@repobit/dex-store-elements 1.7.2 → 2.0.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 (227) hide show
  1. package/CHANGELOG.md +5 -905
  2. package/README.md +9 -7
  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 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/eta/types.ts"],"names":[],"mappings":"AAAA,mBAAmB","sourcesContent":["// src/eta/types.ts\n\n/**\n * Shared type definitions for the Eta template subsystem.\n *\n * The subsystem is split into small, single-responsibility pieces:\n *\n * MutationObserver\n * -> translates DOM mutations into TemplateIndexMutation values\n *\n * EtaTemplateIndex\n * -> maintains the operation index for a scoped boundary\n *\n * TemplateOperationFactory\n * -> discovers templates and compiles them via EtaTemplateCache\n *\n * TextOperation / AttributeOperation\n * -> render a single DOM target against a context\n *\n * EtaTemplateController\n * -> owns lifecycle, the Task schedule, and the context builder\n *\n * EtaMutationBatcher\n * -> coalesces MutationRecord batches into a single\n * index flush per scheduled tick (round 6)\n *\n * Most of these layers are Eta-agnostic. Only the cache and factory know how\n * to talk to Eta. Everything else works on plain DOM nodes.\n */\n\n/**\n * Schedule mode for `EtaMutationBatcher` flushes.\n *\n * Defined here (rather than in `batcher.ts`) so consumers can\n * import the type without pulling the batcher module into a\n * type-only import cycle. The batcher re-exports the type for\n * direct importers.\n *\n * - `microtask` — flush via `queueMicrotask`. Lowest latency.\n * - `animation-frame` — flush via `requestAnimationFrame`.\n * Recommended default for browser hosts.\n * - `idle` — flush via `requestIdleCallback` (with a `setTimeout`\n * fallback). Lowest priority.\n * - `manual` — never auto-flush; the host owns the lifecycle.\n */\nexport type EtaMutationBatchSchedule =\n | 'microtask'\n | 'animation-frame'\n | 'idle'\n | 'manual';\n\nexport type EtaMutationBatchScheduleResolver = () =>\n | EtaMutationBatchSchedule\n | undefined;\n\nexport type EtaMutationBatchScheduleOption =\n | EtaMutationBatchSchedule\n | EtaMutationBatchScheduleResolver;\n\n/**\n * A precompiled Eta template function.\n *\n * `data` is the rendering context. The function returns a string. Eta exposes\n * `compile` as a member of the Eta class, so the function signature is\n * `(data?) => string`.\n */\nexport type EtaCompiledTemplate = (\n data?: object\n) => string;\n\n/**\n * Discriminated union describing a single change that should be reflected\n * in the template index.\n *\n * - `add` introduces a node that has not been seen before\n * - `remove` drops a node and all of its descendants\n * - `attribute` re-runs attribute discovery for a single attribute on an\n * element that is already part of the index\n * - `text` re-runs text discovery for a text node that is already part of\n * the index\n */\nexport type TemplateIndexMutation =\n | {\n readonly type: 'add';\n readonly node: Node;\n }\n | {\n readonly type: 'remove';\n readonly node: Node;\n }\n | {\n readonly type : 'attribute';\n readonly element : Element;\n readonly attribute: string;\n }\n | {\n readonly type: 'text';\n readonly node: Text;\n };\n\n/**\n * Anything that can absorb a TemplateIndexMutation.\n *\n * EtaMutationObserver and EtaTemplateIndex both satisfy this interface so\n * that they can be swapped in tests or composed by other layers.\n *\n * `apply` returns `true` only when the sink actually changed its\n * index as a result of the mutation. Returning `false` signals that\n * the mutation was ignored (the node was outside the index's root,\n * the attribute had no template, the boundary skipped the subtree,\n * etc.). The observer uses this signal to decide whether a render\n * pass needs to be scheduled, so returning the wrong value directly\n * causes either stale renders or unnecessary work.\n */\nexport interface TemplateIndexSink {\n apply(mutation: TemplateIndexMutation): boolean;\n}\n\n/**\n * A single immutable rendering operation.\n *\n * Operations are owned by a single DOM target (a text node or an attribute\n * of an element) and know nothing about template discovery, the index, or\n * the controller. They simply render their target against a context.\n *\n * The `dispose` method is currently a no-op for the built-in operations but\n * exists as an extension point for future implementations that may hold\n * observers, event listeners, or other resources.\n */\nexport interface TemplateOperation<\n TContext = object\n> {\n readonly owner: Node;\n\n readonly kind: 'text' | 'attribute';\n\n execute(context: TContext): void;\n\n dispose(): void;\n}\n\n/**\n * Structural surface used by `TemplateOperationContext.sources`.\n *\n * Defined here (rather than imported from `source-registry.ts`) so\n * `types.ts` stays a leaf module per the eta subsystem layout.\n * Any object that satisfies these four methods can stand in for\n * the real `EtaTemplateSourceRegistry` — tests can pass mocks\n * without pulling the registry module into a type-only cycle.\n */\nexport interface TemplateOperationSourceRegistry {\n readTextSource(node: Text): string | undefined;\n replaceTextSource(\n node: Text,\n source: string | undefined\n ): void;\n readAttributeSource(\n element: Element,\n name: string\n ): string | undefined;\n setAttributeSource(\n element: Element,\n name: string,\n source: string\n ): void;\n}\n\n/**\n * Per-call context passed into `TemplateOperationFactory.create*`\n * methods.\n *\n * Carries dependencies that the factory needs at discovery time\n * but does not own. Today the only such dependency is the\n * `EtaTemplateSourceRegistry`, which preserves original template\n * sources across renders. By threading the registry through every\n * factory call (rather than storing it on the factory instance)\n * the factory stays stateless at the call site and can safely be\n * shared across multiple indices — the registry is always the\n * one owned by the calling index.\n *\n * The context is optional: factory implementations that do not\n * need preserved sources can simply ignore it. Test fakes can\n * pass `undefined`.\n */\nexport interface TemplateOperationContext {\n /** Source registry for preserved original template sources. */\n readonly sources?: TemplateOperationSourceRegistry;\n}\n\n/**\n * Factory contract for producing TemplateOperation instances from DOM nodes.\n *\n * The factory is the only Eta-aware discovery layer. The collector simply\n * forwards raw DOM nodes to the factory and stores whatever comes back.\n *\n * A factory returns `undefined` when a node does not contain a template,\n * which lets the index skip irrelevant subtrees.\n *\n * The optional `context` parameter carries dependencies that the\n * factory needs at discovery time but does not own — currently\n * the source registry. The factory treats it as advisory: a\n * missing context means the factory does not have access to\n * preserved sources, so post-render reads fall back to the live\n * DOM value.\n */\nexport interface TemplateOperationFactory<\n TContext = object\n> {\n createTextOperation(\n node: Text,\n context?: TemplateOperationContext\n ): TemplateOperation<TContext> | undefined;\n\n createAttributeOperation(\n element: Element,\n attribute: Attr,\n context?: TemplateOperationContext\n ): TemplateOperation<TContext> | undefined;\n}\n\n/**\n * Cache for compiled Eta templates.\n *\n * Keys are the original template strings. The cache is the single owner of\n * template compilation. Neither the factory nor operations compile templates\n * directly.\n */\nexport interface EtaTemplateCache {\n get(source: string): EtaCompiledTemplate;\n\n clear(): void;\n\n /**\n * Number of compiled templates currently held in the cache.\n *\n * Optional because the structural minimum only describes what the\n * controller and factory need to drive a render pass. The\n * default `DefaultEtaTemplateCache` exposes `size`; tests and\n * diagnostics that read `cache.size` rely on this hook being\n * present, so the optional property documents the convention.\n *\n * `EtaTemplateController.#cache` is now a true ECMAScript\n * private field and cannot be observed from outside the\n * controller, but the host can still construct the cache\n * directly and read `size` for diagnostics.\n */\n readonly size?: number;\n}\n\n/**\n * Result type returned by Eta when compiling a template source.\n *\n * Some Eta configurations (async, plugins, custom tags) can change the\n * function shape; we keep the contract minimal and let EtaTemplateCache\n * implementation choose the actual compiler.\n */\nexport type EtaCompileFn = (\n source: string\n) => EtaCompiledTemplate;\n\n/**\n * Minimal surface required by `EtaTemplateController` on its host.\n *\n * The controller reads the root element and may register local async\n * work with the host so the render pass participates in the host's\n * `updateComplete` contract.\n *\n * Anything else — the current scope, compute revision, the compute\n * controller — is read by the host-supplied `args` / `context`\n * callbacks inside `EtaTemplateControllerOptions`, NOT by the\n * controller. That keeps the controller reusable outside\n * `BdScopedElement`.\n */\nexport interface EtaTemplateHost {\n /**\n * Owning boundary. Must be an `Element` because the controller marks\n * it as a traversal boundary (only elements own attributes and\n * children — text/document roots cannot act as Eta boundaries).\n */\n readonly root: Element;\n\n /**\n * Track local async work — when provided, the controller registers\n * the render pass under its own instance as the key so the host's\n * `updateComplete` waits for the render to finish before resolving.\n *\n * Mirrors the signature used by `BdNodeElement.trackLocalWork`.\n */\n trackLocalWork?<T>(\n key: unknown,\n work: PromiseLike<T>\n ): Promise<T>;\n}\n\n/**\n * Options accepted by `EtaTemplateController`.\n *\n * The controller is scope-agnostic. Everything reactive is funnelled\n * through `args`, `enabled`, and `context` callbacks so the controller\n * stays usable outside `BdScopedElement`.\n */\nexport interface EtaTemplateControllerOptions<\n TArgs extends readonly unknown[] = readonly unknown[],\n TContext extends object = object\n> {\n /**\n * Args the controller reacts to. The Task re-runs whenever the\n * returned tuple changes; the default comparison is `@lit/task`'s\n * `shallowArrayEquals`. Override via `argsEqual` for custom\n * equality (e.g. structural compare on a single object argument).\n *\n * Hosts typically return reactive properties of their own state:\n *\n * ```ts\n * args: () => [\n * this.currentScope,\n * this.compute.revision,\n * this.isComputeEnabled\n * ] as const\n * ```\n */\n args: () => TArgs;\n\n /**\n * Optional equality check for `args`. Forwarded to the underlying\n * `@lit/task` so the controller re-runs only when the returned\n * tuple actually changes by the host's definition.\n *\n * Return `true` when the old tuple and the new tuple should be\n * treated as equal (no rerun); return `false` to force a rerun.\n * When omitted, `@lit/task` uses its built-in\n * `shallowArrayEquals` which compares tuple elements by reference\n * (object identity for non-primitives).\n */\n argsEqual?: (\n oldArgs: TArgs,\n newArgs: TArgs\n ) => boolean;\n\n /**\n * Optional gate. When `enabled` returns `false` the controller skips\n * the render pass. When enabled returns false, the task completes\n * with undefined.\n *\n * The default is \"always enabled\".\n */\n enabled?: (args: TArgs) => boolean;\n\n /**\n * Context builder. Returns the value handed to each\n * `TemplateOperation.execute()` call.\n *\n * Returning `undefined` short-circuits the render pass for the\n * current args — the index keeps its operations but the renderer\n * does not invoke them. This is the right behaviour when the args\n * describe a state where rendering would produce invalid output\n * (for example, a scope that has not yet been published).\n *\n * Hosts that want the recommended `$scope` / `$compute` shape can\n * spread the scope entry, then attach `$scope` and `$compute`\n * fields to the returned context object. The controller does NOT\n * build that shape for the host — see `DefaultEtaContext` for the\n * documented shape.\n */\n context: (args: TArgs) => TContext | undefined;\n\n /**\n * Optional override used by tests to inject a deterministic index.\n *\n * The callback receives the resolved factory so the index can be\n * constructed with the same factory the controller will use. The\n * returned object must:\n *\n * - implement `TemplateIndexSink` so the observer can feed it\n * mutations;\n * - be iterable so the controller can render every operation;\n * - expose `disposeAll()` so the controller can clean up on\n * disconnect.\n *\n * `EtaTemplateIndex` satisfies this shape; tests may return a fake.\n */\n createIndex?: (\n factory: TemplateOperationFactory<TContext>\n ) => EtaTemplateIndexLike<TContext>;\n\n /**\n * Optional allowlist of attribute names the factory should\n * consider. When provided, attributes outside the list are skipped.\n *\n * When omitted, the factory defaults to observing every attribute.\n */\n attributeNames?: readonly string[];\n\n /**\n * When `true`, the controller tells the factory to ignore any\n * attribute allowlist and observe every attribute. Useful when\n * templates use non-standard attribute names (e.g. plain `href`\n * with a template literal).\n *\n * The controller owns its default factory privately; this option\n * controls the factory and observer that the controller builds.\n */\n observeAllAttributes?: boolean;\n\n /**\n * Optional predicate evaluated by the controller to decide whether\n * an `Element` is a topology boundary (i.e. owned by a different\n * controller).\n *\n * Threaded through to the index so the index's traversal and the\n * host's own child accounting share a single rule. Without this\n * predicate the index still walks the host's subtree but cannot\n * tell apart foreign boundaries.\n *\n * ⚠️ **Stable-on-raw-DOM.** The predicate MUST work on raw DOM\n * shape (tag names, marker attributes) rather than prototype-side\n * state such as `instanceof BdScopedElement` or runtime brands\n * set in custom-element classes. The parent index may scan a\n * subtree before a nested custom element upgrades; without a\n * stable raw-DOM check the parent index will silently absorb the\n * nested scope's templates. See `EtaTemplateIndexOptions.\n * isBoundaryElement` for full rationale and example patterns.\n *\n * Example pattern (tag-name based, stable before upgrade):\n *\n * ```ts\n * isBoundaryElement: (element) => {\n * const name = element.localName;\n * return (\n * name === 'bd-context' ||\n * name === 'bd-product' ||\n * name === 'bd-option'\n * );\n * }\n * ```\n */\n isBoundaryElement?: (element: Element) => boolean;\n\n /**\n * Optional per-operation error handler.\n *\n * **Continue vs. throw behaviour:**\n *\n * - When this handler is provided, the render loop catches errors\n * thrown by individual operations and continues with the next\n * operation. The render pass is considered successful and the\n * Task resolves normally with the most recent context. This is\n * the right behaviour when callers want to observe partial\n * failures (e.g. telemetry, fallback rendering) without aborting\n * the whole render.\n * - When omitted, the first error thrown by an operation propagates\n * out of the render loop, the Task transitions to its error\n * state, and `updateComplete` rejects. The previous successful\n * render's output stays in the DOM because no later operation\n * overwrites it.\n *\n * Mixing both modes is not supported — there is no way to observe\n * the error AND propagate it in a single render pass. If both are\n * needed, use the handler here and re-throw explicitly from inside\n * it.\n */\n onRenderError?: (\n error: unknown,\n operation: TemplateOperation<TContext>\n ) => void;\n\n /**\n * Optional schedule for `EtaMutationBatcher` flushes (round 6).\n *\n * Controls how the controller coalesces DOM mutations before\n * forwarding them to the index. Defaults to `'animation-frame'`\n * when omitted, which matches the design doc's recommended\n * production default for AEM / SPA-style bursty DOM updates.\n *\n * Schedules:\n *\n * - `'microtask'` — lowest latency. The flush runs on the next\n * microtask. Useful for tests that want deterministic flushes\n * via `await new Promise<void>(r => queueMicrotask(r))`.\n * - `'animation-frame'` — flush via `requestAnimationFrame`.\n * Recommended default; coalesces DOM churn before paint.\n * - `'idle'` — flush via `requestIdleCallback` (with a\n * `setTimeout` fallback). Lowest priority.\n * - `'manual'` — never auto-flush. The host owns the lifecycle\n * and must call `controller.flushMutations()` /\n * `controller.flushAndRender()` itself. Intended for\n * host-driven lifecycles (for example, AEM block decoration\n * flows where the host knows exactly when a decoration phase\n * ends).\n *\n * **Has no effect on tests that bypass the controller.** Tests\n * that drive the observer directly still observe records through\n * the legacy `TemplateIndexSink` path because they construct\n * the observer with an explicit `sink` rather than relying on\n * the controller's batcher wiring.\n *\n * **Has no effect when a custom observer is injected.** The\n * controller owns the batcher; consumers that want a different\n * forwarding destination should construct their own observer\n * and skip the controller's batcher.\n */\n mutationBatchSchedule?: EtaMutationBatchScheduleOption;\n}\n\n/**\n * Options accepted by `EtaTemplateIndex`.\n *\n * The controller passes these through to the index it constructs. The\n * index is otherwise opaque; boundary detection and ownership rules\n * live here so the index does not need to know about products,\n * options, or scoped elements.\n */\nexport interface EtaTemplateIndexOptions {\n /**\n * Predicate that decides whether an `Element` should be treated as a\n * traversal boundary.\n *\n * When the predicate returns `true` for an element:\n *\n * - If the element is this index's own root, it is still indexed as\n * the local boundary. Its own attributes and owned descendants are\n * collected.\n * - If the element is not this index's root, it is a foreign\n * boundary. The index does not collect the foreign boundary's\n * attributes and does not descend into its subtree.\n *\n * The predicate is also consulted during mutation entry points: an\n * attribute or text mutation on a foreign boundary element or its\n * descendants is ignored.\n *\n * ⚠️ **Stable-on-raw-DOM invariant.** The predicate MUST work on\n * raw DOM shape (e.g. `element.localName`, `element.tagName`,\n * marker attributes) rather than on prototype-side state such as\n * `element instanceof BdScopedElement` or a runtime brand set in\n * a custom-element class. The reason: the parent index may scan\n * a subtree before a nested custom element upgrades, in which\n * case the nested element has not yet been augmented with the\n * brand and the parent index would accidentally collect its\n * templates. No DOM mutation necessarily fires later when the\n * upgrade completes, so the parent index may keep the wrong\n * operations. Prefer tag-name or marker-attribute checks so the\n * classification is stable from the moment the element is\n * parsed.\n *\n * Example patterns:\n *\n * ```ts\n * // Tag-name based — works on raw DOM, no upgrade required.\n * isBoundaryElement: (element) => {\n * const name = element.localName;\n * return (\n * name === 'bd-context' ||\n * name === 'bd-product' ||\n * name === 'bd-option'\n * );\n * }\n * ```\n *\n * ```ts\n * // Marker-attribute based — also stable before upgrade.\n * isBoundaryElement: (element) =>\n * element.hasAttribute('bd-scope') ||\n * element.matches('bd-context,bd-product,bd-option')\n * ```\n *\n * ```ts\n * // Brand + tag-name fallback — keep the runtime brand as a fast\n * path for already-upgraded hosts, but always fall back to a\n // stable raw-DOM check so the parent index stays correct while\n // the subtree is upgrading.\n * isBoundaryElement: (element) =>\n * isBdScopedElement(element) ||\n * element.matches('bd-context,bd-product,bd-option')\n * ```\n */\n readonly isBoundaryElement?: (\n element: Element\n ) => boolean;\n\n /**\n * Root owned by this index.\n *\n * Mutations received by the index that target nodes outside the\n * subtree rooted at `root` are dropped. Without `root`, the index\n * accepts every mutation it receives — callers that wire a\n * parent observer must set `root` to prevent nested-scope leakage.\n *\n * The root is an `Element` for light-DOM indices and a\n * `ShadowRoot` for shadow-DOM indices. The controller walks\n * the host's light subtree during `hostConnected` looking for\n * attached open shadow roots and creates a per-root index for\n * each one. Tests may pass either kind.\n */\n readonly root?: Element | ShadowRoot;\n}\n\n/**\n * Structural minimum required for an Eta template index.\n *\n * The real `EtaTemplateIndex` (in `./template-index.js`) implements this\n * shape. Splitting the contract out lets `types.ts` stay free of the\n * index implementation, avoiding a circular import.\n */\nexport interface EtaTemplateIndexLike<\n TContext = object\n> extends TemplateIndexSink,\n Iterable<TemplateOperation<TContext>> {\n disposeAll(): void;\n\n initialize(root: ParentNode): void;\n\n /**\n * Number of operations currently held by the index.\n *\n * The real `EtaTemplateIndex` (in `./template-index.js`) is the\n * sole intended implementer; the field is required because\n * diagnostics and tests read it directly without an\n * `?? 0` fallback. Fake indices used in tests must provide\n * `get size(): number { return 0; }` (or equivalent).\n */\n readonly size: number;\n}\n"]}
@@ -1,17 +1,29 @@
1
- import { registerActionNodes } from "./actions/index.js";
1
+ export * from './actions/index.js';
2
+ export * from './compute/compute.expand.js';
3
+ export * from './compute/compute.scan.js';
4
+ export * from './compute/option-resolver.js';
5
+ export * from './contexts/context.scope.js';
6
+ export * from './controllers/controller.action-resolve.js';
7
+ export * from './controllers/controller.action-topology.js';
8
+ export * from './controllers/controller.compute.js';
9
+ export * from './controllers/controller.resolve.js';
10
+ export * from './core/action-topology.js';
11
+ export * from './core/actions.js';
12
+ export * from './core/node.element.js';
13
+ export * from './core/node.scope.js';
14
+ export * from './core/option-update.js';
15
+ export * from './eta/index.js';
16
+ export * from './nodes/node.context.js';
17
+ export * from './nodes/node.option.js';
18
+ export * from './nodes/node.product.js';
19
+ export * from './renders/index.js';
20
+ export * from './renders/render.wrapper.js';
2
21
  import { ContextNode } from './nodes/node.context.js';
3
22
  import { OptionNode } from './nodes/node.option.js';
4
23
  import { ProductNode } from './nodes/node.product.js';
5
- import { RootNode } from './nodes/node.root.js';
6
- import { StateNode } from './nodes/node.state.js';
7
- import { registerRenderNodes } from "./renders/index.js";
8
- export { registerActionNodes, registerRenderNodes };
9
24
  export declare const elementDefinitions: {
10
- readonly 'bd-root': typeof RootNode;
11
- readonly 'bd-state': typeof StateNode;
25
+ readonly 'bd-context': typeof ContextNode;
12
26
  readonly 'bd-product': typeof ProductNode;
13
27
  readonly 'bd-option': typeof OptionNode;
14
- readonly 'bd-context': typeof ContextNode;
15
28
  };
16
29
  export declare function registerContextNodes(): void;
17
- export { ContextNode, OptionNode, ProductNode, RootNode, StateNode };
package/dist/src/index.js CHANGED
@@ -1,18 +1,30 @@
1
- import { registerActionNodes } from "./actions/index.js";
1
+ export * from './actions/index.js';
2
+ export * from './compute/compute.expand.js';
3
+ export * from './compute/compute.scan.js';
4
+ export * from './compute/option-resolver.js';
5
+ export * from './contexts/context.scope.js';
6
+ export * from './controllers/controller.action-resolve.js';
7
+ export * from './controllers/controller.action-topology.js';
8
+ export * from './controllers/controller.compute.js';
9
+ export * from './controllers/controller.resolve.js';
10
+ export * from './core/action-topology.js';
11
+ export * from './core/actions.js';
12
+ export * from './core/node.element.js';
13
+ export * from './core/node.scope.js';
14
+ export * from './core/option-update.js';
15
+ export * from './eta/index.js';
16
+ export * from './nodes/node.context.js';
17
+ export * from './nodes/node.option.js';
18
+ export * from './nodes/node.product.js';
19
+ export * from './renders/index.js';
20
+ export * from './renders/render.wrapper.js';
2
21
  import { ContextNode } from './nodes/node.context.js';
3
22
  import { OptionNode } from './nodes/node.option.js';
4
23
  import { ProductNode } from './nodes/node.product.js';
5
- import { RootNode } from './nodes/node.root.js';
6
- import { StateNode } from './nodes/node.state.js';
7
- import { registerRenderNodes } from "./renders/index.js";
8
- export { registerActionNodes, registerRenderNodes };
9
- // Export definitions for consumers who want tags + constructors
10
24
  export const elementDefinitions = {
11
- 'bd-root': RootNode,
12
- 'bd-state': StateNode,
25
+ 'bd-context': ContextNode,
13
26
  'bd-product': ProductNode,
14
- 'bd-option': OptionNode,
15
- 'bd-context': ContextNode
27
+ 'bd-option': OptionNode
16
28
  };
17
29
  export function registerContextNodes() {
18
30
  for (const [tag, Ctor] of Object.entries(elementDefinitions)) {
@@ -21,5 +33,4 @@ export function registerContextNodes() {
21
33
  }
22
34
  }
23
35
  }
24
- export { ContextNode, OptionNode, ProductNode, RootNode, StateNode };
25
36
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAEhD,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,CAAC;AAEpD,gEAAgE;AAChE,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,SAAS,EAAK,QAAQ;IACtB,UAAU,EAAI,SAAS;IACvB,YAAY,EAAE,WAAW;IACzB,WAAW,EAAG,UAAU;IACxB,YAAY,EAAE,WAAW;CACjB,CAAC;AAEX,MAAM,UAAU,oBAAoB;IAClC,KAAK,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAAE,CAAC;QAC7D,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YAC7B,cAAc,CAAC,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QACnC,CAAC;IACH,CAAC;AACH,CAAC;AAED,OAAO,EACL,WAAW,EACX,UAAU,EACV,WAAW,EACX,QAAQ,EACR,SAAS,EACV,CAAC","sourcesContent":["import { registerActionNodes } from \"./actions\";\nimport { ContextNode } from './nodes/node.context.js';\nimport { OptionNode } from './nodes/node.option.js';\nimport { ProductNode } from './nodes/node.product.js';\nimport { RootNode } from './nodes/node.root.js';\nimport { StateNode } from './nodes/node.state.js';\nimport { registerRenderNodes } from \"./renders\";\n\nexport { registerActionNodes, registerRenderNodes };\n\n// Export definitions for consumers who want tags + constructors\nexport const elementDefinitions = {\n 'bd-root' : RootNode,\n 'bd-state' : StateNode,\n 'bd-product': ProductNode,\n 'bd-option' : OptionNode,\n 'bd-context': ContextNode\n} as const;\n\nexport function registerContextNodes() {\n for (const [tag, Ctor] of Object.entries(elementDefinitions)) {\n if (!customElements.get(tag)) {\n customElements.define(tag, Ctor);\n }\n }\n}\n\nexport {\n ContextNode,\n OptionNode,\n ProductNode,\n RootNode,\n StateNode\n};\n\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4CAA4C,CAAC;AAC3D,cAAc,6CAA6C,CAAC;AAC5D,cAAc,qCAAqC,CAAC;AACpD,cAAc,qCAAqC,CAAC;AACpD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,6BAA6B,CAAC;AAE5C,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,YAAY,EAAE,WAAW;IACzB,YAAY,EAAE,WAAW;IACzB,WAAW,EAAG,UAAU;CAChB,CAAC;AAEX,MAAM,UAAU,oBAAoB;IAClC,KAAK,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAAE,CAAC;QAC7D,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YAC7B,cAAc,CAAC,MAAM,CACnB,GAAG,EACH,IAAI,CACL,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC","sourcesContent":["export * from './actions/index.js';\nexport * from './compute/compute.expand.js';\nexport * from './compute/compute.scan.js';\nexport * from './compute/option-resolver.js';\nexport * from './contexts/context.scope.js';\nexport * from './controllers/controller.action-resolve.js';\nexport * from './controllers/controller.action-topology.js';\nexport * from './controllers/controller.compute.js';\nexport * from './controllers/controller.resolve.js';\nexport * from './core/action-topology.js';\nexport * from './core/actions.js';\nexport * from './core/node.element.js';\nexport * from './core/node.scope.js';\nexport * from './core/option-update.js';\nexport * from './eta/index.js';\nexport * from './nodes/node.context.js';\nexport * from './nodes/node.option.js';\nexport * from './nodes/node.product.js';\nexport * from './renders/index.js';\nexport * from './renders/render.wrapper.js';\n\nimport { ContextNode } from './nodes/node.context.js';\nimport { OptionNode } from './nodes/node.option.js';\nimport { ProductNode } from './nodes/node.product.js';\n\nexport const elementDefinitions = {\n 'bd-context': ContextNode,\n 'bd-product': ProductNode,\n 'bd-option' : OptionNode\n} as const;\n\nexport function registerContextNodes(): void {\n for (const [tag, Ctor] of Object.entries(elementDefinitions)) {\n if (!customElements.get(tag)) {\n customElements.define(\n tag,\n Ctor\n );\n }\n }\n}\n"]}
@@ -1,4 +1,6 @@
1
- import { StateNode } from "./node.state.js";
2
- export declare class ContextNode extends StateNode {
3
- ignoreEventsParent: boolean;
1
+ import { type BdScope } from '../contexts/context.scope.js';
2
+ import { BdScopedElement } from '../core/node.scope.js';
3
+ export declare class ContextNode extends BdScopedElement {
4
+ private readonly _workflow;
5
+ get scope(): BdScope | undefined;
4
6
  }
@@ -1,8 +1,53 @@
1
- import { StateNode } from "./node.state.js";
2
- export class ContextNode extends StateNode {
1
+ import { extendBdContextScope } from '../contexts/context.scope.js';
2
+ import { BdActionResolveController } from '../controllers/controller.action-resolve.js';
3
+ import { BdScopedElement } from '../core/node.scope.js';
4
+ export class ContextNode extends BdScopedElement {
3
5
  constructor() {
4
6
  super(...arguments);
5
- this.ignoreEventsParent = true;
7
+ this._workflow = new BdActionResolveController(this, {
8
+ name: 'context',
9
+ args: () => [
10
+ this.parentScope
11
+ ],
12
+ /**
13
+ * ContextNode is a hard event boundary.
14
+ *
15
+ * Transitions from the parent scope are ignored so outer
16
+ * `bd-action-request` events cannot drive descendants inside this
17
+ * context. Local `bd-action-request` events captured by this node
18
+ * still become fresh transitions and are published to children.
19
+ *
20
+ * `filterTransition` honours the user-facing `ignore-events` and
21
+ * `ignore-events-parent` attributes on top of the hard boundary.
22
+ * Local events whose `eventId` matches `ignore-events` are dropped
23
+ * here; the parent boundary is re-affirmed regardless.
24
+ */
25
+ transition: () => undefined,
26
+ derive: ([parentScope]) => [
27
+ parentScope
28
+ ],
29
+ enabled: ([parentScope]) => Boolean(parentScope),
30
+ resolve: ([parentScope]) => parentScope,
31
+ filterTransition: (candidate) => {
32
+ if (candidate.source === 'parent') {
33
+ return false;
34
+ }
35
+ return this._filterTransition(candidate);
36
+ },
37
+ commit: (parentScope, _args, _resolveContext, actionContext) => {
38
+ if (!parentScope) {
39
+ this.clearScope();
40
+ return;
41
+ }
42
+ this.publishScope(extendBdContextScope(parentScope, actionContext.transition));
43
+ },
44
+ onDisabled: () => {
45
+ this.clearScope();
46
+ }
47
+ });
48
+ }
49
+ get scope() {
50
+ return this.currentScope;
6
51
  }
7
52
  }
8
53
  //# sourceMappingURL=node.context.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"node.context.js","sourceRoot":"","sources":["../../../src/nodes/node.context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,MAAM,OAAO,WAAY,SAAQ,SAAS;IAA1C;;QACE,uBAAkB,GAAG,IAAI,CAAC;IAC5B,CAAC;CAAA","sourcesContent":["import { StateNode } from \"./node.state\";\nexport class ContextNode extends StateNode {\n ignoreEventsParent = true;\n}\n"]}
1
+ {"version":3,"file":"node.context.js","sourceRoot":"","sources":["../../../src/nodes/node.context.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EAErB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,yBAAyB,EAAE,MAAM,4CAA4C,CAAC;AACvF,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,MAAM,OAAO,WAAY,SAAQ,eAAe;IAAhD;;QACmB,cAAS,GACxB,IAAI,yBAAyB,CAC3B,IAAI,EACJ;YACE,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,GAAG,EAAE,CAAC;gBACV,IAAI,CAAC,WAAW;aACR;YACV;;;;;;;;;;;;eAYG;YACH,UAAU,EAAE,GAAG,EAAE,CAAC,SAAS;YAC3B,MAAM,EAAM,CAAC,CAAC,WAAW,CAAC,EAAE,EAAE,CAAC;gBAC7B,WAAW;aACH;YACV,OAAO,EAAE,CAAC,CAAC,WAAW,CAAC,EAAE,EAAE,CACzB,OAAO,CAAC,WAAW,CAAC;YACtB,OAAO,EAAE,CAAC,CAAC,WAAW,CAAC,EAAE,EAAE,CACzB,WAAW;YACb,gBAAgB,EAAE,CAAC,SAAS,EAAE,EAAE;gBAC9B,IAAI,SAAS,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;oBAClC,OAAO,KAAK,CAAC;gBACf,CAAC;gBAED,OAAO,IAAI,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC;YAC3C,CAAC;YACD,MAAM,EAAE,CAAC,WAAW,EAAE,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,EAAE;gBAC7D,IAAI,CAAC,WAAW,EAAE,CAAC;oBACjB,IAAI,CAAC,UAAU,EAAE,CAAC;oBAClB,OAAO;gBACT,CAAC;gBAED,IAAI,CAAC,YAAY,CACf,oBAAoB,CAClB,WAAW,EACX,aAAa,CAAC,UAAU,CACzB,CACF,CAAC;YACJ,CAAC;YACD,UAAU,EAAE,GAAG,EAAE;gBACf,IAAI,CAAC,UAAU,EAAE,CAAC;YACpB,CAAC;SACF,CACF,CAAC;IAKN,CAAC;IAHC,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;CACF","sourcesContent":["import {\n extendBdContextScope,\n type BdScope\n} from '@/contexts/context.scope.js';\nimport { BdActionResolveController } from '@/controllers/controller.action-resolve.js';\nimport { BdScopedElement } from '@/core/node.scope.js';\n\nexport class ContextNode extends BdScopedElement {\n private readonly _workflow =\n new BdActionResolveController(\n this,\n {\n name: 'context',\n args: () => [\n this.parentScope\n ] as const,\n /**\n * ContextNode is a hard event boundary.\n *\n * Transitions from the parent scope are ignored so outer\n * `bd-action-request` events cannot drive descendants inside this\n * context. Local `bd-action-request` events captured by this node\n * still become fresh transitions and are published to children.\n *\n * `filterTransition` honours the user-facing `ignore-events` and\n * `ignore-events-parent` attributes on top of the hard boundary.\n * Local events whose `eventId` matches `ignore-events` are dropped\n * here; the parent boundary is re-affirmed regardless.\n */\n transition: () => undefined,\n derive : ([parentScope]) => [\n parentScope\n ] as const,\n enabled: ([parentScope]) =>\n Boolean(parentScope),\n resolve: ([parentScope]) =>\n parentScope,\n filterTransition: (candidate) => {\n if (candidate.source === 'parent') {\n return false;\n }\n\n return this._filterTransition(candidate);\n },\n commit: (parentScope, _args, _resolveContext, actionContext) => {\n if (!parentScope) {\n this.clearScope();\n return;\n }\n\n this.publishScope(\n extendBdContextScope(\n parentScope,\n actionContext.transition\n )\n );\n },\n onDisabled: () => {\n this.clearScope();\n }\n }\n );\n\n get scope(): BdScope | undefined {\n return this.currentScope;\n }\n}\n"]}
@@ -1,34 +1,14 @@
1
- import { dataLayerContextType, dataLayerPayload } from "../contexts/context.datalayer.js";
2
- import { optionContextType } from "../contexts/context.option.js";
3
- import { productContextType } from "../contexts/context.product.js";
4
- import { EventType } from "../events/events.js";
5
- import { ProductBundleOption, ProductOption } from "@repobit/dex-store";
6
- import { StateNode } from "./node.state.js";
7
- export declare class OptionNode extends StateNode {
8
- _optionContext?: optionContextType;
9
- _dataLayer?: dataLayerContextType;
10
- product?: productContextType;
11
- bundle: ProductBundleOption[];
1
+ import { type BdDataLayerEvent, type BdScope } from '../contexts/context.scope.js';
2
+ import { BdScopedElement } from '../core/node.scope.js';
3
+ import type { ProductOption } from '@repobit/dex-store';
4
+ export declare class OptionNode extends BdScopedElement {
12
5
  devices?: number;
13
6
  subscription?: number;
14
- dataLayerEvent?: dataLayerPayload["event"];
15
- _option: ProductOption | null | undefined;
16
- private _sentDataLayer;
17
- private _pendingDevicesFromEvent;
18
- private _pendingSubscriptionFromEvent;
19
- get option(): ProductOption | null | undefined;
20
- private _collectFromTask;
21
- private _syncOptionAttributes;
22
- private _changeOptionEvent;
23
- private _fireDataLayerTask;
24
- private _loadOptionByAttributes;
25
- getEtaArgs(): unknown[];
26
- buildEtaContext(): Promise<object | undefined>;
27
- connectedCallback(): void;
28
- disconnectedCallback(): void;
29
- protected getUpdateComplete(): Promise<boolean>;
30
- protected _eventChange(e: EventType): void;
31
- private _applyDeltaUpdate;
32
- private __applyAction;
33
- private __applyBundle;
7
+ option?: ProductOption;
8
+ dataLayerEvent?: BdDataLayerEvent;
9
+ private _dataLayerSent;
10
+ private readonly _workflow;
11
+ get scope(): BdScope | undefined;
12
+ protected updated(changedProperties: Map<PropertyKey, unknown>): void;
13
+ private fireDataLayer;
34
14
  }