@svgrid/grid 2.2.16 → 2.2.18

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 (290) hide show
  1. package/README.md +1 -1
  2. package/dist/GridFooter.svelte +12 -11
  3. package/dist/SvAnchor.svelte +65 -0
  4. package/dist/SvAnchor.svelte.d.ts +24 -0
  5. package/dist/SvAspectRatio.svelte +38 -0
  6. package/dist/SvAspectRatio.svelte.d.ts +16 -0
  7. package/dist/SvAutoComplete.svelte +52 -7
  8. package/dist/SvAutoComplete.svelte.d.ts +4 -1
  9. package/dist/SvBlockquote.svelte +43 -0
  10. package/dist/SvBlockquote.svelte.d.ts +16 -0
  11. package/dist/SvCalendar.svelte +33 -2
  12. package/dist/SvCalendar.svelte.d.ts +8 -1
  13. package/dist/SvCheckBox.svelte +6 -2
  14. package/dist/SvCode.svelte +52 -0
  15. package/dist/SvCode.svelte.d.ts +19 -0
  16. package/dist/SvCollapsible.svelte +75 -0
  17. package/dist/SvCollapsible.svelte.d.ts +27 -0
  18. package/dist/SvColorInput.svelte +11 -17
  19. package/dist/SvColorInput.svelte.d.ts +2 -0
  20. package/dist/SvComboBox.svelte +85 -8
  21. package/dist/SvComboBox.svelte.d.ts +14 -0
  22. package/dist/SvCountryInput.svelte +2 -2
  23. package/dist/SvCountryInput.svelte.d.ts +1 -1
  24. package/dist/SvDropDownList.svelte +154 -51
  25. package/dist/SvDropDownList.svelte.d.ts +17 -3
  26. package/dist/SvDurationInput.svelte +59 -41
  27. package/dist/SvDurationInput.svelte.d.ts +18 -0
  28. package/dist/SvField.svelte +203 -12
  29. package/dist/SvField.svelte.d.ts +45 -8
  30. package/dist/SvForm.svelte +195 -21
  31. package/dist/SvForm.svelte.d.ts +23 -0
  32. package/dist/SvGrid.controller.svelte.d.ts +12 -1
  33. package/dist/SvGrid.controller.svelte.js +87 -7
  34. package/dist/SvGrid.svelte +383 -181
  35. package/dist/SvGrid.types.d.ts +123 -2
  36. package/dist/SvGridChartView.svelte +70 -0
  37. package/dist/SvGridChartView.svelte.d.ts +11 -0
  38. package/dist/SvGridDropdown.svelte +9 -2
  39. package/dist/SvGridSelect.svelte +5 -2
  40. package/dist/SvGridSelect.svelte.d.ts +1 -1
  41. package/dist/SvGroup.svelte +41 -0
  42. package/dist/SvGroup.svelte.d.ts +27 -0
  43. package/dist/SvHoverCard.svelte +70 -0
  44. package/dist/SvHoverCard.svelte.d.ts +41 -0
  45. package/dist/SvKbd.svelte +51 -0
  46. package/dist/SvKbd.svelte.d.ts +18 -0
  47. package/dist/SvList.svelte +55 -0
  48. package/dist/SvList.svelte.d.ts +23 -0
  49. package/dist/SvListBox.svelte +166 -77
  50. package/dist/SvListBox.svelte.d.ts +17 -4
  51. package/dist/SvLoadingOverlay.svelte +53 -0
  52. package/dist/SvLoadingOverlay.svelte.d.ts +28 -0
  53. package/dist/SvMark.svelte +36 -0
  54. package/dist/SvMark.svelte.d.ts +14 -0
  55. package/dist/SvMaskedInput.svelte +50 -35
  56. package/dist/SvMaskedInput.svelte.d.ts +17 -2
  57. package/dist/SvMenuList.svelte +32 -3
  58. package/dist/SvMenubar.svelte +200 -0
  59. package/dist/SvMenubar.svelte.d.ts +18 -0
  60. package/dist/SvMultiSelect.svelte +7 -4
  61. package/dist/SvMultiSelect.svelte.d.ts +1 -1
  62. package/dist/SvNumberInput.svelte +79 -42
  63. package/dist/SvNumberInput.svelte.d.ts +25 -0
  64. package/dist/SvOtpInput.svelte +2 -2
  65. package/dist/SvPasswordInput.svelte +51 -31
  66. package/dist/SvPasswordInput.svelte.d.ts +17 -0
  67. package/dist/SvPhoneInput.svelte +39 -28
  68. package/dist/SvPhoneInput.svelte.d.ts +4 -0
  69. package/dist/SvPopconfirm.svelte +79 -0
  70. package/dist/SvPopconfirm.svelte.d.ts +42 -0
  71. package/dist/SvPopover.svelte +87 -29
  72. package/dist/SvPopover.svelte.d.ts +18 -4
  73. package/dist/SvRadioGroup.svelte +5 -1
  74. package/dist/SvResult.svelte +73 -0
  75. package/dist/SvResult.svelte.d.ts +28 -0
  76. package/dist/SvSegmented.svelte +114 -0
  77. package/dist/SvSegmented.svelte.d.ts +29 -0
  78. package/dist/SvSimpleGrid.svelte +41 -0
  79. package/dist/SvSimpleGrid.svelte.d.ts +25 -0
  80. package/dist/SvSlider.svelte +23 -10
  81. package/dist/SvSpinner.svelte +43 -0
  82. package/dist/SvSpinner.svelte.d.ts +20 -0
  83. package/dist/SvStack.svelte +37 -0
  84. package/dist/SvStack.svelte.d.ts +24 -0
  85. package/dist/SvSwitchButton.svelte +6 -1
  86. package/dist/SvTagsInput.svelte +9 -5
  87. package/dist/SvText.svelte +76 -0
  88. package/dist/SvText.svelte.d.ts +31 -0
  89. package/dist/SvTextInput.svelte +75 -43
  90. package/dist/SvTextInput.svelte.d.ts +28 -1
  91. package/dist/SvTimePicker.svelte +32 -2
  92. package/dist/SvTimePicker.svelte.d.ts +8 -9
  93. package/dist/SvTitle.svelte +57 -0
  94. package/dist/SvTitle.svelte.d.ts +24 -0
  95. package/dist/SvToaster.svelte +41 -6
  96. package/dist/SvToggleButton.svelte +4 -1
  97. package/dist/SvTooltip.svelte +68 -34
  98. package/dist/SvTooltip.svelte.d.ts +14 -2
  99. package/dist/SvTree.svelte +81 -21
  100. package/dist/SvTree.svelte.d.ts +3 -2
  101. package/dist/SvTreeSelect.svelte +5 -2
  102. package/dist/SvTreeSelect.svelte.d.ts +1 -1
  103. package/dist/SvVisuallyHidden.svelte +49 -0
  104. package/dist/SvVisuallyHidden.svelte.d.ts +19 -0
  105. package/dist/ai.d.ts +289 -0
  106. package/dist/ai.js +1013 -0
  107. package/dist/board-view.svelte.d.ts +22 -0
  108. package/dist/board-view.svelte.js +13 -0
  109. package/dist/build-api.js +36 -6
  110. package/dist/cdn/GridMenus-0AK9O7qG.js +420 -0
  111. package/dist/cdn/GridMenus-BjUoCXoD.js +416 -0
  112. package/dist/cdn/SvDateTimePicker-CYC7gRER.js +2176 -0
  113. package/dist/cdn/SvDateTimePicker-DtQKd4Ns.js +2198 -0
  114. package/dist/cdn/SvGridChart-BcLCYvw9.js +1195 -0
  115. package/dist/cdn/SvGridChart-BhnFdLd0.js +1203 -0
  116. package/dist/cdn/SvGridChartPanel-Cmx9DHAS.js +561 -0
  117. package/dist/cdn/SvGridChartPanel-DvjwxLvK.js +577 -0
  118. package/dist/cdn/SvGridChartView-B40DTJSX.js +54 -0
  119. package/dist/cdn/SvGridChartView-PwqI4s02.js +53 -0
  120. package/dist/cdn/SvGridDropdown-DjALc_4f.js +255 -0
  121. package/dist/cdn/SvGridDropdown-hpnHvOGt.js +254 -0
  122. package/dist/cdn/chart-T1usDN0o.js +1212 -0
  123. package/dist/cdn/disclose-version-DoD9AFD_.js +2958 -0
  124. package/dist/cdn/export-format-JT5pWVT8.js +561 -0
  125. package/dist/cdn/popover-P-9P2YYn.js +69 -0
  126. package/dist/cdn/rolldown-runtime-Dy4uBu1J.js +11 -0
  127. package/dist/cdn/src-BLhdLmoN.js +25707 -0
  128. package/dist/cdn/src-BwnUVj3T.js +25623 -0
  129. package/dist/cdn/svgrid.js +9 -32897
  130. package/dist/cdn/svgrid.svelte-external.js +9 -30052
  131. package/dist/cell-formatting.d.ts +2 -2
  132. package/dist/cell-render.js +4 -4
  133. package/dist/chart-view.svelte.d.ts +25 -0
  134. package/dist/chart-view.svelte.js +14 -0
  135. package/dist/createCombobox.svelte.d.ts +5 -0
  136. package/dist/createCombobox.svelte.js +21 -5
  137. package/dist/createDropdownList.svelte.d.ts +3 -0
  138. package/dist/createDropdownList.svelte.js +8 -2
  139. package/dist/createForm.svelte.d.ts +18 -0
  140. package/dist/createForm.svelte.js +51 -6
  141. package/dist/createMenu.svelte.js +27 -0
  142. package/dist/createPopoverSelect.svelte.d.ts +3 -0
  143. package/dist/createPopoverSelect.svelte.js +9 -1
  144. package/dist/createSlider.svelte.d.ts +8 -21
  145. package/dist/createSlider.svelte.js +34 -0
  146. package/dist/createTooltip.svelte.d.ts +12 -0
  147. package/dist/createTooltip.svelte.js +72 -9
  148. package/dist/editor-contract.d.ts +15 -0
  149. package/dist/export-provider.d.ts +27 -0
  150. package/dist/export-provider.js +9 -0
  151. package/dist/filter-operators.d.ts +6 -0
  152. package/dist/filter-operators.js +33 -0
  153. package/dist/form-field.d.ts +45 -2
  154. package/dist/grid-messages.d.ts +61 -0
  155. package/dist/grid-messages.js +72 -0
  156. package/dist/group-display.d.ts +62 -0
  157. package/dist/group-display.js +78 -0
  158. package/dist/index.d.ts +36 -4
  159. package/dist/index.js +43 -2
  160. package/dist/js-scroller.svelte.d.ts +35 -0
  161. package/dist/js-scroller.svelte.js +154 -0
  162. package/dist/list-option.d.ts +46 -0
  163. package/dist/list-option.js +53 -0
  164. package/dist/menus.js +25 -11
  165. package/dist/pivot-view.svelte.d.ts +72 -0
  166. package/dist/pivot-view.svelte.js +13 -0
  167. package/dist/positioning.d.ts +111 -0
  168. package/dist/positioning.js +191 -0
  169. package/dist/scheduler-model.d.ts +3 -0
  170. package/dist/scheduler-model.js +22 -5
  171. package/dist/svgrid-wrapper.types.d.ts +18 -0
  172. package/dist/toast-store.svelte.d.ts +54 -0
  173. package/dist/toast-store.svelte.js +65 -15
  174. package/package.json +9 -1
  175. package/src/GridFooter.svelte +12 -11
  176. package/src/SvAnchor.svelte +65 -0
  177. package/src/SvAspectRatio.svelte +38 -0
  178. package/src/SvAutoComplete.svelte +52 -7
  179. package/src/SvBlockquote.svelte +43 -0
  180. package/src/SvCalendar.svelte +33 -2
  181. package/src/SvCalendar.test.ts +15 -0
  182. package/src/SvCheckBox.svelte +6 -2
  183. package/src/SvCode.svelte +52 -0
  184. package/src/SvCollapsible.svelte +75 -0
  185. package/src/SvColorInput.svelte +11 -17
  186. package/src/SvComboBox.svelte +85 -8
  187. package/src/SvCountryInput.svelte +2 -2
  188. package/src/SvDropDownList.svelte +154 -51
  189. package/src/SvDurationInput.svelte +59 -41
  190. package/src/SvField.svelte +203 -12
  191. package/src/SvForm.svelte +195 -21
  192. package/src/SvForm.test.ts +112 -0
  193. package/src/SvGrid.controller.svelte.ts +88 -7
  194. package/src/SvGrid.svelte +383 -181
  195. package/src/SvGrid.types.ts +125 -1
  196. package/src/SvGridChartView.svelte +70 -0
  197. package/src/SvGridDropdown.svelte +9 -2
  198. package/src/SvGridSelect.svelte +5 -2
  199. package/src/SvGroup.svelte +41 -0
  200. package/src/SvHoverCard.svelte +70 -0
  201. package/src/SvKbd.svelte +51 -0
  202. package/src/SvList.svelte +55 -0
  203. package/src/SvListBox.svelte +166 -77
  204. package/src/SvLoadingOverlay.svelte +53 -0
  205. package/src/SvMark.svelte +36 -0
  206. package/src/SvMaskedInput.svelte +50 -35
  207. package/src/SvMenuList.svelte +32 -3
  208. package/src/SvMenubar.svelte +200 -0
  209. package/src/SvMultiSelect.svelte +7 -4
  210. package/src/SvNumberInput.svelte +79 -42
  211. package/src/SvOtpInput.svelte +2 -2
  212. package/src/SvPasswordInput.svelte +51 -31
  213. package/src/SvPhoneInput.svelte +39 -28
  214. package/src/SvPopconfirm.svelte +79 -0
  215. package/src/SvPopover.svelte +87 -29
  216. package/src/SvRadioGroup.svelte +5 -1
  217. package/src/SvResult.svelte +73 -0
  218. package/src/SvSegmented.svelte +114 -0
  219. package/src/SvSimpleGrid.svelte +41 -0
  220. package/src/SvSlider.svelte +23 -10
  221. package/src/SvSpinner.svelte +43 -0
  222. package/src/SvStack.svelte +37 -0
  223. package/src/SvSwitchButton.svelte +6 -1
  224. package/src/SvTagsInput.svelte +9 -5
  225. package/src/SvText.svelte +76 -0
  226. package/src/SvTextInput.svelte +75 -43
  227. package/src/SvTimePicker.svelte +32 -2
  228. package/src/SvTitle.svelte +57 -0
  229. package/src/SvToaster.svelte +41 -6
  230. package/src/SvToaster.test.ts +32 -0
  231. package/src/SvToggleButton.svelte +4 -1
  232. package/src/SvTooltip.svelte +68 -34
  233. package/src/SvTree.svelte +81 -21
  234. package/src/SvTreeSelect.svelte +5 -2
  235. package/src/SvVisuallyHidden.svelte +49 -0
  236. package/src/ai.test.ts +502 -0
  237. package/src/ai.ts +1391 -0
  238. package/src/board-view.svelte.ts +33 -0
  239. package/src/build-api.coverage.test.ts +101 -0
  240. package/src/build-api.ts +43 -18
  241. package/src/builtin-editors.grid.test.ts +1 -1
  242. package/src/cell-formatting.ts +5 -5
  243. package/src/cell-render.ts +4 -4
  244. package/src/chart-view.svelte.ts +36 -0
  245. package/src/createCombobox.svelte.ts +17 -5
  246. package/src/createDropdownList.svelte.ts +8 -2
  247. package/src/createForm.svelte.ts +59 -6
  248. package/src/createMenu.svelte.ts +23 -0
  249. package/src/createPopoverSelect.svelte.ts +8 -1
  250. package/src/createSlider.svelte.ts +20 -0
  251. package/src/createTooltip.svelte.ts +67 -9
  252. package/src/editor-contract.ts +16 -0
  253. package/src/export-provider.ts +40 -0
  254. package/src/filter-operators.ts +37 -0
  255. package/src/form-field.ts +42 -2
  256. package/src/grid-messages.test.ts +24 -0
  257. package/src/grid-messages.ts +137 -0
  258. package/src/group-display.test.ts +77 -0
  259. package/src/group-display.ts +117 -0
  260. package/src/i18n.grid.test.ts +73 -0
  261. package/src/index.ts +91 -2
  262. package/src/js-scroller.svelte.ts +173 -0
  263. package/src/list-option.test.ts +56 -0
  264. package/src/list-option.ts +81 -0
  265. package/src/menus.test.ts +32 -0
  266. package/src/menus.ts +25 -12
  267. package/src/pivot-view.svelte.ts +90 -0
  268. package/src/pivot-view.test.ts +38 -0
  269. package/src/pivot.grid.test.ts +102 -0
  270. package/src/positioning.test.ts +141 -0
  271. package/src/positioning.ts +266 -0
  272. package/src/scheduler-model.test.ts +16 -0
  273. package/src/scheduler-model.ts +24 -5
  274. package/src/svgrid-wrapper.types.ts +23 -0
  275. package/src/svgrid.charting.test.ts +8 -1
  276. package/src/svgrid.comments-autocomplete.test.ts +7 -2
  277. package/src/svgrid.context-menu.test.ts +8 -3
  278. package/src/toast-store.svelte.ts +98 -0
  279. package/src/toast-store.test.ts +62 -1
  280. package/src/ui-breadth.test.ts +138 -0
  281. package/src/ui-buttons.test.ts +39 -0
  282. package/src/ui-inputs.test.ts +2 -2
  283. package/src/ui-range.test.ts +9 -0
  284. package/src/ui-selection.test.ts +36 -0
  285. package/src/ui-tier1.test.ts +1 -1
  286. package/src/virtual.test.ts +20 -6
  287. package/dist/SvGridBoard.svelte +0 -2339
  288. package/dist/SvGridBoard.svelte.d.ts +0 -31
  289. package/src/SvGridBoard.svelte +0 -2339
  290. package/src/board.test.ts +0 -927
package/dist/ai.d.ts ADDED
@@ -0,0 +1,289 @@
1
+ /**
2
+ * Pro AI feature pack
3
+ * -------------------
4
+ *
5
+ * Three jobs every analyst wishes a data grid could do:
6
+ *
7
+ * 1. Natural-language filter / sort (`aiFilter`)
8
+ * "show me deals closing this quarter over $50k owned by Sasha"
9
+ * -> { filters: [...], sort: [...] }
10
+ *
11
+ * 2. Smart fill (`aiSmartFill`)
12
+ * User edits two cells in a column with example values; the
13
+ * Grid proposes the rest. Excel "Flash Fill" pattern.
14
+ *
15
+ * 3. Summarise rows (`aiSummarize`)
16
+ * Single row, the current selection, a group key, or the whole
17
+ * filtered view -> a one-paragraph summary.
18
+ *
19
+ * The grid stays headless / model-agnostic. The consumer supplies an
20
+ * `AIProvider` that knows how to call OpenAI / Anthropic / a local
21
+ * model / a server-side proxy. We never bundle a model client.
22
+ *
23
+ * Built-in + free: the AI helpers live in `@svgrid/grid`. They ship no model
24
+ * client and do nothing until you register a provider with `setAIProvider(...)`,
25
+ * so they add nothing to the base bundle unless you actually use them.
26
+ */
27
+ import type { RowData, SvGridApi, TableFeatures } from './index';
28
+ type ExportFormat = 'xlsx' | 'xls' | 'pdf' | 'csv' | 'tsv' | 'html' | 'json' | 'xml' | 'md';
29
+ /**
30
+ * Shape every consumer-provided model adapter must implement. Keeping this
31
+ * tiny (one async call, two response formats) lets the same adapter drive
32
+ * OpenAI's `chat.completions`, Anthropic's `messages`, a self-hosted
33
+ * llama.cpp endpoint, or a server-side proxy. The grid only cares that the
34
+ * provider eventually returns a string we can parse.
35
+ */
36
+ export type AIProvider = (request: AIRequest) => Promise<string>;
37
+ export type AIRequest = {
38
+ /** Full prompt the grid built for the model. Already includes column
39
+ * schema and any sampled rows where applicable. */
40
+ prompt: string;
41
+ /** When 'json', the provider should ask the model to return strict
42
+ * JSON only - no prose. We parse the response with JSON.parse and
43
+ * throw a typed error on failure. */
44
+ responseFormat?: 'text' | 'json';
45
+ /** Honored if the underlying transport supports cancellation. */
46
+ signal?: AbortSignal;
47
+ /** Free-form tag for telemetry / logging. One of: 'filter',
48
+ * 'smart-fill', 'summarize', 'classify'. */
49
+ task: AITask;
50
+ /** Soft hint to the provider about how many tokens we expect back.
51
+ * Useful for routing small jobs to a cheaper model. */
52
+ maxOutputTokens?: number;
53
+ };
54
+ export type AITask = 'filter' | 'smart-fill' | 'summarize' | 'classify' | 'export' | 'anomaly' | 'chart';
55
+ /**
56
+ * Register the model adapter every AI call will route through. Call once
57
+ * at app boot. Passing `null` clears the provider and AI calls revert to
58
+ * throwing "no provider" errors.
59
+ */
60
+ export declare function setAIProvider(p: AIProvider | null): void;
61
+ export declare function getAIProvider(): AIProvider | null;
62
+ export declare function hasAIProvider(): boolean;
63
+ export type AIFilterClause = {
64
+ field: string;
65
+ operator: 'contains' | 'equals' | 'startsWith' | 'greaterThan' | 'lessThan' | 'isBlank';
66
+ value?: string;
67
+ };
68
+ export type AISortClause = {
69
+ field: string;
70
+ desc: boolean;
71
+ };
72
+ export type AIFilterResult = {
73
+ filters: AIFilterClause[];
74
+ sort: AISortClause[];
75
+ /** Plain-English explanation of how the model interpreted the query.
76
+ * Surface this in the UI so the user can confirm or undo. */
77
+ rationale: string;
78
+ };
79
+ export type AIFilterOptions = {
80
+ /**
81
+ * When true, the helper not only RETURNS the plan but also applies it
82
+ * to the grid via `api.setFilter` / `api.setSort`. Defaults to false
83
+ * so callers can show a preview before committing.
84
+ */
85
+ apply?: boolean;
86
+ signal?: AbortSignal;
87
+ };
88
+ /**
89
+ * Translate a natural-language query into a filter+sort plan against
90
+ * the current grid's columns. The grid passes the column schema (names,
91
+ * types, sample values) to the model so it can pick the right field
92
+ * names without hallucinating.
93
+ */
94
+ export declare function aiFilter<TFeatures extends TableFeatures, TData extends RowData>(api: SvGridApi<TFeatures, TData>, query: string, opts?: AIFilterOptions): Promise<AIFilterResult>;
95
+ export type AISmartFillExample = {
96
+ input: Record<string, unknown>;
97
+ output: unknown;
98
+ };
99
+ export type AISmartFillResult<TValue = unknown> = {
100
+ field: string;
101
+ predictions: Array<{
102
+ rowIndex: number;
103
+ value: TValue;
104
+ confidence: number;
105
+ }>;
106
+ rationale: string;
107
+ };
108
+ export type AISmartFillOptions = {
109
+ /** Target column - the one whose values we want filled. */
110
+ field: string;
111
+ /** Index of rows the model should propose values for. If omitted, every
112
+ * row whose current `field` value is `null`, `undefined` or `''` is
113
+ * selected automatically. */
114
+ targetRowIndices?: number[];
115
+ /**
116
+ * Worked examples the user has already filled in. Required - the
117
+ * model needs at least one to know the pattern, two or more to lock
118
+ * the schema. We don't pull these from the grid automatically because
119
+ * "edited" vs "untouched" isn't a state SvGrid exposes today.
120
+ */
121
+ examples: AISmartFillExample[];
122
+ signal?: AbortSignal;
123
+ };
124
+ /**
125
+ * Given a column and a few user-provided examples, propose values for the
126
+ * untouched rows. Returns predictions only - the caller chooses whether to
127
+ * commit them via `api.setCellValue`. This is the right shape for an
128
+ * accept-per-cell UX with confidence-coloured highlights.
129
+ */
130
+ export declare function aiSmartFill<TFeatures extends TableFeatures, TData extends RowData, TValue = unknown>(api: SvGridApi<TFeatures, TData>, opts: AISmartFillOptions): Promise<AISmartFillResult<TValue>>;
131
+ export type AISummarizeTarget = {
132
+ kind: 'row';
133
+ rowIndex: number;
134
+ } | {
135
+ kind: 'all';
136
+ } | {
137
+ kind: 'selection';
138
+ rowIndices: number[];
139
+ } | {
140
+ kind: 'group';
141
+ field: string;
142
+ value: unknown;
143
+ };
144
+ export type AISummary = {
145
+ text: string;
146
+ bullets: string[];
147
+ /** Field names the model thinks are the most load-bearing for the
148
+ * story it just told. UI can highlight those columns. */
149
+ highlightedFields: string[];
150
+ };
151
+ export type AISummarizeOptions = {
152
+ target: AISummarizeTarget;
153
+ /** Optional question the user is trying to answer. Helps the model
154
+ * bias the summary toward the relevant columns. */
155
+ question?: string;
156
+ signal?: AbortSignal;
157
+ };
158
+ /**
159
+ * Ask the model to summarise a slice of the grid. Caps the row sample at
160
+ * a model-friendly size; for huge selections it samples uniformly so the
161
+ * summary stays representative without blowing the context window.
162
+ */
163
+ export declare function aiSummarize<TFeatures extends TableFeatures, TData extends RowData>(api: SvGridApi<TFeatures, TData>, opts: AISummarizeOptions): Promise<AISummary>;
164
+ export type AIClassifyOptions = {
165
+ /** Column whose free-text we're classifying. */
166
+ inputField: string;
167
+ /** Target column the model should write to. */
168
+ outputField: string;
169
+ /** Allowed values. The model is constrained to pick one. */
170
+ classes: string[];
171
+ /** Optional one-line description of each class (acts as a labeling rubric). */
172
+ classDescriptions?: Record<string, string>;
173
+ /** Rows to classify. Defaults to all. */
174
+ targetRowIndices?: number[];
175
+ signal?: AbortSignal;
176
+ };
177
+ export type AIClassifyResult = {
178
+ inputField: string;
179
+ outputField: string;
180
+ predictions: Array<{
181
+ rowIndex: number;
182
+ value: string;
183
+ confidence: number;
184
+ }>;
185
+ };
186
+ /**
187
+ * Bucket free-text cells into one of a known set of classes. The model
188
+ * is constrained to pick from `opts.classes`; predictions outside the set
189
+ * are dropped so the caller can rely on the output being clean enum
190
+ * values it can write straight back into the grid.
191
+ */
192
+ export declare function aiClassify<TFeatures extends TableFeatures, TData extends RowData>(api: SvGridApi<TFeatures, TData>, opts: AIClassifyOptions): Promise<AIClassifyResult>;
193
+ export type AIExportPlan = {
194
+ format: ExportFormat;
195
+ filters: AIFilterClause[];
196
+ sort: AISortClause[];
197
+ groupBy: string[];
198
+ /** Plain-English explanation of how the model read the request. */
199
+ rationale: string;
200
+ };
201
+ export type AIExportOptions = {
202
+ /**
203
+ * Also apply the filter / sort / grouping to the grid (mutating the view) so
204
+ * it mirrors the export. Default FALSE - the export is self-contained (it
205
+ * computes its own rows), so the grid is left untouched unless you opt in.
206
+ */
207
+ apply?: boolean;
208
+ /** Actually download the file. Default true; set false to preview the plan. */
209
+ run?: boolean;
210
+ /** Base filename (no extension). Default 'export'. */
211
+ filename?: string;
212
+ signal?: AbortSignal;
213
+ };
214
+ /**
215
+ * Turn a natural-language request ("export EU orders from Q2 as a grouped PDF")
216
+ * into an export: the model returns a `{ format, filters, sort, groupBy }` plan
217
+ * against the grid's columns; we apply the filter/sort to the grid and hand the
218
+ * result to the registered export engine (@svgrid/enterprise). Returns the plan
219
+ * so the UI can show what it did (or preview it first with `run: false`).
220
+ */
221
+ export declare function aiExport<TFeatures extends TableFeatures, TData extends RowData>(api: SvGridApi<TFeatures, TData>, query: string, opts?: AIExportOptions): Promise<AIExportPlan>;
222
+ export type AIAnomaly = {
223
+ /** Index into the SCANNED rows (target order), when the model pins one row. */
224
+ rowIndex?: number;
225
+ field?: string;
226
+ value?: unknown;
227
+ reason: string;
228
+ severity: 'low' | 'medium' | 'high';
229
+ };
230
+ export type AIAnomalyResult = {
231
+ anomalies: AIAnomaly[];
232
+ summary: string;
233
+ };
234
+ export type AIAnomalyOptions = {
235
+ /** Which rows to scan. Defaults to the whole dataset. */
236
+ target?: AISummarizeTarget;
237
+ /** Optional focus, e.g. "look at pricing and margins". */
238
+ question?: string;
239
+ signal?: AbortSignal;
240
+ };
241
+ /**
242
+ * Scan a slice of the grid (all / selection / group) for anomalies - outliers,
243
+ * suspicious values, inconsistencies - and return a structured list plus a
244
+ * one-line summary. Pairs naturally with an export: "find the odd ones, then
245
+ * export just those".
246
+ */
247
+ export declare function aiFindAnomalies<TFeatures extends TableFeatures, TData extends RowData>(api: SvGridApi<TFeatures, TData>, opts?: AIAnomalyOptions): Promise<AIAnomalyResult>;
248
+ export type AIChartType = 'bar' | 'line' | 'area' | 'pie';
249
+ export type AIChartPlan = {
250
+ type: AIChartType;
251
+ /** Group-by (category-axis) column field, or null. */
252
+ dimension: string | null;
253
+ /** Split-by column field: one series per distinct value, or null. */
254
+ series: string | null;
255
+ /** Measure (value-axis) column field, or null. */
256
+ measure: string | null;
257
+ reduce: 'sum' | 'avg' | 'count';
258
+ stacked: boolean;
259
+ logScale: boolean;
260
+ timeAxis: boolean;
261
+ valueFormat: 'number' | 'currency' | 'percent';
262
+ rationale: string;
263
+ };
264
+ export type AIChartOptions = {
265
+ /** Apply the plan to the grid's chart panel (open + configure). Default false. */
266
+ apply?: boolean;
267
+ signal?: AbortSignal;
268
+ };
269
+ /**
270
+ * Translate a natural-language request into a chart plan for the grid's built-in
271
+ * `charting` panel. Validates every field against the real schema, then (with
272
+ * `apply: true`) pushes it into the panel through `api.configureChart`.
273
+ */
274
+ export declare function aiChart<TFeatures extends TableFeatures, TData extends RowData>(api: SvGridApi<TFeatures, TData>, query: string, opts?: AIChartOptions): Promise<AIChartPlan>;
275
+ /**
276
+ * Wire the grid's chart-panel AI button to the model: registers a handler (via
277
+ * `api.setChartAiHandler`) that runs `aiChart` and returns the plan for the
278
+ * panel to apply + explain. Call once after `onApiReady`. `installEnterprise`
279
+ * calls this for you.
280
+ */
281
+ export declare function enableAiCharting<TFeatures extends TableFeatures, TData extends RowData>(api: SvGridApi<TFeatures, TData>): void;
282
+ export declare function disableAiCharting<TFeatures extends TableFeatures, TData extends RowData>(api: SvGridApi<TFeatures, TData>): void;
283
+ /**
284
+ * A deterministic provider that returns canned, schema-shaped responses
285
+ * for each task. Wire it in via `setAIProvider(mockAIProvider)` to make
286
+ * the AI demo work end-to-end without a real model key. Not for production.
287
+ */
288
+ export declare const mockAIProvider: AIProvider;
289
+ export {};