@ramstack/alpinegear-main 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/alpinegear-main.esm.js +22 -9
- package/alpinegear-main.esm.min.js +1 -1
- package/alpinegear-main.js +22 -9
- package/alpinegear-main.min.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@ To include the CDN version of this plugin, add the following `<script>` tag befo
|
|
|
11
11
|
|
|
12
12
|
```html
|
|
13
13
|
<!-- alpine.js plugin -->
|
|
14
|
-
<script src="https://cdn.jsdelivr.net/npm/@ramstack/alpinegear-main@1/
|
|
14
|
+
<script src="https://cdn.jsdelivr.net/npm/@ramstack/alpinegear-main@1/alpinegear-main.min.js" defer></script>
|
|
15
15
|
|
|
16
16
|
<!-- alpine.js -->
|
|
17
17
|
<script src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js" defer></script>
|
package/alpinegear-main.esm.js
CHANGED
|
@@ -38,10 +38,10 @@ function has_setter(value) {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
const key = Symbol();
|
|
41
|
-
let
|
|
41
|
+
let observer;
|
|
42
42
|
|
|
43
43
|
function observe_resize(el, listener) {
|
|
44
|
-
|
|
44
|
+
observer ??= new ResizeObserver(entries => {
|
|
45
45
|
for (const e of entries) {
|
|
46
46
|
for (const callback of e.target[key]?.values() ?? []) {
|
|
47
47
|
callback(e);
|
|
@@ -52,19 +52,19 @@ function observe_resize(el, listener) {
|
|
|
52
52
|
el[key] ??= new Set();
|
|
53
53
|
el[key].add(listener);
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
observer.observe(el);
|
|
56
56
|
|
|
57
57
|
return () => {
|
|
58
58
|
el[key].delete(listener);
|
|
59
59
|
|
|
60
60
|
if (!el[key].size) {
|
|
61
|
-
|
|
61
|
+
observer.unobserve(el);
|
|
62
62
|
el[key] = null;
|
|
63
63
|
}
|
|
64
64
|
};
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
const warn = (...args) => console.warn("
|
|
67
|
+
const warn = (...args) => console.warn("alpinegear.js:", ...args);
|
|
68
68
|
const is_array = Array.isArray;
|
|
69
69
|
const is_nullish = value => value === null || value === undefined;
|
|
70
70
|
const is_checkable_input = el => el.type === "checkbox" || el.type === "radio";
|
|
@@ -143,6 +143,7 @@ const canonical_names = create_map(
|
|
|
143
143
|
"videoHeight,videoWidth," +
|
|
144
144
|
"naturalHeight,naturalWidth," +
|
|
145
145
|
"clientHeight,clientWidth,offsetHeight,offsetWidth," +
|
|
146
|
+
"indeterminate," +
|
|
146
147
|
"open," +
|
|
147
148
|
"group");
|
|
148
149
|
|
|
@@ -219,6 +220,10 @@ function plugin$5({ directive, entangle, evaluateLater, mapAttributes, mutateDom
|
|
|
219
220
|
process_dimensions();
|
|
220
221
|
break;
|
|
221
222
|
|
|
223
|
+
case "indeterminate":
|
|
224
|
+
process_indeterminate();
|
|
225
|
+
break;
|
|
226
|
+
|
|
222
227
|
case "open":
|
|
223
228
|
process_details();
|
|
224
229
|
break;
|
|
@@ -249,12 +254,12 @@ function plugin$5({ directive, entangle, evaluateLater, mapAttributes, mutateDom
|
|
|
249
254
|
|
|
250
255
|
const source = {
|
|
251
256
|
get: create_getter(evaluateLater, source_el, expression),
|
|
252
|
-
set: create_setter(evaluateLater, source_el, expression)
|
|
257
|
+
set: create_setter(evaluateLater, source_el, expression)
|
|
253
258
|
};
|
|
254
259
|
|
|
255
260
|
const target = {
|
|
256
261
|
get: create_getter(evaluateLater, el, value),
|
|
257
|
-
set: create_setter(evaluateLater, el, value)
|
|
262
|
+
set: create_setter(evaluateLater, el, value)
|
|
258
263
|
};
|
|
259
264
|
|
|
260
265
|
switch (modifier) {
|
|
@@ -292,14 +297,14 @@ function plugin$5({ directive, entangle, evaluateLater, mapAttributes, mutateDom
|
|
|
292
297
|
|
|
293
298
|
|
|
294
299
|
|
|
295
|
-
|
|
300
|
+
setTimeout(() => {
|
|
296
301
|
|
|
297
302
|
|
|
298
303
|
is_nullish(get_value()) && update_variable();
|
|
299
304
|
|
|
300
305
|
effect(() => apply_select_values(el, as_array(get_value() ?? [])));
|
|
301
306
|
cleanup(listen(el, "change", () => set_value(collect_selected_values(el))));
|
|
302
|
-
});
|
|
307
|
+
}, 0);
|
|
303
308
|
|
|
304
309
|
processed = true;
|
|
305
310
|
break;
|
|
@@ -314,6 +319,14 @@ function plugin$5({ directive, entangle, evaluateLater, mapAttributes, mutateDom
|
|
|
314
319
|
}
|
|
315
320
|
}
|
|
316
321
|
|
|
322
|
+
function process_indeterminate() {
|
|
323
|
+
if (el.type === "checkbox") {
|
|
324
|
+
is_nullish(get_value()) && update_variable();
|
|
325
|
+
effect(update_property);
|
|
326
|
+
processed = true;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
|
|
317
330
|
function process_files() {
|
|
318
331
|
if (el.type === "file") {
|
|
319
332
|
cleanup(listen(el, "input", update_variable));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function e(e,...t){const n=e(...t);return()=>{let e;return n(
|
|
1
|
+
function e(e,...t){const n=e(...t);return()=>{let e;return n(t=>e=t),t=e,"function"==typeof t?.get?e.get():e;var t}}function t(e,...t){const n=e(...t);t[t.length-1]=`${t.at(-1)} = __val`;const o=e(...t);return e=>{let t;n(e=>t=e),function(e){return"function"==typeof e?.set}(t)?t.set(e):o(()=>{},{scope:{__val:e}})}}const n=Symbol();let o;const a=(...e)=>console.warn("alpinegear.js:",...e),r=Array.isArray,c=e=>null==e,i=e=>"checkbox"===e.type||"radio"===e.type,l=e=>e instanceof HTMLTemplateElement,u=e=>e.nodeType===Node.ELEMENT_NODE,s=e=>r(e)?e:[e],d=(e,t)=>e==t,f=(e,t)=>e.findIndex(e=>e==t),p=(e,t)=>e.includes(t),m=(e,t,n,o)=>(e.addEventListener(t,n,o),()=>e.removeEventListener(t,n,o)),v=e=>"object"==typeof e?JSON.parse(JSON.stringify(e)):e;function h(e,t,n=null){const{effect:o,release:a}=Alpine;let r,c,i=!1;const l=o(()=>{r=e(),i||(n?.deep&&JSON.stringify(r),c=r),(i||(n?.immediate??1))&&setTimeout(()=>{t(r,c),c=r},0),i=!0});return()=>a(l)}const b=new Map("value,checked,files,innerHTML,innerText,textContent,videoHeight,videoWidth,naturalHeight,naturalWidth,clientHeight,clientWidth,offsetHeight,offsetWidth,indeterminate,open,group".split(",").map(e=>[e.trim().toLowerCase(),e.trim()]));function g({directive:l,entangle:u,evaluateLater:g,mapAttributes:T,mutateDom:_,prefixed:k}){T(e=>({name:e.name.replace(/^&/,k("bound:")),value:e.value})),l("bound",(l,{expression:T,value:k,modifiers:x},{effect:N,cleanup:y})=>{if(!k)return void a("x-bound directive expects the presence of a bound property name");const E=l.tagName.toUpperCase();T=T?.trim();const L=b.get(k.trim().replace("-","").toLowerCase());T||=L;const w=e(g,l,T),S=t(g,l,T),D=()=>d(l[L],w())||_(()=>l[L]=w()),H=()=>S((e=>"number"===e.type||"range"===e.type)(l)?function(e){return""===e?null:+e}(l[L]):l[L]);let A;switch(L){case"value":!function(){switch(E){case"INPUT":case"TEXTAREA":c(w())&&H(),N(D),y(m(l,"input",H)),A=!0;break;case"SELECT":setTimeout(()=>{c(w())&&H(),N(()=>function(e,t){for(const n of e.options)n.selected=f(t,n.value)>=0}(l,s(w()??[]))),y(m(l,"change",()=>S(function(e){return e.multiple?[...e.selectedOptions].map(e=>e.value):e.value}(l))))},0),A=!0}}();break;case"checked":i(l)&&(N(D),y(m(l,"change",H)),A=!0);break;case"files":"file"===l.type&&(y(m(l,"input",H)),A=!0);break;case"innerHTML":case"innerText":case"textContent":"true"===l.contentEditable&&(c(w())&&H(),N(D),y(m(l,"input",H)),A=!0);break;case"videoHeight":case"videoWidth":C("VIDEO","resize");break;case"naturalHeight":case"naturalWidth":C("IMG","load");break;case"clientHeight":case"clientWidth":case"offsetHeight":case"offsetWidth":y(function(e,t){return o??=new ResizeObserver(e=>{for(const t of e)for(const e of t.target[n]?.values()??[])e(t)}),e[n]??=new Set,e[n].add(t),o.observe(e),()=>{e[n].delete(t),e[n].size||(o.unobserve(e),e[n]=null)}}(l,H)),A=!0;break;case"indeterminate":"checkbox"===l.type&&(c(w())&&H(),N(D),A=!0);break;case"open":"DETAILS"===E&&(c(w())&&H(),N(D),y(m(l,"toggle",H)),A=!0);break;case"group":i(l)&&(l.name||_(()=>l.name=T),N(()=>_(()=>function(e,t){e.checked=r(t)?f(t,e.value)>=0:d(e.value,t)}(l,w()??[]))),y(m(l,"input",()=>S(function(e,t){if("radio"===e.type)return e.value;t=s(t);const n=f(t,e.value);return e.checked?n>=0||t.push(e.value):n>=0&&t.splice(n,1),t}(l,w())))),A=!0)}if(!A){const n=p(x,"in")?"in":p(x,"out")?"out":"inout",o=T===k?((e,t)=>{for(;e&&!t(e);)e=(e._x_teleportBack??e).parentElement;return e})(l.parentNode,e=>e._x_dataStack):l;if(!l._x_dataStack)return void a("x-bound directive requires the presence of the x-data directive to bind component properties");if(!o)return void a(`x-bound directive cannot find the parent scope where the '${k}' property is defined`);const r={get:e(g,o,T),set:t(g,o,T)},c={get:e(g,l,k),set:t(g,l,k)};switch(n){case"in":y(h(()=>r.get(),e=>c.set(v(e))));break;case"out":y(h(()=>c.get(),e=>r.set(v(e))));break;default:y(u(r,c))}}function C(e,t){E===e&&(H(),y(m(l,t,H)),A=!0)}})}function T({directive:t,evaluateLater:n,mutateDom:o}){t("format",(t,{modifiers:a},{effect:r})=>{const c=/{{(?<expr>.+?)}}/g,i=p(a,"once");function l(e){i?o(()=>e()):r(()=>o(()=>e()))}!function t(a){switch(a.nodeType){case Node.TEXT_NODE:!function(t){const a=t.textContent.split(c);if(a.length>1){const r=new DocumentFragment;for(let o=0;a.length>o;o++)if(o%2==0)r.appendChild(document.createTextNode(a[o]));else{const c=e(n,t.parentNode,a[o]),i=document.createTextNode("");r.append(i),l(()=>i.textContent=c())}o(()=>t.parentElement.replaceChild(r,t))}}(a);break;case Node.ELEMENT_NODE:!function(e){for(let n of e.childNodes)t(n)}(a),function(t){for(let o of t.attributes)if([...o.value.matchAll(c)].length){const a=o.value;l(()=>o.value=a.replace(c,(o,a)=>e(n,t,a)()))}}(a)}}(t)})}function _(e,t,{addScopeToNode:n,cleanup:o,initTree:a,mutateDom:r,scope:c={}}){if(e._r_block)return;document.body._r_block??=(()=>{const e=new MutationObserver(e=>{for(let t of e)for(let e of t.addedNodes)e._r_block?.update()});return e.observe(document.body,{childList:!0,subtree:!0}),e})();let i=l(t)?[...t.content.cloneNode(!0).childNodes]:[t.cloneNode(!0)];r(()=>{for(let t of i)u(t)&&n(t,c,e),e.parentElement.insertBefore(t,e),u(t)&&a(t)}),e._r_block={template:t,update(){r(()=>{for(let t of i??[])e.parentElement.insertBefore(t,e)})},delete(){e._r_block=null;for(let e of i??[])e.remove();i=null}},o(()=>e._r_block?.delete())}function k({addScopeToNode:e,directive:t,initTree:n,mutateDom:o}){t("fragment",(t,{},{cleanup:r})=>{l(t)?_(t,t,{addScopeToNode:e,cleanup:r,initTree:n,mutateDom:o}):a("x-fragment can only be used on a 'template' tag")})}function x({addScopeToNode:t,directive:n,initTree:o,mutateDom:r}){n("match",(n,{},{cleanup:c,effect:i,evaluateLater:u})=>{if(!l(n))return void a("x-match can only be used on a 'template' tag");const s=[];for(let t of n.content.children){const n=t.getAttribute("x-case");null!==n?s.push({el:t,get_value:e(u,n)}):t.hasAttribute("x-default")&&s.push({el:t,get_value:()=>!0,default:!0})}const d=()=>n._r_block?.delete();i(()=>{let e;for(let t of s)t.get_value()&&!e&&(e=t);var a;e?(a=e,n._r_block?.template!==a.el&&(d(),_(n,a.el,{addScopeToNode:t,cleanup:c,initTree:o,mutateDom:r}))):d()})})}function N(e){e.directive("template",(e,{expression:t})=>{if(l(e))return void a("x-template cannot be used on a 'template' tag");const n=document.getElementById(t);l(n)?queueMicrotask(()=>{e.innerHTML="",e.append(n.content.cloneNode(!0))}):a("x-template directive can only reference the template tag")})}function y({addScopeToNode:t,directive:n,initTree:o,mutateDom:r}){n("when",(n,{expression:c},{cleanup:i,effect:u,evaluateLater:s})=>{if(!l(n))return void a("x-when can only be used on a 'template' tag");const d=e(s,c);u(()=>d()?_(n,n,{addScopeToNode:t,cleanup:i,initTree:o,mutateDom:r}):n._r_block?.delete())})}export{g as bound,T as format,k as fragment,x as match,N as template,y as when};
|
package/alpinegear-main.js
CHANGED
|
@@ -41,10 +41,10 @@
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
const key = Symbol();
|
|
44
|
-
let
|
|
44
|
+
let observer;
|
|
45
45
|
|
|
46
46
|
function observe_resize(el, listener) {
|
|
47
|
-
|
|
47
|
+
observer ??= new ResizeObserver(entries => {
|
|
48
48
|
for (const e of entries) {
|
|
49
49
|
for (const callback of e.target[key]?.values() ?? []) {
|
|
50
50
|
callback(e);
|
|
@@ -55,19 +55,19 @@
|
|
|
55
55
|
el[key] ??= new Set();
|
|
56
56
|
el[key].add(listener);
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
observer.observe(el);
|
|
59
59
|
|
|
60
60
|
return () => {
|
|
61
61
|
el[key].delete(listener);
|
|
62
62
|
|
|
63
63
|
if (!el[key].size) {
|
|
64
|
-
|
|
64
|
+
observer.unobserve(el);
|
|
65
65
|
el[key] = null;
|
|
66
66
|
}
|
|
67
67
|
};
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
const warn = (...args) => console.warn("
|
|
70
|
+
const warn = (...args) => console.warn("alpinegear.js:", ...args);
|
|
71
71
|
const is_array = Array.isArray;
|
|
72
72
|
const is_nullish = value => value === null || value === undefined;
|
|
73
73
|
const is_checkable_input = el => el.type === "checkbox" || el.type === "radio";
|
|
@@ -146,6 +146,7 @@
|
|
|
146
146
|
"videoHeight,videoWidth," +
|
|
147
147
|
"naturalHeight,naturalWidth," +
|
|
148
148
|
"clientHeight,clientWidth,offsetHeight,offsetWidth," +
|
|
149
|
+
"indeterminate," +
|
|
149
150
|
"open," +
|
|
150
151
|
"group");
|
|
151
152
|
|
|
@@ -222,6 +223,10 @@
|
|
|
222
223
|
process_dimensions();
|
|
223
224
|
break;
|
|
224
225
|
|
|
226
|
+
case "indeterminate":
|
|
227
|
+
process_indeterminate();
|
|
228
|
+
break;
|
|
229
|
+
|
|
225
230
|
case "open":
|
|
226
231
|
process_details();
|
|
227
232
|
break;
|
|
@@ -252,12 +257,12 @@
|
|
|
252
257
|
|
|
253
258
|
const source = {
|
|
254
259
|
get: create_getter(evaluateLater, source_el, expression),
|
|
255
|
-
set: create_setter(evaluateLater, source_el, expression)
|
|
260
|
+
set: create_setter(evaluateLater, source_el, expression)
|
|
256
261
|
};
|
|
257
262
|
|
|
258
263
|
const target = {
|
|
259
264
|
get: create_getter(evaluateLater, el, value),
|
|
260
|
-
set: create_setter(evaluateLater, el, value)
|
|
265
|
+
set: create_setter(evaluateLater, el, value)
|
|
261
266
|
};
|
|
262
267
|
|
|
263
268
|
switch (modifier) {
|
|
@@ -295,14 +300,14 @@
|
|
|
295
300
|
|
|
296
301
|
|
|
297
302
|
|
|
298
|
-
|
|
303
|
+
setTimeout(() => {
|
|
299
304
|
|
|
300
305
|
|
|
301
306
|
is_nullish(get_value()) && update_variable();
|
|
302
307
|
|
|
303
308
|
effect(() => apply_select_values(el, as_array(get_value() ?? [])));
|
|
304
309
|
cleanup(listen(el, "change", () => set_value(collect_selected_values(el))));
|
|
305
|
-
});
|
|
310
|
+
}, 0);
|
|
306
311
|
|
|
307
312
|
processed = true;
|
|
308
313
|
break;
|
|
@@ -317,6 +322,14 @@
|
|
|
317
322
|
}
|
|
318
323
|
}
|
|
319
324
|
|
|
325
|
+
function process_indeterminate() {
|
|
326
|
+
if (el.type === "checkbox") {
|
|
327
|
+
is_nullish(get_value()) && update_variable();
|
|
328
|
+
effect(update_property);
|
|
329
|
+
processed = true;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
|
|
320
333
|
function process_files() {
|
|
321
334
|
if (el.type === "file") {
|
|
322
335
|
cleanup(listen(el, "input", update_variable));
|
package/alpinegear-main.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(){"use strict";function e(e,...t){const n=e(...t);return()=>{let e;return n(
|
|
1
|
+
!function(){"use strict";function e(e,...t){const n=e(...t);return()=>{let e;return n(t=>e=t),t=e,"function"==typeof t?.get?e.get():e;var t}}function t(e,...t){const n=e(...t);t[t.length-1]=`${t.at(-1)} = __val`;const o=e(...t);return e=>{let t;n(e=>t=e),function(e){return"function"==typeof e?.set}(t)?t.set(e):o(()=>{},{scope:{__val:e}})}}const n=Symbol();let o;const a=(...e)=>console.warn("alpinegear.js:",...e),i=Array.isArray,c=e=>null==e,r=e=>"checkbox"===e.type||"radio"===e.type,l=e=>e instanceof HTMLTemplateElement,u=e=>e.nodeType===Node.ELEMENT_NODE,s=e=>i(e)?e:[e],d=(e,t)=>e==t,f=(e,t)=>e.findIndex(e=>e==t),p=(e,t)=>e.includes(t),m=(e,t,n,o)=>(e.addEventListener(t,n,o),()=>e.removeEventListener(t,n,o)),v=e=>"object"==typeof e?JSON.parse(JSON.stringify(e)):e;function h(e,t,n=null){const{effect:o,release:a}=Alpine;let i,c,r=!1;const l=o(()=>{i=e(),r||(n?.deep&&JSON.stringify(i),c=i),(r||(n?.immediate??1))&&setTimeout(()=>{t(i,c),c=i},0),r=!0});return()=>a(l)}const b=new Map("value,checked,files,innerHTML,innerText,textContent,videoHeight,videoWidth,naturalHeight,naturalWidth,clientHeight,clientWidth,offsetHeight,offsetWidth,indeterminate,open,group".split(",").map(e=>[e.trim().toLowerCase(),e.trim()]));function g(e,t,{addScopeToNode:n,cleanup:o,initTree:a,mutateDom:i,scope:c={}}){if(e._r_block)return;document.body._r_block??=(()=>{const e=new MutationObserver(e=>{for(let t of e)for(let e of t.addedNodes)e._r_block?.update()});return e.observe(document.body,{childList:!0,subtree:!0}),e})();let r=l(t)?[...t.content.cloneNode(!0).childNodes]:[t.cloneNode(!0)];i(()=>{for(let t of r)u(t)&&n(t,c,e),e.parentElement.insertBefore(t,e),u(t)&&a(t)}),e._r_block={template:t,update(){i(()=>{for(let t of r??[])e.parentElement.insertBefore(t,e)})},delete(){e._r_block=null;for(let e of r??[])e.remove();r=null}},o(()=>e._r_block?.delete())}function T(u){(function({directive:l,entangle:u,evaluateLater:g,mapAttributes:T,mutateDom:_,prefixed:k}){T(e=>({name:e.name.replace(/^&/,k("bound:")),value:e.value})),l("bound",(l,{expression:T,value:k,modifiers:x},{effect:N,cleanup:y})=>{if(!k)return void a("x-bound directive expects the presence of a bound property name");const E=l.tagName.toUpperCase();T=T?.trim();const L=b.get(k.trim().replace("-","").toLowerCase());T||=L;const S=e(g,l,T),w=t(g,l,T),D=()=>d(l[L],S())||_(()=>l[L]=S()),H=()=>w((e=>"number"===e.type||"range"===e.type)(l)?function(e){return""===e?null:+e}(l[L]):l[L]);let A;switch(L){case"value":!function(){switch(E){case"INPUT":case"TEXTAREA":c(S())&&H(),N(D),y(m(l,"input",H)),A=!0;break;case"SELECT":setTimeout(()=>{c(S())&&H(),N(()=>function(e,t){for(const n of e.options)n.selected=f(t,n.value)>=0}(l,s(S()??[]))),y(m(l,"change",()=>w(function(e){return e.multiple?[...e.selectedOptions].map(e=>e.value):e.value}(l))))},0),A=!0}}();break;case"checked":r(l)&&(N(D),y(m(l,"change",H)),A=!0);break;case"files":"file"===l.type&&(y(m(l,"input",H)),A=!0);break;case"innerHTML":case"innerText":case"textContent":"true"===l.contentEditable&&(c(S())&&H(),N(D),y(m(l,"input",H)),A=!0);break;case"videoHeight":case"videoWidth":C("VIDEO","resize");break;case"naturalHeight":case"naturalWidth":C("IMG","load");break;case"clientHeight":case"clientWidth":case"offsetHeight":case"offsetWidth":y(function(e,t){return o??=new ResizeObserver(e=>{for(const t of e)for(const e of t.target[n]?.values()??[])e(t)}),e[n]??=new Set,e[n].add(t),o.observe(e),()=>{e[n].delete(t),e[n].size||(o.unobserve(e),e[n]=null)}}(l,H)),A=!0;break;case"indeterminate":"checkbox"===l.type&&(c(S())&&H(),N(D),A=!0);break;case"open":"DETAILS"===E&&(c(S())&&H(),N(D),y(m(l,"toggle",H)),A=!0);break;case"group":r(l)&&(l.name||_(()=>l.name=T),N(()=>_(()=>function(e,t){e.checked=i(t)?f(t,e.value)>=0:d(e.value,t)}(l,S()??[]))),y(m(l,"input",()=>w(function(e,t){if("radio"===e.type)return e.value;t=s(t);const n=f(t,e.value);return e.checked?n>=0||t.push(e.value):n>=0&&t.splice(n,1),t}(l,S())))),A=!0)}if(!A){const n=p(x,"in")?"in":p(x,"out")?"out":"inout",o=T===k?((e,t)=>{for(;e&&!t(e);)e=(e._x_teleportBack??e).parentElement;return e})(l.parentNode,e=>e._x_dataStack):l;if(!l._x_dataStack)return void a("x-bound directive requires the presence of the x-data directive to bind component properties");if(!o)return void a(`x-bound directive cannot find the parent scope where the '${k}' property is defined`);const i={get:e(g,o,T),set:t(g,o,T)},c={get:e(g,l,k),set:t(g,l,k)};switch(n){case"in":y(h(()=>i.get(),e=>c.set(v(e))));break;case"out":y(h(()=>c.get(),e=>i.set(v(e))));break;default:y(u(i,c))}}function C(e,t){E===e&&(H(),y(m(l,t,H)),A=!0)}})})(u),function({directive:t,evaluateLater:n,mutateDom:o}){t("format",(t,{modifiers:a},{effect:i})=>{const c=/{{(?<expr>.+?)}}/g,r=p(a,"once");function l(e){r?o(()=>e()):i(()=>o(()=>e()))}!function t(a){switch(a.nodeType){case Node.TEXT_NODE:!function(t){const a=t.textContent.split(c);if(a.length>1){const i=new DocumentFragment;for(let o=0;a.length>o;o++)if(o%2==0)i.appendChild(document.createTextNode(a[o]));else{const c=e(n,t.parentNode,a[o]),r=document.createTextNode("");i.append(r),l(()=>r.textContent=c())}o(()=>t.parentElement.replaceChild(i,t))}}(a);break;case Node.ELEMENT_NODE:!function(e){for(let n of e.childNodes)t(n)}(a),function(t){for(let o of t.attributes)if([...o.value.matchAll(c)].length){const a=o.value;l(()=>o.value=a.replace(c,(o,a)=>e(n,t,a)()))}}(a)}}(t)})}(u),function({addScopeToNode:e,directive:t,initTree:n,mutateDom:o}){t("fragment",(t,{},{cleanup:i})=>{l(t)?g(t,t,{addScopeToNode:e,cleanup:i,initTree:n,mutateDom:o}):a("x-fragment can only be used on a 'template' tag")})}(u),function({addScopeToNode:t,directive:n,initTree:o,mutateDom:i}){n("match",(n,{},{cleanup:c,effect:r,evaluateLater:u})=>{if(!l(n))return void a("x-match can only be used on a 'template' tag");const s=[];for(let t of n.content.children){const n=t.getAttribute("x-case");null!==n?s.push({el:t,get_value:e(u,n)}):t.hasAttribute("x-default")&&s.push({el:t,get_value:()=>!0,default:!0})}const d=()=>n._r_block?.delete();r(()=>{let e;for(let t of s)t.get_value()&&!e&&(e=t);var a;e?(a=e,n._r_block?.template!==a.el&&(d(),g(n,a.el,{addScopeToNode:t,cleanup:c,initTree:o,mutateDom:i}))):d()})})}(u),function(e){e.directive("template",(e,{expression:t})=>{if(l(e))return void a("x-template cannot be used on a 'template' tag");const n=document.getElementById(t);l(n)?queueMicrotask(()=>{e.innerHTML="",e.append(n.content.cloneNode(!0))}):a("x-template directive can only reference the template tag")})}(u),function({addScopeToNode:t,directive:n,initTree:o,mutateDom:i}){n("when",(n,{expression:c},{cleanup:r,effect:u,evaluateLater:s})=>{if(!l(n))return void a("x-when can only be used on a 'template' tag");const d=e(s,c);u(()=>d()?g(n,n,{addScopeToNode:t,cleanup:r,initTree:o,mutateDom:i}):n._r_block?.delete())})}(u)}document.addEventListener("alpine:init",()=>{Alpine.plugin(T)})}();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ramstack/alpinegear-main",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "@ramstack/alpinegear-main is a combined plugin that includes several Alpine.js directives, providing a convenient all-in-one package.",
|
|
5
5
|
"author": "Rameel Burhan",
|
|
6
6
|
"license": "MIT",
|