@gridsheet/preact-core 3.3.0 → 3.4.1

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.
@@ -66,9 +66,22 @@ export type MenuComponentItem<Args extends unknown[] = []> = {
66
66
  componentId: string;
67
67
  visible?: (ctx: MenuContext, ...args: Args) => boolean;
68
68
  };
69
- export type ContextMenuItemDescriptor = MenuDividerItem | MenuItemBase | MenuComponentItem;
70
- export type RowMenuItemDescriptor = MenuDividerItem | MenuItemBase<[y: number]> | MenuComponentItem<[y: number]>;
71
- export type ColMenuItemDescriptor = MenuDividerItem | MenuItemBase<[x: number]> | MenuComponentItem<[x: number]>;
69
+ /**
70
+ * A menu entry that opens a nested flyout of child items on hover. `children` uses the same
71
+ * descriptor shape (items, dividers, or further submenus), so menus can nest arbitrarily —
72
+ * useful when a category (e.g. cell "Format") has more options than fit in one flat list.
73
+ */
74
+ export type MenuSubmenuItem<Args extends unknown[] = []> = {
75
+ type: 'submenu';
76
+ id?: string;
77
+ label: string | ((ctx: MenuContext, ...args: Args) => string);
78
+ visible?: (ctx: MenuContext, ...args: Args) => boolean;
79
+ disabled?: (ctx: MenuContext, ...args: Args) => boolean;
80
+ children: (MenuDividerItem | MenuItemBase<Args> | MenuSubmenuItem<Args>)[];
81
+ };
82
+ export type ContextMenuItemDescriptor = MenuDividerItem | MenuItemBase | MenuComponentItem | MenuSubmenuItem;
83
+ export type RowMenuItemDescriptor = MenuDividerItem | MenuItemBase<[y: number]> | MenuComponentItem<[y: number]> | MenuSubmenuItem<[y: number]>;
84
+ export type ColMenuItemDescriptor = MenuDividerItem | MenuItemBase<[x: number]> | MenuComponentItem<[x: number]> | MenuSubmenuItem<[x: number]>;
72
85
  export declare const defaultContextMenuDescriptors: ContextMenuItemDescriptor[];
73
86
  export declare const defaultRowMenuDescriptors: RowMenuItemDescriptor[];
74
87
  export declare const defaultColMenuDescriptors: ColMenuItemDescriptor[];
package/dist/spellbook.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { allFunctions } from "@gridsheet/functions";
2
- import { aA as useBook, a_ as xn } from "./hooks-DroLjp9H.mjs";
2
+ import { aH as useBook, b7 as vn } from "./hooks-BHtHkTAN.mjs";
3
3
  const useSpellbook = ({ additionalFunctions, ...rest } = {}) => useBook({ ...rest, additionalFunctions: { ...allFunctions, ...additionalFunctions } });
4
- const createSpellbook = ({ additionalFunctions, ...rest } = {}) => xn({ ...rest, additionalFunctions: { ...allFunctions, ...additionalFunctions } });
4
+ const createSpellbook = ({ additionalFunctions, ...rest } = {}) => vn({ ...rest, additionalFunctions: { ...allFunctions, ...additionalFunctions } });
5
5
  export {
6
6
  createSpellbook,
7
7
  useSpellbook
@@ -12,6 +12,9 @@ export declare class CoreAction<T> {
12
12
  private actionId;
13
13
  /** Whether this action mutates sheet data (triggers loading indicator). */
14
14
  mutation: boolean;
15
+ /** Whether this action kicks off a chunked async mutation (fill/paste): its reduce
16
+ * sets `pendingAsyncOp` and GridSheet runs it with a progress bar. Locked while one runs. */
17
+ asyncMutation: boolean;
15
18
  reduce(store: StoreType, payload: T): StoreWithCallback;
16
19
  call(payload: T): {
17
20
  type: number;
@@ -24,6 +27,8 @@ export declare class CoreAction<T> {
24
27
  }
25
28
  /** Returns true if the given action type is a mutation (heavy operation). */
26
29
  export declare const isMutationAction: (type: number) => boolean;
30
+ /** Returns true if the action starts a chunked async mutation (fill/paste). */
31
+ export declare const isAsyncMutationAction: (type: number) => boolean;
27
32
  export declare const setSearchQuery: (payload: string | undefined) => {
28
33
  type: number;
29
34
  value: string | undefined;
@@ -332,6 +337,36 @@ export declare const setStore: (payload: Partial<StoreType>) => {
332
337
  type: number;
333
338
  value: Partial<StoreType>;
334
339
  };
340
+ export declare const selectToDataEdge: (payload: {
341
+ deltaY: number;
342
+ deltaX: number;
343
+ }) => {
344
+ type: number;
345
+ value: {
346
+ deltaY: number;
347
+ deltaX: number;
348
+ };
349
+ };
350
+ export declare const fillDown: (payload: null) => {
351
+ type: number;
352
+ value: null;
353
+ };
354
+ export declare const fillRight: (payload: null) => {
355
+ type: number;
356
+ value: null;
357
+ };
358
+ export declare const commitAsyncOp: (payload: {
359
+ sheet: Sheet;
360
+ selectingZone: ZoneType;
361
+ finalize?: Partial<StoreType>;
362
+ }) => {
363
+ type: number;
364
+ value: {
365
+ sheet: Sheet;
366
+ selectingZone: ZoneType;
367
+ finalize?: Partial<StoreType>;
368
+ };
369
+ };
335
370
  export declare const userActions: {
336
371
  blur: (payload: null) => {
337
372
  type: number;
@@ -539,6 +574,24 @@ export declare const userActions: {
539
574
  filter?: FilterConfig;
540
575
  };
541
576
  };
577
+ selectToDataEdge: (payload: {
578
+ deltaY: number;
579
+ deltaX: number;
580
+ }) => {
581
+ type: number;
582
+ value: {
583
+ deltaY: number;
584
+ deltaX: number;
585
+ };
586
+ };
587
+ fillDown: (payload: null) => {
588
+ type: number;
589
+ value: null;
590
+ };
591
+ fillRight: (payload: null) => {
592
+ type: number;
593
+ value: null;
594
+ };
542
595
  };
543
596
  export {};
544
597
  //# sourceMappingURL=actions.d.ts.map
package/dist/types.d.ts CHANGED
@@ -96,6 +96,14 @@ export type StoreType = {
96
96
  position: PositionType;
97
97
  } | null;
98
98
  editorHovering: boolean;
99
+ pendingAsyncOp: PendingAsyncOp | null;
100
+ };
101
+ export type PendingAsyncOp = {
102
+ run: (onProgress: (ratio: number) => void) => Promise<Sheet>;
103
+ selectingZone: ZoneType;
104
+ label: string;
105
+ finalize?: Partial<StoreType>;
106
+ postCommit?: () => void;
99
107
  };
100
108
  export type Manager<T> = {
101
109
  instance: T;
@@ -116,6 +124,13 @@ export type StoreHandle = {
116
124
  value: any;
117
125
  }>;
118
126
  };
127
+ /** Consumer-driven loading state: show a progress overlay while data isn't ready yet (e.g.
128
+ * the app is fetching/parsing initial cells). `true` = indeterminate spinner; an object =
129
+ * a determinate bar. The consumer decides when loading ends (the grid can't know the source). */
130
+ export type LoadingState = boolean | {
131
+ progress?: number | null;
132
+ label?: string;
133
+ };
119
134
  export type Props = {
120
135
  initialCells: CellsByAddressType;
121
136
  sheetName?: string;
@@ -125,6 +140,7 @@ export type Props = {
125
140
  options?: OptionsType;
126
141
  className?: string;
127
142
  style?: CSSProperties;
143
+ loading?: LoadingState;
128
144
  };
129
145
  export type EditorEvent = KeyboardEvent<HTMLTextAreaElement>;
130
146
  export type EditorEventWithNativeEvent = EditorEvent & {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gridsheet/preact-core",
3
- "version": "3.3.0",
3
+ "version": "3.4.1",
4
4
  "description": "Spreadsheet component for Preact",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -10,7 +10,7 @@
10
10
  "url": "git+https://github.com/walkframe/gridsheet.git"
11
11
  },
12
12
  "dependencies": {
13
- "@gridsheet/web": "3.3.0"
13
+ "@gridsheet/web": "3.4.1"
14
14
  },
15
15
  "exports": {
16
16
  ".": {
@@ -35,8 +35,8 @@
35
35
  "vite": "^6.2.2",
36
36
  "vite-plugin-dts": "^4.5.3",
37
37
  "@preact/preset-vite": "^2.10.1",
38
- "@gridsheet/functions": "3.3.0",
39
- "@gridsheet/react-core": "3.3.0"
38
+ "@gridsheet/react-core": "3.4.1",
39
+ "@gridsheet/functions": "3.4.1"
40
40
  },
41
41
  "bugs": {
42
42
  "url": "https://github.com/walkframe/gridsheet/issues"