@astryxdesign/core 0.7.17 → 0.7.18-canary.g170df15
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/AlertDialog/AlertDialog.d.ts.map +1 -1
- package/dist/AlertDialog/AlertDialog.js +7 -0
- package/dist/AppShell/AppShell.d.ts.map +1 -1
- package/dist/AppShell/AppShell.js +5 -3
- package/dist/AppShell/observeMainOverflow.d.ts +5 -0
- package/dist/AppShell/observeMainOverflow.d.ts.map +1 -1
- package/dist/AppShell/observeMainOverflow.js +39 -9
- package/dist/BottomSheet/BottomSheet.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheet.js +8 -0
- package/dist/BottomSheet/useSheetGestures.d.ts +8 -0
- package/dist/BottomSheet/useSheetGestures.d.ts.map +1 -1
- package/dist/BottomSheet/useSheetGestures.js +16 -1
- package/dist/Button/Button.d.ts.map +1 -1
- package/dist/Button/Button.js +3 -16
- package/dist/Card/Card.d.ts.map +1 -1
- package/dist/Card/Card.js +5 -1
- package/dist/Citation/Citation.d.ts.map +1 -1
- package/dist/Citation/Citation.js +2 -2
- package/dist/ClickableCard/ClickableCard.d.ts.map +1 -1
- package/dist/ClickableCard/ClickableCard.js +7 -2
- package/dist/DateInput/DateInput.d.ts +0 -3
- package/dist/DateInput/DateInput.d.ts.map +1 -1
- package/dist/DateInput/DateInput.js +3 -5
- package/dist/DateInput/NativeDateField.d.ts.map +1 -1
- package/dist/DateInput/NativeDateField.js +3 -5
- package/dist/DateInput/TouchDateField.d.ts.map +1 -1
- package/dist/DateInput/TouchDateField.js +2 -4
- package/dist/DateInput/useTypedDate.d.ts.map +1 -1
- package/dist/DateInput/useTypedDate.js +9 -6
- package/dist/DateRangeInput/DateRangeInput.d.ts.map +1 -1
- package/dist/DateRangeInput/DateRangeInput.js +13 -9
- package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
- package/dist/DateTimeInput/DateTimeInput.js +3 -15
- package/dist/DateTimeInput/TouchDateTimeField.d.ts.map +1 -1
- package/dist/DateTimeInput/TouchDateTimeField.js +2 -14
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +7 -1
- package/dist/Drawer/Drawer.d.ts.map +1 -1
- package/dist/Drawer/Drawer.js +7 -0
- package/dist/Field/Field.d.ts.map +1 -1
- package/dist/Field/Field.js +2 -1
- package/dist/Field/FieldLabel.d.ts.map +1 -1
- package/dist/Field/FieldLabel.js +9 -2
- package/dist/Field/InputClearButton.d.ts.map +1 -1
- package/dist/Field/InputClearButton.js +23 -0
- package/dist/Field/inputStyles.stylex.d.ts +22 -6
- package/dist/Field/inputStyles.stylex.d.ts.map +1 -1
- package/dist/Field/inputStyles.stylex.js +32 -0
- package/dist/FieldStatus/FieldStatus.d.ts.map +1 -1
- package/dist/FieldStatus/FieldStatus.js +7 -2
- package/dist/FileInput/FileInput.d.ts.map +1 -1
- package/dist/FileInput/FileInput.js +4 -4
- package/dist/InputGroup/InputGroup.d.ts.map +1 -1
- package/dist/InputGroup/InputGroup.js +6 -16
- package/dist/InputGroup/InputGroupText.d.ts.map +1 -1
- package/dist/InputGroup/InputGroupText.js +2 -8
- package/dist/Item/Item.d.ts.map +1 -1
- package/dist/Item/Item.js +8 -2
- package/dist/Kbd/Kbd.d.ts +3 -2
- package/dist/Kbd/Kbd.d.ts.map +1 -1
- package/dist/Kbd/Kbd.js +3 -2
- package/dist/Layer/gestureCounter.d.ts +5 -0
- package/dist/Layer/gestureCounter.d.ts.map +1 -1
- package/dist/Layer/gestureCounter.js +40 -4
- package/dist/Layer/inputHold.d.ts +13 -0
- package/dist/Layer/inputHold.d.ts.map +1 -1
- package/dist/Layer/inputHold.js +203 -14
- package/dist/Layer/layerHost.d.ts +3 -2
- package/dist/Layer/layerHost.d.ts.map +1 -1
- package/dist/Layer/layerHost.js +3 -2
- package/dist/Layer/outsidePanClaim.d.ts +17 -0
- package/dist/Layer/outsidePanClaim.d.ts.map +1 -1
- package/dist/Layer/outsidePanClaim.js +36 -8
- package/dist/Layer/outsidePress.d.ts +7 -1
- package/dist/Layer/outsidePress.d.ts.map +1 -1
- package/dist/Layer/outsidePress.js +9 -2
- package/dist/Layer/useLayer.d.ts +21 -5
- package/dist/Layer/useLayer.d.ts.map +1 -1
- package/dist/Layer/useLayer.js +63 -40
- package/dist/Lightbox/Lightbox.d.ts.map +1 -1
- package/dist/Lightbox/Lightbox.js +7 -0
- package/dist/MetadataList/MetadataList.d.ts +1 -1
- package/dist/MetadataList/MetadataList.d.ts.map +1 -1
- package/dist/MetadataList/MetadataList.js +8 -0
- package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
- package/dist/MultiSelector/MultiSelector.js +37 -17
- package/dist/NavIcon/NavIcon.d.ts +2 -2
- package/dist/NavIcon/NavIcon.d.ts.map +1 -1
- package/dist/NavIcon/NavIcon.js +2 -2
- package/dist/NavMenu/NavHeadingMenuItem.d.ts.map +1 -1
- package/dist/NavMenu/NavHeadingMenuItem.js +4 -3
- package/dist/NumberInput/NumberInput.d.ts +13 -5
- package/dist/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/NumberInput/NumberInput.js +6 -17
- package/dist/NumberInput/numberParser.d.ts +9 -2
- package/dist/NumberInput/numberParser.d.ts.map +1 -1
- package/dist/NumberInput/numberParser.js +15 -2
- package/dist/Overlay/OverlayScrim.d.ts.map +1 -1
- package/dist/Overlay/OverlayScrim.js +13 -4
- package/dist/Overlay/useOverlay.d.ts +1 -1
- package/dist/Pagination/Pagination.d.ts +3 -2
- package/dist/Pagination/Pagination.d.ts.map +1 -1
- package/dist/Pagination/Pagination.js +9 -2
- package/dist/Popover/usePopover.d.ts +37 -6
- package/dist/Popover/usePopover.d.ts.map +1 -1
- package/dist/Popover/usePopover.js +103 -20
- package/dist/PowerSearch/PowerSearch.d.ts +4 -1
- package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearch.js +3 -4
- package/dist/PowerSearch/PowerSearchBottomSheet.d.ts +1 -2
- package/dist/PowerSearch/PowerSearchBottomSheet.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchBottomSheet.js +173 -185
- package/dist/PowerSearch/PowerSearchValueEditor.d.ts +0 -12
- package/dist/PowerSearch/PowerSearchValueEditor.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchValueEditor.js +1 -51
- package/dist/PowerSearch/formatFilterValue.d.ts.map +1 -1
- package/dist/PowerSearch/formatFilterValue.js +6 -8
- package/dist/PowerSearch/formatTokenValue.d.ts +5 -10
- package/dist/PowerSearch/formatTokenValue.d.ts.map +1 -1
- package/dist/PowerSearch/formatTokenValue.js +21 -38
- package/dist/PowerSearch/relativeDateOptions.d.ts +30 -0
- package/dist/PowerSearch/relativeDateOptions.d.ts.map +1 -0
- package/dist/PowerSearch/relativeDateOptions.js +74 -0
- package/dist/ProgressBar/ProgressBar.d.ts +1 -1
- package/dist/ProgressBar/ProgressBar.d.ts.map +1 -1
- package/dist/ProgressBar/ProgressBar.js +20 -14
- package/dist/Resizable/createResizable.d.ts.map +1 -1
- package/dist/Resizable/createResizable.js +38 -4
- package/dist/SegmentedControl/SegmentedControlItem.d.ts.map +1 -1
- package/dist/SegmentedControl/SegmentedControlItem.js +5 -3
- package/dist/SelectableCard/SelectableCard.d.ts.map +1 -1
- package/dist/SelectableCard/SelectableCard.js +6 -2
- package/dist/Selector/Selector.d.ts.map +1 -1
- package/dist/Selector/Selector.js +2 -1
- package/dist/SideNav/SideNavItem.d.ts.map +1 -1
- package/dist/SideNav/SideNavItem.js +1 -1
- package/dist/Slider/Slider.d.ts.map +1 -1
- package/dist/Slider/Slider.js +53 -8
- package/dist/Stepper/Step.d.ts.map +1 -1
- package/dist/Stepper/Step.js +2 -2
- package/dist/TabList/Tab.d.ts.map +1 -1
- package/dist/TabList/Tab.js +2 -0
- package/dist/TabList/TabMenu.d.ts.map +1 -1
- package/dist/TabList/TabMenu.js +2 -0
- package/dist/Table/BaseTable.d.ts.map +1 -1
- package/dist/Table/BaseTable.js +30 -8
- package/dist/Table/Table.d.ts +9 -4
- package/dist/Table/Table.d.ts.map +1 -1
- package/dist/Table/Table.js +9 -4
- package/dist/Table/TableHeaderCell.d.ts.map +1 -1
- package/dist/Table/TableHeaderCell.js +3 -7
- package/dist/Table/plugins/rowIndex/useTableRowIndex.d.ts.map +1 -1
- package/dist/Table/plugins/rowIndex/useTableRowIndex.js +4 -1
- package/dist/Table/plugins/rowStatus/useTableRowStatus.d.ts.map +1 -1
- package/dist/Table/plugins/rowStatus/useTableRowStatus.js +2 -0
- package/dist/Table/plugins/sortable/useTableSortable.d.ts.map +1 -1
- package/dist/Table/plugins/sortable/useTableSortable.js +18 -1
- package/dist/Table/plugins/stickyColumns/useTableStickyColumns.d.ts.map +1 -1
- package/dist/Table/plugins/stickyColumns/useTableStickyColumns.js +34 -24
- package/dist/Table/tableColumnAdmission.d.ts +7 -0
- package/dist/Table/tableColumnAdmission.d.ts.map +1 -1
- package/dist/Table/tableColumnAdmission.js +15 -0
- package/dist/Table/types.d.ts +5 -5
- package/dist/Text/Text.d.ts.map +1 -1
- package/dist/Text/Text.js +13 -8
- package/dist/Text/TruncationTooltip.d.ts +7 -39
- package/dist/Text/TruncationTooltip.d.ts.map +1 -1
- package/dist/Text/TruncationTooltip.js +47 -128
- package/dist/Text/cutText.d.ts +22 -0
- package/dist/Text/cutText.d.ts.map +1 -0
- package/dist/Text/cutText.js +92 -0
- package/dist/Text/cutTextOnKeyboardFocus.d.ts +41 -0
- package/dist/Text/cutTextOnKeyboardFocus.d.ts.map +1 -0
- package/dist/Text/cutTextOnKeyboardFocus.js +112 -0
- package/dist/Text/textClampContext.d.ts +1 -0
- package/dist/Text/textClampContext.d.ts.map +1 -1
- package/dist/Text/textClampContext.js +10 -5
- package/dist/Text/useTruncation.d.ts +23 -1
- package/dist/Text/useTruncation.d.ts.map +1 -1
- package/dist/Text/useTruncation.js +74 -28
- package/dist/TextInput/TextInput.d.ts +6 -6
- package/dist/Thumbnail/Thumbnail.js +4 -1
- package/dist/TimeInput/TimeInput.d.ts +0 -3
- package/dist/TimeInput/TimeInput.d.ts.map +1 -1
- package/dist/TimeInput/TimeInput.js +3 -5
- package/dist/TimeInput/TouchTimeField.d.ts.map +1 -1
- package/dist/TimeInput/TouchTimeField.js +3 -5
- package/dist/Timestamp/Timestamp.d.ts.map +1 -1
- package/dist/Timestamp/Timestamp.js +22 -16
- package/dist/Timestamp/TimestampHoverCard.d.ts +6 -3
- package/dist/Timestamp/TimestampHoverCard.d.ts.map +1 -1
- package/dist/Timestamp/TimestampHoverCard.js +30 -19
- package/dist/Timestamp/formatInstant.d.ts.map +1 -1
- package/dist/Timestamp/formatInstant.js +3 -3
- package/dist/Timestamp/tooltipEntries.d.ts.map +1 -1
- package/dist/Timestamp/tooltipEntries.js +4 -2
- package/dist/Toast/Toast.d.ts.map +1 -1
- package/dist/Toast/Toast.js +62 -31
- package/dist/Toast/ToastViewport.d.ts.map +1 -1
- package/dist/Toast/ToastViewport.js +35 -13
- package/dist/Toast/useToast.d.ts.map +1 -1
- package/dist/Toast/useToast.js +35 -14
- package/dist/Tooltip/useTooltip.d.ts.map +1 -1
- package/dist/Tooltip/useTooltip.js +3 -3
- package/dist/astryx.css +38 -8
- package/dist/hooks/useAnnounceRenderedText.d.ts +10 -3
- package/dist/hooks/useAnnounceRenderedText.d.ts.map +1 -1
- package/dist/hooks/useAnnounceRenderedText.js +11 -3
- package/dist/hooks/useFocusTrap.d.ts +12 -0
- package/dist/hooks/useFocusTrap.d.ts.map +1 -1
- package/dist/hooks/useFocusTrap.js +13 -6
- package/dist/hooks/useHotkeys.d.ts +9 -1
- package/dist/hooks/useHotkeys.d.ts.map +1 -1
- package/dist/hooks/useHotkeys.js +52 -2
- package/dist/hooks/useInputStatusIcon.d.ts.map +1 -1
- package/dist/hooks/useInputStatusIcon.js +2 -1
- package/dist/hooks/useKeyboardHint.d.ts.map +1 -1
- package/dist/hooks/useKeyboardHint.js +4 -3
- package/dist/i18n/generated-english/DateRangeInput/DateRangeInput.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/DateRangeInput/DateRangeInput.generated.js +2 -0
- package/dist/i18n/generated-english/MultiSelector/MultiSelector.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/MultiSelector/MultiSelector.generated.js +1 -0
- package/dist/i18n/generated-english/PowerSearch/PowerSearchValueEditor.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/PowerSearch/PowerSearchValueEditor.generated.js +0 -6
- package/dist/i18n/generated-english/PowerSearch/relativeDateOptions.generated.d.ts +8 -0
- package/dist/i18n/generated-english/PowerSearch/relativeDateOptions.generated.d.ts.map +1 -0
- package/dist/i18n/generated-english/PowerSearch/relativeDateOptions.generated.js +17 -0
- package/dist/i18n/generated-english/Slider/Slider.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/Slider/Slider.generated.js +1 -0
- package/dist/i18n/generated-english/Thumbnail/Thumbnail.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/Thumbnail/Thumbnail.generated.js +1 -0
- package/dist/i18n/generated-locales/en.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/en.generated.js +5 -0
- package/dist/i18n/generated-locales/pseudo.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/pseudo.generated.js +5 -0
- package/dist/i18n/getLocaleDirection.d.ts +0 -16
- package/dist/i18n/getLocaleDirection.d.ts.map +1 -1
- package/dist/i18n/getLocaleDirection.js +16 -6
- package/dist/i18n/listFormat.d.ts +34 -0
- package/dist/i18n/listFormat.d.ts.map +1 -0
- package/dist/i18n/listFormat.js +45 -0
- package/dist/i18n/useListFormatter.d.ts +7 -3
- package/dist/i18n/useListFormatter.d.ts.map +1 -1
- package/dist/i18n/useListFormatter.js +16 -13
- package/dist/internal/module-loader.d.ts +15 -0
- package/dist/internal/module-loader.d.ts.map +1 -0
- package/dist/internal/module-loader.js +15 -0
- package/dist/motion/animatedLayout.d.ts +6 -0
- package/dist/motion/animatedLayout.d.ts.map +1 -1
- package/dist/motion/animatedLayout.js +201 -27
- package/dist/palette/color.d.ts +16 -0
- package/dist/palette/color.d.ts.map +1 -1
- package/dist/palette/color.js +37 -1
- package/dist/palette/derive-look.d.ts +235 -0
- package/dist/palette/derive-look.d.ts.map +1 -0
- package/dist/palette/derive-look.js +879 -0
- package/dist/palette/editor-look.d.ts +41 -0
- package/dist/palette/editor-look.d.ts.map +1 -0
- package/dist/palette/editor-look.js +401 -0
- package/dist/palette/mapping.d.ts +99 -6
- package/dist/palette/mapping.d.ts.map +1 -1
- package/dist/palette/mapping.js +68 -11
- package/dist/theme/tokens.d.ts +1 -1
- package/dist/theme/tokens.d.ts.map +1 -1
- package/dist/theme/tokens.js +1 -1
- package/dist/utils/characters.d.ts.map +1 -1
- package/dist/utils/characters.js +7 -0
- package/dist/utils/devWarning.d.ts +18 -0
- package/dist/utils/devWarning.d.ts.map +1 -1
- package/dist/utils/devWarning.js +30 -0
- package/dist/utils/focusReturn.d.ts +2 -0
- package/dist/utils/focusReturn.d.ts.map +1 -1
- package/dist/utils/focusReturn.js +3 -8
- package/dist/utils/hitArea.d.ts +4 -1
- package/dist/utils/hitArea.d.ts.map +1 -1
- package/dist/utils/hitArea.js +72 -9
- package/dist/utils/mergeProps.d.ts.map +1 -1
- package/dist/utils/mergeProps.js +53 -38
- package/dist/utils/scrollView.d.ts +2 -2
- package/dist/utils/scrollView.d.ts.map +1 -1
- package/dist/utils/scrollView.js +3 -3
- package/dist/utils/textDirection.d.ts +29 -5
- package/dist/utils/textDirection.d.ts.map +1 -1
- package/dist/utils/textDirection.js +56 -4
- package/dist/utils/touchHitArea.d.ts.map +1 -1
- package/dist/utils/touchHitArea.js +4 -2
- package/dist/virtualization/useInlineListWindow.d.ts.map +1 -1
- package/dist/virtualization/useInlineListWindow.js +63 -4
- package/locales/en.json +26 -6
- package/locales/pseudo.json +15 -0
- package/package.json +10 -5
- package/src/AlertDialog/AlertDialog.tsx +15 -0
- package/src/AlertDialog/useImperativeAlertDialog.doc.mjs +7 -4
- package/src/AppShell/AppShell.tsx +6 -3
- package/src/AppShell/observeMainOverflow.ts +39 -9
- package/src/Badge/Badge.doc.mjs +3 -3
- package/src/BottomSheet/BottomSheet.tsx +15 -0
- package/src/BottomSheet/useSheetGestures.ts +26 -1
- package/src/Button/Button.tsx +3 -23
- package/src/Card/Card.doc.mjs +3 -3
- package/src/Card/Card.tsx +11 -6
- package/src/Chat/ChatSendButton.doc.mjs +6 -6
- package/src/Chat/ChatToolCalls.doc.mjs +1 -1
- package/src/CheckboxInput/CheckboxInput.doc.mjs +3 -3
- package/src/Citation/Citation.tsx +8 -2
- package/src/ClickableCard/ClickableCard.tsx +9 -2
- package/src/ComplexSelector/ComplexSelector.doc.mjs +3 -3
- package/src/ContextMenu/ContextMenuItem.doc.mjs +3 -3
- package/src/DateInput/DateInput.tsx +2 -4
- package/src/DateInput/NativeDateField.tsx +5 -4
- package/src/DateInput/TouchDateField.tsx +2 -3
- package/src/DateInput/useTypedDate.ts +13 -6
- package/src/DateRangeInput/DateRangeInput.tsx +14 -10
- package/src/DateTimeInput/DateTimeInput.tsx +2 -12
- package/src/DateTimeInput/TouchDateTimeField.tsx +2 -11
- package/src/Dialog/Dialog.tsx +15 -1
- package/src/Dialog/useImperativeDialog.doc.mjs +7 -4
- package/src/Drawer/Drawer.tsx +15 -0
- package/src/DropdownMenu/DropdownMenu.doc.mjs +1 -1
- package/src/DropdownMenu/DropdownMenuCheckboxItem.doc.mjs +3 -3
- package/src/DropdownMenu/DropdownMenuItem.doc.mjs +3 -3
- package/src/DropdownMenu/DropdownMenuRadioItem.doc.mjs +3 -3
- package/src/DropdownMenu/DropdownMenuSubMenu.doc.mjs +2 -2
- package/src/Field/Field.doc.mjs +1 -1
- package/src/Field/Field.tsx +2 -1
- package/src/Field/FieldLabel.doc.mjs +3 -3
- package/src/Field/FieldLabel.tsx +11 -3
- package/src/Field/InputClearButton.tsx +27 -0
- package/src/Field/inputStyles.stylex.ts +53 -6
- package/src/FieldStatus/FieldStatus.tsx +7 -2
- package/src/FileInput/FileInput.tsx +12 -2
- package/src/Icon/Icon.doc.mjs +17 -14
- package/src/Icon/useIcon.doc.mjs +6 -6
- package/src/IconButton/IconButton.doc.mjs +2 -2
- package/src/InfoTip/InfoTip.doc.mjs +1 -1
- package/src/InputGroup/InputGroup.tsx +5 -12
- package/src/InputGroup/InputGroupText.tsx +2 -3
- package/src/Item/Item.tsx +10 -1
- package/src/Kbd/Kbd.doc.mjs +5 -5
- package/src/Kbd/Kbd.tsx +3 -2
- package/src/Layer/gestureCounter.ts +39 -3
- package/src/Layer/inputHold.ts +241 -18
- package/src/Layer/layerHost.ts +3 -2
- package/src/Layer/outsidePanClaim.ts +50 -8
- package/src/Layer/outsidePress.ts +18 -4
- package/src/Layer/useLayer.tsx +128 -76
- package/src/Lightbox/Lightbox.tsx +15 -0
- package/src/MetadataList/MetadataList.tsx +8 -0
- package/src/MoreMenu/MoreMenu.doc.mjs +1 -1
- package/src/MultiSelector/MultiSelector.doc.mjs +2 -2
- package/src/MultiSelector/MultiSelector.tsx +45 -15
- package/src/NavIcon/NavIcon.doc.mjs +19 -10
- package/src/NavIcon/NavIcon.tsx +3 -2
- package/src/NavMenu/NavHeadingMenuItem.tsx +9 -3
- package/src/NumberInput/NumberInput.doc.mjs +12 -12
- package/src/NumberInput/NumberInput.tsx +12 -15
- package/src/NumberInput/numberParser.ts +15 -2
- package/src/Overlay/Overlay.doc.mjs +13 -1
- package/src/Overlay/OverlayScrim.tsx +45 -15
- package/src/Overlay/useOverlay.doc.mjs +7 -7
- package/src/Overlay/useOverlay.tsx +1 -1
- package/src/Pagination/Pagination.doc.mjs +9 -6
- package/src/Pagination/Pagination.tsx +15 -3
- package/src/Popover/usePopover.doc.mjs +14 -4
- package/src/Popover/usePopover.tsx +180 -23
- package/src/PowerSearch/PowerSearch.doc.mjs +165 -15
- package/src/PowerSearch/PowerSearch.tsx +6 -8
- package/src/PowerSearch/PowerSearchBottomSheet.tsx +182 -223
- package/src/PowerSearch/PowerSearchValueEditor.tsx +1 -51
- package/src/PowerSearch/formatFilterValue.ts +8 -9
- package/src/PowerSearch/formatTokenValue.ts +24 -42
- package/src/PowerSearch/relativeDateOptions.ts +84 -0
- package/src/ProgressBar/ProgressBar.doc.mjs +24 -5
- package/src/ProgressBar/ProgressBar.tsx +28 -18
- package/src/Resizable/createResizable.ts +46 -5
- package/src/SegmentedControl/SegmentedControlItem.tsx +4 -3
- package/src/SelectableCard/SelectableCard.tsx +8 -2
- package/src/Selector/Selector.doc.mjs +3 -3
- package/src/Selector/Selector.tsx +3 -1
- package/src/Selector/SelectorOption.doc.mjs +3 -3
- package/src/SideNav/SideNavItem.doc.mjs +6 -6
- package/src/SideNav/SideNavItem.tsx +3 -0
- package/src/Slider/Slider.tsx +48 -6
- package/src/Stepper/Step.tsx +7 -1
- package/src/Switch/Switch.doc.mjs +3 -3
- package/src/TabList/Tab.tsx +4 -0
- package/src/TabList/TabMenu.tsx +4 -0
- package/src/Table/BaseTable.tsx +35 -7
- package/src/Table/Table.doc.mjs +56 -6
- package/src/Table/Table.tsx +9 -4
- package/src/Table/TableHeaderCell.tsx +2 -8
- package/src/Table/plugins/rowIndex/useTableRowIndex.tsx +10 -1
- package/src/Table/plugins/rowStatus/useTableRowStatus.tsx +5 -0
- package/src/Table/plugins/sortable/useTableSortable.tsx +41 -2
- package/src/Table/plugins/stickyColumns/useTableStickyColumns.tsx +49 -20
- package/src/Table/tableColumnAdmission.ts +23 -0
- package/src/Table/types.ts +5 -5
- package/src/Table/useTableRowsVirtualization.doc.mjs +2 -2
- package/src/Text/Text.tsx +21 -7
- package/src/Text/TruncationTooltip.tsx +51 -184
- package/src/Text/cutText.tsx +126 -0
- package/src/Text/cutTextOnKeyboardFocus.tsx +158 -0
- package/src/Text/textClampContext.ts +14 -4
- package/src/Text/useTruncation.ts +85 -27
- package/src/TextArea/TextArea.doc.mjs +4 -4
- package/src/TextInput/TextInput.doc.mjs +3 -3
- package/src/Thumbnail/Thumbnail.tsx +1 -1
- package/src/TimeInput/TimeInput.tsx +3 -9
- package/src/TimeInput/TouchTimeField.tsx +6 -4
- package/src/Timestamp/Timestamp.tsx +29 -21
- package/src/Timestamp/TimestampHoverCard.tsx +44 -31
- package/src/Timestamp/formatInstant.ts +7 -3
- package/src/Timestamp/tooltipEntries.ts +4 -2
- package/src/Toast/Toast.doc.mjs +24 -37
- package/src/Toast/Toast.tsx +77 -29
- package/src/Toast/ToastViewport.tsx +33 -13
- package/src/Toast/useToast.tsx +42 -15
- package/src/Tokenizer/Tokenizer.doc.mjs +2 -2
- package/src/Tooltip/useTooltip.tsx +2 -1
- package/src/TopNav/TopNavMegaMenu.doc.mjs +13 -0
- package/src/TopNav/TopNavMenu.doc.mjs +2 -0
- package/src/Typeahead/Typeahead.doc.mjs +2 -2
- package/src/hooks/useAnnounceRenderedText.ts +15 -2
- package/src/hooks/useFocusTrap.ts +27 -4
- package/src/hooks/useHotkeys.doc.mjs +54 -11
- package/src/hooks/useHotkeys.ts +72 -3
- package/src/hooks/useInputStatusIcon.tsx +2 -1
- package/src/hooks/useKeyboardHint.tsx +3 -2
- package/src/i18n/generated-english/DateRangeInput/DateRangeInput.generated.ts +2 -0
- package/src/i18n/generated-english/MultiSelector/MultiSelector.generated.ts +1 -0
- package/src/i18n/generated-english/PowerSearch/PowerSearchValueEditor.generated.ts +0 -6
- package/src/i18n/generated-english/PowerSearch/relativeDateOptions.generated.ts +18 -0
- package/src/i18n/generated-english/Slider/Slider.generated.ts +1 -0
- package/src/i18n/generated-english/Thumbnail/Thumbnail.generated.ts +1 -0
- package/src/i18n/generated-locales/en.generated.ts +5 -0
- package/src/i18n/generated-locales/pseudo.generated.ts +5 -0
- package/src/i18n/getLocaleDirection.ts +57 -7
- package/src/i18n/listFormat.ts +55 -0
- package/src/i18n/useListFormatter.ts +22 -13
- package/src/internal/module-loader.ts +15 -0
- package/src/motion/animatedLayout.ts +215 -28
- package/src/palette/color.ts +41 -1
- package/src/palette/derive-look.ts +1186 -0
- package/src/palette/editor-look.ts +480 -0
- package/src/palette/mapping.ts +129 -15
- package/src/theme/SyntaxTheme.doc.mjs +1 -1
- package/src/theme/tokens.ts +2 -1
- package/src/theme/useThemeName.doc.mjs +1 -1
- package/src/utils/characters.ts +11 -0
- package/src/utils/devWarning.ts +35 -0
- package/src/utils/focusReturn.ts +3 -11
- package/src/utils/hitArea.ts +87 -18
- package/src/utils/mergeProps.ts +57 -34
- package/src/utils/scrollView.ts +3 -2
- package/src/utils/textDirection.ts +65 -5
- package/src/utils/touchHitArea.ts +3 -2
- package/src/virtualization/useInlineListWindow.ts +102 -11
package/src/palette/mapping.ts
CHANGED
|
@@ -11,7 +11,15 @@
|
|
|
11
11
|
* generated copy
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
import {
|
|
14
|
+
import {
|
|
15
|
+
compositeOver,
|
|
16
|
+
contrastRatio,
|
|
17
|
+
hexToOklch,
|
|
18
|
+
normalizeColor,
|
|
19
|
+
ratioDown,
|
|
20
|
+
} from './color';
|
|
21
|
+
|
|
22
|
+
export {compositeOver};
|
|
15
23
|
import {
|
|
16
24
|
PALETTE_BLACK,
|
|
17
25
|
PALETTE_WHITE,
|
|
@@ -19,9 +27,10 @@ import {
|
|
|
19
27
|
perceptualDelta,
|
|
20
28
|
} from './generator';
|
|
21
29
|
import type {TonalPaletteCandidate, TonalPaletteGenerationInput} from './types';
|
|
30
|
+
import type {EditorLookResult, PaletteEditorRules} from './editor-look';
|
|
22
31
|
|
|
23
32
|
export type PaletteMode = 'light' | 'dark';
|
|
24
|
-
type ColorTriple = [number, number, number];
|
|
33
|
+
export type ColorTriple = [number, number, number];
|
|
25
34
|
|
|
26
35
|
/** One token pointed at a palette stop in one mode. */
|
|
27
36
|
export interface StopRef {
|
|
@@ -34,6 +43,8 @@ export interface StopRef {
|
|
|
34
43
|
family?: string;
|
|
35
44
|
/** The stop holds the seed's exact color (an exact anchor). */
|
|
36
45
|
exact?: boolean;
|
|
46
|
+
/** The half is the base theme's own value in that mode (family `literal`): the generated module reads it from the base, so the mode follows the base theme. */
|
|
47
|
+
base?: boolean;
|
|
37
48
|
}
|
|
38
49
|
|
|
39
50
|
/** One contrast check behind a stop choice. */
|
|
@@ -82,8 +93,20 @@ export interface PaletteBase {
|
|
|
82
93
|
/** What the mapping reads around the palette. */
|
|
83
94
|
export interface PaletteMappingContext {
|
|
84
95
|
base?: PaletteBase;
|
|
96
|
+
/**
|
|
97
|
+
* The theme editor's own rules, beyond `themePalette()`'s mapping: the
|
|
98
|
+
* colors a look grows (category and chart colors, the status roles a
|
|
99
|
+
* theme leaves unset, code colors) and a base theme's own pairs kept
|
|
100
|
+
* readable for those colors. They never change a token
|
|
101
|
+
* `themePalette()` maps. The editor passes its own rules module
|
|
102
|
+
* (editor-look) here, so an app that imports only `themePalette()` ships
|
|
103
|
+
* none of them.
|
|
104
|
+
*/
|
|
105
|
+
editor?: PaletteEditorRules;
|
|
85
106
|
/** Whether a token exists, so the mapping sets it. */
|
|
86
107
|
has: (token: string) => boolean;
|
|
108
|
+
/** Core's default value of each token, as written: a token the official theme leaves to Core follows the family at Core's lightness. */
|
|
109
|
+
defaults?: Readonly<Record<string, unknown>>;
|
|
87
110
|
reader: PaletteColorReader;
|
|
88
111
|
/** The value a token is set to exactly in a mode, as written. */
|
|
89
112
|
settingOf?: (token: string, mode: PaletteMode) => string | undefined;
|
|
@@ -93,17 +116,23 @@ export interface PaletteMappingContext {
|
|
|
93
116
|
setExactly?: (token: string) => boolean;
|
|
94
117
|
/** The line that sets a value, for a note that offers one; without it, the note offers none. */
|
|
95
118
|
setLine?: (thing: string, value: string, mode?: PaletteMode) => string;
|
|
119
|
+
/** The modes the theme shows: the derived colors' notes name only these. */
|
|
120
|
+
shown?: ReadonlyArray<PaletteMode>;
|
|
96
121
|
}
|
|
97
122
|
|
|
98
123
|
/** One color setting: a palette family of the same id. */
|
|
99
124
|
export interface PaletteDial {
|
|
100
125
|
id: string;
|
|
101
126
|
seed: string;
|
|
127
|
+
/** Set for one mode only (an accent token): the editor keeps the other mode as it was. */
|
|
128
|
+
only?: PaletteMode;
|
|
102
129
|
}
|
|
103
130
|
|
|
104
131
|
/** A family of a palette config: the generator's family input, and any key of the author's. */
|
|
105
132
|
export interface ConfigFamily {
|
|
106
133
|
id?: unknown;
|
|
134
|
+
/** The family's name, as a look's own family carries it. */
|
|
135
|
+
name?: unknown;
|
|
107
136
|
seed?: unknown;
|
|
108
137
|
anchors?: {mode: string; stop: number; [key: string]: unknown}[];
|
|
109
138
|
[key: string]: unknown;
|
|
@@ -155,6 +184,35 @@ export interface PaletteMapping {
|
|
|
155
184
|
unread: Record<string, string>;
|
|
156
185
|
/** Lifted secondary text per background token of LIFT_PARTS, per mode; null without one. */
|
|
157
186
|
lift: Record<string, Partial<Record<PaletteMode, StopRef>>> | null;
|
|
187
|
+
/** Status fills someone red-weak or green-weak may not tell apart. */
|
|
188
|
+
cvd: {
|
|
189
|
+
a: string;
|
|
190
|
+
b: string;
|
|
191
|
+
vision: 'red-weak' | 'green-weak';
|
|
192
|
+
mode: PaletteMode;
|
|
193
|
+
colors: [string, string];
|
|
194
|
+
page?: string;
|
|
195
|
+
pages?: string[];
|
|
196
|
+
}[];
|
|
197
|
+
/** The code colors that keep the base theme's because none of their family's stops reads on the code background and the page. */
|
|
198
|
+
code: string[];
|
|
199
|
+
/** The look's colors kept at the base theme's in a mode, because a text/fill pair the base theme draws with them would not read. */
|
|
200
|
+
kept: {token: string; mode: PaletteMode; pair: BasePair; ratio: number}[];
|
|
201
|
+
/** The status roles the theme leaves unset, each derived from the look, what they gave up to stay written, and the roles that gave something up. */
|
|
202
|
+
statuses: {
|
|
203
|
+
roles: Record<string, 'derived'>;
|
|
204
|
+
why: string[];
|
|
205
|
+
short: string[];
|
|
206
|
+
};
|
|
207
|
+
/** Whether the category colors (Badge, Token, Card tints) and the chart colors follow the look, and what they gave up to stay written. */
|
|
208
|
+
categories: {
|
|
209
|
+
badges: 'derived' | 'none';
|
|
210
|
+
chart: 'derived' | 'none';
|
|
211
|
+
limits: string[];
|
|
212
|
+
moved: string[];
|
|
213
|
+
alike: boolean;
|
|
214
|
+
unread: boolean;
|
|
215
|
+
};
|
|
158
216
|
}
|
|
159
217
|
|
|
160
218
|
/** The color settings. Each one is a palette family of the same id. */
|
|
@@ -444,21 +502,11 @@ export function ratio(
|
|
|
444
502
|
a: ReadonlyArray<number>,
|
|
445
503
|
b: ReadonlyArray<number>,
|
|
446
504
|
): number {
|
|
447
|
-
|
|
448
|
-
return (x + 0.05) / (y + 0.05);
|
|
505
|
+
return contrastRatio(hex(a), hex(b));
|
|
449
506
|
}
|
|
450
507
|
|
|
451
|
-
/** A
|
|
452
|
-
export
|
|
453
|
-
over: ReadonlyArray<number>,
|
|
454
|
-
alpha: number,
|
|
455
|
-
under: ReadonlyArray<number>,
|
|
456
|
-
): ColorTriple {
|
|
457
|
-
return over.map((c, i) => c * alpha + under[i] * (1 - alpha)) as ColorTriple;
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
/** A ratio to two decimals. */
|
|
461
|
-
export const round = (r: number): number => Math.round(r * 100) / 100;
|
|
508
|
+
/** A ratio cut down to two decimals, never rounded up past a need. */
|
|
509
|
+
export const round = ratioDown;
|
|
462
510
|
|
|
463
511
|
/** A stop as text: a layout may hold 16.666666666666668. */
|
|
464
512
|
export const shade = (s: number): string => String(round(s));
|
|
@@ -730,6 +778,7 @@ export function paletteTools(
|
|
|
730
778
|
at,
|
|
731
779
|
atInside,
|
|
732
780
|
ref,
|
|
781
|
+
colorIn,
|
|
733
782
|
exactOf,
|
|
734
783
|
settingOf,
|
|
735
784
|
rawOf,
|
|
@@ -737,6 +786,7 @@ export function paletteTools(
|
|
|
737
786
|
solid,
|
|
738
787
|
surfaces,
|
|
739
788
|
onFor,
|
|
789
|
+
onChoices,
|
|
740
790
|
page,
|
|
741
791
|
neutral,
|
|
742
792
|
contrast,
|
|
@@ -947,6 +997,36 @@ export function planPaletteRequest(
|
|
|
947
997
|
return {config, fills};
|
|
948
998
|
}
|
|
949
999
|
|
|
1000
|
+
/**
|
|
1001
|
+
* Whether a token is one the look derives: a category color (Badge, Token,
|
|
1002
|
+
* Card tint), a chart color, a code color or the overlay scrim.
|
|
1003
|
+
*/
|
|
1004
|
+
export const isLookToken = (token: string): boolean =>
|
|
1005
|
+
/^--color-(?:(?:background|text|icon|border)-(?:red|orange|yellow|green|teal|cyan|blue|purple|pink|gray)|data-[a-z0-9-]+|syntax-(?:keyword|string|comment|number|function|type|variable|operator|constant|tag|attribute|property|punctuation|background)|overlay)$/.test(
|
|
1006
|
+
token,
|
|
1007
|
+
);
|
|
1008
|
+
|
|
1009
|
+
/** The text roles a rule block can set for what it draws. */
|
|
1010
|
+
export const TEXT_PROPS = [
|
|
1011
|
+
'color',
|
|
1012
|
+
'--color-text-primary',
|
|
1013
|
+
'--color-text-secondary',
|
|
1014
|
+
'--color-text-accent',
|
|
1015
|
+
];
|
|
1016
|
+
|
|
1017
|
+
/**
|
|
1018
|
+
* A text/fill pair a base theme draws: a category's text on its fill, a
|
|
1019
|
+
* status's text on its fill or its tint, or the text a part's rule block
|
|
1020
|
+
* sets on its fill. The editor words it.
|
|
1021
|
+
*/
|
|
1022
|
+
export type BasePair =
|
|
1023
|
+
| {kind: 'category'; hue: string}
|
|
1024
|
+
| {kind: 'status'; role: string; tint: boolean}
|
|
1025
|
+
| {kind: 'part'; part: string; block: string; prop: string};
|
|
1026
|
+
|
|
1027
|
+
/** Two decimals. */
|
|
1028
|
+
export const round2 = (n: number): number => Math.round(n * 100) / 100;
|
|
1029
|
+
|
|
950
1030
|
/**
|
|
951
1031
|
* The token mapping of a generated palette: each color token's stop in
|
|
952
1032
|
* light and dark, as the official Neutral theme maps its families, with the
|
|
@@ -1581,12 +1661,46 @@ export function mapPalette(
|
|
|
1581
1661
|
}
|
|
1582
1662
|
}
|
|
1583
1663
|
|
|
1664
|
+
// The colors the theme editor grows beyond this mapping, from its own
|
|
1665
|
+
// rules (context.editor, which themePalette() never passes): the look's
|
|
1666
|
+
// category, chart and code colors, the status roles the theme leaves
|
|
1667
|
+
// unset, and a base theme's own pairs kept where they read.
|
|
1668
|
+
const {categories, statuses, code, cvd, keptAtBase}: EditorLookResult =
|
|
1669
|
+
context.editor
|
|
1670
|
+
? context.editor.growLook({
|
|
1671
|
+
candidate,
|
|
1672
|
+
dials,
|
|
1673
|
+
context,
|
|
1674
|
+
tokens,
|
|
1675
|
+
modes,
|
|
1676
|
+
setExactly,
|
|
1677
|
+
t,
|
|
1678
|
+
})
|
|
1679
|
+
: {
|
|
1680
|
+
categories: {
|
|
1681
|
+
badges: 'none',
|
|
1682
|
+
chart: 'none',
|
|
1683
|
+
limits: [],
|
|
1684
|
+
moved: [],
|
|
1685
|
+
alike: false,
|
|
1686
|
+
unread: false,
|
|
1687
|
+
},
|
|
1688
|
+
statuses: {roles: {}, why: [], short: []},
|
|
1689
|
+
code: [],
|
|
1690
|
+
cvd: [],
|
|
1691
|
+
keptAtBase: [],
|
|
1692
|
+
};
|
|
1584
1693
|
return {
|
|
1585
1694
|
tokens,
|
|
1586
1695
|
contrast: checks.filter(c => c.note !== ''),
|
|
1587
1696
|
exact,
|
|
1588
1697
|
unread,
|
|
1589
1698
|
lift,
|
|
1699
|
+
categories,
|
|
1700
|
+
statuses,
|
|
1701
|
+
cvd,
|
|
1702
|
+
code,
|
|
1703
|
+
kept: keptAtBase,
|
|
1590
1704
|
};
|
|
1591
1705
|
}
|
|
1592
1706
|
|
|
@@ -59,7 +59,7 @@ export const docs = {
|
|
|
59
59
|
props: [
|
|
60
60
|
{
|
|
61
61
|
name: 'theme',
|
|
62
|
-
type: '
|
|
62
|
+
type: 'SyntaxThemeDefinition',
|
|
63
63
|
required: true,
|
|
64
64
|
description:
|
|
65
65
|
'Syntax highlighting theme: a preset from @astryxdesign/core/theme/syntax or a custom theme created with defineSyntaxTheme().',
|
package/src/theme/tokens.ts
CHANGED
|
@@ -22,8 +22,9 @@
|
|
|
22
22
|
* - /packages/core/src/theme/index.ts
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
import
|
|
25
|
+
import type {DefinedTheme, TokenName} from './defineTheme';
|
|
26
26
|
import {generatedScopedStatusRoleDefaults} from './statusRoleDefaults';
|
|
27
|
+
import {tokenDefaults} from './tokenDefaults';
|
|
27
28
|
import {resolveTokenReferences} from './tokenReferences';
|
|
28
29
|
import {
|
|
29
30
|
evaluateColorFunctions,
|
|
@@ -21,7 +21,7 @@ export const docs = {
|
|
|
21
21
|
{
|
|
22
22
|
guidance: true,
|
|
23
23
|
description:
|
|
24
|
-
'Use this hook for theme identity, such as picking
|
|
24
|
+
'Use this hook for theme identity, such as picking which icon to show for the active theme.',
|
|
25
25
|
},
|
|
26
26
|
{
|
|
27
27
|
guidance: true,
|
package/src/utils/characters.ts
CHANGED
|
@@ -54,6 +54,17 @@ export function characterCount(str: string): number {
|
|
|
54
54
|
*/
|
|
55
55
|
export function firstCharacter(str: string): string {
|
|
56
56
|
if (characterSegmenter) {
|
|
57
|
+
// A unit below U+0300 never joins a unit before it that is also below U+0300,
|
|
58
|
+
// except LF after CR. When the first unit and any next unit are below U+0300
|
|
59
|
+
// and the first is not CR, the first unit is the whole first character.
|
|
60
|
+
const unit = str.charCodeAt(0);
|
|
61
|
+
if (
|
|
62
|
+
unit < 0x300 &&
|
|
63
|
+
unit !== 0x0d &&
|
|
64
|
+
(str.length === 1 || str.charCodeAt(1) < 0x300)
|
|
65
|
+
) {
|
|
66
|
+
return str[0];
|
|
67
|
+
}
|
|
57
68
|
const first = characterSegmenter.segment(str)[Symbol.iterator]().next();
|
|
58
69
|
return first.done ? '' : first.value.segment;
|
|
59
70
|
}
|
package/src/utils/devWarning.ts
CHANGED
|
@@ -109,6 +109,41 @@ export function devPropError(
|
|
|
109
109
|
return new Error(formatDevMessage(component, `\`${prop}\` ${message}`));
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
+
const missingCallbacks = new Map<string, (...args: unknown[]) => never>();
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Make a stand-in for a required callback prop that a caller left out. The
|
|
116
|
+
* stand-in throws {@link devPropError} when the component calls it, instead of
|
|
117
|
+
* a TypeError such as "onOpenChange is not a function". Each component, prop
|
|
118
|
+
* and message gets the same function on every render, so Effect dependencies
|
|
119
|
+
* stay stable.
|
|
120
|
+
*
|
|
121
|
+
* Use it only inside an inline `process.env.NODE_ENV !== 'production'` check,
|
|
122
|
+
* as for `devPropError`.
|
|
123
|
+
*
|
|
124
|
+
* @example
|
|
125
|
+
* ```
|
|
126
|
+
* if (process.env.NODE_ENV !== 'production' && typeof onOpenChange !== 'function') {
|
|
127
|
+
* onOpenChange = devMissingCallback('Dialog', 'onOpenChange', 'is required.');
|
|
128
|
+
* }
|
|
129
|
+
* ```
|
|
130
|
+
*/
|
|
131
|
+
export function devMissingCallback(
|
|
132
|
+
component: string,
|
|
133
|
+
prop: string,
|
|
134
|
+
message: string,
|
|
135
|
+
): (...args: unknown[]) => never {
|
|
136
|
+
const key = `${component}\u0000${prop}\u0000${message}`;
|
|
137
|
+
let callback = missingCallbacks.get(key);
|
|
138
|
+
if (callback == null) {
|
|
139
|
+
callback = () => {
|
|
140
|
+
throw devPropError(component, prop, message);
|
|
141
|
+
};
|
|
142
|
+
missingCallbacks.set(key, callback);
|
|
143
|
+
}
|
|
144
|
+
return callback;
|
|
145
|
+
}
|
|
146
|
+
|
|
112
147
|
const warnedKeys = new Set<string>();
|
|
113
148
|
|
|
114
149
|
/**
|
package/src/utils/focusReturn.ts
CHANGED
|
@@ -474,14 +474,6 @@ export function trackLayerFocus(
|
|
|
474
474
|
return record;
|
|
475
475
|
}
|
|
476
476
|
|
|
477
|
-
/** Whether focus in `layerDoc` is inside `layer` or on nothing. */
|
|
478
|
-
function isInsideOrLost(layerDoc: Document, layer: Element | null): boolean {
|
|
479
|
-
return (
|
|
480
|
-
isFocusDetached(layerDoc) ||
|
|
481
|
-
(layer != null && layer.contains(layerDoc.activeElement))
|
|
482
|
-
);
|
|
483
|
-
}
|
|
484
|
-
|
|
485
477
|
/**
|
|
486
478
|
* The default return move. A control takes a plain focus, which scrolls it
|
|
487
479
|
* into view. A container that only stands in (an ancestor, `main`) takes
|
|
@@ -601,8 +593,8 @@ function nameOf(record: LayerFocusRecord, layer: Element | null): string {
|
|
|
601
593
|
return id ? `layer "${id}"` : 'a layer';
|
|
602
594
|
}
|
|
603
595
|
|
|
604
|
-
/** The element itself when it takes focus, else its first tab stop. */
|
|
605
|
-
function focusableWithin(element: Element | null): HTMLElement | null {
|
|
596
|
+
/** The element itself when it takes focus, else its first tab stop. Internal. */
|
|
597
|
+
export function focusableWithin(element: Element | null): HTMLElement | null {
|
|
606
598
|
if (element == null) {
|
|
607
599
|
return null;
|
|
608
600
|
}
|
|
@@ -700,7 +692,7 @@ export function isLayerFocusStranded(record: LayerFocusRecord): boolean {
|
|
|
700
692
|
isInside ||
|
|
701
693
|
(frameHost != null &&
|
|
702
694
|
active === frameHost &&
|
|
703
|
-
|
|
695
|
+
isFocusLost(layer, layerDoc)) ||
|
|
704
696
|
(active != null && isInsideClosingLayer(active))
|
|
705
697
|
);
|
|
706
698
|
}
|
package/src/utils/hitArea.ts
CHANGED
|
@@ -351,7 +351,7 @@ interface Watch {
|
|
|
351
351
|
toLayout: (rect: HitRect) => HitRect,
|
|
352
352
|
) => HitInsets;
|
|
353
353
|
readonly checkAtPress: boolean;
|
|
354
|
-
readonly onInsets: (insets: HitInsets) => void;
|
|
354
|
+
readonly onInsets: (insets: HitInsets, readSettling?: SettlingRead) => void;
|
|
355
355
|
isVisible: boolean;
|
|
356
356
|
last: HitInsets;
|
|
357
357
|
/** The ancestor animations the watch waits out before a pass reads it. */
|
|
@@ -415,12 +415,16 @@ function sameInsets(a: HitInsets, b: HitInsets): boolean {
|
|
|
415
415
|
);
|
|
416
416
|
}
|
|
417
417
|
|
|
418
|
-
function deliver(
|
|
418
|
+
function deliver(
|
|
419
|
+
watch: Watch,
|
|
420
|
+
insets: HitInsets,
|
|
421
|
+
readSettling: SettlingRead,
|
|
422
|
+
): void {
|
|
419
423
|
if (sameInsets(watch.last, insets)) {
|
|
420
424
|
return;
|
|
421
425
|
}
|
|
422
426
|
watch.last = insets;
|
|
423
|
-
watch.onInsets(insets);
|
|
427
|
+
watch.onInsets(insets, readSettling);
|
|
424
428
|
}
|
|
425
429
|
|
|
426
430
|
/** Whether `candidate` is the control itself, or part of it. */
|
|
@@ -715,11 +719,53 @@ function readCandidates(doc: Document): Candidate[] {
|
|
|
715
719
|
}));
|
|
716
720
|
}
|
|
717
721
|
|
|
722
|
+
/**
|
|
723
|
+
* Whether a tap can reach `element`. A touch nearer a neighbour that no tap
|
|
724
|
+
* reaches is still the control's. Only the touch check asks. The measuring
|
|
725
|
+
* pass reads no style, so such a neighbour still stops a hit area halfway.
|
|
726
|
+
* That strip takes no tap from anyone. Opacity does not count: a control
|
|
727
|
+
* drawn at opacity 0, such as a native input over its own drawn box, takes
|
|
728
|
+
* the tap.
|
|
729
|
+
*/
|
|
730
|
+
function takesTaps(element: Element): boolean {
|
|
731
|
+
if (element.matches(':disabled') || element.closest('[inert]') != null) {
|
|
732
|
+
return false;
|
|
733
|
+
}
|
|
734
|
+
const view = element.ownerDocument.defaultView;
|
|
735
|
+
if (view == null) {
|
|
736
|
+
return true;
|
|
737
|
+
}
|
|
738
|
+
const style = view.getComputedStyle(element);
|
|
739
|
+
if (style.pointerEvents === 'none') {
|
|
740
|
+
return false;
|
|
741
|
+
}
|
|
742
|
+
if (typeof element.checkVisibility === 'function') {
|
|
743
|
+
return element.checkVisibility({checkVisibilityCSS: true});
|
|
744
|
+
}
|
|
745
|
+
// Without `checkVisibility`, its two checks are read from the styles.
|
|
746
|
+
if (style.visibility === 'hidden' || style.visibility === 'collapse') {
|
|
747
|
+
return false;
|
|
748
|
+
}
|
|
749
|
+
for (
|
|
750
|
+
let node = element.parentElement;
|
|
751
|
+
node != null;
|
|
752
|
+
node = node.parentElement
|
|
753
|
+
) {
|
|
754
|
+
if (
|
|
755
|
+
view.getComputedStyle(node).getPropertyValue('content-visibility') ===
|
|
756
|
+
'hidden'
|
|
757
|
+
) {
|
|
758
|
+
return false;
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
return true;
|
|
762
|
+
}
|
|
763
|
+
|
|
718
764
|
/** A control's rect and clamped insets, from candidates already read. */
|
|
719
765
|
function measureOne(
|
|
720
766
|
watch: Watch,
|
|
721
767
|
candidates: ReadonlyArray<Candidate>,
|
|
722
|
-
): {target: HitRect; insets: HitInsets; neighbours:
|
|
768
|
+
): {target: HitRect; insets: HitInsets; neighbours: Candidate[]} {
|
|
723
769
|
const target = plainRect(watch.element);
|
|
724
770
|
const scale = screenScale(watch.element, target, HIT_AREA_TOLERANCE);
|
|
725
771
|
// Two targets each growing up to half the minimum reach each other from a
|
|
@@ -731,15 +777,13 @@ function measureOne(
|
|
|
731
777
|
bottom: reach * scale.y,
|
|
732
778
|
left: reach * scale.x,
|
|
733
779
|
});
|
|
734
|
-
const neighbours = candidates
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
)
|
|
742
|
-
.map(({rect}) => rect);
|
|
780
|
+
const neighbours = candidates.filter(
|
|
781
|
+
({element, rect}) =>
|
|
782
|
+
rect.right > rect.left &&
|
|
783
|
+
rect.bottom > rect.top &&
|
|
784
|
+
intersects(band, rect) &&
|
|
785
|
+
!isOwn(watch, element),
|
|
786
|
+
);
|
|
743
787
|
return {
|
|
744
788
|
target,
|
|
745
789
|
// The insets are in the control's layout px. The returned rects stay in
|
|
@@ -749,7 +793,7 @@ function measureOne(
|
|
|
749
793
|
// still counts that neighbour.
|
|
750
794
|
insets: clampedHitInsets(
|
|
751
795
|
inLayout(target, target, scale),
|
|
752
|
-
neighbours.map(rect => inLayout(rect, target, scale)),
|
|
796
|
+
neighbours.map(({rect}) => inLayout(rect, target, scale)),
|
|
753
797
|
watch.minSize,
|
|
754
798
|
watch.growth?.(inLayout(target, target, scale), rect =>
|
|
755
799
|
inLayout(rect, target, scale),
|
|
@@ -781,6 +825,27 @@ export function settlingAnimations(root: Element | Document): Animation[] {
|
|
|
781
825
|
});
|
|
782
826
|
}
|
|
783
827
|
|
|
828
|
+
/** Reads `settlingAnimations` of a root. */
|
|
829
|
+
export type SettlingRead = (root: Element) => Animation[];
|
|
830
|
+
|
|
831
|
+
/**
|
|
832
|
+
* A `settlingAnimations` read for one loop of writes, which reads each root
|
|
833
|
+
* once. Each read recalculates the styles that the loop's earlier writes
|
|
834
|
+
* changed, so one read per root also prevents those recalculations. A write
|
|
835
|
+
* of hit insets starts no animation, so a root's list stays true for the loop.
|
|
836
|
+
*/
|
|
837
|
+
function readOncePerRoot(): SettlingRead {
|
|
838
|
+
const reads = new Map<Element, Animation[]>();
|
|
839
|
+
return root => {
|
|
840
|
+
let animations = reads.get(root);
|
|
841
|
+
if (animations === undefined) {
|
|
842
|
+
animations = settlingAnimations(root);
|
|
843
|
+
reads.set(root, animations);
|
|
844
|
+
}
|
|
845
|
+
return animations;
|
|
846
|
+
};
|
|
847
|
+
}
|
|
848
|
+
|
|
784
849
|
/** The properties whose animation moves or resizes a box on screen. */
|
|
785
850
|
const BOX_MOTION =
|
|
786
851
|
/^(transform|translate|scale|rotate|offset[A-Z]\w*|inset\w*|top|right|bottom|left|(min|max)?(Width|Height|width|height|BlockSize|InlineSize)|blockSize|inlineSize|margin\w*|padding\w*)$/;
|
|
@@ -885,8 +950,9 @@ function measure(): void {
|
|
|
885
950
|
results.push({watch, insets: measureOne(watch, candidates).insets});
|
|
886
951
|
}
|
|
887
952
|
// Writes.
|
|
953
|
+
const readSettling = readOncePerRoot();
|
|
888
954
|
for (const {watch, insets} of results) {
|
|
889
|
-
deliver(watch, insets);
|
|
955
|
+
deliver(watch, insets, readSettling);
|
|
890
956
|
}
|
|
891
957
|
if (pending.size > 0) {
|
|
892
958
|
requestFrame();
|
|
@@ -1107,7 +1173,8 @@ function isNearerNeighbour(
|
|
|
1107
1173
|
press.y,
|
|
1108
1174
|
);
|
|
1109
1175
|
isNearer ||= neighbours.some(
|
|
1110
|
-
|
|
1176
|
+
({element: neighbour, rect}) =>
|
|
1177
|
+
distanceTo(rect, press.x, press.y) < own && takesTaps(neighbour),
|
|
1111
1178
|
);
|
|
1112
1179
|
// The press still scales the control, so these insets read a scaled box.
|
|
1113
1180
|
// A pass after the press's motion ends takes the insets instead.
|
|
@@ -1325,8 +1392,9 @@ function onPointerChange(): void {
|
|
|
1325
1392
|
return;
|
|
1326
1393
|
}
|
|
1327
1394
|
stopObserving();
|
|
1395
|
+
const readSettling = readOncePerRoot();
|
|
1328
1396
|
for (const entry of watched.values()) {
|
|
1329
|
-
entry.watches.forEach(watch => deliver(watch, NO_HIT_INSETS));
|
|
1397
|
+
entry.watches.forEach(watch => deliver(watch, NO_HIT_INSETS, readSettling));
|
|
1330
1398
|
}
|
|
1331
1399
|
}
|
|
1332
1400
|
|
|
@@ -1382,6 +1450,7 @@ export function resetHitAreaForTests(): void {
|
|
|
1382
1450
|
/**
|
|
1383
1451
|
* Keeps `element`'s hit insets live until the returned function runs:
|
|
1384
1452
|
* `onInsets` hears each change (typically `writeHitInsets` on the control).
|
|
1453
|
+
* A pass also gives it a read of settling animations that its writes share.
|
|
1385
1454
|
* Where the primary pointer is not coarse, the insets are 0, and only the
|
|
1386
1455
|
* pointer query is listened to. Where it is, the shared per-frame pass
|
|
1387
1456
|
* measures the element while it is on screen. It measures again on a resize
|
|
@@ -1391,7 +1460,7 @@ export function resetHitAreaForTests(): void {
|
|
|
1391
1460
|
*/
|
|
1392
1461
|
export function watchHitArea(
|
|
1393
1462
|
element: Element,
|
|
1394
|
-
onInsets: (insets: HitInsets) => void,
|
|
1463
|
+
onInsets: (insets: HitInsets, readSettling?: SettlingRead) => void,
|
|
1395
1464
|
{
|
|
1396
1465
|
minSize = MIN_TOUCH_TARGET,
|
|
1397
1466
|
ownsDescendantTouches = false,
|
package/src/utils/mergeProps.ts
CHANGED
|
@@ -36,29 +36,6 @@ type PropsObject = {
|
|
|
36
36
|
[key: string]: unknown;
|
|
37
37
|
};
|
|
38
38
|
|
|
39
|
-
function mergeTwoProps(base: PropsObject, overrides: PropsObject): PropsObject {
|
|
40
|
-
const merged: PropsObject = {...base, ...overrides};
|
|
41
|
-
|
|
42
|
-
const cls = [base.className, overrides.className].filter(Boolean).join(' ');
|
|
43
|
-
if (cls) {
|
|
44
|
-
merged.className = cls;
|
|
45
|
-
} else {
|
|
46
|
-
delete merged.className;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const mergedStyle =
|
|
50
|
-
overrides.style && base.style
|
|
51
|
-
? {...base.style, ...overrides.style}
|
|
52
|
-
: overrides.style || base.style;
|
|
53
|
-
if (mergedStyle) {
|
|
54
|
-
merged.style = mergedStyle;
|
|
55
|
-
} else {
|
|
56
|
-
delete merged.style;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
return merged;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
39
|
export function mergeProps(
|
|
63
40
|
xdsClassOrStylexResult: string | PropsObject,
|
|
64
41
|
stylexResultOrClassName?: PropsObject | string,
|
|
@@ -90,20 +67,66 @@ export function mergeProps(
|
|
|
90
67
|
}
|
|
91
68
|
|
|
92
69
|
const first = xdsClassOrStylexResult;
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
let merged = mergeTwoProps(first, second);
|
|
70
|
+
const isSecondString = typeof stylexResultOrClassName === 'string';
|
|
71
|
+
const second = isSecondString ? undefined : stylexResultOrClassName;
|
|
72
|
+
|
|
73
|
+
const merged: PropsObject = second ? {...first, ...second} : {...first};
|
|
98
74
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
75
|
+
const cls1 = first.className;
|
|
76
|
+
const cls2 = isSecondString ? stylexResultOrClassName : second?.className;
|
|
77
|
+
const cls3 =
|
|
78
|
+
typeof classNameOrStyle === 'string' ? classNameOrStyle : undefined;
|
|
79
|
+
|
|
80
|
+
let cls = '';
|
|
81
|
+
if (cls1) {
|
|
82
|
+
cls = cls1;
|
|
83
|
+
}
|
|
84
|
+
if (cls2) {
|
|
85
|
+
cls = cls ? `${cls} ${cls2}` : cls2;
|
|
103
86
|
}
|
|
87
|
+
if (cls3) {
|
|
88
|
+
cls = cls ? `${cls} ${cls3}` : cls3;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (cls) {
|
|
92
|
+
merged.className = cls;
|
|
93
|
+
} else {
|
|
94
|
+
delete merged.className;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const s1 = first.style;
|
|
98
|
+
const s2 = second?.style;
|
|
99
|
+
const s3 =
|
|
100
|
+
typeof classNameOrStyle === 'object' && classNameOrStyle != null
|
|
101
|
+
? classNameOrStyle
|
|
102
|
+
: undefined;
|
|
103
|
+
const s4 = style != null ? style : undefined;
|
|
104
104
|
|
|
105
|
-
|
|
106
|
-
|
|
105
|
+
let styleCount = 0;
|
|
106
|
+
if (s1) {
|
|
107
|
+
styleCount++;
|
|
108
|
+
}
|
|
109
|
+
if (s2) {
|
|
110
|
+
styleCount++;
|
|
111
|
+
}
|
|
112
|
+
if (s3) {
|
|
113
|
+
styleCount++;
|
|
114
|
+
}
|
|
115
|
+
if (s4) {
|
|
116
|
+
styleCount++;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
if (styleCount === 0) {
|
|
120
|
+
delete merged.style;
|
|
121
|
+
} else if (styleCount === 1) {
|
|
122
|
+
merged.style = s4 || s3 || s2 || s1;
|
|
123
|
+
} else {
|
|
124
|
+
merged.style = {
|
|
125
|
+
...(s1 || {}),
|
|
126
|
+
...(s2 || {}),
|
|
127
|
+
...(s3 || {}),
|
|
128
|
+
...(s4 || {}),
|
|
129
|
+
};
|
|
107
130
|
}
|
|
108
131
|
|
|
109
132
|
return merged;
|
package/src/utils/scrollView.ts
CHANGED
|
@@ -52,11 +52,12 @@ export function parseTouchAction(value: string): AllowedPans {
|
|
|
52
52
|
|
|
53
53
|
/**
|
|
54
54
|
* Whether `touch-action` on `element` and on every box above it leaves a pan
|
|
55
|
-
* on `axis` to the browser.
|
|
55
|
+
* on `axis` to the browser. With `boundary`, the walk stops before it.
|
|
56
56
|
*/
|
|
57
57
|
export function touchActionAllowsPan(
|
|
58
58
|
element: Element,
|
|
59
59
|
axis: keyof AllowedPans,
|
|
60
|
+
boundary?: Node,
|
|
60
61
|
): boolean {
|
|
61
62
|
const view = element.ownerDocument.defaultView;
|
|
62
63
|
if (view == null) {
|
|
@@ -64,7 +65,7 @@ export function touchActionAllowsPan(
|
|
|
64
65
|
}
|
|
65
66
|
for (
|
|
66
67
|
let node: Node | null = element;
|
|
67
|
-
node != null;
|
|
68
|
+
node != null && node !== boundary;
|
|
68
69
|
node = parentAcrossShadow(node)
|
|
69
70
|
) {
|
|
70
71
|
if (
|