@stencil/core 4.28.2-dev.1742360514.37ac3fc → 4.28.2-dev.1742410675.302a004

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core/internal",
3
- "version": "4.28.2-dev.1742360514.37ac3fc",
3
+ "version": "4.28.2-dev.1742410675.302a004",
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",
@@ -384,6 +384,30 @@ var import_app_data19 = require("@stencil/core/internal/app-data");
384
384
  // src/utils/constants.ts
385
385
  var SVG_NS = "http://www.w3.org/2000/svg";
386
386
  var HTML_NS = "http://www.w3.org/1999/xhtml";
387
+ var PrimitiveType = /* @__PURE__ */ ((PrimitiveType2) => {
388
+ PrimitiveType2["Undefined"] = "undefined";
389
+ PrimitiveType2["Null"] = "null";
390
+ PrimitiveType2["String"] = "string";
391
+ PrimitiveType2["Number"] = "number";
392
+ PrimitiveType2["SpecialNumber"] = "number";
393
+ PrimitiveType2["Boolean"] = "boolean";
394
+ PrimitiveType2["BigInt"] = "bigint";
395
+ return PrimitiveType2;
396
+ })(PrimitiveType || {});
397
+ var NonPrimitiveType = /* @__PURE__ */ ((NonPrimitiveType2) => {
398
+ NonPrimitiveType2["Array"] = "array";
399
+ NonPrimitiveType2["Date"] = "date";
400
+ NonPrimitiveType2["Map"] = "map";
401
+ NonPrimitiveType2["Object"] = "object";
402
+ NonPrimitiveType2["RegularExpression"] = "regexp";
403
+ NonPrimitiveType2["Set"] = "set";
404
+ NonPrimitiveType2["Channel"] = "channel";
405
+ NonPrimitiveType2["Symbol"] = "symbol";
406
+ return NonPrimitiveType2;
407
+ })(NonPrimitiveType || {});
408
+ var TYPE_CONSTANT = "type";
409
+ var VALUE_CONSTANT = "value";
410
+ var SERIALIZED_PREFIX = "serialized:";
387
411
 
388
412
  // src/utils/helpers.ts
389
413
  var isDef = (v) => v != null && v !== void 0;
@@ -403,6 +427,101 @@ var escapeRegExpSpecialCharacters = (text) => {
403
427
  return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
404
428
  };
405
429
 
430
+ // src/utils/remote-value.ts
431
+ var RemoteValue = class _RemoteValue {
432
+ /**
433
+ * Deserializes a LocalValue serialized object back to its original JavaScript representation
434
+ *
435
+ * @param serialized The serialized LocalValue object
436
+ * @returns The original JavaScript value/object
437
+ */
438
+ static fromLocalValue(serialized) {
439
+ const type = serialized[TYPE_CONSTANT];
440
+ const value = VALUE_CONSTANT in serialized ? serialized[VALUE_CONSTANT] : void 0;
441
+ switch (type) {
442
+ case "string" /* String */:
443
+ return value;
444
+ case "boolean" /* Boolean */:
445
+ return value;
446
+ case "bigint" /* BigInt */:
447
+ return BigInt(value);
448
+ case "undefined" /* Undefined */:
449
+ return void 0;
450
+ case "null" /* Null */:
451
+ return null;
452
+ case "number" /* Number */:
453
+ if (value === "NaN") return NaN;
454
+ if (value === "-0") return -0;
455
+ if (value === "Infinity") return Infinity;
456
+ if (value === "-Infinity") return -Infinity;
457
+ return value;
458
+ case "array" /* Array */:
459
+ return value.map((item) => _RemoteValue.fromLocalValue(item));
460
+ case "date" /* Date */:
461
+ return new Date(value);
462
+ case "map" /* Map */:
463
+ const map2 = /* @__PURE__ */ new Map();
464
+ for (const [key, val] of value) {
465
+ const deserializedKey = typeof key === "object" && key !== null ? _RemoteValue.fromLocalValue(key) : key;
466
+ const deserializedValue = _RemoteValue.fromLocalValue(val);
467
+ map2.set(deserializedKey, deserializedValue);
468
+ }
469
+ return map2;
470
+ case "object" /* Object */:
471
+ const obj = {};
472
+ for (const [key, val] of value) {
473
+ obj[key] = _RemoteValue.fromLocalValue(val);
474
+ }
475
+ return obj;
476
+ case "regexp" /* RegularExpression */:
477
+ const { pattern, flags } = value;
478
+ return new RegExp(pattern, flags);
479
+ case "set" /* Set */:
480
+ const set = /* @__PURE__ */ new Set();
481
+ for (const item of value) {
482
+ set.add(_RemoteValue.fromLocalValue(item));
483
+ }
484
+ return set;
485
+ case "symbol" /* Symbol */:
486
+ return Symbol(value);
487
+ default:
488
+ throw new Error(`Unsupported type: ${type}`);
489
+ }
490
+ }
491
+ /**
492
+ * Utility method to deserialize multiple LocalValues at once
493
+ *
494
+ * @param serializedValues Array of serialized LocalValue objects
495
+ * @returns Array of deserialized JavaScript values
496
+ */
497
+ static fromLocalValueArray(serializedValues) {
498
+ return serializedValues.map((value) => _RemoteValue.fromLocalValue(value));
499
+ }
500
+ /**
501
+ * Verifies if the given object matches the structure of a serialized LocalValue
502
+ *
503
+ * @param obj Object to verify
504
+ * @returns boolean indicating if the object has LocalValue structure
505
+ */
506
+ static isLocalValueObject(obj) {
507
+ if (typeof obj !== "object" || obj === null) {
508
+ return false;
509
+ }
510
+ if (!obj.hasOwnProperty(TYPE_CONSTANT)) {
511
+ return false;
512
+ }
513
+ const type = obj[TYPE_CONSTANT];
514
+ const hasTypeProperty = Object.values({ ...PrimitiveType, ...NonPrimitiveType }).includes(type);
515
+ if (!hasTypeProperty) {
516
+ return false;
517
+ }
518
+ if (type !== "null" /* Null */ && type !== "undefined" /* Undefined */) {
519
+ return obj.hasOwnProperty(VALUE_CONSTANT);
520
+ }
521
+ return true;
522
+ }
523
+ };
524
+
406
525
  // src/utils/result.ts
407
526
  var result_exports = {};
408
527
  __export(result_exports, {
@@ -452,6 +571,14 @@ var unwrapErr = (result) => {
452
571
  }
453
572
  };
454
573
 
574
+ // src/utils/serialize.ts
575
+ function deserializeProperty(value) {
576
+ if (typeof value !== "string" || !value.startsWith(SERIALIZED_PREFIX)) {
577
+ return value;
578
+ }
579
+ return RemoteValue.fromLocalValue(JSON.parse(atob(value.slice(SERIALIZED_PREFIX.length))));
580
+ }
581
+
455
582
  // src/utils/util.ts
456
583
  var lowerPathParam = (fn) => (p) => fn(p.toLowerCase());
457
584
  var isDtsFile = lowerPathParam((p) => p.endsWith(".d.ts") || p.endsWith(".d.mts") || p.endsWith(".d.cts"));
@@ -1246,6 +1373,7 @@ var validateInputProperties = (inputElm) => {
1246
1373
 
1247
1374
  // src/runtime/client-hydrate.ts
1248
1375
  var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1376
+ var _a;
1249
1377
  const endHydrate = createTime("hydrateClient", tagName);
1250
1378
  const shadowRoot = hostElm.shadowRoot;
1251
1379
  const childRenderNodes = [];
@@ -1254,6 +1382,18 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1254
1382
  const shadowRootNodes = import_app_data5.BUILD.shadowDom && shadowRoot ? [] : null;
1255
1383
  const vnode = newVNode(tagName, null);
1256
1384
  vnode.$elm$ = hostElm;
1385
+ vnode.$attrs$ = {};
1386
+ const members = Object.entries(((_a = hostRef.$cmpMeta$) == null ? void 0 : _a.$members$) || {});
1387
+ members.forEach(([memberName, [memberFlags, metaAttributeName]]) => {
1388
+ var _a2;
1389
+ if (!(memberFlags & 31 /* Prop */)) {
1390
+ return;
1391
+ }
1392
+ const attributeName = metaAttributeName || memberName;
1393
+ const attrPropVal = parsePropertyValue(hostElm.getAttribute(attributeName), memberFlags);
1394
+ vnode.$attrs$[memberName] = attrPropVal;
1395
+ (_a2 = hostRef == null ? void 0 : hostRef.$instanceValues$) == null ? void 0 : _a2.set(memberName, attrPropVal);
1396
+ });
1257
1397
  let scopeId2;
1258
1398
  if (import_app_data5.BUILD.scoped) {
1259
1399
  const cmpMeta = hostRef.$cmpMeta$;
@@ -2006,17 +2146,25 @@ var import_app_data14 = require("@stencil/core/internal/app-data");
2006
2146
  // src/runtime/parse-property-value.ts
2007
2147
  var import_app_data6 = require("@stencil/core/internal/app-data");
2008
2148
  var parsePropertyValue = (propValue, propType) => {
2149
+ if (import_app_data6.BUILD.hydrateClientSide && isComplexType(propValue) && typeof propValue === "string" && (propValue.startsWith("{") && propValue.endsWith("}") || propValue.startsWith("[") && propValue.endsWith("]"))) {
2150
+ try {
2151
+ return JSON.parse(propValue);
2152
+ } catch (e) {
2153
+ }
2154
+ }
2155
+ if (import_app_data6.BUILD.hydrateClientSide && typeof propValue === "string" && propValue.startsWith(SERIALIZED_PREFIX)) {
2156
+ return deserializeProperty(propValue);
2157
+ }
2009
2158
  if (propValue != null && !isComplexType(propValue)) {
2010
2159
  if (import_app_data6.BUILD.propBoolean && propType & 4 /* Boolean */) {
2011
2160
  return propValue === "false" ? false : propValue === "" || !!propValue;
2012
2161
  }
2013
2162
  if (import_app_data6.BUILD.propNumber && propType & 2 /* Number */) {
2014
- return parseFloat(propValue);
2163
+ return typeof propValue === "string" ? parseFloat(propValue) : typeof propValue === "number" ? propValue : NaN;
2015
2164
  }
2016
2165
  if (import_app_data6.BUILD.propString && propType & 1 /* String */) {
2017
2166
  return String(propValue);
2018
2167
  }
2019
- return propValue;
2020
2168
  }
2021
2169
  return propValue;
2022
2170
  };
@@ -2786,7 +2934,11 @@ var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
2786
2934
  const hostElm = hostRef.$hostElement$;
2787
2935
  const cmpMeta = hostRef.$cmpMeta$;
2788
2936
  const oldVNode = hostRef.$vnode$ || newVNode(null, null);
2789
- const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
2937
+ const isHostElement = isHost(renderFnResults);
2938
+ const rootVnode = isHostElement ? renderFnResults : h(null, null, renderFnResults);
2939
+ if (!isHostElement) {
2940
+ rootVnode.$attrs$ = oldVNode.$attrs$;
2941
+ }
2790
2942
  hostTagName = hostElm.tagName;
2791
2943
  if (import_app_data12.BUILD.isDev && Array.isArray(renderFnResults) && renderFnResults.some(isHost)) {
2792
2944
  throw new Error(`The <Host> must be the single root component.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core/internal/testing",
3
- "version": "4.28.2-dev.1742360514.37ac3fc",
3
+ "version": "4.28.2-dev.1742410675.302a004",
4
4
  "description": "Stencil internal testing 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
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Stencil Mock Doc (CommonJS) v4.28.2-dev.1742360514.37ac3fc | MIT Licensed | https://stenciljs.com
2
+ Stencil Mock Doc (CommonJS) v4.28.2-dev.1742410675.302a004 | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
  "use strict";
5
5
  var __defProp = Object.defineProperty;
package/mock-doc/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Stencil Mock Doc v4.28.2-dev.1742360514.37ac3fc | MIT Licensed | https://stenciljs.com
2
+ Stencil Mock Doc v4.28.2-dev.1742410675.302a004 | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
 
5
5
  // src/runtime/runtime-constants.ts
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core/mock-doc",
3
- "version": "4.28.2-dev.1742360514.37ac3fc",
3
+ "version": "4.28.2-dev.1742410675.302a004",
4
4
  "description": "Mock window, document and DOM outside of a browser environment.",
5
5
  "main": "./index.cjs",
6
6
  "module": "./index.js",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core",
3
- "version": "4.28.2-dev.1742360514.37ac3fc",
3
+ "version": "4.28.2-dev.1742410675.302a004",
4
4
  "license": "MIT",
5
5
  "main": "./internal/stencil-core/index.cjs",
6
6
  "module": "./internal/stencil-core/index.js",
@@ -1,5 +1,5 @@
1
1
  /*
2
- Stencil Screenshot v4.28.2-dev.1742360514.37ac3fc | MIT Licensed | https://stenciljs.com
2
+ Stencil Screenshot v4.28.2-dev.1742410675.302a004 | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
  "use strict";
5
5
  var __create = Object.create;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core/screenshot",
3
- "version": "4.28.2-dev.1742360514.37ac3fc",
3
+ "version": "4.28.2-dev.1742410675.302a004",
4
4
  "description": "Stencil Screenshot.",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",
@@ -1,5 +1,5 @@
1
1
  /*
2
- Stencil Screenshot Pixel Match v4.28.2-dev.1742360514.37ac3fc | MIT Licensed | https://stenciljs.com
2
+ Stencil Screenshot Pixel Match v4.28.2-dev.1742410675.302a004 | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
  "use strict";
5
5
  var __create = Object.create;