@sheetxl/react 0.8.0-beta.7 → 0.8.0-beta.9

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 (49) hide show
  1. package/browser/cjs/index.cjs +18 -17
  2. package/browser/cjs/xuAfpHmA2W4MFa_0.cjs +1 -0
  3. package/browser/esm/Dk6274Lic6AOmEAq.mjs +2624 -0
  4. package/browser/esm/index.mjs +6023 -4108
  5. package/licenses/dependencies.txt +0 -555
  6. package/node/esm/B-5p0wwNM6Y5jlI2.mjs +2624 -0
  7. package/node/esm/index.mjs +8080 -6160
  8. package/package.json +6 -7
  9. package/resources/locales/de/sheet.cmd.json +101 -0
  10. package/resources/locales/de/ui.msg.json +5 -0
  11. package/resources/locales/en/sheet.cmd.json +113 -0
  12. package/resources/locales/en/ui.msg.json +166 -0
  13. package/types/src/cell/OutlineButton.d.ts +123 -0
  14. package/types/src/cell/index.d.ts +1 -0
  15. package/types/src/checklist/ValueChecklist.d.ts +15 -3
  16. package/types/src/control/FormControlRenderers.d.ts +14 -0
  17. package/types/src/control/index.d.ts +2 -0
  18. package/types/src/frame/CommandContext.d.ts +27 -0
  19. package/types/src/index.d.ts +1 -0
  20. package/types/src/layer/SheetHeaderCellLayer.d.ts +9 -0
  21. package/types/src/layer/SheetOutlineLayer.d.ts +40 -0
  22. package/types/src/layer/index.d.ts +1 -0
  23. package/types/src/movable/IMovableArea.d.ts +10 -0
  24. package/types/src/movable/MovableAdornment.d.ts +20 -0
  25. package/types/src/movable/MovableControl.d.ts +32 -0
  26. package/types/src/movable/MovableFrame.d.ts +13 -15
  27. package/types/src/movable/MovableRenderers.d.ts +55 -0
  28. package/types/src/movable/RotateHandle.d.ts +29 -0
  29. package/types/src/movable/framePlacement.d.ts +29 -0
  30. package/types/src/movable/geometry.d.ts +51 -0
  31. package/types/src/movable/index.d.ts +1 -0
  32. package/types/src/shape/ShapeEditor.d.ts +16 -2
  33. package/types/src/shape/ShapeGallery.d.ts +16 -0
  34. package/types/src/shape/ShapeHandles.d.ts +28 -0
  35. package/types/src/shape/ShapeSVG.d.ts +24 -0
  36. package/types/src/shape/ShapeText.d.ts +17 -0
  37. package/types/src/shape/icons/ShapeIcons.d.ts +16 -0
  38. package/types/src/shape/icons/_ShapeIconPack.d.ts +4 -0
  39. package/types/src/shape/index.d.ts +3 -0
  40. package/types/src/shape/shapeFrame.d.ts +6 -0
  41. package/types/src/shape/shapeStyle.d.ts +31 -0
  42. package/types/src/sheet/ISheetElement.d.ts +8 -1
  43. package/types/src/sheet/SheetOutlineElement.d.ts +70 -0
  44. package/types/src/workbook/DefaultMovableRenderers.d.ts +2 -0
  45. package/browser/cjs/Bo9Kx3L_XQkGPBJ5.cjs +0 -1
  46. package/browser/cjs/Pl04-kDEQSO8_qFU.cjs +0 -156
  47. package/browser/esm/CwXbsCWTrl3QB1t6.mjs +0 -6286
  48. package/node/esm/CZc8rKcLzArmqJz2.mjs +0 -9
  49. package/types/src/movable/MoveableBundle.d.ts +0 -4
@@ -1,5 +1,5 @@
1
1
  import { default as React } from 'react';
2
- import { Scalar } from '@sheetxl/sdk';
2
+ import { Scalar, IFilter } from '@sheetxl/sdk';
3
3
  import { CheckboxListProps } from '@sheetxl/grid-react';
4
4
  /** One value the checklist offers. */
5
5
  export interface ValueChecklistItem {
@@ -16,12 +16,19 @@ export interface ValueChecklistItem {
16
16
  export interface ValueChecklistProps {
17
17
  /** The values, in the order shown. */
18
18
  items: readonly ValueChecklistItem[];
19
+ /**
20
+ * The date tree over the leading items, as `IFilter.getItems` answers it: one level per entry,
21
+ * each the runs of items its nodes span. Listed as Excel's tree: a row per node with a
22
+ * disclosure, the deepest level's nodes as the leaves, and the items past the tree flat under
23
+ * it. While a search is typed the dates list flat by their text.
24
+ */
25
+ dates?: readonly IFilter.DateLevel[];
19
26
  /** The checked values, by `text`. */
20
27
  checked: ReadonlySet<string>;
21
28
  /**
22
29
  * `texts` were set to `checked` — one on a click, the highlighted rows on Space, every row in
23
- * view on Select All. Rows out of the view (narrowed away by the search) are never named, so
24
- * they keep their state.
30
+ * view on Select All, every item of a node on its row. Rows out of the view (narrowed away by
31
+ * the search) are never named, so they keep their state.
25
32
  */
26
33
  onCheckedChange: (texts: readonly string[], checked: boolean) => void;
27
34
  /** Whether a `(Blanks)` row is offered, first in the list. */
@@ -64,6 +71,11 @@ export interface ValueChecklistProps {
64
71
  * The search field keeps the focus; Up/Down move the list's highlight, Space toggles the
65
72
  * highlighted rows, Enter applies, Escape clears the search and then closes.
66
73
  *
74
+ * With `dates`, the leading items are listed as a tree (Excel's year › month › day): a node's
75
+ * checkbox is the state of its items, its row toggles them all, and its disclosure (or Left and
76
+ * Right on the highlighted row, with nothing typed) folds it. Collapsing hides the member rows
77
+ * from the view; they keep their state.
78
+ *
67
79
  * The root wears the grid's surface and mode, so the list looks like the cells it stands for even
68
80
  * inside chrome of another color.
69
81
  */
@@ -0,0 +1,14 @@
1
+ import { default as React } from 'react';
2
+ import { MovableRendererProps } from '../movable';
3
+ export declare const ButtonRenderer: React.ComponentType<MovableRendererProps>;
4
+ export declare const CheckBoxRenderer: React.ComponentType<MovableRendererProps>;
5
+ export declare const OptionButtonRenderer: React.ComponentType<MovableRendererProps>;
6
+ export declare const ScrollBarRenderer: React.ComponentType<MovableRendererProps>;
7
+ export declare const SpinnerRenderer: React.ComponentType<MovableRendererProps>;
8
+ export declare const DropDownRenderer: React.ComponentType<MovableRendererProps>;
9
+ export declare const ListBoxRenderer: React.ComponentType<MovableRendererProps>;
10
+ export declare const GroupBoxRenderer: React.ComponentType<MovableRendererProps>;
11
+ export declare const LabelRenderer: React.ComponentType<MovableRendererProps>;
12
+ /** A kind with no look of its own: a neutral frame with its name. */
13
+ export declare const UnmodeledControlRenderer: React.ComponentType<MovableRendererProps>;
14
+ //# sourceMappingURL=FormControlRenderers.d.ts.map
@@ -0,0 +1,2 @@
1
+ export * from './FormControlRenderers';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -74,6 +74,33 @@ export interface ResizeHeaderContext {
74
74
  toUnits?(value: number): number;
75
75
  toPixels?(value: number): number;
76
76
  }
77
+ /**
78
+ * The one group a Show / Hide Detail command acts on, named by its summary header; without it the
79
+ * command acts on the selection.
80
+ */
81
+ export interface OutlineTarget {
82
+ axis: IRange.Axis;
83
+ /** The summary row or column, zero-based. */
84
+ index: number;
85
+ }
86
+ /** A gutter button's press: expand (`show`) or collapse the group whose summary this is. */
87
+ export interface OutlineToggle extends OutlineTarget {
88
+ show: boolean;
89
+ }
90
+ /** The level a level button shows: `level` on `axis`. */
91
+ export interface OutlineLevel {
92
+ axis: IRange.Axis;
93
+ level: number;
94
+ }
95
+ /** The outline settings window's value. */
96
+ export interface OutlineSettings {
97
+ /** Summary rows below their details (else above). */
98
+ summaryBelow: boolean;
99
+ /** Summary columns to the right of their details (else to the left). */
100
+ summaryRight: boolean;
101
+ /** Apply the automatic outline styles. */
102
+ automaticStyles: boolean;
103
+ }
77
104
  export interface NewTable {
78
105
  ranges: ICellRanges;
79
106
  hasHeader?: boolean;
@@ -12,6 +12,7 @@ export * from './slicer';
12
12
  export * from './comment';
13
13
  export * from './richText';
14
14
  export * from './movable';
15
+ export * from './control';
15
16
  export * from './form';
16
17
  export * from './editableLabel';
17
18
  export * from './tabStrip';
@@ -8,6 +8,12 @@ export interface SheetHeaderCellLayerProps extends LayerProps {
8
8
  header: ISheetHeader;
9
9
  /** Per-header renderer (the sheet's `SheetHeaderRenderer` wrapping). */
10
10
  renderCell: (props: CellRendererProps) => React.ReactNode;
11
+ /**
12
+ * A styling input the layer cannot watch itself: a new value busts the label cache. The header
13
+ * element passes its filtered runs' revision (a filter set or cleared may hide no row, so no
14
+ * size change repaints for it).
15
+ */
16
+ invalidateToken?: unknown;
11
17
  }
12
18
  /**
13
19
  * The header's cell layer.
@@ -20,6 +26,9 @@ export interface SheetHeaderCellLayerProps extends LayerProps {
20
26
  * - **size change** (`onSizesChange`) — alters what is visible/labeled;
21
27
  * - **selection change** — header labels are styled by selection (fill / weight / color), but the tiled
22
28
  * `CellLayer` cache survives scroll, so it must be dropped when *this header's* selected runs change.
29
+ *
30
+ * A third comes from the owner as `invalidateToken`: the rows a filter holds a condition over (the blue
31
+ * row numbers), which the header element reads and the layer cannot.
23
32
  * Gated on the runs {@link selectedRunsSignature} so it busts only when the styling would differ (not
24
33
  * on every active-cell move, and never on scroll — there is no per-frame range work).
25
34
  *
@@ -0,0 +1,40 @@
1
+ import { default as React } from 'react';
2
+ import { IRange, ISheet } from '@sheetxl/sdk';
3
+ import { LayerProps } from '@sheetxl/grid-react';
4
+ import { OutlineButtonProps } from '../cell/OutlineButton';
5
+ export interface SheetOutlineLayerProps extends LayerProps {
6
+ /** The sheet whose outline is drawn. */
7
+ sheet: ISheet;
8
+ /** Rows or columns. */
9
+ axis: IRange.Axis;
10
+ /** The lanes across the gutter: one per level, plus one. */
11
+ lanes: number;
12
+ /** Renders a group's collapse / expand button. Defaults to `OutlineButton`. */
13
+ renderButton?: (props: OutlineButtonProps) => React.ReactNode;
14
+ /**
15
+ * The space around the buttons, in pixels: between neighbors, before the first and after the last.
16
+ *
17
+ * @defaultValue 1
18
+ */
19
+ laneGap?: number;
20
+ /**
21
+ * Space between a bracket's end and its button, in pixels.
22
+ *
23
+ * @defaultValue 0
24
+ */
25
+ bracketGap?: number;
26
+ }
27
+ /**
28
+ * The outline gutter's layer: for each group in view, a bracket beside its details and a button on
29
+ * its summary that collapses or expands it; and beside each detail header a dot, as Excel draws.
30
+ *
31
+ * @remarks
32
+ * Lane `level - 1` holds the groups of that level, outermost nearest the sheet edge. Groups come from
33
+ * {@link IOutline.getGroups} limited to the pane's visible span, so the work is per group in view. A
34
+ * collapsed group draws only its button. The dots are the gutter's cells: a {@link CellTileDiv} in
35
+ * this layer renders one per header the tiling engine finds in view, and a header at level `n` gets
36
+ * its dot in lane `n`, the lane after its deepest bracket, so a dot never sits on a line.
37
+ * Re-renders on scroll (the pane context) and on `onOutlineChange`.
38
+ */
39
+ export declare const SheetOutlineLayer: React.MemoExoticComponent<(props: SheetOutlineLayerProps) => React.JSX.Element>;
40
+ //# sourceMappingURL=SheetOutlineLayer.d.ts.map
@@ -10,6 +10,7 @@ export * from './SheetColumnButtonLayer';
10
10
  export * from './SheetGridLineLayer';
11
11
  export * from './SheetBackgroundLayer';
12
12
  export * from './SheetHeaderCellLayer';
13
+ export * from './SheetOutlineLayer';
13
14
  export * from './SheetMovableLayer';
14
15
  export * from './TableLayer';
15
16
  export * from './SheetTableCommandLayer';
@@ -47,6 +47,16 @@ export interface MovableElementProps extends React.HTMLAttributes<HTMLElement> {
47
47
  * box can drag from its border and put the caret where its text is pressed.
48
48
  */
49
49
  onDragZone?: (isDragZone: (event: MouseEvent | TouchEvent) => boolean) => void;
50
+ /**
51
+ * A box above the selection chrome, placed and turned exactly as the frame is, for the content's
52
+ * own controls (a shape's adjustment handles). `null` when the movable has none.
53
+ *
54
+ * @remarks
55
+ * Render into it with a portal. It fills the frame's box and is pointer-transparent; controls opt
56
+ * back in. Drawn above the resize handles, so a control on the selection outline wins the press,
57
+ * as in Excel.
58
+ */
59
+ adornmentHost?: HTMLElement | null;
50
60
  /**
51
61
  * If true then the component is disabled.
52
62
  * @defaultValue false
@@ -0,0 +1,20 @@
1
+ import { default as React } from 'react';
2
+ import { IMovable } from '@sheetxl/sdk';
3
+ import { MovablePreview } from './framePlacement';
4
+ export interface MovableAdornmentProps {
5
+ movable: IMovable;
6
+ /** The gesture preview, as the frame is given it. */
7
+ preview?: MovablePreview | null;
8
+ /** Receives the box once mounted and `null` when it unmounts; the layer hands it to the content. */
9
+ onHost: (movable: IMovable, host: HTMLElement | null) => void;
10
+ /** The layer's own controls for the movable: its outline, resize and rotate handles. */
11
+ children?: React.ReactNode;
12
+ }
13
+ /**
14
+ * The box a selected movable's controls are drawn in: placed and turned as its frame is, from the
15
+ * same numbers. The layer's controls come first and the content renders its own after them (see
16
+ * `MovableElementProps.adornmentHost`), so a content control is hit before a resize handle it
17
+ * overlaps.
18
+ */
19
+ export declare const MovableAdornment: React.FC<MovableAdornmentProps>;
20
+ //# sourceMappingURL=MovableAdornment.d.ts.map
@@ -0,0 +1,32 @@
1
+ import { default as React } from 'react';
2
+ import { ResizeDirection } from './geometry';
3
+ /** The resize cursor for a handle on a frame turned `rotation` degrees, so it follows the turn. */
4
+ export declare const resizeCursor: (direction: ResizeDirection, rotation: number) => string;
5
+ export interface MovableControlProps {
6
+ /** Compass names of the handles to draw (`nw`, `n`, … `se`). */
7
+ directions: readonly string[];
8
+ /** Degrees clockwise the frame is turned; only the cursors use it, the box turns itself. */
9
+ rotation: number;
10
+ /**
11
+ * Fade the control, as during a gesture. It stays mounted: the handle being dragged holds the
12
+ * pointer capture.
13
+ */
14
+ isDragging?: boolean;
15
+ /** A press on a handle. Return `false` to refuse the gesture. */
16
+ onResizeStart: () => boolean;
17
+ /**
18
+ * The pointer moved. `delta` is how far it is from the press, in screen pixels; `keepAspect` is
19
+ * whether Shift is held.
20
+ */
21
+ onResize: (direction: ResizeDirection, delta: readonly [number, number], keepAspect: boolean) => void;
22
+ /** The pointer was released. */
23
+ onResizeEnd: () => void;
24
+ /** The gesture was lost (`pointercancel`). */
25
+ onResizeCancel: () => void;
26
+ }
27
+ /**
28
+ * A selected movable's outline and resize handles, drawn in its adornment box so they are placed
29
+ * and turned from the same numbers as the frame. Each handle captures the pointer for its gesture.
30
+ */
31
+ export declare const MovableControl: React.FC<MovableControlProps>;
32
+ //# sourceMappingURL=MovableControl.d.ts.map
@@ -1,7 +1,7 @@
1
1
  import { default as React } from 'react';
2
- import { Bounds } from '@sheetxl/utils';
3
2
  import { IMovable } from '@sheetxl/sdk';
4
3
  import { MovableElementProps } from './IMovableArea';
4
+ import { MovablePreview } from './framePlacement';
5
5
  export interface MovableFrameProps extends React.HTMLAttributes<HTMLElement> {
6
6
  /**
7
7
  * The underlying model for the chart.
@@ -18,26 +18,24 @@ export interface MovableFrameProps extends React.HTMLAttributes<HTMLElement> {
18
18
  onRefUnload: (ref: HTMLElement) => void;
19
19
  onHide: (hide: (movable: IMovable) => boolean | Promise<boolean> | void) => void;
20
20
  onShow: (show: (movable: IMovable) => void) => void;
21
- /** {@inheritDoc MovableElementProps.onDragZone} */
22
- onDragZone?: (isDragZone: (event: MouseEvent | TouchEvent) => boolean) => void;
21
+ /** {@inheritDoc MovableElementProps.adornmentHost} */
22
+ adornmentHost?: HTMLElement | null;
23
23
  /**
24
- * Live drag/resize preview bounds (absolute), or null/undefined when idle. When set, the frame
25
- * renders HERE instead of at the model bounds (the model isn't touched until the gesture commits).
26
- * Surface-scoped in the parent, so it's set in every pane — that's what makes a dragged shape appear,
27
- * correctly clipped, on both sides of a freeze boundary.
24
+ * Live drag/resize/rotate preview, or null/undefined when idle. When set, the frame renders with it
25
+ * instead of the model (the model isn't touched until the gesture commits). Surface-scoped in the
26
+ * parent, so it's set in every pane — that's what makes a dragged shape appear, correctly clipped,
27
+ * on both sides of a freeze boundary.
28
28
  */
29
- overrideBounds?: Bounds | null;
30
- /**
31
- * Called after the frame repositions (scroll, keyboard nudge, drag preview, resize). The parent uses
32
- * it to re-sync the Moveable control box to the frame's new DOM rect — a nudge re-renders only this
33
- * frame, not the parent, so the parent can't detect the move on its own.
34
- */
35
- onReposition?: () => void;
29
+ preview?: MovablePreview | null;
36
30
  /**
37
31
  * Called when the final movable is unselected.
38
32
  */
39
33
  onUnFocus: () => void;
40
- dragStart(e: MouseEvent | TouchEvent, target?: EventTarget | null): void;
34
+ /**
35
+ * A press that may move the frame, after it selected. Not called for a press outside the
36
+ * content's drag zone or in an editable element.
37
+ */
38
+ dragStart(e: PointerEvent): void;
41
39
  disabled?: boolean;
42
40
  /**
43
41
  * Indicates if the frame is being dragged. Useful for styling.
@@ -0,0 +1,55 @@
1
+ import { default as React } from 'react';
2
+ import { IMovable } from '@sheetxl/sdk';
3
+ import { MovableElementProps } from './IMovableArea';
4
+ /**
5
+ * What a movable's renderer is given: the element props the movable layer hands every movable,
6
+ * with the movable itself always present.
7
+ */
8
+ export interface MovableRendererProps extends MovableElementProps {
9
+ movable: IMovable;
10
+ }
11
+ /**
12
+ * Draws the content of one kind of movable (`IMovable.IContent.getType()`) inside the frame the
13
+ * movable layer gives it.
14
+ */
15
+ export type MovableRenderer = React.ComponentType<MovableRendererProps>;
16
+ /**
17
+ * Resolves a renderer, as a dynamic `import()` does. Called the first time a movable of the kind
18
+ * is drawn, never before, so a kind that never appears costs nothing.
19
+ */
20
+ export type MovableRendererLoader = () => Promise<MovableRenderer>;
21
+ /**
22
+ * How a renderer is registered.
23
+ */
24
+ export interface MovableRendererOptions {
25
+ /**
26
+ * What is drawn while the renderer loads.
27
+ * @defaultValue nothing — the movable's frame is there already.
28
+ */
29
+ fallback?: React.ReactNode;
30
+ }
31
+ /**
32
+ * Registers the renderer for a kind of movable content, replacing the built-in one.
33
+ *
34
+ * @param type The content type (`picture`, `chart`, `shape`, `checkBox`, …), as registered with
35
+ * `MovableContentRegistry` in the SDK.
36
+ * @param load Resolves the renderer when first needed.
37
+ * @returns A function that removes the registration.
38
+ *
39
+ * @example
40
+ * ```ts
41
+ * registerMovableRenderer('map', () => import('./MapRenderer').then((module) => module.MapRenderer));
42
+ * ```
43
+ */
44
+ export declare function registerMovableRenderer(type: string, load: MovableRendererLoader, options?: MovableRendererOptions): () => void;
45
+ /**
46
+ * The renderer for a kind of movable content: the registered one, else the built-in one, else
47
+ * `undefined`.
48
+ */
49
+ export declare function getMovableRenderer(type: string): ((props: MovableRendererProps) => React.ReactElement) | undefined;
50
+ /**
51
+ * Registers a built-in renderer. A registered renderer always wins over it.
52
+ * @internal
53
+ */
54
+ export declare function registerBuiltInMovableRenderer(type: string, load: MovableRendererLoader, options?: MovableRendererOptions): void;
55
+ //# sourceMappingURL=MovableRenderers.d.ts.map
@@ -0,0 +1,29 @@
1
+ import { default as React } from 'react';
2
+ export interface RotateHandleProps {
3
+ /**
4
+ * Fade the handle, as during any gesture. It stays mounted: while it turns the frame it holds
5
+ * the pointer capture.
6
+ */
7
+ isDragging?: boolean;
8
+ /** A press on the handle. Return `false` to refuse the gesture. */
9
+ onStart: () => boolean;
10
+ /**
11
+ * The pointer moved: `degrees` is the angle swept about the frame's center since the press,
12
+ * clockwise; `snap` is whether the rotation should snap (Shift).
13
+ */
14
+ onRotate: (degrees: number, snap: boolean) => void;
15
+ /** The pointer was released. */
16
+ onEnd: () => void;
17
+ /** The gesture was lost (`pointercancel`). */
18
+ onCancel: () => void;
19
+ }
20
+ /**
21
+ * The handle that turns a selected frame, drawn in its adornment box above the top edge so it
22
+ * turns with the frame. Its size and offset are set by the movable layer's stylesheet.
23
+ *
24
+ * @remarks
25
+ * The angle is measured about the center of the adornment box, which is the frame's center at any
26
+ * rotation. The pointer is captured for the gesture, so it keeps rotating outside the handle.
27
+ */
28
+ export declare const RotateHandle: React.FC<RotateHandleProps>;
29
+ //# sourceMappingURL=RotateHandle.d.ts.map
@@ -0,0 +1,29 @@
1
+ import { Bounds } from '@sheetxl/utils';
2
+ import { IMovable } from '@sheetxl/sdk';
3
+ import { IGridPane } from '@sheetxl/grid-react';
4
+ /** Where a movable's frame sits in a pane: its pane box and its turn about the box's center. */
5
+ export interface FramePlacement {
6
+ left: number;
7
+ top: number;
8
+ width: number;
9
+ height: number;
10
+ /** Degrees, clockwise. */
11
+ rotation: number;
12
+ }
13
+ /**
14
+ * An in-flight gesture's view of one movable, drawn in place of the model until the gesture
15
+ * commits. What it leaves out is read from the model.
16
+ */
17
+ export interface MovablePreview {
18
+ /** The unrotated frame, absolute. */
19
+ bounds?: Bounds;
20
+ /** Degrees, clockwise. */
21
+ rotation?: number;
22
+ }
23
+ /**
24
+ * The placement of a movable's frame in `pane`, from the drag preview when there is one, else the
25
+ * model. The frame and everything drawn in register with it (adornments) use this, so they cannot
26
+ * disagree.
27
+ */
28
+ export declare const framePlacement: (movable: IMovable, pane: IGridPane, preview?: MovablePreview | null) => FramePlacement;
29
+ //# sourceMappingURL=framePlacement.d.ts.map
@@ -0,0 +1,51 @@
1
+ import { Bounds } from '@sheetxl/utils';
2
+ /**
3
+ * Which handle a resize drags, per axis: `-1` the left or top edge, `1` the right or bottom edge,
4
+ * `0` neither (an edge handle on the other axis).
5
+ */
6
+ export type ResizeDirection = readonly [number, number];
7
+ /**
8
+ * The frame after dragging a resize handle, with the opposite edge or corner held still on screen.
9
+ *
10
+ * @param start - The unrotated frame when the drag started.
11
+ * @param direction - The handle being dragged.
12
+ * @param dist - How much the frame has grown along its own (unrotated) axes, positive when larger,
13
+ * whichever side is dragged. An axis the handle does not drag is ignored.
14
+ * @param rotation - Degrees clockwise the frame is turned about its center.
15
+ * @param keepAspect - Keep `start`'s aspect ratio. Only a corner drag keeps it.
16
+ * @returns The unrotated frame, turned by `rotation` about its own center like `start`.
17
+ *
18
+ * @remarks
19
+ * A size is never negative: a frame dragged past its opposite edge stops there.
20
+ */
21
+ export declare const resizeFrame: (start: Bounds, direction: ResizeDirection, dist: readonly [number, number], rotation: number, keepAspect: boolean) => Bounds;
22
+ /**
23
+ * How much a resize handle's drag grows its frame, the `dist` that `resizeFrame` takes.
24
+ *
25
+ * @param direction - The handle being dragged.
26
+ * @param delta - How far the pointer is from the press, on screen.
27
+ * @param rotation - Degrees clockwise the frame is turned about its center.
28
+ * @returns The growth along the frame's own axes, positive when larger.
29
+ */
30
+ export declare const resizeGrowth: (direction: ResizeDirection, delta: readonly [number, number], rotation: number) => [number, number];
31
+ /** The step a rotation snaps to while Shift is held, in degrees. */
32
+ export declare const ROTATION_SNAP = 15;
33
+ /**
34
+ * A rotation in `[0, 360)`, optionally snapped to the nearest multiple of `snap` degrees.
35
+ */
36
+ export declare const normalizeRotation: (degrees: number, snap?: number) => number;
37
+ /**
38
+ * The angle, in degrees clockwise on screen, a pointer has swept about `center` since `press`,
39
+ * in `(-180, 180]`.
40
+ */
41
+ export declare const sweptAngle: (center: {
42
+ x: number;
43
+ y: number;
44
+ }, press: {
45
+ x: number;
46
+ y: number;
47
+ }, pointer: {
48
+ x: number;
49
+ y: number;
50
+ }) => number;
51
+ //# sourceMappingURL=geometry.d.ts.map
@@ -3,4 +3,5 @@ export * from './MovableLayer';
3
3
  export * from './MovableEdit';
4
4
  export * from './EmptyFrame';
5
5
  export * from './TextBox';
6
+ export * from './MovableRenderers';
6
7
  //# sourceMappingURL=index.d.ts.map
@@ -1,4 +1,5 @@
1
1
  import { default as React } from 'react';
2
+ import { IShape } from '@sheetxl/sdk';
2
3
  import { MovableElementProps } from '../movable';
3
4
  export interface ShapeEditorAttributes {
4
5
  isShapeEditor: () => true;
@@ -6,11 +7,24 @@ export interface ShapeEditorAttributes {
6
7
  export interface IShapeEditorElement extends HTMLDivElement, ShapeEditorAttributes {
7
8
  }
8
9
  export interface ShapeEditorProps extends MovableElementProps {
9
- shape: any;
10
+ shape: IShape;
11
+ /**
12
+ * Draws the geometry's text rectangle and connection sites over the shape.
13
+ * @defaultValue false
14
+ */
15
+ debugGeometry?: boolean;
10
16
  ref?: React.Ref<IShapeEditorElement>;
11
17
  }
12
18
  /**
13
- * Placeholder for chart editors.
19
+ * A shape in the sheet: its geometry as one SVG that fills the movable's frame, its text at the
20
+ * geometry's text rectangle, and its adjustment handles while it is selected.
21
+ *
22
+ * @remarks
23
+ * The frame owns position, size and zoom; the drawing is a `viewBox` of the movable's unzoomed
24
+ * bounds stretched to fill it, so a resize re-evaluates the geometry (adjust values are ratios,
25
+ * and the shape stretches as it does in Excel) and zoom thickens lines as Excel's does. A group
26
+ * draws its members in one SVG, each in its own style. A custom geometry is evaluated like a
27
+ * preset, from the definition the file states.
14
28
  */
15
29
  export declare const ShapeEditor: React.NamedExoticComponent<Omit<ShapeEditorProps, "ref"> & React.RefAttributes<IShapeEditorElement>>;
16
30
  //# sourceMappingURL=ShapeEditor.d.ts.map
@@ -0,0 +1,16 @@
1
+ /**
2
+ * One section of the Insert > Shapes gallery: its heading and its presets in display order, each
3
+ * with the message key of its name.
4
+ */
5
+ export interface ShapeGalleryCategory {
6
+ key: string;
7
+ label: string;
8
+ presets: readonly (readonly [preset: string, label: string])[];
9
+ }
10
+ /**
11
+ * The Insert > Shapes gallery: Excel's sections, order and names. A curated subset of the presets
12
+ * (Excel's gallery leaves out some, such as `gear6` and the action buttons); every preset still has
13
+ * an icon in the `shape` pack.
14
+ */
15
+ export declare const ShapeGallery: readonly ShapeGalleryCategory[];
16
+ //# sourceMappingURL=ShapeGallery.d.ts.map
@@ -0,0 +1,28 @@
1
+ import { default as React } from 'react';
2
+ import { IGeometry } from '@sheetxl/sdk';
3
+ export type HandleDragPhase = 'move' | 'end' | 'cancel';
4
+ export interface ShapeHandlesProps {
5
+ /** The handles' positions, in the shape's frame. */
6
+ handles: readonly IGeometry.IHandle[];
7
+ /** The shape's frame: the overlay's `viewBox`, so a handle lands exactly on the geometry. */
8
+ width: number;
9
+ height: number;
10
+ /** Device px per shape px, for a handle that stays the same size on screen at any zoom. */
11
+ zoom: number;
12
+ /**
13
+ * A handle being dragged: its index and where the pointer is, in the shape's frame. `'move'`
14
+ * while the pointer moves, `'end'` when it is released there, `'cancel'` when the drag is lost.
15
+ */
16
+ onDrag: (index: number, x: number, y: number, phase: HandleDragPhase) => void;
17
+ }
18
+ /**
19
+ * The adjustment handles of a selected shape, drawn over its geometry in the same `viewBox`.
20
+ *
21
+ * @remarks
22
+ * Pointer positions are mapped through the overlay's own screen matrix, which folds in the
23
+ * frame's size, the view's zoom and any rotation, so a drag reads in shape-local px however the
24
+ * frame is placed. The overlay itself is pointer-transparent; only the dots take presses, which
25
+ * do not bubble to the frame as a move.
26
+ */
27
+ export declare const ShapeHandles: React.FC<ShapeHandlesProps>;
28
+ //# sourceMappingURL=ShapeHandles.d.ts.map
@@ -0,0 +1,24 @@
1
+ import { default as React } from 'react';
2
+ import { IGeometry, IResource, IStyleCollection } from '@sheetxl/sdk';
3
+ import { ResolvedShapeStyle } from './shapeStyle';
4
+ /** `pointer-events` for a drawn part: hit where painted, or not at all while the frame is hidden. */
5
+ export type PartHit = 'visiblePainted' | 'none';
6
+ /** A URL an `<image>` can load a resource from: its external URI, or its bytes as a data URL. */
7
+ export declare const resourceUrl: (resource: IResource) => Promise<string>;
8
+ export interface ShapePathsProps {
9
+ geometry: IGeometry;
10
+ /** The shape's own style, for paths that belong to no group member. */
11
+ style: ResolvedShapeStyle;
12
+ /** What a group member's style and a picture's image resolve against. */
13
+ styles: IStyleCollection | null;
14
+ /** The images the shape's JSON names, by resource id (`IShape.getResource`). */
15
+ getResource?: (resourceId: number) => IResource | null;
16
+ zoom: number;
17
+ hit: PartHit;
18
+ }
19
+ /**
20
+ * Everything a geometry draws: a shape's paths in its style, or a group's members, each placed
21
+ * and in its own style.
22
+ */
23
+ export declare const ShapePaths: React.FC<ShapePathsProps>;
24
+ //# sourceMappingURL=ShapeSVG.d.ts.map
@@ -0,0 +1,17 @@
1
+ import { default as React } from 'react';
2
+ import { ITextFrame, IStyleCollection } from '@sheetxl/sdk';
3
+ export interface ShapeTextProps {
4
+ /** The text written on the shape, by paragraph, with how its body sits in the shape. */
5
+ text: ITextFrame.JSON;
6
+ /** Resolves colors through the workbook's theme; `null` reads them without one. */
7
+ styles: IStyleCollection | null;
8
+ /** The color the shape's theme style gives its text, used where a run states none. */
9
+ color?: string | null;
10
+ }
11
+ /**
12
+ * The text written on a shape: its paragraphs laid out as the body says — anchored, inset,
13
+ * aligned, spaced — with what formatting its runs carry. Text layout stays in the DOM; nothing
14
+ * here is measured.
15
+ */
16
+ export declare const ShapeText: React.FC<ShapeTextProps>;
17
+ //# sourceMappingURL=ShapeText.d.ts.map
@@ -0,0 +1,16 @@
1
+ /**
2
+ * The icon pack holding one 24x24 icon per preset shape, keyed by the preset name
3
+ * (`IGeometry.Preset`). Separate from the base pack and loaded only when one of its icons is asked
4
+ * for. The icons are generated from the geometry engine (`pnpm gen:shapes:icons` in the SDK).
5
+ */
6
+ export declare const SHAPE_ICON_PACK = "shape";
7
+ /**
8
+ * The icon key of a preset shape, for `DynamicIcon` or any command or menu that takes an icon key.
9
+ *
10
+ * @example
11
+ * ```tsx
12
+ * <DynamicIcon iconKey={shapeIconKey(IGeometry.Preset.RoundRect)} />
13
+ * ```
14
+ */
15
+ export declare const shapeIconKey: (preset: string) => string;
16
+ //# sourceMappingURL=ShapeIcons.d.ts.map
@@ -0,0 +1,4 @@
1
+ import { IconPackInput } from '@sheetxl/utils-react';
2
+ declare const pack: IconPackInput;
3
+ export default pack;
4
+ //# sourceMappingURL=_ShapeIconPack.d.ts.map
@@ -1,2 +1,5 @@
1
1
  export * from './ShapeEditor';
2
+ export * from './ShapeGallery';
3
+ export * from './ShapeText';
4
+ export * from './icons/ShapeIcons';
2
5
  //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,6 @@
1
+ /**
2
+ * A stroke width in shape px snapped to whole device pixels, never thinner than one: a 1 pt line
3
+ * is 1 px at 100% and 3 px at 200%, as Excel draws it. Zero stays zero (no line).
4
+ */
5
+ export declare const snapStrokeWidth: (width: number, zoom: number) => number;
6
+ //# sourceMappingURL=shapeFrame.d.ts.map