@repobit/dex-store-elements 1.7.3 → 2.0.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 (227) hide show
  1. package/CHANGELOG.md +6 -906
  2. package/README.md +308 -283
  3. package/dist/src/actions/action.adapter.d.ts +36 -0
  4. package/dist/src/actions/action.adapter.js +183 -0
  5. package/dist/src/actions/action.adapter.js.map +1 -0
  6. package/dist/src/actions/action.attributes.d.ts +15 -0
  7. package/dist/src/actions/action.attributes.js +137 -0
  8. package/dist/src/actions/action.attributes.js.map +1 -0
  9. package/dist/src/actions/action.registry.d.ts +4 -0
  10. package/dist/src/actions/action.registry.js +119 -0
  11. package/dist/src/actions/action.registry.js.map +1 -0
  12. package/dist/src/actions/index.d.ts +3 -2
  13. package/dist/src/actions/index.js +3 -80
  14. package/dist/src/actions/index.js.map +1 -1
  15. package/dist/src/compute/compute.expand.d.ts +70 -0
  16. package/dist/src/compute/compute.expand.js +319 -0
  17. package/dist/src/compute/compute.expand.js.map +1 -0
  18. package/dist/src/compute/compute.scan.d.ts +54 -0
  19. package/dist/src/compute/compute.scan.js +160 -0
  20. package/dist/src/compute/compute.scan.js.map +1 -0
  21. package/dist/src/compute/option-resolver.d.ts +31 -0
  22. package/dist/src/compute/option-resolver.js +147 -0
  23. package/dist/src/compute/option-resolver.js.map +1 -0
  24. package/dist/src/contexts/context.compute.d.ts +12 -0
  25. package/dist/src/contexts/context.compute.js +4 -0
  26. package/dist/src/contexts/context.compute.js.map +1 -0
  27. package/dist/src/contexts/context.scope.d.ts +139 -0
  28. package/dist/src/contexts/context.scope.js +48 -0
  29. package/dist/src/contexts/context.scope.js.map +1 -0
  30. package/dist/src/controllers/controller.action-resolve.d.ts +110 -0
  31. package/dist/src/controllers/controller.action-resolve.js +203 -0
  32. package/dist/src/controllers/controller.action-resolve.js.map +1 -0
  33. package/dist/src/controllers/controller.action-topology.d.ts +59 -0
  34. package/dist/src/controllers/controller.action-topology.js +130 -0
  35. package/dist/src/controllers/controller.action-topology.js.map +1 -0
  36. package/dist/src/controllers/controller.compute.d.ts +72 -0
  37. package/dist/src/controllers/controller.compute.js +110 -0
  38. package/dist/src/controllers/controller.compute.js.map +1 -0
  39. package/dist/src/controllers/controller.resolve.d.ts +78 -0
  40. package/dist/src/controllers/controller.resolve.js +205 -0
  41. package/dist/src/controllers/controller.resolve.js.map +1 -0
  42. package/dist/src/core/action-topology.d.ts +62 -0
  43. package/dist/src/core/action-topology.js +67 -0
  44. package/dist/src/core/action-topology.js.map +1 -0
  45. package/dist/src/core/actions.d.ts +64 -0
  46. package/dist/src/core/actions.js +47 -0
  47. package/dist/src/core/actions.js.map +1 -0
  48. package/dist/src/core/node.element.d.ts +179 -0
  49. package/dist/src/core/node.element.js +573 -0
  50. package/dist/src/core/node.element.js.map +1 -0
  51. package/dist/src/core/node.scope.d.ts +374 -0
  52. package/dist/src/core/node.scope.js +558 -0
  53. package/dist/src/core/node.scope.js.map +1 -0
  54. package/dist/src/core/option-update.d.ts +11 -0
  55. package/dist/src/core/option-update.js +59 -0
  56. package/dist/src/core/option-update.js.map +1 -0
  57. package/dist/src/dsl/compilers/array/compiler.js +13 -14
  58. package/dist/src/dsl/compilers/array/compiler.js.map +1 -1
  59. package/dist/src/dsl/compilers/boolean/compiler.d.ts +1 -1
  60. package/dist/src/dsl/compilers/boolean/compiler.js +14 -27
  61. package/dist/src/dsl/compilers/boolean/compiler.js.map +1 -1
  62. package/dist/src/dsl/compilers/enum/compiler.js +7 -10
  63. package/dist/src/dsl/compilers/enum/compiler.js.map +1 -1
  64. package/dist/src/dsl/compilers/index.d.ts +1 -1
  65. package/dist/src/dsl/compilers/index.js +5 -5
  66. package/dist/src/dsl/compilers/index.js.map +1 -1
  67. package/dist/src/dsl/utilty.d.ts +0 -4
  68. package/dist/src/dsl/utilty.js +3 -30
  69. package/dist/src/dsl/utilty.js.map +1 -1
  70. package/dist/src/eta/batch.d.ts +123 -0
  71. package/dist/src/eta/batch.js +162 -0
  72. package/dist/src/eta/batch.js.map +1 -0
  73. package/dist/src/eta/batcher.d.ts +184 -0
  74. package/dist/src/eta/batcher.js +335 -0
  75. package/dist/src/eta/batcher.js.map +1 -0
  76. package/dist/src/eta/cache.d.ts +36 -0
  77. package/dist/src/eta/cache.js +56 -0
  78. package/dist/src/eta/cache.js.map +1 -0
  79. package/dist/src/eta/controller.d.ts +608 -0
  80. package/dist/src/eta/controller.js +1036 -0
  81. package/dist/src/eta/controller.js.map +1 -0
  82. package/dist/src/eta/factory.d.ts +74 -0
  83. package/dist/src/eta/factory.js +121 -0
  84. package/dist/src/eta/factory.js.map +1 -0
  85. package/dist/src/eta/idle.d.ts +39 -0
  86. package/dist/src/eta/idle.js +52 -0
  87. package/dist/src/eta/idle.js.map +1 -0
  88. package/dist/src/eta/index.d.ts +52 -0
  89. package/dist/src/eta/index.js +13 -0
  90. package/dist/src/eta/index.js.map +1 -0
  91. package/dist/src/eta/observer.d.ts +263 -0
  92. package/dist/src/eta/observer.js +263 -0
  93. package/dist/src/eta/observer.js.map +1 -0
  94. package/dist/src/eta/operations.d.ts +41 -0
  95. package/dist/src/eta/operations.js +59 -0
  96. package/dist/src/eta/operations.js.map +1 -0
  97. package/dist/src/eta/source-registry.d.ts +198 -0
  98. package/dist/src/eta/source-registry.js +267 -0
  99. package/dist/src/eta/source-registry.js.map +1 -0
  100. package/dist/src/eta/template-index.d.ts +285 -0
  101. package/dist/src/eta/template-index.js +642 -0
  102. package/dist/src/eta/template-index.js.map +1 -0
  103. package/dist/src/eta/types.d.ts +529 -0
  104. package/dist/src/eta/types.js +2 -0
  105. package/dist/src/eta/types.js.map +1 -0
  106. package/dist/src/index.d.ts +21 -9
  107. package/dist/src/index.js +22 -11
  108. package/dist/src/index.js.map +1 -1
  109. package/dist/src/nodes/node.context.d.ts +5 -3
  110. package/dist/src/nodes/node.context.js +48 -3
  111. package/dist/src/nodes/node.context.js.map +1 -1
  112. package/dist/src/nodes/node.option.d.ts +11 -31
  113. package/dist/src/nodes/node.option.js +158 -222
  114. package/dist/src/nodes/node.option.js.map +1 -1
  115. package/dist/src/nodes/node.product.d.ts +7 -11
  116. package/dist/src/nodes/node.product.js +85 -64
  117. package/dist/src/nodes/node.product.js.map +1 -1
  118. package/dist/src/renders/attributes/buyLink.d.ts +2 -2
  119. package/dist/src/renders/attributes/buyLink.js +14 -11
  120. package/dist/src/renders/attributes/buyLink.js.map +1 -1
  121. package/dist/src/renders/attributes/devices.d.ts +2 -2
  122. package/dist/src/renders/attributes/devices.js +9 -19
  123. package/dist/src/renders/attributes/devices.js.map +1 -1
  124. package/dist/src/renders/attributes/discount.d.ts +2 -2
  125. package/dist/src/renders/attributes/discount.js +56 -44
  126. package/dist/src/renders/attributes/discount.js.map +1 -1
  127. package/dist/src/renders/attributes/hide.d.ts +2 -2
  128. package/dist/src/renders/attributes/hide.js +49 -14
  129. package/dist/src/renders/attributes/hide.js.map +1 -1
  130. package/dist/src/renders/attributes/index.d.ts +3 -3
  131. package/dist/src/renders/attributes/index.js +2 -4
  132. package/dist/src/renders/attributes/index.js.map +1 -1
  133. package/dist/src/renders/attributes/price.d.ts +2 -2
  134. package/dist/src/renders/attributes/price.js +30 -44
  135. package/dist/src/renders/attributes/price.js.map +1 -1
  136. package/dist/src/renders/attributes/subscription.d.ts +2 -2
  137. package/dist/src/renders/attributes/subscription.js +14 -20
  138. package/dist/src/renders/attributes/subscription.js.map +1 -1
  139. package/dist/src/renders/attributes/utilty.d.ts +2 -0
  140. package/dist/src/renders/attributes/utilty.js +17 -4
  141. package/dist/src/renders/attributes/utilty.js.map +1 -1
  142. package/dist/src/renders/context.d.ts +122 -10
  143. package/dist/src/renders/context.js +140 -80
  144. package/dist/src/renders/context.js.map +1 -1
  145. package/dist/src/renders/format.js +2 -2
  146. package/dist/src/renders/format.js.map +1 -1
  147. package/dist/src/renders/index.d.ts +6 -2
  148. package/dist/src/renders/index.js +67 -29
  149. package/dist/src/renders/index.js.map +1 -1
  150. package/dist/src/renders/observe.d.ts +1 -4
  151. package/dist/src/renders/observe.js +10 -24
  152. package/dist/src/renders/observe.js.map +1 -1
  153. package/dist/src/renders/render.wrapper.d.ts +37 -0
  154. package/dist/src/renders/render.wrapper.js +147 -0
  155. package/dist/src/renders/render.wrapper.js.map +1 -0
  156. package/dist/src/templating/eta.js +1 -4
  157. package/dist/src/templating/eta.js.map +1 -1
  158. package/package.json +4 -5
  159. package/dist/src/actions/action.button.d.ts +0 -2
  160. package/dist/src/actions/action.button.js +0 -8
  161. package/dist/src/actions/action.button.js.map +0 -1
  162. package/dist/src/actions/action.input.d.ts +0 -2
  163. package/dist/src/actions/action.input.js +0 -43
  164. package/dist/src/actions/action.input.js.map +0 -1
  165. package/dist/src/actions/action.select.d.ts +0 -2
  166. package/dist/src/actions/action.select.js +0 -14
  167. package/dist/src/actions/action.select.js.map +0 -1
  168. package/dist/src/actions/utilty.d.ts +0 -16
  169. package/dist/src/actions/utilty.js +0 -149
  170. package/dist/src/actions/utilty.js.map +0 -1
  171. package/dist/src/contexts/context.datalayer.d.ts +0 -9
  172. package/dist/src/contexts/context.datalayer.js +0 -3
  173. package/dist/src/contexts/context.datalayer.js.map +0 -1
  174. package/dist/src/contexts/context.derived.d.ts +0 -12
  175. package/dist/src/contexts/context.derived.js +0 -3
  176. package/dist/src/contexts/context.derived.js.map +0 -1
  177. package/dist/src/contexts/context.option.d.ts +0 -5
  178. package/dist/src/contexts/context.option.js +0 -3
  179. package/dist/src/contexts/context.option.js.map +0 -1
  180. package/dist/src/contexts/context.product.d.ts +0 -5
  181. package/dist/src/contexts/context.product.js +0 -3
  182. package/dist/src/contexts/context.product.js.map +0 -1
  183. package/dist/src/contexts/context.state.d.ts +0 -28
  184. package/dist/src/contexts/context.state.js +0 -3
  185. package/dist/src/contexts/context.state.js.map +0 -1
  186. package/dist/src/contexts/context.store.d.ts +0 -5
  187. package/dist/src/contexts/context.store.js +0 -3
  188. package/dist/src/contexts/context.store.js.map +0 -1
  189. package/dist/src/controllers/collect-controller.d.ts +0 -39
  190. package/dist/src/controllers/collect-controller.js +0 -161
  191. package/dist/src/controllers/collect-controller.js.map +0 -1
  192. package/dist/src/controllers/compute-controller.d.ts +0 -55
  193. package/dist/src/controllers/compute-controller.js +0 -350
  194. package/dist/src/controllers/compute-controller.js.map +0 -1
  195. package/dist/src/controllers/eta-renderer/eta-dom-renderer.d.ts +0 -25
  196. package/dist/src/controllers/eta-renderer/eta-dom-renderer.js +0 -192
  197. package/dist/src/controllers/eta-renderer/eta-dom-renderer.js.map +0 -1
  198. package/dist/src/controllers/eta-renderer/eta-mutation-observer.d.ts +0 -28
  199. package/dist/src/controllers/eta-renderer/eta-mutation-observer.js +0 -206
  200. package/dist/src/controllers/eta-renderer/eta-mutation-observer.js.map +0 -1
  201. package/dist/src/controllers/eta-renderer/eta-renderer.d.ts +0 -21
  202. package/dist/src/controllers/eta-renderer/eta-renderer.js +0 -77
  203. package/dist/src/controllers/eta-renderer/eta-renderer.js.map +0 -1
  204. package/dist/src/controllers/eta-renderer/eta-template-cache.d.ts +0 -24
  205. package/dist/src/controllers/eta-renderer/eta-template-cache.js +0 -61
  206. package/dist/src/controllers/eta-renderer/eta-template-cache.js.map +0 -1
  207. package/dist/src/controllers/eta-renderer/eta-types.d.ts +0 -11
  208. package/dist/src/controllers/eta-renderer/eta-types.js +0 -1
  209. package/dist/src/controllers/eta-renderer/eta-types.js.map +0 -1
  210. package/dist/src/controllers/eta-renderer/index.d.ts +0 -2
  211. package/dist/src/controllers/eta-renderer/index.js +0 -2
  212. package/dist/src/controllers/eta-renderer/index.js.map +0 -1
  213. package/dist/src/controllers/event-pipeline-controller.d.ts +0 -28
  214. package/dist/src/controllers/event-pipeline-controller.js +0 -72
  215. package/dist/src/controllers/event-pipeline-controller.js.map +0 -1
  216. package/dist/src/events/events.d.ts +0 -75
  217. package/dist/src/events/events.js +0 -78
  218. package/dist/src/events/events.js.map +0 -1
  219. package/dist/src/nodes/node.root.d.ts +0 -16
  220. package/dist/src/nodes/node.root.js +0 -49
  221. package/dist/src/nodes/node.root.js.map +0 -1
  222. package/dist/src/nodes/node.state.d.ts +0 -88
  223. package/dist/src/nodes/node.state.js +0 -330
  224. package/dist/src/nodes/node.state.js.map +0 -1
  225. package/dist/src/renders/utility.d.ts +0 -32
  226. package/dist/src/renders/utility.js +0 -191
  227. package/dist/src/renders/utility.js.map +0 -1
@@ -0,0 +1,147 @@
1
+ import { ContextConsumer } from '@lit/context';
2
+ import { Task } from '@lit/task';
3
+ import { bdComputeContext } from '../contexts/context.compute.js';
4
+ import { bdScopeContext } from '../contexts/context.scope.js';
5
+ import { dispatchBdNodeTrackWork } from '../core/node.element.js';
6
+ import { renderAttributes } from './attributes/index.js';
7
+ import { createRenderContext } from './context.js';
8
+ import { OBS_ATTRS_RENDER } from './observe.js';
9
+ /**
10
+ * Invisible render wrapper for a regular HTML render target.
11
+ *
12
+ * It implements the minimal ReactiveControllerHost surface needed by
13
+ * ContextConsumer, but delegates dispatchEvent to the target element. That
14
+ * makes the target the context request entrypoint without adding a wrapper
15
+ * element to the DOM.
16
+ */
17
+ export class BdRenderWrapper {
18
+ constructor(target) {
19
+ this.target = target;
20
+ this._controllers = new Set();
21
+ this._connected = false;
22
+ this._updateComplete = Promise.resolve(true);
23
+ this._renderTask =
24
+ new Task(this, {
25
+ autoRun: false,
26
+ task: async ([scope, computeResult], { signal }) => {
27
+ throwIfAborted(signal);
28
+ await renderAttributes(this.target, createRenderContext(scope, computeResult));
29
+ throwIfAborted(signal);
30
+ return true;
31
+ }
32
+ });
33
+ this._originalUpdateComplete =
34
+ Object.getOwnPropertyDescriptor(target, 'updateComplete');
35
+ Object.defineProperty(target, 'updateComplete', {
36
+ configurable: true,
37
+ get: () => this.updateComplete
38
+ });
39
+ /**
40
+ * ContextConsumer expects a ReactiveControllerHost & HTMLElement.
41
+ * This wrapper is headless, so we intentionally provide the minimal
42
+ * host surface and delegate dispatchEvent() to the real target element.
43
+ */
44
+ new ContextConsumer(this, {
45
+ context: bdScopeContext,
46
+ subscribe: true,
47
+ callback: (scope) => {
48
+ this.scope = scope;
49
+ this._queueRender();
50
+ }
51
+ });
52
+ new ContextConsumer(this, {
53
+ context: bdComputeContext,
54
+ subscribe: true,
55
+ callback: (computeResult) => {
56
+ this._computeResult = computeResult;
57
+ this._queueRender();
58
+ }
59
+ });
60
+ }
61
+ get updateComplete() {
62
+ return this._updateComplete;
63
+ }
64
+ addController(controller) {
65
+ this._controllers.add(controller);
66
+ }
67
+ removeController(controller) {
68
+ this._controllers.delete(controller);
69
+ }
70
+ requestUpdate() {
71
+ // Task status changes call host.requestUpdate(). This headless host has no
72
+ // update lifecycle, and queueing here would recursively trigger renders.
73
+ }
74
+ dispatchEvent(event) {
75
+ return this.target.dispatchEvent(event);
76
+ }
77
+ connect() {
78
+ if (this._connected) {
79
+ return;
80
+ }
81
+ this._connected = true;
82
+ this._observeTarget();
83
+ for (const controller of this._controllers) {
84
+ controller.hostConnected?.();
85
+ }
86
+ this._queueRender();
87
+ }
88
+ disconnect() {
89
+ if (!this._connected) {
90
+ return;
91
+ }
92
+ this._connected = false;
93
+ this._disconnectObserver();
94
+ this._renderTask.abort(createAbortError('BdRenderWrapper disconnected.'));
95
+ for (const controller of this._controllers) {
96
+ controller.hostDisconnected?.();
97
+ }
98
+ this._restoreUpdateComplete();
99
+ }
100
+ renderTarget() {
101
+ this._queueRender();
102
+ return this.updateComplete;
103
+ }
104
+ _queueRender() {
105
+ if (!this._connected) {
106
+ return;
107
+ }
108
+ this._renderTask.run([
109
+ this.scope,
110
+ this._computeResult
111
+ ]);
112
+ const promise = this._renderTask.taskComplete;
113
+ this._updateComplete = promise;
114
+ dispatchBdNodeTrackWork(this.target, this, promise);
115
+ }
116
+ _observeTarget() {
117
+ this._disconnectObserver();
118
+ if (typeof MutationObserver === 'undefined') {
119
+ return;
120
+ }
121
+ this._observer = new MutationObserver(() => {
122
+ this._queueRender();
123
+ });
124
+ this._observer.observe(this.target, {
125
+ attributeFilter: [...OBS_ATTRS_RENDER],
126
+ attributes: true
127
+ });
128
+ }
129
+ _disconnectObserver() {
130
+ this._observer?.disconnect();
131
+ this._observer = undefined;
132
+ }
133
+ _restoreUpdateComplete() {
134
+ if (this._originalUpdateComplete) {
135
+ Object.defineProperty(this.target, 'updateComplete', this._originalUpdateComplete);
136
+ return;
137
+ }
138
+ delete this.target.updateComplete;
139
+ }
140
+ }
141
+ function throwIfAborted(signal) {
142
+ signal.throwIfAborted();
143
+ }
144
+ function createAbortError(message) {
145
+ return new DOMException(message, 'AbortError');
146
+ }
147
+ //# sourceMappingURL=render.wrapper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render.wrapper.js","sourceRoot":"","sources":["../../../src/renders/render.wrapper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAOjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EACL,cAAc,EAEf,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAchD;;;;;;;GAOG;AACH,MAAM,OAAO,eAAe;IAW1B,YACW,MAAsB;QAAtB,WAAM,GAAN,MAAM,CAAgB;QAThB,iBAAY,GAAG,IAAI,GAAG,EAAsB,CAAC;QAItD,eAAU,GAAG,KAAK,CAAC;QACnB,oBAAe,GAAuC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAMlF,IAAI,CAAC,WAAW;YACd,IAAI,IAAI,CACN,IAAI,EACJ;gBACE,OAAO,EAAE,KAAK;gBACd,IAAI,EAAK,KAAK,EAAE,CACd,KAA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,OAAO,GAAG,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC;QAE9C,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC;QAE/B,uBAAuB,CACrB,IAAI,CAAC,MAAM,EACX,IAAI,EACJ,OAAO,CACR,CAAC;IACJ,CAAC;IAEO,cAAc;QACpB,IAAI,CAAC,mBAAmB,EAAE,CAAC;QAE3B,IAAI,OAAO,gBAAgB,KAAK,WAAW,EAAE,CAAC;YAC5C,OAAO;QACT,CAAC;QAED,IAAI,CAAC,SAAS,GAAG,IAAI,gBAAgB,CAAC,GAAG,EAAE;YACzC,IAAI,CAAC,YAAY,EAAE,CAAC;QACtB,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,SAAS,CAAC,OAAO,CACpB,IAAI,CAAC,MAAM,EACX;YACE,eAAe,EAAE,CAAC,GAAG,gBAAgB,CAAC;YACtC,UAAU,EAAO,IAAI;SACtB,CACF,CAAC;IACJ,CAAC;IAEO,mBAAmB;QACzB,IAAI,CAAC,SAAS,EAAE,UAAU,EAAE,CAAC;QAC7B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;IAEO,sBAAsB;QAC5B,IAAI,IAAI,CAAC,uBAAuB,EAAE,CAAC;YACjC,MAAM,CAAC,cAAc,CACnB,IAAI,CAAC,MAAM,EACX,gBAAgB,EAChB,IAAI,CAAC,uBAAuB,CAC7B,CAAC;YACF,OAAO;QACT,CAAC;QAED,OAAO,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC;IACpC,CAAC;CACF;AAED,SAAS,cAAc,CACrB,MAAmB;IAEnB,MAAM,CAAC,cAAc,EAAE,CAAC;AAC1B,CAAC;AAED,SAAS,gBAAgB,CACvB,OAAe;IAEf,OAAO,IAAI,YAAY,CACrB,OAAO,EACP,YAAY,CACb,CAAC;AACJ,CAAC","sourcesContent":["import { ContextConsumer } from '@lit/context';\nimport { Task } from '@lit/task';\nimport type {\n ReactiveController,\n ReactiveControllerHost\n} from 'lit';\n\nimport type { BdComputeResult } from '@/compute/compute.expand.js';\nimport { bdComputeContext } from '@/contexts/context.compute.js';\nimport {\n bdScopeContext,\n type BdScope\n} from '@/contexts/context.scope.js';\nimport { dispatchBdNodeTrackWork } from '@/core/node.element.js';\nimport { renderAttributes } from './attributes/index.js';\nimport { createRenderContext } from './context.js';\nimport { OBS_ATTRS_RENDER } from './observe.js';\n\nexport type BdRenderTarget = HTMLElement & {\n updateComplete?: Promise<boolean>;\n};\n\ntype UpdateCompleteDescriptor =\n PropertyDescriptor | undefined;\n\ntype RenderArgs = readonly [\n scope: BdScope | undefined,\n computeResult: BdComputeResult | undefined\n];\n\n/**\n * Invisible render wrapper for a regular HTML render target.\n *\n * It implements the minimal ReactiveControllerHost surface needed by\n * ContextConsumer, but delegates dispatchEvent to the target element. That\n * makes the target the context request entrypoint without adding a wrapper\n * element to the DOM.\n */\nexport class BdRenderWrapper implements ReactiveControllerHost {\n scope?: BdScope;\n\n private readonly _controllers = new Set<ReactiveController>();\n private readonly _originalUpdateComplete?: UpdateCompleteDescriptor;\n private readonly _renderTask : Task<RenderArgs, boolean>;\n private _observer? : MutationObserver;\n private _connected = false;\n private _updateComplete : Promise<boolean> = Promise.resolve(true);\n private _computeResult? : BdComputeResult;\n\n constructor(\n readonly target: BdRenderTarget\n ) {\n this._renderTask =\n new Task<RenderArgs, boolean>(\n this,\n {\n autoRun: false,\n task : async ([\n scope,\n computeResult\n ], { signal }) => {\n throwIfAborted(signal);\n\n await renderAttributes(\n this.target,\n createRenderContext(\n scope,\n computeResult\n )\n );\n\n throwIfAborted(signal);\n\n return true;\n }\n }\n );\n\n this._originalUpdateComplete =\n Object.getOwnPropertyDescriptor(\n target,\n 'updateComplete'\n );\n\n Object.defineProperty(\n target,\n 'updateComplete',\n {\n configurable: true,\n get : () => this.updateComplete\n }\n );\n\n /**\n * ContextConsumer expects a ReactiveControllerHost & HTMLElement.\n * This wrapper is headless, so we intentionally provide the minimal\n * host surface and delegate dispatchEvent() to the real target element.\n */\n new ContextConsumer(\n this as unknown as ReactiveControllerHost & HTMLElement,\n {\n context : bdScopeContext,\n subscribe: true,\n callback : (scope) => {\n this.scope = scope;\n this._queueRender();\n }\n }\n );\n\n new ContextConsumer(\n this as unknown as ReactiveControllerHost & HTMLElement,\n {\n context : bdComputeContext,\n subscribe: true,\n callback : (computeResult) => {\n this._computeResult = computeResult;\n this._queueRender();\n }\n }\n );\n }\n\n get updateComplete(): Promise<boolean> {\n return this._updateComplete;\n }\n\n addController(\n controller: ReactiveController\n ): void {\n this._controllers.add(controller);\n }\n\n removeController(\n controller: ReactiveController\n ): void {\n this._controllers.delete(controller);\n }\n\n requestUpdate(): void {\n // Task status changes call host.requestUpdate(). This headless host has no\n // update lifecycle, and queueing here would recursively trigger renders.\n }\n\n dispatchEvent(\n event: Event\n ): boolean {\n return this.target.dispatchEvent(event);\n }\n\n connect(): void {\n if (this._connected) {\n return;\n }\n\n this._connected = true;\n this._observeTarget();\n\n for (const controller of this._controllers) {\n controller.hostConnected?.();\n }\n\n this._queueRender();\n }\n\n disconnect(): void {\n if (!this._connected) {\n return;\n }\n\n this._connected = false;\n this._disconnectObserver();\n this._renderTask.abort(\n createAbortError('BdRenderWrapper disconnected.')\n );\n\n for (const controller of this._controllers) {\n controller.hostDisconnected?.();\n }\n\n this._restoreUpdateComplete();\n }\n\n renderTarget(): Promise<boolean> {\n this._queueRender();\n return this.updateComplete;\n }\n\n private _queueRender(): void {\n if (!this._connected) {\n return;\n }\n\n this._renderTask.run([\n this.scope,\n this._computeResult\n ] as const);\n\n const promise = this._renderTask.taskComplete;\n\n this._updateComplete = promise;\n\n dispatchBdNodeTrackWork(\n this.target,\n this,\n promise\n );\n }\n\n private _observeTarget(): void {\n this._disconnectObserver();\n\n if (typeof MutationObserver === 'undefined') {\n return;\n }\n\n this._observer = new MutationObserver(() => {\n this._queueRender();\n });\n\n this._observer.observe(\n this.target,\n {\n attributeFilter: [...OBS_ATTRS_RENDER],\n attributes : true\n }\n );\n }\n\n private _disconnectObserver(): void {\n this._observer?.disconnect();\n this._observer = undefined;\n }\n\n private _restoreUpdateComplete(): void {\n if (this._originalUpdateComplete) {\n Object.defineProperty(\n this.target,\n 'updateComplete',\n this._originalUpdateComplete\n );\n return;\n }\n\n delete this.target.updateComplete;\n }\n}\n\nfunction throwIfAborted(\n signal: AbortSignal\n): void {\n signal.throwIfAborted();\n}\n\nfunction createAbortError(\n message: string\n): DOMException {\n return new DOMException(\n message,\n 'AbortError'\n );\n}\n"]}
@@ -1,9 +1,6 @@
1
1
  import { Eta } from 'eta/core';
2
- // Single Eta engine instance used across nodes
3
2
  const eta = new Eta({
4
- // We control where templates are injected (text nodes), so auto-escape can remain default.
5
- // Configure here if you want escaping behavior to change globally.
6
- tags: ["{{", "}}"]
3
+ tags: ['{{', '}}']
7
4
  });
8
5
  export default eta;
9
6
  //# sourceMappingURL=eta.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"eta.js","sourceRoot":"","sources":["../../../src/templating/eta.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,+CAA+C;AAC/C,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC;IAClB,2FAA2F;IAC3F,mEAAmE;IACnE,IAAI,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC;CACnB,CAAC,CAAC;AAEH,eAAe,GAAG,CAAC","sourcesContent":["import { Eta } from 'eta/core';\n\n// Single Eta engine instance used across nodes\nconst eta = new Eta({\n // We control where templates are injected (text nodes), so auto-escape can remain default.\n // Configure here if you want escaping behavior to change globally.\n tags: [\"{{\", \"}}\"]\n});\n\nexport default eta;\n"]}
1
+ {"version":3,"file":"eta.js","sourceRoot":"","sources":["../../../src/templating/eta.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC;IAClB,IAAI,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC;CACnB,CAAC,CAAC;AAEH,eAAe,GAAG,CAAC","sourcesContent":["import { Eta } from 'eta/core';\n\nconst eta = new Eta({\n tags: ['{{', '}}']\n});\n\nexport default eta;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@repobit/dex-store-elements",
3
- "version": "1.7.3",
3
+ "version": "2.0.1",
4
4
  "description": "HTML elements layer for pricings",
5
5
  "author": "Buga Adrian Alexandru <abuga@bitdefender.com>",
6
6
  "homepage": "https://github.com/bitdefender/dex-core#readme",
@@ -52,9 +52,8 @@
52
52
  "dependencies": {
53
53
  "@lit/context": "^1.1.6",
54
54
  "@lit/task": "^1.0.3",
55
- "@repobit/dex-store": "1.5.3",
56
- "eta": "^4.5.1",
57
- "nanomorph": "^5.4.3"
55
+ "@repobit/dex-store": "1.5.5",
56
+ "eta": "^4.5.1"
58
57
  },
59
58
  "contributes": {
60
59
  "html": {
@@ -63,5 +62,5 @@
63
62
  ]
64
63
  }
65
64
  },
66
- "gitHead": "b599e9104c9a9150994815b26a4f65a466195830"
65
+ "gitHead": "c7c8073704b604d773bfec0a9b570ab318910ac3"
67
66
  }
@@ -1,2 +0,0 @@
1
- import { ActionNode } from "./utilty.js";
2
- export declare const button: (el: ActionNode) => void;
@@ -1,8 +0,0 @@
1
- import { addEventListener, dispatchActionAttributes, readClickAttributes } from "./utilty.js";
2
- export const button = (el) => {
3
- const onClick = () => {
4
- dispatchActionAttributes(el, readClickAttributes(el));
5
- };
6
- addEventListener(el, "click", onClick);
7
- };
8
- //# sourceMappingURL=action.button.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"action.button.js","sourceRoot":"","sources":["../../../src/actions/action.button.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,gBAAgB,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAEvG,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,EAAc,EAAE,EAAE;IACvC,MAAM,OAAO,GAAG,GAAG,EAAE;QACnB,wBAAwB,CAAC,EAAE,EAAE,mBAAmB,CAAC,EAAE,CAAC,CAAC,CAAC;IACxD,CAAC,CAAC;IAEF,gBAAgB,CAAC,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;AACzC,CAAC,CAAA","sourcesContent":["import { ActionNode, addEventListener, dispatchActionAttributes, readClickAttributes } from \"./utilty\";\n\nexport const button = (el: ActionNode) => {\n const onClick = () => {\n dispatchActionAttributes(el, readClickAttributes(el));\n };\n\n addEventListener(el, \"click\", onClick);\n}\n"]}
@@ -1,2 +0,0 @@
1
- import { ActionNode } from "./utilty.js";
2
- export declare const input: (el: ActionNode<HTMLInputElement>) => void;
@@ -1,43 +0,0 @@
1
- import { addEventListener, dispatchActionAttributes, readClickAttributes } from "./utilty.js";
2
- const toOptionalNumber = (value) => {
3
- const trimmed = value.trim();
4
- if (!trimmed)
5
- return undefined;
6
- const parsed = Number(trimmed);
7
- return Number.isNaN(parsed) ? undefined : parsed;
8
- };
9
- export const input = (el) => {
10
- const dispatchClickAction = () => {
11
- dispatchActionAttributes(el, readClickAttributes(el));
12
- };
13
- const dispatchDeltaFromValue = () => {
14
- const attr = readClickAttributes(el);
15
- if (!('type' in attr))
16
- return;
17
- const delta = toOptionalNumber(el.value);
18
- if (delta === undefined)
19
- return;
20
- dispatchActionAttributes(el, {
21
- type: attr.type,
22
- delta,
23
- min: toOptionalNumber(el.min),
24
- max: toOptionalNumber(el.max),
25
- useAsValue: true,
26
- storeId: attr.storeId
27
- });
28
- };
29
- switch (el.type) {
30
- case "checkbox":
31
- case "radio":
32
- if (el.checked) {
33
- dispatchClickAction();
34
- }
35
- addEventListener(el, "click", dispatchClickAction);
36
- break;
37
- case "text":
38
- case "number":
39
- addEventListener(el, "change", dispatchDeltaFromValue);
40
- break;
41
- }
42
- };
43
- //# sourceMappingURL=action.input.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"action.input.js","sourceRoot":"","sources":["../../../src/actions/action.input.ts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,UAAU,CAAC;QAChB,KAAK,OAAO;YACV,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC;gBACf,mBAAmB,EAAE,CAAC;YACxB,CAAC;YACD,gBAAgB,CAAC,EAAE,EAAE,OAAO,EAAE,mBAAmB,CAAC,CAAC;YACnD,MAAM;QACR,KAAK,MAAM,CAAC;QACZ,KAAK,QAAQ;YACX,gBAAgB,CAAC,EAAE,EAAE,QAAQ,EAAE,sBAAsB,CAAC,CAAC;YACvD,MAAM;IACV,CAAC;AACH,CAAC,CAAA","sourcesContent":["import { ActionNode, addEventListener, dispatchActionAttributes, readClickAttributes } from \"./utilty\";\n\nconst toOptionalNumber = (value: string): number | undefined => {\n const trimmed = value.trim();\n if (!trimmed) return undefined;\n const parsed = Number(trimmed);\n return Number.isNaN(parsed) ? undefined : parsed;\n};\n\nexport const input = (el: ActionNode<HTMLInputElement>) => {\n const dispatchClickAction = () => {\n dispatchActionAttributes(el, readClickAttributes(el));\n };\n\n const dispatchDeltaFromValue = () => {\n const attr = readClickAttributes(el);\n if (!('type' in attr)) return;\n\n const delta = toOptionalNumber(el.value);\n if (delta === undefined) return;\n\n dispatchActionAttributes(el, {\n type : attr.type,\n delta,\n min : toOptionalNumber(el.min),\n max : toOptionalNumber(el.max),\n useAsValue: true,\n storeId : attr.storeId\n });\n };\n\n switch (el.type) {\n case \"checkbox\":\n case \"radio\":\n if (el.checked) {\n dispatchClickAction();\n }\n addEventListener(el, \"click\", dispatchClickAction);\n break;\n case \"text\":\n case \"number\":\n addEventListener(el, \"change\", dispatchDeltaFromValue);\n break;\n }\n}\n"]}
@@ -1,2 +0,0 @@
1
- import { ActionNode } from "./utilty.js";
2
- export declare const select: (el: ActionNode<HTMLSelectElement>) => void;
@@ -1,14 +0,0 @@
1
- import { addEventListener, dispatchActionAttributes, readClickAttributes } from "./utilty.js";
2
- export const select = (el) => {
3
- const onChange = () => {
4
- const selected = el.selectedOptions[0];
5
- if (!selected)
6
- return;
7
- const attr = readClickAttributes(selected);
8
- if ('type' in attr)
9
- return;
10
- dispatchActionAttributes(el, attr);
11
- };
12
- addEventListener(el, "change", onChange);
13
- };
14
- //# sourceMappingURL=action.select.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"action.select.js","sourceRoot":"","sources":["../../../src/actions/action.select.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,gBAAgB,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAEvG,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,EAAiC,EAAE,EAAE;IAC1D,MAAM,QAAQ,GAAG,GAAG,EAAE;QACpB,MAAM,QAAQ,GAAG,EAAE,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;QACvC,IAAI,CAAC,QAAQ;YAAE,OAAO;QAEtB,MAAM,IAAI,GAAG,mBAAmB,CAAC,QAAQ,CAAC,CAAC;QAC3C,IAAI,MAAM,IAAI,IAAI;YAAE,OAAO;QAC3B,wBAAwB,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;IACrC,CAAC,CAAC;IAEF,gBAAgB,CAAC,EAAE,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;AAC3C,CAAC,CAAA","sourcesContent":["import { ActionNode, addEventListener, dispatchActionAttributes, readClickAttributes } from \"./utilty\";\n\nexport const select = (el: ActionNode<HTMLSelectElement>) => {\n const onChange = () => {\n const selected = el.selectedOptions[0];\n if (!selected) return;\n\n const attr = readClickAttributes(selected);\n if ('type' in attr) return;\n dispatchActionAttributes(el, attr);\n };\n\n addEventListener(el, \"change\", onChange);\n}\n"]}
@@ -1,16 +0,0 @@
1
- import { Action, UpdateByDelta } from "../events/events.js";
2
- export type ActionAttributes = UpdateByDelta | Action;
3
- type WithStore = {
4
- storeName: symbol;
5
- updateComplete: Promise<void>;
6
- };
7
- export type ActionNode<T extends HTMLElement = HTMLElement> = T & WithStore;
8
- export declare const DATA_ACTION_NODE = "[data-store-action]";
9
- export declare const readClickAttributes: (el: HTMLElement) => ActionAttributes;
10
- export declare const dispatchActionAttributes: (el: HTMLElement, attr: ActionAttributes) => void;
11
- export declare const connectedCallback: (el: ActionNode) => void;
12
- export declare const disconnectedCallback: (el: ActionNode) => void;
13
- export declare const handleActionNode: (node: ActionNode) => void;
14
- export declare const cleanupActionNode: (node: ActionNode) => void;
15
- export declare const addEventListener: (el: HTMLElement, type: "click" | "change", listener: (event: Event) => void) => void;
16
- export {};
@@ -1,149 +0,0 @@
1
- import { ActionEvent, CollectActionEvent, CollectUpdateByDeltaEvent, UpdateByDeltaEvent } from "../events/events.js";
2
- import { button } from "./action.button.js";
3
- import { input } from "./action.input.js";
4
- import { select } from "./action.select.js";
5
- export const DATA_ACTION_NODE = "[data-store-action]";
6
- // Track initialized action nodes to ensure we don't wire them up twice
7
- const ACTION_BOUND = new WeakSet();
8
- const ACTION_LISTENER_DISPOSERS = new WeakMap();
9
- const ACTION_ORIGINAL_REMOVE = new WeakMap();
10
- const shouldCollectForNode = (el) => !(el.dataset.storeNoCollect === '' || el.dataset.storeNoCollect === 'true');
11
- const disconnectCollectedAction = (el) => {
12
- if (el instanceof HTMLSelectElement) {
13
- [...el.options].forEach((option) => disconnectedCallback(option));
14
- return;
15
- }
16
- disconnectedCallback(el);
17
- };
18
- const teardownActionNode = (node) => {
19
- const hadState = ACTION_BOUND.has(node)
20
- || ACTION_LISTENER_DISPOSERS.has(node)
21
- || ACTION_ORIGINAL_REMOVE.has(node);
22
- if (!hadState)
23
- return;
24
- disconnectCollectedAction(node);
25
- const listenerDisposers = ACTION_LISTENER_DISPOSERS.get(node);
26
- if (listenerDisposers) {
27
- for (const dispose of listenerDisposers) {
28
- dispose();
29
- }
30
- ACTION_LISTENER_DISPOSERS.delete(node);
31
- }
32
- const originalRemove = ACTION_ORIGINAL_REMOVE.get(node);
33
- if (originalRemove) {
34
- node.remove = originalRemove;
35
- }
36
- ACTION_ORIGINAL_REMOVE.delete(node);
37
- ACTION_BOUND.delete(node);
38
- };
39
- export const readClickAttributes = (el) => {
40
- const ds = el.dataset;
41
- const storeId = ds.storeId || undefined;
42
- if ('storeSetType' in ds) {
43
- return {
44
- type: ds.storeSetType,
45
- delta: ds.storeSetDelta === "next" || ds.storeSetDelta === "prev" ? ds.storeSetDelta : Number(ds.storeSetDelta),
46
- min: Number(ds.storeSetMin) || undefined,
47
- max: Number(ds.storeSetMax) || undefined,
48
- useAsValue: ds.storeSetUseAsValue === 'true' || ds.storeSetUseAsValue === '' || false,
49
- storeId
50
- };
51
- }
52
- else {
53
- return {
54
- devices: Number(ds.storeSetDevices) || undefined,
55
- subscription: Number(ds.storeSetSubscription) || undefined,
56
- id: ds.storeSetId,
57
- campaign: ds.storeSetCampaign,
58
- bundle: ds.storeSetBundle === 'true' || ds.storeSetBundle === '' || false,
59
- storeId
60
- };
61
- }
62
- };
63
- export const dispatchActionAttributes = (el, attr) => {
64
- if ('type' in attr) {
65
- el.dispatchEvent(new UpdateByDeltaEvent(attr));
66
- return;
67
- }
68
- el.dispatchEvent(new ActionEvent(attr));
69
- };
70
- const addLogic = async (el) => {
71
- if (el.updateComplete) {
72
- await el.updateComplete;
73
- }
74
- if (el instanceof HTMLInputElement) {
75
- connectedCallback(el);
76
- input(el);
77
- return;
78
- }
79
- if (el instanceof HTMLSelectElement) {
80
- [...el.options]
81
- .forEach(option => connectedCallback(option));
82
- select(el);
83
- return;
84
- }
85
- //treat everything else as a button
86
- button(el);
87
- connectedCallback(el);
88
- };
89
- export const connectedCallback = (el) => {
90
- if (!el.storeName) {
91
- el.storeName = Symbol("action");
92
- }
93
- const attr = readClickAttributes(el);
94
- if (shouldCollectForNode(el)) {
95
- if ('type' in attr) {
96
- el.dispatchEvent(new CollectUpdateByDeltaEvent({ name: el.storeName, update: attr }));
97
- }
98
- else {
99
- el.dispatchEvent(new CollectActionEvent({ name: el.storeName, action: attr }));
100
- }
101
- }
102
- };
103
- export const disconnectedCallback = (el) => {
104
- const attr = readClickAttributes(el);
105
- if (shouldCollectForNode(el)) {
106
- if ('type' in attr) {
107
- el.dispatchEvent(new CollectUpdateByDeltaEvent({
108
- name: el.storeName,
109
- update: null
110
- }));
111
- }
112
- else {
113
- el.dispatchEvent(new CollectActionEvent({
114
- name: el.storeName,
115
- action: null
116
- }));
117
- }
118
- }
119
- };
120
- export const handleActionNode = (node) => {
121
- if (ACTION_BOUND.has(node))
122
- return;
123
- ACTION_BOUND.add(node);
124
- addLogic(node);
125
- };
126
- export const cleanupActionNode = (node) => {
127
- teardownActionNode(node);
128
- };
129
- export const addEventListener = (el, type, listener) => {
130
- el.addEventListener(type, listener);
131
- let listenerDisposers = ACTION_LISTENER_DISPOSERS.get(el);
132
- if (!listenerDisposers) {
133
- listenerDisposers = new Set();
134
- ACTION_LISTENER_DISPOSERS.set(el, listenerDisposers);
135
- }
136
- listenerDisposers.add(() => {
137
- el.removeEventListener(type, listener);
138
- });
139
- const actionEl = el;
140
- if (!ACTION_ORIGINAL_REMOVE.has(actionEl)) {
141
- const originalRemove = actionEl.remove;
142
- ACTION_ORIGINAL_REMOVE.set(actionEl, originalRemove);
143
- actionEl.remove = () => {
144
- teardownActionNode(actionEl);
145
- originalRemove.call(actionEl);
146
- };
147
- }
148
- };
149
- //# sourceMappingURL=utilty.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utilty.js","sourceRoot":"","sources":["../../../src/actions/utilty.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,WAAW,EAAE,kBAAkB,EAAE,yBAAyB,EAAiB,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACxI,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAQzC,MAAM,CAAC,MAAM,gBAAgB,GAAG,qBAAqB,CAAC;AAEtD,uEAAuE;AACvE,MAAM,YAAY,GAAG,IAAI,OAAO,EAAc,CAAC;AAC/C,MAAM,yBAAyB,G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AAC3B,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,EAAe,EAAE,IAAwB,EAAE,QAAgC,EAAE,EAAE;IAC9G,EAAE,CAAC,gBAAgB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAEpC,IAAI,iBAAiB,GAAG,yBAAyB,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAC1D,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACvB,iBAAiB,GAAG,IAAI,GAAG,EAAc,CAAC;QAC1C,yBAAyB,CAAC,GAAG,CAAC,EAAE,EAAE,iBAAiB,CAAC,CAAC;IACvD,CAAC;IACD,iBAAiB,CAAC,GAAG,CAAC,GAAG,EAAE;QACzB,EAAE,CAAC,mBAAmB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IACzC,CAAC,CAAC,CAAC;IAEH,MAAM,QAAQ,GAAG,EAAgB,CAAC;IAClC,IAAI,CAAC,sBAAsB,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC1C,MAAM,cAAc,GAAG,QAAQ,CAAC,MAAM,CAAC;QACvC,sBAAsB,CAAC,GAAG,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC;QAErD,QAAQ,CAAC,MAAM,GAAG,GAAG,EAAE;YACrB,kBAAkB,CAAC,QAAQ,CAAC,CAAC;YAC7B,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAChC,CAAC,CAAA;IACH,CAAC;AACH,CAAC,CAAA","sourcesContent":["import { Action, ActionEvent, CollectActionEvent, CollectUpdateByDeltaEvent, UpdateByDelta, UpdateByDeltaEvent } from \"@/events/events\";\nimport { button } from \"./action.button\";\nimport { input } from \"./action.input\";\nimport { select } from \"./action.select\";\n\nexport type ActionAttributes = UpdateByDelta | Action;\ntype WithStore = {\n storeName : symbol;\n updateComplete: Promise<void>;\n};\nexport type ActionNode<T extends HTMLElement = HTMLElement> = T & WithStore;\nexport const DATA_ACTION_NODE = \"[data-store-action]\";\n\n// Track initialized action nodes to ensure we don't wire them up twice\nconst ACTION_BOUND = new WeakSet<ActionNode>();\nconst ACTION_LISTENER_DISPOSERS = new WeakMap<HTMLElement, Set<() => void>>();\nconst ACTION_ORIGINAL_REMOVE = new WeakMap<ActionNode, () => void>();\n\nconst shouldCollectForNode = (el: HTMLElement) => !(el.dataset.storeNoCollect === '' || el.dataset.storeNoCollect === 'true');\n\nconst disconnectCollectedAction = (el: ActionNode) => {\n if (el instanceof HTMLSelectElement) {\n [...el.options].forEach((option) => disconnectedCallback(option as unknown as ActionNode));\n return;\n }\n\n disconnectedCallback(el);\n};\n\nconst teardownActionNode = (node: ActionNode) => {\n const hadState =\n ACTION_BOUND.has(node)\n || ACTION_LISTENER_DISPOSERS.has(node)\n || ACTION_ORIGINAL_REMOVE.has(node);\n if (!hadState) return;\n\n disconnectCollectedAction(node);\n\n const listenerDisposers = ACTION_LISTENER_DISPOSERS.get(node);\n if (listenerDisposers) {\n for (const dispose of listenerDisposers) {\n dispose();\n }\n ACTION_LISTENER_DISPOSERS.delete(node);\n }\n\n const originalRemove = ACTION_ORIGINAL_REMOVE.get(node);\n if (originalRemove) {\n node.remove = originalRemove;\n }\n\n ACTION_ORIGINAL_REMOVE.delete(node);\n ACTION_BOUND.delete(node);\n};\n\nexport const readClickAttributes = (el: HTMLElement): ActionAttributes => {\n const ds = el.dataset;\n const storeId = ds.storeId || undefined;\n\n if ('storeSetType' in ds) {\n return {\n type : ds.storeSetType as UpdateByDelta[\"type\"],\n delta : ds.storeSetDelta === \"next\" || ds.storeSetDelta === \"prev\" ? ds.storeSetDelta : Number(ds.storeSetDelta),\n min : Number(ds.storeSetMin) || undefined,\n max : Number(ds.storeSetMax) || undefined,\n useAsValue: ds.storeSetUseAsValue === 'true' || ds.storeSetUseAsValue === '' || false,\n storeId\n };\n } else {\n return {\n devices : Number(ds.storeSetDevices) || undefined,\n subscription: Number(ds.storeSetSubscription) || undefined,\n id : ds.storeSetId,\n campaign : ds.storeSetCampaign,\n bundle : ds.storeSetBundle === 'true' || ds.storeSetBundle === '' || false,\n storeId\n };\n }\n};\n\nexport const dispatchActionAttributes = (el: HTMLElement, attr: ActionAttributes) => {\n if ('type' in attr) {\n el.dispatchEvent(new UpdateByDeltaEvent(attr));\n return;\n }\n\n el.dispatchEvent(new ActionEvent(attr));\n};\n\nconst addLogic = async (el: ActionNode) => {\n if (el.updateComplete) {\n await el.updateComplete;\n }\n\n if (el instanceof HTMLInputElement) {\n connectedCallback(el);\n input(el);\n return;\n }\n\n if (el instanceof HTMLSelectElement) {\n [...el.options]\n .forEach(option => connectedCallback(option as unknown as ActionNode));\n select(el);\n return;\n }\n\n //treat everything else as a button\n button(el);\n connectedCallback(el);\n};\n\nexport const connectedCallback = (el: ActionNode) => {\n if (!el.storeName) {\n el.storeName = Symbol(\"action\");\n }\n\n const attr = readClickAttributes(el);\n if (shouldCollectForNode(el)) {\n if ('type' in attr) {\n el.dispatchEvent(new CollectUpdateByDeltaEvent({ name: el.storeName, update: attr }));\n } else {\n el.dispatchEvent(new CollectActionEvent({ name: el.storeName, action: attr }));\n }\n }\n};\n\nexport const disconnectedCallback = (el: ActionNode) => {\n const attr = readClickAttributes(el);\n if (shouldCollectForNode(el)) {\n if ('type' in attr) {\n el.dispatchEvent(new CollectUpdateByDeltaEvent({\n name : el.storeName,\n update: null\n }));\n } else {\n el.dispatchEvent(new CollectActionEvent({\n name : el.storeName,\n action: null\n }));\n }\n }\n};\n\nexport const handleActionNode = (node: ActionNode) => {\n if (ACTION_BOUND.has(node)) return;\n ACTION_BOUND.add(node);\n addLogic(node);\n};\n\nexport const cleanupActionNode = (node: ActionNode) => {\n teardownActionNode(node);\n};\n\nexport const addEventListener = (el: HTMLElement, type: \"click\" | \"change\", listener: (event: Event) => void) => {\n el.addEventListener(type, listener);\n\n let listenerDisposers = ACTION_LISTENER_DISPOSERS.get(el);\n if (!listenerDisposers) {\n listenerDisposers = new Set<() => void>();\n ACTION_LISTENER_DISPOSERS.set(el, listenerDisposers);\n }\n listenerDisposers.add(() => {\n el.removeEventListener(type, listener);\n });\n\n const actionEl = el as ActionNode;\n if (!ACTION_ORIGINAL_REMOVE.has(actionEl)) {\n const originalRemove = actionEl.remove;\n ACTION_ORIGINAL_REMOVE.set(actionEl, originalRemove);\n\n actionEl.remove = () => {\n teardownActionNode(actionEl);\n originalRemove.call(actionEl);\n }\n }\n}\n"]}
@@ -1,9 +0,0 @@
1
- import type { ProductOption } from '@repobit/dex-store';
2
- export type dataLayerPayload = {
3
- option: ProductOption;
4
- event: "all" | "info" | "comparison" | (string & {});
5
- };
6
- export type dataLayerContextType = ((payload: dataLayerPayload) => void) | undefined;
7
- export declare const dataLayerContext: {
8
- __context__: dataLayerContextType;
9
- };
@@ -1,3 +0,0 @@
1
- import { createContext } from '@lit/context';
2
- export const dataLayerContext = createContext(Symbol('dataLayer'));
3
- //# sourceMappingURL=context.datalayer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"context.datalayer.js","sourceRoot":"","sources":["../../../src/contexts/context.datalayer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAU7C,MAAM,CAAC,MAAM,gBAAgB,GAAG,aAAa,CAAuB,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC","sourcesContent":["import { createContext } from '@lit/context';\nimport type { ProductOption } from '@repobit/dex-store';\n\nexport type dataLayerPayload = {\n option: ProductOption;\n event : \"all\" | \"info\" | \"comparison\" | (string & {});\n};\n\nexport type dataLayerContextType = ((payload: dataLayerPayload) => void) | undefined;\n\nexport const dataLayerContext = createContext<dataLayerContextType>(Symbol('dataLayer'));\n\n"]}
@@ -1,12 +0,0 @@
1
- import { Product, ProductOption, Store } from '@repobit/dex-store';
2
- import { stateContextType } from './context.state.js';
3
- export type Params = {
4
- product?: Product | null;
5
- option?: ProductOption | null;
6
- state?: stateContextType;
7
- store?: Store;
8
- };
9
- export type derivedContextType = (param: Params) => Promise<Record<string, unknown>>;
10
- export declare const derivedContext: {
11
- __context__: derivedContextType | null | undefined;
12
- };
@@ -1,3 +0,0 @@
1
- import { createContext } from '@lit/context';
2
- export const derivedContext = createContext(Symbol('derived'));
3
- //# sourceMappingURL=context.derived.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"context.derived.js","sourceRoot":"","sources":["../../../src/contexts/context.derived.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAa7C,MAAM,CAAC,MAAM,cAAc,GAAG,aAAa,CAAwC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC","sourcesContent":["import { createContext } from '@lit/context';\nimport { Product, ProductOption, Store } from '@repobit/dex-store';\nimport { stateContextType } from './context.state';\n\nexport type Params = {\n product?: Product | null,\n option? : ProductOption | null,\n state? : stateContextType,\n store? : Store\n};\n\nexport type derivedContextType = (param: Params) => Promise<Record<string, unknown>>\n\nexport const derivedContext = createContext<derivedContextType | undefined | null>(Symbol('derived'));"]}
@@ -1,5 +0,0 @@
1
- import { ProductOption } from '@repobit/dex-store';
2
- export type optionContextType = Promise<ProductOption | null | undefined> | undefined;
3
- export declare const optionContext: {
4
- __context__: optionContextType;
5
- };
@@ -1,3 +0,0 @@
1
- import { createContext } from '@lit/context';
2
- export const optionContext = createContext(Symbol('option'));
3
- //# sourceMappingURL=context.option.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"context.option.js","sourceRoot":"","sources":["../../../src/contexts/context.option.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAI7C,MAAM,CAAC,MAAM,aAAa,GAAG,aAAa,CAAoB,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC","sourcesContent":["import { createContext } from '@lit/context';\nimport { ProductOption } from '@repobit/dex-store';\n\nexport type optionContextType = Promise<ProductOption | null | undefined> | undefined\nexport const optionContext = createContext<optionContextType>(Symbol('option'));"]}
@@ -1,5 +0,0 @@
1
- import type { Product } from '@repobit/dex-store';
2
- export type productContextType = Product | null | undefined;
3
- export declare const productContext: {
4
- __context__: productContextType;
5
- };
@@ -1,3 +0,0 @@
1
- import { createContext } from '@lit/context';
2
- export const productContext = createContext(Symbol('product'));
3
- //# sourceMappingURL=context.product.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"context.product.js","sourceRoot":"","sources":["../../../src/contexts/context.product.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAI7C,MAAM,CAAC,MAAM,cAAc,GAAG,aAAa,CAAqB,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC","sourcesContent":["import { createContext } from '@lit/context';\nimport type { Product } from '@repobit/dex-store';\n\nexport type productContextType = Product | null | undefined;\nexport const productContext = createContext<productContextType>(Symbol('product'));\n\n"]}
@@ -1,28 +0,0 @@
1
- export type MinMax = {
2
- min: {
3
- value: number;
4
- fmt: string;
5
- };
6
- max: {
7
- value: number;
8
- fmt: string;
9
- };
10
- };
11
- type Price = MinMax & {
12
- monthly: MinMax;
13
- };
14
- type Discount = MinMax & {
15
- monthly: MinMax;
16
- percentage: MinMax & {
17
- monthly: MinMax;
18
- };
19
- };
20
- export type stateContextType = {
21
- price: Price;
22
- discountedPrice: Price;
23
- discount: Discount;
24
- };
25
- export declare const stateContext: {
26
- __context__: stateContextType;
27
- };
28
- export {};
@@ -1,3 +0,0 @@
1
- import { createContext } from '@lit/context';
2
- export const stateContext = createContext(Symbol('state'));
3
- //# sourceMappingURL=context.state.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"context.state.js","sourceRoot":"","sources":["../../../src/contexts/context.state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAuB7C,MAAM,CAAC,MAAM,YAAY,GAAG,aAAa,CAAmB,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC","sourcesContent":["import { createContext } from '@lit/context';\n\nexport type MinMax = {\n min: { value: number, fmt: string };\n max: { value: number, fmt: string };\n}\n\ntype Price = MinMax & {\n monthly: MinMax\n}\n\ntype Discount = MinMax & {\n monthly : MinMax,\n percentage: MinMax & {\n monthly: MinMax\n }\n}\n\nexport type stateContextType = {\n price : Price;\n discountedPrice: Price;\n discount : Discount;\n}\nexport const stateContext = createContext<stateContextType>(Symbol('state'));"]}
@@ -1,5 +0,0 @@
1
- import { Store } from '@repobit/dex-store';
2
- export type storeContextType = Store | undefined;
3
- export declare const storeContext: {
4
- __context__: storeContextType;
5
- };
@@ -1,3 +0,0 @@
1
- import { createContext } from '@lit/context';
2
- export const storeContext = createContext(Symbol('store'));
3
- //# sourceMappingURL=context.store.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"context.store.js","sourceRoot":"","sources":["../../../src/contexts/context.store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAI7C,MAAM,CAAC,MAAM,YAAY,GAAG,aAAa,CAAmB,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC","sourcesContent":["import { createContext } from '@lit/context';\nimport { Store } from '@repobit/dex-store';\n\nexport type storeContextType = Store | undefined\nexport const storeContext = createContext<storeContextType>(Symbol('store'));"]}