@ramstack/alpinegear-fragment 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
|
@@ -133,6 +133,11 @@ Provides the `x-hotkey` directive, which allows you to easily handle keyboard sh
|
|
|
133
133
|
**[@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>
|
|
134
134
|
Provides the `x-router` and `x-route` directives, which enable client-side navigation and routing functionality within your Alpine.js application.
|
|
135
135
|
|
|
136
|
+
**[@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>
|
|
137
|
+
Provides a headless dialog directive for Alpine.js based on the native HTML `<dialog>` element.
|
|
138
|
+
It supports declarative composition, value-based close semantics, and both modal and non-modal dialogs,
|
|
139
|
+
with optional Promise-based imperative control.
|
|
140
|
+
|
|
136
141
|
|
|
137
142
|
## Contributions
|
|
138
143
|
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
|
|
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 = {} }) {
|
|
@@ -68,4 +68,4 @@ function plugin({ addScopeToNode, directive, initTree, mutateDom }) {
|
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
export { plugin as fragment };
|
|
71
|
+
export { plugin as fragment };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=e=>e
|
|
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("fragment",(n,{},{cleanup:d})=>{e(n)?function(t,n,{addScopeToNode:r,cleanup:l,initTree:d,mutateDom:a,scope:c={}}){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)];a(()=>{for(let e of u)o(e)&&r(e,c,t),t.parentElement.insertBefore(e,t),o(e)&&d(e)}),t._r_block={template:n,update(){a(()=>{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}):console.warn("alpinegear.js:","x-fragment can only be used on a 'template' tag")})}export{t as fragment};
|
package/alpinegear-fragment.js
CHANGED
|
@@ -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
|
|
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 = {} }) {
|
|
@@ -73,4 +73,4 @@
|
|
|
73
73
|
|
|
74
74
|
document.addEventListener("alpine:init", () => { Alpine.plugin(plugin); });
|
|
75
75
|
|
|
76
|
-
})();
|
|
76
|
+
})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(){"use strict";const e=e=>e
|
|
1
|
+
!function(){"use strict";const e=e=>e.matches("template"),o=e=>e.nodeType===Node.ELEMENT_NODE;function t({addScopeToNode:t,directive:n,initTree:l,mutateDom:r}){n("fragment",(n,{},{cleanup:d})=>{e(n)?function(t,n,{addScopeToNode:l,cleanup:r,initTree:d,mutateDom:c,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 i=e(n)?[...n.content.cloneNode(!0).childNodes]:[n.cloneNode(!0)];c(()=>{for(let e of i)o(e)&&l(e,a,t),t.parentElement.insertBefore(e,t),o(e)&&d(e)}),t._r_block={template:n,update(){c(()=>{for(let e of i??[])t.parentElement.insertBefore(e,t)})},delete(){t._r_block=null;for(let e of i??[])e.remove();i=null}},r(()=>t._r_block?.delete())}(n,n,{addScopeToNode:t,cleanup:d,initTree:l,mutateDom:r}):console.warn("alpinegear.js:","x-fragment can only be used on a 'template' tag")})}document.addEventListener("alpine:init",()=>{Alpine.plugin(t)})}();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ramstack/alpinegear-fragment",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "@ramstack/alpinegear-fragment provides 'x-format' Alpine.js directive, allowing for fragment-like behavior similar to what's available in frameworks like 'Vue.js' or 'React', where multiple root elements can be grouped together.",
|
|
5
5
|
"author": "Rameel Burhan",
|
|
6
6
|
"license": "MIT",
|