@svgrid/grid 2.2.15 → 2.2.17

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/index.d.ts CHANGED
@@ -5,10 +5,15 @@ export { createGrid, createSvGrid, type SvelteGrid } from './createGrid.svelte';
5
5
  export { createGridState, createSvGridState } from './createGridState.svelte';
6
6
  export { subscribeGrid, subscribeSvGrid } from './subscribe';
7
7
  export { default as SvGrid } from './SvGrid.svelte';
8
- export { default as SvGridBoard } from './SvGridBoard.svelte';
9
8
  export type { BoardConfig, BoardLane, BoardCardMoveEvent, BoardCardCommitEvent, BoardLayout, BoardSubtask, BoardComment, BoardMenuContext, BoardLaneMenuContext, BoardDrawerConfig } from './SvGrid.types';
9
+ export { registerBoardView, getBoardView, hasBoardView } from './board-view.svelte';
10
+ export * from './ai';
11
+ export { registerExportProvider, getExportProvider, type GridExportProvider, type GridExportRunOptions, } from './export-provider';
10
12
  export type { SchedulerConfig, SchedulerDrawerConfig, SchedulerEventMoveEvent, SchedulerEventResizeEvent, SchedulerEventCommitEvent, SchedulerRangeSelection, SchedulerView, SchedulerResource, SchedulerCollisionMode, SchedulerException, SchedulerEditScope, SchedulerOccurrenceChangeEvent, } from './SvGrid.types';
11
13
  export { registerSchedulerView, getSchedulerView, hasSchedulerView } from './scheduler-view.svelte';
14
+ export type { ChartViewConfig } from './SvGrid.types';
15
+ export { registerChartView, getChartView, hasChartView } from './chart-view.svelte';
16
+ export { registerPivotEngine, getPivotEngine, hasPivotEngine, type PivotEngine, type GridPivotConfig, type GridPivotValue, type GridPivotRow, } from './pivot-view.svelte';
12
17
  export { resolveEvents, hasConflict, overlapCount, overlapsBands, workingIntervals, withinWorking, type WorkingWindow, eventsOnDay, layoutDayEvents, monthWeekSegments, agendaGroups, rangeForView, daysForView, navigateAnchor, timelineAxis, timelineGeom, timelineRows, type ResolvedEvent, type EventSpec, type RecurrenceException, type PositionedEvent, type OverflowMarker, type DayLayout, type LayoutOptions, type MonthSegment, type AgendaGroup, type TimelineTick, type TimelineMajor, type TimelineAxis, type TimelineRow, } from './scheduler-model';
13
18
  export { default as SvGridDropdown } from './SvGridDropdown.svelte';
14
19
  export { default as SvCalendar, type CalendarValue, type CalendarPreset, type CalendarAnimation } from './SvCalendar.svelte';
@@ -17,7 +22,7 @@ export { default as SvTimePicker, type TimeValue } from './SvTimePicker.svelte';
17
22
  export { default as SvDateTimePicker, type DateTimeValue } from './SvDateTimePicker.svelte';
18
23
  export { default as SvDateRangeInput, type DateRangeValue } from './SvDateRangeInput.svelte';
19
24
  export { default as SvButtonGroup, type ButtonGroupItem, type ButtonGroupMode, type ButtonGroupValue } from './SvButtonGroup.svelte';
20
- export { editorAria, editorErrorId, editorHintId, nextEditorId, resolveMessages, type SvEditorProps, type EditorSize, type EditorDir, type EditorAriaState, } from './editor-contract';
25
+ export { editorAria, editorErrorId, editorHintId, nextEditorId, resolveMessages, type SvEditorProps, type EditorSize, type EditorDir, type EditorAction, type EditorAriaState, } from './editor-contract';
21
26
  export { type EditorInteraction } from './editor-contract';
22
27
  export { FOCUSABLE_SELECTOR, getFocusable, createFocusTrap, type FocusTrap, type FocusTrapOptions, } from './a11y/focus-trap';
23
28
  export { lockScroll, scrollLockDepth } from './a11y/scroll-lock';
@@ -29,7 +34,25 @@ export { createPagination, type Pagination, type PaginationConfig } from './crea
29
34
  export { createStepper, type Stepper, type StepperConfig, type StepStatus } from './createStepper';
30
35
  export { createCarousel, type Carousel, type CarouselConfig } from './createCarousel.svelte';
31
36
  export { createCommand, type Command, type CommandConfig } from './createCommand.svelte';
32
- export { createForm, type Form, type FormConfig } from './createForm.svelte';
37
+ export { createForm, type Form, type FormConfig, type FormMessages } from './createForm.svelte';
38
+ export { default as SvSegmented, type SegmentedOption } from './SvSegmented.svelte';
39
+ export { default as SvSpinner } from './SvSpinner.svelte';
40
+ export { default as SvLoadingOverlay } from './SvLoadingOverlay.svelte';
41
+ export { default as SvResult } from './SvResult.svelte';
42
+ export { default as SvCollapsible } from './SvCollapsible.svelte';
43
+ export { default as SvStack } from './SvStack.svelte';
44
+ export { default as SvGroup } from './SvGroup.svelte';
45
+ export { default as SvSimpleGrid } from './SvSimpleGrid.svelte';
46
+ export { default as SvText } from './SvText.svelte';
47
+ export { default as SvTitle } from './SvTitle.svelte';
48
+ export { default as SvAnchor } from './SvAnchor.svelte';
49
+ export { default as SvBlockquote } from './SvBlockquote.svelte';
50
+ export { default as SvMark } from './SvMark.svelte';
51
+ export { default as SvList } from './SvList.svelte';
52
+ export { default as SvKbd } from './SvKbd.svelte';
53
+ export { default as SvCode } from './SvCode.svelte';
54
+ export { default as SvVisuallyHidden } from './SvVisuallyHidden.svelte';
55
+ export { default as SvAspectRatio } from './SvAspectRatio.svelte';
33
56
  export { registerCellEditor, getCellEditor, hasCellEditor, unregisterCellEditor, registeredCellEditorTypes, defaultEditorProps, resolveEditorProps, type CellEditorContext, type CellEditorRegistration, } from './editor-registry';
34
57
  export { registerBuiltinEditors } from './builtin-editors';
35
58
  export { default as SvField } from './SvField.svelte';
@@ -138,9 +161,12 @@ export { default as SvStepper, type StepItem } from './SvStepper.svelte';
138
161
  export { default as SvAvatar } from './SvAvatar.svelte';
139
162
  export { avatarInitials, avatarColorHue } from './avatar';
140
163
  export { default as SvContextMenu } from './SvContextMenu.svelte';
141
- export { toast, dismissToast, clearToasts, pauseToast, resumeToast, toastStore, type Toast, type ToastVariant, type ToastOptions, type ToastFn, } from './toast-store.svelte';
164
+ export { toast, dismissToast, updateToast, clearToasts, pauseToast, resumeToast, toastStore, type Toast, type ToastVariant, type ToastOptions, type ToastFn, type ToastAction, type UpdateToast, type PromiseMessages, } from './toast-store.svelte';
142
165
  export { default as SvMenu, type MenuItem } from './SvMenu.svelte';
143
166
  export { default as SvMenuList } from './SvMenuList.svelte';
167
+ export { default as SvMenubar, type MenubarMenu } from './SvMenubar.svelte';
168
+ export { default as SvHoverCard } from './SvHoverCard.svelte';
169
+ export { default as SvPopconfirm } from './SvPopconfirm.svelte';
144
170
  export { default as SvNavPane, type NavItem, type NavSection, type NavModule } from './SvNavPane.svelte';
145
171
  export { default as SvProgress } from './SvProgress.svelte';
146
172
  export { default as SvCircularProgress } from './SvCircularProgress.svelte';
@@ -148,6 +174,7 @@ export { popIn } from './popover';
148
174
  export { default as SvForm, type FormField, type FormFieldType, type FormSection, type FormEntry } from './SvForm.svelte';
149
175
  export { rules, runRules, isEmptyValue, type Validator, type RuleOptions, type CompareOp } from './validators';
150
176
  export { anchoredRect, portalToBody, PANEL_THEME_VARS, type AnchoredRect } from './popover';
177
+ export { computePosition, autoUpdate, parsePlacement, type Placement, type Side, type Align, type Rect, type Viewport, type ComputePositionOptions, type ComputePositionResult, } from './positioning';
151
178
  export { toDate, startOfDay, startOfWeek, startOfMonth, addDays, addMonths, addYears, clampDate, isSameDay, monthMatrix, weekdayOrder, isoWeek, decadeRange, withTime, snapMinute, type DateLike, } from './datetime/date-core';
152
179
  export { formatDate, parseDate, tokenizeMask } from './datetime/date-format';
153
180
  export { toICS, fromICS, ruleToRRule, rruleToRule, type ICalEvent } from './scheduler-ical';
@@ -158,7 +185,10 @@ export { default as FlexRender } from './FlexRender.svelte';
158
185
  export { renderComponent, renderSnippet } from './render-component';
159
186
  export { default as SvGridChart } from './SvGridChart.svelte';
160
187
  export { default as SvGridChartPanel } from './SvGridChartPanel.svelte';
188
+ export { default as SvChart } from './SvGridChart.svelte';
189
+ export { default as SvChartPanel } from './SvGridChartPanel.svelte';
161
190
  export type { ChartingConfig, ChartAggregateRequest, ChartAggregateBucket } from './SvGrid.types';
191
+ export type { GridLocalization } from './SvGrid.types';
162
192
  export { buildChart, formatChartValue, rowsToChartSpec, niceScale, niceLogScale, linearTrend, simpleMovingAverage, exponentialMovingAverage, computeOverlay, buildLinePath, sampleGradient, pickContrastText, DEFAULT_PALETTE, type ChartType, type ChartSpec, type ChartSeries, type ChartGeometry, type ChartBar, type ChartLine, type ChartLinePoint, type ChartPieSlice, type ChartSelection, type ChartReferenceLine, type ChartRefLineGeo, type ChartRefLineGeoV, type ChartScatterDot, type ScatterPoint, type NiceScale, type SeriesOverlay, type SeriesPattern, type ChartAnnotation, type ChartHeatmapCell, type ChartFunnelSegment, type ChartRadarSeries, type ChartRadarAxis, type ChartTreemapCell, type ChartCalendarCell, type ChartGaugeLayout, type ChartSankeyNode, type ChartSankeyLink, type ChartValueFormat, type TreeNode, } from './chart';
163
193
  export { chartToSvgString, downloadChartSvg, chartToPngBlob, downloadChartPng, chartSpecToCsv, downloadChartCsv, type ChartExportOptions, } from './chart-export';
164
194
  export { buildSparkline, toSparklineValues, type SparklineConfig, type SparklineType, type SparklineGeometry, } from './sparkline';
@@ -175,6 +205,8 @@ export { default as SvGroupCell } from './SvGroupCell.svelte';
175
205
  export { default as SvRowGroupPanel } from './SvRowGroupPanel.svelte';
176
206
  export { createNamedViews, memoryViews, localStorageViews, attachAutoSavedView, type SavedView, type ViewStorage, type NamedViews, type AutoSavedViewOptions, } from './named-views';
177
207
  export { resolveCellFormat, computeColumnStat, lerpColor, rgba, contrastText, formatNeedsStats, formatsNeedingStats, type ConditionalFormat, type ConditionalFormatSpec, type ColorScaleFormat, type ColorScaleStop, type ScaleBounds, type DataBarFormat, type IconSetFormat, type RuleFormat, type ResolvedCellFormat, } from './conditional-formatting';
208
+ export { defaultGridMessages, resolveGridMessages, type GridMessages, } from './grid-messages';
209
+ export { insertGroupFooters, buildAutoGroupColumns, type GroupDisplayType, type GroupFooterOptions, type AutoGroupColumnSpec, type AutoGroupResult, } from './group-display';
178
210
  export { getKeyboardIntent, getNextActiveCell, type GridKeyboardIntent } from './keyboard';
179
211
  export { createVirtualizer } from './virtualization/virtualizer';
180
212
  export { createSvelteVirtualizer } from './virtualization/svelte-virtualizer.svelte';
package/dist/index.js CHANGED
@@ -5,8 +5,18 @@ export { createGrid, createSvGrid } from './createGrid.svelte';
5
5
  export { createGridState, createSvGridState } from './createGridState.svelte';
6
6
  export { subscribeGrid, subscribeSvGrid } from './subscribe';
7
7
  export { default as SvGrid } from './SvGrid.svelte';
8
- export { default as SvGridBoard } from './SvGridBoard.svelte';
8
+ export { registerBoardView, getBoardView, hasBoardView } from './board-view.svelte';
9
+ // Built-in AI helpers (free): natural-language filter, smart-fill, summarize,
10
+ // classify, anomaly detection, chart-this and export planning. They ship no
11
+ // model client and no-op until you register one with `setAIProvider(...)`, so
12
+ // they tree-shake out of the base bundle unless you actually import them. The
13
+ // export-provider seam lets @svgrid/enterprise register its Excel/PDF engine so
14
+ // AI-planned exports can WRITE those formats.
15
+ export * from './ai';
16
+ export { registerExportProvider, getExportProvider, } from './export-provider';
9
17
  export { registerSchedulerView, getSchedulerView, hasSchedulerView } from './scheduler-view.svelte';
18
+ export { registerChartView, getChartView, hasChartView } from './chart-view.svelte';
19
+ export { registerPivotEngine, getPivotEngine, hasPivotEngine, } from './pivot-view.svelte';
10
20
  // Pure scheduler layout/model helpers (framework-free, like recurrence/date-core).
11
21
  // The calendar RENDERER that consumes these ships in @svgrid/enterprise.
12
22
  export { resolveEvents, hasConflict, overlapCount, overlapsBands, workingIntervals, withinWorking, eventsOnDay, layoutDayEvents, monthWeekSegments, agendaGroups, rangeForView, daysForView, navigateAnchor, timelineAxis, timelineGeom, timelineRows, } from './scheduler-model';
@@ -41,6 +51,25 @@ export { createCarousel } from './createCarousel.svelte';
41
51
  export { createCommand } from './createCommand.svelte';
42
52
  // Schema-driven form core (SvForm): values/errors/touched + validation + submit.
43
53
  export { createForm } from './createForm.svelte';
54
+ export { default as SvSegmented } from './SvSegmented.svelte';
55
+ export { default as SvSpinner } from './SvSpinner.svelte';
56
+ export { default as SvLoadingOverlay } from './SvLoadingOverlay.svelte';
57
+ export { default as SvResult } from './SvResult.svelte';
58
+ export { default as SvCollapsible } from './SvCollapsible.svelte';
59
+ export { default as SvStack } from './SvStack.svelte';
60
+ export { default as SvGroup } from './SvGroup.svelte';
61
+ export { default as SvSimpleGrid } from './SvSimpleGrid.svelte';
62
+ // UI kit - typography + display primitives (Pillar C2)
63
+ export { default as SvText } from './SvText.svelte';
64
+ export { default as SvTitle } from './SvTitle.svelte';
65
+ export { default as SvAnchor } from './SvAnchor.svelte';
66
+ export { default as SvBlockquote } from './SvBlockquote.svelte';
67
+ export { default as SvMark } from './SvMark.svelte';
68
+ export { default as SvList } from './SvList.svelte';
69
+ export { default as SvKbd } from './SvKbd.svelte';
70
+ export { default as SvCode } from './SvCode.svelte';
71
+ export { default as SvVisuallyHidden } from './SvVisuallyHidden.svelte';
72
+ export { default as SvAspectRatio } from './SvAspectRatio.svelte';
44
73
  // UI kit - custom cell-editor registry (register any component as a grid editor)
45
74
  export { registerCellEditor, getCellEditor, hasCellEditor, unregisterCellEditor, registeredCellEditorTypes, defaultEditorProps, resolveEditorProps, } from './editor-registry';
46
75
  export { registerBuiltinEditors } from './builtin-editors';
@@ -167,9 +196,12 @@ export { default as SvStepper } from './SvStepper.svelte';
167
196
  export { default as SvAvatar } from './SvAvatar.svelte';
168
197
  export { avatarInitials, avatarColorHue } from './avatar';
169
198
  export { default as SvContextMenu } from './SvContextMenu.svelte';
170
- export { toast, dismissToast, clearToasts, pauseToast, resumeToast, toastStore, } from './toast-store.svelte';
199
+ export { toast, dismissToast, updateToast, clearToasts, pauseToast, resumeToast, toastStore, } from './toast-store.svelte';
171
200
  export { default as SvMenu } from './SvMenu.svelte';
172
201
  export { default as SvMenuList } from './SvMenuList.svelte';
202
+ export { default as SvMenubar } from './SvMenubar.svelte';
203
+ export { default as SvHoverCard } from './SvHoverCard.svelte';
204
+ export { default as SvPopconfirm } from './SvPopconfirm.svelte';
173
205
  export { default as SvNavPane } from './SvNavPane.svelte';
174
206
  export { default as SvProgress } from './SvProgress.svelte';
175
207
  export { default as SvCircularProgress } from './SvCircularProgress.svelte';
@@ -177,6 +209,7 @@ export { popIn } from './popover';
177
209
  export { default as SvForm } from './SvForm.svelte';
178
210
  export { rules, runRules, isEmptyValue } from './validators';
179
211
  export { anchoredRect, portalToBody, PANEL_THEME_VARS } from './popover';
212
+ export { computePosition, autoUpdate, parsePlacement, } from './positioning';
180
213
  export { toDate, startOfDay, startOfWeek, startOfMonth, addDays, addMonths, addYears, clampDate, isSameDay, monthMatrix, weekdayOrder, isoWeek, decadeRange, withTime, snapMinute, } from './datetime/date-core';
181
214
  export { formatDate, parseDate, tokenizeMask } from './datetime/date-format';
182
215
  export { toICS, fromICS, ruleToRRule, rruleToRule } from './scheduler-ical';
@@ -187,6 +220,12 @@ export { default as FlexRender } from './FlexRender.svelte';
187
220
  export { renderComponent, renderSnippet } from './render-component';
188
221
  export { default as SvGridChart } from './SvGridChart.svelte';
189
222
  export { default as SvGridChartPanel } from './SvGridChartPanel.svelte';
223
+ // Preferred names for the standalone chart primitives. `SvChart` is a genuine
224
+ // standalone component (spec-driven, no grid needed), so it sits alongside its
225
+ // unprefixed siblings SvGauge / SvSparkline. The `SvGrid*` names remain exported
226
+ // as aliases so existing imports keep working.
227
+ export { default as SvChart } from './SvGridChart.svelte';
228
+ export { default as SvChartPanel } from './SvGridChartPanel.svelte';
190
229
  export { buildChart, formatChartValue, rowsToChartSpec, niceScale, niceLogScale, linearTrend, simpleMovingAverage, exponentialMovingAverage, computeOverlay, buildLinePath, sampleGradient, pickContrastText, DEFAULT_PALETTE, } from './chart';
191
230
  export { chartToSvgString, downloadChartSvg, chartToPngBlob, downloadChartPng, chartSpecToCsv, downloadChartCsv, } from './chart-export';
192
231
  export { buildSparkline, toSparklineValues, } from './sparkline';
@@ -203,6 +242,8 @@ export { default as SvGroupCell } from './SvGroupCell.svelte';
203
242
  export { default as SvRowGroupPanel } from './SvRowGroupPanel.svelte';
204
243
  export { createNamedViews, memoryViews, localStorageViews, attachAutoSavedView, } from './named-views';
205
244
  export { resolveCellFormat, computeColumnStat, lerpColor, rgba, contrastText, formatNeedsStats, formatsNeedingStats, } from './conditional-formatting';
245
+ export { defaultGridMessages, resolveGridMessages, } from './grid-messages';
246
+ export { insertGroupFooters, buildAutoGroupColumns, } from './group-display';
206
247
  export { getKeyboardIntent, getNextActiveCell } from './keyboard';
207
248
  export { createVirtualizer } from './virtualization/virtualizer';
208
249
  export { createSvelteVirtualizer } from './virtualization/svelte-virtualizer.svelte';
@@ -0,0 +1,35 @@
1
+ type ScrollerVirtualizer = {
2
+ setScrollOffset: (offset: number) => void;
3
+ getOffsetForIndex: (index: number) => number;
4
+ getSizeForIndex: (index: number) => number;
5
+ };
6
+ export type JsScrollerConfig = {
7
+ /** The shared virtualizer to drive. */
8
+ virtualizer: ScrollerVirtualizer;
9
+ /** Full scrollable content height (px). */
10
+ totalSize: () => number;
11
+ /** Visible viewport height (px). */
12
+ viewport: () => number;
13
+ /** Row height used to convert line-mode wheel deltas to px. */
14
+ lineStep: () => number;
15
+ };
16
+ export declare function createJsScroller(cfg: JsScrollerConfig): {
17
+ readonly scrollOffset: number;
18
+ readonly maxOffset: number;
19
+ readonly thumbH: number;
20
+ readonly thumbTop: number;
21
+ readonly dragging: boolean;
22
+ scrollTo: (offset: number) => void;
23
+ scrollByPx: (delta: number) => void;
24
+ ensureVisible: (top: number, h: number) => void;
25
+ ensureIndexVisible: (index: number) => void;
26
+ onWheel: (e: WheelEvent) => void;
27
+ onThumbDown: (e: PointerEvent) => void;
28
+ onThumbMove: (e: PointerEvent) => void;
29
+ onThumbUp: (e: PointerEvent) => void;
30
+ onTrackDown: (e: PointerEvent) => void;
31
+ onContentDown: (e: PointerEvent) => void;
32
+ onContentMove: (e: PointerEvent) => void;
33
+ onContentUp: (e: PointerEvent) => void;
34
+ };
35
+ export {};
@@ -0,0 +1,154 @@
1
+ /**
2
+ * createJsScroller - a JS-driven vertical scroller for the virtualized selection
3
+ * controls (SvListBox / SvDropDownList / SvTree).
4
+ *
5
+ * Native overflow scroll is composited off the main thread, so on a fast
6
+ * scrollbar-thumb drag the browser paints the new (empty) scroll position a
7
+ * frame before JS can re-window the virtualizer - the "blank flash while
8
+ * scrolling". This helper removes that async gap the way Smart's list does: the
9
+ * content does NOT use native scroll. A single `scrollOffset` state positions
10
+ * the rows (`translateY`) AND drives the virtualizer window in the same reactive
11
+ * flush, and a custom scrollbar + wheel/touch handlers set that offset directly.
12
+ *
13
+ * The component owns the markup (translated rows + the `sb`/`thumb` elements);
14
+ * this owns the offset, the geometry, and the input handlers.
15
+ */
16
+ import { untrack } from 'svelte';
17
+ export function createJsScroller(cfg) {
18
+ // The single source of truth for the scroll position.
19
+ let scrollOffset = $state(0);
20
+ const maxOffset = $derived(Math.max(0, cfg.totalSize() - cfg.viewport()));
21
+ // Push the offset into the virtualizer whenever it changes. `untrack` keeps
22
+ // the virtualizer's `version` write out of this effect's dependencies.
23
+ $effect(() => {
24
+ const o = scrollOffset;
25
+ untrack(() => cfg.virtualizer.setScrollOffset(o));
26
+ });
27
+ // Re-clamp if the content shrinks under the current offset.
28
+ $effect(() => {
29
+ const m = maxOffset;
30
+ if (untrack(() => scrollOffset) > m)
31
+ scrollOffset = m;
32
+ });
33
+ function scrollTo(offset) {
34
+ scrollOffset = Math.max(0, Math.min(maxOffset, offset));
35
+ }
36
+ function scrollByPx(delta) {
37
+ scrollTo(scrollOffset + delta);
38
+ }
39
+ function onWheel(e) {
40
+ if (maxOffset <= 0)
41
+ return;
42
+ // deltaMode: 0 = pixels, 1 = lines, 2 = pages.
43
+ const step = e.deltaMode === 1 ? e.deltaY * cfg.lineStep() : e.deltaMode === 2 ? e.deltaY * cfg.viewport() : e.deltaY;
44
+ const before = scrollOffset;
45
+ scrollByPx(step);
46
+ // Only swallow the wheel when it moved us, so the page can scroll once the
47
+ // list is pinned at its top/bottom edge.
48
+ if (scrollOffset !== before)
49
+ e.preventDefault();
50
+ }
51
+ // --- Custom scrollbar geometry --------------------------------------------
52
+ const thumbH = $derived(maxOffset > 0 && cfg.totalSize() > 0
53
+ ? Math.max(24, Math.min(cfg.viewport(), (cfg.viewport() / cfg.totalSize()) * cfg.viewport()))
54
+ : 0);
55
+ const trackRange = $derived(Math.max(0, cfg.viewport() - thumbH));
56
+ const thumbTop = $derived(maxOffset > 0 ? (scrollOffset / maxOffset) * trackRange : 0);
57
+ let dragging = $state(false);
58
+ let dragStartY = 0;
59
+ let dragStartOffset = 0;
60
+ function onThumbDown(e) {
61
+ e.stopPropagation();
62
+ e.preventDefault();
63
+ dragging = true;
64
+ dragStartY = e.clientY;
65
+ dragStartOffset = scrollOffset;
66
+ e.currentTarget.setPointerCapture(e.pointerId);
67
+ }
68
+ function onThumbMove(e) {
69
+ if (!dragging)
70
+ return;
71
+ const dy = e.clientY - dragStartY;
72
+ scrollTo(dragStartOffset + (trackRange > 0 ? (dy / trackRange) * maxOffset : 0));
73
+ }
74
+ function onThumbUp(e) {
75
+ dragging = false;
76
+ releaseCapture(e);
77
+ }
78
+ function onTrackDown(e) {
79
+ const rect = e.currentTarget.getBoundingClientRect();
80
+ scrollByPx(e.clientY - rect.top < thumbTop ? -cfg.viewport() : cfg.viewport());
81
+ }
82
+ // --- Touch: drag the content to pan ---------------------------------------
83
+ let touchActive = false;
84
+ let touchStartY = 0;
85
+ let touchStartOffset = 0;
86
+ function onContentDown(e) {
87
+ if (e.pointerType !== 'touch')
88
+ return;
89
+ touchActive = true;
90
+ touchStartY = e.clientY;
91
+ touchStartOffset = scrollOffset;
92
+ e.currentTarget.setPointerCapture(e.pointerId);
93
+ }
94
+ function onContentMove(e) {
95
+ if (!touchActive)
96
+ return;
97
+ scrollTo(touchStartOffset - (e.clientY - touchStartY));
98
+ }
99
+ function onContentUp(e) {
100
+ if (!touchActive)
101
+ return;
102
+ touchActive = false;
103
+ releaseCapture(e);
104
+ }
105
+ function releaseCapture(e) {
106
+ try {
107
+ ;
108
+ e.currentTarget.releasePointerCapture(e.pointerId);
109
+ }
110
+ catch {
111
+ /* capture may already be gone */
112
+ }
113
+ }
114
+ /** Scroll the minimal amount to bring `[top, top+h]` fully into view. */
115
+ function ensureVisible(top, h) {
116
+ if (top < scrollOffset)
117
+ scrollTo(top);
118
+ else if (top + h > scrollOffset + cfg.viewport())
119
+ scrollTo(top + h - cfg.viewport());
120
+ }
121
+ /** Bring a virtualizer row index into view (variable-height aware). */
122
+ function ensureIndexVisible(index) {
123
+ ensureVisible(cfg.virtualizer.getOffsetForIndex(index), cfg.virtualizer.getSizeForIndex(index));
124
+ }
125
+ return {
126
+ get scrollOffset() {
127
+ return scrollOffset;
128
+ },
129
+ get maxOffset() {
130
+ return maxOffset;
131
+ },
132
+ get thumbH() {
133
+ return thumbH;
134
+ },
135
+ get thumbTop() {
136
+ return thumbTop;
137
+ },
138
+ get dragging() {
139
+ return dragging;
140
+ },
141
+ scrollTo,
142
+ scrollByPx,
143
+ ensureVisible,
144
+ ensureIndexVisible,
145
+ onWheel,
146
+ onThumbDown,
147
+ onThumbMove,
148
+ onThumbUp,
149
+ onTrackDown,
150
+ onContentDown,
151
+ onContentMove,
152
+ onContentUp,
153
+ };
154
+ }
@@ -8,6 +8,14 @@ export type ListOption = {
8
8
  /** Optional color swatch (any CSS color) shown before the label. */
9
9
  color?: string;
10
10
  };
11
+ /**
12
+ * Coerce a raw options array into well-formed ListOptions. A primitive item
13
+ * (`1`, `'a'`) becomes `{ value, label: String(value) }`; an object missing a
14
+ * `label` or `value` gets the other filled in. This makes a caller who passes
15
+ * e.g. `[1, 2, 3]` or `['a', 'b']` render sensibly instead of crashing a keyed
16
+ * `#each` on `undefined`/duplicate `value`s.
17
+ */
18
+ export declare function normalizeOptions(raw: ReadonlyArray<ListOption | string | number> | null | undefined): ListOption[];
11
19
  /** Case-insensitive substring filter over option labels. */
12
20
  export declare function filterOptions(options: ReadonlyArray<ListOption>, query: string): ListOption[];
13
21
  /** An option carrying its position in the flat source array (for prop-getters). */
@@ -28,6 +36,44 @@ export type OptionGroup = {
28
36
  export declare function groupOptions(options: ReadonlyArray<ListOption>): OptionGroup[];
29
37
  /** Whether any option declares a `group` (so headings are worth rendering). */
30
38
  export declare function hasGroups(options: ReadonlyArray<ListOption>): boolean;
39
+ /** Fixed px, or a per-option function - lets a virtualized list mix row heights. */
40
+ export type RowHeight = number | ((opt: IndexedOption, index: number) => number);
41
+ /** One row of the flattened virtualization model: a group heading or an option. */
42
+ export type VirtualListRow = {
43
+ type: 'group';
44
+ label: string;
45
+ size: number;
46
+ } | {
47
+ type: 'option';
48
+ opt: IndexedOption;
49
+ size: number;
50
+ };
51
+ export type FlatVirtualModel = {
52
+ /** Group headings + options in render order, each with its px height. */
53
+ entries: VirtualListRow[];
54
+ /** Whether any group heading rows are present. */
55
+ hasGroups: boolean;
56
+ /** Height (px) of the entry at flat index `i` - feeds the virtualizer's `estimateSize`. */
57
+ sizeAt: (i: number) => number;
58
+ /** Maps an OPTION index (position in the source options array, as used by
59
+ * `optionProps(index)`) to its flat entry index - so the active option can
60
+ * be scrolled into view even with group rows interleaved. */
61
+ optionFlatIndex: number[];
62
+ };
63
+ /**
64
+ * Flatten a (possibly grouped) option list into a single virtualization model:
65
+ * group headings become rows interleaved with their options, and each row
66
+ * carries its pixel height. This is what lets the selection controls window a
67
+ * GROUPED list (previously they fell back to rendering every node) and support
68
+ * variable row heights, while reusing the shared `createSvelteVirtualizer`.
69
+ *
70
+ * Pure - no DOM. Builds on `groupOptions`, which already tags each option with
71
+ * its flat `index` (the value `optionProps(index)` expects).
72
+ */
73
+ export declare function flattenForVirtual(options: ReadonlyArray<ListOption>, opts: {
74
+ rowHeight: RowHeight;
75
+ groupHeaderHeight?: number;
76
+ }): FlatVirtualModel;
31
77
  /**
32
78
  * Next enabled option index whose label starts with `buffer` (type-ahead),
33
79
  * searching forward from just after `from` and wrapping. Returns -1 for no
@@ -1,3 +1,22 @@
1
+ /**
2
+ * Coerce a raw options array into well-formed ListOptions. A primitive item
3
+ * (`1`, `'a'`) becomes `{ value, label: String(value) }`; an object missing a
4
+ * `label` or `value` gets the other filled in. This makes a caller who passes
5
+ * e.g. `[1, 2, 3]` or `['a', 'b']` render sensibly instead of crashing a keyed
6
+ * `#each` on `undefined`/duplicate `value`s.
7
+ */
8
+ export function normalizeOptions(raw) {
9
+ if (!raw)
10
+ return [];
11
+ return raw.map((o) => {
12
+ if (o != null && typeof o === 'object') {
13
+ const opt = o;
14
+ const value = opt.value ?? opt.label ?? '';
15
+ return { ...opt, value, label: opt.label ?? String(value) };
16
+ }
17
+ return { value: o, label: String(o) };
18
+ });
19
+ }
1
20
  /** Case-insensitive substring filter over option labels. */
2
21
  export function filterOptions(options, query) {
3
22
  const q = query.trim().toLowerCase();
@@ -30,6 +49,40 @@ export function groupOptions(options) {
30
49
  export function hasGroups(options) {
31
50
  return options.some((o) => o.group != null);
32
51
  }
52
+ /**
53
+ * Flatten a (possibly grouped) option list into a single virtualization model:
54
+ * group headings become rows interleaved with their options, and each row
55
+ * carries its pixel height. This is what lets the selection controls window a
56
+ * GROUPED list (previously they fell back to rendering every node) and support
57
+ * variable row heights, while reusing the shared `createSvelteVirtualizer`.
58
+ *
59
+ * Pure - no DOM. Builds on `groupOptions`, which already tags each option with
60
+ * its flat `index` (the value `optionProps(index)` expects).
61
+ */
62
+ export function flattenForVirtual(options, opts) {
63
+ const headerH = Math.max(1, opts.groupHeaderHeight ?? 28);
64
+ const rh = opts.rowHeight;
65
+ const sizeOf = (o) => Math.max(1, typeof rh === 'function' ? rh(o, o.index) : rh);
66
+ const entries = [];
67
+ const optionFlatIndex = new Array(options.length);
68
+ let anyGroups = false;
69
+ for (const g of groupOptions(options)) {
70
+ if (g.group != null) {
71
+ anyGroups = true;
72
+ entries.push({ type: 'group', label: g.group, size: headerH });
73
+ }
74
+ for (const opt of g.options) {
75
+ optionFlatIndex[opt.index] = entries.length;
76
+ entries.push({ type: 'option', opt, size: sizeOf(opt) });
77
+ }
78
+ }
79
+ return {
80
+ entries,
81
+ hasGroups: anyGroups,
82
+ sizeAt: (i) => entries[i]?.size ?? 0,
83
+ optionFlatIndex,
84
+ };
85
+ }
33
86
  /**
34
87
  * Next enabled option index whose label starts with `buffer` (type-ahead),
35
88
  * searching forward from just after `from` and wrapping. Returns -1 for no
package/dist/menus.js CHANGED
@@ -322,16 +322,21 @@ export function createMenus(ctx) {
322
322
  ctx.internalColumns = ctx.internalColumns.filter((d) => (d.id ?? d.field) !== t.columnId);
323
323
  }
324
324
  // Built-in items, keyed. `run` reads the live target passed at click time.
325
+ // `msg` names the GridMessages key so the label localizes (falls back to the
326
+ // English `label` when no `localeText` is set).
325
327
  const builtins = {
326
- copy: { label: "Copy", run: () => ctx.copySelectionToClipboard() },
327
- cut: { label: "Cut", run: () => ctx.cutSelectionToClipboard() },
328
- paste: { label: "Paste", run: () => void ctx.pasteFromClipboard() },
329
- clear: { label: "Clear", run: () => ctx.clearSelectedCells() },
330
- row_above: { label: "Insert row above", run: (t) => insertRowAt(t, 0) },
331
- row_below: { label: "Insert row below", run: (t) => insertRowAt(t, 1) },
332
- remove_row: { label: "Remove row", run: removeRowAt },
333
- remove_col: { label: "Remove column", run: removeColAt },
334
- comment: { label: "Edit comment", run: (t) => openCommentEditor(t) },
328
+ copy: { label: "Copy", msg: "menuCopy", run: () => ctx.copySelectionToClipboard() },
329
+ cut: { label: "Cut", msg: "menuCut", run: () => ctx.cutSelectionToClipboard() },
330
+ paste: { label: "Paste", msg: "menuPaste", run: () => void ctx.pasteFromClipboard() },
331
+ clear: { label: "Clear", msg: "menuClear", run: () => ctx.clearSelectedCells() },
332
+ row_above: { label: "Insert row above", msg: "menuInsertRowAbove", run: (t) => insertRowAt(t, 0) },
333
+ row_below: { label: "Insert row below", msg: "menuInsertRowBelow", run: (t) => insertRowAt(t, 1) },
334
+ remove_row: { label: "Remove row", msg: "menuRemoveRow", run: removeRowAt },
335
+ remove_col: { label: "Remove column", msg: "menuRemoveColumn", run: removeColAt },
336
+ comment: { label: "Edit comment", msg: "menuEditComment", run: (t) => openCommentEditor(t) },
337
+ // Charting: open the chart panel scoped to the current cell selection. Gated
338
+ // on `chartingEnabled` in the resolver below.
339
+ chart: { label: "Chart selected range", msg: "chartRange", run: () => { ctx.chartPanelOpen = true; } },
335
340
  };
336
341
  const DEFAULT_ITEMS = [
337
342
  "copy", "cut", "paste", "clear", "separator",
@@ -399,9 +404,14 @@ export function createMenus(ctx) {
399
404
  if (!target)
400
405
  return [];
401
406
  const cfg = ctx.props.contextMenu;
407
+ const messages = ctx.messages;
402
408
  const entries = Array.isArray(cfg)
403
409
  ? cfg
404
- : [...DEFAULT_ITEMS, ...(ctx.props.editableComments ? ["separator", "comment"] : [])];
410
+ : [
411
+ ...DEFAULT_ITEMS,
412
+ ...(ctx.chartingEnabled ? ["separator", "chart"] : []),
413
+ ...(ctx.props.editableComments ? ["separator", "comment"] : []),
414
+ ];
405
415
  const out = [];
406
416
  for (const entry of entries) {
407
417
  if (entry === "separator") {
@@ -409,10 +419,14 @@ export function createMenus(ctx) {
409
419
  continue;
410
420
  }
411
421
  if (typeof entry === "string") {
422
+ // The chart item only makes sense when charting is enabled.
423
+ if (entry === "chart" && !ctx.chartingEnabled)
424
+ continue;
412
425
  const b = builtins[entry];
413
426
  if (!b)
414
427
  continue;
415
- out.push({ key: entry, label: b.label, run: () => b.run(target) });
428
+ const label = (b.msg && messages?.[b.msg]) || b.label;
429
+ out.push({ key: entry, label, run: () => b.run(target) });
416
430
  continue;
417
431
  }
418
432
  if (entry.hidden?.(target))
@@ -0,0 +1,72 @@
1
+ /**
2
+ * pivot-engine registry - the injection seam for in-grid pivot mode. Setting the
3
+ * `pivot` prop on `<SvGrid>` turns the live grid into a pivot table in place, but
4
+ * the pivot ENGINE (which aggregates rows into a pivot result with nested column
5
+ * headers) ships in `@svgrid/enterprise`. This tiny reactive holder lets
6
+ * enterprise register that engine at import time; the grid looks it up and runs
7
+ * it over its filtered + sorted rows, or shows an upsell placeholder when the
8
+ * engine is absent. Mirrors the `scheduler-view` / `editor-registry` pattern.
9
+ *
10
+ * Unlike the scheduler (which swaps in a whole renderer component), the pivot
11
+ * engine is a PURE function - the pivot result renders through the grid's normal
12
+ * table + grouped-column-header path.
13
+ *
14
+ * ONE ENGINE, two entry points: the engine registered here is enterprise's
15
+ * `createPivotModel`. The `pivot` prop on `<SvGrid>` (declarative, no UI) reaches
16
+ * it through this seam; the visual `<SvPivotDesigner>` component calls the same
17
+ * `createPivotModel` directly and adds a drag-drop field designer, heat-tinting,
18
+ * expand/collapse and a chart view on top. Pick the prop for code-defined
19
+ * pivots, the designer for an end-user field picker - both aggregate identically.
20
+ *
21
+ * ```ts
22
+ * // in @svgrid/enterprise, at module load (via enablePivot()):
23
+ * import { registerPivotEngine } from '@svgrid/grid'
24
+ * import { createPivotModel } from './pivot'
25
+ * registerPivotEngine((data, config) => createPivotModel(data, config))
26
+ * ```
27
+ */
28
+ import type { ColumnDef, RowData, TableFeatures } from './index';
29
+ /** One value measure in a pivot: which field, how to aggregate, how to label. */
30
+ export type GridPivotValue<TData = RowData> = {
31
+ field: keyof TData & string;
32
+ agg?: 'sum' | 'avg' | 'min' | 'max' | 'count' | 'countDistinct' | 'first' | 'last';
33
+ label?: string;
34
+ format?: unknown;
35
+ };
36
+ /**
37
+ * Free-grid pivot config. Structurally compatible with enterprise `PivotConfig`
38
+ * so the free package carries zero dependency on enterprise; the enterprise
39
+ * config remains assignable to this.
40
+ */
41
+ export type GridPivotConfig<TData = RowData> = {
42
+ /** Row-axis dimensions, outer-most first. */
43
+ rows: ReadonlyArray<keyof TData & string>;
44
+ /** Column-axis dimensions, outer-most first. */
45
+ cols: ReadonlyArray<keyof TData & string>;
46
+ /** One or more measures aggregated under each column-axis leaf. */
47
+ values: ReadonlyArray<GridPivotValue<TData>>;
48
+ grandTotalRow?: boolean;
49
+ grandTotalCol?: boolean;
50
+ rowSubtotals?: boolean;
51
+ colSort?: (a: unknown, b: unknown, level: number) => number;
52
+ rowSort?: (a: unknown, b: unknown, level: number) => number;
53
+ };
54
+ /** A pivot row as emitted by the engine (plain object, keyed by leaf column id). */
55
+ export type GridPivotRow = Record<string, unknown> & {
56
+ __pivotId: string;
57
+ __pivotDepth: number;
58
+ __pivotLabel: string;
59
+ __pivotParentId: string | null;
60
+ __pivotExpandable: boolean;
61
+ };
62
+ /** The registered pivot engine: pure `(data, config) => { rows, columns }`. */
63
+ export type PivotEngine = <TFeatures extends TableFeatures = TableFeatures, TData extends RowData = RowData>(data: ReadonlyArray<TData>, config: GridPivotConfig<TData>) => {
64
+ rows: GridPivotRow[];
65
+ columns: Array<ColumnDef<TFeatures, GridPivotRow>>;
66
+ };
67
+ /** Register the pivot engine. Enterprise calls this from `enablePivot()`. */
68
+ export declare function registerPivotEngine(fn: PivotEngine): void;
69
+ /** The registered pivot engine, or null when enterprise is not installed. */
70
+ export declare function getPivotEngine(): PivotEngine | null;
71
+ /** Whether a pivot engine has been registered. */
72
+ export declare function hasPivotEngine(): boolean;
@@ -0,0 +1,13 @@
1
+ let engine = $state(null);
2
+ /** Register the pivot engine. Enterprise calls this from `enablePivot()`. */
3
+ export function registerPivotEngine(fn) {
4
+ engine = fn;
5
+ }
6
+ /** The registered pivot engine, or null when enterprise is not installed. */
7
+ export function getPivotEngine() {
8
+ return engine;
9
+ }
10
+ /** Whether a pivot engine has been registered. */
11
+ export function hasPivotEngine() {
12
+ return engine != null;
13
+ }