@stencil/core 4.28.2 → 4.29.0
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 +10 -7
- 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 +156 -3
- package/internal/client/package.json +1 -1
- package/internal/client/patch-browser.js +1 -1
- package/internal/hydrate/index.js +161 -14
- package/internal/hydrate/package.json +1 -1
- package/internal/hydrate/runner.d.ts +12 -0
- package/internal/hydrate/runner.js +365 -1
- package/internal/package.json +1 -1
- package/internal/stencil-public-runtime.d.ts +2 -0
- package/internal/testing/index.js +155 -2
- 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 +2 -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 +38 -38
- package/sys/node/package.json +1 -1
- package/sys/node/worker.js +1 -1
- package/testing/index.js +3 -2
- package/testing/package.json +1 -1
|
@@ -1662,6 +1662,8 @@ export declare namespace JSXBase {
|
|
|
1662
1662
|
onTransitionRunCapture?: (event: TransitionEvent) => void;
|
|
1663
1663
|
onTransitionStart?: (event: TransitionEvent) => void;
|
|
1664
1664
|
onTransitionStartCapture?: (event: TransitionEvent) => void;
|
|
1665
|
+
[key: `aria-${string}`]: string | boolean | undefined;
|
|
1666
|
+
[key: `aria${string}`]: string | boolean | undefined;
|
|
1665
1667
|
}
|
|
1666
1668
|
}
|
|
1667
1669
|
export interface JSXAttributes<T = Element> {
|
|
@@ -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,19 @@ 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
|
+
const members = Object.entries(((_a = hostRef.$cmpMeta$) == null ? void 0 : _a.$members$) || {});
|
|
1386
|
+
members.forEach(([memberName, [memberFlags, metaAttributeName]]) => {
|
|
1387
|
+
var _a2;
|
|
1388
|
+
if (!(memberFlags & 31 /* Prop */)) {
|
|
1389
|
+
return;
|
|
1390
|
+
}
|
|
1391
|
+
const attributeName = metaAttributeName || memberName;
|
|
1392
|
+
const attrVal = hostElm.getAttribute(attributeName);
|
|
1393
|
+
if (attrVal !== null) {
|
|
1394
|
+
const attrPropVal = parsePropertyValue(attrVal, memberFlags);
|
|
1395
|
+
(_a2 = hostRef == null ? void 0 : hostRef.$instanceValues$) == null ? void 0 : _a2.set(memberName, attrPropVal);
|
|
1396
|
+
}
|
|
1397
|
+
});
|
|
1257
1398
|
let scopeId2;
|
|
1258
1399
|
if (import_app_data5.BUILD.scoped) {
|
|
1259
1400
|
const cmpMeta = hostRef.$cmpMeta$;
|
|
@@ -2006,12 +2147,23 @@ var import_app_data14 = require("@stencil/core/internal/app-data");
|
|
|
2006
2147
|
// src/runtime/parse-property-value.ts
|
|
2007
2148
|
var import_app_data6 = require("@stencil/core/internal/app-data");
|
|
2008
2149
|
var parsePropertyValue = (propValue, propType) => {
|
|
2150
|
+
if ((import_app_data6.BUILD.hydrateClientSide || import_app_data6.BUILD.hydrateServerSide) && typeof propValue === "string" && (propValue.startsWith("{") && propValue.endsWith("}") || propValue.startsWith("[") && propValue.endsWith("]"))) {
|
|
2151
|
+
try {
|
|
2152
|
+
propValue = JSON.parse(propValue);
|
|
2153
|
+
return propValue;
|
|
2154
|
+
} catch (e) {
|
|
2155
|
+
}
|
|
2156
|
+
}
|
|
2157
|
+
if ((import_app_data6.BUILD.hydrateClientSide || import_app_data6.BUILD.hydrateServerSide) && typeof propValue === "string" && propValue.startsWith(SERIALIZED_PREFIX)) {
|
|
2158
|
+
propValue = deserializeProperty(propValue);
|
|
2159
|
+
return propValue;
|
|
2160
|
+
}
|
|
2009
2161
|
if (propValue != null && !isComplexType(propValue)) {
|
|
2010
2162
|
if (import_app_data6.BUILD.propBoolean && propType & 4 /* Boolean */) {
|
|
2011
2163
|
return propValue === "false" ? false : propValue === "" || !!propValue;
|
|
2012
2164
|
}
|
|
2013
2165
|
if (import_app_data6.BUILD.propNumber && propType & 2 /* Number */) {
|
|
2014
|
-
return parseFloat(propValue);
|
|
2166
|
+
return typeof propValue === "string" ? parseFloat(propValue) : typeof propValue === "number" ? propValue : NaN;
|
|
2015
2167
|
}
|
|
2016
2168
|
if (import_app_data6.BUILD.propString && propType & 1 /* String */) {
|
|
2017
2169
|
return String(propValue);
|
|
@@ -2786,7 +2938,8 @@ var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
|
|
|
2786
2938
|
const hostElm = hostRef.$hostElement$;
|
|
2787
2939
|
const cmpMeta = hostRef.$cmpMeta$;
|
|
2788
2940
|
const oldVNode = hostRef.$vnode$ || newVNode(null, null);
|
|
2789
|
-
const
|
|
2941
|
+
const isHostElement = isHost(renderFnResults);
|
|
2942
|
+
const rootVnode = isHostElement ? renderFnResults : h(null, null, renderFnResults);
|
|
2790
2943
|
hostTagName = hostElm.tagName;
|
|
2791
2944
|
if (import_app_data12.BUILD.isDev && Array.isArray(renderFnResults) && renderFnResults.some(isHost)) {
|
|
2792
2945
|
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.
|
|
3
|
+
"version": "4.29.0",
|
|
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
|
package/mock-doc/index.cjs
CHANGED
package/mock-doc/index.js
CHANGED
package/mock-doc/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stencil/core",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.29.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "./internal/stencil-core/index.cjs",
|
|
6
6
|
"module": "./internal/stencil-core/index.js",
|
|
@@ -116,6 +116,7 @@
|
|
|
116
116
|
"test.dist": "npm run ts scripts/index.ts -- --validate-build",
|
|
117
117
|
"test.end-to-end": "cd test/end-to-end && npm ci && npm test && npm run test.dist",
|
|
118
118
|
"test.jest": "node --experimental-vm-modules ./node_modules/jest/bin/jest.js",
|
|
119
|
+
"test.type-tests": "cd ./test/wdio && npm install && npm run build.main && cd ../../ && tsc -p test/type-tests/tsconfig.json",
|
|
119
120
|
"test.wdio": "cd test/wdio && npm ci && npm run test",
|
|
120
121
|
"test.wdio.testOnly": "cd test/wdio && npm ci && npm run wdio",
|
|
121
122
|
"test.prod": "npm run test.dist && npm run test.end-to-end && npm run test.jest && npm run test.wdio && npm run test.testing && npm run test.analysis",
|
package/screenshot/index.js
CHANGED
package/screenshot/package.json
CHANGED