@mono-lit/helper 0.0.0-stage → 0.0.1

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