@aevantec/litevue 0.6.2 → 0.6.3
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/litevue-plugins.dev.iife.js +4 -85
- package/dist/litevue-plugins.dev.mjs +4 -85
- package/dist/litevue-plugins.iife.js +1 -1
- package/dist/litevue-plugins.mjs +1 -1
- package/dist/litevue-plugins.umd.js +1 -1
- package/dist/litevue.dev.iife.js +2 -121
- package/dist/litevue.dev.mjs +2 -121
- package/dist/litevue.iife.js +1 -1
- package/dist/litevue.mjs +1 -1
- package/dist/litevue.umd.js +1 -1
- package/dist/plugins/media.dev.iife.js +2 -35
- package/dist/plugins/media.dev.mjs +2 -35
- package/dist/plugins/media.iife.js +1 -1
- package/dist/plugins/media.mjs +1 -1
- package/dist/plugins/media.umd.js +1 -1
- package/dist/plugins/morph.dev.iife.js +2 -42
- package/dist/plugins/morph.dev.mjs +2 -42
- package/dist/plugins/morph.iife.js +1 -1
- package/dist/plugins/morph.mjs +1 -1
- package/dist/plugins/morph.umd.js +1 -1
- package/dist/plugins/navigate.dev.iife.js +1 -10
- package/dist/plugins/navigate.dev.mjs +1 -10
- package/dist/plugins/persist.dev.iife.js +0 -7
- package/dist/plugins/persist.dev.mjs +0 -7
- package/dist/plugins/transition.iife.js +1 -1
- package/dist/plugins/transition.mjs +1 -1
- package/dist/plugins/transition.umd.js +1 -1
- package/dist/types/app.d.mts +2 -5
- package/dist/types/app.d.ts +2 -5
- package/dist/types/block.d.mts +0 -4
- package/dist/types/block.d.ts +0 -4
- package/dist/types/context.d.mts +0 -5
- package/dist/types/context.d.ts +0 -5
- package/dist/types/devtools-panel/chrome.d.mts +0 -3
- package/dist/types/devtools-panel/chrome.d.ts +0 -3
- package/dist/types/devtools-panel/menu.d.mts +0 -2
- package/dist/types/devtools-panel/menu.d.ts +0 -2
- package/dist/types/devtools-panel/plugins.d.mts +0 -4
- package/dist/types/devtools-panel/plugins.d.ts +0 -4
- package/dist/types/devtools-panel/styles.d.mts +2 -17
- package/dist/types/devtools-panel/styles.d.ts +2 -17
- package/dist/types/devtools-panel/values.d.mts +0 -25
- package/dist/types/devtools-panel/values.d.ts +0 -25
- package/dist/types/devtools.d.mts +0 -7
- package/dist/types/devtools.d.ts +0 -7
- package/dist/types/directives/on.d.mts +0 -1
- package/dist/types/directives/on.d.ts +0 -1
- package/dist/types/errors.d.mts +0 -7
- package/dist/types/errors.d.ts +0 -7
- package/dist/types/eval.d.mts +0 -3
- package/dist/types/eval.d.ts +0 -3
- package/dist/types/lazy.d.mts +0 -10
- package/dist/types/lazy.d.ts +0 -10
- package/dist/types/magics.d.mts +0 -9
- package/dist/types/magics.d.ts +0 -9
- package/dist/types/ownership.d.mts +0 -19
- package/dist/types/ownership.d.ts +0 -19
- package/dist/types/plugins/media/index.d.mts +0 -5
- package/dist/types/plugins/media/index.d.ts +0 -5
- package/dist/types/plugins/morph/index.d.mts +0 -8
- package/dist/types/plugins/morph/index.d.ts +0 -8
- package/dist/types/scheduler.d.mts +0 -5
- package/dist/types/scheduler.d.ts +0 -5
- package/dist/types/utils.d.mts +0 -5
- package/dist/types/utils.d.ts +0 -5
- package/dist/types/warn.d.mts +0 -12
- package/dist/types/warn.d.ts +0 -12
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@aevantec/litevue")):"function"==typeof define&&define.amd?define(["exports","@aevantec/litevue"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).LiteVuePlugins={},e.LiteVue)}(this,function(e,t){var n={9:/\d/,a:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/},i=(e,t,i)=>{let o="",r="",s=0;for(let a=0;a<t.length;a++){const i=n[t[a]];if(i){for(;s<e.length&&!i.test(e[s]);)s++;if(s>=e.length)return o;o+=r+e[s++],r=""}else r+=t[a],e[s]===t[a]&&s++}return i?o+r:o},o=e=>(parseFloat(e)||0)*(e.includes("ms")?1:1e3),r=(e,t)=>{const n=e.split(","),i=t.split(",");let r=0;for(let s=0;s<n.length;s++)r=Math.max(r,o(n[s])+o(i[s%i.length]));return r},s="litevue:",a=Object.create(null),c="local",l=e=>{const t=e??c;return"string"!=typeof t?t:a[t.toLowerCase()]??(e=>{try{if("local"===e||"localStorage"===e)return localStorage;if("session"===e||"sessionStorage"===e)return sessionStorage}catch{}})(t)},d=(e,t,n,i,o)=>{if(!i)return o(()=>{});const r=((e,t)=>(t??Object.keys(e)).filter(t=>{if("$"===t[0])return!1;const n=Object.getOwnPropertyDescriptor(e,t);if(n&&n.get&&!n.set)return!1;const i=n&&n.value;return(!i||!0!==i.__v_isRef||!0!==i.__v_isReadonly)&&"function"!=typeof e[t]}))(e,n);try{const n=JSON.parse(i.getItem(t)||"null");if(n)for(const t of r)({}).hasOwnProperty.call(n,t)&&(e[t]=n[t])}catch{}return o(()=>{const n={};for(const t of r)n[t]=e[t];try{i.setItem(t,JSON.stringify(n))}catch{}})},f=[],u=(e,t,n)=>"radio"!==e.type||!e.name||e===(n.find(t=>"radio"===t.type&&t.name===e.name&&t.checked)||n.find(t=>"radio"===t.type&&t.name===e.name)),p=(e,t)=>1===e.nodeType&&(e.hasAttribute("data-morph-preserve")||e.__marker||!!t.preserve?.(e)),m="[v-scope\\.visible],[v-scope\\.idle],[v-scope\\.interaction]",v=/^(?:v-|:|@)/,h=/^(?::|v-bind:)/,b=/^v-(?!scope|on:)/,g=["id","data-key","data-id"],y=e=>{for(const t of g){const n=e.getAttribute(t);if(null!=n)return t+"="+n}return null},w=e=>{for(let t=e;t;t=t.parentElement)if(t.__ctx)return t.__ctx},x=e=>e.__ctx||[...e.children||[]].map(x).find(Boolean),k=(e,t)=>(t||x(e))?.dispose?.(e),E=e=>{const t=new Set;e.matches("details,dialog")&&t.add("open");for(const{name:n}of e.attributes)if(h.test(n)){const e=n.replace(h,"").split(".")[0];t.add(/\.camel\b/.test(n)?e.replace(/-(\w)/g,(e,t)=>t.toUpperCase()):e)}else/^v-model\b/.test(n)?(t.add("value"),t.add("checked")):"v-bind"===n?t.add("*"):b.test(n)&&(t.add("style"),"v-popover"==n&&t.add("popover"));return t},S=e=>e.hasAttribute("v-for")||e.hasAttribute("v-if")||e.hasAttribute("v-else")||e.hasAttribute("v-else-if"),_=["Value","Checked","Selected"],L=(e,t,n)=>{const i=E(t);e.__anchor&&i.add("style"),n&&((e,t,n)=>{const i=E(t.closest("select")||t);if(!(n.has("*")||i.has("*")||i.has("value")||"output"==e.type||"textarea"==e.type&&t.value.includes("{{")))for(const o of _){const i=o.toLowerCase(),r="default"+o,s="Selected"==o?r:i;!n.has(i)&&r in e&&e[i]!==t[s]&&(e[i]=t[s])}})(e,t,i);const o=Object(e.__bound);for(const{name:r,value:s}of t.attributes)v.test(r)||i.has(r)||r in o||e.getAttribute(r)!==s&&e.setAttribute(r,s);for(const{name:r}of[...e.attributes])i.has("*")||i.has(r)||t.hasAttribute(r)||e.removeAttribute(r)},T=(e,t,n,i)=>{if(e.nodeType!==t.nodeType)return A(e,t,n,i);if(3===e.nodeType||8===e.nodeType){const o=t.data;if(((e,t)=>e.includes(t?t.delimiters[0]:"{{"))(o,n)&&"SCRIPT"!=e.parentNode?.nodeName)return;return e.data?void(e.data!==o&&(e.data=o)):A(e,t,n,i)}if(1!==e.nodeType)return;const o=e,r=t;if(o.tagName!==r.tagName)return A(e,t,n,i);if(!i.skip?.(o,r)&&!o.hasAttribute("data-morph-skip")){if(o.matches(m))return o.isEqualNode(r)?void 0:A(e,t,n,i);L(o,r,i.values),"TEMPLATE"!=o.tagName||o.content.isEqualNode(r.content)||(o.innerHTML=r.innerHTML),(e=>{if(e.hasAttribute("v-text")||e.hasAttribute("v-html")||e.hasAttribute("v-pre")||e.hasAttribute("v-once")||S(e))return!0;for(let t=e.firstElementChild;t;t=t.nextElementSibling)if(S(t))return!0;return!1})(r)||Object.getOwnPropertyDescriptor(Object(o.__ctx?.scope),"$template")||N(o,r,o.__ctx||n,i)}},A=(e,t,n,i)=>{if(p(e,i))return;const o=t.cloneNode(!0);return!1!==i.beforeNodeAdded?.(o)?(k(e,n),e.parentNode.replaceChild(o,e),i.afterNodeRemoved?.(e),O(o,n),o):void 0},O=(e,t)=>{if(e.parentElement?.closest(m))return;const n=t||w(e.parentNode);n?.walk?.(e,n)},N=(e,t,n,i)=>{const o=i.key||y,r=new Map;for(let u=e.firstChild;u;u=u.nextSibling)if(1===u.nodeType){const e=o(u);if(null==e)continue;r.set(e,u)}const s=e=>e&&1===e.nodeType?o(e):null,a=new Set;for(let u=t.firstChild;u;u=u.nextSibling)a.add(s(u));const c=t=>{p(t,i)||(k(t,n),e.removeChild(t),i.afterNodeRemoved?.(t))};let l=e.firstChild,d=t.firstChild;const f=t=>{const o=t.cloneNode(!0);!1!==i.beforeNodeAdded?.(o)&&(e.insertBefore(o,l),O(o,n))};for(;d;){const t=d.nextSibling,o=s(d);if(""===l?.data&&d.hasAttribute?.("v-teleport"))l=l.nextSibling;else if(null!=o){const t=r.get(o);t?(t===l?l=l.nextSibling:e.insertBefore(t,l),r.delete(o),T(t,d,n,i)):f(d)}else if(l&&null==s(l)){if(p(l,i)&&!p(d,i)){l=l.nextSibling;continue}const e=l.nextSibling;T(l,d,n,i),l=e}else{if(l&&!a.has(s(l))){const e=l.nextSibling;c(l),l=e;continue}f(d)}d=t}for(;l;){const e=l.nextSibling;c(l),l=e}},$=(e,t,n={})=>{let i;if("string"==typeof t){const n=document.createElement("template"),o=e instanceof SVGElement;n.innerHTML=o?`<svg>${t.trim()}</svg>`:t.trim();const r=o?n.content.firstChild:n.content;i=1===r.childNodes.length&&r.firstElementChild?r.firstElementChild:(()=>{const t=e.cloneNode(!1);return t.append(...r.childNodes),t})()}else i=t;if(i){const t=()=>{const t=C();e=T(e,i,w(e.parentNode),n)||e,t()};n.transition&&document.startViewTransition?document.startViewTransition(t):t()}return e},C=()=>{const e=document.activeElement;if(!e||e===document.body)return()=>{};const t=e;let n=null,i=null;try{n=t.selectionStart,i=t.selectionEnd}catch{}return()=>{if(e!==document.activeElement&&e.isConnected&&(e.focus(),null!==n))try{t.setSelectionRange(n,i)}catch{}}},P={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},j=Object.freeze({...P}),q={mobile:"base",tablet:"md",desktop:"lg"},M=/^\d+$/,D=(0,t.reactive)({bp:"base",tick:0}),R={...P},z=["base"],I=!1,V=[],B=new Map,H=()=>"undefined"!=typeof window&&"function"==typeof window.matchMedia,W=(e,t)=>e.addEventListener?(e.addEventListener("change",t),{mql:e,off:()=>e.removeEventListener("change",t)}):(e.addListener(t),{mql:e,off:()=>e.removeListener(t)}),K=()=>{for(let e=V.length-1;e>=0;e--)if(V[e].mql.matches)return z[e+1];return"base"},J=()=>{V.forEach(e=>e.off()),V=[];const e=Object.keys(R).filter(e=>R[e]>0).sort((e,t)=>R[e]-R[t]);z=["base",...e],H()&&(V=e.map(e=>{const t=window.matchMedia(`(min-width: ${R[e]}px)`);return W(t,()=>{D.bp=K()})}),D.bp=K())},Z=()=>{I||(I=!0,J()),D.tick},F=e=>{if(!H())return!1;let t=B.get(e);t?B.delete(e):t=W(window.matchMedia(e),()=>D.tick++),B.set(e,t);for(const[n,i]of B){if(B.size<=64)break;i.off(),B.delete(n)}return t.mql.matches},G=e=>{if("number"==typeof e)return e;if("base"===e)return 0;if(M.test(e))return Number(e);const t=void 0===R[e]?q[e]:void 0;return void 0!==t?"base"===t?0:R[t]:R[e]},U=e=>{if(e<=0)return!0;const t=z.findIndex(t=>"base"!==t&&R[t]===e);return-1!==t?z.indexOf(D.bp)>=t:(D.tick,F(`(min-width: ${e}px)`))},Q=(e,t)=>{if(Z(),!e||"object"!=typeof e)return t;let n,i=-1;for(const o of Object.keys(e)){const t=G(o);void 0!==t&&(t>=i&&U(t)&&(i=t,n=e[o]))}return void 0!==n?n:t},X=e=>{const t=q[e],n=R[t];return void 0!==n?n:P[t]},Y=(e,t)=>Q(e,t),ee=Object.defineProperties(Y,{props:{value:e=>{Z();const t={};for(const n of Object.keys(e))t[n]=Q(e[n]);return t}},breakpoint:{get:()=>(Z(),D.bp),enumerable:!0},device:{get:()=>(Z(),U(X("tablet"))?U(X("desktop"))?"desktop":"tablet":"mobile"),enumerable:!0},atLeast:{value:e=>{Z();const t=G(e);return void 0!==t&&U(t)}},match:{value:e=>(Z(),F(e))},configure:{value:({breakpoints:e})=>{e&&(R={...e},I&&(J(),D.tick++))}}}),te=()=>{V.forEach(e=>e.off()),B.forEach(e=>e.off()),V=[],B.clear(),I=!1};e.collapse=e=>{e.directive("collapse",({el:e,get:t,effect:n,modifiers:i})=>{const o=e;let r=250;for(const u in i||{}){const e=/^duration-(\d+)$/.exec(u);e&&(r=+e[1])}const s=["overflow","height","transition","visibility"],a=s.map(e=>o.style[e]);let c,l=0;const d=new Set,f=(e,t)=>{const n=setTimeout(()=>{d.delete(n),e()},t);d.add(n)};return n(()=>{const e=!!t();if(e===c)return;const n=++l;var i;i=!e,o.style.visibility=i?"hidden":a[3],o.style.overflow=e&&null==c?a[0]:"hidden",null==c?f(()=>{o.style.transition=`height ${r}ms ease, visibility ${r}ms`}):(o.style.height=a[1]||o.scrollHeight+"px",e?f(()=>{n===l&&(o.style.height=a[1],o.style.overflow=a[0])},r):o.offsetHeight),e||(o.style.height="0px"),c=e}),()=>{d.forEach(clearTimeout),s.forEach((e,t)=>o.style[e]=a[t])}})},e.defaultBreakpoints=j,e.focus=e=>{e.directive("focus",({el:e,get:t,effect:n,modifiers:i})=>{let o=!0,r=!1;return n(()=>{r!==(r=!!t())&&Promise.resolve().then(()=>{o&&r&&(e.focus(),i?.select&&e.select&&e.select())})}),()=>{o=!1}}),e.directive("trap",({el:e,get:t,effect:n})=>{let i=!1,o=null;const r=()=>[...e.querySelectorAll("a[href],area[href],button,input:not([type=hidden]),select,textarea,summary,iframe,audio[controls],video[controls],[contenteditable],[tabindex]")].filter(e=>e.tabIndex>=0&&!e.matches(":disabled,[inert],[inert] *")&&!1!==e.checkVisibility?.({visibilityProperty:!0})).filter(u),s=t=>{if("Tab"!==t.key||f.at(-1)!==e)return;const n=r();if(!n.length)return void t.preventDefault();const i=n[0],o=n[n.length-1],s=document.activeElement;e.contains(s)?(t.shiftKey?i:o).compareDocumentPosition(s)&(t.shiftKey?4:2)||(t.preventDefault(),(t.shiftKey?o:i).focus()):(t.preventDefault(),i.focus())},a=()=>{i=!1,f.splice(f.indexOf(e),1),document.removeEventListener("keydown",s,!0),o&&o.focus&&o.focus()};return n(()=>{const n=!!t();n&&!i?(i=!0,o=document.activeElement,f.splice(f.findIndex(t=>e.contains(t))>>>0,0,e),document.addEventListener("keydown",s,!0),Promise.resolve().then(()=>{i&&f.at(-1)===e&&(r()[0]||e).focus()})):!n&&i&&a()}),()=>{i&&a()}})},e.intersect=e=>{e.directive("intersect",({el:e,get:t,modifiers:n})=>{let i=!1;const o=new IntersectionObserver(e=>{for(const r of e){const e=n?.full?r.intersectionRatio>=1:r.isIntersecting,s=n?.leave?i&&!e:e&&!i;i=e,s&&(t(),n?.once&&o.disconnect())}},{threshold:n?.full?1:0});return o.observe(e),()=>o.disconnect()})},e.mask=e=>{e.directive("mask",({el:e,exp:t})=>{const o=e,r=e=>{const{value:r,selectionStart:s}=o,a=e?.inputType,c=i(r,t,!a?.startsWith("del"));if(c===r)return!1;if(o.value=c,null!=s&&document.activeElement===o){let e=i(r.slice(0,s),t).length;if(!e||!a?.endsWith("Backward"))for(;e<c.length&&!n[t[e]];)e++;o.setSelectionRange(e,e)}return!0};e.addEventListener("input",r);const s=r();let a=!0;return Promise.resolve().then(()=>{a&&(r()||s)&&(e.dispatchEvent(new Event("input")),e.dispatchEvent(new Event("change")))}),()=>{a=!1,e.removeEventListener("input",r)}})},e.media=(e,t)=>(t&&ee.configure(t),e.scope.$mq=ee,e.scope.$mqProps=ee.props,e.scope.$mqAtLeast=ee.atLeast,e.scope.$mqMatch=ee.match,Object.defineProperty(e.scope,"$mqBreakpoint",{get:()=>ee.breakpoint,enumerable:!0,configurable:!0}),Object.defineProperty(e.scope,"$mqDevice",{get:()=>ee.device,enumerable:!0,configurable:!0}),()=>{te(),D.tick++}),e.morph=$,e.morphPlugin=e=>{e.scope.$morph=$},e.mq=ee,e.persist=e=>{e.directive("persist",({ctx:e,el:t,exp:n,arg:i,modifiers:o,effect:r})=>{const a=s+(n||t.id);let c=o?void 0:l();for(const s in o)if(c=l(s))break;const f=i?i.split(",").map(e=>e.trim()).filter(Boolean):void 0;d(e.scope,a,f,c,r)})},e.persistStore=(e,n={})=>{const i=(0,t.store)(e);if(!i)return()=>{};const o=l(n.storage);return d(i,s+(n.key??e),n.keys,o,t.watchEffect)},e.registerStorage=(e,t)=>{a[e.toLowerCase()]=t},e.resetMedia=()=>{te(),R={...P},z=["base",...Object.keys(R).sort((e,t)=>R[e]-R[t])],I=!1,D.bp="base",D.tick=0},e.resize=e=>{e.directive("resize",({el:e,get:t,exp:n,modifiers:i})=>{const o=t(`(($width, $height) => { ${n} })`);if(i?.window||i?.visual){const e=i.visual&&window.visualViewport||window,t=()=>o(e.width||innerWidth,e.height||innerHeight);return e.addEventListener("resize",t),t(),()=>e.removeEventListener("resize",t)}const r=new ResizeObserver(e=>{for(const t of e){const e=t.contentRect;o(e.width,e.height)}});return r.observe(e),()=>r.disconnect()})},e.setDefaultStorage=e=>{c=e},e.transition=e=>{e.directive("transition",({el:e,get:t,effect:n,arg:i,modifiers:o,exp:s})=>{const a=e,c=i||"v",l=e=>`${c}-${e}`;let d,f=0;const u=()=>{a.classList.remove(l("enter-from"),l("enter-active"),l("enter-to"),l("leave-from"),l("leave-active"),l("leave-to"))},p=(e,t)=>{const n=++f;u(),a.classList.add(l(e+"-from"),l(e+"-active")),a.offsetWidth,a.classList.remove(l(e+"-from")),a.classList.add(l(e+"-to")),clearTimeout(d),d=setTimeout(()=>{n===f&&(u(),t&&t())},(e=>{const t=getComputedStyle(e);return Math.max(r(t.transitionDuration,t.transitionDelay),r(t.animationDuration,t.animationDelay))})(a))};if(!s){let e=!0;return Promise.resolve().then(()=>{e&&p("enter")}),a.__leave=()=>(e=!1,a.__leaving=1,new Promise(e=>p("leave",e))),()=>{e=!1,clearTimeout(d),u(),delete a.__leave}}const m="none"==a.style.display?"":a.style.display;let v;return n(()=>{const e=!!t();if(e===v)return;const n=null!=v;v=e,e?(a.style.display=m,(n||o?.appear)&&p("enter")):n?p("leave",()=>{a.style.display="none"}):a.style.display="none"}),()=>{clearTimeout(d),u(),!1===v&&(a.style.display="none")}})}});
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@aevantec/litevue")):"function"==typeof define&&define.amd?define(["exports","@aevantec/litevue"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).LiteVuePlugins={},e.LiteVue)}(this,function(e,t){var n={9:/\d/,a:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/},i=(e,t,i)=>{let o="",r="",s=0;for(let a=0;a<t.length;a++){const i=n[t[a]];if(i){for(;s<e.length&&!i.test(e[s]);)s++;if(s>=e.length)return o;o+=r+e[s++],r=""}else r+=t[a],e[s]===t[a]&&s++}return i?o+r:o},o=e=>(parseFloat(e)||0)*(e.includes("ms")?1:1e3),r=(e,t)=>{const n=e.split(","),i=t.split(",");let r=0;for(let s=0;s<n.length;s++)r=Math.max(r,o(n[s])+o(i[s%i.length]));return r},s="litevue:",a=Object.create(null),c="local",l=e=>{const t=e??c;return"string"!=typeof t?t:a[t.toLowerCase()]??(e=>{try{if("local"===e||"localStorage"===e)return localStorage;if("session"===e||"sessionStorage"===e)return sessionStorage}catch{}})(t)},d=(e,t,n,i,o)=>{if(!i)return o(()=>{});const r=((e,t)=>(t??Object.keys(e)).filter(t=>{if("$"===t[0])return!1;const n=Object.getOwnPropertyDescriptor(e,t);if(n&&n.get&&!n.set)return!1;const i=n&&n.value;return(!i||!0!==i.__v_isRef||!0!==i.__v_isReadonly)&&"function"!=typeof e[t]}))(e,n);try{const n=JSON.parse(i.getItem(t)||"null");if(n)for(const t of r)({}).hasOwnProperty.call(n,t)&&(e[t]=n[t])}catch{}return o(()=>{const n={};for(const t of r)n[t]=e[t];try{i.setItem(t,JSON.stringify(n))}catch{}})},f=[],u=(e,t,n)=>"radio"!==e.type||!e.name||e===(n.find(t=>"radio"===t.type&&t.name===e.name&&t.checked)||n.find(t=>"radio"===t.type&&t.name===e.name)),p=(e,t)=>1===e.nodeType&&(e.hasAttribute("data-morph-preserve")||e.__marker||!!t.preserve?.(e)),m="[v-scope\\.visible],[v-scope\\.idle],[v-scope\\.interaction]",h=/^(?:v-|:|@)/,v=/^(?::|v-bind:)/,b=/^v-(?!scope|on:)/,g=["id","data-key","data-id"],y=e=>{for(const t of g){const n=e.getAttribute(t);if(null!=n)return t+"="+n}return null},w=e=>{for(let t=e;t;t=t.parentElement)if(t.__ctx)return t.__ctx},x=e=>e.__ctx||[...e.children||[]].map(x).find(Boolean),k=(e,t)=>(t||x(e))?.dispose?.(e),E=e=>{const t=new Set;e.matches("details,dialog")&&t.add("open");for(const{name:n}of e.attributes)if(v.test(n)){const e=n.replace(v,"").split(".")[0];t.add(/\.camel\b/.test(n)?e.replace(/-(\w)/g,(e,t)=>t.toUpperCase()):e)}else/^v-model\b/.test(n)?(t.add("value"),t.add("checked")):"v-bind"===n?t.add("*"):b.test(n)&&(t.add("style"),"v-popover"==n&&t.add("popover"));return t},S=e=>e.hasAttribute("v-for")||e.hasAttribute("v-if")||e.hasAttribute("v-else")||e.hasAttribute("v-else-if"),T=["Value","Checked","Selected"],_=(e,t,n)=>{const i=E(t);e.__anchor&&i.add("style");for(const r of e.constructor.morphOwnedAttributes||[])i.add(r);n&&((e,t,n)=>{const i=E(t.closest("select")||t);if(!(n.has("*")||i.has("*")||i.has("value")||"output"==e.type||"textarea"==e.type&&t.value.includes("{{")))for(const o of T){const i=o.toLowerCase(),r="default"+o,s="Selected"==o?r:i;!n.has(i)&&r in e&&e[i]!==t[s]&&(e[i]=t[s])}})(e,t,i);const o=Object(e.__bound);for(const{name:r,value:s}of t.attributes)h.test(r)||i.has(r)||r in o||e.getAttribute(r)!==s&&e.setAttribute(r,s);for(const{name:r}of[...e.attributes])i.has("*")||i.has(r)||t.hasAttribute(r)||e.removeAttribute(r)},A=(e,t,n,i)=>{if(e.nodeType!==t.nodeType)return L(e,t,n,i);if(3===e.nodeType||8===e.nodeType){const o=t.data;if(((e,t)=>e.includes(t?t.delimiters[0]:"{{"))(o,n)&&"SCRIPT"!=e.parentNode?.nodeName)return;return e.data?void(e.data!==o&&(e.data=o)):L(e,t,n,i)}if(1!==e.nodeType)return;const o=e,r=t;if(o.tagName!==r.tagName)return L(e,t,n,i);if(!i.skip?.(o,r)&&!o.hasAttribute("data-morph-skip")){if(o.matches(m))return o.isEqualNode(r)?void 0:L(e,t,n,i);_(o,r,i.values),"TEMPLATE"!=o.tagName||o.content.isEqualNode(r.content)||(o.innerHTML=r.innerHTML),(e=>{if(e.hasAttribute("v-text")||e.hasAttribute("v-html")||e.hasAttribute("v-pre")||e.hasAttribute("v-once")||S(e))return!0;for(let t=e.firstElementChild;t;t=t.nextElementSibling)if(S(t))return!0;return!1})(r)||Object.getOwnPropertyDescriptor(Object(o.__ctx?.scope),"$template")||O(o,r,o.__ctx||n,i)}},L=(e,t,n,i)=>{if(p(e,i))return;const o=t.cloneNode(!0);return!1!==i.beforeNodeAdded?.(o)?(k(e,n),e.parentNode.replaceChild(o,e),i.afterNodeRemoved?.(e),N(o,n),o):void 0},N=(e,t)=>{if(e.parentElement?.closest(m))return;const n=t||w(e.parentNode);n?.walk?.(e,n)},O=(e,t,n,i)=>{const o=i.key||y,r=new Map;for(let u=e.firstChild;u;u=u.nextSibling)if(1===u.nodeType){const e=o(u);if(null==e)continue;r.set(e,u)}const s=e=>e&&1===e.nodeType?o(e):null,a=new Set;for(let u=t.firstChild;u;u=u.nextSibling)a.add(s(u));const c=t=>{p(t,i)||(k(t,n),e.removeChild(t),i.afterNodeRemoved?.(t))};let l=e.firstChild,d=t.firstChild;const f=t=>{const o=t.cloneNode(!0);!1!==i.beforeNodeAdded?.(o)&&(e.insertBefore(o,l),N(o,n))};for(;d;){const t=d.nextSibling,o=s(d);if(""===l?.data&&d.hasAttribute?.("v-teleport"))l=l.nextSibling;else if(null!=o){const t=r.get(o);t?(t===l?l=l.nextSibling:e.insertBefore(t,l),r.delete(o),A(t,d,n,i)):f(d)}else if(l&&(null==s(l)||!a.has(s(l))&&l.tagName===d.tagName)){if(p(l,i)&&!p(d,i)){l=l.nextSibling;continue}const e=l.nextSibling;A(l,d,n,i),l=e}else{if(l&&!a.has(s(l))){const e=l.nextSibling;c(l),l=e;continue}f(d)}d=t}for(;l;){const e=l.nextSibling;c(l),l=e}},$=(e,t,n={})=>{let i;if("string"==typeof t){const n=document.createElement("template"),o=e instanceof SVGElement;n.innerHTML=o?`<svg>${t.trim()}</svg>`:t.trim();const r=o?n.content.firstChild:n.content;i=1===r.childNodes.length&&r.firstElementChild?r.firstElementChild:(()=>{const t=e.cloneNode(!1);return t.append(...r.childNodes),t})()}else i=t;if(i){const t=()=>{const t=C();e=A(e,i,w(e.parentNode),n)||e,t()};n.transition&&document.startViewTransition?document.startViewTransition(t):t()}return e},C=()=>{const e=document.activeElement;if(!e||e===document.body)return()=>{};const t=e;let n=null,i=null;try{n=t.selectionStart,i=t.selectionEnd}catch{}return()=>{if(e!==document.activeElement&&e.isConnected&&(e.focus(),null!==n))try{t.setSelectionRange(n,i)}catch{}}},P={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},j=Object.freeze({...P}),q={mobile:"base",tablet:"md",desktop:"lg"},M=/^\d+$/,D=(0,t.reactive)({bp:"base",tick:0}),R={...P},z=["base"],I=!1,V=[],B=new Map,H=()=>"undefined"!=typeof window&&"function"==typeof window.matchMedia,W=(e,t)=>(e.addEventListener("change",t),{mql:e,off:()=>e.removeEventListener("change",t)}),K=()=>{for(let e=V.length-1;e>=0;e--)if(V[e].mql.matches)return z[e+1];return"base"},J=()=>{V.forEach(e=>e.off()),V=[];const e=Object.keys(R).filter(e=>R[e]>0).sort((e,t)=>R[e]-R[t]);z=["base",...e],H()&&(V=e.map(e=>{const t=window.matchMedia(`(min-width: ${R[e]}px)`);return W(t,()=>{D.bp=K()})}),D.bp=K())},Z=()=>{I||(I=!0,J()),D.tick},F=e=>{if(!H())return!1;let t=B.get(e);t?B.delete(e):t=W(window.matchMedia(e),()=>D.tick++),B.set(e,t);for(const[n,i]of B){if(B.size<=64)break;i.off(),B.delete(n)}return t.mql.matches},G=e=>{if("number"==typeof e)return e;if("base"===e)return 0;if(M.test(e))return Number(e);const t=void 0===R[e]?q[e]:void 0;return void 0!==t?"base"===t?0:R[t]:R[e]},U=e=>{if(e<=0)return!0;const t=z.findIndex(t=>"base"!==t&&R[t]===e);return-1!==t?z.indexOf(D.bp)>=t:(D.tick,F(`(min-width: ${e}px)`))},Q=(e,t)=>{if(Z(),!e||"object"!=typeof e)return t;let n,i=-1;for(const o of Object.keys(e)){const t=G(o);void 0!==t&&(t>=i&&U(t)&&(i=t,n=e[o]))}return void 0!==n?n:t},X=e=>{const t=q[e],n=R[t];return void 0!==n?n:P[t]},Y=(e,t)=>Q(e,t),ee=Object.defineProperties(Y,{props:{value:e=>{Z();const t={};for(const n of Object.keys(e))t[n]=Q(e[n]);return t}},breakpoint:{get:()=>(Z(),D.bp),enumerable:!0},device:{get:()=>(Z(),U(X("tablet"))?U(X("desktop"))?"desktop":"tablet":"mobile"),enumerable:!0},atLeast:{value:e=>{Z();const t=G(e);return void 0!==t&&U(t)}},match:{value:e=>(Z(),F(e))},configure:{value:({breakpoints:e})=>{e&&(R={...e},I&&(J(),D.tick++))}}}),te=()=>{V.forEach(e=>e.off()),B.forEach(e=>e.off()),V=[],B.clear(),I=!1};e.collapse=e=>{e.directive("collapse",({el:e,get:t,effect:n,modifiers:i})=>{const o=e;let r=250;for(const u in i||{}){const e=/^duration-(\d+)$/.exec(u);e&&(r=+e[1])}const s=["overflow","height","transition","visibility"],a=s.map(e=>o.style[e]);let c,l=0;const d=new Set,f=(e,t)=>{const n=setTimeout(()=>{d.delete(n),e()},t);d.add(n)};return n(()=>{const e=!!t();if(e===c)return;const n=++l;var i;i=!e,o.style.visibility=i?"hidden":a[3],o.style.overflow=e&&null==c?a[0]:"hidden",null==c?f(()=>{o.style.transition=`height ${r}ms ease, visibility ${r}ms`}):(o.style.height=a[1]||o.scrollHeight+"px",e?f(()=>{n===l&&(o.style.height=a[1],o.style.overflow=a[0])},r):o.offsetHeight),e||(o.style.height="0px"),c=e}),()=>{d.forEach(clearTimeout),s.forEach((e,t)=>o.style[e]=a[t])}})},e.defaultBreakpoints=j,e.focus=e=>{e.directive("focus",({el:e,get:t,effect:n,modifiers:i})=>{let o=!0,r=!1;return n(()=>{r!==(r=!!t())&&Promise.resolve().then(()=>{o&&r&&(e.focus(),i?.select&&e.select&&e.select())})}),()=>{o=!1}}),e.directive("trap",({el:e,get:t,effect:n})=>{let i=!1,o=null;const r=()=>[...e.querySelectorAll("a[href],area[href],button,input:not([type=hidden]),select,textarea,summary,iframe,audio[controls],video[controls],[contenteditable],[tabindex]")].filter(e=>e.tabIndex>=0&&!e.matches(":disabled,[inert],[inert] *")&&!1!==e.checkVisibility?.({visibilityProperty:!0})).filter(u),s=t=>{if("Tab"!==t.key||f.at(-1)!==e)return;const n=r();if(!n.length)return void t.preventDefault();const i=n[0],o=n[n.length-1],s=document.activeElement;e.contains(s)?(t.shiftKey?i:o).compareDocumentPosition(s)&(t.shiftKey?4:2)||(t.preventDefault(),(t.shiftKey?o:i).focus()):(t.preventDefault(),i.focus())},a=()=>{i=!1,f.splice(f.indexOf(e),1),document.removeEventListener("keydown",s,!0),o&&o.focus&&o.focus()};return n(()=>{const n=!!t();n&&!i?(i=!0,o=document.activeElement,f.splice(f.findIndex(t=>e.contains(t))>>>0,0,e),document.addEventListener("keydown",s,!0),Promise.resolve().then(()=>{i&&f.at(-1)===e&&(r()[0]||e).focus()})):!n&&i&&a()}),()=>{i&&a()}})},e.intersect=e=>{e.directive("intersect",({el:e,get:t,modifiers:n})=>{let i=!1;const o=new IntersectionObserver(e=>{for(const r of e){const e=n?.full?r.intersectionRatio>=1:r.isIntersecting,s=n?.leave?i&&!e:e&&!i;i=e,s&&(t(),n?.once&&o.disconnect())}},{threshold:n?.full?1:0});return o.observe(e),()=>o.disconnect()})},e.mask=e=>{e.directive("mask",({el:e,exp:t})=>{const o=e,r=e=>{const{value:r,selectionStart:s}=o,a=e?.inputType,c=i(r,t,!a?.startsWith("del"));if(c===r)return!1;if(o.value=c,null!=s&&document.activeElement===o){let e=i(r.slice(0,s),t).length;if(!e||!a?.endsWith("Backward"))for(;e<c.length&&!n[t[e]];)e++;o.setSelectionRange(e,e)}return!0};e.addEventListener("input",r);const s=r();let a=!0;return Promise.resolve().then(()=>{a&&(r()||s)&&(e.dispatchEvent(new Event("input")),e.dispatchEvent(new Event("change")))}),()=>{a=!1,e.removeEventListener("input",r)}})},e.media=(e,t)=>(t&&ee.configure(t),e.scope.$mq=ee,e.scope.$mqProps=ee.props,e.scope.$mqAtLeast=ee.atLeast,e.scope.$mqMatch=ee.match,Object.defineProperty(e.scope,"$mqBreakpoint",{get:()=>ee.breakpoint,enumerable:!0,configurable:!0}),Object.defineProperty(e.scope,"$mqDevice",{get:()=>ee.device,enumerable:!0,configurable:!0}),()=>{te(),D.tick++}),e.morph=$,e.morphPlugin=e=>{e.scope.$morph=$},e.mq=ee,e.persist=e=>{e.directive("persist",({ctx:e,el:t,exp:n,arg:i,modifiers:o,effect:r})=>{const a=s+(n||t.id);let c=o?void 0:l();for(const s in o)if(c=l(s))break;const f=i?i.split(",").map(e=>e.trim()).filter(Boolean):void 0;d(e.scope,a,f,c,r)})},e.persistStore=(e,n={})=>{const i=(0,t.store)(e);if(!i)return()=>{};const o=l(n.storage);return d(i,s+(n.key??e),n.keys,o,t.watchEffect)},e.registerStorage=(e,t)=>{a[e.toLowerCase()]=t},e.resetMedia=()=>{te(),R={...P},z=["base",...Object.keys(R).sort((e,t)=>R[e]-R[t])],I=!1,D.bp="base",D.tick=0},e.resize=e=>{e.directive("resize",({el:e,get:t,exp:n,modifiers:i})=>{const o=t(`(($width, $height) => { ${n} })`);if(i?.window||i?.visual){const e=i.visual&&window.visualViewport||window,t=()=>o(e.width||innerWidth,e.height||innerHeight);return e.addEventListener("resize",t),t(),()=>e.removeEventListener("resize",t)}const r=new ResizeObserver(e=>{for(const t of e){const e=t.contentRect;o(e.width,e.height)}});return r.observe(e),()=>r.disconnect()})},e.setDefaultStorage=e=>{c=e},e.transition=e=>{e.directive("transition",({el:e,get:t,effect:n,arg:i,modifiers:o,exp:s})=>{const a=e,c=i||"v",l=e=>`${c}-${e}`;let d,f=0;const u=()=>{a.classList.remove(l("enter-from"),l("enter-active"),l("enter-to"),l("leave-from"),l("leave-active"),l("leave-to"))},p=(e,t)=>{const n=++f;u(),a.classList.add(l(e+"-from"),l(e+"-active")),a.offsetWidth,a.classList.remove(l(e+"-from")),a.classList.add(l(e+"-to")),clearTimeout(d),d=setTimeout(()=>{n===f&&(u(),t&&t())},(e=>{const t=getComputedStyle(e);return Math.max(r(t.transitionDuration,t.transitionDelay),r(t.animationDuration,t.animationDelay))})(a))};if(!s){let e=!0;return Promise.resolve().then(()=>{e&&p("enter")}),a.__leave=()=>(e=!1,new Promise(e=>p("leave",e))),()=>{e=!1,clearTimeout(d),u(),delete a.__leave}}const m="none"==a.style.display?"":a.style.display;let h;return n(()=>{const e=!!t();if(e===h)return;const n=null!=h;h=e,e?(a.style.display=m,(n||o?.appear)&&p("enter")):n?p("leave",()=>{a.style.display="none"}):a.style.display="none"}),()=>{clearTimeout(d),u(),!1===h&&(a.style.display="none")}})}});
|
package/dist/litevue.dev.iife.js
CHANGED
|
@@ -643,7 +643,6 @@ getter: `, this.getter);
|
|
|
643
643
|
var registerComponent = (name) => {
|
|
644
644
|
if (!isDisabled()) componentNames.add(name);
|
|
645
645
|
};
|
|
646
|
-
/** Registers a plugin and returns a deregister, as registerScope does. */
|
|
647
646
|
var registerPlugin = (info) => {
|
|
648
647
|
if (isDisabled()) return;
|
|
649
648
|
pluginList.push(info);
|
|
@@ -653,7 +652,6 @@ getter: `, this.getter);
|
|
|
653
652
|
if (i > -1) pluginList.splice(i, 1);
|
|
654
653
|
};
|
|
655
654
|
};
|
|
656
|
-
/** True when something is listening, so app.use() can skip the diff. */
|
|
657
655
|
var pluginsWatched = () => !isDisabled();
|
|
658
656
|
var emitFlush = () => {
|
|
659
657
|
if (listeners.flush.size && !isDisabled()) emit("flush");
|
|
@@ -703,7 +701,6 @@ getter: `, this.getter);
|
|
|
703
701
|
};
|
|
704
702
|
if (typeof window !== "undefined" && !isDisabled()) window.__LITE_VUE__ = devtools;
|
|
705
703
|
// src/errors.ts
|
|
706
|
-
/** Levenshtein, bounded — only used to rank candidate names in DEV. */
|
|
707
704
|
var distance = (a, b) => {
|
|
708
705
|
const m = a.length;
|
|
709
706
|
const n = b.length;
|
|
@@ -717,7 +714,6 @@ getter: `, this.getter);
|
|
|
717
714
|
}
|
|
718
715
|
return prev[n];
|
|
719
716
|
};
|
|
720
|
-
/** Every name in scope, up the prototype chain that nested `v-scope`s inherit. */
|
|
721
717
|
var scopeNames = (scope) => {
|
|
722
718
|
const names = /* @__PURE__ */ new Set();
|
|
723
719
|
let cur = scope;
|
|
@@ -727,7 +723,6 @@ getter: `, this.getter);
|
|
|
727
723
|
}
|
|
728
724
|
return [...names];
|
|
729
725
|
};
|
|
730
|
-
/** `count is not defined` → the closest name actually in scope. */
|
|
731
726
|
var suggestName = (err, scope) => {
|
|
732
727
|
if (!scope || !(err instanceof ReferenceError)) return;
|
|
733
728
|
const missing = /^(\w+) is not defined$/.exec(err.message)?.[1];
|
|
@@ -748,14 +743,12 @@ getter: `, this.getter);
|
|
|
748
743
|
suggestion: best
|
|
749
744
|
} : { missing };
|
|
750
745
|
};
|
|
751
|
-
/** A short, recognisable rendering of the element — not its whole subtree. */
|
|
752
746
|
var describeEl = (el) => {
|
|
753
747
|
if (!el) return;
|
|
754
748
|
if (!(el instanceof Element)) return el.nodeType === 3 ? `text node "${el.nodeValue?.trim().slice(0, 40)}"` : void 0;
|
|
755
749
|
return `<${el.tagName.toLowerCase()}${el.id ? `#${el.id}` : ""}${el.classList.length ? `.${[...el.classList].join(".")}` : ""}>`;
|
|
756
750
|
};
|
|
757
751
|
var handlers = [];
|
|
758
|
-
/** Registered by `app.onError()`. Shared across apps, like the store registry. */
|
|
759
752
|
var addErrorHandler = (fn) => {
|
|
760
753
|
handlers.push(fn);
|
|
761
754
|
return () => {
|
|
@@ -792,17 +785,7 @@ getter: `, this.getter);
|
|
|
792
785
|
if (info.el) console.error(info.el);
|
|
793
786
|
};
|
|
794
787
|
// src/scheduler.ts
|
|
795
|
-
/**
|
|
796
|
-
* Effects this library has stopped.
|
|
797
|
-
*
|
|
798
|
-
* The scheduler must know whether a queued runner is still live, and
|
|
799
|
-
* @vue/reactivity offers no supported way to ask: 3.4's `ReactiveEffect.active`
|
|
800
|
-
* became an undeclared `flags` bitfield in 3.5. Since every stop here goes
|
|
801
|
-
* through `stopEffect`, tracking them ourselves is version-proof. Weak, so a
|
|
802
|
-
* stopped effect stays collectable.
|
|
803
|
-
*/
|
|
804
788
|
var stopped = /* @__PURE__ */ new WeakSet();
|
|
805
|
-
/** Stops an effect and remembers that it is stopped. Use instead of `stop`. */
|
|
806
789
|
var stopEffect = (runner) => {
|
|
807
790
|
stopped.add(runner);
|
|
808
791
|
if (runner.effect) stop(runner);
|
|
@@ -813,10 +796,6 @@ getter: `, this.getter);
|
|
|
813
796
|
var p = Promise.resolve();
|
|
814
797
|
var MAX_RUNS = 100;
|
|
815
798
|
var nextTick = (fn) => p.then(fn);
|
|
816
|
-
/**
|
|
817
|
-
* Stamps a job with its creation order, which the flush runs in. An effect
|
|
818
|
-
* stamped as it is created sorts before the children its first run creates.
|
|
819
|
-
*/
|
|
820
799
|
var stampJob = (job) => (job.i = uid$1++, job);
|
|
821
800
|
var queueJob = (job) => {
|
|
822
801
|
job.i ?? stampJob(job);
|
|
@@ -848,19 +827,10 @@ getter: `, this.getter);
|
|
|
848
827
|
};
|
|
849
828
|
// src/magics.ts
|
|
850
829
|
var uid = 0;
|
|
851
|
-
/**
|
|
852
|
-
* $id('name') — unique ids for accessibility attributes. Stable within a scope
|
|
853
|
-
* so label/input pairs match, unique across scopes.
|
|
854
|
-
*/
|
|
855
830
|
var createId = () => {
|
|
856
831
|
const memo = Object.create(null);
|
|
857
832
|
return (name = "id") => memo[name] || (memo[name] = `${name}-${++uid}`);
|
|
858
833
|
};
|
|
859
|
-
/**
|
|
860
|
-
* $watch(source, callback, { immediate }) — watches a dot-path string or getter
|
|
861
|
-
* and calls back with (value, oldValue). Returns a stop function; it also stops
|
|
862
|
-
* when the owning scope unmounts.
|
|
863
|
-
*/
|
|
864
834
|
var createWatch = (ctx) => (source, cb, options) => {
|
|
865
835
|
const getter = typeof source === "function" ? source : () => source.split(".").reduce((o, k) => o == null ? o : o[k], ctx.scope);
|
|
866
836
|
let oldValue;
|
|
@@ -950,22 +920,10 @@ getter: `, this.getter);
|
|
|
950
920
|
else style[name] = val;
|
|
951
921
|
};
|
|
952
922
|
// src/warn.ts
|
|
953
|
-
/**
|
|
954
|
-
* Development warnings.
|
|
955
|
-
*
|
|
956
|
-
* Every call site is guarded by `import.meta.env.DEV`; the production build
|
|
957
|
-
* replaces that constant and terser drops the branch, so neither these
|
|
958
|
-
* functions nor their strings ship. Messages are therefore free to be wordy —
|
|
959
|
-
* say what to do instead.
|
|
960
|
-
*/
|
|
961
923
|
var seen = /* @__PURE__ */ new Set();
|
|
962
924
|
var warn = (msg) => {
|
|
963
925
|
console.warn(`[litevue] ${msg}`);
|
|
964
926
|
};
|
|
965
|
-
/**
|
|
966
|
-
* Warns once per `key`. Most callers are effects, which re-run on every
|
|
967
|
-
* relevant change — one mistake would otherwise print on every keystroke.
|
|
968
|
-
*/
|
|
969
927
|
var warnOnce = (key, msg) => {
|
|
970
928
|
if (seen.has(key)) return;
|
|
971
929
|
seen.add(key);
|
|
@@ -1014,10 +972,6 @@ getter: `, this.getter);
|
|
|
1014
972
|
}
|
|
1015
973
|
};
|
|
1016
974
|
// src/directives/on.ts
|
|
1017
|
-
/**
|
|
1018
|
-
* Can `exp` stand as a single expression, or is it a statement list?
|
|
1019
|
-
* Memoised: it compiles a throwaway function, which a `v-for` pays per row.
|
|
1020
|
-
*/
|
|
1021
975
|
var expressionCache = Object.create(null);
|
|
1022
976
|
var cachedExpressions = 0;
|
|
1023
977
|
var isExpression = (exp) => {
|
|
@@ -1181,11 +1135,6 @@ getter: `, this.getter);
|
|
|
1181
1135
|
if (val != null) el.removeAttribute(name);
|
|
1182
1136
|
return val;
|
|
1183
1137
|
};
|
|
1184
|
-
/**
|
|
1185
|
-
* Adds a listener and returns a remover. Callers are expected to use it:
|
|
1186
|
-
* `app.unmount(el)` leaves elements in the document, so a listener left behind
|
|
1187
|
-
* would keep driving markup meant to be inert.
|
|
1188
|
-
*/
|
|
1189
1138
|
var listen = (el, event, handler, options) => {
|
|
1190
1139
|
el.addEventListener(event, handler, options);
|
|
1191
1140
|
return () => el.removeEventListener(event, handler, options);
|
|
@@ -1321,35 +1270,19 @@ getter: `, this.getter);
|
|
|
1321
1270
|
};
|
|
1322
1271
|
// src/ownership.ts
|
|
1323
1272
|
var owned = /* @__PURE__ */ new WeakMap();
|
|
1324
|
-
/**
|
|
1325
|
-
* The node currently being walked. A module-level cursor suffices because the
|
|
1326
|
-
* walk is synchronous and depth-first, and it keeps `owner` out of every
|
|
1327
|
-
* directive signature.
|
|
1328
|
-
*/
|
|
1329
1273
|
var owner;
|
|
1330
1274
|
var setOwner = (node) => {
|
|
1331
1275
|
const previous = owner;
|
|
1332
1276
|
owner = node;
|
|
1333
1277
|
return previous;
|
|
1334
1278
|
};
|
|
1335
|
-
/**
|
|
1336
|
-
* Registers a disposer against `node`, defaulting to the node being walked.
|
|
1337
|
-
* Pass `node` explicitly for a directive that outlives its element: `v-if` and
|
|
1338
|
-
* `v-for` detach the template and render from an anchor, so they must own to
|
|
1339
|
-
* the anchor.
|
|
1340
|
-
*/
|
|
1341
1279
|
var own = (dispose, node = owner) => {
|
|
1342
1280
|
if (!node) return;
|
|
1343
1281
|
const list = owned.get(node);
|
|
1344
1282
|
if (list) list.push(dispose);
|
|
1345
1283
|
else owned.set(node, [dispose]);
|
|
1346
1284
|
};
|
|
1347
|
-
/** Withdraws a disposer from `node`, for an owner that removes it itself. */
|
|
1348
1285
|
var disown = (dispose, node) => remove(owned.get(node) || [], dispose);
|
|
1349
|
-
/**
|
|
1350
|
-
* Disposes `node` and its subtree. Safe on an unowned node, and idempotent —
|
|
1351
|
-
* the record is dropped as it runs.
|
|
1352
|
-
*/
|
|
1353
1286
|
var disposeSubtree = (node) => {
|
|
1354
1287
|
const list = owned.get(node);
|
|
1355
1288
|
if (list) {
|
|
@@ -1643,17 +1576,12 @@ getter: `, this.getter);
|
|
|
1643
1576
|
"idle",
|
|
1644
1577
|
"interaction"
|
|
1645
1578
|
];
|
|
1646
|
-
/** Selector matching every scope root, deferred or not. */
|
|
1647
1579
|
var SCOPE_SELECTOR = ["[v-scope]", ...LAZY_MODES.map((m) => `[v-scope\\.${m}]`)].join(",");
|
|
1648
1580
|
var INTERACTIONS = [
|
|
1649
1581
|
"pointerdown",
|
|
1650
1582
|
"keydown",
|
|
1651
1583
|
"focusin"
|
|
1652
1584
|
];
|
|
1653
|
-
/**
|
|
1654
|
-
* Arms `mode` and returns a disposer. Fires at most once; disposing first
|
|
1655
|
-
* cancels it, since a region can be unmounted while still waiting.
|
|
1656
|
-
*/
|
|
1657
1585
|
var arm = (el, mode, fire) => {
|
|
1658
1586
|
let done = false;
|
|
1659
1587
|
const once = () => {
|
|
@@ -1688,10 +1616,6 @@ getter: `, this.getter);
|
|
|
1688
1616
|
stop();
|
|
1689
1617
|
};
|
|
1690
1618
|
};
|
|
1691
|
-
/**
|
|
1692
|
-
* Returns true if `el` was deferred. The walk must not descend into it:
|
|
1693
|
-
* walking consumes directives, so it could not be walked again later.
|
|
1694
|
-
*/
|
|
1695
1619
|
var deferScope = (el, ctx, walk, once) => {
|
|
1696
1620
|
const mode = LAZY_MODES.find((m) => el.hasAttribute(`v-scope.${m}`));
|
|
1697
1621
|
if (!mode) return false;
|
|
@@ -1713,16 +1637,6 @@ getter: `, this.getter);
|
|
|
1713
1637
|
var dirRE = /^(?:v-|:|@)/;
|
|
1714
1638
|
var modifierRE = /\.([\w-]+)/g;
|
|
1715
1639
|
var inOnce = false;
|
|
1716
|
-
/**
|
|
1717
|
-
* Registers a cleanup on both owners: the context, for whole-region teardown,
|
|
1718
|
-
* and the walked node, for a subtree detached on its own. Dropping the entry
|
|
1719
|
-
* when the node goes keeps a re-mounted region from accumulating spent ones.
|
|
1720
|
-
*
|
|
1721
|
-
* The `indexOf` guard also makes this run-once. A subtree can reach the same
|
|
1722
|
-
* cleanup twice — via the block root, whose teardown drains `ctx.cleanups`,
|
|
1723
|
-
* and via the node — and a second run would remove a listener the next mount
|
|
1724
|
-
* installed.
|
|
1725
|
-
*/
|
|
1726
1640
|
var addCleanup = (ctx, cleanup, node) => {
|
|
1727
1641
|
ctx.cleanups.push(cleanup);
|
|
1728
1642
|
own(() => {
|
|
@@ -1931,10 +1845,6 @@ getter: `, this.getter);
|
|
|
1931
1845
|
}
|
|
1932
1846
|
});
|
|
1933
1847
|
};
|
|
1934
|
-
/**
|
|
1935
|
-
* `querySelector` for a selector written in markup. One that does not parse is
|
|
1936
|
-
* reported and yields undefined, rather than throwing out of `mount()`.
|
|
1937
|
-
*/
|
|
1938
1848
|
var query = (sel, el, source) => {
|
|
1939
1849
|
try {
|
|
1940
1850
|
return document.querySelector(sel);
|
|
@@ -1954,7 +1864,7 @@ getter: `, this.getter);
|
|
|
1954
1864
|
if (templateEl !== void 0) console.error(`template selector ${template} has no matching <template> element.`);
|
|
1955
1865
|
return;
|
|
1956
1866
|
}
|
|
1957
|
-
el.appendChild(templateEl.content
|
|
1867
|
+
el.appendChild(el.ownerDocument.importNode(templateEl.content, true));
|
|
1958
1868
|
return;
|
|
1959
1869
|
}
|
|
1960
1870
|
el.innerHTML = template;
|
|
@@ -1991,11 +1901,6 @@ getter: `, this.getter);
|
|
|
1991
1901
|
};
|
|
1992
1902
|
return ctx;
|
|
1993
1903
|
};
|
|
1994
|
-
/**
|
|
1995
|
-
* Framework-provided, so non-enumerable: `Object.assign`-ing one scope onto
|
|
1996
|
-
* another must copy the user's data and leave these alone. v-for does exactly
|
|
1997
|
-
* that on every update, which reset each row's $id and wiped its $refs.
|
|
1998
|
-
*/
|
|
1999
1904
|
var hide = (scope, key, value) => Object.defineProperty(scope, key, {
|
|
2000
1905
|
value,
|
|
2001
1906
|
writable: true,
|
|
@@ -2040,7 +1945,7 @@ getter: `, this.getter);
|
|
|
2040
1945
|
else if (template.hasAttribute("v-for")) {
|
|
2041
1946
|
this.isFragment = true;
|
|
2042
1947
|
(this.template = new DocumentFragment()).append(template.cloneNode(true));
|
|
2043
|
-
} else if (this.isFragment) this.template = template.
|
|
1948
|
+
} else if (this.isFragment) this.template = template.ownerDocument.importNode(template.content, true);
|
|
2044
1949
|
else this.template = template.cloneNode(true);
|
|
2045
1950
|
if (isRoot) this.ctx = createContext(parentCtx);
|
|
2046
1951
|
else {
|
|
@@ -2113,10 +2018,6 @@ getter: `, this.getter);
|
|
|
2113
2018
|
if (leaves.length) Promise.all(leaves).then(removeNow);
|
|
2114
2019
|
else removeNow();
|
|
2115
2020
|
}
|
|
2116
|
-
/**
|
|
2117
|
-
* The bookkeeping half of `remove()`, for a block whose nodes are already
|
|
2118
|
-
* gone — `remove()`'s `removeChild` calls would throw on them.
|
|
2119
|
-
*/
|
|
2120
2021
|
discard() {
|
|
2121
2022
|
if (this.parentCtx) remove(this.parentCtx.blocks, this);
|
|
2122
2023
|
this.teardown();
|
|
@@ -2130,20 +2031,6 @@ getter: `, this.getter);
|
|
|
2130
2031
|
}
|
|
2131
2032
|
};
|
|
2132
2033
|
// src/store.ts
|
|
2133
|
-
/**
|
|
2134
|
-
* DEV: catch `$store.typo`, which otherwise reads as `undefined` and renders a
|
|
2135
|
-
* blank instead of raising.
|
|
2136
|
-
*
|
|
2137
|
-
* The trap sits *under* `reactive`, not over it: `reactive` probes its target
|
|
2138
|
-
* for `__v_raw`, and a wrapper that forwards that probe is bypassed entirely.
|
|
2139
|
-
* `__v_`-prefixed keys are ignored for the same reason — they are not reads a
|
|
2140
|
-
* user wrote.
|
|
2141
|
-
*
|
|
2142
|
-
* Deferred to the end of the task, because reading a store before it is
|
|
2143
|
-
* registered is legitimate — the registry is reactive so the expression
|
|
2144
|
-
* re-runs. A microtask would warn on a store registered after an `await`. One
|
|
2145
|
-
* registered later still warns; a check cannot wait forever.
|
|
2146
|
-
*/
|
|
2147
2034
|
var registry = Object.create(null);
|
|
2148
2035
|
var target = registry;
|
|
2149
2036
|
target = new Proxy(registry, { get(obj, key, receiver) {
|
|
@@ -2284,12 +2171,6 @@ getter: `, this.getter);
|
|
|
2284
2171
|
}
|
|
2285
2172
|
return this;
|
|
2286
2173
|
},
|
|
2287
|
-
/**
|
|
2288
|
-
* Tear down mounted regions: every root, or only those at or inside `el`.
|
|
2289
|
-
* Effects stop, cleanups run and scopes deregister; the rest of the app
|
|
2290
|
-
* keeps running. Without it, replacing a region's markup leaves its
|
|
2291
|
-
* effects writing to detached nodes.
|
|
2292
|
-
*/
|
|
2293
2174
|
unmount(el) {
|
|
2294
2175
|
if (el == null) {
|
|
2295
2176
|
rootBlocks.forEach((block) => block.teardown());
|