ladrillosjs 2.0.0-beta.3.2 → 2.0.0-beta.3.4

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.
@@ -1,38 +1,38 @@
1
- var q = Object.defineProperty, I = Object.defineProperties;
1
+ var j = Object.defineProperty, I = Object.defineProperties;
2
2
  var B = Object.getOwnPropertyDescriptors;
3
- var v = Object.getOwnPropertySymbols;
4
- var j = Object.prototype.hasOwnProperty, W = Object.prototype.propertyIsEnumerable;
5
- var k = (t) => {
3
+ var P = Object.getOwnPropertySymbols;
4
+ var D = Object.prototype.hasOwnProperty, W = Object.prototype.propertyIsEnumerable;
5
+ var z = (t) => {
6
6
  throw TypeError(t);
7
7
  };
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) => {
8
+ var k = (t, e, r) => e in t ? j(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
- 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]);
10
+ D.call(e, r) && k(t, r, e[r]);
11
+ if (P)
12
+ for (var r of P(e))
13
+ W.call(e, r) && k(t, r, e[r]);
14
14
  return t;
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);
15
+ }, m = (t, e) => I(t, B(e));
16
+ var O = (t, e, r) => e.has(t) || z("Cannot " + r);
17
+ var L = (t, e, r) => e.has(t) ? z("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, r);
18
+ var $ = (t, e, r) => (O(t, e, "access private method"), r);
19
19
  var p = (t, e, r) => new Promise((s, o) => {
20
20
  var i = (c) => {
21
21
  try {
22
- a(r.next(c));
22
+ l(r.next(c));
23
23
  } catch (d) {
24
24
  o(d);
25
25
  }
26
- }, l = (c) => {
26
+ }, a = (c) => {
27
27
  try {
28
- a(r.throw(c));
28
+ l(r.throw(c));
29
29
  } catch (d) {
30
30
  o(d);
31
31
  }
32
- }, a = (c) => c.done ? s(c.value) : Promise.resolve(c.value).then(i, l);
33
- a((r = r.apply(t, e)).next());
32
+ }, l = (c) => c.done ? s(c.value) : Promise.resolve(c.value).then(i, a);
33
+ l((r = r.apply(t, e)).next());
34
34
  });
35
- const L = () => {
35
+ const _ = () => {
36
36
  try {
37
37
  return !1;
38
38
  } catch (t) {
@@ -45,7 +45,7 @@ const L = () => {
45
45
  * @param args - Additional arguments to log
46
46
  */
47
47
  log(t, ...e) {
48
- L() && console.log(t, ...e);
48
+ _() && console.log(t, ...e);
49
49
  },
50
50
  /**
51
51
  * Log an error (always logs in both dev and production)
@@ -61,7 +61,7 @@ const L = () => {
61
61
  * @param args - Additional arguments to log
62
62
  */
63
63
  warn(t, ...e) {
64
- L() && console.warn(t, ...e);
64
+ _() && console.warn(t, ...e);
65
65
  }
66
66
  }, g = (t, e) => {
67
67
  const r = [t];
@@ -73,44 +73,44 @@ const L = () => {
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
- }, pe = (t, e, r) => {
76
+ }, ue = (t, e, r) => {
77
77
  const s = g(
78
78
  "⚠️ Binding Error: Failed to evaluate expression",
79
- f(h({}, r), {
79
+ m(h({}, r), {
80
80
  expression: t,
81
81
  lineHint: (r == null ? void 0 : r.lineHint) || "Template binding expression"
82
82
  })
83
83
  );
84
84
  n.error(s), n.error(` Error details: ${e.message}`), e.stack && console.debug(" Stack trace:", e.stack);
85
- }, ue = (t, e, r, s) => {
85
+ }, ge = (t, e, r, s) => {
86
86
  const o = g(
87
87
  "⚠️ Event Handler Error: Failed to execute handler",
88
- f(h({}, s), {
88
+ m(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
94
  n.error(o), n.error(` Error details: ${r.message}`), r.stack && console.debug(" Stack trace:", r.stack);
95
- }, ge = (t, e, r) => {
95
+ }, he = (t, e, r) => {
96
96
  const s = g(
97
97
  "⚠️ Conditional Error: Failed to evaluate condition",
98
- f(h({}, r), {
98
+ m(h({}, r), {
99
99
  expression: t,
100
100
  lineHint: (r == null ? void 0 : r.lineHint) || "$if/$else-if condition"
101
101
  })
102
102
  );
103
103
  n.error(s), n.error(` Error details: ${e.message}`), e.stack && console.debug(" Stack trace:", e.stack);
104
- }, he = (t, e, r) => {
104
+ }, me = (t, e, r) => {
105
105
  const s = g(
106
106
  "⚠️ Loop Error: Failed to process loop",
107
- f(h({}, r), {
107
+ m(h({}, r), {
108
108
  expression: t,
109
109
  lineHint: (r == null ? void 0 : r.lineHint) || "$for loop expression"
110
110
  })
111
111
  );
112
112
  n.error(s), n.error(` Error details: ${e.message}`), e.stack && console.debug(" Stack trace:", e.stack);
113
- }, _ = (t, e, r) => {
113
+ }, x = (t, e, r) => {
114
114
  const s = g(
115
115
  "⚠️ Registration Error: Failed to register component",
116
116
  {
@@ -119,10 +119,10 @@ const L = () => {
119
119
  }
120
120
  );
121
121
  n.error(s), n.error(` Error details: ${r.message}`), r.stack && console.debug(" Stack trace:", r.stack);
122
- }, H = (t, e, r) => {
122
+ }, T = (t, e, r) => {
123
123
  const s = g(
124
124
  "⚠️ Fetch Error: Failed to load resource",
125
- f(h({}, r), {
125
+ m(h({}, r), {
126
126
  componentPath: t
127
127
  })
128
128
  );
@@ -139,25 +139,25 @@ const L = () => {
139
139
  e
140
140
  );
141
141
  n.error(r), n.error(` Error details: ${t.message}`), t.stack && console.debug(" Stack trace:", t.stack);
142
- }, me = (t, e, r) => {
142
+ }, ye = (t, e, r) => {
143
143
  const s = g(
144
144
  "⚠️ Two-Way Binding Error: Failed to setup binding",
145
- f(h({}, r), {
145
+ m(h({}, r), {
146
146
  expression: t,
147
147
  lineHint: (r == null ? void 0 : r.lineHint) || "$model binding"
148
148
  })
149
149
  );
150
150
  n.error(s), n.error(` Error details: ${e.message}`);
151
- }, ye = (t, e) => {
151
+ }, we = (t, e) => {
152
152
  var r;
153
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(), K = 25, O = (t) => {
157
+ }, u = /* @__PURE__ */ new Map(), K = 25, G = (t) => {
158
158
  const e = u.get(t);
159
159
  return e && (u.delete(t), u.set(t, e)), e;
160
- }, G = (t, e) => {
160
+ }, J = (t, e) => {
161
161
  if (u.has(t))
162
162
  u.delete(t);
163
163
  else if (u.size >= K) {
@@ -168,7 +168,7 @@ const L = () => {
168
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 = O(t);
171
+ const e = G(t);
172
172
  if (e) return e;
173
173
  try {
174
174
  const r = yield fetch(t);
@@ -177,38 +177,38 @@ const L = () => {
177
177
  `Failed to fetch component from ${t}: ${r.statusText}`
178
178
  );
179
179
  const s = yield r.text();
180
- return G(t, s), s;
180
+ return J(t, s), s;
181
181
  } catch (r) {
182
- H(t, r, { componentPath: t });
182
+ T(t, r, { componentPath: t });
183
183
  }
184
- }), J = (t) => p(null, null, function* () {
184
+ }), V = (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 H(t, e), "";
190
+ return T(t, e), "";
191
191
  }
192
- }), b = {
192
+ }), v = {
193
193
  bindings: /{([^}]+)}/g,
194
194
  comments: {
195
195
  js: /\/\*[\s\S]*?\*\/|\/\/.*$/gm,
196
196
  css: /\/\*[\s\S]*?\*\//g,
197
197
  html: /<!--[\s\S]*?-->/g
198
198
  }
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();
199
+ }, X = new DOMParser(), H = (t, e) => p(null, null, function* () {
200
+ const r = Y(t), { scripts: s, externalScripts: o } = U(r), i = yield ee(r), a = r.body.innerHTML.trim();
201
201
  return {
202
202
  tagName: e,
203
- template: l,
203
+ template: a,
204
204
  scripts: s,
205
205
  externalScripts: o,
206
206
  styles: i
207
207
  };
208
- }), X = (t) => V.parseFromString(
209
- t.replace(b.comments.html, ""),
208
+ }), Y = (t) => X.parseFromString(
209
+ t.replace(v.comments.html, ""),
210
210
  "text/html"
211
- ), Y = (t) => [
211
+ ), Q = (t) => [
212
212
  "/@vite/",
213
213
  // Vite dev client
214
214
  "/__vite",
@@ -223,33 +223,33 @@ const L = () => {
223
223
  // Browser Sync
224
224
  "/livereload.js"
225
225
  // LiveReload
226
- ].some((r) => t.includes(r)), Q = (t) => {
226
+ ].some((r) => t.includes(r)), U = (t) => {
227
227
  var s, o;
228
228
  const e = [], r = [];
229
229
  for (const i of t.querySelectorAll("script")) {
230
230
  if (i.src) {
231
- if (Y(i.src)) {
231
+ if (Q(i.src)) {
232
232
  i.remove();
233
233
  continue;
234
234
  }
235
- const l = i.hasAttribute("external");
235
+ const a = i.hasAttribute("external");
236
236
  r.push({
237
237
  src: i.getAttribute("src") || i.src,
238
238
  // Use getAttribute to preserve relative paths
239
239
  type: (s = i.type) != null ? s : null,
240
- external: l
240
+ external: a
241
241
  });
242
242
  } else if (i.textContent) {
243
- let l = i.textContent.trim();
244
- l = l.replace(b.comments.js, "").trim(), e.push({
245
- content: l,
243
+ let a = i.textContent.trim();
244
+ a = a.replace(v.comments.js, "").trim(), e.push({
245
+ content: a,
246
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
- }, U = (t) => {
252
+ }, Z = (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, `
@@ -261,19 +261,19 @@ const L = () => {
261
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
- }, Z = (t) => p(null, null, function* () {
264
+ }, ee = (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 i = yield J(s.href), l = U(i);
270
- l && (e += `
271
- ` + l);
269
+ const i = yield V(s.href), a = Z(i);
270
+ a && (e += `
271
+ ` + a);
272
272
  } else if (s.tagName === "STYLE") {
273
273
  const o = s;
274
274
  if (o.textContent) {
275
275
  let i = o.textContent.trim();
276
- i = i.replace(b.comments.css, "").trim(), e += `
276
+ i = i.replace(v.comments.css, "").trim(), e += `
277
277
  ` + i;
278
278
  }
279
279
  }
@@ -281,10 +281,10 @@ const L = () => {
281
281
  }
282
282
  return e.trim();
283
283
  });
284
- var w, T, A;
285
- class ee {
284
+ var C, A, F;
285
+ class te {
286
286
  constructor() {
287
- z(this, w);
287
+ L(this, C);
288
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) {
@@ -294,34 +294,34 @@ class ee {
294
294
  return;
295
295
  }
296
296
  if (o) {
297
- this.lazyComponents.add(e), $(this, w, T).call(this, e, r, s), n.log(`Component ${e} registered as lazy-loaded`);
297
+ this.lazyComponents.add(e), $(this, C, A).call(this, e, r, s), n.log(`Component ${e} registered as lazy-loaded`);
298
298
  return;
299
299
  }
300
300
  try {
301
- const i = yield N(r), l = yield x(i, e);
301
+ const i = yield N(r), a = yield H(i, e);
302
302
  this.components[e] = {
303
303
  tagName: e,
304
- template: l.template,
305
- scripts: l.scripts,
306
- externalScripts: l.externalScripts,
307
- styles: l.styles,
304
+ template: a.template,
305
+ scripts: a.scripts,
306
+ externalScripts: a.externalScripts,
307
+ styles: a.styles,
308
308
  sourcePath: r,
309
309
  lazy: !1
310
- }, n.log(`Component ${e} registered successfully`), yield $(this, w, A).call(this, e, s);
310
+ }, n.log(`Component ${e} registered successfully`), yield $(this, C, F).call(this, e, s);
311
311
  } catch (i) {
312
- _(e, r, i);
312
+ x(e, r, i);
313
313
  return;
314
314
  }
315
315
  });
316
316
  }
317
317
  }
318
- w = new WeakSet(), /**
318
+ C = 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
- T = function(e, r, s) {
324
+ A = function(e, r, s) {
325
325
  const o = this;
326
326
  class i extends HTMLElement {
327
327
  constructor() {
@@ -338,8 +338,8 @@ T = function(e, r, s) {
338
338
  return;
339
339
  }
340
340
  this.observer = new IntersectionObserver(
341
- (a) => {
342
- a.forEach((c) => {
341
+ (l) => {
342
+ l.forEach((c) => {
343
343
  c.isIntersecting && !this.loaded && (this.loaded = !0, this.loadComponent());
344
344
  });
345
345
  },
@@ -366,25 +366,25 @@ T = function(e, r, s) {
366
366
  n.log(`Component ${e} is already loading, waiting...`), yield o.lazyLoadingInProgress.get(e), this.upgradePlaceholder();
367
367
  return;
368
368
  }
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`);
371
- } catch (a) {
372
- o.lazyLoadingInProgress.delete(e), _(e, r, a);
369
+ const l = this.performLoad();
370
+ o.lazyLoadingInProgress.set(e, l), yield l, o.lazyLoadingInProgress.delete(e), o.lazyComponentsLoaded.add(e), o.lazyComponents.delete(e), n.log(`Component ${e} lazy-loaded successfully`);
371
+ } catch (l) {
372
+ o.lazyLoadingInProgress.delete(e), x(e, r, l);
373
373
  }
374
374
  });
375
375
  }
376
376
  performLoad() {
377
377
  return p(this, null, function* () {
378
378
  n.log(`Lazy loading component: ${e}`);
379
- const a = this.parentNode;
380
- if (this.nextSibling, !a) {
379
+ const l = this.parentNode;
380
+ if (this.nextSibling, !l) {
381
381
  M(`Placeholder for ${e} has no parent node`, {
382
382
  componentName: e,
383
383
  componentPath: r
384
384
  });
385
385
  return;
386
386
  }
387
- const c = yield N(r), d = yield x(c, e);
387
+ const c = yield N(r), d = yield H(c, e);
388
388
  n.log(`Component ${e} parsed successfully`), o.components[e] = {
389
389
  tagName: e,
390
390
  template: d.template,
@@ -394,16 +394,16 @@ T = function(e, r, s) {
394
394
  sourcePath: r,
395
395
  lazy: !0
396
396
  };
397
- const m = `${e}-real`;
398
- n.log(`Defining real component with temp name: ${m}`);
397
+ const f = `${e}-real`;
398
+ n.log(`Defining real component with temp name: ${f}`);
399
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();
400
+ o.components[e].tagName = f;
401
+ const { defineWebComponent: E } = yield import("./webcomponent-WCW6485Z.mjs");
402
+ E(o.components[e], s), n.log(`Real component ${f} defined`), o.components[e].tagName = y, this.upgradePlaceholder();
403
403
  });
404
404
  }
405
405
  upgradePlaceholder() {
406
- const a = this, c = this.parentNode, d = this.nextSibling;
406
+ const l = this, c = this.parentNode, d = this.nextSibling;
407
407
  if (!c) {
408
408
  M(`Placeholder for ${e} has no parent node`, {
409
409
  componentName: e,
@@ -411,23 +411,23 @@ T = function(e, r, s) {
411
411
  });
412
412
  return;
413
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");
414
+ const f = `${e}-real`, y = document.createElement(f);
415
+ for (n.log(`Created real component instance: ${f}`), Array.from(l.attributes).forEach((E) => {
416
+ E.name !== "eager" && y.setAttribute(E.name, E.value);
417
+ }); l.firstChild; )
418
+ y.appendChild(l.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(l), n.log("Removed placeholder element");
420
420
  }
421
421
  }
422
422
  customElements.get(e) || customElements.define(e, i);
423
- }, A = function(e, r) {
423
+ }, F = function(e, r) {
424
424
  return p(this, null, function* () {
425
- const { defineWebComponent: s } = yield import("./webcomponent-DT_kduma.mjs");
425
+ const { defineWebComponent: s } = yield import("./webcomponent-WCW6485Z.mjs");
426
426
  this.components[e] && s(this.components[e], r);
427
427
  });
428
428
  };
429
- const F = new ee();
430
- class te {
429
+ const R = new te();
430
+ class re {
431
431
  constructor() {
432
432
  this.listeners = /* @__PURE__ */ new Map();
433
433
  }
@@ -448,14 +448,14 @@ class te {
448
448
  if (!o || o.size === 0)
449
449
  return Promise.resolve();
450
450
  const i = [];
451
- return o.forEach((l) => {
451
+ return o.forEach((a) => {
452
452
  try {
453
- const a = l(r);
454
- a instanceof Promise && i.push(a);
455
- } catch (a) {
453
+ const l = a(r);
454
+ l instanceof Promise && i.push(l);
455
+ } catch (l) {
456
456
  n.error(
457
457
  `⚠️ Event Bus Error: Failed to execute listener for "${e}"`
458
- ), n.error(` Error details: ${a.message}`), i.push(Promise.reject(a));
458
+ ), n.error(` Error details: ${l.message}`), i.push(Promise.reject(l));
459
459
  }
460
460
  }), i.length > 0 ? Promise.all(i).then(() => {
461
461
  }) : Promise.resolve();
@@ -497,38 +497,71 @@ class te {
497
497
  return (s = (r = this.listeners.get(e)) == null ? void 0 : r.size) != null ? s : 0;
498
498
  }
499
499
  }
500
- const R = new te(), re = (t, e, r, s) => F.registerComponent(t, e, r, s), se = (t) => p(null, null, function* () {
500
+ const q = new re(), w = {};
501
+ function Ce(t = {}) {
502
+ const {
503
+ src: e = "components",
504
+ dest: r = "components",
505
+ copyOnDev: s = !1
506
+ } = t;
507
+ return {
508
+ name: "ladrillosjs:copy-components",
509
+ apply: s ? "serve" : "build",
510
+ generateBundle(i, a) {
511
+ return p(this, null, function* () {
512
+ const l = w.resolve(process.cwd(), e), c = w.resolve(process.cwd(), "dist", r);
513
+ if (!w.existsSync(l)) {
514
+ console.warn(
515
+ `[ladrillosjs:copy-components] Source directory not found: ${l}`
516
+ );
517
+ return;
518
+ }
519
+ try {
520
+ w.existsSync(c) && w.rmSync(c, { recursive: !0, force: !0 }), w.cpSync(l, c, { recursive: !0 }), console.log(
521
+ `[ladrillosjs:copy-components] Copied components from ${l} to ${c}`
522
+ );
523
+ } catch (d) {
524
+ throw console.error(
525
+ "[ladrillosjs:copy-components] Error copying components:",
526
+ d
527
+ ), d;
528
+ }
529
+ });
530
+ }
531
+ };
532
+ }
533
+ const se = (t, e, r, s) => R.registerComponent(t, e, r, s), oe = (t) => p(null, null, function* () {
501
534
  yield Promise.all(
502
535
  t.map(
503
- ({ name: e, path: r, useShadowDOM: s, lazy: o }) => F.registerComponent(e, r, s, o)
536
+ ({ name: e, path: r, useShadowDOM: s, lazy: o }) => R.registerComponent(e, r, s, o)
504
537
  )
505
538
  );
506
- }), oe = (t, e) => R.listen(t, e), ne = (t, e) => {
507
- R.emit(t, e);
508
- }, we = (t, e) => {
539
+ }), ne = (t, e) => q.listen(t, e), ie = (t, e) => {
540
+ q.emit(t, e);
541
+ }, Ee = (t, e) => {
509
542
  if (e) {
510
543
  const r = e.tagName.toLowerCase();
511
544
  window.__ladrilloContexts || (window.__ladrilloContexts = /* @__PURE__ */ new Map()), window.__ladrilloContexts.set(r, { shadowRoot: t, element: e });
512
545
  }
513
- }, E = () => {
546
+ }, S = () => {
514
547
  const t = window.__ladrilloContexts;
515
548
  if (t && t.size > 0) {
516
549
  const e = Array.from(t.values());
517
550
  return e[e.length - 1];
518
551
  }
519
552
  return null;
520
- }, ie = () => {
521
- const t = E();
553
+ }, le = () => {
554
+ const t = S();
522
555
  return t && t.element ? t.element.state || {} : {};
523
- }, S = (t) => {
524
- const e = E();
556
+ }, b = (t) => {
557
+ const e = S();
525
558
  e && e.setState && e.setState(t);
526
- }, ae = (t, e) => (S({ [t]: e }), (r) => {
527
- S({ [t]: r });
528
- }), le = (t, e) => {
559
+ }, ae = (t, e) => (b({ [t]: e }), (r) => {
560
+ b({ [t]: r });
561
+ }), ce = (t, e) => {
529
562
  if (e)
530
563
  return e.querySelector(t);
531
- const r = E();
564
+ const r = S();
532
565
  if (r) {
533
566
  const s = r.shadowRoot || r.element;
534
567
  if (s) {
@@ -537,10 +570,10 @@ const R = new te(), re = (t, e, r, s) => F.registerComponent(t, e, r, s), se = (
537
570
  }
538
571
  }
539
572
  return document.querySelector(t);
540
- }, ce = (t, e) => {
573
+ }, de = (t, e) => {
541
574
  if (e)
542
575
  return e.querySelectorAll(t);
543
- const r = E();
576
+ const r = S();
544
577
  if (r) {
545
578
  const s = r.shadowRoot || r.element;
546
579
  if (s) {
@@ -551,30 +584,31 @@ const R = new te(), re = (t, e, r, s) => F.registerComponent(t, e, r, s), se = (
551
584
  return document.querySelectorAll(t);
552
585
  };
553
586
  typeof window != "undefined" && (window.ladrillosjs = {
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);
587
+ registerComponent: se,
588
+ registerComponents: oe
589
+ }, window.$listen = ne, window.$emit = ie, window.$querySelector = ce, window.$querySelectorAll = de, window.$reactive = ae, window.$setState = b, window.$getState = le);
557
590
  export {
558
- oe as $,
559
- b as R,
560
- we as _,
561
- pe as a,
562
- he as b,
563
- ye as c,
564
- ge as d,
565
- ue as e,
566
- R as f,
591
+ ne as $,
592
+ v as R,
593
+ Ee as _,
594
+ ue as a,
595
+ me as b,
596
+ we as c,
597
+ he as d,
598
+ ge as e,
599
+ q as f,
567
600
  fe as g,
568
601
  n as h,
569
- me as i,
570
- se as j,
571
- ne as k,
602
+ ye as i,
603
+ oe as j,
604
+ ie as k,
572
605
  M as l,
573
- ie as m,
574
- S as n,
606
+ le as m,
607
+ b as n,
575
608
  ae as o,
576
- le as p,
577
- ce as q,
578
- re as r
609
+ ce as p,
610
+ de as q,
611
+ se as r,
612
+ Ce as s
579
613
  };
580
- //# sourceMappingURL=index-JWdjGiUA.mjs.map
614
+ //# sourceMappingURL=index-COl4zCLy.mjs.map