@constructive-io/sheets 0.4.1 → 0.6.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.
Files changed (50) hide show
  1. package/README.md +19 -24
  2. package/dist/advanced.cjs +250 -405
  3. package/dist/advanced.cjs.map +1 -1
  4. package/dist/advanced.d.cts +9 -10
  5. package/dist/advanced.d.ts +9 -10
  6. package/dist/advanced.js +3 -3
  7. package/dist/auth.cjs +10 -10
  8. package/dist/auth.cjs.map +1 -1
  9. package/dist/auth.d.cts +5 -4
  10. package/dist/auth.d.ts +5 -4
  11. package/dist/auth.js +3 -3
  12. package/dist/{chunk-GLVZSPV2.js → chunk-4EZ6A23C.js} +4 -3
  13. package/dist/chunk-4EZ6A23C.js.map +1 -0
  14. package/dist/{chunk-3BNOZQIJ.js → chunk-KKAWMVEG.js} +11 -11
  15. package/dist/chunk-KKAWMVEG.js.map +1 -0
  16. package/dist/{chunk-FG2LRZP5.js → chunk-KOZAW264.js} +4 -3
  17. package/dist/chunk-KOZAW264.js.map +1 -0
  18. package/dist/{chunk-BWJVRYJT.js → chunk-KVPVEXWB.js} +40 -17
  19. package/dist/chunk-KVPVEXWB.js.map +1 -0
  20. package/dist/{chunk-BWKB52JB.js → chunk-LR64FLWO.js} +231 -379
  21. package/dist/chunk-LR64FLWO.js.map +1 -0
  22. package/dist/{chunk-SDKHWE7G.js → chunk-ZETPUEXH.js} +27 -2
  23. package/dist/chunk-ZETPUEXH.js.map +1 -0
  24. package/dist/{date-editor-CXKKGNL6.js → date-editor-QT47WY5T.js} +5 -3
  25. package/dist/date-editor-QT47WY5T.js.map +1 -0
  26. package/dist/{editor-props-M6Dh0P9f.d.ts → grid-cell-types-C3ARj148.d.cts} +70 -62
  27. package/dist/{editor-props-M6Dh0P9f.d.cts → grid-cell-types-C3ARj148.d.ts} +70 -62
  28. package/dist/index.cjs +564 -493
  29. package/dist/index.cjs.map +1 -1
  30. package/dist/index.d.cts +86 -35
  31. package/dist/index.d.ts +86 -35
  32. package/dist/index.js +264 -72
  33. package/dist/index.js.map +1 -1
  34. package/dist/{sheets-context-9u9r7Bs0.d.ts → sheets-context-B03WDhZ9.d.cts} +13 -6
  35. package/dist/{sheets-context-BjGIHocT.d.cts → sheets-context-DmVCOgiX.d.ts} +13 -6
  36. package/dist/styles.css +6 -0
  37. package/dist/testing.cjs +99 -33
  38. package/dist/testing.cjs.map +1 -1
  39. package/dist/testing.d.cts +11 -7
  40. package/dist/testing.d.ts +11 -7
  41. package/dist/testing.js +34 -8
  42. package/dist/testing.js.map +1 -1
  43. package/package.json +15 -16
  44. package/dist/chunk-3BNOZQIJ.js.map +0 -1
  45. package/dist/chunk-BWJVRYJT.js.map +0 -1
  46. package/dist/chunk-BWKB52JB.js.map +0 -1
  47. package/dist/chunk-FG2LRZP5.js.map +0 -1
  48. package/dist/chunk-GLVZSPV2.js.map +0 -1
  49. package/dist/chunk-SDKHWE7G.js.map +0 -1
  50. package/dist/date-editor-CXKKGNL6.js.map +0 -1
package/README.md CHANGED
@@ -1,27 +1,28 @@
1
1
  # @constructive-io/sheets
2
2
 
3
- Portable spreadsheet-like CRUD editor for PostGraphile backends. Drop-in React component that provides a full-featured data grid with filtering, pagination, cell editing, draft rows, relation handling, and standalone authentication.
3
+ Portable spreadsheet-like CRUD editor for Constructive/PostGraphile backends. The package provides a native DOM grid with filtering, pagination, cell editing, draft rows, relation handling, and standalone authentication.
4
4
 
5
5
  ## Requirements
6
6
 
7
- - **Backend**: Constructive server (`cnc server`) or PostGraphile v5 with the `_meta` introspection plugin
7
+ - **Backend**: Constructive server (`cnc server`) exposing the `2026-07` `_meta` contract
8
8
  - **Frontend**: React 18+, Tailwind CSS v4
9
9
 
10
10
  ## Install
11
11
 
12
12
  ```bash
13
13
  npm install @constructive-io/sheets @constructive-io/data @constructive-io/ui \
14
- @glideapps/glide-data-grid @tanstack/react-query @tanstack/react-form
14
+ @tanstack/react-query @tanstack/react-form
15
15
  ```
16
16
 
17
+ `lucide-react` and `@remixicon/react` are runtime dependencies of Sheets and
18
+ are installed transitively.
19
+
17
20
  ### Optional peer dependencies
18
21
 
19
22
  | Package | For |
20
23
  |---------|-----|
21
24
  | `leaflet` + `react-leaflet` | Geometry/map editors |
22
25
  | `react-aria-components` + `@internationalized/date` | Date picker editors |
23
- | `lucide-react` | Icons |
24
- | `@remixicon/react` | Icons |
25
26
 
26
27
  ## Quick Start
27
28
 
@@ -32,6 +33,7 @@ import {
32
33
  SheetsProvider, Sheets, SheetsTableSelector,
33
34
  SheetsAuthGate, useSheetsMeta,
34
35
  } from '@constructive-io/sheets';
36
+ import { selectConsoleDataTables } from '@constructive-io/data';
35
37
 
36
38
  function SpreadsheetApp() {
37
39
  const [activeTable, setActiveTable] = useState('');
@@ -40,10 +42,7 @@ function SpreadsheetApp() {
40
42
  const tables = useMemo(() => {
41
43
  const metaTables = meta?._meta?.tables;
42
44
  if (!metaTables?.length) return [];
43
- return metaTables
44
- .filter((t): t is NonNullable<typeof t> => Boolean(t?.name))
45
- .map((t) => ({ name: t.name }))
46
- .sort((a, b) => a.name.localeCompare(b.name));
45
+ return selectConsoleDataTables(metaTables).map(({ name }) => ({ name }));
47
46
  }, [meta?._meta?.tables]);
48
47
 
49
48
  return (
@@ -85,6 +84,9 @@ function MySpreadsheet() {
85
84
  auth: {
86
85
  mode: 'embedded',
87
86
  getToken: () => localStorage.getItem('my-jwt-token'),
87
+ // A stable user/session id isolates the React Query cache without
88
+ // putting the bearer token into query keys or devtools.
89
+ getIdentityKey: () => currentUser.id,
88
90
  },
89
91
  onAuthError: () => {
90
92
  // Handle 401 — clear tokens, redirect to login, etc.
@@ -98,7 +100,7 @@ function MySpreadsheet() {
98
100
 
99
101
  ## CSS Setup
100
102
 
101
- Sheets requires Tailwind CSS v4 and the glide-data-grid styles.
103
+ Sheets requires Tailwind CSS v4.
102
104
 
103
105
  ### 1. Install Tailwind v4
104
106
 
@@ -112,22 +114,14 @@ npm install tailwindcss @tailwindcss/postcss
112
114
  /* globals.css */
113
115
  @import 'tailwindcss';
114
116
  @import '@constructive-io/ui/globals.css';
115
-
116
- /* Scan sheets + ui packages for Tailwind classes */
117
- @source "../node_modules/@constructive-io/ui/src";
118
- @source "../node_modules/@constructive-io/sheets/src";
119
- ```
120
-
121
- Then import the glide-data-grid CSS in your layout or entry component (not in the Tailwind CSS file):
122
-
123
- ```tsx
124
- // app/layout.tsx
125
- import '@glideapps/glide-data-grid/dist/index.css';
117
+ @import '@constructive-io/sheets/styles.css';
126
118
  ```
127
119
 
128
- ### 3. Add the portal element
120
+ The Sheets stylesheet is a Tailwind v4 source contract: it scans the shipped
121
+ JavaScript in `dist`, so consumers do not depend on unpublished package source.
122
+ The UI stylesheet carries its own source and theme contract.
129
123
 
130
- Glide Data Grid renders overlay editors into a portal. Add this as the last child of `<body>` in your root layout:
124
+ Overlay editors render into a portal. Add this as the last child of `<body>` in your root layout:
131
125
 
132
126
  ```tsx
133
127
  // app/layout.tsx
@@ -137,7 +131,7 @@ Glide Data Grid renders overlay editors into a portal. Add this as the last chil
137
131
  </body>
138
132
  ```
139
133
 
140
- Without this, cell editors (date pickers, relation selectors, JSON editors, etc.) won't open.
134
+ Without this, overlay editors such as date, relation, and JSON editors won't open.
141
135
 
142
136
  ## Configuration
143
137
 
@@ -147,6 +141,7 @@ The `SheetsConfig` object passed to `<SheetsProvider>`:
147
141
  |------|------|----------|-------------|
148
142
  | `endpoint` | `string` | Yes | PostGraphile GraphQL endpoint URL |
149
143
  | `auth` | `SheetsAuthEmbedded \| SheetsAuthStandalone` | Yes | Auth mode |
144
+ | `auth.getIdentityKey` | `() => string \| null` | Embedded | Stable non-secret user/session cache identity; an opaque token-generation key is used when omitted |
150
145
  | `authEndpoint` | `string` | No | Separate auth GraphQL endpoint |
151
146
  | `databaseId` | `string` | No | Multi-tenant database scope |
152
147
  | `fieldTypeOverrides` | `Record<string, string>` | No | Override detected field types |