@tarojs/components 3.3.12 → 3.3.13
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/cjs/{index-eefce54e.js → index-7464647f.js} +156 -101
- package/dist/cjs/{index-cf56824f.js → index-cde74e58.js} +1 -1
- package/dist/cjs/loader.cjs.js +3 -3
- package/dist/cjs/taro-audio-core.cjs.entry.js +2 -2
- package/dist/cjs/taro-block-core.cjs.entry.js +2 -2
- package/dist/cjs/taro-button-core.cjs.entry.js +3 -3
- package/dist/cjs/taro-camera-core.cjs.entry.js +2 -2
- package/dist/cjs/taro-canvas-core.cjs.entry.js +2 -2
- package/dist/cjs/taro-checkbox-core_2.cjs.entry.js +6 -5
- package/dist/cjs/taro-components.cjs.js +5 -5
- package/dist/cjs/taro-cover-image-core.cjs.entry.js +2 -2
- package/dist/cjs/taro-cover-view-core.cjs.entry.js +2 -2
- package/dist/cjs/taro-custom-wrapper-core.cjs.entry.js +2 -2
- package/dist/cjs/taro-form-core.cjs.entry.js +2 -2
- package/dist/cjs/taro-icon-core.cjs.entry.js +3 -3
- package/dist/cjs/taro-image-core.cjs.entry.js +3 -3
- package/dist/cjs/taro-input-core.cjs.entry.js +18 -10
- package/dist/cjs/taro-label-core.cjs.entry.js +2 -2
- package/dist/cjs/taro-movable-area-core.cjs.entry.js +2 -2
- package/dist/cjs/taro-movable-view-core.cjs.entry.js +2 -2
- package/dist/cjs/taro-navigator-core.cjs.entry.js +3 -3
- package/dist/cjs/taro-open-data-core.cjs.entry.js +2 -2
- package/dist/cjs/taro-picker-core_2.cjs.entry.js +4 -4
- package/dist/cjs/taro-picker-view-column-core.cjs.entry.js +2 -2
- package/dist/cjs/taro-picker-view-core.cjs.entry.js +2 -2
- package/dist/cjs/taro-progress-core.cjs.entry.js +2 -2
- package/dist/cjs/taro-pull-to-refresh.cjs.entry.js +3 -3
- package/dist/cjs/taro-radio-core_2.cjs.entry.js +3 -3
- package/dist/cjs/taro-rich-text-core.cjs.entry.js +2 -2
- package/dist/cjs/taro-scroll-view-core.cjs.entry.js +3 -3
- package/dist/cjs/taro-slider-core.cjs.entry.js +2 -2
- package/dist/cjs/taro-swiper-core_2.cjs.entry.js +112 -106
- package/dist/cjs/taro-switch-core.cjs.entry.js +2 -2
- package/dist/cjs/taro-tabbar.cjs.entry.js +3 -3
- package/dist/cjs/taro-text-core.cjs.entry.js +3 -3
- package/dist/cjs/taro-textarea-core.cjs.entry.js +2 -2
- package/dist/cjs/taro-video-control_3.cjs.entry.js +5 -5
- package/dist/cjs/taro-view-core.cjs.entry.js +11 -3
- package/dist/cjs/taro-web-view-core.cjs.entry.js +2 -2
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/components/checkbox/checkbox.js +21 -2
- package/dist/collection/components/input/input.js +16 -8
- package/dist/collection/components/swiper/swiper.js +7 -1
- package/dist/collection/components/view/view.js +9 -1
- package/dist/esm/{index-310de3d5.js → index-165a6222.js} +156 -101
- package/dist/esm/{index-ff1b322a.js → index-85e10859.js} +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/taro-audio-core.entry.js +2 -2
- package/dist/esm/taro-block-core.entry.js +2 -2
- package/dist/esm/taro-button-core.entry.js +3 -3
- package/dist/esm/taro-camera-core.entry.js +2 -2
- package/dist/esm/taro-canvas-core.entry.js +2 -2
- package/dist/esm/taro-checkbox-core_2.entry.js +6 -5
- package/dist/esm/taro-components.js +5 -5
- package/dist/esm/taro-cover-image-core.entry.js +2 -2
- package/dist/esm/taro-cover-view-core.entry.js +2 -2
- package/dist/esm/taro-custom-wrapper-core.entry.js +2 -2
- package/dist/esm/taro-form-core.entry.js +2 -2
- package/dist/esm/taro-icon-core.entry.js +3 -3
- package/dist/esm/taro-image-core.entry.js +3 -3
- package/dist/esm/taro-input-core.entry.js +18 -10
- package/dist/esm/taro-label-core.entry.js +2 -2
- package/dist/esm/taro-movable-area-core.entry.js +2 -2
- package/dist/esm/taro-movable-view-core.entry.js +2 -2
- package/dist/esm/taro-navigator-core.entry.js +3 -3
- package/dist/esm/taro-open-data-core.entry.js +2 -2
- package/dist/esm/taro-picker-core_2.entry.js +4 -4
- package/dist/esm/taro-picker-view-column-core.entry.js +2 -2
- package/dist/esm/taro-picker-view-core.entry.js +2 -2
- package/dist/esm/taro-progress-core.entry.js +2 -2
- package/dist/esm/taro-pull-to-refresh.entry.js +3 -3
- package/dist/esm/taro-radio-core_2.entry.js +3 -3
- package/dist/esm/taro-rich-text-core.entry.js +2 -2
- package/dist/esm/taro-scroll-view-core.entry.js +3 -3
- package/dist/esm/taro-slider-core.entry.js +2 -2
- package/dist/esm/taro-swiper-core_2.entry.js +112 -106
- package/dist/esm/taro-switch-core.entry.js +2 -2
- package/dist/esm/taro-tabbar.entry.js +3 -3
- package/dist/esm/taro-text-core.entry.js +3 -3
- package/dist/esm/taro-textarea-core.entry.js +2 -2
- package/dist/esm/taro-video-control_3.entry.js +5 -5
- package/dist/esm/taro-view-core.entry.js +11 -3
- package/dist/esm/taro-web-view-core.entry.js +2 -2
- package/dist/esm-es5/index-165a6222.js +1 -0
- package/dist/esm-es5/{index-ff1b322a.js → index-85e10859.js} +0 -0
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/taro-audio-core.entry.js +1 -1
- package/dist/esm-es5/taro-block-core.entry.js +1 -1
- package/dist/esm-es5/taro-button-core.entry.js +1 -1
- package/dist/esm-es5/taro-camera-core.entry.js +1 -1
- package/dist/esm-es5/taro-canvas-core.entry.js +1 -1
- package/dist/esm-es5/taro-checkbox-core_2.entry.js +1 -1
- package/dist/esm-es5/taro-components.js +1 -1
- package/dist/esm-es5/taro-cover-image-core.entry.js +1 -1
- package/dist/esm-es5/taro-cover-view-core.entry.js +1 -1
- package/dist/esm-es5/taro-custom-wrapper-core.entry.js +1 -1
- package/dist/esm-es5/taro-form-core.entry.js +1 -1
- package/dist/esm-es5/taro-icon-core.entry.js +1 -1
- package/dist/esm-es5/taro-image-core.entry.js +1 -1
- package/dist/esm-es5/taro-input-core.entry.js +1 -1
- package/dist/esm-es5/taro-label-core.entry.js +1 -1
- package/dist/esm-es5/taro-movable-area-core.entry.js +1 -1
- package/dist/esm-es5/taro-movable-view-core.entry.js +1 -1
- package/dist/esm-es5/taro-navigator-core.entry.js +1 -1
- package/dist/esm-es5/taro-open-data-core.entry.js +1 -1
- package/dist/esm-es5/taro-picker-core_2.entry.js +1 -1
- package/dist/esm-es5/taro-picker-view-column-core.entry.js +1 -1
- package/dist/esm-es5/taro-picker-view-core.entry.js +1 -1
- package/dist/esm-es5/taro-progress-core.entry.js +1 -1
- package/dist/esm-es5/taro-pull-to-refresh.entry.js +1 -1
- package/dist/esm-es5/taro-radio-core_2.entry.js +1 -1
- package/dist/esm-es5/taro-rich-text-core.entry.js +1 -1
- package/dist/esm-es5/taro-scroll-view-core.entry.js +1 -1
- package/dist/esm-es5/taro-slider-core.entry.js +1 -1
- package/dist/esm-es5/taro-swiper-core_2.entry.js +1 -1
- package/dist/esm-es5/taro-switch-core.entry.js +1 -1
- package/dist/esm-es5/taro-tabbar.entry.js +1 -1
- package/dist/esm-es5/taro-text-core.entry.js +1 -1
- package/dist/esm-es5/taro-textarea-core.entry.js +1 -1
- package/dist/esm-es5/taro-video-control_3.entry.js +1 -1
- package/dist/esm-es5/taro-view-core.entry.js +1 -1
- package/dist/esm-es5/taro-web-view-core.entry.js +1 -1
- package/dist/taro-components/{p-8eb84de2.system.entry.js → p-00328ebf.system.entry.js} +1 -1
- package/dist/taro-components/p-016f56cc.system.entry.js +1 -0
- package/dist/taro-components/{p-15121391.system.entry.js → p-098f4931.system.entry.js} +1 -1
- package/dist/taro-components/p-0da88b1b.entry.js +1 -0
- package/dist/taro-components/p-0fb7f599.entry.js +1 -0
- package/dist/taro-components/p-1507bcbf.entry.js +1 -0
- package/dist/taro-components/p-17c0731f.entry.js +1 -0
- package/dist/taro-components/{p-9a4123eb.system.entry.js → p-1ed219a6.system.entry.js} +1 -1
- package/dist/taro-components/p-26c08f44.entry.js +1 -0
- package/dist/taro-components/{p-502841e0.system.entry.js → p-26d8c60a.system.entry.js} +1 -1
- package/dist/taro-components/{p-970ed6da.system.entry.js → p-2b6a2449.system.entry.js} +1 -1
- package/dist/taro-components/p-2c5d57af.entry.js +1 -0
- package/dist/taro-components/{p-239bf0ca.system.entry.js → p-2ce9bc65.system.entry.js} +1 -1
- package/dist/taro-components/{p-1f2dfaef.system.entry.js → p-2de1a146.system.entry.js} +1 -1
- package/dist/taro-components/{p-a079321f.system.entry.js → p-2eda9121.system.entry.js} +1 -1
- package/dist/taro-components/p-2ef4681b.system.entry.js +1 -0
- package/dist/taro-components/p-30bfacb9.system.js +1 -0
- package/dist/taro-components/{p-921a765a.system.entry.js → p-321aeeec.system.entry.js} +1 -1
- package/dist/taro-components/p-3554df41.entry.js +1 -0
- package/dist/taro-components/p-37cfef64.entry.js +1 -0
- package/dist/taro-components/{p-7911ccd6.system.entry.js → p-382cabbc.system.entry.js} +1 -1
- package/dist/taro-components/p-3e2d4793.entry.js +1 -0
- package/dist/taro-components/{p-e15654c4.system.entry.js → p-4168e24d.system.entry.js} +1 -1
- package/dist/taro-components/{p-236774f0.system.entry.js → p-4462dca4.system.entry.js} +1 -1
- package/dist/taro-components/{p-30c0639e.js → p-49ae5efb.js} +1 -1
- package/dist/taro-components/p-4a2ffc1c.entry.js +1 -0
- package/dist/taro-components/p-4ff67760.entry.js +1 -0
- package/dist/taro-components/p-5412a1d2.system.entry.js +1 -0
- package/dist/taro-components/{p-9242dcf7.system.entry.js → p-5a13bd63.system.entry.js} +1 -1
- package/dist/taro-components/{p-aed3d0e9.system.entry.js → p-5c8ba192.system.entry.js} +1 -1
- package/dist/taro-components/p-5d84eaf0.entry.js +1 -0
- package/dist/taro-components/{p-318795b9.system.entry.js → p-5e6feca6.system.entry.js} +1 -1
- package/dist/taro-components/{p-625158f0.js → p-6967e577.js} +0 -0
- package/dist/taro-components/{p-bd00f506.system.js → p-696f0d1c.system.js} +0 -0
- package/dist/taro-components/{p-d402dc94.system.entry.js → p-69be8189.system.entry.js} +1 -1
- package/dist/taro-components/p-6daacf48.entry.js +1 -0
- package/dist/taro-components/p-70f40e3a.entry.js +1 -0
- package/dist/taro-components/p-72f2b6f5.entry.js +1 -0
- package/dist/taro-components/p-76c00960.entry.js +1 -0
- package/dist/taro-components/p-7a5be745.entry.js +1 -0
- package/dist/taro-components/p-7b021c48.entry.js +1 -0
- package/dist/taro-components/p-7f3e5f09.entry.js +1 -0
- package/dist/taro-components/{p-c1d6c0ba.system.entry.js → p-7ffcfb05.system.entry.js} +1 -1
- package/dist/taro-components/p-81588c19.entry.js +1 -0
- package/dist/taro-components/{p-89fc30f0.entry.js → p-8cf16235.entry.js} +1 -1
- package/dist/taro-components/{p-4f139925.system.entry.js → p-8d905ff5.system.entry.js} +1 -1
- package/dist/taro-components/p-923c6e08.entry.js +1 -0
- package/dist/taro-components/p-93748645.system.js +1 -0
- package/dist/taro-components/p-9767491b.entry.js +1 -0
- package/dist/taro-components/{p-3eb31172.system.entry.js → p-9d6a7a70.system.entry.js} +1 -1
- package/dist/taro-components/{p-e3e40b03.system.entry.js → p-9e807bd6.system.entry.js} +1 -1
- package/dist/taro-components/p-9e912454.system.entry.js +1 -0
- package/dist/taro-components/{p-9c9178cd.system.entry.js → p-a34988ff.system.entry.js} +1 -1
- package/dist/taro-components/p-a895db87.entry.js +1 -0
- package/dist/taro-components/{p-9ffb69e5.system.entry.js → p-af9ec312.system.entry.js} +1 -1
- package/dist/taro-components/{p-0f393c6d.system.entry.js → p-b685a487.system.entry.js} +1 -1
- package/dist/taro-components/p-b6e0dca6.entry.js +1 -0
- package/dist/taro-components/{p-129341f2.system.entry.js → p-bd922592.system.entry.js} +1 -1
- package/dist/taro-components/{p-73c389e7.system.entry.js → p-c221cebb.system.entry.js} +1 -1
- package/dist/taro-components/p-c5722042.entry.js +1 -0
- package/dist/taro-components/p-ca67c759.entry.js +1 -0
- package/dist/taro-components/p-ce093936.entry.js +1 -0
- package/dist/taro-components/{p-4d11f3ad.system.entry.js → p-ce49e2f4.system.entry.js} +1 -1
- package/dist/taro-components/p-d12592f1.entry.js +1 -0
- package/dist/taro-components/{p-a74d5aa5.system.entry.js → p-d52009d1.system.entry.js} +1 -1
- package/dist/taro-components/{p-2e9e9ca7.system.entry.js → p-d52bf5f5.system.entry.js} +1 -1
- package/dist/taro-components/{p-81f5977d.system.entry.js → p-d6269b5e.system.entry.js} +1 -1
- package/dist/taro-components/p-d6a37b93.entry.js +1 -0
- package/dist/taro-components/p-de3a4828.entry.js +1 -0
- package/dist/taro-components/p-f4158e42.entry.js +1 -0
- package/dist/taro-components/p-f6c7f07c.system.entry.js +1 -0
- package/dist/taro-components/p-f7b6c1a6.entry.js +1 -0
- package/dist/taro-components/p-f8d0dabb.entry.js +1 -0
- package/dist/taro-components/{p-8c43da73.system.entry.js → p-f9013b36.system.entry.js} +1 -1
- package/dist/taro-components/p-f991bc7b.entry.js +1 -0
- package/dist/taro-components/taro-components.esm.js +1 -1
- package/dist/taro-components/taro-components.js +1 -1
- package/dist/types/components/checkbox/checkbox.d.ts +1 -0
- package/dist/types/components/view/view.d.ts +2 -0
- package/dist/types/components.d.ts +2 -0
- package/dist/types/stencil-public-runtime.d.ts +190 -182
- package/loader/index.d.ts +0 -1
- package/package.json +4 -4
- package/dist/esm-es5/index-310de3d5.js +0 -1
- package/dist/taro-components/p-180fd001.entry.js +0 -1
- package/dist/taro-components/p-28348261.entry.js +0 -1
- package/dist/taro-components/p-31b89eb3.entry.js +0 -1
- package/dist/taro-components/p-31f0f881.entry.js +0 -1
- package/dist/taro-components/p-4591dff5.entry.js +0 -1
- package/dist/taro-components/p-4afe24d7.entry.js +0 -1
- package/dist/taro-components/p-4b632069.entry.js +0 -1
- package/dist/taro-components/p-4f1d45ff.entry.js +0 -1
- package/dist/taro-components/p-5032d822.entry.js +0 -1
- package/dist/taro-components/p-593ee811.entry.js +0 -1
- package/dist/taro-components/p-6287057a.entry.js +0 -1
- package/dist/taro-components/p-66120099.entry.js +0 -1
- package/dist/taro-components/p-6730fa44.entry.js +0 -1
- package/dist/taro-components/p-6f331ed3.entry.js +0 -1
- package/dist/taro-components/p-8031d6b5.system.entry.js +0 -1
- package/dist/taro-components/p-80f50da7.entry.js +0 -1
- package/dist/taro-components/p-82185d54.system.entry.js +0 -1
- package/dist/taro-components/p-8676c058.entry.js +0 -1
- package/dist/taro-components/p-8f7b75f6.system.entry.js +0 -1
- package/dist/taro-components/p-906c3a0a.entry.js +0 -1
- package/dist/taro-components/p-9205470e.entry.js +0 -1
- package/dist/taro-components/p-945fa1a0.entry.js +0 -1
- package/dist/taro-components/p-95f5261c.entry.js +0 -1
- package/dist/taro-components/p-96771939.entry.js +0 -1
- package/dist/taro-components/p-96f1e9e7.entry.js +0 -1
- package/dist/taro-components/p-9c47f99e.entry.js +0 -1
- package/dist/taro-components/p-9fe2309f.entry.js +0 -1
- package/dist/taro-components/p-a208926a.entry.js +0 -1
- package/dist/taro-components/p-a3e783c3.entry.js +0 -1
- package/dist/taro-components/p-af393b0b.entry.js +0 -1
- package/dist/taro-components/p-b2ed71a7.entry.js +0 -1
- package/dist/taro-components/p-b5d2597b.system.js +0 -1
- package/dist/taro-components/p-b7c29d05.entry.js +0 -1
- package/dist/taro-components/p-c2810ece.entry.js +0 -1
- package/dist/taro-components/p-c37d9a5d.system.entry.js +0 -1
- package/dist/taro-components/p-c9380fa6.entry.js +0 -1
- package/dist/taro-components/p-ca74a018.entry.js +0 -1
- package/dist/taro-components/p-cf496b3b.system.js +0 -1
- package/dist/taro-components/p-e256974b.system.entry.js +0 -1
- package/dist/taro-components/p-e28625a2.entry.js +0 -1
- package/dist/taro-components/p-e302b8d7.entry.js +0 -1
|
@@ -34,26 +34,26 @@ const doc = win.document || { head: {} };
|
|
|
34
34
|
const plt = {
|
|
35
35
|
$flags$: 0,
|
|
36
36
|
$resourcesUrl$: '',
|
|
37
|
-
jmp: h => h(),
|
|
38
|
-
raf: h => requestAnimationFrame(h),
|
|
37
|
+
jmp: (h) => h(),
|
|
38
|
+
raf: (h) => requestAnimationFrame(h),
|
|
39
39
|
ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
|
|
40
40
|
rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
|
|
41
41
|
ce: (eventName, opts) => new CustomEvent(eventName, opts),
|
|
42
42
|
};
|
|
43
43
|
const promiseResolve = (v) => Promise.resolve(v);
|
|
44
|
-
const supportsConstructibleStylesheets =
|
|
44
|
+
const supportsConstructibleStylesheets = /*@__PURE__*/ (() => {
|
|
45
45
|
try {
|
|
46
46
|
new CSSStyleSheet();
|
|
47
|
-
return typeof
|
|
47
|
+
return typeof new CSSStyleSheet().replace === 'function';
|
|
48
48
|
}
|
|
49
49
|
catch (e) { }
|
|
50
50
|
return false;
|
|
51
51
|
})()
|
|
52
52
|
;
|
|
53
53
|
const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
|
|
54
|
-
if (
|
|
54
|
+
if (listeners) {
|
|
55
55
|
listeners.map(([flags, name, method]) => {
|
|
56
|
-
const target =
|
|
56
|
+
const target = getHostListenerTarget(elm, flags) ;
|
|
57
57
|
const handler = hostListenerProxy(hostRef, method);
|
|
58
58
|
const opts = hostListenerOpts(flags);
|
|
59
59
|
plt.ael(target, name, handler, opts);
|
|
@@ -78,12 +78,12 @@ const hostListenerProxy = (hostRef, methodName) => (ev) => {
|
|
|
78
78
|
}
|
|
79
79
|
};
|
|
80
80
|
const getHostListenerTarget = (elm, flags) => {
|
|
81
|
-
if (
|
|
81
|
+
if (flags & 4 /* TargetDocument */)
|
|
82
82
|
return doc;
|
|
83
83
|
return elm;
|
|
84
84
|
};
|
|
85
85
|
// prettier-ignore
|
|
86
|
-
const hostListenerOpts = (flags) =>
|
|
86
|
+
const hostListenerOpts = (flags) => (flags & 2 /* Capture */) !== 0;
|
|
87
87
|
const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
|
|
88
88
|
const XLINK_NS = 'http://www.w3.org/1999/xlink';
|
|
89
89
|
const createTime = (fnName, tagName = '') => {
|
|
@@ -139,7 +139,7 @@ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
|
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
|
-
else if (
|
|
142
|
+
else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
|
|
143
143
|
styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
|
|
144
144
|
}
|
|
145
145
|
}
|
|
@@ -149,10 +149,10 @@ const attachStyles = (hostRef) => {
|
|
|
149
149
|
const cmpMeta = hostRef.$cmpMeta$;
|
|
150
150
|
const elm = hostRef.$hostElement$;
|
|
151
151
|
const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
|
|
152
|
-
|
|
152
|
+
addStyle(elm.getRootNode(), cmpMeta);
|
|
153
153
|
endAttachStyles();
|
|
154
154
|
};
|
|
155
|
-
const getScopeId = (cmp, mode) => 'sc-' + (
|
|
155
|
+
const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
|
|
156
156
|
/**
|
|
157
157
|
* Default style mode id
|
|
158
158
|
*/
|
|
@@ -209,10 +209,10 @@ const h = (nodeName, vnodeData, ...children) => {
|
|
|
209
209
|
walk(children);
|
|
210
210
|
if (vnodeData) {
|
|
211
211
|
// normalize class / classname attributes
|
|
212
|
-
if (
|
|
212
|
+
if (vnodeData.key) {
|
|
213
213
|
key = vnodeData.key;
|
|
214
214
|
}
|
|
215
|
-
if (
|
|
215
|
+
if (vnodeData.name) {
|
|
216
216
|
slotName = vnodeData.name;
|
|
217
217
|
}
|
|
218
218
|
{
|
|
@@ -222,12 +222,12 @@ const h = (nodeName, vnodeData, ...children) => {
|
|
|
222
222
|
typeof classData !== 'object'
|
|
223
223
|
? classData
|
|
224
224
|
: Object.keys(classData)
|
|
225
|
-
.filter(k => classData[k])
|
|
225
|
+
.filter((k) => classData[k])
|
|
226
226
|
.join(' ');
|
|
227
227
|
}
|
|
228
228
|
}
|
|
229
229
|
}
|
|
230
|
-
if (
|
|
230
|
+
if (typeof nodeName === 'function') {
|
|
231
231
|
// nodeName is a functional component
|
|
232
232
|
return nodeName(vnodeData === null ? {} : vnodeData, vNodeChildren, vdomFnUtils);
|
|
233
233
|
}
|
|
@@ -307,19 +307,19 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
307
307
|
if (oldValue !== newValue) {
|
|
308
308
|
let isProp = isMemberInElement(elm, memberName);
|
|
309
309
|
let ln = memberName.toLowerCase();
|
|
310
|
-
if (
|
|
310
|
+
if (memberName === 'class') {
|
|
311
311
|
const classList = elm.classList;
|
|
312
312
|
const oldClasses = parseClassList(oldValue);
|
|
313
313
|
const newClasses = parseClassList(newValue);
|
|
314
|
-
classList.remove(...oldClasses.filter(c => c && !newClasses.includes(c)));
|
|
315
|
-
classList.add(...newClasses.filter(c => c && !oldClasses.includes(c)));
|
|
314
|
+
classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
|
|
315
|
+
classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
|
|
316
316
|
}
|
|
317
|
-
else if (
|
|
317
|
+
else if (memberName === 'style') {
|
|
318
318
|
// update style attribute, css properties and values
|
|
319
319
|
{
|
|
320
320
|
for (const prop in oldValue) {
|
|
321
321
|
if (!newValue || newValue[prop] == null) {
|
|
322
|
-
if (
|
|
322
|
+
if (prop.includes('-')) {
|
|
323
323
|
elm.style.removeProperty(prop);
|
|
324
324
|
}
|
|
325
325
|
else {
|
|
@@ -330,7 +330,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
330
330
|
}
|
|
331
331
|
for (const prop in newValue) {
|
|
332
332
|
if (!oldValue || newValue[prop] !== oldValue[prop]) {
|
|
333
|
-
if (
|
|
333
|
+
if (prop.includes('-')) {
|
|
334
334
|
elm.style.setProperty(prop, newValue[prop]);
|
|
335
335
|
}
|
|
336
336
|
else {
|
|
@@ -339,15 +339,17 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
339
339
|
}
|
|
340
340
|
}
|
|
341
341
|
}
|
|
342
|
-
else if (
|
|
342
|
+
else if (memberName === 'key')
|
|
343
343
|
;
|
|
344
|
-
else if (
|
|
344
|
+
else if (memberName === 'ref') {
|
|
345
345
|
// minifier will clean this up
|
|
346
346
|
if (newValue) {
|
|
347
347
|
newValue(elm);
|
|
348
348
|
}
|
|
349
349
|
}
|
|
350
|
-
else if (
|
|
350
|
+
else if ((!isProp ) &&
|
|
351
|
+
memberName[0] === 'o' &&
|
|
352
|
+
memberName[1] === 'n') {
|
|
351
353
|
// Event Handlers
|
|
352
354
|
// so if the member name starts with "on" and the 3rd characters is
|
|
353
355
|
// a capital letter, and it's not already a member on the element,
|
|
@@ -422,7 +424,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
422
424
|
}
|
|
423
425
|
if (newValue == null || newValue === false) {
|
|
424
426
|
if (newValue !== false || elm.getAttribute(memberName) === '') {
|
|
425
|
-
if (
|
|
427
|
+
if (xlink) {
|
|
426
428
|
elm.removeAttributeNS(XLINK_NS, memberName);
|
|
427
429
|
}
|
|
428
430
|
else {
|
|
@@ -432,7 +434,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
432
434
|
}
|
|
433
435
|
else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
|
|
434
436
|
newValue = newValue === true ? '' : newValue;
|
|
435
|
-
if (
|
|
437
|
+
if (xlink) {
|
|
436
438
|
elm.setAttributeNS(XLINK_NS, memberName, newValue);
|
|
437
439
|
}
|
|
438
440
|
else {
|
|
@@ -448,7 +450,9 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
|
|
|
448
450
|
// if the element passed in is a shadow root, which is a document fragment
|
|
449
451
|
// then we want to be adding attrs/props to the shadow root's "host" element
|
|
450
452
|
// if it's not a shadow root, then we add attrs/props to the same element
|
|
451
|
-
const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host
|
|
453
|
+
const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host
|
|
454
|
+
? newVnode.$elm$.host
|
|
455
|
+
: newVnode.$elm$;
|
|
452
456
|
const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
|
|
453
457
|
const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
|
|
454
458
|
{
|
|
@@ -471,7 +475,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
471
475
|
let elm;
|
|
472
476
|
let childNode;
|
|
473
477
|
let oldVNode;
|
|
474
|
-
if (
|
|
478
|
+
if (!useNativeShadowDom) {
|
|
475
479
|
// remember for later we need to check to relocate nodes
|
|
476
480
|
checkSlotRelocate = true;
|
|
477
481
|
if (newVNode.$tag$ === 'slot') {
|
|
@@ -482,17 +486,20 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
482
486
|
1 /* isSlotReference */;
|
|
483
487
|
}
|
|
484
488
|
}
|
|
485
|
-
if (
|
|
489
|
+
if (newVNode.$text$ !== null) {
|
|
486
490
|
// create text node
|
|
487
491
|
elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
|
|
488
492
|
}
|
|
489
|
-
else if (
|
|
493
|
+
else if (newVNode.$flags$ & 1 /* isSlotReference */) {
|
|
490
494
|
// create a slot reference node
|
|
491
|
-
elm = newVNode.$elm$ =
|
|
495
|
+
elm = newVNode.$elm$ =
|
|
496
|
+
doc.createTextNode('');
|
|
492
497
|
}
|
|
493
498
|
else {
|
|
494
499
|
// create element
|
|
495
|
-
elm = newVNode.$elm$ = (
|
|
500
|
+
elm = newVNode.$elm$ = (doc.createElement(newVNode.$flags$ & 2 /* isSlotFallback */
|
|
501
|
+
? 'slot-fb'
|
|
502
|
+
: newVNode.$tag$));
|
|
496
503
|
// add css classes, attrs, props, listeners, etc.
|
|
497
504
|
{
|
|
498
505
|
updateElement(null, newVNode, isSvgMode);
|
|
@@ -554,14 +561,14 @@ const putBackInOriginalLocation = (parentElm, recursive) => {
|
|
|
554
561
|
plt.$flags$ &= ~1 /* isTmpDisconnected */;
|
|
555
562
|
};
|
|
556
563
|
const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
|
|
557
|
-
let containerElm = ((
|
|
564
|
+
let containerElm = ((parentElm['s-cr'] && parentElm['s-cr'].parentNode) || parentElm);
|
|
558
565
|
let childNode;
|
|
559
566
|
for (; startIdx <= endIdx; ++startIdx) {
|
|
560
567
|
if (vnodes[startIdx]) {
|
|
561
568
|
childNode = createElm(null, parentVNode, startIdx);
|
|
562
569
|
if (childNode) {
|
|
563
570
|
vnodes[startIdx].$elm$ = childNode;
|
|
564
|
-
containerElm.insertBefore(childNode,
|
|
571
|
+
containerElm.insertBefore(childNode, referenceNode(before) );
|
|
565
572
|
}
|
|
566
573
|
}
|
|
567
574
|
}
|
|
@@ -629,7 +636,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
629
636
|
}
|
|
630
637
|
else if (isSameVnode(oldStartVnode, newEndVnode)) {
|
|
631
638
|
// Vnode moved right
|
|
632
|
-
if (
|
|
639
|
+
if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
|
|
633
640
|
putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
|
|
634
641
|
}
|
|
635
642
|
patch(oldStartVnode, newEndVnode);
|
|
@@ -639,7 +646,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
639
646
|
}
|
|
640
647
|
else if (isSameVnode(oldEndVnode, newStartVnode)) {
|
|
641
648
|
// Vnode moved left
|
|
642
|
-
if (
|
|
649
|
+
if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
|
|
643
650
|
putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
|
|
644
651
|
}
|
|
645
652
|
patch(oldEndVnode, newStartVnode);
|
|
@@ -658,7 +665,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
658
665
|
}
|
|
659
666
|
}
|
|
660
667
|
}
|
|
661
|
-
if (
|
|
668
|
+
if (idxInOld >= 0) {
|
|
662
669
|
elmToMove = oldCh[idxInOld];
|
|
663
670
|
if (elmToMove.$tag$ !== newStartVnode.$tag$) {
|
|
664
671
|
node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld);
|
|
@@ -685,7 +692,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
685
692
|
if (oldStartIdx > oldEndIdx) {
|
|
686
693
|
addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
|
|
687
694
|
}
|
|
688
|
-
else if (
|
|
695
|
+
else if (newStartIdx > newEndIdx) {
|
|
689
696
|
removeVnodes(oldCh, oldStartIdx, oldEndIdx);
|
|
690
697
|
}
|
|
691
698
|
};
|
|
@@ -693,7 +700,7 @@ const isSameVnode = (vnode1, vnode2) => {
|
|
|
693
700
|
// compare if two vnode to see if they're "technically" the same
|
|
694
701
|
// need to have the same element tag, and same key to be the same
|
|
695
702
|
if (vnode1.$tag$ === vnode2.$tag$) {
|
|
696
|
-
if (
|
|
703
|
+
if (vnode1.$tag$ === 'slot') {
|
|
697
704
|
return vnode1.$name$ === vnode2.$name$;
|
|
698
705
|
}
|
|
699
706
|
{
|
|
@@ -717,10 +724,10 @@ const patch = (oldVNode, newVNode) => {
|
|
|
717
724
|
const tag = newVNode.$tag$;
|
|
718
725
|
const text = newVNode.$text$;
|
|
719
726
|
let defaultHolder;
|
|
720
|
-
if (
|
|
727
|
+
if (text === null) {
|
|
721
728
|
// element node
|
|
722
729
|
{
|
|
723
|
-
if (
|
|
730
|
+
if (tag === 'slot')
|
|
724
731
|
;
|
|
725
732
|
else {
|
|
726
733
|
// either this is the first render of an element OR it's an update
|
|
@@ -729,29 +736,29 @@ const patch = (oldVNode, newVNode) => {
|
|
|
729
736
|
updateElement(oldVNode, newVNode, isSvgMode);
|
|
730
737
|
}
|
|
731
738
|
}
|
|
732
|
-
if (
|
|
739
|
+
if (oldChildren !== null && newChildren !== null) {
|
|
733
740
|
// looks like there's child vnodes for both the old and new vnodes
|
|
734
741
|
updateChildren(elm, oldChildren, newVNode, newChildren);
|
|
735
742
|
}
|
|
736
743
|
else if (newChildren !== null) {
|
|
737
744
|
// no old child vnodes, but there are new child vnodes to add
|
|
738
|
-
if (
|
|
745
|
+
if (oldVNode.$text$ !== null) {
|
|
739
746
|
// the old vnode was text, so be sure to clear it out
|
|
740
747
|
elm.textContent = '';
|
|
741
748
|
}
|
|
742
749
|
// add the new vnode children
|
|
743
750
|
addVnodes(elm, null, newVNode, newChildren, 0, newChildren.length - 1);
|
|
744
751
|
}
|
|
745
|
-
else if (
|
|
752
|
+
else if (oldChildren !== null) {
|
|
746
753
|
// no new child vnodes, but there are old child vnodes to remove
|
|
747
754
|
removeVnodes(oldChildren, 0, oldChildren.length - 1);
|
|
748
755
|
}
|
|
749
756
|
}
|
|
750
|
-
else if (
|
|
757
|
+
else if ((defaultHolder = elm['s-cr'])) {
|
|
751
758
|
// this element has slotted content
|
|
752
759
|
defaultHolder.parentNode.textContent = text;
|
|
753
760
|
}
|
|
754
|
-
else if (
|
|
761
|
+
else if (oldVNode.$text$ !== text) {
|
|
755
762
|
// update the text content for the text only vnode
|
|
756
763
|
// and also only if the text is different than before
|
|
757
764
|
elm.data = text;
|
|
@@ -829,7 +836,7 @@ const relocateSlotContent = (elm) => {
|
|
|
829
836
|
// that is suppose to always represent the original content location
|
|
830
837
|
if (isNodeLocatedInSlot(node, slotNameAttr)) {
|
|
831
838
|
// it's possible we've already decided to relocate this node
|
|
832
|
-
relocateNodeData = relocateNodes.find(r => r.$nodeToRelocate$ === node);
|
|
839
|
+
relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
|
|
833
840
|
// made some changes to slots
|
|
834
841
|
// let's make sure we also double check
|
|
835
842
|
// fallbacks are correctly hidden or shown
|
|
@@ -848,9 +855,9 @@ const relocateSlotContent = (elm) => {
|
|
|
848
855
|
});
|
|
849
856
|
}
|
|
850
857
|
if (node['s-sr']) {
|
|
851
|
-
relocateNodes.map(relocateNode => {
|
|
858
|
+
relocateNodes.map((relocateNode) => {
|
|
852
859
|
if (isNodeLocatedInSlot(relocateNode.$nodeToRelocate$, node['s-sn'])) {
|
|
853
|
-
relocateNodeData = relocateNodes.find(r => r.$nodeToRelocate$ === node);
|
|
860
|
+
relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
|
|
854
861
|
if (relocateNodeData && !relocateNode.$slotRefNode$) {
|
|
855
862
|
relocateNode.$slotRefNode$ = relocateNodeData.$slotRefNode$;
|
|
856
863
|
}
|
|
@@ -858,7 +865,7 @@ const relocateSlotContent = (elm) => {
|
|
|
858
865
|
});
|
|
859
866
|
}
|
|
860
867
|
}
|
|
861
|
-
else if (!relocateNodes.some(r => r.$nodeToRelocate$ === node)) {
|
|
868
|
+
else if (!relocateNodes.some((r) => r.$nodeToRelocate$ === node)) {
|
|
862
869
|
// so far this element does not have a slot home, not setting slotRefNode on purpose
|
|
863
870
|
// if we never find a home for this element then we'll need to hide it
|
|
864
871
|
relocateNodes.push({
|
|
@@ -903,10 +910,10 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
903
910
|
rootVnode.$tag$ = null;
|
|
904
911
|
rootVnode.$flags$ |= 4 /* isHost */;
|
|
905
912
|
hostRef.$vnode$ = rootVnode;
|
|
906
|
-
rootVnode.$elm$ = oldVNode.$elm$ = (
|
|
913
|
+
rootVnode.$elm$ = oldVNode.$elm$ = (hostElm);
|
|
907
914
|
{
|
|
908
915
|
contentRef = hostElm['s-cr'];
|
|
909
|
-
useNativeShadowDom =
|
|
916
|
+
useNativeShadowDom = (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) !== 0;
|
|
910
917
|
// always reset
|
|
911
918
|
checkSlotFallbackVisibility = false;
|
|
912
919
|
}
|
|
@@ -931,7 +938,8 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
931
938
|
if (!nodeToRelocate['s-ol']) {
|
|
932
939
|
// add a reference node marking this node's original location
|
|
933
940
|
// keep a reference to this node for later lookups
|
|
934
|
-
orgLocationNode =
|
|
941
|
+
orgLocationNode =
|
|
942
|
+
doc.createTextNode('');
|
|
935
943
|
orgLocationNode['s-nr'] = nodeToRelocate;
|
|
936
944
|
nodeToRelocate.parentNode.insertBefore((nodeToRelocate['s-ol'] = orgLocationNode), nodeToRelocate);
|
|
937
945
|
}
|
|
@@ -955,7 +963,8 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
955
963
|
}
|
|
956
964
|
}
|
|
957
965
|
}
|
|
958
|
-
if ((!insertBeforeNode && parentNodeRef !== nodeToRelocate.parentNode) ||
|
|
966
|
+
if ((!insertBeforeNode && parentNodeRef !== nodeToRelocate.parentNode) ||
|
|
967
|
+
nodeToRelocate.nextSibling !== insertBeforeNode) {
|
|
959
968
|
// we've checked that it's worth while to relocate
|
|
960
969
|
// since that the node to relocate
|
|
961
970
|
// has a different next sibling or parent relocated
|
|
@@ -987,7 +996,7 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
987
996
|
relocateNodes.length = 0;
|
|
988
997
|
}
|
|
989
998
|
};
|
|
990
|
-
const getElement = (ref) => (
|
|
999
|
+
const getElement = (ref) => (getHostRef(ref).$hostElement$ );
|
|
991
1000
|
const createEvent = (ref, name, flags) => {
|
|
992
1001
|
const elm = getElement(ref);
|
|
993
1002
|
return {
|
|
@@ -1001,21 +1010,28 @@ const createEvent = (ref, name, flags) => {
|
|
|
1001
1010
|
},
|
|
1002
1011
|
};
|
|
1003
1012
|
};
|
|
1013
|
+
/**
|
|
1014
|
+
* Helper function to create & dispatch a custom Event on a provided target
|
|
1015
|
+
* @param elm the target of the Event
|
|
1016
|
+
* @param name the name to give the custom Event
|
|
1017
|
+
* @param opts options for configuring a custom Event
|
|
1018
|
+
* @returns the custom Event
|
|
1019
|
+
*/
|
|
1004
1020
|
const emitEvent = (elm, name, opts) => {
|
|
1005
1021
|
const ev = plt.ce(name, opts);
|
|
1006
1022
|
elm.dispatchEvent(ev);
|
|
1007
1023
|
return ev;
|
|
1008
1024
|
};
|
|
1009
1025
|
const attachToAncestor = (hostRef, ancestorComponent) => {
|
|
1010
|
-
if (
|
|
1011
|
-
ancestorComponent['s-p'].push(new Promise(r => (hostRef.$onRenderResolve$ = r)));
|
|
1026
|
+
if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
|
|
1027
|
+
ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r)));
|
|
1012
1028
|
}
|
|
1013
1029
|
};
|
|
1014
1030
|
const scheduleUpdate = (hostRef, isInitialLoad) => {
|
|
1015
1031
|
{
|
|
1016
1032
|
hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
|
|
1017
1033
|
}
|
|
1018
|
-
if (
|
|
1034
|
+
if (hostRef.$flags$ & 4 /* isWaitingForChildren */) {
|
|
1019
1035
|
hostRef.$flags$ |= 512 /* needsRerender */;
|
|
1020
1036
|
return;
|
|
1021
1037
|
}
|
|
@@ -1024,11 +1040,11 @@ const scheduleUpdate = (hostRef, isInitialLoad) => {
|
|
|
1024
1040
|
// has already fired off its lifecycle update then
|
|
1025
1041
|
// fire off the initial update
|
|
1026
1042
|
const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
|
|
1027
|
-
return
|
|
1043
|
+
return writeTask(dispatch) ;
|
|
1028
1044
|
};
|
|
1029
1045
|
const dispatchHooks = (hostRef, isInitialLoad) => {
|
|
1030
1046
|
const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$);
|
|
1031
|
-
const instance =
|
|
1047
|
+
const instance = hostRef.$lazyInstance$ ;
|
|
1032
1048
|
let promise;
|
|
1033
1049
|
if (isInitialLoad) {
|
|
1034
1050
|
{
|
|
@@ -1055,7 +1071,7 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
|
1055
1071
|
const elm = hostRef.$hostElement$;
|
|
1056
1072
|
const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$);
|
|
1057
1073
|
const rc = elm['s-rc'];
|
|
1058
|
-
if (
|
|
1074
|
+
if (isInitialLoad) {
|
|
1059
1075
|
// DOM WRITE!
|
|
1060
1076
|
attachStyles(hostRef);
|
|
1061
1077
|
}
|
|
@@ -1063,11 +1079,11 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
|
1063
1079
|
{
|
|
1064
1080
|
callRender(hostRef, instance);
|
|
1065
1081
|
}
|
|
1066
|
-
if (
|
|
1082
|
+
if (rc) {
|
|
1067
1083
|
// ok, so turns out there are some child host elements
|
|
1068
1084
|
// waiting on this parent element to load
|
|
1069
1085
|
// let's fire off all update callbacks waiting
|
|
1070
|
-
rc.map(cb => cb());
|
|
1086
|
+
rc.map((cb) => cb());
|
|
1071
1087
|
elm['s-rc'] = undefined;
|
|
1072
1088
|
}
|
|
1073
1089
|
endRender();
|
|
@@ -1087,7 +1103,7 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
|
1087
1103
|
};
|
|
1088
1104
|
const callRender = (hostRef, instance, elm) => {
|
|
1089
1105
|
try {
|
|
1090
|
-
instance =
|
|
1106
|
+
instance = instance.render() ;
|
|
1091
1107
|
{
|
|
1092
1108
|
hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
|
|
1093
1109
|
}
|
|
@@ -1114,7 +1130,7 @@ const postUpdateComponent = (hostRef) => {
|
|
|
1114
1130
|
const tagName = hostRef.$cmpMeta$.$tagName$;
|
|
1115
1131
|
const elm = hostRef.$hostElement$;
|
|
1116
1132
|
const endPostUpdate = createTime('postUpdate', tagName);
|
|
1117
|
-
const instance =
|
|
1133
|
+
const instance = hostRef.$lazyInstance$ ;
|
|
1118
1134
|
const ancestorComponent = hostRef.$ancestorComponent$;
|
|
1119
1135
|
{
|
|
1120
1136
|
safeCall(instance, 'componentDidRender');
|
|
@@ -1183,20 +1199,21 @@ const safeCall = (instance, method, arg) => {
|
|
|
1183
1199
|
const then = (promise, thenFn) => {
|
|
1184
1200
|
return promise && promise.then ? promise.then(thenFn) : thenFn();
|
|
1185
1201
|
};
|
|
1186
|
-
const addHydratedFlag = (elm) =>
|
|
1202
|
+
const addHydratedFlag = (elm) => elm.classList.add('hydrated')
|
|
1203
|
+
;
|
|
1187
1204
|
const parsePropertyValue = (propValue, propType) => {
|
|
1188
1205
|
// ensure this value is of the correct prop type
|
|
1189
1206
|
if (propValue != null && !isComplexType(propValue)) {
|
|
1190
|
-
if (
|
|
1207
|
+
if (propType & 4 /* Boolean */) {
|
|
1191
1208
|
// per the HTML spec, any string value means it is a boolean true value
|
|
1192
1209
|
// but we'll cheat here and say that the string "false" is the boolean false
|
|
1193
1210
|
return propValue === 'false' ? false : propValue === '' || !!propValue;
|
|
1194
1211
|
}
|
|
1195
|
-
if (
|
|
1212
|
+
if (propType & 2 /* Number */) {
|
|
1196
1213
|
// force it to be a number
|
|
1197
1214
|
return parseFloat(propValue);
|
|
1198
1215
|
}
|
|
1199
|
-
if (
|
|
1216
|
+
if (propType & 1 /* String */) {
|
|
1200
1217
|
// could have been passed as a number or boolean
|
|
1201
1218
|
// but we still want it as a string
|
|
1202
1219
|
return String(propValue);
|
|
@@ -1212,22 +1229,22 @@ const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propNam
|
|
|
1212
1229
|
const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
1213
1230
|
// check our new property value against our internal value
|
|
1214
1231
|
const hostRef = getHostRef(ref);
|
|
1215
|
-
const elm =
|
|
1232
|
+
const elm = hostRef.$hostElement$ ;
|
|
1216
1233
|
const oldVal = hostRef.$instanceValues$.get(propName);
|
|
1217
1234
|
const flags = hostRef.$flags$;
|
|
1218
|
-
const instance =
|
|
1235
|
+
const instance = hostRef.$lazyInstance$ ;
|
|
1219
1236
|
newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
|
|
1220
|
-
if ((
|
|
1237
|
+
if ((!(flags & 8 /* isConstructingInstance */) || oldVal === undefined) && newVal !== oldVal) {
|
|
1221
1238
|
// gadzooks! the property's value has changed!!
|
|
1222
1239
|
// set our new value!
|
|
1223
1240
|
hostRef.$instanceValues$.set(propName, newVal);
|
|
1224
|
-
if (
|
|
1241
|
+
if (instance) {
|
|
1225
1242
|
// get an array of method names of watch functions to call
|
|
1226
|
-
if (
|
|
1243
|
+
if (cmpMeta.$watchers$ && flags & 128 /* isWatchReady */) {
|
|
1227
1244
|
const watchMethods = cmpMeta.$watchers$[propName];
|
|
1228
1245
|
if (watchMethods) {
|
|
1229
1246
|
// this instance is watching for when this property changed
|
|
1230
|
-
watchMethods.map(watchMethodName => {
|
|
1247
|
+
watchMethods.map((watchMethodName) => {
|
|
1231
1248
|
try {
|
|
1232
1249
|
// fire off each of the watch methods that are watching this property
|
|
1233
1250
|
instance[watchMethodName](newVal, oldVal, propName);
|
|
@@ -1238,7 +1255,7 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
1238
1255
|
});
|
|
1239
1256
|
}
|
|
1240
1257
|
}
|
|
1241
|
-
if (
|
|
1258
|
+
if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
|
|
1242
1259
|
// looks like this value actually changed, so we've got work to do!
|
|
1243
1260
|
// but only if we've already rendered, otherwise just chill out
|
|
1244
1261
|
// queue that we need to do an update, but don't worry about queuing
|
|
@@ -1249,15 +1266,16 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
1249
1266
|
}
|
|
1250
1267
|
};
|
|
1251
1268
|
const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
1252
|
-
if (
|
|
1253
|
-
if (
|
|
1269
|
+
if (cmpMeta.$members$) {
|
|
1270
|
+
if (Cstr.watchers) {
|
|
1254
1271
|
cmpMeta.$watchers$ = Cstr.watchers;
|
|
1255
1272
|
}
|
|
1256
1273
|
// It's better to have a const than two Object.entries()
|
|
1257
1274
|
const members = Object.entries(cmpMeta.$members$);
|
|
1258
1275
|
const prototype = Cstr.prototype;
|
|
1259
1276
|
members.map(([memberName, [memberFlags]]) => {
|
|
1260
|
-
if (
|
|
1277
|
+
if ((memberFlags & 31 /* Prop */ ||
|
|
1278
|
+
((flags & 2 /* proxyState */) && memberFlags & 32 /* State */))) {
|
|
1261
1279
|
// proxyComponent - prop
|
|
1262
1280
|
Object.defineProperty(prototype, memberName, {
|
|
1263
1281
|
get() {
|
|
@@ -1272,7 +1290,8 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1272
1290
|
enumerable: true,
|
|
1273
1291
|
});
|
|
1274
1292
|
}
|
|
1275
|
-
else if (
|
|
1293
|
+
else if (flags & 1 /* isElementConstructor */ &&
|
|
1294
|
+
memberFlags & 64 /* Method */) {
|
|
1276
1295
|
// proxyComponent - method
|
|
1277
1296
|
Object.defineProperty(prototype, memberName, {
|
|
1278
1297
|
value(...args) {
|
|
@@ -1282,11 +1301,48 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1282
1301
|
});
|
|
1283
1302
|
}
|
|
1284
1303
|
});
|
|
1285
|
-
if (
|
|
1304
|
+
if ((flags & 1 /* isElementConstructor */)) {
|
|
1286
1305
|
const attrNameToPropName = new Map();
|
|
1287
1306
|
prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
|
|
1288
1307
|
plt.jmp(() => {
|
|
1289
1308
|
const propName = attrNameToPropName.get(attrName);
|
|
1309
|
+
// In a webcomponent lifecyle the attributeChangedCallback runs prior to connectedCallback
|
|
1310
|
+
// in the case where an attribute was set inline.
|
|
1311
|
+
// ```html
|
|
1312
|
+
// <my-component some-attribute="some-value"></my-component>
|
|
1313
|
+
// ```
|
|
1314
|
+
//
|
|
1315
|
+
// There is an edge case where a developer sets the attribute inline on a custom element and then programatically
|
|
1316
|
+
// changes it before it has been upgraded as shown below:
|
|
1317
|
+
//
|
|
1318
|
+
// ```html
|
|
1319
|
+
// <!-- this component has _not_ been upgraded yet -->
|
|
1320
|
+
// <my-component id="test" some-attribute="some-value"></my-component>
|
|
1321
|
+
// <script>
|
|
1322
|
+
// // grab non-upgraded component
|
|
1323
|
+
// el = document.querySelector("#test");
|
|
1324
|
+
// el.someAttribute = "another-value";
|
|
1325
|
+
// // upgrade component
|
|
1326
|
+
// cutsomElements.define('my-component', MyComponent);
|
|
1327
|
+
// </script>
|
|
1328
|
+
// ```
|
|
1329
|
+
// In this case if we do not unshadow here and use the value of the shadowing property, attributeChangedCallback
|
|
1330
|
+
// will be called with `newValue = "some-value"` and will set the shadowed property (this.someAttribute = "another-value")
|
|
1331
|
+
// to the value that was set inline i.e. "some-value" from above example. When
|
|
1332
|
+
// the connectedCallback attempts to unshadow it will use "some-value" as the intial value rather than "another-value"
|
|
1333
|
+
//
|
|
1334
|
+
// The case where the attribute was NOT set inline but was not set programmatically shall be handled/unshadowed
|
|
1335
|
+
// by connectedCallback as this attributeChangedCallback will not fire.
|
|
1336
|
+
//
|
|
1337
|
+
// https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
|
|
1338
|
+
//
|
|
1339
|
+
// TODO(STENCIL-16) we should think about whether or not we actually want to be reflecting the attributes to
|
|
1340
|
+
// properties here given that this goes against best practices outlined here
|
|
1341
|
+
// https://developers.google.com/web/fundamentals/web-components/best-practices#avoid-reentrancy
|
|
1342
|
+
if (this.hasOwnProperty(propName)) {
|
|
1343
|
+
newValue = this[propName];
|
|
1344
|
+
delete this[propName];
|
|
1345
|
+
}
|
|
1290
1346
|
this[propName] = newValue === null && typeof this[propName] === 'boolean' ? false : newValue;
|
|
1291
1347
|
});
|
|
1292
1348
|
};
|
|
@@ -1305,7 +1361,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1305
1361
|
};
|
|
1306
1362
|
const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
|
|
1307
1363
|
// initializeComponent
|
|
1308
|
-
if (
|
|
1364
|
+
if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
|
|
1309
1365
|
{
|
|
1310
1366
|
// we haven't initialized this element yet
|
|
1311
1367
|
hostRef.$flags$ |= 32 /* hasInitializedComponent */;
|
|
@@ -1319,8 +1375,8 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1319
1375
|
Cstr = await Cstr;
|
|
1320
1376
|
endLoad();
|
|
1321
1377
|
}
|
|
1322
|
-
if (
|
|
1323
|
-
// we'
|
|
1378
|
+
if (!Cstr.isProxied) {
|
|
1379
|
+
// we've never proxied this Constructor before
|
|
1324
1380
|
// let's add the getters/setters to its prototype before
|
|
1325
1381
|
// the first time we create an instance of the implementation
|
|
1326
1382
|
{
|
|
@@ -1354,7 +1410,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1354
1410
|
}
|
|
1355
1411
|
endNewInstance();
|
|
1356
1412
|
}
|
|
1357
|
-
if (
|
|
1413
|
+
if (Cstr.style) {
|
|
1358
1414
|
// this component has styles but we haven't registered them yet
|
|
1359
1415
|
let style = Cstr.style;
|
|
1360
1416
|
const scopeId = getScopeId(cmpMeta);
|
|
@@ -1368,7 +1424,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1368
1424
|
// we've successfully created a lazy instance
|
|
1369
1425
|
const ancestorComponent = hostRef.$ancestorComponent$;
|
|
1370
1426
|
const schedule = () => scheduleUpdate(hostRef, true);
|
|
1371
|
-
if (
|
|
1427
|
+
if (ancestorComponent && ancestorComponent['s-rc']) {
|
|
1372
1428
|
// this is the intial load and this component it has an ancestor component
|
|
1373
1429
|
// but the ancestor component has NOT fired its will update lifecycle yet
|
|
1374
1430
|
// so let's just cool our jets and wait for the ancestor to continue first
|
|
@@ -1394,7 +1450,7 @@ const connectedCallback = (elm) => {
|
|
|
1394
1450
|
// if the slot polyfill is required we'll need to put some nodes
|
|
1395
1451
|
// in here to act as original content anchors as we move nodes around
|
|
1396
1452
|
// host element has been connected to the DOM
|
|
1397
|
-
if (
|
|
1453
|
+
if ((cmpMeta.$flags$ & (4 /* hasSlotRelocation */ | 8 /* needsShadowDomShim */))) {
|
|
1398
1454
|
setContentReference(elm);
|
|
1399
1455
|
}
|
|
1400
1456
|
}
|
|
@@ -1405,8 +1461,7 @@ const connectedCallback = (elm) => {
|
|
|
1405
1461
|
while ((ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host)) {
|
|
1406
1462
|
// climb up the ancestors looking for the first
|
|
1407
1463
|
// component that hasn't finished its lifecycle update yet
|
|
1408
|
-
if (
|
|
1409
|
-
ancestorComponent['s-p']) {
|
|
1464
|
+
if (ancestorComponent['s-p']) {
|
|
1410
1465
|
// we found this components first ancestor component
|
|
1411
1466
|
// keep a reference to this component's ancestor component
|
|
1412
1467
|
attachToAncestor(hostRef, (hostRef.$ancestorComponent$ = ancestorComponent));
|
|
@@ -1416,7 +1471,7 @@ const connectedCallback = (elm) => {
|
|
|
1416
1471
|
}
|
|
1417
1472
|
// Lazy properties
|
|
1418
1473
|
// https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
|
|
1419
|
-
if (
|
|
1474
|
+
if (cmpMeta.$members$) {
|
|
1420
1475
|
Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
|
|
1421
1476
|
if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
|
|
1422
1477
|
const value = elm[memberName];
|
|
@@ -1445,17 +1500,17 @@ const setContentReference = (elm) => {
|
|
|
1445
1500
|
// let's pick out the inner content for slot projection
|
|
1446
1501
|
// create a node to represent where the original
|
|
1447
1502
|
// content was first placed, which is useful later on
|
|
1448
|
-
const contentRefElm = (elm['s-cr'] = doc.createComment(
|
|
1503
|
+
const contentRefElm = (elm['s-cr'] = doc.createComment(''));
|
|
1449
1504
|
contentRefElm['s-cn'] = true;
|
|
1450
1505
|
elm.insertBefore(contentRefElm, elm.firstChild);
|
|
1451
1506
|
};
|
|
1452
1507
|
const disconnectedCallback = (elm) => {
|
|
1453
1508
|
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
|
|
1454
1509
|
const hostRef = getHostRef(elm);
|
|
1455
|
-
const instance =
|
|
1510
|
+
const instance = hostRef.$lazyInstance$ ;
|
|
1456
1511
|
{
|
|
1457
1512
|
if (hostRef.$rmListeners$) {
|
|
1458
|
-
hostRef.$rmListeners$.map(rmListener => rmListener());
|
|
1513
|
+
hostRef.$rmListeners$.map((rmListener) => rmListener());
|
|
1459
1514
|
hostRef.$rmListeners$ = undefined;
|
|
1460
1515
|
}
|
|
1461
1516
|
}
|
|
@@ -1477,7 +1532,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1477
1532
|
let isBootstrapping = true;
|
|
1478
1533
|
Object.assign(plt, options);
|
|
1479
1534
|
plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
|
|
1480
|
-
lazyBundles.map(lazyBundle => lazyBundle[1].map(compactMeta => {
|
|
1535
|
+
lazyBundles.map((lazyBundle) => lazyBundle[1].map((compactMeta) => {
|
|
1481
1536
|
const cmpMeta = {
|
|
1482
1537
|
$flags$: compactMeta[0],
|
|
1483
1538
|
$tagName$: compactMeta[1],
|
|
@@ -1493,7 +1548,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1493
1548
|
{
|
|
1494
1549
|
cmpMeta.$watchers$ = {};
|
|
1495
1550
|
}
|
|
1496
|
-
const tagName =
|
|
1551
|
+
const tagName = cmpMeta.$tagName$;
|
|
1497
1552
|
const HostElement = class extends HTMLElement {
|
|
1498
1553
|
// StencilLazyHost
|
|
1499
1554
|
constructor(self) {
|
|
@@ -1536,7 +1591,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1536
1591
|
// Process deferred connectedCallbacks now all components have been registered
|
|
1537
1592
|
isBootstrapping = false;
|
|
1538
1593
|
if (deferredConnectedCallbacks.length) {
|
|
1539
|
-
deferredConnectedCallbacks.map(host => host.connectedCallback());
|
|
1594
|
+
deferredConnectedCallbacks.map((host) => host.connectedCallback());
|
|
1540
1595
|
}
|
|
1541
1596
|
else {
|
|
1542
1597
|
{
|
|
@@ -1557,10 +1612,10 @@ const registerHost = (elm, cmpMeta) => {
|
|
|
1557
1612
|
$instanceValues$: new Map(),
|
|
1558
1613
|
};
|
|
1559
1614
|
{
|
|
1560
|
-
hostRef.$onInstancePromise$ = new Promise(r => (hostRef.$onInstanceResolve$ = r));
|
|
1615
|
+
hostRef.$onInstancePromise$ = new Promise((r) => (hostRef.$onInstanceResolve$ = r));
|
|
1561
1616
|
}
|
|
1562
1617
|
{
|
|
1563
|
-
hostRef.$onReadyPromise$ = new Promise(r => (hostRef.$onReadyResolve$ = r));
|
|
1618
|
+
hostRef.$onReadyPromise$ = new Promise((r) => (hostRef.$onReadyResolve$ = r));
|
|
1564
1619
|
elm['s-p'] = [];
|
|
1565
1620
|
elm['s-rc'] = [];
|
|
1566
1621
|
}
|
|
@@ -1568,13 +1623,13 @@ const registerHost = (elm, cmpMeta) => {
|
|
|
1568
1623
|
return hostRefs.set(elm, hostRef);
|
|
1569
1624
|
};
|
|
1570
1625
|
const isMemberInElement = (elm, memberName) => memberName in elm;
|
|
1571
|
-
const consoleError = (e, el) => (
|
|
1626
|
+
const consoleError = (e, el) => (0, console.error)(e, el);
|
|
1572
1627
|
const cmpModules = /*@__PURE__*/ new Map();
|
|
1573
1628
|
const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
1574
1629
|
// loadModuleImport
|
|
1575
1630
|
const exportName = cmpMeta.$tagName$.replace(/-/g, '_');
|
|
1576
1631
|
const bundleId = cmpMeta.$lazyBundleId$;
|
|
1577
|
-
const module =
|
|
1632
|
+
const module = cmpModules.get(bundleId) ;
|
|
1578
1633
|
if (module) {
|
|
1579
1634
|
return module[exportName];
|
|
1580
1635
|
}
|
|
@@ -1582,7 +1637,7 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
|
1582
1637
|
/* webpackInclude: /\.entry\.js$/ */
|
|
1583
1638
|
/* webpackExclude: /\.system\.entry\.js$/ */
|
|
1584
1639
|
/* webpackMode: "lazy" */
|
|
1585
|
-
`./${bundleId}.entry.js${
|
|
1640
|
+
`./${bundleId}.entry.js${''}`)); }).then((importedModule) => {
|
|
1586
1641
|
{
|
|
1587
1642
|
cmpModules.set(bundleId, importedModule);
|
|
1588
1643
|
}
|