Skip to content

Commit 86b52d1

Browse files
committed
feat(angular): move to standalone components and directives
1 parent 4f69809 commit 86b52d1

File tree

48 files changed

+130
-67
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+130
-67
lines changed

projects/interacto-angular/src/lib/components/dwell-spring/dwell-spring.component.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ describe('DwellSpringComponent', () => {
88

99
beforeEach(() => {
1010
TestBed.configureTestingModule({
11-
declarations: [DwellSpringComponent]
11+
imports: [DwellSpringComponent]
1212
});
1313
fixture = TestBed.createComponent(DwellSpringComponent);
1414
component = fixture.componentInstance;

projects/interacto-angular/src/lib/components/dwell-spring/dwell-spring.component.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ import { Component, ElementRef, ViewChild } from '@angular/core';
33
@Component({
44
selector: 'io-dwell-spring',
55
templateUrl: './dwell-spring.component.html',
6-
styleUrls: ['./dwell-spring.component.css']
6+
styleUrls: ['./dwell-spring.component.css'],
7+
standalone: true
78
})
89
export class DwellSpringComponent {
910
@ViewChild('handle')

projects/interacto-angular/src/lib/components/linear-history/linear-history.component.spec.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
import {ComponentFixture, TestBed} from '@angular/core/testing';
22

33
import {LinearHistoryComponent} from './linear-history.component';
4-
import {InteractoModule} from '../../interacto-angular.module';
4+
import {TestingInteractoModule} from '../../testing-interacto-angular.module';
55

66
describe('LinearHistoryComponent', () => {
77
let component: LinearHistoryComponent;
88
let fixture: ComponentFixture<LinearHistoryComponent>;
99

1010
beforeEach(async () => {
1111
await TestBed.configureTestingModule({
12-
declarations: [LinearHistoryComponent],
13-
imports: [InteractoModule]
12+
imports: [TestingInteractoModule, LinearHistoryComponent]
1413
})
1514
.compileComponents();
1615
});

projects/interacto-angular/src/lib/components/linear-history/linear-history.component.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
11
import {AfterViewInit, Component, ElementRef, Input, Optional, ViewChild} from '@angular/core';
22
import {Bindings, RedoNTimes, Undoable, UndoHistory, UndoHistoryBase, UndoNTimes} from 'interacto';
3+
import {CommonModule} from '@angular/common';
4+
import {UndoBinderDirective} from '../../directives/undo-binder.directive';
5+
import {RedoBinderDirective} from '../../directives/redo-binder.directive';
36

47
@Component({
58
selector: 'io-linear-history',
69
templateUrl: './linear-history.component.html',
7-
styleUrls: ['./linear-history.component.css']
10+
styleUrls: ['./linear-history.component.css'],
11+
standalone: true,
12+
imports: [
13+
CommonModule,
14+
UndoBinderDirective,
15+
RedoBinderDirective
16+
]
817
})
918
export class LinearHistoryComponent implements AfterViewInit {
1019
@ViewChild('undoButtonContainer')

projects/interacto-angular/src/lib/components/tree-history/tree-history.component.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type {KeyValue} from '@angular/common';
1+
import {CommonModule, KeyValue} from '@angular/common';
22
import {
33
AfterViewInit,
44
ChangeDetectionStrategy,
@@ -10,6 +10,11 @@ import {
1010
} from '@angular/core';
1111
import { Binding, PartialPointTypedBinder, PartialTapsTypedBinder, PartialTouchTypedBinder, TreeUndoHistory, UndoableSnapshot, UndoableTreeNode } from 'interacto';
1212
import { Subscription } from "rxjs";
13+
import {UndoBinderDirective} from '../../directives/undo-binder.directive';
14+
import {RedoBinderDirective} from '../../directives/redo-binder.directive';
15+
import {ClickBinderDirective} from '../../directives/click-binder.directive';
16+
import {TapsBinderDirective} from '../../directives/taps-binder.directive';
17+
import {LongTouchBinderDirective} from '../../directives/long-touch-binder.directive';
1318

1419
/**
1520
* The Angular component for display a tree-based undo/redo history
@@ -18,6 +23,15 @@ import { Subscription } from "rxjs";
1823
selector: 'io-tree-history',
1924
templateUrl: './tree-history.component.html',
2025
styleUrls: ['./tree-history.component.css'],
26+
standalone: true,
27+
imports: [
28+
CommonModule,
29+
UndoBinderDirective,
30+
RedoBinderDirective,
31+
ClickBinderDirective,
32+
TapsBinderDirective,
33+
LongTouchBinderDirective
34+
],
2135
changeDetection: ChangeDetectionStrategy.OnPush
2236
})
2337
export class TreeHistoryComponent implements OnDestroy, AfterViewInit {

projects/interacto-angular/src/lib/directives/anchor-binder.directive.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import {InteractoBinderDirective} from './interacto-binder-directive';
44
import {OnDynamicDirective} from './on-dynamic.directive';
55

66
@Directive({
7-
selector: 'a:[ioAnchor],[ioAnchor] [ioOnDynamic]'
7+
selector: 'a:[ioAnchor],[ioAnchor] [ioOnDynamic]',
8+
standalone: true
89
})
910
export class AnchorBinderDirective extends InteractoBinderDirective<HTMLAnchorElement, PartialAnchorTypedBinder> {
1011
@Output()

projects/interacto-angular/src/lib/directives/button-binder.directive.spec.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ let ctx: BindingsContext;
2020
<div id="b2" ioOnDynamic [ioButton]="m2"><button id="b4">B</button></div>
2121
<button id="b3" [ioButton] (buttonBinder)="m3($event, 123)">b3</button>
2222
<button ioButton>Bad</button>
23-
<button [ioButton]="rr">Bad2</button>`
23+
<button [ioButton]="rr">Bad2</button>`,
24+
standalone: true,
25+
imports: [ButtonBinderDirective, OnDynamicDirective]
2426
})
2527
class TestComponent {
2628
public param: number = 0;
@@ -53,8 +55,7 @@ class TestComponent {
5355
describe('button directive', () => {
5456
beforeEach(() => {
5557
fixture = TestBed.configureTestingModule({
56-
imports: [TestingInteractoModule],
57-
declarations: [ButtonBinderDirective, OnDynamicDirective, TestComponent]
58+
imports: [TestingInteractoModule, ButtonBinderDirective, OnDynamicDirective, TestComponent]
5859
}).createComponent(TestComponent);
5960

6061
fixture.detectChanges();

projects/interacto-angular/src/lib/directives/button-binder.directive.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import {InteractoBinderDirective} from './interacto-binder-directive';
44
import {OnDynamicDirective} from './on-dynamic.directive';
55

66
@Directive({
7-
selector: 'button:[ioButton],[ioButton] [ioOnDynamic]'
7+
selector: 'button:[ioButton],[ioButton] [ioOnDynamic]',
8+
standalone: true
89
})
910
export class ButtonBinderDirective extends InteractoBinderDirective<HTMLButtonElement | HTMLElement, PartialButtonTypedBinder> {
1011
@Output()

projects/interacto-angular/src/lib/directives/click-binder.directive.spec.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ let ctx: BindingsContext;
2222
<div id="b" ioOnDynamic [ioClick]="methodDyn"><b id="b1">B</b></div>
2323
<b id="b2" [ioClick] (clickBinder)="methodParam($event, 'foo')"></b>
2424
<b ioClick>bad</b>
25-
<b [ioClick]="fff">bad2</b>`
25+
<b [ioClick]="fff">bad2</b>`,
26+
standalone: true,
27+
imports: [ClickBinderDirective, OnDynamicDirective]
2628
})
2729
class TestComponent {
2830
public param: string = "";
@@ -62,8 +64,7 @@ class TestComponent {
6264
describe('click directive', () => {
6365
beforeEach(() => {
6466
fixture = TestBed.configureTestingModule({
65-
imports: [TestingInteractoModule],
66-
declarations: [ClickBinderDirective, OnDynamicDirective, TestComponent]
67+
imports: [TestingInteractoModule, ClickBinderDirective, OnDynamicDirective, TestComponent]
6768
}).createComponent(TestComponent);
6869

6970
fixture.detectChanges();

projects/interacto-angular/src/lib/directives/click-binder.directive.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import {InteractoBinderDirective} from './interacto-binder-directive';
44
import {OnDynamicDirective} from './on-dynamic.directive';
55

66
@Directive({
7-
selector: '[ioClick]'
7+
selector: '[ioClick]',
8+
standalone: true
89
})
910
export class ClickBinderDirective extends InteractoBinderDirective<HTMLElement, PartialPointTypedBinder> implements AfterContentInit {
1011
@Output()

0 commit comments

Comments
 (0)