@stencil/core 5.0.0-alpha.2 → 5.0.0-alpha.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.
- package/dist/{client-DucyoZT4.mjs → client-Dti6fFpE.mjs} +108 -69
- package/dist/compiler/index.d.mts +3 -3
- package/dist/compiler/index.mjs +2 -2
- package/dist/compiler/utils/index.d.mts +2 -2
- package/dist/compiler/utils/index.mjs +3 -3
- package/dist/{compiler-DyK1_szo.mjs → compiler-BYRrEeD-.mjs} +2065 -2106
- package/dist/declarations/stencil-public-compiler.d.ts +4085 -2
- package/dist/declarations/stencil-public-compiler.js +0 -1
- package/dist/declarations/stencil-public-docs.d.ts +494 -1
- package/dist/declarations/stencil-public-runtime.d.ts +1943 -2
- package/dist/{index-fIuYTL9f.d.mts → index-9LTuoSiw.d.mts} +18 -2
- package/dist/{index-D-LlB2nw.d.mts → index-BwTaN1Nq.d.mts} +199 -809
- package/dist/{index-BONzXKJt.d.ts → index-CyrGY82h.d.ts} +5 -7
- package/dist/{index-CHjZtib0.d.ts → index-hS-KBdAP.d.ts} +1 -1
- package/dist/index.d.mts +1 -0
- package/dist/index.mjs +2 -2
- package/dist/{jsx-runtime-DBzBJLKk.d.ts → jsx-runtime-DlDkTqps.d.ts} +1 -1
- package/dist/jsx-runtime.d.ts +1 -1
- package/dist/jsx-runtime.js +1 -1
- package/dist/{node-BWBQAh8C.mjs → node-BF2jSfWg.mjs} +3 -14
- package/dist/regular-expression-D5pGVpCu.mjs +415 -0
- package/dist/runtime/app-data/index.d.ts +1 -1
- package/dist/runtime/app-data/index.js +1 -2
- package/dist/runtime/client/index.d.ts +18 -4
- package/dist/runtime/client/index.js +130 -214
- package/dist/runtime/index.d.ts +20 -4
- package/dist/runtime/index.js +2 -2
- package/dist/runtime/server/index.d.mts +18 -7
- package/dist/runtime/server/index.mjs +128 -215
- package/dist/runtime/server/runner.d.mts +1 -17
- package/dist/runtime/server/runner.mjs +12 -394
- package/dist/{runtime-CqlPYKjW.js → runtime-COEYYPyw.js} +130 -214
- package/dist/sys/node/index.d.mts +1 -1
- package/dist/sys/node/index.mjs +1 -1
- package/dist/sys/node/worker.mjs +2 -2
- package/dist/testing/index.d.mts +3 -3
- package/dist/testing/index.mjs +20 -18
- package/dist/{validation-BR7tMYEv.mjs → validation-Byxie0Uk.mjs} +28 -24
- package/package.json +9 -13
- package/dist/serialize-o-Sj1lvg.mjs +0 -792
- package/dist/stencil-public-compiler-C_X1iolo.d.ts +0 -4455
- package/dist/stencil-public-runtime-DlV8o7-z.d.ts +0 -1845
|
@@ -124,8 +124,7 @@ const LISTENER_FLAGS = {
|
|
|
124
124
|
Capture: 2,
|
|
125
125
|
TargetDocument: 4,
|
|
126
126
|
TargetWindow: 8,
|
|
127
|
-
TargetBody: 16
|
|
128
|
-
TargetParent: 32
|
|
127
|
+
TargetBody: 16
|
|
129
128
|
};
|
|
130
129
|
const HOST_FLAGS = {
|
|
131
130
|
hasConnected: 1,
|
|
@@ -161,7 +160,12 @@ const CMP_FLAGS = {
|
|
|
161
160
|
shadowNeedsScopedCss: 128,
|
|
162
161
|
hasSlot: 256,
|
|
163
162
|
hasModernPropertyDecls: 512,
|
|
164
|
-
shadowSlotAssignmentManual: 1024
|
|
163
|
+
shadowSlotAssignmentManual: 1024,
|
|
164
|
+
shadowModeClosed: 2048,
|
|
165
|
+
patchChildren: 4096,
|
|
166
|
+
patchClone: 8192,
|
|
167
|
+
patchInsert: 16384,
|
|
168
|
+
patchAll: 32768
|
|
165
169
|
};
|
|
166
170
|
/**
|
|
167
171
|
* Namespaces
|
|
@@ -192,38 +196,6 @@ const NODE_TYPES = {
|
|
|
192
196
|
DOCUMENT_FRAGMENT_NODE: 11,
|
|
193
197
|
NOTATION_NODE: 12
|
|
194
198
|
};
|
|
195
|
-
/**
|
|
196
|
-
* Represents a primitive type.
|
|
197
|
-
* Described in https://w3c.github.io/webdriver-bidi/#type-script-PrimitiveProtocolValue.
|
|
198
|
-
*/
|
|
199
|
-
const PrimitiveType = {
|
|
200
|
-
Undefined: "undefined",
|
|
201
|
-
Null: "null",
|
|
202
|
-
String: "string",
|
|
203
|
-
Number: "number",
|
|
204
|
-
SpecialNumber: "number",
|
|
205
|
-
Boolean: "boolean",
|
|
206
|
-
BigInt: "bigint"
|
|
207
|
-
};
|
|
208
|
-
/**
|
|
209
|
-
* Represents a non-primitive type.
|
|
210
|
-
* Described in https://w3c.github.io/webdriver-bidi/#type-script-RemoteValue.
|
|
211
|
-
* @deprecated will be removed in v5. Use `@AttrDeserialize()` / `@PropDeserialize()` decorators instead.
|
|
212
|
-
*/
|
|
213
|
-
const NonPrimitiveType = {
|
|
214
|
-
Array: "array",
|
|
215
|
-
Date: "date",
|
|
216
|
-
Map: "map",
|
|
217
|
-
Object: "object",
|
|
218
|
-
RegularExpression: "regexp",
|
|
219
|
-
Set: "set",
|
|
220
|
-
Channel: "channel",
|
|
221
|
-
Symbol: "symbol"
|
|
222
|
-
};
|
|
223
|
-
/** @deprecated will be removed in v5. Use `@AttrDeserialize()` / `@PropDeserialize()` decorators instead. */
|
|
224
|
-
const TYPE_CONSTANT = "type";
|
|
225
|
-
/** @deprecated will be removed in v5. Use `@AttrDeserialize()` / `@PropDeserialize()` decorators instead. */
|
|
226
|
-
const VALUE_CONSTANT = "value";
|
|
227
199
|
//#endregion
|
|
228
200
|
//#region src/utils/get-prop-descriptor.ts
|
|
229
201
|
/**
|
|
@@ -376,7 +348,7 @@ const cmpModules = /* @__PURE__ */ new Map();
|
|
|
376
348
|
* where here in the source code it must be like this, so that an undesirable
|
|
377
349
|
* transformation that Esbuild would otherwise carry out doesn't occur, but we
|
|
378
350
|
* actually need to then manually edit the bundled Esbuild code later on to fix
|
|
379
|
-
* that. We do this with plugins in the Esbuild and
|
|
351
|
+
* that. We do this with plugins in the Esbuild and Rolldown bundles which
|
|
380
352
|
* include this file.
|
|
381
353
|
*/
|
|
382
354
|
const MODULE_IMPORT_PREFIX = "./";
|
|
@@ -588,12 +560,14 @@ function createStyleSheetIfNeededAndSupported(styles) {
|
|
|
588
560
|
let globalStyleSheet;
|
|
589
561
|
const GLOBAL_STYLE_ID = "sc-global";
|
|
590
562
|
function createShadowRoot(cmpMeta) {
|
|
591
|
-
const
|
|
563
|
+
const isClosed = BUILD$1.shadowModeClosed && !!(cmpMeta.$flags$ & CMP_FLAGS.shadowModeClosed);
|
|
564
|
+
const opts = { mode: isClosed ? "closed" : "open" };
|
|
592
565
|
if (BUILD$1.shadowDelegatesFocus) opts.delegatesFocus = !!(cmpMeta.$flags$ & CMP_FLAGS.shadowDelegatesFocus);
|
|
593
566
|
if (BUILD$1.shadowSlotAssignmentManual) {
|
|
594
567
|
if (!!(cmpMeta.$flags$ & CMP_FLAGS.shadowSlotAssignmentManual)) opts.slotAssignment = "manual";
|
|
595
568
|
}
|
|
596
569
|
const shadowRoot = this.attachShadow(opts);
|
|
570
|
+
if (BUILD$1.shadowModeClosed && isClosed) this.__shadowRoot = shadowRoot;
|
|
597
571
|
if (globalStyleSheet === void 0) globalStyleSheet = createStyleSheetIfNeededAndSupported(globalStyles) ?? null;
|
|
598
572
|
if (globalStyleSheet) if (supportsMutableAdoptedStyleSheets) shadowRoot.adoptedStyleSheets.push(globalStyleSheet);
|
|
599
573
|
else shadowRoot.adoptedStyleSheets = [...shadowRoot.adoptedStyleSheets, globalStyleSheet];
|
|
@@ -1245,6 +1219,24 @@ function internalCall(node, method) {
|
|
|
1245
1219
|
}
|
|
1246
1220
|
}
|
|
1247
1221
|
//#endregion
|
|
1222
|
+
//#region src/runtime/element.ts
|
|
1223
|
+
const getElement = (ref) => BUILD$1.lazyLoad ? getHostRef(ref)?.$hostElement$ : ref;
|
|
1224
|
+
/**
|
|
1225
|
+
* Get the shadow root for a Stencil component's host element.
|
|
1226
|
+
* This works for both open and closed shadow DOM modes.
|
|
1227
|
+
*
|
|
1228
|
+
* For closed shadow DOM, `element.shadowRoot` returns `null` by design,
|
|
1229
|
+
* but Stencil stores the reference internally so components can still
|
|
1230
|
+
* access their own shadow root.
|
|
1231
|
+
*
|
|
1232
|
+
* @param element The host element (from @Element() decorator)
|
|
1233
|
+
* @returns The shadow root, or null if no shadow root exists
|
|
1234
|
+
*/
|
|
1235
|
+
const getShadowRoot = (element) => {
|
|
1236
|
+
if (BUILD$1.shadowModeClosed && element.__shadowRoot) return element.__shadowRoot;
|
|
1237
|
+
return element.shadowRoot;
|
|
1238
|
+
};
|
|
1239
|
+
//#endregion
|
|
1248
1240
|
//#region src/runtime/profile.ts
|
|
1249
1241
|
let i = 0;
|
|
1250
1242
|
const createTime = (fnName, tagName = "") => {
|
|
@@ -1421,7 +1413,8 @@ const addStyle = (styleContainerNode, cmpMeta, mode) => {
|
|
|
1421
1413
|
if (!BUILD$1.attachStyles || !win.document) return scopeId;
|
|
1422
1414
|
let style = styles.get(scopeId);
|
|
1423
1415
|
if (cmpMeta.$flags$ & CMP_FLAGS.hasSlotRelocation) style = getStyleWithSlotCss(style);
|
|
1424
|
-
|
|
1416
|
+
const isClosedShadowSSR = BUILD$1.hydrateServerSide && BUILD$1.shadowModeClosed && cmpMeta.$flags$ & CMP_FLAGS.shadowNeedsScopedCss && cmpMeta.$flags$ & CMP_FLAGS.shadowModeClosed;
|
|
1417
|
+
if (styleContainerNode.nodeType !== NODE_TYPE.DocumentFragment && !isClosedShadowSSR) styleContainerNode = win.document;
|
|
1425
1418
|
if (style) {
|
|
1426
1419
|
if (typeof style === "string") {
|
|
1427
1420
|
styleContainerNode = styleContainerNode.head || styleContainerNode;
|
|
@@ -1471,7 +1464,8 @@ const addStyle = (styleContainerNode, cmpMeta, mode) => {
|
|
|
1471
1464
|
/**
|
|
1472
1465
|
* attach styles at the beginning of a shadow root node if we render shadow components
|
|
1473
1466
|
*/
|
|
1474
|
-
if (cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation) styleContainerNode.
|
|
1467
|
+
if (cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation) if (isClosedShadowSSR) styleContainerNode.prepend(styleElm);
|
|
1468
|
+
else styleContainerNode.insertBefore(styleElm, null);
|
|
1475
1469
|
if (appliedStyles) appliedStyles.add(scopeId);
|
|
1476
1470
|
}
|
|
1477
1471
|
} else if (BUILD$1.constructableCSS) {
|
|
@@ -1506,7 +1500,12 @@ const attachStyles = (hostRef) => {
|
|
|
1506
1500
|
const elm = hostRef.$hostElement$;
|
|
1507
1501
|
const flags = cmpMeta.$flags$;
|
|
1508
1502
|
const endAttachStyles = createTime("attachStyles", cmpMeta.$tagName$);
|
|
1509
|
-
|
|
1503
|
+
let styleContainerNode;
|
|
1504
|
+
const shadowRoot = BUILD$1.shadowDom && supportsShadow ? getShadowRoot(elm) : null;
|
|
1505
|
+
if (shadowRoot) styleContainerNode = shadowRoot;
|
|
1506
|
+
else if (BUILD$1.hydrateServerSide && BUILD$1.shadowModeClosed && flags & CMP_FLAGS.shadowNeedsScopedCss && flags & CMP_FLAGS.shadowModeClosed) styleContainerNode = elm;
|
|
1507
|
+
else styleContainerNode = elm.getRootNode();
|
|
1508
|
+
const scopeId = addStyle(styleContainerNode, cmpMeta, hostRef.$modeName$);
|
|
1510
1509
|
if ((BUILD$1.shadowDom || BUILD$1.scoped) && BUILD$1.cssAnnotations && flags & CMP_FLAGS.needsScopedEncapsulation) {
|
|
1511
1510
|
elm["s-sc"] = scopeId;
|
|
1512
1511
|
elm.classList.add(scopeId + "-h");
|
|
@@ -1744,7 +1743,7 @@ const validateInputProperties = (inputElm) => {
|
|
|
1744
1743
|
*/
|
|
1745
1744
|
const initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
|
|
1746
1745
|
const endHydrate = createTime("hydrateClient", tagName);
|
|
1747
|
-
const shadowRoot = hostElm
|
|
1746
|
+
const shadowRoot = getShadowRoot(hostElm);
|
|
1748
1747
|
const childRenderNodes = [];
|
|
1749
1748
|
const slotNodes = [];
|
|
1750
1749
|
const slottedNodes = [];
|
|
@@ -1825,7 +1824,7 @@ const initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
|
|
|
1825
1824
|
}
|
|
1826
1825
|
addSlotRelocateNode(slottedItem.node, slottedItem.slot, false, slottedItem.node["s-oo"] || currentPos);
|
|
1827
1826
|
if (slottedItem.node.parentElement?.shadowRoot && slottedItem.node["getAttribute"] && slottedItem.node.getAttribute("slot")) slottedItem.node.removeAttribute("slot");
|
|
1828
|
-
if (BUILD$1.experimentalSlotFixes) patchSlottedNode(slottedItem.node);
|
|
1827
|
+
if (BUILD$1.experimentalSlotFixes || BUILD$1.patchAll && hostRef.$cmpMeta$.$flags$ & CMP_FLAGS.patchAll) patchSlottedNode(slottedItem.node);
|
|
1829
1828
|
}
|
|
1830
1829
|
currentPos = (slottedItem.node["s-oo"] || currentPos) + 1;
|
|
1831
1830
|
}
|
|
@@ -2147,9 +2146,12 @@ const _polyfillHost = "-shadowcsshost";
|
|
|
2147
2146
|
const _polyfillSlotted = "-shadowcssslotted";
|
|
2148
2147
|
const _polyfillHostContext = "-shadowcsscontext";
|
|
2149
2148
|
const _parenSuffix = ")(?:\\(((?:\\([^)(]*\\)|[^)(]*)+?)\\))?([^,{]*)";
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2149
|
+
let _cssColonHostRe;
|
|
2150
|
+
let _cssColonHostContextRe;
|
|
2151
|
+
let _cssColonSlottedRe;
|
|
2152
|
+
const getCssColonHostRe = () => _cssColonHostRe ??= new RegExp("(" + _polyfillHost + _parenSuffix, "gim");
|
|
2153
|
+
const getCssColonHostContextRe = () => _cssColonHostContextRe ??= new RegExp("(" + _polyfillHostContext + _parenSuffix, "gim");
|
|
2154
|
+
const getCssColonSlottedRe = () => _cssColonSlottedRe ??= new RegExp("(" + _polyfillSlotted + _parenSuffix, "gim");
|
|
2153
2155
|
const _polyfillHostNoCombinator = _polyfillHost + "-no-combinator";
|
|
2154
2156
|
const _polyfillHostNoCombinatorRe = /-shadowcsshost-no-combinator([^\s]*)/;
|
|
2155
2157
|
const _shadowDOMSelectorsRe = [/::shadow/g, /::content/g];
|
|
@@ -2309,7 +2311,7 @@ const colonHostPartReplacer = (host, part, suffix) => {
|
|
|
2309
2311
|
return host + part.replace(_polyfillHost, "") + suffix;
|
|
2310
2312
|
};
|
|
2311
2313
|
const convertColonHost = (cssText) => {
|
|
2312
|
-
return convertColonRule(cssText,
|
|
2314
|
+
return convertColonRule(cssText, getCssColonHostRe(), colonHostPartReplacer);
|
|
2313
2315
|
};
|
|
2314
2316
|
const colonHostContextPartReplacer = (host, part, suffix) => {
|
|
2315
2317
|
if (part.indexOf(_polyfillHost) > -1) return colonHostPartReplacer(host, part, suffix);
|
|
@@ -2318,7 +2320,7 @@ const colonHostContextPartReplacer = (host, part, suffix) => {
|
|
|
2318
2320
|
const convertColonSlotted = (cssText, slotScopeId) => {
|
|
2319
2321
|
const slotClass = "." + slotScopeId + " > ";
|
|
2320
2322
|
const selectors = [];
|
|
2321
|
-
cssText = cssText.replace(
|
|
2323
|
+
cssText = cssText.replace(getCssColonSlottedRe(), (...m) => {
|
|
2322
2324
|
if (m[2]) {
|
|
2323
2325
|
const compound = m[2].trim();
|
|
2324
2326
|
const suffix = m[3];
|
|
@@ -2347,7 +2349,7 @@ const convertColonSlotted = (cssText, slotScopeId) => {
|
|
|
2347
2349
|
};
|
|
2348
2350
|
};
|
|
2349
2351
|
const convertColonHostContext = (cssText) => {
|
|
2350
|
-
return convertColonRule(cssText,
|
|
2352
|
+
return convertColonRule(cssText, getCssColonHostContextRe(), colonHostContextPartReplacer);
|
|
2351
2353
|
};
|
|
2352
2354
|
const convertShadowDOMSelectors = (cssText) => {
|
|
2353
2355
|
return _shadowDOMSelectorsRe.reduce((result, pattern) => result.replace(pattern, " "), cssText);
|
|
@@ -2536,111 +2538,6 @@ const computeMode = (elm) => modeResolutionChain.map((h) => h(elm)).find((m) =>
|
|
|
2536
2538
|
const setMode = (handler) => modeResolutionChain.push(handler);
|
|
2537
2539
|
const getMode = (ref) => getHostRef(ref)?.$modeName$;
|
|
2538
2540
|
//#endregion
|
|
2539
|
-
//#region src/utils/remote-value.ts
|
|
2540
|
-
/**
|
|
2541
|
-
* RemoteValue class for deserializing LocalValue serialized objects back into their original form
|
|
2542
|
-
* @deprecated will be removed in v5. Use `@AttrDeserialize()` / `@PropDeserialize()` decorators instead.
|
|
2543
|
-
*/
|
|
2544
|
-
var RemoteValue = class RemoteValue {
|
|
2545
|
-
/**
|
|
2546
|
-
* Deserializes a LocalValue serialized object back to its original JavaScript representation
|
|
2547
|
-
*
|
|
2548
|
-
* @param serialized The serialized LocalValue object
|
|
2549
|
-
* @returns The original JavaScript value/object
|
|
2550
|
-
*/
|
|
2551
|
-
static fromLocalValue(serialized) {
|
|
2552
|
-
const type = serialized[TYPE_CONSTANT];
|
|
2553
|
-
const value = "value" in serialized ? serialized[VALUE_CONSTANT] : void 0;
|
|
2554
|
-
switch (type) {
|
|
2555
|
-
case PrimitiveType.String: return value;
|
|
2556
|
-
case PrimitiveType.Boolean: return value;
|
|
2557
|
-
case PrimitiveType.BigInt: return BigInt(value);
|
|
2558
|
-
case PrimitiveType.Undefined: return;
|
|
2559
|
-
case PrimitiveType.Null: return null;
|
|
2560
|
-
case PrimitiveType.Number:
|
|
2561
|
-
if (value === "NaN") return NaN;
|
|
2562
|
-
if (value === "-0") return -0;
|
|
2563
|
-
if (value === "Infinity") return Infinity;
|
|
2564
|
-
if (value === "-Infinity") return -Infinity;
|
|
2565
|
-
return value;
|
|
2566
|
-
case NonPrimitiveType.Array: return value.map((item) => RemoteValue.fromLocalValue(item));
|
|
2567
|
-
case NonPrimitiveType.Date: return new Date(value);
|
|
2568
|
-
case NonPrimitiveType.Map:
|
|
2569
|
-
const map = /* @__PURE__ */ new Map();
|
|
2570
|
-
for (const [key, val] of value) {
|
|
2571
|
-
const deserializedKey = typeof key === "object" && key !== null ? RemoteValue.fromLocalValue(key) : key;
|
|
2572
|
-
const deserializedValue = RemoteValue.fromLocalValue(val);
|
|
2573
|
-
map.set(deserializedKey, deserializedValue);
|
|
2574
|
-
}
|
|
2575
|
-
return map;
|
|
2576
|
-
case NonPrimitiveType.Object:
|
|
2577
|
-
const obj = {};
|
|
2578
|
-
for (const [key, val] of value) obj[key] = RemoteValue.fromLocalValue(val);
|
|
2579
|
-
return obj;
|
|
2580
|
-
case NonPrimitiveType.RegularExpression:
|
|
2581
|
-
const { pattern, flags } = value;
|
|
2582
|
-
return new RegExp(pattern, flags);
|
|
2583
|
-
case NonPrimitiveType.Set:
|
|
2584
|
-
const set = /* @__PURE__ */ new Set();
|
|
2585
|
-
for (const item of value) set.add(RemoteValue.fromLocalValue(item));
|
|
2586
|
-
return set;
|
|
2587
|
-
case NonPrimitiveType.Symbol: return Symbol(value);
|
|
2588
|
-
default: throw new Error(`Unsupported type: ${type}`);
|
|
2589
|
-
}
|
|
2590
|
-
}
|
|
2591
|
-
/**
|
|
2592
|
-
* Utility method to deserialize multiple LocalValues at once
|
|
2593
|
-
*
|
|
2594
|
-
* @param serializedValues Array of serialized LocalValue objects
|
|
2595
|
-
* @returns Array of deserialized JavaScript values
|
|
2596
|
-
*/
|
|
2597
|
-
static fromLocalValueArray(serializedValues) {
|
|
2598
|
-
return serializedValues.map((value) => RemoteValue.fromLocalValue(value));
|
|
2599
|
-
}
|
|
2600
|
-
/**
|
|
2601
|
-
* Verifies if the given object matches the structure of a serialized LocalValue
|
|
2602
|
-
*
|
|
2603
|
-
* @param obj Object to verify
|
|
2604
|
-
* @returns boolean indicating if the object has LocalValue structure
|
|
2605
|
-
*/
|
|
2606
|
-
static isLocalValueObject(obj) {
|
|
2607
|
-
if (typeof obj !== "object" || obj === null) return false;
|
|
2608
|
-
if (!obj.hasOwnProperty("type")) return false;
|
|
2609
|
-
const type = obj[TYPE_CONSTANT];
|
|
2610
|
-
if (!Object.values({
|
|
2611
|
-
...PrimitiveType,
|
|
2612
|
-
...NonPrimitiveType
|
|
2613
|
-
}).includes(type)) return false;
|
|
2614
|
-
if (type !== PrimitiveType.Null && type !== PrimitiveType.Undefined) return obj.hasOwnProperty(VALUE_CONSTANT);
|
|
2615
|
-
return true;
|
|
2616
|
-
}
|
|
2617
|
-
};
|
|
2618
|
-
//#endregion
|
|
2619
|
-
//#region src/utils/serialize.ts
|
|
2620
|
-
/**
|
|
2621
|
-
* Unicode-safe base64 decoding that handles characters outside Latin1 range.
|
|
2622
|
-
* Unlike atob(), this properly decodes Unicode characters including emoji,
|
|
2623
|
-
* CJK characters, and currency symbols like €.
|
|
2624
|
-
* @param {string} base64 - The base64 string to decode.
|
|
2625
|
-
* @returns {string} Decoded string.
|
|
2626
|
-
*/
|
|
2627
|
-
function decodeBase64Unicode(base64) {
|
|
2628
|
-
const binary = atob(base64);
|
|
2629
|
-
const bytes = new Uint8Array(binary.length);
|
|
2630
|
-
for (let i = 0; i < binary.length; i++) bytes[i] = binary.charCodeAt(i);
|
|
2631
|
-
return new TextDecoder().decode(bytes);
|
|
2632
|
-
}
|
|
2633
|
-
/**
|
|
2634
|
-
* Deserialize a value from a string that was serialized earlier.
|
|
2635
|
-
* @param {string} value - The string to deserialize.
|
|
2636
|
-
* @returns {unknown} The deserialized value.
|
|
2637
|
-
* @deprecated will be removed in v5. Use `@AttrDeserialize()` decorator instead.
|
|
2638
|
-
*/
|
|
2639
|
-
function deserializeProperty(value) {
|
|
2640
|
-
if (typeof value !== "string" || !value.startsWith("serialized:")) return value;
|
|
2641
|
-
return RemoteValue.fromLocalValue(JSON.parse(decodeBase64Unicode(value.slice(11))));
|
|
2642
|
-
}
|
|
2643
|
-
//#endregion
|
|
2644
2541
|
//#region src/runtime/parse-property-value.ts
|
|
2645
2542
|
/**
|
|
2646
2543
|
* Parse a new property value for a given property type.
|
|
@@ -2667,14 +2564,6 @@ function deserializeProperty(value) {
|
|
|
2667
2564
|
* @returns the parsed/coerced value
|
|
2668
2565
|
*/
|
|
2669
2566
|
const parsePropertyValue = (propValue, propType, isFormAssociated) => {
|
|
2670
|
-
/**
|
|
2671
|
-
* Allow hydrate parameters that contain a complex non-serialized values.
|
|
2672
|
-
* This is SSR-specific and should only run during hydration.
|
|
2673
|
-
*/
|
|
2674
|
-
if ((BUILD$1.hydrateClientSide || BUILD$1.hydrateServerSide) && typeof propValue === "string" && propValue.startsWith("serialized:")) {
|
|
2675
|
-
propValue = deserializeProperty(propValue);
|
|
2676
|
-
return propValue;
|
|
2677
|
-
}
|
|
2678
2567
|
if (propValue != null && !isComplexType(propValue)) {
|
|
2679
2568
|
/**
|
|
2680
2569
|
* ensure this value is of the correct prop type
|
|
@@ -2703,9 +2592,6 @@ const parsePropertyValue = (propValue, propType, isFormAssociated) => {
|
|
|
2703
2592
|
return propValue;
|
|
2704
2593
|
};
|
|
2705
2594
|
//#endregion
|
|
2706
|
-
//#region src/runtime/element.ts
|
|
2707
|
-
const getElement = (ref) => BUILD$1.lazyLoad ? getHostRef(ref)?.$hostElement$ : ref;
|
|
2708
|
-
//#endregion
|
|
2709
2595
|
//#region src/runtime/event-emitter.ts
|
|
2710
2596
|
const createEvent = (ref, name, flags) => {
|
|
2711
2597
|
const elm = getElement(ref);
|
|
@@ -3058,7 +2944,10 @@ const putBackInOriginalLocation = (parentElm, recursive) => {
|
|
|
3058
2944
|
const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
|
|
3059
2945
|
let containerElm = BUILD$1.slotRelocation && parentElm["s-cr"] && parentElm["s-cr"].parentNode || parentElm;
|
|
3060
2946
|
let childNode;
|
|
3061
|
-
if (BUILD$1.shadowDom && containerElm.
|
|
2947
|
+
if (BUILD$1.shadowDom && containerElm.tagName === hostTagName) {
|
|
2948
|
+
const shadow = getShadowRoot(containerElm);
|
|
2949
|
+
if (shadow) containerElm = shadow;
|
|
2950
|
+
}
|
|
3062
2951
|
if (parentVNode.$tag$ === "template") containerElm = containerElm.content;
|
|
3063
2952
|
for (; startIdx <= endIdx; ++startIdx) if (vnodes[startIdx]) {
|
|
3064
2953
|
childNode = createElm(null, parentVNode, startIdx);
|
|
@@ -3408,7 +3297,8 @@ const insertBefore = (parent, newNode, reference, isInitialLoad) => {
|
|
|
3408
3297
|
if (BUILD$1.slotRelocation) {
|
|
3409
3298
|
if (BUILD$1.scoped && typeof newNode["s-sn"] === "string" && !!newNode["s-sr"] && !!newNode["s-cr"]) addRemoveSlotScopedClass(newNode["s-cr"], newNode, parent, newNode.parentElement);
|
|
3410
3299
|
else if (typeof newNode["s-sn"] === "string") {
|
|
3411
|
-
|
|
3300
|
+
const hostElm = newNode["s-hn"] && parent.closest?.(newNode["s-hn"]);
|
|
3301
|
+
if ((BUILD$1.experimentalSlotFixes || BUILD$1.patchAll && !!(hostElm && getHostRef(hostElm)?.$cmpMeta$.$flags$ & CMP_FLAGS.patchAll)) && parent.getRootNode().nodeType !== NODE_TYPES.DOCUMENT_FRAGMENT_NODE) patchParentNode(newNode);
|
|
3412
3302
|
parent.insertBefore(newNode, reference);
|
|
3413
3303
|
const { slotNode } = findSlotFromSlottedNode(newNode);
|
|
3414
3304
|
if (slotNode && !isInitialLoad) dispatchSlotChangeEvent(slotNode);
|
|
@@ -3497,7 +3387,7 @@ render() {
|
|
|
3497
3387
|
rootVnode.$tag$ = null;
|
|
3498
3388
|
rootVnode.$flags$ |= VNODE_FLAGS.isHost;
|
|
3499
3389
|
hostRef.$vnode$ = rootVnode;
|
|
3500
|
-
rootVnode.$elm$ = oldVNode.$elm$ = BUILD$1.shadowDom ? hostElm
|
|
3390
|
+
rootVnode.$elm$ = oldVNode.$elm$ = BUILD$1.shadowDom ? getShadowRoot(hostElm) || hostElm : hostElm;
|
|
3501
3391
|
if (BUILD$1.scoped || BUILD$1.shadowDom) scopeId = hostElm["s-sc"];
|
|
3502
3392
|
useNativeShadowDom = supportsShadow && !!(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation) && !(cmpMeta.$flags$ & CMP_FLAGS.shadowNeedsScopedCss);
|
|
3503
3393
|
if (BUILD$1.slotRelocation) {
|
|
@@ -3652,13 +3542,13 @@ const dispatchHooks = (hostRef, isInitialLoad) => {
|
|
|
3652
3542
|
}
|
|
3653
3543
|
if (hostRef.$fetchedCbList$.length) hostRef.$fetchedCbList$.forEach((cb) => cb(elm));
|
|
3654
3544
|
}
|
|
3655
|
-
emitLifecycleEvent(elm, "componentWillLoad");
|
|
3545
|
+
if (BUILD$1.lifecycleDOMEvents) emitLifecycleEvent(elm, "componentWillLoad");
|
|
3656
3546
|
maybePromise = safeCall(instance, "componentWillLoad", void 0, elm);
|
|
3657
3547
|
} else {
|
|
3658
|
-
emitLifecycleEvent(elm, "componentWillUpdate");
|
|
3548
|
+
if (BUILD$1.lifecycleDOMEvents) emitLifecycleEvent(elm, "componentWillUpdate");
|
|
3659
3549
|
maybePromise = safeCall(instance, "componentWillUpdate", void 0, elm);
|
|
3660
3550
|
}
|
|
3661
|
-
emitLifecycleEvent(elm, "componentWillRender");
|
|
3551
|
+
if (BUILD$1.lifecycleDOMEvents) emitLifecycleEvent(elm, "componentWillRender");
|
|
3662
3552
|
maybePromise = enqueue(maybePromise, () => safeCall(instance, "componentWillRender", void 0, elm));
|
|
3663
3553
|
endSchedule();
|
|
3664
3554
|
return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
|
|
@@ -3793,14 +3683,14 @@ const postUpdateComponent = (hostRef) => {
|
|
|
3793
3683
|
if (BUILD$1.isDev) hostRef.$flags$ |= HOST_FLAGS.devOnRender;
|
|
3794
3684
|
safeCall(instance, "componentDidRender", void 0, elm);
|
|
3795
3685
|
if (BUILD$1.isDev) hostRef.$flags$ &= ~HOST_FLAGS.devOnRender;
|
|
3796
|
-
emitLifecycleEvent(elm, "componentDidRender");
|
|
3686
|
+
if (BUILD$1.lifecycleDOMEvents) emitLifecycleEvent(elm, "componentDidRender");
|
|
3797
3687
|
if (!(hostRef.$flags$ & HOST_FLAGS.hasLoadedComponent)) {
|
|
3798
3688
|
hostRef.$flags$ |= HOST_FLAGS.hasLoadedComponent;
|
|
3799
3689
|
if (BUILD$1.asyncLoading && BUILD$1.cssAnnotations) addHydratedFlag(elm);
|
|
3800
3690
|
if (BUILD$1.isDev) hostRef.$flags$ |= HOST_FLAGS.devOnDidLoad;
|
|
3801
3691
|
safeCall(instance, "componentDidLoad", void 0, elm);
|
|
3802
3692
|
if (BUILD$1.isDev) hostRef.$flags$ &= ~HOST_FLAGS.devOnDidLoad;
|
|
3803
|
-
emitLifecycleEvent(elm, "componentDidLoad");
|
|
3693
|
+
if (BUILD$1.lifecycleDOMEvents) emitLifecycleEvent(elm, "componentDidLoad");
|
|
3804
3694
|
if (BUILD$1.propChangeCallback) hostRef.$flags$ |= HOST_FLAGS.isWatchReady;
|
|
3805
3695
|
endPostUpdate();
|
|
3806
3696
|
if (BUILD$1.asyncLoading) {
|
|
@@ -3811,7 +3701,7 @@ const postUpdateComponent = (hostRef) => {
|
|
|
3811
3701
|
if (BUILD$1.isDev) hostRef.$flags$ |= HOST_FLAGS.devOnRender;
|
|
3812
3702
|
safeCall(instance, "componentDidUpdate", void 0, elm);
|
|
3813
3703
|
if (BUILD$1.isDev) hostRef.$flags$ &= ~HOST_FLAGS.devOnRender;
|
|
3814
|
-
emitLifecycleEvent(elm, "componentDidUpdate");
|
|
3704
|
+
if (BUILD$1.lifecycleDOMEvents) emitLifecycleEvent(elm, "componentDidUpdate");
|
|
3815
3705
|
endPostUpdate();
|
|
3816
3706
|
}
|
|
3817
3707
|
if (BUILD$1.method && BUILD$1.lazyLoad) hostRef.$onInstanceResolve$(elm);
|
|
@@ -4103,9 +3993,11 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
4103
3993
|
return;
|
|
4104
3994
|
}
|
|
4105
3995
|
const propFlags = members.find(([m]) => m === propName);
|
|
4106
|
-
|
|
3996
|
+
const isBooleanTarget = propFlags && propFlags[1][0] & MEMBER_FLAGS.Boolean;
|
|
3997
|
+
const isSpuriousBooleanRemoval = isBooleanTarget && newValue === null && this[propName] === void 0;
|
|
3998
|
+
if (isBooleanTarget) newValue = !(newValue === null || newValue === "false");
|
|
4107
3999
|
const propDesc = Object.getOwnPropertyDescriptor(prototype, propName);
|
|
4108
|
-
if (newValue != this[propName] && (!propDesc.get || !!propDesc.set)) this[propName] = newValue;
|
|
4000
|
+
if (!isSpuriousBooleanRemoval && newValue != this[propName] && (!propDesc.get || !!propDesc.set)) this[propName] = newValue;
|
|
4109
4001
|
});
|
|
4110
4002
|
};
|
|
4111
4003
|
Cstr.observedAttributes = Array.from(new Set([...Object.keys(cmpMeta.$watchers$ ?? {}), ...members.filter(([_, m]) => m[0] & MEMBER_FLAGS.HasAttribute).map(([propName, m]) => {
|
|
@@ -4234,7 +4126,6 @@ const connectedCallback = (elm) => {
|
|
|
4234
4126
|
if (!hostRef) return;
|
|
4235
4127
|
const cmpMeta = hostRef.$cmpMeta$;
|
|
4236
4128
|
const endConnected = createTime("connectedCallback", cmpMeta.$tagName$);
|
|
4237
|
-
if (BUILD$1.hostListenerTargetParent) addHostEventListeners(elm, hostRef, cmpMeta.$listeners$, true);
|
|
4238
4129
|
if (!(hostRef.$flags$ & HOST_FLAGS.hasConnected)) {
|
|
4239
4130
|
hostRef.$flags$ |= HOST_FLAGS.hasConnected;
|
|
4240
4131
|
let hostId;
|
|
@@ -4242,7 +4133,8 @@ const connectedCallback = (elm) => {
|
|
|
4242
4133
|
hostId = elm.getAttribute(HYDRATE_ID);
|
|
4243
4134
|
if (hostId) {
|
|
4244
4135
|
if (BUILD$1.shadowDom && supportsShadow && cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation) {
|
|
4245
|
-
const
|
|
4136
|
+
const shadowRoot = getShadowRoot(elm);
|
|
4137
|
+
const scopeId = BUILD$1.mode ? addStyle(shadowRoot, cmpMeta, elm.getAttribute("s-mode")) : addStyle(shadowRoot, cmpMeta);
|
|
4246
4138
|
elm.classList.remove(scopeId + "-h", scopeId + "-s");
|
|
4247
4139
|
} else if (BUILD$1.scoped && cmpMeta.$flags$ & CMP_FLAGS.scopedCssEncapsulation) elm["s-sc"] = getScopeId(cmpMeta, BUILD$1.mode ? elm.getAttribute("s-mode") : void 0);
|
|
4248
4140
|
initializeClientHydrate(elm, cmpMeta.$tagName$, hostId, hostRef);
|
|
@@ -4281,7 +4173,7 @@ const connectedCallback = (elm) => {
|
|
|
4281
4173
|
if (BUILD$1.initializeNextTick) nextTick(() => initializeComponent(elm, hostRef, cmpMeta));
|
|
4282
4174
|
else initializeComponent(elm, hostRef, cmpMeta);
|
|
4283
4175
|
} else {
|
|
4284
|
-
addHostEventListeners(elm, hostRef, cmpMeta.$listeners
|
|
4176
|
+
addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
|
|
4285
4177
|
if (hostRef?.$lazyInstance$) fireConnectedCallback(hostRef.$lazyInstance$, elm);
|
|
4286
4178
|
else if (hostRef?.$onReadyPromise$) hostRef.$onReadyPromise$.then(() => fireConnectedCallback(hostRef.$lazyInstance$, elm));
|
|
4287
4179
|
}
|
|
@@ -4342,14 +4234,18 @@ const proxyCustomElement = (Cstr, compactMeta) => {
|
|
|
4342
4234
|
}
|
|
4343
4235
|
if (BUILD$1.reflect) cmpMeta.$attrsToReflect$ = [];
|
|
4344
4236
|
if (BUILD$1.shadowDom && !supportsShadow && cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation) cmpMeta.$flags$ |= CMP_FLAGS.needsShadowDomShim;
|
|
4345
|
-
if (!(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation) && cmpMeta.$flags$ & CMP_FLAGS.hasSlot) if (BUILD$1.experimentalSlotFixes) patchPseudoShadowDom(Cstr.prototype);
|
|
4237
|
+
if (!(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation) && cmpMeta.$flags$ & CMP_FLAGS.hasSlot) if (BUILD$1.experimentalSlotFixes || BUILD$1.patchAll && cmpMeta.$flags$ & CMP_FLAGS.patchAll) patchPseudoShadowDom(Cstr.prototype);
|
|
4346
4238
|
else {
|
|
4347
|
-
if (BUILD$1.slotChildNodesFix) patchChildSlotNodes(Cstr.prototype);
|
|
4348
|
-
if (BUILD$1.cloneNodeFix) patchCloneNode(Cstr.prototype);
|
|
4349
|
-
if (BUILD$1.appendChildSlotFix
|
|
4239
|
+
if (BUILD$1.slotChildNodesFix || BUILD$1.patchChildren && cmpMeta.$flags$ & CMP_FLAGS.patchChildren) patchChildSlotNodes(Cstr.prototype);
|
|
4240
|
+
if (BUILD$1.cloneNodeFix || BUILD$1.patchClone && cmpMeta.$flags$ & CMP_FLAGS.patchClone) patchCloneNode(Cstr.prototype);
|
|
4241
|
+
if (BUILD$1.appendChildSlotFix || BUILD$1.patchInsert && cmpMeta.$flags$ & CMP_FLAGS.patchInsert) {
|
|
4242
|
+
patchSlotAppendChild(Cstr.prototype);
|
|
4243
|
+
patchInsertBefore(Cstr.prototype);
|
|
4244
|
+
patchSlotRemoveChild(Cstr.prototype);
|
|
4245
|
+
}
|
|
4350
4246
|
if (BUILD$1.scopedSlotTextContentFix && cmpMeta.$flags$ & CMP_FLAGS.scopedCssEncapsulation) patchTextContent(Cstr.prototype);
|
|
4351
4247
|
}
|
|
4352
|
-
else if (BUILD$1.cloneNodeFix) patchCloneNode(Cstr.prototype);
|
|
4248
|
+
else if (BUILD$1.cloneNodeFix || BUILD$1.patchClone && cmpMeta.$flags$ & CMP_FLAGS.patchClone) patchCloneNode(Cstr.prototype);
|
|
4353
4249
|
if (BUILD$1.hydrateClientSide && BUILD$1.shadowDom) hydrateScopedToShadow();
|
|
4354
4250
|
const originalConnectedCallback = Cstr.prototype.connectedCallback;
|
|
4355
4251
|
const originalDisconnectedCallback = Cstr.prototype.disconnectedCallback;
|
|
@@ -4365,7 +4261,7 @@ const proxyCustomElement = (Cstr, compactMeta) => {
|
|
|
4365
4261
|
if (!this.__hasHostListenerAttached) {
|
|
4366
4262
|
const hostRef = getHostRef(this);
|
|
4367
4263
|
if (!hostRef) return;
|
|
4368
|
-
addHostEventListeners(this, hostRef, cmpMeta.$listeners
|
|
4264
|
+
addHostEventListeners(this, hostRef, cmpMeta.$listeners$);
|
|
4369
4265
|
this.__hasHostListenerAttached = true;
|
|
4370
4266
|
}
|
|
4371
4267
|
connectedCallback(this);
|
|
@@ -4377,8 +4273,13 @@ const proxyCustomElement = (Cstr, compactMeta) => {
|
|
|
4377
4273
|
},
|
|
4378
4274
|
__attachShadow() {
|
|
4379
4275
|
if (supportsShadow) {
|
|
4380
|
-
|
|
4381
|
-
|
|
4276
|
+
const isClosed = BUILD$1.shadowModeClosed && !!(cmpMeta.$flags$ & CMP_FLAGS.shadowModeClosed);
|
|
4277
|
+
let existingRoot = this.shadowRoot;
|
|
4278
|
+
if (BUILD$1.shadowModeClosed && isClosed) existingRoot = this.__shadowRoot ?? null;
|
|
4279
|
+
if (!existingRoot) createShadowRoot.call(this, cmpMeta);
|
|
4280
|
+
else if (BUILD$1.shadowModeClosed && isClosed) {
|
|
4281
|
+
if (existingRoot.mode !== "closed") throw new Error(`Unable to re-use existing shadow root for ${cmpMeta.$tagName$}! Mode is set to ${existingRoot.mode} but expected closed.`);
|
|
4282
|
+
}
|
|
4382
4283
|
} else this.shadowRoot = this;
|
|
4383
4284
|
}
|
|
4384
4285
|
});
|
|
@@ -4474,7 +4375,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
4474
4375
|
cmpMeta.$deserializers$ = compactMeta[6] ?? {};
|
|
4475
4376
|
}
|
|
4476
4377
|
if (BUILD$1.shadowDom && !supportsShadow && cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation) cmpMeta.$flags$ |= CMP_FLAGS.needsShadowDomShim;
|
|
4477
|
-
const tagName =
|
|
4378
|
+
const tagName = transformTag(cmpMeta.$tagName$);
|
|
4478
4379
|
const HostElement = class extends HTMLElement {
|
|
4479
4380
|
["s-p"];
|
|
4480
4381
|
["s-rc"];
|
|
@@ -4501,7 +4402,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
4501
4402
|
*/
|
|
4502
4403
|
if (!this.hasRegisteredEventListeners) {
|
|
4503
4404
|
this.hasRegisteredEventListeners = true;
|
|
4504
|
-
addHostEventListeners(this, hostRef, cmpMeta.$listeners
|
|
4405
|
+
addHostEventListeners(this, hostRef, cmpMeta.$listeners$);
|
|
4505
4406
|
}
|
|
4506
4407
|
if (appLoadFallback) {
|
|
4507
4408
|
clearTimeout(appLoadFallback);
|
|
@@ -4533,14 +4434,18 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
4533
4434
|
return getHostRef(this)?.$onReadyPromise$;
|
|
4534
4435
|
}
|
|
4535
4436
|
};
|
|
4536
|
-
if (!(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation) && cmpMeta.$flags$ & CMP_FLAGS.hasSlot) if (BUILD$1.experimentalSlotFixes) patchPseudoShadowDom(HostElement.prototype);
|
|
4437
|
+
if (!(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation) && cmpMeta.$flags$ & CMP_FLAGS.hasSlot) if (BUILD$1.experimentalSlotFixes || BUILD$1.patchAll && cmpMeta.$flags$ & CMP_FLAGS.patchAll) patchPseudoShadowDom(HostElement.prototype);
|
|
4537
4438
|
else {
|
|
4538
|
-
if (BUILD$1.slotChildNodesFix) patchChildSlotNodes(HostElement.prototype);
|
|
4539
|
-
if (BUILD$1.cloneNodeFix) patchCloneNode(HostElement.prototype);
|
|
4540
|
-
if (BUILD$1.appendChildSlotFix
|
|
4439
|
+
if (BUILD$1.slotChildNodesFix || BUILD$1.patchChildren && cmpMeta.$flags$ & CMP_FLAGS.patchChildren) patchChildSlotNodes(HostElement.prototype);
|
|
4440
|
+
if (BUILD$1.cloneNodeFix || BUILD$1.patchClone && cmpMeta.$flags$ & CMP_FLAGS.patchClone) patchCloneNode(HostElement.prototype);
|
|
4441
|
+
if (BUILD$1.appendChildSlotFix || BUILD$1.patchInsert && cmpMeta.$flags$ & CMP_FLAGS.patchInsert) {
|
|
4442
|
+
patchSlotAppendChild(HostElement.prototype);
|
|
4443
|
+
patchInsertBefore(HostElement.prototype);
|
|
4444
|
+
patchSlotRemoveChild(HostElement.prototype);
|
|
4445
|
+
}
|
|
4541
4446
|
if (BUILD$1.scopedSlotTextContentFix && cmpMeta.$flags$ & CMP_FLAGS.scopedCssEncapsulation) patchTextContent(HostElement.prototype);
|
|
4542
4447
|
}
|
|
4543
|
-
else if (BUILD$1.cloneNodeFix) patchCloneNode(HostElement.prototype);
|
|
4448
|
+
else if (BUILD$1.cloneNodeFix || BUILD$1.patchClone && cmpMeta.$flags$ & CMP_FLAGS.patchClone) patchCloneNode(HostElement.prototype);
|
|
4544
4449
|
if (BUILD$1.formAssociated && cmpMeta.$flags$ & CMP_FLAGS.formAssociated) HostElement.formAssociated = true;
|
|
4545
4450
|
if (BUILD$1.hotModuleReplacement) HostElement.prototype["s-hmr"] = function(hmrVersionId) {
|
|
4546
4451
|
hmrStart(this, cmpMeta, hmrVersionId);
|
|
@@ -4572,18 +4477,14 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
4572
4477
|
const Fragment = (_, children) => children;
|
|
4573
4478
|
//#endregion
|
|
4574
4479
|
//#region src/runtime/host-listener.ts
|
|
4575
|
-
const addHostEventListeners = (elm, hostRef, listeners
|
|
4576
|
-
if (BUILD$1.hostListener && listeners && win.document) {
|
|
4577
|
-
|
|
4578
|
-
|
|
4579
|
-
|
|
4580
|
-
|
|
4581
|
-
|
|
4582
|
-
|
|
4583
|
-
plt.ael(target, name, handler, opts);
|
|
4584
|
-
(hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
|
|
4585
|
-
});
|
|
4586
|
-
}
|
|
4480
|
+
const addHostEventListeners = (elm, hostRef, listeners) => {
|
|
4481
|
+
if (BUILD$1.hostListener && listeners && win.document) listeners.map(([flags, name, method]) => {
|
|
4482
|
+
const target = BUILD$1.hostListenerTarget ? getHostListenerTarget(win.document, elm, flags) : elm;
|
|
4483
|
+
const handler = hostListenerProxy(hostRef, method);
|
|
4484
|
+
const opts = hostListenerOpts(flags);
|
|
4485
|
+
plt.ael(target, name, handler, opts);
|
|
4486
|
+
(hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
|
|
4487
|
+
});
|
|
4587
4488
|
};
|
|
4588
4489
|
const hostListenerProxy = (hostRef, methodName) => (ev) => {
|
|
4589
4490
|
try {
|
|
@@ -4598,7 +4499,6 @@ const getHostListenerTarget = (doc, elm, flags) => {
|
|
|
4598
4499
|
if (BUILD$1.hostListenerTargetDocument && flags & LISTENER_FLAGS.TargetDocument) return doc;
|
|
4599
4500
|
if (BUILD$1.hostListenerTargetWindow && flags & LISTENER_FLAGS.TargetWindow) return win;
|
|
4600
4501
|
if (BUILD$1.hostListenerTargetBody && flags & LISTENER_FLAGS.TargetBody) return doc.body;
|
|
4601
|
-
if (BUILD$1.hostListenerTargetParent && flags & LISTENER_FLAGS.TargetParent && elm.parentElement) return elm.parentElement;
|
|
4602
4502
|
return elm;
|
|
4603
4503
|
};
|
|
4604
4504
|
const hostListenerOpts = (flags) => supportsListenerOptions ? {
|
|
@@ -4626,8 +4526,19 @@ const setPlatformOptions = (opts) => Object.assign(plt, opts);
|
|
|
4626
4526
|
//#endregion
|
|
4627
4527
|
//#region src/runtime/render.ts
|
|
4628
4528
|
/**
|
|
4529
|
+
* A WeakMap to persist HostRef objects across multiple render() calls to the
|
|
4530
|
+
* same container. This enables VNode diffing on re-renders — without it, each
|
|
4531
|
+
* call creates a fresh HostRef with no previous VNode, causing renderVdom to
|
|
4532
|
+
* replace the entire DOM subtree instead of patching only what changed.
|
|
4533
|
+
*/
|
|
4534
|
+
const hostRefCache = /* @__PURE__ */ new WeakMap();
|
|
4535
|
+
/**
|
|
4629
4536
|
* Method to render a virtual DOM tree to a container element.
|
|
4630
4537
|
*
|
|
4538
|
+
* Supports efficient re-renders: calling `render()` again on the same container
|
|
4539
|
+
* will diff the new VNode tree against the previous one and only update what changed,
|
|
4540
|
+
* preserving existing DOM elements and their state.
|
|
4541
|
+
*
|
|
4631
4542
|
* @example
|
|
4632
4543
|
* ```tsx
|
|
4633
4544
|
* import { render } from '@stencil/core';
|
|
@@ -4644,14 +4555,19 @@ const setPlatformOptions = (opts) => Object.assign(plt, opts);
|
|
|
4644
4555
|
* @param container - The container element to render the virtual DOM tree to
|
|
4645
4556
|
*/
|
|
4646
4557
|
function render(vnode, container) {
|
|
4647
|
-
|
|
4648
|
-
|
|
4649
|
-
|
|
4558
|
+
let ref = hostRefCache.get(container);
|
|
4559
|
+
if (!ref) {
|
|
4560
|
+
ref = {
|
|
4650
4561
|
$flags$: 0,
|
|
4651
|
-
$
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
|
|
4562
|
+
$cmpMeta$: {
|
|
4563
|
+
$flags$: 0,
|
|
4564
|
+
$tagName$: container.tagName
|
|
4565
|
+
},
|
|
4566
|
+
$hostElement$: container
|
|
4567
|
+
};
|
|
4568
|
+
hostRefCache.set(container, ref);
|
|
4569
|
+
}
|
|
4570
|
+
renderVdom(ref, vnode);
|
|
4655
4571
|
}
|
|
4656
4572
|
//#endregion
|
|
4657
4573
|
//#region src/runtime/tag-transform.ts
|
|
@@ -4876,4 +4792,4 @@ const insertChildVNodeAnnotations = (doc, vnodeChild, cmpData, hostId, depth, in
|
|
|
4876
4792
|
}
|
|
4877
4793
|
};
|
|
4878
4794
|
//#endregion
|
|
4879
|
-
export { AttachInternals, AttrDeserialize, BUILD, Build, Component, Element$1 as Element, Env, Event, Fragment, H, H as HTMLElement, HYDRATED_STYLE_ID, Host, Listen, Method, Mixin, NAMESPACE, Prop, PropSerialize, STENCIL_DEV_MODE, State, Watch, addHostEventListeners, bootstrapLazy, cmpModules, connectedCallback, consoleDevError, consoleDevInfo, consoleDevWarn, consoleError, createEvent, defineCustomElement, disconnectedCallback, forceModeUpdate, forceUpdate, getAssetPath, getElement, getHostRef, getMode, getRenderingRef, getValue, h, insertVdomAnnotations, isMemberInElement, jsx, jsxs, loadModule, modeResolutionChain, needsScopedSSR, nextTick, parsePropertyValue, plt, postUpdateComponent, promiseResolve, proxyComponent, proxyCustomElement, readTask, registerHost, registerInstance, render, renderVdom, resolveVar, setAssetPath, setErrorHandler, setMode, setNonce, setPlatformHelpers, setPlatformOptions, setScopedSSR, setTagTransformer, setValue, styles, supportsConstructableStylesheets, supportsListenerOptions, supportsMutableAdoptedStyleSheets, supportsShadow, transformTag, win, writeTask };
|
|
4795
|
+
export { AttachInternals, AttrDeserialize, BUILD, Build, Component, Element$1 as Element, Env, Event, Fragment, H, H as HTMLElement, HYDRATED_STYLE_ID, Host, Listen, Method, Mixin, NAMESPACE, Prop, PropSerialize, STENCIL_DEV_MODE, State, Watch, addHostEventListeners, bootstrapLazy, cmpModules, connectedCallback, consoleDevError, consoleDevInfo, consoleDevWarn, consoleError, createEvent, defineCustomElement, disconnectedCallback, forceModeUpdate, forceUpdate, getAssetPath, getElement, getHostRef, getMode, getRenderingRef, getShadowRoot, getValue, h, insertVdomAnnotations, isMemberInElement, jsx, jsxs, loadModule, modeResolutionChain, needsScopedSSR, nextTick, parsePropertyValue, plt, postUpdateComponent, promiseResolve, proxyComponent, proxyCustomElement, readTask, registerHost, registerInstance, render, renderVdom, resolveVar, setAssetPath, setErrorHandler, setMode, setNonce, setPlatformHelpers, setPlatformOptions, setScopedSSR, setTagTransformer, setValue, styles, supportsConstructableStylesheets, supportsListenerOptions, supportsMutableAdoptedStyleSheets, supportsShadow, transformTag, win, writeTask };
|