@constructive-io/sheets 0.3.0 → 0.4.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.
package/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { b as SheetsConfig, C as CellProps, c as CellTypeDefinition, d as CellTypeMatchInput, e as SheetsCellRenderContext, f as SheetsScopeKey, S as SheetsExecuteFn, a as SheetsUploadFn, g as SheetsBackendAdapter } from './sheets-context-CojEFlaY.cjs';
3
- export { n as AdapterListQuery, o as AdapterListResult, p as AdapterPageInfo, A as AdapterTableContext, s as CellColumnDescriptor, r as CellTypePlugin, j as SheetsAuthEmbedded, k as SheetsAuthStandalone, h as SheetsContext, i as SheetsContextValue, t as SheetsLogger, l as createSheetsExecute, m as createSheetsUpload, q as defineCellType, u as useSheetsContext } from './sheets-context-CojEFlaY.cjs';
2
+ import { b as SheetsConfig, S as SheetsExecuteFn, C as CellProps, c as CellTypeDefinition, d as CellTypeMatchInput, e as SheetsCellRenderContext, f as SheetsScopeKey, a as SheetsUploadFn, g as SheetsBackendAdapter } from './sheets-context-BjGIHocT.cjs';
3
+ export { n as AdapterListQuery, o as AdapterListResult, p as AdapterPageInfo, A as AdapterTableContext, s as CellColumnDescriptor, r as CellTypePlugin, j as SheetsAuthEmbedded, k as SheetsAuthStandalone, h as SheetsContext, i as SheetsContextValue, t as SheetsLogger, l as createSheetsExecute, m as createSheetsUpload, q as defineCellType, u as useSheetsContext } from './sheets-context-BjGIHocT.cjs';
4
4
  import { StoreApi } from 'zustand';
5
5
  import { R as RelationInfo, d as RelationInfoSlice, E as EditorProps, F as FieldMetadata, S as SheetsCell, e as CellRegistryEntry, b as CellType, f as CellRenderer, g as CellPlugin, h as ColumnSchema } from './editor-props-M6Dh0P9f.cjs';
6
6
  export { B as BaseCellProps, c as CellCategory, l as CellValue, m as FieldMetadata, i as RelationKind, n as RowData, a as SheetsCellKind, T as TableSchema, j as buildRelationInfoFromMeta, k as isImageField, r as resolveCellType } from './editor-props-M6Dh0P9f.cjs';
@@ -19,6 +19,43 @@ interface SheetsProviderProps {
19
19
  }
20
20
  declare function SheetsProvider({ config, children }: SheetsProviderProps): react_jsx_runtime.JSX.Element;
21
21
 
22
+ /**
23
+ * Presigned-URL upload helpers for the sheets cell-upload seam.
24
+ *
25
+ * Replaces the legacy multipart `<endpoint>/upload` POST. The flow is:
26
+ * 1. SHA-256 hash the file bytes (Web Crypto, zero new deps)
27
+ * 2. Call the presigned upload op (discovered via introspection) to get a
28
+ * presigned PUT url + fileId
29
+ * 3. PUT the raw bytes to that url (only Content-Type, NO Authorization)
30
+ * 4. Resolve the stable public `downloadUrl` for the fileId
31
+ *
32
+ * `confirmUpload` is intentionally skipped: the backend plugin creates the file
33
+ * row inside the upload op, so `downloadUrl` resolves immediately.
34
+ *
35
+ * The upload op is discovered via runtime introspection, matched by FIELD/TYPE
36
+ * SHAPE (never a hardcoded name): a root mutation `upload<Type>File(input: {...})`
37
+ * whose input + payload carry the upload shape.
38
+ *
39
+ * The downloadUrl-by-id field is likewise shape-discovered. Three read shapes,
40
+ * preferred in order: the inflected singular `appFile(id:)`; a filtered
41
+ * connection `appFiles(where:{id:{equalTo:$id}}){ nodes { downloadUrl } }`
42
+ * (Relay-disabled backends); and the Relay `node(nodeId:)` fallback.
43
+ */
44
+
45
+ /**
46
+ * Resolve a file's signed `downloadUrl` by id — the public entry point for callers
47
+ * OUTSIDE the upload flow (e.g. a storage browser fetching the preview/copy link for
48
+ * an already-uploaded file).
49
+ *
50
+ * `downloadUrl` is a Grafast computed field, so it cannot be selected through the
51
+ * runtime query builder (`buildSelect` intersects the select against pg columns and
52
+ * drops computed fields). This discovers the by-id field once per endpoint (cached)
53
+ * and reads it through the SAME resolver the upload path uses. Returns null on any
54
+ * failure — a missing url is not exceptional for the caller (it just disables
55
+ * copy/download), so the throwing internals are swallowed here.
56
+ */
57
+ declare function resolveDownloadUrl(execute: SheetsExecuteFn, endpoint: string, fileId: string): Promise<string | null>;
58
+
22
59
  type DraftRowStatus = 'idle' | 'saving' | 'error';
23
60
  interface DraftRow {
24
61
  id: string;
@@ -1647,4 +1684,4 @@ declare function useDataPagination({ initialPageSize, initialPageIndex, totalCou
1647
1684
  }) => any;
1648
1685
  };
1649
1686
 
1650
- export { BOOLEAN_TYPES, BUILTIN_EDITOR_TYPES, type Binding, CellPlugin, CellProps, CellRegistry, CellRegistryEntry, CellRenderer, type CellSlot, type CellSlots, CellType, type CellTypeBuiltins, CellTypeDefinition, CellTypeMatchInput, type CellTypeRegistry, ColumnSchema, type CommandResult, DATE_TIME_TYPES, type DataFilteringContextValue, type DataPaginationContextValue, type DispatchEvent, DockStatusBar, DockStatusBarCompact, type DraftMeta, type DraftRow, type DynamicFormSpec, ENHANCED_TYPES, EditorProps, type ExtractedRange, FeedbackProvider, type FieldTypeMap, type FilterCondition, type FilterGroup, type FilterNode, type FilterValue, FloatingStatus, GEOMETRY_TYPES, type GridCommand, type GridCommandContext, type Interceptor, MAX_FILTER_DEPTH, MEDIA_TYPES, type MetaField, type MetaTable, NON_EDITABLE_TYPES, NUMBER_TYPES, type OperationFeedback, RangeSet, type RelationColumnInfo, RelationInfo, type RowWithDraft, STRUCTURED_DATA_TYPES, type ScalarFieldSpec, type SelectionCurrent, type SelectionRect, Sheets, type SheetsAuthState, SheetsBackendAdapter, SheetsCell, SheetsCellRenderContext, SheetsConfig, SheetsControls, type SheetsControlsProps, type SheetsDraftBindings, SheetsEmptyState, SheetsErrorBoundary, SheetsErrorState, type SheetsEvent, SheetsExecuteFn, type SheetsHandle, SheetsLoadingState, SheetsPagination, type SheetsPaginationBindings, type SheetsPaginationProps, type SheetsProps, SheetsProvider, type SheetsRow, SheetsScopeKey, type SheetsSelection, type SheetsSelectionBindings, type SheetsSlots, type SheetsStoreState, SheetsTableSelector, type SheetsThemeInput, type SheetsThemeTokens, SheetsUploadFn, TYPED_ARRAY_TYPES, type TableSelectorProps, type TableWithCategory, type Trigger, type UploadProgress, type UploadResponse, type UseDataFilteringConfig, type UseDataPaginationConfig, type UseFieldUploadOptions, type UseInfiniteTableOptions, type UseInfiniteTableResult, type UseMetaOptions, type UseSheetsResult, type UseSheetsTableCursorOptions, type UseSheetsTableCursorResult, type UseTableOptions, type UseTableResult, VIEWER_ONLY_TYPES, buildScalarFormSpec, buildZodSchema, clear as clearSheetsSelection, computeDraftMetaSignature, countConditions, createCellTypeRegistry, createColumnSchemaFromMeta, createEmptyGroup, createMetadataHash, createPostGraphileAdapter, emptySheetsSelection, executeFieldUpload, extendRangeToCell, fillDownWrites, fillRightWrites, findTableFormSpec, getCellsInRange, getDraftMeta, isArrayCellType, isDraftRow, isSheetsScopeKey, isStructuredDataType, kbd, mapToFrontendCellType, moveActive, sheetsTableQueryKeys as queryKeys, selectCell, selectRange, selectRow, sheetsQueryKeys, toTSV, toggleRow, tokensFromCssVars, useDataFiltering, useDataGridColumns, useDataPagination, useDynamicCreate, useDynamicUpdate, useFeedback, useOperationFeedback, useRelationColumns, useSheets, useSheetsAdapter, useSheetsFieldUpload, useSheetsImageUpload, useSheetsInfiniteTable, useSheetsMeta, useSheetsStore, useSheetsStoreApi, useSheetsTable, useSheetsTableCursor };
1687
+ export { BOOLEAN_TYPES, BUILTIN_EDITOR_TYPES, type Binding, CellPlugin, CellProps, CellRegistry, CellRegistryEntry, CellRenderer, type CellSlot, type CellSlots, CellType, type CellTypeBuiltins, CellTypeDefinition, CellTypeMatchInput, type CellTypeRegistry, ColumnSchema, type CommandResult, DATE_TIME_TYPES, type DataFilteringContextValue, type DataPaginationContextValue, type DispatchEvent, DockStatusBar, DockStatusBarCompact, type DraftMeta, type DraftRow, type DynamicFormSpec, ENHANCED_TYPES, EditorProps, type ExtractedRange, FeedbackProvider, type FieldTypeMap, type FilterCondition, type FilterGroup, type FilterNode, type FilterValue, FloatingStatus, GEOMETRY_TYPES, type GridCommand, type GridCommandContext, type Interceptor, MAX_FILTER_DEPTH, MEDIA_TYPES, type MetaField, type MetaTable, NON_EDITABLE_TYPES, NUMBER_TYPES, type OperationFeedback, RangeSet, type RelationColumnInfo, RelationInfo, type RowWithDraft, STRUCTURED_DATA_TYPES, type ScalarFieldSpec, type SelectionCurrent, type SelectionRect, Sheets, type SheetsAuthState, SheetsBackendAdapter, SheetsCell, SheetsCellRenderContext, SheetsConfig, SheetsControls, type SheetsControlsProps, type SheetsDraftBindings, SheetsEmptyState, SheetsErrorBoundary, SheetsErrorState, type SheetsEvent, SheetsExecuteFn, type SheetsHandle, SheetsLoadingState, SheetsPagination, type SheetsPaginationBindings, type SheetsPaginationProps, type SheetsProps, SheetsProvider, type SheetsRow, SheetsScopeKey, type SheetsSelection, type SheetsSelectionBindings, type SheetsSlots, type SheetsStoreState, SheetsTableSelector, type SheetsThemeInput, type SheetsThemeTokens, SheetsUploadFn, TYPED_ARRAY_TYPES, type TableSelectorProps, type TableWithCategory, type Trigger, type UploadProgress, type UploadResponse, type UseDataFilteringConfig, type UseDataPaginationConfig, type UseFieldUploadOptions, type UseInfiniteTableOptions, type UseInfiniteTableResult, type UseMetaOptions, type UseSheetsResult, type UseSheetsTableCursorOptions, type UseSheetsTableCursorResult, type UseTableOptions, type UseTableResult, VIEWER_ONLY_TYPES, buildScalarFormSpec, buildZodSchema, clear as clearSheetsSelection, computeDraftMetaSignature, countConditions, createCellTypeRegistry, createColumnSchemaFromMeta, createEmptyGroup, createMetadataHash, createPostGraphileAdapter, emptySheetsSelection, executeFieldUpload, extendRangeToCell, fillDownWrites, fillRightWrites, findTableFormSpec, getCellsInRange, getDraftMeta, isArrayCellType, isDraftRow, isSheetsScopeKey, isStructuredDataType, kbd, mapToFrontendCellType, moveActive, sheetsTableQueryKeys as queryKeys, resolveDownloadUrl, selectCell, selectRange, selectRow, sheetsQueryKeys, toTSV, toggleRow, tokensFromCssVars, useDataFiltering, useDataGridColumns, useDataPagination, useDynamicCreate, useDynamicUpdate, useFeedback, useOperationFeedback, useRelationColumns, useSheets, useSheetsAdapter, useSheetsFieldUpload, useSheetsImageUpload, useSheetsInfiniteTable, useSheetsMeta, useSheetsStore, useSheetsStoreApi, useSheetsTable, useSheetsTableCursor };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { b as SheetsConfig, C as CellProps, c as CellTypeDefinition, d as CellTypeMatchInput, e as SheetsCellRenderContext, f as SheetsScopeKey, S as SheetsExecuteFn, a as SheetsUploadFn, g as SheetsBackendAdapter } from './sheets-context-Da55TTR9.js';
3
- export { n as AdapterListQuery, o as AdapterListResult, p as AdapterPageInfo, A as AdapterTableContext, s as CellColumnDescriptor, r as CellTypePlugin, j as SheetsAuthEmbedded, k as SheetsAuthStandalone, h as SheetsContext, i as SheetsContextValue, t as SheetsLogger, l as createSheetsExecute, m as createSheetsUpload, q as defineCellType, u as useSheetsContext } from './sheets-context-Da55TTR9.js';
2
+ import { b as SheetsConfig, S as SheetsExecuteFn, C as CellProps, c as CellTypeDefinition, d as CellTypeMatchInput, e as SheetsCellRenderContext, f as SheetsScopeKey, a as SheetsUploadFn, g as SheetsBackendAdapter } from './sheets-context-9u9r7Bs0.js';
3
+ export { n as AdapterListQuery, o as AdapterListResult, p as AdapterPageInfo, A as AdapterTableContext, s as CellColumnDescriptor, r as CellTypePlugin, j as SheetsAuthEmbedded, k as SheetsAuthStandalone, h as SheetsContext, i as SheetsContextValue, t as SheetsLogger, l as createSheetsExecute, m as createSheetsUpload, q as defineCellType, u as useSheetsContext } from './sheets-context-9u9r7Bs0.js';
4
4
  import { StoreApi } from 'zustand';
5
5
  import { R as RelationInfo, d as RelationInfoSlice, E as EditorProps, F as FieldMetadata, S as SheetsCell, e as CellRegistryEntry, b as CellType, f as CellRenderer, g as CellPlugin, h as ColumnSchema } from './editor-props-M6Dh0P9f.js';
6
6
  export { B as BaseCellProps, c as CellCategory, l as CellValue, m as FieldMetadata, i as RelationKind, n as RowData, a as SheetsCellKind, T as TableSchema, j as buildRelationInfoFromMeta, k as isImageField, r as resolveCellType } from './editor-props-M6Dh0P9f.js';
@@ -19,6 +19,43 @@ interface SheetsProviderProps {
19
19
  }
20
20
  declare function SheetsProvider({ config, children }: SheetsProviderProps): react_jsx_runtime.JSX.Element;
21
21
 
22
+ /**
23
+ * Presigned-URL upload helpers for the sheets cell-upload seam.
24
+ *
25
+ * Replaces the legacy multipart `<endpoint>/upload` POST. The flow is:
26
+ * 1. SHA-256 hash the file bytes (Web Crypto, zero new deps)
27
+ * 2. Call the presigned upload op (discovered via introspection) to get a
28
+ * presigned PUT url + fileId
29
+ * 3. PUT the raw bytes to that url (only Content-Type, NO Authorization)
30
+ * 4. Resolve the stable public `downloadUrl` for the fileId
31
+ *
32
+ * `confirmUpload` is intentionally skipped: the backend plugin creates the file
33
+ * row inside the upload op, so `downloadUrl` resolves immediately.
34
+ *
35
+ * The upload op is discovered via runtime introspection, matched by FIELD/TYPE
36
+ * SHAPE (never a hardcoded name): a root mutation `upload<Type>File(input: {...})`
37
+ * whose input + payload carry the upload shape.
38
+ *
39
+ * The downloadUrl-by-id field is likewise shape-discovered. Three read shapes,
40
+ * preferred in order: the inflected singular `appFile(id:)`; a filtered
41
+ * connection `appFiles(where:{id:{equalTo:$id}}){ nodes { downloadUrl } }`
42
+ * (Relay-disabled backends); and the Relay `node(nodeId:)` fallback.
43
+ */
44
+
45
+ /**
46
+ * Resolve a file's signed `downloadUrl` by id — the public entry point for callers
47
+ * OUTSIDE the upload flow (e.g. a storage browser fetching the preview/copy link for
48
+ * an already-uploaded file).
49
+ *
50
+ * `downloadUrl` is a Grafast computed field, so it cannot be selected through the
51
+ * runtime query builder (`buildSelect` intersects the select against pg columns and
52
+ * drops computed fields). This discovers the by-id field once per endpoint (cached)
53
+ * and reads it through the SAME resolver the upload path uses. Returns null on any
54
+ * failure — a missing url is not exceptional for the caller (it just disables
55
+ * copy/download), so the throwing internals are swallowed here.
56
+ */
57
+ declare function resolveDownloadUrl(execute: SheetsExecuteFn, endpoint: string, fileId: string): Promise<string | null>;
58
+
22
59
  type DraftRowStatus = 'idle' | 'saving' | 'error';
23
60
  interface DraftRow {
24
61
  id: string;
@@ -1647,4 +1684,4 @@ declare function useDataPagination({ initialPageSize, initialPageIndex, totalCou
1647
1684
  }) => any;
1648
1685
  };
1649
1686
 
1650
- export { BOOLEAN_TYPES, BUILTIN_EDITOR_TYPES, type Binding, CellPlugin, CellProps, CellRegistry, CellRegistryEntry, CellRenderer, type CellSlot, type CellSlots, CellType, type CellTypeBuiltins, CellTypeDefinition, CellTypeMatchInput, type CellTypeRegistry, ColumnSchema, type CommandResult, DATE_TIME_TYPES, type DataFilteringContextValue, type DataPaginationContextValue, type DispatchEvent, DockStatusBar, DockStatusBarCompact, type DraftMeta, type DraftRow, type DynamicFormSpec, ENHANCED_TYPES, EditorProps, type ExtractedRange, FeedbackProvider, type FieldTypeMap, type FilterCondition, type FilterGroup, type FilterNode, type FilterValue, FloatingStatus, GEOMETRY_TYPES, type GridCommand, type GridCommandContext, type Interceptor, MAX_FILTER_DEPTH, MEDIA_TYPES, type MetaField, type MetaTable, NON_EDITABLE_TYPES, NUMBER_TYPES, type OperationFeedback, RangeSet, type RelationColumnInfo, RelationInfo, type RowWithDraft, STRUCTURED_DATA_TYPES, type ScalarFieldSpec, type SelectionCurrent, type SelectionRect, Sheets, type SheetsAuthState, SheetsBackendAdapter, SheetsCell, SheetsCellRenderContext, SheetsConfig, SheetsControls, type SheetsControlsProps, type SheetsDraftBindings, SheetsEmptyState, SheetsErrorBoundary, SheetsErrorState, type SheetsEvent, SheetsExecuteFn, type SheetsHandle, SheetsLoadingState, SheetsPagination, type SheetsPaginationBindings, type SheetsPaginationProps, type SheetsProps, SheetsProvider, type SheetsRow, SheetsScopeKey, type SheetsSelection, type SheetsSelectionBindings, type SheetsSlots, type SheetsStoreState, SheetsTableSelector, type SheetsThemeInput, type SheetsThemeTokens, SheetsUploadFn, TYPED_ARRAY_TYPES, type TableSelectorProps, type TableWithCategory, type Trigger, type UploadProgress, type UploadResponse, type UseDataFilteringConfig, type UseDataPaginationConfig, type UseFieldUploadOptions, type UseInfiniteTableOptions, type UseInfiniteTableResult, type UseMetaOptions, type UseSheetsResult, type UseSheetsTableCursorOptions, type UseSheetsTableCursorResult, type UseTableOptions, type UseTableResult, VIEWER_ONLY_TYPES, buildScalarFormSpec, buildZodSchema, clear as clearSheetsSelection, computeDraftMetaSignature, countConditions, createCellTypeRegistry, createColumnSchemaFromMeta, createEmptyGroup, createMetadataHash, createPostGraphileAdapter, emptySheetsSelection, executeFieldUpload, extendRangeToCell, fillDownWrites, fillRightWrites, findTableFormSpec, getCellsInRange, getDraftMeta, isArrayCellType, isDraftRow, isSheetsScopeKey, isStructuredDataType, kbd, mapToFrontendCellType, moveActive, sheetsTableQueryKeys as queryKeys, selectCell, selectRange, selectRow, sheetsQueryKeys, toTSV, toggleRow, tokensFromCssVars, useDataFiltering, useDataGridColumns, useDataPagination, useDynamicCreate, useDynamicUpdate, useFeedback, useOperationFeedback, useRelationColumns, useSheets, useSheetsAdapter, useSheetsFieldUpload, useSheetsImageUpload, useSheetsInfiniteTable, useSheetsMeta, useSheetsStore, useSheetsStoreApi, useSheetsTable, useSheetsTableCursor };
1687
+ export { BOOLEAN_TYPES, BUILTIN_EDITOR_TYPES, type Binding, CellPlugin, CellProps, CellRegistry, CellRegistryEntry, CellRenderer, type CellSlot, type CellSlots, CellType, type CellTypeBuiltins, CellTypeDefinition, CellTypeMatchInput, type CellTypeRegistry, ColumnSchema, type CommandResult, DATE_TIME_TYPES, type DataFilteringContextValue, type DataPaginationContextValue, type DispatchEvent, DockStatusBar, DockStatusBarCompact, type DraftMeta, type DraftRow, type DynamicFormSpec, ENHANCED_TYPES, EditorProps, type ExtractedRange, FeedbackProvider, type FieldTypeMap, type FilterCondition, type FilterGroup, type FilterNode, type FilterValue, FloatingStatus, GEOMETRY_TYPES, type GridCommand, type GridCommandContext, type Interceptor, MAX_FILTER_DEPTH, MEDIA_TYPES, type MetaField, type MetaTable, NON_EDITABLE_TYPES, NUMBER_TYPES, type OperationFeedback, RangeSet, type RelationColumnInfo, RelationInfo, type RowWithDraft, STRUCTURED_DATA_TYPES, type ScalarFieldSpec, type SelectionCurrent, type SelectionRect, Sheets, type SheetsAuthState, SheetsBackendAdapter, SheetsCell, SheetsCellRenderContext, SheetsConfig, SheetsControls, type SheetsControlsProps, type SheetsDraftBindings, SheetsEmptyState, SheetsErrorBoundary, SheetsErrorState, type SheetsEvent, SheetsExecuteFn, type SheetsHandle, SheetsLoadingState, SheetsPagination, type SheetsPaginationBindings, type SheetsPaginationProps, type SheetsProps, SheetsProvider, type SheetsRow, SheetsScopeKey, type SheetsSelection, type SheetsSelectionBindings, type SheetsSlots, type SheetsStoreState, SheetsTableSelector, type SheetsThemeInput, type SheetsThemeTokens, SheetsUploadFn, TYPED_ARRAY_TYPES, type TableSelectorProps, type TableWithCategory, type Trigger, type UploadProgress, type UploadResponse, type UseDataFilteringConfig, type UseDataPaginationConfig, type UseFieldUploadOptions, type UseInfiniteTableOptions, type UseInfiniteTableResult, type UseMetaOptions, type UseSheetsResult, type UseSheetsTableCursorOptions, type UseSheetsTableCursorResult, type UseTableOptions, type UseTableResult, VIEWER_ONLY_TYPES, buildScalarFormSpec, buildZodSchema, clear as clearSheetsSelection, computeDraftMetaSignature, countConditions, createCellTypeRegistry, createColumnSchemaFromMeta, createEmptyGroup, createMetadataHash, createPostGraphileAdapter, emptySheetsSelection, executeFieldUpload, extendRangeToCell, fillDownWrites, fillRightWrites, findTableFormSpec, getCellsInRange, getDraftMeta, isArrayCellType, isDraftRow, isSheetsScopeKey, isStructuredDataType, kbd, mapToFrontendCellType, moveActive, sheetsTableQueryKeys as queryKeys, resolveDownloadUrl, selectCell, selectRange, selectRow, sheetsQueryKeys, toTSV, toggleRow, tokensFromCssVars, useDataFiltering, useDataGridColumns, useDataPagination, useDynamicCreate, useDynamicUpdate, useFeedback, useOperationFeedback, useRelationColumns, useSheets, useSheetsAdapter, useSheetsFieldUpload, useSheetsImageUpload, useSheetsInfiniteTable, useSheetsMeta, useSheetsStore, useSheetsStoreApi, useSheetsTable, useSheetsTableCursor };
package/dist/index.js CHANGED
@@ -6,6 +6,7 @@ import {
6
6
  createPostGraphileAdapter,
7
7
  createSheetsCell,
8
8
  executeFieldUpload,
9
+ getImageMetadata,
9
10
  isSheetsScopeKey,
10
11
  resolveRelationFieldMap,
11
12
  sheetsQueryKeys,
@@ -18,22 +19,23 @@ import {
18
19
  useSheetsTable,
19
20
  useSheetsTableCursor,
20
21
  validateOrderByVariables
21
- } from "./chunk-TU7ATZ4X.js";
22
+ } from "./chunk-BWKB52JB.js";
22
23
  import {
23
24
  SheetsAuthGate,
24
25
  useSheetsForgotPassword,
25
26
  useSheetsLogin,
26
27
  useSheetsRegister,
27
28
  useSheetsResetPassword
28
- } from "./chunk-FNVHSOQQ.js";
29
+ } from "./chunk-3BNOZQIJ.js";
29
30
  import {
30
31
  SheetsProvider
31
- } from "./chunk-ODUBS2NL.js";
32
+ } from "./chunk-BWJVRYJT.js";
32
33
  import {
33
34
  DataError,
34
35
  createSheetsExecute,
35
- createSheetsUpload
36
- } from "./chunk-H4JJTMP5.js";
36
+ createSheetsUpload,
37
+ resolveDownloadUrl
38
+ } from "./chunk-SDKHWE7G.js";
37
39
  import "./chunk-GLVZSPV2.js";
38
40
  import {
39
41
  SheetsContext,
@@ -45,7 +47,7 @@ import {
45
47
  useSheetsContext,
46
48
  useSheetsStore,
47
49
  useSheetsStoreApi
48
- } from "./chunk-4PGPVMZB.js";
50
+ } from "./chunk-FG2LRZP5.js";
49
51
  import {
50
52
  BOOLEAN_TYPES,
51
53
  BUILTIN_EDITOR_TYPES,
@@ -5584,6 +5586,9 @@ function GeometryCellView(props) {
5584
5586
  );
5585
5587
  }
5586
5588
 
5589
+ // src/cell-model/views/image-view.tsx
5590
+ import { FileIcon } from "lucide-react";
5591
+
5587
5592
  // src/cell-model/image-cache.ts
5588
5593
  var CAP = 256;
5589
5594
  var cache = /* @__PURE__ */ new Map();
@@ -5607,13 +5612,39 @@ function warmImage(url) {
5607
5612
  }
5608
5613
 
5609
5614
  // src/cell-model/views/image-view.tsx
5610
- import { jsx as jsx14 } from "react/jsx-runtime";
5615
+ import { jsx as jsx14, jsxs as jsxs10 } from "react/jsx-runtime";
5611
5616
  function readUrl(data) {
5612
5617
  if (Array.isArray(data) && typeof data[0] === "string") return data[0];
5613
5618
  return "";
5614
5619
  }
5620
+ function basename(url) {
5621
+ const path = url.split(/[?#]/)[0];
5622
+ const seg = path.slice(path.lastIndexOf("/") + 1);
5623
+ return seg || url;
5624
+ }
5625
+ function isNonImageFile(cellType, value) {
5626
+ if (cellType === "image" || value == null) return false;
5627
+ const mime = getImageMetadata(value)?.mime;
5628
+ return !(mime && mime !== "unknown" && mime.startsWith("image/"));
5629
+ }
5615
5630
  function ImageCellView(props) {
5616
5631
  const url = readUrl(props.cell.data);
5632
+ if (url && isNonImageFile(props.column.cellType, props.value)) {
5633
+ const meta = getImageMetadata(props.value);
5634
+ const filename = meta?.filename && meta.filename !== "Unknown" ? meta.filename : basename(url);
5635
+ return /* @__PURE__ */ jsxs10(
5636
+ "div",
5637
+ {
5638
+ "data-slot": "file-cell",
5639
+ role: "gridcell",
5640
+ className: cn("flex h-full w-full items-center gap-1.5 overflow-hidden px-2"),
5641
+ children: [
5642
+ /* @__PURE__ */ jsx14(FileIcon, { className: "size-3.5 shrink-0 text-muted-foreground", "aria-hidden": "true" }),
5643
+ /* @__PURE__ */ jsx14("span", { className: "truncate text-sm", title: filename, children: filename })
5644
+ ]
5645
+ }
5646
+ );
5647
+ }
5617
5648
  return /* @__PURE__ */ jsx14(
5618
5649
  "div",
5619
5650
  {
@@ -5671,7 +5702,7 @@ function NumberCellView(props) {
5671
5702
  }
5672
5703
 
5673
5704
  // src/cell-model/views/relation-view.tsx
5674
- import { jsx as jsx17, jsxs as jsxs10 } from "react/jsx-runtime";
5705
+ import { jsx as jsx17, jsxs as jsxs11 } from "react/jsx-runtime";
5675
5706
  function getListRelationCount(chips) {
5676
5707
  const last = chips[chips.length - 1];
5677
5708
  if (typeof last === "string" && last.startsWith("+")) {
@@ -5696,7 +5727,7 @@ function RelationCellView(props) {
5696
5727
  }
5697
5728
  const chips = cell.data;
5698
5729
  const count = getListRelationCount(chips);
5699
- return /* @__PURE__ */ jsxs10(
5730
+ return /* @__PURE__ */ jsxs11(
5700
5731
  "div",
5701
5732
  {
5702
5733
  "data-slot": "relation-cell",
@@ -6045,7 +6076,7 @@ import { createPortal } from "react-dom";
6045
6076
 
6046
6077
  // src/grid/feedback/editor-error-boundary.tsx
6047
6078
  import { Component as Component2 } from "react";
6048
- import { jsx as jsx22, jsxs as jsxs11 } from "react/jsx-runtime";
6079
+ import { jsx as jsx22, jsxs as jsxs12 } from "react/jsx-runtime";
6049
6080
  var EditorErrorBoundary = class extends Component2 {
6050
6081
  state = { error: null };
6051
6082
  static getDerivedStateFromError(error) {
@@ -6059,7 +6090,7 @@ var EditorErrorBoundary = class extends Component2 {
6059
6090
  if (this.state.error == null) {
6060
6091
  return this.props.children;
6061
6092
  }
6062
- return /* @__PURE__ */ jsxs11("div", { className: "bg-popover text-foreground flex flex-col gap-2 rounded-lg border p-3 text-sm shadow-lg", children: [
6093
+ return /* @__PURE__ */ jsxs12("div", { className: "bg-popover text-foreground flex flex-col gap-2 rounded-lg border p-3 text-sm shadow-lg", children: [
6063
6094
  /* @__PURE__ */ jsx22("span", { className: "text-muted-foreground", children: "Editor failed to load/render" }),
6064
6095
  /* @__PURE__ */ jsx22(
6065
6096
  "button",
@@ -6828,7 +6859,7 @@ function resolveKeyCommand(event, keymap = DEFAULT_KEYMAP) {
6828
6859
  }
6829
6860
 
6830
6861
  // src/grid/sheets.tsx
6831
- import { Fragment as Fragment3, jsx as jsx24, jsxs as jsxs12 } from "react/jsx-runtime";
6862
+ import { Fragment as Fragment3, jsx as jsx24, jsxs as jsxs13 } from "react/jsx-runtime";
6832
6863
  var FALLBACK_PAGE_ROWS = 10;
6833
6864
  var ESTIMATED_ROW_HEIGHT2 = 34;
6834
6865
  function escapeCsvField(value) {
@@ -7401,7 +7432,7 @@ function SheetsDomInner({
7401
7432
  }
7402
7433
  const activeFilterCount = shell.filterTree ? countConditions(shell.filterTree) : 0;
7403
7434
  const isFilteredEmpty = shell.serverRowCount === 0 && shell.draftRowCount === 0 && activeFilterCount > 0;
7404
- return /* @__PURE__ */ jsxs12(SheetsErrorBoundary, { onError: config.onError, children: [
7435
+ return /* @__PURE__ */ jsxs13(SheetsErrorBoundary, { onError: config.onError, children: [
7405
7436
  /* @__PURE__ */ jsx24("div", { "data-part-id": "sheets-controls-container", children: slots?.toolbar ? /* @__PURE__ */ jsx24(Fragment3, { children: typeof slots.toolbar === "function" ? slots.toolbar({ tableName }) : slots.toolbar }) : /* @__PURE__ */ jsx24(
7406
7437
  SheetsControls,
7407
7438
  {
@@ -7421,7 +7452,7 @@ function SheetsDomInner({
7421
7452
  onExport: handleExport
7422
7453
  }
7423
7454
  ) }),
7424
- /* @__PURE__ */ jsxs12(
7455
+ /* @__PURE__ */ jsxs13(
7425
7456
  "div",
7426
7457
  {
7427
7458
  "data-part-id": "sheets-container",
@@ -7451,17 +7482,17 @@ function SheetsDomInner({
7451
7482
  activeDescendantId: activeCell ? `sheets-cell-${activeCell[1]}-${activeCell[0]}` : void 0
7452
7483
  }
7453
7484
  ),
7454
- isFilteredEmpty && /* @__PURE__ */ jsxs12("div", { className: "bg-background/80 absolute inset-0 flex flex-col items-center justify-center gap-3 p-6 text-center", children: [
7485
+ isFilteredEmpty && /* @__PURE__ */ jsxs13("div", { className: "bg-background/80 absolute inset-0 flex flex-col items-center justify-center gap-3 p-6 text-center", children: [
7455
7486
  /* @__PURE__ */ jsx24(RiSearchEyeLine, { className: "text-muted-foreground h-8 w-8" }),
7456
- /* @__PURE__ */ jsxs12("div", { className: "space-y-1", children: [
7487
+ /* @__PURE__ */ jsxs13("div", { className: "space-y-1", children: [
7457
7488
  /* @__PURE__ */ jsx24("p", { className: "text-foreground text-sm font-medium", children: "No matching rows" }),
7458
- /* @__PURE__ */ jsxs12("p", { className: "text-muted-foreground max-w-md text-sm", children: [
7489
+ /* @__PURE__ */ jsxs13("p", { className: "text-muted-foreground max-w-md text-sm", children: [
7459
7490
  "No rows match the active ",
7460
7491
  activeFilterCount === 1 ? "filter" : "filters",
7461
7492
  "."
7462
7493
  ] })
7463
7494
  ] }),
7464
- /* @__PURE__ */ jsxs12(Button6, { variant: "outline", size: "sm", onClick: shell.clearAllFilters, children: [
7495
+ /* @__PURE__ */ jsxs13(Button6, { variant: "outline", size: "sm", onClick: shell.clearAllFilters, children: [
7465
7496
  /* @__PURE__ */ jsx24(RiFilterOffLine, { className: "h-4 w-4" }),
7466
7497
  /* @__PURE__ */ jsx24("span", { className: "ms-1", children: "Clear filters" })
7467
7498
  ] })
@@ -7537,7 +7568,7 @@ import { Input as Input2 } from "@constructive-io/ui/input";
7537
7568
  import { ProgressiveBlur } from "@constructive-io/ui/progressive-blur";
7538
7569
  import { ScrollArea } from "@constructive-io/ui/scroll-area";
7539
7570
  import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@constructive-io/ui/tooltip";
7540
- import { jsx as jsx25, jsxs as jsxs13 } from "react/jsx-runtime";
7571
+ import { jsx as jsx25, jsxs as jsxs14 } from "react/jsx-runtime";
7541
7572
  var BLUR_HEIGHT_PERCENT = 0.28;
7542
7573
  var BLUR_HEIGHT_MIN_PX = 64;
7543
7574
  var BLUR_HEIGHT_MAX_PX = 140;
@@ -7554,7 +7585,7 @@ var TableItem = memo3(function TableItem2({ table, activeTable, onTableSelect, i
7554
7585
  isActive ? "bg-primary/10 text-foreground ring-primary/30 dark:bg-primary/15 dark:ring-primary/40 ring-1" : "text-muted-foreground hover:text-foreground"
7555
7586
  ),
7556
7587
  onClick: () => onTableSelect(table.value),
7557
- children: /* @__PURE__ */ jsx25("div", { className: "flex min-w-0 flex-1 items-center", children: /* @__PURE__ */ jsxs13(Tooltip, { children: [
7588
+ children: /* @__PURE__ */ jsx25("div", { className: "flex min-w-0 flex-1 items-center", children: /* @__PURE__ */ jsxs14(Tooltip, { children: [
7558
7589
  /* @__PURE__ */ jsx25(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx25("span", { className: "truncate text-xs", children: table.label }) }),
7559
7590
  /* @__PURE__ */ jsx25(TooltipContent, { side: "right", align: "start", children: /* @__PURE__ */ jsx25("span", { className: "text-xs font-medium", children: table.label }) })
7560
7591
  ] }) })
@@ -7610,15 +7641,15 @@ var SheetsTableSelector = memo3(function SheetsTableSelector2({
7610
7641
  }
7611
7642
  }, [onNewTable]);
7612
7643
  if (isLoading) {
7613
- return /* @__PURE__ */ jsxs13("div", { "data-part-id": "sheets-table-selector-loading", className: "bg-background flex h-full flex-col", children: [
7614
- /* @__PURE__ */ jsxs13("div", { className: "border-border/60 flex-shrink-0 border-b p-6", children: [
7644
+ return /* @__PURE__ */ jsxs14("div", { "data-part-id": "sheets-table-selector-loading", className: "bg-background flex h-full flex-col", children: [
7645
+ /* @__PURE__ */ jsxs14("div", { className: "border-border/60 flex-shrink-0 border-b p-6", children: [
7615
7646
  /* @__PURE__ */ jsx25("div", { className: "bg-muted mb-6 h-8 w-32 animate-pulse rounded" }),
7616
7647
  /* @__PURE__ */ jsx25("div", { className: "bg-muted mb-4 h-10 w-full animate-pulse rounded-md" }),
7617
7648
  /* @__PURE__ */ jsx25("div", { className: "bg-muted mb-4 h-10 w-full animate-pulse rounded-md" }),
7618
7649
  /* @__PURE__ */ jsx25("div", { className: "bg-muted h-10 w-full animate-pulse rounded-md" })
7619
7650
  ] }),
7620
- /* @__PURE__ */ jsx25("div", { className: "flex-1 space-y-2 p-6", children: [1, 2, 3, 4, 5].map((i) => /* @__PURE__ */ jsxs13("div", { className: "flex items-center justify-between rounded-lg border p-3", children: [
7621
- /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-3", children: [
7651
+ /* @__PURE__ */ jsx25("div", { className: "flex-1 space-y-2 p-6", children: [1, 2, 3, 4, 5].map((i) => /* @__PURE__ */ jsxs14("div", { className: "flex items-center justify-between rounded-lg border p-3", children: [
7652
+ /* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-3", children: [
7622
7653
  /* @__PURE__ */ jsx25("div", { className: "bg-muted h-4 w-4 animate-pulse rounded" }),
7623
7654
  /* @__PURE__ */ jsx25("div", { className: "bg-muted h-4 w-24 animate-pulse rounded" })
7624
7655
  ] }),
@@ -7626,18 +7657,18 @@ var SheetsTableSelector = memo3(function SheetsTableSelector2({
7626
7657
  ] }, i)) })
7627
7658
  ] });
7628
7659
  }
7629
- return /* @__PURE__ */ jsx25(TooltipProvider, { delayDuration: 150, children: /* @__PURE__ */ jsxs13(
7660
+ return /* @__PURE__ */ jsx25(TooltipProvider, { delayDuration: 150, children: /* @__PURE__ */ jsxs14(
7630
7661
  "div",
7631
7662
  {
7632
7663
  "data-part-id": "sheets-table-selector",
7633
7664
  className: "bg-background flex h-full max-h-[calc(100vh-4rem)] flex-col",
7634
7665
  children: [
7635
- /* @__PURE__ */ jsxs13("div", { className: "flex-shrink-0 py-4", children: [
7636
- /* @__PURE__ */ jsx25("div", { className: "flex flex-col gap-2 pr-2 pb-2", children: /* @__PURE__ */ jsxs13(Button7, { onClick: handleNewTable, className: "h-8 w-full justify-start gap-2", variant: "outline", children: [
7666
+ /* @__PURE__ */ jsxs14("div", { className: "flex-shrink-0 py-4", children: [
7667
+ /* @__PURE__ */ jsx25("div", { className: "flex flex-col gap-2 pr-2 pb-2", children: /* @__PURE__ */ jsxs14(Button7, { onClick: handleNewTable, className: "h-8 w-full justify-start gap-2", variant: "outline", children: [
7637
7668
  /* @__PURE__ */ jsx25(RiAddLine4, { size: 16 }),
7638
7669
  "New table"
7639
7670
  ] }) }),
7640
- /* @__PURE__ */ jsxs13("div", { className: "relative pr-2", children: [
7671
+ /* @__PURE__ */ jsxs14("div", { className: "relative pr-2", children: [
7641
7672
  /* @__PURE__ */ jsx25(
7642
7673
  RiSearchLine,
7643
7674
  {
@@ -7663,7 +7694,7 @@ var SheetsTableSelector = memo3(function SheetsTableSelector2({
7663
7694
  ref: containerRef,
7664
7695
  "data-part-id": "table-selector-table-list",
7665
7696
  className: "mt-4 flex min-h-0 flex-1 flex-col gap-2 overflow-hidden pr-2",
7666
- children: filteredTables.length === 0 ? /* @__PURE__ */ jsxs13("div", { className: "flex flex-col items-center justify-center py-12 text-center", children: [
7697
+ children: filteredTables.length === 0 ? /* @__PURE__ */ jsxs14("div", { className: "flex flex-col items-center justify-center py-12 text-center", children: [
7667
7698
  /* @__PURE__ */ jsx25("div", { className: "bg-muted mb-4 flex h-12 w-12 items-center justify-center rounded-full", children: /* @__PURE__ */ jsx25(RiSearchLine, { size: 20, className: "text-muted-foreground" }) }),
7668
7699
  /* @__PURE__ */ jsx25("p", { className: "text-muted-foreground mb-1 text-sm font-medium", children: "No tables found" }),
7669
7700
  /* @__PURE__ */ jsx25("p", { className: "text-muted-foreground/80 text-xs", children: searchQuery ? "Try adjusting your search terms" : "No tables available in this schema" })
@@ -7741,8 +7772,8 @@ function SheetsTableListByCategory({
7741
7772
  return `${Math.round(clamped)}px`;
7742
7773
  }, [scrollAreaHeight]);
7743
7774
  const scrollAreaStyle = maxContentHeight !== void 0 ? { maxHeight: `${maxContentHeight}px` } : void 0;
7744
- return /* @__PURE__ */ jsxs13(Collapsible, { open: isExpanded, onOpenChange: onToggleExpand, className: "flex min-h-0 shrink-0 flex-col", children: [
7745
- /* @__PURE__ */ jsxs13(
7775
+ return /* @__PURE__ */ jsxs14(Collapsible, { open: isExpanded, onOpenChange: onToggleExpand, className: "flex min-h-0 shrink-0 flex-col", children: [
7776
+ /* @__PURE__ */ jsxs14(
7746
7777
  CollapsibleTrigger,
7747
7778
  {
7748
7779
  className: cn(
@@ -7761,7 +7792,7 @@ function SheetsTableListByCategory({
7761
7792
  }
7762
7793
  ),
7763
7794
  /* @__PURE__ */ jsx25("span", { className: "text-muted-foreground text-xs font-medium", children: title }),
7764
- /* @__PURE__ */ jsxs13("span", { className: "ml-auto flex items-center gap-1.5", children: [
7795
+ /* @__PURE__ */ jsxs14("span", { className: "ml-auto flex items-center gap-1.5", children: [
7765
7796
  !isExpanded && hasSelectedItem && /* @__PURE__ */ jsx25("span", { className: "bg-primary/50 h-1.5 w-1.5 rounded-full", "aria-label": "Contains selected item" }),
7766
7797
  /* @__PURE__ */ jsx25("span", { className: "text-muted-foreground/70 text-[10px] tabular-nums", children: tables.length })
7767
7798
  ] })
@@ -7790,7 +7821,7 @@ function SheetsTableListByCategory({
7790
7821
  }
7791
7822
  },
7792
7823
  className: "min-h-0 overflow-hidden",
7793
- children: tables.length > 0 ? /* @__PURE__ */ jsxs13("div", { className: "relative mt-2 min-h-0", children: [
7824
+ children: tables.length > 0 ? /* @__PURE__ */ jsxs14("div", { className: "relative mt-2 min-h-0", children: [
7794
7825
  /* @__PURE__ */ jsx25(
7795
7826
  ScrollArea,
7796
7827
  {
@@ -7811,7 +7842,7 @@ function SheetsTableListByCategory({
7811
7842
  }
7812
7843
  ),
7813
7844
  showBottomBlur && tables.length > 3 && /* @__PURE__ */ jsx25(ProgressiveBlur, { position: "bottom", height: blurHeight, surface: "background", intensity: 0.22 })
7814
- ] }) : /* @__PURE__ */ jsxs13("div", { className: "flex flex-col items-center justify-center py-6 text-center", children: [
7845
+ ] }) : /* @__PURE__ */ jsxs14("div", { className: "flex flex-col items-center justify-center py-6 text-center", children: [
7815
7846
  /* @__PURE__ */ jsx25("div", { className: "bg-muted mb-2 flex h-10 w-10 items-center justify-center rounded-full", children: hasSearchTerm ? /* @__PURE__ */ jsx25(RiSearchLine, { className: "text-muted-foreground h-5 w-5" }) : /* @__PURE__ */ jsx25(RiDatabaseLine, { className: "text-muted-foreground h-5 w-5" }) }),
7816
7847
  /* @__PURE__ */ jsx25("p", { className: "text-muted-foreground text-xs", children: emptyMessage })
7817
7848
  ] })
@@ -8436,6 +8467,7 @@ export {
8436
8467
  moveActive,
8437
8468
  sheetsTableQueryKeys as queryKeys,
8438
8469
  resolveCellType,
8470
+ resolveDownloadUrl,
8439
8471
  selectCell,
8440
8472
  selectRange,
8441
8473
  selectRow,