@astryxdesign/core 0.7.7-canary.fc68123 → 0.7.7
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/CHANGELOG.md +104 -0
- package/dist/AlertDialog/AlertDialog.d.ts +1 -4
- package/dist/AlertDialog/AlertDialog.d.ts.map +1 -1
- package/dist/AlertDialog/AlertDialog.js +6 -36
- package/dist/BottomSheet/BottomSheetPanel.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheetPanel.js +4 -23
- package/dist/BottomSheet/useSheetGestures.d.ts.map +1 -1
- package/dist/BottomSheet/useSheetGestures.js +1 -3
- package/dist/Button/Button.d.ts.map +1 -1
- package/dist/Button/Button.js +1 -17
- package/dist/CheckboxInput/CheckboxInput.d.ts.map +1 -1
- package/dist/CheckboxInput/CheckboxInput.js +2 -13
- package/dist/ComplexSelector/ComplexSelector.d.ts +1 -4
- package/dist/ComplexSelector/ComplexSelector.d.ts.map +1 -1
- package/dist/ComplexSelector/ComplexSelector.js +4 -14
- package/dist/ContextMenu/ContextMenu.js +2 -2
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +31 -7
- package/dist/Field/Field.js +2 -2
- package/dist/HoverCard/HoverCard.d.ts +3 -4
- package/dist/HoverCard/HoverCard.d.ts.map +1 -1
- package/dist/HoverCard/HoverCard.js +2 -27
- package/dist/HoverCard/useHoverCard.d.ts +4 -5
- package/dist/HoverCard/useHoverCard.d.ts.map +1 -1
- package/dist/HoverCard/useHoverCard.js +31 -17
- package/dist/Icon/Icon.d.ts +1 -5
- package/dist/Icon/Icon.d.ts.map +1 -1
- package/dist/Icon/Icon.js +2 -5
- package/dist/Layer/usePressPin.d.ts +5 -17
- package/dist/Layer/usePressPin.d.ts.map +1 -1
- package/dist/Layer/usePressPin.js +12 -62
- package/dist/Lightbox/Lightbox.d.ts.map +1 -1
- package/dist/Lightbox/Lightbox.js +0 -18
- package/dist/PowerSearch/PowerSearch.d.ts +3 -36
- package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearch.js +127 -433
- package/dist/PowerSearch/PowerSearchEditPopover.d.ts +1 -32
- package/dist/PowerSearch/PowerSearchEditPopover.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchEditPopover.js +6 -17
- package/dist/PowerSearch/PowerSearchValueEditor.d.ts +3 -38
- package/dist/PowerSearch/PowerSearchValueEditor.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchValueEditor.js +61 -170
- package/dist/PowerSearch/formatFilterValue.d.ts +0 -7
- package/dist/PowerSearch/formatFilterValue.d.ts.map +1 -1
- package/dist/PowerSearch/formatFilterValue.js +1 -11
- package/dist/RadioList/RadioList.d.ts.map +1 -1
- package/dist/RadioList/RadioList.js +2 -3
- package/dist/RadioList/RadioListItem.d.ts +1 -1
- package/dist/RadioList/RadioListItem.d.ts.map +1 -1
- package/dist/RadioList/RadioListItem.js +3 -5
- package/dist/Resizable/ResizeHandle.d.ts +1 -2
- package/dist/Resizable/ResizeHandle.d.ts.map +1 -1
- package/dist/Resizable/ResizeHandle.js +77 -99
- package/dist/SegmentedControl/useSegmentedSelectionMotion.d.ts.map +1 -1
- package/dist/SegmentedControl/useSegmentedSelectionMotion.js +3 -3
- package/dist/Slider/sliderTouchController.js +2 -2
- package/dist/Spinner/Spinner.d.ts +1 -1
- package/dist/Spinner/Spinner.d.ts.map +1 -1
- package/dist/Spinner/Spinner.js +58 -60
- package/dist/Switch/useSwitchTouch.js +4 -4
- package/dist/Table/BaseTable.d.ts.map +1 -1
- package/dist/Table/BaseTable.js +8 -29
- package/dist/TextInput/TextInput.d.ts +2 -2
- package/dist/TextInput/TextInput.d.ts.map +1 -1
- package/dist/TextInput/TextInput.js +7 -10
- package/dist/Toast/Toast.d.ts +1 -11
- package/dist/Toast/Toast.d.ts.map +1 -1
- package/dist/Toast/Toast.js +15 -25
- package/dist/Toast/ToastViewport.d.ts.map +1 -1
- package/dist/Toast/ToastViewport.js +34 -94
- package/dist/Toast/types.d.ts +3 -9
- package/dist/Toast/types.d.ts.map +1 -1
- package/dist/Tooltip/useTooltip.d.ts +1 -19
- package/dist/Tooltip/useTooltip.d.ts.map +1 -1
- package/dist/Tooltip/useTooltip.js +53 -34
- package/dist/Typeahead/TypeaheadItem.d.ts +1 -2
- package/dist/Typeahead/TypeaheadItem.d.ts.map +1 -1
- package/dist/astryx.css +6 -35
- package/dist/gestures/PressTracker.d.ts.map +1 -1
- package/dist/gestures/PressTracker.js +3 -4
- package/dist/hooks/actionGroupTracker.d.ts +1 -4
- package/dist/hooks/actionGroupTracker.d.ts.map +1 -1
- package/dist/hooks/actionGroupTracker.js +3 -13
- package/dist/hooks/index.d.ts +0 -1
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +0 -1
- package/dist/hooks/useAttachment.d.ts +1 -1
- package/dist/hooks/useAttachment.js +1 -1
- package/dist/hooks/useInputStatusIcon.d.ts +1 -1
- package/dist/hooks/useInputStatusIcon.d.ts.map +1 -1
- package/dist/hooks/useInputStatusIcon.js +2 -2
- package/dist/hooks/useLongPress.d.ts +2 -6
- package/dist/hooks/useLongPress.d.ts.map +1 -1
- package/dist/hooks/useLongPress.js +15 -95
- 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-locales/en.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/en.generated.js +0 -30
- package/dist/i18n/generated-locales/pseudo.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/pseudo.generated.js +0 -30
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -4
- package/dist/motion/animatedLayout.d.ts.map +1 -1
- package/dist/motion/animatedLayout.js +6 -5
- package/dist/motion/animator.d.ts +14 -14
- package/dist/motion/animator.d.ts.map +1 -1
- package/dist/motion/animator.js +18 -41
- package/dist/utils/dateParser.d.ts.map +1 -1
- package/dist/utils/dateParser.js +0 -12
- package/dist/utils/focusReturn.d.ts +0 -15
- package/dist/utils/focusReturn.d.ts.map +1 -1
- package/dist/utils/focusReturn.js +0 -28
- package/dist/utils/interactionOverlay.stylex.d.ts +2 -3
- package/dist/utils/interactionOverlay.stylex.d.ts.map +1 -1
- package/dist/utils/interactionOverlay.stylex.js +2 -3
- package/dist/utils/pressFeedback.d.ts.map +1 -1
- package/dist/utils/pressFeedback.js +6 -19
- package/locales/en.json +0 -120
- package/locales/pseudo.json +0 -90
- package/package.json +5 -10
- package/src/AlertDialog/AlertDialog.doc.mjs +2 -2
- package/src/AlertDialog/AlertDialog.tsx +5 -37
- package/src/BottomSheet/BottomSheetPanel.tsx +3 -37
- package/src/BottomSheet/useSheetGestures.ts +1 -3
- package/src/Button/Button.tsx +4 -26
- package/src/CheckboxInput/CheckboxInput.doc.mjs +0 -18
- package/src/CheckboxInput/CheckboxInput.tsx +9 -36
- package/src/ComplexSelector/ComplexSelector.tsx +5 -20
- package/src/ContextMenu/ContextMenu.tsx +2 -2
- package/src/Dialog/Dialog.tsx +31 -10
- package/src/Field/Field.tsx +2 -2
- package/src/HoverCard/HoverCard.doc.mjs +2 -4
- package/src/HoverCard/HoverCard.tsx +4 -35
- package/src/HoverCard/useHoverCard.doc.mjs +36 -178
- package/src/HoverCard/useHoverCard.tsx +52 -46
- package/src/Icon/Icon.doc.mjs +8 -49
- package/src/Icon/Icon.tsx +7 -15
- package/src/Layer/usePressPin.ts +15 -81
- package/src/Lightbox/Lightbox.tsx +0 -18
- package/src/PowerSearch/PowerSearch.doc.mjs +5 -54
- package/src/PowerSearch/PowerSearch.tsx +155 -609
- package/src/PowerSearch/PowerSearchEditPopover.tsx +6 -28
- package/src/PowerSearch/PowerSearchValueEditor.tsx +38 -203
- package/src/PowerSearch/formatFilterValue.ts +1 -18
- package/src/RadioList/RadioList.tsx +2 -3
- package/src/RadioList/RadioListItem.tsx +3 -5
- package/src/Resizable/Resizable.doc.mjs +4 -5
- package/src/Resizable/ResizeHandle.tsx +109 -167
- package/src/SegmentedControl/useSegmentedSelectionMotion.ts +3 -6
- package/src/Slider/sliderTouchController.ts +2 -2
- package/src/Spinner/Spinner.tsx +63 -77
- package/src/Switch/useSwitchTouch.ts +4 -4
- package/src/Table/BaseTable.tsx +12 -46
- package/src/TextInput/TextInput.tsx +10 -11
- package/src/Toast/Toast.doc.mjs +3 -4
- package/src/Toast/Toast.tsx +32 -52
- package/src/Toast/ToastViewport.tsx +35 -121
- package/src/Toast/types.ts +3 -9
- package/src/Tooltip/useTooltip.doc.mjs +0 -24
- package/src/Tooltip/useTooltip.tsx +56 -61
- package/src/Typeahead/TypeaheadItem.doc.mjs +3 -6
- package/src/Typeahead/TypeaheadItem.tsx +1 -2
- package/src/gestures/PressTracker.ts +3 -4
- package/src/gestures/README.md +1 -7
- package/src/hooks/actionGroupTracker.ts +5 -20
- package/src/hooks/index.ts +0 -2
- package/src/hooks/useAttachment.ts +1 -1
- package/src/hooks/useInputStatusIcon.tsx +2 -3
- package/src/hooks/useLongPress.doc.mjs +2 -2
- package/src/hooks/useLongPress.ts +15 -136
- package/src/i18n/generated-english/PowerSearch/PowerSearchValueEditor.generated.ts +0 -6
- package/src/i18n/generated-locales/en.generated.ts +0 -41
- package/src/i18n/generated-locales/pseudo.generated.ts +0 -42
- package/src/index.ts +0 -13
- package/src/motion/README.md +5 -9
- package/src/motion/animatedLayout.ts +4 -5
- package/src/motion/animator.ts +29 -61
- package/src/utils/dateParser.ts +0 -16
- package/src/utils/focusReturn.ts +0 -30
- package/src/utils/interactionOverlay.stylex.ts +2 -3
- package/src/utils/pressFeedback.ts +6 -19
- package/dist/PowerSearch/PowerSearchBottomSheet.d.ts +0 -100
- package/dist/PowerSearch/PowerSearchBottomSheet.d.ts.map +0 -1
- package/dist/PowerSearch/PowerSearchBottomSheet.js +0 -1913
- package/dist/PowerSearch/formatTokenValue.d.ts +0 -28
- package/dist/PowerSearch/formatTokenValue.d.ts.map +0 -1
- package/dist/PowerSearch/formatTokenValue.js +0 -160
- package/dist/PowerSearch/powerSearchSheetUtils.d.ts +0 -65
- package/dist/PowerSearch/powerSearchSheetUtils.d.ts.map +0 -1
- package/dist/PowerSearch/powerSearchSheetUtils.js +0 -168
- package/dist/animator/createAnimator.d.ts +0 -98
- package/dist/animator/createAnimator.d.ts.map +0 -1
- package/dist/animator/createAnimator.js +0 -259
- package/dist/hooks/pressGroupContext.d.ts +0 -6
- package/dist/hooks/pressGroupContext.d.ts.map +0 -1
- package/dist/hooks/pressGroupContext.js +0 -20
- package/dist/hooks/useActionGroupTracking.d.ts +0 -53
- package/dist/hooks/useActionGroupTracking.d.ts.map +0 -1
- package/dist/hooks/useActionGroupTracking.js +0 -174
- package/dist/hooks/useAnimator.d.ts +0 -41
- package/dist/hooks/useAnimator.d.ts.map +0 -1
- package/dist/hooks/useAnimator.js +0 -70
- package/dist/i18n/generated-english/PowerSearch/PowerSearchBottomSheet.generated.d.ts +0 -8
- package/dist/i18n/generated-english/PowerSearch/PowerSearchBottomSheet.generated.d.ts.map +0 -1
- package/dist/i18n/generated-english/PowerSearch/PowerSearchBottomSheet.generated.js +0 -42
- package/dist/i18n/generated-english/PowerSearch/formatTokenValue.generated.d.ts +0 -8
- package/dist/i18n/generated-english/PowerSearch/formatTokenValue.generated.d.ts.map +0 -1
- package/dist/i18n/generated-english/PowerSearch/formatTokenValue.generated.js +0 -14
- package/dist/internal/indicatorPress.stylex.d.ts +0 -20
- package/dist/internal/indicatorPress.stylex.d.ts.map +0 -1
- package/dist/internal/indicatorPress.stylex.js +0 -26
- package/dist/motion/progress.d.ts +0 -88
- package/dist/motion/progress.d.ts.map +0 -1
- package/dist/motion/progress.js +0 -128
- package/dist/motion/uikit/alert.d.ts +0 -41
- package/dist/motion/uikit/alert.d.ts.map +0 -1
- package/dist/motion/uikit/alert.js +0 -43
- package/dist/privateAttributes/pressGroupItem.stylex.d.ts +0 -15
- package/dist/privateAttributes/pressGroupItem.stylex.d.ts.map +0 -1
- package/dist/privateAttributes/pressGroupItem.stylex.js +0 -23
- package/dist/utils/triggerFocus.d.ts +0 -36
- package/dist/utils/triggerFocus.d.ts.map +0 -1
- package/dist/utils/triggerFocus.js +0 -65
- package/src/PowerSearch/PowerSearchBottomSheet.tsx +0 -2515
- package/src/PowerSearch/formatTokenValue.ts +0 -215
- package/src/PowerSearch/powerSearchSheetUtils.ts +0 -224
- package/src/animator/createAnimator.doc.mjs +0 -153
- package/src/animator/createAnimator.ts +0 -324
- package/src/hooks/pressGroupContext.ts +0 -21
- package/src/hooks/useActionGroupTracking.ts +0 -224
- package/src/hooks/useAnimator.doc.mjs +0 -109
- package/src/hooks/useAnimator.ts +0 -67
- package/src/i18n/generated-english/PowerSearch/PowerSearchBottomSheet.generated.ts +0 -43
- package/src/i18n/generated-english/PowerSearch/formatTokenValue.generated.ts +0 -15
- package/src/internal/indicatorPress.stylex.ts +0 -24
- package/src/motion/progress.ts +0 -155
- package/src/motion/uikit/alert.ts +0 -43
- package/src/privateAttributes/pressGroupItem.stylex.ts +0 -23
- package/src/utils/triggerFocus.ts +0 -80
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @generated by scripts/generate-i18n-runtime.mjs from packages/core/locales/en.json,
|
|
5
|
-
* holding the English for the catalog keys named in packages/core/src/PowerSearch/PowerSearchBottomSheet.tsx.
|
|
6
|
-
* Do not edit by hand. Run `pnpm generate:i18n-runtime` instead.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
const english = {
|
|
10
|
-
"@astryx.powersearch.allFiltersRemoved": "All filters removed",
|
|
11
|
-
"@astryx.powersearch.editableFiltersRemoved": "Editable filters removed",
|
|
12
|
-
"@astryx.powersearch.editor.apply": "Apply",
|
|
13
|
-
"@astryx.powersearch.editor.cancel": "Cancel",
|
|
14
|
-
"@astryx.powersearch.editor.operator": "Operator",
|
|
15
|
-
"@astryx.powersearch.sheet.addFilter": "Add filter",
|
|
16
|
-
"@astryx.powersearch.sheet.clearAll": "Clear all",
|
|
17
|
-
"@astryx.powersearch.sheet.clearAllCancel": "Keep filters",
|
|
18
|
-
"@astryx.powersearch.sheet.clearAllConfirm": "Clear filters",
|
|
19
|
-
"@astryx.powersearch.sheet.clearAllDescription": "This removes all editable filters from this search.",
|
|
20
|
-
"@astryx.powersearch.sheet.clearAllTitle": "Clear all filters?",
|
|
21
|
-
"@astryx.powersearch.sheet.done": "Done",
|
|
22
|
-
"@astryx.powersearch.sheet.editableFiltersClearedWithCount": "Editable filters removed. {resultCount}",
|
|
23
|
-
"@astryx.powersearch.sheet.fieldOperator": "{field} {operator}",
|
|
24
|
-
"@astryx.powersearch.sheet.filterUnavailable": "This filter is no longer available",
|
|
25
|
-
"@astryx.powersearch.sheet.filtersClearedWithCount": "All filters removed. {resultCount}",
|
|
26
|
-
"@astryx.powersearch.sheet.filtersTitle": "Filters",
|
|
27
|
-
"@astryx.powersearch.sheet.labelValue": "{label} {value}",
|
|
28
|
-
"@astryx.powersearch.sheet.noFilters": "No filters applied",
|
|
29
|
-
"@astryx.powersearch.sheet.noFiltersDescription": "Add a filter to narrow your results and find what you need faster.",
|
|
30
|
-
"@astryx.powersearch.sheet.noMatchingFields": "No filters match your search",
|
|
31
|
-
"@astryx.powersearch.sheet.noResults": "No results found",
|
|
32
|
-
"@astryx.powersearch.sheet.removeFilter": "Remove {field} filter",
|
|
33
|
-
"@astryx.powersearch.sheet.search": "Search",
|
|
34
|
-
"@astryx.powersearch.sheet.searchFields": "Search filters",
|
|
35
|
-
"@astryx.powersearch.sheet.searchFieldsPlaceholder": "Search filters…",
|
|
36
|
-
"@astryx.powersearch.sheet.searchResults": "Search results",
|
|
37
|
-
"@astryx.powersearch.sheet.tryDifferentSearch": "Try a different search.",
|
|
38
|
-
"@astryx.powersearch.sheet.ungroupedFields": "General",
|
|
39
|
-
"@astryx.tokenizer.tokenAdded": "Added {label}",
|
|
40
|
-
"@astryx.tokenizer.tokenRemoved": "Removed {label}"
|
|
41
|
-
};
|
|
42
|
-
export default english;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @generated by scripts/generate-i18n-runtime.mjs from packages/core/locales/en.json,
|
|
3
|
-
* holding the English for the catalog keys named in packages/core/src/PowerSearch/formatTokenValue.ts.
|
|
4
|
-
* Do not edit by hand. Run `pnpm generate:i18n-runtime` instead.
|
|
5
|
-
*/
|
|
6
|
-
declare const english: Readonly<Record<string, string>>;
|
|
7
|
-
export default english;
|
|
8
|
-
//# sourceMappingURL=formatTokenValue.generated.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"formatTokenValue.generated.d.ts","sourceRoot":"","sources":["../../../../src/i18n/generated-english/PowerSearch/formatTokenValue.generated.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,QAAA,MAAM,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAI7C,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @generated by scripts/generate-i18n-runtime.mjs from packages/core/locales/en.json,
|
|
5
|
-
* holding the English for the catalog keys named in packages/core/src/PowerSearch/formatTokenValue.ts.
|
|
6
|
-
* Do not edit by hand. Run `pnpm generate:i18n-runtime` instead.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
const english = {
|
|
10
|
-
"@astryx.powersearch.valueEditor.dateRange": "date range",
|
|
11
|
-
"@astryx.powersearch.valueEditor.filtersCount": "{count, number} {count, plural, one {filter} other {filters}}",
|
|
12
|
-
"@astryx.powersearch.valueEditor.itemsCount": "{count, number} {count, plural, one {item} other {items}}"
|
|
13
|
-
};
|
|
14
|
-
export default english;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file indicatorPress.stylex.ts
|
|
3
|
-
* @input Uses StyleX
|
|
4
|
-
* @output Exports `indicatorPressScope`, the marker of a first-party
|
|
5
|
-
* indicator that paints its own press
|
|
6
|
-
* @position Internal entry for Astryx's own replacement indicators;
|
|
7
|
-
* CheckboxInput reads it
|
|
8
|
-
*/
|
|
9
|
-
import * as stylex from '@stylexjs/stylex';
|
|
10
|
-
/**
|
|
11
|
-
* Marks a first-party replacement indicator that paints its own press, for
|
|
12
|
-
* a shape that CheckboxInput's rounded-square press layer would tint past,
|
|
13
|
-
* such as a circle. CheckboxInput leaves that layer off over an indicator
|
|
14
|
-
* with this marker.
|
|
15
|
-
*
|
|
16
|
-
* @internal Not public API: the touch press reaches the indicator through a
|
|
17
|
-
* private property.
|
|
18
|
-
*/
|
|
19
|
-
export declare const indicatorPressScope: ReturnType<typeof stylex.defineMarker>;
|
|
20
|
-
//# sourceMappingURL=indicatorPress.stylex.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"indicatorPress.stylex.d.ts","sourceRoot":"","sources":["../../src/internal/indicatorPress.stylex.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAE3C;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,EAAE,UAAU,CAAC,OAAO,MAAM,CAAC,YAAY,CAChD,CAAC"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @file indicatorPress.stylex.ts
|
|
5
|
-
* @input Uses StyleX
|
|
6
|
-
* @output Exports `indicatorPressScope`, the marker of a first-party
|
|
7
|
-
* indicator that paints its own press
|
|
8
|
-
* @position Internal entry for Astryx's own replacement indicators;
|
|
9
|
-
* CheckboxInput reads it
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
import * as stylex from '@stylexjs/stylex';
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Marks a first-party replacement indicator that paints its own press, for
|
|
16
|
-
* a shape that CheckboxInput's rounded-square press layer would tint past,
|
|
17
|
-
* such as a circle. CheckboxInput leaves that layer off over an indicator
|
|
18
|
-
* with this marker.
|
|
19
|
-
*
|
|
20
|
-
* @internal Not public API: the touch press reaches the indicator through a
|
|
21
|
-
* private property.
|
|
22
|
-
*/
|
|
23
|
-
export const indicatorPressScope = {
|
|
24
|
-
x1lrrceh: "x1lrrceh",
|
|
25
|
-
$$css: true
|
|
26
|
-
};
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file progress.ts
|
|
3
|
-
* @input A spring, a normalized progress, an animator's presented velocities
|
|
4
|
-
* @output Exports `progressCurve` (a spring's progress from 0 to 1 as a
|
|
5
|
-
* MotionCurve), `mapProgress` (one curve as a function of another),
|
|
6
|
-
* `mapRange` (the clamped linear map most companions use) and
|
|
7
|
-
* `presentedProgressVelocity` (the progress velocity that continues what
|
|
8
|
-
* an animator shows)
|
|
9
|
-
* @position Shared by the motion building blocks that move several channels
|
|
10
|
-
* along one path and by companion motion (a
|
|
11
|
-
* scrim's dim following a sheet): one velocity unit, one curve mapping and
|
|
12
|
-
* one way to continue an interrupted motion
|
|
13
|
-
*
|
|
14
|
-
* A path is described by a normalized progress: 0 where it starts, 1 where
|
|
15
|
-
* it rests, beyond either end on a spring's overshoot. Its velocity is in
|
|
16
|
-
* progress per second; each channel's own velocity stays in the channel's
|
|
17
|
-
* units per second.
|
|
18
|
-
*
|
|
19
|
-
* An interrupted motion continues from what is on screen: the
|
|
20
|
-
* block reads the presented values and velocities from the animator at one
|
|
21
|
-
* `now` (`get`, `getVelocity`), restarts a path from those values, and starts
|
|
22
|
-
* its progress with the presented velocity projected on the path's tangent
|
|
23
|
-
* at its start, v·t / (t·t), where t = d(values)/dp. Channels are weighted
|
|
24
|
-
* into one unit first (px per unit of scale, say), so a scale and a
|
|
25
|
-
* translation count alike.
|
|
26
|
-
*
|
|
27
|
-
* A companion follows a driving curve through `mapProgress`, most often
|
|
28
|
-
* with `mapRange`: `mapProgress(sheetY, mapRange([closedY, openY], [0, dim]))`
|
|
29
|
-
* dims a scrim as a sheet rises. Played on another animator, it stays in
|
|
30
|
-
* lockstep only when it starts with its driver: pass the driver's start,
|
|
31
|
-
* `scrim.play({opacity}, {at: start})` with `start = await handle.started`
|
|
32
|
-
* (or one shared `at` for both calls); two calls from rest otherwise each
|
|
33
|
-
* start at their own commit.
|
|
34
|
-
*
|
|
35
|
-
* SYNC: When modified, update /packages/core/src/motion/progress.test.ts and
|
|
36
|
-
* /packages/core/src/motion/README.md.
|
|
37
|
-
*/
|
|
38
|
-
import type { Animator, MotionCurve, MotionProperty } from './animator.js';
|
|
39
|
-
import { type SpringDescription } from './spring.js';
|
|
40
|
-
/**
|
|
41
|
-
* The progress of `spring` from 0 to 1, starting with `velocity` (progress
|
|
42
|
-
* per second): exactly 1 once it settles within `epsilon`.
|
|
43
|
-
*/
|
|
44
|
-
export declare function progressCurve(spring: SpringDescription, { velocity, epsilon, }?: {
|
|
45
|
-
velocity?: number;
|
|
46
|
-
epsilon?: number;
|
|
47
|
-
}): MotionCurve;
|
|
48
|
-
/**
|
|
49
|
-
* The curve of `f(driver(t))`, its velocity by the chain rule: a channel
|
|
50
|
-
* following a path as its progress moves, or a companion following any
|
|
51
|
-
* driving curve (a sheet's `y` mapped onto its scrim's opacity). The driver
|
|
52
|
-
* is any MotionCurve, not only a progress from 0 to 1. A companion played on
|
|
53
|
-
* another animator starts with its driver (`{at: start}`; see the file
|
|
54
|
-
* header).
|
|
55
|
-
*/
|
|
56
|
-
export declare function mapProgress(driver: MotionCurve, f: (value: number) => number): MotionCurve;
|
|
57
|
-
/**
|
|
58
|
-
* The linear map from `input` to `output`, held at `output`'s ends outside
|
|
59
|
-
* `input` unless `clamp` is false: what most companions are (a scrim's dim
|
|
60
|
-
* along a sheet's travel, a parallax, a dismissal's fade). Either range may
|
|
61
|
-
* run backward (`[openY, closedY]`).
|
|
62
|
-
*/
|
|
63
|
-
export declare function mapRange(input: readonly [number, number], output: readonly [number, number], { clamp }?: {
|
|
64
|
-
clamp?: boolean;
|
|
65
|
-
}): (x: number) => number;
|
|
66
|
-
/**
|
|
67
|
-
* One channel of a path: an animator property and its value at each
|
|
68
|
-
* progress.
|
|
69
|
-
*/
|
|
70
|
-
export interface ProgressChannel {
|
|
71
|
-
readonly property: MotionProperty;
|
|
72
|
-
/** The property's value at progress `p`. */
|
|
73
|
-
at(p: number): number;
|
|
74
|
-
/**
|
|
75
|
-
* What one unit of the property weighs in the projection, in a unit the
|
|
76
|
-
* channels share (px per unit of scale for a box `weight` px wide). 1 by
|
|
77
|
-
* default.
|
|
78
|
-
*/
|
|
79
|
-
readonly weight?: number;
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* The progress velocity, per second, that continues what `animator`
|
|
83
|
-
* presents at `now` along a path that starts there: the presented velocity
|
|
84
|
-
* projected on the path's tangent at progress 0, v·t / (t·t). 0 when the
|
|
85
|
-
* path does not move any of its channels.
|
|
86
|
-
*/
|
|
87
|
-
export declare function presentedProgressVelocity(animator: Pick<Animator, 'getVelocity'>, channels: ReadonlyArray<ProgressChannel>, now?: number): number;
|
|
88
|
-
//# sourceMappingURL=progress.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../../src/motion/progress.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,OAAO,KAAK,EAAC,QAAQ,EAAE,WAAW,EAAE,cAAc,EAAC,MAAM,YAAY,CAAC;AACtE,OAAO,EAIL,KAAK,iBAAiB,EACvB,MAAM,UAAU,CAAC;AAKlB;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,iBAAiB,EACzB,EACE,QAAY,EACZ,OAA0B,GAC3B,GAAE;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAM,GAC5C,WAAW,CAQb;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CACzB,MAAM,EAAE,WAAW,EACnB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,GAC3B,WAAW,CAWb;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CACtB,KAAK,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,EAChC,MAAM,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,EACjC,EAAC,KAAY,EAAC,GAAE;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAM,GACrC,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAWvB;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAClC,4CAA4C;IAC5C,EAAE,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACtB;;;;OAIG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,aAAa,CAAC,EACvC,QAAQ,EAAE,aAAa,CAAC,eAAe,CAAC,EACxC,GAAG,CAAC,EAAE,MAAM,GACX,MAAM,CAUR"}
|
package/dist/motion/progress.js
DELETED
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @file progress.ts
|
|
5
|
-
* @input A spring, a normalized progress, an animator's presented velocities
|
|
6
|
-
* @output Exports `progressCurve` (a spring's progress from 0 to 1 as a
|
|
7
|
-
* MotionCurve), `mapProgress` (one curve as a function of another),
|
|
8
|
-
* `mapRange` (the clamped linear map most companions use) and
|
|
9
|
-
* `presentedProgressVelocity` (the progress velocity that continues what
|
|
10
|
-
* an animator shows)
|
|
11
|
-
* @position Shared by the motion building blocks that move several channels
|
|
12
|
-
* along one path and by companion motion (a
|
|
13
|
-
* scrim's dim following a sheet): one velocity unit, one curve mapping and
|
|
14
|
-
* one way to continue an interrupted motion
|
|
15
|
-
*
|
|
16
|
-
* A path is described by a normalized progress: 0 where it starts, 1 where
|
|
17
|
-
* it rests, beyond either end on a spring's overshoot. Its velocity is in
|
|
18
|
-
* progress per second; each channel's own velocity stays in the channel's
|
|
19
|
-
* units per second.
|
|
20
|
-
*
|
|
21
|
-
* An interrupted motion continues from what is on screen: the
|
|
22
|
-
* block reads the presented values and velocities from the animator at one
|
|
23
|
-
* `now` (`get`, `getVelocity`), restarts a path from those values, and starts
|
|
24
|
-
* its progress with the presented velocity projected on the path's tangent
|
|
25
|
-
* at its start, v·t / (t·t), where t = d(values)/dp. Channels are weighted
|
|
26
|
-
* into one unit first (px per unit of scale, say), so a scale and a
|
|
27
|
-
* translation count alike.
|
|
28
|
-
*
|
|
29
|
-
* A companion follows a driving curve through `mapProgress`, most often
|
|
30
|
-
* with `mapRange`: `mapProgress(sheetY, mapRange([closedY, openY], [0, dim]))`
|
|
31
|
-
* dims a scrim as a sheet rises. Played on another animator, it stays in
|
|
32
|
-
* lockstep only when it starts with its driver: pass the driver's start,
|
|
33
|
-
* `scrim.play({opacity}, {at: start})` with `start = await handle.started`
|
|
34
|
-
* (or one shared `at` for both calls); two calls from rest otherwise each
|
|
35
|
-
* start at their own commit.
|
|
36
|
-
*
|
|
37
|
-
* SYNC: When modified, update /packages/core/src/motion/progress.test.ts and
|
|
38
|
-
* /packages/core/src/motion/README.md.
|
|
39
|
-
*/
|
|
40
|
-
|
|
41
|
-
import { SETTLING_EPSILON, solveSpring, toSpring } from "./spring.js";
|
|
42
|
-
|
|
43
|
-
/** The step of the finite differences taken on a progress. */
|
|
44
|
-
const STEP = 1e-4;
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* The progress of `spring` from 0 to 1, starting with `velocity` (progress
|
|
48
|
-
* per second): exactly 1 once it settles within `epsilon`.
|
|
49
|
-
*/
|
|
50
|
-
export function progressCurve(spring, {
|
|
51
|
-
velocity = 0,
|
|
52
|
-
epsilon = SETTLING_EPSILON
|
|
53
|
-
} = {}) {
|
|
54
|
-
const curve = solveSpring(toSpring(spring), {
|
|
55
|
-
from: 0,
|
|
56
|
-
to: 1,
|
|
57
|
-
velocity
|
|
58
|
-
});
|
|
59
|
-
const duration = curve.settleTime(epsilon);
|
|
60
|
-
return {
|
|
61
|
-
duration,
|
|
62
|
-
at: t => t >= duration ? 1 : curve.value(t),
|
|
63
|
-
velocity: t => t >= duration ? 0 : curve.velocity(t)
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* The curve of `f(driver(t))`, its velocity by the chain rule: a channel
|
|
69
|
-
* following a path as its progress moves, or a companion following any
|
|
70
|
-
* driving curve (a sheet's `y` mapped onto its scrim's opacity). The driver
|
|
71
|
-
* is any MotionCurve, not only a progress from 0 to 1. A companion played on
|
|
72
|
-
* another animator starts with its driver (`{at: start}`; see the file
|
|
73
|
-
* header).
|
|
74
|
-
*/
|
|
75
|
-
export function mapProgress(driver, f) {
|
|
76
|
-
return {
|
|
77
|
-
duration: driver.duration,
|
|
78
|
-
at: t => f(driver.at(t)),
|
|
79
|
-
velocity: t => {
|
|
80
|
-
const value = driver.at(t);
|
|
81
|
-
return (f(value + STEP) - f(value - STEP)) / (2 * STEP) * driver.velocity(t);
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* The linear map from `input` to `output`, held at `output`'s ends outside
|
|
88
|
-
* `input` unless `clamp` is false: what most companions are (a scrim's dim
|
|
89
|
-
* along a sheet's travel, a parallax, a dismissal's fade). Either range may
|
|
90
|
-
* run backward (`[openY, closedY]`).
|
|
91
|
-
*/
|
|
92
|
-
export function mapRange(input, output, {
|
|
93
|
-
clamp = true
|
|
94
|
-
} = {}) {
|
|
95
|
-
const [a, b] = input;
|
|
96
|
-
const [c, d] = output;
|
|
97
|
-
return x => {
|
|
98
|
-
let t = a === b ? x < a ? 0 : 1 : (x - a) / (b - a);
|
|
99
|
-
if (clamp) {
|
|
100
|
-
t = Math.min(1, Math.max(0, t));
|
|
101
|
-
}
|
|
102
|
-
// Exact at both ends.
|
|
103
|
-
return t === 0 ? c : t === 1 ? d : c + (d - c) * t;
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* One channel of a path: an animator property and its value at each
|
|
109
|
-
* progress.
|
|
110
|
-
*/
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* The progress velocity, per second, that continues what `animator`
|
|
114
|
-
* presents at `now` along a path that starts there: the presented velocity
|
|
115
|
-
* projected on the path's tangent at progress 0, v·t / (t·t). 0 when the
|
|
116
|
-
* path does not move any of its channels.
|
|
117
|
-
*/
|
|
118
|
-
export function presentedProgressVelocity(animator, channels, now) {
|
|
119
|
-
let along = 0;
|
|
120
|
-
let squared = 0;
|
|
121
|
-
for (const channel of channels) {
|
|
122
|
-
const weight = channel.weight ?? 1;
|
|
123
|
-
const tangent = (channel.at(STEP) - channel.at(0)) / STEP * weight;
|
|
124
|
-
along += animator.getVelocity(channel.property, now) * weight * tangent;
|
|
125
|
-
squared += tangent * tangent;
|
|
126
|
-
}
|
|
127
|
-
return squared > 1e-12 ? along / squared : 0;
|
|
128
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file alert.ts
|
|
3
|
-
* @input Nothing; data only
|
|
4
|
-
* @output Exports `alertController`: how UIAlertController (`.alert`) tracks
|
|
5
|
-
* a finger across its actions
|
|
6
|
-
* @position The alert domain of the UIKit constants table (motion/uikit);
|
|
7
|
-
* its springs are `springs.alertPresent` and `springs.alertDismiss`
|
|
8
|
-
*
|
|
9
|
-
* Every value was read from UIKit on the iOS 26.2 simulator. A host app
|
|
10
|
-
* presented `UIAlertController(.alert)` with two and with three actions.
|
|
11
|
-
* Real HID touches drove it, and the action views' highlight was sampled
|
|
12
|
-
* every frame. Lengths are in pt (CSS px), durations in ms.
|
|
13
|
-
*
|
|
14
|
-
* Every leaf carries one or more `@source`; GUESS values also carry the
|
|
15
|
-
* `@measure` task that will confirm or replace them. uikit.test.ts enforces
|
|
16
|
-
* both.
|
|
17
|
-
*
|
|
18
|
-
* SYNC: When modified, update /packages/core/src/motion/MEASUREMENTS.md
|
|
19
|
-
*/
|
|
20
|
-
export declare const alertController: {
|
|
21
|
-
readonly actions: {
|
|
22
|
-
/**
|
|
23
|
-
* How long after touch-down the touched action highlights: none, it is
|
|
24
|
-
* highlighted in the touch-down frame (a tap and a 300 ms hold alike).
|
|
25
|
-
* @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
|
|
26
|
-
* iPhone 17 Pro, per-frame highlight of the action views under real HID
|
|
27
|
-
* touches, Oct 23 2026
|
|
28
|
-
*/
|
|
29
|
-
readonly highlightOnsetMs: 0;
|
|
30
|
-
/**
|
|
31
|
-
* How far outside an action the finger may go and keep it highlighted:
|
|
32
|
-
* none. The highlight cleared 1 pt below the action, and a lift there ran
|
|
33
|
-
* nothing. UIButton keeps 70 pt; an alert action does not.
|
|
34
|
-
* @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
|
|
35
|
-
* iPhone 17 Pro, per-frame highlight of the action views under real HID
|
|
36
|
-
* touches, Oct 23 2026
|
|
37
|
-
*/
|
|
38
|
-
readonly highlightExpansion: 0;
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
//# sourceMappingURL=alert.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"alert.d.ts","sourceRoot":"","sources":["../../../src/motion/uikit/alert.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,eAAO,MAAM,eAAe;;QAExB;;;;;;WAMG;;QAEH;;;;;;;WAOG;;;CAGG,CAAC"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @file alert.ts
|
|
5
|
-
* @input Nothing; data only
|
|
6
|
-
* @output Exports `alertController`: how UIAlertController (`.alert`) tracks
|
|
7
|
-
* a finger across its actions
|
|
8
|
-
* @position The alert domain of the UIKit constants table (motion/uikit);
|
|
9
|
-
* its springs are `springs.alertPresent` and `springs.alertDismiss`
|
|
10
|
-
*
|
|
11
|
-
* Every value was read from UIKit on the iOS 26.2 simulator. A host app
|
|
12
|
-
* presented `UIAlertController(.alert)` with two and with three actions.
|
|
13
|
-
* Real HID touches drove it, and the action views' highlight was sampled
|
|
14
|
-
* every frame. Lengths are in pt (CSS px), durations in ms.
|
|
15
|
-
*
|
|
16
|
-
* Every leaf carries one or more `@source`; GUESS values also carry the
|
|
17
|
-
* `@measure` task that will confirm or replace them. uikit.test.ts enforces
|
|
18
|
-
* both.
|
|
19
|
-
*
|
|
20
|
-
* SYNC: When modified, update /packages/core/src/motion/MEASUREMENTS.md
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
export const alertController = {
|
|
24
|
-
actions: {
|
|
25
|
-
/**
|
|
26
|
-
* How long after touch-down the touched action highlights: none, it is
|
|
27
|
-
* highlighted in the touch-down frame (a tap and a 300 ms hold alike).
|
|
28
|
-
* @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
|
|
29
|
-
* iPhone 17 Pro, per-frame highlight of the action views under real HID
|
|
30
|
-
* touches, Oct 23 2026
|
|
31
|
-
*/
|
|
32
|
-
highlightOnsetMs: 0,
|
|
33
|
-
/**
|
|
34
|
-
* How far outside an action the finger may go and keep it highlighted:
|
|
35
|
-
* none. The highlight cleared 1 pt below the action, and a lift there ran
|
|
36
|
-
* nothing. UIButton keeps 70 pt; an alert action does not.
|
|
37
|
-
* @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
|
|
38
|
-
* iPhone 17 Pro, per-frame highlight of the action views under real HID
|
|
39
|
-
* touches, Oct 23 2026
|
|
40
|
-
*/
|
|
41
|
-
highlightExpansion: 0
|
|
42
|
-
}
|
|
43
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file privateAttributes/pressGroupItem.stylex.ts
|
|
3
|
-
* @input Nothing: the private press-group-item attribute
|
|
4
|
-
* @output pressGroupItemProps, which marks an action a group's tracker
|
|
5
|
-
* follows, and isTrackedByGroup, which reads the mark
|
|
6
|
-
* @position Owner module of the private press-group-item attribute: the only
|
|
7
|
-
* file that writes its name. AlertDialog marks its actions, and the press
|
|
8
|
-
* controller (utils/pressFeedback.ts) leaves their press to the group's
|
|
9
|
-
* tracker. No package entry exports it.
|
|
10
|
-
*/
|
|
11
|
-
/** Spread on each action that a group's tracker follows. */
|
|
12
|
-
export declare const pressGroupItemProps: Readonly<Record<string, string>>;
|
|
13
|
-
/** Whether a group's tracker paints the press on `element` or an ancestor. */
|
|
14
|
-
export declare function isTrackedByGroup(element: Element): boolean;
|
|
15
|
-
//# sourceMappingURL=pressGroupItem.stylex.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pressGroupItem.stylex.d.ts","sourceRoot":"","sources":["../../src/privateAttributes/pressGroupItem.stylex.ts"],"names":[],"mappings":"AACA;;;;;;;;;GASG;AAIH,4DAA4D;AAC5D,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAEhE,CAAC;AAEF,8EAA8E;AAC9E,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAE1D"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
/**
|
|
3
|
-
* @file privateAttributes/pressGroupItem.stylex.ts
|
|
4
|
-
* @input Nothing: the private press-group-item attribute
|
|
5
|
-
* @output pressGroupItemProps, which marks an action a group's tracker
|
|
6
|
-
* follows, and isTrackedByGroup, which reads the mark
|
|
7
|
-
* @position Owner module of the private press-group-item attribute: the only
|
|
8
|
-
* file that writes its name. AlertDialog marks its actions, and the press
|
|
9
|
-
* controller (utils/pressFeedback.ts) leaves their press to the group's
|
|
10
|
-
* tracker. No package entry exports it.
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
const PRESS_GROUP_ITEM = 'data-astryx-press-group-item';
|
|
14
|
-
|
|
15
|
-
/** Spread on each action that a group's tracker follows. */
|
|
16
|
-
export const pressGroupItemProps = {
|
|
17
|
-
[PRESS_GROUP_ITEM]: ''
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
/** Whether a group's tracker paints the press on `element` or an ancestor. */
|
|
21
|
-
export function isTrackedByGroup(element) {
|
|
22
|
-
return element.closest(`[${PRESS_GROUP_ITEM}]`) != null;
|
|
23
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file triggerFocus.ts
|
|
3
|
-
* @input A focus event on a hover-layer trigger and its focusTrigger value
|
|
4
|
-
* @output Whether that focus counts as focus on the trigger, and a gate that
|
|
5
|
-
* remembers it for the matching blur
|
|
6
|
-
* @position Shared focus-trigger judgement for Tooltip and HoverCard
|
|
7
|
-
*/
|
|
8
|
-
/** When focus on a trigger opens its layer. */
|
|
9
|
-
export type TriggerFocusMode = 'auto' | 'always' | 'never';
|
|
10
|
-
/** Whether `element` is in the tab order or naturally focusable. */
|
|
11
|
-
export declare function isFocusableTrigger(element: HTMLElement): boolean;
|
|
12
|
-
/**
|
|
13
|
-
* Whether a focus event on a trigger (its `currentTarget`) counts as focus on
|
|
14
|
-
* the trigger.
|
|
15
|
-
*
|
|
16
|
-
* Under `auto` it is decided when focus arrives, not when listeners attach: a
|
|
17
|
-
* roving-tabindex member that was `tabindex="-1"` then can be the tab stop
|
|
18
|
-
* now. A trigger that receives focus is focusable by definition, which covers
|
|
19
|
-
* focusable elements this check does not list, such as a `<summary>` or an SVG
|
|
20
|
-
* link. Focus inside the trigger counts only while the trigger is focusable
|
|
21
|
-
* too, so a plain wrapper ignores its children's focus.
|
|
22
|
-
*/
|
|
23
|
-
export declare function isFocusForTrigger(event: Event, mode: TriggerFocusMode): boolean;
|
|
24
|
-
/** Remembers whether a trigger's current focus counted when it arrived. */
|
|
25
|
-
export interface TriggerFocusGate {
|
|
26
|
-
/** On focusin: whether this focus opens the layer. */
|
|
27
|
-
focusIn(event: Event, mode: TriggerFocusMode): boolean;
|
|
28
|
-
/**
|
|
29
|
-
* On focusout: whether this blur closes the layer. A focus that counted
|
|
30
|
-
* closes on blur even if the trigger has since left the tab order.
|
|
31
|
-
*/
|
|
32
|
-
focusOut(event: Event, mode: TriggerFocusMode): boolean;
|
|
33
|
-
}
|
|
34
|
-
/** A gate for one trigger; each hook keeps one for its lifetime. */
|
|
35
|
-
export declare function createTriggerFocusGate(): TriggerFocusGate;
|
|
36
|
-
//# sourceMappingURL=triggerFocus.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"triggerFocus.d.ts","sourceRoot":"","sources":["../../src/utils/triggerFocus.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AAEH,+CAA+C;AAC/C,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE3D,oEAAoE;AACpE,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAShE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,gBAAgB,GACrB,OAAO,CAWT;AAED,2EAA2E;AAC3E,MAAM,WAAW,gBAAgB;IAC/B,sDAAsD;IACtD,OAAO,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC;IACvD;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC;CACzD;AAED,oEAAoE;AACpE,wBAAgB,sBAAsB,IAAI,gBAAgB,CAezD"}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @file triggerFocus.ts
|
|
5
|
-
* @input A focus event on a hover-layer trigger and its focusTrigger value
|
|
6
|
-
* @output Whether that focus counts as focus on the trigger, and a gate that
|
|
7
|
-
* remembers it for the matching blur
|
|
8
|
-
* @position Shared focus-trigger judgement for Tooltip and HoverCard
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
/** When focus on a trigger opens its layer. */
|
|
12
|
-
|
|
13
|
-
/** Whether `element` is in the tab order or naturally focusable. */
|
|
14
|
-
export function isFocusableTrigger(element) {
|
|
15
|
-
if (element.hasAttribute('tabindex')) {
|
|
16
|
-
return element.tabIndex >= 0;
|
|
17
|
-
}
|
|
18
|
-
const focusableTags = ['A', 'BUTTON', 'INPUT', 'SELECT', 'TEXTAREA'];
|
|
19
|
-
if (focusableTags.includes(element.tagName)) {
|
|
20
|
-
return !element.disabled;
|
|
21
|
-
}
|
|
22
|
-
return element.isContentEditable;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Whether a focus event on a trigger (its `currentTarget`) counts as focus on
|
|
27
|
-
* the trigger.
|
|
28
|
-
*
|
|
29
|
-
* Under `auto` it is decided when focus arrives, not when listeners attach: a
|
|
30
|
-
* roving-tabindex member that was `tabindex="-1"` then can be the tab stop
|
|
31
|
-
* now. A trigger that receives focus is focusable by definition, which covers
|
|
32
|
-
* focusable elements this check does not list, such as a `<summary>` or an SVG
|
|
33
|
-
* link. Focus inside the trigger counts only while the trigger is focusable
|
|
34
|
-
* too, so a plain wrapper ignores its children's focus.
|
|
35
|
-
*/
|
|
36
|
-
export function isFocusForTrigger(event, mode) {
|
|
37
|
-
if (mode === 'always') {
|
|
38
|
-
return true;
|
|
39
|
-
}
|
|
40
|
-
if (mode === 'never') {
|
|
41
|
-
return false;
|
|
42
|
-
}
|
|
43
|
-
const trigger = event.currentTarget;
|
|
44
|
-
return trigger != null && (event.target === trigger || isFocusableTrigger(trigger));
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/** Remembers whether a trigger's current focus counted when it arrived. */
|
|
48
|
-
|
|
49
|
-
/** A gate for one trigger; each hook keeps one for its lifetime. */
|
|
50
|
-
export function createTriggerFocusGate() {
|
|
51
|
-
let isCounted = false;
|
|
52
|
-
return {
|
|
53
|
-
focusIn(event, mode) {
|
|
54
|
-
isCounted = isFocusForTrigger(event, mode);
|
|
55
|
-
return isCounted;
|
|
56
|
-
},
|
|
57
|
-
focusOut(event, mode) {
|
|
58
|
-
if (!isCounted && !isFocusForTrigger(event, mode)) {
|
|
59
|
-
return false;
|
|
60
|
-
}
|
|
61
|
-
isCounted = false;
|
|
62
|
-
return true;
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
}
|