@astryxdesign/core 0.7.5 → 0.7.6-canary.0ef60dd
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 +1 -1
- package/dist/AlertDialog/AlertDialog.d.ts.map +1 -1
- package/dist/AlertDialog/AlertDialog.js +5 -5
- package/dist/Avatar/Avatar.d.ts.map +1 -1
- package/dist/Avatar/Avatar.js +12 -3
- package/dist/Badge/Badge.d.ts.map +1 -1
- package/dist/Badge/Badge.js +7 -1
- package/dist/BottomSheet/BottomSheet.js +1 -1
- package/dist/BottomSheet/BottomSheetPanel.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheetPanel.js +2 -1
- package/dist/BottomSheet/useSheetGestures.d.ts +12 -0
- package/dist/BottomSheet/useSheetGestures.d.ts.map +1 -1
- package/dist/BottomSheet/useSheetGestures.js +30 -3
- package/dist/Button/Button.js +4 -4
- package/dist/CheckboxInput/CheckboxInput.d.ts.map +1 -1
- package/dist/CheckboxInput/CheckboxInput.js +6 -5
- package/dist/ClickableCard/ClickableCard.d.ts.map +1 -1
- package/dist/ClickableCard/ClickableCard.js +37 -4
- package/dist/DateInput/DateInput.d.ts.map +1 -1
- package/dist/DateInput/DateInput.js +12 -4
- package/dist/DateInput/MonthScroller.d.ts.map +1 -1
- package/dist/DateInput/MonthScroller.js +101 -15
- package/dist/DateInput/TouchDateField.d.ts.map +1 -1
- package/dist/DateInput/TouchDateField.js +8 -3
- package/dist/DateRangeInput/DateRangeInput.d.ts.map +1 -1
- package/dist/DateRangeInput/DateRangeInput.js +1 -1
- package/dist/DateTimeInput/DateTimeInput.d.ts +5 -2
- package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
- package/dist/DateTimeInput/DateTimeInput.js +23 -12
- package/dist/DateTimeInput/NativeTimeSegment.d.ts.map +1 -1
- package/dist/DateTimeInput/NativeTimeSegment.js +5 -4
- package/dist/DateTimeInput/TouchDateTimeField.d.ts.map +1 -1
- package/dist/DateTimeInput/TouchDateTimeField.js +4 -3
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +34 -9
- package/dist/Dialog/DialogHeader.d.ts.map +1 -1
- package/dist/Dialog/DialogHeader.js +5 -4
- package/dist/Divider/Divider.d.ts.map +1 -1
- package/dist/Divider/Divider.js +2 -1
- package/dist/Drawer/Drawer.d.ts +1 -0
- package/dist/Drawer/Drawer.d.ts.map +1 -1
- package/dist/Drawer/Drawer.js +7 -2
- package/dist/DropdownMenu/DropdownMenu.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenu.js +7 -3
- package/dist/DropdownMenu/MenuBottomSheetActionList.d.ts.map +1 -1
- package/dist/DropdownMenu/MenuBottomSheetActionList.js +6 -5
- package/dist/DropdownMenu/lazyMenuBottomSheet.d.ts +20 -2
- package/dist/DropdownMenu/lazyMenuBottomSheet.d.ts.map +1 -1
- package/dist/DropdownMenu/lazyMenuBottomSheet.js +31 -3
- package/dist/DropdownMenu/renderDropdownItems.d.ts.map +1 -1
- package/dist/DropdownMenu/renderDropdownItems.js +21 -16
- package/dist/EmptyState/EmptyState.d.ts.map +1 -1
- package/dist/EmptyState/EmptyState.js +2 -1
- package/dist/Field/FieldLabel.d.ts +1 -1
- package/dist/Field/FieldLabel.d.ts.map +1 -1
- package/dist/Field/FieldLabel.js +4 -4
- package/dist/Field/InputClearButton.js +3 -3
- package/dist/Field/PanelSearchInput.js +2 -2
- package/dist/FieldStatus/FieldStatus.js +2 -2
- package/dist/FileInput/FileInput.d.ts.map +1 -1
- package/dist/FileInput/FileInput.js +7 -1
- package/dist/Heading/Heading.js +1 -1
- package/dist/Icon/Icon.js +1 -1
- package/dist/Indicator/CheckIndicator.d.ts.map +1 -1
- package/dist/Indicator/CheckIndicator.js +2 -1
- package/dist/Indicator/CheckboxIndicator.d.ts.map +1 -1
- package/dist/Indicator/CheckboxIndicator.js +3 -1
- package/dist/Indicator/RadioIndicator.d.ts.map +1 -1
- package/dist/Indicator/RadioIndicator.js +3 -1
- package/dist/Item/Item.d.ts.map +1 -1
- package/dist/Item/Item.js +2 -1
- package/dist/Item/ItemSwipeLayer.js +1 -1
- package/dist/Layer/popoverOperations.d.ts +27 -0
- package/dist/Layer/popoverOperations.d.ts.map +1 -0
- package/dist/Layer/popoverOperations.js +159 -0
- package/dist/Layer/useLayer.d.ts +1 -1
- package/dist/Layer/useLayer.d.ts.map +1 -1
- package/dist/Layer/useLayer.js +93 -59
- package/dist/Layout/Layout.js +1 -1
- package/dist/Layout/LayoutContent.js +1 -1
- package/dist/Layout/LayoutFooter.js +1 -1
- package/dist/Layout/LayoutHeader.js +1 -1
- package/dist/Lightbox/Lightbox.d.ts.map +1 -1
- package/dist/Lightbox/Lightbox.js +5 -0
- package/dist/Lightbox/LightboxViewport.a11y.browser.spec.js +5 -4
- package/dist/List/List.js +1 -1
- package/dist/List/ListItem.js +3 -3
- package/dist/MobileNav/MobileNav.d.ts.map +1 -1
- package/dist/MobileNav/MobileNav.js +7 -2
- package/dist/MultiSelector/CreateRow.a11y.chromium.spec.js +7 -6
- package/dist/MultiSelector/MultiSelector.d.ts +1 -1
- package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
- package/dist/MultiSelector/MultiSelector.js +26 -10
- package/dist/NumberInput/NumberInput.d.ts +3 -1
- package/dist/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/NumberInput/NumberInput.js +3 -3
- package/dist/NumberInput/numberParser.d.ts +3 -0
- package/dist/NumberInput/numberParser.d.ts.map +1 -1
- package/dist/NumberInput/numberParser.js +7 -44
- package/dist/ProgressBar/ProgressBar.d.ts.map +1 -1
- package/dist/ProgressBar/ProgressBar.js +16 -12
- package/dist/Resizable/useResizable.d.ts.map +1 -1
- package/dist/Resizable/useResizable.js +28 -2
- package/dist/SegmentedControl/SegmentedControlItem.d.ts.map +1 -1
- package/dist/SegmentedControl/SegmentedControlItem.js +4 -1
- package/dist/Selector/useSelectorPresentation.d.ts +8 -1
- package/dist/Selector/useSelectorPresentation.d.ts.map +1 -1
- package/dist/Selector/useSelectorPresentation.js +20 -4
- package/dist/Skeleton/Skeleton.d.ts.map +1 -1
- package/dist/Skeleton/Skeleton.js +1 -1
- package/dist/Slider/Slider.d.ts.map +1 -1
- package/dist/Slider/Slider.js +10 -2
- package/dist/Spinner/Spinner.d.ts.map +1 -1
- package/dist/Spinner/Spinner.js +3 -3
- package/dist/Stack/Stack.js +1 -1
- package/dist/Stack/StackItem.js +1 -1
- package/dist/TabList/TabList.d.ts.map +1 -1
- package/dist/TabList/TabList.js +16 -1
- package/dist/Table/plugins/columnResize/useTableColumnResize.d.ts.map +1 -1
- package/dist/Table/plugins/columnResize/useTableColumnResize.js +9 -1
- package/dist/Text/Text.js +1 -1
- package/dist/Text/useTruncation.d.ts.map +1 -1
- package/dist/Text/useTruncation.js +23 -5
- package/dist/TextArea/TextArea.d.ts +1 -1
- package/dist/TextArea/TextArea.d.ts.map +1 -1
- package/dist/TextArea/TextArea.js +13 -2
- package/dist/TextInput/TextInput.d.ts.map +1 -1
- package/dist/TextInput/TextInput.js +3 -3
- package/dist/TimeInput/TimeInput.d.ts +6 -2
- package/dist/TimeInput/TimeInput.d.ts.map +1 -1
- package/dist/TimeInput/TimeInput.js +21 -14
- package/dist/TimeInput/TouchTimeField.d.ts.map +1 -1
- package/dist/TimeInput/TouchTimeField.js +5 -4
- package/dist/Timestamp/Timestamp.d.ts.map +1 -1
- package/dist/Timestamp/Timestamp.js +2 -2
- package/dist/Timestamp/TimestampHoverCard.js +4 -4
- package/dist/Toast/Toast.d.ts.map +1 -1
- package/dist/Toast/Toast.js +60 -20
- package/dist/Toast/ToastViewport.d.ts.map +1 -1
- package/dist/Toast/ToastViewport.js +82 -51
- package/dist/Tokenizer/Tokenizer.d.ts.map +1 -1
- package/dist/Tokenizer/Tokenizer.js +13 -2
- package/dist/Tokenizer/TokenizerBottomSheet.js +3 -3
- package/dist/Toolbar/Toolbar.d.ts.map +1 -1
- package/dist/Toolbar/Toolbar.js +2 -1
- package/dist/TopNav/TopNavMegaMenu.d.ts.map +1 -1
- package/dist/TopNav/TopNavMegaMenu.js +3 -0
- package/dist/TopNav/TopNavMenu.d.ts.map +1 -1
- package/dist/TopNav/TopNavMenu.js +1 -0
- package/dist/Typeahead/Typeahead.d.ts +1 -1
- package/dist/Typeahead/Typeahead.d.ts.map +1 -1
- package/dist/Typeahead/Typeahead.js +9 -1
- package/dist/astryx.css +20 -4
- package/dist/gestures/GestureArena.d.ts +6 -0
- package/dist/gestures/GestureArena.d.ts.map +1 -1
- package/dist/gestures/GestureArena.js +39 -0
- package/dist/gestures/GestureHost.d.ts +352 -0
- package/dist/gestures/GestureHost.d.ts.map +1 -0
- package/dist/gestures/GestureHost.js +1773 -0
- package/dist/gestures/GestureRecognizer.d.ts +10 -0
- package/dist/gestures/GestureRecognizer.d.ts.map +1 -1
- package/dist/gestures/GestureRecognizer.js +16 -0
- package/dist/gestures/LongPressGestureRecognizer.d.ts +1 -0
- package/dist/gestures/LongPressGestureRecognizer.d.ts.map +1 -1
- package/dist/gestures/LongPressGestureRecognizer.js +3 -0
- package/dist/gestures/PanGestureRecognizer.d.ts +1 -0
- package/dist/gestures/PanGestureRecognizer.d.ts.map +1 -1
- package/dist/gestures/PanGestureRecognizer.js +3 -0
- package/dist/gestures/PinchGestureRecognizer.d.ts +31 -0
- package/dist/gestures/PinchGestureRecognizer.d.ts.map +1 -0
- package/dist/gestures/PinchGestureRecognizer.js +128 -0
- package/dist/gestures/ScreenEdgePanGestureRecognizer.d.ts +71 -0
- package/dist/gestures/ScreenEdgePanGestureRecognizer.d.ts.map +1 -0
- package/dist/gestures/ScreenEdgePanGestureRecognizer.js +223 -0
- package/dist/gestures/SwipeGestureRecognizer.d.ts +37 -0
- package/dist/gestures/SwipeGestureRecognizer.d.ts.map +1 -0
- package/dist/gestures/SwipeGestureRecognizer.js +148 -0
- package/dist/gestures/TapGestureRecognizer.d.ts +1 -0
- package/dist/gestures/TapGestureRecognizer.d.ts.map +1 -1
- package/dist/gestures/TapGestureRecognizer.js +3 -0
- package/dist/gestures/VelocityTracker.d.ts +6 -2
- package/dist/gestures/VelocityTracker.d.ts.map +1 -1
- package/dist/gestures/VelocityTracker.js +7 -3
- package/dist/gestures/haptics.d.ts +65 -0
- package/dist/gestures/haptics.d.ts.map +1 -0
- package/dist/gestures/haptics.js +182 -0
- package/dist/gestures/nativeScroll.d.ts +42 -0
- package/dist/gestures/nativeScroll.d.ts.map +1 -0
- package/dist/gestures/nativeScroll.js +228 -0
- package/dist/gestures/touchAction.d.ts +60 -0
- package/dist/gestures/touchAction.d.ts.map +1 -0
- package/dist/gestures/touchAction.js +157 -0
- package/dist/gestures/touchActionRule.d.ts +34 -0
- package/dist/gestures/touchActionRule.d.ts.map +1 -0
- package/dist/gestures/touchActionRule.js +140 -0
- package/dist/gestures/types.d.ts +18 -7
- package/dist/gestures/types.d.ts.map +1 -1
- package/dist/gestures/types.js +22 -2
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/modalAnnounce.d.ts.map +1 -1
- package/dist/hooks/modalAnnounce.js +107 -61
- package/dist/hooks/useAdaptivePresentation.d.ts.map +1 -1
- package/dist/hooks/useAdaptivePresentation.js +4 -1
- package/dist/hooks/useAnnounce.d.ts +101 -42
- package/dist/hooks/useAnnounce.d.ts.map +1 -1
- package/dist/hooks/useAnnounce.js +161 -75
- package/dist/hooks/useAnnounceRenderedText.d.ts +11 -3
- package/dist/hooks/useAnnounceRenderedText.d.ts.map +1 -1
- package/dist/hooks/useAnnounceRenderedText.js +5 -3
- package/dist/hooks/useBusyAnnouncement.d.ts.map +1 -1
- package/dist/hooks/useBusyAnnouncement.js +6 -12
- package/dist/hooks/useMenuHover.d.ts.map +1 -1
- package/dist/hooks/useMenuHover.js +12 -1
- 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/motion/animator.d.ts +7 -1
- package/dist/motion/animator.d.ts.map +1 -1
- package/dist/motion/animator.js +119 -27
- package/dist/theme/defineTheme.d.ts +19 -5
- package/dist/theme/defineTheme.d.ts.map +1 -1
- package/dist/theme/defineTheme.js +64 -4
- package/dist/theme/domainTokens/domainTokenDefaults.d.ts +3 -0
- package/dist/theme/domainTokens/domainTokenDefaults.d.ts.map +1 -0
- package/dist/theme/domainTokens/domainTokenDefaults.js +19 -0
- package/dist/theme/domainTokens/index.d.ts +5 -4
- package/dist/theme/domainTokens/index.d.ts.map +1 -1
- package/dist/theme/domainTokens/index.js +5 -9
- package/dist/theme/index.d.ts +1 -0
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/motionKnobs.d.ts +56 -0
- package/dist/theme/motionKnobs.d.ts.map +1 -0
- package/dist/theme/motionKnobs.js +48 -0
- package/dist/theme/resolveThemeValues.d.ts +11 -4
- package/dist/theme/resolveThemeValues.d.ts.map +1 -1
- package/dist/theme/resolveThemeValues.js +40 -4
- package/dist/theme/themeAdaptations.d.ts +7 -3
- package/dist/theme/themeAdaptations.d.ts.map +1 -1
- package/dist/theme/themeAdaptations.js +36 -7
- package/dist/theme/themeMotion.d.ts +96 -0
- package/dist/theme/themeMotion.d.ts.map +1 -0
- package/dist/theme/themeMotion.js +177 -0
- package/dist/theme/tokenReferences.d.ts +31 -0
- package/dist/theme/tokenReferences.d.ts.map +1 -0
- package/dist/theme/tokenReferences.js +132 -0
- package/dist/theme/tokens.d.ts +1 -0
- package/dist/theme/tokens.d.ts.map +1 -1
- package/dist/theme/tokens.js +9 -129
- package/dist/theme/tokens.stylex.d.ts +12 -0
- package/dist/theme/tokens.stylex.d.ts.map +1 -1
- package/dist/theme/tokens.stylex.js +12 -0
- package/dist/utils/focusReturn.d.ts +17 -1
- package/dist/utils/focusReturn.d.ts.map +1 -1
- package/dist/utils/focusReturn.js +11 -4
- package/dist/utils/getNodeText.d.ts +8 -0
- package/dist/utils/getNodeText.d.ts.map +1 -0
- package/dist/utils/getNodeText.js +37 -0
- package/dist/utils/interactionModality.d.ts +11 -2
- package/dist/utils/interactionModality.d.ts.map +1 -1
- package/dist/utils/interactionModality.js +58 -5
- package/dist/utils/interactionOverlay.stylex.d.ts.map +1 -1
- package/dist/utils/interactionOverlay.stylex.js +17 -8
- package/dist/utils/plainDate.d.ts +2 -0
- package/dist/utils/plainDate.d.ts.map +1 -1
- package/dist/utils/plainDate.js +46 -3
- package/dist/utils/presentation.d.ts +50 -0
- package/dist/utils/presentation.d.ts.map +1 -0
- package/dist/utils/presentation.js +125 -0
- package/dist/utils/pressFeedback.d.ts.map +1 -1
- package/dist/utils/pressFeedback.js +20 -1
- package/dist/utils/primaryClick.d.ts +11 -0
- package/dist/utils/primaryClick.d.ts.map +1 -0
- package/dist/utils/primaryClick.js +25 -0
- package/dist/utils/timeFormat.d.ts +47 -0
- package/dist/utils/timeFormat.d.ts.map +1 -0
- package/dist/utils/timeFormat.js +240 -0
- package/dist/utils/touchPresentation.d.ts.map +1 -1
- package/dist/utils/touchPresentation.js +5 -3
- package/dist/utils/touchPresentation.stylex.d.ts +15 -0
- package/dist/utils/touchPresentation.stylex.d.ts.map +1 -0
- package/dist/utils/touchPresentation.stylex.js +33 -0
- package/dist/utils/unicodeDigits.d.ts +20 -0
- package/dist/utils/unicodeDigits.d.ts.map +1 -0
- package/dist/utils/unicodeDigits.js +70 -0
- package/locales/en.json +23 -3
- package/locales/pseudo.json +15 -0
- package/package.json +5 -4
- package/src/AlertDialog/AlertDialog.tsx +6 -5
- package/src/AlertDialog/__tests__/AlertDialog.a11y.chromium.spec.ts +18 -6
- package/src/Avatar/Avatar.spec.md +22 -22
- package/src/Avatar/Avatar.tsx +18 -1
- package/src/Avatar/__tests__/AvatarForcedColors.a11y.chromium.spec.ts +126 -0
- package/src/Badge/Badge.doc.mjs +1 -1
- package/src/Badge/Badge.tsx +19 -2
- package/src/Badge/__tests__/BadgeLargerText.a11y.chromium.spec.ts +260 -0
- package/src/BottomSheet/BottomSheet.test.tsx +46 -0
- package/src/BottomSheet/BottomSheet.tsx +1 -1
- package/src/BottomSheet/BottomSheetPanel.tsx +2 -1
- package/src/BottomSheet/useSheetGestures.test.ts +52 -0
- package/src/BottomSheet/useSheetGestures.ts +37 -6
- package/src/Breadcrumbs/__tests__/Breadcrumbs.a11y.chromium.spec.ts +18 -6
- package/src/Button/Button.tsx +4 -4
- package/src/Calendar/Calendar.spec.md +87 -48
- package/src/Calendar/__tests__/Calendar.a11y.chromium.spec.ts +21 -7
- package/src/Carousel/__tests__/Carousel.a11y.chromium.spec.ts +21 -7
- package/src/CheckboxInput/CheckboxInput.tsx +6 -5
- package/src/ClickableCard/ClickableCard.test.tsx +96 -0
- package/src/ClickableCard/ClickableCard.tsx +48 -4
- package/src/Collapsible/Collapsible.spec.md +2 -0
- package/src/Collapsible/CollapsibleGroup.spec.md +57 -29
- package/src/Collapsible/__tests__/Collapsible.a11y.chromium.spec.ts +18 -7
- package/src/Collapsible/__tests__/CollapsibleGroupAccordion.a11y.chromium.spec.ts +18 -6
- package/src/ComplexSelector/ComplexSelector.test.tsx +37 -0
- package/src/ContextMenu/ContextMenu.test.tsx +35 -0
- package/src/DateInput/DateInput.test.tsx +115 -3
- package/src/DateInput/DateInput.tsx +29 -14
- package/src/DateInput/DateInputTouch.test.tsx +76 -0
- package/src/DateInput/MonthScroller.tsx +106 -20
- package/src/DateInput/MonthScrollerSettle.test.tsx +165 -0
- package/src/DateInput/TouchDateField.tsx +14 -3
- package/src/DateInput/__tests__/MonthScrollerSteps.interaction.browser.spec.ts +312 -0
- package/src/DateRangeInput/DateRangeInput.test.tsx +46 -3
- package/src/DateRangeInput/DateRangeInput.tsx +16 -12
- package/src/DateTimeInput/DateTimeInput.doc.mjs +10 -8
- package/src/DateTimeInput/DateTimeInput.spec.md +75 -51
- package/src/DateTimeInput/DateTimeInput.test.tsx +81 -0
- package/src/DateTimeInput/DateTimeInput.tsx +46 -24
- package/src/DateTimeInput/NativeTimeSegment.tsx +4 -6
- package/src/DateTimeInput/TouchDateTimeField.tsx +3 -7
- package/src/Dialog/Dialog.test.tsx +216 -2
- package/src/Dialog/Dialog.tsx +42 -9
- package/src/Dialog/DialogHeader.tsx +5 -4
- package/src/Dialog/__tests__/DialogSecondDocument.a11y.browser.spec.ts +202 -0
- package/src/Divider/Divider.tsx +2 -1
- package/src/Drawer/Drawer.spec.md +111 -80
- package/src/Drawer/Drawer.test.tsx +35 -0
- package/src/Drawer/Drawer.tsx +13 -2
- package/src/Drawer/DrawerHeader.spec.md +181 -0
- package/src/Drawer/__tests__/DrawerNonModalPageScroll.a11y.chromium.spec.ts +267 -0
- package/src/DropdownMenu/DropdownMenu.test.tsx +41 -0
- package/src/DropdownMenu/DropdownMenu.tsx +10 -3
- package/src/DropdownMenu/DropdownMenuSubMenu.test.tsx +34 -0
- package/src/DropdownMenu/MenuBottomSheetActionList.tsx +6 -5
- package/src/DropdownMenu/__tests__/Menu.a11y.chromium.spec.ts +19 -7
- package/src/DropdownMenu/__tests__/MenuButton.a11y.chromium.spec.ts +21 -9
- package/src/DropdownMenu/lazyMenuBottomSheet.test.ts +60 -0
- package/src/DropdownMenu/lazyMenuBottomSheet.ts +36 -7
- package/src/DropdownMenu/renderDropdownItems.tsx +24 -19
- package/src/EmptyState/EmptyState.tsx +2 -1
- package/src/Field/FieldLabel.tsx +5 -4
- package/src/Field/InputClearButton.tsx +3 -3
- package/src/Field/PanelSearchInput.tsx +2 -2
- package/src/FieldStatus/FieldStatus.tsx +2 -2
- package/src/FileInput/FileInput.test.tsx +21 -0
- package/src/FileInput/FileInput.tsx +4 -1
- package/src/FormLayout/FormLayout.spec.md +7 -8
- package/src/Heading/Heading.tsx +1 -1
- package/src/Icon/Icon.tsx +1 -1
- package/src/Indicator/CheckIndicator.spec.md +47 -42
- package/src/Indicator/CheckIndicator.tsx +2 -1
- package/src/Indicator/CheckboxIndicator.spec.md +40 -37
- package/src/Indicator/CheckboxIndicator.tsx +3 -1
- package/src/Indicator/Indicator.spec.md +188 -0
- package/src/Indicator/RadioIndicator.tsx +3 -1
- package/src/Item/Item.tsx +2 -1
- package/src/Item/ItemSwipeLayer.tsx +1 -1
- package/src/Kbd/Kbd.spec.md +81 -38
- package/src/Layer/__tests__/LayerBrowserHide.a11y.chromium.spec.ts +126 -0
- package/src/Layer/popoverOperations.test.ts +205 -0
- package/src/Layer/popoverOperations.ts +172 -0
- package/src/Layer/useLayer.test.tsx +348 -1
- package/src/Layer/useLayer.tsx +118 -71
- package/src/Layout/Layout.spec.md +127 -131
- package/src/Layout/Layout.tsx +1 -1
- package/src/Layout/LayoutContent.spec.md +205 -0
- package/src/Layout/LayoutContent.tsx +1 -1
- package/src/Layout/LayoutFooter.spec.md +190 -0
- package/src/Layout/LayoutFooter.tsx +1 -1
- package/src/Layout/LayoutHeader.spec.md +193 -0
- package/src/Layout/LayoutHeader.tsx +1 -1
- package/src/Layout/LayoutPanel.spec.md +194 -0
- package/src/Layout/__tests__/Layout.a11y.chromium.spec.ts +18 -6
- package/src/Lightbox/Lightbox.test.tsx +18 -0
- package/src/Lightbox/Lightbox.tsx +5 -0
- package/src/Lightbox/LightboxViewport.a11y.browser.spec.ts +8 -4
- package/src/Link/__tests__/Link.a11y.chromium.spec.ts +18 -8
- package/src/List/List.tsx +1 -1
- package/src/List/ListItem.spec.md +205 -0
- package/src/List/ListItem.tsx +3 -3
- package/src/MetadataList/MetadataList.spec.md +187 -0
- package/src/MetadataList/MetadataListItem.spec.md +165 -0
- package/src/MobileNav/MobileNav.test.tsx +15 -0
- package/src/MobileNav/MobileNav.tsx +9 -1
- package/src/MobileNav/__tests__/MobileNavHeader.a11y.chromium.spec.ts +89 -0
- package/src/MoreMenu/MoreMenu.test.tsx +11 -0
- package/src/MultiSelector/CreateRow.a11y.chromium.spec.ts +7 -8
- package/src/MultiSelector/MultiSelector.spec.md +7 -4
- package/src/MultiSelector/MultiSelector.test.tsx +270 -1
- package/src/MultiSelector/MultiSelector.tsx +25 -10
- package/src/MultiSelector/__tests__/MultiSelector.listbox.a11y.test.tsx +8 -1
- package/src/NavMenu/NavHeadingMenu.spec.md +1 -5
- package/src/NumberInput/NumberInput.doc.mjs +13 -7
- package/src/NumberInput/NumberInput.spec.md +59 -37
- package/src/NumberInput/NumberInput.tsx +13 -3
- package/src/NumberInput/__tests__/NumberInput.coarse-pointer.a11y.chromium.spec.ts +102 -0
- package/src/NumberInput/numberParser.ts +7 -45
- package/src/ProgressBar/ProgressBar.test.tsx +108 -32
- package/src/ProgressBar/ProgressBar.tsx +58 -10
- package/src/ProgressBar/__tests__/ProgressBar.a11y.chromium.spec.ts +21 -9
- package/src/ProgressBar/__tests__/ProgressBarMotion.a11y.chromium.spec.ts +831 -0
- package/src/Resizable/__tests__/ResizeHandle.a11y.chromium.spec.ts +21 -14
- package/src/Resizable/useResizable.test.ts +43 -0
- package/src/Resizable/useResizable.ts +32 -9
- package/src/SegmentedControl/SegmentedControl.test.tsx +84 -0
- package/src/SegmentedControl/SegmentedControlItem.tsx +11 -5
- package/src/Selector/Selector.test.tsx +90 -1
- package/src/Selector/__tests__/Selector.combobox.a11y.test.tsx +8 -1
- package/src/Selector/__tests__/Selector.listbox.a11y.test.tsx +8 -1
- package/src/Selector/useSelectorPresentation.ts +31 -3
- package/src/SideNav/SideNav.test.tsx +27 -0
- package/src/SideNav/__tests__/SideNavRailMotion.interaction.browser.spec.ts +176 -51
- package/src/Skeleton/Skeleton.tsx +3 -1
- package/src/Slider/Slider.test.tsx +31 -0
- package/src/Slider/Slider.tsx +8 -3
- package/src/Slider/__tests__/Slider.a11y.chromium.spec.ts +19 -7
- package/src/Spinner/Spinner.tsx +5 -3
- package/src/Stack/Stack.tsx +1 -1
- package/src/Stack/StackItem.tsx +1 -1
- package/src/TabList/TabList.test.tsx +58 -4
- package/src/TabList/TabList.tsx +16 -1
- package/src/TabList/__tests__/TabPressPointer.interaction.browser.spec.ts +163 -0
- package/src/Table/__tests__/Table.a11y.chromium.spec.ts +18 -6
- package/src/Table/plugins/columnResize/useTableColumnResize.test.tsx +22 -0
- package/src/Table/plugins/columnResize/useTableColumnResize.tsx +8 -4
- package/src/Text/Text.tsx +1 -1
- package/src/Text/useTruncation.test.tsx +128 -1
- package/src/Text/useTruncation.ts +23 -5
- package/src/TextArea/TextArea.spec.md +10 -13
- package/src/TextArea/TextArea.test.tsx +60 -0
- package/src/TextArea/TextArea.tsx +15 -1
- package/src/TextInput/TextInput.test.tsx +21 -0
- package/src/TextInput/TextInput.tsx +3 -1
- package/src/TimeInput/NativeTimeInput.test.tsx +17 -0
- package/src/TimeInput/Presentation.test.tsx +21 -0
- package/src/TimeInput/TimeInput.doc.mjs +8 -8
- package/src/TimeInput/TimeInput.spec.md +45 -48
- package/src/TimeInput/TimeInput.test.tsx +76 -0
- package/src/TimeInput/TimeInput.tsx +36 -18
- package/src/TimeInput/TouchTimeField.tsx +4 -6
- package/src/Timestamp/Timestamp.spec.md +6 -12
- package/src/Timestamp/Timestamp.test.tsx +30 -5
- package/src/Timestamp/Timestamp.tsx +6 -2
- package/src/Timestamp/TimestampHoverCard.tsx +4 -4
- package/src/Toast/Toast.spec.md +14 -20
- package/src/Toast/Toast.tsx +104 -36
- package/src/Toast/ToastViewport.test.tsx +719 -1
- package/src/Toast/ToastViewport.tsx +100 -50
- package/src/Tokenizer/Tokenizer.spec.md +5 -3
- package/src/Tokenizer/Tokenizer.test.tsx +68 -0
- package/src/Tokenizer/Tokenizer.tsx +14 -2
- package/src/Tokenizer/TokenizerBottomSheet.test.tsx +15 -4
- package/src/Tokenizer/TokenizerBottomSheet.tsx +3 -3
- package/src/Toolbar/Toolbar.spec.md +5 -6
- package/src/Toolbar/Toolbar.test.tsx +30 -0
- package/src/Toolbar/Toolbar.tsx +2 -1
- package/src/Toolbar/__tests__/Toolbar.a11y.chromium.spec.ts +18 -6
- package/src/Tooltip/__tests__/Tooltip.a11y.chromium.spec.ts +18 -7
- package/src/TopNav/TopNav.test.tsx +27 -0
- package/src/TopNav/TopNavMegaMenu.test.tsx +21 -0
- package/src/TopNav/TopNavMegaMenu.tsx +4 -1
- package/src/TopNav/TopNavMenu.test.tsx +17 -0
- package/src/TopNav/TopNavMenu.tsx +1 -0
- package/src/Typeahead/Typeahead.test.tsx +40 -0
- package/src/Typeahead/Typeahead.tsx +12 -1
- package/src/__tests__/pressState.ts +8 -4
- package/src/gestures/GestureArena.ts +35 -0
- package/src/gestures/GestureHost.ts +2065 -0
- package/src/gestures/GestureRecognizer.ts +18 -0
- package/src/gestures/LongPressGestureRecognizer.ts +4 -0
- package/src/gestures/PanGestureRecognizer.ts +4 -0
- package/src/gestures/PinchGestureRecognizer.ts +148 -0
- package/src/gestures/ScreenEdgePanGestureRecognizer.ts +256 -0
- package/src/gestures/SwipeGestureRecognizer.ts +197 -0
- package/src/gestures/TapGestureRecognizer.ts +4 -0
- package/src/gestures/VelocityTracker.ts +10 -3
- package/src/gestures/__tests__/GestureHost.test.ts +2087 -0
- package/src/gestures/__tests__/PanGestureRecognizer.test.ts +4 -4
- package/src/gestures/__tests__/PinchGestureRecognizer.test.ts +74 -0
- package/src/gestures/__tests__/ScreenEdgePanGestureRecognizer.test.ts +498 -0
- package/src/gestures/__tests__/SwipeGestureRecognizer.test.ts +108 -0
- package/src/gestures/__tests__/arena.test.ts +5 -0
- package/src/gestures/__tests__/arenaPinchSwipeEdge.test.ts +193 -0
- package/src/gestures/__tests__/browser/build-fixture.mjs +46 -0
- package/src/gestures/__tests__/browser/fixture.ts +307 -0
- package/src/gestures/__tests__/browser/gestures.interaction.browser.spec.ts +1137 -0
- package/src/gestures/__tests__/browserNegotiation.test.ts +293 -0
- package/src/gestures/__tests__/haptics.test.ts +187 -0
- package/src/gestures/__tests__/harness.ts +21 -2
- package/src/gestures/__tests__/recognizerKind.test.ts +78 -0
- package/src/gestures/__tests__/touchActionRule.test.ts +54 -0
- package/src/gestures/haptics.ts +203 -0
- package/src/gestures/nativeScroll.ts +277 -0
- package/src/gestures/touchAction.ts +191 -0
- package/src/gestures/touchActionRule.ts +157 -0
- package/src/gestures/types.ts +30 -9
- package/src/hooks/index.ts +5 -1
- package/src/hooks/modalAnnounce.ts +129 -72
- package/src/hooks/useAdaptivePresentation.ts +4 -1
- package/src/hooks/useAnnounce.doc.mjs +35 -3
- package/src/hooks/useAnnounce.replace.test.tsx +516 -0
- package/src/hooks/useAnnounce.ts +209 -102
- package/src/hooks/useAnnounceRenderedText.adopters.test.tsx +10 -1
- package/src/hooks/useAnnounceRenderedText.ts +17 -3
- package/src/hooks/useBusyAnnouncement.ts +7 -10
- package/src/hooks/useMenuHover.ts +15 -1
- package/src/i18n/generated-locales/en.generated.ts +6 -0
- package/src/i18n/generated-locales/pseudo.generated.ts +6 -0
- package/src/motion/README.md +11 -1
- package/src/motion/animator.test.ts +151 -3
- package/src/motion/animator.ts +149 -33
- package/src/theme/Theme.doc.mjs +1 -1
- package/src/theme/defineTheme.ts +117 -8
- package/src/theme/derivedVarRegistry.test.ts +4 -0
- package/src/theme/domainTokens/domainTokenDefaults.ts +19 -0
- package/src/theme/domainTokens/index.ts +6 -10
- package/src/theme/expandMotionScale.test.ts +1 -1
- package/src/theme/index.ts +5 -0
- package/src/theme/motionKnobs.ts +82 -0
- package/src/theme/resolveThemeValues.ts +68 -6
- package/src/theme/themeAdaptations.ts +52 -12
- package/src/theme/themeMotion.test.ts +620 -0
- package/src/theme/themeMotion.ts +221 -0
- package/src/theme/tokenReferences.ts +149 -0
- package/src/theme/tokens.stylex.ts +10 -0
- package/src/theme/tokens.ts +15 -158
- package/src/utils/focusReturn.ts +17 -6
- package/src/utils/getNodeText.test.ts +24 -0
- package/src/utils/getNodeText.ts +37 -0
- package/src/utils/interactionModality.test.ts +45 -1
- package/src/utils/interactionModality.ts +64 -5
- package/src/utils/interactionOverlay.stylex.ts +12 -3
- package/src/utils/plainDate.test.ts +90 -0
- package/src/utils/plainDate.ts +58 -3
- package/src/utils/presentation.test.ts +380 -0
- package/src/utils/presentation.ts +180 -0
- package/src/utils/pressFeedback.test.ts +138 -0
- package/src/utils/pressFeedback.ts +34 -11
- package/src/utils/pressPaintPriority.test.ts +80 -0
- package/src/utils/primaryClick.test.ts +38 -0
- package/src/utils/primaryClick.ts +28 -0
- package/src/utils/timeFormat.test.ts +204 -0
- package/src/utils/timeFormat.ts +314 -0
- package/src/utils/touchPresentation.stylex.ts +43 -0
- package/src/utils/touchPresentation.test.ts +140 -1
- package/src/utils/touchPresentation.ts +5 -3
- package/src/utils/unicodeDigits.test.ts +44 -0
- package/src/utils/unicodeDigits.ts +71 -0
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file tokenReferences.ts
|
|
5
|
+
* @input A flat map of token names to raw CSS values
|
|
6
|
+
* @output `resolveTokenReferences`, which follows `var(--name[, fallback])`
|
|
7
|
+
* references through the map, and the CSS parsing helpers it shares
|
|
8
|
+
* (`splitTopLevelComma`, `findMatchingParen`)
|
|
9
|
+
* @position Theme utility with no imports: tokens.ts resolves a theme's token
|
|
10
|
+
* graph on it (evaluating color functions as it goes), and themeMotion.ts
|
|
11
|
+
* resolves motion tokens written as references on it. Pure; safe on the
|
|
12
|
+
* server.
|
|
13
|
+
*
|
|
14
|
+
* SYNC: When modified, update:
|
|
15
|
+
* - /packages/core/src/theme/tokens.ts
|
|
16
|
+
* - /packages/core/src/theme/themeMotion.ts
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Split the arguments of a CSS function body on the first top-level comma.
|
|
21
|
+
* Handles nested functions such as rgba(), color-mix(), var(), and quoted strings.
|
|
22
|
+
*/
|
|
23
|
+
export function splitTopLevelComma(input) {
|
|
24
|
+
let depth = 0;
|
|
25
|
+
let quote = null;
|
|
26
|
+
let isEscaped = false;
|
|
27
|
+
for (let i = 0; i < input.length; i++) {
|
|
28
|
+
const char = input[i];
|
|
29
|
+
if (quote !== null) {
|
|
30
|
+
if (isEscaped) {
|
|
31
|
+
isEscaped = false;
|
|
32
|
+
} else if (char === '\\') {
|
|
33
|
+
isEscaped = true;
|
|
34
|
+
} else if (char === quote) {
|
|
35
|
+
quote = null;
|
|
36
|
+
}
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
if (char === '"' || char === "'") {
|
|
40
|
+
quote = char;
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
if (char === '(') {
|
|
44
|
+
depth++;
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
if (char === ')') {
|
|
48
|
+
depth = Math.max(0, depth - 1);
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
if (char === ',' && depth === 0) {
|
|
52
|
+
return [input.slice(0, i).trim(), input.slice(i + 1).trim()];
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** Index of the `)` matching the `(` at `openIndex`, or -1 when unbalanced. */
|
|
59
|
+
export function findMatchingParen(input, openIndex) {
|
|
60
|
+
let depth = 0;
|
|
61
|
+
for (let i = openIndex; i < input.length; i++) {
|
|
62
|
+
const char = input[i];
|
|
63
|
+
if (char === '(') {
|
|
64
|
+
depth++;
|
|
65
|
+
} else if (char === ')') {
|
|
66
|
+
depth--;
|
|
67
|
+
if (depth === 0) {
|
|
68
|
+
return i;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return -1;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Resolves every value in `raw` to a concrete one: each `var(--name[,
|
|
77
|
+
* fallback])` is replaced by `name`'s resolved value, or by its fallback when
|
|
78
|
+
* `raw` has no `name`, and is kept as written when neither exists or the
|
|
79
|
+
* references form a cycle. `evaluate` then runs on each substituted value
|
|
80
|
+
* (tokens.ts evaluates CSS color functions there).
|
|
81
|
+
*/
|
|
82
|
+
export function resolveTokenReferences(raw, evaluate = expr => expr) {
|
|
83
|
+
const cache = {};
|
|
84
|
+
|
|
85
|
+
// `seen` tracks the reference chain, so a cycle resolves to the literal
|
|
86
|
+
// reference instead of recursing forever.
|
|
87
|
+
const substitute = (expr, seen) => {
|
|
88
|
+
const start = expr.indexOf('var(');
|
|
89
|
+
if (start === -1) {
|
|
90
|
+
return expr;
|
|
91
|
+
}
|
|
92
|
+
const openIndex = start + 'var'.length;
|
|
93
|
+
const closeIndex = findMatchingParen(expr, openIndex);
|
|
94
|
+
if (closeIndex === -1) {
|
|
95
|
+
return expr;
|
|
96
|
+
}
|
|
97
|
+
const inner = expr.slice(openIndex + 1, closeIndex);
|
|
98
|
+
const commaSplit = splitTopLevelComma(inner);
|
|
99
|
+
const name = (commaSplit ? commaSplit[0] : inner).trim();
|
|
100
|
+
const fallback = commaSplit ? commaSplit[1] : null;
|
|
101
|
+
let replacement;
|
|
102
|
+
if (seen.has(name)) {
|
|
103
|
+
replacement = expr.slice(start, closeIndex + 1);
|
|
104
|
+
} else if (name in raw) {
|
|
105
|
+
seen.add(name);
|
|
106
|
+
replacement = reference(name, seen);
|
|
107
|
+
seen.delete(name);
|
|
108
|
+
} else if (fallback !== null) {
|
|
109
|
+
replacement = substitute(fallback.trim(), seen);
|
|
110
|
+
} else {
|
|
111
|
+
replacement = expr.slice(start, closeIndex + 1);
|
|
112
|
+
}
|
|
113
|
+
const rest = substitute(expr.slice(closeIndex + 1), seen);
|
|
114
|
+
return expr.slice(0, start) + replacement + rest;
|
|
115
|
+
};
|
|
116
|
+
const reference = (name, seen) => {
|
|
117
|
+
if (name in cache) {
|
|
118
|
+
return cache[name];
|
|
119
|
+
}
|
|
120
|
+
const value = raw[name];
|
|
121
|
+
if (value === undefined) {
|
|
122
|
+
return '';
|
|
123
|
+
}
|
|
124
|
+
const resolved = evaluate(value.includes('var(') ? substitute(value, seen) : value);
|
|
125
|
+
cache[name] = resolved;
|
|
126
|
+
return resolved;
|
|
127
|
+
};
|
|
128
|
+
for (const name of Object.keys(raw)) {
|
|
129
|
+
reference(name, new Set());
|
|
130
|
+
}
|
|
131
|
+
return cache;
|
|
132
|
+
}
|
package/dist/theme/tokens.d.ts
CHANGED
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
*
|
|
16
16
|
* SYNC: When modified, update:
|
|
17
17
|
* - /packages/core/src/theme/useTheme.ts
|
|
18
|
+
* - /packages/core/src/theme/tokenReferences.ts (the `var()` resolver)
|
|
18
19
|
* - /packages/core/src/theme/index.ts
|
|
19
20
|
*/
|
|
20
21
|
import { type DefinedTheme, type TokenName } from './defineTheme.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../src/theme/tokens.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../src/theme/tokens.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,SAAS,EAEf,MAAM,eAAe,CAAC;AASvB,kFAAkF;AAClF,MAAM,MAAM,iBAAiB,GAAG,OAAO,GAAG,MAAM,CAAC;AAEjD,4DAA4D;AAC5D,MAAM,WAAW,yBAAyB;IACxC,kGAAkG;IAClG,IAAI,EAAE,iBAAiB,CAAC;CACzB;AAED,2DAA2D;AAC3D,MAAM,WAAW,wBAAyB,SAAQ,yBAAyB;IACzE,mFAAmF;IACnF,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,SAAS,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,GAAG,MAAM,CAEhE;AAED,sFAAsF;AACtF,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAElB,CAAC;AAgK/B;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,YAAY,GAAG,IAAI,GAAG,SAAS,EACtC,OAAO,EAAE,yBAAyB,GACjC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CA8CxB;AAED,2EAA2E;AAC3E,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,YAAY,GAAG,IAAI,GAAG,SAAS,EACtC,IAAI,EAAE,SAAS,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,EAC/B,OAAO,EAAE,wBAAwB,GAChC,MAAM,CAGR"}
|
package/dist/theme/tokens.js
CHANGED
|
@@ -17,12 +17,14 @@
|
|
|
17
17
|
*
|
|
18
18
|
* SYNC: When modified, update:
|
|
19
19
|
* - /packages/core/src/theme/useTheme.ts
|
|
20
|
+
* - /packages/core/src/theme/tokenReferences.ts (the `var()` resolver)
|
|
20
21
|
* - /packages/core/src/theme/index.ts
|
|
21
22
|
*/
|
|
22
23
|
|
|
23
24
|
import { tokenDefaults } from "./defineTheme.js";
|
|
24
25
|
import { parseColor, formatColor } from "../utils/color.js";
|
|
25
26
|
import { generatedScopedStatusRoleDefaults } from "./generateThemeRules.js";
|
|
27
|
+
import { findMatchingParen, resolveTokenReferences, splitTopLevelComma } from "./tokenReferences.js";
|
|
26
28
|
|
|
27
29
|
/** Resolved color mode used when choosing the side of light/dark token values. */
|
|
28
30
|
|
|
@@ -54,45 +56,6 @@ export function tokenVar(name) {
|
|
|
54
56
|
/** Flat map of every known Astryx token name to its `var(--token-name)` reference. */
|
|
55
57
|
export const tokenVars = Object.fromEntries(Object.keys(tokenDefaults).map(name => [name, tokenVar(name)]));
|
|
56
58
|
|
|
57
|
-
/**
|
|
58
|
-
* Split the arguments of a CSS function body on the first top-level comma.
|
|
59
|
-
* Handles nested functions such as rgba(), color-mix(), var(), and quoted strings.
|
|
60
|
-
*/
|
|
61
|
-
function splitTopLevelComma(input) {
|
|
62
|
-
let depth = 0;
|
|
63
|
-
let quote = null;
|
|
64
|
-
let isEscaped = false;
|
|
65
|
-
for (let i = 0; i < input.length; i++) {
|
|
66
|
-
const char = input[i];
|
|
67
|
-
if (quote !== null) {
|
|
68
|
-
if (isEscaped) {
|
|
69
|
-
isEscaped = false;
|
|
70
|
-
} else if (char === '\\') {
|
|
71
|
-
isEscaped = true;
|
|
72
|
-
} else if (char === quote) {
|
|
73
|
-
quote = null;
|
|
74
|
-
}
|
|
75
|
-
continue;
|
|
76
|
-
}
|
|
77
|
-
if (char === '"' || char === "'") {
|
|
78
|
-
quote = char;
|
|
79
|
-
continue;
|
|
80
|
-
}
|
|
81
|
-
if (char === '(') {
|
|
82
|
-
depth++;
|
|
83
|
-
continue;
|
|
84
|
-
}
|
|
85
|
-
if (char === ')') {
|
|
86
|
-
depth = Math.max(0, depth - 1);
|
|
87
|
-
continue;
|
|
88
|
-
}
|
|
89
|
-
if (char === ',' && depth === 0) {
|
|
90
|
-
return [input.slice(0, i).trim(), input.slice(i + 1).trim()];
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
return null;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
59
|
/** Parse a CSS light-dark(light, dark) function into its two argument values. */
|
|
97
60
|
function parseLightDark(value) {
|
|
98
61
|
const trimmed = value.trim();
|
|
@@ -129,27 +92,11 @@ function resolveXDSTokenValue(value, mode) {
|
|
|
129
92
|
// Generated themes emit derived tokens as references to other tokens rather
|
|
130
93
|
// than baked-in values, so a scoped CSS override of a base token re-themes the
|
|
131
94
|
// subtree that references it. The CSS cascade resolves those references, but
|
|
132
|
-
// non-CSS consumers (canvas, SVG, data-viz) need the concrete value.
|
|
133
|
-
//
|
|
134
|
-
// the resolved token map (
|
|
135
|
-
// the CSS color functions used by the theme generator against those
|
|
136
|
-
|
|
137
|
-
/** Index of the `)` matching the `(` at `openIndex`, or -1 when unbalanced. */
|
|
138
|
-
function findMatchingParen(input, openIndex) {
|
|
139
|
-
let depth = 0;
|
|
140
|
-
for (let i = openIndex; i < input.length; i++) {
|
|
141
|
-
const char = input[i];
|
|
142
|
-
if (char === '(') {
|
|
143
|
-
depth++;
|
|
144
|
-
} else if (char === ')') {
|
|
145
|
-
depth--;
|
|
146
|
-
if (depth === 0) {
|
|
147
|
-
return i;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
return -1;
|
|
152
|
-
}
|
|
95
|
+
// non-CSS consumers (canvas, SVG, data-viz) need the concrete value. The same
|
|
96
|
+
// resolution replays in JS: tokenReferences.ts follows `var()` references
|
|
97
|
+
// through the resolved token map (guarding against cycles), and these helpers
|
|
98
|
+
// evaluate the CSS color functions used by the theme generator against those
|
|
99
|
+
// values.
|
|
153
100
|
|
|
154
101
|
/** Split a color-mix component into its color and optional percentage. */
|
|
155
102
|
function parseMixComponent(part) {
|
|
@@ -262,73 +209,6 @@ function evaluateColorFunctions(expr) {
|
|
|
262
209
|
return expr.slice(0, idx) + replacement + evaluateColorFunctions(expr.slice(closeIndex + 1));
|
|
263
210
|
}
|
|
264
211
|
|
|
265
|
-
/**
|
|
266
|
-
* Substitute `var(--name[, fallback])` references with their resolved values.
|
|
267
|
-
* `seen` tracks the reference chain so cycles resolve to the literal reference
|
|
268
|
-
* instead of recursing forever.
|
|
269
|
-
*/
|
|
270
|
-
function substituteVars(expr, raw, cache, seen) {
|
|
271
|
-
const start = expr.indexOf('var(');
|
|
272
|
-
if (start === -1) {
|
|
273
|
-
return expr;
|
|
274
|
-
}
|
|
275
|
-
const openIndex = start + 'var'.length;
|
|
276
|
-
const closeIndex = findMatchingParen(expr, openIndex);
|
|
277
|
-
if (closeIndex === -1) {
|
|
278
|
-
return expr;
|
|
279
|
-
}
|
|
280
|
-
const inner = expr.slice(openIndex + 1, closeIndex);
|
|
281
|
-
const commaSplit = splitTopLevelComma(inner);
|
|
282
|
-
const name = (commaSplit ? commaSplit[0] : inner).trim();
|
|
283
|
-
const fallback = commaSplit ? commaSplit[1] : null;
|
|
284
|
-
let replacement;
|
|
285
|
-
if (seen.has(name)) {
|
|
286
|
-
replacement = expr.slice(start, closeIndex + 1);
|
|
287
|
-
} else if (name in raw) {
|
|
288
|
-
seen.add(name);
|
|
289
|
-
replacement = resolveReference(name, raw, cache, seen);
|
|
290
|
-
seen.delete(name);
|
|
291
|
-
} else if (fallback !== null) {
|
|
292
|
-
replacement = substituteVars(fallback.trim(), raw, cache, seen);
|
|
293
|
-
} else {
|
|
294
|
-
replacement = expr.slice(start, closeIndex + 1);
|
|
295
|
-
}
|
|
296
|
-
const rest = substituteVars(expr.slice(closeIndex + 1), raw, cache, seen);
|
|
297
|
-
return expr.slice(0, start) + replacement + rest;
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
/** Fully resolve a single expression: substitute references, then evaluate colors. */
|
|
301
|
-
function resolveExpression(expr, raw, cache, seen) {
|
|
302
|
-
if (!expr.includes('var(') && !expr.includes('color-mix(')) {
|
|
303
|
-
return expr;
|
|
304
|
-
}
|
|
305
|
-
const substituted = substituteVars(expr, raw, cache, seen);
|
|
306
|
-
return evaluateColorFunctions(substituted);
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
/** Resolve one token by name, memoizing the result in `cache`. */
|
|
310
|
-
function resolveReference(name, raw, cache, seen) {
|
|
311
|
-
if (name in cache) {
|
|
312
|
-
return cache[name];
|
|
313
|
-
}
|
|
314
|
-
const value = raw[name];
|
|
315
|
-
if (value === undefined) {
|
|
316
|
-
return '';
|
|
317
|
-
}
|
|
318
|
-
const resolved = resolveExpression(value, raw, cache, seen);
|
|
319
|
-
cache[name] = resolved;
|
|
320
|
-
return resolved;
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
/** Resolve every reference/color function in a raw token map to concrete values. */
|
|
324
|
-
function resolveReferences(raw) {
|
|
325
|
-
const cache = {};
|
|
326
|
-
for (const name of Object.keys(raw)) {
|
|
327
|
-
resolveReference(name, raw, cache, new Set());
|
|
328
|
-
}
|
|
329
|
-
return cache;
|
|
330
|
-
}
|
|
331
|
-
|
|
332
212
|
/**
|
|
333
213
|
* Resolve all Astryx token values for a theme and effective color mode.
|
|
334
214
|
*
|
|
@@ -352,7 +232,7 @@ export function resolveThemeTokens(theme, options) {
|
|
|
352
232
|
resolved[key] = resolveXDSTokenValue(value, mode);
|
|
353
233
|
}
|
|
354
234
|
if (theme == null) {
|
|
355
|
-
return
|
|
235
|
+
return resolveTokenReferences(resolved, evaluateColorFunctions);
|
|
356
236
|
}
|
|
357
237
|
|
|
358
238
|
// A theme's local tokens resolve its references to them, then leave the
|
|
@@ -378,7 +258,7 @@ export function resolveThemeTokens(theme, options) {
|
|
|
378
258
|
}
|
|
379
259
|
}
|
|
380
260
|
}
|
|
381
|
-
return Object.fromEntries(Object.entries(
|
|
261
|
+
return Object.fromEntries(Object.entries(resolveTokenReferences(resolved, evaluateColorFunctions)).filter(([key]) => !localKeys.has(key)));
|
|
382
262
|
}
|
|
383
263
|
|
|
384
264
|
/** Resolve one Astryx token value for a theme and effective color mode. */
|
|
@@ -340,10 +340,22 @@ export declare const durationVars: stylex.VarGroup<Readonly<{
|
|
|
340
340
|
export type DurationVarName = keyof typeof durationDefaults;
|
|
341
341
|
export declare const easeDefaults: {
|
|
342
342
|
readonly '--ease-standard': "cubic-bezier(0.24, 1, 0.4, 1)";
|
|
343
|
+
/**
|
|
344
|
+
* Entrances: a layer or element arriving. A theme's `character` sets it
|
|
345
|
+
* (spec:AST-108 FR2); at `'standard'` it equals --ease-standard.
|
|
346
|
+
*/
|
|
347
|
+
readonly '--ease-entrance': "cubic-bezier(0.24, 1, 0.4, 1)";
|
|
348
|
+
/**
|
|
349
|
+
* Moves: an element changing place or size on screen. A theme's
|
|
350
|
+
* `character` sets it; at `'standard'` it equals --ease-standard.
|
|
351
|
+
*/
|
|
352
|
+
readonly '--ease-move': "cubic-bezier(0.24, 1, 0.4, 1)";
|
|
343
353
|
readonly '--ease-exit': "cubic-bezier(0.3, 0, 0.6, 0.6)";
|
|
344
354
|
};
|
|
345
355
|
export declare const easeVars: stylex.VarGroup<Readonly<{
|
|
346
356
|
readonly '--ease-standard': "cubic-bezier(0.24, 1, 0.4, 1)";
|
|
357
|
+
readonly '--ease-entrance': "cubic-bezier(0.24, 1, 0.4, 1)";
|
|
358
|
+
readonly '--ease-move': "cubic-bezier(0.24, 1, 0.4, 1)";
|
|
347
359
|
readonly '--ease-exit': "cubic-bezier(0.3, 0, 0.6, 0.6)";
|
|
348
360
|
}>, symbol>;
|
|
349
361
|
export type EaseVarName = keyof typeof easeDefaults;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.stylex.d.ts","sourceRoot":"","sources":["../../src/theme/tokens.stylex.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAM3C,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsJhB,CAAC;AAEX,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAAmC,CAAC;AAS1D,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;CAgBlB,CAAC;AAEX,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;WAAqC,CAAC;AAM9D,eAAO,MAAM,YAAY;;;;CAIf,CAAC;AAEX,eAAO,MAAM,QAAQ;;;;WAAkC,CAAC;AAMxD,eAAO,MAAM,cAAc;;CAEjB,CAAC;AAEX,eAAO,MAAM,UAAU;;WAAoC,CAAC;AAE5D,MAAM,MAAM,aAAa,GAAG,MAAM,OAAO,cAAc,CAAC;AAWxD,eAAO,MAAM,aAAa;;;;;CAKhB,CAAC;AAEX,eAAO,MAAM,SAAS;;;;;WAAmC,CAAC;AAM1D,eAAO,MAAM,cAAc;;;;;;;;CAWjB,CAAC;AAEX,eAAO,MAAM,UAAU;;;;;;;;WAAoC,CAAC;AAQ5D,eAAO,MAAM,cAAc;;;;;;;;;CAejB,CAAC;AAEX,eAAO,MAAM,UAAU;;;;;;;;;WAAoC,CAAC;AAU5D,eAAO,MAAM,gBAAgB;;;;;;;;;;CAUnB,CAAC;AAEX,eAAO,MAAM,YAAY;;;;;;;;;;WAAsC,CAAC;AAEhE,MAAM,MAAM,eAAe,GAAG,MAAM,OAAO,gBAAgB,CAAC;AAU5D,eAAO,MAAM,YAAY;;;
|
|
1
|
+
{"version":3,"file":"tokens.stylex.d.ts","sourceRoot":"","sources":["../../src/theme/tokens.stylex.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAM3C,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsJhB,CAAC;AAEX,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAAmC,CAAC;AAS1D,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;CAgBlB,CAAC;AAEX,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;WAAqC,CAAC;AAM9D,eAAO,MAAM,YAAY;;;;CAIf,CAAC;AAEX,eAAO,MAAM,QAAQ;;;;WAAkC,CAAC;AAMxD,eAAO,MAAM,cAAc;;CAEjB,CAAC;AAEX,eAAO,MAAM,UAAU;;WAAoC,CAAC;AAE5D,MAAM,MAAM,aAAa,GAAG,MAAM,OAAO,cAAc,CAAC;AAWxD,eAAO,MAAM,aAAa;;;;;CAKhB,CAAC;AAEX,eAAO,MAAM,SAAS;;;;;WAAmC,CAAC;AAM1D,eAAO,MAAM,cAAc;;;;;;;;CAWjB,CAAC;AAEX,eAAO,MAAM,UAAU;;;;;;;;WAAoC,CAAC;AAQ5D,eAAO,MAAM,cAAc;;;;;;;;;CAejB,CAAC;AAEX,eAAO,MAAM,UAAU;;;;;;;;;WAAoC,CAAC;AAU5D,eAAO,MAAM,gBAAgB;;;;;;;;;;CAUnB,CAAC;AAEX,eAAO,MAAM,YAAY;;;;;;;;;;WAAsC,CAAC;AAEhE,MAAM,MAAM,eAAe,GAAG,MAAM,OAAO,gBAAgB,CAAC;AAU5D,eAAO,MAAM,YAAY;;IAEvB;;;OAGG;;IAEH;;;OAGG;;;CAGK,CAAC;AAEX,eAAO,MAAM,QAAQ;;;;;WAAkC,CAAC;AAExD,MAAM,MAAM,WAAW,GAAG,MAAM,OAAO,YAAY,CAAC;AAKpD,eAAO,MAAM,kBAAkB;;;;CAMrB,CAAC;AAEX,eAAO,MAAM,cAAc;;;;WAAwC,CAAC;AAMpE,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;CAcnB,CAAC;AAEX,eAAO,MAAM,YAAY;;;;;;;;;;;;;WAAsC,CAAC;AAMhE,eAAO,MAAM,kBAAkB;;;;;CAKrB,CAAC;AAEX,eAAO,MAAM,cAAc;;;;;WAAwC,CAAC;AAMpE,MAAM,MAAM,YAAY,GAAG,MAAM,OAAO,aAAa,CAAC;AACtD,MAAM,MAAM,cAAc,GAAG,MAAM,OAAO,eAAe,CAAC;AAC1D,MAAM,MAAM,WAAW,GAAG,MAAM,OAAO,YAAY,CAAC;AACpD,MAAM,MAAM,aAAa,GAAG,MAAM,OAAO,cAAc,CAAC;AACxD,MAAM,MAAM,aAAa,GAAG,MAAM,OAAO,cAAc,CAAC;AACxD,MAAM,MAAM,iBAAiB,GAAG,MAAM,OAAO,kBAAkB,CAAC;AAChE,MAAM,MAAM,eAAe,GAAG,MAAM,OAAO,gBAAgB,CAAC;AAC5D,MAAM,MAAM,iBAAiB,GAAG,MAAM,OAAO,kBAAkB,CAAC;AAehE,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0DpB,CAAC;AAEX,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAAuC,CAAC;AAElE,MAAM,MAAM,gBAAgB,GAAG,MAAM,OAAO,iBAAiB,CAAC"}
|
|
@@ -455,10 +455,22 @@ export const durationVars = {
|
|
|
455
455
|
|
|
456
456
|
export const easeDefaults = {
|
|
457
457
|
'--ease-standard': 'cubic-bezier(0.24, 1, 0.4, 1)',
|
|
458
|
+
/**
|
|
459
|
+
* Entrances: a layer or element arriving. A theme's `character` sets it
|
|
460
|
+
* (spec:AST-108 FR2); at `'standard'` it equals --ease-standard.
|
|
461
|
+
*/
|
|
462
|
+
'--ease-entrance': 'cubic-bezier(0.24, 1, 0.4, 1)',
|
|
463
|
+
/**
|
|
464
|
+
* Moves: an element changing place or size on screen. A theme's
|
|
465
|
+
* `character` sets it; at `'standard'` it equals --ease-standard.
|
|
466
|
+
*/
|
|
467
|
+
'--ease-move': 'cubic-bezier(0.24, 1, 0.4, 1)',
|
|
458
468
|
'--ease-exit': 'cubic-bezier(0.3, 0, 0.6, 0.6)'
|
|
459
469
|
};
|
|
460
470
|
export const easeVars = {
|
|
461
471
|
"--ease-standard": "var(--ease-standard)",
|
|
472
|
+
"--ease-entrance": "var(--ease-entrance)",
|
|
473
|
+
"--ease-move": "var(--ease-move)",
|
|
462
474
|
"--ease-exit": "var(--ease-exit)",
|
|
463
475
|
__varGroupHash__: "xf09i69"
|
|
464
476
|
};
|
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file focusReturn.ts
|
|
3
|
+
* @input The document's current active element and the shared interaction
|
|
4
|
+
* modality.
|
|
5
|
+
* @output Whether focus is currently "detached" — on nothing in particular —
|
|
6
|
+
* and a focus move whose ring follows the last input.
|
|
7
|
+
* @position Utility; used by overlay triggers (e.g. DateInput, DateTimeInput)
|
|
8
|
+
* that return focus to their control when the overlay closes, but only when
|
|
9
|
+
* the dismiss did not already move focus somewhere the user chose, and by
|
|
10
|
+
* overlays (Dialog, DropdownMenu) that move focus programmatically.
|
|
11
|
+
*/
|
|
12
|
+
import { type InteractionModality } from './interactionModality.js';
|
|
1
13
|
/**
|
|
2
14
|
* True when focus rests on nothing in particular — no active element, or the
|
|
3
15
|
* document body / root element.
|
|
@@ -21,8 +33,12 @@ export declare function isFocusDetached(doc?: Document): boolean;
|
|
|
21
33
|
* autofocus target, the control that opened a Dialog, or a menu trigger the
|
|
22
34
|
* caller renders. Pass `options` (for example `preventScroll`) as to `focus()`.
|
|
23
35
|
*
|
|
36
|
+
* `modality` defaults to the page's last input. A caller moving focus inside a
|
|
37
|
+
* second document (a same-origin iframe, a Document Picture-in-Picture window)
|
|
38
|
+
* passes that document's, which it tracks with `trackInteractionModalityIn`.
|
|
39
|
+
*
|
|
24
40
|
* Make sure modality tracking is active (`useInteractionModalityTracking()`)
|
|
25
41
|
* in the component that calls this.
|
|
26
42
|
*/
|
|
27
|
-
export declare function focusForLastInput(element: HTMLElement, options?: FocusOptions): void;
|
|
43
|
+
export declare function focusForLastInput(element: HTMLElement, options?: FocusOptions, modality?: InteractionModality): void;
|
|
28
44
|
//# sourceMappingURL=focusReturn.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"focusReturn.d.ts","sourceRoot":"","sources":["../../src/utils/focusReturn.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"focusReturn.d.ts","sourceRoot":"","sources":["../../src/utils/focusReturn.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AAEH,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,uBAAuB,CAAC;AAE/B;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAAC,GAAG,GAAE,QAAmB,GAAG,OAAO,CAKjE;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,WAAW,EACpB,OAAO,CAAC,EAAE,YAAY,EACtB,QAAQ,GAAE,mBAA8C,GACvD,IAAI,CA2BN"}
|
|
@@ -41,14 +41,21 @@ export function isFocusDetached(doc = document) {
|
|
|
41
41
|
* autofocus target, the control that opened a Dialog, or a menu trigger the
|
|
42
42
|
* caller renders. Pass `options` (for example `preventScroll`) as to `focus()`.
|
|
43
43
|
*
|
|
44
|
+
* `modality` defaults to the page's last input. A caller moving focus inside a
|
|
45
|
+
* second document (a same-origin iframe, a Document Picture-in-Picture window)
|
|
46
|
+
* passes that document's, which it tracks with `trackInteractionModalityIn`.
|
|
47
|
+
*
|
|
44
48
|
* Make sure modality tracking is active (`useInteractionModalityTracking()`)
|
|
45
49
|
* in the component that calls this.
|
|
46
50
|
*/
|
|
47
|
-
export function focusForLastInput(element, options) {
|
|
51
|
+
export function focusForLastInput(element, options, modality = getInteractionModality()) {
|
|
48
52
|
// A text-entry field paints its own focus treatment to show where typing
|
|
49
|
-
// goes, and an extra blur there can run validation or mark it touched.
|
|
50
|
-
|
|
51
|
-
|
|
53
|
+
// goes, and an extra blur there can run validation or mark it touched. The
|
|
54
|
+
// field's own window: one in an iframe or a Picture-in-Picture window is
|
|
55
|
+
// never an instance of the page's constructors.
|
|
56
|
+
const view = element.ownerDocument.defaultView ?? window;
|
|
57
|
+
const isTextEntry = element instanceof view.HTMLInputElement || element instanceof view.HTMLTextAreaElement || element instanceof view.HTMLSelectElement || element.isContentEditable;
|
|
58
|
+
if (isTextEntry || modality !== 'pointer') {
|
|
52
59
|
if (options === undefined) {
|
|
53
60
|
element.focus();
|
|
54
61
|
} else {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* The plain text a node renders through strings, numbers and element
|
|
4
|
+
* children, joined with spaces. Text a component renders internally, from
|
|
5
|
+
* props other than `children`, is not reachable and yields `''`.
|
|
6
|
+
*/
|
|
7
|
+
export declare function getNodeText(node: ReactNode): string;
|
|
8
|
+
//# sourceMappingURL=getNodeText.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getNodeText.d.ts","sourceRoot":"","sources":["../../src/utils/getNodeText.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AAErC;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAkBnD"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file getNodeText.ts
|
|
5
|
+
* @input Receives a React node
|
|
6
|
+
* @output Exports getNodeText, the node's plain text
|
|
7
|
+
* @position Shared utility; consumed where a rendered node also needs a
|
|
8
|
+
* spoken name (Toast announcements, Table column-resize handle names)
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { isValidElement } from 'react';
|
|
12
|
+
/**
|
|
13
|
+
* The plain text a node renders through strings, numbers and element
|
|
14
|
+
* children, joined with spaces. Text a component renders internally, from
|
|
15
|
+
* props other than `children`, is not reachable and yields `''`.
|
|
16
|
+
*/
|
|
17
|
+
export function getNodeText(node) {
|
|
18
|
+
if (node == null || typeof node === 'boolean') {
|
|
19
|
+
return '';
|
|
20
|
+
}
|
|
21
|
+
if (typeof node === 'string') {
|
|
22
|
+
return node;
|
|
23
|
+
}
|
|
24
|
+
if (typeof node === 'number') {
|
|
25
|
+
return String(node);
|
|
26
|
+
}
|
|
27
|
+
if (Array.isArray(node)) {
|
|
28
|
+
return node.map(getNodeText).filter(Boolean).join(' ');
|
|
29
|
+
}
|
|
30
|
+
if (/*#__PURE__*/isValidElement(node)) {
|
|
31
|
+
const {
|
|
32
|
+
children
|
|
33
|
+
} = node.props;
|
|
34
|
+
return getNodeText(children);
|
|
35
|
+
}
|
|
36
|
+
return '';
|
|
37
|
+
}
|
|
@@ -2,8 +2,17 @@ export type InteractionModality = 'keyboard' | 'pointer';
|
|
|
2
2
|
declare function trackInteractionModality(): () => void;
|
|
3
3
|
/** Activate shared modality tracking when the first consumer mounts. */
|
|
4
4
|
export declare function useInteractionModalityTracking(): void;
|
|
5
|
-
/**
|
|
6
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Track a second document while a consumer there is mounted: a component an
|
|
7
|
+
* app renders into a same-origin iframe or a Document Picture-in-Picture
|
|
8
|
+
* window gets input there that never reaches the page's listeners. The first
|
|
9
|
+
* consumer installs the document's listener pair and the last one's cleanup
|
|
10
|
+
* removes it. Read the value with `getInteractionModality(doc)`. The page's
|
|
11
|
+
* own document keeps its document-lifetime listeners.
|
|
12
|
+
*/
|
|
13
|
+
export declare function trackInteractionModalityIn(targetDocument: Document): () => void;
|
|
14
|
+
/** How the user last interacted with the page, or with `targetDocument`. */
|
|
15
|
+
export declare function getInteractionModality(targetDocument?: Document): InteractionModality;
|
|
7
16
|
/** Test-only: restore the initial state between cases. */
|
|
8
17
|
export declare function __resetInteractionModalityForTest(): void;
|
|
9
18
|
/** Test-only: activate the tracker without rendering a hook. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactionModality.d.ts","sourceRoot":"","sources":["../../src/utils/interactionModality.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"interactionModality.d.ts","sourceRoot":"","sources":["../../src/utils/interactionModality.ts"],"names":[],"mappings":"AAwCA,MAAM,MAAM,mBAAmB,GAAG,UAAU,GAAG,SAAS,CAAC;AAgDzD,iBAAS,wBAAwB,IAAI,MAAM,IAAI,CAsB9C;AAED,wEAAwE;AACxE,wBAAgB,8BAA8B,IAAI,IAAI,CAErD;AAED;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CACxC,cAAc,EAAE,QAAQ,GACvB,MAAM,IAAI,CAkCZ;AAED,4EAA4E;AAC5E,wBAAgB,sBAAsB,CACpC,cAAc,CAAC,EAAE,QAAQ,GACxB,mBAAmB,CAOrB;AAED,0DAA0D;AAC1D,wBAAgB,iCAAiC,IAAI,IAAI,CAIxD;AAED,gEAAgE;AAChE,eAAO,MAAM,yCAAyC,iCAC5B,CAAC"}
|
|
@@ -6,7 +6,9 @@
|
|
|
6
6
|
* @file interactionModality.ts
|
|
7
7
|
* @input Global pointerdown/keydown events
|
|
8
8
|
* @output `useInteractionModalityTracking()` activates document-lifetime tracking;
|
|
9
|
-
* `getInteractionModality()` reads how the user last interacted
|
|
9
|
+
* `getInteractionModality()` reads how the user last interacted;
|
|
10
|
+
* `trackInteractionModalityIn(doc)` and `getInteractionModality(doc)` do the
|
|
11
|
+
* same for a second document
|
|
10
12
|
* @position Internal document-wide singleton; used where `:focus-visible` alone
|
|
11
13
|
* is too broad
|
|
12
14
|
*
|
|
@@ -26,8 +28,12 @@
|
|
|
26
28
|
* The store lives on `document`, so duplicate Astryx bundles share one state
|
|
27
29
|
* value and one listener pair. The first mounted consumer activates tracking;
|
|
28
30
|
* the listeners then remain for the document lifetime so input during a gap
|
|
29
|
-
* between consumers is not lost.
|
|
30
|
-
*
|
|
31
|
+
* between consumers is not lost. A second document (a same-origin iframe, a
|
|
32
|
+
* Document Picture-in-Picture window) gets its own store when a component
|
|
33
|
+
* tracks it, since input there never reaches the page's listeners; its
|
|
34
|
+
* listeners stay only while a consumer there is mounted. Importing this module
|
|
35
|
+
* has no DOM side effects, and server rendering keeps the keyboard-safe
|
|
36
|
+
* default.
|
|
31
37
|
*/
|
|
32
38
|
import { useEffect } from 'react';
|
|
33
39
|
const interactionModalityStoreKey = Symbol.for('@astryxdesign/core/interaction-modality/v1');
|
|
@@ -89,8 +95,55 @@ export function useInteractionModalityTracking() {
|
|
|
89
95
|
useEffect(() => trackInteractionModality(), []);
|
|
90
96
|
}
|
|
91
97
|
|
|
92
|
-
/**
|
|
93
|
-
|
|
98
|
+
/**
|
|
99
|
+
* Track a second document while a consumer there is mounted: a component an
|
|
100
|
+
* app renders into a same-origin iframe or a Document Picture-in-Picture
|
|
101
|
+
* window gets input there that never reaches the page's listeners. The first
|
|
102
|
+
* consumer installs the document's listener pair and the last one's cleanup
|
|
103
|
+
* removes it. Read the value with `getInteractionModality(doc)`. The page's
|
|
104
|
+
* own document keeps its document-lifetime listeners.
|
|
105
|
+
*/
|
|
106
|
+
export function trackInteractionModalityIn(targetDocument) {
|
|
107
|
+
if (typeof document !== 'undefined' && targetDocument === document) {
|
|
108
|
+
return trackInteractionModality();
|
|
109
|
+
}
|
|
110
|
+
const store = getStore(targetDocument);
|
|
111
|
+
store.consumers = (store.consumers ?? 0) + 1;
|
|
112
|
+
if (store.consumers === 1) {
|
|
113
|
+
store.isListening = true;
|
|
114
|
+
targetDocument.addEventListener('pointerdown', store.onPointerDown, {
|
|
115
|
+
capture: true,
|
|
116
|
+
passive: true
|
|
117
|
+
});
|
|
118
|
+
targetDocument.addEventListener('keydown', store.onKeyDown, {
|
|
119
|
+
capture: true,
|
|
120
|
+
passive: true
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
let isReleased = false;
|
|
124
|
+
return () => {
|
|
125
|
+
if (isReleased) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
isReleased = true;
|
|
129
|
+
store.consumers = (store.consumers ?? 1) - 1;
|
|
130
|
+
if (store.consumers === 0) {
|
|
131
|
+
store.isListening = false;
|
|
132
|
+
targetDocument.removeEventListener('pointerdown', store.onPointerDown, {
|
|
133
|
+
capture: true
|
|
134
|
+
});
|
|
135
|
+
targetDocument.removeEventListener('keydown', store.onKeyDown, {
|
|
136
|
+
capture: true
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/** How the user last interacted with the page, or with `targetDocument`. */
|
|
143
|
+
export function getInteractionModality(targetDocument) {
|
|
144
|
+
if (targetDocument != null) {
|
|
145
|
+
return getStore(targetDocument).modality;
|
|
146
|
+
}
|
|
94
147
|
return typeof document === 'undefined' ? 'keyboard' : getStore(document).modality;
|
|
95
148
|
}
|
|
96
149
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactionOverlay.stylex.d.ts","sourceRoot":"","sources":["../../src/utils/interactionOverlay.stylex.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+EG;AAEH,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAG3C;;;;;;;;;;GAUG;AACH,eAAO,MAAM,SAAS;;WAEpB,CAAC;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW;IACtB,iEAAiE;;CAEjE,CAAC;
|
|
1
|
+
{"version":3,"file":"interactionOverlay.stylex.d.ts","sourceRoot":"","sources":["../../src/utils/interactionOverlay.stylex.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+EG;AAEH,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAG3C;;;;;;;;;;GAUG;AACH,eAAO,MAAM,SAAS;;WAEpB,CAAC;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW;IACtB,iEAAiE;;CAEjE,CAAC;AA6GH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8HnC,CAAC"}
|