@stencil/core 4.37.1 → 4.38.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 +2 -2
- package/cli/index.js +2 -2
- package/cli/package.json +1 -1
- package/compiler/package.json +1 -1
- package/compiler/stencil.js +337 -169
- 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 +3 -3
- package/internal/app-data/index.cjs +1 -1
- package/internal/app-data/index.js +1 -1
- package/internal/app-data/package.json +1 -1
- package/internal/app-globals/package.json +1 -1
- package/internal/client/index.js +95 -46
- package/internal/client/package.json +1 -1
- package/internal/client/patch-browser.js +1 -1
- package/internal/hydrate/index.js +116 -64
- package/internal/hydrate/package.json +1 -1
- package/internal/hydrate/runner.d.ts +2 -0
- package/internal/hydrate/runner.js +1 -1
- package/internal/package.json +1 -1
- package/internal/stencil-core/index.d.ts +2 -0
- package/internal/stencil-private.d.ts +33 -8
- package/internal/stencil-public-compiler.d.ts +5 -0
- package/internal/stencil-public-runtime.d.ts +16 -2
- package/internal/testing/index.js +91 -44
- 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 +2 -2
- package/screenshot/package.json +1 -1
- package/screenshot/pixel-match.js +1 -1
- package/sys/node/index.js +34 -34
- package/sys/node/package.json +1 -1
- package/sys/node/worker.js +1 -1
- package/testing/index.js +22 -12
- package/testing/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Stencil Hydrate Platform v4.
|
|
2
|
+
Stencil Hydrate Platform v4.38.0 | MIT Licensed | https://stenciljs.com
|
|
3
3
|
*/
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
5
5
|
var __export = (target, all) => {
|
|
@@ -906,11 +906,13 @@ var inspect = (ref) => {
|
|
|
906
906
|
needsRerender: !!(flags & 512 /* needsRerender */)
|
|
907
907
|
},
|
|
908
908
|
instanceValues: hostRef.$instanceValues$,
|
|
909
|
+
serializerValues: hostRef.$serializerValues$,
|
|
909
910
|
ancestorComponent: hostRef.$ancestorComponent$,
|
|
910
911
|
hostElement,
|
|
911
912
|
lazyInstance: hostRef.$lazyInstance$,
|
|
912
913
|
vnode: hostRef.$vnode$,
|
|
913
914
|
modeName: hostRef.$modeName$,
|
|
915
|
+
fetchedCbList: hostRef.$fetchedCbList$,
|
|
914
916
|
onReadyPromise: hostRef.$onReadyPromise$,
|
|
915
917
|
onReadyResolve: hostRef.$onReadyResolve$,
|
|
916
918
|
onInstancePromise: hostRef.$onInstancePromise$,
|
|
@@ -1207,7 +1209,7 @@ var validateInputProperties = (inputElm) => {
|
|
|
1207
1209
|
|
|
1208
1210
|
// src/runtime/client-hydrate.ts
|
|
1209
1211
|
var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
|
|
1210
|
-
var _a, _b
|
|
1212
|
+
var _a, _b;
|
|
1211
1213
|
const endHydrate = createTime("hydrateClient", tagName);
|
|
1212
1214
|
const shadowRoot = hostElm.shadowRoot;
|
|
1213
1215
|
const childRenderNodes = [];
|
|
@@ -1216,23 +1218,6 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
|
|
|
1216
1218
|
const shadowRootNodes = BUILD8.shadowDom && shadowRoot ? [] : null;
|
|
1217
1219
|
const vnode = newVNode(tagName, null);
|
|
1218
1220
|
vnode.$elm$ = hostElm;
|
|
1219
|
-
const members = Object.entries(((_a = hostRef.$cmpMeta$) == null ? void 0 : _a.$members$) || {});
|
|
1220
|
-
members.forEach(([memberName, [memberFlags, metaAttributeName]]) => {
|
|
1221
|
-
var _a2, _b2;
|
|
1222
|
-
if (!(memberFlags & 31 /* Prop */)) {
|
|
1223
|
-
return;
|
|
1224
|
-
}
|
|
1225
|
-
const attributeName = metaAttributeName || memberName;
|
|
1226
|
-
const attrVal = hostElm.getAttribute(attributeName);
|
|
1227
|
-
if (attrVal !== null) {
|
|
1228
|
-
const attrPropVal = parsePropertyValue(
|
|
1229
|
-
attrVal,
|
|
1230
|
-
memberFlags,
|
|
1231
|
-
BUILD8.formAssociated && !!(((_a2 = hostRef.$cmpMeta$) == null ? void 0 : _a2.$flags$) & 64 /* formAssociated */)
|
|
1232
|
-
);
|
|
1233
|
-
(_b2 = hostRef == null ? void 0 : hostRef.$instanceValues$) == null ? void 0 : _b2.set(memberName, attrPropVal);
|
|
1234
|
-
}
|
|
1235
|
-
});
|
|
1236
1221
|
let scopeId2;
|
|
1237
1222
|
if (BUILD8.scoped) {
|
|
1238
1223
|
const cmpMeta = hostRef.$cmpMeta$;
|
|
@@ -1271,7 +1256,7 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
|
|
|
1271
1256
|
if (childRenderNode.$tag$ === "slot") {
|
|
1272
1257
|
node["s-cr"] = hostElm["s-cr"];
|
|
1273
1258
|
}
|
|
1274
|
-
} else if (((
|
|
1259
|
+
} else if (((_a = childRenderNode.$tag$) == null ? void 0 : _a.toString().includes("-")) && childRenderNode.$tag$ !== "slot-fb" && !childRenderNode.$elm$.shadowRoot) {
|
|
1275
1260
|
const cmpMeta = getHostRef(childRenderNode.$elm$);
|
|
1276
1261
|
if (cmpMeta) {
|
|
1277
1262
|
const scopeId3 = getScopeId(
|
|
@@ -1342,7 +1327,7 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
|
|
|
1342
1327
|
}
|
|
1343
1328
|
}
|
|
1344
1329
|
addSlotRelocateNode(slottedItem.node, slottedItem.slot, false, slottedItem.node["s-oo"]);
|
|
1345
|
-
if (((
|
|
1330
|
+
if (((_b = slottedItem.node.parentElement) == null ? void 0 : _b.shadowRoot) && slottedItem.node["getAttribute"] && slottedItem.node.getAttribute("slot")) {
|
|
1346
1331
|
slottedItem.node.removeAttribute("slot");
|
|
1347
1332
|
}
|
|
1348
1333
|
if (BUILD8.experimentalSlotFixes) {
|
|
@@ -2765,9 +2750,13 @@ render() {
|
|
|
2765
2750
|
}
|
|
2766
2751
|
if (BUILD14.reflect && cmpMeta.$attrsToReflect$) {
|
|
2767
2752
|
rootVnode.$attrs$ = rootVnode.$attrs$ || {};
|
|
2768
|
-
cmpMeta.$attrsToReflect$.
|
|
2769
|
-
(
|
|
2770
|
-
|
|
2753
|
+
cmpMeta.$attrsToReflect$.forEach(([propName, attribute]) => {
|
|
2754
|
+
if (BUILD14.serializer && hostRef.$serializerValues$.has(propName)) {
|
|
2755
|
+
rootVnode.$attrs$[attribute] = hostRef.$serializerValues$.get(propName);
|
|
2756
|
+
} else {
|
|
2757
|
+
rootVnode.$attrs$[attribute] = hostElm[propName];
|
|
2758
|
+
}
|
|
2759
|
+
});
|
|
2771
2760
|
}
|
|
2772
2761
|
if (isInitialLoad && rootVnode.$attrs$) {
|
|
2773
2762
|
for (const key of Object.keys(rootVnode.$attrs$)) {
|
|
@@ -2922,11 +2911,16 @@ var dispatchHooks = (hostRef, isInitialLoad) => {
|
|
|
2922
2911
|
}
|
|
2923
2912
|
let maybePromise;
|
|
2924
2913
|
if (isInitialLoad) {
|
|
2925
|
-
if (BUILD15.lazyLoad
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
hostRef.$queuedListeners
|
|
2929
|
-
|
|
2914
|
+
if (BUILD15.lazyLoad) {
|
|
2915
|
+
if (BUILD15.hostListener) {
|
|
2916
|
+
hostRef.$flags$ |= 256 /* isListenReady */;
|
|
2917
|
+
if (hostRef.$queuedListeners$) {
|
|
2918
|
+
hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event, elm));
|
|
2919
|
+
hostRef.$queuedListeners$ = void 0;
|
|
2920
|
+
}
|
|
2921
|
+
}
|
|
2922
|
+
if (hostRef.$fetchedCbList$.length) {
|
|
2923
|
+
hostRef.$fetchedCbList$.forEach((cb) => cb(elm));
|
|
2930
2924
|
}
|
|
2931
2925
|
}
|
|
2932
2926
|
emitLifecycleEvent(elm, "componentWillLoad");
|
|
@@ -3174,6 +3168,9 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
3174
3168
|
`Couldn't find host element for "${cmpMeta.$tagName$}" as it is unknown to this Stencil runtime. This usually happens when integrating a 3rd party Stencil component with another Stencil component or application. Please reach out to the maintainers of the 3rd party Stencil component or report this on the Stencil Discord server (https://chat.stenciljs.com) or comment on this similar [GitHub issue](https://github.com/stenciljs/core/issues/5457).`
|
|
3175
3169
|
);
|
|
3176
3170
|
}
|
|
3171
|
+
if (BUILD16.serializer && hostRef.$serializerValues$.has(propName) && hostRef.$serializerValues$.get(propName) === newVal) {
|
|
3172
|
+
return;
|
|
3173
|
+
}
|
|
3177
3174
|
const elm = BUILD16.lazyLoad ? hostRef.$hostElement$ : ref;
|
|
3178
3175
|
const oldVal = hostRef.$instanceValues$.get(propName);
|
|
3179
3176
|
const flags = hostRef.$flags$;
|
|
@@ -3187,6 +3184,15 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
3187
3184
|
const didValueChange = newVal !== oldVal && !areBothNaN;
|
|
3188
3185
|
if ((!BUILD16.lazyLoad || !(flags & 8 /* isConstructingInstance */) || oldVal === void 0) && didValueChange) {
|
|
3189
3186
|
hostRef.$instanceValues$.set(propName, newVal);
|
|
3187
|
+
if (BUILD16.serializer && BUILD16.reflect && cmpMeta.$attrsToReflect$) {
|
|
3188
|
+
if (instance && cmpMeta.$serializers$ && cmpMeta.$serializers$[propName]) {
|
|
3189
|
+
let attrVal = newVal;
|
|
3190
|
+
for (const methodName of cmpMeta.$serializers$[propName]) {
|
|
3191
|
+
attrVal = instance[methodName](attrVal, propName);
|
|
3192
|
+
}
|
|
3193
|
+
hostRef.$serializerValues$.set(propName, attrVal);
|
|
3194
|
+
}
|
|
3195
|
+
}
|
|
3190
3196
|
if (BUILD16.isDev) {
|
|
3191
3197
|
if (hostRef.$flags$ & 1024 /* devOnRender */) {
|
|
3192
3198
|
consoleDevWarn(
|
|
@@ -3211,7 +3217,7 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
3211
3217
|
}
|
|
3212
3218
|
}
|
|
3213
3219
|
if (!BUILD16.lazyLoad || instance) {
|
|
3214
|
-
if (BUILD16.
|
|
3220
|
+
if (BUILD16.propChangeCallback && cmpMeta.$watchers$ && flags & 128 /* isWatchReady */) {
|
|
3215
3221
|
const watchMethods = cmpMeta.$watchers$[propName];
|
|
3216
3222
|
if (watchMethods) {
|
|
3217
3223
|
watchMethods.map((watchMethodName) => {
|
|
@@ -3266,9 +3272,17 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
3266
3272
|
});
|
|
3267
3273
|
});
|
|
3268
3274
|
}
|
|
3269
|
-
if (BUILD17.member && cmpMeta.$members$ || BUILD17.
|
|
3270
|
-
if (BUILD17.
|
|
3271
|
-
cmpMeta.$watchers$
|
|
3275
|
+
if (BUILD17.member && cmpMeta.$members$ || BUILD17.propChangeCallback) {
|
|
3276
|
+
if (BUILD17.propChangeCallback) {
|
|
3277
|
+
if (Cstr.watchers && !cmpMeta.$watchers$) {
|
|
3278
|
+
cmpMeta.$watchers$ = Cstr.watchers;
|
|
3279
|
+
}
|
|
3280
|
+
if (Cstr.deserializers && !cmpMeta.$deserializers$) {
|
|
3281
|
+
cmpMeta.$deserializers$ = Cstr.deserializers;
|
|
3282
|
+
}
|
|
3283
|
+
if (Cstr.serializers && !cmpMeta.$serializers$) {
|
|
3284
|
+
cmpMeta.$serializers$ = Cstr.serializers;
|
|
3285
|
+
}
|
|
3272
3286
|
}
|
|
3273
3287
|
const members = Object.entries((_a = cmpMeta.$members$) != null ? _a : {});
|
|
3274
3288
|
members.map(([memberName, [memberFlags]]) => {
|
|
@@ -3321,8 +3335,6 @@ More information: https://stenciljs.com/docs/properties#prop-mutability`
|
|
|
3321
3335
|
const currentValue = memberFlags & 32 /* State */ ? this[memberName] : ref.$hostElement$[memberName];
|
|
3322
3336
|
if (typeof currentValue === "undefined" && ref.$instanceValues$.get(memberName)) {
|
|
3323
3337
|
newValue = ref.$instanceValues$.get(memberName);
|
|
3324
|
-
} else if (!ref.$instanceValues$.get(memberName) && currentValue) {
|
|
3325
|
-
ref.$instanceValues$.set(memberName, currentValue);
|
|
3326
3338
|
}
|
|
3327
3339
|
origSetter.apply(this, [
|
|
3328
3340
|
parsePropertyValue(
|
|
@@ -3343,7 +3355,7 @@ More information: https://stenciljs.com/docs/properties#prop-mutability`
|
|
|
3343
3355
|
if ((flags & 1 /* isElementConstructor */) === 0 || (cmpMeta.$members$[memberName][0] & 4096 /* Setter */) === 0) {
|
|
3344
3356
|
setValue(this, memberName, newValue, cmpMeta);
|
|
3345
3357
|
if (flags & 1 /* isElementConstructor */ && !ref.$lazyInstance$) {
|
|
3346
|
-
ref.$
|
|
3358
|
+
ref.$fetchedCbList$.push(() => {
|
|
3347
3359
|
if (cmpMeta.$members$[memberName][0] & 4096 /* Setter */ && ref.$lazyInstance$[memberName] !== ref.$instanceValues$.get(memberName)) {
|
|
3348
3360
|
ref.$lazyInstance$[memberName] = newValue;
|
|
3349
3361
|
}
|
|
@@ -3366,7 +3378,9 @@ More information: https://stenciljs.com/docs/properties#prop-mutability`
|
|
|
3366
3378
|
if (ref.$lazyInstance$) {
|
|
3367
3379
|
setterSetVal();
|
|
3368
3380
|
} else {
|
|
3369
|
-
ref.$
|
|
3381
|
+
ref.$fetchedCbList$.push(() => {
|
|
3382
|
+
setterSetVal();
|
|
3383
|
+
});
|
|
3370
3384
|
}
|
|
3371
3385
|
}
|
|
3372
3386
|
}
|
|
@@ -3390,14 +3404,39 @@ More information: https://stenciljs.com/docs/properties#prop-mutability`
|
|
|
3390
3404
|
plt.jmp(() => {
|
|
3391
3405
|
var _a2;
|
|
3392
3406
|
const propName = attrNameToPropName.get(attrName);
|
|
3407
|
+
const hostRef = getHostRef(this);
|
|
3408
|
+
if (BUILD17.serializer && hostRef.$serializerValues$.has(propName) && hostRef.$serializerValues$.get(propName) === newValue) {
|
|
3409
|
+
return;
|
|
3410
|
+
}
|
|
3393
3411
|
if (this.hasOwnProperty(propName) && BUILD17.lazyLoad) {
|
|
3394
3412
|
newValue = this[propName];
|
|
3395
3413
|
delete this[propName];
|
|
3414
|
+
}
|
|
3415
|
+
if (BUILD17.deserializer && cmpMeta.$deserializers$ && cmpMeta.$deserializers$[propName]) {
|
|
3416
|
+
const setVal = (methodName, instance) => {
|
|
3417
|
+
const deserializeVal = instance == null ? void 0 : instance[methodName](newValue, propName);
|
|
3418
|
+
if (deserializeVal !== this[propName]) {
|
|
3419
|
+
this[propName] = deserializeVal;
|
|
3420
|
+
}
|
|
3421
|
+
};
|
|
3422
|
+
for (const methodName of cmpMeta.$deserializers$[propName]) {
|
|
3423
|
+
if (BUILD17.lazyLoad) {
|
|
3424
|
+
if (hostRef.$lazyInstance$) {
|
|
3425
|
+
setVal(methodName, hostRef.$lazyInstance$);
|
|
3426
|
+
} else {
|
|
3427
|
+
hostRef.$fetchedCbList$.push(() => {
|
|
3428
|
+
setVal(methodName, hostRef.$lazyInstance$);
|
|
3429
|
+
});
|
|
3430
|
+
}
|
|
3431
|
+
} else {
|
|
3432
|
+
setVal(methodName, this);
|
|
3433
|
+
}
|
|
3434
|
+
}
|
|
3435
|
+
return;
|
|
3396
3436
|
} else if (prototype.hasOwnProperty(propName) && typeof this[propName] === "number" && // cast type to number to avoid TS compiler issues
|
|
3397
3437
|
this[propName] == newValue) {
|
|
3398
3438
|
return;
|
|
3399
3439
|
} else if (propName == null) {
|
|
3400
|
-
const hostRef = getHostRef(this);
|
|
3401
3440
|
const flags2 = hostRef == null ? void 0 : hostRef.$flags$;
|
|
3402
3441
|
if (hostRef && flags2 && !(flags2 & 8 /* isConstructingInstance */) && flags2 & 128 /* isWatchReady */ && newValue !== oldValue) {
|
|
3403
3442
|
const elm = BUILD17.lazyLoad ? hostRef.$hostElement$ : this;
|
|
@@ -3413,7 +3452,7 @@ More information: https://stenciljs.com/docs/properties#prop-mutability`
|
|
|
3413
3452
|
}
|
|
3414
3453
|
const propDesc = Object.getOwnPropertyDescriptor(prototype, propName);
|
|
3415
3454
|
newValue = newValue === null && typeof this[propName] === "boolean" ? false : newValue;
|
|
3416
|
-
if (newValue
|
|
3455
|
+
if (newValue != this[propName] && (!propDesc.get || !!propDesc.set)) {
|
|
3417
3456
|
this[propName] = newValue;
|
|
3418
3457
|
}
|
|
3419
3458
|
});
|
|
@@ -3459,8 +3498,10 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
|
3459
3498
|
throw new Error(`Constructor for "${cmpMeta.$tagName$}#${hostRef.$modeName$}" was not found`);
|
|
3460
3499
|
}
|
|
3461
3500
|
if (BUILD18.member && !Cstr.isProxied) {
|
|
3462
|
-
if (BUILD18.
|
|
3501
|
+
if (BUILD18.propChangeCallback) {
|
|
3463
3502
|
cmpMeta.$watchers$ = Cstr.watchers;
|
|
3503
|
+
cmpMeta.$serializers$ = Cstr.serializers;
|
|
3504
|
+
cmpMeta.$deserializers$ = Cstr.deserializers;
|
|
3464
3505
|
}
|
|
3465
3506
|
proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
|
|
3466
3507
|
Cstr.isProxied = true;
|
|
@@ -3477,7 +3518,7 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
|
3477
3518
|
if (BUILD18.member) {
|
|
3478
3519
|
hostRef.$flags$ &= ~8 /* isConstructingInstance */;
|
|
3479
3520
|
}
|
|
3480
|
-
if (BUILD18.
|
|
3521
|
+
if (BUILD18.propChangeCallback) {
|
|
3481
3522
|
hostRef.$flags$ |= 128 /* isWatchReady */;
|
|
3482
3523
|
}
|
|
3483
3524
|
endNewInstance();
|
|
@@ -3574,7 +3615,7 @@ var connectedCallback = (elm) => {
|
|
|
3574
3615
|
}
|
|
3575
3616
|
if (BUILD19.prop && !BUILD19.hydrateServerSide && cmpMeta.$members$) {
|
|
3576
3617
|
Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
|
|
3577
|
-
if (memberFlags & 31 /* Prop */ && elm.
|
|
3618
|
+
if (memberFlags & 31 /* Prop */ && memberName in elm && elm[memberName] !== Object.prototype[memberName]) {
|
|
3578
3619
|
const value = elm[memberName];
|
|
3579
3620
|
delete elm[memberName];
|
|
3580
3621
|
elm[memberName] = value;
|
|
@@ -3655,8 +3696,10 @@ var proxyCustomElement = (Cstr, compactMeta) => {
|
|
|
3655
3696
|
if (BUILD21.hostListener) {
|
|
3656
3697
|
cmpMeta.$listeners$ = compactMeta[3];
|
|
3657
3698
|
}
|
|
3658
|
-
if (BUILD21.
|
|
3699
|
+
if (BUILD21.propChangeCallback) {
|
|
3659
3700
|
cmpMeta.$watchers$ = Cstr.$watchers$;
|
|
3701
|
+
cmpMeta.$deserializers$ = Cstr.$deserializers$;
|
|
3702
|
+
cmpMeta.$serializers$ = Cstr.$serializers$;
|
|
3660
3703
|
}
|
|
3661
3704
|
if (BUILD21.reflect) {
|
|
3662
3705
|
cmpMeta.$attrsToReflect$ = [];
|
|
@@ -3804,7 +3847,7 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
3804
3847
|
let hasSlotRelocation = false;
|
|
3805
3848
|
lazyBundles.map((lazyBundle) => {
|
|
3806
3849
|
lazyBundle[1].map((compactMeta) => {
|
|
3807
|
-
var _a2;
|
|
3850
|
+
var _a2, _b, _c;
|
|
3808
3851
|
const cmpMeta = {
|
|
3809
3852
|
$flags$: compactMeta[0],
|
|
3810
3853
|
$tagName$: compactMeta[1],
|
|
@@ -3823,8 +3866,10 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
3823
3866
|
if (BUILD22.reflect) {
|
|
3824
3867
|
cmpMeta.$attrsToReflect$ = [];
|
|
3825
3868
|
}
|
|
3826
|
-
if (BUILD22.
|
|
3869
|
+
if (BUILD22.propChangeCallback) {
|
|
3827
3870
|
cmpMeta.$watchers$ = (_a2 = compactMeta[4]) != null ? _a2 : {};
|
|
3871
|
+
cmpMeta.$serializers$ = (_b = compactMeta[5]) != null ? _b : {};
|
|
3872
|
+
cmpMeta.$deserializers$ = (_c = compactMeta[6]) != null ? _c : {};
|
|
3828
3873
|
}
|
|
3829
3874
|
if (BUILD22.shadowDom && !supportsShadow && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
|
|
3830
3875
|
cmpMeta.$flags$ |= 8 /* needsShadowDomShim */;
|
|
@@ -4198,6 +4243,9 @@ import { globalScripts } from "@stencil/core/internal/app-globals";
|
|
|
4198
4243
|
// src/hydrate/platform/proxy-host-element.ts
|
|
4199
4244
|
function proxyHostElement(elm, cstr) {
|
|
4200
4245
|
const cmpMeta = cstr.cmpMeta;
|
|
4246
|
+
cmpMeta.$watchers$ = cmpMeta.$watchers$ || cstr.watchers;
|
|
4247
|
+
cmpMeta.$deserializers$ = cmpMeta.$deserializers$ || cstr.deserializers;
|
|
4248
|
+
cmpMeta.$serializers$ = cmpMeta.$serializers$ || cstr.serializers;
|
|
4201
4249
|
if (typeof elm.componentOnReady !== "function") {
|
|
4202
4250
|
elm.componentOnReady = componentOnReady;
|
|
4203
4251
|
}
|
|
@@ -4211,7 +4259,7 @@ function proxyHostElement(elm, cstr) {
|
|
|
4211
4259
|
const hostRef = getHostRef(elm);
|
|
4212
4260
|
const members = Object.entries(cmpMeta.$members$);
|
|
4213
4261
|
members.forEach(([memberName, [memberFlags, metaAttributeName]]) => {
|
|
4214
|
-
var _a;
|
|
4262
|
+
var _a, _b;
|
|
4215
4263
|
if (memberFlags & 31 /* Prop */) {
|
|
4216
4264
|
const attributeName = metaAttributeName || memberName;
|
|
4217
4265
|
const attrValue = elm.getAttribute(attributeName);
|
|
@@ -4219,7 +4267,13 @@ function proxyHostElement(elm, cstr) {
|
|
|
4219
4267
|
let attrPropVal;
|
|
4220
4268
|
const { get: origGetter, set: origSetter } = Object.getOwnPropertyDescriptor(cstr.prototype, memberName) || {};
|
|
4221
4269
|
if (attrValue != null) {
|
|
4222
|
-
|
|
4270
|
+
if ((_a = cmpMeta.$deserializers$) == null ? void 0 : _a[memberName]) {
|
|
4271
|
+
for (const methodName of cmpMeta.$deserializers$[memberName]) {
|
|
4272
|
+
attrPropVal = cstr.prototype[methodName](attrValue, memberName);
|
|
4273
|
+
}
|
|
4274
|
+
} else {
|
|
4275
|
+
attrPropVal = parsePropertyValue(attrValue, memberFlags, !!(cmpMeta.$flags$ & 64 /* formAssociated */));
|
|
4276
|
+
}
|
|
4223
4277
|
}
|
|
4224
4278
|
if (propValue !== void 0) {
|
|
4225
4279
|
attrPropVal = propValue;
|
|
@@ -4230,7 +4284,7 @@ function proxyHostElement(elm, cstr) {
|
|
|
4230
4284
|
origSetter.apply(elm, [attrPropVal]);
|
|
4231
4285
|
attrPropVal = origGetter ? origGetter.apply(elm) : attrPropVal;
|
|
4232
4286
|
}
|
|
4233
|
-
(
|
|
4287
|
+
(_b = hostRef == null ? void 0 : hostRef.$instanceValues$) == null ? void 0 : _b.set(memberName, attrPropVal);
|
|
4234
4288
|
}
|
|
4235
4289
|
const getterSetterDescriptor = {
|
|
4236
4290
|
get: function() {
|
|
@@ -4244,21 +4298,18 @@ function proxyHostElement(elm, cstr) {
|
|
|
4244
4298
|
};
|
|
4245
4299
|
Object.defineProperty(elm, memberName, getterSetterDescriptor);
|
|
4246
4300
|
Object.defineProperty(elm, metaAttributeName, getterSetterDescriptor);
|
|
4247
|
-
|
|
4248
|
-
|
|
4249
|
-
|
|
4250
|
-
|
|
4251
|
-
|
|
4252
|
-
|
|
4253
|
-
|
|
4254
|
-
|
|
4255
|
-
|
|
4256
|
-
|
|
4257
|
-
|
|
4258
|
-
|
|
4259
|
-
enumerable: true
|
|
4260
|
-
});
|
|
4261
|
-
}
|
|
4301
|
+
hostRef.$fetchedCbList$.push(() => {
|
|
4302
|
+
var _a2;
|
|
4303
|
+
if (!((_a2 = hostRef == null ? void 0 : hostRef.$instanceValues$) == null ? void 0 : _a2.has(memberName))) {
|
|
4304
|
+
setValue(
|
|
4305
|
+
elm,
|
|
4306
|
+
memberName,
|
|
4307
|
+
attrPropVal !== void 0 ? attrPropVal : hostRef.$lazyInstance$[memberName],
|
|
4308
|
+
cmpMeta
|
|
4309
|
+
);
|
|
4310
|
+
}
|
|
4311
|
+
Object.defineProperty(hostRef.$lazyInstance$, memberName, getterSetterDescriptor);
|
|
4312
|
+
});
|
|
4262
4313
|
} else if (memberFlags & 64 /* Method */) {
|
|
4263
4314
|
Object.defineProperty(elm, memberName, {
|
|
4264
4315
|
value(...args) {
|
|
@@ -4274,7 +4325,6 @@ function proxyHostElement(elm, cstr) {
|
|
|
4274
4325
|
});
|
|
4275
4326
|
}
|
|
4276
4327
|
});
|
|
4277
|
-
cstr.prototype.__stencilAugmented = true;
|
|
4278
4328
|
}
|
|
4279
4329
|
}
|
|
4280
4330
|
function componentOnReady() {
|
|
@@ -4675,8 +4725,10 @@ var registerHost = (elm, cmpMeta) => {
|
|
|
4675
4725
|
$cmpMeta$: cmpMeta,
|
|
4676
4726
|
$hostElement$: elm,
|
|
4677
4727
|
$instanceValues$: /* @__PURE__ */ new Map(),
|
|
4728
|
+
$serializerValues$: /* @__PURE__ */ new Map(),
|
|
4678
4729
|
$renderCount$: 0
|
|
4679
4730
|
};
|
|
4731
|
+
hostRef.$fetchedCbList$ = [];
|
|
4680
4732
|
hostRef.$onInstancePromise$ = new Promise((r) => hostRef.$onInstanceResolve$ = r);
|
|
4681
4733
|
hostRef.$onReadyPromise$ = new Promise((r) => hostRef.$onReadyResolve$ = r);
|
|
4682
4734
|
elm["s-p"] = [];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stencil/core/internal/hydrate",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.38.0",
|
|
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
|
|
@@ -7,12 +7,14 @@ export declare function createWindowFromHtml(templateHtml: string, uniqueId: str
|
|
|
7
7
|
* Serialize a value to a string that can be deserialized later.
|
|
8
8
|
* @param {unknown} value - The value to serialize.
|
|
9
9
|
* @returns {string} A string that can be deserialized later.
|
|
10
|
+
* @deprecated will be removed in v5. Use `@PropSerialize()` decorator instead.
|
|
10
11
|
*/
|
|
11
12
|
export declare function serializeProperty(value: unknown): string | number | boolean;
|
|
12
13
|
/**
|
|
13
14
|
* Deserialize a value from a string that was serialized earlier.
|
|
14
15
|
* @param {string} value - The string to deserialize.
|
|
15
16
|
* @returns {unknown} The deserialized value.
|
|
17
|
+
* @deprecated will be removed in v5. Use `@AttrDeserialize()` decorator instead.
|
|
16
18
|
*/
|
|
17
19
|
export declare function deserializeProperty(value: string): any;
|
|
18
20
|
export type ResolutionHandler = (elm: HTMLElement) => string | undefined | null;
|
package/internal/package.json
CHANGED
|
@@ -90,20 +90,22 @@ export interface BuildFeatures {
|
|
|
90
90
|
hostListenerTarget: boolean;
|
|
91
91
|
method: boolean;
|
|
92
92
|
prop: boolean;
|
|
93
|
+
propChangeCallback: boolean;
|
|
93
94
|
propMutable: boolean;
|
|
94
95
|
state: boolean;
|
|
95
|
-
watchCallback: boolean;
|
|
96
96
|
member: boolean;
|
|
97
97
|
updatable: boolean;
|
|
98
98
|
propBoolean: boolean;
|
|
99
99
|
propNumber: boolean;
|
|
100
100
|
propString: boolean;
|
|
101
|
-
|
|
101
|
+
serializer: boolean;
|
|
102
|
+
deserializer: boolean;
|
|
102
103
|
lifecycle: boolean;
|
|
103
104
|
asyncLoading: boolean;
|
|
104
105
|
observeAttribute: boolean;
|
|
105
106
|
reflect: boolean;
|
|
106
107
|
taskQueue: boolean;
|
|
108
|
+
modernPropertyDecls: boolean;
|
|
107
109
|
}
|
|
108
110
|
export interface BuildConditionals extends Partial<BuildFeatures> {
|
|
109
111
|
hotModuleReplacement?: boolean;
|
|
@@ -442,6 +444,7 @@ export interface ComponentCompilerFeatures {
|
|
|
442
444
|
hasComponentWillRenderFn: boolean;
|
|
443
445
|
hasComponentDidRenderFn: boolean;
|
|
444
446
|
hasConnectedCallbackFn: boolean;
|
|
447
|
+
hasDeserializer: boolean;
|
|
445
448
|
hasDisconnectedCallbackFn: boolean;
|
|
446
449
|
hasElement: boolean;
|
|
447
450
|
hasEvent: boolean;
|
|
@@ -466,6 +469,7 @@ export interface ComponentCompilerFeatures {
|
|
|
466
469
|
hasPropMutable: boolean;
|
|
467
470
|
hasReflect: boolean;
|
|
468
471
|
hasRenderFn: boolean;
|
|
472
|
+
hasSerializer: boolean;
|
|
469
473
|
hasState: boolean;
|
|
470
474
|
hasStyle: boolean;
|
|
471
475
|
hasVdomAttribute: boolean;
|
|
@@ -523,6 +527,7 @@ export interface ComponentCompilerMeta extends ComponentCompilerFeatures {
|
|
|
523
527
|
* - indirectly/transitively reference the current component directly in their JSX/h() function
|
|
524
528
|
*/
|
|
525
529
|
dependents: string[];
|
|
530
|
+
deserializers: ComponentCompilerChangeHandler[];
|
|
526
531
|
/**
|
|
527
532
|
* A list of web component tag names that are directly referenced in a Stencil component's JSX/h() function
|
|
528
533
|
*/
|
|
@@ -547,6 +552,7 @@ export interface ComponentCompilerMeta extends ComponentCompilerFeatures {
|
|
|
547
552
|
listeners: ComponentCompilerListener[];
|
|
548
553
|
methods: ComponentCompilerMethod[];
|
|
549
554
|
properties: ComponentCompilerProperty[];
|
|
555
|
+
serializers: ComponentCompilerChangeHandler[];
|
|
550
556
|
shadowDelegatesFocus: boolean;
|
|
551
557
|
sourceFilePath: string;
|
|
552
558
|
sourceMapPath: string;
|
|
@@ -555,7 +561,7 @@ export interface ComponentCompilerMeta extends ComponentCompilerFeatures {
|
|
|
555
561
|
styles: StyleCompiler[];
|
|
556
562
|
tagName: string;
|
|
557
563
|
virtualProperties: ComponentCompilerVirtualProperty[];
|
|
558
|
-
watchers:
|
|
564
|
+
watchers: ComponentCompilerChangeHandler[];
|
|
559
565
|
}
|
|
560
566
|
/**
|
|
561
567
|
* The supported style encapsulation modes on a Stencil component:
|
|
@@ -698,7 +704,7 @@ export interface ComponentCompilerMethodComplexType {
|
|
|
698
704
|
references: ComponentCompilerTypeReferences;
|
|
699
705
|
return: string;
|
|
700
706
|
}
|
|
701
|
-
export interface
|
|
707
|
+
export interface ComponentCompilerChangeHandler {
|
|
702
708
|
propName: string;
|
|
703
709
|
methodName: string;
|
|
704
710
|
}
|
|
@@ -774,7 +780,7 @@ export interface ComponentCompilerData {
|
|
|
774
780
|
export interface ComponentConstructor {
|
|
775
781
|
is?: string;
|
|
776
782
|
properties?: ComponentConstructorProperties;
|
|
777
|
-
watchers?:
|
|
783
|
+
watchers?: ComponentConstructorChangeHandlers;
|
|
778
784
|
events?: ComponentConstructorEvent[];
|
|
779
785
|
listeners?: ComponentConstructorListener[];
|
|
780
786
|
style?: string;
|
|
@@ -784,12 +790,14 @@ export interface ComponentConstructor {
|
|
|
784
790
|
cmpMeta?: ComponentRuntimeMeta;
|
|
785
791
|
isProxied?: boolean;
|
|
786
792
|
isStyleRegistered?: boolean;
|
|
793
|
+
serializers?: ComponentConstructorChangeHandlers;
|
|
794
|
+
deserializers?: ComponentConstructorChangeHandlers;
|
|
787
795
|
}
|
|
788
796
|
/**
|
|
789
797
|
* A mapping from class member names to a list of methods which are watching
|
|
790
798
|
* them.
|
|
791
799
|
*/
|
|
792
|
-
export interface
|
|
800
|
+
export interface ComponentConstructorChangeHandlers {
|
|
793
801
|
[propName: string]: string[];
|
|
794
802
|
}
|
|
795
803
|
export interface ComponentTestingConstructor extends ComponentConstructor {
|
|
@@ -1412,7 +1420,11 @@ export type ComponentRuntimeMetaCompact = [
|
|
|
1412
1420
|
/** listeners */
|
|
1413
1421
|
ComponentRuntimeHostListener[]?,
|
|
1414
1422
|
/** watchers */
|
|
1415
|
-
|
|
1423
|
+
ComponentConstructorChangeHandlers?,
|
|
1424
|
+
/** serializers */
|
|
1425
|
+
ComponentConstructorChangeHandlers?,
|
|
1426
|
+
/** deserializers */
|
|
1427
|
+
ComponentConstructorChangeHandlers?
|
|
1416
1428
|
];
|
|
1417
1429
|
/**
|
|
1418
1430
|
* Runtime metadata for a Stencil component
|
|
@@ -1447,11 +1459,19 @@ export interface ComponentRuntimeMeta {
|
|
|
1447
1459
|
/**
|
|
1448
1460
|
* Information about which class members have watchers attached on the component.
|
|
1449
1461
|
*/
|
|
1450
|
-
$watchers$?:
|
|
1462
|
+
$watchers$?: ComponentConstructorChangeHandlers;
|
|
1451
1463
|
/**
|
|
1452
1464
|
* A bundle ID used for lazy loading.
|
|
1453
1465
|
*/
|
|
1454
1466
|
$lazyBundleId$?: string;
|
|
1467
|
+
/**
|
|
1468
|
+
* Information about which class members have prop > attribute serializers attached on the component.
|
|
1469
|
+
*/
|
|
1470
|
+
$serializers$?: ComponentConstructorChangeHandlers;
|
|
1471
|
+
/**
|
|
1472
|
+
* Information about which class members have attribute > prop deserializers attached on the component.
|
|
1473
|
+
*/
|
|
1474
|
+
$deserializers$?: ComponentConstructorChangeHandlers;
|
|
1455
1475
|
}
|
|
1456
1476
|
/**
|
|
1457
1477
|
* A mapping of the names of members on the component to some runtime-specific
|
|
@@ -1508,7 +1528,12 @@ export interface HostRef {
|
|
|
1508
1528
|
$cmpMeta$: ComponentRuntimeMeta;
|
|
1509
1529
|
$hostElement$: HostElement;
|
|
1510
1530
|
$instanceValues$?: Map<string, any>;
|
|
1531
|
+
$serializerValues$?: Map<string, string>;
|
|
1511
1532
|
$lazyInstance$?: ComponentInterface;
|
|
1533
|
+
/**
|
|
1534
|
+
* A list of callback functions called immediately after a lazy component module has been fetched.
|
|
1535
|
+
*/
|
|
1536
|
+
$fetchedCbList$?: ((elm: HostElement) => void)[];
|
|
1512
1537
|
/**
|
|
1513
1538
|
* A promise that gets resolved if `BUILD.asyncLoading` is enabled and after the `componentDidLoad`
|
|
1514
1539
|
* and before the `componentDidUpdate` lifecycle events are triggered.
|
|
@@ -138,6 +138,11 @@ export interface StencilConfig {
|
|
|
138
138
|
* This behavior defaults to `true`, but may be opted-out of by setting this flag to `false`.
|
|
139
139
|
*/
|
|
140
140
|
transformAliasedImportPaths?: boolean;
|
|
141
|
+
/**
|
|
142
|
+
* When `true`, Stencil will suppress diagnostics which warn about public members using reserved names
|
|
143
|
+
* (for example, decorating a method named `focus` with `@Method()`). Defaults to `false`.
|
|
144
|
+
*/
|
|
145
|
+
suppressReservedPublicNameWarnings?: boolean;
|
|
141
146
|
/**
|
|
142
147
|
* When `true`, we will validate a project's `package.json` based on the output target the user has designated
|
|
143
148
|
* as `isPrimaryPackageOutputTarget: true` in their Stencil config.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
type CustomMethodDecorator<T> = (target: object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T> | void;
|
|
2
2
|
type UnionToIntersection<U> = (U extends any ? (x: U) => void : never) extends (x: infer I) => void ? I : never;
|
|
3
3
|
export interface ComponentDecorator {
|
|
4
4
|
(opts?: ComponentOptions): ClassDecorator;
|
|
@@ -152,7 +152,13 @@ export interface StateDecorator {
|
|
|
152
152
|
(): PropertyDecorator;
|
|
153
153
|
}
|
|
154
154
|
export interface WatchDecorator {
|
|
155
|
-
(propName:
|
|
155
|
+
(propName: any): CustomMethodDecorator<(newValue?: any, oldValue?: any, propName?: any, ...args: any[]) => any | void>;
|
|
156
|
+
}
|
|
157
|
+
export interface PropSerializeDecorator {
|
|
158
|
+
(propName: any): CustomMethodDecorator<(newValue?: any, propName?: string, ...args: any[]) => string | null>;
|
|
159
|
+
}
|
|
160
|
+
export interface AttrDeserializeDecorator {
|
|
161
|
+
(propName: any): CustomMethodDecorator<(newValue?: any, propName?: string, ...args: any[]) => any>;
|
|
156
162
|
}
|
|
157
163
|
export interface UserBuildConditionals {
|
|
158
164
|
isDev: boolean;
|
|
@@ -234,6 +240,14 @@ export declare const State: StateDecorator;
|
|
|
234
240
|
* https://stenciljs.com/docs/reactive-data#watch-decorator
|
|
235
241
|
*/
|
|
236
242
|
export declare const Watch: WatchDecorator;
|
|
243
|
+
/**
|
|
244
|
+
* Decorator to serialize a property to an attribute string.
|
|
245
|
+
*/
|
|
246
|
+
export declare const PropSerialize: PropSerializeDecorator;
|
|
247
|
+
/**
|
|
248
|
+
* Decorator to deserialize an attribute string to a property.
|
|
249
|
+
*/
|
|
250
|
+
export declare const AttrDeserialize: AttrDeserializeDecorator;
|
|
237
251
|
export type ResolutionHandler = (elm: HTMLElement) => string | undefined | null;
|
|
238
252
|
export type ErrorHandler = (err: any, element?: HTMLElement) => void;
|
|
239
253
|
/**
|