@constructive-io/sheets 0.4.1 → 0.6.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 (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
@@ -1,7 +1,6 @@
1
- import React__default, { ComponentType } from 'react';
2
- import { E as EditorProps, C as CellCreationMetadata, S as SheetsCell } from './editor-props-M6Dh0P9f.cjs';
3
- export { a as SheetsCellKind } from './editor-props-M6Dh0P9f.cjs';
4
- import * as react_jsx_runtime from 'react/jsx-runtime';
1
+ import react__default, { ComponentType } from 'react';
2
+ import { E as EditorProps, C as CellCreationMetadata, S as SheetsCell } from './grid-cell-types-C3ARj148.cjs';
3
+ export { a as SheetsCellKind } from './grid-cell-types-C3ARj148.cjs';
5
4
  import '@constructive-io/data';
6
5
 
7
6
  /**
@@ -55,13 +54,13 @@ declare const OVERLAY: {
55
54
  };
56
55
 
57
56
  interface EditorFocusTrapProps {
58
- children: React__default.ReactNode;
57
+ children: react__default.ReactNode;
59
58
  onEscape?: () => void;
60
- onKeyDown?: (e: React__default.KeyboardEvent) => void;
59
+ onKeyDown?: (e: react__default.KeyboardEvent) => void;
61
60
  className?: string;
62
- style?: React__default.CSSProperties;
61
+ style?: react__default.CSSProperties;
63
62
  }
64
- declare function EditorFocusTrap({ children, onEscape, onKeyDown, className, style }: EditorFocusTrapProps): react_jsx_runtime.JSX.Element;
63
+ declare function EditorFocusTrap({ children, onEscape, onKeyDown, className, style }: EditorFocusTrapProps): react__default.JSX.Element;
65
64
 
66
65
  type TargetRect = {
67
66
  x: number;
@@ -70,13 +69,13 @@ type TargetRect = {
70
69
  height: number;
71
70
  };
72
71
  type Props = {
73
- children?: React__default.ReactNode;
72
+ children?: react__default.ReactNode;
74
73
  debugName?: string;
75
74
  marginPx?: number;
76
75
  minBelowPx?: number;
77
76
  target?: TargetRect;
78
77
  };
79
- declare function OverlayViewportGuard({ children, debugName, marginPx, minBelowPx, target }: Props): react_jsx_runtime.JSX.Element;
78
+ declare function OverlayViewportGuard({ children, debugName, marginPx, minBelowPx, target }: Props): react__default.JSX.Element;
80
79
 
81
80
  declare function createSheetsCell(value: unknown, metadata: CellCreationMetadata, deriveGeometry?: (value: unknown) => SheetsCell): SheetsCell;
82
81
 
@@ -1,7 +1,6 @@
1
- import React__default, { ComponentType } from 'react';
2
- import { E as EditorProps, C as CellCreationMetadata, S as SheetsCell } from './editor-props-M6Dh0P9f.js';
3
- export { a as SheetsCellKind } from './editor-props-M6Dh0P9f.js';
4
- import * as react_jsx_runtime from 'react/jsx-runtime';
1
+ import react__default, { ComponentType } from 'react';
2
+ import { E as EditorProps, C as CellCreationMetadata, S as SheetsCell } from './grid-cell-types-C3ARj148.js';
3
+ export { a as SheetsCellKind } from './grid-cell-types-C3ARj148.js';
5
4
  import '@constructive-io/data';
6
5
 
7
6
  /**
@@ -55,13 +54,13 @@ declare const OVERLAY: {
55
54
  };
56
55
 
57
56
  interface EditorFocusTrapProps {
58
- children: React__default.ReactNode;
57
+ children: react__default.ReactNode;
59
58
  onEscape?: () => void;
60
- onKeyDown?: (e: React__default.KeyboardEvent) => void;
59
+ onKeyDown?: (e: react__default.KeyboardEvent) => void;
61
60
  className?: string;
62
- style?: React__default.CSSProperties;
61
+ style?: react__default.CSSProperties;
63
62
  }
64
- declare function EditorFocusTrap({ children, onEscape, onKeyDown, className, style }: EditorFocusTrapProps): react_jsx_runtime.JSX.Element;
63
+ declare function EditorFocusTrap({ children, onEscape, onKeyDown, className, style }: EditorFocusTrapProps): react__default.JSX.Element;
65
64
 
66
65
  type TargetRect = {
67
66
  x: number;
@@ -70,13 +69,13 @@ type TargetRect = {
70
69
  height: number;
71
70
  };
72
71
  type Props = {
73
- children?: React__default.ReactNode;
72
+ children?: react__default.ReactNode;
74
73
  debugName?: string;
75
74
  marginPx?: number;
76
75
  minBelowPx?: number;
77
76
  target?: TargetRect;
78
77
  };
79
- declare function OverlayViewportGuard({ children, debugName, marginPx, minBelowPx, target }: Props): react_jsx_runtime.JSX.Element;
78
+ declare function OverlayViewportGuard({ children, debugName, marginPx, minBelowPx, target }: Props): react__default.JSX.Element;
80
79
 
81
80
  declare function createSheetsCell(value: unknown, metadata: CellCreationMetadata, deriveGeometry?: (value: unknown) => SheetsCell): SheetsCell;
82
81
 
package/dist/advanced.js CHANGED
@@ -5,9 +5,9 @@ import {
5
5
  createSheetsCell,
6
6
  resolveNativeEditor,
7
7
  wrapNativeEditor
8
- } from "./chunk-BWKB52JB.js";
9
- import "./chunk-SDKHWE7G.js";
10
- import "./chunk-FG2LRZP5.js";
8
+ } from "./chunk-LR64FLWO.js";
9
+ import "./chunk-ZETPUEXH.js";
10
+ import "./chunk-KOZAW264.js";
11
11
  import {
12
12
  EditorFocusTrap,
13
13
  OVERLAY,
package/dist/auth.cjs CHANGED
@@ -245,11 +245,11 @@ function getStorage() {
245
245
  return null;
246
246
  }
247
247
  }
248
- function setStoredToken(databaseId, accessToken, expiresAt) {
248
+ function setStoredToken(databaseId, accessToken, expiresAt, identityKey) {
249
249
  const storage = getStorage();
250
250
  if (!storage) return;
251
251
  try {
252
- const data = { accessToken, expiresAt };
252
+ const data = { accessToken, expiresAt, identityKey };
253
253
  storage.setItem(storageKey(databaseId), JSON.stringify(data));
254
254
  } catch {
255
255
  }
@@ -363,12 +363,12 @@ function useSheetsLogin() {
363
363
  if (!token) {
364
364
  throw createInvalidCredentialsError();
365
365
  }
366
- return { token, email: credentials.email };
366
+ return { token, email: credentials.email, identityKey: signInResult.userId };
367
367
  },
368
- onSuccess: ({ token }) => {
368
+ onSuccess: ({ token, identityKey }) => {
369
369
  const databaseId = config.databaseId || "default";
370
- setStoredToken(databaseId, token.accessToken, token.expiresAt);
371
- storeApi.getState().setAuthenticated(token.accessToken, token.expiresAt);
370
+ setStoredToken(databaseId, token.accessToken, token.expiresAt, identityKey);
371
+ storeApi.getState().setAuthenticated(token.accessToken, token.expiresAt, identityKey);
372
372
  queryClient.invalidateQueries({ queryKey: ["sheets"] });
373
373
  }
374
374
  });
@@ -413,13 +413,13 @@ function useSheetsRegister() {
413
413
  );
414
414
  const signUpResult = result.signUp?.result;
415
415
  const token = signUpResult ? toAuthToken(signUpResult) : null;
416
- return { token, email: formData.email };
416
+ return { token, email: formData.email, identityKey: signUpResult?.userId ?? null };
417
417
  },
418
- onSuccess: ({ token }) => {
418
+ onSuccess: ({ token, identityKey }) => {
419
419
  if (token) {
420
420
  const databaseId = config.databaseId || "default";
421
- setStoredToken(databaseId, token.accessToken, token.expiresAt);
422
- storeApi.getState().setAuthenticated(token.accessToken, token.expiresAt);
421
+ setStoredToken(databaseId, token.accessToken, token.expiresAt, identityKey);
422
+ storeApi.getState().setAuthenticated(token.accessToken, token.expiresAt, identityKey);
423
423
  }
424
424
  queryClient.invalidateQueries({ queryKey: ["sheets"] });
425
425
  },