@tarojs/components 3.3.9 → 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 +37 -12
- 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 +5 -7
- 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/picker/picker-group.js +59 -9
- package/dist/collection/components/swiper/swiper.js +7 -1
- package/dist/collection/components/tabbar/tabbar.js +2 -4
- 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 +37 -12
- 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 +5 -7
- 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-f9013b36.system.entry.js +1 -0
- 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/picker/picker-group.d.ts +7 -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/dist-h5/react/utils/reactify-wc.js +1 -0
- package/loader/index.d.ts +0 -1
- package/package.json +5 -4
- package/types/Camera.d.ts +7 -7
- package/types/LivePusher.d.ts +51 -3
- package/types/Map.d.ts +11 -1
- package/types/PickerView.d.ts +7 -7
- package/types/Swiper.d.ts +2 -0
- package/dist/esm-es5/index-310de3d5.js +0 -1
- package/dist/taro-components/p-153b839d.system.entry.js +0 -1
- package/dist/taro-components/p-180fd001.entry.js +0 -1
- package/dist/taro-components/p-1925bbdb.entry.js +0 -1
- package/dist/taro-components/p-1f44e8ef.system.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-3bda72b4.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-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-82185d54.system.entry.js +0 -1
- package/dist/taro-components/p-8676c058.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
|
@@ -12,26 +12,26 @@ const doc = win.document || { head: {} };
|
|
|
12
12
|
const plt = {
|
|
13
13
|
$flags$: 0,
|
|
14
14
|
$resourcesUrl$: '',
|
|
15
|
-
jmp: h => h(),
|
|
16
|
-
raf: h => requestAnimationFrame(h),
|
|
15
|
+
jmp: (h) => h(),
|
|
16
|
+
raf: (h) => requestAnimationFrame(h),
|
|
17
17
|
ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
|
|
18
18
|
rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
|
|
19
19
|
ce: (eventName, opts) => new CustomEvent(eventName, opts),
|
|
20
20
|
};
|
|
21
21
|
const promiseResolve = (v) => Promise.resolve(v);
|
|
22
|
-
const supportsConstructibleStylesheets =
|
|
22
|
+
const supportsConstructibleStylesheets = /*@__PURE__*/ (() => {
|
|
23
23
|
try {
|
|
24
24
|
new CSSStyleSheet();
|
|
25
|
-
return typeof
|
|
25
|
+
return typeof new CSSStyleSheet().replace === 'function';
|
|
26
26
|
}
|
|
27
27
|
catch (e) { }
|
|
28
28
|
return false;
|
|
29
29
|
})()
|
|
30
30
|
;
|
|
31
31
|
const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
|
|
32
|
-
if (
|
|
32
|
+
if (listeners) {
|
|
33
33
|
listeners.map(([flags, name, method]) => {
|
|
34
|
-
const target =
|
|
34
|
+
const target = getHostListenerTarget(elm, flags) ;
|
|
35
35
|
const handler = hostListenerProxy(hostRef, method);
|
|
36
36
|
const opts = hostListenerOpts(flags);
|
|
37
37
|
plt.ael(target, name, handler, opts);
|
|
@@ -56,12 +56,12 @@ const hostListenerProxy = (hostRef, methodName) => (ev) => {
|
|
|
56
56
|
}
|
|
57
57
|
};
|
|
58
58
|
const getHostListenerTarget = (elm, flags) => {
|
|
59
|
-
if (
|
|
59
|
+
if (flags & 4 /* TargetDocument */)
|
|
60
60
|
return doc;
|
|
61
61
|
return elm;
|
|
62
62
|
};
|
|
63
63
|
// prettier-ignore
|
|
64
|
-
const hostListenerOpts = (flags) =>
|
|
64
|
+
const hostListenerOpts = (flags) => (flags & 2 /* Capture */) !== 0;
|
|
65
65
|
const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
|
|
66
66
|
const XLINK_NS = 'http://www.w3.org/1999/xlink';
|
|
67
67
|
const createTime = (fnName, tagName = '') => {
|
|
@@ -117,7 +117,7 @@ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
|
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
|
-
else if (
|
|
120
|
+
else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
|
|
121
121
|
styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
|
|
122
122
|
}
|
|
123
123
|
}
|
|
@@ -127,10 +127,10 @@ const attachStyles = (hostRef) => {
|
|
|
127
127
|
const cmpMeta = hostRef.$cmpMeta$;
|
|
128
128
|
const elm = hostRef.$hostElement$;
|
|
129
129
|
const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
|
|
130
|
-
|
|
130
|
+
addStyle(elm.getRootNode(), cmpMeta);
|
|
131
131
|
endAttachStyles();
|
|
132
132
|
};
|
|
133
|
-
const getScopeId = (cmp, mode) => 'sc-' + (
|
|
133
|
+
const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
|
|
134
134
|
/**
|
|
135
135
|
* Default style mode id
|
|
136
136
|
*/
|
|
@@ -187,10 +187,10 @@ const h = (nodeName, vnodeData, ...children) => {
|
|
|
187
187
|
walk(children);
|
|
188
188
|
if (vnodeData) {
|
|
189
189
|
// normalize class / classname attributes
|
|
190
|
-
if (
|
|
190
|
+
if (vnodeData.key) {
|
|
191
191
|
key = vnodeData.key;
|
|
192
192
|
}
|
|
193
|
-
if (
|
|
193
|
+
if (vnodeData.name) {
|
|
194
194
|
slotName = vnodeData.name;
|
|
195
195
|
}
|
|
196
196
|
{
|
|
@@ -200,12 +200,12 @@ const h = (nodeName, vnodeData, ...children) => {
|
|
|
200
200
|
typeof classData !== 'object'
|
|
201
201
|
? classData
|
|
202
202
|
: Object.keys(classData)
|
|
203
|
-
.filter(k => classData[k])
|
|
203
|
+
.filter((k) => classData[k])
|
|
204
204
|
.join(' ');
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
|
-
if (
|
|
208
|
+
if (typeof nodeName === 'function') {
|
|
209
209
|
// nodeName is a functional component
|
|
210
210
|
return nodeName(vnodeData === null ? {} : vnodeData, vNodeChildren, vdomFnUtils);
|
|
211
211
|
}
|
|
@@ -285,19 +285,19 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
285
285
|
if (oldValue !== newValue) {
|
|
286
286
|
let isProp = isMemberInElement(elm, memberName);
|
|
287
287
|
let ln = memberName.toLowerCase();
|
|
288
|
-
if (
|
|
288
|
+
if (memberName === 'class') {
|
|
289
289
|
const classList = elm.classList;
|
|
290
290
|
const oldClasses = parseClassList(oldValue);
|
|
291
291
|
const newClasses = parseClassList(newValue);
|
|
292
|
-
classList.remove(...oldClasses.filter(c => c && !newClasses.includes(c)));
|
|
293
|
-
classList.add(...newClasses.filter(c => c && !oldClasses.includes(c)));
|
|
292
|
+
classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
|
|
293
|
+
classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
|
|
294
294
|
}
|
|
295
|
-
else if (
|
|
295
|
+
else if (memberName === 'style') {
|
|
296
296
|
// update style attribute, css properties and values
|
|
297
297
|
{
|
|
298
298
|
for (const prop in oldValue) {
|
|
299
299
|
if (!newValue || newValue[prop] == null) {
|
|
300
|
-
if (
|
|
300
|
+
if (prop.includes('-')) {
|
|
301
301
|
elm.style.removeProperty(prop);
|
|
302
302
|
}
|
|
303
303
|
else {
|
|
@@ -308,7 +308,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
308
308
|
}
|
|
309
309
|
for (const prop in newValue) {
|
|
310
310
|
if (!oldValue || newValue[prop] !== oldValue[prop]) {
|
|
311
|
-
if (
|
|
311
|
+
if (prop.includes('-')) {
|
|
312
312
|
elm.style.setProperty(prop, newValue[prop]);
|
|
313
313
|
}
|
|
314
314
|
else {
|
|
@@ -317,15 +317,17 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
317
317
|
}
|
|
318
318
|
}
|
|
319
319
|
}
|
|
320
|
-
else if (
|
|
320
|
+
else if (memberName === 'key')
|
|
321
321
|
;
|
|
322
|
-
else if (
|
|
322
|
+
else if (memberName === 'ref') {
|
|
323
323
|
// minifier will clean this up
|
|
324
324
|
if (newValue) {
|
|
325
325
|
newValue(elm);
|
|
326
326
|
}
|
|
327
327
|
}
|
|
328
|
-
else if (
|
|
328
|
+
else if ((!isProp ) &&
|
|
329
|
+
memberName[0] === 'o' &&
|
|
330
|
+
memberName[1] === 'n') {
|
|
329
331
|
// Event Handlers
|
|
330
332
|
// so if the member name starts with "on" and the 3rd characters is
|
|
331
333
|
// a capital letter, and it's not already a member on the element,
|
|
@@ -400,7 +402,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
400
402
|
}
|
|
401
403
|
if (newValue == null || newValue === false) {
|
|
402
404
|
if (newValue !== false || elm.getAttribute(memberName) === '') {
|
|
403
|
-
if (
|
|
405
|
+
if (xlink) {
|
|
404
406
|
elm.removeAttributeNS(XLINK_NS, memberName);
|
|
405
407
|
}
|
|
406
408
|
else {
|
|
@@ -410,7 +412,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
410
412
|
}
|
|
411
413
|
else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
|
|
412
414
|
newValue = newValue === true ? '' : newValue;
|
|
413
|
-
if (
|
|
415
|
+
if (xlink) {
|
|
414
416
|
elm.setAttributeNS(XLINK_NS, memberName, newValue);
|
|
415
417
|
}
|
|
416
418
|
else {
|
|
@@ -426,7 +428,9 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
|
|
|
426
428
|
// if the element passed in is a shadow root, which is a document fragment
|
|
427
429
|
// then we want to be adding attrs/props to the shadow root's "host" element
|
|
428
430
|
// if it's not a shadow root, then we add attrs/props to the same element
|
|
429
|
-
const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host
|
|
431
|
+
const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host
|
|
432
|
+
? newVnode.$elm$.host
|
|
433
|
+
: newVnode.$elm$;
|
|
430
434
|
const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
|
|
431
435
|
const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
|
|
432
436
|
{
|
|
@@ -449,7 +453,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
449
453
|
let elm;
|
|
450
454
|
let childNode;
|
|
451
455
|
let oldVNode;
|
|
452
|
-
if (
|
|
456
|
+
if (!useNativeShadowDom) {
|
|
453
457
|
// remember for later we need to check to relocate nodes
|
|
454
458
|
checkSlotRelocate = true;
|
|
455
459
|
if (newVNode.$tag$ === 'slot') {
|
|
@@ -460,17 +464,20 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
460
464
|
1 /* isSlotReference */;
|
|
461
465
|
}
|
|
462
466
|
}
|
|
463
|
-
if (
|
|
467
|
+
if (newVNode.$text$ !== null) {
|
|
464
468
|
// create text node
|
|
465
469
|
elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
|
|
466
470
|
}
|
|
467
|
-
else if (
|
|
471
|
+
else if (newVNode.$flags$ & 1 /* isSlotReference */) {
|
|
468
472
|
// create a slot reference node
|
|
469
|
-
elm = newVNode.$elm$ =
|
|
473
|
+
elm = newVNode.$elm$ =
|
|
474
|
+
doc.createTextNode('');
|
|
470
475
|
}
|
|
471
476
|
else {
|
|
472
477
|
// create element
|
|
473
|
-
elm = newVNode.$elm$ = (
|
|
478
|
+
elm = newVNode.$elm$ = (doc.createElement(newVNode.$flags$ & 2 /* isSlotFallback */
|
|
479
|
+
? 'slot-fb'
|
|
480
|
+
: newVNode.$tag$));
|
|
474
481
|
// add css classes, attrs, props, listeners, etc.
|
|
475
482
|
{
|
|
476
483
|
updateElement(null, newVNode, isSvgMode);
|
|
@@ -532,14 +539,14 @@ const putBackInOriginalLocation = (parentElm, recursive) => {
|
|
|
532
539
|
plt.$flags$ &= ~1 /* isTmpDisconnected */;
|
|
533
540
|
};
|
|
534
541
|
const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
|
|
535
|
-
let containerElm = ((
|
|
542
|
+
let containerElm = ((parentElm['s-cr'] && parentElm['s-cr'].parentNode) || parentElm);
|
|
536
543
|
let childNode;
|
|
537
544
|
for (; startIdx <= endIdx; ++startIdx) {
|
|
538
545
|
if (vnodes[startIdx]) {
|
|
539
546
|
childNode = createElm(null, parentVNode, startIdx);
|
|
540
547
|
if (childNode) {
|
|
541
548
|
vnodes[startIdx].$elm$ = childNode;
|
|
542
|
-
containerElm.insertBefore(childNode,
|
|
549
|
+
containerElm.insertBefore(childNode, referenceNode(before) );
|
|
543
550
|
}
|
|
544
551
|
}
|
|
545
552
|
}
|
|
@@ -607,7 +614,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
607
614
|
}
|
|
608
615
|
else if (isSameVnode(oldStartVnode, newEndVnode)) {
|
|
609
616
|
// Vnode moved right
|
|
610
|
-
if (
|
|
617
|
+
if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
|
|
611
618
|
putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
|
|
612
619
|
}
|
|
613
620
|
patch(oldStartVnode, newEndVnode);
|
|
@@ -617,7 +624,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
617
624
|
}
|
|
618
625
|
else if (isSameVnode(oldEndVnode, newStartVnode)) {
|
|
619
626
|
// Vnode moved left
|
|
620
|
-
if (
|
|
627
|
+
if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
|
|
621
628
|
putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
|
|
622
629
|
}
|
|
623
630
|
patch(oldEndVnode, newStartVnode);
|
|
@@ -636,7 +643,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
636
643
|
}
|
|
637
644
|
}
|
|
638
645
|
}
|
|
639
|
-
if (
|
|
646
|
+
if (idxInOld >= 0) {
|
|
640
647
|
elmToMove = oldCh[idxInOld];
|
|
641
648
|
if (elmToMove.$tag$ !== newStartVnode.$tag$) {
|
|
642
649
|
node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld);
|
|
@@ -663,7 +670,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
663
670
|
if (oldStartIdx > oldEndIdx) {
|
|
664
671
|
addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
|
|
665
672
|
}
|
|
666
|
-
else if (
|
|
673
|
+
else if (newStartIdx > newEndIdx) {
|
|
667
674
|
removeVnodes(oldCh, oldStartIdx, oldEndIdx);
|
|
668
675
|
}
|
|
669
676
|
};
|
|
@@ -671,7 +678,7 @@ const isSameVnode = (vnode1, vnode2) => {
|
|
|
671
678
|
// compare if two vnode to see if they're "technically" the same
|
|
672
679
|
// need to have the same element tag, and same key to be the same
|
|
673
680
|
if (vnode1.$tag$ === vnode2.$tag$) {
|
|
674
|
-
if (
|
|
681
|
+
if (vnode1.$tag$ === 'slot') {
|
|
675
682
|
return vnode1.$name$ === vnode2.$name$;
|
|
676
683
|
}
|
|
677
684
|
{
|
|
@@ -695,10 +702,10 @@ const patch = (oldVNode, newVNode) => {
|
|
|
695
702
|
const tag = newVNode.$tag$;
|
|
696
703
|
const text = newVNode.$text$;
|
|
697
704
|
let defaultHolder;
|
|
698
|
-
if (
|
|
705
|
+
if (text === null) {
|
|
699
706
|
// element node
|
|
700
707
|
{
|
|
701
|
-
if (
|
|
708
|
+
if (tag === 'slot')
|
|
702
709
|
;
|
|
703
710
|
else {
|
|
704
711
|
// either this is the first render of an element OR it's an update
|
|
@@ -707,29 +714,29 @@ const patch = (oldVNode, newVNode) => {
|
|
|
707
714
|
updateElement(oldVNode, newVNode, isSvgMode);
|
|
708
715
|
}
|
|
709
716
|
}
|
|
710
|
-
if (
|
|
717
|
+
if (oldChildren !== null && newChildren !== null) {
|
|
711
718
|
// looks like there's child vnodes for both the old and new vnodes
|
|
712
719
|
updateChildren(elm, oldChildren, newVNode, newChildren);
|
|
713
720
|
}
|
|
714
721
|
else if (newChildren !== null) {
|
|
715
722
|
// no old child vnodes, but there are new child vnodes to add
|
|
716
|
-
if (
|
|
723
|
+
if (oldVNode.$text$ !== null) {
|
|
717
724
|
// the old vnode was text, so be sure to clear it out
|
|
718
725
|
elm.textContent = '';
|
|
719
726
|
}
|
|
720
727
|
// add the new vnode children
|
|
721
728
|
addVnodes(elm, null, newVNode, newChildren, 0, newChildren.length - 1);
|
|
722
729
|
}
|
|
723
|
-
else if (
|
|
730
|
+
else if (oldChildren !== null) {
|
|
724
731
|
// no new child vnodes, but there are old child vnodes to remove
|
|
725
732
|
removeVnodes(oldChildren, 0, oldChildren.length - 1);
|
|
726
733
|
}
|
|
727
734
|
}
|
|
728
|
-
else if (
|
|
735
|
+
else if ((defaultHolder = elm['s-cr'])) {
|
|
729
736
|
// this element has slotted content
|
|
730
737
|
defaultHolder.parentNode.textContent = text;
|
|
731
738
|
}
|
|
732
|
-
else if (
|
|
739
|
+
else if (oldVNode.$text$ !== text) {
|
|
733
740
|
// update the text content for the text only vnode
|
|
734
741
|
// and also only if the text is different than before
|
|
735
742
|
elm.data = text;
|
|
@@ -807,7 +814,7 @@ const relocateSlotContent = (elm) => {
|
|
|
807
814
|
// that is suppose to always represent the original content location
|
|
808
815
|
if (isNodeLocatedInSlot(node, slotNameAttr)) {
|
|
809
816
|
// it's possible we've already decided to relocate this node
|
|
810
|
-
relocateNodeData = relocateNodes.find(r => r.$nodeToRelocate$ === node);
|
|
817
|
+
relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
|
|
811
818
|
// made some changes to slots
|
|
812
819
|
// let's make sure we also double check
|
|
813
820
|
// fallbacks are correctly hidden or shown
|
|
@@ -826,9 +833,9 @@ const relocateSlotContent = (elm) => {
|
|
|
826
833
|
});
|
|
827
834
|
}
|
|
828
835
|
if (node['s-sr']) {
|
|
829
|
-
relocateNodes.map(relocateNode => {
|
|
836
|
+
relocateNodes.map((relocateNode) => {
|
|
830
837
|
if (isNodeLocatedInSlot(relocateNode.$nodeToRelocate$, node['s-sn'])) {
|
|
831
|
-
relocateNodeData = relocateNodes.find(r => r.$nodeToRelocate$ === node);
|
|
838
|
+
relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
|
|
832
839
|
if (relocateNodeData && !relocateNode.$slotRefNode$) {
|
|
833
840
|
relocateNode.$slotRefNode$ = relocateNodeData.$slotRefNode$;
|
|
834
841
|
}
|
|
@@ -836,7 +843,7 @@ const relocateSlotContent = (elm) => {
|
|
|
836
843
|
});
|
|
837
844
|
}
|
|
838
845
|
}
|
|
839
|
-
else if (!relocateNodes.some(r => r.$nodeToRelocate$ === node)) {
|
|
846
|
+
else if (!relocateNodes.some((r) => r.$nodeToRelocate$ === node)) {
|
|
840
847
|
// so far this element does not have a slot home, not setting slotRefNode on purpose
|
|
841
848
|
// if we never find a home for this element then we'll need to hide it
|
|
842
849
|
relocateNodes.push({
|
|
@@ -881,10 +888,10 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
881
888
|
rootVnode.$tag$ = null;
|
|
882
889
|
rootVnode.$flags$ |= 4 /* isHost */;
|
|
883
890
|
hostRef.$vnode$ = rootVnode;
|
|
884
|
-
rootVnode.$elm$ = oldVNode.$elm$ = (
|
|
891
|
+
rootVnode.$elm$ = oldVNode.$elm$ = (hostElm);
|
|
885
892
|
{
|
|
886
893
|
contentRef = hostElm['s-cr'];
|
|
887
|
-
useNativeShadowDom =
|
|
894
|
+
useNativeShadowDom = (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) !== 0;
|
|
888
895
|
// always reset
|
|
889
896
|
checkSlotFallbackVisibility = false;
|
|
890
897
|
}
|
|
@@ -909,7 +916,8 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
909
916
|
if (!nodeToRelocate['s-ol']) {
|
|
910
917
|
// add a reference node marking this node's original location
|
|
911
918
|
// keep a reference to this node for later lookups
|
|
912
|
-
orgLocationNode =
|
|
919
|
+
orgLocationNode =
|
|
920
|
+
doc.createTextNode('');
|
|
913
921
|
orgLocationNode['s-nr'] = nodeToRelocate;
|
|
914
922
|
nodeToRelocate.parentNode.insertBefore((nodeToRelocate['s-ol'] = orgLocationNode), nodeToRelocate);
|
|
915
923
|
}
|
|
@@ -933,7 +941,8 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
933
941
|
}
|
|
934
942
|
}
|
|
935
943
|
}
|
|
936
|
-
if ((!insertBeforeNode && parentNodeRef !== nodeToRelocate.parentNode) ||
|
|
944
|
+
if ((!insertBeforeNode && parentNodeRef !== nodeToRelocate.parentNode) ||
|
|
945
|
+
nodeToRelocate.nextSibling !== insertBeforeNode) {
|
|
937
946
|
// we've checked that it's worth while to relocate
|
|
938
947
|
// since that the node to relocate
|
|
939
948
|
// has a different next sibling or parent relocated
|
|
@@ -965,7 +974,7 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
965
974
|
relocateNodes.length = 0;
|
|
966
975
|
}
|
|
967
976
|
};
|
|
968
|
-
const getElement = (ref) => (
|
|
977
|
+
const getElement = (ref) => (getHostRef(ref).$hostElement$ );
|
|
969
978
|
const createEvent = (ref, name, flags) => {
|
|
970
979
|
const elm = getElement(ref);
|
|
971
980
|
return {
|
|
@@ -979,21 +988,28 @@ const createEvent = (ref, name, flags) => {
|
|
|
979
988
|
},
|
|
980
989
|
};
|
|
981
990
|
};
|
|
991
|
+
/**
|
|
992
|
+
* Helper function to create & dispatch a custom Event on a provided target
|
|
993
|
+
* @param elm the target of the Event
|
|
994
|
+
* @param name the name to give the custom Event
|
|
995
|
+
* @param opts options for configuring a custom Event
|
|
996
|
+
* @returns the custom Event
|
|
997
|
+
*/
|
|
982
998
|
const emitEvent = (elm, name, opts) => {
|
|
983
999
|
const ev = plt.ce(name, opts);
|
|
984
1000
|
elm.dispatchEvent(ev);
|
|
985
1001
|
return ev;
|
|
986
1002
|
};
|
|
987
1003
|
const attachToAncestor = (hostRef, ancestorComponent) => {
|
|
988
|
-
if (
|
|
989
|
-
ancestorComponent['s-p'].push(new Promise(r => (hostRef.$onRenderResolve$ = r)));
|
|
1004
|
+
if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
|
|
1005
|
+
ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r)));
|
|
990
1006
|
}
|
|
991
1007
|
};
|
|
992
1008
|
const scheduleUpdate = (hostRef, isInitialLoad) => {
|
|
993
1009
|
{
|
|
994
1010
|
hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
|
|
995
1011
|
}
|
|
996
|
-
if (
|
|
1012
|
+
if (hostRef.$flags$ & 4 /* isWaitingForChildren */) {
|
|
997
1013
|
hostRef.$flags$ |= 512 /* needsRerender */;
|
|
998
1014
|
return;
|
|
999
1015
|
}
|
|
@@ -1002,11 +1018,11 @@ const scheduleUpdate = (hostRef, isInitialLoad) => {
|
|
|
1002
1018
|
// has already fired off its lifecycle update then
|
|
1003
1019
|
// fire off the initial update
|
|
1004
1020
|
const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
|
|
1005
|
-
return
|
|
1021
|
+
return writeTask(dispatch) ;
|
|
1006
1022
|
};
|
|
1007
1023
|
const dispatchHooks = (hostRef, isInitialLoad) => {
|
|
1008
1024
|
const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$);
|
|
1009
|
-
const instance =
|
|
1025
|
+
const instance = hostRef.$lazyInstance$ ;
|
|
1010
1026
|
let promise;
|
|
1011
1027
|
if (isInitialLoad) {
|
|
1012
1028
|
{
|
|
@@ -1033,7 +1049,7 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
|
1033
1049
|
const elm = hostRef.$hostElement$;
|
|
1034
1050
|
const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$);
|
|
1035
1051
|
const rc = elm['s-rc'];
|
|
1036
|
-
if (
|
|
1052
|
+
if (isInitialLoad) {
|
|
1037
1053
|
// DOM WRITE!
|
|
1038
1054
|
attachStyles(hostRef);
|
|
1039
1055
|
}
|
|
@@ -1041,11 +1057,11 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
|
1041
1057
|
{
|
|
1042
1058
|
callRender(hostRef, instance);
|
|
1043
1059
|
}
|
|
1044
|
-
if (
|
|
1060
|
+
if (rc) {
|
|
1045
1061
|
// ok, so turns out there are some child host elements
|
|
1046
1062
|
// waiting on this parent element to load
|
|
1047
1063
|
// let's fire off all update callbacks waiting
|
|
1048
|
-
rc.map(cb => cb());
|
|
1064
|
+
rc.map((cb) => cb());
|
|
1049
1065
|
elm['s-rc'] = undefined;
|
|
1050
1066
|
}
|
|
1051
1067
|
endRender();
|
|
@@ -1065,7 +1081,7 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
|
1065
1081
|
};
|
|
1066
1082
|
const callRender = (hostRef, instance, elm) => {
|
|
1067
1083
|
try {
|
|
1068
|
-
instance =
|
|
1084
|
+
instance = instance.render() ;
|
|
1069
1085
|
{
|
|
1070
1086
|
hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
|
|
1071
1087
|
}
|
|
@@ -1092,7 +1108,7 @@ const postUpdateComponent = (hostRef) => {
|
|
|
1092
1108
|
const tagName = hostRef.$cmpMeta$.$tagName$;
|
|
1093
1109
|
const elm = hostRef.$hostElement$;
|
|
1094
1110
|
const endPostUpdate = createTime('postUpdate', tagName);
|
|
1095
|
-
const instance =
|
|
1111
|
+
const instance = hostRef.$lazyInstance$ ;
|
|
1096
1112
|
const ancestorComponent = hostRef.$ancestorComponent$;
|
|
1097
1113
|
{
|
|
1098
1114
|
safeCall(instance, 'componentDidRender');
|
|
@@ -1161,20 +1177,21 @@ const safeCall = (instance, method, arg) => {
|
|
|
1161
1177
|
const then = (promise, thenFn) => {
|
|
1162
1178
|
return promise && promise.then ? promise.then(thenFn) : thenFn();
|
|
1163
1179
|
};
|
|
1164
|
-
const addHydratedFlag = (elm) =>
|
|
1180
|
+
const addHydratedFlag = (elm) => elm.classList.add('hydrated')
|
|
1181
|
+
;
|
|
1165
1182
|
const parsePropertyValue = (propValue, propType) => {
|
|
1166
1183
|
// ensure this value is of the correct prop type
|
|
1167
1184
|
if (propValue != null && !isComplexType(propValue)) {
|
|
1168
|
-
if (
|
|
1185
|
+
if (propType & 4 /* Boolean */) {
|
|
1169
1186
|
// per the HTML spec, any string value means it is a boolean true value
|
|
1170
1187
|
// but we'll cheat here and say that the string "false" is the boolean false
|
|
1171
1188
|
return propValue === 'false' ? false : propValue === '' || !!propValue;
|
|
1172
1189
|
}
|
|
1173
|
-
if (
|
|
1190
|
+
if (propType & 2 /* Number */) {
|
|
1174
1191
|
// force it to be a number
|
|
1175
1192
|
return parseFloat(propValue);
|
|
1176
1193
|
}
|
|
1177
|
-
if (
|
|
1194
|
+
if (propType & 1 /* String */) {
|
|
1178
1195
|
// could have been passed as a number or boolean
|
|
1179
1196
|
// but we still want it as a string
|
|
1180
1197
|
return String(propValue);
|
|
@@ -1190,22 +1207,22 @@ const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propNam
|
|
|
1190
1207
|
const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
1191
1208
|
// check our new property value against our internal value
|
|
1192
1209
|
const hostRef = getHostRef(ref);
|
|
1193
|
-
const elm =
|
|
1210
|
+
const elm = hostRef.$hostElement$ ;
|
|
1194
1211
|
const oldVal = hostRef.$instanceValues$.get(propName);
|
|
1195
1212
|
const flags = hostRef.$flags$;
|
|
1196
|
-
const instance =
|
|
1213
|
+
const instance = hostRef.$lazyInstance$ ;
|
|
1197
1214
|
newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
|
|
1198
|
-
if ((
|
|
1215
|
+
if ((!(flags & 8 /* isConstructingInstance */) || oldVal === undefined) && newVal !== oldVal) {
|
|
1199
1216
|
// gadzooks! the property's value has changed!!
|
|
1200
1217
|
// set our new value!
|
|
1201
1218
|
hostRef.$instanceValues$.set(propName, newVal);
|
|
1202
|
-
if (
|
|
1219
|
+
if (instance) {
|
|
1203
1220
|
// get an array of method names of watch functions to call
|
|
1204
|
-
if (
|
|
1221
|
+
if (cmpMeta.$watchers$ && flags & 128 /* isWatchReady */) {
|
|
1205
1222
|
const watchMethods = cmpMeta.$watchers$[propName];
|
|
1206
1223
|
if (watchMethods) {
|
|
1207
1224
|
// this instance is watching for when this property changed
|
|
1208
|
-
watchMethods.map(watchMethodName => {
|
|
1225
|
+
watchMethods.map((watchMethodName) => {
|
|
1209
1226
|
try {
|
|
1210
1227
|
// fire off each of the watch methods that are watching this property
|
|
1211
1228
|
instance[watchMethodName](newVal, oldVal, propName);
|
|
@@ -1216,7 +1233,7 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
1216
1233
|
});
|
|
1217
1234
|
}
|
|
1218
1235
|
}
|
|
1219
|
-
if (
|
|
1236
|
+
if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
|
|
1220
1237
|
// looks like this value actually changed, so we've got work to do!
|
|
1221
1238
|
// but only if we've already rendered, otherwise just chill out
|
|
1222
1239
|
// queue that we need to do an update, but don't worry about queuing
|
|
@@ -1227,15 +1244,16 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
1227
1244
|
}
|
|
1228
1245
|
};
|
|
1229
1246
|
const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
1230
|
-
if (
|
|
1231
|
-
if (
|
|
1247
|
+
if (cmpMeta.$members$) {
|
|
1248
|
+
if (Cstr.watchers) {
|
|
1232
1249
|
cmpMeta.$watchers$ = Cstr.watchers;
|
|
1233
1250
|
}
|
|
1234
1251
|
// It's better to have a const than two Object.entries()
|
|
1235
1252
|
const members = Object.entries(cmpMeta.$members$);
|
|
1236
1253
|
const prototype = Cstr.prototype;
|
|
1237
1254
|
members.map(([memberName, [memberFlags]]) => {
|
|
1238
|
-
if (
|
|
1255
|
+
if ((memberFlags & 31 /* Prop */ ||
|
|
1256
|
+
((flags & 2 /* proxyState */) && memberFlags & 32 /* State */))) {
|
|
1239
1257
|
// proxyComponent - prop
|
|
1240
1258
|
Object.defineProperty(prototype, memberName, {
|
|
1241
1259
|
get() {
|
|
@@ -1250,7 +1268,8 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1250
1268
|
enumerable: true,
|
|
1251
1269
|
});
|
|
1252
1270
|
}
|
|
1253
|
-
else if (
|
|
1271
|
+
else if (flags & 1 /* isElementConstructor */ &&
|
|
1272
|
+
memberFlags & 64 /* Method */) {
|
|
1254
1273
|
// proxyComponent - method
|
|
1255
1274
|
Object.defineProperty(prototype, memberName, {
|
|
1256
1275
|
value(...args) {
|
|
@@ -1260,11 +1279,48 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1260
1279
|
});
|
|
1261
1280
|
}
|
|
1262
1281
|
});
|
|
1263
|
-
if (
|
|
1282
|
+
if ((flags & 1 /* isElementConstructor */)) {
|
|
1264
1283
|
const attrNameToPropName = new Map();
|
|
1265
1284
|
prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
|
|
1266
1285
|
plt.jmp(() => {
|
|
1267
1286
|
const propName = attrNameToPropName.get(attrName);
|
|
1287
|
+
// In a webcomponent lifecyle the attributeChangedCallback runs prior to connectedCallback
|
|
1288
|
+
// in the case where an attribute was set inline.
|
|
1289
|
+
// ```html
|
|
1290
|
+
// <my-component some-attribute="some-value"></my-component>
|
|
1291
|
+
// ```
|
|
1292
|
+
//
|
|
1293
|
+
// There is an edge case where a developer sets the attribute inline on a custom element and then programatically
|
|
1294
|
+
// changes it before it has been upgraded as shown below:
|
|
1295
|
+
//
|
|
1296
|
+
// ```html
|
|
1297
|
+
// <!-- this component has _not_ been upgraded yet -->
|
|
1298
|
+
// <my-component id="test" some-attribute="some-value"></my-component>
|
|
1299
|
+
// <script>
|
|
1300
|
+
// // grab non-upgraded component
|
|
1301
|
+
// el = document.querySelector("#test");
|
|
1302
|
+
// el.someAttribute = "another-value";
|
|
1303
|
+
// // upgrade component
|
|
1304
|
+
// cutsomElements.define('my-component', MyComponent);
|
|
1305
|
+
// </script>
|
|
1306
|
+
// ```
|
|
1307
|
+
// In this case if we do not unshadow here and use the value of the shadowing property, attributeChangedCallback
|
|
1308
|
+
// will be called with `newValue = "some-value"` and will set the shadowed property (this.someAttribute = "another-value")
|
|
1309
|
+
// to the value that was set inline i.e. "some-value" from above example. When
|
|
1310
|
+
// the connectedCallback attempts to unshadow it will use "some-value" as the intial value rather than "another-value"
|
|
1311
|
+
//
|
|
1312
|
+
// The case where the attribute was NOT set inline but was not set programmatically shall be handled/unshadowed
|
|
1313
|
+
// by connectedCallback as this attributeChangedCallback will not fire.
|
|
1314
|
+
//
|
|
1315
|
+
// https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
|
|
1316
|
+
//
|
|
1317
|
+
// TODO(STENCIL-16) we should think about whether or not we actually want to be reflecting the attributes to
|
|
1318
|
+
// properties here given that this goes against best practices outlined here
|
|
1319
|
+
// https://developers.google.com/web/fundamentals/web-components/best-practices#avoid-reentrancy
|
|
1320
|
+
if (this.hasOwnProperty(propName)) {
|
|
1321
|
+
newValue = this[propName];
|
|
1322
|
+
delete this[propName];
|
|
1323
|
+
}
|
|
1268
1324
|
this[propName] = newValue === null && typeof this[propName] === 'boolean' ? false : newValue;
|
|
1269
1325
|
});
|
|
1270
1326
|
};
|
|
@@ -1283,7 +1339,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1283
1339
|
};
|
|
1284
1340
|
const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
|
|
1285
1341
|
// initializeComponent
|
|
1286
|
-
if (
|
|
1342
|
+
if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
|
|
1287
1343
|
{
|
|
1288
1344
|
// we haven't initialized this element yet
|
|
1289
1345
|
hostRef.$flags$ |= 32 /* hasInitializedComponent */;
|
|
@@ -1297,8 +1353,8 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1297
1353
|
Cstr = await Cstr;
|
|
1298
1354
|
endLoad();
|
|
1299
1355
|
}
|
|
1300
|
-
if (
|
|
1301
|
-
// we'
|
|
1356
|
+
if (!Cstr.isProxied) {
|
|
1357
|
+
// we've never proxied this Constructor before
|
|
1302
1358
|
// let's add the getters/setters to its prototype before
|
|
1303
1359
|
// the first time we create an instance of the implementation
|
|
1304
1360
|
{
|
|
@@ -1332,7 +1388,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1332
1388
|
}
|
|
1333
1389
|
endNewInstance();
|
|
1334
1390
|
}
|
|
1335
|
-
if (
|
|
1391
|
+
if (Cstr.style) {
|
|
1336
1392
|
// this component has styles but we haven't registered them yet
|
|
1337
1393
|
let style = Cstr.style;
|
|
1338
1394
|
const scopeId = getScopeId(cmpMeta);
|
|
@@ -1346,7 +1402,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1346
1402
|
// we've successfully created a lazy instance
|
|
1347
1403
|
const ancestorComponent = hostRef.$ancestorComponent$;
|
|
1348
1404
|
const schedule = () => scheduleUpdate(hostRef, true);
|
|
1349
|
-
if (
|
|
1405
|
+
if (ancestorComponent && ancestorComponent['s-rc']) {
|
|
1350
1406
|
// this is the intial load and this component it has an ancestor component
|
|
1351
1407
|
// but the ancestor component has NOT fired its will update lifecycle yet
|
|
1352
1408
|
// so let's just cool our jets and wait for the ancestor to continue first
|
|
@@ -1372,7 +1428,7 @@ const connectedCallback = (elm) => {
|
|
|
1372
1428
|
// if the slot polyfill is required we'll need to put some nodes
|
|
1373
1429
|
// in here to act as original content anchors as we move nodes around
|
|
1374
1430
|
// host element has been connected to the DOM
|
|
1375
|
-
if (
|
|
1431
|
+
if ((cmpMeta.$flags$ & (4 /* hasSlotRelocation */ | 8 /* needsShadowDomShim */))) {
|
|
1376
1432
|
setContentReference(elm);
|
|
1377
1433
|
}
|
|
1378
1434
|
}
|
|
@@ -1383,8 +1439,7 @@ const connectedCallback = (elm) => {
|
|
|
1383
1439
|
while ((ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host)) {
|
|
1384
1440
|
// climb up the ancestors looking for the first
|
|
1385
1441
|
// component that hasn't finished its lifecycle update yet
|
|
1386
|
-
if (
|
|
1387
|
-
ancestorComponent['s-p']) {
|
|
1442
|
+
if (ancestorComponent['s-p']) {
|
|
1388
1443
|
// we found this components first ancestor component
|
|
1389
1444
|
// keep a reference to this component's ancestor component
|
|
1390
1445
|
attachToAncestor(hostRef, (hostRef.$ancestorComponent$ = ancestorComponent));
|
|
@@ -1394,7 +1449,7 @@ const connectedCallback = (elm) => {
|
|
|
1394
1449
|
}
|
|
1395
1450
|
// Lazy properties
|
|
1396
1451
|
// https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
|
|
1397
|
-
if (
|
|
1452
|
+
if (cmpMeta.$members$) {
|
|
1398
1453
|
Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
|
|
1399
1454
|
if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
|
|
1400
1455
|
const value = elm[memberName];
|
|
@@ -1423,17 +1478,17 @@ const setContentReference = (elm) => {
|
|
|
1423
1478
|
// let's pick out the inner content for slot projection
|
|
1424
1479
|
// create a node to represent where the original
|
|
1425
1480
|
// content was first placed, which is useful later on
|
|
1426
|
-
const contentRefElm = (elm['s-cr'] = doc.createComment(
|
|
1481
|
+
const contentRefElm = (elm['s-cr'] = doc.createComment(''));
|
|
1427
1482
|
contentRefElm['s-cn'] = true;
|
|
1428
1483
|
elm.insertBefore(contentRefElm, elm.firstChild);
|
|
1429
1484
|
};
|
|
1430
1485
|
const disconnectedCallback = (elm) => {
|
|
1431
1486
|
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
|
|
1432
1487
|
const hostRef = getHostRef(elm);
|
|
1433
|
-
const instance =
|
|
1488
|
+
const instance = hostRef.$lazyInstance$ ;
|
|
1434
1489
|
{
|
|
1435
1490
|
if (hostRef.$rmListeners$) {
|
|
1436
|
-
hostRef.$rmListeners$.map(rmListener => rmListener());
|
|
1491
|
+
hostRef.$rmListeners$.map((rmListener) => rmListener());
|
|
1437
1492
|
hostRef.$rmListeners$ = undefined;
|
|
1438
1493
|
}
|
|
1439
1494
|
}
|
|
@@ -1455,7 +1510,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1455
1510
|
let isBootstrapping = true;
|
|
1456
1511
|
Object.assign(plt, options);
|
|
1457
1512
|
plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
|
|
1458
|
-
lazyBundles.map(lazyBundle => lazyBundle[1].map(compactMeta => {
|
|
1513
|
+
lazyBundles.map((lazyBundle) => lazyBundle[1].map((compactMeta) => {
|
|
1459
1514
|
const cmpMeta = {
|
|
1460
1515
|
$flags$: compactMeta[0],
|
|
1461
1516
|
$tagName$: compactMeta[1],
|
|
@@ -1471,7 +1526,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1471
1526
|
{
|
|
1472
1527
|
cmpMeta.$watchers$ = {};
|
|
1473
1528
|
}
|
|
1474
|
-
const tagName =
|
|
1529
|
+
const tagName = cmpMeta.$tagName$;
|
|
1475
1530
|
const HostElement = class extends HTMLElement {
|
|
1476
1531
|
// StencilLazyHost
|
|
1477
1532
|
constructor(self) {
|
|
@@ -1514,7 +1569,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1514
1569
|
// Process deferred connectedCallbacks now all components have been registered
|
|
1515
1570
|
isBootstrapping = false;
|
|
1516
1571
|
if (deferredConnectedCallbacks.length) {
|
|
1517
|
-
deferredConnectedCallbacks.map(host => host.connectedCallback());
|
|
1572
|
+
deferredConnectedCallbacks.map((host) => host.connectedCallback());
|
|
1518
1573
|
}
|
|
1519
1574
|
else {
|
|
1520
1575
|
{
|
|
@@ -1535,10 +1590,10 @@ const registerHost = (elm, cmpMeta) => {
|
|
|
1535
1590
|
$instanceValues$: new Map(),
|
|
1536
1591
|
};
|
|
1537
1592
|
{
|
|
1538
|
-
hostRef.$onInstancePromise$ = new Promise(r => (hostRef.$onInstanceResolve$ = r));
|
|
1593
|
+
hostRef.$onInstancePromise$ = new Promise((r) => (hostRef.$onInstanceResolve$ = r));
|
|
1539
1594
|
}
|
|
1540
1595
|
{
|
|
1541
|
-
hostRef.$onReadyPromise$ = new Promise(r => (hostRef.$onReadyResolve$ = r));
|
|
1596
|
+
hostRef.$onReadyPromise$ = new Promise((r) => (hostRef.$onReadyResolve$ = r));
|
|
1542
1597
|
elm['s-p'] = [];
|
|
1543
1598
|
elm['s-rc'] = [];
|
|
1544
1599
|
}
|
|
@@ -1546,13 +1601,13 @@ const registerHost = (elm, cmpMeta) => {
|
|
|
1546
1601
|
return hostRefs.set(elm, hostRef);
|
|
1547
1602
|
};
|
|
1548
1603
|
const isMemberInElement = (elm, memberName) => memberName in elm;
|
|
1549
|
-
const consoleError = (e, el) => (
|
|
1604
|
+
const consoleError = (e, el) => (0, console.error)(e, el);
|
|
1550
1605
|
const cmpModules = /*@__PURE__*/ new Map();
|
|
1551
1606
|
const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
1552
1607
|
// loadModuleImport
|
|
1553
1608
|
const exportName = cmpMeta.$tagName$.replace(/-/g, '_');
|
|
1554
1609
|
const bundleId = cmpMeta.$lazyBundleId$;
|
|
1555
|
-
const module =
|
|
1610
|
+
const module = cmpModules.get(bundleId) ;
|
|
1556
1611
|
if (module) {
|
|
1557
1612
|
return module[exportName];
|
|
1558
1613
|
}
|
|
@@ -1560,7 +1615,7 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
|
1560
1615
|
/* webpackInclude: /\.entry\.js$/ */
|
|
1561
1616
|
/* webpackExclude: /\.system\.entry\.js$/ */
|
|
1562
1617
|
/* webpackMode: "lazy" */
|
|
1563
|
-
`./${bundleId}.entry.js${
|
|
1618
|
+
`./${bundleId}.entry.js${''}`).then((importedModule) => {
|
|
1564
1619
|
{
|
|
1565
1620
|
cmpModules.set(bundleId, importedModule);
|
|
1566
1621
|
}
|