@svgrid/enterprise 3.0.2 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (364) hide show
  1. package/LICENSE +94 -24
  2. package/README.md +36 -4
  3. package/dist/SvAdvancedFilter.svelte +1 -1
  4. package/dist/SvAlertsManager.svelte +2 -1
  5. package/dist/SvBoard.svelte +2 -1
  6. package/dist/SvExportMenu.svelte +4 -1
  7. package/dist/SvExportMenu.svelte.d.ts +0 -13
  8. package/dist/SvExpressionEditor.svelte +3 -3
  9. package/dist/SvFormulaBar.svelte +94 -20
  10. package/dist/SvFormulaBar.svelte.d.ts +7 -0
  11. package/dist/SvGridAlerts.svelte +49 -9
  12. package/dist/SvGridBoard.svelte +13 -8
  13. package/dist/SvGridBulkEditDrawer.svelte +26 -2
  14. package/dist/SvGridEditPanel.svelte +3 -0
  15. package/dist/SvGridScheduler.svelte +69 -40
  16. package/dist/SvGridSelectionBar.svelte +10 -3
  17. package/dist/SvPivotDesigner.svelte +198 -40
  18. package/dist/SvPivotDesigner.svelte.d.ts +27 -20
  19. package/dist/SvSheet.svelte +4043 -243
  20. package/dist/SvSheet.svelte.d.ts +76 -3
  21. package/dist/SvSheetChartSetup.svelte +151 -0
  22. package/dist/SvSheetChartSetup.svelte.d.ts +18 -0
  23. package/dist/SvSheetComment.svelte +216 -31
  24. package/dist/SvSheetComment.svelte.d.ts +11 -11
  25. package/dist/SvSheetConditionalFormat.svelte +28 -31
  26. package/dist/SvSheetDataValidation.svelte +66 -42
  27. package/dist/SvSheetEditRanges.svelte +217 -0
  28. package/dist/SvSheetEditRanges.svelte.d.ts +15 -0
  29. package/dist/SvSheetErrors.svelte +125 -0
  30. package/dist/SvSheetErrors.svelte.d.ts +20 -0
  31. package/dist/SvSheetEvaluate.svelte +133 -0
  32. package/dist/SvSheetEvaluate.svelte.d.ts +15 -0
  33. package/dist/SvSheetFilterMenu.svelte +137 -34
  34. package/dist/SvSheetFilterMenu.svelte.d.ts +5 -0
  35. package/dist/SvSheetFindReplace.svelte +19 -19
  36. package/dist/SvSheetFormatCells.svelte +125 -81
  37. package/dist/SvSheetGoalSeek.svelte +17 -16
  38. package/dist/SvSheetInsertFunction.svelte +15 -13
  39. package/dist/SvSheetIteration.svelte +81 -0
  40. package/dist/SvSheetIteration.svelte.d.ts +10 -0
  41. package/dist/SvSheetLink.svelte +99 -0
  42. package/dist/SvSheetLink.svelte.d.ts +17 -0
  43. package/dist/SvSheetListPicker.svelte +4 -2
  44. package/dist/SvSheetListPicker.svelte.d.ts +0 -6
  45. package/dist/SvSheetManageRules.svelte +20 -18
  46. package/dist/SvSheetNameManager.svelte +17 -15
  47. package/dist/SvSheetPageSetup.svelte +159 -0
  48. package/dist/SvSheetPageSetup.svelte.d.ts +13 -0
  49. package/dist/SvSheetPasteSpecial.svelte +22 -20
  50. package/dist/SvSheetPivot.svelte +220 -0
  51. package/dist/SvSheetPivot.svelte.d.ts +21 -0
  52. package/dist/SvSheetProtectSheet.svelte +81 -0
  53. package/dist/SvSheetProtectSheet.svelte.d.ts +11 -0
  54. package/dist/SvSheetRemoveDuplicates.svelte +13 -10
  55. package/dist/SvSheetRibbon.svelte +104 -51
  56. package/dist/SvSheetSizeDialog.svelte +4 -2
  57. package/dist/SvSheetSort.svelte +218 -0
  58. package/dist/SvSheetSort.svelte.d.ts +28 -0
  59. package/dist/SvSheetSparklines.svelte +135 -0
  60. package/dist/SvSheetSparklines.svelte.d.ts +14 -0
  61. package/dist/SvSheetTable.svelte +160 -0
  62. package/dist/SvSheetTable.svelte.d.ts +24 -0
  63. package/dist/SvSheetTabs.svelte +161 -31
  64. package/dist/SvSheetTabs.svelte.d.ts +22 -8
  65. package/dist/SvSheetTextToColumns.svelte +20 -20
  66. package/dist/SvSheetValidationAlert.svelte +8 -6
  67. package/dist/advanced-filter-enable.js +1 -1
  68. package/dist/alerts/alert-engine.d.ts +6 -0
  69. package/dist/alerts/alert-engine.js +21 -4
  70. package/dist/alerts/alert-formats.js +2 -0
  71. package/dist/alerts/alert-types.d.ts +1 -1
  72. package/dist/alerts.d.ts +1 -1
  73. package/dist/alerts.js +2 -2
  74. package/dist/board.js +2 -2
  75. package/dist/bulk-edit.d.ts +3 -1
  76. package/dist/bulk-edit.js +1 -1
  77. package/dist/cdn/svgrid-enterprise.svelte-external.js +39827 -16429
  78. package/dist/designer/assets/GridMenus-8gTNssgV.js +8 -0
  79. package/dist/designer/assets/{SvChartMenu-D9hEeHar.js → SvChartMenu-BDoeqGz6.js} +1 -1
  80. package/dist/designer/assets/{SvDateTimePicker-DARvKUL2.js → SvDateTimePicker-DCPg7WGN.js} +1 -1
  81. package/dist/designer/assets/SvGridCellEditor-DMoWJjEI.js +4 -0
  82. package/dist/designer/assets/{SvGridChart-B8j1SSy3.js → SvGridChart-Cy1ATrWh.js} +2 -2
  83. package/dist/designer/assets/SvGridChartBuilder-eQ3mn0L9.js +1 -0
  84. package/dist/designer/assets/{SvGridChartPanel-pT6ITc2P.js → SvGridChartPanel-CATdVc9X.js} +3 -3
  85. package/dist/designer/assets/{SvGridChartView-bg281UA1.js → SvGridChartView-CmsZtCED.js} +1 -1
  86. package/dist/designer/assets/SvGridDropdown-Cjz0H-fI.js +1 -0
  87. package/dist/designer/assets/{SvTabs-UFCMTHXS.js → SvTabs-2mHC6oaz.js} +1 -1
  88. package/dist/designer/assets/cell-formatting-BbubJTVz.js +1 -0
  89. package/dist/designer/assets/{chart-cIPUsbM5.js → chart-Cn7MnNqA.js} +1 -1
  90. package/dist/designer/assets/{chart-panel-messages-DtTxpBUU.js → chart-panel-messages-Dz7PTIqT.js} +1 -1
  91. package/dist/designer/assets/{chart-summary-Czu_5epb.js → chart-summary-BD1qYB2R.js} +1 -1
  92. package/dist/designer/assets/{chart-trend-D5I5VEe8.js → chart-trend-B8xr5LuD.js} +1 -1
  93. package/dist/designer/assets/{dismissable-BO547MH9.js → dismissable-ChWRPkoa.js} +1 -1
  94. package/dist/designer/assets/{export-format-D-eP4b2l.js → export-format-DGckmgKr.js} +1 -1
  95. package/dist/designer/assets/{focus-trap-CAreAhlU.js → focus-trap-V2-6Fy9I.js} +1 -1
  96. package/dist/designer/assets/{index-DwU7CAMm.js → index-BSjv6Qec.js} +317 -315
  97. package/dist/designer/assets/index-_JVFxt02.css +1 -0
  98. package/dist/designer/assets/row-resize-BInFWCpr.js +1 -0
  99. package/dist/designer/assets/server-block-cache-CXJKkJpy.js +1 -0
  100. package/dist/designer/assets/src-DUQ4xE3x.js +58 -0
  101. package/dist/designer/assets/validate-C3B8QKsM.js +1 -0
  102. package/dist/designer/index.html +17 -16
  103. package/dist/export-pdf.d.ts +75 -0
  104. package/dist/export-pdf.js +216 -15
  105. package/dist/export.js +10 -2
  106. package/dist/gantt/SvGridGantt.svelte +2890 -0
  107. package/dist/gantt/SvGridGantt.svelte.d.ts +30 -0
  108. package/dist/gantt/gantt-config.d.ts +73 -0
  109. package/dist/gantt/gantt-config.js +1 -0
  110. package/dist/gantt/gantt-critical-path.d.ts +67 -0
  111. package/dist/gantt/gantt-critical-path.js +207 -0
  112. package/dist/gantt/gantt-model.d.ts +257 -0
  113. package/dist/gantt/gantt-model.js +651 -0
  114. package/dist/gantt/gantt-resources.d.ts +59 -0
  115. package/dist/gantt/gantt-resources.js +71 -0
  116. package/dist/gantt/gantt.d.ts +7 -0
  117. package/dist/gantt/gantt.js +36 -0
  118. package/dist/gantt/index.d.ts +15 -0
  119. package/dist/gantt/index.js +22 -0
  120. package/dist/gantt/timeline-arrows.d.ts +102 -0
  121. package/dist/gantt/timeline-arrows.js +181 -0
  122. package/dist/import.d.ts +2 -2
  123. package/dist/import.js +1 -1
  124. package/dist/index.d.ts +34 -7
  125. package/dist/index.js +44 -7
  126. package/dist/install.js +8 -1
  127. package/dist/license-core.d.ts +17 -1
  128. package/dist/license-core.js +16 -5
  129. package/dist/license.d.ts +18 -2
  130. package/dist/license.js +71 -6
  131. package/dist/node/studio.js +140 -8
  132. package/dist/pivot-enable.js +2 -2
  133. package/dist/scheduler-dependencies.d.ts +35 -0
  134. package/dist/scheduler-dependencies.js +36 -1
  135. package/dist/scheduler.js +2 -2
  136. package/dist/selection-bar.js +2 -2
  137. package/dist/server/SvGroupCell.svelte +213 -0
  138. package/dist/server/SvGroupCell.svelte.d.ts +62 -0
  139. package/dist/server/SvRowGroupPanel.svelte +322 -0
  140. package/dist/server/SvRowGroupPanel.svelte.d.ts +37 -0
  141. package/dist/server/enable.d.ts +17 -0
  142. package/dist/server/enable.js +49 -0
  143. package/dist/server/index.d.ts +22 -0
  144. package/dist/server/index.js +24 -0
  145. package/dist/server/messages.d.ts +45 -0
  146. package/dist/server/messages.js +35 -0
  147. package/dist/server/server-group-model.d.ts +104 -0
  148. package/dist/server/server-group-model.js +272 -0
  149. package/dist/server/server-pivot.d.ts +46 -0
  150. package/dist/server/server-pivot.js +57 -0
  151. package/dist/server/server-row-model.d.ts +547 -0
  152. package/dist/server/server-row-model.js +1551 -0
  153. package/dist/server/server-selection.d.ts +99 -0
  154. package/dist/server/server-selection.js +215 -0
  155. package/dist/server/svgrid-adapter.d.ts +155 -0
  156. package/dist/server/svgrid-adapter.js +202 -0
  157. package/dist/sheet/ast.d.ts +45 -1
  158. package/dist/sheet/ast.js +14 -0
  159. package/dist/sheet/auto-filter.d.ts +58 -4
  160. package/dist/sheet/auto-filter.js +159 -11
  161. package/dist/sheet/autocomplete.d.ts +9 -0
  162. package/dist/sheet/autocomplete.js +90 -4
  163. package/dist/sheet/cell-images.d.ts +39 -0
  164. package/dist/sheet/cell-images.js +90 -0
  165. package/dist/sheet/cell-types.d.ts +58 -0
  166. package/dist/sheet/cell-types.js +96 -0
  167. package/dist/sheet/coerce.d.ts +40 -0
  168. package/dist/sheet/coerce.js +170 -3
  169. package/dist/sheet/comments.d.ts +43 -9
  170. package/dist/sheet/comments.js +85 -27
  171. package/dist/sheet/conditional-formats.d.ts +29 -6
  172. package/dist/sheet/conditional-formats.js +37 -12
  173. package/dist/sheet/csv.d.ts +32 -0
  174. package/dist/sheet/csv.js +158 -0
  175. package/dist/sheet/culture.d.ts +87 -0
  176. package/dist/sheet/culture.js +247 -0
  177. package/dist/sheet/delta.d.ts +102 -0
  178. package/dist/sheet/delta.js +203 -0
  179. package/dist/sheet/deps.d.ts +45 -1
  180. package/dist/sheet/deps.js +77 -2
  181. package/dist/sheet/document.d.ts +106 -4
  182. package/dist/sheet/document.js +204 -3
  183. package/dist/sheet/engine.d.ts +67 -0
  184. package/dist/sheet/engine.js +19 -0
  185. package/dist/sheet/entry.d.ts +8 -4
  186. package/dist/sheet/entry.js +171 -21
  187. package/dist/sheet/error-check.d.ts +49 -0
  188. package/dist/sheet/error-check.js +83 -0
  189. package/dist/sheet/evaluate-steps.d.ts +48 -0
  190. package/dist/sheet/evaluate-steps.js +196 -0
  191. package/dist/sheet/evaluate.d.ts +67 -0
  192. package/dist/sheet/evaluate.js +725 -13
  193. package/dist/sheet/filter-files.d.ts +37 -0
  194. package/dist/sheet/filter-files.js +465 -0
  195. package/dist/sheet/format-store.d.ts +15 -0
  196. package/dist/sheet/format-store.js +11 -1
  197. package/dist/sheet/from-rows.d.ts +14 -0
  198. package/dist/sheet/from-rows.js +50 -0
  199. package/dist/sheet/function-catalog.d.ts +1 -1
  200. package/dist/sheet/function-catalog.js +296 -5
  201. package/dist/sheet/functions.js +363 -91
  202. package/dist/sheet/index.d.ts +35 -8
  203. package/dist/sheet/index.js +35 -8
  204. package/dist/sheet/links.d.ts +57 -0
  205. package/dist/sheet/links.js +174 -0
  206. package/dist/sheet/messages.d.ts +778 -0
  207. package/dist/sheet/messages.js +806 -0
  208. package/dist/sheet/number-format.d.ts +52 -5
  209. package/dist/sheet/number-format.js +465 -68
  210. package/dist/sheet/objects.d.ts +106 -0
  211. package/dist/sheet/objects.js +149 -0
  212. package/dist/sheet/ods-document.d.ts +44 -0
  213. package/dist/sheet/ods-document.js +1275 -0
  214. package/dist/sheet/open-file.d.ts +26 -0
  215. package/dist/sheet/open-file.js +56 -0
  216. package/dist/sheet/outline.d.ts +82 -0
  217. package/dist/sheet/outline.js +228 -0
  218. package/dist/sheet/packs/array.d.ts +16 -0
  219. package/dist/sheet/packs/array.js +172 -0
  220. package/dist/sheet/packs/database.d.ts +42 -0
  221. package/dist/sheet/packs/database.js +142 -0
  222. package/dist/sheet/packs/engineering.d.ts +2 -0
  223. package/dist/sheet/packs/engineering.js +296 -0
  224. package/dist/sheet/packs/financial.d.ts +5 -0
  225. package/dist/sheet/packs/financial.js +220 -0
  226. package/dist/sheet/packs/math-stats.d.ts +2 -0
  227. package/dist/sheet/packs/math-stats.js +372 -0
  228. package/dist/sheet/packs/special.d.ts +44 -0
  229. package/dist/sheet/packs/special.js +187 -0
  230. package/dist/sheet/packs/stats-dist.d.ts +2 -0
  231. package/dist/sheet/packs/stats-dist.js +785 -0
  232. package/dist/sheet/packs/text-date.d.ts +2 -0
  233. package/dist/sheet/packs/text-date.js +332 -0
  234. package/dist/sheet/packs/trig.d.ts +2 -0
  235. package/dist/sheet/packs/trig.js +73 -0
  236. package/dist/sheet/page-setup.d.ts +73 -0
  237. package/dist/sheet/page-setup.js +73 -0
  238. package/dist/sheet/parse.js +42 -10
  239. package/dist/sheet/paste-special.d.ts +22 -0
  240. package/dist/sheet/paste-special.js +14 -5
  241. package/dist/sheet/pivot-range.d.ts +160 -0
  242. package/dist/sheet/pivot-range.js +333 -0
  243. package/dist/sheet/presence.d.ts +73 -0
  244. package/dist/sheet/presence.js +79 -0
  245. package/dist/sheet/print.d.ts +104 -0
  246. package/dist/sheet/print.js +169 -0
  247. package/dist/sheet/protection.d.ts +55 -1
  248. package/dist/sheet/protection.js +55 -2
  249. package/dist/sheet/rects.d.ts +1 -1
  250. package/dist/sheet/refs.d.ts +48 -0
  251. package/dist/sheet/refs.js +155 -8
  252. package/dist/sheet/ribbon-icons.d.ts +1 -1
  253. package/dist/sheet/ribbon-icons.js +186 -0
  254. package/dist/sheet/ribbon.d.ts +1 -1
  255. package/dist/sheet/ribbon.js +324 -23
  256. package/dist/sheet/sheet-kinds.d.ts +74 -0
  257. package/dist/sheet/sheet-kinds.js +91 -0
  258. package/dist/sheet/shortcuts.d.ts +13 -3
  259. package/dist/sheet/shortcuts.js +63 -12
  260. package/dist/sheet/sort.d.ts +51 -0
  261. package/dist/sheet/sort.js +107 -0
  262. package/dist/sheet/sparklines.d.ts +111 -0
  263. package/dist/sheet/sparklines.js +204 -0
  264. package/dist/sheet/table-styles.d.ts +74 -0
  265. package/dist/sheet/table-styles.js +152 -0
  266. package/dist/sheet/tables.d.ts +19 -0
  267. package/dist/sheet/tables.js +31 -0
  268. package/dist/sheet/tokenize.d.ts +18 -1
  269. package/dist/sheet/tokenize.js +60 -9
  270. package/dist/sheet/validation.d.ts +16 -0
  271. package/dist/sheet/validation.js +37 -0
  272. package/dist/sheet/workbook.d.ts +148 -3
  273. package/dist/sheet/workbook.js +742 -31
  274. package/dist/sheet/xls-cfb.d.ts +32 -0
  275. package/dist/sheet/xls-cfb.js +290 -0
  276. package/dist/sheet/xls-document.d.ts +10 -0
  277. package/dist/sheet/xls-document.js +1243 -0
  278. package/dist/sheet/xls-formula.d.ts +40 -0
  279. package/dist/sheet/xls-formula.js +569 -0
  280. package/dist/sheet/xlsx-document.d.ts +108 -0
  281. package/dist/sheet/xlsx-document.js +1849 -0
  282. package/dist/sheet/xlsx-drawing.d.ts +99 -0
  283. package/dist/sheet/xlsx-drawing.js +420 -0
  284. package/dist/sheet-enable.js +6 -7
  285. package/dist/sheet-text.d.ts +7 -0
  286. package/dist/sheet-text.js +29 -0
  287. package/dist/sources/auth-supabase.js +2 -2
  288. package/dist/sources/realtime-supabase.js +2 -2
  289. package/dist/sources/rest.d.ts +6 -2
  290. package/dist/sources/rest.js +42 -7
  291. package/dist/sources/supabase.d.ts +10 -1
  292. package/dist/sources/supabase.js +73 -40
  293. package/dist/studio/emit-project.js +14 -1
  294. package/dist/studio/index.js +1 -1
  295. package/dist/studio/project.d.ts +11 -2
  296. package/dist/studio/project.js +5 -2
  297. package/dist/studio/ui-components.generated.js +107 -2
  298. package/dist/sveltekit/in-memory.d.ts +2 -2
  299. package/dist/sveltekit/in-memory.js +125 -4
  300. package/dist/sveltekit/index.d.ts +1 -1
  301. package/dist/sveltekit/index.js +1 -1
  302. package/dist/sveltekit/query-plan.d.ts +50 -4
  303. package/dist/sveltekit/query-plan.js +25 -3
  304. package/dist/sveltekit/sql-source.d.ts +6 -0
  305. package/dist/sveltekit/sql-source.js +34 -6
  306. package/dist/sveltekit/sql.d.ts +31 -0
  307. package/dist/sveltekit/sql.js +135 -25
  308. package/dist/sveltekit/transport.d.ts +10 -2
  309. package/dist/sveltekit/transport.js +30 -6
  310. package/dist/upgrade-prompt.d.ts +1 -1
  311. package/dist/version.d.ts +1 -1
  312. package/dist/version.js +1 -1
  313. package/dist/watermark.js +35 -2
  314. package/dist/wc/GridMenus-By9vPuq0.js +1088 -0
  315. package/dist/wc/SvChartMenu-CQNrQGT2.js +308 -0
  316. package/dist/wc/SvDateRangeInput-DR6m7bSM.js +199 -0
  317. package/dist/wc/SvDateTimePicker-D-vRnaMo.js +771 -0
  318. package/dist/wc/SvField-B_kurx_P.js +149 -0
  319. package/dist/wc/SvGrid.helpers-BdVDtjUm.js +135 -0
  320. package/dist/wc/SvGridCellEditor-Bnf1Kr5C.js +560 -0
  321. package/dist/wc/SvGridChart-BqUJh2pG.js +3572 -0
  322. package/dist/wc/SvGridChartBuilder-CGycC5cn.js +988 -0
  323. package/dist/wc/SvGridChartPanel-CRnizsHD.js +1746 -0
  324. package/dist/wc/SvGridChartView-D1pa_xMy.js +47 -0
  325. package/dist/wc/SvGridDropdown-45WsObLL.js +259 -0
  326. package/dist/wc/SvModal-DrfOYYyX.js +189 -0
  327. package/dist/wc/cell-formatting-CBfgahv1.js +86 -0
  328. package/dist/wc/chart-6OXlybVT.js +4341 -0
  329. package/dist/wc/chart-export-CeSADGfi.js +135 -0
  330. package/dist/wc/chart-export-pdf-BGko7MER.js +104 -0
  331. package/dist/wc/chart-summary-2m3ia1-n.js +137 -0
  332. package/dist/wc/chart-trend-CQOQtTMl.js +50 -0
  333. package/dist/wc/chart-validate-CD6ptiwg.js +180 -0
  334. package/dist/wc/client-DQIzjDBG.js +3064 -0
  335. package/dist/wc/column-resize-DUPgynvc.js +101 -0
  336. package/dist/wc/date-format-DS-z_h9v.js +1130 -0
  337. package/dist/wc/dismissable-CQ6XFXsk.js +45 -0
  338. package/dist/wc/editor-contract-peBDxir_.js +22 -0
  339. package/dist/wc/editor-registry-DxGKqcvx.js +24 -0
  340. package/dist/wc/focus-trap-Dbb2tJxb.js +65 -0
  341. package/dist/wc/list-option-DrRyivWp.js +82 -0
  342. package/dist/wc/popover-WsGlvtQv.js +69 -0
  343. package/dist/wc/positioning-BiKLfu1E.js +112 -0
  344. package/dist/wc/react.d.ts +41 -0
  345. package/dist/wc/react.js +90 -0
  346. package/dist/wc/rolldown-runtime-Dy4uBu1J.js +11 -0
  347. package/dist/wc/row-drag-touch-CycRR65n.js +93 -0
  348. package/dist/wc/row-resize-limG_N1z.js +111 -0
  349. package/dist/wc/sv-sheet-element.d.ts +97 -0
  350. package/dist/wc/sv-sheet-element.js +44213 -0
  351. package/dist/wc/svelte-virtualizer.svelte-CXtQy2TQ.js +530 -0
  352. package/dist/wc/validate-BqDthkNr.js +88 -0
  353. package/dist/wc/vue.d.ts +31 -0
  354. package/dist/wc/vue.js +75 -0
  355. package/package.json +30 -5
  356. package/dist/designer/assets/GridMenus-BlsvL_aU.js +0 -8
  357. package/dist/designer/assets/SvGridCellEditor-C7uQXYds.js +0 -4
  358. package/dist/designer/assets/SvGridChartBuilder-kvyIU_Rl.js +0 -1
  359. package/dist/designer/assets/SvGridDropdown-Bb3HH2Aj.js +0 -1
  360. package/dist/designer/assets/cell-formatting-wr5wm7US.js +0 -1
  361. package/dist/designer/assets/index-CMFgAoVV.css +0 -1
  362. package/dist/designer/assets/row-resize-DLktcqUK.js +0 -1
  363. package/dist/designer/assets/src-EdI3Xqds.js +0 -58
  364. package/dist/designer/assets/validate-h-aslRV9.js +0 -1
@@ -0,0 +1,99 @@
1
+ import type { CellValue } from './ast.js';
2
+ import type { SheetChartObject, SheetObject } from './objects.js';
3
+ import type { Rect } from './format-store.js';
4
+ export declare const REL_DRAWING = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing";
5
+ export declare const REL_IMAGE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image";
6
+ export declare const REL_CHART = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart";
7
+ /** Excel measures a drawing in English Metric Units: 9525 to the pixel. */
8
+ export declare const EMU_PER_PX = 9525;
9
+ /**
10
+ * Whether a picture's source is one the .xlsx can carry: a `data:` URL of a
11
+ * type Excel keeps in `xl/media`. An SVG is not one (Excel wants a PNG blip
12
+ * with the SVG as an extension), nor is a web address, whose bytes are
13
+ * elsewhere. The shell asks before it inserts a picture, so what it draws
14
+ * is what the file will hold.
15
+ */
16
+ export declare function xlsxCanCarryPicture(src: string): boolean;
17
+ /** A data URL split into its media type and its payload, or null. */
18
+ export declare function dataUrlParts(src: string): {
19
+ mime: string;
20
+ base64: string;
21
+ } | null;
22
+ export type DrawingParts = {
23
+ /** `xl/drawings/drawing<n>.xml`, or null when the sheet has nothing to draw. */
24
+ drawingPath: string | null;
25
+ drawingXml: string;
26
+ drawingRels: string;
27
+ /** Extra parts, keyed by their path: the chart definitions and the media. */
28
+ parts: Record<string, string>;
29
+ /** Content-type overrides these parts need. */
30
+ overrides: string[];
31
+ /** Default extensions the package must declare for the media written. */
32
+ extensions: string[];
33
+ /** Objects that could not be written, for a caller that wants to say so. */
34
+ skipped: SheetObject[];
35
+ };
36
+ export type DrawingContext = {
37
+ /** The sheet the objects sit on, for a chart's references. */
38
+ sheet: string;
39
+ /** 1-based index of this drawing part in the package. */
40
+ index: number;
41
+ /** The number of chart parts already written, so the next one is unique. */
42
+ chartsSoFar: number;
43
+ /** The number of media parts already written. */
44
+ mediaSoFar: number;
45
+ valueAt(row: number, col: number): CellValue;
46
+ textAt(row: number, col: number): string;
47
+ };
48
+ /**
49
+ * The drawing part for one sheet's objects, with the charts and the media
50
+ * they need.
51
+ *
52
+ * A picture whose source is not a `data:` URL is skipped rather than
53
+ * guessed at: its bytes are somewhere else, and a spreadsheet that opens
54
+ * with a broken image in it is worse than one that opens without the
55
+ * image.
56
+ */
57
+ export declare function drawingPartsFor(objects: ReadonlyArray<SheetObject>, context: DrawingContext): DrawingParts;
58
+ /** The lines the chart reads, worked out the way `chartSpecOf` works them
59
+ * out, so the file and the screen show the same chart. */
60
+ export declare function chartRefs(object: SheetChartObject, sheet: string): {
61
+ categories: string;
62
+ series: Array<{
63
+ name: string;
64
+ values: string;
65
+ }>;
66
+ };
67
+ /** A reference like `Sales!$B$2:$B$7`, as a rectangle on its sheet. */
68
+ export declare function rectOfRef(text: string): {
69
+ sheet: string | null;
70
+ rect: Rect;
71
+ } | null;
72
+ export type DrawingReadContext = {
73
+ /** Parse a part, the way the reader parses every other one. */
74
+ parse(xml: string, what: string): Document;
75
+ /** The drawing part's own relationships, by id. */
76
+ rels: Map<string, {
77
+ target: string;
78
+ type: string;
79
+ }>;
80
+ /** Every part in the package. Media entries are data URLs by the time
81
+ * they reach here, which is what an image object holds anyway. */
82
+ parts: Record<string, string>;
83
+ /** A fresh object id. */
84
+ newId(): string;
85
+ /** Column width and row height in pixels, for the one case that needs
86
+ * them: a two-cell anchor, whose size is a pair of cells rather than a
87
+ * measurement. Defaults to Excel's own defaults. */
88
+ columnWidth?(col: number): number;
89
+ rowHeight?(row: number): number;
90
+ };
91
+ /**
92
+ * The objects a drawing part holds.
93
+ *
94
+ * A one-cell anchor gives its size outright. A two-cell anchor, which is
95
+ * what most other producers write, gives a second cell instead, so the size
96
+ * is measured across the cells between them: approximate where the columns
97
+ * are not the default width, and better than dropping the picture.
98
+ */
99
+ export declare function objectsFromDrawing(drawingXml: string, context: DrawingReadContext): SheetObject[];
@@ -0,0 +1,420 @@
1
+ /**
2
+ * The drawing part: the objects on a sheet, written into the .xlsx and read
3
+ * back out of one.
4
+ *
5
+ * Until now a chart or a picture lived in the document and nowhere else, so
6
+ * Save As wrote the cells and left the objects behind. Excel keeps them in
7
+ * a separate part per sheet (`xl/drawings/drawing1.xml`), each anchored to a
8
+ * cell, with a picture's bytes in `xl/media` and a chart's definition in its
9
+ * own part. This builds those, and reads them.
10
+ *
11
+ * Two deliberate simplifications, both visible to the reader:
12
+ *
13
+ * - Every object is a ONE-cell anchor: the cell it hangs from plus a size in
14
+ * English Metric Units. That is exactly what the model holds ("move but
15
+ * don't size with cells"), so nothing is invented on the way out and
16
+ * nothing is lost on the way back.
17
+ * - A chart part carries the REFERENCES its series read, not a cached copy
18
+ * of the numbers. Excel recalculates a chart from its references on open,
19
+ * so a file written here redraws from the cells beside it rather than from
20
+ * a snapshot that can disagree with them.
21
+ */
22
+ import { colToLetters } from './address.js';
23
+ const NS_XDR = 'http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing';
24
+ const NS_A = 'http://schemas.openxmlformats.org/drawingml/2006/main';
25
+ const NS_C = 'http://schemas.openxmlformats.org/drawingml/2006/chart';
26
+ const NS_R = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships';
27
+ export const REL_DRAWING = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing';
28
+ export const REL_IMAGE = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image';
29
+ export const REL_CHART = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart';
30
+ /** Excel measures a drawing in English Metric Units: 9525 to the pixel. */
31
+ export const EMU_PER_PX = 9525;
32
+ const emu = (px) => Math.round(px * EMU_PER_PX);
33
+ const px = (value) => Math.round(value / EMU_PER_PX);
34
+ const esc = (text) => text.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
35
+ /** An absolute reference the way a chart part spells one. */
36
+ function ref(sheet, r1, c1, r2 = r1, c2 = c1) {
37
+ const name = /^[A-Za-z_][A-Za-z0-9_.]*$/.test(sheet) ? sheet : `'${sheet.replace(/'/g, "''")}'`;
38
+ const from = `$${colToLetters(c1)}$${r1 + 1}`;
39
+ const to = `$${colToLetters(c2)}$${r2 + 1}`;
40
+ return `${name}!${from === to ? from : `${from}:${to}`}`;
41
+ }
42
+ /** The image types Excel writes, by the extension the media part takes. */
43
+ const IMAGE_TYPES = {
44
+ 'image/png': 'png',
45
+ 'image/jpeg': 'jpeg',
46
+ 'image/jpg': 'jpeg',
47
+ 'image/gif': 'gif',
48
+ 'image/webp': 'png',
49
+ 'image/bmp': 'bmp',
50
+ };
51
+ /**
52
+ * Whether a picture's source is one the .xlsx can carry: a `data:` URL of a
53
+ * type Excel keeps in `xl/media`. An SVG is not one (Excel wants a PNG blip
54
+ * with the SVG as an extension), nor is a web address, whose bytes are
55
+ * elsewhere. The shell asks before it inserts a picture, so what it draws
56
+ * is what the file will hold.
57
+ */
58
+ export function xlsxCanCarryPicture(src) {
59
+ const data = dataUrlParts(src);
60
+ return !!data && data.mime in IMAGE_TYPES;
61
+ }
62
+ /** A data URL split into its media type and its payload, or null. */
63
+ export function dataUrlParts(src) {
64
+ const match = /^data:([^;,]+)(;base64)?,(.*)$/s.exec(src.trim());
65
+ if (!match)
66
+ return null;
67
+ const mime = match[1].toLowerCase();
68
+ // A data URL without `;base64` is percent-encoded text, which is not a
69
+ // picture worth writing into a spreadsheet.
70
+ if (!match[2])
71
+ return null;
72
+ return { mime, base64: match[3] };
73
+ }
74
+ /**
75
+ * The drawing part for one sheet's objects, with the charts and the media
76
+ * they need.
77
+ *
78
+ * A picture whose source is not a `data:` URL is skipped rather than
79
+ * guessed at: its bytes are somewhere else, and a spreadsheet that opens
80
+ * with a broken image in it is worse than one that opens without the
81
+ * image.
82
+ */
83
+ export function drawingPartsFor(objects, context) {
84
+ const empty = {
85
+ drawingPath: null, drawingXml: '', drawingRels: '', parts: {}, overrides: [], extensions: [], skipped: [],
86
+ };
87
+ if (objects.length === 0)
88
+ return empty;
89
+ const anchors = [];
90
+ const rels = [];
91
+ const parts = {};
92
+ const overrides = [];
93
+ const extensions = new Set();
94
+ const skipped = [];
95
+ let charts = context.chartsSoFar;
96
+ let media = context.mediaSoFar;
97
+ let shape = 1;
98
+ for (const object of objects) {
99
+ shape += 1;
100
+ const rel = `rId${rels.length + 1}`;
101
+ if (object.kind === 'image') {
102
+ const data = dataUrlParts(object.src);
103
+ const extension = data ? IMAGE_TYPES[data.mime] : undefined;
104
+ if (!data || !extension) {
105
+ skipped.push(object);
106
+ continue;
107
+ }
108
+ media += 1;
109
+ const path = `xl/media/image${media}.${extension}`;
110
+ // Media rides in the parts map as the data URL it came from; the zip
111
+ // writer is what turns it back into bytes, so everything here stays
112
+ // text and stays testable.
113
+ parts[path] = `data:${data.mime};base64,${data.base64}`;
114
+ extensions.add(extension);
115
+ rels.push(`<Relationship Id="${rel}" Type="${REL_IMAGE}" Target="../media/image${media}.${extension}"/>`);
116
+ anchors.push(pictureAnchor(object, rel, shape));
117
+ continue;
118
+ }
119
+ charts += 1;
120
+ const path = `xl/charts/chart${charts}.xml`;
121
+ parts[path] = chartPart(object, context);
122
+ overrides.push(`<Override PartName="/${path}" ContentType="application/vnd.openxmlformats-officedocument.drawingml.chart+xml"/>`);
123
+ rels.push(`<Relationship Id="${rel}" Type="${REL_CHART}" Target="../charts/chart${charts}.xml"/>`);
124
+ anchors.push(chartAnchor(object, rel, shape));
125
+ }
126
+ if (anchors.length === 0)
127
+ return { ...empty, skipped };
128
+ const drawingPath = `xl/drawings/drawing${context.index}.xml`;
129
+ overrides.push(`<Override PartName="/${drawingPath}" ContentType="application/vnd.openxmlformats-officedocument.drawing+xml"/>`);
130
+ return {
131
+ drawingPath,
132
+ drawingXml: `<xdr:wsDr xmlns:xdr="${NS_XDR}" xmlns:a="${NS_A}">${anchors.join('')}</xdr:wsDr>`,
133
+ drawingRels: `<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">${rels.join('')}</Relationships>`,
134
+ parts,
135
+ overrides,
136
+ extensions: [...extensions],
137
+ skipped,
138
+ };
139
+ }
140
+ function anchorFrom(object) {
141
+ const { row, col, dx, dy, width, height } = object.anchor;
142
+ return `<xdr:from><xdr:col>${col}</xdr:col><xdr:colOff>${emu(dx)}</xdr:colOff>`
143
+ + `<xdr:row>${row}</xdr:row><xdr:rowOff>${emu(dy)}</xdr:rowOff></xdr:from>`
144
+ + `<xdr:ext cx="${emu(width)}" cy="${emu(height)}"/>`;
145
+ }
146
+ function pictureAnchor(object, rel, shape) {
147
+ const { width, height } = object.anchor;
148
+ return '<xdr:oneCellAnchor>'
149
+ + anchorFrom(object)
150
+ + '<xdr:pic>'
151
+ + `<xdr:nvPicPr><xdr:cNvPr id="${shape}" name="Picture ${shape}"${object.alt ? ` descr="${esc(object.alt)}"` : ''}/><xdr:cNvPicPr/></xdr:nvPicPr>`
152
+ + `<xdr:blipFill><a:blip xmlns:r="${NS_R}" r:embed="${rel}"/><a:stretch><a:fillRect/></a:stretch></xdr:blipFill>`
153
+ + `<xdr:spPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="${emu(width)}" cy="${emu(height)}"/></a:xfrm>`
154
+ + '<a:prstGeom prst="rect"><a:avLst/></a:prstGeom></xdr:spPr>'
155
+ + '</xdr:pic><xdr:clientData/></xdr:oneCellAnchor>';
156
+ }
157
+ function chartAnchor(object, rel, shape) {
158
+ const { width, height } = object.anchor;
159
+ return '<xdr:oneCellAnchor>'
160
+ + anchorFrom(object)
161
+ + '<xdr:graphicFrame macro="">'
162
+ + `<xdr:nvGraphicFramePr><xdr:cNvPr id="${shape}" name="Chart ${shape}"/><xdr:cNvGraphicFramePr/></xdr:nvGraphicFramePr>`
163
+ + `<xdr:xfrm><a:off x="0" y="0"/><a:ext cx="${emu(width)}" cy="${emu(height)}"/></xdr:xfrm>`
164
+ + `<a:graphic><a:graphicData uri="${NS_C}"><c:chart xmlns:c="${NS_C}" xmlns:r="${NS_R}" r:id="${rel}"/></a:graphicData></a:graphic>`
165
+ + '</xdr:graphicFrame><xdr:clientData/></xdr:oneCellAnchor>';
166
+ }
167
+ /** The lines the chart reads, worked out the way `chartSpecOf` works them
168
+ * out, so the file and the screen show the same chart. */
169
+ export function chartRefs(object, sheet) {
170
+ const [r1, c1, r2, c2] = object.range;
171
+ const byColumns = object.series === 'columns';
172
+ const seriesFrom = byColumns ? c1 : r1;
173
+ const seriesTo = byColumns ? c2 : r2;
174
+ const pointFrom = byColumns ? r1 : c1;
175
+ const pointTo = byColumns ? r2 : c2;
176
+ const firstSeries = object.headers ? seriesFrom + 1 : seriesFrom;
177
+ const firstPoint = object.headers ? pointFrom + 1 : pointFrom;
178
+ const cell = (s, p) => (byColumns ? { row: p, col: s } : { row: s, col: p });
179
+ const catFrom = cell(seriesFrom, firstPoint);
180
+ const catTo = cell(seriesFrom, pointTo);
181
+ const categories = object.headers ? ref(sheet, catFrom.row, catFrom.col, catTo.row, catTo.col) : '';
182
+ const series = [];
183
+ for (let s = firstSeries; s <= seriesTo; s += 1) {
184
+ const head = cell(s, pointFrom);
185
+ const from = cell(s, firstPoint);
186
+ const to = cell(s, pointTo);
187
+ series.push({
188
+ name: object.headers ? ref(sheet, head.row, head.col) : '',
189
+ values: ref(sheet, from.row, from.col, to.row, to.col),
190
+ });
191
+ }
192
+ return { categories, series };
193
+ }
194
+ /** One chart part. */
195
+ function chartPart(object, context) {
196
+ const { categories, series } = chartRefs(object, context.sheet);
197
+ const grouping = object.stacked ? 'stacked' : object.type === 'bar' ? 'clustered' : 'standard';
198
+ const body = series.map((s, i) => {
199
+ const name = s.name ? `<c:tx><c:strRef><c:f>${esc(s.name)}</c:f></c:strRef></c:tx>` : '';
200
+ const cat = categories ? `<c:cat><c:strRef><c:f>${esc(categories)}</c:f></c:strRef></c:cat>` : '';
201
+ // Excel's own trendline element, so the line drawn here is a trendline
202
+ // there rather than a second series of numbers.
203
+ //
204
+ // Its place in the series matters: the schema orders a series
205
+ // idx, order, tx, ..., trendline, errBars, cat, val, and Excel reports a
206
+ // file whose elements are out of that order as one needing repair.
207
+ const trend = object.trend
208
+ ? `<c:trendline><c:trendlineType val="${object.trend === 'sma3' ? 'movingAvg' : 'linear'}"/>${object.trend === 'sma3' ? '<c:period val="3"/>' : ''}</c:trendline>`
209
+ : '';
210
+ if (object.type === 'scatter') {
211
+ return `<c:ser><c:idx val="${i}"/><c:order val="${i}"/>${name}${trend}`
212
+ + (categories ? `<c:xVal><c:numRef><c:f>${esc(categories)}</c:f></c:numRef></c:xVal>` : '')
213
+ + `<c:yVal><c:numRef><c:f>${esc(s.values)}</c:f></c:numRef></c:yVal></c:ser>`;
214
+ }
215
+ return `<c:ser><c:idx val="${i}"/><c:order val="${i}"/>${name}${trend}${cat}`
216
+ + `<c:val><c:numRef><c:f>${esc(s.values)}</c:f></c:numRef></c:val></c:ser>`;
217
+ }).join('');
218
+ const plot = object.type === 'pie'
219
+ ? `<c:pieChart><c:varyColors val="1"/>${body}</c:pieChart>`
220
+ : object.type === 'line'
221
+ ? `<c:lineChart><c:grouping val="${object.stacked ? 'stacked' : 'standard'}"/><c:marker val="1"/>${body}<c:axId val="1"/><c:axId val="2"/></c:lineChart>`
222
+ : object.type === 'area'
223
+ ? `<c:areaChart><c:grouping val="${object.stacked ? 'stacked' : 'standard'}"/>${body}<c:axId val="1"/><c:axId val="2"/></c:areaChart>`
224
+ : object.type === 'scatter'
225
+ ? `<c:scatterChart><c:scatterStyle val="lineMarker"/>${body}<c:axId val="1"/><c:axId val="2"/></c:scatterChart>`
226
+ : `<c:barChart><c:barDir val="col"/><c:grouping val="${grouping}"/>${object.stacked ? '<c:overlap val="100"/>' : ''}${body}<c:axId val="1"/><c:axId val="2"/></c:barChart>`;
227
+ const axes = object.type === 'pie'
228
+ ? ''
229
+ : `<c:${object.type === 'scatter' ? 'valAx' : 'catAx'}><c:axId val="1"/><c:scaling><c:orientation val="minMax"/></c:scaling><c:delete val="0"/><c:axPos val="b"/><c:crossAx val="2"/></c:${object.type === 'scatter' ? 'valAx' : 'catAx'}>`
230
+ + '<c:valAx><c:axId val="2"/><c:scaling><c:orientation val="minMax"/></c:scaling><c:delete val="0"/><c:axPos val="l"/><c:crossAx val="1"/></c:valAx>';
231
+ const title = object.title
232
+ ? `<c:title><c:tx><c:rich><a:bodyPr/><a:p><a:r><a:t>${esc(object.title)}</a:t></a:r></a:p></c:rich></c:tx><c:overlay val="0"/></c:title><c:autoTitleDeleted val="0"/>`
233
+ : '<c:autoTitleDeleted val="1"/>';
234
+ return `<c:chartSpace xmlns:c="${NS_C}" xmlns:a="${NS_A}" xmlns:r="${NS_R}">`
235
+ + `<c:chart>${title}<c:plotArea><c:layout/>${plot}${axes}</c:plotArea>`
236
+ + '<c:plotVisOnly val="1"/><c:dispBlanksAs val="gap"/></c:chart></c:chartSpace>';
237
+ }
238
+ // ---------------------------------------------------------------------------
239
+ // Reading one back
240
+ // ---------------------------------------------------------------------------
241
+ /** The elements of one namespace, by local name, in document order. */
242
+ function tags(root, ns, local) {
243
+ return [...root.getElementsByTagNameNS(ns, local)];
244
+ }
245
+ function first(root, ns, local) {
246
+ return root.getElementsByTagNameNS(ns, local)[0] ?? null;
247
+ }
248
+ function numberIn(root, ns, local) {
249
+ const el = root ? first(root, ns, local) : null;
250
+ const value = Number(el?.textContent ?? '');
251
+ return Number.isFinite(value) ? value : 0;
252
+ }
253
+ /** A reference like `Sales!$B$2:$B$7`, as a rectangle on its sheet. */
254
+ export function rectOfRef(text) {
255
+ const trimmed = text.trim();
256
+ if (!trimmed)
257
+ return null;
258
+ const bang = trimmed.lastIndexOf('!');
259
+ const sheetPart = bang >= 0 ? trimmed.slice(0, bang) : '';
260
+ const cells = bang >= 0 ? trimmed.slice(bang + 1) : trimmed;
261
+ const sheet = sheetPart.startsWith("'") && sheetPart.endsWith("'")
262
+ ? sheetPart.slice(1, -1).replace(/''/g, "'")
263
+ : sheetPart || null;
264
+ const ends = cells.split(':').map((part) => /^\$?([A-Za-z]+)\$?(\d+)$/.exec(part.trim()));
265
+ if (!ends[0])
266
+ return null;
267
+ const at = (m) => ({
268
+ col: m[1].toUpperCase().split('').reduce((n, ch) => n * 26 + (ch.charCodeAt(0) - 64), 0) - 1,
269
+ row: Number(m[2]) - 1,
270
+ });
271
+ const from = at(ends[0]);
272
+ const to = ends[1] ? at(ends[1]) : from;
273
+ return {
274
+ sheet,
275
+ rect: [
276
+ Math.min(from.row, to.row), Math.min(from.col, to.col),
277
+ Math.max(from.row, to.row), Math.max(from.col, to.col),
278
+ ],
279
+ };
280
+ }
281
+ /**
282
+ * The objects a drawing part holds.
283
+ *
284
+ * A one-cell anchor gives its size outright. A two-cell anchor, which is
285
+ * what most other producers write, gives a second cell instead, so the size
286
+ * is measured across the cells between them: approximate where the columns
287
+ * are not the default width, and better than dropping the picture.
288
+ */
289
+ export function objectsFromDrawing(drawingXml, context) {
290
+ const root = context.parse(drawingXml, 'drawing').documentElement;
291
+ const out = [];
292
+ const anchors = [...tags(root, NS_XDR, 'oneCellAnchor'), ...tags(root, NS_XDR, 'twoCellAnchor')];
293
+ for (const anchor of anchors) {
294
+ const from = first(anchor, NS_XDR, 'from');
295
+ if (!from)
296
+ continue;
297
+ const col = numberIn(from, NS_XDR, 'col');
298
+ const row = numberIn(from, NS_XDR, 'row');
299
+ const dx = px(numberIn(from, NS_XDR, 'colOff'));
300
+ const dy = px(numberIn(from, NS_XDR, 'rowOff'));
301
+ const ext = first(anchor, NS_XDR, 'ext');
302
+ let width = ext ? px(Number(ext.getAttribute('cx') ?? 0)) : 0;
303
+ let height = ext ? px(Number(ext.getAttribute('cy') ?? 0)) : 0;
304
+ if (!width || !height) {
305
+ const to = first(anchor, NS_XDR, 'to');
306
+ const toCol = to ? numberIn(to, NS_XDR, 'col') : col + 4;
307
+ const toRow = to ? numberIn(to, NS_XDR, 'row') : row + 8;
308
+ const widthOf = context.columnWidth ?? (() => 64);
309
+ const heightOf = context.rowHeight ?? (() => 20);
310
+ width = 0;
311
+ height = 0;
312
+ for (let c = col; c < toCol; c += 1)
313
+ width += widthOf(c);
314
+ for (let r = row; r < toRow; r += 1)
315
+ height += heightOf(r);
316
+ width = Math.max(width - dx + (to ? px(numberIn(to, NS_XDR, 'colOff')) : 0), 24);
317
+ height = Math.max(height - dy + (to ? px(numberIn(to, NS_XDR, 'rowOff')) : 0), 24);
318
+ }
319
+ const at = { row, col, dx, dy, width, height };
320
+ const pic = first(anchor, NS_XDR, 'pic');
321
+ if (pic) {
322
+ const blip = first(pic, NS_A, 'blip');
323
+ const id = blip?.getAttributeNS(NS_R, 'embed') ?? blip?.getAttribute('r:embed');
324
+ const target = id ? context.rels.get(id)?.target : undefined;
325
+ const src = target ? context.parts[target] : undefined;
326
+ // Only a picture whose bytes are in the package comes back; one that
327
+ // points outside it would be a broken image on the sheet.
328
+ if (!src || !src.startsWith('data:'))
329
+ continue;
330
+ const name = first(pic, NS_XDR, 'cNvPr');
331
+ const alt = name?.getAttribute('descr') ?? undefined;
332
+ out.push({ id: context.newId(), kind: 'image', anchor: at, src, ...(alt ? { alt } : {}) });
333
+ continue;
334
+ }
335
+ const frame = first(anchor, NS_XDR, 'graphicFrame');
336
+ if (!frame)
337
+ continue;
338
+ const chartEl = first(frame, NS_C, 'chart');
339
+ const chartId = chartEl?.getAttributeNS(NS_R, 'id') ?? chartEl?.getAttribute('r:id');
340
+ const chartPath = chartId ? context.rels.get(chartId)?.target : undefined;
341
+ const chartXml = chartPath ? context.parts[chartPath] : undefined;
342
+ if (!chartXml)
343
+ continue;
344
+ const chart = chartFromPart(chartXml, at, context);
345
+ if (chart)
346
+ out.push(chart);
347
+ }
348
+ return out;
349
+ }
350
+ /** The chart kind a chart part describes, and the block its series read. */
351
+ function chartFromPart(xml, anchor, context) {
352
+ const root = context.parse(xml, 'chart').documentElement;
353
+ const kinds = [
354
+ ['barChart', 'bar'], ['lineChart', 'line'], ['areaChart', 'area'],
355
+ ['pieChart', 'pie'], ['scatterChart', 'scatter'],
356
+ ];
357
+ const found = kinds.find(([tag]) => first(root, NS_C, tag) !== null);
358
+ if (!found)
359
+ return null;
360
+ const [tag, type] = found;
361
+ const plot = first(root, NS_C, tag);
362
+ // The block the chart reads is the union of every reference in it: the
363
+ // categories, the series names and the values. That is how a chart
364
+ // written by anything else comes back as a range rather than as a copy.
365
+ let sheet = null;
366
+ let rect = null;
367
+ let headers = false;
368
+ for (const f of tags(plot, NS_C, 'f')) {
369
+ const parsed = rectOfRef(f.textContent ?? '');
370
+ if (!parsed)
371
+ continue;
372
+ sheet = sheet ?? parsed.sheet;
373
+ const inside = f.parentElement?.parentElement?.localName;
374
+ if (inside === 'tx' || inside === 'cat' || inside === 'xVal')
375
+ headers = true;
376
+ rect = rect ? union(rect, parsed.rect) : parsed.rect;
377
+ }
378
+ if (!rect)
379
+ return null;
380
+ const series = orientationOf(plot, rect);
381
+ const title = first(root, NS_C, 'title');
382
+ const titleText = title ? [...tags(title, NS_A, 't')].map((t) => t.textContent ?? '').join('').trim() : '';
383
+ const grouping = first(plot, NS_C, 'grouping')?.getAttribute('val');
384
+ const trendKind = first(plot, NS_C, 'trendlineType')?.getAttribute('val');
385
+ return {
386
+ id: context.newId(),
387
+ kind: 'chart',
388
+ anchor,
389
+ range: rect,
390
+ type,
391
+ headers,
392
+ series,
393
+ ...(titleText ? { title: titleText } : {}),
394
+ ...(grouping === 'stacked' || grouping === 'percentStacked' ? { stacked: true } : {}),
395
+ ...(trendKind === 'linear' ? { trend: 'linear' } : trendKind === 'movingAvg' ? { trend: 'sma3' } : {}),
396
+ };
397
+ }
398
+ function union(a, b) {
399
+ return [
400
+ Math.min(a[0], b[0]), Math.min(a[1], b[1]),
401
+ Math.max(a[2], b[2]), Math.max(a[3], b[3]),
402
+ ];
403
+ }
404
+ /**
405
+ * Whether each series is a column of the block or a row of it, read off the
406
+ * first series' own reference: a reference down one column is a column.
407
+ */
408
+ function orientationOf(plot, rect) {
409
+ const values = first(plot, NS_C, 'val') ?? first(plot, NS_C, 'yVal');
410
+ const f = values ? first(values, NS_C, 'f') : null;
411
+ const parsed = f ? rectOfRef(f.textContent ?? '') : null;
412
+ if (!parsed)
413
+ return 'columns';
414
+ const [r1, c1, r2, c2] = parsed.rect;
415
+ if (r1 !== r2 && c1 === c2)
416
+ return 'columns';
417
+ if (c1 !== c2 && r1 === r2)
418
+ return 'rows';
419
+ return rect[2] - rect[0] >= rect[3] - rect[1] ? 'columns' : 'rows';
420
+ }
@@ -5,9 +5,10 @@
5
5
  * muscle memory works on any `<SvGrid>` with cell selection on.
6
6
  *
7
7
  * The grid ships the `registerGridShortcuts` seam for free and interprets a key
8
- * itself only when nothing claims it; the commands are here. Soft-gated like
9
- * the rest of Enterprise: it works without a license key but the grid shows the
10
- * unlicensed watermark and a one-time console nudge.
8
+ * itself only when nothing claims it; the commands are here. Evaluated like
9
+ * the rest of Enterprise, and part of the Suite edition: it works without a
10
+ * license key, and under a Grid-edition key, but the grid shows the unlicensed
11
+ * watermark and a one-time console nudge in both cases.
11
12
  *
12
13
  * ```ts
13
14
  * import { setLicenseKey, enableSheet } from '@svgrid/enterprise'
@@ -19,8 +20,7 @@
19
20
  // The Svelte-free subpath: importing the barrel would drag SvGrid.svelte into
20
21
  // this module's chunk, and into any unit test that touches it.
21
22
  import { registerGridShortcuts } from '@svgrid/grid/shortcuts';
22
- import { isLicenseKeySet } from './license.js';
23
- import { emitUnlicensedNudge } from './watermark.js';
23
+ import { nudgeEnterpriseFor } from './license.js';
24
24
  import { handleSheetKey } from './sheet/shortcuts.js';
25
25
  import { setFillTranslator } from './sheet/commands.js';
26
26
  import { translateFormula } from './sheet/refs.js';
@@ -41,6 +41,5 @@ export function enableSheet() {
41
41
  // literal text into every row; with it the relative half of each reference
42
42
  // shifts and the absolute half does not, the way Excel fills.
43
43
  setFillTranslator((value, delta) => translateFormula(value, delta.rows, delta.cols));
44
- if (!isLicenseKeySet())
45
- emitUnlicensedNudge();
44
+ nudgeEnterpriseFor('spreadsheet', 'Spreadsheet');
46
45
  }
@@ -0,0 +1,7 @@
1
+ import { type SheetMessages } from './sheet/messages.js';
2
+ /** A string by key, with its `{placeholders}` filled. */
3
+ export type SheetText = (key: string, vars?: Record<string, string | number>) => string;
4
+ /** Called by the shell: `get` reads its resolved map, so a change to the
5
+ * `localization` prop reaches every reader. */
6
+ export declare function provideSheetText(get: () => SheetMessages): void;
7
+ export declare function useSheetText(): SheetText;
@@ -0,0 +1,29 @@
1
+ /**
2
+ * How the shell's strings reach every part of it. `SvSheet` provides the
3
+ * resolved map through Svelte context once; the ribbon, the tab strip, the
4
+ * formula bar and each dialog ask for `t` and read their strings through
5
+ * it. A part mounted on its own, outside a shell, gets the English
6
+ * defaults, so nothing needs a prop it did not have before.
7
+ */
8
+ import { getContext, setContext } from 'svelte';
9
+ import { defaultSheetMessages, formatMessage } from './sheet/messages.js';
10
+ const KEY = Symbol.for('sv-sheet-text');
11
+ /** Called by the shell: `get` reads its resolved map, so a change to the
12
+ * `localization` prop reaches every reader. */
13
+ export function provideSheetText(get) {
14
+ setContext(KEY, get);
15
+ }
16
+ export function useSheetText() {
17
+ let get;
18
+ try {
19
+ get = getContext(KEY);
20
+ }
21
+ catch {
22
+ get = undefined;
23
+ }
24
+ return (key, vars) => {
25
+ const map = get ? get() : defaultSheetMessages;
26
+ const text = map[key] ?? defaultSheetMessages[key] ?? key;
27
+ return formatMessage(text, vars);
28
+ };
29
+ }
@@ -9,10 +9,10 @@
9
9
  * await auth.signIn(email, password)
10
10
  * // ... auth.signOut(); auth.dispose() on unmount
11
11
  */
12
- import { nudgeEnterprise } from '../license.js';
12
+ import { nudgeEnterpriseFor } from '../license.js';
13
13
  const userOf = (session) => session?.user ? { id: session.user.id, email: session.user.email } : null;
14
14
  export function createSupabaseAuth(config) {
15
- nudgeEnterprise('Studio'); // soft-gate; never blocks
15
+ nudgeEnterpriseFor('studio', 'Studio'); // evaluation nudge; never blocks
16
16
  let state = { user: null, loading: true, error: null };
17
17
  const emit = () => config.onChange({ ...state });
18
18
  const set = (patch) => {
@@ -17,9 +17,9 @@
17
17
  * coalesce bursts into a single refetch. For per-row effects (e.g. flashing a
18
18
  * changed row) read the normalized event passed to `onChange`.
19
19
  */
20
- import { nudgeEnterprise } from '../license.js';
20
+ import { nudgeEnterpriseFor } from '../license.js';
21
21
  export function createSupabaseRealtime(config) {
22
- nudgeEnterprise('Studio'); // soft-gate; never blocks
22
+ nudgeEnterpriseFor('studio', 'Studio'); // evaluation nudge; never blocks
23
23
  const schema = config.schema ?? 'public';
24
24
  const channelName = config.channelName ?? `svgrid:${schema}:${config.table}`;
25
25
  let timer;
@@ -32,7 +32,11 @@ export type RestDataSourceConfig<TData extends RowData> = {
32
32
  query?: Record<string, string>;
33
33
  /** Build read query params from the grid request. Override for bespoke APIs. */
34
34
  buildQuery?: (request: ServerRequest) => Record<string, string>;
35
- /** Parse a read response body into rows + total. Override for bespoke shapes. */
36
- parse?: (body: unknown, response: Response) => ServerResult<TData>;
35
+ /**
36
+ * Parse a read response body into rows + total. Override for bespoke
37
+ * shapes. Receives the request too, so a parser can tell a short last
38
+ * block from a full one when the API sends no total.
39
+ */
40
+ parse?: (body: unknown, response: Response, request: ServerRequest) => ServerResult<TData>;
37
41
  };
38
42
  export declare function createRestDataSource<TData extends RowData>(config: RestDataSourceConfig<TData>): WritableDataSource<TData>;