@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
|
@@ -29,8 +29,7 @@ const LISTENER_FLAGS = {
|
|
|
29
29
|
Capture: 2,
|
|
30
30
|
TargetDocument: 4,
|
|
31
31
|
TargetWindow: 8,
|
|
32
|
-
TargetBody: 16
|
|
33
|
-
TargetParent: 32
|
|
32
|
+
TargetBody: 16
|
|
34
33
|
};
|
|
35
34
|
const HOST_FLAGS = {
|
|
36
35
|
hasConnected: 1,
|
|
@@ -66,7 +65,12 @@ const CMP_FLAGS = {
|
|
|
66
65
|
shadowNeedsScopedCss: 128,
|
|
67
66
|
hasSlot: 256,
|
|
68
67
|
hasModernPropertyDecls: 512,
|
|
69
|
-
shadowSlotAssignmentManual: 1024
|
|
68
|
+
shadowSlotAssignmentManual: 1024,
|
|
69
|
+
shadowModeClosed: 2048,
|
|
70
|
+
patchChildren: 4096,
|
|
71
|
+
patchClone: 8192,
|
|
72
|
+
patchInsert: 16384,
|
|
73
|
+
patchAll: 32768
|
|
70
74
|
};
|
|
71
75
|
/**
|
|
72
76
|
* Namespaces
|
|
@@ -97,38 +101,6 @@ const NODE_TYPES = {
|
|
|
97
101
|
DOCUMENT_FRAGMENT_NODE: 11,
|
|
98
102
|
NOTATION_NODE: 12
|
|
99
103
|
};
|
|
100
|
-
/**
|
|
101
|
-
* Represents a primitive type.
|
|
102
|
-
* Described in https://w3c.github.io/webdriver-bidi/#type-script-PrimitiveProtocolValue.
|
|
103
|
-
*/
|
|
104
|
-
const PrimitiveType = {
|
|
105
|
-
Undefined: "undefined",
|
|
106
|
-
Null: "null",
|
|
107
|
-
String: "string",
|
|
108
|
-
Number: "number",
|
|
109
|
-
SpecialNumber: "number",
|
|
110
|
-
Boolean: "boolean",
|
|
111
|
-
BigInt: "bigint"
|
|
112
|
-
};
|
|
113
|
-
/**
|
|
114
|
-
* Represents a non-primitive type.
|
|
115
|
-
* Described in https://w3c.github.io/webdriver-bidi/#type-script-RemoteValue.
|
|
116
|
-
* @deprecated will be removed in v5. Use `@AttrDeserialize()` / `@PropDeserialize()` decorators instead.
|
|
117
|
-
*/
|
|
118
|
-
const NonPrimitiveType = {
|
|
119
|
-
Array: "array",
|
|
120
|
-
Date: "date",
|
|
121
|
-
Map: "map",
|
|
122
|
-
Object: "object",
|
|
123
|
-
RegularExpression: "regexp",
|
|
124
|
-
Set: "set",
|
|
125
|
-
Channel: "channel",
|
|
126
|
-
Symbol: "symbol"
|
|
127
|
-
};
|
|
128
|
-
/** @deprecated will be removed in v5. Use `@AttrDeserialize()` / `@PropDeserialize()` decorators instead. */
|
|
129
|
-
const TYPE_CONSTANT = "type";
|
|
130
|
-
/** @deprecated will be removed in v5. Use `@AttrDeserialize()` / `@PropDeserialize()` decorators instead. */
|
|
131
|
-
const VALUE_CONSTANT = "value";
|
|
132
104
|
//#endregion
|
|
133
105
|
//#region src/utils/get-prop-descriptor.ts
|
|
134
106
|
/**
|
|
@@ -201,14 +173,6 @@ const reWireGetterSetter = (instance, hostRef) => {
|
|
|
201
173
|
});
|
|
202
174
|
};
|
|
203
175
|
//#endregion
|
|
204
|
-
//#region src/runtime/asset-path.ts
|
|
205
|
-
const getAssetPath = (path) => {
|
|
206
|
-
const base = plt.$resourcesUrl$ || new URL(".", import.meta.url).href;
|
|
207
|
-
const assetUrl = new URL(path, base);
|
|
208
|
-
return assetUrl.origin !== win.location.origin ? assetUrl.href : assetUrl.pathname;
|
|
209
|
-
};
|
|
210
|
-
const setAssetPath = (path) => plt.$resourcesUrl$ = path;
|
|
211
|
-
//#endregion
|
|
212
176
|
//#region src/runtime/runtime-constants.ts
|
|
213
177
|
/**
|
|
214
178
|
* Bit flags for recording various properties of VDom nodes
|
|
@@ -284,12 +248,14 @@ function createStyleSheetIfNeededAndSupported(styles) {}
|
|
|
284
248
|
let globalStyleSheet;
|
|
285
249
|
const GLOBAL_STYLE_ID = "sc-global";
|
|
286
250
|
function createShadowRoot(cmpMeta) {
|
|
287
|
-
const
|
|
251
|
+
const isClosed = BUILD$1.shadowModeClosed && !!(cmpMeta.$flags$ & CMP_FLAGS.shadowModeClosed);
|
|
252
|
+
const opts = { mode: isClosed ? "closed" : "open" };
|
|
288
253
|
if (BUILD$1.shadowDelegatesFocus) opts.delegatesFocus = !!(cmpMeta.$flags$ & CMP_FLAGS.shadowDelegatesFocus);
|
|
289
254
|
if (BUILD$1.shadowSlotAssignmentManual) {
|
|
290
255
|
if (!!(cmpMeta.$flags$ & CMP_FLAGS.shadowSlotAssignmentManual)) opts.slotAssignment = "manual";
|
|
291
256
|
}
|
|
292
257
|
const shadowRoot = this.attachShadow(opts);
|
|
258
|
+
if (BUILD$1.shadowModeClosed && isClosed) this.__shadowRoot = shadowRoot;
|
|
293
259
|
if (globalStyleSheet === void 0) globalStyleSheet = createStyleSheetIfNeededAndSupported(globalStyles) ?? null;
|
|
294
260
|
if (globalStyleSheet) shadowRoot.adoptedStyleSheets = [...shadowRoot.adoptedStyleSheets, globalStyleSheet];
|
|
295
261
|
else if (globalStyles && true) {
|
|
@@ -940,6 +906,24 @@ function internalCall(node, method) {
|
|
|
940
906
|
}
|
|
941
907
|
}
|
|
942
908
|
//#endregion
|
|
909
|
+
//#region src/runtime/element.ts
|
|
910
|
+
const getElement = (ref) => BUILD$1.lazyLoad ? getHostRef(ref)?.$hostElement$ : ref;
|
|
911
|
+
/**
|
|
912
|
+
* Get the shadow root for a Stencil component's host element.
|
|
913
|
+
* This works for both open and closed shadow DOM modes.
|
|
914
|
+
*
|
|
915
|
+
* For closed shadow DOM, `element.shadowRoot` returns `null` by design,
|
|
916
|
+
* but Stencil stores the reference internally so components can still
|
|
917
|
+
* access their own shadow root.
|
|
918
|
+
*
|
|
919
|
+
* @param element The host element (from @Element() decorator)
|
|
920
|
+
* @returns The shadow root, or null if no shadow root exists
|
|
921
|
+
*/
|
|
922
|
+
const getShadowRoot = (element) => {
|
|
923
|
+
if (BUILD$1.shadowModeClosed && element.__shadowRoot) return element.__shadowRoot;
|
|
924
|
+
return element.shadowRoot;
|
|
925
|
+
};
|
|
926
|
+
//#endregion
|
|
943
927
|
//#region src/runtime/profile.ts
|
|
944
928
|
let i = 0;
|
|
945
929
|
const createTime = (fnName, tagName = "") => {
|
|
@@ -1096,7 +1080,8 @@ const addStyle = (styleContainerNode, cmpMeta, mode) => {
|
|
|
1096
1080
|
if (!BUILD$1.attachStyles || !win.document) return scopeId;
|
|
1097
1081
|
let style = styles.get(scopeId);
|
|
1098
1082
|
if (cmpMeta.$flags$ & CMP_FLAGS.hasSlotRelocation) style = getStyleWithSlotCss(style);
|
|
1099
|
-
|
|
1083
|
+
const isClosedShadowSSR = BUILD$1.hydrateServerSide && BUILD$1.shadowModeClosed && cmpMeta.$flags$ & CMP_FLAGS.shadowNeedsScopedCss && cmpMeta.$flags$ & CMP_FLAGS.shadowModeClosed;
|
|
1084
|
+
if (styleContainerNode.nodeType !== NODE_TYPE.DocumentFragment && !isClosedShadowSSR) styleContainerNode = win.document;
|
|
1100
1085
|
if (style) {
|
|
1101
1086
|
if (typeof style === "string") {
|
|
1102
1087
|
styleContainerNode = styleContainerNode.head || styleContainerNode;
|
|
@@ -1142,7 +1127,8 @@ const addStyle = (styleContainerNode, cmpMeta, mode) => {
|
|
|
1142
1127
|
/**
|
|
1143
1128
|
* attach styles at the beginning of a shadow root node if we render shadow components
|
|
1144
1129
|
*/
|
|
1145
|
-
if (cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation) styleContainerNode.
|
|
1130
|
+
if (cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation) if (isClosedShadowSSR) styleContainerNode.prepend(styleElm);
|
|
1131
|
+
else styleContainerNode.insertBefore(styleElm, null);
|
|
1146
1132
|
if (appliedStyles) appliedStyles.add(scopeId);
|
|
1147
1133
|
}
|
|
1148
1134
|
} else if (BUILD$1.constructableCSS) {
|
|
@@ -1177,7 +1163,12 @@ const attachStyles = (hostRef) => {
|
|
|
1177
1163
|
const elm = hostRef.$hostElement$;
|
|
1178
1164
|
const flags = cmpMeta.$flags$;
|
|
1179
1165
|
const endAttachStyles = createTime("attachStyles", cmpMeta.$tagName$);
|
|
1180
|
-
|
|
1166
|
+
let styleContainerNode;
|
|
1167
|
+
const shadowRoot = BUILD$1.shadowDom && supportsShadow ? getShadowRoot(elm) : null;
|
|
1168
|
+
if (shadowRoot) styleContainerNode = shadowRoot;
|
|
1169
|
+
else if (BUILD$1.hydrateServerSide && BUILD$1.shadowModeClosed && flags & CMP_FLAGS.shadowNeedsScopedCss && flags & CMP_FLAGS.shadowModeClosed) styleContainerNode = elm;
|
|
1170
|
+
else styleContainerNode = elm.getRootNode();
|
|
1171
|
+
const scopeId = addStyle(styleContainerNode, cmpMeta, hostRef.$modeName$);
|
|
1181
1172
|
if ((BUILD$1.shadowDom || BUILD$1.scoped) && BUILD$1.cssAnnotations && flags & CMP_FLAGS.needsScopedEncapsulation) {
|
|
1182
1173
|
elm["s-sc"] = scopeId;
|
|
1183
1174
|
elm.classList.add(scopeId + "-h");
|
|
@@ -1411,7 +1402,7 @@ const validateInputProperties = (inputElm) => {
|
|
|
1411
1402
|
*/
|
|
1412
1403
|
const initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
|
|
1413
1404
|
const endHydrate = createTime("hydrateClient", tagName);
|
|
1414
|
-
const shadowRoot = hostElm
|
|
1405
|
+
const shadowRoot = getShadowRoot(hostElm);
|
|
1415
1406
|
const childRenderNodes = [];
|
|
1416
1407
|
const slotNodes = [];
|
|
1417
1408
|
const slottedNodes = [];
|
|
@@ -1492,7 +1483,7 @@ const initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
|
|
|
1492
1483
|
}
|
|
1493
1484
|
addSlotRelocateNode(slottedItem.node, slottedItem.slot, false, slottedItem.node["s-oo"] || currentPos);
|
|
1494
1485
|
if (slottedItem.node.parentElement?.shadowRoot && slottedItem.node["getAttribute"] && slottedItem.node.getAttribute("slot")) slottedItem.node.removeAttribute("slot");
|
|
1495
|
-
if (BUILD$1.experimentalSlotFixes) patchSlottedNode(slottedItem.node);
|
|
1486
|
+
if (BUILD$1.experimentalSlotFixes || BUILD$1.patchAll && hostRef.$cmpMeta$.$flags$ & CMP_FLAGS.patchAll) patchSlottedNode(slottedItem.node);
|
|
1496
1487
|
}
|
|
1497
1488
|
currentPos = (slottedItem.node["s-oo"] || currentPos) + 1;
|
|
1498
1489
|
}
|
|
@@ -1814,9 +1805,12 @@ const _polyfillHost = "-shadowcsshost";
|
|
|
1814
1805
|
const _polyfillSlotted = "-shadowcssslotted";
|
|
1815
1806
|
const _polyfillHostContext = "-shadowcsscontext";
|
|
1816
1807
|
const _parenSuffix = ")(?:\\(((?:\\([^)(]*\\)|[^)(]*)+?)\\))?([^,{]*)";
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1808
|
+
let _cssColonHostRe;
|
|
1809
|
+
let _cssColonHostContextRe;
|
|
1810
|
+
let _cssColonSlottedRe;
|
|
1811
|
+
const getCssColonHostRe = () => _cssColonHostRe ??= new RegExp("(" + _polyfillHost + _parenSuffix, "gim");
|
|
1812
|
+
const getCssColonHostContextRe = () => _cssColonHostContextRe ??= new RegExp("(" + _polyfillHostContext + _parenSuffix, "gim");
|
|
1813
|
+
const getCssColonSlottedRe = () => _cssColonSlottedRe ??= new RegExp("(" + _polyfillSlotted + _parenSuffix, "gim");
|
|
1820
1814
|
const _polyfillHostNoCombinator = _polyfillHost + "-no-combinator";
|
|
1821
1815
|
const _polyfillHostNoCombinatorRe = /-shadowcsshost-no-combinator([^\s]*)/;
|
|
1822
1816
|
const _shadowDOMSelectorsRe = [/::shadow/g, /::content/g];
|
|
@@ -1976,7 +1970,7 @@ const colonHostPartReplacer = (host, part, suffix) => {
|
|
|
1976
1970
|
return host + part.replace(_polyfillHost, "") + suffix;
|
|
1977
1971
|
};
|
|
1978
1972
|
const convertColonHost = (cssText) => {
|
|
1979
|
-
return convertColonRule(cssText,
|
|
1973
|
+
return convertColonRule(cssText, getCssColonHostRe(), colonHostPartReplacer);
|
|
1980
1974
|
};
|
|
1981
1975
|
const colonHostContextPartReplacer = (host, part, suffix) => {
|
|
1982
1976
|
if (part.indexOf(_polyfillHost) > -1) return colonHostPartReplacer(host, part, suffix);
|
|
@@ -1985,7 +1979,7 @@ const colonHostContextPartReplacer = (host, part, suffix) => {
|
|
|
1985
1979
|
const convertColonSlotted = (cssText, slotScopeId) => {
|
|
1986
1980
|
const slotClass = "." + slotScopeId + " > ";
|
|
1987
1981
|
const selectors = [];
|
|
1988
|
-
cssText = cssText.replace(
|
|
1982
|
+
cssText = cssText.replace(getCssColonSlottedRe(), (...m) => {
|
|
1989
1983
|
if (m[2]) {
|
|
1990
1984
|
const compound = m[2].trim();
|
|
1991
1985
|
const suffix = m[3];
|
|
@@ -2014,7 +2008,7 @@ const convertColonSlotted = (cssText, slotScopeId) => {
|
|
|
2014
2008
|
};
|
|
2015
2009
|
};
|
|
2016
2010
|
const convertColonHostContext = (cssText) => {
|
|
2017
|
-
return convertColonRule(cssText,
|
|
2011
|
+
return convertColonRule(cssText, getCssColonHostContextRe(), colonHostContextPartReplacer);
|
|
2018
2012
|
};
|
|
2019
2013
|
const convertShadowDOMSelectors = (cssText) => {
|
|
2020
2014
|
return _shadowDOMSelectorsRe.reduce((result, pattern) => result.replace(pattern, " "), cssText);
|
|
@@ -2203,111 +2197,6 @@ const computeMode = (elm) => modeResolutionChain.map((h) => h(elm)).find((m) =>
|
|
|
2203
2197
|
const setMode = (handler) => modeResolutionChain.push(handler);
|
|
2204
2198
|
const getMode = (ref) => getHostRef(ref)?.$modeName$;
|
|
2205
2199
|
//#endregion
|
|
2206
|
-
//#region src/utils/remote-value.ts
|
|
2207
|
-
/**
|
|
2208
|
-
* RemoteValue class for deserializing LocalValue serialized objects back into their original form
|
|
2209
|
-
* @deprecated will be removed in v5. Use `@AttrDeserialize()` / `@PropDeserialize()` decorators instead.
|
|
2210
|
-
*/
|
|
2211
|
-
var RemoteValue = class RemoteValue {
|
|
2212
|
-
/**
|
|
2213
|
-
* Deserializes a LocalValue serialized object back to its original JavaScript representation
|
|
2214
|
-
*
|
|
2215
|
-
* @param serialized The serialized LocalValue object
|
|
2216
|
-
* @returns The original JavaScript value/object
|
|
2217
|
-
*/
|
|
2218
|
-
static fromLocalValue(serialized) {
|
|
2219
|
-
const type = serialized[TYPE_CONSTANT];
|
|
2220
|
-
const value = "value" in serialized ? serialized[VALUE_CONSTANT] : void 0;
|
|
2221
|
-
switch (type) {
|
|
2222
|
-
case PrimitiveType.String: return value;
|
|
2223
|
-
case PrimitiveType.Boolean: return value;
|
|
2224
|
-
case PrimitiveType.BigInt: return BigInt(value);
|
|
2225
|
-
case PrimitiveType.Undefined: return;
|
|
2226
|
-
case PrimitiveType.Null: return null;
|
|
2227
|
-
case PrimitiveType.Number:
|
|
2228
|
-
if (value === "NaN") return NaN;
|
|
2229
|
-
if (value === "-0") return -0;
|
|
2230
|
-
if (value === "Infinity") return Infinity;
|
|
2231
|
-
if (value === "-Infinity") return -Infinity;
|
|
2232
|
-
return value;
|
|
2233
|
-
case NonPrimitiveType.Array: return value.map((item) => RemoteValue.fromLocalValue(item));
|
|
2234
|
-
case NonPrimitiveType.Date: return new Date(value);
|
|
2235
|
-
case NonPrimitiveType.Map:
|
|
2236
|
-
const map = /* @__PURE__ */ new Map();
|
|
2237
|
-
for (const [key, val] of value) {
|
|
2238
|
-
const deserializedKey = typeof key === "object" && key !== null ? RemoteValue.fromLocalValue(key) : key;
|
|
2239
|
-
const deserializedValue = RemoteValue.fromLocalValue(val);
|
|
2240
|
-
map.set(deserializedKey, deserializedValue);
|
|
2241
|
-
}
|
|
2242
|
-
return map;
|
|
2243
|
-
case NonPrimitiveType.Object:
|
|
2244
|
-
const obj = {};
|
|
2245
|
-
for (const [key, val] of value) obj[key] = RemoteValue.fromLocalValue(val);
|
|
2246
|
-
return obj;
|
|
2247
|
-
case NonPrimitiveType.RegularExpression:
|
|
2248
|
-
const { pattern, flags } = value;
|
|
2249
|
-
return new RegExp(pattern, flags);
|
|
2250
|
-
case NonPrimitiveType.Set:
|
|
2251
|
-
const set = /* @__PURE__ */ new Set();
|
|
2252
|
-
for (const item of value) set.add(RemoteValue.fromLocalValue(item));
|
|
2253
|
-
return set;
|
|
2254
|
-
case NonPrimitiveType.Symbol: return Symbol(value);
|
|
2255
|
-
default: throw new Error(`Unsupported type: ${type}`);
|
|
2256
|
-
}
|
|
2257
|
-
}
|
|
2258
|
-
/**
|
|
2259
|
-
* Utility method to deserialize multiple LocalValues at once
|
|
2260
|
-
*
|
|
2261
|
-
* @param serializedValues Array of serialized LocalValue objects
|
|
2262
|
-
* @returns Array of deserialized JavaScript values
|
|
2263
|
-
*/
|
|
2264
|
-
static fromLocalValueArray(serializedValues) {
|
|
2265
|
-
return serializedValues.map((value) => RemoteValue.fromLocalValue(value));
|
|
2266
|
-
}
|
|
2267
|
-
/**
|
|
2268
|
-
* Verifies if the given object matches the structure of a serialized LocalValue
|
|
2269
|
-
*
|
|
2270
|
-
* @param obj Object to verify
|
|
2271
|
-
* @returns boolean indicating if the object has LocalValue structure
|
|
2272
|
-
*/
|
|
2273
|
-
static isLocalValueObject(obj) {
|
|
2274
|
-
if (typeof obj !== "object" || obj === null) return false;
|
|
2275
|
-
if (!obj.hasOwnProperty("type")) return false;
|
|
2276
|
-
const type = obj[TYPE_CONSTANT];
|
|
2277
|
-
if (!Object.values({
|
|
2278
|
-
...PrimitiveType,
|
|
2279
|
-
...NonPrimitiveType
|
|
2280
|
-
}).includes(type)) return false;
|
|
2281
|
-
if (type !== PrimitiveType.Null && type !== PrimitiveType.Undefined) return obj.hasOwnProperty(VALUE_CONSTANT);
|
|
2282
|
-
return true;
|
|
2283
|
-
}
|
|
2284
|
-
};
|
|
2285
|
-
//#endregion
|
|
2286
|
-
//#region src/utils/serialize.ts
|
|
2287
|
-
/**
|
|
2288
|
-
* Unicode-safe base64 decoding that handles characters outside Latin1 range.
|
|
2289
|
-
* Unlike atob(), this properly decodes Unicode characters including emoji,
|
|
2290
|
-
* CJK characters, and currency symbols like €.
|
|
2291
|
-
* @param {string} base64 - The base64 string to decode.
|
|
2292
|
-
* @returns {string} Decoded string.
|
|
2293
|
-
*/
|
|
2294
|
-
function decodeBase64Unicode(base64) {
|
|
2295
|
-
const binary = atob(base64);
|
|
2296
|
-
const bytes = new Uint8Array(binary.length);
|
|
2297
|
-
for (let i = 0; i < binary.length; i++) bytes[i] = binary.charCodeAt(i);
|
|
2298
|
-
return new TextDecoder().decode(bytes);
|
|
2299
|
-
}
|
|
2300
|
-
/**
|
|
2301
|
-
* Deserialize a value from a string that was serialized earlier.
|
|
2302
|
-
* @param {string} value - The string to deserialize.
|
|
2303
|
-
* @returns {unknown} The deserialized value.
|
|
2304
|
-
* @deprecated will be removed in v5. Use `@AttrDeserialize()` decorator instead.
|
|
2305
|
-
*/
|
|
2306
|
-
function deserializeProperty(value) {
|
|
2307
|
-
if (typeof value !== "string" || !value.startsWith("serialized:")) return value;
|
|
2308
|
-
return RemoteValue.fromLocalValue(JSON.parse(decodeBase64Unicode(value.slice(11))));
|
|
2309
|
-
}
|
|
2310
|
-
//#endregion
|
|
2311
2200
|
//#region src/runtime/parse-property-value.ts
|
|
2312
2201
|
/**
|
|
2313
2202
|
* Parse a new property value for a given property type.
|
|
@@ -2334,14 +2223,6 @@ function deserializeProperty(value) {
|
|
|
2334
2223
|
* @returns the parsed/coerced value
|
|
2335
2224
|
*/
|
|
2336
2225
|
const parsePropertyValue = (propValue, propType, isFormAssociated) => {
|
|
2337
|
-
/**
|
|
2338
|
-
* Allow hydrate parameters that contain a complex non-serialized values.
|
|
2339
|
-
* This is SSR-specific and should only run during hydration.
|
|
2340
|
-
*/
|
|
2341
|
-
if ((BUILD$1.hydrateClientSide || BUILD$1.hydrateServerSide) && typeof propValue === "string" && propValue.startsWith("serialized:")) {
|
|
2342
|
-
propValue = deserializeProperty(propValue);
|
|
2343
|
-
return propValue;
|
|
2344
|
-
}
|
|
2345
2226
|
if (propValue != null && !isComplexType(propValue)) {
|
|
2346
2227
|
/**
|
|
2347
2228
|
* ensure this value is of the correct prop type
|
|
@@ -2370,9 +2251,6 @@ const parsePropertyValue = (propValue, propType, isFormAssociated) => {
|
|
|
2370
2251
|
return propValue;
|
|
2371
2252
|
};
|
|
2372
2253
|
//#endregion
|
|
2373
|
-
//#region src/runtime/element.ts
|
|
2374
|
-
const getElement = (ref) => BUILD$1.lazyLoad ? getHostRef(ref)?.$hostElement$ : ref;
|
|
2375
|
-
//#endregion
|
|
2376
2254
|
//#region src/runtime/event-emitter.ts
|
|
2377
2255
|
const createEvent = (ref, name, flags) => {
|
|
2378
2256
|
const elm = getElement(ref);
|
|
@@ -2725,7 +2603,10 @@ const putBackInOriginalLocation = (parentElm, recursive) => {
|
|
|
2725
2603
|
const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
|
|
2726
2604
|
let containerElm = BUILD$1.slotRelocation && parentElm["s-cr"] && parentElm["s-cr"].parentNode || parentElm;
|
|
2727
2605
|
let childNode;
|
|
2728
|
-
if (BUILD$1.shadowDom && containerElm.
|
|
2606
|
+
if (BUILD$1.shadowDom && containerElm.tagName === hostTagName) {
|
|
2607
|
+
const shadow = getShadowRoot(containerElm);
|
|
2608
|
+
if (shadow) containerElm = shadow;
|
|
2609
|
+
}
|
|
2729
2610
|
if (parentVNode.$tag$ === "template") containerElm = containerElm.content;
|
|
2730
2611
|
for (; startIdx <= endIdx; ++startIdx) if (vnodes[startIdx]) {
|
|
2731
2612
|
childNode = createElm(null, parentVNode, startIdx);
|
|
@@ -3075,7 +2956,8 @@ const insertBefore = (parent, newNode, reference, isInitialLoad) => {
|
|
|
3075
2956
|
if (BUILD$1.slotRelocation) {
|
|
3076
2957
|
if (BUILD$1.scoped && typeof newNode["s-sn"] === "string" && !!newNode["s-sr"] && !!newNode["s-cr"]) addRemoveSlotScopedClass(newNode["s-cr"], newNode, parent, newNode.parentElement);
|
|
3077
2958
|
else if (typeof newNode["s-sn"] === "string") {
|
|
3078
|
-
|
|
2959
|
+
const hostElm = newNode["s-hn"] && parent.closest?.(newNode["s-hn"]);
|
|
2960
|
+
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);
|
|
3079
2961
|
parent.insertBefore(newNode, reference);
|
|
3080
2962
|
const { slotNode } = findSlotFromSlottedNode(newNode);
|
|
3081
2963
|
if (slotNode && !isInitialLoad) dispatchSlotChangeEvent(slotNode);
|
|
@@ -3164,7 +3046,7 @@ render() {
|
|
|
3164
3046
|
rootVnode.$tag$ = null;
|
|
3165
3047
|
rootVnode.$flags$ |= VNODE_FLAGS.isHost;
|
|
3166
3048
|
hostRef.$vnode$ = rootVnode;
|
|
3167
|
-
rootVnode.$elm$ = oldVNode.$elm$ = BUILD$1.shadowDom ? hostElm
|
|
3049
|
+
rootVnode.$elm$ = oldVNode.$elm$ = BUILD$1.shadowDom ? getShadowRoot(hostElm) || hostElm : hostElm;
|
|
3168
3050
|
if (BUILD$1.scoped || BUILD$1.shadowDom) scopeId = hostElm["s-sc"];
|
|
3169
3051
|
useNativeShadowDom = supportsShadow && !!(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation) && !(cmpMeta.$flags$ & CMP_FLAGS.shadowNeedsScopedCss);
|
|
3170
3052
|
if (BUILD$1.slotRelocation) {
|
|
@@ -3319,13 +3201,13 @@ const dispatchHooks = (hostRef, isInitialLoad) => {
|
|
|
3319
3201
|
}
|
|
3320
3202
|
if (hostRef.$fetchedCbList$.length) hostRef.$fetchedCbList$.forEach((cb) => cb(elm));
|
|
3321
3203
|
}
|
|
3322
|
-
emitLifecycleEvent(elm, "componentWillLoad");
|
|
3204
|
+
if (BUILD$1.lifecycleDOMEvents) emitLifecycleEvent(elm, "componentWillLoad");
|
|
3323
3205
|
maybePromise = safeCall(instance, "componentWillLoad", void 0, elm);
|
|
3324
3206
|
} else {
|
|
3325
|
-
emitLifecycleEvent(elm, "componentWillUpdate");
|
|
3207
|
+
if (BUILD$1.lifecycleDOMEvents) emitLifecycleEvent(elm, "componentWillUpdate");
|
|
3326
3208
|
maybePromise = safeCall(instance, "componentWillUpdate", void 0, elm);
|
|
3327
3209
|
}
|
|
3328
|
-
emitLifecycleEvent(elm, "componentWillRender");
|
|
3210
|
+
if (BUILD$1.lifecycleDOMEvents) emitLifecycleEvent(elm, "componentWillRender");
|
|
3329
3211
|
maybePromise = enqueue(maybePromise, () => safeCall(instance, "componentWillRender", void 0, elm));
|
|
3330
3212
|
endSchedule();
|
|
3331
3213
|
return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
|
|
@@ -3460,14 +3342,14 @@ const postUpdateComponent = (hostRef) => {
|
|
|
3460
3342
|
if (BUILD$1.isDev) hostRef.$flags$ |= HOST_FLAGS.devOnRender;
|
|
3461
3343
|
safeCall(instance, "componentDidRender", void 0, elm);
|
|
3462
3344
|
if (BUILD$1.isDev) hostRef.$flags$ &= ~HOST_FLAGS.devOnRender;
|
|
3463
|
-
emitLifecycleEvent(elm, "componentDidRender");
|
|
3345
|
+
if (BUILD$1.lifecycleDOMEvents) emitLifecycleEvent(elm, "componentDidRender");
|
|
3464
3346
|
if (!(hostRef.$flags$ & HOST_FLAGS.hasLoadedComponent)) {
|
|
3465
3347
|
hostRef.$flags$ |= HOST_FLAGS.hasLoadedComponent;
|
|
3466
3348
|
if (BUILD$1.asyncLoading && BUILD$1.cssAnnotations) addHydratedFlag(elm);
|
|
3467
3349
|
if (BUILD$1.isDev) hostRef.$flags$ |= HOST_FLAGS.devOnDidLoad;
|
|
3468
3350
|
safeCall(instance, "componentDidLoad", void 0, elm);
|
|
3469
3351
|
if (BUILD$1.isDev) hostRef.$flags$ &= ~HOST_FLAGS.devOnDidLoad;
|
|
3470
|
-
emitLifecycleEvent(elm, "componentDidLoad");
|
|
3352
|
+
if (BUILD$1.lifecycleDOMEvents) emitLifecycleEvent(elm, "componentDidLoad");
|
|
3471
3353
|
if (BUILD$1.propChangeCallback) hostRef.$flags$ |= HOST_FLAGS.isWatchReady;
|
|
3472
3354
|
endPostUpdate();
|
|
3473
3355
|
if (BUILD$1.asyncLoading) {
|
|
@@ -3478,7 +3360,7 @@ const postUpdateComponent = (hostRef) => {
|
|
|
3478
3360
|
if (BUILD$1.isDev) hostRef.$flags$ |= HOST_FLAGS.devOnRender;
|
|
3479
3361
|
safeCall(instance, "componentDidUpdate", void 0, elm);
|
|
3480
3362
|
if (BUILD$1.isDev) hostRef.$flags$ &= ~HOST_FLAGS.devOnRender;
|
|
3481
|
-
emitLifecycleEvent(elm, "componentDidUpdate");
|
|
3363
|
+
if (BUILD$1.lifecycleDOMEvents) emitLifecycleEvent(elm, "componentDidUpdate");
|
|
3482
3364
|
endPostUpdate();
|
|
3483
3365
|
}
|
|
3484
3366
|
if (BUILD$1.method && BUILD$1.lazyLoad) hostRef.$onInstanceResolve$(elm);
|
|
@@ -3770,9 +3652,11 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
3770
3652
|
return;
|
|
3771
3653
|
}
|
|
3772
3654
|
const propFlags = members.find(([m]) => m === propName);
|
|
3773
|
-
|
|
3655
|
+
const isBooleanTarget = propFlags && propFlags[1][0] & MEMBER_FLAGS.Boolean;
|
|
3656
|
+
const isSpuriousBooleanRemoval = isBooleanTarget && newValue === null && this[propName] === void 0;
|
|
3657
|
+
if (isBooleanTarget) newValue = !(newValue === null || newValue === "false");
|
|
3774
3658
|
const propDesc = Object.getOwnPropertyDescriptor(prototype, propName);
|
|
3775
|
-
if (newValue != this[propName] && (!propDesc.get || !!propDesc.set)) this[propName] = newValue;
|
|
3659
|
+
if (!isSpuriousBooleanRemoval && newValue != this[propName] && (!propDesc.get || !!propDesc.set)) this[propName] = newValue;
|
|
3776
3660
|
});
|
|
3777
3661
|
};
|
|
3778
3662
|
Cstr.observedAttributes = Array.from(new Set([...Object.keys(cmpMeta.$watchers$ ?? {}), ...members.filter(([_, m]) => m[0] & MEMBER_FLAGS.HasAttribute).map(([propName, m]) => {
|
|
@@ -3901,7 +3785,6 @@ const connectedCallback = (elm) => {
|
|
|
3901
3785
|
if (!hostRef) return;
|
|
3902
3786
|
const cmpMeta = hostRef.$cmpMeta$;
|
|
3903
3787
|
const endConnected = createTime("connectedCallback", cmpMeta.$tagName$);
|
|
3904
|
-
if (BUILD$1.hostListenerTargetParent) addHostEventListeners(elm, hostRef, cmpMeta.$listeners$, true);
|
|
3905
3788
|
if (!(hostRef.$flags$ & HOST_FLAGS.hasConnected)) {
|
|
3906
3789
|
hostRef.$flags$ |= HOST_FLAGS.hasConnected;
|
|
3907
3790
|
let hostId;
|
|
@@ -3909,7 +3792,8 @@ const connectedCallback = (elm) => {
|
|
|
3909
3792
|
hostId = elm.getAttribute(HYDRATE_ID);
|
|
3910
3793
|
if (hostId) {
|
|
3911
3794
|
if (BUILD$1.shadowDom && supportsShadow && cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation) {
|
|
3912
|
-
const
|
|
3795
|
+
const shadowRoot = getShadowRoot(elm);
|
|
3796
|
+
const scopeId = BUILD$1.mode ? addStyle(shadowRoot, cmpMeta, elm.getAttribute("s-mode")) : addStyle(shadowRoot, cmpMeta);
|
|
3913
3797
|
elm.classList.remove(scopeId + "-h", scopeId + "-s");
|
|
3914
3798
|
} else if (BUILD$1.scoped && cmpMeta.$flags$ & CMP_FLAGS.scopedCssEncapsulation) elm["s-sc"] = getScopeId(cmpMeta, BUILD$1.mode ? elm.getAttribute("s-mode") : void 0);
|
|
3915
3799
|
initializeClientHydrate(elm, cmpMeta.$tagName$, hostId, hostRef);
|
|
@@ -3948,7 +3832,7 @@ const connectedCallback = (elm) => {
|
|
|
3948
3832
|
if (BUILD$1.initializeNextTick) nextTick(() => initializeComponent(elm, hostRef, cmpMeta));
|
|
3949
3833
|
else initializeComponent(elm, hostRef, cmpMeta);
|
|
3950
3834
|
} else {
|
|
3951
|
-
addHostEventListeners(elm, hostRef, cmpMeta.$listeners
|
|
3835
|
+
addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
|
|
3952
3836
|
if (hostRef?.$lazyInstance$) fireConnectedCallback(hostRef.$lazyInstance$, elm);
|
|
3953
3837
|
else if (hostRef?.$onReadyPromise$) hostRef.$onReadyPromise$.then(() => fireConnectedCallback(hostRef.$lazyInstance$, elm));
|
|
3954
3838
|
}
|
|
@@ -4009,14 +3893,18 @@ const proxyCustomElement = (Cstr, compactMeta) => {
|
|
|
4009
3893
|
}
|
|
4010
3894
|
if (BUILD$1.reflect) cmpMeta.$attrsToReflect$ = [];
|
|
4011
3895
|
if (BUILD$1.shadowDom && !supportsShadow && cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation) cmpMeta.$flags$ |= CMP_FLAGS.needsShadowDomShim;
|
|
4012
|
-
if (!(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation) && cmpMeta.$flags$ & CMP_FLAGS.hasSlot) if (BUILD$1.experimentalSlotFixes) patchPseudoShadowDom(Cstr.prototype);
|
|
3896
|
+
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);
|
|
4013
3897
|
else {
|
|
4014
|
-
if (BUILD$1.slotChildNodesFix) patchChildSlotNodes(Cstr.prototype);
|
|
4015
|
-
if (BUILD$1.cloneNodeFix) patchCloneNode(Cstr.prototype);
|
|
4016
|
-
if (BUILD$1.appendChildSlotFix
|
|
3898
|
+
if (BUILD$1.slotChildNodesFix || BUILD$1.patchChildren && cmpMeta.$flags$ & CMP_FLAGS.patchChildren) patchChildSlotNodes(Cstr.prototype);
|
|
3899
|
+
if (BUILD$1.cloneNodeFix || BUILD$1.patchClone && cmpMeta.$flags$ & CMP_FLAGS.patchClone) patchCloneNode(Cstr.prototype);
|
|
3900
|
+
if (BUILD$1.appendChildSlotFix || BUILD$1.patchInsert && cmpMeta.$flags$ & CMP_FLAGS.patchInsert) {
|
|
3901
|
+
patchSlotAppendChild(Cstr.prototype);
|
|
3902
|
+
patchInsertBefore(Cstr.prototype);
|
|
3903
|
+
patchSlotRemoveChild(Cstr.prototype);
|
|
3904
|
+
}
|
|
4017
3905
|
if (BUILD$1.scopedSlotTextContentFix && cmpMeta.$flags$ & CMP_FLAGS.scopedCssEncapsulation) patchTextContent(Cstr.prototype);
|
|
4018
3906
|
}
|
|
4019
|
-
else if (BUILD$1.cloneNodeFix) patchCloneNode(Cstr.prototype);
|
|
3907
|
+
else if (BUILD$1.cloneNodeFix || BUILD$1.patchClone && cmpMeta.$flags$ & CMP_FLAGS.patchClone) patchCloneNode(Cstr.prototype);
|
|
4020
3908
|
if (BUILD$1.hydrateClientSide && BUILD$1.shadowDom) hydrateScopedToShadow();
|
|
4021
3909
|
const originalConnectedCallback = Cstr.prototype.connectedCallback;
|
|
4022
3910
|
const originalDisconnectedCallback = Cstr.prototype.disconnectedCallback;
|
|
@@ -4032,7 +3920,7 @@ const proxyCustomElement = (Cstr, compactMeta) => {
|
|
|
4032
3920
|
if (!this.__hasHostListenerAttached) {
|
|
4033
3921
|
const hostRef = getHostRef(this);
|
|
4034
3922
|
if (!hostRef) return;
|
|
4035
|
-
addHostEventListeners(this, hostRef, cmpMeta.$listeners
|
|
3923
|
+
addHostEventListeners(this, hostRef, cmpMeta.$listeners$);
|
|
4036
3924
|
this.__hasHostListenerAttached = true;
|
|
4037
3925
|
}
|
|
4038
3926
|
connectedCallback(this);
|
|
@@ -4044,8 +3932,13 @@ const proxyCustomElement = (Cstr, compactMeta) => {
|
|
|
4044
3932
|
},
|
|
4045
3933
|
__attachShadow() {
|
|
4046
3934
|
if (supportsShadow) {
|
|
4047
|
-
|
|
4048
|
-
|
|
3935
|
+
const isClosed = BUILD$1.shadowModeClosed && !!(cmpMeta.$flags$ & CMP_FLAGS.shadowModeClosed);
|
|
3936
|
+
let existingRoot = this.shadowRoot;
|
|
3937
|
+
if (BUILD$1.shadowModeClosed && isClosed) existingRoot = this.__shadowRoot ?? null;
|
|
3938
|
+
if (!existingRoot) createShadowRoot.call(this, cmpMeta);
|
|
3939
|
+
else if (BUILD$1.shadowModeClosed && isClosed) {
|
|
3940
|
+
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.`);
|
|
3941
|
+
}
|
|
4049
3942
|
} else this.shadowRoot = this;
|
|
4050
3943
|
}
|
|
4051
3944
|
});
|
|
@@ -4141,7 +4034,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
4141
4034
|
cmpMeta.$deserializers$ = compactMeta[6] ?? {};
|
|
4142
4035
|
}
|
|
4143
4036
|
if (BUILD$1.shadowDom && !supportsShadow && cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation) cmpMeta.$flags$ |= CMP_FLAGS.needsShadowDomShim;
|
|
4144
|
-
const tagName =
|
|
4037
|
+
const tagName = transformTag(cmpMeta.$tagName$);
|
|
4145
4038
|
const HostElement = class extends HTMLElement {
|
|
4146
4039
|
["s-p"];
|
|
4147
4040
|
["s-rc"];
|
|
@@ -4168,7 +4061,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
4168
4061
|
*/
|
|
4169
4062
|
if (!this.hasRegisteredEventListeners) {
|
|
4170
4063
|
this.hasRegisteredEventListeners = true;
|
|
4171
|
-
addHostEventListeners(this, hostRef, cmpMeta.$listeners
|
|
4064
|
+
addHostEventListeners(this, hostRef, cmpMeta.$listeners$);
|
|
4172
4065
|
}
|
|
4173
4066
|
if (appLoadFallback) {
|
|
4174
4067
|
clearTimeout(appLoadFallback);
|
|
@@ -4200,14 +4093,18 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
4200
4093
|
return getHostRef(this)?.$onReadyPromise$;
|
|
4201
4094
|
}
|
|
4202
4095
|
};
|
|
4203
|
-
if (!(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation) && cmpMeta.$flags$ & CMP_FLAGS.hasSlot) if (BUILD$1.experimentalSlotFixes) patchPseudoShadowDom(HostElement.prototype);
|
|
4096
|
+
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);
|
|
4204
4097
|
else {
|
|
4205
|
-
if (BUILD$1.slotChildNodesFix) patchChildSlotNodes(HostElement.prototype);
|
|
4206
|
-
if (BUILD$1.cloneNodeFix) patchCloneNode(HostElement.prototype);
|
|
4207
|
-
if (BUILD$1.appendChildSlotFix
|
|
4098
|
+
if (BUILD$1.slotChildNodesFix || BUILD$1.patchChildren && cmpMeta.$flags$ & CMP_FLAGS.patchChildren) patchChildSlotNodes(HostElement.prototype);
|
|
4099
|
+
if (BUILD$1.cloneNodeFix || BUILD$1.patchClone && cmpMeta.$flags$ & CMP_FLAGS.patchClone) patchCloneNode(HostElement.prototype);
|
|
4100
|
+
if (BUILD$1.appendChildSlotFix || BUILD$1.patchInsert && cmpMeta.$flags$ & CMP_FLAGS.patchInsert) {
|
|
4101
|
+
patchSlotAppendChild(HostElement.prototype);
|
|
4102
|
+
patchInsertBefore(HostElement.prototype);
|
|
4103
|
+
patchSlotRemoveChild(HostElement.prototype);
|
|
4104
|
+
}
|
|
4208
4105
|
if (BUILD$1.scopedSlotTextContentFix && cmpMeta.$flags$ & CMP_FLAGS.scopedCssEncapsulation) patchTextContent(HostElement.prototype);
|
|
4209
4106
|
}
|
|
4210
|
-
else if (BUILD$1.cloneNodeFix) patchCloneNode(HostElement.prototype);
|
|
4107
|
+
else if (BUILD$1.cloneNodeFix || BUILD$1.patchClone && cmpMeta.$flags$ & CMP_FLAGS.patchClone) patchCloneNode(HostElement.prototype);
|
|
4211
4108
|
if (BUILD$1.formAssociated && cmpMeta.$flags$ & CMP_FLAGS.formAssociated) HostElement.formAssociated = true;
|
|
4212
4109
|
if (BUILD$1.hotModuleReplacement) HostElement.prototype["s-hmr"] = function(hmrVersionId) {
|
|
4213
4110
|
hmrStart(this, cmpMeta, hmrVersionId);
|
|
@@ -4239,18 +4136,14 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
4239
4136
|
const Fragment = (_, children) => children;
|
|
4240
4137
|
//#endregion
|
|
4241
4138
|
//#region src/runtime/host-listener.ts
|
|
4242
|
-
const addHostEventListeners = (elm, hostRef, listeners
|
|
4243
|
-
if (BUILD$1.hostListener && listeners && win.document) {
|
|
4244
|
-
|
|
4245
|
-
|
|
4246
|
-
|
|
4247
|
-
|
|
4248
|
-
|
|
4249
|
-
|
|
4250
|
-
plt.ael(target, name, handler, opts);
|
|
4251
|
-
(hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
|
|
4252
|
-
});
|
|
4253
|
-
}
|
|
4139
|
+
const addHostEventListeners = (elm, hostRef, listeners) => {
|
|
4140
|
+
if (BUILD$1.hostListener && listeners && win.document) listeners.map(([flags, name, method]) => {
|
|
4141
|
+
const target = BUILD$1.hostListenerTarget ? getHostListenerTarget(win.document, elm, flags) : elm;
|
|
4142
|
+
const handler = hostListenerProxy(hostRef, method);
|
|
4143
|
+
const opts = hostListenerOpts(flags);
|
|
4144
|
+
plt.ael(target, name, handler, opts);
|
|
4145
|
+
(hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
|
|
4146
|
+
});
|
|
4254
4147
|
};
|
|
4255
4148
|
const hostListenerProxy = (hostRef, methodName) => (ev) => {
|
|
4256
4149
|
try {
|
|
@@ -4265,7 +4158,6 @@ const getHostListenerTarget = (doc, elm, flags) => {
|
|
|
4265
4158
|
if (BUILD$1.hostListenerTargetDocument && flags & LISTENER_FLAGS.TargetDocument) return doc;
|
|
4266
4159
|
if (BUILD$1.hostListenerTargetWindow && flags & LISTENER_FLAGS.TargetWindow) return win;
|
|
4267
4160
|
if (BUILD$1.hostListenerTargetBody && flags & LISTENER_FLAGS.TargetBody) return doc.body;
|
|
4268
|
-
if (BUILD$1.hostListenerTargetParent && flags & LISTENER_FLAGS.TargetParent && elm.parentElement) return elm.parentElement;
|
|
4269
4161
|
return elm;
|
|
4270
4162
|
};
|
|
4271
4163
|
const hostListenerOpts = (flags) => (flags & LISTENER_FLAGS.Capture) !== 0;
|
|
@@ -4636,7 +4528,7 @@ function hydrateApp(win, opts, results, afterHydrate, resolve) {
|
|
|
4636
4528
|
$flags$: null
|
|
4637
4529
|
}, null);
|
|
4638
4530
|
if (Cstr != null && Cstr.cmpMeta != null) {
|
|
4639
|
-
if (opts.serializeShadowRoot !== false && !!(Cstr.cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation) && tagRequiresScoped(elm.tagName, opts.serializeShadowRoot)) {
|
|
4531
|
+
if (opts.serializeShadowRoot !== false && !!(Cstr.cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation) && (tagRequiresScoped(elm.tagName, opts.serializeShadowRoot) || !!(Cstr.cmpMeta.$flags$ & CMP_FLAGS.shadowModeClosed))) {
|
|
4640
4532
|
const cmpMeta = Cstr.cmpMeta;
|
|
4641
4533
|
cmpMeta.$flags$ |= CMP_FLAGS.shadowNeedsScopedCss;
|
|
4642
4534
|
Object.defineProperty(Cstr, "cmpMeta", { get: function() {
|
|
@@ -4704,7 +4596,7 @@ async function hydrateComponent(win, results, tagName, elm, waitingElements) {
|
|
|
4704
4596
|
waitingElements.add(elm);
|
|
4705
4597
|
const hostRef = getHostRef(this);
|
|
4706
4598
|
if (!hostRef) return;
|
|
4707
|
-
addHostEventListeners(this, hostRef, cmpMeta.$listeners
|
|
4599
|
+
addHostEventListeners(this, hostRef, cmpMeta.$listeners$);
|
|
4708
4600
|
try {
|
|
4709
4601
|
connectedCallback(elm);
|
|
4710
4602
|
await elm.componentOnReady();
|
|
@@ -4946,6 +4838,27 @@ const Build = {
|
|
|
4946
4838
|
const styles = /* @__PURE__ */ new Map();
|
|
4947
4839
|
const modeResolutionChain = [];
|
|
4948
4840
|
/**
|
|
4841
|
+
* Server-side implementation of getAssetPath.
|
|
4842
|
+
*
|
|
4843
|
+
* Unlike the client-side version, this doesn't use import.meta.url as a fallback
|
|
4844
|
+
* because it doesn't make sense in the bundled hydrate factory context.
|
|
4845
|
+
* The base URL must come from plt.$resourcesUrl$ (set via hydration options).
|
|
4846
|
+
* @param path - The relative path to the asset
|
|
4847
|
+
* @returns The resolved asset path, which may be an absolute URL if resourcesUrl is set to an external URL, or a relative path if resourcesUrl is a relative path or not set at all
|
|
4848
|
+
*/
|
|
4849
|
+
const getAssetPath = (path) => {
|
|
4850
|
+
const base = plt.$resourcesUrl$ || "./";
|
|
4851
|
+
const assetUrl = new URL(path, base);
|
|
4852
|
+
return assetUrl.origin !== win.location.origin ? assetUrl.href : assetUrl.pathname;
|
|
4853
|
+
};
|
|
4854
|
+
/**
|
|
4855
|
+
* Sets the base URL for resolving asset paths in the server/hydrate context.
|
|
4856
|
+
* @param path - The base URL to use for resolving asset paths. This should typically be set to the same value as the `resourcesUrl` option passed to `hydrateDocument` to ensure that asset paths are resolved correctly in the server/hydrate context.
|
|
4857
|
+
* If not set, it defaults to './', which is a reasonable default for server-side rendering.
|
|
4858
|
+
* @returns void
|
|
4859
|
+
*/
|
|
4860
|
+
const setAssetPath = (path) => plt.$resourcesUrl$ = path;
|
|
4861
|
+
/**
|
|
4949
4862
|
* Checks to see any components are rendered with `scoped`
|
|
4950
4863
|
* @param opts - SSR options
|
|
4951
4864
|
*/
|
|
@@ -2,22 +2,6 @@ import { Readable } from "node:stream";
|
|
|
2
2
|
//#region src/server/runner/create-window.d.ts
|
|
3
3
|
declare function createWindowFromHtml(templateHtml: string, uniqueId: string): any;
|
|
4
4
|
//#endregion
|
|
5
|
-
//#region src/utils/serialize.d.ts
|
|
6
|
-
/**
|
|
7
|
-
* Serialize a value to a string that can be deserialized later.
|
|
8
|
-
* @param {unknown} value - The value to serialize.
|
|
9
|
-
* @returns {string} A string that can be deserialized later.
|
|
10
|
-
* @deprecated will be removed in v5. Use `@PropSerialize()` decorator instead.
|
|
11
|
-
*/
|
|
12
|
-
declare function serializeProperty(value: unknown): string | number | boolean;
|
|
13
|
-
/**
|
|
14
|
-
* Deserialize a value from a string that was serialized earlier.
|
|
15
|
-
* @param {string} value - The string to deserialize.
|
|
16
|
-
* @returns {unknown} The deserialized value.
|
|
17
|
-
* @deprecated will be removed in v5. Use `@AttrDeserialize()` decorator instead.
|
|
18
|
-
*/
|
|
19
|
-
declare function deserializeProperty(value: string): any;
|
|
20
|
-
//#endregion
|
|
21
5
|
//#region src/declarations/stencil-public-runtime.d.ts
|
|
22
6
|
type ResolutionHandler = (elm: HTMLElement) => string | undefined | null;
|
|
23
7
|
type TagTransformer = (tag: string) => string;
|
|
@@ -320,4 +304,4 @@ declare function transformTag<T extends string>(tag: T): T;
|
|
|
320
304
|
*/
|
|
321
305
|
declare function setTagTransformer(transformer: TagTransformer): void;
|
|
322
306
|
//#endregion
|
|
323
|
-
export { createWindowFromHtml,
|
|
307
|
+
export { createWindowFromHtml, hydrateDocument, renderToString, resetHydrateDocData, serializeDocumentToString, setTagTransformer, streamToString, transformTag };
|