grist-widget-sdk 0.3.27 → 0.5.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 (88) hide show
  1. package/CHANGELOG.md +84 -0
  2. package/README.md +79 -208
  3. package/dist/app.cjs +1336 -4415
  4. package/dist/app.cjs.map +1 -1
  5. package/dist/app.d.cts +6 -103
  6. package/dist/app.d.ts +6 -103
  7. package/dist/app.js +5 -7
  8. package/dist/chunk-4ZGVKGDF.js +204 -0
  9. package/dist/chunk-4ZGVKGDF.js.map +1 -0
  10. package/dist/{chunk-6Y2IONGJ.js → chunk-LSALXIGM.js} +191 -20
  11. package/dist/chunk-LSALXIGM.js.map +1 -0
  12. package/dist/chunk-MAPAWVQC.js +1898 -0
  13. package/dist/chunk-MAPAWVQC.js.map +1 -0
  14. package/dist/{chunk-YQNMIL33.js → chunk-OXA2VITC.js} +532 -181
  15. package/dist/chunk-OXA2VITC.js.map +1 -0
  16. package/dist/define-widget-B1FIvI-h.d.cts +433 -0
  17. package/dist/define-widget-B9gEtJP0.d.ts +433 -0
  18. package/dist/emulator/testing.cjs +3341 -6512
  19. package/dist/emulator/testing.cjs.map +1 -1
  20. package/dist/emulator/testing.d.cts +29 -14
  21. package/dist/emulator/testing.d.ts +29 -14
  22. package/dist/emulator/testing.js +78 -72
  23. package/dist/emulator/testing.js.map +1 -1
  24. package/dist/emulator.cjs +63 -249
  25. package/dist/emulator.cjs.map +1 -1
  26. package/dist/emulator.d.cts +6 -8
  27. package/dist/emulator.d.ts +6 -8
  28. package/dist/emulator.js +5 -11
  29. package/dist/index.cjs +1442 -4862
  30. package/dist/index.cjs.map +1 -1
  31. package/dist/index.d.cts +81 -260
  32. package/dist/index.d.ts +81 -260
  33. package/dist/index.js +12 -158
  34. package/dist/mount-grist-widget-CkB-3iG_.d.ts +137 -0
  35. package/dist/mount-grist-widget-Dtelqao_.d.cts +137 -0
  36. package/dist/{inline-DpcT8tV9.d.ts → templates-CGmRIQBV.d.cts} +89 -35
  37. package/dist/{inline-C7DkvuET.d.cts → templates-Cq94qOcf.d.ts} +89 -35
  38. package/dist/{types-D3JxUCfL.d.cts → types-DBStn0Dk.d.cts} +2 -26
  39. package/dist/{types-D3JxUCfL.d.ts → types-DBStn0Dk.d.ts} +2 -26
  40. package/package.json +8 -37
  41. package/dist/advanced.cjs +0 -2799
  42. package/dist/advanced.cjs.map +0 -1
  43. package/dist/advanced.d.cts +0 -822
  44. package/dist/advanced.d.ts +0 -822
  45. package/dist/advanced.js +0 -872
  46. package/dist/advanced.js.map +0 -1
  47. package/dist/chunk-22U7WAY3.js +0 -463
  48. package/dist/chunk-22U7WAY3.js.map +0 -1
  49. package/dist/chunk-64SVRWW7.js +0 -758
  50. package/dist/chunk-64SVRWW7.js.map +0 -1
  51. package/dist/chunk-6Y2IONGJ.js.map +0 -1
  52. package/dist/chunk-B4AKVSWV.js +0 -2362
  53. package/dist/chunk-B4AKVSWV.js.map +0 -1
  54. package/dist/chunk-ELGVOHFD.js +0 -32
  55. package/dist/chunk-ELGVOHFD.js.map +0 -1
  56. package/dist/chunk-GTTD5HPO.js +0 -36
  57. package/dist/chunk-GTTD5HPO.js.map +0 -1
  58. package/dist/chunk-NO6FYX33.js +0 -2084
  59. package/dist/chunk-NO6FYX33.js.map +0 -1
  60. package/dist/chunk-OPTOYD2Y.js +0 -277
  61. package/dist/chunk-OPTOYD2Y.js.map +0 -1
  62. package/dist/chunk-PM3B4WYV.js +0 -12
  63. package/dist/chunk-PM3B4WYV.js.map +0 -1
  64. package/dist/chunk-REV5AUXD.js +0 -25
  65. package/dist/chunk-REV5AUXD.js.map +0 -1
  66. package/dist/chunk-YQNMIL33.js.map +0 -1
  67. package/dist/create-grist-emulator-BCqp1BF9.d.ts +0 -81
  68. package/dist/create-grist-emulator-DBM8OSIR.d.cts +0 -81
  69. package/dist/emulator/devtools.cjs +0 -1404
  70. package/dist/emulator/devtools.cjs.map +0 -1
  71. package/dist/emulator/devtools.d.cts +0 -48
  72. package/dist/emulator/devtools.d.ts +0 -48
  73. package/dist/emulator/devtools.js +0 -506
  74. package/dist/emulator/devtools.js.map +0 -1
  75. package/dist/emulator/transports.cjs +0 -1132
  76. package/dist/emulator/transports.cjs.map +0 -1
  77. package/dist/emulator/transports.d.cts +0 -38
  78. package/dist/emulator/transports.d.ts +0 -38
  79. package/dist/emulator/transports.js +0 -12
  80. package/dist/emulator/transports.js.map +0 -1
  81. package/dist/templates-8k2LKoO-.d.cts +0 -24
  82. package/dist/templates-DIwi_mvI.d.ts +0 -24
  83. package/dist/use-grist-reads-DUMvJgV7.d.ts +0 -480
  84. package/dist/use-grist-reads-DpjVuI0H.d.cts +0 -480
  85. package/dist/use-grist-types-DdOLEJXN.d.cts +0 -499
  86. package/dist/use-grist-types-kwxoFeub.d.ts +0 -499
  87. package/dist/use-grist-widget-options-from-context-CGOlQ5Vc.d.cts +0 -43
  88. package/dist/use-grist-widget-options-from-context-CGOlQ5Vc.d.ts +0 -43
@@ -86,7 +86,7 @@ type GristColumnToMap = {
86
86
  strictType?: boolean;
87
87
  };
88
88
  /** Argument shape for `grist.ready({ columns })`. */
89
- type GristColumnsToMap = Array<string | GristColumnToMap>;
89
+ type GristColumnsToMap = ReadonlyArray<string | GristColumnToMap>;
90
90
  /**
91
91
  * Mapping returned by Grist between logical widget column names and real table column ids.
92
92
  * Single mappings are `string`; `allowMultiple` columns are `string[]`.
@@ -103,12 +103,6 @@ type GristReadyOptions = {
103
103
  allowSelectBy?: boolean;
104
104
  hasCustomOptions?: boolean;
105
105
  onEditOptions?: () => void | Promise<void>;
106
- /** Passed to availability detection (default 10). */
107
- availabilityMaxAttempts?: number;
108
- /** Ms between availability polls (default 1000). */
109
- availabilityIntervalMs?: number;
110
- /** Log when the page is not iframe-embedded (default false). */
111
- logWhenNotEmbedded?: boolean;
112
106
  };
113
107
  /** Optional second argument to `docApi.applyUserActions`. */
114
108
  type GristApplyUserActionsOptions = {
@@ -206,23 +200,5 @@ type GristTableOperations = {
206
200
  upsert: (records: GristTableUpsertRecord | GristTableUpsertRecord[], options?: GristTableUpsertOptions) => Promise<void>;
207
201
  destroy: (recordIds: number | number[]) => Promise<void>;
208
202
  };
209
- /** Subset of `grist.docApi` from https://docs.getgrist.com/grist-plugin-api.js */
210
- type GristDocApi = {
211
- getDocName: () => Promise<string> | string;
212
- listTables: () => Promise<string[]> | string[];
213
- fetchTable: (tableId: string) => Promise<Record<string, unknown[]>>;
214
- applyUserActions: (actions: unknown[][], options?: GristApplyUserActionsOptions) => Promise<unknown>;
215
- /** Present when the widget requested sufficient access (e.g. full). */
216
- getAccessToken?: (options?: {
217
- readOnly?: boolean;
218
- }) => Promise<{
219
- token: string;
220
- baseUrl: string;
221
- }>;
222
- /** Current section's table data (often smaller than {@link fetchTable} for the whole table). */
223
- fetchSelectedTable?: (options?: GristFetchSelectedOptions) => Promise<Record<string, unknown[]>>;
224
- /** Single row in the current section by numeric row id. */
225
- fetchSelectedRecord?: (rowId: number, options?: GristFetchSelectedOptions) => Promise<Record<string, unknown>>;
226
- };
227
203
 
228
- export type { GristRowRecord as G, GristReplicaTable as a, GristReplicaDocument as b, GristReplicaColumn as c, GristWidgetColumnMap as d, GristCursorPos as e, GristWidgetInteraction as f, GristReplicaSelection as g, GristWidgetConfiguration as h, GristReadyOptions as i, GristFetchSelectedOptions as j, GristTableOperations as k, GristFormulaKind as l, GristReplicaRow as m, GristRequiredAccess as n, GristDocumentMode as o, GristApplyUserActionsOptions as p, GristColumnToMap as q, GristColumnsToMap as r, GristDocApi as s, GristMinimalRecord as t, GristTableNewRecord as u, GristTableOpOptions as v, GristTableUpdateRecord as w, GristTableUpsertOptions as x, GristTableUpsertRecord as y, GristWidgetLinkingInfo as z };
204
+ export type { GristReplicaDocument as G, GristReplicaTable as a, GristWidgetColumnMap as b, GristCursorPos as c, GristWidgetInteraction as d, GristReplicaColumn as e, GristRowRecord as f, GristReplicaSelection as g, GristWidgetConfiguration as h, GristReadyOptions as i, GristFetchSelectedOptions as j, GristTableOperations as k, GristRequiredAccess as l, GristDocumentMode as m, GristFormulaKind as n, GristApplyUserActionsOptions as o, GristColumnToMap as p, GristColumnsToMap as q, GristReplicaRow as r };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "grist-widget-sdk",
3
- "version": "0.3.27",
3
+ "version": "0.5.0",
4
4
  "description": "React hooks and helpers for Grist custom widgets",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -40,16 +40,6 @@
40
40
  "default": "./dist/index.cjs"
41
41
  }
42
42
  },
43
- "./advanced": {
44
- "import": {
45
- "types": "./dist/advanced.d.ts",
46
- "default": "./dist/advanced.js"
47
- },
48
- "require": {
49
- "types": "./dist/advanced.d.cts",
50
- "default": "./dist/advanced.cjs"
51
- }
52
- },
53
43
  "./app": {
54
44
  "import": {
55
45
  "types": "./dist/app.d.ts",
@@ -70,16 +60,6 @@
70
60
  "default": "./dist/emulator.cjs"
71
61
  }
72
62
  },
73
- "./emulator/transports": {
74
- "import": {
75
- "types": "./dist/emulator/transports.d.ts",
76
- "default": "./dist/emulator/transports.js"
77
- },
78
- "require": {
79
- "types": "./dist/emulator/transports.d.cts",
80
- "default": "./dist/emulator/transports.cjs"
81
- }
82
- },
83
63
  "./emulator/testing": {
84
64
  "import": {
85
65
  "types": "./dist/emulator/testing.d.ts",
@@ -90,16 +70,6 @@
90
70
  "default": "./dist/emulator/testing.cjs"
91
71
  }
92
72
  },
93
- "./emulator/devtools": {
94
- "import": {
95
- "types": "./dist/emulator/devtools.d.ts",
96
- "default": "./dist/emulator/devtools.js"
97
- },
98
- "require": {
99
- "types": "./dist/emulator/devtools.d.cts",
100
- "default": "./dist/emulator/devtools.cjs"
101
- }
102
- },
103
73
  "./tsconfig/app.json": "./tsconfig/app.json",
104
74
  "./tsconfig/node.json": "./tsconfig/node.json"
105
75
  },
@@ -118,22 +88,22 @@
118
88
  "@testing-library/dom": "^10",
119
89
  "@testing-library/jest-dom": "^7.0.1",
120
90
  "@testing-library/react": "^16.3.3",
121
- "@types/node": "^26.6.5",
91
+ "@types/node": "^26.6.6",
122
92
  "@types/react": "^19.3.0",
123
93
  "@types/react-dom": "^19.3.0",
124
- "@vitejs/plugin-react": "^6.1.2",
125
- "@vitest/coverage-v8": "^5.0.5",
94
+ "@vitejs/plugin-react": "^6.2.1",
95
+ "@vitest/coverage-v8": "^5.1.0",
126
96
  "eslint": "^10.13.0",
127
97
  "eslint-plugin-react-hooks": "^7.1.1",
128
98
  "fast-check": "^4.10.2",
129
- "globals": "^17.13.0",
99
+ "globals": "^17.14.0",
130
100
  "grist-plugin-api": "^0.0.1",
131
101
  "jsdom": "^30.1.3",
132
102
  "tsup": "^9.0.0",
133
103
  "typescript": "^6.0.3",
134
- "typescript-eslint": "^8.72.0",
104
+ "typescript-eslint": "^8.72.1",
135
105
  "vite": "^8.3.5",
136
- "vitest": "^5.0.5"
106
+ "vitest": "^5.1.0"
137
107
  },
138
108
  "dependencies": {
139
109
  "grain-rpc": "^0.1.7",
@@ -147,6 +117,7 @@
147
117
  "test:emulator": "vitest --run --project emulator --passWithNoTests",
148
118
  "test:coverage": "vitest --run --project unit --project emulator --coverage",
149
119
  "bench": "vitest run --project bench",
120
+ "bench:update": "BENCH_UPDATE=1 vitest run --project bench",
150
121
  "typecheck": "tsc -p tsconfig.json --noEmit && tsc -p tsconfig.vitest.json --noEmit",
151
122
  "lint": "eslint ."
152
123
  }