grist-widget-sdk 0.3.17 → 0.3.25

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 (40) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/advanced.cjs +1 -5
  3. package/dist/advanced.cjs.map +1 -1
  4. package/dist/advanced.d.cts +6 -4
  5. package/dist/advanced.d.ts +6 -4
  6. package/dist/advanced.js +2 -2
  7. package/dist/{chunk-OTIHUVSE.js → chunk-EPEBKXVN.js} +3 -7
  8. package/dist/chunk-EPEBKXVN.js.map +1 -0
  9. package/dist/{chunk-D5GBS2NT.js → chunk-TZB3OZA6.js} +1 -1
  10. package/dist/chunk-TZB3OZA6.js.map +1 -0
  11. package/dist/{create-grist-emulator-DBS6gmiI.d.cts → create-grist-emulator-K-iUKUCZ.d.cts} +4 -3
  12. package/dist/{create-grist-emulator-C_0I4wax.d.ts → create-grist-emulator-_3_JK7Rr.d.ts} +4 -3
  13. package/dist/emulator/devtools.d.cts +6 -4
  14. package/dist/emulator/devtools.d.ts +6 -4
  15. package/dist/emulator/testing.d.cts +6 -5
  16. package/dist/emulator/testing.d.ts +6 -5
  17. package/dist/emulator/testing.js +1 -1
  18. package/dist/emulator/transports.d.cts +5 -4
  19. package/dist/emulator/transports.d.ts +5 -4
  20. package/dist/emulator.d.cts +9 -7
  21. package/dist/emulator.d.ts +9 -7
  22. package/dist/index.cjs +1 -5
  23. package/dist/index.cjs.map +1 -1
  24. package/dist/index.d.cts +13 -7
  25. package/dist/index.d.ts +13 -7
  26. package/dist/index.js +2 -2
  27. package/dist/index.js.map +1 -1
  28. package/dist/{inline-QitZwXKP.d.ts → inline-A8yaddmp.d.cts} +3 -2
  29. package/dist/{inline-CRwQQ-GW.d.cts → inline-B7QQeWul.d.ts} +3 -2
  30. package/dist/{templates-DBq719O_.d.cts → templates-CB_VwjEU.d.cts} +1 -1
  31. package/dist/{templates-BC7FoSdW.d.ts → templates-pRIXc2RR.d.ts} +1 -1
  32. package/dist/{types-Fb2wplkv.d.ts → types-YcRfo7oy.d.cts} +1 -1
  33. package/dist/{types-Fb2wplkv.d.cts → types-YcRfo7oy.d.ts} +1 -1
  34. package/dist/{use-grist-widget-options-from-context-BFhQBGRY.d.ts → use-grist-widget-options-from-context-Bbd5-f39.d.cts} +5 -6
  35. package/dist/{use-grist-widget-options-from-context-qpFMdoBJ.d.cts → use-grist-widget-options-from-context-hl-NwOwP.d.ts} +5 -6
  36. package/package.json +9 -6
  37. package/tsconfig/app.json +38 -0
  38. package/tsconfig/node.json +36 -0
  39. package/dist/chunk-D5GBS2NT.js.map +0 -1
  40. package/dist/chunk-OTIHUVSE.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # grist-widget-sdk
2
2
 
3
+ ## 0.3.25
4
+
5
+ ### Patch Changes
6
+
7
+ - bbcca4d: New: shared TypeScript settings for widgets, to `extends` from a widget's own tsconfig files. `grist-widget-sdk/tsconfig/app.json` covers the browser code in `src/` (bundler resolution, `react-jsx`, `strict` and the unused-code checks); `grist-widget-sdk/tsconfig/node.json` covers `vite.config.ts`. Both are the settings scaffolded widgets have used so far, so a compiler-setting change can now reach widgets with an SDK update instead of a hand edit in each one. They need TypeScript 5.8 or later. A change that makes a check stricter can fail a widget's typecheck, so it only ships in a minor release.
8
+
9
+ ## 0.3.20
10
+
11
+ ### Patch Changes
12
+
13
+ - 87d98f0: Fix declaration emit for code that wraps SDK hooks. A library compiled with `declaration: true` that re-exported `useGristStatus()` or `useGristHandshake().status` with an inferred type failed with TS2883 (TS2742 before TypeScript 6), "cannot be named without a reference to '…/dist/use-grist-widget-options-from-context-…'", because those signatures reached types that only a private build chunk exported.
14
+
15
+ The types involved are now public: `UseGristStatusResult`, `UseGristSelectionResult`, `UseGristWritesResult` and `UseGristThemeResult` (the slice-hook return types the docs already named, now exported and used as the hooks' declared return types), plus `UseGristCoreOptions` and `UseGristCoreResult`, the connection types they build on. `GristWidgetStatus` is now a single type shared by `grist-widget-sdk` and `grist-widget-sdk/advanced`, where there used to be two identical ones. All additions are type-only. At runtime, `docApi` is now read from `window.grist` on every render instead of memoized on the handshake phase, so it can no longer outlive a `window.grist` that was replaced or removed (as the emulator does) while the phase stayed `online`; in real Grist the global never changes, so the value is the same.
16
+
3
17
  ## 0.3.17
4
18
 
5
19
  ### Patch Changes
package/dist/advanced.cjs CHANGED
@@ -1699,11 +1699,7 @@ function useGristCoreFromManager(manager) {
1699
1699
  );
1700
1700
  const status = deriveStatus(snapshot);
1701
1701
  const error = deriveErrorMessage(snapshot);
1702
- const docApi = (0, import_react2.useMemo)(() => {
1703
- if (snapshot.lifecycle.phase !== "online") return null;
1704
- if (typeof grist === "undefined") return null;
1705
- return grist.docApi ?? null;
1706
- }, [snapshot.lifecycle.phase, snapshot.generation]);
1702
+ const docApi = snapshot.lifecycle.phase === "online" && typeof grist !== "undefined" ? grist.docApi ?? null : null;
1707
1703
  const isAvailable = computeAvailabilityFromSnapshot(snapshot);
1708
1704
  const reload = (0, import_react2.useCallback)(async () => {
1709
1705
  manager.reload();