@jasonshimmy/custom-elements-runtime 2.5.0 → 2.5.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/dist/custom-elements-runtime.cjs.js +1 -18
- package/dist/custom-elements-runtime.cjs.js.map +1 -1
- package/dist/custom-elements-runtime.es.js +150 -3644
- package/dist/custom-elements-runtime.es.js.map +1 -1
- package/dist/custom-elements-runtime.router.cjs.js +19 -19
- package/dist/custom-elements-runtime.router.cjs.js.map +1 -1
- package/dist/custom-elements-runtime.router.es.js +762 -451
- package/dist/custom-elements-runtime.router.es.js.map +1 -1
- package/dist/custom-elements-runtime.ssr.cjs.js +1 -1
- package/dist/custom-elements-runtime.ssr.es.js +1 -1
- package/dist/custom-elements-runtime.transitions.cjs.js +1 -1
- package/dist/custom-elements-runtime.transitions.es.js +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/namespace-helpers-BCVTzhAO.cjs +5 -0
- package/dist/namespace-helpers-BCVTzhAO.cjs.map +1 -0
- package/dist/namespace-helpers-CF28TyaG.js +786 -0
- package/dist/namespace-helpers-CF28TyaG.js.map +1 -0
- package/dist/router.d.ts +82 -21
- package/dist/runtime/monitoring/health-monitor.d.ts +99 -0
- package/dist/runtime/render.d.ts +1 -1
- package/dist/runtime/scheduler.d.ts +46 -0
- package/dist/template-compiler-CXHEnaBh.cjs +17 -0
- package/dist/template-compiler-CXHEnaBh.cjs.map +1 -0
- package/dist/template-compiler-DD_VZrte.js +3729 -0
- package/dist/template-compiler-DD_VZrte.js.map +1 -0
- package/dist/{transitions-CZ21fzhh.js → transitions-Bx0Nc9zR.js} +256 -255
- package/dist/transitions-Bx0Nc9zR.js.map +1 -0
- package/dist/{transitions-RXe2brRm.cjs → transitions-DfcqL-X4.cjs} +4 -4
- package/dist/transitions-DfcqL-X4.cjs.map +1 -0
- package/package.json +9 -8
- package/dist/namespace-helpers-BsKQl3aH.cjs +0 -5
- package/dist/namespace-helpers-BsKQl3aH.cjs.map +0 -1
- package/dist/namespace-helpers-Dw1mgQab.js +0 -692
- package/dist/namespace-helpers-Dw1mgQab.js.map +0 -1
- package/dist/transitions-CZ21fzhh.js.map +0 -1
- package/dist/transitions-RXe2brRm.cjs.map +0 -1
|
@@ -0,0 +1,786 @@
|
|
|
1
|
+
import { d as L, a as m } from "./logger-BuUYv7C_.js";
|
|
2
|
+
function x() {
|
|
3
|
+
const n = (() => {
|
|
4
|
+
try {
|
|
5
|
+
return globalThis.process?.env?.NODE_ENV;
|
|
6
|
+
} catch {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
})(), e = (() => {
|
|
10
|
+
try {
|
|
11
|
+
if (typeof window > "u")
|
|
12
|
+
return { vitest: !1, cypress: !1 };
|
|
13
|
+
const t = window;
|
|
14
|
+
return {
|
|
15
|
+
vitest: !!t.__vitest__,
|
|
16
|
+
cypress: !!t.Cypress
|
|
17
|
+
};
|
|
18
|
+
} catch {
|
|
19
|
+
return { vitest: !1, cypress: !1 };
|
|
20
|
+
}
|
|
21
|
+
})();
|
|
22
|
+
return {
|
|
23
|
+
isTest: n === "test" || e.vitest || e.cypress,
|
|
24
|
+
isVitest: e.vitest,
|
|
25
|
+
isCypress: e.cypress
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
class N {
|
|
29
|
+
pendingUpdates = /* @__PURE__ */ new Map();
|
|
30
|
+
isFlushScheduled = !1;
|
|
31
|
+
isFlushing = !1;
|
|
32
|
+
testEnv;
|
|
33
|
+
lastCleanup = 0;
|
|
34
|
+
CLEANUP_INTERVAL = 300 * 1e3;
|
|
35
|
+
// 5 minutes
|
|
36
|
+
MAX_PENDING_SIZE = 1e4;
|
|
37
|
+
// Prevent memory bloat
|
|
38
|
+
constructor() {
|
|
39
|
+
this.testEnv = x(), this.schedulePeriodicCleanup();
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Schedule an update to be executed in the next microtask
|
|
43
|
+
* Uses component identity to deduplicate multiple render requests for the same component
|
|
44
|
+
*/
|
|
45
|
+
schedule(e, s) {
|
|
46
|
+
const t = s || e;
|
|
47
|
+
this.pendingUpdates.size >= this.MAX_PENDING_SIZE && this.performEmergencyCleanup(), this.pendingUpdates.set(t, e), this.isFlushScheduled || this.scheduleFlush();
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Schedule the flush operation based on environment
|
|
51
|
+
*/
|
|
52
|
+
scheduleFlush() {
|
|
53
|
+
this.isFlushScheduled = !0, this.testEnv.isTest && !this.isFlushing ? this.flush() : queueMicrotask(() => this.flush());
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Execute all pending updates
|
|
57
|
+
*/
|
|
58
|
+
flush() {
|
|
59
|
+
if (this.isFlushing)
|
|
60
|
+
return;
|
|
61
|
+
this.isFlushing = !0;
|
|
62
|
+
const e = this.pendingUpdates;
|
|
63
|
+
this.pendingUpdates = /* @__PURE__ */ new Map(), this.isFlushScheduled = !1;
|
|
64
|
+
try {
|
|
65
|
+
for (const s of e.values())
|
|
66
|
+
try {
|
|
67
|
+
s();
|
|
68
|
+
} catch (t) {
|
|
69
|
+
L("Error in batched update:", t);
|
|
70
|
+
}
|
|
71
|
+
} finally {
|
|
72
|
+
this.isFlushing = !1;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Force flush any pending DOM updates immediately. This is useful in
|
|
77
|
+
* test environments or callers that require synchronous guarantees after
|
|
78
|
+
* state changes. Prefer relying on the scheduler's automatic flush when
|
|
79
|
+
* possible; use this only when a caller needs to synchronously observe
|
|
80
|
+
* rendered DOM changes.
|
|
81
|
+
*/
|
|
82
|
+
flushImmediately() {
|
|
83
|
+
this.pendingUpdates.size !== 0 && (this.isFlushScheduled = !1, this.flush());
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Get the number of pending updates
|
|
87
|
+
*/
|
|
88
|
+
get pendingCount() {
|
|
89
|
+
return this.pendingUpdates.size;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Check if there are pending updates
|
|
93
|
+
*/
|
|
94
|
+
get hasPendingUpdates() {
|
|
95
|
+
return this.pendingUpdates.size > 0;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Check if currently flushing updates
|
|
99
|
+
*/
|
|
100
|
+
get isFlushingUpdates() {
|
|
101
|
+
return this.isFlushing;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Schedule periodic cleanup to prevent memory leaks
|
|
105
|
+
*/
|
|
106
|
+
schedulePeriodicCleanup() {
|
|
107
|
+
if (this.testEnv.isTest) return;
|
|
108
|
+
const e = () => {
|
|
109
|
+
this.performPeriodicCleanup(), this.testEnv.isTest || setTimeout(e, this.CLEANUP_INTERVAL);
|
|
110
|
+
};
|
|
111
|
+
setTimeout(e, this.CLEANUP_INTERVAL);
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Perform periodic cleanup of stale entries
|
|
115
|
+
*/
|
|
116
|
+
performPeriodicCleanup() {
|
|
117
|
+
const e = Date.now();
|
|
118
|
+
e - this.lastCleanup < this.CLEANUP_INTERVAL || (this.pendingUpdates.size > 100 && m(
|
|
119
|
+
`Scheduler has ${this.pendingUpdates.size} pending updates. Consider investigating.`
|
|
120
|
+
), this.lastCleanup = e);
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Emergency cleanup when pending updates exceed safe limits
|
|
124
|
+
*/
|
|
125
|
+
performEmergencyCleanup() {
|
|
126
|
+
m(
|
|
127
|
+
"Scheduler emergency cleanup: too many pending updates, clearing oldest entries"
|
|
128
|
+
);
|
|
129
|
+
const e = Array.from(this.pendingUpdates.entries()), s = Math.floor(e.length / 2);
|
|
130
|
+
for (let t = 0; t < s; t++)
|
|
131
|
+
this.pendingUpdates.delete(e[t][0]);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
const b = new N();
|
|
135
|
+
function D(n, e) {
|
|
136
|
+
b.schedule(n, e);
|
|
137
|
+
}
|
|
138
|
+
function I() {
|
|
139
|
+
b.flushImmediately();
|
|
140
|
+
}
|
|
141
|
+
const w = /* @__PURE__ */ new WeakSet();
|
|
142
|
+
class H {
|
|
143
|
+
static cache = /* @__PURE__ */ new WeakMap();
|
|
144
|
+
static arrayHandlerCache = /* @__PURE__ */ new WeakMap();
|
|
145
|
+
static objectHandlerCache = /* @__PURE__ */ new WeakMap();
|
|
146
|
+
/**
|
|
147
|
+
* Get or create a reactive proxy for an object
|
|
148
|
+
*/
|
|
149
|
+
static getOrCreateProxy(e, s, t = !1) {
|
|
150
|
+
const r = this.cache.get(e);
|
|
151
|
+
if (r)
|
|
152
|
+
return r;
|
|
153
|
+
const a = t ? this.getOrCreateArrayHandler(s) : this.getOrCreateObjectHandler(s), i = new Proxy(e, a);
|
|
154
|
+
try {
|
|
155
|
+
A.markAsProxy(i);
|
|
156
|
+
} catch {
|
|
157
|
+
}
|
|
158
|
+
return this.cache.set(e, i), i;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Get or create a cached array handler
|
|
162
|
+
*/
|
|
163
|
+
static getOrCreateArrayHandler(e) {
|
|
164
|
+
if (!this.arrayHandlerCache.has(e)) {
|
|
165
|
+
const s = {
|
|
166
|
+
get: (t, r, a) => {
|
|
167
|
+
const i = Reflect.get(t, r, a);
|
|
168
|
+
return typeof i == "function" && typeof r == "string" && [
|
|
169
|
+
"push",
|
|
170
|
+
"pop",
|
|
171
|
+
"shift",
|
|
172
|
+
"unshift",
|
|
173
|
+
"splice",
|
|
174
|
+
"sort",
|
|
175
|
+
"reverse",
|
|
176
|
+
"fill",
|
|
177
|
+
"copyWithin"
|
|
178
|
+
].includes(r) ? function(...u) {
|
|
179
|
+
const d = i.apply(t, u);
|
|
180
|
+
return e.triggerUpdate(), d;
|
|
181
|
+
} : i;
|
|
182
|
+
},
|
|
183
|
+
set: (t, r, a) => (t[r] = e.makeReactiveValue(a), e.triggerUpdate(), !0),
|
|
184
|
+
deleteProperty: (t, r) => (delete t[r], e.triggerUpdate(), !0)
|
|
185
|
+
};
|
|
186
|
+
this.arrayHandlerCache.set(e, s);
|
|
187
|
+
}
|
|
188
|
+
return this.arrayHandlerCache.get(e);
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Get or create a cached object handler
|
|
192
|
+
*/
|
|
193
|
+
static getOrCreateObjectHandler(e) {
|
|
194
|
+
if (!this.objectHandlerCache.has(e)) {
|
|
195
|
+
const s = {
|
|
196
|
+
get: (t, r, a) => Reflect.get(t, r, a),
|
|
197
|
+
set: (t, r, a) => (t[r] = e.makeReactiveValue(a), e.triggerUpdate(), !0),
|
|
198
|
+
deleteProperty: (t, r) => (delete t[r], e.triggerUpdate(), !0)
|
|
199
|
+
};
|
|
200
|
+
this.objectHandlerCache.set(e, s);
|
|
201
|
+
}
|
|
202
|
+
return this.objectHandlerCache.get(e);
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Check if an object already has a cached proxy
|
|
206
|
+
*/
|
|
207
|
+
static hasProxy(e) {
|
|
208
|
+
return this.cache.has(e);
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Clear all cached proxies (useful for testing)
|
|
212
|
+
*/
|
|
213
|
+
static clear() {
|
|
214
|
+
this.cache = /* @__PURE__ */ new WeakMap(), this.arrayHandlerCache = /* @__PURE__ */ new WeakMap(), this.objectHandlerCache = /* @__PURE__ */ new WeakMap();
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Get cache statistics (for debugging)
|
|
218
|
+
* Note: WeakMap doesn't provide size, so this is limited
|
|
219
|
+
*/
|
|
220
|
+
static getStats() {
|
|
221
|
+
return {
|
|
222
|
+
hasCachedProxies: this.cache instanceof WeakMap
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
class A {
|
|
227
|
+
// Cache a stable reactiveContext object keyed by onUpdate -> makeReactive
|
|
228
|
+
// This allows handler caches in ReactiveProxyCache to reuse handlers
|
|
229
|
+
// for identical reactive contexts instead of creating a new context object
|
|
230
|
+
// on each createReactiveProxy call.
|
|
231
|
+
static contextCache = /* @__PURE__ */ new WeakMap();
|
|
232
|
+
/**
|
|
233
|
+
* Create an optimized reactive proxy with minimal overhead
|
|
234
|
+
*/
|
|
235
|
+
static createReactiveProxy(e, s, t) {
|
|
236
|
+
try {
|
|
237
|
+
if (w.has(e)) return e;
|
|
238
|
+
} catch {
|
|
239
|
+
}
|
|
240
|
+
const r = Array.isArray(e);
|
|
241
|
+
let a = this.contextCache.get(s);
|
|
242
|
+
a || (a = /* @__PURE__ */ new WeakMap(), this.contextCache.set(s, a));
|
|
243
|
+
let i = a.get(t);
|
|
244
|
+
return i || (i = {
|
|
245
|
+
triggerUpdate: s,
|
|
246
|
+
makeReactiveValue: t
|
|
247
|
+
}, a.set(t, i)), H.getOrCreateProxy(e, i, r);
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Mark an object as a proxy (for optimization)
|
|
251
|
+
*/
|
|
252
|
+
static markAsProxy(e) {
|
|
253
|
+
if (e)
|
|
254
|
+
try {
|
|
255
|
+
w.add(e);
|
|
256
|
+
} catch {
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
class P {
|
|
261
|
+
// Use a stack to support nested callers (component render -> watcher)
|
|
262
|
+
// so that watchers can temporarily become the "current component" while
|
|
263
|
+
// establishing dependencies without clobbering the outer component id.
|
|
264
|
+
currentComponentStack = [];
|
|
265
|
+
// Consolidated component data: stores dependencies, render function, state index, and last warning time
|
|
266
|
+
componentData = /* @__PURE__ */ new Map();
|
|
267
|
+
// Flat storage: compound key `${componentId}:${stateIndex}` -> ReactiveState
|
|
268
|
+
stateStorage = /* @__PURE__ */ new Map();
|
|
269
|
+
trackingDisabled = !1;
|
|
270
|
+
/**
|
|
271
|
+
* Set the current component being rendered for dependency tracking
|
|
272
|
+
*/
|
|
273
|
+
setCurrentComponent(e, s) {
|
|
274
|
+
if (this.currentComponentStack.push(e), !this.componentData.has(e))
|
|
275
|
+
this.componentData.set(e, {
|
|
276
|
+
dependencies: /* @__PURE__ */ new Set(),
|
|
277
|
+
renderFn: s,
|
|
278
|
+
stateIndex: 0,
|
|
279
|
+
lastWarnTime: 0,
|
|
280
|
+
watchers: /* @__PURE__ */ new Map()
|
|
281
|
+
});
|
|
282
|
+
else {
|
|
283
|
+
const t = this.componentData.get(e);
|
|
284
|
+
if (t.watchers && t.watchers.size) {
|
|
285
|
+
for (const r of t.watchers.values())
|
|
286
|
+
try {
|
|
287
|
+
this.cleanup(r);
|
|
288
|
+
} catch {
|
|
289
|
+
}
|
|
290
|
+
t.watchers.clear();
|
|
291
|
+
}
|
|
292
|
+
t.renderFn = s, t.stateIndex = 0;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Clear the current component after rendering
|
|
297
|
+
*/
|
|
298
|
+
clearCurrentComponent() {
|
|
299
|
+
this.currentComponentStack.pop();
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* Get the current component id (top of stack) or null
|
|
303
|
+
*/
|
|
304
|
+
getCurrentComponentId() {
|
|
305
|
+
return this.currentComponentStack.length ? this.currentComponentStack[this.currentComponentStack.length - 1] : null;
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* Register a watcher id under a component so it can be cleaned up on re-render
|
|
309
|
+
*/
|
|
310
|
+
registerWatcher(e, s) {
|
|
311
|
+
const t = this.componentData.get(e);
|
|
312
|
+
t && t.watchers.set(s, s);
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* Temporarily disable dependency tracking
|
|
316
|
+
*/
|
|
317
|
+
disableTracking() {
|
|
318
|
+
this.trackingDisabled = !0;
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* Re-enable dependency tracking
|
|
322
|
+
*/
|
|
323
|
+
enableTracking() {
|
|
324
|
+
this.trackingDisabled = !1;
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Check if a component is currently rendering
|
|
328
|
+
*/
|
|
329
|
+
isRenderingComponent() {
|
|
330
|
+
return this.currentComponentStack.length > 0;
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* Return whether we should emit a render-time warning for the current component.
|
|
334
|
+
* This throttles warnings to avoid spamming the console for legitimate rapid updates.
|
|
335
|
+
*/
|
|
336
|
+
shouldEmitRenderWarning() {
|
|
337
|
+
const e = this.currentComponentStack.length ? this.currentComponentStack[this.currentComponentStack.length - 1] : null;
|
|
338
|
+
if (!e) return !0;
|
|
339
|
+
const s = this.componentData.get(e);
|
|
340
|
+
if (!s) return !0;
|
|
341
|
+
const t = Date.now();
|
|
342
|
+
return t - s.lastWarnTime < 1e3 ? !1 : (s.lastWarnTime = t, !0);
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Execute a function with tracking disabled
|
|
346
|
+
*/
|
|
347
|
+
withoutTracking(e) {
|
|
348
|
+
const s = this.trackingDisabled;
|
|
349
|
+
this.trackingDisabled = !0;
|
|
350
|
+
try {
|
|
351
|
+
return e();
|
|
352
|
+
} finally {
|
|
353
|
+
this.trackingDisabled = s;
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* Get or create a state instance for the current component
|
|
358
|
+
*/
|
|
359
|
+
getOrCreateState(e) {
|
|
360
|
+
const s = this.currentComponentStack.length ? this.currentComponentStack[this.currentComponentStack.length - 1] : null;
|
|
361
|
+
if (!s)
|
|
362
|
+
return new g(e);
|
|
363
|
+
const t = this.componentData.get(s);
|
|
364
|
+
if (!t)
|
|
365
|
+
return new g(e);
|
|
366
|
+
const r = `${s}:${t.stateIndex++}`;
|
|
367
|
+
let a = this.stateStorage.get(r);
|
|
368
|
+
return a || (a = new g(e), this.stateStorage.set(r, a)), a;
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* Track a dependency for the current component
|
|
372
|
+
*/
|
|
373
|
+
trackDependency(e) {
|
|
374
|
+
if (this.trackingDisabled) return;
|
|
375
|
+
const s = this.currentComponentStack.length ? this.currentComponentStack[this.currentComponentStack.length - 1] : null;
|
|
376
|
+
if (!s) return;
|
|
377
|
+
const t = this.componentData.get(s);
|
|
378
|
+
t && (t.dependencies.add(e), e.addDependent(s));
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
381
|
+
* Trigger updates for all components that depend on a state
|
|
382
|
+
*/
|
|
383
|
+
triggerUpdate(e) {
|
|
384
|
+
const s = e.getDependents();
|
|
385
|
+
for (const t of s) {
|
|
386
|
+
const r = this.componentData.get(t);
|
|
387
|
+
r && D(r.renderFn, t);
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
/**
|
|
391
|
+
* Clean up component dependencies when component is destroyed
|
|
392
|
+
*/
|
|
393
|
+
cleanup(e) {
|
|
394
|
+
const s = this.componentData.get(e);
|
|
395
|
+
if (s) {
|
|
396
|
+
for (const r of s.dependencies)
|
|
397
|
+
r.removeDependent(e);
|
|
398
|
+
this.componentData.delete(e);
|
|
399
|
+
}
|
|
400
|
+
const t = e + ":";
|
|
401
|
+
for (const r of this.stateStorage.keys())
|
|
402
|
+
r.startsWith(t) && this.stateStorage.delete(r);
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
const o = new P();
|
|
406
|
+
class g {
|
|
407
|
+
_value;
|
|
408
|
+
dependents = /* @__PURE__ */ new Set();
|
|
409
|
+
constructor(e) {
|
|
410
|
+
this._value = this.makeReactive(e);
|
|
411
|
+
try {
|
|
412
|
+
const s = Symbol.for("@cer/ReactiveState");
|
|
413
|
+
Object.defineProperty(this, s, {
|
|
414
|
+
value: !0,
|
|
415
|
+
enumerable: !1,
|
|
416
|
+
configurable: !1
|
|
417
|
+
});
|
|
418
|
+
} catch {
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
get value() {
|
|
422
|
+
return o.trackDependency(this), this._value;
|
|
423
|
+
}
|
|
424
|
+
set value(e) {
|
|
425
|
+
o.isRenderingComponent() && o.shouldEmitRenderWarning() && m(
|
|
426
|
+
`🚨 State modification detected during render! This can cause infinite loops.
|
|
427
|
+
• Move state updates to event handlers
|
|
428
|
+
• Use useEffect/watch for side effects
|
|
429
|
+
• Ensure computed properties don't modify state`
|
|
430
|
+
), this._value = this.makeReactive(e), o.triggerUpdate(this);
|
|
431
|
+
}
|
|
432
|
+
addDependent(e) {
|
|
433
|
+
this.dependents.add(e);
|
|
434
|
+
}
|
|
435
|
+
removeDependent(e) {
|
|
436
|
+
this.dependents.delete(e);
|
|
437
|
+
}
|
|
438
|
+
getDependents() {
|
|
439
|
+
return this.dependents;
|
|
440
|
+
}
|
|
441
|
+
makeReactive(e) {
|
|
442
|
+
return e === null || typeof e != "object" || e instanceof Node || e instanceof Element || e instanceof HTMLElement ? e : A.createReactiveProxy(
|
|
443
|
+
e,
|
|
444
|
+
() => o.triggerUpdate(this),
|
|
445
|
+
(s) => this.makeReactive(s)
|
|
446
|
+
);
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
function j(n) {
|
|
450
|
+
return o.getOrCreateState(
|
|
451
|
+
n === void 0 ? null : n
|
|
452
|
+
);
|
|
453
|
+
}
|
|
454
|
+
function y(n) {
|
|
455
|
+
if (!n || typeof n != "object") return !1;
|
|
456
|
+
try {
|
|
457
|
+
const e = Symbol.for("@cer/ReactiveState");
|
|
458
|
+
return Object.prototype.hasOwnProperty.call(n, e);
|
|
459
|
+
} catch {
|
|
460
|
+
return !1;
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
function z(n) {
|
|
464
|
+
const e = new g(n());
|
|
465
|
+
return {
|
|
466
|
+
get value() {
|
|
467
|
+
return o.trackDependency(e), n();
|
|
468
|
+
}
|
|
469
|
+
};
|
|
470
|
+
}
|
|
471
|
+
function V(n, e, s) {
|
|
472
|
+
let t;
|
|
473
|
+
const r = y(n) ? () => n.value : n, a = `watch-${Math.random().toString(36).substr(2, 9)}`;
|
|
474
|
+
try {
|
|
475
|
+
const c = o.getCurrentComponentId();
|
|
476
|
+
c && o.registerWatcher(c, a);
|
|
477
|
+
} catch {
|
|
478
|
+
}
|
|
479
|
+
const i = () => {
|
|
480
|
+
o.setCurrentComponent(a, i);
|
|
481
|
+
const c = r();
|
|
482
|
+
o.clearCurrentComponent(), c !== t && (e(c, t), t = c);
|
|
483
|
+
};
|
|
484
|
+
return o.setCurrentComponent(a, i), t = r(), o.clearCurrentComponent(), s && s.immediate && e(t, void 0), () => {
|
|
485
|
+
o.cleanup(a);
|
|
486
|
+
};
|
|
487
|
+
}
|
|
488
|
+
const $ = (n) => {
|
|
489
|
+
try {
|
|
490
|
+
n();
|
|
491
|
+
} catch {
|
|
492
|
+
}
|
|
493
|
+
}, h = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map(), C = 500;
|
|
494
|
+
let E, k, S = !1, _ = !1, M;
|
|
495
|
+
const R = !!globalThis.process?.versions?.node;
|
|
496
|
+
function q(n) {
|
|
497
|
+
if (h.has(n))
|
|
498
|
+
return h.get(n);
|
|
499
|
+
const e = n.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
|
500
|
+
return h.size < C && h.set(n, e), e;
|
|
501
|
+
}
|
|
502
|
+
function G(n) {
|
|
503
|
+
if (p.has(n))
|
|
504
|
+
return p.get(n);
|
|
505
|
+
const e = n.replace(/-([a-z])/g, (s, t) => t.toUpperCase());
|
|
506
|
+
return p.size < C && p.set(n, e), e;
|
|
507
|
+
}
|
|
508
|
+
function Z(n) {
|
|
509
|
+
if (typeof n == "string") {
|
|
510
|
+
if (f.has(n))
|
|
511
|
+
return f.get(n);
|
|
512
|
+
const e = n.replace(
|
|
513
|
+
/[&<>"']/g,
|
|
514
|
+
(s) => ({
|
|
515
|
+
"&": "&",
|
|
516
|
+
"<": "<",
|
|
517
|
+
">": ">",
|
|
518
|
+
'"': """,
|
|
519
|
+
"'": "'"
|
|
520
|
+
})[s]
|
|
521
|
+
);
|
|
522
|
+
return e !== n && f.size < C && f.set(n, e), e;
|
|
523
|
+
}
|
|
524
|
+
return n;
|
|
525
|
+
}
|
|
526
|
+
function l(n) {
|
|
527
|
+
if (!n) return "";
|
|
528
|
+
const e = String(n);
|
|
529
|
+
if (typeof document < "u" && typeof document.createElement == "function") {
|
|
530
|
+
const c = e.replace(/</g, "").replace(/>/g, ""), u = M || (M = document.createElement("div"));
|
|
531
|
+
try {
|
|
532
|
+
l._el = u;
|
|
533
|
+
} catch {
|
|
534
|
+
}
|
|
535
|
+
return u.innerHTML = c, (u.textContent || "").replace(new RegExp("", "g"), "<").replace(new RegExp("", "g"), ">");
|
|
536
|
+
}
|
|
537
|
+
const s = {
|
|
538
|
+
lt: "<",
|
|
539
|
+
gt: ">",
|
|
540
|
+
amp: "&",
|
|
541
|
+
quot: '"',
|
|
542
|
+
apos: "'",
|
|
543
|
+
nbsp: " "
|
|
544
|
+
}, t = E ?? l._namedMap;
|
|
545
|
+
let r = t;
|
|
546
|
+
if (!r && R)
|
|
547
|
+
try {
|
|
548
|
+
const a = globalThis.require;
|
|
549
|
+
if (typeof a == "function") {
|
|
550
|
+
const i = [
|
|
551
|
+
"@jasonshimmy/custom-elements-runtime/entities.json",
|
|
552
|
+
// installed package export
|
|
553
|
+
"../../entities.json",
|
|
554
|
+
// dist/runtime -> ../../entities.json
|
|
555
|
+
"../../../entities.json",
|
|
556
|
+
// src/lib/runtime -> ../../../entities.json
|
|
557
|
+
"../entities.json",
|
|
558
|
+
"./entities.json"
|
|
559
|
+
];
|
|
560
|
+
for (const c of i)
|
|
561
|
+
try {
|
|
562
|
+
const u = a(c);
|
|
563
|
+
if (u && typeof u == "object") {
|
|
564
|
+
r = u;
|
|
565
|
+
break;
|
|
566
|
+
}
|
|
567
|
+
} catch {
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
} catch {
|
|
571
|
+
}
|
|
572
|
+
if (!r) {
|
|
573
|
+
r = s, S = !0;
|
|
574
|
+
try {
|
|
575
|
+
l._usedFallback = !0;
|
|
576
|
+
} catch {
|
|
577
|
+
}
|
|
578
|
+
const a = l._namedMapLoader ?? k;
|
|
579
|
+
a && a().then((i) => {
|
|
580
|
+
E = i;
|
|
581
|
+
try {
|
|
582
|
+
l._namedMap = i;
|
|
583
|
+
} catch {
|
|
584
|
+
}
|
|
585
|
+
}).catch(() => {
|
|
586
|
+
});
|
|
587
|
+
}
|
|
588
|
+
if ((S || l._usedFallback) && !(_ || l._warnedFallback)) {
|
|
589
|
+
_ = !0;
|
|
590
|
+
try {
|
|
591
|
+
l._warnedFallback = !0;
|
|
592
|
+
} catch {
|
|
593
|
+
}
|
|
594
|
+
try {
|
|
595
|
+
m(
|
|
596
|
+
"decodeEntities: using small SSR fallback entity map. Register the full entities.json via registerEntityMap(entities) on the server to enable full HTML5 named-entity decoding."
|
|
597
|
+
);
|
|
598
|
+
} catch {
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
return e.replace(/&(#x?[0-9a-fA-F]+|[a-zA-Z]+);/g, (a, i) => {
|
|
602
|
+
if (i.charCodeAt(0) === 35) {
|
|
603
|
+
const d = (i.charAt(1) || "").toLowerCase() === "x" ? parseInt(i.slice(2), 16) : parseInt(i.slice(1), 10);
|
|
604
|
+
return Number.isNaN(d) ? `&${i};` : String.fromCodePoint(d);
|
|
605
|
+
}
|
|
606
|
+
const c = r[i] ?? (t && t[i]);
|
|
607
|
+
return c !== void 0 ? c : `&${i};`;
|
|
608
|
+
});
|
|
609
|
+
}
|
|
610
|
+
async function T() {
|
|
611
|
+
const n = [
|
|
612
|
+
"@jasonshimmy",
|
|
613
|
+
"custom-elements-runtime",
|
|
614
|
+
"entities.json"
|
|
615
|
+
].join("/");
|
|
616
|
+
try {
|
|
617
|
+
const e = await import(
|
|
618
|
+
/* @vite-ignore */
|
|
619
|
+
n
|
|
620
|
+
);
|
|
621
|
+
return e && (e.default || e);
|
|
622
|
+
} catch {
|
|
623
|
+
try {
|
|
624
|
+
const e = [
|
|
625
|
+
n,
|
|
626
|
+
// try package export via dynamic import too (best for installed packages)
|
|
627
|
+
"./entities.json",
|
|
628
|
+
"../../entities.json",
|
|
629
|
+
"../../../entities.json"
|
|
630
|
+
];
|
|
631
|
+
for (const s of e)
|
|
632
|
+
try {
|
|
633
|
+
const t = await import(
|
|
634
|
+
/* @vite-ignore */
|
|
635
|
+
s
|
|
636
|
+
);
|
|
637
|
+
if (t)
|
|
638
|
+
return t && (t.default || t);
|
|
639
|
+
} catch {
|
|
640
|
+
}
|
|
641
|
+
return {
|
|
642
|
+
lt: "<",
|
|
643
|
+
gt: ">",
|
|
644
|
+
amp: "&",
|
|
645
|
+
quot: '"',
|
|
646
|
+
apos: "'",
|
|
647
|
+
nbsp: " "
|
|
648
|
+
};
|
|
649
|
+
} catch {
|
|
650
|
+
return {
|
|
651
|
+
lt: "<",
|
|
652
|
+
gt: ">",
|
|
653
|
+
amp: "&",
|
|
654
|
+
quot: '"',
|
|
655
|
+
apos: "'",
|
|
656
|
+
nbsp: " "
|
|
657
|
+
};
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
k = T;
|
|
662
|
+
l._namedMapLoader = T;
|
|
663
|
+
function B(n) {
|
|
664
|
+
const e = String(n);
|
|
665
|
+
return { __unsafeHTML: e, __rawHTML: e };
|
|
666
|
+
}
|
|
667
|
+
function K(n) {
|
|
668
|
+
return !!n && (typeof n.__unsafeHTML == "string" || typeof n.__rawHTML == "string");
|
|
669
|
+
}
|
|
670
|
+
function X(n, e) {
|
|
671
|
+
if (typeof e == "string") {
|
|
672
|
+
if (e === "") return;
|
|
673
|
+
const s = e.split(".");
|
|
674
|
+
let t = n;
|
|
675
|
+
for (const r of s) {
|
|
676
|
+
if (t == null || typeof t != "object") {
|
|
677
|
+
t = void 0;
|
|
678
|
+
break;
|
|
679
|
+
}
|
|
680
|
+
t = t[r];
|
|
681
|
+
}
|
|
682
|
+
return y(t) ? t.value : t;
|
|
683
|
+
}
|
|
684
|
+
return e;
|
|
685
|
+
}
|
|
686
|
+
function J(n, e, s) {
|
|
687
|
+
const t = String(e).split("."), r = t.pop();
|
|
688
|
+
if (!r) return;
|
|
689
|
+
const a = t.reduce(
|
|
690
|
+
(i, c) => (i[c] == null && (i[c] = {}), i[c]),
|
|
691
|
+
n
|
|
692
|
+
);
|
|
693
|
+
y(a[r]) ? a[r].value = s : a[r] = s;
|
|
694
|
+
}
|
|
695
|
+
function U(n) {
|
|
696
|
+
try {
|
|
697
|
+
if (n && typeof n == "object") {
|
|
698
|
+
if (y(n)) return n.value;
|
|
699
|
+
if ("value" in n) {
|
|
700
|
+
const e = n.value;
|
|
701
|
+
return e == null || typeof e == "string" || typeof e == "number" || typeof e == "boolean" ? e : n;
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
} catch {
|
|
705
|
+
}
|
|
706
|
+
return n;
|
|
707
|
+
}
|
|
708
|
+
function Q(n) {
|
|
709
|
+
const e = U(n);
|
|
710
|
+
if (e == null) return null;
|
|
711
|
+
const s = typeof e;
|
|
712
|
+
return s === "string" || s === "number" || s === "boolean" ? String(e) : null;
|
|
713
|
+
}
|
|
714
|
+
function Y(n) {
|
|
715
|
+
if (!n || typeof n != "string") return !1;
|
|
716
|
+
if (n === "class" || n.endsWith("Class")) return !0;
|
|
717
|
+
if (n.includes("-"))
|
|
718
|
+
try {
|
|
719
|
+
if (n.split("-").some((s) => s === "class")) return !0;
|
|
720
|
+
} catch {
|
|
721
|
+
}
|
|
722
|
+
return !1;
|
|
723
|
+
}
|
|
724
|
+
const v = {
|
|
725
|
+
xlink: "http://www.w3.org/1999/xlink",
|
|
726
|
+
xml: "http://www.w3.org/XML/1998/namespace"
|
|
727
|
+
};
|
|
728
|
+
function ee(n, e, s) {
|
|
729
|
+
try {
|
|
730
|
+
if (!e || !e.includes(":")) {
|
|
731
|
+
n.setAttribute(e, s);
|
|
732
|
+
return;
|
|
733
|
+
}
|
|
734
|
+
const t = e.indexOf(":"), r = e.substring(0, t), a = e.substring(t + 1), i = v[r];
|
|
735
|
+
i ? n.setAttributeNS(i, a, s) : n.setAttribute(e, s);
|
|
736
|
+
} catch {
|
|
737
|
+
try {
|
|
738
|
+
n.setAttribute(e, s);
|
|
739
|
+
} catch {
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
function te(n, e) {
|
|
744
|
+
try {
|
|
745
|
+
if (!e || !e.includes(":")) {
|
|
746
|
+
n.removeAttribute(e);
|
|
747
|
+
return;
|
|
748
|
+
}
|
|
749
|
+
const s = e.indexOf(":"), t = e.substring(0, s), r = e.substring(s + 1), a = v[t];
|
|
750
|
+
a ? n.removeAttributeNS(a, r) : n.removeAttribute(e);
|
|
751
|
+
} catch {
|
|
752
|
+
try {
|
|
753
|
+
n.removeAttribute(e);
|
|
754
|
+
} catch {
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
const F = "http://www.w3.org/2000/svg", O = "http://www.w3.org/1998/Math/MathML", ne = {
|
|
759
|
+
svg: F,
|
|
760
|
+
math: O
|
|
761
|
+
};
|
|
762
|
+
export {
|
|
763
|
+
F as S,
|
|
764
|
+
ne as T,
|
|
765
|
+
$ as a,
|
|
766
|
+
Q as b,
|
|
767
|
+
z as c,
|
|
768
|
+
l as d,
|
|
769
|
+
Z as e,
|
|
770
|
+
I as f,
|
|
771
|
+
X as g,
|
|
772
|
+
ee as h,
|
|
773
|
+
y as i,
|
|
774
|
+
te as j,
|
|
775
|
+
G as k,
|
|
776
|
+
Y as l,
|
|
777
|
+
o as m,
|
|
778
|
+
D as n,
|
|
779
|
+
K as o,
|
|
780
|
+
j as r,
|
|
781
|
+
J as s,
|
|
782
|
+
q as t,
|
|
783
|
+
B as u,
|
|
784
|
+
V as w
|
|
785
|
+
};
|
|
786
|
+
//# sourceMappingURL=namespace-helpers-CF28TyaG.js.map
|