@aevantec/litevue 0.5.4 → 0.5.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/dist/litevue-devtools.iife.js +1 -1
  2. package/dist/litevue-devtools.mjs +1 -853
  3. package/dist/litevue-devtools.umd.js +1 -1
  4. package/dist/litevue-plugins.iife.js +1 -1
  5. package/dist/litevue-plugins.mjs +1 -717
  6. package/dist/litevue-plugins.umd.js +1 -1
  7. package/dist/litevue.iife.js +1 -12
  8. package/dist/litevue.mjs +1 -1890
  9. package/dist/litevue.umd.js +1 -12
  10. package/dist/plugins/collapse.iife.js +1 -1
  11. package/dist/plugins/collapse.mjs +1 -46
  12. package/dist/plugins/collapse.umd.js +1 -1
  13. package/dist/plugins/focus.iife.js +1 -1
  14. package/dist/plugins/focus.mjs +1 -69
  15. package/dist/plugins/focus.umd.js +1 -1
  16. package/dist/plugins/intersect.iife.js +1 -1
  17. package/dist/plugins/intersect.mjs +1 -20
  18. package/dist/plugins/intersect.umd.js +1 -1
  19. package/dist/plugins/mask.iife.js +1 -1
  20. package/dist/plugins/mask.mjs +1 -37
  21. package/dist/plugins/mask.umd.js +1 -1
  22. package/dist/plugins/media.iife.js +1 -1
  23. package/dist/plugins/media.mjs +1 -204
  24. package/dist/plugins/media.umd.js +1 -1
  25. package/dist/plugins/morph.iife.js +1 -1
  26. package/dist/plugins/morph.mjs +1 -174
  27. package/dist/plugins/morph.umd.js +1 -1
  28. package/dist/plugins/persist.iife.js +1 -1
  29. package/dist/plugins/persist.mjs +1 -86
  30. package/dist/plugins/persist.umd.js +1 -1
  31. package/dist/plugins/resize.iife.js +1 -1
  32. package/dist/plugins/resize.mjs +1 -15
  33. package/dist/plugins/resize.umd.js +1 -1
  34. package/dist/plugins/transition.iife.js +1 -1
  35. package/dist/plugins/transition.mjs +1 -76
  36. package/dist/plugins/transition.umd.js +1 -1
  37. package/dist/types/app.d.mts +30 -2
  38. package/dist/types/app.d.ts +30 -2
  39. package/dist/types/block.d.mts +7 -0
  40. package/dist/types/block.d.ts +7 -0
  41. package/dist/types/context.d.mts +7 -0
  42. package/dist/types/context.d.ts +7 -0
  43. package/dist/types/index.d.mts +1 -1
  44. package/dist/types/index.d.ts +1 -1
  45. package/dist/types/ownership.d.mts +30 -0
  46. package/dist/types/ownership.d.ts +30 -0
  47. package/dist/types/plugins/media/index.d.mts +0 -4
  48. package/dist/types/plugins/media/index.d.ts +0 -4
  49. package/dist/types/scheduler.d.mts +3 -0
  50. package/dist/types/scheduler.d.ts +3 -0
  51. package/dist/types/warn.d.mts +16 -0
  52. package/dist/types/warn.d.ts +16 -0
  53. package/package.json +15 -8
@@ -1 +1 @@
1
- var LiteVueMorph=function(t){"use strict";const e=/^(?:v-|:|@)/,n=/^(?::|v-bind:)/,r=["id","data-key","data-id"],i=t=>{for(const e of r){const n=t.getAttribute(e);if(null!=n)return e+"="+n}return null},o=t=>{for(let e=t;e;e=e.parentElement)if(e.__ctx)return e.__ctx},l=t=>t.hasAttribute("v-for")||t.hasAttribute("v-if")||t.hasAttribute("v-else")||t.hasAttribute("v-else-if"),s=(t,r)=>{const i=(t=>{const e=new Set;for(const{name:r}of t.attributes)n.test(r)?e.add(r.replace(n,"").split(".")[0]):"v-model"===r&&(e.add("value"),e.add("checked"));return e})(r);for(const{name:n,value:o}of[...r.attributes])e.test(n)||i.has(n)||t.getAttribute(n)!==o&&t.setAttribute(n,o);for(const{name:e}of[...t.attributes])i.has(e)||r.hasAttribute(e)||t.removeAttribute(e)},c=(t,e,n,r)=>{if(t.nodeType!==e.nodeType)return u(t,e,n);if(3===t.nodeType||8===t.nodeType){const r=e.data;if(((t,e)=>t.includes(e?e.delimiters[0]:"{{"))(r,n))return;return void(t.data!==r&&(t.data=r))}if(1!==t.nodeType)return;const i=t,o=e;if(i.tagName!==o.tagName)return u(t,e,n);r.skip?.(i,o)||i.hasAttribute("data-morph-skip")||(s(i,o),(t=>{if(t.hasAttribute("v-text")||t.hasAttribute("v-html")||t.hasAttribute("v-pre")||t.hasAttribute("v-once")||l(t))return!0;for(let e=t.firstElementChild;e;e=e.nextElementSibling)if(l(e))return!0;return!1})(o)||d(i,o,i.__ctx||n,r))},u=(t,e,n)=>{const r=e.cloneNode(!0);t.parentNode.replaceChild(r,t),a(r,n)},a=(t,e)=>{const n=e||o(t.parentNode);n?.walk?.(t,n)},d=(t,e,n,r)=>{const o=r.key||i,l=new Map;for(let i=t.firstChild;i;i=i.nextSibling)if(1===i.nodeType){const t=o(i);if(null==t)continue;l.set(t,i)}const s=t=>t&&1===t.nodeType?o(t):null;let u=t.firstChild,d=e.firstChild;const f=e=>{const r=e.cloneNode(!0);t.insertBefore(r,u),a(r,n)};for(;d;){const e=d.nextSibling,i=s(d);if(null!=i){const e=l.get(i);e?(e===u?u=u.nextSibling:t.insertBefore(e,u),l.delete(i),c(e,d,n,r)):f(d)}else if(u&&null==s(u)){const t=u.nextSibling;c(u,d,n,r),u=t}else f(d);d=e}for(;u;){const e=u.nextSibling;t.removeChild(u),u=e}},f=(t,e,n={})=>{let r;if("string"==typeof e){const n=document.createElement("template");n.innerHTML=e.trim();const i=n.content;r=1===i.childElementCount?i.firstElementChild:(()=>{const e=t.cloneNode(!1);return e.appendChild(i),e})()}else r=e;if(r){const e=h();c(t,r,o(t),n),e()}return t},h=()=>{const t=document.activeElement;if(!t||t===document.body)return()=>{};const e=t;let n=null,r=null;try{n=e.selectionStart,r=e.selectionEnd}catch{}return()=>{if(t!==document.activeElement&&t.isConnected&&(t.focus(),null!==n))try{e.setSelectionRange(n,r)}catch{}}};return t.morph=f,t.morphPlugin=t=>{t.scope.$morph=f},Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),t}({});
1
+ var LiteVueMorph=function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});var e=/^(?:v-|:|@)/,n=/^(?::|v-bind:)/,r=["id","data-key","data-id"],i=t=>{for(const e of r){const n=t.getAttribute(e);if(null!=n)return e+"="+n}return null},o=t=>{for(let e=t;e;e=e.parentElement)if(e.__ctx)return e.__ctx},l=t=>t.hasAttribute("v-for")||t.hasAttribute("v-if")||t.hasAttribute("v-else")||t.hasAttribute("v-else-if"),s=(t,r)=>{const i=(t=>{const e=new Set;for(const{name:r}of t.attributes)n.test(r)?e.add(r.replace(n,"").split(".")[0]):"v-model"===r&&(e.add("value"),e.add("checked"));return e})(r);for(const{name:n,value:o}of[...r.attributes])e.test(n)||i.has(n)||t.getAttribute(n)!==o&&t.setAttribute(n,o);for(const{name:e}of[...t.attributes])i.has(e)||r.hasAttribute(e)||t.removeAttribute(e)},c=(t,e,n,r)=>{if(t.nodeType!==e.nodeType)return a(t,e,n);if(3===t.nodeType||8===t.nodeType){const r=e.data;if(((t,e)=>t.includes(e?e.delimiters[0]:"{{"))(r,n))return;return void(t.data!==r&&(t.data=r))}if(1!==t.nodeType)return;const i=t,o=e;if(i.tagName!==o.tagName)return a(t,e,n);r.skip?.(i,o)||i.hasAttribute("data-morph-skip")||(s(i,o),(t=>{if(t.hasAttribute("v-text")||t.hasAttribute("v-html")||t.hasAttribute("v-pre")||t.hasAttribute("v-once")||l(t))return!0;for(let e=t.firstElementChild;e;e=e.nextElementSibling)if(l(e))return!0;return!1})(o)||d(i,o,i.__ctx||n,r))},a=(t,e,n)=>{const r=e.cloneNode(!0);n?.dispose?.(t),t.parentNode.replaceChild(r,t),u(r,n)},u=(t,e)=>{const n=e||o(t.parentNode);n?.walk?.(t,n)},d=(t,e,n,r)=>{const o=r.key||i,l=new Map;for(let i=t.firstChild;i;i=i.nextSibling)if(1===i.nodeType){const t=o(i);if(null==t)continue;l.set(t,i)}const s=t=>t&&1===t.nodeType?o(t):null;let a=t.firstChild,d=e.firstChild;const f=e=>{const r=e.cloneNode(!0);t.insertBefore(r,a),u(r,n)};for(;d;){const e=d.nextSibling,i=s(d);if(null!=i){const e=l.get(i);e?(e===a?a=a.nextSibling:t.insertBefore(e,a),l.delete(i),c(e,d,n,r)):f(d)}else if(a&&null==s(a)){const t=a.nextSibling;c(a,d,n,r),a=t}else f(d);d=e}for(;a;){const e=a.nextSibling;n?.dispose?.(a),t.removeChild(a),a=e}},f=(t,e,n={})=>{let r;if("string"==typeof e){const n=document.createElement("template");n.innerHTML=e.trim();const i=n.content;r=1===i.childElementCount?i.firstElementChild:(()=>{const e=t.cloneNode(!1);return e.appendChild(i),e})()}else r=e;if(r){const e=h();c(t,r,o(t),n),e()}return t},h=()=>{const t=document.activeElement;if(!t||t===document.body)return()=>{};const e=t;let n=null,r=null;try{n=e.selectionStart,r=e.selectionEnd}catch{}return()=>{if(t!==document.activeElement&&t.isConnected&&(t.focus(),null!==n))try{e.setSelectionRange(n,r)}catch{}}};return t.morph=f,t.morphPlugin=t=>{t.scope.$morph=f},t}({});
@@ -1,174 +1 @@
1
- const dirRE = /^(?:v-|:|@)/;
2
- const bindRE = /^(?::|v-bind:)/;
3
- const KEY_ATTRS = ["id", "data-key", "data-id"];
4
- const defaultKey = (el) => {
5
- for (const attr of KEY_ATTRS) {
6
- const value = el.getAttribute(attr);
7
- if (value != null) return attr + "=" + value;
8
- }
9
- return null;
10
- };
11
- const nearestCtx = (node) => {
12
- for (let el = node; el; el = el.parentElement) {
13
- if (el.__ctx) return el.__ctx;
14
- }
15
- };
16
- const boundAttrs = (to) => {
17
- const owned = /* @__PURE__ */ new Set();
18
- for (const { name } of to.attributes) {
19
- if (bindRE.test(name)) {
20
- owned.add(name.replace(bindRE, "").split(".")[0]);
21
- } else if (name === "v-model") {
22
- owned.add("value");
23
- owned.add("checked");
24
- }
25
- }
26
- return owned;
27
- };
28
- const isBlockRoot = (el) => el.hasAttribute("v-for") || el.hasAttribute("v-if") || el.hasAttribute("v-else") || el.hasAttribute("v-else-if");
29
- const ownsChildren = (to) => {
30
- if (to.hasAttribute("v-text") || to.hasAttribute("v-html") || to.hasAttribute("v-pre") || to.hasAttribute("v-once") || isBlockRoot(to)) {
31
- return true;
32
- }
33
- for (let c = to.firstElementChild; c; c = c.nextElementSibling) {
34
- if (isBlockRoot(c)) return true;
35
- }
36
- return false;
37
- };
38
- const patchAttrs = (from, to) => {
39
- const owned = boundAttrs(to);
40
- for (const { name, value } of [...to.attributes]) {
41
- if (dirRE.test(name) || owned.has(name)) continue;
42
- if (from.getAttribute(name) !== value) from.setAttribute(name, value);
43
- }
44
- for (const { name } of [...from.attributes]) {
45
- if (owned.has(name) || to.hasAttribute(name)) continue;
46
- from.removeAttribute(name);
47
- }
48
- };
49
- const isInterpolation = (data, ctx) => data.includes(ctx ? ctx.delimiters[0] : "{{");
50
- const patchNode = (from, to, ctx, opts) => {
51
- if (from.nodeType !== to.nodeType) return replaceNode(from, to, ctx);
52
- if (from.nodeType === 3 || from.nodeType === 8) {
53
- const data = to.data;
54
- if (isInterpolation(data, ctx)) return;
55
- if (from.data !== data) from.data = data;
56
- return;
57
- }
58
- if (from.nodeType !== 1) return;
59
- const a = from;
60
- const b = to;
61
- if (a.tagName !== b.tagName) return replaceNode(from, to, ctx);
62
- if (opts.skip?.(a, b) || a.hasAttribute("data-morph-skip")) return;
63
- patchAttrs(a, b);
64
- if (!ownsChildren(b)) {
65
- patchChildren(a, b, a.__ctx || ctx, opts);
66
- }
67
- };
68
- const replaceNode = (from, to, ctx) => {
69
- const fresh = to.cloneNode(true);
70
- from.parentNode.replaceChild(fresh, from);
71
- mountNew(fresh, ctx);
72
- };
73
- const mountNew = (node, ctx) => {
74
- const target = ctx || nearestCtx(node.parentNode);
75
- target?.walk?.(node, target);
76
- };
77
- const patchChildren = (from, to, ctx, opts) => {
78
- const key = opts.key || defaultKey;
79
- const keyed = /* @__PURE__ */ new Map();
80
- for (let n = from.firstChild; n; n = n.nextSibling) {
81
- if (n.nodeType === 1) {
82
- const k = key(n);
83
- if (k == null) continue;
84
- keyed.set(k, n);
85
- }
86
- }
87
- const keyOf = (n) => n && n.nodeType === 1 ? key(n) : null;
88
- let oldChild = from.firstChild;
89
- let newChild = to.firstChild;
90
- const insert = (node) => {
91
- const fresh = node.cloneNode(true);
92
- from.insertBefore(fresh, oldChild);
93
- mountNew(fresh, ctx);
94
- };
95
- while (newChild) {
96
- const nextNew = newChild.nextSibling;
97
- const wantKey = keyOf(newChild);
98
- if (wantKey != null) {
99
- const match = keyed.get(wantKey);
100
- if (match) {
101
- if (match === oldChild) {
102
- oldChild = oldChild.nextSibling;
103
- } else {
104
- from.insertBefore(match, oldChild);
105
- }
106
- keyed.delete(wantKey);
107
- patchNode(match, newChild, ctx, opts);
108
- } else {
109
- insert(newChild);
110
- }
111
- } else if (oldChild && keyOf(oldChild) == null) {
112
- const nextOld = oldChild.nextSibling;
113
- patchNode(oldChild, newChild, ctx, opts);
114
- oldChild = nextOld;
115
- } else {
116
- insert(newChild);
117
- }
118
- newChild = nextNew;
119
- }
120
- while (oldChild) {
121
- const next = oldChild.nextSibling;
122
- from.removeChild(oldChild);
123
- oldChild = next;
124
- }
125
- };
126
- const morph = (from, to, opts = {}) => {
127
- let target;
128
- if (typeof to === "string") {
129
- const holder = document.createElement("template");
130
- holder.innerHTML = to.trim();
131
- const content = holder.content;
132
- target = content.childElementCount === 1 ? content.firstElementChild : (() => {
133
- const wrapper = from.cloneNode(false);
134
- wrapper.appendChild(content);
135
- return wrapper;
136
- })();
137
- } else {
138
- target = to;
139
- }
140
- if (target) {
141
- const restore = captureFocus();
142
- patchNode(from, target, nearestCtx(from), opts);
143
- restore();
144
- }
145
- return from;
146
- };
147
- const captureFocus = () => {
148
- const active = document.activeElement;
149
- if (!active || active === document.body) return () => {
150
- };
151
- const field = active;
152
- let start = null;
153
- let end = null;
154
- try {
155
- start = field.selectionStart;
156
- end = field.selectionEnd;
157
- } catch {
158
- }
159
- return () => {
160
- if (active === document.activeElement || !active.isConnected) return;
161
- active.focus();
162
- if (start !== null) {
163
- try {
164
- field.setSelectionRange(start, end);
165
- } catch {
166
- }
167
- }
168
- };
169
- };
170
- const morphPlugin = (app) => {
171
- app.scope.$morph = morph;
172
- };
173
-
174
- export { morph, morphPlugin };
1
+ var t=/^(?:v-|:|@)/,e=/^(?::|v-bind:)/,n=["id","data-key","data-id"],r=t=>{for(const e of n){const n=t.getAttribute(e);if(null!=n)return e+"="+n}return null},i=t=>{for(let e=t;e;e=e.parentElement)if(e.__ctx)return e.__ctx},o=t=>t.hasAttribute("v-for")||t.hasAttribute("v-if")||t.hasAttribute("v-else")||t.hasAttribute("v-else-if"),s=(n,r)=>{const i=(t=>{const n=/* @__PURE__ */new Set;for(const{name:r}of t.attributes)e.test(r)?n.add(r.replace(e,"").split(".")[0]):"v-model"===r&&(n.add("value"),n.add("checked"));return n})(r);for(const{name:e,value:o}of[...r.attributes])t.test(e)||i.has(e)||n.getAttribute(e)!==o&&n.setAttribute(e,o);for(const{name:t}of[...n.attributes])i.has(t)||r.hasAttribute(t)||n.removeAttribute(t)},l=(t,e,n,r)=>{if(t.nodeType!==e.nodeType)return c(t,e,n);if(3===t.nodeType||8===t.nodeType){const r=e.data;if(((t,e)=>t.includes(e?e.delimiters[0]:"{{"))(r,n))return;return void(t.data!==r&&(t.data=r))}if(1!==t.nodeType)return;const i=t,l=e;if(i.tagName!==l.tagName)return c(t,e,n);r.skip?.(i,l)||i.hasAttribute("data-morph-skip")||(s(i,l),(t=>{if(t.hasAttribute("v-text")||t.hasAttribute("v-html")||t.hasAttribute("v-pre")||t.hasAttribute("v-once")||o(t))return!0;for(let e=t.firstElementChild;e;e=e.nextElementSibling)if(o(e))return!0;return!1})(l)||d(i,l,i.__ctx||n,r))},c=(t,e,n)=>{const r=e.cloneNode(!0);n?.dispose?.(t),t.parentNode.replaceChild(r,t),a(r,n)},a=(t,e)=>{const n=e||i(t.parentNode);n?.walk?.(t,n)},d=(t,e,n,i)=>{const o=i.key||r,s=/* @__PURE__ */new Map;for(let r=t.firstChild;r;r=r.nextSibling)if(1===r.nodeType){const t=o(r);if(null==t)continue;s.set(t,r)}const c=t=>t&&1===t.nodeType?o(t):null;let d=t.firstChild,u=e.firstChild;const f=e=>{const r=e.cloneNode(!0);t.insertBefore(r,d),a(r,n)};for(;u;){const e=u.nextSibling,r=c(u);if(null!=r){const e=s.get(r);e?(e===d?d=d.nextSibling:t.insertBefore(e,d),s.delete(r),l(e,u,n,i)):f(u)}else if(d&&null==c(d)){const t=d.nextSibling;l(d,u,n,i),d=t}else f(u);u=e}for(;d;){const e=d.nextSibling;n?.dispose?.(d),t.removeChild(d),d=e}},u=(t,e,n={})=>{let r;if("string"==typeof e){const n=document.createElement("template");n.innerHTML=e.trim();const i=n.content;r=1===i.childElementCount?i.firstElementChild:(()=>{const e=t.cloneNode(!1);return e.appendChild(i),e})()}else r=e;if(r){const e=f();l(t,r,i(t),n),e()}return t},f=()=>{const t=document.activeElement;if(!t||t===document.body)return()=>{};const e=t;let n=null,r=null;try{n=e.selectionStart,r=e.selectionEnd}catch{}return()=>{if(t!==document.activeElement&&t.isConnected&&(t.focus(),null!==n))try{e.setSelectionRange(n,r)}catch{}}},h=t=>{t.scope.$morph=u};export{u as morph,h as morphPlugin};
@@ -1 +1 @@
1
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).LiteVueMorph={})}(this,function(t){"use strict";const e=/^(?:v-|:|@)/,n=/^(?::|v-bind:)/,o=["id","data-key","data-id"],i=t=>{for(const e of o){const n=t.getAttribute(e);if(null!=n)return e+"="+n}return null},r=t=>{for(let e=t;e;e=e.parentElement)if(e.__ctx)return e.__ctx},l=t=>t.hasAttribute("v-for")||t.hasAttribute("v-if")||t.hasAttribute("v-else")||t.hasAttribute("v-else-if"),s=(t,o)=>{const i=(t=>{const e=new Set;for(const{name:o}of t.attributes)n.test(o)?e.add(o.replace(n,"").split(".")[0]):"v-model"===o&&(e.add("value"),e.add("checked"));return e})(o);for(const{name:n,value:r}of[...o.attributes])e.test(n)||i.has(n)||t.getAttribute(n)!==r&&t.setAttribute(n,r);for(const{name:e}of[...t.attributes])i.has(e)||o.hasAttribute(e)||t.removeAttribute(e)},c=(t,e,n,o)=>{if(t.nodeType!==e.nodeType)return u(t,e,n);if(3===t.nodeType||8===t.nodeType){const o=e.data;if(((t,e)=>t.includes(e?e.delimiters[0]:"{{"))(o,n))return;return void(t.data!==o&&(t.data=o))}if(1!==t.nodeType)return;const i=t,r=e;if(i.tagName!==r.tagName)return u(t,e,n);o.skip?.(i,r)||i.hasAttribute("data-morph-skip")||(s(i,r),(t=>{if(t.hasAttribute("v-text")||t.hasAttribute("v-html")||t.hasAttribute("v-pre")||t.hasAttribute("v-once")||l(t))return!0;for(let e=t.firstElementChild;e;e=e.nextElementSibling)if(l(e))return!0;return!1})(r)||a(i,r,i.__ctx||n,o))},u=(t,e,n)=>{const o=e.cloneNode(!0);t.parentNode.replaceChild(o,t),d(o,n)},d=(t,e)=>{const n=e||r(t.parentNode);n?.walk?.(t,n)},a=(t,e,n,o)=>{const r=o.key||i,l=new Map;for(let i=t.firstChild;i;i=i.nextSibling)if(1===i.nodeType){const t=r(i);if(null==t)continue;l.set(t,i)}const s=t=>t&&1===t.nodeType?r(t):null;let u=t.firstChild,a=e.firstChild;const f=e=>{const o=e.cloneNode(!0);t.insertBefore(o,u),d(o,n)};for(;a;){const e=a.nextSibling,i=s(a);if(null!=i){const e=l.get(i);e?(e===u?u=u.nextSibling:t.insertBefore(e,u),l.delete(i),c(e,a,n,o)):f(a)}else if(u&&null==s(u)){const t=u.nextSibling;c(u,a,n,o),u=t}else f(a);a=e}for(;u;){const e=u.nextSibling;t.removeChild(u),u=e}},f=(t,e,n={})=>{let o;if("string"==typeof e){const n=document.createElement("template");n.innerHTML=e.trim();const i=n.content;o=1===i.childElementCount?i.firstElementChild:(()=>{const e=t.cloneNode(!1);return e.appendChild(i),e})()}else o=e;if(o){const e=p();c(t,o,r(t),n),e()}return t},p=()=>{const t=document.activeElement;if(!t||t===document.body)return()=>{};const e=t;let n=null,o=null;try{n=e.selectionStart,o=e.selectionEnd}catch{}return()=>{if(t!==document.activeElement&&t.isConnected&&(t.focus(),null!==n))try{e.setSelectionRange(n,o)}catch{}}};t.morph=f,t.morphPlugin=t=>{t.scope.$morph=f},Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})});
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).LiteVueMorph={})}(this,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});var t=/^(?:v-|:|@)/,n=/^(?::|v-bind:)/,o=["id","data-key","data-id"],i=e=>{for(const t of o){const n=e.getAttribute(t);if(null!=n)return t+"="+n}return null},r=e=>{for(let t=e;t;t=t.parentElement)if(t.__ctx)return t.__ctx},l=e=>e.hasAttribute("v-for")||e.hasAttribute("v-if")||e.hasAttribute("v-else")||e.hasAttribute("v-else-if"),s=(e,o)=>{const i=(e=>{const t=new Set;for(const{name:o}of e.attributes)n.test(o)?t.add(o.replace(n,"").split(".")[0]):"v-model"===o&&(t.add("value"),t.add("checked"));return t})(o);for(const{name:n,value:r}of[...o.attributes])t.test(n)||i.has(n)||e.getAttribute(n)!==r&&e.setAttribute(n,r);for(const{name:t}of[...e.attributes])i.has(t)||o.hasAttribute(t)||e.removeAttribute(t)},c=(e,t,n,o)=>{if(e.nodeType!==t.nodeType)return d(e,t,n);if(3===e.nodeType||8===e.nodeType){const o=t.data;if(((e,t)=>e.includes(t?t.delimiters[0]:"{{"))(o,n))return;return void(e.data!==o&&(e.data=o))}if(1!==e.nodeType)return;const i=e,r=t;if(i.tagName!==r.tagName)return d(e,t,n);o.skip?.(i,r)||i.hasAttribute("data-morph-skip")||(s(i,r),(e=>{if(e.hasAttribute("v-text")||e.hasAttribute("v-html")||e.hasAttribute("v-pre")||e.hasAttribute("v-once")||l(e))return!0;for(let t=e.firstElementChild;t;t=t.nextElementSibling)if(l(t))return!0;return!1})(r)||a(i,r,i.__ctx||n,o))},d=(e,t,n)=>{const o=t.cloneNode(!0);n?.dispose?.(e),e.parentNode.replaceChild(o,e),u(o,n)},u=(e,t)=>{const n=t||r(e.parentNode);n?.walk?.(e,n)},a=(e,t,n,o)=>{const r=o.key||i,l=new Map;for(let i=e.firstChild;i;i=i.nextSibling)if(1===i.nodeType){const e=r(i);if(null==e)continue;l.set(e,i)}const s=e=>e&&1===e.nodeType?r(e):null;let d=e.firstChild,a=t.firstChild;const f=t=>{const o=t.cloneNode(!0);e.insertBefore(o,d),u(o,n)};for(;a;){const t=a.nextSibling,i=s(a);if(null!=i){const t=l.get(i);t?(t===d?d=d.nextSibling:e.insertBefore(t,d),l.delete(i),c(t,a,n,o)):f(a)}else if(d&&null==s(d)){const e=d.nextSibling;c(d,a,n,o),d=e}else f(a);a=t}for(;d;){const t=d.nextSibling;n?.dispose?.(d),e.removeChild(d),d=t}},f=(e,t,n={})=>{let o;if("string"==typeof t){const n=document.createElement("template");n.innerHTML=t.trim();const i=n.content;o=1===i.childElementCount?i.firstElementChild:(()=>{const t=e.cloneNode(!1);return t.appendChild(i),t})()}else o=t;if(o){const t=p();c(e,o,r(e),n),t()}return e},p=()=>{const e=document.activeElement;if(!e||e===document.body)return()=>{};const t=e;let n=null,o=null;try{n=t.selectionStart,o=t.selectionEnd}catch{}return()=>{if(e!==document.activeElement&&e.isConnected&&(e.focus(),null!==n))try{t.setSelectionRange(n,o)}catch{}}};e.morph=f,e.morphPlugin=e=>{e.scope.$morph=f}});
@@ -1 +1 @@
1
- var LiteVuePersist=function(t,e){"use strict";const r="litevue:",o=Object.create(null);let s="local";const n=t=>{const e=t??s;return"string"!=typeof e?e:o[e]??(t=>{try{if("local"===t||"localStorage"===t)return localStorage;if("session"===t||"sessionStorage"===t)return sessionStorage}catch{}})(e)},i=(t,e,r,o,s)=>{if(!o)return s(()=>{});const n=((t,e)=>(e??Object.keys(t)).filter(e=>{if("$"===e[0])return!1;const r=Object.getOwnPropertyDescriptor(t,e);if(r&&r.get&&!r.set)return!1;const o=r&&r.value;return(!o||!0!==o.__v_isRef||!0!==o.__v_isReadonly)&&"function"!=typeof t[e]}))(t,r);try{const r=JSON.parse(o.getItem(e)||"null");if(r)for(const e of n)e in r&&(t[e]=r[e])}catch{}return s(()=>{const r={};for(const e of n)r[e]=t[e];try{o.setItem(e,JSON.stringify(r))}catch{}})};return t.persist=t=>{t.directive("persist",({ctx:t,el:e,exp:o,arg:s,modifiers:c,effect:f})=>{const a=r+(o||e.id);let l;for(const r in c||{})if(n(r)){l=r;break}const u=s?s.split(",").map(t=>t.trim()).filter(Boolean):void 0;i(t.scope,a,u,n(l),f)})},t.persistStore=(t,o={})=>{const s=e.store(t);if(!s)return()=>{};const c=n(o.storage);return i(s,r+(o.key??t),o.keys,c,e.watchEffect)},t.registerStorage=(t,e)=>{o[t]=e},t.setDefaultStorage=t=>{s=t},Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),t}({},LiteVue);
1
+ var LiteVuePersist=function(t,e){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});var r="litevue:",o=Object.create(null),s="local",n=t=>{const e=t??s;return"string"!=typeof e?e:o[e]??(t=>{try{if("local"===t||"localStorage"===t)return localStorage;if("session"===t||"sessionStorage"===t)return sessionStorage}catch{}})(e)},i=(t,e,r,o,s)=>{if(!o)return s(()=>{});const n=((t,e)=>(e??Object.keys(t)).filter(e=>{if("$"===e[0])return!1;const r=Object.getOwnPropertyDescriptor(t,e);if(r&&r.get&&!r.set)return!1;const o=r&&r.value;return(!o||!0!==o.__v_isRef||!0!==o.__v_isReadonly)&&"function"!=typeof t[e]}))(t,r);try{const r=JSON.parse(o.getItem(e)||"null");if(r)for(const e of n)e in r&&(t[e]=r[e])}catch{}return s(()=>{const r={};for(const e of n)r[e]=t[e];try{o.setItem(e,JSON.stringify(r))}catch{}})};return t.persist=t=>{t.directive("persist",({ctx:t,el:e,exp:o,arg:s,modifiers:c,effect:a})=>{const f=r+(o||e.id);let l;for(const r in c||{})if(n(r)){l=r;break}const u=s?s.split(",").map(t=>t.trim()).filter(Boolean):void 0;i(t.scope,f,u,n(l),a)})},t.persistStore=(t,o={})=>{const s=(0,e.store)(t);if(!s)return()=>{};const c=n(o.storage);return i(s,r+(o.key??t),o.keys,c,e.watchEffect)},t.registerStorage=(t,e)=>{o[t]=e},t.setDefaultStorage=t=>{s=t},t}({},LiteVue);
@@ -1,86 +1 @@
1
- import { store, watchEffect } from '@aevantec/litevue';
2
-
3
- const PREFIX = "litevue:";
4
- const registry = /* @__PURE__ */ Object.create(null);
5
- let defaultStorage = "local";
6
- const builtin = (name) => {
7
- try {
8
- if (name === "local" || name === "localStorage") return localStorage;
9
- if (name === "session" || name === "sessionStorage") return sessionStorage;
10
- } catch {
11
- }
12
- };
13
- const resolve = (storage) => {
14
- const target = storage ?? defaultStorage;
15
- if (typeof target !== "string") return target;
16
- return registry[target] ?? builtin(target);
17
- };
18
- const registerStorage = (name, storage) => {
19
- registry[name] = storage;
20
- };
21
- const setDefaultStorage = (storage) => {
22
- defaultStorage = storage;
23
- };
24
- const persistable = (target, keys) => (keys ?? Object.keys(target)).filter((k) => {
25
- if (k[0] === "$") return false;
26
- const desc = Object.getOwnPropertyDescriptor(target, k);
27
- if (desc && desc.get && !desc.set) return false;
28
- const raw = desc && desc.value;
29
- if (raw && raw.__v_isRef === true && raw.__v_isReadonly === true) {
30
- return false;
31
- }
32
- return typeof target[k] !== "function";
33
- });
34
- const sync = (target, key, keys, storage, run) => {
35
- if (!storage) return run(() => {
36
- });
37
- const fields = persistable(target, keys);
38
- try {
39
- const saved = JSON.parse(storage.getItem(key) || "null");
40
- if (saved) {
41
- for (const k of fields) {
42
- if (k in saved) target[k] = saved[k];
43
- }
44
- }
45
- } catch {
46
- }
47
- return run(() => {
48
- const snapshot = {};
49
- for (const k of fields) snapshot[k] = target[k];
50
- try {
51
- storage.setItem(key, JSON.stringify(snapshot));
52
- } catch {
53
- }
54
- });
55
- };
56
- const persist = (app) => {
57
- app.directive("persist", ({ ctx, el, exp, arg, modifiers, effect }) => {
58
- const key = PREFIX + (exp || el.id);
59
- let storage;
60
- for (const name in modifiers || {}) {
61
- if (resolve(name)) {
62
- storage = name;
63
- break;
64
- }
65
- }
66
- const keys = arg ? arg.split(",").map((k) => k.trim()).filter(Boolean) : void 0;
67
- sync(ctx.scope, key, keys, resolve(storage), effect);
68
- });
69
- };
70
- const persistStore = (name, options = {}) => {
71
- const target = store(name);
72
- if (!target) {
73
- return () => {
74
- };
75
- }
76
- const storage = resolve(options.storage);
77
- return sync(
78
- target,
79
- PREFIX + (options.key ?? name),
80
- options.keys,
81
- storage,
82
- watchEffect
83
- );
84
- };
85
-
86
- export { persist, persistStore, registerStorage, setDefaultStorage };
1
+ import{store as t,watchEffect as e}from"@aevantec/litevue";var r="litevue:",o=Object.create(null),n="local",s=t=>{const e=t??n;return"string"!=typeof e?e:o[e]??(t=>{try{if("local"===t||"localStorage"===t)return localStorage;if("session"===t||"sessionStorage"===t)return sessionStorage}catch{}})(e)},c=(t,e)=>{o[t]=e},i=t=>{n=t},f=(t,e,r,o,n)=>{if(!o)return n(()=>{});const s=((t,e)=>(e??Object.keys(t)).filter(e=>{if("$"===e[0])return!1;const r=Object.getOwnPropertyDescriptor(t,e);if(r&&r.get&&!r.set)return!1;const o=r&&r.value;return(!o||!0!==o.__v_isRef||!0!==o.__v_isReadonly)&&"function"!=typeof t[e]}))(t,r);try{const r=JSON.parse(o.getItem(e)||"null");if(r)for(const e of s)e in r&&(t[e]=r[e])}catch{}return n(()=>{const r={};for(const e of s)r[e]=t[e];try{o.setItem(e,JSON.stringify(r))}catch{}})},a=t=>{t.directive("persist",({ctx:t,el:e,exp:o,arg:n,modifiers:c,effect:i})=>{const a=r+(o||e.id);let l;for(const r in c||{})if(s(r)){l=r;break}const u=n?n.split(",").map(t=>t.trim()).filter(Boolean):void 0;f(t.scope,a,u,s(l),i)})},l=(o,n={})=>{const c=t(o);if(!c)return()=>{};const i=s(n.storage);return f(c,r+(n.key??o),n.keys,i,e)};export{a as persist,l as persistStore,c as registerStorage,i as setDefaultStorage};
@@ -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).LiteVuePersist={},e.LiteVue)}(this,function(e,t){"use strict";const o="litevue:",r=Object.create(null);let s="local";const n=e=>{const t=e??s;return"string"!=typeof t?t:r[t]??(e=>{try{if("local"===e||"localStorage"===e)return localStorage;if("session"===e||"sessionStorage"===e)return sessionStorage}catch{}})(t)},i=(e,t,o,r,s)=>{if(!r)return s(()=>{});const n=((e,t)=>(t??Object.keys(e)).filter(t=>{if("$"===t[0])return!1;const o=Object.getOwnPropertyDescriptor(e,t);if(o&&o.get&&!o.set)return!1;const r=o&&o.value;return(!r||!0!==r.__v_isRef||!0!==r.__v_isReadonly)&&"function"!=typeof e[t]}))(e,o);try{const o=JSON.parse(r.getItem(t)||"null");if(o)for(const t of n)t in o&&(e[t]=o[t])}catch{}return s(()=>{const o={};for(const t of n)o[t]=e[t];try{r.setItem(t,JSON.stringify(o))}catch{}})};e.persist=e=>{e.directive("persist",({ctx:e,el:t,exp:r,arg:s,modifiers:c,effect:f})=>{const l=o+(r||t.id);let a;for(const o in c||{})if(n(o)){a=o;break}const u=s?s.split(",").map(e=>e.trim()).filter(Boolean):void 0;i(e.scope,l,u,n(a),f)})},e.persistStore=(e,r={})=>{const s=t.store(e);if(!s)return()=>{};const c=n(r.storage);return i(s,o+(r.key??e),r.keys,c,t.watchEffect)},e.registerStorage=(e,t)=>{r[e]=t},e.setDefaultStorage=e=>{s=e},Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
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).LiteVuePersist={},e.LiteVue)}(this,function(e,t){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});var r="litevue:",o=Object.create(null),i="local",n=e=>{const t=e??i;return"string"!=typeof t?t:o[t]??(e=>{try{if("local"===e||"localStorage"===e)return localStorage;if("session"===e||"sessionStorage"===e)return sessionStorage}catch{}})(t)},s=(e,t,r,o,i)=>{if(!o)return i(()=>{});const n=((e,t)=>(t??Object.keys(e)).filter(t=>{if("$"===t[0])return!1;const r=Object.getOwnPropertyDescriptor(e,t);if(r&&r.get&&!r.set)return!1;const o=r&&r.value;return(!o||!0!==o.__v_isRef||!0!==o.__v_isReadonly)&&"function"!=typeof e[t]}))(e,r);try{const r=JSON.parse(o.getItem(t)||"null");if(r)for(const t of n)t in r&&(e[t]=r[t])}catch{}return i(()=>{const r={};for(const t of n)r[t]=e[t];try{o.setItem(t,JSON.stringify(r))}catch{}})};e.persist=e=>{e.directive("persist",({ctx:e,el:t,exp:o,arg:i,modifiers:c,effect:f})=>{const a=r+(o||t.id);let l;for(const r in c||{})if(n(r)){l=r;break}const u=i?i.split(",").map(e=>e.trim()).filter(Boolean):void 0;s(e.scope,a,u,n(l),f)})},e.persistStore=(e,o={})=>{const i=(0,t.store)(e);if(!i)return()=>{};const c=n(o.storage);return s(i,r+(o.key??e),o.keys,c,t.watchEffect)},e.registerStorage=(e,t)=>{o[e]=t},e.setDefaultStorage=e=>{i=e}});
@@ -1 +1 @@
1
- var LiteVueResize=function(e){"use strict";return e.resize=e=>{e.directive("resize",({el:e,get:t,exp:i})=>{const r=t(`(($width, $height) => { ${i} })`),n=new ResizeObserver(e=>{for(const t of e){const e=t.contentRect;r(e.width,e.height)}});return n.observe(e),()=>n.disconnect()})},Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e}({});
1
+ var LiteVueResize=function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});return e.resize=e=>{e.directive("resize",({el:e,get:t,exp:i})=>{const r=t(`(($width, $height) => { ${i} })`),n=new ResizeObserver(e=>{for(const t of e){const e=t.contentRect;r(e.width,e.height)}});return n.observe(e),()=>n.disconnect()})},e}({});
@@ -1,15 +1 @@
1
- const resize = (app) => {
2
- app.directive("resize", ({ el, get, exp }) => {
3
- const handler = get(`(($width, $height) => { ${exp} })`);
4
- const observer = new ResizeObserver((entries) => {
5
- for (const entry of entries) {
6
- const box = entry.contentRect;
7
- handler(box.width, box.height);
8
- }
9
- });
10
- observer.observe(el);
11
- return () => observer.disconnect();
12
- });
13
- };
14
-
15
- export { resize };
1
+ var e=e=>{e.directive("resize",({el:e,get:t,exp:r})=>{const i=t(`(($width, $height) => { ${r} })`),n=new ResizeObserver(e=>{for(const t of e){const e=t.contentRect;i(e.width,e.height)}});return n.observe(e),()=>n.disconnect()})};export{e as resize};
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).LiteVueResize={})}(this,function(e){"use strict";e.resize=e=>{e.directive("resize",({el:e,get:t,exp:i})=>{const o=t(`(($width, $height) => { ${i} })`),n=new ResizeObserver(e=>{for(const t of e){const e=t.contentRect;o(e.width,e.height)}});return n.observe(e),()=>n.disconnect()})},Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).LiteVueResize={})}(this,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});e.resize=e=>{e.directive("resize",({el:e,get:t,exp:o})=>{const i=t(`(($width, $height) => { ${o} })`),n=new ResizeObserver(e=>{for(const t of e){const e=t.contentRect;i(e.width,e.height)}});return n.observe(e),()=>n.disconnect()})}});
@@ -1 +1 @@
1
- var LiteVueTransition=function(e){"use strict";const t=e=>(parseFloat(e)||0)*(e.includes("ms")?1:1e3),n=(e,n)=>{const i=e.split(","),a=n.split(",");let r=0;for(let s=0;s<i.length;s++)r=Math.max(r,t(i[s])+t(a[s%a.length]));return r};return e.transition=e=>{e.directive("transition",({el:e,get:t,effect:i,arg:a,modifiers:r,exp:s})=>{const o=e,l=a||"v",c=e=>`${l}-${e}`;let v=0,m=!0;const d=()=>{o.classList.remove(c("enter-from"),c("enter-active"),c("enter-to"),c("leave-from"),c("leave-active"),c("leave-to"))},u=(e,t)=>{const i=++v;d(),o.classList.add(c(e+"-from"),c(e+"-active")),o.offsetWidth,o.classList.remove(c(e+"-from")),o.classList.add(c(e+"-to")),setTimeout(()=>{i===v&&(d(),t&&t())},(e=>{const t=getComputedStyle(e);return Math.max(n(t.transitionDuration,t.transitionDelay),n(t.animationDuration,t.animationDelay))})(o))};if(!s)return Promise.resolve().then(()=>u("enter")),o.__leave=()=>new Promise(e=>u("leave",e)),()=>{delete o.__leave};i(()=>{const e=!!t();if(m)return m=!1,o.style.display=e?"":"none",void(e&&r?.appear&&u("enter"));e?(o.style.display="",u("enter")):u("leave",()=>{o.style.display="none"})})})},Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e}({});
1
+ var LiteVueTransition=function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});var t=e=>(parseFloat(e)||0)*(e.includes("ms")?1:1e3),a=(e,a)=>{const r=e.split(","),i=a.split(",");let n=0;for(let o=0;o<r.length;o++)n=Math.max(n,t(r[o])+t(i[o%i.length]));return n};return e.transition=e=>{e.directive("transition",({el:e,get:t,effect:r,arg:i,modifiers:n,exp:o})=>{const s=e,l=i||"v",c=e=>`${l}-${e}`;let m,v=0,u=!0;const d=()=>{s.classList.remove(c("enter-from"),c("enter-active"),c("enter-to"),c("leave-from"),c("leave-active"),c("leave-to"))},f=(e,t)=>{const r=++v;d(),s.classList.add(c(e+"-from"),c(e+"-active")),s.offsetWidth,s.classList.remove(c(e+"-from")),s.classList.add(c(e+"-to")),clearTimeout(m),m=setTimeout(()=>{r===v&&(d(),t&&t())},(e=>{const t=getComputedStyle(e);return Math.max(a(t.transitionDuration,t.transitionDelay),a(t.animationDuration,t.animationDelay))})(s))};if(!o){let e=!0;return Promise.resolve().then(()=>{e&&f("enter")}),s.__leave=()=>new Promise(e=>f("leave",e)),()=>{e=!1,clearTimeout(m),delete s.__leave}}return r(()=>{const e=!!t();if(u)return u=!1,s.style.display=e?"":"none",void(e&&n?.appear&&f("enter"));e?(s.style.display="",f("enter")):f("leave",()=>{s.style.display="none"})}),()=>clearTimeout(m)})},e}({});
@@ -1,76 +1 @@
1
- const toMs = (v) => (parseFloat(v) || 0) * (v.includes("ms") ? 1 : 1e3);
2
- const maxOf = (durations, delays) => {
3
- const ds = durations.split(",");
4
- const dl = delays.split(",");
5
- let max = 0;
6
- for (let i = 0; i < ds.length; i++) {
7
- max = Math.max(max, toMs(ds[i]) + toMs(dl[i % dl.length]));
8
- }
9
- return max;
10
- };
11
- const durationOf = (el) => {
12
- const s = getComputedStyle(el);
13
- return Math.max(
14
- maxOf(s.transitionDuration, s.transitionDelay),
15
- maxOf(s.animationDuration, s.animationDelay)
16
- );
17
- };
18
- const transition = (app) => {
19
- app.directive("transition", ({ el, get, effect, arg, modifiers, exp }) => {
20
- const elem = el;
21
- const name = arg || "v";
22
- const cls = (phase) => `${name}-${phase}`;
23
- let seq = 0;
24
- let first = true;
25
- const clear = () => {
26
- elem.classList.remove(
27
- cls("enter-from"),
28
- cls("enter-active"),
29
- cls("enter-to"),
30
- cls("leave-from"),
31
- cls("leave-active"),
32
- cls("leave-to")
33
- );
34
- };
35
- const run = (phase, done) => {
36
- const id = ++seq;
37
- clear();
38
- elem.classList.add(cls(phase + "-from"), cls(phase + "-active"));
39
- void elem.offsetWidth;
40
- elem.classList.remove(cls(phase + "-from"));
41
- elem.classList.add(cls(phase + "-to"));
42
- setTimeout(() => {
43
- if (id === seq) {
44
- clear();
45
- if (done) done();
46
- }
47
- }, durationOf(elem));
48
- };
49
- if (!exp) {
50
- Promise.resolve().then(() => run("enter"));
51
- elem.__leave = () => new Promise((resolve) => run("leave", resolve));
52
- return () => {
53
- delete elem.__leave;
54
- };
55
- }
56
- effect(() => {
57
- const show = !!get();
58
- if (first) {
59
- first = false;
60
- elem.style.display = show ? "" : "none";
61
- if (show && modifiers?.appear) run("enter");
62
- return;
63
- }
64
- if (show) {
65
- elem.style.display = "";
66
- run("enter");
67
- } else {
68
- run("leave", () => {
69
- elem.style.display = "none";
70
- });
71
- }
72
- });
73
- });
74
- };
75
-
76
- export { transition };
1
+ var e=e=>(parseFloat(e)||0)*(e.includes("ms")?1:1e3),t=(t,a)=>{const r=t.split(","),i=a.split(",");let n=0;for(let o=0;o<r.length;o++)n=Math.max(n,e(r[o])+e(i[o%i.length]));return n},a=e=>{e.directive("transition",({el:e,get:a,effect:r,arg:i,modifiers:n,exp:o})=>{const s=e,l=i||"v",c=e=>`${l}-${e}`;let m,v=0,d=!0;const u=()=>{s.classList.remove(c("enter-from"),c("enter-active"),c("enter-to"),c("leave-from"),c("leave-active"),c("leave-to"))},f=(e,a)=>{const r=++v;u(),s.classList.add(c(e+"-from"),c(e+"-active")),s.offsetWidth,s.classList.remove(c(e+"-from")),s.classList.add(c(e+"-to")),clearTimeout(m),m=setTimeout(()=>{r===v&&(u(),a&&a())},(e=>{const a=getComputedStyle(e);return Math.max(t(a.transitionDuration,a.transitionDelay),t(a.animationDuration,a.animationDelay))})(s))};if(!o){let e=!0;return Promise.resolve().then(()=>{e&&f("enter")}),s.__leave=()=>new Promise(e=>f("leave",e)),()=>{e=!1,clearTimeout(m),delete s.__leave}}return r(()=>{const e=!!a();if(d)return d=!1,s.style.display=e?"":"none",void(e&&n?.appear&&f("enter"));e?(s.style.display="",f("enter")):f("leave",()=>{s.style.display="none"})}),()=>clearTimeout(m)})};export{a as transition};
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).LiteVueTransition={})}(this,function(e){"use strict";const t=e=>(parseFloat(e)||0)*(e.includes("ms")?1:1e3),n=(e,n)=>{const i=e.split(","),o=n.split(",");let s=0;for(let a=0;a<i.length;a++)s=Math.max(s,t(i[a])+t(o[a%o.length]));return s};e.transition=e=>{e.directive("transition",({el:e,get:t,effect:i,arg:o,modifiers:s,exp:a})=>{const r=e,l=o||"v",f=e=>`${l}-${e}`;let d=0,c=!0;const m=()=>{r.classList.remove(f("enter-from"),f("enter-active"),f("enter-to"),f("leave-from"),f("leave-active"),f("leave-to"))},u=(e,t)=>{const i=++d;m(),r.classList.add(f(e+"-from"),f(e+"-active")),r.offsetWidth,r.classList.remove(f(e+"-from")),r.classList.add(f(e+"-to")),setTimeout(()=>{i===d&&(m(),t&&t())},(e=>{const t=getComputedStyle(e);return Math.max(n(t.transitionDuration,t.transitionDelay),n(t.animationDuration,t.animationDelay))})(r))};if(!a)return Promise.resolve().then(()=>u("enter")),r.__leave=()=>new Promise(e=>u("leave",e)),()=>{delete r.__leave};i(()=>{const e=!!t();if(c)return c=!1,r.style.display=e?"":"none",void(e&&s?.appear&&u("enter"));e?(r.style.display="",u("enter")):u("leave",()=>{r.style.display="none"})})})},Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).LiteVueTransition={})}(this,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});var t=e=>(parseFloat(e)||0)*(e.includes("ms")?1:1e3),i=(e,i)=>{const n=e.split(","),o=i.split(",");let a=0;for(let r=0;r<n.length;r++)a=Math.max(a,t(n[r])+t(o[r%o.length]));return a};e.transition=e=>{e.directive("transition",({el:e,get:t,effect:n,arg:o,modifiers:a,exp:r})=>{const s=e,l=o||"v",f=e=>`${l}-${e}`;let d,c=0,m=!0;const u=()=>{s.classList.remove(f("enter-from"),f("enter-active"),f("enter-to"),f("leave-from"),f("leave-active"),f("leave-to"))},p=(e,t)=>{const n=++c;u(),s.classList.add(f(e+"-from"),f(e+"-active")),s.offsetWidth,s.classList.remove(f(e+"-from")),s.classList.add(f(e+"-to")),clearTimeout(d),d=setTimeout(()=>{n===c&&(u(),t&&t())},(e=>{const t=getComputedStyle(e);return Math.max(i(t.transitionDuration,t.transitionDelay),i(t.animationDuration,t.animationDelay))})(s))};if(!r){let e=!0;return Promise.resolve().then(()=>{e&&p("enter")}),s.__leave=()=>new Promise(e=>p("leave",e)),()=>{e=!1,clearTimeout(d),delete s.__leave}}return n(()=>{const e=!!t();if(m)return m=!1,s.style.display=e?"":"none",void(e&&a?.appear&&p("enter"));e?(s.style.display="",p("enter")):p("leave",()=>{s.style.display="none"})}),()=>clearTimeout(d)})}});
@@ -6,6 +6,16 @@ export interface App {
6
6
  */
7
7
  scope: Record<string, any>;
8
8
  directive(name: string, def?: Directive): any;
9
+ /**
10
+ * Register a component — a function returning a scope object, used from
11
+ * `v-scope="Name()"` — or retrieve one by name.
12
+ *
13
+ * Components have always been plain functions reachable from an expression;
14
+ * this gives them a named home, so a plugin can contribute one without
15
+ * reaching into `app.scope`, and so a name can be looked up rather than
16
+ * guessed at.
17
+ */
18
+ component(name: string, factory?: ComponentFactory): any;
9
19
  /**
10
20
  * Install a plugin. A plugin is a function (or object with an install
11
21
  * method) that receives the app and optional options. Installing the same
@@ -19,7 +29,25 @@ export interface App {
19
29
  */
20
30
  unmount(el?: string | Element | null): void;
21
31
  }
22
- export type Plugin<Options = any> = ((app: App, options?: Options) => void) | {
23
- install(app: App, options?: Options): void;
32
+ /**
33
+ * A plugin may return a teardown function, which runs when the app is fully
34
+ * unmounted. Returning nothing is still valid, so existing plugins are
35
+ * unaffected.
36
+ *
37
+ * The shape matches directives, which already return their cleanup. Without
38
+ * it a plugin could acquire page-wide resources — observers, listeners,
39
+ * matchMedia subscriptions — and had no way to give them back: the media
40
+ * plugin held five MediaQueryList subscriptions for the life of the page
41
+ * whether or not any app was still running.
42
+ */
43
+ export type PluginTeardown = () => void;
44
+ /**
45
+ * A component factory. Called from an expression — `v-scope="Counter({ n: 1 })"`
46
+ * — and returns the scope object for that region. Props are whatever the
47
+ * expression passes.
48
+ */
49
+ export type ComponentFactory = (...props: any[]) => Record<string, any>;
50
+ export type Plugin<Options = any> = ((app: App, options?: Options) => PluginTeardown | void) | {
51
+ install(app: App, options?: Options): PluginTeardown | void;
24
52
  };
25
53
  export declare const createApp: (initialData?: any) => App;
@@ -6,6 +6,16 @@ export interface App {
6
6
  */
7
7
  scope: Record<string, any>;
8
8
  directive(name: string, def?: Directive): any;
9
+ /**
10
+ * Register a component — a function returning a scope object, used from
11
+ * `v-scope="Name()"` — or retrieve one by name.
12
+ *
13
+ * Components have always been plain functions reachable from an expression;
14
+ * this gives them a named home, so a plugin can contribute one without
15
+ * reaching into `app.scope`, and so a name can be looked up rather than
16
+ * guessed at.
17
+ */
18
+ component(name: string, factory?: ComponentFactory): any;
9
19
  /**
10
20
  * Install a plugin. A plugin is a function (or object with an install
11
21
  * method) that receives the app and optional options. Installing the same
@@ -19,7 +29,25 @@ export interface App {
19
29
  */
20
30
  unmount(el?: string | Element | null): void;
21
31
  }
22
- export type Plugin<Options = any> = ((app: App, options?: Options) => void) | {
23
- install(app: App, options?: Options): void;
32
+ /**
33
+ * A plugin may return a teardown function, which runs when the app is fully
34
+ * unmounted. Returning nothing is still valid, so existing plugins are
35
+ * unaffected.
36
+ *
37
+ * The shape matches directives, which already return their cleanup. Without
38
+ * it a plugin could acquire page-wide resources — observers, listeners,
39
+ * matchMedia subscriptions — and had no way to give them back: the media
40
+ * plugin held five MediaQueryList subscriptions for the life of the page
41
+ * whether or not any app was still running.
42
+ */
43
+ export type PluginTeardown = () => void;
44
+ /**
45
+ * A component factory. Called from an expression — `v-scope="Counter({ n: 1 })"`
46
+ * — and returns the scope object for that region. Props are whatever the
47
+ * expression passes.
48
+ */
49
+ export type ComponentFactory = (...props: any[]) => Record<string, any>;
50
+ export type Plugin<Options = any> = ((app: App, options?: Options) => PluginTeardown | void) | {
51
+ install(app: App, options?: Options): PluginTeardown | void;
24
52
  };
25
53
  export declare const createApp: (initialData?: any) => App;
@@ -7,9 +7,16 @@ export declare class Block {
7
7
  isFragment: boolean;
8
8
  start?: Text;
9
9
  end?: Text;
10
+ owned: boolean;
10
11
  get el(): Element | Text;
11
12
  constructor(template: Element, parentCtx: Context, isRoot?: boolean);
12
13
  insert(parent: Element, anchor?: Node | null): void;
13
14
  remove(): void;
15
+ /**
16
+ * The bookkeeping half of `remove()`, for a block whose nodes are already
17
+ * gone. `remove()` cannot be reused there: its `removeChild` calls would
18
+ * throw on nodes that no longer have this parent.
19
+ */
20
+ discard(): void;
14
21
  teardown(): void;
15
22
  }
@@ -7,9 +7,16 @@ export declare class Block {
7
7
  isFragment: boolean;
8
8
  start?: Text;
9
9
  end?: Text;
10
+ owned: boolean;
10
11
  get el(): Element | Text;
11
12
  constructor(template: Element, parentCtx: Context, isRoot?: boolean);
12
13
  insert(parent: Element, anchor?: Node | null): void;
13
14
  remove(): void;
15
+ /**
16
+ * The bookkeeping half of `remove()`, for a block whose nodes are already
17
+ * gone. `remove()` cannot be reused there: its `removeChild` calls would
18
+ * throw on nodes that no longer have this parent.
19
+ */
20
+ discard(): void;
14
21
  teardown(): void;
15
22
  }
@@ -18,6 +18,13 @@ export interface Context {
18
18
  * reading it here keeps them from importing — and re-bundling — the core.
19
19
  */
20
20
  walk?: (node: Node, ctx: Context) => ChildNode | null | void;
21
+ /**
22
+ * Disposes a node and its subtree. Published on the root context alongside
23
+ * `walk` and inherited by the spreads above, so a plugin that removes nodes
24
+ * — morph does, directly — can release what they owned without importing
25
+ * and re-bundling the core.
26
+ */
27
+ dispose?: (node: Node) => void;
21
28
  }
22
29
  export declare const createContext: (parent?: Context) => Context;
23
30
  export declare const createScopedContext: (ctx: Context, data?: {}) => Context;
@@ -18,6 +18,13 @@ export interface Context {
18
18
  * reading it here keeps them from importing — and re-bundling — the core.
19
19
  */
20
20
  walk?: (node: Node, ctx: Context) => ChildNode | null | void;
21
+ /**
22
+ * Disposes a node and its subtree. Published on the root context alongside
23
+ * `walk` and inherited by the spreads above, so a plugin that removes nodes
24
+ * — morph does, directly — can release what they owned without importing
25
+ * and re-bundling the core.
26
+ */
27
+ dispose?: (node: Node) => void;
21
28
  }
22
29
  export declare const createContext: (parent?: Context) => Context;
23
30
  export declare const createScopedContext: (ctx: Context, data?: {}) => Context;
@@ -1,5 +1,5 @@
1
1
  export { createApp } from './app.mjs';
2
- export type { App, Plugin } from './app.mjs';
2
+ export type { App, ComponentFactory, Plugin } from './app.mjs';
3
3
  export { store } from './store.mjs';
4
4
  export { nextTick } from './scheduler.mjs';
5
5
  export { watchEffect } from './effect.mjs';
@@ -1,5 +1,5 @@
1
1
  export { createApp } from './app';
2
- export type { App, Plugin } from './app';
2
+ export type { App, ComponentFactory, Plugin } from './app';
3
3
  export { store } from './store';
4
4
  export { nextTick } from './scheduler';
5
5
  export { watchEffect } from './effect';