@repobit/dex-store-elements 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/CHANGELOG.md +110 -0
  2. package/README.md +211 -0
  3. package/dist/src/actions/action.button.d.ts +1 -0
  4. package/dist/src/actions/action.button.js +14 -0
  5. package/dist/src/actions/action.button.js.map +1 -0
  6. package/dist/src/actions/action.input.d.ts +1 -0
  7. package/dist/src/actions/action.input.js +37 -0
  8. package/dist/src/actions/action.input.js.map +1 -0
  9. package/dist/src/actions/action.select.d.ts +1 -0
  10. package/dist/src/actions/action.select.js +12 -0
  11. package/dist/src/actions/action.select.js.map +1 -0
  12. package/dist/src/actions/index.d.ts +2 -0
  13. package/dist/src/actions/index.js +30 -0
  14. package/dist/src/actions/index.js.map +1 -0
  15. package/dist/src/actions/utilty.d.ts +9 -0
  16. package/dist/src/actions/utilty.js +88 -0
  17. package/dist/src/actions/utilty.js.map +1 -0
  18. package/dist/src/contexts/context.datalayer.d.ts +9 -0
  19. package/dist/src/contexts/context.datalayer.js +3 -0
  20. package/dist/src/contexts/context.datalayer.js.map +1 -0
  21. package/dist/src/contexts/context.derived.d.ts +12 -0
  22. package/dist/src/contexts/context.derived.js +3 -0
  23. package/dist/src/contexts/context.derived.js.map +1 -0
  24. package/dist/src/contexts/context.event.d.ts +5 -0
  25. package/dist/src/contexts/context.event.js +3 -0
  26. package/dist/src/contexts/context.event.js.map +1 -0
  27. package/dist/src/contexts/context.option.d.ts +5 -0
  28. package/dist/src/contexts/context.option.js +3 -0
  29. package/dist/src/contexts/context.option.js.map +1 -0
  30. package/dist/src/contexts/context.product.d.ts +5 -0
  31. package/dist/src/contexts/context.product.js +3 -0
  32. package/dist/src/contexts/context.product.js.map +1 -0
  33. package/dist/src/contexts/context.state.d.ts +28 -0
  34. package/dist/src/contexts/context.state.js +3 -0
  35. package/dist/src/contexts/context.state.js.map +1 -0
  36. package/dist/src/contexts/context.store.d.ts +5 -0
  37. package/dist/src/contexts/context.store.js +3 -0
  38. package/dist/src/contexts/context.store.js.map +1 -0
  39. package/dist/src/dsl/compilers/array/compiler.d.ts +1 -0
  40. package/dist/src/dsl/compilers/array/compiler.js +30 -0
  41. package/dist/src/dsl/compilers/array/compiler.js.map +1 -0
  42. package/dist/src/dsl/compilers/boolean/compiler.d.ts +7 -0
  43. package/dist/src/dsl/compilers/boolean/compiler.js +53 -0
  44. package/dist/src/dsl/compilers/boolean/compiler.js.map +1 -0
  45. package/dist/src/dsl/compilers/enum/compiler.d.ts +7 -0
  46. package/dist/src/dsl/compilers/enum/compiler.js +16 -0
  47. package/dist/src/dsl/compilers/enum/compiler.js.map +1 -0
  48. package/dist/src/dsl/compilers/index.d.ts +12 -0
  49. package/dist/src/dsl/compilers/index.js +9 -0
  50. package/dist/src/dsl/compilers/index.js.map +1 -0
  51. package/dist/src/dsl/utilty.d.ts +6 -0
  52. package/dist/src/dsl/utilty.js +32 -0
  53. package/dist/src/dsl/utilty.js.map +1 -0
  54. package/dist/src/events/events.d.ts +60 -0
  55. package/dist/src/events/events.js +56 -0
  56. package/dist/src/events/events.js.map +1 -0
  57. package/dist/src/index.d.ts +9 -0
  58. package/dist/src/index.js +10 -0
  59. package/dist/src/index.js.map +1 -0
  60. package/dist/src/nodes/node.context.d.ts +3 -0
  61. package/dist/src/nodes/node.context.js +15 -0
  62. package/dist/src/nodes/node.context.js.map +1 -0
  63. package/dist/src/nodes/node.option.d.ts +32 -0
  64. package/dist/src/nodes/node.option.js +247 -0
  65. package/dist/src/nodes/node.option.js.map +1 -0
  66. package/dist/src/nodes/node.product.d.ts +14 -0
  67. package/dist/src/nodes/node.product.js +99 -0
  68. package/dist/src/nodes/node.product.js.map +1 -0
  69. package/dist/src/nodes/node.root.d.ts +16 -0
  70. package/dist/src/nodes/node.root.js +53 -0
  71. package/dist/src/nodes/node.root.js.map +1 -0
  72. package/dist/src/nodes/node.state.d.ts +112 -0
  73. package/dist/src/nodes/node.state.js +742 -0
  74. package/dist/src/nodes/node.state.js.map +1 -0
  75. package/dist/src/renders/attributes/buyLink.d.ts +2 -0
  76. package/dist/src/renders/attributes/buyLink.js +18 -0
  77. package/dist/src/renders/attributes/buyLink.js.map +1 -0
  78. package/dist/src/renders/attributes/devices.d.ts +2 -0
  79. package/dist/src/renders/attributes/devices.js +32 -0
  80. package/dist/src/renders/attributes/devices.js.map +1 -0
  81. package/dist/src/renders/attributes/discount.d.ts +2 -0
  82. package/dist/src/renders/attributes/discount.js +96 -0
  83. package/dist/src/renders/attributes/discount.js.map +1 -0
  84. package/dist/src/renders/attributes/hide.d.ts +2 -0
  85. package/dist/src/renders/attributes/hide.js +33 -0
  86. package/dist/src/renders/attributes/hide.js.map +1 -0
  87. package/dist/src/renders/attributes/index.d.ts +3 -0
  88. package/dist/src/renders/attributes/index.js +24 -0
  89. package/dist/src/renders/attributes/index.js.map +1 -0
  90. package/dist/src/renders/attributes/price.d.ts +2 -0
  91. package/dist/src/renders/attributes/price.js +96 -0
  92. package/dist/src/renders/attributes/price.js.map +1 -0
  93. package/dist/src/renders/attributes/subscription.d.ts +2 -0
  94. package/dist/src/renders/attributes/subscription.js +34 -0
  95. package/dist/src/renders/attributes/subscription.js.map +1 -0
  96. package/dist/src/renders/attributes/trialLink.d.ts +2 -0
  97. package/dist/src/renders/attributes/trialLink.js +13 -0
  98. package/dist/src/renders/attributes/trialLink.js.map +1 -0
  99. package/dist/src/renders/context.d.ts +11 -0
  100. package/dist/src/renders/context.js +88 -0
  101. package/dist/src/renders/context.js.map +1 -0
  102. package/dist/src/renders/format.d.ts +2 -0
  103. package/dist/src/renders/format.js +21 -0
  104. package/dist/src/renders/format.js.map +1 -0
  105. package/dist/src/renders/index.d.ts +2 -0
  106. package/dist/src/renders/index.js +30 -0
  107. package/dist/src/renders/index.js.map +1 -0
  108. package/dist/src/renders/observe.d.ts +4 -0
  109. package/dist/src/renders/observe.js +30 -0
  110. package/dist/src/renders/observe.js.map +1 -0
  111. package/dist/src/renders/utility.d.ts +28 -0
  112. package/dist/src/renders/utility.js +132 -0
  113. package/dist/src/renders/utility.js.map +1 -0
  114. package/dist/src/templating/eta.d.ts +3 -0
  115. package/dist/src/templating/eta.js +9 -0
  116. package/dist/src/templating/eta.js.map +1 -0
  117. package/package.json +64 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,110 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
+
6
+ ## 1.1.0 (2025-10-08)
7
+
8
+
9
+ ### Features
10
+
11
+ * **DEX-21811:** add action based on data atributes ([11af0cb](https://github.com/bitdefender/dex-core/commit/11af0cbbb02fb81ee1c61d8783d339c73cbd73dc))
12
+ * **DEX-21811:** add async derived ([51e48f1](https://github.com/bitdefender/dex-core/commit/51e48f11c291ab5bb309888aee41031416e7d343))
13
+ * **DEX-21811:** add back enum funnction ([6661340](https://github.com/bitdefender/dex-core/commit/6661340cabd3ff06a127ed46596949e5854ef9e5))
14
+ * **DEX-21811:** add bundle logic to state ([ad76851](https://github.com/bitdefender/dex-core/commit/ad76851e14208a30c4aef78599b147f84e7eb720))
15
+ * **DEX-21811:** add bundle test ([953483e](https://github.com/bitdefender/dex-core/commit/953483e17ca983e1e0ea217eba3e79a35d81477c))
16
+ * **DEX-21811:** add data layer callback ([4782ebb](https://github.com/bitdefender/dex-core/commit/4782ebbdeab19a7c84512658d78b81fbc92ee848))
17
+ * **DEX-21811:** add derived state test and attribute eta ([e6965d8](https://github.com/bitdefender/dex-core/commit/e6965d840106da9e9d8a9718aed5e614d57e331a))
18
+ * **DEX-21811:** add derrived eta ctx ([e05f1da](https://github.com/bitdefender/dex-core/commit/e05f1da32aa29d36ebaea86ae6fe0fa852b18a4b))
19
+ * **DEX-21811:** add eta templating ([e3346f4](https://github.com/bitdefender/dex-core/commit/e3346f43c7d376c611499a031baa9d6b2c37b73f))
20
+ * **DEX-21811:** add fallback for option render ([a111766](https://github.com/bitdefender/dex-core/commit/a111766b1383ee351601b2141dc57cc58f9fc40d))
21
+ * **DEX-21811:** add forward event default ([73a6fa6](https://github.com/bitdefender/dex-core/commit/73a6fa67aef979b402e6aadd98d573238f39ac81))
22
+ * **DEX-21811:** add ignore event and no collect attribute ([3785362](https://github.com/bitdefender/dex-core/commit/3785362c66e4e3ca021b78514dea753332fbba55))
23
+ * **DEX-21811:** add init mappings ([6166a22](https://github.com/bitdefender/dex-core/commit/6166a220e0b81e0e566efb47c5f5567f17cfee25))
24
+ * **DEX-21811:** add new gramar and tests ([1372560](https://github.com/bitdefender/dex-core/commit/1372560a10ba24c6cda6e8e0bd13d514bdc8b036))
25
+ * **DEX-21811:** add parsers and renders ([0d52ebc](https://github.com/bitdefender/dex-core/commit/0d52ebcd3f73024cd2076406adbc8002a601264f))
26
+ * **DEX-21811:** add partial state node with debounce ([5f798c6](https://github.com/bitdefender/dex-core/commit/5f798c664684aae2d3eb4c4f7d469ec86bac3b56))
27
+ * **DEX-21811:** add product context ([315ba25](https://github.com/bitdefender/dex-core/commit/315ba251b2f1bb448206331a7ceb4ac840a84e07))
28
+ * **DEX-21811:** add product event test ([e58f380](https://github.com/bitdefender/dex-core/commit/e58f3808f14ded21a63ebc4fdcd63569af1eaac3))
29
+ * **DEX-21811:** add product test ([2c98788](https://github.com/bitdefender/dex-core/commit/2c987889fc2f35ffd19bad238e61e18d71b09d4f))
30
+ * **DEX-21811:** add select action test ([c474941](https://github.com/bitdefender/dex-core/commit/c4749413663405f4165c16133fed3226eb9cdd3c))
31
+ * **DEX-21811:** add select test ([c028049](https://github.com/bitdefender/dex-core/commit/c0280490c3acddeac3f0083e8e4f03c034185272))
32
+ * **DEX-21811:** add test for state ([039db66](https://github.com/bitdefender/dex-core/commit/039db6634c90db30c16aeb968dd6021a703a8e01))
33
+ * **DEX-21811:** add trial links ([209c577](https://github.com/bitdefender/dex-core/commit/209c577f6809023b2d73dc2783a4699453e6466f))
34
+ * **DEX-21811:** added upstream event for stateUpdated ([ff2654e](https://github.com/bitdefender/dex-core/commit/ff2654e24e9b4136283612d818987e4be5103bae))
35
+ * **DEX-21811:** change boolean expresion to use it. to referecne ctx ([2fa2b45](https://github.com/bitdefender/dex-core/commit/2fa2b4537a39969c0e69f3d01ad9c994c405f28d))
36
+ * **DEX-21811:** change context values to be strings for price and discounts ([a8ab427](https://github.com/bitdefender/dex-core/commit/a8ab427990662ff1e48412ef460a7a88627737d4))
37
+ * **DEX-21811:** change node state to use task ([97af5b4](https://github.com/bitdefender/dex-core/commit/97af5b4160ab14094f1fd5d35ac76bbefbbbe2b2))
38
+ * **DEX-21811:** change overrides and trialinks ([db527b4](https://github.com/bitdefender/dex-core/commit/db527b495601d46857e9362f79dba8c033ffd665))
39
+ * **DEX-21811:** change state to use task ([77d061b](https://github.com/bitdefender/dex-core/commit/77d061b8f05fff8d66e189648374103d8b112922))
40
+ * **DEX-21811:** compute state values ([3aa64c1](https://github.com/bitdefender/dex-core/commit/3aa64c11aa892ef4554a1d8ff9a1290ab4b222fe))
41
+ * **DEX-21811:** computedOptions not keep track of bundled options ([5a30c7b](https://github.com/bitdefender/dex-core/commit/5a30c7b17d1196b380346894c15067351855aec2))
42
+ * **DEX-21811:** fix corner case for input type ([c279822](https://github.com/bitdefender/dex-core/commit/c279822df866bab379b6c492318019f28dd09a71))
43
+ * **DEX-21811:** fix propagation issues and order ([6054e16](https://github.com/bitdefender/dex-core/commit/6054e16a8a2344b65a2d7c4f35daa0dbdc86b62e))
44
+ * **DEX-21811:** fix state mechanism ([157d3a8](https://github.com/bitdefender/dex-core/commit/157d3a8e1c72a4d4f536cd98d4880d00d98c291d))
45
+ * **DEX-21811:** fixed handshake ([05b1324](https://github.com/bitdefender/dex-core/commit/05b1324b1067505180a45a738f3228db5ecf5d83))
46
+ * **DEX-21811:** make state into a provider ([4e0e021](https://github.com/bitdefender/dex-core/commit/4e0e0211b6d142e9273d7b1977c920e8b183dec9))
47
+ * **DEX-21811:** refactor ([db658da](https://github.com/bitdefender/dex-core/commit/db658da5e30332af87d80157c55168a31478a7c8))
48
+ * **DEX-21811:** refactor ([de4cfc3](https://github.com/bitdefender/dex-core/commit/de4cfc3913b0378ea29c1dd94fa58e7730915d8e))
49
+ * **DEX-21811:** refactor rendering ([f3bbed1](https://github.com/bitdefender/dex-core/commit/f3bbed180b58c497cacba4ca19e56b074a309a02))
50
+ * **DEX-21811:** replace 3 step state with 2 ([0432b32](https://github.com/bitdefender/dex-core/commit/0432b32f6e3f53fd0cf199dc9a7f6befff9cc752))
51
+ * **DEX-21811:** replace boolean grammar with eta ([173115e](https://github.com/bitdefender/dex-core/commit/173115e185c249f1851dbff9afec1bac6effac5e))
52
+ * **DEX-21811:** replace eta templates ([6f8ac8f](https://github.com/bitdefender/dex-core/commit/6f8ac8fbbd6847fe3dc9457b4f7aa8a6cbab262e))
53
+ * **DEX-21811:** state node is working ([0412a4f](https://github.com/bitdefender/dex-core/commit/0412a4f0c1f3896a4fa9e97aa70d6748f2100ba7))
54
+ * **DEX-21811:** update node product to use updateComplete ([423f45c](https://github.com/bitdefender/dex-core/commit/423f45cba79733afd29eeb832b127187dedc8b40))
55
+ * **DEX-21811:** update option node ([79bb71a](https://github.com/bitdefender/dex-core/commit/79bb71a9727be9bcea551e22563c598ab6339b69))
56
+ * **DEX-21811:** update test ([6d468e3](https://github.com/bitdefender/dex-core/commit/6d468e3737bb429d0b0c397c2d92c8c2e99a04eb))
57
+ * **DEX-21811:** update test ([ee8f60e](https://github.com/bitdefender/dex-core/commit/ee8f60ec0248ac2e8dba949909d89264f1781685))
58
+ * **DEX-21811:** update test to use only mock function ([4d97649](https://github.com/bitdefender/dex-core/commit/4d97649d9021257c39a44a3db0eab75815334430))
59
+ * **DEX-21811:** wip ([1660def](https://github.com/bitdefender/dex-core/commit/1660def6bf0ffabab87ca0e449d3a43fb59781b4))
60
+ * **DEX-21811:** working click events ([9f1538f](https://github.com/bitdefender/dex-core/commit/9f1538f17d639381580eecfc1954bb16654a10d8))
61
+ * **DEX-2181:** add renders ([5175d15](https://github.com/bitdefender/dex-core/commit/5175d15772607be0afc2e8d6504417988e7dc5cf))
62
+
63
+
64
+ ### Bug Fixes
65
+
66
+ * **DEX-21811:** add small fixes ([b7f47d7](https://github.com/bitdefender/dex-core/commit/b7f47d7500cb2783c112a7de0f5d8f9cbbba4bbf))
67
+ * **DEX-21811:** change state compute to transiztion bundles ([45dd085](https://github.com/bitdefender/dex-core/commit/45dd0858cf8a751236a29cad88dad6a5c1a16aa8))
68
+
69
+
70
+
71
+ ## [0.2.1](https://github.com/bitdefender/dex-core/compare/@repobit/dex-store@0.2.0...@repobit/dex-store@0.2.1) (2025-04-08)
72
+
73
+
74
+ ### Bug Fixes
75
+
76
+ * **DEX-21811:** remove engine restriction ([b0ff9e6](https://github.com/bitdefender/dex-core/commit/b0ff9e69d89f345daac6ee9cfea128fe9d671eb5))
77
+
78
+
79
+
80
+ ## [0.2.0](https://github.com/bitdefender/dex-core/compare/@repobit/dex-store@0.1.0...@repobit/dex-store@0.2.0) (2025-03-25)
81
+
82
+
83
+ ### Features
84
+
85
+ * **DEX-21811:** add overrides ([d226d0e](https://github.com/bitdefender/dex-core/commit/d226d0ec7ede7fe51b2d6451f0356f76cd6b7d52))
86
+ * **DEX-21811:** add vlaicu as a provider ([9a0ddcc](https://github.com/bitdefender/dex-core/commit/9a0ddcc213bc99839594a8fd2082a3559e5894a6))
87
+ * **DEX-21811:** hide properties from store ([51ca86b](https://github.com/bitdefender/dex-core/commit/51ca86b9e73d70b4242efa210856da11394a0db2))
88
+
89
+
90
+ ### Bug Fixes
91
+
92
+ * **DEX-21811:** add default campaign returned by api ([56e7a8d](https://github.com/bitdefender/dex-core/commit/56e7a8d6c0f51e988b29647dbfb18bf05a8359ef))
93
+ * **DEX-21811:** apply changes for ts ([974670b](https://github.com/bitdefender/dex-core/commit/974670bd4a36c7dfbf86f09a7b3d8fac7e09f6a7))
94
+
95
+
96
+
97
+ ## 0.1.0 (2025-03-25)
98
+
99
+
100
+ ### Features
101
+
102
+ * **DEX-21811:** add initial files ([048b21f](https://github.com/bitdefender/dex-core/commit/048b21f4f3693e62646a17839cf100efc77caaf7))
103
+ * **DEX-21811:** add provider init selector ([366d36a](https://github.com/bitdefender/dex-core/commit/366d36afd2eb9ef989460b664eac3e1e24cd7317))
104
+ * **DEX-21811:** add test for provider ([884a136](https://github.com/bitdefender/dex-core/commit/884a136a45dd29c24ab4d95c7b7e3f50877cfe39))
105
+ * **DEX-21811:** add vlaicu bundle test ([d6df092](https://github.com/bitdefender/dex-core/commit/d6df0929981c839515d1fec5ad96348ef0b745c7))
106
+ * **DEX-21811:** added bundle logic for init selector ([00a7bca](https://github.com/bitdefender/dex-core/commit/00a7bca94ed04e4ebfc8925932e9ddcc3d834d00))
107
+ * **DEX-21811:** change campaign to a function ([aa578e6](https://github.com/bitdefender/dex-core/commit/aa578e66198f0d29b41dd42b7b0908a0082422cc))
108
+ * **DEX-21811:** changed getOption to be async for vlaicu bundle ([40988d8](https://github.com/bitdefender/dex-core/commit/40988d843c6545bd65eda01fb476032603b8d905))
109
+ * **DEX-21811:** fix export ([26ff9d1](https://github.com/bitdefender/dex-core/commit/26ff9d1d5eb08c87753d581efb322bb88b416e87))
110
+ * **DEX-21811:** fix types ([531c1bd](https://github.com/bitdefender/dex-core/commit/531c1bd8a0fec02de12c70341a9d29fea77e09e5))
package/README.md ADDED
@@ -0,0 +1,211 @@
1
+ # @repobit/dex-store-elements
2
+
3
+ Lightweight HTML custom elements + attribute renderers for building dynamic pricing UIs on top of `@repobit/dex-store`.
4
+
5
+ - Custom elements: `<bd-root>`, `<bd-product>`, `<bd-option>`, `<bd-state>`
6
+ - Unified attribute-based renderers (no framework required)
7
+ - Eta templates for text/HTML and attributes
8
+ - Single, merged data context across product, option and state
9
+ - Extensible “derived” variables/functions you can compute and use anywhere
10
+
11
+ ## Requirements
12
+ - Node 18+
13
+ - Peer dependency: `lit@^3`
14
+
15
+ ## Install
16
+
17
+ ```bash
18
+ npm i @repobit/dex-store-elements @repobit/dex-store lit
19
+ ```
20
+
21
+ ## Quick start
22
+
23
+ ```html
24
+ <!-- index.html -->
25
+ <script type="module">
26
+ import '@repobit/dex-store-elements';
27
+ import { initActionNodes } from '@repobit/dex-store-elements';
28
+ import { initRenderNodes } from '@repobit/dex-store-elements/renders';
29
+ import { Store } from '@repobit/dex-store';
30
+
31
+ window.addEventListener('DOMContentLoaded', async () => {
32
+ const root = document.querySelector('bd-root');
33
+ root.store = new Store({
34
+ locale: 'en-us',
35
+ provider: { name: 'vlaicu' }
36
+ });
37
+
38
+ // Optional: define derived values/functions for templates + hide DSL
39
+ root.derived = async ({ option }) => ({
40
+ mails: (p) => ((option?.getDevices?.() ?? 0) / p) * 100
41
+ });
42
+
43
+ initActionNodes(root);
44
+ initRenderNodes(root);
45
+ });
46
+ </script>
47
+
48
+ <bd-root storeName="root">
49
+ <bd-product storeName="product" productId="com.bitdefender.tsmd.v2">
50
+ <bd-option devices="5" subscription="12">
51
+ <!-- Attribute renderers (see below) -->
52
+ <div data-store-render data-store-devices></div>
53
+ <div data-store-render data-store-subscription data-store-subscription-type="years"></div>
54
+ <div data-store-render data-store-price="discounted || full"></div>
55
+ <a data-store-render data-store-buy-link>Buy</a>
56
+ <!-- Eta template (text) -->
57
+ <p>Now at only {{= it.option.discountedPrice }}!</p>
58
+ <!-- Eta template (attribute, implicit) -->
59
+ <div title="Devices {{= it.option.devices }}"></div>
60
+ <!-- Hide via DSL using merged context -->
61
+ <div data-store-render data-store-hide="!it.option.discountedPrice">
62
+ Hidden when discounted price doesn't exists
63
+ </div>
64
+ <!-- Actions -->
65
+ <button data-store-action data-store-set-devices="25">25 devices</button>
66
+ </bd-option>
67
+ </bd-product>
68
+ </bd-root>
69
+ ```
70
+
71
+ **Store Config**
72
+ - `trialLinks` and `overrides` come from `@repobit/dex-store` and work transparently with these elements. You pass them when creating the `Store` and render them via attributes like `data-store-trial-link` or by relying on overridden option fields.
73
+
74
+ Example advanced config when constructing the store:
75
+
76
+ ```ts
77
+ import { Store } from '@repobit/dex-store';
78
+
79
+ const store = new Store({
80
+ locale : 'en-us',
81
+ provider: { name: 'vlaicu' },
82
+
83
+ // Map productId -> campaign -> optionVariation -> trial URL
84
+ // productId is the final id after adaptor mapping (e.g. 'com.bitdefender.tsmd.v2').
85
+ // optionVariation key format: '<devices>-<subscription>' (e.g. '5-12').
86
+ trialLinks: {
87
+ 'com.bitdefender.tsmd.v2': {
88
+ default: {
89
+ '5-12' : 'https://trial.example.com/default/5-12',
90
+ '10-12': 'https://trial.example.com/default/10-12'
91
+ },
92
+ PromoX: {
93
+ '5-12' : 'https://trial.example.com/promox/5-12',
94
+ '10-12': 'https://trial.example.com/promox/10-12'
95
+ }
96
+ }
97
+ },
98
+
99
+ // Per-product overrides for campaign and/or options
100
+ // - Set/redirect campaign via `default.campaign` or `[campaign].campaign`
101
+ // - Merge option fields per variation; use `null` to remove an option
102
+ overrides: {
103
+ 'com.bitdefender.tsmd.v2': {
104
+ // Applies when no explicit campaign is requested
105
+ default: {
106
+ campaign: 'OvDefault'
107
+ },
108
+ PromoX: {
109
+ campaign: 'PromoX',
110
+ options : {
111
+ '5-12' : { discountedPrice: 49.99, buyLink: 'https://example.com/override/buy' },
112
+ '10-12': null // delete this variation
113
+ }
114
+ }
115
+ }
116
+ }
117
+ });
118
+ ```
119
+
120
+ Notes
121
+ - `data-store-trial-link` uses `trialLinks` to set the anchor `href`. If no mapping exists, the attribute is left untouched.
122
+ - `overrides.options` merges into each option; you can update `buyLink`, `discountedPrice`, etc., or delete an entire variation with `null`.
123
+ - Keys are resolved against the product id returned by the provider (after adaptor mapping). If you don’t use mappings, it’s the id you pass in `<bd-product productId="...">`.
124
+
125
+ ## Rendering model
126
+ - Add `data-store-render` to any element you want updated by the pipeline.
127
+ - A single binder subscribes to option, product and aggregated state contexts and renders attributes + Eta templates.
128
+ - Scoping is natural: a node sees the nearest provider up the tree (e.g., `it.option.*` is only available inside `<bd-option>`).
129
+
130
+ ## Supported attributes
131
+
132
+ - `data-store-devices`
133
+ - Renders option devices to text nodes, `<input>` value, or `<select>` options (adds `data-store-set-devices` on each option)
134
+ - Optional label helpers: `data-store-text-single="device"`, `data-store-text-many="devices"`
135
+
136
+ - `data-store-subscription`
137
+ - Renders option subscription similarly; add `data-store-subscription-type="years|months"`
138
+ - Label helpers: `data-store-text-single`, `data-store-text-many`
139
+
140
+ - `data-store-price`
141
+ - Allowed tokens: `full`, `discounted`, `full-monthly`, `discounted-monthly`
142
+ - Supports OR semantics via `||` to choose the first available variant:
143
+ - `data-store-price="discounted || full"`
144
+
145
+ - `data-store-discount`
146
+ - Allowed tokens: `value`, `percentage`, `value-monthly`, `percentage-monthly`
147
+ - Supports `||` fallbacks
148
+
149
+ - Aggregated state (min/max across options):
150
+ - `data-store-context-price` tokens: `min-full`, `max-full`, `min-full-monthly`, `max-full-monthly`, `min-discounted`, `max-discounted`, `min-discounted-monthly`, `max-discounted-monthly`
151
+ - `data-store-context-discount` tokens: `min-value`, `max-value`, `min-value-monthly`, `max-value-monthly`, `min-percentage`, `max-percentage`, `min-percentage-monthly`, `max-percentage-monthly`
152
+
153
+ - Links
154
+ - `data-store-buy-link` sets anchor `href` and useful `data-*` attributes
155
+ - `data-store-trial-link` sets anchor `href` to the trial link (if configured in `@repobit/dex-store` store config)
156
+
157
+ - Hide DSL
158
+ - `data-store-hide="<boolean expression>"` with an optional `data-store-hide-type="display|opacity|visibility"`
159
+ - Expression is compiled and evaluated against the unified context:
160
+ - `it.option.*` current option data. Price- and discount-related fields are formatted strings (currency-aware). Do not rely on numeric math for prices; they vary by currency. Devices/subscription remain numeric.
161
+ - `it.product.*` id/campaign/name
162
+ - `it.state.*` aggregated min/max data (also available under `it.ctx`)
163
+ - any keys returned from your `root.derived`
164
+ - Examples:
165
+ - `data-store-hide="it.option.discountedPrice === 0"`
166
+ - `data-store-hide="(it.state.price.min > 100) && (it.product.campaign === 'test')"`
167
+
168
+ ## Eta templates
169
+ - Text/HTML: any element that is not a provider and doesn’t contain nested providers is treated as a whole-template; `innerHTML` is compiled once and morphed via nanomorph. This preserves existing DOM event listeners and state.
170
+ - Attributes:
171
+ - Implicit: any attribute whose value contains `{{` is rendered via Eta
172
+ - The Eta context variable is `it` (Eta default). It contains:
173
+ - `it.option.*` (inside `<bd-option>`)
174
+ - `it.product.*` (inside `<bd-product>`)
175
+ - `it.state.*` and `it.ctx.*` (inside any provider subtree)
176
+ - your derived overlay merged at top-level (see below)
177
+
178
+ ## Derived variables/functions
179
+ - Provide a function at the root: `root.derived = async ({ option, product, state, store }) => ({ ... })`
180
+ - The returned object is merged into the Eta/DSL context:
181
+ - Example: `({ mails: (p) => (option.getDevices()/p)*100, option: { someVar: state.discount.value.min } })`
182
+ - Use it in Eta: `{{= it.mails(10) }}` or `{{= it.option.someVar }}`
183
+ - Use it in hide: `data-store-hide="it.mails(10) >= 50"`
184
+
185
+ ## Actions
186
+ - Add `data-store-action` to elements to emit store events.
187
+ - Set absolute values: `data-store-set-devices`, `data-store-set-subscription`, `data-store-set-id`, `data-store-set-campaign`
188
+ - Update by delta/sequence: `data-store-set-type="devices|subscription"`, `data-store-set-delta="next|prev|<number>"`
189
+ - Initialize once per mount with:
190
+ - `import { initActionNodes } from '@repobit/dex-store-elements'`
191
+ - `initActionNodes(root)`
192
+
193
+ ## Initialization helpers
194
+ - Rendering: `import { initRenderNodes } from '@repobit/dex-store-elements/renders'`
195
+ - Actions: `import { initActionNodes } from '@repobit/dex-store-elements'`
196
+
197
+ ## Caveats
198
+ - Scoping: attribute Eta and hide can only see contexts provided by ancestors. For example, `it.option.*` is only available inside `<bd-option>`.
199
+ - Nested providers: inner providers render their own subtrees; outer nodes can still render attributes safely even when they contain nested providers.
200
+
201
+ ## TypeScript
202
+ - Custom element classes are exported for advanced use:
203
+ - `RootNode`, `ProductNode`, `OptionNode`, `StateNode`
204
+ - The derived signature:
205
+ ```ts
206
+ import type { derivedContextType } from '@repobit/dex-store-elements/src/contexts/context.derived';
207
+ const derived: derivedContextType = async ({ option, product, state, store }) => ({ ... });
208
+ ```
209
+
210
+ ## License
211
+ ISC
@@ -0,0 +1 @@
1
+ export declare const button: (el: HTMLElement) => void;
@@ -0,0 +1,14 @@
1
+ import { ActionEvent, UpdateByDeltaEvent } from "../events/events.js";
2
+ import { addEventListener, readClickAttributes } from "./utilty.js";
3
+ export const button = (el) => {
4
+ const action = () => {
5
+ const attr = readClickAttributes(el);
6
+ if ('type' in attr) {
7
+ el.dispatchEvent(new UpdateByDeltaEvent(attr));
8
+ return;
9
+ }
10
+ el.dispatchEvent(new ActionEvent(attr));
11
+ };
12
+ addEventListener(el, "click", action);
13
+ };
14
+ //# sourceMappingURL=action.button.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"action.button.js","sourceRoot":"","sources":["../../../src/actions/action.button.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAEjE,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,EAAe,EAAE,EAAE;IAExC,MAAM,MAAM,GAAG,GAAG,EAAE;QAClB,MAAM,IAAI,GAAG,mBAAmB,CAAC,EAAE,CAAC,CAAC;QAErC,IAAI,MAAM,IAAI,IAAI,EAAE,CAAC;YACnB,EAAE,CAAC,aAAa,CAAC,IAAI,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAA;YAC9C,OAAO;QACT,CAAC;QAED,EAAE,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,IAAI,CAAC,CAAC,CAAA;IACzC,CAAC,CAAC;IAEF,gBAAgB,CAAC,EAAE,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;AACxC,CAAC,CAAA"}
@@ -0,0 +1 @@
1
+ export declare const input: (el: HTMLInputElement) => void;
@@ -0,0 +1,37 @@
1
+ import { ActionEvent, UpdateByDeltaEvent } from "../events/events.js";
2
+ import { addEventListener, readClickAttributes } from "./utilty.js";
3
+ export const input = (el) => {
4
+ const button = () => {
5
+ const attr = readClickAttributes(el);
6
+ if ('type' in attr) {
7
+ el.dispatchEvent(new UpdateByDeltaEvent(attr));
8
+ return;
9
+ }
10
+ el.dispatchEvent(new ActionEvent(attr));
11
+ };
12
+ const number = () => {
13
+ const attr = readClickAttributes(el);
14
+ if ('type' in attr) {
15
+ el.dispatchEvent(new UpdateByDeltaEvent({
16
+ type: attr.type,
17
+ delta: Number(el.value),
18
+ min: Number(el.min),
19
+ max: Number(el.max),
20
+ useAsValue: true,
21
+ storeId: attr.storeId
22
+ }));
23
+ return;
24
+ }
25
+ };
26
+ switch (el.type) {
27
+ case "checkbox":
28
+ case "radio":
29
+ addEventListener(el, "click", button);
30
+ break;
31
+ case "text":
32
+ case "number":
33
+ addEventListener(el, "change", number);
34
+ break;
35
+ }
36
+ };
37
+ //# sourceMappingURL=action.input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"action.input.js","sourceRoot":"","sources":["../../../src/actions/action.input.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAEjE,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,EAAoB,EAAE,EAAE;IAC5C,MAAM,MAAM,GAAG,GAAG,EAAE;QAClB,MAAM,IAAI,GAAG,mBAAmB,CAAC,EAAE,CAAC,CAAC;QAErC,IAAI,MAAM,IAAI,IAAI,EAAE,CAAC;YACnB,EAAE,CAAC,aAAa,CAAC,IAAI,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC;YAC/C,OAAO;QACT,CAAC;QAED,EAAE,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,IAAI,CAAC,CAAC,CAAA;IACzC,CAAC,CAAA;IAED,MAAM,MAAM,GAAG,GAAG,EAAE;QAClB,MAAM,IAAI,GAAG,mBAAmB,CAAC,EAAE,CAAC,CAAC;QAErC,IAAI,MAAM,IAAI,IAAI,EAAE,CAAC;YACnB,EAAE,CAAC,aAAa,CAAC,IAAI,kBAAkB,CAAC;gBACtC,IAAI,EAAQ,IAAI,CAAC,IAAI;gBACrB,KAAK,EAAO,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC;gBAC5B,GAAG,EAAS,MAAM,CAAC,EAAE,CAAC,GAAG,CAAC;gBAC1B,GAAG,EAAS,MAAM,CAAC,EAAE,CAAC,GAAG,CAAC;gBAC1B,UAAU,EAAE,IAAI;gBAChB,OAAO,EAAK,IAAI,CAAC,OAAO;aACzB,CAAC,CAAC,CAAA;YAEH,OAAO;QACT,CAAC;IACH,CAAC,CAAA;IAED,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC;QAChB,KAAK,UAAU,CAAC;QAChB,KAAK,OAAO;YACV,gBAAgB,CAAC,EAAE,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;YACtC,MAAM;QACR,KAAK,MAAM,CAAC;QACZ,KAAK,QAAQ;YACX,gBAAgB,CAAC,EAAE,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;YACvC,MAAM;IACV,CAAC;AAEH,CAAC,CAAA"}
@@ -0,0 +1 @@
1
+ export declare const select: (el: HTMLSelectElement) => void;
@@ -0,0 +1,12 @@
1
+ import { ActionEvent } from "../events/events.js";
2
+ import { addEventListener, readClickAttributes } from "./utilty.js";
3
+ export const select = (el) => {
4
+ const action = () => {
5
+ const attr = readClickAttributes(el.selectedOptions[0]);
6
+ if ('id' in attr) {
7
+ el.dispatchEvent(new ActionEvent(attr));
8
+ }
9
+ };
10
+ addEventListener(el, "change", action);
11
+ };
12
+ //# sourceMappingURL=action.select.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"action.select.js","sourceRoot":"","sources":["../../../src/actions/action.select.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAEjE,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,EAAqB,EAAE,EAAE;IAE9C,MAAM,MAAM,GAAG,GAAG,EAAE;QAClB,MAAM,IAAI,GAAG,mBAAmB,CAAC,EAAE,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;QAExD,IAAI,IAAI,IAAI,IAAI,EAAE,CAAC;YACjB,EAAE,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,IAAI,CAAC,CAAC,CAAA;QACzC,CAAC;IACH,CAAC,CAAC;IAEF,gBAAgB,CAAC,EAAE,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;AACzC,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ declare const initActionNodes: (document: HTMLElement) => void;
2
+ export { initActionNodes };
@@ -0,0 +1,30 @@
1
+ import { DATA_ACTION_NODE, handleActionNode } from "./utilty.js";
2
+ const initActionNodes = (document) => {
3
+ // On page load, “announce” the ones already in the DOM:
4
+ document
5
+ .querySelectorAll(DATA_ACTION_NODE)
6
+ .forEach(handleActionNode);
7
+ // Watch for future adds/removals:
8
+ const mo = new MutationObserver(muts => {
9
+ for (const m of muts) {
10
+ for (const node of Array.from(m.addedNodes)) {
11
+ if (!(node instanceof HTMLElement))
12
+ continue;
13
+ // check the node itself
14
+ if (node.matches(DATA_ACTION_NODE)) {
15
+ handleActionNode(node);
16
+ }
17
+ node
18
+ .querySelectorAll(DATA_ACTION_NODE)
19
+ .forEach(handleActionNode);
20
+ }
21
+ }
22
+ });
23
+ // make sure to observe subtree so deep inserts fire here:
24
+ mo.observe(document, {
25
+ childList: true,
26
+ subtree: true
27
+ });
28
+ };
29
+ export { initActionNodes };
30
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/actions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE1E,MAAM,eAAe,GAAG,CAAC,QAAqB,EAAE,EAAE;IAClD,wDAAwD;IACtD,QAAQ;SACL,gBAAgB,CAAa,gBAAgB,CAAC;SAC9C,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAE7B,kCAAkC;IAClC,MAAM,EAAE,GAAG,IAAI,gBAAgB,CAAC,IAAI,CAAC,EAAE;QACrC,KAAK,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC;YACrB,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,EAAE,CAAC;gBAC5C,IAAI,CAAC,CAAC,IAAI,YAAY,WAAW,CAAC;oBAAE,SAAS;gBAE7C,wBAAwB;gBACxB,IAAI,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,EAAE,CAAC;oBACnC,gBAAgB,CAAC,IAAkB,CAAC,CAAC;gBACvC,CAAC;gBAED,IAAI;qBACD,gBAAgB,CAAa,gBAAgB,CAAC;qBAC9C,OAAO,CAAC,gBAAgB,CAAC,CAAC;YAC/B,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,0DAA0D;IAC1D,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE;QACnB,SAAS,EAAE,IAAI;QACf,OAAO,EAAI,IAAI;KAChB,CAAC,CAAC;AACL,CAAC,CAAA;AAED,OAAO,EAAE,eAAe,EAAE,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { Action, UpdateByDelta } from "../events/events.js";
2
+ export type ActionAttributes = UpdateByDelta | Action;
3
+ export type ActionNode = HTMLElement & {
4
+ storeName: symbol;
5
+ };
6
+ export declare const DATA_ACTION_NODE = "[data-store-action]";
7
+ export declare const readClickAttributes: (el: HTMLElement) => ActionAttributes;
8
+ export declare const handleActionNode: (node: ActionNode) => void;
9
+ export declare const addEventListener: (el: HTMLElement, type: "click" | "change", listener: (event: Event) => void) => void;
@@ -0,0 +1,88 @@
1
+ import { CollectActionEvent, CollectUpdateByDeltaEvent } 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
+ export const readClickAttributes = (el) => {
7
+ const ds = el.dataset;
8
+ const storeId = ds.storeId || undefined;
9
+ if ('storeSetType' in ds) {
10
+ return {
11
+ type: ds.storeSetType,
12
+ delta: ds.storeSetDelta === "next" || ds.storeSetDelta === "prev" ? ds.storeSetDelta : Number(ds.storeSetDelta),
13
+ min: Number(ds.storeSetMin) || undefined,
14
+ max: Number(ds.storeSetMax) || undefined,
15
+ useAsValue: ds.storeSetUseAsValue === 'true' || ds.storeSetUseAsValue === '' || false,
16
+ storeId
17
+ };
18
+ }
19
+ else {
20
+ return {
21
+ devices: Number(ds.storeSetDevices) || undefined,
22
+ subscription: Number(ds.storeSetSubscription) || undefined,
23
+ id: ds.storeSetId,
24
+ campaign: ds.storeSetCampaign,
25
+ bundle: ds.storeSetBundle === 'true' || ds.storeSetBundle === '' || false,
26
+ storeId
27
+ };
28
+ }
29
+ };
30
+ const addLogic = (el) => {
31
+ if (el instanceof HTMLInputElement) {
32
+ input(el);
33
+ }
34
+ if (el instanceof HTMLSelectElement) {
35
+ select(el);
36
+ }
37
+ //treat everything else as a button
38
+ button(el);
39
+ };
40
+ const connectedCallback = (el) => {
41
+ if (!el.storeName) {
42
+ el.storeName = Symbol("action");
43
+ }
44
+ const attr = readClickAttributes(el);
45
+ const noCollect = (el.dataset.storeNoCollect === '' || el.dataset.storeNoCollect === 'true');
46
+ const shouldCollect = !noCollect;
47
+ if (shouldCollect) {
48
+ if ('type' in attr) {
49
+ el.dispatchEvent(new CollectUpdateByDeltaEvent({ name: el.storeName, update: attr }));
50
+ }
51
+ else {
52
+ el.dispatchEvent(new CollectActionEvent({ name: el.storeName, action: attr }));
53
+ }
54
+ }
55
+ };
56
+ const disconnectedCallback = (el) => {
57
+ const attr = readClickAttributes(el);
58
+ const noCollect = (el.dataset.storeNoCollect === '' || el.dataset.storeNoCollect === 'true');
59
+ const shouldCollect = !noCollect;
60
+ if (shouldCollect) {
61
+ if ('storeSetType' in attr) {
62
+ el.dispatchEvent(new CollectUpdateByDeltaEvent({
63
+ name: el.storeName,
64
+ update: null
65
+ }));
66
+ }
67
+ else {
68
+ el.dispatchEvent(new CollectActionEvent({
69
+ name: el.storeName,
70
+ action: null
71
+ }));
72
+ }
73
+ }
74
+ };
75
+ export const handleActionNode = (node) => {
76
+ addLogic(node);
77
+ connectedCallback(node);
78
+ };
79
+ export const addEventListener = (el, type, listener) => {
80
+ el.addEventListener(type, listener);
81
+ const originalRemove = el.remove;
82
+ el.remove = () => {
83
+ disconnectedCallback(el);
84
+ el.removeEventListener(type, listener);
85
+ originalRemove.call(el);
86
+ };
87
+ };
88
+ //# sourceMappingURL=utilty.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utilty.js","sourceRoot":"","sources":["../../../src/actions/utilty.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,9 @@
1
+ import type { ProductOption } from '@repobit/dex-store';
2
+ export type dataLayerPayload = {
3
+ option: ProductOption;
4
+ event: "product-loaded" | "main-product-loaded" | "product-comparison" | (string & {});
5
+ };
6
+ export type dataLayerContextType = ((payload: dataLayerPayload) => void) | undefined;
7
+ export declare const dataLayerContext: {
8
+ __context__: dataLayerContextType;
9
+ };
@@ -0,0 +1,3 @@
1
+ import { createContext } from '@lit/context';
2
+ export const dataLayerContext = createContext(Symbol('dataLayer'));
3
+ //# sourceMappingURL=context.datalayer.js.map
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,12 @@
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
+ };
@@ -0,0 +1,3 @@
1
+ import { createContext } from '@lit/context';
2
+ export const derivedContext = createContext(Symbol('derived'));
3
+ //# sourceMappingURL=context.derived.js.map
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,5 @@
1
+ import { EventType } from '../events/events.js';
2
+ export type eventContexType = EventType | undefined;
3
+ export declare const eventContext: {
4
+ __context__: eventContexType;
5
+ };
@@ -0,0 +1,3 @@
1
+ import { createContext } from '@lit/context';
2
+ export const eventContext = createContext(Symbol('store-event'));
3
+ //# sourceMappingURL=context.event.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.event.js","sourceRoot":"","sources":["../../../src/contexts/context.event.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAG7C,MAAM,CAAC,MAAM,YAAY,GAAG,aAAa,CAAkB,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC"}
@@ -0,0 +1,5 @@
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
+ };
@@ -0,0 +1,3 @@
1
+ import { createContext } from '@lit/context';
2
+ export const optionContext = createContext(Symbol('option'));
3
+ //# sourceMappingURL=context.option.js.map
@@ -0,0 +1 @@
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"}