snice 4.8.0 → 4.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (315) hide show
  1. package/adapters/react/camera-annotate.d.ts +27 -0
  2. package/adapters/react/camera-annotate.d.ts.map +1 -0
  3. package/adapters/react/camera-annotate.js +24 -0
  4. package/adapters/react/camera-annotate.js.map +1 -0
  5. package/adapters/react/camera-annotate.tsx +35 -0
  6. package/adapters/react/candlestick.d.ts +34 -0
  7. package/adapters/react/candlestick.d.ts.map +1 -0
  8. package/adapters/react/candlestick.js +24 -0
  9. package/adapters/react/candlestick.js.map +1 -0
  10. package/adapters/react/candlestick.tsx +42 -0
  11. package/adapters/react/components.d.ts +14 -0
  12. package/adapters/react/components.d.ts.map +1 -1
  13. package/adapters/react/components.js +7 -0
  14. package/adapters/react/components.js.map +1 -1
  15. package/adapters/react/components.ts +14 -0
  16. package/adapters/react/funnel.d.ts +31 -0
  17. package/adapters/react/funnel.d.ts.map +1 -0
  18. package/adapters/react/funnel.js +24 -0
  19. package/adapters/react/funnel.js.map +1 -0
  20. package/adapters/react/funnel.tsx +39 -0
  21. package/adapters/react/network-graph.d.ts +32 -0
  22. package/adapters/react/network-graph.d.ts.map +1 -0
  23. package/adapters/react/network-graph.js +24 -0
  24. package/adapters/react/network-graph.js.map +1 -0
  25. package/adapters/react/network-graph.tsx +40 -0
  26. package/adapters/react/sankey.d.ts +31 -0
  27. package/adapters/react/sankey.d.ts.map +1 -0
  28. package/adapters/react/sankey.js +24 -0
  29. package/adapters/react/sankey.js.map +1 -0
  30. package/adapters/react/sankey.tsx +39 -0
  31. package/adapters/react/time-range-picker.d.ts +33 -0
  32. package/adapters/react/time-range-picker.d.ts.map +1 -0
  33. package/adapters/react/time-range-picker.js +24 -0
  34. package/adapters/react/time-range-picker.js.map +1 -0
  35. package/adapters/react/time-range-picker.tsx +41 -0
  36. package/adapters/react/treemap.d.ts +30 -0
  37. package/adapters/react/treemap.d.ts.map +1 -0
  38. package/adapters/react/treemap.js +24 -0
  39. package/adapters/react/treemap.js.map +1 -0
  40. package/adapters/react/treemap.tsx +38 -0
  41. package/adapters/react/virtual-scroller.d.ts +1 -0
  42. package/adapters/react/virtual-scroller.d.ts.map +1 -1
  43. package/adapters/react/virtual-scroller.js +1 -1
  44. package/adapters/react/virtual-scroller.js.map +1 -1
  45. package/adapters/react/virtual-scroller.tsx +2 -1
  46. package/dist/cdn/accordion/snice-accordion.js +1 -1
  47. package/dist/cdn/accordion/snice-accordion.min.js +1 -1
  48. package/dist/cdn/alert/snice-alert.js +1 -1
  49. package/dist/cdn/alert/snice-alert.min.js +1 -1
  50. package/dist/cdn/audio-recorder/snice-audio-recorder.js +1 -1
  51. package/dist/cdn/audio-recorder/snice-audio-recorder.min.js +1 -1
  52. package/dist/cdn/avatar/snice-avatar.js +1 -1
  53. package/dist/cdn/avatar/snice-avatar.min.js +1 -1
  54. package/dist/cdn/badge/snice-badge.js +1 -1
  55. package/dist/cdn/badge/snice-badge.min.js +1 -1
  56. package/dist/cdn/banner/snice-banner.js +1 -1
  57. package/dist/cdn/banner/snice-banner.min.js +1 -1
  58. package/dist/cdn/breadcrumbs/snice-breadcrumbs.js +2 -2
  59. package/dist/cdn/breadcrumbs/snice-breadcrumbs.js.map +1 -1
  60. package/dist/cdn/breadcrumbs/snice-breadcrumbs.min.js +13 -13
  61. package/dist/cdn/breadcrumbs/snice-breadcrumbs.min.js.map +1 -1
  62. package/dist/cdn/button/snice-button.js +1 -1
  63. package/dist/cdn/button/snice-button.min.js +1 -1
  64. package/dist/cdn/calendar/snice-calendar.js +1 -1
  65. package/dist/cdn/calendar/snice-calendar.min.js +1 -1
  66. package/dist/cdn/camera/snice-camera.js +1 -1
  67. package/dist/cdn/camera/snice-camera.min.js +1 -1
  68. package/dist/cdn/camera-annotate/README.md +27 -0
  69. package/dist/cdn/camera-annotate/snice-camera-annotate.js +730 -0
  70. package/dist/cdn/camera-annotate/snice-camera-annotate.js.map +1 -0
  71. package/dist/cdn/camera-annotate/snice-camera-annotate.min.js +144 -0
  72. package/dist/cdn/camera-annotate/snice-camera-annotate.min.js.map +1 -0
  73. package/dist/cdn/candlestick/README.md +27 -0
  74. package/dist/cdn/candlestick/snice-candlestick.js +717 -0
  75. package/dist/cdn/candlestick/snice-candlestick.js.map +1 -0
  76. package/dist/cdn/candlestick/snice-candlestick.min.js +22 -0
  77. package/dist/cdn/candlestick/snice-candlestick.min.js.map +1 -0
  78. package/dist/cdn/card/snice-card.js +1 -1
  79. package/dist/cdn/card/snice-card.min.js +1 -1
  80. package/dist/cdn/carousel/snice-carousel.js +1 -1
  81. package/dist/cdn/carousel/snice-carousel.min.js +1 -1
  82. package/dist/cdn/chart/snice-chart.js +1 -1
  83. package/dist/cdn/chart/snice-chart.min.js +1 -1
  84. package/dist/cdn/chat/snice-chat.js +1 -1
  85. package/dist/cdn/chat/snice-chat.min.js +1 -1
  86. package/dist/cdn/checkbox/snice-checkbox.js +1 -1
  87. package/dist/cdn/checkbox/snice-checkbox.min.js +1 -1
  88. package/dist/cdn/chip/snice-chip.js +1 -1
  89. package/dist/cdn/chip/snice-chip.min.js +1 -1
  90. package/dist/cdn/code-block/snice-code-block.js +1 -1
  91. package/dist/cdn/code-block/snice-code-block.min.js +1 -1
  92. package/dist/cdn/color-display/snice-color-display.js +1 -1
  93. package/dist/cdn/color-display/snice-color-display.min.js +1 -1
  94. package/dist/cdn/color-picker/snice-color-picker.js +1 -1
  95. package/dist/cdn/color-picker/snice-color-picker.min.js +1 -1
  96. package/dist/cdn/command-palette/snice-command-palette.js +1 -1
  97. package/dist/cdn/command-palette/snice-command-palette.min.js +1 -1
  98. package/dist/cdn/date-picker/snice-date-picker.js +1 -1
  99. package/dist/cdn/date-picker/snice-date-picker.min.js +1 -1
  100. package/dist/cdn/divider/snice-divider.js +1 -1
  101. package/dist/cdn/divider/snice-divider.min.js +1 -1
  102. package/dist/cdn/doc/snice-doc.js +1 -1
  103. package/dist/cdn/doc/snice-doc.min.js +1 -1
  104. package/dist/cdn/draw/snice-draw.js +1 -1
  105. package/dist/cdn/draw/snice-draw.min.js +1 -1
  106. package/dist/cdn/drawer/snice-drawer.js +1 -1
  107. package/dist/cdn/drawer/snice-drawer.min.js +1 -1
  108. package/dist/cdn/empty-state/snice-empty-state.js +1 -1
  109. package/dist/cdn/empty-state/snice-empty-state.min.js +1 -1
  110. package/dist/cdn/file-gallery/snice-file-gallery.js +1 -1
  111. package/dist/cdn/file-gallery/snice-file-gallery.min.js +1 -1
  112. package/dist/cdn/file-upload/snice-file-upload.js +1 -1
  113. package/dist/cdn/file-upload/snice-file-upload.min.js +1 -1
  114. package/dist/cdn/funnel/README.md +27 -0
  115. package/dist/cdn/funnel/snice-funnel.js +424 -0
  116. package/dist/cdn/funnel/snice-funnel.js.map +1 -0
  117. package/dist/cdn/funnel/snice-funnel.min.js +20 -0
  118. package/dist/cdn/funnel/snice-funnel.min.js.map +1 -0
  119. package/dist/cdn/gauge/snice-gauge.js +1 -1
  120. package/dist/cdn/gauge/snice-gauge.min.js +1 -1
  121. package/dist/cdn/heatmap/snice-heatmap.js +1 -1
  122. package/dist/cdn/heatmap/snice-heatmap.min.js +1 -1
  123. package/dist/cdn/image/snice-image.js +1 -1
  124. package/dist/cdn/image/snice-image.min.js +1 -1
  125. package/dist/cdn/input/snice-input.js +1 -1
  126. package/dist/cdn/input/snice-input.min.js +1 -1
  127. package/dist/cdn/kanban/snice-kanban.js +1 -1
  128. package/dist/cdn/kanban/snice-kanban.min.js +1 -1
  129. package/dist/cdn/kpi/snice-kpi.js +1 -1
  130. package/dist/cdn/kpi/snice-kpi.min.js +1 -1
  131. package/dist/cdn/layout/README.md +2 -2
  132. package/dist/cdn/layout/snice-layout.js +23 -6
  133. package/dist/cdn/layout/snice-layout.js.map +1 -1
  134. package/dist/cdn/layout/snice-layout.min.js +2 -2
  135. package/dist/cdn/layout/snice-layout.min.js.map +1 -1
  136. package/dist/cdn/link/snice-link.js +1 -1
  137. package/dist/cdn/link/snice-link.min.js +1 -1
  138. package/dist/cdn/link-preview/snice-link-preview.js +1 -1
  139. package/dist/cdn/link-preview/snice-link-preview.min.js +1 -1
  140. package/dist/cdn/list/README.md +6 -2
  141. package/dist/cdn/list/snice-list.js +87 -10
  142. package/dist/cdn/list/snice-list.js.map +1 -1
  143. package/dist/cdn/list/snice-list.min.js +20 -6
  144. package/dist/cdn/list/snice-list.min.js.map +1 -1
  145. package/dist/cdn/location/snice-location.js +1 -1
  146. package/dist/cdn/location/snice-location.min.js +1 -1
  147. package/dist/cdn/login/snice-login.js +1 -1
  148. package/dist/cdn/login/snice-login.min.js +1 -1
  149. package/dist/cdn/masonry/snice-masonry.js +1 -1
  150. package/dist/cdn/masonry/snice-masonry.min.js +1 -1
  151. package/dist/cdn/menu/snice-menu.js +1 -1
  152. package/dist/cdn/menu/snice-menu.min.js +1 -1
  153. package/dist/cdn/modal/snice-modal.js +1 -1
  154. package/dist/cdn/modal/snice-modal.min.js +1 -1
  155. package/dist/cdn/music-player/snice-music-player.js +1 -1
  156. package/dist/cdn/music-player/snice-music-player.min.js +1 -1
  157. package/dist/cdn/nav/README.md +2 -2
  158. package/dist/cdn/nav/snice-nav.js +23 -6
  159. package/dist/cdn/nav/snice-nav.js.map +1 -1
  160. package/dist/cdn/nav/snice-nav.min.js +2 -2
  161. package/dist/cdn/nav/snice-nav.min.js.map +1 -1
  162. package/dist/cdn/network-graph/README.md +27 -0
  163. package/dist/cdn/network-graph/snice-network-graph.js +788 -0
  164. package/dist/cdn/network-graph/snice-network-graph.js.map +1 -0
  165. package/dist/cdn/network-graph/snice-network-graph.min.js +13 -0
  166. package/dist/cdn/network-graph/snice-network-graph.min.js.map +1 -0
  167. package/dist/cdn/pagination/README.md +2 -2
  168. package/dist/cdn/pagination/snice-pagination.js +13 -13
  169. package/dist/cdn/pagination/snice-pagination.js.map +1 -1
  170. package/dist/cdn/pagination/snice-pagination.min.js +14 -14
  171. package/dist/cdn/pagination/snice-pagination.min.js.map +1 -1
  172. package/dist/cdn/paint/snice-paint.js +1 -1
  173. package/dist/cdn/paint/snice-paint.min.js +1 -1
  174. package/dist/cdn/progress/snice-progress.js +1 -1
  175. package/dist/cdn/progress/snice-progress.min.js +1 -1
  176. package/dist/cdn/qr-code/snice-qr-code.js +1 -1
  177. package/dist/cdn/qr-code/snice-qr-code.min.js +1 -1
  178. package/dist/cdn/qr-reader/snice-qr-reader.js +1 -1
  179. package/dist/cdn/qr-reader/snice-qr-reader.min.js +1 -1
  180. package/dist/cdn/radio/snice-radio.js +1 -1
  181. package/dist/cdn/radio/snice-radio.min.js +1 -1
  182. package/dist/cdn/runtime/snice-runtime.esm.js +3 -3
  183. package/dist/cdn/runtime/snice-runtime.esm.js.map +1 -1
  184. package/dist/cdn/runtime/snice-runtime.esm.min.js +3 -3
  185. package/dist/cdn/runtime/snice-runtime.esm.min.js.map +1 -1
  186. package/dist/cdn/runtime/snice-runtime.js +3 -3
  187. package/dist/cdn/runtime/snice-runtime.js.map +1 -1
  188. package/dist/cdn/runtime/snice-runtime.min.js +3 -3
  189. package/dist/cdn/runtime/snice-runtime.min.js.map +1 -1
  190. package/dist/cdn/sankey/README.md +27 -0
  191. package/dist/cdn/sankey/snice-sankey.js +679 -0
  192. package/dist/cdn/sankey/snice-sankey.js.map +1 -0
  193. package/dist/cdn/sankey/snice-sankey.min.js +21 -0
  194. package/dist/cdn/sankey/snice-sankey.min.js.map +1 -0
  195. package/dist/cdn/select/snice-select.js +1 -1
  196. package/dist/cdn/select/snice-select.min.js +1 -1
  197. package/dist/cdn/skeleton/snice-skeleton.js +1 -1
  198. package/dist/cdn/skeleton/snice-skeleton.min.js +1 -1
  199. package/dist/cdn/slider/snice-slider.js +1 -1
  200. package/dist/cdn/slider/snice-slider.min.js +1 -1
  201. package/dist/cdn/sparkline/snice-sparkline.js +1 -1
  202. package/dist/cdn/sparkline/snice-sparkline.min.js +1 -1
  203. package/dist/cdn/spinner/snice-spinner.js +1 -1
  204. package/dist/cdn/spinner/snice-spinner.min.js +1 -1
  205. package/dist/cdn/split-pane/snice-split-pane.js +1 -1
  206. package/dist/cdn/split-pane/snice-split-pane.min.js +1 -1
  207. package/dist/cdn/stepper/README.md +6 -2
  208. package/dist/cdn/stepper/snice-stepper.js +77 -10
  209. package/dist/cdn/stepper/snice-stepper.js.map +1 -1
  210. package/dist/cdn/stepper/snice-stepper.min.js +13 -9
  211. package/dist/cdn/stepper/snice-stepper.min.js.map +1 -1
  212. package/dist/cdn/switch/snice-switch.js +1 -1
  213. package/dist/cdn/switch/snice-switch.min.js +1 -1
  214. package/dist/cdn/table/snice-table.js +1 -1
  215. package/dist/cdn/table/snice-table.min.js +1 -1
  216. package/dist/cdn/tabs/snice-tabs.js +1 -1
  217. package/dist/cdn/tabs/snice-tabs.min.js +1 -1
  218. package/dist/cdn/terminal/snice-terminal.js +1 -1
  219. package/dist/cdn/terminal/snice-terminal.min.js +1 -1
  220. package/dist/cdn/textarea/snice-textarea.js +1 -1
  221. package/dist/cdn/textarea/snice-textarea.min.js +1 -1
  222. package/dist/cdn/time-range-picker/README.md +27 -0
  223. package/dist/cdn/time-range-picker/snice-time-range-picker.js +635 -0
  224. package/dist/cdn/time-range-picker/snice-time-range-picker.js.map +1 -0
  225. package/dist/cdn/time-range-picker/snice-time-range-picker.min.js +34 -0
  226. package/dist/cdn/time-range-picker/snice-time-range-picker.min.js.map +1 -0
  227. package/dist/cdn/timeline/snice-timeline.js +1 -1
  228. package/dist/cdn/timeline/snice-timeline.min.js +1 -1
  229. package/dist/cdn/timer/snice-timer.js +1 -1
  230. package/dist/cdn/timer/snice-timer.min.js +1 -1
  231. package/dist/cdn/toast/snice-toast.js +1 -1
  232. package/dist/cdn/toast/snice-toast.min.js +1 -1
  233. package/dist/cdn/tooltip/snice-tooltip.js +1 -1
  234. package/dist/cdn/tooltip/snice-tooltip.min.js +1 -1
  235. package/dist/cdn/tree/README.md +5 -1
  236. package/dist/cdn/tree/snice-tree.js +4 -8
  237. package/dist/cdn/tree/snice-tree.js.map +1 -1
  238. package/dist/cdn/tree/snice-tree.min.js +5 -5
  239. package/dist/cdn/tree/snice-tree.min.js.map +1 -1
  240. package/dist/cdn/treemap/README.md +27 -0
  241. package/dist/cdn/treemap/snice-treemap.js +522 -0
  242. package/dist/cdn/treemap/snice-treemap.js.map +1 -0
  243. package/dist/cdn/treemap/snice-treemap.min.js +14 -0
  244. package/dist/cdn/treemap/snice-treemap.min.js.map +1 -0
  245. package/dist/cdn/virtual-scroller/README.md +2 -2
  246. package/dist/cdn/virtual-scroller/snice-virtual-scroller.js +47 -16
  247. package/dist/cdn/virtual-scroller/snice-virtual-scroller.js.map +1 -1
  248. package/dist/cdn/virtual-scroller/snice-virtual-scroller.min.js +9 -9
  249. package/dist/cdn/virtual-scroller/snice-virtual-scroller.min.js.map +1 -1
  250. package/dist/components/breadcrumbs/snice-breadcrumbs.js +1 -1
  251. package/dist/components/breadcrumbs/snice-breadcrumbs.js.map +1 -1
  252. package/dist/components/camera-annotate/snice-camera-annotate.d.ts +68 -0
  253. package/dist/components/camera-annotate/snice-camera-annotate.js +663 -0
  254. package/dist/components/camera-annotate/snice-camera-annotate.js.map +1 -0
  255. package/dist/components/camera-annotate/snice-camera-annotate.types.d.ts +50 -0
  256. package/dist/components/candlestick/snice-candlestick.d.ts +78 -0
  257. package/dist/components/candlestick/snice-candlestick.js +650 -0
  258. package/dist/components/candlestick/snice-candlestick.js.map +1 -0
  259. package/dist/components/candlestick/snice-candlestick.types.d.ts +40 -0
  260. package/dist/components/funnel/snice-funnel.d.ts +37 -0
  261. package/dist/components/funnel/snice-funnel.js +357 -0
  262. package/dist/components/funnel/snice-funnel.js.map +1 -0
  263. package/dist/components/funnel/snice-funnel.types.d.ts +28 -0
  264. package/dist/components/list/snice-list-item.d.ts +2 -0
  265. package/dist/components/list/snice-list-item.js +20 -2
  266. package/dist/components/list/snice-list-item.js.map +1 -1
  267. package/dist/components/nav/snice-nav.js +22 -5
  268. package/dist/components/nav/snice-nav.js.map +1 -1
  269. package/dist/components/network-graph/snice-network-graph.d.ts +80 -0
  270. package/dist/components/network-graph/snice-network-graph.js +721 -0
  271. package/dist/components/network-graph/snice-network-graph.js.map +1 -0
  272. package/dist/components/network-graph/snice-network-graph.types.d.ts +49 -0
  273. package/dist/components/pagination/snice-pagination.js +12 -12
  274. package/dist/components/sankey/snice-sankey.d.ts +46 -0
  275. package/dist/components/sankey/snice-sankey.js +612 -0
  276. package/dist/components/sankey/snice-sankey.js.map +1 -0
  277. package/dist/components/sankey/snice-sankey.types.d.ts +59 -0
  278. package/dist/components/stepper/snice-stepper.js +9 -3
  279. package/dist/components/stepper/snice-stepper.js.map +1 -1
  280. package/dist/components/time-range-picker/snice-time-range-picker.d.ts +67 -0
  281. package/dist/components/time-range-picker/snice-time-range-picker.js +568 -0
  282. package/dist/components/time-range-picker/snice-time-range-picker.js.map +1 -0
  283. package/dist/components/time-range-picker/snice-time-range-picker.types.d.ts +39 -0
  284. package/dist/components/treemap/snice-treemap.d.ts +49 -0
  285. package/dist/components/treemap/snice-treemap.js +455 -0
  286. package/dist/components/treemap/snice-treemap.js.map +1 -0
  287. package/dist/components/treemap/snice-treemap.types.d.ts +42 -0
  288. package/dist/components/virtual-scroller/snice-virtual-scroller.d.ts +5 -0
  289. package/dist/components/virtual-scroller/snice-virtual-scroller.js +47 -16
  290. package/dist/components/virtual-scroller/snice-virtual-scroller.js.map +1 -1
  291. package/dist/index.cjs +1 -1
  292. package/dist/index.cjs.map +1 -1
  293. package/dist/index.esm.js +1 -1
  294. package/dist/index.esm.js.map +1 -1
  295. package/dist/index.iife.js +1 -1
  296. package/dist/index.iife.js.map +1 -1
  297. package/dist/symbols.cjs +1 -1
  298. package/dist/symbols.esm.js +1 -1
  299. package/dist/transitions.cjs +1 -1
  300. package/dist/transitions.esm.js +1 -1
  301. package/docs/ai/components/camera-annotate.md +82 -0
  302. package/docs/ai/components/candlestick.md +79 -0
  303. package/docs/ai/components/funnel.md +86 -0
  304. package/docs/ai/components/network-graph.md +87 -0
  305. package/docs/ai/components/sankey.md +63 -0
  306. package/docs/ai/components/time-range-picker.md +78 -0
  307. package/docs/ai/components/treemap.md +78 -0
  308. package/docs/components/camera-annotate.md +186 -0
  309. package/docs/components/candlestick.md +196 -0
  310. package/docs/components/funnel.md +191 -0
  311. package/docs/components/network-graph.md +215 -0
  312. package/docs/components/sankey.md +201 -0
  313. package/docs/components/time-range-picker.md +213 -0
  314. package/docs/components/treemap.md +198 -0
  315. package/package.json +1 -1
@@ -0,0 +1,612 @@
1
+ import { __runInitializers, __esDecorate } from 'tslib';
2
+ import { element, property, query, dispatch, ready, watch, render, styles, dispose, html, css } from 'snice';
3
+
4
+ var cssContent = ":host{display:block;font-family:var(--snice-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif);contain:layout style paint;width:100%}.sankey{position:relative;width:100%;min-height:12.5rem}.sankey__svg{display:block;width:100%;height:100%}.sankey__node{cursor:pointer;transition:opacity var(--snice-transition-fast, 150ms) ease}.sankey__node rect{stroke:var(--snice-color-background,rgb(255 255 255));stroke-width:1px}.sankey__node:hover rect{filter:brightness(1.1)}.sankey__link{cursor:pointer;transition:opacity var(--snice-transition-fast, 150ms) ease}.sankey__link path{fill:none;stroke-opacity:0.35;transition:stroke-opacity var(--snice-transition-fast, 150ms) ease}.sankey__link:hover path{stroke-opacity:0.6}.sankey--dimmed .sankey__node:not(.sankey__node--highlighted){opacity:.2}.sankey--dimmed .sankey__link:not(.sankey__link--highlighted) path{stroke-opacity:0.08}.sankey__label{font-size:var(--snice-font-size-sm, .75rem);fill:var(--snice-color-text,rgb(23 23 23));pointer-events:none;dominant-baseline:central}.sankey__value{font-size:var(--snice-font-size-xs, .625rem);fill:var(--snice-color-text-secondary,rgb(82 82 82));pointer-events:none;dominant-baseline:central}.sankey__tooltip{position:absolute;pointer-events:none;background:var(--snice-color-background,rgb(255 255 255));border:1px solid var(--snice-color-border,rgb(226 226 226));border-radius:4px;padding:var(--snice-spacing-xs,.5rem) var(--snice-spacing-sm,.75rem);font-size:var(--snice-font-size-sm, .75rem);color:var(--snice-color-text,rgb(23 23 23));box-shadow:var(--snice-shadow-md,0 4px 6px -1px rgb(0 0 0 / .1),0 2px 4px -2px rgb(0 0 0 / .1));white-space:nowrap;z-index:10;opacity:0;transition:opacity var(--snice-transition-fast, 150ms) ease}.sankey__tooltip--visible{opacity:1}.sankey__tooltip-label{font-weight:var(--snice-font-weight-semibold,600)}.sankey__tooltip-value{color:var(--snice-color-text-secondary,rgb(82 82 82));margin-top:var(--snice-spacing-3xs,.125rem)}@keyframes sankey-fade-in{from{opacity:0;transform:translateY(.5rem)}to{opacity:1;transform:translateY(0)}}:host([animation]) .sankey__node{animation:sankey-fade-in var(--snice-transition-medium,250ms) ease both}:host([animation]) .sankey__link path{stroke-dasharray:1000;stroke-dashoffset:1000;animation:.8s forwards sankey-link-draw}@keyframes sankey-link-draw{to{stroke-dashoffset:0}}";
5
+
6
+ const DEFAULT_COLORS = [
7
+ '#2196f3', '#4caf50', '#ff9800', '#f44336', '#9c27b0',
8
+ '#00bcd4', '#8bc34a', '#ffc107', '#e91e63', '#673ab7'
9
+ ];
10
+ function escapeHTML(str) {
11
+ return str.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
12
+ }
13
+ let SniceSankey = (() => {
14
+ let _classDecorators = [element('snice-sankey')];
15
+ let _classDescriptor;
16
+ let _classExtraInitializers = [];
17
+ let _classThis;
18
+ let _classSuper = HTMLElement;
19
+ let _instanceExtraInitializers = [];
20
+ let _data_decorators;
21
+ let _data_initializers = [];
22
+ let _data_extraInitializers = [];
23
+ let _nodeWidth_decorators;
24
+ let _nodeWidth_initializers = [];
25
+ let _nodeWidth_extraInitializers = [];
26
+ let _nodePadding_decorators;
27
+ let _nodePadding_initializers = [];
28
+ let _nodePadding_extraInitializers = [];
29
+ let _alignment_decorators;
30
+ let _alignment_initializers = [];
31
+ let _alignment_extraInitializers = [];
32
+ let _showLabels_decorators;
33
+ let _showLabels_initializers = [];
34
+ let _showLabels_extraInitializers = [];
35
+ let _showValues_decorators;
36
+ let _showValues_initializers = [];
37
+ let _showValues_extraInitializers = [];
38
+ let _animation_decorators;
39
+ let _animation_initializers = [];
40
+ let _animation_extraInitializers = [];
41
+ let _chartEl_decorators;
42
+ let _chartEl_initializers = [];
43
+ let _chartEl_extraInitializers = [];
44
+ let _tooltipEl_decorators;
45
+ let _tooltipEl_initializers = [];
46
+ let _tooltipEl_extraInitializers = [];
47
+ let _emitNodeClick_decorators;
48
+ let _emitLinkClick_decorators;
49
+ let _emitHover_decorators;
50
+ let _init_decorators;
51
+ let _onDataChange_decorators;
52
+ let _onDisplayChange_decorators;
53
+ let _renderContent_decorators;
54
+ let _componentStyles_decorators;
55
+ let _cleanup_decorators;
56
+ (class extends _classSuper {
57
+ static { _classThis = this; }
58
+ constructor() {
59
+ super(...arguments);
60
+ this.data = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _data_initializers, { nodes: [], links: [] }));
61
+ this.nodeWidth = (__runInitializers(this, _data_extraInitializers), __runInitializers(this, _nodeWidth_initializers, 20));
62
+ this.nodePadding = (__runInitializers(this, _nodeWidth_extraInitializers), __runInitializers(this, _nodePadding_initializers, 10));
63
+ this.alignment = (__runInitializers(this, _nodePadding_extraInitializers), __runInitializers(this, _alignment_initializers, 'justify'));
64
+ this.showLabels = (__runInitializers(this, _alignment_extraInitializers), __runInitializers(this, _showLabels_initializers, true));
65
+ this.showValues = (__runInitializers(this, _showLabels_extraInitializers), __runInitializers(this, _showValues_initializers, true));
66
+ this.animation = (__runInitializers(this, _showValues_extraInitializers), __runInitializers(this, _animation_initializers, false));
67
+ this.chartEl = (__runInitializers(this, _animation_extraInitializers), __runInitializers(this, _chartEl_initializers, void 0));
68
+ this.tooltipEl = (__runInitializers(this, _chartEl_extraInitializers), __runInitializers(this, _tooltipEl_initializers, void 0));
69
+ this.cachedData = (__runInitializers(this, _tooltipEl_extraInitializers), { nodes: [], links: [] });
70
+ this.layoutNodes = [];
71
+ this.layoutLinks = [];
72
+ this.hoveredNodeId = null;
73
+ this.hoveredLinkIndex = null;
74
+ this.chartWidth = 600;
75
+ this.chartHeight = 400;
76
+ this.resizeObserver = null;
77
+ }
78
+ static {
79
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
80
+ _data_decorators = [property({ type: Object, attribute: false })];
81
+ _nodeWidth_decorators = [property({ type: Number, attribute: 'node-width' })];
82
+ _nodePadding_decorators = [property({ type: Number, attribute: 'node-padding' })];
83
+ _alignment_decorators = [property()];
84
+ _showLabels_decorators = [property({ type: Boolean, attribute: 'show-labels' })];
85
+ _showValues_decorators = [property({ type: Boolean, attribute: 'show-values' })];
86
+ _animation_decorators = [property({ type: Boolean })];
87
+ _chartEl_decorators = [query('.sankey__chart')];
88
+ _tooltipEl_decorators = [query('.sankey__tooltip')];
89
+ _emitNodeClick_decorators = [dispatch('sankey-node-click', { bubbles: true, composed: true })];
90
+ _emitLinkClick_decorators = [dispatch('sankey-link-click', { bubbles: true, composed: true })];
91
+ _emitHover_decorators = [dispatch('sankey-hover', { bubbles: true, composed: true })];
92
+ _init_decorators = [ready()];
93
+ _onDataChange_decorators = [watch('data')];
94
+ _onDisplayChange_decorators = [watch('showLabels', 'showValues', 'animation', 'alignment')];
95
+ _renderContent_decorators = [render({ once: true })];
96
+ _componentStyles_decorators = [styles()];
97
+ _cleanup_decorators = [dispose()];
98
+ __esDecorate(this, null, _emitNodeClick_decorators, { kind: "method", name: "emitNodeClick", static: false, private: false, access: { has: obj => "emitNodeClick" in obj, get: obj => obj.emitNodeClick }, metadata: _metadata }, null, _instanceExtraInitializers);
99
+ __esDecorate(this, null, _emitLinkClick_decorators, { kind: "method", name: "emitLinkClick", static: false, private: false, access: { has: obj => "emitLinkClick" in obj, get: obj => obj.emitLinkClick }, metadata: _metadata }, null, _instanceExtraInitializers);
100
+ __esDecorate(this, null, _emitHover_decorators, { kind: "method", name: "emitHover", static: false, private: false, access: { has: obj => "emitHover" in obj, get: obj => obj.emitHover }, metadata: _metadata }, null, _instanceExtraInitializers);
101
+ __esDecorate(this, null, _init_decorators, { kind: "method", name: "init", static: false, private: false, access: { has: obj => "init" in obj, get: obj => obj.init }, metadata: _metadata }, null, _instanceExtraInitializers);
102
+ __esDecorate(this, null, _onDataChange_decorators, { kind: "method", name: "onDataChange", static: false, private: false, access: { has: obj => "onDataChange" in obj, get: obj => obj.onDataChange }, metadata: _metadata }, null, _instanceExtraInitializers);
103
+ __esDecorate(this, null, _onDisplayChange_decorators, { kind: "method", name: "onDisplayChange", static: false, private: false, access: { has: obj => "onDisplayChange" in obj, get: obj => obj.onDisplayChange }, metadata: _metadata }, null, _instanceExtraInitializers);
104
+ __esDecorate(this, null, _renderContent_decorators, { kind: "method", name: "renderContent", static: false, private: false, access: { has: obj => "renderContent" in obj, get: obj => obj.renderContent }, metadata: _metadata }, null, _instanceExtraInitializers);
105
+ __esDecorate(this, null, _componentStyles_decorators, { kind: "method", name: "componentStyles", static: false, private: false, access: { has: obj => "componentStyles" in obj, get: obj => obj.componentStyles }, metadata: _metadata }, null, _instanceExtraInitializers);
106
+ __esDecorate(this, null, _cleanup_decorators, { kind: "method", name: "cleanup", static: false, private: false, access: { has: obj => "cleanup" in obj, get: obj => obj.cleanup }, metadata: _metadata }, null, _instanceExtraInitializers);
107
+ __esDecorate(null, null, _data_decorators, { kind: "field", name: "data", static: false, private: false, access: { has: obj => "data" in obj, get: obj => obj.data, set: (obj, value) => { obj.data = value; } }, metadata: _metadata }, _data_initializers, _data_extraInitializers);
108
+ __esDecorate(null, null, _nodeWidth_decorators, { kind: "field", name: "nodeWidth", static: false, private: false, access: { has: obj => "nodeWidth" in obj, get: obj => obj.nodeWidth, set: (obj, value) => { obj.nodeWidth = value; } }, metadata: _metadata }, _nodeWidth_initializers, _nodeWidth_extraInitializers);
109
+ __esDecorate(null, null, _nodePadding_decorators, { kind: "field", name: "nodePadding", static: false, private: false, access: { has: obj => "nodePadding" in obj, get: obj => obj.nodePadding, set: (obj, value) => { obj.nodePadding = value; } }, metadata: _metadata }, _nodePadding_initializers, _nodePadding_extraInitializers);
110
+ __esDecorate(null, null, _alignment_decorators, { kind: "field", name: "alignment", static: false, private: false, access: { has: obj => "alignment" in obj, get: obj => obj.alignment, set: (obj, value) => { obj.alignment = value; } }, metadata: _metadata }, _alignment_initializers, _alignment_extraInitializers);
111
+ __esDecorate(null, null, _showLabels_decorators, { kind: "field", name: "showLabels", static: false, private: false, access: { has: obj => "showLabels" in obj, get: obj => obj.showLabels, set: (obj, value) => { obj.showLabels = value; } }, metadata: _metadata }, _showLabels_initializers, _showLabels_extraInitializers);
112
+ __esDecorate(null, null, _showValues_decorators, { kind: "field", name: "showValues", static: false, private: false, access: { has: obj => "showValues" in obj, get: obj => obj.showValues, set: (obj, value) => { obj.showValues = value; } }, metadata: _metadata }, _showValues_initializers, _showValues_extraInitializers);
113
+ __esDecorate(null, null, _animation_decorators, { kind: "field", name: "animation", static: false, private: false, access: { has: obj => "animation" in obj, get: obj => obj.animation, set: (obj, value) => { obj.animation = value; } }, metadata: _metadata }, _animation_initializers, _animation_extraInitializers);
114
+ __esDecorate(null, null, _chartEl_decorators, { kind: "field", name: "chartEl", static: false, private: false, access: { has: obj => "chartEl" in obj, get: obj => obj.chartEl, set: (obj, value) => { obj.chartEl = value; } }, metadata: _metadata }, _chartEl_initializers, _chartEl_extraInitializers);
115
+ __esDecorate(null, null, _tooltipEl_decorators, { kind: "field", name: "tooltipEl", static: false, private: false, access: { has: obj => "tooltipEl" in obj, get: obj => obj.tooltipEl, set: (obj, value) => { obj.tooltipEl = value; } }, metadata: _metadata }, _tooltipEl_initializers, _tooltipEl_extraInitializers);
116
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
117
+ _classThis = _classDescriptor.value;
118
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
119
+ __runInitializers(_classThis, _classExtraInitializers);
120
+ }
121
+ emitNodeClick(node) {
122
+ return { node };
123
+ }
124
+ emitLinkClick(link) {
125
+ return { link };
126
+ }
127
+ emitHover(detail) {
128
+ return detail;
129
+ }
130
+ init() {
131
+ const rect = this.getBoundingClientRect();
132
+ if (rect.width > 0)
133
+ this.chartWidth = rect.width;
134
+ if (rect.height > 0)
135
+ this.chartHeight = rect.height;
136
+ if (this.cachedData.nodes.length === 0 && this.data.nodes.length > 0) {
137
+ this.cachedData = this.data;
138
+ }
139
+ this.computeLayout();
140
+ this.rebuildChart();
141
+ if (typeof ResizeObserver !== 'undefined') {
142
+ this.resizeObserver = new ResizeObserver((entries) => {
143
+ const entry = entries[0];
144
+ if (entry) {
145
+ const { width, height } = entry.contentRect;
146
+ if (width > 0 && height > 0) {
147
+ this.chartWidth = width;
148
+ this.chartHeight = height;
149
+ this.computeLayout();
150
+ this.rebuildChart();
151
+ }
152
+ }
153
+ });
154
+ this.resizeObserver.observe(this);
155
+ }
156
+ }
157
+ onDataChange() {
158
+ this.cachedData = this.data;
159
+ this.computeLayout();
160
+ this.rebuildChart();
161
+ }
162
+ onDisplayChange() {
163
+ this.computeLayout();
164
+ this.rebuildChart();
165
+ }
166
+ computeLayout() {
167
+ const data = this.cachedData;
168
+ if (!data || !data.nodes.length || !data.links.length) {
169
+ this.layoutNodes = [];
170
+ this.layoutLinks = [];
171
+ return;
172
+ }
173
+ const padding = 40;
174
+ const labelSpace = this.showLabels ? 80 : 0;
175
+ const width = this.chartWidth - labelSpace * 2;
176
+ const height = this.chartHeight - padding * 2;
177
+ if (width <= 0 || height <= 0)
178
+ return;
179
+ // Build node map
180
+ const nodeMap = new Map();
181
+ data.nodes.forEach((n, i) => {
182
+ nodeMap.set(n.id, {
183
+ id: n.id,
184
+ label: n.label || n.id,
185
+ color: n.color || DEFAULT_COLORS[i % DEFAULT_COLORS.length],
186
+ x: 0, y: 0,
187
+ width: this.nodeWidth,
188
+ height: 0,
189
+ value: 0,
190
+ depth: 0,
191
+ sourceLinks: [],
192
+ targetLinks: []
193
+ });
194
+ });
195
+ // Build links
196
+ const links = data.links.map(l => ({
197
+ source: nodeMap.get(l.source),
198
+ target: nodeMap.get(l.target),
199
+ value: l.value,
200
+ color: l.color || nodeMap.get(l.source)?.color || DEFAULT_COLORS[0],
201
+ width: 0,
202
+ sy: 0,
203
+ ty: 0
204
+ })).filter(l => l.source && l.target);
205
+ // Assign links to nodes
206
+ links.forEach(link => {
207
+ link.source.sourceLinks.push(link);
208
+ link.target.targetLinks.push(link);
209
+ });
210
+ // Calculate node values
211
+ nodeMap.forEach(node => {
212
+ const sourceTotal = node.sourceLinks.reduce((s, l) => s + l.value, 0);
213
+ const targetTotal = node.targetLinks.reduce((s, l) => s + l.value, 0);
214
+ node.value = Math.max(sourceTotal, targetTotal);
215
+ });
216
+ // Compute depths using BFS
217
+ this.computeDepths(nodeMap);
218
+ const nodes = Array.from(nodeMap.values());
219
+ const maxDepth = Math.max(...nodes.map(n => n.depth));
220
+ // X positions
221
+ const xScale = maxDepth > 0 ? (width - this.nodeWidth) / maxDepth : 0;
222
+ nodes.forEach(node => {
223
+ node.x = labelSpace + node.depth * xScale;
224
+ });
225
+ // Apply alignment
226
+ this.applyAlignment(nodes, maxDepth, width, labelSpace);
227
+ // Y positions - compute node heights and stack within each column
228
+ const columns = this.getColumns(nodes);
229
+ columns.forEach(column => {
230
+ const colTotalValue = column.reduce((s, n) => s + n.value, 0);
231
+ const availableHeight = height - (column.length - 1) * this.nodePadding;
232
+ const scale = colTotalValue > 0 ? availableHeight / colTotalValue : 0;
233
+ let y = padding;
234
+ column.forEach(node => {
235
+ node.y = y;
236
+ node.height = Math.max(node.value * scale, 2);
237
+ y += node.height + this.nodePadding;
238
+ });
239
+ });
240
+ // Iterative relaxation for better node positioning
241
+ for (let i = 0; i < 32; i++) {
242
+ this.relaxColumns(columns, height, padding);
243
+ }
244
+ // Compute link positions
245
+ links.forEach(link => {
246
+ link.width = Math.max(1, (link.value / link.source.value) * link.source.height);
247
+ });
248
+ // Sort and position source links
249
+ nodes.forEach(node => {
250
+ node.sourceLinks.sort((a, b) => a.target.y - b.target.y);
251
+ let sy = 0;
252
+ node.sourceLinks.forEach(link => {
253
+ link.sy = node.y + sy;
254
+ sy += link.width;
255
+ });
256
+ node.targetLinks.sort((a, b) => a.source.y - b.source.y);
257
+ let ty = 0;
258
+ node.targetLinks.forEach(link => {
259
+ link.width = Math.max(1, (link.value / link.target.value) * link.target.height);
260
+ link.ty = node.y + ty;
261
+ ty += link.width;
262
+ });
263
+ });
264
+ this.layoutNodes = nodes;
265
+ this.layoutLinks = links;
266
+ }
267
+ computeDepths(nodeMap) {
268
+ const remaining = new Set(nodeMap.values());
269
+ let depth = 0;
270
+ while (remaining.size > 0) {
271
+ const nextLevel = [];
272
+ remaining.forEach(node => {
273
+ if (node.targetLinks.every(l => !remaining.has(l.source))) {
274
+ node.depth = depth;
275
+ nextLevel.push(node);
276
+ }
277
+ });
278
+ if (nextLevel.length === 0) {
279
+ // Break cycles - assign remaining to current depth
280
+ remaining.forEach(node => {
281
+ node.depth = depth;
282
+ });
283
+ break;
284
+ }
285
+ nextLevel.forEach(n => remaining.delete(n));
286
+ depth++;
287
+ }
288
+ }
289
+ getColumns(nodes) {
290
+ const maxDepth = Math.max(...nodes.map(n => n.depth), 0);
291
+ const columns = [];
292
+ for (let i = 0; i <= maxDepth; i++) {
293
+ columns.push(nodes.filter(n => n.depth === i));
294
+ }
295
+ return columns;
296
+ }
297
+ applyAlignment(nodes, maxDepth, width, labelSpace) {
298
+ if (this.alignment === 'right') {
299
+ nodes.forEach(node => {
300
+ if (node.sourceLinks.length === 0) {
301
+ node.depth = maxDepth;
302
+ node.x = labelSpace + maxDepth * ((width - this.nodeWidth) / Math.max(maxDepth, 1));
303
+ }
304
+ });
305
+ }
306
+ else if (this.alignment === 'center') {
307
+ nodes.forEach(node => {
308
+ if (node.targetLinks.length === 0 && node.sourceLinks.length === 0) {
309
+ node.depth = Math.floor(maxDepth / 2);
310
+ node.x = labelSpace + node.depth * ((width - this.nodeWidth) / Math.max(maxDepth, 1));
311
+ }
312
+ });
313
+ }
314
+ else if (this.alignment === 'justify') {
315
+ nodes.forEach(node => {
316
+ if (node.sourceLinks.length === 0 && maxDepth > 0) {
317
+ node.depth = maxDepth;
318
+ node.x = labelSpace + maxDepth * ((width - this.nodeWidth) / maxDepth);
319
+ }
320
+ });
321
+ }
322
+ }
323
+ relaxColumns(columns, height, padding) {
324
+ // Forward pass - push nodes based on sources
325
+ columns.forEach(column => {
326
+ column.forEach(node => {
327
+ if (node.targetLinks.length > 0) {
328
+ const avg = node.targetLinks.reduce((s, l) => s + l.source.y, 0) / node.targetLinks.length;
329
+ const delta = (avg - node.y) * 0.5;
330
+ node.y += delta;
331
+ }
332
+ });
333
+ this.resolveOverlaps(column, height, padding);
334
+ });
335
+ // Backward pass - push nodes based on targets
336
+ for (let i = columns.length - 1; i >= 0; i--) {
337
+ columns[i].forEach(node => {
338
+ if (node.sourceLinks.length > 0) {
339
+ const avg = node.sourceLinks.reduce((s, l) => s + l.target.y, 0) / node.sourceLinks.length;
340
+ const delta = (avg - node.y) * 0.5;
341
+ node.y += delta;
342
+ }
343
+ });
344
+ this.resolveOverlaps(columns[i], height, padding);
345
+ }
346
+ }
347
+ resolveOverlaps(column, height, padding) {
348
+ column.sort((a, b) => a.y - b.y);
349
+ let y0 = padding;
350
+ column.forEach(node => {
351
+ if (node.y < y0) {
352
+ node.y = y0;
353
+ }
354
+ y0 = node.y + node.height + this.nodePadding;
355
+ });
356
+ // Push up if exceeding bottom
357
+ const lastNode = column[column.length - 1];
358
+ if (lastNode) {
359
+ const overflow = lastNode.y + lastNode.height - (height + padding);
360
+ if (overflow > 0) {
361
+ lastNode.y -= overflow;
362
+ for (let i = column.length - 2; i >= 0; i--) {
363
+ const maxY = column[i + 1].y - column[i].height - this.nodePadding;
364
+ if (column[i].y > maxY) {
365
+ column[i].y = maxY;
366
+ }
367
+ }
368
+ }
369
+ }
370
+ }
371
+ getLinkPath(link) {
372
+ const x0 = link.source.x + link.source.width;
373
+ const x1 = link.target.x;
374
+ const xi = (x0 + x1) / 2;
375
+ const y0 = link.sy + link.width / 2;
376
+ const y1 = link.ty + link.width / 2;
377
+ return `M${x0},${y0} C${xi},${y0} ${xi},${y1} ${x1},${y1}`;
378
+ }
379
+ handleSvgClick(e) {
380
+ const target = e.target;
381
+ const el = target.closest('[data-node-id]');
382
+ const linkEl = target.closest('[data-link-index]');
383
+ if (el) {
384
+ const nodeId = el.dataset.nodeId;
385
+ const originalNode = this.cachedData.nodes.find(n => n.id === nodeId);
386
+ if (originalNode)
387
+ this.emitNodeClick(originalNode);
388
+ }
389
+ else if (linkEl) {
390
+ const index = parseInt(linkEl.dataset.linkIndex, 10);
391
+ const originalLink = this.cachedData.links[index];
392
+ if (originalLink)
393
+ this.emitLinkClick(originalLink);
394
+ }
395
+ }
396
+ handleSvgMouseMove(e) {
397
+ const target = e.target;
398
+ const nodeEl = target.closest('[data-node-id]');
399
+ const linkEl = target.closest('[data-link-index]');
400
+ const tooltip = this.tooltipEl;
401
+ this.chartEl;
402
+ if (nodeEl) {
403
+ const nodeId = nodeEl.dataset.nodeId;
404
+ const node = this.layoutNodes.find(n => n.id === nodeId);
405
+ if (!node)
406
+ return;
407
+ // Update hover highlight
408
+ if (this.hoveredNodeId !== nodeId || this.hoveredLinkIndex !== null) {
409
+ this.hoveredNodeId = nodeId;
410
+ this.hoveredLinkIndex = null;
411
+ this.applyHoverClasses();
412
+ }
413
+ // Update tooltip
414
+ if (tooltip) {
415
+ tooltip.querySelector('.sankey__tooltip-label').textContent = node.label;
416
+ tooltip.querySelector('.sankey__tooltip-value').textContent = `Value: ${node.value.toLocaleString()}`;
417
+ this.positionTooltip(e);
418
+ tooltip.classList.add('sankey__tooltip--visible');
419
+ }
420
+ const originalNode = this.cachedData.nodes.find(n => n.id === nodeId);
421
+ if (originalNode)
422
+ this.emitHover({ type: 'node', item: originalNode });
423
+ }
424
+ else if (linkEl) {
425
+ const index = parseInt(linkEl.dataset.linkIndex, 10);
426
+ const link = this.layoutLinks[index];
427
+ if (!link)
428
+ return;
429
+ // Update hover highlight
430
+ if (this.hoveredLinkIndex !== index || this.hoveredNodeId !== null) {
431
+ this.hoveredLinkIndex = index;
432
+ this.hoveredNodeId = null;
433
+ this.applyHoverClasses();
434
+ }
435
+ // Update tooltip
436
+ if (tooltip) {
437
+ tooltip.querySelector('.sankey__tooltip-label').textContent = `${link.source.label} \u2192 ${link.target.label}`;
438
+ tooltip.querySelector('.sankey__tooltip-value').textContent = `Value: ${link.value.toLocaleString()}`;
439
+ this.positionTooltip(e);
440
+ tooltip.classList.add('sankey__tooltip--visible');
441
+ }
442
+ const originalLink = this.cachedData.links[index];
443
+ if (originalLink)
444
+ this.emitHover({ type: 'link', item: originalLink });
445
+ }
446
+ else {
447
+ this.clearHover();
448
+ }
449
+ }
450
+ handleSvgMouseLeave() {
451
+ this.clearHover();
452
+ }
453
+ clearHover() {
454
+ if (this.hoveredNodeId !== null || this.hoveredLinkIndex !== null) {
455
+ this.hoveredNodeId = null;
456
+ this.hoveredLinkIndex = null;
457
+ this.applyHoverClasses();
458
+ this.emitHover(null);
459
+ }
460
+ const tooltip = this.tooltipEl;
461
+ if (tooltip)
462
+ tooltip.classList.remove('sankey__tooltip--visible');
463
+ }
464
+ positionTooltip(e) {
465
+ const tooltip = this.tooltipEl;
466
+ if (!tooltip)
467
+ return;
468
+ const rect = this.getBoundingClientRect();
469
+ tooltip.style.left = `${e.clientX - rect.left + 10}px`;
470
+ tooltip.style.top = `${e.clientY - rect.top - 10}px`;
471
+ }
472
+ applyHoverClasses() {
473
+ const chart = this.chartEl;
474
+ if (!chart)
475
+ return;
476
+ const svg = chart.querySelector('svg');
477
+ if (!svg)
478
+ return;
479
+ const isDimmed = this.hoveredNodeId !== null || this.hoveredLinkIndex !== null;
480
+ const container = svg.closest('.sankey');
481
+ if (container) {
482
+ container.classList.toggle('sankey--dimmed', isDimmed);
483
+ }
484
+ // Update node highlights
485
+ const nodeGroups = svg.querySelectorAll('[data-node-id]');
486
+ nodeGroups.forEach(g => {
487
+ const nodeId = g.dataset.nodeId;
488
+ const highlighted = this.isNodeHighlighted(nodeId);
489
+ g.classList.toggle('sankey__node--highlighted', highlighted);
490
+ });
491
+ // Update link highlights
492
+ const linkGroups = svg.querySelectorAll('[data-link-index]');
493
+ linkGroups.forEach(g => {
494
+ const index = parseInt(g.dataset.linkIndex, 10);
495
+ const highlighted = this.isLinkHighlighted(index);
496
+ g.classList.toggle('sankey__link--highlighted', highlighted);
497
+ });
498
+ }
499
+ isNodeHighlighted(nodeId) {
500
+ if (this.hoveredNodeId === null && this.hoveredLinkIndex === null)
501
+ return false;
502
+ if (this.hoveredNodeId === nodeId)
503
+ return true;
504
+ if (this.hoveredLinkIndex !== null) {
505
+ const link = this.layoutLinks[this.hoveredLinkIndex];
506
+ return link?.source.id === nodeId || link?.target.id === nodeId;
507
+ }
508
+ if (this.hoveredNodeId) {
509
+ return this.layoutLinks.some(l => (l.source.id === this.hoveredNodeId && l.target.id === nodeId) ||
510
+ (l.target.id === this.hoveredNodeId && l.source.id === nodeId));
511
+ }
512
+ return false;
513
+ }
514
+ isLinkHighlighted(index) {
515
+ if (this.hoveredNodeId === null && this.hoveredLinkIndex === null)
516
+ return false;
517
+ if (this.hoveredLinkIndex === index)
518
+ return true;
519
+ if (this.hoveredNodeId) {
520
+ const link = this.layoutLinks[index];
521
+ return link?.source.id === this.hoveredNodeId || link?.target.id === this.hoveredNodeId;
522
+ }
523
+ return false;
524
+ }
525
+ rebuildChart() {
526
+ const chart = this.chartEl;
527
+ if (!chart) {
528
+ requestAnimationFrame(() => this.rebuildChart());
529
+ return;
530
+ }
531
+ const hasData = this.layoutNodes.length > 0;
532
+ if (!hasData) {
533
+ chart.innerHTML = '';
534
+ return;
535
+ }
536
+ chart.innerHTML = this.buildSVG();
537
+ }
538
+ buildSVG() {
539
+ const nodes = this.layoutNodes;
540
+ const links = this.layoutLinks;
541
+ let svg = `<svg class="sankey__svg" viewBox="0 0 ${this.chartWidth} ${this.chartHeight}" preserveAspectRatio="xMidYMid meet" role="img" aria-label="Sankey diagram">`;
542
+ // Links
543
+ svg += `<g class="sankey__links">`;
544
+ for (let i = 0; i < links.length; i++) {
545
+ const link = links[i];
546
+ const path = escapeHTML(this.getLinkPath(link));
547
+ const color = escapeHTML(link.color);
548
+ svg += `<g class="sankey__link" data-link-index="${i}">`;
549
+ svg += `<path d="${path}" stroke="${color}" stroke-width="${Math.max(1, link.width)}"/>`;
550
+ svg += `</g>`;
551
+ }
552
+ svg += `</g>`;
553
+ // Nodes
554
+ svg += `<g class="sankey__nodes">`;
555
+ for (let i = 0; i < nodes.length; i++) {
556
+ const node = nodes[i];
557
+ const color = escapeHTML(node.color);
558
+ const nodeId = escapeHTML(node.id);
559
+ svg += `<g class="sankey__node" data-node-id="${nodeId}">`;
560
+ svg += `<rect x="${node.x}" y="${node.y}" width="${node.width}" height="${Math.max(node.height, 2)}" fill="${color}"/>`;
561
+ if (this.showLabels) {
562
+ const label = escapeHTML(node.label);
563
+ if (node.depth === 0) {
564
+ svg += `<text class="sankey__label" x="${node.x - 6}" y="${node.y + node.height / 2}" text-anchor="end">${label}</text>`;
565
+ }
566
+ else {
567
+ svg += `<text class="sankey__label" x="${node.x + node.width + 6}" y="${node.y + node.height / 2}" text-anchor="start">${label}</text>`;
568
+ }
569
+ }
570
+ if (this.showValues && node.height > 12) {
571
+ const value = escapeHTML(node.value.toLocaleString());
572
+ if (node.depth === 0) {
573
+ svg += `<text class="sankey__value" x="${node.x - 6}" y="${node.y + node.height / 2 + 12}" text-anchor="end">${value}</text>`;
574
+ }
575
+ else {
576
+ svg += `<text class="sankey__value" x="${node.x + node.width + 6}" y="${node.y + node.height / 2 + 12}" text-anchor="start">${value}</text>`;
577
+ }
578
+ }
579
+ svg += `</g>`;
580
+ }
581
+ svg += `</g>`;
582
+ svg += `</svg>`;
583
+ return svg;
584
+ }
585
+ renderContent() {
586
+ return html /*html*/ `
587
+ <div class="sankey"
588
+ role="img"
589
+ aria-label="Sankey diagram"
590
+ @click=${(e) => this.handleSvgClick(e)}
591
+ @mousemove=${(e) => this.handleSvgMouseMove(e)}
592
+ @mouseleave=${() => this.handleSvgMouseLeave()}>
593
+ <div class="sankey__chart"></div>
594
+ <div class="sankey__tooltip">
595
+ <div class="sankey__tooltip-label"></div>
596
+ <div class="sankey__tooltip-value"></div>
597
+ </div>
598
+ </div>
599
+ `;
600
+ }
601
+ componentStyles() {
602
+ return css /*css*/ `${cssContent}`;
603
+ }
604
+ cleanup() {
605
+ this.resizeObserver?.disconnect();
606
+ }
607
+ });
608
+ return _classThis;
609
+ })();
610
+
611
+ export { SniceSankey };
612
+ //# sourceMappingURL=snice-sankey.js.map