driftjs-shared 0.0.6 → 0.0.8

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.
@@ -0,0 +1,2 @@
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 r(e,t,r){return typeof e==`function`?e(t,r,f,p,n,m):typeof e.__drift_fn__==`function`?e.__drift_fn__(t,r,f,p,n,m):(e._executableFn||=typeof e.__drift_fn__==`string`?Function(`return (`+e.__drift_fn__+`)`)():e.__drift_fn__,e._executableFn(t,r,f,p,n,m))}function i(e,t,a){if(e==null)return e;if(typeof e==`function`)return e(t,a,f,p,n,m);if(typeof e==`object`&&e){if(`__drift_fn__`in e||typeof e._executableFn==`function`)return r(e,t,a);if(Array.isArray(e)){let n;for(let r of e)n=i(r,t,a);return n}}return e}function a(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?a(e.default):e.compiledModule?a(e.compiledModule):null}function o(e,t,n){if(!e||typeof e!=`object`)return{};let r={};for(let a of Object.keys(e)){if(a===`__drift_props__`||a===`__drift_children__`||a===`__proto__`||a===`constructor`||a===`prototype`)continue;let o=e[a];r[a]=i(o,t,n)}return r}function s(e,t){let n=t-1;for(;n>=0&&/\s/.test(e[n]);)n--;if(n<0)return!0;let r=e[n];return/[(,=:[!&|?+\-*/%^~<>]/.test(r)}function c(e,t){let n=0,r=0,i=0,a=null,o=!1,c=!1,l=!1,u=!1,d=!1,f=[];for(let p=0;p<e.length;p++){let m=e[p];if(a!==null){if(o){o=!1;continue}if(m===`\\`){o=!0;continue}if(a==="`"&&m===`$`&&e[p+1]===`{`){f.push(i),a=null,p++,i++;continue}if(m===a){a=null;continue}continue}if(c){m===`
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=new Set;for(;r&&r!==Object.prototype;){if(Object.prototype.hasOwnProperty.call(r,t)){r[t]=n,i=r;break}r=Object.getPrototypeOf(r)}i||=(e[t]=n,e);let o=e;for(;o&&o!==Object.prototype&&(typeof o.__drift_mark_dirty__==`function`&&a.add(o.__drift_mark_dirty__),o!==i);)o=Object.getPrototypeOf(o);if(!t.startsWith(`__drift_`))for(let e of a)try{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(e&&p(e,t))return e[t];if(typeof globalThis<`u`&&globalThis){if(t===`__proto__`||t===`constructor`||t===`prototype`||t===`__drift_mark_dirty__`)return;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?(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 A=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 j(e){return e.startsWith(`--`)?e:e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function M(e){if(e==null||e===!1||e===``)return``;if(typeof e==`string`)return e.trim();if(Array.isArray(e))return e.map(e=>M(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=j(n),i=r;typeof r==`number`&&r!==0&&!A.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=j,exports.createContext=w,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=M,exports.onUnmount=k,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;