snice 3.2.0 → 3.3.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 (413) hide show
  1. package/bin/templates/base/src/components/counter-button.ts +2 -2
  2. package/bin/templates/base/src/pages/about-page.ts +8 -5
  3. package/bin/templates/base/src/pages/home-page.ts +9 -6
  4. package/bin/templates/base/src/pages/not-found-page.ts +7 -4
  5. package/dist/components/accordion/snice-accordion-item.d.ts +2 -2
  6. package/dist/components/accordion/snice-accordion-item.js +9 -9
  7. package/dist/components/accordion/snice-accordion-item.js.map +1 -1
  8. package/dist/components/accordion/snice-accordion.d.ts +2 -2
  9. package/dist/components/accordion/snice-accordion.js +9 -9
  10. package/dist/components/accordion/snice-accordion.js.map +1 -1
  11. package/dist/components/actions/snice-actions.d.ts +28 -0
  12. package/dist/components/actions/snice-actions.js +220 -0
  13. package/dist/components/actions/snice-actions.js.map +1 -0
  14. package/dist/components/actions/snice-actions.types.d.ts +27 -0
  15. package/dist/components/alert/snice-alert.d.ts +2 -2
  16. package/dist/components/alert/snice-alert.js +8 -8
  17. package/dist/components/alert/snice-alert.js.map +1 -1
  18. package/dist/components/audio-recorder/snice-audio-recorder.d.ts +58 -0
  19. package/dist/components/audio-recorder/snice-audio-recorder.js +413 -0
  20. package/dist/components/audio-recorder/snice-audio-recorder.js.map +1 -0
  21. package/dist/components/audio-recorder/snice-audio-recorder.types.d.ts +28 -0
  22. package/dist/components/avatar/snice-avatar.d.ts +2 -2
  23. package/dist/components/avatar/snice-avatar.js +9 -9
  24. package/dist/components/avatar/snice-avatar.js.map +1 -1
  25. package/dist/components/badge/snice-badge.d.ts +2 -2
  26. package/dist/components/badge/snice-badge.js +10 -10
  27. package/dist/components/badge/snice-badge.js.map +1 -1
  28. package/dist/components/banner/snice-banner.d.ts +2 -2
  29. package/dist/components/banner/snice-banner.js +8 -8
  30. package/dist/components/banner/snice-banner.js.map +1 -1
  31. package/dist/components/breadcrumbs/snice-breadcrumbs.d.ts +2 -2
  32. package/dist/components/breadcrumbs/snice-breadcrumbs.js +11 -11
  33. package/dist/components/breadcrumbs/snice-breadcrumbs.js.map +1 -1
  34. package/dist/components/button/snice-button.d.ts +2 -2
  35. package/dist/components/button/snice-button.js +8 -8
  36. package/dist/components/button/snice-button.js.map +1 -1
  37. package/dist/components/calendar/snice-calendar.d.ts +46 -0
  38. package/dist/components/calendar/snice-calendar.js +294 -0
  39. package/dist/components/calendar/snice-calendar.js.map +1 -0
  40. package/dist/components/calendar/snice-calendar.types.d.ts +34 -0
  41. package/dist/components/camera/snice-camera.d.ts +39 -0
  42. package/dist/components/camera/snice-camera.js +286 -0
  43. package/dist/components/camera/snice-camera.js.map +1 -0
  44. package/dist/components/camera/snice-camera.types.d.ts +28 -0
  45. package/dist/components/card/snice-card.d.ts +2 -2
  46. package/dist/components/card/snice-card.js +9 -9
  47. package/dist/components/card/snice-card.js.map +1 -1
  48. package/dist/components/carousel/snice-carousel.d.ts +32 -0
  49. package/dist/components/carousel/snice-carousel.js +279 -0
  50. package/dist/components/carousel/snice-carousel.js.map +1 -0
  51. package/dist/components/carousel/snice-carousel.types.d.ts +22 -0
  52. package/dist/components/chart/snice-chart.d.ts +73 -0
  53. package/dist/components/chart/snice-chart.js +946 -0
  54. package/dist/components/chart/snice-chart.js.map +1 -0
  55. package/dist/components/chart/snice-chart.types.d.ts +71 -0
  56. package/dist/components/chat/snice-chat.d.ts +98 -0
  57. package/dist/components/chat/snice-chat.js +589 -0
  58. package/dist/components/chat/snice-chat.js.map +1 -0
  59. package/dist/components/chat/snice-chat.types.d.ts +141 -0
  60. package/dist/components/checkbox/snice-checkbox.d.ts +2 -2
  61. package/dist/components/checkbox/snice-checkbox.js +8 -8
  62. package/dist/components/checkbox/snice-checkbox.js.map +1 -1
  63. package/dist/components/chip/snice-chip.d.ts +2 -2
  64. package/dist/components/chip/snice-chip.js +8 -8
  65. package/dist/components/chip/snice-chip.js.map +1 -1
  66. package/dist/components/code-block/snice-code-block.d.ts +15 -0
  67. package/dist/components/code-block/snice-code-block.js +141 -0
  68. package/dist/components/code-block/snice-code-block.js.map +1 -0
  69. package/dist/components/code-block/snice-code-block.types.d.ts +15 -0
  70. package/dist/components/color-display/snice-color-display.d.ts +2 -2
  71. package/dist/components/color-display/snice-color-display.js +10 -10
  72. package/dist/components/color-display/snice-color-display.js.map +1 -1
  73. package/dist/components/color-picker/snice-color-picker.d.ts +2 -2
  74. package/dist/components/color-picker/snice-color-picker.js +8 -8
  75. package/dist/components/color-picker/snice-color-picker.js.map +1 -1
  76. package/dist/components/command-palette/snice-command-palette.d.ts +47 -0
  77. package/dist/components/command-palette/snice-command-palette.js +428 -0
  78. package/dist/components/command-palette/snice-command-palette.js.map +1 -0
  79. package/dist/components/command-palette/snice-command-palette.types.d.ts +49 -0
  80. package/dist/components/date-picker/snice-date-picker.d.ts +2 -2
  81. package/dist/components/date-picker/snice-date-picker.js +9 -9
  82. package/dist/components/date-picker/snice-date-picker.js.map +1 -1
  83. package/dist/components/divider/snice-divider.d.ts +2 -2
  84. package/dist/components/divider/snice-divider.js +10 -10
  85. package/dist/components/divider/snice-divider.js.map +1 -1
  86. package/dist/components/doc/snice-doc.d.ts +93 -0
  87. package/dist/components/doc/snice-doc.js +626 -0
  88. package/dist/components/doc/snice-doc.js.map +1 -0
  89. package/dist/components/doc/snice-doc.types.d.ts +118 -0
  90. package/dist/components/draw/snice-draw.d.ts +71 -0
  91. package/dist/components/draw/snice-draw.js +709 -0
  92. package/dist/components/draw/snice-draw.js.map +1 -0
  93. package/dist/components/draw/snice-draw.types.d.ts +41 -0
  94. package/dist/components/drawer/snice-drawer.d.ts +2 -2
  95. package/dist/components/drawer/snice-drawer.js +9 -9
  96. package/dist/components/drawer/snice-drawer.js.map +1 -1
  97. package/dist/components/empty-state/snice-empty-state.d.ts +2 -2
  98. package/dist/components/empty-state/snice-empty-state.js +8 -8
  99. package/dist/components/empty-state/snice-empty-state.js.map +1 -1
  100. package/dist/components/file-upload/snice-file-upload.d.ts +2 -3
  101. package/dist/components/file-upload/snice-file-upload.js +8 -15
  102. package/dist/components/file-upload/snice-file-upload.js.map +1 -1
  103. package/dist/components/gantt/snice-gantt.d.ts +29 -0
  104. package/dist/components/gantt/snice-gantt.js +268 -0
  105. package/dist/components/gantt/snice-gantt.js.map +1 -0
  106. package/dist/components/gantt/snice-gantt.types.d.ts +23 -0
  107. package/dist/components/image/snice-image.d.ts +2 -2
  108. package/dist/components/image/snice-image.js +11 -11
  109. package/dist/components/image/snice-image.js.map +1 -1
  110. package/dist/components/input/snice-input.d.ts +2 -2
  111. package/dist/components/input/snice-input.js +8 -8
  112. package/dist/components/input/snice-input.js.map +1 -1
  113. package/dist/components/kanban/snice-kanban.d.ts +31 -0
  114. package/dist/components/kanban/snice-kanban.js +243 -0
  115. package/dist/components/kanban/snice-kanban.js.map +1 -0
  116. package/dist/components/kanban/snice-kanban.types.d.ts +29 -0
  117. package/dist/components/kpi/snice-kpi.d.ts +2 -2
  118. package/dist/components/kpi/snice-kpi.js +11 -11
  119. package/dist/components/kpi/snice-kpi.js.map +1 -1
  120. package/dist/components/layout/snice-layout-blog.d.ts +2 -2
  121. package/dist/components/layout/snice-layout-blog.js +8 -8
  122. package/dist/components/layout/snice-layout-blog.js.map +1 -1
  123. package/dist/components/layout/snice-layout-card.d.ts +2 -2
  124. package/dist/components/layout/snice-layout-card.js +8 -8
  125. package/dist/components/layout/snice-layout-card.js.map +1 -1
  126. package/dist/components/layout/snice-layout-centered.d.ts +2 -2
  127. package/dist/components/layout/snice-layout-centered.js +8 -8
  128. package/dist/components/layout/snice-layout-centered.js.map +1 -1
  129. package/dist/components/layout/snice-layout-dashboard.d.ts +2 -2
  130. package/dist/components/layout/snice-layout-dashboard.js +8 -8
  131. package/dist/components/layout/snice-layout-dashboard.js.map +1 -1
  132. package/dist/components/layout/snice-layout-fullscreen.d.ts +2 -2
  133. package/dist/components/layout/snice-layout-fullscreen.js +8 -8
  134. package/dist/components/layout/snice-layout-fullscreen.js.map +1 -1
  135. package/dist/components/layout/snice-layout-landing.d.ts +2 -2
  136. package/dist/components/layout/snice-layout-landing.js +8 -8
  137. package/dist/components/layout/snice-layout-landing.js.map +1 -1
  138. package/dist/components/layout/snice-layout-minimal.d.ts +2 -2
  139. package/dist/components/layout/snice-layout-minimal.js +8 -8
  140. package/dist/components/layout/snice-layout-minimal.js.map +1 -1
  141. package/dist/components/layout/snice-layout-sidebar.d.ts +2 -2
  142. package/dist/components/layout/snice-layout-sidebar.js +8 -8
  143. package/dist/components/layout/snice-layout-sidebar.js.map +1 -1
  144. package/dist/components/layout/snice-layout-split.d.ts +2 -2
  145. package/dist/components/layout/snice-layout-split.js +8 -8
  146. package/dist/components/layout/snice-layout-split.js.map +1 -1
  147. package/dist/components/layout/snice-layout.d.ts +2 -2
  148. package/dist/components/layout/snice-layout.js +8 -8
  149. package/dist/components/layout/snice-layout.js.map +1 -1
  150. package/dist/components/link/snice-link.d.ts +2 -2
  151. package/dist/components/link/snice-link.js +10 -10
  152. package/dist/components/link/snice-link.js.map +1 -1
  153. package/dist/components/list/snice-list-item.d.ts +6 -0
  154. package/dist/components/list/snice-list-item.js +68 -0
  155. package/dist/components/list/snice-list-item.js.map +1 -0
  156. package/dist/components/list/snice-list.d.ts +23 -0
  157. package/dist/components/list/snice-list.js +276 -0
  158. package/dist/components/list/snice-list.js.map +1 -0
  159. package/dist/components/list/snice-list.types.d.ts +10 -0
  160. package/dist/components/location/snice-location.d.ts +35 -0
  161. package/dist/components/location/snice-location.js +238 -0
  162. package/dist/components/location/snice-location.js.map +1 -0
  163. package/dist/components/location/snice-location.types.d.ts +35 -0
  164. package/dist/components/login/snice-login.d.ts +2 -2
  165. package/dist/components/login/snice-login.js +8 -8
  166. package/dist/components/login/snice-login.js.map +1 -1
  167. package/dist/components/menu/snice-menu-divider.d.ts +4 -0
  168. package/dist/components/menu/snice-menu-divider.js +53 -0
  169. package/dist/components/menu/snice-menu-divider.js.map +1 -0
  170. package/dist/components/menu/snice-menu-item.d.ts +10 -0
  171. package/dist/components/menu/snice-menu-item.js +99 -0
  172. package/dist/components/menu/snice-menu-item.js.map +1 -0
  173. package/dist/components/menu/snice-menu-item.types.d.ts +9 -0
  174. package/dist/components/menu/snice-menu.d.ts +27 -0
  175. package/dist/components/menu/snice-menu.js +199 -0
  176. package/dist/components/menu/snice-menu.js.map +1 -0
  177. package/dist/components/menu/snice-menu.types.d.ts +18 -0
  178. package/dist/components/modal/snice-modal.d.ts +2 -2
  179. package/dist/components/modal/snice-modal.js +8 -8
  180. package/dist/components/modal/snice-modal.js.map +1 -1
  181. package/dist/components/nav/snice-nav.js.map +1 -1
  182. package/dist/components/pagination/snice-pagination.d.ts +2 -2
  183. package/dist/components/pagination/snice-pagination.js +8 -8
  184. package/dist/components/pagination/snice-pagination.js.map +1 -1
  185. package/dist/components/progress/snice-progress.d.ts +2 -2
  186. package/dist/components/progress/snice-progress.js +10 -10
  187. package/dist/components/progress/snice-progress.js.map +1 -1
  188. package/dist/components/qr-code/qrcode.d.ts +28 -0
  189. package/dist/components/qr-code/qrcode.js +916 -0
  190. package/dist/components/qr-code/qrcode.js.map +1 -0
  191. package/dist/components/qr-code/snice-qr-code.d.ts +35 -0
  192. package/dist/components/qr-code/snice-qr-code.js +263 -0
  193. package/dist/components/qr-code/snice-qr-code.js.map +1 -0
  194. package/dist/components/qr-code/snice-qr-code.types.d.ts +33 -0
  195. package/dist/components/radio/snice-radio.d.ts +2 -2
  196. package/dist/components/radio/snice-radio.js +8 -8
  197. package/dist/components/radio/snice-radio.js.map +1 -1
  198. package/dist/components/select/snice-option.d.ts +2 -2
  199. package/dist/components/select/snice-option.js +8 -8
  200. package/dist/components/select/snice-option.js.map +1 -1
  201. package/dist/components/select/snice-select.d.ts +2 -2
  202. package/dist/components/select/snice-select.js +9 -9
  203. package/dist/components/select/snice-select.js.map +1 -1
  204. package/dist/components/skeleton/snice-skeleton.d.ts +2 -2
  205. package/dist/components/skeleton/snice-skeleton.js +9 -9
  206. package/dist/components/skeleton/snice-skeleton.js.map +1 -1
  207. package/dist/components/slider/snice-slider.d.ts +2 -2
  208. package/dist/components/slider/snice-slider.js +8 -8
  209. package/dist/components/slider/snice-slider.js.map +1 -1
  210. package/dist/components/sparkline/snice-sparkline.d.ts +2 -2
  211. package/dist/components/sparkline/snice-sparkline.js +10 -10
  212. package/dist/components/sparkline/snice-sparkline.js.map +1 -1
  213. package/dist/components/spinner/snice-spinner.d.ts +2 -2
  214. package/dist/components/spinner/snice-spinner.js +10 -10
  215. package/dist/components/spinner/snice-spinner.js.map +1 -1
  216. package/dist/components/split-pane/snice-split-pane.d.ts +32 -0
  217. package/dist/components/split-pane/snice-split-pane.js +191 -0
  218. package/dist/components/split-pane/snice-split-pane.js.map +1 -0
  219. package/dist/components/split-pane/snice-split-pane.types.d.ts +19 -0
  220. package/dist/components/stat/snice-stat.d.ts +14 -0
  221. package/dist/components/stat/snice-stat.js +140 -0
  222. package/dist/components/stat/snice-stat.js.map +1 -0
  223. package/dist/components/stat/snice-stat.types.d.ts +12 -0
  224. package/dist/components/stepper/snice-stepper-panel.d.ts +2 -2
  225. package/dist/components/stepper/snice-stepper-panel.js +10 -10
  226. package/dist/components/stepper/snice-stepper-panel.js.map +1 -1
  227. package/dist/components/stepper/snice-stepper.d.ts +2 -2
  228. package/dist/components/stepper/snice-stepper.js +11 -11
  229. package/dist/components/stepper/snice-stepper.js.map +1 -1
  230. package/dist/components/switch/snice-switch.d.ts +2 -2
  231. package/dist/components/switch/snice-switch.js +8 -8
  232. package/dist/components/switch/snice-switch.js.map +1 -1
  233. package/dist/components/table/snice-cell-actions.d.ts +2 -2
  234. package/dist/components/table/snice-cell-actions.js +8 -8
  235. package/dist/components/table/snice-cell-actions.js.map +1 -1
  236. package/dist/components/table/snice-cell-boolean.d.ts +2 -2
  237. package/dist/components/table/snice-cell-boolean.js +8 -8
  238. package/dist/components/table/snice-cell-boolean.js.map +1 -1
  239. package/dist/components/table/snice-cell-color.d.ts +2 -2
  240. package/dist/components/table/snice-cell-color.js +8 -8
  241. package/dist/components/table/snice-cell-color.js.map +1 -1
  242. package/dist/components/table/snice-cell-currency.d.ts +2 -2
  243. package/dist/components/table/snice-cell-currency.js +8 -8
  244. package/dist/components/table/snice-cell-currency.js.map +1 -1
  245. package/dist/components/table/snice-cell-date.d.ts +2 -2
  246. package/dist/components/table/snice-cell-date.js +8 -8
  247. package/dist/components/table/snice-cell-date.js.map +1 -1
  248. package/dist/components/table/snice-cell-duration.d.ts +2 -2
  249. package/dist/components/table/snice-cell-duration.js +8 -8
  250. package/dist/components/table/snice-cell-duration.js.map +1 -1
  251. package/dist/components/table/snice-cell-email.d.ts +2 -2
  252. package/dist/components/table/snice-cell-email.js +8 -8
  253. package/dist/components/table/snice-cell-email.js.map +1 -1
  254. package/dist/components/table/snice-cell-filesize.d.ts +2 -2
  255. package/dist/components/table/snice-cell-filesize.js +8 -8
  256. package/dist/components/table/snice-cell-filesize.js.map +1 -1
  257. package/dist/components/table/snice-cell-image.d.ts +2 -2
  258. package/dist/components/table/snice-cell-image.js +8 -8
  259. package/dist/components/table/snice-cell-image.js.map +1 -1
  260. package/dist/components/table/snice-cell-json.d.ts +2 -2
  261. package/dist/components/table/snice-cell-json.js +8 -8
  262. package/dist/components/table/snice-cell-json.js.map +1 -1
  263. package/dist/components/table/snice-cell-link.d.ts +2 -2
  264. package/dist/components/table/snice-cell-link.js +8 -8
  265. package/dist/components/table/snice-cell-link.js.map +1 -1
  266. package/dist/components/table/snice-cell-location.d.ts +2 -2
  267. package/dist/components/table/snice-cell-location.js +8 -8
  268. package/dist/components/table/snice-cell-location.js.map +1 -1
  269. package/dist/components/table/snice-cell-number.d.ts +2 -2
  270. package/dist/components/table/snice-cell-number.js +8 -8
  271. package/dist/components/table/snice-cell-number.js.map +1 -1
  272. package/dist/components/table/snice-cell-percentage.d.ts +2 -2
  273. package/dist/components/table/snice-cell-percentage.js +8 -8
  274. package/dist/components/table/snice-cell-percentage.js.map +1 -1
  275. package/dist/components/table/snice-cell-phone.d.ts +2 -2
  276. package/dist/components/table/snice-cell-phone.js +8 -8
  277. package/dist/components/table/snice-cell-phone.js.map +1 -1
  278. package/dist/components/table/snice-cell-progress.d.ts +2 -2
  279. package/dist/components/table/snice-cell-progress.js +8 -8
  280. package/dist/components/table/snice-cell-progress.js.map +1 -1
  281. package/dist/components/table/snice-cell-rating.d.ts +2 -2
  282. package/dist/components/table/snice-cell-rating.js +8 -8
  283. package/dist/components/table/snice-cell-rating.js.map +1 -1
  284. package/dist/components/table/snice-cell-sparkline.d.ts +2 -2
  285. package/dist/components/table/snice-cell-sparkline.js +8 -8
  286. package/dist/components/table/snice-cell-sparkline.js.map +1 -1
  287. package/dist/components/table/snice-cell-status.d.ts +2 -2
  288. package/dist/components/table/snice-cell-status.js +8 -8
  289. package/dist/components/table/snice-cell-status.js.map +1 -1
  290. package/dist/components/table/snice-cell-tag.d.ts +2 -2
  291. package/dist/components/table/snice-cell-tag.js +8 -8
  292. package/dist/components/table/snice-cell-tag.js.map +1 -1
  293. package/dist/components/table/snice-cell-text.d.ts +2 -2
  294. package/dist/components/table/snice-cell-text.js +8 -8
  295. package/dist/components/table/snice-cell-text.js.map +1 -1
  296. package/dist/components/table/snice-cell.d.ts +2 -2
  297. package/dist/components/table/snice-cell.js +8 -8
  298. package/dist/components/table/snice-cell.js.map +1 -1
  299. package/dist/components/table/snice-column.d.ts +1 -1
  300. package/dist/components/table/snice-column.js +4 -4
  301. package/dist/components/table/snice-column.js.map +1 -1
  302. package/dist/components/table/snice-header.d.ts +2 -2
  303. package/dist/components/table/snice-header.js +8 -8
  304. package/dist/components/table/snice-header.js.map +1 -1
  305. package/dist/components/table/snice-progress.d.ts +2 -2
  306. package/dist/components/table/snice-progress.js +8 -8
  307. package/dist/components/table/snice-progress.js.map +1 -1
  308. package/dist/components/table/snice-rating.d.ts +2 -2
  309. package/dist/components/table/snice-rating.js +8 -8
  310. package/dist/components/table/snice-rating.js.map +1 -1
  311. package/dist/components/table/snice-row.d.ts +2 -2
  312. package/dist/components/table/snice-row.js +8 -8
  313. package/dist/components/table/snice-row.js.map +1 -1
  314. package/dist/components/table/snice-table.d.ts +2 -3
  315. package/dist/components/table/snice-table.js +8 -13
  316. package/dist/components/table/snice-table.js.map +1 -1
  317. package/dist/components/tabs/snice-tab-panel.d.ts +2 -2
  318. package/dist/components/tabs/snice-tab-panel.js +8 -8
  319. package/dist/components/tabs/snice-tab-panel.js.map +1 -1
  320. package/dist/components/tabs/snice-tab.d.ts +2 -2
  321. package/dist/components/tabs/snice-tab.js +8 -8
  322. package/dist/components/tabs/snice-tab.js.map +1 -1
  323. package/dist/components/tabs/snice-tabs.d.ts +2 -2
  324. package/dist/components/tabs/snice-tabs.js +8 -8
  325. package/dist/components/tabs/snice-tabs.js.map +1 -1
  326. package/dist/components/terminal/snice-terminal.types.d.ts +133 -0
  327. package/dist/components/textarea/snice-textarea.d.ts +2 -2
  328. package/dist/components/textarea/snice-textarea.js +8 -8
  329. package/dist/components/textarea/snice-textarea.js.map +1 -1
  330. package/dist/components/timeline/snice-timeline.d.ts +1 -1
  331. package/dist/components/timeline/snice-timeline.js +7 -7
  332. package/dist/components/timeline/snice-timeline.js.map +1 -1
  333. package/dist/components/toast/snice-toast-container.d.ts +2 -2
  334. package/dist/components/toast/snice-toast-container.js +8 -8
  335. package/dist/components/toast/snice-toast-container.js.map +1 -1
  336. package/dist/components/toast/snice-toast.d.ts +2 -2
  337. package/dist/components/toast/snice-toast.js +8 -8
  338. package/dist/components/toast/snice-toast.js.map +1 -1
  339. package/dist/components/tooltip/snice-tooltip.d.ts +2 -2
  340. package/dist/components/tooltip/snice-tooltip.js +8 -8
  341. package/dist/components/tooltip/snice-tooltip.js.map +1 -1
  342. package/dist/components/tree/snice-tree-item.d.ts +35 -0
  343. package/dist/components/tree/snice-tree-item.js +301 -0
  344. package/dist/components/tree/snice-tree-item.js.map +1 -0
  345. package/dist/components/tree/snice-tree-item.types.d.ts +30 -0
  346. package/dist/components/tree/snice-tree.d.ts +45 -0
  347. package/dist/components/tree/snice-tree.js +390 -0
  348. package/dist/components/tree/snice-tree.js.map +1 -0
  349. package/dist/components/tree/snice-tree.types.d.ts +65 -0
  350. package/dist/components/virtual-scroller/snice-virtual-scroller.d.ts +31 -0
  351. package/dist/components/virtual-scroller/snice-virtual-scroller.js +160 -0
  352. package/dist/components/virtual-scroller/snice-virtual-scroller.js.map +1 -0
  353. package/dist/components/virtual-scroller/snice-virtual-scroller.types.d.ts +19 -0
  354. package/dist/index.cjs +1 -1
  355. package/dist/index.esm.js +1 -1
  356. package/dist/index.iife.js +1 -1
  357. package/dist/symbols.cjs +1 -1
  358. package/dist/symbols.esm.js +1 -1
  359. package/dist/transitions.cjs +1 -1
  360. package/dist/transitions.esm.js +1 -1
  361. package/docs/ai/components/actions.md +81 -0
  362. package/docs/ai/components/audio-recorder.md +97 -0
  363. package/docs/ai/components/calendar.md +95 -0
  364. package/docs/ai/components/camera.md +130 -0
  365. package/docs/ai/components/carousel.md +49 -0
  366. package/docs/ai/components/chart.md +160 -0
  367. package/docs/ai/components/chat.md +189 -0
  368. package/docs/ai/components/code-block.md +32 -0
  369. package/docs/ai/components/command-palette.md +117 -0
  370. package/docs/ai/components/doc.md +154 -0
  371. package/docs/ai/components/draw.md +140 -0
  372. package/docs/ai/components/gantt.md +95 -0
  373. package/docs/ai/components/kanban.md +102 -0
  374. package/docs/ai/components/layout.md +261 -0
  375. package/docs/ai/components/list.md +50 -0
  376. package/docs/ai/components/location.md +75 -0
  377. package/docs/ai/components/menu.md +114 -0
  378. package/docs/ai/components/popover.md +70 -0
  379. package/docs/ai/components/qr-code.md +106 -0
  380. package/docs/ai/components/split-pane.md +71 -0
  381. package/docs/ai/components/stat.md +29 -0
  382. package/docs/ai/components/tree.md +191 -0
  383. package/docs/ai/components/virtual-scroller.md +71 -0
  384. package/docs/components/actions.md +317 -0
  385. package/docs/components/alert.md +540 -0
  386. package/docs/components/audio-recorder.md +152 -0
  387. package/docs/components/badge.md +593 -0
  388. package/docs/components/breadcrumbs.md +568 -0
  389. package/docs/components/button.md +648 -0
  390. package/docs/components/calendar.md +397 -0
  391. package/docs/components/camera.md +383 -0
  392. package/docs/components/card.md +778 -0
  393. package/docs/components/carousel.md +63 -0
  394. package/docs/components/chart.md +526 -0
  395. package/docs/components/chat.md +482 -0
  396. package/docs/components/checkbox.md +714 -0
  397. package/docs/components/chip.md +670 -0
  398. package/docs/components/code-block.md +49 -0
  399. package/docs/components/command-palette.md +159 -0
  400. package/docs/components/doc.md +357 -0
  401. package/docs/components/draw.md +307 -0
  402. package/docs/components/gantt.md +347 -0
  403. package/docs/components/kanban.md +410 -0
  404. package/docs/components/list.md +65 -0
  405. package/docs/components/location.md +369 -0
  406. package/docs/components/menu.md +633 -0
  407. package/docs/components/popover.md +333 -0
  408. package/docs/components/qr-code.md +464 -0
  409. package/docs/components/split-pane.md +315 -0
  410. package/docs/components/stat.md +45 -0
  411. package/docs/components/tree.md +536 -0
  412. package/docs/components/virtual-scroller.md +298 -0
  413. package/package.json +1 -1
@@ -0,0 +1,946 @@
1
+ import { __runInitializers, __esDecorate } from 'tslib';
2
+ import { element, property, query, styles, render, css, html } from 'snice';
3
+
4
+ var chartStyles = ":host{display:block;width:100%;height:400px;position:relative;font-family:var(--font-family, system-ui, -apple-system, sans-serif)}.chart-container{width:100%;height:100%;position:relative;display:flex;flex-direction:column}.chart-canvas{flex:1;position:relative;overflow:hidden}svg{width:100%;height:100%}.chart-legend{display:flex;gap:16px;padding:12px;flex-wrap:wrap}.chart-legend.legend-top{order:-1}.chart-legend.legend-bottom{order:1}.chart-legend.legend-left{flex-direction:column;position:absolute;left:0;top:50%;transform:translateY(-50%)}.chart-legend.legend-right{flex-direction:column;position:absolute;right:0;top:50%;transform:translateY(-50%)}.legend-item{display:flex;align-items:center;gap:8px;cursor:pointer;user-select:none;transition:opacity .2s}.legend-item:hover{opacity:.8}.legend-item.hidden{opacity:.5;text-decoration:line-through}.legend-color{width:16px;height:16px;border-radius:2px}.legend-label{font-size:14px;color:var(--text-color,#333)}.chart-tooltip{position:absolute;background:var(--tooltip-bg,rgba(0,0,0,.9));color:var(--tooltip-color,#fff);padding:8px 12px;border-radius:4px;font-size:12px;pointer-events:none;white-space:nowrap;z-index:1000;opacity:0;transition:opacity .2s}.chart-tooltip.visible{opacity:1}.axis-label{font-size:12px;fill:var(--axis-color,#666)}.axis-line{stroke:var(--axis-color,#666);stroke-width:1}.grid-line{stroke:var(--grid-color,#e0e0e0);stroke-width:1;stroke-dasharray:2,2}.data-point{transition:r .2s,opacity .2s}.data-point:hover{r:6;cursor:pointer}.chart-bar,.chart-path{transition:opacity .2s}.chart-slice{transition:opacity .2s;cursor:pointer}.chart-slice:hover{opacity:.8}@keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes scaleIn{from{transform:scale(0)}to{transform:scale(1)}}.animated .chart-bar,.animated .chart-path,.animated .chart-slice,.animated .data-point{animation:.5s ease-out fadeIn}.animated .chart-slice{transform-origin:center;animation:.5s ease-out scaleIn}";
5
+
6
+ const DEFAULT_OPTIONS = {
7
+ responsive: true,
8
+ maintainAspectRatio: false,
9
+ legend: { position: 'top', clickable: true },
10
+ tooltip: { trigger: 'hover' },
11
+ animation: { enabled: true, duration: 500, easing: 'ease-out' },
12
+ xAxis: { grid: true },
13
+ yAxis: { grid: true }
14
+ };
15
+ const DEFAULT_COLORS = [
16
+ '#2196f3', '#4caf50', '#ff9800', '#f44336', '#9c27b0',
17
+ '#00bcd4', '#8bc34a', '#ffc107', '#e91e63', '#673ab7'
18
+ ];
19
+ let SniceChart = (() => {
20
+ let _classDecorators = [element('snice-chart')];
21
+ let _classDescriptor;
22
+ let _classExtraInitializers = [];
23
+ let _classThis;
24
+ let _classSuper = HTMLElement;
25
+ let _instanceExtraInitializers = [];
26
+ let _type_decorators;
27
+ let _type_initializers = [];
28
+ let _type_extraInitializers = [];
29
+ let _datasets_decorators;
30
+ let _datasets_initializers = [];
31
+ let _datasets_extraInitializers = [];
32
+ let _labels_decorators;
33
+ let _labels_initializers = [];
34
+ let _labels_extraInitializers = [];
35
+ let _options_decorators;
36
+ let _options_initializers = [];
37
+ let _options_extraInitializers = [];
38
+ let _width_decorators;
39
+ let _width_initializers = [];
40
+ let _width_extraInitializers = [];
41
+ let _height_decorators;
42
+ let _height_initializers = [];
43
+ let _height_extraInitializers = [];
44
+ let _renderTrigger_decorators;
45
+ let _renderTrigger_initializers = [];
46
+ let _renderTrigger_extraInitializers = [];
47
+ let _canvasElement_decorators;
48
+ let _canvasElement_initializers = [];
49
+ let _canvasElement_extraInitializers = [];
50
+ let _tooltipVisible_decorators;
51
+ let _tooltipVisible_initializers = [];
52
+ let _tooltipVisible_extraInitializers = [];
53
+ let _tooltipContent_decorators;
54
+ let _tooltipContent_initializers = [];
55
+ let _tooltipContent_extraInitializers = [];
56
+ let _tooltipX_decorators;
57
+ let _tooltipX_initializers = [];
58
+ let _tooltipX_extraInitializers = [];
59
+ let _tooltipY_decorators;
60
+ let _tooltipY_initializers = [];
61
+ let _tooltipY_extraInitializers = [];
62
+ let _styles_decorators;
63
+ let _render_decorators;
64
+ (class extends _classSuper {
65
+ static { _classThis = this; }
66
+ constructor() {
67
+ super(...arguments);
68
+ this.type = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _type_initializers, 'line'));
69
+ this.datasets = (__runInitializers(this, _type_extraInitializers), __runInitializers(this, _datasets_initializers, []));
70
+ this.labels = (__runInitializers(this, _datasets_extraInitializers), __runInitializers(this, _labels_initializers, []));
71
+ this.options = (__runInitializers(this, _labels_extraInitializers), __runInitializers(this, _options_initializers, DEFAULT_OPTIONS));
72
+ this.width = (__runInitializers(this, _options_extraInitializers), __runInitializers(this, _width_initializers, 0));
73
+ this.height = (__runInitializers(this, _width_extraInitializers), __runInitializers(this, _height_initializers, 0));
74
+ this.hiddenDatasets = (__runInitializers(this, _height_extraInitializers), new Set());
75
+ this.renderTrigger = __runInitializers(this, _renderTrigger_initializers, 0);
76
+ this.canvasElement = (__runInitializers(this, _renderTrigger_extraInitializers), __runInitializers(this, _canvasElement_initializers, void 0));
77
+ this.tooltipVisible = (__runInitializers(this, _canvasElement_extraInitializers), __runInitializers(this, _tooltipVisible_initializers, false));
78
+ this.tooltipContent = (__runInitializers(this, _tooltipVisible_extraInitializers), __runInitializers(this, _tooltipContent_initializers, ''));
79
+ this.tooltipX = (__runInitializers(this, _tooltipContent_extraInitializers), __runInitializers(this, _tooltipX_initializers, 0));
80
+ this.tooltipY = (__runInitializers(this, _tooltipX_extraInitializers), __runInitializers(this, _tooltipY_initializers, 0));
81
+ this.canvas = (__runInitializers(this, _tooltipY_extraInitializers), null);
82
+ this.ctx = null;
83
+ }
84
+ static {
85
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
86
+ _type_decorators = [property({ type: String })];
87
+ _datasets_decorators = [property({ type: Array, attribute: false })];
88
+ _labels_decorators = [property({ type: Array, attribute: false })];
89
+ _options_decorators = [property({ type: Object, attribute: false })];
90
+ _width_decorators = [property({ type: Number })];
91
+ _height_decorators = [property({ type: Number })];
92
+ _renderTrigger_decorators = [property({ type: Number, attribute: false })];
93
+ _canvasElement_decorators = [query('.chart-render-canvas')];
94
+ _tooltipVisible_decorators = [property({ type: Boolean, attribute: false })];
95
+ _tooltipContent_decorators = [property({ type: String, attribute: false })];
96
+ _tooltipX_decorators = [property({ type: Number, attribute: false })];
97
+ _tooltipY_decorators = [property({ type: Number, attribute: false })];
98
+ _styles_decorators = [styles()];
99
+ _render_decorators = [render()];
100
+ __esDecorate(this, null, _styles_decorators, { kind: "method", name: "styles", static: false, private: false, access: { has: obj => "styles" in obj, get: obj => obj.styles }, metadata: _metadata }, null, _instanceExtraInitializers);
101
+ __esDecorate(this, null, _render_decorators, { kind: "method", name: "render", static: false, private: false, access: { has: obj => "render" in obj, get: obj => obj.render }, metadata: _metadata }, null, _instanceExtraInitializers);
102
+ __esDecorate(null, null, _type_decorators, { kind: "field", name: "type", static: false, private: false, access: { has: obj => "type" in obj, get: obj => obj.type, set: (obj, value) => { obj.type = value; } }, metadata: _metadata }, _type_initializers, _type_extraInitializers);
103
+ __esDecorate(null, null, _datasets_decorators, { kind: "field", name: "datasets", static: false, private: false, access: { has: obj => "datasets" in obj, get: obj => obj.datasets, set: (obj, value) => { obj.datasets = value; } }, metadata: _metadata }, _datasets_initializers, _datasets_extraInitializers);
104
+ __esDecorate(null, null, _labels_decorators, { kind: "field", name: "labels", static: false, private: false, access: { has: obj => "labels" in obj, get: obj => obj.labels, set: (obj, value) => { obj.labels = value; } }, metadata: _metadata }, _labels_initializers, _labels_extraInitializers);
105
+ __esDecorate(null, null, _options_decorators, { kind: "field", name: "options", static: false, private: false, access: { has: obj => "options" in obj, get: obj => obj.options, set: (obj, value) => { obj.options = value; } }, metadata: _metadata }, _options_initializers, _options_extraInitializers);
106
+ __esDecorate(null, null, _width_decorators, { kind: "field", name: "width", static: false, private: false, access: { has: obj => "width" in obj, get: obj => obj.width, set: (obj, value) => { obj.width = value; } }, metadata: _metadata }, _width_initializers, _width_extraInitializers);
107
+ __esDecorate(null, null, _height_decorators, { kind: "field", name: "height", static: false, private: false, access: { has: obj => "height" in obj, get: obj => obj.height, set: (obj, value) => { obj.height = value; } }, metadata: _metadata }, _height_initializers, _height_extraInitializers);
108
+ __esDecorate(null, null, _renderTrigger_decorators, { kind: "field", name: "renderTrigger", static: false, private: false, access: { has: obj => "renderTrigger" in obj, get: obj => obj.renderTrigger, set: (obj, value) => { obj.renderTrigger = value; } }, metadata: _metadata }, _renderTrigger_initializers, _renderTrigger_extraInitializers);
109
+ __esDecorate(null, null, _canvasElement_decorators, { kind: "field", name: "canvasElement", static: false, private: false, access: { has: obj => "canvasElement" in obj, get: obj => obj.canvasElement, set: (obj, value) => { obj.canvasElement = value; } }, metadata: _metadata }, _canvasElement_initializers, _canvasElement_extraInitializers);
110
+ __esDecorate(null, null, _tooltipVisible_decorators, { kind: "field", name: "tooltipVisible", static: false, private: false, access: { has: obj => "tooltipVisible" in obj, get: obj => obj.tooltipVisible, set: (obj, value) => { obj.tooltipVisible = value; } }, metadata: _metadata }, _tooltipVisible_initializers, _tooltipVisible_extraInitializers);
111
+ __esDecorate(null, null, _tooltipContent_decorators, { kind: "field", name: "tooltipContent", static: false, private: false, access: { has: obj => "tooltipContent" in obj, get: obj => obj.tooltipContent, set: (obj, value) => { obj.tooltipContent = value; } }, metadata: _metadata }, _tooltipContent_initializers, _tooltipContent_extraInitializers);
112
+ __esDecorate(null, null, _tooltipX_decorators, { kind: "field", name: "tooltipX", static: false, private: false, access: { has: obj => "tooltipX" in obj, get: obj => obj.tooltipX, set: (obj, value) => { obj.tooltipX = value; } }, metadata: _metadata }, _tooltipX_initializers, _tooltipX_extraInitializers);
113
+ __esDecorate(null, null, _tooltipY_decorators, { kind: "field", name: "tooltipY", static: false, private: false, access: { has: obj => "tooltipY" in obj, get: obj => obj.tooltipY, set: (obj, value) => { obj.tooltipY = value; } }, metadata: _metadata }, _tooltipY_initializers, _tooltipY_extraInitializers);
114
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
115
+ _classThis = _classDescriptor.value;
116
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
117
+ __runInitializers(_classThis, _classExtraInitializers);
118
+ }
119
+ styles() {
120
+ return css /*css*/ `${chartStyles}`;
121
+ }
122
+ render() {
123
+ const legendPosition = this.options.legend?.position || 'top';
124
+ const animated = this.options.animation?.enabled !== false;
125
+ // Draw chart after render
126
+ requestAnimationFrame(() => this.initAndDrawChart());
127
+ return html /*html*/ `
128
+ <div class="chart-container ${animated ? 'animated' : ''}">
129
+ ${legendPosition !== 'none' ? this.renderLegend() : ''}
130
+ <div class="chart-canvas">
131
+ <canvas class="chart-render-canvas"></canvas>
132
+ </div>
133
+ <div class="chart-tooltip ${this.tooltipVisible ? 'visible' : ''}"
134
+ style="left: ${this.tooltipX}px; top: ${this.tooltipY}px;">
135
+ ${this.tooltipContent}
136
+ </div>
137
+ </div>
138
+ `;
139
+ }
140
+ renderLegend() {
141
+ const position = this.options.legend?.position || 'top';
142
+ return html /*html*/ `
143
+ <div class="chart-legend legend-${position}">
144
+ ${this.datasets.map((dataset, index) => html `
145
+ <div class="legend-item ${this.hiddenDatasets.has(index) ? 'hidden' : ''}"
146
+ @click=${() => this.handleLegendClick(index)}>
147
+ <div class="legend-color" style="background: ${this.getDatasetColor(dataset, index)};"></div>
148
+ <span class="legend-label">${dataset.label}</span>
149
+ </div>
150
+ `)}
151
+ </div>
152
+ `;
153
+ }
154
+ initAndDrawChart() {
155
+ this.canvas = this.canvasElement || null;
156
+ if (!this.canvas)
157
+ return;
158
+ const width = this.width || this.offsetWidth || 600;
159
+ const height = this.height || this.offsetHeight || 400;
160
+ this.canvas.width = width;
161
+ this.canvas.height = height;
162
+ this.canvas.style.width = `${width}px`;
163
+ this.canvas.style.height = `${height}px`;
164
+ try {
165
+ this.ctx = this.canvas.getContext('2d');
166
+ }
167
+ catch (e) {
168
+ // Canvas not supported in test environment
169
+ return;
170
+ }
171
+ if (!this.ctx || !this.datasets.length)
172
+ return;
173
+ // Clear canvas
174
+ this.ctx.clearRect(0, 0, width, height);
175
+ const chartType = this.type;
176
+ switch (chartType) {
177
+ case 'pie':
178
+ case 'donut':
179
+ this.drawPieChart(width, height, chartType === 'donut');
180
+ break;
181
+ case 'radar':
182
+ this.drawRadarChart(width, height);
183
+ break;
184
+ default:
185
+ this.drawCartesianChart(width, height);
186
+ }
187
+ }
188
+ drawCartesianChart(width, height) {
189
+ if (!this.ctx)
190
+ return;
191
+ const padding = { top: 40, right: 40, bottom: 60, left: 60 };
192
+ const chartWidth = width - padding.left - padding.right;
193
+ const chartHeight = height - padding.top - padding.bottom;
194
+ const { min: yMin, max: yMax } = this.getYAxisRange();
195
+ const xCount = this.getXAxisCount();
196
+ // Draw grid
197
+ this.drawGrid(padding, chartWidth, chartHeight, yMin, yMax, xCount);
198
+ // Draw axes
199
+ this.drawAxes(padding, chartWidth, chartHeight, yMin, yMax, xCount);
200
+ // Draw datasets
201
+ this.ctx.save();
202
+ this.ctx.translate(padding.left, padding.top);
203
+ this.datasets.forEach((dataset, index) => {
204
+ if (this.hiddenDatasets.has(index))
205
+ return;
206
+ this.drawDataset(dataset, index, chartWidth, chartHeight, yMin, yMax, xCount);
207
+ });
208
+ this.ctx.restore();
209
+ }
210
+ drawGrid(padding, chartWidth, chartHeight, yMin, yMax, xCount) {
211
+ if (!this.ctx || (!this.options.xAxis?.grid && !this.options.yAxis?.grid))
212
+ return;
213
+ this.ctx.strokeStyle = '#e0e0e0';
214
+ this.ctx.lineWidth = 1;
215
+ const yTicks = this.options.yAxis?.ticks || 5;
216
+ if (this.options.yAxis?.grid) {
217
+ for (let i = 0; i <= yTicks; i++) {
218
+ const y = padding.top + (chartHeight / yTicks) * i;
219
+ this.ctx.beginPath();
220
+ this.ctx.moveTo(padding.left, y);
221
+ this.ctx.lineTo(padding.left + chartWidth, y);
222
+ this.ctx.stroke();
223
+ }
224
+ }
225
+ if (this.options.xAxis?.grid) {
226
+ for (let i = 0; i <= xCount; i++) {
227
+ const x = padding.left + (chartWidth / xCount) * i;
228
+ this.ctx.beginPath();
229
+ this.ctx.moveTo(x, padding.top);
230
+ this.ctx.lineTo(x, padding.top + chartHeight);
231
+ this.ctx.stroke();
232
+ }
233
+ }
234
+ }
235
+ drawAxes(padding, chartWidth, chartHeight, yMin, yMax, xCount) {
236
+ if (!this.ctx)
237
+ return;
238
+ this.ctx.strokeStyle = '#333';
239
+ this.ctx.lineWidth = 2;
240
+ // Y axis
241
+ this.ctx.beginPath();
242
+ this.ctx.moveTo(padding.left, padding.top);
243
+ this.ctx.lineTo(padding.left, padding.top + chartHeight);
244
+ this.ctx.stroke();
245
+ // X axis
246
+ this.ctx.beginPath();
247
+ this.ctx.moveTo(padding.left, padding.top + chartHeight);
248
+ this.ctx.lineTo(padding.left + chartWidth, padding.top + chartHeight);
249
+ this.ctx.stroke();
250
+ // Y axis labels
251
+ this.ctx.fillStyle = '#666';
252
+ this.ctx.font = '12px sans-serif';
253
+ this.ctx.textAlign = 'right';
254
+ this.ctx.textBaseline = 'middle';
255
+ const yTicks = this.options.yAxis?.ticks || 5;
256
+ for (let i = 0; i <= yTicks; i++) {
257
+ const value = yMax - (yMax - yMin) / yTicks * i;
258
+ const y = padding.top + (chartHeight / yTicks) * i;
259
+ this.ctx.fillText(value.toFixed(1), padding.left - 10, y);
260
+ }
261
+ // X axis labels - align with line chart points
262
+ this.ctx.textAlign = 'center';
263
+ this.ctx.textBaseline = 'top';
264
+ const numLabels = this.labels.length;
265
+ if (numLabels > 0) {
266
+ const spacing = chartWidth / (numLabels - 1 || 1);
267
+ for (let i = 0; i < numLabels; i++) {
268
+ const x = padding.left + spacing * i;
269
+ const label = this.labels[i] || i.toString();
270
+ this.ctx.fillText(label, x, padding.top + chartHeight + 10);
271
+ }
272
+ }
273
+ }
274
+ drawDataset(dataset, datasetIndex, chartWidth, chartHeight, yMin, yMax, xCount) {
275
+ const chartType = dataset.type || this.type;
276
+ switch (chartType) {
277
+ case 'line':
278
+ this.drawLineDataset(dataset, datasetIndex, chartWidth, chartHeight, yMin, yMax);
279
+ break;
280
+ case 'area':
281
+ this.drawAreaDataset(dataset, datasetIndex, chartWidth, chartHeight, yMin, yMax);
282
+ break;
283
+ case 'bar':
284
+ this.drawBarDataset(dataset, datasetIndex, chartWidth, chartHeight, yMin, yMax, xCount);
285
+ break;
286
+ case 'scatter':
287
+ this.drawScatterDataset(dataset, datasetIndex, chartWidth, chartHeight, yMin, yMax);
288
+ break;
289
+ }
290
+ }
291
+ drawLineDataset(dataset, datasetIndex, chartWidth, chartHeight, yMin, yMax) {
292
+ if (!this.ctx)
293
+ return;
294
+ const points = this.getDataPoints(dataset, chartWidth, chartHeight, yMin, yMax);
295
+ const color = this.getDatasetColor(dataset, datasetIndex);
296
+ const borderWidth = dataset.borderWidth || 2;
297
+ const pointRadius = dataset.pointRadius !== undefined ? dataset.pointRadius : 4;
298
+ if (points.length === 0)
299
+ return;
300
+ // Draw line
301
+ this.ctx.strokeStyle = dataset.borderColor || color;
302
+ this.ctx.lineWidth = borderWidth;
303
+ this.ctx.beginPath();
304
+ this.ctx.moveTo(points[0].x, points[0].y);
305
+ points.slice(1).forEach(p => this.ctx.lineTo(p.x, p.y));
306
+ this.ctx.stroke();
307
+ // Draw points
308
+ this.ctx.fillStyle = color;
309
+ points.forEach(p => {
310
+ this.ctx.beginPath();
311
+ this.ctx.arc(p.x, p.y, pointRadius, 0, Math.PI * 2);
312
+ this.ctx.fill();
313
+ });
314
+ }
315
+ drawAreaDataset(dataset, datasetIndex, chartWidth, chartHeight, yMin, yMax) {
316
+ if (!this.ctx)
317
+ return;
318
+ const points = this.getDataPoints(dataset, chartWidth, chartHeight, yMin, yMax);
319
+ const color = this.getDatasetColor(dataset, datasetIndex);
320
+ if (points.length === 0)
321
+ return;
322
+ // Draw filled area
323
+ const bgColor = dataset.backgroundColor;
324
+ this.ctx.fillStyle = (Array.isArray(bgColor) ? bgColor[0] : bgColor) || color;
325
+ this.ctx.globalAlpha = 0.3;
326
+ this.ctx.beginPath();
327
+ this.ctx.moveTo(points[0].x, chartHeight);
328
+ this.ctx.lineTo(points[0].x, points[0].y);
329
+ points.slice(1).forEach(p => this.ctx.lineTo(p.x, p.y));
330
+ this.ctx.lineTo(points[points.length - 1].x, chartHeight);
331
+ this.ctx.closePath();
332
+ this.ctx.fill();
333
+ this.ctx.globalAlpha = 1;
334
+ // Draw line
335
+ this.drawLineDataset(dataset, datasetIndex, chartWidth, chartHeight, yMin, yMax);
336
+ }
337
+ drawBarDataset(dataset, datasetIndex, chartWidth, chartHeight, yMin, yMax, xCount) {
338
+ if (!this.ctx)
339
+ return;
340
+ const color = this.getDatasetColor(dataset, datasetIndex);
341
+ const visibleCount = this.datasets.filter((_, i) => !this.hiddenDatasets.has(i)).length;
342
+ const visibleDatasets = this.datasets.filter((_, i) => !this.hiddenDatasets.has(i));
343
+ const datasetOffset = visibleDatasets.indexOf(dataset);
344
+ const numBars = dataset.data.length;
345
+ const spacing = chartWidth / Math.max(numBars - 1, 1);
346
+ const maxBarGroupWidth = spacing * 0.6;
347
+ const barGroupWidth = Math.min(maxBarGroupWidth, 80);
348
+ const singleBarWidth = barGroupWidth / visibleCount;
349
+ dataset.data.forEach((value, index) => {
350
+ const y = typeof value === 'number' ? value : value.y || 0;
351
+ const barHeight = ((y - yMin) / (yMax - yMin)) * chartHeight;
352
+ const labelX = spacing * index;
353
+ let x = labelX - barGroupWidth / 2 + datasetOffset * singleBarWidth;
354
+ if (x < 0)
355
+ x = 0;
356
+ if (x + singleBarWidth > chartWidth)
357
+ x = chartWidth - singleBarWidth;
358
+ const barY = chartHeight - barHeight;
359
+ this.ctx.fillStyle = Array.isArray(dataset.backgroundColor)
360
+ ? dataset.backgroundColor[index % dataset.backgroundColor.length]
361
+ : color;
362
+ this.ctx.fillRect(x, barY, singleBarWidth, barHeight);
363
+ });
364
+ }
365
+ drawScatterDataset(dataset, datasetIndex, chartWidth, chartHeight, yMin, yMax) {
366
+ this.drawLineDataset(dataset, datasetIndex, chartWidth, chartHeight, yMin, yMax);
367
+ }
368
+ drawPieChart(width, height, isDonut) {
369
+ if (!this.ctx || !this.datasets[0])
370
+ return;
371
+ const centerX = width / 2;
372
+ const centerY = height / 2;
373
+ const radius = Math.min(width, height) / 2 - 40;
374
+ const innerRadius = isDonut ? radius * 0.6 : 0;
375
+ const dataset = this.datasets[0];
376
+ const total = dataset.data.reduce((sum, val) => {
377
+ const numVal = typeof val === 'number' ? val : 0;
378
+ return sum + numVal;
379
+ }, 0);
380
+ let currentAngle = -Math.PI / 2;
381
+ dataset.data.forEach((value, index) => {
382
+ const val = typeof value === 'number' ? value : 0;
383
+ const angle = total > 0 ? (val / total) * 2 * Math.PI : 0;
384
+ const endAngle = currentAngle + angle;
385
+ const color = Array.isArray(dataset.backgroundColor)
386
+ ? dataset.backgroundColor[index % dataset.backgroundColor.length]
387
+ : DEFAULT_COLORS[index % DEFAULT_COLORS.length];
388
+ this.ctx.fillStyle = color;
389
+ this.ctx.beginPath();
390
+ this.ctx.arc(centerX, centerY, radius, currentAngle, endAngle);
391
+ if (isDonut) {
392
+ this.ctx.arc(centerX, centerY, innerRadius, endAngle, currentAngle, true);
393
+ }
394
+ else {
395
+ this.ctx.lineTo(centerX, centerY);
396
+ }
397
+ this.ctx.closePath();
398
+ this.ctx.fill();
399
+ currentAngle = endAngle;
400
+ });
401
+ }
402
+ drawRadarChart(width, height) {
403
+ if (!this.ctx)
404
+ return;
405
+ const centerX = width / 2;
406
+ const centerY = height / 2;
407
+ const radius = Math.min(width, height) / 2 - 60;
408
+ const numPoints = this.labels.length || this.datasets[0]?.data.length || 3;
409
+ const angleStep = (2 * Math.PI) / numPoints;
410
+ const maxValue = Math.max(...this.datasets.flatMap(d => d.data.map(v => typeof v === 'number' ? v : 0)));
411
+ // Draw grid
412
+ this.ctx.strokeStyle = '#e0e0e0';
413
+ [0.2, 0.4, 0.6, 0.8, 1].forEach(ratio => {
414
+ const r = radius * ratio;
415
+ this.ctx.beginPath();
416
+ for (let i = 0; i <= numPoints; i++) {
417
+ const angle = i * angleStep - Math.PI / 2;
418
+ const x = centerX + Math.cos(angle) * r;
419
+ const y = centerY + Math.sin(angle) * r;
420
+ if (i === 0) {
421
+ this.ctx.moveTo(x, y);
422
+ }
423
+ else {
424
+ this.ctx.lineTo(x, y);
425
+ }
426
+ }
427
+ this.ctx.closePath();
428
+ this.ctx.stroke();
429
+ });
430
+ // Draw axes
431
+ for (let i = 0; i < numPoints; i++) {
432
+ const angle = i * angleStep - Math.PI / 2;
433
+ const x = centerX + Math.cos(angle) * radius;
434
+ const y = centerY + Math.sin(angle) * radius;
435
+ this.ctx.beginPath();
436
+ this.ctx.moveTo(centerX, centerY);
437
+ this.ctx.lineTo(x, y);
438
+ this.ctx.stroke();
439
+ // Labels
440
+ this.ctx.fillStyle = '#666';
441
+ this.ctx.font = '12px sans-serif';
442
+ this.ctx.textAlign = 'center';
443
+ this.ctx.fillText(this.labels[i] || i.toString(), x, y);
444
+ }
445
+ // Draw data
446
+ this.datasets.forEach((dataset, datasetIndex) => {
447
+ if (this.hiddenDatasets.has(datasetIndex))
448
+ return;
449
+ const color = this.getDatasetColor(dataset, datasetIndex);
450
+ this.ctx.fillStyle = color;
451
+ this.ctx.globalAlpha = 0.3;
452
+ this.ctx.beginPath();
453
+ dataset.data.forEach((value, index) => {
454
+ const val = typeof value === 'number' ? value : 0;
455
+ const angle = index * angleStep - Math.PI / 2;
456
+ const r = (val / maxValue) * radius;
457
+ const x = centerX + Math.cos(angle) * r;
458
+ const y = centerY + Math.sin(angle) * r;
459
+ if (index === 0) {
460
+ this.ctx.moveTo(x, y);
461
+ }
462
+ else {
463
+ this.ctx.lineTo(x, y);
464
+ }
465
+ });
466
+ this.ctx.closePath();
467
+ this.ctx.fill();
468
+ this.ctx.globalAlpha = 1;
469
+ this.ctx.strokeStyle = dataset.borderColor || color;
470
+ this.ctx.lineWidth = dataset.borderWidth || 2;
471
+ this.ctx.stroke();
472
+ });
473
+ }
474
+ renderCartesianChartSVG() {
475
+ const padding = { top: 40, right: 40, bottom: 60, left: 60 };
476
+ const width = this.width || this.offsetWidth || 600;
477
+ const height = this.height || this.offsetHeight || 400;
478
+ const chartWidth = width - padding.left - padding.right;
479
+ const chartHeight = height - padding.top - padding.bottom;
480
+ const { min: yMin, max: yMax } = this.getYAxisRange();
481
+ const xCount = this.getXAxisCount();
482
+ const gridSVG = this.renderCartesianGridSVG(padding, chartWidth, chartHeight, yMin, yMax, xCount);
483
+ const axesSVG = this.renderCartesianAxesSVG(padding, chartWidth, chartHeight, yMin, yMax, xCount);
484
+ const datasetsSVG = this.datasets
485
+ .map((dataset, index) => this.hiddenDatasets.has(index) ? '' :
486
+ this.renderDatasetSVG(dataset, index, chartWidth, chartHeight, yMin, yMax, xCount))
487
+ .join('');
488
+ return `
489
+ <svg width="${width}" height="${height}" viewBox="0 0 ${width} ${height}">
490
+ ${gridSVG}
491
+ ${axesSVG}
492
+ <g transform="translate(${padding.left}, ${padding.top})">
493
+ ${datasetsSVG}
494
+ </g>
495
+ </svg>
496
+ `;
497
+ }
498
+ renderCartesianGridSVG(padding, chartWidth, chartHeight, yMin, yMax, xCount) {
499
+ if (!this.options.xAxis?.grid && !this.options.yAxis?.grid)
500
+ return '';
501
+ const yTicks = this.options.yAxis?.ticks || 5;
502
+ let gridSVG = '';
503
+ if (this.options.yAxis?.grid) {
504
+ for (let i = 0; i <= yTicks; i++) {
505
+ const y = padding.top + (chartHeight / yTicks) * i;
506
+ gridSVG += `<line class="grid-line" x1="${padding.left}" y1="${y}" x2="${padding.left + chartWidth}" y2="${y}" stroke="#e0e0e0" />`;
507
+ }
508
+ }
509
+ if (this.options.xAxis?.grid) {
510
+ for (let i = 0; i <= xCount; i++) {
511
+ const x = padding.left + (chartWidth / xCount) * i;
512
+ gridSVG += `<line class="grid-line" x1="${x}" y1="${padding.top}" x2="${x}" y2="${padding.top + chartHeight}" stroke="#e0e0e0" />`;
513
+ }
514
+ }
515
+ return gridSVG;
516
+ }
517
+ renderCartesianAxesSVG(padding, chartWidth, chartHeight, yMin, yMax, xCount) {
518
+ const yTicks = this.options.yAxis?.ticks || 5;
519
+ let axesSVG = '';
520
+ // Y axis
521
+ axesSVG += `<line class="axis-line" x1="${padding.left}" y1="${padding.top}" x2="${padding.left}" y2="${padding.top + chartHeight}" stroke="#333" />`;
522
+ // Y axis labels
523
+ for (let i = 0; i <= yTicks; i++) {
524
+ const value = yMax - (yMax - yMin) / yTicks * i;
525
+ const y = padding.top + (chartHeight / yTicks) * i;
526
+ axesSVG += `<text class="axis-label" x="${padding.left - 10}" y="${y}" text-anchor="end" alignment-baseline="middle" fill="#666" font-size="12">${value.toFixed(1)}</text>`;
527
+ }
528
+ // X axis
529
+ axesSVG += `<line class="axis-line" x1="${padding.left}" y1="${padding.top + chartHeight}" x2="${padding.left + chartWidth}" y2="${padding.top + chartHeight}" stroke="#333" />`;
530
+ // X axis labels
531
+ for (let i = 0; i <= xCount; i++) {
532
+ const x = padding.left + (chartWidth / xCount) * i;
533
+ const label = this.labels[i] || i.toString();
534
+ axesSVG += `<text class="axis-label" x="${x}" y="${padding.top + chartHeight + 20}" text-anchor="middle" fill="#666" font-size="12">${label}</text>`;
535
+ }
536
+ return axesSVG;
537
+ }
538
+ renderDatasetSVG(dataset, datasetIndex, chartWidth, chartHeight, yMin, yMax, xCount) {
539
+ const chartType = dataset.type || this.type;
540
+ switch (chartType) {
541
+ case 'line':
542
+ return this.renderLineDatasetSVG(dataset, datasetIndex, chartWidth, chartHeight, yMin, yMax);
543
+ case 'area':
544
+ return this.renderAreaDatasetSVG(dataset, datasetIndex, chartWidth, chartHeight, yMin, yMax);
545
+ case 'bar':
546
+ return this.renderBarDatasetSVG(dataset, datasetIndex, chartWidth, chartHeight, yMin, yMax, xCount);
547
+ case 'scatter':
548
+ return this.renderScatterDatasetSVG(dataset, datasetIndex, chartWidth, chartHeight, yMin, yMax);
549
+ case 'bubble':
550
+ return this.renderBubbleDatasetSVG(dataset, datasetIndex, chartWidth, chartHeight, yMin, yMax);
551
+ default:
552
+ return this.renderLineDatasetSVG(dataset, datasetIndex, chartWidth, chartHeight, yMin, yMax);
553
+ }
554
+ }
555
+ renderLineDatasetSVG(dataset, datasetIndex, chartWidth, chartHeight, yMin, yMax) {
556
+ const points = this.getDataPoints(dataset, chartWidth, chartHeight, yMin, yMax);
557
+ const color = this.getDatasetColor(dataset, datasetIndex);
558
+ const borderWidth = dataset.borderWidth || 2;
559
+ const pointRadius = dataset.pointRadius !== undefined ? dataset.pointRadius : 4;
560
+ if (points.length === 0)
561
+ return '';
562
+ const pathD = `M ${points.map(p => `${p.x} ${p.y}`).join(' L ')}`;
563
+ const circlesSVG = points.map(p => `<circle cx="${p.x}" cy="${p.y}" r="${pointRadius}" fill="${color}" />`).join('');
564
+ return `<path d="${pathD}" fill="none" stroke="${dataset.borderColor || color}" stroke-width="${borderWidth}" />${circlesSVG}`;
565
+ }
566
+ renderAreaDatasetSVG(dataset, datasetIndex, chartWidth, chartHeight, yMin, yMax) {
567
+ return this.renderLineDatasetSVG(dataset, datasetIndex, chartWidth, chartHeight, yMin, yMax);
568
+ }
569
+ renderBarDatasetSVG(dataset, datasetIndex, chartWidth, chartHeight, yMin, yMax, xCount) {
570
+ const color = this.getDatasetColor(dataset, datasetIndex);
571
+ const barWidth = (chartWidth / xCount) * 0.8 / this.datasets.filter((_, i) => !this.hiddenDatasets.has(i)).length;
572
+ return dataset.data.map((value, index) => {
573
+ const y = typeof value === 'number' ? value : value.y || 0;
574
+ const barHeight = ((y - yMin) / (yMax - yMin)) * chartHeight;
575
+ const x = (chartWidth / xCount) * index;
576
+ const barY = chartHeight - barHeight;
577
+ return `<rect x="${x}" y="${barY}" width="${barWidth}" height="${barHeight}" fill="${color}" />`;
578
+ }).join('');
579
+ }
580
+ renderScatterDatasetSVG(dataset, datasetIndex, chartWidth, chartHeight, yMin, yMax) {
581
+ return this.renderLineDatasetSVG(dataset, datasetIndex, chartWidth, chartHeight, yMin, yMax);
582
+ }
583
+ renderBubbleDatasetSVG(dataset, datasetIndex, chartWidth, chartHeight, yMin, yMax) {
584
+ return this.renderLineDatasetSVG(dataset, datasetIndex, chartWidth, chartHeight, yMin, yMax);
585
+ }
586
+ renderPieChartSVG(isDonut) {
587
+ return '<svg width="600" height="400"><text x="300" y="200" text-anchor="middle">Pie chart placeholder</text></svg>';
588
+ }
589
+ renderRadarChartSVG() {
590
+ return '<svg width="600" height="400"><text x="300" y="200" text-anchor="middle">Radar chart placeholder</text></svg>';
591
+ }
592
+ renderLineDataset(dataset, datasetIndex, chartWidth, chartHeight, yMin, yMax) {
593
+ const points = this.getDataPoints(dataset, chartWidth, chartHeight, yMin, yMax);
594
+ const color = this.getDatasetColor(dataset, datasetIndex);
595
+ const borderWidth = dataset.borderWidth || 2;
596
+ const pointRadius = dataset.pointRadius !== undefined ? dataset.pointRadius : 4;
597
+ const tension = dataset.tension || 0;
598
+ let pathD = '';
599
+ if (points.length > 0) {
600
+ pathD = `M ${points[0].x} ${points[0].y}`;
601
+ if (tension > 0) {
602
+ // Smooth curve
603
+ for (let i = 1; i < points.length; i++) {
604
+ const prev = points[i - 1];
605
+ const curr = points[i];
606
+ const cpx = prev.x + (curr.x - prev.x) * 0.5;
607
+ pathD += ` Q ${cpx} ${prev.y}, ${cpx} ${curr.y}`;
608
+ pathD += ` Q ${cpx} ${curr.y}, ${curr.x} ${curr.y}`;
609
+ }
610
+ }
611
+ else {
612
+ // Straight lines
613
+ points.slice(1).forEach(p => {
614
+ pathD += ` L ${p.x} ${p.y}`;
615
+ });
616
+ }
617
+ }
618
+ return html /*html*/ `
619
+ <path class="chart-path"
620
+ d="${pathD}"
621
+ fill="none"
622
+ stroke="${dataset.borderColor || color}"
623
+ stroke-width="${borderWidth}" />
624
+ ${points.map((p, i) => html `
625
+ <circle class="data-point"
626
+ cx="${p.x}"
627
+ cy="${p.y}"
628
+ r="${pointRadius}"
629
+ fill="${color}"
630
+ @mouseenter=${(e) => this.showTooltip(dataset, i, e)}
631
+ @mouseleave=${() => this.hideTooltip()} />
632
+ `)}
633
+ `;
634
+ }
635
+ renderAreaDataset(dataset, datasetIndex, chartWidth, chartHeight, yMin, yMax) {
636
+ const points = this.getDataPoints(dataset, chartWidth, chartHeight, yMin, yMax);
637
+ const color = this.getDatasetColor(dataset, datasetIndex);
638
+ const borderWidth = dataset.borderWidth || 2;
639
+ if (points.length === 0)
640
+ return '';
641
+ let pathD = `M ${points[0].x} ${chartHeight}`;
642
+ pathD += ` L ${points[0].x} ${points[0].y}`;
643
+ points.slice(1).forEach(p => {
644
+ pathD += ` L ${p.x} ${p.y}`;
645
+ });
646
+ pathD += ` L ${points[points.length - 1].x} ${chartHeight} Z`;
647
+ const lineD = points.map((p, i) => i === 0 ? `M ${p.x} ${p.y}` : `L ${p.x} ${p.y}`).join(' ');
648
+ return html /*html*/ `
649
+ <path class="chart-path"
650
+ d="${pathD}"
651
+ fill="${dataset.backgroundColor || color}"
652
+ fill-opacity="0.3" />
653
+ <path class="chart-path"
654
+ d="${lineD}"
655
+ fill="none"
656
+ stroke="${dataset.borderColor || color}"
657
+ stroke-width="${borderWidth}" />
658
+ `;
659
+ }
660
+ renderBarDataset(dataset, datasetIndex, chartWidth, chartHeight, yMin, yMax, xCount) {
661
+ const color = this.getDatasetColor(dataset, datasetIndex);
662
+ const barWidth = (chartWidth / xCount) * 0.8 / this.datasets.filter((_, i) => !this.hiddenDatasets.has(i)).length;
663
+ const visibleDatasets = this.datasets.filter((_, i) => !this.hiddenDatasets.has(i));
664
+ const datasetOffset = visibleDatasets.indexOf(dataset);
665
+ return html /*html*/ `
666
+ ${dataset.data.map((value, index) => {
667
+ const y = typeof value === 'number' ? value : value.y || 0;
668
+ const barHeight = ((y - yMin) / (yMax - yMin)) * chartHeight;
669
+ const x = (chartWidth / xCount) * index + datasetOffset * barWidth + (chartWidth / xCount) * 0.1;
670
+ const barY = chartHeight - barHeight;
671
+ return html /*html*/ `
672
+ <rect class="chart-bar"
673
+ x="${x}"
674
+ y="${barY}"
675
+ width="${barWidth}"
676
+ height="${barHeight}"
677
+ fill="${Array.isArray(dataset.backgroundColor) ? dataset.backgroundColor[index % dataset.backgroundColor.length] : color}"
678
+ @mouseenter=${(e) => this.showTooltip(dataset, index, e)}
679
+ @mouseleave=${() => this.hideTooltip()} />
680
+ `;
681
+ })}
682
+ `;
683
+ }
684
+ renderBarChart(horizontal) {
685
+ // Similar to renderBarDataset but with swapped axes
686
+ return this.renderCartesianChartSVG();
687
+ }
688
+ renderScatterDataset(dataset, datasetIndex, chartWidth, chartHeight, yMin, yMax) {
689
+ const color = this.getDatasetColor(dataset, datasetIndex);
690
+ const pointRadius = dataset.pointRadius !== undefined ? dataset.pointRadius : 4;
691
+ return html /*html*/ `
692
+ ${dataset.data.map((value, index) => {
693
+ const point = typeof value === 'object' ? value : { x: index, y: value };
694
+ const x = typeof point.x === 'number' ? (point.x / (this.getXAxisCount())) * chartWidth : 0;
695
+ const y = chartHeight - ((point.y - yMin) / (yMax - yMin)) * chartHeight;
696
+ return html /*html*/ `
697
+ <circle class="data-point"
698
+ cx="${x}"
699
+ cy="${y}"
700
+ r="${pointRadius}"
701
+ fill="${color}"
702
+ @mouseenter=${(e) => this.showTooltip(dataset, index, e)}
703
+ @mouseleave=${() => this.hideTooltip()} />
704
+ `;
705
+ })}
706
+ `;
707
+ }
708
+ renderBubbleDataset(dataset, datasetIndex, chartWidth, chartHeight, yMin, yMax) {
709
+ const color = this.getDatasetColor(dataset, datasetIndex);
710
+ const maxR = Math.max(...dataset.data.map(v => typeof v === 'object' ? v.r || 5 : 5));
711
+ return html /*html*/ `
712
+ ${dataset.data.map((value, index) => {
713
+ const point = value;
714
+ const x = typeof point.x === 'number' ? (point.x / this.getXAxisCount()) * chartWidth : 0;
715
+ const y = chartHeight - ((point.y - yMin) / (yMax - yMin)) * chartHeight;
716
+ const r = ((point.r || 5) / maxR) * 20;
717
+ return html /*html*/ `
718
+ <circle class="data-point"
719
+ cx="${x}"
720
+ cy="${y}"
721
+ r="${r}"
722
+ fill="${color}"
723
+ fill-opacity="0.6"
724
+ @mouseenter=${(e) => this.showTooltip(dataset, index, e)}
725
+ @mouseleave=${() => this.hideTooltip()} />
726
+ `;
727
+ })}
728
+ `;
729
+ }
730
+ renderPieChart(isDonut) {
731
+ const width = this.width || this.offsetWidth || 600;
732
+ const height = this.height || this.offsetHeight || 400;
733
+ const centerX = width / 2;
734
+ const centerY = height / 2;
735
+ const radius = Math.min(width, height) / 2 - 40;
736
+ const innerRadius = isDonut ? radius * 0.6 : 0;
737
+ const dataset = this.datasets[0];
738
+ if (!dataset)
739
+ return html /*html*/ `<svg></svg>`;
740
+ const total = dataset.data.reduce((sum, val) => {
741
+ const numVal = typeof val === 'number' ? val : 0;
742
+ return sum + numVal;
743
+ }, 0);
744
+ let currentAngle = -Math.PI / 2;
745
+ return html /*html*/ `
746
+ <svg width="${width}" height="${height}" viewBox="0 0 ${width} ${height}">
747
+ ${dataset.data.map((value, index) => {
748
+ const val = typeof value === 'number' ? value : 0;
749
+ const angle = total > 0 ? (val / total) * 2 * Math.PI : 0;
750
+ const endAngle = currentAngle + angle;
751
+ const x1 = centerX + Math.cos(currentAngle) * radius;
752
+ const y1 = centerY + Math.sin(currentAngle) * radius;
753
+ const x2 = centerX + Math.cos(endAngle) * radius;
754
+ const y2 = centerY + Math.sin(endAngle) * radius;
755
+ const largeArc = angle > Math.PI ? 1 : 0;
756
+ let pathD = `M ${centerX} ${centerY} L ${x1} ${y1} A ${radius} ${radius} 0 ${largeArc} 1 ${x2} ${y2} Z`;
757
+ if (isDonut) {
758
+ const ix1 = centerX + Math.cos(currentAngle) * innerRadius;
759
+ const iy1 = centerY + Math.sin(currentAngle) * innerRadius;
760
+ const ix2 = centerX + Math.cos(endAngle) * innerRadius;
761
+ const iy2 = centerY + Math.sin(endAngle) * innerRadius;
762
+ pathD = `M ${x1} ${y1} A ${radius} ${radius} 0 ${largeArc} 1 ${x2} ${y2} L ${ix2} ${iy2} A ${innerRadius} ${innerRadius} 0 ${largeArc} 0 ${ix1} ${iy1} Z`;
763
+ }
764
+ const color = Array.isArray(dataset.backgroundColor)
765
+ ? dataset.backgroundColor[index % dataset.backgroundColor.length]
766
+ : DEFAULT_COLORS[index % DEFAULT_COLORS.length];
767
+ const result = html `
768
+ <path class="chart-slice"
769
+ d="${pathD}"
770
+ fill="${color}"
771
+ @mouseenter=${(e) => this.showTooltip(dataset, index, e)}
772
+ @mouseleave=${() => this.hideTooltip()} />
773
+ `;
774
+ currentAngle = endAngle;
775
+ return result;
776
+ })}
777
+ </svg>
778
+ `;
779
+ }
780
+ renderRadarChart() {
781
+ const width = this.width || this.offsetWidth || 600;
782
+ const height = this.height || this.offsetHeight || 400;
783
+ const centerX = width / 2;
784
+ const centerY = height / 2;
785
+ const radius = Math.min(width, height) / 2 - 60;
786
+ const numPoints = this.labels.length || this.datasets[0]?.data.length || 3;
787
+ const angleStep = (2 * Math.PI) / numPoints;
788
+ const maxValue = Math.max(...this.datasets.flatMap(d => d.data.map(v => typeof v === 'number' ? v : 0)));
789
+ return html /*html*/ `
790
+ <svg width="${width}" height="${height}" viewBox="0 0 ${width} ${height}">
791
+ <!-- Radar grid -->
792
+ ${[0.2, 0.4, 0.6, 0.8, 1].map(ratio => {
793
+ const r = radius * ratio;
794
+ const points = Array.from({ length: numPoints }, (_, i) => {
795
+ const angle = i * angleStep - Math.PI / 2;
796
+ return `${centerX + Math.cos(angle) * r},${centerY + Math.sin(angle) * r}`;
797
+ }).join(' ');
798
+ return html /*html*/ `<polygon points="${points}" fill="none" stroke="#e0e0e0" />`;
799
+ })}
800
+
801
+ <!-- Axes -->
802
+ ${Array.from({ length: numPoints }, (_, i) => {
803
+ const angle = i * angleStep - Math.PI / 2;
804
+ const x = centerX + Math.cos(angle) * radius;
805
+ const y = centerY + Math.sin(angle) * radius;
806
+ return html /*html*/ `
807
+ <line class="grid-line" x1="${centerX}" y1="${centerY}" x2="${x}" y2="${y}" />
808
+ <text class="axis-label" x="${x}" y="${y}" text-anchor="middle">
809
+ ${this.labels[i] || i}
810
+ </text>
811
+ `;
812
+ })}
813
+
814
+ <!-- Data -->
815
+ ${this.datasets.map((dataset, datasetIndex) => {
816
+ if (this.hiddenDatasets.has(datasetIndex))
817
+ return '';
818
+ const points = dataset.data.map((value, index) => {
819
+ const val = typeof value === 'number' ? value : 0;
820
+ const angle = index * angleStep - Math.PI / 2;
821
+ const r = (val / maxValue) * radius;
822
+ return `${centerX + Math.cos(angle) * r},${centerY + Math.sin(angle) * r}`;
823
+ }).join(' ');
824
+ const color = this.getDatasetColor(dataset, datasetIndex);
825
+ return html /*html*/ `
826
+ <polygon class="chart-path"
827
+ points="${points}"
828
+ fill="${color}"
829
+ fill-opacity="0.3"
830
+ stroke="${dataset.borderColor || color}"
831
+ stroke-width="${dataset.borderWidth || 2}" />
832
+ `;
833
+ })}
834
+ </svg>
835
+ `;
836
+ }
837
+ getDataPoints(dataset, chartWidth, chartHeight, yMin, yMax) {
838
+ return dataset.data.map((value, index) => {
839
+ const y = typeof value === 'number' ? value : value.y || 0;
840
+ return {
841
+ x: (chartWidth / (dataset.data.length - 1 || 1)) * index,
842
+ y: chartHeight - ((y - yMin) / (yMax - yMin)) * chartHeight
843
+ };
844
+ });
845
+ }
846
+ getYAxisRange() {
847
+ const allValues = this.datasets.flatMap((dataset, index) => this.hiddenDatasets.has(index) ? [] :
848
+ dataset.data.map(v => typeof v === 'number' ? v : v.y || 0));
849
+ const min = this.options.yAxis?.min !== undefined ? this.options.yAxis.min : Math.min(0, ...allValues);
850
+ const max = this.options.yAxis?.max !== undefined ? this.options.yAxis.max : Math.max(...allValues);
851
+ return { min, max };
852
+ }
853
+ getXAxisCount() {
854
+ return Math.max(this.labels.length - 1, ...this.datasets.map(d => d.data.length - 1)) || 1;
855
+ }
856
+ getDatasetColor(dataset, index) {
857
+ if (dataset.backgroundColor && !Array.isArray(dataset.backgroundColor)) {
858
+ return dataset.backgroundColor;
859
+ }
860
+ if (dataset.borderColor) {
861
+ return dataset.borderColor;
862
+ }
863
+ return DEFAULT_COLORS[index % DEFAULT_COLORS.length];
864
+ }
865
+ handleLegendClick(index) {
866
+ if (!this.options.legend?.clickable)
867
+ return;
868
+ this.toggleDataset(index);
869
+ }
870
+ showTooltip(dataset, index, event) {
871
+ if (this.options.tooltip?.trigger === 'none')
872
+ return;
873
+ const value = dataset.data[index];
874
+ this.labels[index] || index;
875
+ let content = '';
876
+ if (this.options.tooltip?.format) {
877
+ content = this.options.tooltip.format(value, this.datasets.indexOf(dataset), index);
878
+ }
879
+ else {
880
+ const val = typeof value === 'number' ? value : value.y;
881
+ content = `${dataset.label}: ${val}`;
882
+ }
883
+ this.tooltipContent = content;
884
+ this.tooltipX = event.offsetX + 10;
885
+ this.tooltipY = event.offsetY - 30;
886
+ this.tooltipVisible = true;
887
+ }
888
+ hideTooltip() {
889
+ this.tooltipVisible = false;
890
+ }
891
+ refresh() {
892
+ // Force re-render by updating datasets reference
893
+ this.datasets = [...this.datasets];
894
+ }
895
+ update(datasets) {
896
+ this.datasets = datasets;
897
+ requestAnimationFrame(() => this.initAndDrawChart());
898
+ }
899
+ addDataset(dataset) {
900
+ this.datasets = [...this.datasets, dataset];
901
+ }
902
+ removeDataset(index) {
903
+ this.datasets = this.datasets.filter((_, i) => i !== index);
904
+ this.hiddenDatasets.delete(index);
905
+ }
906
+ toggleDataset(index) {
907
+ if (this.hiddenDatasets.has(index)) {
908
+ this.hiddenDatasets.delete(index);
909
+ }
910
+ else {
911
+ this.hiddenDatasets.add(index);
912
+ }
913
+ // Trigger re-render
914
+ this.renderTrigger++;
915
+ }
916
+ exportImage(format = 'svg') {
917
+ if (format === 'svg') {
918
+ // Return the last generated SVG content
919
+ if (!this.datasets.length)
920
+ return '';
921
+ const chartType = this.type;
922
+ switch (chartType) {
923
+ case 'pie':
924
+ case 'donut':
925
+ return this.renderPieChartSVG(chartType === 'donut');
926
+ case 'radar':
927
+ return this.renderRadarChartSVG();
928
+ default:
929
+ return this.renderCartesianChartSVG();
930
+ }
931
+ }
932
+ // For PNG, would need canvas conversion
933
+ return '';
934
+ }
935
+ getData() {
936
+ return {
937
+ datasets: this.datasets,
938
+ labels: this.labels
939
+ };
940
+ }
941
+ });
942
+ return _classThis;
943
+ })();
944
+
945
+ export { SniceChart };
946
+ //# sourceMappingURL=snice-chart.js.map