@ibyar/core 2.3.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 +11 -7
- package/annotation/options.d.ts.map +1 -1
- package/annotation/options.js.map +1 -1
- package/binding/binding.expressions.d.ts +2 -2
- package/binding/binding.expressions.d.ts.map +1 -1
- package/binding/binding.expressions.js.map +1 -1
- package/component/component.d.ts +15 -10
- package/component/component.d.ts.map +1 -1
- package/component/component.js +46 -1
- 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/directive/directive.d.ts +3 -2
- package/directive/directive.d.ts.map +1 -1
- package/directive/directive.js +6 -3
- package/directive/directive.js.map +1 -1
- package/html/deserialize.d.ts.map +1 -1
- package/html/deserialize.js +11 -2
- package/html/deserialize.js.map +1 -1
- package/html/expression.d.ts.map +1 -1
- package/html/expression.js +14 -5
- package/html/expression.js.map +1 -1
- package/html/types.d.ts +6 -0
- package/html/types.d.ts.map +1 -1
- package/html/types.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 +8 -8
- 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 +42 -24
- 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 +2 -1
- package/view/form-view.js.map +1 -1
- package/view/render.d.ts +4 -1
- package/view/render.d.ts.map +1 -1
- package/view/render.js +32 -6
- 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 +27 -7
- package/view/view.js.map +1 -1
- package/zone/zone.js +1 -1
- package/zone/zone.js.map +1 -1
|
@@ -1,12 +1,33 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Type } from '../utils/typeof.js';
|
|
2
2
|
import { ChildOptions, ComponentOptions, DirectiveOptions, OutputEventInit, OutputOptions, PipeOptions, InjectableOptions } from './options.js';
|
|
3
3
|
type PropertyValue<T> = T | ((value: T) => void) | undefined;
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated since v2.4.0, use `input` function instead.
|
|
6
|
+
*/
|
|
4
7
|
export declare function Input<This, Value>(name?: string): (value: PropertyValue<Value>, context: ClassFieldDecoratorContext<This, Value> | ClassSetterDecoratorContext<This, Value>) => void;
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated since v2.4.0, use `formValue` function instead.
|
|
10
|
+
*/
|
|
5
11
|
export declare function FormValue<This, Value>(): (value: PropertyValue<Value>, context: ClassFieldDecoratorContext<This, Value> | ClassSetterDecoratorContext<This, Value>) => void;
|
|
12
|
+
/**
|
|
13
|
+
* @deprecated since v2.4.0, use `output` function instead.
|
|
14
|
+
*/
|
|
6
15
|
export declare function Output<This, Value>(options?: OutputOptions): (value: undefined, context: ClassFieldDecoratorContext<This, Value>) => void;
|
|
16
|
+
/**
|
|
17
|
+
* @deprecated since v2.4.0, use `output` function instead.
|
|
18
|
+
*/
|
|
7
19
|
export declare function Output<This, Value>(name?: string, options?: OutputEventInit): (value: undefined, context: ClassFieldDecoratorContext<This, Value>) => void;
|
|
20
|
+
/**
|
|
21
|
+
* @deprecated since v2.4.0, use `view` function instead.
|
|
22
|
+
*/
|
|
8
23
|
export declare function View<This, Value>(): (value: PropertyValue<Value>, context: ClassFieldDecoratorContext<This, Value> | ClassSetterDecoratorContext<This, Value>) => void;
|
|
24
|
+
/**
|
|
25
|
+
* @deprecated since v2.4.0, use `viewChild` function instead.
|
|
26
|
+
*/
|
|
9
27
|
export declare function ViewChild<This, Value>(selector: string | typeof HTMLElement | CustomElementConstructor, childOptions?: ChildOptions): (value: PropertyValue<Value>, context: ClassFieldDecoratorContext<This, Value> | ClassSetterDecoratorContext<This, Value>) => void;
|
|
28
|
+
/**
|
|
29
|
+
* @deprecated since v2.4.0, use `viewChildren` function instead.
|
|
30
|
+
*/
|
|
10
31
|
export declare function ViewChildren<This, Value>(selector: string | typeof HTMLElement | CustomElementConstructor): (value: PropertyValue<Value>, context: ClassFieldDecoratorContext<This, Value> | ClassSetterDecoratorContext<This, Value>) => void;
|
|
11
32
|
export declare function HostListener<This, Value extends (this: This, ...args: any) => any>(eventName: string, args?: string | string[]): (value: Value, context: ClassMethodDecoratorContext<unknown, (this: unknown, ...args: any) => any>) => void;
|
|
12
33
|
type ValueGetter<T> = T | (() => T) | undefined;
|
|
@@ -26,7 +47,7 @@ export declare const Injectable: (param: InjectableOptions) => (constructor: any
|
|
|
26
47
|
/**
|
|
27
48
|
* define a new custom element model class
|
|
28
49
|
*/
|
|
29
|
-
export declare const Component: (param: ComponentOptions<
|
|
50
|
+
export declare const Component: (param: ComponentOptions<Type<any>> | ComponentOptions<Type<any>>[]) => (constructor: any, context: ClassDecoratorContext<new (...args: any) => any>) => any;
|
|
30
51
|
export declare const customElement: (param: {
|
|
31
52
|
selector: string;
|
|
32
53
|
} & ElementDefinitionOptions) => (constructor: any, context: ClassDecoratorContext<new (...args: any) => any>) => any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decorators.d.ts","sourceRoot":"","sources":["../../../src/core/annotation/decorators.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"decorators.d.ts","sourceRoot":"","sources":["../../../src/core/annotation/decorators.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAQ/C,OAAO,EACN,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,EAChD,eAAe,EAAE,aAAa,EAAE,WAAW,EAC3C,iBAAiB,EACjB,MAAM,cAAc,CAAC;AAItB,KAAK,aAAa,CAAC,CAAC,IAAI,CAAC,GA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AC,MAAM,CAAC,CAAC,GAAG,SAAS,CAAC;AAEhD,wBAAgB,WAAW,CAAC,IAAI,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,6KAYhE;AAED;;GAEG;AACH,eAAO,MAAM,IAAI,iFAzJmD,GAAG,0BA6JtE,CAAC;AAGF;;GAEG;AACH,eAAO,MAAM,SAAS,sFAnK8C,GAAG,0BAuKtE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,UAAU,uFA5K6C,GAAG,0BAgLtE,CAAC;AAmBF;;GAEG;AACH,eAAO,MAAM,SAAS,iIAtM8C,GAAG,0BAgNtE,CAAC;AAEF,eAAO,MAAM,aAAa;cAAkC,MAAM;wFAlNE,GAAG,0BAsNtE,CAAC"}
|
package/annotation/decorators.js
CHANGED
|
@@ -2,6 +2,9 @@ import { makeClassDecorator, makeClassMemberDecorator } from '@ibyar/decorators'
|
|
|
2
2
|
import { Components } from '../component/component.js';
|
|
3
3
|
import { ReflectComponents } from '../component/reflect.js';
|
|
4
4
|
import { fetchHtml } from '../utils/path.js';
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated since v2.4.0, use `input` function instead.
|
|
7
|
+
*/
|
|
5
8
|
export function Input(name) {
|
|
6
9
|
return makeClassMemberDecorator((value, context, metadata) => {
|
|
7
10
|
if (!name && typeof context.name !== 'string') {
|
|
@@ -13,6 +16,9 @@ export function Input(name) {
|
|
|
13
16
|
ReflectComponents.addInput(metadata, context.name, name || context.name);
|
|
14
17
|
});
|
|
15
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* @deprecated since v2.4.0, use `formValue` function instead.
|
|
21
|
+
*/
|
|
16
22
|
export function FormValue() {
|
|
17
23
|
return makeClassMemberDecorator((value, context, metadata) => {
|
|
18
24
|
if (typeof context.name !== 'string') {
|
|
@@ -24,6 +30,9 @@ export function FormValue() {
|
|
|
24
30
|
ReflectComponents.addInput(metadata, context.name, 'value');
|
|
25
31
|
});
|
|
26
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* @deprecated since v2.4.0, use `output` function instead.
|
|
35
|
+
*/
|
|
27
36
|
export function Output(name, options) {
|
|
28
37
|
const eventType = typeof name === 'object' ? name.name : name;
|
|
29
38
|
const eventOpts = typeof name === 'object' ? name : options;
|
|
@@ -40,6 +49,9 @@ export function Output(name, options) {
|
|
|
40
49
|
});
|
|
41
50
|
});
|
|
42
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* @deprecated since v2.4.0, use `view` function instead.
|
|
54
|
+
*/
|
|
43
55
|
export function View() {
|
|
44
56
|
return makeClassMemberDecorator((value, context, metadata) => {
|
|
45
57
|
if (typeof context.name !== 'string') {
|
|
@@ -51,6 +63,9 @@ export function View() {
|
|
|
51
63
|
ReflectComponents.setComponentView(metadata, context.name);
|
|
52
64
|
});
|
|
53
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* @deprecated since v2.4.0, use `viewChild` function instead.
|
|
68
|
+
*/
|
|
54
69
|
export function ViewChild(selector, childOptions) {
|
|
55
70
|
return makeClassMemberDecorator((value, context, metadata) => {
|
|
56
71
|
if (typeof context.name !== 'string') {
|
|
@@ -62,6 +77,9 @@ export function ViewChild(selector, childOptions) {
|
|
|
62
77
|
ReflectComponents.addViewChild(metadata, context.name, selector, childOptions);
|
|
63
78
|
});
|
|
64
79
|
}
|
|
80
|
+
/**
|
|
81
|
+
* @deprecated since v2.4.0, use `viewChildren` function instead.
|
|
82
|
+
*/
|
|
65
83
|
export function ViewChildren(selector) {
|
|
66
84
|
return makeClassMemberDecorator((value, context, metadata) => {
|
|
67
85
|
if (typeof context.name !== 'string') {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decorators.js","sourceRoot":"","sources":["../../../src/core/annotation/decorators.ts"],"names":[],"mappings":"AACA,OAAO,EAEN,kBAAkB,EAAE,wBAAwB,EAC5C,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,iB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,CAAC;YACnD,CAAC;QACF,CAAC,CAAC;aACD,KAAK,CAAC,MAAM,CAAC,EAAE;YACf,OAAO,CAAC,KAAK,CAAC,eAAe,GAAG,CAAC,WAAW,sBAAsB,MAAM,CAAC,IAAI,eAAe,MAAM,GAAG,CAAC,CAAC;QACxG,CAAC,CAAC,CAAC;IACL,CAAC;SAAM,CAAC;QACP,UAAU,CAAC,eAAe,CAAC,MAAM,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC;IACnD,CAAC;AACF,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,kBAAkB,CAC1C,CAAC,GAAG,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE;IACvC,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QACxB,KAAK,MAAM,IAAI,IAAI,GAAG,EAAE,CAAC;YACxB,iBAAiB,CAAC,WAAkB,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;QACvD,CAAC;IACF,CAAC;SAAM,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;QACpC,iBAAiB,CAAC,WAAkB,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC;IACtD,CAAC;AACF,CAAC,CACD,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG,kBAAkB,CAC9C,CAAC,GAAG,EAAE,WAAW,EAAE,OAAO,EAAE,EAAE;IAC7B,UAAU,CAAC,UAAU,CAAC,WAAkB,EAAE,GAAG,CAAC,CAAC;AAChD,CAAC,CACD,CAAC","sourcesContent":["import type { Class } from '../utils/typeof.js';\nimport {\n\tMetadataClass, MetadataContext,\n\tmakeClassDecorator, makeClassMemberDecorator\n} from '@ibyar/decorators';\nimport { Components } from '../component/component.js';\nimport { ReflectComponents } from '../component/reflect.js';\nimport { fetchHtml } from '../utils/path.js';\nimport {\n\tChildOptions, ComponentOptions, DirectiveOptions,\n\tOutputEventInit, OutputOptions, PipeOptions,\n\tInjectableOptions\n} from './options.js';\n\n\n\ntype PropertyValue<T> = T | ((value: T) => void) | undefined;\n\n\nexport function Input<This, Value>(name?: string) {\n\treturn makeClassMemberDecorator<PropertyValue<Value>, ClassFieldDecoratorContext<This, Value> | ClassSetterDecoratorContext<This, Value>>(\n\t\t(value, context, metadata) => {\n\t\t\tif (!name && typeof context.name !== 'string') {\n\t\t\t\tthrow new TypeError(`type ${typeof context.name} of '${context.name.toString()}' is not supported`);\n\t\t\t}\n\t\t\tif (context.private) {\n\t\t\t\tthrow new SyntaxError(`private members '${context.name.toString()}' is not supported.`);\n\t\t\t}\n\t\t\tReflectComponents.addInput(metadata, context.name as string, name || context.name as string);\n\t\t}\n\t);\n}\n\nexport function FormValue<This, Value>() {\n\treturn makeClassMemberDecorator<PropertyValue<Value>, ClassFieldDecoratorContext<This, Value> | ClassSetterDecoratorContext<This, Value>>(\n\t\t(value, context, metadata) => {\n\t\t\tif (typeof context.name !== 'string') {\n\t\t\t\tthrow new TypeError(`type ${typeof context.name} of '${context.name.toString()}' is not supported`);\n\t\t\t}\n\t\t\tif (context.private) {\n\t\t\t\tthrow new SyntaxError(`private members '${context.name.toString()}' is not supported.`);\n\t\t\t}\n\t\t\tReflectComponents.addInput(metadata, context.name, 'value');\n\t\t}\n\t);\n}\n\nexport function Output<This, Value>(options?: OutputOptions): (value: undefined, context: ClassFieldDecoratorContext<This, Value>) => void;\nexport function Output<This, Value>(name?: string, options?: OutputEventInit): (value: undefined, context: ClassFieldDecoratorContext<This, Value>) => void;\nexport function Output<This, Value>(name?: string | OutputOptions, options?: OutputEventInit): (value: undefined, context: ClassFieldDecoratorContext<This, Value>) => void {\n\tconst eventType = typeof name === 'object' ? name.name : name;\n\tconst eventOpts = typeof name === 'object' ? name : options;\n\treturn makeClassMemberDecorator<undefined, ClassFieldDecoratorContext<This, Value>>(\n\t\t(value, context, metadata) => {\n\t\t\tif (typeof context.name !== 'string') {\n\t\t\t\tthrow new TypeError(`type ${typeof context.name} of '${context.name.toString()}' is not supported`);\n\t\t\t}\n\t\t\tif (context.private) {\n\t\t\t\tthrow new SyntaxError(`private members '${context.name.toString()}' is not supported.`);\n\t\t\t}\n\t\t\tReflectComponents.addOutput(\n\t\t\t\tmetadata,\n\t\t\t\tcontext.name,\n\t\t\t\teventType || context.name,\n\t\t\t\t{\n\t\t\t\t\tbubbles: eventOpts?.bubbles ?? false,\n\t\t\t\t\tcomposed: eventOpts?.composed ?? false\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t);\n}\n\nexport function View<This, Value>() {\n\treturn makeClassMemberDecorator<PropertyValue<Value>, ClassFieldDecoratorContext<This, Value> | ClassSetterDecoratorContext<This, Value>>(\n\t\t(value, context, metadata) => {\n\t\t\tif (typeof context.name !== 'string') {\n\t\t\t\tthrow new TypeError(`type ${typeof context.name} of '${context.name.toString()}' is not supported`);\n\t\t\t}\n\t\t\tif (context.private) {\n\t\t\t\tthrow new SyntaxError(`private members '${context.name.toString()}' is not supported.`);\n\t\t\t}\n\t\t\tReflectComponents.setComponentView(metadata, context.name);\n\t\t}\n\t);\n}\n\nexport function ViewChild<This, Value>(selector: string | typeof HTMLElement | CustomElementConstructor, childOptions?: ChildOptions) {\n\treturn makeClassMemberDecorator<PropertyValue<Value>, ClassFieldDecoratorContext<This, Value> | ClassSetterDecoratorContext<This, Value>>(\n\t\t(value, context, metadata) => {\n\t\t\tif (typeof context.name !== 'string') {\n\t\t\t\tthrow new TypeError(`type ${typeof context.name} of '${context.name.toString()}' is not supported`);\n\t\t\t}\n\t\t\tif (context.private) {\n\t\t\t\tthrow new SyntaxError(`private members '${context.name.toString()}' is not supported.`);\n\t\t\t}\n\t\t\tReflectComponents.addViewChild(metadata, context.name, selector, childOptions);\n\t\t}\n\t);\n}\n\nexport function ViewChildren<This, Value>(selector: string | typeof HTMLElement | CustomElementConstructor) {\n\treturn makeClassMemberDecorator<PropertyValue<Value>, ClassFieldDecoratorContext<This, Value> | ClassSetterDecoratorContext<This, Value>>(\n\t\t(value, context, metadata) => {\n\t\t\tif (typeof context.name !== 'string') {\n\t\t\t\tthrow new TypeError(`type ${typeof context.name} of '${context.name.toString()}' is not supported`);\n\t\t\t}\n\t\t\tif (context.private) {\n\t\t\t\tthrow new SyntaxError(`private members '${context.name.toString()}' is not supported.`);\n\t\t\t}\n\t\t\tReflectComponents.addViewChildren(metadata, context.name, selector);\n\t\t}\n\t);\n}\n\n\nexport function HostListener<This, Value extends (this: This, ...args: any) => any>(eventName: string, args?: string | string[]) {\n\treturn makeClassMemberDecorator<Value, ClassMethodDecoratorContext>(\n\t\t(value, context, metadata) => {\n\t\t\tif (typeof context.name !== 'string') {\n\t\t\t\tthrow new TypeError(`type ${typeof context.name} of '${context.name.toString()}' is not supported`);\n\t\t\t}\n\t\t\targs = typeof args === 'string' ? [args] : args;\n\t\t\tReflectComponents.addHostListener(\n\t\t\t\tmetadata,\n\t\t\t\tcontext.name,\n\t\t\t\teventName,\n\t\t\t\targs || []\n\t\t\t);\n\t\t}\n\t);\n}\n\n\ntype ValueGetter<T> = T | (() => T) | undefined;\n\nexport function HostBinding<This, Value>(hostPropertyName: string) {\n\treturn makeClassMemberDecorator<ValueGetter<Value>, ClassFieldDecoratorContext<This, Value> | ClassMethodDecoratorContext<This, any> | ClassGetterDecoratorContext<This, Value>>(\n\t\t(value, context, metadata) => {\n\t\t\tif (typeof context.name !== 'string') {\n\t\t\t\tthrow new TypeError(`type ${typeof context.name} of '${context.name.toString()}' is not supported`);\n\t\t\t}\n\t\t\tif (context.private) {\n\t\t\t\tthrow new SyntaxError(`private members '${context.name.toString()}' is not supported.`);\n\t\t\t}\n\t\t\tReflectComponents.addHostBinding(metadata, context.name, hostPropertyName);\n\t\t}\n\t);\n}\n\n/**\n * register a new pipe\n */\nexport const Pipe = makeClassDecorator<PipeOptions>(\n\t(opt, constructor, context, metadata) => {\n\t\tComponents.definePipe(constructor as any, opt, metadata);\n\t}\n);\n\n\n/**\n * register a new structure or attribute directive \n */\nexport const Directive = makeClassDecorator<DirectiveOptions>(\n\t(opt, constructor, context, metadata) => {\n\t\tComponents.defineDirective(constructor as any, opt, metadata);\n\t}\n);\n\n/**\n * register a new service\n */\nexport const Injectable = makeClassDecorator<InjectableOptions>(\n\t(opt, constructor, context) => {\n\t\tComponents.defineInjectable(constructor as any, opt, context.metadata);\n\t}\n);\n\nfunction generateComponent<T extends Class>(target: MetadataClass<T>, opt: ComponentOptions<T>, metadata: MetadataContext) {\n\tif (opt.templateUrl) {\n\t\tfetchHtml(opt.templateUrl)\n\t\t\t.then(htmlTemplate => {\n\t\t\t\tif (htmlTemplate) {\n\t\t\t\t\topt.template = htmlTemplate;\n\t\t\t\t\tComponents.defineComponent(target, opt, metadata);\n\t\t\t\t}\n\t\t\t})\n\t\t\t.catch(reason => {\n\t\t\t\tconsole.error(`Error @URL: ${opt.templateUrl}, for model Class: ${target.name},\\n Reason: ${reason}.`);\n\t\t\t});\n\t} else {\n\t\tComponents.defineComponent(target, opt, metadata);\n\t}\n}\n\n/**\n * define a new custom element model class\n */\nexport const Component = makeClassDecorator<ComponentOptions | ComponentOptions[]>(\n\t(opt, constructor, context, metadata) => {\n\t\tif (Array.isArray(opt)) {\n\t\t\tfor (const comp of opt) {\n\t\t\t\tgenerateComponent(constructor as any, comp, metadata);\n\t\t\t}\n\t\t} else if (typeof opt === 'object') {\n\t\t\tgenerateComponent(constructor as any, opt, metadata);\n\t\t}\n\t}\n);\n\nexport const customElement = makeClassDecorator<{ selector: string } & ElementDefinitionOptions, Class<HTMLElement>>(\n\t(opt, constructor, context) => {\n\t\tComponents.defineView(constructor as any, opt);\n\t}\n);\n"]}
|
|
1
|
+
{"version":3,"file":"decorators.js","sourceRoot":"","sources":["../../../src/core/annotation/decorators.ts"],"names":[],"mappings":"AACA,OAAO,EAEN,kBAAkB,EAAE,wBAAwB,EAC5C,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,iBAAiB,EA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BAC5B,UAAU,CAAC,eAAe,CAAC,MAAM,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC;YACnD,CAAC;QACF,CAAC,CAAC;aACD,KAAK,CAAC,MAAM,CAAC,EAAE;YACf,OAAO,CAAC,KAAK,CAAC,eAAe,GAAG,CAAC,WAAW,sBAAsB,MAAM,CAAC,IAAI,eAAe,MAAM,GAAG,CAAC,CAAC;QACxG,CAAC,CAAC,CAAC;IACL,CAAC;SAAM,CAAC;QACP,UAAU,CAAC,eAAe,CAAC,MAAM,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC;IACnD,CAAC;AACF,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,kBAAkB,CAC1C,CAAC,GAAG,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE;IACvC,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QACxB,KAAK,MAAM,IAAI,IAAI,GAAG,EAAE,CAAC;YACxB,iBAAiB,CAAC,WAAkB,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;QACvD,CAAC;IACF,CAAC;SAAM,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;QACpC,iBAAiB,CAAC,WAAkB,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC;IACtD,CAAC;AACF,CAAC,CACD,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG,kBAAkB,CAC9C,CAAC,GAAG,EAAE,WAAW,EAAE,OAAO,EAAE,EAAE;IAC7B,UAAU,CAAC,UAAU,CAAC,WAAkB,EAAE,GAAG,CAAC,CAAC;AAChD,CAAC,CACD,CAAC","sourcesContent":["import type { Type } from '../utils/typeof.js';\nimport {\n\tMetadataClass, MetadataContext,\n\tmakeClassDecorator, makeClassMemberDecorator\n} from '@ibyar/decorators';\nimport { Components } from '../component/component.js';\nimport { ReflectComponents } from '../component/reflect.js';\nimport { fetchHtml } from '../utils/path.js';\nimport {\n\tChildOptions, ComponentOptions, DirectiveOptions,\n\tOutputEventInit, OutputOptions, PipeOptions,\n\tInjectableOptions\n} from './options.js';\n\n\n\ntype PropertyValue<T> = T | ((value: T) => void) | undefined;\n\n/**\n * @deprecated since v2.4.0, use `input` function instead.\n */\n\nexport function Input<This, Value>(name?: string) {\n\treturn makeClassMemberDecorator<PropertyValue<Value>, ClassFieldDecoratorContext<This, Value> | ClassSetterDecoratorContext<This, Value>>(\n\t\t(value, context, metadata) => {\n\t\t\tif (!name && typeof context.name !== 'string') {\n\t\t\t\tthrow new TypeError(`type ${typeof context.name} of '${context.name.toString()}' is not supported`);\n\t\t\t}\n\t\t\tif (context.private) {\n\t\t\t\tthrow new SyntaxError(`private members '${context.name.toString()}' is not supported.`);\n\t\t\t}\n\t\t\tReflectComponents.addInput(metadata, context.name as string, name || context.name as string);\n\t\t}\n\t);\n}\n\n\n/**\n * @deprecated since v2.4.0, use `formValue` function instead.\n */\nexport function FormValue<This, Value>() {\n\treturn makeClassMemberDecorator<PropertyValue<Value>, ClassFieldDecoratorContext<This, Value> | ClassSetterDecoratorContext<This, Value>>(\n\t\t(value, context, metadata) => {\n\t\t\tif (typeof context.name !== 'string') {\n\t\t\t\tthrow new TypeError(`type ${typeof context.name} of '${context.name.toString()}' is not supported`);\n\t\t\t}\n\t\t\tif (context.private) {\n\t\t\t\tthrow new SyntaxError(`private members '${context.name.toString()}' is not supported.`);\n\t\t\t}\n\t\t\tReflectComponents.addInput(metadata, context.name, 'value');\n\t\t}\n\t);\n}\n\n/**\n * @deprecated since v2.4.0, use `output` function instead.\n */\nexport function Output<This, Value>(options?: OutputOptions): (value: undefined, context: ClassFieldDecoratorContext<This, Value>) => void;\n\n/**\n * @deprecated since v2.4.0, use `output` function instead.\n */\nexport function Output<This, Value>(name?: string, options?: OutputEventInit): (value: undefined, context: ClassFieldDecoratorContext<This, Value>) => void;\n\n/**\n * @deprecated since v2.4.0, use `output` function instead.\n */\nexport function Output<This, Value>(name?: string | OutputOptions, options?: OutputEventInit): (value: undefined, context: ClassFieldDecoratorContext<This, Value>) => void {\n\tconst eventType = typeof name === 'object' ? name.name : name;\n\tconst eventOpts = typeof name === 'object' ? name : options;\n\treturn makeClassMemberDecorator<undefined, ClassFieldDecoratorContext<This, Value>>(\n\t\t(value, context, metadata) => {\n\t\t\tif (typeof context.name !== 'string') {\n\t\t\t\tthrow new TypeError(`type ${typeof context.name} of '${context.name.toString()}' is not supported`);\n\t\t\t}\n\t\t\tif (context.private) {\n\t\t\t\tthrow new SyntaxError(`private members '${context.name.toString()}' is not supported.`);\n\t\t\t}\n\t\t\tReflectComponents.addOutput(\n\t\t\t\tmetadata,\n\t\t\t\tcontext.name,\n\t\t\t\teventType || context.name,\n\t\t\t\t{\n\t\t\t\t\tbubbles: eventOpts?.bubbles ?? false,\n\t\t\t\t\tcomposed: eventOpts?.composed ?? false\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t);\n}\n\n/**\n * @deprecated since v2.4.0, use `view` function instead.\n */\nexport function View<This, Value>() {\n\treturn makeClassMemberDecorator<PropertyValue<Value>, ClassFieldDecoratorContext<This, Value> | ClassSetterDecoratorContext<This, Value>>(\n\t\t(value, context, metadata) => {\n\t\t\tif (typeof context.name !== 'string') {\n\t\t\t\tthrow new TypeError(`type ${typeof context.name} of '${context.name.toString()}' is not supported`);\n\t\t\t}\n\t\t\tif (context.private) {\n\t\t\t\tthrow new SyntaxError(`private members '${context.name.toString()}' is not supported.`);\n\t\t\t}\n\t\t\tReflectComponents.setComponentView(metadata, context.name);\n\t\t}\n\t);\n}\n\n/**\n * @deprecated since v2.4.0, use `viewChild` function instead.\n */\nexport function ViewChild<This, Value>(selector: string | typeof HTMLElement | CustomElementConstructor, childOptions?: ChildOptions) {\n\treturn makeClassMemberDecorator<PropertyValue<Value>, ClassFieldDecoratorContext<This, Value> | ClassSetterDecoratorContext<This, Value>>(\n\t\t(value, context, metadata) => {\n\t\t\tif (typeof context.name !== 'string') {\n\t\t\t\tthrow new TypeError(`type ${typeof context.name} of '${context.name.toString()}' is not supported`);\n\t\t\t}\n\t\t\tif (context.private) {\n\t\t\t\tthrow new SyntaxError(`private members '${context.name.toString()}' is not supported.`);\n\t\t\t}\n\t\t\tReflectComponents.addViewChild(metadata, context.name, selector, childOptions);\n\t\t}\n\t);\n}\n\n/**\n * @deprecated since v2.4.0, use `viewChildren` function instead.\n */\nexport function ViewChildren<This, Value>(selector: string | typeof HTMLElement | CustomElementConstructor) {\n\treturn makeClassMemberDecorator<PropertyValue<Value>, ClassFieldDecoratorContext<This, Value> | ClassSetterDecoratorContext<This, Value>>(\n\t\t(value, context, metadata) => {\n\t\t\tif (typeof context.name !== 'string') {\n\t\t\t\tthrow new TypeError(`type ${typeof context.name} of '${context.name.toString()}' is not supported`);\n\t\t\t}\n\t\t\tif (context.private) {\n\t\t\t\tthrow new SyntaxError(`private members '${context.name.toString()}' is not supported.`);\n\t\t\t}\n\t\t\tReflectComponents.addViewChildren(metadata, context.name, selector);\n\t\t}\n\t);\n}\n\nexport function HostListener<This, Value extends (this: This, ...args: any) => any>(eventName: string, args?: string | string[]) {\n\treturn makeClassMemberDecorator<Value, ClassMethodDecoratorContext>(\n\t\t(value, context, metadata) => {\n\t\t\tif (typeof context.name !== 'string') {\n\t\t\t\tthrow new TypeError(`type ${typeof context.name} of '${context.name.toString()}' is not supported`);\n\t\t\t}\n\t\t\targs = typeof args === 'string' ? [args] : args;\n\t\t\tReflectComponents.addHostListener(\n\t\t\t\tmetadata,\n\t\t\t\tcontext.name,\n\t\t\t\teventName,\n\t\t\t\targs || []\n\t\t\t);\n\t\t}\n\t);\n}\n\n\ntype ValueGetter<T> = T | (() => T) | undefined;\n\nexport function HostBinding<This, Value>(hostPropertyName: string) {\n\treturn makeClassMemberDecorator<ValueGetter<Value>, ClassFieldDecoratorContext<This, Value> | ClassMethodDecoratorContext<This, any> | ClassGetterDecoratorContext<This, Value>>(\n\t\t(value, context, metadata) => {\n\t\t\tif (typeof context.name !== 'string') {\n\t\t\t\tthrow new TypeError(`type ${typeof context.name} of '${context.name.toString()}' is not supported`);\n\t\t\t}\n\t\t\tif (context.private) {\n\t\t\t\tthrow new SyntaxError(`private members '${context.name.toString()}' is not supported.`);\n\t\t\t}\n\t\t\tReflectComponents.addHostBinding(metadata, context.name, hostPropertyName);\n\t\t}\n\t);\n}\n\n/**\n * register a new pipe\n */\nexport const Pipe = makeClassDecorator<PipeOptions>(\n\t(opt, constructor, context, metadata) => {\n\t\tComponents.definePipe(constructor as any, opt, metadata);\n\t}\n);\n\n\n/**\n * register a new structure or attribute directive \n */\nexport const Directive = makeClassDecorator<DirectiveOptions>(\n\t(opt, constructor, context, metadata) => {\n\t\tComponents.defineDirective(constructor as any, opt, metadata);\n\t}\n);\n\n/**\n * register a new service\n */\nexport const Injectable = makeClassDecorator<InjectableOptions>(\n\t(opt, constructor, context) => {\n\t\tComponents.defineInjectable(constructor as any, opt, context.metadata);\n\t}\n);\n\nfunction generateComponent<T extends Type<any>>(target: MetadataClass<T>, opt: ComponentOptions<T>, metadata: MetadataContext) {\n\tif (opt.templateUrl) {\n\t\tfetchHtml(opt.templateUrl)\n\t\t\t.then(htmlTemplate => {\n\t\t\t\tif (htmlTemplate) {\n\t\t\t\t\topt.template = htmlTemplate;\n\t\t\t\t\tComponents.defineComponent(target, opt, metadata);\n\t\t\t\t}\n\t\t\t})\n\t\t\t.catch(reason => {\n\t\t\t\tconsole.error(`Error @URL: ${opt.templateUrl}, for model Class: ${target.name},\\n Reason: ${reason}.`);\n\t\t\t});\n\t} else {\n\t\tComponents.defineComponent(target, opt, metadata);\n\t}\n}\n\n/**\n * define a new custom element model class\n */\nexport const Component = makeClassDecorator<ComponentOptions | ComponentOptions[]>(\n\t(opt, constructor, context, metadata) => {\n\t\tif (Array.isArray(opt)) {\n\t\t\tfor (const comp of opt) {\n\t\t\t\tgenerateComponent(constructor as any, comp, metadata);\n\t\t\t}\n\t\t} else if (typeof opt === 'object') {\n\t\t\tgenerateComponent(constructor as any, opt, metadata);\n\t\t}\n\t}\n);\n\nexport const customElement = makeClassDecorator<{ selector: string } & ElementDefinitionOptions, Type<HTMLElement>>(\n\t(opt, constructor, context) => {\n\t\tComponents.defineView(constructor as any, opt);\n\t}\n);\n"]}
|
package/annotation/options.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Type } from '../utils/typeof.js';
|
|
2
2
|
import type { DomNode } from '@ibyar/elements';
|
|
3
3
|
import type { TemplateUrl } from '../utils/path.js';
|
|
4
4
|
import type { ZoneType } from '../zone/bootstrap.js';
|
|
@@ -52,18 +52,18 @@ export interface DirectiveOptions {
|
|
|
52
52
|
*/
|
|
53
53
|
zone?: ZoneType;
|
|
54
54
|
/**
|
|
55
|
-
* name of possible structure
|
|
55
|
+
* name of possible structure directives successor
|
|
56
56
|
*/
|
|
57
|
-
|
|
57
|
+
successors?: string[];
|
|
58
58
|
}
|
|
59
59
|
export interface InjectableOptions {
|
|
60
|
-
provideIn?:
|
|
60
|
+
provideIn?: Type<CustomElementConstructor> | 'root' | 'platform' | 'any';
|
|
61
61
|
}
|
|
62
62
|
export interface PipeOptions {
|
|
63
63
|
name: string;
|
|
64
64
|
asynchronous?: boolean;
|
|
65
65
|
}
|
|
66
|
-
export interface ComponentOptions<T =
|
|
66
|
+
export interface ComponentOptions<T = Type<any>> {
|
|
67
67
|
/**
|
|
68
68
|
* a tag name for the component,
|
|
69
69
|
* if the tag name is valid custom element name, the view class will be a custom element,
|
|
@@ -177,6 +177,10 @@ export interface ComponentOptions<T = Class> {
|
|
|
177
177
|
* default mode: `open`, delegatesFocus: `false` and slotAssignment: `manual`
|
|
178
178
|
*/
|
|
179
179
|
shadowRootInit?: Partial<ShadowRootInit>;
|
|
180
|
+
/**
|
|
181
|
+
*
|
|
182
|
+
*/
|
|
183
|
+
disabledFeatures?: ('internals' | 'shadow')[];
|
|
180
184
|
/**
|
|
181
185
|
* Create a custom form-associated element with HTMLElement.attachInternals
|
|
182
186
|
* default: false
|
|
@@ -261,7 +265,7 @@ export interface ComponentOptions<T = Class> {
|
|
|
261
265
|
*
|
|
262
266
|
* ```
|
|
263
267
|
*/
|
|
264
|
-
formAssociated?: boolean |
|
|
268
|
+
formAssociated?: boolean | Type<ValueControl<any>>;
|
|
265
269
|
/**
|
|
266
270
|
* - use `manual` for no zone.js patch effect applied,
|
|
267
271
|
* and used for manual change detection for heavily process components.
|
|
@@ -286,7 +290,7 @@ export interface ComponentOptions<T = Class> {
|
|
|
286
290
|
/**
|
|
287
291
|
* The imports property specifies the component's template dependencies — those directives, components, and pipes that can be used within its template.
|
|
288
292
|
*/
|
|
289
|
-
imports?: (
|
|
293
|
+
imports?: (Type<any> | ReadonlyArray<any>)[];
|
|
290
294
|
}
|
|
291
295
|
export interface ChildOptions {
|
|
292
296
|
[key: string]: any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../../src/core/annotation/options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../../src/core/annotation/options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAGnE,MAAM,WAAW,gBAAgB;IAEhC;;;;;OAKG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;;;;;;;;;;;;;;;;;;;;;OAsBG;IAEH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;;;;;;;;;;;;OAcG;IACH,IAAI,CAAC,EAAE,QAAQ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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmFG;IACH,cAAc,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC;IAEnD;;;;;;;;;;;;;;;;;;;OAmBG;IACH,IAAI,CAAC,EAAE,QAAQ,CAAC;IAEhB;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;CAC7C;AAED,MAAM,WAAW,YAAY;IAC5B,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACnB;AAED,MAAM,WAAW,YAAY;IAC5B,QAAQ,EAAE,MAAM,GAAG,OAAO,WAAW,GAAG,wBAAwB,CAAC;IACjE,YAAY,CAAC,EAAE,YAAY,CAAC;CAC5B;AAED,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;AAC5D,MAAM,MAAM,aAAa,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,eAAe,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.js","sourceRoot":"","sources":["../../../src/core/annotation/options.ts"],"names":[],"mappings":"","sourcesContent":["import type { Class, TypeOf } from '../utils/typeof.js';\nimport type { DomNode } from '@ibyar/elements';\nimport type { TemplateUrl } from '../utils/path.js';\nimport type { ZoneType } from '../zone/bootstrap.js';\nimport type { ValueControl } from '../component/custom-element.js';\n\n\nexport interface DirectiveOptions {\n\n\t/**\n\t * the name of the directive which is used in the template\n\t * \n\t * a structural directive name should start with `*`,\n\t * and an attributes directive should not.\n\t */\n\tselector: string;\n\n\t/**\n\t * export this directive to the HTML template scope,\n\t * \n\t * it can be accessed by the template reference name \n\t * ex:\n\t * ```ts\n\t * \n\t * \n\t * \n\t * Directive({\n\t * \tselector: '*tooltip',\n\t * \texportAs: 'tooltip'\n\t * })\n\t * ```\n\t * \n\t * in your component\n\t * \n\t * ```html\n\t * <a tooltip=\"I'm a tooltip!!\" #tooltip=\"tooltip\">I'm a link</a>\n\t * <button (click)=\"tooltip.toggleTooltip()\">Toggle tooltip</button>\n\t * ```\n\t * \n\t */\n\n\texportAs?: string;\n\n\t/**\n\t * - use `manual` for no zone.js patch effect applied,\n\t * and used for manual change detection for heavily process components.\n\t * \n\t * - use `proxy` zone for automatic detect changes without use of `zone.js`\n\t * \n\t * - use `aurora` for detection events like `rxjs` observables, `setTimeout`,\n\t * `setInterval` and `fetch` and `XMLHttpRequest`, etc...\n\t * make sure that `zone.js` is imported in the polyfills module. \n\t * \n\t * if no value specified, the value will be initialized by the custom element `web component` zone,\n\t * - if the web component zone is `manual`, the directive zone also will be `manual`, expect weird behavior.\n\t * - if the web component zone is `proxy`, the directive zone also will be `proxy`.\n\t * - if the web component zone is `aurora`, the directive zone also will be `aurora` and will get the benefit of `zone.js`.\n\t */\n\tzone?: ZoneType;\n\n\n\t/**\n\t * name of possible structure directive successor\n\t */\n\tsuccessor?: string;\n}\n\nexport interface InjectableOptions {\n\tprovideIn?: TypeOf<CustomElementConstructor> | 'root' | 'platform' | 'any';\n}\n\nexport interface PipeOptions {\n\tname: string;\n\tasynchronous?: boolean;\n}\n\nexport interface ComponentOptions<T = Class> {\n\n\t/**\n\t * a tag name for the component,\n\t * if the tag name is valid custom element name, the view class will be a custom element,\n\t * otherwise an HTMLUnknownElement will be created\n\t */\n\tselector: string;\n\n\t/**\n\t * add html file url path to fetch,\n\t * templateUrl had propriety than template, and will override it.\n\t *\n\t * Can provide file name as \"person-view.html\" will resolved \n\t * as 'http://site-address.org/persin-view.html',\n\t * \n\t * OR as an object { moduleMeta: import.meta, filename: 'person-edit.html' }\n\t * let (import.meta = '/person/person.js') will resolved \n\t * as 'http://site-address.org/person/person-edit.html',\n\t * \n\t * OR as an object { moduleMeta: import.meta }\n\t * let (import.meta = '/person/person.js') will resolved as 'http://site-address.org/person/person.html'.\n\t * \n\t * if url not found, component will not be defined,\n\t * \n\t * if you didn't use webpack or rollup.js or any bundler, \n\t * you should copy the html files to its folder by yourself. \n\t */\n\ttemplateUrl?: TemplateUrl | string;\n\n\t/**\n\t * template: html string\n\t * \tif template === null || undefined ==> it had nothing to render, \n\t * and may be inherit from an html element\n\t * \n\t * write a template, as inline string, represent a a valid html.\n\t * \t\t\t\t\n\t */\n\ttemplate?: string | DomNode;\n\n\t/**\n\t * style for this element\n\t */\n\tstyles?: string | { [key: string]: string }[];\n\n\t/**\n\t * what basic element should the new component inherit from,\n\t * the tag name to inherit from as 'a', 'div', 'table', 'td', 'th', 'tr', etc ...\n\t * also, support extends a custom element tag name.\n\t */\n\textend?: keyof HTMLElementTagNameMap | `${string}-${string}`;\n\n\t/**\n\t * An encapsulation policy for the template and CSS styles. One of:\n\t * 'custom': Use global CSS without any encapsulation.\n\t * 'shadow-dom': Use Shadow DOM v1 to encapsulate styles.\n\t * \n\t * 'template': like 'custom', with load the template from the document ('index.html' file)\n\t * \t \t\t\tthat had the same id as the component \"selector\".\n\t * 'shadow-dom-template': like 'shadowDom', and load template by selector id.\n\t * \n\t * Both 'template' & 'shadow-dom-template' encapsulation type:\n\t * should had attributes name like lowercase,\n\t * \tthe browser itself, will convert all attributes to lowercase\n\t * \n\t * ```typescript\n\t *\t\t@Input('personage') personAge: number;\n\t *\t\t@Input('propname') propName: string;\n\t *\t\t@Output('savebuttonclick') saveButtonClick = new EventEmitter<Persons>();\n\t *\t\t@View('personform') personForm: HTMLFormElement;\n\t * ```\n\t * \n\t * any app root element as \n\t * \n\t * ```html\n\t * <app-root></app-root>\n\t * ```\n\t * \n\t * the supported bind options is 'One way binding *(as passing data only)'\n\t * and 'template parsing' and 'event binding' syntax, HTML (angular) like.\n\t * it load its attributes from 'window object'\n\t * \n\t * so to pass date to A root element, \n\t * \n\t * ```html\n\t * <script>\n\t * \tconst appVersion = '0.1.504';\n\t * \tfunction onRootAppClick() {\n\t *\t\tconsole.log('root app clicked');\n\t * \t}\n\t * \tfunction onSave(data){\n\t *\t\tconsole.log('root app save', data);\n\t * \t}\n\t * </script>\n\t * <app-root [version]=\"appVersion\" \n\t * \t\tonclick=\"onRootAppClick()\"\n\t * \t\t(save)=\"onSave()\" >\n\t * </app-root>\n\t * ```\n\t * \n\t * default is 'custom'\n\t * @type {'custom' | 'shadowDom' | 'template' | 'shadowDom-template'}\n\t */\n\tencapsulation?: 'custom' | 'shadow-dom' | 'template' | 'shadow-dom-template';\n\n\t/**\n\t * default: 'open' when encapsulation used,\n\t * otherwise it is undefined and will not attach shadow root element.\n\t */\n\tshadowDomMode?: ShadowRootMode;\n\n\t/**\n\t * default: false\n\t */\n\tshadowDomDelegatesFocus?: boolean;\n\n\t/**\n\t * shadow root initialization options,\n\t * default mode: `open`, delegatesFocus: `false` and slotAssignment: `manual`\n\t */\n\tshadowRootInit?: Partial<ShadowRootInit>;\n\n\t/**\n\t * Create a custom form-associated element with HTMLElement.attachInternals\n\t * default: false\n\t * \n\t * if the value is `true` it is expected from the model class to implement `ValueControl<T>` interface\n\t * \n\t * otherwise you can register another class that implement `ValueControl<T>`,\n\t * in case if you want split the model and the value controller.\n\t * \n\t * #### Usage Notes:\n\t * \n\t * ```ts\n\t * \n\t * @Component({\n\t * \tselector: 'custom-message',\n\t * \ttemplate: `\n\t * \t\t<label for=\"message\">Message</label>\n\t * \t\t<textarea id=\"message\" [(value)]=\"message\" [disabled]=\"disabled\" (change)=\"onMessageChange($event.target.value)\"></textarea>\n\t * \t`,\n\t * \tformAssociated: true,\n\t * \t// formAssociated: CustomMessage,\n\t * })\n\t * export class CustomMessage implements ValueControl<string> {\n\t * \n\t * \tprivate message: string | null = '';\n\t * \tprivate disabled: boolean = false;\n\t * \tprivate _onChange: (_: any) => void = () => {};\n\t * \n\t * \twriteValue({ value, mode }: WriteValueOptions<string>) {\n\t * \t\tthis.message = mode !== 'reset' ? value : '';\n\t * \t}\n\t * \n\t * \tregisterOnChange(fn: (_: any) => void): void {\n\t * \t\tthis._onChange = fn;\n\t * \t}\n\t * \n\t * \tsetDisabledState(isDisabled: boolean) {\n\t * \t\tthis.disabled = isDisabled;\n\t * \t}\n\t * \n\t * \tonMessageChange(message: string) {\n\t * \t\tthis._onChange(message);\n\t * \t}\n\t * \t\n\t * }\n\t * \n\t * \n\t * export class CustomInputValueControl implements ValueControl<number> {\n\t * \n\t * \tprivate _value: number | null = null;\n\t * \tprivate _disabled: boolean = false;\n\t * \tprivate _onChange: (_: any) => void = () => {};\n\t * \n\t * \twriteValue({ value, mode }: WriteValueOptions<number>) {\n\t * \t\tthis._value = mode !== 'reset' ? value : null;\n\t * \t}\n\t * \n\t * \tregisterOnChange(fn: (_: any) => void): void {\n\t * \t\tthis._onChange = fn;\n\t * \t}\n\t * \n\t * \tsetDisabledState(isDisabled: boolean) {\n\t * \t\tthis._disabled = isDisabled;\n\t * \t}\n\t * \t\n\t * }\n\t * \n\t * @Component({\n\t * \tselector: 'custom-input',\n\t * \textend: 'input',\n\t * \tformAssociated: CustomInputValueControl,\n\t * })\n\t * export class CustomInputElement {\n\t * \t\n\t * @View()\n\t * \tview: HTMLInputElement;\n\t * \n\t * \tonInit() {\n\t * \t\tthis.view.type = 'number';\n\t * \t}\n\t * }\n\t * \n\t * ```\n\t */\n\tformAssociated?: boolean | TypeOf<ValueControl<any>>;\n\n\t/**\n\t * - use `manual` for no zone.js patch effect applied,\n\t * and used for manual change detection for heavily process components.\n\t * \n\t * - use `proxy` zone for automatic detect changes without use of `zone.js`\n\t * \n\t * - use `aurora` for detection events like `rxjs` observables, `setTimeout`,\n\t * `setInterval` and `fetch` and `XMLHttpRequest`, etc...\n\t * make sure that `zone.js` is imported in the polyfills module. \n\t * \n\t * the default value is the platform zone type which can be changed by:\n\t * \n\t * ```js\n\t * bootstrapZone('manual')\n\t * bootstrapZone('proxy')\n\t * bootstrapZone('aurora')\n\t * ```\n\t * \n\t * if `bootstrapZone` never been called, then the default zone is a `manual`.\n\t */\n\tzone?: ZoneType;\n\n\t/**\n\t * The imports property specifies the component's template dependencies — those directives, components, and pipes that can be used within its template.\n\t */\n\timports?: (TypeOf<any> | ReadonlyArray<any>)[];\n}\n\nexport interface ChildOptions {\n\t[key: string]: any;\n}\n\nexport interface ViewChildOpt {\n\tselector: string | typeof HTMLElement | CustomElementConstructor;\n\tchildOptions?: ChildOptions;\n}\n\nexport type OutputEventInit = Omit<EventInit, 'cancelable'>;\nexport type OutputOptions = { name?: string } & OutputEventInit;\n"]}
|
|
1
|
+
{"version":3,"file":"options.js","sourceRoot":"","sources":["../../../src/core/annotation/options.ts"],"names":[],"mappings":"","sourcesContent":["import type { Type } from '../utils/typeof.js';\nimport type { DomNode } from '@ibyar/elements';\nimport type { TemplateUrl } from '../utils/path.js';\nimport type { ZoneType } from '../zone/bootstrap.js';\nimport type { ValueControl } from '../component/custom-element.js';\n\n\nexport interface DirectiveOptions {\n\n\t/**\n\t * the name of the directive which is used in the template\n\t * \n\t * a structural directive name should start with `*`,\n\t * and an attributes directive should not.\n\t */\n\tselector: string;\n\n\t/**\n\t * export this directive to the HTML template scope,\n\t * \n\t * it can be accessed by the template reference name \n\t * ex:\n\t * ```ts\n\t * \n\t * \n\t * \n\t * Directive({\n\t * \tselector: '*tooltip',\n\t * \texportAs: 'tooltip'\n\t * })\n\t * ```\n\t * \n\t * in your component\n\t * \n\t * ```html\n\t * <a tooltip=\"I'm a tooltip!!\" #tooltip=\"tooltip\">I'm a link</a>\n\t * <button (click)=\"tooltip.toggleTooltip()\">Toggle tooltip</button>\n\t * ```\n\t * \n\t */\n\n\texportAs?: string;\n\n\t/**\n\t * - use `manual` for no zone.js patch effect applied,\n\t * and used for manual change detection for heavily process components.\n\t * \n\t * - use `proxy` zone for automatic detect changes without use of `zone.js`\n\t * \n\t * - use `aurora` for detection events like `rxjs` observables, `setTimeout`,\n\t * `setInterval` and `fetch` and `XMLHttpRequest`, etc...\n\t * make sure that `zone.js` is imported in the polyfills module. \n\t * \n\t * if no value specified, the value will be initialized by the custom element `web component` zone,\n\t * - if the web component zone is `manual`, the directive zone also will be `manual`, expect weird behavior.\n\t * - if the web component zone is `proxy`, the directive zone also will be `proxy`.\n\t * - if the web component zone is `aurora`, the directive zone also will be `aurora` and will get the benefit of `zone.js`.\n\t */\n\tzone?: ZoneType;\n\n\t/**\n\t * name of possible structure directives successor\n\t */\n\tsuccessors?: string[];\n\n}\n\nexport interface InjectableOptions {\n\tprovideIn?: Type<CustomElementConstructor> | 'root' | 'platform' | 'any';\n}\n\nexport interface PipeOptions {\n\tname: string;\n\tasynchronous?: boolean;\n}\n\nexport interface ComponentOptions<T = Type<any>> {\n\n\t/**\n\t * a tag name for the component,\n\t * if the tag name is valid custom element name, the view class will be a custom element,\n\t * otherwise an HTMLUnknownElement will be created\n\t */\n\tselector: string;\n\n\t/**\n\t * add html file url path to fetch,\n\t * templateUrl had propriety than template, and will override it.\n\t *\n\t * Can provide file name as \"person-view.html\" will resolved \n\t * as 'http://site-address.org/persin-view.html',\n\t * \n\t * OR as an object { moduleMeta: import.meta, filename: 'person-edit.html' }\n\t * let (import.meta = '/person/person.js') will resolved \n\t * as 'http://site-address.org/person/person-edit.html',\n\t * \n\t * OR as an object { moduleMeta: import.meta }\n\t * let (import.meta = '/person/person.js') will resolved as 'http://site-address.org/person/person.html'.\n\t * \n\t * if url not found, component will not be defined,\n\t * \n\t * if you didn't use webpack or rollup.js or any bundler, \n\t * you should copy the html files to its folder by yourself. \n\t */\n\ttemplateUrl?: TemplateUrl | string;\n\n\t/**\n\t * template: html string\n\t * \tif template === null || undefined ==> it had nothing to render, \n\t * and may be inherit from an html element\n\t * \n\t * write a template, as inline string, represent a a valid html.\n\t * \t\t\t\t\n\t */\n\ttemplate?: string | DomNode;\n\n\t/**\n\t * style for this element\n\t */\n\tstyles?: string | { [key: string]: string }[];\n\n\t/**\n\t * what basic element should the new component inherit from,\n\t * the tag name to inherit from as 'a', 'div', 'table', 'td', 'th', 'tr', etc ...\n\t * also, support extends a custom element tag name.\n\t */\n\textend?: keyof HTMLElementTagNameMap | `${string}-${string}`;\n\n\t/**\n\t * An encapsulation policy for the template and CSS styles. One of:\n\t * 'custom': Use global CSS without any encapsulation.\n\t * 'shadow-dom': Use Shadow DOM v1 to encapsulate styles.\n\t * \n\t * 'template': like 'custom', with load the template from the document ('index.html' file)\n\t * \t \t\t\tthat had the same id as the component \"selector\".\n\t * 'shadow-dom-template': like 'shadowDom', and load template by selector id.\n\t * \n\t * Both 'template' & 'shadow-dom-template' encapsulation type:\n\t * should had attributes name like lowercase,\n\t * \tthe browser itself, will convert all attributes to lowercase\n\t * \n\t * ```typescript\n\t *\t\t@Input('personage') personAge: number;\n\t *\t\t@Input('propname') propName: string;\n\t *\t\t@Output('savebuttonclick') saveButtonClick = new EventEmitter<Persons>();\n\t *\t\t@View('personform') personForm: HTMLFormElement;\n\t * ```\n\t * \n\t * any app root element as \n\t * \n\t * ```html\n\t * <app-root></app-root>\n\t * ```\n\t * \n\t * the supported bind options is 'One way binding *(as passing data only)'\n\t * and 'template parsing' and 'event binding' syntax, HTML (angular) like.\n\t * it load its attributes from 'window object'\n\t * \n\t * so to pass date to A root element, \n\t * \n\t * ```html\n\t * <script>\n\t * \tconst appVersion = '0.1.504';\n\t * \tfunction onRootAppClick() {\n\t *\t\tconsole.log('root app clicked');\n\t * \t}\n\t * \tfunction onSave(data){\n\t *\t\tconsole.log('root app save', data);\n\t * \t}\n\t * </script>\n\t * <app-root [version]=\"appVersion\" \n\t * \t\tonclick=\"onRootAppClick()\"\n\t * \t\t(save)=\"onSave()\" >\n\t * </app-root>\n\t * ```\n\t * \n\t * default is 'custom'\n\t * @type {'custom' | 'shadowDom' | 'template' | 'shadowDom-template'}\n\t */\n\tencapsulation?: 'custom' | 'shadow-dom' | 'template' | 'shadow-dom-template';\n\n\t/**\n\t * default: 'open' when encapsulation used,\n\t * otherwise it is undefined and will not attach shadow root element.\n\t */\n\tshadowDomMode?: ShadowRootMode;\n\n\t/**\n\t * default: false\n\t */\n\tshadowDomDelegatesFocus?: boolean;\n\n\t/**\n\t * shadow root initialization options,\n\t * default mode: `open`, delegatesFocus: `false` and slotAssignment: `manual`\n\t */\n\tshadowRootInit?: Partial<ShadowRootInit>;\n\n\t/**\n\t * \n\t */\n\tdisabledFeatures?: ('internals' | 'shadow')[];\n\n\t/**\n\t * Create a custom form-associated element with HTMLElement.attachInternals\n\t * default: false\n\t * \n\t * if the value is `true` it is expected from the model class to implement `ValueControl<T>` interface\n\t * \n\t * otherwise you can register another class that implement `ValueControl<T>`,\n\t * in case if you want split the model and the value controller.\n\t * \n\t * #### Usage Notes:\n\t * \n\t * ```ts\n\t * \n\t * @Component({\n\t * \tselector: 'custom-message',\n\t * \ttemplate: `\n\t * \t\t<label for=\"message\">Message</label>\n\t * \t\t<textarea id=\"message\" [(value)]=\"message\" [disabled]=\"disabled\" (change)=\"onMessageChange($event.target.value)\"></textarea>\n\t * \t`,\n\t * \tformAssociated: true,\n\t * \t// formAssociated: CustomMessage,\n\t * })\n\t * export class CustomMessage implements ValueControl<string> {\n\t * \n\t * \tprivate message: string | null = '';\n\t * \tprivate disabled: boolean = false;\n\t * \tprivate _onChange: (_: any) => void = () => {};\n\t * \n\t * \twriteValue({ value, mode }: WriteValueOptions<string>) {\n\t * \t\tthis.message = mode !== 'reset' ? value : '';\n\t * \t}\n\t * \n\t * \tregisterOnChange(fn: (_: any) => void): void {\n\t * \t\tthis._onChange = fn;\n\t * \t}\n\t * \n\t * \tsetDisabledState(isDisabled: boolean) {\n\t * \t\tthis.disabled = isDisabled;\n\t * \t}\n\t * \n\t * \tonMessageChange(message: string) {\n\t * \t\tthis._onChange(message);\n\t * \t}\n\t * \t\n\t * }\n\t * \n\t * \n\t * export class CustomInputValueControl implements ValueControl<number> {\n\t * \n\t * \tprivate _value: number | null = null;\n\t * \tprivate _disabled: boolean = false;\n\t * \tprivate _onChange: (_: any) => void = () => {};\n\t * \n\t * \twriteValue({ value, mode }: WriteValueOptions<number>) {\n\t * \t\tthis._value = mode !== 'reset' ? value : null;\n\t * \t}\n\t * \n\t * \tregisterOnChange(fn: (_: any) => void): void {\n\t * \t\tthis._onChange = fn;\n\t * \t}\n\t * \n\t * \tsetDisabledState(isDisabled: boolean) {\n\t * \t\tthis._disabled = isDisabled;\n\t * \t}\n\t * \t\n\t * }\n\t * \n\t * @Component({\n\t * \tselector: 'custom-input',\n\t * \textend: 'input',\n\t * \tformAssociated: CustomInputValueControl,\n\t * })\n\t * export class CustomInputElement {\n\t * \t\n\t * @View()\n\t * \tview: HTMLInputElement;\n\t * \n\t * \tonInit() {\n\t * \t\tthis.view.type = 'number';\n\t * \t}\n\t * }\n\t * \n\t * ```\n\t */\n\tformAssociated?: boolean | Type<ValueControl<any>>;\n\n\t/**\n\t * - use `manual` for no zone.js patch effect applied,\n\t * and used for manual change detection for heavily process components.\n\t * \n\t * - use `proxy` zone for automatic detect changes without use of `zone.js`\n\t * \n\t * - use `aurora` for detection events like `rxjs` observables, `setTimeout`,\n\t * `setInterval` and `fetch` and `XMLHttpRequest`, etc...\n\t * make sure that `zone.js` is imported in the polyfills module. \n\t * \n\t * the default value is the platform zone type which can be changed by:\n\t * \n\t * ```js\n\t * bootstrapZone('manual')\n\t * bootstrapZone('proxy')\n\t * bootstrapZone('aurora')\n\t * ```\n\t * \n\t * if `bootstrapZone` never been called, then the default zone is a `manual`.\n\t */\n\tzone?: ZoneType;\n\n\t/**\n\t * The imports property specifies the component's template dependencies — those directives, components, and pipes that can be used within its template.\n\t */\n\timports?: (Type<any> | ReadonlyArray<any>)[];\n}\n\nexport interface ChildOptions {\n\t[key: string]: any;\n}\n\nexport interface ViewChildOpt {\n\tselector: string | typeof HTMLElement | CustomElementConstructor;\n\tchildOptions?: ChildOptions;\n}\n\nexport type OutputEventInit = Omit<EventInit, 'cancelable'>;\nexport type OutputOptions = { name?: string } & OutputEventInit;\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Context, ExpressionNode, Identifier, InfixExpressionNode, MemberExpression, NodeDeserializer, ScopeSubscription, Stack, VisitNodeType } from '@ibyar/expressions';
|
|
1
|
+
import { Context, DeclarationExpression, ExpressionNode, Identifier, InfixExpressionNode, MemberExpression, NodeDeserializer, ScopeSubscription, Stack, VisitNodeType } from '@ibyar/expressions';
|
|
2
2
|
type OneWayOperator = '=:';
|
|
3
3
|
type TwoWayOperator = '=::';
|
|
4
4
|
type BindingOperators = OneWayOperator | TwoWayOperator;
|
|
@@ -10,7 +10,7 @@ export declare class OneWayAssignmentExpression extends InfixExpressionNode<OneW
|
|
|
10
10
|
static visit(node: OneWayAssignmentExpression, visitNode: VisitNodeType): void;
|
|
11
11
|
protected left: MemberExpression;
|
|
12
12
|
private rightEvents;
|
|
13
|
-
constructor(left: MemberExpression, right: ExpressionNode);
|
|
13
|
+
constructor(left: MemberExpression | DeclarationExpression, right: ExpressionNode);
|
|
14
14
|
set(stack: Stack, value: any): any;
|
|
15
15
|
get(stack: Stack): any;
|
|
16
16
|
subscribe(stack: Stack, pipelineNames?: string[]): ScopeSubscription<Context>[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"binding.expressions.d.ts","sourceRoot":"","sources":["../../../src/core/binding/binding.expressions.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,OAAO,
|
|
1
|
+
{"version":3,"file":"binding.expressions.d.ts","sourceRoot":"","sources":["../../../src/core/binding/binding.expressions.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,OAAO,EAAE,qBAAqB,EACV,cAAc,EAClC,UAAU,EAAE,mBAAmB,EAAE,gBAAgB,EACjD,gBAAgB,EAAwB,iBAAiB,EACzD,KAAK,EAAwB,aAAa,EAE1C,MAAM,oBAAoB,CAAC;AAK5B,KAAK,cAAc,GAAG,IAAI,CAAC;AAC3B,KAAK,cAAc,GAAG,KAAK,CAAC;AAC5B,KAAK,gBAAgB,GAAG,cAAc,GAAG,cAAc,CAAC;AAExD,MAAM,WAAW,iBAAkB,SAAQ,mBAAmB,CAAC,gBAAgB,CAAC;I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\tContext, Deserializer, ExpressionEventMap, ExpressionNode,\n\tIdentifier, InfixExpressionNode, MemberExpression,\n\tNodeDeserializer, ReactiveScope, Scope, ScopeSubscription,\n\tStack, ValueChangedCallback, VisitNodeType,\n\tfindReactiveScopeByEventMap\n} from '@ibyar/expressions';\nimport { isOnDestroy } from '../component/lifecycle.js';\nimport { createDestroySubscription } from '../context/subscription.js';\nimport { AsyncPipeProvider, AsyncPipeScope, PipeProvider } from '../pipe/pipe.js';\n\ntype OneWayOperator = '=:';\ntype TwoWayOperator = '=::';\ntype BindingOperators = OneWayOperator | TwoWayOperator;\n\nexport interface BindingAssignment extends InfixExpressionNode<BindingOperators> {\n\tsubscribe(stack: Stack, pipelineNames?: string[]): ScopeSubscription<Context>[];\n}\n\n\n@Deserializer('OneWayAssignment')\nexport class OneWayAssignmentExpression extends InfixExpressionNode<OneWayOperator> implements BindingAssignment {\n\tstatic fromJSON(node: OneWayAssignmentExpression, deserializer: NodeDeserializer): OneWayAssignmentExpression {\n\t\treturn new OneWayAssignmentExpression(\n\t\t\tdeserializer(node.left) as MemberExpression,\n\t\t\tdeserializer(node.right)\n\t\t);\n\t}\n\tstatic visit(node: OneWayAssignmentExpression, visitNode: VisitNodeType): void {\n\t\tvisitNode(node.left);\n\t\tvisitNode(node.right);\n\t}\n\n\tdeclare protected left: MemberExpression;\n\tprivate rightEvents = this.right.events();\n\tconstructor(left: MemberExpression, right: ExpressionNode) {\n\t\tsuper('=:', left, right);\n\t}\n\tset(stack: Stack, value: any) {\n\t\treturn this.left.set(stack, value);\n\t}\n\tget(stack: Stack): any {\n\t\tconst rv = this.right.get(stack);\n\t\tthis.set(stack, rv);\n\t\treturn rv;\n\t}\n\tsubscribe(stack: Stack, pipelineNames?: string[]): ScopeSubscription<Context>[] {\n\t\tconst subscriptions: ScopeSubscription<Context>[] = [];\n\t\tif (pipelineNames?.length) {\n\t\t\tconst syncPipeScope = Scope.blockScope();\n\t\t\tconst asyncPipeScope = AsyncPipeScope.blockScope();\n\t\t\tlet hasAsync = false, hasSync = false;\n\t\t\tpipelineNames.forEach(pipelineName => {\n\t\t\t\tconst scope = stack.findScope(pipelineName);\n\t\t\t\tconst pipe = scope.get(pipelineName)!;\n\t\t\t\tif (scope instanceof AsyncPipeProvider) {\n\t\t\t\t\thasAsync = true;\n\t\t\t\t\tasyncPipeScope.set(pipelineName, pipe);\n\t\t\t\t\tif (isOnDestroy(pipe.prototype)) {\n\t\t\t\t\t\tsubscriptions.push(createDestroySubscription(() => asyncPipeScope.unsubscribe(pipelineName)));\n\t\t\t\t\t}\n\t\t\t\t} else if (scope instanceof PipeProvider) {\n\t\t\t\t\thasSync = true;\n\t\t\t\t\tsyncPipeScope.set(pipelineName, pipe);\n\t\t\t\t}\n\t\t\t});\n\t\t\thasSync && stack.pushScope(syncPipeScope);\n\t\t\thasAsync && stack.pushScope(asyncPipeScope);\n\t\t}\n\t\tconst tuples = findReactiveScopeByEventMap(this.rightEvents, stack);\n\t\tconst callback: ValueChangedCallback = () => this.get(stack);\n\t\ttuples.forEach(tuple => {\n\t\t\tconst subscription = tuple[1].subscribe(tuple[0], callback);\n\t\t\tsubscriptions.push(subscription);\n\t\t});\n\t\treturn subscriptions;\n\t}\n}\n\n\n/**\n * the default behavior is assign the right hand side to the left hand side.\n * \n * \n */\n@Deserializer('TwoWayAssignment')\nexport class TwoWayAssignmentExpression extends InfixExpressionNode<TwoWayOperator> implements BindingAssignment {\n\tstatic fromJSON(node: TwoWayAssignmentExpression, deserializer: NodeDeserializer): TwoWayAssignmentExpression {\n\t\treturn new TwoWayAssignmentExpression(\n\t\t\tdeserializer(node.left) as MemberExpression,\n\t\t\tdeserializer(node.right) as MemberExpression | Identifier\n\t\t);\n\t}\n\tstatic visit(node: TwoWayAssignmentExpression, visitNode: VisitNodeType): void {\n\t\tvisitNode(node.left);\n\t\tvisitNode(node.right);\n\t}\n\n\tdeclare protected left: MemberExpression;\n\tdeclare protected right: MemberExpression | Identifier;\n\n\tprivate rightEvents: ExpressionEventMap;\n\tprivate leftEvents: ExpressionEventMap;\n\tconstructor(left: MemberExpression, right: MemberExpression | Identifier) {\n\t\tsuper('=::', left, right);\n\t\tthis.rightEvents = this.right.events();\n\t\tthis.leftEvents = this.left.events();\n\t}\n\n\tset(stack: Stack, value: any) {\n\t\treturn this.setRTL(stack, value);\n\t}\n\tget(stack: Stack): any {\n\t\treturn this.getRTL(stack);\n\t}\n\n\tprivate setRTL(stack: Stack, value: any) {\n\t\treturn this.left.set(stack, value);\n\t}\n\tprivate getRTL(stack: Stack): any {\n\t\tconst rv = this.right.get(stack);\n\t\tthis.setRTL(stack, rv);\n\t\treturn rv;\n\t}\n\tprivate actionRTL(stack: Stack): ValueChangedCallback {\n\t\treturn () => this.getRTL(stack);\n\t}\n\n\tprivate setLTR(stack: Stack, value: any) {\n\t\treturn this.right.set(stack, value);\n\t}\n\tprivate getLTR(stack: Stack): any {\n\t\tconst lv = this.left.get(stack);\n\t\tthis.setLTR(stack, lv);\n\t\treturn lv;\n\t}\n\tprivate actionLTR(stack: Stack): ValueChangedCallback {\n\t\treturn () => this.getLTR(stack);\n\t}\n\n\tprivate subscribeToEvents(stack: Stack, tuples: [string, ReactiveScope<Context>][], actionCallback: ValueChangedCallback) {\n\t\tconst subscriptions: ScopeSubscription<Context>[] = [];\n\t\ttuples.forEach(tuple => {\n\t\t\tconst subscription = tuple[1].subscribe(tuple[0], actionCallback);\n\t\t\tsubscriptions.push(subscription);\n\t\t});\n\t\treturn subscriptions;\n\t}\n\n\tsubscribe(stack: Stack): ScopeSubscription<Context>[] {\n\n\t\t// right to left\n\t\tconst rightTuples = findReactiveScopeByEventMap(this.rightEvents, stack);\n\t\tconst rtlAction = this.actionRTL(stack);\n\t\tconst rtlSubscriptions = this.subscribeToEvents(stack, rightTuples, rtlAction);\n\n\t\t// left to right \n\t\tconst leftTuples = findReactiveScopeByEventMap(this.leftEvents, stack);\n\t\tconst ltrAction = this.actionLTR(stack);\n\t\tconst ltrSubscriptions = this.subscribeToEvents(stack, leftTuples, ltrAction);\n\n\t\treturn rtlSubscriptions.concat(ltrSubscriptions);\n\t}\n\n}\n"]}
|
|
1
|
+
{"version":3,"file":"binding.expressions.js","sourceRoot":"","sources":["../../../src/core/binding/binding.expressions.ts"],"names":[],"mappings":";AAAA,OAAO,EAC0B,YAAY,EAEhC,mBAAmB,EACE,KAAK,EAEtC,2BAA2B,EAC3B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;IAYrE,0BAA0B;4BADtC,YAAY,CAAC,kBAAkB,CAAC;;;;sBACe,mBAAmB;0CAA3B,SAAQ,WAAmC;;;;YAAnF,6KAwDC;;;YAxDY,uDAA0B;;QACtC,MAAM,CAAC,QAAQ,CAAC,IAAgC,EAAE,YAA8B;YAC/E,OAAO,IAAI,0BAA0B,CACpC,YAAY,CAAC,IAAI,CAAC,IAAI,CAA6C,EACnE,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CACxB,CAAC;QACH,CAAC;QACD,MAAM,CAAC,KAAK,CAAC,IAAgC,EAAE,SAAwB;YACtE,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACrB,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACvB,CAAC;QAGO,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;QAC1C,YAAY,IAA8C,EAAE,KAAqB;YAChF,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;QAC1B,CAAC;QACD,GAAG,CAAC,KAAY,EAAE,KAAU;YAC3B,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QACpC,CAAC;QACD,GAAG,CAAC,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C,EAAE,CAAC;YACvD,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;gBACtB,MAAM,YAAY,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC;gBAClE,aAAa,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YAClC,CAAC,CAAC,CAAC;YACH,OAAO,aAAa,CAAC;QACtB,CAAC;QAED,SAAS,CAAC,KAAY;YAErB,gBAAgB;YAChB,MAAM,WAAW,GAAG,2BAA2B,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;YACzE,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;YACxC,MAAM,gBAAgB,GAAG,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;YAE/E,iBAAiB;YACjB,MAAM,UAAU,GAAG,2BAA2B,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;YACvE,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;YACxC,MAAM,gBAAgB,GAAG,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;YAE9E,OAAO,gBAAgB,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;QAClD,CAAC;;;;SA5EW,0BAA0B","sourcesContent":["import {\n\tContext, DeclarationExpression, Deserializer,\n\tExpressionEventMap, ExpressionNode,\n\tIdentifier, InfixExpressionNode, MemberExpression,\n\tNodeDeserializer, ReactiveScope, Scope, ScopeSubscription,\n\tStack, ValueChangedCallback, VisitNodeType,\n\tfindReactiveScopeByEventMap\n} from '@ibyar/expressions';\nimport { isOnDestroy } from '../component/lifecycle.js';\nimport { createDestroySubscription } from '../context/subscription.js';\nimport { AsyncPipeProvider, AsyncPipeScope, PipeProvider } from '../pipe/pipe.js';\n\ntype OneWayOperator = '=:';\ntype TwoWayOperator = '=::';\ntype BindingOperators = OneWayOperator | TwoWayOperator;\n\nexport interface BindingAssignment extends InfixExpressionNode<BindingOperators> {\n\tsubscribe(stack: Stack, pipelineNames?: string[]): ScopeSubscription<Context>[];\n}\n\n\n@Deserializer('OneWayAssignment')\nexport class OneWayAssignmentExpression extends InfixExpressionNode<OneWayOperator> implements BindingAssignment {\n\tstatic fromJSON(node: OneWayAssignmentExpression, deserializer: NodeDeserializer): OneWayAssignmentExpression {\n\t\treturn new OneWayAssignmentExpression(\n\t\t\tdeserializer(node.left) as MemberExpression | DeclarationExpression,\n\t\t\tdeserializer(node.right)\n\t\t);\n\t}\n\tstatic visit(node: OneWayAssignmentExpression, visitNode: VisitNodeType): void {\n\t\tvisitNode(node.left);\n\t\tvisitNode(node.right);\n\t}\n\n\tdeclare protected left: MemberExpression;\n\tprivate rightEvents = this.right.events();\n\tconstructor(left: MemberExpression | DeclarationExpression, right: ExpressionNode) {\n\t\tsuper('=:', left, right);\n\t}\n\tset(stack: Stack, value: any) {\n\t\treturn this.left.set(stack, value);\n\t}\n\tget(stack: Stack): any {\n\t\tconst rv = this.right.get(stack);\n\t\tthis.set(stack, rv);\n\t\treturn rv;\n\t}\n\tsubscribe(stack: Stack, pipelineNames?: string[]): ScopeSubscription<Context>[] {\n\t\tconst subscriptions: ScopeSubscription<Context>[] = [];\n\t\tif (pipelineNames?.length) {\n\t\t\tconst syncPipeScope = Scope.blockScope();\n\t\t\tconst asyncPipeScope = AsyncPipeScope.blockScope();\n\t\t\tlet hasAsync = false, hasSync = false;\n\t\t\tpipelineNames.forEach(pipelineName => {\n\t\t\t\tconst scope = stack.findScope(pipelineName);\n\t\t\t\tconst pipe = scope.get(pipelineName)!;\n\t\t\t\tif (scope instanceof AsyncPipeProvider) {\n\t\t\t\t\thasAsync = true;\n\t\t\t\t\tasyncPipeScope.set(pipelineName, pipe);\n\t\t\t\t\tif (isOnDestroy(pipe.prototype)) {\n\t\t\t\t\t\tsubscriptions.push(createDestroySubscription(() => asyncPipeScope.unsubscribe(pipelineName)));\n\t\t\t\t\t}\n\t\t\t\t} else if (scope instanceof PipeProvider) {\n\t\t\t\t\thasSync = true;\n\t\t\t\t\tsyncPipeScope.set(pipelineName, pipe);\n\t\t\t\t}\n\t\t\t});\n\t\t\thasSync && stack.pushScope(syncPipeScope);\n\t\t\thasAsync && stack.pushScope(asyncPipeScope);\n\t\t}\n\t\tconst tuples = findReactiveScopeByEventMap(this.rightEvents, stack);\n\t\tconst callback: ValueChangedCallback = () => this.get(stack);\n\t\ttuples.forEach(tuple => {\n\t\t\tconst subscription = tuple[1].subscribe(tuple[0], callback);\n\t\t\tsubscriptions.push(subscription);\n\t\t});\n\t\treturn subscriptions;\n\t}\n}\n\n\n/**\n * the default behavior is assign the right hand side to the left hand side.\n * \n * \n */\n@Deserializer('TwoWayAssignment')\nexport class TwoWayAssignmentExpression extends InfixExpressionNode<TwoWayOperator> implements BindingAssignment {\n\tstatic fromJSON(node: TwoWayAssignmentExpression, deserializer: NodeDeserializer): TwoWayAssignmentExpression {\n\t\treturn new TwoWayAssignmentExpression(\n\t\t\tdeserializer(node.left) as MemberExpression,\n\t\t\tdeserializer(node.right) as MemberExpression | Identifier\n\t\t);\n\t}\n\tstatic visit(node: TwoWayAssignmentExpression, visitNode: VisitNodeType): void {\n\t\tvisitNode(node.left);\n\t\tvisitNode(node.right);\n\t}\n\n\tdeclare protected left: MemberExpression;\n\tdeclare protected right: MemberExpression | Identifier;\n\n\tprivate rightEvents: ExpressionEventMap;\n\tprivate leftEvents: ExpressionEventMap;\n\tconstructor(left: MemberExpression, right: MemberExpression | Identifier) {\n\t\tsuper('=::', left, right);\n\t\tthis.rightEvents = this.right.events();\n\t\tthis.leftEvents = this.left.events();\n\t}\n\n\tset(stack: Stack, value: any) {\n\t\treturn this.setRTL(stack, value);\n\t}\n\tget(stack: Stack): any {\n\t\treturn this.getRTL(stack);\n\t}\n\n\tprivate setRTL(stack: Stack, value: any) {\n\t\treturn this.left.set(stack, value);\n\t}\n\tprivate getRTL(stack: Stack): any {\n\t\tconst rv = this.right.get(stack);\n\t\tthis.setRTL(stack, rv);\n\t\treturn rv;\n\t}\n\tprivate actionRTL(stack: Stack): ValueChangedCallback {\n\t\treturn () => this.getRTL(stack);\n\t}\n\n\tprivate setLTR(stack: Stack, value: any) {\n\t\treturn this.right.set(stack, value);\n\t}\n\tprivate getLTR(stack: Stack): any {\n\t\tconst lv = this.left.get(stack);\n\t\tthis.setLTR(stack, lv);\n\t\treturn lv;\n\t}\n\tprivate actionLTR(stack: Stack): ValueChangedCallback {\n\t\treturn () => this.getLTR(stack);\n\t}\n\n\tprivate subscribeToEvents(stack: Stack, tuples: [string, ReactiveScope<Context>][], actionCallback: ValueChangedCallback) {\n\t\tconst subscriptions: ScopeSubscription<Context>[] = [];\n\t\ttuples.forEach(tuple => {\n\t\t\tconst subscription = tuple[1].subscribe(tuple[0], actionCallback);\n\t\t\tsubscriptions.push(subscription);\n\t\t});\n\t\treturn subscriptions;\n\t}\n\n\tsubscribe(stack: Stack): ScopeSubscription<Context>[] {\n\n\t\t// right to left\n\t\tconst rightTuples = findReactiveScopeByEventMap(this.rightEvents, stack);\n\t\tconst rtlAction = this.actionRTL(stack);\n\t\tconst rtlSubscriptions = this.subscribeToEvents(stack, rightTuples, rtlAction);\n\n\t\t// left to right \n\t\tconst leftTuples = findReactiveScopeByEventMap(this.leftEvents, stack);\n\t\tconst ltrAction = this.actionLTR(stack);\n\t\tconst ltrSubscriptions = this.subscribeToEvents(stack, leftTuples, ltrAction);\n\n\t\treturn rtlSubscriptions.concat(ltrSubscriptions);\n\t}\n\n}\n"]}
|
package/component/component.d.ts
CHANGED
|
@@ -1,26 +1,27 @@
|
|
|
1
1
|
import type { MetadataClass, MetadataContext } from '@ibyar/decorators';
|
|
2
|
-
import type {
|
|
2
|
+
import type { Type } from '../utils/typeof.js';
|
|
3
3
|
import type { ZoneType } from '../zone/bootstrap.js';
|
|
4
4
|
import { Tag, DomNode, DomRenderNode, DomElementNode } from '@ibyar/elements';
|
|
5
5
|
import { HTMLComponent, ValueControl } from './custom-element.js';
|
|
6
6
|
import { AttributeDirective, StructuralDirective } from '../directive/directive.js';
|
|
7
7
|
import { ComponentOptions, PipeOptions, InjectableOptions, DirectiveOptions } from '../annotation/options.js';
|
|
8
8
|
import { ChildRef, HostBindingRef, InputPropertyRef, ListenerRef, OutputPropertyRef, PropertyRef } from './reflect.js';
|
|
9
|
+
import { SignalRuntimeMetadata } from '../signals/runtime.js';
|
|
9
10
|
export interface InjectableRef<T> {
|
|
10
|
-
provideIn:
|
|
11
|
-
modelClass:
|
|
11
|
+
provideIn: Type<CustomElementConstructor> | 'root' | 'platform' | 'any';
|
|
12
|
+
modelClass: Type<T>;
|
|
12
13
|
name: string;
|
|
13
14
|
}
|
|
14
15
|
export interface PipeRef<T> {
|
|
15
16
|
name: string;
|
|
16
17
|
asynchronous?: boolean;
|
|
17
|
-
modelClass:
|
|
18
|
+
modelClass: Type<T>;
|
|
18
19
|
}
|
|
19
20
|
export interface DirectiveRef<T> {
|
|
20
21
|
selector: string;
|
|
21
22
|
exportAs?: string;
|
|
22
23
|
zone?: ZoneType;
|
|
23
|
-
modelClass:
|
|
24
|
+
modelClass: Type<StructuralDirective> | Type<AttributeDirective>;
|
|
24
25
|
inputs: PropertyRef[];
|
|
25
26
|
outputs: PropertyRef[];
|
|
26
27
|
view: string;
|
|
@@ -29,6 +30,7 @@ export interface DirectiveRef<T> {
|
|
|
29
30
|
hostListeners: ListenerRef[];
|
|
30
31
|
hostBindings: HostBindingRef[];
|
|
31
32
|
viewBindings?: DomElementNode;
|
|
33
|
+
signals: SignalRuntimeMetadata[];
|
|
32
34
|
}
|
|
33
35
|
export interface ComponentRef<T> {
|
|
34
36
|
selector: string;
|
|
@@ -38,7 +40,7 @@ export interface ComponentRef<T> {
|
|
|
38
40
|
extend: Tag;
|
|
39
41
|
extendCustomElement: boolean;
|
|
40
42
|
viewClass: MetadataClass<HTMLComponent<T>> & CustomElementConstructor;
|
|
41
|
-
modelClass:
|
|
43
|
+
modelClass: Type<T>;
|
|
42
44
|
inputs: InputPropertyRef[];
|
|
43
45
|
outputs: OutputPropertyRef[];
|
|
44
46
|
view: string;
|
|
@@ -51,19 +53,22 @@ export interface ComponentRef<T> {
|
|
|
51
53
|
encapsulation: 'custom' | 'shadow-dom' | 'template' | 'shadow-dom-template' | 'shadow-slot';
|
|
52
54
|
isShadowDom: boolean;
|
|
53
55
|
shadowRootInit: ShadowRootInit;
|
|
54
|
-
|
|
56
|
+
disabledFeatures?: ('internals' | 'shadow')[];
|
|
57
|
+
formAssociated: boolean | Type<ValueControl<any>>;
|
|
55
58
|
zone?: ZoneType;
|
|
59
|
+
signals: SignalRuntimeMetadata[];
|
|
56
60
|
}
|
|
57
61
|
export declare class Components {
|
|
58
62
|
private static EMPTY_LIST;
|
|
59
63
|
private static emptyList;
|
|
60
64
|
private static patchTemplate;
|
|
61
65
|
static defineDirective(modelClass: MetadataClass, opts: DirectiveOptions, metadata: MetadataContext): void;
|
|
62
|
-
static definePipe<T extends
|
|
63
|
-
static defineInjectable<T extends
|
|
64
|
-
static defineComponent<T extends
|
|
66
|
+
static definePipe<T extends Type<any>>(modelClass: MetadataClass<T>, opts: PipeOptions, metadata: MetadataContext): void;
|
|
67
|
+
static defineInjectable<T extends Type<any>>(modelClass: MetadataClass<T>, opts: InjectableOptions, metadata: MetadataContext): void;
|
|
68
|
+
static defineComponent<T extends Type<any>>(modelClass: MetadataClass<T>, opts: ComponentOptions<T>, metadata: MetadataContext): void;
|
|
65
69
|
static defineView<T extends HTMLElement>(viewClass: MetadataClass<T>, opt: {
|
|
66
70
|
selector: string;
|
|
67
71
|
} & ElementDefinitionOptions): void;
|
|
72
|
+
private static scanRuntimeSignals;
|
|
68
73
|
}
|
|
69
74
|
//# sourceMappingURL=component.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../src/core/component/component.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../src/core/component/component.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EACS,GAAG,EAClB,OAAO,EAAE,aAAa,EACH,cAAc,EAEjC,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAElE,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAGpF,OAAO,EACN,gBAAgB,EAAE,WAAW,EAC7B,iBAAiB,EAAE,gBAAgB,EACnC,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACN,QAAQ,EAAE,cAAc,EAAE,gBAAgB,EAC1C,WAAW,EAAE,iBAAiB,EAAE,WAAW,EAE3C,MAAM,cAAc,CAAC;AAItB,OAAO,EAAwB,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAGpF,MAAM,WAAW,aAAa,CAAC,CAAC;IAC/B,SAAS,EAAE,IAAI,CAAC,wBAAwB,CAAC,GAAG,MAAM,GAAG,UAAU,GAAG,KAAK,CAAC;IACxE,UAAU,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,OAAO,CAAC,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,UAAU,EAAE,IAAI,CAAC,CAAC,C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W,EAAE,SAAS,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,GAAG,wBAAwB;IAU1H,OAAO,CAAC,MAAM,CAAC,kBAAkB;CA6BjC"}
|
package/component/component.js
CHANGED
|
@@ -2,9 +2,11 @@ import { findByTagName, htmlParser, templateParser, canAttachShadow, directiveRe
|
|
|
2
2
|
import { classRegistryProvider } from '../providers/provider.js';
|
|
3
3
|
import { initCustomElementView } from '../view/view.js';
|
|
4
4
|
import { buildExpressionNodes } from '../html/expression.js';
|
|
5
|
+
import { ReflectComponents } from './reflect.js';
|
|
5
6
|
import { deserializeExpressionNodes } from '../html/deserialize.js';
|
|
6
7
|
import { parseHostNode } from '../html/host.js';
|
|
7
8
|
import { provide } from '../di/inject.js';
|
|
9
|
+
import { RuntimeClassMetadata } from '../signals/runtime.js';
|
|
8
10
|
const DEFAULT_SHADOW_ROOT_INIT = { mode: 'open', delegatesFocus: false, slotAssignment: 'named' };
|
|
9
11
|
export class Components {
|
|
10
12
|
static EMPTY_LIST = Object.freeze([]);
|
|
@@ -23,6 +25,10 @@ export class Components {
|
|
|
23
25
|
}
|
|
24
26
|
}
|
|
25
27
|
static defineDirective(modelClass, opts, metadata) {
|
|
28
|
+
if (!opts.signals) {
|
|
29
|
+
opts.signals = RuntimeClassMetadata.scanMetadata(modelClass);
|
|
30
|
+
}
|
|
31
|
+
this.scanRuntimeSignals(modelClass, opts, metadata);
|
|
26
32
|
Object.assign(metadata, opts);
|
|
27
33
|
if (metadata.hostListeners?.length || metadata.hostBindings?.length) {
|
|
28
34
|
const hostNode = parseHostNode({
|
|
@@ -34,10 +40,18 @@ export class Components {
|
|
|
34
40
|
}
|
|
35
41
|
metadata.modelClass = modelClass;
|
|
36
42
|
classRegistryProvider.registerDirective(modelClass);
|
|
43
|
+
const successors = [];
|
|
44
|
+
if (metadata.successor) {
|
|
45
|
+
successors.push(metadata.successor.trim());
|
|
46
|
+
}
|
|
47
|
+
if (Array.isArray(metadata.successors)) {
|
|
48
|
+
successors.push(...metadata.successors.map(s => s.trim()));
|
|
49
|
+
}
|
|
50
|
+
metadata.successors = successors;
|
|
37
51
|
directiveRegistry.register(opts.selector, {
|
|
38
52
|
inputs: metadata.inputs?.map(input => input.viewAttribute),
|
|
39
53
|
outputs: metadata.outputs?.map(output => output.viewAttribute),
|
|
40
|
-
|
|
54
|
+
successors: successors,
|
|
41
55
|
});
|
|
42
56
|
}
|
|
43
57
|
static definePipe(modelClass, opts, metadata) {
|
|
@@ -53,6 +67,10 @@ export class Components {
|
|
|
53
67
|
provide(modelClass);
|
|
54
68
|
}
|
|
55
69
|
static defineComponent(modelClass, opts, metadata) {
|
|
70
|
+
if (!opts.signals) {
|
|
71
|
+
opts.signals = RuntimeClassMetadata.scanMetadata(modelClass);
|
|
72
|
+
}
|
|
73
|
+
this.scanRuntimeSignals(modelClass, opts, metadata);
|
|
56
74
|
const componentRef = Object.assign(metadata, opts);
|
|
57
75
|
componentRef.extend = findByTagName(opts.extend);
|
|
58
76
|
componentRef.extendCustomElement = !!opts.extend && isValidCustomElementName(opts.extend);
|
|
@@ -143,5 +161,32 @@ export class Components {
|
|
|
143
161
|
const { selector, ...definition } = opt;
|
|
144
162
|
customElements.define(selector, viewClass, definition);
|
|
145
163
|
}
|
|
164
|
+
static scanRuntimeSignals(modelClass, opts, metadata) {
|
|
165
|
+
if (!opts.signals) {
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
const signals = opts.signals;
|
|
169
|
+
signals.filter(item => item.signal === 'input')
|
|
170
|
+
.flatMap(item => item.options)
|
|
171
|
+
.forEach(option => ReflectComponents.addInput(metadata, option.name, option.alias));
|
|
172
|
+
signals.filter(item => item.signal === 'formValue')
|
|
173
|
+
.flatMap(item => item.options)
|
|
174
|
+
.forEach(option => ReflectComponents.addInput(metadata, option.name, 'view'));
|
|
175
|
+
signals.filter(item => item.signal === 'output')
|
|
176
|
+
.flatMap(item => item.options)
|
|
177
|
+
.forEach(option => ReflectComponents.addOutput(metadata, option.name, option.alias, {}));
|
|
178
|
+
signals.filter(item => item.signal === 'model')
|
|
179
|
+
.flatMap(item => item.options)
|
|
180
|
+
.forEach(option => {
|
|
181
|
+
ReflectComponents.addInput(metadata, option.name, option.alias);
|
|
182
|
+
ReflectComponents.addOutput(metadata, option.name, option.alias, {});
|
|
183
|
+
});
|
|
184
|
+
signals.filter(item => item.signal === 'view')
|
|
185
|
+
.flatMap(item => item.options)
|
|
186
|
+
.forEach(option => ReflectComponents.setComponentView(metadata, option.name));
|
|
187
|
+
signals.filter(item => item.signal === 'viewChild')
|
|
188
|
+
.flatMap(item => item.options)
|
|
189
|
+
.forEach(option => ReflectComponents.addViewChild(metadata, option.name, 'ɵSignal', {}));
|
|
190
|
+
}
|
|
146
191
|
}
|
|
147
192
|
//# sourceMappingURL=component.js.map
|