@ramstack/alpinegear-template 1.0.0-preview.1 → 1.1.0-preview.1
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.
@@ -4,14 +4,14 @@ const is_template = el => el instanceof HTMLTemplateElement;
|
|
4
4
|
function plugin(alpine) {
|
5
5
|
alpine.directive("template", (el, { expression }) => {
|
6
6
|
if (is_template(el)) {
|
7
|
-
warn("x-template cannot be used on a 'template' tag
|
7
|
+
warn("x-template cannot be used on a 'template' tag");
|
8
8
|
return;
|
9
9
|
}
|
10
10
|
|
11
11
|
const tpl = document.getElementById(expression);
|
12
12
|
|
13
13
|
if (!is_template(tpl)) {
|
14
|
-
warn("x-template directive can only reference the template tag
|
14
|
+
warn("x-template directive can only reference the template tag");
|
15
15
|
return;
|
16
16
|
}
|
17
17
|
|
@@ -1 +1 @@
|
|
1
|
-
const e=(...e)=>console.warn("alpine-gear.js:",...e),t=e=>e instanceof HTMLTemplateElement;function n(n){n.directive("template",((n,{expression:a})=>{if(t(n))return void e("x-template cannot be used on a 'template' tag
|
1
|
+
const e=(...e)=>console.warn("alpine-gear.js:",...e),t=e=>e instanceof HTMLTemplateElement;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
@@ -7,14 +7,14 @@
|
|
7
7
|
function plugin(alpine) {
|
8
8
|
alpine.directive("template", (el, { expression }) => {
|
9
9
|
if (is_template(el)) {
|
10
|
-
warn("x-template cannot be used on a 'template' tag
|
10
|
+
warn("x-template cannot be used on a 'template' tag");
|
11
11
|
return;
|
12
12
|
}
|
13
13
|
|
14
14
|
const tpl = document.getElementById(expression);
|
15
15
|
|
16
16
|
if (!is_template(tpl)) {
|
17
|
-
warn("x-template directive can only reference the template tag
|
17
|
+
warn("x-template directive can only reference the template tag");
|
18
18
|
return;
|
19
19
|
}
|
20
20
|
|
@@ -1 +1 @@
|
|
1
|
-
!function(){"use strict";const e=(...e)=>console.warn("alpine-gear.js:",...e),t=e=>e instanceof HTMLTemplateElement;function n(n){n.directive("template",((n,{expression:i})=>{if(t(n))return void e("x-template cannot be used on a 'template' tag
|
1
|
+
!function(){"use strict";const e=(...e)=>console.warn("alpine-gear.js:",...e),t=e=>e instanceof HTMLTemplateElement;function n(n){n.directive("template",((n,{expression:i})=>{if(t(n))return void e("x-template cannot be used on a 'template' tag");const a=document.getElementById(i);t(a)?queueMicrotask((()=>{n.innerHTML="",n.append(a.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.1.0-preview.1",
|
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",
|