ladrillosjs 2.0.0-beta.3 → 2.0.0-beta.3.2
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 +152 -4
- package/dist/core/main.d.ts +2 -0
- package/dist/{index-DymB3-NG.mjs → index-JWdjGiUA.mjs} +216 -190
- package/dist/index-JWdjGiUA.mjs.map +1 -0
- package/dist/index-qEisp6n5.js +19 -0
- package/dist/index-qEisp6n5.js.map +1 -0
- package/dist/ladrillosjs.cjs.js +1 -1
- package/dist/ladrillosjs.es.js +1 -1
- package/dist/ladrillosjs.umd.js +17 -17
- package/dist/ladrillosjs.umd.js.map +1 -1
- package/dist/{webcomponent-BQLjYvOH.js → webcomponent-B-2Pj2ku.js} +2 -2
- package/dist/{webcomponent-BQLjYvOH.js.map → webcomponent-B-2Pj2ku.js.map} +1 -1
- package/dist/{webcomponent-DrCSyWrI.mjs → webcomponent-DT_kduma.mjs} +2 -2
- package/dist/{webcomponent-DrCSyWrI.mjs.map → webcomponent-DT_kduma.mjs.map} +1 -1
- package/package.json +1 -1
- package/dist/index-DZgn4gH2.js +0 -19
- package/dist/index-DZgn4gH2.js.map +0 -1
- package/dist/index-DymB3-NG.mjs.map +0 -1
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
1
|
+
var q = Object.defineProperty, I = Object.defineProperties;
|
|
2
|
+
var B = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var v = Object.getOwnPropertySymbols;
|
|
4
|
+
var j = Object.prototype.hasOwnProperty, W = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var k = (t) => {
|
|
6
6
|
throw TypeError(t);
|
|
7
7
|
};
|
|
8
|
-
var P = (t, e, r) => e in t ?
|
|
8
|
+
var P = (t, e, r) => e in t ? q(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, h = (t, e) => {
|
|
9
9
|
for (var r in e || (e = {}))
|
|
10
|
-
|
|
11
|
-
if (
|
|
12
|
-
for (var r of
|
|
13
|
-
|
|
10
|
+
j.call(e, r) && P(t, r, e[r]);
|
|
11
|
+
if (v)
|
|
12
|
+
for (var r of v(e))
|
|
13
|
+
W.call(e, r) && P(t, r, e[r]);
|
|
14
14
|
return t;
|
|
15
|
-
},
|
|
16
|
-
var
|
|
17
|
-
var
|
|
18
|
-
var
|
|
19
|
-
var
|
|
20
|
-
var
|
|
15
|
+
}, f = (t, e) => I(t, B(e));
|
|
16
|
+
var D = (t, e, r) => e.has(t) || k("Cannot " + r);
|
|
17
|
+
var z = (t, e, r) => e.has(t) ? k("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, r);
|
|
18
|
+
var $ = (t, e, r) => (D(t, e, "access private method"), r);
|
|
19
|
+
var p = (t, e, r) => new Promise((s, o) => {
|
|
20
|
+
var i = (c) => {
|
|
21
21
|
try {
|
|
22
22
|
a(r.next(c));
|
|
23
|
-
} catch (
|
|
24
|
-
o(
|
|
23
|
+
} catch (d) {
|
|
24
|
+
o(d);
|
|
25
25
|
}
|
|
26
26
|
}, l = (c) => {
|
|
27
27
|
try {
|
|
28
28
|
a(r.throw(c));
|
|
29
|
-
} catch (
|
|
30
|
-
o(
|
|
29
|
+
} catch (d) {
|
|
30
|
+
o(d);
|
|
31
31
|
}
|
|
32
|
-
}, a = (c) => c.done ? s(c.value) : Promise.resolve(c.value).then(
|
|
32
|
+
}, a = (c) => c.done ? s(c.value) : Promise.resolve(c.value).then(i, l);
|
|
33
33
|
a((r = r.apply(t, e)).next());
|
|
34
34
|
});
|
|
35
|
-
const
|
|
35
|
+
const L = () => {
|
|
36
36
|
try {
|
|
37
37
|
return !1;
|
|
38
38
|
} catch (t) {
|
|
39
39
|
return process.env.NODE_ENV === "development";
|
|
40
40
|
}
|
|
41
|
-
},
|
|
41
|
+
}, n = {
|
|
42
42
|
/**
|
|
43
43
|
* Log a message only in development mode
|
|
44
44
|
* @param message - The message to log
|
|
45
45
|
* @param args - Additional arguments to log
|
|
46
46
|
*/
|
|
47
47
|
log(t, ...e) {
|
|
48
|
-
|
|
48
|
+
L() && console.log(t, ...e);
|
|
49
49
|
},
|
|
50
50
|
/**
|
|
51
51
|
* Log an error (always logs in both dev and production)
|
|
@@ -61,9 +61,9 @@ const M = () => {
|
|
|
61
61
|
* @param args - Additional arguments to log
|
|
62
62
|
*/
|
|
63
63
|
warn(t, ...e) {
|
|
64
|
-
|
|
64
|
+
L() && console.warn(t, ...e);
|
|
65
65
|
}
|
|
66
|
-
},
|
|
66
|
+
}, g = (t, e) => {
|
|
67
67
|
const r = [t];
|
|
68
68
|
return e && (e.componentName && r.push(`
|
|
69
69
|
Component: <${e.componentName}>`), e.componentPath && r.push(`
|
|
@@ -73,102 +73,102 @@ const M = () => {
|
|
|
73
73
|
Event: ${e.eventType}`), e.elementTag && r.push(`
|
|
74
74
|
Element: <${e.elementTag}>`), e.lineHint && r.push(`
|
|
75
75
|
Location: ${e.lineHint}`)), r.join("");
|
|
76
|
-
},
|
|
77
|
-
const s =
|
|
76
|
+
}, pe = (t, e, r) => {
|
|
77
|
+
const s = g(
|
|
78
78
|
"⚠️ Binding Error: Failed to evaluate expression",
|
|
79
|
-
|
|
79
|
+
f(h({}, r), {
|
|
80
80
|
expression: t,
|
|
81
81
|
lineHint: (r == null ? void 0 : r.lineHint) || "Template binding expression"
|
|
82
82
|
})
|
|
83
83
|
);
|
|
84
|
-
|
|
85
|
-
},
|
|
86
|
-
const o =
|
|
84
|
+
n.error(s), n.error(` Error details: ${e.message}`), e.stack && console.debug(" Stack trace:", e.stack);
|
|
85
|
+
}, ue = (t, e, r, s) => {
|
|
86
|
+
const o = g(
|
|
87
87
|
"⚠️ Event Handler Error: Failed to execute handler",
|
|
88
|
-
|
|
88
|
+
f(h({}, s), {
|
|
89
89
|
eventType: t,
|
|
90
90
|
expression: e,
|
|
91
91
|
lineHint: (s == null ? void 0 : s.lineHint) || `on${t} handler`
|
|
92
92
|
})
|
|
93
93
|
);
|
|
94
|
-
|
|
95
|
-
},
|
|
96
|
-
const s =
|
|
94
|
+
n.error(o), n.error(` Error details: ${r.message}`), r.stack && console.debug(" Stack trace:", r.stack);
|
|
95
|
+
}, ge = (t, e, r) => {
|
|
96
|
+
const s = g(
|
|
97
97
|
"⚠️ Conditional Error: Failed to evaluate condition",
|
|
98
|
-
|
|
98
|
+
f(h({}, r), {
|
|
99
99
|
expression: t,
|
|
100
100
|
lineHint: (r == null ? void 0 : r.lineHint) || "$if/$else-if condition"
|
|
101
101
|
})
|
|
102
102
|
);
|
|
103
|
-
|
|
104
|
-
},
|
|
105
|
-
const s =
|
|
103
|
+
n.error(s), n.error(` Error details: ${e.message}`), e.stack && console.debug(" Stack trace:", e.stack);
|
|
104
|
+
}, he = (t, e, r) => {
|
|
105
|
+
const s = g(
|
|
106
106
|
"⚠️ Loop Error: Failed to process loop",
|
|
107
|
-
|
|
107
|
+
f(h({}, r), {
|
|
108
108
|
expression: t,
|
|
109
109
|
lineHint: (r == null ? void 0 : r.lineHint) || "$for loop expression"
|
|
110
110
|
})
|
|
111
111
|
);
|
|
112
|
-
|
|
113
|
-
},
|
|
114
|
-
const s =
|
|
112
|
+
n.error(s), n.error(` Error details: ${e.message}`), e.stack && console.debug(" Stack trace:", e.stack);
|
|
113
|
+
}, _ = (t, e, r) => {
|
|
114
|
+
const s = g(
|
|
115
115
|
"⚠️ Registration Error: Failed to register component",
|
|
116
116
|
{
|
|
117
117
|
componentName: t,
|
|
118
118
|
componentPath: e
|
|
119
119
|
}
|
|
120
120
|
);
|
|
121
|
-
|
|
122
|
-
},
|
|
123
|
-
const s =
|
|
121
|
+
n.error(s), n.error(` Error details: ${r.message}`), r.stack && console.debug(" Stack trace:", r.stack);
|
|
122
|
+
}, H = (t, e, r) => {
|
|
123
|
+
const s = g(
|
|
124
124
|
"⚠️ Fetch Error: Failed to load resource",
|
|
125
|
-
|
|
125
|
+
f(h({}, r), {
|
|
126
126
|
componentPath: t
|
|
127
127
|
})
|
|
128
128
|
);
|
|
129
|
-
|
|
130
|
-
},
|
|
131
|
-
const r =
|
|
129
|
+
n.error(s), n.error(` Error details: ${e.message}`);
|
|
130
|
+
}, M = (t, e) => {
|
|
131
|
+
const r = g(
|
|
132
132
|
`⚠️ Parse Error: ${t}`,
|
|
133
133
|
e
|
|
134
134
|
);
|
|
135
|
-
|
|
136
|
-
},
|
|
137
|
-
const r =
|
|
135
|
+
n.error(r);
|
|
136
|
+
}, fe = (t, e) => {
|
|
137
|
+
const r = g(
|
|
138
138
|
"⚠️ Script Error: Failed to execute component script",
|
|
139
139
|
e
|
|
140
140
|
);
|
|
141
|
-
|
|
142
|
-
},
|
|
143
|
-
const s =
|
|
141
|
+
n.error(r), n.error(` Error details: ${t.message}`), t.stack && console.debug(" Stack trace:", t.stack);
|
|
142
|
+
}, me = (t, e, r) => {
|
|
143
|
+
const s = g(
|
|
144
144
|
"⚠️ Two-Way Binding Error: Failed to setup binding",
|
|
145
|
-
|
|
145
|
+
f(h({}, r), {
|
|
146
146
|
expression: t,
|
|
147
147
|
lineHint: (r == null ? void 0 : r.lineHint) || "$model binding"
|
|
148
148
|
})
|
|
149
149
|
);
|
|
150
|
-
|
|
151
|
-
},
|
|
150
|
+
n.error(s), n.error(` Error details: ${e.message}`);
|
|
151
|
+
}, ye = (t, e) => {
|
|
152
152
|
var r;
|
|
153
|
-
return
|
|
153
|
+
return h({
|
|
154
154
|
componentName: (t == null ? void 0 : t.tagName) || ((r = t == null ? void 0 : t.constructor) == null ? void 0 : r.name),
|
|
155
155
|
componentPath: (t == null ? void 0 : t.sourcePath) || (t == null ? void 0 : t._sourcePath)
|
|
156
156
|
}, e);
|
|
157
|
-
}, u = /* @__PURE__ */ new Map(),
|
|
157
|
+
}, u = /* @__PURE__ */ new Map(), K = 25, O = (t) => {
|
|
158
158
|
const e = u.get(t);
|
|
159
159
|
return e && (u.delete(t), u.set(t, e)), e;
|
|
160
|
-
},
|
|
160
|
+
}, G = (t, e) => {
|
|
161
161
|
if (u.has(t))
|
|
162
162
|
u.delete(t);
|
|
163
|
-
else if (u.size >=
|
|
163
|
+
else if (u.size >= K) {
|
|
164
164
|
const r = u.keys().next().value;
|
|
165
165
|
r && u.delete(r);
|
|
166
166
|
}
|
|
167
167
|
u.set(t, e);
|
|
168
|
-
}, N = (t) =>
|
|
168
|
+
}, N = (t) => p(null, null, function* () {
|
|
169
169
|
if (!t)
|
|
170
170
|
throw new Error("Path cannot be null or empty");
|
|
171
|
-
const e =
|
|
171
|
+
const e = O(t);
|
|
172
172
|
if (e) return e;
|
|
173
173
|
try {
|
|
174
174
|
const r = yield fetch(t);
|
|
@@ -177,17 +177,17 @@ const M = () => {
|
|
|
177
177
|
`Failed to fetch component from ${t}: ${r.statusText}`
|
|
178
178
|
);
|
|
179
179
|
const s = yield r.text();
|
|
180
|
-
return
|
|
180
|
+
return G(t, s), s;
|
|
181
181
|
} catch (r) {
|
|
182
|
-
|
|
182
|
+
H(t, r, { componentPath: t });
|
|
183
183
|
}
|
|
184
|
-
}),
|
|
184
|
+
}), J = (t) => p(null, null, function* () {
|
|
185
185
|
try {
|
|
186
186
|
const e = yield fetch(t);
|
|
187
187
|
if (!e.ok) throw new Error(`HTTP ${e.status}`);
|
|
188
188
|
return yield e.text();
|
|
189
189
|
} catch (e) {
|
|
190
|
-
return
|
|
190
|
+
return H(t, e), "";
|
|
191
191
|
}
|
|
192
192
|
}), b = {
|
|
193
193
|
bindings: /{([^}]+)}/g,
|
|
@@ -196,19 +196,19 @@ const M = () => {
|
|
|
196
196
|
css: /\/\*[\s\S]*?\*\//g,
|
|
197
197
|
html: /<!--[\s\S]*?-->/g
|
|
198
198
|
}
|
|
199
|
-
},
|
|
200
|
-
const r =
|
|
199
|
+
}, V = new DOMParser(), x = (t, e) => p(null, null, function* () {
|
|
200
|
+
const r = X(t), { scripts: s, externalScripts: o } = Q(r), i = yield Z(r), l = r.body.innerHTML.trim();
|
|
201
201
|
return {
|
|
202
202
|
tagName: e,
|
|
203
203
|
template: l,
|
|
204
204
|
scripts: s,
|
|
205
205
|
externalScripts: o,
|
|
206
|
-
styles:
|
|
206
|
+
styles: i
|
|
207
207
|
};
|
|
208
|
-
}),
|
|
208
|
+
}), X = (t) => V.parseFromString(
|
|
209
209
|
t.replace(b.comments.html, ""),
|
|
210
210
|
"text/html"
|
|
211
|
-
),
|
|
211
|
+
), Y = (t) => [
|
|
212
212
|
"/@vite/",
|
|
213
213
|
// Vite dev client
|
|
214
214
|
"/__vite",
|
|
@@ -223,33 +223,33 @@ const M = () => {
|
|
|
223
223
|
// Browser Sync
|
|
224
224
|
"/livereload.js"
|
|
225
225
|
// LiveReload
|
|
226
|
-
].some((r) => t.includes(r)),
|
|
226
|
+
].some((r) => t.includes(r)), Q = (t) => {
|
|
227
227
|
var s, o;
|
|
228
228
|
const e = [], r = [];
|
|
229
|
-
for (const
|
|
230
|
-
if (
|
|
231
|
-
if (
|
|
232
|
-
|
|
229
|
+
for (const i of t.querySelectorAll("script")) {
|
|
230
|
+
if (i.src) {
|
|
231
|
+
if (Y(i.src)) {
|
|
232
|
+
i.remove();
|
|
233
233
|
continue;
|
|
234
234
|
}
|
|
235
|
-
const l =
|
|
235
|
+
const l = i.hasAttribute("external");
|
|
236
236
|
r.push({
|
|
237
|
-
src:
|
|
237
|
+
src: i.getAttribute("src") || i.src,
|
|
238
238
|
// Use getAttribute to preserve relative paths
|
|
239
|
-
type: (s =
|
|
239
|
+
type: (s = i.type) != null ? s : null,
|
|
240
240
|
external: l
|
|
241
241
|
});
|
|
242
|
-
} else if (
|
|
243
|
-
let l =
|
|
242
|
+
} else if (i.textContent) {
|
|
243
|
+
let l = i.textContent.trim();
|
|
244
244
|
l = l.replace(b.comments.js, "").trim(), e.push({
|
|
245
245
|
content: l,
|
|
246
|
-
type: (o =
|
|
246
|
+
type: (o = i.type) != null ? o : null
|
|
247
247
|
});
|
|
248
248
|
}
|
|
249
|
-
|
|
249
|
+
i.remove();
|
|
250
250
|
}
|
|
251
251
|
return { scripts: e, externalScripts: r };
|
|
252
|
-
},
|
|
252
|
+
}, U = (t) => {
|
|
253
253
|
const e = t.match(/const __vite__css = "((?:[^"\\]|\\.)*)"/);
|
|
254
254
|
if (e && e[1])
|
|
255
255
|
return e[1].replace(/\\r\\n/g, `
|
|
@@ -258,47 +258,47 @@ const M = () => {
|
|
|
258
258
|
const r = t.match(/export\s+default\s+"((?:[^"\\]|\\.)*)"/);
|
|
259
259
|
return r && r[1] ? r[1].replace(/\\r\\n/g, `
|
|
260
260
|
`).replace(/\\n/g, `
|
|
261
|
-
`).replace(/\\t/g, " ").replace(/\\"/g, '"').replace(/\\\\/g, "\\") : t.includes("import") || t.includes("export") ? (
|
|
261
|
+
`).replace(/\\t/g, " ").replace(/\\"/g, '"').replace(/\\\\/g, "\\") : t.includes("import") || t.includes("export") ? (n.warn(
|
|
262
262
|
"CSS file returned JavaScript module format. CSS may not load correctly."
|
|
263
263
|
), "") : t;
|
|
264
|
-
},
|
|
264
|
+
}, Z = (t) => p(null, null, function* () {
|
|
265
265
|
let e = "";
|
|
266
266
|
const r = t.querySelectorAll("style, link[rel='stylesheet']");
|
|
267
267
|
for (const s of r) {
|
|
268
268
|
if (s.tagName === "LINK") {
|
|
269
|
-
const
|
|
269
|
+
const i = yield J(s.href), l = U(i);
|
|
270
270
|
l && (e += `
|
|
271
271
|
` + l);
|
|
272
272
|
} else if (s.tagName === "STYLE") {
|
|
273
273
|
const o = s;
|
|
274
274
|
if (o.textContent) {
|
|
275
|
-
let
|
|
276
|
-
|
|
277
|
-
` +
|
|
275
|
+
let i = o.textContent.trim();
|
|
276
|
+
i = i.replace(b.comments.css, "").trim(), e += `
|
|
277
|
+
` + i;
|
|
278
278
|
}
|
|
279
279
|
}
|
|
280
280
|
s.remove();
|
|
281
281
|
}
|
|
282
282
|
return e.trim();
|
|
283
283
|
});
|
|
284
|
-
var
|
|
285
|
-
class
|
|
284
|
+
var w, T, A;
|
|
285
|
+
class ee {
|
|
286
286
|
constructor() {
|
|
287
|
-
|
|
288
|
-
this.components = {}, this.lazyComponents = /* @__PURE__ */ new Set(), this.intersectionObserver = null;
|
|
287
|
+
z(this, w);
|
|
288
|
+
this.components = {}, this.lazyComponents = /* @__PURE__ */ new Set(), this.intersectionObserver = null, this.lazyLoadingInProgress = /* @__PURE__ */ new Map(), this.lazyComponentsLoaded = /* @__PURE__ */ new Set();
|
|
289
289
|
}
|
|
290
290
|
registerComponent(e, r, s = !0, o = !1) {
|
|
291
|
-
return
|
|
291
|
+
return p(this, null, function* () {
|
|
292
292
|
if (this.components[e]) {
|
|
293
|
-
|
|
293
|
+
n.warn(`Component with name "${e}" is already registered.`);
|
|
294
294
|
return;
|
|
295
295
|
}
|
|
296
296
|
if (o) {
|
|
297
|
-
this.lazyComponents.add(e),
|
|
297
|
+
this.lazyComponents.add(e), $(this, w, T).call(this, e, r, s), n.log(`Component ${e} registered as lazy-loaded`);
|
|
298
298
|
return;
|
|
299
299
|
}
|
|
300
300
|
try {
|
|
301
|
-
const
|
|
301
|
+
const i = yield N(r), l = yield x(i, e);
|
|
302
302
|
this.components[e] = {
|
|
303
303
|
tagName: e,
|
|
304
304
|
template: l.template,
|
|
@@ -307,23 +307,23 @@ class oe {
|
|
|
307
307
|
styles: l.styles,
|
|
308
308
|
sourcePath: r,
|
|
309
309
|
lazy: !1
|
|
310
|
-
},
|
|
311
|
-
} catch (
|
|
312
|
-
|
|
310
|
+
}, n.log(`Component ${e} registered successfully`), yield $(this, w, A).call(this, e, s);
|
|
311
|
+
} catch (i) {
|
|
312
|
+
_(e, r, i);
|
|
313
313
|
return;
|
|
314
314
|
}
|
|
315
315
|
});
|
|
316
316
|
}
|
|
317
317
|
}
|
|
318
|
-
|
|
318
|
+
w = new WeakSet(), /**
|
|
319
319
|
* Defines a lazy-loading placeholder component
|
|
320
320
|
* @param name - Component name
|
|
321
321
|
* @param path - Component path
|
|
322
322
|
* @param useShadowDOM - Whether to use Shadow DOM
|
|
323
323
|
*/
|
|
324
|
-
|
|
324
|
+
T = function(e, r, s) {
|
|
325
325
|
const o = this;
|
|
326
|
-
class
|
|
326
|
+
class i extends HTMLElement {
|
|
327
327
|
constructor() {
|
|
328
328
|
super(), this.loaded = !1, this.observer = null, s && (this.attachShadow({ mode: "open" }), this.shadowRoot && (this.shadowRoot.innerHTML = `
|
|
329
329
|
<style>
|
|
@@ -344,8 +344,8 @@ A = function(e, r, s) {
|
|
|
344
344
|
});
|
|
345
345
|
},
|
|
346
346
|
{
|
|
347
|
-
rootMargin: "
|
|
348
|
-
// Load
|
|
347
|
+
rootMargin: "100px"
|
|
348
|
+
// Load 100px before entering viewport
|
|
349
349
|
}
|
|
350
350
|
), this.observer.observe(this);
|
|
351
351
|
}
|
|
@@ -354,54 +354,80 @@ A = function(e, r, s) {
|
|
|
354
354
|
this.observer && (this.observer.disconnect(), this.observer = null);
|
|
355
355
|
}
|
|
356
356
|
loadComponent() {
|
|
357
|
-
return
|
|
357
|
+
return p(this, null, function* () {
|
|
358
358
|
try {
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
359
|
+
if (o.lazyComponentsLoaded.has(e)) {
|
|
360
|
+
n.log(
|
|
361
|
+
`Component ${e} already loaded, upgrading placeholder...`
|
|
362
|
+
), this.upgradePlaceholder();
|
|
363
|
+
return;
|
|
364
|
+
}
|
|
365
|
+
if (o.lazyLoadingInProgress.has(e)) {
|
|
366
|
+
n.log(`Component ${e} is already loading, waiting...`), yield o.lazyLoadingInProgress.get(e), this.upgradePlaceholder();
|
|
366
367
|
return;
|
|
367
368
|
}
|
|
368
|
-
const
|
|
369
|
-
|
|
370
|
-
tagName: e,
|
|
371
|
-
template: y.template,
|
|
372
|
-
scripts: y.scripts,
|
|
373
|
-
externalScripts: y.externalScripts,
|
|
374
|
-
styles: y.styles,
|
|
375
|
-
sourcePath: r,
|
|
376
|
-
lazy: !0
|
|
377
|
-
};
|
|
378
|
-
const w = `${e}-real`;
|
|
379
|
-
i.log(`Defining real component with temp name: ${w}`);
|
|
380
|
-
const B = o.components[e].tagName;
|
|
381
|
-
o.components[e].tagName = w;
|
|
382
|
-
const { defineWebComponent: j } = yield import("./webcomponent-DrCSyWrI.mjs");
|
|
383
|
-
j(o.components[e], s), i.log(`Real component ${w} defined`), o.components[e].tagName = B;
|
|
384
|
-
const E = document.createElement(w);
|
|
385
|
-
for (i.log(`Created real component instance: ${w}`), Array.from(a.attributes).forEach((v) => {
|
|
386
|
-
E.setAttribute(v.name, v.value);
|
|
387
|
-
}); a.firstChild; )
|
|
388
|
-
E.appendChild(a.firstChild);
|
|
389
|
-
f ? (c.insertBefore(E, f), i.log("Inserted real component before next sibling")) : (c.appendChild(E), i.log("Appended real component to parent")), c.removeChild(a), i.log("Removed placeholder element"), o.lazyComponents.delete(e), i.log(`Component ${e} lazy-loaded successfully`);
|
|
369
|
+
const a = this.performLoad();
|
|
370
|
+
o.lazyLoadingInProgress.set(e, a), yield a, o.lazyLoadingInProgress.delete(e), o.lazyComponentsLoaded.add(e), o.lazyComponents.delete(e), n.log(`Component ${e} lazy-loaded successfully`);
|
|
390
371
|
} catch (a) {
|
|
391
|
-
|
|
372
|
+
o.lazyLoadingInProgress.delete(e), _(e, r, a);
|
|
373
|
+
}
|
|
374
|
+
});
|
|
375
|
+
}
|
|
376
|
+
performLoad() {
|
|
377
|
+
return p(this, null, function* () {
|
|
378
|
+
n.log(`Lazy loading component: ${e}`);
|
|
379
|
+
const a = this.parentNode;
|
|
380
|
+
if (this.nextSibling, !a) {
|
|
381
|
+
M(`Placeholder for ${e} has no parent node`, {
|
|
382
|
+
componentName: e,
|
|
383
|
+
componentPath: r
|
|
384
|
+
});
|
|
385
|
+
return;
|
|
392
386
|
}
|
|
387
|
+
const c = yield N(r), d = yield x(c, e);
|
|
388
|
+
n.log(`Component ${e} parsed successfully`), o.components[e] = {
|
|
389
|
+
tagName: e,
|
|
390
|
+
template: d.template,
|
|
391
|
+
scripts: d.scripts,
|
|
392
|
+
externalScripts: d.externalScripts,
|
|
393
|
+
styles: d.styles,
|
|
394
|
+
sourcePath: r,
|
|
395
|
+
lazy: !0
|
|
396
|
+
};
|
|
397
|
+
const m = `${e}-real`;
|
|
398
|
+
n.log(`Defining real component with temp name: ${m}`);
|
|
399
|
+
const y = o.components[e].tagName;
|
|
400
|
+
o.components[e].tagName = m;
|
|
401
|
+
const { defineWebComponent: C } = yield import("./webcomponent-DT_kduma.mjs");
|
|
402
|
+
C(o.components[e], s), n.log(`Real component ${m} defined`), o.components[e].tagName = y, this.upgradePlaceholder();
|
|
393
403
|
});
|
|
394
404
|
}
|
|
405
|
+
upgradePlaceholder() {
|
|
406
|
+
const a = this, c = this.parentNode, d = this.nextSibling;
|
|
407
|
+
if (!c) {
|
|
408
|
+
M(`Placeholder for ${e} has no parent node`, {
|
|
409
|
+
componentName: e,
|
|
410
|
+
componentPath: r
|
|
411
|
+
});
|
|
412
|
+
return;
|
|
413
|
+
}
|
|
414
|
+
const m = `${e}-real`, y = document.createElement(m);
|
|
415
|
+
for (n.log(`Created real component instance: ${m}`), Array.from(a.attributes).forEach((C) => {
|
|
416
|
+
C.name !== "eager" && y.setAttribute(C.name, C.value);
|
|
417
|
+
}); a.firstChild; )
|
|
418
|
+
y.appendChild(a.firstChild);
|
|
419
|
+
d ? (c.insertBefore(y, d), n.log("Inserted real component before next sibling")) : (c.appendChild(y), n.log("Appended real component to parent")), c.removeChild(a), n.log("Removed placeholder element");
|
|
420
|
+
}
|
|
395
421
|
}
|
|
396
|
-
customElements.get(e) || customElements.define(e,
|
|
397
|
-
},
|
|
398
|
-
return
|
|
399
|
-
const { defineWebComponent: s } = yield import("./webcomponent-
|
|
422
|
+
customElements.get(e) || customElements.define(e, i);
|
|
423
|
+
}, A = function(e, r) {
|
|
424
|
+
return p(this, null, function* () {
|
|
425
|
+
const { defineWebComponent: s } = yield import("./webcomponent-DT_kduma.mjs");
|
|
400
426
|
this.components[e] && s(this.components[e], r);
|
|
401
427
|
});
|
|
402
428
|
};
|
|
403
|
-
const
|
|
404
|
-
class
|
|
429
|
+
const F = new ee();
|
|
430
|
+
class te {
|
|
405
431
|
constructor() {
|
|
406
432
|
this.listeners = /* @__PURE__ */ new Map();
|
|
407
433
|
}
|
|
@@ -421,17 +447,17 @@ class ne {
|
|
|
421
447
|
const o = this.listeners.get(e);
|
|
422
448
|
if (!o || o.size === 0)
|
|
423
449
|
return Promise.resolve();
|
|
424
|
-
const
|
|
450
|
+
const i = [];
|
|
425
451
|
return o.forEach((l) => {
|
|
426
452
|
try {
|
|
427
453
|
const a = l(r);
|
|
428
|
-
a instanceof Promise &&
|
|
454
|
+
a instanceof Promise && i.push(a);
|
|
429
455
|
} catch (a) {
|
|
430
|
-
|
|
456
|
+
n.error(
|
|
431
457
|
`⚠️ Event Bus Error: Failed to execute listener for "${e}"`
|
|
432
|
-
),
|
|
458
|
+
), n.error(` Error details: ${a.message}`), i.push(Promise.reject(a));
|
|
433
459
|
}
|
|
434
|
-
}),
|
|
460
|
+
}), i.length > 0 ? Promise.all(i).then(() => {
|
|
435
461
|
}) : Promise.resolve();
|
|
436
462
|
}
|
|
437
463
|
/**
|
|
@@ -471,38 +497,38 @@ class ne {
|
|
|
471
497
|
return (s = (r = this.listeners.get(e)) == null ? void 0 : r.size) != null ? s : 0;
|
|
472
498
|
}
|
|
473
499
|
}
|
|
474
|
-
const R = new
|
|
500
|
+
const R = new te(), re = (t, e, r, s) => F.registerComponent(t, e, r, s), se = (t) => p(null, null, function* () {
|
|
475
501
|
yield Promise.all(
|
|
476
502
|
t.map(
|
|
477
|
-
({ name: e, path: r, useShadowDOM: s, lazy: o }) =>
|
|
503
|
+
({ name: e, path: r, useShadowDOM: s, lazy: o }) => F.registerComponent(e, r, s, o)
|
|
478
504
|
)
|
|
479
505
|
);
|
|
480
|
-
}),
|
|
506
|
+
}), oe = (t, e) => R.listen(t, e), ne = (t, e) => {
|
|
481
507
|
R.emit(t, e);
|
|
482
|
-
},
|
|
508
|
+
}, we = (t, e) => {
|
|
483
509
|
if (e) {
|
|
484
510
|
const r = e.tagName.toLowerCase();
|
|
485
511
|
window.__ladrilloContexts || (window.__ladrilloContexts = /* @__PURE__ */ new Map()), window.__ladrilloContexts.set(r, { shadowRoot: t, element: e });
|
|
486
512
|
}
|
|
487
|
-
},
|
|
513
|
+
}, E = () => {
|
|
488
514
|
const t = window.__ladrilloContexts;
|
|
489
515
|
if (t && t.size > 0) {
|
|
490
516
|
const e = Array.from(t.values());
|
|
491
517
|
return e[e.length - 1];
|
|
492
518
|
}
|
|
493
519
|
return null;
|
|
494
|
-
},
|
|
495
|
-
const t =
|
|
520
|
+
}, ie = () => {
|
|
521
|
+
const t = E();
|
|
496
522
|
return t && t.element ? t.element.state || {} : {};
|
|
497
|
-
},
|
|
498
|
-
const e =
|
|
523
|
+
}, S = (t) => {
|
|
524
|
+
const e = E();
|
|
499
525
|
e && e.setState && e.setState(t);
|
|
500
|
-
},
|
|
501
|
-
|
|
502
|
-
}),
|
|
526
|
+
}, ae = (t, e) => (S({ [t]: e }), (r) => {
|
|
527
|
+
S({ [t]: r });
|
|
528
|
+
}), le = (t, e) => {
|
|
503
529
|
if (e)
|
|
504
530
|
return e.querySelector(t);
|
|
505
|
-
const r =
|
|
531
|
+
const r = E();
|
|
506
532
|
if (r) {
|
|
507
533
|
const s = r.shadowRoot || r.element;
|
|
508
534
|
if (s) {
|
|
@@ -511,10 +537,10 @@ const R = new ne(), ie = (t, e, r, s) => L.registerComponent(t, e, r, s), le = (
|
|
|
511
537
|
}
|
|
512
538
|
}
|
|
513
539
|
return document.querySelector(t);
|
|
514
|
-
},
|
|
540
|
+
}, ce = (t, e) => {
|
|
515
541
|
if (e)
|
|
516
542
|
return e.querySelectorAll(t);
|
|
517
|
-
const r =
|
|
543
|
+
const r = E();
|
|
518
544
|
if (r) {
|
|
519
545
|
const s = r.shadowRoot || r.element;
|
|
520
546
|
if (s) {
|
|
@@ -525,30 +551,30 @@ const R = new ne(), ie = (t, e, r, s) => L.registerComponent(t, e, r, s), le = (
|
|
|
525
551
|
return document.querySelectorAll(t);
|
|
526
552
|
};
|
|
527
553
|
typeof window != "undefined" && (window.ladrillosjs = {
|
|
528
|
-
registerComponent:
|
|
529
|
-
registerComponents:
|
|
530
|
-
}, window.$listen =
|
|
554
|
+
registerComponent: re,
|
|
555
|
+
registerComponents: se
|
|
556
|
+
}, window.$listen = oe, window.$emit = ne, window.$querySelector = le, window.$querySelectorAll = ce, window.$reactive = ae, window.$setState = S, window.$getState = ie);
|
|
531
557
|
export {
|
|
532
|
-
|
|
558
|
+
oe as $,
|
|
533
559
|
b as R,
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
560
|
+
we as _,
|
|
561
|
+
pe as a,
|
|
562
|
+
he as b,
|
|
563
|
+
ye as c,
|
|
564
|
+
ge as d,
|
|
565
|
+
ue as e,
|
|
540
566
|
R as f,
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
567
|
+
fe as g,
|
|
568
|
+
n as h,
|
|
569
|
+
me as i,
|
|
570
|
+
se as j,
|
|
571
|
+
ne as k,
|
|
572
|
+
M as l,
|
|
573
|
+
ie as m,
|
|
574
|
+
S as n,
|
|
575
|
+
ae as o,
|
|
576
|
+
le as p,
|
|
577
|
+
ce as q,
|
|
578
|
+
re as r
|
|
553
579
|
};
|
|
554
|
-
//# sourceMappingURL=index-
|
|
580
|
+
//# sourceMappingURL=index-JWdjGiUA.mjs.map
|