frontile 0.18.0-beta.1 → 0.18.0-beta.3
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/declarations/-private/control-blur.d.ts +1 -0
- package/declarations/-private/control-blur.d.ts.map +1 -0
- package/declarations/-private/deprecated-args.d.ts +19 -0
- package/declarations/-private/deprecated-args.d.ts.map +1 -0
- package/declarations/-private/dialog.d.ts +1 -0
- package/declarations/-private/dialog.d.ts.map +1 -0
- package/declarations/-private/dom.d.ts +1 -0
- package/declarations/-private/dom.d.ts.map +1 -0
- package/declarations/-private/get-config.d.ts +1 -0
- package/declarations/-private/get-config.d.ts.map +1 -0
- package/declarations/-private/icons.d.ts +23 -0
- package/declarations/-private/icons.d.ts.map +1 -0
- package/declarations/-private/manager.d.ts +1 -0
- package/declarations/-private/manager.d.ts.map +1 -0
- package/declarations/-private/notification-stack.d.ts +1 -0
- package/declarations/-private/notification-stack.d.ts.map +1 -0
- package/declarations/-private/notification.d.ts +5 -4
- package/declarations/-private/notification.d.ts.map +1 -0
- package/declarations/-private/timer.d.ts +1 -0
- package/declarations/-private/timer.d.ts.map +1 -0
- package/declarations/-private/types.d.ts +11 -8
- package/declarations/-private/types.d.ts.map +1 -0
- package/declarations/buttons.d.ts +1 -0
- package/declarations/buttons.d.ts.map +1 -0
- package/declarations/collections.d.ts +1 -0
- package/declarations/collections.d.ts.map +1 -0
- package/declarations/components/buttons/button-group.d.ts +4 -1
- package/declarations/components/buttons/button-group.d.ts.map +1 -0
- package/declarations/components/buttons/button.d.ts +13 -3
- package/declarations/components/buttons/button.d.ts.map +1 -0
- package/declarations/components/buttons/chip.d.ts +16 -8
- package/declarations/components/buttons/chip.d.ts.map +1 -0
- package/declarations/components/buttons/close-button.d.ts +6 -2
- package/declarations/components/buttons/close-button.d.ts.map +1 -0
- package/declarations/components/buttons/index.d.ts +1 -0
- package/declarations/components/buttons/index.d.ts.map +1 -0
- package/declarations/components/buttons/segmented-control/item.d.ts +1 -0
- package/declarations/components/buttons/segmented-control/item.d.ts.map +1 -0
- package/declarations/components/buttons/segmented-control/segmented-control.d.ts +21 -10
- package/declarations/components/buttons/segmented-control/segmented-control.d.ts.map +1 -0
- package/declarations/components/buttons/segmented-control.d.ts +1 -0
- package/declarations/components/buttons/segmented-control.d.ts.map +1 -0
- package/declarations/components/buttons/toggle-button.d.ts +10 -1
- package/declarations/components/buttons/toggle-button.d.ts.map +1 -0
- package/declarations/components/collections/calendar/calendar.d.ts +58 -61
- package/declarations/components/collections/calendar/calendar.d.ts.map +1 -0
- package/declarations/components/collections/calendar/day-cell.d.ts +1 -0
- package/declarations/components/collections/calendar/day-cell.d.ts.map +1 -0
- package/declarations/components/collections/calendar/header.d.ts +1 -0
- package/declarations/components/collections/calendar/header.d.ts.map +1 -0
- package/declarations/components/collections/calendar/month-grid.d.ts +1 -0
- package/declarations/components/collections/calendar/month-grid.d.ts.map +1 -0
- package/declarations/components/collections/calendar/types.d.ts +1 -0
- package/declarations/components/collections/calendar/types.d.ts.map +1 -0
- package/declarations/components/collections/calendar/utils.d.ts +2 -0
- package/declarations/components/collections/calendar/utils.d.ts.map +1 -0
- package/declarations/components/collections/calendar/year-grid.d.ts +1 -0
- package/declarations/components/collections/calendar/year-grid.d.ts.map +1 -0
- package/declarations/components/collections/calendar.d.ts +1 -0
- package/declarations/components/collections/calendar.d.ts.map +1 -0
- package/declarations/components/collections/command/command.d.ts +2 -11
- package/declarations/components/collections/command/command.d.ts.map +1 -0
- package/declarations/components/collections/command/dialog.d.ts +1 -0
- package/declarations/components/collections/command/dialog.d.ts.map +1 -0
- package/declarations/components/collections/command/footer.d.ts +1 -0
- package/declarations/components/collections/command/footer.d.ts.map +1 -0
- package/declarations/components/collections/command/index.d.ts +1 -0
- package/declarations/components/collections/command/index.d.ts.map +1 -0
- package/declarations/components/collections/command/input.d.ts +7 -1
- package/declarations/components/collections/command/input.d.ts.map +1 -0
- package/declarations/components/collections/command/list.d.ts +4 -0
- package/declarations/components/collections/command/list.d.ts.map +1 -0
- package/declarations/components/collections/command.d.ts +1 -0
- package/declarations/components/collections/command.d.ts.map +1 -0
- package/declarations/components/collections/dropdown/dropdown.d.ts +74 -4
- package/declarations/components/collections/dropdown/dropdown.d.ts.map +1 -0
- package/declarations/components/collections/dropdown/menu-context.d.ts +34 -7
- package/declarations/components/collections/dropdown/menu-context.d.ts.map +1 -0
- package/declarations/components/collections/dropdown/sub.d.ts +4 -8
- package/declarations/components/collections/dropdown/sub.d.ts.map +1 -0
- package/declarations/components/collections/dropdown.d.ts +1 -0
- package/declarations/components/collections/dropdown.d.ts.map +1 -0
- package/declarations/components/collections/index.d.ts +1 -0
- package/declarations/components/collections/index.d.ts.map +1 -0
- package/declarations/components/collections/listbox/group.d.ts +8 -2
- package/declarations/components/collections/listbox/group.d.ts.map +1 -0
- package/declarations/components/collections/listbox/item.d.ts +49 -7
- package/declarations/components/collections/listbox/item.d.ts.map +1 -0
- package/declarations/components/collections/listbox/listbox.d.ts +32 -4
- package/declarations/components/collections/listbox/listbox.d.ts.map +1 -0
- package/declarations/components/collections/listbox.d.ts +1 -0
- package/declarations/components/collections/listbox.d.ts.map +1 -0
- package/declarations/components/collections/simple-table/body.d.ts +118 -103
- package/declarations/components/collections/simple-table/body.d.ts.map +1 -0
- package/declarations/components/collections/simple-table/cell.d.ts +118 -103
- package/declarations/components/collections/simple-table/cell.d.ts.map +1 -0
- package/declarations/components/collections/simple-table/column.d.ts +118 -103
- package/declarations/components/collections/simple-table/column.d.ts.map +1 -0
- package/declarations/components/collections/simple-table/footer.d.ts +118 -103
- package/declarations/components/collections/simple-table/footer.d.ts.map +1 -0
- package/declarations/components/collections/simple-table/header.d.ts +118 -103
- package/declarations/components/collections/simple-table/header.d.ts.map +1 -0
- package/declarations/components/collections/simple-table/index.d.ts +118 -103
- package/declarations/components/collections/simple-table/index.d.ts.map +1 -0
- package/declarations/components/collections/simple-table/row.d.ts +118 -103
- package/declarations/components/collections/simple-table/row.d.ts.map +1 -0
- package/declarations/components/collections/table/cell-default.d.ts +1 -0
- package/declarations/components/collections/table/cell-default.d.ts.map +1 -0
- package/declarations/components/collections/table/cell-for.d.ts +1 -0
- package/declarations/components/collections/table/cell-for.d.ts.map +1 -0
- package/declarations/components/collections/table/cell-rendering-context.d.ts +1 -0
- package/declarations/components/collections/table/cell-rendering-context.d.ts.map +1 -0
- package/declarations/components/collections/table/checkbox.d.ts +6 -1
- package/declarations/components/collections/table/checkbox.d.ts.map +1 -0
- package/declarations/components/collections/table/column-visibility.d.ts +119 -104
- package/declarations/components/collections/table/column-visibility.d.ts.map +1 -0
- package/declarations/components/collections/table/index.d.ts +1 -0
- package/declarations/components/collections/table/index.d.ts.map +1 -0
- package/declarations/components/collections/table/sort-button.d.ts +118 -103
- package/declarations/components/collections/table/sort-button.d.ts.map +1 -0
- package/declarations/components/collections/table/table.d.ts +118 -103
- package/declarations/components/collections/table/table.d.ts.map +1 -0
- package/declarations/components/collections/table/types.d.ts +1 -0
- package/declarations/components/collections/table/types.d.ts.map +1 -0
- package/declarations/components/collections/table/utils.d.ts +1 -0
- package/declarations/components/collections/table/utils.d.ts.map +1 -0
- package/declarations/components/collections/table.d.ts +1 -0
- package/declarations/components/collections/table.d.ts.map +1 -0
- package/declarations/components/disclosure/accordion/accordion.d.ts +31 -24
- package/declarations/components/disclosure/accordion/accordion.d.ts.map +1 -0
- package/declarations/components/disclosure/accordion/item.d.ts +1 -0
- package/declarations/components/disclosure/accordion/item.d.ts.map +1 -0
- package/declarations/components/disclosure/accordion.d.ts +1 -0
- package/declarations/components/disclosure/accordion.d.ts.map +1 -0
- package/declarations/components/disclosure/index.d.ts +1 -0
- package/declarations/components/disclosure/index.d.ts.map +1 -0
- package/declarations/components/forms/autocomplete.d.ts +36 -34
- package/declarations/components/forms/autocomplete.d.ts.map +1 -0
- package/declarations/components/forms/checkbox-group.d.ts +8 -1
- package/declarations/components/forms/checkbox-group.d.ts.map +1 -0
- package/declarations/components/forms/checkbox.d.ts +6 -1
- package/declarations/components/forms/checkbox.d.ts.map +1 -0
- package/declarations/components/forms/date-picker/date-picker.d.ts +258 -0
- package/declarations/components/forms/date-picker/date-picker.d.ts.map +1 -0
- package/declarations/components/forms/date-picker/end-content.d.ts +30 -0
- package/declarations/components/forms/date-picker/end-content.d.ts.map +1 -0
- package/declarations/components/forms/date-picker/trigger.d.ts +41 -0
- package/declarations/components/forms/date-picker/trigger.d.ts.map +1 -0
- package/declarations/components/forms/date-picker/types.d.ts +150 -0
- package/declarations/components/forms/date-picker/types.d.ts.map +1 -0
- package/declarations/components/forms/date-picker/value.d.ts +44 -0
- package/declarations/components/forms/date-picker/value.d.ts.map +1 -0
- package/declarations/components/forms/date-picker.d.ts +4 -0
- package/declarations/components/forms/date-picker.d.ts.map +1 -0
- package/declarations/components/forms/field-types.d.ts +2 -1
- package/declarations/components/forms/field-types.d.ts.map +1 -0
- package/declarations/components/forms/field.d.ts +6 -0
- package/declarations/components/forms/field.d.ts.map +1 -0
- package/declarations/components/forms/form-control.d.ts +2 -1
- package/declarations/components/forms/form-control.d.ts.map +1 -0
- package/declarations/components/forms/form-description.d.ts +1 -0
- package/declarations/components/forms/form-description.d.ts.map +1 -0
- package/declarations/components/forms/form-feedback.d.ts +18 -2
- package/declarations/components/forms/form-feedback.d.ts.map +1 -0
- package/declarations/components/forms/form.d.ts +2 -11
- package/declarations/components/forms/form.d.ts.map +1 -0
- package/declarations/components/forms/icons.d.ts +4 -1
- package/declarations/components/forms/index.d.ts +3 -0
- package/declarations/components/forms/index.d.ts.map +1 -0
- package/declarations/components/forms/input-otp.d.ts +10 -12
- package/declarations/components/forms/input-otp.d.ts.map +1 -0
- package/declarations/components/forms/input.d.ts +21 -21
- package/declarations/components/forms/input.d.ts.map +1 -0
- package/declarations/components/forms/label.d.ts +6 -1
- package/declarations/components/forms/label.d.ts.map +1 -0
- package/declarations/components/forms/native-select.d.ts +17 -7
- package/declarations/components/forms/native-select.d.ts.map +1 -0
- package/declarations/components/forms/radio-group.d.ts +8 -1
- package/declarations/components/forms/radio-group.d.ts.map +1 -0
- package/declarations/components/forms/radio.d.ts +6 -1
- package/declarations/components/forms/radio.d.ts.map +1 -0
- package/declarations/components/forms/select/end-content.d.ts +1 -0
- package/declarations/components/forms/select/end-content.d.ts.map +1 -0
- package/declarations/components/forms/select/native-mirror.d.ts +1 -0
- package/declarations/components/forms/select/native-mirror.d.ts.map +1 -0
- package/declarations/components/forms/select/select.d.ts +44 -50
- package/declarations/components/forms/select/select.d.ts.map +1 -0
- package/declarations/components/forms/select/selected-items.d.ts +1 -0
- package/declarations/components/forms/select/selected-items.d.ts.map +1 -0
- package/declarations/components/forms/select/trigger.d.ts +1 -0
- package/declarations/components/forms/select/trigger.d.ts.map +1 -0
- package/declarations/components/forms/select/types.d.ts +43 -12
- package/declarations/components/forms/select/types.d.ts.map +1 -0
- package/declarations/components/forms/select.d.ts +1 -0
- package/declarations/components/forms/select.d.ts.map +1 -0
- package/declarations/components/forms/switch.d.ts +30 -19
- package/declarations/components/forms/switch.d.ts.map +1 -0
- package/declarations/components/forms/textarea.d.ts +16 -6
- package/declarations/components/forms/textarea.d.ts.map +1 -0
- package/declarations/components/navigation/external-link.d.ts +2 -1
- package/declarations/components/navigation/external-link.d.ts.map +1 -0
- package/declarations/components/navigation/index.d.ts +1 -0
- package/declarations/components/navigation/index.d.ts.map +1 -0
- package/declarations/components/navigation/pagination/pagination.d.ts +26 -19
- package/declarations/components/navigation/pagination/pagination.d.ts.map +1 -0
- package/declarations/components/navigation/pagination/range.d.ts +1 -0
- package/declarations/components/navigation/pagination/range.d.ts.map +1 -0
- package/declarations/components/navigation/pagination.d.ts +1 -0
- package/declarations/components/navigation/pagination.d.ts.map +1 -0
- package/declarations/components/navigation/tab-nav/item.d.ts +1 -0
- package/declarations/components/navigation/tab-nav/item.d.ts.map +1 -0
- package/declarations/components/navigation/tab-nav/tab-nav.d.ts +23 -13
- package/declarations/components/navigation/tab-nav/tab-nav.d.ts.map +1 -0
- package/declarations/components/navigation/tab-nav.d.ts +1 -0
- package/declarations/components/navigation/tab-nav.d.ts.map +1 -0
- package/declarations/components/navigation/tabs/panel.d.ts +1 -0
- package/declarations/components/navigation/tabs/panel.d.ts.map +1 -0
- package/declarations/components/navigation/tabs/tab.d.ts +1 -0
- package/declarations/components/navigation/tabs/tab.d.ts.map +1 -0
- package/declarations/components/navigation/tabs/tabs.d.ts +23 -13
- package/declarations/components/navigation/tabs/tabs.d.ts.map +1 -0
- package/declarations/components/navigation/tabs.d.ts +1 -0
- package/declarations/components/navigation/tabs.d.ts.map +1 -0
- package/declarations/components/notifications/index.d.ts +3 -2
- package/declarations/components/notifications/index.d.ts.map +1 -0
- package/declarations/components/notifications/notification-card.d.ts +7 -8
- package/declarations/components/notifications/notification-card.d.ts.map +1 -0
- package/declarations/components/notifications/notifications-container.d.ts +3 -2
- package/declarations/components/notifications/notifications-container.d.ts.map +1 -0
- package/declarations/components/overlays/backdrop.d.ts +1 -0
- package/declarations/components/overlays/backdrop.d.ts.map +1 -0
- package/declarations/components/overlays/drawer/body.d.ts +1 -0
- package/declarations/components/overlays/drawer/body.d.ts.map +1 -0
- package/declarations/components/overlays/drawer/drag-handle.d.ts +1 -0
- package/declarations/components/overlays/drawer/drag-handle.d.ts.map +1 -0
- package/declarations/components/overlays/drawer/footer.d.ts +1 -0
- package/declarations/components/overlays/drawer/footer.d.ts.map +1 -0
- package/declarations/components/overlays/drawer/header.d.ts +1 -0
- package/declarations/components/overlays/drawer/header.d.ts.map +1 -0
- package/declarations/components/overlays/drawer/selectors.d.ts +1 -0
- package/declarations/components/overlays/drawer/selectors.d.ts.map +1 -0
- package/declarations/components/overlays/drawer.d.ts +94 -86
- package/declarations/components/overlays/drawer.d.ts.map +1 -0
- package/declarations/components/overlays/index.d.ts +1 -0
- package/declarations/components/overlays/index.d.ts.map +1 -0
- package/declarations/components/overlays/modal/body.d.ts +1 -0
- package/declarations/components/overlays/modal/body.d.ts.map +1 -0
- package/declarations/components/overlays/modal/footer.d.ts +1 -0
- package/declarations/components/overlays/modal/footer.d.ts.map +1 -0
- package/declarations/components/overlays/modal/header.d.ts +1 -0
- package/declarations/components/overlays/modal/header.d.ts.map +1 -0
- package/declarations/components/overlays/modal.d.ts +18 -12
- package/declarations/components/overlays/modal.d.ts.map +1 -0
- package/declarations/components/overlays/mount-animation.d.ts +1 -0
- package/declarations/components/overlays/mount-animation.d.ts.map +1 -0
- package/declarations/components/overlays/overlay.d.ts +14 -0
- package/declarations/components/overlays/overlay.d.ts.map +1 -0
- package/declarations/components/overlays/popover.d.ts +2 -1
- package/declarations/components/overlays/popover.d.ts.map +1 -0
- package/declarations/components/overlays/portal-target.d.ts +1 -0
- package/declarations/components/overlays/portal-target.d.ts.map +1 -0
- package/declarations/components/overlays/portal.d.ts +1 -0
- package/declarations/components/overlays/portal.d.ts.map +1 -0
- package/declarations/components/overlays/tooltip.d.ts +3 -2
- package/declarations/components/overlays/tooltip.d.ts.map +1 -0
- package/declarations/components/status/alert.d.ts +12 -13
- package/declarations/components/status/alert.d.ts.map +1 -0
- package/declarations/components/status/index.d.ts +1 -0
- package/declarations/components/status/index.d.ts.map +1 -0
- package/declarations/components/status/progress-bar.d.ts +6 -1
- package/declarations/components/status/progress-bar.d.ts.map +1 -0
- package/declarations/components/utilities/avatar.d.ts +13 -7
- package/declarations/components/utilities/avatar.d.ts.map +1 -0
- package/declarations/components/utilities/collapsible.d.ts +1 -0
- package/declarations/components/utilities/collapsible.d.ts.map +1 -0
- package/declarations/components/utilities/divider.d.ts +12 -0
- package/declarations/components/utilities/divider.d.ts.map +1 -0
- package/declarations/components/utilities/index.d.ts +1 -0
- package/declarations/components/utilities/index.d.ts.map +1 -0
- package/declarations/components/utilities/kbd.d.ts +5 -4
- package/declarations/components/utilities/kbd.d.ts.map +1 -0
- package/declarations/components/utilities/skeleton.d.ts +1 -0
- package/declarations/components/utilities/skeleton.d.ts.map +1 -0
- package/declarations/components/utilities/spinner.d.ts +15 -7
- package/declarations/components/utilities/spinner.d.ts.map +1 -0
- package/declarations/components/utilities/visually-hidden.d.ts +1 -0
- package/declarations/components/utilities/visually-hidden.d.ts.map +1 -0
- package/declarations/disclosure.d.ts +1 -0
- package/declarations/disclosure.d.ts.map +1 -0
- package/declarations/forms.d.ts +1 -0
- package/declarations/forms.d.ts.map +1 -0
- package/declarations/index.d.ts +2 -1
- package/declarations/index.d.ts.map +1 -0
- package/declarations/modifiers/drag-to-dismiss.d.ts +1 -0
- package/declarations/modifiers/drag-to-dismiss.d.ts.map +1 -0
- package/declarations/modifiers/press.d.ts +1 -0
- package/declarations/modifiers/press.d.ts.map +1 -0
- package/declarations/navigation.d.ts +1 -0
- package/declarations/navigation.d.ts.map +1 -0
- package/declarations/notifications.d.ts +1 -0
- package/declarations/notifications.d.ts.map +1 -0
- package/declarations/overlays.d.ts +1 -0
- package/declarations/overlays.d.ts.map +1 -0
- package/declarations/services/notifications.d.ts +1 -0
- package/declarations/services/notifications.d.ts.map +1 -0
- package/declarations/status.d.ts +1 -0
- package/declarations/status.d.ts.map +1 -0
- package/declarations/template-registry.d.ts +2 -1
- package/declarations/test-support.d.ts +1 -0
- package/declarations/test-support.d.ts.map +1 -0
- package/declarations/utilities.d.ts +1 -0
- package/declarations/utilities.d.ts.map +1 -0
- package/declarations/utils/deferred-work.d.ts +1 -0
- package/declarations/utils/deferred-work.d.ts.map +1 -0
- package/declarations/utils/filter.d.ts +1 -0
- package/declarations/utils/filter.d.ts.map +1 -0
- package/declarations/utils/forms-utils-index.d.ts +1 -0
- package/declarations/utils/forms-utils-index.d.ts.map +1 -0
- package/declarations/utils/keys.d.ts +1 -0
- package/declarations/utils/keys.d.ts.map +1 -0
- package/declarations/utils/listManager.d.ts +22 -0
- package/declarations/utils/listManager.d.ts.map +1 -0
- package/declarations/utils/nested-data.d.ts +1 -0
- package/declarations/utils/nested-data.d.ts.map +1 -0
- package/declarations/utils/prefers-reduced-motion.d.ts +1 -0
- package/declarations/utils/prefers-reduced-motion.d.ts.map +1 -0
- package/declarations/utils/ref.d.ts +2 -1
- package/declarations/utils/ref.d.ts.map +1 -0
- package/declarations/utils/roving-focus.d.ts +1 -0
- package/declarations/utils/roving-focus.d.ts.map +1 -0
- package/declarations/utils/safe-area.d.ts +1 -0
- package/declarations/utils/safe-area.d.ts.map +1 -0
- package/declarations/utils/safe-styles.d.ts +1 -0
- package/declarations/utils/safe-styles.d.ts.map +1 -0
- package/declarations/utils/selection-indicator.d.ts +1 -0
- package/declarations/utils/selection-indicator.d.ts.map +1 -0
- package/declarations/utils/standard-validator.d.ts +1 -0
- package/declarations/utils/standard-validator.d.ts.map +1 -0
- package/declarations/utils/toggle.d.ts +1 -0
- package/declarations/utils/toggle.d.ts.map +1 -0
- package/dist/components/buttons/button-group.js +26 -1
- package/dist/components/buttons/button-group.js.map +1 -1
- package/dist/components/buttons/button.js +21 -2
- package/dist/components/buttons/button.js.map +1 -1
- package/dist/components/buttons/chip.js +19 -2
- package/dist/components/buttons/chip.js.map +1 -1
- package/dist/components/buttons/close-button.js +18 -2
- package/dist/components/buttons/close-button.js.map +1 -1
- package/dist/components/buttons/segmented-control/item.js.map +1 -1
- package/dist/components/buttons/segmented-control/segmented-control.js +1 -1
- package/dist/components/buttons/segmented-control/segmented-control.js.map +1 -1
- package/dist/components/buttons/toggle-button.js +36 -2
- package/dist/components/buttons/toggle-button.js.map +1 -1
- package/dist/components/collections/calendar/calendar.js +36 -3
- package/dist/components/collections/calendar/calendar.js.map +1 -1
- package/dist/components/collections/calendar/day-cell.js.map +1 -1
- package/dist/components/collections/calendar/header.js +1 -2
- package/dist/components/collections/calendar/header.js.map +1 -1
- package/dist/components/collections/calendar/month-grid.js.map +1 -1
- package/dist/components/collections/calendar/utils.js +1 -1
- package/dist/components/collections/calendar/utils.js.map +1 -1
- package/dist/components/collections/calendar/year-grid.js.map +1 -1
- package/dist/components/collections/command/command.js.map +1 -1
- package/dist/components/collections/command/dialog.js +0 -1
- package/dist/components/collections/command/dialog.js.map +1 -1
- package/dist/components/collections/command/footer.js +1 -1
- package/dist/components/collections/command/footer.js.map +1 -1
- package/dist/components/collections/command/input.js.map +1 -1
- package/dist/components/collections/command/list.js +1 -1
- package/dist/components/collections/command/list.js.map +1 -1
- package/dist/components/collections/dropdown/dropdown.js +114 -11
- package/dist/components/collections/dropdown/dropdown.js.map +1 -1
- package/dist/components/collections/dropdown/menu-context.js +52 -1
- package/dist/components/collections/dropdown/menu-context.js.map +1 -1
- package/dist/components/collections/dropdown/sub.js +2 -9
- package/dist/components/collections/dropdown/sub.js.map +1 -1
- package/dist/components/collections/listbox/group.js +1 -1
- package/dist/components/collections/listbox/group.js.map +1 -1
- package/dist/components/collections/listbox/item.js +78 -13
- package/dist/components/collections/listbox/item.js.map +1 -1
- package/dist/components/collections/listbox/listbox.js +53 -2
- package/dist/components/collections/listbox/listbox.js.map +1 -1
- package/dist/components/collections/simple-table/body.js.map +1 -1
- package/dist/components/collections/simple-table/cell.js.map +1 -1
- package/dist/components/collections/simple-table/column.js.map +1 -1
- package/dist/components/collections/simple-table/footer.js.map +1 -1
- package/dist/components/collections/simple-table/header.js.map +1 -1
- package/dist/components/collections/simple-table/index.js.map +1 -1
- package/dist/components/collections/simple-table/row.js.map +1 -1
- package/dist/components/collections/table/cell-default.js.map +1 -1
- package/dist/components/collections/table/cell-for.js.map +1 -1
- package/dist/components/collections/table/cell-rendering-context.js.map +1 -1
- package/dist/components/collections/table/checkbox.js.map +1 -1
- package/dist/components/collections/table/column-visibility.js +2 -2
- package/dist/components/collections/table/column-visibility.js.map +1 -1
- package/dist/components/collections/table/sort-button.js +1 -1
- package/dist/components/collections/table/sort-button.js.map +1 -1
- package/dist/components/collections/table/table.js +1 -2
- package/dist/components/collections/table/table.js.map +1 -1
- package/dist/components/collections/table/utils.js.map +1 -1
- package/dist/components/disclosure/accordion/accordion.js.map +1 -1
- package/dist/components/disclosure/accordion/item.js +1 -1
- package/dist/components/disclosure/accordion/item.js.map +1 -1
- package/dist/components/forms/autocomplete.js +48 -3
- package/dist/components/forms/autocomplete.js.map +1 -1
- package/dist/components/forms/checkbox-group.js.map +1 -1
- package/dist/components/forms/checkbox.js.map +1 -1
- package/dist/components/forms/date-picker/date-picker.js +301 -0
- package/dist/components/forms/date-picker/date-picker.js.map +1 -0
- package/dist/components/forms/date-picker/end-content.js +21 -0
- package/dist/components/forms/date-picker/end-content.js.map +1 -0
- package/dist/components/forms/date-picker/trigger.js +14 -0
- package/dist/components/forms/date-picker/trigger.js.map +1 -0
- package/dist/components/forms/date-picker/types.js +2 -0
- package/dist/components/forms/date-picker/types.js.map +1 -0
- package/dist/components/forms/date-picker/value.js +97 -0
- package/dist/components/forms/date-picker/value.js.map +1 -0
- package/dist/components/forms/date-picker.js +2 -0
- package/dist/components/forms/date-picker.js.map +1 -0
- package/dist/components/forms/field.js +3 -1
- package/dist/components/forms/field.js.map +1 -1
- package/dist/components/forms/form-control.js +1 -1
- package/dist/components/forms/form-control.js.map +1 -1
- package/dist/components/forms/form-description.js.map +1 -1
- package/dist/components/forms/form-feedback.js +25 -2
- package/dist/components/forms/form-feedback.js.map +1 -1
- package/dist/components/forms/form.js.map +1 -1
- package/dist/components/forms/index.js +2 -0
- package/dist/components/forms/index.js.map +1 -1
- package/dist/components/forms/input-otp.js.map +1 -1
- package/dist/components/forms/input.js +1 -1
- package/dist/components/forms/input.js.map +1 -1
- package/dist/components/forms/label.js.map +1 -1
- package/dist/components/forms/native-select.js +2 -2
- package/dist/components/forms/native-select.js.map +1 -1
- package/dist/components/forms/radio-group.js.map +1 -1
- package/dist/components/forms/radio.js.map +1 -1
- package/dist/components/forms/select/end-content.js +2 -2
- package/dist/components/forms/select/end-content.js.map +1 -1
- package/dist/components/forms/select/native-mirror.js.map +1 -1
- package/dist/components/forms/select/select.js +61 -7
- package/dist/components/forms/select/select.js.map +1 -1
- package/dist/components/forms/select/selected-items.js +1 -1
- package/dist/components/forms/select/selected-items.js.map +1 -1
- package/dist/components/forms/select/trigger.js.map +1 -1
- package/dist/components/forms/switch.js +9 -1
- package/dist/components/forms/switch.js.map +1 -1
- package/dist/components/forms/textarea.js.map +1 -1
- package/dist/components/navigation/external-link.js.map +1 -1
- package/dist/components/navigation/pagination/pagination.js +2 -2
- package/dist/components/navigation/pagination/pagination.js.map +1 -1
- package/dist/components/navigation/pagination/range.js.map +1 -1
- package/dist/components/navigation/tab-nav/item.js.map +1 -1
- package/dist/components/navigation/tab-nav/tab-nav.js +1 -1
- package/dist/components/navigation/tab-nav/tab-nav.js.map +1 -1
- package/dist/components/navigation/tabs/panel.js.map +1 -1
- package/dist/components/navigation/tabs/tab.js.map +1 -1
- package/dist/components/navigation/tabs/tabs.js +1 -1
- package/dist/components/navigation/tabs/tabs.js.map +1 -1
- package/dist/components/notifications/index.js +2 -2
- package/dist/components/notifications/notification-card.js +2 -2
- package/dist/components/notifications/notifications-container.js +1 -1
- package/dist/components/notifications/notifications-container.js.map +1 -1
- package/dist/components/overlays/backdrop.js +1 -1
- package/dist/components/overlays/backdrop.js.map +1 -1
- package/dist/components/overlays/drawer/body.js.map +1 -1
- package/dist/components/overlays/drawer/drag-handle.js.map +1 -1
- package/dist/components/overlays/drawer/footer.js.map +1 -1
- package/dist/components/overlays/drawer/header.js.map +1 -1
- package/dist/components/overlays/drawer/selectors.js.map +1 -1
- package/dist/components/overlays/drawer.js +4 -4
- package/dist/components/overlays/drawer.js.map +1 -1
- package/dist/components/overlays/modal/body.js.map +1 -1
- package/dist/components/overlays/modal/footer.js.map +1 -1
- package/dist/components/overlays/modal/header.js.map +1 -1
- package/dist/components/overlays/modal.js +1 -1
- package/dist/components/overlays/modal.js.map +1 -1
- package/dist/components/overlays/mount-animation.js.map +1 -1
- package/dist/components/overlays/overlay.js +52 -3
- package/dist/components/overlays/overlay.js.map +1 -1
- package/dist/components/overlays/popover.js +2 -2
- package/dist/components/overlays/popover.js.map +1 -1
- package/dist/components/overlays/portal-target.js.map +1 -1
- package/dist/components/overlays/portal.js.map +1 -1
- package/dist/components/overlays/tooltip.js +1 -1
- package/dist/components/overlays/tooltip.js.map +1 -1
- package/dist/components/status/alert.js +29 -20
- package/dist/components/status/alert.js.map +1 -1
- package/dist/components/status/progress-bar.js +9 -1
- package/dist/components/status/progress-bar.js.map +1 -1
- package/dist/components/utilities/avatar.js.map +1 -1
- package/dist/components/utilities/collapsible.js.map +1 -1
- package/dist/components/utilities/divider.js +1 -1
- package/dist/components/utilities/divider.js.map +1 -1
- package/dist/components/utilities/index.js +1 -1
- package/dist/components/utilities/kbd.js +2 -2
- package/dist/components/utilities/kbd.js.map +1 -1
- package/dist/components/utilities/skeleton.js.map +1 -1
- package/dist/components/utilities/spinner.js +26 -7
- package/dist/components/utilities/spinner.js.map +1 -1
- package/dist/components/utilities/visually-hidden.js.map +1 -1
- package/dist/control-blur-C8OnSQR5.js.map +1 -1
- package/dist/deprecated-args-BIUjLA8y.js +32 -0
- package/dist/deprecated-args-BIUjLA8y.js.map +1 -0
- package/dist/dialog-CreV7aPQ.js.map +1 -1
- package/dist/dom-cKWVvtkd.js.map +1 -1
- package/dist/forms.js +2 -0
- package/dist/forms.js.map +1 -1
- package/dist/icons-DZ61nCzv.js +51 -0
- package/dist/icons-DZ61nCzv.js.map +1 -0
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/dist/{manager-CDIZzrQ9.js → manager-jDaRVZ5o.js} +28 -24
- package/dist/manager-jDaRVZ5o.js.map +1 -0
- package/dist/modifiers/drag-to-dismiss.js.map +1 -1
- package/dist/modifiers/press.js.map +1 -1
- package/dist/{notification-card-BHTra4Zh.js → notification-card-dz-eE6z9.js} +26 -23
- package/dist/notification-card-dz-eE6z9.js.map +1 -0
- package/dist/notifications.js +2 -2
- package/dist/runtime--fcdnjmJ-BOdRhmsS.js.map +1 -1
- package/dist/services/notifications.js +1 -1
- package/dist/services/notifications.js.map +1 -1
- package/dist/test-support.js.map +1 -1
- package/dist/utilities.js +1 -1
- package/dist/utils/deferred-work.js.map +1 -1
- package/dist/utils/filter.js.map +1 -1
- package/dist/utils/forms-utils-index.js.map +1 -1
- package/dist/utils/keys.js.map +1 -1
- package/dist/utils/listManager.js +34 -4
- package/dist/utils/listManager.js.map +1 -1
- package/dist/utils/nested-data.js.map +1 -1
- package/dist/utils/prefers-reduced-motion.js.map +1 -1
- package/dist/utils/ref.js +1 -1
- package/dist/utils/ref.js.map +1 -1
- package/dist/utils/roving-focus.js.map +1 -1
- package/dist/utils/safe-area.js.map +1 -1
- package/dist/utils/safe-styles.js.map +1 -1
- package/dist/utils/selection-indicator.js.map +1 -1
- package/dist/utils/standard-validator.js.map +1 -1
- package/dist/utils/toggle.js.map +1 -1
- package/package.json +23 -24
- package/dist/components/collections/calendar/icons.js +0 -23
- package/dist/components/collections/calendar/icons.js.map +0 -1
- package/dist/components/collections/table/icons.js +0 -19
- package/dist/components/collections/table/icons.js.map +0 -1
- package/dist/components/disclosure/icons.js +0 -13
- package/dist/components/disclosure/icons.js.map +0 -1
- package/dist/components/forms/icons.js +0 -13
- package/dist/components/forms/icons.js.map +0 -1
- package/dist/components/navigation/pagination/icons.js +0 -23
- package/dist/components/navigation/pagination/icons.js.map +0 -1
- package/dist/intent-icons-DpEViO8C.js +0 -19
- package/dist/intent-icons-DpEViO8C.js.map +0 -1
- package/dist/manager-CDIZzrQ9.js.map +0 -1
- package/dist/notification-card-BHTra4Zh.js.map +0 -1
- package/dist/template-registry.js +0 -2
- package/dist/template-registry.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manager-jDaRVZ5o.js","sources":["../src/-private/timer.ts","../src/-private/get-config.ts","../src/-private/notification.ts","../src/-private/manager.ts"],"sourcesContent":["import { tracked } from '@glimmer/tracking';\nimport { later, cancel } from '@ember/runloop';\nimport type { Timer as EmberTimer } from '@ember/runloop';\nimport { action } from '@ember/object';\n\nexport default class Timer {\n @tracked remaining: number;\n @tracked isRunning = true;\n\n readonly onFinish: () => void;\n private timer?: EmberTimer;\n private start!: number;\n\n constructor(duration: number, onFinish: () => void) {\n this.remaining = duration;\n this.onFinish = onFinish;\n this.setup();\n }\n\n @action clear(): void {\n this.isRunning = false;\n\n if (this.timer) {\n cancel(this.timer);\n }\n }\n\n @action pause(): void {\n // Pausing an already paused timer would subtract the elapsed time twice,\n // eventually driving `remaining` to zero or below.\n if (!this.isRunning) {\n return;\n }\n\n this.clear();\n this.remaining = Math.max(0, this.remaining - (Date.now() - this.start));\n }\n\n @action resume(): void {\n // Already counting down; resuming again would restart the remaining time.\n if (this.isRunning) {\n return;\n }\n\n this.clear();\n this.setup();\n }\n\n private setup(): void {\n this.start = Date.now();\n this.isRunning = true;\n\n this.timer = later(\n this,\n () => {\n this.onFinish();\n this.isRunning = false;\n },\n this.remaining\n );\n }\n}\n","import { get } from '@ember/object';\nimport type { DefaultConfig } from './types';\n\nexport function getConfigOption<T extends keyof DefaultConfig>(\n config: DefaultConfig,\n key: T,\n defaultValue: NonNullable<DefaultConfig[T]>\n): NonNullable<DefaultConfig[T]> {\n const value = get(config, key);\n\n if (value === undefined) {\n return defaultValue;\n }\n\n return value;\n}\n","import { tracked } from '@glimmer/tracking';\nimport { deprecate } from '@ember/debug';\nimport Timer from './timer';\nimport { getConfigOption } from './get-config';\nimport type {\n NotificationOptions,\n NotificationContent,\n NotificationStatus,\n NotificationAppearance,\n NotificationUpdate,\n CustomAction,\n DefaultConfig\n} from './types';\n\n/**\n * Normalise the two content forms into `{ title, description }`.\n */\nfunction toContent(content: string | NotificationContent): NotificationContent {\n return typeof content === 'string' ? { title: content } : content;\n}\n\n/**\n * Emit the shared deprecation notice and remap `error` onto `danger`. Used\n * for both the option-level and config-level `appearance` fallbacks in\n * `resolveStatus`, which must apply the same remap.\n */\nfunction mapAppearance(appearance: NotificationAppearance): NotificationStatus {\n deprecate(\n 'The `appearance` option for notifications is deprecated. Use `status` instead, and `danger` in place of `error`.',\n false,\n {\n id: 'frontile.notification-appearance',\n until: '0.19.0',\n for: 'frontile',\n since: { available: '0.18.0', enabled: '0.18.0' }\n }\n );\n\n if (appearance === 'error') return 'danger';\n // `info` folded into `primary` when the axis became `status`.\n if (appearance === 'info') return 'primary';\n\n return appearance;\n}\n\n/**\n * Resolve the notification status from the current option, the deprecated\n * `appearance` option, and the app config, in that order.\n */\nfunction resolveStatus(\n config: DefaultConfig,\n options: NotificationOptions\n): NotificationStatus {\n if (options.status) {\n return options.status;\n }\n\n if (options.appearance) {\n return mapAppearance(options.appearance);\n }\n\n if (config.status) {\n return config.status;\n }\n\n if (config.appearance) {\n return mapAppearance(config.appearance);\n }\n\n // `config.status`/`config.appearance` were already read directly above, so\n // there is no distinct config lookup left to fall back to.\n return 'neutral';\n}\n\nexport default class Notification<\n TMetadata extends Record<string, unknown> = Record<string, unknown>\n> {\n /**\n * The title of the notification. Named `message` for backwards\n * compatibility with the original single-string API.\n */\n @tracked message: string;\n @tracked description?: string;\n @tracked status: NotificationStatus;\n @tracked allowClosing: boolean;\n @tracked isLoading: boolean;\n @tracked customActions?: CustomAction[];\n @tracked timer?: Timer;\n @tracked isRemoving = false;\n\n readonly transitionDuration: number;\n readonly duration: number;\n readonly hideIcon: boolean;\n readonly metadata?: TMetadata;\n\n constructor(\n config: DefaultConfig,\n content: string | NotificationContent,\n options: NotificationOptions<TMetadata> = {}\n ) {\n const { title, description } = toContent(content);\n\n this.message = title;\n // An object content form owns the description outright; the option is only\n // a convenience for the string form.\n this.description =\n typeof content === 'string' ? options.description : description;\n this.status = resolveStatus(config, options);\n this.isLoading = options.isLoading === true;\n this.hideIcon = options.hideIcon === true;\n this.customActions = options.customActions;\n this.duration =\n options.duration || getConfigOption(config, 'duration', 5000);\n this.transitionDuration =\n typeof options.transitionDuration !== 'undefined'\n ? options.transitionDuration\n : getConfigOption(config, 'transitionDuration', 200);\n this.metadata = options.metadata;\n this.allowClosing = options.allowClosing !== false;\n }\n\n /** Read-only alias of `message` — do not add a setter. */\n get title(): string {\n return this.message;\n }\n\n /**\n * @deprecated Read `status` instead.\n *\n * The return type is widened to include `'default'` because `default` is\n * new vocabulary introduced alongside this getter's deprecation — it has\n * no equivalent in the old `NotificationAppearance` names, so mapping it\n * onto `'info'` here would silently lie about the notification's status.\n * Everything else keeps the old four-value shape.\n */\n get appearance(): 'default' | 'info' | 'success' | 'warning' | 'error' {\n if (this.status === 'danger') return 'error';\n if (this.status === 'neutral') return 'default';\n if (this.status === 'primary') return 'info';\n\n return this.status;\n }\n\n /**\n * Mutate the notification in place. Used by `promise()` so a settling\n * promise swaps the content of the toast already on screen rather than\n * replacing it with a new one.\n */\n update(changes: NotificationUpdate): void {\n if (typeof changes.title !== 'undefined') {\n this.message = changes.title;\n }\n\n if (typeof changes.description !== 'undefined') {\n this.description = changes.description;\n }\n\n if (typeof changes.status !== 'undefined') {\n this.status = changes.status;\n }\n\n if (typeof changes.allowClosing !== 'undefined') {\n this.allowClosing = changes.allowClosing;\n }\n\n if (typeof changes.isLoading !== 'undefined') {\n this.isLoading = changes.isLoading;\n }\n }\n\n remove(): void {\n this.isRemoving = true;\n\n if (this.timer) {\n this.timer.clear();\n }\n }\n}\n","import Notification from './notification';\nimport Timer from './timer';\nimport { tracked } from '@glimmer/tracking';\nimport { assert } from '@ember/debug';\nimport { getConfigOption } from './get-config';\nimport { getOwner } from '@ember/owner';\nimport { isDestroyed } from '@ember/destroyable';\nimport { later } from '@ember/runloop';\nimport type Owner from '@ember/owner';\nimport type {\n DefaultConfig,\n NotificationOptions,\n NotificationContent,\n NotificationStatus,\n PromiseMessage,\n PromiseNotificationOptions\n} from './types';\n\nfunction resolveMessage<T>(\n message: PromiseMessage<T>,\n value: T\n): NotificationContent {\n const resolved = typeof message === 'function' ? message(value) : message;\n return typeof resolved === 'string' ? { title: resolved } : resolved;\n}\n\n/**\n * Whether a notification should get an auto-removal timer, given its own\n * `preserve` option and the manager's config. An explicit `preserve` wins;\n * otherwise the config's `preserve` default applies. Either way, a\n * config-level `skipTimer: true` forces preservation — there's no timer to\n * skip if the notification is never auto-removed in the first place.\n *\n * Shared by `add()` and `promise()`'s settle path, which must apply this\n * decision identically.\n */\nfunction shouldAutoRemove(\n config: DefaultConfig,\n preserveOption: boolean | undefined\n): boolean {\n const preserve =\n typeof preserveOption === 'undefined'\n ? getConfigOption(config, 'preserve', false)\n : preserveOption;\n\n if (getConfigOption(config, 'skipTimer', false) === true) {\n return false;\n }\n\n return preserve === false;\n}\n\nexport default class NotificationsManager {\n @tracked notifications: Notification<Record<string, unknown>>[] = [];\n\n config: DefaultConfig = {};\n onRemove?: (notification: Notification<Record<string, unknown>>) => void;\n\n constructor(\n context: object,\n onRemove?: (notification: Notification<Record<string, unknown>>) => void\n ) {\n if (isDestroyed(context)) {\n return;\n }\n const owner = getOwner(context) as Owner;\n assert('NotificationsManager context must have an owner', owner);\n const configFactory = owner.factoryFor('config:environment');\n\n if (configFactory && configFactory.class) {\n this.config =\n (configFactory.class as never)['@frontile/notifications'] || {};\n }\n\n this.onRemove = onRemove;\n }\n\n add<TMetadata extends Record<string, unknown> = Record<string, unknown>>(\n content: string | NotificationContent,\n options: NotificationOptions<TMetadata> = {}\n ): Notification<TMetadata> {\n const notification = new Notification<TMetadata>(\n this.config,\n content,\n options\n );\n this.notifications = [...this.notifications, notification];\n\n if (shouldAutoRemove(this.config, options.preserve)) {\n this.setupAutoRemoval(notification, notification.duration);\n }\n return notification;\n }\n\n /**\n * Show a notification driven by a promise: a spinner while pending, then\n * the same notification mutated in place once it settles.\n *\n * Returns the original promise, so callers can still await it — and are\n * still responsible for handling its rejection.\n */\n promise<\n T,\n TMetadata extends Record<string, unknown> = Record<string, unknown>\n >(\n promise: Promise<T>,\n options: PromiseNotificationOptions<T, TMetadata>\n ): Promise<T> {\n const { loading, success, error, ...rest } = options;\n\n const notification = this.add<TMetadata>(loading, {\n ...(rest as NotificationOptions<TMetadata>),\n preserve: true,\n allowClosing: false,\n isLoading: true\n });\n\n const settle = (\n content: NotificationContent,\n status: NotificationStatus\n ) => {\n // The user may have dismissed the toast before the promise settled; in\n // that case there is nothing left to update.\n if (notification.isRemoving) {\n return;\n }\n\n notification.update({\n ...content,\n // `update()` treats an absent key as \"leave this field alone\" (that\n // distinction is load-bearing elsewhere), so a settle message with\n // no description must still pass an explicit empty string here —\n // otherwise `resolveMessage`'s string-form `{ title }` (no\n // `description` key at all) would leave the loading phase's stale\n // description on screen instead of clearing it.\n description: content.description ?? '',\n status,\n allowClosing: true,\n isLoading: false\n });\n\n // `preserve: true` forces the loading phase to skip auto-dismissal\n // (there's nothing useful to time out on a spinner), but the docs\n // promise every option except `isLoading` carries through to the\n // settled notification — so a caller's own `preserve` must still be\n // honored here, not silently overridden by the loading phase's.\n if (shouldAutoRemove(this.config, rest.preserve)) {\n this.setupAutoRemoval(notification, notification.duration);\n }\n };\n\n promise.then(\n (value) => settle(resolveMessage(success, value), 'success'),\n (reason) => settle(resolveMessage(error, reason), 'danger')\n );\n\n return promise;\n }\n\n remove(notification?: Notification<Record<string, unknown>>): void {\n // Removal is single-shot: a notification already on its way out must not\n // schedule a second removal, otherwise `onRemove` is called twice for it.\n if (!notification || notification.isRemoving) {\n return;\n }\n\n notification.remove();\n\n // The unmount is timed to `transitionDuration` (default 200ms), which\n // governs the card's exit *opacity* fade. The exit *slide/scale*\n // transform, however, runs at a fixed 400ms (see notificationCard's\n // theme slots) independent of `transitionDuration`. At the defaults this\n // is invisible only because the opacity reaches 0 at the same moment the\n // card unmounts, hiding the fact that the slide is truncated mid-flight.\n // If the opacity duration is ever decoupled from this unmount timer (or\n // `transitionDuration` is changed without also revisiting the transform\n // duration), cards will visibly disappear mid-slide instead of fading\n // out cleanly. Keep the two in sync, or make the unmount wait for the\n // longer of the two durations.\n later(\n this,\n () => {\n this.notifications = this.notifications.filter((n) => {\n return n !== notification;\n });\n\n // Call the onRemove callback after the notification is actually removed\n if (this.onRemove) {\n this.onRemove(notification);\n }\n },\n notification.transitionDuration\n );\n }\n\n removeAll(): void {\n this.notifications.forEach((notification) => {\n this.remove(notification);\n });\n }\n\n private setupAutoRemoval(\n notification: Notification<Record<string, unknown>>,\n duration: number\n ): void {\n notification.timer = new Timer(duration, () => {\n this.remove(notification);\n });\n }\n}\n"],"names":["Timer","g","prototype","tracked","i","onFinish","timer","start","constructor","duration","remaining","setup","clear","isRunning","cancel","n","action","pause","Math","max","Date","now","resume","later","getConfigOption","config","key","defaultValue","value","get","undefined","toContent","content","title","mapAppearance","appearance","deprecate","id","until","for","since","available","enabled","resolveStatus","options","status","Notification","transitionDuration","hideIcon","metadata","description","message","isLoading","customActions","allowClosing","update","changes","remove","isRemoving","resolveMessage","resolved","shouldAutoRemove","preserveOption","preserve","NotificationsManager","onRemove","context","isDestroyed","owner","getOwner","assert","configFactory","factoryFor","class","add","notification","notifications","setupAutoRemoval","promise","loading","success","error","rest","settle","then","reason","filter","removeAll","forEach"],"mappings":";;;;;;;;AAKe,MAAMA,KAAK,CAAC;AAAA,EAAA;IAAAC,eAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,WAAA,EAAA,CACxBC,OAAO,CAAA,CAAA;AAAA;EAAA,UAAA,IAAAC,2BAAA,CAAA,IAAA,EAAA,WAAA,CAAA,EAAA,MAAA;AAAA,EAAA;IAAAH,eAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,WAAA,EAAA,CACPC,OAAO,CAAA,EAAA,YAAA;AAAA,MAAA,OAAa,IAAI;AAAA,IAAA,CAAA,CAAA;AAAA;EAAA,UAAA,IAAAC,2BAAA,CAAA,IAAA,EAAA,WAAA,CAAA,EAAA,MAAA;EAEhBC,QAAQ;EACTC,KAAK;EACLC,KAAK;AAEbC,EAAAA,WAAWA,CAACC,QAAgB,EAAEJ,QAAoB,EAAE;IAClD,IAAI,CAACK,SAAS,GAAGD,QAAQ;IACzB,IAAI,CAACJ,QAAQ,GAAGA,QAAQ;IACxB,IAAI,CAACM,KAAK,EAAE;AACd,EAAA;AAEQC,EAAAA,KAAKA,GAAS;IACpB,IAAI,CAACC,SAAS,GAAG,KAAK;IAEtB,IAAI,IAAI,CAACP,KAAK,EAAE;AACdQ,MAAAA,MAAM,CAAC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K;QACpD,OAAOA,CAAC,KAAK4D,YAAY;AAC3B,MAAA,CAAC,CAAC;;AAEF;MACA,IAAI,IAAI,CAACV,QAAQ,EAAE;AACjB,QAAA,IAAI,CAACA,QAAQ,CAACU,YAAY,CAAC;AAC7B,MAAA;AACF,IAAA,CAAC,EACDA,YAAY,CAAC5B,kBACf,CAAC;AACH,EAAA;AAEAwC,EAAAA,SAASA,GAAS;AAChB,IAAA,IAAI,CAACX,aAAa,CAACY,OAAO,CAAEb,YAAY,IAAK;AAC3C,MAAA,IAAI,CAAClB,MAAM,CAACkB,YAAY,CAAC;AAC3B,IAAA,CAAC,CAAC;AACJ,EAAA;AAEQE,EAAAA,gBAAgBA,CACtBF,YAAmD,EACnDlE,QAAgB,EACV;IACNkE,YAAY,CAACrE,KAAK,GAAG,IAAIN,KAAK,CAACS,QAAQ,EAAE,MAAM;AAC7C,MAAA,IAAI,CAACgD,MAAM,CAACkB,YAAY,CAAC;AAC3B,IAAA,CAAC,CAAC;AACJ,EAAA;AACF;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drag-to-dismiss.js","sources":["../../src/modifiers/drag-to-dismiss.ts"],"sourcesContent":["import { modifier } from 'ember-modifier';\n\nexport type DragAxis = 'x' | 'y';\n\n/** 1 dismisses by moving positive along the axis (down / right); -1 negative. */\nexport type DragDirection = 1 | -1;\n\nexport interface DragToDismissOptions {\n axis: DragAxis;\n direction: DragDirection;\n isEnabled: boolean;\n onDismiss: () => void;\n /** Scroll container that may start a drag when already at its edge. */\n scrollSelector?: string;\n /** Always-draggable handle. */\n handleSelector?: string;\n}\n\n/** Fraction of the element's size along the axis that commits a dismiss. */\nconst DISTANCE_THRESHOLD = 0.25;\n\n/** px/ms that commits a dismiss regardless of distance. */\nconst VELOCITY_THRESHOLD = 0.4;\n\n/** Window over which velocity is measured. */\nconst VELOCITY_WINDOW_MS = 100;\n\n/** Minimum elapsed time trusted for a velocity estimate; see velocity(). */\nconst MIN_VELOCITY_ELAPSED_MS = 4;\n\nconst SETTLE_MS = 200;\nconst EASING = 'cubic-bezier(0.37, 0, 0.63, 1)';\n\n/** Resistance applied to movement away from the dismiss direction. */\nconst RUBBER_BAND = 0.2;\n\n/**\n * Travel, in px, a press on a scroll container must cover before the\n * modifier decides whether it is a dismiss drag or a native scroll. Below\n * this, a tap's inherent jitter (and a real scroll's own initial wobble)\n * would otherwise read as a direction. 10px sits in the middle of the 8-12px\n * range typical of touch \"slop\" thresholds (e.g. the ~10px many browsers use\n * before committing a touch gesture to panning) -- large enough to filter\n * jitter, small enough that the decision still feels immediate.\n */\nconst CLAIM_THRESHOLD_PX = 10;\n\n/**\n * How long after the scroll container last scrolled a press is refused the\n * gesture. A fling that decelerates and comes to rest against the edge leaves\n * the scroller reporting \"at the edge\", so the very next touch -- or the\n * follow-through of the same one -- would otherwise read as a dismiss drag and\n * close the panel the user was only trying to scroll. Checking the scroll\n * position alone cannot tell those apart; it has no memory of having just\n * moved. Vaul solves it the same way, with a lock in the same range.\n */\nconst SCROLL_LOCK_MS = 150;\n\nfunction prefersReducedMotion(): boolean {\n return (\n typeof window.matchMedia === 'function' &&\n window.matchMedia('(prefers-reduced-motion: reduce)').matches\n );\n}\n\ninterface Sample {\n position: number;\n time: number;\n}\n\nconst dragToDismiss = modifier<{\n Args: { Positional: []; Named: DragToDismissOptions };\n Element: HTMLElement;\n}>((element, _positional, named) => {\n let pointerId: number | null = null;\n let start = 0;\n let offset = 0;\n let samples: Sample[] = [];\n let isDestroyed = false;\n\n // A press that landed on the scroll container (rather than the handle)\n // does not claim the gesture on pointerdown. It waits here, undecided,\n // until handlePointerMove sees enough travel to tell a dismiss drag from a\n // native scroll -- see the pending branch there for the decision itself.\n let pendingPointerId: number | null = null;\n let pendingStartX = 0;\n let pendingStartY = 0;\n let pendingTarget: EventTarget | null = null;\n let exitTimeoutId: number | undefined;\n // Set once the gesture has committed to dismissing. After that point the\n // off-screen transform must survive teardown -- see the note in the\n // destructor for why clearing it is visible even though the element is on\n // its way out.\n let hasCommitted = false;\n let lastScrollAt = -Infinity;\n\n const axisPosition = (event: PointerEvent): number =>\n named.axis === 'y' ? event.clientY : event.clientX;\n\n const elementSize = (): number =>\n named.axis === 'y' ? element.offsetHeight : element.offsetWidth;\n\n const setTransform = (value: number): void => {\n element.style.transform =\n named.axis === 'y' ? `translateY(${value}px)` : `translateX(${value}px)`;\n };\n\n // Whether a drag started inside the body should take over from native\n // scrolling: only when the scroller is already at the edge the drag pulls\n // away from, so a half-scrolled list still scrolls normally.\n const scrollerAllowsDrag = (target: EventTarget | null): boolean => {\n if (!named.scrollSelector) {\n return false;\n }\n\n const scroller =\n target instanceof Element\n ? target.closest<HTMLElement>(named.scrollSelector)\n : null;\n\n if (!scroller) {\n // The press did not land in the scroll container at all -- e.g. a\n // header or footer area outside it. There's nothing there to protect\n // from a hijacked scroll, so it's always draggable. This used to be\n // riskier than it sounds, since the old pointerdown-time claim\n // preventDefault'd every subsequent move unconditionally; now it only\n // matters once handlePointerMove's own along-axis/toward-dismiss gate\n // agrees, so a header press that wiggles sideways or the wrong way no\n // longer hijacks anything either.\n return true;\n }\n\n const position =\n named.axis === 'y' ? scroller.scrollTop : scroller.scrollLeft;\n const max =\n named.axis === 'y'\n ? scroller.scrollHeight - scroller.clientHeight\n : scroller.scrollWidth - scroller.clientWidth;\n\n return named.direction === 1 ? position <= 0 : position >= max;\n };\n\n const isHandle = (target: EventTarget | null): boolean =>\n Boolean(\n named.handleSelector &&\n target instanceof Element &&\n target.closest(named.handleSelector)\n );\n\n // Claim the gesture immediately -- this is only ever right for a press\n // that needs no further evidence: the handle (an explicit affordance, see\n // below), or any press at all when there's no scroll container configured\n // to protect (free-drag, nothing native can conflict with).\n const claimDrag = (event: PointerEvent): void => {\n pointerId = event.pointerId;\n start = axisPosition(event);\n offset = 0;\n samples = [{ position: start, time: event.timeStamp }];\n\n // A synthetic PointerEvent carries an id the browser never issued, so\n // capture throws in tests. The drag works without it; capture only\n // makes real pointers keep tracking outside the element.\n try {\n element.setPointerCapture(event.pointerId);\n } catch {\n // ignore\n }\n\n element.style.transition = 'none';\n };\n\n const handlePointerDown = (event: PointerEvent): void => {\n if (\n !named.isEnabled ||\n pointerId !== null ||\n pendingPointerId !== null ||\n !event.isPrimary ||\n event.button !== 0\n ) {\n return;\n }\n\n if (isHandle(event.target)) {\n claimDrag(event);\n return;\n }\n\n if (!named.scrollSelector) {\n // Nothing scrollable is configured at all, so there's no native\n // scroll to protect -- the whole element is free-drag, same as\n // always.\n claimDrag(event);\n return;\n }\n\n // A scroll container exists somewhere in this element. Claiming here\n // (the old behaviour) meant every press that landed at the scroll\n // edge -- including the extremely common case of content shorter than\n // the container, where scrollHeight === clientHeight so it is *always*\n // at the edge -- immediately took over the gesture and preventDefault'd\n // every subsequent move, which silently broke native scrolling. Instead,\n // wait: record where the press started and decide once handlePointerMove\n // sees enough travel to tell a scroll from a dismiss drag.\n pendingPointerId = event.pointerId;\n pendingStartX = event.clientX;\n pendingStartY = event.clientY;\n pendingTarget = event.target;\n samples = [{ position: axisPosition(event), time: event.timeStamp }];\n };\n\n const applyDragOffset = (event: PointerEvent): void => {\n const position = axisPosition(event);\n const raw = (position - start) * named.direction;\n\n // Toward the dismiss edge tracks 1:1; away from it rubber-bands, so the\n // panel still acknowledges the gesture without appearing to detach.\n offset = raw >= 0 ? raw : raw * RUBBER_BAND;\n\n // Once we own the gesture the browser must not also scroll or select.\n if (event.cancelable) {\n event.preventDefault();\n }\n\n setTransform(offset * named.direction);\n };\n\n const handlePointerMove = (event: PointerEvent): void => {\n const isActive = pointerId === event.pointerId;\n const isPending = !isActive && pendingPointerId === event.pointerId;\n\n if (!isActive && !isPending) {\n return;\n }\n\n samples.push({ position: axisPosition(event), time: event.timeStamp });\n samples = samples.filter(\n (sample) => event.timeStamp - sample.time <= VELOCITY_WINDOW_MS\n );\n\n if (isPending) {\n const dx = event.clientX - pendingStartX;\n const dy = event.clientY - pendingStartY;\n\n if (Math.hypot(dx, dy) < CLAIM_THRESHOLD_PX) {\n // Not enough travel yet to tell a scroll from a dismiss drag. Leave\n // the event alone -- no preventDefault -- so native scrolling (if\n // any) is free to happen.\n return;\n }\n\n // Enough travel to decide, once and for all: never re-evaluate this\n // gesture again after this point.\n const axisDelta = named.axis === 'y' ? dy : dx;\n const crossDelta = named.axis === 'y' ? dx : dy;\n const movesTowardDismiss = axisDelta * named.direction > 0;\n const isAlongAxis = Math.abs(axisDelta) > Math.abs(crossDelta);\n const target = pendingTarget;\n\n pendingPointerId = null;\n pendingTarget = null;\n\n const isScrollSettling = event.timeStamp - lastScrollAt < SCROLL_LOCK_MS;\n\n if (\n !isAlongAxis ||\n !movesTowardDismiss ||\n isScrollSettling ||\n !scrollerAllowsDrag(target)\n ) {\n // Abandoned permanently for this gesture: never preventDefault, let\n // the browser scroll (or do nothing) natively. Nothing was ever\n // claimed or captured, so there's nothing to undo.\n return;\n }\n\n pointerId = event.pointerId;\n start = named.axis === 'y' ? pendingStartY : pendingStartX;\n offset = 0;\n\n try {\n element.setPointerCapture(event.pointerId);\n } catch {\n // ignore\n }\n\n element.style.transition = 'none';\n }\n\n applyDragOffset(event);\n };\n\n const settle = (): void => {\n if (prefersReducedMotion()) {\n element.style.transition = '';\n element.style.transform = '';\n return;\n }\n\n element.style.transition = `transform ${SETTLE_MS}ms ${EASING}`;\n element.style.transform = '';\n };\n\n const commit = (): void => {\n // We own the exit motion ourselves rather than handing off to the\n // overlay wrapper's leave animation. onDismiss() -> onClose -> a tracked\n // flag flip -> Ember re-render -> ember-css-transitions applying `leave`\n // happens several frames later, and in that gap Ember's re-render (or\n // this modifier's own teardown, which runs once `isOpen` flips) clears\n // this element's inline transform -- so freezing the transform and\n // waiting for the wrapper's animation let the drawer visibly snap back\n // to rest before sliding out.\n //\n // Instead, animate this element from its current dragged offset the\n // rest of the way off-screen (its own size along the axis), and only\n // call onDismiss() once that animation finishes. While onDismiss has\n // not fired, `isOpen` is still true, so nothing re-renders or destroys\n // this element and nothing can clear its inline style out from under\n // the animation -- the motion is continuous from wherever the user let\n // go, and by the time onDismiss finally runs the element is already\n // off-screen, so whatever the wrapper's leave animation does next is\n // invisible.\n hasCommitted = true;\n\n if (prefersReducedMotion()) {\n named.onDismiss();\n return;\n }\n\n const size = elementSize();\n const distance = Math.max(size, Math.abs(offset));\n\n const finish = (): void => {\n if (exitTimeoutId !== undefined) {\n window.clearTimeout(exitTimeoutId);\n exitTimeoutId = undefined;\n }\n element.removeEventListener('transitionend', onTransitionEnd);\n\n if (isDestroyed) {\n return;\n }\n\n named.onDismiss();\n };\n\n const onTransitionEnd = (event: TransitionEvent): void => {\n if (event.target !== element || event.propertyName !== 'transform') {\n return;\n }\n finish();\n };\n\n element.addEventListener('transitionend', onTransitionEnd);\n // transitionend can fail to fire (e.g. the element is hidden mid\n // transition), so a timeout guarantees onDismiss still runs.\n exitTimeoutId = window.setTimeout(finish, SETTLE_MS + 50);\n\n element.style.transition = `transform ${SETTLE_MS}ms ${EASING}`;\n setTransform(distance * named.direction);\n };\n\n const velocity = (event: PointerEvent): number => {\n // Re-window here rather than trusting the filtering done on the last\n // move. Between that move and this event the pointer may have rested --\n // a drag, a pause, then a flick is an ordinary gesture -- and a stale\n // `samples[0]` would average the pause in and under-report the flick.\n // With no sample inside the trailing window the pointer has not moved\n // recently, which is a velocity of zero, not an unknown.\n // Re-window here rather than trusting the filtering done on the last\n // move. Between that move and this event the pointer may have rested --\n // a drag, a pause, then a flick is an ordinary gesture -- and a stale\n // `samples[0]` would average the pause in and under-report the flick.\n // With no sample inside the trailing window the pointer has not moved\n // recently, which is a velocity of zero, not an unknown.\n const cutoff = event.timeStamp - VELOCITY_WINDOW_MS;\n const oldest = samples.find((sample) => sample.time >= cutoff);\n if (!oldest) {\n return 0;\n }\n\n const elapsed = event.timeStamp - oldest.time;\n // Real pointer input arrives no faster than the device's sampling rate\n // (~8ms for a 120Hz touch digitizer, ~16ms for a 60Hz mouse poll), so an\n // elapsed time below that floor is measurement noise rather than a\n // signal of gesture speed — dividing by it would produce a physically\n // implausible velocity. Below the floor, fall back to the distance\n // check alone.\n if (elapsed < MIN_VELOCITY_ELAPSED_MS) {\n return 0;\n }\n\n return (\n ((axisPosition(event) - oldest.position) * named.direction) / elapsed\n );\n };\n\n const handlePointerUp = (event: PointerEvent): void => {\n if (pendingPointerId === event.pointerId) {\n // The gesture never crossed the claim threshold: a tap, or a press\n // that stayed a native scroll for its whole life. This also covers\n // `pointercancel`, which the browser fires on a pending gesture when\n // it takes over to scroll -- either way, nothing was ever claimed or\n // captured, so resetting is all there is to do; it must not be\n // mistaken for a dismiss.\n pendingPointerId = null;\n pendingTarget = null;\n return;\n }\n\n if (pointerId !== event.pointerId) {\n return;\n }\n\n pointerId = null;\n\n try {\n element.releasePointerCapture(event.pointerId);\n } catch {\n // ignore\n }\n\n const size = elementSize();\n const passedDistance = size > 0 && offset > size * DISTANCE_THRESHOLD;\n const passedVelocity = velocity(event) > VELOCITY_THRESHOLD;\n\n if (passedDistance || passedVelocity) {\n commit();\n } else {\n settle();\n }\n };\n\n // `scroll` does not bubble, but it does propagate to capture-phase\n // listeners on ancestors, which is how one listener here sees any scroll\n // container inside the element.\n const handleScroll = (event: Event): void => {\n lastScrollAt = event.timeStamp;\n };\n\n element.addEventListener('scroll', handleScroll, {\n capture: true,\n passive: true\n });\n element.addEventListener('pointerdown', handlePointerDown);\n element.addEventListener('pointermove', handlePointerMove, {\n passive: false\n });\n element.addEventListener('pointerup', handlePointerUp);\n element.addEventListener('pointercancel', handlePointerUp);\n\n return () => {\n element.removeEventListener('scroll', handleScroll, { capture: true });\n element.removeEventListener('pointerdown', handlePointerDown);\n element.removeEventListener('pointermove', handlePointerMove);\n element.removeEventListener('pointerup', handlePointerUp);\n element.removeEventListener('pointercancel', handlePointerUp);\n\n // Mark torn down first so a pending exit animation's finish() (from\n // transitionend or its setTimeout fallback) sees it and skips calling\n // onDismiss() again -- the caller that tore this modifier down has\n // already moved on, and firing onDismiss after teardown could re-enter\n // logic that no longer expects it.\n isDestroyed = true;\n\n // Never clear the transform once the gesture has committed. It looks\n // safe to -- the element is being destroyed -- but ember-css-transitions\n // does not animate this element out, it animates a CLONE of it, and the\n // clone is taken during teardown. Measured: with the reset in place, the\n // drawer slid off-screen under its own exit animation, then the clone\n // appeared back at the resting position and slid out a second time. That\n // is the \"jumps back to the open position, then closes\" report; the\n // transform has to still be on the element at the moment it is cloned.\n //\n // The remaining case is a drag that never committed -- disabled\n // mid-drag, spring-back, or the consumer unmounting the drawer some\n // other way -- where the drag styling should indeed be undone. The\n // `exitTimeoutId` guard additionally covers an unmount racing an\n // in-flight exit animation, where clearing would abort it visibly.\n if (!hasCommitted && exitTimeoutId === undefined) {\n element.style.transform = '';\n element.style.transition = '';\n }\n };\n});\n\nexport { dragToDismiss };\nexport default dragToDismiss;\n"],"names":["DISTANCE_THRESHOLD","VELOCITY_THRESHOLD","VELOCITY_WINDOW_MS","MIN_VELOCITY_ELAPSED_MS","SETTLE_MS","EASING","RUBBER_BAND","CLAIM_THRESHOLD_PX","SCROLL_LOCK_MS","prefersReducedMotion","window","matchMedia","matches","dragToDismiss","modifier","element","_positional","named","pointerId","start","offset","samples","isDestroyed","pendingPointerId","pendingStartX","pendingStartY","pendingTarget","exitTimeoutId","hasCommitted","lastScrollAt","Infinity","axisPosition","event","axis","clientY","clientX","elementSize","offsetHeight","offsetWidth","setTransform","value","style","transform","scrollerAllowsDrag","target","scrollSelector","scroller","Element","closest","position","scrollTop","scrollLeft","max","scrollHeight","clientHeight","scrollWidth","clientWidth","direction","isHandle","Boolean","handleSelector","claimDrag","time","timeStamp","setPointerCapture","transition","handlePointerDown","isEnabled","isPrimary","button","applyDragOffset","raw","cancelable","preventDefault","handlePointerMove","isActive","isPending","push","filter","sample","dx","dy","Math","hypot","axisDelta","crossDelta","movesTowardDismiss","isAlongAxis","abs","isScrollSettling","settle","commit","onDismiss","size","distance","finish","undefined","clearTimeout","removeEventListener","onTransitionEnd","propertyName","addEventListener","setTimeout","velocity","cutoff","oldest","find","elapsed","handlePointerUp","releasePointerCapture","passedDistance","passedVelocity","handleScroll","capture","passive"],"mappings":";;AAIA;;AAcA;AACA,MAAMA,kBAAkB,GAAG,IAAI;;AAE/B;AACA,MAAMC,kBAAkB,GAAG,GAAG;;AAE9B;AACA,MAAMC,kBAAkB,GAAG,GAAG;;AAE9B;AACA,MAAMC,uBAAuB,GAAG,CAAC;AAEjC,MAAMC,SAAS,GAAG,GAAG;AACrB,MAAMC,MAAM,GAAG,gCAAgC;;AAE/C;AACA,MAAMC,WAAW,GAAG,GAAG;;AAEvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,kBAAkB,GAAG,EAAE;;AAE7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,cAAc,GAAG,GAAG;AAE1B,SAASC,oBAAoBA,GAAY;AACvC,EAAA,OACE,OAAOC,MAAM,CAACC,UAAU,KAAK,UAAU,IACvCD,MAAM,CAACC,UAAU,CAAC,kCAAkC,CAAC,CAACC,OAAO;AAEjE;AAOA,MAAMC,aAAa,GAAGC,QAAQ,CAG3B,CAACC,OAAO,EAAEC,WAAW,EAAEC,KAAK,KAAK;EAClC,IAAIC,SAAwB,GAAG,IAAI;EACnC,IAAIC,KAAK,GAAG,CAAC;EACb,IAAIC,MAAM,GAAG,CAAC;EACd,IAAIC,OAAiB,GAAG,EAAE;EAC1B,IAAIC,WAAW,GAAG,KAAK;;AAEvB;AACA;AACA;AACA;EACA,IAAIC,gBAA+B,GAAG,IAAI;EAC1C,IAAIC,aAAa,GAAG,CAAC;EACrB,IAAIC,aAAa,GAAG,CAAC;EACrB,IAAIC,aAAiC,GAAG,IAAI;AAC5C,EAAA,IAAIC,aAAiC;AACrC;AACA;AACA;AACA;EACA,IAAIC,YAAY,GAAG,KAAK;EACxB,IAAIC,YAAY,GAAG,CAACC,QAAQ;AAE5B,EAAA,MAAMC,YAAY,GAAIC,KAAmB,IACvCf,KAAK,CAACgB,IAAI,KAAK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AAa,EAAEnC,iBAAiB,CAAC;AAC1DnD,EAAAA,OAAO,CAACsF,gBAAgB,CAAC,aAAa,EAAE3B,iBAAiB,EAAE;AACzDwC,IAAAA,OAAO,EAAE;AACX,GAAC,CAAC;AACFnG,EAAAA,OAAO,CAACsF,gBAAgB,CAAC,WAAW,EAAEO,eAAe,CAAC;AACtD7F,EAAAA,OAAO,CAACsF,gBAAgB,CAAC,eAAe,EAAEO,eAAe,CAAC;AAE1D,EAAA,OAAO,MAAM;AACX7F,IAAAA,OAAO,CAACmF,mBAAmB,CAAC,QAAQ,EAAEc,YAAY,EAAE;AAAEC,MAAAA,OAAO,EAAE;AAAK,KAAC,CAAC;AACtElG,IAAAA,OAAO,CAACmF,mBAAmB,CAAC,aAAa,EAAEhC,iBAAiB,CAAC;AAC7DnD,IAAAA,OAAO,CAACmF,mBAAmB,CAAC,aAAa,EAAExB,iBAAiB,CAAC;AAC7D3D,IAAAA,OAAO,CAACmF,mBAAmB,CAAC,WAAW,EAAEU,eAAe,CAAC;AACzD7F,IAAAA,OAAO,CAACmF,mBAAmB,CAAC,eAAe,EAAEU,eAAe,CAAC;;AAE7D;AACA;AACA;AACA;AACA;AACAtF,IAAAA,WAAW,GAAG,IAAI;;AAElB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAA,IAAI,CAACM,YAAY,IAAID,aAAa,KAAKqE,SAAS,EAAE;AAChDjF,MAAAA,OAAO,CAAC0B,KAAK,CAACC,SAAS,GAAG,EAAE;AAC5B3B,MAAAA,OAAO,CAAC0B,KAAK,CAACwB,UAAU,GAAG,EAAE;AAC/B,IAAA;EACF,CAAC;AACH,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"drag-to-dismiss.js","sources":["../../src/modifiers/drag-to-dismiss.ts"],"sourcesContent":["import { modifier } from 'ember-modifier';\n\nexport type DragAxis = 'x' | 'y';\n\n/** 1 dismisses by moving positive along the axis (down / right); -1 negative. */\nexport type DragDirection = 1 | -1;\n\nexport interface DragToDismissOptions {\n axis: DragAxis;\n direction: DragDirection;\n isEnabled: boolean;\n onDismiss: () => void;\n /** Scroll container that may start a drag when already at its edge. */\n scrollSelector?: string;\n /** Always-draggable handle. */\n handleSelector?: string;\n}\n\n/** Fraction of the element's size along the axis that commits a dismiss. */\nconst DISTANCE_THRESHOLD = 0.25;\n\n/** px/ms that commits a dismiss regardless of distance. */\nconst VELOCITY_THRESHOLD = 0.4;\n\n/** Window over which velocity is measured. */\nconst VELOCITY_WINDOW_MS = 100;\n\n/** Minimum elapsed time trusted for a velocity estimate; see velocity(). */\nconst MIN_VELOCITY_ELAPSED_MS = 4;\n\nconst SETTLE_MS = 200;\nconst EASING = 'cubic-bezier(0.37, 0, 0.63, 1)';\n\n/** Resistance applied to movement away from the dismiss direction. */\nconst RUBBER_BAND = 0.2;\n\n/**\n * Travel, in px, a press on a scroll container must cover before the\n * modifier decides whether it is a dismiss drag or a native scroll. Below\n * this, a tap's inherent jitter (and a real scroll's own initial wobble)\n * would otherwise read as a direction. 10px sits in the middle of the 8-12px\n * range typical of touch \"slop\" thresholds (e.g. the ~10px many browsers use\n * before committing a touch gesture to panning) -- large enough to filter\n * jitter, small enough that the decision still feels immediate.\n */\nconst CLAIM_THRESHOLD_PX = 10;\n\n/**\n * How long after the scroll container last scrolled a press is refused the\n * gesture. A fling that decelerates and comes to rest against the edge leaves\n * the scroller reporting \"at the edge\", so the very next touch -- or the\n * follow-through of the same one -- would otherwise read as a dismiss drag and\n * close the panel the user was only trying to scroll. Checking the scroll\n * position alone cannot tell those apart; it has no memory of having just\n * moved. Vaul solves it the same way, with a lock in the same range.\n */\nconst SCROLL_LOCK_MS = 150;\n\nfunction prefersReducedMotion(): boolean {\n return (\n typeof window.matchMedia === 'function' &&\n window.matchMedia('(prefers-reduced-motion: reduce)').matches\n );\n}\n\ninterface Sample {\n position: number;\n time: number;\n}\n\nconst dragToDismiss = modifier<{\n Args: { Positional: []; Named: DragToDismissOptions };\n Element: HTMLElement;\n}>((element, _positional, named) => {\n let pointerId: number | null = null;\n let start = 0;\n let offset = 0;\n let samples: Sample[] = [];\n let isDestroyed = false;\n\n // A press that landed on the scroll container (rather than the handle)\n // does not claim the gesture on pointerdown. It waits here, undecided,\n // until handlePointerMove sees enough travel to tell a dismiss drag from a\n // native scroll -- see the pending branch there for the decision itself.\n let pendingPointerId: number | null = null;\n let pendingStartX = 0;\n let pendingStartY = 0;\n let pendingTarget: EventTarget | null = null;\n let exitTimeoutId: number | undefined;\n // Set once the gesture has committed to dismissing. After that point the\n // off-screen transform must survive teardown -- see the note in the\n // destructor for why clearing it is visible even though the element is on\n // its way out.\n let hasCommitted = false;\n let lastScrollAt = -Infinity;\n\n const axisPosition = (event: PointerEvent): number =>\n named.axis === 'y' ? event.clientY : event.clientX;\n\n const elementSize = (): number =>\n named.axis === 'y' ? element.offsetHeight : element.offsetWidth;\n\n const setTransform = (value: number): void => {\n element.style.transform =\n named.axis === 'y' ? `translateY(${value}px)` : `translateX(${value}px)`;\n };\n\n // Whether a drag started inside the body should take over from native\n // scrolling: only when the scroller is already at the edge the drag pulls\n // away from, so a half-scrolled list still scrolls normally.\n const scrollerAllowsDrag = (target: EventTarget | null): boolean => {\n if (!named.scrollSelector) {\n return false;\n }\n\n const scroller =\n target instanceof Element\n ? target.closest<HTMLElement>(named.scrollSelector)\n : null;\n\n if (!scroller) {\n // The press did not land in the scroll container at all -- e.g. a\n // header or footer area outside it. There's nothing there to protect\n // from a hijacked scroll, so it's always draggable. This used to be\n // riskier than it sounds, since the old pointerdown-time claim\n // preventDefault'd every subsequent move unconditionally; now it only\n // matters once handlePointerMove's own along-axis/toward-dismiss gate\n // agrees, so a header press that wiggles sideways or the wrong way no\n // longer hijacks anything either.\n return true;\n }\n\n const position =\n named.axis === 'y' ? scroller.scrollTop : scroller.scrollLeft;\n const max =\n named.axis === 'y'\n ? scroller.scrollHeight - scroller.clientHeight\n : scroller.scrollWidth - scroller.clientWidth;\n\n return named.direction === 1 ? position <= 0 : position >= max;\n };\n\n const isHandle = (target: EventTarget | null): boolean =>\n Boolean(\n named.handleSelector &&\n target instanceof Element &&\n target.closest(named.handleSelector)\n );\n\n // Claim the gesture immediately -- this is only ever right for a press\n // that needs no further evidence: the handle (an explicit affordance, see\n // below), or any press at all when there's no scroll container configured\n // to protect (free-drag, nothing native can conflict with).\n const claimDrag = (event: PointerEvent): void => {\n pointerId = event.pointerId;\n start = axisPosition(event);\n offset = 0;\n samples = [{ position: start, time: event.timeStamp }];\n\n // A synthetic PointerEvent carries an id the browser never issued, so\n // capture throws in tests. The drag works without it; capture only\n // makes real pointers keep tracking outside the element.\n try {\n element.setPointerCapture(event.pointerId);\n } catch {\n // ignore\n }\n\n element.style.transition = 'none';\n };\n\n const handlePointerDown = (event: PointerEvent): void => {\n if (\n !named.isEnabled ||\n pointerId !== null ||\n pendingPointerId !== null ||\n !event.isPrimary ||\n event.button !== 0\n ) {\n return;\n }\n\n if (isHandle(event.target)) {\n claimDrag(event);\n return;\n }\n\n if (!named.scrollSelector) {\n // Nothing scrollable is configured at all, so there's no native\n // scroll to protect -- the whole element is free-drag, same as\n // always.\n claimDrag(event);\n return;\n }\n\n // A scroll container exists somewhere in this element. Claiming here\n // (the old behaviour) meant every press that landed at the scroll\n // edge -- including the extremely common case of content shorter than\n // the container, where scrollHeight === clientHeight so it is *always*\n // at the edge -- immediately took over the gesture and preventDefault'd\n // every subsequent move, which silently broke native scrolling. Instead,\n // wait: record where the press started and decide once handlePointerMove\n // sees enough travel to tell a scroll from a dismiss drag.\n pendingPointerId = event.pointerId;\n pendingStartX = event.clientX;\n pendingStartY = event.clientY;\n pendingTarget = event.target;\n samples = [{ position: axisPosition(event), time: event.timeStamp }];\n };\n\n const applyDragOffset = (event: PointerEvent): void => {\n const position = axisPosition(event);\n const raw = (position - start) * named.direction;\n\n // Toward the dismiss edge tracks 1:1; away from it rubber-bands, so the\n // panel still acknowledges the gesture without appearing to detach.\n offset = raw >= 0 ? raw : raw * RUBBER_BAND;\n\n // Once we own the gesture the browser must not also scroll or select.\n if (event.cancelable) {\n event.preventDefault();\n }\n\n setTransform(offset * named.direction);\n };\n\n const handlePointerMove = (event: PointerEvent): void => {\n const isActive = pointerId === event.pointerId;\n const isPending = !isActive && pendingPointerId === event.pointerId;\n\n if (!isActive && !isPending) {\n return;\n }\n\n samples.push({ position: axisPosition(event), time: event.timeStamp });\n samples = samples.filter(\n (sample) => event.timeStamp - sample.time <= VELOCITY_WINDOW_MS\n );\n\n if (isPending) {\n const dx = event.clientX - pendingStartX;\n const dy = event.clientY - pendingStartY;\n\n if (Math.hypot(dx, dy) < CLAIM_THRESHOLD_PX) {\n // Not enough travel yet to tell a scroll from a dismiss drag. Leave\n // the event alone -- no preventDefault -- so native scrolling (if\n // any) is free to happen.\n return;\n }\n\n // Enough travel to decide, once and for all: never re-evaluate this\n // gesture again after this point.\n const axisDelta = named.axis === 'y' ? dy : dx;\n const crossDelta = named.axis === 'y' ? dx : dy;\n const movesTowardDismiss = axisDelta * named.direction > 0;\n const isAlongAxis = Math.abs(axisDelta) > Math.abs(crossDelta);\n const target = pendingTarget;\n\n pendingPointerId = null;\n pendingTarget = null;\n\n const isScrollSettling = event.timeStamp - lastScrollAt < SCROLL_LOCK_MS;\n\n if (\n !isAlongAxis ||\n !movesTowardDismiss ||\n isScrollSettling ||\n !scrollerAllowsDrag(target)\n ) {\n // Abandoned permanently for this gesture: never preventDefault, let\n // the browser scroll (or do nothing) natively. Nothing was ever\n // claimed or captured, so there's nothing to undo.\n return;\n }\n\n pointerId = event.pointerId;\n start = named.axis === 'y' ? pendingStartY : pendingStartX;\n offset = 0;\n\n try {\n element.setPointerCapture(event.pointerId);\n } catch {\n // ignore\n }\n\n element.style.transition = 'none';\n }\n\n applyDragOffset(event);\n };\n\n const settle = (): void => {\n if (prefersReducedMotion()) {\n element.style.transition = '';\n element.style.transform = '';\n return;\n }\n\n element.style.transition = `transform ${SETTLE_MS}ms ${EASING}`;\n element.style.transform = '';\n };\n\n const commit = (): void => {\n // We own the exit motion ourselves rather than handing off to the\n // overlay wrapper's leave animation. onDismiss() -> onClose -> a tracked\n // flag flip -> Ember re-render -> ember-css-transitions applying `leave`\n // happens several frames later, and in that gap Ember's re-render (or\n // this modifier's own teardown, which runs once `isOpen` flips) clears\n // this element's inline transform -- so freezing the transform and\n // waiting for the wrapper's animation let the drawer visibly snap back\n // to rest before sliding out.\n //\n // Instead, animate this element from its current dragged offset the\n // rest of the way off-screen (its own size along the axis), and only\n // call onDismiss() once that animation finishes. While onDismiss has\n // not fired, `isOpen` is still true, so nothing re-renders or destroys\n // this element and nothing can clear its inline style out from under\n // the animation -- the motion is continuous from wherever the user let\n // go, and by the time onDismiss finally runs the element is already\n // off-screen, so whatever the wrapper's leave animation does next is\n // invisible.\n hasCommitted = true;\n\n if (prefersReducedMotion()) {\n named.onDismiss();\n return;\n }\n\n const size = elementSize();\n const distance = Math.max(size, Math.abs(offset));\n\n const finish = (): void => {\n if (exitTimeoutId !== undefined) {\n window.clearTimeout(exitTimeoutId);\n exitTimeoutId = undefined;\n }\n element.removeEventListener('transitionend', onTransitionEnd);\n\n if (isDestroyed) {\n return;\n }\n\n named.onDismiss();\n };\n\n const onTransitionEnd = (event: TransitionEvent): void => {\n if (event.target !== element || event.propertyName !== 'transform') {\n return;\n }\n finish();\n };\n\n element.addEventListener('transitionend', onTransitionEnd);\n // transitionend can fail to fire (e.g. the element is hidden mid\n // transition), so a timeout guarantees onDismiss still runs.\n exitTimeoutId = window.setTimeout(finish, SETTLE_MS + 50);\n\n element.style.transition = `transform ${SETTLE_MS}ms ${EASING}`;\n setTransform(distance * named.direction);\n };\n\n const velocity = (event: PointerEvent): number => {\n // Re-window here rather than trusting the filtering done on the last\n // move. Between that move and this event the pointer may have rested --\n // a drag, a pause, then a flick is an ordinary gesture -- and a stale\n // `samples[0]` would average the pause in and under-report the flick.\n // With no sample inside the trailing window the pointer has not moved\n // recently, which is a velocity of zero, not an unknown.\n // Re-window here rather than trusting the filtering done on the last\n // move. Between that move and this event the pointer may have rested --\n // a drag, a pause, then a flick is an ordinary gesture -- and a stale\n // `samples[0]` would average the pause in and under-report the flick.\n // With no sample inside the trailing window the pointer has not moved\n // recently, which is a velocity of zero, not an unknown.\n const cutoff = event.timeStamp - VELOCITY_WINDOW_MS;\n const oldest = samples.find((sample) => sample.time >= cutoff);\n if (!oldest) {\n return 0;\n }\n\n const elapsed = event.timeStamp - oldest.time;\n // Real pointer input arrives no faster than the device's sampling rate\n // (~8ms for a 120Hz touch digitizer, ~16ms for a 60Hz mouse poll), so an\n // elapsed time below that floor is measurement noise rather than a\n // signal of gesture speed — dividing by it would produce a physically\n // implausible velocity. Below the floor, fall back to the distance\n // check alone.\n if (elapsed < MIN_VELOCITY_ELAPSED_MS) {\n return 0;\n }\n\n return (\n ((axisPosition(event) - oldest.position) * named.direction) / elapsed\n );\n };\n\n const handlePointerUp = (event: PointerEvent): void => {\n if (pendingPointerId === event.pointerId) {\n // The gesture never crossed the claim threshold: a tap, or a press\n // that stayed a native scroll for its whole life. This also covers\n // `pointercancel`, which the browser fires on a pending gesture when\n // it takes over to scroll -- either way, nothing was ever claimed or\n // captured, so resetting is all there is to do; it must not be\n // mistaken for a dismiss.\n pendingPointerId = null;\n pendingTarget = null;\n return;\n }\n\n if (pointerId !== event.pointerId) {\n return;\n }\n\n pointerId = null;\n\n try {\n element.releasePointerCapture(event.pointerId);\n } catch {\n // ignore\n }\n\n const size = elementSize();\n const passedDistance = size > 0 && offset > size * DISTANCE_THRESHOLD;\n const passedVelocity = velocity(event) > VELOCITY_THRESHOLD;\n\n if (passedDistance || passedVelocity) {\n commit();\n } else {\n settle();\n }\n };\n\n // `scroll` does not bubble, but it does propagate to capture-phase\n // listeners on ancestors, which is how one listener here sees any scroll\n // container inside the element.\n const handleScroll = (event: Event): void => {\n lastScrollAt = event.timeStamp;\n };\n\n element.addEventListener('scroll', handleScroll, {\n capture: true,\n passive: true\n });\n element.addEventListener('pointerdown', handlePointerDown);\n element.addEventListener('pointermove', handlePointerMove, {\n passive: false\n });\n element.addEventListener('pointerup', handlePointerUp);\n element.addEventListener('pointercancel', handlePointerUp);\n\n return () => {\n element.removeEventListener('scroll', handleScroll, { capture: true });\n element.removeEventListener('pointerdown', handlePointerDown);\n element.removeEventListener('pointermove', handlePointerMove);\n element.removeEventListener('pointerup', handlePointerUp);\n element.removeEventListener('pointercancel', handlePointerUp);\n\n // Mark torn down first so a pending exit animation's finish() (from\n // transitionend or its setTimeout fallback) sees it and skips calling\n // onDismiss() again -- the caller that tore this modifier down has\n // already moved on, and firing onDismiss after teardown could re-enter\n // logic that no longer expects it.\n isDestroyed = true;\n\n // Never clear the transform once the gesture has committed. It looks\n // safe to -- the element is being destroyed -- but ember-css-transitions\n // does not animate this element out, it animates a CLONE of it, and the\n // clone is taken during teardown. Measured: with the reset in place, the\n // drawer slid off-screen under its own exit animation, then the clone\n // appeared back at the resting position and slid out a second time. That\n // is the \"jumps back to the open position, then closes\" report; the\n // transform has to still be on the element at the moment it is cloned.\n //\n // The remaining case is a drag that never committed -- disabled\n // mid-drag, spring-back, or the consumer unmounting the drawer some\n // other way -- where the drag styling should indeed be undone. The\n // `exitTimeoutId` guard additionally covers an unmount racing an\n // in-flight exit animation, where clearing would abort it visibly.\n if (!hasCommitted && exitTimeoutId === undefined) {\n element.style.transform = '';\n element.style.transition = '';\n }\n };\n});\n\nexport { dragToDismiss };\nexport default dragToDismiss;\n"],"names":["DISTANCE_THRESHOLD","VELOCITY_THRESHOLD","VELOCITY_WINDOW_MS","MIN_VELOCITY_ELAPSED_MS","SETTLE_MS","EASING","RUBBER_BAND","CLAIM_THRESHOLD_PX","SCROLL_LOCK_MS","prefersReducedMotion","window","matchMedia","matches","dragToDismiss","modifier","element","_positional","named","pointerId","start","offset","samples","isDestroyed","pendingPointerId","pendingStartX","pendingStartY","pendingTarget","exitTimeoutId","hasCommitted","lastScrollAt","Infinity","axisPosition","event","axis","clientY","clientX","elementSize","offsetHeight","offsetWidth","setTransform","value","style","transform","scrollerAllowsDrag","target","scrollSelector","scroller","Element","closest","position","scrollTop","scrollLeft","max","scrollHeight","clientHeight","scrollWidth","clientWidth","direction","isHandle","Boolean","handleSelector","claimDrag","time","timeStamp","setPointerCapture","transition","handlePointerDown","isEnabled","isPrimary","button","applyDragOffset","raw","cancelable","preventDefault","handlePointerMove","isActive","isPending","push","filter","sample","dx","dy","Math","hypot","axisDelta","crossDelta","movesTowardDismiss","isAlongAxis","abs","isScrollSettling","settle","commit","onDismiss","size","distance","finish","undefined","clearTimeout","removeEventListener","onTransitionEnd","propertyName","addEventListener","setTimeout","velocity","cutoff","oldest","find","elapsed","handlePointerUp","releasePointerCapture","passedDistance","passedVelocity","handleScroll","capture","passive"],"mappings":";;AAIA;;AAcA;AACA,MAAMA,kBAAkB,GAAG,IAAI;;AAE/B;AACA,MAAMC,kBAAkB,GAAG,GAAG;;AAE9B;AACA,MAAMC,kBAAkB,GAAG,GAAG;;AAE9B;AACA,MAAMC,uBAAuB,GAAG,CAAC;AAEjC,MAAMC,SAAS,GAAG,GAAG;AACrB,MAAMC,MAAM,GAAG,gCAAgC;;AAE/C;AACA,MAAMC,WAAW,GAAG,GAAG;;AAEvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,kBAAkB,GAAG,EAAE;;AAE7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,cAAc,GAAG,GAAG;AAE1B,SAASC,oBAAoBA,GAAY;AACvC,EAAA,OACE,OAAOC,MAAM,CAACC,UAAU,KAAK,UAAU,IACvCD,MAAM,CAACC,UAAU,CAAC,kCAAkC,CAAC,CAACC,OAAO;AAEjE;AAOA,MAAMC,aAAa,GAAGC,QAAQ,CAG3B,CAACC,OAAO,EAAEC,WAAW,EAAEC,KAAK,KAAK;EAClC,IAAIC,SAAwB,GAAG,IAAI;EACnC,IAAIC,KAAK,GAAG,CAAC;EACb,IAAIC,MAAM,GAAG,CAAC;EAC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;AACA,IAAA,IAAI,CAACM,YAAY,IAAID,aAAa,KAAKqE,SAAS,EAAE;AAChDjF,MAAAA,OAAO,CAAC0B,KAAK,CAACC,SAAS,GAAG,EAAE;AAC5B3B,MAAAA,OAAO,CAAC0B,KAAK,CAACwB,UAAU,GAAG,EAAE;AAC/B,IAAA;EACF,CAAC;AACH,CAAC;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"press.js","sources":["../../src/modifiers/press.ts"],"sourcesContent":["import { modifier } from 'ember-modifier';\nimport { assert } from '@ember/debug';\n\nexport type PressType = 'pressstart' | 'pressend' | 'pressup' | 'press';\nexport type PointerType = 'mouse' | 'pen' | 'touch' | 'keyboard' | 'virtual';\n\nexport class PressEvent {\n /** The type of press event. */\n type: PressType;\n /** The pointer type that triggered the press event. */\n pointerType: PointerType;\n /** The target element of the press event. */\n target: Element;\n /** Whether the shift keyboard modifier was held during the press event. */\n shiftKey: boolean;\n /** Whether the ctrl keyboard modifier was held during the press event. */\n ctrlKey: boolean;\n /** Whether the meta keyboard modifier was held during the press event. */\n metaKey: boolean;\n /** Whether the alt keyboard modifier was held during the press event. */\n altKey: boolean;\n /** The x position of the event relative to the target element. */\n x: number;\n /** The y position of the event relative to the target element. */\n y: number;\n private shouldContinuePropagation = false;\n private originalEvent: Event;\n\n constructor(\n type: PressType,\n pointerType: PointerType,\n originalEvent: Event,\n target: Element\n ) {\n this.type = type;\n this.pointerType = pointerType;\n this.target = target;\n this.originalEvent = originalEvent;\n this.shiftKey = this.getModifierState(originalEvent, 'shiftKey');\n this.ctrlKey = this.getModifierState(originalEvent, 'ctrlKey');\n this.metaKey = this.getModifierState(originalEvent, 'metaKey');\n this.altKey = this.getModifierState(originalEvent, 'altKey');\n\n const coords = this.getCoordinates(originalEvent, target);\n this.x = coords.x;\n this.y = coords.y;\n }\n\n /** By default, press events stop propagation to parent elements. */\n continuePropagation(): void {\n this.shouldContinuePropagation = true;\n }\n\n /** Prevents the default browser behavior for this event. */\n preventDefault(): void {\n this.originalEvent.preventDefault();\n }\n\n get shouldPropagate(): boolean {\n return this.shouldContinuePropagation;\n }\n\n private getModifierState(\n event: Event,\n key: 'shiftKey' | 'ctrlKey' | 'metaKey' | 'altKey'\n ): boolean {\n if (\n event instanceof KeyboardEvent ||\n event instanceof MouseEvent ||\n event instanceof PointerEvent\n ) {\n return event[key];\n }\n return false;\n }\n\n private getCoordinates(\n event: Event,\n target: Element\n ): { x: number; y: number } {\n if (event instanceof MouseEvent || event instanceof PointerEvent) {\n const rect = target.getBoundingClientRect();\n return {\n x: event.clientX - rect.left,\n y: event.clientY - rect.top\n };\n }\n return { x: 0, y: 0 };\n }\n}\n\nfunction getPointerType(event: Event): PointerType {\n if (event instanceof PointerEvent) {\n return event.pointerType as PointerType;\n }\n if (event instanceof KeyboardEvent) {\n return 'keyboard';\n }\n if (event instanceof MouseEvent) {\n return 'mouse';\n }\n return 'virtual';\n}\n\nfunction isHTMLAnchorLink(element: Element): boolean {\n return element instanceof HTMLAnchorElement && element.hasAttribute('href');\n}\n\nfunction shouldPreventDefaultUp(target: Element): boolean {\n if (target instanceof HTMLInputElement) {\n return false;\n }\n\n if (target instanceof HTMLButtonElement) {\n return target.type !== 'submit' && target.type !== 'reset';\n }\n\n if (isHTMLAnchorLink(target)) {\n return false;\n }\n\n return true;\n}\n\nfunction isValidInputKey(target: HTMLInputElement, key: string): boolean {\n const nonTextInputTypes = new Set([\n 'checkbox',\n 'radio',\n 'range',\n 'color',\n 'file',\n 'image',\n 'button',\n 'submit',\n 'reset'\n ]);\n\n return target.type === 'checkbox' || target.type === 'radio'\n ? key === ' '\n : nonTextInputTypes.has(target.type);\n}\n\nfunction shouldPreventDefaultKeyboard(target: Element, key: string): boolean {\n if (target instanceof HTMLInputElement) {\n return !isValidInputKey(target, key);\n }\n return shouldPreventDefaultUp(target);\n}\n\nexport interface PressOptions {\n onPressStart?: (event: PressEvent) => void;\n onPressEnd?: (event: PressEvent) => void;\n onPress?: (event: PressEvent) => void;\n onPressUp?: (event: PressEvent) => void;\n onPressChange?: (isPressed: boolean) => void;\n}\n\nexport interface PressSignature {\n Element: HTMLElement;\n Args: {\n Positional: [(event: PressEvent) => void] | [];\n Named: PressOptions;\n };\n}\n\nconst press = modifier<PressSignature>(\n (\n element: HTMLElement,\n positional: PressSignature['Args']['Positional'],\n named: PressOptions = {}\n ) => {\n let isPressed = false;\n const cleanupFunctions: (() => void)[] = [];\n let documentListenersActive = false;\n let currentPointerType: PointerType | null = null;\n\n // Handle positional onPress argument\n const positionalOnPress = positional[0];\n\n assert(\n 'You cannot provide both a positional onPress function and the onPress named argument to the press modifier. Choose one approach.',\n !(positionalOnPress && named.onPress)\n );\n\n // Use positional or named onPress\n const onPress = positionalOnPress || named.onPress;\n\n // Check if any callbacks are provided\n const hasAnyCallback =\n named.onPressStart ||\n named.onPressEnd ||\n onPress ||\n named.onPressUp ||\n named.onPressChange;\n\n if (!hasAnyCallback) {\n return () => {};\n }\n\n // Determine which types of events we need based on callbacks\n // We need start events if we have onPressStart OR if we have any end events (to track state) OR onPressChange\n const needsStartEvents =\n named.onPressStart ||\n named.onPressEnd ||\n onPress ||\n named.onPressUp ||\n named.onPressChange;\n const needsEndEvents =\n named.onPressEnd || onPress || named.onPressUp || named.onPressChange;\n\n // Check if we should ignore this event due to pointer event deduplication\n const shouldIgnoreEvent = (event: Event): boolean => {\n const eventPointerType = getPointerType(event);\n\n // If this is a mouse event but we already have a pointer/touch interaction active, ignore it\n if (\n eventPointerType === 'mouse' &&\n currentPointerType &&\n currentPointerType !== 'mouse'\n ) {\n return true;\n }\n\n // In mobile Safari, both pointer and mouse events can fire for the same touch.\n // If we have pointer event support, ignore mouse events entirely on touch devices\n if (\n eventPointerType === 'mouse' &&\n 'PointerEvent' in window &&\n 'ontouchstart' in window\n ) {\n return true;\n }\n\n return false;\n };\n\n // The document listeners exist only as a fallback for releases that happen\n // outside of the element (the pointer was dragged off before being\n // released). They run in the capture phase, which is the very first node in\n // the propagation path, so they must never handle - and never stop - an\n // event that belongs to the element itself: the element's own listeners\n // (including any registered by the consumer) still need to see it.\n const isInsideElement = (event: Event): boolean =>\n element.contains(event.target as Node);\n\n // Wraps a handler so it only runs for events that originated outside of the\n // element, which is the whole contract of the document-level fallback. Each\n // wrapper is created once and stored, so add/removeEventListener always see\n // the same function identity.\n const onlyOutsideElement =\n <E extends Event>(handler: (event: E) => void) =>\n (event: E): void => {\n if (isInsideElement(event)) {\n return;\n }\n handler(event);\n };\n\n const addDocumentListeners = (): void => {\n if (documentListenersActive || !needsEndEvents) {\n return;\n }\n documentListenersActive = true;\n document.addEventListener('pointerup', endFromDocument, true);\n document.addEventListener('mouseup', endFromDocument, true);\n document.addEventListener('pointercancel', cancelFromDocument, true);\n };\n\n const removeDocumentListeners = (): void => {\n if (!documentListenersActive) {\n return;\n }\n documentListenersActive = false;\n document.removeEventListener('pointerup', endFromDocument, true);\n document.removeEventListener('mouseup', endFromDocument, true);\n document.removeEventListener('pointercancel', cancelFromDocument, true);\n };\n\n const start = (event: Event): void => {\n if (shouldIgnoreEvent(event)) {\n return;\n }\n\n if (!isPressed) {\n isPressed = true;\n currentPointerType = getPointerType(event);\n addDocumentListeners();\n named.onPressChange?.(true);\n const pressEvent = new PressEvent(\n 'pressstart',\n getPointerType(event),\n event,\n element\n );\n named.onPressStart?.(pressEvent);\n if (!pressEvent.shouldPropagate) {\n event.stopPropagation();\n }\n }\n };\n\n const end = (event: Event): void => {\n if (shouldIgnoreEvent(event) || !isPressed) {\n return;\n }\n\n isPressed = false;\n currentPointerType = null;\n removeDocumentListeners();\n named.onPressChange?.(false);\n\n const onTarget = isInsideElement(event);\n const dispatched: PressEvent[] = [];\n\n const pressEndEvent = new PressEvent(\n 'pressend',\n getPointerType(event),\n event,\n element\n );\n named.onPressEnd?.(pressEndEvent);\n dispatched.push(pressEndEvent);\n\n // `press` and `pressup` only describe a release on the element itself.\n if (onTarget) {\n const pressEvent = new PressEvent(\n 'press',\n getPointerType(event),\n event,\n element\n );\n onPress?.(pressEvent);\n dispatched.push(pressEvent);\n\n const pressUpEvent = new PressEvent(\n 'pressup',\n getPointerType(event),\n event,\n element\n );\n named.onPressUp?.(pressUpEvent);\n dispatched.push(pressUpEvent);\n }\n\n // Any handler opting in to propagation wins. Only the element's own\n // release is ours to stop - stopping a release that happened elsewhere\n // would hide it from the rest of the page.\n if (onTarget && !dispatched.some((e) => e.shouldPropagate)) {\n event.stopPropagation();\n }\n };\n\n const cancel = (event: PointerEvent): void => {\n if (!isPressed) {\n return;\n }\n isPressed = false;\n currentPointerType = null;\n removeDocumentListeners();\n named.onPressChange?.(false);\n const pressEvent = new PressEvent(\n 'pressend',\n getPointerType(event),\n event,\n element\n );\n named.onPressEnd?.(pressEvent);\n if (isInsideElement(event) && !pressEvent.shouldPropagate) {\n event.stopPropagation();\n }\n };\n\n // Declared after `end`/`cancel` so the factory can capture them; the\n // resulting functions are stored once and reused by add/removeEventListener.\n const endFromDocument = onlyOutsideElement(end);\n const cancelFromDocument = onlyOutsideElement<PointerEvent>(cancel);\n\n const handleKeyDown = (event: KeyboardEvent): void => {\n if (event.key === 'Enter' || event.key === ' ') {\n if (shouldPreventDefaultKeyboard(element, event.key)) {\n event.preventDefault();\n }\n start(event);\n }\n };\n\n const handleKeyUp = (event: KeyboardEvent): void => {\n if (event.key === 'Enter' || event.key === ' ') {\n if (shouldPreventDefaultKeyboard(element, event.key)) {\n event.preventDefault();\n }\n end(event);\n }\n };\n\n // Add pointer/mouse down events only if we need start events\n if (needsStartEvents) {\n element.addEventListener('pointerdown', start);\n element.addEventListener('mousedown', start);\n\n cleanupFunctions.push(() => {\n element.removeEventListener('pointerdown', start);\n element.removeEventListener('mousedown', start);\n });\n }\n\n // Add pointer/mouse up events only if we need end events\n if (needsEndEvents) {\n element.addEventListener('pointerup', end);\n element.addEventListener('mouseup', end);\n\n cleanupFunctions.push(() => {\n element.removeEventListener('pointerup', end);\n element.removeEventListener('mouseup', end);\n });\n }\n\n // Add pointer cancel whenever we track the end of an interaction: cancel\n // resets the pressed state and triggers onPressEnd/onPressChange. It has to\n // be on the element as well as on the document, because the document\n // fallback deliberately ignores events targeting the element.\n if (needsEndEvents) {\n element.addEventListener('pointercancel', cancel);\n\n cleanupFunctions.push(() => {\n element.removeEventListener('pointercancel', cancel);\n });\n }\n\n // Add keyboard events - both start and end events if we have any callbacks that need them\n if (needsStartEvents) {\n element.addEventListener('keydown', handleKeyDown);\n cleanupFunctions.push(() => {\n element.removeEventListener('keydown', handleKeyDown);\n });\n }\n\n if (needsEndEvents) {\n element.addEventListener('keyup', handleKeyUp);\n cleanupFunctions.push(() => {\n element.removeEventListener('keyup', handleKeyUp);\n });\n }\n\n return (): void => {\n cleanupFunctions.forEach((cleanup) => cleanup());\n removeDocumentListeners();\n currentPointerType = null;\n isPressed = false;\n };\n }\n);\n\nexport { press };\nexport default press;\n"],"names":["PressEvent","type","pointerType","target","shiftKey","ctrlKey","metaKey","altKey","x","y","shouldContinuePropagation","originalEvent","constructor","getModifierState","coords","getCoordinates","continuePropagation","preventDefault","shouldPropagate","event","key","KeyboardEvent","MouseEvent","PointerEvent","rect","getBoundingClientRect","clientX","left","clientY","top","getPointerType","isHTMLAnchorLink","element","HTMLAnchorElement","hasAttribute","shouldPreventDefaultUp","HTMLInputElement","HTMLButtonElement","isValidInputKey","nonTextInputTypes","Set","has","shouldPreventDefaultKeyboard","press","modifier","positional","named","isPressed","cleanupFunctions","documentListenersActive","currentPointerType","positionalOnPress","assert","onPress","hasAnyCallback","onPressStart","onPressEnd","onPressUp","onPressChange","needsStartEvents","needsEndEvents","shouldIgnoreEvent","eventPointerType","window","isInsideElement","contains","onlyOutsideElement","handler","addDocumentListeners","document","addEventListener","endFromDocument","cancelFromDocument","removeDocumentListeners","removeEventListener","start","pressEvent","stopPropagation","end","onTarget","dispatched","pressEndEvent","push","pressUpEvent","some","e","cancel","handleKeyDown","handleKeyUp","forEach","cleanup"],"mappings":";;;AAMO,MAAMA,UAAU,CAAC;AACtB;EAC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lD,MAAAA,OAAO,CAAC0C,mBAAmB,CAAC,eAAe,EAAEY,MAAM,CAAC;AACtD,IAAA,CAAC,CAAC;AACJ,EAAA;;AAEA;AACA,EAAA,IAAI3B,gBAAgB,EAAE;AACpB3B,IAAAA,OAAO,CAACsC,gBAAgB,CAAC,SAAS,EAAEiB,aAAa,CAAC;IAClDvC,gBAAgB,CAACkC,IAAI,CAAC,MAAM;AAC1BlD,MAAAA,OAAO,CAAC0C,mBAAmB,CAAC,SAAS,EAAEa,aAAa,CAAC;AACvD,IAAA,CAAC,CAAC;AACJ,EAAA;AAEA,EAAA,IAAI3B,cAAc,EAAE;AAClB5B,IAAAA,OAAO,CAACsC,gBAAgB,CAAC,OAAO,EAAEkB,WAAW,CAAC;IAC9CxC,gBAAgB,CAACkC,IAAI,CAAC,MAAM;AAC1BlD,MAAAA,OAAO,CAAC0C,mBAAmB,CAAC,OAAO,EAAEc,WAAW,CAAC;AACnD,IAAA,CAAC,CAAC;AACJ,EAAA;AAEA,EAAA,OAAO,MAAY;IACjBxC,gBAAgB,CAACyC,OAAO,CAAEC,OAAO,IAAKA,OAAO,EAAE,CAAC;AAChDjB,IAAAA,uBAAuB,EAAE;AACzBvB,IAAAA,kBAAkB,GAAG,IAAI;AACzBH,IAAAA,SAAS,GAAG,KAAK;EACnB,CAAC;AACH,CACF;;;;"}
|
|
1
|
+
{"version":3,"file":"press.js","sources":["../../src/modifiers/press.ts"],"sourcesContent":["import { modifier } from 'ember-modifier';\nimport { assert } from '@ember/debug';\n\nexport type PressType = 'pressstart' | 'pressend' | 'pressup' | 'press';\nexport type PointerType = 'mouse' | 'pen' | 'touch' | 'keyboard' | 'virtual';\n\nexport class PressEvent {\n /** The type of press event. */\n type: PressType;\n /** The pointer type that triggered the press event. */\n pointerType: PointerType;\n /** The target element of the press event. */\n target: Element;\n /** Whether the shift keyboard modifier was held during the press event. */\n shiftKey: boolean;\n /** Whether the ctrl keyboard modifier was held during the press event. */\n ctrlKey: boolean;\n /** Whether the meta keyboard modifier was held during the press event. */\n metaKey: boolean;\n /** Whether the alt keyboard modifier was held during the press event. */\n altKey: boolean;\n /** The x position of the event relative to the target element. */\n x: number;\n /** The y position of the event relative to the target element. */\n y: number;\n private shouldContinuePropagation = false;\n private originalEvent: Event;\n\n constructor(\n type: PressType,\n pointerType: PointerType,\n originalEvent: Event,\n target: Element\n ) {\n this.type = type;\n this.pointerType = pointerType;\n this.target = target;\n this.originalEvent = originalEvent;\n this.shiftKey = this.getModifierState(originalEvent, 'shiftKey');\n this.ctrlKey = this.getModifierState(originalEvent, 'ctrlKey');\n this.metaKey = this.getModifierState(originalEvent, 'metaKey');\n this.altKey = this.getModifierState(originalEvent, 'altKey');\n\n const coords = this.getCoordinates(originalEvent, target);\n this.x = coords.x;\n this.y = coords.y;\n }\n\n /** By default, press events stop propagation to parent elements. */\n continuePropagation(): void {\n this.shouldContinuePropagation = true;\n }\n\n /** Prevents the default browser behavior for this event. */\n preventDefault(): void {\n this.originalEvent.preventDefault();\n }\n\n get shouldPropagate(): boolean {\n return this.shouldContinuePropagation;\n }\n\n private getModifierState(\n event: Event,\n key: 'shiftKey' | 'ctrlKey' | 'metaKey' | 'altKey'\n ): boolean {\n if (\n event instanceof KeyboardEvent ||\n event instanceof MouseEvent ||\n event instanceof PointerEvent\n ) {\n return event[key];\n }\n return false;\n }\n\n private getCoordinates(\n event: Event,\n target: Element\n ): { x: number; y: number } {\n if (event instanceof MouseEvent || event instanceof PointerEvent) {\n const rect = target.getBoundingClientRect();\n return {\n x: event.clientX - rect.left,\n y: event.clientY - rect.top\n };\n }\n return { x: 0, y: 0 };\n }\n}\n\nfunction getPointerType(event: Event): PointerType {\n if (event instanceof PointerEvent) {\n return event.pointerType as PointerType;\n }\n if (event instanceof KeyboardEvent) {\n return 'keyboard';\n }\n if (event instanceof MouseEvent) {\n return 'mouse';\n }\n return 'virtual';\n}\n\nfunction isHTMLAnchorLink(element: Element): boolean {\n return element instanceof HTMLAnchorElement && element.hasAttribute('href');\n}\n\nfunction shouldPreventDefaultUp(target: Element): boolean {\n if (target instanceof HTMLInputElement) {\n return false;\n }\n\n if (target instanceof HTMLButtonElement) {\n return target.type !== 'submit' && target.type !== 'reset';\n }\n\n if (isHTMLAnchorLink(target)) {\n return false;\n }\n\n return true;\n}\n\nfunction isValidInputKey(target: HTMLInputElement, key: string): boolean {\n const nonTextInputTypes = new Set([\n 'checkbox',\n 'radio',\n 'range',\n 'color',\n 'file',\n 'image',\n 'button',\n 'submit',\n 'reset'\n ]);\n\n return target.type === 'checkbox' || target.type === 'radio'\n ? key === ' '\n : nonTextInputTypes.has(target.type);\n}\n\nfunction shouldPreventDefaultKeyboard(target: Element, key: string): boolean {\n if (target instanceof HTMLInputElement) {\n return !isValidInputKey(target, key);\n }\n return shouldPreventDefaultUp(target);\n}\n\nexport interface PressOptions {\n onPressStart?: (event: PressEvent) => void;\n onPressEnd?: (event: PressEvent) => void;\n onPress?: (event: PressEvent) => void;\n onPressUp?: (event: PressEvent) => void;\n onPressChange?: (isPressed: boolean) => void;\n}\n\nexport interface PressSignature {\n Element: HTMLElement;\n Args: {\n Positional: [(event: PressEvent) => void] | [];\n Named: PressOptions;\n };\n}\n\nconst press = modifier<PressSignature>(\n (\n element: HTMLElement,\n positional: PressSignature['Args']['Positional'],\n named: PressOptions = {}\n ) => {\n let isPressed = false;\n const cleanupFunctions: (() => void)[] = [];\n let documentListenersActive = false;\n let currentPointerType: PointerType | null = null;\n\n // Handle positional onPress argument\n const positionalOnPress = positional[0];\n\n assert(\n 'You cannot provide both a positional onPress function and the onPress named argument to the press modifier. Choose one approach.',\n !(positionalOnPress && named.onPress)\n );\n\n // Use positional or named onPress\n const onPress = positionalOnPress || named.onPress;\n\n // Check if any callbacks are provided\n const hasAnyCallback =\n named.onPressStart ||\n named.onPressEnd ||\n onPress ||\n named.onPressUp ||\n named.onPressChange;\n\n if (!hasAnyCallback) {\n return () => {};\n }\n\n // Determine which types of events we need based on callbacks\n // We need start events if we have onPressStart OR if we have any end events (to track state) OR onPressChange\n const needsStartEvents =\n named.onPressStart ||\n named.onPressEnd ||\n onPress ||\n named.onPressUp ||\n named.onPressChange;\n const needsEndEvents =\n named.onPressEnd || onPress || named.onPressUp || named.onPressChange;\n\n // Check if we should ignore this event due to pointer event deduplication\n const shouldIgnoreEvent = (event: Event): boolean => {\n const eventPointerType = getPointerType(event);\n\n // If this is a mouse event but we already have a pointer/touch interaction active, ignore it\n if (\n eventPointerType === 'mouse' &&\n currentPointerType &&\n currentPointerType !== 'mouse'\n ) {\n return true;\n }\n\n // In mobile Safari, both pointer and mouse events can fire for the same touch.\n // If we have pointer event support, ignore mouse events entirely on touch devices\n if (\n eventPointerType === 'mouse' &&\n 'PointerEvent' in window &&\n 'ontouchstart' in window\n ) {\n return true;\n }\n\n return false;\n };\n\n // The document listeners exist only as a fallback for releases that happen\n // outside of the element (the pointer was dragged off before being\n // released). They run in the capture phase, which is the very first node in\n // the propagation path, so they must never handle - and never stop - an\n // event that belongs to the element itself: the element's own listeners\n // (including any registered by the consumer) still need to see it.\n const isInsideElement = (event: Event): boolean =>\n element.contains(event.target as Node);\n\n // Wraps a handler so it only runs for events that originated outside of the\n // element, which is the whole contract of the document-level fallback. Each\n // wrapper is created once and stored, so add/removeEventListener always see\n // the same function identity.\n const onlyOutsideElement =\n <E extends Event>(handler: (event: E) => void) =>\n (event: E): void => {\n if (isInsideElement(event)) {\n return;\n }\n handler(event);\n };\n\n const addDocumentListeners = (): void => {\n if (documentListenersActive || !needsEndEvents) {\n return;\n }\n documentListenersActive = true;\n document.addEventListener('pointerup', endFromDocument, true);\n document.addEventListener('mouseup', endFromDocument, true);\n document.addEventListener('pointercancel', cancelFromDocument, true);\n };\n\n const removeDocumentListeners = (): void => {\n if (!documentListenersActive) {\n return;\n }\n documentListenersActive = false;\n document.removeEventListener('pointerup', endFromDocument, true);\n document.removeEventListener('mouseup', endFromDocument, true);\n document.removeEventListener('pointercancel', cancelFromDocument, true);\n };\n\n const start = (event: Event): void => {\n if (shouldIgnoreEvent(event)) {\n return;\n }\n\n if (!isPressed) {\n isPressed = true;\n currentPointerType = getPointerType(event);\n addDocumentListeners();\n named.onPressChange?.(true);\n const pressEvent = new PressEvent(\n 'pressstart',\n getPointerType(event),\n event,\n element\n );\n named.onPressStart?.(pressEvent);\n if (!pressEvent.shouldPropagate) {\n event.stopPropagation();\n }\n }\n };\n\n const end = (event: Event): void => {\n if (shouldIgnoreEvent(event) || !isPressed) {\n return;\n }\n\n isPressed = false;\n currentPointerType = null;\n removeDocumentListeners();\n named.onPressChange?.(false);\n\n const onTarget = isInsideElement(event);\n const dispatched: PressEvent[] = [];\n\n const pressEndEvent = new PressEvent(\n 'pressend',\n getPointerType(event),\n event,\n element\n );\n named.onPressEnd?.(pressEndEvent);\n dispatched.push(pressEndEvent);\n\n // `press` and `pressup` only describe a release on the element itself.\n if (onTarget) {\n const pressEvent = new PressEvent(\n 'press',\n getPointerType(event),\n event,\n element\n );\n onPress?.(pressEvent);\n dispatched.push(pressEvent);\n\n const pressUpEvent = new PressEvent(\n 'pressup',\n getPointerType(event),\n event,\n element\n );\n named.onPressUp?.(pressUpEvent);\n dispatched.push(pressUpEvent);\n }\n\n // Any handler opting in to propagation wins. Only the element's own\n // release is ours to stop - stopping a release that happened elsewhere\n // would hide it from the rest of the page.\n if (onTarget && !dispatched.some((e) => e.shouldPropagate)) {\n event.stopPropagation();\n }\n };\n\n const cancel = (event: PointerEvent): void => {\n if (!isPressed) {\n return;\n }\n isPressed = false;\n currentPointerType = null;\n removeDocumentListeners();\n named.onPressChange?.(false);\n const pressEvent = new PressEvent(\n 'pressend',\n getPointerType(event),\n event,\n element\n );\n named.onPressEnd?.(pressEvent);\n if (isInsideElement(event) && !pressEvent.shouldPropagate) {\n event.stopPropagation();\n }\n };\n\n // Declared after `end`/`cancel` so the factory can capture them; the\n // resulting functions are stored once and reused by add/removeEventListener.\n const endFromDocument = onlyOutsideElement(end);\n const cancelFromDocument = onlyOutsideElement<PointerEvent>(cancel);\n\n const handleKeyDown = (event: KeyboardEvent): void => {\n if (event.key === 'Enter' || event.key === ' ') {\n if (shouldPreventDefaultKeyboard(element, event.key)) {\n event.preventDefault();\n }\n start(event);\n }\n };\n\n const handleKeyUp = (event: KeyboardEvent): void => {\n if (event.key === 'Enter' || event.key === ' ') {\n if (shouldPreventDefaultKeyboard(element, event.key)) {\n event.preventDefault();\n }\n end(event);\n }\n };\n\n // Add pointer/mouse down events only if we need start events\n if (needsStartEvents) {\n element.addEventListener('pointerdown', start);\n element.addEventListener('mousedown', start);\n\n cleanupFunctions.push(() => {\n element.removeEventListener('pointerdown', start);\n element.removeEventListener('mousedown', start);\n });\n }\n\n // Add pointer/mouse up events only if we need end events\n if (needsEndEvents) {\n element.addEventListener('pointerup', end);\n element.addEventListener('mouseup', end);\n\n cleanupFunctions.push(() => {\n element.removeEventListener('pointerup', end);\n element.removeEventListener('mouseup', end);\n });\n }\n\n // Add pointer cancel whenever we track the end of an interaction: cancel\n // resets the pressed state and triggers onPressEnd/onPressChange. It has to\n // be on the element as well as on the document, because the document\n // fallback deliberately ignores events targeting the element.\n if (needsEndEvents) {\n element.addEventListener('pointercancel', cancel);\n\n cleanupFunctions.push(() => {\n element.removeEventListener('pointercancel', cancel);\n });\n }\n\n // Add keyboard events - both start and end events if we have any callbacks that need them\n if (needsStartEvents) {\n element.addEventListener('keydown', handleKeyDown);\n cleanupFunctions.push(() => {\n element.removeEventListener('keydown', handleKeyDown);\n });\n }\n\n if (needsEndEvents) {\n element.addEventListener('keyup', handleKeyUp);\n cleanupFunctions.push(() => {\n element.removeEventListener('keyup', handleKeyUp);\n });\n }\n\n return (): void => {\n cleanupFunctions.forEach((cleanup) => cleanup());\n removeDocumentListeners();\n currentPointerType = null;\n isPressed = false;\n };\n }\n);\n\nexport { press };\nexport default press;\n"],"names":["PressEvent","type","pointerType","target","shiftKey","ctrlKey","metaKey","altKey","x","y","shouldContinuePropagation","originalEvent","constructor","getModifierState","coords","getCoordinates","continuePropagation","preventDefault","shouldPropagate","event","key","KeyboardEvent","MouseEvent","PointerEvent","rect","getBoundingClientRect","clientX","left","clientY","top","getPointerType","isHTMLAnchorLink","element","HTMLAnchorElement","hasAttribute","shouldPreventDefaultUp","HTMLInputElement","HTMLButtonElement","isValidInputKey","nonTextInputTypes","Set","has","shouldPreventDefaultKeyboard","press","modifier","positional","named","isPressed","cleanupFunctions","documentListenersActive","currentPointerType","positionalOnPress","assert","onPress","hasAnyCallback","onPressStart","onPressEnd","onPressUp","onPressChange","needsStartEvents","needsEndEvents","shouldIgnoreEvent","eventPointerType","window","isInsideElement","contains","onlyOutsideElement","handler","addDocumentListeners","document","addEventListener","endFromDocument","cancelFromDocument","removeDocumentListeners","removeEventListener","start","pressEvent","stopPropagation","end","onTarget","dispatched","pressEndEvent","push","pressUpEvent","some","e","cancel","handleKeyDown","handleKeyUp","forEach","cleanup"],"mappings":";;;AAMO,MAAMA,UAAU,CAAC;AACtB;EACAC,IAAI;AACJ;EACAC,WAAW;AACX;EACAC,MAAM;AACN;EACAC,QAAQ;AACR;EACAC,OAAO;AACP;EACAC,OAAO;AACP;EACAC,MAAM;AACN;EACAC,CAAC;AACD;EACAC,CAAC;AACOC,EAAAA,yBAAyB,GAAG,KAAK;EACjCC,aAAa;EAErBC,WAAWA,CACTX,IAAe,EACfC,WAAwB,EACxBS,aAAoB,EACpBR,MAAe,EACf;IACA,IAAI,CAACF,IAAI,GAAGA,IAAI;IAChB,IAAI,CAACC,WAAW,GAAGA,WAAW;IAC9B,IAAI,CAACC,MAAM,GAAGA,MAAM;IACpB,IAAI,CAACQ,aAAa,GAAGA,aAAa;IAClC,IAAI,CAACP,QAAQ,GAAG,IAAI,CAACS,gBAAgB,CAACF,aAAa,EAAE,UAAU,CAAC;IAChE,IAAI,CAACN,OAAO,GAAG,IAAI,CAACQ,gBAAgB,CAACF,aAAa,EAAE,SAAS,CAAC;IAC9D,IAAI,CAACL,OAAO,GAAG,IAAI,CAACO,gBAAgB,CAACF,aAAa,E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,gBAAgB,CAACyC,OAAO,CAAEC,OAAO,IAAKA,OAAO,EAAE,CAAC;AAChDjB,IAAAA,uBAAuB,EAAE;AACzBvB,IAAAA,kBAAkB,GAAG,IAAI;AACzBH,IAAAA,SAAS,GAAG,KAAK;EACnB,CAAC;AACH,CACF;;"}
|
|
@@ -7,7 +7,7 @@ import { fn } from '@ember/helper';
|
|
|
7
7
|
import { CloseButton } from './components/buttons/close-button.js';
|
|
8
8
|
import { Button } from './components/buttons/button.js';
|
|
9
9
|
import { Spinner } from './components/utilities/spinner.js';
|
|
10
|
-
import {
|
|
10
|
+
import { h as IconDanger, i as IconWarning, j as IconSuccess, k as IconInfo } from './icons-DZ61nCzv.js';
|
|
11
11
|
import { useStyles } from '@frontile/theme';
|
|
12
12
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
13
13
|
import { setComponentTemplate } from '@ember/component';
|
|
@@ -125,36 +125,39 @@ class NotificationStack {
|
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
-
const
|
|
129
|
-
|
|
128
|
+
const STATUS_CONFIG = {
|
|
129
|
+
neutral: {
|
|
130
130
|
icon: IconInfo,
|
|
131
|
-
// Button
|
|
132
|
-
// loading <Spinner>'s `@
|
|
133
|
-
//
|
|
131
|
+
// Button colour for the primary custom action. Also reused as the
|
|
132
|
+
// loading <Spinner>'s `@color` (its colour union has the same
|
|
133
|
+
// neutral/primary/success/warning/danger shape), so the spinner's arc
|
|
134
134
|
// matches the same accent the card's custom action button would use.
|
|
135
|
-
|
|
135
|
+
actionColor: 'neutral',
|
|
136
136
|
// `alert` interrupts a screen reader, so it is reserved for the
|
|
137
|
-
//
|
|
137
|
+
// statuses that warrant interrupting. This coupling is why the prop is
|
|
138
|
+
// `@status` and not `@color`.
|
|
138
139
|
role: 'status'
|
|
139
140
|
},
|
|
140
|
-
info
|
|
141
|
+
// Formerly `info`, which already painted `primary`'s classes. The info
|
|
142
|
+
// glyph stays attached to `primary`.
|
|
143
|
+
primary: {
|
|
141
144
|
icon: IconInfo,
|
|
142
|
-
|
|
145
|
+
actionColor: 'primary',
|
|
143
146
|
role: 'status'
|
|
144
147
|
},
|
|
145
148
|
success: {
|
|
146
149
|
icon: IconSuccess,
|
|
147
|
-
|
|
150
|
+
actionColor: 'success',
|
|
148
151
|
role: 'status'
|
|
149
152
|
},
|
|
150
153
|
warning: {
|
|
151
154
|
icon: IconWarning,
|
|
152
|
-
|
|
155
|
+
actionColor: 'warning',
|
|
153
156
|
role: 'alert'
|
|
154
157
|
},
|
|
155
158
|
danger: {
|
|
156
159
|
icon: IconDanger,
|
|
157
|
-
|
|
160
|
+
actionColor: 'danger',
|
|
158
161
|
role: 'alert'
|
|
159
162
|
}
|
|
160
163
|
};
|
|
@@ -176,17 +179,17 @@ class NotificationCard extends Component {
|
|
|
176
179
|
get isTopPlacement() {
|
|
177
180
|
return isTopPlacement(this.args.placement || 'bottom-right');
|
|
178
181
|
}
|
|
179
|
-
get
|
|
180
|
-
return this.args.notification.
|
|
182
|
+
get status() {
|
|
183
|
+
return this.args.notification.status;
|
|
181
184
|
}
|
|
182
185
|
get icon() {
|
|
183
|
-
return
|
|
186
|
+
return STATUS_CONFIG[this.status].icon;
|
|
184
187
|
}
|
|
185
|
-
get
|
|
186
|
-
return
|
|
188
|
+
get actionColor() {
|
|
189
|
+
return STATUS_CONFIG[this.status].actionColor;
|
|
187
190
|
}
|
|
188
191
|
get role() {
|
|
189
|
-
return
|
|
192
|
+
return STATUS_CONFIG[this.status].role;
|
|
190
193
|
}
|
|
191
194
|
get style() {
|
|
192
195
|
const {
|
|
@@ -292,8 +295,8 @@ class NotificationCard extends Component {
|
|
|
292
295
|
customActionButton,
|
|
293
296
|
closeButton
|
|
294
297
|
} = notificationCard({
|
|
295
|
-
|
|
296
|
-
variant: this.args.variant || '
|
|
298
|
+
status: this.status,
|
|
299
|
+
variant: this.args.variant || 'surface',
|
|
297
300
|
hasDescription: !!this.args.notification.description,
|
|
298
301
|
// Only pin the card to the placement edge once the container has
|
|
299
302
|
// supplied stack geometry — see the `stackPlacement` variant's
|
|
@@ -314,7 +317,7 @@ class NotificationCard extends Component {
|
|
|
314
317
|
};
|
|
315
318
|
}
|
|
316
319
|
static {
|
|
317
|
-
setComponentTemplate(precompileTemplate("{{!-- template-lint-disable no-inline-styles style-concatenation --}}\n<div data-component=\"notification-card\" data-part=\"base\" class={{this.classes.base}} style={{this.style}} role={{this.role}} data-test-notification-card data-test-
|
|
320
|
+
setComponentTemplate(precompileTemplate("{{!-- template-lint-disable no-inline-styles style-concatenation --}}\n<div data-component=\"notification-card\" data-part=\"base\" class={{this.classes.base}} style={{this.style}} role={{this.role}} data-test-notification-card data-test-status={{this.status}} {{this.enter}} ...attributes>\n {{!-- measure reads offsetHeight off this inner element, not the outer one above, since the outer carries the collapsed-stack height clamp. See notification-stack.ts. --}}\n <div data-part=\"inner\" class={{this.classes.inner}} {{this.measure}}>\n {{#unless @notification.hideIcon}}\n {{#if @notification.isLoading}}\n <Spinner data-part=\"spinner\" @class={{this.classes.spinner}} @color={{this.actionColor}} @size=\"sm\" data-test-icon=\"loading\" />\n {{else}}\n {{#let this.icon as |Icon|}}\n <Icon data-part=\"icon\" class={{this.classes.icon}} />\n {{/let}}\n {{/if}}\n {{/unless}}\n\n <div data-part=\"content\" class={{this.classes.content}}>\n <div data-part=\"title\" class={{this.classes.title}}>{{@notification.title}}</div>\n\n {{#if @notification.description}}\n <div data-part=\"description\" class={{this.classes.description}}>\n {{@notification.description}}\n </div>\n {{/if}}\n </div>\n\n {{#if @notification.customActions}}\n <div data-part=\"custom-actions\" class={{this.classes.customActions}}>\n {{#each @notification.customActions as |customAction index|}}\n <Button data-part=\"custom-action-button\" @size=\"xs\" @color={{if index \"neutral\" this.actionColor}} @variant={{if index \"plain\" \"solid\"}} @class={{this.classes.customActionButton}} @onPress={{fn this.handleClickCustomAction customAction}}>\n {{customAction.label}}\n </Button>\n {{/each}}\n </div>\n {{/if}}\n\n {{#if @notification.allowClosing}}\n <CloseButton data-part=\"close-button\" @onPress={{this.remove}} @size=\"sm\" @class={{this.classes.closeButton}} />\n {{/if}}\n </div>\n</div>", {
|
|
318
321
|
strictMode: true,
|
|
319
322
|
scope: () => ({
|
|
320
323
|
Spinner,
|
|
@@ -327,4 +330,4 @@ class NotificationCard extends Component {
|
|
|
327
330
|
}
|
|
328
331
|
|
|
329
332
|
export { NotificationCard as N, NotificationStack as a };
|
|
330
|
-
//# sourceMappingURL=notification-card-
|
|
333
|
+
//# sourceMappingURL=notification-card-dz-eE6z9.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notification-card-dz-eE6z9.js","sources":["../src/-private/notification-stack.ts","../src/components/notifications/notification-card.gts"],"sourcesContent":["import type { containerPlacement } from './types';\n\n/**\n * How much each card behind the front of the stack shrinks, as a fraction.\n */\nconst SCALE_STEP = 0.05;\n\n/**\n * Cards are pinned to the placement edge, so a top placement stacks\n * downwards and a bottom placement stacks upwards. Exported so\n * notification-card.gts's own enter/exit slide direction can share this\n * instead of re-deriving it from the placement string.\n */\nfunction isTopPlacement(placement: containerPlacement): boolean {\n return placement.startsWith('top');\n}\n\ninterface NotificationStackInput {\n /**\n * Measured card heights in px, ordered front-first (index 0 is the newest\n * notification). A card that has not been measured yet contributes 0.\n */\n heights: number[];\n\n isExpanded: boolean;\n\n /**\n * Peek offset between collapsed cards, and the gap between expanded cards.\n */\n gap: number;\n\n /**\n * How many cards stay visible while collapsed.\n */\n visibleToasts: number;\n\n placement: containerPlacement;\n}\n\ninterface CardGeometry {\n transform: string;\n zIndex: number;\n opacity: number;\n\n /**\n * Fixed height in px while collapsed, so a taller card behind the front one\n * cannot stick out past it. `null` means the card sizes to its content.\n */\n height: number | null;\n\n transformOrigin: 'top center' | 'bottom center';\n\n /**\n * `'none'` when the card is fully transparent (collapsed beyond\n * `visibleToasts`), so it cannot swallow clicks meant for the page beneath\n * it; `'auto'` otherwise.\n */\n pointerEvents: 'auto' | 'none';\n}\n\n/**\n * Pure geometry for the notification stack: given measured card heights and\n * the current expansion state, it produces the transform for each card and\n * the height the container should animate to.\n *\n * Deliberately free of Ember and DOM dependencies so the layout maths can be\n * tested on its own.\n */\nclass NotificationStack {\n readonly heights: number[];\n readonly isExpanded: boolean;\n readonly gap: number;\n readonly visibleToasts: number;\n readonly placement: containerPlacement;\n\n constructor(input: NotificationStackInput) {\n this.heights = input.heights;\n this.isExpanded = input.isExpanded;\n this.gap = input.gap;\n this.visibleToasts = input.visibleToasts;\n this.placement = input.placement;\n }\n\n get isTopPlacement(): boolean {\n return isTopPlacement(this.placement);\n }\n\n /**\n * Cards are pinned to the placement edge, so a top placement stacks\n * downwards and a bottom placement stacks upwards.\n */\n get directionSign(): number {\n return this.isTopPlacement ? 1 : -1;\n }\n\n get transformOrigin(): CardGeometry['transformOrigin'] {\n return this.isTopPlacement ? 'top center' : 'bottom center';\n }\n\n get count(): number {\n return this.heights.length;\n }\n\n get frontHeight(): number {\n return this.heights[0] ?? 0;\n }\n\n geometryFor(index: number): CardGeometry {\n const zIndex = this.count - index;\n\n if (this.isExpanded) {\n return {\n transform: `translateY(${this.directionSign * this.offsetBefore(index)}px) scale(1)`,\n zIndex,\n opacity: 1,\n height: null,\n transformOrigin: this.transformOrigin,\n pointerEvents: 'auto'\n };\n }\n\n const offset = index * this.gap;\n const scale = Math.max(0, 1 - index * SCALE_STEP);\n const isVisible = index < this.visibleToasts;\n\n return {\n transform: `translateY(${this.directionSign * offset}px) scale(${scale})`,\n zIndex,\n opacity: isVisible ? 1 : 0,\n // The front card must size to its own content (`null`). Clamping it to\n // `frontHeight` would be self-referential — `frontHeight` *is* the\n // front card's own measurement — and would permanently lock in\n // whatever height was measured first, before content (e.g. a long\n // description) finished laying out. Only cards behind the front one\n // need clamping, so a taller card further back can't poke out past it.\n height: index === 0 ? null : this.frontHeight,\n transformOrigin: this.transformOrigin,\n // A card past `visibleToasts` is fully transparent while collapsed;\n // without this it would still sit in the fixed-position stack and\n // swallow clicks meant for the page beneath it.\n pointerEvents: isVisible ? 'auto' : 'none'\n };\n }\n\n get containerHeight(): number {\n if (this.count === 0) {\n return 0;\n }\n\n if (this.isExpanded) {\n return this.offsetBefore(this.count) - this.gap;\n }\n\n const visible = Math.min(this.count, this.visibleToasts);\n return this.frontHeight + (visible - 1) * this.gap;\n }\n\n /**\n * Distance from the placement edge to the leading edge of `index`, i.e. the\n * summed heights and gaps of every card in front of it.\n */\n private offsetBefore(index: number): number {\n let offset = 0;\n\n for (let i = 0; i < index; i++) {\n offset += (this.heights[i] ?? 0) + this.gap;\n }\n\n return offset;\n }\n}\n\nexport { NotificationStack, isTopPlacement };\nexport type { NotificationStackInput, CardGeometry };\n","import Component from '@glimmer/component';\nimport { tracked } from '@glimmer/tracking';\nimport { modifier } from 'ember-modifier';\nimport { service } from '@ember/service';\nimport { htmlSafe } from '@ember/template';\nimport { fn } from '@ember/helper';\nimport { CloseButton } from '../buttons/close-button';\nimport { Button } from '../buttons/button';\nimport { Spinner } from '../utilities/spinner';\nimport {\n IconInfo,\n IconSuccess,\n IconWarning,\n IconDanger\n} from '../../-private/icons';\nimport { useStyles } from '@frontile/theme';\n\nimport type NotificationsService from '../../services/notifications';\nimport type Notification from '../../-private/notification';\nimport { isTopPlacement } from '../../-private/notification-stack';\nimport type { CardGeometry } from '../../-private/notification-stack';\nimport type {\n CustomAction,\n containerPlacement,\n NotificationStatus\n} from '../../-private/types';\nimport type { SafeString } from '@ember/template';\n\n/**\n * Everything that varies by `NotificationStatus`, keyed in one place so\n * adding a status means adding one row here instead of remembering to\n * touch an icon map, an action-colour map, and the `role` getter's cascade\n * separately.\n */\nconst STATUS_CONFIG = {\n neutral: {\n icon: IconInfo,\n // Button colour for the primary custom action. Also reused as the\n // loading <Spinner>'s `@color` (its colour union has the same\n // neutral/primary/success/warning/danger shape), so the spinner's arc\n // matches the same accent the card's custom action button would use.\n actionColor: 'neutral',\n // `alert` interrupts a screen reader, so it is reserved for the\n // statuses that warrant interrupting. This coupling is why the prop is\n // `@status` and not `@color`.\n role: 'status'\n },\n // Formerly `info`, which already painted `primary`'s classes. The info\n // glyph stays attached to `primary`.\n primary: {\n icon: IconInfo,\n actionColor: 'primary',\n role: 'status'\n },\n success: {\n icon: IconSuccess,\n actionColor: 'success',\n role: 'status'\n },\n warning: {\n icon: IconWarning,\n actionColor: 'warning',\n role: 'alert'\n },\n danger: {\n icon: IconDanger,\n actionColor: 'danger',\n role: 'alert'\n }\n} as const satisfies Record<\n NotificationStatus,\n {\n icon: unknown;\n actionColor: 'neutral' | 'primary' | 'success' | 'warning' | 'danger';\n role: 'status' | 'alert';\n }\n>;\n\ninterface NotificationCardSignature {\n Args: {\n notification: Notification<Record<string, unknown>>;\n placement: containerPlacement;\n\n /**\n * The visual style of the card.\n *\n * @defaultValue 'surface'\n */\n variant?: 'surface' | 'soft' | 'solid';\n\n /**\n * Position, scale, and stacking supplied by the container. When omitted\n * the card renders in place with no stack transform.\n *\n * Part of the container/card plumbing, not a consumer-facing argument.\n *\n * @internal\n */\n geometry?: CardGeometry;\n\n /**\n * Called with the card's measured height whenever it changes.\n *\n * Part of the container/card plumbing, not a consumer-facing argument.\n *\n * @internal\n */\n onMeasure?: (height: number) => void;\n };\n Element: HTMLDivElement;\n}\n\nclass NotificationCard extends Component<NotificationCardSignature> {\n @service notifications!: NotificationsService;\n\n /**\n * False for the first frame so the card can transition in from the\n * placement edge rather than appearing at its resting position.\n */\n @tracked hasEntered = false;\n\n get isTopPlacement(): boolean {\n return isTopPlacement(this.args.placement || 'bottom-right');\n }\n\n get status(): NotificationStatus {\n return this.args.notification.status;\n }\n\n get icon() {\n return STATUS_CONFIG[this.status].icon;\n }\n\n get actionColor() {\n return STATUS_CONFIG[this.status].actionColor;\n }\n\n get role(): 'status' | 'alert' {\n return STATUS_CONFIG[this.status].role;\n }\n\n get style(): SafeString {\n const { geometry, notification } = this.args;\n // The theme owns the whole `transition-duration` shorthand (and its\n // `motion-reduce:` override) so the per-property duration order can\n // never drift out of sync with `transition-[transform,opacity,height]`\n // across the component boundary — see notification-card.ts. This card\n // only supplies the one value `@transitionDuration` actually governs\n // (the enter/exit fade), as a custom property the theme's `var()` reads.\n const declarations = [\n `--frontile-toast-fade: ${notification.transitionDuration}ms`\n ];\n\n // The static edge-pinning (`position: absolute` + `left/right/top` or\n // `bottom`) lives in the `stackPlacement` theme variant (see\n // `this.classes`) rather than here, since it never varies frame to\n // frame — only the geometry-driven parts below (transform, opacity,\n // height, z-index, transform-origin) need to be inline, because a\n // `style` attribute passed through `...attributes` replaces the\n // element's own `style` outright and would drop them.\n\n if (!this.hasEntered || notification.isRemoving) {\n // Enter from, and exit to, the placement edge.\n const offset = this.isTopPlacement ? '-100%' : '100%';\n declarations.push(\n `opacity: 0`,\n `transform: translateY(${offset}) scale(0.95)`,\n // A card can be transparent-and-collapsed the instant it starts\n // exiting; keep it out of the click path either way.\n `pointer-events: none`\n );\n\n if (geometry) {\n declarations.push(\n `z-index: ${geometry.zIndex}`,\n `transform-origin: ${geometry.transformOrigin}`,\n // Preserve the collapsed height clamp through the exit\n // transition — otherwise a non-front collapsed card snaps from\n // its clamped height to `auto` for the slide-out.\n geometry.height === null\n ? `height: auto`\n : `height: ${geometry.height}px`\n );\n }\n\n return htmlSafe(declarations.join('; '));\n }\n\n if (geometry) {\n declarations.push(\n `transform: ${geometry.transform}`,\n `transform-origin: ${geometry.transformOrigin}`,\n `z-index: ${geometry.zIndex}`,\n `opacity: ${geometry.opacity}`,\n `pointer-events: ${geometry.pointerEvents}`,\n geometry.height === null\n ? `height: auto`\n : `height: ${geometry.height}px`\n );\n }\n\n return htmlSafe(declarations.join('; '));\n }\n\n /**\n * Flip to the resting position on the frame after insertion, so the browser\n * has a start value to transition from.\n */\n enter = modifier(() => {\n const frame = requestAnimationFrame(() => {\n this.hasEntered = true;\n });\n\n return () => cancelAnimationFrame(frame);\n });\n\n /**\n * Report the card's height to the container so the stack can lay itself\n * out. Also fires when promise content swaps change the height.\n *\n * `element` is the inner element (never height-constrained, so its\n * `offsetHeight` is always the content's true natural height). The border\n * lives on the outer element (`element.parentElement`), so it isn't part\n * of that number — we add it back via `outer.offsetHeight -\n * outer.clientHeight`, the outer element's vertical border width. That\n * difference is constant whether or not the outer element's height is\n * currently clamped by the collapsed-stack height, so it's safe to read\n * off the outer element even while it's clamped, and it stays correct if\n * the theme's border width ever changes.\n */\n measure = modifier((element: HTMLElement) => {\n const { onMeasure } = this.args;\n\n if (!onMeasure) {\n return;\n }\n\n const outer = element.parentElement as HTMLElement;\n\n const report = () => {\n const outerBorder = outer.offsetHeight - outer.clientHeight;\n onMeasure(element.offsetHeight + outerBorder);\n };\n\n const observer = new ResizeObserver(report);\n\n report();\n observer.observe(element);\n\n return () => observer.disconnect();\n });\n\n remove = () => {\n this.notifications.remove(this.args.notification);\n };\n\n handleClickCustomAction = (customAction: CustomAction) => {\n customAction.onClick();\n this.notifications.remove(this.args.notification);\n };\n\n get classes() {\n const { notificationCard } = useStyles();\n\n const {\n base,\n inner,\n icon,\n spinner,\n content,\n title,\n description,\n customActions,\n customActionButton,\n closeButton\n } = notificationCard({\n status: this.status,\n variant: this.args.variant || 'surface',\n hasDescription: !!this.args.notification.description,\n // Only pin the card to the placement edge once the container has\n // supplied stack geometry — see the `stackPlacement` variant's\n // comment in the theme.\n stackPlacement: this.args.geometry\n ? this.isTopPlacement\n ? 'top'\n : 'bottom'\n : 'none'\n });\n\n return {\n base: base(),\n inner: inner(),\n icon: icon(),\n spinner: spinner(),\n content: content(),\n title: title(),\n description: description(),\n customActions: customActions(),\n customActionButton: customActionButton(),\n closeButton: closeButton()\n };\n }\n\n <template>\n {{! template-lint-disable no-inline-styles style-concatenation }}\n <div\n data-component=\"notification-card\"\n data-part=\"base\"\n class={{this.classes.base}}\n style={{this.style}}\n role={{this.role}}\n data-test-notification-card\n data-test-status={{this.status}}\n {{this.enter}}\n ...attributes\n >\n {{! measure reads offsetHeight off this inner element, not the outer one above, since the outer carries the collapsed-stack height clamp. See notification-stack.ts. }}\n <div data-part=\"inner\" class={{this.classes.inner}} {{this.measure}}>\n {{#unless @notification.hideIcon}}\n {{#if @notification.isLoading}}\n <Spinner\n data-part=\"spinner\"\n @class={{this.classes.spinner}}\n @color={{this.actionColor}}\n @size=\"sm\"\n data-test-icon=\"loading\"\n />\n {{else}}\n {{#let this.icon as |Icon|}}\n <Icon data-part=\"icon\" class={{this.classes.icon}} />\n {{/let}}\n {{/if}}\n {{/unless}}\n\n <div data-part=\"content\" class={{this.classes.content}}>\n <div\n data-part=\"title\"\n class={{this.classes.title}}\n >{{@notification.title}}</div>\n\n {{#if @notification.description}}\n <div data-part=\"description\" class={{this.classes.description}}>\n {{@notification.description}}\n </div>\n {{/if}}\n </div>\n\n {{#if @notification.customActions}}\n <div data-part=\"custom-actions\" class={{this.classes.customActions}}>\n {{#each @notification.customActions as |customAction index|}}\n <Button\n data-part=\"custom-action-button\"\n @size=\"xs\"\n @color={{if index \"neutral\" this.actionColor}}\n @variant={{if index \"plain\" \"solid\"}}\n @class={{this.classes.customActionButton}}\n @onPress={{fn this.handleClickCustomAction customAction}}\n >\n {{customAction.label}}\n </Button>\n {{/each}}\n </div>\n {{/if}}\n\n {{#if @notification.allowClosing}}\n <CloseButton\n data-part=\"close-button\"\n @onPress={{this.remove}}\n @size=\"sm\"\n @class={{this.classes.closeButton}}\n />\n {{/if}}\n </div>\n </div>\n </template>\n}\n\nexport { NotificationCard, type NotificationCardSignature };\nexport default NotificationCard;\n"],"names":["SCALE_STEP","isTopPlacement","placement","startsWith","NotificationStack","heights","isExpanded","gap","visibleToasts","constructor","input","directionSign","transformOrigin","count","length","frontHeight","geometryFor","index","zIndex","transform","offsetBefore","opacity","height","pointerEvents","offset","scale","Math","max","isVisible","containerHeight","visible","min","i","STATUS_CONFIG","neutral","icon","IconInfo","actionColor","role","primary","success","IconSuccess","warning","IconWarning","danger","IconDanger","NotificationCard","Component","g","prototype","service","tracked","args","status","notification","style","geometry","declarations","transitionDuration","hasEntered","isRemoving","push","htmlSafe","join","enter","modifier","frame","requestAnimationFrame","cancelAnimationFrame","measure","element","onMeasure","outer","parentElement","report","outerBorder","offsetHeight","clientHeight","observer","ResizeObserver","observe","disconnect","remove","notifications","handleClickCustomAction","customAction","onClick","classes","notificationCard","useStyles","base","inner","spinner","content","title","description","customActions","customActionButton","closeButton","variant","hasDescription","stackPlacement","setComponentTemplate","precompileTemplate","strictMode","scope","Spinner","Button","fn","CloseButton"],"mappings":";;;;;;;;;;;;;;;AAEA;AACA;AACA;AACA,MAAMA,UAAU,GAAG,IAAI;;AAEvB;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,cAAcA,CAACC,SAA6B,EAAW;AAC9D,EAAA,OAAOA,SAAS,CAACC,UAAU,CAAC,KAAK,CAAC;AACpC;AA6CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,iBAAiB,CAAC;EACbC,OAAO;EACPC,UAAU;EACVC,GAAG;EACHC,aAAa;EACbN,SAAS;EAElBO,WAAWA,CAACC,KAA6B,EAAE;AACzC,IAAA,IAAI,CAACL,OAAO,GAAGK,KAAK,CAACL,OAAO;AAC5B,IAAA,IAAI,CAACC,UAAU,GAAGI,KAAK,CAACJ,UAAU;AAClC,IAAA,IAAI,CAACC,GAAG,GAAGG,KAAK,CAACH,GAAG;AACpB,IAAA,IAAI,CAACC,aAAa,GAAGE,KAAK,CAACF,aAAa;AACxC,IAAA,IAAI,CAACN,SAAS,GAAGQ,KAAK,CAACR,SAAS;AAClC,EAAA;EAEA,IAAID,cAAcA,GAAY;AAC5B,IAAA,OAAOA,cAAc,CAAC,IAAI,CAACC,SAAS,CAAC;AACvC,EAAA;;AAEA;AACF;AACA;AACA;EACE,IAAIS,aAAaA,GAAW;AAC1B,IAAA,OAAO,IAAI,CAACV,cAAc,GAAG,CAAC,GAAG,EAAE;AACrC,EAAA;EAEA,IAAIW,eAAeA,GAAoC;AACrD,IAAA,OAAO,IAAI,CAACX,cAAc,GAAG,YAAY,GAAG,eAAe;AAC7D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AA,OAAA;QAAAC,OAAA;QAAAC,MAAA;QAAAC,EAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;"}
|
package/dist/notifications.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { N as Notification, T as Timer } from './manager-
|
|
1
|
+
export { N as Notification, T as Timer } from './manager-jDaRVZ5o.js';
|
|
2
2
|
import '@ember/service';
|
|
3
|
-
export { N as NotificationCard, a as NotificationStack } from './notification-card-
|
|
3
|
+
export { N as NotificationCard, a as NotificationStack } from './notification-card-dz-eE6z9.js';
|
|
4
4
|
export { NotificationsContainer } from './components/notifications/notifications-container.js';
|
|
5
5
|
//# sourceMappingURL=notifications.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime--fcdnjmJ-BOdRhmsS.js","sources":["../../../node_modules/.pnpm/decorator-transforms@2.4.0_@babel+core@7.
|
|
1
|
+
{"version":3,"file":"runtime--fcdnjmJ-BOdRhmsS.js","sources":["../../../node_modules/.pnpm/decorator-transforms@2.4.0_@babel+core@7.29.7/node_modules/decorator-transforms/dist/runtime--fcdnjmJ.js"],"sourcesContent":["const deferred = /* @__PURE__ */ new WeakMap();\nfunction deferDecorator(proto, prop, desc) {\n let map = deferred.get(proto);\n if (!map) {\n map = /* @__PURE__ */ new Map();\n deferred.set(proto, map);\n }\n map.set(prop, desc);\n}\nfunction findDeferredDecorator(target, prop) {\n var _a;\n let cursor = target.prototype;\n while (cursor) {\n let desc = (_a = deferred.get(cursor)) == null ? void 0 : _a.get(prop);\n if (desc) {\n return desc;\n }\n cursor = Object.getPrototypeOf(cursor);\n }\n}\nfunction decorateFieldV1(target, prop, decorators, initializer) {\n return decorateFieldV2(target.prototype, prop, decorators, initializer);\n}\nfunction decorateFieldV2(prototype, prop, decorators, initializer) {\n let desc = {\n configurable: true,\n enumerable: true,\n writable: true,\n initializer: null\n };\n if (initializer) {\n desc.initializer = initializer;\n }\n for (let decorator of decorators) {\n desc = decorator(prototype, prop, desc) || desc;\n }\n if (desc.initializer === void 0) {\n Object.defineProperty(prototype, prop, desc);\n } else {\n deferDecorator(prototype, prop, desc);\n }\n}\nfunction decorateMethodV1({ prototype }, prop, decorators) {\n return decorateMethodV2(prototype, prop, decorators);\n}\nfunction decorateMethodV2(prototype, prop, decorators) {\n const origDesc = Object.getOwnPropertyDescriptor(prototype, prop);\n let desc = { ...origDesc };\n for (let decorator of decorators) {\n desc = decorator(prototype, prop, desc) || desc;\n }\n if (desc.initializer !== void 0) {\n desc.value = desc.initializer ? desc.initializer.call(prototype) : void 0;\n desc.initializer = void 0;\n }\n Object.defineProperty(prototype, prop, desc);\n}\nfunction initializeDeferredDecorator(target, prop) {\n let desc = findDeferredDecorator(target.constructor, prop);\n if (desc) {\n Object.defineProperty(target, prop, {\n enumerable: desc.enumerable,\n configurable: desc.configurable,\n writable: desc.writable,\n value: desc.initializer ? desc.initializer.call(target) : void 0\n });\n }\n}\nfunction decorateClass(target, decorators) {\n return decorators.reduce(\n (accum, decorator) => decorator(accum) || accum,\n target\n );\n}\nfunction decoratePOJO(pojo, decorated) {\n for (let [type, prop, decorators] of decorated) {\n if (type === \"field\") {\n decoratePojoField(pojo, prop, decorators);\n } else {\n decorateMethodV2(pojo, prop, decorators);\n }\n }\n return pojo;\n}\nfunction decoratePojoField(pojo, prop, decorators) {\n let desc = {\n configurable: true,\n enumerable: true,\n writable: true,\n initializer: () => {\n var _a;\n return (_a = Object.getOwnPropertyDescriptor(pojo, prop)) == null ? void 0 : _a.value;\n }\n };\n for (let decorator of decorators) {\n desc = decorator(pojo, prop, desc) || desc;\n }\n if (desc.initializer) {\n desc.value = desc.initializer.call(pojo);\n delete desc.initializer;\n }\n Object.defineProperty(pojo, prop, desc);\n}\nconst runtime = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({\n __proto__: null,\n c: decorateClass,\n f: decorateFieldV1,\n g: decorateFieldV2,\n i: initializeDeferredDecorator,\n m: decorateMethodV1,\n n: decorateMethodV2,\n p: decoratePOJO\n}, Symbol.toStringTag, { value: \"Module\" }));\nexport {\n decorateFieldV1 as a,\n decorateFieldV2 as b,\n decorateMethodV1 as c,\n decorateClass as d,\n decorateMethodV2 as e,\n decoratePOJO as f,\n initializeDeferredDecorator as i,\n runtime as r\n};\n//# sourceMappingURL=runtime--fcdnjmJ.js.map\n"],"names":["deferred","WeakMap","deferDecorator","proto","prop","desc","map","get","Map","set","findDeferredDecorator","target","_a","cursor","prototype","Object","getPrototypeOf","decorateFieldV2","decorators","initializer","configurable","enumerable","writable","decorator","defineProperty","decorateMethodV2","origDesc","getOwnPropertyDescriptor","value","call","initializeDeferredDecorator","constructor"],"mappings":"AAuBA,MAAMA,QAAA,sBAGEC,OAAA,EAAA;AAER,SAASC,eACPC,KAAA,EACAC,IAAA,EACAC,IAAA,EACM;AACN,EAAA,IAAIC,GAAA,GAAMN,QAAA,CAASO,GAAA,CAAIJ,KAAK,CAAA;EAC5B,IAAI,CAACG,GAAA,EAAK;AACRA,IAAAA,GAAA,sBAAUE,GAAA,EAAA;AACVR,IAAAA,QAAA,CAASS,GAAA,CAAIN,KAAA,EAAOG,GAAG,CAAA;AACzB,EAAA;AACAA,EAAAA,GAAA,CAAIG,GAAA,CAAIL,IAAA,EAAMC,IAAI,CAAA;AACpB;AAEA,SAASK,qBAAAA,CACPC,MAAA,EACAP,IAAA,EACwB;AArB1B,EAAA,IAAAQ,EAAA;AAsBE,EAAA,IAAIC,MAAA,GAAkBF,MAAA,CAAeG,SAAA;AACrC,EAAA,OAAOD,MAAA,EAAQ;AACb,IAAA,IAAIR,IAAA,GAAA,CAAOO,EAAA,GAAAZ,QAAA,CAASO,GAAA,CAAIM,MAAM,MAAnB,IAAA,GAAA,MAAA,GAAAD,EAAA,CAAsBL,GAAA,CAAIH,IAAA,CAAA;AACrC,IAAA,IAAIC,IAAA,EAAM;AACR,MAAA,OAAOA,IAAA;AACT,IAAA;AACAQ,IAA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