@funstack/ui 0.1.0-alpha.11 → 0.1.0-alpha.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/accordion/accordion-context.mjs.map +1 -1
- package/dist/accordion/accordion-item.d.mts +3 -4
- package/dist/accordion/accordion-item.d.mts.map +1 -1
- package/dist/accordion/accordion-item.mjs +10 -4
- package/dist/accordion/accordion-item.mjs.map +1 -1
- package/dist/accordion/accordion-panel.d.mts +3 -4
- package/dist/accordion/accordion-panel.d.mts.map +1 -1
- package/dist/accordion/accordion-panel.mjs +2 -1
- package/dist/accordion/accordion-panel.mjs.map +1 -1
- package/dist/accordion/accordion-root.d.mts +3 -3
- package/dist/accordion/accordion-root.d.mts.map +1 -1
- package/dist/accordion/accordion-root.mjs +8 -19
- package/dist/accordion/accordion-root.mjs.map +1 -1
- package/dist/accordion/accordion-trigger.d.mts +3 -4
- package/dist/accordion/accordion-trigger.d.mts.map +1 -1
- package/dist/accordion/accordion-trigger.mjs +5 -3
- package/dist/accordion/accordion-trigger.mjs.map +1 -1
- package/dist/button/button.d.mts +4 -2
- package/dist/button/button.d.mts.map +1 -1
- package/dist/button/button.mjs +3 -2
- package/dist/button/button.mjs.map +1 -1
- package/dist/checkbox/checkbox.d.mts +4 -5
- package/dist/checkbox/checkbox.d.mts.map +1 -1
- package/dist/checkbox/checkbox.mjs +16 -59
- package/dist/checkbox/checkbox.mjs.map +1 -1
- package/dist/checkbox-group/checkbox-group-context.mjs.map +1 -1
- package/dist/checkbox-group/checkbox-group-item.d.mts +3 -4
- package/dist/checkbox-group/checkbox-group-item.d.mts.map +1 -1
- package/dist/checkbox-group/checkbox-group-item.mjs +21 -27
- package/dist/checkbox-group/checkbox-group-item.mjs.map +1 -1
- package/dist/checkbox-group/checkbox-group-label.mjs +1 -6
- package/dist/checkbox-group/checkbox-group-label.mjs.map +1 -1
- package/dist/checkbox-group/checkbox-group-parent.d.mts +3 -4
- package/dist/checkbox-group/checkbox-group-parent.d.mts.map +1 -1
- package/dist/checkbox-group/checkbox-group-parent.mjs +12 -10
- package/dist/checkbox-group/checkbox-group-parent.mjs.map +1 -1
- package/dist/checkbox-group/checkbox-group-root.d.mts +1 -1
- package/dist/checkbox-group/checkbox-group-root.d.mts.map +1 -1
- package/dist/checkbox-group/checkbox-group-root.mjs +74 -101
- package/dist/checkbox-group/checkbox-group-root.mjs.map +1 -1
- package/dist/combobox/combobox-clear.d.mts.map +1 -1
- package/dist/combobox/combobox-clear.mjs +5 -6
- package/dist/combobox/combobox-clear.mjs.map +1 -1
- package/dist/combobox/combobox-context.mjs.map +1 -1
- package/dist/combobox/combobox-group.d.mts.map +1 -1
- package/dist/combobox/combobox-group.mjs +2 -1
- package/dist/combobox/combobox-group.mjs.map +1 -1
- package/dist/combobox/combobox-input.d.mts +6 -5
- package/dist/combobox/combobox-input.d.mts.map +1 -1
- package/dist/combobox/combobox-input.mjs +29 -14
- package/dist/combobox/combobox-input.mjs.map +1 -1
- package/dist/combobox/combobox-list.d.mts.map +1 -1
- package/dist/combobox/combobox-list.mjs +6 -10
- package/dist/combobox/combobox-list.mjs.map +1 -1
- package/dist/combobox/combobox-option.d.mts.map +1 -1
- package/dist/combobox/combobox-option.mjs +2 -1
- package/dist/combobox/combobox-option.mjs.map +1 -1
- package/dist/combobox/combobox-popup.d.mts.map +1 -1
- package/dist/combobox/combobox-popup.mjs +9 -25
- package/dist/combobox/combobox-popup.mjs.map +1 -1
- package/dist/combobox/combobox-root.d.mts.map +1 -1
- package/dist/combobox/combobox-root.mjs +101 -106
- package/dist/combobox/combobox-root.mjs.map +1 -1
- package/dist/combobox/combobox-trigger.d.mts +9 -6
- package/dist/combobox/combobox-trigger.d.mts.map +1 -1
- package/dist/combobox/combobox-trigger.mjs +36 -43
- package/dist/combobox/combobox-trigger.mjs.map +1 -1
- package/dist/combobox/index.mjs +1 -1
- package/dist/combobox/use-combobox-form.mjs +56 -0
- package/dist/combobox/use-combobox-form.mjs.map +1 -0
- package/dist/combobox/use-option-registry.mjs +62 -0
- package/dist/combobox/use-option-registry.mjs.map +1 -0
- package/dist/dialog/dialog-close.d.mts.map +1 -1
- package/dist/dialog/dialog-close.mjs +29 -62
- package/dist/dialog/dialog-close.mjs.map +1 -1
- package/dist/dialog/dialog-context.mjs.map +1 -1
- package/dist/dialog/dialog-form.d.mts.map +1 -1
- package/dist/dialog/dialog-form.mjs +5 -4
- package/dist/dialog/dialog-form.mjs.map +1 -1
- package/dist/dialog/dialog-popup.d.mts +5 -5
- package/dist/dialog/dialog-popup.d.mts.map +1 -1
- package/dist/dialog/dialog-popup.mjs +39 -103
- package/dist/dialog/dialog-popup.mjs.map +1 -1
- package/dist/dialog/dialog-root.d.mts.map +1 -1
- package/dist/dialog/dialog-root.mjs +30 -118
- package/dist/dialog/dialog-root.mjs.map +1 -1
- package/dist/dialog/dialog-trigger.d.mts +2 -1
- package/dist/dialog/dialog-trigger.d.mts.map +1 -1
- package/dist/dialog/dialog-trigger.mjs +27 -23
- package/dist/dialog/dialog-trigger.mjs.map +1 -1
- package/dist/field/field-control.mjs +6 -13
- package/dist/field/field-control.mjs.map +1 -1
- package/dist/field/field-description.d.mts.map +1 -1
- package/dist/field/field-description.mjs +1 -2
- package/dist/field/field-description.mjs.map +1 -1
- package/dist/field/field-error.d.mts.map +1 -1
- package/dist/field/field-error.mjs +1 -2
- package/dist/field/field-error.mjs.map +1 -1
- package/dist/field/field-label.d.mts.map +1 -1
- package/dist/field/field-label.mjs +3 -11
- package/dist/field/field-label.mjs.map +1 -1
- package/dist/field/field-root.mjs +22 -42
- package/dist/field/field-root.mjs.map +1 -1
- package/dist/field/index.mjs +1 -1
- package/dist/field/use-server-error-visibility.mjs +44 -0
- package/dist/field/use-server-error-visibility.mjs.map +1 -0
- package/dist/form/form-root.d.mts.map +1 -1
- package/dist/form/form-root.mjs +6 -7
- package/dist/form/form-root.mjs.map +1 -1
- package/dist/form/form-submit.d.mts +1 -1
- package/dist/form/form-submit.mjs +4 -10
- package/dist/form/form-submit.mjs.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/internal/anchor-position.mjs +1 -59
- package/dist/internal/anchor-position.mjs.map +1 -1
- package/dist/internal/announce.mjs +4 -42
- package/dist/internal/announce.mjs.map +1 -1
- package/dist/internal/arrow-keys.mjs +21 -0
- package/dist/internal/arrow-keys.mjs.map +1 -0
- package/dist/internal/decimal.mjs +7 -1
- package/dist/internal/decimal.mjs.map +1 -1
- package/dist/internal/dom-order.mjs +17 -0
- package/dist/internal/dom-order.mjs.map +1 -0
- package/dist/internal/field-context.d.mts.map +1 -1
- package/dist/internal/field-context.mjs +11 -1
- package/dist/internal/field-context.mjs.map +1 -1
- package/dist/internal/focus-first-invalid.mjs +16 -7
- package/dist/internal/focus-first-invalid.mjs.map +1 -1
- package/dist/internal/group-member.mjs +37 -0
- package/dist/internal/group-member.mjs.map +1 -0
- package/dist/internal/overlay-popup.mjs +103 -0
- package/dist/internal/overlay-popup.mjs.map +1 -0
- package/dist/internal/pointer-capture.mjs +20 -0
- package/dist/internal/pointer-capture.mjs.map +1 -0
- package/dist/internal/popover-open.mjs +18 -0
- package/dist/internal/popover-open.mjs.map +1 -0
- package/dist/internal/render-element.d.mts +2 -0
- package/dist/internal/render-element.mjs +20 -2
- package/dist/internal/render-element.mjs.map +1 -1
- package/dist/internal/shipped-styles.mjs +14 -0
- package/dist/internal/shipped-styles.mjs.map +1 -0
- package/dist/internal/sync-presence.mjs +5 -1
- package/dist/internal/sync-presence.mjs.map +1 -1
- package/dist/internal/toolbar-context.mjs.map +1 -1
- package/dist/internal/tooltip-warm.mjs +1 -1
- package/dist/internal/tooltip-warm.mjs.map +1 -1
- package/dist/internal/transition-boundary.mjs +1 -1
- package/dist/internal/transition-boundary.mjs.map +1 -1
- package/dist/internal/trigger-ref.mjs +26 -0
- package/dist/internal/trigger-ref.mjs.map +1 -0
- package/dist/internal/types.d.mts +2 -0
- package/dist/internal/types.d.mts.map +1 -1
- package/dist/internal/use-action-trigger.mjs +5 -23
- package/dist/internal/use-action-trigger.mjs.map +1 -1
- package/dist/internal/use-checkable-input.mjs +79 -0
- package/dist/internal/use-checkable-input.mjs.map +1 -0
- package/dist/internal/use-controllable-action.mjs +16 -24
- package/dist/internal/use-controllable-action.mjs.map +1 -1
- package/dist/internal/use-dev-warning.mjs +8 -4
- package/dist/internal/use-dev-warning.mjs.map +1 -1
- package/dist/internal/use-element-check.mjs +39 -0
- package/dist/internal/use-element-check.mjs.map +1 -0
- package/dist/internal/use-exit-animation.mjs +1 -1
- package/dist/internal/use-exit-animation.mjs.map +1 -1
- package/dist/internal/use-field-control.mjs +28 -12
- package/dist/internal/use-field-control.mjs.map +1 -1
- package/dist/internal/use-fieldset-group.mjs +46 -0
- package/dist/internal/use-fieldset-group.mjs.map +1 -0
- package/dist/internal/use-form-reset.mjs +1 -5
- package/dist/internal/use-form-reset.mjs.map +1 -1
- package/dist/internal/use-item-order.mjs +42 -0
- package/dist/internal/use-item-order.mjs.map +1 -0
- package/dist/internal/use-latest.mjs +4 -8
- package/dist/internal/use-latest.mjs.map +1 -1
- package/dist/internal/use-merged-refs.mjs +19 -0
- package/dist/internal/use-merged-refs.mjs.map +1 -0
- package/dist/internal/use-name-warning.mjs +84 -0
- package/dist/internal/use-name-warning.mjs.map +1 -0
- package/dist/internal/use-native-checked.mjs +4 -6
- package/dist/internal/use-native-checked.mjs.map +1 -1
- package/dist/internal/use-native-focusgroup.mjs +19 -0
- package/dist/internal/use-native-focusgroup.mjs.map +1 -0
- package/dist/internal/use-native-group-reconciliation.mjs.map +1 -1
- package/dist/internal/use-overlay-close.mjs +63 -0
- package/dist/internal/use-overlay-close.mjs.map +1 -0
- package/dist/internal/{use-popover-root.mjs → use-overlay-root.mjs} +32 -39
- package/dist/internal/use-overlay-root.mjs.map +1 -0
- package/dist/internal/use-popover-popup.mjs +38 -80
- package/dist/internal/use-popover-popup.mjs.map +1 -1
- package/dist/internal/use-popover-trigger.d.mts +15 -0
- package/dist/internal/use-popover-trigger.d.mts.map +1 -0
- package/dist/internal/use-popover-trigger.mjs +28 -24
- package/dist/internal/use-popover-trigger.mjs.map +1 -1
- package/dist/internal/use-register-count.mjs +24 -0
- package/dist/internal/use-register-count.mjs.map +1 -0
- package/dist/internal/use-render.d.mts +2 -0
- package/dist/internal/use-render.mjs +2 -2
- package/dist/internal/use-render.mjs.map +1 -1
- package/dist/internal/use-resolved-placement.mjs +38 -22
- package/dist/internal/use-resolved-placement.mjs.map +1 -1
- package/dist/internal/use-roving-focus.mjs +5 -18
- package/dist/internal/use-roving-focus.mjs.map +1 -1
- package/dist/internal/use-superseded-rejection.mjs +47 -0
- package/dist/internal/use-superseded-rejection.mjs.map +1 -0
- package/dist/internal/validity.mjs +1 -13
- package/dist/internal/validity.mjs.map +1 -1
- package/dist/internal/value-set.mjs +41 -0
- package/dist/internal/value-set.mjs.map +1 -0
- package/dist/menu/index.d.mts +1 -1
- package/dist/menu/menu-checkbox-item.mjs.map +1 -1
- package/dist/menu/menu-context-trigger.d.mts +2 -7
- package/dist/menu/menu-context-trigger.d.mts.map +1 -1
- package/dist/menu/menu-context-trigger.mjs +11 -187
- package/dist/menu/menu-context-trigger.mjs.map +1 -1
- package/dist/menu/menu-context.d.mts +1 -1
- package/dist/menu/menu-context.mjs +1 -1
- package/dist/menu/menu-context.mjs.map +1 -1
- package/dist/menu/menu-dom.mjs +2 -17
- package/dist/menu/menu-dom.mjs.map +1 -1
- package/dist/menu/menu-gestures.mjs +166 -0
- package/dist/menu/menu-gestures.mjs.map +1 -0
- package/dist/menu/menu-group.d.mts.map +1 -1
- package/dist/menu/menu-group.mjs +2 -1
- package/dist/menu/menu-group.mjs.map +1 -1
- package/dist/menu/menu-hover.mjs +0 -1
- package/dist/menu/menu-hover.mjs.map +1 -1
- package/dist/menu/menu-item.mjs.map +1 -1
- package/dist/menu/menu-outside.mjs +101 -0
- package/dist/menu/menu-outside.mjs.map +1 -0
- package/dist/menu/menu-point.mjs +85 -0
- package/dist/menu/menu-point.mjs.map +1 -0
- package/dist/menu/menu-popup.d.mts +6 -7
- package/dist/menu/menu-popup.d.mts.map +1 -1
- package/dist/menu/menu-popup.mjs +38 -248
- package/dist/menu/menu-popup.mjs.map +1 -1
- package/dist/menu/menu-radio-group.mjs.map +1 -1
- package/dist/menu/menu-radio-item.d.mts +2 -0
- package/dist/menu/menu-radio-item.d.mts.map +1 -1
- package/dist/menu/menu-radio-item.mjs +1 -0
- package/dist/menu/menu-radio-item.mjs.map +1 -1
- package/dist/menu/menu-root.d.mts +10 -0
- package/dist/menu/menu-root.d.mts.map +1 -1
- package/dist/menu/menu-root.mjs +10 -8
- package/dist/menu/menu-root.mjs.map +1 -1
- package/dist/menu/menu-submenu-trigger.d.mts.map +1 -1
- package/dist/menu/menu-submenu-trigger.mjs +12 -9
- package/dist/menu/menu-submenu-trigger.mjs.map +1 -1
- package/dist/menu/menu-trigger.d.mts +10 -11
- package/dist/menu/menu-trigger.d.mts.map +1 -1
- package/dist/menu/menu-trigger.mjs +14 -7
- package/dist/menu/menu-trigger.mjs.map +1 -1
- package/dist/menu/use-menu-item.mjs +14 -16
- package/dist/menu/use-menu-item.mjs.map +1 -1
- package/dist/menu/use-menu-keyboard.mjs +88 -0
- package/dist/menu/use-menu-keyboard.mjs.map +1 -0
- package/dist/meter/meter-root.mjs +1 -1
- package/dist/number-field/index.d.mts +2 -1
- package/dist/number-field/index.d.mts.map +1 -1
- package/dist/number-field/index.mjs +2 -2
- package/dist/number-field/index.mjs.map +1 -1
- package/dist/number-field/number-field-arithmetic.mjs +30 -11
- package/dist/number-field/number-field-arithmetic.mjs.map +1 -1
- package/dist/number-field/number-field-context.d.mts +6 -1
- package/dist/number-field/number-field-context.d.mts.map +1 -0
- package/dist/number-field/number-field-context.mjs.map +1 -1
- package/dist/number-field/number-field-decrement.d.mts +1 -1
- package/dist/number-field/number-field-decrement.mjs +1 -1
- package/dist/number-field/number-field-decrement.mjs.map +1 -1
- package/dist/number-field/number-field-increment.d.mts +2 -22
- package/dist/number-field/number-field-increment.d.mts.map +1 -1
- package/dist/number-field/number-field-increment.mjs +2 -53
- package/dist/number-field/number-field-increment.mjs.map +1 -1
- package/dist/number-field/number-field-input.d.mts.map +1 -1
- package/dist/number-field/number-field-input.mjs +18 -22
- package/dist/number-field/number-field-input.mjs.map +1 -1
- package/dist/number-field/number-field-label.d.mts.map +1 -1
- package/dist/number-field/number-field-label.mjs +3 -9
- package/dist/number-field/number-field-label.mjs.map +1 -1
- package/dist/number-field/number-field-root.d.mts +3 -2
- package/dist/number-field/number-field-root.d.mts.map +1 -1
- package/dist/number-field/number-field-root.mjs +81 -91
- package/dist/number-field/number-field-root.mjs.map +1 -1
- package/dist/number-field/use-number-field-dev-warnings.mjs +28 -0
- package/dist/number-field/use-number-field-dev-warnings.mjs.map +1 -0
- package/dist/number-field/use-step-button.d.mts +24 -0
- package/dist/number-field/use-step-button.d.mts.map +1 -0
- package/dist/number-field/use-step-button.mjs +57 -3
- package/dist/number-field/use-step-button.mjs.map +1 -1
- package/dist/popover/popover-close.d.mts.map +1 -1
- package/dist/popover/popover-close.mjs +28 -67
- package/dist/popover/popover-close.mjs.map +1 -1
- package/dist/popover/popover-context.mjs.map +1 -1
- package/dist/popover/popover-popup.d.mts +9 -6
- package/dist/popover/popover-popup.d.mts.map +1 -1
- package/dist/popover/popover-popup.mjs +13 -36
- package/dist/popover/popover-popup.mjs.map +1 -1
- package/dist/popover/popover-root.mjs +4 -3
- package/dist/popover/popover-root.mjs.map +1 -1
- package/dist/popover/popover-trigger.d.mts +10 -10
- package/dist/popover/popover-trigger.d.mts.map +1 -1
- package/dist/popover/popover-trigger.mjs +4 -2
- package/dist/popover/popover-trigger.mjs.map +1 -1
- package/dist/progress/progress-root.mjs +1 -1
- package/dist/radio-group/radio-group-context.mjs.map +1 -1
- package/dist/radio-group/radio-group-item.d.mts +3 -4
- package/dist/radio-group/radio-group-item.d.mts.map +1 -1
- package/dist/radio-group/radio-group-item.mjs +20 -25
- package/dist/radio-group/radio-group-item.mjs.map +1 -1
- package/dist/radio-group/radio-group-label.mjs +1 -6
- package/dist/radio-group/radio-group-label.mjs.map +1 -1
- package/dist/radio-group/radio-group-root.d.mts +1 -1
- package/dist/radio-group/radio-group-root.d.mts.map +1 -1
- package/dist/radio-group/radio-group-root.mjs +21 -40
- package/dist/radio-group/radio-group-root.mjs.map +1 -1
- package/dist/select/select-dom.mjs +9 -18
- package/dist/select/select-dom.mjs.map +1 -1
- package/dist/select/select-option.mjs +1 -1
- package/dist/select/select-root.mjs +3 -2
- package/dist/select/select-root.mjs.map +1 -1
- package/dist/slider/slider-arithmetic.mjs +74 -13
- package/dist/slider/slider-arithmetic.mjs.map +1 -1
- package/dist/slider/slider-context.mjs.map +1 -1
- package/dist/slider/slider-label.d.mts.map +1 -1
- package/dist/slider/slider-label.mjs +3 -9
- package/dist/slider/slider-label.mjs.map +1 -1
- package/dist/slider/slider-root.d.mts +2 -2
- package/dist/slider/slider-root.d.mts.map +1 -1
- package/dist/slider/slider-root.mjs +36 -116
- package/dist/slider/slider-root.mjs.map +1 -1
- package/dist/slider/slider-thumb.d.mts.map +1 -1
- package/dist/slider/slider-thumb.mjs +8 -6
- package/dist/slider/slider-thumb.mjs.map +1 -1
- package/dist/slider/slider-value.d.mts.map +1 -1
- package/dist/slider/slider-value.mjs +2 -1
- package/dist/slider/slider-value.mjs.map +1 -1
- package/dist/slider/use-slider-dev-warnings.mjs +29 -0
- package/dist/slider/use-slider-dev-warnings.mjs.map +1 -0
- package/dist/slider/use-thumb-registry.mjs +51 -0
- package/dist/slider/use-thumb-registry.mjs.map +1 -0
- package/dist/switch/switch.d.mts +4 -5
- package/dist/switch/switch.d.mts.map +1 -1
- package/dist/switch/switch.mjs +15 -55
- package/dist/switch/switch.mjs.map +1 -1
- package/dist/tabs/tabs-context.d.mts +2 -3
- package/dist/tabs/tabs-context.d.mts.map +1 -1
- package/dist/tabs/tabs-context.mjs.map +1 -1
- package/dist/tabs/tabs-list.d.mts.map +1 -1
- package/dist/tabs/tabs-list.mjs +9 -22
- package/dist/tabs/tabs-list.mjs.map +1 -1
- package/dist/tabs/tabs-panel.d.mts +3 -4
- package/dist/tabs/tabs-panel.d.mts.map +1 -1
- package/dist/tabs/tabs-panel.mjs.map +1 -1
- package/dist/tabs/tabs-root.d.mts +4 -3
- package/dist/tabs/tabs-root.d.mts.map +1 -1
- package/dist/tabs/tabs-root.mjs +2 -1
- package/dist/tabs/tabs-root.mjs.map +1 -1
- package/dist/tabs/tabs-tab.d.mts +3 -4
- package/dist/tabs/tabs-tab.d.mts.map +1 -1
- package/dist/tabs/tabs-tab.mjs.map +1 -1
- package/dist/toast/toast-action.mjs.map +1 -1
- package/dist/toast/toast-close.d.mts.map +1 -1
- package/dist/toast/toast-close.mjs +2 -8
- package/dist/toast/toast-close.mjs.map +1 -1
- package/dist/toast/toast-context.mjs.map +1 -1
- package/dist/toast/toast-hotkey.mjs +27 -0
- package/dist/toast/toast-hotkey.mjs.map +1 -0
- package/dist/toast/toast-queue.mjs +137 -0
- package/dist/toast/toast-queue.mjs.map +1 -0
- package/dist/toast/toast-root.d.mts.map +1 -1
- package/dist/toast/toast-root.mjs +2 -0
- package/dist/toast/toast-root.mjs.map +1 -1
- package/dist/toast/toast-timers.mjs +65 -0
- package/dist/toast/toast-timers.mjs.map +1 -0
- package/dist/toast/toast-viewport.d.mts.map +1 -1
- package/dist/toast/toast-viewport.mjs +30 -235
- package/dist/toast/toast-viewport.mjs.map +1 -1
- package/dist/toast/toast.mjs +1 -1
- package/dist/toast/toast.mjs.map +1 -1
- package/dist/toast/use-modal-portal-host.mjs +52 -0
- package/dist/toast/use-modal-portal-host.mjs.map +1 -0
- package/dist/toggle/toggle.d.mts +3 -4
- package/dist/toggle/toggle.d.mts.map +1 -1
- package/dist/toggle/toggle.mjs +7 -10
- package/dist/toggle/toggle.mjs.map +1 -1
- package/dist/toggle-group/toggle-group-context.d.mts +2 -1
- package/dist/toggle-group/toggle-group-context.d.mts.map +1 -1
- package/dist/toggle-group/toggle-group-context.mjs.map +1 -1
- package/dist/toggle-group/toggle-group-item.d.mts +7 -3
- package/dist/toggle-group/toggle-group-item.d.mts.map +1 -1
- package/dist/toggle-group/toggle-group-item.mjs +6 -7
- package/dist/toggle-group/toggle-group-item.mjs.map +1 -1
- package/dist/toggle-group/toggle-group-root.d.mts.map +1 -1
- package/dist/toggle-group/toggle-group-root.mjs +29 -64
- package/dist/toggle-group/toggle-group-root.mjs.map +1 -1
- package/dist/toolbar/toolbar-root.d.mts +2 -2
- package/dist/toolbar/toolbar-root.d.mts.map +1 -1
- package/dist/toolbar/toolbar-root.mjs +3 -4
- package/dist/toolbar/toolbar-root.mjs.map +1 -1
- package/dist/tooltip/tooltip-context.d.mts +1 -1
- package/dist/tooltip/tooltip-context.mjs.map +1 -1
- package/dist/tooltip/tooltip-popup.d.mts.map +1 -1
- package/dist/tooltip/tooltip-popup.mjs +6 -15
- package/dist/tooltip/tooltip-popup.mjs.map +1 -1
- package/dist/tooltip/tooltip-root.mjs +2 -2
- package/dist/tooltip/tooltip-root.mjs.map +1 -1
- package/dist/tooltip/tooltip-trigger.d.mts +2 -1
- package/dist/tooltip/tooltip-trigger.d.mts.map +1 -1
- package/dist/tooltip/tooltip-trigger.mjs +3 -2
- package/dist/tooltip/tooltip-trigger.mjs.map +1 -1
- package/dist/tooltip/use-tooltip-interaction.mjs +4 -3
- package/dist/tooltip/use-tooltip-interaction.mjs.map +1 -1
- package/package.json +3 -2
- package/dist/accordion/accordion-context.d.mts +0 -5
- package/dist/accordion/accordion-context.d.mts.map +0 -1
- package/dist/internal/use-popover-root.mjs.map +0 -1
- /package/dist/internal/{use-popover-root.d.mts → use-overlay-root.d.mts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anchor-position.mjs","names":[],"sources":["../../src/internal/anchor-position.ts"],"sourcesContent":["// Placement of a popover against its implicit anchor (the invoker set by `commandfor`,\n// `interestfor` or `showPopover({ source })`): inline `position-area` from a side and an\n// alignment, plus `position-try-fallbacks` that flip it when it does not fit; and the parser that\n// reads back which option the browser applied. Shared by Tooltip, Popover and Menu\n// (design/conventions.md 13; design/components/tooltip.md 7.1, popover.md 8).\n//\n// Keyword policy (conventions 13.1): physical keywords and the `self-*` group only. A plain\n// logical keyword (`block-end`, `span-inline-end`) on a top-layer popup resolves against the\n// root's writing mode, so it would ignore a `dir=\"rtl\"` container; `self-x-*` resolves against the\n// popup's own (inherited) direction. Keyword groups are never mixed in one value.\n//\n// No \"use client\" directive: pure functions, importable from anywhere (conventions 7.1).\n\n/** A physical side of the anchor. */\nexport type PhysicalSide = \"top\" | \"bottom\" | \"left\" | \"right\";\n/**\n * Side of the anchor the popup is placed on: physical, or inline-logical (`inline-start` /\n * `inline-end` follow the popup's own `direction` through the `self-x-*` keywords).\n */\nexport type AnchorSide = PhysicalSide | \"inline-start\" | \"inline-end\";\n/**\n * Alignment along that side: inline-relative on a `top` / `bottom` side (`start`: the popup's\n * inline-start edge meets the anchor's), the top / bottom edges on the others.\n */\nexport type AnchorAlign = \"start\" | \"center\" | \"end\";\n/** A computed `direction`. */\nexport type Direction = \"ltr\" | \"rtl\";\n\n/** Flip to the opposite side, then the other axis, then both, when the popup does not fit. */\nexport const POSITION_TRY_FALLBACKS = \"flip-block, flip-inline, flip-block flip-inline\";\n\nconst SIDE_KEYWORD: Record<AnchorSide, string> = {\n top: \"top\",\n bottom: \"bottom\",\n left: \"left\",\n right: \"right\",\n \"inline-start\": \"self-x-start\",\n \"inline-end\": \"self-x-end\",\n};\n\n/**\n * The `position-area` for a side and an alignment (the matrix of conventions 13.1):\n * `bottom` + `center` is `bottom`, `bottom` + `start` is `bottom span-self-x-end`, `right` +\n * `start` is `right span-bottom`, `inline-end` + `start` is `self-x-end span-bottom`.\n */\nexport function positionArea(side: AnchorSide, align: AnchorAlign): string {\n const keyword = SIDE_KEYWORD[side];\n if (align === \"center\") return keyword;\n const horizontal = side === \"top\" || side === \"bottom\";\n const span = horizontal\n ? align === \"start\"\n ? \"span-self-x-end\"\n : \"span-self-x-start\"\n : align === \"start\"\n ? \"span-bottom\"\n : \"span-top\";\n return `${keyword} ${span}`;\n}\n\n// --- Reading back the applied option (conventions 13.2) --------------------------------------\n\n/** Where the browser placed a popup: a physical side and the alignment along it. */\nexport interface ResolvedPlacement {\n readonly side: PhysicalSide;\n readonly align: AnchorAlign;\n}\n\ntype Axis = \"x\" | \"y\";\n\ninterface Token {\n /** `side`: the cell is on that side; `span`: spans toward a direction; `neutral`: neither. */\n readonly kind: \"side\" | \"span\" | \"neutral\";\n /** The physical direction of a `side` or `span` token. */\n readonly physical: PhysicalSide | null;\n}\n\nconst AXIS_OF: Record<PhysicalSide, Axis> = { top: \"y\", bottom: \"y\", left: \"x\", right: \"x\" };\n\n/**\n * Parses a computed `position-area` (conventions 13.2) into the physical side the popup sits on\n * and its alignment. Total: anything it cannot map returns `null` (`none`, an empty value, a\n * vertical `writing-mode`, a corner cell, the cell over the anchor, an unknown keyword), and the\n * part keeps the requested values. The engines serialise in grammar order, in any keyword group:\n * `span-left top`, `span-all bottom` (Firefox's form of a flipped `bottom`), `self-end\n * span-self-end`, `span-self-x-end bottom`, `self-x-start span-top`.\n *\n * `selfDirection` is the popup's computed `direction` (it resolves `self-*` tokens);\n * `rootDirection` the root's (plain `x-*` / `inline-*` tokens, which a consumer `style` override\n * may use), passed as a function so it is read only when such a token appears.\n */\nexport function parsePositionArea(\n value: string | null | undefined,\n selfDirection: Direction,\n rootDirection: Direction | (() => Direction),\n writingMode: string = \"horizontal-tb\",\n): ResolvedPlacement | null {\n if (writingMode !== \"horizontal-tb\" || typeof value !== \"string\") return null;\n const words = value.trim().split(/\\s+/);\n if (words.length > 2 || words[0] === \"\" || words[0] === \"none\") return null;\n let root: Direction | undefined;\n const rootDir = (): Direction =>\n (root ??= typeof rootDirection === \"function\" ? rootDirection() : rootDirection);\n\n const tokens: Token[] = [];\n for (let index = 0; index < words.length; index++) {\n const token = classify(words[index]!, index, words.length, selfDirection, rootDir);\n if (token === null) return null;\n tokens.push(token);\n }\n\n const sides = tokens.filter((t) => t.kind === \"side\");\n // No side (the cell over the anchor) or two (a corner): not a placement of the table.\n if (sides.length !== 1) return null;\n const side = sides[0]!.physical!;\n const span = tokens.find((t) => t.kind === \"span\");\n if (span === undefined) return { side, align: \"center\" };\n const toward = span.physical!;\n if (AXIS_OF[toward] === AXIS_OF[side]) return null;\n if (AXIS_OF[side] === \"y\") {\n // Inline-relative: spanning toward the popup's inline-end puts the inline-start edges\n // together.\n const inlineEnd: PhysicalSide = selfDirection === \"rtl\" ? \"left\" : \"right\";\n return { side, align: toward === inlineEnd ? \"start\" : \"end\" };\n }\n return { side, align: toward === \"bottom\" ? \"start\" : \"end\" };\n}\n\nfunction classify(\n word: string,\n index: number,\n count: number,\n selfDirection: Direction,\n rootDirection: () => Direction,\n): Token | null {\n if (word === \"center\" || word === \"span-all\") return { kind: \"neutral\", physical: null };\n const span = word.startsWith(\"span-\");\n const physical = physicalOf(\n span ? word.slice(5) : word,\n index,\n count,\n selfDirection,\n rootDirection,\n );\n return physical === null ? null : { kind: span ? \"span\" : \"side\", physical };\n}\n\n/**\n * The physical direction a keyword names, in `horizontal-tb`. Bare `start` / `end` /\n * `self-start` / `self-end` are positional: the block axis first, the inline axis second; alone\n * they name both axes (a corner, or a span over both), which the table does not describe.\n */\nfunction physicalOf(\n name: string,\n index: number,\n count: number,\n selfDirection: Direction,\n rootDirection: () => Direction,\n): PhysicalSide | null {\n switch (name) {\n case \"top\":\n case \"bottom\":\n case \"left\":\n case \"right\":\n return name;\n // The block axis is top / bottom in horizontal-tb, whatever the direction.\n case \"y-start\":\n case \"self-y-start\":\n case \"y-self-start\":\n case \"block-start\":\n case \"self-block-start\":\n return \"top\";\n case \"y-end\":\n case \"self-y-end\":\n case \"y-self-end\":\n case \"block-end\":\n case \"self-block-end\":\n return \"bottom\";\n // The inline axis against the popup's own direction.\n case \"self-x-start\":\n case \"x-self-start\":\n case \"self-inline-start\":\n return inlineEdge(\"start\", selfDirection);\n case \"self-x-end\":\n case \"x-self-end\":\n case \"self-inline-end\":\n return inlineEdge(\"end\", selfDirection);\n // The inline axis against the containing block's (the root's, for a top-layer popup).\n case \"x-start\":\n case \"inline-start\":\n return inlineEdge(\"start\", rootDirection());\n case \"x-end\":\n case \"inline-end\":\n return inlineEdge(\"end\", rootDirection());\n case \"start\":\n case \"end\":\n case \"self-start\":\n case \"self-end\": {\n if (count !== 2) return null;\n const edge = name.endsWith(\"start\") ? \"start\" : \"end\";\n if (index === 0) return edge === \"start\" ? \"top\" : \"bottom\";\n return inlineEdge(edge, name.startsWith(\"self-\") ? selfDirection : rootDirection());\n }\n default:\n return null;\n }\n}\n\nfunction inlineEdge(edge: \"start\" | \"end\", direction: Direction): PhysicalSide {\n return (edge === \"start\") === (direction === \"ltr\") ? \"left\" : \"right\";\n}\n\n// --- Placement at a point (design/components/context-menu.md 4.2, conventions 12, 13.4) -------\n\n/** Custom property carrying the x coordinate of a point-placed popup (viewport px). */\nexport const MENU_POINT_X = \"--menu-point-x\";\n/** Custom property carrying the y coordinate of a point-placed popup (viewport px). */\nexport const MENU_POINT_Y = \"--menu-point-y\";\n/**\n * Custom property carrying the vertical gap between the point and the menu: `0px` for a mouse or\n * keyboard open, `16px` for a touch or pen open, which is placed above the finger (#88, 4.7).\n */\nexport const MENU_POINT_GAP = \"--menu-point-gap\";\n/** The gap of a touch or pen open (context-menu.md 4.7). */\nexport const MENU_POINT_TOUCH_GAP = \"16px\";\n\n/** The dedupe key of the shipped rules (`<style href precedence>`). */\nexport const MENU_POINT_HREF = \"@funstack/ui/menu-point\";\n/**\n * The React stylesheet precedence bucket of the library's functional CSS. Fizz writes every\n * same-precedence `<style>` of one server flush as a single element with the texts concatenated,\n * which would match none of the per-href hashes in `STYLE_SHA256`: at most one shipped stylesheet\n * in this bucket may render during server rendering (today the tooltip skip-delay rule; the menu\n * point rules are client-only). A second one needs a precedence of its own (guard row in\n * `csp/csp.test.tsx`).\n */\nexport const FSUI_PRECEDENCE = \"fsui\";\n\nconst UP = `top: auto; bottom: calc(100% - var(${MENU_POINT_Y}) + var(${MENU_POINT_GAP}));`;\nconst DOWN = `bottom: auto; top: calc(var(${MENU_POINT_Y}) + var(${MENU_POINT_GAP}));`;\nconst LEFT = `left: auto; right: calc(100% - var(${MENU_POINT_X}));`;\nconst RIGHT = `right: auto; left: var(${MENU_POINT_X});`;\n\n/**\n * The `@position-try` options that mirror a point-placed popup around the point when it does not\n * fit (context-menu.md 4.2, conventions 12). The base position is inline on the popup: the\n * point's y below (mouse, keyboard) or above (touch, pen, with `--menu-point-gap`) the menu and,\n * by the popup's direction, its left (LTR) or right (RTL) edge at the point's x. A menu names the\n * three options that apply to its direction and pointer kind (`MENU_POINT_FALLBACKS`); the others\n * are inert. Functional at-rules with no selectors: no element is styled. `100%` resolves against\n * the viewport, the top layer's containing block, which `clientX` / `clientY` are measured in.\n * Its SHA-256 is `STYLE_SHA256` in `@funstack/ui/csp` (a jsdom row recomputes it).\n */\nexport const MENU_POINT_RULES =\n \"/* @funstack/ui: placement of a menu at a point. Functional only: the base position is inline \" +\n \"on the popup (below or above the point and, by direction, its left or right edge at the \" +\n \"point); these options mirror it around the point when it does not fit. */\\n\" +\n `@position-try --fsui-menu-up { ${UP} }\\n` +\n `@position-try --fsui-menu-down { ${DOWN} }\\n` +\n `@position-try --fsui-menu-left { ${LEFT} }\\n` +\n `@position-try --fsui-menu-right { ${RIGHT} }\\n` +\n `@position-try --fsui-menu-up-left { ${UP} ${LEFT} }\\n` +\n `@position-try --fsui-menu-up-right { ${UP} ${RIGHT} }\\n` +\n `@position-try --fsui-menu-down-left { ${DOWN} ${LEFT} }\\n` +\n `@position-try --fsui-menu-down-right { ${DOWN} ${RIGHT} }\\n`;\n\n/**\n * Two equivalent spellings of the point fallback list per direction and pointer kind\n * (`MENU_POINT_FALLBACKS[direction][offset ? \"touch\" : \"mouse\"][generation % 2]`), alternated by\n * the placement's generation: changing `position-try-fallbacks` clears the remembered \"last\n * successful position option\", so a re-show at a new point does not keep the previous flip\n * (design 4.3). The first two options are order-independent (only one of them can fix a given\n * overflow). A move that changes direction or pointer kind changes the list either way.\n * Mouse and keyboard: below the point, flipping up and across; touch and pen: above it, flipping\n * across and down (4.7).\n */\nexport const MENU_POINT_FALLBACKS = {\n ltr: {\n mouse: [\n \"--fsui-menu-up, --fsui-menu-left, --fsui-menu-up-left\",\n \"--fsui-menu-left, --fsui-menu-up, --fsui-menu-up-left\",\n ],\n touch: [\n \"--fsui-menu-left, --fsui-menu-down, --fsui-menu-down-left\",\n \"--fsui-menu-down, --fsui-menu-left, --fsui-menu-down-left\",\n ],\n },\n rtl: {\n mouse: [\n \"--fsui-menu-up, --fsui-menu-right, --fsui-menu-up-right\",\n \"--fsui-menu-right, --fsui-menu-up, --fsui-menu-up-right\",\n ],\n touch: [\n \"--fsui-menu-right, --fsui-menu-down, --fsui-menu-down-right\",\n \"--fsui-menu-down, --fsui-menu-right, --fsui-menu-down-right\",\n ],\n },\n} as const;\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"anchor-position.mjs","names":[],"sources":["../../src/internal/anchor-position.ts"],"sourcesContent":["// Placement of a popover against its implicit anchor (the invoker set by `commandfor`,\n// `interestfor` or `showPopover({ source })`): inline `position-area` from a side and an\n// alignment, plus `position-try-fallbacks` that flip it when it does not fit; and the parser that\n// reads back which option the browser applied. Shared by Tooltip, Popover and Menu\n// (design/conventions.md 13; design/components/tooltip.md 7.1, popover.md 8).\n//\n// Keyword policy (conventions 13.1): physical keywords and the `self-*` group only. A plain\n// logical keyword (`block-end`, `span-inline-end`) on a top-layer popup resolves against the\n// root's writing mode, so it would ignore a `dir=\"rtl\"` container; `self-x-*` resolves against the\n// popup's own (inherited) direction. Keyword groups are never mixed in one value.\n//\n// No \"use client\" directive: pure functions, importable from anywhere (conventions 7.1).\n\n/** A physical side of the anchor. */\nexport type PhysicalSide = \"top\" | \"bottom\" | \"left\" | \"right\";\n/**\n * Side of the anchor the popup is placed on: physical, or inline-logical (`inline-start` /\n * `inline-end` follow the popup's own `direction` through the `self-x-*` keywords).\n */\nexport type AnchorSide = PhysicalSide | \"inline-start\" | \"inline-end\";\n/**\n * Alignment along that side: inline-relative on a `top` / `bottom` side (`start`: the popup's\n * inline-start edge meets the anchor's), the top / bottom edges on the others.\n */\nexport type AnchorAlign = \"start\" | \"center\" | \"end\";\n/** A computed `direction`. */\nexport type Direction = \"ltr\" | \"rtl\";\n\n/** Flip to the opposite side, then the other axis, then both, when the popup does not fit. */\nexport const POSITION_TRY_FALLBACKS = \"flip-block, flip-inline, flip-block flip-inline\";\n\nconst SIDE_KEYWORD: Record<AnchorSide, string> = {\n top: \"top\",\n bottom: \"bottom\",\n left: \"left\",\n right: \"right\",\n \"inline-start\": \"self-x-start\",\n \"inline-end\": \"self-x-end\",\n};\n\n/**\n * The `position-area` for a side and an alignment (the matrix of conventions 13.1):\n * `bottom` + `center` is `bottom`, `bottom` + `start` is `bottom span-self-x-end`, `right` +\n * `start` is `right span-bottom`, `inline-end` + `start` is `self-x-end span-bottom`.\n */\nexport function positionArea(side: AnchorSide, align: AnchorAlign): string {\n const keyword = SIDE_KEYWORD[side];\n if (align === \"center\") return keyword;\n const horizontal = side === \"top\" || side === \"bottom\";\n const span = horizontal\n ? align === \"start\"\n ? \"span-self-x-end\"\n : \"span-self-x-start\"\n : align === \"start\"\n ? \"span-bottom\"\n : \"span-top\";\n return `${keyword} ${span}`;\n}\n\n// --- Reading back the applied option (conventions 13.2) --------------------------------------\n\n/** Where the browser placed a popup: a physical side and the alignment along it. */\nexport interface ResolvedPlacement {\n readonly side: PhysicalSide;\n readonly align: AnchorAlign;\n}\n\ntype Axis = \"x\" | \"y\";\n\ninterface Token {\n /** `side`: the cell is on that side; `span`: spans toward a direction; `neutral`: neither. */\n readonly kind: \"side\" | \"span\" | \"neutral\";\n /** The physical direction of a `side` or `span` token. */\n readonly physical: PhysicalSide | null;\n}\n\nconst AXIS_OF: Record<PhysicalSide, Axis> = { top: \"y\", bottom: \"y\", left: \"x\", right: \"x\" };\n\n/**\n * Parses a computed `position-area` (conventions 13.2) into the physical side the popup sits on\n * and its alignment. Total: anything it cannot map returns `null` (`none`, an empty value, a\n * vertical `writing-mode`, a corner cell, the cell over the anchor, an unknown keyword), and the\n * part keeps the requested values. The engines serialise in grammar order, in any keyword group:\n * `span-left top`, `span-all bottom` (Firefox's form of a flipped `bottom`), `self-end\n * span-self-end`, `span-self-x-end bottom`, `self-x-start span-top`.\n *\n * `selfDirection` is the popup's computed `direction` (it resolves `self-*` tokens);\n * `rootDirection` the root's (plain `x-*` / `inline-*` tokens, which a consumer `style` override\n * may use), passed as a function so it is read only when such a token appears.\n */\nexport function parsePositionArea(\n value: string | null | undefined,\n selfDirection: Direction,\n rootDirection: Direction | (() => Direction),\n writingMode: string = \"horizontal-tb\",\n): ResolvedPlacement | null {\n if (writingMode !== \"horizontal-tb\" || typeof value !== \"string\") return null;\n const words = value.trim().split(/\\s+/);\n if (words.length > 2 || words[0] === \"\" || words[0] === \"none\") return null;\n let root: Direction | undefined;\n const rootDir = (): Direction =>\n (root ??= typeof rootDirection === \"function\" ? rootDirection() : rootDirection);\n\n const tokens: Token[] = [];\n for (let index = 0; index < words.length; index++) {\n const token = classify(words[index]!, index, words.length, selfDirection, rootDir);\n if (token === null) return null;\n tokens.push(token);\n }\n\n const sides = tokens.filter((t) => t.kind === \"side\");\n // No side (the cell over the anchor) or two (a corner): not a placement of the table.\n if (sides.length !== 1) return null;\n const side = sides[0]!.physical!;\n const span = tokens.find((t) => t.kind === \"span\");\n if (span === undefined) return { side, align: \"center\" };\n const toward = span.physical!;\n if (AXIS_OF[toward] === AXIS_OF[side]) return null;\n if (AXIS_OF[side] === \"y\") {\n // Inline-relative: spanning toward the popup's inline-end puts the inline-start edges\n // together.\n const inlineEnd: PhysicalSide = selfDirection === \"rtl\" ? \"left\" : \"right\";\n return { side, align: toward === inlineEnd ? \"start\" : \"end\" };\n }\n return { side, align: toward === \"bottom\" ? \"start\" : \"end\" };\n}\n\nfunction classify(\n word: string,\n index: number,\n count: number,\n selfDirection: Direction,\n rootDirection: () => Direction,\n): Token | null {\n if (word === \"center\" || word === \"span-all\") return { kind: \"neutral\", physical: null };\n const span = word.startsWith(\"span-\");\n const physical = physicalOf(\n span ? word.slice(5) : word,\n index,\n count,\n selfDirection,\n rootDirection,\n );\n return physical === null ? null : { kind: span ? \"span\" : \"side\", physical };\n}\n\n/**\n * The physical direction a keyword names, in `horizontal-tb`. Bare `start` / `end` /\n * `self-start` / `self-end` are positional: the block axis first, the inline axis second; alone\n * they name both axes (a corner, or a span over both), which the table does not describe.\n */\nfunction physicalOf(\n name: string,\n index: number,\n count: number,\n selfDirection: Direction,\n rootDirection: () => Direction,\n): PhysicalSide | null {\n switch (name) {\n case \"top\":\n case \"bottom\":\n case \"left\":\n case \"right\":\n return name;\n // The block axis is top / bottom in horizontal-tb, whatever the direction.\n case \"y-start\":\n case \"self-y-start\":\n case \"y-self-start\":\n case \"block-start\":\n case \"self-block-start\":\n return \"top\";\n case \"y-end\":\n case \"self-y-end\":\n case \"y-self-end\":\n case \"block-end\":\n case \"self-block-end\":\n return \"bottom\";\n // The inline axis against the popup's own direction.\n case \"self-x-start\":\n case \"x-self-start\":\n case \"self-inline-start\":\n return inlineEdge(\"start\", selfDirection);\n case \"self-x-end\":\n case \"x-self-end\":\n case \"self-inline-end\":\n return inlineEdge(\"end\", selfDirection);\n // The inline axis against the containing block's (the root's, for a top-layer popup).\n case \"x-start\":\n case \"inline-start\":\n return inlineEdge(\"start\", rootDirection());\n case \"x-end\":\n case \"inline-end\":\n return inlineEdge(\"end\", rootDirection());\n case \"start\":\n case \"end\":\n case \"self-start\":\n case \"self-end\": {\n if (count !== 2) return null;\n const edge = name.endsWith(\"start\") ? \"start\" : \"end\";\n if (index === 0) return edge === \"start\" ? \"top\" : \"bottom\";\n return inlineEdge(edge, name.startsWith(\"self-\") ? selfDirection : rootDirection());\n }\n default:\n return null;\n }\n}\n\nfunction inlineEdge(edge: \"start\" | \"end\", direction: Direction): PhysicalSide {\n return (edge === \"start\") === (direction === \"ltr\") ? \"left\" : \"right\";\n}\n"],"mappings":"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"}
|
|
@@ -1,53 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
//#region src/internal/announce.ts
|
|
3
|
-
/** How long the fallback region keeps a message before it is cleared, so a repeat is spoken. */
|
|
4
|
-
const ANNOUNCE_CLEAR_DELAY = 1e3;
|
|
5
|
-
const REGION_STYLE = "position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap;";
|
|
6
|
-
let region = null;
|
|
7
|
-
let clearTimer;
|
|
8
|
-
let writeTimer;
|
|
9
|
-
function liveRegion(doc) {
|
|
10
|
-
if (region !== null && region.isConnected && region.ownerDocument === doc) return region;
|
|
11
|
-
const el = doc.createElement("div");
|
|
12
|
-
el.setAttribute("role", "status");
|
|
13
|
-
el.setAttribute("aria-live", "polite");
|
|
14
|
-
el.setAttribute("aria-atomic", "true");
|
|
15
|
-
el.setAttribute("data-fsui-announcer", "");
|
|
16
|
-
el.setAttribute("style", REGION_STYLE);
|
|
17
|
-
doc.body.append(el);
|
|
18
|
-
region = el;
|
|
19
|
-
return el;
|
|
20
|
-
}
|
|
21
3
|
/**
|
|
22
|
-
* Speaks `message` in the context of `element
|
|
23
|
-
*
|
|
24
|
-
* `ANNOUNCE_WRITE_DELAY` ms later and cleared again after `ANNOUNCE_CLEAR_DELAY`). An empty
|
|
25
|
-
* message announces nothing; a newer message replaces one not yet written.
|
|
4
|
+
* Speaks `message` in the context of `element` through `element.ariaNotify(message)`. An empty
|
|
5
|
+
* message, or an engine without `ariaNotify` (jsdom, a lagging test build), announces nothing.
|
|
26
6
|
*/
|
|
27
7
|
function announce(element, message) {
|
|
28
8
|
if (message === "") return;
|
|
29
9
|
const notifying = element;
|
|
30
|
-
if (typeof notifying.ariaNotify === "function")
|
|
31
|
-
notifying.ariaNotify(message);
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
const doc = element.ownerDocument;
|
|
35
|
-
if (doc.body === null) return;
|
|
36
|
-
const el = liveRegion(doc);
|
|
37
|
-
el.textContent = "";
|
|
38
|
-
if (clearTimer !== void 0) clearTimeout(clearTimer);
|
|
39
|
-
if (writeTimer !== void 0) clearTimeout(writeTimer);
|
|
40
|
-
clearTimer = void 0;
|
|
41
|
-
writeTimer = setTimeout(() => {
|
|
42
|
-
writeTimer = void 0;
|
|
43
|
-
el.textContent = message;
|
|
44
|
-
clearTimer = setTimeout(() => {
|
|
45
|
-
clearTimer = void 0;
|
|
46
|
-
el.textContent = "";
|
|
47
|
-
}, ANNOUNCE_CLEAR_DELAY);
|
|
48
|
-
}, 100);
|
|
10
|
+
if (typeof notifying.ariaNotify === "function") notifying.ariaNotify(message);
|
|
49
11
|
}
|
|
50
12
|
//#endregion
|
|
51
|
-
export {
|
|
13
|
+
export { announce };
|
|
52
14
|
|
|
53
15
|
//# sourceMappingURL=announce.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"announce.mjs","names":[],"sources":["../../src/internal/announce.ts"],"sourcesContent":["\"use client\";\n// Screen-reader announcements (design/components/number-field.md 8.3, conventions 8): through\n// `ariaNotify()
|
|
1
|
+
{"version":3,"file":"announce.mjs","names":[],"sources":["../../src/internal/announce.ts"],"sourcesContent":["\"use client\";\n// Screen-reader announcements (design/components/number-field.md 8.3, conventions 8): through\n// `ariaNotify()`, which every supported engine has (Chrome 141, Firefox 150, Safari 27). No live\n// region fallback (docs/vision.md: no fallbacks; #113 A1): a region in `document.body` would be\n// inert under a modal dialog anyway. No part renders a live region for these announcements.\n\n/** `ariaNotify()` on an element or a document, where the engine has it (not in the DOM types yet). */\nexport interface AriaNotifyTarget {\n ariaNotify?: (announcement: string, options?: { priority?: \"normal\" | \"high\" }) => void;\n}\n\ntype NotifyingElement = Element & AriaNotifyTarget;\n\n/**\n * Speaks `message` in the context of `element` through `element.ariaNotify(message)`. An empty\n * message, or an engine without `ariaNotify` (jsdom, a lagging test build), announces nothing.\n */\nexport function announce(element: Element, message: string): void {\n if (message === \"\") return;\n const notifying = element as NotifyingElement;\n if (typeof notifying.ariaNotify === \"function\") notifying.ariaNotify(message);\n}\n"],"mappings":";;;;;;AAiBA,SAAgB,SAAS,SAAkB,SAAuB;CAChE,IAAI,YAAY,IAAI;CACpB,MAAM,YAAY;CAClB,IAAI,OAAO,UAAU,eAAe,YAAY,UAAU,WAAW,OAAO;AAC9E"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
//#region src/internal/arrow-keys.ts
|
|
2
|
+
/** The move `key` makes along `orientation` (Home / End on both axes; mirrored when `rtl`). */
|
|
3
|
+
function resolveArrowKey(key, orientation, rtl) {
|
|
4
|
+
switch (key) {
|
|
5
|
+
case "Home": return "first";
|
|
6
|
+
case "End": return "last";
|
|
7
|
+
case "ArrowRight": return orientation === "horizontal" ? rtl ? "prev" : "next" : null;
|
|
8
|
+
case "ArrowLeft": return orientation === "horizontal" ? rtl ? "next" : "prev" : null;
|
|
9
|
+
case "ArrowDown": return orientation === "vertical" ? "next" : null;
|
|
10
|
+
case "ArrowUp": return orientation === "vertical" ? "prev" : null;
|
|
11
|
+
default: return null;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
/** Keyboard focus: the ring shows even where the engine's heuristic would not. */
|
|
15
|
+
function focusWithRing(element) {
|
|
16
|
+
element.focus({ focusVisible: true });
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
export { focusWithRing, resolveArrowKey };
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=arrow-keys.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arrow-keys.mjs","names":[],"sources":["../../src/internal/arrow-keys.ts"],"sourcesContent":["// Arrow-key navigation shared by the roving-focus engine and Tabs.List. No directive: pure\n// functions (conventions 7.1).\nimport type { Orientation } from \"./types.js\";\n\nexport type ArrowMove = \"next\" | \"prev\" | \"first\" | \"last\";\n\n/** The move `key` makes along `orientation` (Home / End on both axes; mirrored when `rtl`). */\nexport function resolveArrowKey(\n key: string,\n orientation: Orientation,\n rtl: boolean,\n): ArrowMove | null {\n switch (key) {\n case \"Home\":\n return \"first\";\n case \"End\":\n return \"last\";\n case \"ArrowRight\":\n return orientation === \"horizontal\" ? (rtl ? \"prev\" : \"next\") : null;\n case \"ArrowLeft\":\n return orientation === \"horizontal\" ? (rtl ? \"next\" : \"prev\") : null;\n case \"ArrowDown\":\n return orientation === \"vertical\" ? \"next\" : null;\n case \"ArrowUp\":\n return orientation === \"vertical\" ? \"prev\" : null;\n default:\n return null;\n }\n}\n\n/** Keyboard focus: the ring shows even where the engine's heuristic would not. */\nexport function focusWithRing(element: HTMLElement): void {\n element.focus({ focusVisible: true } as FocusOptions);\n}\n"],"mappings":";;AAOA,SAAgB,gBACd,KACA,aACA,KACkB;CAClB,QAAQ,KAAR;EACE,KAAK,QACH,OAAO;EACT,KAAK,OACH,OAAO;EACT,KAAK,cACH,OAAO,gBAAgB,eAAgB,MAAM,SAAS,SAAU;EAClE,KAAK,aACH,OAAO,gBAAgB,eAAgB,MAAM,SAAS,SAAU;EAClE,KAAK,aACH,OAAO,gBAAgB,aAAa,SAAS;EAC/C,KAAK,WACH,OAAO,gBAAgB,aAAa,SAAS;EAC/C,SACE,OAAO;CACX;AACF;;AAGA,SAAgB,cAAc,SAA4B;CACxD,QAAQ,MAAM,EAAE,cAAc,KAAK,CAAiB;AACtD"}
|
|
@@ -12,6 +12,12 @@ function decimalsOf(n) {
|
|
|
12
12
|
const dot = text.indexOf(".");
|
|
13
13
|
return dot === -1 ? 0 : text.length - dot - 1;
|
|
14
14
|
}
|
|
15
|
+
/** Tolerance for grid computations on binary floating point (`0.3 / 0.1` is `2.9999999999999996`). */
|
|
16
|
+
const EPSILON = 1e-9;
|
|
17
|
+
/** The decimal places a grid of `step` from `min` needs: the larger of the two. */
|
|
18
|
+
function gridDecimals(step, min) {
|
|
19
|
+
return Math.max(decimalsOf(step), decimalsOf(min));
|
|
20
|
+
}
|
|
15
21
|
/**
|
|
16
22
|
* `value` rounded to `decimals` places through `toFixed` (decimal, not binary, rounding of the
|
|
17
23
|
* written digits: `roundTo(0.1 + 0.2, 1)` is `0.3`). `-0` becomes `0`.
|
|
@@ -22,6 +28,6 @@ function roundTo(value, decimals) {
|
|
|
22
28
|
return result === 0 ? 0 : result;
|
|
23
29
|
}
|
|
24
30
|
//#endregion
|
|
25
|
-
export { decimalsOf, roundTo };
|
|
31
|
+
export { EPSILON, decimalsOf, gridDecimals, roundTo };
|
|
26
32
|
|
|
27
33
|
//# sourceMappingURL=decimal.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decimal.mjs","names":[],"sources":["../../src/internal/decimal.ts"],"sourcesContent":["// Decimal helpers shared by Slider and NumberField (design/components/number-field.md 5.4). No\n// directive: no React, no client-only API.\n\n/** Number of decimal places of `n` as written (`0.1` → 1, `1e-7` → 7, `5` → 0). */\nexport function decimalsOf(n: number): number {\n if (!Number.isFinite(n)) return 0;\n const text = String(n);\n const exponent = /e-(\\d+)$/i.exec(text);\n if (exponent !== null) {\n const mantissa = text.slice(0, exponent.index);\n const dot = mantissa.indexOf(\".\");\n return Number(exponent[1]) + (dot === -1 ? 0 : mantissa.length - dot - 1);\n }\n const dot = text.indexOf(\".\");\n return dot === -1 ? 0 : text.length - dot - 1;\n}\n\n/**\n * `value` rounded to `decimals` places through `toFixed` (decimal, not binary, rounding of the\n * written digits: `roundTo(0.1 + 0.2, 1)` is `0.3`). `-0` becomes `0`.\n */\nexport function roundTo(value: number, decimals: number): number {\n if (!Number.isFinite(value)) return value;\n // `toFixed` takes at most 100 digits; anything near that is already exact.\n const result = decimals <= 0 ? Math.round(value) : Number(value.toFixed(Math.min(decimals, 100)));\n return result === 0 ? 0 : result;\n}\n"],"mappings":";;AAIA,SAAgB,WAAW,GAAmB;CAC5C,IAAI,CAAC,OAAO,SAAS,CAAC,GAAG,OAAO;CAChC,MAAM,OAAO,OAAO,CAAC;CACrB,MAAM,WAAW,YAAY,KAAK,IAAI;CACtC,IAAI,aAAa,MAAM;EACrB,MAAM,WAAW,KAAK,MAAM,GAAG,SAAS,KAAK;EAC7C,MAAM,MAAM,SAAS,QAAQ,GAAG;EAChC,OAAO,OAAO,SAAS,EAAE,KAAK,QAAQ,KAAK,IAAI,SAAS,SAAS,MAAM;CACzE;CACA,MAAM,MAAM,KAAK,QAAQ,GAAG;CAC5B,OAAO,QAAQ,KAAK,IAAI,KAAK,SAAS,MAAM;AAC9C;;;;;AAMA,SAAgB,QAAQ,OAAe,UAA0B;CAC/D,IAAI,CAAC,OAAO,SAAS,KAAK,GAAG,OAAO;CAEpC,MAAM,SAAS,YAAY,IAAI,KAAK,MAAM,KAAK,IAAI,OAAO,MAAM,QAAQ,KAAK,IAAI,UAAU,GAAG,CAAC,CAAC;CAChG,OAAO,WAAW,IAAI,IAAI;AAC5B"}
|
|
1
|
+
{"version":3,"file":"decimal.mjs","names":[],"sources":["../../src/internal/decimal.ts"],"sourcesContent":["// Decimal helpers shared by Slider and NumberField (design/components/number-field.md 5.4). No\n// directive: no React, no client-only API.\n\n/** Number of decimal places of `n` as written (`0.1` → 1, `1e-7` → 7, `5` → 0). */\nexport function decimalsOf(n: number): number {\n if (!Number.isFinite(n)) return 0;\n const text = String(n);\n const exponent = /e-(\\d+)$/i.exec(text);\n if (exponent !== null) {\n const mantissa = text.slice(0, exponent.index);\n const dot = mantissa.indexOf(\".\");\n return Number(exponent[1]) + (dot === -1 ? 0 : mantissa.length - dot - 1);\n }\n const dot = text.indexOf(\".\");\n return dot === -1 ? 0 : text.length - dot - 1;\n}\n\n/** Tolerance for grid computations on binary floating point (`0.3 / 0.1` is `2.9999999999999996`). */\nexport const EPSILON = 1e-9;\n\n/** The decimal places a grid of `step` from `min` needs: the larger of the two. */\nexport function gridDecimals(step: number, min: number): number {\n return Math.max(decimalsOf(step), decimalsOf(min));\n}\n\n/**\n * `value` rounded to `decimals` places through `toFixed` (decimal, not binary, rounding of the\n * written digits: `roundTo(0.1 + 0.2, 1)` is `0.3`). `-0` becomes `0`.\n */\nexport function roundTo(value: number, decimals: number): number {\n if (!Number.isFinite(value)) return value;\n // `toFixed` takes at most 100 digits; anything near that is already exact.\n const result = decimals <= 0 ? Math.round(value) : Number(value.toFixed(Math.min(decimals, 100)));\n return result === 0 ? 0 : result;\n}\n"],"mappings":";;AAIA,SAAgB,WAAW,GAAmB;CAC5C,IAAI,CAAC,OAAO,SAAS,CAAC,GAAG,OAAO;CAChC,MAAM,OAAO,OAAO,CAAC;CACrB,MAAM,WAAW,YAAY,KAAK,IAAI;CACtC,IAAI,aAAa,MAAM;EACrB,MAAM,WAAW,KAAK,MAAM,GAAG,SAAS,KAAK;EAC7C,MAAM,MAAM,SAAS,QAAQ,GAAG;EAChC,OAAO,OAAO,SAAS,EAAE,KAAK,QAAQ,KAAK,IAAI,SAAS,SAAS,MAAM;CACzE;CACA,MAAM,MAAM,KAAK,QAAQ,GAAG;CAC5B,OAAO,QAAQ,KAAK,IAAI,KAAK,SAAS,MAAM;AAC9C;;AAGA,MAAa,UAAU;;AAGvB,SAAgB,aAAa,MAAc,KAAqB;CAC9D,OAAO,KAAK,IAAI,WAAW,IAAI,GAAG,WAAW,GAAG,CAAC;AACnD;;;;;AAMA,SAAgB,QAAQ,OAAe,UAA0B;CAC/D,IAAI,CAAC,OAAO,SAAS,KAAK,GAAG,OAAO;CAEpC,MAAM,SAAS,YAAY,IAAI,KAAK,MAAM,KAAK,IAAI,OAAO,MAAM,QAAQ,KAAK,IAAI,UAAU,GAAG,CAAC,CAAC;CAChG,OAAO,WAAW,IAAI,IAAI;AAC5B"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//#region src/internal/dom-order.ts
|
|
2
|
+
/** A `sort` comparator putting nodes in document order. */
|
|
3
|
+
function compareDocumentOrder(a, b) {
|
|
4
|
+
if (a === b) return 0;
|
|
5
|
+
const position = a.compareDocumentPosition(b);
|
|
6
|
+
if (position & Node.DOCUMENT_POSITION_FOLLOWING) return -1;
|
|
7
|
+
if (position & Node.DOCUMENT_POSITION_PRECEDING) return 1;
|
|
8
|
+
return 0;
|
|
9
|
+
}
|
|
10
|
+
/** Sorts items into the document order of their elements. */
|
|
11
|
+
function sortByDocumentOrder(items, elementOf) {
|
|
12
|
+
return [...items].sort((a, b) => compareDocumentOrder(elementOf(a), elementOf(b)));
|
|
13
|
+
}
|
|
14
|
+
//#endregion
|
|
15
|
+
export { compareDocumentOrder, sortByDocumentOrder };
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=dom-order.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dom-order.mjs","names":[],"sources":["../../src/internal/dom-order.ts"],"sourcesContent":["// Document-order helpers. No directive: pure DOM reads (conventions 7.1).\n\n/** A `sort` comparator putting nodes in document order. */\nexport function compareDocumentOrder(a: Node, b: Node): number {\n if (a === b) return 0;\n const position = a.compareDocumentPosition(b);\n if (position & Node.DOCUMENT_POSITION_FOLLOWING) return -1;\n if (position & Node.DOCUMENT_POSITION_PRECEDING) return 1;\n return 0;\n}\n\n/** Sorts items into the document order of their elements. */\nexport function sortByDocumentOrder<T>(items: readonly T[], elementOf: (item: T) => Node): T[] {\n return [...items].sort((a, b) => compareDocumentOrder(elementOf(a), elementOf(b)));\n}\n"],"mappings":";;AAGA,SAAgB,qBAAqB,GAAS,GAAiB;CAC7D,IAAI,MAAM,GAAG,OAAO;CACpB,MAAM,WAAW,EAAE,wBAAwB,CAAC;CAC5C,IAAI,WAAW,KAAK,6BAA6B,OAAO;CACxD,IAAI,WAAW,KAAK,6BAA6B,OAAO;CACxD,OAAO;AACT;;AAGA,SAAgB,oBAAuB,OAAqB,WAAmC;CAC7F,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC,MAAM,GAAG,MAAM,qBAAqB,UAAU,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC;AACnF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field-context.d.mts","names":[],"sources":["../../src/internal/field-context.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"field-context.d.mts","names":[],"sources":["../../src/internal/field-context.ts"],"mappings":";;;iBAMiB;;WAEN;;WAEA;;WAEA,UAAU;;WAEV;;WAEA;;WAEA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { dataAttr } from "./data-attr.mjs";
|
|
2
3
|
import { createContext, use } from "react";
|
|
3
4
|
//#region src/internal/field-context.ts
|
|
4
5
|
const FieldContext = createContext(null);
|
|
@@ -8,7 +9,16 @@ function useFieldContext(part) {
|
|
|
8
9
|
return ctx;
|
|
9
10
|
}
|
|
10
11
|
const FormContext = createContext(null);
|
|
12
|
+
/** The four state attributes every Field part renders (design 6.1). */
|
|
13
|
+
function fieldDataAttributes(state) {
|
|
14
|
+
return {
|
|
15
|
+
"data-invalid": dataAttr(state.invalid),
|
|
16
|
+
"data-disabled": dataAttr(state.disabled),
|
|
17
|
+
"data-required": dataAttr(state.required),
|
|
18
|
+
"data-pending": dataAttr(state.pending)
|
|
19
|
+
};
|
|
20
|
+
}
|
|
11
21
|
//#endregion
|
|
12
|
-
export { FieldContext, FormContext, useFieldContext };
|
|
22
|
+
export { FieldContext, FormContext, fieldDataAttributes, useFieldContext };
|
|
13
23
|
|
|
14
24
|
//# sourceMappingURL=field-context.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field-context.mjs","names":[],"sources":["../../src/internal/field-context.ts"],"sourcesContent":["\"use client\";\nimport { createContext, use } from \"react\";\nimport type { FieldValidity, FormErrors, ValidatableElement } from \"./validity.js\";\n\n/** The state every Field part receives (design/components/field-form.md 4.1). */\nexport interface FieldState {\n /** An error is shown: the control matches `:user-invalid`, or a server error for this field is shown. */\n readonly invalid: boolean;\n /** The messages shown: `[validationMessage]` for a native constraint, the strings `validate` returned for a custom one, the server's strings for a server error; `[]` while valid. */\n readonly messages: readonly string[];\n /** A snapshot of the control's `ValidityState` (all valid on the server and before the first read). */\n readonly validity: FieldValidity;\n /** `Field.Root disabled` or the control's own `disabled`. */\n readonly disabled: boolean;\n /** `Field.Root required` or the control's own `required`. */\n readonly required: boolean;\n /** The enclosing form's submission is in flight (`useFormStatus().pending`); `false` outside a form. */\n readonly pending: boolean;\n}\n\nexport interface FieldIds {\n readonly control: string;\n readonly label: string;\n readonly description: string;\n readonly error: string;\n}\n\n/** What a control reports to its Field (design 7.1). */\nexport interface FieldControlRegistration {\n /** The element the Field labels, describes and listens to (the input, or a group's fieldset). */\n readonly element: HTMLElement;\n /** `<label for>` can target it. Groups report `false`. */\n readonly labelable: boolean;\n /** The control's own `required` / `disabled` props (for the Field's `data-*` state). */\n readonly required: boolean;\n readonly disabled: boolean;\n /**\n * Where `validity`, `validationMessage` and the custom-validity slot are read and written when\n * that is not the registered element (NumberField: the hidden `input[type=number]` after the\n * visible text input). `:user-invalid`, the listeners and the focus target stay on `element`;\n * after writing the slot the Field mirrors this element's `validationMessage` into `element`\n * (design/components/field-form.md,
|
|
1
|
+
{"version":3,"file":"field-context.mjs","names":[],"sources":["../../src/internal/field-context.ts"],"sourcesContent":["\"use client\";\nimport { createContext, use } from \"react\";\nimport { dataAttr } from \"./data-attr.js\";\nimport type { FieldValidity, FormErrors, ValidatableElement } from \"./validity.js\";\n\n/** The state every Field part receives (design/components/field-form.md 4.1). */\nexport interface FieldState {\n /** An error is shown: the control matches `:user-invalid`, or a server error for this field is shown. */\n readonly invalid: boolean;\n /** The messages shown: `[validationMessage]` for a native constraint, the strings `validate` returned for a custom one, the server's strings for a server error; `[]` while valid. */\n readonly messages: readonly string[];\n /** A snapshot of the control's `ValidityState` (all valid on the server and before the first read). */\n readonly validity: FieldValidity;\n /** `Field.Root disabled` or the control's own `disabled`. */\n readonly disabled: boolean;\n /** `Field.Root required` or the control's own `required`. */\n readonly required: boolean;\n /** The enclosing form's submission is in flight (`useFormStatus().pending`); `false` outside a form. */\n readonly pending: boolean;\n}\n\nexport interface FieldIds {\n readonly control: string;\n readonly label: string;\n readonly description: string;\n readonly error: string;\n}\n\n/** What a control reports to its Field (design 7.1). */\nexport interface FieldControlRegistration {\n /** The element the Field labels, describes and listens to (the input, or a group's fieldset). */\n readonly element: HTMLElement;\n /** `<label for>` can target it. Groups report `false`. */\n readonly labelable: boolean;\n /** The control's own `required` / `disabled` props (for the Field's `data-*` state). */\n readonly required: boolean;\n readonly disabled: boolean;\n /**\n * Where `validity`, `validationMessage` and the custom-validity slot are read and written when\n * that is not the registered element (NumberField: the hidden `input[type=number]` after the\n * visible text input). `:user-invalid`, the listeners and the focus target stay on `element`;\n * after writing the slot the Field mirrors this element's `validationMessage` into `element`\n * (design/components/field-form.md, `validityElement`). Resolved on every read.\n */\n readonly validityElement?: (() => ValidatableElement | null) | undefined;\n}\n\nexport interface FieldContextValue {\n readonly ids: FieldIds;\n /** `Field.Root name`. */\n readonly name: string | undefined;\n /** `Field.Root disabled` / `required` (the props, not the merged state). */\n readonly disabled: boolean;\n readonly required: boolean;\n readonly state: FieldState;\n /** The registered control is labelable (default `true`, also before any registration). */\n readonly labelable: boolean;\n /** Registers the Field's control; returns the unregister function. The first one wins. */\n readonly registerControl: (registration: FieldControlRegistration) => () => void;\n /** A `Field.Error` is mounted (the Field may cancel the platform bubble). */\n readonly registerError: () => () => void;\n /**\n * The control's value changed in the DOM without an `input` / `change` event the Field could\n * hear (a Combobox selection, a CheckboxGroup's derived `required`, a rolled-back optimistic\n * value): re-reads the slot and the mirror after the commit that wrote it, and refreshes the\n * other Fields of the `Form.Root` (cross-field rules). `edit`: the user made the change, so a\n * shown server error is dismissed as by an `input` event. Call from a layout effect.\n */\n readonly notifyChange: (edit: boolean) => void;\n}\n\nexport const FieldContext = createContext<FieldContextValue | null>(null);\n\nexport function useFieldContext(part: string): FieldContextValue {\n const ctx = use(FieldContext);\n if (ctx === null) throw new Error(`${part} must be rendered inside a Field.Root.`);\n return ctx;\n}\n\n/** What a Field registers with its Form (design 3.5). */\nexport interface FormFieldRegistration {\n /** The control, or a group's first enabled (or checked) member. */\n readonly getFocusTarget: () => HTMLElement | null;\n /** The Field shows a server error at the latest commit. */\n readonly showsServerError: () => boolean;\n /** The server messages shown, for an announcement when focus does not move. */\n readonly serverMessages: () => readonly string[];\n /** Re-runs `validate` and re-reads validity (another Field's control changed). */\n readonly refresh: () => void;\n}\n\nexport interface FormContextValue {\n readonly errors: FormErrors | undefined;\n readonly registerField: (registration: FormFieldRegistration) => () => void;\n /**\n * The `FormData` of the submission in flight when the Form ran it itself (the intercepted path),\n * else `null`: the stale-value suppression of design 3.2 item 2 is computed against it.\n */\n readonly submittedData: () => FormData | null;\n /** Refreshes every registered Field except `source` (a change no DOM event carried). */\n readonly refreshFields: (source: FormFieldRegistration | null) => void;\n}\n\nexport const FormContext = createContext<FormContextValue | null>(null);\n\n/** The four state attributes every Field part renders (design 6.1). */\nexport function fieldDataAttributes(state: FieldState) {\n return {\n \"data-invalid\": dataAttr(state.invalid),\n \"data-disabled\": dataAttr(state.disabled),\n \"data-required\": dataAttr(state.required),\n \"data-pending\": dataAttr(state.pending),\n };\n}\n"],"mappings":";;;;AAuEA,MAAa,eAAe,cAAwC,IAAI;AAExE,SAAgB,gBAAgB,MAAiC;CAC/D,MAAM,MAAM,IAAI,YAAY;CAC5B,IAAI,QAAQ,MAAM,MAAM,IAAI,MAAM,GAAG,KAAK,uCAAuC;CACjF,OAAO;AACT;AA0BA,MAAa,cAAc,cAAuC,IAAI;;AAGtE,SAAgB,oBAAoB,OAAmB;CACrD,OAAO;EACL,gBAAgB,SAAS,MAAM,OAAO;EACtC,iBAAiB,SAAS,MAAM,QAAQ;EACxC,iBAAiB,SAAS,MAAM,QAAQ;EACxC,gBAAgB,SAAS,MAAM,OAAO;CACxC;AACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { sortByDocumentOrder } from "./
|
|
1
|
+
import { sortByDocumentOrder } from "./dom-order.mjs";
|
|
2
2
|
//#region src/internal/focus-first-invalid.ts
|
|
3
3
|
/**
|
|
4
4
|
* Speaks `message` through `element.ariaNotify()` where the browser has it (design 5.3: the
|
|
@@ -13,9 +13,9 @@ function announce(element, message) {
|
|
|
13
13
|
/** The submission attempt in progress: every target added during the current task. */
|
|
14
14
|
let batch = null;
|
|
15
15
|
/**
|
|
16
|
-
* Adds a control whose `invalid` event a Field cancelled during a submission
|
|
17
|
-
* focuses the first collected control in document order in a microtask, so the
|
|
18
|
-
* depend on the browser's dispatch order or on how many forms are on the page.
|
|
16
|
+
* Adds a control whose `invalid` event (fired on `source`) a Field cancelled during a submission
|
|
17
|
+
* attempt, and focuses the first collected control in document order in a microtask, so the
|
|
18
|
+
* result does not depend on the browser's dispatch order or on how many forms are on the page.
|
|
19
19
|
*
|
|
20
20
|
* The batch lives until the end of the task (a `setTimeout`), not just one microtask: when the
|
|
21
21
|
* browser dispatches the `invalid` events itself (a click on a submit button), it runs a
|
|
@@ -23,25 +23,34 @@ let batch = null;
|
|
|
23
23
|
* second event fires. Every add therefore queues a focus of the batch's first target; later ones
|
|
24
24
|
* re-focus the same element, which is a no-op.
|
|
25
25
|
*
|
|
26
|
+
* A second `invalid` for the same `source` (the element the event fired on) starts a new batch:
|
|
27
|
+
* one validation fires it once per element, so it belongs to the next attempt, even when that
|
|
28
|
+
* attempt comes before the timer (two attempts in one task, or a test that does not yield to
|
|
29
|
+
* timers between them). Joining the old batch would compare focus with the old attempt's.
|
|
30
|
+
*
|
|
26
31
|
* Skips the focus when focus moved during the attempt to an element that is not one of the
|
|
27
32
|
* collected targets: a plain `<input required>` with no Field kept the platform's behaviour
|
|
28
33
|
* (bubble and focus), and the library does not fight it.
|
|
29
34
|
*/
|
|
30
|
-
function collectInvalid(target, message
|
|
35
|
+
function collectInvalid(target, message, source) {
|
|
31
36
|
if (target === null) return;
|
|
37
|
+
if (batch !== null && batch.sources.has(source)) batch = null;
|
|
32
38
|
if (batch === null) {
|
|
33
|
-
|
|
39
|
+
const created = {
|
|
40
|
+
sources: /* @__PURE__ */ new Set(),
|
|
34
41
|
targets: [],
|
|
35
42
|
messages: /* @__PURE__ */ new Map(),
|
|
36
43
|
activeBefore: target.ownerDocument.activeElement,
|
|
37
44
|
moved: false,
|
|
38
45
|
announced: null
|
|
39
46
|
};
|
|
47
|
+
batch = created;
|
|
40
48
|
setTimeout(() => {
|
|
41
|
-
batch = null;
|
|
49
|
+
if (batch === created) batch = null;
|
|
42
50
|
}, 0);
|
|
43
51
|
}
|
|
44
52
|
const current = batch;
|
|
53
|
+
current.sources.add(source);
|
|
45
54
|
if (!current.targets.includes(target)) current.targets.push(target);
|
|
46
55
|
current.messages.set(target, message);
|
|
47
56
|
queueMicrotask(() => focusFirst(current));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"focus-first-invalid.mjs","names":[],"sources":["../../src/internal/focus-first-invalid.ts"],"sourcesContent":["// Directive-free: the module-level first-invalid collector (design/components/field-form.md 2.5).\nimport { sortByDocumentOrder } from \"./
|
|
1
|
+
{"version":3,"file":"focus-first-invalid.mjs","names":[],"sources":["../../src/internal/focus-first-invalid.ts"],"sourcesContent":["// Directive-free: the module-level first-invalid collector (design/components/field-form.md 2.5).\nimport type { AriaNotifyTarget } from \"./announce.js\";\nimport { sortByDocumentOrder } from \"./dom-order.js\";\n\ninterface Batch {\n /** The elements whose `invalid` event was collected (a group's members, not its target). */\n readonly sources: Set<Element>;\n readonly targets: HTMLElement[];\n /** The message each target's Field shows, for the announcement when focus does not move. */\n readonly messages: Map<HTMLElement, string>;\n /** `document.activeElement` when the first target arrived. */\n readonly activeBefore: Element | null;\n /** The batch moved focus (later microtasks then re-focus, never announce). */\n moved: boolean;\n /** The target already announced. */\n announced: HTMLElement | null;\n}\n\ntype NotifyingElement = HTMLElement & AriaNotifyTarget;\n\n/**\n * Speaks `message` through `element.ariaNotify()` where the browser has it (design 5.3: the\n * error is read when focus moves to the control; when focus is already there nothing would be\n * read). Does nothing without `ariaNotify` or with an empty message.\n */\nexport function announce(element: HTMLElement, message: string): void {\n const notifying = element as NotifyingElement;\n if (message === \"\" || typeof notifying.ariaNotify !== \"function\") return;\n notifying.ariaNotify(message);\n}\n\n/** The submission attempt in progress: every target added during the current task. */\nlet batch: Batch | null = null;\n\n/**\n * Adds a control whose `invalid` event (fired on `source`) a Field cancelled during a submission\n * attempt, and focuses the first collected control in document order in a microtask, so the\n * result does not depend on the browser's dispatch order or on how many forms are on the page.\n *\n * The batch lives until the end of the task (a `setTimeout`), not just one microtask: when the\n * browser dispatches the `invalid` events itself (a click on a submit button), it runs a\n * microtask checkpoint after each listener, so the microtask of the first event runs before the\n * second event fires. Every add therefore queues a focus of the batch's first target; later ones\n * re-focus the same element, which is a no-op.\n *\n * A second `invalid` for the same `source` (the element the event fired on) starts a new batch:\n * one validation fires it once per element, so it belongs to the next attempt, even when that\n * attempt comes before the timer (two attempts in one task, or a test that does not yield to\n * timers between them). Joining the old batch would compare focus with the old attempt's.\n *\n * Skips the focus when focus moved during the attempt to an element that is not one of the\n * collected targets: a plain `<input required>` with no Field kept the platform's behaviour\n * (bubble and focus), and the library does not fight it.\n */\nexport function collectInvalid(target: HTMLElement | null, message: string, source: Element): void {\n if (target === null) return;\n if (batch !== null && batch.sources.has(source)) batch = null;\n if (batch === null) {\n const created: Batch = {\n sources: new Set(),\n targets: [],\n messages: new Map(),\n activeBefore: target.ownerDocument.activeElement,\n moved: false,\n announced: null,\n };\n batch = created;\n setTimeout(() => {\n if (batch === created) batch = null;\n }, 0);\n }\n const current = batch;\n current.sources.add(source);\n if (!current.targets.includes(target)) current.targets.push(target);\n current.messages.set(target, message);\n queueMicrotask(() => focusFirst(current));\n}\n\nfunction focusFirst(current: Batch): void {\n const { targets, activeBefore } = current;\n const connected = targets.filter((t) => t.isConnected);\n if (connected.length === 0) return;\n const active = connected[0]!.ownerDocument.activeElement;\n if (active !== activeBefore && active !== null && !connected.includes(active as HTMLElement)) {\n return;\n }\n const first = sortByDocumentOrder(connected, (t) => t)[0]!;\n if (active !== first) {\n current.moved = true;\n first.focus();\n } else if (!current.moved && current.announced !== first) {\n // Focus was already on the first invalid control (an implicit submission with Enter): the\n // cancelled bubble was the only announcement, so speak the message instead.\n current.announced = first;\n announce(first, current.messages.get(first) ?? \"\");\n }\n}\n"],"mappings":";;;;;;;AAyBA,SAAgB,SAAS,SAAsB,SAAuB;CACpE,MAAM,YAAY;CAClB,IAAI,YAAY,MAAM,OAAO,UAAU,eAAe,YAAY;CAClE,UAAU,WAAW,OAAO;AAC9B;;AAGA,IAAI,QAAsB;;;;;;;;;;;;;;;;;;;;;AAsB1B,SAAgB,eAAe,QAA4B,SAAiB,QAAuB;CACjG,IAAI,WAAW,MAAM;CACrB,IAAI,UAAU,QAAQ,MAAM,QAAQ,IAAI,MAAM,GAAG,QAAQ;CACzD,IAAI,UAAU,MAAM;EAClB,MAAM,UAAiB;GACrB,yBAAS,IAAI,IAAI;GACjB,SAAS,CAAC;GACV,0BAAU,IAAI,IAAI;GAClB,cAAc,OAAO,cAAc;GACnC,OAAO;GACP,WAAW;EACb;EACA,QAAQ;EACR,iBAAiB;GACf,IAAI,UAAU,SAAS,QAAQ;EACjC,GAAG,CAAC;CACN;CACA,MAAM,UAAU;CAChB,QAAQ,QAAQ,IAAI,MAAM;CAC1B,IAAI,CAAC,QAAQ,QAAQ,SAAS,MAAM,GAAG,QAAQ,QAAQ,KAAK,MAAM;CAClE,QAAQ,SAAS,IAAI,QAAQ,OAAO;CACpC,qBAAqB,WAAW,OAAO,CAAC;AAC1C;AAEA,SAAS,WAAW,SAAsB;CACxC,MAAM,EAAE,SAAS,iBAAiB;CAClC,MAAM,YAAY,QAAQ,QAAQ,MAAM,EAAE,WAAW;CACrD,IAAI,UAAU,WAAW,GAAG;CAC5B,MAAM,SAAS,UAAU,EAAE,CAAE,cAAc;CAC3C,IAAI,WAAW,gBAAgB,WAAW,QAAQ,CAAC,UAAU,SAAS,MAAqB,GACzF;CAEF,MAAM,QAAQ,oBAAoB,YAAY,MAAM,CAAC,CAAC,CAAC;CACvD,IAAI,WAAW,OAAO;EACpB,QAAQ,QAAQ;EAChB,MAAM,MAAM;CACd,OAAO,IAAI,CAAC,QAAQ,SAAS,QAAQ,cAAc,OAAO;EAGxD,QAAQ,YAAY;EACpB,SAAS,OAAO,QAAQ,SAAS,IAAI,KAAK,KAAK,EAAE;CACnD;AACF"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { dataAttr } from "./data-attr.mjs";
|
|
3
|
+
import { guardCheckableChange } from "./use-native-checked.mjs";
|
|
4
|
+
//#region src/internal/group-member.ts
|
|
5
|
+
/**
|
|
6
|
+
* The owned layer (conventions 1.2) of a group Item's `<input>`: `type`, the group's `name` /
|
|
7
|
+
* `form`, `value`, `checked` (the optimistic state), `defaultChecked` (never rendered), a
|
|
8
|
+
* checkbox's `aria-checked` (removed), `disabled`, `required`, the state `data-*` attributes,
|
|
9
|
+
* and the guarded `onChange`.
|
|
10
|
+
*/
|
|
11
|
+
function groupMemberProps(options) {
|
|
12
|
+
const { type, component, checked, pending, effectiveDisabled, invalid, activate } = options;
|
|
13
|
+
return {
|
|
14
|
+
type,
|
|
15
|
+
name: options.name,
|
|
16
|
+
value: options.value,
|
|
17
|
+
checked,
|
|
18
|
+
defaultChecked: void 0,
|
|
19
|
+
...type === "checkbox" && { "aria-checked": void 0 },
|
|
20
|
+
disabled: options.ownDisabled,
|
|
21
|
+
form: options.form,
|
|
22
|
+
required: options.required,
|
|
23
|
+
"data-checked": dataAttr(checked),
|
|
24
|
+
"data-pending": dataAttr(pending),
|
|
25
|
+
"data-disabled": dataAttr(effectiveDisabled),
|
|
26
|
+
...invalid !== void 0 && { "aria-invalid": invalid },
|
|
27
|
+
onChange: (event) => {
|
|
28
|
+
if (effectiveDisabled) return;
|
|
29
|
+
const nativeEvent = event.nativeEvent;
|
|
30
|
+
guardCheckableChange(nativeEvent, () => activate(nativeEvent), component);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
export { groupMemberProps };
|
|
36
|
+
|
|
37
|
+
//# sourceMappingURL=group-member.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"group-member.mjs","names":[],"sources":["../../src/internal/group-member.ts"],"sourcesContent":["\"use client\";\nimport type { ChangeEvent, ComponentPropsWithRef } from \"react\";\nimport { dataAttr } from \"./data-attr.js\";\nimport type { DataAttributes } from \"./render-element.js\";\nimport { guardCheckableChange } from \"./use-native-checked.js\";\n\nexport interface GroupMemberPropsOptions {\n readonly type: \"radio\" | \"checkbox\";\n /** Dispatch-guard name (`\"RadioGroup.Item\"`). */\n readonly component: string;\n /** The group's shared `name` and `form`. */\n readonly name: string;\n readonly form: string | undefined;\n readonly value: string;\n readonly required: boolean;\n /** Optimistic. */\n readonly checked: boolean;\n readonly pending: boolean;\n /** Own `disabled` prop or the Root's: `data-disabled` and the click guard. */\n readonly effectiveDisabled: boolean;\n /** The member's own `disabled` prop only: the Root's reaches it through `<fieldset disabled>`. */\n readonly ownDisabled: boolean;\n /** CheckboxGroup inside a Field: the group's `aria-invalid` (the fieldset cannot carry it). */\n readonly invalid?: \"true\" | \"false\" | undefined;\n /** The user checked (radio) or toggled (checkbox) the input. */\n readonly activate: (event: Event) => void;\n}\n\n/**\n * The owned layer (conventions 1.2) of a group Item's `<input>`: `type`, the group's `name` /\n * `form`, `value`, `checked` (the optimistic state), `defaultChecked` (never rendered), a\n * checkbox's `aria-checked` (removed), `disabled`, `required`, the state `data-*` attributes,\n * and the guarded `onChange`.\n */\nexport function groupMemberProps(\n options: GroupMemberPropsOptions,\n): Partial<ComponentPropsWithRef<\"input\">> & DataAttributes {\n const { type, component, checked, pending, effectiveDisabled, invalid, activate } = options;\n return {\n type,\n name: options.name,\n value: options.value,\n checked,\n defaultChecked: undefined,\n ...(type === \"checkbox\" && { \"aria-checked\": undefined }),\n // Owned (Switch precedent) so that native disabledness, `data-disabled` and the click guard\n // agree. Only the Item's own prop: `Root disabled` reaches the input through the fieldset.\n disabled: options.ownDisabled,\n form: options.form,\n required: options.required,\n \"data-checked\": dataAttr(checked),\n \"data-pending\": dataAttr(pending),\n \"data-disabled\": dataAttr(effectiveDisabled),\n ...(invalid !== undefined && { \"aria-invalid\": invalid }),\n onChange: (event: ChangeEvent<HTMLInputElement>) => {\n // A natively disabled input fires no click; this covers `render` elements that do not\n // honour `disabled`.\n if (effectiveDisabled) return;\n const nativeEvent = event.nativeEvent;\n guardCheckableChange(nativeEvent, () => activate(nativeEvent), component);\n },\n };\n}\n"],"mappings":";;;;;;;;;;AAkCA,SAAgB,iBACd,SAC0D;CAC1D,MAAM,EAAE,MAAM,WAAW,SAAS,SAAS,mBAAmB,SAAS,aAAa;CACpF,OAAO;EACL;EACA,MAAM,QAAQ;EACd,OAAO,QAAQ;EACf;EACA,gBAAgB,KAAA;EAChB,GAAI,SAAS,cAAc,EAAE,gBAAgB,KAAA,EAAU;EAGvD,UAAU,QAAQ;EAClB,MAAM,QAAQ;EACd,UAAU,QAAQ;EAClB,gBAAgB,SAAS,OAAO;EAChC,gBAAgB,SAAS,OAAO;EAChC,iBAAiB,SAAS,iBAAiB;EAC3C,GAAI,YAAY,KAAA,KAAa,EAAE,gBAAgB,QAAQ;EACvD,WAAW,UAAyC;GAGlD,IAAI,mBAAmB;GACvB,MAAM,cAAc,MAAM;GAC1B,qBAAqB,mBAAmB,SAAS,WAAW,GAAG,SAAS;EAC1E;CACF;AACF"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { ToolbarContext } from "./toolbar-context.mjs";
|
|
3
|
+
import { useDevWarning } from "./use-dev-warning.mjs";
|
|
4
|
+
import { useExitAnimation } from "./use-exit-animation.mjs";
|
|
5
|
+
import { Activity, useRef, useState } from "react";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
//#region src/internal/overlay-popup.tsx
|
|
8
|
+
const isDev = process.env.NODE_ENV !== "production";
|
|
9
|
+
/**
|
|
10
|
+
* The children of a popup (Popover, Dialog, Menu, Combobox). JS-free mode: always rendered.
|
|
11
|
+
* Library mode: rendered while `visible`, or with `keepMounted` inside an `<Activity>` whose mode
|
|
12
|
+
* changes with committed state, inside the Root's transition (conventions 5.5). The content is
|
|
13
|
+
* not part of an enclosing Toolbar's sequence (the engine excludes `[popover]` and `dialog`), so
|
|
14
|
+
* parts inside it see no Toolbar. `children` is called only when rendered.
|
|
15
|
+
*/
|
|
16
|
+
function renderOverlayContent({ isLibrary, keepMounted, visible, wrapContent }, children) {
|
|
17
|
+
let node;
|
|
18
|
+
if (!isLibrary) node = children();
|
|
19
|
+
else if (keepMounted === true) node = /* @__PURE__ */ jsx(Activity, {
|
|
20
|
+
mode: visible ? "visible" : "hidden",
|
|
21
|
+
children: wrapContent(children())
|
|
22
|
+
});
|
|
23
|
+
else node = visible ? wrapContent(children()) : null;
|
|
24
|
+
return /* @__PURE__ */ jsx(ToolbarContext, {
|
|
25
|
+
value: null,
|
|
26
|
+
children: node
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* `held` for a popup (design/components/popover.md 4.4): the children stay mounted while the
|
|
31
|
+
* close animates. A library-driven close commits `false` first and hides in the layout effect,
|
|
32
|
+
* so without `transition` the children are held through the close commit ("previous value in
|
|
33
|
+
* state"). With `transition` the close commit unmounts them inside the view transition, whose old
|
|
34
|
+
* snapshot carries the content out.
|
|
35
|
+
*/
|
|
36
|
+
function useCloseHold(committed, isLibrary, transition) {
|
|
37
|
+
const exit = useExitAnimation();
|
|
38
|
+
const [prevCommitted, setPrevCommitted] = useState(committed);
|
|
39
|
+
if (prevCommitted !== committed) {
|
|
40
|
+
setPrevCommitted(committed);
|
|
41
|
+
if (isLibrary && prevCommitted && transition === void 0) exit.holdDuringRender();
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
...exit,
|
|
45
|
+
afterClose: (popup, echo) => {
|
|
46
|
+
if (echo && transition !== void 0) return;
|
|
47
|
+
const animations = exit.exitAnimations(popup);
|
|
48
|
+
if (animations.length > 0) exit.holdUntil(animations);
|
|
49
|
+
else exit.release();
|
|
50
|
+
},
|
|
51
|
+
releaseIfIdle: (isCommitted, awaitingClose, shown) => {
|
|
52
|
+
if (exit.held && !isCommitted && !exit.waiting() && !awaitingClose && !shown) exit.release();
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
/** The lower-cased `command` of a `command` event. */
|
|
57
|
+
function commandOf(event) {
|
|
58
|
+
return String(event.command ?? "").toLowerCase();
|
|
59
|
+
}
|
|
60
|
+
/** Resolves `initialFocus` against the popup (a ref, or a selector inside the popup). */
|
|
61
|
+
function resolveInitialFocus(popup, initialFocus) {
|
|
62
|
+
if (typeof initialFocus === "string") return popup.querySelector(initialFocus);
|
|
63
|
+
return initialFocus.current;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* `initialFocus` resolved right before a library open (design 6.1): the target, or `null` (the
|
|
67
|
+
* platform picks) without one, or when it resolves to nothing or outside the popup; those two
|
|
68
|
+
* warn once per instance in development. `noun` names the popup in the warning.
|
|
69
|
+
*/
|
|
70
|
+
function useInitialFocusTarget(part, noun) {
|
|
71
|
+
const warned = useRef(false);
|
|
72
|
+
return (popup, initialFocus) => {
|
|
73
|
+
if (initialFocus === void 0) return null;
|
|
74
|
+
const target = resolveInitialFocus(popup, initialFocus);
|
|
75
|
+
if (target !== null && popup.contains(target)) return target;
|
|
76
|
+
if (isDev && !warned.current) {
|
|
77
|
+
warned.current = true;
|
|
78
|
+
console.error(target === null ? `${part}: \`initialFocus\` resolved to no element; the platform picks the focus target.` : `${part}: \`initialFocus\` is outside the ${noun}; the platform picks the focus target.`);
|
|
79
|
+
}
|
|
80
|
+
return null;
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Design 6.2 rule 2, after a close that began with focus inside (or whose commit unmounted the
|
|
85
|
+
* focused content): when focus is now on `<body>` or still inside the hidden popup, focus the
|
|
86
|
+
* Trigger (connected, and `canFocus` when given), else blur what holds focus.
|
|
87
|
+
*/
|
|
88
|
+
function returnFocusToTrigger(popup, trigger, canFocus) {
|
|
89
|
+
const doc = popup.ownerDocument;
|
|
90
|
+
const active = doc.activeElement;
|
|
91
|
+
if (active !== null && active !== doc.body && !popup.contains(active)) return;
|
|
92
|
+
if (trigger !== null && trigger.isConnected && (canFocus === void 0 || canFocus(trigger))) trigger.focus();
|
|
93
|
+
else if (active instanceof HTMLElement && active !== doc.body) active.blur();
|
|
94
|
+
}
|
|
95
|
+
/** The development warnings for a Popup's library-only props in JS-free mode. */
|
|
96
|
+
function useJsFreePropWarnings(part, noun, isLibrary, transition, keepMounted) {
|
|
97
|
+
useDevWarning(!isLibrary && transition !== void 0, isDev && `${part}: \`transition\` has no effect in JS-free mode; the browser opens and closes the ${noun} outside any React transition. Animate it with CSS (\`@starting-style\`).`);
|
|
98
|
+
useDevWarning(!isLibrary && keepMounted === false, isDev && `${part}: \`keepMounted={false}\` cannot be honoured in JS-free mode; the content is always mounted so that the server HTML is complete.`);
|
|
99
|
+
}
|
|
100
|
+
//#endregion
|
|
101
|
+
export { commandOf, renderOverlayContent, resolveInitialFocus, returnFocusToTrigger, useCloseHold, useInitialFocusTarget, useJsFreePropWarnings };
|
|
102
|
+
|
|
103
|
+
//# sourceMappingURL=overlay-popup.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"overlay-popup.mjs","names":[],"sources":["../../src/internal/overlay-popup.tsx"],"sourcesContent":["\"use client\";\n// The pieces Dialog.Popup shares with usePopoverPopup (Popover, Menu, Combobox). The two stay\n// separate: Dialog has showModal / show, `close` / `cancel` / `submit` and light dismiss.\nimport { Activity, useRef, useState } from \"react\";\nimport type { ReactNode, RefObject, ViewTransitionClass } from \"react\";\nimport { ToolbarContext } from \"./toolbar-context.js\";\nimport { useDevWarning } from \"./use-dev-warning.js\";\nimport { useExitAnimation } from \"./use-exit-animation.js\";\nimport type { ExitAnimation } from \"./use-exit-animation.js\";\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\nexport interface OverlayContentOptions {\n readonly isLibrary: boolean;\n readonly keepMounted: boolean | undefined;\n /** Committed open, or held while the exit animates (design/components/popover.md 4.4). */\n readonly visible: boolean;\n readonly wrapContent: (children: ReactNode) => ReactNode;\n}\n\n/**\n * The children of a popup (Popover, Dialog, Menu, Combobox). JS-free mode: always rendered.\n * Library mode: rendered while `visible`, or with `keepMounted` inside an `<Activity>` whose mode\n * changes with committed state, inside the Root's transition (conventions 5.5). The content is\n * not part of an enclosing Toolbar's sequence (the engine excludes `[popover]` and `dialog`), so\n * parts inside it see no Toolbar. `children` is called only when rendered.\n */\nexport function renderOverlayContent(\n { isLibrary, keepMounted, visible, wrapContent }: OverlayContentOptions,\n children: () => ReactNode,\n): ReactNode {\n let node: ReactNode;\n if (!isLibrary) {\n node = children();\n } else if (keepMounted === true) {\n node = <Activity mode={visible ? \"visible\" : \"hidden\"}>{wrapContent(children())}</Activity>;\n } else {\n node = visible ? wrapContent(children()) : null;\n }\n return <ToolbarContext value={null}>{node}</ToolbarContext>;\n}\n\nexport interface CloseHold extends ExitAnimation {\n /**\n * The close's native event (`toggle` / `close`) arrived: hold the content until the exit\n * animations settle, or release a hold now when nothing animates (Firefox, or no CSS exit: the\n * popup is already `display: none`, the commit is invisible). Call before the notification, so\n * its commit keeps the children. Nothing for the library's own close (`echo`) with\n * `transition`: the close commit's view transition carried the content out.\n */\n readonly afterClose: (popup: Element, echo: boolean) => void;\n /**\n * The apply effect's release rule: a hold the close commit set (or a dismissal's notification\n * commit) that no exit animation is going to release, the popup being hidden and its close\n * event handled.\n */\n readonly releaseIfIdle: (committed: boolean, awaitingClose: boolean, shown: boolean) => void;\n}\n\n/**\n * `held` for a popup (design/components/popover.md 4.4): the children stay mounted while the\n * close animates. A library-driven close commits `false` first and hides in the layout effect,\n * so without `transition` the children are held through the close commit (\"previous value in\n * state\"). With `transition` the close commit unmounts them inside the view transition, whose old\n * snapshot carries the content out.\n */\nexport function useCloseHold(\n committed: boolean,\n isLibrary: boolean,\n transition: ViewTransitionClass | undefined,\n): CloseHold {\n const exit = useExitAnimation();\n const [prevCommitted, setPrevCommitted] = useState(committed);\n if (prevCommitted !== committed) {\n setPrevCommitted(committed);\n if (isLibrary && prevCommitted && transition === undefined) exit.holdDuringRender();\n }\n return {\n ...exit,\n afterClose: (popup, echo) => {\n if (echo && transition !== undefined) return;\n const animations = exit.exitAnimations(popup);\n if (animations.length > 0) exit.holdUntil(animations);\n else exit.release();\n },\n releaseIfIdle: (isCommitted, awaitingClose, shown) => {\n if (exit.held && !isCommitted && !exit.waiting() && !awaitingClose && !shown) {\n exit.release();\n }\n },\n };\n}\n\n/** The lower-cased `command` of a `command` event. */\nexport function commandOf(event: Event): string {\n return String((event as Event & { command?: string }).command ?? \"\").toLowerCase();\n}\n\n/** Resolves `initialFocus` against the popup (a ref, or a selector inside the popup). */\nexport function resolveInitialFocus(\n popup: HTMLElement,\n initialFocus: RefObject<HTMLElement | null> | string,\n): HTMLElement | null {\n if (typeof initialFocus === \"string\") return popup.querySelector<HTMLElement>(initialFocus);\n return initialFocus.current;\n}\n\nexport type InitialFocusTarget = (\n popup: HTMLElement,\n initialFocus: RefObject<HTMLElement | null> | string | undefined,\n) => HTMLElement | null;\n\n/**\n * `initialFocus` resolved right before a library open (design 6.1): the target, or `null` (the\n * platform picks) without one, or when it resolves to nothing or outside the popup; those two\n * warn once per instance in development. `noun` names the popup in the warning.\n */\nexport function useInitialFocusTarget(part: string, noun: string): InitialFocusTarget {\n const warned = useRef(false);\n return (popup, initialFocus) => {\n if (initialFocus === undefined) return null;\n const target = resolveInitialFocus(popup, initialFocus);\n if (target !== null && popup.contains(target)) return target;\n if (isDev && !warned.current) {\n warned.current = true;\n console.error(\n target === null\n ? `${part}: \\`initialFocus\\` resolved to no element; the platform picks the focus target.`\n : `${part}: \\`initialFocus\\` is outside the ${noun}; the platform picks the focus target.`,\n );\n }\n return null;\n };\n}\n\n/**\n * Design 6.2 rule 2, after a close that began with focus inside (or whose commit unmounted the\n * focused content): when focus is now on `<body>` or still inside the hidden popup, focus the\n * Trigger (connected, and `canFocus` when given), else blur what holds focus.\n */\nexport function returnFocusToTrigger(\n popup: HTMLElement,\n trigger: HTMLElement | null,\n canFocus?: (trigger: HTMLElement) => boolean,\n): void {\n const doc = popup.ownerDocument;\n const active = doc.activeElement;\n if (active !== null && active !== doc.body && !popup.contains(active)) return;\n if (trigger !== null && trigger.isConnected && (canFocus === undefined || canFocus(trigger))) {\n trigger.focus();\n } else if (active instanceof HTMLElement && active !== doc.body) {\n active.blur();\n }\n}\n\n/** The development warnings for a Popup's library-only props in JS-free mode. */\nexport function useJsFreePropWarnings(\n part: string,\n noun: string,\n isLibrary: boolean,\n transition: ViewTransitionClass | undefined,\n keepMounted: boolean | undefined,\n): void {\n useDevWarning(\n !isLibrary && transition !== undefined,\n isDev &&\n `${part}: \\`transition\\` has no effect in JS-free mode; the browser opens and closes the ` +\n `${noun} outside any React transition. Animate it with CSS (\\`@starting-style\\`).`,\n );\n useDevWarning(\n !isLibrary && keepMounted === false,\n isDev &&\n `${part}: \\`keepMounted={false}\\` cannot be honoured in JS-free mode; the content is ` +\n \"always mounted so that the server HTML is complete.\",\n );\n}\n"],"mappings":";;;;;;;AAUA,MAAM,QAAQ,QAAQ,IAAI,aAAa;;;;;;;;AAiBvC,SAAgB,qBACd,EAAE,WAAW,aAAa,SAAS,eACnC,UACW;CACX,IAAI;CACJ,IAAI,CAAC,WACH,OAAO,SAAS;MACX,IAAI,gBAAgB,MACzB,OAAO,oBAAC,UAAD;EAAU,MAAM,UAAU,YAAY;EAAW,UAAA,YAAY,SAAS,CAAC;CAAY,CAAA;MAE1F,OAAO,UAAU,YAAY,SAAS,CAAC,IAAI;CAE7C,OAAO,oBAAC,gBAAD;EAAgB,OAAO;EAAO,UAAA;CAAqB,CAAA;AAC5D;;;;;;;;AA0BA,SAAgB,aACd,WACA,WACA,YACW;CACX,MAAM,OAAO,iBAAiB;CAC9B,MAAM,CAAC,eAAe,oBAAoB,SAAS,SAAS;CAC5D,IAAI,kBAAkB,WAAW;EAC/B,iBAAiB,SAAS;EAC1B,IAAI,aAAa,iBAAiB,eAAe,KAAA,GAAW,KAAK,iBAAiB;CACpF;CACA,OAAO;EACL,GAAG;EACH,aAAa,OAAO,SAAS;GAC3B,IAAI,QAAQ,eAAe,KAAA,GAAW;GACtC,MAAM,aAAa,KAAK,eAAe,KAAK;GAC5C,IAAI,WAAW,SAAS,GAAG,KAAK,UAAU,UAAU;QAC/C,KAAK,QAAQ;EACpB;EACA,gBAAgB,aAAa,eAAe,UAAU;GACpD,IAAI,KAAK,QAAQ,CAAC,eAAe,CAAC,KAAK,QAAQ,KAAK,CAAC,iBAAiB,CAAC,OACrE,KAAK,QAAQ;EAEjB;CACF;AACF;;AAGA,SAAgB,UAAU,OAAsB;CAC9C,OAAO,OAAQ,MAAuC,WAAW,EAAE,CAAC,CAAC,YAAY;AACnF;;AAGA,SAAgB,oBACd,OACA,cACoB;CACpB,IAAI,OAAO,iBAAiB,UAAU,OAAO,MAAM,cAA2B,YAAY;CAC1F,OAAO,aAAa;AACtB;;;;;;AAYA,SAAgB,sBAAsB,MAAc,MAAkC;CACpF,MAAM,SAAS,OAAO,KAAK;CAC3B,QAAQ,OAAO,iBAAiB;EAC9B,IAAI,iBAAiB,KAAA,GAAW,OAAO;EACvC,MAAM,SAAS,oBAAoB,OAAO,YAAY;EACtD,IAAI,WAAW,QAAQ,MAAM,SAAS,MAAM,GAAG,OAAO;EACtD,IAAI,SAAS,CAAC,OAAO,SAAS;GAC5B,OAAO,UAAU;GACjB,QAAQ,MACN,WAAW,OACP,GAAG,KAAK,mFACR,GAAG,KAAK,oCAAoC,KAAK,uCACvD;EACF;EACA,OAAO;CACT;AACF;;;;;;AAOA,SAAgB,qBACd,OACA,SACA,UACM;CACN,MAAM,MAAM,MAAM;CAClB,MAAM,SAAS,IAAI;CACnB,IAAI,WAAW,QAAQ,WAAW,IAAI,QAAQ,CAAC,MAAM,SAAS,MAAM,GAAG;CACvE,IAAI,YAAY,QAAQ,QAAQ,gBAAgB,aAAa,KAAA,KAAa,SAAS,OAAO,IACxF,QAAQ,MAAM;MACT,IAAI,kBAAkB,eAAe,WAAW,IAAI,MACzD,OAAO,KAAK;AAEhB;;AAGA,SAAgB,sBACd,MACA,MACA,WACA,YACA,aACM;CACN,cACE,CAAC,aAAa,eAAe,KAAA,GAC7B,SACE,GAAG,KAAK,mFACH,KAAK,0EACd;CACA,cACE,CAAC,aAAa,gBAAgB,OAC9B,SACE,GAAG,KAAK,iIAEZ;AACF"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//#region src/internal/pointer-capture.ts
|
|
2
|
+
/**
|
|
3
|
+
* `setPointerCapture`, which throws `NotFoundError` for a pointer the engine no longer tracks
|
|
4
|
+
* (context-menu.md 2.1). A silent no-op when no button is down. `true` when the capture was
|
|
5
|
+
* taken (the Menu's press-drag-release gesture runs only then, 2.6). The Combobox Input uses it
|
|
6
|
+
* to keep a press on the field from light-dismissing the listbox (combobox.md 5.4, #123).
|
|
7
|
+
*/
|
|
8
|
+
function capturePointer(element, pointerId) {
|
|
9
|
+
if (element === null || pointerId === void 0) return false;
|
|
10
|
+
try {
|
|
11
|
+
element.setPointerCapture(pointerId);
|
|
12
|
+
return true;
|
|
13
|
+
} catch {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
export { capturePointer };
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=pointer-capture.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pointer-capture.mjs","names":[],"sources":["../../src/internal/pointer-capture.ts"],"sourcesContent":["// No directive: a pure DOM call (conventions 7.1).\n\n/**\n * `setPointerCapture`, which throws `NotFoundError` for a pointer the engine no longer tracks\n * (context-menu.md 2.1). A silent no-op when no button is down. `true` when the capture was\n * taken (the Menu's press-drag-release gesture runs only then, 2.6). The Combobox Input uses it\n * to keep a press on the field from light-dismissing the listbox (combobox.md 5.4, #123).\n */\nexport function capturePointer(element: Element | null, pointerId: number | undefined): boolean {\n if (element === null || pointerId === undefined) return false;\n try {\n element.setPointerCapture(pointerId);\n return true;\n } catch {\n // Not an active pointer (a synthetic event, a released button): nothing to capture.\n return false;\n }\n}\n"],"mappings":";;;;;;;AAQA,SAAgB,eAAe,SAAyB,WAAwC;CAC9F,IAAI,YAAY,QAAQ,cAAc,KAAA,GAAW,OAAO;CACxD,IAAI;EACF,QAAQ,kBAAkB,SAAS;EACnC,OAAO;CACT,QAAQ;EAEN,OAAO;CACT;AACF"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
//#region src/internal/popover-open.ts
|
|
2
|
+
/**
|
|
3
|
+
* Whether `element` is a showing popover (`:popover-open`). `false` for `null` and where the
|
|
4
|
+
* selector is unsupported (it throws there, for example on a `render` element in an engine
|
|
5
|
+
* without the Popover API).
|
|
6
|
+
*/
|
|
7
|
+
function isPopoverOpen(element) {
|
|
8
|
+
if (element === null) return false;
|
|
9
|
+
try {
|
|
10
|
+
return element.matches(":popover-open");
|
|
11
|
+
} catch {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
export { isPopoverOpen };
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=popover-open.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"popover-open.mjs","names":[],"sources":["../../src/internal/popover-open.ts"],"sourcesContent":["// No directive: a pure DOM read (conventions 7.1).\n\n/**\n * Whether `element` is a showing popover (`:popover-open`). `false` for `null` and where the\n * selector is unsupported (it throws there, for example on a `render` element in an engine\n * without the Popover API).\n */\nexport function isPopoverOpen(element: Element | null): boolean {\n if (element === null) return false;\n try {\n return element.matches(\":popover-open\");\n } catch {\n return false;\n }\n}\n"],"mappings":";;;;;;AAOA,SAAgB,cAAc,SAAkC;CAC9D,IAAI,YAAY,MAAM,OAAO;CAC7B,IAAI;EACF,OAAO,QAAQ,QAAQ,eAAe;CACxC,QAAQ;EACN,OAAO;CACT;AACF"}
|