@vielzeug/ore 26.10.17 → 26.10.18
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/errors.cjs +1 -1
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.d.ts +1 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +1 -1
- package/dist/errors.js.map +1 -1
- package/dist/ore.cjs +2 -2
- package/dist/ore.cjs.map +1 -1
- package/dist/ore.iife.js +2 -2
- package/dist/ore.iife.js.map +1 -1
- package/dist/ore.js +115 -109
- package/dist/ore.js.map +1 -1
- package/dist/template/compiler.cjs +1 -1
- package/dist/template/compiler.cjs.map +1 -1
- package/dist/template/compiler.d.ts.map +1 -1
- package/dist/template/compiler.js +1 -1
- package/dist/template/compiler.js.map +1 -1
- package/dist/utils/dom.cjs +1 -1
- package/dist/utils/dom.cjs.map +1 -1
- package/dist/utils/dom.d.ts.map +1 -1
- package/dist/utils/dom.js +1 -1
- package/dist/utils/dom.js.map +1 -1
- package/package.json +5 -5
package/dist/ore.js
CHANGED
|
@@ -32,6 +32,7 @@ var s = {
|
|
|
32
32
|
listenNullTarget: (e) => `listen() called with a null/undefined target for event "${e}": listener not attached`,
|
|
33
33
|
modelRequiresValueBinding: (e) => `model(): "${e}" must be a plain value/checked attribute binding, not a boolean attribute. Bind it as ${e}=\${model(sig)}, not ?${e}=\${model(sig)}.`,
|
|
34
34
|
propBindingForbiddenName: (e) => `html\`...\`: ".${e}" is a forbidden property-binding name (prototype pollution guard)`,
|
|
35
|
+
propBindingHtmlInjectionName: (e) => `html\`...\`: ".${e}" parses raw HTML and is not a supported property binding. Sanitize untrusted content, then bind it with the unsafeHtml() directive.`,
|
|
35
36
|
propInvalidReflect: "Structured props cannot use reflect:true: use prop.json() with reflect:false",
|
|
36
37
|
templateInterpolationInTag: "html`...`: interpolations inside a tag must be named attributes, boolean attributes, events, or refs",
|
|
37
38
|
useFieldAlreadyCalled: (e) => `useField() was already called on <${e}>. Call it only once per component.`,
|
|
@@ -74,7 +75,7 @@ var resolveMaybeReactive = (e) => typeof e == "function" ? e() : i(e) ? e.value
|
|
|
74
75
|
"poster",
|
|
75
76
|
"src",
|
|
76
77
|
"xlink:href"
|
|
77
|
-
]), u = /^\s*(?:(?:javascript|vbscript|blob):|data:(?:[^,]*\/(?:html|svg\+xml)|application\/(?:xhtml|xml)))/i, setAttr = (e, t, n) => {
|
|
78
|
+
]), u = /^\s*(?:(?:javascript|vbscript|blob):|data:(?:[^,]*\/(?:html|svg\+xml)|application\/(?:xhtml|xml)))/i, d = /[\t\n\r]/g, f = /^[\s\p{C}]+|[\s\p{C}]+$/gu, normalizeUrlForSchemeCheck = (e) => e.replace(d, "").replace(f, ""), isDangerousUrl = (e) => u.test(normalizeUrlForSchemeCheck(e)), setAttr = (e, t, n) => {
|
|
78
79
|
let r = t.toLowerCase();
|
|
79
80
|
if (/^on[a-z]/i.test(t)) {
|
|
80
81
|
`${t}${t.slice(2)}`, e.removeAttribute(t);
|
|
@@ -85,7 +86,7 @@ var resolveMaybeReactive = (e) => typeof e == "function" ? e() : i(e) ? e.value
|
|
|
85
86
|
return;
|
|
86
87
|
}
|
|
87
88
|
let i = n === !0 ? "true" : String(n);
|
|
88
|
-
l.has(r) &&
|
|
89
|
+
l.has(r) && isDangerousUrl(i) ? (`${t}`, e.removeAttribute(t)) : e.setAttribute(t, i);
|
|
89
90
|
}, listen = (e, t, n, r) => {
|
|
90
91
|
if (!e) return s.listenNullTarget(t), () => {};
|
|
91
92
|
let i = n;
|
|
@@ -101,28 +102,28 @@ var resolveMaybeReactive = (e) => typeof e == "function" ? e() : i(e) ? e.value
|
|
|
101
102
|
e && t.add(e);
|
|
102
103
|
}
|
|
103
104
|
return t;
|
|
104
|
-
}, isStructuredValue = (e) => Array.isArray(e) || typeof e == "object" && !!e,
|
|
105
|
+
}, isStructuredValue = (e) => Array.isArray(e) || typeof e == "object" && !!e, p = null, createRuntimeContext = (e) => ({
|
|
105
106
|
element: e,
|
|
106
107
|
formResetCallbacks: [],
|
|
107
108
|
mountCallbacks: []
|
|
108
|
-
}),
|
|
109
|
-
|
|
109
|
+
}), m = 0, beginPendingWork = () => {
|
|
110
|
+
m++;
|
|
110
111
|
let e = !1;
|
|
111
112
|
return () => {
|
|
112
|
-
e || (e = !0,
|
|
113
|
+
e || (e = !0, m--);
|
|
113
114
|
};
|
|
114
115
|
}, runWithContext = (e, t) => {
|
|
115
|
-
let n =
|
|
116
|
-
|
|
116
|
+
let n = p;
|
|
117
|
+
p = e;
|
|
117
118
|
try {
|
|
118
119
|
return t();
|
|
119
120
|
} finally {
|
|
120
|
-
|
|
121
|
+
p = n;
|
|
121
122
|
}
|
|
122
123
|
}, requireSetupContext = (e) => {
|
|
123
|
-
if (
|
|
124
|
+
if (p) return p;
|
|
124
125
|
throw new OreApiError(`${e}: ${s.lifecycleOutsideSetup}`);
|
|
125
|
-
}, getHost = () => requireSetupContext("getHost").element, tryRegisterCleanup = (e) =>
|
|
126
|
+
}, getHost = () => requireSetupContext("getHost").element, tryRegisterCleanup = (e) => p ? (r(() => e), !0) : !1, onCleanup = (e) => {
|
|
126
127
|
if (!tryRegisterCleanup(e)) throw new OreApiError(`onCleanup: ${s.lifecycleOutsideSetup}`);
|
|
127
128
|
}, onMounted = (e) => {
|
|
128
129
|
requireSetupContext("onMounted").mountCallbacks.push(e);
|
|
@@ -140,39 +141,39 @@ function onEvent(e, t, n, r) {
|
|
|
140
141
|
var onElement = (e, t) => watchEffect(() => {
|
|
141
142
|
let n = e.value;
|
|
142
143
|
if (n) return t(n);
|
|
143
|
-
}),
|
|
144
|
+
}), h = /* @__PURE__ */ new WeakMap(), buildAncestorChain = (e) => {
|
|
144
145
|
let t = [], n = e;
|
|
145
146
|
for (; n;) n instanceof HTMLElement && t.push(n), n = n.parentNode ?? (n instanceof ShadowRoot ? n.host : null);
|
|
146
147
|
return t;
|
|
147
148
|
}, provideOnElement = (e, t, n) => {
|
|
148
|
-
let r =
|
|
149
|
-
r.has(t) && `${e.localName}`, r.set(t, n),
|
|
149
|
+
let r = h.get(e) ?? /* @__PURE__ */ new Map();
|
|
150
|
+
r.has(t) && `${e.localName}`, r.set(t, n), h.set(e, r);
|
|
150
151
|
}, provide = (e, t) => {
|
|
151
152
|
let n = requireSetupContext("provide").element;
|
|
152
153
|
provideOnElement(n, e, t), onCleanup(() => {
|
|
153
|
-
let t =
|
|
154
|
-
t && (t.delete(e), t.size === 0 &&
|
|
154
|
+
let t = h.get(n);
|
|
155
|
+
t && (t.delete(e), t.size === 0 && h.delete(n));
|
|
155
156
|
});
|
|
156
|
-
},
|
|
157
|
+
}, g = Symbol("inject.not_found"), _ = /* @__PURE__ */ new WeakMap(), walkAndFind = (e, t) => {
|
|
157
158
|
let n = buildAncestorChain(e);
|
|
158
159
|
for (let e of n) {
|
|
159
|
-
let n =
|
|
160
|
+
let n = h.get(e);
|
|
160
161
|
if (n?.has(t)) return n.get(t);
|
|
161
162
|
}
|
|
162
|
-
return
|
|
163
|
+
return g;
|
|
163
164
|
}, lookup = (e, t) => {
|
|
164
|
-
let n =
|
|
165
|
-
n || (n = /* @__PURE__ */ new Map(),
|
|
165
|
+
let n = _.get(e);
|
|
166
|
+
n || (n = /* @__PURE__ */ new Map(), _.set(e, n));
|
|
166
167
|
let r = t;
|
|
167
168
|
return n.has(r) || n.set(r, walkAndFind(e.element, t)), n.get(r);
|
|
168
169
|
};
|
|
169
170
|
function inject(e, ...t) {
|
|
170
171
|
let n = lookup(requireSetupContext("inject"), e);
|
|
171
|
-
return n ===
|
|
172
|
+
return n === g ? t.length > 0 ? t[0] : void 0 : n;
|
|
172
173
|
}
|
|
173
174
|
var injectStrict = (e) => {
|
|
174
175
|
let t = requireSetupContext("injectStrict"), n = lookup(t, e);
|
|
175
|
-
if (n !==
|
|
176
|
+
if (n !== g) return n;
|
|
176
177
|
throw new OreApiError(s.injectStrictFailed(String(e), t.element.localName));
|
|
177
178
|
};
|
|
178
179
|
function createContext(e) {
|
|
@@ -206,7 +207,7 @@ function _stringProp(e) {
|
|
|
206
207
|
reflect: !0
|
|
207
208
|
};
|
|
208
209
|
}
|
|
209
|
-
var
|
|
210
|
+
var v = {
|
|
210
211
|
bool(e) {
|
|
211
212
|
return {
|
|
212
213
|
default: e ?? !1,
|
|
@@ -271,9 +272,9 @@ function validatePropDefs(e) {
|
|
|
271
272
|
}
|
|
272
273
|
return t;
|
|
273
274
|
}
|
|
274
|
-
var
|
|
275
|
-
let i =
|
|
276
|
-
i || (i = /* @__PURE__ */ new Map(),
|
|
275
|
+
var y = /* @__PURE__ */ new WeakMap(), getPropMeta = (e, t) => y.get(e)?.get(t), coerceIncoming = (e, t) => typeof e == "string" ? t(e) : e, registerProp = (e, t, n, r) => {
|
|
276
|
+
let i = y.get(e);
|
|
277
|
+
i || (i = /* @__PURE__ */ new Map(), y.set(e, i));
|
|
277
278
|
let { default: o, parse: s, reflect: c = !1 } = r, l = a(o), u = i.get(n), d = Object.hasOwn(e, t), f = d ? e[t] : void 0, p = {
|
|
278
279
|
parse: s,
|
|
279
280
|
reflect: c,
|
|
@@ -304,34 +305,34 @@ var makeBrand = (e) => {
|
|
|
304
305
|
is,
|
|
305
306
|
stamp
|
|
306
307
|
};
|
|
307
|
-
},
|
|
308
|
+
}, b = makeBrand("ore:css-result"), x = b.is, cssResultToString = function() {
|
|
308
309
|
return this.content;
|
|
309
310
|
}, css = (e, ...t) => {
|
|
310
311
|
let n = "";
|
|
311
312
|
for (let r = 0; r < e.length; r++) if (n += e[r], r < t.length) {
|
|
312
313
|
let e = t[r];
|
|
313
|
-
n +=
|
|
314
|
+
n += x(e) ? e.content : String(e);
|
|
314
315
|
}
|
|
315
|
-
return
|
|
316
|
+
return b.stamp({
|
|
316
317
|
content: n.trim(),
|
|
317
318
|
toString: cssResultToString
|
|
318
319
|
});
|
|
319
|
-
},
|
|
320
|
+
}, S = /* @__PURE__ */ new Map(), C = 256, loadStylesheet = (e) => {
|
|
320
321
|
if (e instanceof CSSStyleSheet) return e;
|
|
321
|
-
let t = typeof e == "string" ? e : e.content, n =
|
|
322
|
-
if (n) return
|
|
322
|
+
let t = typeof e == "string" ? e : e.content, n = S.get(t);
|
|
323
|
+
if (n) return S.delete(t), S.set(t, n), n;
|
|
323
324
|
let r = new CSSStyleSheet();
|
|
324
325
|
try {
|
|
325
326
|
r.replaceSync(t);
|
|
326
327
|
} catch {
|
|
327
328
|
return r;
|
|
328
329
|
}
|
|
329
|
-
if (
|
|
330
|
-
let e =
|
|
331
|
-
e !== void 0 &&
|
|
330
|
+
if (S.set(t, r), S.size > C) {
|
|
331
|
+
let e = S.keys().next().value;
|
|
332
|
+
e !== void 0 && S.delete(e);
|
|
332
333
|
}
|
|
333
334
|
return r;
|
|
334
|
-
},
|
|
335
|
+
}, w = {
|
|
335
336
|
SETUP_DONE: "setup_done",
|
|
336
337
|
SETUP_RUNNING: "setup_running",
|
|
337
338
|
UNINITIALIZED: "uninitialized",
|
|
@@ -340,7 +341,7 @@ var makeBrand = (e) => {
|
|
|
340
341
|
formResetCallbacks: [],
|
|
341
342
|
generation: 0,
|
|
342
343
|
mountCallbacks: [],
|
|
343
|
-
phase:
|
|
344
|
+
phase: w.UNINITIALIZED,
|
|
344
345
|
scope: n(),
|
|
345
346
|
templateResult: null
|
|
346
347
|
}), isPromiseLike = (e) => (typeof e == "object" || typeof e == "function") && e !== null && "then" in e && typeof e.then == "function", BaseElement = class extends HTMLElement {
|
|
@@ -359,7 +360,7 @@ var makeBrand = (e) => {
|
|
|
359
360
|
}
|
|
360
361
|
connectedCallback() {
|
|
361
362
|
o(() => {
|
|
362
|
-
this._component.phase ===
|
|
363
|
+
this._component.phase === w.UNINITIALIZED && this._runSetup(), this._init();
|
|
363
364
|
});
|
|
364
365
|
}
|
|
365
366
|
attributeChangedCallback(e, t, n) {
|
|
@@ -370,10 +371,10 @@ var makeBrand = (e) => {
|
|
|
370
371
|
Object.is(o(() => r.signal.value), i) || (r.signal.value = i);
|
|
371
372
|
}
|
|
372
373
|
disconnectedCallback() {
|
|
373
|
-
this._component.generation++, this._component.phase =
|
|
374
|
+
this._component.generation++, this._component.phase = w.UNMOUNTED, this._resetSetupState();
|
|
374
375
|
}
|
|
375
376
|
_resetSetupState() {
|
|
376
|
-
this._component.scope.dispose(), this._component.formResetCallbacks = [], this._component.mountCallbacks = [], this._component.phase =
|
|
377
|
+
this._component.scope.dispose(), this._component.formResetCallbacks = [], this._component.mountCallbacks = [], this._component.phase = w.UNINITIALIZED, this._component.scope = n(), this._component.templateResult = null;
|
|
377
378
|
}
|
|
378
379
|
formResetCallback() {
|
|
379
380
|
for (let e of this._component.formResetCallbacks) try {
|
|
@@ -391,7 +392,7 @@ var makeBrand = (e) => {
|
|
|
391
392
|
}), this);
|
|
392
393
|
}
|
|
393
394
|
_runSetup() {
|
|
394
|
-
this._component.phase =
|
|
395
|
+
this._component.phase = w.SETUP_RUNNING;
|
|
395
396
|
let e = this.constructor._definition, t = this.constructor._normalizedPropDefs, n = createRuntimeContext(this);
|
|
396
397
|
try {
|
|
397
398
|
let r;
|
|
@@ -401,7 +402,7 @@ var makeBrand = (e) => {
|
|
|
401
402
|
return e.setup(n);
|
|
402
403
|
});
|
|
403
404
|
}), this._component.mountCallbacks.push(...n.mountCallbacks), this._component.formResetCallbacks.push(...n.formResetCallbacks), isPromiseLike(r)) throw new OreApiError(s.asyncSetupUnsupported);
|
|
404
|
-
this._component.templateResult = r ?? null, this._component.phase =
|
|
405
|
+
this._component.templateResult = r ?? null, this._component.phase = w.SETUP_DONE;
|
|
405
406
|
} catch (e) {
|
|
406
407
|
throw this._reportLifecycleError(e, "setup"), this._resetSetupState(), e;
|
|
407
408
|
}
|
|
@@ -419,7 +420,7 @@ var makeBrand = (e) => {
|
|
|
419
420
|
});
|
|
420
421
|
}
|
|
421
422
|
_init() {
|
|
422
|
-
this._applyStyles(), this._mountTemplate(), this._component.phase ===
|
|
423
|
+
this._applyStyles(), this._mountTemplate(), this._component.phase === w.SETUP_DONE && this._scheduleMountCallbacks();
|
|
423
424
|
}
|
|
424
425
|
_applyStyles() {
|
|
425
426
|
let e = this.constructor._definition;
|
|
@@ -484,13 +485,13 @@ var classMap = (e) => t(() => [...resolveClassTokens(e)].join(" "));
|
|
|
484
485
|
function ref() {
|
|
485
486
|
return a(null);
|
|
486
487
|
}
|
|
487
|
-
var
|
|
488
|
+
var T = makeBrand("ore:directive"), createDirectiveResult = (e) => T.stamp({ mount: e }), E = T.is, D = makeBrand("ore:html-result"), O = D.is;
|
|
488
489
|
function createHtmlResult(e, t) {
|
|
489
490
|
let mount = (n, r, i) => {
|
|
490
491
|
let a = Array.from(e.childNodes);
|
|
491
492
|
return n.insertBefore(e, r), t(i), a;
|
|
492
493
|
};
|
|
493
|
-
return
|
|
494
|
+
return D.stamp({
|
|
494
495
|
apply: t,
|
|
495
496
|
fragment: e,
|
|
496
497
|
mount
|
|
@@ -600,7 +601,7 @@ function each(e, n, i, s) {
|
|
|
600
601
|
}
|
|
601
602
|
//#endregion
|
|
602
603
|
//#region src/directives/live.ts
|
|
603
|
-
var
|
|
604
|
+
var k = makeBrand("ore:live"), live = (e) => k.stamp({ source: e }), A = k.is, j = makeBrand("ore:model"), M = j.is, modelDefaultGet = (e) => e instanceof HTMLInputElement && (e.type === "checkbox" || e.type === "radio") ? e.checked : e.value, modelDefaultEvent = (e) => e instanceof HTMLInputElement && (e.type === "checkbox" || e.type === "radio") || e instanceof HTMLSelectElement ? "change" : "input", model = (e, t) => j.stamp({
|
|
604
605
|
event: t?.event,
|
|
605
606
|
get: t?.get,
|
|
606
607
|
source: e
|
|
@@ -638,25 +639,25 @@ function unsafeHtml(e) {
|
|
|
638
639
|
}
|
|
639
640
|
//#endregion
|
|
640
641
|
//#region src/directives/when.ts
|
|
641
|
-
var
|
|
642
|
+
var N = "when() anchor comment has no parent node";
|
|
642
643
|
function when(e, n, a) {
|
|
643
644
|
return typeof e != "function" && !i(e) ? createDirectiveResult((t, r) => {
|
|
644
645
|
let i = e ? n() : a ? a() : null;
|
|
645
|
-
if (!i || !
|
|
646
|
+
if (!i || !O(i)) return;
|
|
646
647
|
let o = t.parentNode;
|
|
647
|
-
invariant(o,
|
|
648
|
+
invariant(o, N);
|
|
648
649
|
let s = i.mount(o, t, r);
|
|
649
650
|
r(() => removeNodes(s));
|
|
650
651
|
}) : createDirectiveResult((i, s) => {
|
|
651
652
|
let c = (typeof e == "function" ? t(e) : null) ?? e, l = i.parentNode;
|
|
652
|
-
invariant(l,
|
|
653
|
+
invariant(l, N);
|
|
653
654
|
let u = document.createComment("when/end");
|
|
654
655
|
l.insertBefore(u, i.nextSibling);
|
|
655
656
|
let d = createReplaceableSlot(), f = r(() => {
|
|
656
657
|
let e = c.value;
|
|
657
658
|
d.clear();
|
|
658
659
|
let t = e ? n() : a ? a() : null;
|
|
659
|
-
t &&
|
|
660
|
+
t && O(t) && d.setNodes(o(() => t.mount(l, u, d.registerCleanup)));
|
|
660
661
|
});
|
|
661
662
|
s(() => f.dispose()), s(() => {
|
|
662
663
|
d.clear(), u.remove();
|
|
@@ -665,12 +666,12 @@ function when(e, n, a) {
|
|
|
665
666
|
}
|
|
666
667
|
//#endregion
|
|
667
668
|
//#region src/forms/field.ts
|
|
668
|
-
var
|
|
669
|
+
var P = /* @__PURE__ */ new WeakMap(), F = /* @__PURE__ */ new WeakSet(), useField = (e) => {
|
|
669
670
|
let t = getHost();
|
|
670
671
|
if (!t.constructor.formAssociated) throw new OreApiError(s.defineFieldRequiresFormAssociated(t.localName));
|
|
671
|
-
if (
|
|
672
|
-
let n =
|
|
673
|
-
|
|
672
|
+
if (F.has(t)) throw new OreApiError(s.useFieldAlreadyCalled(t.localName));
|
|
673
|
+
let n = P.get(t) ?? t.attachInternals();
|
|
674
|
+
P.set(t, n), F.add(t), onCleanup(() => F.delete(t));
|
|
674
675
|
let r = e.toFormValue ?? ((t) => t == null ? e.emptyStringForNull ? "" : null : t instanceof File || t instanceof FormData ? t : String(t));
|
|
675
676
|
watchEffect(() => {
|
|
676
677
|
n.setFormValue(r(e.value.value));
|
|
@@ -701,7 +702,7 @@ var M = /* @__PURE__ */ new WeakMap(), N = /* @__PURE__ */ new WeakSet(), useFie
|
|
|
701
702
|
}, normalizeHostAttrKey = (e) => e === "role" || e.startsWith("aria-") ? e : e.startsWith("aria") ? `aria-${e.slice(4).toLowerCase()}` : e, bind = (e, t) => {
|
|
702
703
|
let n = t?.target ?? getHost(), r = [];
|
|
703
704
|
if (e.attr) for (let [t, i] of Object.entries(e.attr)) {
|
|
704
|
-
let e = applyAttribute(n,
|
|
705
|
+
let e = applyAttribute(n, I(t), i);
|
|
705
706
|
e && r.push(e);
|
|
706
707
|
}
|
|
707
708
|
if (e.class && r.push(applyClassMap(n, e.class)), e.style) for (let [t, i] of Object.entries(e.style)) {
|
|
@@ -719,7 +720,7 @@ var M = /* @__PURE__ */ new WeakMap(), N = /* @__PURE__ */ new WeakSet(), useFie
|
|
|
719
720
|
for (let e of r) e();
|
|
720
721
|
};
|
|
721
722
|
return tryRegisterCleanup(cleanup), cleanup;
|
|
722
|
-
},
|
|
723
|
+
}, I = normalizeHostAttrKey, applyReactiveBinding = (e, t) => {
|
|
723
724
|
if (typeof e == "function") return watchEffect(() => {
|
|
724
725
|
t(e());
|
|
725
726
|
});
|
|
@@ -751,7 +752,7 @@ function applyClassMap(e, t) {
|
|
|
751
752
|
}
|
|
752
753
|
//#endregion
|
|
753
754
|
//#region src/slots.ts
|
|
754
|
-
var
|
|
755
|
+
var L = "default", normalizeSlotName = (e) => e || L, createSlots = (e) => {
|
|
755
756
|
let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), ensureSlotEntry = (e) => {
|
|
756
757
|
let n = t.get(e);
|
|
757
758
|
return n || (n = {
|
|
@@ -801,14 +802,14 @@ var F = "default", normalizeSlotName = (e) => e || F, createSlots = (e) => {
|
|
|
801
802
|
return onMounted(initSlots), onCleanup(() => {
|
|
802
803
|
i?.disconnect(), i = null;
|
|
803
804
|
for (let e of r.values()) e();
|
|
804
|
-
r.clear(), n.clear(), t.clear(),
|
|
805
|
+
r.clear(), n.clear(), t.clear(), R.delete(e);
|
|
805
806
|
}), {
|
|
806
807
|
elements: (e) => ensureSlotEntry(normalizeSlotName(e)).elements,
|
|
807
808
|
has: (e) => ensureSlotEntry(normalizeSlotName(e)).presence
|
|
808
809
|
};
|
|
809
|
-
},
|
|
810
|
-
let e = requireSetupContext("useSlots"), t =
|
|
811
|
-
return t || (t = createSlots(e.element),
|
|
810
|
+
}, R = /* @__PURE__ */ new WeakMap(), useSlots = () => {
|
|
811
|
+
let e = requireSetupContext("useSlots"), t = R.get(e.element);
|
|
812
|
+
return t || (t = createSlots(e.element), R.set(e.element, t)), t;
|
|
812
813
|
}, signalEffect = (e, t, n) => {
|
|
813
814
|
let i = r(() => {
|
|
814
815
|
t(e.value);
|
|
@@ -860,7 +861,7 @@ var F = "default", normalizeSlotName = (e) => e || F, createSlots = (e) => {
|
|
|
860
861
|
}, insertHtmlValues = (e, t, n) => {
|
|
861
862
|
let r = [], i = t.parentNode;
|
|
862
863
|
invariant(i, "html binding anchor has no parent node");
|
|
863
|
-
for (let a of e) if (
|
|
864
|
+
for (let a of e) if (O(a)) {
|
|
864
865
|
let e = Array.from(a.fragment.childNodes);
|
|
865
866
|
i.insertBefore(a.fragment, t), a.apply(n), r.push(...e);
|
|
866
867
|
} else if (a != null && a !== !1) {
|
|
@@ -902,7 +903,7 @@ var F = "default", normalizeSlotName = (e) => e || F, createSlots = (e) => {
|
|
|
902
903
|
break;
|
|
903
904
|
case "ref": applyRefBinding(e, t);
|
|
904
905
|
}
|
|
905
|
-
}, createAttrBindingFromValue = (e, n, r, a) =>
|
|
906
|
+
}, createAttrBindingFromValue = (e, n, r, a) => A(a) ? {
|
|
906
907
|
el: e,
|
|
907
908
|
live: !0,
|
|
908
909
|
mode: n,
|
|
@@ -927,14 +928,14 @@ var F = "default", normalizeSlotName = (e) => e || F, createSlots = (e) => {
|
|
|
927
928
|
name: r,
|
|
928
929
|
type: "attr",
|
|
929
930
|
value: a
|
|
930
|
-
}, resolveStaticText = (e) => e == null ? "" : String(e),
|
|
931
|
+
}, resolveStaticText = (e) => e == null ? "" : String(e), z = {
|
|
931
932
|
ATTR: "attr",
|
|
932
933
|
BOOL_ATTR: "boolAttr",
|
|
933
934
|
EVENT: "event",
|
|
934
935
|
NODE: "node",
|
|
935
936
|
PROP: "prop",
|
|
936
937
|
REF: "ref"
|
|
937
|
-
},
|
|
938
|
+
}, B = {
|
|
938
939
|
capture: !0,
|
|
939
940
|
once: !0,
|
|
940
941
|
prevent: !0,
|
|
@@ -943,68 +944,73 @@ var F = "default", normalizeSlotName = (e) => e || F, createSlots = (e) => {
|
|
|
943
944
|
if (t.length === 0) return;
|
|
944
945
|
let n = {};
|
|
945
946
|
for (let r of t) {
|
|
946
|
-
if (!(r in
|
|
947
|
+
if (!(r in B)) throw new OreApiError(s.eventModifierUnknown(e, r));
|
|
947
948
|
n[r] = !0;
|
|
948
949
|
}
|
|
949
950
|
return n;
|
|
950
|
-
},
|
|
951
|
+
}, V = /\s+@([a-zA-Z_][-a-zA-Z0-9_.-]*)\s*=\s*["']?$/, H = /\s+ref\s*=\s*["']?$/, U = /\s+\?([a-zA-Z_][-a-zA-Z0-9_]*)\s*=\s*["']?$/, W = /\s+\.([a-zA-Z_][-a-zA-Z0-9_]*)\s*=\s*["']?$/, G = /\s+([a-zA-Z_][-a-zA-Z0-9_]*)\s*=\s*["']?$/, K = /* @__PURE__ */ new Set([
|
|
952
|
+
"innerhtml",
|
|
953
|
+
"outerhtml",
|
|
954
|
+
"srcdoc"
|
|
955
|
+
]), detectSlot = (e) => {
|
|
951
956
|
let t;
|
|
952
|
-
if (t =
|
|
957
|
+
if (t = V.exec(e)) {
|
|
953
958
|
let n = e.slice(0, -t[0].length), [r, ...i] = t[1].split(".");
|
|
954
959
|
return {
|
|
955
960
|
eventModifiers: parseEventModifiers(r, i),
|
|
956
|
-
kind:
|
|
961
|
+
kind: z.EVENT,
|
|
957
962
|
name: r,
|
|
958
963
|
prefix: n
|
|
959
964
|
};
|
|
960
965
|
}
|
|
961
|
-
if (t =
|
|
962
|
-
kind:
|
|
966
|
+
if (t = H.exec(e)) return {
|
|
967
|
+
kind: z.REF,
|
|
963
968
|
prefix: e.slice(0, -t[0].length)
|
|
964
969
|
};
|
|
965
|
-
if (t =
|
|
966
|
-
kind:
|
|
970
|
+
if (t = U.exec(e)) return {
|
|
971
|
+
kind: z.BOOL_ATTR,
|
|
967
972
|
name: t[1],
|
|
968
973
|
prefix: e.slice(0, -t[0].length)
|
|
969
974
|
};
|
|
970
|
-
if (t =
|
|
975
|
+
if (t = W.exec(e)) {
|
|
971
976
|
let n = t[1];
|
|
972
977
|
if (n === "__proto__" || n === "constructor" || n === "prototype") throw new OreApiError(s.propBindingForbiddenName(n));
|
|
978
|
+
if (K.has(n.toLowerCase())) throw new OreApiError(s.propBindingHtmlInjectionName(n));
|
|
973
979
|
return {
|
|
974
|
-
kind:
|
|
980
|
+
kind: z.PROP,
|
|
975
981
|
name: n,
|
|
976
982
|
prefix: e.slice(0, -t[0].length)
|
|
977
983
|
};
|
|
978
984
|
}
|
|
979
|
-
if (t =
|
|
980
|
-
kind:
|
|
985
|
+
if (t = G.exec(e)) return {
|
|
986
|
+
kind: z.ATTR,
|
|
981
987
|
name: t[1],
|
|
982
988
|
prefix: e.slice(0, -t[0].length)
|
|
983
989
|
};
|
|
984
990
|
let n = e.lastIndexOf("<");
|
|
985
991
|
if (n > e.lastIndexOf(">") && e[n + 1] !== "/") throw new OreApiError(s.templateInterpolationInTag);
|
|
986
992
|
return {
|
|
987
|
-
kind:
|
|
993
|
+
kind: z.NODE,
|
|
988
994
|
prefix: e
|
|
989
995
|
};
|
|
990
|
-
},
|
|
996
|
+
}, q = /* @__PURE__ */ new WeakMap(), J = /[@?]?[a-zA-Z_][-a-zA-Z0-9_.]*\s*=\s*$/, normalizeTemplateStrings = (e) => {
|
|
991
997
|
let t = Array.from(e), n = !1;
|
|
992
998
|
for (let e = 0; e < t.length - 1; e++) {
|
|
993
999
|
let r = t[e], i = r[r.length - 1];
|
|
994
1000
|
for (let e of r) e === "<" ? n = !0 : e === ">" && (n = !1);
|
|
995
|
-
if ((i === "\"" || i === "'") && n &&
|
|
1001
|
+
if ((i === "\"" || i === "'") && n && J.test(r.slice(0, -1))) {
|
|
996
1002
|
t[e] = r.slice(0, -1);
|
|
997
1003
|
let n = t[e + 1];
|
|
998
1004
|
n.startsWith(i) && (t[e + 1] = n.slice(1));
|
|
999
1005
|
}
|
|
1000
1006
|
}
|
|
1001
1007
|
return t;
|
|
1002
|
-
},
|
|
1008
|
+
}, Y = "data-ore-b", X = /^ore:(\d+)$/, walkNode = (e, t, n, r) => {
|
|
1003
1009
|
if (e.nodeType === Node.ELEMENT_NODE) {
|
|
1004
|
-
let r = e, i = r.getAttribute(
|
|
1005
|
-
i !== null && (n.set(Number(i), [...t]), r.removeAttribute(
|
|
1010
|
+
let r = e, i = r.getAttribute(Y);
|
|
1011
|
+
i !== null && (n.set(Number(i), [...t]), r.removeAttribute(Y));
|
|
1006
1012
|
} else if (e.nodeType === Node.COMMENT_NODE) {
|
|
1007
|
-
let n = e.nodeValue, i = n === null ? null :
|
|
1013
|
+
let n = e.nodeValue, i = n === null ? null : X.exec(n);
|
|
1008
1014
|
i && r.set(Number(i[1]), [...t]);
|
|
1009
1015
|
}
|
|
1010
1016
|
let i = e.childNodes;
|
|
@@ -1013,13 +1019,13 @@ var F = "default", normalizeSlotName = (e) => e || F, createSlots = (e) => {
|
|
|
1013
1019
|
let t = normalizeTemplateStrings(e), n = "", r, i = 0, a = 0, o = [];
|
|
1014
1020
|
for (let e = 0; e < t.length - 1; e++) {
|
|
1015
1021
|
let s = t[e], c = detectSlot(s);
|
|
1016
|
-
if (c.kind ===
|
|
1022
|
+
if (c.kind === z.NODE) n += `${c.prefix}<!--ore:${a}-->`, o.push({
|
|
1017
1023
|
commentId: a,
|
|
1018
|
-
kind:
|
|
1024
|
+
kind: z.NODE
|
|
1019
1025
|
}), a++, r = void 0;
|
|
1020
1026
|
else {
|
|
1021
|
-
r === void 0 || c.prefix.lastIndexOf("<") > c.prefix.lastIndexOf(">") ? (r = i++, n += `${c.prefix} ${
|
|
1022
|
-
let e = c.kind ===
|
|
1027
|
+
r === void 0 || c.prefix.lastIndexOf("<") > c.prefix.lastIndexOf(">") ? (r = i++, n += `${c.prefix} ${Y}="${r}"`) : n += c.prefix;
|
|
1028
|
+
let e = c.kind === z.BOOL_ATTR ? "bool" : c.kind === z.ATTR ? "attr" : void 0;
|
|
1023
1029
|
o.push({
|
|
1024
1030
|
elementId: r,
|
|
1025
1031
|
eventModifiers: c.eventModifiers,
|
|
@@ -1041,20 +1047,20 @@ var F = "default", normalizeSlotName = (e) => e || F, createSlots = (e) => {
|
|
|
1041
1047
|
slots: o
|
|
1042
1048
|
};
|
|
1043
1049
|
}, getStaticTemplate = (e) => {
|
|
1044
|
-
let t =
|
|
1045
|
-
return t || (t = buildStaticTemplate(e),
|
|
1050
|
+
let t = q.get(e);
|
|
1051
|
+
return t || (t = buildStaticTemplate(e), q.set(e, t)), t;
|
|
1046
1052
|
}, followPath = (e, t) => {
|
|
1047
1053
|
let n = e;
|
|
1048
1054
|
for (let e of t) n = n.childNodes[e];
|
|
1049
1055
|
return n;
|
|
1050
|
-
},
|
|
1056
|
+
}, Z = "html`...`: node-slot comment anchor has no parent node", toHtmlValues = (e) => Array.isArray(e) ? e : [e], embedStaticResult = (e, t, n) => {
|
|
1051
1057
|
let r = t.parentNode;
|
|
1052
|
-
for (invariant(r,
|
|
1058
|
+
for (invariant(r, Z); e.fragment.firstChild;) r.insertBefore(e.fragment.firstChild, t);
|
|
1053
1059
|
n.push(e.apply.bind(e));
|
|
1054
1060
|
}, compileTemplate = (e, n) => {
|
|
1055
1061
|
let r = getStaticTemplate(e), a = r.element.content.cloneNode(!0), o = [], c = [], l = r.slots.map((e, t) => {
|
|
1056
1062
|
let i = n[t];
|
|
1057
|
-
if (e.kind ===
|
|
1063
|
+
if (e.kind === z.NODE) {
|
|
1058
1064
|
let t = e.commentId === void 0 ? void 0 : r.commentPaths.get(e.commentId);
|
|
1059
1065
|
return invariant(t, `compiled template is missing a comment path for node slot ${e.commentId}`), {
|
|
1060
1066
|
comment: followPath(a, t),
|
|
@@ -1069,9 +1075,9 @@ var F = "default", normalizeSlotName = (e) => e || F, createSlots = (e) => {
|
|
|
1069
1075
|
value: i
|
|
1070
1076
|
};
|
|
1071
1077
|
});
|
|
1072
|
-
for (let { comment: e, el: n, slot: r, value: a } of l) if (r.kind ===
|
|
1078
|
+
for (let { comment: e, el: n, slot: r, value: a } of l) if (r.kind === z.NODE) {
|
|
1073
1079
|
let n = e;
|
|
1074
|
-
if (invariant(n, "compiled template produced a node slot without a comment anchor"),
|
|
1080
|
+
if (invariant(n, "compiled template produced a node slot without a comment anchor"), E(a)) {
|
|
1075
1081
|
o.push({
|
|
1076
1082
|
anchor: n,
|
|
1077
1083
|
directive: a,
|
|
@@ -1079,7 +1085,7 @@ var F = "default", normalizeSlotName = (e) => e || F, createSlots = (e) => {
|
|
|
1079
1085
|
});
|
|
1080
1086
|
continue;
|
|
1081
1087
|
}
|
|
1082
|
-
if (
|
|
1088
|
+
if (O(a)) {
|
|
1083
1089
|
embedStaticResult(a, n, c), n.remove();
|
|
1084
1090
|
continue;
|
|
1085
1091
|
}
|
|
@@ -1093,16 +1099,16 @@ var F = "default", normalizeSlotName = (e) => e || F, createSlots = (e) => {
|
|
|
1093
1099
|
continue;
|
|
1094
1100
|
}
|
|
1095
1101
|
if (Array.isArray(a)) {
|
|
1096
|
-
for (let e of a) if (
|
|
1102
|
+
for (let e of a) if (O(e)) embedStaticResult(e, n, c);
|
|
1097
1103
|
else {
|
|
1098
1104
|
let t = n.parentNode;
|
|
1099
|
-
invariant(t,
|
|
1105
|
+
invariant(t, Z), t.insertBefore(document.createTextNode(resolveStaticText(e)), n);
|
|
1100
1106
|
}
|
|
1101
1107
|
n.remove();
|
|
1102
1108
|
continue;
|
|
1103
1109
|
}
|
|
1104
1110
|
n.replaceWith(document.createTextNode(resolveStaticText(a)));
|
|
1105
|
-
} else if (invariant(n, "compiled template produced an element slot without an element"), r.kind ===
|
|
1111
|
+
} else if (invariant(n, "compiled template produced an element slot without an element"), r.kind === z.EVENT) {
|
|
1106
1112
|
let e = r.name;
|
|
1107
1113
|
if (invariant(e, "compiled template produced an event slot without an event name"), typeof a == "function") o.push({
|
|
1108
1114
|
el: n,
|
|
@@ -1124,7 +1130,7 @@ var F = "default", normalizeSlotName = (e) => e || F, createSlots = (e) => {
|
|
|
1124
1130
|
type: "event"
|
|
1125
1131
|
});
|
|
1126
1132
|
}
|
|
1127
|
-
} else if (r.kind ===
|
|
1133
|
+
} else if (r.kind === z.PROP) {
|
|
1128
1134
|
let e = r.name;
|
|
1129
1135
|
invariant(e, "compiled template produced a prop slot without a property name"), typeof a == "function" ? o.push({
|
|
1130
1136
|
el: n,
|
|
@@ -1142,12 +1148,12 @@ var F = "default", normalizeSlotName = (e) => e || F, createSlots = (e) => {
|
|
|
1142
1148
|
type: "prop",
|
|
1143
1149
|
value: a
|
|
1144
1150
|
});
|
|
1145
|
-
} else if (r.kind ===
|
|
1151
|
+
} else if (r.kind === z.REF) a && o.push({
|
|
1146
1152
|
el: n,
|
|
1147
1153
|
ref: a,
|
|
1148
1154
|
type: "ref"
|
|
1149
1155
|
});
|
|
1150
|
-
else if (invariant(r.name, "compiled template produced an attr slot without an attribute name"),
|
|
1156
|
+
else if (invariant(r.name, "compiled template produced an attr slot without an attribute name"), M(a)) {
|
|
1151
1157
|
if (r.mode !== "attr") throw new OreApiError(s.modelRequiresValueBinding(r.name));
|
|
1152
1158
|
o.push({
|
|
1153
1159
|
el: n,
|
|
@@ -1161,7 +1167,7 @@ var F = "default", normalizeSlotName = (e) => e || F, createSlots = (e) => {
|
|
|
1161
1167
|
for (let t of o) applyBinding(t, e);
|
|
1162
1168
|
for (let t of c) t(e);
|
|
1163
1169
|
});
|
|
1164
|
-
}, html = (e, ...t) => compileTemplate(e, t),
|
|
1170
|
+
}, html = (e, ...t) => compileTemplate(e, t), Q = {
|
|
1165
1171
|
bubbles: !0,
|
|
1166
1172
|
cancelable: !0,
|
|
1167
1173
|
composed: !0
|
|
@@ -1169,13 +1175,13 @@ var F = "default", normalizeSlotName = (e) => e || F, createSlots = (e) => {
|
|
|
1169
1175
|
let e = getHost();
|
|
1170
1176
|
return ((t, ...n) => {
|
|
1171
1177
|
let r = n.length > 0 ? {
|
|
1172
|
-
...
|
|
1178
|
+
...Q,
|
|
1173
1179
|
detail: n[0]
|
|
1174
|
-
} :
|
|
1180
|
+
} : Q;
|
|
1175
1181
|
return e.dispatchEvent(new CustomEvent(String(t), r));
|
|
1176
1182
|
});
|
|
1177
|
-
},
|
|
1183
|
+
}, $ = 0, ee = Math.random().toString(36).slice(2, 6), createId = (e = "id") => `${e}-${ee}${++$}`;
|
|
1178
1184
|
//#endregion
|
|
1179
|
-
export { OreApiError, OreError, OreInternalError, OreLifecycleError, bind, classMap, createContext, createId, css, define, each, getHost, html, inject, injectStrict, live, model, onCleanup, onElement, onEvent, onFormReset, onMounted,
|
|
1185
|
+
export { OreApiError, OreError, OreInternalError, OreLifecycleError, bind, classMap, createContext, createId, css, define, each, getHost, html, inject, injectStrict, live, model, onCleanup, onElement, onEvent, onFormReset, onMounted, v as prop, provide, ref, styleMap, unsafeHtml, useEmit, useField, useSlots, watchEffect, when };
|
|
1180
1186
|
|
|
1181
1187
|
//# sourceMappingURL=ore.js.map
|