@particle-academy/holy-sheet 2.7.0 → 2.8.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.
package/dist/index.d.cts CHANGED
@@ -70,6 +70,28 @@ interface SheetSchema {
70
70
  right?: string;
71
71
  };
72
72
  };
73
+ /** Native charts drawn over cell ranges; they stay live when the cells change. */
74
+ charts?: ChartSchema[];
75
+ }
76
+ interface ChartSchema {
77
+ type: "column" | "bar" | "line" | "pie";
78
+ title?: string;
79
+ /** Axis labels, e.g. "A5:A7" or "'Other sheet'!A5:A7". */
80
+ categories?: string;
81
+ series: {
82
+ name?: string;
83
+ values: string;
84
+ color?: string;
85
+ }[];
86
+ /** Top-left and bottom-right cells; defaults to beside the data. */
87
+ position?: {
88
+ from: string;
89
+ to: string;
90
+ };
91
+ dataLabels?: boolean;
92
+ legend?: boolean;
93
+ /** Excel number format for the axis and labels, e.g. "$#,##0". */
94
+ format?: string;
73
95
  }
74
96
  interface HolySheetSchema {
75
97
  sheets: SheetSchema[];
@@ -235,7 +257,7 @@ interface SetMetaOp {
235
257
  }
236
258
 
237
259
  /** This package's own version, pinned to package.json by `version.test.ts`. */
238
- declare const VERSION = "2.7.0";
260
+ declare const VERSION = "2.8.0";
239
261
  type Any$6 = any;
240
262
  /**
241
263
  * Agent — the structured-tool surface for Holy Sheet. Mirrors PHP `Agent`.
@@ -307,7 +329,7 @@ type Any$5 = any;
307
329
  * over `Agent`. Provided for parity / DI ergonomics; most callers use `Agent`.
308
330
  */
309
331
  declare class HolySheet {
310
- static readonly VERSION = "2.7.0";
332
+ static readonly VERSION = "2.8.0";
311
333
  validate(schema: Any$5): ValidationError[];
312
334
  toBytes(schema: Any$5): Uint8Array;
313
335
  write(schema: Any$5, path: string): Promise<WriteResult>;
@@ -440,6 +462,33 @@ declare class MergedRegion {
440
462
  ref(): string;
441
463
  }
442
464
 
465
+ /**
466
+ * A cell range a chart reads from. Mirrors PHP `Workbook\ChartRange`:
467
+ * "B5:B7", "B5", "'Q3 Revenue'!B5:B7" or "Data!B5:B7", resolved against the
468
+ * chart's own sheet when no sheet is named.
469
+ */
470
+ declare class ChartRange {
471
+ readonly sheet: string;
472
+ /** 0-based first column. */
473
+ readonly c1: number;
474
+ /** 1-based first row. */
475
+ readonly r1: number;
476
+ readonly c2: number;
477
+ readonly r2: number;
478
+ constructor(sheet: string,
479
+ /** 0-based first column. */
480
+ c1: number,
481
+ /** 1-based first row. */
482
+ r1: number, c2: number, r2: number);
483
+ static parse(ref: unknown, defaultSheet: string): ChartRange | null;
484
+ /** 'Q3 Revenue'!$B$5:$B$7 */
485
+ formula(): string;
486
+ /** "B5:B7" on its own sheet, "'Data'!B5:B7" on another. */
487
+ toSchema(ownSheet: string): string;
488
+ /** A1 addresses, row by row. */
489
+ addresses(): string[];
490
+ }
491
+
443
492
  /** How a sheet prints. Mirrors the PHP `Sheet::$print` array. */
444
493
  interface PrintSetup {
445
494
  orientation: "portrait" | "landscape" | null;
@@ -450,6 +499,23 @@ interface PrintSetup {
450
499
  right: string;
451
500
  } | null;
452
501
  }
502
+ /** A native chart, normalised. Mirrors the PHP `Sheet::$charts` entries. */
503
+ interface NormalizedChart {
504
+ type: "column" | "bar" | "line" | "pie";
505
+ title: string | null;
506
+ categories: ChartRange | null;
507
+ series: {
508
+ name: string | null;
509
+ values: ChartRange;
510
+ color: string | null;
511
+ }[];
512
+ /** [col, row], both 0-based. */
513
+ from: [number, number];
514
+ to: [number, number];
515
+ legend: boolean | null;
516
+ dataLabels: boolean;
517
+ format: string | null;
518
+ }
453
519
  /** A worksheet. Mirrors PHP `Workbook\Sheet`. Cells are an A1-keyed map. */
454
520
  declare class Sheet {
455
521
  readonly name: string;
@@ -461,9 +527,11 @@ declare class Sheet {
461
527
  /** 1-based row number → pixels. */
462
528
  readonly rowHeights: Map<number, number>;
463
529
  readonly print: PrintSetup | null;
530
+ readonly charts: NormalizedChart[];
464
531
  constructor(name: string, cells?: Map<string, Cell>, mergedRegions?: MergedRegion[], columnWidths?: Map<number, number>, frozenRows?: number, frozenCols?: number,
465
532
  /** 1-based row number → pixels. */
466
- rowHeights?: Map<number, number>, print?: PrintSetup | null);
533
+ rowHeights?: Map<number, number>, print?: PrintSetup | null, charts?: NormalizedChart[]);
534
+ withCharts(charts: NormalizedChart[]): Sheet;
467
535
  /** rowNumber → (colLetter → Cell), sorted by ascending row number. */
468
536
  rows(): Map<number, Map<string, Cell>>;
469
537
  hasComments(): boolean;
@@ -580,6 +648,7 @@ declare class XlsxWriter {
580
648
  private rootRelsXml;
581
649
  private workbookXml;
582
650
  private workbookRelsXml;
651
+ /** Comments keep rId1 (vml) and rId2 (comments); the chart drawing takes the next id. */
583
652
  private sheetRelsXml;
584
653
  private sheetXml;
585
654
  private cellXml;
@@ -823,4 +892,4 @@ declare function zipSync(files: ZipFile[]): Uint8Array;
823
892
 
824
893
  declare function unzipSync(data: Uint8Array): Record<string, Uint8Array>;
825
894
 
826
- export { type AddSheetOp, Agent, type AggOp, ArrayBuilder, type BuilderOptions, CellAddress, type CellData, type CellFormatInput, type CellPrimitive, type ClearCellOp, type ColumnSchema, type ColumnType, type CommentInput, CsvBuilder, type DeleteColumnsOp, type DeleteRowsOp, type DisplayFormat, FormatSniffer, FormulaLinter, type FormulaProblem, HolySheet, type HolySheetSchema, Inference, type InsertColumnsOp, type InsertRowsOp, type MoveSheetOp, Normalizer, OdsReader, type RemoveSheetOp, type RenameSheetOp, type RepairResult, Repairer, type ReplaceSheetOp, type RowCell, SchemaException, type SetCellOp, type SetColumnWidthsOp, type SetFrozenOp, type SetMergedRegionsOp, type SetMetaOp, type SetRangeOp, type SetWorkbookOp, SheetDiff, type SheetOp, SheetOpSchema, type SheetOpType, SheetReducer, type SheetSchema, type SpreadsheetFormat, Theme, type ThemeKey, UnsupportedFormatException, VERSION, type ValidationError, Validator, type WriteResult, XlsxReader, XlsxWriter, type ZipFile, unzipSync, zipSync };
895
+ export { type AddSheetOp, Agent, type AggOp, ArrayBuilder, type BuilderOptions, CellAddress, type CellData, type CellFormatInput, type CellPrimitive, type ChartSchema, type ClearCellOp, type ColumnSchema, type ColumnType, type CommentInput, CsvBuilder, type DeleteColumnsOp, type DeleteRowsOp, type DisplayFormat, FormatSniffer, FormulaLinter, type FormulaProblem, HolySheet, type HolySheetSchema, Inference, type InsertColumnsOp, type InsertRowsOp, type MoveSheetOp, Normalizer, OdsReader, type RemoveSheetOp, type RenameSheetOp, type RepairResult, Repairer, type ReplaceSheetOp, type RowCell, SchemaException, type SetCellOp, type SetColumnWidthsOp, type SetFrozenOp, type SetMergedRegionsOp, type SetMetaOp, type SetRangeOp, type SetWorkbookOp, SheetDiff, type SheetOp, SheetOpSchema, type SheetOpType, SheetReducer, type SheetSchema, type SpreadsheetFormat, Theme, type ThemeKey, UnsupportedFormatException, VERSION, type ValidationError, Validator, type WriteResult, XlsxReader, XlsxWriter, type ZipFile, unzipSync, zipSync };
package/dist/index.d.ts CHANGED
@@ -70,6 +70,28 @@ interface SheetSchema {
70
70
  right?: string;
71
71
  };
72
72
  };
73
+ /** Native charts drawn over cell ranges; they stay live when the cells change. */
74
+ charts?: ChartSchema[];
75
+ }
76
+ interface ChartSchema {
77
+ type: "column" | "bar" | "line" | "pie";
78
+ title?: string;
79
+ /** Axis labels, e.g. "A5:A7" or "'Other sheet'!A5:A7". */
80
+ categories?: string;
81
+ series: {
82
+ name?: string;
83
+ values: string;
84
+ color?: string;
85
+ }[];
86
+ /** Top-left and bottom-right cells; defaults to beside the data. */
87
+ position?: {
88
+ from: string;
89
+ to: string;
90
+ };
91
+ dataLabels?: boolean;
92
+ legend?: boolean;
93
+ /** Excel number format for the axis and labels, e.g. "$#,##0". */
94
+ format?: string;
73
95
  }
74
96
  interface HolySheetSchema {
75
97
  sheets: SheetSchema[];
@@ -235,7 +257,7 @@ interface SetMetaOp {
235
257
  }
236
258
 
237
259
  /** This package's own version, pinned to package.json by `version.test.ts`. */
238
- declare const VERSION = "2.7.0";
260
+ declare const VERSION = "2.8.0";
239
261
  type Any$6 = any;
240
262
  /**
241
263
  * Agent — the structured-tool surface for Holy Sheet. Mirrors PHP `Agent`.
@@ -307,7 +329,7 @@ type Any$5 = any;
307
329
  * over `Agent`. Provided for parity / DI ergonomics; most callers use `Agent`.
308
330
  */
309
331
  declare class HolySheet {
310
- static readonly VERSION = "2.7.0";
332
+ static readonly VERSION = "2.8.0";
311
333
  validate(schema: Any$5): ValidationError[];
312
334
  toBytes(schema: Any$5): Uint8Array;
313
335
  write(schema: Any$5, path: string): Promise<WriteResult>;
@@ -440,6 +462,33 @@ declare class MergedRegion {
440
462
  ref(): string;
441
463
  }
442
464
 
465
+ /**
466
+ * A cell range a chart reads from. Mirrors PHP `Workbook\ChartRange`:
467
+ * "B5:B7", "B5", "'Q3 Revenue'!B5:B7" or "Data!B5:B7", resolved against the
468
+ * chart's own sheet when no sheet is named.
469
+ */
470
+ declare class ChartRange {
471
+ readonly sheet: string;
472
+ /** 0-based first column. */
473
+ readonly c1: number;
474
+ /** 1-based first row. */
475
+ readonly r1: number;
476
+ readonly c2: number;
477
+ readonly r2: number;
478
+ constructor(sheet: string,
479
+ /** 0-based first column. */
480
+ c1: number,
481
+ /** 1-based first row. */
482
+ r1: number, c2: number, r2: number);
483
+ static parse(ref: unknown, defaultSheet: string): ChartRange | null;
484
+ /** 'Q3 Revenue'!$B$5:$B$7 */
485
+ formula(): string;
486
+ /** "B5:B7" on its own sheet, "'Data'!B5:B7" on another. */
487
+ toSchema(ownSheet: string): string;
488
+ /** A1 addresses, row by row. */
489
+ addresses(): string[];
490
+ }
491
+
443
492
  /** How a sheet prints. Mirrors the PHP `Sheet::$print` array. */
444
493
  interface PrintSetup {
445
494
  orientation: "portrait" | "landscape" | null;
@@ -450,6 +499,23 @@ interface PrintSetup {
450
499
  right: string;
451
500
  } | null;
452
501
  }
502
+ /** A native chart, normalised. Mirrors the PHP `Sheet::$charts` entries. */
503
+ interface NormalizedChart {
504
+ type: "column" | "bar" | "line" | "pie";
505
+ title: string | null;
506
+ categories: ChartRange | null;
507
+ series: {
508
+ name: string | null;
509
+ values: ChartRange;
510
+ color: string | null;
511
+ }[];
512
+ /** [col, row], both 0-based. */
513
+ from: [number, number];
514
+ to: [number, number];
515
+ legend: boolean | null;
516
+ dataLabels: boolean;
517
+ format: string | null;
518
+ }
453
519
  /** A worksheet. Mirrors PHP `Workbook\Sheet`. Cells are an A1-keyed map. */
454
520
  declare class Sheet {
455
521
  readonly name: string;
@@ -461,9 +527,11 @@ declare class Sheet {
461
527
  /** 1-based row number → pixels. */
462
528
  readonly rowHeights: Map<number, number>;
463
529
  readonly print: PrintSetup | null;
530
+ readonly charts: NormalizedChart[];
464
531
  constructor(name: string, cells?: Map<string, Cell>, mergedRegions?: MergedRegion[], columnWidths?: Map<number, number>, frozenRows?: number, frozenCols?: number,
465
532
  /** 1-based row number → pixels. */
466
- rowHeights?: Map<number, number>, print?: PrintSetup | null);
533
+ rowHeights?: Map<number, number>, print?: PrintSetup | null, charts?: NormalizedChart[]);
534
+ withCharts(charts: NormalizedChart[]): Sheet;
467
535
  /** rowNumber → (colLetter → Cell), sorted by ascending row number. */
468
536
  rows(): Map<number, Map<string, Cell>>;
469
537
  hasComments(): boolean;
@@ -580,6 +648,7 @@ declare class XlsxWriter {
580
648
  private rootRelsXml;
581
649
  private workbookXml;
582
650
  private workbookRelsXml;
651
+ /** Comments keep rId1 (vml) and rId2 (comments); the chart drawing takes the next id. */
583
652
  private sheetRelsXml;
584
653
  private sheetXml;
585
654
  private cellXml;
@@ -823,4 +892,4 @@ declare function zipSync(files: ZipFile[]): Uint8Array;
823
892
 
824
893
  declare function unzipSync(data: Uint8Array): Record<string, Uint8Array>;
825
894
 
826
- export { type AddSheetOp, Agent, type AggOp, ArrayBuilder, type BuilderOptions, CellAddress, type CellData, type CellFormatInput, type CellPrimitive, type ClearCellOp, type ColumnSchema, type ColumnType, type CommentInput, CsvBuilder, type DeleteColumnsOp, type DeleteRowsOp, type DisplayFormat, FormatSniffer, FormulaLinter, type FormulaProblem, HolySheet, type HolySheetSchema, Inference, type InsertColumnsOp, type InsertRowsOp, type MoveSheetOp, Normalizer, OdsReader, type RemoveSheetOp, type RenameSheetOp, type RepairResult, Repairer, type ReplaceSheetOp, type RowCell, SchemaException, type SetCellOp, type SetColumnWidthsOp, type SetFrozenOp, type SetMergedRegionsOp, type SetMetaOp, type SetRangeOp, type SetWorkbookOp, SheetDiff, type SheetOp, SheetOpSchema, type SheetOpType, SheetReducer, type SheetSchema, type SpreadsheetFormat, Theme, type ThemeKey, UnsupportedFormatException, VERSION, type ValidationError, Validator, type WriteResult, XlsxReader, XlsxWriter, type ZipFile, unzipSync, zipSync };
895
+ export { type AddSheetOp, Agent, type AggOp, ArrayBuilder, type BuilderOptions, CellAddress, type CellData, type CellFormatInput, type CellPrimitive, type ChartSchema, type ClearCellOp, type ColumnSchema, type ColumnType, type CommentInput, CsvBuilder, type DeleteColumnsOp, type DeleteRowsOp, type DisplayFormat, FormatSniffer, FormulaLinter, type FormulaProblem, HolySheet, type HolySheetSchema, Inference, type InsertColumnsOp, type InsertRowsOp, type MoveSheetOp, Normalizer, OdsReader, type RemoveSheetOp, type RenameSheetOp, type RepairResult, Repairer, type ReplaceSheetOp, type RowCell, SchemaException, type SetCellOp, type SetColumnWidthsOp, type SetFrozenOp, type SetMergedRegionsOp, type SetMetaOp, type SetRangeOp, type SetWorkbookOp, SheetDiff, type SheetOp, SheetOpSchema, type SheetOpType, SheetReducer, type SheetSchema, type SpreadsheetFormat, Theme, type ThemeKey, UnsupportedFormatException, VERSION, type ValidationError, Validator, type WriteResult, XlsxReader, XlsxWriter, type ZipFile, unzipSync, zipSync };