@swisspost/design-system-components 1.5.0 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/check-non-empty-ae713942.js +13 -0
- package/dist/cjs/check-non-empty-ae713942.js.map +1 -0
- package/dist/cjs/{check-one-of-4c2e8b2e.js → check-one-of-27ad3154.js} +1 -1
- package/dist/cjs/check-one-of-27ad3154.js.map +1 -0
- package/dist/cjs/constants-238701d3.js +7 -0
- package/dist/cjs/constants-238701d3.js.map +1 -0
- package/dist/cjs/fade-35a3633a.js +12 -0
- package/dist/cjs/fade-35a3633a.js.map +1 -0
- package/dist/cjs/index-b38a23e0.js +41 -0
- package/dist/cjs/index-b38a23e0.js.map +1 -0
- package/dist/cjs/{index-12cc37c9.js → index-b619e205.js} +245 -41
- package/dist/cjs/index-b619e205.js.map +1 -0
- package/dist/cjs/index.cjs.js +26 -0
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/loader.cjs.js +3 -12
- package/dist/cjs/loader.cjs.js.map +1 -1
- package/dist/cjs/package-7c4db872.js +7 -0
- package/dist/cjs/package-7c4db872.js.map +1 -0
- package/dist/cjs/post-accordion.cjs.entry.js +89 -0
- package/dist/cjs/post-accordion.cjs.entry.js.map +1 -0
- package/dist/cjs/post-alert-c037e6a3.js +101 -0
- package/dist/cjs/post-alert-c037e6a3.js.map +1 -0
- package/dist/cjs/post-alert.cjs.entry.js +9 -97
- package/dist/cjs/post-alert.cjs.entry.js.map +1 -1
- package/dist/cjs/post-collapsible-7c9d23a2.js +93 -0
- package/dist/cjs/post-collapsible-7c9d23a2.js.map +1 -0
- package/dist/cjs/post-collapsible.cjs.entry.js +7 -119
- package/dist/cjs/post-collapsible.cjs.entry.js.map +1 -1
- package/dist/cjs/post-components.cjs.js +3 -6
- package/dist/cjs/post-components.cjs.js.map +1 -1
- package/dist/cjs/post-icon-f418f76a.js +105 -0
- package/dist/cjs/post-icon-f418f76a.js.map +1 -0
- package/dist/cjs/post-icon.cjs.entry.js +8 -100
- package/dist/cjs/post-icon.cjs.entry.js.map +1 -1
- package/dist/cjs/post-tab-header-e08c2a42.js +33 -0
- package/dist/cjs/post-tab-header-e08c2a42.js.map +1 -0
- package/dist/cjs/post-tab-header.cjs.entry.js +6 -26
- package/dist/cjs/post-tab-header.cjs.entry.js.map +1 -1
- package/dist/cjs/post-tab-panel-721f7f32.js +27 -0
- package/dist/cjs/post-tab-panel-721f7f32.js.map +1 -0
- package/dist/cjs/post-tab-panel.cjs.entry.js +4 -20
- package/dist/cjs/post-tab-panel.cjs.entry.js.map +1 -1
- package/dist/cjs/post-tabs-4bcc867b.js +153 -0
- package/dist/cjs/post-tabs-4bcc867b.js.map +1 -0
- package/dist/cjs/post-tabs.cjs.entry.js +5 -127
- package/dist/cjs/post-tabs.cjs.entry.js.map +1 -1
- package/dist/cjs/post-tooltip-261c5cda.js +5095 -0
- package/dist/cjs/post-tooltip-261c5cda.js.map +1 -0
- package/dist/cjs/post-tooltip.cjs.entry.js +5 -5088
- package/dist/cjs/post-tooltip.cjs.entry.js.map +1 -1
- package/dist/collection/animations/collapse.js +13 -0
- package/dist/collection/animations/collapse.js.map +1 -0
- package/dist/collection/animations/fade.js +4 -4
- package/dist/collection/animations/fade.js.map +1 -1
- package/dist/collection/collection-manifest.json +10 -9
- package/dist/collection/components/post-accordion/post-accordion.css +1 -0
- package/dist/collection/components/post-accordion/post-accordion.js +178 -0
- package/dist/collection/components/post-accordion/post-accordion.js.map +1 -0
- package/dist/collection/components/post-alert/post-alert.css +6 -534
- package/dist/collection/components/post-alert/post-alert.js +10 -9
- package/dist/collection/components/post-alert/post-alert.js.map +1 -1
- package/dist/collection/components/post-collapsible/heading-levels.js +2 -0
- package/dist/collection/components/post-collapsible/heading-levels.js.map +1 -0
- package/dist/collection/components/post-collapsible/post-collapsible.css +1 -261
- package/dist/collection/components/post-collapsible/post-collapsible.js +65 -63
- package/dist/collection/components/post-collapsible/post-collapsible.js.map +1 -1
- package/dist/collection/components/post-icon/post-icon.css +1 -102
- package/dist/collection/components/post-icon/post-icon.js +5 -4
- package/dist/collection/components/post-icon/post-icon.js.map +1 -1
- package/dist/collection/components/post-tab-header/post-tab-header.css +3 -337
- package/dist/collection/components/post-tab-header/post-tab-header.js +6 -5
- package/dist/collection/components/post-tab-header/post-tab-header.js.map +1 -1
- package/dist/collection/components/post-tab-panel/post-tab-panel.css +1 -3
- package/dist/collection/components/post-tab-panel/post-tab-panel.js +2 -2
- package/dist/collection/components/post-tabs/post-tabs.css +1 -148
- package/dist/collection/components/post-tabs/post-tabs.js +36 -13
- package/dist/collection/components/post-tabs/post-tabs.js.map +1 -1
- package/dist/collection/components/post-tooltip/post-tooltip.css +1 -194
- package/dist/collection/components/post-tooltip/post-tooltip.js +22 -15
- package/dist/collection/components/post-tooltip/post-tooltip.js.map +1 -1
- package/dist/collection/index.js +8 -1
- package/dist/collection/index.js.map +1 -1
- package/dist/collection/utils/index.js +1 -3
- package/dist/collection/utils/index.js.map +1 -1
- package/dist/collection/utils/is-motion-reduced.js +4 -0
- package/dist/collection/utils/is-motion-reduced.js.map +1 -0
- package/dist/collection/utils/property-checkers/check-non-empty.js +1 -1
- package/dist/collection/utils/property-checkers/empty-or.js +1 -1
- package/dist/collection/utils/property-checkers/index.js +4 -4
- package/dist/components/check-non-empty.js +2 -2
- package/dist/components/check-non-empty.js.map +1 -1
- package/dist/components/check-one-of.js.map +1 -1
- package/dist/components/constants.js +5 -0
- package/dist/components/constants.js.map +1 -0
- package/dist/components/fade.js +4 -4
- package/dist/components/fade.js.map +1 -1
- package/dist/components/index.d.ts +6 -0
- package/dist/components/index.js +8 -1
- package/dist/components/index.js.map +1 -1
- package/dist/components/index2.js +36 -0
- package/dist/components/index2.js.map +1 -0
- package/dist/components/package.js +1 -1
- package/dist/components/post-accordion.d.ts +11 -0
- package/dist/components/post-accordion.js +108 -0
- package/dist/components/post-accordion.js.map +1 -0
- package/dist/components/post-alert.js +1 -129
- package/dist/components/post-alert.js.map +1 -1
- package/dist/components/post-alert2.js +138 -0
- package/dist/components/post-alert2.js.map +1 -0
- package/dist/components/post-collapsible.js +1 -146
- package/dist/components/post-collapsible.js.map +1 -1
- package/dist/components/post-collapsible2.js +117 -0
- package/dist/components/post-collapsible2.js.map +1 -0
- package/dist/components/post-icon2.js +12 -22
- package/dist/components/post-icon2.js.map +1 -1
- package/dist/components/post-tab-header.js +1 -45
- package/dist/components/post-tab-header.js.map +1 -1
- package/dist/components/post-tab-header2.js +51 -0
- package/dist/components/post-tab-header2.js.map +1 -0
- package/dist/components/post-tab-panel.js +1 -39
- package/dist/components/post-tab-panel.js.map +1 -1
- package/dist/components/post-tab-panel2.js +43 -0
- package/dist/components/post-tab-panel2.js.map +1 -0
- package/dist/components/post-tabs.js +1 -146
- package/dist/components/post-tabs.js.map +1 -1
- package/dist/components/post-tabs2.js +169 -0
- package/dist/components/post-tabs2.js.map +1 -0
- package/dist/components/post-tooltip.js +1 -5111
- package/dist/components/post-tooltip.js.map +1 -1
- package/dist/components/post-tooltip2.js +5117 -0
- package/dist/components/post-tooltip2.js.map +1 -0
- package/dist/docs.d.ts +334 -235
- package/dist/docs.json +458 -14
- package/dist/esm/check-non-empty-09c39561.js +11 -0
- package/dist/esm/check-non-empty-09c39561.js.map +1 -0
- package/dist/esm/{check-one-of-ded5e15e.js → check-one-of-74750af9.js} +1 -1
- package/dist/esm/check-one-of-74750af9.js.map +1 -0
- package/dist/esm/constants-8d548297.js +5 -0
- package/dist/esm/constants-8d548297.js.map +1 -0
- package/dist/esm/fade-7fd71785.js +9 -0
- package/dist/esm/fade-7fd71785.js.map +1 -0
- package/dist/esm/index-35921354.js +36 -0
- package/dist/esm/index-35921354.js.map +1 -0
- package/dist/esm/{index-5611074b.js → index-4eff5fc5.js} +245 -41
- package/dist/esm/index-4eff5fc5.js.map +1 -0
- package/dist/esm/index.js +14 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/loader.js +4 -13
- package/dist/esm/loader.js.map +1 -1
- package/dist/esm/package-3bbdb32c.js +5 -0
- package/dist/esm/package-3bbdb32c.js.map +1 -0
- package/dist/esm/post-accordion.entry.js +85 -0
- package/dist/esm/post-accordion.entry.js.map +1 -0
- package/dist/esm/post-alert-5dd43c8b.js +99 -0
- package/dist/esm/post-alert-5dd43c8b.js.map +1 -0
- package/dist/esm/post-alert.entry.js +8 -100
- package/dist/esm/post-alert.entry.js.map +1 -1
- package/dist/esm/post-collapsible-26dc2340.js +91 -0
- package/dist/esm/post-collapsible-26dc2340.js.map +1 -0
- package/dist/esm/post-collapsible.entry.js +6 -122
- package/dist/esm/post-collapsible.entry.js.map +1 -1
- package/dist/esm/post-components.js +4 -7
- package/dist/esm/post-components.js.map +1 -1
- package/dist/esm/post-icon-fb0eb8aa.js +103 -0
- package/dist/esm/post-icon-fb0eb8aa.js.map +1 -0
- package/dist/esm/post-icon.entry.js +7 -103
- package/dist/esm/post-icon.entry.js.map +1 -1
- package/dist/esm/post-tab-header-deebc551.js +31 -0
- package/dist/esm/post-tab-header-deebc551.js.map +1 -0
- package/dist/esm/post-tab-header.entry.js +5 -29
- package/dist/esm/post-tab-header.entry.js.map +1 -1
- package/dist/esm/post-tab-panel-4b820f71.js +25 -0
- package/dist/esm/post-tab-panel-4b820f71.js.map +1 -0
- package/dist/esm/post-tab-panel.entry.js +3 -23
- package/dist/esm/post-tab-panel.entry.js.map +1 -1
- package/dist/esm/post-tabs-2d8d6a33.js +151 -0
- package/dist/esm/post-tabs-2d8d6a33.js.map +1 -0
- package/dist/esm/post-tabs.entry.js +4 -130
- package/dist/esm/post-tabs.entry.js.map +1 -1
- package/dist/esm/post-tooltip-811309c5.js +5093 -0
- package/dist/esm/post-tooltip-811309c5.js.map +1 -0
- package/dist/esm/post-tooltip.entry.js +4 -5091
- package/dist/esm/post-tooltip.entry.js.map +1 -1
- package/dist/post-components/index.esm.js +1 -1
- package/dist/post-components/{p-2b6ab354.entry.js → p-01e8dfe6.js} +3 -3
- package/dist/post-components/p-01e8dfe6.js.map +1 -0
- package/dist/post-components/p-0a49c1a3.entry.js +2 -0
- package/dist/post-components/{p-bcc705f1.js → p-1339f8cd.js} +1 -1
- package/dist/post-components/p-1339f8cd.js.map +1 -0
- package/dist/post-components/p-1a8a8ef2.js +2 -0
- package/dist/post-components/p-1a8a8ef2.js.map +1 -0
- package/dist/post-components/p-27092ac3.entry.js +2 -0
- package/dist/post-components/p-27092ac3.entry.js.map +1 -0
- package/dist/post-components/{p-e5306504.js → p-2737eaf5.js} +1 -1
- package/dist/post-components/p-2737eaf5.js.map +1 -0
- package/dist/post-components/p-332eef46.js +2 -0
- package/dist/post-components/p-332eef46.js.map +1 -0
- package/dist/post-components/p-440193f4.js +2 -0
- package/dist/post-components/p-440193f4.js.map +1 -0
- package/dist/post-components/p-541142fd.js +2 -0
- package/dist/post-components/p-541142fd.js.map +1 -0
- package/dist/post-components/p-574acdb0.js +2 -0
- package/dist/post-components/p-574acdb0.js.map +1 -0
- package/dist/post-components/p-66460e3f.entry.js +2 -0
- package/dist/post-components/p-66460e3f.entry.js.map +1 -0
- package/dist/post-components/p-810ee105.entry.js +2 -0
- package/dist/post-components/p-810ee105.entry.js.map +1 -0
- package/dist/post-components/p-939df031.entry.js +2 -0
- package/dist/post-components/p-939df031.entry.js.map +1 -0
- package/dist/post-components/p-94b3f291.entry.js +2 -0
- package/dist/post-components/p-94b3f291.entry.js.map +1 -0
- package/dist/post-components/p-97000cb6.js +2 -0
- package/dist/post-components/p-97000cb6.js.map +1 -0
- package/dist/post-components/p-a7649277.js +3 -0
- package/dist/post-components/p-a7649277.js.map +1 -0
- package/dist/post-components/p-abd149b3.entry.js +2 -0
- package/dist/post-components/p-abd149b3.entry.js.map +1 -0
- package/dist/post-components/p-b531475e.js +2 -0
- package/dist/post-components/p-b531475e.js.map +1 -0
- package/dist/post-components/p-c6b73d6e.js +2 -0
- package/dist/post-components/p-c6b73d6e.js.map +1 -0
- package/dist/post-components/{p-29535fea.entry.js → p-d4fb9f16.js} +2 -2
- package/dist/post-components/p-d4fb9f16.js.map +1 -0
- package/dist/post-components/p-dfe29f7f.js +2 -0
- package/dist/post-components/p-dfe29f7f.js.map +1 -0
- package/dist/post-components/p-e9dc9039.entry.js +2 -0
- package/dist/post-components/p-e9dc9039.entry.js.map +1 -0
- package/dist/post-components/post-components.esm.js +1 -1
- package/dist/post-components/post-components.esm.js.map +1 -1
- package/dist/types/animations/collapse.d.ts +2 -0
- package/dist/types/components/post-accordion/post-accordion.d.ts +28 -0
- package/dist/types/components/post-alert/post-alert.d.ts +1 -1
- package/dist/types/components/post-collapsible/heading-levels.d.ts +2 -0
- package/dist/types/components/post-collapsible/post-collapsible.d.ts +16 -12
- package/dist/types/components/post-tabs/post-tabs.d.ts +1 -0
- package/dist/types/components.d.ts +79 -3
- package/dist/types/index.d.ts +7 -0
- package/dist/types/stencil-public-runtime.d.ts +38 -5
- package/dist/types/utils/index.d.ts +1 -3
- package/dist/types/utils/is-motion-reduced.d.ts +1 -0
- package/loader/index.d.ts +1 -1
- package/package.json +8 -8
- package/dist/cjs/check-non-empty-35b4d0b5.js +0 -14
- package/dist/cjs/check-non-empty-35b4d0b5.js.map +0 -1
- package/dist/cjs/check-one-of-4c2e8b2e.js.map +0 -1
- package/dist/cjs/check-type-508a21a5.js +0 -18
- package/dist/cjs/check-type-508a21a5.js.map +0 -1
- package/dist/cjs/fade-8c6d4fa7.js +0 -12
- package/dist/cjs/fade-8c6d4fa7.js.map +0 -1
- package/dist/cjs/index-12cc37c9.js.map +0 -1
- package/dist/cjs/index-f8f6f146.js +0 -28
- package/dist/cjs/index-f8f6f146.js.map +0 -1
- package/dist/cjs/package-67091813.js +0 -7
- package/dist/cjs/package-67091813.js.map +0 -1
- package/dist/collection/utils/get-element-height.js +0 -12
- package/dist/collection/utils/get-element-height.js.map +0 -1
- package/dist/collection/utils/on-transition-end.js +0 -15
- package/dist/collection/utils/on-transition-end.js.map +0 -1
- package/dist/collection/utils/should-reduce-motion.js +0 -4
- package/dist/collection/utils/should-reduce-motion.js.map +0 -1
- package/dist/components/check-type.js +0 -16
- package/dist/components/check-type.js.map +0 -1
- package/dist/esm/check-non-empty-554bdf88.js +0 -11
- package/dist/esm/check-non-empty-554bdf88.js.map +0 -1
- package/dist/esm/check-one-of-ded5e15e.js.map +0 -1
- package/dist/esm/check-type-18ebb4e7.js +0 -16
- package/dist/esm/check-type-18ebb4e7.js.map +0 -1
- package/dist/esm/fade-671f1489.js +0 -9
- package/dist/esm/fade-671f1489.js.map +0 -1
- package/dist/esm/index-5611074b.js.map +0 -1
- package/dist/esm/index-7f723686.js +0 -24
- package/dist/esm/index-7f723686.js.map +0 -1
- package/dist/esm/package-f5cb3167.js +0 -5
- package/dist/esm/package-f5cb3167.js.map +0 -1
- package/dist/esm/polyfills/css-shim.js +0 -1
- package/dist/post-components/p-12046db8.entry.js +0 -2
- package/dist/post-components/p-12046db8.entry.js.map +0 -1
- package/dist/post-components/p-15fc087f.js +0 -2
- package/dist/post-components/p-15fc087f.js.map +0 -1
- package/dist/post-components/p-24b07f64.js +0 -2
- package/dist/post-components/p-29535fea.entry.js.map +0 -1
- package/dist/post-components/p-296af738.entry.js +0 -2
- package/dist/post-components/p-296af738.entry.js.map +0 -1
- package/dist/post-components/p-2b6ab354.entry.js.map +0 -1
- package/dist/post-components/p-75a7b352.js +0 -2
- package/dist/post-components/p-75a7b352.js.map +0 -1
- package/dist/post-components/p-a14ec7bb.entry.js +0 -2
- package/dist/post-components/p-a14ec7bb.entry.js.map +0 -1
- package/dist/post-components/p-bcc705f1.js.map +0 -1
- package/dist/post-components/p-c7497ecb.entry.js +0 -2
- package/dist/post-components/p-c7497ecb.entry.js.map +0 -1
- package/dist/post-components/p-c8efe0ae.js +0 -2
- package/dist/post-components/p-c8efe0ae.js.map +0 -1
- package/dist/post-components/p-cc6e4eb8.entry.js +0 -2
- package/dist/post-components/p-cc6e4eb8.entry.js.map +0 -1
- package/dist/post-components/p-d94db268.js +0 -3
- package/dist/post-components/p-d94db268.js.map +0 -1
- package/dist/post-components/p-e5306504.js.map +0 -1
- package/dist/types/utils/get-element-height.d.ts +0 -3
- package/dist/types/utils/on-transition-end.d.ts +0 -1
- package/dist/types/utils/should-reduce-motion.d.ts +0 -1
- /package/dist/post-components/{p-24b07f64.js.map → p-0a49c1a3.entry.js.map} +0 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const constants = require('./constants-238701d3.js');
|
|
4
|
+
|
|
5
|
+
function checkNonEmpty(value, error) {
|
|
6
|
+
if (constants.EMPTY_VALUES.some(v => v === value)) {
|
|
7
|
+
throw new Error(error);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
exports.checkNonEmpty = checkNonEmpty;
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=check-non-empty-ae713942.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"check-non-empty-ae713942.js","mappings":";;;;SAEgB,aAAa,CAAC,KAAc,EAAE,KAAa;EACzD,IAAIA,sBAAY,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,KAAK,KAAK,CAAC,EAAE;IACvC,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC;GACxB;AACH;;;;","names":["EMPTY_VALUES"],"sources":["src/utils/property-checkers/check-non-empty.ts"],"sourcesContent":["import { EMPTY_VALUES } from './constants';\n\nexport function checkNonEmpty(value: unknown, error: string) {\n if (EMPTY_VALUES.some(v => v === value)) {\n throw new Error(error);\n }\n}\n"],"version":3}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"check-one-of-27ad3154.js","mappings":";;SAAgB,UAAU,CAAI,KAAQ,EAAE,cAA4B,EAAE,KAAa;EACjF,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,KAAK,CAAC;IAAE,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC;AAC9D;;;;","names":[],"sources":["src/utils/property-checkers/check-one-of.ts"],"sourcesContent":["export function checkOneOf<T>(value: T, possibleValues: readonly T[], error: string) {\n if (!possibleValues.includes(value)) throw new Error(error);\n}\n"],"version":3}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"constants-238701d3.js","mappings":";;MAAa,YAAY,GAAG,CAAC,SAAS,EAAE,IAAI,EAAE,EAAE;;;;","names":[],"sources":["src/utils/property-checkers/constants.ts"],"sourcesContent":["export const EMPTY_VALUES = [undefined, null, ''];\n"],"version":3}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const fadeDuration = 200;
|
|
4
|
+
const fadedOutKeyframe = { opacity: '0' };
|
|
5
|
+
const fadedInKeyframe = { opacity: '1' };
|
|
6
|
+
const fadeIn = (el) => el.animate([fadedOutKeyframe, fadedInKeyframe], { duration: fadeDuration });
|
|
7
|
+
const fadeOut = (el) => el.animate([fadedInKeyframe, fadedOutKeyframe], { duration: fadeDuration });
|
|
8
|
+
|
|
9
|
+
exports.fadeIn = fadeIn;
|
|
10
|
+
exports.fadeOut = fadeOut;
|
|
11
|
+
|
|
12
|
+
//# sourceMappingURL=fade-35a3633a.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"fade-35a3633a.js","mappings":";;AAAA,MAAM,YAAY,GAAG,GAAG,CAAC;AACzB,MAAM,gBAAgB,GAAa,EAAC,OAAO,EAAE,GAAG,EAAC,CAAC;AAClD,MAAM,eAAe,GAAa,EAAC,OAAO,EAAE,GAAG,EAAC,CAAC;MAEpC,MAAM,GAAG,CAAC,EAAW,KAAgB,EAAE,CAAC,OAAO,CAC1D,CAAE,gBAAgB,EAAE,eAAe,CAAE,EACrC,EAAE,QAAQ,EAAE,YAAY,EAAE,EAC1B;MAEW,OAAO,GAAG,CAAC,EAAW,KAAgB,EAAE,CAAC,OAAO,CAC3D,CAAE,eAAe,EAAE,gBAAgB,CAAE,EACrC,EAAE,QAAQ,EAAE,YAAY,EAAE;;;;;","names":[],"sources":["src/animations/fade.ts"],"sourcesContent":["const fadeDuration = 200;\nconst fadedOutKeyframe: Keyframe = {opacity: '0'};\nconst fadedInKeyframe: Keyframe = {opacity: '1'};\n\nexport const fadeIn = (el: Element): Animation => el.animate(\n [ fadedOutKeyframe, fadedInKeyframe ],\n { duration: fadeDuration }\n);\n\nexport const fadeOut = (el: Element): Animation => el.animate(\n [ fadedInKeyframe, fadedOutKeyframe ],\n { duration: fadeDuration }\n);\n"],"version":3}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const constants = require('./constants-238701d3.js');
|
|
4
|
+
const checkOneOf = require('./check-one-of-27ad3154.js');
|
|
5
|
+
|
|
6
|
+
function emptyOr(check) {
|
|
7
|
+
return (...args) => {
|
|
8
|
+
const value = args[0];
|
|
9
|
+
if (!constants.EMPTY_VALUES.some(v => v === value))
|
|
10
|
+
check(...args);
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function checkPattern(value, pattern, errorMessage) {
|
|
15
|
+
if (typeof value !== 'string' || !pattern.test(value))
|
|
16
|
+
throw new Error(errorMessage);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function checkType(value, type, error) {
|
|
20
|
+
const typeIsArray = type === 'array';
|
|
21
|
+
const valueIsArray = Array.isArray(value);
|
|
22
|
+
if (typeIsArray || valueIsArray) {
|
|
23
|
+
if (valueIsArray !== typeIsArray)
|
|
24
|
+
throw new Error(error);
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
if (typeof value !== type)
|
|
28
|
+
throw new Error(error);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const checkEmptyOrOneOf = emptyOr(checkOneOf.checkOneOf);
|
|
33
|
+
const checkEmptyOrPattern = emptyOr(checkPattern);
|
|
34
|
+
const checkEmptyOrType = emptyOr(checkType);
|
|
35
|
+
|
|
36
|
+
exports.checkEmptyOrOneOf = checkEmptyOrOneOf;
|
|
37
|
+
exports.checkEmptyOrPattern = checkEmptyOrPattern;
|
|
38
|
+
exports.checkEmptyOrType = checkEmptyOrType;
|
|
39
|
+
exports.checkType = checkType;
|
|
40
|
+
|
|
41
|
+
//# sourceMappingURL=index-b38a23e0.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"index-b38a23e0.js","mappings":";;;;;SAEgB,OAAO,CAAsB,KAA2B;EACtE,OAAO,CAAC,GAAG,IAAO;IAChB,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;IACtB,IAAI,CAACA,sBAAY,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,KAAK,KAAK,CAAC;MAAE,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;GAC1D,CAAC;AACJ;;SCPgB,YAAY,CAAC,KAAc,EAAE,OAAe,EAAE,YAAoB;EAChF,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC;IAAE,MAAM,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC;AACvF;;SCMgB,SAAS,CAAC,KAAc,EAAE,IAAkB,EAAE,KAAa;EACzE,MAAM,WAAW,GAAG,IAAI,KAAK,OAAO,CAAC;EACrC,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;EAE1C,IAAI,WAAW,IAAI,YAAY,EAAE;IAC/B,IAAI,YAAY,KAAK,WAAW;MAAE,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC;GAC1D;OAAM;IACL,IAAI,OAAO,KAAK,KAAK,IAAI;MAAE,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC;GACnD;AACH;;MCZa,iBAAiB,GAAG,OAAO,CAACC,qBAAU,EAAE;MACxC,mBAAmB,GAAG,OAAO,CAAC,YAAY,EAAE;MAC5C,gBAAgB,GAAG,OAAO,CAAC,SAAS;;;;;;;","names":["EMPTY_VALUES","checkOneOf"],"sources":["src/utils/property-checkers/empty-or.ts","src/utils/property-checkers/check-pattern.ts","src/utils/property-checkers/check-type.ts","src/utils/property-checkers/index.ts"],"sourcesContent":["import { EMPTY_VALUES } from './constants';\n\nexport function emptyOr<T extends unknown[]>(check: (...args: T) => void) {\n return (...args: T) => {\n const value = args[0];\n if (!EMPTY_VALUES.some(v => v === value)) check(...args);\n };\n}\n","export function checkPattern(value: unknown, pattern: RegExp, errorMessage: string) {\n if (typeof value !== 'string' || !pattern.test(value)) throw new Error(errorMessage);\n}\n","export type PropertyType =\n | 'boolean'\n | 'number'\n | 'string'\n | 'array'\n | 'object'\n | 'function';\n\nexport function checkType(value: unknown, type: PropertyType, error: string) {\n const typeIsArray = type === 'array';\n const valueIsArray = Array.isArray(value);\n\n if (typeIsArray || valueIsArray) {\n if (valueIsArray !== typeIsArray) throw new Error(error);\n } else {\n if (typeof value !== type) throw new Error(error);\n }\n}\n","import { emptyOr } from './empty-or';\nimport { checkOneOf } from './check-one-of';\nimport { checkPattern } from './check-pattern';\nimport { checkType } from './check-type';\n\nexport const checkEmptyOrOneOf = emptyOr(checkOneOf);\nexport const checkEmptyOrPattern = emptyOr(checkPattern);\nexport const checkEmptyOrType = emptyOr(checkType);\n\nexport * from './check-non-empty';\nexport * from './check-one-of';\nexport * from './check-pattern';\nexport * from './check-type';\n"],"version":3}
|
|
@@ -127,10 +127,10 @@ const h = (nodeName, vnodeData, ...children) => {
|
|
|
127
127
|
};
|
|
128
128
|
walk(children);
|
|
129
129
|
if (vnodeData) {
|
|
130
|
-
// normalize class / classname attributes
|
|
131
130
|
if (vnodeData.key) {
|
|
132
131
|
key = vnodeData.key;
|
|
133
132
|
}
|
|
133
|
+
// normalize class / className attributes
|
|
134
134
|
{
|
|
135
135
|
const classData = vnodeData.className || vnodeData.class;
|
|
136
136
|
if (classData) {
|
|
@@ -332,9 +332,9 @@ const registerStyle = (scopeId, cssText, allowCS) => {
|
|
|
332
332
|
}
|
|
333
333
|
styles.set(scopeId, style);
|
|
334
334
|
};
|
|
335
|
-
const addStyle = (styleContainerNode, cmpMeta, mode
|
|
335
|
+
const addStyle = (styleContainerNode, cmpMeta, mode) => {
|
|
336
336
|
var _a;
|
|
337
|
-
|
|
337
|
+
const scopeId = getScopeId(cmpMeta);
|
|
338
338
|
const style = styles.get(scopeId);
|
|
339
339
|
// if an element is NOT connected then getRootNode() will return the wrong root node
|
|
340
340
|
// so the fallback is to always use the document for the root node in those cases
|
|
@@ -349,11 +349,8 @@ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
|
|
|
349
349
|
}
|
|
350
350
|
if (!appliedStyles.has(scopeId)) {
|
|
351
351
|
{
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
styleElm = doc.createElement('style');
|
|
355
|
-
styleElm.innerHTML = style;
|
|
356
|
-
}
|
|
352
|
+
styleElm = doc.createElement('style');
|
|
353
|
+
styleElm.innerHTML = style;
|
|
357
354
|
// Apply CSP nonce to the style tag if it exists
|
|
358
355
|
const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
|
|
359
356
|
if (nonce != null) {
|
|
@@ -378,7 +375,6 @@ const attachStyles = (hostRef) => {
|
|
|
378
375
|
const flags = cmpMeta.$flags$;
|
|
379
376
|
const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
|
|
380
377
|
const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
|
|
381
|
-
// TODO(STENCIL-662): Remove code related to deprecated shadowDomShim field
|
|
382
378
|
if (flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
|
|
383
379
|
// only required when we're NOT using native shadow dom (slot)
|
|
384
380
|
// or this browser doesn't support native shadow dom
|
|
@@ -401,6 +397,21 @@ const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
|
|
|
401
397
|
*
|
|
402
398
|
* Modified for Stencil's compiler and vdom
|
|
403
399
|
*/
|
|
400
|
+
/**
|
|
401
|
+
* When running a VDom render set properties present on a VDom node onto the
|
|
402
|
+
* corresponding HTML element.
|
|
403
|
+
*
|
|
404
|
+
* Note that this function has special functionality for the `class`,
|
|
405
|
+
* `style`, `key`, and `ref` attributes, as well as event handlers (like
|
|
406
|
+
* `onClick`, etc). All others are just passed through as-is.
|
|
407
|
+
*
|
|
408
|
+
* @param elm the HTMLElement onto which attributes should be set
|
|
409
|
+
* @param memberName the name of the attribute to set
|
|
410
|
+
* @param oldValue the old value for the attribute
|
|
411
|
+
* @param newValue the new value for the attribute
|
|
412
|
+
* @param isSvg whether we're in an svg context or not
|
|
413
|
+
* @param flags bitflags for Vdom variables
|
|
414
|
+
*/
|
|
404
415
|
const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
405
416
|
if (oldValue !== newValue) {
|
|
406
417
|
let isProp = isMemberInElement(elm, memberName);
|
|
@@ -959,9 +970,9 @@ const patch = (oldVNode, newVNode) => {
|
|
|
959
970
|
}
|
|
960
971
|
};
|
|
961
972
|
/**
|
|
962
|
-
* 'Nullify' any VDom `ref` callbacks on a VDom node or its children by
|
|
963
|
-
*
|
|
964
|
-
*
|
|
973
|
+
* 'Nullify' any VDom `ref` callbacks on a VDom node or its children by calling
|
|
974
|
+
* them with `null`. This signals that the DOM element corresponding to the VDom
|
|
975
|
+
* node has been removed from the DOM.
|
|
965
976
|
*
|
|
966
977
|
* @param vNode a virtual DOM node
|
|
967
978
|
*/
|
|
@@ -982,12 +993,39 @@ const nullifyVNodeRefs = (vNode) => {
|
|
|
982
993
|
* @param hostRef data needed to root and render the virtual DOM tree, such as
|
|
983
994
|
* the DOM node into which it should be rendered.
|
|
984
995
|
* @param renderFnResults the virtual DOM nodes to be rendered
|
|
996
|
+
* @param isInitialLoad whether or not this is the first call after page load
|
|
985
997
|
*/
|
|
986
|
-
const renderVdom = (hostRef, renderFnResults) => {
|
|
998
|
+
const renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
|
|
987
999
|
const hostElm = hostRef.$hostElement$;
|
|
988
1000
|
const oldVNode = hostRef.$vnode$ || newVNode(null, null);
|
|
1001
|
+
// if `renderFnResults` is a Host node then we can use it directly. If not,
|
|
1002
|
+
// we need to call `h` again to wrap the children of our component in a
|
|
1003
|
+
// 'dummy' Host node (well, an empty vnode) since `renderVdom` assumes
|
|
1004
|
+
// implicitly that the top-level vdom node is 1) an only child and 2)
|
|
1005
|
+
// contains attrs that need to be set on the host element.
|
|
989
1006
|
const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
|
|
990
1007
|
hostTagName = hostElm.tagName;
|
|
1008
|
+
// On the first render and *only* on the first render we want to check for
|
|
1009
|
+
// any attributes set on the host element which are also set on the vdom
|
|
1010
|
+
// node. If we find them, we override the value on the VDom node attrs with
|
|
1011
|
+
// the value from the host element, which allows developers building apps
|
|
1012
|
+
// with Stencil components to override e.g. the `role` attribute on a
|
|
1013
|
+
// component even if it's already set on the `Host`.
|
|
1014
|
+
if (isInitialLoad && rootVnode.$attrs$) {
|
|
1015
|
+
for (const key of Object.keys(rootVnode.$attrs$)) {
|
|
1016
|
+
// We have a special implementation in `setAccessor` for `style` and
|
|
1017
|
+
// `class` which reconciles values coming from the VDom with values
|
|
1018
|
+
// already present on the DOM element, so we don't want to override those
|
|
1019
|
+
// attributes on the VDom tree with values from the host element if they
|
|
1020
|
+
// are present.
|
|
1021
|
+
//
|
|
1022
|
+
// Likewise, `ref` and `key` are special internal values for the Stencil
|
|
1023
|
+
// runtime and we don't want to override those either.
|
|
1024
|
+
if (hostElm.hasAttribute(key) && !['key', 'ref', 'style', 'class'].includes(key)) {
|
|
1025
|
+
rootVnode.$attrs$[key] = hostElm[key];
|
|
1026
|
+
}
|
|
1027
|
+
}
|
|
1028
|
+
}
|
|
991
1029
|
rootVnode.$tag$ = null;
|
|
992
1030
|
rootVnode.$flags$ |= 4 /* VNODE_FLAGS.isHost */;
|
|
993
1031
|
hostRef.$vnode$ = rootVnode;
|
|
@@ -1045,6 +1083,13 @@ const dispatchHooks = (hostRef, isInitialLoad) => {
|
|
|
1045
1083
|
// called in order after `dispatchHooks` exits.
|
|
1046
1084
|
let maybePromise;
|
|
1047
1085
|
if (isInitialLoad) {
|
|
1086
|
+
{
|
|
1087
|
+
hostRef.$flags$ |= 256 /* HOST_FLAGS.isListenReady */;
|
|
1088
|
+
if (hostRef.$queuedListeners$) {
|
|
1089
|
+
hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
|
|
1090
|
+
hostRef.$queuedListeners$ = undefined;
|
|
1091
|
+
}
|
|
1092
|
+
}
|
|
1048
1093
|
{
|
|
1049
1094
|
// If `componentWillLoad` returns a `Promise` then we want to wait on
|
|
1050
1095
|
// whatever's going on in that `Promise` before we launch into
|
|
@@ -1089,6 +1134,16 @@ const enqueue = (maybePromise, fn) => isPromisey(maybePromise) ? maybePromise.th
|
|
|
1089
1134
|
*/
|
|
1090
1135
|
const isPromisey = (maybePromise) => maybePromise instanceof Promise ||
|
|
1091
1136
|
(maybePromise && maybePromise.then && typeof maybePromise.then === 'function');
|
|
1137
|
+
/**
|
|
1138
|
+
* Update a component given reference to its host elements and so on.
|
|
1139
|
+
*
|
|
1140
|
+
* @param hostRef an object containing references to the element's host node,
|
|
1141
|
+
* VDom nodes, and other metadata
|
|
1142
|
+
* @param instance a reference to the underlying host element where it will be
|
|
1143
|
+
* rendered
|
|
1144
|
+
* @param isInitialLoad whether or not this function is being called as part of
|
|
1145
|
+
* the first render cycle
|
|
1146
|
+
*/
|
|
1092
1147
|
const updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
1093
1148
|
var _a;
|
|
1094
1149
|
const elm = hostRef.$hostElement$;
|
|
@@ -1100,7 +1155,7 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
|
1100
1155
|
}
|
|
1101
1156
|
const endRender = createTime('render', hostRef.$cmpMeta$.$tagName$);
|
|
1102
1157
|
{
|
|
1103
|
-
callRender(hostRef, instance);
|
|
1158
|
+
callRender(hostRef, instance, elm, isInitialLoad);
|
|
1104
1159
|
}
|
|
1105
1160
|
if (rc) {
|
|
1106
1161
|
// ok, so turns out there are some child host elements
|
|
@@ -1124,8 +1179,24 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
|
1124
1179
|
}
|
|
1125
1180
|
}
|
|
1126
1181
|
};
|
|
1127
|
-
|
|
1182
|
+
/**
|
|
1183
|
+
* Handle making the call to the VDom renderer with the proper context given
|
|
1184
|
+
* various build variables
|
|
1185
|
+
*
|
|
1186
|
+
* @param hostRef an object containing references to the element's host node,
|
|
1187
|
+
* VDom nodes, and other metadata
|
|
1188
|
+
* @param instance a reference to the underlying host element where it will be
|
|
1189
|
+
* rendered
|
|
1190
|
+
* @param elm the Host element for the component
|
|
1191
|
+
* @param isInitialLoad whether or not this function is being called as part of
|
|
1192
|
+
* @returns an empty promise
|
|
1193
|
+
*/
|
|
1194
|
+
const callRender = (hostRef, instance, elm, isInitialLoad) => {
|
|
1128
1195
|
try {
|
|
1196
|
+
/**
|
|
1197
|
+
* minification optimization: `allRenderFn` is `true` if all components have a `render`
|
|
1198
|
+
* method, so we can call the method immediately. If not, check before calling it.
|
|
1199
|
+
*/
|
|
1129
1200
|
instance = instance.render() ;
|
|
1130
1201
|
{
|
|
1131
1202
|
hostRef.$flags$ &= ~16 /* HOST_FLAGS.isQueuedForUpdate */;
|
|
@@ -1139,7 +1210,7 @@ const callRender = (hostRef, instance, elm) => {
|
|
|
1139
1210
|
// or we need to update the css class/attrs on the host element
|
|
1140
1211
|
// DOM WRITE!
|
|
1141
1212
|
{
|
|
1142
|
-
renderVdom(hostRef, instance);
|
|
1213
|
+
renderVdom(hostRef, instance, isInitialLoad);
|
|
1143
1214
|
}
|
|
1144
1215
|
}
|
|
1145
1216
|
}
|
|
@@ -1202,6 +1273,16 @@ const appDidLoad = (who) => {
|
|
|
1202
1273
|
}
|
|
1203
1274
|
nextTick(() => emitEvent(win, 'appload', { detail: { namespace: NAMESPACE } }));
|
|
1204
1275
|
};
|
|
1276
|
+
/**
|
|
1277
|
+
* Allows to safely call a method, e.g. `componentDidLoad`, on an instance,
|
|
1278
|
+
* e.g. custom element node. If a build figures out that e.g. no component
|
|
1279
|
+
* has a `componentDidLoad` method, the instance method gets removed from the
|
|
1280
|
+
* output bundle and this function returns `undefined`.
|
|
1281
|
+
* @param instance any object that may or may not contain methods
|
|
1282
|
+
* @param method method name
|
|
1283
|
+
* @param arg single arbitrary argument
|
|
1284
|
+
* @returns result of method call if it exists, otherwise `undefined`
|
|
1285
|
+
*/
|
|
1205
1286
|
const safeCall = (instance, method, arg) => {
|
|
1206
1287
|
if (instance && instance[method]) {
|
|
1207
1288
|
try {
|
|
@@ -1269,6 +1350,7 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
1269
1350
|
* @returns a reference to the same constructor passed in (but now mutated)
|
|
1270
1351
|
*/
|
|
1271
1352
|
const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
1353
|
+
var _a;
|
|
1272
1354
|
if (cmpMeta.$members$) {
|
|
1273
1355
|
if (Cstr.watchers) {
|
|
1274
1356
|
cmpMeta.$watchers$ = Cstr.watchers;
|
|
@@ -1306,7 +1388,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1306
1388
|
});
|
|
1307
1389
|
if ((flags & 1 /* PROXY_FLAGS.isElementConstructor */)) {
|
|
1308
1390
|
const attrNameToPropName = new Map();
|
|
1309
|
-
prototype.attributeChangedCallback = function (attrName,
|
|
1391
|
+
prototype.attributeChangedCallback = function (attrName, oldValue, newValue) {
|
|
1310
1392
|
plt.jmp(() => {
|
|
1311
1393
|
const propName = attrNameToPropName.get(attrName);
|
|
1312
1394
|
// In a web component lifecycle the attributeChangedCallback runs prior to connectedCallback
|
|
@@ -1329,12 +1411,12 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1329
1411
|
// customElements.define('my-component', MyComponent);
|
|
1330
1412
|
// </script>
|
|
1331
1413
|
// ```
|
|
1332
|
-
// In this case if we do not
|
|
1414
|
+
// In this case if we do not un-shadow here and use the value of the shadowing property, attributeChangedCallback
|
|
1333
1415
|
// will be called with `newValue = "some-value"` and will set the shadowed property (this.someAttribute = "another-value")
|
|
1334
1416
|
// to the value that was set inline i.e. "some-value" from above example. When
|
|
1335
|
-
// the connectedCallback attempts to
|
|
1417
|
+
// the connectedCallback attempts to un-shadow it will use "some-value" as the initial value rather than "another-value"
|
|
1336
1418
|
//
|
|
1337
|
-
// The case where the attribute was NOT set inline but was not set programmatically shall be handled/
|
|
1419
|
+
// The case where the attribute was NOT set inline but was not set programmatically shall be handled/un-shadowed
|
|
1338
1420
|
// by connectedCallback as this attributeChangedCallback will not fire.
|
|
1339
1421
|
//
|
|
1340
1422
|
// https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
|
|
@@ -1354,23 +1436,62 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1354
1436
|
// `propName` to be converted to a `DOMString`, which may not be what we want for other primitive props.
|
|
1355
1437
|
return;
|
|
1356
1438
|
}
|
|
1439
|
+
else if (propName == null) {
|
|
1440
|
+
// At this point we should know this is not a "member", so we can treat it like watching an attribute
|
|
1441
|
+
// on a vanilla web component
|
|
1442
|
+
const hostRef = getHostRef(this);
|
|
1443
|
+
const flags = hostRef === null || hostRef === void 0 ? void 0 : hostRef.$flags$;
|
|
1444
|
+
// We only want to trigger the callback(s) if:
|
|
1445
|
+
// 1. The instance is ready
|
|
1446
|
+
// 2. The watchers are ready
|
|
1447
|
+
// 3. The value has changed
|
|
1448
|
+
if (!(flags & 8 /* HOST_FLAGS.isConstructingInstance */) &&
|
|
1449
|
+
flags & 128 /* HOST_FLAGS.isWatchReady */ &&
|
|
1450
|
+
newValue !== oldValue) {
|
|
1451
|
+
const instance = hostRef.$lazyInstance$ ;
|
|
1452
|
+
const entry = cmpMeta.$watchers$[attrName];
|
|
1453
|
+
entry === null || entry === void 0 ? void 0 : entry.forEach((callbackName) => {
|
|
1454
|
+
if (instance[callbackName] != null) {
|
|
1455
|
+
instance[callbackName].call(instance, newValue, oldValue, attrName);
|
|
1456
|
+
}
|
|
1457
|
+
});
|
|
1458
|
+
}
|
|
1459
|
+
return;
|
|
1460
|
+
}
|
|
1357
1461
|
this[propName] = newValue === null && typeof this[propName] === 'boolean' ? false : newValue;
|
|
1358
1462
|
});
|
|
1359
1463
|
};
|
|
1360
|
-
//
|
|
1361
|
-
//
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1464
|
+
// Create an array of attributes to observe
|
|
1465
|
+
// This list in comprised of all strings used within a `@Watch()` decorator
|
|
1466
|
+
// on a component as well as any Stencil-specific "members" (`@Prop()`s and `@State()`s).
|
|
1467
|
+
// As such, there is no way to guarantee type-safety here that a user hasn't entered
|
|
1468
|
+
// an invalid attribute.
|
|
1469
|
+
Cstr.observedAttributes = Array.from(new Set([
|
|
1470
|
+
...Object.keys((_a = cmpMeta.$watchers$) !== null && _a !== void 0 ? _a : {}),
|
|
1471
|
+
...members
|
|
1472
|
+
.filter(([_, m]) => m[0] & 15 /* MEMBER_FLAGS.HasAttribute */)
|
|
1473
|
+
.map(([propName, m]) => {
|
|
1474
|
+
const attrName = m[1] || propName;
|
|
1475
|
+
attrNameToPropName.set(attrName, propName);
|
|
1476
|
+
return attrName;
|
|
1477
|
+
}),
|
|
1478
|
+
]));
|
|
1369
1479
|
}
|
|
1370
1480
|
}
|
|
1371
1481
|
return Cstr;
|
|
1372
1482
|
};
|
|
1373
|
-
|
|
1483
|
+
/**
|
|
1484
|
+
* Initialize a Stencil component given a reference to its host element, its
|
|
1485
|
+
* runtime bookkeeping data structure, runtime metadata about the component,
|
|
1486
|
+
* and (optionally) an HMR version ID.
|
|
1487
|
+
*
|
|
1488
|
+
* @param elm a host element
|
|
1489
|
+
* @param hostRef the element's runtime bookkeeping object
|
|
1490
|
+
* @param cmpMeta runtime metadata for the Stencil component
|
|
1491
|
+
* @param hmrVersionId an (optional) HMR version ID
|
|
1492
|
+
*/
|
|
1493
|
+
const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
1494
|
+
let Cstr;
|
|
1374
1495
|
// initializeComponent
|
|
1375
1496
|
if ((hostRef.$flags$ & 32 /* HOST_FLAGS.hasInitializedComponent */) === 0) {
|
|
1376
1497
|
// Let the runtime know that the component has been initialized
|
|
@@ -1493,18 +1614,40 @@ const connectedCallback = (elm) => {
|
|
|
1493
1614
|
}
|
|
1494
1615
|
}
|
|
1495
1616
|
else {
|
|
1617
|
+
// not the first time this has connected
|
|
1618
|
+
// reattach any event listeners to the host
|
|
1619
|
+
// since they would have been removed when disconnected
|
|
1620
|
+
addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
|
|
1496
1621
|
// fire off connectedCallback() on component instance
|
|
1497
|
-
|
|
1622
|
+
if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$lazyInstance$) {
|
|
1623
|
+
fireConnectedCallback(hostRef.$lazyInstance$);
|
|
1624
|
+
}
|
|
1625
|
+
else if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$onReadyPromise$) {
|
|
1626
|
+
hostRef.$onReadyPromise$.then(() => fireConnectedCallback(hostRef.$lazyInstance$));
|
|
1627
|
+
}
|
|
1498
1628
|
}
|
|
1499
1629
|
endConnected();
|
|
1500
1630
|
}
|
|
1501
1631
|
};
|
|
1502
|
-
const
|
|
1632
|
+
const disconnectInstance = (instance) => {
|
|
1633
|
+
{
|
|
1634
|
+
safeCall(instance, 'disconnectedCallback');
|
|
1635
|
+
}
|
|
1636
|
+
};
|
|
1637
|
+
const disconnectedCallback = async (elm) => {
|
|
1503
1638
|
if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
|
|
1504
1639
|
const hostRef = getHostRef(elm);
|
|
1505
|
-
const instance = hostRef.$lazyInstance$ ;
|
|
1506
1640
|
{
|
|
1507
|
-
|
|
1641
|
+
if (hostRef.$rmListeners$) {
|
|
1642
|
+
hostRef.$rmListeners$.map((rmListener) => rmListener());
|
|
1643
|
+
hostRef.$rmListeners$ = undefined;
|
|
1644
|
+
}
|
|
1645
|
+
}
|
|
1646
|
+
if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$lazyInstance$) {
|
|
1647
|
+
disconnectInstance(hostRef.$lazyInstance$);
|
|
1648
|
+
}
|
|
1649
|
+
else if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$onReadyPromise$) {
|
|
1650
|
+
hostRef.$onReadyPromise$.then(() => disconnectInstance(hostRef.$lazyInstance$));
|
|
1508
1651
|
}
|
|
1509
1652
|
}
|
|
1510
1653
|
};
|
|
@@ -1524,6 +1667,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1524
1667
|
plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
|
|
1525
1668
|
lazyBundles.map((lazyBundle) => {
|
|
1526
1669
|
lazyBundle[1].map((compactMeta) => {
|
|
1670
|
+
var _a;
|
|
1527
1671
|
const cmpMeta = {
|
|
1528
1672
|
$flags$: compactMeta[0],
|
|
1529
1673
|
$tagName$: compactMeta[1],
|
|
@@ -1534,7 +1678,10 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1534
1678
|
cmpMeta.$members$ = compactMeta[2];
|
|
1535
1679
|
}
|
|
1536
1680
|
{
|
|
1537
|
-
cmpMeta.$
|
|
1681
|
+
cmpMeta.$listeners$ = compactMeta[3];
|
|
1682
|
+
}
|
|
1683
|
+
{
|
|
1684
|
+
cmpMeta.$watchers$ = (_a = compactMeta[4]) !== null && _a !== void 0 ? _a : {};
|
|
1538
1685
|
}
|
|
1539
1686
|
const tagName = cmpMeta.$tagName$;
|
|
1540
1687
|
const HostElement = class extends HTMLElement {
|
|
@@ -1606,6 +1753,35 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1606
1753
|
// Fallback appLoad event
|
|
1607
1754
|
endBootstrap();
|
|
1608
1755
|
};
|
|
1756
|
+
const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
|
|
1757
|
+
if (listeners) {
|
|
1758
|
+
listeners.map(([flags, name, method]) => {
|
|
1759
|
+
const target = elm;
|
|
1760
|
+
const handler = hostListenerProxy(hostRef, method);
|
|
1761
|
+
const opts = hostListenerOpts(flags);
|
|
1762
|
+
plt.ael(target, name, handler, opts);
|
|
1763
|
+
(hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
|
|
1764
|
+
});
|
|
1765
|
+
}
|
|
1766
|
+
};
|
|
1767
|
+
const hostListenerProxy = (hostRef, methodName) => (ev) => {
|
|
1768
|
+
try {
|
|
1769
|
+
{
|
|
1770
|
+
if (hostRef.$flags$ & 256 /* HOST_FLAGS.isListenReady */) {
|
|
1771
|
+
// instance is ready, let's call it's member method for this event
|
|
1772
|
+
hostRef.$lazyInstance$[methodName](ev);
|
|
1773
|
+
}
|
|
1774
|
+
else {
|
|
1775
|
+
(hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
|
|
1776
|
+
}
|
|
1777
|
+
}
|
|
1778
|
+
}
|
|
1779
|
+
catch (e) {
|
|
1780
|
+
consoleError(e);
|
|
1781
|
+
}
|
|
1782
|
+
};
|
|
1783
|
+
// prettier-ignore
|
|
1784
|
+
const hostListenerOpts = (flags) => (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0;
|
|
1609
1785
|
/**
|
|
1610
1786
|
* Assigns the given value to the nonce property on the runtime platform object.
|
|
1611
1787
|
* During runtime, this value is used to set the nonce attribute on all dynamically created script and style tags.
|
|
@@ -1613,13 +1789,40 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1613
1789
|
* @returns void
|
|
1614
1790
|
*/
|
|
1615
1791
|
const setNonce = (nonce) => (plt.$nonce$ = nonce);
|
|
1792
|
+
/**
|
|
1793
|
+
* A WeakMap mapping runtime component references to their corresponding host reference
|
|
1794
|
+
* instances.
|
|
1795
|
+
*/
|
|
1616
1796
|
const hostRefs = /*@__PURE__*/ new WeakMap();
|
|
1797
|
+
/**
|
|
1798
|
+
* Given a {@link d.RuntimeRef} retrieve the corresponding {@link d.HostRef}
|
|
1799
|
+
*
|
|
1800
|
+
* @param ref the runtime ref of interest
|
|
1801
|
+
* @returns the Host reference (if found) or undefined
|
|
1802
|
+
*/
|
|
1617
1803
|
const getHostRef = (ref) => hostRefs.get(ref);
|
|
1804
|
+
/**
|
|
1805
|
+
* Register a lazy instance with the {@link hostRefs} object so it's
|
|
1806
|
+
* corresponding {@link d.HostRef} can be retrieved later.
|
|
1807
|
+
*
|
|
1808
|
+
* @param lazyInstance the lazy instance of interest
|
|
1809
|
+
* @param hostRef that instances `HostRef` object
|
|
1810
|
+
* @returns a reference to the host ref WeakMap
|
|
1811
|
+
*/
|
|
1618
1812
|
const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
|
|
1619
|
-
|
|
1813
|
+
/**
|
|
1814
|
+
* Register a host element for a Stencil component, setting up various metadata
|
|
1815
|
+
* and callbacks based on {@link BUILD} flags as well as the component's runtime
|
|
1816
|
+
* metadata.
|
|
1817
|
+
*
|
|
1818
|
+
* @param hostElement the host element to register
|
|
1819
|
+
* @param cmpMeta runtime metadata for that component
|
|
1820
|
+
* @returns a reference to the host ref WeakMap
|
|
1821
|
+
*/
|
|
1822
|
+
const registerHost = (hostElement, cmpMeta) => {
|
|
1620
1823
|
const hostRef = {
|
|
1621
1824
|
$flags$: 0,
|
|
1622
|
-
$hostElement$:
|
|
1825
|
+
$hostElement$: hostElement,
|
|
1623
1826
|
$cmpMeta$: cmpMeta,
|
|
1624
1827
|
$instanceValues$: new Map(),
|
|
1625
1828
|
};
|
|
@@ -1628,10 +1831,11 @@ const registerHost = (elm, cmpMeta) => {
|
|
|
1628
1831
|
}
|
|
1629
1832
|
{
|
|
1630
1833
|
hostRef.$onReadyPromise$ = new Promise((r) => (hostRef.$onReadyResolve$ = r));
|
|
1631
|
-
|
|
1632
|
-
|
|
1834
|
+
hostElement['s-p'] = [];
|
|
1835
|
+
hostElement['s-rc'] = [];
|
|
1633
1836
|
}
|
|
1634
|
-
|
|
1837
|
+
addHostEventListeners(hostElement, hostRef, cmpMeta.$listeners$);
|
|
1838
|
+
return hostRefs.set(hostElement, hostRef);
|
|
1635
1839
|
};
|
|
1636
1840
|
const isMemberInElement = (elm, memberName) => memberName in elm;
|
|
1637
1841
|
const consoleError = (e, el) => (0, console.error)(e, el);
|
|
@@ -1731,4 +1935,4 @@ exports.promiseResolve = promiseResolve;
|
|
|
1731
1935
|
exports.registerInstance = registerInstance;
|
|
1732
1936
|
exports.setNonce = setNonce;
|
|
1733
1937
|
|
|
1734
|
-
//# sourceMappingURL=index-
|
|
1938
|
+
//# sourceMappingURL=index-b619e205.js.map
|