@stencil/core 5.0.0-alpha.2 → 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.
Files changed (42) hide show
  1. package/dist/{client-DucyoZT4.mjs → client-CSm3x5ke.mjs} +81 -60
  2. package/dist/compiler/index.d.mts +3 -3
  3. package/dist/compiler/index.mjs +2 -2
  4. package/dist/compiler/utils/index.d.mts +2 -2
  5. package/dist/compiler/utils/index.mjs +3 -3
  6. package/dist/{compiler-DyK1_szo.mjs → compiler-D6iP7Bzb.mjs} +1390 -1631
  7. package/dist/declarations/stencil-public-compiler.d.ts +4031 -2
  8. package/dist/declarations/stencil-public-compiler.js +0 -1
  9. package/dist/declarations/stencil-public-docs.d.ts +494 -1
  10. package/dist/declarations/stencil-public-runtime.d.ts +1943 -2
  11. package/dist/{index-fIuYTL9f.d.mts → index-CXHCTQNt.d.mts} +14 -2
  12. package/dist/{index-BONzXKJt.d.ts → index-CyrGY82h.d.ts} +5 -7
  13. package/dist/{index-CHjZtib0.d.ts → index-hS-KBdAP.d.ts} +1 -1
  14. package/dist/{index-D-LlB2nw.d.mts → index-tUR6pD3J.d.mts} +145 -809
  15. package/dist/index.d.mts +1 -0
  16. package/dist/index.mjs +2 -2
  17. package/dist/{jsx-runtime-DBzBJLKk.d.ts → jsx-runtime-DlDkTqps.d.ts} +1 -1
  18. package/dist/jsx-runtime.d.ts +1 -1
  19. package/dist/jsx-runtime.js +1 -1
  20. package/dist/{node-BWBQAh8C.mjs → node-Bg-mO5dw.mjs} +3 -14
  21. package/dist/regular-expression-D5pGVpCu.mjs +415 -0
  22. package/dist/runtime/app-data/index.d.ts +1 -1
  23. package/dist/runtime/app-data/index.js +1 -2
  24. package/dist/runtime/client/index.d.ts +14 -4
  25. package/dist/runtime/client/index.js +103 -205
  26. package/dist/runtime/index.d.ts +16 -4
  27. package/dist/runtime/index.js +2 -2
  28. package/dist/runtime/server/index.d.mts +1 -3
  29. package/dist/runtime/server/index.mjs +103 -205
  30. package/dist/runtime/server/runner.d.mts +1 -17
  31. package/dist/runtime/server/runner.mjs +12 -394
  32. package/dist/{runtime-CqlPYKjW.js → runtime-BBCnuprF.js} +103 -205
  33. package/dist/sys/node/index.d.mts +1 -1
  34. package/dist/sys/node/index.mjs +1 -1
  35. package/dist/sys/node/worker.mjs +2 -2
  36. package/dist/testing/index.d.mts +3 -3
  37. package/dist/testing/index.mjs +18 -17
  38. package/dist/{validation-BR7tMYEv.mjs → validation-Byxie0Uk.mjs} +28 -24
  39. package/package.json +9 -13
  40. package/dist/serialize-o-Sj1lvg.mjs +0 -792
  41. package/dist/stencil-public-compiler-C_X1iolo.d.ts +0 -4455
  42. 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 false;
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 "open";
11448
+ return this._mode;
11449
+ }
11450
+ set mode(value) {
11451
+ this._mode = value;
11443
11452
  }
11444
11453
  get pictureInPictureElement() {
11445
11454
  return null;
@@ -12300,405 +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
- * Unicode-safe base64 encoding that handles characters outside Latin1 range.
12650
- * Unlike btoa(), this properly handles Unicode characters including emoji,
12651
- * CJK characters, and currency symbols like €.
12652
- * @param {string} str - The string to encode.
12653
- * @returns {string} Base64 encoded string.
12654
- */
12655
- function encodeBase64Unicode(str) {
12656
- const utf8Bytes = new TextEncoder().encode(str);
12657
- let binary = "";
12658
- for (let i = 0; i < utf8Bytes.length; i++) binary += String.fromCharCode(utf8Bytes[i]);
12659
- return btoa(binary);
12660
- }
12661
- /**
12662
- * Unicode-safe base64 decoding that handles characters outside Latin1 range.
12663
- * Unlike atob(), this properly decodes Unicode characters including emoji,
12664
- * CJK characters, and currency symbols like €.
12665
- * @param {string} base64 - The base64 string to decode.
12666
- * @returns {string} Decoded string.
12667
- */
12668
- function decodeBase64Unicode(base64) {
12669
- const binary = atob(base64);
12670
- const bytes = new Uint8Array(binary.length);
12671
- for (let i = 0; i < binary.length; i++) bytes[i] = binary.charCodeAt(i);
12672
- return new TextDecoder().decode(bytes);
12673
- }
12674
- /**
12675
- * Serialize a value to a string that can be deserialized later.
12676
- * @param {unknown} value - The value to serialize.
12677
- * @returns {string} A string that can be deserialized later.
12678
- * @deprecated will be removed in v5. Use `@PropSerialize()` decorator instead.
12679
- */
12680
- function serializeProperty(value) {
12681
- /**
12682
- * If the value is a primitive type, return it as is.
12683
- */
12684
- if ([
12685
- "string",
12686
- "boolean",
12687
- "undefined"
12688
- ].includes(typeof value) || typeof value === "number" && value !== Infinity && value !== -Infinity && !isNaN(value)) return value;
12689
- const arg = LocalValue.getArgument(value);
12690
- return SERIALIZED_PREFIX + encodeBase64Unicode(JSON.stringify(arg));
12691
- }
12692
- /**
12693
- * Deserialize a value from a string that was serialized earlier.
12694
- * @param {string} value - The string to deserialize.
12695
- * @returns {unknown} The deserialized value.
12696
- * @deprecated will be removed in v5. Use `@AttrDeserialize()` decorator instead.
12697
- */
12698
- function deserializeProperty(value) {
12699
- if (typeof value !== "string" || !value.startsWith("serialized:")) return value;
12700
- return RemoteValue.fromLocalValue(JSON.parse(decodeBase64Unicode(value.slice(11))));
12701
- }
12702
12320
  new RegExp("Capture$");
12703
12321
  BUILD.lazyLoad || globalThis.HTMLElement;
12704
12322
  //#endregion
@@ -14069,4 +13687,4 @@ function removeScripts(elm) {
14069
13687
  }
14070
13688
  }
14071
13689
  //#endregion
14072
- export { createWindowFromHtml, deserializeProperty, hydrateDocument, renderToString, resetHydrateDocData, serializeDocumentToString, serializeProperty, setTagTransformer, streamToString, transformTag };
13690
+ export { createWindowFromHtml, hydrateDocument, renderToString, resetHydrateDocData, serializeDocumentToString, setTagTransformer, streamToString, transformTag };