@sheetwrite/react 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Sheetwrite contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,60 @@
1
+ # @sheetwrite/react
2
+
3
+ React components for Sheetwrite.
4
+
5
+ ## Install
6
+
7
+ ```sh
8
+ bun add @sheetwrite/react
9
+ ```
10
+
11
+ React 18 or newer is a peer dependency. Core and WASM are runtime dependencies of the adapter.
12
+
13
+ ## Data-first component
14
+
15
+ ```tsx
16
+ import { Sheetwrite } from "@sheetwrite/react";
17
+ import "@sheetwrite/react/styles.css";
18
+
19
+ <Sheetwrite
20
+ columns={[
21
+ { key: "name", title: "Name" },
22
+ { key: "price", title: "Price", type: "currency" },
23
+ ]}
24
+ defaultRows={products}
25
+ height={500}
26
+ onGridChange={(event) => console.log(event.source, event.transaction.patches)}
27
+ />;
28
+ ```
29
+
30
+ `defaultRows` seeds an uncontrolled grid. It is never mutated. Changing its identity deliberately creates a new grid generation; later grid edits are owned by the grid, not synchronized back into the input array.
31
+
32
+ `onGridChange` observes the complete transaction. Do not persist only
33
+ `event.changes`; use `event.transaction.patches` or attach `SyncCoordinator` to
34
+ the ready `Grid` for mutation IDs, acknowledgements, retry, and remote ordering.
35
+
36
+ Use `height={500}` for a fixed host or `fill` to occupy an already-sized ancestor. `fill` requires an ancestor with available height.
37
+
38
+ The component initializes WASM on client mount. `fallback` renders inside the stable host while initialization is pending or after an initialization failure. `onInitializationError(error)` observes failures. `wasmSource` is the advanced explicit-source escape hatch.
39
+
40
+ ## Advanced component
41
+
42
+ ```tsx
43
+ import { SheetwriteGrid } from "@sheetwrite/react";
44
+ import "@sheetwrite/react/styles.css";
45
+
46
+ <SheetwriteGrid ref={gridRef} workbook={workbook} data={data} fill />;
47
+ ```
48
+
49
+ Reset-bound inputs are `workbook`, `data`, `datasource`, `datasourceStorage`, `renderer`, `workerUrl`, and `renderers`. They replace the grid. Live inputs are `theme`, `readOnly`, `config`, `overscan`, and `minColumns`.
50
+
51
+ `ref` receives the current `Grid` before `onReady({ grid, generation, reason })` runs and clears on replacement or unmount. Reasons are `initial`, `input-reset`, and `renderer-reset`.
52
+
53
+ Grid events use collision-free names: `onGridChange`, `onViewportChange`, `onSelectionChange`, `onEditBegin`, `onEditCommit`, `onSearch`, and `onActiveSheetChange`. Native host `onChange` and `onScroll` remain ordinary DOM handlers.
54
+
55
+ For vanilla/preload control, import `initSheetwrite()` and `createGrid()` from `@sheetwrite/core`. See [installation](https://sheetwrite.vercel.app/docs/start/installation/), [React integration](https://sheetwrite.vercel.app/docs/frameworks/react/), and [collaboration](https://sheetwrite.vercel.app/docs/guides/collaboration/).
56
+
57
+ XLSX is not installed by this adapter. If the toolbar configuration enables
58
+ XLSX export, install `@sheetwrite/xlsx` and import
59
+ `@sheetwrite/xlsx/register` before the action (or lazily inside its handler).
60
+ CSV/TSV require no optional package.
@@ -0,0 +1,40 @@
1
+ import { type CellScalar, type Grid, type GridOptions } from "@sheetwrite/core";
2
+ import { type GridAdapterEventHandlers, type GridSizeProps, type SheetwriteInitializationProps, type SimpleColumn } from "@sheetwrite/core/adapter";
3
+ import { type CSSProperties, type ForwardedRef, type HTMLAttributes, type ReactElement, type ReactNode } from "react";
4
+ /** Advanced framework adapter props for workbook data or datasource ownership. */
5
+ export interface SheetwriteGridProps extends GridOptions, GridAdapterEventHandlers, SheetwriteInitializationProps, Omit<HTMLAttributes<HTMLDivElement>, keyof GridAdapterEventHandlers | "children"> {
6
+ /** Additional class appended to the required `sheetwrite` host class. */
7
+ className?: string;
8
+ /** Host styles merged before adapter sizing styles. */
9
+ style?: CSSProperties;
10
+ /** Content shown while WASM is loading or after initialization fails. */
11
+ fallback?: ReactNode;
12
+ /** Host height in CSS pixels for numbers or any CSS length string. */
13
+ height?: number | string;
14
+ /** Fills the parent's available width and height, taking precedence over `height`. */
15
+ fill?: true;
16
+ }
17
+ /** Advanced framework component for workbook data or datasource input. */
18
+ export declare const SheetwriteGrid: import("react").ForwardRefExoticComponent<SheetwriteGridProps & import("react").RefAttributes<Grid>>;
19
+ /** Simple framework adapter props for columns and default row objects. */
20
+ export type SheetwriteProps<Row extends Record<string, CellScalar>> = Omit<SheetwriteGridProps, "workbook" | "data" | "datasource" | "height" | "fill"> & GridSizeProps & {
21
+ /** Ordered schema used to derive the component-owned sheet. */
22
+ columns: readonly SimpleColumn<Row>[];
23
+ /** Rows converted to initial columnar data; missing column keys become `null`. */
24
+ defaultRows: readonly Row[];
25
+ /** Name of the generated sheet; defaults to `Sheet 1`. */
26
+ sheetName?: string;
27
+ };
28
+ /**
29
+ * Convenience component for local object rows. It derives a single-sheet workbook from
30
+ * `columns`, `defaultRows`, and `sheetName`, initializes Sheetwrite, and owns the `Grid`
31
+ * through prop-driven resets and unmount cleanup. Pass a `ref` to access the live `Grid`;
32
+ * use `SheetwriteGrid` when the host already owns a workbook or datasource.
33
+ */
34
+ export declare const Sheetwrite: <Row extends Record<string, CellScalar>>(props: SheetwriteProps<Row> & {
35
+ /** Receives the live Grid after readiness and `null` on reset or unmount. */
36
+ ref?: ForwardedRef<Grid>;
37
+ }) => ReactElement;
38
+ export type { CellScalar, Grid } from "@sheetwrite/core";
39
+ export type { GridReadyEvent, SimpleColumn } from "@sheetwrite/core/adapter";
40
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,UAAU,EACf,KAAK,IAAI,EACT,KAAK,WAAW,EAGjB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAGL,KAAK,wBAAwB,EAG7B,KAAK,aAAa,EAGlB,KAAK,6BAA6B,EAClC,KAAK,YAAY,EAClB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,YAAY,EAEjB,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,SAAS,EAMf,MAAM,OAAO,CAAC;AAOf,kFAAkF;AAClF,MAAM,WAAW,mBACf,SAAQ,WAAW,EACjB,wBAAwB,EACxB,6BAA6B,EAC7B,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,MAAM,wBAAwB,GAAG,UAAU,CAAC;IACnF,yEAAyE;IACzE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uDAAuD;IACvD,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,yEAAyE;IACzE,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,sEAAsE;IACtE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,sFAAsF;IACtF,IAAI,CAAC,EAAE,IAAI,CAAC;CACb;AAED,0EAA0E;AAC1E,eAAO,MAAM,cAAc,sGAyL1B,CAAC;AAEF,0EAA0E;AAC1E,MAAM,MAAM,eAAe,CAAC,GAAG,SAAS,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,IAAI,IAAI,CACxE,mBAAmB,EACnB,UAAU,GAAG,MAAM,GAAG,YAAY,GAAG,QAAQ,GAAG,MAAM,CACvD,GACC,aAAa,GAAG;IACd,+DAA+D;IAC/D,OAAO,EAAE,SAAS,YAAY,CAAC,GAAG,CAAC,EAAE,CAAC;IACtC,kFAAkF;IAClF,WAAW,EAAE,SAAS,GAAG,EAAE,CAAC;IAC5B,0DAA0D;IAC1D,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAYJ;;;;;GAKG;AACH,eAAO,MAAM,UAAU,EAA0B,CAAC,GAAG,SAAS,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,EACtF,KAAK,EAAE,eAAe,CAAC,GAAG,CAAC,GAAG;IAC5B,6EAA6E;IAC7E,GAAG,CAAC,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC;CAC1B,KACE,YAAY,CAAC;AAElB,YAAY,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACzD,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,164 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { initSheetwrite, isSheetwriteReady, } from "@sheetwrite/core";
3
+ import { createGridController, createSimpleGridInput, getGridResetReason, gridSizeStyle, } from "@sheetwrite/core/adapter";
4
+ import { forwardRef, useEffect, useLayoutEffect, useMemo, useRef, useState, } from "react";
5
+ function publishGrid(ref, grid) {
6
+ if (typeof ref === "function")
7
+ ref(grid);
8
+ else if (ref)
9
+ ref.current = grid;
10
+ }
11
+ /** Advanced framework component for workbook data or datasource input. */
12
+ export const SheetwriteGrid = forwardRef(function SheetwriteGrid(props, ref) {
13
+ const { className, style, fallback, wasmSource, onInitializationError, onGridChange, onSelectionChange, onViewportChange, onEditBegin, onEditCommit, onSearch, onActiveSheetChange, onReady, workbook, data, datasource, datasourceStorage, renderer, workerUrl, theme, readOnly, protectionResolver, mutationPolicy, renderers, overscan, minColumns, config, height, fill, ...hostAttributes } = props;
14
+ const hostRef = useRef(null);
15
+ const controllerRef = useRef(null);
16
+ const publishedRef = useRef(null);
17
+ const generationRef = useRef(0);
18
+ const initializedRef = useRef(isSheetwriteReady());
19
+ const mountedRef = useRef(false);
20
+ const [initializationState, setInitializationState] = useState(initializedRef.current ? "ready" : "loading");
21
+ const previousOptionsRef = useRef(null);
22
+ const liveOptionsRef = useRef({
23
+ theme,
24
+ readOnly,
25
+ overscan,
26
+ minColumns,
27
+ config,
28
+ });
29
+ liveOptionsRef.current = { theme, readOnly, overscan, minColumns, config };
30
+ const handlers = useRef({});
31
+ Object.assign(handlers.current, {
32
+ onGridChange,
33
+ onSelectionChange,
34
+ onViewportChange,
35
+ onEditBegin,
36
+ onEditCommit,
37
+ onSearch,
38
+ onActiveSheetChange,
39
+ onReady,
40
+ onInitializationError,
41
+ });
42
+ useLayoutEffect(() => {
43
+ const previous = publishedRef.current;
44
+ if (previous && previous !== ref)
45
+ publishGrid(previous, null);
46
+ publishedRef.current = ref;
47
+ publishGrid(ref, controllerRef.current?.grid ?? null);
48
+ return () => {
49
+ if (publishedRef.current !== ref)
50
+ return;
51
+ publishGrid(ref, null);
52
+ publishedRef.current = null;
53
+ };
54
+ }, [ref]);
55
+ useEffect(() => {
56
+ mountedRef.current = true;
57
+ return () => {
58
+ mountedRef.current = false;
59
+ };
60
+ }, []);
61
+ useEffect(() => {
62
+ let current = true;
63
+ if (isSheetwriteReady()) {
64
+ initializedRef.current = true;
65
+ setInitializationState("ready");
66
+ return;
67
+ }
68
+ setInitializationState("loading");
69
+ void initSheetwrite(wasmSource).then(() => {
70
+ if (!mountedRef.current || !isSheetwriteReady())
71
+ return;
72
+ initializedRef.current = true;
73
+ setInitializationState("ready");
74
+ }, (error) => {
75
+ if (!current || !mountedRef.current)
76
+ return;
77
+ initializedRef.current = false;
78
+ setInitializationState("error");
79
+ handlers.current.onInitializationError?.(error);
80
+ });
81
+ return () => {
82
+ current = false;
83
+ };
84
+ }, [wasmSource]);
85
+ useEffect(() => {
86
+ if (initializationState !== "ready")
87
+ return;
88
+ const host = hostRef.current;
89
+ if (!host)
90
+ return;
91
+ const options = {
92
+ workbook,
93
+ data,
94
+ datasource,
95
+ datasourceStorage,
96
+ renderer,
97
+ workerUrl,
98
+ renderers,
99
+ protectionResolver,
100
+ mutationPolicy,
101
+ ...liveOptionsRef.current,
102
+ };
103
+ const previousOptions = previousOptionsRef.current;
104
+ const reason = generationRef.current === 0
105
+ ? "initial"
106
+ : ((previousOptions && getGridResetReason(previousOptions, options)) ?? "input-reset");
107
+ const controller = createGridController(host, options, {
108
+ onGridChange: (event) => handlers.current.onGridChange?.(event),
109
+ onSelectionChange: (selection) => handlers.current.onSelectionChange?.(selection),
110
+ onViewportChange: (event) => handlers.current.onViewportChange?.(event),
111
+ onEditBegin: (event) => handlers.current.onEditBegin?.(event),
112
+ onEditCommit: (event) => handlers.current.onEditCommit?.(event),
113
+ onSearch: (result) => handlers.current.onSearch?.(result),
114
+ onActiveSheetChange: (event) => handlers.current.onActiveSheetChange?.(event),
115
+ });
116
+ controllerRef.current = controller;
117
+ generationRef.current += 1;
118
+ publishGrid(publishedRef.current, controller.grid);
119
+ handlers.current.onReady?.({
120
+ grid: controller.grid,
121
+ generation: generationRef.current,
122
+ reason,
123
+ });
124
+ previousOptionsRef.current = options;
125
+ return () => {
126
+ publishGrid(publishedRef.current, null);
127
+ if (controllerRef.current === controller)
128
+ controllerRef.current = null;
129
+ controller.destroy();
130
+ };
131
+ }, [
132
+ initializationState,
133
+ workbook,
134
+ data,
135
+ datasource,
136
+ datasourceStorage,
137
+ renderer,
138
+ workerUrl,
139
+ protectionResolver,
140
+ mutationPolicy,
141
+ renderers,
142
+ ]);
143
+ useEffect(() => controllerRef.current?.setReadOnly(readOnly ?? false), [readOnly]);
144
+ useEffect(() => controllerRef.current?.setConfig(config), [config]);
145
+ useEffect(() => controllerRef.current?.setTheme(theme), [theme]);
146
+ useEffect(() => controllerRef.current?.setOverscan(overscan), [overscan]);
147
+ useEffect(() => controllerRef.current?.setMinColumns(minColumns), [minColumns]);
148
+ const hostClassName = className ? `sheetwrite ${className}` : "sheetwrite";
149
+ const sizing = gridSizeStyle({ height, fill });
150
+ const hostStyle = { ...style, ...sizing };
151
+ return (_jsx("div", { ...hostAttributes, ref: hostRef, className: hostClassName, style: hostStyle, children: initializationState === "ready" ? null : fallback }));
152
+ });
153
+ const SheetwriteComponent = forwardRef(function Sheetwrite({ columns, defaultRows, sheetName, ...props }, ref) {
154
+ const input = useMemo(() => createSimpleGridInput({ columns, defaultRows, sheetName }), [columns, defaultRows, sheetName]);
155
+ return _jsx(SheetwriteGrid, { ...props, ...input, ref: ref });
156
+ });
157
+ /**
158
+ * Convenience component for local object rows. It derives a single-sheet workbook from
159
+ * `columns`, `defaultRows`, and `sheetName`, initializes Sheetwrite, and owns the `Grid`
160
+ * through prop-driven resets and unmount cleanup. Pass a `ref` to access the live `Grid`;
161
+ * use `SheetwriteGrid` when the host already owns a workbook or datasource.
162
+ */
163
+ export const Sheetwrite = SheetwriteComponent;
164
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAIL,cAAc,EACd,iBAAiB,GAClB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EAKrB,kBAAkB,EAClB,aAAa,GAGd,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAGL,UAAU,EAIV,SAAS,EACT,eAAe,EACf,OAAO,EACP,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAC;AAEf,SAAS,WAAW,CAAC,GAAuB,EAAE,IAAiB;IAC7D,IAAI,OAAO,GAAG,K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IAC/C,MAAM,SAAS,GAAG,EAAE,GAAG,KAAK,EAAE,GAAG,MAAM,EAAE,CAAC;IAC1C,OAAO,CACL,iBAAS,cAAc,EAAE,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,KAAK,EAAE,SAAS,YAC9E,mBAAmB,KAAK,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,GAC9C,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAgBF,MAAM,mBAAmB,GAAG,UAAU,CACpC,SAAS,UAAU,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG;IACpE,MAAM,KAAK,GAAG,OAAO,CACnB,GAAG,EAAE,CAAC,qBAAqB,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC,EAChE,CAAC,OAAO,EAAE,WAAW,EAAE,SAAS,CAAC,CAClC,CAAC;IACF,OAAO,KAAC,cAAc,OAAK,KAAK,KAAM,KAAK,EAAE,GAAG,EAAE,GAAG,GAAI,CAAC;AAC5D,CAAC,CACF,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,mBAKT,CAAC"}
package/package.json ADDED
@@ -0,0 +1,50 @@
1
+ {
2
+ "name": "@sheetwrite/react",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "description": "React adapter for Sheetwrite.",
6
+ "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/chh-ay/Sheetwrite.git",
10
+ "directory": "packages/react"
11
+ },
12
+ "homepage": "https://chh-ay.github.io/Sheetwrite/",
13
+ "bugs": {
14
+ "url": "https://github.com/chh-ay/Sheetwrite/issues"
15
+ },
16
+ "keywords": [
17
+ "spreadsheet",
18
+ "data-grid",
19
+ "react",
20
+ "canvas"
21
+ ],
22
+ "main": "./dist/index.js",
23
+ "module": "./dist/index.js",
24
+ "types": "./dist/index.d.ts",
25
+ "exports": {
26
+ ".": {
27
+ "types": "./dist/index.d.ts",
28
+ "default": "./dist/index.js"
29
+ },
30
+ "./styles.css": "./styles.css"
31
+ },
32
+ "files": [
33
+ "dist",
34
+ "styles.css"
35
+ ],
36
+ "publishConfig": {
37
+ "access": "public",
38
+ "provenance": true
39
+ },
40
+ "scripts": {
41
+ "build": "rm -rf dist && tsc -p tsconfig.build.json",
42
+ "typecheck": "tsc --noEmit -p tsconfig.json"
43
+ },
44
+ "peerDependencies": {
45
+ "react": ">=18"
46
+ },
47
+ "dependencies": {
48
+ "@sheetwrite/core": "0.1.0"
49
+ }
50
+ }
package/styles.css ADDED
@@ -0,0 +1 @@
1
+ @import "@sheetwrite/core/styles.css";