@stencil/core 4.28.2-dev.1742328872.ce86124 → 4.28.2-dev.1742360514.37ac3fc
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/cli/index.cjs +1 -1
- package/cli/index.js +1 -1
- package/cli/package.json +1 -1
- package/compiler/package.json +1 -1
- package/compiler/stencil.js +9 -10
- package/dev-server/client/index.js +1 -1
- package/dev-server/client/package.json +1 -1
- package/dev-server/connector.html +2 -2
- package/dev-server/index.js +1 -1
- package/dev-server/package.json +1 -1
- package/dev-server/server-process.js +2 -2
- package/internal/app-data/package.json +1 -1
- package/internal/client/index.js +2 -150
- package/internal/client/package.json +1 -1
- package/internal/client/patch-browser.js +1 -1
- package/internal/hydrate/index.js +3 -153
- package/internal/hydrate/package.json +1 -1
- package/internal/hydrate/runner.d.ts +0 -12
- package/internal/hydrate/runner.js +1 -359
- package/internal/package.json +1 -1
- package/internal/testing/index.js +1 -149
- package/internal/testing/package.json +1 -1
- package/mock-doc/index.cjs +1 -1
- package/mock-doc/index.js +1 -1
- package/mock-doc/package.json +1 -1
- package/package.json +1 -1
- package/screenshot/index.js +1 -1
- package/screenshot/package.json +1 -1
- package/screenshot/pixel-match.js +1 -1
- package/sys/node/index.js +25 -25
- package/sys/node/package.json +1 -1
- package/sys/node/worker.js +1 -1
- package/testing/index.js +2 -3
- package/testing/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Stencil Hydrate Platform v4.28.2-dev.
|
|
2
|
+
Stencil Hydrate Platform v4.28.2-dev.1742360514.37ac3fc | MIT Licensed | https://stenciljs.com
|
|
3
3
|
*/
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
5
5
|
var __export = (target, all) => {
|
|
@@ -138,131 +138,6 @@ import { BUILD as BUILD18 } from "@stencil/core/internal/app-data";
|
|
|
138
138
|
// src/runtime/client-hydrate.ts
|
|
139
139
|
import { BUILD as BUILD6 } from "@stencil/core/internal/app-data";
|
|
140
140
|
|
|
141
|
-
// src/hydrate/runner/serialize.ts
|
|
142
|
-
var PrimitiveType = /* @__PURE__ */ ((PrimitiveType2) => {
|
|
143
|
-
PrimitiveType2["Undefined"] = "undefined";
|
|
144
|
-
PrimitiveType2["Null"] = "null";
|
|
145
|
-
PrimitiveType2["String"] = "string";
|
|
146
|
-
PrimitiveType2["Number"] = "number";
|
|
147
|
-
PrimitiveType2["SpecialNumber"] = "number";
|
|
148
|
-
PrimitiveType2["Boolean"] = "boolean";
|
|
149
|
-
PrimitiveType2["BigInt"] = "bigint";
|
|
150
|
-
return PrimitiveType2;
|
|
151
|
-
})(PrimitiveType || {});
|
|
152
|
-
var NonPrimitiveType = /* @__PURE__ */ ((NonPrimitiveType2) => {
|
|
153
|
-
NonPrimitiveType2["Array"] = "array";
|
|
154
|
-
NonPrimitiveType2["Date"] = "date";
|
|
155
|
-
NonPrimitiveType2["Map"] = "map";
|
|
156
|
-
NonPrimitiveType2["Object"] = "object";
|
|
157
|
-
NonPrimitiveType2["RegularExpression"] = "regexp";
|
|
158
|
-
NonPrimitiveType2["Set"] = "set";
|
|
159
|
-
NonPrimitiveType2["Channel"] = "channel";
|
|
160
|
-
NonPrimitiveType2["Symbol"] = "symbol";
|
|
161
|
-
return NonPrimitiveType2;
|
|
162
|
-
})(NonPrimitiveType || {});
|
|
163
|
-
var TYPE_CONSTANT = "type";
|
|
164
|
-
var VALUE_CONSTANT = "value";
|
|
165
|
-
var SERIALIZED_PREFIX = "serialized:";
|
|
166
|
-
function deserializeProperty(value) {
|
|
167
|
-
if (typeof value !== "string" || !value.startsWith(SERIALIZED_PREFIX)) {
|
|
168
|
-
return value;
|
|
169
|
-
}
|
|
170
|
-
return RemoteValue.fromLocalValue(JSON.parse(atob(value.slice(SERIALIZED_PREFIX.length))));
|
|
171
|
-
}
|
|
172
|
-
var RemoteValue = class _RemoteValue {
|
|
173
|
-
/**
|
|
174
|
-
* Deserializes a LocalValue serialized object back to its original JavaScript representation
|
|
175
|
-
*
|
|
176
|
-
* @param serialized The serialized LocalValue object
|
|
177
|
-
* @returns The original JavaScript value/object
|
|
178
|
-
*/
|
|
179
|
-
static fromLocalValue(serialized) {
|
|
180
|
-
const type = serialized[TYPE_CONSTANT];
|
|
181
|
-
const value = VALUE_CONSTANT in serialized ? serialized[VALUE_CONSTANT] : void 0;
|
|
182
|
-
switch (type) {
|
|
183
|
-
case "string" /* String */:
|
|
184
|
-
return value;
|
|
185
|
-
case "boolean" /* Boolean */:
|
|
186
|
-
return value;
|
|
187
|
-
case "bigint" /* BigInt */:
|
|
188
|
-
return BigInt(value);
|
|
189
|
-
case "undefined" /* Undefined */:
|
|
190
|
-
return void 0;
|
|
191
|
-
case "null" /* Null */:
|
|
192
|
-
return null;
|
|
193
|
-
case "number" /* Number */:
|
|
194
|
-
if (value === "NaN") return NaN;
|
|
195
|
-
if (value === "-0") return -0;
|
|
196
|
-
if (value === "Infinity") return Infinity;
|
|
197
|
-
if (value === "-Infinity") return -Infinity;
|
|
198
|
-
return value;
|
|
199
|
-
case "array" /* Array */:
|
|
200
|
-
return value.map((item) => _RemoteValue.fromLocalValue(item));
|
|
201
|
-
case "date" /* Date */:
|
|
202
|
-
return new Date(value);
|
|
203
|
-
case "map" /* Map */:
|
|
204
|
-
const map2 = /* @__PURE__ */ new Map();
|
|
205
|
-
for (const [key, val] of value) {
|
|
206
|
-
const deserializedKey = typeof key === "object" && key !== null ? _RemoteValue.fromLocalValue(key) : key;
|
|
207
|
-
const deserializedValue = _RemoteValue.fromLocalValue(val);
|
|
208
|
-
map2.set(deserializedKey, deserializedValue);
|
|
209
|
-
}
|
|
210
|
-
return map2;
|
|
211
|
-
case "object" /* Object */:
|
|
212
|
-
const obj = {};
|
|
213
|
-
for (const [key, val] of value) {
|
|
214
|
-
obj[key] = _RemoteValue.fromLocalValue(val);
|
|
215
|
-
}
|
|
216
|
-
return obj;
|
|
217
|
-
case "regexp" /* RegularExpression */:
|
|
218
|
-
const { pattern, flags } = value;
|
|
219
|
-
return new RegExp(pattern, flags);
|
|
220
|
-
case "set" /* Set */:
|
|
221
|
-
const set = /* @__PURE__ */ new Set();
|
|
222
|
-
for (const item of value) {
|
|
223
|
-
set.add(_RemoteValue.fromLocalValue(item));
|
|
224
|
-
}
|
|
225
|
-
return set;
|
|
226
|
-
case "symbol" /* Symbol */:
|
|
227
|
-
return Symbol(value);
|
|
228
|
-
default:
|
|
229
|
-
throw new Error(`Unsupported type: ${type}`);
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
/**
|
|
233
|
-
* Utility method to deserialize multiple LocalValues at once
|
|
234
|
-
*
|
|
235
|
-
* @param serializedValues Array of serialized LocalValue objects
|
|
236
|
-
* @returns Array of deserialized JavaScript values
|
|
237
|
-
*/
|
|
238
|
-
static fromLocalValueArray(serializedValues) {
|
|
239
|
-
return serializedValues.map((value) => _RemoteValue.fromLocalValue(value));
|
|
240
|
-
}
|
|
241
|
-
/**
|
|
242
|
-
* Verifies if the given object matches the structure of a serialized LocalValue
|
|
243
|
-
*
|
|
244
|
-
* @param obj Object to verify
|
|
245
|
-
* @returns boolean indicating if the object has LocalValue structure
|
|
246
|
-
*/
|
|
247
|
-
static isLocalValueObject(obj) {
|
|
248
|
-
if (typeof obj !== "object" || obj === null) {
|
|
249
|
-
return false;
|
|
250
|
-
}
|
|
251
|
-
if (!obj.hasOwnProperty(TYPE_CONSTANT)) {
|
|
252
|
-
return false;
|
|
253
|
-
}
|
|
254
|
-
const type = obj[TYPE_CONSTANT];
|
|
255
|
-
const hasTypeProperty = Object.values({ ...PrimitiveType, ...NonPrimitiveType }).includes(type);
|
|
256
|
-
if (!hasTypeProperty) {
|
|
257
|
-
return false;
|
|
258
|
-
}
|
|
259
|
-
if (type !== "null" /* Null */ && type !== "undefined" /* Undefined */) {
|
|
260
|
-
return obj.hasOwnProperty(VALUE_CONSTANT);
|
|
261
|
-
}
|
|
262
|
-
return true;
|
|
263
|
-
}
|
|
264
|
-
};
|
|
265
|
-
|
|
266
141
|
// src/runtime/dom-extras.ts
|
|
267
142
|
import { BUILD as BUILD3 } from "@stencil/core/internal/app-data";
|
|
268
143
|
|
|
@@ -1037,7 +912,6 @@ var validateInputProperties = (inputElm) => {
|
|
|
1037
912
|
|
|
1038
913
|
// src/runtime/client-hydrate.ts
|
|
1039
914
|
var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
|
|
1040
|
-
var _a;
|
|
1041
915
|
const endHydrate = createTime("hydrateClient", tagName);
|
|
1042
916
|
const shadowRoot = hostElm.shadowRoot;
|
|
1043
917
|
const childRenderNodes = [];
|
|
@@ -1046,27 +920,6 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
|
|
|
1046
920
|
const shadowRootNodes = BUILD6.shadowDom && shadowRoot ? [] : null;
|
|
1047
921
|
const vnode = newVNode(tagName, null);
|
|
1048
922
|
vnode.$elm$ = hostElm;
|
|
1049
|
-
let attributes;
|
|
1050
|
-
const members = Object.entries(((_a = hostRef.$cmpMeta$) == null ? void 0 : _a.$members$) || {});
|
|
1051
|
-
members.forEach(([memberName, [memberFlags, metaAttributeName]]) => {
|
|
1052
|
-
if (!(memberFlags & 31 /* Prop */)) {
|
|
1053
|
-
return;
|
|
1054
|
-
}
|
|
1055
|
-
const attributeName = metaAttributeName || memberName;
|
|
1056
|
-
let attrValue = hostElm.getAttribute(attributeName);
|
|
1057
|
-
if ((attrValue == null ? void 0 : attrValue.startsWith("{")) && attrValue.endsWith("}") || (attrValue == null ? void 0 : attrValue.startsWith("[")) && attrValue.endsWith("]")) {
|
|
1058
|
-
try {
|
|
1059
|
-
attrValue = JSON.parse(attrValue);
|
|
1060
|
-
} catch (e) {
|
|
1061
|
-
}
|
|
1062
|
-
} else if (attrValue == null ? void 0 : attrValue.startsWith(SERIALIZED_PREFIX)) {
|
|
1063
|
-
attrValue = deserializeProperty(attrValue);
|
|
1064
|
-
}
|
|
1065
|
-
if (!attributes) {
|
|
1066
|
-
attributes = {};
|
|
1067
|
-
}
|
|
1068
|
-
hostRef.$instanceValues$.set(memberName, attrValue);
|
|
1069
|
-
});
|
|
1070
923
|
let scopeId2;
|
|
1071
924
|
if (BUILD6.scoped) {
|
|
1072
925
|
const cmpMeta = hostRef.$cmpMeta$;
|
|
@@ -2599,8 +2452,7 @@ var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
|
|
|
2599
2452
|
const hostElm = hostRef.$hostElement$;
|
|
2600
2453
|
const cmpMeta = hostRef.$cmpMeta$;
|
|
2601
2454
|
const oldVNode = hostRef.$vnode$ || newVNode(null, null);
|
|
2602
|
-
const
|
|
2603
|
-
const rootVnode = isHostElem ? renderFnResults : h(null, null, renderFnResults);
|
|
2455
|
+
const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
|
|
2604
2456
|
hostTagName = hostElm.tagName;
|
|
2605
2457
|
if (BUILD13.isDev && Array.isArray(renderFnResults) && renderFnResults.some(isHost)) {
|
|
2606
2458
|
throw new Error(`The <Host> must be the single root component.
|
|
@@ -4032,12 +3884,10 @@ function proxyHostElement(elm, cstr) {
|
|
|
4032
3884
|
attrValue = JSON.parse(attrValue);
|
|
4033
3885
|
} catch (e) {
|
|
4034
3886
|
}
|
|
4035
|
-
} else if (attrValue == null ? void 0 : attrValue.startsWith(SERIALIZED_PREFIX)) {
|
|
4036
|
-
attrValue = deserializeProperty(attrValue);
|
|
4037
3887
|
}
|
|
4038
3888
|
const { get: origGetter, set: origSetter } = Object.getOwnPropertyDescriptor(cstr.prototype, memberName) || {};
|
|
4039
3889
|
let attrPropVal;
|
|
4040
|
-
if (
|
|
3890
|
+
if (attrValue != null) {
|
|
4041
3891
|
attrPropVal = parsePropertyValue(attrValue, memberFlags);
|
|
4042
3892
|
}
|
|
4043
3893
|
const ownValue = elm[memberName];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stencil/core/internal/hydrate",
|
|
3
|
-
"version": "4.28.2-dev.
|
|
3
|
+
"version": "4.28.2-dev.1742360514.37ac3fc",
|
|
4
4
|
"description": "Stencil internal hydrate platform to be imported by the Stencil Compiler. Breaking changes can and will happen at any time.",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"private": true
|
|
@@ -255,17 +255,5 @@ export declare function renderToString(html: string | any, options: SerializeDoc
|
|
|
255
255
|
export declare function hydrateDocument(doc: any | string, options?: HydrateDocumentOptions): Promise<HydrateResults>;
|
|
256
256
|
export declare function hydrateDocument(doc: any | string, options: HydrateDocumentOptions | undefined, asStream?: boolean): Readable;
|
|
257
257
|
export declare function serializeDocumentToString(doc: Document, opts: HydrateFactoryOptions): string;
|
|
258
|
-
/**
|
|
259
|
-
* Serialize a value to a string that can be deserialized later.
|
|
260
|
-
* @param {unknown} value - The value to serialize.
|
|
261
|
-
* @returns {string} A string that can be deserialized later.
|
|
262
|
-
*/
|
|
263
|
-
export declare function serializeProperty(value: unknown): string | number | boolean;
|
|
264
|
-
/**
|
|
265
|
-
* Deserialize a value from a string that was serialized earlier.
|
|
266
|
-
* @param {string} value - The string to deserialize.
|
|
267
|
-
* @returns {unknown} The deserialized value.
|
|
268
|
-
*/
|
|
269
|
-
export declare function deserializeProperty(value: string): any;
|
|
270
258
|
|
|
271
259
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Stencil Hydrate Runner v4.28.2-dev.
|
|
2
|
+
Stencil Hydrate Runner v4.28.2-dev.1742360514.37ac3fc | MIT Licensed | https://stenciljs.com
|
|
3
3
|
*/
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
5
5
|
var __export = (target, all) => {
|
|
@@ -14234,362 +14234,6 @@ import { BUILD as BUILD24 } from "@stencil/core/internal/app-data";
|
|
|
14234
14234
|
// src/runtime/client-hydrate.ts
|
|
14235
14235
|
import { BUILD as BUILD12 } from "@stencil/core/internal/app-data";
|
|
14236
14236
|
|
|
14237
|
-
// src/hydrate/runner/serialize.ts
|
|
14238
|
-
var PrimitiveType = /* @__PURE__ */ ((PrimitiveType2) => {
|
|
14239
|
-
PrimitiveType2["Undefined"] = "undefined";
|
|
14240
|
-
PrimitiveType2["Null"] = "null";
|
|
14241
|
-
PrimitiveType2["String"] = "string";
|
|
14242
|
-
PrimitiveType2["Number"] = "number";
|
|
14243
|
-
PrimitiveType2["SpecialNumber"] = "number";
|
|
14244
|
-
PrimitiveType2["Boolean"] = "boolean";
|
|
14245
|
-
PrimitiveType2["BigInt"] = "bigint";
|
|
14246
|
-
return PrimitiveType2;
|
|
14247
|
-
})(PrimitiveType || {});
|
|
14248
|
-
var NonPrimitiveType = /* @__PURE__ */ ((NonPrimitiveType2) => {
|
|
14249
|
-
NonPrimitiveType2["Array"] = "array";
|
|
14250
|
-
NonPrimitiveType2["Date"] = "date";
|
|
14251
|
-
NonPrimitiveType2["Map"] = "map";
|
|
14252
|
-
NonPrimitiveType2["Object"] = "object";
|
|
14253
|
-
NonPrimitiveType2["RegularExpression"] = "regexp";
|
|
14254
|
-
NonPrimitiveType2["Set"] = "set";
|
|
14255
|
-
NonPrimitiveType2["Channel"] = "channel";
|
|
14256
|
-
NonPrimitiveType2["Symbol"] = "symbol";
|
|
14257
|
-
return NonPrimitiveType2;
|
|
14258
|
-
})(NonPrimitiveType || {});
|
|
14259
|
-
var TYPE_CONSTANT = "type";
|
|
14260
|
-
var VALUE_CONSTANT = "value";
|
|
14261
|
-
var SERIALIZED_PREFIX = "serialized:";
|
|
14262
|
-
function serializeProperty(value) {
|
|
14263
|
-
if (["string", "boolean", "undefined"].includes(typeof value) || typeof value === "number" && value !== Infinity && value !== -Infinity && !isNaN(value)) {
|
|
14264
|
-
return value;
|
|
14265
|
-
}
|
|
14266
|
-
const arg = LocalValue.getArgument(value);
|
|
14267
|
-
return SERIALIZED_PREFIX + btoa(JSON.stringify(arg));
|
|
14268
|
-
}
|
|
14269
|
-
function deserializeProperty(value) {
|
|
14270
|
-
if (typeof value !== "string" || !value.startsWith(SERIALIZED_PREFIX)) {
|
|
14271
|
-
return value;
|
|
14272
|
-
}
|
|
14273
|
-
return RemoteValue.fromLocalValue(JSON.parse(atob(value.slice(SERIALIZED_PREFIX.length))));
|
|
14274
|
-
}
|
|
14275
|
-
var LocalValue = class _LocalValue {
|
|
14276
|
-
constructor(type, value) {
|
|
14277
|
-
if (type === "undefined" /* Undefined */ || type === "null" /* Null */) {
|
|
14278
|
-
this.type = type;
|
|
14279
|
-
} else {
|
|
14280
|
-
this.type = type;
|
|
14281
|
-
this.value = value;
|
|
14282
|
-
}
|
|
14283
|
-
}
|
|
14284
|
-
/**
|
|
14285
|
-
* Creates a new LocalValue object with a string value.
|
|
14286
|
-
*
|
|
14287
|
-
* @param {string} value - The string value to be stored in the LocalValue object.
|
|
14288
|
-
* @returns {LocalValue} - The created LocalValue object.
|
|
14289
|
-
*/
|
|
14290
|
-
static createStringValue(value) {
|
|
14291
|
-
return new _LocalValue("string" /* String */, value);
|
|
14292
|
-
}
|
|
14293
|
-
/**
|
|
14294
|
-
* Creates a new LocalValue object with a number value.
|
|
14295
|
-
*
|
|
14296
|
-
* @param {number} value - The number value.
|
|
14297
|
-
* @returns {LocalValue} - The created LocalValue object.
|
|
14298
|
-
*/
|
|
14299
|
-
static createNumberValue(value) {
|
|
14300
|
-
return new _LocalValue("number" /* Number */, value);
|
|
14301
|
-
}
|
|
14302
|
-
/**
|
|
14303
|
-
* Creates a new LocalValue object with a special number value.
|
|
14304
|
-
*
|
|
14305
|
-
* @param {number} value - The value of the special number.
|
|
14306
|
-
* @returns {LocalValue} - The created LocalValue object.
|
|
14307
|
-
*/
|
|
14308
|
-
static createSpecialNumberValue(value) {
|
|
14309
|
-
if (Number.isNaN(value)) {
|
|
14310
|
-
return new _LocalValue("number" /* SpecialNumber */, "NaN");
|
|
14311
|
-
}
|
|
14312
|
-
if (Object.is(value, -0)) {
|
|
14313
|
-
return new _LocalValue("number" /* SpecialNumber */, "-0");
|
|
14314
|
-
}
|
|
14315
|
-
if (value === Infinity) {
|
|
14316
|
-
return new _LocalValue("number" /* SpecialNumber */, "Infinity");
|
|
14317
|
-
}
|
|
14318
|
-
if (value === -Infinity) {
|
|
14319
|
-
return new _LocalValue("number" /* SpecialNumber */, "-Infinity");
|
|
14320
|
-
}
|
|
14321
|
-
return new _LocalValue("number" /* SpecialNumber */, value);
|
|
14322
|
-
}
|
|
14323
|
-
/**
|
|
14324
|
-
* Creates a new LocalValue object with an undefined value.
|
|
14325
|
-
* @returns {LocalValue} - The created LocalValue object.
|
|
14326
|
-
*/
|
|
14327
|
-
static createUndefinedValue() {
|
|
14328
|
-
return new _LocalValue("undefined" /* Undefined */);
|
|
14329
|
-
}
|
|
14330
|
-
/**
|
|
14331
|
-
* Creates a new LocalValue object with a null value.
|
|
14332
|
-
* @returns {LocalValue} - The created LocalValue object.
|
|
14333
|
-
*/
|
|
14334
|
-
static createNullValue() {
|
|
14335
|
-
return new _LocalValue("null" /* Null */);
|
|
14336
|
-
}
|
|
14337
|
-
/**
|
|
14338
|
-
* Creates a new LocalValue object with a boolean value.
|
|
14339
|
-
*
|
|
14340
|
-
* @param {boolean} value - The boolean value.
|
|
14341
|
-
* @returns {LocalValue} - The created LocalValue object.
|
|
14342
|
-
*/
|
|
14343
|
-
static createBooleanValue(value) {
|
|
14344
|
-
return new _LocalValue("boolean" /* Boolean */, value);
|
|
14345
|
-
}
|
|
14346
|
-
/**
|
|
14347
|
-
* Creates a new LocalValue object with a BigInt value.
|
|
14348
|
-
*
|
|
14349
|
-
* @param {BigInt} value - The BigInt value.
|
|
14350
|
-
* @returns {LocalValue} - The created LocalValue object.
|
|
14351
|
-
*/
|
|
14352
|
-
static createBigIntValue(value) {
|
|
14353
|
-
return new _LocalValue("bigint" /* BigInt */, value.toString());
|
|
14354
|
-
}
|
|
14355
|
-
/**
|
|
14356
|
-
* Creates a new LocalValue object with an array.
|
|
14357
|
-
*
|
|
14358
|
-
* @param {Array} value - The array.
|
|
14359
|
-
* @returns {LocalValue} - The created LocalValue object.
|
|
14360
|
-
*/
|
|
14361
|
-
static createArrayValue(value) {
|
|
14362
|
-
return new _LocalValue("array" /* Array */, value);
|
|
14363
|
-
}
|
|
14364
|
-
/**
|
|
14365
|
-
* Creates a new LocalValue object with date value.
|
|
14366
|
-
*
|
|
14367
|
-
* @param {string} value - The date.
|
|
14368
|
-
* @returns {LocalValue} - The created LocalValue object.
|
|
14369
|
-
*/
|
|
14370
|
-
static createDateValue(value) {
|
|
14371
|
-
return new _LocalValue("date" /* Date */, value);
|
|
14372
|
-
}
|
|
14373
|
-
/**
|
|
14374
|
-
* Creates a new LocalValue object of map value.
|
|
14375
|
-
* @param {Map} map - The map.
|
|
14376
|
-
* @returns {LocalValue} - The created LocalValue object.
|
|
14377
|
-
*/
|
|
14378
|
-
static createMapValue(map2) {
|
|
14379
|
-
const value = [];
|
|
14380
|
-
Array.from(map2.entries()).forEach(([key, val]) => {
|
|
14381
|
-
value.push([_LocalValue.getArgument(key), _LocalValue.getArgument(val)]);
|
|
14382
|
-
});
|
|
14383
|
-
return new _LocalValue("map" /* Map */, value);
|
|
14384
|
-
}
|
|
14385
|
-
/**
|
|
14386
|
-
* Creates a new LocalValue object from the passed object.
|
|
14387
|
-
*
|
|
14388
|
-
* @param object the object to create a LocalValue from
|
|
14389
|
-
* @returns {LocalValue} - The created LocalValue object.
|
|
14390
|
-
*/
|
|
14391
|
-
static createObjectValue(object) {
|
|
14392
|
-
const value = [];
|
|
14393
|
-
Object.entries(object).forEach(([key, val]) => {
|
|
14394
|
-
value.push([key, _LocalValue.getArgument(val)]);
|
|
14395
|
-
});
|
|
14396
|
-
return new _LocalValue("object" /* Object */, value);
|
|
14397
|
-
}
|
|
14398
|
-
/**
|
|
14399
|
-
* Creates a new LocalValue object of regular expression value.
|
|
14400
|
-
*
|
|
14401
|
-
* @param {string} value - The value of the regular expression.
|
|
14402
|
-
* @returns {LocalValue} - The created LocalValue object.
|
|
14403
|
-
*/
|
|
14404
|
-
static createRegularExpressionValue(value) {
|
|
14405
|
-
return new _LocalValue("regexp" /* RegularExpression */, value);
|
|
14406
|
-
}
|
|
14407
|
-
/**
|
|
14408
|
-
* Creates a new LocalValue object with the specified value.
|
|
14409
|
-
* @param {Set} value - The value to be set.
|
|
14410
|
-
* @returns {LocalValue} - The created LocalValue object.
|
|
14411
|
-
*/
|
|
14412
|
-
static createSetValue(value) {
|
|
14413
|
-
return new _LocalValue("set" /* Set */, value);
|
|
14414
|
-
}
|
|
14415
|
-
/**
|
|
14416
|
-
* Creates a new LocalValue object with the given channel value
|
|
14417
|
-
*
|
|
14418
|
-
* @param {ChannelValue} value - The channel value.
|
|
14419
|
-
* @returns {LocalValue} - The created LocalValue object.
|
|
14420
|
-
*/
|
|
14421
|
-
static createChannelValue(value) {
|
|
14422
|
-
return new _LocalValue("channel" /* Channel */, value);
|
|
14423
|
-
}
|
|
14424
|
-
/**
|
|
14425
|
-
* Creates a new LocalValue object with a Symbol value.
|
|
14426
|
-
*
|
|
14427
|
-
* @param {Symbol} symbol - The Symbol value
|
|
14428
|
-
* @returns {LocalValue} - The created LocalValue object
|
|
14429
|
-
*/
|
|
14430
|
-
static createSymbolValue(symbol) {
|
|
14431
|
-
const description = symbol.description || "Symbol()";
|
|
14432
|
-
return new _LocalValue("symbol" /* Symbol */, description);
|
|
14433
|
-
}
|
|
14434
|
-
static getArgument(argument) {
|
|
14435
|
-
const type = typeof argument;
|
|
14436
|
-
switch (type) {
|
|
14437
|
-
case "string" /* String */:
|
|
14438
|
-
return _LocalValue.createStringValue(argument);
|
|
14439
|
-
case "number" /* Number */:
|
|
14440
|
-
if (Number.isNaN(argument) || Object.is(argument, -0) || !Number.isFinite(argument)) {
|
|
14441
|
-
return _LocalValue.createSpecialNumberValue(argument);
|
|
14442
|
-
}
|
|
14443
|
-
return _LocalValue.createNumberValue(argument);
|
|
14444
|
-
case "boolean" /* Boolean */:
|
|
14445
|
-
return _LocalValue.createBooleanValue(argument);
|
|
14446
|
-
case "bigint" /* BigInt */:
|
|
14447
|
-
return _LocalValue.createBigIntValue(argument);
|
|
14448
|
-
case "undefined" /* Undefined */:
|
|
14449
|
-
return _LocalValue.createUndefinedValue();
|
|
14450
|
-
case "symbol" /* Symbol */:
|
|
14451
|
-
return _LocalValue.createSymbolValue(argument);
|
|
14452
|
-
case "object" /* Object */:
|
|
14453
|
-
if (argument === null) {
|
|
14454
|
-
return _LocalValue.createNullValue();
|
|
14455
|
-
}
|
|
14456
|
-
if (argument instanceof Date) {
|
|
14457
|
-
return _LocalValue.createDateValue(argument);
|
|
14458
|
-
}
|
|
14459
|
-
if (argument instanceof Map) {
|
|
14460
|
-
const map2 = [];
|
|
14461
|
-
argument.forEach((value, key) => {
|
|
14462
|
-
const objectKey = typeof key === "string" ? key : _LocalValue.getArgument(key);
|
|
14463
|
-
const objectValue = _LocalValue.getArgument(value);
|
|
14464
|
-
map2.push([objectKey, objectValue]);
|
|
14465
|
-
});
|
|
14466
|
-
return _LocalValue.createMapValue(argument);
|
|
14467
|
-
}
|
|
14468
|
-
if (argument instanceof Set) {
|
|
14469
|
-
const set = [];
|
|
14470
|
-
argument.forEach((value) => {
|
|
14471
|
-
set.push(_LocalValue.getArgument(value));
|
|
14472
|
-
});
|
|
14473
|
-
return _LocalValue.createSetValue(set);
|
|
14474
|
-
}
|
|
14475
|
-
if (argument instanceof Array) {
|
|
14476
|
-
const arr = [];
|
|
14477
|
-
argument.forEach((value) => {
|
|
14478
|
-
arr.push(_LocalValue.getArgument(value));
|
|
14479
|
-
});
|
|
14480
|
-
return _LocalValue.createArrayValue(arr);
|
|
14481
|
-
}
|
|
14482
|
-
if (argument instanceof RegExp) {
|
|
14483
|
-
return _LocalValue.createRegularExpressionValue({
|
|
14484
|
-
pattern: argument.source,
|
|
14485
|
-
flags: argument.flags
|
|
14486
|
-
});
|
|
14487
|
-
}
|
|
14488
|
-
return _LocalValue.createObjectValue(argument);
|
|
14489
|
-
}
|
|
14490
|
-
throw new Error(`Unsupported type: ${type}`);
|
|
14491
|
-
}
|
|
14492
|
-
asMap() {
|
|
14493
|
-
return {
|
|
14494
|
-
[TYPE_CONSTANT]: this.type,
|
|
14495
|
-
...!(this.type === "null" /* Null */ || this.type === "undefined" /* Undefined */) ? { [VALUE_CONSTANT]: this.value } : {}
|
|
14496
|
-
};
|
|
14497
|
-
}
|
|
14498
|
-
};
|
|
14499
|
-
var RemoteValue = class _RemoteValue {
|
|
14500
|
-
/**
|
|
14501
|
-
* Deserializes a LocalValue serialized object back to its original JavaScript representation
|
|
14502
|
-
*
|
|
14503
|
-
* @param serialized The serialized LocalValue object
|
|
14504
|
-
* @returns The original JavaScript value/object
|
|
14505
|
-
*/
|
|
14506
|
-
static fromLocalValue(serialized) {
|
|
14507
|
-
const type = serialized[TYPE_CONSTANT];
|
|
14508
|
-
const value = VALUE_CONSTANT in serialized ? serialized[VALUE_CONSTANT] : void 0;
|
|
14509
|
-
switch (type) {
|
|
14510
|
-
case "string" /* String */:
|
|
14511
|
-
return value;
|
|
14512
|
-
case "boolean" /* Boolean */:
|
|
14513
|
-
return value;
|
|
14514
|
-
case "bigint" /* BigInt */:
|
|
14515
|
-
return BigInt(value);
|
|
14516
|
-
case "undefined" /* Undefined */:
|
|
14517
|
-
return void 0;
|
|
14518
|
-
case "null" /* Null */:
|
|
14519
|
-
return null;
|
|
14520
|
-
case "number" /* Number */:
|
|
14521
|
-
if (value === "NaN") return NaN;
|
|
14522
|
-
if (value === "-0") return -0;
|
|
14523
|
-
if (value === "Infinity") return Infinity;
|
|
14524
|
-
if (value === "-Infinity") return -Infinity;
|
|
14525
|
-
return value;
|
|
14526
|
-
case "array" /* Array */:
|
|
14527
|
-
return value.map((item) => _RemoteValue.fromLocalValue(item));
|
|
14528
|
-
case "date" /* Date */:
|
|
14529
|
-
return new Date(value);
|
|
14530
|
-
case "map" /* Map */:
|
|
14531
|
-
const map2 = /* @__PURE__ */ new Map();
|
|
14532
|
-
for (const [key, val] of value) {
|
|
14533
|
-
const deserializedKey = typeof key === "object" && key !== null ? _RemoteValue.fromLocalValue(key) : key;
|
|
14534
|
-
const deserializedValue = _RemoteValue.fromLocalValue(val);
|
|
14535
|
-
map2.set(deserializedKey, deserializedValue);
|
|
14536
|
-
}
|
|
14537
|
-
return map2;
|
|
14538
|
-
case "object" /* Object */:
|
|
14539
|
-
const obj = {};
|
|
14540
|
-
for (const [key, val] of value) {
|
|
14541
|
-
obj[key] = _RemoteValue.fromLocalValue(val);
|
|
14542
|
-
}
|
|
14543
|
-
return obj;
|
|
14544
|
-
case "regexp" /* RegularExpression */:
|
|
14545
|
-
const { pattern, flags } = value;
|
|
14546
|
-
return new RegExp(pattern, flags);
|
|
14547
|
-
case "set" /* Set */:
|
|
14548
|
-
const set = /* @__PURE__ */ new Set();
|
|
14549
|
-
for (const item of value) {
|
|
14550
|
-
set.add(_RemoteValue.fromLocalValue(item));
|
|
14551
|
-
}
|
|
14552
|
-
return set;
|
|
14553
|
-
case "symbol" /* Symbol */:
|
|
14554
|
-
return Symbol(value);
|
|
14555
|
-
default:
|
|
14556
|
-
throw new Error(`Unsupported type: ${type}`);
|
|
14557
|
-
}
|
|
14558
|
-
}
|
|
14559
|
-
/**
|
|
14560
|
-
* Utility method to deserialize multiple LocalValues at once
|
|
14561
|
-
*
|
|
14562
|
-
* @param serializedValues Array of serialized LocalValue objects
|
|
14563
|
-
* @returns Array of deserialized JavaScript values
|
|
14564
|
-
*/
|
|
14565
|
-
static fromLocalValueArray(serializedValues) {
|
|
14566
|
-
return serializedValues.map((value) => _RemoteValue.fromLocalValue(value));
|
|
14567
|
-
}
|
|
14568
|
-
/**
|
|
14569
|
-
* Verifies if the given object matches the structure of a serialized LocalValue
|
|
14570
|
-
*
|
|
14571
|
-
* @param obj Object to verify
|
|
14572
|
-
* @returns boolean indicating if the object has LocalValue structure
|
|
14573
|
-
*/
|
|
14574
|
-
static isLocalValueObject(obj) {
|
|
14575
|
-
if (typeof obj !== "object" || obj === null) {
|
|
14576
|
-
return false;
|
|
14577
|
-
}
|
|
14578
|
-
if (!obj.hasOwnProperty(TYPE_CONSTANT)) {
|
|
14579
|
-
return false;
|
|
14580
|
-
}
|
|
14581
|
-
const type = obj[TYPE_CONSTANT];
|
|
14582
|
-
const hasTypeProperty = Object.values({ ...PrimitiveType, ...NonPrimitiveType }).includes(type);
|
|
14583
|
-
if (!hasTypeProperty) {
|
|
14584
|
-
return false;
|
|
14585
|
-
}
|
|
14586
|
-
if (type !== "null" /* Null */ && type !== "undefined" /* Undefined */) {
|
|
14587
|
-
return obj.hasOwnProperty(VALUE_CONSTANT);
|
|
14588
|
-
}
|
|
14589
|
-
return true;
|
|
14590
|
-
}
|
|
14591
|
-
};
|
|
14592
|
-
|
|
14593
14237
|
// src/runtime/dom-extras.ts
|
|
14594
14238
|
import { BUILD as BUILD9 } from "@stencil/core/internal/app-data";
|
|
14595
14239
|
|
|
@@ -16045,10 +15689,8 @@ function removeScripts(elm) {
|
|
|
16045
15689
|
}
|
|
16046
15690
|
export {
|
|
16047
15691
|
createWindowFromHtml,
|
|
16048
|
-
deserializeProperty,
|
|
16049
15692
|
hydrateDocument,
|
|
16050
15693
|
renderToString,
|
|
16051
15694
|
serializeDocumentToString,
|
|
16052
|
-
serializeProperty,
|
|
16053
15695
|
streamToString
|
|
16054
15696
|
};
|
package/internal/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stencil/core/internal",
|
|
3
|
-
"version": "4.28.2-dev.
|
|
3
|
+
"version": "4.28.2-dev.1742360514.37ac3fc",
|
|
4
4
|
"description": "Stencil internals only to be imported by the Stencil Compiler. Breaking changes can and will happen at any time.",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"types": "./index.d.ts",
|