@tethys/cdk 20.0.7 → 21.0.0-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/tethys-cdk-dom.mjs +6 -6
- package/fesm2022/tethys-cdk-dom.mjs.map +1 -1
- package/fesm2022/tethys-cdk-event.mjs +9 -9
- package/fesm2022/tethys-cdk-event.mjs.map +1 -1
- package/fesm2022/tethys-cdk-hotkey.mjs +10 -10
- package/fesm2022/tethys-cdk-hotkey.mjs.map +1 -1
- package/fesm2022/tethys-cdk-immutable.mjs.map +1 -1
- package/package.json +13 -13
- /package/{behaviors/index.d.ts → types/tethys-cdk-behaviors.d.ts} +0 -0
- /package/{dom/index.d.ts → types/tethys-cdk-dom.d.ts} +0 -0
- /package/{event/index.d.ts → types/tethys-cdk-event.d.ts} +0 -0
- /package/{hotkey/index.d.ts → types/tethys-cdk-hotkey.d.ts} +0 -0
- /package/{immutable/index.d.ts → types/tethys-cdk-immutable.d.ts} +0 -0
- /package/{is/index.d.ts → types/tethys-cdk-is.d.ts} +0 -0
- /package/{logger/index.d.ts → types/tethys-cdk-logger.d.ts} +0 -0
- /package/{index.d.ts → types/tethys-cdk.d.ts} +0 -0
|
@@ -79,10 +79,10 @@ class HostRenderer extends AbstractElementRenderer {
|
|
|
79
79
|
get element() {
|
|
80
80
|
return this.elementRef.nativeElement;
|
|
81
81
|
}
|
|
82
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
83
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
82
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: HostRenderer, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
83
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: HostRenderer }); }
|
|
84
84
|
}
|
|
85
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
85
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: HostRenderer, decorators: [{
|
|
86
86
|
type: Injectable
|
|
87
87
|
}] });
|
|
88
88
|
function useHostRenderer() {
|
|
@@ -122,10 +122,10 @@ class ThyStealthView {
|
|
|
122
122
|
this.templateRef = inject((TemplateRef));
|
|
123
123
|
this.stealthViewBehavior = useStealthViewRenderer(this.templateRef);
|
|
124
124
|
}
|
|
125
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
126
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
125
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: ThyStealthView, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
126
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.0.8", type: ThyStealthView, isStandalone: true, selector: "ng-template[thyStealthView]", exportAs: ["thyStealthView"], ngImport: i0 }); }
|
|
127
127
|
}
|
|
128
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
128
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: ThyStealthView, decorators: [{
|
|
129
129
|
type: Directive,
|
|
130
130
|
args: [{
|
|
131
131
|
selector: 'ng-template[thyStealthView]',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tethys-cdk-dom.mjs","sources":["../../../cdk/dom/abstract-element-renderer.ts","../../../cdk/dom/element-renderer.ts","../../../cdk/dom/host-renderer.ts","../../../cdk/dom/stealth-view-renderer.ts","../../../cdk/dom/stealth-view-directive.ts","../../../cdk/dom/tethys-cdk-dom.ts"],"sourcesContent":["import { Renderer2, inject, RendererStyleFlags2 } from '@angular/core';\n\nexport abstract class AbstractElementRenderer {\n private renderer = inject(Renderer2);\n\n protected abstract element?: Element;\n\n private classNames: string[] = [];\n\n private get safeElement() {\n if (!this.element) {\n throw new Error(`Element is null, should call setElement method for ElementRenderer before update dom.`);\n }\n return this.element;\n }\n\n updateClass(classNames: string[]) {\n if (this.classNames) {\n this.classNames.forEach(className => {\n if (classNames.indexOf(className) < 0) {\n this.removeClass(className);\n }\n });\n }\n const newClasses: string[] = [];\n classNames.forEach(className => {\n if (className) {\n newClasses.push(className);\n if (this.classNames.indexOf(className) < 0) {\n this.addClass(className);\n }\n }\n });\n this.classNames = newClasses;\n return this;\n }\n\n updateClassByMap(classMap: Record<string, boolean>) {\n const newClasses = [];\n for (const key in classMap) {\n if (classMap.hasOwnProperty(key) && classMap[key]) {\n newClasses.push(key);\n }\n }\n this.updateClass(newClasses);\n }\n\n addClass(className: string) {\n this.renderer.addClass(this.safeElement, className);\n return this;\n }\n\n removeClass(className: string) {\n this.renderer.removeClass(this.safeElement, className);\n return this;\n }\n\n setStyle(style: string, value: any, flags?: RendererStyleFlags2) {\n this.renderer.setStyle(this.safeElement, style, value, flags);\n return this;\n }\n}\n","import { AbstractElementRenderer } from './abstract-element-renderer';\n\nexport class ElementRenderer extends AbstractElementRenderer {\n protected element?: Element;\n\n setElement(element: Element) {\n this.element = element;\n }\n\n constructor(element?: Element) {\n super();\n this.element = element;\n }\n}\n\nexport function useElementRenderer(element?: Element): ElementRenderer {\n return new ElementRenderer(element);\n}\n","import { Injectable, inject, ElementRef } from '@angular/core';\nimport { AbstractElementRenderer } from './abstract-element-renderer';\n\n/**\n * @private\n */\n@Injectable()\nexport class HostRenderer extends AbstractElementRenderer {\n private elementRef = inject(ElementRef);\n\n protected get element() {\n return this.elementRef.nativeElement;\n }\n}\n\nexport function useHostRenderer() {\n return new HostRenderer();\n}\n","import { ApplicationRef, DestroyRef, Directive, EmbeddedViewRef, inject, Injector, isSignal, Signal, TemplateRef } from '@angular/core';\n\nexport interface StealthViewRenderer {\n rootNodes: Node[];\n}\n\nexport function useStealthViewRenderer(templateRefInput: Signal<TemplateRef<any>> | TemplateRef<any>): StealthViewRenderer {\n const injector = inject(Injector);\n const applicationRef = inject(ApplicationRef);\n const destroyRef = inject(DestroyRef);\n\n let embeddedViewRef!: EmbeddedViewRef<any>;\n\n destroyRef.onDestroy(() => {\n if (embeddedViewRef) {\n embeddedViewRef.destroy();\n applicationRef.detachView(embeddedViewRef);\n }\n });\n\n const result = {\n get rootNodes() {\n if (!embeddedViewRef) {\n const templateRef = isSignal(templateRefInput) ? templateRefInput() : templateRefInput;\n embeddedViewRef = templateRef.createEmbeddedView({}, injector);\n applicationRef.attachView(embeddedViewRef);\n }\n return embeddedViewRef.rootNodes;\n }\n };\n return result;\n}\n","import { Directive, inject, TemplateRef } from '@angular/core';\nimport { useStealthViewRenderer } from './stealth-view-renderer';\n\n@Directive({\n selector: 'ng-template[thyStealthView]',\n exportAs: 'thyStealthView'\n})\n// eslint-disable-next-line @angular-eslint/directive-class-suffix\nexport class ThyStealthView {\n private templateRef = inject(TemplateRef<any>);\n\n private stealthViewBehavior = useStealthViewRenderer(this.templateRef);\n\n get rootNodes() {\n return this.stealthViewBehavior.rootNodes;\n }\n\n constructor() {}\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;MAEsB,uBAAuB,CAAA;AAA7C,IAAA,WAAA,GAAA;AACY,QAAA,IAAA,CAAA,QAAQ,GAAG,MAAM,CAAC,SAAS,CAAC;QAI5B,IAAA,CAAA,UAAU,GAAa,EAAE;IAsDrC;AApDI,IAAA,IAAY,WAAW,GAAA;AACnB,QAAA,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;AACf,YAAA,MAAM,IAAI,KAAK,CAAC,CAAA,qFAAA,CAAuF,CAAC;QAC5G;QACA,OAAO,IAAI,CAAC,OAAO;IACvB;AAEA,IAAA,WAAW,CA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AC,WAAW,EAAE,SAAS,CAAC;AACtD,QAAA,OAAO,IAAI;IACf;AAEA,IAAA,QAAQ,CAAC,KAAa,EAAE,KAAU,EAAE,KAA2B,EAAA;AAC3D,QAAA,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC;AAC7D,QAAA,OAAO,IAAI;IACf;AACH;;AC3DK,MAAO,eAAgB,SAAQ,uBAAuB,CAAA;AAGxD,IAAA,UAAU,CAAC,OAAgB,EAAA;AACvB,QAAA,IAAI,CAAC,OAAO,GAAG,OAAO;IAC1B;AAEA,IAAA,WAAA,CAAY,OAAiB,EAAA;AACzB,QAAA,KAAK,EAAE;AACP,QAAA,IAAI,CAAC,OAAO,GAAG,OAAO;IAC1B;AACH;AAEK,SAAU,kBAAkB,CAAC,OAAiB,EAAA;AAChD,IAAA,OAAO,IAAI,eAAe,CAAC,OAAO,CAAC;AACvC;;ACdA;;AAEG;AAEG,MAAO,YAAa,SAAQ,uBAAuB,CAAA;AADzD,IAAA,WAAA,GAAA;;AAEY,QAAA,IAAA,CAAA,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;AAK1C,IAAA;AAHG,IAAA,IAAc,OAAO,GAAA;AACjB,QAAA,OAAO,IAAI,CAAC,UAAU,CAAC,aAAa;IACxC
|
|
1
|
+
{"version":3,"file":"tethys-cdk-dom.mjs","sources":["../../../cdk/dom/abstract-element-renderer.ts","../../../cdk/dom/element-renderer.ts","../../../cdk/dom/host-renderer.ts","../../../cdk/dom/stealth-view-renderer.ts","../../../cdk/dom/stealth-view-directive.ts","../../../cdk/dom/tethys-cdk-dom.ts"],"sourcesContent":["import { Renderer2, inject, RendererStyleFlags2 } from '@angular/core';\n\nexport abstract class AbstractElementRenderer {\n private renderer = inject(Renderer2);\n\n protected abstract element?: Element;\n\n private classNames: string[] = [];\n\n private get safeElement() {\n if (!this.element) {\n throw new Error(`Element is null, should call setElement method for ElementRenderer before update dom.`);\n }\n return this.element;\n }\n\n updateClass(classNames: string[]) {\n if (this.classNames) {\n this.classNames.forEach(className => {\n if (classNames.indexOf(className) < 0) {\n this.removeClass(className);\n }\n });\n }\n const newClasses: string[] = [];\n classNames.forEach(className => {\n if (className) {\n newClasses.push(className);\n if (this.classNames.indexOf(className) < 0) {\n this.addClass(className);\n }\n }\n });\n this.classNames = newClasses;\n return this;\n }\n\n updateClassByMap(classMap: Record<string, boolean>) {\n const newClasses = [];\n for (const key in classMap) {\n if (classMap.hasOwnProperty(key) && classMap[key]) {\n newClasses.push(key);\n }\n }\n this.updateClass(newClasses);\n }\n\n addClass(className: string) {\n this.renderer.addClass(this.safeElement, className);\n return this;\n }\n\n removeClass(className: string) {\n this.renderer.removeClass(this.safeElement, className);\n return this;\n }\n\n setStyle(style: string, value: any, flags?: RendererStyleFlags2) {\n this.renderer.setStyle(this.safeElement, style, value, flags);\n return this;\n }\n}\n","import { AbstractElementRenderer } from './abstract-element-renderer';\n\nexport class ElementRenderer extends AbstractElementRenderer {\n protected element?: Element;\n\n setElement(element: Element) {\n this.element = element;\n }\n\n constructor(element?: Element) {\n super();\n this.element = element;\n }\n}\n\nexport function useElementRenderer(element?: Element): ElementRenderer {\n return new ElementRenderer(element);\n}\n","import { Injectable, inject, ElementRef } from '@angular/core';\nimport { AbstractElementRenderer } from './abstract-element-renderer';\n\n/**\n * @private\n */\n@Injectable()\nexport class HostRenderer extends AbstractElementRenderer {\n private elementRef = inject(ElementRef);\n\n protected get element() {\n return this.elementRef.nativeElement;\n }\n}\n\nexport function useHostRenderer() {\n return new HostRenderer();\n}\n","import { ApplicationRef, DestroyRef, Directive, EmbeddedViewRef, inject, Injector, isSignal, Signal, TemplateRef } from '@angular/core';\n\nexport interface StealthViewRenderer {\n rootNodes: Node[];\n}\n\nexport function useStealthViewRenderer(templateRefInput: Signal<TemplateRef<any>> | TemplateRef<any>): StealthViewRenderer {\n const injector = inject(Injector);\n const applicationRef = inject(ApplicationRef);\n const destroyRef = inject(DestroyRef);\n\n let embeddedViewRef!: EmbeddedViewRef<any>;\n\n destroyRef.onDestroy(() => {\n if (embeddedViewRef) {\n embeddedViewRef.destroy();\n applicationRef.detachView(embeddedViewRef);\n }\n });\n\n const result = {\n get rootNodes() {\n if (!embeddedViewRef) {\n const templateRef = isSignal(templateRefInput) ? templateRefInput() : templateRefInput;\n embeddedViewRef = templateRef.createEmbeddedView({}, injector);\n applicationRef.attachView(embeddedViewRef);\n }\n return embeddedViewRef.rootNodes;\n }\n };\n return result;\n}\n","import { Directive, inject, TemplateRef } from '@angular/core';\nimport { useStealthViewRenderer } from './stealth-view-renderer';\n\n@Directive({\n selector: 'ng-template[thyStealthView]',\n exportAs: 'thyStealthView'\n})\n// eslint-disable-next-line @angular-eslint/directive-class-suffix\nexport class ThyStealthView {\n private templateRef = inject(TemplateRef<any>);\n\n private stealthViewBehavior = useStealthViewRenderer(this.templateRef);\n\n get rootNodes() {\n return this.stealthViewBehavior.rootNodes;\n }\n\n constructor() {}\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;MAEsB,uBAAuB,CAAA;AAA7C,IAAA,WAAA,GAAA;AACY,QAAA,IAAA,CAAA,QAAQ,GAAG,MAAM,CAAC,SAAS,CAAC;QAI5B,IAAA,CAAA,UAAU,GAAa,EAAE;IAsDrC;AApDI,IAAA,IAAY,WAAW,GAAA;AACnB,QAAA,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;AACf,YAAA,MAAM,IAAI,KAAK,CAAC,CAAA,qFAAA,CAAuF,CAAC;QAC5G;QACA,OAAO,IAAI,CAAC,OAAO;IACvB;AAEA,IAAA,WAAW,CAAC,UAAoB,EAAA;AAC5B,QAAA,IAAI,IAAI,CAAC,UAAU,EAAE;AACjB,YAAA,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,SAAS,IAAG;gBAChC,IAAI,UAAU,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC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
|
51
51
|
this._event$.complete();
|
|
52
52
|
}
|
|
53
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
54
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
53
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: ThyEventDispatcher, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
54
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.0.8", type: ThyEventDispatcher, isStandalone: true, ngImport: i0 }); }
|
|
55
55
|
}
|
|
56
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
56
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: ThyEventDispatcher, decorators: [{
|
|
57
57
|
type: Directive
|
|
58
58
|
}], ctorParameters: () => [] });
|
|
59
59
|
|
|
@@ -66,10 +66,10 @@ class ThyClickDispatcher extends ThyEventDispatcher {
|
|
|
66
66
|
clicked(auditTimeInMs = DEFAULT_CLICKED_TIME) {
|
|
67
67
|
return this.subscribe(auditTimeInMs);
|
|
68
68
|
}
|
|
69
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
70
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
69
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: ThyClickDispatcher, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
70
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: ThyClickDispatcher, providedIn: 'root' }); }
|
|
71
71
|
}
|
|
72
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
72
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: ThyClickDispatcher, decorators: [{
|
|
73
73
|
type: Injectable,
|
|
74
74
|
args: [{
|
|
75
75
|
providedIn: 'root'
|
|
@@ -92,10 +92,10 @@ class ThyKeyboardDispatcher extends ThyEventDispatcher {
|
|
|
92
92
|
keydown(auditTimeInMs = DEFAULT_KEYDOWN_TIME) {
|
|
93
93
|
return this.subscribe(auditTimeInMs);
|
|
94
94
|
}
|
|
95
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
96
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
95
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: ThyKeyboardDispatcher, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
96
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: ThyKeyboardDispatcher, providedIn: 'root' }); }
|
|
97
97
|
}
|
|
98
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
98
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: ThyKeyboardDispatcher, decorators: [{
|
|
99
99
|
type: Injectable,
|
|
100
100
|
args: [{
|
|
101
101
|
providedIn: 'root'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tethys-cdk-event.mjs","sources":["../../../cdk/event/event-dispatcher.ts","../../../cdk/event/click-dispatcher.ts","../../../cdk/event/keyboard-dispatcher.ts","../../../cdk/event/tethys-cdk-event.ts"],"sourcesContent":["import { fromEvent, Observable, Subject, Subscription } from 'rxjs';\nimport { auditTime } from 'rxjs/operators';\nimport { Directive, NgZone, OnDestroy, inject, DOCUMENT } from '@angular/core';\n\nconst DEFAULT_EVENT_TIME = 100;\n\n@Directive()\nexport abstract class ThyEventDispatcher<T = Event> implements OnDestroy {\n private _globalSubscription: Subscription | null = null;\n\n private _event$ = new Subject<T>();\n\n private _subscriptionCount = 0;\n\n private _addGlobalListener() {\n this._globalSubscription = this.ngZone.runOutsideAngular(() => {\n return fromEvent<T>(this.document, this.eventName).subscribe((event: T) => {\n this._event$.next(event);\n });\n });\n }\n\n private _removeGlobalListener() {\n if (this._globalSubscription) {\n this._globalSubscription.unsubscribe();\n this._globalSubscription = null;\n }\n }\n\n get globalSubscription(): Subscription | null {\n return this._globalSubscription;\n }\n\n protected document: Document = inject(DOCUMENT);\n\n protected ngZone: NgZone = inject(NgZone);\n\n protected abstract eventName: string;\n\n constructor() {}\n\n protected subscribe(auditTimeInMs: number = DEFAULT_EVENT_TIME): Observable<T> {\n return new Observable(observer => {\n if (!this._globalSubscription) {\n this._addGlobalListener();\n }\n // In the case of a 0ms delay, use an observable without auditTime\n // since it does add a perceptible delay in processing overhead.\n const subscription =\n auditTimeInMs > 0 ? this._event$.pipe(auditTime(auditTimeInMs)).subscribe(observer) : this._event$.subscribe(observer);\n\n this._subscriptionCount++;\n return () => {\n subscription.unsubscribe();\n this._subscriptionCount--;\n\n if (!this._subscriptionCount) {\n this._removeGlobalListener();\n }\n };\n });\n }\n\n ngOnDestroy() {\n this._removeGlobalListener();\n this._event$.complete();\n }\n}\n","import { Injectable } from '@angular/core';\nimport { Observable } from 'rxjs';\nimport { ThyEventDispatcher } from './event-dispatcher';\n\nconst DEFAULT_CLICKED_TIME = 100;\n\n@Injectable({\n providedIn: 'root'\n})\nexport class ThyClickDispatcher extends ThyEventDispatcher {\n eventName = 'click';\n\n clicked<TEvent = Event>(auditTimeInMs: number = DEFAULT_CLICKED_TIME): Observable<TEvent> {\n return this.subscribe(auditTimeInMs) as Observable<TEvent>;\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport { Injectable } from '@angular/core';\nimport { Observable } from 'rxjs';\nimport { ThyEventDispatcher } from './event-dispatcher';\n\nconst DEFAULT_KEYDOWN_TIME = 100;\n\n@Injectable({\n providedIn: 'root'\n})\nexport class ThyKeyboardDispatcher extends ThyEventDispatcher {\n eventName = 'keydown';\n\n keydown(auditTimeInMs: number = DEFAULT_KEYDOWN_TIME): Observable<Event> {\n return this.subscribe(auditTimeInMs);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAIA,MAAM,kBAAkB,GAAG,GAAG;MAGR,kBAAkB,CAAA;IAO5B,kBAAkB,GAAA;QACtB,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,MAAK;AAC1D,YAAA,OAAO,SAAS,CAAI,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,CAAC,KAAQ,KAAI;AACtE,gBAAA,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC;AAC5B,YAAA,CAAC,CAAC;AACN,QAAA,CAAC,CAAC;IACN;IAEQ,qBAAqB,GAAA;AACzB,QAAA,IAAI,IAAI,CAAC,mBAAmB,EAAE;AAC1B,YAAA,IAAI,CAAC,mBAAmB,CAAC,WAAW,EAAE;AACtC,YAAA,IAAI,CAAC,mBAAmB,GAAG,IAAI;QACnC;IACJ;AAEA,IAAA,IAAI,kBAAkB,GAAA;QAClB,OAAO,IAAI,CAAC,mBAAmB;IACnC;AAQA,IAAA,WAAA,GAAA;QA/BQ,IAAA,CAAA,mBAAmB,GAAwB,IAAI;AAE/C,QAAA,IAAA,CAAA,OAAO,GAAG,IAAI,OAAO,EAAK;QAE1B,IAAA,CAAA,kBAAkB,GAAG,CAAC;AAqBpB,QAAA,IAAA,CAAA,QAAQ,GAAa,MAAM,CAAC,QAAQ,CAAC;AAErC,QAAA,IAAA,CAAA,MAAM,GAAW,MAAM,CAAC,MAAM,CAAC;IAI1B;IAEL,SAAS,CAAC,gBAAwB,kBAAkB,EAAA;AAC1D,QAAA,OAAO,IAAI,UAAU,CAAC,QAAQ,IAAG;AAC7B,YAAA,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE;gBAC3B,IAAI,CAAC,kBAAkB,EAAE;YAC7B;;;AAGA,YAAA,MAAM,YAAY,GACd,aAAa,GAAG,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC;YAE1H,IAAI,CAAC,kBAAkB,EAAE;AACzB,YAAA,OAAO,MAAK;gBACR,YAAY,CAAC,WAAW,EAAE;gBAC1B,IAAI,CAAC,kBAAkB,EAAE;AAEzB,gBAAA,IAAI,CAAC,IAAI,CAAC,kBAAkB,EAAE;oBAC1B,IAAI,CAAC,qBAAqB,EAAE;gBAChC;AACJ,YAAA,CAAC;AACL,QAAA,CAAC,CAAC;IACN;IAEA,WAAW,GAAA;QACP,IAAI,CAAC,qBAAqB,EAAE;AAC5B,QAAA,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE;IAC3B
|
|
1
|
+
{"version":3,"file":"tethys-cdk-event.mjs","sources":["../../../cdk/event/event-dispatcher.ts","../../../cdk/event/click-dispatcher.ts","../../../cdk/event/keyboard-dispatcher.ts","../../../cdk/event/tethys-cdk-event.ts"],"sourcesContent":["import { fromEvent, Observable, Subject, Subscription } from 'rxjs';\nimport { auditTime } from 'rxjs/operators';\nimport { Directive, NgZone, OnDestroy, inject, DOCUMENT } from '@angular/core';\n\nconst DEFAULT_EVENT_TIME = 100;\n\n@Directive()\nexport abstract class ThyEventDispatcher<T = Event> implements OnDestroy {\n private _globalSubscription: Subscription | null = null;\n\n private _event$ = new Subject<T>();\n\n private _subscriptionCount = 0;\n\n private _addGlobalListener() {\n this._globalSubscription = this.ngZone.runOutsideAngular(() => {\n return fromEvent<T>(this.document, this.eventName).subscribe((event: T) => {\n this._event$.next(event);\n });\n });\n }\n\n private _removeGlobalListener() {\n if (this._globalSubscription) {\n this._globalSubscription.unsubscribe();\n this._globalSubscription = null;\n }\n }\n\n get globalSubscription(): Subscription | null {\n return this._globalSubscription;\n }\n\n protected document: Document = inject(DOCUMENT);\n\n protected ngZone: NgZone = inject(NgZone);\n\n protected abstract eventName: string;\n\n constructor() {}\n\n protected subscribe(auditTimeInMs: number = DEFAULT_EVENT_TIME): Observable<T> {\n return new Observable(observer => {\n if (!this._globalSubscription) {\n this._addGlobalListener();\n }\n // In the case of a 0ms delay, use an observable without auditTime\n // since it does add a perceptible delay in processing overhead.\n const subscription =\n auditTimeInMs > 0 ? this._event$.pipe(auditTime(auditTimeInMs)).subscribe(observer) : this._event$.subscribe(observer);\n\n this._subscriptionCount++;\n return () => {\n subscription.unsubscribe();\n this._subscriptionCount--;\n\n if (!this._subscriptionCount) {\n this._removeGlobalListener();\n }\n };\n });\n }\n\n ngOnDestroy() {\n this._removeGlobalListener();\n this._event$.complete();\n }\n}\n","import { Injectable } from '@angular/core';\nimport { Observable } from 'rxjs';\nimport { ThyEventDispatcher } from './event-dispatcher';\n\nconst DEFAULT_CLICKED_TIME = 100;\n\n@Injectable({\n providedIn: 'root'\n})\nexport class ThyClickDispatcher extends ThyEventDispatcher {\n eventName = 'click';\n\n clicked<TEvent = Event>(auditTimeInMs: number = DEFAULT_CLICKED_TIME): Observable<TEvent> {\n return this.subscribe(auditTimeInMs) as Observable<TEvent>;\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport { Injectable } from '@angular/core';\nimport { Observable } from 'rxjs';\nimport { ThyEventDispatcher } from './event-dispatcher';\n\nconst DEFAULT_KEYDOWN_TIME = 100;\n\n@Injectable({\n providedIn: 'root'\n})\nexport class ThyKeyboardDispatcher extends ThyEventDispatcher {\n eventName = 'keydown';\n\n keydown(auditTimeInMs: number = DEFAULT_KEYDOWN_TIME): Observable<Event> {\n return this.subscribe(auditTimeInMs);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAIA,MAAM,kBAAkB,GAAG,GAAG;MAGR,kBAAkB,CAAA;IAO5B,kBAAkB,GAAA;QACtB,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,MAAK;AAC1D,YAAA,OAAO,SAAS,CAAI,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,CAAC,KAAQ,KAAI;AACtE,gBAAA,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC;AAC5B,YAAA,CAAC,CAAC;AACN,QAAA,CAAC,CAAC;IACN;IAEQ,qBAAqB,GAAA;AACzB,QAAA,IAAI,IAAI,CAAC,mBAAmB,EAAE;AAC1B,YAAA,IAAI,CAAC,mBAAmB,CAAC,WAAW,EAAE;AACtC,YAAA,IAAI,CAAC,mBAAmB,GAAG,IAAI;QACnC;IACJ;AAEA,IAAA,IAAI,kBAAkB,GAAA;QAClB,OAAO,IAAI,CAAC,mBAAmB;IACnC;AAQA,IAAA,WAAA,GAAA;QA/BQ,IAAA,CAAA,mBAAmB,GAAwB,IAAI;AAE/C,QAAA,IAAA,CAAA,OAAO,GAAG,IAAI,OAAO,EAAK;QAE1B,IAAA,CAAA,kBAAkB,GAAG,CAAC;AAqBpB,QAAA,IAAA,CAAA,QAAQ,GAAa,MAAM,CAAC,QAAQ,CAAC;AAErC,QAAA,IAAA,CAAA,MAAM,GAAW,MAAM,CAAC,MAAM,CAAC;IAI1B;IAEL,SAAS,CAAC,gBAAwB,kBAAkB,EAAA;AAC1D,QAAA,OAAO,IAAI,UA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|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
80
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
79
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: ThyHotkeyDispatcher, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
80
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: ThyHotkeyDispatcher, providedIn: 'root' }); }
|
|
81
81
|
}
|
|
82
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
82
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: ThyHotkeyDispatcher, decorators: [{
|
|
83
83
|
type: Injectable,
|
|
84
84
|
args: [{ providedIn: 'root' }]
|
|
85
85
|
}] });
|
|
@@ -125,20 +125,20 @@ class ThyHotkeyDirective {
|
|
|
125
125
|
this.subscription.unsubscribe();
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
129
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "
|
|
128
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: ThyHotkeyDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
129
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.0.8", type: ThyHotkeyDirective, isStandalone: true, selector: "[thyHotkey]", inputs: { thyHotkey: { classPropertyName: "thyHotkey", publicName: "thyHotkey", isSignal: true, isRequired: false, transformFunction: null }, thyHotkeyScope: { classPropertyName: "thyHotkeyScope", publicName: "thyHotkeyScope", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { thyHotkeyListener: "thyHotkeyListener" }, ngImport: i0 }); }
|
|
130
130
|
}
|
|
131
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
131
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: ThyHotkeyDirective, decorators: [{
|
|
132
132
|
type: Directive,
|
|
133
133
|
args: [{ selector: '[thyHotkey]' }]
|
|
134
134
|
}], propDecorators: { thyHotkey: [{ type: i0.Input, args: [{ isSignal: true, alias: "thyHotkey", required: false }] }], thyHotkeyScope: [{ type: i0.Input, args: [{ isSignal: true, alias: "thyHotkeyScope", required: false }] }], thyHotkeyListener: [{ type: i0.Output, args: ["thyHotkeyListener"] }] } });
|
|
135
135
|
|
|
136
136
|
class ThyHotkeyModule {
|
|
137
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
138
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
|
139
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
137
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: ThyHotkeyModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
138
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.0.8", ngImport: i0, type: ThyHotkeyModule, imports: [ThyHotkeyDirective], exports: [ThyHotkeyDirective] }); }
|
|
139
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: ThyHotkeyModule }); }
|
|
140
140
|
}
|
|
141
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
141
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: ThyHotkeyModule, decorators: [{
|
|
142
142
|
type: NgModule,
|
|
143
143
|
args: [{
|
|
144
144
|
imports: [ThyHotkeyDirective],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tethys-cdk-hotkey.mjs","sources":["../../../cdk/hotkey/hotkey.ts","../../../cdk/hotkey/hotkey-dispatcher.ts","../../../cdk/hotkey/hotkey.directive.ts","../../../cdk/hotkey/module.ts","../../../cdk/hotkey/tethys-cdk-hotkey.ts"],"sourcesContent":["const modifierKeyNames: string[] = [`Control`, 'Alt', 'Meta', 'Shift'];\n\n// We don't want to show `Shift` when `event.key` is capital\nfunction showShift(event: KeyboardEvent): boolean {\n const { shiftKey, code, key } = event;\n return shiftKey && !(code.startsWith('Key') && key.toUpperCase() === key);\n}\n\nexport function hotkey(event: KeyboardEvent): string {\n const { ctrlKey, altKey, metaKey, key } = event;\n const hotkeyString: string[] = [];\n const modifiers: boolean[] = [ctrlKey, altKey, metaKey, showShift(event)];\n for (const [i, mod] of modifiers.entries()) {\n if (mod) hotkeyString.push(modifierKeyNames[i]);\n }\n\n if (!modifierKeyNames.includes(key)) {\n hotkeyString.push(key);\n }\n\n return hotkeyString.join('+');\n}\n\nexport function isHotkey(event: KeyboardEvent, key: string) {\n return key.toUpperCase() === hotkey(event).toUpperCase();\n}\n","import { coerceElement } from '@angular/cdk/coercion';\nimport { Injectable, NgZone, ElementRef } from '@angular/core';\nimport { ThyEventDispatcher } from '@tethys/cdk/event';\nimport { fromEvent, Observable, OperatorFunction } from 'rxjs';\nimport { filter } from 'rxjs/operators';\nimport { isFormElement, isString, isUndefinedOrNull } from '@tethys/cdk/is';\nimport { isHotkey } from './hotkey';\n\nfunction runInZone<T>(zone: NgZone): OperatorFunction<T, T> {\n return source => {\n return new Observable(observer => {\n const onNext = (value: T) => zone.run(() => observer.next(value));\n const onError = (e: any) => zone.run(() => observer.error(e));\n const onComplete = () => zone.run(() => observer.complete());\n return source.subscribe(onNext, onError, onComplete);\n });\n };\n}\n\n@Injectable({ providedIn: 'root' })\nexport class ThyHotkeyDispatcher extends ThyEventDispatcher {\n eventName = 'keydown';\n\n private createKeydownObservable(scope: Element | Document) {\n if (scope === this.document) {\n return this.subscribe();\n } else {\n return fromEvent(scope, 'keydown');\n }\n }\n\n /**\n * 热键事件订阅\n */\n keydown(hotkey: string | string[], scope?: ElementRef<Element> | Element | Document): Observable<KeyboardEvent> {\n const hotkeys = isString(hotkey) ? hotkey.split(',') : hotkey;\n const scopeElement = coerceElement(isUndefinedOrNull(scope) ? this.document : scope);\n const keydown = this.createKeydownObservable(scopeElement);\n return new Observable<KeyboardEvent>(subscriber => {\n const subscription = keydown\n .pipe(\n filter(event => {\n return hotkeys.some(key => isHotkey(event as KeyboardEvent, key));\n })\n )\n .subscribe(event => {\n // 如果当前焦点的元素是表单元素并且焦点原色不是Hotkey绑定元素则忽略快捷键\n if (isFormElement(this.document.activeElement) && this.document.activeElement !== scope) {\n return;\n }\n subscriber.next(event as KeyboardEvent);\n });\n return () => {\n subscription.unsubscribe();\n };\n }).pipe(runInZone(this.ngZone));\n }\n}\n","import { Directive, ElementRef, OnInit, OnDestroy, inject, input, output, DOCUMENT } from '@angular/core';\nimport { Subscription } from 'rxjs';\nimport { isFormElement, isString } from '@tethys/cdk/is';\nimport { ThyHotkeyDispatcher } from './hotkey-dispatcher';\n\n/**\n * @name thyHotkey\n */\n@Directive({ selector: '[thyHotkey]' })\nexport class ThyHotkeyDirective implements OnInit, OnDestroy {\n private document = inject(DOCUMENT);\n private hotkeyDispatcher = inject(ThyHotkeyDispatcher);\n private elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /**\n * 热键对应 Code,多个热键组合支持通过数组或逗号分割的形式传入\n */\n readonly thyHotkey = input<string | string[]>();\n\n /**\n * 配置热键触发范围,默认绑定在 document 上\n */\n readonly thyHotkeyScope = input<string | Element | ElementRef<Element>>();\n\n /**\n * 热键触发后的事件\n */\n readonly thyHotkeyListener = output<KeyboardEvent>();\n\n private subscription!: Subscription;\n\n ngOnInit(): void {\n const hotkeyScope = this.thyHotkeyScope();\n const scope = isString(hotkeyScope) ? this.document.querySelector(hotkeyScope) : hotkeyScope;\n this.subscription = this.hotkeyDispatcher.keydown(this.thyHotkey()!, scope!).subscribe(event => {\n event.preventDefault();\n event.stopPropagation();\n if (isFormElement(this.elementRef)) {\n this.elementRef.nativeElement.focus();\n } else {\n this.elementRef.nativeElement.click();\n }\n this.thyHotkeyListener.emit(event);\n });\n }\n\n ngOnDestroy(): void {\n if (this.subscription) {\n this.subscription.unsubscribe();\n }\n }\n}\n","import { NgModule } from '@angular/core';\nimport { ThyHotkeyDirective } from './hotkey.directive';\n\n@NgModule({\n imports: [ThyHotkeyDirective],\n exports: [ThyHotkeyDirective]\n})\nexport class ThyHotkeyModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;AAAA,MAAM,gBAAgB,GAAa,CAAC,CAAA,OAAA,CAAS,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC;AAEtE;AACA,SAAS,SAAS,CAAC,KAAoB,EAAA;IACnC,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,KAAK;AACrC,IAAA,OAAO,QAAQ,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,WAAW,EAAE,KAAK,GAAG,CAAC;AAC7E;AAEM,SAAU,MAAM,CAAC,KAAoB,EAAA;IACvC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,KAAK;IAC/C,MAAM,YAAY,GAAa,EAAE;AACjC,IAAA,MAAM,SAAS,GAAc,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC;AACzE,IAAA,KAAK,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,IAAI,SAAS,CAAC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AA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;gHAAf,eAAe,EAAA,OAAA,EAAA,CAHd,kBAAkB,CAAA,EAAA,OAAA,EAAA,CAClB,kBAAkB,CAAA,EAAA,CAAA,CAAA;gHAEnB,eAAe,EAAA,CAAA,CAAA;;4FAAf,eAAe,EAAA,UAAA,EAAA,CAAA;kBAJ3B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACN,OAAO,EAAE,CAAC,kBAAkB,CAAC;oBAC7B,OAAO,EAAE,CAAC,kBAAkB;AAC/B,iBAAA;;;ACND;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"tethys-cdk-hotkey.mjs","sources":["../../../cdk/hotkey/hotkey.ts","../../../cdk/hotkey/hotkey-dispatcher.ts","../../../cdk/hotkey/hotkey.directive.ts","../../../cdk/hotkey/module.ts","../../../cdk/hotkey/tethys-cdk-hotkey.ts"],"sourcesContent":["const modifierKeyNames: string[] = [`Control`, 'Alt', 'Meta', 'Shift'];\n\n// We don't want to show `Shift` when `event.key` is capital\nfunction showShift(event: KeyboardEvent): boolean {\n const { shiftKey, code, key } = event;\n return shiftKey && !(code.startsWith('Key') && key.toUpperCase() === key);\n}\n\nexport function hotkey(event: KeyboardEvent): string {\n const { ctrlKey, altKey, metaKey, key } = event;\n const hotkeyString: string[] = [];\n const modifiers: boolean[] = [ctrlKey, altKey, metaKey, showShift(event)];\n for (const [i, mod] of modifiers.entries()) {\n if (mod) hotkeyString.push(modifierKeyNames[i]);\n }\n\n if (!modifierKeyNames.includes(key)) {\n hotkeyString.push(key);\n }\n\n return hotkeyString.join('+');\n}\n\nexport function isHotkey(event: KeyboardEvent, key: string) {\n return key.toUpperCase() === hotkey(event).toUpperCase();\n}\n","import { coerceElement } from '@angular/cdk/coercion';\nimport { Injectable, NgZone, ElementRef } from '@angular/core';\nimport { ThyEventDispatcher } from '@tethys/cdk/event';\nimport { fromEvent, Observable, OperatorFunction } from 'rxjs';\nimport { filter } from 'rxjs/operators';\nimport { isFormElement, isString, isUndefinedOrNull } from '@tethys/cdk/is';\nimport { isHotkey } from './hotkey';\n\nfunction runInZone<T>(zone: NgZone): OperatorFunction<T, T> {\n return source => {\n return new Observable(observer => {\n const onNext = (value: T) => zone.run(() => observer.next(value));\n const onError = (e: any) => zone.run(() => observer.error(e));\n const onComplete = () => zone.run(() => observer.complete());\n return source.subscribe(onNext, onError, onComplete);\n });\n };\n}\n\n@Injectable({ providedIn: 'root' })\nexport class ThyHotkeyDispatcher extends ThyEventDispatcher {\n eventName = 'keydown';\n\n private createKeydownObservable(scope: Element | Document) {\n if (scope === this.document) {\n return this.subscribe();\n } else {\n return fromEvent(scope, 'keydown');\n }\n }\n\n /**\n * 热键事件订阅\n */\n keydown(hotkey: string | string[], scope?: ElementRef<Element> | Element | Document): Observable<KeyboardEvent> {\n const hotkeys = isString(hotkey) ? hotkey.split(',') : hotkey;\n const scopeElement = coerceElement(isUndefinedOrNull(scope) ? this.document : scope);\n const keydown = this.createKeydownObservable(scopeElement);\n return new Observable<KeyboardEvent>(subscriber => {\n const subscription = keydown\n .pipe(\n filter(event => {\n return hotkeys.some(key => isHotkey(event as KeyboardEvent, key));\n })\n )\n .subscribe(event => {\n // 如果当前焦点的元素是表单元素并且焦点原色不是Hotkey绑定元素则忽略快捷键\n if (isFormElement(this.document.activeElement) && this.document.activeElement !== scope) {\n return;\n }\n subscriber.next(event as KeyboardEvent);\n });\n return () => {\n subscription.unsubscribe();\n };\n }).pipe(runInZone(this.ngZone));\n }\n}\n","import { Directive, ElementRef, OnInit, OnDestroy, inject, input, output, DOCUMENT } from '@angular/core';\nimport { Subscription } from 'rxjs';\nimport { isFormElement, isString } from '@tethys/cdk/is';\nimport { ThyHotkeyDispatcher } from './hotkey-dispatcher';\n\n/**\n * @name thyHotkey\n */\n@Directive({ selector: '[thyHotkey]' })\nexport class ThyHotkeyDirective implements OnInit, OnDestroy {\n private document = inject(DOCUMENT);\n private hotkeyDispatcher = inject(ThyHotkeyDispatcher);\n private elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /**\n * 热键对应 Code,多个热键组合支持通过数组或逗号分割的形式传入\n */\n readonly thyHotkey = input<string | string[]>();\n\n /**\n * 配置热键触发范围,默认绑定在 document 上\n */\n readonly thyHotkeyScope = input<string | Element | ElementRef<Element>>();\n\n /**\n * 热键触发后的事件\n */\n readonly thyHotkeyListener = output<KeyboardEvent>();\n\n private subscription!: Subscription;\n\n ngOnInit(): void {\n const hotkeyScope = this.thyHotkeyScope();\n const scope = isString(hotkeyScope) ? this.document.querySelector(hotkeyScope) : hotkeyScope;\n this.subscription = this.hotkeyDispatcher.keydown(this.thyHotkey()!, scope!).subscribe(event => {\n event.preventDefault();\n event.stopPropagation();\n if (isFormElement(this.elementRef)) {\n this.elementRef.nativeElement.focus();\n } else {\n this.elementRef.nativeElement.click();\n }\n this.thyHotkeyListener.emit(event);\n });\n }\n\n ngOnDestroy(): void {\n if (this.subscription) {\n this.subscription.unsubscribe();\n }\n }\n}\n","import { NgModule } from '@angular/core';\nimport { ThyHotkeyDirective } from './hotkey.directive';\n\n@NgModule({\n imports: [ThyHotkeyDirective],\n exports: [ThyHotkeyDirective]\n})\nexport class ThyHotkeyModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;AAAA,MAAM,gBAAgB,GAAa,CAAC,CAAA,OAAA,CAAS,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC;AAEtE;AACA,SAAS,SAAS,CAAC,KAAoB,EAAA;IACnC,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,KAAK;AACrC,IAAA,OAAO,QAAQ,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,WAAW,EAAE,KAAK,GAAG,CAAC;AAC7E;AAEM,SAAU,MAAM,CAAC,KAAoB,EAAA;IACvC,MAAM,EAAE,OAAO,EAAE,MAAM,EA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A,EAAA,mBAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FAAlB,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAD9B,SAAS;mBAAC,EAAE,QAAQ,EAAE,aAAa,EAAE;;;MCDzB,eAAe,CAAA;8GAAf,eAAe,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;+GAAf,eAAe,EAAA,OAAA,EAAA,CAHd,kBAAkB,CAAA,EAAA,OAAA,EAAA,CAClB,kBAAkB,CAAA,EAAA,CAAA,CAAA;+GAEnB,eAAe,EAAA,CAAA,CAAA;;2FAAf,eAAe,EAAA,UAAA,EAAA,CAAA;kBAJ3B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACN,OAAO,EAAE,CAAC,kBAAkB,CAAC;oBAC7B,OAAO,EAAE,CAAC,kBAAkB;AAC/B,iBAAA;;;ACND;;AAEG;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tethys-cdk-immutable.mjs","sources":["../../../cdk/immutable/object-producer.ts","../../../cdk/immutable/immutable.ts","../../../cdk/immutable/tethys-cdk-immutable.ts"],"sourcesContent":["/* eslint-disable prettier/prettier */\ntype GetIndexedField<T, K> = K extends keyof T\n ? T[K]\n : K extends `${number}`\n ? '0' extends keyof T\n ? undefined\n : number extends keyof T\n ? T[number]\n : undefined\n : undefined;\ntype FieldWithPossiblyUndefined<T, Key> = GetFieldType<Exclude<T, undefined>, Key> | Extract<T, undefined>;\ntype IndexedFieldWithPossiblyUndefined<T, Key> = GetIndexedField<Exclude<T, undefined>, Key> | Extract<T, undefined>;\nexport type GetFieldType<T, P> = P extends `${infer Left}.${infer Right}`\n ? Left extends keyof T\n ? FieldWithPossiblyUndefined<T[Left], Right>\n : Left extends `${infer FieldKey}[${infer IndexKey}]`\n ? FieldKey extends keyof T\n ? FieldWithPossiblyUndefined<IndexedFieldWithPossiblyUndefined<T[FieldKey], IndexKey>, Right>\n : undefined\n : undefined\n : P extends keyof T\n ? T[P]\n : P extends `${infer FieldKey}[${infer IndexKey}]`\n ? FieldKey extends keyof T\n ? IndexedFieldWithPossiblyUndefined<T[FieldKey], IndexKey>\n : undefined\n : undefined;\n\nexport class ObjectProducer<TEntity> {\n entity: TEntity;\n\n constructor(entity: TEntity) {\n this.entity = entity;\n }\n\n get<TPath extends string>(propPath: TPath): GetFieldType<TEntity, TPath> {\n return propPath.split('.').reduce((previousValue: any, part: string) => previousValue && previousValue[part], this.entity);\n }\n\n set<TPath extends string>(propPath: TPath, value: GetFieldType<TEntity, TPath>) {\n const newEntity = { ...this.entity };\n\n const split = propPath.split('.');\n const lastIndex = split.length - 1;\n\n split.reduce((previousValue: any, part, index) => {\n if (index === lastIndex) {\n previousValue[part] = value;\n } else {\n previousValue[part] = Array.isArray(previousValue[part]) ? previousValue[part].slice() : { ...previousValue[part] };\n }\n\n return previousValue && previousValue[part];\n }, newEntity);\n\n this.entity = newEntity;\n return newEntity;\n }\n}\n","import { coerceArray } from '@angular/cdk/coercion';\nimport { isFunction, isUndefinedOrNull, isArray } from '@tethys/cdk/is';\nimport { ObjectProducer } from './object-producer';\n\nexport type Id = string | number;\n\nexport type Ids = Id[];\n\nexport type IdOrIds = Id | Ids;\n\nexport interface EntityAddOptions {\n prepend?: boolean;\n\n afterId?: Id;\n}\n\nexport interface EntityMoveOptions {\n afterId?: Id;\n\n toIndex?: number;\n}\n\ntype ExtractKeysOfValueType<T, K> = { [I in keyof T]: T[I] extends K ? I : never }[keyof T];\nexport interface ProducerOptions<TEntity> {\n idKey?: ExtractKeysOfValueType<TEntity, Id>;\n}\n\nexport class Producer<TEntity> {\n private idKey = '_id';\n\n private entities: TEntity[];\n\n constructor(entities: TEntity[], options?: ProducerOptions<TEntity>) {\n this.entities = entities || [];\n if (options && options.idKey) {\n this.idKey = options.idKey as string;\n }\n }\n\n private getPathValue(entity: TEntity, path: string = this.idKey): string | number {\n return (entity as Record<string, unknown>)[path] as string | number ;\n }\n\n /**\n * Add an entity or entities.\n *\n * @example\n * produce([users]).add(Entity);\n * produce([users]).add([Entity, Entity]);\n * produce([users]).add(Entity, { prepend: true });\n * produce([users]).add(Entity, { afterId: '' });\n */\n add(entity: TEntity | TEntity[], addOptions?: EntityAddOptions): TEntity[] {\n const addEntities = coerceArray(entity);\n if (addEntities.length === 0) {\n return this.entities;\n }\n if (addOptions && (addOptions.afterId || addOptions.prepend)) {\n if (addOptions.afterId) {\n const entities = [...this.entities];\n const index =\n this.entities.findIndex(item => {\n return this.getPathValue(item) === addOptions.afterId;\n }) + 1;\n entities.splice(index, 0, ...addEntities);\n this.entities = [...entities];\n } else if (addOptions.prepend) {\n this.entities = [...addEntities, ...this.entities];\n }\n } else {\n this.entities = [...this.entities, ...addEntities];\n }\n return this.entities;\n }\n\n /**\n *\n * Update an entity or entities.\n *\n * @example\n * produce([users]).update(3, {\n * name: 'New Name'\n * });\n *\n * produce([users]).update(3, entity => {\n * return {\n * ...entity,\n * name: 'New Name'\n * }\n * });\n *\n * produce([users]).update([1,2,3], {\n * name: 'New Name'\n * });\n */\n update(id: IdOrIds | null, newStateFn: (entity: Readonly<TEntity>) => Partial<TEntity>): TEntity[];\n update(id: IdOrIds | null, newState?: Partial<TEntity>): TEntity[];\n update(\n idsOrFn: IdOrIds | null | Partial<TEntity> | ((entity: Readonly<TEntity>) => boolean),\n newStateOrFn?: ((entity: Readonly<TEntity>) => Partial<TEntity>) | Partial<TEntity>\n ): TEntity[] {\n const ids = coerceArray(idsOrFn);\n\n for (let i = 0; i < this.entities.length; i++) {\n const oldEntity = this.entities[i];\n if (ids.indexOf(this.getPathValue(oldEntity)) >= 0) {\n const newState = isFunction(newStateOrFn) ? newStateOrFn(oldEntity) : newStateOrFn;\n this.entities[i] = { ...oldEntity, ...newState };\n }\n }\n return [...this.entities];\n }\n\n /**\n *\n * Remove one or more entities:\n *\n * @example\n * produce([users]).remove(5);\n * produce([users]).remove([1,2,3]);\n * produce([users]).remove(entity => entity.id === 1);\n */\n remove(id: IdOrIds): TEntity[];\n remove(predicate: (entity: Readonly<TEntity>) => boolean): TEntity[];\n remove(idsOrFn?: IdOrIds | ((entity: Readonly<TEntity>) => boolean)): TEntity[] {\n if (isFunction(idsOrFn)) {\n this.entities = this.entities.filter(entity => {\n return !(idsOrFn as any)(entity);\n });\n } else {\n const ids = coerceArray(idsOrFn);\n this.entities = this.entities.filter(entity => {\n return ids.indexOf(this.getPathValue(entity)) === -1;\n });\n }\n return this.entities;\n }\n\n /**\n *\n * Move one or more entities:\n *\n * @example\n * produce([users]).move(5, {afterId: 2});\n * produce([users]).move(5, {toIndex: 0});\n */\n move(id: Id, moveOptions?: EntityMoveOptions): TEntity[] {\n const fromIndex = this.entities.findIndex(item => this.getPathValue(item) === id);\n let toIndex = 0;\n const newEntities = [...this.entities];\n\n if (!id || fromIndex < 0) {\n return [...this.entities];\n }\n\n if (moveOptions) {\n if (!isUndefinedOrNull(moveOptions.afterId)) {\n toIndex = this.entities.findIndex(item => this.getPathValue(item) === moveOptions.afterId);\n } else if (moveOptions.toIndex) {\n toIndex = moveOptions.toIndex;\n }\n }\n toIndex = Math.max(0, Math.min(this.entities.length - 1, toIndex));\n if (toIndex === fromIndex) {\n return [...this.entities];\n } else {\n const target = this.entities[fromIndex];\n const delta = toIndex < fromIndex ? -1 : 1;\n\n for (let i = fromIndex; i !== toIndex; i += delta) {\n newEntities[i] = newEntities[i + delta];\n }\n newEntities[toIndex] = target;\n return [...newEntities];\n }\n }\n}\n\nexport function produce<TEntity>(entities: TEntity[], options?: ProducerOptions<TEntity>): Producer<TEntity>;\nexport function produce<TEntity>(entities: TEntity): ObjectProducer<TEntity>;\nexport function produce<TEntity>(entities: TEntity | TEntity[], options?: ProducerOptions<TEntity>) {\n if (isArray(entities)) {\n return new Producer<TEntity>(entities, options);\n } else {\n return new ObjectProducer<TEntity>(entities);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */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CAAC,KAAK,OAAO,EAAE,CAAC,IAAI,KAAK,EAAE;gBAC/C,WAAW,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,GAAG,KAAK,CAAC;YAC3C;AACA,YAAA,WAAW,CAAC,OAAO,CAAC,GAAG,MAAM;AAC7B,YAAA,OAAO,CAAC,GAAG,WAAW,CAAC;QAC3B;IACJ;AACH;AAIK,SAAU,OAAO,CAAU,QAA6B,EAAE,OAAkC,EAAA;AAC9F,IAAA,IAAI,OAAO,CAAC,QAAQ,CAAC,EAAE;AACnB,QAAA,OAAO,IAAI,QAAQ,CAAU,QAAQ,EAAE,OAAO,CAAC;IACnD;SAAO;AACH,QAAA,OAAO,IAAI,cAAc,CAAU,QAAQ,CAAC;IAChD;AACJ;;AC1LA;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"tethys-cdk-immutable.mjs","sources":["../../../cdk/immutable/object-producer.ts","../../../cdk/immutable/immutable.ts","../../../cdk/immutable/tethys-cdk-immutable.ts"],"sourcesContent":["type GetIndexedField<T, K> = K extends keyof T\n ? T[K]\n : K extends `${number}`\n ? '0' extends keyof T\n ? undefined\n : number extends keyof T\n ? T[number]\n : undefined\n : undefined;\ntype FieldWithPossiblyUndefined<T, Key> = GetFieldType<Exclude<T, undefined>, Key> | Extract<T, undefined>;\ntype IndexedFieldWithPossiblyUndefined<T, Key> = GetIndexedField<Exclude<T, undefined>, Key> | Extract<T, undefined>;\nexport type GetFieldType<T, P> = P extends `${infer Left}.${infer Right}`\n ? Left extends keyof T\n ? FieldWithPossiblyUndefined<T[Left], Right>\n : Left extends `${infer FieldKey}[${infer IndexKey}]`\n ? FieldKey extends keyof T\n ? FieldWithPossiblyUndefined<IndexedFieldWithPossiblyUndefined<T[FieldKey], IndexKey>, Right>\n : undefined\n : undefined\n : P extends keyof T\n ? T[P]\n : P extends `${infer FieldKey}[${infer IndexKey}]`\n ? FieldKey extends keyof T\n ? IndexedFieldWithPossiblyUndefined<T[FieldKey], IndexKey>\n : undefined\n : undefined;\n\nexport class ObjectProducer<TEntity> {\n entity: TEntity;\n\n constructor(entity: TEntity) {\n this.entity = entity;\n }\n\n get<TPath extends string>(propPath: TPath): GetFieldType<TEntity, TPath> {\n return propPath.split('.').reduce((previousValue: any, part: string) => previousValue && previousValue[part], this.entity);\n }\n\n set<TPath extends string>(propPath: TPath, value: GetFieldType<TEntity, TPath>) {\n const newEntity = { ...this.entity };\n\n const split = propPath.split('.');\n const lastIndex = split.length - 1;\n\n split.reduce((previousValue: any, part, index) => {\n if (index === lastIndex) {\n previousValue[part] = value;\n } else {\n previousValue[part] = Array.isArray(previousValue[part]) ? previousValue[part].slice() : { ...previousValue[part] };\n }\n\n return previousValue && previousValue[part];\n }, newEntity);\n\n this.entity = newEntity;\n return newEntity;\n }\n}\n","import { coerceArray } from '@angular/cdk/coercion';\nimport { isFunction, isUndefinedOrNull, isArray } from '@tethys/cdk/is';\nimport { ObjectProducer } from './object-producer';\n\nexport type Id = string | number;\n\nexport type Ids = Id[];\n\nexport type IdOrIds = Id | Ids;\n\nexport interface EntityAddOptions {\n prepend?: boolean;\n\n afterId?: Id;\n}\n\nexport interface EntityMoveOptions {\n afterId?: Id;\n\n toIndex?: number;\n}\n\ntype ExtractKeysOfValueType<T, K> = { [I in keyof T]: T[I] extends K ? I : never }[keyof T];\nexport interface ProducerOptions<TEntity> {\n idKey?: ExtractKeysOfValueType<TEntity, Id>;\n}\n\nexport class Producer<TEntity> {\n private idKey = '_id';\n\n private entities: TEntity[];\n\n constructor(entities: TEntity[], options?: ProducerOptions<TEntity>) {\n this.entities = entities || [];\n if (options && options.idKey) {\n this.idKey = options.idKey as string;\n }\n }\n\n private getPathValue(entity: TEntity, path: string = this.idKey): string | number {\n return (entity as Record<string, unknown>)[path] as string | number ;\n }\n\n /**\n * Add an entity or entities.\n *\n * @example\n * produce([users]).add(Entity);\n * produce([users]).add([Entity, Entity]);\n * produce([users]).add(Entity, { prepend: true });\n * produce([users]).add(Entity, { afterId: '' });\n */\n add(entity: TEntity | TEntity[], addOptions?: EntityAddOptions): TEntity[] {\n const addEntities = coerceArray(entity);\n if (addEntities.length === 0) {\n return this.entities;\n }\n if (addOptions && (addOptions.afterId || addOptions.prepend)) {\n if (addOptions.afterId) {\n const entities = [...this.entities];\n const index =\n this.entities.findIndex(item => {\n return this.getPathValue(item) === addOptions.afterId;\n }) + 1;\n entities.splice(index, 0, ...addEntities);\n this.entities = [...entities];\n } else if (addOptions.prepend) {\n this.entities = [...addEntities, ...this.entities];\n }\n } else {\n this.entities = [...this.entities, ...addEntities];\n }\n return this.entities;\n }\n\n /**\n *\n * Update an entity or entities.\n *\n * @example\n * produce([users]).update(3, {\n * name: 'New Name'\n * });\n *\n * produce([users]).update(3, entity => {\n * return {\n * ...entity,\n * name: 'New Name'\n * }\n * });\n *\n * produce([users]).update([1,2,3], {\n * name: 'New Name'\n * });\n */\n update(id: IdOrIds | null, newStateFn: (entity: Readonly<TEntity>) => Partial<TEntity>): TEntity[];\n update(id: IdOrIds | null, newState?: Partial<TEntity>): TEntity[];\n update(\n idsOrFn: IdOrIds | null | Partial<TEntity> | ((entity: Readonly<TEntity>) => boolean),\n newStateOrFn?: ((entity: Readonly<TEntity>) => Partial<TEntity>) | Partial<TEntity>\n ): TEntity[] {\n const ids = coerceArray(idsOrFn);\n\n for (let i = 0; i < this.entities.length; i++) {\n const oldEntity = this.entities[i];\n if (ids.indexOf(this.getPathValue(oldEntity)) >= 0) {\n const newState = isFunction(newStateOrFn) ? newStateOrFn(oldEntity) : newStateOrFn;\n this.entities[i] = { ...oldEntity, ...newState };\n }\n }\n return [...this.entities];\n }\n\n /**\n *\n * Remove one or more entities:\n *\n * @example\n * produce([users]).remove(5);\n * produce([users]).remove([1,2,3]);\n * produce([users]).remove(entity => entity.id === 1);\n */\n remove(id: IdOrIds): TEntity[];\n remove(predicate: (entity: Readonly<TEntity>) => boolean): TEntity[];\n remove(idsOrFn?: IdOrIds | ((entity: Readonly<TEntity>) => boolean)): TEntity[] {\n if (isFunction(idsOrFn)) {\n this.entities = this.entities.filter(entity => {\n return !(idsOrFn as any)(entity);\n });\n } else {\n const ids = coerceArray(idsOrFn);\n this.entities = this.entities.filter(entity => {\n return ids.indexOf(this.getPathValue(entity)) === -1;\n });\n }\n return this.entities;\n }\n\n /**\n *\n * Move one or more entities:\n *\n * @example\n * produce([users]).move(5, {afterId: 2});\n * produce([users]).move(5, {toIndex: 0});\n */\n move(id: Id, moveOptions?: EntityMoveOptions): TEntity[] {\n const fromIndex = this.entities.findIndex(item => this.getPathValue(item) === id);\n let toIndex = 0;\n const newEntities = [...this.entities];\n\n if (!id || fromIndex < 0) {\n return [...this.entities];\n }\n\n if (moveOptions) {\n if (!isUndefinedOrNull(moveOptions.afterId)) {\n toIndex = this.entities.findIndex(item => this.getPathValue(item) === moveOptions.afterId);\n } else if (moveOptions.toIndex) {\n toIndex = moveOptions.toIndex;\n }\n }\n toIndex = Math.max(0, Math.min(this.entities.length - 1, toIndex));\n if (toIndex === fromIndex) {\n return [...this.entities];\n } else {\n const target = this.entities[fromIndex];\n const delta = toIndex < fromIndex ? -1 : 1;\n\n for (let i = fromIndex; i !== toIndex; i += delta) {\n newEntities[i] = newEntities[i + delta];\n }\n newEntities[toIndex] = target;\n return [...newEntities];\n }\n }\n}\n\nexport function produce<TEntity>(entities: TEntity[], options?: ProducerOptions<TEntity>): Producer<TEntity>;\nexport function produce<TEntity>(entities: TEntity): ObjectProducer<TEntity>;\nexport function produce<TEntity>(entities: TEntity | TEntity[], options?: ProducerOptions<TEntity>) {\n if (isArray(entities)) {\n return new Producer<TEntity>(entities, options);\n } else {\n return new ObjectProducer<TEntity>(entities);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;MA2Ba,cAAc,CAAA;AAGvB,IAAA,WAAA,CAAY,MAAe,EAAA;AACvB,QAAA,IAAI,CAAC,MAAM,GAAG,MAAM;IACxB;AAEA,IAAA,GAAG,CAAuB,QA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AG,MAAM;AAC7B,YAAA,OAAO,CAAC,GAAG,WAAW,CAAC;QAC3B;IACJ;AACH;AAIK,SAAU,OAAO,CAAU,QAA6B,EAAE,OAAkC,EAAA;AAC9F,IAAA,IAAI,OAAO,CAAC,QAAQ,CAAC,EAAE;AACnB,QAAA,OAAO,IAAI,QAAQ,CAAU,QAAQ,EAAE,OAAO,CAAC;IACnD;SAAO;AACH,QAAA,OAAO,IAAI,cAAc,CAAU,QAAQ,CAAC;IAChD;AACJ;;AC1LA;;AAEG;;;;"}
|
package/package.json
CHANGED
|
@@ -1,50 +1,50 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tethys/cdk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "21.0.0-next.0",
|
|
4
4
|
"peerDependencies": {
|
|
5
|
-
"@angular/common": "^
|
|
6
|
-
"@angular/core": "^
|
|
7
|
-
"@angular/cdk": "^
|
|
5
|
+
"@angular/common": "^21.0.0",
|
|
6
|
+
"@angular/core": "^21.0.0",
|
|
7
|
+
"@angular/cdk": "^21.0.0"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"tslib": "^2.3.0"
|
|
11
11
|
},
|
|
12
12
|
"module": "fesm2022/tethys-cdk.mjs",
|
|
13
|
-
"typings": "
|
|
13
|
+
"typings": "types/tethys-cdk.d.ts",
|
|
14
14
|
"exports": {
|
|
15
15
|
"./package.json": {
|
|
16
16
|
"default": "./package.json"
|
|
17
17
|
},
|
|
18
18
|
".": {
|
|
19
|
-
"types": "./
|
|
19
|
+
"types": "./types/tethys-cdk.d.ts",
|
|
20
20
|
"default": "./fesm2022/tethys-cdk.mjs"
|
|
21
21
|
},
|
|
22
22
|
"./behaviors": {
|
|
23
|
-
"types": "./behaviors
|
|
23
|
+
"types": "./types/tethys-cdk-behaviors.d.ts",
|
|
24
24
|
"default": "./fesm2022/tethys-cdk-behaviors.mjs"
|
|
25
25
|
},
|
|
26
26
|
"./dom": {
|
|
27
|
-
"types": "./dom
|
|
27
|
+
"types": "./types/tethys-cdk-dom.d.ts",
|
|
28
28
|
"default": "./fesm2022/tethys-cdk-dom.mjs"
|
|
29
29
|
},
|
|
30
30
|
"./event": {
|
|
31
|
-
"types": "./event
|
|
31
|
+
"types": "./types/tethys-cdk-event.d.ts",
|
|
32
32
|
"default": "./fesm2022/tethys-cdk-event.mjs"
|
|
33
33
|
},
|
|
34
34
|
"./hotkey": {
|
|
35
|
-
"types": "./hotkey
|
|
35
|
+
"types": "./types/tethys-cdk-hotkey.d.ts",
|
|
36
36
|
"default": "./fesm2022/tethys-cdk-hotkey.mjs"
|
|
37
37
|
},
|
|
38
38
|
"./immutable": {
|
|
39
|
-
"types": "./immutable
|
|
39
|
+
"types": "./types/tethys-cdk-immutable.d.ts",
|
|
40
40
|
"default": "./fesm2022/tethys-cdk-immutable.mjs"
|
|
41
41
|
},
|
|
42
42
|
"./is": {
|
|
43
|
-
"types": "./is
|
|
43
|
+
"types": "./types/tethys-cdk-is.d.ts",
|
|
44
44
|
"default": "./fesm2022/tethys-cdk-is.mjs"
|
|
45
45
|
},
|
|
46
46
|
"./logger": {
|
|
47
|
-
"types": "./logger
|
|
47
|
+
"types": "./types/tethys-cdk-logger.d.ts",
|
|
48
48
|
"default": "./fesm2022/tethys-cdk-logger.mjs"
|
|
49
49
|
}
|
|
50
50
|
},
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|