reifyui 0.4.2 → 0.5.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.ts CHANGED
@@ -229,6 +229,90 @@ export const GoogleButton: ComponentType<Record<string, unknown>>;
229
229
  export const GOOGLE_ENABLED: boolean;
230
230
 
231
231
  // ── AI spreadsheet grid ──────────────────────────────────────────────────────
232
- export const SheetGrid: ComponentType<Record<string, unknown>>;
233
- export function sheetToDelimited(sheet: unknown, delimiter?: string): string;
234
- export function sheetToAoA(sheet: unknown): unknown[][];
232
+ export interface SheetColumn {
233
+ id: string;
234
+ name: string;
235
+ type: string;
236
+ width?: number;
237
+ options?: Array<string | { label?: string; value?: unknown; color?: string }>;
238
+ [key: string]: unknown;
239
+ }
240
+ export interface SheetRow { id: string; height?: number; [key: string]: unknown }
241
+ export interface SheetCell { value?: unknown; status?: string; error?: string | null; [key: string]: unknown }
242
+ export interface Sheet {
243
+ meta?: { title?: string; [key: string]: unknown };
244
+ columns?: SheetColumn[];
245
+ rows?: SheetRow[];
246
+ cells?: Record<string, SheetCell>;
247
+ [key: string]: unknown;
248
+ }
249
+
250
+ /** One entry in the grid's column vocabulary. A host adds a column kind by adding a descriptor
251
+ * — the grid has no hardcoded knowledge of any type beyond its own defaults. */
252
+ export interface SheetColumnType {
253
+ type: string;
254
+ label: string;
255
+ /** The app fills these cells: status dot, tint, and run affordances. */
256
+ computed?: boolean;
257
+ /** Defaults to !computed. */
258
+ editable?: boolean;
259
+ /** The column key holding this type's config; dropped when the type changes. */
260
+ configKey?: string;
261
+ /** An extra header sub-label, e.g. which kind of compute this is. */
262
+ badge?: (column: SheetColumn) => string | undefined;
263
+ /** How much room this type's config popover needs. Defaults to 250 x 340. */
264
+ configWidth?: number;
265
+ configHeight?: number;
266
+ }
267
+
268
+ export interface SheetCellRenderContext {
269
+ cell: SheetCell;
270
+ column: SheetColumn;
271
+ row: SheetRow;
272
+ rowIndex: number;
273
+ sheet: Sheet;
274
+ computed: boolean;
275
+ width?: number;
276
+ height?: number;
277
+ editing: boolean;
278
+ readOnly: boolean;
279
+ setCell: (value: unknown) => void;
280
+ runCell: (() => void) | null;
281
+ }
282
+
283
+ export interface SheetColumnConfigContext {
284
+ column: SheetColumn;
285
+ columns: SheetColumn[];
286
+ /** The type currently selected in the popover, which may differ from column.type. */
287
+ type: string;
288
+ /** Commit the column patch and close the popover. */
289
+ applyPatch: (patch: Record<string, unknown>) => void;
290
+ deleteColumn: () => void;
291
+ close: () => void;
292
+ }
293
+
294
+ export interface SheetGridProps {
295
+ sheet: Sheet;
296
+ onChange?: (next: Sheet) => void;
297
+ onRunCell?: (rowId: string, colId: string) => void;
298
+ onRunColumn?: (colId: string) => void;
299
+ readOnly?: boolean;
300
+ fetchBlobUrl?: (path: string) => Promise<string>;
301
+ onOpenResource?: (ref: Record<string, unknown>) => void;
302
+ peerMarks?: Record<string, { name: string; color: string }>;
303
+ onActiveCell?: (cellKey: string | null) => void;
304
+ columnTypes?: SheetColumnType[];
305
+ /** Replace a cell's body. Return undefined to fall through to the built-in rendering. */
306
+ renderCell?: (ctx: SheetCellRenderContext) => ReactNode | undefined;
307
+ /** Replace the column popover's body. Return undefined to fall through. */
308
+ renderColumnConfig?: (ctx: SheetColumnConfigContext) => ReactNode | undefined;
309
+ }
310
+ export const SheetGrid: ComponentType<SheetGridProps>;
311
+
312
+ /** cellText says what one cell is worth in a flat file — without it, a cell holding an object
313
+ * exports as raw JSON. */
314
+ export interface SheetExportOptions {
315
+ cellText?: (cell: SheetCell | undefined, column: SheetColumn) => string | number | boolean;
316
+ }
317
+ export function sheetToDelimited(sheet: Sheet, delimiter?: string, options?: SheetExportOptions): string;
318
+ export function sheetToAoA(sheet: Sheet, options?: SheetExportOptions): unknown[][];