@ramstack/alpinegear-template 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
|
@@ -202,6 +202,11 @@ Provides the `x-hotkey` directive, which allows you to easily handle keyboard sh
|
|
|
202
202
|
**[@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>
|
|
203
203
|
Provides the `x-router` and `x-route` directives, which enable client-side navigation and routing functionality within your Alpine.js application.
|
|
204
204
|
|
|
205
|
+
**[@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>
|
|
206
|
+
Provides a headless dialog directive for Alpine.js based on the native HTML `<dialog>` element.
|
|
207
|
+
It supports declarative composition, value-based close semantics, and both modal and non-modal dialogs,
|
|
208
|
+
with optional Promise-based imperative control.
|
|
209
|
+
|
|
205
210
|
|
|
206
211
|
## Contributions
|
|
207
212
|
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
|
|
|
4
4
|
function plugin(alpine) {
|
|
5
5
|
alpine.directive("template", (el, { expression }) => {
|
|
@@ -15,11 +15,11 @@ function plugin(alpine) {
|
|
|
15
15
|
return;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
// Adding a queued task ensures asynchronous content update, allowing Alpine.js
|
|
19
|
+
// to handle context propagation for cloned elements properly.
|
|
20
|
+
// This is important because manipulation can occur within the mutateDom function
|
|
21
|
+
// when mutation observing is disabled, preventing proper context propagation
|
|
22
|
+
// for cloned elements.
|
|
23
23
|
queueMicrotask(() => {
|
|
24
24
|
el.innerHTML = "";
|
|
25
25
|
el.append(tpl.content.cloneNode(true));
|
|
@@ -27,4 +27,4 @@ function plugin(alpine) {
|
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
export { plugin as template };
|
|
30
|
+
export { plugin as template };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=(...e)=>console.warn("alpinegear.js:",...e),t=e=>e
|
|
1
|
+
const e=(...e)=>console.warn("alpinegear.js:",...e),t=e=>e.matches("template");function n(n){n.directive("template",(n,{expression:a})=>{if(t(n))return void e("x-template cannot be used on a 'template' tag");const o=document.getElementById(a);t(o)?queueMicrotask(()=>{n.innerHTML="",n.append(o.content.cloneNode(!0))}):e("x-template directive can only reference the template tag")})}export{n as template};
|
package/alpinegear-template.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
|
|
|
7
7
|
function plugin(alpine) {
|
|
8
8
|
alpine.directive("template", (el, { expression }) => {
|
|
@@ -18,11 +18,11 @@
|
|
|
18
18
|
return;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
// Adding a queued task ensures asynchronous content update, allowing Alpine.js
|
|
22
|
+
// to handle context propagation for cloned elements properly.
|
|
23
|
+
// This is important because manipulation can occur within the mutateDom function
|
|
24
|
+
// when mutation observing is disabled, preventing proper context propagation
|
|
25
|
+
// for cloned elements.
|
|
26
26
|
queueMicrotask(() => {
|
|
27
27
|
el.innerHTML = "";
|
|
28
28
|
el.append(tpl.content.cloneNode(true));
|
|
@@ -32,4 +32,4 @@
|
|
|
32
32
|
|
|
33
33
|
document.addEventListener("alpine:init", () => { Alpine.plugin(plugin); });
|
|
34
34
|
|
|
35
|
-
})();
|
|
35
|
+
})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(){"use strict";const e=(...e)=>console.warn("alpinegear.js:",...e),t=e=>e
|
|
1
|
+
!function(){"use strict";const e=(...e)=>console.warn("alpinegear.js:",...e),t=e=>e.matches("template");function n(n){n.directive("template",(n,{expression:a})=>{if(t(n))return void e("x-template cannot be used on a 'template' tag");const i=document.getElementById(a);t(i)?queueMicrotask(()=>{n.innerHTML="",n.append(i.content.cloneNode(!0))}):e("x-template directive can only reference the template tag")})}document.addEventListener("alpine:init",()=>{Alpine.plugin(n)})}();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ramstack/alpinegear-template",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "@ramstack/alpinegear-template provides 'x-template' Alpine.js directive, that enhances template management, providing better control over reusable template blocks, dynamic and recursive component rendering.",
|
|
5
5
|
"author": "Rameel Burhan",
|
|
6
6
|
"license": "MIT",
|