@ibyar/core 1.0.0 → 1.2.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.js +23 -23
- package/annotation/decorators.js.map +1 -1
- package/annotation/options.d.ts +26 -1
- package/annotation/options.d.ts.map +1 -1
- package/annotation/options.js.map +1 -1
- package/binding/binding.expressions.d.ts +1 -1
- package/binding/binding.expressions.d.ts.map +1 -1
- package/binding/binding.expressions.js +30 -18
- package/binding/binding.expressions.js.map +1 -1
- package/component/component.d.ts +2 -0
- package/component/component.d.ts.map +1 -1
- package/component/component.js +5 -4
- package/component/component.js.map +1 -1
- package/component/custom-element.d.ts +2 -4
- 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/reflect.d.ts +2 -2
- package/component/reflect.d.ts.map +1 -1
- package/component/reflect.js +2 -1
- package/component/reflect.js.map +1 -1
- package/context/subscription.d.ts +1 -1
- package/context/subscription.d.ts.map +1 -1
- package/context/subscription.js +1 -1
- package/context/subscription.js.map +1 -1
- package/directive/parser.js.map +1 -1
- package/directive/providers.js.map +1 -1
- package/html/deserialize.js.map +1 -1
- package/html/expression.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/linker/template-ref.js.map +1 -1
- package/linker/view-container-ref.d.ts.map +1 -1
- package/linker/view-container-ref.js +2 -1
- package/linker/view-container-ref.js.map +1 -1
- package/linker/view-ref.js.map +1 -1
- package/package.json +8 -8
- package/pipe/pipe.js.map +1 -1
- package/providers/provider.d.ts +1 -1
- package/providers/provider.d.ts.map +1 -1
- package/providers/provider.js +9 -8
- package/providers/provider.js.map +1 -1
- package/scope/scope.d.ts +29 -0
- package/scope/scope.d.ts.map +1 -0
- package/scope/scope.js +82 -0
- package/scope/scope.js.map +1 -0
- package/scope/signals.d.ts +15 -0
- package/scope/signals.d.ts.map +1 -0
- package/scope/signals.js +49 -0
- package/scope/signals.js.map +1 -0
- package/scope/stream.d.ts +1 -0
- package/scope/stream.d.ts.map +1 -0
- package/scope/stream.js +8 -0
- package/scope/stream.js.map +1 -0
- package/scope/variables.d.ts +19 -0
- package/scope/variables.d.ts.map +1 -0
- package/scope/variables.js +38 -0
- package/scope/variables.js.map +1 -0
- package/scope/web-scope.d.ts +4 -0
- package/scope/web-scope.d.ts.map +1 -0
- package/scope/web-scope.js +2 -0
- package/scope/web-scope.js.map +1 -0
- package/signals/signals.d.ts +14 -0
- package/signals/signals.d.ts.map +1 -0
- package/signals/signals.js +56 -0
- package/signals/signals.js.map +1 -0
- package/utils/elements-util.js.map +1 -1
- package/utils/path.js.map +1 -1
- package/view/base-view.d.ts.map +1 -1
- package/view/base-view.js +18 -15
- package/view/base-view.js.map +1 -1
- package/view/form-view.js.map +1 -1
- package/view/mutation.js +1 -2
- package/view/mutation.js.map +1 -1
- package/view/render.d.ts +2 -0
- package/view/render.d.ts.map +1 -1
- package/view/render.js +35 -13
- package/view/render.js.map +1 -1
- package/view/utils.js.map +1 -1
- package/view/view.d.ts.map +1 -1
- package/view/view.js +19 -8
- package/view/view.js.map +1 -1
- package/zone/bootstrap.js.map +1 -1
- package/zone/proxy.js.map +1 -1
- package/zone/task.js.map +1 -1
- package/zone/zone.js.map +1 -1
- package/annotation/context.d.ts +0 -41
- package/annotation/context.d.ts.map +0 -1
- package/annotation/context.js +0 -79
- package/annotation/context.js.map +0 -1
- package/render/host-binding.handler.d.ts +0 -46
- package/render/host-binding.handler.js +0 -60
- package/render/host-binding.handler.js.map +0 -1
- package/render/host-listener.handler.d.ts +0 -50
- package/render/host-listener.handler.js +0 -88
- package/render/host-listener.handler.js.map +0 -1
- package/render/render-handler.d.ts +0 -11
- package/render/render-handler.js +0 -2
- package/render/render-handler.js.map +0 -1
package/annotation/decorators.js
CHANGED
|
@@ -3,101 +3,101 @@ import { Components } from '../component/component.js';
|
|
|
3
3
|
import { ReflectComponents } from '../component/reflect.js';
|
|
4
4
|
import { fetchHtml } from '../utils/path.js';
|
|
5
5
|
export function Input(name) {
|
|
6
|
-
return makeClassMemberDecorator((value, context) => {
|
|
6
|
+
return makeClassMemberDecorator((value, context, metadata) => {
|
|
7
7
|
if (!name && typeof context.name !== 'string') {
|
|
8
8
|
throw new TypeError(`type ${typeof context.name} of '${context.name.toString()}' is not supported`);
|
|
9
9
|
}
|
|
10
10
|
if (context.private) {
|
|
11
11
|
throw new SyntaxError(`private members '${context.name.toString()}' is not supported.`);
|
|
12
12
|
}
|
|
13
|
-
ReflectComponents.addInput(
|
|
13
|
+
ReflectComponents.addInput(metadata, context.name, name || context.name);
|
|
14
14
|
});
|
|
15
15
|
}
|
|
16
16
|
export function FormValue() {
|
|
17
|
-
return makeClassMemberDecorator((value, context) => {
|
|
17
|
+
return makeClassMemberDecorator((value, context, metadata) => {
|
|
18
18
|
if (typeof context.name !== 'string') {
|
|
19
19
|
throw new TypeError(`type ${typeof context.name} of '${context.name.toString()}' is not supported`);
|
|
20
20
|
}
|
|
21
21
|
if (context.private) {
|
|
22
22
|
throw new SyntaxError(`private members '${context.name.toString()}' is not supported.`);
|
|
23
23
|
}
|
|
24
|
-
ReflectComponents.addInput(
|
|
24
|
+
ReflectComponents.addInput(metadata, context.name, 'value');
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
27
|
export function Output(name, options) {
|
|
28
28
|
const eventType = typeof name === 'object' ? name.name : name;
|
|
29
29
|
const eventOpts = typeof name === 'object' ? name : options;
|
|
30
|
-
return makeClassMemberDecorator((value, context) => {
|
|
30
|
+
return makeClassMemberDecorator((value, context, metadata) => {
|
|
31
31
|
if (typeof context.name !== 'string') {
|
|
32
32
|
throw new TypeError(`type ${typeof context.name} of '${context.name.toString()}' is not supported`);
|
|
33
33
|
}
|
|
34
34
|
if (context.private) {
|
|
35
35
|
throw new SyntaxError(`private members '${context.name.toString()}' is not supported.`);
|
|
36
36
|
}
|
|
37
|
-
ReflectComponents.addOutput(
|
|
37
|
+
ReflectComponents.addOutput(metadata, context.name, eventType || context.name, {
|
|
38
38
|
bubbles: eventOpts?.bubbles ?? false,
|
|
39
39
|
composed: eventOpts?.composed ?? false
|
|
40
40
|
});
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
43
|
export function View() {
|
|
44
|
-
return makeClassMemberDecorator((value, context) => {
|
|
44
|
+
return makeClassMemberDecorator((value, context, metadata) => {
|
|
45
45
|
if (typeof context.name !== 'string') {
|
|
46
46
|
throw new TypeError(`type ${typeof context.name} of '${context.name.toString()}' is not supported`);
|
|
47
47
|
}
|
|
48
48
|
if (context.private) {
|
|
49
49
|
throw new SyntaxError(`private members '${context.name.toString()}' is not supported.`);
|
|
50
50
|
}
|
|
51
|
-
ReflectComponents.setComponentView(
|
|
51
|
+
ReflectComponents.setComponentView(metadata, context.name);
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
54
|
export function ViewChild(selector, childOptions) {
|
|
55
|
-
return makeClassMemberDecorator((value, context) => {
|
|
55
|
+
return makeClassMemberDecorator((value, context, metadata) => {
|
|
56
56
|
if (typeof context.name !== 'string') {
|
|
57
57
|
throw new TypeError(`type ${typeof context.name} of '${context.name.toString()}' is not supported`);
|
|
58
58
|
}
|
|
59
59
|
if (context.private) {
|
|
60
60
|
throw new SyntaxError(`private members '${context.name.toString()}' is not supported.`);
|
|
61
61
|
}
|
|
62
|
-
ReflectComponents.addViewChild(
|
|
62
|
+
ReflectComponents.addViewChild(metadata, context.name, selector, childOptions);
|
|
63
63
|
});
|
|
64
64
|
}
|
|
65
65
|
export function ViewChildren(selector) {
|
|
66
|
-
return makeClassMemberDecorator((value, context) => {
|
|
66
|
+
return makeClassMemberDecorator((value, context, metadata) => {
|
|
67
67
|
if (typeof context.name !== 'string') {
|
|
68
68
|
throw new TypeError(`type ${typeof context.name} of '${context.name.toString()}' is not supported`);
|
|
69
69
|
}
|
|
70
70
|
if (context.private) {
|
|
71
71
|
throw new SyntaxError(`private members '${context.name.toString()}' is not supported.`);
|
|
72
72
|
}
|
|
73
|
-
ReflectComponents.addViewChildren(
|
|
73
|
+
ReflectComponents.addViewChildren(metadata, context.name, selector);
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
76
|
export function HostListener(eventName, args) {
|
|
77
|
-
return makeClassMemberDecorator((value, context) => {
|
|
77
|
+
return makeClassMemberDecorator((value, context, metadata) => {
|
|
78
78
|
if (typeof context.name !== 'string') {
|
|
79
79
|
throw new TypeError(`type ${typeof context.name} of '${context.name.toString()}' is not supported`);
|
|
80
80
|
}
|
|
81
81
|
args = typeof args === 'string' ? [args] : args;
|
|
82
|
-
ReflectComponents.addHostListener(
|
|
82
|
+
ReflectComponents.addHostListener(metadata, context.name, eventName, args || []);
|
|
83
83
|
});
|
|
84
84
|
}
|
|
85
85
|
export function HostBinding(hostPropertyName) {
|
|
86
|
-
return makeClassMemberDecorator((value, context) => {
|
|
86
|
+
return makeClassMemberDecorator((value, context, metadata) => {
|
|
87
87
|
if (typeof context.name !== 'string') {
|
|
88
88
|
throw new TypeError(`type ${typeof context.name} of '${context.name.toString()}' is not supported`);
|
|
89
89
|
}
|
|
90
90
|
if (context.private) {
|
|
91
91
|
throw new SyntaxError(`private members '${context.name.toString()}' is not supported.`);
|
|
92
92
|
}
|
|
93
|
-
ReflectComponents.addHostBinding(
|
|
93
|
+
ReflectComponents.addHostBinding(metadata, context.name, hostPropertyName);
|
|
94
94
|
});
|
|
95
95
|
}
|
|
96
|
-
export const Pipe = makeClassDecorator((opt, constructor, context) => {
|
|
97
|
-
Components.definePipe(constructor, opt,
|
|
96
|
+
export const Pipe = makeClassDecorator((opt, constructor, context, metadata) => {
|
|
97
|
+
Components.definePipe(constructor, opt, metadata);
|
|
98
98
|
});
|
|
99
|
-
export const Directive = makeClassDecorator((opt, constructor, context) => {
|
|
100
|
-
Components.defineDirective(constructor, opt,
|
|
99
|
+
export const Directive = makeClassDecorator((opt, constructor, context, metadata) => {
|
|
100
|
+
Components.defineDirective(constructor, opt, metadata);
|
|
101
101
|
});
|
|
102
102
|
function generateComponent(target, opt, metadata) {
|
|
103
103
|
if (opt.templateUrl) {
|
|
@@ -116,14 +116,14 @@ function generateComponent(target, opt, metadata) {
|
|
|
116
116
|
Components.defineComponent(target, opt, metadata);
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
|
-
export const Component = makeClassDecorator((opt, constructor, context) => {
|
|
119
|
+
export const Component = makeClassDecorator((opt, constructor, context, metadata) => {
|
|
120
120
|
if (Array.isArray(opt)) {
|
|
121
121
|
for (const comp of opt) {
|
|
122
|
-
generateComponent(constructor, comp,
|
|
122
|
+
generateComponent(constructor, comp, metadata);
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
else if (typeof opt === 'object') {
|
|
126
|
-
generateComponent(constructor, opt,
|
|
126
|
+
generateComponent(constructor, opt, metadata);
|
|
127
127
|
}
|
|
128
128
|
});
|
|
129
129
|
export const customElement = makeClassDecorator((opt, constructor, context) => {
|
|
@@ -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,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAW7C,MAAM,UAAU,KAAK,CAAc,IAAa;IAC/C,OAAO,wBAAwB,CAC9B,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;QAClB,IAAI,CAAC,IAAI,IAAI,OAAO,OAAO,CAAC,IAAI,KAAK,QAAQ,EAAE;YAC9C,MAAM,IAAI,SAAS,CAAC,QAAQ,OAAO,OAAO,CAAC,IAAI,QAAQ,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,oBAAoB,CAAC,CAAC;SACpG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U,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, ServiceOptions\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) => {\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(context.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) => {\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(context.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) => {\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\tcontext.metadata,\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) => {\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(context.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) => {\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(context.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) => {\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(context.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) => {\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\tcontext.metadata,\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) => {\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(context.metadata, context.name, hostPropertyName);\n\t\t}\n\t);\n}\n\nexport const Pipe = makeClassDecorator<PipeOptions>(\n\t(opt, constructor, context) => {\n\t\tComponents.definePipe(constructor as any, opt, context.metadata);\n\t}\n);\n\n\nexport const Directive = makeClassDecorator<DirectiveOptions>(\n\t(opt, constructor, context) => {\n\t\tComponents.defineDirective(constructor as any, opt, context.metadata);\n\t}\n);\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\nexport const Component = makeClassDecorator<ComponentOptions | ComponentOptions[]>(\n\t(opt, constructor, context) => {\n\t\tif (Array.isArray(opt)) {\n\t\t\tfor (const comp of opt) {\n\t\t\t\tgenerateComponent(constructor as any, comp, context.metadata);\n\t\t\t}\n\t\t} else if (typeof opt === 'object') {\n\t\t\tgenerateComponent(constructor as any, opt, context.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,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,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,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, ServiceOptions\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\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\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\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\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"]}
|
package/annotation/options.d.ts
CHANGED
|
@@ -11,6 +11,30 @@ export interface DirectiveOptions {
|
|
|
11
11
|
* and an attributes directive should not.
|
|
12
12
|
*/
|
|
13
13
|
selector: string;
|
|
14
|
+
/**
|
|
15
|
+
* export this directive to the HTML template scope,
|
|
16
|
+
*
|
|
17
|
+
* it can be accessed by the template reference name
|
|
18
|
+
* ex:
|
|
19
|
+
* ```ts
|
|
20
|
+
*
|
|
21
|
+
*
|
|
22
|
+
*
|
|
23
|
+
* Directive({
|
|
24
|
+
* selector: '*tooltip',
|
|
25
|
+
* exportAs: 'tooltip'
|
|
26
|
+
* })
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* in your component
|
|
30
|
+
*
|
|
31
|
+
* ```html
|
|
32
|
+
* <a tooltip="I'm a tooltip!!" #tooltip="tooltip">I'm a link</a>
|
|
33
|
+
* <button (click)="tooltip.toggleTooltip()">Toggle tooltip</button>
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
*/
|
|
37
|
+
exportAs?: string;
|
|
14
38
|
/**
|
|
15
39
|
* - use `manual` for no zone.js patch effect applied,
|
|
16
40
|
* and used for manual change detection for heavily process components.
|
|
@@ -82,8 +106,9 @@ export interface ComponentOptions<T = Class> {
|
|
|
82
106
|
/**
|
|
83
107
|
* what basic element should the new component inherit from,
|
|
84
108
|
* the tag name to inherit from as 'a', 'div', 'table', 'td', 'th', 'tr', etc ...
|
|
109
|
+
* also, support extends a custom element tag name.
|
|
85
110
|
*/
|
|
86
|
-
extend?: keyof HTMLElementTagNameMap
|
|
111
|
+
extend?: keyof HTMLElementTagNameMap | `${string}-${string}`;
|
|
87
112
|
/**
|
|
88
113
|
* An encapsulation policy for the template and CSS styles. One of:
|
|
89
114
|
* 'custom': Use global CSS without any encapsulation.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../../src/core/annotation/options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAG9D,MAAM,WAAW,gBAAgB;IAEhC;;;;;OAKG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;;;;;;;;;;;;;OAcG;IACH,IAAI,CAAC,EAAE,QAAQ,CAAC;CAChB;AAED,MAAM,WAAW,cAAc;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC,wBAAwB,CAAC,GAAG,MAAM,GAAG,UAAU,GAAG,KAAK,CAAC;CAC3E;AAED,MAAM,WAAW,WAAW;IAC3B,IAAI,EAAE,MAAM,CAA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AM,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 { DomNode } from '@ibyar/elements';\nimport { TemplateUrl } from '../utils/path.js';\nimport { ZoneType } from '../zone/bootstrap.js';\nimport { 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 * - 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\nexport interface ServiceOptions {\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: typeof 'string' ==> html string,\n\t * \t\t\t TypeOf 'DomRootRenderNode<T>' ==> JSX, create factory\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 * 2 possible way to write a template, as inline string, represent a a valid html, \n\t * or us aurora jsx factory \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 */\n\textend?: keyof HTMLElementTagNameMap;\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 { Class, TypeOf } from '../utils/typeof.js';\nimport { DomNode } from '@ibyar/elements';\nimport { TemplateUrl } from '../utils/path.js';\nimport { ZoneType } from '../zone/bootstrap.js';\nimport { 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\nexport interface ServiceOptions {\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: typeof 'string' ==> html string,\n\t * \t\t\t TypeOf 'DomRootRenderNode<T>' ==> JSX, create factory\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 * 2 possible way to write a template, as inline string, represent a a valid html, \n\t * or us aurora jsx factory \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,4 +1,4 @@
|
|
|
1
|
-
import { ExpressionNode,
|
|
1
|
+
import { Context, 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;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"binding.expressions.d.ts","sourceRoot":"","sources":["../../../src/core/binding/binding.expressions.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,cAAc,EAAE,mBAAmB,EAAE,
|
|
1
|
+
{"version":3,"file":"binding.expressions.d.ts","sourceRoot":"","sources":["../../../src/core/binding/binding.expressions.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,OAAO,EAAoC,cAAc,EACzD,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,g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IAMxE,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG;IAG5B,GAAG,CAAC,KAAK,EAAE,KAAK,GAAG,GAAG;IAItB,OAAO,CAAC,MAAM;IAGd,OAAO,CAAC,MAAM;IAKd,OAAO,CAAC,SAAS;IAIjB,OAAO,CAAC,MAAM;IAGd,OAAO,CAAC,MAAM;IAKd,OAAO,CAAC,SAAS;IAIjB,OAAO,CAAC,iBAAiB;IASzB,SAAS,CAAC,KAAK,EAAE,KAAK,GAAG,iBAAiB,CAAC,OAAO,CAAC,EAAE;CAerD"}
|
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
import { __esDecorate, __runInitializers } from "tslib";
|
|
2
|
-
import {
|
|
3
|
-
import { createSubscriptionDestroyer } from '../context/subscription.js';
|
|
2
|
+
import { Deserializer, InfixExpressionNode, Scope, findReactiveScopeByEventMap } from '@ibyar/expressions';
|
|
4
3
|
import { isOnDestroy } from '../component/lifecycle.js';
|
|
4
|
+
import { createDestroySubscription } from '../context/subscription.js';
|
|
5
5
|
import { AsyncPipeProvider, AsyncPipeScope, PipeProvider } from '../pipe/pipe.js';
|
|
6
|
-
|
|
6
|
+
let OneWayAssignmentExpression = (() => {
|
|
7
7
|
let _classDecorators = [Deserializer('OneWayAssignment')];
|
|
8
8
|
let _classDescriptor;
|
|
9
9
|
let _classExtraInitializers = [];
|
|
10
10
|
let _classThis;
|
|
11
|
-
|
|
11
|
+
let _classSuper = InfixExpressionNode;
|
|
12
|
+
var OneWayAssignmentExpression = class extends _classSuper {
|
|
13
|
+
static { _classThis = this; }
|
|
12
14
|
static {
|
|
13
|
-
|
|
15
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
16
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
14
17
|
OneWayAssignmentExpression = _classThis = _classDescriptor.value;
|
|
18
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
15
19
|
__runInitializers(_classThis, _classExtraInitializers);
|
|
16
20
|
}
|
|
17
21
|
static fromJSON(node, deserializer) {
|
|
@@ -46,7 +50,7 @@ export let OneWayAssignmentExpression = (() => {
|
|
|
46
50
|
hasAsync = true;
|
|
47
51
|
asyncPipeScope.set(pipelineName, pipe);
|
|
48
52
|
if (isOnDestroy(pipe.prototype)) {
|
|
49
|
-
subscriptions.push(
|
|
53
|
+
subscriptions.push(createDestroySubscription(() => asyncPipeScope.unsubscribe(pipelineName)));
|
|
50
54
|
}
|
|
51
55
|
}
|
|
52
56
|
else if (scope instanceof PipeProvider) {
|
|
@@ -68,21 +72,26 @@ export let OneWayAssignmentExpression = (() => {
|
|
|
68
72
|
};
|
|
69
73
|
return OneWayAssignmentExpression = _classThis;
|
|
70
74
|
})();
|
|
75
|
+
export { OneWayAssignmentExpression };
|
|
71
76
|
/**
|
|
72
77
|
* the default behavior is assign the right hand side to the left hand side.
|
|
73
78
|
*
|
|
74
79
|
*
|
|
75
80
|
*/
|
|
76
|
-
|
|
77
|
-
let
|
|
78
|
-
let
|
|
79
|
-
let
|
|
80
|
-
let
|
|
81
|
-
|
|
81
|
+
let TwoWayAssignmentExpression = (() => {
|
|
82
|
+
let _classDecorators = [Deserializer('TwoWayAssignment')];
|
|
83
|
+
let _classDescriptor;
|
|
84
|
+
let _classExtraInitializers = [];
|
|
85
|
+
let _classThis;
|
|
86
|
+
let _classSuper = InfixExpressionNode;
|
|
87
|
+
var TwoWayAssignmentExpression = class extends _classSuper {
|
|
88
|
+
static { _classThis = this; }
|
|
82
89
|
static {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
90
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
91
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
92
|
+
TwoWayAssignmentExpression = _classThis = _classDescriptor.value;
|
|
93
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
94
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
86
95
|
}
|
|
87
96
|
static fromJSON(node, deserializer) {
|
|
88
97
|
return new TwoWayAssignmentExpression(deserializer(node.left), deserializer(node.right));
|
|
@@ -91,10 +100,12 @@ export let TwoWayAssignmentExpression = (() => {
|
|
|
91
100
|
visitNode(node.left);
|
|
92
101
|
visitNode(node.right);
|
|
93
102
|
}
|
|
94
|
-
rightEvents
|
|
95
|
-
leftEvents
|
|
103
|
+
rightEvents;
|
|
104
|
+
leftEvents;
|
|
96
105
|
constructor(left, right) {
|
|
97
106
|
super('=::', left, right);
|
|
107
|
+
this.rightEvents = this.right.events();
|
|
108
|
+
this.leftEvents = this.left.events();
|
|
98
109
|
}
|
|
99
110
|
set(stack, value) {
|
|
100
111
|
return this.setRTL(stack, value);
|
|
@@ -144,6 +155,7 @@ export let TwoWayAssignmentExpression = (() => {
|
|
|
144
155
|
return rtlSubscriptions.concat(ltrSubscriptions);
|
|
145
156
|
}
|
|
146
157
|
};
|
|
147
|
-
return TwoWayAssignmentExpression =
|
|
158
|
+
return TwoWayAssignmentExpression = _classThis;
|
|
148
159
|
})();
|
|
160
|
+
export { TwoWayAssignmentExpression };
|
|
149
161
|
//# sourceMappingURL=binding.expressions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"binding.expressions.js","sourceRoot":"","sources":["../../../src/core/binding/binding.expressions.ts"],"names":[],"mappings":";AAAA,OAAO,EACU,mBAAmB,EAC5B,2BAA2B,EACH,KAAK,EACN,YAAY,EAE1C,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AACz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AAC,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;;WA1EW,0BAA0B","sourcesContent":["import {\n\tExpressionNode, InfixExpressionNode, ScopeSubscription,\n\tStack, findReactiveScopeByEventMap, ReactiveScope,\n\tContext, ValueChangedCallback, Scope,\n\tMemberExpression, Identifier, Deserializer,\n\tVisitNodeType, NodeDeserializer\n} from '@ibyar/expressions';\nimport { createSubscriptionDestroyer } from '../context/subscription.js';\nimport { isOnDestroy } from '../component/lifecycle.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(createSubscriptionDestroyer(() => 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 = this.right.events();\n\tprivate leftEvents = this.left.events();\n\tconstructor(left: MemberExpression, right: MemberExpression | Identifier) {\n\t\tsuper('=::', left, right);\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,EACG,YAAY,EACT,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,CAAqB,EAC3C,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CACxB,CAAC;QACH,CAAC;QACD,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AAiB,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, 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"]}
|
package/component/component.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ export interface PipeRef<T> {
|
|
|
18
18
|
}
|
|
19
19
|
export interface DirectiveRef<T> {
|
|
20
20
|
selector: string;
|
|
21
|
+
exportAs?: string;
|
|
21
22
|
zone?: ZoneType;
|
|
22
23
|
modelClass: TypeOf<StructuralDirective> | TypeOf<AttributeDirective>;
|
|
23
24
|
inputs: PropertyRef[];
|
|
@@ -35,6 +36,7 @@ export interface ComponentRef<T> {
|
|
|
35
36
|
compiledTemplate?: DomNode;
|
|
36
37
|
styles: string;
|
|
37
38
|
extend: Tag;
|
|
39
|
+
extendCustomElement: boolean;
|
|
38
40
|
viewClass: MetadataClass<HTMLComponent<T>> & CustomElementConstructor;
|
|
39
41
|
modelClass: TypeOf<T>;
|
|
40
42
|
inputs: InputPropertyRef[];
|
|
@@ -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,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EACS,GAAG,EAClB,OAAO,EAAE,aAAa,EACH,cAAc,
|
|
1
|
+
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../src/core/component/component.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,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AAU;IAEtB,OAAO,CAAC,MAAM,CAAC,UAAU,CAA0B;IACnD,OAAO,CAAC,MAAM,CAAC,SAAS;IAIxB,OAAO,CAAC,MAAM,CAAC,aAAa;IAY5B,OAAO,CAAC,MAAM,CAAC,aAAa;IAM5B,OAAO,CAAC,MAAM,CAAC,aAAa;IAwD5B,MAAM,CAAC,eAAe,CAAC,UAAU,EAAE,aAAa,EAAE,IAAI,EAAE,gBAAgB,EAAE,QAAQ,EAAE,eAAe;IAkBnG,MAAM,CAAC,UAAU,CAAC,CAAC,SAAS,KAAK,EAAE,UAAU,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,eAAe;IAM7G,MAAM,CAAC,aAAa,CAAC,CAAC,SAAS,KAAK,EAAE,UAAU,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,QAAQ,EAAE,eAAe;IAOnH,MAAM,CAAC,eAAe,CAAC,CAAC,SAAS,KAAK,EAAE,UAAU,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,gBAAgB,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,eAAe;IAoG1H,MAAM,CAAC,UAAU,CAAC,CAAC,SAAS,WAAW,EAAE,SAAS,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,GAAG,wBAAwB;CAU1H"}
|
package/component/component.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { findByTagName, htmlParser, templateParser, canAttachShadow, directiveRegistry, DomElementNode, DomFragmentNode, DomParentNode } from '@ibyar/elements';
|
|
1
|
+
import { findByTagName, htmlParser, templateParser, canAttachShadow, directiveRegistry, DomElementNode, DomFragmentNode, DomParentNode, isValidCustomElementName } from '@ibyar/elements';
|
|
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
5
|
import { ListenerRef } from './reflect.js';
|
|
6
6
|
import { deserializeExpressionNodes } from '../html/deserialize.js';
|
|
7
7
|
const DEFAULT_SHADOW_ROOT_INIT = { mode: 'open', delegatesFocus: false, slotAssignment: 'named' };
|
|
8
|
-
class Components {
|
|
8
|
+
export class Components {
|
|
9
9
|
static EMPTY_LIST = Object.freeze([]);
|
|
10
10
|
static emptyList() {
|
|
11
11
|
return Components.EMPTY_LIST;
|
|
@@ -106,6 +106,7 @@ class Components {
|
|
|
106
106
|
static defineComponent(modelClass, opts, metadata) {
|
|
107
107
|
const componentRef = Object.assign(metadata, opts);
|
|
108
108
|
componentRef.extend = findByTagName(opts.extend);
|
|
109
|
+
componentRef.extendCustomElement = !!opts.extend && isValidCustomElementName(opts.extend);
|
|
109
110
|
if (typeof componentRef.template === 'string') {
|
|
110
111
|
if (componentRef.styles) {
|
|
111
112
|
const template = `<style>${componentRef.styles}</style>${componentRef.template}`;
|
|
@@ -190,8 +191,8 @@ class Components {
|
|
|
190
191
|
}
|
|
191
192
|
static defineView(viewClass, opt) {
|
|
192
193
|
ClassRegistryProvider.registerView(viewClass);
|
|
193
|
-
|
|
194
|
+
const { selector, ...definition } = opt;
|
|
195
|
+
customElements.define(selector, viewClass, definition);
|
|
194
196
|
}
|
|
195
197
|
}
|
|
196
|
-
export { Components };
|
|
197
198
|
//# sourceMappingURL=component.js.map
|