@gridsheet/preact-core 3.0.0-rc.7 → 3.0.0-rc.8

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 (115) hide show
  1. package/dist/hooks-hS8l-fYa.mjs +1440 -0
  2. package/dist/hooks-hS8l-fYa.mjs.map +1 -0
  3. package/dist/index.d.ts +3 -34
  4. package/dist/index.js +358 -9246
  5. package/dist/index.js.map +1 -1
  6. package/dist/{components → react-core/src/components}/FunctionGuide.d.ts +2 -2
  7. package/dist/{components → react-core/src/components}/useAutocomplete.d.ts +3 -3
  8. package/dist/react-core/src/index.d.ts +17 -0
  9. package/dist/{lib → react-core/src/lib}/clipboard.d.ts +1 -1
  10. package/dist/{components → react-core/src/lib}/hooks.d.ts +2 -0
  11. package/dist/{lib → react-core/src/lib}/menu.d.ts +1 -1
  12. package/dist/react-core/src/lib/style.d.ts +12 -0
  13. package/dist/react-core/src/policy/checkbox.d.ts +3 -0
  14. package/dist/react-core/src/spellbook.d.ts +6 -0
  15. package/dist/{store → react-core/src/store}/actions.d.ts +1 -1
  16. package/dist/{store/dispatchers.d.ts → react-core/src/store/applyers.d.ts} +1 -1
  17. package/dist/{store → react-core/src/store}/helpers.d.ts +1 -2
  18. package/dist/react-core/src/types.d.ts +104 -0
  19. package/dist/spellbook.d.ts +2 -0
  20. package/dist/spellbook.js +10 -0
  21. package/dist/spellbook.js.map +1 -0
  22. package/package.json +18 -2
  23. package/dist/constants.d.ts +0 -21
  24. package/dist/formula/evaluator.d.ts +0 -134
  25. package/dist/formula/formula-error.d.ts +0 -10
  26. package/dist/formula/functions/__async.d.ts +0 -67
  27. package/dist/formula/functions/__base.d.ts +0 -112
  28. package/dist/formula/functions/__utils.d.ts +0 -23
  29. package/dist/formula/functions/abs.d.ts +0 -9
  30. package/dist/formula/functions/add.d.ts +0 -10
  31. package/dist/formula/functions/and.d.ts +0 -9
  32. package/dist/formula/functions/arrayformula.d.ts +0 -12
  33. package/dist/formula/functions/average.d.ts +0 -9
  34. package/dist/formula/functions/concat.d.ts +0 -9
  35. package/dist/formula/functions/count.d.ts +0 -9
  36. package/dist/formula/functions/counta.d.ts +0 -9
  37. package/dist/formula/functions/divide.d.ts +0 -10
  38. package/dist/formula/functions/eq.d.ts +0 -9
  39. package/dist/formula/functions/gt.d.ts +0 -9
  40. package/dist/formula/functions/gte.d.ts +0 -9
  41. package/dist/formula/functions/if.d.ts +0 -9
  42. package/dist/formula/functions/iferror.d.ts +0 -10
  43. package/dist/formula/functions/len.d.ts +0 -9
  44. package/dist/formula/functions/lt.d.ts +0 -9
  45. package/dist/formula/functions/lte.d.ts +0 -9
  46. package/dist/formula/functions/max.d.ts +0 -9
  47. package/dist/formula/functions/min.d.ts +0 -9
  48. package/dist/formula/functions/minus.d.ts +0 -10
  49. package/dist/formula/functions/multiply.d.ts +0 -9
  50. package/dist/formula/functions/ne.d.ts +0 -9
  51. package/dist/formula/functions/not.d.ts +0 -9
  52. package/dist/formula/functions/now.d.ts +0 -9
  53. package/dist/formula/functions/or.d.ts +0 -9
  54. package/dist/formula/functions/power.d.ts +0 -9
  55. package/dist/formula/functions/sum.d.ts +0 -9
  56. package/dist/formula/functions/uminus.d.ts +0 -9
  57. package/dist/formula/mapping.d.ts +0 -11
  58. package/dist/formula/solver.d.ts +0 -39
  59. package/dist/lib/autofill.d.ts +0 -17
  60. package/dist/lib/book.d.ts +0 -127
  61. package/dist/lib/cell.d.ts +0 -17
  62. package/dist/lib/coords.d.ts +0 -22
  63. package/dist/lib/date.d.ts +0 -2
  64. package/dist/lib/dom.d.ts +0 -7
  65. package/dist/lib/filter.d.ts +0 -7
  66. package/dist/lib/input.d.ts +0 -24
  67. package/dist/lib/label.d.ts +0 -4
  68. package/dist/lib/operation.d.ts +0 -31
  69. package/dist/lib/palette.d.ts +0 -2
  70. package/dist/lib/popup.d.ts +0 -24
  71. package/dist/lib/reference.d.ts +0 -19
  72. package/dist/lib/sheet.d.ts +0 -508
  73. package/dist/lib/sheet_utils.d.ts +0 -55
  74. package/dist/lib/spatial.d.ts +0 -79
  75. package/dist/lib/time.d.ts +0 -29
  76. package/dist/lib/virtualization.d.ts +0 -22
  77. package/dist/policy/checkbox.d.ts +0 -3
  78. package/dist/policy/core.d.ts +0 -164
  79. package/dist/policy/thousand_separator.d.ts +0 -4
  80. package/dist/sentinels.d.ts +0 -40
  81. package/dist/styles/embedder.d.ts +0 -2
  82. package/dist/styles/minified.d.ts +0 -3
  83. package/dist/styles/utils.d.ts +0 -52
  84. package/dist/types.d.ts +0 -369
  85. package/dist/utils.d.ts +0 -2
  86. /package/dist/{components → react-core/src/components}/Cell.d.ts +0 -0
  87. /package/dist/{components → react-core/src/components}/CellStateOverlay.d.ts +0 -0
  88. /package/dist/{components → react-core/src/components}/ColumnMenu.d.ts +0 -0
  89. /package/dist/{components → react-core/src/components}/ColumnMenuFilterSection.d.ts +0 -0
  90. /package/dist/{components → react-core/src/components}/ColumnMenuLabelSection.d.ts +0 -0
  91. /package/dist/{components → react-core/src/components}/ColumnMenuSortSection.d.ts +0 -0
  92. /package/dist/{components → react-core/src/components}/ContextMenu.d.ts +0 -0
  93. /package/dist/{components → react-core/src/components}/Editor.d.ts +0 -0
  94. /package/dist/{components → react-core/src/components}/EditorOptions.d.ts +0 -0
  95. /package/dist/{components → react-core/src/components}/Emitter.d.ts +0 -0
  96. /package/dist/{components → react-core/src/components}/Fixed.d.ts +0 -0
  97. /package/dist/{components → react-core/src/components}/FormulaBar.d.ts +0 -0
  98. /package/dist/{components → react-core/src/components}/GridSheet.d.ts +0 -0
  99. /package/dist/{components → react-core/src/components}/HeaderCellLeft.d.ts +0 -0
  100. /package/dist/{components → react-core/src/components}/HeaderCellTop.d.ts +0 -0
  101. /package/dist/{components → react-core/src/components}/MenuItem.d.ts +0 -0
  102. /package/dist/{components → react-core/src/components}/PluginBase.d.ts +0 -0
  103. /package/dist/{components → react-core/src/components}/Resizer.d.ts +0 -0
  104. /package/dist/{components → react-core/src/components}/RowMenu.d.ts +0 -0
  105. /package/dist/{components → react-core/src/components}/ScrollHandle.d.ts +0 -0
  106. /package/dist/{components → react-core/src/components}/SearchBar.d.ts +0 -0
  107. /package/dist/{components → react-core/src/components}/StoreObserver.d.ts +0 -0
  108. /package/dist/{components → react-core/src/components}/Tabular.d.ts +0 -0
  109. /package/dist/{components → react-core/src/components}/svg/AddIcon.d.ts +0 -0
  110. /package/dist/{components → react-core/src/components}/svg/Base.d.ts +0 -0
  111. /package/dist/{components → react-core/src/components}/svg/CloseIcon.d.ts +0 -0
  112. /package/dist/{components → react-core/src/components}/svg/SearchIcon.d.ts +0 -0
  113. /package/dist/{lib → react-core/src/lib}/events.d.ts +0 -0
  114. /package/dist/{lib → react-core/src/lib}/paste.d.ts +0 -0
  115. /package/dist/{store → react-core/src/store}/index.d.ts +0 -0
package/dist/types.d.ts DELETED
@@ -1,369 +0,0 @@
1
- import { UserSheet, Sheet, SheetLimits } from './lib/sheet';
2
- import { RefObject, CSSProperties, KeyboardEvent } from 'react';
3
- import { BookType, TransmitProps } from './lib/book';
4
- import { PolicyType } from './policy/core';
5
- import { Dispatcher } from './store';
6
- import { ContextMenuItemDescriptor, RowMenuItemDescriptor, ColMenuItemDescriptor } from './lib/menu';
7
- /**
8
- * Controls how formula values are resolved when reading a cell.
9
- *
10
- * - `'RESOLVED'` (default) — Fully evaluates formulas to a scalar value.
11
- * Range references (e.g. `=C1:F1`) are unwrapped to the top-left scalar.
12
- * - `'EVALUATED'` — Evaluates formulas one level deep but keeps range/Sheet
13
- * results intact. Use this when you need the `Sheet` object a range formula
14
- * produces (e.g. in `renderSheet` policy hooks).
15
- * - `'RAW'` — Returns the formula string with cell addresses resolved to their
16
- * display form; does not evaluate.
17
- * - `'SYSTEM'` — Returns the raw stored value with no evaluation or transformation.
18
- */
19
- export type Resolution = 'RESOLVED' | 'EVALUATED' | 'RAW' | 'SYSTEM';
20
- export type Y = number;
21
- export type X = number;
22
- export type Height = number;
23
- export type Width = number;
24
- export type ShapeType = {
25
- rows: number;
26
- cols: number;
27
- };
28
- export type RectType = {
29
- y: Y;
30
- x: X;
31
- height: Height;
32
- width: Width;
33
- };
34
- export type MatrixType<T = any> = T[][];
35
- export type Policies = {
36
- [s: string]: PolicyType;
37
- };
38
- export type CursorStateType = {
39
- pointing: PointType;
40
- selectingFrom: PointType;
41
- selectingTo: PointType;
42
- };
43
- export type FeedbackType = (args: {
44
- sheet: UserSheet;
45
- points?: CursorStateType;
46
- }) => void;
47
- export type ModeType = 'light' | 'dark';
48
- export type HeadersType = 'both' | 'vertical' | 'horizontal' | 'none';
49
- export type AsyncCache = {
50
- /** Cached result value from the async computation. */
51
- value: any;
52
- /** Absolute timestamp (ms since epoch) at which the cache expires. undefined means cache never expires. */
53
- expireTime?: number;
54
- };
55
- export type System = {
56
- id?: string;
57
- sheetId?: number;
58
- changedTime?: number;
59
- /** Cumulative top offset (px) from sheet origin. Set on row-header cells (x=0). */
60
- offsetTop?: number;
61
- /** Cumulative left offset (px) from sheet origin. Set on col-header cells (y=0). */
62
- offsetLeft?: number;
63
- tmpAsyncCaches?: Record<string, AsyncCache>;
64
- /** Address of the origin cell whose array formula spilled its value into this cell. */
65
- spilledFrom?: Address;
66
- /** IDs of cells whose formula depends on this cell. */
67
- dependents?: Set<Id>;
68
- /** IDs of cells that this cell's formula depends on. */
69
- dependencies?: Set<Id>;
70
- };
71
- export type FilterConditionMethod = 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte' | 'blank' | 'nonblank' | 'includes' | 'excludes';
72
- export type FilterCondition = {
73
- method: FilterConditionMethod;
74
- value: string[];
75
- };
76
- export type FilterConfig = {
77
- mode?: 'and' | 'or';
78
- conditions: FilterCondition[];
79
- };
80
- export type CellType<T = any, Custom = any> = {
81
- value?: T;
82
- style?: CSSProperties;
83
- justifyContent?: CSSProperties['justifyContent'];
84
- alignItems?: CSSProperties['alignItems'];
85
- label?: string;
86
- width?: Width;
87
- height?: Height;
88
- policy?: string;
89
- custom?: Custom;
90
- formulaEnabled?: boolean;
91
- prevention?: OperationType;
92
- /** Cached result from an async formula. Stored directly on the cell for serializability. */
93
- asyncCaches?: Record<string, AsyncCache>;
94
- /** Filter configuration. Set on col-header cells (y=0). null means explicitly absent (used in undo diffBefore to survive JSON serialization). */
95
- filter?: FilterConfig | null;
96
- /** Whether this row is hidden by a filter. Set on row-header cells (x=0). */
97
- filtered?: boolean;
98
- /** If true, this row is excluded from sort and stays at its original position. Set on row-header cells (x=0). */
99
- sortFixed?: boolean;
100
- /** If true, this row is always visible regardless of active filters. Set on row-header cells (x=0). */
101
- filterFixed?: boolean;
102
- };
103
- export type RawCellType = {
104
- value?: string;
105
- style?: CSSProperties;
106
- skip?: boolean;
107
- };
108
- export type CellPatchType<T = any> = Partial<CellType> & {
109
- value: T;
110
- };
111
- export type CellFilter = (cell: CellType) => boolean;
112
- export type CellsByAddressType = {
113
- [address: string]: CellType;
114
- };
115
- export type CellsByIdType = {
116
- [id: Id]: CellType | undefined;
117
- };
118
- export type SystemsByIdType = {
119
- [id: Id]: System;
120
- };
121
- export type OptionsType = {
122
- sheetHeight?: number;
123
- sheetWidth?: number;
124
- sheetResize?: CSSProperties['resize'];
125
- editingOnEnter?: boolean;
126
- showFormulaBar?: boolean;
127
- limits?: SheetLimits;
128
- mode?: ModeType;
129
- contextMenu?: ContextMenuItemDescriptor[];
130
- rowMenu?: RowMenuItemDescriptor[];
131
- colMenu?: ColMenuItemDescriptor[];
132
- };
133
- export type RangeType = {
134
- start: number;
135
- end: number;
136
- };
137
- export type PointType = {
138
- y: Y;
139
- x: X;
140
- };
141
- export type ExtraPointType = {
142
- y: Y;
143
- x: X;
144
- absY?: boolean;
145
- absX?: boolean;
146
- sheet?: Sheet;
147
- };
148
- export type PositionType = {
149
- y: Y;
150
- x: X;
151
- };
152
- export type ZoneType = {
153
- startY: Y;
154
- startX: X;
155
- endY: Y;
156
- endX: X;
157
- };
158
- export type AreaType = {
159
- top: Y;
160
- left: X;
161
- bottom: Y;
162
- right: X;
163
- };
164
- export type WriterType = (value: string) => void;
165
- export type StoreType = {
166
- sheetId: number;
167
- sheetReactive: RefObject<Sheet>;
168
- rootRef: RefObject<HTMLDivElement>;
169
- flashRef: RefObject<HTMLDivElement>;
170
- mainRef: RefObject<HTMLDivElement>;
171
- editorRef: RefObject<HTMLTextAreaElement>;
172
- largeEditorRef: RefObject<HTMLTextAreaElement>;
173
- tabularRef: RefObject<HTMLDivElement>;
174
- searchInputRef: RefObject<HTMLTextAreaElement>;
175
- entering: boolean;
176
- choosing: PointType;
177
- inputting: string;
178
- selectingZone: ZoneType;
179
- autofillDraggingTo: PointType | null;
180
- leftHeaderSelecting: boolean;
181
- topHeaderSelecting: boolean;
182
- editingAddress: string;
183
- editorRect: RectType;
184
- dragging: boolean;
185
- sheetHeight: number;
186
- sheetWidth: number;
187
- mode: ModeType;
188
- searchQuery?: string;
189
- searchCaseSensitive: boolean;
190
- searchRegex: boolean;
191
- searchRange?: ZoneType;
192
- matchingCells: string[];
193
- matchingCellIndex: number;
194
- editingOnEnter: boolean;
195
- contextMenuPosition: PositionType;
196
- contextMenu: ContextMenuItemDescriptor[];
197
- rowMenu: RowMenuItemDescriptor[];
198
- colMenu: ColMenuItemDescriptor[];
199
- resizingPositionY: [Y, Y, Y];
200
- resizingPositionX: [X, X, X];
201
- columnMenuState: {
202
- x: number;
203
- position: PositionType;
204
- } | null;
205
- rowMenuState: {
206
- y: number;
207
- position: PositionType;
208
- } | null;
209
- editorHovering: boolean;
210
- };
211
- export type Manager<T> = {
212
- instance: T;
213
- sync: T extends StoreType ? Dispatcher : (instance: T) => void;
214
- };
215
- export type SheetHandle = {
216
- sheet: UserSheet;
217
- apply: (sheet: UserSheet) => void;
218
- };
219
- export type StoreHandle = {
220
- store: StoreType;
221
- apply: (store: StoreType) => void;
222
- dispatch: Dispatcher;
223
- };
224
- export type Props = {
225
- initialCells: CellsByAddressType;
226
- sheetName?: string;
227
- book?: BookType;
228
- sheetRef?: RefObject<SheetHandle | null>;
229
- storeRef?: RefObject<StoreHandle | null>;
230
- options?: OptionsType;
231
- className?: string;
232
- style?: CSSProperties;
233
- };
234
- export type Id = string;
235
- export type Ids = Id[];
236
- export type IdMatrix = Ids[];
237
- export type Address = string;
238
- export type MatricesByAddress<T> = {
239
- [origin: Address]: MatrixType<T>;
240
- };
241
- export type StorePatchType = {
242
- sheetId: number;
243
- choosing?: PointType;
244
- selectingZone?: ZoneType | undefined;
245
- sheetHeight?: number;
246
- sheetWidth?: number;
247
- transmit?: TransmitProps;
248
- };
249
- export type HistoryUpdateType = {
250
- operation: 'UPDATE';
251
- srcSheetId: number;
252
- dstSheetId: number;
253
- applyed: boolean;
254
- undoReflection?: StorePatchType;
255
- redoReflection?: StorePatchType;
256
- diffBefore: CellsByIdType;
257
- diffAfter: CellsByIdType;
258
- partial: boolean;
259
- };
260
- export type MoveRelation = {
261
- before?: string;
262
- after?: string;
263
- src: Address;
264
- dst?: Address;
265
- new?: Id;
266
- lost?: Id;
267
- };
268
- export type MoveRelations = MoveRelation[];
269
- export type HistoryMoveType = {
270
- operation: 'MOVE';
271
- srcSheetId: number;
272
- dstSheetId: number;
273
- applyed: boolean;
274
- undoReflection?: StorePatchType;
275
- redoReflection?: StorePatchType;
276
- diffBefore: CellsByIdType;
277
- diffAfter: CellsByIdType;
278
- moveRelations: MoveRelations;
279
- };
280
- export type HistoryInsertRowsType = {
281
- operation: 'INSERT_ROWS';
282
- srcSheetId: number;
283
- dstSheetId: number;
284
- applyed: boolean;
285
- undoReflection?: StorePatchType;
286
- redoReflection?: StorePatchType;
287
- y: number;
288
- numRows: number;
289
- idMatrix: IdMatrix;
290
- diffBefore?: CellsByIdType;
291
- diffAfter?: CellsByIdType;
292
- partial?: true;
293
- };
294
- export type HistoryRemoveRowsType = {
295
- operation: 'REMOVE_ROWS';
296
- srcSheetId: number;
297
- dstSheetId: number;
298
- applyed: boolean;
299
- undoReflection?: StorePatchType;
300
- redoReflection?: StorePatchType;
301
- ys: number[];
302
- diffBefore?: CellsByIdType;
303
- deleted: IdMatrix;
304
- };
305
- export type HistoryInsertColsType = {
306
- operation: 'INSERT_COLS';
307
- srcSheetId: number;
308
- dstSheetId: number;
309
- applyed: boolean;
310
- undoReflection?: StorePatchType;
311
- redoReflection?: StorePatchType;
312
- x: number;
313
- numCols: number;
314
- idMatrix: IdMatrix;
315
- diffBefore?: CellsByIdType;
316
- diffAfter?: CellsByIdType;
317
- partial?: true;
318
- };
319
- export type HistoryRemoveColsType = {
320
- operation: 'REMOVE_COLS';
321
- srcSheetId: number;
322
- dstSheetId: number;
323
- applyed: boolean;
324
- undoReflection?: StorePatchType;
325
- redoReflection?: StorePatchType;
326
- xs: number[];
327
- diffBefore?: CellsByIdType;
328
- deleted: IdMatrix;
329
- };
330
- export type HistorySortRowsType = {
331
- operation: 'SORT_ROWS';
332
- srcSheetId: number;
333
- dstSheetId: number;
334
- applyed: boolean;
335
- undoReflection?: StorePatchType;
336
- redoReflection?: StorePatchType;
337
- /** Mapping from original row index to new row index after sort */
338
- sortedRowMapping: {
339
- [beforeY: number]: number;
340
- };
341
- };
342
- export type HistoryType = HistoryUpdateType | HistoryMoveType | HistoryInsertRowsType | HistoryRemoveRowsType | HistoryInsertColsType | HistoryRemoveColsType | HistorySortRowsType;
343
- export type Virtualization = {
344
- xs: number[];
345
- ys: number[];
346
- adjuster: AreaType;
347
- };
348
- export type OperatorType = 'USER' | 'SYSTEM';
349
- export type OperationType = number;
350
- export type StoreDispatchType = {
351
- store: StoreType;
352
- dispatch: Dispatcher;
353
- };
354
- export type ContextsBySheetId = {
355
- [sheetId: string]: StoreDispatchType;
356
- };
357
- export type SheetIdsByName = {
358
- [sheetName: string]: number;
359
- };
360
- export type RefPaletteType = {
361
- [address: string]: number;
362
- };
363
- export type EditorEvent = KeyboardEvent<HTMLTextAreaElement>;
364
- export type EditorEventWithNativeEvent = EditorEvent & {
365
- nativeEvent: KeyboardEvent & {
366
- isComposing: boolean;
367
- };
368
- };
369
- //# sourceMappingURL=types.d.ts.map
package/dist/utils.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export declare const setDefault: <K = PropertyKey, D = any>(target: any, key: K, defaultValue: D) => D;
2
- //# sourceMappingURL=utils.d.ts.map
File without changes
File without changes
File without changes