@swisspost/design-system-components 10.0.0-next.70 → 10.0.0-next.71
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/breakpoints-B0Olgvgc.js +206 -0
- package/dist/cjs/component-on-ready-CifOTqw1.js +24 -0
- package/dist/cjs/{focusable-ZqET_zrB.js → focusable-COT2uiEV.js} +25 -4
- package/dist/cjs/{index-DPdHkdGf.js → index-CCteMCnR.js} +13 -13
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/nanoid-CmjyF1Cm.js +20 -0
- package/dist/cjs/{package-Ds_LS1pB.js → package-CscM89A7.js} +1 -1
- package/dist/cjs/post-accordion_2.cjs.entry.js +7 -7
- package/dist/cjs/post-autocomplete.cjs.entry.js +3 -3
- package/dist/cjs/post-avatar.cjs.entry.js +6 -24
- package/dist/cjs/post-back-to-top.cjs.entry.js +3 -3
- package/dist/cjs/post-banner.cjs.entry.js +3 -3
- package/dist/cjs/post-breadcrumb-item.cjs.entry.js +30 -33
- package/dist/cjs/post-breadcrumbs.cjs.entry.js +82 -80
- package/dist/cjs/post-closebutton_14.cjs.entry.js +36 -33
- package/dist/cjs/post-collapsible_2.cjs.entry.js +5 -5
- package/dist/cjs/post-components.cjs.js +2 -2
- package/dist/cjs/post-date-picker.cjs.entry.js +31 -23
- package/dist/cjs/post-footer.cjs.entry.js +5 -5
- package/dist/cjs/post-linkarea.cjs.entry.js +3 -3
- package/dist/cjs/post-listbox-option.cjs.entry.js +4 -4
- package/dist/cjs/post-listbox.cjs.entry.js +4 -4
- package/dist/cjs/post-login-widget.cjs.entry.js +36 -3
- package/dist/cjs/post-number-input.cjs.entry.js +6 -6
- package/dist/cjs/post-pagination.cjs.entry.js +5 -5
- package/dist/cjs/post-popover-trigger.cjs.entry.js +5 -5
- package/dist/cjs/post-popover.cjs.entry.js +4 -4
- package/dist/cjs/post-rating.cjs.entry.js +4 -4
- package/dist/cjs/post-stepper-item.cjs.entry.js +3 -3
- package/dist/cjs/post-stepper.cjs.entry.js +4 -4
- package/dist/cjs/post-tab-item.cjs.entry.js +6 -6
- package/dist/cjs/post-tab-panel.cjs.entry.js +6 -6
- package/dist/cjs/post-tabs.cjs.entry.js +7 -27
- package/dist/cjs/post-tooltip-trigger.cjs.entry.js +16 -12
- package/dist/cjs/post-tooltip.cjs.entry.js +4 -4
- package/dist/collection/components/post-accordion-item/post-accordion-item.js +3 -4
- package/dist/collection/components/post-avatar/avatar-utils.js +2 -2
- package/dist/collection/components/post-avatar/post-avatar.js +3 -40
- package/dist/collection/components/post-breadcrumb-item/post-breadcrumb-item.css +1 -1
- package/dist/collection/components/post-breadcrumb-item/post-breadcrumb-item.js +79 -39
- package/dist/collection/components/post-breadcrumb-item/variants.js +1 -0
- package/dist/collection/components/post-breadcrumbs/post-breadcrumbs.css +1 -1
- package/dist/collection/components/post-breadcrumbs/post-breadcrumbs.js +84 -83
- package/dist/collection/components/post-closebutton/post-closebutton.js +1 -1
- package/dist/collection/components/post-collapsible/post-collapsible.js +1 -1
- package/dist/collection/components/post-collapsible-trigger/post-collapsible-trigger.js +1 -1
- package/dist/collection/components/post-date-picker/post-date-picker.css +1 -1
- package/dist/collection/components/post-date-picker/post-date-picker.js +2 -2
- package/dist/collection/components/post-footer/post-footer.js +1 -1
- package/dist/collection/components/post-header/post-header.js +4 -4
- package/dist/collection/components/post-icon/post-icon.js +3 -2
- package/dist/collection/components/post-language-menu/post-language-menu.js +2 -3
- package/dist/collection/components/post-linkarea/post-linkarea.js +1 -1
- package/dist/collection/components/post-listbox/post-listbox.js +1 -1
- package/dist/collection/components/post-listbox-option/post-listbox-option.js +2 -2
- package/dist/collection/components/post-login-widget/post-login-widget.css +1 -0
- package/dist/collection/components/post-login-widget/post-login-widget.js +106 -4
- package/dist/collection/components/post-logo/post-logo.js +1 -1
- package/dist/collection/components/post-mainnavigation/post-mainnavigation.js +1 -1
- package/dist/collection/components/post-megadropdown/post-megadropdown.js +1 -1
- package/dist/collection/components/post-megadropdown-trigger/post-megadropdown-trigger.js +1 -1
- package/dist/collection/components/post-menu/post-menu.js +5 -2
- package/dist/collection/components/post-menu-item/post-menu-item.css +1 -1
- package/dist/collection/components/post-menu-trigger/post-menu-trigger.js +1 -1
- package/dist/collection/components/post-number-input/post-number-input.js +2 -2
- package/dist/collection/components/post-pagination/post-pagination.js +1 -2
- package/dist/collection/components/post-popover/post-popover.js +1 -1
- package/dist/collection/components/post-popover-trigger/post-popover-trigger.js +1 -1
- package/dist/collection/components/post-popovercontainer/post-popovercontainer.css +1 -1
- package/dist/collection/components/post-popovercontainer/post-popovercontainer.js +5 -6
- package/dist/collection/components/post-rating/post-rating.js +1 -1
- package/dist/collection/components/post-stepper/post-stepper.js +1 -1
- package/dist/collection/components/post-stepper-item/post-stepper-item.js +1 -1
- package/dist/collection/components/post-tab-item/post-tab-item.js +2 -3
- package/dist/collection/components/post-tab-panel/post-tab-panel.js +2 -3
- package/dist/collection/components/post-tabs/post-tabs.js +2 -2
- package/dist/collection/components/post-togglebutton/post-togglebutton.js +1 -1
- package/dist/collection/components/post-tooltip/post-tooltip.js +1 -1
- package/dist/collection/components/post-tooltip-trigger/post-tooltip-trigger.js +15 -9
- package/dist/collection/hydrate-stub/index.stub.js +5 -0
- package/dist/collection/test-setup.js +7 -0
- package/dist/collection/utils/index.js +2 -0
- package/dist/collection/utils/locales.js +9 -2
- package/dist/collection/utils/nanoid.js +16 -0
- package/dist/collection/utils/property-decorators/array-of.js +22 -0
- package/dist/collection/utils/property-decorators/create-validator-decorator.js +187 -0
- package/dist/collection/utils/property-decorators/date.js +21 -0
- package/dist/collection/utils/property-decorators/index.js +9 -0
- package/dist/collection/utils/property-decorators/iso-date.js +21 -0
- package/dist/collection/utils/property-decorators/one-of.js +22 -0
- package/dist/collection/utils/property-decorators/pattern.js +22 -0
- package/dist/collection/utils/property-decorators/required.js +24 -0
- package/dist/collection/utils/property-decorators/type.js +25 -0
- package/dist/collection/utils/property-decorators/url.js +29 -0
- package/dist/components/breakpoints.js +1 -0
- package/dist/components/component-on-ready.js +1 -0
- package/dist/components/focusable.js +1 -1
- package/dist/components/index2.js +1 -1
- package/dist/components/nanoid.js +1 -0
- package/dist/components/package.js +1 -1
- package/dist/components/post-accordion-item2.js +1 -1
- package/dist/components/post-accordion2.js +1 -1
- package/dist/components/post-autocomplete.js +1 -1
- package/dist/components/post-avatar.js +1 -1
- package/dist/components/post-avatar2.js +1 -0
- package/dist/components/post-back-to-top.js +1 -1
- package/dist/components/post-banner.js +1 -1
- package/dist/components/post-breadcrumb-item.js +1 -1
- package/dist/components/post-breadcrumbs.js +1 -1
- package/dist/components/post-closebutton2.js +1 -1
- package/dist/components/post-collapsible-trigger2.js +1 -1
- package/dist/components/post-collapsible2.js +1 -1
- package/dist/components/post-date-picker.js +1 -1
- package/dist/components/post-footer.js +1 -1
- package/dist/components/post-header.js +1 -1
- package/dist/components/post-icon2.js +1 -1
- package/dist/components/post-language-menu-item.js +1 -1
- package/dist/components/post-language-menu.js +1 -1
- package/dist/components/post-linkarea.js +1 -1
- package/dist/components/post-listbox-option.js +1 -1
- package/dist/components/post-listbox.js +1 -1
- package/dist/components/post-login-widget.js +1 -1
- package/dist/components/post-logo.js +1 -1
- package/dist/components/post-mainnavigation.js +1 -1
- package/dist/components/post-megadropdown-trigger.js +1 -1
- package/dist/components/post-megadropdown.js +1 -1
- package/dist/components/post-menu-item2.js +1 -1
- package/dist/components/post-menu-trigger2.js +1 -1
- package/dist/components/post-menu2.js +1 -1
- package/dist/components/post-number-input.js +1 -1
- package/dist/components/post-pagination.js +1 -1
- package/dist/components/post-popover-trigger.js +1 -1
- package/dist/components/post-popover.js +1 -1
- package/dist/components/post-popovercontainer2.js +1 -1
- package/dist/components/post-rating.js +1 -1
- package/dist/components/post-stepper-item.js +1 -1
- package/dist/components/post-stepper.js +1 -1
- package/dist/components/post-tab-item.js +1 -1
- package/dist/components/post-tab-panel.js +1 -1
- package/dist/components/post-tabs.js +1 -1
- package/dist/components/post-togglebutton2.js +1 -1
- package/dist/components/post-tooltip-trigger.js +1 -1
- package/dist/components/post-tooltip.js +1 -1
- package/dist/components/react/index.js +1 -1
- package/dist/components/react/p-8LXe8Zt_.js +1 -0
- package/dist/components/react/p-BC0-M_SK.js +1 -0
- package/dist/components/react/p-BQ3HlJPr.js +1 -0
- package/dist/components/react/p-BrY4VWTQ.js +1 -0
- package/dist/components/react/p-C7s9oglQ.js +1 -0
- package/dist/components/react/{p-D6uA8DbL.js → p-CTgZ8DGr.js} +1 -1
- package/dist/components/react/{p-B2iQay0-.js → p-CVtlwDsT.js} +1 -1
- package/dist/components/react/p-CaLwTf3T.js +1 -0
- package/dist/components/react/p-ClJyTIVM.js +1 -0
- package/dist/components/react/{p-B2BDAeHI.js → p-DGr-hfLq.js} +1 -1
- package/dist/components/react/{p-Cu9RsvYK.js → p-DJxdj9pa.js} +1 -1
- package/dist/components/react/p-DKDEtjQe.js +1 -0
- package/dist/components/react/p-DPKR_4uI.js +1 -0
- package/dist/components/react/p-DcEDGaFs.js +1 -0
- package/dist/components/react/{p-C8b6-YQl.js → p-DipfA69b.js} +1 -1
- package/dist/components/react/{p-Dmnnz3fB.js → p-DwZxAC2u.js} +1 -1
- package/dist/components/react/p-lpWRZjJp.js +1 -0
- package/dist/components/react/p-x3kxyWSZ.js +1 -0
- package/dist/components/react/post-accordion-item.js +1 -1
- package/dist/components/react/post-accordion.js +1 -1
- package/dist/components/react/post-autocomplete.js +1 -1
- package/dist/components/react/post-avatar.js +1 -1
- package/dist/components/react/post-back-to-top.js +1 -1
- package/dist/components/react/post-banner.js +1 -1
- package/dist/components/react/post-breadcrumb-item.js +1 -1
- package/dist/components/react/post-breadcrumbs.js +1 -1
- package/dist/components/react/post-closebutton.js +1 -1
- package/dist/components/react/post-collapsible-trigger.js +1 -1
- package/dist/components/react/post-collapsible.js +1 -1
- package/dist/components/react/post-date-picker.js +1 -1
- package/dist/components/react/post-footer.js +1 -1
- package/dist/components/react/post-header.js +1 -1
- package/dist/components/react/post-icon.js +1 -1
- package/dist/components/react/post-language-menu-item.js +1 -1
- package/dist/components/react/post-language-menu.js +1 -1
- package/dist/components/react/post-linkarea.js +1 -1
- package/dist/components/react/post-listbox-option.js +1 -1
- package/dist/components/react/post-listbox.js +1 -1
- package/dist/components/react/post-login-widget.js +1 -1
- package/dist/components/react/post-logo.js +1 -1
- package/dist/components/react/post-mainnavigation.js +1 -1
- package/dist/components/react/post-megadropdown-trigger.js +1 -1
- package/dist/components/react/post-megadropdown.js +1 -1
- package/dist/components/react/post-menu-item.js +1 -1
- package/dist/components/react/post-menu-trigger.js +1 -1
- package/dist/components/react/post-menu.js +1 -1
- package/dist/components/react/post-number-input.js +1 -1
- package/dist/components/react/post-pagination.js +1 -1
- package/dist/components/react/post-popover-trigger.js +1 -1
- package/dist/components/react/post-popover.js +1 -1
- package/dist/components/react/post-popovercontainer.js +1 -1
- package/dist/components/react/post-rating.js +1 -1
- package/dist/components/react/post-stepper-item.js +1 -1
- package/dist/components/react/post-stepper.js +1 -1
- package/dist/components/react/post-tab-item.js +1 -1
- package/dist/components/react/post-tab-panel.js +1 -1
- package/dist/components/react/post-tabs.js +1 -1
- package/dist/components/react/post-togglebutton.js +1 -1
- package/dist/components/react/post-tooltip-trigger.js +1 -1
- package/dist/components/react/post-tooltip.js +1 -1
- package/dist/docs.json +202 -69
- package/dist/esm/breakpoints-BQ3HlJPr.js +202 -0
- package/dist/esm/component-on-ready-lpWRZjJp.js +22 -0
- package/dist/esm/{focusable-BD_WT2MO.js → focusable-C7afHKmo.js} +25 -5
- package/dist/esm/{index-DmAi35UF.js → index-DmBWUef5.js} +13 -13
- package/dist/esm/loader.js +3 -3
- package/dist/esm/nanoid-8LXe8Zt_.js +18 -0
- package/dist/esm/package-x3kxyWSZ.js +3 -0
- package/dist/esm/post-accordion_2.entry.js +6 -6
- package/dist/esm/post-autocomplete.entry.js +3 -3
- package/dist/esm/post-avatar.entry.js +6 -24
- package/dist/esm/post-back-to-top.entry.js +3 -3
- package/dist/esm/post-banner.entry.js +3 -3
- package/dist/esm/post-breadcrumb-item.entry.js +31 -34
- package/dist/esm/post-breadcrumbs.entry.js +82 -80
- package/dist/esm/post-closebutton_14.entry.js +31 -28
- package/dist/esm/post-collapsible_2.entry.js +5 -5
- package/dist/esm/post-components.js +3 -3
- package/dist/esm/post-date-picker.entry.js +15 -7
- package/dist/esm/post-footer.entry.js +4 -4
- package/dist/esm/post-linkarea.entry.js +3 -3
- package/dist/esm/post-listbox-option.entry.js +4 -4
- package/dist/esm/post-listbox.entry.js +4 -4
- package/dist/esm/post-login-widget.entry.js +36 -3
- package/dist/esm/post-number-input.entry.js +5 -5
- package/dist/esm/post-pagination.entry.js +4 -4
- package/dist/esm/post-popover-trigger.entry.js +5 -5
- package/dist/esm/post-popover.entry.js +4 -4
- package/dist/esm/post-rating.entry.js +4 -4
- package/dist/esm/post-stepper-item.entry.js +3 -3
- package/dist/esm/post-stepper.entry.js +4 -4
- package/dist/esm/post-tab-item.entry.js +5 -5
- package/dist/esm/post-tab-panel.entry.js +5 -5
- package/dist/esm/post-tabs.entry.js +6 -26
- package/dist/esm/post-tooltip-trigger.entry.js +16 -12
- package/dist/esm/post-tooltip.entry.js +4 -4
- package/dist/post-components/{p-c2e05ba0.entry.js → p-08a0e8e9.entry.js} +1 -1
- package/dist/post-components/{p-f12e59a0.entry.js → p-1583817b.entry.js} +1 -1
- package/dist/post-components/{p-e6ba44b1.entry.js → p-203d9abd.entry.js} +1 -1
- package/dist/post-components/p-2c68af27.entry.js +1 -0
- package/dist/post-components/{p-092f8795.entry.js → p-39143e19.entry.js} +1 -1
- package/dist/post-components/p-46dd9e7e.entry.js +1 -0
- package/dist/post-components/{p-77d5e17b.entry.js → p-4b445a35.entry.js} +1 -1
- package/dist/post-components/p-53a8cce5.entry.js +1 -0
- package/dist/post-components/p-72bff1fc.entry.js +1 -0
- package/dist/post-components/{p-25c28493.entry.js → p-75045028.entry.js} +1 -1
- package/dist/post-components/{p-534fed55.entry.js → p-768b4516.entry.js} +1 -1
- package/dist/post-components/{p-2fcca5ec.entry.js → p-7e072450.entry.js} +1 -1
- package/dist/post-components/{p-3cefd49e.entry.js → p-83cb6424.entry.js} +1 -1
- package/dist/post-components/p-8LXe8Zt_.js +1 -0
- package/dist/post-components/{p-1d58bec1.entry.js → p-94f4da57.entry.js} +1 -1
- package/dist/post-components/{p-5068ae7e.entry.js → p-9dace750.entry.js} +1 -1
- package/dist/post-components/{p-3fea238c.entry.js → p-9ea7e46f.entry.js} +1 -1
- package/dist/post-components/p-BQ3HlJPr.js +1 -0
- package/dist/post-components/p-BrY4VWTQ.js +1 -0
- package/dist/post-components/p-DmBWUef5.js +2 -0
- package/dist/post-components/{p-86697a58.entry.js → p-a0ac814c.entry.js} +1 -1
- package/dist/post-components/p-a0d12ca8.entry.js +1 -0
- package/dist/post-components/{p-570d64dd.entry.js → p-bab0f27f.entry.js} +1 -1
- package/dist/post-components/p-cb039d66.entry.js +1 -0
- package/dist/post-components/p-e8cda4e1.entry.js +1 -0
- package/dist/post-components/{p-17ccebe6.entry.js → p-e8e50d5c.entry.js} +1 -1
- package/dist/post-components/p-eb64ec1d.entry.js +1 -0
- package/dist/post-components/p-f0746a9e.entry.js +1 -0
- package/dist/post-components/p-f5e33714.entry.js +1 -0
- package/dist/post-components/{p-521178f5.entry.js → p-f93ce33d.entry.js} +1 -1
- package/dist/post-components/{p-9ca5c297.entry.js → p-fd0446b2.entry.js} +1 -1
- package/dist/post-components/p-lpWRZjJp.js +1 -0
- package/dist/post-components/p-x3kxyWSZ.js +1 -0
- package/dist/post-components/post-components.css +1 -1
- package/dist/post-components/post-components.esm.js +1 -1
- package/dist/types/components/post-avatar/avatar-utils.d.ts +1 -1
- package/dist/types/components/post-avatar/post-avatar.d.ts +0 -8
- package/dist/types/components/post-breadcrumb-item/post-breadcrumb-item.d.ts +14 -11
- package/dist/types/components/post-breadcrumb-item/variants.d.ts +2 -0
- package/dist/types/components/post-breadcrumbs/post-breadcrumbs.d.ts +23 -25
- package/dist/types/components/post-login-widget/post-login-widget.d.ts +21 -2
- package/dist/types/components/post-menu/post-menu.d.ts +1 -1
- package/dist/types/components/post-popover/post-popover.d.ts +1 -1
- package/dist/types/components/post-tooltip/post-tooltip.d.ts +1 -1
- package/dist/types/components/post-tooltip-trigger/post-tooltip-trigger.d.ts +1 -0
- package/dist/types/components.d.ts +68 -24
- package/dist/types/modules.d.ts +2 -0
- package/dist/types/utils/index.d.ts +2 -0
- package/dist/types/utils/nanoid.d.ts +8 -0
- package/dist/types/utils/property-decorators/array-of.d.ts +9 -0
- package/dist/types/utils/property-decorators/create-validator-decorator.d.ts +43 -0
- package/dist/types/utils/property-decorators/date.d.ts +6 -0
- package/dist/types/utils/property-decorators/index.d.ts +9 -0
- package/dist/types/utils/property-decorators/iso-date.d.ts +6 -0
- package/dist/types/utils/property-decorators/one-of.d.ts +8 -0
- package/dist/types/utils/property-decorators/pattern.d.ts +8 -0
- package/dist/types/utils/property-decorators/required.d.ts +8 -0
- package/dist/types/utils/property-decorators/type.d.ts +9 -0
- package/dist/types/utils/property-decorators/url.d.ts +6 -0
- package/hydrate/index.js +417 -114734
- package/hydrate/index.mjs +417 -114734
- package/hydrate/index.stub.js +5 -0
- package/package.json +28 -18
- package/dist/cjs/index-YBj3gUJp.js +0 -114540
- package/dist/cjs/index.browser-BVb9l9T_.js +0 -16
- package/dist/components/index.browser.js +0 -1
- package/dist/components/index3.js +0 -6
- package/dist/components/post-breadcrumb-item2.js +0 -1
- package/dist/components/react/p-B076QoO3.js +0 -1
- package/dist/components/react/p-B_RL4AOE.js +0 -1
- package/dist/components/react/p-BoFDru4R.js +0 -1
- package/dist/components/react/p-BuL0WAoF.js +0 -1
- package/dist/components/react/p-CJcRbvrI.js +0 -6
- package/dist/components/react/p-DSSN7xW4.js +0 -1
- package/dist/components/react/p-DW7sbg9f.js +0 -1
- package/dist/components/react/p-DgdnwpId.js +0 -1
- package/dist/components/react/p-PuHMz_9_.js +0 -1
- package/dist/components/react/p-nA1BKco0.js +0 -1
- package/dist/components/react/p-tpgRP2Dr.js +0 -1
- package/dist/esm/index-CJcRbvrI.js +0 -114535
- package/dist/esm/index.browser-nA1BKco0.js +0 -14
- package/dist/esm/package-DW7sbg9f.js +0 -3
- package/dist/post-components/p-29ada3d7.entry.js +0 -1
- package/dist/post-components/p-5f52cba3.entry.js +0 -1
- package/dist/post-components/p-987bebe8.entry.js +0 -1
- package/dist/post-components/p-9ea3066f.entry.js +0 -1
- package/dist/post-components/p-CJcRbvrI.js +0 -6
- package/dist/post-components/p-DW7sbg9f.js +0 -1
- package/dist/post-components/p-DmAi35UF.js +0 -2
- package/dist/post-components/p-PuHMz_9_.js +0 -1
- package/dist/post-components/p-a6fc33fa.entry.js +0 -1
- package/dist/post-components/p-ac853d6b.entry.js +0 -1
- package/dist/post-components/p-bd09bc20.entry.js +0 -1
- package/dist/post-components/p-c55b537b.entry.js +0 -1
- package/dist/post-components/p-dded4f13.entry.js +0 -1
- package/dist/post-components/p-ead1094e.entry.js +0 -1
- package/dist/post-components/p-nA1BKco0.js +0 -1
- package/dist/types/home/runner/work/design-system/design-system/packages/components/.stencil/types/language-tags.d.ts +0 -1
- /package/dist/types/{language-tags.js → test-setup.d.ts} +0 -0
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { isValueEmpty } from "../is-value-empty";
|
|
2
|
+
import { getElement } from "@stencil/core";
|
|
3
|
+
/** Tracks prototypes whose `componentDidLoad` lifecycle has already been wrapped. */
|
|
4
|
+
const patchedTargets = new WeakSet();
|
|
5
|
+
/** Tracks component instances that already completed the first load cycle. */
|
|
6
|
+
const loadedInstances = new WeakSet();
|
|
7
|
+
/** Stores validators per component prototype and property name. */
|
|
8
|
+
const validatorsByTarget = new WeakMap();
|
|
9
|
+
/** Stores all properties that use a validator decorator for each component prototype. */
|
|
10
|
+
const decoratedPropertiesByTarget = new WeakMap();
|
|
11
|
+
/** Stores per-instance property values captured by dynamically created accessors. */
|
|
12
|
+
const propertyValuesByInstance = new WeakMap();
|
|
13
|
+
/**
|
|
14
|
+
* Returns the value for a key in a {@link WeakMap} and lazily creates it when missing.
|
|
15
|
+
*
|
|
16
|
+
* @template K WeakMap key type.
|
|
17
|
+
* @template T WeakMap value type.
|
|
18
|
+
* @param map WeakMap used as storage.
|
|
19
|
+
* @param key Object key used to retrieve or initialize the value.
|
|
20
|
+
* @param factory Factory creating the value when no entry exists for the key.
|
|
21
|
+
* @returns Existing or newly created value associated with the key.
|
|
22
|
+
*/
|
|
23
|
+
function getOrCreate(map, key, factory) {
|
|
24
|
+
let value = map.get(key);
|
|
25
|
+
if (!value) {
|
|
26
|
+
value = factory();
|
|
27
|
+
map.set(key, value);
|
|
28
|
+
}
|
|
29
|
+
return value;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Returns the mutable validator list registered for a property on a component prototype.
|
|
33
|
+
*
|
|
34
|
+
* @param target Component prototype where decorators were applied.
|
|
35
|
+
* @param property Decorated property name.
|
|
36
|
+
* @returns Validator list for the property.
|
|
37
|
+
*/
|
|
38
|
+
function getValidators(target, property) {
|
|
39
|
+
const validatorsByProperty = getOrCreate(validatorsByTarget, target, () => new Map());
|
|
40
|
+
return getOrCreate(validatorsByProperty, property, () => []);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Returns all property names decorated with validator decorators for a prototype.
|
|
44
|
+
*
|
|
45
|
+
* @param target Component prototype where decorators were applied.
|
|
46
|
+
* @returns Set of decorated property names.
|
|
47
|
+
*/
|
|
48
|
+
function getDecoratedProperties(target) {
|
|
49
|
+
return getOrCreate(decoratedPropertiesByTarget, target, () => new Set());
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Returns the map containing tracked property values for a component instance.
|
|
53
|
+
*
|
|
54
|
+
* @param instance Component instance.
|
|
55
|
+
* @returns Map keyed by property name with last assigned values.
|
|
56
|
+
*/
|
|
57
|
+
function getValuesByProperty(instance) {
|
|
58
|
+
return getOrCreate(propertyValuesByInstance, instance, () => new Map());
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Defines an accessor for a decorated property that stores values per instance and
|
|
62
|
+
* triggers validation after the component first loads.
|
|
63
|
+
*
|
|
64
|
+
* Accessor creation is skipped when a getter already exists to avoid overriding
|
|
65
|
+
* component-defined accessors.
|
|
66
|
+
*
|
|
67
|
+
* @param target Component prototype receiving the accessor.
|
|
68
|
+
* @param property Decorated property name.
|
|
69
|
+
*/
|
|
70
|
+
function createPropertyAccessor(target, property) {
|
|
71
|
+
const descriptor = Object.getOwnPropertyDescriptor(target, property);
|
|
72
|
+
if (descriptor && descriptor.get)
|
|
73
|
+
return;
|
|
74
|
+
Object.defineProperty(target, property, {
|
|
75
|
+
get() {
|
|
76
|
+
return getValuesByProperty(this).get(property);
|
|
77
|
+
},
|
|
78
|
+
set(newValue) {
|
|
79
|
+
getValuesByProperty(this).set(property, newValue);
|
|
80
|
+
if (loadedInstances.has(this)) {
|
|
81
|
+
runValidators(this, property);
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
enumerable: true,
|
|
85
|
+
configurable: true,
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Wraps `componentDidLoad` once per prototype to execute validators on initial render.
|
|
90
|
+
*
|
|
91
|
+
* Existing `componentDidLoad` behavior is preserved and called after validation.
|
|
92
|
+
*
|
|
93
|
+
* @param target Component prototype to patch.
|
|
94
|
+
*/
|
|
95
|
+
function patchComponentDidLoad(target) {
|
|
96
|
+
if (patchedTargets.has(target))
|
|
97
|
+
return;
|
|
98
|
+
patchedTargets.add(target);
|
|
99
|
+
const original = 'componentDidLoad' in target && typeof target.componentDidLoad === 'function'
|
|
100
|
+
? target.componentDidLoad
|
|
101
|
+
: undefined;
|
|
102
|
+
Object.defineProperty(target, 'componentDidLoad', {
|
|
103
|
+
writable: true,
|
|
104
|
+
configurable: true,
|
|
105
|
+
value: function (...args) {
|
|
106
|
+
loadedInstances.add(this);
|
|
107
|
+
const decoratedProperties = getDecoratedProperties(Object.getPrototypeOf(this));
|
|
108
|
+
for (const property of decoratedProperties) {
|
|
109
|
+
runValidators(this, property);
|
|
110
|
+
}
|
|
111
|
+
if (original) {
|
|
112
|
+
return original.apply(this, args);
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Executes all validators for a property in ascending priority order.
|
|
119
|
+
*
|
|
120
|
+
* Validation is skipped for empty values unless a validator explicitly opts in via
|
|
121
|
+
* `validateEmptyValues`. Execution stops when a blocking validator fails.
|
|
122
|
+
*
|
|
123
|
+
* @param component Component instance.
|
|
124
|
+
* @param property Property name to validate.
|
|
125
|
+
*/
|
|
126
|
+
function runValidators(component, property) {
|
|
127
|
+
const prototype = Object.getPrototypeOf(component);
|
|
128
|
+
const validatorsByProperty = validatorsByTarget.get(prototype);
|
|
129
|
+
if (!validatorsByProperty)
|
|
130
|
+
return;
|
|
131
|
+
const validators = validatorsByProperty.get(property);
|
|
132
|
+
if (!validators || validators.length === 0)
|
|
133
|
+
return;
|
|
134
|
+
const sortedValidators = [...validators].sort((a, b) => a.priority - b.priority);
|
|
135
|
+
const value = component[property];
|
|
136
|
+
const valueIsEmpty = isValueEmpty(value);
|
|
137
|
+
for (const validator of sortedValidators) {
|
|
138
|
+
if (valueIsEmpty && !validator.validateEmptyValues) {
|
|
139
|
+
continue;
|
|
140
|
+
}
|
|
141
|
+
const passed = validator.run(component, property);
|
|
142
|
+
if (!passed && validator.blocking)
|
|
143
|
+
break;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Creates a property decorator that registers a validator for a component property.
|
|
148
|
+
*
|
|
149
|
+
* The returned decorator ensures property access is intercepted, initial-load
|
|
150
|
+
* validation is enabled, and the provided validator is stored for execution.
|
|
151
|
+
*
|
|
152
|
+
* @param validator Validator definition to register.
|
|
153
|
+
* @returns Property decorator compatible with TypeScript decorator syntax.
|
|
154
|
+
*/
|
|
155
|
+
export function createValidatorDecorator(validator) {
|
|
156
|
+
return function (target, property) {
|
|
157
|
+
createPropertyAccessor(target, property);
|
|
158
|
+
patchComponentDidLoad(target);
|
|
159
|
+
getDecoratedProperties(target).add(property);
|
|
160
|
+
getValidators(target, property).push(validator);
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Builds a validation context for a decorated component property.
|
|
165
|
+
*
|
|
166
|
+
* The returned context includes:
|
|
167
|
+
* - `value`: current property value.
|
|
168
|
+
* - `showError(constraint)`: helper that logs a consistent error format and includes
|
|
169
|
+
* the host element for easier debugging in browser consoles.
|
|
170
|
+
*
|
|
171
|
+
* Message format: `[componentName] Property "property" <constraint>. Received: <value>.`
|
|
172
|
+
*
|
|
173
|
+
* @param component Component instance containing the validated property.
|
|
174
|
+
* @param property Property name being validated.
|
|
175
|
+
* @returns Validation context used by individual validator implementations.
|
|
176
|
+
*/
|
|
177
|
+
export function getValidationContext(component, property) {
|
|
178
|
+
const host = getElement(component);
|
|
179
|
+
const componentName = host.localName;
|
|
180
|
+
const value = component[property];
|
|
181
|
+
return {
|
|
182
|
+
value,
|
|
183
|
+
showError(constraint) {
|
|
184
|
+
console.error(`[${componentName}] Property "${String(property)}" ${constraint}. Received: ${JSON.stringify(value)}.`, host);
|
|
185
|
+
},
|
|
186
|
+
};
|
|
187
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { createValidatorDecorator, getValidationContext } from "./create-validator-decorator";
|
|
2
|
+
/**
|
|
3
|
+
* Property decorator that validates the property value is a valid date string.
|
|
4
|
+
*
|
|
5
|
+
* Validation runs on `componentDidLoad` and whenever the property value changes.
|
|
6
|
+
*/
|
|
7
|
+
export function DateValue() {
|
|
8
|
+
return createValidatorDecorator({
|
|
9
|
+
priority: 1,
|
|
10
|
+
blocking: false,
|
|
11
|
+
run(component, property) {
|
|
12
|
+
const { value, showError } = getValidationContext(component, property);
|
|
13
|
+
const isValid = typeof value === 'string' && !Number.isNaN(new Date(value).getTime());
|
|
14
|
+
if (!isValid) {
|
|
15
|
+
showError('must be a valid date string');
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
return true;
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { ArrayOf } from './array-of';
|
|
2
|
+
export { createValidatorDecorator, getValidationContext } from './create-validator-decorator';
|
|
3
|
+
export { DateValue } from './date';
|
|
4
|
+
export { IsoDate } from './iso-date';
|
|
5
|
+
export { OneOf } from './one-of';
|
|
6
|
+
export { Pattern } from './pattern';
|
|
7
|
+
export { Required } from './required';
|
|
8
|
+
export { Type } from './type';
|
|
9
|
+
export { Url } from './url';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { isIsoDate } from "../is-iso-date";
|
|
2
|
+
import { createValidatorDecorator, getValidationContext } from "./create-validator-decorator";
|
|
3
|
+
/**
|
|
4
|
+
* Property decorator that validates the property value is a date in ISO 8601 format (YYYY-MM-DD).
|
|
5
|
+
*
|
|
6
|
+
* Validation runs on `componentDidLoad` and whenever the property value changes.
|
|
7
|
+
*/
|
|
8
|
+
export function IsoDate() {
|
|
9
|
+
return createValidatorDecorator({
|
|
10
|
+
priority: 1,
|
|
11
|
+
blocking: false,
|
|
12
|
+
run(component, property) {
|
|
13
|
+
const { value, showError } = getValidationContext(component, property);
|
|
14
|
+
if (!isIsoDate(String(value))) {
|
|
15
|
+
showError('must be in ISO format (YYYY-MM-DD)');
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
return true;
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { createValidatorDecorator, getValidationContext } from "./create-validator-decorator";
|
|
2
|
+
/**
|
|
3
|
+
* Property decorator that validates the property value is one of the allowed values.
|
|
4
|
+
*
|
|
5
|
+
* Validation runs on `componentDidLoad` and whenever the property value changes.
|
|
6
|
+
*
|
|
7
|
+
* @param possibleValues - The array of allowed values for the property.
|
|
8
|
+
*/
|
|
9
|
+
export function OneOf(possibleValues) {
|
|
10
|
+
return createValidatorDecorator({
|
|
11
|
+
priority: 1,
|
|
12
|
+
blocking: false,
|
|
13
|
+
run(component, property) {
|
|
14
|
+
const { value, showError } = getValidationContext(component, property);
|
|
15
|
+
if (!possibleValues.includes(value)) {
|
|
16
|
+
showError(`must be one of [${possibleValues.join(', ')}]`);
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
return true;
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { createValidatorDecorator, getValidationContext } from "./create-validator-decorator";
|
|
2
|
+
/**
|
|
3
|
+
* Property decorator that validates the property value matches a regular expression.
|
|
4
|
+
*
|
|
5
|
+
* Validation runs on `componentDidLoad` and whenever the property value changes.
|
|
6
|
+
*
|
|
7
|
+
* @param pattern - The regex pattern the property value must match.
|
|
8
|
+
*/
|
|
9
|
+
export function Pattern(pattern) {
|
|
10
|
+
return createValidatorDecorator({
|
|
11
|
+
priority: 1,
|
|
12
|
+
blocking: false,
|
|
13
|
+
run(component, property) {
|
|
14
|
+
const { value, showError } = getValidationContext(component, property);
|
|
15
|
+
if (typeof value !== 'string' || !pattern.test(value)) {
|
|
16
|
+
showError(`must match ${pattern}`);
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
return true;
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { isValueEmpty } from "../is-value-empty";
|
|
2
|
+
import { createValidatorDecorator, getValidationContext } from "./create-validator-decorator";
|
|
3
|
+
/**
|
|
4
|
+
* Property decorator that validates the property is not empty.
|
|
5
|
+
* If the property is empty (undefined, null, '', NaN), an error is logged.
|
|
6
|
+
* This validator is blocking: if it fails, subsequent validators will not run.
|
|
7
|
+
*
|
|
8
|
+
* Validation runs on `componentDidLoad` and whenever the property value changes.
|
|
9
|
+
*/
|
|
10
|
+
export function Required() {
|
|
11
|
+
return createValidatorDecorator({
|
|
12
|
+
priority: 0,
|
|
13
|
+
blocking: true,
|
|
14
|
+
validateEmptyValues: true,
|
|
15
|
+
run(component, property) {
|
|
16
|
+
const { value, showError } = getValidationContext(component, property);
|
|
17
|
+
if (isValueEmpty(value)) {
|
|
18
|
+
showError('is required');
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
return true;
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { createValidatorDecorator, getValidationContext } from "./create-validator-decorator";
|
|
2
|
+
/**
|
|
3
|
+
* Property decorator that validates the property value is of the specified type.
|
|
4
|
+
*
|
|
5
|
+
* Validation runs on `componentDidLoad` and whenever the property value changes.
|
|
6
|
+
*
|
|
7
|
+
* @param type - The expected type ('boolean', 'number', 'string', 'array', 'object', 'function').
|
|
8
|
+
*/
|
|
9
|
+
export function Type(type) {
|
|
10
|
+
return createValidatorDecorator({
|
|
11
|
+
priority: 1,
|
|
12
|
+
blocking: false,
|
|
13
|
+
run(component, property) {
|
|
14
|
+
const { value, showError } = getValidationContext(component, property);
|
|
15
|
+
const typeIsArray = type === 'array';
|
|
16
|
+
const valueIsArray = Array.isArray(value);
|
|
17
|
+
const isValid = typeIsArray || valueIsArray ? valueIsArray === typeIsArray : typeof value === type;
|
|
18
|
+
if (!isValid) {
|
|
19
|
+
showError(`must be of type "${type}"`);
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
return true;
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { createValidatorDecorator, getValidationContext } from "./create-validator-decorator";
|
|
2
|
+
/**
|
|
3
|
+
* Property decorator that validates the property value is a valid URL.
|
|
4
|
+
*
|
|
5
|
+
* Validation runs on `componentDidLoad` and whenever the property value changes.
|
|
6
|
+
*/
|
|
7
|
+
export function Url() {
|
|
8
|
+
return createValidatorDecorator({
|
|
9
|
+
priority: 1,
|
|
10
|
+
blocking: false,
|
|
11
|
+
run(component, property) {
|
|
12
|
+
const { value, showError } = getValidationContext(component, property);
|
|
13
|
+
let isValid = typeof value === 'string' || value instanceof URL;
|
|
14
|
+
if (isValid) {
|
|
15
|
+
try {
|
|
16
|
+
new URL(value, 'https://www.post.ch');
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
isValid = false;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
if (!isValid) {
|
|
23
|
+
showError('must be a valid URL');
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
return true;
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function t(t,i,e){var s,n=e||{},o=n.noTrailing,d=void 0!==o&&o,h=n.noLeading,v=void 0!==h&&h,c=n.debounceMode,r=void 0===c?void 0:c,a=!1,u=0;function m(){s&&clearTimeout(s)}function l(){for(var e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];var h=this,c=Date.now()-u;function l(){u=Date.now(),i.apply(h,n)}function b(){s=void 0}a||(v||!r||s||l(),m(),void 0===r&&c>t?v?(u=Date.now(),d||(s=setTimeout(r?b:l,t))):l():!0!==d&&(s=setTimeout(r?b:l,void 0===r?t-c:t)))}return l.cancel=function(t){var i=(t||{}).upcomingOnly,e=void 0!==i&&i;m(),a=!e},l}function i(i,e){var s={}.atBegin;return t(i,e,{debounceMode:!1!==(void 0!==s&&s)})}const e=new class{constructor(){this.breakpoints=[{key:"xl",device:"desktop",minWidth:1280},{key:"lg",device:"desktop",minWidth:1024},{key:"md",device:"tablet",minWidth:780},{key:"sm",device:"tablet",minWidth:600},{key:"xs",device:"mobile",minWidth:0}],this.resizeObserver=globalThis.ResizeObserver?new ResizeObserver((()=>this.updateCurrentBreakpoint())):null,this.updateCurrentBreakpoint=t(50,((t={emitEvents:!0})=>{const i=this.currentBreakpoint,e=this.breakpoints.find((t=>t.minWidth<=innerWidth));e&&(this.currentBreakpoint=e,t.emitEvents&&Object.keys(this.currentBreakpoint).filter((t=>!i||this.currentBreakpoint[t]!==i[t])).forEach((t=>this.dispatchEvent(t))))})),this.resizeObserver&&(this.updateCurrentBreakpoint({emitEvents:!1}),this.resizeObserver.observe(document.body))}dispatchEvent(t){globalThis.dispatchEvent(new CustomEvent(`postBreakpoint:${t}`,{detail:this.currentBreakpoint[t]}))}get(t){return this.updateCurrentBreakpoint({emitEvents:!1}),this.currentBreakpoint[t]}};export{e as b,i as d,t}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e){return"function"==typeof e.componentOnReady?e.componentOnReady():new Promise((t=>{return n=()=>{t(e)},"function"==typeof requestAnimationFrame?requestAnimationFrame(n):setTimeout(n);var n}))}export{e as c}
|