@ibyar/core 2.5.0 → 3.1.1

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.
Files changed (87) hide show
  1. package/annotation/decorators.d.ts +2 -30
  2. package/annotation/decorators.d.ts.map +1 -1
  3. package/annotation/decorators.js +2 -89
  4. package/annotation/decorators.js.map +1 -1
  5. package/annotation/options.d.ts +12 -6
  6. package/annotation/options.d.ts.map +1 -1
  7. package/annotation/options.js.map +1 -1
  8. package/binding/binding.expressions copy.d.ts +43 -0
  9. package/binding/binding.expressions copy.d.ts.map +1 -0
  10. package/binding/binding.expressions copy.js +161 -0
  11. package/binding/binding.expressions copy.js.map +1 -0
  12. package/binding/signal.expressions.d.ts +50 -0
  13. package/binding/signal.expressions.d.ts.map +1 -0
  14. package/binding/signal.expressions.js +182 -0
  15. package/binding/signal.expressions.js.map +1 -0
  16. package/component/component.d.ts +1 -1
  17. package/component/component.d.ts.map +1 -1
  18. package/component/component.js +5 -8
  19. package/component/component.js.map +1 -1
  20. package/component/custom-element.d.ts +4 -15
  21. package/component/custom-element.d.ts.map +1 -1
  22. package/component/custom-element.js +1 -2
  23. package/component/custom-element.js.map +1 -1
  24. package/component/initializer.d.ts +39 -27
  25. package/component/initializer.d.ts.map +1 -1
  26. package/component/initializer.js +47 -29
  27. package/component/initializer.js.map +1 -1
  28. package/component/reflect.d.ts.map +1 -1
  29. package/component/reflect.js +8 -2
  30. package/component/reflect.js.map +1 -1
  31. package/di/provider.d.ts +1 -0
  32. package/di/provider.d.ts.map +1 -1
  33. package/di/provider.js +11 -0
  34. package/di/provider.js.map +1 -1
  35. package/directive/directive.d.ts +21 -12
  36. package/directive/directive.d.ts.map +1 -1
  37. package/directive/directive.js +76 -27
  38. package/directive/directive.js.map +1 -1
  39. package/html/deserialize.d.ts.map +1 -1
  40. package/html/deserialize.js +7 -0
  41. package/html/deserialize.js.map +1 -1
  42. package/html/expression.d.ts.map +1 -1
  43. package/html/expression.js +41 -8
  44. package/html/expression.js.map +1 -1
  45. package/linker/change-detector-ref.d.ts +3 -3
  46. package/linker/change-detector-ref.js.map +1 -1
  47. package/linker/template-ref.js +3 -3
  48. package/linker/template-ref.js.map +1 -1
  49. package/linker/view-container-ref.d.ts.map +1 -1
  50. package/linker/view-container-ref.js +4 -4
  51. package/linker/view-container-ref.js.map +1 -1
  52. package/linker/view-ref.d.ts +2 -2
  53. package/linker/view-ref.js.map +1 -1
  54. package/package.json +7 -7
  55. package/pipe/pipe.d.ts +2 -2
  56. package/pipe/pipe.js +2 -2
  57. package/pipe/pipe.js.map +1 -1
  58. package/signals/factory.d.ts +3 -7
  59. package/signals/factory.d.ts.map +1 -1
  60. package/signals/factory.js +6 -12
  61. package/signals/factory.js.map +1 -1
  62. package/signals/runtime.d.ts +6 -6
  63. package/signals/runtime.d.ts.map +1 -1
  64. package/signals/runtime.js +29 -18
  65. package/signals/runtime.js.map +1 -1
  66. package/signals/scopes.d.ts +4 -0
  67. package/signals/scopes.d.ts.map +1 -0
  68. package/signals/scopes.js +4 -0
  69. package/signals/scopes.js.map +1 -0
  70. package/signals/signals.d.ts +2 -7
  71. package/signals/signals.d.ts.map +1 -1
  72. package/signals/signals.js +0 -9
  73. package/signals/signals.js.map +1 -1
  74. package/utils/elements-util.d.ts +0 -1
  75. package/utils/elements-util.d.ts.map +1 -1
  76. package/utils/elements-util.js +0 -9
  77. package/utils/elements-util.js.map +1 -1
  78. package/view/base-view.d.ts.map +1 -1
  79. package/view/base-view.js +38 -84
  80. package/view/base-view.js.map +1 -1
  81. package/view/render.d.ts +5 -3
  82. package/view/render.d.ts.map +1 -1
  83. package/view/render.js +64 -30
  84. package/view/render.js.map +1 -1
  85. package/view/view.d.ts.map +1 -1
  86. package/view/view.js +3 -16
  87. package/view/view.js.map +1 -1
@@ -1,34 +1,5 @@
1
1
  import type { Type } from '../utils/typeof.js';
2
- import { ChildOptions, ComponentOptions, DirectiveOptions, OutputEventInit, OutputOptions, PipeOptions, InjectableOptions } from './options.js';
3
- type PropertyValue<T> = T | ((value: T) => void) | undefined;
4
- /**
5
- * @deprecated since v2.4.0, use `input` function instead.
6
- */
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
- */
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
- */
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
- */
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
- */
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
- */
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
- */
31
- export declare function ViewChildren<This, Value>(selector: string | typeof HTMLElement | CustomElementConstructor): (value: PropertyValue<Value>, context: ClassFieldDecoratorContext<This, Value> | ClassSetterDecoratorContext<This, Value>) => void;
2
+ import { ComponentOptions, DirectiveOptions, PipeOptions, InjectableOptions, ModuleOptions } from './options.js';
32
3
  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;
33
4
  type ValueGetter<T> = T | (() => T) | undefined;
34
5
  export declare function HostBinding<This, Value>(hostPropertyName: string): (value: ValueGetter<Value>, context: ClassFieldDecoratorContext<This, Value> | ClassMethodDecoratorContext<This, any> | ClassGetterDecoratorContext<This, Value>) => void;
@@ -51,5 +22,6 @@ export declare const Component: (param: ComponentOptions<Type<any>> | ComponentO
51
22
  export declare const customElement: (param: {
52
23
  selector: string;
53
24
  } & ElementDefinitionOptions) => (constructor: any, context: ClassDecoratorContext<new (...args: any) => any>) => any;
25
+ export declare const Module: (param: ModuleOptions) => (constructor: any, context: ClassDecoratorContext<new (...args: any) => any>) => any;
54
26
  export {};
55
27
  //# sourceMappingURL=decorators.d.ts.map
@@ -1 +1 @@
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,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;AAE7D;;GAEG;AAEH,wBAAgB,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,MAAM,sIAY/C;AAGD;;GAEG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,KAAK,wIAYpC;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,0BAA0B,CAAC,IAAI,EAAE,KAAK,CAAC,KAAK,IAAI,CAAC;AAE3I;;GAEG;AACH,wBAAgB,M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CAAC"}
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,gBAAgB,EAAE,gBAAgB,EAClC,WAAW,EAAE,iBAAiB,EAC9B,aAAa,EACb,MAAM,cAAc,CAAC;AAGtB,wBAAgB,YAAY,CAAC,IAAI,EAAE,KAAK,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,+GAe9H;AAGD,KAAK,WAAW,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,SAAS,CAAC;AAEhD,wBAAgB,WAAW,CAAC,IAAI,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,6KAYhE;AAED;;GAEG;AACH,eAAO,MAAM,IAAI,iFA3Bb,GAAF,0BA+BD,CAAC;AAGF;;GAEG;AACH,eAAO,MAAM,SAAS,sFArClB,GAAF,0BAyCD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,UAAU,uFA9CnB,GAAF,0BAkDD,CAAC;AAmBF;;GAEG;AACH,eAAO,MAAM,SAAS,iIAxElB,GAAF,0BAkFD,CAAC;AAEF,eAAO,MAAM,aAAa;cAAkC,MAAM;wFApF9D,GAAF,0BAwFD,CAAC;AAEF,eAAO,MAAM,MAAM,mFA1Ff,GAAF,0BA8FD,CAAC"}
@@ -2,95 +2,6 @@ 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
- */
8
- export function Input(name) {
9
- return makeClassMemberDecorator((value, context, metadata) => {
10
- if (!name && typeof context.name !== 'string') {
11
- throw new TypeError(`type ${typeof context.name} of '${context.name.toString()}' is not supported`);
12
- }
13
- if (context.private) {
14
- throw new SyntaxError(`private members '${context.name.toString()}' is not supported.`);
15
- }
16
- ReflectComponents.addInput(metadata, context.name, name || context.name);
17
- });
18
- }
19
- /**
20
- * @deprecated since v2.4.0, use `formValue` function instead.
21
- */
22
- export function FormValue() {
23
- return makeClassMemberDecorator((value, context, metadata) => {
24
- if (typeof context.name !== 'string') {
25
- throw new TypeError(`type ${typeof context.name} of '${context.name.toString()}' is not supported`);
26
- }
27
- if (context.private) {
28
- throw new SyntaxError(`private members '${context.name.toString()}' is not supported.`);
29
- }
30
- ReflectComponents.addInput(metadata, context.name, 'value');
31
- });
32
- }
33
- /**
34
- * @deprecated since v2.4.0, use `output` function instead.
35
- */
36
- export function Output(name, options) {
37
- const eventType = typeof name === 'object' ? name.name : name;
38
- const eventOpts = typeof name === 'object' ? name : options;
39
- return makeClassMemberDecorator((value, context, metadata) => {
40
- if (typeof context.name !== 'string') {
41
- throw new TypeError(`type ${typeof context.name} of '${context.name.toString()}' is not supported`);
42
- }
43
- if (context.private) {
44
- throw new SyntaxError(`private members '${context.name.toString()}' is not supported.`);
45
- }
46
- ReflectComponents.addOutput(metadata, context.name, eventType || context.name, {
47
- bubbles: eventOpts?.bubbles ?? false,
48
- composed: eventOpts?.composed ?? false
49
- });
50
- });
51
- }
52
- /**
53
- * @deprecated since v2.4.0, use `view` function instead.
54
- */
55
- export function View() {
56
- return makeClassMemberDecorator((value, context, metadata) => {
57
- if (typeof context.name !== 'string') {
58
- throw new TypeError(`type ${typeof context.name} of '${context.name.toString()}' is not supported`);
59
- }
60
- if (context.private) {
61
- throw new SyntaxError(`private members '${context.name.toString()}' is not supported.`);
62
- }
63
- ReflectComponents.setComponentView(metadata, context.name);
64
- });
65
- }
66
- /**
67
- * @deprecated since v2.4.0, use `viewChild` function instead.
68
- */
69
- export function ViewChild(selector, childOptions) {
70
- return makeClassMemberDecorator((value, context, metadata) => {
71
- if (typeof context.name !== 'string') {
72
- throw new TypeError(`type ${typeof context.name} of '${context.name.toString()}' is not supported`);
73
- }
74
- if (context.private) {
75
- throw new SyntaxError(`private members '${context.name.toString()}' is not supported.`);
76
- }
77
- ReflectComponents.addViewChild(metadata, context.name, selector, childOptions);
78
- });
79
- }
80
- /**
81
- * @deprecated since v2.4.0, use `viewChildren` function instead.
82
- */
83
- export function ViewChildren(selector) {
84
- return makeClassMemberDecorator((value, context, metadata) => {
85
- if (typeof context.name !== 'string') {
86
- throw new TypeError(`type ${typeof context.name} of '${context.name.toString()}' is not supported`);
87
- }
88
- if (context.private) {
89
- throw new SyntaxError(`private members '${context.name.toString()}' is not supported.`);
90
- }
91
- ReflectComponents.addViewChildren(metadata, context.name, selector);
92
- });
93
- }
94
5
  export function HostListener(eventName, args) {
95
6
  return makeClassMemberDecorator((value, context, metadata) => {
96
7
  if (typeof context.name !== 'string') {
@@ -162,4 +73,6 @@ export const Component = makeClassDecorator((opt, constructor, context, metadata
162
73
  export const customElement = makeClassDecorator((opt, constructor, context) => {
163
74
  Components.defineView(constructor, opt);
164
75
  });
76
+ export const Module = makeClassDecorator((opt, constructor, context) => {
77
+ });
165
78
  //# sourceMappingURL=decorators.js.map
@@ -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;;GAEG;AAEH,MAAM,UAAU,KAAK,CAAc,IAAa;IAC/C,OAAO,wBAAwB,CAC9B,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,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,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"]}
1
+ {"version":3,"file":"decorators.js","sourceRoot":"","sources":["../../../src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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;AAEF,MAAM,CAAC,MAAM,MAAM,GAAG,kBAAkB,CACvC,CAAC,GAAG,EAAE,WAAW,EAAE,OAAO,EAAE,EAAE;AAE9B,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\tComponentOptions, DirectiveOptions,\n\tPipeOptions, InjectableOptions,\n\tModuleOptions\n} from './options.js';\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\nexport const Module = makeClassDecorator<ModuleOptions>(\n\t(opt, constructor, context) => {\n\n\t}\n);\n"]}
@@ -125,10 +125,10 @@ export interface ComponentOptions<T = Type<any>> {
125
125
  * the browser itself, will convert all attributes to lowercase
126
126
  *
127
127
  * ```typescript
128
- * @Input('personage') personAge: number;
129
- * @Input('propname') propName: string;
130
- * @Output('savebuttonclick') saveButtonClick = new EventEmitter<Persons>();
131
- * @View('personform') personForm: HTMLFormElement;
128
+ * personAge = input<number>(20, {alias: 'personage'});
129
+ * propName = input<string>(undefined, {alias: 'propname'});
130
+ * saveButtonClick = output<Persons>({alias: 'savebuttonclick'});
131
+ * readonly view = view(HTMLFormElement);
132
132
  * ```
133
133
  *
134
134
  * any app root element as
@@ -255,8 +255,7 @@ export interface ComponentOptions<T = Type<any>> {
255
255
  * })
256
256
  * export class CustomInputElement {
257
257
  *
258
- * @View()
259
- * view: HTMLInputElement;
258
+ * view = view<HTMLInputElement>();
260
259
  *
261
260
  * onInit() {
262
261
  * this.view.type = 'number';
@@ -269,6 +268,7 @@ export interface ComponentOptions<T = Type<any>> {
269
268
  /**
270
269
  * - use `manual` for no zone.js patch effect applied,
271
270
  * and used for manual change detection for heavily process components.
271
+ * `better to use with signals`.
272
272
  *
273
273
  * - use `proxy` zone for automatic detect changes without use of `zone.js`
274
274
  *
@@ -303,4 +303,10 @@ export type OutputEventInit = Omit<EventInit, 'cancelable'>;
303
303
  export type OutputOptions = {
304
304
  name?: string;
305
305
  } & OutputEventInit;
306
+ export interface ModuleOptions {
307
+ /**
308
+ * The imports property specifies the component's template dependencies — those directives, components, and pipes that can be used within its template.
309
+ */
310
+ imports?: (Type<any> | ReadonlyArray<any>)[];
311
+ }
306
312
  //# sourceMappingURL=options.d.ts.map
@@ -1 +1 @@
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;;;;;;;;;;;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AE,CAAC;IAE9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAkFG;IACH,cAAc,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC;IAEnD;;;;;;;;;;;;;;;;;;;;OAoBG;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;AAGhE,MAAM,WAAW,aAAa;IAC7B;;GAEE;IACF,OAAO,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;CAE7C"}
@@ -1 +1 @@
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
+ {"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\tpersonAge = input<number>(20, {alias: 'personage'});\n\t * \t\tpropName = input<string>(undefined, {alias: 'propname'});\n\t *\t\tsaveButtonClick = output<Persons>({alias: 'savebuttonclick'});\n\t *\t\treadonly view = view(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 * \tview = view<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 * `better to use with signals`.\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\n\nexport interface ModuleOptions {\n\t/**\n * The imports property specifies the component's template dependencies — those directives, components, and pipes that can be used within its template.\n */\n\timports?: (Type<any> | ReadonlyArray<any>)[];\n\n}\n"]}
@@ -0,0 +1,43 @@
1
+ import { Context, DeclarationExpression, ExpressionNode, Identifier, InfixExpressionNode, MemberExpression, NodeDeserializer, ScopeSubscription, Stack, VisitNodeType } from '@ibyar/expressions';
2
+ type OneWayOperator = '=:';
3
+ type TwoWayOperator = '=::';
4
+ type BindingOperators = OneWayOperator | TwoWayOperator;
5
+ export interface BindingAssignment extends InfixExpressionNode<BindingOperators> {
6
+ subscribe(stack: Stack, pipelineNames?: string[]): ScopeSubscription<Context>[];
7
+ }
8
+ export declare class OneWayAssignmentExpression extends InfixExpressionNode<OneWayOperator> implements BindingAssignment {
9
+ static fromJSON(node: OneWayAssignmentExpression, deserializer: NodeDeserializer): OneWayAssignmentExpression;
10
+ static visit(node: OneWayAssignmentExpression, visitNode: VisitNodeType): void;
11
+ protected left: MemberExpression;
12
+ private rightEvents;
13
+ constructor(left: MemberExpression | DeclarationExpression, right: ExpressionNode);
14
+ set(stack: Stack, value: any): any;
15
+ get(stack: Stack): any;
16
+ subscribe(stack: Stack, pipelineNames?: string[]): ScopeSubscription<Context>[];
17
+ }
18
+ /**
19
+ * the default behavior is assign the right hand side to the left hand side.
20
+ *
21
+ *
22
+ */
23
+ export declare class TwoWayAssignmentExpression extends InfixExpressionNode<TwoWayOperator> implements BindingAssignment {
24
+ static fromJSON(node: TwoWayAssignmentExpression, deserializer: NodeDeserializer): TwoWayAssignmentExpression;
25
+ static visit(node: TwoWayAssignmentExpression, visitNode: VisitNodeType): void;
26
+ protected left: MemberExpression;
27
+ protected right: MemberExpression | Identifier;
28
+ private rightEvents;
29
+ private leftEvents;
30
+ constructor(left: MemberExpression, right: MemberExpression | Identifier);
31
+ set(stack: Stack, value: any): any;
32
+ get(stack: Stack): any;
33
+ private setRTL;
34
+ private getRTL;
35
+ private actionRTL;
36
+ private setLTR;
37
+ private getLTR;
38
+ private actionLTR;
39
+ private subscribeToEvents;
40
+ subscribe(stack: Stack): ScopeSubscription<Context>[];
41
+ }
42
+ export {};
43
+ //# sourceMappingURL=binding.expressions%20copy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"binding.expressions copy.d.ts","sourceRoot":"","sources":["../../../src/core/binding/binding.expressions copy.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;IAC/E,SAAS,CAAC,KAAK,EAAE,KAAK,EAAE,aAAa,CAAC,EAAE,MAAM,EAAE,GAAG,iBAAiB,CAAC,OAAO,CAAC,EAAE,CAAC;CAChF;AAGD,qBACa,0BAA2B,SAAQ,mBAAmB,CAAC,cAAc,CAAE,YAAW,iBAAiB;IAC/G,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,0BAA0B,EAAE,YAAY,EAAE,gBAAgB,GAAG,0BAA0B;IAM7G,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,0BAA0B,EAAE,SAAS,EAAE,aAAa,GAAG,IAAI;IAK9E,UAAkB,IAAI,EAAE,gBAAgB,CAAC;IACzC,OAAO,CAAC,WAAW,CAA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Node, Scope, findReactiveScopeByEventMap } from '@ibyar/expressions';
3
+ import { isOnDestroy } from '../component/lifecycle.js';
4
+ import { createDestroySubscription } from '../context/subscription.js';
5
+ import { AsyncPipeProvider, AsyncPipeScope, PipeProvider } from '../pipe/pipe.js';
6
+ let OneWayAssignmentExpression = (() => {
7
+ let _classDecorators = [Deserializer('OneWayAssignment')];
8
+ let _classDescriptor;
9
+ let _classExtraInitializers = [];
10
+ let _classThis;
11
+ let _classSuper = InfixExpressionNode;
12
+ var OneWayAssignmentExpression = class extends _classSuper {
13
+ static { _classThis = this; }
14
+ static {
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);
17
+ OneWayAssignmentExpression = _classThis = _classDescriptor.value;
18
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
19
+ __runInitializers(_classThis, _classExtraInitializers);
20
+ }
21
+ static fromJSON(node, deserializer) {
22
+ return new OneWayAssignmentExpression(deserializer(node.left), deserializer(node.right));
23
+ }
24
+ static visit(node, visitNode) {
25
+ visitNode(node.left);
26
+ visitNode(node.right);
27
+ }
28
+ rightEvents = this.right.events();
29
+ constructor(left, right) {
30
+ super('=:', left, right);
31
+ }
32
+ set(stack, value) {
33
+ return this.left.set(stack, value);
34
+ }
35
+ get(stack) {
36
+ const rv = this.right.get(stack);
37
+ this.set(stack, rv);
38
+ return rv;
39
+ }
40
+ subscribe(stack, pipelineNames) {
41
+ const subscriptions = [];
42
+ if (pipelineNames?.length) {
43
+ const syncPipeScope = Scope.blockScope();
44
+ const asyncPipeScope = AsyncPipeScope.blockScope();
45
+ let hasAsync = false, hasSync = false;
46
+ pipelineNames.forEach(pipelineName => {
47
+ const scope = stack.findScope(pipelineName);
48
+ const pipe = scope.get(pipelineName);
49
+ if (scope instanceof AsyncPipeProvider) {
50
+ hasAsync = true;
51
+ asyncPipeScope.set(pipelineName, pipe);
52
+ if (isOnDestroy(pipe.prototype)) {
53
+ subscriptions.push(createDestroySubscription(() => asyncPipeScope.unsubscribe(pipelineName)));
54
+ }
55
+ }
56
+ else if (scope instanceof PipeProvider) {
57
+ hasSync = true;
58
+ syncPipeScope.set(pipelineName, pipe);
59
+ }
60
+ });
61
+ hasSync && stack.pushScope(syncPipeScope);
62
+ hasAsync && stack.pushScope(asyncPipeScope);
63
+ }
64
+ const tuples = findReactiveScopeByEventMap(this.rightEvents, stack);
65
+ const callback = () => this.get(stack);
66
+ tuples.forEach(tuple => {
67
+ const subscription = tuple[1].subscribe(tuple[0], callback);
68
+ subscriptions.push(subscription);
69
+ });
70
+ return subscriptions;
71
+ }
72
+ };
73
+ return OneWayAssignmentExpression = _classThis;
74
+ })();
75
+ export { OneWayAssignmentExpression };
76
+ /**
77
+ * the default behavior is assign the right hand side to the left hand side.
78
+ *
79
+ *
80
+ */
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; }
89
+ static {
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);
95
+ }
96
+ static fromJSON(node, deserializer) {
97
+ return new TwoWayAssignmentExpression(deserializer(node.left), deserializer(node.right));
98
+ }
99
+ static visit(node, visitNode) {
100
+ visitNode(node.left);
101
+ visitNode(node.right);
102
+ }
103
+ rightEvents;
104
+ leftEvents;
105
+ constructor(left, right) {
106
+ super('=::', left, right);
107
+ this.rightEvents = this.right.events();
108
+ this.leftEvents = this.left.events();
109
+ }
110
+ set(stack, value) {
111
+ return this.setRTL(stack, value);
112
+ }
113
+ get(stack) {
114
+ return this.getRTL(stack);
115
+ }
116
+ setRTL(stack, value) {
117
+ return this.left.set(stack, value);
118
+ }
119
+ getRTL(stack) {
120
+ const rv = this.right.get(stack);
121
+ this.setRTL(stack, rv);
122
+ return rv;
123
+ }
124
+ actionRTL(stack) {
125
+ return () => this.getRTL(stack);
126
+ }
127
+ setLTR(stack, value) {
128
+ return this.right.set(stack, value);
129
+ }
130
+ getLTR(stack) {
131
+ const lv = this.left.get(stack);
132
+ this.setLTR(stack, lv);
133
+ return lv;
134
+ }
135
+ actionLTR(stack) {
136
+ return () => this.getLTR(stack);
137
+ }
138
+ subscribeToEvents(stack, tuples, actionCallback) {
139
+ const subscriptions = [];
140
+ tuples.forEach(tuple => {
141
+ const subscription = tuple[1].subscribe(tuple[0], actionCallback);
142
+ subscriptions.push(subscription);
143
+ });
144
+ return subscriptions;
145
+ }
146
+ subscribe(stack) {
147
+ // right to left
148
+ const rightTuples = findReactiveScopeByEventMap(this.rightEvents, stack);
149
+ const rtlAction = this.actionRTL(stack);
150
+ const rtlSubscriptions = this.subscribeToEvents(stack, rightTuples, rtlAction);
151
+ // left to right
152
+ const leftTuples = findReactiveScopeByEventMap(this.leftEvents, stack);
153
+ const ltrAction = this.actionLTR(stack);
154
+ const ltrSubscriptions = this.subscribeToEvents(stack, leftTuples, ltrAction);
155
+ return rtlSubscriptions.concat(ltrSubscriptions);
156
+ }
157
+ };
158
+ return TwoWayAssignmentExpression = _classThis;
159
+ })();
160
+ export { TwoWayAssignmentExpression };
161
+ //# sourceMappingURL=binding.expressions%20copy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"binding.expressions copy.js","sourceRoot":"","sources":["../../../src/core/binding/binding.expressions copy.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,KAAY;YACf,MAAM,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YACjC,IA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K,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"]}
@@ -0,0 +1,50 @@
1
+ import { CallExpression, Context, ExpressionNode, InfixExpressionNode, NodeDeserializer, ScopeSubscription, Stack, VisitNodeType } from '@ibyar/expressions';
2
+ type SignalOneWayOperator = '=:$';
3
+ type SignalTwoWayOperator = '=::$';
4
+ type SignalBindingOperators = SignalOneWayOperator | SignalTwoWayOperator;
5
+ export interface SignalBindingAssignment extends InfixExpressionNode<SignalBindingOperators> {
6
+ subscribe(stack: Stack, pipelineNames?: string[]): ScopeSubscription<Context>[];
7
+ }
8
+ /**
9
+ * this.input.set(model.property |> pipe);
10
+ * left = this.input.set(value);
11
+ * right = model.property |> pipe;
12
+ */
13
+ export declare class SignalOneWayAssignmentExpression extends InfixExpressionNode<SignalOneWayOperator> implements SignalBindingAssignment {
14
+ static fromJSON(node: SignalOneWayAssignmentExpression, deserializer: NodeDeserializer): SignalOneWayAssignmentExpression;
15
+ static visit(node: SignalOneWayAssignmentExpression, visitNode: VisitNodeType): void;
16
+ protected left: CallExpression;
17
+ private rightEvents;
18
+ constructor(left: CallExpression, right: ExpressionNode);
19
+ set(stack: Stack, value: any): any;
20
+ get(stack: Stack): any;
21
+ subscribe(stack: Stack, pipelineNames?: string[]): ScopeSubscription<Context>[];
22
+ }
23
+ /**
24
+ * `the default behavior is assign the right hand side to the left hand side.`
25
+ *
26
+ * this.input.set(model.property.get());
27
+ * model.property.set(this.input.get());
28
+ */
29
+ export declare class SignalTwoWayAssignmentExpression extends InfixExpressionNode<SignalTwoWayOperator> implements SignalBindingAssignment {
30
+ static fromJSON(node: SignalTwoWayAssignmentExpression, deserializer: NodeDeserializer): SignalTwoWayAssignmentExpression;
31
+ static visit(node: SignalTwoWayAssignmentExpression, visitNode: VisitNodeType): void;
32
+ protected left: CallExpression;
33
+ protected right: CallExpression;
34
+ private rightEvents;
35
+ private leftEvents;
36
+ constructor(left: CallExpression, right: CallExpression);
37
+ set(stack: Stack, value: any): any;
38
+ get(stack: Stack): any;
39
+ private setRTL;
40
+ private getRTL;
41
+ private actionRTL;
42
+ private setLTR;
43
+ private getLTR;
44
+ private actionLTR;
45
+ private bindSignal;
46
+ private subscribeToEvents;
47
+ subscribe(stack: Stack): ScopeSubscription<Context>[];
48
+ }
49
+ export {};
50
+ //# sourceMappingURL=signal.expressions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signal.expressions.d.ts","sourceRoot":"","sources":["../../../src/core/binding/signal.expressions.ts"],"names":[],"mappings":"A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