@tethys/cdk 19.1.14 → 20.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/behaviors/index.d.ts +45 -6
- package/dom/index.d.ts +49 -5
- package/event/index.d.ts +36 -3
- package/fesm2022/tethys-cdk-behaviors.mjs +6 -6
- package/fesm2022/tethys-cdk-behaviors.mjs.map +1 -1
- package/fesm2022/tethys-cdk-dom.mjs +6 -6
- package/fesm2022/tethys-cdk-dom.mjs.map +1 -1
- package/fesm2022/tethys-cdk-event.mjs +20 -24
- package/fesm2022/tethys-cdk-event.mjs.map +1 -1
- package/fesm2022/tethys-cdk-hotkey.mjs +17 -19
- package/fesm2022/tethys-cdk-hotkey.mjs.map +1 -1
- package/fesm2022/tethys-cdk-immutable.mjs.map +1 -1
- package/fesm2022/tethys-cdk-is.mjs.map +1 -1
- package/fesm2022/tethys-cdk-logger.mjs.map +1 -1
- package/hotkey/index.d.ts +52 -4
- package/immutable/index.d.ts +90 -2
- package/index.d.ts +5 -5
- package/is/index.d.ts +20 -1
- package/logger/index.d.ts +7 -1
- package/package.json +5 -5
- package/behaviors/action-behavior.d.ts +0 -11
- package/behaviors/async-behavior.d.ts +0 -15
- package/behaviors/behavior.d.ts +0 -17
- package/behaviors/error-handler.d.ts +0 -3
- package/behaviors/run-in-zone.d.ts +0 -3
- package/behaviors/types.d.ts +0 -5
- package/dom/abstract-element-renderer.d.ts +0 -12
- package/dom/element-renderer.d.ts +0 -7
- package/dom/host-renderer.d.ts +0 -12
- package/dom/stealth-view-directive.d.ts +0 -9
- package/dom/stealth-view-renderer.d.ts +0 -5
- package/event/click-dispatcher.d.ts +0 -9
- package/event/event-dispatcher.d.ts +0 -19
- package/event/keyboard-dispatcher.d.ts +0 -9
- package/hotkey/hotkey-dispatcher.d.ts +0 -14
- package/hotkey/hotkey.d.ts +0 -2
- package/hotkey/hotkey.directive.d.ts +0 -27
- package/hotkey/module.d.ts +0 -7
- package/immutable/immutable.d.ts +0 -78
- package/immutable/object-producer.d.ts +0 -11
- package/is/utils.d.ts +0 -17
- package/logger/logger.d.ts +0 -5
- package/public-api.d.ts +0 -5
|
@@ -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 { DOCUMENT } from '@angular/common';\nimport { Injectable, NgZone, ElementRef, inject } from '@angular/core';\nimport { ThyEventDispatcher } from '@tethys/cdk/event';\nimport { fromEvent, Observable, OperatorFunction, Subscriber } 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 constructor() {\n const document = inject(DOCUMENT);\n const ngZone = inject(NgZone);\n\n super(document, ngZone, 'keydown');\n }\n\n private createKeydownObservable(scope: Element | Document) {\n if (scope === this.document) {\n return this.subscribe(null);\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(filter((event: KeyboardEvent) => hotkeys.some(key => isHotkey(event, key))))\n .subscribe((event: KeyboardEvent) => {\n // 如果当前焦点的元素是表单元素并且焦点原色不是Hotkey绑定元素则忽略快捷键\n if (isFormElement(this.document.activeElement) && this.document.activeElement !== scope) {\n return;\n }\n subscriber.next(event);\n });\n return () => {\n subscription.unsubscribe();\n };\n }).pipe(runInZone(this.ngZone));\n }\n}\n","import { DOCUMENT } from '@angular/common';\nimport { Directive, ElementRef, OnInit, OnDestroy, inject, input, output } 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 = null;\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,CAAS,OAAA,CAAA,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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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
|
+
{"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(null);\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(filter((event: KeyboardEvent) => hotkeys.some(key => isHotkey(event, key))))\n .subscribe((event: KeyboardEvent) => {\n // 如果当前焦点的元素是表单元素并且焦点原色不是Hotkey绑定元素则忽略快捷键\n if (isFormElement(this.document.activeElement) && this.document.activeElement !== scope) {\n return;\n }\n subscriber.next(event);\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 = null;\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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,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;4FAAlB,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAD9B,SAAS;mBAAC,EAAE,QAAQ,EAAE,aAAa,EAAE;;;MCDzB,eAAe,CAAA;+GAAf,eAAe,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,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 +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> =\n | GetFieldType<Exclude<T, undefined>, Key>\n | Extract<T, undefined>\ntype IndexedFieldWithPossiblyUndefined<T, Key> =\n | GetIndexedField<Exclude<T, undefined>, Key>\n | 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, 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 /**\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 item[this.idKey] === 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(oldEntity[this.idKey]) >= 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(entity[this.idKey]) === -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 => item[this.idKey] === 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 => item[this.idKey] === 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":";;;MAgCa,cAAc,CAAA;AAGvB,IAAA,WAAA,CAAY,MAAe,EAAA;AACvB,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AAI,QAAQ,CAAU,QAAQ,EAAE,OAAO,CAAC;;SAC5C;AACH,QAAA,OAAO,IAAI,cAAc,CAAU,QAAQ,CAAC;;AAEpD;;ACtLA;;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":["/* 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> =\n | GetFieldType<Exclude<T, undefined>, Key>\n | Extract<T, undefined>\ntype IndexedFieldWithPossiblyUndefined<T, Key> =\n | GetIndexedField<Exclude<T, undefined>, Key>\n | 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, 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 /**\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 item[this.idKey] === 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(oldEntity[this.idKey]) >= 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(entity[this.idKey]) === -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 => item[this.idKey] === 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 => item[this.idKey] === 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":";;;MAgCa,cAAc,CAAA;AAGvB,IAAA,WAAA,CAAY,MAAe,EAAA;AACvB,QAAA,IAAI,CAAC,MAAM,GAAG,MAAM;IACxB;AAEA,IAAA,GAAG,CAAuB,QAAe,EAAA;QACrC,OAAO,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,aAAkB,EAAE,IAAY,KAAK,aAAa,IAAI,aAAa,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC;IAC9H;IAEA,GAAG,CAAuB,QAAe,EAAE,KAAmC,EAAA;QAC1E,MAAM,SAAS,GAAG,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE;QAEpC,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC;AACjC,QAAA,MAAM,SAAS,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC;QAElC,KAAK,CAA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AAO,EAAE;AAC5B,gBAAA,OAAO,GAAG,WAAW,CAAC,OAAO;YACjC;QACJ;QACA,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC;AAClE,QAAA,IAAI,OAAO,KAAK,SAAS,EAAE;AACvB,YAAA,OAAO,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC7B;aAAO;YACH,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC;AACvC,YAAA,MAAM,KAAK,GAAG,OAAO,GAAG,SAAS,GAAG,CAAC,CAAC,GAAG,CAAC;AAE1C,YAAA,KAAK,IAAI,CAAC,GAAG,SAAS,EAAE,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;;ACtLA;;AAEG;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tethys-cdk-is.mjs","sources":["../../../cdk/is/utils.ts","../../../cdk/is/tethys-cdk-is.ts"],"sourcesContent":["import { coerceElement } from '@angular/cdk/coercion';\nimport { ElementRef, TemplateRef } from '@angular/core';\n\nexport function isUndefined(value: any): value is undefined {\n return value === undefined;\n}\n\nexport function isNull(value: any): value is null {\n return value === null;\n}\n\nexport function isUndefinedOrNull(value: any): value is undefined | null {\n return isUndefined(value) || isNull(value);\n}\n\nexport function isArray<T = any>(value: any): value is Array<T> {\n return value && baseGetTag(value) === '[object Array]';\n}\n\nexport function isEmpty(value?: any): boolean {\n if (isUndefinedOrNull(value)) {\n return true;\n }\n if (isArray(value)) {\n return !value.length;\n }\n const tag = baseGetTag(value);\n if (tag == '[object Map]' || tag == '[object Set]') {\n return !value.size;\n }\n for (const key in value) {\n if (Object.hasOwnProperty.call(value, key)) {\n return false;\n }\n }\n return true;\n}\n\nexport function isString(value?: any): value is string {\n return typeof value == 'string' || (!isArray(value) && isObjectLike(value) && baseGetTag(value) === '[object String]');\n}\n\nfunction isObjectLike(value: any): value is object {\n return value !== null && typeof value === 'object';\n}\n\nfunction baseGetTag(value: any) {\n const objectProto = Object.prototype;\n const hasOwnProperty = objectProto.hasOwnProperty;\n const toString = objectProto.toString;\n const symToStringTag = typeof Symbol !== 'undefined' ? Symbol.toStringTag : undefined;\n\n if (value == null) {\n return value === undefined ? '[object Undefined]' : '[object Null]';\n }\n if (!(symToStringTag && symToStringTag in Object(value))) {\n return toString.call(value);\n }\n const isOwn = hasOwnProperty.call(value, symToStringTag);\n const tag = value[symToStringTag];\n let unmasked = false;\n try {\n value[symToStringTag] = undefined;\n unmasked = true;\n } catch (e) {}\n\n const result = toString.call(value);\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag] = tag;\n } else {\n delete value[symToStringTag];\n }\n }\n return result;\n}\n\nexport function isNumber(value: any): value is number {\n return typeof value === 'number' || (isObjectLike(value) && baseGetTag(value) === '[object Number]');\n}\n\nexport function isObject(value: any): value is object {\n // Avoid a V8 JIT bug in Chrome 19-20.\n // See https://code.google.com/p/v8/issues/detail?id=2291 for more details.\n const type = typeof value;\n return !!value && (type === 'object' || type === 'function');\n}\n\nexport function isFunction(value: any): value is Function {\n const type = typeof value;\n return !!value && type === 'function';\n}\n\nexport function isDate(value: any): value is Date {\n const type = typeof value;\n return !!value && type === 'object' && !!value.getTime;\n}\n\nexport function isBoolean(value: any): value is boolean {\n return value === true || value === false || (isObjectLike(value) && baseGetTag(value) === '[object Boolean]');\n}\n\nexport function isTemplateRef<C = any>(value: any): value is TemplateRef<C> {\n return value instanceof TemplateRef;\n}\n\nexport function isHTMLElement(value: any): value is HTMLElement {\n return value instanceof HTMLElement;\n}\n\nexport function isElementRef(value: any): value is ElementRef {\n return value instanceof ElementRef;\n}\n\nexport function isFormElement<T = Element>(elementOrRef: ElementRef<T> | T): boolean {\n const element = coerceElement(elementOrRef);\n if (!(element instanceof HTMLElement)) {\n return false;\n }\n const name = element.nodeName.toLowerCase();\n const type = (element.getAttribute('type') || '').toLowerCase();\n return (\n name === 'select' ||\n name === 'textarea' ||\n (name === 'input' && type !== 'submit' && type !== 'reset' && type !== 'checkbox' && type !== 'radio' && type !== 'file') ||\n element.isContentEditable\n );\n}\n\nexport function isMacPlatform(userAgent = navigator.userAgent) {\n return /macintosh|mac os x/i.test(userAgent);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAGM,SAAU,WAAW,CAAC,KAAU,EAAA;IAClC,OAAO,KAAK,KAAK,SAAS;AAC9B;AAEM,SAAU,MAAM,CAAC,KAAU,EAAA;IAC7B,OAAO,KAAK,KAAK,IAAI;AACzB;AAEM,SAAU,iBAAiB,CAAC,KAAU,EAAA;IACxC,OAAO,WAAW,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC;AAC9C;AAEM,SAAU,OAAO,CAAU,KAAU,EAAA;IACvC,OAAO,KAAK,IAAI,UAAU,CAAC,KAAK,CAAC,KAAK,gBAAgB;AAC1D;AAEM,SAAU,OAAO,CAAC,KAAW,EAAA;AAC/B,IAAA,IAAI,iBAAiB,CAAC,KAAK,CAAC,EAAE;AAC1B,QAAA,OAAO,IAAI
|
|
1
|
+
{"version":3,"file":"tethys-cdk-is.mjs","sources":["../../../cdk/is/utils.ts","../../../cdk/is/tethys-cdk-is.ts"],"sourcesContent":["import { coerceElement } from '@angular/cdk/coercion';\nimport { ElementRef, TemplateRef } from '@angular/core';\n\nexport function isUndefined(value: any): value is undefined {\n return value === undefined;\n}\n\nexport function isNull(value: any): value is null {\n return value === null;\n}\n\nexport function isUndefinedOrNull(value: any): value is undefined | null {\n return isUndefined(value) || isNull(value);\n}\n\nexport function isArray<T = any>(value: any): value is Array<T> {\n return value && baseGetTag(value) === '[object Array]';\n}\n\nexport function isEmpty(value?: any): boolean {\n if (isUndefinedOrNull(value)) {\n return true;\n }\n if (isArray(value)) {\n return !value.length;\n }\n const tag = baseGetTag(value);\n if (tag == '[object Map]' || tag == '[object Set]') {\n return !value.size;\n }\n for (const key in value) {\n if (Object.hasOwnProperty.call(value, key)) {\n return false;\n }\n }\n return true;\n}\n\nexport function isString(value?: any): value is string {\n return typeof value == 'string' || (!isArray(value) && isObjectLike(value) && baseGetTag(value) === '[object String]');\n}\n\nfunction isObjectLike(value: any): value is object {\n return value !== null && typeof value === 'object';\n}\n\nfunction baseGetTag(value: any) {\n const objectProto = Object.prototype;\n const hasOwnProperty = objectProto.hasOwnProperty;\n const toString = objectProto.toString;\n const symToStringTag = typeof Symbol !== 'undefined' ? Symbol.toStringTag : undefined;\n\n if (value == null) {\n return value === undefined ? '[object Undefined]' : '[object Null]';\n }\n if (!(symToStringTag && symToStringTag in Object(value))) {\n return toString.call(value);\n }\n const isOwn = hasOwnProperty.call(value, symToStringTag);\n const tag = value[symToStringTag];\n let unmasked = false;\n try {\n value[symToStringTag] = undefined;\n unmasked = true;\n } catch (e) {}\n\n const result = toString.call(value);\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag] = tag;\n } else {\n delete value[symToStringTag];\n }\n }\n return result;\n}\n\nexport function isNumber(value: any): value is number {\n return typeof value === 'number' || (isObjectLike(value) && baseGetTag(value) === '[object Number]');\n}\n\nexport function isObject(value: any): value is object {\n // Avoid a V8 JIT bug in Chrome 19-20.\n // See https://code.google.com/p/v8/issues/detail?id=2291 for more details.\n const type = typeof value;\n return !!value && (type === 'object' || type === 'function');\n}\n\nexport function isFunction(value: any): value is Function {\n const type = typeof value;\n return !!value && type === 'function';\n}\n\nexport function isDate(value: any): value is Date {\n const type = typeof value;\n return !!value && type === 'object' && !!value.getTime;\n}\n\nexport function isBoolean(value: any): value is boolean {\n return value === true || value === false || (isObjectLike(value) && baseGetTag(value) === '[object Boolean]');\n}\n\nexport function isTemplateRef<C = any>(value: any): value is TemplateRef<C> {\n return value instanceof TemplateRef;\n}\n\nexport function isHTMLElement(value: any): value is HTMLElement {\n return value instanceof HTMLElement;\n}\n\nexport function isElementRef(value: any): value is ElementRef {\n return value instanceof ElementRef;\n}\n\nexport function isFormElement<T = Element>(elementOrRef: ElementRef<T> | T): boolean {\n const element = coerceElement(elementOrRef);\n if (!(element instanceof HTMLElement)) {\n return false;\n }\n const name = element.nodeName.toLowerCase();\n const type = (element.getAttribute('type') || '').toLowerCase();\n return (\n name === 'select' ||\n name === 'textarea' ||\n (name === 'input' && type !== 'submit' && type !== 'reset' && type !== 'checkbox' && type !== 'radio' && type !== 'file') ||\n element.isContentEditable\n );\n}\n\nexport function isMacPlatform(userAgent = navigator.userAgent) {\n return /macintosh|mac os x/i.test(userAgent);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAGM,SAAU,WAAW,CAAC,KAAU,EAAA;IAClC,OAAO,KAAK,KAAK,SAAS;AAC9B;AAEM,SAAU,MAAM,CAAC,KAAU,EAAA;IAC7B,OAAO,KAAK,KAAK,IAAI;AACzB;AAEM,SAAU,iBAAiB,CAAC,KAAU,EAAA;IACxC,OAAO,WAAW,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC;AAC9C;AAEM,SAAU,OAAO,CAAU,KAAU,EAAA;IACvC,OAAO,KAAK,IAAI,UAAU,CAAC,KAAK,CAAC,KAAK,gBAAgB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C,SAAS,CAAC;AAChD;;ACnIA;;AAEG;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tethys-cdk-logger.mjs","sources":["../../../cdk/logger/logger.ts","../../../cdk/logger/tethys-cdk-logger.ts"],"sourcesContent":["import { isDevMode } from '@angular/core';\n\nconst record: Record<string, boolean> = {};\n\nexport const PREFIX = '[TETHYS-CDK]:';\n\nfunction notRecorded(...args: any[]): boolean {\n const asRecord = args.reduce((acc, c) => acc + c.toString(), '');\n\n if (record[asRecord]) {\n return false;\n } else {\n record[asRecord] = true;\n return true;\n }\n}\n\nfunction consoleCommonBehavior(consoleFunc: (...args: any) => void, ...args: any[]): void {\n if (isDevMode() && notRecorded(...args)) {\n consoleFunc(...args);\n }\n}\n\n// Warning should only be printed in dev mode and only once.\nexport const warn = (...args: any[]) => consoleCommonBehavior((...arg: any[]) => console.warn(PREFIX, ...arg), ...args);\n\nexport function createWarnDeprecation(prefix: string): (...args: any[]) => void {\n return (...args: any[]) => {\n const stack = new Error().stack;\n return consoleCommonBehavior(\n (...arg: any[]) => {\n console.warn(prefix, 'deprecated:', ...arg, stack);\n },\n ...args\n );\n };\n}\n\nexport const warnDeprecation = createWarnDeprecation(PREFIX);\n\n// Log should only be printed in dev mode.\nexport const log = (...args: any[]) => {\n if (isDevMode()) {\n console.log(PREFIX, ...args);\n }\n};\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;AAEA,MAAM,MAAM,GAA4B,EAAE;AAEnC,MAAM,MAAM,GAAG;AAEtB,SAAS,WAAW,CAAC,GAAG,IAAW,EAAA;IAC/B,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,EAAE,CAAC;AAEhE,IAAA,IAAI,MAAM,CAAC,QAAQ,CAAC,EAAE;AAClB,QAAA,OAAO,KAAK
|
|
1
|
+
{"version":3,"file":"tethys-cdk-logger.mjs","sources":["../../../cdk/logger/logger.ts","../../../cdk/logger/tethys-cdk-logger.ts"],"sourcesContent":["import { isDevMode } from '@angular/core';\n\nconst record: Record<string, boolean> = {};\n\nexport const PREFIX = '[TETHYS-CDK]:';\n\nfunction notRecorded(...args: any[]): boolean {\n const asRecord = args.reduce((acc, c) => acc + c.toString(), '');\n\n if (record[asRecord]) {\n return false;\n } else {\n record[asRecord] = true;\n return true;\n }\n}\n\nfunction consoleCommonBehavior(consoleFunc: (...args: any) => void, ...args: any[]): void {\n if (isDevMode() && notRecorded(...args)) {\n consoleFunc(...args);\n }\n}\n\n// Warning should only be printed in dev mode and only once.\nexport const warn = (...args: any[]) => consoleCommonBehavior((...arg: any[]) => console.warn(PREFIX, ...arg), ...args);\n\nexport function createWarnDeprecation(prefix: string): (...args: any[]) => void {\n return (...args: any[]) => {\n const stack = new Error().stack;\n return consoleCommonBehavior(\n (...arg: any[]) => {\n console.warn(prefix, 'deprecated:', ...arg, stack);\n },\n ...args\n );\n };\n}\n\nexport const warnDeprecation = createWarnDeprecation(PREFIX);\n\n// Log should only be printed in dev mode.\nexport const log = (...args: any[]) => {\n if (isDevMode()) {\n console.log(PREFIX, ...args);\n }\n};\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;AAEA,MAAM,MAAM,GAA4B,EAAE;AAEnC,MAAM,MAAM,GAAG;AAEtB,SAAS,WAAW,CAAC,GAAG,IAAW,EAAA;IAC/B,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,EAAE,CAAC;AAEhE,IAAA,IAAI,MAAM,CAAC,QAAQ,CAAC,EAAE;AAClB,QAAA,OAAO,KAAK;IAChB;SAAO;AACH,QAAA,MAAM,CAAC,QAAQ,CAAC,GAAG,IAAI;AACvB,QAAA,OAAO,IAAI;IACf;AACJ;AAEA,SAAS,qBAAqB,CAAC,WAAmC,EAAE,GAAG,IAAW,EAAA;IAC9E,IAAI,SAAS,EAAE,IAAI,WAAW,CAAC,GAAG,IAAI,CAAC,EAAE;AACrC,QAAA,WAAW,CAAC,GAAG,IAAI,CAAC;IACxB;AACJ;AAEA;AACO,MAAM,IAAI,GAAG,CAAC,GAAG,IAAW,KAAK,qBAAqB,CAAC,CAAC,GAAG,GAAU,KAAK,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,CAAC,EAAE,GAAG,IAAI;AAEhH,SAAU,qBAAqB,CAAC,MAAc,EAAA;AAChD,IAAA,OAAO,CAAC,GAAG,IAAW,KAAI;AACtB,QAAA,MAAM,KAAK,GAAG,IAAI,KAAK,EAAE,CAAC,KAAK;AAC/B,QAAA,OAAO,qBAAqB,CACxB,CAAC,GAAG,GAAU,KAAI;AACd,YAAA,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,aAAa,EAAE,GAAG,GAAG,EAAE,KAAK,CAAC;AACtD,QAAA,CAAC,EACD,GAAG,IAAI,CACV;AACL,IAAA,CAAC;AACL;MAEa,eAAe,GAAG,qBAAqB,CAAC,MAAM;AAE3D;MACa,GAAG,GAAG,CAAC,GAAG,IAAW,KAAI;IAClC,IAAI,SAAS,EAAE,EAAE;QACb,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC;IAChC;AACJ;;AC7CA;;AAEG;;;;"}
|
package/hotkey/index.d.ts
CHANGED
|
@@ -1,4 +1,52 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { OnInit, OnDestroy, ElementRef } from '@angular/core';
|
|
3
|
+
import { ThyEventDispatcher } from '@tethys/cdk/event';
|
|
4
|
+
import { Observable } from 'rxjs';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @name thyHotkey
|
|
8
|
+
*/
|
|
9
|
+
declare class ThyHotkeyDirective implements OnInit, OnDestroy {
|
|
10
|
+
private document;
|
|
11
|
+
private hotkeyDispatcher;
|
|
12
|
+
private elementRef;
|
|
13
|
+
/**
|
|
14
|
+
* 热键对应 Code,多个热键组合支持通过数组或逗号分割的形式传入
|
|
15
|
+
*/
|
|
16
|
+
readonly thyHotkey: i0.InputSignal<string | string[]>;
|
|
17
|
+
/**
|
|
18
|
+
* 配置热键触发范围,默认绑定在 document 上
|
|
19
|
+
*/
|
|
20
|
+
readonly thyHotkeyScope: i0.InputSignal<string | Element | ElementRef<Element>>;
|
|
21
|
+
/**
|
|
22
|
+
* 热键触发后的事件
|
|
23
|
+
*/
|
|
24
|
+
readonly thyHotkeyListener: i0.OutputEmitterRef<KeyboardEvent>;
|
|
25
|
+
private subscription;
|
|
26
|
+
ngOnInit(): void;
|
|
27
|
+
ngOnDestroy(): void;
|
|
28
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ThyHotkeyDirective, never>;
|
|
29
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<ThyHotkeyDirective, "[thyHotkey]", never, { "thyHotkey": { "alias": "thyHotkey"; "required": false; "isSignal": true; }; "thyHotkeyScope": { "alias": "thyHotkeyScope"; "required": false; "isSignal": true; }; }, { "thyHotkeyListener": "thyHotkeyListener"; }, never, never, true, never>;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
declare class ThyHotkeyModule {
|
|
33
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ThyHotkeyModule, never>;
|
|
34
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<ThyHotkeyModule, never, [typeof ThyHotkeyDirective], [typeof ThyHotkeyDirective]>;
|
|
35
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<ThyHotkeyModule>;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
declare function hotkey(event: KeyboardEvent): string;
|
|
39
|
+
declare function isHotkey(event: KeyboardEvent, key: string): boolean;
|
|
40
|
+
|
|
41
|
+
declare class ThyHotkeyDispatcher extends ThyEventDispatcher {
|
|
42
|
+
eventName: string;
|
|
43
|
+
private createKeydownObservable;
|
|
44
|
+
/**
|
|
45
|
+
* 热键事件订阅
|
|
46
|
+
*/
|
|
47
|
+
keydown(hotkey: string | string[], scope?: ElementRef<Element> | Element | Document): Observable<KeyboardEvent>;
|
|
48
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ThyHotkeyDispatcher, never>;
|
|
49
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<ThyHotkeyDispatcher>;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export { ThyHotkeyDirective, ThyHotkeyDispatcher, ThyHotkeyModule, hotkey, isHotkey };
|
package/immutable/index.d.ts
CHANGED
|
@@ -1,2 +1,90 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
type GetIndexedField<T, K> = K extends keyof T ? T[K] : K extends `${number}` ? '0' extends keyof T ? undefined : number extends keyof T ? T[number] : undefined : undefined;
|
|
2
|
+
type FieldWithPossiblyUndefined<T, Key> = GetFieldType<Exclude<T, undefined>, Key> | Extract<T, undefined>;
|
|
3
|
+
type IndexedFieldWithPossiblyUndefined<T, Key> = GetIndexedField<Exclude<T, undefined>, Key> | Extract<T, undefined>;
|
|
4
|
+
type GetFieldType<T, P> = P extends `${infer Left}.${infer Right}` ? Left extends keyof T ? FieldWithPossiblyUndefined<T[Left], Right> : Left extends `${infer FieldKey}[${infer IndexKey}]` ? FieldKey extends keyof T ? FieldWithPossiblyUndefined<IndexedFieldWithPossiblyUndefined<T[FieldKey], IndexKey>, Right> : undefined : undefined : P extends keyof T ? T[P] : P extends `${infer FieldKey}[${infer IndexKey}]` ? FieldKey extends keyof T ? IndexedFieldWithPossiblyUndefined<T[FieldKey], IndexKey> : undefined : undefined;
|
|
5
|
+
declare class ObjectProducer<TEntity> {
|
|
6
|
+
entity: TEntity;
|
|
7
|
+
constructor(entity: TEntity);
|
|
8
|
+
get<TPath extends string>(propPath: TPath): GetFieldType<TEntity, TPath>;
|
|
9
|
+
set<TPath extends string>(propPath: TPath, value: GetFieldType<TEntity, TPath>): TEntity;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
type Id = string | number;
|
|
13
|
+
type Ids = Id[];
|
|
14
|
+
type IdOrIds = Id | Ids;
|
|
15
|
+
interface EntityAddOptions {
|
|
16
|
+
prepend?: boolean;
|
|
17
|
+
afterId?: Id;
|
|
18
|
+
}
|
|
19
|
+
interface EntityMoveOptions {
|
|
20
|
+
afterId?: Id;
|
|
21
|
+
toIndex?: number;
|
|
22
|
+
}
|
|
23
|
+
type ExtractKeysOfValueType<T, K> = {
|
|
24
|
+
[I in keyof T]: T[I] extends K ? I : never;
|
|
25
|
+
}[keyof T];
|
|
26
|
+
interface ProducerOptions<TEntity> {
|
|
27
|
+
idKey?: ExtractKeysOfValueType<TEntity, Id>;
|
|
28
|
+
}
|
|
29
|
+
declare class Producer<TEntity> {
|
|
30
|
+
private idKey;
|
|
31
|
+
private entities;
|
|
32
|
+
constructor(entities: TEntity[], options?: ProducerOptions<TEntity>);
|
|
33
|
+
/**
|
|
34
|
+
* Add an entity or entities.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* produce([users]).add(Entity);
|
|
38
|
+
* produce([users]).add([Entity, Entity]);
|
|
39
|
+
* produce([users]).add(Entity, { prepend: true });
|
|
40
|
+
* produce([users]).add(Entity, { afterId: '' });
|
|
41
|
+
*/
|
|
42
|
+
add(entity: TEntity | TEntity[], addOptions?: EntityAddOptions): TEntity[];
|
|
43
|
+
/**
|
|
44
|
+
*
|
|
45
|
+
* Update an entity or entities.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* produce([users]).update(3, {
|
|
49
|
+
* name: 'New Name'
|
|
50
|
+
* });
|
|
51
|
+
*
|
|
52
|
+
* produce([users]).update(3, entity => {
|
|
53
|
+
* return {
|
|
54
|
+
* ...entity,
|
|
55
|
+
* name: 'New Name'
|
|
56
|
+
* }
|
|
57
|
+
* });
|
|
58
|
+
*
|
|
59
|
+
* produce([users]).update([1,2,3], {
|
|
60
|
+
* name: 'New Name'
|
|
61
|
+
* });
|
|
62
|
+
*/
|
|
63
|
+
update(id: IdOrIds | null, newStateFn: (entity: Readonly<TEntity>) => Partial<TEntity>): TEntity[];
|
|
64
|
+
update(id: IdOrIds | null, newState?: Partial<TEntity>): TEntity[];
|
|
65
|
+
/**
|
|
66
|
+
*
|
|
67
|
+
* Remove one or more entities:
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* produce([users]).remove(5);
|
|
71
|
+
* produce([users]).remove([1,2,3]);
|
|
72
|
+
* produce([users]).remove(entity => entity.id === 1);
|
|
73
|
+
*/
|
|
74
|
+
remove(id: IdOrIds): TEntity[];
|
|
75
|
+
remove(predicate: (entity: Readonly<TEntity>) => boolean): TEntity[];
|
|
76
|
+
/**
|
|
77
|
+
*
|
|
78
|
+
* Move one or more entities:
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* produce([users]).move(5, {afterId: 2});
|
|
82
|
+
* produce([users]).move(5, {toIndex: 0});
|
|
83
|
+
*/
|
|
84
|
+
move(id: Id, moveOptions?: EntityMoveOptions): TEntity[];
|
|
85
|
+
}
|
|
86
|
+
declare function produce<TEntity>(entities: TEntity[], options?: ProducerOptions<TEntity>): Producer<TEntity>;
|
|
87
|
+
declare function produce<TEntity>(entities: TEntity): ObjectProducer<TEntity>;
|
|
88
|
+
|
|
89
|
+
export { ObjectProducer, Producer, produce };
|
|
90
|
+
export type { EntityAddOptions, EntityMoveOptions, Id, IdOrIds, Ids, ProducerOptions };
|
package/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export * from '
|
|
1
|
+
export * from '@tethys/cdk/is';
|
|
2
|
+
export * from '@tethys/cdk/logger';
|
|
3
|
+
export * from '@tethys/cdk/immutable';
|
|
4
|
+
export * from '@tethys/cdk/event';
|
|
5
|
+
export * from '@tethys/cdk/hotkey';
|
package/is/index.d.ts
CHANGED
|
@@ -1 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
import { TemplateRef, ElementRef } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
declare function isUndefined(value: any): value is undefined;
|
|
4
|
+
declare function isNull(value: any): value is null;
|
|
5
|
+
declare function isUndefinedOrNull(value: any): value is undefined | null;
|
|
6
|
+
declare function isArray<T = any>(value: any): value is Array<T>;
|
|
7
|
+
declare function isEmpty(value?: any): boolean;
|
|
8
|
+
declare function isString(value?: any): value is string;
|
|
9
|
+
declare function isNumber(value: any): value is number;
|
|
10
|
+
declare function isObject(value: any): value is object;
|
|
11
|
+
declare function isFunction(value: any): value is Function;
|
|
12
|
+
declare function isDate(value: any): value is Date;
|
|
13
|
+
declare function isBoolean(value: any): value is boolean;
|
|
14
|
+
declare function isTemplateRef<C = any>(value: any): value is TemplateRef<C>;
|
|
15
|
+
declare function isHTMLElement(value: any): value is HTMLElement;
|
|
16
|
+
declare function isElementRef(value: any): value is ElementRef;
|
|
17
|
+
declare function isFormElement<T = Element>(elementOrRef: ElementRef<T> | T): boolean;
|
|
18
|
+
declare function isMacPlatform(userAgent?: string): boolean;
|
|
19
|
+
|
|
20
|
+
export { isArray, isBoolean, isDate, isElementRef, isEmpty, isFormElement, isFunction, isHTMLElement, isMacPlatform, isNull, isNumber, isObject, isString, isTemplateRef, isUndefined, isUndefinedOrNull };
|
package/logger/index.d.ts
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
declare const PREFIX = "[TETHYS-CDK]:";
|
|
2
|
+
declare const warn: (...args: any[]) => void;
|
|
3
|
+
declare function createWarnDeprecation(prefix: string): (...args: any[]) => void;
|
|
4
|
+
declare const warnDeprecation: (...args: any[]) => void;
|
|
5
|
+
declare const log: (...args: any[]) => void;
|
|
6
|
+
|
|
7
|
+
export { PREFIX, createWarnDeprecation, log, warn, warnDeprecation };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tethys/cdk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "20.0.0-next.0",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@angular/common": "^19.0.0",
|
|
6
6
|
"@angular/core": "^19.0.0",
|
|
@@ -23,14 +23,14 @@
|
|
|
23
23
|
"types": "./behaviors/index.d.ts",
|
|
24
24
|
"default": "./fesm2022/tethys-cdk-behaviors.mjs"
|
|
25
25
|
},
|
|
26
|
-
"./dom": {
|
|
27
|
-
"types": "./dom/index.d.ts",
|
|
28
|
-
"default": "./fesm2022/tethys-cdk-dom.mjs"
|
|
29
|
-
},
|
|
30
26
|
"./event": {
|
|
31
27
|
"types": "./event/index.d.ts",
|
|
32
28
|
"default": "./fesm2022/tethys-cdk-event.mjs"
|
|
33
29
|
},
|
|
30
|
+
"./dom": {
|
|
31
|
+
"types": "./dom/index.d.ts",
|
|
32
|
+
"default": "./fesm2022/tethys-cdk-dom.mjs"
|
|
33
|
+
},
|
|
34
34
|
"./hotkey": {
|
|
35
35
|
"types": "./hotkey/index.d.ts",
|
|
36
36
|
"default": "./fesm2022/tethys-cdk-hotkey.mjs"
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Observable } from 'rxjs';
|
|
2
|
-
import { Signal } from '@angular/core';
|
|
3
|
-
import { Behavior, BehaviorContext } from './behavior';
|
|
4
|
-
import { ErrorFn, ExtractObservableValue, SuccessFn } from './types';
|
|
5
|
-
export interface ActionBehavior<R> {
|
|
6
|
-
saving: Signal<boolean>;
|
|
7
|
-
execute(success?: SuccessFn<R>, error?: ErrorFn): Observable<R>;
|
|
8
|
-
execute(context: BehaviorContext<R>): Observable<R>;
|
|
9
|
-
execute(successOrContext: SuccessFn<R> | BehaviorContext<R>, error?: ErrorFn): Observable<R>;
|
|
10
|
-
}
|
|
11
|
-
export declare function actionBehavior<A extends (...args: any) => Observable<any> = (...args: any) => Observable<any>>(action: A, context?: BehaviorContext<ExtractObservableValue<ReturnType<A>>>): Behavior<Parameters<A>, ActionBehavior<ExtractObservableValue<ReturnType<A>>>> & ActionBehavior<ExtractObservableValue<ReturnType<A>>>;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Observable } from 'rxjs';
|
|
2
|
-
import { Behavior, BehaviorContext } from './behavior';
|
|
3
|
-
import { ErrorFn, ExtractObservableValue, SuccessFn } from './types';
|
|
4
|
-
import { Signal } from '@angular/core';
|
|
5
|
-
export interface AsyncBehavior<R> {
|
|
6
|
-
loadingDone: Signal<boolean>;
|
|
7
|
-
loading: Signal<boolean>;
|
|
8
|
-
state: Signal<'pending' | 'loading' | 'success' | 'error'>;
|
|
9
|
-
error?: Signal<Error>;
|
|
10
|
-
value?: Signal<R>;
|
|
11
|
-
execute(success?: SuccessFn<R>, error?: ErrorFn): void;
|
|
12
|
-
execute(context: BehaviorContext<R>): void;
|
|
13
|
-
execute(successOrContext: SuccessFn<R> | BehaviorContext<R>, error?: ErrorFn): void;
|
|
14
|
-
}
|
|
15
|
-
export declare function asyncBehavior<A extends (...args: any) => Observable<any> = (...args: any) => Observable<any>>(action: A, context?: BehaviorContext<ExtractObservableValue<ReturnType<A>>>): Behavior<Parameters<A>, AsyncBehavior<ExtractObservableValue<ReturnType<A>>>> & AsyncBehavior<ExtractObservableValue<ReturnType<A>>>;
|
package/behaviors/behavior.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { ErrorFn, SuccessFn } from './types';
|
|
2
|
-
declare const BEHAVIOR: unique symbol;
|
|
3
|
-
export type Behavior<P extends Array<any>, R> = (...args: P) => R & {
|
|
4
|
-
[BEHAVIOR]: true;
|
|
5
|
-
};
|
|
6
|
-
export interface BehaviorContext<R> {
|
|
7
|
-
success?: SuccessFn<R>;
|
|
8
|
-
error?: ErrorFn;
|
|
9
|
-
}
|
|
10
|
-
export declare function createBehaviorFromFunction<P extends any[], R>(fn: () => R): Behavior<P, R>;
|
|
11
|
-
export declare function createBehaviorFromFunction<P extends any[], R, U extends Record<string, unknown>>(fn: () => R, extraApi: U): Behavior<P, R> & U;
|
|
12
|
-
export declare function pickBehaviorCallbacks<R>(beforeContext: BehaviorContext<R>, successOrContext: SuccessFn<R> | BehaviorContext<R>, error?: ErrorFn): {
|
|
13
|
-
success: SuccessFn<R>;
|
|
14
|
-
error: ErrorFn;
|
|
15
|
-
};
|
|
16
|
-
export declare function handleBehaviorError(error: Error, errorFn: ErrorFn): void;
|
|
17
|
-
export {};
|
package/behaviors/types.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { Observable } from 'rxjs';
|
|
2
|
-
export type ExtractObservableValue<T> = T extends Observable<infer V> ? V : T;
|
|
3
|
-
export type ParametersWithAppend<Fn extends (...args: any[]) => any, NextArg> = Fn extends (...args: infer PrevArg) => any ? [...PrevArg, NextArg] : never;
|
|
4
|
-
export type SuccessFn<R> = (result: R) => void;
|
|
5
|
-
export type ErrorFn = (error: Error) => void;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { RendererStyleFlags2 } from '@angular/core';
|
|
2
|
-
export declare abstract class AbstractElementRenderer {
|
|
3
|
-
private renderer;
|
|
4
|
-
protected abstract element: Element;
|
|
5
|
-
private classNames;
|
|
6
|
-
private get safeElement();
|
|
7
|
-
updateClass(classNames: string[]): this;
|
|
8
|
-
updateClassByMap(classMap: Record<string, boolean>): void;
|
|
9
|
-
addClass(className: string): this;
|
|
10
|
-
removeClass(className: string): this;
|
|
11
|
-
setStyle(style: string, value: any, flags?: RendererStyleFlags2): this;
|
|
12
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { AbstractElementRenderer } from './abstract-element-renderer';
|
|
2
|
-
export declare class ElementRenderer extends AbstractElementRenderer {
|
|
3
|
-
protected element: Element;
|
|
4
|
-
setElement(element: Element): void;
|
|
5
|
-
constructor(element: Element);
|
|
6
|
-
}
|
|
7
|
-
export declare function useElementRenderer(element?: Element): ElementRenderer;
|
package/dom/host-renderer.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { AbstractElementRenderer } from './abstract-element-renderer';
|
|
2
|
-
import * as i0 from "@angular/core";
|
|
3
|
-
/**
|
|
4
|
-
* @private
|
|
5
|
-
*/
|
|
6
|
-
export declare class HostRenderer extends AbstractElementRenderer {
|
|
7
|
-
private elementRef;
|
|
8
|
-
protected get element(): any;
|
|
9
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<HostRenderer, never>;
|
|
10
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<HostRenderer>;
|
|
11
|
-
}
|
|
12
|
-
export declare function useHostRenderer(): HostRenderer;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import * as i0 from "@angular/core";
|
|
2
|
-
export declare class ThyStealthView {
|
|
3
|
-
private templateRef;
|
|
4
|
-
private stealthViewBehavior;
|
|
5
|
-
get rootNodes(): Node[];
|
|
6
|
-
constructor();
|
|
7
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<ThyStealthView, never>;
|
|
8
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<ThyStealthView, "ng-template[thyStealthView]", ["thyStealthView"], {}, {}, never, never, true, never>;
|
|
9
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Observable } from 'rxjs';
|
|
2
|
-
import { ThyEventDispatcher } from './event-dispatcher';
|
|
3
|
-
import * as i0 from "@angular/core";
|
|
4
|
-
export declare class ThyClickDispatcher extends ThyEventDispatcher {
|
|
5
|
-
constructor();
|
|
6
|
-
clicked(auditTimeInMs?: number): Observable<Event>;
|
|
7
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<ThyClickDispatcher, never>;
|
|
8
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<ThyClickDispatcher>;
|
|
9
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { Observable, Subscription } from 'rxjs';
|
|
2
|
-
import { NgZone, OnDestroy } from '@angular/core';
|
|
3
|
-
import * as i0 from "@angular/core";
|
|
4
|
-
export declare abstract class ThyEventDispatcher<T = Event> implements OnDestroy {
|
|
5
|
-
protected document: Document;
|
|
6
|
-
protected ngZone: NgZone;
|
|
7
|
-
private eventName;
|
|
8
|
-
private _globalSubscription;
|
|
9
|
-
private _event$;
|
|
10
|
-
private _subscriptionCount;
|
|
11
|
-
private _addGlobalListener;
|
|
12
|
-
private _removeGlobalListener;
|
|
13
|
-
get globalSubscription(): Subscription;
|
|
14
|
-
constructor(document: Document, ngZone: NgZone, eventName: string);
|
|
15
|
-
protected subscribe(auditTimeInMs?: number): Observable<T>;
|
|
16
|
-
ngOnDestroy(): void;
|
|
17
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<ThyEventDispatcher<any>, never>;
|
|
18
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<ThyEventDispatcher<any>, never, never, {}, {}, never, never, true, never>;
|
|
19
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Observable } from 'rxjs';
|
|
2
|
-
import { ThyEventDispatcher } from './event-dispatcher';
|
|
3
|
-
import * as i0 from "@angular/core";
|
|
4
|
-
export declare class ThyKeyboardDispatcher extends ThyEventDispatcher {
|
|
5
|
-
constructor();
|
|
6
|
-
keydown(auditTimeInMs?: number): Observable<Event>;
|
|
7
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<ThyKeyboardDispatcher, never>;
|
|
8
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<ThyKeyboardDispatcher>;
|
|
9
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { ElementRef } from '@angular/core';
|
|
2
|
-
import { ThyEventDispatcher } from '@tethys/cdk/event';
|
|
3
|
-
import { Observable } from 'rxjs';
|
|
4
|
-
import * as i0 from "@angular/core";
|
|
5
|
-
export declare class ThyHotkeyDispatcher extends ThyEventDispatcher {
|
|
6
|
-
constructor();
|
|
7
|
-
private createKeydownObservable;
|
|
8
|
-
/**
|
|
9
|
-
* 热键事件订阅
|
|
10
|
-
*/
|
|
11
|
-
keydown(hotkey: string | string[], scope?: ElementRef<Element> | Element | Document): Observable<KeyboardEvent>;
|
|
12
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<ThyHotkeyDispatcher, never>;
|
|
13
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<ThyHotkeyDispatcher>;
|
|
14
|
-
}
|
package/hotkey/hotkey.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { ElementRef, OnInit, OnDestroy } from '@angular/core';
|
|
2
|
-
import * as i0 from "@angular/core";
|
|
3
|
-
/**
|
|
4
|
-
* @name thyHotkey
|
|
5
|
-
*/
|
|
6
|
-
export declare class ThyHotkeyDirective implements OnInit, OnDestroy {
|
|
7
|
-
private document;
|
|
8
|
-
private hotkeyDispatcher;
|
|
9
|
-
private elementRef;
|
|
10
|
-
/**
|
|
11
|
-
* 热键对应 Code,多个热键组合支持通过数组或逗号分割的形式传入
|
|
12
|
-
*/
|
|
13
|
-
readonly thyHotkey: import("@angular/core").InputSignal<string | string[]>;
|
|
14
|
-
/**
|
|
15
|
-
* 配置热键触发范围,默认绑定在 document 上
|
|
16
|
-
*/
|
|
17
|
-
readonly thyHotkeyScope: import("@angular/core").InputSignal<string | Element | ElementRef<Element>>;
|
|
18
|
-
/**
|
|
19
|
-
* 热键触发后的事件
|
|
20
|
-
*/
|
|
21
|
-
readonly thyHotkeyListener: import("@angular/core").OutputEmitterRef<KeyboardEvent>;
|
|
22
|
-
private subscription;
|
|
23
|
-
ngOnInit(): void;
|
|
24
|
-
ngOnDestroy(): void;
|
|
25
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<ThyHotkeyDirective, never>;
|
|
26
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<ThyHotkeyDirective, "[thyHotkey]", never, { "thyHotkey": { "alias": "thyHotkey"; "required": false; "isSignal": true; }; "thyHotkeyScope": { "alias": "thyHotkeyScope"; "required": false; "isSignal": true; }; }, { "thyHotkeyListener": "thyHotkeyListener"; }, never, never, true, never>;
|
|
27
|
-
}
|