@stencil/core 5.0.0-alpha.1 → 5.0.0-alpha.3
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-B1nuvCd2.mjs → client-CSm3x5ke.mjs} +81 -60
- 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-LX4_RKKd.mjs → compiler-D6iP7Bzb.mjs} +1391 -1631
- package/dist/declarations/stencil-public-compiler.d.ts +4031 -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-CXHCTQNt.d.mts} +14 -2
- 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-LlB2nw.d.mts → index-tUR6pD3J.d.mts} +145 -809
- 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-SxQIOCZE.mjs → node-Bg-mO5dw.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 +14 -4
- package/dist/runtime/client/index.js +103 -192
- package/dist/runtime/index.d.ts +16 -4
- package/dist/runtime/index.js +2 -2
- package/dist/runtime/server/index.d.mts +1 -3
- package/dist/runtime/server/index.mjs +103 -192
- package/dist/runtime/server/runner.d.mts +1 -17
- package/dist/runtime/server/runner.mjs +12 -368
- package/dist/{runtime-CF9DJtSu.js → runtime-BBCnuprF.js} +103 -192
- 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 +18 -17
- package/dist/{validation-CaCgjw-f.mjs → validation-Byxie0Uk.mjs} +28 -24
- package/package.json +9 -13
- package/dist/serialize-BkYHk7Mi.mjs +0 -766
- package/dist/stencil-public-compiler-C_X1iolo.d.ts +0 -4455
- package/dist/stencil-public-runtime-DlV8o7-z.d.ts +0 -1845
|
@@ -8365,6 +8365,7 @@ var MockElement = class extends MockNode {
|
|
|
8365
8365
|
}
|
|
8366
8366
|
attachShadow(_opts) {
|
|
8367
8367
|
const shadowRoot = this.ownerDocument.createDocumentFragment();
|
|
8368
|
+
shadowRoot.mode = _opts.mode ?? "open";
|
|
8368
8369
|
shadowRoot.delegatesFocus = _opts.delegatesFocus ?? false;
|
|
8369
8370
|
this.shadowRoot = shadowRoot;
|
|
8370
8371
|
return shadowRoot;
|
|
@@ -11418,6 +11419,8 @@ var MockResizeObserver = class {
|
|
|
11418
11419
|
unobserve() {}
|
|
11419
11420
|
};
|
|
11420
11421
|
var MockShadowRoot = class extends MockDocumentFragment {
|
|
11422
|
+
_mode = "open";
|
|
11423
|
+
_delegatesFocus = false;
|
|
11421
11424
|
get activeElement() {
|
|
11422
11425
|
return null;
|
|
11423
11426
|
}
|
|
@@ -11425,7 +11428,10 @@ var MockShadowRoot = class extends MockDocumentFragment {
|
|
|
11425
11428
|
return false;
|
|
11426
11429
|
}
|
|
11427
11430
|
get delegatesFocus() {
|
|
11428
|
-
return
|
|
11431
|
+
return this._delegatesFocus;
|
|
11432
|
+
}
|
|
11433
|
+
set delegatesFocus(value) {
|
|
11434
|
+
this._delegatesFocus = value;
|
|
11429
11435
|
}
|
|
11430
11436
|
get fullscreenElement() {
|
|
11431
11437
|
return null;
|
|
@@ -11439,7 +11445,10 @@ var MockShadowRoot = class extends MockDocumentFragment {
|
|
|
11439
11445
|
return null;
|
|
11440
11446
|
}
|
|
11441
11447
|
get mode() {
|
|
11442
|
-
return
|
|
11448
|
+
return this._mode;
|
|
11449
|
+
}
|
|
11450
|
+
set mode(value) {
|
|
11451
|
+
this._mode = value;
|
|
11443
11452
|
}
|
|
11444
11453
|
get pictureInPictureElement() {
|
|
11445
11454
|
return null;
|
|
@@ -12300,379 +12309,14 @@ function createWindowFromHtml(templateHtml, uniqueId) {
|
|
|
12300
12309
|
}
|
|
12301
12310
|
return cloneWindow(templateWindow);
|
|
12302
12311
|
}
|
|
12303
|
-
/**
|
|
12304
|
-
* Represents a primitive type.
|
|
12305
|
-
* Described in https://w3c.github.io/webdriver-bidi/#type-script-PrimitiveProtocolValue.
|
|
12306
|
-
*/
|
|
12307
|
-
const PrimitiveType = {
|
|
12308
|
-
Undefined: "undefined",
|
|
12309
|
-
Null: "null",
|
|
12310
|
-
String: "string",
|
|
12311
|
-
Number: "number",
|
|
12312
|
-
SpecialNumber: "number",
|
|
12313
|
-
Boolean: "boolean",
|
|
12314
|
-
BigInt: "bigint"
|
|
12315
|
-
};
|
|
12316
|
-
/**
|
|
12317
|
-
* Represents a non-primitive type.
|
|
12318
|
-
* Described in https://w3c.github.io/webdriver-bidi/#type-script-RemoteValue.
|
|
12319
|
-
* @deprecated will be removed in v5. Use `@AttrDeserialize()` / `@PropDeserialize()` decorators instead.
|
|
12320
|
-
*/
|
|
12321
|
-
const NonPrimitiveType = {
|
|
12322
|
-
Array: "array",
|
|
12323
|
-
Date: "date",
|
|
12324
|
-
Map: "map",
|
|
12325
|
-
Object: "object",
|
|
12326
|
-
RegularExpression: "regexp",
|
|
12327
|
-
Set: "set",
|
|
12328
|
-
Channel: "channel",
|
|
12329
|
-
Symbol: "symbol"
|
|
12330
|
-
};
|
|
12331
|
-
/** @deprecated will be removed in v5. Use `@AttrDeserialize()` / `@PropDeserialize()` decorators instead. */
|
|
12332
|
-
const TYPE_CONSTANT = "type";
|
|
12333
|
-
/** @deprecated will be removed in v5. Use `@AttrDeserialize()` / `@PropDeserialize()` decorators instead. */
|
|
12334
|
-
const VALUE_CONSTANT = "value";
|
|
12335
|
-
/** @deprecated will be removed in v5. Use `@AttrDeserialize()` / `@PropDeserialize()` decorators instead. */
|
|
12336
|
-
const SERIALIZED_PREFIX = "serialized:";
|
|
12337
12312
|
const HYDRATED_STYLE_ID = "sty-id";
|
|
12338
12313
|
const STENCIL_DOC_DATA = "_stencilDocData";
|
|
12339
12314
|
//#endregion
|
|
12340
12315
|
//#region src/utils/helpers.ts
|
|
12341
12316
|
const isString = (v) => typeof v === "string";
|
|
12342
12317
|
//#endregion
|
|
12343
|
-
//#region src/utils/shadow-css.ts
|
|
12344
|
-
const _polyfillHost = "-shadowcsshost";
|
|
12345
|
-
const _polyfillSlotted = "-shadowcssslotted";
|
|
12346
|
-
const _polyfillHostContext = "-shadowcsscontext";
|
|
12347
|
-
const _parenSuffix = ")(?:\\(((?:\\([^)(]*\\)|[^)(]*)+?)\\))?([^,{]*)";
|
|
12348
|
-
new RegExp("(" + _polyfillHost + _parenSuffix, "gim");
|
|
12349
|
-
new RegExp("(" + _polyfillHostContext + _parenSuffix, "gim");
|
|
12350
|
-
new RegExp("(" + _polyfillSlotted + _parenSuffix, "gim");
|
|
12351
|
-
_polyfillHost + "";
|
|
12352
|
-
//#endregion
|
|
12353
12318
|
//#region src/runtime/mode.ts
|
|
12354
12319
|
const setMode = (handler) => modeResolutionChain.push(handler);
|
|
12355
|
-
//#endregion
|
|
12356
|
-
//#region src/utils/local-value.ts
|
|
12357
|
-
/**
|
|
12358
|
-
* Represents a local value with a specified type and optional value.
|
|
12359
|
-
* Described in https://w3c.github.io/webdriver-bidi/#type-script-LocalValue
|
|
12360
|
-
* @deprecated will be removed in v5. Use `@AttrDeserialize()` / `@PropDeserialize()` decorators instead.
|
|
12361
|
-
*/
|
|
12362
|
-
var LocalValue = class LocalValue {
|
|
12363
|
-
type;
|
|
12364
|
-
value;
|
|
12365
|
-
constructor(type, value) {
|
|
12366
|
-
if (type === PrimitiveType.Undefined || type === PrimitiveType.Null) this.type = type;
|
|
12367
|
-
else {
|
|
12368
|
-
this.type = type;
|
|
12369
|
-
this.value = value;
|
|
12370
|
-
}
|
|
12371
|
-
}
|
|
12372
|
-
/**
|
|
12373
|
-
* Creates a new LocalValue object with a string value.
|
|
12374
|
-
*
|
|
12375
|
-
* @param {string} value - The string value to be stored in the LocalValue object.
|
|
12376
|
-
* @returns {LocalValue} - The created LocalValue object.
|
|
12377
|
-
*/
|
|
12378
|
-
static createStringValue(value) {
|
|
12379
|
-
return new LocalValue(PrimitiveType.String, value);
|
|
12380
|
-
}
|
|
12381
|
-
/**
|
|
12382
|
-
* Creates a new LocalValue object with a number value.
|
|
12383
|
-
*
|
|
12384
|
-
* @param {number} value - The number value.
|
|
12385
|
-
* @returns {LocalValue} - The created LocalValue object.
|
|
12386
|
-
*/
|
|
12387
|
-
static createNumberValue(value) {
|
|
12388
|
-
return new LocalValue(PrimitiveType.Number, value);
|
|
12389
|
-
}
|
|
12390
|
-
/**
|
|
12391
|
-
* Creates a new LocalValue object with a special number value.
|
|
12392
|
-
*
|
|
12393
|
-
* @param {number} value - The value of the special number.
|
|
12394
|
-
* @returns {LocalValue} - The created LocalValue object.
|
|
12395
|
-
*/
|
|
12396
|
-
static createSpecialNumberValue(value) {
|
|
12397
|
-
if (Number.isNaN(value)) return new LocalValue(PrimitiveType.SpecialNumber, "NaN");
|
|
12398
|
-
if (Object.is(value, -0)) return new LocalValue(PrimitiveType.SpecialNumber, "-0");
|
|
12399
|
-
if (value === Infinity) return new LocalValue(PrimitiveType.SpecialNumber, "Infinity");
|
|
12400
|
-
if (value === -Infinity) return new LocalValue(PrimitiveType.SpecialNumber, "-Infinity");
|
|
12401
|
-
return new LocalValue(PrimitiveType.SpecialNumber, value);
|
|
12402
|
-
}
|
|
12403
|
-
/**
|
|
12404
|
-
* Creates a new LocalValue object with an undefined value.
|
|
12405
|
-
* @returns {LocalValue} - The created LocalValue object.
|
|
12406
|
-
*/
|
|
12407
|
-
static createUndefinedValue() {
|
|
12408
|
-
return new LocalValue(PrimitiveType.Undefined);
|
|
12409
|
-
}
|
|
12410
|
-
/**
|
|
12411
|
-
* Creates a new LocalValue object with a null value.
|
|
12412
|
-
* @returns {LocalValue} - The created LocalValue object.
|
|
12413
|
-
*/
|
|
12414
|
-
static createNullValue() {
|
|
12415
|
-
return new LocalValue(PrimitiveType.Null);
|
|
12416
|
-
}
|
|
12417
|
-
/**
|
|
12418
|
-
* Creates a new LocalValue object with a boolean value.
|
|
12419
|
-
*
|
|
12420
|
-
* @param {boolean} value - The boolean value.
|
|
12421
|
-
* @returns {LocalValue} - The created LocalValue object.
|
|
12422
|
-
*/
|
|
12423
|
-
static createBooleanValue(value) {
|
|
12424
|
-
return new LocalValue(PrimitiveType.Boolean, value);
|
|
12425
|
-
}
|
|
12426
|
-
/**
|
|
12427
|
-
* Creates a new LocalValue object with a BigInt value.
|
|
12428
|
-
*
|
|
12429
|
-
* @param {BigInt} value - The BigInt value.
|
|
12430
|
-
* @returns {LocalValue} - The created LocalValue object.
|
|
12431
|
-
*/
|
|
12432
|
-
static createBigIntValue(value) {
|
|
12433
|
-
return new LocalValue(PrimitiveType.BigInt, value.toString());
|
|
12434
|
-
}
|
|
12435
|
-
/**
|
|
12436
|
-
* Creates a new LocalValue object with an array.
|
|
12437
|
-
*
|
|
12438
|
-
* @param {Array} value - The array.
|
|
12439
|
-
* @returns {LocalValue} - The created LocalValue object.
|
|
12440
|
-
*/
|
|
12441
|
-
static createArrayValue(value) {
|
|
12442
|
-
return new LocalValue(NonPrimitiveType.Array, value);
|
|
12443
|
-
}
|
|
12444
|
-
/**
|
|
12445
|
-
* Creates a new LocalValue object with date value.
|
|
12446
|
-
*
|
|
12447
|
-
* @param {string} value - The date.
|
|
12448
|
-
* @returns {LocalValue} - The created LocalValue object.
|
|
12449
|
-
*/
|
|
12450
|
-
static createDateValue(value) {
|
|
12451
|
-
return new LocalValue(NonPrimitiveType.Date, value);
|
|
12452
|
-
}
|
|
12453
|
-
/**
|
|
12454
|
-
* Creates a new LocalValue object of map value.
|
|
12455
|
-
* @param {Map} map - The map.
|
|
12456
|
-
* @returns {LocalValue} - The created LocalValue object.
|
|
12457
|
-
*/
|
|
12458
|
-
static createMapValue(map) {
|
|
12459
|
-
const value = [];
|
|
12460
|
-
Array.from(map.entries()).forEach(([key, val]) => {
|
|
12461
|
-
value.push([LocalValue.getArgument(key), LocalValue.getArgument(val)]);
|
|
12462
|
-
});
|
|
12463
|
-
return new LocalValue(NonPrimitiveType.Map, value);
|
|
12464
|
-
}
|
|
12465
|
-
/**
|
|
12466
|
-
* Creates a new LocalValue object from the passed object.
|
|
12467
|
-
*
|
|
12468
|
-
* @param object the object to create a LocalValue from
|
|
12469
|
-
* @returns {LocalValue} - The created LocalValue object.
|
|
12470
|
-
*/
|
|
12471
|
-
static createObjectValue(object) {
|
|
12472
|
-
const value = [];
|
|
12473
|
-
Object.entries(object).forEach(([key, val]) => {
|
|
12474
|
-
value.push([key, LocalValue.getArgument(val)]);
|
|
12475
|
-
});
|
|
12476
|
-
return new LocalValue(NonPrimitiveType.Object, value);
|
|
12477
|
-
}
|
|
12478
|
-
/**
|
|
12479
|
-
* Creates a new LocalValue object of regular expression value.
|
|
12480
|
-
*
|
|
12481
|
-
* @param {string} value - The value of the regular expression.
|
|
12482
|
-
* @returns {LocalValue} - The created LocalValue object.
|
|
12483
|
-
*/
|
|
12484
|
-
static createRegularExpressionValue(value) {
|
|
12485
|
-
return new LocalValue(NonPrimitiveType.RegularExpression, value);
|
|
12486
|
-
}
|
|
12487
|
-
/**
|
|
12488
|
-
* Creates a new LocalValue object with the specified value.
|
|
12489
|
-
* @param {Set} value - The value to be set.
|
|
12490
|
-
* @returns {LocalValue} - The created LocalValue object.
|
|
12491
|
-
*/
|
|
12492
|
-
static createSetValue(value) {
|
|
12493
|
-
return new LocalValue(NonPrimitiveType.Set, value);
|
|
12494
|
-
}
|
|
12495
|
-
/**
|
|
12496
|
-
* Creates a new LocalValue object with the given channel value
|
|
12497
|
-
*
|
|
12498
|
-
* @param {ChannelValue} value - The channel value.
|
|
12499
|
-
* @returns {LocalValue} - The created LocalValue object.
|
|
12500
|
-
*/
|
|
12501
|
-
static createChannelValue(value) {
|
|
12502
|
-
return new LocalValue(NonPrimitiveType.Channel, value);
|
|
12503
|
-
}
|
|
12504
|
-
/**
|
|
12505
|
-
* Creates a new LocalValue object with a Symbol value.
|
|
12506
|
-
*
|
|
12507
|
-
* @param {Symbol} symbol - The Symbol value
|
|
12508
|
-
* @returns {LocalValue} - The created LocalValue object
|
|
12509
|
-
*/
|
|
12510
|
-
static createSymbolValue(symbol) {
|
|
12511
|
-
const description = symbol.description || "Symbol()";
|
|
12512
|
-
return new LocalValue(NonPrimitiveType.Symbol, description);
|
|
12513
|
-
}
|
|
12514
|
-
static getArgument(argument) {
|
|
12515
|
-
const type = typeof argument;
|
|
12516
|
-
switch (type) {
|
|
12517
|
-
case PrimitiveType.String: return LocalValue.createStringValue(argument);
|
|
12518
|
-
case PrimitiveType.Number:
|
|
12519
|
-
if (Number.isNaN(argument) || Object.is(argument, -0) || !Number.isFinite(argument)) return LocalValue.createSpecialNumberValue(argument);
|
|
12520
|
-
return LocalValue.createNumberValue(argument);
|
|
12521
|
-
case PrimitiveType.Boolean: return LocalValue.createBooleanValue(argument);
|
|
12522
|
-
case PrimitiveType.BigInt: return LocalValue.createBigIntValue(argument);
|
|
12523
|
-
case PrimitiveType.Undefined: return LocalValue.createUndefinedValue();
|
|
12524
|
-
case NonPrimitiveType.Symbol: return LocalValue.createSymbolValue(argument);
|
|
12525
|
-
case NonPrimitiveType.Object:
|
|
12526
|
-
if (argument === null) return LocalValue.createNullValue();
|
|
12527
|
-
if (argument instanceof Date) return LocalValue.createDateValue(argument);
|
|
12528
|
-
if (argument instanceof Map) {
|
|
12529
|
-
const map = [];
|
|
12530
|
-
argument.forEach((value, key) => {
|
|
12531
|
-
const objectKey = typeof key === "string" ? key : LocalValue.getArgument(key);
|
|
12532
|
-
const objectValue = LocalValue.getArgument(value);
|
|
12533
|
-
map.push([objectKey, objectValue]);
|
|
12534
|
-
});
|
|
12535
|
-
return LocalValue.createMapValue(argument);
|
|
12536
|
-
}
|
|
12537
|
-
if (argument instanceof Set) {
|
|
12538
|
-
const set = [];
|
|
12539
|
-
argument.forEach((value) => {
|
|
12540
|
-
set.push(LocalValue.getArgument(value));
|
|
12541
|
-
});
|
|
12542
|
-
return LocalValue.createSetValue(set);
|
|
12543
|
-
}
|
|
12544
|
-
if (argument instanceof Array) {
|
|
12545
|
-
const arr = [];
|
|
12546
|
-
argument.forEach((value) => {
|
|
12547
|
-
arr.push(LocalValue.getArgument(value));
|
|
12548
|
-
});
|
|
12549
|
-
return LocalValue.createArrayValue(arr);
|
|
12550
|
-
}
|
|
12551
|
-
if (argument instanceof RegExp) return LocalValue.createRegularExpressionValue({
|
|
12552
|
-
pattern: argument.source,
|
|
12553
|
-
flags: argument.flags
|
|
12554
|
-
});
|
|
12555
|
-
return LocalValue.createObjectValue(argument);
|
|
12556
|
-
}
|
|
12557
|
-
throw new Error(`Unsupported type: ${type}`);
|
|
12558
|
-
}
|
|
12559
|
-
asMap() {
|
|
12560
|
-
return {
|
|
12561
|
-
[TYPE_CONSTANT]: this.type,
|
|
12562
|
-
...!(this.type === PrimitiveType.Null || this.type === PrimitiveType.Undefined) ? { [VALUE_CONSTANT]: this.value } : {}
|
|
12563
|
-
};
|
|
12564
|
-
}
|
|
12565
|
-
};
|
|
12566
|
-
//#endregion
|
|
12567
|
-
//#region src/utils/remote-value.ts
|
|
12568
|
-
/**
|
|
12569
|
-
* RemoteValue class for deserializing LocalValue serialized objects back into their original form
|
|
12570
|
-
* @deprecated will be removed in v5. Use `@AttrDeserialize()` / `@PropDeserialize()` decorators instead.
|
|
12571
|
-
*/
|
|
12572
|
-
var RemoteValue = class RemoteValue {
|
|
12573
|
-
/**
|
|
12574
|
-
* Deserializes a LocalValue serialized object back to its original JavaScript representation
|
|
12575
|
-
*
|
|
12576
|
-
* @param serialized The serialized LocalValue object
|
|
12577
|
-
* @returns The original JavaScript value/object
|
|
12578
|
-
*/
|
|
12579
|
-
static fromLocalValue(serialized) {
|
|
12580
|
-
const type = serialized[TYPE_CONSTANT];
|
|
12581
|
-
const value = "value" in serialized ? serialized[VALUE_CONSTANT] : void 0;
|
|
12582
|
-
switch (type) {
|
|
12583
|
-
case PrimitiveType.String: return value;
|
|
12584
|
-
case PrimitiveType.Boolean: return value;
|
|
12585
|
-
case PrimitiveType.BigInt: return BigInt(value);
|
|
12586
|
-
case PrimitiveType.Undefined: return;
|
|
12587
|
-
case PrimitiveType.Null: return null;
|
|
12588
|
-
case PrimitiveType.Number:
|
|
12589
|
-
if (value === "NaN") return NaN;
|
|
12590
|
-
if (value === "-0") return -0;
|
|
12591
|
-
if (value === "Infinity") return Infinity;
|
|
12592
|
-
if (value === "-Infinity") return -Infinity;
|
|
12593
|
-
return value;
|
|
12594
|
-
case NonPrimitiveType.Array: return value.map((item) => RemoteValue.fromLocalValue(item));
|
|
12595
|
-
case NonPrimitiveType.Date: return new Date(value);
|
|
12596
|
-
case NonPrimitiveType.Map:
|
|
12597
|
-
const map = /* @__PURE__ */ new Map();
|
|
12598
|
-
for (const [key, val] of value) {
|
|
12599
|
-
const deserializedKey = typeof key === "object" && key !== null ? RemoteValue.fromLocalValue(key) : key;
|
|
12600
|
-
const deserializedValue = RemoteValue.fromLocalValue(val);
|
|
12601
|
-
map.set(deserializedKey, deserializedValue);
|
|
12602
|
-
}
|
|
12603
|
-
return map;
|
|
12604
|
-
case NonPrimitiveType.Object:
|
|
12605
|
-
const obj = {};
|
|
12606
|
-
for (const [key, val] of value) obj[key] = RemoteValue.fromLocalValue(val);
|
|
12607
|
-
return obj;
|
|
12608
|
-
case NonPrimitiveType.RegularExpression:
|
|
12609
|
-
const { pattern, flags } = value;
|
|
12610
|
-
return new RegExp(pattern, flags);
|
|
12611
|
-
case NonPrimitiveType.Set:
|
|
12612
|
-
const set = /* @__PURE__ */ new Set();
|
|
12613
|
-
for (const item of value) set.add(RemoteValue.fromLocalValue(item));
|
|
12614
|
-
return set;
|
|
12615
|
-
case NonPrimitiveType.Symbol: return Symbol(value);
|
|
12616
|
-
default: throw new Error(`Unsupported type: ${type}`);
|
|
12617
|
-
}
|
|
12618
|
-
}
|
|
12619
|
-
/**
|
|
12620
|
-
* Utility method to deserialize multiple LocalValues at once
|
|
12621
|
-
*
|
|
12622
|
-
* @param serializedValues Array of serialized LocalValue objects
|
|
12623
|
-
* @returns Array of deserialized JavaScript values
|
|
12624
|
-
*/
|
|
12625
|
-
static fromLocalValueArray(serializedValues) {
|
|
12626
|
-
return serializedValues.map((value) => RemoteValue.fromLocalValue(value));
|
|
12627
|
-
}
|
|
12628
|
-
/**
|
|
12629
|
-
* Verifies if the given object matches the structure of a serialized LocalValue
|
|
12630
|
-
*
|
|
12631
|
-
* @param obj Object to verify
|
|
12632
|
-
* @returns boolean indicating if the object has LocalValue structure
|
|
12633
|
-
*/
|
|
12634
|
-
static isLocalValueObject(obj) {
|
|
12635
|
-
if (typeof obj !== "object" || obj === null) return false;
|
|
12636
|
-
if (!obj.hasOwnProperty("type")) return false;
|
|
12637
|
-
const type = obj[TYPE_CONSTANT];
|
|
12638
|
-
if (!Object.values({
|
|
12639
|
-
...PrimitiveType,
|
|
12640
|
-
...NonPrimitiveType
|
|
12641
|
-
}).includes(type)) return false;
|
|
12642
|
-
if (type !== PrimitiveType.Null && type !== PrimitiveType.Undefined) return obj.hasOwnProperty(VALUE_CONSTANT);
|
|
12643
|
-
return true;
|
|
12644
|
-
}
|
|
12645
|
-
};
|
|
12646
|
-
//#endregion
|
|
12647
|
-
//#region src/utils/serialize.ts
|
|
12648
|
-
/**
|
|
12649
|
-
* Serialize a value to a string that can be deserialized later.
|
|
12650
|
-
* @param {unknown} value - The value to serialize.
|
|
12651
|
-
* @returns {string} A string that can be deserialized later.
|
|
12652
|
-
* @deprecated will be removed in v5. Use `@PropSerialize()` decorator instead.
|
|
12653
|
-
*/
|
|
12654
|
-
function serializeProperty(value) {
|
|
12655
|
-
/**
|
|
12656
|
-
* If the value is a primitive type, return it as is.
|
|
12657
|
-
*/
|
|
12658
|
-
if ([
|
|
12659
|
-
"string",
|
|
12660
|
-
"boolean",
|
|
12661
|
-
"undefined"
|
|
12662
|
-
].includes(typeof value) || typeof value === "number" && value !== Infinity && value !== -Infinity && !isNaN(value)) return value;
|
|
12663
|
-
const arg = LocalValue.getArgument(value);
|
|
12664
|
-
return SERIALIZED_PREFIX + btoa(JSON.stringify(arg));
|
|
12665
|
-
}
|
|
12666
|
-
/**
|
|
12667
|
-
* Deserialize a value from a string that was serialized earlier.
|
|
12668
|
-
* @param {string} value - The string to deserialize.
|
|
12669
|
-
* @returns {unknown} The deserialized value.
|
|
12670
|
-
* @deprecated will be removed in v5. Use `@AttrDeserialize()` decorator instead.
|
|
12671
|
-
*/
|
|
12672
|
-
function deserializeProperty(value) {
|
|
12673
|
-
if (typeof value !== "string" || !value.startsWith("serialized:")) return value;
|
|
12674
|
-
return RemoteValue.fromLocalValue(JSON.parse(atob(value.slice(11))));
|
|
12675
|
-
}
|
|
12676
12320
|
new RegExp("Capture$");
|
|
12677
12321
|
BUILD.lazyLoad || globalThis.HTMLElement;
|
|
12678
12322
|
//#endregion
|
|
@@ -14043,4 +13687,4 @@ function removeScripts(elm) {
|
|
|
14043
13687
|
}
|
|
14044
13688
|
}
|
|
14045
13689
|
//#endregion
|
|
14046
|
-
export { createWindowFromHtml,
|
|
13690
|
+
export { createWindowFromHtml, hydrateDocument, renderToString, resetHydrateDocData, serializeDocumentToString, setTagTransformer, streamToString, transformTag };
|