@ibyar/core 0.8.6 → 1.1.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.
Files changed (144) hide show
  1. package/annotation/decorators.d.ts +20 -285
  2. package/annotation/decorators.d.ts.map +1 -0
  3. package/annotation/decorators.js +92 -84
  4. package/annotation/decorators.js.map +1 -1
  5. package/annotation/options.d.ts +276 -0
  6. package/annotation/options.d.ts.map +1 -0
  7. package/annotation/options.js +2 -0
  8. package/annotation/options.js.map +1 -0
  9. package/binding/binding.expressions.d.ts +2 -1
  10. package/binding/binding.expressions.d.ts.map +1 -0
  11. package/binding/binding.expressions.js +149 -124
  12. package/binding/binding.expressions.js.map +1 -1
  13. package/component/component.d.ts +13 -11
  14. package/component/component.d.ts.map +1 -0
  15. package/component/component.js +39 -45
  16. package/component/component.js.map +1 -1
  17. package/component/custom-element.d.ts +1 -3
  18. package/component/custom-element.d.ts.map +1 -0
  19. package/component/custom-element.js.map +1 -1
  20. package/component/events.d.ts +1 -0
  21. package/component/events.d.ts.map +1 -0
  22. package/component/events.js +4 -3
  23. package/component/events.js.map +1 -1
  24. package/component/lifecycle.d.ts +1 -0
  25. package/component/lifecycle.d.ts.map +1 -0
  26. package/component/reflect.d.ts +12 -15
  27. package/component/reflect.d.ts.map +1 -0
  28. package/component/reflect.js +28 -47
  29. package/component/reflect.js.map +1 -1
  30. package/context/stack.d.ts +1 -0
  31. package/context/stack.d.ts.map +1 -0
  32. package/context/subscription.d.ts +1 -0
  33. package/context/subscription.d.ts.map +1 -0
  34. package/directive/directive.d.ts +1 -0
  35. package/directive/directive.d.ts.map +1 -0
  36. package/directive/directive.js +8 -0
  37. package/directive/directive.js.map +1 -1
  38. package/directive/parser.d.ts +1 -0
  39. package/directive/parser.d.ts.map +1 -0
  40. package/directive/parser.js +9 -7
  41. package/directive/parser.js.map +1 -1
  42. package/directive/providers.d.ts +1 -0
  43. package/directive/providers.d.ts.map +1 -0
  44. package/directive/providers.js +2 -1
  45. package/directive/providers.js.map +1 -1
  46. package/html/deserialize.d.ts +1 -0
  47. package/html/deserialize.d.ts.map +1 -0
  48. package/html/expression.d.ts +1 -0
  49. package/html/expression.d.ts.map +1 -0
  50. package/html/expression.js +2 -2
  51. package/html/expression.js.map +1 -1
  52. package/html/types.d.ts +1 -0
  53. package/html/types.d.ts.map +1 -0
  54. package/index.d.ts +2 -2
  55. package/index.d.ts.map +1 -0
  56. package/index.js +1 -2
  57. package/index.js.map +1 -1
  58. package/linker/change-detector-ref.d.ts +1 -0
  59. package/linker/change-detector-ref.d.ts.map +1 -0
  60. package/linker/template-ref.d.ts +1 -0
  61. package/linker/template-ref.d.ts.map +1 -0
  62. package/linker/template-ref.js +5 -0
  63. package/linker/template-ref.js.map +1 -1
  64. package/linker/view-container-ref.d.ts +4 -2
  65. package/linker/view-container-ref.d.ts.map +1 -0
  66. package/linker/view-container-ref.js +9 -7
  67. package/linker/view-container-ref.js.map +1 -1
  68. package/linker/view-ref.d.ts +1 -0
  69. package/linker/view-ref.d.ts.map +1 -0
  70. package/linker/view-ref.js +5 -2
  71. package/linker/view-ref.js.map +1 -1
  72. package/node.d.ts +1 -0
  73. package/node.d.ts.map +1 -0
  74. package/package.json +8 -9
  75. package/pipe/pipe.d.ts +1 -0
  76. package/pipe/pipe.d.ts.map +1 -0
  77. package/pipe/pipe.js +2 -1
  78. package/pipe/pipe.js.map +1 -1
  79. package/providers/provider.d.ts +15 -13
  80. package/providers/provider.d.ts.map +1 -0
  81. package/providers/provider.js +13 -15
  82. package/providers/provider.js.map +1 -1
  83. package/scope/variables.d.ts +19 -0
  84. package/scope/variables.d.ts.map +1 -0
  85. package/scope/variables.js +38 -0
  86. package/scope/variables.js.map +1 -0
  87. package/utils/elements-util.d.ts +1 -0
  88. package/utils/elements-util.d.ts.map +1 -0
  89. package/utils/path.d.ts +1 -0
  90. package/utils/path.d.ts.map +1 -0
  91. package/utils/typeof.d.ts +3 -0
  92. package/utils/typeof.d.ts.map +1 -0
  93. package/utils/typeof.js.map +1 -1
  94. package/utils/utils.d.ts +1 -0
  95. package/utils/utils.d.ts.map +1 -0
  96. package/view/base-view.d.ts +1 -0
  97. package/view/base-view.d.ts.map +1 -0
  98. package/view/base-view.js +33 -29
  99. package/view/base-view.js.map +1 -1
  100. package/view/form-view.d.ts +1 -0
  101. package/view/form-view.d.ts.map +1 -0
  102. package/view/form-view.js +70 -67
  103. package/view/form-view.js.map +1 -1
  104. package/view/mutation.d.ts +1 -0
  105. package/view/mutation.d.ts.map +1 -0
  106. package/view/mutation.js +35 -35
  107. package/view/mutation.js.map +1 -1
  108. package/view/render.d.ts +2 -0
  109. package/view/render.d.ts.map +1 -0
  110. package/view/render.js +25 -13
  111. package/view/render.js.map +1 -1
  112. package/view/utils.d.ts +4 -3
  113. package/view/utils.d.ts.map +1 -0
  114. package/view/utils.js.map +1 -1
  115. package/view/view.d.ts +5 -4
  116. package/view/view.d.ts.map +1 -0
  117. package/view/view.js +34 -7
  118. package/view/view.js.map +1 -1
  119. package/zone/bootstrap.d.ts +1 -0
  120. package/zone/bootstrap.d.ts.map +1 -0
  121. package/zone/proxy.d.ts +1 -0
  122. package/zone/proxy.d.ts.map +1 -0
  123. package/zone/proxy.js +1 -0
  124. package/zone/proxy.js.map +1 -1
  125. package/zone/task.d.ts +1 -0
  126. package/zone/task.d.ts.map +1 -0
  127. package/zone/task.js +11 -3
  128. package/zone/task.js.map +1 -1
  129. package/zone/zone.d.ts +1 -0
  130. package/zone/zone.d.ts.map +1 -0
  131. package/zone/zone.js +8 -6
  132. package/zone/zone.js.map +1 -1
  133. package/providers/injector.d.ts +0 -10
  134. package/providers/injector.js +0 -27
  135. package/providers/injector.js.map +0 -1
  136. package/render/host-binding.handler.d.ts +0 -46
  137. package/render/host-binding.handler.js +0 -60
  138. package/render/host-binding.handler.js.map +0 -1
  139. package/render/host-listener.handler.d.ts +0 -50
  140. package/render/host-listener.handler.js +0 -88
  141. package/render/host-listener.handler.js.map +0 -1
  142. package/render/render-handler.d.ts +0 -11
  143. package/render/render-handler.js +0 -2
  144. package/render/render-handler.js.map +0 -1
@@ -0,0 +1,276 @@
1
+ import type { Class, TypeOf } from '../utils/typeof.js';
2
+ import { DomNode } from '@ibyar/elements';
3
+ import { TemplateUrl } from '../utils/path.js';
4
+ import { ZoneType } from '../zone/bootstrap.js';
5
+ import { ValueControl } from '../component/custom-element.js';
6
+ export interface DirectiveOptions {
7
+ /**
8
+ * the name of the directive which is used in the template
9
+ *
10
+ * a structural directive name should start with `*`,
11
+ * and an attributes directive should not.
12
+ */
13
+ selector: string;
14
+ /**
15
+ * - use `manual` for no zone.js patch effect applied,
16
+ * and used for manual change detection for heavily process components.
17
+ *
18
+ * - use `proxy` zone for automatic detect changes without use of `zone.js`
19
+ *
20
+ * - use `aurora` for detection events like `rxjs` observables, `setTimeout`,
21
+ * `setInterval` and `fetch` and `XMLHttpRequest`, etc...
22
+ * make sure that `zone.js` is imported in the polyfills module.
23
+ *
24
+ * if no value specified, the value will be initialized by the custom element `web component` zone,
25
+ * - if the web component zone is `manual`, the directive zone also will be `manual`, expect weird behavior.
26
+ * - if the web component zone is `proxy`, the directive zone also will be `proxy`.
27
+ * - if the web component zone is `aurora`, the directive zone also will be `aurora` and will get the benefit of `zone.js`.
28
+ */
29
+ zone?: ZoneType;
30
+ }
31
+ export interface ServiceOptions {
32
+ provideIn?: TypeOf<CustomElementConstructor> | 'root' | 'platform' | 'any';
33
+ }
34
+ export interface PipeOptions {
35
+ name: string;
36
+ asynchronous?: boolean;
37
+ }
38
+ export interface ComponentOptions<T = Class> {
39
+ /**
40
+ * a tag name for the component,
41
+ * if the tag name is valid custom element name, the view class will be a custom element,
42
+ * otherwise an HTMLUnknownElement will be created
43
+ */
44
+ selector: string;
45
+ /**
46
+ * add html file url path to fetch,
47
+ * templateUrl had propriety than template, and will override it.
48
+ *
49
+ * Can provide file name as "person-view.html" will resolved
50
+ * as 'http://site-address.org/persin-view.html',
51
+ *
52
+ * OR as an object { moduleMeta: import.meta, filename: 'person-edit.html' }
53
+ * let (import.meta = '/person/person.js') will resolved
54
+ * as 'http://site-address.org/person/person-edit.html',
55
+ *
56
+ * OR as an object { moduleMeta: import.meta }
57
+ * let (import.meta = '/person/person.js') will resolved as 'http://site-address.org/person/person.html'.
58
+ *
59
+ * if url not found, component will not be defined,
60
+ *
61
+ * if you didn't use webpack or rollup.js or any bundler,
62
+ * you should copy the html files to its folder by yourself.
63
+ */
64
+ templateUrl?: TemplateUrl | string;
65
+ /**
66
+ * template: typeof 'string' ==> html string,
67
+ * TypeOf 'DomRootRenderNode<T>' ==> JSX, create factory
68
+ * if template === null || undefined ==> it had nothing to render,
69
+ * and may be inherit from an html element
70
+ *
71
+ * 2 possible way to write a template, as inline string, represent a a valid html,
72
+ * or us aurora jsx factory
73
+ *
74
+ */
75
+ template?: string | DomNode;
76
+ /**
77
+ * style for this element
78
+ */
79
+ styles?: string | {
80
+ [key: string]: string;
81
+ }[];
82
+ /**
83
+ * what basic element should the new component inherit from,
84
+ * the tag name to inherit from as 'a', 'div', 'table', 'td', 'th', 'tr', etc ...
85
+ * also, support extends a custom element tag name.
86
+ */
87
+ extend?: keyof HTMLElementTagNameMap | `${string}-${string}`;
88
+ /**
89
+ * An encapsulation policy for the template and CSS styles. One of:
90
+ * 'custom': Use global CSS without any encapsulation.
91
+ * 'shadow-dom': Use Shadow DOM v1 to encapsulate styles.
92
+ *
93
+ * 'template': like 'custom', with load the template from the document ('index.html' file)
94
+ * that had the same id as the component "selector".
95
+ * 'shadow-dom-template': like 'shadowDom', and load template by selector id.
96
+ *
97
+ * Both 'template' & 'shadow-dom-template' encapsulation type:
98
+ * should had attributes name like lowercase,
99
+ * the browser itself, will convert all attributes to lowercase
100
+ *
101
+ * ```typescript
102
+ * @Input('personage') personAge: number;
103
+ * @Input('propname') propName: string;
104
+ * @Output('savebuttonclick') saveButtonClick = new EventEmitter<Persons>();
105
+ * @View('personform') personForm: HTMLFormElement;
106
+ * ```
107
+ *
108
+ * any app root element as
109
+ *
110
+ * ```html
111
+ * <app-root></app-root>
112
+ * ```
113
+ *
114
+ * the supported bind options is 'One way binding *(as passing data only)'
115
+ * and 'template parsing' and 'event binding' syntax, HTML (angular) like.
116
+ * it load its attributes from 'window object'
117
+ *
118
+ * so to pass date to A root element,
119
+ *
120
+ * ```html
121
+ * <script>
122
+ * const appVersion = '0.1.504';
123
+ * function onRootAppClick() {
124
+ * console.log('root app clicked');
125
+ * }
126
+ * function onSave(data){
127
+ * console.log('root app save', data);
128
+ * }
129
+ * </script>
130
+ * <app-root [version]="appVersion"
131
+ * onclick="onRootAppClick()"
132
+ * (save)="onSave()" >
133
+ * </app-root>
134
+ * ```
135
+ *
136
+ * default is 'custom'
137
+ * @type {'custom' | 'shadowDom' | 'template' | 'shadowDom-template'}
138
+ */
139
+ encapsulation?: 'custom' | 'shadow-dom' | 'template' | 'shadow-dom-template';
140
+ /**
141
+ * default: 'open' when encapsulation used,
142
+ * otherwise it is undefined and will not attach shadow root element.
143
+ */
144
+ shadowDomMode?: ShadowRootMode;
145
+ /**
146
+ * default: false
147
+ */
148
+ shadowDomDelegatesFocus?: boolean;
149
+ /**
150
+ * shadow root initialization options,
151
+ * default mode: `open`, delegatesFocus: `false` and slotAssignment: `manual`
152
+ */
153
+ shadowRootInit?: Partial<ShadowRootInit>;
154
+ /**
155
+ * Create a custom form-associated element with HTMLElement.attachInternals
156
+ * default: false
157
+ *
158
+ * if the value is `true` it is expected from the model class to implement `ValueControl<T>` interface
159
+ *
160
+ * otherwise you can register another class that implement `ValueControl<T>`,
161
+ * in case if you want split the model and the value controller.
162
+ *
163
+ * #### Usage Notes:
164
+ *
165
+ * ```ts
166
+ *
167
+ * @Component({
168
+ * selector: 'custom-message',
169
+ * template: `
170
+ * <label for="message">Message</label>
171
+ * <textarea id="message" [(value)]="message" [disabled]="disabled" (change)="onMessageChange($event.target.value)"></textarea>
172
+ * `,
173
+ * formAssociated: true,
174
+ * // formAssociated: CustomMessage,
175
+ * })
176
+ * export class CustomMessage implements ValueControl<string> {
177
+ *
178
+ * private message: string | null = '';
179
+ * private disabled: boolean = false;
180
+ * private _onChange: (_: any) => void = () => {};
181
+ *
182
+ * writeValue({ value, mode }: WriteValueOptions<string>) {
183
+ * this.message = mode !== 'reset' ? value : '';
184
+ * }
185
+ *
186
+ * registerOnChange(fn: (_: any) => void): void {
187
+ * this._onChange = fn;
188
+ * }
189
+ *
190
+ * setDisabledState(isDisabled: boolean) {
191
+ * this.disabled = isDisabled;
192
+ * }
193
+ *
194
+ * onMessageChange(message: string) {
195
+ * this._onChange(message);
196
+ * }
197
+ *
198
+ * }
199
+ *
200
+ *
201
+ * export class CustomInputValueControl implements ValueControl<number> {
202
+ *
203
+ * private _value: number | null = null;
204
+ * private _disabled: boolean = false;
205
+ * private _onChange: (_: any) => void = () => {};
206
+ *
207
+ * writeValue({ value, mode }: WriteValueOptions<number>) {
208
+ * this._value = mode !== 'reset' ? value : null;
209
+ * }
210
+ *
211
+ * registerOnChange(fn: (_: any) => void): void {
212
+ * this._onChange = fn;
213
+ * }
214
+ *
215
+ * setDisabledState(isDisabled: boolean) {
216
+ * this._disabled = isDisabled;
217
+ * }
218
+ *
219
+ * }
220
+ *
221
+ * @Component({
222
+ * selector: 'custom-input',
223
+ * extend: 'input',
224
+ * formAssociated: CustomInputValueControl,
225
+ * })
226
+ * export class CustomInputElement {
227
+ *
228
+ * @View()
229
+ * view: HTMLInputElement;
230
+ *
231
+ * onInit() {
232
+ * this.view.type = 'number';
233
+ * }
234
+ * }
235
+ *
236
+ * ```
237
+ */
238
+ formAssociated?: boolean | TypeOf<ValueControl<any>>;
239
+ /**
240
+ * - use `manual` for no zone.js patch effect applied,
241
+ * and used for manual change detection for heavily process components.
242
+ *
243
+ * - use `proxy` zone for automatic detect changes without use of `zone.js`
244
+ *
245
+ * - use `aurora` for detection events like `rxjs` observables, `setTimeout`,
246
+ * `setInterval` and `fetch` and `XMLHttpRequest`, etc...
247
+ * make sure that `zone.js` is imported in the polyfills module.
248
+ *
249
+ * the default value is the platform zone type which can be changed by:
250
+ *
251
+ * ```js
252
+ * bootstrapZone('manual')
253
+ * bootstrapZone('proxy')
254
+ * bootstrapZone('aurora')
255
+ * ```
256
+ *
257
+ * if `bootstrapZone` never been called, then the default zone is a `manual`.
258
+ */
259
+ zone?: ZoneType;
260
+ /**
261
+ * The imports property specifies the component's template dependencies — those directives, components, and pipes that can be used within its template.
262
+ */
263
+ imports?: (TypeOf<any> | ReadonlyArray<any>)[];
264
+ }
265
+ export interface ChildOptions {
266
+ [key: string]: any;
267
+ }
268
+ export interface ViewChildOpt {
269
+ selector: string | typeof HTMLElement | CustomElementConstructor;
270
+ childOptions?: ChildOptions;
271
+ }
272
+ export type OutputEventInit = Omit<EventInit, 'cancelable'>;
273
+ export type OutputOptions = {
274
+ name?: string;
275
+ } & OutputEventInit;
276
+ //# sourceMappingURL=options.d.ts.map
@@ -0,0 +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,CAAC;IACb,YAAY,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,gBAAgB,CAAC,CAAC,GAAG,KAAK;IAE1C;;;;OAIG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;;;;;;;;;;;;;;;;;OAkBG;IACH,WAAW,CAAC,EAAE,WAAW,GAAG,MAAM,CAAC;IAEnC;;;;;;;;;OASG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAE5B;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,EAAE,CAAC;IAE9C;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,qBAAqB,GAAG,GAAG,MAAM,IAAI,MAAM,EAAE,CAAC;IAE7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAkDG;IACH,aAAa,CAAC,EAAE,QAAQ,GAAG,YAAY,GAAG,UAAU,GAAG,qBAAqB,CAAC;IAE7E;;;OAGG;IACH,aAAa,CAAC,EAAE,cAAc,CAAC;IAE/B;;OAEG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAElC;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;IAEzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmFG;IACH,cAAc,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC;IAErD;;;;;;;;;;;;;;;;;;;OAmBG;IACH,IAAI,CAAC,EAAE,QAAQ,CAAC;IAEhB;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;CAC/C;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"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=options.js.map
@@ -0,0 +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 * 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, InfixExpressionNode, ScopeSubscription, Stack, Context, MemberExpression, Identifier, VisitNodeType, NodeDeserializer } from '@ibyar/expressions';
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;
@@ -40,3 +40,4 @@ export declare class TwoWayAssignmentExpression extends InfixExpressionNode<TwoW
40
40
  subscribe(stack: Stack): ScopeSubscription<Context>[];
41
41
  }
42
42
  export {};
43
+ //# sourceMappingURL=binding.expressions.d.ts.map
@@ -0,0 +1 @@
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,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,CAAuB;gBAC9B,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,cAAc;IAGzD,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG;IAG5B,GAAG,CAAC,KAAK,EAAE,KAAK,GAAG,GAAG;IAKtB,SAAS,CAAC,KAAK,EAAE,KAAK,EAAE,aAAa,CAAC,EAAE,MAAM,EAAE,GAAG,iBAAiB,CAAC,OAAO,CAAC,EAAE;CA+B/E;AAGD;;;;GAIG;AACH,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,UAAkB,KAAK,EAAE,gBAAgB,GAAG,UAAU,CAAC;IAEvD,OAAO,CAAC,WAAW,CAAqB;IACxC,OAAO,CAAC,UAAU,CAAqB;gBAC3B,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,gBAAgB,GAAG,UAAU;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,136 +1,161 @@
1
- var OneWayAssignmentExpression_1, TwoWayAssignmentExpression_1;
2
- import { __decorate, __metadata } from "tslib";
3
- import { InfixExpressionNode, findReactiveScopeByEventMap, Scope, MemberExpression, Deserializer } from '@ibyar/expressions';
4
- import { createSubscriptionDestroyer } from '../context/subscription.js';
1
+ import { __esDecorate, __runInitializers } from "tslib";
2
+ import { Deserializer, InfixExpressionNode, Scope, findReactiveScopeByEventMap } from '@ibyar/expressions';
5
3
  import { isOnDestroy } from '../component/lifecycle.js';
4
+ import { createSubscriptionDestroyer } from '../context/subscription.js';
6
5
  import { AsyncPipeProvider, AsyncPipeScope, PipeProvider } from '../pipe/pipe.js';
7
- let OneWayAssignmentExpression = OneWayAssignmentExpression_1 = class OneWayAssignmentExpression extends InfixExpressionNode {
8
- static fromJSON(node, deserializer) {
9
- return new OneWayAssignmentExpression_1(deserializer(node.left), deserializer(node.right));
10
- }
11
- static visit(node, visitNode) {
12
- visitNode(node.left);
13
- visitNode(node.right);
14
- }
15
- constructor(left, right) {
16
- super('=:', left, right);
17
- this.rightEvents = this.right.events();
18
- }
19
- set(stack, value) {
20
- return this.left.set(stack, value);
21
- }
22
- get(stack) {
23
- const rv = this.right.get(stack);
24
- this.set(stack, rv);
25
- return rv;
26
- }
27
- subscribe(stack, pipelineNames) {
28
- const subscriptions = [];
29
- if (pipelineNames?.length) {
30
- const syncPipeScope = Scope.blockScope();
31
- const asyncPipeScope = AsyncPipeScope.blockScope();
32
- let hasAsync = false, hasSync = false;
33
- pipelineNames.forEach(pipelineName => {
34
- const scope = stack.findScope(pipelineName);
35
- const pipe = scope.get(pipelineName);
36
- if (scope instanceof AsyncPipeProvider) {
37
- hasAsync = true;
38
- asyncPipeScope.set(pipelineName, pipe);
39
- if (isOnDestroy(pipe.prototype)) {
40
- subscriptions.push(createSubscriptionDestroyer(() => asyncPipeScope.unsubscribe(pipelineName)));
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(createSubscriptionDestroyer(() => asyncPipeScope.unsubscribe(pipelineName)));
54
+ }
55
+ }
56
+ else if (scope instanceof PipeProvider) {
57
+ hasSync = true;
58
+ syncPipeScope.set(pipelineName, pipe);
41
59
  }
42
- }
43
- else if (scope instanceof PipeProvider) {
44
- hasSync = true;
45
- syncPipeScope.set(pipelineName, pipe);
46
- }
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);
47
69
  });
48
- hasSync && stack.pushScope(syncPipeScope);
49
- hasAsync && stack.pushScope(asyncPipeScope);
50
- }
51
- const tuples = findReactiveScopeByEventMap(this.rightEvents, stack);
52
- const callback = () => this.get(stack);
53
- tuples.forEach(tuple => {
54
- const subscription = tuple[1].subscribe(tuple[0], callback);
55
- subscriptions.push(subscription);
56
- });
57
- return subscriptions;
58
- }
59
- };
60
- OneWayAssignmentExpression = OneWayAssignmentExpression_1 = __decorate([
61
- Deserializer('OneWayAssignment'),
62
- __metadata("design:paramtypes", [MemberExpression, Object])
63
- ], OneWayAssignmentExpression);
70
+ return subscriptions;
71
+ }
72
+ };
73
+ return OneWayAssignmentExpression = _classThis;
74
+ })();
64
75
  export { OneWayAssignmentExpression };
65
76
  /**
66
77
  * the default behavior is assign the right hand side to the left hand side.
67
78
  *
68
79
  *
69
80
  */
70
- let TwoWayAssignmentExpression = TwoWayAssignmentExpression_1 = class TwoWayAssignmentExpression extends InfixExpressionNode {
71
- static fromJSON(node, deserializer) {
72
- return new TwoWayAssignmentExpression_1(deserializer(node.left), deserializer(node.right));
73
- }
74
- static visit(node, visitNode) {
75
- visitNode(node.left);
76
- visitNode(node.right);
77
- }
78
- constructor(left, right) {
79
- super('=::', left, right);
80
- this.rightEvents = this.right.events();
81
- this.leftEvents = this.left.events();
82
- }
83
- set(stack, value) {
84
- return this.setRTL(stack, value);
85
- }
86
- get(stack) {
87
- return this.getRTL(stack);
88
- }
89
- setRTL(stack, value) {
90
- return this.left.set(stack, value);
91
- }
92
- getRTL(stack) {
93
- const rv = this.right.get(stack);
94
- this.setRTL(stack, rv);
95
- return rv;
96
- }
97
- actionRTL(stack) {
98
- return () => this.getRTL(stack);
99
- }
100
- setLTR(stack, value) {
101
- return this.right.set(stack, value);
102
- }
103
- getLTR(stack) {
104
- const lv = this.left.get(stack);
105
- this.setLTR(stack, lv);
106
- return lv;
107
- }
108
- actionLTR(stack) {
109
- return () => this.getLTR(stack);
110
- }
111
- subscribeToEvents(stack, tuples, actionCallback) {
112
- const subscriptions = [];
113
- tuples.forEach(tuple => {
114
- const subscription = tuple[1].subscribe(tuple[0], actionCallback);
115
- subscriptions.push(subscription);
116
- });
117
- return subscriptions;
118
- }
119
- subscribe(stack) {
120
- // right to left
121
- const rightTuples = findReactiveScopeByEventMap(this.rightEvents, stack);
122
- const rtlAction = this.actionRTL(stack);
123
- const rtlSubscriptions = this.subscribeToEvents(stack, rightTuples, rtlAction);
124
- // left to right
125
- const leftTuples = findReactiveScopeByEventMap(this.leftEvents, stack);
126
- const ltrAction = this.actionLTR(stack);
127
- const ltrSubscriptions = this.subscribeToEvents(stack, leftTuples, ltrAction);
128
- return rtlSubscriptions.concat(ltrSubscriptions);
129
- }
130
- };
131
- TwoWayAssignmentExpression = TwoWayAssignmentExpression_1 = __decorate([
132
- Deserializer('TwoWayAssignment'),
133
- __metadata("design:paramtypes", [MemberExpression, Object])
134
- ], TwoWayAssignmentExpression);
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
+ })();
135
160
  export { TwoWayAssignmentExpression };
136
161
  //# sourceMappingURL=binding.expressions.js.map