@nectary/components 5.42.5-rc.0 → 5.43.1
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/accordion/global/index.js +1 -1
- package/accordion/index.js +5 -5
- package/accordion-item/global/index.js +1 -1
- package/accordion-item/index.js +6 -6
- package/action-menu/global/index.js +1 -1
- package/action-menu/index.js +4 -4
- package/action-menu-option/global/index.js +1 -1
- package/action-menu-option/index.js +4 -4
- package/alert/global/index.js +1 -1
- package/alert/index.js +6 -6
- package/avatar/global/index.js +1 -1
- package/avatar/index.js +4 -4
- package/badge/global/index.js +1 -1
- package/badge/index.js +5 -5
- package/bundle.js +8259 -13221
- package/button/global/index.js +1 -1
- package/button/index.js +7 -7
- package/button-group/global/index.js +1 -1
- package/button-group/index.js +4 -4
- package/button-group-item/global/index.js +1 -1
- package/button-group-item/index.js +3 -3
- package/card-container/global/index.js +1 -1
- package/card-container/index.js +1 -1
- package/card-v2/global/index.js +1 -1
- package/card-v2/index.js +3 -3
- package/card-v2-title/global/index.js +1 -1
- package/card-v2-title/index.js +2 -2
- package/checkbox/global/index.js +1 -1
- package/checkbox/index.js +5 -5
- package/chip/global/index.js +1 -1
- package/chip/index.js +6 -6
- package/code-tag/global/index.js +1 -1
- package/code-tag/index.js +2 -2
- package/color-menu/global/index.js +1 -1
- package/color-menu/index.js +6 -6
- package/color-menu-option/global/index.js +1 -1
- package/color-menu-option/index.js +5 -5
- package/color-swatch/global/index.js +2 -2
- package/color-swatch/index.js +19 -5
- package/color-swatch/utils.d.ts +2 -2
- package/color-swatch/utils.js +1 -1
- package/date-picker/global/index.js +1 -1
- package/date-picker/index.js +10 -10
- package/dialog/global/index.js +1 -1
- package/dialog/index.d.ts +2 -2
- package/dialog/index.js +9 -9
- package/emoji/global/index.js +1 -1
- package/emoji/index.js +3 -3
- package/emoji/utils.js +1 -1
- package/emoji-picker/global/index.js +1 -1
- package/emoji-picker/index.js +16 -13
- package/field/global/index.js +1 -1
- package/field/index.js +4 -4
- package/field-v2/global/index.js +1 -1
- package/field-v2/index.js +5 -5
- package/file-drop/global/index.js +1 -1
- package/file-drop/index.js +6 -6
- package/file-picker/global/index.js +1 -1
- package/file-picker/index.js +4 -4
- package/file-status/global/index.js +1 -1
- package/file-status/index.js +6 -6
- package/flag/global/index.js +1 -1
- package/flag/index.js +3 -3
- package/flag/utils.js +1 -1
- package/floating-panel/global/index.js +1 -1
- package/floating-panel/index.d.ts +3 -3
- package/floating-panel/index.js +12 -10
- package/floating-panel-button/index.js +3 -3
- package/floating-panel-icon-button/index.js +4 -4
- package/grid/global/index.js +1 -1
- package/grid/index.js +1 -1
- package/grid-item/global/index.js +1 -1
- package/grid-item/index.js +2 -2
- package/help-tooltip/global/index.js +1 -1
- package/help-tooltip/index.js +5 -5
- package/icon/generated-icon-type.d.ts +1 -1
- package/icon/global/index.js +1 -1
- package/icon/index.d.ts +1 -1
- package/icon/index.js +2 -2
- package/inline-alert/global/index.js +1 -1
- package/inline-alert/index.js +8 -8
- package/input/global/index.js +1 -1
- package/input/index.js +8 -8
- package/link/global/index.js +1 -1
- package/link/index.d.ts +2 -2
- package/link/index.js +10 -10
- package/link/types.d.ts +8 -8
- package/list/global/index.js +1 -1
- package/list/index.js +1 -1
- package/list-item/global/index.js +1 -1
- package/list-item/index.js +1 -1
- package/package.json +10 -10
- package/pagination/global/index.js +1 -1
- package/pagination/index.d.ts +2 -2
- package/pagination/index.js +6 -6
- package/persistent-overlay/global/index.js +1 -1
- package/persistent-overlay/index.js +4 -4
- package/pop/global/index.js +1 -1
- package/pop/index.d.ts +1 -1
- package/pop/index.js +10 -9
- package/popover/global/index.js +1 -1
- package/popover/index.js +7 -7
- package/progress/global/index.js +1 -1
- package/progress/index.js +3 -3
- package/progress-stepper/global/index.js +1 -1
- package/progress-stepper/index.js +6 -6
- package/progress-stepper-item/global/index.js +1 -1
- package/progress-stepper-item/index.js +5 -5
- package/progress-stepper-item/utils.d.ts +5 -5
- package/progress-stepper-item/utils.js +1 -1
- package/progress-stepper-item-v2/global/index.js +1 -1
- package/progress-stepper-item-v2/index.js +6 -5
- package/progress-stepper-item-v2/utils.d.ts +3 -3
- package/progress-stepper-item-v2/utils.js +1 -1
- package/progress-stepper-v2/compact.js +5 -4
- package/progress-stepper-v2/global/index.js +1 -1
- package/progress-stepper-v2/index.js +14 -11
- package/progress-stepper-v2/separators.js +1 -1
- package/progress-stepper-v2/step-chip.js +2 -2
- package/radio/global/index.js +1 -1
- package/radio/index.js +4 -4
- package/radio-option/global/index.js +1 -1
- package/radio-option/index.js +2 -2
- package/rich-text/global/index.js +1 -1
- package/rich-text/index.js +10 -10
- package/rich-text/utils.js +1 -1
- package/rich-textarea/global/index.js +1 -1
- package/rich-textarea/index.js +8 -8
- package/rich-textarea/utils.js +2 -2
- package/rich-textarea-chip/index.js +5 -5
- package/segment-collapse/global/index.js +1 -1
- package/segment-collapse/index.js +4 -4
- package/segmented-control/global/index.js +1 -1
- package/segmented-control/index.js +5 -5
- package/segmented-control-option/global/index.js +1 -1
- package/segmented-control-option/index.js +3 -3
- package/segmented-icon-control/global/index.js +1 -1
- package/segmented-icon-control/index.js +6 -6
- package/segmented-icon-control-option/global/index.js +1 -1
- package/segmented-icon-control-option/index.js +3 -3
- package/select-button/global/index.js +1 -1
- package/select-button/index.js +7 -7
- package/select-menu/global/index.js +1 -1
- package/select-menu/index.js +12 -12
- package/select-menu-option/global/index.js +1 -1
- package/select-menu-option/index.js +4 -4
- package/sheet/global/index.js +1 -1
- package/sheet/index.d.ts +1 -1
- package/sheet/index.js +7 -7
- package/sheet-title/global/index.js +1 -1
- package/sheet-title/index.d.ts +1 -1
- package/sheet-title/index.js +5 -5
- package/skeleton/global/index.js +1 -1
- package/skeleton/index.js +3 -3
- package/skeleton-item/global/index.js +1 -1
- package/skeleton-item/index.js +1 -1
- package/spinner/global/index.js +1 -1
- package/spinner/index.js +4 -4
- package/standalone.js +88 -25
- package/stop-events/index.js +2 -2
- package/table/global/index.js +1 -1
- package/table/index.js +1 -1
- package/table-body/global/index.js +1 -1
- package/table-body/index.js +1 -1
- package/table-cell/global/index.js +1 -1
- package/table-cell/index.js +3 -3
- package/table-head/global/index.js +1 -1
- package/table-head/index.js +1 -1
- package/table-head-cell/global/index.js +1 -1
- package/table-head-cell/index.js +4 -4
- package/table-row/global/index.js +1 -1
- package/table-row/index.js +2 -2
- package/tabs/global/index.js +1 -1
- package/tabs/index.js +6 -6
- package/tabs-icon-option/global/index.js +1 -1
- package/tabs-icon-option/index.js +3 -3
- package/tabs-option/global/index.js +1 -1
- package/tabs-option/index.js +4 -4
- package/tag/global/index.js +1 -1
- package/tag/index.js +5 -5
- package/text/global/index.js +1 -1
- package/text/index.js +3 -3
- package/textarea/global/index.js +1 -1
- package/textarea/index.js +7 -7
- package/time-picker/global/index.js +1 -1
- package/time-picker/index.js +8 -7
- package/title/global/index.js +1 -1
- package/title/index.js +3 -3
- package/toast/global/index.js +1 -1
- package/toast/index.js +7 -7
- package/toast/types.d.ts +0 -2
- package/toast-manager/global/index.js +1 -1
- package/toast-manager/index.js +7 -6
- package/toggle/global/index.js +1 -1
- package/toggle/index.js +3 -3
- package/tooltip/global/index.js +1 -1
- package/tooltip/index.d.ts +1 -1
- package/tooltip/index.js +9 -8
- package/utils/component-names.d.ts +1 -1
- package/utils/control-keyboard-navigation.d.ts +1 -1
- package/utils/control-keyboard-navigation.js +2 -2
- package/utils/element.d.ts +109 -16
- package/utils/element.js +2 -2
- package/utils/global-components-manager.d.ts +47 -4
- package/utils/global-components-manager.js +2 -91
- package/utils/index.js +73 -73
- package/utils/placement.js +1 -1
- package/utils/rect.js +1 -1
- package/utils/shared/cdn-loader.js +136 -0
- package/utils/shared/deferred-promise.js +10 -0
- package/utils/shared/global-elements-manager.js +150 -0
- package/utils/shared/global-elements-store.js +33 -0
- package/utils/shared/index.d.js +16 -0
- package/utils/shared/index.js +16 -0
- package/utils/shared/nectary-element-base.js +25 -0
- package/accordion/types.d.js +0 -1
- package/accordion-item/index.d.js +0 -3
- package/action-menu/global/index.d.js +0 -1
- package/action-menu/index.d.js +0 -1
- package/action-menu/types.d.js +0 -1
- package/action-menu-option/global/index.d.js +0 -1
- package/action-menu-option/index.d.js +0 -1
- package/action-menu-option/types.d.js +0 -1
- package/action-menu-option/utils.d.js +0 -1
- package/alert/global/index.d.js +0 -1
- package/alert/index.d.js +0 -3
- package/alert/types.d.js +0 -1
- package/alert/utils.d.js +0 -1
- package/avatar/colors.d.js +0 -1
- package/avatar/global/index.d.js +0 -1
- package/avatar/index.d.js +0 -1
- package/avatar/types.d.js +0 -1
- package/avatar/utils.d.js +0 -1
- package/badge/global/index.d.js +0 -1
- package/badge/index.d.js +0 -1
- package/badge/types.d.js +0 -1
- package/badge/utils.d.js +0 -1
- package/button/global/index.d.js +0 -1
- package/button/index.d.js +0 -1
- package/button/types.d.js +0 -1
- package/button/utils.d.js +0 -1
- package/button-group/global/index.d.js +0 -1
- package/button-group/index.d.js +0 -1
- package/button-group/types.d.js +0 -1
- package/button-group-item/global/index.d.js +0 -1
- package/button-group-item/index.d.js +0 -1
- package/button-group-item/types.d.js +0 -1
- package/card-container/global/index.d.js +0 -1
- package/card-container/index.d.js +0 -1
- package/card-container/types.d.js +0 -1
- package/card-v2/global/index.d.js +0 -1
- package/card-v2/index.d.js +0 -1
- package/card-v2/types.d.js +0 -1
- package/card-v2-title/global/index.d.js +0 -1
- package/card-v2-title/index.d.js +0 -1
- package/card-v2-title/types.d.js +0 -1
- package/checkbox/global/index.d.js +0 -1
- package/checkbox/index.d.js +0 -1
- package/checkbox/types.d.js +0 -1
- package/chip/colors.d.js +0 -1
- package/chip/global/index.d.js +0 -1
- package/chip/index.d.js +0 -2
- package/chip/types.d.js +0 -1
- package/chip/utils.d.js +0 -1
- package/code-tag/global/index.d.js +0 -1
- package/code-tag/index.d.js +0 -1
- package/code-tag/types.d.js +0 -1
- package/color-menu/global/index.d.js +0 -1
- package/color-menu/index.d.js +0 -1
- package/color-menu/types.d.js +0 -1
- package/color-menu/utils.d.js +0 -1
- package/color-menu-option/global/index.d.js +0 -1
- package/color-menu-option/index.d.js +0 -2
- package/color-menu-option/types.d.js +0 -1
- package/color-menu-option/utils.d.js +0 -1
- package/color-swatch/global/index.d.js +0 -40
- package/color-swatch/index.d.js +0 -6
- package/color-swatch/types.d.js +0 -1
- package/color-swatch/utils.d.js +0 -1
- package/date-picker/global/index.d.js +0 -1
- package/date-picker/index.d.js +0 -2
- package/date-picker/types.d.js +0 -1
- package/date-picker/utils.d.js +0 -1
- package/dialog/global/index.d.js +0 -1
- package/dialog/index.d.js +0 -3
- package/dialog/types.d.js +0 -1
- package/emoji/global/index.d.js +0 -1
- package/emoji/index.d.js +0 -1
- package/emoji/types.d.js +0 -1
- package/emoji/utils.d.js +0 -1
- package/emoji-picker/global/index.d.js +0 -1
- package/emoji-picker/index.d.js +0 -7
- package/emoji-picker/types.d.js +0 -1
- package/field/global/index.d.js +0 -1
- package/field/index.d.js +0 -1
- package/field/types.d.js +0 -1
- package/field-v2/global/index.d.js +0 -1
- package/field-v2/index.d.js +0 -1
- package/field-v2/types.d.js +0 -1
- package/file-drop/global/index.d.js +0 -1
- package/file-drop/index.d.js +0 -2
- package/file-drop/types.d.js +0 -1
- package/file-drop/utils.d.js +0 -1
- package/file-picker/global/index.d.js +0 -1
- package/file-picker/index.d.js +0 -1
- package/file-picker/types.d.js +0 -1
- package/file-picker/utils.d.js +0 -1
- package/file-status/global/index.d.js +0 -1
- package/file-status/index.d.js +0 -3
- package/file-status/types.d.js +0 -1
- package/file-status/utils.d.js +0 -1
- package/flag/global/index.d.js +0 -1
- package/flag/index.d.js +0 -1
- package/flag/types.d.js +0 -1
- package/flag/utils.d.js +0 -1
- package/floating-panel/global/index.d.js +0 -1
- package/floating-panel/index.d.js +0 -4
- package/floating-panel/types.d.js +0 -1
- package/floating-panel-button/index.d.js +0 -1
- package/floating-panel-button/types.d.js +0 -1
- package/floating-panel-icon-button/index.d.js +0 -2
- package/floating-panel-icon-button/types.d.js +0 -1
- package/grid/global/index.d.js +0 -1
- package/grid/index.d.js +0 -1
- package/grid/types.d.js +0 -1
- package/grid-item/global/index.d.js +0 -1
- package/grid-item/index.d.js +0 -1
- package/grid-item/types.d.js +0 -1
- package/help-tooltip/global/index.d.js +0 -1
- package/help-tooltip/index.d.js +0 -2
- package/help-tooltip/types.d.js +0 -1
- package/icon/generated-icon-type.d.js +0 -1
- package/icon/global/index.d.js +0 -1
- package/icon/index.d.js +0 -1
- package/icon/types.d.js +0 -1
- package/inline-alert/global/index.d.js +0 -1
- package/inline-alert/index.d.js +0 -5
- package/inline-alert/types.d.js +0 -1
- package/inline-alert/utils.d.js +0 -1
- package/input/global/index.d.js +0 -1
- package/input/index.d.js +0 -1
- package/input/types.d.js +0 -1
- package/input/utils.d.js +0 -1
- package/link/global/index.d.js +0 -1
- package/link/index.d.js +0 -2
- package/link/types.d.js +0 -1
- package/link/utils.d.js +0 -1
- package/list/global/index.d.js +0 -1
- package/list/index.d.js +0 -1
- package/list/types.d.js +0 -1
- package/list-item/global/index.d.js +0 -1
- package/list-item/index.d.js +0 -1
- package/list-item/types.d.js +0 -1
- package/pagination/global/index.d.js +0 -1
- package/pagination/index.d.js +0 -1
- package/pagination/types.d.js +0 -1
- package/persistent-overlay/global/index.d.js +0 -1
- package/persistent-overlay/index.d.js +0 -1
- package/persistent-overlay/types.d.js +0 -1
- package/pop/global/index.d.js +0 -1
- package/pop/index.d.js +0 -1
- package/pop/types.d.js +0 -1
- package/pop/utils.d.js +0 -1
- package/popover/global/index.d.js +0 -1
- package/popover/index.d.js +0 -1
- package/popover/types.d.js +0 -1
- package/popover/utils.d.js +0 -1
- package/progress/global/index.d.js +0 -1
- package/progress/index.d.js +0 -1
- package/progress/types.d.js +0 -1
- package/progress-stepper/global/index.d.js +0 -1
- package/progress-stepper/index.d.js +0 -1
- package/progress-stepper/types.d.js +0 -1
- package/progress-stepper-item/global/index.d.js +0 -1
- package/progress-stepper-item/index.d.js +0 -2
- package/progress-stepper-item/types.d.js +0 -1
- package/progress-stepper-item/utils.d.js +0 -1
- package/progress-stepper-item-v2/global/index.d.js +0 -1
- package/progress-stepper-item-v2/index.d.js +0 -2
- package/progress-stepper-item-v2/types.d.js +0 -1
- package/progress-stepper-item-v2/utils.d.js +0 -1
- package/progress-stepper-v2/compact-format.d.js +0 -1
- package/progress-stepper-v2/compact.d.js +0 -1
- package/progress-stepper-v2/global/index.d.js +0 -1
- package/progress-stepper-v2/index.d.js +0 -84
- package/progress-stepper-v2/model.d.js +0 -1
- package/progress-stepper-v2/orientation.d.js +0 -1
- package/progress-stepper-v2/separators.d.js +0 -1
- package/progress-stepper-v2/step-chip.d.js +0 -1
- package/progress-stepper-v2/types.d.js +0 -1
- package/radio/global/index.d.js +0 -1
- package/radio/index.d.js +0 -1
- package/radio/types.d.js +0 -1
- package/radio-option/global/index.d.js +0 -1
- package/radio-option/index.d.js +0 -1
- package/radio-option/types.d.js +0 -1
- package/rich-text/global/index.d.js +0 -1
- package/rich-text/index.d.js +0 -4
- package/rich-text/types.d.js +0 -1
- package/rich-text/utils.d.js +0 -1
- package/rich-textarea/global/index.d.js +0 -1
- package/rich-textarea/index.d.js +0 -1
- package/rich-textarea/types.d.js +0 -1
- package/rich-textarea/utils.d.js +0 -1
- package/rich-textarea-chip/index.d.js +0 -2
- package/rich-textarea-chip/types.d.js +0 -1
- package/segment-collapse/global/index.d.js +0 -1
- package/segment-collapse/index.d.js +0 -1
- package/segment-collapse/types.d.js +0 -1
- package/segmented-control/global/index.d.js +0 -1
- package/segmented-control/index.d.js +0 -1
- package/segmented-control/types.d.js +0 -1
- package/segmented-control-option/global/index.d.js +0 -1
- package/segmented-control-option/index.d.js +0 -1
- package/segmented-control-option/types.d.js +0 -1
- package/segmented-icon-control/global/index.d.js +0 -1
- package/segmented-icon-control/index.d.js +0 -1
- package/segmented-icon-control/types.d.js +0 -1
- package/segmented-icon-control-option/global/index.d.js +0 -1
- package/segmented-icon-control-option/index.d.js +0 -1
- package/segmented-icon-control-option/types.d.js +0 -1
- package/select-button/global/index.d.js +0 -1
- package/select-button/index.d.js +0 -2
- package/select-button/types.d.js +0 -1
- package/select-menu/global/index.d.js +0 -1
- package/select-menu/index.d.js +0 -3
- package/select-menu/types.d.js +0 -1
- package/select-menu-option/global/index.d.js +0 -1
- package/select-menu-option/index.d.js +0 -2
- package/select-menu-option/types.d.js +0 -1
- package/select-menu-option/utils.d.js +0 -1
- package/sheet/global/index.d.js +0 -1
- package/sheet/index.d.js +0 -1
- package/sheet/types.d.js +0 -1
- package/sheet-title/global/index.d.js +0 -1
- package/sheet-title/index.d.js +0 -2
- package/sheet-title/types.d.js +0 -1
- package/skeleton/global/index.d.js +0 -1
- package/skeleton/index.d.js +0 -1
- package/skeleton/types.d.js +0 -1
- package/skeleton-item/global/index.d.js +0 -1
- package/skeleton-item/index.d.js +0 -1
- package/skeleton-item/types.d.js +0 -1
- package/spinner/global/index.d.js +0 -1
- package/spinner/index.d.js +0 -1
- package/spinner/types.d.js +0 -1
- package/stop-events/index.d.js +0 -1
- package/table/global/index.d.js +0 -1
- package/table/index.d.js +0 -1
- package/table/types.d.js +0 -1
- package/table-body/global/index.d.js +0 -1
- package/table-body/index.d.js +0 -1
- package/table-body/types.d.js +0 -1
- package/table-cell/global/index.d.js +0 -1
- package/table-cell/index.d.js +0 -1
- package/table-cell/types.d.js +0 -1
- package/table-cell/utils.d.js +0 -1
- package/table-head/global/index.d.js +0 -1
- package/table-head/index.d.js +0 -1
- package/table-head/types.d.js +0 -1
- package/table-head-cell/global/index.d.js +0 -1
- package/table-head-cell/index.d.js +0 -1
- package/table-head-cell/types.d.js +0 -1
- package/table-row/global/index.d.js +0 -1
- package/table-row/index.d.js +0 -1
- package/table-row/types.d.js +0 -1
- package/tabs/global/index.d.js +0 -1
- package/tabs/index.d.js +0 -1
- package/tabs/types.d.js +0 -1
- package/tabs-icon-option/global/index.d.js +0 -1
- package/tabs-icon-option/index.d.js +0 -1
- package/tabs-icon-option/types.d.js +0 -1
- package/tabs-option/global/index.d.js +0 -1
- package/tabs-option/index.d.js +0 -1
- package/tabs-option/types.d.js +0 -1
- package/tag/colors.d.js +0 -1
- package/tag/global/index.d.js +0 -1
- package/tag/index.d.js +0 -2
- package/tag/types.d.js +0 -1
- package/tag/utils.d.js +0 -1
- package/text/global/index.d.js +0 -1
- package/text/index.d.js +0 -1
- package/text/types.d.js +0 -1
- package/text/utils.d.js +0 -1
- package/textarea/global/index.d.js +0 -1
- package/textarea/index.d.js +0 -1
- package/textarea/types.d.js +0 -1
- package/time-picker/global/index.d.js +0 -1
- package/time-picker/index.d.js +0 -2
- package/time-picker/types.d.js +0 -1
- package/time-picker/utils.d.js +0 -1
- package/title/global/index.d.js +0 -1
- package/title/index.d.js +0 -1
- package/title/types.d.js +0 -1
- package/title/utils.d.js +0 -1
- package/toast/global/index.d.js +0 -1
- package/toast/index.d.js +0 -2
- package/toast/types.d.js +0 -1
- package/toast/utils.d.js +0 -1
- package/toast-manager/global/index.d.js +0 -1
- package/toast-manager/index.d.js +0 -2
- package/toast-manager/types.d.js +0 -1
- package/toast-manager/utils.d.js +0 -1
- package/toggle/global/index.d.js +0 -1
- package/toggle/index.d.js +0 -1
- package/toggle/types.d.js +0 -1
- package/tooltip/global/index.d.js +0 -1
- package/tooltip/index.d.js +0 -2
- package/tooltip/tooltip-state.d.js +0 -1
- package/tooltip/types.d.js +0 -1
- package/tooltip/utils.d.js +0 -1
- package/utils/adapters.d.js +0 -1
- package/utils/component-names.d.js +0 -1
- package/utils/context.d.js +0 -1
- package/utils/control-keyboard-navigation.d.js +0 -1
- package/utils/countries.d.js +0 -1
- package/utils/csv.d.js +0 -1
- package/utils/debounce.d.js +0 -1
- package/utils/dom.d.js +0 -1
- package/utils/element.d.js +0 -1
- package/utils/event-target.d.js +0 -1
- package/utils/form.d.js +0 -1
- package/utils/get-react-event-handler.d.js +0 -1
- package/utils/global-components-constants.d.js +0 -1
- package/utils/global-components-manager.d.js +0 -1
- package/utils/index.d.js +0 -75
- package/utils/markdown.d.js +0 -1
- package/utils/placement.d.js +0 -1
- package/utils/rect.d.js +0 -1
- package/utils/scroll-lock.d.js +0 -1
- package/utils/size.d.js +0 -1
- package/utils/slot.d.js +0 -1
- package/utils/throttle.d.js +0 -1
- package/utils/uid.d.js +0 -1
- /package/{accordion-item/global/index.d.js → utils/shared/cdn-loader.d.js} +0 -0
- /package/{accordion-item/types.d.js → utils/shared/deferred-promise.d.js} +0 -0
- /package/{accordion-item/utils.d.js → utils/shared/global-elements-manager.d.js} +0 -0
- /package/{accordion/global/index.d.js → utils/shared/global-elements-store.d.js} +0 -0
- /package/{accordion/index.d.js → utils/shared/nectary-element-base.d.js} +0 -0
package/utils/element.d.ts
CHANGED
|
@@ -1,25 +1,118 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
// Generated by dts-bundle-generator v9.5.1
|
|
2
|
+
|
|
3
|
+
export type SinchElementName = `sinch-${string}`;
|
|
4
|
+
declare class NectaryElementBase extends HTMLElement {
|
|
5
|
+
private static _isGlobal;
|
|
6
|
+
static get elementName(): SinchElementName;
|
|
7
|
+
static get isGlobal(): boolean;
|
|
8
|
+
static set isGlobal(value: boolean);
|
|
9
|
+
}
|
|
10
|
+
declare const BASE_COMPONENT_NAMES_LIST: readonly [
|
|
11
|
+
"accordion-item",
|
|
12
|
+
"accordion",
|
|
13
|
+
"action-menu-option",
|
|
14
|
+
"action-menu",
|
|
15
|
+
"alert",
|
|
16
|
+
"avatar",
|
|
17
|
+
"badge",
|
|
18
|
+
"button-group-item",
|
|
19
|
+
"button-group",
|
|
20
|
+
"button",
|
|
21
|
+
"card-container",
|
|
22
|
+
"card-v2-title",
|
|
23
|
+
"card-v2",
|
|
24
|
+
"checkbox",
|
|
25
|
+
"chip",
|
|
26
|
+
"code-tag",
|
|
27
|
+
"color-menu-option",
|
|
28
|
+
"color-menu",
|
|
29
|
+
"color-swatch",
|
|
30
|
+
"date-picker",
|
|
31
|
+
"dialog",
|
|
32
|
+
"emoji-picker",
|
|
33
|
+
"emoji",
|
|
34
|
+
"field",
|
|
35
|
+
"field-v2",
|
|
36
|
+
"file-drop",
|
|
37
|
+
"file-picker",
|
|
38
|
+
"file-status",
|
|
39
|
+
"flag",
|
|
40
|
+
"floating-panel",
|
|
41
|
+
"floating-panel-button",
|
|
42
|
+
"floating-panel-icon-button",
|
|
43
|
+
"grid-item",
|
|
44
|
+
"grid",
|
|
45
|
+
"help-tooltip",
|
|
46
|
+
"icon",
|
|
47
|
+
"inline-alert",
|
|
48
|
+
"input",
|
|
49
|
+
"link",
|
|
50
|
+
"list-item",
|
|
51
|
+
"list",
|
|
52
|
+
"pagination",
|
|
53
|
+
"persistent-overlay",
|
|
54
|
+
"pop",
|
|
55
|
+
"popover",
|
|
56
|
+
"progress-stepper-item-v2",
|
|
57
|
+
"progress-stepper-item",
|
|
58
|
+
"progress-stepper-v2",
|
|
59
|
+
"progress-stepper",
|
|
60
|
+
"progress",
|
|
61
|
+
"radio-option",
|
|
62
|
+
"radio",
|
|
63
|
+
"rich-text",
|
|
64
|
+
"rich-textarea",
|
|
65
|
+
"rich-textarea-chip",
|
|
66
|
+
"segment-collapse",
|
|
67
|
+
"segmented-control-option",
|
|
68
|
+
"segmented-control",
|
|
69
|
+
"segmented-icon-control-option",
|
|
70
|
+
"segmented-icon-control",
|
|
71
|
+
"select-button",
|
|
72
|
+
"select-menu-option",
|
|
73
|
+
"select-menu",
|
|
74
|
+
"sheet",
|
|
75
|
+
"sheet-title",
|
|
76
|
+
"skeleton-item",
|
|
77
|
+
"skeleton",
|
|
78
|
+
"spinner",
|
|
79
|
+
"stop-events",
|
|
80
|
+
"table-body",
|
|
81
|
+
"table-cell",
|
|
82
|
+
"table-head-cell",
|
|
83
|
+
"table-head",
|
|
84
|
+
"table-row",
|
|
85
|
+
"table",
|
|
86
|
+
"tabs-icon-option",
|
|
87
|
+
"tabs-option",
|
|
88
|
+
"tabs",
|
|
89
|
+
"tag",
|
|
90
|
+
"text",
|
|
91
|
+
"textarea",
|
|
92
|
+
"time-picker",
|
|
93
|
+
"title",
|
|
94
|
+
"toast-manager",
|
|
95
|
+
"toast",
|
|
96
|
+
"toggle",
|
|
97
|
+
"tooltip"
|
|
98
|
+
];
|
|
99
|
+
export type ComponentName = `sinch-${typeof BASE_COMPONENT_NAMES_LIST[number]}`;
|
|
3
100
|
export declare const pascalToKebabCase: (str: string) => string;
|
|
4
101
|
export declare const registerComponent: (name: ComponentName, constructor: CustomElementConstructor) => void;
|
|
5
102
|
export declare const defineCustomElement: (name: ComponentName, constructor?: CustomElementConstructor) => Promise<void>;
|
|
6
|
-
interface SetNectaryRegistryOptions {
|
|
7
|
-
|
|
103
|
+
export interface SetNectaryRegistryOptions {
|
|
104
|
+
manualRegistration?: boolean;
|
|
8
105
|
}
|
|
9
106
|
export declare const setNectaryRegistry: (registry?: CustomElementRegistry, options?: SetNectaryRegistryOptions) => void;
|
|
10
107
|
export declare const resetNectaryRegistry: () => void;
|
|
11
|
-
declare global {
|
|
12
|
-
interface ShadowRootInit {
|
|
13
|
-
customElements?: CustomElementRegistry;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
108
|
export declare class NectaryElement extends NectaryElementBase {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
109
|
+
#private;
|
|
110
|
+
attachShadow(options?: Partial<ShadowRootInit>): ShadowRoot;
|
|
111
|
+
version: string;
|
|
112
|
+
get focusable(): boolean;
|
|
113
|
+
connectedCallback(): void;
|
|
114
|
+
disconnectedCallback(): void;
|
|
115
|
+
get isDomConnected(): boolean;
|
|
24
116
|
}
|
|
117
|
+
|
|
25
118
|
export {};
|
package/utils/element.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { NectaryElementBase, sinchElementNameToBase } from "./shared/nectary-element-base.js";
|
|
2
2
|
import { getConstructor } from "./shared/global-elements-store.js";
|
|
3
|
-
import {
|
|
4
|
-
const version = "5.
|
|
3
|
+
import { COMPONENTS_STORE_KEY } from "./global-components-constants.js";
|
|
4
|
+
const version = "5.0.1";
|
|
5
5
|
const pkg = {
|
|
6
6
|
version
|
|
7
7
|
};
|
|
@@ -1,8 +1,51 @@
|
|
|
1
|
-
|
|
1
|
+
// Generated by dts-bundle-generator v9.5.1
|
|
2
|
+
|
|
3
|
+
export type SinchElementName = `sinch-${string}`;
|
|
4
|
+
export interface GlobalManagerConfig {
|
|
5
|
+
storeKey: symbol;
|
|
6
|
+
registryUrl: string;
|
|
7
|
+
baseElementNames: Set<string>;
|
|
8
|
+
nameToPathMap?: Map<string, string>;
|
|
9
|
+
}
|
|
10
|
+
export interface GlobalManagerInitOptions {
|
|
11
|
+
/**
|
|
12
|
+
* URL to resolve the modules from
|
|
13
|
+
*/
|
|
14
|
+
cdnUrl: string;
|
|
15
|
+
/**
|
|
16
|
+
* Fallback URL to resolve the modules from if `cdnUrl` fails
|
|
17
|
+
*/
|
|
18
|
+
fallbackCdnUrl?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Preloads all components from the bundle.js module
|
|
21
|
+
*/
|
|
22
|
+
preload?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Target version of the library to resolve
|
|
25
|
+
*
|
|
26
|
+
* If left unspecified, it will resolve to the latest version
|
|
27
|
+
*/
|
|
28
|
+
targetlibVersion?: string;
|
|
29
|
+
}
|
|
30
|
+
declare abstract class GlobalElementsManager {
|
|
31
|
+
private config;
|
|
32
|
+
constructor(config: GlobalManagerConfig);
|
|
33
|
+
getConstructor(name: SinchElementName): Promise<CustomElementConstructor> | null;
|
|
34
|
+
private patchCustomElements;
|
|
35
|
+
private toClassName;
|
|
36
|
+
private loadModule;
|
|
37
|
+
private createLoader;
|
|
38
|
+
private preloadBundle;
|
|
39
|
+
init(options: GlobalManagerInitOptions): Promise<void>;
|
|
40
|
+
whenLoaded(): Promise<void>;
|
|
41
|
+
private getModulePath;
|
|
42
|
+
preload(name: SinchElementName | SinchElementName[] | "all"): Promise<void>;
|
|
43
|
+
}
|
|
2
44
|
declare class GlobalComponentsManagerImpl extends GlobalElementsManager {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
45
|
+
private static instance;
|
|
46
|
+
constructor();
|
|
47
|
+
static getInstance(): GlobalComponentsManagerImpl;
|
|
6
48
|
}
|
|
7
49
|
export declare const GlobalComponentsManager: GlobalComponentsManagerImpl;
|
|
50
|
+
|
|
8
51
|
export {};
|
|
@@ -1,95 +1,6 @@
|
|
|
1
1
|
import { GlobalElementsManager } from "./shared/global-elements-manager.js";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
"accordion-item",
|
|
5
|
-
"accordion",
|
|
6
|
-
"action-menu-option",
|
|
7
|
-
"action-menu",
|
|
8
|
-
"alert",
|
|
9
|
-
"avatar",
|
|
10
|
-
"badge",
|
|
11
|
-
"button-group-item",
|
|
12
|
-
"button-group",
|
|
13
|
-
"button",
|
|
14
|
-
"card-container",
|
|
15
|
-
"card-v2-title",
|
|
16
|
-
"card-v2",
|
|
17
|
-
"checkbox",
|
|
18
|
-
"chip",
|
|
19
|
-
"code-tag",
|
|
20
|
-
"color-menu-option",
|
|
21
|
-
"color-menu",
|
|
22
|
-
"color-swatch",
|
|
23
|
-
"date-picker",
|
|
24
|
-
"dialog",
|
|
25
|
-
"emoji-picker",
|
|
26
|
-
"emoji",
|
|
27
|
-
"field",
|
|
28
|
-
"field-v2",
|
|
29
|
-
"file-drop",
|
|
30
|
-
"file-picker",
|
|
31
|
-
"file-status",
|
|
32
|
-
"flag",
|
|
33
|
-
"floating-panel",
|
|
34
|
-
"floating-panel-button",
|
|
35
|
-
"floating-panel-icon-button",
|
|
36
|
-
"grid-item",
|
|
37
|
-
"grid",
|
|
38
|
-
"help-tooltip",
|
|
39
|
-
"icon",
|
|
40
|
-
"inline-alert",
|
|
41
|
-
"input",
|
|
42
|
-
"link",
|
|
43
|
-
"list-item",
|
|
44
|
-
"list",
|
|
45
|
-
"pagination",
|
|
46
|
-
"persistent-overlay",
|
|
47
|
-
"pop",
|
|
48
|
-
"popover",
|
|
49
|
-
"progress-stepper-item-v2",
|
|
50
|
-
"progress-stepper-item",
|
|
51
|
-
"progress-stepper-v2",
|
|
52
|
-
"progress-stepper",
|
|
53
|
-
"progress",
|
|
54
|
-
"radio-option",
|
|
55
|
-
"radio",
|
|
56
|
-
"rich-text",
|
|
57
|
-
"rich-textarea",
|
|
58
|
-
"rich-textarea-chip",
|
|
59
|
-
"segment-collapse",
|
|
60
|
-
"segmented-control-option",
|
|
61
|
-
"segmented-control",
|
|
62
|
-
"segmented-icon-control-option",
|
|
63
|
-
"segmented-icon-control",
|
|
64
|
-
"select-button",
|
|
65
|
-
"select-menu-option",
|
|
66
|
-
"select-menu",
|
|
67
|
-
"sheet",
|
|
68
|
-
"sheet-title",
|
|
69
|
-
"skeleton-item",
|
|
70
|
-
"skeleton",
|
|
71
|
-
"spinner",
|
|
72
|
-
"stop-events",
|
|
73
|
-
"table-body",
|
|
74
|
-
"table-cell",
|
|
75
|
-
"table-head-cell",
|
|
76
|
-
"table-head",
|
|
77
|
-
"table-row",
|
|
78
|
-
"table",
|
|
79
|
-
"tabs-icon-option",
|
|
80
|
-
"tabs-option",
|
|
81
|
-
"tabs",
|
|
82
|
-
"tag",
|
|
83
|
-
"text",
|
|
84
|
-
"textarea",
|
|
85
|
-
"time-picker",
|
|
86
|
-
"title",
|
|
87
|
-
"toast-manager",
|
|
88
|
-
"toast",
|
|
89
|
-
"toggle",
|
|
90
|
-
"tooltip"
|
|
91
|
-
];
|
|
92
|
-
const BASE_COMPONENT_NAMES = new Set(BASE_COMPONENT_NAMES_LIST);
|
|
2
|
+
import { BASE_COMPONENT_NAMES } from "./component-names.js";
|
|
3
|
+
import { COMPONENTS_REGISTRY_URL, COMPONENTS_STORE_KEY } from "./global-components-constants.js";
|
|
93
4
|
class GlobalComponentsManagerImpl extends GlobalElementsManager {
|
|
94
5
|
static instance = null;
|
|
95
6
|
constructor() {
|
package/utils/index.js
CHANGED
|
@@ -1,75 +1,75 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
1
|
+
import { Context, subscribeContext } from "./context.js";
|
|
2
|
+
import { CSV_DELIMITER, getFirstCsvValue, packCsv, unpackCsv, updateCsv } from "./csv.js";
|
|
3
|
+
import { applyRange, attrValueToFloat, attrValueToInteger, attrValueToPixels, clampNumber, cloneNode, composedContains, createScopedElement, getAttribute, getBooleanAttribute, getCssVar, getCssVars, getDeepActiveElement, getIntegerAttribute, getLiteralAttribute, getScrollableParents, getTransformedAncestor, hasClass, isAttrEqual, isAttrTrue, isLiteralValue, isTransformedElement, setClass, shouldReduceMotion, updateAttribute, updateBooleanAttribute, updateExplicitBooleanAttribute, updateIntegerAttribute, updateLiteralAttribute } from "./dom.js";
|
|
4
|
+
import { NectaryElement, defineCustomElement, pascalToKebabCase, registerComponent, resetNectaryRegistry, setNectaryRegistry } from "./element.js";
|
|
5
|
+
import { getRect, getTargetRect, rectOverlap } from "./rect.js";
|
|
6
|
+
import { getFirstFocusableElement, getFirstSlotElement, isElementFocused } from "./slot.js";
|
|
7
|
+
import { throttleAnimationFrame } from "./throttle.js";
|
|
8
|
+
import { debounceAnimationFrame, debounceTimeout } from "./debounce.js";
|
|
9
|
+
import { getReactEventHandler } from "./get-react-event-handler.js";
|
|
10
|
+
import { isEmojiString, parseMarkdown } from "./markdown.js";
|
|
11
|
+
import { getTargetAttribute, getTargetByAttribute, getTargetIndexInParent, isTargetEqual } from "./event-target.js";
|
|
12
|
+
import { isActivationKey } from "./control-keyboard-navigation.js";
|
|
13
|
+
import { getUid } from "./uid.js";
|
|
14
14
|
export {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
15
|
+
CSV_DELIMITER,
|
|
16
|
+
Context,
|
|
17
|
+
NectaryElement,
|
|
18
|
+
applyRange,
|
|
19
|
+
attrValueToFloat,
|
|
20
|
+
attrValueToInteger,
|
|
21
|
+
attrValueToPixels,
|
|
22
|
+
clampNumber,
|
|
23
|
+
cloneNode,
|
|
24
|
+
composedContains,
|
|
25
|
+
createScopedElement,
|
|
26
|
+
debounceAnimationFrame,
|
|
27
|
+
debounceTimeout,
|
|
28
|
+
defineCustomElement,
|
|
29
|
+
getAttribute,
|
|
30
|
+
getBooleanAttribute,
|
|
31
|
+
getCssVar,
|
|
32
|
+
getCssVars,
|
|
33
|
+
getDeepActiveElement,
|
|
34
|
+
getFirstCsvValue,
|
|
35
|
+
getFirstFocusableElement,
|
|
36
|
+
getFirstSlotElement,
|
|
37
|
+
getIntegerAttribute,
|
|
38
|
+
getLiteralAttribute,
|
|
39
|
+
getReactEventHandler,
|
|
40
|
+
getRect,
|
|
41
|
+
getScrollableParents,
|
|
42
|
+
getTargetAttribute,
|
|
43
|
+
getTargetByAttribute,
|
|
44
|
+
getTargetIndexInParent,
|
|
45
|
+
getTargetRect,
|
|
46
|
+
getTransformedAncestor,
|
|
47
|
+
getUid,
|
|
48
|
+
hasClass,
|
|
49
|
+
isActivationKey,
|
|
50
|
+
isAttrEqual,
|
|
51
|
+
isAttrTrue,
|
|
52
|
+
isElementFocused,
|
|
53
|
+
isEmojiString,
|
|
54
|
+
isLiteralValue,
|
|
55
|
+
isTargetEqual,
|
|
56
|
+
isTransformedElement,
|
|
57
|
+
packCsv,
|
|
58
|
+
parseMarkdown,
|
|
59
|
+
pascalToKebabCase,
|
|
60
|
+
rectOverlap,
|
|
61
|
+
registerComponent,
|
|
62
|
+
resetNectaryRegistry,
|
|
63
|
+
setClass,
|
|
64
|
+
setNectaryRegistry,
|
|
65
|
+
shouldReduceMotion,
|
|
66
|
+
subscribeContext,
|
|
67
|
+
throttleAnimationFrame,
|
|
68
|
+
unpackCsv,
|
|
69
|
+
updateAttribute,
|
|
70
|
+
updateBooleanAttribute,
|
|
71
|
+
updateCsv,
|
|
72
|
+
updateExplicitBooleanAttribute,
|
|
73
|
+
updateIntegerAttribute,
|
|
74
|
+
updateLiteralAttribute
|
|
75
75
|
};
|
package/utils/placement.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isTransformedElement, getTransformedAncestor } from "./dom.js";
|
|
2
2
|
const resolveTransformedAncestor = (node, ancestorHint) => {
|
|
3
3
|
if (node != null && ancestorHint != null && ancestorHint.isConnected && isTransformedElement(ancestorHint) && (ancestorHint === node || ancestorHint.contains(node))) {
|
|
4
4
|
return ancestorHint;
|
package/utils/rect.js
CHANGED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
const getNonEsmShModuleFile = (modulePath) => {
|
|
2
|
+
if (modulePath === "bundle") {
|
|
3
|
+
return "bundle.js";
|
|
4
|
+
}
|
|
5
|
+
return `${modulePath}/index.js`;
|
|
6
|
+
};
|
|
7
|
+
const getImportPath = (cdnUrl, version, modulePath) => {
|
|
8
|
+
if (cdnUrl.length === 0) {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
const host = new URL(cdnUrl).host;
|
|
12
|
+
if (host === "esm.sh") {
|
|
13
|
+
if (version.length !== 0) {
|
|
14
|
+
return `${cdnUrl}@${version}/es2022/${modulePath}.mjs`;
|
|
15
|
+
}
|
|
16
|
+
return `${cdnUrl}/${modulePath}`;
|
|
17
|
+
}
|
|
18
|
+
const moduleFile = getNonEsmShModuleFile(modulePath);
|
|
19
|
+
if (version.length !== 0) {
|
|
20
|
+
return `${cdnUrl}/${version}/${moduleFile}`;
|
|
21
|
+
}
|
|
22
|
+
return `${cdnUrl}/latest/${moduleFile}`;
|
|
23
|
+
};
|
|
24
|
+
const getCssImportPath = (cdnUrl, version, modulePath) => {
|
|
25
|
+
if (cdnUrl.length === 0) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
const host = new URL(cdnUrl).host;
|
|
29
|
+
if (host === "esm.sh") {
|
|
30
|
+
if (cdnUrl.includes("theme-base")) {
|
|
31
|
+
modulePath = `dist/${modulePath}`;
|
|
32
|
+
}
|
|
33
|
+
if (version.length !== 0) {
|
|
34
|
+
return `${cdnUrl}@${version}/es2022/${modulePath}.css`;
|
|
35
|
+
}
|
|
36
|
+
return `${cdnUrl}/${modulePath}`;
|
|
37
|
+
}
|
|
38
|
+
if (version.length !== 0) {
|
|
39
|
+
return `${cdnUrl}/${version}/${modulePath}.js`;
|
|
40
|
+
}
|
|
41
|
+
return `${cdnUrl}/latest/${modulePath}.js`;
|
|
42
|
+
};
|
|
43
|
+
const FALLBACK_DELAY_MS = 2e3;
|
|
44
|
+
const loadModuleWithFallback = async (options) => {
|
|
45
|
+
const { cdnUrl, fallbackCdnUrl, version, modulePath, logPrefix = "CDN" } = options;
|
|
46
|
+
const importPath = getImportPath(cdnUrl, version, modulePath);
|
|
47
|
+
const fallbackImportPath = getImportPath(fallbackCdnUrl, version, modulePath);
|
|
48
|
+
const promises = [
|
|
49
|
+
import(
|
|
50
|
+
/* webpackIgnore: true */
|
|
51
|
+
importPath
|
|
52
|
+
)
|
|
53
|
+
];
|
|
54
|
+
let timeoutId = null;
|
|
55
|
+
if (fallbackImportPath !== null) {
|
|
56
|
+
promises.push(
|
|
57
|
+
new Promise((resolve) => {
|
|
58
|
+
timeoutId = setTimeout(() => resolve(import(
|
|
59
|
+
/* webpackIgnore: true */
|
|
60
|
+
fallbackImportPath
|
|
61
|
+
)), FALLBACK_DELAY_MS);
|
|
62
|
+
})
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
try {
|
|
66
|
+
const module = await Promise.any(promises);
|
|
67
|
+
if (timeoutId !== null) {
|
|
68
|
+
clearTimeout(timeoutId);
|
|
69
|
+
}
|
|
70
|
+
return module;
|
|
71
|
+
} catch (error) {
|
|
72
|
+
if (error instanceof AggregateError) {
|
|
73
|
+
console.error(`${logPrefix} primary load failed: ${importPath}`, error.errors[0]);
|
|
74
|
+
if (fallbackImportPath !== null) {
|
|
75
|
+
console.error(`${logPrefix} fallback load failed: ${fallbackImportPath}`, error.errors[1]);
|
|
76
|
+
}
|
|
77
|
+
} else {
|
|
78
|
+
console.error(`${logPrefix} failed to load module: ${importPath}`, error);
|
|
79
|
+
}
|
|
80
|
+
throw error;
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
const fetchCSS = async (url) => {
|
|
84
|
+
const res = await fetch(url);
|
|
85
|
+
if (!res.ok) {
|
|
86
|
+
throw new Error(`CSS fetch failed: ${res.status} ${url}`);
|
|
87
|
+
}
|
|
88
|
+
const css = await res.text();
|
|
89
|
+
return { default: css };
|
|
90
|
+
};
|
|
91
|
+
const loadCSSFromUrl = (url) => {
|
|
92
|
+
if (url.endsWith(".css")) {
|
|
93
|
+
return fetchCSS(url);
|
|
94
|
+
}
|
|
95
|
+
return import(
|
|
96
|
+
/* webpackIgnore: true */
|
|
97
|
+
url
|
|
98
|
+
);
|
|
99
|
+
};
|
|
100
|
+
const loadCSSModuleWithFallback = async (options) => {
|
|
101
|
+
const { cdnUrl, fallbackCdnUrl, version, modulePath, logPrefix = "CDN" } = options;
|
|
102
|
+
const importPath = getCssImportPath(cdnUrl, version, modulePath);
|
|
103
|
+
const fallbackImportPath = getCssImportPath(fallbackCdnUrl, version, modulePath);
|
|
104
|
+
const promises = [
|
|
105
|
+
loadCSSFromUrl(importPath)
|
|
106
|
+
];
|
|
107
|
+
let timeoutId = null;
|
|
108
|
+
if (fallbackImportPath !== null) {
|
|
109
|
+
promises.push(
|
|
110
|
+
new Promise((resolve) => {
|
|
111
|
+
timeoutId = setTimeout(() => resolve(loadCSSFromUrl(fallbackImportPath)), FALLBACK_DELAY_MS);
|
|
112
|
+
})
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
try {
|
|
116
|
+
const module = await Promise.any(promises);
|
|
117
|
+
if (timeoutId !== null) {
|
|
118
|
+
clearTimeout(timeoutId);
|
|
119
|
+
}
|
|
120
|
+
return module;
|
|
121
|
+
} catch (error) {
|
|
122
|
+
if (error instanceof AggregateError) {
|
|
123
|
+
console.error(`${logPrefix} primary load failed: ${importPath}`, error.errors[0]);
|
|
124
|
+
if (fallbackImportPath !== null) {
|
|
125
|
+
console.error(`${logPrefix} fallback load failed: ${fallbackImportPath}`, error.errors[1]);
|
|
126
|
+
}
|
|
127
|
+
} else {
|
|
128
|
+
console.error(`${logPrefix} failed to load module: ${importPath}`, error);
|
|
129
|
+
}
|
|
130
|
+
throw error;
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
export {
|
|
134
|
+
loadCSSModuleWithFallback,
|
|
135
|
+
loadModuleWithFallback
|
|
136
|
+
};
|