@svgrid/grid 2.6.20 → 2.6.22

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 (110) hide show
  1. package/CHANGELOG.md +62 -0
  2. package/README.md +22 -0
  3. package/dist/GridMenus.svelte +17 -12
  4. package/dist/SvGrid.controller.svelte.d.ts +14 -8
  5. package/dist/SvGrid.controller.svelte.js +214 -74
  6. package/dist/SvGrid.css +1 -1
  7. package/dist/SvGrid.svelte +112 -57
  8. package/dist/SvGrid.types.d.ts +191 -1
  9. package/dist/ai.d.ts +28 -0
  10. package/dist/ai.js +6 -0
  11. package/dist/cdn/{GridMenus-B0F9iBrG.js → GridMenus-BuoBPqxx.js} +137 -132
  12. package/dist/cdn/GridMenus-n4llxoOI.js +494 -0
  13. package/dist/cdn/column-resize-DsfNXMom.js +102 -0
  14. package/dist/cdn/row-resize-BRcimkUT.js +95 -0
  15. package/dist/cdn/{src-Cd0tearp.js → src-C9Hihx1W.js} +3497 -3487
  16. package/dist/cdn/{src-B1TdiyS8.js → src-D1lXwq1l.js} +8258 -8248
  17. package/dist/cdn/svgrid.js +10 -8
  18. package/dist/cdn/svgrid.svelte-external.js +10 -8
  19. package/dist/cdn/validate-_CDJzgIo.js +75 -0
  20. package/dist/cell-formatting.d.ts +2 -0
  21. package/dist/cell-formatting.js +2 -0
  22. package/dist/chart-export.d.ts +1 -0
  23. package/dist/chart.d.ts +31 -5
  24. package/dist/chart.js +9 -3
  25. package/dist/column-groups.js +1 -1
  26. package/dist/column-resize.d.ts +46 -0
  27. package/dist/column-resize.js +205 -0
  28. package/dist/columns.d.ts +0 -3
  29. package/dist/columns.js +0 -57
  30. package/dist/core.d.ts +216 -4
  31. package/dist/core.js +532 -119
  32. package/dist/createTree.svelte.d.ts +3 -0
  33. package/dist/createTree.svelte.js +1 -0
  34. package/dist/datetime/date-core.d.ts +2 -0
  35. package/dist/datetime/date-restrict.d.ts +1 -0
  36. package/dist/datetime/timezone.d.ts +1 -0
  37. package/dist/dock-manager-model.d.ts +3 -0
  38. package/dist/dock-manager-model.js +1 -0
  39. package/dist/dock-model.d.ts +6 -0
  40. package/dist/dock-model.js +3 -0
  41. package/dist/editor-contract.d.ts +1 -0
  42. package/dist/filtering/excel-filters.js +28 -0
  43. package/dist/group-display.d.ts +1 -1
  44. package/dist/index.d.ts +2 -1
  45. package/dist/index.js +6 -0
  46. package/dist/list-option.d.ts +1 -0
  47. package/dist/menus.js +1 -1
  48. package/dist/positioning.d.ts +2 -0
  49. package/dist/row-resize.d.ts +11 -0
  50. package/dist/row-resize.js +7 -1
  51. package/dist/scheduler-ical.d.ts +1 -0
  52. package/dist/scheduler-model.d.ts +1 -0
  53. package/dist/selection.js +9 -0
  54. package/dist/spreadsheet.d.ts +1 -1
  55. package/dist/spreadsheet.js +1 -1
  56. package/dist/summaries.js +22 -0
  57. package/dist/svgrid-wrapper.types.d.ts +5 -0
  58. package/dist/toast-store.svelte.d.ts +4 -0
  59. package/dist/validate.d.ts +50 -0
  60. package/dist/validate.js +187 -0
  61. package/package.json +4 -1
  62. package/src/GridMenus.svelte +17 -12
  63. package/src/SvGrid.controller.svelte.ts +223 -76
  64. package/src/SvGrid.css +1 -1
  65. package/src/SvGrid.svelte +112 -57
  66. package/src/SvGrid.types.ts +191 -1
  67. package/src/ai.ts +28 -0
  68. package/src/cell-formatting.ts +2 -0
  69. package/src/chart-export.ts +1 -0
  70. package/src/chart.ts +31 -5
  71. package/src/column-groups.ts +1 -1
  72. package/src/column-resize.test.ts +381 -0
  73. package/src/column-resize.ts +227 -0
  74. package/src/columns.test.ts +0 -103
  75. package/src/columns.ts +0 -58
  76. package/src/core.aggregate.test.ts +134 -0
  77. package/src/core.filter.test.ts +156 -0
  78. package/src/core.grouping.test.ts +146 -0
  79. package/src/core.row-shape.test.ts +119 -0
  80. package/src/core.rowmodel-cache.test.ts +121 -0
  81. package/src/core.sort.test.ts +293 -0
  82. package/src/core.ts +723 -119
  83. package/src/createTree.svelte.ts +3 -0
  84. package/src/datetime/date-core.ts +2 -0
  85. package/src/datetime/date-restrict.ts +1 -0
  86. package/src/datetime/timezone.ts +1 -0
  87. package/src/dock-manager-model.ts +3 -0
  88. package/src/dock-model.ts +6 -0
  89. package/src/editor-contract.ts +1 -0
  90. package/src/filtering/excel-filters.ts +30 -0
  91. package/src/filtering/normalize-fast-path.test.ts +104 -0
  92. package/src/group-display.ts +1 -1
  93. package/src/index.ts +12 -1
  94. package/src/list-option.ts +1 -0
  95. package/src/menus.ts +1 -1
  96. package/src/positioning.ts +2 -0
  97. package/src/resize-props.test.ts +361 -0
  98. package/src/row-resize.test.ts +31 -0
  99. package/src/row-resize.ts +21 -3
  100. package/src/scheduler-ical.ts +1 -0
  101. package/src/scheduler-model.ts +1 -0
  102. package/src/selection.ts +9 -0
  103. package/src/spreadsheet.ts +1 -1
  104. package/src/summaries.ts +21 -0
  105. package/src/svgrid-wrapper.types.ts +5 -0
  106. package/src/svgrid.summaries.test.ts +217 -0
  107. package/src/toast-store.svelte.ts +4 -0
  108. package/src/validate.test.ts +207 -0
  109. package/src/validate.ts +269 -0
  110. package/dist/cdn/GridMenus-IHK_l7m6.js +0 -489
package/dist/ai.d.ts CHANGED
@@ -34,6 +34,7 @@ type ExportFormat = 'xlsx' | 'xls' | 'pdf' | 'csv' | 'tsv' | 'html' | 'json' | '
34
34
  * provider eventually returns a string we can parse.
35
35
  */
36
36
  export type AIProvider = (request: AIRequest) => Promise<string>;
37
+ /** One call out to the model, as the grid builds it. Providers receive this. */
37
38
  export type AIRequest = {
38
39
  /** Full prompt the grid built for the model. Already includes column
39
40
  * schema and any sampled rows where applicable. */
@@ -51,6 +52,7 @@ export type AIRequest = {
51
52
  * Useful for routing small jobs to a cheaper model. */
52
53
  maxOutputTokens?: number;
53
54
  };
55
+ /** Which helper produced a request - carried on {@link AIRequest} for routing and telemetry. */
54
56
  export type AITask = 'filter' | 'smart-fill' | 'summarize' | 'classify' | 'export' | 'anomaly' | 'chart';
55
57
  /**
56
58
  * Register the model adapter every AI call will route through. Call once
@@ -58,17 +60,22 @@ export type AITask = 'filter' | 'smart-fill' | 'summarize' | 'classify' | 'expor
58
60
  * throwing "no provider" errors.
59
61
  */
60
62
  export declare function setAIProvider(p: AIProvider | null): void;
63
+ /** The provider registered with `setAIProvider`, or null when none is. */
61
64
  export declare function getAIProvider(): AIProvider | null;
65
+ /** Whether an AI provider is registered. Gate AI affordances on this so the UI stays honest. */
62
66
  export declare function hasAIProvider(): boolean;
67
+ /** One condition in a filter plan: a column, a comparison, and the value to match. */
63
68
  export type AIFilterClause = {
64
69
  field: string;
65
70
  operator: 'contains' | 'equals' | 'startsWith' | 'greaterThan' | 'lessThan' | 'isBlank';
66
71
  value?: string;
67
72
  };
73
+ /** One ordering clause in a filter plan. */
68
74
  export type AISortClause = {
69
75
  field: string;
70
76
  desc: boolean;
71
77
  };
78
+ /** A natural-language query turned into filters and sorting, plus the model's reasoning. */
72
79
  export type AIFilterResult = {
73
80
  filters: AIFilterClause[];
74
81
  sort: AISortClause[];
@@ -76,6 +83,7 @@ export type AIFilterResult = {
76
83
  * Surface this in the UI so the user can confirm or undo. */
77
84
  rationale: string;
78
85
  };
86
+ /** Options for `aiFilter` - preview the plan, or apply it straight to the grid. */
79
87
  export type AIFilterOptions = {
80
88
  /**
81
89
  * When true, the helper not only RETURNS the plan but also applies it
@@ -92,10 +100,12 @@ export type AIFilterOptions = {
92
100
  * names without hallucinating.
93
101
  */
94
102
  export declare function aiFilter<TFeatures extends TableFeatures, TData extends RowData>(api: SvGridApi<TFeatures, TData>, query: string, opts?: AIFilterOptions): Promise<AIFilterResult>;
103
+ /** One worked example teaching smart-fill what to produce for a row. */
95
104
  export type AISmartFillExample = {
96
105
  input: Record<string, unknown>;
97
106
  output: unknown;
98
107
  };
108
+ /** Proposed values for the blank cells of one column, each with a confidence score. */
99
109
  export type AISmartFillResult<TValue = unknown> = {
100
110
  field: string;
101
111
  predictions: Array<{
@@ -105,6 +115,7 @@ export type AISmartFillResult<TValue = unknown> = {
105
115
  }>;
106
116
  rationale: string;
107
117
  };
118
+ /** Options for `aiSmartFill` - which column to fill, which rows, and the examples to learn from. */
108
119
  export type AISmartFillOptions = {
109
120
  /** Target column - the one whose values we want filled. */
110
121
  field: string;
@@ -128,6 +139,7 @@ export type AISmartFillOptions = {
128
139
  * accept-per-cell UX with confidence-coloured highlights.
129
140
  */
130
141
  export declare function aiSmartFill<TFeatures extends TableFeatures, TData extends RowData, TValue = unknown>(api: SvGridApi<TFeatures, TData>, opts: AISmartFillOptions): Promise<AISmartFillResult<TValue>>;
142
+ /** What to summarise: one row, the selection, a group, or the whole set. */
131
143
  export type AISummarizeTarget = {
132
144
  kind: 'row';
133
145
  rowIndex: number;
@@ -141,6 +153,7 @@ export type AISummarizeTarget = {
141
153
  field: string;
142
154
  value: unknown;
143
155
  };
156
+ /** A generated summary: prose, bullets, and the columns the model leaned on. */
144
157
  export type AISummary = {
145
158
  text: string;
146
159
  bullets: string[];
@@ -148,6 +161,7 @@ export type AISummary = {
148
161
  * story it just told. UI can highlight those columns. */
149
162
  highlightedFields: string[];
150
163
  };
164
+ /** Options for `aiSummarize` - the target, and optionally the question to answer. */
151
165
  export type AISummarizeOptions = {
152
166
  target: AISummarizeTarget;
153
167
  /** Optional question the user is trying to answer. Helps the model
@@ -161,6 +175,7 @@ export type AISummarizeOptions = {
161
175
  * summary stays representative without blowing the context window.
162
176
  */
163
177
  export declare function aiSummarize<TFeatures extends TableFeatures, TData extends RowData>(api: SvGridApi<TFeatures, TData>, opts: AISummarizeOptions): Promise<AISummary>;
178
+ /** Options for `aiClassify` - the column to label and the categories to choose from. */
164
179
  export type AIClassifyOptions = {
165
180
  /** Column whose free-text we're classifying. */
166
181
  inputField: string;
@@ -174,6 +189,7 @@ export type AIClassifyOptions = {
174
189
  targetRowIndices?: number[];
175
190
  signal?: AbortSignal;
176
191
  };
192
+ /** Proposed category labels per row, with the model's reasoning. */
177
193
  export type AIClassifyResult = {
178
194
  inputField: string;
179
195
  outputField: string;
@@ -190,6 +206,7 @@ export type AIClassifyResult = {
190
206
  * values it can write straight back into the grid.
191
207
  */
192
208
  export declare function aiClassify<TFeatures extends TableFeatures, TData extends RowData>(api: SvGridApi<TFeatures, TData>, opts: AIClassifyOptions): Promise<AIClassifyResult>;
209
+ /** An export the model derived from a request: format, columns, and scope. */
193
210
  export type AIExportPlan = {
194
211
  format: ExportFormat;
195
212
  filters: AIFilterClause[];
@@ -198,6 +215,7 @@ export type AIExportPlan = {
198
215
  /** Plain-English explanation of how the model read the request. */
199
216
  rationale: string;
200
217
  };
218
+ /** Options for `aiExport` - preview the plan, or run the export it describes. */
201
219
  export type AIExportOptions = {
202
220
  /**
203
221
  * Also apply the filter / sort / grouping to the grid (mutating the view) so
@@ -219,6 +237,7 @@ export type AIExportOptions = {
219
237
  * so the UI can show what it did (or preview it first with `run: false`).
220
238
  */
221
239
  export declare function aiExport<TFeatures extends TableFeatures, TData extends RowData>(api: SvGridApi<TFeatures, TData>, query: string, opts?: AIExportOptions): Promise<AIExportPlan>;
240
+ /** One flagged value, with why it stands out and how strongly. */
222
241
  export type AIAnomaly = {
223
242
  /** Index into the SCANNED rows (target order), when the model pins one row. */
224
243
  rowIndex?: number;
@@ -227,10 +246,12 @@ export type AIAnomaly = {
227
246
  reason: string;
228
247
  severity: 'low' | 'medium' | 'high';
229
248
  };
249
+ /** Everything an anomaly scan flagged across the rows it looked at. */
230
250
  export type AIAnomalyResult = {
231
251
  anomalies: AIAnomaly[];
232
252
  summary: string;
233
253
  };
254
+ /** Options for `aiFindAnomalies` - which rows and columns to scan. */
234
255
  export type AIAnomalyOptions = {
235
256
  /** Which rows to scan. Defaults to the whole dataset. */
236
257
  target?: AISummarizeTarget;
@@ -245,7 +266,9 @@ export type AIAnomalyOptions = {
245
266
  * export just those".
246
267
  */
247
268
  export declare function aiFindAnomalies<TFeatures extends TableFeatures, TData extends RowData>(api: SvGridApi<TFeatures, TData>, opts?: AIAnomalyOptions): Promise<AIAnomalyResult>;
269
+ /** Chart shapes the model may choose from when planning a visualisation. */
248
270
  export type AIChartType = 'bar' | 'line' | 'area' | 'pie';
271
+ /** A chart the model proposed: its type, and the fields to plot. */
249
272
  export type AIChartPlan = {
250
273
  type: AIChartType;
251
274
  /** Group-by (category-axis) column field, or null. */
@@ -261,6 +284,7 @@ export type AIChartPlan = {
261
284
  valueFormat: 'number' | 'currency' | 'percent';
262
285
  rationale: string;
263
286
  };
287
+ /** Options for `aiChart` - preview the plan, or render it into the grid. */
264
288
  export type AIChartOptions = {
265
289
  /** Apply the plan to the grid's chart panel (open + configure). Default false. */
266
290
  apply?: boolean;
@@ -279,6 +303,10 @@ export declare function aiChart<TFeatures extends TableFeatures, TData extends R
279
303
  * calls this for you.
280
304
  */
281
305
  export declare function enableAiCharting<TFeatures extends TableFeatures, TData extends RowData>(api: SvGridApi<TFeatures, TData>): void;
306
+ /**
307
+ * Remove the natural-language chart handler, hiding the AI button in the chart
308
+ * panel. The inverse of `enableAiCharting`; safe to call when none was set.
309
+ */
282
310
  export declare function disableAiCharting<TFeatures extends TableFeatures, TData extends RowData>(api: SvGridApi<TFeatures, TData>): void;
283
311
  /**
284
312
  * A deterministic provider that returns canned, schema-shaped responses
package/dist/ai.js CHANGED
@@ -34,9 +34,11 @@ let provider = null;
34
34
  export function setAIProvider(p) {
35
35
  provider = p;
36
36
  }
37
+ /** The provider registered with `setAIProvider`, or null when none is. */
37
38
  export function getAIProvider() {
38
39
  return provider;
39
40
  }
41
+ /** Whether an AI provider is registered. Gate AI affordances on this so the UI stays honest. */
40
42
  export function hasAIProvider() {
41
43
  return provider != null;
42
44
  }
@@ -590,6 +592,10 @@ export function enableAiCharting(api) {
590
592
  };
591
593
  });
592
594
  }
595
+ /**
596
+ * Remove the natural-language chart handler, hiding the AI button in the chart
597
+ * panel. The inverse of `enableAiCharting`; safe to call when none was set.
598
+ */
593
599
  export function disableAiCharting(api) {
594
600
  const hook = api;
595
601
  hook.setChartAiHandler?.(null);