- implements OnInit, OnDestroy
+ implements OnInit
{
model$ = this.select();
diff --git a/apps/demos/src/app/rx-angular-pocs/cdk/utils/rxjs/operators/queueWith.ts b/apps/demos/src/app/rx-angular-pocs/cdk/utils/rxjs/operators/queueWith.ts
deleted file mode 100644
index c88cbfbe68..0000000000
--- a/apps/demos/src/app/rx-angular-pocs/cdk/utils/rxjs/operators/queueWith.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-import { mergeMap } from 'rxjs/operators';
-import { Observable } from 'rxjs';
-import { TaskQueue } from '../scheduler/priority/task-queue';
-import { PrioritySchedulingOptions } from '../scheduler/priority';
-
-export function queueWith(h: TaskQueue
, p: PrioritySchedulingOptions
) {
- return (o$: Observable<(...args: any[]) => void>) => o$.pipe(
- mergeMap(w => new Observable(s => {
- const id = h.queueTask(() => () => s.next(w()), p);
- return () => {
- h.dequeueTask(id);
- }
- }))
- );
-}
diff --git a/apps/demos/src/app/shared/debug-helper/cd-env/cd-env/cd-env.component.ts b/apps/demos/src/app/shared/debug-helper/cd-env/cd-env/cd-env.component.ts
index 27ab8aae17..d36d806afb 100644
--- a/apps/demos/src/app/shared/debug-helper/cd-env/cd-env/cd-env.component.ts
+++ b/apps/demos/src/app/shared/debug-helper/cd-env/cd-env/cd-env.component.ts
@@ -4,24 +4,22 @@ import { CdHelper } from '../../../utils/cd-helper';
@Component({
selector: 'rxa-cd-env',
- template: `
-
-
- {{changeDetection}}
-
-
-
-
-
- `,
+ template: `
+
+ {{ changeDetection }}
+
+
+
+
+ `,
+ standalone: false,
host: {
- class: 'd-block w-100'
+ class: 'd-block w-100',
},
changeDetection: environment.changeDetection,
- providers: [CdHelper]
+ providers: [CdHelper],
})
export class CdEnvComponent {
changeDetection = environment.changeDetection;
- constructor(public cdHelper: CdHelper) {
- }
+ constructor(public cdHelper: CdHelper) {}
}
diff --git a/apps/demos/src/app/shared/debug-helper/i-frame/i-frame.module.ts b/apps/demos/src/app/shared/debug-helper/i-frame/i-frame.module.ts
deleted file mode 100644
index e1dc623117..0000000000
--- a/apps/demos/src/app/shared/debug-helper/i-frame/i-frame.module.ts
+++ /dev/null
@@ -1,16 +0,0 @@
-import { NgModule } from '@angular/core';
-import { CommonModule } from '@angular/common';
-import { IFrameComponent } from './i-frame/i-frame.component';
-import { RxLetModule } from '../../../features/experiments/structural-directives/rx-let/rx-let.module';
-
-
-@NgModule({
- declarations: [IFrameComponent],
- imports: [
- CommonModule,
- RxLetModule
- ],
- exports: [IFrameComponent]
-})
-export class IFrameModule {
-}
diff --git a/apps/demos/src/app/shared/debug-helper/i-frame/i-frame/i-frame.component.ts b/apps/demos/src/app/shared/debug-helper/i-frame/i-frame/i-frame.component.ts
deleted file mode 100644
index 16c510ae31..0000000000
--- a/apps/demos/src/app/shared/debug-helper/i-frame/i-frame/i-frame.component.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-import { ChangeDetectionStrategy, Component, Input, OnInit } from '@angular/core';
-import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser';
-
-@Component({
- selector: 'rxa-i-frame',
- template: `
- `,
- host: {
- class: 'd-block w-100'
- },
- changeDetection: ChangeDetectionStrategy.OnPush
-})
-export class IFrameComponent implements OnInit {
-
- @Input()
- url;
-
- urlSafe: SafeResourceUrl;
-
- constructor(public sanitizer: DomSanitizer) {
- }
-
- ngOnInit() {
- this.urlSafe = this.sanitizer.bypassSecurityTrustResourceUrl(this.url);
- }
-}
diff --git a/apps/demos/src/app/shared/debug-helper/ripple/ripple.component.ts b/apps/demos/src/app/shared/debug-helper/ripple/ripple.component.ts
index 9e1866c203..60e640f94b 100644
--- a/apps/demos/src/app/shared/debug-helper/ripple/ripple.component.ts
+++ b/apps/demos/src/app/shared/debug-helper/ripple/ripple.component.ts
@@ -1,4 +1,11 @@
-import { ChangeDetectionStrategy, Component, ElementRef, Input, Renderer2, ViewChild } from '@angular/core';
+import {
+ ChangeDetectionStrategy,
+ Component,
+ ElementRef,
+ Input,
+ Renderer2,
+ ViewChild,
+} from '@angular/core';
import { MatRipple } from '@angular/material/core';
import { Hooks } from '../hooks';
import { RxState } from '@rx-angular/state';
@@ -10,13 +17,18 @@ import { isObservable, Observable, of } from 'rxjs';
selector: 'rxa-ripple',
changeDetection: ChangeDetectionStrategy.Default,
template: `
- {{dirty()}}
-
-
+ {{ dirty() }}
+
+
`,
- providers: [RxState]
+ providers: [RxState],
+ standalone: false,
})
export class RippleComponent extends Hooks {
@ViewChild(MatRipple) ripple: MatRipple;
@@ -46,28 +58,32 @@ export class RippleComponent extends Hooks {
private elementRef: ElementRef,
private renderer: Renderer2,
private configService: AppConfigService,
- private state: RxState<{ value: any }>
+ private state: RxState<{ value: any }>,
) {
super();
this.state.hold(this.afterViewInit$, (v) => {
- console.log('hold: ', this.elementRef.nativeElement.children[0].children[0]);
- this.displayElem = this.elementRef.nativeElement.children[0].children[0]
+ console.log(
+ 'hold: ',
+ this.elementRef.nativeElement.children[0].children[0],
+ );
+ this.displayElem = this.elementRef.nativeElement.children[0].children[0];
});
this.state.hold(
this.afterViewInit$.pipe(switchMap(() => this.state.select('value'))),
- (v) => this.render(v)
+ (v) => this.render(v),
);
}
dirty() {
- if(this.always) {
- this.render('')
+ if (this.always) {
+ this.render('');
}
}
render(value: any) {
this.rippleOn && this.ripple && this.ripple.launch(this.rippleEffect);
- this.displayElem && this.renderer.setProperty(this.displayElem, 'innerHTML', value + '');
+ this.displayElem &&
+ this.renderer.setProperty(this.displayElem, 'innerHTML', value + '');
console.log(this.name, ' called');
}
}
diff --git a/apps/demos/src/app/shared/debug-helper/value-provider/array-provider.service.ts b/apps/demos/src/app/shared/debug-helper/value-provider/array-provider.service.ts
index 2f3b5bef4f..59a071bf7a 100644
--- a/apps/demos/src/app/shared/debug-helper/value-provider/array-provider.service.ts
+++ b/apps/demos/src/app/shared/debug-helper/value-provider/array-provider.service.ts
@@ -43,6 +43,7 @@ export class ArrayProviderService extends RxState
{
protected moveItemsMutableSubject = new Subject();
protected updateItemsMutableSubject = new Subject();
protected removeItemsMutableSubject = new Subject();
+ protected swapItemsSubject = new Subject();
private resetAll = () => {
this.resetObservables();
@@ -106,6 +107,18 @@ export class ArrayProviderService extends RxState {
addItemImmutable([], itemsToAdd ?? 0),
);
+ this.connect('array', this.swapItemsSubject, (state) => {
+ const data = state?.array || [];
+ if (data.length > 2) {
+ const first = data[0];
+ const last = data[data.length - 1];
+ data[0] = last;
+ data[data.length - 1] = first;
+ return [...data];
+ }
+ return data;
+ });
+
this.resetAll();
}
@@ -127,6 +140,10 @@ export class ArrayProviderService extends RxState {
});
}
+ swap() {
+ this.swapItemsSubject.next();
+ }
+
shuffleItemsImmutable(): void {
this.shuffleItemsImmutableSubject.next();
}
diff --git a/apps/demos/src/app/shared/debug-helper/value-provider/array-provider/array-provider.component.ts b/apps/demos/src/app/shared/debug-helper/value-provider/array-provider/array-provider.component.ts
index ac27db3c8f..ab49817f53 100644
--- a/apps/demos/src/app/shared/debug-helper/value-provider/array-provider/array-provider.component.ts
+++ b/apps/demos/src/app/shared/debug-helper/value-provider/array-provider/array-provider.component.ts
@@ -91,6 +91,9 @@ import { ArrayProviderService } from '../array-provider.service';
>
Shuffle Attack
+