@rx-angular/cdk
Version:
@rx-angular/cdk is a Component Development Kit for ergonomic and highly performant angular applications. It helps to to build Large scale applications, UI libs, state management, rendering systems and much more. Furthermore the unique way of mixing reacti
1 lines • 29.7 kB
Source Map (JSON)
{"version":3,"file":"cdk-render-strategies.mjs","sources":["../../../../libs/cdk/render-strategies/src/lib/concurrent-strategies.ts","../../../../libs/cdk/render-strategies/src/lib/native-strategies.ts","../../../../libs/cdk/render-strategies/src/lib/config.ts","../../../../libs/cdk/render-strategies/src/lib/onStrategy.ts","../../../../libs/cdk/render-strategies/src/lib/strategy-handling.ts","../../../../libs/cdk/render-strategies/src/lib/strategy-provider.service.ts","../../../../libs/cdk/render-strategies/src/cdk-render-strategies.ts"],"sourcesContent":["import { NgZone } from '@angular/core';\nimport { coalescingManager, coalescingObj } from '@rx-angular/cdk/coalescing';\nimport {\n cancelCallback,\n forceFrameRate,\n PriorityLevel,\n scheduleCallback,\n} from '@rx-angular/cdk/internals/scheduler';\nimport { MonoTypeOperatorFunction, Observable } from 'rxjs';\nimport { filter, mapTo, switchMap } from 'rxjs/operators';\nimport {\n RxConcurrentStrategyNames,\n RxCustomStrategyCredentials,\n RxStrategyCredentials,\n} from './model';\n\n// set default to 60fps\nforceFrameRate(60);\n\nconst immediateStrategy: RxStrategyCredentials = {\n name: 'immediate',\n work: (cdRef) => cdRef.detectChanges(),\n behavior: ({ work, scope, ngZone }) => {\n return (o$) =>\n o$.pipe(\n scheduleOnQueue(work, {\n ngZone,\n priority: PriorityLevel.ImmediatePriority,\n scope,\n })\n );\n },\n};\n\nconst userBlockingStrategy: RxStrategyCredentials = {\n name: 'userBlocking',\n work: (cdRef) => cdRef.detectChanges(),\n behavior: ({ work, scope, ngZone }) => {\n return (o$) =>\n o$.pipe(\n scheduleOnQueue(work, {\n ngZone,\n priority: PriorityLevel.UserBlockingPriority,\n scope,\n })\n );\n },\n};\n\nconst normalStrategy: RxStrategyCredentials = {\n name: 'normal',\n work: (cdRef) => cdRef.detectChanges(),\n behavior: ({ work, scope, ngZone }) => {\n return (o$) =>\n o$.pipe(\n scheduleOnQueue(work, {\n ngZone,\n priority: PriorityLevel.NormalPriority,\n scope,\n })\n );\n },\n};\n\nconst lowStrategy: RxStrategyCredentials = {\n name: 'low',\n work: (cdRef) => cdRef.detectChanges(),\n behavior: ({ work, scope, ngZone }) => {\n return (o$) =>\n o$.pipe(\n scheduleOnQueue(work, {\n ngZone,\n priority: PriorityLevel.LowPriority,\n scope,\n })\n );\n },\n};\n\nconst idleStrategy: RxStrategyCredentials = {\n name: 'idle',\n work: (cdRef) => cdRef.detectChanges(),\n behavior: ({ work, scope, ngZone }) => {\n return (o$) =>\n o$.pipe(\n scheduleOnQueue(work, {\n ngZone,\n priority: PriorityLevel.IdlePriority,\n scope,\n })\n );\n },\n};\n\nfunction scheduleOnQueue<T>(\n work: (...args: any[]) => void,\n options: {\n priority: PriorityLevel;\n scope: coalescingObj;\n delay?: number;\n ngZone: NgZone;\n }\n): MonoTypeOperatorFunction<T> {\n const scope = (options.scope as Record<string, unknown>) || {};\n return (o$: Observable<T>): Observable<T> =>\n o$.pipe(\n filter(() => !coalescingManager.isCoalescing(scope)),\n switchMap((v) =>\n new Observable<T>((subscriber) => {\n coalescingManager.add(scope);\n const task = scheduleCallback(\n options.priority,\n () => {\n work();\n coalescingManager.remove(scope);\n subscriber.next(v);\n },\n { delay: options.delay, ngZone: options.ngZone }\n );\n return () => {\n coalescingManager.remove(scope);\n cancelCallback(task);\n };\n }).pipe(mapTo(v))\n )\n );\n}\n\nexport type RxConcurrentStrategies =\n RxCustomStrategyCredentials<RxConcurrentStrategyNames>;\nexport const RX_CONCURRENT_STRATEGIES: RxConcurrentStrategies = {\n immediate: immediateStrategy,\n userBlocking: userBlockingStrategy,\n normal: normalStrategy,\n low: lowStrategy,\n idle: idleStrategy,\n};\n","import { NgZone } from '@angular/core';\nimport { coalesceWith } from '@rx-angular/cdk/coalescing';\nimport { getZoneUnPatchedApi } from '@rx-angular/cdk/internals/core';\nimport { Observable } from 'rxjs';\nimport { tap } from 'rxjs/operators';\nimport {\n RxCustomStrategyCredentials,\n RxNativeStrategyNames,\n RxStrategyCredentials,\n} from './model';\n\nconst animationFrameTick = () =>\n new Observable<number>((subscriber) => {\n // use the unpatched API no avoid zone interference\n const id = getZoneUnPatchedApi('requestAnimationFrame')(() => {\n subscriber.next(0);\n subscriber.complete();\n });\n return () => {\n // use the unpatched API no avoid zone interference\n getZoneUnPatchedApi('cancelAnimationFrame')(id);\n };\n });\n\nconst localCredentials: RxStrategyCredentials = {\n name: 'local',\n work: (cdRef, _, notification) => {\n cdRef.detectChanges();\n },\n behavior:\n ({ work, scope, ngZone }) =>\n (o$) =>\n o$.pipe(\n coalesceWith(animationFrameTick(), scope as Record<string, unknown>),\n tap(() => (ngZone ? ngZone.run(() => work()) : work()))\n ),\n};\n\nconst noopCredentials: RxStrategyCredentials = {\n name: 'noop',\n work: () => void 0,\n behavior: () => (o$) => o$,\n};\n\nconst nativeCredentials: RxStrategyCredentials = {\n name: 'native',\n work: (cdRef) => cdRef.markForCheck(),\n behavior:\n ({ work, ngZone }) =>\n (o$) =>\n o$.pipe(\n tap(() =>\n ngZone && !NgZone.isInAngularZone()\n ? ngZone.run(() => work())\n : work()\n )\n ),\n};\n\nexport type RxNativeStrategies =\n RxCustomStrategyCredentials<RxNativeStrategyNames>;\nexport const RX_NATIVE_STRATEGIES: RxNativeStrategies = {\n native: nativeCredentials,\n noop: noopCredentials,\n local: localCredentials,\n};\n","import { InjectionToken, Provider } from '@angular/core';\nimport { RX_CONCURRENT_STRATEGIES } from './concurrent-strategies';\nimport {\n RxCustomStrategyCredentials,\n RxDefaultStrategyNames,\n RxStrategyNames,\n} from './model';\nimport { RX_NATIVE_STRATEGIES } from './native-strategies';\n\nexport interface RxRenderStrategiesConfig<T extends string> {\n primaryStrategy?: RxStrategyNames<T>;\n customStrategies?: RxCustomStrategyCredentials<T>;\n patchZone?: boolean;\n /**\n * @deprecated This flag will be dropped soon, as it is no longer required when using signal based view & content queries\n */\n parent?: boolean;\n}\n\nexport const RX_RENDER_STRATEGIES_CONFIG = new InjectionToken<\n RxRenderStrategiesConfig<string>\n>('rxa-render-strategies-config');\n\nexport const RX_RENDER_STRATEGIES_DEFAULTS: Required<\n RxRenderStrategiesConfig<RxDefaultStrategyNames>\n> = {\n primaryStrategy: 'normal',\n customStrategies: {\n ...RX_NATIVE_STRATEGIES,\n ...RX_CONCURRENT_STRATEGIES,\n },\n patchZone: true,\n parent: false,\n} as const;\n\nexport function mergeDefaultConfig<T extends string>(\n cfg?: RxRenderStrategiesConfig<T>,\n): Required<RxRenderStrategiesConfig<T | RxDefaultStrategyNames>> {\n const custom: RxRenderStrategiesConfig<T> = cfg\n ? cfg\n : ({ customStrategies: {} } as any);\n return {\n ...RX_RENDER_STRATEGIES_DEFAULTS,\n ...custom,\n customStrategies: {\n ...custom.customStrategies,\n ...RX_RENDER_STRATEGIES_DEFAULTS.customStrategies,\n },\n };\n}\n\n/**\n * @description\n * Can be used to set the default render strategy or create custom render strategies.\n *\n * With this function you can customize the behavior of:\n * - `rxLet` directive\n * - `rxFor` directive\n * - `rxIf` directive\n * - `rxVirtualFor` directive\n * - `rxVirtualView` directive\n * - `RxStrategyProvider` service.\n *\n * @example\n * import { provideRxRenderStrategies } from '@rx-angular/cdk/render-strategies';\n *\n * const appConfig: ApplicationConfig = {\n * providers: [\n * provideRxRenderStrategies({\n * primaryStrategy: 'sync',\n * customStrategies: {\n * sync: {\n * name: 'sync',\n * work: (cdRef) => { cdRef.detectChanges(); },\n * behavior: ({ work }) => (o$) => o$.pipe(tap(() => work()))\n * },\n * asap: {\n * name: 'asap',\n * work: (cdRef) => { cdRef.detectChanges(); },\n * behavior: ({ work }) => (o$) => o$.pipe(delay(0, asapScheduler), tap(() => work()))\n * },\n * }),\n * ],\n * };\n *\n * @param config - The configuration object.\n * @returns A provider that can be used to set the default render strategy or create custom render strategies.\n */\nexport function provideRxRenderStrategies(\n config: RxRenderStrategiesConfig<string>,\n): Provider {\n return {\n provide: RX_RENDER_STRATEGIES_CONFIG,\n useValue: mergeDefaultConfig(config),\n } satisfies Provider;\n}\n","import { NgZone } from '@angular/core';\nimport { RxCoalescingOptions } from '@rx-angular/cdk/coalescing';\nimport { Observable, throwError } from 'rxjs';\nimport { catchError, map, take } from 'rxjs/operators';\nimport { RxRenderWork, RxStrategyCredentials } from './model';\n\n/**\n * @internal\n *\n * @param value\n * @param strategy\n * @param workFactory\n * @param options\n */\nexport function onStrategy<T>(\n value: T,\n strategy: RxStrategyCredentials,\n workFactory: (\n value: T,\n work: RxRenderWork,\n options: RxCoalescingOptions\n ) => void,\n options: RxCoalescingOptions & { ngZone?: NgZone } = {}\n): Observable<T> {\n return new Observable<T>((subscriber) => {\n subscriber.next(value);\n }).pipe(\n strategy.behavior({\n work: () => workFactory(value, strategy.work, options),\n scope: (options.scope as Record<string, unknown>) || {},\n ngZone: options.ngZone,\n }),\n catchError((error) => throwError(() => [error, value])),\n map(() => value),\n take(1)\n );\n}\n","import { coerceAllFactory } from '@rx-angular/cdk/coercing';\nimport { Observable, ReplaySubject } from 'rxjs';\nimport { map, share, startWith, switchAll } from 'rxjs/operators';\nimport {\n RxCustomStrategyCredentials,\n RxStrategyCredentials,\n RxStrategyNames,\n} from './model';\n\nexport interface RxStrategyHandler {\n strategy$: Observable<RxStrategyCredentials>;\n next(name: RxStrategyNames | Observable<RxStrategyNames>): void;\n}\n\n/**\n * @internal\n *\n * A factory function returning an object to handle the process of turning strategy names into `RxStrategyCredentials`\n * You can next a strategy name as Observable or string and get an Observable of `RxStrategyCredentials`\n *\n * @param defaultStrategyName\n * @param strategies\n */\nexport function strategyHandling(\n defaultStrategyName: string,\n strategies: RxCustomStrategyCredentials<string>\n): RxStrategyHandler {\n const hotFlattened = coerceAllFactory<string>(\n () => new ReplaySubject<RxStrategyNames | Observable<RxStrategyNames>>(1),\n switchAll()\n );\n return {\n strategy$: hotFlattened.values$.pipe(\n startWith(defaultStrategyName),\n nameToStrategyCredentials(strategies, defaultStrategyName),\n share()\n ) as Observable<RxStrategyCredentials>,\n next(name: RxStrategyNames | Observable<RxStrategyNames>) {\n hotFlattened.next(name);\n },\n };\n}\n\n/**\n * @internal\n */\nfunction nameToStrategyCredentials(\n strategies: RxCustomStrategyCredentials<string>,\n defaultStrategyName: string\n) {\n return (\n o$: Observable<string | null | undefined>\n ): Observable<RxStrategyCredentials> =>\n o$.pipe(\n map((name) =>\n name && Object.keys(strategies).includes(name)\n ? strategies[name]\n : strategies[defaultStrategyName]\n )\n );\n}\n","import {\n ChangeDetectorRef,\n Inject,\n Injectable,\n NgZone,\n Optional,\n} from '@angular/core';\nimport {\n BehaviorSubject,\n fromEvent,\n MonoTypeOperatorFunction,\n Observable,\n} from 'rxjs';\nimport { map, shareReplay, switchMap, takeUntil } from 'rxjs/operators';\nimport {\n mergeDefaultConfig,\n RX_RENDER_STRATEGIES_CONFIG,\n RxRenderStrategiesConfig,\n} from './config';\nimport {\n RxStrategies,\n RxStrategyCredentials,\n RxStrategyNames,\n ScheduleOnStrategyOptions,\n} from './model';\nimport { onStrategy } from './onStrategy';\n\n/**\n * @description\n * RxStrategyProvider is a wrapper service that you can use to consume strategies and schedule your code execution.\n *\n * @example\n * Component({\n * selector: 'app-service-communicator',\n * template: ``\n * });\n * export class ServiceCommunicationComponent {\n * private currentUserSettings;\n *\n * constructor(\n * private strategyProvider: RxStrategyProvider,\n * private userService: UserService,\n * private backgroundSync: BackgroundSyncService\n * ) {\n * this.userService.fetchCurrentUserSettings\n * .pipe(\n * tap(settings => (this.currentUserSettings = settings)),\n * this.strategyProvider.scheduleWith(\n * settings => this.backgroundSync.openConnection(settings),\n * { strategy: 'idle' }\n * )\n * )\n * .subscribe();\n * }\n * }\n *\n * @docsCategory RxStrategyProvider\n * @docsPage RxStrategyProvider\n */\n@Injectable({ providedIn: 'root' })\nexport class RxStrategyProvider<T extends string = string> {\n private _strategies$ = new BehaviorSubject<RxStrategies<T>>(undefined);\n private _primaryStrategy$ = new BehaviorSubject<\n RxStrategyCredentials<RxStrategyNames<T>>\n >(undefined);\n\n private readonly _cfg: Required<RxRenderStrategiesConfig<T>>;\n\n /**\n * @description\n * Returns current `RxAngularConfig` used in the service.\n * Config includes:\n * - strategy that currently in use - `primaryStrategy`\n * - array of custom user defined strategies - `customStrategies`\n * - setting that is responsible for running in our outside of the zone.js - `patchZone`\n */\n get config(): Required<RxRenderStrategiesConfig<T>> {\n return this._cfg;\n }\n\n /**\n * @description\n * Returns object that contains key-value pairs of strategy names and their credentials (settings) that are available in the service.\n */\n get strategies(): RxStrategies<T> {\n return this._strategies$.getValue();\n }\n\n /**\n * @description\n * Returns an array of strategy names available in the service.\n */\n get strategyNames(): string[] {\n return Object.values(this.strategies).map((s) => s.name);\n }\n\n /**\n * @description\n * Returns current strategy of the service.\n */\n get primaryStrategy(): RxStrategyNames<T> {\n return this._primaryStrategy$.getValue().name;\n }\n\n /**\n * @description\n * Set's the strategy that will be used by the service.\n */\n set primaryStrategy(strategyName: RxStrategyNames<T>) {\n this._primaryStrategy$.next(\n <RxStrategyCredentials<RxStrategyNames<T>>>this.strategies[strategyName]\n );\n }\n\n /**\n * @description\n * Current strategy of the service as an observable.\n */\n readonly primaryStrategy$: Observable<RxStrategyCredentials> =\n this._primaryStrategy$.asObservable();\n\n /**\n * @description\n * Returns observable of an object that contains key-value pairs of strategy names and their credentials (settings) that are available in the service.\n */\n readonly strategies$ = this._strategies$.asObservable();\n\n /**\n * @description\n * Returns an observable of an array of strategy names available in the service.\n */\n readonly strategyNames$ = this.strategies$.pipe(\n map((strategies) => Object.values(strategies).map((s) => s.name)),\n shareReplay({ bufferSize: 1, refCount: true })\n );\n\n /**\n * @internal\n */\n constructor(\n @Optional()\n @Inject(RX_RENDER_STRATEGIES_CONFIG)\n cfg: RxRenderStrategiesConfig<T>\n ) {\n this._cfg = mergeDefaultConfig(cfg);\n this._strategies$.next(this._cfg.customStrategies as any);\n this.primaryStrategy = this.config.primaryStrategy;\n }\n\n /**\n * @description\n * Allows to schedule a work inside rxjs `pipe`. Accepts the work and configuration options object.\n * - work is any function that should be executed\n * - (optional) options includes strategy, patchZone and scope\n *\n * Scope is by default a subscription but you can also pass `this` and then the scope will be current component.\n * Scope setup is useful if your work is some of the methods of `ChangeDetectorRef`. Only one change detection will be triggered if you have multiple schedules of change detection methods and scope is set to `this`.\n *\n * @example\n * myObservable$.pipe(\n * this.strategyProvider.scheduleWith(() => myWork(), {strategy: 'idle', patchZone: false})\n * ).subscribe();\n *\n * @return MonoTypeOperatorFunction<R>\n */\n scheduleWith<R>(\n work: (v?: R) => void,\n options?: ScheduleOnStrategyOptions\n ): MonoTypeOperatorFunction<R> {\n const strategy = this.strategies[options?.strategy || this.primaryStrategy];\n const scope = options?.scope || {};\n const _work = getWork(work, options?.patchZone);\n const ngZone = options?.patchZone || undefined;\n return (o$) =>\n o$.pipe(\n switchMap((v) =>\n onStrategy(\n v,\n strategy,\n (_v) => {\n _work(_v);\n },\n { scope, ngZone }\n )\n )\n );\n }\n\n /**\n * @description\n * Allows to schedule a work as an observable. Accepts the work and configuration options object.\n * - work is any function that should be executed\n * - (optional) options includes strategy, patchZone and scope\n *\n * Scope is by default a subscription but you can also pass `this` and then the scope will be current component.\n * Scope setup is especially useful if you provide work that will trigger a change detection.\n *\n * @example\n * this.strategyProvider.schedule(() => myWork(), {strategy: 'idle', patchZone: false}).subscribe();\n *\n * @return Observable<R>\n */\n schedule<R>(\n work: () => R,\n options?: ScheduleOnStrategyOptions\n ): Observable<R> {\n const strategy = this.strategies[options?.strategy || this.primaryStrategy];\n const scope = options?.scope || {};\n const _work = getWork(work, options?.patchZone);\n const ngZone = options?.patchZone || undefined;\n let returnVal: R;\n return onStrategy(\n null,\n strategy,\n () => {\n returnVal = _work();\n },\n { scope, ngZone }\n ).pipe(map(() => returnVal));\n }\n\n /**\n * @description\n * Allows to schedule a change detection cycle. Accepts the ChangeDetectorRef and configuration options object.\n * Options include:\n * - afterCD which is the work that should be executed after change detection cycle.\n * - abortCtrl is an AbortController that you can use to cancel the scheduled cycle.\n *\n * @example\n * this.strategyProvider.scheduleCd(this.changeDetectorRef, {afterCD: myWork()});\n *\n * @return AbortController\n */\n scheduleCD(\n cdRef: ChangeDetectorRef,\n options?: ScheduleOnStrategyOptions & {\n afterCD?: () => void;\n abortCtrl?: AbortController;\n }\n ): AbortController {\n const strategy = this.strategies[options?.strategy || this.primaryStrategy];\n const scope = options?.scope || cdRef;\n const abC = options?.abortCtrl || new AbortController();\n const ngZone = options?.patchZone || undefined;\n const work = getWork(() => {\n strategy.work(cdRef, scope);\n if (options?.afterCD) {\n options.afterCD();\n }\n }, options.patchZone);\n onStrategy(\n null,\n strategy,\n () => {\n work();\n },\n { scope, ngZone }\n )\n .pipe(takeUntil(fromEvent(abC.signal, 'abort')))\n .subscribe();\n return abC;\n }\n}\n\nfunction getWork<T>(\n work: (args?: any) => T,\n patchZone?: false | NgZone\n): (args?: any) => T {\n let _work = work;\n if (patchZone) {\n _work = (args?: any) => patchZone.run(() => work(args));\n }\n return _work;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;AAgBA;AACA,cAAc,CAAC,EAAE,CAAC;AAElB,MAAM,iBAAiB,GAA0B;AAC/C,IAAA,IAAI,EAAE,WAAW;IACjB,IAAI,EAAE,CAAC,KAAK,KAAK,KAAK,CAAC,aAAa,EAAE;IACtC,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,KAAI;AACpC,QAAA,OAAO,CAAC,EAAE,KACR,EAAE,CAAC,IAAI,CACL,eAAe,CAAC,IAAI,EAAE;YACpB,MAAM;AACN,YAAA,QAAQ,EAAiC,CAAA;YACzC,KAAK;AACN,SAAA,CAAC,CACH;KACJ;CACF;AAED,MAAM,oBAAoB,GAA0B;AAClD,IAAA,IAAI,EAAE,cAAc;IACpB,IAAI,EAAE,CAAC,KAAK,KAAK,KAAK,CAAC,aAAa,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