@ibyar/core 2.4.0 → 2.5.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/annotation/decorators.d.ts +23 -2
- package/annotation/decorators.d.ts.map +1 -1
- package/annotation/decorators.js +18 -0
- package/annotation/decorators.js.map +1 -1
- package/annotation/options.d.ts +5 -5
- package/annotation/options.d.ts.map +1 -1
- package/annotation/options.js.map +1 -1
- package/component/component.d.ts +14 -10
- package/component/component.d.ts.map +1 -1
- package/component/component.js +37 -0
- package/component/component.js.map +1 -1
- package/component/custom-element.d.ts +6 -2
- package/component/custom-element.d.ts.map +1 -1
- package/component/custom-element.js.map +1 -1
- package/component/events.js.map +1 -1
- package/component/initializer.d.ts +67 -0
- package/component/initializer.d.ts.map +1 -0
- package/component/initializer.js +59 -0
- package/component/initializer.js.map +1 -0
- package/di/inject.d.ts +11 -4
- package/di/inject.d.ts.map +1 -1
- package/di/inject.js +18 -2
- package/di/inject.js.map +1 -1
- package/di/provider.d.ts +7 -5
- package/di/provider.d.ts.map +1 -1
- package/di/provider.js +29 -13
- package/di/provider.js.map +1 -1
- package/index.d.ts +1 -0
- package/index.d.ts.map +1 -1
- package/index.js +1 -0
- package/index.js.map +1 -1
- package/initializer/input.d.ts +1 -0
- package/initializer/input.d.ts.map +1 -0
- package/initializer/input.js +2 -0
- package/initializer/input.js.map +1 -0
- package/linker/change-detector-ref.d.ts.map +1 -1
- package/linker/change-detector-ref.js +26 -4
- package/linker/change-detector-ref.js.map +1 -1
- package/linker/view-container-ref.d.ts +4 -4
- package/linker/view-container-ref.d.ts.map +1 -1
- package/linker/view-container-ref.js.map +1 -1
- package/package.json +6 -6
- package/pipe/pipe.d.ts +6 -6
- package/pipe/pipe.d.ts.map +1 -1
- package/pipe/pipe.js.map +1 -1
- package/signals/factory.d.ts +23 -0
- package/signals/factory.d.ts.map +1 -0
- package/signals/factory.js +65 -0
- package/signals/factory.js.map +1 -0
- package/signals/initializer.d.ts +26 -0
- package/signals/initializer.d.ts.map +1 -0
- package/signals/initializer.js +19 -0
- package/signals/initializer.js.map +1 -0
- package/signals/input.d.ts +1 -0
- package/signals/input.d.ts.map +1 -0
- package/signals/input.js +2 -0
- package/signals/input.js.map +1 -0
- package/signals/runtime.d.ts +37 -0
- package/signals/runtime.d.ts.map +1 -0
- package/signals/runtime.js +165 -0
- package/signals/runtime.js.map +1 -0
- package/signals/signals.d.ts +11 -9
- package/signals/signals.d.ts.map +1 -1
- package/signals/signals.js +23 -41
- package/signals/signals.js.map +1 -1
- package/utils/typeof.d.ts +4 -2
- package/utils/typeof.d.ts.map +1 -1
- package/utils/typeof.js.map +1 -1
- package/view/base-view.d.ts +2 -2
- package/view/base-view.d.ts.map +1 -1
- package/view/base-view.js +41 -23
- package/view/base-view.js.map +1 -1
- package/view/form-view.d.ts +2 -2
- package/view/form-view.d.ts.map +1 -1
- package/view/form-view.js.map +1 -1
- package/view/render.d.ts +2 -0
- package/view/render.d.ts.map +1 -1
- package/view/render.js +16 -0
- package/view/render.js.map +1 -1
- package/view/utils.d.ts +2 -2
- package/view/utils.d.ts.map +1 -1
- package/view/utils.js.map +1 -1
- package/view/view.d.ts +3 -3
- package/view/view.d.ts.map +1 -1
- package/view/view.js +15 -2
- package/view/view.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"custom-element.js","sourceRoot":"","sources":["../../../src/core/component/custom-element.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"custom-element.js","sourceRoot":"","sources":["../../../src/core/component/custom-element.ts"],"names":[],"mappings":"AAwDA,MAAM,UAAU,eAAe,CAAC,MAAW;IAC1C,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC;WAChC,MAAM,YAAY,WAAW,CAAC;AACnC,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAmB,MAAW,EAAE,SAAkB;IACtF,OAAO,eAAe,CAAC,MAAM,CAAC;WAC1B,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,YAAY,SAAS,CAAC;AACxD,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,OAAoB;IACjD,OAAO,OAAO,IAAI,OAAO,YAAY,WAAW,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC;AACrF,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,OAAoB;IACxD,OAAO,OAAO,IAAI,OAAO,YAAY,kBAAkB,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC;AAC5F,CAAC;AAqHD,MAAM,UAAU,cAAc,CAAC,GAAQ;IACtC,OAAO,GAAG;WACN,OAAO,GAAG,KAAK,QAAQ;WACvB,OAAO,GAAG,CAAC,UAAU,KAAK,UAAU;WACpC,OAAO,GAAG,CAAC,gBAAgB,KAAK,UAAU,CAAC;AAChD,CAAC","sourcesContent":["import type { ReactiveScope, ReactiveScopeControl, Context, SignalScope } from '@ibyar/expressions';\nimport type { Type } from '../utils/typeof.js';\nimport { EventEmitter } from './events.js';\nimport { ComponentRef } from './component.js';\nimport { AuroraZone } from '../zone/zone.js';\nimport { PropertyRef } from './reflect.js';\nimport { InjectionProvider } from '../di/provider.js';\nimport { ChangeDetectorRef } from '../linker/change-detector-ref.js';\n\nexport interface CustomElement {\n\tadoptedCallback(): void;\n\tattributeChangedCallback(name: string, oldValue: any, newValue: any): void;\n\tconnectedCallback(): void;\n\tdisconnectedCallback(): void;\n}\n\nexport type ModelType<T> = T & Context;\n\nexport type NodeContextType<T> = { 'this': BaseComponent<T> };\n\nexport interface BaseComponent<T> extends CustomElement {\n\n\t_model: ModelType<T>;\n\t_modelScope: ReactiveScopeControl<T & Context>;\n\t_signalScope: SignalScope;\n\t_viewScope: ReactiveScope<{ 'this': BaseComponent<T> }>;\n\t_zone: AuroraZone;\n\t_provider: InjectionProvider;\n\t_detector: ChangeDetectorRef;\n\n\tgetComponentRef(): ComponentRef<T>;\n\n\thasInputStartWith(viewProp: string): boolean;\n\tgetInputStartWith(viewProp: string): PropertyRef | undefined;\n\tgetInput(viewProp: string): PropertyRef | undefined;\n\tgetInputValue(viewProp: string): any;\n\tsetInputValue(viewProp: string, value: any): void;\n\n\thasInput(viewProp: string): boolean;\n\thasProp(propName: string): boolean;\n\thasOutput(viewProp: string): boolean;\n\n\tgetOutput(viewProp: string): PropertyRef | undefined;\n\tgetEventEmitter<V>(viewProp: string): EventEmitter<V> | undefined;\n\n\ttriggerOutput(eventName: string, value?: any): void;\n\tonDestroy(callback: () => void): void;\n\n\t/**\n\t * apply change detection\n\t */\n\tdetectChanges(): void;\n}\n\nexport interface HTMLComponent<T> extends BaseComponent<T>, HTMLElement { }\n\nexport function isHTMLComponent(object: any): object is HTMLComponent<any> {\n\treturn Reflect.has(object, '_model')\n\t\t&& object instanceof HTMLElement;\n}\n\nexport function isHTMLComponentOfType<T extends object>(object: any, typeClass: Type<T>): object is HTMLComponent<T> {\n\treturn isHTMLComponent(object)\n\t\t&& Reflect.get(object, '_model') instanceof typeClass;\n}\n\nexport function isHTMLElement(element: HTMLElement): element is HTMLElement {\n\treturn element && element instanceof HTMLElement && !element.tagName?.includes('-');\n}\n\nexport function isHTMLUnknownElement(element: HTMLElement): element is HTMLElement {\n\treturn element && element instanceof HTMLUnknownElement && !element.tagName?.includes('-');\n}\n\n/**\n * Lifecycle callbacks\n * A map, whose keys are the strings \"connectedCallback\", \"disconnectedCallback\", \"adoptedCallback\", \"attributeChangedCallback\", \n * \"formAssociatedCallback\", \"formDisabledCallback\", \"formResetCallback\", and \"formStateRestoreCallback\" \n * https://html.spec.whatwg.org/multipage/custom-elements.html#concept-custom-element-definition-lifecycle-callbacks\n * \n * A form-associated custom element API includes a set of extra lifecycle callbacks to tie in to the form lifecycle.\n * The callbacks are optional: only implement a callback if your element needs to do something at that point in the lifecycle.\n * https://html.spec.whatwg.org/multipage/custom-elements.html#the-elementinternals-interface \n * https://docs.google.com/document/d/1JO8puctCSpW-ZYGU8lF-h4FWRIDQNDVexzHoOQ2iQmY/edit\n */\nexport interface FormAssociatedCustomElement extends CustomElement {\n\n\t/**\n\t * Called when the browser associates the element with a form element,\n\t * or disassociates the element from a form element.\n\t * @param form \n\t */\n\tformAssociatedCallback(form: HTMLFormElement | null): void;\n\n\t/**\n\t * Called after the disabled state of the element changes,\n\t * either because the disabled attribute of this element was added or removed;\n\t * or because the disabled state changed on a <fieldset> that's an ancestor of this element.\n\t * The disabled parameter represents the new disabled state of the element.\n\t * The element may, for example, disable elements in its shadow DOM when it is disabled.\n\t * @param disabled \n\t */\n\tformDisabledCallback(disabled: boolean): void;\n\n\t/**\n\t * Called after the form is reset.\n\t * The element should reset itself to some kind of default state.\n\t * For <input> elements, this usually involves setting the value property to\n\t * match the value attribute set in markup (or in the case of a checkbox,\n\t * setting the checked property to match the checked attribute.\n\t */\n\tformResetCallback(): void;\n\n\t/**\n\t * Called in one of two circumstances:\n\t * When the browser restores the state of the element (for example, after a navigation, or when the browser restarts).\n\t * The mode argument is \"restore\" in this case.\n\t * \n\t * When the browser's input-assist features such as form auto filling sets a value.\n\t * The mode argument is \"autocomplete\" in this case.\n\t * \n\t * The type of the first argument depends on how the setFormValue() method was called.\n\t * For more details, see Restoring form state.\n\t */\n\tformStateRestoreCallback(value: any, mode: 'restore' | 'autocomplete'): void;\n}\n\nexport type WriteValueMode = 'restore' | 'autocomplete' | 'reset';\n\nexport type WriteValueOptions<T> = { value: T | null, mode?: 'restore' | 'autocomplete' } | { value?: undefined, mode: 'reset' };\n\n\nexport interface ValueControl<T = any> {\n\t/**\n\t * reset the value of the\n\t * @param value \n\t * @param mode \n\t */\n\twriteValue(opt: { value?: undefined, mode: 'reset' }): void;\n\n\t/**\n\t * \n\t * When the browser restores the state of the element (for example, after a navigation, or when the browser restarts).\n\t * The mode argument is \"restore\" in this case.\n\t * \n\t * When the browser's input-assist features such as form auto filling sets a value.\n\t * The mode argument is \"autocomplete\" in this case.\n\t * \n\t * @param opt: options contain the `value` to be written and `mode` represented by `restore` or `autocomplete` or `undefined`\n\t */\n\n\twriteValue(opt: { value: T | null, mode?: 'restore' | 'autocomplete' }): void;\n\n\twriteValue(opt: { value?: T | null, mode?: WriteValueMode }): void;\n\n\twriteValue(opt: WriteValueOptions<T>): void;\n\n\t/**\n\t * This method is called when new `ValueControl` assigned to the form associated element.\n\t * \n\t * When implementing the registerOnChange method in your own value accessor, save the given function so your class calls it at the appropriate time.\n\t * \n\t * ```ts\n\t * registerOnChange(fn: (_: any) => void): void {\n\t * \tthis._onChange = fn;\n\t * }\n\t * ```\n\t * \n\t * When the value changes in the UI, call the registered function to allow the forms API to update itself:\n\t * \n\t * ```ts\n\t * \n\t * onChange(event: Event){\n\t * \t\n\t * }\n\t * \n\t * ```\n\t * @param fn the function to be called when a control want to change the value of a form associated element.\n\t */\n\n\tregisterOnChange(fn: (value?: T | null) => void): void;\n\n\t/**\n\t * called when `disabled` attribute change.\n\t * @param isDisabled \n\t */\n\tsetDisabledState?(isDisabled: boolean): void;\n}\n\nexport function isValueControl(obj: any): obj is ValueControl {\n\treturn obj\n\t\t&& typeof obj === 'object'\n\t\t&& typeof obj.writeValue === 'function'\n\t\t&& typeof obj.registerOnChange === 'function';\n}\n\nexport interface BaseFormAssociatedComponent<T extends Object> extends BaseComponent<T>, FormAssociatedCustomElement {\n\treadonly internals: ElementInternals;\n\treadonly form: HTMLFormElement | null;\n\treadonly valueControl?: ValueControl<T>;\n\n\tregisterValueControl(valueControl: ValueControl): void;\n}\n\nexport interface FormAssociatedComponent<T extends Object, V = any> extends BaseFormAssociatedComponent<T>, HTMLComponent<T> {\n\n\tvalue: V | null;\n}\n\nexport type HTMLFormElement = HTMLButtonElement | HTMLDataListElement | HTMLFieldSetElement | HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\n\n\nexport interface ConstructorOfView<T> {\n\tnew(): T;\n\treadonly prototype: T;\n}\n"]}
|
package/component/events.js.map
CHANGED
|
@@ -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,CAAC,QAAQ,EAAE,EAAE,CAAC;gBACxB,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBAChB,OAAO,CAAC,KAAK,CAAC,uBAAuB,EAAE,KAAK,CAAC,CAAC;gBAC/C,CAAC;YACF,CAAC;QACF,CAAC,CAAC,CAAC;IACJ,CAAC;IACD,SAAS,CAAC,IAAU,EAAE,KAAW,EAAE,QAAc;QAChD,MAAM,YAAY,GAAoB,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC;QAC7D,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,YAAY,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;QAC9D,OAAO,YAAY,CAAC;IACrB,CAAC;IAED,MAAM,CAAC,YAA6B;QACnC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IACvC,CAAC;CACD","sourcesContent":["export class Subscription<T> {\n\tprivate othersSubscription: Subscription<any>[];\n\tconstructor(private eventEmitter: EventEmitter<T>) { }\n\tadd(subscription: Subscription<any>) {\n\t\tif (!this.othersSubscription) {\n\t\t\tthis.othersSubscription = [];\n\t\t}\n\t\tthis.othersSubscription.push(subscription);\n\t}\n\tunsubscribe(): void {\n\t\tthis.eventEmitter.remove(this);\n\t\tif (this.othersSubscription) {\n\t\t\tthis.othersSubscription.forEach((subscription) => {\n\t\t\t\tsubscription.unsubscribe();\n\t\t\t});\n\t\t}\n\t}\n}\n\ninterface Subscribe {\n\tnext?: any;\n\terror?: any;\n\tcomplete?: any;\n}\n\nexport class EventEmitter<T> {\n\tprivate subscribers: Map<Subscription<T>, Subscribe> = new Map();\n\tconstructor() { }\n\temit(value?: T): void {\n\t\tthis.subscribers.forEach((subscribe) => {\n\t\t\ttry {\n\t\t\t\tsubscribe.next(value);\n\t\t\t} catch (error) {\n\t\t\t\ttry {\n\t\t\t\t\tsubscribe.error?.(error);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tconsole.error('error: handling event', error);\n\t\t\t\t}\n\t\t\t} finally {\n\t\t\t\ttry {\n\t\t\t\t\tsubscribe.complete?.();\n\t\t\t\t} catch (error) {\n\t\t\t\t\tconsole.error('error: handling event', error);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\tsubscribe(next?: any, error?: any, complete?: any): Subscription<T> {\n\t\tconst subscription: Subscription<T> = new Subscription(this);\n\t\tthis.subscribers.set(subscription, { next, error, complete });\n\t\treturn subscription;\n\t}\n\n\tremove(subscription: Subscription<T>) {\n\t\tthis.subscribers.delete(subscription);\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"events.js","sourceRoot":"","sources":["../../../src/core/component/events.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,YAAY;IAEJ;IADZ,kBAAkB,CAAsB;IAChD,YAAoB,YAA6B;QAA7B,iBAAY,GAAZ,YAAY,CAAiB;IAAI,CAAC;IACtD,GAAG,CAAC,YAA+B;QAClC,IAAI,CAAC,IAAI,CAAC,kBAAkB,EAAE,CAAC;YAC9B,IAAI,CAAC,kBAAkB,GAAG,EAAE,CAAC;QAC9B,CAAC;QACD,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAC5C,CAAC;IACD,WAAW;QACV,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAC/B,IAAI,IAAI,CAAC,kBAAkB,EAAE,CAAC;YAC7B,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC,YAAY,EAAE,EAAE;gBAChD,YAAY,CAAC,WAAW,EAAE,CAAC;YAC5B,CAAC,CAAC,CAAC;QACJ,CAAC;IACF,CAAC;CACD;AAQD,MAAM,OAAO,YAAY;IAChB,WAAW,GAAoC,IAAI,GAAG,EAAE,CAAC;IACjE,gBAAgB,CAAC;IACjB,IAAI,CAAC,KAAS;QACb,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE;YACtC,IAAI,CAAC;gBACJ,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACvB,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,IAAI,CAAC;oBACJ,SAAS,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,CAAC;gBAC1B,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBAChB,OAAO,CAAC,KAAK,CAAC,uBAAuB,EAAE,KAAK,CAAC,CAAC;gBAC/C,CAAC;YACF,CAAC;oBAAS,CAAC;gBACV,IAAI,CAAC;oBACJ,SAAS,CAAC,QAAQ,EAAE,EAAE,CAAC;gBACxB,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBAChB,OAAO,CAAC,KAAK,CAAC,uBAAuB,EAAE,KAAK,CAAC,CAAC;gBAC/C,CAAC;YACF,CAAC;QACF,CAAC,CAAC,CAAC;IACJ,CAAC;IACD,SAAS,CAAC,IAAU,EAAE,KAAW,EAAE,QAAc;QAChD,MAAM,YAAY,GAAoB,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC;QAC7D,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,YAAY,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;QAC9D,OAAO,YAAY,CAAC;IACrB,CAAC;IAED,MAAM,CAAC,YAA6B;QACnC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IACvC,CAAC;CACD","sourcesContent":["export class Subscription<T> {\n\tprivate othersSubscription: Subscription<any>[];\n\tconstructor(private eventEmitter: EventEmitter<T>) { }\n\tadd(subscription: Subscription<any>) {\n\t\tif (!this.othersSubscription) {\n\t\t\tthis.othersSubscription = [];\n\t\t}\n\t\tthis.othersSubscription.push(subscription);\n\t}\n\tunsubscribe(): void {\n\t\tthis.eventEmitter.remove(this);\n\t\tif (this.othersSubscription) {\n\t\t\tthis.othersSubscription.forEach((subscription) => {\n\t\t\t\tsubscription.unsubscribe();\n\t\t\t});\n\t\t}\n\t}\n}\n\ninterface Subscribe {\n\tnext?: any;\n\terror?: any;\n\tcomplete?: any;\n}\n\nexport class EventEmitter<T> {\n\tprivate subscribers: Map<Subscription<T>, Subscribe> = new Map();\n\tconstructor() { }\n\temit(value?: T): void {\n\t\tthis.subscribers.forEach((subscribe) => {\n\t\t\ttry {\n\t\t\t\tsubscribe.next(value);\n\t\t\t} catch (error) {\n\t\t\t\ttry {\n\t\t\t\t\tsubscribe.error?.(error);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tconsole.error('error: handling event', error);\n\t\t\t\t}\n\t\t\t} finally {\n\t\t\t\ttry {\n\t\t\t\t\tsubscribe.complete?.();\n\t\t\t\t} catch (error) {\n\t\t\t\t\tconsole.error('error: handling event', error);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\tsubscribe(next?: any, error?: any, complete?: any): Subscription<T> {\n\t\tconst subscription: Subscription<T> = new Subscription(this);\n\t\tthis.subscribers.set(subscription, { next, error, complete });\n\t\treturn subscription;\n\t}\n\n\tremove(subscription: Subscription<T>) {\n\t\tthis.subscribers.delete(subscription);\n\t}\n}\n\n"]}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { ScopeSubscription, Signal, WritableSignal } from '@ibyar/expressions';
|
|
2
|
+
import { InjectionToken } from '../di/provider.js';
|
|
3
|
+
import { Type } from '../utils/typeof.js';
|
|
4
|
+
import { HTMLComponent } from './custom-element.js';
|
|
5
|
+
import { OutputEventInit } from '../annotation/options.js';
|
|
6
|
+
export interface InputOptions<T, TransformT> {
|
|
7
|
+
alias?: string;
|
|
8
|
+
transform?: (v: TransformT) => T;
|
|
9
|
+
}
|
|
10
|
+
export type InputOptionsWithoutTransform<T> = Omit<InputOptions<T, T>, 'transform'> & {
|
|
11
|
+
transform?: undefined;
|
|
12
|
+
};
|
|
13
|
+
export type InputOptionsWithTransform<T, TransformT> = Required<Pick<InputOptions<T, TransformT>, 'transform'>> & InputOptions<T, TransformT>;
|
|
14
|
+
export interface InputSignalWithTransform<T, TransformT> extends Signal<T> {
|
|
15
|
+
}
|
|
16
|
+
export interface InputSignal<T, TransformT = T> extends InputSignalWithTransform<T, TransformT> {
|
|
17
|
+
}
|
|
18
|
+
export declare function input<T>(): InputSignal<T>;
|
|
19
|
+
export declare function input<T>(initialValue: T, opts?: InputOptionsWithoutTransform<T>): InputSignal<T>;
|
|
20
|
+
export declare function input<T, TransformT = T>(initialValue: T, opts: InputOptionsWithTransform<T, TransformT>): InputSignalWithTransform<T, TransformT>;
|
|
21
|
+
export declare function input<T, TransformT = T>(initialValue?: T, opts?: InputOptions<T, TransformT>): InputSignal<T, TransformT>;
|
|
22
|
+
export declare namespace input {
|
|
23
|
+
var required: typeof requiredInput;
|
|
24
|
+
}
|
|
25
|
+
declare function requiredInput<T>(): InputSignal<T>;
|
|
26
|
+
declare function requiredInput<T>(opts?: InputOptionsWithoutTransform<T>): InputSignal<T>;
|
|
27
|
+
declare function requiredInput<T, TransformT = T>(opts: InputOptionsWithTransform<T, TransformT>): InputSignalWithTransform<T, TransformT>;
|
|
28
|
+
type OutputOption = OutputEventInit & {
|
|
29
|
+
alias?: string;
|
|
30
|
+
};
|
|
31
|
+
export interface OutputSignal<T> extends Signal<T> {
|
|
32
|
+
set: never;
|
|
33
|
+
update: never;
|
|
34
|
+
}
|
|
35
|
+
export declare class OutputSignal<T> extends Signal<T> {
|
|
36
|
+
options?: OutputOption;
|
|
37
|
+
emit(value: T): void;
|
|
38
|
+
}
|
|
39
|
+
export declare function isOutputSignal<T = any>(signal: any): signal is OutputSignal<T>;
|
|
40
|
+
export declare function output<T>(opts?: OutputOption): OutputSignal<T>;
|
|
41
|
+
interface ModelOptions {
|
|
42
|
+
alias?: string;
|
|
43
|
+
}
|
|
44
|
+
export interface ModelSignal<T> extends WritableSignal<T> {
|
|
45
|
+
subscribe(callback: (value: T) => void): ScopeSubscription<T>;
|
|
46
|
+
}
|
|
47
|
+
export declare function model<T>(): ModelSignal<T>;
|
|
48
|
+
export declare function model<T>(opts?: ModelOptions): ModelSignal<T>;
|
|
49
|
+
export declare namespace model {
|
|
50
|
+
var required: typeof requiredModel;
|
|
51
|
+
}
|
|
52
|
+
declare function requiredModel<T>(): ModelSignal<T>;
|
|
53
|
+
export declare const VIEW_TOKEN: InjectionToken<HTMLElement>;
|
|
54
|
+
export declare function view(): HTMLElement;
|
|
55
|
+
export declare function view<T extends keyof HTMLElementTagNameMap>(extend: T): HTMLElementTagNameMap[T];
|
|
56
|
+
export declare function view<T>(type: Type<T>): HTMLComponent<T>;
|
|
57
|
+
export declare function view<T, V extends keyof HTMLElementTagNameMap>(type: Type<T>, extend: V): HTMLComponent<T> & HTMLElementTagNameMap[V];
|
|
58
|
+
export declare class ViewChildSignal<T> extends Signal<T> {
|
|
59
|
+
selector: string | Type<T> | HTMLElement | keyof HTMLElementTagNameMap;
|
|
60
|
+
}
|
|
61
|
+
export declare function isViewChildSignal<T = any>(signal: any): signal is ViewChildSignal<T>;
|
|
62
|
+
export declare function viewChild<T extends HTMLElement>(selector: Type<T>): Signal<T>;
|
|
63
|
+
export declare function viewChild<T>(selector: Type<T>): Signal<HTMLComponent<T>>;
|
|
64
|
+
export declare function viewChild<T extends keyof HTMLElementTagNameMap>(selector: T): Signal<HTMLElementTagNameMap[T]>;
|
|
65
|
+
export declare function viewChild<T extends HTMLElement>(selector: string): Signal<T>;
|
|
66
|
+
export {};
|
|
67
|
+
//# sourceMappingURL=initializer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"initializer.d.ts","sourceRoot":"","sources":["../../../src/core/component/initializer.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,iBAAiB,EACjB,MAAM,EAAE,cAAc,EACtB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,aAAa,EAA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,EAAE,IAAI,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AAC/E,wBAAgB,SAAS,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;AAC1E,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,qBAAqB,EAAE,QAAQ,EAAE,CAAC,GAAG,MAAM,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAAC;AAChH,wBAAgB,SAAS,CAAC,CAAC,SAAS,WAAW,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { getReactiveNode, Signal } from '@ibyar/expressions';
|
|
2
|
+
import { signalScopeFactory } from '../signals/factory.js';
|
|
3
|
+
import { InjectionToken } from '../di/provider.js';
|
|
4
|
+
import { inject } from '../di/inject.js';
|
|
5
|
+
export function input(initialValue, opts) {
|
|
6
|
+
const signal = signalScopeFactory.signal(initialValue);
|
|
7
|
+
if (opts?.transform) {
|
|
8
|
+
const setOriginal = signal.set;
|
|
9
|
+
signal.set = (value) => setOriginal(opts.transform(value));
|
|
10
|
+
}
|
|
11
|
+
;
|
|
12
|
+
return signal;
|
|
13
|
+
}
|
|
14
|
+
function requiredInput(opts) {
|
|
15
|
+
return input(undefined, opts);
|
|
16
|
+
}
|
|
17
|
+
input.required = requiredInput;
|
|
18
|
+
export class OutputSignal extends Signal {
|
|
19
|
+
options;
|
|
20
|
+
emit(value) {
|
|
21
|
+
this.scope.set(this.index, value);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
export function isOutputSignal(signal) {
|
|
25
|
+
return signal instanceof OutputSignal;
|
|
26
|
+
}
|
|
27
|
+
export function output(opts) {
|
|
28
|
+
const signal = signalScopeFactory.signal(undefined, OutputSignal);
|
|
29
|
+
signal.options = opts;
|
|
30
|
+
return signal;
|
|
31
|
+
}
|
|
32
|
+
export function model(opts) {
|
|
33
|
+
const signal = signalScopeFactory.signalFn(undefined);
|
|
34
|
+
const node = getReactiveNode(signal);
|
|
35
|
+
if (node) {
|
|
36
|
+
signal.subscribe = node.subscribe.bind(signal);
|
|
37
|
+
}
|
|
38
|
+
return signal;
|
|
39
|
+
}
|
|
40
|
+
function requiredModel(opts) {
|
|
41
|
+
return model(opts);
|
|
42
|
+
}
|
|
43
|
+
model.required = requiredModel;
|
|
44
|
+
export const VIEW_TOKEN = new InjectionToken('VIEW');
|
|
45
|
+
export function view() {
|
|
46
|
+
return inject(VIEW_TOKEN);
|
|
47
|
+
}
|
|
48
|
+
export class ViewChildSignal extends Signal {
|
|
49
|
+
selector;
|
|
50
|
+
}
|
|
51
|
+
export function isViewChildSignal(signal) {
|
|
52
|
+
return signal instanceof ViewChildSignal;
|
|
53
|
+
}
|
|
54
|
+
export function viewChild(selector) {
|
|
55
|
+
const signal = signalScopeFactory.signal(undefined, ViewChildSignal);
|
|
56
|
+
signal.selector = selector;
|
|
57
|
+
return signal;
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=initializer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"initializer.js","sourceRoot":"","sources":["../../../src/core/component/initializer.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,eAAe,EAEf,MAAM,EACN,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AA2BzC,MAAM,UAAU,KAAK,CAAoB,YAAgB,EAAE,IAAkC;IAC5F,MAAM,MAAM,GAAG,kBAAkB,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IACvD,IAAI,IAAI,EAAE,SAAS,EAAE,CAAC;QACrB,MAAM,WAAW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AAC;AAED,KAAK,CAAC,QAAQ,GAAG,aAAa,CAAC;AAG/B,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,cAAc,CAAc,MAAM,CAAC,CAAC;AAOlE,MAAM,UAAU,IAAI;IACnB,OAAO,MAAM,CAAC,UAAU,CAAE,CAAC;AAC5B,CAAC;AAGD,MAAM,OAAO,eAAmB,SAAQ,MAAS;IACzC,QAAQ,CAA+D;CAC9E;AAED,MAAM,UAAU,iBAAiB,CAAU,MAAW;IACrD,OAAO,MAAM,YAAY,eAAe,CAAC;AAC1C,CAAC;AAMD,MAAM,UAAU,SAAS,CAAI,QAAsE;IAClG,MAAM,MAAM,GAAG,kBAAkB,CAAC,MAAM,CAAC,SAAS,EAAE,eAAe,CAAuB,CAAC;IAC3F,MAAM,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,OAAO,MAAM,CAAC;AACf,CAAC","sourcesContent":["import {\n\tgetReactiveNode,\n\tScopeSubscription,\n\tSignal, WritableSignal\n} from '@ibyar/expressions';\nimport { signalScopeFactory } from '../signals/factory.js';\nimport { InjectionToken } from '../di/provider.js';\nimport { inject } from '../di/inject.js';\nimport { Type } from '../utils/typeof.js';\nimport { HTMLComponent } from './custom-element.js';\nimport { OutputEventInit } from '../annotation/options.js';\n\n\nexport interface InputOptions<T, TransformT> {\n\talias?: string;\n\ttransform?: (v: TransformT) => T;\n}\n\nexport type InputOptionsWithoutTransform<T> = Omit<InputOptions<T, T>, 'transform'> & { transform?: undefined }\n\nexport type InputOptionsWithTransform<T, TransformT> = Required<Pick<InputOptions<T, TransformT>, 'transform'>> & InputOptions<T, TransformT>;\n\nexport interface InputSignalWithTransform<T, TransformT> extends Signal<T> {\n\n}\n\nexport interface InputSignal<T, TransformT = T> extends InputSignalWithTransform<T, TransformT> {\n\n}\n\nexport function input<T>(): InputSignal<T>;\nexport function input<T>(initialValue: T, opts?: InputOptionsWithoutTransform<T>): InputSignal<T>;\nexport function input<T, TransformT = T>(initialValue: T, opts: InputOptionsWithTransform<T, TransformT>): InputSignalWithTransform<T, TransformT>;\nexport function input<T, TransformT = T>(initialValue?: T, opts?: InputOptions<T, TransformT>): InputSignal<T, TransformT>;\nexport function input<T, TransformT = T>(initialValue?: T, opts?: InputOptions<T, TransformT>): InputSignal<T, TransformT> {\n\tconst signal = signalScopeFactory.signal(initialValue);\n\tif (opts?.transform) {\n\t\tconst setOriginal = signal.set;\n\t\tsignal.set = (value: T): void => setOriginal(opts!.transform!(value as any as TransformT));\n\t};\n\treturn signal as InputSignal<T, TransformT>;\n}\n\nfunction requiredInput<T>(): InputSignal<T>;\nfunction requiredInput<T>(opts?: InputOptionsWithoutTransform<T>): InputSignal<T>;\nfunction requiredInput<T, TransformT = T>(opts: InputOptionsWithTransform<T, TransformT>): InputSignalWithTransform<T, TransformT>;\nfunction requiredInput<T, TransformT = T>(opts?: InputOptions<T, TransformT>): InputSignal<T, TransformT> {\n\treturn input(undefined as T, opts);\n}\n\ninput.required = requiredInput;\n\n\ntype OutputOption = OutputEventInit & { alias?: string };\n\n\n\nexport interface OutputSignal<T> extends Signal<T> {\n\tset: never;\n\tupdate: never;\n}\n\nexport class OutputSignal<T> extends Signal<T> {\n\tpublic options?: OutputOption;\n\n\temit(value: T) {\n\t\tthis.scope.set(this.index, value);\n\t}\n}\n\n\nexport function isOutputSignal<T = any>(signal: any): signal is OutputSignal<T> {\n\treturn signal instanceof OutputSignal;\n}\n\nexport function output<T>(opts?: OutputOption): OutputSignal<T> {\n\tconst signal = signalScopeFactory.signal(undefined, OutputSignal) as OutputSignal<T>;\n\tsignal.options = opts;\n\treturn signal;\n}\n\ninterface ModelOptions {\n\talias?: string;\n}\n\nexport interface ModelSignal<T> extends WritableSignal<T> {\n\tsubscribe(callback: (value: T) => void): ScopeSubscription<T>;\n}\n\nexport function model<T>(): ModelSignal<T>;\nexport function model<T>(opts?: ModelOptions): ModelSignal<T>;\nexport function model<T>(opts?: ModelOptions): ModelSignal<T> {\n\tconst signal = signalScopeFactory.signalFn(undefined) as ModelSignal<T>;\n\tconst node = getReactiveNode(signal);\n\tif (node) {\n\t\tsignal.subscribe = node.subscribe.bind(signal);\n\t}\n\treturn signal;\n}\n\nfunction requiredModel<T>(): ModelSignal<T>;\nfunction requiredModel<T>(opts?: ModelOptions): ModelSignal<T> {\n\treturn model(opts);\n}\n\nmodel.required = requiredModel;\n\n\nexport const VIEW_TOKEN = new InjectionToken<HTMLElement>('VIEW');\n\n\nexport function view(): HTMLElement;\nexport function view<T extends keyof HTMLElementTagNameMap>(extend: T): HTMLElementTagNameMap[T];\nexport function view<T>(type: Type<T>): HTMLComponent<T>;\nexport function view<T, V extends keyof HTMLElementTagNameMap>(type: Type<T>, extend: V): HTMLComponent<T> & HTMLElementTagNameMap[V];\nexport function view(): any {\n\treturn inject(VIEW_TOKEN)!;\n}\n\n\nexport class ViewChildSignal<T> extends Signal<T> {\n\tpublic selector: string | Type<T> | HTMLElement | keyof HTMLElementTagNameMap;\n}\n\nexport function isViewChildSignal<T = any>(signal: any): signal is ViewChildSignal<T> {\n\treturn signal instanceof ViewChildSignal;\n}\n\nexport function viewChild<T extends HTMLElement>(selector: Type<T>): Signal<T>;\nexport function viewChild<T>(selector: Type<T>): Signal<HTMLComponent<T>>;\nexport function viewChild<T extends keyof HTMLElementTagNameMap>(selector: T): Signal<HTMLElementTagNameMap[T]>;\nexport function viewChild<T extends HTMLElement>(selector: string): Signal<T>;\nexport function viewChild<T>(selector: string | Type<T> | HTMLElement | keyof HTMLElementTagNameMap): Signal<T> {\n\tconst signal = signalScopeFactory.signal(undefined, ViewChildSignal) as ViewChildSignal<T>;\n\tsignal.selector = selector;\n\treturn signal;\n}\n"]}
|
package/di/inject.d.ts
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { InjectionToken } from './provider.js';
|
|
3
|
-
export declare function
|
|
1
|
+
import { AbstractType, Type } from '../utils/typeof.js';
|
|
2
|
+
import { InjectionProvider, InjectionToken } from './provider.js';
|
|
3
|
+
export declare function forkProvider(): InjectionProvider;
|
|
4
|
+
export declare function addProvider(modelProvider: InjectionProvider): void;
|
|
5
|
+
export declare function removeProvider(modelProvider: InjectionProvider): void;
|
|
6
|
+
export declare function provide<T>(type: Type<T>): void;
|
|
7
|
+
export declare function provide<T>(type: AbstractType<T>): void;
|
|
8
|
+
export declare function provide<T>(type: Type<T>, value: T): void;
|
|
9
|
+
export declare function provide<T>(type: AbstractType<T>, value: T): void;
|
|
4
10
|
export declare function provide<T>(token: InjectionToken<T>, value: T): void;
|
|
5
|
-
export declare function inject<T>(type:
|
|
11
|
+
export declare function inject<T>(type: Type<T>): T;
|
|
12
|
+
export declare function inject<T>(type: AbstractType<T>): T;
|
|
6
13
|
export declare function inject<T>(token: InjectionToken<T>): T | undefined;
|
|
7
14
|
//# sourceMappingURL=inject.d.ts.map
|
package/di/inject.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inject.d.ts","sourceRoot":"","sources":["../../../src/core/di/inject.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"inject.d.ts","sourceRoot":"","sources":["../../../src/core/di/inject.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAY,MAAM,eAAe,CAAC;AAO5E,wBAAgB,YAAY,IAAI,iBAAiB,CAEhD;AAED,wBAAgB,WAAW,CAAC,aAAa,EAAE,iBAAiB,QAE3D;AAED,wBAAgB,cAAc,CAAC,aAAa,EAAE,iBAAiB,QAK9D;AAMD,wBAAgB,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;AAChD,wBAAgB,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;AACxD,wBAAgB,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC;AAC1D,wBAAgB,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC;AAClE,wBAAgB,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,cAAc,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC;AAKrE,wBAAgB,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AAC5C,wBAAgB,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AACpD,wBAAgB,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,cAAc,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC"}
|
package/di/inject.js
CHANGED
|
@@ -1,9 +1,25 @@
|
|
|
1
1
|
import { InjectionProvider } from './provider.js';
|
|
2
2
|
const ROOT_PROVIDER = new InjectionProvider();
|
|
3
|
+
const PROVIDERS = [ROOT_PROVIDER];
|
|
4
|
+
export function forkProvider() {
|
|
5
|
+
return ROOT_PROVIDER.fork();
|
|
6
|
+
}
|
|
7
|
+
export function addProvider(modelProvider) {
|
|
8
|
+
PROVIDERS.push(modelProvider);
|
|
9
|
+
}
|
|
10
|
+
export function removeProvider(modelProvider) {
|
|
11
|
+
const index = PROVIDERS.findIndex(provider => provider === modelProvider);
|
|
12
|
+
if (index >= 0) {
|
|
13
|
+
PROVIDERS.splice(index, 1);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function getProvider() {
|
|
17
|
+
return PROVIDERS.at(-1) ?? ROOT_PROVIDER;
|
|
18
|
+
}
|
|
3
19
|
export function provide(provider, value) {
|
|
4
|
-
|
|
20
|
+
getProvider().provide(provider, value);
|
|
5
21
|
}
|
|
6
22
|
export function inject(provider) {
|
|
7
|
-
return
|
|
23
|
+
return getProvider().inject(provider);
|
|
8
24
|
}
|
|
9
25
|
//# sourceMappingURL=inject.js.map
|
package/di/inject.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inject.js","sourceRoot":"","sources":["../../../src/core/di/inject.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAA4B,MAAM,eAAe,CAAC;AAG5E,MAAM,aAAa,GAAG,IAAI,iBAAiB,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"inject.js","sourceRoot":"","sources":["../../../src/core/di/inject.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAA4B,MAAM,eAAe,CAAC;AAG5E,MAAM,aAAa,GAAG,IAAI,iBAAiB,EAAE,CAAC;AAE9C,MAAM,SAAS,GAAwB,CAAC,aAAa,CAAC,CAAC;AAEvD,MAAM,UAAU,YAAY;IAC3B,OAAO,aAAa,CAAC,IAAI,EAAE,CAAC;AAC7B,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,aAAgC;IAC3D,SAAS,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;AAC/B,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,aAAgC;IAC9D,MAAM,KAAK,GAAG,SAAS,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,KAAK,aAAa,CAAC,CAAC;IAC1E,IAAI,KAAK,IAAI,CAAC,EAAE,CAAC;QAChB,SAAS,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IAC5B,CAAC;AACF,CAAC;AAED,SAAS,WAAW;IACnB,OAAO,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,aAAa,CAAC;AAC1C,CAAC;AAOD,MAAM,UAAU,OAAO,CAAI,QAAqB,EAAE,KAAS;IAC1D,WAAW,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;AACxC,CAAC;AAKD,MAAM,UAAU,MAAM,CAAI,QAAqB;IAC9C,OAAO,WAAW,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;AACvC,CAAC","sourcesContent":["import { AbstractType, Type } from '../utils/typeof.js';\nimport { InjectionProvider, InjectionToken, Provider } from './provider.js';\n\n\nconst ROOT_PROVIDER = new InjectionProvider();\n\nconst PROVIDERS: InjectionProvider[] = [ROOT_PROVIDER];\n\nexport function forkProvider(): InjectionProvider {\n\treturn ROOT_PROVIDER.fork();\n}\n\nexport function addProvider(modelProvider: InjectionProvider) {\n\tPROVIDERS.push(modelProvider);\n}\n\nexport function removeProvider(modelProvider: InjectionProvider) {\n\tconst index = PROVIDERS.findIndex(provider => provider === modelProvider);\n\tif (index >= 0) {\n\t\tPROVIDERS.splice(index, 1);\n\t}\n}\n\nfunction getProvider(): InjectionProvider {\n\treturn PROVIDERS.at(-1) ?? ROOT_PROVIDER;\n}\n\nexport function provide<T>(type: Type<T>): void;\nexport function provide<T>(type: AbstractType<T>): void;\nexport function provide<T>(type: Type<T>, value: T): void;\nexport function provide<T>(type: AbstractType<T>, value: T): void;\nexport function provide<T>(token: InjectionToken<T>, value: T): void;\nexport function provide<T>(provider: Provider<T>, value?: T) {\n\tgetProvider().provide(provider, value);\n}\n\nexport function inject<T>(type: Type<T>): T;\nexport function inject<T>(type: AbstractType<T>): T;\nexport function inject<T>(token: InjectionToken<T>): T | undefined;\nexport function inject<T>(provider: Provider<T>): T | undefined {\n\treturn getProvider().inject(provider);\n}\n"]}
|
package/di/provider.d.ts
CHANGED
|
@@ -1,21 +1,23 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AbstractType, Type } from '../utils/typeof.js';
|
|
2
2
|
export declare class InjectionToken<T> {
|
|
3
3
|
token: string;
|
|
4
4
|
constructor(token: string);
|
|
5
5
|
}
|
|
6
|
-
export type Provider<T> =
|
|
6
|
+
export type Provider<T> = Type<T> | AbstractType<T> | InjectionToken<T>;
|
|
7
7
|
export declare class InjectionProvider {
|
|
8
8
|
private parent?;
|
|
9
9
|
private readonly types;
|
|
10
10
|
private readonly tokens;
|
|
11
11
|
constructor(parent?: InjectionProvider | undefined);
|
|
12
|
+
fork(): InjectionProvider;
|
|
12
13
|
hasToken<T>(token: InjectionToken<T>): InjectionProvider | false;
|
|
13
|
-
hasType<T>(type:
|
|
14
|
+
hasType<T>(type: Type<any> | AbstractType<any>): InjectionProvider | false;
|
|
14
15
|
getToken<T>(token: InjectionToken<T>): T | undefined;
|
|
15
|
-
getInstance<T>(type:
|
|
16
|
-
setType<T>(type:
|
|
16
|
+
getInstance<T>(type: Type<any> | AbstractType<any>): T;
|
|
17
|
+
setType<T>(type: Type<any> | AbstractType<any>, value?: T): void;
|
|
17
18
|
setToken<T>(token: InjectionToken<T>, value: T): void;
|
|
18
19
|
provide<T>(typeOrToken: Provider<T>, value?: T): void;
|
|
19
20
|
inject<T>(typeOrToken: Provider<T>): T | undefined;
|
|
21
|
+
clear<T>(typeOrToken: Provider<T>): void;
|
|
20
22
|
}
|
|
21
23
|
//# sourceMappingURL=provider.d.ts.map
|
package/di/provider.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../src/core/di/provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../src/core/di/provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAG7D,qBAAa,cAAc,CAAC,CAAC;IACT,KAAK,EAAE,MAAM;gBAAb,KAAK,EAAE,MAAM;CAChC;AAED,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,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
|
|
|
4
4
|
this.token = token;
|
|
5
5
|
}
|
|
6
6
|
}
|
|
7
|
-
const
|
|
7
|
+
const REQUIRE_INIT = Symbol('REQUIRE_INIT');
|
|
8
8
|
export class InjectionProvider {
|
|
9
9
|
parent;
|
|
10
|
-
types = new
|
|
11
|
-
tokens = new
|
|
10
|
+
types = new Map();
|
|
11
|
+
tokens = new Map();
|
|
12
12
|
constructor(parent) {
|
|
13
13
|
this.parent = parent;
|
|
14
14
|
}
|
|
15
|
+
fork() {
|
|
16
|
+
return new InjectionProvider(this);
|
|
17
|
+
}
|
|
15
18
|
hasToken(token) {
|
|
16
19
|
return this.tokens.has(token) ? this : false;
|
|
17
20
|
}
|
|
@@ -19,39 +22,52 @@ export class InjectionProvider {
|
|
|
19
22
|
return this.types.has(type) ? this : false;
|
|
20
23
|
}
|
|
21
24
|
getToken(token) {
|
|
22
|
-
|
|
25
|
+
let value = this.tokens.get(token);
|
|
26
|
+
if (value === undefined && this.parent) {
|
|
27
|
+
value = this.parent.getToken(token);
|
|
28
|
+
}
|
|
29
|
+
return value;
|
|
23
30
|
}
|
|
24
31
|
getInstance(type) {
|
|
25
32
|
let instance = this.types.get(type);
|
|
26
|
-
if (instance ===
|
|
33
|
+
if (instance === REQUIRE_INIT) {
|
|
27
34
|
instance = new type();
|
|
28
35
|
this.types.set(type, instance);
|
|
29
36
|
}
|
|
37
|
+
else if (instance === undefined && this.parent) {
|
|
38
|
+
instance = this.parent.getInstance(type);
|
|
39
|
+
}
|
|
30
40
|
return instance;
|
|
31
41
|
}
|
|
32
42
|
setType(type, value) {
|
|
33
|
-
this.types.set(type, value ??
|
|
43
|
+
this.types.set(type, value ?? REQUIRE_INIT);
|
|
34
44
|
}
|
|
35
45
|
setToken(token, value) {
|
|
36
46
|
this.tokens.set(token, value);
|
|
37
47
|
}
|
|
38
48
|
provide(typeOrToken, value) {
|
|
39
49
|
if (typeOrToken instanceof InjectionToken) {
|
|
40
|
-
|
|
41
|
-
provider.setToken(typeOrToken, value);
|
|
50
|
+
this.setToken(typeOrToken, value);
|
|
42
51
|
}
|
|
43
52
|
else {
|
|
44
|
-
|
|
45
|
-
provider.setType(typeOrToken, value ?? EMPTY_VALUE);
|
|
53
|
+
this.setType(typeOrToken, value ?? REQUIRE_INIT);
|
|
46
54
|
}
|
|
47
55
|
}
|
|
48
56
|
inject(typeOrToken) {
|
|
57
|
+
if (typeOrToken instanceof InjectionToken) {
|
|
58
|
+
return this.getToken(typeOrToken);
|
|
59
|
+
}
|
|
60
|
+
return this.getInstance(typeOrToken);
|
|
61
|
+
}
|
|
62
|
+
clear(typeOrToken) {
|
|
49
63
|
if (typeOrToken instanceof InjectionToken) {
|
|
50
64
|
const provider = this.parent?.hasToken(typeOrToken) || this;
|
|
51
|
-
|
|
65
|
+
provider.tokens.delete(typeOrToken);
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
const provider = this.parent?.hasType(typeOrToken) || this;
|
|
69
|
+
provider.types.delete(typeOrToken);
|
|
52
70
|
}
|
|
53
|
-
const provider = this.parent?.hasType(typeOrToken) || this;
|
|
54
|
-
return provider.getInstance(typeOrToken);
|
|
55
71
|
}
|
|
56
72
|
}
|
|
57
73
|
//# sourceMappingURL=provider.js.map
|
package/di/provider.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../../../src/core/di/provider.ts"],"names":[],"mappings":"AAGA,MAAM,OAAO,cAAc;IACP;IAAnB,YAAmB,KAAa;QAAb,UAAK,GAAL,KAAK,CAAQ;IAAI,CAAC;CACrC;AAID,MAAM,
|
|
1
|
+
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../../../src/core/di/provider.ts"],"names":[],"mappings":"AAGA,MAAM,OAAO,cAAc;IACP;IAAnB,YAAmB,KAAa;QAAb,UAAK,GAAL,KAAK,CAAQ;IAAI,CAAC;CACrC;AAID,MAAM,YAAY,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;AAE5C,M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cesContent":["import type { AbstractType, Type } from '../utils/typeof.js';\n\n\nexport class InjectionToken<T> {\n\tconstructor(public token: string) { }\n}\n\nexport type Provider<T> = Type<T> | AbstractType<T> | InjectionToken<T>;\n\nconst REQUIRE_INIT = Symbol('REQUIRE_INIT');\n\nexport class InjectionProvider {\n\n\tprivate readonly types = new Map<Type<any> | AbstractType<any>, any>();\n\tprivate readonly tokens = new Map<InjectionToken<any>, any>();\n\n\tconstructor(private parent?: InjectionProvider) { }\n\n\tfork(): InjectionProvider {\n\t\treturn new InjectionProvider(this);\n\t}\n\n\thasToken<T>(token: InjectionToken<T>): InjectionProvider | false {\n\t\treturn this.tokens.has(token) ? this : false;\n\t}\n\n\thasType<T>(type: Type<any> | AbstractType<any>): InjectionProvider | false {\n\t\treturn this.types.has(type) ? this : false;\n\t}\n\n\tgetToken<T>(token: InjectionToken<T>): T | undefined {\n\t\tlet value = this.tokens.get(token);\n\t\tif (value === undefined && this.parent) {\n\t\t\tvalue = this.parent.getToken(token);\n\t\t}\n\t\treturn value;\n\t}\n\n\tgetInstance<T>(type: Type<any> | AbstractType<any>): T {\n\t\tlet instance = this.types.get(type);\n\t\tif (instance === REQUIRE_INIT) {\n\t\t\tinstance = new (type as Type<any>)();\n\t\t\tthis.types.set(type, instance);\n\t\t} else if (instance === undefined && this.parent) {\n\t\t\tinstance = this.parent.getInstance(type);\n\t\t}\n\t\treturn instance;\n\t}\n\n\tsetType<T>(type: Type<any> | AbstractType<any>, value?: T): void {\n\t\tthis.types.set(type, value ?? REQUIRE_INIT);\n\t}\n\n\tsetToken<T>(token: InjectionToken<T>, value: T): void {\n\t\tthis.tokens.set(token, value);\n\t}\n\n\tprovide<T>(typeOrToken: Provider<T>, value?: T) {\n\t\tif (typeOrToken instanceof InjectionToken) {\n\t\t\tthis.setToken(typeOrToken, value);\n\t\t} else {\n\t\t\tthis.setType(typeOrToken, value ?? REQUIRE_INIT as unknown as T);\n\t\t}\n\t}\n\n\tinject<T>(typeOrToken: Provider<T>): T | undefined {\n\t\tif (typeOrToken instanceof InjectionToken) {\n\t\t\treturn this.getToken(typeOrToken);\n\t\t}\n\t\treturn this.getInstance(typeOrToken);\n\t}\n\n\tclear<T>(typeOrToken: Provider<T>): void {\n\t\tif (typeOrToken instanceof InjectionToken) {\n\t\t\tconst provider = this.parent?.hasToken(typeOrToken) || this;\n\t\t\tprovider.tokens.delete(typeOrToken);\n\t\t} else {\n\t\t\tconst provider = this.parent?.hasType(typeOrToken) || this;\n\t\t\tprovider.types.delete(typeOrToken);\n\t\t}\n\t}\n\n}\n"]}
|
package/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export * from './annotation/options.js';
|
|
|
2
2
|
export * from './annotation/decorators.js';
|
|
3
3
|
export * from './signals/signals.js';
|
|
4
4
|
export * from './component/component.js';
|
|
5
|
+
export * from './component/initializer.js';
|
|
5
6
|
export * from './component/reflect.js';
|
|
6
7
|
export * from './component/custom-element.js';
|
|
7
8
|
export * from './component/events.js';
|
package/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AACA,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AACA,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAE3C,cAAc,sBAAsB,CAAC;AAErC,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AAEzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAE/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,iCAAiC,CAAC;AAEhD,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AAErC,cAAc,gBAAgB,CAAC;AAE/B,cAAc,yBAAyB,CAAC;AAExC,cAAc,0BAA0B,CAAC;AACzC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AAEjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAG/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC"}
|
package/index.js
CHANGED
|
@@ -2,6 +2,7 @@ export * from './annotation/options.js';
|
|
|
2
2
|
export * from './annotation/decorators.js';
|
|
3
3
|
export * from './signals/signals.js';
|
|
4
4
|
export * from './component/component.js';
|
|
5
|
+
export * from './component/initializer.js';
|
|
5
6
|
export * from './component/reflect.js';
|
|
6
7
|
export * from './component/custom-element.js';
|
|
7
8
|
export * from './component/events.js';
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AACA,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AACA,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAE3C,cAAc,sBAAsB,CAAC;AAErC,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AAEzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAE/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,iCAAiC,CAAC;AAEhD,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AAErC,cAAc,gBAAgB,CAAC;AAE/B,cAAc,yBAAyB,CAAC;AAExC,cAAc,0BAA0B,CAAC;AACzC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AAEjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAG/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC","sourcesContent":["\nexport * from './annotation/options.js';\nexport * from './annotation/decorators.js';\n\nexport * from './signals/signals.js';\n\nexport * from './component/component.js';\nexport * from './component/initializer.js';\nexport * from './component/reflect.js';\nexport * from './component/custom-element.js';\nexport * from './component/events.js';\nexport * from './component/lifecycle.js';\n\nexport * from './di/provider.js';\nexport * from './di/inject.js';\nexport * from './di/tokens.js';\n\nexport * from './linker/view-ref.js';\nexport * from './linker/template-ref.js';\nexport * from './linker/view-container-ref.js';\nexport * from './linker/change-detector-ref.js';\n\nexport * from './directive/directive.js';\nexport * from './html/expression.js';\n\nexport * from './pipe/pipe.js';\n\nexport * from './providers/provider.js';\n\nexport * from './utils/elements-util.js';\nexport * from './utils/path.js';\nexport * from './utils/typeof.js';\nexport * from './utils/utils.js';\n\nexport * from './view/mutation.js';\nexport * from './view/render.js';\nexport * from './view/utils.js';\nexport * from './view/view.js';\n\n\nexport * from './zone/bootstrap.js';\nexport * from './zone/zone.js';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=input.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../../src/core/initializer/input.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input.js","sourceRoot":"","sources":["../../../src/core/initializer/input.ts"],"names":[],"mappings":"","sourcesContent":[""]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"change-detector-ref.d.ts","sourceRoot":"","sources":["../../../src/core/linker/change-detector-ref.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAEnE,8BAAsB,iBAAiB;IAEtC;;;OAGG;IACH,QAAQ,CAAC,MAAM,IAAI,IAAI;IAEvB;;OAEG;IACH,QAAQ,CAAC,QAAQ,IAAI,IAAI;IAEzB;;;OAGG;IACH,QAAQ,CAAC,YAAY,IAAI,IAAI;IAE7B;;OAEG;IACH,QAAQ,CAAC,aAAa,IAAI,IAAI;IAG9B;;OAEG;IACH,QAAQ,CAAC,cAAc,IAAI,IAAI;CAC/B;
|
|
1
|
+
{"version":3,"file":"change-detector-ref.d.ts","sourceRoot":"","sources":["../../../src/core/linker/change-detector-ref.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAEnE,8BAAsB,iBAAiB;IAEtC;;;OAGG;IACH,QAAQ,CAAC,MAAM,IAAI,IAAI;IAEvB;;OAEG;IACH,QAAQ,CAAC,QAAQ,IAAI,IAAI;IAEzB;;;OAGG;IACH,QAAQ,CAAC,YAAY,IAAI,IAAI;IAE7B;;OAEG;IACH,QAAQ,CAAC,aAAa,IAAI,IAAI;IAG9B;;OAEG;IACH,QAAQ,CAAC,cAAc,IAAI,IAAI;CAC/B;AAyBD;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,oBAAoB,CAAC,GAAG,CAAC,EAAE,WAAW,EAAE,MAAM,OAAO,GAAG,iBAAiB,CAkBvH;AAED,wBAAgB,4BAA4B,CAAC,QAAQ,EAAE,MAAM,oBAAoB,CAAC,GAAG,CAAC,GAAG,iBAAiB,CAkBzG"}
|
|
@@ -1,10 +1,32 @@
|
|
|
1
1
|
export class ChangeDetectorRef {
|
|
2
2
|
}
|
|
3
|
+
class ChangeDetectorRefImpl extends ChangeDetectorRef {
|
|
4
|
+
ref;
|
|
5
|
+
constructor(ref) {
|
|
6
|
+
super();
|
|
7
|
+
this.ref = ref;
|
|
8
|
+
}
|
|
9
|
+
detach() {
|
|
10
|
+
this.ref.detach();
|
|
11
|
+
}
|
|
12
|
+
reattach() {
|
|
13
|
+
this.ref.reattach();
|
|
14
|
+
}
|
|
15
|
+
markForCheck() {
|
|
16
|
+
this.ref.markForCheck();
|
|
17
|
+
}
|
|
18
|
+
detectChanges() {
|
|
19
|
+
this.ref.detectChanges();
|
|
20
|
+
}
|
|
21
|
+
checkNoChanges() {
|
|
22
|
+
this.ref.checkNoChanges();
|
|
23
|
+
}
|
|
24
|
+
}
|
|
3
25
|
/**
|
|
4
26
|
* create a change Detector Reference by property key.
|
|
5
27
|
*/
|
|
6
28
|
export function createChangeDetectorRef(scope, propertyKey) {
|
|
7
|
-
return {
|
|
29
|
+
return new ChangeDetectorRefImpl({
|
|
8
30
|
detach() {
|
|
9
31
|
scope.detach();
|
|
10
32
|
},
|
|
@@ -20,10 +42,10 @@ export function createChangeDetectorRef(scope, propertyKey) {
|
|
|
20
42
|
checkNoChanges() {
|
|
21
43
|
scope.checkNoChanges();
|
|
22
44
|
},
|
|
23
|
-
};
|
|
45
|
+
});
|
|
24
46
|
}
|
|
25
47
|
export function createModelChangeDetectorRef(resolver) {
|
|
26
|
-
return {
|
|
48
|
+
return new ChangeDetectorRefImpl({
|
|
27
49
|
detach() {
|
|
28
50
|
resolver().detach();
|
|
29
51
|
},
|
|
@@ -39,6 +61,6 @@ export function createModelChangeDetectorRef(resolver) {
|
|
|
39
61
|
checkNoChanges() {
|
|
40
62
|
resolver().checkNoChanges();
|
|
41
63
|
},
|
|
42
|
-
};
|
|
64
|
+
});
|
|
43
65
|
}
|
|
44
66
|
//# sourceMappingURL=change-detector-ref.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"change-detector-ref.js","sourceRoot":"","sources":["../../../src/core/linker/change-detector-ref.ts"],"names":[],"mappings":"AAEA,MAAM,OAAgB,iBAAiB;CA6BtC;AAED;;GAEG;AACH,MAAM,UAAU,uBAAuB,CAAC,KAAgC,EAAE,WAA0B;IACnG,OAAO;
|
|
1
|
+
{"version":3,"file":"change-detector-ref.js","sourceRoot":"","sources":["../../../src/core/linker/change-detector-ref.ts"],"names":[],"mappings":"AAEA,MAAM,OAAgB,iBAAiB;CA6BtC;AAED,MAAM,qBAAsB,SAAQ,iBAAiB;IAEhC;IAApB,YAAoB,GAAsB;QACzC,KAAK,EAAE,CAAC;QADW,QAAG,GAAH,GAAG,CAAmB;IAE1C,CAAC;IAED,MAAM;QACL,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC;IACnB,CAAC;IACD,QAAQ;QACP,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;IACrB,CAAC;IACD,YAAY;QACX,IAAI,CAAC,GAAG,CAAC,YAAY,EAAE,CAAC;IACzB,CAAC;IACD,aAAa;QACZ,IAAI,CAAC,GAAG,CAAC,aAAa,EAAE,CAAC;IAC1B,CAAC;IACD,cAAc;QACb,IAAI,CAAC,GAAG,CAAC,cAAc,EAAE,CAAC;IAC3B,CAAC;CACD;AAED;;GAEG;AACH,MAAM,UAAU,uBAAuB,CAAC,KAAgC,EAAE,WAA0B;IACnG,OAAO,IAAI,qBAAqB,CAAC;QAChC,MAAM;YACL,KAAK,CAAC,MAAM,EAAE,CAAC;QAChB,CAAC;QACD,QAAQ;YACP,KAAK,CAAC,QAAQ,EAAE,CAAC;QAClB,CAAC;QACD,YAAY;YACX,KAAK,CAAC,WAAW,CAAC,WAAW,EAAE,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC;QACxD,CAAC;QACD,aAAa;YACZ,KAAK,CAAC,aAAa,EAAE,CAAC;QACvB,CAAC;QACD,cAAc;YACb,KAAK,CAAC,cAAc,EAAE,CAAC;QACxB,CAAC;KACD,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,4BAA4B,CAAC,QAAyC;IACrF,OAAO,IAAI,qBAAqB,CAAC;QAChC,MAAM;YACL,QAAQ,EAAE,CAAC,MAAM,EAAE,CAAC;QACrB,CAAC;QACD,QAAQ;YACP,QAAQ,EAAE,CAAC,QAAQ,EAAE,CAAC;QACvB,CAAC;QACD,YAAY;YACX,QAAQ,EAAE,CAAC,aAAa,EAAE,CAAA;QAC3B,CAAC;QACD,aAAa;YACZ,QAAQ,EAAE,CAAC,aAAa,EAAE,CAAC;QAC5B,CAAC;QACD,cAAc;YACb,QAAQ,EAAE,CAAC,cAAc,EAAE,CAAC;QAC7B,CAAC;KACD,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { ReactiveScopeControl, Context } from '@ibyar/expressions';\n\nexport abstract class ChangeDetectorRef {\n\n\t/**\n\t * used when want to update ui-view like, you want to replace an array with another \n\t * without reflect changes on view until reattached again.\n\t */\n\tabstract detach(): void;\n\n\t/**\n\t * apply all the not emitted changes, and continue emit changes now.\n\t */\n\tabstract reattach(): void;\n\n\t/**\n\t * apply changes now,\n\t * will not effect the state of the detector wither if attached ot not.\n\t */\n\tabstract markForCheck(): void;\n\n\t/**\n\t * apply change detection\n\t */\n\tabstract detectChanges(): void;\n\n\n\t/**\n\t * throw error if any changes has been made\n\t */\n\tabstract checkNoChanges(): void;\n}\n\nclass ChangeDetectorRefImpl extends ChangeDetectorRef {\n\n\tconstructor(private ref: ChangeDetectorRef) {\n\t\tsuper();\n\t}\n\n\tdetach(): void {\n\t\tthis.ref.detach();\n\t}\n\treattach(): void {\n\t\tthis.ref.reattach();\n\t}\n\tmarkForCheck(): void {\n\t\tthis.ref.markForCheck();\n\t}\n\tdetectChanges(): void {\n\t\tthis.ref.detectChanges();\n\t}\n\tcheckNoChanges(): void {\n\t\tthis.ref.checkNoChanges();\n\t}\n}\n\n/**\n * create a change Detector Reference by property key.\n */\nexport function createChangeDetectorRef(scope: ReactiveScopeControl<any>, propertyKey: keyof Context): ChangeDetectorRef {\n\treturn new ChangeDetectorRefImpl({\n\t\tdetach() {\n\t\t\tscope.detach();\n\t\t},\n\t\treattach() {\n\t\t\tscope.reattach();\n\t\t},\n\t\tmarkForCheck() {\n\t\t\tscope.emitChanges(propertyKey, scope.get(propertyKey));\n\t\t},\n\t\tdetectChanges() {\n\t\t\tscope.detectChanges();\n\t\t},\n\t\tcheckNoChanges() {\n\t\t\tscope.checkNoChanges();\n\t\t},\n\t});\n}\n\nexport function createModelChangeDetectorRef(resolver: () => ReactiveScopeControl<any>): ChangeDetectorRef {\n\treturn new ChangeDetectorRefImpl({\n\t\tdetach() {\n\t\t\tresolver().detach();\n\t\t},\n\t\treattach() {\n\t\t\tresolver().reattach();\n\t\t},\n\t\tmarkForCheck() {\n\t\t\tresolver().detectChanges()\n\t\t},\n\t\tdetectChanges() {\n\t\t\tresolver().detectChanges();\n\t\t},\n\t\tcheckNoChanges() {\n\t\t\tresolver().checkNoChanges();\n\t\t},\n\t});\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { MetadataClass } from '@ibyar/decorators';
|
|
2
|
-
import type {
|
|
2
|
+
import type { Type } from '../utils/typeof.js';
|
|
3
3
|
import { TemplateRef } from './template-ref.js';
|
|
4
4
|
import { EmbeddedViewRef, ViewRef } from './view-ref.js';
|
|
5
5
|
import { HTMLComponent } from '../component/custom-element.js';
|
|
@@ -73,7 +73,7 @@ export declare abstract class ViewContainerRef {
|
|
|
73
73
|
* @param viewClass the generated aurora view class
|
|
74
74
|
* @param options
|
|
75
75
|
*/
|
|
76
|
-
abstract createComponent<C extends {}>(viewClass:
|
|
76
|
+
abstract createComponent<C extends {}>(viewClass: Type<HTMLComponent<C>>, options?: IndexOptions): C;
|
|
77
77
|
/**
|
|
78
78
|
* Instantiates a single component and inserts its host view into this container.
|
|
79
79
|
*
|
|
@@ -86,7 +86,7 @@ export declare abstract class ViewContainerRef {
|
|
|
86
86
|
*
|
|
87
87
|
* @returns The new `HTMLComponent` which contains the component instance and the host view.
|
|
88
88
|
*/
|
|
89
|
-
abstract createComponent<C extends {}>(componentType:
|
|
89
|
+
abstract createComponent<C extends {}>(componentType: Type<C>, options?: ViewContainerComponentOptions): C;
|
|
90
90
|
/**
|
|
91
91
|
* create an HTMLElement by tag name `selector`.
|
|
92
92
|
* @param selector the tag name for the aurora custom-element
|
|
@@ -99,7 +99,7 @@ export declare abstract class ViewContainerRef {
|
|
|
99
99
|
* @param viewClass the generated aurora view class
|
|
100
100
|
* @param options
|
|
101
101
|
*/
|
|
102
|
-
abstract createElement<C extends HTMLElement>(htmlElementClass:
|
|
102
|
+
abstract createElement<C extends HTMLElement>(htmlElementClass: Type<C>, options?: HTMLElementOptions): C;
|
|
103
103
|
/**
|
|
104
104
|
* create a text node and insert to the view
|
|
105
105
|
* @param data
|