@ramstack/alpinegear-when 1.2.4 → 1.4.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 CHANGED
@@ -130,6 +130,11 @@ Provides the `x-hotkey` directive, which allows you to easily handle keyboard sh
130
130
  **[@ramstack/alpinegear-router](https://www.npmjs.com/package/@ramstack/alpinegear-router)** ([README](https://github.com/rameel/ramstack.alpinegear.js/tree/main/src/plugins/router))<br>
131
131
  Provides the `x-router` and `x-route` directives, which enable client-side navigation and routing functionality within your Alpine.js application.
132
132
 
133
+ **[@ramstack/alpinegear-dialog](https://www.npmjs.com/package/@ramstack/alpinegear-dialog)** ([README](https://github.com/rameel/ramstack.alpinegear.js/tree/main/src/plugins/dialog))<br>
134
+ Provides a headless dialog directive for Alpine.js based on the native HTML `<dialog>` element.
135
+ It supports declarative composition, value-based close semantics, and both modal and non-modal dialogs,
136
+ with optional Promise-based imperative control.
137
+
133
138
 
134
139
  ## Contributions
135
140
  Bug reports and contributions are welcome.
@@ -1,5 +1,5 @@
1
1
  const warn = (...args) => console.warn("alpinegear.js:", ...args);
2
- const is_template = el => el instanceof HTMLTemplateElement;
2
+ const is_template = el => el.matches("template");
3
3
  const is_element = el => el.nodeType === Node.ELEMENT_NODE;
4
4
 
5
5
  function anchor_block(el, template, { addScopeToNode, cleanup, initTree, mutateDom, scope = {} }) {
@@ -85,4 +85,4 @@ function plugin({ addScopeToNode, directive, initTree, mutateDom }) {
85
85
  });
86
86
  }
87
87
 
88
- export { plugin as when };
88
+ export { plugin as when };
@@ -1 +1 @@
1
- const e=e=>e instanceof HTMLTemplateElement,o=e=>e.nodeType===Node.ELEMENT_NODE;function t({addScopeToNode:t,directive:n,initTree:r,mutateDom:l}){n("when",(n,{expression:c},{cleanup:d,effect:a,evaluateLater:u})=>{if(!e(n))return void console.warn("alpinegear.js:","x-when can only be used on a 'template' tag");const i=function(e,...o){const t=e(...o);return()=>{let e;return t(o=>e=o),o=e,"function"==typeof o?.get?e.get():e;var o}}(u,c);a(()=>i()?function(t,n,{addScopeToNode:r,cleanup:l,initTree:c,mutateDom:d,scope:a={}}){if(t._r_block)return;document.body._r_block??=(()=>{const e=new MutationObserver(e=>{for(let o of e)for(let e of o.addedNodes)e._r_block?.update()});return e.observe(document.body,{childList:!0,subtree:!0}),e})();let u=e(n)?[...n.content.cloneNode(!0).childNodes]:[n.cloneNode(!0)];d(()=>{for(let e of u)o(e)&&r(e,a,t),t.parentElement.insertBefore(e,t),o(e)&&c(e)}),t._r_block={template:n,update(){d(()=>{for(let e of u??[])t.parentElement.insertBefore(e,t)})},delete(){t._r_block=null;for(let e of u??[])e.remove();u=null}},l(()=>t._r_block?.delete())}(n,n,{addScopeToNode:t,cleanup:d,initTree:r,mutateDom:l}):n._r_block?.delete())})}export{t as when};
1
+ const e=e=>e.matches("template"),o=e=>e.nodeType===Node.ELEMENT_NODE;function t({addScopeToNode:t,directive:n,initTree:r,mutateDom:l}){n("when",(n,{expression:c},{cleanup:d,effect:a,evaluateLater:u})=>{if(!e(n))return void console.warn("alpinegear.js:","x-when can only be used on a 'template' tag");const i=function(e,...o){const t=e(...o);return()=>{let e;return t(o=>e=o),o=e,"function"==typeof o?.get?e.get():e;var o}}(u,c);a(()=>i()?function(t,n,{addScopeToNode:r,cleanup:l,initTree:c,mutateDom:d,scope:a={}}){if(t._r_block)return;document.body._r_block??=(()=>{const e=new MutationObserver(e=>{for(let o of e)for(let e of o.addedNodes)e._r_block?.update()});return e.observe(document.body,{childList:!0,subtree:!0}),e})();let u=e(n)?[...n.content.cloneNode(!0).childNodes]:[n.cloneNode(!0)];d(()=>{for(let e of u)o(e)&&r(e,a,t),t.parentElement.insertBefore(e,t),o(e)&&c(e)}),t._r_block={template:n,update(){d(()=>{for(let e of u??[])t.parentElement.insertBefore(e,t)})},delete(){t._r_block=null;for(let e of u??[])e.remove();u=null}},l(()=>t._r_block?.delete())}(n,n,{addScopeToNode:t,cleanup:d,initTree:r,mutateDom:l}):n._r_block?.delete())})}export{t as when};
@@ -2,7 +2,7 @@
2
2
  'use strict';
3
3
 
4
4
  const warn = (...args) => console.warn("alpinegear.js:", ...args);
5
- const is_template = el => el instanceof HTMLTemplateElement;
5
+ const is_template = el => el.matches("template");
6
6
  const is_element = el => el.nodeType === Node.ELEMENT_NODE;
7
7
 
8
8
  function anchor_block(el, template, { addScopeToNode, cleanup, initTree, mutateDom, scope = {} }) {
@@ -90,4 +90,4 @@
90
90
 
91
91
  document.addEventListener("alpine:init", () => { Alpine.plugin(plugin); });
92
92
 
93
- })();
93
+ })();
@@ -1 +1 @@
1
- !function(){"use strict";const e=e=>e instanceof HTMLTemplateElement,t=e=>e.nodeType===Node.ELEMENT_NODE;function o({addScopeToNode:o,directive:n,initTree:r,mutateDom:l}){n("when",(n,{expression:c},{cleanup:d,effect:i,evaluateLater:a})=>{if(!e(n))return void console.warn("alpinegear.js:","x-when can only be used on a 'template' tag");const u=function(e,...t){const o=e(...t);return()=>{let e;return o(t=>e=t),t=e,"function"==typeof t?.get?e.get():e;var t}}(a,c);i(()=>u()?function(o,n,{addScopeToNode:r,cleanup:l,initTree:c,mutateDom:d,scope:i={}}){if(o._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 a=e(n)?[...n.content.cloneNode(!0).childNodes]:[n.cloneNode(!0)];d(()=>{for(let e of a)t(e)&&r(e,i,o),o.parentElement.insertBefore(e,o),t(e)&&c(e)}),o._r_block={template:n,update(){d(()=>{for(let e of a??[])o.parentElement.insertBefore(e,o)})},delete(){o._r_block=null;for(let e of a??[])e.remove();a=null}},l(()=>o._r_block?.delete())}(n,n,{addScopeToNode:o,cleanup:d,initTree:r,mutateDom:l}):n._r_block?.delete())})}document.addEventListener("alpine:init",()=>{Alpine.plugin(o)})}();
1
+ !function(){"use strict";const e=e=>e.matches("template"),t=e=>e.nodeType===Node.ELEMENT_NODE;function o({addScopeToNode:o,directive:n,initTree:r,mutateDom:l}){n("when",(n,{expression:c},{cleanup:d,effect:a,evaluateLater:i})=>{if(!e(n))return void console.warn("alpinegear.js:","x-when can only be used on a 'template' tag");const u=function(e,...t){const o=e(...t);return()=>{let e;return o(t=>e=t),t=e,"function"==typeof t?.get?e.get():e;var t}}(i,c);a(()=>u()?function(o,n,{addScopeToNode:r,cleanup:l,initTree:c,mutateDom:d,scope:a={}}){if(o._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=e(n)?[...n.content.cloneNode(!0).childNodes]:[n.cloneNode(!0)];d(()=>{for(let e of i)t(e)&&r(e,a,o),o.parentElement.insertBefore(e,o),t(e)&&c(e)}),o._r_block={template:n,update(){d(()=>{for(let e of i??[])o.parentElement.insertBefore(e,o)})},delete(){o._r_block=null;for(let e of i??[])e.remove();i=null}},l(()=>o._r_block?.delete())}(n,n,{addScopeToNode:o,cleanup:d,initTree:r,mutateDom:l}):n._r_block?.delete())})}document.addEventListener("alpine:init",()=>{Alpine.plugin(o)})}();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ramstack/alpinegear-when",
3
- "version": "1.2.4",
3
+ "version": "1.4.0",
4
4
  "description": "@ramstack/alpinegear-when provides additional directives, magic functions, and utilities for a more productive development experience",
5
5
  "author": {
6
6
  "name": "Rameel Burhan",