@gridsheet/preact-core 2.0.0-rc.0
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.
- package/dist/components/Cell.d.ts +9 -0
- package/dist/components/ContextMenu.d.ts +20 -0
- package/dist/components/Editor.d.ts +10 -0
- package/dist/components/Emitter.d.ts +9 -0
- package/dist/components/Fixed.d.ts +10 -0
- package/dist/components/FormulaBar.d.ts +2 -0
- package/dist/components/GridSheet.d.ts +3 -0
- package/dist/components/HeaderCellLeft.d.ts +7 -0
- package/dist/components/HeaderCellTop.d.ts +7 -0
- package/dist/components/PluginBase.d.ts +21 -0
- package/dist/components/Resizer.d.ts +2 -0
- package/dist/components/ScrollHandle.d.ts +9 -0
- package/dist/components/SearchBar.d.ts +2 -0
- package/dist/components/StoreObserver.d.ts +8 -0
- package/dist/components/Tabular.d.ts +8 -0
- package/dist/components/hooks.d.ts +10 -0
- package/dist/components/svg/AddIcon.d.ts +3 -0
- package/dist/components/svg/Base.d.ts +12 -0
- package/dist/components/svg/CloseIcon.d.ts +3 -0
- package/dist/components/svg/SearchIcon.d.ts +3 -0
- package/dist/constants.d.ts +21 -0
- package/dist/formula/evaluator.d.ts +120 -0
- package/dist/formula/functions/__base.d.ts +26 -0
- package/dist/formula/functions/__utils.d.ts +12 -0
- package/dist/formula/functions/abs.d.ts +12 -0
- package/dist/formula/functions/acos.d.ts +12 -0
- package/dist/formula/functions/add.d.ts +13 -0
- package/dist/formula/functions/and.d.ts +19 -0
- package/dist/formula/functions/asin.d.ts +12 -0
- package/dist/formula/functions/atan.d.ts +12 -0
- package/dist/formula/functions/atan2.d.ts +12 -0
- package/dist/formula/functions/average.d.ts +19 -0
- package/dist/formula/functions/col.d.ts +13 -0
- package/dist/formula/functions/concat.d.ts +12 -0
- package/dist/formula/functions/concatenate.d.ts +19 -0
- package/dist/formula/functions/cos.d.ts +12 -0
- package/dist/formula/functions/count.d.ts +19 -0
- package/dist/formula/functions/counta.d.ts +19 -0
- package/dist/formula/functions/countif.d.ts +13 -0
- package/dist/formula/functions/divide.d.ts +12 -0
- package/dist/formula/functions/eq.d.ts +12 -0
- package/dist/formula/functions/exp.d.ts +12 -0
- package/dist/formula/functions/gt.d.ts +12 -0
- package/dist/formula/functions/gte.d.ts +12 -0
- package/dist/formula/functions/hlookup.d.ts +18 -0
- package/dist/formula/functions/if.d.ts +17 -0
- package/dist/formula/functions/iferror.d.ts +20 -0
- package/dist/formula/functions/len.d.ts +12 -0
- package/dist/formula/functions/lenb.d.ts +12 -0
- package/dist/formula/functions/ln.d.ts +12 -0
- package/dist/formula/functions/log.d.ts +12 -0
- package/dist/formula/functions/log10.d.ts +12 -0
- package/dist/formula/functions/lt.d.ts +12 -0
- package/dist/formula/functions/lte.d.ts +12 -0
- package/dist/formula/functions/max.d.ts +19 -0
- package/dist/formula/functions/min.d.ts +19 -0
- package/dist/formula/functions/minus.d.ts +13 -0
- package/dist/formula/functions/mod.d.ts +12 -0
- package/dist/formula/functions/multiply.d.ts +12 -0
- package/dist/formula/functions/ne.d.ts +12 -0
- package/dist/formula/functions/not.d.ts +12 -0
- package/dist/formula/functions/now.d.ts +9 -0
- package/dist/formula/functions/or.d.ts +19 -0
- package/dist/formula/functions/pi.d.ts +9 -0
- package/dist/formula/functions/power.d.ts +12 -0
- package/dist/formula/functions/product.d.ts +19 -0
- package/dist/formula/functions/radians.d.ts +12 -0
- package/dist/formula/functions/rand.d.ts +9 -0
- package/dist/formula/functions/round.d.ts +17 -0
- package/dist/formula/functions/rounddown.d.ts +17 -0
- package/dist/formula/functions/roundup.d.ts +17 -0
- package/dist/formula/functions/row.d.ts +13 -0
- package/dist/formula/functions/sin.d.ts +12 -0
- package/dist/formula/functions/sqrt.d.ts +12 -0
- package/dist/formula/functions/sum.d.ts +19 -0
- package/dist/formula/functions/sumif.d.ts +18 -0
- package/dist/formula/functions/tan.d.ts +12 -0
- package/dist/formula/functions/uminus.d.ts +12 -0
- package/dist/formula/functions/vlookup.d.ts +18 -0
- package/dist/formula/mapping.d.ts +3 -0
- package/dist/formula/solver.d.ts +16 -0
- package/dist/index.d.ts +60 -0
- package/dist/index.js +7166 -0
- package/dist/lib/autofill.d.ts +17 -0
- package/dist/lib/clipboard.d.ts +3 -0
- package/dist/lib/converters.d.ts +10 -0
- package/dist/lib/events.d.ts +6 -0
- package/dist/lib/hub.d.ts +39 -0
- package/dist/lib/input.d.ts +15 -0
- package/dist/lib/operation.d.ts +27 -0
- package/dist/lib/palette.d.ts +2 -0
- package/dist/lib/paste.d.ts +4 -0
- package/dist/lib/sheet.d.ts +3 -0
- package/dist/lib/structs.d.ts +64 -0
- package/dist/lib/table.d.ts +388 -0
- package/dist/lib/time.d.ts +24 -0
- package/dist/lib/virtualization.d.ts +22 -0
- package/dist/parsers/core.d.ts +36 -0
- package/dist/policy/core.d.ts +47 -0
- package/dist/renderers/checkbox.d.ts +5 -0
- package/dist/renderers/core.d.ts +62 -0
- package/dist/renderers/thousand_separator.d.ts +4 -0
- package/dist/store/actions.d.ts +194 -0
- package/dist/store/dispatchers.d.ts +13 -0
- package/dist/store/helpers.d.ts +31 -0
- package/dist/store/index.d.ts +10 -0
- package/dist/styles/embedder.d.ts +2 -0
- package/dist/styles/minified.d.ts +3 -0
- package/dist/types.d.ts +310 -0
- package/dist/utils.d.ts +2 -0
- package/exports.ts +35 -0
- package/index.ts +3 -0
- package/package.json +28 -0
- package/tsconfig.json +25 -0
- package/vite.config.js +37 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
import { RendererType } from './renderers/core';
|
|
2
|
+
import { ParserType } from './parsers/core';
|
|
3
|
+
import { UserTable, Table } from './lib/table';
|
|
4
|
+
import { FunctionMapping } from './formula/functions/__base';
|
|
5
|
+
import { FC, RefObject, CSSProperties, KeyboardEvent } from 'react';
|
|
6
|
+
import { Hub, HubReactiveType } from './lib/hub';
|
|
7
|
+
import { PolicyType } from './policy/core';
|
|
8
|
+
import { Dispatcher } from './store';
|
|
9
|
+
export type Y = number;
|
|
10
|
+
export type X = number;
|
|
11
|
+
export type Height = number;
|
|
12
|
+
export type Width = number;
|
|
13
|
+
export type ShapeType = {
|
|
14
|
+
height: Height;
|
|
15
|
+
width: Width;
|
|
16
|
+
};
|
|
17
|
+
export type RectType = {
|
|
18
|
+
y: Y;
|
|
19
|
+
x: X;
|
|
20
|
+
height: Height;
|
|
21
|
+
width: Width;
|
|
22
|
+
};
|
|
23
|
+
export type MatrixType<T = any> = T[][];
|
|
24
|
+
export type Labeler = (n: number) => string;
|
|
25
|
+
export type Renderers = {
|
|
26
|
+
[s: string]: RendererType;
|
|
27
|
+
};
|
|
28
|
+
export type Parsers = {
|
|
29
|
+
[s: string]: ParserType;
|
|
30
|
+
};
|
|
31
|
+
export type Labelers = {
|
|
32
|
+
[s: string]: Labeler;
|
|
33
|
+
};
|
|
34
|
+
export type Policies = {
|
|
35
|
+
[s: string]: PolicyType;
|
|
36
|
+
};
|
|
37
|
+
export type TableRef = {
|
|
38
|
+
table: UserTable;
|
|
39
|
+
dispatch: (table: UserTable) => void;
|
|
40
|
+
};
|
|
41
|
+
export type CursorStateType = {
|
|
42
|
+
pointing: PointType;
|
|
43
|
+
selectingFrom: PointType;
|
|
44
|
+
selectingTo: PointType;
|
|
45
|
+
};
|
|
46
|
+
export type FeedbackType = (table: UserTable, points?: CursorStateType) => void;
|
|
47
|
+
export type ModeType = 'light' | 'dark';
|
|
48
|
+
export type HeadersType = 'both' | 'vertical' | 'horizontal' | 'none';
|
|
49
|
+
export type CellType<T = any, Custom = any> = {
|
|
50
|
+
value?: T;
|
|
51
|
+
style?: CSSProperties;
|
|
52
|
+
justifyContent?: CSSProperties['justifyContent'];
|
|
53
|
+
alignItems?: CSSProperties['alignItems'];
|
|
54
|
+
labeler?: string;
|
|
55
|
+
width?: Width;
|
|
56
|
+
height?: Height;
|
|
57
|
+
renderer?: string;
|
|
58
|
+
parser?: string;
|
|
59
|
+
policy?: string;
|
|
60
|
+
custom?: Custom;
|
|
61
|
+
disableFormula?: boolean;
|
|
62
|
+
prevention?: OperationType;
|
|
63
|
+
system?: {
|
|
64
|
+
id: string;
|
|
65
|
+
sheetId: number;
|
|
66
|
+
changedAt: Date;
|
|
67
|
+
dependents: Set<string>;
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
export type RawCellType = {
|
|
71
|
+
value?: string;
|
|
72
|
+
style?: CSSProperties;
|
|
73
|
+
skip?: boolean;
|
|
74
|
+
};
|
|
75
|
+
export type CellPatchType = CellType;
|
|
76
|
+
export type CellFilter = (cell: CellType) => boolean;
|
|
77
|
+
export type CellsByAddressType = {
|
|
78
|
+
[address: string]: CellType;
|
|
79
|
+
};
|
|
80
|
+
export type CellsByIdType = {
|
|
81
|
+
[id: Id]: CellType | undefined;
|
|
82
|
+
};
|
|
83
|
+
export type OptionsType = {
|
|
84
|
+
sheetHeight?: number;
|
|
85
|
+
sheetWidth?: number;
|
|
86
|
+
sheetResize?: CSSProperties['resize'];
|
|
87
|
+
historyLimit?: number;
|
|
88
|
+
headerHeight?: number;
|
|
89
|
+
headerWidth?: number;
|
|
90
|
+
editingOnEnter?: boolean;
|
|
91
|
+
showAddress?: boolean;
|
|
92
|
+
showFormulaBar?: boolean;
|
|
93
|
+
minNumRows?: number;
|
|
94
|
+
maxNumRows?: number;
|
|
95
|
+
minNumCols?: number;
|
|
96
|
+
maxNumCols?: number;
|
|
97
|
+
mode?: ModeType;
|
|
98
|
+
renderers?: Renderers;
|
|
99
|
+
parsers?: Parsers;
|
|
100
|
+
labelers?: Labelers;
|
|
101
|
+
policies?: Policies;
|
|
102
|
+
onSave?: FeedbackType;
|
|
103
|
+
onChange?: FeedbackType;
|
|
104
|
+
onSelect?: FeedbackType;
|
|
105
|
+
onKeyUp?: (e: EditorEvent, points: CursorStateType) => void;
|
|
106
|
+
onInit?: (table: UserTable) => void;
|
|
107
|
+
additionalFunctions?: FunctionMapping;
|
|
108
|
+
contextMenuItems?: FC<ContextMenuProps>[];
|
|
109
|
+
};
|
|
110
|
+
export type RangeType = {
|
|
111
|
+
start: number;
|
|
112
|
+
end: number;
|
|
113
|
+
};
|
|
114
|
+
export type PointType = {
|
|
115
|
+
y: Y;
|
|
116
|
+
x: X;
|
|
117
|
+
};
|
|
118
|
+
export type ExtraPointType = {
|
|
119
|
+
y: Y;
|
|
120
|
+
x: X;
|
|
121
|
+
absY?: boolean;
|
|
122
|
+
absX?: boolean;
|
|
123
|
+
table?: Table;
|
|
124
|
+
};
|
|
125
|
+
export type PositionType = {
|
|
126
|
+
y: Y;
|
|
127
|
+
x: X;
|
|
128
|
+
};
|
|
129
|
+
export type ZoneType = {
|
|
130
|
+
startY: Y;
|
|
131
|
+
startX: X;
|
|
132
|
+
endY: Y;
|
|
133
|
+
endX: X;
|
|
134
|
+
};
|
|
135
|
+
export type AreaType = {
|
|
136
|
+
top: Y;
|
|
137
|
+
left: X;
|
|
138
|
+
bottom: Y;
|
|
139
|
+
right: X;
|
|
140
|
+
};
|
|
141
|
+
export type WriterType = (value: string) => void;
|
|
142
|
+
export type StoreType = {
|
|
143
|
+
sheetId: number;
|
|
144
|
+
table: Table;
|
|
145
|
+
rootRef: RefObject<HTMLDivElement>;
|
|
146
|
+
mainRef: RefObject<HTMLDivElement>;
|
|
147
|
+
editorRef: RefObject<HTMLTextAreaElement>;
|
|
148
|
+
largeEditorRef: RefObject<HTMLTextAreaElement>;
|
|
149
|
+
tabularRef: RefObject<HTMLDivElement>;
|
|
150
|
+
searchInputRef: RefObject<HTMLTextAreaElement>;
|
|
151
|
+
entering: boolean;
|
|
152
|
+
choosing: PointType;
|
|
153
|
+
inputting: string;
|
|
154
|
+
selectingZone: ZoneType;
|
|
155
|
+
autofillDraggingTo: PointType | null;
|
|
156
|
+
leftHeaderSelecting: boolean;
|
|
157
|
+
topHeaderSelecting: boolean;
|
|
158
|
+
editingAddress: string;
|
|
159
|
+
editorRect: RectType;
|
|
160
|
+
dragging: boolean;
|
|
161
|
+
sheetHeight: number;
|
|
162
|
+
sheetWidth: number;
|
|
163
|
+
headerHeight: number;
|
|
164
|
+
headerWidth: number;
|
|
165
|
+
minNumRows: number;
|
|
166
|
+
maxNumRows: number;
|
|
167
|
+
minNumCols: number;
|
|
168
|
+
maxNumCols: number;
|
|
169
|
+
mode: ModeType;
|
|
170
|
+
searchQuery?: string;
|
|
171
|
+
searchCaseSensitive: boolean;
|
|
172
|
+
matchingCells: string[];
|
|
173
|
+
matchingCellIndex: number;
|
|
174
|
+
editingOnEnter: boolean;
|
|
175
|
+
showAddress: boolean;
|
|
176
|
+
contextMenuPosition: PositionType;
|
|
177
|
+
contextMenuItems: FC<ContextMenuProps>[];
|
|
178
|
+
resizingPositionY: [Y, Y, Y];
|
|
179
|
+
resizingPositionX: [X, X, X];
|
|
180
|
+
onSave?: FeedbackType;
|
|
181
|
+
};
|
|
182
|
+
export type Props = {
|
|
183
|
+
initialCells: CellsByAddressType;
|
|
184
|
+
sheetName?: string;
|
|
185
|
+
hubReactive?: HubReactiveType;
|
|
186
|
+
tableRef?: RefObject<TableRef | null>;
|
|
187
|
+
options?: OptionsType;
|
|
188
|
+
className?: string;
|
|
189
|
+
style?: CSSProperties;
|
|
190
|
+
};
|
|
191
|
+
export type Id = string;
|
|
192
|
+
export type Ids = Id[];
|
|
193
|
+
export type IdMatrix = Ids[];
|
|
194
|
+
export type Address = string;
|
|
195
|
+
export type MatricesByAddress<T> = {
|
|
196
|
+
[origin: Address]: MatrixType<T>;
|
|
197
|
+
};
|
|
198
|
+
export type HubPatchType = Partial<Hub>;
|
|
199
|
+
export type StorePatchType = {
|
|
200
|
+
sheetId: number;
|
|
201
|
+
choosing?: PointType;
|
|
202
|
+
selectingZone?: ZoneType | undefined;
|
|
203
|
+
hub?: HubPatchType;
|
|
204
|
+
};
|
|
205
|
+
export type HistoryUpdateType = {
|
|
206
|
+
operation: 'UPDATE';
|
|
207
|
+
srcSheetId: number;
|
|
208
|
+
dstSheetId: number;
|
|
209
|
+
applyed: boolean;
|
|
210
|
+
undoReflection?: StorePatchType;
|
|
211
|
+
redoReflection?: StorePatchType;
|
|
212
|
+
diffBefore: CellsByIdType;
|
|
213
|
+
diffAfter: CellsByIdType;
|
|
214
|
+
partial: boolean;
|
|
215
|
+
};
|
|
216
|
+
export type HistoryMoveType = {
|
|
217
|
+
operation: 'MOVE';
|
|
218
|
+
srcSheetId: number;
|
|
219
|
+
dstSheetId: number;
|
|
220
|
+
applyed: boolean;
|
|
221
|
+
undoReflection?: StorePatchType;
|
|
222
|
+
redoReflection?: StorePatchType;
|
|
223
|
+
diffBefore: CellsByIdType;
|
|
224
|
+
src: AreaType;
|
|
225
|
+
dst: AreaType;
|
|
226
|
+
matrixFrom: IdMatrix;
|
|
227
|
+
matrixTo: IdMatrix;
|
|
228
|
+
matrixNew: IdMatrix;
|
|
229
|
+
lostRows: MatricesByAddress<Id>;
|
|
230
|
+
};
|
|
231
|
+
export type HistoryInsertRowsType = {
|
|
232
|
+
operation: 'INSERT_ROWS';
|
|
233
|
+
srcSheetId: number;
|
|
234
|
+
dstSheetId: number;
|
|
235
|
+
applyed: boolean;
|
|
236
|
+
undoReflection?: StorePatchType;
|
|
237
|
+
redoReflection?: StorePatchType;
|
|
238
|
+
y: number;
|
|
239
|
+
numRows: number;
|
|
240
|
+
idMatrix: IdMatrix;
|
|
241
|
+
diffBefore?: CellsByIdType;
|
|
242
|
+
diffAfter?: CellsByIdType;
|
|
243
|
+
partial?: true;
|
|
244
|
+
};
|
|
245
|
+
export type HistoryRemoveRowsType = {
|
|
246
|
+
operation: 'REMOVE_ROWS';
|
|
247
|
+
srcSheetId: number;
|
|
248
|
+
dstSheetId: number;
|
|
249
|
+
applyed: boolean;
|
|
250
|
+
undoReflection?: StorePatchType;
|
|
251
|
+
redoReflection?: StorePatchType;
|
|
252
|
+
ys: number[];
|
|
253
|
+
deleted: IdMatrix;
|
|
254
|
+
};
|
|
255
|
+
export type HistoryInsertColsType = {
|
|
256
|
+
operation: 'INSERT_COLS';
|
|
257
|
+
srcSheetId: number;
|
|
258
|
+
dstSheetId: number;
|
|
259
|
+
applyed: boolean;
|
|
260
|
+
undoReflection?: StorePatchType;
|
|
261
|
+
redoReflection?: StorePatchType;
|
|
262
|
+
x: number;
|
|
263
|
+
numCols: number;
|
|
264
|
+
idMatrix: IdMatrix;
|
|
265
|
+
diffBefore?: CellsByIdType;
|
|
266
|
+
diffAfter?: CellsByIdType;
|
|
267
|
+
partial?: true;
|
|
268
|
+
};
|
|
269
|
+
export type HistoryRemoveColsType = {
|
|
270
|
+
operation: 'REMOVE_COLS';
|
|
271
|
+
srcSheetId: number;
|
|
272
|
+
dstSheetId: number;
|
|
273
|
+
applyed: boolean;
|
|
274
|
+
undoReflection?: StorePatchType;
|
|
275
|
+
redoReflection?: StorePatchType;
|
|
276
|
+
xs: number[];
|
|
277
|
+
deleted: IdMatrix;
|
|
278
|
+
};
|
|
279
|
+
export type HistoryType = HistoryUpdateType | HistoryMoveType | HistoryInsertRowsType | HistoryRemoveRowsType | HistoryInsertColsType | HistoryRemoveColsType;
|
|
280
|
+
export type Virtualization = {
|
|
281
|
+
xs: number[];
|
|
282
|
+
ys: number[];
|
|
283
|
+
adjuster: AreaType;
|
|
284
|
+
};
|
|
285
|
+
export type OperatorType = 'USER' | 'SYSTEM';
|
|
286
|
+
export type OperationType = number;
|
|
287
|
+
export type StoreDispatchType = {
|
|
288
|
+
store: StoreType;
|
|
289
|
+
dispatch: Dispatcher;
|
|
290
|
+
};
|
|
291
|
+
export type ContextsBySheetId = {
|
|
292
|
+
[sheetId: string]: StoreDispatchType;
|
|
293
|
+
};
|
|
294
|
+
export type SheetIdsByName = {
|
|
295
|
+
[sheetName: string]: number;
|
|
296
|
+
};
|
|
297
|
+
export type RefPaletteType = {
|
|
298
|
+
[address: string]: number;
|
|
299
|
+
};
|
|
300
|
+
export type EditorEvent = KeyboardEvent<HTMLTextAreaElement>;
|
|
301
|
+
export type EditorEventWithNativeEvent = EditorEvent & {
|
|
302
|
+
nativeEvent: KeyboardEvent & {
|
|
303
|
+
isComposing: boolean;
|
|
304
|
+
};
|
|
305
|
+
};
|
|
306
|
+
export type ContextMenuProps = {
|
|
307
|
+
store: StoreType;
|
|
308
|
+
dispatch: Dispatcher;
|
|
309
|
+
};
|
|
310
|
+
//# sourceMappingURL=types.d.ts.map
|
package/dist/utils.d.ts
ADDED
package/exports.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export {
|
|
2
|
+
useState,
|
|
3
|
+
useReducer,
|
|
4
|
+
useEffect,
|
|
5
|
+
useLayoutEffect,
|
|
6
|
+
useRef,
|
|
7
|
+
useImperativeHandle,
|
|
8
|
+
useMemo,
|
|
9
|
+
useCallback,
|
|
10
|
+
useContext,
|
|
11
|
+
useDebugValue,
|
|
12
|
+
createElement,
|
|
13
|
+
createContext,
|
|
14
|
+
createRef,
|
|
15
|
+
Fragment,
|
|
16
|
+
Component,
|
|
17
|
+
version,
|
|
18
|
+
Children,
|
|
19
|
+
render as compatRender,
|
|
20
|
+
hydrate,
|
|
21
|
+
unmountComponentAtNode,
|
|
22
|
+
createPortal,
|
|
23
|
+
createFactory,
|
|
24
|
+
cloneElement,
|
|
25
|
+
isValidElement,
|
|
26
|
+
findDOMNode,
|
|
27
|
+
PureComponent,
|
|
28
|
+
memo,
|
|
29
|
+
forwardRef,
|
|
30
|
+
unstable_batchedUpdates,
|
|
31
|
+
StrictMode,
|
|
32
|
+
Suspense,
|
|
33
|
+
SuspenseList,
|
|
34
|
+
lazy,
|
|
35
|
+
} from 'preact/compat';
|
package/index.ts
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@gridsheet/preact-core",
|
|
3
|
+
"version": "2.0.0-rc.0",
|
|
4
|
+
"description": "Spreadsheet component for Preact",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"copy-types": "rsync -avm --include='*/' --include='*.d.ts' --exclude='*' ../react-core/dist/ ./dist/",
|
|
10
|
+
"append-preact": "echo '\nexport { h, render } from \"preact\";' >> dist/index.d.ts && cat exports.ts >> dist/index.d.ts",
|
|
11
|
+
"build": "rm -rf ./dist || true && vite build && pnpm copy-types && pnpm append-preact"
|
|
12
|
+
},
|
|
13
|
+
"peerDependencies": {
|
|
14
|
+
"dayjs": "^1.11.13",
|
|
15
|
+
"preact": "^10.26.6"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"@types/react": "^19.1.4",
|
|
19
|
+
"@types/react-dom": "^19.1.5",
|
|
20
|
+
"@vitejs/plugin-react": "^4.3.4",
|
|
21
|
+
"typescript": "^5.8.2",
|
|
22
|
+
"vite": "^6.2.2",
|
|
23
|
+
"vite-plugin-dts": "^4.5.3",
|
|
24
|
+
"@preact/preset-vite": "^2.10.1"
|
|
25
|
+
},
|
|
26
|
+
"author": "righ",
|
|
27
|
+
"license": "Apache-2.0"
|
|
28
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"types": ["vite/client", "react"],
|
|
4
|
+
"target": "ES2015",
|
|
5
|
+
"module": "ES2015",
|
|
6
|
+
"moduleResolution": "node",
|
|
7
|
+
"lib": ["DOM", "ESNext", "DOM.Iterable", "ScriptHost", "ES2016.Array.Include"],
|
|
8
|
+
"declaration": true,
|
|
9
|
+
"declarationMap": true,
|
|
10
|
+
"allowJs": true,
|
|
11
|
+
"jsx": "react-jsx",
|
|
12
|
+
"jsxImportSource": "react",
|
|
13
|
+
"sourceMap": true,
|
|
14
|
+
"outDir": "./dist/",
|
|
15
|
+
"strict": true,
|
|
16
|
+
"noImplicitAny": true,
|
|
17
|
+
"strictNullChecks": true,
|
|
18
|
+
"esModuleInterop": true,
|
|
19
|
+
"skipLibCheck": true,
|
|
20
|
+
"baseUrl": "./src/",
|
|
21
|
+
"forceConsistentCasingInFileNames": true
|
|
22
|
+
},
|
|
23
|
+
"exclude": ["node_modules", "storybook", "dist", "e2e", "plugins"],
|
|
24
|
+
"include": ["**/*.ts", "**/*.tsx"]
|
|
25
|
+
}
|
package/vite.config.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// packages/preact-core/vite.config.ts
|
|
2
|
+
import { defineConfig } from 'vite';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import { fileURLToPath } from 'url';
|
|
5
|
+
import { dirname } from 'path';
|
|
6
|
+
|
|
7
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
8
|
+
const __dirname = dirname(__filename);
|
|
9
|
+
|
|
10
|
+
export default defineConfig({
|
|
11
|
+
build: {
|
|
12
|
+
lib: {
|
|
13
|
+
entry: path.resolve(__dirname, './index.ts'),
|
|
14
|
+
name: 'GridsheetPreactCore',
|
|
15
|
+
formats: ['es'],
|
|
16
|
+
fileName: (_, name) => `${name}.js`,
|
|
17
|
+
},
|
|
18
|
+
outDir: 'dist',
|
|
19
|
+
emptyOutDir: true,
|
|
20
|
+
preserveModules: true,
|
|
21
|
+
preserveModulesRoot: 'src',
|
|
22
|
+
rollupOptions: {
|
|
23
|
+
external: [/^preact/],
|
|
24
|
+
input: path.resolve(__dirname, './index.ts'),
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
optimizeDeps: {
|
|
28
|
+
include: ['preact/jsx-runtime'],
|
|
29
|
+
},
|
|
30
|
+
resolve: {
|
|
31
|
+
alias: {
|
|
32
|
+
react: 'preact/compat',
|
|
33
|
+
'react-dom': 'preact/compat',
|
|
34
|
+
'react/jsx-runtime': 'preact/jsx-runtime',
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
});
|