driftjs-shared 0.0.13 → 0.0.15
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/dist/index-cjs.js +1 -2
- package/dist/index-es.js +69 -256
- package/package.json +1 -1
package/dist/index-cjs.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=256,t=new Set([`area`,`base`,`br`,`col`,`embed`,`hr`,`img`,`input`,`link`,`meta`,`param`,`source`,`track`,`wbr`]);function n(e){return Array.isArray(e)?e:e&&typeof e[Symbol.iterator]==`function`?Array.from(e):[]}function
|
|
2
|
-
`&&(c=!1);continue}if(l){m===`*`&&e[p+1]===`/`&&(l=!1,p++);continue}if(u){if(o){o=!1;continue}if(m===`\\`){o=!0;continue}if(d){m===`]`&&(d=!1);continue}if(m===`[`){d=!0;continue}if(m===`/`){u=!1;continue}continue}if(m===`/`&&e[p+1]===`/`){c=!0,p++;continue}if(m===`/`&&e[p+1]===`*`){l=!0,p++;continue}if(m===`/`&&s(e,p)){u=!0,d=!1;continue}if(m===`'`||m===`"`||m==="`"){a=m;continue}if(m===`(`){n++;continue}if(m===`)`){n=Math.max(0,n-1);continue}if(m===`[`){r++;continue}if(m===`]`){r=Math.max(0,r-1);continue}if(m===`{`){i++;continue}if(m===`}`){i=Math.max(0,i-1),f.length>0&&i===f[f.length-1]&&(f.pop(),a="`");continue}if(n===0&&r===0&&i===0&&a===null&&!c&&!l&&!u){let e=t(p,m);if(typeof e==`number`)return e;if(e===!0)return p}}return-1}function l(e,t){return c(e,(e,n)=>n===t)}function u(e,t=`,`){let n=[],r=0;c(e,(i,a)=>{if(a===t){let t=e.slice(r,i).trim();t&&n.push(t),r=i+1}});let i=e.slice(r).trim();return i&&n.push(i),n}function d(e){let t=e.trim();if(!t.startsWith(`(`)||!t.endsWith(`)`))return!1;let n=0,r=null,i=!1;for(let e=0;e<t.length-1;e++){let a=t[e];if(r!==null){i?i=!1:a===`\\`?i=!0:a===r&&(r=null);continue}if(a===`"`||a===`'`||a==="`"){r=a;continue}if(a===`(`?n++:a===`)`&&n--,n===0)return!1}return n===1}function f(e,t,n){if(!e||typeof e!=`object`||t===`__proto__`||t===`constructor`||t===`prototype`||t===`__drift_mark_dirty__`)return n;let r=e,i=null,a=[];for(;r&&r!==Object.prototype;){if(typeof r.__drift_mark_dirty__==`function`&&a.push(r.__drift_mark_dirty__),Object.prototype.hasOwnProperty.call(r,t)){r[t]=n,i=r;break}r=Object.getPrototypeOf(r)}if(i||(e[t]=n),!t.startsWith(`__drift_`))for(let e=0;e<a.length;e++)try{a[e](t)}catch(e){console.error(`[DriftJS] Error notifying dirty update for "${t}":`,e)}return n}function p(e,t){if(!e||typeof e!=`object`)return!1;let n=e;for(;n&&n!==Object.prototype;){if(Object.prototype.hasOwnProperty.call(n,t))return!0;n=Object.getPrototypeOf(n)}return!1}function m(e,t){if(!(t===`__proto__`||t===`constructor`||t===`prototype`||t===`__drift_mark_dirty__`)){if(e&&typeof e==`object`){let n=e;for(;n&&n!==Object.prototype;){if(Object.prototype.hasOwnProperty.call(n,t))return n[t];n=Object.getPrototypeOf(n)}}if(typeof globalThis<`u`&&globalThis){let e=globalThis;for(;e&&e!==Object.prototype;){if(Object.prototype.hasOwnProperty.call(e,t))return globalThis[t];e=Object.getPrototypeOf(e)}}}}var h=m;typeof globalThis<`u`&&!globalThis._get&&(globalThis._get=m);function g(e,t,n){!e||typeof e!=`object`||t===`__proto__`||t===`constructor`||t===`prototype`||t===`__drift_mark_dirty__`||(e[t]=n)}function _(e,t,r,i,a){if(g(e,t,r),i&&g(e,i,a),t.startsWith(`{`)&&t.endsWith(`}`)){let n=r&&typeof r==`object`?r:{},i=u(t.slice(1,-1));for(let t of i){let r=l(t,`:`);if(r!==-1){let i=t.slice(0,r).trim(),a=t.slice(r+1).trim(),o=l(a,`=`);if(o!==-1){let t=a.slice(0,o).trim(),r=a.slice(o+1).trim(),s=Object.prototype.hasOwnProperty.call(n,i)?n[i]:void 0;g(e,t,s===void 0?v(r,e):s)}else a.startsWith(`{`)||a.startsWith(`[`)?_(e,a,Object.prototype.hasOwnProperty.call(n,i)?n[i]:void 0,null,0):g(e,a,Object.prototype.hasOwnProperty.call(n,i)?n[i]:void 0)}else{let r=l(t,`=`);if(r!==-1){let i=t.slice(0,r).trim(),a=t.slice(r+1).trim(),o=Object.prototype.hasOwnProperty.call(n,i)?n[i]:void 0;g(e,i,o===void 0?v(a,e):o)}else g(e,t,Object.prototype.hasOwnProperty.call(n,t)?n[t]:void 0)}}}else if(t.startsWith(`[`)&&t.endsWith(`]`)){let i=n(r),a=u(t.slice(1,-1));for(let t=0;t<a.length;t++){let n=a[t],r=l(n,`=`);if(r!==-1){let a=n.slice(0,r).trim(),o=n.slice(r+1).trim(),s=i[t];g(e,a,s===void 0?v(o,e):s)}else n.startsWith(`{`)||n.startsWith(`[`)?_(e,n,i[t],null,0):g(e,n,i[t])}}}function v(e,t){let n=e.trim();if(n===`true`)return!0;if(n===`false`)return!1;if(n===`null`)return null;if(n!==`undefined`){if(n.startsWith(`"`)&&n.endsWith(`"`)||n.startsWith(`'`)&&n.endsWith(`'`)||n.startsWith("`")&&n.endsWith("`"))return n.slice(1,-1);if(!Number.isNaN(Number(n))&&n!==``)return Number(n);try{return JSON.parse(n)}catch{return t&&p(t,n)?m(t,n):n}}}var y=Symbol.for(`__drift_vm_stack__`);function b(){let e=globalThis;return e[y]||(e[y]=[]),e[y]}function x(e){b().push(e)}function S(){b().pop()}function C(){let e=b();return e.length>0?e[e.length-1]:null}function w(e,t){let n={id:Symbol(t||`DriftContext`),name:t,defaultValue:e,provide(e){T(n,e)},inject(e){return E(n,e)}};return n}function T(e,t){let n=C();if(!n||!n.contextMap)throw Error(`provide() can only be called inside the <script> block of a DriftJS component during instantiation.`);n.contextMap.set(e.id,t)}function E(e,t){let n=C();if(!n)return t===void 0?e.defaultValue:t;let r=n;for(;r;){if(r.contextMap&&r.contextMap.has(e.id))return r.contextMap.get(e.id);r=r.parentVM}return t===void 0?e.defaultValue:t}var D=T,O=E;function k(e){let t=C();t&&typeof t.registerProgrammaticEffect==`function`?t.registerProgrammaticEffect(e):t||console.warn(`[DriftJS] effect() was called outside a component execution context. Lifecycle hooks must be called synchronously during component setup.`)}function A(e){let t=C();t&&typeof t.registerProgrammaticEffect==`function`?t.registerProgrammaticEffect(e,!0):t||console.warn(`[DriftJS] onMount() was called outside a component execution context. Lifecycle hooks must be called synchronously during component setup.`)}function j(e){let t=C();t?(t.unmountCallbacks||=[],t.unmountCallbacks.push(e)):console.warn(`[DriftJS] onUnmount() was called outside a component execution context. Lifecycle hooks must be called synchronously during component setup.`)}var M=new Set(`animationIterationCount.borderImageOutset.borderImageSlice.borderImageWidth.boxFlex.boxFlexGroup.boxOrdinalGroup.columnCount.columns.flex.flexGrow.flexPositive.flexShrink.flexNegative.flexOrder.gridArea.gridRow.gridRowEnd.gridRowSpan.gridRowStart.gridColumn.gridColumnEnd.gridColumnSpan.gridColumnStart.fontWeight.lineClamp.lineHeight.opacity.order.orphans.tabSize.widows.zIndex.zoom.fillOpacity.floodOpacity.stopOpacity.strokeDasharray.strokeDashoffset.strokeMiterlimit.strokeOpacity.strokeWidth`.split(`.`));function N(e){return e.startsWith(`--`)?e:e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function P(e){if(e==null||e===!1||e===``)return``;if(typeof e==`string`)return e.trim();if(Array.isArray(e))return e.map(e=>P(e)).filter(e=>!!(e&&e.length>0)).join(`; `);if(typeof e==`object`){let t=[];for(let[n,r]of Object.entries(e)){if(r==null||r===!1||r===``)continue;let e=N(n),i=r;typeof r==`number`&&r!==0&&!M.has(n)&&(i=`${r}px`),t.push(`${e}: ${i}`)}return t.join(`; `)}return String(e)}exports.MAX_REGISTERS=e,exports.VOID_ELEMENTS=t,exports._get=h,exports.camelToKebab=N,exports.createContext=w,exports.effect=k,exports.evaluateExpression=i,exports.evaluatePropsSpec=o,exports.executePrecompiledFn=r,exports.findTopLevelChar=l,exports.getActiveVM=C,exports.getScopeValue=m,exports.hasMatchingOuterParens=d,exports.inScopeChain=p,exports.inject=O,exports.injectContext=E,exports.isRegexStartChar=s,exports.normalizeStyle=P,exports.onMount=A,exports.onUnmount=j,exports.popActiveVM=S,exports.populateItemScope=_,exports.provide=D,exports.provideContext=T,exports.pushActiveVM=x,exports.resolveComponentModule=a,exports.resolveIterable=n,exports.scanBalancedDelimiters=c,exports.setScopeValue=f,exports.splitPatternEntries=u;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=256,t=new Set([`area`,`base`,`br`,`col`,`embed`,`hr`,`img`,`input`,`link`,`meta`,`param`,`source`,`track`,`wbr`]);function n(e,t,n){if(!e||typeof e!=`object`||t===`__proto__`||t===`constructor`||t===`prototype`||t===`__drift_mark_dirty__`)return n;let r=e,i=null,a=[];for(;r&&r!==Object.prototype;){if(typeof r.__drift_mark_dirty__==`function`&&a.push(r.__drift_mark_dirty__),Object.prototype.hasOwnProperty.call(r,t)){r[t]=n,i=r;break}r=Object.getPrototypeOf(r)}if(i||(e[t]=n),!t.startsWith(`__drift_`))for(let e=0;e<a.length;e++)try{a[e](t)}catch(e){console.error(`[DriftJS] Error notifying dirty update for "${t}":`,e)}return n}function r(e,t){if(!e||typeof e!=`object`)return!1;let n=e;for(;n&&n!==Object.prototype;){if(Object.prototype.hasOwnProperty.call(n,t))return!0;n=Object.getPrototypeOf(n)}return!1}function i(e,t){if(!(t===`__proto__`||t===`constructor`||t===`prototype`||t===`__drift_mark_dirty__`)){if(e&&typeof e==`object`){let n=e;for(;n&&n!==Object.prototype;){if(Object.prototype.hasOwnProperty.call(n,t))return n[t];n=Object.getPrototypeOf(n)}}if(typeof globalThis<`u`&&globalThis){let e=globalThis;for(;e&&e!==Object.prototype;){if(Object.prototype.hasOwnProperty.call(e,t))return globalThis[t];e=Object.getPrototypeOf(e)}}}}function a(e,t,n){return!e||typeof e!=`object`||t===`__proto__`||t===`constructor`||t===`prototype`||t===`__drift_mark_dirty__`||(e[t]=n),n}function o(e,t,n,r,i){a(e,t,n),r&&a(e,r,i)}function s(e){return Array.isArray(e)?e:e&&typeof e[Symbol.iterator]==`function`?Array.from(e):[]}function c(e,t,a){if(typeof e==`function`)return e(t,a,n,r,s,i);if(typeof e.__drift_fn__==`function`)return e.__drift_fn__(t,a,n,r,s,i);if(typeof e._executableFn==`function`)return e._executableFn(t,a,n,r,s,i)}function l(e,t,a){if(e==null)return e;if(typeof e==`function`)return e(t,a,n,r,s,i);if(typeof e==`object`&&e){if(`__drift_fn__`in e||typeof e._executableFn==`function`)return c(e,t,a);if(Array.isArray(e)){let n;for(let r of e)n=l(r,t,a);return n}}return e}function u(e){return!e||typeof e!=`object`?null:Array.isArray(e.bytecode)||ArrayBuffer.isView(e.bytecode)?e:e.program&&(Array.isArray(e.program.bytecode)||ArrayBuffer.isView(e.program.bytecode))?e.program:e.default?u(e.default):e.compiledModule?u(e.compiledModule):null}function d(e,t,n){if(!e||typeof e!=`object`)return{};let r={};for(let i of Object.keys(e)){if(i===`__drift_props__`||i===`__drift_children__`||i===`__proto__`||i===`constructor`||i===`prototype`)continue;let a=e[i];r[i]=l(a,t,n)}return r}var f=Symbol.for(`__drift_vm_stack__`);function p(){let e=globalThis;return e[f]||(e[f]=[]),e[f]}function m(e){p().push(e)}function h(){p().pop()}function g(){let e=p();return e.length>0?e[e.length-1]:null}function _(e,t){let n={id:Symbol(t||`DriftContext`),name:t,defaultValue:e,provide(e){v(n,e)},inject(e){return y(n,e)}};return n}function v(e,t){let n=g();if(!n||!n.contextMap)throw Error(`provide() can only be called inside the <script> block of a DriftJS component during instantiation.`);n.contextMap.set(e.id,t)}function y(e,t){let n=g();if(!n)return t===void 0?e.defaultValue:t;let r=n;for(;r;){if(r.contextMap&&r.contextMap.has(e.id))return r.contextMap.get(e.id);r=r.parentVM}return t===void 0?e.defaultValue:t}var b=v,x=y;function S(e){let t=g();t&&typeof t.registerProgrammaticEffect==`function`?t.registerProgrammaticEffect(e):t||console.warn(`[DriftJS] effect() was called outside a component execution context. Lifecycle hooks must be called synchronously during component setup.`)}function C(e){let t=g();t&&typeof t.registerProgrammaticEffect==`function`?t.registerProgrammaticEffect(e,!0):t||console.warn(`[DriftJS] onMount() was called outside a component execution context. Lifecycle hooks must be called synchronously during component setup.`)}function w(e){let t=g();t?(t.unmountCallbacks||=[],t.unmountCallbacks.push(e)):console.warn(`[DriftJS] onUnmount() was called outside a component execution context. Lifecycle hooks must be called synchronously during component setup.`)}var T=new Set(`animationIterationCount.borderImageOutset.borderImageSlice.borderImageWidth.boxFlex.boxFlexGroup.boxOrdinalGroup.columnCount.columns.flex.flexGrow.flexPositive.flexShrink.flexNegative.flexOrder.gridArea.gridRow.gridRowEnd.gridRowSpan.gridRowStart.gridColumn.gridColumnEnd.gridColumnSpan.gridColumnStart.fontWeight.lineClamp.lineHeight.opacity.order.orphans.tabSize.widows.zIndex.zoom.fillOpacity.floodOpacity.stopOpacity.strokeDasharray.strokeDashoffset.strokeMiterlimit.strokeOpacity.strokeWidth`.split(`.`));function E(e){return e.startsWith(`--`)?e:e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function D(e){if(e==null||e===!1||e===``)return``;if(typeof e==`string`)return e.trim();if(Array.isArray(e))return e.map(e=>D(e)).filter(e=>!!(e&&e.length>0)).join(`; `);if(typeof e==`object`){let t=[];for(let[n,r]of Object.entries(e)){if(r==null||r===!1||r===``)continue;let e=E(n),i=r;typeof r==`number`&&r!==0&&!T.has(n)&&(i=`${r}px`),t.push(`${e}: ${i}`)}return t.join(`; `)}return String(e)}exports.MAX_REGISTERS=e,exports.VOID_ELEMENTS=t,exports.camelToKebab=E,exports.createContext=_,exports.effect=S,exports.evaluateExpression=l,exports.evaluatePropsSpec=d,exports.executePrecompiledFn=c,exports.getActiveVM=g,exports.getScopeValue=i,exports.inScopeChain=r,exports.inject=x,exports.injectContext=y,exports.normalizeStyle=D,exports.onMount=C,exports.onUnmount=w,exports.popActiveVM=h,exports.populateItemScope=o,exports.provide=b,exports.provideContext=v,exports.pushActiveVM=m,exports.resolveComponentModule=u,exports.resolveIterable=s,exports.setScopeProp=a,exports.setScopeValue=n;
|
package/dist/index-es.js
CHANGED
|
@@ -16,187 +16,8 @@ var e = 256, t = /* @__PURE__ */ new Set([
|
|
|
16
16
|
"wbr"
|
|
17
17
|
]);
|
|
18
18
|
//#endregion
|
|
19
|
-
//#region src/evaluator.ts
|
|
20
|
-
function n(e) {
|
|
21
|
-
return Array.isArray(e) ? e : e && typeof e[Symbol.iterator] == "function" ? Array.from(e) : [];
|
|
22
|
-
}
|
|
23
|
-
function r(e, t, r) {
|
|
24
|
-
if (typeof e == "function") return e(t, r, f, p, n, m);
|
|
25
|
-
if (typeof e.__drift_fn__ == "function") return e.__drift_fn__(t, r, f, p, n, m);
|
|
26
|
-
if (typeof e._executableFn == "function") return e._executableFn(t, r, f, p, n, m);
|
|
27
|
-
}
|
|
28
|
-
function i(e, t, a) {
|
|
29
|
-
if (e == null) return e;
|
|
30
|
-
if (typeof e == "function") return e(t, a, f, p, n, m);
|
|
31
|
-
if (typeof e == "object" && e) {
|
|
32
|
-
if ("__drift_fn__" in e || typeof e._executableFn == "function") return r(e, t, a);
|
|
33
|
-
if (Array.isArray(e)) {
|
|
34
|
-
let n;
|
|
35
|
-
for (let r of e) n = i(r, t, a);
|
|
36
|
-
return n;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
return e;
|
|
40
|
-
}
|
|
41
|
-
function a(e) {
|
|
42
|
-
return !e || typeof e != "object" ? null : Array.isArray(e.bytecode) || ArrayBuffer.isView(e.bytecode) ? e : e.program && (Array.isArray(e.program.bytecode) || ArrayBuffer.isView(e.program.bytecode)) ? e.program : e.default ? a(e.default) : e.compiledModule ? a(e.compiledModule) : null;
|
|
43
|
-
}
|
|
44
|
-
function o(e, t, n) {
|
|
45
|
-
if (!e || typeof e != "object") return {};
|
|
46
|
-
let r = {};
|
|
47
|
-
for (let a of Object.keys(e)) {
|
|
48
|
-
if (a === "__drift_props__" || a === "__drift_children__" || a === "__proto__" || a === "constructor" || a === "prototype") continue;
|
|
49
|
-
let o = e[a];
|
|
50
|
-
r[a] = i(o, t, n);
|
|
51
|
-
}
|
|
52
|
-
return r;
|
|
53
|
-
}
|
|
54
|
-
//#endregion
|
|
55
|
-
//#region src/scanner.ts
|
|
56
|
-
function s(e, t) {
|
|
57
|
-
let n = t - 1;
|
|
58
|
-
for (; n >= 0 && /\s/.test(e[n]);) n--;
|
|
59
|
-
if (n < 0) return !0;
|
|
60
|
-
let r = e[n];
|
|
61
|
-
return /[(,=:[!&|?+\-*/%^~<>]/.test(r);
|
|
62
|
-
}
|
|
63
|
-
function c(e, t) {
|
|
64
|
-
let n = 0, r = 0, i = 0, a = null, o = !1, c = !1, l = !1, u = !1, d = !1, f = [];
|
|
65
|
-
for (let p = 0; p < e.length; p++) {
|
|
66
|
-
let m = e[p];
|
|
67
|
-
if (a !== null) {
|
|
68
|
-
if (o) {
|
|
69
|
-
o = !1;
|
|
70
|
-
continue;
|
|
71
|
-
}
|
|
72
|
-
if (m === "\\") {
|
|
73
|
-
o = !0;
|
|
74
|
-
continue;
|
|
75
|
-
}
|
|
76
|
-
if (a === "`" && m === "$" && e[p + 1] === "{") {
|
|
77
|
-
f.push(i), a = null, p++, i++;
|
|
78
|
-
continue;
|
|
79
|
-
}
|
|
80
|
-
if (m === a) {
|
|
81
|
-
a = null;
|
|
82
|
-
continue;
|
|
83
|
-
}
|
|
84
|
-
continue;
|
|
85
|
-
}
|
|
86
|
-
if (c) {
|
|
87
|
-
m === "\n" && (c = !1);
|
|
88
|
-
continue;
|
|
89
|
-
}
|
|
90
|
-
if (l) {
|
|
91
|
-
m === "*" && e[p + 1] === "/" && (l = !1, p++);
|
|
92
|
-
continue;
|
|
93
|
-
}
|
|
94
|
-
if (u) {
|
|
95
|
-
if (o) {
|
|
96
|
-
o = !1;
|
|
97
|
-
continue;
|
|
98
|
-
}
|
|
99
|
-
if (m === "\\") {
|
|
100
|
-
o = !0;
|
|
101
|
-
continue;
|
|
102
|
-
}
|
|
103
|
-
if (d) {
|
|
104
|
-
m === "]" && (d = !1);
|
|
105
|
-
continue;
|
|
106
|
-
}
|
|
107
|
-
if (m === "[") {
|
|
108
|
-
d = !0;
|
|
109
|
-
continue;
|
|
110
|
-
}
|
|
111
|
-
if (m === "/") {
|
|
112
|
-
u = !1;
|
|
113
|
-
continue;
|
|
114
|
-
}
|
|
115
|
-
continue;
|
|
116
|
-
}
|
|
117
|
-
if (m === "/" && e[p + 1] === "/") {
|
|
118
|
-
c = !0, p++;
|
|
119
|
-
continue;
|
|
120
|
-
}
|
|
121
|
-
if (m === "/" && e[p + 1] === "*") {
|
|
122
|
-
l = !0, p++;
|
|
123
|
-
continue;
|
|
124
|
-
}
|
|
125
|
-
if (m === "/" && s(e, p)) {
|
|
126
|
-
u = !0, d = !1;
|
|
127
|
-
continue;
|
|
128
|
-
}
|
|
129
|
-
if (m === "'" || m === "\"" || m === "`") {
|
|
130
|
-
a = m;
|
|
131
|
-
continue;
|
|
132
|
-
}
|
|
133
|
-
if (m === "(") {
|
|
134
|
-
n++;
|
|
135
|
-
continue;
|
|
136
|
-
}
|
|
137
|
-
if (m === ")") {
|
|
138
|
-
n = Math.max(0, n - 1);
|
|
139
|
-
continue;
|
|
140
|
-
}
|
|
141
|
-
if (m === "[") {
|
|
142
|
-
r++;
|
|
143
|
-
continue;
|
|
144
|
-
}
|
|
145
|
-
if (m === "]") {
|
|
146
|
-
r = Math.max(0, r - 1);
|
|
147
|
-
continue;
|
|
148
|
-
}
|
|
149
|
-
if (m === "{") {
|
|
150
|
-
i++;
|
|
151
|
-
continue;
|
|
152
|
-
}
|
|
153
|
-
if (m === "}") {
|
|
154
|
-
i = Math.max(0, i - 1), f.length > 0 && i === f[f.length - 1] && (f.pop(), a = "`");
|
|
155
|
-
continue;
|
|
156
|
-
}
|
|
157
|
-
if (n === 0 && r === 0 && i === 0 && a === null && !c && !l && !u) {
|
|
158
|
-
let e = t(p, m);
|
|
159
|
-
if (typeof e == "number") return e;
|
|
160
|
-
if (e === !0) return p;
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
return -1;
|
|
164
|
-
}
|
|
165
|
-
function l(e, t) {
|
|
166
|
-
return c(e, (e, n) => n === t);
|
|
167
|
-
}
|
|
168
|
-
function u(e, t = ",") {
|
|
169
|
-
let n = [], r = 0;
|
|
170
|
-
c(e, (i, a) => {
|
|
171
|
-
if (a === t) {
|
|
172
|
-
let t = e.slice(r, i).trim();
|
|
173
|
-
t && n.push(t), r = i + 1;
|
|
174
|
-
}
|
|
175
|
-
});
|
|
176
|
-
let i = e.slice(r).trim();
|
|
177
|
-
return i && n.push(i), n;
|
|
178
|
-
}
|
|
179
|
-
function d(e) {
|
|
180
|
-
let t = e.trim();
|
|
181
|
-
if (!t.startsWith("(") || !t.endsWith(")")) return !1;
|
|
182
|
-
let n = 0, r = null, i = !1;
|
|
183
|
-
for (let e = 0; e < t.length - 1; e++) {
|
|
184
|
-
let a = t[e];
|
|
185
|
-
if (r !== null) {
|
|
186
|
-
i ? i = !1 : a === "\\" ? i = !0 : a === r && (r = null);
|
|
187
|
-
continue;
|
|
188
|
-
}
|
|
189
|
-
if (a === "\"" || a === "'" || a === "`") {
|
|
190
|
-
r = a;
|
|
191
|
-
continue;
|
|
192
|
-
}
|
|
193
|
-
if (a === "(" ? n++ : a === ")" && n--, n === 0) return !1;
|
|
194
|
-
}
|
|
195
|
-
return n === 1;
|
|
196
|
-
}
|
|
197
|
-
//#endregion
|
|
198
19
|
//#region src/scope.ts
|
|
199
|
-
function
|
|
20
|
+
function n(e, t, n) {
|
|
200
21
|
if (!e || typeof e != "object" || t === "__proto__" || t === "constructor" || t === "prototype" || t === "__drift_mark_dirty__") return n;
|
|
201
22
|
let r = e, i = null, a = [];
|
|
202
23
|
for (; r && r !== Object.prototype;) {
|
|
@@ -213,7 +34,7 @@ function f(e, t, n) {
|
|
|
213
34
|
}
|
|
214
35
|
return n;
|
|
215
36
|
}
|
|
216
|
-
function
|
|
37
|
+
function r(e, t) {
|
|
217
38
|
if (!e || typeof e != "object") return !1;
|
|
218
39
|
let n = e;
|
|
219
40
|
for (; n && n !== Object.prototype;) {
|
|
@@ -222,7 +43,7 @@ function p(e, t) {
|
|
|
222
43
|
}
|
|
223
44
|
return !1;
|
|
224
45
|
}
|
|
225
|
-
function
|
|
46
|
+
function i(e, t) {
|
|
226
47
|
if (!(t === "__proto__" || t === "constructor" || t === "prototype" || t === "__drift_mark_dirty__")) {
|
|
227
48
|
if (e && typeof e == "object") {
|
|
228
49
|
let n = e;
|
|
@@ -240,94 +61,86 @@ function m(e, t) {
|
|
|
240
61
|
}
|
|
241
62
|
}
|
|
242
63
|
}
|
|
243
|
-
|
|
244
|
-
typeof
|
|
245
|
-
function g(e, t, n) {
|
|
246
|
-
!e || typeof e != "object" || t === "__proto__" || t === "constructor" || t === "prototype" || t === "__drift_mark_dirty__" || (e[t] = n);
|
|
64
|
+
function a(e, t, n) {
|
|
65
|
+
return !e || typeof e != "object" || t === "__proto__" || t === "constructor" || t === "prototype" || t === "__drift_mark_dirty__" || (e[t] = n), n;
|
|
247
66
|
}
|
|
248
|
-
function
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
let n = a[t], r = l(n, "=");
|
|
271
|
-
if (r !== -1) {
|
|
272
|
-
let a = n.slice(0, r).trim(), o = n.slice(r + 1).trim(), s = i[t];
|
|
273
|
-
g(e, a, s === void 0 ? v(o, e) : s);
|
|
274
|
-
} else n.startsWith("{") || n.startsWith("[") ? _(e, n, i[t], null, 0) : g(e, n, i[t]);
|
|
67
|
+
function o(e, t, n, r, i) {
|
|
68
|
+
a(e, t, n), r && a(e, r, i);
|
|
69
|
+
}
|
|
70
|
+
//#endregion
|
|
71
|
+
//#region src/evaluator.ts
|
|
72
|
+
function s(e) {
|
|
73
|
+
return Array.isArray(e) ? e : e && typeof e[Symbol.iterator] == "function" ? Array.from(e) : [];
|
|
74
|
+
}
|
|
75
|
+
function c(e, t, a) {
|
|
76
|
+
if (typeof e == "function") return e(t, a, n, r, s, i);
|
|
77
|
+
if (typeof e.__drift_fn__ == "function") return e.__drift_fn__(t, a, n, r, s, i);
|
|
78
|
+
if (typeof e._executableFn == "function") return e._executableFn(t, a, n, r, s, i);
|
|
79
|
+
}
|
|
80
|
+
function l(e, t, a) {
|
|
81
|
+
if (e == null) return e;
|
|
82
|
+
if (typeof e == "function") return e(t, a, n, r, s, i);
|
|
83
|
+
if (typeof e == "object" && e) {
|
|
84
|
+
if ("__drift_fn__" in e || typeof e._executableFn == "function") return c(e, t, a);
|
|
85
|
+
if (Array.isArray(e)) {
|
|
86
|
+
let n;
|
|
87
|
+
for (let r of e) n = l(r, t, a);
|
|
88
|
+
return n;
|
|
275
89
|
}
|
|
276
90
|
}
|
|
91
|
+
return e;
|
|
277
92
|
}
|
|
278
|
-
function
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
if (
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
if (
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
} catch {
|
|
289
|
-
return t && p(t, n) ? m(t, n) : n;
|
|
290
|
-
}
|
|
93
|
+
function u(e) {
|
|
94
|
+
return !e || typeof e != "object" ? null : Array.isArray(e.bytecode) || ArrayBuffer.isView(e.bytecode) ? e : e.program && (Array.isArray(e.program.bytecode) || ArrayBuffer.isView(e.program.bytecode)) ? e.program : e.default ? u(e.default) : e.compiledModule ? u(e.compiledModule) : null;
|
|
95
|
+
}
|
|
96
|
+
function d(e, t, n) {
|
|
97
|
+
if (!e || typeof e != "object") return {};
|
|
98
|
+
let r = {};
|
|
99
|
+
for (let i of Object.keys(e)) {
|
|
100
|
+
if (i === "__drift_props__" || i === "__drift_children__" || i === "__proto__" || i === "constructor" || i === "prototype") continue;
|
|
101
|
+
let a = e[i];
|
|
102
|
+
r[i] = l(a, t, n);
|
|
291
103
|
}
|
|
104
|
+
return r;
|
|
292
105
|
}
|
|
293
106
|
//#endregion
|
|
294
107
|
//#region src/context.ts
|
|
295
|
-
var
|
|
296
|
-
function
|
|
108
|
+
var f = Symbol.for("__drift_vm_stack__");
|
|
109
|
+
function p() {
|
|
297
110
|
let e = globalThis;
|
|
298
|
-
return e[
|
|
111
|
+
return e[f] || (e[f] = []), e[f];
|
|
299
112
|
}
|
|
300
|
-
function
|
|
301
|
-
|
|
113
|
+
function m(e) {
|
|
114
|
+
p().push(e);
|
|
302
115
|
}
|
|
303
|
-
function
|
|
304
|
-
|
|
116
|
+
function h() {
|
|
117
|
+
p().pop();
|
|
305
118
|
}
|
|
306
|
-
function
|
|
307
|
-
let e =
|
|
119
|
+
function g() {
|
|
120
|
+
let e = p();
|
|
308
121
|
return e.length > 0 ? e[e.length - 1] : null;
|
|
309
122
|
}
|
|
310
|
-
function
|
|
123
|
+
function _(e, t) {
|
|
311
124
|
let n = {
|
|
312
125
|
id: Symbol(t || "DriftContext"),
|
|
313
126
|
name: t,
|
|
314
127
|
defaultValue: e,
|
|
315
128
|
provide(e) {
|
|
316
|
-
|
|
129
|
+
v(n, e);
|
|
317
130
|
},
|
|
318
131
|
inject(e) {
|
|
319
|
-
return
|
|
132
|
+
return y(n, e);
|
|
320
133
|
}
|
|
321
134
|
};
|
|
322
135
|
return n;
|
|
323
136
|
}
|
|
324
|
-
function
|
|
325
|
-
let n =
|
|
137
|
+
function v(e, t) {
|
|
138
|
+
let n = g();
|
|
326
139
|
if (!n || !n.contextMap) throw Error("provide() can only be called inside the <script> block of a DriftJS component during instantiation.");
|
|
327
140
|
n.contextMap.set(e.id, t);
|
|
328
141
|
}
|
|
329
|
-
function
|
|
330
|
-
let n =
|
|
142
|
+
function y(e, t) {
|
|
143
|
+
let n = g();
|
|
331
144
|
if (!n) return t === void 0 ? e.defaultValue : t;
|
|
332
145
|
let r = n;
|
|
333
146
|
for (; r;) {
|
|
@@ -336,39 +149,39 @@ function E(e, t) {
|
|
|
336
149
|
}
|
|
337
150
|
return t === void 0 ? e.defaultValue : t;
|
|
338
151
|
}
|
|
339
|
-
var
|
|
340
|
-
function
|
|
341
|
-
let t =
|
|
152
|
+
var b = v, x = y;
|
|
153
|
+
function S(e) {
|
|
154
|
+
let t = g();
|
|
342
155
|
t && typeof t.registerProgrammaticEffect == "function" ? t.registerProgrammaticEffect(e) : t || console.warn("[DriftJS] effect() was called outside a component execution context. Lifecycle hooks must be called synchronously during component setup.");
|
|
343
156
|
}
|
|
344
|
-
function
|
|
345
|
-
let t =
|
|
157
|
+
function C(e) {
|
|
158
|
+
let t = g();
|
|
346
159
|
t && typeof t.registerProgrammaticEffect == "function" ? t.registerProgrammaticEffect(e, !0) : t || console.warn("[DriftJS] onMount() was called outside a component execution context. Lifecycle hooks must be called synchronously during component setup.");
|
|
347
160
|
}
|
|
348
|
-
function
|
|
349
|
-
let t =
|
|
161
|
+
function w(e) {
|
|
162
|
+
let t = g();
|
|
350
163
|
t ? (t.unmountCallbacks ||= [], t.unmountCallbacks.push(e)) : console.warn("[DriftJS] onUnmount() was called outside a component execution context. Lifecycle hooks must be called synchronously during component setup.");
|
|
351
164
|
}
|
|
352
165
|
//#endregion
|
|
353
166
|
//#region src/style.ts
|
|
354
|
-
var
|
|
355
|
-
function
|
|
167
|
+
var T = /* @__PURE__ */ new Set(/* @__PURE__ */ "animationIterationCount.borderImageOutset.borderImageSlice.borderImageWidth.boxFlex.boxFlexGroup.boxOrdinalGroup.columnCount.columns.flex.flexGrow.flexPositive.flexShrink.flexNegative.flexOrder.gridArea.gridRow.gridRowEnd.gridRowSpan.gridRowStart.gridColumn.gridColumnEnd.gridColumnSpan.gridColumnStart.fontWeight.lineClamp.lineHeight.opacity.order.orphans.tabSize.widows.zIndex.zoom.fillOpacity.floodOpacity.stopOpacity.strokeDasharray.strokeDashoffset.strokeMiterlimit.strokeOpacity.strokeWidth".split("."));
|
|
168
|
+
function E(e) {
|
|
356
169
|
return e.startsWith("--") ? e : e.replace(/[A-Z]/g, (e) => `-${e.toLowerCase()}`);
|
|
357
170
|
}
|
|
358
|
-
function
|
|
171
|
+
function D(e) {
|
|
359
172
|
if (e == null || e === !1 || e === "") return "";
|
|
360
173
|
if (typeof e == "string") return e.trim();
|
|
361
|
-
if (Array.isArray(e)) return e.map((e) =>
|
|
174
|
+
if (Array.isArray(e)) return e.map((e) => D(e)).filter((e) => !!(e && e.length > 0)).join("; ");
|
|
362
175
|
if (typeof e == "object") {
|
|
363
176
|
let t = [];
|
|
364
177
|
for (let [n, r] of Object.entries(e)) {
|
|
365
178
|
if (r == null || r === !1 || r === "") continue;
|
|
366
|
-
let e =
|
|
367
|
-
typeof r == "number" && r !== 0 && !
|
|
179
|
+
let e = E(n), i = r;
|
|
180
|
+
typeof r == "number" && r !== 0 && !T.has(n) && (i = `${r}px`), t.push(`${e}: ${i}`);
|
|
368
181
|
}
|
|
369
182
|
return t.join("; ");
|
|
370
183
|
}
|
|
371
184
|
return String(e);
|
|
372
185
|
}
|
|
373
186
|
//#endregion
|
|
374
|
-
export { e as MAX_REGISTERS, t as VOID_ELEMENTS,
|
|
187
|
+
export { e as MAX_REGISTERS, t as VOID_ELEMENTS, E as camelToKebab, _ as createContext, S as effect, l as evaluateExpression, d as evaluatePropsSpec, c as executePrecompiledFn, g as getActiveVM, i as getScopeValue, r as inScopeChain, x as inject, y as injectContext, D as normalizeStyle, C as onMount, w as onUnmount, h as popActiveVM, o as populateItemScope, b as provide, v as provideContext, m as pushActiveVM, u as resolveComponentModule, s as resolveIterable, a as setScopeProp, n as setScopeValue };
|