@mono-lit/helper 0.0.0-stage → 0.0.2

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 (539) hide show
  1. package/LICENSE.md +55 -0
  2. package/README.md +35 -3
  3. package/dist/breakpoints-CAbhDUht.js +84 -0
  4. package/dist/checkbox-Cqpie9Ap.js +4 -0
  5. package/dist/chip-DBUUa2eB.js +4 -0
  6. package/dist/chip-limits-BMoO31JM.js +213 -0
  7. package/dist/chip-strip-Cw3gyz0q.js +213 -0
  8. package/dist/color-DHYrfXsX.js +253 -0
  9. package/dist/css-class-BRKRzHx-.js +60 -0
  10. package/dist/css-size-DhHSVZJK.js +37 -0
  11. package/dist/data/theme/presets.json.d.ts +140 -0
  12. package/dist/data-source-controller-B_rgHCjw.js +241 -0
  13. package/dist/data-source-controller-Dbb4fd8I.js +241 -0
  14. package/dist/data-source-options-CP-X62Pa.js +535 -0
  15. package/dist/data-source-options-Jqj7LU3Z.js +537 -0
  16. package/dist/data-source-read-B4DGp6UQ.js +216 -0
  17. package/dist/data-source-read-DL88aH8t.js +217 -0
  18. package/dist/decorate-DEXtNagw.js +141 -0
  19. package/dist/element-props-CLB6yvbm.js +114 -0
  20. package/dist/esm-Ptok4SQZ.js +2026 -0
  21. package/dist/excel-CY6zGkcx.js +608 -0
  22. package/dist/excel-DopRbEMK.js +608 -0
  23. package/dist/export-BiGVyxt6.js +2302 -0
  24. package/dist/export.d.ts +1 -0
  25. package/dist/export.js +2302 -0
  26. package/dist/field-icons-DELrSdqJ.js +86 -0
  27. package/dist/field-path-C92eGLg3.js +251 -0
  28. package/dist/filter-builder-Bke3qOgJ.js +205 -0
  29. package/dist/filter-builder-CE4zE0V5.js +205 -0
  30. package/dist/filter-eval-DIfU2EAn.js +173 -0
  31. package/dist/filter-odata-C1vSGZaY.js +591 -0
  32. package/dist/form-control-core-B8d7k6vk.js +223 -0
  33. package/dist/form-control-core-eeRr0zLU.js +223 -0
  34. package/dist/hydration-flush-RB5Tz5nl.js +1001 -0
  35. package/dist/icon-CJkTlmTb.js +55 -0
  36. package/dist/icon-dVhYJUIH.js +17 -0
  37. package/dist/import-BgJdkwBI.js +606 -0
  38. package/dist/import.d.ts +1 -0
  39. package/dist/import.js +606 -0
  40. package/dist/index.d.ts +1 -0
  41. package/dist/index.js +16 -0
  42. package/dist/index.node-BIqEGehH.js +396 -0
  43. package/dist/index.node.d.ts +1 -0
  44. package/dist/index.node.js +16 -0
  45. package/dist/input-zGOULADt.js +4 -0
  46. package/dist/layout-var-CZnzMC0s.js +73 -0
  47. package/dist/light-slots-BVJwyg_2.js +244 -0
  48. package/dist/light-slots-DW1WgfgT.js +254 -0
  49. package/dist/markdown-DfqrfOJN.js +20146 -0
  50. package/dist/mono-button-simcTQdW.js +873 -0
  51. package/dist/mono-button.shadow-B_rKOY9N.js +784 -0
  52. package/dist/mono-data-chart-CEv29_NS.js +779 -0
  53. package/dist/mono-data-dropdown-Wnoke6zO.js +357 -0
  54. package/dist/mono-data-grid-CjkEqxgE.js +3913 -0
  55. package/dist/mono-data-grid-YjR3n9Ar.js +3915 -0
  56. package/dist/mono-element-B0kP_96P.js +232 -0
  57. package/dist/mono-event-Bi1qP9uN.js +129 -0
  58. package/dist/mono-form-controller-5PfsU4qa.js +409 -0
  59. package/dist/mono-modal-controller-BMO3n3rP.js +223 -0
  60. package/dist/mono-ui-CPV7rrdo.js +358 -0
  61. package/dist/normalize-error-Gcgmgh5i.js +871 -0
  62. package/dist/notifier-CE4yxMUQ.js +88 -0
  63. package/dist/nuxt.d.ts +1 -0
  64. package/dist/nuxt.js +130 -0
  65. package/dist/popup-portal-BziRX1yG.js +465 -0
  66. package/dist/popup-stack-CEEMib__.js +189 -0
  67. package/dist/rate-limit-BBa2PO79.js +521 -0
  68. package/dist/reactive-D3EERqgO.js +47 -0
  69. package/dist/reactive-Di3mTMnV.js +1087 -0
  70. package/dist/search.d.ts +1 -0
  71. package/dist/search.js +97 -0
  72. package/dist/src/components/accordion/accordion-core.d.ts +62 -0
  73. package/dist/src/components/accordion/accordion-types.d.ts +62 -0
  74. package/dist/src/components/accordion/index.d.ts +3 -0
  75. package/dist/src/components/accordion/index.shadow.d.ts +5 -0
  76. package/dist/src/components/accordion/mono-accordion.d.ts +55 -0
  77. package/dist/src/components/accordion/mono-accordion.shadow.d.ts +56 -0
  78. package/dist/src/components/alert/alert-core.d.ts +46 -0
  79. package/dist/src/components/alert/alert-types.d.ts +44 -0
  80. package/dist/src/components/alert/index.d.ts +3 -0
  81. package/dist/src/components/alert/index.shadow.d.ts +5 -0
  82. package/dist/src/components/alert/mono-alert.d.ts +44 -0
  83. package/dist/src/components/alert/mono-alert.shadow.d.ts +34 -0
  84. package/dist/src/components/breadcrumb/breadcrumb-core.d.ts +61 -0
  85. package/dist/src/components/breadcrumb/breadcrumb-list-core.d.ts +49 -0
  86. package/dist/src/components/breadcrumb/breadcrumb-render.d.ts +31 -0
  87. package/dist/src/components/breadcrumb/breadcrumb-types.d.ts +117 -0
  88. package/dist/src/components/breadcrumb/breadcrumb-utils.d.ts +43 -0
  89. package/dist/src/components/breadcrumb/index.d.ts +6 -0
  90. package/dist/src/components/breadcrumb/index.shadow.d.ts +8 -0
  91. package/dist/src/components/breadcrumb/mono-breadcrumb-list.d.ts +29 -0
  92. package/dist/src/components/breadcrumb/mono-breadcrumb-list.shadow.d.ts +48 -0
  93. package/dist/src/components/breadcrumb/mono-breadcrumb.d.ts +38 -0
  94. package/dist/src/components/breadcrumb/mono-breadcrumb.shadow.d.ts +73 -0
  95. package/dist/src/components/button/button-core.d.ts +90 -0
  96. package/dist/src/components/button/button-dropdown-core.d.ts +57 -0
  97. package/dist/src/components/button/button-dropdown-types.d.ts +129 -0
  98. package/dist/src/components/button/button-types.d.ts +219 -0
  99. package/dist/src/components/button/button-utils.d.ts +18 -0
  100. package/dist/src/components/button/index.button-dropdown.d.ts +4 -0
  101. package/dist/src/components/button/index.button-dropdown.shadow.d.ts +4 -0
  102. package/dist/src/components/button/index.d.ts +8 -0
  103. package/dist/src/components/button/index.shadow.d.ts +5 -0
  104. package/dist/src/components/button/mono-button-dropdown.d.ts +35 -0
  105. package/dist/src/components/button/mono-button-dropdown.shadow.d.ts +45 -0
  106. package/dist/src/components/button/mono-button.d.ts +123 -0
  107. package/dist/src/components/button/mono-button.shadow.d.ts +56 -0
  108. package/dist/src/components/card/card-core.d.ts +75 -0
  109. package/dist/src/components/card/card-types.d.ts +137 -0
  110. package/dist/src/components/card/card-utils.d.ts +23 -0
  111. package/dist/src/components/card/index.d.ts +4 -0
  112. package/dist/src/components/card/index.shadow.d.ts +6 -0
  113. package/dist/src/components/card/mono-card.d.ts +56 -0
  114. package/dist/src/components/card/mono-card.shadow.d.ts +52 -0
  115. package/dist/src/components/chart/chart-core.d.ts +43 -0
  116. package/dist/src/components/chart/chart-odata.d.ts +52 -0
  117. package/dist/src/components/chart/chart-types.d.ts +356 -0
  118. package/dist/src/components/chart/index.d.ts +8 -0
  119. package/dist/src/components/chart/index.shadow.d.ts +7 -0
  120. package/dist/src/components/chart/mono-chart-presets.d.ts +43 -0
  121. package/dist/src/components/chart/mono-chart-presets.shadow.d.ts +43 -0
  122. package/dist/src/components/chart/mono-chart.d.ts +30 -0
  123. package/dist/src/components/chart/mono-chart.shadow.d.ts +22 -0
  124. package/dist/src/components/chart/mono-data-chart.d.ts +27 -0
  125. package/dist/src/components/checkbox/checkbox-core.d.ts +53 -0
  126. package/dist/src/components/checkbox/checkbox-types.d.ts +69 -0
  127. package/dist/src/components/checkbox/checkbox-utils.d.ts +35 -0
  128. package/dist/src/components/checkbox/index.d.ts +4 -0
  129. package/dist/src/components/checkbox/index.shadow.d.ts +5 -0
  130. package/dist/src/components/checkbox/mono-checkbox.d.ts +34 -0
  131. package/dist/src/components/checkbox/mono-checkbox.shadow.d.ts +45 -0
  132. package/dist/src/components/chip/chip-core.d.ts +58 -0
  133. package/dist/src/components/chip/chip-types.d.ts +142 -0
  134. package/dist/src/components/chip/chip-utils.d.ts +24 -0
  135. package/dist/src/components/chip/index.d.ts +8 -0
  136. package/dist/src/components/chip/index.shadow.d.ts +6 -0
  137. package/dist/src/components/chip/mono-chip.d.ts +48 -0
  138. package/dist/src/components/chip/mono-chip.shadow.d.ts +33 -0
  139. package/dist/src/components/chip/mono-status-dot.d.ts +34 -0
  140. package/dist/src/components/date/date-core.d.ts +80 -0
  141. package/dist/src/components/date/date-types.d.ts +163 -0
  142. package/dist/src/components/date/index.d.ts +3 -0
  143. package/dist/src/components/date/index.shadow.d.ts +4 -0
  144. package/dist/src/components/date/mono-date.d.ts +22 -0
  145. package/dist/src/components/date/mono-date.shadow.d.ts +31 -0
  146. package/dist/src/components/drawer/drawer-core.d.ts +99 -0
  147. package/dist/src/components/drawer/drawer-types.d.ts +153 -0
  148. package/dist/src/components/drawer/index.d.ts +3 -0
  149. package/dist/src/components/drawer/index.shadow.d.ts +4 -0
  150. package/dist/src/components/drawer/mono-drawer.d.ts +45 -0
  151. package/dist/src/components/drawer/mono-drawer.shadow.d.ts +46 -0
  152. package/dist/src/components/dropdown/dropdown-core.d.ts +33 -0
  153. package/dist/src/components/dropdown/dropdown-types.d.ts +88 -0
  154. package/dist/src/components/dropdown/index.d.ts +3 -0
  155. package/dist/src/components/dropdown/index.shadow.d.ts +4 -0
  156. package/dist/src/components/dropdown/mono-dropdown.d.ts +34 -0
  157. package/dist/src/components/dropdown/mono-dropdown.shadow.d.ts +28 -0
  158. package/dist/src/components/dropdown-table/dropdown-table-core.d.ts +65 -0
  159. package/dist/src/components/dropdown-table/dropdown-table-types.d.ts +278 -0
  160. package/dist/src/components/dropdown-table/index.d.ts +5 -0
  161. package/dist/src/components/dropdown-table/index.shadow.d.ts +6 -0
  162. package/dist/src/components/dropdown-table/mono-data-dropdown.d.ts +152 -0
  163. package/dist/src/components/dropdown-table/mono-dropdown-table.d.ts +46 -0
  164. package/dist/src/components/dropdown-table/mono-dropdown-table.shadow.d.ts +22 -0
  165. package/dist/src/components/file-upload/file-upload-core.d.ts +60 -0
  166. package/dist/src/components/file-upload/file-upload-types.d.ts +145 -0
  167. package/dist/src/components/file-upload/file-upload-utils.d.ts +16 -0
  168. package/dist/src/components/file-upload/index.d.ts +4 -0
  169. package/dist/src/components/file-upload/index.shadow.d.ts +5 -0
  170. package/dist/src/components/file-upload/mono-file-upload.d.ts +33 -0
  171. package/dist/src/components/file-upload/mono-file-upload.shadow.d.ts +50 -0
  172. package/dist/src/components/filter/filter-builder-core.d.ts +36 -0
  173. package/dist/src/components/filter/filter-builder.d.ts +23 -0
  174. package/dist/src/components/filter/filter-odata.d.ts +27 -0
  175. package/dist/src/components/filter/filter-operators.d.ts +13 -0
  176. package/dist/src/components/filter/filter-types.d.ts +253 -0
  177. package/dist/src/components/filter/index.d.ts +6 -0
  178. package/dist/src/components/filter/index.shadow.d.ts +7 -0
  179. package/dist/src/components/filter/mono-filter-builder.d.ts +21 -0
  180. package/dist/src/components/filter/mono-filter-builder.shadow.d.ts +17 -0
  181. package/dist/src/components/form/form-control-core.d.ts +37 -0
  182. package/dist/src/components/form/form-rules.d.ts +25 -0
  183. package/dist/src/components/form/form-types.d.ts +307 -0
  184. package/dist/src/components/form/index.d.ts +6 -0
  185. package/dist/src/components/form/mono-form-controller.d.ts +16 -0
  186. package/dist/src/components/input/index.d.ts +6 -0
  187. package/dist/src/components/input/index.shadow.d.ts +8 -0
  188. package/dist/src/components/input/input-core.d.ts +91 -0
  189. package/dist/src/components/input/input-format.d.ts +118 -0
  190. package/dist/src/components/input/input-types.d.ts +179 -0
  191. package/dist/src/components/input/input-utils.d.ts +10 -0
  192. package/dist/src/components/input/mono-input.d.ts +46 -0
  193. package/dist/src/components/input/mono-input.shadow.d.ts +34 -0
  194. package/dist/src/components/menu/index.d.ts +6 -0
  195. package/dist/src/components/menu/index.shadow.d.ts +7 -0
  196. package/dist/src/components/menu/menu-core.d.ts +65 -0
  197. package/dist/src/components/menu/menu-render.d.ts +55 -0
  198. package/dist/src/components/menu/menu-types.d.ts +195 -0
  199. package/dist/src/components/menu/menu-utils.d.ts +53 -0
  200. package/dist/src/components/menu/mono-menu-list.d.ts +118 -0
  201. package/dist/src/components/menu/mono-menu.d.ts +39 -0
  202. package/dist/src/components/menu/mono-menu.shadow.d.ts +40 -0
  203. package/dist/src/components/modal/index.d.ts +4 -0
  204. package/dist/src/components/modal/index.shadow.d.ts +5 -0
  205. package/dist/src/components/modal/modal-core.d.ts +110 -0
  206. package/dist/src/components/modal/modal-types.d.ts +304 -0
  207. package/dist/src/components/modal/mono-modal-controller.d.ts +4 -0
  208. package/dist/src/components/modal/mono-modal.d.ts +45 -0
  209. package/dist/src/components/modal/mono-modal.shadow.d.ts +50 -0
  210. package/dist/src/components/nav/index.d.ts +4 -0
  211. package/dist/src/components/nav/index.shadow.d.ts +6 -0
  212. package/dist/src/components/nav/mono-nav.d.ts +41 -0
  213. package/dist/src/components/nav/mono-nav.shadow.d.ts +21 -0
  214. package/dist/src/components/nav/nav-core.d.ts +34 -0
  215. package/dist/src/components/nav/nav-types.d.ts +48 -0
  216. package/dist/src/components/nav/nav-utils.d.ts +12 -0
  217. package/dist/src/components/radio/index.d.ts +4 -0
  218. package/dist/src/components/radio/index.shadow.d.ts +5 -0
  219. package/dist/src/components/radio/mono-radio.d.ts +31 -0
  220. package/dist/src/components/radio/mono-radio.shadow.d.ts +35 -0
  221. package/dist/src/components/radio/radio-core.d.ts +45 -0
  222. package/dist/src/components/radio/radio-types.d.ts +58 -0
  223. package/dist/src/components/radio/radio-utils.d.ts +12 -0
  224. package/dist/src/components/rich-text-editor/index.d.ts +5 -0
  225. package/dist/src/components/rich-text-editor/index.shadow.d.ts +6 -0
  226. package/dist/src/components/rich-text-editor/mono-rich-text-editor.d.ts +31 -0
  227. package/dist/src/components/rich-text-editor/mono-rich-text-editor.shadow.d.ts +34 -0
  228. package/dist/src/components/rich-text-editor/rich-text-editor-core.d.ts +100 -0
  229. package/dist/src/components/rich-text-editor/rich-text-editor-loader.d.ts +17 -0
  230. package/dist/src/components/rich-text-editor/rich-text-editor-toolbar.d.ts +65 -0
  231. package/dist/src/components/rich-text-editor/rich-text-editor-types.d.ts +231 -0
  232. package/dist/src/components/select/index.d.ts +4 -0
  233. package/dist/src/components/select/index.shadow.d.ts +5 -0
  234. package/dist/src/components/select/mono-select.d.ts +69 -0
  235. package/dist/src/components/select/mono-select.shadow.d.ts +48 -0
  236. package/dist/src/components/select/select-core.d.ts +98 -0
  237. package/dist/src/components/select/select-types.d.ts +284 -0
  238. package/dist/src/components/select/select-utils.d.ts +7 -0
  239. package/dist/src/components/sidebar/index.d.ts +4 -0
  240. package/dist/src/components/sidebar/index.shadow.d.ts +6 -0
  241. package/dist/src/components/sidebar/mono-sidebar.d.ts +34 -0
  242. package/dist/src/components/sidebar/mono-sidebar.shadow.d.ts +27 -0
  243. package/dist/src/components/sidebar/sidebar-core.d.ts +51 -0
  244. package/dist/src/components/sidebar/sidebar-types.d.ts +119 -0
  245. package/dist/src/components/sidebar/sidebar-utils.d.ts +55 -0
  246. package/dist/src/components/switch/index.d.ts +4 -0
  247. package/dist/src/components/switch/index.shadow.d.ts +5 -0
  248. package/dist/src/components/switch/mono-switch.d.ts +31 -0
  249. package/dist/src/components/switch/mono-switch.shadow.d.ts +36 -0
  250. package/dist/src/components/switch/switch-core.d.ts +49 -0
  251. package/dist/src/components/switch/switch-types.d.ts +64 -0
  252. package/dist/src/components/switch/switch-utils.d.ts +12 -0
  253. package/dist/src/components/table/array-source.d.ts +44 -0
  254. package/dist/src/components/table/date-filter-tree.d.ts +93 -0
  255. package/dist/src/components/table/grouping.d.ts +55 -0
  256. package/dist/src/components/table/index.d.ts +33 -0
  257. package/dist/src/components/table/index.shadow.d.ts +47 -0
  258. package/dist/src/components/table/mono-data-grid.d.ts +1756 -0
  259. package/dist/src/components/table/mono-table-checkbox-core.d.ts +76 -0
  260. package/dist/src/components/table/mono-table-checkbox.d.ts +34 -0
  261. package/dist/src/components/table/mono-table-checkbox.shadow.d.ts +26 -0
  262. package/dist/src/components/table/mono-table-detail-core.d.ts +87 -0
  263. package/dist/src/components/table/mono-table-detail.d.ts +32 -0
  264. package/dist/src/components/table/mono-table-detail.shadow.d.ts +31 -0
  265. package/dist/src/components/table/mono-table-empty-core.d.ts +60 -0
  266. package/dist/src/components/table/mono-table-empty.d.ts +35 -0
  267. package/dist/src/components/table/mono-table-empty.shadow.d.ts +40 -0
  268. package/dist/src/components/table/mono-table-error-core.d.ts +84 -0
  269. package/dist/src/components/table/mono-table-error.d.ts +28 -0
  270. package/dist/src/components/table/mono-table-error.shadow.d.ts +21 -0
  271. package/dist/src/components/table/mono-table-info-core.d.ts +13 -0
  272. package/dist/src/components/table/mono-table-info.d.ts +19 -0
  273. package/dist/src/components/table/mono-table-info.shadow.d.ts +14 -0
  274. package/dist/src/components/table/mono-table-loading-core.d.ts +41 -0
  275. package/dist/src/components/table/mono-table-loading.d.ts +50 -0
  276. package/dist/src/components/table/mono-table-loading.shadow.d.ts +14 -0
  277. package/dist/src/components/table/mono-table-page-size-core.d.ts +14 -0
  278. package/dist/src/components/table/mono-table-page-size.d.ts +16 -0
  279. package/dist/src/components/table/mono-table-page-size.shadow.d.ts +11 -0
  280. package/dist/src/components/table/mono-table-paging-core.d.ts +22 -0
  281. package/dist/src/components/table/mono-table-paging-group-core.d.ts +18 -0
  282. package/dist/src/components/table/mono-table-paging-group.d.ts +20 -0
  283. package/dist/src/components/table/mono-table-paging-group.shadow.d.ts +13 -0
  284. package/dist/src/components/table/mono-table-paging.d.ts +16 -0
  285. package/dist/src/components/table/mono-table-paging.shadow.d.ts +11 -0
  286. package/dist/src/components/table/mono-table-search-core.d.ts +74 -0
  287. package/dist/src/components/table/mono-table-search.d.ts +34 -0
  288. package/dist/src/components/table/mono-table-search.shadow.d.ts +21 -0
  289. package/dist/src/components/table/mono-table-sort-core.d.ts +35 -0
  290. package/dist/src/components/table/mono-table-sort.d.ts +38 -0
  291. package/dist/src/components/table/mono-table-sort.shadow.d.ts +20 -0
  292. package/dist/src/components/table/mono-table-summary-core.d.ts +26 -0
  293. package/dist/src/components/table/mono-table-summary.d.ts +24 -0
  294. package/dist/src/components/table/mono-table-summary.shadow.d.ts +14 -0
  295. package/dist/src/components/table/mono-table-th-core.d.ts +56 -0
  296. package/dist/src/components/table/mono-table-th.d.ts +41 -0
  297. package/dist/src/components/table/mono-table-th.shadow.d.ts +19 -0
  298. package/dist/src/components/table/store-group-source.d.ts +24 -0
  299. package/dist/src/components/table/table-controller-core.d.ts +40 -0
  300. package/dist/src/components/table/table-filter-icons.d.ts +3 -0
  301. package/dist/src/components/table/table-menu-core.d.ts +65 -0
  302. package/dist/src/components/table/table-overlay.d.ts +165 -0
  303. package/dist/src/components/table/table-sort-icons.d.ts +4 -0
  304. package/dist/src/components/table/table-sort-utils.d.ts +20 -0
  305. package/dist/src/components/table/table-types.d.ts +475 -0
  306. package/dist/src/components/tabs/index.d.ts +3 -0
  307. package/dist/src/components/tabs/index.shadow.d.ts +4 -0
  308. package/dist/src/components/tabs/mono-tabs.d.ts +33 -0
  309. package/dist/src/components/tabs/mono-tabs.shadow.d.ts +37 -0
  310. package/dist/src/components/tabs/tabs-core.d.ts +57 -0
  311. package/dist/src/components/tabs/tabs-types.d.ts +65 -0
  312. package/dist/src/components/tag-input/index.d.ts +4 -0
  313. package/dist/src/components/tag-input/index.shadow.d.ts +5 -0
  314. package/dist/src/components/tag-input/mono-tag-input.d.ts +66 -0
  315. package/dist/src/components/tag-input/mono-tag-input.shadow.d.ts +40 -0
  316. package/dist/src/components/tag-input/tag-input-core.d.ts +108 -0
  317. package/dist/src/components/tag-input/tag-input-types.d.ts +420 -0
  318. package/dist/src/components/tag-input/tag-input-utils.d.ts +8 -0
  319. package/dist/src/components/textarea/index.d.ts +4 -0
  320. package/dist/src/components/textarea/index.shadow.d.ts +5 -0
  321. package/dist/src/components/textarea/mono-textarea.d.ts +29 -0
  322. package/dist/src/components/textarea/mono-textarea.shadow.d.ts +31 -0
  323. package/dist/src/components/textarea/textarea-core.d.ts +60 -0
  324. package/dist/src/components/textarea/textarea-types.d.ts +131 -0
  325. package/dist/src/components/textarea/textarea-utils.d.ts +7 -0
  326. package/dist/src/components/tooltip/control-tooltip.d.ts +36 -0
  327. package/dist/src/components/tooltip/index.d.ts +6 -0
  328. package/dist/src/components/tooltip/tooltip-config.d.ts +27 -0
  329. package/dist/src/components/tooltip/tooltip-declarative.d.ts +41 -0
  330. package/dist/src/components/tooltip/tooltip-loader.d.ts +1 -0
  331. package/dist/src/components/tooltip/tooltip-types.d.ts +110 -0
  332. package/dist/src/composables/breakpoints.d.ts +59 -0
  333. package/dist/src/composables/chip-limits.d.ts +48 -0
  334. package/dist/src/composables/chip-strip.d.ts +93 -0
  335. package/dist/src/composables/color.d.ts +103 -0
  336. package/dist/src/composables/css-class.d.ts +27 -0
  337. package/dist/src/composables/css-size.d.ts +40 -0
  338. package/dist/src/composables/data-source-controller.d.ts +113 -0
  339. package/dist/src/composables/element-props.d.ts +46 -0
  340. package/dist/src/composables/field-icons.d.ts +15 -0
  341. package/dist/src/composables/hybird-prop.d.ts +79 -0
  342. package/dist/src/composables/hydration-flush.d.ts +34 -0
  343. package/dist/src/composables/icon.d.ts +17 -0
  344. package/dist/src/composables/layout-var.d.ts +34 -0
  345. package/dist/src/composables/light-slots.d.ts +133 -0
  346. package/dist/src/composables/mdi-glyphs.d.ts +4 -0
  347. package/dist/src/composables/mono-element.d.ts +9 -0
  348. package/dist/src/composables/mono-event.d.ts +55 -0
  349. package/dist/src/composables/mono-pending.d.ts +8 -0
  350. package/dist/src/composables/mono-skeleton.d.ts +193 -0
  351. package/dist/src/composables/mono-ui.d.ts +58 -0
  352. package/dist/src/composables/notifier.d.ts +46 -0
  353. package/dist/src/composables/popup-portal.d.ts +226 -0
  354. package/dist/src/composables/popup-stack.d.ts +70 -0
  355. package/dist/src/composables/rate-limit.d.ts +108 -0
  356. package/dist/src/composables/reactive.d.ts +53 -0
  357. package/dist/src/composables/shadow-css.d.ts +42 -0
  358. package/dist/src/composables/visibility.d.ts +36 -0
  359. package/dist/src/data/theme/index.d.ts +30 -0
  360. package/dist/src/data/theme/presets.d.ts +94 -0
  361. package/dist/src/entries/index.d.ts +2 -0
  362. package/dist/src/entries/index.node.d.ts +42 -0
  363. package/dist/src/entries/search.d.ts +3 -0
  364. package/dist/src/export/detail.d.ts +29 -0
  365. package/dist/src/export/download.d.ts +9 -0
  366. package/dist/src/export/excel/index.d.ts +27 -0
  367. package/dist/src/export/excel/nodes.d.ts +123 -0
  368. package/dist/src/export/expression.d.ts +36 -0
  369. package/dist/src/export/helpers.d.ts +6 -0
  370. package/dist/src/export/index.d.ts +13 -0
  371. package/dist/src/export/markdown.d.ts +52 -0
  372. package/dist/src/export/resolve-data.d.ts +31 -0
  373. package/dist/src/export/sentinel.d.ts +97 -0
  374. package/dist/src/export/sheet-name.d.ts +45 -0
  375. package/dist/src/export/styles.d.ts +33 -0
  376. package/dist/src/export/template.d.ts +10 -0
  377. package/dist/src/export/types.d.ts +259 -0
  378. package/dist/src/import/coerce.d.ts +38 -0
  379. package/dist/src/import/index.d.ts +16 -0
  380. package/dist/src/import/match.d.ts +54 -0
  381. package/dist/src/import/parse.d.ts +15 -0
  382. package/dist/src/import/types.d.ts +153 -0
  383. package/dist/src/nuxt/index.d.ts +94 -0
  384. package/dist/src/search/data-search.d.ts +207 -0
  385. package/dist/src/search/field-path.d.ts +107 -0
  386. package/dist/src/search/filter-eval.d.ts +30 -0
  387. package/dist/src/search/index.d.ts +22 -0
  388. package/dist/src/search/odata-search.d.ts +18 -0
  389. package/dist/src/search/search-expr.d.ts +160 -0
  390. package/dist/src/utils/data-source-apply.d.ts +97 -0
  391. package/dist/src/utils/data-source-options.d.ts +116 -0
  392. package/dist/src/utils/data-source-read.d.ts +85 -0
  393. package/dist/src/utils/data-source-summary.d.ts +55 -0
  394. package/dist/src/utils/normalize-error.d.ts +90 -0
  395. package/dist/src/vite/index.d.ts +48 -0
  396. package/dist/src/vite/mono-client-only.d.ts +35 -0
  397. package/dist/src/vite/mono-ssr-stub.d.ts +20 -0
  398. package/dist/src/vite/shadow-manifest.d.ts +8 -0
  399. package/dist/styles-BIJ31TM4.js +20146 -0
  400. package/dist/tooltip-DQqNpqk2.js +795 -0
  401. package/dist/tooltip.d.ts +1 -0
  402. package/dist/tooltip.js +2 -0
  403. package/dist/ui/accordion.d.ts +1 -0
  404. package/dist/ui/accordion.js +466 -0
  405. package/dist/ui/alert.d.ts +1 -0
  406. package/dist/ui/alert.js +221 -0
  407. package/dist/ui/breadcrumb.d.ts +1 -0
  408. package/dist/ui/breadcrumb.js +902 -0
  409. package/dist/ui/button-dropdown.d.ts +1 -0
  410. package/dist/ui/button-dropdown.js +679 -0
  411. package/dist/ui/button.d.ts +1 -0
  412. package/dist/ui/button.js +63 -0
  413. package/dist/ui/card.d.ts +1 -0
  414. package/dist/ui/card.js +524 -0
  415. package/dist/ui/chart.d.ts +1 -0
  416. package/dist/ui/chart.js +885 -0
  417. package/dist/ui/checkbox.d.ts +1 -0
  418. package/dist/ui/checkbox.js +413 -0
  419. package/dist/ui/chip.d.ts +1 -0
  420. package/dist/ui/chip.js +558 -0
  421. package/dist/ui/date.d.ts +1 -0
  422. package/dist/ui/date.js +686 -0
  423. package/dist/ui/drawer.d.ts +1 -0
  424. package/dist/ui/drawer.js +901 -0
  425. package/dist/ui/dropdown-table.d.ts +1 -0
  426. package/dist/ui/dropdown-table.js +1291 -0
  427. package/dist/ui/dropdown.d.ts +1 -0
  428. package/dist/ui/dropdown.js +586 -0
  429. package/dist/ui/file-upload.d.ts +1 -0
  430. package/dist/ui/file-upload.js +688 -0
  431. package/dist/ui/filter.d.ts +1 -0
  432. package/dist/ui/filter.js +400 -0
  433. package/dist/ui/font/files/geist-47c091c9.woff2 +0 -0
  434. package/dist/ui/font/files/geist-8dd77544.woff2 +0 -0
  435. package/dist/ui/font/files/geist-b9248b1e.woff2 +0 -0
  436. package/dist/ui/font/files/geist-d40d74b4.woff2 +0 -0
  437. package/dist/ui/font/files/geist-f493429a.woff2 +0 -0
  438. package/dist/ui/font/files/geistmono-03737868.woff2 +0 -0
  439. package/dist/ui/font/files/geistmono-421a7e38.woff2 +0 -0
  440. package/dist/ui/font/files/geistmono-48ef518d.woff2 +0 -0
  441. package/dist/ui/font/files/geistmono-5df35d39.woff2 +0 -0
  442. package/dist/ui/font/files/geistmono-7de289a4.woff2 +0 -0
  443. package/dist/ui/font/files/geistmono-e976128f.woff2 +0 -0
  444. package/dist/ui/font/files/inter-05cf802c.woff2 +0 -0
  445. package/dist/ui/font/files/inter-2b2f25a4.woff2 +0 -0
  446. package/dist/ui/font/files/inter-467acc7a.woff2 +0 -0
  447. package/dist/ui/font/files/inter-6e85163c.woff2 +0 -0
  448. package/dist/ui/font/files/inter-7048add3.woff2 +0 -0
  449. package/dist/ui/font/files/inter-9be0371e.woff2 +0 -0
  450. package/dist/ui/font/files/inter-a28b7e31.woff2 +0 -0
  451. package/dist/ui/font/files/poppins-054df55a.woff2 +0 -0
  452. package/dist/ui/font/files/poppins-0ee5dc9a.woff2 +0 -0
  453. package/dist/ui/font/files/poppins-0f44cb18.woff2 +0 -0
  454. package/dist/ui/font/files/poppins-0ff0d30c.woff2 +0 -0
  455. package/dist/ui/font/files/poppins-13045147.woff2 +0 -0
  456. package/dist/ui/font/files/poppins-1db57cd9.woff2 +0 -0
  457. package/dist/ui/font/files/poppins-2cf2a902.woff2 +0 -0
  458. package/dist/ui/font/files/poppins-39e7f079.woff2 +0 -0
  459. package/dist/ui/font/files/poppins-9607042d.woff2 +0 -0
  460. package/dist/ui/font/files/poppins-9a88fc1f.woff2 +0 -0
  461. package/dist/ui/font/files/poppins-b8f4f752.woff2 +0 -0
  462. package/dist/ui/font/files/poppins-f5e57db4.woff2 +0 -0
  463. package/dist/ui/font/geist-mono.css +104 -0
  464. package/dist/ui/font/geist.css +168 -0
  465. package/dist/ui/font/inter.css +232 -0
  466. package/dist/ui/font/poppins.css +104 -0
  467. package/dist/ui/form.d.ts +1 -0
  468. package/dist/ui/form.js +3 -0
  469. package/dist/ui/index.css +21989 -0
  470. package/dist/ui/input.d.ts +1 -0
  471. package/dist/ui/input.js +1176 -0
  472. package/dist/ui/menu.d.ts +1 -0
  473. package/dist/ui/menu.js +1289 -0
  474. package/dist/ui/modal.d.ts +1 -0
  475. package/dist/ui/modal.js +996 -0
  476. package/dist/ui/nav.d.ts +1 -0
  477. package/dist/ui/nav.js +295 -0
  478. package/dist/ui/radio.d.ts +1 -0
  479. package/dist/ui/radio.js +379 -0
  480. package/dist/ui/rich-text-editor.d.ts +1 -0
  481. package/dist/ui/rich-text-editor.js +1338 -0
  482. package/dist/ui/select.d.ts +1 -0
  483. package/dist/ui/select.js +2200 -0
  484. package/dist/ui/shadow/accordion.js +442 -0
  485. package/dist/ui/shadow/alert.js +218 -0
  486. package/dist/ui/shadow/breadcrumb.js +919 -0
  487. package/dist/ui/shadow/button-dropdown.js +696 -0
  488. package/dist/ui/shadow/button.js +63 -0
  489. package/dist/ui/shadow/card.js +538 -0
  490. package/dist/ui/shadow/chart.js +1685 -0
  491. package/dist/ui/shadow/checkbox.js +457 -0
  492. package/dist/ui/shadow/chip.js +559 -0
  493. package/dist/ui/shadow/date.js +712 -0
  494. package/dist/ui/shadow/drawer.js +869 -0
  495. package/dist/ui/shadow/dropdown-table.js +1620 -0
  496. package/dist/ui/shadow/dropdown.js +547 -0
  497. package/dist/ui/shadow/file-upload.js +731 -0
  498. package/dist/ui/shadow/filter.js +402 -0
  499. package/dist/ui/shadow/input.js +1150 -0
  500. package/dist/ui/shadow/menu.js +899 -0
  501. package/dist/ui/shadow/modal.js +1194 -0
  502. package/dist/ui/shadow/nav.js +240 -0
  503. package/dist/ui/shadow/radio.js +408 -0
  504. package/dist/ui/shadow/rich-text-editor.js +1344 -0
  505. package/dist/ui/shadow/select.js +2167 -0
  506. package/dist/ui/shadow/sidebar.js +606 -0
  507. package/dist/ui/shadow/switch.js +428 -0
  508. package/dist/ui/shadow/table.js +4755 -0
  509. package/dist/ui/shadow/tabs.js +372 -0
  510. package/dist/ui/shadow/tag-input.js +2974 -0
  511. package/dist/ui/shadow/textarea.js +816 -0
  512. package/dist/ui/sidebar.d.ts +1 -0
  513. package/dist/ui/sidebar.js +659 -0
  514. package/dist/ui/switch.d.ts +1 -0
  515. package/dist/ui/switch.js +398 -0
  516. package/dist/ui/table.d.ts +1 -0
  517. package/dist/ui/table.js +4654 -0
  518. package/dist/ui/tabs.d.ts +1 -0
  519. package/dist/ui/tabs.js +379 -0
  520. package/dist/ui/tag-input.d.ts +1 -0
  521. package/dist/ui/tag-input.js +2947 -0
  522. package/dist/ui/textarea.d.ts +1 -0
  523. package/dist/ui/textarea.js +819 -0
  524. package/dist/ui/theme/legacy.css +293 -0
  525. package/dist/ui/theme/luma.css +743 -0
  526. package/dist/ui/theme/lyra.css +754 -0
  527. package/dist/ui/theme/maia.css +673 -0
  528. package/dist/ui/theme/mira.css +802 -0
  529. package/dist/ui/theme/nova.css +662 -0
  530. package/dist/ui/theme/one.css +699 -0
  531. package/dist/ui/theme/rhea.css +742 -0
  532. package/dist/ui/theme/sera.css +845 -0
  533. package/dist/ui/theme/tokens.css +261 -0
  534. package/dist/ui/theme/vega.css +467 -0
  535. package/dist/vite-C5iUK7so.js +329 -0
  536. package/dist/vite.d.ts +1 -0
  537. package/dist/vite.js +2 -0
  538. package/dist/vue.d.ts +282 -0
  539. package/package.json +411 -3
@@ -0,0 +1,1685 @@
1
+ import { a as __decorate, c as defineHybridPropAlias, f as customElement, i as withShadowUtilityStyles, l as defineHybridPropAliases, r as toShadowCss, s as booleanStringConverter, t as flushSsrHydration, u as numberStringConverter, v as monoPendingGrace } from "../../hydration-flush-RB5Tz5nl.js";
2
+ import { t as dispatchMonoEvent } from "../../mono-event-Bi1qP9uN.js";
3
+ import { n as toCssSize } from "../../css-size-DhHSVZJK.js";
4
+ import { n as detachEventHandlers, t as applyProps } from "../../element-props-CLB6yvbm.js";
5
+ import { t as createNotifier } from "../../notifier-CE4yxMUQ.js";
6
+ import { n as isPath, t as getFieldValue } from "../../field-path-C92eGLg3.js";
7
+ import { A as compileFilterPredicate, O as andFilters, a as describeError, c as errorTitle, k as andPredicates, l as isCanceled, s as errorText } from "../../reactive-Di3mTMnV.js";
8
+ import { r as readAllRows } from "../../data-source-read-B4DGp6UQ.js";
9
+ import { a as resolveDataSourceOptions, d as createApplyGate, f as isRolledUp, h as monoArraySource, i as normalizeSortList, n as extraLoadOptions, o as toList, p as loadApply, r as mergeDataSourceOptions, u as summaryFilterOf } from "../../data-source-options-CP-X62Pa.js";
10
+ import { t as arrayToODataString } from "../../filter-odata-C1vSGZaY.js";
11
+ import { a as spinnerIcon, i as refreshIcon } from "../../field-icons-DELrSdqJ.js";
12
+ import { LitElement, html, isServer, nothing, unsafeCSS } from "lit";
13
+ import { property, query, state } from "lit/decorators.js";
14
+ import { styleMap } from "lit/directives/style-map.js";
15
+ //#region src/components/chart/chart-core.ts
16
+ /**
17
+ * The mono color names a chart accepts wherever a color is expected. They map to
18
+ * the `--_mono-chart-<name>` resolvers in chart.css, which chain through the
19
+ * public `--mono-chart-*` overrides to the Basecoat tokens — `chart-1` … `chart-5`
20
+ * are Basecoat's own chart palette (`--chart-1` … `--chart-5`), the roles are the
21
+ * page's. `surface` is internal: the hairline between slices.
22
+ */
23
+ var MONO_COLOR_NAMES = new Set([
24
+ "chart-1",
25
+ "chart-2",
26
+ "chart-3",
27
+ "chart-4",
28
+ "chart-5",
29
+ "primary",
30
+ "secondary",
31
+ "accent",
32
+ "success",
33
+ "warning",
34
+ "danger",
35
+ "info",
36
+ "surface"
37
+ ]);
38
+ /** Used before the element is in the DOM (SSR) or if a token resolves empty — ONE, light. */
39
+ var MONO_COLOR_FALLBACK = {
40
+ "chart-1": "oklch(0.859 0.069 267.7)",
41
+ "chart-2": "oklch(0.735 0.12 268.04)",
42
+ "chart-3": "oklch(0.61 0.12 267.95)",
43
+ "chart-4": "oklch(0.485 0.119 267.92)",
44
+ "chart-5": "oklch(0.36 0.12 268.21)",
45
+ primary: "oklch(0.299 0.119 267.96)",
46
+ secondary: "oklch(0.554 0.041 257.42)",
47
+ accent: "oklch(0.735 0.12 268.04)",
48
+ success: "oklch(0.5239 0.0917 180.004)",
49
+ warning: "oklch(0.5423 0.1066 70.504)",
50
+ danger: "oklch(0.561 0.202 26.71)",
51
+ info: "oklch(0.431 0.163 267.72)",
52
+ surface: "oklch(0.973 0.007 268.55)"
53
+ };
54
+ /** The tooltip lines come from the data (labels, formatted values) — never markup. */
55
+ function escapeHtml(s) {
56
+ return s.replace(/[&<>"']/g, (c) => ({
57
+ "&": "&amp;",
58
+ "<": "&lt;",
59
+ ">": "&gt;",
60
+ "\"": "&quot;",
61
+ "'": "&#39;"
62
+ })[c]);
63
+ }
64
+ /**
65
+ * Cached loader for the OPTIONAL `chart.js` peer.
66
+ *
67
+ * `chart.js/auto` self-registers every controller/scale/element — the right
68
+ * trade here because the library is externalized, so the consumer's bundler
69
+ * owns the cost and tree-shaking on our side would buy nothing.
70
+ */
71
+ var _chartPromise = null;
72
+ function loadChartJs() {
73
+ _chartPromise ??= import("chart.js/auto").then((m) => m?.default ?? m).catch((err) => {
74
+ _chartPromise = null;
75
+ throw new Error("[mono-chart] needs the optional peer dependency \"chart.js\". Install it in your app: pnpm add chart.js@4.5.1" + (err?.message ? ` (original error: ${err.message})` : ""));
76
+ });
77
+ return _chartPromise;
78
+ }
79
+ /**
80
+ * `MonoChartCore` — render-mode-agnostic logic for the chart elements.
81
+ *
82
+ * It owns the imperative Chart.js lifecycle, following the same shape as the
83
+ * flatpickr wrapper in `date-core.ts`: create in `firstUpdated` behind an
84
+ * `isServer` guard and a dynamic import, split `updated()` into a cheap data
85
+ * update vs a full rebuild, and destroy in `disconnectedCallback` BEFORE
86
+ * `super`. A `ResizeObserver` is added on top because, unlike flatpickr, a
87
+ * canvas needs to be told when its box changes.
88
+ */
89
+ var MonoChartCore = (superClass) => {
90
+ class MonoChartCoreClass extends superClass {
91
+ constructor(...args) {
92
+ super(...args);
93
+ this.aspectRatio = 2;
94
+ this.legend = true;
95
+ this.title = "";
96
+ this.stacked = false;
97
+ this.cssClass = {};
98
+ this.cssClassName = "";
99
+ this.loadingText = "Loading…";
100
+ this.retryLabel = "Retry";
101
+ this.loading = false;
102
+ this.loadingError = null;
103
+ this._appFailure = null;
104
+ this._error = "";
105
+ this._chart = null;
106
+ this._buildToken = 0;
107
+ this._onThemeChanged = () => {
108
+ if (isServer || !this._chart) return;
109
+ requestAnimationFrame(() => {
110
+ if (!this._chart) return;
111
+ const palette = this._colors;
112
+ if (palette?.length) this.dataChart?.setColors(palette);
113
+ else this.dataChart?._setColorResolver((c) => this._resolveColor(c));
114
+ this.rebuild();
115
+ });
116
+ };
117
+ this._applyQueued = false;
118
+ this._onRetry = (event) => {
119
+ event.stopPropagation();
120
+ const error = this._dsError;
121
+ if (!error) return;
122
+ const fromApp = !!this._appFailure;
123
+ dispatchMonoEvent(this, "retry", {
124
+ error,
125
+ source: fromApp ? "app" : "dataSource"
126
+ });
127
+ if (!fromApp) this.dataChart?.retry();
128
+ };
129
+ this._externalTooltip = (context) => {
130
+ const el = this._tooltipEl;
131
+ if (!el) return;
132
+ const tip = context.tooltip;
133
+ if (!tip || tip.opacity === 0) {
134
+ el.removeAttribute("data-open");
135
+ el.setAttribute("aria-hidden", "true");
136
+ return;
137
+ }
138
+ const title = tip.title ?? [];
139
+ const bodies = (tip.body ?? []).map((b) => b.lines ?? []);
140
+ const colors = tip.labelColors ?? [];
141
+ const parts = [];
142
+ for (const t of title) parts.push(`<div class="mono-chart-tooltip-title">${escapeHtml(String(t))}</div>`);
143
+ bodies.forEach((lines, i) => {
144
+ const swatch = colors[i]?.backgroundColor ?? colors[i]?.borderColor;
145
+ for (const line of lines) {
146
+ const m = /^(.*?):\s*(.+)$/.exec(String(line));
147
+ const text = m ? `<span class="mono-chart-tooltip-label">${escapeHtml(m[1])}</span><span class="mono-chart-tooltip-value">${escapeHtml(m[2])}</span>` : `<span class="mono-chart-tooltip-label">${escapeHtml(String(line))}</span>`;
148
+ parts.push(`<div class="mono-chart-tooltip-row">${swatch ? `<span class="mono-chart-tooltip-swatch" style="background:${escapeHtml(String(swatch))}"></span>` : ""}${text}</div>`);
149
+ }
150
+ });
151
+ el.innerHTML = parts.join("");
152
+ const width = el.parentElement?.clientWidth ?? context.chart.width;
153
+ const gap = 8;
154
+ el.setAttribute("data-open", "");
155
+ el.setAttribute("aria-hidden", "false");
156
+ const h = el.offsetHeight;
157
+ const w = el.offsetWidth;
158
+ const side = tip.caretY - h - gap < 0 ? "bottom" : "top";
159
+ el.setAttribute("data-side", side);
160
+ const x = Math.min(Math.max(tip.caretX, w / 2), Math.max(width - w / 2, w / 2));
161
+ el.style.left = `${x}px`;
162
+ el.style.top = `${tip.caretY}px`;
163
+ };
164
+ defineHybridPropAliases(this, [
165
+ "dataChart",
166
+ "chartOptions",
167
+ "aspectRatio",
168
+ "cssClass",
169
+ "loadingText",
170
+ "loadingError"
171
+ ]);
172
+ defineHybridPropAlias(this, "controlChart", "dataChart");
173
+ for (const alias of ["css-class", "cssclass"]) Object.defineProperty(this, alias, {
174
+ get: () => this.cssClass,
175
+ set: (value) => this._setCssClass(value),
176
+ configurable: true,
177
+ enumerable: false
178
+ });
179
+ }
180
+ static {
181
+ this.monoPendingAuto = "data";
182
+ }
183
+ _monoPendingReady() {
184
+ const ctrl = this.dataChart;
185
+ if (!ctrl) return this.data != null || monoPendingGrace(this);
186
+ if (ctrl.loading) return false;
187
+ return monoPendingGrace(this) || ctrl.data().datasets.length > 0;
188
+ }
189
+ static {
190
+ this._rebuildKeys = [
191
+ "type",
192
+ "chartOptions",
193
+ "legend",
194
+ "title",
195
+ "stacked",
196
+ "aspectRatio"
197
+ ];
198
+ }
199
+ static get observedAttributes() {
200
+ return [
201
+ ...super.observedAttributes ?? [],
202
+ "aspectratio",
203
+ "chartoptions",
204
+ "css-class",
205
+ "cssclass",
206
+ "colors"
207
+ ];
208
+ }
209
+ attributeChangedCallback(name, old, value) {
210
+ super.attributeChangedCallback(name, old, value);
211
+ if (old === value) return;
212
+ if (name === "css-class" || name === "cssclass") this._setCssClass(value);
213
+ else if (name === "colors") this.colors = value ?? void 0;
214
+ }
215
+ _setCssClass(value) {
216
+ if (value == null) {
217
+ this.cssClass = {};
218
+ this.cssClassName = "";
219
+ return;
220
+ }
221
+ if (typeof value === "object") {
222
+ this.cssClass = value;
223
+ return;
224
+ }
225
+ const trimmed = String(value).trim();
226
+ if (!trimmed) {
227
+ this.cssClass = {};
228
+ this.cssClassName = "";
229
+ return;
230
+ }
231
+ if (trimmed.startsWith("{") && trimmed.endsWith("}")) try {
232
+ this.cssClass = JSON.parse(trimmed);
233
+ return;
234
+ } catch {}
235
+ this.cssClassName = trimmed;
236
+ }
237
+ /** The live chart.js instance, or null before it mounts. */
238
+ get chart() {
239
+ return this._chart;
240
+ }
241
+ connectedCallback() {
242
+ super.connectedCallback();
243
+ this._subscribe();
244
+ if (!isServer) {
245
+ window.addEventListener("theme-changed", this._onThemeChanged);
246
+ this._watchMode();
247
+ }
248
+ }
249
+ disconnectedCallback() {
250
+ this._off?.();
251
+ this._off = void 0;
252
+ if (!isServer) {
253
+ window.removeEventListener("theme-changed", this._onThemeChanged);
254
+ this._modeObserver?.disconnect();
255
+ this._modeObserver = void 0;
256
+ this._modeQuery?.removeEventListener("change", this._onThemeChanged);
257
+ this._modeQuery = void 0;
258
+ }
259
+ this._destroyChart();
260
+ super.disconnectedCallback();
261
+ }
262
+ /**
263
+ * Dark mode is the same tokens flipped by the `.dark` class on `<html>` /
264
+ * `<body>` (or the OS, under `color-scheme: system`) — and nothing fires
265
+ * `theme-changed` for that: VitePress's appearance toggle and a consumer's
266
+ * own switch just swap the class. Watch the class and the media query and
267
+ * treat a flip exactly like a theme change.
268
+ */
269
+ _watchMode() {
270
+ if (typeof MutationObserver === "undefined") return;
271
+ let dark = document.documentElement.classList.contains("dark") || document.body?.classList.contains("dark");
272
+ this._modeObserver = new MutationObserver(() => {
273
+ const next = document.documentElement.classList.contains("dark") || document.body?.classList.contains("dark");
274
+ if (next === dark) return;
275
+ dark = next;
276
+ this._onThemeChanged();
277
+ });
278
+ this._modeObserver.observe(document.documentElement, {
279
+ attributes: true,
280
+ attributeFilter: ["class"]
281
+ });
282
+ if (document.body) this._modeObserver.observe(document.body, {
283
+ attributes: true,
284
+ attributeFilter: ["class"]
285
+ });
286
+ this._modeQuery = window.matchMedia?.("(prefers-color-scheme: dark)");
287
+ this._modeQuery?.addEventListener?.("change", this._onThemeChanged);
288
+ }
289
+ willUpdate(changed) {
290
+ if (changed.has("loadingError")) {
291
+ const v = this.loadingError;
292
+ this._appFailure = v == null || v === false || v === "" ? null : describeError(v === true ? void 0 : v);
293
+ }
294
+ super.willUpdate?.(changed);
295
+ if (changed.has("dataChart")) this._subscribe();
296
+ }
297
+ _subscribe() {
298
+ this._off?.();
299
+ detachEventHandlers(this);
300
+ this._off = this.dataChart?.subscribe(() => {
301
+ this._scheduleApplyProps();
302
+ this.requestUpdate();
303
+ });
304
+ if (!isServer) this.dataChart?._setColorResolver((c) => this._resolveColor(c));
305
+ this._scheduleApplyProps();
306
+ }
307
+ /**
308
+ * Drive the apply from `update()` as well as `_subscribe()` — every render
309
+ * reaches here, so a controller that arrives late (or a `setProps` between
310
+ * subscriptions) can't be missed. Same arrangement as
311
+ * `table-controller-core`, which documents why `_subscribe` alone is fragile.
312
+ */
313
+ update(changed) {
314
+ this._scheduleApplyProps();
315
+ super.update(changed);
316
+ }
317
+ /**
318
+ * Deferred + de-duplicated: the apply writes reactive props, and doing that
319
+ * inside the update cycle would trip Lit's change-in-update warning.
320
+ */
321
+ _scheduleApplyProps() {
322
+ if (isServer) return;
323
+ if (this._applyQueued) return;
324
+ if (typeof queueMicrotask !== "function") {
325
+ this._applyControllerProps();
326
+ return;
327
+ }
328
+ this._applyQueued = true;
329
+ queueMicrotask(() => {
330
+ this._applyQueued = false;
331
+ this._applyControllerProps();
332
+ });
333
+ }
334
+ /**
335
+ * Pull `controlMonoChart({ props })` onto this element, so the template needs
336
+ * nothing but the controller binding.
337
+ *
338
+ * The CONTROLLER WINS for keys it declares (matching `controlMonoTable` and
339
+ * `controlMonoForm`); keys it doesn't mention are left to whatever the
340
+ * template set. `applyProps` supplies the skip-undefined, read-only and
341
+ * equality guards. `?.props` is optional-called so a controller built before
342
+ * this option existed simply contributes nothing.
343
+ */
344
+ _applyControllerProps() {
345
+ applyProps(this, this.dataChart?.props?.());
346
+ }
347
+ /**
348
+ * Effective type. A preset's locked type wins (a `<mono-chart-pie>` is a pie),
349
+ * then an explicit element `type`, then the controller's, then `'bar'`.
350
+ */
351
+ get _type() {
352
+ return this._presetType ?? this.type ?? this.dataChart?.type ?? "bar";
353
+ }
354
+ /** Effective data: the element's raw `data` wins, else the controller's. */
355
+ get _data() {
356
+ return this.data ?? this.dataChart?.data() ?? {
357
+ labels: [],
358
+ datasets: []
359
+ };
360
+ }
361
+ get _loading() {
362
+ return !!this.dataChart?.loading;
363
+ }
364
+ /** The FIRST load (or a retry) is in flight — nothing to show yet, so a spinner. */
365
+ get _dsBusy() {
366
+ if (this.loading) return true;
367
+ const c = this.dataChart;
368
+ return !this.data && !!c && c.loading && !c.hasLoaded && !c.error;
369
+ }
370
+ /** The app's `loading-error`, else the controller's failed load (the peer-load `_error` is separate). */
371
+ get _dsError() {
372
+ if (this.loading) return null;
373
+ return this._appFailure ?? (this.data ? null : this.dataChart?.error ?? null);
374
+ }
375
+ /** Spinner over the first load; the failure + ↻ after one failed. */
376
+ _renderSourceState() {
377
+ const err = this._dsError;
378
+ if (err) return html`
379
+ <div class="mono-chart-state" mono-ds-state="error" role="alert">
380
+ <span class="mono-chart-state-text" title=${errorTitle(err)}>${errorText(err)}</span>
381
+ <button
382
+ type="button"
383
+ mono-ds-retry
384
+ aria-label=${this.retryLabel}
385
+ title=${this.retryLabel}
386
+ @click=${this._onRetry}
387
+ >
388
+ ${refreshIcon()}
389
+ </button>
390
+ </div>
391
+ `;
392
+ if (this._dsBusy) return html`
393
+ <div class="mono-chart-state" mono-ds-state="loading" role="status">
394
+ <span mono-ds-spinner>${spinnerIcon()}</span>
395
+ <span class="mono-chart-state-text">${this.loadingText}</span>
396
+ </div>
397
+ `;
398
+ return nothing;
399
+ }
400
+ get _empty() {
401
+ const d = this._data;
402
+ return !d.datasets?.length || d.datasets.every((s) => !s.data?.length);
403
+ }
404
+ /** Palette from the `colors` prop, as an array. */
405
+ /** The raw `colors` prop as a list, before name resolution. */
406
+ get _colorList() {
407
+ const c = this.colors;
408
+ if (!c) return null;
409
+ if (Array.isArray(c)) return c.filter(Boolean);
410
+ return String(c).split(",").map((s) => s.trim()).filter(Boolean);
411
+ }
412
+ /**
413
+ * The palette handed to Chart.js: the `colors` list if given, else the single
414
+ * `color` accent, else null (the controller keeps its own default).
415
+ * Mono color NAMES are resolved to real values here — see `_resolveColor`.
416
+ */
417
+ get _colors() {
418
+ const list = this._colorList ?? (this.color ? [this.color] : null);
419
+ if (!list?.length) return null;
420
+ return list.map((c) => this._resolveColor(c));
421
+ }
422
+ /**
423
+ * The element's own computed style scope.
424
+ *
425
+ * Read from the inner `.mono-chart` wrapper, not the host: in the shadow
426
+ * build the custom properties are declared inside the shadow root, so the
427
+ * host would return empty strings.
428
+ */
429
+ _styleScope() {
430
+ if (isServer) return null;
431
+ return this.renderRoot?.querySelector?.(".mono-chart") ?? this;
432
+ }
433
+ /**
434
+ * Turn a mono color NAME into the value the canvas needs.
435
+ *
436
+ * Chart.js paints onto a bitmap and never resolves `var()`, so `success` (or
437
+ * a literal `var(--x)`) would render as transparent. Names map to the
438
+ * component's `--_mono-chart-*` resolvers, which chain through the public
439
+ * `--mono-chart-*` overrides down to the Basecoat tokens — so a consumer
440
+ * who re-themes the app gets re-themed charts for free. Anything that isn't
441
+ * a known name (a hex, `rgb()`, `hsl()`) is passed through untouched.
442
+ */
443
+ _resolveColor(value) {
444
+ const name = value.trim();
445
+ if (!MONO_COLOR_NAMES.has(name)) return name;
446
+ const scope = this._styleScope();
447
+ if (!scope) return MONO_COLOR_FALLBACK[name] ?? name;
448
+ const prop = name.startsWith("chart-") ? `--_mono-chart-${name.slice(6)}` : `--_mono-chart-${name}`;
449
+ return getComputedStyle(scope).getPropertyValue(prop).trim() || MONO_COLOR_FALLBACK[name] || name;
450
+ }
451
+ /**
452
+ * The inks and type Chart.js paints the chrome with — read off the element's
453
+ * own box, where chart.css resolved them from the Basecoat tokens: legend
454
+ * and title in `--foreground`, ticks in `--muted-foreground`, the grid in
455
+ * `--border`, the tooltip as a popover, the page font at text-xs.
456
+ */
457
+ _themeColors() {
458
+ const fallback = {
459
+ text: "oklch(0.372 0.039 257.29)",
460
+ muted: "oklch(0.554 0.041 257.42)",
461
+ grid: "oklch(0.929 0.013 255.51)",
462
+ tooltipBg: "oklch(1 0 0)",
463
+ tooltipColor: "oklch(0.372 0.039 257.29)",
464
+ tooltipBorder: "oklch(0.929 0.013 255.51)",
465
+ fontFamily: "ui-sans-serif, system-ui, sans-serif",
466
+ fontSize: 12,
467
+ radius: 8,
468
+ barRadius: 8
469
+ };
470
+ const scope = this._styleScope();
471
+ if (!scope) return fallback;
472
+ const cs = getComputedStyle(scope);
473
+ const read = (name, fb) => cs.getPropertyValue(name).trim() || fb;
474
+ const px = (v, fb, min = 1) => {
475
+ const n = parseFloat(v);
476
+ return Number.isFinite(n) && n >= min ? n : fb;
477
+ };
478
+ return {
479
+ text: read("--_mono-chart-text", fallback.text),
480
+ muted: read("--_mono-chart-muted", fallback.muted),
481
+ grid: read("--_mono-chart-grid", fallback.grid),
482
+ tooltipBg: read("--_mono-chart-tooltip-bg", fallback.tooltipBg),
483
+ tooltipColor: read("--_mono-chart-tooltip-color", fallback.tooltipColor),
484
+ tooltipBorder: read("--_mono-chart-tooltip-border", fallback.tooltipBorder),
485
+ fontFamily: cs.fontFamily || fallback.fontFamily,
486
+ fontSize: px(cs.fontSize, fallback.fontSize),
487
+ radius: px(cs.borderTopLeftRadius, fallback.radius, 0),
488
+ barRadius: px(getComputedStyle(this.renderRoot?.querySelector?.(".mono-chart-canvas-wrap") ?? scope).borderTopLeftRadius, fallback.barRadius, 0)
489
+ };
490
+ }
491
+ /** Merge the element's presentational props with the consumer's raw options. */
492
+ _buildOptions() {
493
+ const theme = this._themeColors();
494
+ const legendOn = this.legend !== false && this.legend !== "false";
495
+ const legendPos = typeof this.legend === "string" && this.legend !== "true" ? this.legend : "top";
496
+ const scaled = this._type !== "pie" && this._type !== "doughnut" && this._type !== "polarArea";
497
+ const base = {
498
+ responsive: true,
499
+ maintainAspectRatio: !this.height,
500
+ aspectRatio: this.aspectRatio,
501
+ font: {
502
+ family: theme.fontFamily,
503
+ size: theme.fontSize
504
+ },
505
+ color: theme.text,
506
+ plugins: {
507
+ legend: {
508
+ display: legendOn,
509
+ position: legendPos,
510
+ labels: {
511
+ color: theme.text,
512
+ font: {
513
+ family: theme.fontFamily,
514
+ size: theme.fontSize
515
+ },
516
+ boxWidth: theme.fontSize,
517
+ boxHeight: theme.fontSize,
518
+ useBorderRadius: true,
519
+ borderRadius: Math.round(theme.fontSize / 4)
520
+ }
521
+ },
522
+ title: this.title ? {
523
+ display: true,
524
+ text: this.title,
525
+ color: theme.text,
526
+ font: {
527
+ family: theme.fontFamily,
528
+ size: theme.fontSize + 2,
529
+ weight: 500
530
+ }
531
+ } : { display: false },
532
+ tooltip: {
533
+ enabled: false,
534
+ external: this._externalTooltip,
535
+ backgroundColor: theme.tooltipBg,
536
+ titleColor: theme.tooltipColor,
537
+ bodyColor: theme.tooltipColor,
538
+ borderColor: theme.tooltipBorder,
539
+ borderWidth: 1,
540
+ cornerRadius: theme.radius,
541
+ padding: {
542
+ x: 12,
543
+ y: 6
544
+ },
545
+ titleFont: {
546
+ family: theme.fontFamily,
547
+ size: theme.fontSize,
548
+ weight: 500
549
+ },
550
+ bodyFont: {
551
+ family: theme.fontFamily,
552
+ size: theme.fontSize
553
+ },
554
+ boxPadding: 4,
555
+ usePointStyle: true
556
+ }
557
+ },
558
+ onClick: (_e, els) => {
559
+ const hit = els?.[0];
560
+ if (!hit) return;
561
+ this.dataChart?._emitPoint?.(hit.datasetIndex, hit.index);
562
+ }
563
+ };
564
+ if (scaled) {
565
+ base.elements = { bar: { borderRadius: theme.barRadius } };
566
+ base.interaction = {
567
+ mode: "index",
568
+ intersect: false
569
+ };
570
+ base.scales = {
571
+ x: {
572
+ stacked: this.stacked,
573
+ ticks: {
574
+ color: theme.muted,
575
+ font: {
576
+ family: theme.fontFamily,
577
+ size: theme.fontSize
578
+ }
579
+ },
580
+ grid: { color: theme.grid },
581
+ border: { color: theme.grid }
582
+ },
583
+ y: {
584
+ stacked: this.stacked,
585
+ ticks: {
586
+ color: theme.muted,
587
+ font: {
588
+ family: theme.fontFamily,
589
+ size: theme.fontSize
590
+ }
591
+ },
592
+ grid: { color: theme.grid },
593
+ border: { color: theme.grid }
594
+ }
595
+ };
596
+ }
597
+ return deepMerge(deepMerge(base, this.dataChart?.options() ?? {}), this.chartOptions ?? {});
598
+ }
599
+ async firstUpdated(changed) {
600
+ super.firstUpdated?.(changed);
601
+ if (isServer) return;
602
+ this.dataChart?._setColorResolver((c) => this._resolveColor(c));
603
+ const palette = this._colors;
604
+ if (palette?.length) this.dataChart?.setColors(palette);
605
+ this._syncTypeToController();
606
+ await this._createChart();
607
+ }
608
+ updated(changed) {
609
+ super.updated?.(changed);
610
+ if (isServer) return;
611
+ if (changed.has("colors") || changed.has("color")) {
612
+ const palette = this._colors;
613
+ if (palette?.length) this.dataChart?.setColors(palette);
614
+ }
615
+ this._syncTypeToController();
616
+ if (!this._chart) {
617
+ if (!this._error && !this._empty) this._createChart();
618
+ return;
619
+ }
620
+ if (MonoChartCoreClass._rebuildKeys.some((k) => changed.has(k))) {
621
+ this.rebuild();
622
+ return;
623
+ }
624
+ if (this._chart.config?.type !== this._type) {
625
+ this.rebuild();
626
+ return;
627
+ }
628
+ this._applyData();
629
+ }
630
+ /**
631
+ * Tell the controller which type actually won.
632
+ *
633
+ * The projection depends on it: pie-family charts colour every SLICE, bar
634
+ * and line colour each DATASET. A preset (`<mono-chart-pie>`) fixes its type
635
+ * on the element, so without this the controller would still think it was
636
+ * projecting for the default `bar` and every slice would come out the same
637
+ * colour. `setType` early-returns when unchanged, so this settles in one
638
+ * extra update rather than looping.
639
+ *
640
+ * NOTE: the type is controller state, so pointing a bar element and a pie
641
+ * element at ONE shared controller makes them fight — give each its own.
642
+ */
643
+ _syncTypeToController() {
644
+ const grid = this.dataChart;
645
+ if (grid && grid.type !== this._type) grid.setType(this._type);
646
+ }
647
+ async _createChart() {
648
+ if (isServer || this._chart) return;
649
+ if (!this._canvas) return;
650
+ const token = ++this._buildToken;
651
+ let Chart;
652
+ try {
653
+ Chart = await loadChartJs();
654
+ } catch (err) {
655
+ this._error = err?.message ?? String(err);
656
+ return;
657
+ }
658
+ if (token !== this._buildToken || !this.isConnected || !this._canvas) return;
659
+ try {
660
+ this._chart = new Chart(this._canvas, {
661
+ type: this._type,
662
+ data: this._cloneData(),
663
+ options: this._buildOptions()
664
+ });
665
+ this._error = "";
666
+ this.dataChart?._attachInstance(this._chart);
667
+ this._observeResize();
668
+ } catch (err) {
669
+ this._error = err?.message ?? String(err);
670
+ }
671
+ }
672
+ /**
673
+ * Hand chart.js its own copy. It mutates `data` in place (adding computed
674
+ * metadata), so sharing the controller's projected object would corrupt it.
675
+ */
676
+ _cloneData() {
677
+ const d = this._data;
678
+ return {
679
+ labels: [...d.labels ?? []],
680
+ datasets: (d.datasets ?? []).map((s) => ({
681
+ ...s,
682
+ data: [...s.data ?? []]
683
+ }))
684
+ };
685
+ }
686
+ _applyData() {
687
+ if (!this._chart) return;
688
+ const next = this._cloneData();
689
+ this._chart.data.labels = next.labels;
690
+ this._chart.data.datasets = next.datasets;
691
+ this._chart.update();
692
+ }
693
+ /** Destroy + recreate. Needed for `type` and structural option changes. */
694
+ rebuild() {
695
+ if (isServer) return;
696
+ this._destroyChart();
697
+ this._createChart();
698
+ }
699
+ _destroyChart() {
700
+ this._buildToken++;
701
+ this._ro?.disconnect();
702
+ this._ro = void 0;
703
+ try {
704
+ this._chart?.destroy();
705
+ } catch {}
706
+ this._chart = null;
707
+ this.dataChart?._attachInstance(null);
708
+ this._tooltipEl?.removeAttribute("data-open");
709
+ }
710
+ /**
711
+ * Chart.js `responsive` already listens for window resizes, but not for a
712
+ * container that changes size on its own (a sidebar opening, a flex reflow).
713
+ */
714
+ _observeResize() {
715
+ if (this._ro || typeof ResizeObserver === "undefined") return;
716
+ const wrap = this.renderRoot?.querySelector?.(".mono-chart-canvas-wrap");
717
+ if (!wrap) return;
718
+ this._ro = new ResizeObserver(() => this._chart?.resize());
719
+ this._ro.observe(wrap);
720
+ }
721
+ _cls(base, key) {
722
+ const extra = this.cssClass?.[key];
723
+ return extra ? `${base} ${extra}` : base;
724
+ }
725
+ get _rootClasses() {
726
+ return [
727
+ "mono-chart",
728
+ this._loading ? "loading" : "",
729
+ this.cssClassName,
730
+ this.cssClass?.root
731
+ ].filter(Boolean).join(" ");
732
+ }
733
+ _wrapStyle() {
734
+ const s = {};
735
+ const w = toCssSize(this.width);
736
+ const h = toCssSize(this.height);
737
+ if (w) s.width = w;
738
+ if (h) s.height = h;
739
+ return s;
740
+ }
741
+ renderChart() {
742
+ return html`
743
+ <div
744
+ class=${this._rootClasses}
745
+ ?mono-ds-loading=${this._dsBusy}
746
+ ?mono-ds-error=${!!this._dsError}
747
+ aria-busy=${this._dsBusy ? "true" : nothing}
748
+ >
749
+ ${this._error ? html`<div class=${this._cls("mono-chart-message error", "message")} role="alert">
750
+ ${this._error}
751
+ </div>` : nothing}
752
+ <div class="mono-chart-canvas-wrap" style=${styleMap(this._wrapStyle())}>
753
+ <canvas class=${this._cls("", "canvas")} role="img"></canvas>
754
+ <div class="mono-chart-tooltip" role="tooltip" aria-hidden="true"></div>
755
+ ${this._renderSourceState()}
756
+ </div>
757
+ </div>
758
+ `;
759
+ }
760
+ }
761
+ __decorate([property({ attribute: false })], MonoChartCoreClass.prototype, "dataChart", void 0);
762
+ __decorate([property({ type: String })], MonoChartCoreClass.prototype, "type", void 0);
763
+ __decorate([property({ attribute: false })], MonoChartCoreClass.prototype, "data", void 0);
764
+ __decorate([property({ attribute: false })], MonoChartCoreClass.prototype, "chartOptions", void 0);
765
+ __decorate([property({ type: String })], MonoChartCoreClass.prototype, "width", void 0);
766
+ __decorate([property({ type: String })], MonoChartCoreClass.prototype, "height", void 0);
767
+ __decorate([property({
768
+ attribute: "aspect-ratio",
769
+ converter: numberStringConverter
770
+ })], MonoChartCoreClass.prototype, "aspectRatio", void 0);
771
+ __decorate([property()], MonoChartCoreClass.prototype, "legend", void 0);
772
+ __decorate([property({ type: String })], MonoChartCoreClass.prototype, "title", void 0);
773
+ __decorate([property({ converter: booleanStringConverter })], MonoChartCoreClass.prototype, "stacked", void 0);
774
+ __decorate([property({ type: String })], MonoChartCoreClass.prototype, "color", void 0);
775
+ __decorate([property({ attribute: false })], MonoChartCoreClass.prototype, "colors", void 0);
776
+ __decorate([property({ attribute: false })], MonoChartCoreClass.prototype, "cssClass", void 0);
777
+ __decorate([property({ attribute: false })], MonoChartCoreClass.prototype, "cssClassName", void 0);
778
+ __decorate([property({
779
+ type: String,
780
+ attribute: "loading-text"
781
+ })], MonoChartCoreClass.prototype, "loadingText", void 0);
782
+ __decorate([property({
783
+ type: String,
784
+ attribute: "retry-label"
785
+ })], MonoChartCoreClass.prototype, "retryLabel", void 0);
786
+ __decorate([property({ converter: booleanStringConverter })], MonoChartCoreClass.prototype, "loading", void 0);
787
+ __decorate([property({ attribute: "loading-error" })], MonoChartCoreClass.prototype, "loadingError", void 0);
788
+ __decorate([state()], MonoChartCoreClass.prototype, "_error", void 0);
789
+ __decorate([query("canvas")], MonoChartCoreClass.prototype, "_canvas", void 0);
790
+ __decorate([query(".mono-chart-tooltip")], MonoChartCoreClass.prototype, "_tooltipEl", void 0);
791
+ return MonoChartCoreClass;
792
+ };
793
+ /** Shallow-recursive merge; arrays and non-plain values are replaced wholesale. */
794
+ function deepMerge(base, over) {
795
+ const out = { ...base };
796
+ for (const [k, v] of Object.entries(over)) {
797
+ const prev = out[k];
798
+ if (v && typeof v === "object" && !Array.isArray(v) && prev && typeof prev === "object" && !Array.isArray(prev)) out[k] = deepMerge(prev, v);
799
+ else out[k] = v;
800
+ }
801
+ return out;
802
+ }
803
+ //#endregion
804
+ //#region src/components/chart/chart.css?raw
805
+ var chart_default = "/* ============================================================================\r\n mono-chart — a Chart.js canvas driven by `monoChart(...)` (or a raw chart.js\r\n `data` object). The library is an OPTIONAL peer, loaded on demand; until it\r\n resolves the element renders an empty, correctly-sized box so nothing jumps.\r\n\r\n NOT attribute-styled, on purpose: the chart is a bitmap. This sheet declares\r\n the palette and the inks as custom properties over the Basecoat tokens, and\r\n the ELEMENT reads them back at mount (`_resolveColor`, `_themeColors`) and\r\n hands Chart.js real values — a canvas cannot resolve `var()`. The two boxes\r\n this sheet does paint (the message, the loading veil) keep their classes.\r\n\r\n Tokens (ours → Basecoat):\r\n --_mono-chart-1 … -5 ≡ --chart-1 … --chart-5 (the default palette, in that order)\r\n --_mono-chart-primary ≡ --primary\r\n --_mono-chart-secondary ≡ --muted-foreground (the \"secondary\" ink every field uses)\r\n --_mono-chart-accent ≡ --chart-2 (Basecoat's --accent is a surface, not a series colour)\r\n --_mono-chart-success/warning/danger/info ≡ --success / --warning / --destructive / --info\r\n --_mono-chart-text ≡ --foreground (legend, title)\r\n --_mono-chart-muted ≡ --muted-foreground (axis ticks, the empty message)\r\n --_mono-chart-grid ≡ --border\r\n --_mono-chart-surface ≡ --background (the hairline between slices)\r\n --_mono-chart-tooltip-* ≡ the select panel's popover: --mono-select-dropdown-{bg,color,radius,ring,shadow} → --popover … (the tooltip IS an element, painted here)\r\n --_mono-chart-font ≡ text-xs, in the page font (inherited)\r\n --_mono-chart-radius ≡ --mono-radius-md (tooltip corner, message box)\r\n --_mono-chart-bar-radius ≡ the field's corner chain (--mono-input-outline-radius → --mono-input-radius → --mono-radius-md)\r\n\r\n Every `--mono-chart-<k>` is a public override; the flavours carry nothing —\r\n the tokens they retune (border, foreground, popover, chart-n) reach the chart\r\n through these chains. Dark mode is the same tokens flipped; the element\r\n watches the mode class and repaints.\r\n ============================================================================ */\r\n\r\nmono-chart,\r\nmono-chart-bar,\r\nmono-chart-line,\r\nmono-chart-pie,\r\nmono-chart-doughnut {\r\n display: block;\r\n width: 100%;\r\n}\r\n\r\nmono-chart *,\r\nmono-chart-bar *,\r\nmono-chart-line *,\r\nmono-chart-pie *,\r\nmono-chart-doughnut * {\r\n box-sizing: border-box;\r\n}\r\n\r\n.mono-chart {\r\n position: relative;\r\n width: 100%;\r\n color: var(--_mono-chart-text);\r\n /* the canvas inherits nothing; the element READS these two off this box */\r\n font-family: var(--_mono-chart-font-family);\r\n font-size: var(--_mono-chart-font);\r\n\r\n /* Public customization API → private resolvers. The ELEMENT also reads these\r\n at mount time and hands the resolved colors to Chart.js: canvas painting\r\n can't resolve `var()`, so the palette has to cross into JS as real values. */\r\n --_mono-chart-1: var(--mono-chart-1, var(--chart-1));\r\n --_mono-chart-2: var(--mono-chart-2, var(--chart-2));\r\n --_mono-chart-3: var(--mono-chart-3, var(--chart-3));\r\n --_mono-chart-4: var(--mono-chart-4, var(--chart-4));\r\n --_mono-chart-5: var(--mono-chart-5, var(--chart-5));\r\n\r\n --_mono-chart-primary: var(--mono-chart-primary, var(--primary));\r\n --_mono-chart-secondary: var(--mono-chart-secondary, var(--muted-foreground));\r\n --_mono-chart-accent: var(--mono-chart-accent, var(--chart-2));\r\n --_mono-chart-success: var(--mono-chart-success, var(--success));\r\n --_mono-chart-warning: var(--mono-chart-warning, var(--warning));\r\n --_mono-chart-danger: var(--mono-chart-danger, var(--destructive));\r\n --_mono-chart-info: var(--mono-chart-info, var(--info));\r\n\r\n --_mono-chart-text: var(--mono-chart-text, var(--foreground));\r\n --_mono-chart-muted: var(--mono-chart-muted, var(--muted-foreground));\r\n --_mono-chart-grid: var(--mono-chart-grid, var(--border));\r\n --_mono-chart-surface: var(--mono-chart-surface, var(--background));\r\n\r\n /* basecoat@1.0.2 styles/vega.css .combobox [data-popover] — bg-popover text-popover-foreground ring-foreground/10 rounded-md shadow-md ring-1\r\n (a tooltip is a popover: the same chrome, at text-xs). It is the FLAVOUR's\r\n popover: the corner, ring and shadow read the select panel's public knobs,\r\n which every flavour writes (luma 3xl + shadow-lg, lyra 0, maia 2xl …). */\r\n --_mono-chart-tooltip-bg: var(--mono-chart-tooltip-bg, var(--mono-select-dropdown-bg, var(--popover)));\r\n --_mono-chart-tooltip-color: var(--mono-chart-tooltip-color, var(--mono-select-dropdown-color, var(--popover-foreground)));\r\n --_mono-chart-tooltip-border: var(--mono-chart-tooltip-border, var(--border));\r\n --_mono-chart-tooltip-radius: var(--mono-chart-tooltip-radius, var(--mono-select-dropdown-radius, var(--mono-radius-md)));\r\n --_mono-chart-tooltip-ring: var(--mono-chart-tooltip-ring, var(--mono-select-dropdown-ring, 0 0 0 1px color-mix(in oklab, var(--foreground) 10%, transparent)));\r\n --_mono-chart-tooltip-shadow: var(--mono-chart-tooltip-shadow, var(--mono-select-dropdown-shadow, var(--mono-shadow-md)));\r\n\r\n --_mono-chart-font: var(--mono-chart-font, var(--mono-text-xs));\r\n /* INHERIT, not --font-sans: every other mono control inherits the page font\r\n for its labels, and a chart sits among them */\r\n --_mono-chart-font-family: var(--mono-chart-font-family, inherit);\r\n --_mono-chart-radius: var(--mono-chart-radius, var(--mono-radius-md));\r\n /* The bars' corner IS the flavour's field corner — lyra squares a field through\r\n `--mono-input-radius`, sera through `--mono-input-outline-radius`, maia and\r\n luma pill it through the same knob — so bars are square where the fields are\r\n and round where they are, with nothing set. Chart.js clamps it to half a bar. */\r\n --_mono-chart-bar-radius: var(--mono-chart-bar-radius, var(--mono-input-outline-radius, var(--mono-input-radius, var(--mono-radius-md))));\r\n\r\n /* Chart.js wants PIXELS and a custom property's computed value is still the\r\n token string (`calc(…)`, `2rem`), so the two radii are painted onto real,\r\n invisible border-radius properties here and read back computed. */\r\n border-radius: var(--_mono-chart-radius);\r\n}\r\n\r\n/* The canvas box. Chart.js sets the canvas' intrinsic width/height itself; this\r\n wrapper owns the LAYOUT size so `responsive: true` has something to measure. */\r\n.mono-chart-canvas-wrap {\r\n position: relative;\r\n width: 100%;\r\n /* the bar corner, in px — see the root */\r\n border-radius: var(--_mono-chart-bar-radius);\r\n}\r\n\r\n.mono-chart canvas {\r\n display: block;\r\n width: 100%;\r\n max-width: 100%;\r\n}\r\n\r\n/* The tooltip — an HTML popover placed over the canvas by the element\r\n (Chart.js's `tooltip.external`), not the bitmap one: a canvas can take a\r\n colour and a corner, not the flavour's ring and shadow. Positioned from the\r\n caret; `data-side` says which way it opened. */\r\n.mono-chart-tooltip {\r\n position: absolute;\r\n left: 0;\r\n top: 0;\r\n z-index: 2;\r\n display: none;\r\n flex-direction: column;\r\n gap: calc(var(--mono-spacing) * 0.5);\r\n /* basecoat@1.0.2 styles/vega.css .combobox [data-popover] — bg-popover text-popover-foreground ring-foreground/10 rounded-md shadow-md ring-1; px-3 py-1.5 text-xs */\r\n padding: calc(var(--mono-spacing) * 1.5) calc(var(--mono-spacing) * 3);\r\n border-radius: var(--_mono-chart-tooltip-radius);\r\n background: var(--_mono-chart-tooltip-bg);\r\n color: var(--_mono-chart-tooltip-color);\r\n box-shadow: var(--_mono-chart-tooltip-ring), var(--_mono-chart-tooltip-shadow);\r\n font-size: var(--_mono-chart-font);\r\n line-height: var(--mono-text-xs--lh);\r\n white-space: nowrap;\r\n pointer-events: none;\r\n transform: translate(-50%, calc(-100% - calc(var(--mono-spacing) * 2)));\r\n opacity: 0;\r\n transition: opacity var(--mono-duration-fast, 100ms) var(--mono-ease);\r\n}\r\n\r\n.mono-chart-tooltip[data-open] {\r\n display: flex;\r\n opacity: 1;\r\n}\r\n\r\n/* no room above the point: open below it */\r\n.mono-chart-tooltip[data-side='bottom'] {\r\n transform: translate(-50%, calc(var(--mono-spacing) * 2));\r\n}\r\n\r\n.mono-chart-tooltip-title {\r\n font-weight: var(--mono-font-weight-medium);\r\n}\r\n\r\n.mono-chart-tooltip-row {\r\n display: flex;\r\n align-items: center;\r\n gap: calc(var(--mono-spacing) * 2);\r\n}\r\n\r\n/* the series swatch — a rounded chip, like the legend's */\r\n.mono-chart-tooltip-swatch {\r\n flex: 0 0 auto;\r\n width: calc(var(--mono-spacing) * 2.5);\r\n height: calc(var(--mono-spacing) * 2.5);\r\n border-radius: var(--mono-radius-sm);\r\n}\r\n\r\n.mono-chart-tooltip-value {\r\n margin-inline-start: auto;\r\n font-variant-numeric: tabular-nums;\r\n padding-inline-start: calc(var(--mono-spacing) * 3);\r\n}\r\n\r\n@media (prefers-reduced-motion: reduce) {\r\n .mono-chart-tooltip {\r\n transition: none;\r\n }\r\n}\r\n\r\n/* Shown while the optional peer loads, when there is no data, or on error —\r\n basecoat's empty-state idiom: a dashed hairline, muted text. */\r\n.mono-chart-message {\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n min-height: 6rem;\r\n padding: calc(var(--mono-spacing) * 4);\r\n font-size: var(--mono-text-sm);\r\n line-height: var(--mono-text-sm--lh);\r\n color: var(--_mono-chart-muted);\r\n text-align: center;\r\n border: var(--mono-border-width) dashed var(--_mono-chart-grid);\r\n border-radius: var(--_mono-chart-radius);\r\n}\r\n\r\n.mono-chart-message.error {\r\n color: var(--_mono-chart-danger);\r\n border-color: color-mix(in oklab, var(--_mono-chart-danger) 45%, var(--_mono-chart-grid));\r\n}\r\n\r\n/* Loading veil — the canvas stays mounted so Chart.js keeps its size. The\r\n source-state overlay is exempt: the spinner must not fade with the chart. */\r\n.mono-chart.loading .mono-chart-canvas-wrap > :not(.mono-chart-state) {\r\n opacity: 0.55;\r\n transition: opacity var(--mono-duration) var(--mono-ease);\r\n}\r\n\r\n/* EXTENSION — dataSource state: the first load shows a spinner over the\r\n (still sized) canvas; a failed load shows the error and a ↻, and outlines the\r\n plot in the invalid colour — the same signal a failed field gives. */\r\n.mono-chart-state {\r\n position: absolute;\r\n inset: 0;\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n gap: calc(var(--mono-spacing) * 2);\r\n padding: calc(var(--mono-spacing) * 4);\r\n font-size: var(--mono-text-sm);\r\n line-height: var(--mono-text-sm--lh);\r\n color: var(--_mono-chart-muted);\r\n text-align: center;\r\n}\r\n\r\n.mono-chart[mono-ds-error] .mono-chart-state {\r\n color: var(--mono-chart-ds-error-text, var(--_mono-chart-danger));\r\n}\r\n\r\n.mono-chart[mono-ds-error] .mono-chart-canvas-wrap {\r\n outline: var(--mono-border-width, 1px) solid var(--mono-chart-ds-error-border, var(--mono-mode-invalid-border));\r\n box-shadow: 0 0 0 3px var(--mono-chart-ds-error-ring, var(--mono-mode-invalid-ring));\r\n}\r\n\r\n.mono-chart[mono-ds-loading] .mono-chart-canvas-wrap {\r\n cursor: progress;\r\n}\r\n\r\n.mono-chart-state-text {\r\n min-width: 0;\r\n overflow: hidden;\r\n text-overflow: ellipsis;\r\n}\r\n\r\n.mono-chart-state [mono-ds-spinner],\r\n.mono-chart-state [mono-ds-retry] {\r\n display: inline-flex;\r\n align-items: center;\r\n justify-content: center;\r\n flex-shrink: 0;\r\n width: 1.5rem;\r\n height: 1.5rem;\r\n margin: 0;\r\n padding: 0;\r\n border: 0;\r\n border-radius: calc(var(--radius) - 5px);\r\n background: transparent;\r\n color: inherit;\r\n font: inherit;\r\n}\r\n\r\n.mono-chart-state [mono-ds-retry] {\r\n cursor: pointer;\r\n}\r\n\r\n@media (hover: hover) {\r\n .mono-chart-state [mono-ds-retry]:hover {\r\n background: var(--mono-mode-ghost-hover);\r\n }\r\n}\r\n\r\n.mono-chart-state [mono-ds-retry]:focus-visible {\r\n outline: 2px solid currentColor;\r\n outline-offset: 1px;\r\n}\r\n\r\n.mono-chart-state :is([mono-ds-spinner], [mono-ds-retry]) > svg {\r\n display: block;\r\n width: 1rem;\r\n height: 1rem;\r\n}\r\n\r\n.mono-chart-state [mono-ds-spinner] > svg {\r\n animation: mono-chart-spin 0.7s linear infinite;\r\n}\r\n\r\n@keyframes mono-chart-spin {\r\n to {\r\n transform: rotate(360deg);\r\n }\r\n}\r\n\r\n@media (prefers-reduced-motion: reduce) {\r\n .mono-chart.loading .mono-chart-canvas-wrap > :not(.mono-chart-state) {\r\n transition: none;\r\n }\r\n\r\n .mono-chart-state [mono-ds-spinner] > svg {\r\n animation-duration: 2.4s;\r\n }\r\n}\r\n";
806
+ //#endregion
807
+ //#region src/components/chart/mono-chart.shadow.ts
808
+ var SHADOW_CHART_CSS$1 = toShadowCss(chart_default, { host: "mono-chart" });
809
+ var MonoChartShadow = class MonoChartShadow extends withShadowUtilityStyles(MonoChartCore(LitElement)) {
810
+ static {
811
+ this.disableWarning?.("change-in-update");
812
+ }
813
+ static {
814
+ this.styles = [unsafeCSS(SHADOW_CHART_CSS$1)];
815
+ }
816
+ connectedCallback() {
817
+ super.connectedCallback();
818
+ if (isServer) return;
819
+ flushSsrHydration(this);
820
+ }
821
+ render() {
822
+ return this.renderChart();
823
+ }
824
+ };
825
+ MonoChartShadow = __decorate([customElement("mono-shadow-chart")], MonoChartShadow);
826
+ //#endregion
827
+ //#region src/components/chart/mono-chart-presets.shadow.ts
828
+ var SHADOW_CHART_CSS = toShadowCss(chart_default, { host: "mono-chart" });
829
+ var MonoChartBarShadow = class MonoChartBarShadow extends withShadowUtilityStyles(MonoChartCore(LitElement)) {
830
+ constructor(..._args) {
831
+ super(..._args);
832
+ this._presetType = "bar";
833
+ }
834
+ static {
835
+ this.disableWarning?.("change-in-update");
836
+ }
837
+ static {
838
+ this.styles = [unsafeCSS(SHADOW_CHART_CSS)];
839
+ }
840
+ connectedCallback() {
841
+ super.connectedCallback();
842
+ if (isServer) return;
843
+ flushSsrHydration(this);
844
+ }
845
+ render() {
846
+ return this.renderChart();
847
+ }
848
+ };
849
+ MonoChartBarShadow = __decorate([customElement("mono-shadow-chart-bar")], MonoChartBarShadow);
850
+ var MonoChartLineShadow = class MonoChartLineShadow extends withShadowUtilityStyles(MonoChartCore(LitElement)) {
851
+ constructor(..._args2) {
852
+ super(..._args2);
853
+ this._presetType = "line";
854
+ }
855
+ static {
856
+ this.disableWarning?.("change-in-update");
857
+ }
858
+ static {
859
+ this.styles = [unsafeCSS(SHADOW_CHART_CSS)];
860
+ }
861
+ connectedCallback() {
862
+ super.connectedCallback();
863
+ if (isServer) return;
864
+ flushSsrHydration(this);
865
+ }
866
+ render() {
867
+ return this.renderChart();
868
+ }
869
+ };
870
+ MonoChartLineShadow = __decorate([customElement("mono-shadow-chart-line")], MonoChartLineShadow);
871
+ var MonoChartPieShadow = class MonoChartPieShadow extends withShadowUtilityStyles(MonoChartCore(LitElement)) {
872
+ constructor(..._args3) {
873
+ super(..._args3);
874
+ this._presetType = "pie";
875
+ }
876
+ static {
877
+ this.disableWarning?.("change-in-update");
878
+ }
879
+ static {
880
+ this.styles = [unsafeCSS(SHADOW_CHART_CSS)];
881
+ }
882
+ connectedCallback() {
883
+ super.connectedCallback();
884
+ if (isServer) return;
885
+ flushSsrHydration(this);
886
+ }
887
+ render() {
888
+ return this.renderChart();
889
+ }
890
+ };
891
+ MonoChartPieShadow = __decorate([customElement("mono-shadow-chart-pie")], MonoChartPieShadow);
892
+ var MonoChartDoughnutShadow = class MonoChartDoughnutShadow extends withShadowUtilityStyles(MonoChartCore(LitElement)) {
893
+ constructor(..._args4) {
894
+ super(..._args4);
895
+ this._presetType = "doughnut";
896
+ }
897
+ static {
898
+ this.disableWarning?.("change-in-update");
899
+ }
900
+ static {
901
+ this.styles = [unsafeCSS(SHADOW_CHART_CSS)];
902
+ }
903
+ connectedCallback() {
904
+ super.connectedCallback();
905
+ if (isServer) return;
906
+ flushSsrHydration(this);
907
+ }
908
+ render() {
909
+ return this.renderChart();
910
+ }
911
+ };
912
+ MonoChartDoughnutShadow = __decorate([customElement("mono-shadow-chart-doughnut")], MonoChartDoughnutShadow);
913
+ //#endregion
914
+ //#region src/components/chart/chart-odata.ts
915
+ /**
916
+ * `MonoChartAgg` → the OData aggregate keyword. Every value the chart supports has
917
+ * an exact equivalent, so the server path never has to fall back to draining.
918
+ */
919
+ var ODATA_AGG = {
920
+ sum: "sum",
921
+ avg: "average",
922
+ min: "min",
923
+ max: "max",
924
+ count: "$count"
925
+ };
926
+ /** A dotted path (`Job.Budget`) addresses a nav property as `Job/Budget` in OData. */
927
+ var toODataPath = (field) => field.replaceAll(".", "/");
928
+ /**
929
+ * Build `groupby((<groupBy>),aggregate(<field> with <agg> as <field>, …))`.
930
+ *
931
+ * Each aggregate is aliased back to **its own series field**, which is what lets
932
+ * the result flow through the chart's existing projection untouched: one row per
933
+ * bucket, and re-aggregating a single value is the identity. No special-casing
934
+ * downstream, and a client-side roll-up and a server-side one render identically.
935
+ *
936
+ * `count` has no operand, so it emits `$count as <field>`.
937
+ */
938
+ function buildChartApply(groupBy, series = []) {
939
+ const key = toODataPath(groupBy);
940
+ const aggregates = series.filter((s) => s?.field).map((s) => {
941
+ const agg = ODATA_AGG[s.agg ?? "sum"] ?? "sum";
942
+ return agg === "$count" ? `$count as ${s.field}` : `${toODataPath(s.field)} with ${agg} as ${s.field}`;
943
+ });
944
+ return aggregates.length ? `groupby((${key}),aggregate(${aggregates.join(",")}))` : `groupby((${key}))`;
945
+ }
946
+ /**
947
+ * Compose a filter with a groupby: `filter(<expr>)/groupby(…)`.
948
+ *
949
+ * Filtering INSIDE `$apply` (rather than as a sibling `$filter`) is what keeps the
950
+ * two composable — the filter runs first and the aggregation sees only matching
951
+ * rows, which is the whole point of doing this server-side.
952
+ */
953
+ function composeApply(apply, filter) {
954
+ const expr = arrayToODataString(filter);
955
+ return expr ? `filter(${expr})/${apply}` : apply;
956
+ }
957
+ /**
958
+ * Compose the request an `odata` chart sends — pure, so the merge of
959
+ * `odata.options` with the controller's base (`dataSourceOptions` /
960
+ * `odataOptions`) and the `$apply` folding can be asserted without a network.
961
+ *
962
+ * The base's `filter` is AND-ed under `odata.options.filter`; its `select` /
963
+ * `expand` / `sort` / `paginate` become load options; its `customQueryParams`
964
+ * become raw params beside `$apply`. On the `$apply` path the composed filter
965
+ * travels INSIDE the clause (that is what keeps it composable with the grouping)
966
+ * and is removed from the load options so it is not also sent as a sibling
967
+ * `$filter`; `paginate` is forced off so every bucket comes back.
968
+ */
969
+ function buildChartOdataRequest(input) {
970
+ const base = input.base ?? {};
971
+ const { customQueryParams, ...rest } = mergeDataSourceOptions(input.options ?? {}, base);
972
+ const options = { ...rest };
973
+ const params = { ...customQueryParams ?? {} };
974
+ if (typeof input.aggregate === "function") {
975
+ const groupBy = input.groupBy;
976
+ if (!groupBy) throw new Error("[mono-chart] `odata.aggregate` needs a `groupBy` — there is nothing to group by.");
977
+ const apply = buildChartApply(groupBy, input.series);
978
+ const filter = options.filter;
979
+ params.$apply = input.aggregate({
980
+ apply,
981
+ filter,
982
+ odataFilter: arrayToODataString,
983
+ withFilter: (a, f) => composeApply(a, f === void 0 ? filter : f),
984
+ groupBy,
985
+ series: [...input.series]
986
+ });
987
+ delete options.filter;
988
+ options.paginate = false;
989
+ }
990
+ return {
991
+ options,
992
+ params,
993
+ aggregated: params.$apply !== void 0
994
+ };
995
+ }
996
+ //#endregion
997
+ //#region src/components/chart/mono-data-chart.ts
998
+ /**
999
+ * Default palette, expressed as mono color NAMES rather than literals so a chart
1000
+ * follows the active theme out of the box — exactly like every other component.
1001
+ * These are Basecoat's own chart colours: the element resolves each name through
1002
+ * `--_mono-chart-<name>` → `--mono-chart-*` → `--chart-1` … `--chart-5` at paint
1003
+ * time, so a colour preset, a flavour or dark mode recolours charts too. Past
1004
+ * five series the roles follow, so a sixth dataset is still its own colour.
1005
+ */
1006
+ var DEFAULT_COLORS = [
1007
+ "chart-1",
1008
+ "chart-2",
1009
+ "chart-3",
1010
+ "chart-4",
1011
+ "chart-5",
1012
+ "success",
1013
+ "warning",
1014
+ "danger"
1015
+ ];
1016
+ /**
1017
+ * Values used when nobody has resolved a name yet — a controller used headlessly
1018
+ * (reading `data()` in Node), or before an element mounts. ONE's light tokens,
1019
+ * so the shape is right even without a DOM.
1020
+ */
1021
+ var NAME_FALLBACK = {
1022
+ "chart-1": "oklch(0.859 0.069 267.7)",
1023
+ "chart-2": "oklch(0.735 0.12 268.04)",
1024
+ "chart-3": "oklch(0.61 0.12 267.95)",
1025
+ "chart-4": "oklch(0.485 0.119 267.92)",
1026
+ "chart-5": "oklch(0.36 0.12 268.21)",
1027
+ primary: "oklch(0.299 0.119 267.96)",
1028
+ secondary: "oklch(0.554 0.041 257.42)",
1029
+ accent: "oklch(0.735 0.12 268.04)",
1030
+ success: "oklch(0.5239 0.0917 180.004)",
1031
+ warning: "oklch(0.5423 0.1066 70.504)",
1032
+ danger: "oklch(0.561 0.202 26.71)",
1033
+ info: "oklch(0.431 0.163 267.72)",
1034
+ surface: "oklch(0.973 0.007 268.55)"
1035
+ };
1036
+ /** Read a row field, honouring path expressions (`Job.Name`, `Items.[*].Total`). */
1037
+ function fieldValue(row, field) {
1038
+ if (row == null) return void 0;
1039
+ if (!isPath(field)) return row[field];
1040
+ const v = getFieldValue(row, field);
1041
+ return Array.isArray(v) ? v[0] : v;
1042
+ }
1043
+ /** Coerce to a finite number, or null when the value isn't numeric. */
1044
+ function num(value) {
1045
+ if (value == null || value === "") return null;
1046
+ const n = typeof value === "number" ? value : Number(value);
1047
+ return Number.isFinite(n) ? n : null;
1048
+ }
1049
+ /** Apply an aggregate to a bucket of raw values. */
1050
+ function aggregate(values, agg) {
1051
+ if (agg === "count") return values.length;
1052
+ const nums = values.map(num).filter((n) => n != null);
1053
+ if (!nums.length) return agg === "sum" ? 0 : null;
1054
+ switch (agg) {
1055
+ case "sum": return nums.reduce((a, b) => a + b, 0);
1056
+ case "avg": return nums.reduce((a, b) => a + b, 0) / nums.length;
1057
+ case "min": return Math.min(...nums);
1058
+ case "max": return Math.max(...nums);
1059
+ default: return null;
1060
+ }
1061
+ }
1062
+ /** Parse `#rgb` / `#rrggbb` / `rgb(r,g,b)` to channels; null if unrecognised. */
1063
+ function toRgb(color) {
1064
+ const s = color.trim();
1065
+ const hex = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(s);
1066
+ if (hex) {
1067
+ const h = hex[1].length === 3 ? hex[1].replace(/./g, (c) => c + c) : hex[1];
1068
+ const n = parseInt(h, 16);
1069
+ return [
1070
+ n >> 16 & 255,
1071
+ n >> 8 & 255,
1072
+ n & 255
1073
+ ];
1074
+ }
1075
+ const rgb = /^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)/i.exec(s);
1076
+ if (rgb) return [
1077
+ Number(rgb[1]),
1078
+ Number(rgb[2]),
1079
+ Number(rgb[3])
1080
+ ];
1081
+ return null;
1082
+ }
1083
+ /** Shift a color's lightness by `delta` (-1…1), preserving hue and saturation. */
1084
+ function shiftLightness(color, delta) {
1085
+ const rgb = toRgb(color);
1086
+ if (!rgb) return color;
1087
+ const [r, g, b] = rgb.map((v) => v / 255);
1088
+ const max = Math.max(r, g, b);
1089
+ const min = Math.min(r, g, b);
1090
+ const l = (max + min) / 2;
1091
+ const d = max - min;
1092
+ const s = d === 0 ? 0 : d / (1 - Math.abs(2 * l - 1));
1093
+ let h = 0;
1094
+ if (d !== 0) {
1095
+ if (max === r) h = (g - b) / d % 6;
1096
+ else if (max === g) h = (b - r) / d + 2;
1097
+ else h = (r - g) / d + 4;
1098
+ h *= 60;
1099
+ if (h < 0) h += 360;
1100
+ }
1101
+ const nl = Math.min(.92, Math.max(.08, l + delta));
1102
+ const c = (1 - Math.abs(2 * nl - 1)) * s;
1103
+ const x = c * (1 - Math.abs(h / 60 % 2 - 1));
1104
+ const m = nl - c / 2;
1105
+ const [r1, g1, b1] = h < 60 ? [
1106
+ c,
1107
+ x,
1108
+ 0
1109
+ ] : h < 120 ? [
1110
+ x,
1111
+ c,
1112
+ 0
1113
+ ] : h < 180 ? [
1114
+ 0,
1115
+ c,
1116
+ x
1117
+ ] : h < 240 ? [
1118
+ 0,
1119
+ x,
1120
+ c
1121
+ ] : h < 300 ? [
1122
+ x,
1123
+ 0,
1124
+ c
1125
+ ] : [
1126
+ c,
1127
+ 0,
1128
+ x
1129
+ ];
1130
+ const out = [
1131
+ r1,
1132
+ g1,
1133
+ b1
1134
+ ].map((v) => Math.round((v + m) * 255));
1135
+ return `rgb(${out[0]}, ${out[1]}, ${out[2]})`;
1136
+ }
1137
+ /**
1138
+ * Make every entry visually distinct.
1139
+ *
1140
+ * A token set may ALIAS roles — in ONE, `--success` and `--teal` are the same
1141
+ * colour, and a consumer's own preset can fold two more. That's fine for UI (a chip is either "info" or
1142
+ * "secondary"), but a chart drawing two series in the same colour is unreadable.
1143
+ * On a collision, step the lightness until the colour is unused.
1144
+ *
1145
+ * Only applied to the DEFAULT palette — an explicit `colors` list is honoured
1146
+ * exactly as written, duplicates included.
1147
+ */
1148
+ function distinctColors(list) {
1149
+ const seen = /* @__PURE__ */ new Set();
1150
+ return list.map((color) => {
1151
+ let candidate = color;
1152
+ for (let i = 1; seen.has(candidate.toLowerCase()) && i <= 6; i++) candidate = shiftLightness(color, (i % 2 ? 1 : -1) * .14 * Math.ceil(i / 2));
1153
+ seen.add(candidate.toLowerCase());
1154
+ return candidate;
1155
+ });
1156
+ }
1157
+ /** True for a raw chart.js `data` object (as opposed to a row array / DataSource). */
1158
+ function isRawData(value) {
1159
+ return !!value && typeof value === "object" && !Array.isArray(value) && Array.isArray(value.datasets);
1160
+ }
1161
+ /** Types that colour each POINT rather than each dataset. */
1162
+ function isPerPointType(type) {
1163
+ return type === "pie" || type === "doughnut" || type === "polarArea";
1164
+ }
1165
+ function monoChart(source = null, opts = {}) {
1166
+ let bound = null;
1167
+ let raw = null;
1168
+ let rows = [];
1169
+ /** Rows per label index, so a click can report what produced the point. */
1170
+ let buckets = [];
1171
+ let projected = {
1172
+ labels: [],
1173
+ datasets: []
1174
+ };
1175
+ let instance = null;
1176
+ /**
1177
+ * How many drains are in flight. A COUNTER, not a flag: `bind()` starts one
1178
+ * sync and a following `reload()` starts another, so two drains overlap — with
1179
+ * a boolean the first one to finish cleared it and the chart reported "done"
1180
+ * while the second was still fetching chunks.
1181
+ *
1182
+ * Also guards the re-entrant `changed` echo while a drain is running.
1183
+ */
1184
+ let drainDepth = 0;
1185
+ /**
1186
+ * Whether `rows` came back already rolled up by the server (`odata.aggregate`).
1187
+ * Read by `project()`, which must not re-apply each series' `agg` to a bucket
1188
+ * that is already a single aggregated row.
1189
+ */
1190
+ let preAggregated = false;
1191
+ /**
1192
+ * The `$apply`-through-the-store switch for a bound source: off by option
1193
+ * (`serverApply: false`), or off for good once the backend rejected one.
1194
+ */
1195
+ const applyGate = createApplyGate(opts.serverApply !== false);
1196
+ let series = opts.series ? [...opts.series] : [];
1197
+ let colors = opts.colors?.length ? [...opts.colors] : [...DEFAULT_COLORS];
1198
+ /** Only the DEFAULT palette gets de-duplicated; an explicit list is honoured as written. */
1199
+ let paletteIsDefault = !opts.colors?.length;
1200
+ /**
1201
+ * Turns a mono color NAME into a real value. Falls back to the static token
1202
+ * values until an element installs the DOM-aware version — the controller has
1203
+ * no DOM, and only the element can read the `--_mono-chart-*` tokens (which is
1204
+ * also what makes the palette follow a live theme change).
1205
+ */
1206
+ let resolveColor = (c) => NAME_FALLBACK[c] ?? c;
1207
+ const notifier = createNotifier();
1208
+ const notify = notifier.notify;
1209
+ const elementProps = { ...opts.props ?? {} };
1210
+ /** Build `{ labels, datasets }` from the current rows + series config. */
1211
+ function project() {
1212
+ if (raw) {
1213
+ projected = raw;
1214
+ buckets = [];
1215
+ return;
1216
+ }
1217
+ const groupBy = opts.groupBy;
1218
+ const labelField = opts.labelField ?? groupBy;
1219
+ const specs = series.length ? series : inferSeries();
1220
+ let labels;
1221
+ let groups;
1222
+ if (groupBy) {
1223
+ const order = [];
1224
+ const map = /* @__PURE__ */ new Map();
1225
+ for (const row of rows) {
1226
+ const value = fieldValue(row, groupBy);
1227
+ const key = String(value);
1228
+ let entry = map.get(key);
1229
+ if (!entry) {
1230
+ entry = {
1231
+ label: value,
1232
+ rows: []
1233
+ };
1234
+ map.set(key, entry);
1235
+ order.push(key);
1236
+ }
1237
+ entry.rows.push(row);
1238
+ }
1239
+ labels = order.map((k) => map.get(String(k)).label);
1240
+ groups = order.map((k) => map.get(String(k)).rows);
1241
+ } else {
1242
+ labels = labelField ? rows.map((r) => fieldValue(r, labelField)) : rows.map((_, i) => i + 1);
1243
+ groups = rows.map((r) => [r]);
1244
+ }
1245
+ const perPoint = isPerPointType(ctrl.type);
1246
+ const resolved = colors.map(resolveColor);
1247
+ const palette = paletteIsDefault ? distinctColors(resolved) : resolved;
1248
+ const datasets = specs.map((spec, i) => {
1249
+ /**
1250
+ * Rows that arrived pre-aggregated (`odata.aggregate`) are already one per
1251
+ * bucket, so the series' own `agg` must NOT run again — it would re-reduce a
1252
+ * single value. `sum` is the identity there for `sum`/`min`/`max`/`avg`, but
1253
+ * `count` is not: counting one rolled-up row yields 1 and throws away the
1254
+ * server's `$count`. Reading the value covers every agg uniformly.
1255
+ */
1256
+ const agg = preAggregated ? "sum" : spec.agg ?? "sum";
1257
+ const data = groups.map((bucket) => {
1258
+ const values = bucket.map((row) => fieldValue(row, spec.field));
1259
+ if ((preAggregated || !groupBy) && bucket.length === 1 && agg === "sum") return num(values[0]);
1260
+ return aggregate(values, agg);
1261
+ });
1262
+ const color = spec.color ? resolveColor(spec.color) : palette[i % palette.length];
1263
+ const base = {
1264
+ label: spec.label ?? spec.field,
1265
+ data,
1266
+ backgroundColor: perPoint ? labels.map((_, j) => palette[j % palette.length]) : color,
1267
+ borderColor: perPoint ? resolveColor("surface") : color
1268
+ };
1269
+ if (spec.type) base.type = spec.type;
1270
+ return spec.dataset ? {
1271
+ ...base,
1272
+ ...spec.dataset
1273
+ } : base;
1274
+ });
1275
+ projected = {
1276
+ labels,
1277
+ datasets
1278
+ };
1279
+ buckets = groups;
1280
+ }
1281
+ /**
1282
+ * With no `series`, chart every numeric field on the first row except the
1283
+ * label/group field — so `monoChart(rows, { labelField: 'month' })` just works.
1284
+ */
1285
+ function inferSeries() {
1286
+ const first = rows[0];
1287
+ if (!first) return [];
1288
+ const skip = new Set([opts.labelField, opts.groupBy].filter(Boolean));
1289
+ return Object.keys(first).filter((k) => !skip.has(k) && num(first[k]) != null).map((field) => ({ field }));
1290
+ }
1291
+ const onChanged = () => {
1292
+ if (drainDepth > 0) return;
1293
+ if (opts.loadAll === false) succeed();
1294
+ sync().catch(() => {});
1295
+ };
1296
+ /**
1297
+ * Publish the loading state, notifying only on a real change.
1298
+ *
1299
+ * The DataSource's own `isLoading()` is NOT enough: a draining chart reads the
1300
+ * STORE directly (`readAllRows`), which never goes through the DataSource and so
1301
+ * never flips its loading flag. Reporting only `isLoading()` made the chart look
1302
+ * finished while chunk after chunk was still in flight — `draining` is the half
1303
+ * that covers it.
1304
+ */
1305
+ function setLoading(next) {
1306
+ if (ctrl.loading === next) return;
1307
+ ctrl.loading = next;
1308
+ notify();
1309
+ }
1310
+ const syncLoading = () => {
1311
+ setLoading(drainDepth > 0 || (bound?.isLoading?.() ?? false));
1312
+ };
1313
+ const onLoadingChanged = () => {
1314
+ syncLoading();
1315
+ notify();
1316
+ };
1317
+ /** Record a load failure for the element to paint. Cancelled loads are not failures. */
1318
+ function fail(err) {
1319
+ if (isCanceled(err)) return;
1320
+ ctrl.error = describeError(err);
1321
+ notify();
1322
+ }
1323
+ /** A load answered: the chart has data and any earlier failure is over. */
1324
+ function succeed() {
1325
+ ctrl.hasLoaded = true;
1326
+ ctrl.error = null;
1327
+ }
1328
+ const onLoadError = (err) => {
1329
+ syncLoading();
1330
+ fail(err ?? /* @__PURE__ */ new Error("Request failed"));
1331
+ };
1332
+ function detach() {
1333
+ if (!bound) return;
1334
+ bound.off("changed", onChanged);
1335
+ bound.off("loadingChanged", onLoadingChanged);
1336
+ bound.off("loadError", onLoadError);
1337
+ bound = null;
1338
+ }
1339
+ let dsOptionsSource = opts.dataSourceOptions;
1340
+ let odataOptionsSource = opts.odataOptions;
1341
+ let resolvedOpts = {};
1342
+ /** The consumer's own `ds.filter(...)`, adopted (page path only). */
1343
+ let externalBase = null;
1344
+ /** What the source HELD after this controller's last `filter()` write (read back). */
1345
+ let lastWrittenFilter = null;
1346
+ let lastComposed = void 0;
1347
+ let composeMemo = null;
1348
+ function resolveBase() {
1349
+ resolvedOpts = resolveDataSourceOptions(dsOptionsSource, odataOptionsSource);
1350
+ return resolvedOpts;
1351
+ }
1352
+ /** A base `filter` for the source at hand: arrays and predicates as-is, a raw OData string dropped for an array source. */
1353
+ function baseFilterFor(s) {
1354
+ const f = resolvedOpts.filter;
1355
+ if (f == null) return null;
1356
+ if (typeof s?.store === "function" && !!s.store()) return f;
1357
+ if (typeof f === "function") return f;
1358
+ if (Array.isArray(f) && f.length === 1 && typeof f[0] === "string") return null;
1359
+ return compileFilterPredicate(f);
1360
+ }
1361
+ /**
1362
+ * `loadAll: false` — the source's own page is what renders, so the base goes
1363
+ * onto the source. Adoption rule as in the grid: what the source holds that is
1364
+ * not this controller's last write is the consumer's, and becomes the base.
1365
+ */
1366
+ function applyBaseToSource(s) {
1367
+ if (typeof s.filter === "function") {
1368
+ const live = s.filter() ?? null;
1369
+ if (live !== lastWrittenFilter) externalBase = live;
1370
+ const own = baseFilterFor(s);
1371
+ const remote = typeof s.store === "function" && !!s.store();
1372
+ let next;
1373
+ if (composeMemo && composeMemo.own === own && composeMemo.ext === externalBase) next = composeMemo.out;
1374
+ else {
1375
+ next = remote ? andFilters(own, externalBase) : andPredicates(own, externalBase);
1376
+ composeMemo = {
1377
+ own,
1378
+ ext: externalBase,
1379
+ out: next
1380
+ };
1381
+ }
1382
+ if (next !== lastComposed || (s.filter() ?? null) !== lastWrittenFilter) {
1383
+ s.filter(next);
1384
+ lastComposed = next;
1385
+ lastWrittenFilter = s.filter() ?? null;
1386
+ }
1387
+ }
1388
+ if (resolvedOpts.select !== void 0 && typeof s.select === "function") s.select(toList(resolvedOpts.select) ?? null);
1389
+ if (resolvedOpts.sort !== void 0 && typeof s.sort === "function") s.sort(normalizeSortList(resolvedOpts.sort));
1390
+ const lo = typeof s.loadOptions === "function" ? s.loadOptions() : null;
1391
+ if (lo && typeof lo === "object") Object.assign(lo, extraLoadOptions(resolvedOpts));
1392
+ }
1393
+ /**
1394
+ * The bound source rolled up by the SERVER: ONE
1395
+ * `$apply=filter(…)/groupby((groupBy),aggregate(…))` through the source's own
1396
+ * store, one row per bucket, instead of draining every row to bucket them
1397
+ * here. Same clause `odata.aggregate` builds, same transport the grid's header
1398
+ * filter and summary use (`utils/data-source-apply`).
1399
+ *
1400
+ * `null` is the decline, and the drain is still the definition of the result:
1401
+ * the path switched off (`serverApply: false`, or a backend that already
1402
+ * rejected an `$apply` — the gate remembers), no `groupBy`, no explicit
1403
+ * `series` (the clause needs the fields; `inferSeries` reads them off rows
1404
+ * that are not there yet), a store that cannot carry an `$apply` (a
1405
+ * CustomStore), a failed request, or rows that are not buckets (a server that
1406
+ * ignored the clause hands back entities — `isRolledUp`).
1407
+ *
1408
+ * The filter is what the drain would see: the base ∧ the source's live
1409
+ * `filter()` ∧ its search, folded INSIDE the clause.
1410
+ */
1411
+ async function rollUpViaStore(s) {
1412
+ if (applyGate.skip || !opts.groupBy) return null;
1413
+ const specs = series.filter((sp) => sp?.field);
1414
+ if (!specs.length) return null;
1415
+ const store = typeof s.store === "function" ? s.store() : null;
1416
+ if (!store) return null;
1417
+ const apply = buildChartApply(opts.groupBy, specs);
1418
+ const filter = andFilters(baseFilterFor(s), summaryFilterOf(s));
1419
+ let rolled;
1420
+ try {
1421
+ rolled = await loadApply(store, composeApply(apply, filter));
1422
+ } catch (err) {
1423
+ applyGate.reject(err);
1424
+ return null;
1425
+ }
1426
+ if (!rolled) return null;
1427
+ return isRolledUp(rolled, [opts.groupBy, ...specs.map((sp) => sp.field)]) ? rolled : null;
1428
+ }
1429
+ /** Mirror the source's rows onto `ctrl`, re-project, then notify. */
1430
+ async function sync() {
1431
+ preAggregated = false;
1432
+ resolveBase();
1433
+ if (!bound) rows = [];
1434
+ else if (opts.loadAll === false) {
1435
+ rows = [...bound.items?.() ?? []];
1436
+ if (rows.length) succeed();
1437
+ } else {
1438
+ drainDepth++;
1439
+ syncLoading();
1440
+ try {
1441
+ const rolled = await rollUpViaStore(bound);
1442
+ if (rolled) {
1443
+ rows = rolled;
1444
+ preAggregated = true;
1445
+ } else {
1446
+ const base = resolvedOpts;
1447
+ const filter = baseFilterFor(bound);
1448
+ const loadOptions = extraLoadOptions(base);
1449
+ const isArray = !(typeof bound.store === "function" && bound.store());
1450
+ const drained = await readAllRows(bound, {
1451
+ chunkSize: opts.chunkSize ?? 100,
1452
+ ...filter != null && !isArray ? { filter } : {},
1453
+ ...base.select !== void 0 ? { select: toList(base.select) } : {},
1454
+ ...base.sort !== void 0 ? { sort: normalizeSortList(base.sort) } : {},
1455
+ ...Object.keys(loadOptions).length ? { loadOptions } : {}
1456
+ });
1457
+ rows = isArray && typeof filter === "function" ? drained.filter(filter) : drained;
1458
+ }
1459
+ succeed();
1460
+ } catch (err) {
1461
+ fail(err);
1462
+ throw err;
1463
+ } finally {
1464
+ drainDepth--;
1465
+ syncLoading();
1466
+ }
1467
+ }
1468
+ ctrl.items = rows;
1469
+ project();
1470
+ notify();
1471
+ }
1472
+ function bind(next) {
1473
+ if (isRawData(next)) {
1474
+ detach();
1475
+ raw = next;
1476
+ rows = [];
1477
+ succeed();
1478
+ ctrl.items = rows;
1479
+ ctrl.dataSource = null;
1480
+ project();
1481
+ notify();
1482
+ return;
1483
+ }
1484
+ raw = null;
1485
+ const src = Array.isArray(next) ? monoArraySource(next, { pageSize: 0 }) : next;
1486
+ if (bound === src) return;
1487
+ detach();
1488
+ bound = src;
1489
+ ctrl.dataSource = src;
1490
+ ctrl.hasLoaded = false;
1491
+ ctrl.error = null;
1492
+ if (!src) {
1493
+ sync().catch(() => {});
1494
+ return;
1495
+ }
1496
+ src.on("changed", onChanged);
1497
+ src.on("loadingChanged", onLoadingChanged);
1498
+ src.on("loadError", onLoadError);
1499
+ sync().catch(() => {});
1500
+ }
1501
+ /**
1502
+ * Load through `monoOdataFetch`.
1503
+ *
1504
+ * With `odata.aggregate` this is ONE request: the server rolls the data up with
1505
+ * `$apply` and returns a row per bucket, instead of the chart draining every row
1506
+ * to sum them locally. Without it, rows are fetched normally and `options`
1507
+ * (`select` / `filter` / `take`) is what keeps the payload small.
1508
+ *
1509
+ * `@mono-lit/utility` is imported on demand — it is an OPTIONAL peer, so a consumer that
1510
+ * never sets `odata` neither installs nor loads it (same arrangement as
1511
+ * `chart.js` itself).
1512
+ */
1513
+ async function loadOdata() {
1514
+ const od = opts.odata;
1515
+ if (!od?.url) return;
1516
+ let fetching;
1517
+ try {
1518
+ fetching = await import("@mono-lit/utility/fetching");
1519
+ } catch (err) {
1520
+ throw new Error("[mono-chart] `odata` needs the optional peer dependency \"@mono-lit/utility\". Install it in your app: pnpm add @mono-lit/utility" + (err?.message ? ` (original error: ${err.message})` : ""));
1521
+ }
1522
+ const request = buildChartOdataRequest({
1523
+ options: od.options,
1524
+ base: resolveBase(),
1525
+ aggregate: od.aggregate,
1526
+ groupBy: opts.groupBy,
1527
+ series
1528
+ });
1529
+ setLoading(true);
1530
+ try {
1531
+ const res = await fetching.monoOdataFetch({
1532
+ baseUrl: od.baseUrl,
1533
+ configBaseUrl: od.configBaseUrl,
1534
+ url: od.url,
1535
+ method: od.method,
1536
+ type: "data",
1537
+ notif: false,
1538
+ options: request.options,
1539
+ ...Object.keys(request.params).length ? { params: request.params } : {}
1540
+ });
1541
+ if (res?.error) throw new Error(res.error.message ?? "odata request failed");
1542
+ rows = res?.data ?? [];
1543
+ preAggregated = request.aggregated;
1544
+ succeed();
1545
+ } catch (err) {
1546
+ fail(err);
1547
+ throw err;
1548
+ } finally {
1549
+ setLoading(false);
1550
+ }
1551
+ ctrl.items = rows;
1552
+ project();
1553
+ notify();
1554
+ }
1555
+ async function reload() {
1556
+ if (opts.odata?.url) {
1557
+ await loadOdata();
1558
+ return;
1559
+ }
1560
+ drainDepth++;
1561
+ syncLoading();
1562
+ try {
1563
+ if (opts.loadAll === false && bound?.load) {
1564
+ resolveBase();
1565
+ applyBaseToSource(bound);
1566
+ try {
1567
+ await bound.load();
1568
+ succeed();
1569
+ } catch (err) {
1570
+ fail(err);
1571
+ throw err;
1572
+ }
1573
+ }
1574
+ await sync();
1575
+ } finally {
1576
+ drainDepth--;
1577
+ syncLoading();
1578
+ }
1579
+ }
1580
+ async function setDataSourceOptions(next) {
1581
+ dsOptionsSource = next;
1582
+ await reload();
1583
+ }
1584
+ async function setOdataOptions(next) {
1585
+ odataOptionsSource = next;
1586
+ await reload();
1587
+ }
1588
+ function resolvedDataSourceOptions() {
1589
+ return resolvedOpts;
1590
+ }
1591
+ function setType(next) {
1592
+ if (ctrl.type === next) return;
1593
+ ctrl.type = next;
1594
+ project();
1595
+ notify();
1596
+ }
1597
+ function setSeries(next) {
1598
+ series = [...next];
1599
+ project();
1600
+ notify();
1601
+ }
1602
+ function setColors(next) {
1603
+ colors = next.length ? [...next] : [...DEFAULT_COLORS];
1604
+ paletteIsDefault = !next.length;
1605
+ project();
1606
+ notify();
1607
+ }
1608
+ function setData(next) {
1609
+ preAggregated = false;
1610
+ bind(next);
1611
+ }
1612
+ /** Resolve a clicked point back to the rows that produced it. */
1613
+ function pointEvent(datasetIndex, index) {
1614
+ return {
1615
+ index,
1616
+ datasetIndex,
1617
+ label: projected.labels?.[index],
1618
+ value: projected.datasets[datasetIndex]?.data?.[index],
1619
+ rows: buckets[index] ?? []
1620
+ };
1621
+ }
1622
+ const ctrl = {
1623
+ items: rows,
1624
+ loading: false,
1625
+ error: null,
1626
+ hasLoaded: false,
1627
+ type: opts.type ?? "bar",
1628
+ dataSource: null,
1629
+ get instance() {
1630
+ return instance;
1631
+ },
1632
+ data: () => projected,
1633
+ options: () => opts.options ?? {},
1634
+ props: () => elementProps,
1635
+ /**
1636
+ * Merge, not replace — a partial patch leaves everything else alone.
1637
+ * `undefined` values pass straight through: `applyProps` skips them on the
1638
+ * write side, so "not declared" can never clobber a value the template set.
1639
+ */
1640
+ setProps(patch) {
1641
+ if (!patch) return;
1642
+ Object.assign(elementProps, patch);
1643
+ notify();
1644
+ },
1645
+ setType,
1646
+ setSeries,
1647
+ setColors,
1648
+ setData,
1649
+ bind,
1650
+ reload,
1651
+ refresh: reload,
1652
+ async retry() {
1653
+ ctrl.error = null;
1654
+ notify();
1655
+ await reload().catch(() => {});
1656
+ },
1657
+ setDataSourceOptions,
1658
+ setOdataOptions,
1659
+ resolvedDataSourceOptions,
1660
+ onPointClick: null,
1661
+ subscribe: notifier.subscribe,
1662
+ dispose() {
1663
+ detach();
1664
+ notifier.clear();
1665
+ instance = null;
1666
+ },
1667
+ _attachInstance(next) {
1668
+ instance = next;
1669
+ },
1670
+ _setColorResolver(fn) {
1671
+ resolveColor = fn ?? ((c) => NAME_FALLBACK[c] ?? c);
1672
+ project();
1673
+ notify();
1674
+ }
1675
+ };
1676
+ ctrl._emitPoint = (d, i) => {
1677
+ ctrl.onPointClick?.(pointEvent(d, i));
1678
+ };
1679
+ if (source) bind(source);
1680
+ else project();
1681
+ if (!source && opts.odata?.url) loadOdata().catch(() => {});
1682
+ return ctrl;
1683
+ }
1684
+ //#endregion
1685
+ export { MonoChartBarShadow, MonoChartCore, MonoChartDoughnutShadow, MonoChartLineShadow, MonoChartPieShadow, MonoChartShadow, buildChartApply, composeApply, monoChart as controlMonoChart, monoChart, loadChartJs };