@sheetxl/grid-react 0.7.22 → 0.7.23-beta.2

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 (172) hide show
  1. package/README.md +502 -2
  2. package/browser/cjs/index.cjs +3 -12
  3. package/browser/esm/index.mjs +5797 -1867
  4. package/licenses/dependencies.txt +143 -41
  5. package/node/esm/index.mjs +4951 -1861
  6. package/package.json +7 -6
  7. package/types/index.d.ts +2 -1497
  8. package/types/src/cell/CellLayer.d.ts +70 -0
  9. package/types/src/cell/CellLayer.d.ts.map +1 -0
  10. package/types/src/cell/CellRenderer.d.ts +42 -0
  11. package/types/src/cell/CellRenderer.d.ts.map +1 -0
  12. package/types/src/cell/DefaultCellRenderer.d.ts +6 -0
  13. package/types/src/cell/DefaultCellRenderer.d.ts.map +1 -0
  14. package/types/src/cell/GridlineLayer.d.ts +38 -0
  15. package/types/src/cell/GridlineLayer.d.ts.map +1 -0
  16. package/types/src/cell/Types.d.ts +12 -0
  17. package/types/src/cell/Types.d.ts.map +1 -0
  18. package/types/src/cell/_CellModel.d.ts +82 -0
  19. package/types/src/cell/_CellModel.d.ts.map +1 -0
  20. package/types/src/cell/index.d.ts +6 -0
  21. package/types/src/cell/index.d.ts.map +1 -0
  22. package/types/src/editor/DefaultEditable.d.ts +121 -0
  23. package/types/src/editor/DefaultEditable.d.ts.map +1 -0
  24. package/types/src/editor/EditSession.d.ts +182 -0
  25. package/types/src/editor/EditSession.d.ts.map +1 -0
  26. package/types/src/editor/EditState.d.ts +61 -0
  27. package/types/src/editor/EditState.d.ts.map +1 -0
  28. package/types/src/editor/EditorDiv.d.ts +65 -0
  29. package/types/src/editor/EditorDiv.d.ts.map +1 -0
  30. package/types/src/editor/EditorInput.d.ts +88 -0
  31. package/types/src/editor/EditorInput.d.ts.map +1 -0
  32. package/types/src/editor/EditorLayer.d.ts +69 -0
  33. package/types/src/editor/EditorLayer.d.ts.map +1 -0
  34. package/types/src/editor/EditorPlacement.d.ts +38 -0
  35. package/types/src/editor/EditorPlacement.d.ts.map +1 -0
  36. package/types/src/editor/index.d.ts +10 -0
  37. package/types/src/editor/index.d.ts.map +1 -0
  38. package/types/src/editor/useEditorKeymap.d.ts +74 -0
  39. package/types/src/editor/useEditorKeymap.d.ts.map +1 -0
  40. package/types/src/grid/Grid.d.ts +16 -0
  41. package/types/src/grid/Grid.d.ts.map +1 -0
  42. package/types/src/grid/IGrid.d.ts +93 -0
  43. package/types/src/grid/IGrid.d.ts.map +1 -0
  44. package/types/src/grid/index.d.ts +3 -0
  45. package/types/src/grid/index.d.ts.map +1 -0
  46. package/types/src/header/HeaderDividerAnchor.d.ts +120 -0
  47. package/types/src/header/HeaderDividerAnchor.d.ts.map +1 -0
  48. package/types/src/header/index.d.ts +3 -0
  49. package/types/src/header/index.d.ts.map +1 -0
  50. package/types/src/header/useHeaderSelectionPointer.d.ts +122 -0
  51. package/types/src/header/useHeaderSelectionPointer.d.ts.map +1 -0
  52. package/types/src/index.d.ts +13 -0
  53. package/types/src/index.d.ts.map +1 -0
  54. package/types/src/layer/HoverTipLayer.d.ts +74 -0
  55. package/types/src/layer/HoverTipLayer.d.ts.map +1 -0
  56. package/types/src/layer/Layer.d.ts +92 -0
  57. package/types/src/layer/Layer.d.ts.map +1 -0
  58. package/types/src/layer/LayerTypes.d.ts +47 -0
  59. package/types/src/layer/LayerTypes.d.ts.map +1 -0
  60. package/types/src/layer/RangePrompt.d.ts +42 -0
  61. package/types/src/layer/RangePrompt.d.ts.map +1 -0
  62. package/types/src/layer/Stage.d.ts +147 -0
  63. package/types/src/layer/Stage.d.ts.map +1 -0
  64. package/types/src/layer/StickyAnchor.d.ts +83 -0
  65. package/types/src/layer/StickyAnchor.d.ts.map +1 -0
  66. package/types/src/layer/StickyFloat.d.ts +65 -0
  67. package/types/src/layer/StickyFloat.d.ts.map +1 -0
  68. package/types/src/layer/VirtualDiv.d.ts +59 -0
  69. package/types/src/layer/VirtualDiv.d.ts.map +1 -0
  70. package/types/src/layer/_Utils.d.ts +37 -0
  71. package/types/src/layer/_Utils.d.ts.map +1 -0
  72. package/types/src/layer/index.d.ts +11 -0
  73. package/types/src/layer/index.d.ts.map +1 -0
  74. package/types/src/layer/useGridAnchor.d.ts +157 -0
  75. package/types/src/layer/useGridAnchor.d.ts.map +1 -0
  76. package/types/src/layer/useHoverIntent.d.ts +49 -0
  77. package/types/src/layer/useHoverIntent.d.ts.map +1 -0
  78. package/types/src/layer/useLayerResponder.d.ts +29 -0
  79. package/types/src/layer/useLayerResponder.d.ts.map +1 -0
  80. package/types/src/layer/usePlacement.d.ts +18 -0
  81. package/types/src/layer/usePlacement.d.ts.map +1 -0
  82. package/types/src/layer/useRangeHover.d.ts +35 -0
  83. package/types/src/layer/useRangeHover.d.ts.map +1 -0
  84. package/types/src/list/CheckboxList.d.ts +63 -0
  85. package/types/src/list/CheckboxList.d.ts.map +1 -0
  86. package/types/src/list/List.d.ts +55 -0
  87. package/types/src/list/List.d.ts.map +1 -0
  88. package/types/src/list/index.d.ts +3 -0
  89. package/types/src/list/index.d.ts.map +1 -0
  90. package/types/src/metrics/Types.d.ts +23 -0
  91. package/types/src/metrics/Types.d.ts.map +1 -0
  92. package/types/src/metrics/index.d.ts +3 -0
  93. package/types/src/metrics/index.d.ts.map +1 -0
  94. package/types/src/metrics/useGridMetrics.d.ts +67 -0
  95. package/types/src/metrics/useGridMetrics.d.ts.map +1 -0
  96. package/types/src/range/DragHandle.d.ts +129 -0
  97. package/types/src/range/DragHandle.d.ts.map +1 -0
  98. package/types/src/range/Draggable.d.ts +86 -0
  99. package/types/src/range/Draggable.d.ts.map +1 -0
  100. package/types/src/range/FillHandle.d.ts +54 -0
  101. package/types/src/range/FillHandle.d.ts.map +1 -0
  102. package/types/src/range/RangeRect.d.ts +36 -0
  103. package/types/src/range/RangeRect.d.ts.map +1 -0
  104. package/types/src/range/RangeResizer.d.ts +68 -0
  105. package/types/src/range/RangeResizer.d.ts.map +1 -0
  106. package/types/src/range/RangeStyle.d.ts +8 -0
  107. package/types/src/range/RangeStyle.d.ts.map +1 -0
  108. package/types/src/range/index.d.ts +13 -0
  109. package/types/src/range/index.d.ts.map +1 -0
  110. package/types/src/selection/DefaultSelection.d.ts +59 -0
  111. package/types/src/selection/DefaultSelection.d.ts.map +1 -0
  112. package/types/src/selection/ICellAnchor.d.ts +21 -0
  113. package/types/src/selection/ICellAnchor.d.ts.map +1 -0
  114. package/types/src/selection/ISelection.d.ts +65 -0
  115. package/types/src/selection/ISelection.d.ts.map +1 -0
  116. package/types/src/selection/RangesPickerLayer.d.ts +128 -0
  117. package/types/src/selection/RangesPickerLayer.d.ts.map +1 -0
  118. package/types/src/selection/SelectionLayer.d.ts +179 -0
  119. package/types/src/selection/SelectionLayer.d.ts.map +1 -0
  120. package/types/src/selection/SelectionStyle.d.ts +28 -0
  121. package/types/src/selection/SelectionStyle.d.ts.map +1 -0
  122. package/types/src/selection/SelectionTouchGrips.d.ts +29 -0
  123. package/types/src/selection/SelectionTouchGrips.d.ts.map +1 -0
  124. package/types/src/selection/SelectionUtils.d.ts +2 -0
  125. package/types/src/selection/SelectionUtils.d.ts.map +1 -0
  126. package/types/src/selection/Types.d.ts +67 -0
  127. package/types/src/selection/Types.d.ts.map +1 -0
  128. package/types/src/selection/_SelectionNavigation.d.ts +6 -0
  129. package/types/src/selection/_SelectionNavigation.d.ts.map +1 -0
  130. package/types/src/selection/_SelectionUtils.d.ts +7 -0
  131. package/types/src/selection/_SelectionUtils.d.ts.map +1 -0
  132. package/types/src/selection/index.d.ts +12 -0
  133. package/types/src/selection/index.d.ts.map +1 -0
  134. package/types/src/selection/useDragCells.d.ts +218 -0
  135. package/types/src/selection/useDragCells.d.ts.map +1 -0
  136. package/types/src/selection/useSelectionPointer.d.ts +70 -0
  137. package/types/src/selection/useSelectionPointer.d.ts.map +1 -0
  138. package/types/src/surface/GridPane.d.ts +85 -0
  139. package/types/src/surface/GridPane.d.ts.map +1 -0
  140. package/types/src/surface/GridPaneProvider.d.ts +37 -0
  141. package/types/src/surface/GridPaneProvider.d.ts.map +1 -0
  142. package/types/src/surface/GridSurface.d.ts +11 -0
  143. package/types/src/surface/GridSurface.d.ts.map +1 -0
  144. package/types/src/surface/IGridPane.d.ts +288 -0
  145. package/types/src/surface/IGridPane.d.ts.map +1 -0
  146. package/types/src/surface/IGridSurface.d.ts +141 -0
  147. package/types/src/surface/IGridSurface.d.ts.map +1 -0
  148. package/types/src/surface/SurfaceStateProvider.d.ts +50 -0
  149. package/types/src/surface/SurfaceStateProvider.d.ts.map +1 -0
  150. package/types/src/surface/_GridUtils.d.ts +37 -0
  151. package/types/src/surface/_GridUtils.d.ts.map +1 -0
  152. package/types/src/surface/index.d.ts +7 -0
  153. package/types/src/surface/index.d.ts.map +1 -0
  154. package/types/src/surface/useGridPane.d.ts +31 -0
  155. package/types/src/surface/useGridPane.d.ts.map +1 -0
  156. package/types/src/surface/useSurfaceState.d.ts +22 -0
  157. package/types/src/surface/useSurfaceState.d.ts.map +1 -0
  158. package/types/src/svg/LineSVG.d.ts +13 -0
  159. package/types/src/svg/LineSVG.d.ts.map +1 -0
  160. package/types/src/svg/RectangleSVG.d.ts +114 -0
  161. package/types/src/svg/RectangleSVG.d.ts.map +1 -0
  162. package/types/src/svg/ShapeBounds.d.ts +15 -0
  163. package/types/src/svg/ShapeBounds.d.ts.map +1 -0
  164. package/types/src/svg/Types.d.ts +37 -0
  165. package/types/src/svg/Types.d.ts.map +1 -0
  166. package/types/src/svg/index.d.ts +9 -0
  167. package/types/src/svg/index.d.ts.map +1 -0
  168. package/types/src/theme/GridTheme.d.ts +56 -0
  169. package/types/src/theme/GridTheme.d.ts.map +1 -0
  170. package/types/src/theme/index.d.ts +2 -0
  171. package/types/src/theme/index.d.ts.map +1 -0
  172. package/node/assets/style.css +0 -1
@@ -0,0 +1,54 @@
1
+ import { default as React } from 'react';
2
+ import { RangeCoords } from '@sheetxl/utils';
3
+ import { VisualSVGProps } from '../svg';
4
+ import { DragHandleRenderProps } from './DragHandle';
5
+ /**
6
+ * Props for {@link FillHandle}. Follows the shared **RangeHandle** contract: a controlled `range`
7
+ * (the fill template/source) in, the fill **destination** range out via `onDrag*`. The destination
8
+ * includes the template; the fill direction is `compare(range, destination)` if a consumer needs it.
9
+ * Extends {@link VisualSVGProps} (like {@link RangeRectProps} / {@link RangeResizerProps}) so the
10
+ * dashed preview's paint props — `stroke`, `strokeWidth`, … — are passed directly; the handle inherits
11
+ * {@link DEFAULT_HANDLE_STYLE} for whatever you don't set, and the handle color follows `stroke`.
12
+ */
13
+ export interface FillHandleProps extends VisualSVGProps {
14
+ /**
15
+ * The template (source) range being filled from. Optional because `SelectionLayer` injects it when
16
+ * `enableFill` is set (or via a `singleLayer` slot); required in practice for standalone use.
17
+ */
18
+ range?: RangeCoords;
19
+ /** Drag started; `range` is the template. */
20
+ onDragStart?: (range: RangeCoords, e: React.PointerEvent) => void;
21
+ /**
22
+ * Adjust the raw destination before it drives the preview + `onDrag*` — e.g. snap the fill edge to a
23
+ * merged-cell boundary so the dashed preview and the committed fill agree (and never land on an
24
+ * illegal interval). Given the template and the pointer-derived destination, return the destination to
25
+ * use. Applied on every move; omit for no snapping.
26
+ */
27
+ snapDestination?: (template: RangeCoords, destination: RangeCoords) => RangeCoords;
28
+ /** Live during the drag: the in-progress destination range (incl. the template). */
29
+ onDragMove?: (range: RangeCoords, e: React.PointerEvent) => void;
30
+ /** Drag released: commit the fill to this destination range. Fires only when there IS a fill. */
31
+ onDragEnd?: (range: RangeCoords, e: React.PointerEvent) => void;
32
+ /**
33
+ * The drag finished — fires on **every** release after a press (unlike {@link FillHandleProps.onDragEnd},
34
+ * which fires only when a fill was drawn) AND on an abort (Escape / OS pointercancel). Use it for
35
+ * teardown that must run regardless — closing a preview tooltip, clearing a drag mode. Event-less on an
36
+ * Escape abort, hence the optional event.
37
+ */
38
+ onDragDone?: (e?: React.PointerEvent) => void;
39
+ /**
40
+ * Render the fill handle **element** yourself (headless) — forwarded to {@link DragHandle.renderHandle}.
41
+ * Replaces the default dot. Use it for a custom fill mark (e.g. the Excel fill square).
42
+ */
43
+ renderHandle?: (props: DragHandleRenderProps) => React.ReactNode;
44
+ }
45
+ /**
46
+ * The fill layer: a {@link DragHandle} at a corner of the `range` (bottom-right by default). It owns
47
+ * the handle placement — including the whole-row/column special-casing (pin to bottom-left / top-right
48
+ * and clamp into view) and freeze-pane de-duplication — plus the single-axis fill geometry and the
49
+ * dashed preview, reporting the destination range via the RangeHandle `onDrag*` callbacks. Selection
50
+ * extension + the actual data fill are the consumer's job (via `onDragEnd`) — this layer is
51
+ * selection-agnostic.
52
+ */
53
+ export declare const FillHandle: React.FC<FillHandleProps>;
54
+ //# sourceMappingURL=FillHandle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FillHandle.d.ts","sourceRoot":"","sources":["../../../../src/range/FillHandle.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAA+C,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAG/F,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,QAAQ,CAAC;AAG7C,OAAO,EAAc,KAAK,qBAAqB,EAAqB,MAAM,cAAc,CAAC;AAGzF;;;;;;;GAOG;AACH,MAAM,WAAW,eAAgB,SAAQ,cAAc;IACrD;;;OAGG;IACH,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,6CAA6C;IAC7C,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,EAAE,CAAC,EAAE,KAAK,CAAC,YAAY,KAAK,IAAI,CAAC;IAClE;;;;;OAKG;IACH,eAAe,CAAC,EAAE,CAAC,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,KAAK,WAAW,CAAC;IACnF,oFAAoF;IACpF,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,EAAE,CAAC,EAAE,KAAK,CAAC,YAAY,KAAK,IAAI,CAAC;IACjE,iGAAiG;IACjG,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,EAAE,CAAC,EAAE,KAAK,CAAC,YAAY,KAAK,IAAI,CAAC;IAChE;;;;;OAKG;IACH,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,YAAY,KAAK,IAAI,CAAC;IAC9C;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,qBAAqB,KAAK,KAAK,CAAC,SAAS,CAAC;CAClE;AA2DD;;;;;;;GAOG;AACH,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CA4FhD,CAAC"}
@@ -0,0 +1,36 @@
1
+ import { RangeCoords } from '@sheetxl/utils';
2
+ import { VirtualDivProps } from '../layer';
3
+ import { VisualSVGProps } from '../svg';
4
+ /**
5
+ * Props for {@link RangeRect}: a thin range→bounds wrapper that places the {@link RectangleSVG}
6
+ * **shape** at a grid range — it resolves the range to bounds via the pane, culls off-screen,
7
+ * optionally cuts a `hole`, and forwards every visual prop straight through. The SVG sibling of
8
+ * {@link VirtualDiv} (which hosts HTML content at a range).
9
+ */
10
+ export interface RangeRectProps extends Omit<VirtualDivProps, 'fill'>, Omit<VisualSVGProps, 'style'> {
11
+ /**
12
+ * The range to outline / fill. Resolved to absolute bounds via the current pane.
13
+ */
14
+ range: RangeCoords;
15
+ /**
16
+ * A range cut out of the FILL (evenodd hole) — e.g. the active cell in a selection. The range
17
+ * counterpart of {@link RectangleSVG}'s `hole` (which takes resolved bounds); `RangeRect` resolves
18
+ * it against the pane. The hole belongs to THIS range (the consumer decides which range gets it).
19
+ */
20
+ hole?: RangeCoords;
21
+ /**
22
+ * View-pixel slack for the off-screen cull. Defaults to half the stroke width. This is the one
23
+ * concern {@link RectangleSVG} can't express (it has no pane and does no culling).
24
+ */
25
+ clipInsets?: number;
26
+ }
27
+ /**
28
+ * Places one device-aligned {@link RectangleSVG} at a grid range. Resolves the range to bounds via
29
+ * the current pane, culls when off-screen, cuts an optional `hole`, and hands the raw bounds + all
30
+ * visual props to {@link RectangleSVG} (which snaps + paints). It knows about ranges and the pane;
31
+ * the painting/snapping is RectangleSVG's job. A pure decoration — composed from the two primitives
32
+ * (a view-sized, pointer-transparent {@link VirtualDiv} hosting the shape), shipped because it
33
+ * encodes non-obvious geometry.
34
+ */
35
+ export declare const RangeRect: import('react').MemoExoticComponent<(props: RangeRectProps) => import("react").JSX.Element | null>;
36
+ //# sourceMappingURL=RangeRect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RangeRect.d.ts","sourceRoot":"","sources":["../../../../src/range/RangeRect.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAI/D,OAAO,EAAc,KAAK,eAAe,EAAE,MAAM,UAAU,CAAC;AAC5D,OAAO,EAAgB,KAAK,cAAc,EAAE,MAAM,QAAQ,CAAC;AAE3D;;;;;GAKG;AACH,MAAM,WAAW,cAAe,SAAQ,IAAI,CAAC,eAAe,EAAE,MAAM,CAAC,EAAE,IAAI,CAAC,cAAc,EAAE,OAAO,CAAC;IAClG;;OAEG;IACH,KAAK,EAAE,WAAW,CAAC;IACnB;;;;OAIG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,SAAS,8CAAgB,cAAc,wCAyFlD,CAAC"}
@@ -0,0 +1,68 @@
1
+ import { RangeCoords } from '@sheetxl/utils';
2
+ import { VisualSVGProps } from '../svg';
3
+ import { HandleAnchor, DragHandleRenderProps } from './DragHandle';
4
+ /** The four corner handles (chart series / formula precedent rectangles use these). */
5
+ export declare const RESIZE_ANCHORS_4: readonly HandleAnchor[];
6
+ /** Corners + edge midpoints. */
7
+ export declare const RESIZE_ANCHORS_8: readonly HandleAnchor[];
8
+ /**
9
+ * Props for {@link RangeResizer}. Follows the shared **RangeHandle** contract: a controlled
10
+ * `range` in, the resized range out via `onDrag*`. Extends {@link VisualSVGProps} (like
11
+ * {@link RangeRectProps}) so the outline's paint props — `stroke`, `fill`, `strokeWidth`,
12
+ * `animatedStroke`, `animatedTransition`, … — are passed directly; the handles inherit
13
+ * {@link DEFAULT_HANDLE_STYLE} for whatever you don't set. The grip color follows `stroke`.
14
+ */
15
+ export interface RangeResizerProps extends VisualSVGProps {
16
+ /**
17
+ * The range being resized (controlled). Optional because `SelectionLayer` injects it when used as a
18
+ * `singleLayer` slot; required in practice for standalone use.
19
+ */
20
+ range?: RangeCoords;
21
+ /**
22
+ * Which handles to show. @defaultValue {@link RESIZE_ANCHORS_8}. Pass {@link RESIZE_ANCHORS_4} for
23
+ * corners-only (chart series / formula precedents).
24
+ */
25
+ anchors?: readonly HandleAnchor[];
26
+ /** Drag started; `range` is the original. */
27
+ onDragStart?: (range: RangeCoords, e: React.PointerEvent) => void;
28
+ /** Live during the drag: the in-progress resized range. */
29
+ onDragMove?: (range: RangeCoords, e: React.PointerEvent) => void;
30
+ /** Drag released: commit the resized range. */
31
+ onDragEnd?: (range: RangeCoords, e: React.PointerEvent) => void;
32
+ /**
33
+ * The resize was **aborted** — the user pressed Escape, or the OS cancelled the pointer. Fires INSTEAD
34
+ * of {@link RangeResizerProps.onDragEnd}. The local preview is cleared automatically; because a resize
35
+ * commits live via `onDragMove`, a consumer that mutates its model each move should restore the
36
+ * pre-drag range here (Windows-style abort). Event-less — an Escape abort has no pointer event.
37
+ */
38
+ onDragCancel?: () => void;
39
+ /**
40
+ * The pointer entered (`true`) or left (`false`) a resize grip — aggregated across all handles (only
41
+ * one is ever hovered at a time). Lets a consumer emphasize the outline while a corner is hovered (e.g.
42
+ * Excel thickening the border). Ignored for headless `renderHandle` consumers, which wire their own.
43
+ */
44
+ onHandleHoverChange?: (hovered: boolean) => void;
45
+ /** Handle size (px). @defaultValue 8 */
46
+ size?: number;
47
+ /**
48
+ * Render each corner/edge grip yourself (headless) — forwarded to {@link DragHandle}'s `renderHandle`
49
+ * per anchor (use `DragHandleRenderProps.anchor` to differentiate). Replaces the default grips.
50
+ */
51
+ renderHandle?: (props: DragHandleRenderProps) => React.ReactNode;
52
+ /** Keep the current focus across a handle drag (forwarded to {@link DragHandle.preserveFocus}). */
53
+ preserveFocus?: boolean;
54
+ }
55
+ /**
56
+ * A draggable, resizable rectangle: an outlined range with {@link DragHandle} grips on the requested
57
+ * corners/edges — the interaction used to re-scope a **chart series** or a **formula precedent**.
58
+ * Each grip is the same `DragHandle` primitive; this layer supplies the per-anchor edge-move
59
+ * semantics and the live preview, delegating the committed value to
60
+ * {@link RangeResizerProps.onDragEnd}.
61
+ *
62
+ * @remarks
63
+ * Controlled: render with the current `range` and update it from `onDragEnd`. Dragging an edge/corner
64
+ * past its opposite flips the rectangle (Excel-style), bottoming out at a 1x1 — at which point the
65
+ * grip you're holding has effectively become the opposite grip.
66
+ */
67
+ export declare const RangeResizer: React.FC<RangeResizerProps>;
68
+ //# sourceMappingURL=RangeResizer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RangeResizer.d.ts","sourceRoot":"","sources":["../../../../src/range/RangeResizer.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAmB,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAEnE,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,QAAQ,CAAC;AAO7C,OAAO,EAAc,KAAK,YAAY,EAAE,KAAK,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAGzF,uFAAuF;AACvF,eAAO,MAAM,gBAAgB,EAAE,SAAS,YAAY,EAA6B,CAAC;AAClF,gCAAgC;AAChC,eAAO,MAAM,gBAAgB,EAAE,SAAS,YAAY,EAAiD,CAAC;AAEtG;;;;;;GAMG;AACH,MAAM,WAAW,iBAAkB,SAAQ,cAAc;IACvD;;;OAGG;IACH,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,YAAY,EAAE,CAAC;IAClC,6CAA6C;IAC7C,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,EAAE,CAAC,EAAE,KAAK,CAAC,YAAY,KAAK,IAAI,CAAC;IAClE,2DAA2D;IAC3D,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,EAAE,CAAC,EAAE,KAAK,CAAC,YAAY,KAAK,IAAI,CAAC;IACjE,+CAA+C;IAC/C,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,EAAE,CAAC,EAAE,KAAK,CAAC,YAAY,KAAK,IAAI,CAAC;IAChE;;;;;OAKG;IACH,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACjD,wCAAwC;IACxC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,qBAAqB,KAAK,KAAK,CAAC,SAAS,CAAC;IACjE,mGAAmG;IACnG,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CA8EpD,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { VisualSVGProps } from '../svg';
2
+ /**
3
+ * The flat outline (fill + border, no inner ring) for the resize/fill handle layers
4
+ * (`RangeResizer` / {@link FillHandle}), which draw ONE rectangle. Colors compose from the grid
5
+ * `accent` (same knob as selection); the literals are the fallbacks so a bare grid renders unchanged.
6
+ */
7
+ export declare const DEFAULT_HANDLE_STYLE: VisualSVGProps;
8
+ //# sourceMappingURL=RangeStyle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RangeStyle.d.ts","sourceRoot":"","sources":["../../../../src/range/RangeStyle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,QAAQ,CAAC;AAE7C;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,EAAE,cAIlC,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * **Range** primitives: the pane-aware {@link RangeRect} (an SVG rectangle at a range) plus the
3
+ * controlled drag handles (move / resize / fill) and the generic {@link DragHandle}. The selection
4
+ * layer composes these; the drag handles in turn share `selection/`'s window-driven cell-drag engine
5
+ * (`useWindowDragCells`) for their gesture mechanics — capture, de-dup, edge auto-scroll, touch, cancel.
6
+ */
7
+ export * from './RangeStyle';
8
+ export * from './RangeRect';
9
+ export * from './DragHandle';
10
+ export * from './Draggable';
11
+ export * from './RangeResizer';
12
+ export * from './FillHandle';
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/range/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC"}
@@ -0,0 +1,59 @@
1
+ import { Direction, RangeAxis, CellCoords, RangeCoords, SelectionCoords } from '@sheetxl/utils';
2
+ import { ISelection } from './ISelection';
3
+ /**
4
+ * Options for {@link SelectionConstructionOptions}.
5
+ */
6
+ export interface SelectionConstructionOptions {
7
+ /** Initial selection. Defaults to a single active cell at `0,0`. */
8
+ initial?: SelectionCoords;
9
+ /**
10
+ * Bounds used to clamp {@link DefaultSelection.navigate}. The dumb tier's stand-in for the sheet's
11
+ * entire range. Defaults to non-negative / unbounded.
12
+ */
13
+ getBounds?: () => RangeCoords;
14
+ }
15
+ /**
16
+ * The default in-memory {@link ISelection} for examples and the basic grid. Its {@link ICellAnchor}
17
+ * anchor is `selection.cell`, so a single instance drives both the selection layer (as `ISelection`)
18
+ * and the editor (as the read-only anchor). The real app adapts an sdk `IRangeSelection` to
19
+ * {@link ISelection} instead.
20
+ *
21
+ * @remarks
22
+ * Dumb on purpose: it has no merge / hidden awareness; navigation just steps one cell, clamped to
23
+ * the {@link SelectionConstructionOptions.getBounds} port. Smart navigation lives in the sdk model.
24
+ * Methods are plain (unbound) — consumers read it via `useBoundSyncExternalStore`, which calls
25
+ * `subscribe`/the snapshot selector on the instance, so no per-method binding is needed.
26
+ */
27
+ export declare class DefaultSelection implements ISelection {
28
+ private _coords;
29
+ private readonly _getBounds;
30
+ private readonly listeners;
31
+ constructor(options?: SelectionConstructionOptions);
32
+ /** @inheritdoc ISelection.getSelection */
33
+ getSelection(): SelectionCoords;
34
+ /** @inheritdoc ISelection.setSelection */
35
+ setSelection(next: SelectionCoords): void;
36
+ /** @inheritdoc ISelection.navigate */
37
+ navigate(direction: Direction, select?: boolean, contentful?: boolean, increment?: number): void;
38
+ /** @inheritdoc ISelection.traverse */
39
+ traverse(axis?: RangeAxis, reverse?: boolean, region?: RangeCoords): void;
40
+ /**
41
+ * The index of the active range, or `-1` when there are no ranges. A `rangeIndex < 0` (or out of
42
+ * bounds) WITH ranges resolves to the LAST range — the same convention `SelectionLayer` renders with,
43
+ * so `modify` and the visuals agree on which range is "active" in that (anomalous) state.
44
+ */
45
+ private _activeIndex;
46
+ /** The active range (see {@link _activeIndex}), or the anchor as a 1x1 range when nothing is selected. */
47
+ private _activeRange;
48
+ /** @inheritdoc ISelection.modify */
49
+ modify(cell: Partial<CellCoords>, pivot?: Partial<CellCoords>): void;
50
+ /** @inheritdoc ISelection.append */
51
+ append(start: CellCoords, end?: CellCoords): void;
52
+ /** @inheritdoc ISelection.deselect */
53
+ deselect(rangeToRemove: RangeCoords): void;
54
+ /** @inheritdoc ICellAnchor.getCoords */
55
+ getCoords(): CellCoords;
56
+ /** @inheritdoc ICellAnchor.subscribe */
57
+ subscribe(listener: () => void): (() => void);
58
+ }
59
+ //# sourceMappingURL=DefaultSelection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DefaultSelection.d.ts","sourceRoot":"","sources":["../../../../src/selection/DefaultSelection.ts"],"names":[],"mappings":"AAAA,OAAO,EACoB,SAAS,EAAE,SAAS,EAC7C,KAAK,UAAU,EAAE,KAAK,WAAW,EAAE,KAAK,eAAe,EACxD,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAI/C;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C,oEAAoE;IACpE,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,WAAW,CAAC;CAC/B;AAiBD;;;;;;;;;;;GAWG;AACH,qBAAa,gBAAiB,YAAW,UAAU;IACjD,OAAO,CAAC,OAAO,CAAkB;IACjC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAoB;IAC/C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAyB;gBAEvC,OAAO,GAAE,4BAAiC;IAOtD,0CAA0C;IAC1C,YAAY,IAAI,eAAe;IAI/B,0CAA0C;IAC1C,YAAY,CAAC,IAAI,EAAE,eAAe,GAAG,IAAI;IAMzC,sCAAsC;IACtC,QAAQ,CAAC,SAAS,EAAE,SAAS,EAAE,MAAM,GAAE,OAAe,EAAE,UAAU,GAAE,OAAe,EAAE,SAAS,GAAE,MAAU,GAAG,IAAI;IA+BjH,sCAAsC;IACtC,QAAQ,CAAC,IAAI,GAAE,SAAyB,EAAE,OAAO,GAAE,OAAe,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,IAAI;IA2B/F;;;;OAIG;IACH,OAAO,CAAC,YAAY;IAQpB,0GAA0G;IAC1G,OAAO,CAAC,YAAY;IAKpB,oCAAoC;IACpC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC,EAAE,KAAK,GAAE,OAAO,CAAC,UAAU,CAAqB,GAAG,IAAI;IAuBvF,oCAAoC;IACpC,MAAM,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,GAAE,UAAkB,GAAG,IAAI;IAmBxD,sCAAsC;IACtC,QAAQ,CAAC,aAAa,EAAE,WAAW,GAAG,IAAI;IAsD1C,wCAAwC;IACxC,SAAS,IAAI,UAAU;IAIvB,wCAAwC;IACxC,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC;CAI9C"}
@@ -0,0 +1,21 @@
1
+ import { CellCoords } from '@sheetxl/utils';
2
+ /**
3
+ * An **observable thing located at a cell** — the read+observe anchor the editor follows.
4
+ *
5
+ * @remarks
6
+ * The base of the anchor hierarchy and the decoupling seam between selection and the editor. A
7
+ * consumer given an `ICellAnchor` can read the cell (`getCoords`) and be notified when it changes
8
+ * (`subscribe`), but **cannot move it** — there is no setter, so navigation stays with the selection.
9
+ *
10
+ * Two kinds of thing satisfy it: the selection's **moving** active cell ({@link ISelection} extends
11
+ * this, so a single instance drives both the selection layer and the editor), and a **fixed-cell**
12
+ * thing whose `coords` never move (an `EditSession`, observable on its edit state). The editor reads
13
+ * its anchor through this view (`getCoords`/`subscribe`) and never navigates.
14
+ */
15
+ export interface ICellAnchor {
16
+ /** The cell this thing is located at. Safe in event handlers (always current, never stale). */
17
+ getCoords(): CellCoords;
18
+ /** Subscribe to changes. Returns an unsubscribe. */
19
+ subscribe(listener: () => void): () => void;
20
+ }
21
+ //# sourceMappingURL=ICellAnchor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ICellAnchor.d.ts","sourceRoot":"","sources":["../../../../src/selection/ICellAnchor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,WAAW;IAC1B,+FAA+F;IAC/F,SAAS,IAAI,UAAU,CAAC;IACxB,oDAAoD;IACpD,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC;CAC7C"}
@@ -0,0 +1,65 @@
1
+ import { CellCoords, Direction, RangeAxis, RangeCoords, SelectionCoords } from '@sheetxl/utils';
2
+ import { ICellAnchor } from './ICellAnchor';
3
+ /**
4
+ * An **observable store** of a full {@link SelectionCoords} — the active cell plus the selected
5
+ * ranges and the active range index. The SelectionCoords-level extension of {@link ICellAnchor},
6
+ * whose anchor is the active cell.
7
+ *
8
+ * @remarks
9
+ * This is the single source of truth the selection layer renders and the pointer controller writes.
10
+ * It exposes the minimal mutation surface the layer needs — a raw {@link ISelection.setSelection}
11
+ * write plus {@link ISelection.navigate} (the one logical-move intent).
12
+ *
13
+ * Extends {@link ICellAnchor}: the active cell ({@link SelectionCoords.cell}) is the anchor and
14
+ * `subscribe` notifies on any change, so a single instance drives both the selection layer (as
15
+ * `ISelection`) and the editor (as the read-only {@link ICellAnchor}).
16
+ *
17
+ * `getSelection` MUST return a stable reference while unchanged.
18
+ */
19
+ export interface ISelection extends ICellAnchor {
20
+ /** The current selection. Stable ref while unchanged. Safe in event handlers (never stale). */
21
+ getSelection(): SelectionCoords;
22
+ /** Replace the selection. No-op if logically equal to the current value. */
23
+ setSelection(next: SelectionCoords): void;
24
+ /**
25
+ * Move the active cell in `direction`. With `select`, extend the active range instead of moving
26
+ * (the anchor stays fixed). `contentful` jumps to the next data edge (Ctrl+Arrow); `increment`
27
+ * moves that many cells at once (the page step — the caller passes a view-derived amount).
28
+ * Implementation-defined intelligence (bounds, merges, hidden, contentful) — dumb in
29
+ * {@link DefaultSelection}, sheet-backed in the sdk adapter (mirrors the sdk
30
+ * `IRangeSelection.navigate(direction, select?, contentful?, incrementAmount?)`).
31
+ */
32
+ navigate(direction: Direction, select?: boolean, contentful?: boolean, increment?: number): void;
33
+ /**
34
+ * Cycle the **active cell** to the next cell *within the current selection* — the Tab/Enter
35
+ * traversal. Unlike {@link ISelection.navigate} it never changes which ranges are selected (it only
36
+ * moves the active cell, and the active range index): it wraps at a range edge, visits each cell
37
+ * once, and jumps to the next range when stepping off the last corner. On a single cell (no range)
38
+ * it falls back to a one-cell move — unless a `region` is supplied, in which case a bare cursor
39
+ * **wraps within that region** (a table's data range) instead of moving off it. `Row` axis ⇒ Tab
40
+ * (→, reverse = ←); `Column` axis ⇒ Enter (↓, reverse = ↑). Implementation-defined intelligence
41
+ * (merges, hidden) — dumb in {@link DefaultSelection}, sheet-backed in the sdk adapter.
42
+ */
43
+ traverse(axis?: RangeAxis, reverse?: boolean, region?: RangeCoords): void;
44
+ /**
45
+ * Replace the active range with the box spanning `pivot`..`cell`. `pivot` defaults to the current
46
+ * anchor — so a drag or Shift+click passes only `cell`. Partial coords fall back to the active
47
+ * range's bounds (modifying only a row extends rows while keeping columns). The anchor is kept,
48
+ * unless the new range no longer contains it (an explicit off-anchor `pivot`, e.g. a touch grip on
49
+ * the opposite corner, can drag the range off the anchor) — then it snaps to the nearest corner so
50
+ * the anchor always lies within the active range.
51
+ */
52
+ modify(cell: Partial<CellCoords>, pivot?: Partial<CellCoords>): void;
53
+ /**
54
+ * Add a new range spanning `start`..`end` to the selection (the Ctrl/Cmd-click gesture). If there
55
+ * were no ranges, one is first seeded from the current anchor. The appended range becomes active
56
+ * and its start becomes the anchor.
57
+ */
58
+ append(start: CellCoords, end?: CellCoords): void;
59
+ /**
60
+ * Remove `range` from the selection, splitting any intersecting range around it (the
61
+ * Ctrl/Cmd-click-on-selected gesture). The active cell/range is preserved where possible.
62
+ */
63
+ deselect(range: RangeCoords): void;
64
+ }
65
+ //# sourceMappingURL=ISelection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ISelection.d.ts","sourceRoot":"","sources":["../../../../src/selection/ISelection.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,UAAU,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,KAAK,WAAW,EAAE,KAAK,eAAe,EACxF,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,UAAW,SAAQ,WAAW;IAC7C,+FAA+F;IAC/F,YAAY,IAAI,eAAe,CAAC;IAChC,4EAA4E;IAC5E,YAAY,CAAC,IAAI,EAAE,eAAe,GAAG,IAAI,CAAC;IAC1C;;;;;;;OAOG;IACH,QAAQ,CAAC,SAAS,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,UAAU,CAAC,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjG;;;;;;;;;OASG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IAC1E;;;;;;;OAOG;IACH,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC,EAAE,KAAK,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC;IACrE;;;;OAIG;IACH,MAAM,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,CAAC,EAAE,UAAU,GAAG,IAAI,CAAC;IAClD;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI,CAAC;CACpC"}
@@ -0,0 +1,128 @@
1
+ import { default as React } from 'react';
2
+ import { VisualSVGProps } from '../svg';
3
+ import { HandleAnchor, DragHandleRenderProps } from '../range';
4
+ import { LayerProps } from '../layer';
5
+ import { ISelection } from './ISelection';
6
+ /**
7
+ * The range-reference palette, in rotation order. The default {@link RangesPickerLayer} look cycles `stroke`
8
+ * through this so each range gets its own color — `PICKER_COLORS[i % length]` — and the fill is derived
9
+ * automatically (a low-alpha tint of the same color).
10
+ *
11
+ * These are the shared `--sxl-color-series-*` theme tokens (the SAME hues the formula editor colors reference
12
+ * text with, so a range's text and its rectangle match), so they follow light/dark automatically. The literal
13
+ * fallback keeps a bare (un-themed) grid — storybook / SDK-free reference use — colored.
14
+ */
15
+ export declare const PICKER_COLORS: readonly string[];
16
+ /**
17
+ * Props for {@link RangesPickerLayer}. It **renders a {@link Layer}** at its root (extends
18
+ * {@link LayerProps}: `zIndex`, tap handlers), so a consumer stacks it like any layer. The shared
19
+ * base outline look for every range is {@link RangesPickerLayerProps.rangeStyle}, with
20
+ * {@link RangesPickerLayerProps.getRangeStyle} overriding per range (default: cycle `stroke`
21
+ * through the {@link PICKER_COLORS}).
22
+ */
23
+ export interface RangesPickerLayerProps extends LayerProps {
24
+ /** Shared base outline look for every range (`stroke`, `strokeWidth`, …), merged UNDER `getRangeStyle`. */
25
+ rangeStyle?: VisualSVGProps;
26
+ /**
27
+ * The selection model this layer renders + edits (like {@link SelectionLayer}, and typically a
28
+ * `SheetSelection` over an sdk `IRangeSelection.createSelection()`). It reads the model's
29
+ * {@link SelectionCoords} — one resizable + movable rectangle per range, the `rangeIndex` range
30
+ * **active** — and writes every move / resize / draw back through `setSelection`, setting
31
+ * `rangeIndex` to the edited range so a text-backed model can rewrite exactly that reference.
32
+ *
33
+ * @remarks
34
+ * Unlike {@link SelectionLayer} it renders *only ranges* (never an anchor cell — Excel doesn't draw
35
+ * the formula's home). A gesture over an empty picker (or a click while the caret isn't on a reference)
36
+ * APPENDS a new range, so it doubles as the "insert a new reference" surface.
37
+ */
38
+ selection: ISelection;
39
+ /**
40
+ * Per-range outline props, merged over the layer's shared base ({@link VisualSVGProps}). Receives the
41
+ * range `index` and whether it's `active`. Defaults to cycling `stroke` through {@link PICKER_COLORS}
42
+ * (`PICKER_COLORS[index % length]`). The layer still derives the fill (a low-alpha tint of `stroke`
43
+ * unless you set `fill`), the active animation, and the hover/drag emphasis on top of what you return.
44
+ *
45
+ * Return `null` to OMIT that range from this layer entirely — no outline, no resize/move handles, not
46
+ * interactive. The model (`selection`) is untouched; this is a per-INSTANCE render filter, not a data
47
+ * filter. Lets a consumer share one multi-range model across several layers and have each show only
48
+ * the subset relevant to it (e.g. a formula's references split across per-sheet panes) with no index
49
+ * remapping — writes still go back through `selection.setSelection` at the range's real, unfiltered
50
+ * index, since the model itself was never filtered.
51
+ */
52
+ getRangeStyle?: (index: number, active: boolean) => VisualSVGProps | null;
53
+ /**
54
+ * Which resize handles to show. @defaultValue {@link RESIZE_ANCHORS_4} (corners). Pass
55
+ * {@link RESIZE_ANCHORS_8} for corners + edge midpoints.
56
+ */
57
+ anchors?: readonly HandleAnchor[];
58
+ /** Enable the move grip (drag the border to relocate a range, keeping its size). @defaultValue false */
59
+ enabledMove?: boolean;
60
+ /**
61
+ * Don't claim the grid-wide **draw** gesture — the pointer-drag over empty grid that re-scopes the
62
+ * **active** range from scratch. Ranges stay movable/resizable via their border + corners.
63
+ * @defaultValue false
64
+ */
65
+ disableDraw?: boolean;
66
+ /**
67
+ * Allow Ctrl/Cmd+click (and drag) on the draw surface to **append** a brand-new range even while a
68
+ * range is active — the multi-range pick gesture (Excel point mode's Ctrl+click; a text-backed
69
+ * consumer renders the appended range after a `,` separator). Set `false` for a picker whose value
70
+ * is a single rectangle (a chart series / table range field): the modifier is then ignored and the
71
+ * gesture is a plain draw. There is deliberately no Ctrl+click *deselect* counterpart (unlike the
72
+ * body selection's `useSelectionPointer`) — Excel does not remove a reference by clicking it.
73
+ *
74
+ * @defaultValue true
75
+ */
76
+ allowMulti?: boolean;
77
+ /** Resize handle size (px). @defaultValue 8 */
78
+ size?: number;
79
+ /**
80
+ * Animate the **active** range's outline with a marching-ants stroke (the others stay static).
81
+ *
82
+ * @defaultValue false
83
+ */
84
+ animated?: boolean;
85
+ /**
86
+ * Render the resize corner grips yourself (headless) — forwarded to {@link RangeResizer}'s
87
+ * `renderHandle` per anchor. Replaces the default grips.
88
+ */
89
+ renderHandle?: (props: DragHandleRenderProps) => React.ReactNode;
90
+ /**
91
+ * Keep whatever had focus across a drag (draw / move / resize) rather than letting the gesture move
92
+ * focus to the grid's `tabIndex` Stage. The picker is used *while editing a formula*, so a handle drag
93
+ * must not blur the editor's textarea — it preserves the existing focus (nothing to restore). Turn off
94
+ * only for a picker used outside an editor. @defaultValue true
95
+ */
96
+ preserveFocus?: boolean;
97
+ /**
98
+ * Called when a rectangle gesture (draw / move / resize) starts (`true`) and ends (`false`) — one
99
+ * aggregated signal across all of them. Lets a host react to "a reference drag is in progress" as a whole,
100
+ * e.g. the formula editor hiding its hint popup for the duration. `index` is the range being moved/resized
101
+ * (so a host can highlight exactly that reference), or `null` for a DRAW (no existing range yet) / idle.
102
+ */
103
+ onDragActiveChange?: (active: boolean, index: number | null) => void;
104
+ }
105
+ /**
106
+ * The default per-range look: cycle the stroke through {@link PICKER_COLORS}. Exported so a consumer
107
+ * wrapping {@link RangesPickerLayerProps.getRangeStyle} (e.g. to add a per-instance visibility filter —
108
+ * see that prop's doc) can fall back to it instead of reimplementing the color cycle.
109
+ */
110
+ export declare const defaultRangeStyle: (index: number) => VisualSVGProps;
111
+ /**
112
+ * A **multi-rectangle** range picker — each rectangle resizable + movable — used to re-scope a set of
113
+ * **formula references** or a **chart's data ranges**. Like {@link SelectionLayer} it binds to an
114
+ * {@link ISelection} model, but it renders *only ranges* (never an anchor cell — Excel doesn't draw the
115
+ * formula's home).
116
+ *
117
+ * @remarks
118
+ * Each range is a {@link RangeResizer} (outline + corners) wrapped in a {@link Draggable}
119
+ * (border-ring move), colored from {@link RangesPickerLayerProps.getRangeStyle} (default: cycle
120
+ * {@link PICKER_COLORS}). The model's `rangeIndex` range is **active** — the grid draw re-scopes it and it
121
+ * animates; interacting with a range makes it active. Every gesture writes back through
122
+ * `selection.setSelection`, setting `rangeIndex` to the edited range. A draw while the caret isn't on a
123
+ * reference (`rangeIndex < 0`) APPENDS a new range instead (insert / draw-from-empty). Shift+draw
124
+ * EXTENDS the active range from its start corner; Ctrl/Cmd+draw appends a new range even while one is
125
+ * active (gated by {@link RangesPickerLayerProps.allowMulti}).
126
+ */
127
+ export declare const RangesPickerLayer: React.FC<RangesPickerLayerProps>;
128
+ //# sourceMappingURL=RangesPickerLayer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RangesPickerLayer.d.ts","sourceRoot":"","sources":["../../../../src/selection/RangesPickerLayer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAU/B,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,EACsC,KAAK,YAAY,EAAE,KAAK,qBAAqB,EACzF,MAAM,UAAU,CAAC;AAClB,OAAO,EAAqB,KAAK,UAAU,EAAE,MAAM,UAAU,CAAC;AAE9D,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAkB/C;;;;;;;;GAQG;AACH,eAAO,MAAM,aAAa,EAAE,SAAS,MAAM,EAG1C,CAAC;AAKF;;;;;;GAMG;AACH,MAAM,WAAW,sBAAuB,SAAQ,UAAU;IACxD,2GAA2G;IAC3G,UAAU,CAAC,EAAE,cAAc,CAAC;IAC5B;;;;;;;;;;;OAWG;IACH,SAAS,EAAE,UAAU,CAAC;IACtB;;;;;;;;;;;;OAYG;IACH,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,KAAK,cAAc,GAAG,IAAI,CAAC;IAC1E;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,YAAY,EAAE,CAAC;IAClC,wGAAwG;IACxG,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;;;;;;;OASG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,+CAA+C;IAC/C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,qBAAqB,KAAK,KAAK,CAAC,SAAS,CAAC;IACjE;;;;;OAKG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;;;OAKG;IACH,kBAAkB,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;CACtE;AAUD;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,GAAI,OAAO,MAAM,KAAG,cAEhD,CAAC;AAEH;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAyM9D,CAAC"}