@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.
- package/CHANGELOG.md +110 -0
- package/README.md +211 -0
- package/dist/src/actions/action.button.d.ts +1 -0
- package/dist/src/actions/action.button.js +14 -0
- package/dist/src/actions/action.button.js.map +1 -0
- package/dist/src/actions/action.input.d.ts +1 -0
- package/dist/src/actions/action.input.js +37 -0
- package/dist/src/actions/action.input.js.map +1 -0
- package/dist/src/actions/action.select.d.ts +1 -0
- package/dist/src/actions/action.select.js +12 -0
- package/dist/src/actions/action.select.js.map +1 -0
- package/dist/src/actions/index.d.ts +2 -0
- package/dist/src/actions/index.js +30 -0
- package/dist/src/actions/index.js.map +1 -0
- package/dist/src/actions/utilty.d.ts +9 -0
- package/dist/src/actions/utilty.js +88 -0
- package/dist/src/actions/utilty.js.map +1 -0
- package/dist/src/contexts/context.datalayer.d.ts +9 -0
- package/dist/src/contexts/context.datalayer.js +3 -0
- package/dist/src/contexts/context.datalayer.js.map +1 -0
- package/dist/src/contexts/context.derived.d.ts +12 -0
- package/dist/src/contexts/context.derived.js +3 -0
- package/dist/src/contexts/context.derived.js.map +1 -0
- package/dist/src/contexts/context.event.d.ts +5 -0
- package/dist/src/contexts/context.event.js +3 -0
- package/dist/src/contexts/context.event.js.map +1 -0
- package/dist/src/contexts/context.option.d.ts +5 -0
- package/dist/src/contexts/context.option.js +3 -0
- package/dist/src/contexts/context.option.js.map +1 -0
- package/dist/src/contexts/context.product.d.ts +5 -0
- package/dist/src/contexts/context.product.js +3 -0
- package/dist/src/contexts/context.product.js.map +1 -0
- package/dist/src/contexts/context.state.d.ts +28 -0
- package/dist/src/contexts/context.state.js +3 -0
- package/dist/src/contexts/context.state.js.map +1 -0
- package/dist/src/contexts/context.store.d.ts +5 -0
- package/dist/src/contexts/context.store.js +3 -0
- package/dist/src/contexts/context.store.js.map +1 -0
- package/dist/src/dsl/compilers/array/compiler.d.ts +1 -0
- package/dist/src/dsl/compilers/array/compiler.js +30 -0
- package/dist/src/dsl/compilers/array/compiler.js.map +1 -0
- package/dist/src/dsl/compilers/boolean/compiler.d.ts +7 -0
- package/dist/src/dsl/compilers/boolean/compiler.js +53 -0
- package/dist/src/dsl/compilers/boolean/compiler.js.map +1 -0
- package/dist/src/dsl/compilers/enum/compiler.d.ts +7 -0
- package/dist/src/dsl/compilers/enum/compiler.js +16 -0
- package/dist/src/dsl/compilers/enum/compiler.js.map +1 -0
- package/dist/src/dsl/compilers/index.d.ts +12 -0
- package/dist/src/dsl/compilers/index.js +9 -0
- package/dist/src/dsl/compilers/index.js.map +1 -0
- package/dist/src/dsl/utilty.d.ts +6 -0
- package/dist/src/dsl/utilty.js +32 -0
- package/dist/src/dsl/utilty.js.map +1 -0
- package/dist/src/events/events.d.ts +60 -0
- package/dist/src/events/events.js +56 -0
- package/dist/src/events/events.js.map +1 -0
- package/dist/src/index.d.ts +9 -0
- package/dist/src/index.js +10 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/nodes/node.context.d.ts +3 -0
- package/dist/src/nodes/node.context.js +15 -0
- package/dist/src/nodes/node.context.js.map +1 -0
- package/dist/src/nodes/node.option.d.ts +32 -0
- package/dist/src/nodes/node.option.js +247 -0
- package/dist/src/nodes/node.option.js.map +1 -0
- package/dist/src/nodes/node.product.d.ts +14 -0
- package/dist/src/nodes/node.product.js +99 -0
- package/dist/src/nodes/node.product.js.map +1 -0
- package/dist/src/nodes/node.root.d.ts +16 -0
- package/dist/src/nodes/node.root.js +53 -0
- package/dist/src/nodes/node.root.js.map +1 -0
- package/dist/src/nodes/node.state.d.ts +112 -0
- package/dist/src/nodes/node.state.js +742 -0
- package/dist/src/nodes/node.state.js.map +1 -0
- package/dist/src/renders/attributes/buyLink.d.ts +2 -0
- package/dist/src/renders/attributes/buyLink.js +18 -0
- package/dist/src/renders/attributes/buyLink.js.map +1 -0
- package/dist/src/renders/attributes/devices.d.ts +2 -0
- package/dist/src/renders/attributes/devices.js +32 -0
- package/dist/src/renders/attributes/devices.js.map +1 -0
- package/dist/src/renders/attributes/discount.d.ts +2 -0
- package/dist/src/renders/attributes/discount.js +96 -0
- package/dist/src/renders/attributes/discount.js.map +1 -0
- package/dist/src/renders/attributes/hide.d.ts +2 -0
- package/dist/src/renders/attributes/hide.js +33 -0
- package/dist/src/renders/attributes/hide.js.map +1 -0
- package/dist/src/renders/attributes/index.d.ts +3 -0
- package/dist/src/renders/attributes/index.js +24 -0
- package/dist/src/renders/attributes/index.js.map +1 -0
- package/dist/src/renders/attributes/price.d.ts +2 -0
- package/dist/src/renders/attributes/price.js +96 -0
- package/dist/src/renders/attributes/price.js.map +1 -0
- package/dist/src/renders/attributes/subscription.d.ts +2 -0
- package/dist/src/renders/attributes/subscription.js +34 -0
- package/dist/src/renders/attributes/subscription.js.map +1 -0
- package/dist/src/renders/attributes/trialLink.d.ts +2 -0
- package/dist/src/renders/attributes/trialLink.js +13 -0
- package/dist/src/renders/attributes/trialLink.js.map +1 -0
- package/dist/src/renders/context.d.ts +11 -0
- package/dist/src/renders/context.js +88 -0
- package/dist/src/renders/context.js.map +1 -0
- package/dist/src/renders/format.d.ts +2 -0
- package/dist/src/renders/format.js +21 -0
- package/dist/src/renders/format.js.map +1 -0
- package/dist/src/renders/index.d.ts +2 -0
- package/dist/src/renders/index.js +30 -0
- package/dist/src/renders/index.js.map +1 -0
- package/dist/src/renders/observe.d.ts +4 -0
- package/dist/src/renders/observe.js +30 -0
- package/dist/src/renders/observe.js.map +1 -0
- package/dist/src/renders/utility.d.ts +28 -0
- package/dist/src/renders/utility.js +132 -0
- package/dist/src/renders/utility.js.map +1 -0
- package/dist/src/templating/eta.d.ts +3 -0
- package/dist/src/templating/eta.js +9 -0
- package/dist/src/templating/eta.js.map +1 -0
- package/package.json +64 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.js","sourceRoot":"","sources":["../../../src/renders/format.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,YAAoB,EACpB,SAA6B,OAAO,EACpC,YAAqB,EACrB,UAAmB,EACnB,EAAE;IACF,MAAM,KAAK,GAAG,YAAY,GAAG,EAAE,CAAC;IAChC,MAAM,MAAM,GAAG,YAAY,GAAG,EAAE,CAAC;IAEjC,IAAI,MAAM,KAAK,OAAO,IAAI,MAAM,KAAK,CAAC,EAAE,CAAC;QACvC,IAAI,CAAC,UAAU,IAAI,CAAC,YAAY,EAAE,CAAC;YACjC,OAAO,GAAG,KAAK,EAAE,CAAC;QACpB,CAAC;QACD,OAAO,GAAG,KAAK,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC;IAC/D,CAAC;IAED,IAAI,CAAC,UAAU,IAAI,CAAC,YAAY,EAAE,CAAC;QACjC,OAAO,GAAG,YAAY,EAAE,CAAC;IAC3B,CAAC;IAED,OAAO,GAAG,YAAY,IAAI,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC;AAC7E,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG,CAC3B,OAAe,EACf,YAAqB,EACrB,UAAmB,EACnB,EAAE;IACF,IAAI,CAAC,UAAU,IAAI,CAAC,YAAY,EAAE,CAAC;QACjC,OAAO,GAAG,OAAO,EAAE,CAAC;IACtB,CAAC;IACD,OAAO,GAAG,OAAO,IAAI,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC;AACnE,CAAC,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { DATA_RENDER_NODE, handleRenderNode } from "./utility.js";
|
|
2
|
+
const initRenderNodes = (document) => {
|
|
3
|
+
// On page load, “announce” the ones already in the DOM:
|
|
4
|
+
document
|
|
5
|
+
.querySelectorAll(DATA_RENDER_NODE)
|
|
6
|
+
.forEach(handleRenderNode);
|
|
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_RENDER_NODE)) {
|
|
15
|
+
handleRenderNode(node);
|
|
16
|
+
}
|
|
17
|
+
node
|
|
18
|
+
.querySelectorAll(DATA_RENDER_NODE)
|
|
19
|
+
.forEach(handleRenderNode);
|
|
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 { initRenderNodes };
|
|
30
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/renders/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAc,MAAM,WAAW,CAAC;AAE3E,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,4 @@
|
|
|
1
|
+
export declare const OBS_ATTRS_COMMON: readonly ["data-store-hide", "data-store-hide-type"];
|
|
2
|
+
export declare const OBS_ATTRS_OPTION: readonly ["data-store-devices", "data-store-subscription", "data-store-text-single", "data-store-text-many", "data-store-subscription-type", "data-store-price", "data-store-discount", "data-store-buy-link", "data-store-trial-link"];
|
|
3
|
+
export declare const OBS_ATTRS_STATE: readonly ["data-store-context-price", "data-store-context-discount"];
|
|
4
|
+
export declare const OBS_ATTRS_OPTION_PLUS_STATE: readonly ["data-store-devices", "data-store-subscription", "data-store-text-single", "data-store-text-many", "data-store-subscription-type", "data-store-price", "data-store-discount", "data-store-buy-link", "data-store-trial-link", "data-store-context-price", "data-store-context-discount", "data-store-hide", "data-store-hide-type"];
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Attributes that, when changed, should trigger a re-render of nodes.
|
|
2
|
+
// Shared across both contexts
|
|
3
|
+
export const OBS_ATTRS_COMMON = [
|
|
4
|
+
'data-store-hide',
|
|
5
|
+
'data-store-hide-type'
|
|
6
|
+
];
|
|
7
|
+
// Attributes affecting option-level rendering
|
|
8
|
+
export const OBS_ATTRS_OPTION = [
|
|
9
|
+
'data-store-devices',
|
|
10
|
+
'data-store-subscription',
|
|
11
|
+
'data-store-text-single',
|
|
12
|
+
'data-store-text-many',
|
|
13
|
+
'data-store-subscription-type',
|
|
14
|
+
'data-store-price',
|
|
15
|
+
'data-store-discount',
|
|
16
|
+
'data-store-buy-link',
|
|
17
|
+
'data-store-trial-link'
|
|
18
|
+
];
|
|
19
|
+
// Attributes affecting state-level rendering
|
|
20
|
+
export const OBS_ATTRS_STATE = [
|
|
21
|
+
'data-store-context-price',
|
|
22
|
+
'data-store-context-discount'
|
|
23
|
+
];
|
|
24
|
+
// Combined set used when option-side also cares about state-driven attributes in markup
|
|
25
|
+
export const OBS_ATTRS_OPTION_PLUS_STATE = [
|
|
26
|
+
...OBS_ATTRS_OPTION,
|
|
27
|
+
...OBS_ATTRS_STATE,
|
|
28
|
+
...OBS_ATTRS_COMMON
|
|
29
|
+
];
|
|
30
|
+
//# sourceMappingURL=observe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"observe.js","sourceRoot":"","sources":["../../../src/renders/observe.ts"],"names":[],"mappings":"AAAA,sEAAsE;AAEtE,8BAA8B;AAC9B,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,iBAAiB;IACjB,sBAAsB;CACd,CAAC;AAEX,8CAA8C;AAC9C,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,oBAAoB;IACpB,yBAAyB;IACzB,wBAAwB;IACxB,sBAAsB;IACtB,8BAA8B;IAC9B,kBAAkB;IAClB,qBAAqB;IACrB,qBAAqB;IACrB,uBAAuB;CACf,CAAC;AAEX,6CAA6C;AAC7C,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,0BAA0B;IAC1B,6BAA6B;CACrB,CAAC;AAEX,wFAAwF;AACxF,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,GAAG,gBAAgB;IACnB,GAAG,eAAe;IAClB,GAAG,gBAAgB;CACX,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Context, ContextType } from '@lit/context';
|
|
2
|
+
type AnyContext = Context<unknown, unknown>;
|
|
3
|
+
type CtxVal<C extends AnyContext> = ContextType<C>;
|
|
4
|
+
type ContextMap = Record<string, AnyContext>;
|
|
5
|
+
type ContextValues<M extends ContextMap> = {
|
|
6
|
+
[K in keyof M]: CtxVal<M[K]>;
|
|
7
|
+
};
|
|
8
|
+
type BindContext<M extends ContextMap> = {
|
|
9
|
+
el: HTMLElement;
|
|
10
|
+
contexts: M;
|
|
11
|
+
logic: (values: ContextValues<M>) => void | Promise<void>;
|
|
12
|
+
observedAttrs: string[];
|
|
13
|
+
requireAll?: boolean;
|
|
14
|
+
};
|
|
15
|
+
export type RenderNode = HTMLElement;
|
|
16
|
+
export declare const DATA_RENDER_NODE = "[data-store-render]";
|
|
17
|
+
export declare const attachContext: <C extends AnyContext>(el: HTMLElement, context: C, onValue: (value: ContextType<C>) => void, { subscribe }?: {
|
|
18
|
+
subscribe?: boolean;
|
|
19
|
+
}) => () => void | undefined;
|
|
20
|
+
export declare const observeAttributes: (el: HTMLElement, onChange: () => void, filter?: string[]) => () => void;
|
|
21
|
+
/**
|
|
22
|
+
* Subscribes to all contexts in `contexts`, coalesces updates in a microtask,
|
|
23
|
+
* and calls `logic` with the latest values once ALL are present.
|
|
24
|
+
* Returns a single disposer.
|
|
25
|
+
*/
|
|
26
|
+
export declare function bindContext<M extends ContextMap>({ el, contexts, logic, observedAttrs, requireAll }: BindContext<M>): () => void;
|
|
27
|
+
export declare const handleRenderNode: (el: RenderNode) => void;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { derivedContext } from '../contexts/context.derived.js';
|
|
2
|
+
import { optionContext } from '../contexts/context.option.js';
|
|
3
|
+
import { productContext } from '../contexts/context.product.js';
|
|
4
|
+
import { stateContext } from '../contexts/context.state.js';
|
|
5
|
+
// Legacy per-context renders remain available until full migration is complete
|
|
6
|
+
import { renderAttributes } from '../renders/attributes/index.js';
|
|
7
|
+
import { OBS_ATTRS_OPTION_PLUS_STATE } from '../renders/observe.js';
|
|
8
|
+
import { ContextEvent } from '@lit/context';
|
|
9
|
+
export const DATA_RENDER_NODE = "[data-store-render]";
|
|
10
|
+
export const attachContext = (el, context, onValue, { subscribe = true } = {}) => {
|
|
11
|
+
let dispose;
|
|
12
|
+
el.dispatchEvent(new ContextEvent(context, el, (value, d) => {
|
|
13
|
+
onValue(value);
|
|
14
|
+
dispose = d; // may be provided when subscribe === true
|
|
15
|
+
}, subscribe));
|
|
16
|
+
// call this later to unsubscribe (if provider gave you a disposer)
|
|
17
|
+
return () => dispose?.();
|
|
18
|
+
};
|
|
19
|
+
export const observeAttributes = (el, onChange, filter) => {
|
|
20
|
+
const mo = new MutationObserver((mutations) => {
|
|
21
|
+
for (const m of mutations) {
|
|
22
|
+
if (m.type === 'attributes') {
|
|
23
|
+
onChange();
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
mo.observe(el, {
|
|
28
|
+
attributes: true,
|
|
29
|
+
attributeFilter: filter // e.g. ['user-id','subscribe']
|
|
30
|
+
});
|
|
31
|
+
// return disposer
|
|
32
|
+
return () => mo.disconnect();
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Subscribes to all contexts in `contexts`, coalesces updates in a microtask,
|
|
36
|
+
* and calls `logic` with the latest values once ALL are present.
|
|
37
|
+
* Returns a single disposer.
|
|
38
|
+
*/
|
|
39
|
+
export function bindContext({ el, contexts, logic, observedAttrs = [], requireAll = true }) {
|
|
40
|
+
const keys = Object.keys(contexts);
|
|
41
|
+
const latest = {};
|
|
42
|
+
let scheduled = false; // a microtask has been queued
|
|
43
|
+
let running = false; // logic is currently executing
|
|
44
|
+
let needsRun = false; // something changed; run again after current finishes
|
|
45
|
+
let disposed = false;
|
|
46
|
+
const haveAll = () => keys.every((k) => latest[k] !== undefined);
|
|
47
|
+
const haveAny = () => keys.some((k) => latest[k] !== undefined);
|
|
48
|
+
const pump = async () => {
|
|
49
|
+
scheduled = false;
|
|
50
|
+
// If we're already running, just mark that we need another pass.
|
|
51
|
+
if (running || disposed) {
|
|
52
|
+
needsRun = true;
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
// Run when required contexts are present at least once.
|
|
56
|
+
if (requireAll ? !haveAll() : !haveAny())
|
|
57
|
+
return;
|
|
58
|
+
running = true;
|
|
59
|
+
try {
|
|
60
|
+
do {
|
|
61
|
+
needsRun = false;
|
|
62
|
+
// Snapshot so each run sees a stable view even if `latest` changes while awaiting.
|
|
63
|
+
const snapshot = {};
|
|
64
|
+
for (const k of keys)
|
|
65
|
+
snapshot[k] = latest[k];
|
|
66
|
+
await Promise.resolve(logic(snapshot));
|
|
67
|
+
} while (needsRun && !disposed); // drain one more time if updates queued while running
|
|
68
|
+
}
|
|
69
|
+
catch (err) {
|
|
70
|
+
// Keep the queue alive even if user logic throws.
|
|
71
|
+
console.error(err);
|
|
72
|
+
}
|
|
73
|
+
finally {
|
|
74
|
+
running = false;
|
|
75
|
+
if (needsRun && !disposed) {
|
|
76
|
+
scheduled = true;
|
|
77
|
+
queueMicrotask(pump);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
const scheduleRun = () => {
|
|
82
|
+
if (disposed)
|
|
83
|
+
return;
|
|
84
|
+
needsRun = true;
|
|
85
|
+
if (!scheduled) {
|
|
86
|
+
scheduled = true;
|
|
87
|
+
queueMicrotask(pump);
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
// subscribe to each requested context
|
|
91
|
+
const disposers = keys.map((k) => attachContext(el, contexts[k], (value) => {
|
|
92
|
+
latest[k] = value;
|
|
93
|
+
scheduleRun();
|
|
94
|
+
}));
|
|
95
|
+
// optional: observe attributes once for the whole group
|
|
96
|
+
const stopAttrs = observedAttrs.length > 0
|
|
97
|
+
? observeAttributes(el, scheduleRun, observedAttrs)
|
|
98
|
+
: () => { };
|
|
99
|
+
// single disposer
|
|
100
|
+
return () => {
|
|
101
|
+
disposed = true;
|
|
102
|
+
stopAttrs();
|
|
103
|
+
for (const d of disposers)
|
|
104
|
+
d();
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
const addLogic = (el) => {
|
|
108
|
+
// Single binder aggregates both contexts and renders when either changes
|
|
109
|
+
return bindContext({
|
|
110
|
+
el,
|
|
111
|
+
contexts: { optionContext, stateContext, productContext, derivedContext },
|
|
112
|
+
logic: async ({ optionContext, stateContext, productContext, derivedContext }) => {
|
|
113
|
+
const opt = await optionContext;
|
|
114
|
+
await renderAttributes(el, {
|
|
115
|
+
option: opt,
|
|
116
|
+
state: stateContext,
|
|
117
|
+
product: productContext,
|
|
118
|
+
derived: derivedContext
|
|
119
|
+
});
|
|
120
|
+
},
|
|
121
|
+
observedAttrs: [...OBS_ATTRS_OPTION_PLUS_STATE]
|
|
122
|
+
});
|
|
123
|
+
};
|
|
124
|
+
export const handleRenderNode = (el) => {
|
|
125
|
+
const dispose = addLogic(el);
|
|
126
|
+
const originalRemove = el.remove;
|
|
127
|
+
el.remove = () => {
|
|
128
|
+
dispose();
|
|
129
|
+
originalRemove.call(el);
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
//# sourceMappingURL=utility.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utility.js","sourceRoot":"","sources":["../../../src/renders/utility.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,+EAA+E;AAC/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,2BAA2B,EAAE,MAAM,mBAAmB,CAAC;AAChE,OAAO,EAAW,YAAY,EAAe,MAAM,cAAc,CAAC;AAelE,MAAM,CAAC,MAAM,gBAAgB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EAAyE;IACzE,OAAO,WAAW,CAAC;QACjB,EAAE;QACF,QAAQ,EAAE,EAAE,aAAa,EAAE,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE;QACzE,KAAK,EAAK,KAAK,EAAE,EAAE,aAAa,EAAE,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,EAAE,EAAE;YAClF,MAAM,GAAG,GAAG,MAAM,aAAiD,CAAC;YACpE,MAAM,gBAAgB,CACpB,EAAE,EACF;gBACE,MAAM,EAAG,GAAG;gBACZ,KAAK,EAAI,YAAY;gBACrB,OAAO,EAAE,cAAc;gBACvB,OAAO,EAAE,cAAc;aACxB,CACF,CAAC;QACJ,CAAC;QACD,aAAa,EAAE,CAAC,GAAG,2BAA2B,CAAC;KAChD,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,EAAc,EAAE,EAAE;IACjD,MAAM,OAAO,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;IAE7B,MAAM,cAAc,GAAG,EAAE,CAAC,MAAM,CAAC;IAEjC,EAAE,CAAC,MAAM,GAAG,GAAG,EAAE;QACf,OAAO,EAAE,CAAC;QACV,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC1B,CAAC,CAAA;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Eta } from 'eta';
|
|
2
|
+
// Single Eta engine instance used across nodes
|
|
3
|
+
const eta = new Eta({
|
|
4
|
+
// We control where templates are injected (text nodes), so auto-escape can remain default.
|
|
5
|
+
// Configure here if you want escaping behavior to change globally.
|
|
6
|
+
tags: ["{{", "}}"]
|
|
7
|
+
});
|
|
8
|
+
export default eta;
|
|
9
|
+
//# sourceMappingURL=eta.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eta.js","sourceRoot":"","sources":["../../../src/templating/eta.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,+CAA+C;AAC/C,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC;IAClB,2FAA2F;IAC3F,mEAAmE;IACnE,IAAI,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC;CACnB,CAAC,CAAC;AAEH,eAAe,GAAG,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@repobit/dex-store-elements",
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "HTML elements layer for pricings",
|
|
5
|
+
"author": "Buga Adrian Alexandru <abuga@bitdefender.com>",
|
|
6
|
+
"homepage": "https://github.com/bitdefender/dex-core#readme",
|
|
7
|
+
"license": "ISC",
|
|
8
|
+
"type": "module",
|
|
9
|
+
"main": "dist/src/index.js",
|
|
10
|
+
"module": "dist/src/index.js",
|
|
11
|
+
"types": "dist/src/index.d.ts",
|
|
12
|
+
"directories": {
|
|
13
|
+
"src": "dist/src"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist/src",
|
|
17
|
+
"README.md",
|
|
18
|
+
"CHANGELOG.md",
|
|
19
|
+
"LICENSE"
|
|
20
|
+
],
|
|
21
|
+
"exports": {
|
|
22
|
+
".": "./dist/src/index.js"
|
|
23
|
+
},
|
|
24
|
+
"publishConfig": {
|
|
25
|
+
"access": "public"
|
|
26
|
+
},
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "git+https://github.com/bitdefender/dex-core.git"
|
|
30
|
+
},
|
|
31
|
+
"scripts": {
|
|
32
|
+
"build": "tsc && tsc-alias",
|
|
33
|
+
"test": "vitest run"
|
|
34
|
+
},
|
|
35
|
+
"bugs": {
|
|
36
|
+
"url": "https://github.com/bitdefender/dex-core/issues"
|
|
37
|
+
},
|
|
38
|
+
"volta": {
|
|
39
|
+
"node": "22.14.0"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@lit/context": "*",
|
|
43
|
+
"@lit/task": "*",
|
|
44
|
+
"lit": "*"
|
|
45
|
+
},
|
|
46
|
+
"peerDependencies": {
|
|
47
|
+
"lit": "^3.3.0"
|
|
48
|
+
},
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"@lit/context": "^1.1.5",
|
|
51
|
+
"@lit/task": "^1.0.2",
|
|
52
|
+
"deepmerge": "^4.3.1",
|
|
53
|
+
"eta": "^4.0.1",
|
|
54
|
+
"nanomorph": "^5.4.3"
|
|
55
|
+
},
|
|
56
|
+
"contributes": {
|
|
57
|
+
"html": {
|
|
58
|
+
"customData": [
|
|
59
|
+
"./dom-data.json"
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
"gitHead": "5d1667d5a901619b4883d656a9e1dd5b76da2eae"
|
|
64
|
+
}
|