@astryxdesign/core 0.7.9-canary.db3451e → 0.7.9-canary.ddb8b34

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.
Files changed (53) hide show
  1. package/dist/AlertDialog/AlertDialog.d.ts +3 -2
  2. package/dist/AlertDialog/AlertDialog.d.ts.map +1 -1
  3. package/dist/AlertDialog/AlertDialog.js +11 -14
  4. package/dist/Button/Button.d.ts.map +1 -1
  5. package/dist/Button/Button.js +11 -2
  6. package/dist/ButtonGroup/ButtonGroup.d.ts +2 -1
  7. package/dist/ButtonGroup/ButtonGroup.d.ts.map +1 -1
  8. package/dist/ButtonGroup/ButtonGroup.js +28 -5
  9. package/dist/DropdownMenu/DropdownMenu.d.ts.map +1 -1
  10. package/dist/DropdownMenu/DropdownMenu.js +17 -7
  11. package/dist/TabList/TabList.d.ts.map +1 -1
  12. package/dist/TabList/TabList.js +1 -0
  13. package/dist/astryx.css +4 -0
  14. package/dist/hooks/actionGroupTracker.d.ts +9 -0
  15. package/dist/hooks/actionGroupTracker.d.ts.map +1 -1
  16. package/dist/hooks/actionGroupTracker.js +38 -24
  17. package/dist/hooks/pressGroupContext.d.ts +5 -3
  18. package/dist/hooks/pressGroupContext.d.ts.map +1 -1
  19. package/dist/hooks/pressGroupContext.js +17 -9
  20. package/dist/hooks/useActionGroupTracking.d.ts +29 -4
  21. package/dist/hooks/useActionGroupTracking.d.ts.map +1 -1
  22. package/dist/hooks/useActionGroupTracking.js +92 -14
  23. package/dist/hooks/useGroupPressTracking.d.ts +34 -0
  24. package/dist/hooks/useGroupPressTracking.d.ts.map +1 -0
  25. package/dist/hooks/useGroupPressTracking.js +122 -0
  26. package/dist/privateAttributes/pressGroupItem.stylex.d.ts +8 -5
  27. package/dist/privateAttributes/pressGroupItem.stylex.d.ts.map +1 -1
  28. package/dist/privateAttributes/pressGroupItem.stylex.js +11 -5
  29. package/dist/utils/hitArea.d.ts +28 -2
  30. package/dist/utils/hitArea.d.ts.map +1 -1
  31. package/dist/utils/hitArea.js +49 -11
  32. package/dist/utils/touchHitArea.d.ts +25 -6
  33. package/dist/utils/touchHitArea.d.ts.map +1 -1
  34. package/dist/utils/touchHitArea.js +22 -12
  35. package/dist/utils/touchHitArea.stylex.d.ts +29 -5
  36. package/dist/utils/touchHitArea.stylex.d.ts.map +1 -1
  37. package/dist/utils/touchHitArea.stylex.js +37 -6
  38. package/package.json +4 -4
  39. package/src/AlertDialog/AlertDialog.tsx +9 -13
  40. package/src/Button/Button.tsx +17 -2
  41. package/src/ButtonGroup/ButtonGroup.doc.mjs +3 -2
  42. package/src/ButtonGroup/ButtonGroup.tsx +28 -4
  43. package/src/DropdownMenu/DropdownMenu.tsx +16 -9
  44. package/src/TabList/TabList.tsx +1 -0
  45. package/src/Table/plugins/sortable/useTableSortableState.doc.mjs +173 -0
  46. package/src/hooks/actionGroupTracker.ts +33 -24
  47. package/src/hooks/pressGroupContext.ts +18 -9
  48. package/src/hooks/useActionGroupTracking.ts +139 -19
  49. package/src/hooks/useGroupPressTracking.ts +154 -0
  50. package/src/privateAttributes/pressGroupItem.stylex.ts +11 -5
  51. package/src/utils/hitArea.ts +88 -8
  52. package/src/utils/touchHitArea.stylex.ts +29 -19
  53. package/src/utils/touchHitArea.ts +60 -12
@@ -1,8 +1,9 @@
1
1
  /**
2
2
  * @file AlertDialog.tsx
3
3
  * @input Uses React, StyleX, Dialog, Layout, Heading, Text, Button, the
4
- * action-group tracking (hooks/useActionGroupTracking) and the press-group
5
- * marker (privateAttributes/pressGroupItem.stylex)
4
+ * action-group tracking (hooks/useActionGroupTracking), the press-group
5
+ * context (hooks/pressGroupContext) and the group pointers
6
+ * (hooks/useGroupPressTracking)
6
7
  * @output Exports AlertDialog component, AlertDialogProps type
7
8
  * @position Core implementation; consumed by index.ts, tested by AlertDialog.test.tsx
8
9
  *
@@ -1 +1 @@
1
- {"version":3,"file":"AlertDialog.d.ts","sourceRoot":"","sources":["../../src/AlertDialog/AlertDialog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L,aAAa,EAAE,MAAM,EACrB,GAAG,IAAI,EACR,EAAE,gBAAgB,qBAoHlB;yBAtIe,WAAW"}
@@ -5,8 +5,9 @@
5
5
  /**
6
6
  * @file AlertDialog.tsx
7
7
  * @input Uses React, StyleX, Dialog, Layout, Heading, Text, Button, the
8
- * action-group tracking (hooks/useActionGroupTracking) and the press-group
9
- * marker (privateAttributes/pressGroupItem.stylex)
8
+ * action-group tracking (hooks/useActionGroupTracking), the press-group
9
+ * context (hooks/pressGroupContext) and the group pointers
10
+ * (hooks/useGroupPressTracking)
10
11
  * @output Exports AlertDialog component, AlertDialogProps type
11
12
  * @position Core implementation; consumed by index.ts, tested by AlertDialog.test.tsx
12
13
  *
@@ -36,12 +37,10 @@ import { registerEnglishFallback, useComponentTranslator } from "../i18n/useComp
36
37
  import english from "../i18n/generated-english/AlertDialog/AlertDialog.generated.js";
37
38
  import { useActionGroupTracking } from "../hooks/useActionGroupTracking.js";
38
39
  import { PressGroupContext } from "../hooks/pressGroupContext.js";
40
+ import { GROUP_PRESS_POINTERS } from "../hooks/useGroupPressTracking.js";
39
41
  import { alertController } from "../motion/uikit/alert.js";
40
- import { pressGroupItemProps } from "../privateAttributes/pressGroupItem.stylex.js";
41
42
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
42
43
  registerEnglishFallback(english);
43
- const SLIDING_POINTERS = ['touch', 'pen'];
44
- const ACTION_TRACKING_PROPS = pressGroupItemProps(SLIDING_POINTERS);
45
44
  const SMALL_SCREEN_QUERY = '(max-width: 640px)';
46
45
  const styles = {
47
46
  trackingRow: {
@@ -115,8 +114,8 @@ export function AlertDialog({
115
114
  onOpenChange(false);
116
115
  }, [onOpenChange]);
117
116
 
118
- // Each action carries the press-group marker from its first render, so the
119
- // tracker is its only painter.
117
+ // Through the group's context, each action's Button writes the press-group
118
+ // marker from its first render. So the tracker is its only painter.
120
119
  const actionsRef = useRef(null);
121
120
  // Only under the touch presentation does a press slide across the
122
121
  // actions. A desktop press stays the native button's.
@@ -130,21 +129,20 @@ export function AlertDialog({
130
129
  highlightOnsetMs: alertController.actions.highlightOnsetMs,
131
130
  highlightExpansion: alertController.actions.highlightExpansion,
132
131
  // A mouse press acts as a native button's under any presentation.
133
- pointerTypes: SLIDING_POINTERS,
132
+ pointerTypes: GROUP_PRESS_POINTERS,
134
133
  isEnabled: isTracking
135
134
  });
136
- const actionTrackingProps = isTracking ? ACTION_TRACKING_PROPS : undefined;
137
135
  const buttonActionStyle = [styles.action, isSmallScreen && styles.stackedAction];
138
136
  const cancelButton = /*#__PURE__*/_jsx(Button, {
139
137
  variant: "ghost",
140
138
  label: cancelLabel,
141
139
  onClick: handleCancel,
142
- xstyle: buttonActionStyle,
143
- ...actionTrackingProps,
140
+ xstyle: buttonActionStyle
144
141
  // Dialog focuses [data-autofocus] itself after showModal(), because
145
142
  // React's autoFocus runs during commit while the dialog is invisible.
146
143
  // Cancel is least destructive, so it remains the autofocus target even
147
144
  // when small-screen visual order places the destructive action above it.
145
+ ,
148
146
  "data-autofocus": true
149
147
  }, "cancel");
150
148
  const actionButton = /*#__PURE__*/_jsx(Button, {
@@ -152,8 +150,7 @@ export function AlertDialog({
152
150
  label: actionLabel,
153
151
  onClick: onAction,
154
152
  isLoading: isActionLoading,
155
- xstyle: buttonActionStyle,
156
- ...actionTrackingProps
153
+ xstyle: buttonActionStyle
157
154
  }, "action");
158
155
  return /*#__PURE__*/_jsx(Dialog, {
159
156
  ...rest,
@@ -200,7 +197,7 @@ export function AlertDialog({
200
197
  hAlign: isSmallScreen ? 'stretch' : 'end',
201
198
  wrap: isSmallScreen ? 'nowrap' : 'wrap',
202
199
  children: /*#__PURE__*/_jsx(PressGroupContext, {
203
- value: isTracking,
200
+ value: isTracking ? GROUP_PRESS_POINTERS : null,
204
201
  children: isSmallScreen ? [actionButton, cancelButton] : [cancelButton, actionButton]
205
202
  })
206
203
  })
@@ -1 +1 @@
1
- {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../src/Button/Button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,EACL,GAAG,EACH,GAAG,KAAK,EACT,EAAE,WAAW,GAAG,SAAS,CAoVzB;yBA7We,MAAM"}
@@ -30,7 +30,7 @@ import { iconBoxSizeStyles } from "../Icon/IconSize.stylex.js";
30
30
  import { EDGE_COMP_ATTR } from "../Layout/edgeCompensation.stylex.js";
31
31
  import { useSize } from "../SizeContext/SizeContext.js";
32
32
  import { useButtonGroup } from "../ButtonGroup/ButtonGroupContext.js";
33
- import { PressGroupContext } from "../hooks/pressGroupContext.js";
33
+ import { PressGroupContext, pressGroupItemProps } from "../hooks/pressGroupContext.js";
34
34
  import { useInputGroup } from "../InputGroup/InputGroupContext.js";
35
35
  import { InputGroupInternalContext } from "../InputGroup/InputGroupInternalContext.js";
36
36
  import { groupStyles as inputGroupStyles, inputGroupItemProps } from "../InputGroup/groupStyles.js";
@@ -53,6 +53,9 @@ registerEnglishFallback(english);
53
53
  */
54
54
  const PRESSED_ON = '[data-astryx-press="on"]';
55
55
 
56
+ /** `aria-haspopup` values of a trigger that keeps its own press and opening. */
57
+ const MENU_POPUPS = new Set(['true', 'menu', 'listbox']);
58
+
56
59
  /**
57
60
  * Base button styles
58
61
  * Pseudo-classes are nested within properties per StyleX recommendation:
@@ -396,7 +399,11 @@ export function Button({
396
399
  const t = useComponentTranslator();
397
400
  const size = useSize(sizeProp, 'md');
398
401
  const buttonGroup = useButtonGroup();
399
- const isGroupTracked = use(PressGroupContext);
402
+ // A tracking group's tracker paints this button's pointer press. A menu
403
+ // trigger is not tracked: it keeps its own press and opening.
404
+ const groupPointers = use(PressGroupContext);
405
+ const groupItemProps = groupPointers != null && !MENU_POPUPS.has(String(props['aria-haspopup'])) ? pressGroupItemProps(groupPointers) : undefined;
406
+ const isGroupTracked = groupItemProps != null;
400
407
  const inputGroup = useInputGroup();
401
408
  const [isPending, startTransition] = useTransition();
402
409
  // clickAction is normally fire-once (submit/save/pay), so a same-tick
@@ -611,6 +618,7 @@ export function Button({
611
618
  ...(inputGroup != null && buttonGroup == null ? inputGroupItemProps : undefined),
612
619
  ...sharedMergedProps,
613
620
  ...pressFeedback,
621
+ ...groupItemProps,
614
622
  ...props,
615
623
  ...ariaLabelProp,
616
624
  ...describedByProp,
@@ -633,6 +641,7 @@ export function Button({
633
641
  ...(inputGroup != null && buttonGroup == null ? inputGroupItemProps : undefined),
634
642
  ...sharedMergedProps,
635
643
  ...pressFeedback,
644
+ ...groupItemProps,
636
645
  ...props,
637
646
  ...ariaLabelProp,
638
647
  ...describedByProp,
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * @file ButtonGroup.tsx
3
- * @input Uses React, StyleX, Button/IconButton children
3
+ * @input Uses React, StyleX, Button/IconButton children, and the shared group
4
+ * press tracking (hooks/useGroupPressTracking)
4
5
  * @output Exports ButtonGroup component, context, and types
5
6
  * @position Groups buttons with connected styling; consumed by index.ts
6
7
  *
@@ -1 +1 @@
1
- {"version":3,"file":"ButtonGroup.d.ts","sourceRoot":"","sources":["../../src/ButtonGroup/ButtonGroup.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAU,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAE9C,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,WAAW,CAAC;AAE1C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAI9C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAE5C,OAAO,KAAK,EAAC,sBAAsB,EAAC,MAAM,sBAAsB,CAAC;AAQjE,MAAM,WAAW,gBAAiB,SAAQ,SAAS,CAAC,cAAc,CAAC;IACjE,yCAAyC;IACzC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAEhC;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IAEpB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,WAAW,CAAC,EAAE,sBAAsB,CAAC;IAErC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AIG;IACH,IAAI,CAAC,EAAE,UAAU,CAAC;IAElB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IAEtB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AA6CD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,WAAW,CAAC,EAC1B,QAAQ,EACR,KAAK,EACL,WAA0B,EAC1B,IAAI,EAAE,QAAQ,EACd,UAAkB,EAClB,SAAkB,EAClB,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,aAAa,EAAE,MAAM,EACrB,SAAS,EACT,OAAO,EACP,GAAG,KAAK,EACT,EAAE,gBAAgB,GAAG,SAAS,CA+D9B;yBA9Ee,WAAW"}
@@ -4,7 +4,8 @@
4
4
 
5
5
  /**
6
6
  * @file ButtonGroup.tsx
7
- * @input Uses React, StyleX, Button/IconButton children
7
+ * @input Uses React, StyleX, Button/IconButton children, and the shared group
8
+ * press tracking (hooks/useGroupPressTracking)
8
9
  * @output Exports ButtonGroup component, context, and types
9
10
  * @position Groups buttons with connected styling; consumed by index.ts
10
11
  *
@@ -20,12 +21,16 @@
20
21
  * - /apps/storybook/stories/ButtonGroup.stories.tsx (storybook stories)
21
22
  * - /packages/cli/assets/templates/blocks/components/ButtonGroup/ (showcase blocks)
22
23
  */
23
- import { useMemo } from 'react';
24
+ import { useMemo, useRef } from 'react';
24
25
  import * as stylex from '@stylexjs/stylex';
25
26
  import "../theme/tokens.stylex.js";
26
27
  import { radiusVars, shadowVars } from "../theme/tokens.stylex.js";
27
28
  import { SizeProvider, useSize } from "../SizeContext/SizeContext.js";
28
29
  import { useListFocus } from "../hooks/useListFocus.js";
30
+ import { PressGroupContext } from "../hooks/pressGroupContext.js";
31
+ import { GROUP_PRESS_POINTERS, useGroupPressTracking } from "../hooks/useGroupPressTracking.js";
32
+ import { useTouchPresentation } from "../utils/touchPresentation.js";
33
+ import { touchHitAreaStyles } from "../utils/touchHitArea.stylex.js";
29
34
  import { mergeProps, composeEventHandlers } from "../utils/index.js";
30
35
  import { ButtonGroupContext } from "./ButtonGroupContext.js";
31
36
  import { themeProps } from "../utils/themeProps.js";
@@ -47,6 +52,10 @@ const styles = {
47
52
  vertical: {
48
53
  kXwgrk: "xdt5ytf",
49
54
  $$css: true
55
+ },
56
+ tracking: {
57
+ kVAEAm: "x1n2onr6",
58
+ $$css: true
50
59
  }
51
60
  };
52
61
 
@@ -154,25 +163,39 @@ export function ButtonGroup({
154
163
  orientation,
155
164
  isDisabled
156
165
  }), [orientation, isDisabled]);
166
+
167
+ // Only under the touch presentation does a press slide across the buttons.
168
+ // A desktop press stays the native button's.
169
+ const {
170
+ isTouch
171
+ } = useTouchPresentation();
172
+ const tracksPress = !isDisabled && isTouch;
173
+ const groupRef = useRef(null);
174
+ const {
175
+ hitAreaRef
176
+ } = useGroupPressTracking(groupRef, tracksPress);
157
177
  return /*#__PURE__*/_jsx(ButtonGroupContext, {
158
178
  value: contextValue,
159
179
  children: /*#__PURE__*/_jsx(SizeProvider, {
160
180
  value: size,
161
181
  children: /*#__PURE__*/_jsx("div", {
162
- ref: useMergedRefs(ref, listRef),
182
+ ref: useMergedRefs(ref, listRef, groupRef, hitAreaRef),
163
183
  ...props,
164
184
  ...mergeProps(themeProps('button-group', {
165
185
  size,
166
186
  orientation,
167
187
  elevation
168
- }), stylex.props(styles.group, orientation === 'vertical' && styles.vertical, elevationStyles[elevation], xstyle), className, style),
188
+ }), stylex.props(styles.group, tracksPress && styles.tracking, tracksPress && touchHitAreaStyles.layerBelowChildren, orientation === 'vertical' && styles.vertical, elevationStyles[elevation], xstyle), className, style),
169
189
  role: "group",
170
190
  "aria-label": label,
171
191
  onKeyDown: composeEventHandlers(onKeyDown, handleKeyDown),
172
192
  onFocus: composeEventHandlers(onFocus, handleFocus),
173
193
  "aria-disabled": isDisabled || undefined,
174
194
  "data-testid": testId,
175
- children: children
195
+ children: /*#__PURE__*/_jsx(PressGroupContext, {
196
+ value: tracksPress ? GROUP_PRESS_POINTERS : null,
197
+ children: children
198
+ })
176
199
  })
177
200
  })
178
201
  });
@@ -1 +1 @@
1
- {"version":3,"file":"DropdownMenu.d.ts","sourceRoot":"","sources":["../../src/DropdownMenu/DropdownMenu.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,KAAK,EAAE,EAOZ,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAKf,OAAO,EAAS,KAAK,WAAW,EAAC,MAAM,WAAW,CAAC;AAKnD,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,oBAAoB,CAAC;AA+B9D,OAAO,EAEL,KAAK,oBAAoB,EAC1B,MAAM,kCAAkC,CAAC;AAS1C,OAAO,KAAK,EAAC,cAAc,EAAE,cAAc,EAAC,MAAM,mBAAmB,CAAC;AAStE,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AA2L5C;;;;;;;GAOG;AACH,MAAM,WAAW,oBAAqB,SAAQ,IAAI,CAChD,qBAAqB,EACnB,MAAM,GACN,SAAS,GACT,YAAY,GACZ,SAAS,GACT,aAAa,GACb,YAAY,GACZ,kBAAkB,GAClB,MAAM,GACN,QAAQ,GACR,KAAK,CACR;IACC;;;;;;OAMG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,6BAA6B;IAC7B,KAAK,EAAE,SAAS,CAAC;IACjB;;;;OAIG;IACH,KAAK,CAAC,EAAE,kBAAkB,EAAE,CAAC;CAC9B;AAED;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,SAAS,CAAC;CACjB;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,SAAS,CAAC;IAChB,0EAA0E;IAC1E,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IAC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;IACrB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,cAAc,CAAC;IAE3B;;;;;OAKG;IACH,SAAS,CAAC,EAAE,cAAc,CAAC;IAC3B;;;;OAIG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB;;;OAGG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;IAEnB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,UAAU,qBAAsB,SAAQ,qBAAqB;IAC3D;;;;;;;;OAQG;IACH,YAAY,CAAC,EAAE,wBAAwB,CAAC;IACxC,KAAK,EAAE,kBAAkB,EAAE,CAAC;IAC5B,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,UAAU,yBAA0B,SAAQ,qBAAqB;IAC/D;;;;OAIG;IACH,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,MAAM,MAAM,iBAAiB,GAC3B,qBAAqB,GAAG,yBAAyB,CAAC;AA4xCpD,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,qBAwDpD;yBAxDe,YAAY"}
@@ -53,6 +53,7 @@ import { useDropdownMenuPress } from "../hooks/useMenuPress.js";
53
53
  import { useTypeahead } from "../hooks/useTypeahead.js";
54
54
  import { useFocusReturnVisibility } from "../hooks/useFocusReturnVisibility.js";
55
55
  import { returnFocusForLastInput } from "../utils/focusReturn.js";
56
+ import { PressGroupContext } from "../hooks/pressGroupContext.js";
56
57
  import { useMenuOverflow } from "./useMenuOverflow.js";
57
58
  import { MenuRegionsContext } from "./menuRegionsContext.js";
58
59
  import { moveRegionsTab } from "./menuRegionStops.js";
@@ -1324,15 +1325,24 @@ export function DropdownMenu(props) {
1324
1325
  onOpenChange: handleOpenChange
1325
1326
  };
1326
1327
  if (resolvedPresentation === 'bottom-sheet' && 'items' in props && props.items !== undefined) {
1327
- return /*#__PURE__*/_jsx(DropdownMenuBottomSheet, {
1328
- ...sharedProps,
1329
- presentation: "bottom-sheet"
1328
+ return /*#__PURE__*/_jsx(PressGroupContext, {
1329
+ value: null,
1330
+ children: /*#__PURE__*/_jsx(DropdownMenuBottomSheet, {
1331
+ ...sharedProps,
1332
+ presentation: "bottom-sheet"
1333
+ })
1330
1334
  });
1331
1335
  }
1332
- return /*#__PURE__*/_jsx(DropdownMenuPopover, {
1333
- ...sharedProps,
1334
- presentation: "popover",
1335
- pressTouchModel: props.presentation === 'popover' ? 'pointer' : 'uikit'
1336
+
1337
+ // In a group that tracks presses, the trigger keeps its own press and
1338
+ // opening, whatever its `aria-haspopup`.
1339
+ return /*#__PURE__*/_jsx(PressGroupContext, {
1340
+ value: null,
1341
+ children: /*#__PURE__*/_jsx(DropdownMenuPopover, {
1342
+ ...sharedProps,
1343
+ presentation: "popover",
1344
+ pressTouchModel: props.presentation === 'popover' ? 'pointer' : 'uikit'
1345
+ })
1336
1346
  });
1337
1347
  }
1338
1348
  DropdownMenu.displayName = 'DropdownMenu';
@@ -1 +1 @@
1
- {"version":3,"file":"TabList.d.ts","sourceRoot":"","sources":["../../src/TabList/TabList.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,EAKZ,KAAK,QAAQ,EACb,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAaf,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAE5C,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,kBAAkB,CAAC;AAQlD,OAAO,EAAC,cAAc,EAAC,MAAM,mCAAmC,CAAC;AA4BjE;;;;;;;;GAQG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,CAAC;AAE5D,MAAM,WAAW,YAAa,SAAQ,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,EAAE,UAAU,CAAC;IAC5E,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,WAAW,C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AAkB,EAAE,gBAAgB,EACpC,CAAC,cAAc,CAAC,EAAE,aAAa,EAC/B,GAAG,SAAS,EACb,EAAE,YAAY,qBAgWd;yBAtXe,OAAO"}
@@ -313,6 +313,7 @@ export function TabList({
313
313
  handleFocus
314
314
  } = useListFocus({
315
315
  itemSelector: TAB_STOP_SELECTOR,
316
+ boundarySelector: '.astryx-tab-list, [popover]',
316
317
  orientation: isTabList ? 'horizontal' : 'both',
317
318
  hasRovingTabIndex: true
318
319
  });
package/dist/astryx.css CHANGED
@@ -2339,6 +2339,7 @@
2339
2339
  @media (forced-colors: active){.x1pjcgc3.x1pjcgc3[data-astryx-press="fading"]:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#){background-color:Highlight}}
2340
2340
  @media (forced-colors: active){.x1r4mieh.x1r4mieh[data-astryx-press="on"]:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#){background-color:Highlight}}
2341
2341
  @media (pointer: coarse){.x1ukc1h5.x1ukc1h5:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::after{inset:calc((var(--astryx-hit-inset-top,0px) + var(--_hit-border-top,0px)) * -1) calc((var(--astryx-hit-inset-right,0px) + var(--_hit-border-right,0px)) * -1) calc((var(--astryx-hit-inset-bottom,0px) + var(--_hit-border-bottom,0px)) * -1) calc((var(--astryx-hit-inset-left,0px) + var(--_hit-border-left,0px)) * -1)}}
2342
+ @media (pointer: coarse){.xg52tuh.xg52tuh:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::before{inset:calc((var(--astryx-hit-inset-top,0px) + var(--_hit-border-top,0px)) * -1) calc((var(--astryx-hit-inset-right,0px) + var(--_hit-border-right,0px)) * -1) calc((var(--astryx-hit-inset-bottom,0px) + var(--_hit-border-bottom,0px)) * -1) calc((var(--astryx-hit-inset-left,0px) + var(--_hit-border-left,0px)) * -1)}}
2342
2343
  @starting-style{@media (prefers-reduced-motion: reduce) and (pointer: coarse){.xgo67oj.xgo67oj.xgo67oj:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#){opacity:0}}}
2343
2344
  @starting-style{@media (prefers-reduced-motion: reduce){.xspp5ug.xspp5ug.xspp5ug:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#){transform:translateY(0)}}}
2344
2345
  @media (pointer: coarse){.x10ogxw0.x10ogxw0.x10ogxw0:where(:not(:disabled,[aria-disabled="true"]))[data-astryx-press="on"]:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#){background-image:none}}
@@ -2512,9 +2513,12 @@
2512
2513
  .x12ayhd5:is([dir="rtl"] *):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::after{transform:translateX(100%)}
2513
2514
  @media (forced-colors: none){.x1my3e5g.x1my3e5g:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::before{background-color:var(--color-overlay-pressed)}}
2514
2515
  @media (pointer: coarse){.x1c440c0.x1c440c0:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::after{clip-path:polygon(evenodd,0 0,100% 0,100% 100%,0 100%,0 0,var(--astryx-hit-inset-left,0px) var(--astryx-hit-inset-top,0px),calc(100% - var(--astryx-hit-inset-right,0px)) var(--astryx-hit-inset-top,0px),calc(100% - var(--astryx-hit-inset-right,0px)) calc(100% - var(--astryx-hit-inset-bottom,0px)),var(--astryx-hit-inset-left,0px) calc(100% - var(--astryx-hit-inset-bottom,0px)),var(--astryx-hit-inset-left,0px) var(--astryx-hit-inset-top,0px))}}
2516
+ @media (pointer: coarse){.x1la2cvp.x1la2cvp:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::before{clip-path:polygon(evenodd,0 0,100% 0,100% 100%,0 100%,0 0,var(--astryx-hit-inset-left,0px) var(--astryx-hit-inset-top,0px),calc(100% - var(--astryx-hit-inset-right,0px)) var(--astryx-hit-inset-top,0px),calc(100% - var(--astryx-hit-inset-right,0px)) calc(100% - var(--astryx-hit-inset-bottom,0px)),var(--astryx-hit-inset-left,0px) calc(100% - var(--astryx-hit-inset-bottom,0px)),var(--astryx-hit-inset-left,0px) var(--astryx-hit-inset-top,0px))}}
2515
2517
  @media (pointer: coarse){.x1fjtqre.x1fjtqre:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::after{content:""}}
2518
+ @media (pointer: coarse){.xrfab51.xrfab51:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::before{content:""}}
2516
2519
  @media (pointer: coarse){.x1ep27e9.x1ep27e9:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::after{display:block}}
2517
2520
  @media (pointer: coarse){.x7b72wb.x7b72wb:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::after{position:absolute}}
2521
+ @media (pointer: coarse){.xjupvsi.xjupvsi:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::before{position:absolute}}
2518
2522
  @media (prefers-reduced-motion: reduce){.xhhm9v0.xhhm9v0:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::before{transition-delay:0s}}
2519
2523
  @media (prefers-reduced-motion: reduce){.x1viac0w.x1viac0w:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::backdrop{transition-duration:.01s}}
2520
2524
  @media (prefers-reduced-motion: reduce){.x13sdc92.x13sdc92:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::before{transition-duration:0s}}
@@ -1,3 +1,5 @@
1
+ /** An action that is not enabled takes no highlight and does not run. */
2
+ export declare const DISABLED_SELECTOR = ":disabled, [aria-disabled=\"true\"]";
1
3
  /** A target the tracker measured: its element and viewport rect, px. */
2
4
  export interface ActionGroupTarget {
3
5
  readonly element: HTMLElement;
@@ -6,11 +8,18 @@ export interface ActionGroupTarget {
6
8
  readonly right: number;
7
9
  readonly bottom: number;
8
10
  }
11
+ /**
12
+ * The actions under `roots` that `itemSelector` selects, that are enabled and
13
+ * that `isItem` keeps, in document order. Each box is read once.
14
+ */
15
+ export declare function measureActions(roots: Iterable<Element | null | undefined>, itemSelector: string, isItem?: (element: HTMLElement) => boolean): ActionGroupTarget[];
9
16
  export interface ActionGroupTrackerOptions {
10
17
  /** The elements whose actions are tracked, read when a press begins. */
11
18
  roots: () => Iterable<Element | null | undefined>;
12
19
  /** Selects the actions inside the roots. */
13
20
  itemSelector: string;
21
+ /** Keeps only the actions this accepts among those `itemSelector` selects. */
22
+ isItem?: (element: HTMLElement) => boolean;
14
23
  /** How far outside an action the finger keeps it highlighted, px. */
15
24
  highlightExpansion: number;
16
25
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"actionGroupTracker.d.ts","sourceRoot":"","sources":["../../src/hooks/actionGroupTracker.ts"],"names":[],"mappings":"AAqBA,wEAAwE;AACxE,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,yBAAyB;IACxC,wEAAwE;IACxE,KAAK,EAAE,MAAM,QAAQ,CAAC,OAAO,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC;IAClD,4CAA4C;IAC5C,YAAY,EAAE,MAAM,CAAC;IACrB,qEAAqE;IACrE,kBAAkB,EAAE,MAAM,CAAC;IAC3B;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;OAGG;IACH,iBAAiB,CAAC,EAAE,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AAC;IAClB,kCAAkC;IAClC,QAAQ,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI,CAAC;IACzC,qEAAqE;IACrE,QAAQ,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,CAAC;IACrC,0EAA0E;IAC1E,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B;;;OAGG;IACH,OAAO,IAAI,IAAI,CAAC;CACjB;AAUD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,wBAAwB,CACtC,UAAU,EAAE,MAAM,yBAAyB,GAC1C,kBAAkB,CAwNpB"}
@@ -5,7 +5,8 @@
5
5
  * @input The tracked elements, the action selector and hit expansion, and the
6
6
  * press paint and the press controller's fade clock
7
7
  * @output createActionGroupTracker, ActionGroupTracker,
8
- * ActionGroupTrackerOptions, ActionGroupTarget
8
+ * ActionGroupTrackerOptions, ActionGroupTarget, measureActions (the actions
9
+ * the tracker tracks, measured) and DISABLED_SELECTOR (the actions it skips)
9
10
  * @position Internal core tracker for a held finger that slides across a
10
11
  * group of actions. Gesture recognizers drive it.
11
12
  *
@@ -17,10 +18,41 @@ import { armClickGuard } from "../utils/clickGuard.js";
17
18
  import { PRESSED_ATTRIBUTE, pressFadeMs } from "../utils/pressFeedback.js";
18
19
 
19
20
  /** An action that is not enabled takes no highlight and does not run. */
20
- const DISABLED = ':disabled, [aria-disabled="true"]';
21
+ export const DISABLED_SELECTOR = ':disabled, [aria-disabled="true"]';
21
22
 
22
23
  /** A target the tracker measured: its element and viewport rect, px. */
23
24
 
25
+ /**
26
+ * The actions under `roots` that `itemSelector` selects, that are enabled and
27
+ * that `isItem` keeps, in document order. Each box is read once.
28
+ */
29
+ export function measureActions(roots, itemSelector, isItem) {
30
+ const targets = [];
31
+ for (const root of roots) {
32
+ if (root == null) {
33
+ continue;
34
+ }
35
+ for (const element of root.querySelectorAll(itemSelector)) {
36
+ if (element.matches(DISABLED_SELECTOR) || isItem?.(element) === false) {
37
+ continue;
38
+ }
39
+ const {
40
+ left,
41
+ top,
42
+ right,
43
+ bottom
44
+ } = element.getBoundingClientRect();
45
+ targets.push({
46
+ element,
47
+ left,
48
+ top,
49
+ right,
50
+ bottom
51
+ });
52
+ }
53
+ }
54
+ return targets;
55
+ }
24
56
  /**
25
57
  * Create a tracker. `getOptions` is read on every call, so a hook can pass
26
58
  * the latest props without recreating it.
@@ -102,28 +134,10 @@ export function createActionGroupTracker(getOptions) {
102
134
  const measure = () => {
103
135
  const {
104
136
  roots,
105
- itemSelector
137
+ itemSelector,
138
+ isItem
106
139
  } = getOptions();
107
- const next = [];
108
- for (const root of roots()) {
109
- if (root == null) {
110
- continue;
111
- }
112
- for (const element of root.querySelectorAll(itemSelector)) {
113
- if (element.matches(DISABLED)) {
114
- continue;
115
- }
116
- const rect = element.getBoundingClientRect();
117
- next.push({
118
- element,
119
- left: rect.left,
120
- top: rect.top,
121
- right: rect.right,
122
- bottom: rect.bottom
123
- });
124
- }
125
- }
126
- return next;
140
+ return measureActions(roots(), itemSelector, isItem);
127
141
  };
128
142
  const actionAt = (x, y) => {
129
143
  const {
@@ -202,7 +216,7 @@ export function createActionGroupTracker(getOptions) {
202
216
  return null;
203
217
  }
204
218
  release(lifted);
205
- if (lifted.matches(DISABLED)) {
219
+ if (lifted.matches(DISABLED_SELECTOR)) {
206
220
  return null;
207
221
  }
208
222
  const {
@@ -1,6 +1,8 @@
1
+ export { pressGroupItemProps } from '../privateAttributes/pressGroupItem.stylex.js';
1
2
  /**
2
- * True inside a group whose tracker paints a pointer's press on its actions.
3
- * Those actions take no `:active` paint, so one press never lights two.
3
+ * The pointer types a group's tracker follows on its actions, such as
4
+ * `['touch', 'pen']`, or null outside a tracking group. Those actions take no
5
+ * `:active` paint, so one press never lights two.
4
6
  */
5
- export declare const PressGroupContext: import("react").Context<boolean>;
7
+ export declare const PressGroupContext: import("react").Context<readonly string[] | null>;
6
8
  //# sourceMappingURL=pressGroupContext.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pressGroupContext.d.ts","sourceRoot":"","sources":["../../src/hooks/pressGroupContext.ts"],"names":[],"mappings":"AAeA;;;GAGG;AACH,eAAO,MAAM,iBAAiB,kCAAuB,CAAC"}
1
+ {"version":3,"file":"pressGroupContext.d.ts","sourceRoot":"","sources":["../../src/hooks/pressGroupContext.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAC,mBAAmB,EAAC,MAAM,4CAA4C,CAAC;AAE/E;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,mDACgC,CAAC"}
@@ -4,17 +4,25 @@
4
4
 
5
5
  /**
6
6
  * @file pressGroupContext.ts
7
- * @input Nothing
8
- * @output PressGroupContext: true inside a group whose own tracker paints
9
- * its actions' press
10
- * @position Internal; not exported from the hooks entry. AlertDialog
11
- * provides it around its tracked actions, and Button reads it.
7
+ * @input The layer-scoped context factory (Layer/layerScopedContext) and
8
+ * the press-group marker (privateAttributes/pressGroupItem.stylex)
9
+ * @output PressGroupContext: the pointer types a group's own tracker follows
10
+ * on its actions, or null outside one; pressGroupItemProps, the marker
11
+ * Button writes
12
+ * @position Internal; not exported from the hooks entry. Groups that track
13
+ * presses provide it, and Button reads it. A layer resets it, so a Button
14
+ * in a member's layer is not tracked.
12
15
  */
13
- import { createContext } from 'react';
16
+ import { createLayerScopedContext } from "../Layer/layerScopedContext.js";
17
+
18
+ // Button reads the marker here, not from its private StyleX module: a
19
+ // swizzled Button imports each StyleX module by its public path.
20
+ export { pressGroupItemProps } from "../privateAttributes/pressGroupItem.stylex.js";
14
21
 
15
22
  /**
16
- * True inside a group whose tracker paints a pointer's press on its actions.
17
- * Those actions take no `:active` paint, so one press never lights two.
23
+ * The pointer types a group's tracker follows on its actions, such as
24
+ * `['touch', 'pen']`, or null outside a tracking group. Those actions take no
25
+ * `:active` paint, so one press never lights two.
18
26
  */
19
- export const PressGroupContext = /*#__PURE__*/createContext(false);
27
+ export const PressGroupContext = createLayerScopedContext(null);
20
28
  PressGroupContext.displayName = 'PressGroupContext';
@@ -2,19 +2,25 @@
2
2
  * @file useActionGroupTracking.ts
3
3
  * @input A ref to a group of sibling actions, the actions' selector, and the
4
4
  * component's tracking constants
5
- * @output Exports useActionGroupTracking and ActionGroupTrackingOptions
5
+ * @output Exports useActionGroupTracking, ActionGroupTrackingOptions,
6
+ * resolveNearestAction, the finger resolution of a group whose targets grow,
7
+ * and measureNeighbours, the members that resolution must not reach into
6
8
  * @position Internal hook, not exported from the hooks entry. A long press
7
9
  * drives the shared action-group tracker (hooks/actionGroupTracker.ts) for
8
- * a group that a held pointer slides across. AlertDialog consumes it.
10
+ * a group that a held pointer slides across. AlertDialog and
11
+ * useGroupPressTracking consume it.
9
12
  *
10
13
  * SYNC: When modified, update useActionGroupTracking.test.tsx
11
14
  */
12
15
  import { type RefObject } from 'react';
13
16
  import { LongPressGestureRecognizer } from '../gestures/LongPressGestureRecognizer.js';
14
17
  import type { GestureTouch, PointerKind } from '../gestures/types.js';
18
+ import { type ActionGroupTarget } from './actionGroupTracker.js';
15
19
  export interface ActionGroupTrackingOptions {
16
20
  /** Selects the actions inside the tracked element. */
17
21
  itemSelector: string;
22
+ /** Keeps only the actions this accepts among those `itemSelector` selects. */
23
+ isItem?: (element: HTMLElement) => boolean;
18
24
  /** How long after touch-down the touched action highlights, ms. */
19
25
  highlightOnsetMs: number;
20
26
  /**
@@ -22,10 +28,17 @@ export interface ActionGroupTrackingOptions {
22
28
  * pen hit-tests the actions' exact rects.
23
29
  */
24
30
  highlightExpansion: number;
31
+ /**
32
+ * Picks the action under a finger, in place of the flat expansion. It gets
33
+ * the actions measured when the press begins, and their neighbours: the
34
+ * disabled actions and the members the group does not track. A mouse or a
35
+ * pen hit-tests the exact rects.
36
+ */
37
+ resolveTarget?: (x: number, y: number, targets: ReadonlyArray<ActionGroupTarget>, neighbours: ReadonlyArray<ActionGroupTarget>) => HTMLElement | null;
25
38
  /** Pointers that are tracked; others keep the browser's click. @default every pointer */
26
39
  pointerTypes?: ReadonlyArray<PointerKind>;
27
- /** A press whose target this rejects is not tracked. */
28
- shouldTrack?: (target: unknown) => boolean;
40
+ /** A press this rejects is not tracked, and its click stays the browser's. */
41
+ shouldTrack?: (touch: GestureTouch) => boolean;
29
42
  /** Off, nothing is attached and nothing is tracked. @default true */
30
43
  isEnabled?: boolean;
31
44
  /**
@@ -37,6 +50,18 @@ export interface ActionGroupTrackingOptions {
37
50
  /** Runs the action under the finger at the lift. @default its own click */
38
51
  onActivate?: (item: HTMLElement) => void;
39
52
  }
53
+ /**
54
+ * The action under a finger: the nearest enabled action whose target, grown
55
+ * toward 44 px, holds the point. A neighbour counts for nearness but
56
+ * resolves to none. So nothing highlights over a disabled action, and no
57
+ * grown target reaches into another member.
58
+ */
59
+ export declare function resolveNearestAction(x: number, y: number, targets: ReadonlyArray<ActionGroupTarget>, neighbours: ReadonlyArray<ActionGroupTarget>): HTMLElement | null;
60
+ /**
61
+ * The members inside `root` that a finger must not reach through, with their
62
+ * boxes: the disabled actions and every member the group does not track.
63
+ */
64
+ export declare function measureNeighbours(root: HTMLElement | null, { itemSelector, isItem, }: Pick<ActionGroupTrackingOptions, 'itemSelector' | 'isItem'>): ReadonlyArray<ActionGroupTarget>;
40
65
  /**
41
66
  * The group's press: a long press that a second finger on the group ends with
42
67
  * nothing acting. A plain long press ignores a second finger.
@@ -1 +1 @@
1
- {"version":3,"file":"useActionGroupTracking.d.ts","sourceRoot":"","sources":["../../src/hooks/useActionGroupTracking.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;GAUG;AAEH,OAAO,EAA8B,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAElE,OAAO,EAAC,0BAA0B,EAAC,MAAM,wCAAwC,CAAC;AAElF,OAAO,KAAK,EAAC,YAAY,EAAE,WAAW,EAAC,MAAM,mBAAmB,CAAC;AAOjE,MAAM,WAAW,0BAA0B;IACzC,sDAAsD;IACtD,YAAY,EAAE,MAAM,CAAC;IACrB,mEAAmE;IACnE,gBAAgB,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACH,k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