@ishibashi0112/spreadsheet-grid-solid 0.0.0-stage → 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.
Files changed (132) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +151 -2
  3. package/dist/ColumnFilterPopover-BmxumbB7.js +1418 -0
  4. package/dist/SpreadsheetGrid.d.ts +4 -0
  5. package/dist/columnVirtualizer-CGHyzbwH.js +95 -0
  6. package/dist/context/localeText.d.ts +7 -0
  7. package/dist/context/portal.d.ts +6 -0
  8. package/dist/createSpreadsheetGrid.d.ts +8 -0
  9. package/dist/devWarnings.d.ts +28 -0
  10. package/dist/editors/CellEditorErrorBubble.d.ts +6 -0
  11. package/dist/editors/CellEditorLayer.d.ts +37 -0
  12. package/dist/editors/CheckboxCell.d.ts +10 -0
  13. package/dist/editors/CustomCellEditor.d.ts +9 -0
  14. package/dist/editors/DateCellEditor.d.ts +15 -0
  15. package/dist/editors/NumberCellEditor.d.ts +17 -0
  16. package/dist/editors/SelectCellEditor.d.ts +19 -0
  17. package/dist/editors/TextCellEditor.d.ts +19 -0
  18. package/dist/features/autoHeight.d.ts +2 -0
  19. package/dist/features/columnAutosize.d.ts +2 -0
  20. package/dist/features/columnMenu.d.ts +2 -0
  21. package/dist/features/columnReorder.d.ts +2 -0
  22. package/dist/features/conditionalFormat.d.ts +2 -0
  23. package/dist/features/contextMenu.d.ts +16 -0
  24. package/dist/features/export.d.ts +2 -0
  25. package/dist/features/fillHandle.d.ts +2 -0
  26. package/dist/features/filtering.d.ts +2 -0
  27. package/dist/features/find.d.ts +2 -0
  28. package/dist/features/full.d.ts +2 -0
  29. package/dist/features/grouping.d.ts +2 -0
  30. package/dist/features/imeDirectInput.d.ts +2 -0
  31. package/dist/features/labelRow.d.ts +2 -0
  32. package/dist/features/motionExtras.d.ts +2 -0
  33. package/dist/features/pinnedRows.d.ts +2 -0
  34. package/dist/features/rowDrag.d.ts +2 -0
  35. package/dist/features/scrollHint.d.ts +2 -0
  36. package/dist/features/selectionAggregates.d.ts +2 -0
  37. package/dist/features/serverSide.d.ts +2 -0
  38. package/dist/features/standard.d.ts +7 -0
  39. package/dist/features/toolPanel.d.ts +2 -0
  40. package/dist/features/totalRow.d.ts +2 -0
  41. package/dist/features/types.d.ts +140 -0
  42. package/dist/fullGrid.d.ts +36 -0
  43. package/dist/index.d.ts +33 -0
  44. package/dist/index.js +7315 -0
  45. package/dist/inputValue-C6BHBMBx.js +24 -0
  46. package/dist/locales/en.d.ts +1 -0
  47. package/dist/locales/en.js +2 -0
  48. package/dist/model/gridTypes.d.ts +66 -0
  49. package/dist/portalTokens-Gz03P3fZ.js +52 -0
  50. package/dist/primitives/clickTarget.d.ts +1 -0
  51. package/dist/primitives/columnAutosize.d.ts +7 -0
  52. package/dist/primitives/columnMenu.d.ts +22 -0
  53. package/dist/primitives/columnReorder.d.ts +7 -0
  54. package/dist/primitives/columnVirtualizer.d.ts +8 -0
  55. package/dist/primitives/contextMenu.d.ts +14 -0
  56. package/dist/primitives/controller.d.ts +5 -0
  57. package/dist/primitives/eventKey.d.ts +12 -0
  58. package/dist/primitives/externalStore.d.ts +5 -0
  59. package/dist/primitives/fillHandle.d.ts +56 -0
  60. package/dist/primitives/filterManagement.d.ts +30 -0
  61. package/dist/primitives/filterOrder.d.ts +25 -0
  62. package/dist/primitives/filterPopover.d.ts +33 -0
  63. package/dist/primitives/gridStoreSignals.d.ts +5 -0
  64. package/dist/primitives/inputValue.d.ts +5 -0
  65. package/dist/primitives/liveObject.d.ts +1 -0
  66. package/dist/primitives/memoWhen.d.ts +1 -0
  67. package/dist/primitives/mountGate.d.ts +11 -0
  68. package/dist/primitives/portalTokens.d.ts +3 -0
  69. package/dist/primitives/rowDrag.d.ts +18 -0
  70. package/dist/primitives/selectionAggregates.d.ts +10 -0
  71. package/dist/primitives/serverSide.d.ts +14 -0
  72. package/dist/primitives/style.d.ts +3 -0
  73. package/dist/primitives/toolPanel.d.ts +25 -0
  74. package/dist/primitives/topAlignedInput.d.ts +1 -0
  75. package/dist/primitives/viewSetters.d.ts +9 -0
  76. package/dist/source/chunks/ColumnFilterPopover-BMKPRELT.jsx +1448 -0
  77. package/dist/source/chunks/chunk-5KX4SR2S.jsx +143 -0
  78. package/dist/source/chunks/chunk-RJB7JN2Y.jsx +102 -0
  79. package/dist/source/chunks/chunk-WLXZT66B.jsx +44 -0
  80. package/dist/source/chunks/toolPanelViews-W6KROURU.jsx +934 -0
  81. package/dist/source/index.jsx +8737 -0
  82. package/dist/style.css +2 -0
  83. package/dist/style.css.d.ts +2 -0
  84. package/dist/style.layer.css +4 -0
  85. package/dist/style.layer.css.d.ts +2 -0
  86. package/dist/testing/index.d.ts +1 -0
  87. package/dist/testing.js +1 -0
  88. package/dist/themes/astryx.css +122 -0
  89. package/dist/themes/astryx.css.d.ts +2 -0
  90. package/dist/themes/heroui.css +124 -0
  91. package/dist/themes/heroui.css.d.ts +2 -0
  92. package/dist/themes/mantine.css +122 -0
  93. package/dist/themes/mantine.css.d.ts +2 -0
  94. package/dist/themes/shadcn.css +124 -0
  95. package/dist/themes/shadcn.css.d.ts +2 -0
  96. package/dist/toolPanelViews-BE4gv_L0.js +621 -0
  97. package/dist/view/CellContextMenuPopover.d.ts +15 -0
  98. package/dist/view/ColumnChooserPanel.d.ts +19 -0
  99. package/dist/view/ColumnFilterPopover.d.ts +61 -0
  100. package/dist/view/ColumnFilterPopoverHost.d.ts +24 -0
  101. package/dist/view/ColumnMenuPopover.d.ts +35 -0
  102. package/dist/view/CopyRangeOverlay.d.ts +14 -0
  103. package/dist/view/DefaultGridBottomBar.d.ts +12 -0
  104. package/dist/view/DefaultGridTopBar.d.ts +18 -0
  105. package/dist/view/DetailToggleButton.d.ts +4 -0
  106. package/dist/view/DragHandleGlyph.d.ts +3 -0
  107. package/dist/view/FillHandleLayer.d.ts +16 -0
  108. package/dist/view/FilterDateField.d.ts +12 -0
  109. package/dist/view/FilterManagementPanel.d.ts +25 -0
  110. package/dist/view/GridBodyGroupRow.d.ts +27 -0
  111. package/dist/view/GridBodyLabelRow.d.ts +25 -0
  112. package/dist/view/GridBodyLayer.d.ts +81 -0
  113. package/dist/view/GridBodySkeletonRow.d.ts +25 -0
  114. package/dist/view/GridChip.d.ts +6 -0
  115. package/dist/view/GridDetailLayer.d.ts +24 -0
  116. package/dist/view/GridFilterChipBar.d.ts +12 -0
  117. package/dist/view/GridFindBar.d.ts +13 -0
  118. package/dist/view/GridHeaderRow.d.ts +46 -0
  119. package/dist/view/GridPinnedRows.d.ts +29 -0
  120. package/dist/view/GridScrollHint.d.ts +22 -0
  121. package/dist/view/GridSelectionAggregates.d.ts +5 -0
  122. package/dist/view/GridServerSideErrorBars.d.ts +12 -0
  123. package/dist/view/GridStickyLabelLayer.d.ts +27 -0
  124. package/dist/view/GridTotalRow.d.ts +26 -0
  125. package/dist/view/Overlay.d.ts +17 -0
  126. package/dist/view/RowDragHandle.d.ts +9 -0
  127. package/dist/view/RowSelectionCheckbox.d.ts +10 -0
  128. package/dist/view/SortManagementPanel.d.ts +18 -0
  129. package/dist/view/ToolPanel.d.ts +25 -0
  130. package/dist/view/lazyPopups.d.ts +17 -0
  131. package/dist/view/toolPanelViews.d.ts +4 -0
  132. package/package.json +119 -3
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Yuki Sakakibara
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 CHANGED
@@ -1,3 +1,152 @@
1
- # Temporary Holding Version
1
+ # @ishibashi0112/spreadsheet-grid-solid
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ A virtualized spreadsheet / data grid for Solid 2.0 (~1M rows, pinned columns, Excel-like editing / selection / clipboard, filters & sorting, client-side and server-side row models). It is the Solid version of [`@ishibashi0112/spreadsheet-grid`](https://www.npmjs.com/package/@ishibashi0112/spreadsheet-grid) (React): the same props, column options, imperative handle, CSS and look, built on the same framework-independent core. 日本語は下にあります。
4
+
5
+ **[Docs & live demo](https://datasheet-grid.vercel.app)** (written for the React version; the props are the same. Solid notes, in Japanese: [Solid で使う](https://datasheet-grid.vercel.app/docs/solid)) · [Try on StackBlitz](https://stackblitz.com/fork/github/ishibashi0112/datasheet-grid/tree/main/examples/solid?file=src/App.tsx&terminal=dev) · [GitHub](https://github.com/ishibashi0112/datasheet-grid) · [Changelog](https://github.com/ishibashi0112/datasheet-grid/blob/main/packages/solid/CHANGELOG.md)
6
+
7
+ ## Install
8
+
9
+ ```sh
10
+ npm install @ishibashi0112/spreadsheet-grid-solid
11
+ ```
12
+
13
+ Peer dependencies: `solid-js` / `@solidjs/web` `^2.0.0`. Supported browsers: Chrome / Edge 111+, Firefox 121+, Safari 16.4+. Import the CSS once:
14
+
15
+ ```ts
16
+ import '@ishibashi0112/spreadsheet-grid-solid/style.css'
17
+ ```
18
+
19
+ The package follows the Solid convention for libraries: the `solid` export condition points at JSX source (`dist/source/`), which your bundler compiles with your own Solid settings (DOM or SSR, dev or prod). With Vite, use `@solidjs/vite-plugin` 3 (Vite 8 or later). SSR (for example SolidStart) needs this form. Tools without the `solid` condition get the DOM build (`dist/index.js`, ESM only). In Node (for example tests with Vitest and jsdom), resolve with the `solid` or `browser` condition, which `@solidjs/vite-plugin` sets: with Node's default conditions `@solidjs/web` resolves to its server build and the DOM build fails with "Client-only API called on the server side".
20
+
21
+ `style.layer.css` and the design-system themes (`themes/astryx.css` / `themes/mantine.css` / `themes/heroui.css` / `themes/shadcn.css`) are the same files as in the React version ([installation](https://datasheet-grid.vercel.app/docs/installation), [design systems](https://datasheet-grid.vercel.app/docs/guides/design-systems)).
22
+
23
+ ## Quick start
24
+
25
+ ```tsx
26
+ import { createSignal } from 'solid-js'
27
+ import { SpreadsheetGrid, type GridColumn } from '@ishibashi0112/spreadsheet-grid-solid'
28
+ import '@ishibashi0112/spreadsheet-grid-solid/style.css'
29
+
30
+ type Row = { id: number; name: string }
31
+ const columns: GridColumn<Row>[] = [{ key: 'name', title: 'Name', width: 200, editable: true }]
32
+
33
+ export function App() {
34
+ const [rows, setRows] = createSignal<Row[]>([{ id: 1, name: 'alpha' }])
35
+ return (
36
+ <div style={{ height: '600px' }}>
37
+ <SpreadsheetGrid
38
+ rows={rows()}
39
+ columns={columns}
40
+ onRowsChange={(next) => setRows(next)}
41
+ rowKeyGetter={(row) => row.id}
42
+ height="100%"
43
+ />
44
+ </div>
45
+ )
46
+ }
47
+ ```
48
+
49
+ A runnable example (an editable inventory table with 10,000 rows) is in [`examples/solid`](https://github.com/ishibashi0112/datasheet-grid/tree/main/examples/solid).
50
+
51
+ **English UI:** the grid's own texts default to Japanese. Pass `localeText={localeTextEn}` (`import { localeTextEn } from '@ishibashi0112/spreadsheet-grid-solid/locales/en'`).
52
+
53
+ ## Picking features
54
+
55
+ `SpreadsheetGrid` includes every feature (about 162KB gzip of initial JS; the column filter popover and the tool panel, about 16KB, load later). `createSpreadsheetGrid` builds a grid with only the features you pass, and the rest is left out of your bundle (about 90KB with no features, about 117KB with the `standardFeatures` preset). Unlike the React version, the parts come from the main entry (there is no `/lite`).
56
+
57
+ ```tsx
58
+ import { createSpreadsheetGrid, standardFeatures, serverSideFeature } from '@ishibashi0112/spreadsheet-grid-solid'
59
+
60
+ // Create it once at module level, not inside a component.
61
+ const Grid = createSpreadsheetGrid({ features: { ...standardFeatures, serverSide: serverSideFeature } })
62
+ ```
63
+
64
+ The feature names and what they enable are listed in the React version's `API_REFERENCE.md` (「機能を選んで組み込む」); the part names are the same.
65
+
66
+ ## Differences from the React version
67
+
68
+ - **`ref` works like Solid's DOM refs.** `let grid!: SpreadsheetGridHandle<Row>` with `ref={grid}`, or `ref={(handle) => (grid = handle)}`, gives you the handle with the same methods (there are no React ref objects). The handle is set before your component's first `createEffect` and `onSettled` run, so you can call it there (for example to restore a saved state or scroll to the bottom).
69
+ - **Render functions run only when needed.** `renderCell` runs again when its row, value or column changes, `renderHeader` when its column changes, and the bar renderers when the function changes; not on every update as in React. Positions and states in the context (`rowIndex`, `isActive`, the bar context and so on) are reactive: read them inside JSX and they stay current. Reading them in the function body makes the content re-created whenever they change.
70
+ - **Not available:** the natural-language filter (`/ai`, `GridAskBar`).
71
+ - Everything else (props, column options, handle methods, callbacks, CSS classes and tokens) is the same as in [`API_REFERENCE.md`](https://github.com/ishibashi0112/datasheet-grid/blob/main/packages/react/API_REFERENCE.md) of the React version.
72
+
73
+ ## Solid-specific notes
74
+
75
+ - **Keep `rows` in a signal.** `onRowsChange` returns a new array on every edit (the same contract as the React version). The rows are replaced as a whole, so, following Solid's own split (a signal for values replaced as a whole, a store for nested data updated piece by piece), keep them in a signal and put the array back with `setRows(next)`. In this version, with `createStore` the rows that come back are a store proxy instead of the array the grid returned, so the undo / redo history is cleared, and Solid prints many development diagnostics (the grid warns once in development when `rows` is a store).
76
+ - **Writes apply in a microtask.** After `setRows(...)`, the grid sees the new rows on the next flush. To use a row you just added right away (`getViewRowIndex(key)` then `startEditing(...)`), call `flush()` from `solid-js` first (the React docs use `flushSync` for the same thing). In tests, call `flush()` after changing a signal or firing an event, before looking at the DOM.
77
+ - **Tests (Vitest + jsdom).** Add `@solidjs/vite-plugin` to the Vitest config. Without the plugin, put `browser` in `resolve.conditions`, `ssr.resolve.conditions` and `ssr.resolve.externalConditions` (all three). Use the Solid 2 version of `@solidjs/testing-library` (1.0 release candidates) and `installJsdomLayoutStubs` from `@ishibashi0112/spreadsheet-grid-solid/testing` (jsdom has no layout).
78
+ - **SSR.** SolidStart supports only Solid 1 at the time of writing. With Solid 2, use Vite's SSR with `@solidjs/vite-plugin` (`ssr: true`), `renderToString` or `renderToStream` with `generateHydrationScript` on the server, and `hydrate` on the client (`@solidjs/router` 2 also needs `createRequestEvent` / `provideRequestEvent` from `@solidjs/web/storage`). The server renders only the grid's frame (headers, pinned columns, placeholders); rows are drawn after hydration, as in the React version.
79
+ - **Saving the state in the URL.** Pass the saved state as `initialState` on the first render, save it from `onStateChange`, and apply later changes (back / forward) with `grid.applyState(...)`. Reading signals inside the grid's callbacks is fine; they run outside tracking, like event handlers.
80
+ - **Detail rows.** `detailRow.render` runs once when a row opens; it is not called again when the row changes, and `ctx.row` is the current row. Read `ctx.row` inside JSX to follow edits and undo. A field initialized with `createSignal(() => ctx.row.x)` is reset whenever the row changes, so keep unsaved input in a plain signal.
81
+ - **Sharing props between grids.** Spread a stable object, or write the props out. Spreading an object that is re-created on every change (`{...gridProps()}`) works, but in development Solid reports `HUGE_FAN_OUT`.
82
+ - **Development diagnostics.** In `vite dev`, Solid may print `EFFECT_RELAY_TEAR` / `EFFECT_WRITES_OWN_SOURCE` naming effects such as `autoHeightMeasurer`, `activeRowFollow`, `edit`, `serverSideRowModel` or `fillHandle`. They come from the grid re-aligning its state after a change (the React version re-renders the same way), are harmless, and do not appear in production builds.
83
+
84
+ ## Rules that are easy to get wrong
85
+
86
+ - **Import the CSS.** Without `style.css` the grid is unstyled and its scroll area does not work.
87
+ - **State is controlled.** Edits come back through `onRowsChange` as a new array; pass that array back to `rows` as-is (re-creating it, e.g. with `map`, clears the undo history).
88
+ - **Row keys.** Return a stable key from `rowKeyGetter` (the default is the row index).
89
+ - **Height.** Use the `height` prop. A value containing `%` sizes the whole grid including its bars and needs a parent with a definite height; a number sizes the scroll area only. Without `height`, the scroll area is capped at `480px`.
90
+ - **Positions are view positions.** `viewRowIndex` / `colIndex` are positions after sorting and filtering. Look them up with `getViewRowIndex(rowKey)` / `getColIndex(columnKey)`.
91
+
92
+ ## Versioning
93
+
94
+ This package has its own version (0.x), separate from the React version and the core, and depends on the core of exactly one version. Before 1.0, minor releases may include breaking changes; they are listed in the [changelog](https://github.com/ishibashi0112/datasheet-grid/blob/main/packages/solid/CHANGELOG.md). TypeScript 5.8 or later is supported (`moduleResolution` `bundler` or `nodenext`, `jsx: "preserve"`, `jsxImportSource: "@solidjs/web"`). A library built on this package that exports inferred types should list this package and the core (the version this package depends on) in `peerDependencies`.
95
+
96
+ ## License
97
+
98
+ MIT
99
+
100
+ ---
101
+
102
+ ## 日本語
103
+
104
+ Solid 2.0 向けの仮想化スプレッドシート / データグリッドです(約 100 万行・列固定・Excel ライクな編集 / 選択 / クリップボード・フィルター / ソート・クライアントサイド / サーバーサイド行モデル)。React 版の [`@ishibashi0112/spreadsheet-grid`](https://www.npmjs.com/package/@ishibashi0112/spreadsheet-grid) と同じ props・列の定義・命令的なハンドル・CSS・見た目で、同じフレームワークに依らないコアの上に作っています。
105
+
106
+ **[ドキュメントとライブデモ](https://datasheet-grid.vercel.app)**(React 版向けに書いていますが、props は同じです。Solid 版だけのことは [Solid で使う](https://datasheet-grid.vercel.app/docs/solid))· [StackBlitz で試す](https://stackblitz.com/fork/github/ishibashi0112/datasheet-grid/tree/main/examples/solid?file=src/App.tsx&terminal=dev) · [GitHub](https://github.com/ishibashi0112/datasheet-grid) · [変更履歴](https://github.com/ishibashi0112/datasheet-grid/blob/main/packages/solid/CHANGELOG.md)
107
+
108
+ `npm install @ishibashi0112/spreadsheet-grid-solid` で入れます(peer は `solid-js` / `@solidjs/web` の `^2.0.0`)。CSS は `import '@ishibashi0112/spreadsheet-grid-solid/style.css'` を 1 回読み込みます。`style.layer.css` とデザインシステムのテーマ(`themes/*.css`)は React 版と同じファイルです。
109
+
110
+ パッケージは Solid のライブラリの慣例どおり、`solid` 条件で JSX のままのソース(`dist/source/`)を渡し、利用側のバンドラが自分の Solid の設定(DOM / SSR・開発 / 本番)でコンパイルします。Vite では `@solidjs/vite-plugin` 3(Vite 8 以上)を使ってください。SSR(SolidStart など)はこの形が要ります。`solid` 条件の無いツールは DOM 向けにコンパイル済みの `dist/index.js`(ESM だけ)を読みます。Node の中(Vitest と jsdom のテストなど)では `solid` か `browser` の条件で解決してください(`@solidjs/vite-plugin` が付けます)。Node の既定の条件では `@solidjs/web` がサーバー向けのビルドになり、DOM 向けのビルドは「Client-only API called on the server side」で止まります。
111
+
112
+ 使い方は上の Quick start のとおりです(`rows={rows()}` のように signal を呼んで渡し、編集は `onRowsChange` で受け取って signal へ戻す)。ブラウザで動かせるサンプル(編集できる在庫表 10,000 行)は [`examples/solid`](https://github.com/ishibashi0112/datasheet-grid/tree/main/examples/solid) にあります。英語の文言は `@ishibashi0112/spreadsheet-grid-solid/locales/en` の `localeTextEn` を `localeText` に渡します。
113
+
114
+ 対応ブラウザは Chrome / Edge 111 以降、Firefox 121 以降、Safari 16.4 以降です。
115
+
116
+ ### 機能を選んで組み込む
117
+
118
+ `SpreadsheetGrid` は全機能入りです(初期読み込みの JS が約 162KB gzip。列フィルターのポップオーバーとツールパネルの約 16KB は後から読みます)。`createSpreadsheetGrid` では渡した機能だけを入れたグリッドを作れ、渡さなかった機能はバンドルに入りません(機能なしで約 90KB、プリセット `standardFeatures` で約 117KB)。React 版と違い、機能の部品も同じ入口から import します(`/lite` はありません)。機能の名前と中身は React 版の `API_REFERENCE.md` の「機能を選んで組み込む」のとおりです(部品の名前も同じ)。グリッドはコンポーネントの中ではなく、モジュールの先頭で 1 回だけ作ってください。
119
+
120
+ ### React 版との違い
121
+
122
+ - **`ref` は Solid の DOM の ref と同じです。** `let grid!: SpreadsheetGridHandle<Row>` と `ref={grid}`、または `ref={(handle) => (grid = handle)}` で、同じメソッドを持つハンドルを受け取れます(React の ref オブジェクトはありません)。ハンドルは利用側の部品の最初の `createEffect` と `onSettled` より前に入るので、そこで呼べます(保存した状態を戻す、末尾へスクロールする など)。
123
+ - **描く関数は必要なときだけ呼びます。** `renderCell` は行・値・列が変わったとき、`renderHeader` は列が変わったとき、バーの関数は関数が変わったときだけ呼び直します(React 版のように更新のたびには呼びません)。文脈の位置と状態(`rowIndex` / `isActive` / バーの文脈など)は読んだときに引くので、JSX の中で読めば追従します。関数の本体で読むと、それが変わるたびに中身を作り直します。
124
+ - **ありません:** ことばで絞り込み(`/ai` の `GridAskBar`)。
125
+ - そのほか(props・列の定義・ハンドルのメソッド・通知・CSS のクラスとトークン)は React 版の [`API_REFERENCE.md`](https://github.com/ishibashi0112/datasheet-grid/blob/main/packages/react/API_REFERENCE.md) と同じです。
126
+
127
+ ### Solid で気をつけること
128
+
129
+ - **`rows` は signal で持つ。** `onRowsChange` は編集のたびに新しい配列を返します(React 版と同じ約束)。行は配列ごと差し替わるので、Solid の使い分け(丸ごと差し替える値は signal、中を少しずつ書き換える入れ子のデータは store)どおり signal で持ち、`setRows(next)` で戻してください。今の版では `createStore` に入れると、戻ってくる rows がグリッドの返した配列ではなく store のプロキシになるので、元に戻す / やり直しの履歴が消え、開発時に Solid の知らせが多く出ます(`rows` が store のときは開発時に 1 回警告します)。
130
+ - **書き込みはマイクロタスクで反映されます。** `setRows(...)` の後、グリッドが新しい行を見るのは次の反映のときです。足したばかりの行をすぐ使う(`getViewRowIndex(key)` → `startEditing(...)`)ときは、先に `solid-js` の `flush()` を呼んでください(React 版のドキュメントの `flushSync` と同じ)。テストでも、signal を変えた・イベントを送った後に DOM を見る前に `flush()` を呼びます。
131
+ - **テスト(Vitest + jsdom)。** Vitest の設定に `@solidjs/vite-plugin` を入れてください。プラグイン無しなら `browser` を `resolve.conditions` / `ssr.resolve.conditions` / `ssr.resolve.externalConditions` の 3 か所すべてに書きます。`@solidjs/testing-library` は Solid 2 向けの版(1.0 の候補版)を使い、jsdom にはレイアウトが無いので `@ishibashi0112/spreadsheet-grid-solid/testing` の `installJsdomLayoutStubs` を呼びます。
132
+ - **SSR。** 今の SolidStart は Solid 1 だけに対応しています。Solid 2 では Vite の SSR と `@solidjs/vite-plugin`(`ssr: true`)で、サーバーは `renderToString` か `renderToStream` と `generateHydrationScript`、クライアントは `hydrate` を使います(`@solidjs/router` 2 は `@solidjs/web/storage` の `createRequestEvent` / `provideRequestEvent` も要ります)。サーバーで描くのはグリッドの骨組み(見出し・固定列・読み込み中の印)だけで、行はハイドレーションの後に描きます(React 版と同じ)。
133
+ - **状態を URL に残す。** 保存した状態は最初の描画で `initialState` に渡し、`onStateChange` で保存し、後からの変化(戻る / 進む)は `grid.applyState(...)` で入れます。グリッドの通知の中で signal を読んでかまいません(イベントのハンドラと同じく追跡の外で呼びます)。
134
+ - **展開行。** `detailRow.render` は行を開いたときに 1 回呼び、行が変わっても呼び直しません(`ctx.row` が今の行)。編集や元に戻すに追従するには JSX の中で `ctx.row` を読んでください。`createSignal(() => ctx.row.x)` で持った入力欄の値は行が変わるたびに戻るので、保存前の入力はふつうの signal で持ちます。
135
+ - **複数のグリッドで props を共有する。** 変わらないオブジェクトを spread するか、props を書き並べてください。変化のたびに作り直すオブジェクトを spread しても(`{...gridProps()}`)動きますが、開発時に Solid が `HUGE_FAN_OUT` を出します。
136
+ - **開発時の Solid の知らせ。** `vite dev` では、Solid が `autoHeightMeasurer` / `activeRowFollow` / `edit` / `serverSideRowModel` / `fillHandle` などの effect の名前で `EFFECT_RELAY_TEAR` / `EFFECT_WRITES_OWN_SOURCE` を出すことがあります。変化の後にグリッドが状態を合わせ直す処理(React 版も同じ描き直しをしている)で、害は無く、本番のビルドでは出ません。
137
+
138
+ ### 間違えやすいルール
139
+
140
+ - **CSS を読み込む。** `style.css` が無いとスタイルが当たらず、スクロール領域も機能しません。
141
+ - **状態は controlled。** 編集結果は `onRowsChange` が新しい配列で返します。受け取った配列をそのまま `rows` へ戻してください(`map` 等で作り直すと undo 履歴が消えます)。
142
+ - **行キー。** `rowKeyGetter` で安定したキーを返してください(既定は行 index)。
143
+ - **高さ。** `height` prop で指定します。`%` を含む値はバーを含むグリッド全体の高さで、親要素に確定高さが必要です。数値はスクロール領域だけの高さです。`height` 未指定時のスクロール領域は `480px` が上限です。
144
+ - **位置は表示の位置。** `viewRowIndex` / `colIndex` は並べ替え・絞り込みの後の表示の位置です。`getViewRowIndex(rowKey)` / `getColIndex(columnKey)` で引いてください。
145
+
146
+ ### バージョンの方針
147
+
148
+ このパッケージは React 版・コアとは別の版(0.x)で、コアには同じ 1 つの版で依存します。1.0 より前は minor でも壊す変更が入ることがあり、[変更履歴](https://github.com/ishibashi0112/datasheet-grid/blob/main/packages/solid/CHANGELOG.md)に書きます。TypeScript は 5.8 以上(`moduleResolution` は `bundler` / `nodenext`、`jsx: "preserve"`・`jsxImportSource: "@solidjs/web"`)です。このパッケージの上に作ったライブラリが推論した型を export するときは、このパッケージと core(このパッケージが依存する版)を `peerDependencies` に入れてください。
149
+
150
+ ## License
151
+
152
+ MIT