@aevantec/litevue 0.5.4 → 0.5.6

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 (74) hide show
  1. package/README.md +3 -2
  2. package/dist/litevue-devtools.iife.js +1 -1
  3. package/dist/litevue-devtools.mjs +1 -853
  4. package/dist/litevue-devtools.umd.js +1 -1
  5. package/dist/litevue-plugins.iife.js +1 -1
  6. package/dist/litevue-plugins.mjs +1 -717
  7. package/dist/litevue-plugins.umd.js +1 -1
  8. package/dist/litevue.iife.js +1 -12
  9. package/dist/litevue.mjs +1 -1890
  10. package/dist/litevue.umd.js +1 -12
  11. package/dist/plugins/collapse.iife.js +1 -1
  12. package/dist/plugins/collapse.mjs +1 -46
  13. package/dist/plugins/collapse.umd.js +1 -1
  14. package/dist/plugins/focus.iife.js +1 -1
  15. package/dist/plugins/focus.mjs +1 -69
  16. package/dist/plugins/focus.umd.js +1 -1
  17. package/dist/plugins/intersect.iife.js +1 -1
  18. package/dist/plugins/intersect.mjs +1 -20
  19. package/dist/plugins/intersect.umd.js +1 -1
  20. package/dist/plugins/mask.iife.js +1 -1
  21. package/dist/plugins/mask.mjs +1 -37
  22. package/dist/plugins/mask.umd.js +1 -1
  23. package/dist/plugins/media.iife.js +1 -1
  24. package/dist/plugins/media.mjs +1 -204
  25. package/dist/plugins/media.umd.js +1 -1
  26. package/dist/plugins/morph.iife.js +1 -1
  27. package/dist/plugins/morph.mjs +1 -174
  28. package/dist/plugins/morph.umd.js +1 -1
  29. package/dist/plugins/persist.iife.js +1 -1
  30. package/dist/plugins/persist.mjs +1 -86
  31. package/dist/plugins/persist.umd.js +1 -1
  32. package/dist/plugins/resize.iife.js +1 -1
  33. package/dist/plugins/resize.mjs +1 -15
  34. package/dist/plugins/resize.umd.js +1 -1
  35. package/dist/plugins/transition.iife.js +1 -1
  36. package/dist/plugins/transition.mjs +1 -76
  37. package/dist/plugins/transition.umd.js +1 -1
  38. package/dist/types/app.d.mts +20 -2
  39. package/dist/types/app.d.ts +20 -2
  40. package/dist/types/block.d.mts +6 -0
  41. package/dist/types/block.d.ts +6 -0
  42. package/dist/types/context.d.mts +8 -4
  43. package/dist/types/context.d.ts +8 -4
  44. package/dist/types/devtools.d.mts +7 -0
  45. package/dist/types/devtools.d.ts +7 -0
  46. package/dist/types/effect.d.mts +6 -10
  47. package/dist/types/effect.d.ts +6 -10
  48. package/dist/types/index.d.mts +1 -1
  49. package/dist/types/index.d.ts +1 -1
  50. package/dist/types/magics.d.mts +5 -6
  51. package/dist/types/magics.d.ts +5 -6
  52. package/dist/types/ownership.d.mts +23 -0
  53. package/dist/types/ownership.d.ts +23 -0
  54. package/dist/types/plugins/focus/index.d.mts +6 -8
  55. package/dist/types/plugins/focus/index.d.ts +6 -8
  56. package/dist/types/plugins/media/index.d.mts +6 -11
  57. package/dist/types/plugins/media/index.d.ts +6 -11
  58. package/dist/types/plugins/morph/index.d.mts +21 -10
  59. package/dist/types/plugins/morph/index.d.ts +21 -10
  60. package/dist/types/plugins/persist/index.d.mts +12 -19
  61. package/dist/types/plugins/persist/index.d.ts +12 -19
  62. package/dist/types/plugins/resize/index.d.mts +5 -7
  63. package/dist/types/plugins/resize/index.d.ts +5 -7
  64. package/dist/types/plugins/transition/index.d.mts +7 -12
  65. package/dist/types/plugins/transition/index.d.ts +7 -12
  66. package/dist/types/scheduler.d.mts +3 -0
  67. package/dist/types/scheduler.d.ts +3 -0
  68. package/dist/types/store.d.mts +3 -6
  69. package/dist/types/store.d.ts +3 -6
  70. package/dist/types/utils.d.mts +3 -3
  71. package/dist/types/utils.d.ts +3 -3
  72. package/dist/types/warn.d.mts +14 -0
  73. package/dist/types/warn.d.ts +14 -0
  74. package/package.json +16 -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(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});var t=(e,t)=>1===e.nodeType&&(e.hasAttribute("data-morph-preserve")||!!t.preserve?.(e)),n=/^(?:v-|:|@)/,r=/^(?::|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},s=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"),d=(e,t)=>{const o=(e=>{const t=new Set;for(const{name:n}of e.attributes)r.test(n)?t.add(n.replace(r,"").split(".")[0]):"v-model"===n&&(t.add("value"),t.add("checked"));return t})(t);for(const{name:r,value:i}of[...t.attributes])n.test(r)||o.has(r)||e.getAttribute(r)!==i&&e.setAttribute(r,i);for(const{name:n}of[...e.attributes])o.has(n)||t.hasAttribute(n)||e.removeAttribute(n)},a=(e,t,n,r)=>{if(e.nodeType!==t.nodeType)return c(e,t,n,r);if(3===e.nodeType||8===e.nodeType){const r=t.data;if(((e,t)=>e.includes(t?t.delimiters[0]:"{{"))(r,n))return;return void(e.data!==r&&(e.data=r))}if(1!==e.nodeType)return;const o=e,i=t;if(o.tagName!==i.tagName)return c(e,t,n,r);r.skip?.(o,i)||o.hasAttribute("data-morph-skip")||(d(o,i),(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})(i)||f(o,i,o.__ctx||n,r))},c=(e,n,r,o)=>{if(t(e,o))return;const i=n.cloneNode(!0);!1!==o.beforeNodeAdded?.(i)&&(r?.dispose?.(e),e.parentNode.replaceChild(i,e),o.afterNodeRemoved?.(e),u(i,r))},u=(e,t)=>{const n=t||s(e.parentNode);n?.walk?.(e,n)},f=(e,n,r,o)=>{const s=o.key||i,l=new Map;for(let t=e.firstChild;t;t=t.nextSibling)if(1===t.nodeType){const e=s(t);if(null==e)continue;l.set(e,t)}const d=e=>e&&1===e.nodeType?s(e):null;let c=e.firstChild,f=n.firstChild;const p=t=>{const n=t.cloneNode(!0);!1!==o.beforeNodeAdded?.(n)&&(e.insertBefore(n,c),u(n,r))};for(;f;){const t=f.nextSibling,n=d(f);if(null!=n){const t=l.get(n);t?(t===c?c=c.nextSibling:e.insertBefore(t,c),l.delete(n),a(t,f,r,o)):p(f)}else if(c&&null==d(c)){const e=c.nextSibling;a(c,f,r,o),c=e}else p(f);f=t}for(;c;){const n=c.nextSibling;t(c,o)||(r?.dispose?.(c),e.removeChild(c),o.afterNodeRemoved?.(c)),c=n}},p=(e,t,n={})=>{let r;if("string"==typeof t){const n=document.createElement("template");n.innerHTML=t.trim();const o=n.content;r=1===o.childElementCount?o.firstElementChild:(()=>{const t=e.cloneNode(!1);return t.appendChild(o),t})()}else r=t;if(r){const t=h();a(e,r,s(e),n),t()}return e},h=()=>{const e=document.activeElement;if(!e||e===document.body)return()=>{};const t=e;let n=null,r=null;try{n=t.selectionStart,r=t.selectionEnd}catch{}return()=>{if(e!==document.activeElement&&e.isConnected&&(e.focus(),null!==n))try{t.setSelectionRange(n,r)}catch{}}};return e.morph=p,e.morphPlugin=e=>{e.scope.$morph=p},e}({});
@@ -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 e=(e,t)=>1===e.nodeType&&(e.hasAttribute("data-morph-preserve")||!!t.preserve?.(e)),t=/^(?:v-|:|@)/,n=/^(?::|v-bind:)/,r=["id","data-key","data-id"],o=e=>{for(const t of r){const n=e.getAttribute(t);if(null!=n)return t+"="+n}return null},i=e=>{for(let t=e;t;t=t.parentElement)if(t.__ctx)return t.__ctx},s=e=>e.hasAttribute("v-for")||e.hasAttribute("v-if")||e.hasAttribute("v-else")||e.hasAttribute("v-else-if"),l=(e,r)=>{const o=(e=>{const t=/* @__PURE__ */new Set;for(const{name:r}of e.attributes)n.test(r)?t.add(r.replace(n,"").split(".")[0]):"v-model"===r&&(t.add("value"),t.add("checked"));return t})(r);for(const{name:n,value:i}of[...r.attributes])t.test(n)||o.has(n)||e.getAttribute(n)!==i&&e.setAttribute(n,i);for(const{name:t}of[...e.attributes])o.has(t)||r.hasAttribute(t)||e.removeAttribute(t)},d=(e,t,n,r)=>{if(e.nodeType!==t.nodeType)return a(e,t,n,r);if(3===e.nodeType||8===e.nodeType){const r=t.data;if(((e,t)=>e.includes(t?t.delimiters[0]:"{{"))(r,n))return;return void(e.data!==r&&(e.data=r))}if(1!==e.nodeType)return;const o=e,i=t;if(o.tagName!==i.tagName)return a(e,t,n,r);r.skip?.(o,i)||o.hasAttribute("data-morph-skip")||(l(o,i),(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})(i)||u(o,i,o.__ctx||n,r))},a=(t,n,r,o)=>{if(e(t,o))return;const i=n.cloneNode(!0);!1!==o.beforeNodeAdded?.(i)&&(r?.dispose?.(t),t.parentNode.replaceChild(i,t),o.afterNodeRemoved?.(t),c(i,r))},c=(e,t)=>{const n=t||i(e.parentNode);n?.walk?.(e,n)},u=(t,n,r,i)=>{const s=i.key||o,l=/* @__PURE__ */new Map;for(let e=t.firstChild;e;e=e.nextSibling)if(1===e.nodeType){const t=s(e);if(null==t)continue;l.set(t,e)}const a=e=>e&&1===e.nodeType?s(e):null;let u=t.firstChild,f=n.firstChild;const p=e=>{const n=e.cloneNode(!0);!1!==i.beforeNodeAdded?.(n)&&(t.insertBefore(n,u),c(n,r))};for(;f;){const e=f.nextSibling,n=a(f);if(null!=n){const e=l.get(n);e?(e===u?u=u.nextSibling:t.insertBefore(e,u),l.delete(n),d(e,f,r,i)):p(f)}else if(u&&null==a(u)){const e=u.nextSibling;d(u,f,r,i),u=e}else p(f);f=e}for(;u;){const n=u.nextSibling;e(u,i)||(r?.dispose?.(u),t.removeChild(u),i.afterNodeRemoved?.(u)),u=n}},f=(e,t,n={})=>{let r;if("string"==typeof t){const n=document.createElement("template");n.innerHTML=t.trim();const o=n.content;r=1===o.childElementCount?o.firstElementChild:(()=>{const t=e.cloneNode(!1);return t.appendChild(o),t})()}else r=t;if(r){const t=p();d(e,r,i(e),n),t()}return e},p=()=>{const e=document.activeElement;if(!e||e===document.body)return()=>{};const t=e;let n=null,r=null;try{n=t.selectionStart,r=t.selectionEnd}catch{}return()=>{if(e!==document.activeElement&&e.isConnected&&(e.focus(),null!==n))try{t.setSelectionRange(n,r)}catch{}}},h=e=>{e.scope.$morph=f};export{f 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=(e,t)=>1===e.nodeType&&(e.hasAttribute("data-morph-preserve")||!!t.preserve?.(e)),n=/^(?:v-|:|@)/,o=/^(?::|v-bind:)/,r=["id","data-key","data-id"],i=e=>{for(const t of r){const n=e.getAttribute(t);if(null!=n)return t+"="+n}return null},s=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"),d=(e,t)=>{const r=(e=>{const t=new Set;for(const{name:n}of e.attributes)o.test(n)?t.add(n.replace(o,"").split(".")[0]):"v-model"===n&&(t.add("value"),t.add("checked"));return t})(t);for(const{name:o,value:i}of[...t.attributes])n.test(o)||r.has(o)||e.getAttribute(o)!==i&&e.setAttribute(o,i);for(const{name:n}of[...e.attributes])r.has(n)||t.hasAttribute(n)||e.removeAttribute(n)},a=(e,t,n,o)=>{if(e.nodeType!==t.nodeType)return u(e,t,n,o);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 r=e,i=t;if(r.tagName!==i.tagName)return u(e,t,n,o);o.skip?.(r,i)||r.hasAttribute("data-morph-skip")||(d(r,i),(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})(i)||f(r,i,r.__ctx||n,o))},u=(e,n,o,r)=>{if(t(e,r))return;const i=n.cloneNode(!0);!1!==r.beforeNodeAdded?.(i)&&(o?.dispose?.(e),e.parentNode.replaceChild(i,e),r.afterNodeRemoved?.(e),c(i,o))},c=(e,t)=>{const n=t||s(e.parentNode);n?.walk?.(e,n)},f=(e,n,o,r)=>{const s=r.key||i,l=new Map;for(let t=e.firstChild;t;t=t.nextSibling)if(1===t.nodeType){const e=s(t);if(null==e)continue;l.set(e,t)}const d=e=>e&&1===e.nodeType?s(e):null;let u=e.firstChild,f=n.firstChild;const p=t=>{const n=t.cloneNode(!0);!1!==r.beforeNodeAdded?.(n)&&(e.insertBefore(n,u),c(n,o))};for(;f;){const t=f.nextSibling,n=d(f);if(null!=n){const t=l.get(n);t?(t===u?u=u.nextSibling:e.insertBefore(t,u),l.delete(n),a(t,f,o,r)):p(f)}else if(u&&null==d(u)){const e=u.nextSibling;a(u,f,o,r),u=e}else p(f);f=t}for(;u;){const n=u.nextSibling;t(u,r)||(o?.dispose?.(u),e.removeChild(u),r.afterNodeRemoved?.(u)),u=n}},p=(e,t,n={})=>{let o;if("string"==typeof t){const n=document.createElement("template");n.innerHTML=t.trim();const r=n.content;o=1===r.childElementCount?r.firstElementChild:(()=>{const t=e.cloneNode(!1);return t.appendChild(r),t})()}else o=t;if(o){const t=h();a(e,o,s(e),n),t()}return e},h=()=>{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=p,e.morphPlugin=e=>{e.scope.$morph=p}});
@@ -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,12 @@ 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. Gives components a named
12
+ * home, so a plugin can contribute one without reaching into `app.scope`.
13
+ */
14
+ component(name: string, factory?: ComponentFactory): any;
9
15
  /**
10
16
  * Install a plugin. A plugin is a function (or object with an install
11
17
  * method) that receives the app and optional options. Installing the same
@@ -19,7 +25,19 @@ export interface App {
19
25
  */
20
26
  unmount(el?: string | Element | null): void;
21
27
  }
22
- export type Plugin<Options = any> = ((app: App, options?: Options) => void) | {
23
- install(app: App, options?: Options): void;
28
+ /**
29
+ * A plugin may return a teardown function, run on full unmount; returning
30
+ * nothing stays valid. Mirrors directives, which already return their cleanup.
31
+ * Without it, page-wide resources — observers, listeners, matchMedia — could
32
+ * never be given back.
33
+ */
34
+ export type PluginTeardown = () => void;
35
+ /**
36
+ * A component factory. Called from an expression —
37
+ * `v-scope="Counter({ n: 1 })"` — returning that region's scope object.
38
+ */
39
+ export type ComponentFactory = (...props: any[]) => Record<string, any>;
40
+ export type Plugin<Options = any> = ((app: App, options?: Options) => PluginTeardown | void) | {
41
+ install(app: App, options?: Options): PluginTeardown | void;
24
42
  };
25
43
  export declare const createApp: (initialData?: any) => App;
@@ -6,6 +6,12 @@ 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. Gives components a named
12
+ * home, so a plugin can contribute one without reaching into `app.scope`.
13
+ */
14
+ component(name: string, factory?: ComponentFactory): any;
9
15
  /**
10
16
  * Install a plugin. A plugin is a function (or object with an install
11
17
  * method) that receives the app and optional options. Installing the same
@@ -19,7 +25,19 @@ export interface App {
19
25
  */
20
26
  unmount(el?: string | Element | null): void;
21
27
  }
22
- export type Plugin<Options = any> = ((app: App, options?: Options) => void) | {
23
- install(app: App, options?: Options): void;
28
+ /**
29
+ * A plugin may return a teardown function, run on full unmount; returning
30
+ * nothing stays valid. Mirrors directives, which already return their cleanup.
31
+ * Without it, page-wide resources — observers, listeners, matchMedia — could
32
+ * never be given back.
33
+ */
34
+ export type PluginTeardown = () => void;
35
+ /**
36
+ * A component factory. Called from an expression —
37
+ * `v-scope="Counter({ n: 1 })"` — returning that region's scope object.
38
+ */
39
+ export type ComponentFactory = (...props: any[]) => Record<string, any>;
40
+ export type Plugin<Options = any> = ((app: App, options?: Options) => PluginTeardown | void) | {
41
+ install(app: App, options?: Options): PluginTeardown | void;
24
42
  };
25
43
  export declare const createApp: (initialData?: any) => App;
@@ -7,9 +7,15 @@ 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()`'s `removeChild` calls would throw on them.
18
+ */
19
+ discard(): void;
14
20
  teardown(): void;
15
21
  }
@@ -7,9 +7,15 @@ 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()`'s `removeChild` calls would throw on them.
18
+ */
19
+ discard(): void;
14
20
  teardown(): void;
15
21
  }
@@ -12,12 +12,16 @@ export interface Context {
12
12
  delimiters: [string, string];
13
13
  delimitersRE: RegExp;
14
14
  /**
15
- * The framework walker, published on the root context by `mount()` and
16
- * inherited by every child context through the spreads below. Plugins that
17
- * insert markup into a live tree (morph) need it to bind that markup, and
18
- * reading it here keeps them from importing — and re-bundling — the core.
15
+ * The framework walker, published by `mount()` and inherited by every child
16
+ * context. Plugins that insert markup into a live tree (morph) bind it with
17
+ * this instead of importing — and re-bundling — the core.
19
18
  */
20
19
  walk?: (node: Node, ctx: Context) => ChildNode | null | void;
20
+ /**
21
+ * Disposes a node and its subtree. Published alongside `walk`, so a plugin
22
+ * that removes nodes directly can release what they owned.
23
+ */
24
+ dispose?: (node: Node) => void;
21
25
  }
22
26
  export declare const createContext: (parent?: Context) => Context;
23
27
  export declare const createScopedContext: (ctx: Context, data?: {}) => Context;
@@ -12,12 +12,16 @@ export interface Context {
12
12
  delimiters: [string, string];
13
13
  delimitersRE: RegExp;
14
14
  /**
15
- * The framework walker, published on the root context by `mount()` and
16
- * inherited by every child context through the spreads below. Plugins that
17
- * insert markup into a live tree (morph) need it to bind that markup, and
18
- * reading it here keeps them from importing — and re-bundling — the core.
15
+ * The framework walker, published by `mount()` and inherited by every child
16
+ * context. Plugins that insert markup into a live tree (morph) bind it with
17
+ * this instead of importing — and re-bundling — the core.
19
18
  */
20
19
  walk?: (node: Node, ctx: Context) => ChildNode | null | void;
20
+ /**
21
+ * Disposes a node and its subtree. Published alongside `walk`, so a plugin
22
+ * that removes nodes directly can release what they owned.
23
+ */
24
+ dispose?: (node: Node) => void;
21
25
  }
22
26
  export declare const createContext: (parent?: Context) => Context;
23
27
  export declare const createScopedContext: (ctx: Context, data?: {}) => Context;