@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
|
@@ -36,8 +36,7 @@ const LISTENER_FLAGS = {
|
|
|
36
36
|
Capture: 2,
|
|
37
37
|
TargetDocument: 4,
|
|
38
38
|
TargetWindow: 8,
|
|
39
|
-
TargetBody: 16
|
|
40
|
-
TargetParent: 32
|
|
39
|
+
TargetBody: 16
|
|
41
40
|
};
|
|
42
41
|
const HOST_FLAGS = {
|
|
43
42
|
hasConnected: 1,
|
|
@@ -73,7 +72,12 @@ const CMP_FLAGS = {
|
|
|
73
72
|
shadowNeedsScopedCss: 128,
|
|
74
73
|
hasSlot: 256,
|
|
75
74
|
hasModernPropertyDecls: 512,
|
|
76
|
-
shadowSlotAssignmentManual: 1024
|
|
75
|
+
shadowSlotAssignmentManual: 1024,
|
|
76
|
+
shadowModeClosed: 2048,
|
|
77
|
+
patchChildren: 4096,
|
|
78
|
+
patchClone: 8192,
|
|
79
|
+
patchInsert: 16384,
|
|
80
|
+
patchAll: 32768
|
|
77
81
|
};
|
|
78
82
|
/**
|
|
79
83
|
* Namespaces
|
|
@@ -104,38 +108,6 @@ const NODE_TYPES = {
|
|
|
104
108
|
DOCUMENT_FRAGMENT_NODE: 11,
|
|
105
109
|
NOTATION_NODE: 12
|
|
106
110
|
};
|
|
107
|
-
/**
|
|
108
|
-
* Represents a primitive type.
|
|
109
|
-
* Described in https://w3c.github.io/webdriver-bidi/#type-script-PrimitiveProtocolValue.
|
|
110
|
-
*/
|
|
111
|
-
const PrimitiveType = {
|
|
112
|
-
Undefined: "undefined",
|
|
113
|
-
Null: "null",
|
|
114
|
-
String: "string",
|
|
115
|
-
Number: "number",
|
|
116
|
-
SpecialNumber: "number",
|
|
117
|
-
Boolean: "boolean",
|
|
118
|
-
BigInt: "bigint"
|
|
119
|
-
};
|
|
120
|
-
/**
|
|
121
|
-
* Represents a non-primitive type.
|
|
122
|
-
* Described in https://w3c.github.io/webdriver-bidi/#type-script-RemoteValue.
|
|
123
|
-
* @deprecated will be removed in v5. Use `@AttrDeserialize()` / `@PropDeserialize()` decorators instead.
|
|
124
|
-
*/
|
|
125
|
-
const NonPrimitiveType = {
|
|
126
|
-
Array: "array",
|
|
127
|
-
Date: "date",
|
|
128
|
-
Map: "map",
|
|
129
|
-
Object: "object",
|
|
130
|
-
RegularExpression: "regexp",
|
|
131
|
-
Set: "set",
|
|
132
|
-
Channel: "channel",
|
|
133
|
-
Symbol: "symbol"
|
|
134
|
-
};
|
|
135
|
-
/** @deprecated will be removed in v5. Use `@AttrDeserialize()` / `@PropDeserialize()` decorators instead. */
|
|
136
|
-
const TYPE_CONSTANT = "type";
|
|
137
|
-
/** @deprecated will be removed in v5. Use `@AttrDeserialize()` / `@PropDeserialize()` decorators instead. */
|
|
138
|
-
const VALUE_CONSTANT = "value";
|
|
139
111
|
//#endregion
|
|
140
112
|
//#region src/utils/get-prop-descriptor.ts
|
|
141
113
|
/**
|
|
@@ -270,7 +242,7 @@ const cmpModules = /* @__PURE__ */ new Map();
|
|
|
270
242
|
* where here in the source code it must be like this, so that an undesirable
|
|
271
243
|
* transformation that Esbuild would otherwise carry out doesn't occur, but we
|
|
272
244
|
* actually need to then manually edit the bundled Esbuild code later on to fix
|
|
273
|
-
* that. We do this with plugins in the Esbuild and
|
|
245
|
+
* that. We do this with plugins in the Esbuild and Rolldown bundles which
|
|
274
246
|
* include this file.
|
|
275
247
|
*/
|
|
276
248
|
const MODULE_IMPORT_PREFIX = "./";
|
|
@@ -476,12 +448,14 @@ function createStyleSheetIfNeededAndSupported(styles) {
|
|
|
476
448
|
//#region src/utils/shadow-root.ts
|
|
477
449
|
let globalStyleSheet;
|
|
478
450
|
function createShadowRoot(cmpMeta) {
|
|
479
|
-
const
|
|
451
|
+
const isClosed = BUILD.shadowModeClosed && !!(cmpMeta.$flags$ & CMP_FLAGS.shadowModeClosed);
|
|
452
|
+
const opts = { mode: isClosed ? "closed" : "open" };
|
|
480
453
|
if (BUILD.shadowDelegatesFocus) opts.delegatesFocus = !!(cmpMeta.$flags$ & CMP_FLAGS.shadowDelegatesFocus);
|
|
481
454
|
if (BUILD.shadowSlotAssignmentManual) {
|
|
482
455
|
if (!!(cmpMeta.$flags$ & CMP_FLAGS.shadowSlotAssignmentManual)) opts.slotAssignment = "manual";
|
|
483
456
|
}
|
|
484
457
|
const shadowRoot = this.attachShadow(opts);
|
|
458
|
+
if (BUILD.shadowModeClosed && isClosed) this.__shadowRoot = shadowRoot;
|
|
485
459
|
if (globalStyleSheet === void 0) globalStyleSheet = createStyleSheetIfNeededAndSupported("") ?? null;
|
|
486
460
|
if (globalStyleSheet) if (supportsMutableAdoptedStyleSheets) shadowRoot.adoptedStyleSheets.push(globalStyleSheet);
|
|
487
461
|
else shadowRoot.adoptedStyleSheets = [...shadowRoot.adoptedStyleSheets, globalStyleSheet];
|
|
@@ -1127,6 +1101,24 @@ function internalCall(node, method) {
|
|
|
1127
1101
|
}
|
|
1128
1102
|
}
|
|
1129
1103
|
//#endregion
|
|
1104
|
+
//#region src/runtime/element.ts
|
|
1105
|
+
const getElement = (ref) => BUILD.lazyLoad ? getHostRef(ref)?.$hostElement$ : ref;
|
|
1106
|
+
/**
|
|
1107
|
+
* Get the shadow root for a Stencil component's host element.
|
|
1108
|
+
* This works for both open and closed shadow DOM modes.
|
|
1109
|
+
*
|
|
1110
|
+
* For closed shadow DOM, `element.shadowRoot` returns `null` by design,
|
|
1111
|
+
* but Stencil stores the reference internally so components can still
|
|
1112
|
+
* access their own shadow root.
|
|
1113
|
+
*
|
|
1114
|
+
* @param element The host element (from @Element() decorator)
|
|
1115
|
+
* @returns The shadow root, or null if no shadow root exists
|
|
1116
|
+
*/
|
|
1117
|
+
const getShadowRoot = (element) => {
|
|
1118
|
+
if (BUILD.shadowModeClosed && element.__shadowRoot) return element.__shadowRoot;
|
|
1119
|
+
return element.shadowRoot;
|
|
1120
|
+
};
|
|
1121
|
+
//#endregion
|
|
1130
1122
|
//#region src/runtime/profile.ts
|
|
1131
1123
|
let i = 0;
|
|
1132
1124
|
const createTime = (fnName, tagName = "") => {
|
|
@@ -1303,7 +1295,8 @@ const addStyle = (styleContainerNode, cmpMeta, mode) => {
|
|
|
1303
1295
|
if (!BUILD.attachStyles || !win.document) return scopeId;
|
|
1304
1296
|
let style = styles.get(scopeId);
|
|
1305
1297
|
if (cmpMeta.$flags$ & CMP_FLAGS.hasSlotRelocation) style = getStyleWithSlotCss(style);
|
|
1306
|
-
|
|
1298
|
+
const isClosedShadowSSR = BUILD.hydrateServerSide && BUILD.shadowModeClosed && cmpMeta.$flags$ & CMP_FLAGS.shadowNeedsScopedCss && cmpMeta.$flags$ & CMP_FLAGS.shadowModeClosed;
|
|
1299
|
+
if (styleContainerNode.nodeType !== NODE_TYPE.DocumentFragment && !isClosedShadowSSR) styleContainerNode = win.document;
|
|
1307
1300
|
if (style) {
|
|
1308
1301
|
if (typeof style === "string") {
|
|
1309
1302
|
styleContainerNode = styleContainerNode.head || styleContainerNode;
|
|
@@ -1353,7 +1346,8 @@ const addStyle = (styleContainerNode, cmpMeta, mode) => {
|
|
|
1353
1346
|
/**
|
|
1354
1347
|
* attach styles at the beginning of a shadow root node if we render shadow components
|
|
1355
1348
|
*/
|
|
1356
|
-
if (cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation) styleContainerNode.
|
|
1349
|
+
if (cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation) if (isClosedShadowSSR) styleContainerNode.prepend(styleElm);
|
|
1350
|
+
else styleContainerNode.insertBefore(styleElm, null);
|
|
1357
1351
|
if (appliedStyles) appliedStyles.add(scopeId);
|
|
1358
1352
|
}
|
|
1359
1353
|
} else if (BUILD.constructableCSS) {
|
|
@@ -1388,7 +1382,12 @@ const attachStyles = (hostRef) => {
|
|
|
1388
1382
|
const elm = hostRef.$hostElement$;
|
|
1389
1383
|
const flags = cmpMeta.$flags$;
|
|
1390
1384
|
const endAttachStyles = createTime("attachStyles", cmpMeta.$tagName$);
|
|
1391
|
-
|
|
1385
|
+
let styleContainerNode;
|
|
1386
|
+
const shadowRoot = BUILD.shadowDom && supportsShadow ? getShadowRoot(elm) : null;
|
|
1387
|
+
if (shadowRoot) styleContainerNode = shadowRoot;
|
|
1388
|
+
else if (BUILD.hydrateServerSide && BUILD.shadowModeClosed && flags & CMP_FLAGS.shadowNeedsScopedCss && flags & CMP_FLAGS.shadowModeClosed) styleContainerNode = elm;
|
|
1389
|
+
else styleContainerNode = elm.getRootNode();
|
|
1390
|
+
const scopeId = addStyle(styleContainerNode, cmpMeta, hostRef.$modeName$);
|
|
1392
1391
|
if ((BUILD.shadowDom || BUILD.scoped) && BUILD.cssAnnotations && flags & CMP_FLAGS.needsScopedEncapsulation) {
|
|
1393
1392
|
elm["s-sc"] = scopeId;
|
|
1394
1393
|
elm.classList.add(scopeId + "-h");
|
|
@@ -1626,7 +1625,7 @@ const validateInputProperties = (inputElm) => {
|
|
|
1626
1625
|
*/
|
|
1627
1626
|
const initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
|
|
1628
1627
|
const endHydrate = createTime("hydrateClient", tagName);
|
|
1629
|
-
const shadowRoot = hostElm
|
|
1628
|
+
const shadowRoot = getShadowRoot(hostElm);
|
|
1630
1629
|
const childRenderNodes = [];
|
|
1631
1630
|
const slotNodes = [];
|
|
1632
1631
|
const slottedNodes = [];
|
|
@@ -1707,7 +1706,7 @@ const initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
|
|
|
1707
1706
|
}
|
|
1708
1707
|
addSlotRelocateNode(slottedItem.node, slottedItem.slot, false, slottedItem.node["s-oo"] || currentPos);
|
|
1709
1708
|
if (slottedItem.node.parentElement?.shadowRoot && slottedItem.node["getAttribute"] && slottedItem.node.getAttribute("slot")) slottedItem.node.removeAttribute("slot");
|
|
1710
|
-
if (BUILD.experimentalSlotFixes) patchSlottedNode(slottedItem.node);
|
|
1709
|
+
if (BUILD.experimentalSlotFixes || BUILD.patchAll && hostRef.$cmpMeta$.$flags$ & CMP_FLAGS.patchAll) patchSlottedNode(slottedItem.node);
|
|
1711
1710
|
}
|
|
1712
1711
|
currentPos = (slottedItem.node["s-oo"] || currentPos) + 1;
|
|
1713
1712
|
}
|
|
@@ -2029,9 +2028,12 @@ const _polyfillHost = "-shadowcsshost";
|
|
|
2029
2028
|
const _polyfillSlotted = "-shadowcssslotted";
|
|
2030
2029
|
const _polyfillHostContext = "-shadowcsscontext";
|
|
2031
2030
|
const _parenSuffix = ")(?:\\(((?:\\([^)(]*\\)|[^)(]*)+?)\\))?([^,{]*)";
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2031
|
+
let _cssColonHostRe;
|
|
2032
|
+
let _cssColonHostContextRe;
|
|
2033
|
+
let _cssColonSlottedRe;
|
|
2034
|
+
const getCssColonHostRe = () => _cssColonHostRe ??= new RegExp("(" + _polyfillHost + _parenSuffix, "gim");
|
|
2035
|
+
const getCssColonHostContextRe = () => _cssColonHostContextRe ??= new RegExp("(" + _polyfillHostContext + _parenSuffix, "gim");
|
|
2036
|
+
const getCssColonSlottedRe = () => _cssColonSlottedRe ??= new RegExp("(" + _polyfillSlotted + _parenSuffix, "gim");
|
|
2035
2037
|
const _polyfillHostNoCombinator = _polyfillHost + "-no-combinator";
|
|
2036
2038
|
const _polyfillHostNoCombinatorRe = /-shadowcsshost-no-combinator([^\s]*)/;
|
|
2037
2039
|
const _shadowDOMSelectorsRe = [/::shadow/g, /::content/g];
|
|
@@ -2191,7 +2193,7 @@ const colonHostPartReplacer = (host, part, suffix) => {
|
|
|
2191
2193
|
return host + part.replace(_polyfillHost, "") + suffix;
|
|
2192
2194
|
};
|
|
2193
2195
|
const convertColonHost = (cssText) => {
|
|
2194
|
-
return convertColonRule(cssText,
|
|
2196
|
+
return convertColonRule(cssText, getCssColonHostRe(), colonHostPartReplacer);
|
|
2195
2197
|
};
|
|
2196
2198
|
const colonHostContextPartReplacer = (host, part, suffix) => {
|
|
2197
2199
|
if (part.indexOf(_polyfillHost) > -1) return colonHostPartReplacer(host, part, suffix);
|
|
@@ -2200,7 +2202,7 @@ const colonHostContextPartReplacer = (host, part, suffix) => {
|
|
|
2200
2202
|
const convertColonSlotted = (cssText, slotScopeId) => {
|
|
2201
2203
|
const slotClass = "." + slotScopeId + " > ";
|
|
2202
2204
|
const selectors = [];
|
|
2203
|
-
cssText = cssText.replace(
|
|
2205
|
+
cssText = cssText.replace(getCssColonSlottedRe(), (...m) => {
|
|
2204
2206
|
if (m[2]) {
|
|
2205
2207
|
const compound = m[2].trim();
|
|
2206
2208
|
const suffix = m[3];
|
|
@@ -2229,7 +2231,7 @@ const convertColonSlotted = (cssText, slotScopeId) => {
|
|
|
2229
2231
|
};
|
|
2230
2232
|
};
|
|
2231
2233
|
const convertColonHostContext = (cssText) => {
|
|
2232
|
-
return convertColonRule(cssText,
|
|
2234
|
+
return convertColonRule(cssText, getCssColonHostContextRe(), colonHostContextPartReplacer);
|
|
2233
2235
|
};
|
|
2234
2236
|
const convertShadowDOMSelectors = (cssText) => {
|
|
2235
2237
|
return _shadowDOMSelectorsRe.reduce((result, pattern) => result.replace(pattern, " "), cssText);
|
|
@@ -2418,111 +2420,6 @@ const computeMode = (elm) => modeResolutionChain.map((h) => h(elm)).find((m) =>
|
|
|
2418
2420
|
const setMode = (handler) => modeResolutionChain.push(handler);
|
|
2419
2421
|
const getMode = (ref) => getHostRef(ref)?.$modeName$;
|
|
2420
2422
|
//#endregion
|
|
2421
|
-
//#region src/utils/remote-value.ts
|
|
2422
|
-
/**
|
|
2423
|
-
* RemoteValue class for deserializing LocalValue serialized objects back into their original form
|
|
2424
|
-
* @deprecated will be removed in v5. Use `@AttrDeserialize()` / `@PropDeserialize()` decorators instead.
|
|
2425
|
-
*/
|
|
2426
|
-
var RemoteValue = class RemoteValue {
|
|
2427
|
-
/**
|
|
2428
|
-
* Deserializes a LocalValue serialized object back to its original JavaScript representation
|
|
2429
|
-
*
|
|
2430
|
-
* @param serialized The serialized LocalValue object
|
|
2431
|
-
* @returns The original JavaScript value/object
|
|
2432
|
-
*/
|
|
2433
|
-
static fromLocalValue(serialized) {
|
|
2434
|
-
const type = serialized[TYPE_CONSTANT];
|
|
2435
|
-
const value = "value" in serialized ? serialized[VALUE_CONSTANT] : void 0;
|
|
2436
|
-
switch (type) {
|
|
2437
|
-
case PrimitiveType.String: return value;
|
|
2438
|
-
case PrimitiveType.Boolean: return value;
|
|
2439
|
-
case PrimitiveType.BigInt: return BigInt(value);
|
|
2440
|
-
case PrimitiveType.Undefined: return;
|
|
2441
|
-
case PrimitiveType.Null: return null;
|
|
2442
|
-
case PrimitiveType.Number:
|
|
2443
|
-
if (value === "NaN") return NaN;
|
|
2444
|
-
if (value === "-0") return -0;
|
|
2445
|
-
if (value === "Infinity") return Infinity;
|
|
2446
|
-
if (value === "-Infinity") return -Infinity;
|
|
2447
|
-
return value;
|
|
2448
|
-
case NonPrimitiveType.Array: return value.map((item) => RemoteValue.fromLocalValue(item));
|
|
2449
|
-
case NonPrimitiveType.Date: return new Date(value);
|
|
2450
|
-
case NonPrimitiveType.Map:
|
|
2451
|
-
const map = /* @__PURE__ */ new Map();
|
|
2452
|
-
for (const [key, val] of value) {
|
|
2453
|
-
const deserializedKey = typeof key === "object" && key !== null ? RemoteValue.fromLocalValue(key) : key;
|
|
2454
|
-
const deserializedValue = RemoteValue.fromLocalValue(val);
|
|
2455
|
-
map.set(deserializedKey, deserializedValue);
|
|
2456
|
-
}
|
|
2457
|
-
return map;
|
|
2458
|
-
case NonPrimitiveType.Object:
|
|
2459
|
-
const obj = {};
|
|
2460
|
-
for (const [key, val] of value) obj[key] = RemoteValue.fromLocalValue(val);
|
|
2461
|
-
return obj;
|
|
2462
|
-
case NonPrimitiveType.RegularExpression:
|
|
2463
|
-
const { pattern, flags } = value;
|
|
2464
|
-
return new RegExp(pattern, flags);
|
|
2465
|
-
case NonPrimitiveType.Set:
|
|
2466
|
-
const set = /* @__PURE__ */ new Set();
|
|
2467
|
-
for (const item of value) set.add(RemoteValue.fromLocalValue(item));
|
|
2468
|
-
return set;
|
|
2469
|
-
case NonPrimitiveType.Symbol: return Symbol(value);
|
|
2470
|
-
default: throw new Error(`Unsupported type: ${type}`);
|
|
2471
|
-
}
|
|
2472
|
-
}
|
|
2473
|
-
/**
|
|
2474
|
-
* Utility method to deserialize multiple LocalValues at once
|
|
2475
|
-
*
|
|
2476
|
-
* @param serializedValues Array of serialized LocalValue objects
|
|
2477
|
-
* @returns Array of deserialized JavaScript values
|
|
2478
|
-
*/
|
|
2479
|
-
static fromLocalValueArray(serializedValues) {
|
|
2480
|
-
return serializedValues.map((value) => RemoteValue.fromLocalValue(value));
|
|
2481
|
-
}
|
|
2482
|
-
/**
|
|
2483
|
-
* Verifies if the given object matches the structure of a serialized LocalValue
|
|
2484
|
-
*
|
|
2485
|
-
* @param obj Object to verify
|
|
2486
|
-
* @returns boolean indicating if the object has LocalValue structure
|
|
2487
|
-
*/
|
|
2488
|
-
static isLocalValueObject(obj) {
|
|
2489
|
-
if (typeof obj !== "object" || obj === null) return false;
|
|
2490
|
-
if (!obj.hasOwnProperty("type")) return false;
|
|
2491
|
-
const type = obj[TYPE_CONSTANT];
|
|
2492
|
-
if (!Object.values({
|
|
2493
|
-
...PrimitiveType,
|
|
2494
|
-
...NonPrimitiveType
|
|
2495
|
-
}).includes(type)) return false;
|
|
2496
|
-
if (type !== PrimitiveType.Null && type !== PrimitiveType.Undefined) return obj.hasOwnProperty(VALUE_CONSTANT);
|
|
2497
|
-
return true;
|
|
2498
|
-
}
|
|
2499
|
-
};
|
|
2500
|
-
//#endregion
|
|
2501
|
-
//#region src/utils/serialize.ts
|
|
2502
|
-
/**
|
|
2503
|
-
* Unicode-safe base64 decoding that handles characters outside Latin1 range.
|
|
2504
|
-
* Unlike atob(), this properly decodes Unicode characters including emoji,
|
|
2505
|
-
* CJK characters, and currency symbols like €.
|
|
2506
|
-
* @param {string} base64 - The base64 string to decode.
|
|
2507
|
-
* @returns {string} Decoded string.
|
|
2508
|
-
*/
|
|
2509
|
-
function decodeBase64Unicode(base64) {
|
|
2510
|
-
const binary = atob(base64);
|
|
2511
|
-
const bytes = new Uint8Array(binary.length);
|
|
2512
|
-
for (let i = 0; i < binary.length; i++) bytes[i] = binary.charCodeAt(i);
|
|
2513
|
-
return new TextDecoder().decode(bytes);
|
|
2514
|
-
}
|
|
2515
|
-
/**
|
|
2516
|
-
* Deserialize a value from a string that was serialized earlier.
|
|
2517
|
-
* @param {string} value - The string to deserialize.
|
|
2518
|
-
* @returns {unknown} The deserialized value.
|
|
2519
|
-
* @deprecated will be removed in v5. Use `@AttrDeserialize()` decorator instead.
|
|
2520
|
-
*/
|
|
2521
|
-
function deserializeProperty(value) {
|
|
2522
|
-
if (typeof value !== "string" || !value.startsWith("serialized:")) return value;
|
|
2523
|
-
return RemoteValue.fromLocalValue(JSON.parse(decodeBase64Unicode(value.slice(11))));
|
|
2524
|
-
}
|
|
2525
|
-
//#endregion
|
|
2526
2423
|
//#region src/runtime/parse-property-value.ts
|
|
2527
2424
|
/**
|
|
2528
2425
|
* Parse a new property value for a given property type.
|
|
@@ -2549,14 +2446,6 @@ function deserializeProperty(value) {
|
|
|
2549
2446
|
* @returns the parsed/coerced value
|
|
2550
2447
|
*/
|
|
2551
2448
|
const parsePropertyValue = (propValue, propType, isFormAssociated) => {
|
|
2552
|
-
/**
|
|
2553
|
-
* Allow hydrate parameters that contain a complex non-serialized values.
|
|
2554
|
-
* This is SSR-specific and should only run during hydration.
|
|
2555
|
-
*/
|
|
2556
|
-
if ((BUILD.hydrateClientSide || BUILD.hydrateServerSide) && typeof propValue === "string" && propValue.startsWith("serialized:")) {
|
|
2557
|
-
propValue = deserializeProperty(propValue);
|
|
2558
|
-
return propValue;
|
|
2559
|
-
}
|
|
2560
2449
|
if (propValue != null && !isComplexType(propValue)) {
|
|
2561
2450
|
/**
|
|
2562
2451
|
* ensure this value is of the correct prop type
|
|
@@ -2585,9 +2474,6 @@ const parsePropertyValue = (propValue, propType, isFormAssociated) => {
|
|
|
2585
2474
|
return propValue;
|
|
2586
2475
|
};
|
|
2587
2476
|
//#endregion
|
|
2588
|
-
//#region src/runtime/element.ts
|
|
2589
|
-
const getElement = (ref) => BUILD.lazyLoad ? getHostRef(ref)?.$hostElement$ : ref;
|
|
2590
|
-
//#endregion
|
|
2591
2477
|
//#region src/runtime/event-emitter.ts
|
|
2592
2478
|
const createEvent = (ref, name, flags) => {
|
|
2593
2479
|
const elm = getElement(ref);
|
|
@@ -2940,7 +2826,10 @@ const putBackInOriginalLocation = (parentElm, recursive) => {
|
|
|
2940
2826
|
const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
|
|
2941
2827
|
let containerElm = BUILD.slotRelocation && parentElm["s-cr"] && parentElm["s-cr"].parentNode || parentElm;
|
|
2942
2828
|
let childNode;
|
|
2943
|
-
if (BUILD.shadowDom && containerElm.
|
|
2829
|
+
if (BUILD.shadowDom && containerElm.tagName === hostTagName) {
|
|
2830
|
+
const shadow = getShadowRoot(containerElm);
|
|
2831
|
+
if (shadow) containerElm = shadow;
|
|
2832
|
+
}
|
|
2944
2833
|
if (parentVNode.$tag$ === "template") containerElm = containerElm.content;
|
|
2945
2834
|
for (; startIdx <= endIdx; ++startIdx) if (vnodes[startIdx]) {
|
|
2946
2835
|
childNode = createElm(null, parentVNode, startIdx);
|
|
@@ -3290,7 +3179,8 @@ const insertBefore = (parent, newNode, reference, isInitialLoad) => {
|
|
|
3290
3179
|
if (BUILD.slotRelocation) {
|
|
3291
3180
|
if (BUILD.scoped && typeof newNode["s-sn"] === "string" && !!newNode["s-sr"] && !!newNode["s-cr"]) addRemoveSlotScopedClass(newNode["s-cr"], newNode, parent, newNode.parentElement);
|
|
3292
3181
|
else if (typeof newNode["s-sn"] === "string") {
|
|
3293
|
-
|
|
3182
|
+
const hostElm = newNode["s-hn"] && parent.closest?.(newNode["s-hn"]);
|
|
3183
|
+
if ((BUILD.experimentalSlotFixes || BUILD.patchAll && !!(hostElm && getHostRef(hostElm)?.$cmpMeta$.$flags$ & CMP_FLAGS.patchAll)) && parent.getRootNode().nodeType !== NODE_TYPES.DOCUMENT_FRAGMENT_NODE) patchParentNode(newNode);
|
|
3294
3184
|
parent.insertBefore(newNode, reference);
|
|
3295
3185
|
const { slotNode } = findSlotFromSlottedNode(newNode);
|
|
3296
3186
|
if (slotNode && !isInitialLoad) dispatchSlotChangeEvent(slotNode);
|
|
@@ -3379,7 +3269,7 @@ render() {
|
|
|
3379
3269
|
rootVnode.$tag$ = null;
|
|
3380
3270
|
rootVnode.$flags$ |= VNODE_FLAGS.isHost;
|
|
3381
3271
|
hostRef.$vnode$ = rootVnode;
|
|
3382
|
-
rootVnode.$elm$ = oldVNode.$elm$ = BUILD.shadowDom ? hostElm
|
|
3272
|
+
rootVnode.$elm$ = oldVNode.$elm$ = BUILD.shadowDom ? getShadowRoot(hostElm) || hostElm : hostElm;
|
|
3383
3273
|
if (BUILD.scoped || BUILD.shadowDom) scopeId = hostElm["s-sc"];
|
|
3384
3274
|
useNativeShadowDom = supportsShadow && !!(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation) && !(cmpMeta.$flags$ & CMP_FLAGS.shadowNeedsScopedCss);
|
|
3385
3275
|
if (BUILD.slotRelocation) {
|
|
@@ -3534,13 +3424,13 @@ const dispatchHooks = (hostRef, isInitialLoad) => {
|
|
|
3534
3424
|
}
|
|
3535
3425
|
if (hostRef.$fetchedCbList$.length) hostRef.$fetchedCbList$.forEach((cb) => cb(elm));
|
|
3536
3426
|
}
|
|
3537
|
-
emitLifecycleEvent(elm, "componentWillLoad");
|
|
3427
|
+
if (BUILD.lifecycleDOMEvents) emitLifecycleEvent(elm, "componentWillLoad");
|
|
3538
3428
|
maybePromise = safeCall(instance, "componentWillLoad", void 0, elm);
|
|
3539
3429
|
} else {
|
|
3540
|
-
emitLifecycleEvent(elm, "componentWillUpdate");
|
|
3430
|
+
if (BUILD.lifecycleDOMEvents) emitLifecycleEvent(elm, "componentWillUpdate");
|
|
3541
3431
|
maybePromise = safeCall(instance, "componentWillUpdate", void 0, elm);
|
|
3542
3432
|
}
|
|
3543
|
-
emitLifecycleEvent(elm, "componentWillRender");
|
|
3433
|
+
if (BUILD.lifecycleDOMEvents) emitLifecycleEvent(elm, "componentWillRender");
|
|
3544
3434
|
maybePromise = enqueue(maybePromise, () => safeCall(instance, "componentWillRender", void 0, elm));
|
|
3545
3435
|
endSchedule();
|
|
3546
3436
|
return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
|
|
@@ -3675,14 +3565,14 @@ const postUpdateComponent = (hostRef) => {
|
|
|
3675
3565
|
if (BUILD.isDev) hostRef.$flags$ |= HOST_FLAGS.devOnRender;
|
|
3676
3566
|
safeCall(instance, "componentDidRender", void 0, elm);
|
|
3677
3567
|
if (BUILD.isDev) hostRef.$flags$ &= ~HOST_FLAGS.devOnRender;
|
|
3678
|
-
emitLifecycleEvent(elm, "componentDidRender");
|
|
3568
|
+
if (BUILD.lifecycleDOMEvents) emitLifecycleEvent(elm, "componentDidRender");
|
|
3679
3569
|
if (!(hostRef.$flags$ & HOST_FLAGS.hasLoadedComponent)) {
|
|
3680
3570
|
hostRef.$flags$ |= HOST_FLAGS.hasLoadedComponent;
|
|
3681
3571
|
if (BUILD.asyncLoading && BUILD.cssAnnotations) addHydratedFlag(elm);
|
|
3682
3572
|
if (BUILD.isDev) hostRef.$flags$ |= HOST_FLAGS.devOnDidLoad;
|
|
3683
3573
|
safeCall(instance, "componentDidLoad", void 0, elm);
|
|
3684
3574
|
if (BUILD.isDev) hostRef.$flags$ &= ~HOST_FLAGS.devOnDidLoad;
|
|
3685
|
-
emitLifecycleEvent(elm, "componentDidLoad");
|
|
3575
|
+
if (BUILD.lifecycleDOMEvents) emitLifecycleEvent(elm, "componentDidLoad");
|
|
3686
3576
|
if (BUILD.propChangeCallback) hostRef.$flags$ |= HOST_FLAGS.isWatchReady;
|
|
3687
3577
|
endPostUpdate();
|
|
3688
3578
|
if (BUILD.asyncLoading) {
|
|
@@ -3693,7 +3583,7 @@ const postUpdateComponent = (hostRef) => {
|
|
|
3693
3583
|
if (BUILD.isDev) hostRef.$flags$ |= HOST_FLAGS.devOnRender;
|
|
3694
3584
|
safeCall(instance, "componentDidUpdate", void 0, elm);
|
|
3695
3585
|
if (BUILD.isDev) hostRef.$flags$ &= ~HOST_FLAGS.devOnRender;
|
|
3696
|
-
emitLifecycleEvent(elm, "componentDidUpdate");
|
|
3586
|
+
if (BUILD.lifecycleDOMEvents) emitLifecycleEvent(elm, "componentDidUpdate");
|
|
3697
3587
|
endPostUpdate();
|
|
3698
3588
|
}
|
|
3699
3589
|
if (BUILD.method && BUILD.lazyLoad) hostRef.$onInstanceResolve$(elm);
|
|
@@ -3985,9 +3875,11 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
3985
3875
|
return;
|
|
3986
3876
|
}
|
|
3987
3877
|
const propFlags = members.find(([m]) => m === propName);
|
|
3988
|
-
|
|
3878
|
+
const isBooleanTarget = propFlags && propFlags[1][0] & MEMBER_FLAGS.Boolean;
|
|
3879
|
+
const isSpuriousBooleanRemoval = isBooleanTarget && newValue === null && this[propName] === void 0;
|
|
3880
|
+
if (isBooleanTarget) newValue = !(newValue === null || newValue === "false");
|
|
3989
3881
|
const propDesc = Object.getOwnPropertyDescriptor(prototype, propName);
|
|
3990
|
-
if (newValue != this[propName] && (!propDesc.get || !!propDesc.set)) this[propName] = newValue;
|
|
3882
|
+
if (!isSpuriousBooleanRemoval && newValue != this[propName] && (!propDesc.get || !!propDesc.set)) this[propName] = newValue;
|
|
3991
3883
|
});
|
|
3992
3884
|
};
|
|
3993
3885
|
Cstr.observedAttributes = Array.from(new Set([...Object.keys(cmpMeta.$watchers$ ?? {}), ...members.filter(([_, m]) => m[0] & MEMBER_FLAGS.HasAttribute).map(([propName, m]) => {
|
|
@@ -4116,7 +4008,6 @@ const connectedCallback = (elm) => {
|
|
|
4116
4008
|
if (!hostRef) return;
|
|
4117
4009
|
const cmpMeta = hostRef.$cmpMeta$;
|
|
4118
4010
|
const endConnected = createTime("connectedCallback", cmpMeta.$tagName$);
|
|
4119
|
-
if (BUILD.hostListenerTargetParent) addHostEventListeners(elm, hostRef, cmpMeta.$listeners$, true);
|
|
4120
4011
|
if (!(hostRef.$flags$ & HOST_FLAGS.hasConnected)) {
|
|
4121
4012
|
hostRef.$flags$ |= HOST_FLAGS.hasConnected;
|
|
4122
4013
|
let hostId;
|
|
@@ -4124,7 +4015,8 @@ const connectedCallback = (elm) => {
|
|
|
4124
4015
|
hostId = elm.getAttribute(HYDRATE_ID);
|
|
4125
4016
|
if (hostId) {
|
|
4126
4017
|
if (BUILD.shadowDom && supportsShadow && cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation) {
|
|
4127
|
-
const
|
|
4018
|
+
const shadowRoot = getShadowRoot(elm);
|
|
4019
|
+
const scopeId = BUILD.mode ? addStyle(shadowRoot, cmpMeta, elm.getAttribute("s-mode")) : addStyle(shadowRoot, cmpMeta);
|
|
4128
4020
|
elm.classList.remove(scopeId + "-h", scopeId + "-s");
|
|
4129
4021
|
} else if (BUILD.scoped && cmpMeta.$flags$ & CMP_FLAGS.scopedCssEncapsulation) elm["s-sc"] = getScopeId(cmpMeta, BUILD.mode ? elm.getAttribute("s-mode") : void 0);
|
|
4130
4022
|
initializeClientHydrate(elm, cmpMeta.$tagName$, hostId, hostRef);
|
|
@@ -4163,7 +4055,7 @@ const connectedCallback = (elm) => {
|
|
|
4163
4055
|
if (BUILD.initializeNextTick) nextTick(() => initializeComponent(elm, hostRef, cmpMeta));
|
|
4164
4056
|
else initializeComponent(elm, hostRef, cmpMeta);
|
|
4165
4057
|
} else {
|
|
4166
|
-
addHostEventListeners(elm, hostRef, cmpMeta.$listeners
|
|
4058
|
+
addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
|
|
4167
4059
|
if (hostRef?.$lazyInstance$) fireConnectedCallback(hostRef.$lazyInstance$, elm);
|
|
4168
4060
|
else if (hostRef?.$onReadyPromise$) hostRef.$onReadyPromise$.then(() => fireConnectedCallback(hostRef.$lazyInstance$, elm));
|
|
4169
4061
|
}
|
|
@@ -4224,14 +4116,18 @@ const proxyCustomElement = (Cstr, compactMeta) => {
|
|
|
4224
4116
|
}
|
|
4225
4117
|
if (BUILD.reflect) cmpMeta.$attrsToReflect$ = [];
|
|
4226
4118
|
if (BUILD.shadowDom && !supportsShadow && cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation) cmpMeta.$flags$ |= CMP_FLAGS.needsShadowDomShim;
|
|
4227
|
-
if (!(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation) && cmpMeta.$flags$ & CMP_FLAGS.hasSlot) if (BUILD.experimentalSlotFixes) patchPseudoShadowDom(Cstr.prototype);
|
|
4119
|
+
if (!(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation) && cmpMeta.$flags$ & CMP_FLAGS.hasSlot) if (BUILD.experimentalSlotFixes || BUILD.patchAll && cmpMeta.$flags$ & CMP_FLAGS.patchAll) patchPseudoShadowDom(Cstr.prototype);
|
|
4228
4120
|
else {
|
|
4229
|
-
if (BUILD.slotChildNodesFix) patchChildSlotNodes(Cstr.prototype);
|
|
4230
|
-
if (BUILD.cloneNodeFix) patchCloneNode(Cstr.prototype);
|
|
4231
|
-
if (BUILD.appendChildSlotFix
|
|
4121
|
+
if (BUILD.slotChildNodesFix || BUILD.patchChildren && cmpMeta.$flags$ & CMP_FLAGS.patchChildren) patchChildSlotNodes(Cstr.prototype);
|
|
4122
|
+
if (BUILD.cloneNodeFix || BUILD.patchClone && cmpMeta.$flags$ & CMP_FLAGS.patchClone) patchCloneNode(Cstr.prototype);
|
|
4123
|
+
if (BUILD.appendChildSlotFix || BUILD.patchInsert && cmpMeta.$flags$ & CMP_FLAGS.patchInsert) {
|
|
4124
|
+
patchSlotAppendChild(Cstr.prototype);
|
|
4125
|
+
patchInsertBefore(Cstr.prototype);
|
|
4126
|
+
patchSlotRemoveChild(Cstr.prototype);
|
|
4127
|
+
}
|
|
4232
4128
|
if (BUILD.scopedSlotTextContentFix && cmpMeta.$flags$ & CMP_FLAGS.scopedCssEncapsulation) patchTextContent(Cstr.prototype);
|
|
4233
4129
|
}
|
|
4234
|
-
else if (BUILD.cloneNodeFix) patchCloneNode(Cstr.prototype);
|
|
4130
|
+
else if (BUILD.cloneNodeFix || BUILD.patchClone && cmpMeta.$flags$ & CMP_FLAGS.patchClone) patchCloneNode(Cstr.prototype);
|
|
4235
4131
|
if (BUILD.hydrateClientSide && BUILD.shadowDom) hydrateScopedToShadow();
|
|
4236
4132
|
const originalConnectedCallback = Cstr.prototype.connectedCallback;
|
|
4237
4133
|
const originalDisconnectedCallback = Cstr.prototype.disconnectedCallback;
|
|
@@ -4247,7 +4143,7 @@ const proxyCustomElement = (Cstr, compactMeta) => {
|
|
|
4247
4143
|
if (!this.__hasHostListenerAttached) {
|
|
4248
4144
|
const hostRef = getHostRef(this);
|
|
4249
4145
|
if (!hostRef) return;
|
|
4250
|
-
addHostEventListeners(this, hostRef, cmpMeta.$listeners
|
|
4146
|
+
addHostEventListeners(this, hostRef, cmpMeta.$listeners$);
|
|
4251
4147
|
this.__hasHostListenerAttached = true;
|
|
4252
4148
|
}
|
|
4253
4149
|
connectedCallback(this);
|
|
@@ -4259,8 +4155,13 @@ const proxyCustomElement = (Cstr, compactMeta) => {
|
|
|
4259
4155
|
},
|
|
4260
4156
|
__attachShadow() {
|
|
4261
4157
|
if (supportsShadow) {
|
|
4262
|
-
|
|
4263
|
-
|
|
4158
|
+
const isClosed = BUILD.shadowModeClosed && !!(cmpMeta.$flags$ & CMP_FLAGS.shadowModeClosed);
|
|
4159
|
+
let existingRoot = this.shadowRoot;
|
|
4160
|
+
if (BUILD.shadowModeClosed && isClosed) existingRoot = this.__shadowRoot ?? null;
|
|
4161
|
+
if (!existingRoot) createShadowRoot.call(this, cmpMeta);
|
|
4162
|
+
else if (BUILD.shadowModeClosed && isClosed) {
|
|
4163
|
+
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.`);
|
|
4164
|
+
}
|
|
4264
4165
|
} else this.shadowRoot = this;
|
|
4265
4166
|
}
|
|
4266
4167
|
});
|
|
@@ -4356,7 +4257,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
4356
4257
|
cmpMeta.$deserializers$ = compactMeta[6] ?? {};
|
|
4357
4258
|
}
|
|
4358
4259
|
if (BUILD.shadowDom && !supportsShadow && cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation) cmpMeta.$flags$ |= CMP_FLAGS.needsShadowDomShim;
|
|
4359
|
-
const tagName =
|
|
4260
|
+
const tagName = transformTag(cmpMeta.$tagName$);
|
|
4360
4261
|
const HostElement = class extends HTMLElement {
|
|
4361
4262
|
["s-p"];
|
|
4362
4263
|
["s-rc"];
|
|
@@ -4383,7 +4284,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
4383
4284
|
*/
|
|
4384
4285
|
if (!this.hasRegisteredEventListeners) {
|
|
4385
4286
|
this.hasRegisteredEventListeners = true;
|
|
4386
|
-
addHostEventListeners(this, hostRef, cmpMeta.$listeners
|
|
4287
|
+
addHostEventListeners(this, hostRef, cmpMeta.$listeners$);
|
|
4387
4288
|
}
|
|
4388
4289
|
if (appLoadFallback) {
|
|
4389
4290
|
clearTimeout(appLoadFallback);
|
|
@@ -4415,14 +4316,18 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
4415
4316
|
return getHostRef(this)?.$onReadyPromise$;
|
|
4416
4317
|
}
|
|
4417
4318
|
};
|
|
4418
|
-
if (!(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation) && cmpMeta.$flags$ & CMP_FLAGS.hasSlot) if (BUILD.experimentalSlotFixes) patchPseudoShadowDom(HostElement.prototype);
|
|
4319
|
+
if (!(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation) && cmpMeta.$flags$ & CMP_FLAGS.hasSlot) if (BUILD.experimentalSlotFixes || BUILD.patchAll && cmpMeta.$flags$ & CMP_FLAGS.patchAll) patchPseudoShadowDom(HostElement.prototype);
|
|
4419
4320
|
else {
|
|
4420
|
-
if (BUILD.slotChildNodesFix) patchChildSlotNodes(HostElement.prototype);
|
|
4421
|
-
if (BUILD.cloneNodeFix) patchCloneNode(HostElement.prototype);
|
|
4422
|
-
if (BUILD.appendChildSlotFix
|
|
4321
|
+
if (BUILD.slotChildNodesFix || BUILD.patchChildren && cmpMeta.$flags$ & CMP_FLAGS.patchChildren) patchChildSlotNodes(HostElement.prototype);
|
|
4322
|
+
if (BUILD.cloneNodeFix || BUILD.patchClone && cmpMeta.$flags$ & CMP_FLAGS.patchClone) patchCloneNode(HostElement.prototype);
|
|
4323
|
+
if (BUILD.appendChildSlotFix || BUILD.patchInsert && cmpMeta.$flags$ & CMP_FLAGS.patchInsert) {
|
|
4324
|
+
patchSlotAppendChild(HostElement.prototype);
|
|
4325
|
+
patchInsertBefore(HostElement.prototype);
|
|
4326
|
+
patchSlotRemoveChild(HostElement.prototype);
|
|
4327
|
+
}
|
|
4423
4328
|
if (BUILD.scopedSlotTextContentFix && cmpMeta.$flags$ & CMP_FLAGS.scopedCssEncapsulation) patchTextContent(HostElement.prototype);
|
|
4424
4329
|
}
|
|
4425
|
-
else if (BUILD.cloneNodeFix) patchCloneNode(HostElement.prototype);
|
|
4330
|
+
else if (BUILD.cloneNodeFix || BUILD.patchClone && cmpMeta.$flags$ & CMP_FLAGS.patchClone) patchCloneNode(HostElement.prototype);
|
|
4426
4331
|
if (BUILD.formAssociated && cmpMeta.$flags$ & CMP_FLAGS.formAssociated) HostElement.formAssociated = true;
|
|
4427
4332
|
if (BUILD.hotModuleReplacement) HostElement.prototype["s-hmr"] = function(hmrVersionId) {
|
|
4428
4333
|
hmrStart(this, cmpMeta, hmrVersionId);
|
|
@@ -4454,18 +4359,14 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
4454
4359
|
const Fragment = (_, children) => children;
|
|
4455
4360
|
//#endregion
|
|
4456
4361
|
//#region src/runtime/host-listener.ts
|
|
4457
|
-
const addHostEventListeners = (elm, hostRef, listeners
|
|
4458
|
-
if (BUILD.hostListener && listeners && win.document) {
|
|
4459
|
-
|
|
4460
|
-
|
|
4461
|
-
|
|
4462
|
-
|
|
4463
|
-
|
|
4464
|
-
|
|
4465
|
-
plt.ael(target, name, handler, opts);
|
|
4466
|
-
(hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
|
|
4467
|
-
});
|
|
4468
|
-
}
|
|
4362
|
+
const addHostEventListeners = (elm, hostRef, listeners) => {
|
|
4363
|
+
if (BUILD.hostListener && listeners && win.document) listeners.map(([flags, name, method]) => {
|
|
4364
|
+
const target = BUILD.hostListenerTarget ? getHostListenerTarget(win.document, elm, flags) : elm;
|
|
4365
|
+
const handler = hostListenerProxy(hostRef, method);
|
|
4366
|
+
const opts = hostListenerOpts(flags);
|
|
4367
|
+
plt.ael(target, name, handler, opts);
|
|
4368
|
+
(hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
|
|
4369
|
+
});
|
|
4469
4370
|
};
|
|
4470
4371
|
const hostListenerProxy = (hostRef, methodName) => (ev) => {
|
|
4471
4372
|
try {
|
|
@@ -4480,7 +4381,6 @@ const getHostListenerTarget = (doc, elm, flags) => {
|
|
|
4480
4381
|
if (BUILD.hostListenerTargetDocument && flags & LISTENER_FLAGS.TargetDocument) return doc;
|
|
4481
4382
|
if (BUILD.hostListenerTargetWindow && flags & LISTENER_FLAGS.TargetWindow) return win;
|
|
4482
4383
|
if (BUILD.hostListenerTargetBody && flags & LISTENER_FLAGS.TargetBody) return doc.body;
|
|
4483
|
-
if (BUILD.hostListenerTargetParent && flags & LISTENER_FLAGS.TargetParent && elm.parentElement) return elm.parentElement;
|
|
4484
4384
|
return elm;
|
|
4485
4385
|
};
|
|
4486
4386
|
const hostListenerOpts = (flags) => supportsListenerOptions ? {
|
|
@@ -4508,8 +4408,19 @@ const setPlatformOptions = (opts) => Object.assign(plt, opts);
|
|
|
4508
4408
|
//#endregion
|
|
4509
4409
|
//#region src/runtime/render.ts
|
|
4510
4410
|
/**
|
|
4411
|
+
* A WeakMap to persist HostRef objects across multiple render() calls to the
|
|
4412
|
+
* same container. This enables VNode diffing on re-renders — without it, each
|
|
4413
|
+
* call creates a fresh HostRef with no previous VNode, causing renderVdom to
|
|
4414
|
+
* replace the entire DOM subtree instead of patching only what changed.
|
|
4415
|
+
*/
|
|
4416
|
+
const hostRefCache = /* @__PURE__ */ new WeakMap();
|
|
4417
|
+
/**
|
|
4511
4418
|
* Method to render a virtual DOM tree to a container element.
|
|
4512
4419
|
*
|
|
4420
|
+
* Supports efficient re-renders: calling `render()` again on the same container
|
|
4421
|
+
* will diff the new VNode tree against the previous one and only update what changed,
|
|
4422
|
+
* preserving existing DOM elements and their state.
|
|
4423
|
+
*
|
|
4513
4424
|
* @example
|
|
4514
4425
|
* ```tsx
|
|
4515
4426
|
* import { render } from '@stencil/core';
|
|
@@ -4526,14 +4437,19 @@ const setPlatformOptions = (opts) => Object.assign(plt, opts);
|
|
|
4526
4437
|
* @param container - The container element to render the virtual DOM tree to
|
|
4527
4438
|
*/
|
|
4528
4439
|
function render(vnode, container) {
|
|
4529
|
-
|
|
4530
|
-
|
|
4531
|
-
|
|
4440
|
+
let ref = hostRefCache.get(container);
|
|
4441
|
+
if (!ref) {
|
|
4442
|
+
ref = {
|
|
4532
4443
|
$flags$: 0,
|
|
4533
|
-
$
|
|
4534
|
-
|
|
4535
|
-
|
|
4536
|
-
|
|
4444
|
+
$cmpMeta$: {
|
|
4445
|
+
$flags$: 0,
|
|
4446
|
+
$tagName$: container.tagName
|
|
4447
|
+
},
|
|
4448
|
+
$hostElement$: container
|
|
4449
|
+
};
|
|
4450
|
+
hostRefCache.set(container, ref);
|
|
4451
|
+
}
|
|
4452
|
+
renderVdom(ref, vnode);
|
|
4537
4453
|
}
|
|
4538
4454
|
//#endregion
|
|
4539
4455
|
//#region src/runtime/tag-transform.ts
|
|
@@ -4758,4 +4674,4 @@ const insertChildVNodeAnnotations = (doc, vnodeChild, cmpData, hostId, depth, in
|
|
|
4758
4674
|
}
|
|
4759
4675
|
};
|
|
4760
4676
|
//#endregion
|
|
4761
|
-
export {
|
|
4677
|
+
export { h as A, postUpdateComponent as C, getMode as D, parsePropertyValue as E, HYDRATED_STYLE_ID as F, getShadowRoot as M, getAssetPath as N, setMode as O, setAssetPath as P, getRenderingRef as S, createEvent as T, connectedCallback as _, transformTag as a, setValue as b, setNonce as c, Fragment as d, bootstrapLazy as f, disconnectedCallback as g, proxyCustomElement as h, setTagTransformer as i, getElement as j, Host as k, Mixin as l, forceModeUpdate as m, jsx as n, render as o, defineCustomElement as p, jsxs as r, setPlatformOptions as s, insertVdomAnnotations as t, addHostEventListeners as u, proxyComponent as v, renderVdom as w, forceUpdate as x, getValue as y };
|
package/dist/sys/node/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as setupNodeProcess, r as createNodeLogger, t as createNodeSys } from "../../node-
|
|
1
|
+
import { n as setupNodeProcess, r as createNodeLogger, t as createNodeSys } from "../../node-BF2jSfWg.mjs";
|
|
2
2
|
export { createNodeLogger, createNodeSys, setupNodeProcess };
|
package/dist/sys/node/worker.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { l as createWorkerMessageHandler } from "../../compiler-
|
|
2
|
-
import { t as createNodeSys } from "../../node-
|
|
1
|
+
import { l as createWorkerMessageHandler } from "../../compiler-BYRrEeD-.mjs";
|
|
2
|
+
import { t as createNodeSys } from "../../node-BF2jSfWg.mjs";
|
|
3
3
|
//#region src/sys/node/node-worker-thread.ts
|
|
4
4
|
/**
|
|
5
5
|
* Initialize a worker thread, setting up various machinery for managing
|