@omnitron-dev/prism 0.3.0 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (413) hide show
  1. package/README.md +216 -2
  2. package/THIRD-PARTY-NOTICES.txt +26 -0
  3. package/dist/accessibility/index.js +2 -0
  4. package/dist/accessibility/index.js.map +1 -1
  5. package/dist/auth/index.d.ts +4 -0
  6. package/dist/auth/index.d.ts.map +1 -0
  7. package/dist/auth/index.js +4 -0
  8. package/dist/auth/index.js.map +1 -0
  9. package/dist/blocks/auth-block/guards.d.ts +3 -2
  10. package/dist/blocks/auth-block/guards.d.ts.map +1 -1
  11. package/dist/blocks/dashboard-block/dashboard-block.d.ts.map +1 -1
  12. package/dist/blocks/dashboard-block/types.d.ts +4 -2
  13. package/dist/blocks/dashboard-block/types.d.ts.map +1 -1
  14. package/dist/blocks/dashboard-block/use-dashboard-block.d.ts +2 -2
  15. package/dist/blocks/dashboard-block/use-dashboard-block.d.ts.map +1 -1
  16. package/dist/blocks/data-grid-block/data-grid-block.d.ts.map +1 -1
  17. package/dist/blocks/data-grid-block/types.d.ts +3 -0
  18. package/dist/blocks/data-grid-block/types.d.ts.map +1 -1
  19. package/dist/blocks/index.js +80 -253
  20. package/dist/blocks/index.js.map +1 -1
  21. package/dist/chunk-2AB7VGPW.js +447 -0
  22. package/dist/chunk-2AB7VGPW.js.map +1 -0
  23. package/dist/{chunk-WFD54GQQ.js → chunk-2E67PQ4T.js} +14 -573
  24. package/dist/chunk-2E67PQ4T.js.map +1 -0
  25. package/dist/chunk-2KG2NI73.js +84 -0
  26. package/dist/chunk-2KG2NI73.js.map +1 -0
  27. package/dist/chunk-2UYRW6X3.js +44 -0
  28. package/dist/chunk-2UYRW6X3.js.map +1 -0
  29. package/dist/chunk-36C5H56C.js +208 -0
  30. package/dist/chunk-36C5H56C.js.map +1 -0
  31. package/dist/chunk-36FOXX25.js +73 -0
  32. package/dist/chunk-36FOXX25.js.map +1 -0
  33. package/dist/chunk-3VSM7NZG.js +562 -0
  34. package/dist/chunk-3VSM7NZG.js.map +1 -0
  35. package/dist/chunk-4B2LTPK2.js +826 -0
  36. package/dist/chunk-4B2LTPK2.js.map +1 -0
  37. package/dist/chunk-4HUGZJKU.js +108 -0
  38. package/dist/chunk-4HUGZJKU.js.map +1 -0
  39. package/dist/chunk-4Q5L7LDG.js +74 -0
  40. package/dist/chunk-4Q5L7LDG.js.map +1 -0
  41. package/dist/{chunk-BRDWQVRT.js → chunk-4R7EZ7GQ.js} +3 -2
  42. package/dist/chunk-4R7EZ7GQ.js.map +1 -0
  43. package/dist/chunk-6IANOSMD.js +185 -0
  44. package/dist/chunk-6IANOSMD.js.map +1 -0
  45. package/dist/chunk-7ATBURW2.js +206 -0
  46. package/dist/chunk-7ATBURW2.js.map +1 -0
  47. package/dist/{chunk-6AHI4GSV.js → chunk-AATAOOSF.js} +4 -3
  48. package/dist/chunk-AATAOOSF.js.map +1 -0
  49. package/dist/chunk-AKLRKCYH.js +128 -0
  50. package/dist/chunk-AKLRKCYH.js.map +1 -0
  51. package/dist/chunk-CT46KJOR.js +133 -0
  52. package/dist/chunk-CT46KJOR.js.map +1 -0
  53. package/dist/{chunk-YQW43BDH.js → chunk-D4GFAJAZ.js} +1168 -6354
  54. package/dist/chunk-D4GFAJAZ.js.map +1 -0
  55. package/dist/chunk-D5J3KW6Q.js +106 -0
  56. package/dist/chunk-D5J3KW6Q.js.map +1 -0
  57. package/dist/chunk-DEPJRTVT.js +3 -0
  58. package/dist/{chunk-FU52GL2E.js.map → chunk-DEPJRTVT.js.map} +1 -1
  59. package/dist/{chunk-S6SEGBX6.js → chunk-DHTYHUYI.js} +85 -107
  60. package/dist/chunk-DHTYHUYI.js.map +1 -0
  61. package/dist/chunk-E7WM2RXA.js +249 -0
  62. package/dist/chunk-E7WM2RXA.js.map +1 -0
  63. package/dist/chunk-F6RZ7LW6.js +1271 -0
  64. package/dist/chunk-F6RZ7LW6.js.map +1 -0
  65. package/dist/chunk-FOGY3HA4.js +217 -0
  66. package/dist/chunk-FOGY3HA4.js.map +1 -0
  67. package/dist/chunk-G2GANYMW.js +139 -0
  68. package/dist/chunk-G2GANYMW.js.map +1 -0
  69. package/dist/chunk-I6DILPFE.js +293 -0
  70. package/dist/chunk-I6DILPFE.js.map +1 -0
  71. package/dist/chunk-IRYU3NTG.js +573 -0
  72. package/dist/chunk-IRYU3NTG.js.map +1 -0
  73. package/dist/chunk-JTIUGPW5.js +284 -0
  74. package/dist/chunk-JTIUGPW5.js.map +1 -0
  75. package/dist/{chunk-GUFHFEPZ.js → chunk-JZBSPDED.js} +2 -2
  76. package/dist/{chunk-GUFHFEPZ.js.map → chunk-JZBSPDED.js.map} +1 -1
  77. package/dist/chunk-KPY7TA4D.js +191 -0
  78. package/dist/chunk-KPY7TA4D.js.map +1 -0
  79. package/dist/{chunk-OBJ244BO.js → chunk-LFWKGNCX.js} +50 -656
  80. package/dist/chunk-LFWKGNCX.js.map +1 -0
  81. package/dist/chunk-LH4ZZZYB.js +37 -0
  82. package/dist/chunk-LH4ZZZYB.js.map +1 -0
  83. package/dist/chunk-NFJ7CPG3.js +13 -0
  84. package/dist/chunk-NFJ7CPG3.js.map +1 -0
  85. package/dist/chunk-NFPOIHD4.js +3 -0
  86. package/dist/{chunk-AYYFMTMI.js.map → chunk-NFPOIHD4.js.map} +1 -1
  87. package/dist/{chunk-XIXSSI3B.js → chunk-NJM5AVBM.js} +3 -2
  88. package/dist/chunk-NJM5AVBM.js.map +1 -0
  89. package/dist/{chunk-Z5OSPAOC.js → chunk-NSNM53WI.js} +196 -175
  90. package/dist/chunk-NSNM53WI.js.map +1 -0
  91. package/dist/chunk-NTREGTG7.js +31 -0
  92. package/dist/chunk-NTREGTG7.js.map +1 -0
  93. package/dist/{chunk-ADG4HZEP.js → chunk-OKJA6SJM.js} +4 -4
  94. package/dist/chunk-OKJA6SJM.js.map +1 -0
  95. package/dist/chunk-Q6JDNFSG.js +303 -0
  96. package/dist/chunk-Q6JDNFSG.js.map +1 -0
  97. package/dist/chunk-RPOGINR5.js +115 -0
  98. package/dist/chunk-RPOGINR5.js.map +1 -0
  99. package/dist/{chunk-ZTATTUH7.js → chunk-RSWVYIXK.js} +282 -683
  100. package/dist/chunk-RSWVYIXK.js.map +1 -0
  101. package/dist/chunk-SSEHL5VP.js +110 -0
  102. package/dist/chunk-SSEHL5VP.js.map +1 -0
  103. package/dist/chunk-TEIGUOWN.js +523 -0
  104. package/dist/chunk-TEIGUOWN.js.map +1 -0
  105. package/dist/{chunk-AYYFMTMI.js → chunk-TJ7DHXUX.js} +2 -2
  106. package/dist/chunk-TJ7DHXUX.js.map +1 -0
  107. package/dist/chunk-TZHWYT34.js +590 -0
  108. package/dist/chunk-TZHWYT34.js.map +1 -0
  109. package/dist/chunk-TZWHELY4.js +45 -0
  110. package/dist/chunk-TZWHELY4.js.map +1 -0
  111. package/dist/{chunk-BZOL7GMU.js → chunk-UEINJFLS.js} +7 -7
  112. package/dist/chunk-UEINJFLS.js.map +1 -0
  113. package/dist/chunk-URFQX3I6.js +129 -0
  114. package/dist/chunk-URFQX3I6.js.map +1 -0
  115. package/dist/chunk-VG6FOMOH.js +187 -0
  116. package/dist/chunk-VG6FOMOH.js.map +1 -0
  117. package/dist/chunk-VQVVHMPG.js +106 -0
  118. package/dist/chunk-VQVVHMPG.js.map +1 -0
  119. package/dist/{chunk-DRFNMZLG.js → chunk-VUKOT432.js} +3 -2
  120. package/dist/chunk-VUKOT432.js.map +1 -0
  121. package/dist/chunk-WD4N72DL.js +315 -0
  122. package/dist/chunk-WD4N72DL.js.map +1 -0
  123. package/dist/chunk-XBYMG4QK.js +119 -0
  124. package/dist/chunk-XBYMG4QK.js.map +1 -0
  125. package/dist/chunk-YHM6GIHV.js +3 -0
  126. package/dist/chunk-YHM6GIHV.js.map +1 -0
  127. package/dist/{chunk-SNZK5X6F.js → chunk-Z2AN43YU.js} +4 -2
  128. package/dist/chunk-Z2AN43YU.js.map +1 -0
  129. package/dist/chunk-ZNWHMQRM.js +171 -0
  130. package/dist/chunk-ZNWHMQRM.js.map +1 -0
  131. package/dist/{chunk-YSIG2XYH.js → chunk-ZRJYQN6Y.js} +2 -2
  132. package/dist/{chunk-YSIG2XYH.js.map → chunk-ZRJYQN6Y.js.map} +1 -1
  133. package/dist/{chunk-AD4W7HYC.js → chunk-ZYI3MHLE.js} +3 -2
  134. package/dist/chunk-ZYI3MHLE.js.map +1 -0
  135. package/dist/cli/index.js +66 -423
  136. package/dist/cli/index.js.map +1 -1
  137. package/dist/components/accordion/accordion.d.ts.map +1 -1
  138. package/dist/components/admin-filters/admin-data-table.d.ts +7 -1
  139. package/dist/components/admin-filters/admin-data-table.d.ts.map +1 -1
  140. package/dist/components/admin-filters/filter-toolbar.d.ts.map +1 -1
  141. package/dist/components/admin-filters/index.js +8 -0
  142. package/dist/components/admin-filters/index.js.map +1 -0
  143. package/dist/components/alert/alert.d.ts.map +1 -1
  144. package/dist/components/alert/index.js +5 -0
  145. package/dist/components/alert/index.js.map +1 -0
  146. package/dist/components/animate/index.js +5 -0
  147. package/dist/components/animate/index.js.map +1 -0
  148. package/dist/components/breadcrumbs/breadcrumbs.d.ts.map +1 -1
  149. package/dist/components/breadcrumbs/index.js +4 -0
  150. package/dist/components/breadcrumbs/index.js.map +1 -0
  151. package/dist/components/card/index.js +4 -0
  152. package/dist/components/card/index.js.map +1 -0
  153. package/dist/components/chart/chart.d.ts.map +1 -1
  154. package/dist/components/chart/index.css +52 -0
  155. package/dist/components/chart/index.css.map +1 -0
  156. package/dist/components/chart/index.js +5 -0
  157. package/dist/components/chart/index.js.map +1 -0
  158. package/dist/components/chart/types.d.ts +3 -1
  159. package/dist/components/chart/types.d.ts.map +1 -1
  160. package/dist/components/chart/use-chart.d.ts.map +1 -1
  161. package/dist/components/command-palette/command-palette.d.ts +3 -1
  162. package/dist/components/command-palette/command-palette.d.ts.map +1 -1
  163. package/dist/components/command-palette/index.js +4 -0
  164. package/dist/components/command-palette/index.js.map +1 -0
  165. package/dist/components/confirm-dialog/index.js +4 -0
  166. package/dist/components/confirm-dialog/index.js.map +1 -0
  167. package/dist/components/date-input/date-input.d.ts +28 -0
  168. package/dist/components/date-input/date-input.d.ts.map +1 -0
  169. package/dist/components/date-input/index.d.ts +3 -0
  170. package/dist/components/date-input/index.d.ts.map +1 -0
  171. package/dist/components/date-input/value.d.ts +9 -0
  172. package/dist/components/date-input/value.d.ts.map +1 -0
  173. package/dist/components/doc-layout/doc-sidebar.d.ts +4 -1
  174. package/dist/components/doc-layout/doc-sidebar.d.ts.map +1 -1
  175. package/dist/components/doc-layout/index.js +7 -0
  176. package/dist/components/doc-layout/index.js.map +1 -0
  177. package/dist/components/editor/editor.d.ts.map +1 -1
  178. package/dist/components/editor/icons/index.d.ts +32 -40
  179. package/dist/components/editor/icons/index.d.ts.map +1 -1
  180. package/dist/components/editor/index.js +4 -1
  181. package/dist/components/editor/index.js.map +1 -1
  182. package/dist/components/emoji-picker/index.js +2 -1
  183. package/dist/components/emoji-picker/index.js.map +1 -1
  184. package/dist/components/empty-content/empty-content.d.ts.map +1 -1
  185. package/dist/components/empty-content/index.js +4 -0
  186. package/dist/components/empty-content/index.js.map +1 -0
  187. package/dist/components/error-boundary/error-boundary.d.ts.map +1 -1
  188. package/dist/components/error-boundary/index.js +6 -0
  189. package/dist/components/error-boundary/index.js.map +1 -0
  190. package/dist/components/index.css +17 -10
  191. package/dist/components/index.css.map +1 -1
  192. package/dist/components/index.d.ts +5 -4
  193. package/dist/components/index.d.ts.map +1 -1
  194. package/dist/components/index.js +47 -11
  195. package/dist/components/index.js.map +1 -1
  196. package/dist/components/knowledge-graph/edge-labels.d.ts +14 -0
  197. package/dist/components/knowledge-graph/edge-labels.d.ts.map +1 -0
  198. package/dist/components/knowledge-graph/graph.d.ts +56 -0
  199. package/dist/components/knowledge-graph/graph.d.ts.map +1 -0
  200. package/dist/components/knowledge-graph/index.css +176 -0
  201. package/dist/components/knowledge-graph/index.css.map +1 -0
  202. package/dist/components/knowledge-graph/index.d.ts +3 -0
  203. package/dist/components/knowledge-graph/index.d.ts.map +1 -0
  204. package/dist/components/knowledge-graph/index.js +797 -0
  205. package/dist/components/knowledge-graph/index.js.map +1 -0
  206. package/dist/components/knowledge-graph/label-layout.d.ts +28 -0
  207. package/dist/components/knowledge-graph/label-layout.d.ts.map +1 -0
  208. package/dist/components/knowledge-graph/label-store.d.ts +15 -0
  209. package/dist/components/knowledge-graph/label-store.d.ts.map +1 -0
  210. package/dist/components/knowledge-graph/model.d.ts +92 -0
  211. package/dist/components/knowledge-graph/model.d.ts.map +1 -0
  212. package/dist/components/label/index.js +5 -0
  213. package/dist/components/label/index.js.map +1 -0
  214. package/dist/components/label/label.d.ts.map +1 -1
  215. package/dist/components/lightbox/lightbox.d.ts.map +1 -1
  216. package/dist/components/loading-screen/index.js +4 -0
  217. package/dist/components/loading-screen/index.js.map +1 -0
  218. package/dist/components/map/Map.d.ts +19 -43
  219. package/dist/components/map/Map.d.ts.map +1 -1
  220. package/dist/components/map/MapCoverageLayer.d.ts +1 -1
  221. package/dist/components/map/MapCoverageLayer.d.ts.map +1 -1
  222. package/dist/components/map/MapMarker.d.ts +1 -1
  223. package/dist/components/map/MapMarker.d.ts.map +1 -1
  224. package/dist/components/map/MapPlaceSearch.d.ts +33 -0
  225. package/dist/components/map/MapPlaceSearch.d.ts.map +1 -0
  226. package/dist/components/map/MapPointPicker.d.ts +21 -12
  227. package/dist/components/map/MapPointPicker.d.ts.map +1 -1
  228. package/dist/components/map/coordinates.d.ts +10 -0
  229. package/dist/components/map/coordinates.d.ts.map +1 -0
  230. package/dist/components/map/index.css +4 -0
  231. package/dist/components/map/index.css.map +1 -0
  232. package/dist/components/map/index.d.ts +7 -2
  233. package/dist/components/map/index.d.ts.map +1 -1
  234. package/dist/components/map/index.js +4 -0
  235. package/dist/components/map/index.js.map +1 -0
  236. package/dist/components/nav-card/nav-card.d.ts.map +1 -1
  237. package/dist/components/navigation-progress/index.js +4 -0
  238. package/dist/components/navigation-progress/index.js.map +1 -0
  239. package/dist/components/page-content/index.js +4 -0
  240. package/dist/components/page-content/index.js.map +1 -0
  241. package/dist/components/popover/index.js +4 -0
  242. package/dist/components/popover/index.js.map +1 -0
  243. package/dist/components/rail/rail.d.ts.map +1 -1
  244. package/dist/components/research/diagram-image.d.ts +11 -0
  245. package/dist/components/research/diagram-image.d.ts.map +1 -0
  246. package/dist/components/research/diagram.d.ts +8 -0
  247. package/dist/components/research/diagram.d.ts.map +1 -0
  248. package/dist/components/research/document.d.ts +33 -0
  249. package/dist/components/research/document.d.ts.map +1 -0
  250. package/dist/components/research/frontmatter.d.ts +15 -0
  251. package/dist/components/research/frontmatter.d.ts.map +1 -0
  252. package/dist/components/research/index.css +51 -0
  253. package/dist/components/research/index.css.map +1 -0
  254. package/dist/components/research/index.d.ts +3 -0
  255. package/dist/components/research/index.d.ts.map +1 -0
  256. package/dist/components/research/index.js +8 -0
  257. package/dist/components/research/index.js.map +1 -0
  258. package/dist/components/research/parse.d.ts +29 -0
  259. package/dist/components/research/parse.d.ts.map +1 -0
  260. package/dist/components/research-editor/block-commands.d.ts +20 -0
  261. package/dist/components/research-editor/block-commands.d.ts.map +1 -0
  262. package/dist/components/research-editor/block-controls.d.ts +13 -0
  263. package/dist/components/research-editor/block-controls.d.ts.map +1 -0
  264. package/dist/components/research-editor/editor.d.ts +75 -0
  265. package/dist/components/research-editor/editor.d.ts.map +1 -0
  266. package/dist/components/research-editor/extensions.d.ts +14 -0
  267. package/dist/components/research-editor/extensions.d.ts.map +1 -0
  268. package/dist/components/research-editor/index.css +332 -0
  269. package/dist/components/research-editor/index.css.map +1 -0
  270. package/dist/components/research-editor/index.d.ts +5 -0
  271. package/dist/components/research-editor/index.d.ts.map +1 -0
  272. package/dist/components/research-editor/index.js +1593 -0
  273. package/dist/components/research-editor/index.js.map +1 -0
  274. package/dist/components/research-editor/math-input.d.ts +32 -0
  275. package/dist/components/research-editor/math-input.d.ts.map +1 -0
  276. package/dist/components/research-editor/math-markup.d.ts +4 -0
  277. package/dist/components/research-editor/math-markup.d.ts.map +1 -0
  278. package/dist/components/research-editor/math-navigation.d.ts +6 -0
  279. package/dist/components/research-editor/math-navigation.d.ts.map +1 -0
  280. package/dist/components/research-editor/math-node.d.ts +11 -0
  281. package/dist/components/research-editor/math-node.d.ts.map +1 -0
  282. package/dist/components/research-editor/source.d.ts +19 -0
  283. package/dist/components/research-editor/source.d.ts.map +1 -0
  284. package/dist/components/scroll-to-top/index.js +4 -0
  285. package/dist/components/scroll-to-top/index.js.map +1 -0
  286. package/dist/components/scrollbar/scrollbar.d.ts +4 -2
  287. package/dist/components/scrollbar/scrollbar.d.ts.map +1 -1
  288. package/dist/components/search-input/index.js +7 -0
  289. package/dist/components/search-input/index.js.map +1 -0
  290. package/dist/components/search-input/search-input.d.ts +3 -11
  291. package/dist/components/search-input/search-input.d.ts.map +1 -1
  292. package/dist/components/skeleton/index.js +4 -0
  293. package/dist/components/skeleton/index.js.map +1 -0
  294. package/dist/components/snackbar/index.js +6 -0
  295. package/dist/components/snackbar/index.js.map +1 -0
  296. package/dist/components/stepper/index.js +4 -0
  297. package/dist/components/stepper/index.js.map +1 -0
  298. package/dist/components/table/index.d.ts +1 -0
  299. package/dist/components/table/index.d.ts.map +1 -1
  300. package/dist/components/table/index.js +5 -0
  301. package/dist/components/table/index.js.map +1 -0
  302. package/dist/components/table/table-viewport.d.ts +13 -0
  303. package/dist/components/table/table-viewport.d.ts.map +1 -0
  304. package/dist/components/table/table.d.ts +3 -1
  305. package/dist/components/table/table.d.ts.map +1 -1
  306. package/dist/components/tabs/index.js +6 -0
  307. package/dist/components/tabs/index.js.map +1 -0
  308. package/dist/components/tabs/tabs.d.ts +12 -1
  309. package/dist/components/tabs/tabs.d.ts.map +1 -1
  310. package/dist/components/tiptap-renderer/tiptap-renderer.d.ts +4 -3
  311. package/dist/components/tiptap-renderer/tiptap-renderer.d.ts.map +1 -1
  312. package/dist/core/index.d.ts +1 -1
  313. package/dist/core/index.d.ts.map +1 -1
  314. package/dist/core/index.js +12 -6
  315. package/dist/core/index.js.map +1 -1
  316. package/dist/core/provider.d.ts +7 -2
  317. package/dist/core/provider.d.ts.map +1 -1
  318. package/dist/forms/index.js +2 -0
  319. package/dist/forms/index.js.map +1 -1
  320. package/dist/forms/schema-provider.d.ts +3 -3
  321. package/dist/forms/schema-utils.d.ts +3 -3
  322. package/dist/hooks/index.js +14 -8
  323. package/dist/hooks/index.js.map +1 -1
  324. package/dist/hooks/use-config-from-query.d.ts +2 -0
  325. package/dist/hooks/use-config-from-query.d.ts.map +1 -1
  326. package/dist/hooks/use-image-dimensions.d.ts.map +1 -1
  327. package/dist/hooks/use-keyboard-shortcut.d.ts.map +1 -1
  328. package/dist/hooks/use-scroll-position.d.ts.map +1 -1
  329. package/dist/hooks/use-window-size.d.ts.map +1 -1
  330. package/dist/icons/context.d.ts +17 -0
  331. package/dist/icons/context.d.ts.map +1 -0
  332. package/dist/icons/controls.d.ts +51 -0
  333. package/dist/icons/controls.d.ts.map +1 -0
  334. package/dist/icons/index.d.ts +3 -0
  335. package/dist/icons/index.d.ts.map +1 -0
  336. package/dist/icons/index.js +5 -0
  337. package/dist/icons/index.js.map +1 -0
  338. package/dist/icons/theme.d.ts +4 -0
  339. package/dist/icons/theme.d.ts.map +1 -0
  340. package/dist/index.css +17 -10
  341. package/dist/index.css.map +1 -1
  342. package/dist/index.js +57 -20
  343. package/dist/index.js.map +1 -1
  344. package/dist/internal/research-parser.js +3 -0
  345. package/dist/internal/research-parser.js.map +1 -0
  346. package/dist/layouts/core/header-section.d.ts +1 -0
  347. package/dist/layouts/core/header-section.d.ts.map +1 -1
  348. package/dist/layouts/dashboard/labels.d.ts +12 -0
  349. package/dist/layouts/dashboard/labels.d.ts.map +1 -0
  350. package/dist/layouts/dashboard/layout.d.ts +9 -1
  351. package/dist/layouts/dashboard/layout.d.ts.map +1 -1
  352. package/dist/layouts/dashboard/sidenav.d.ts +7 -3
  353. package/dist/layouts/dashboard/sidenav.d.ts.map +1 -1
  354. package/dist/layouts/index.d.ts +5 -0
  355. package/dist/layouts/index.d.ts.map +1 -1
  356. package/dist/layouts/index.js +9 -3
  357. package/dist/layouts/index.js.map +1 -1
  358. package/dist/layouts/panel-layout.d.ts +35 -0
  359. package/dist/layouts/panel-layout.d.ts.map +1 -0
  360. package/dist/layouts/sidebar-toggle.d.ts +11 -0
  361. package/dist/layouts/sidebar-toggle.d.ts.map +1 -0
  362. package/dist/netron/index.js +2 -1
  363. package/dist/netron/index.js.map +1 -1
  364. package/dist/registry/index.js +1 -1
  365. package/dist/state/create-store.d.ts.map +1 -1
  366. package/dist/state/index.js +3 -2
  367. package/dist/state/index.js.map +1 -1
  368. package/dist/state/settings-version.d.ts.map +1 -1
  369. package/dist/state/stores/auth.d.ts +4 -16
  370. package/dist/state/stores/auth.d.ts.map +1 -1
  371. package/dist/state/stores/ui.d.ts +7 -105
  372. package/dist/state/stores/ui.d.ts.map +1 -1
  373. package/dist/theme/components/Button.d.ts.map +1 -1
  374. package/dist/theme/components/Chip.d.ts.map +1 -1
  375. package/dist/theme/components/Dialog.d.ts.map +1 -1
  376. package/dist/theme/components/FormControls.d.ts +3 -12
  377. package/dist/theme/components/FormControls.d.ts.map +1 -1
  378. package/dist/theme/components/TextField.d.ts.map +1 -1
  379. package/dist/theme/components/index.d.ts.map +1 -1
  380. package/dist/theme/components/theme-utils.d.ts +2 -2
  381. package/dist/theme/components/theme-utils.d.ts.map +1 -1
  382. package/dist/theme/create-theme.d.ts +5 -17
  383. package/dist/theme/create-theme.d.ts.map +1 -1
  384. package/dist/theme/index.js +8 -2
  385. package/dist/theme/index.js.map +1 -1
  386. package/dist/theme/mixins.d.ts +3 -1
  387. package/dist/theme/mixins.d.ts.map +1 -1
  388. package/dist/theme/palette/overrides.d.ts +24 -0
  389. package/dist/theme/palette/overrides.d.ts.map +1 -0
  390. package/dist/theme/semantic-surface.d.ts +8 -0
  391. package/dist/theme/semantic-surface.d.ts.map +1 -0
  392. package/dist/types/index.js +2 -2
  393. package/dist/ui/index.d.ts +18 -0
  394. package/dist/ui/index.d.ts.map +1 -0
  395. package/dist/ui/index.js +149 -0
  396. package/dist/ui/index.js.map +1 -0
  397. package/dist/utils/async-lock.d.ts.map +1 -1
  398. package/package.json +200 -47
  399. package/dist/chunk-6AHI4GSV.js.map +0 -1
  400. package/dist/chunk-AD4W7HYC.js.map +0 -1
  401. package/dist/chunk-ADG4HZEP.js.map +0 -1
  402. package/dist/chunk-BRDWQVRT.js.map +0 -1
  403. package/dist/chunk-BZOL7GMU.js.map +0 -1
  404. package/dist/chunk-DRFNMZLG.js.map +0 -1
  405. package/dist/chunk-FU52GL2E.js +0 -3
  406. package/dist/chunk-OBJ244BO.js.map +0 -1
  407. package/dist/chunk-S6SEGBX6.js.map +0 -1
  408. package/dist/chunk-SNZK5X6F.js.map +0 -1
  409. package/dist/chunk-WFD54GQQ.js.map +0 -1
  410. package/dist/chunk-XIXSSI3B.js.map +0 -1
  411. package/dist/chunk-YQW43BDH.js.map +0 -1
  412. package/dist/chunk-Z5OSPAOC.js.map +0 -1
  413. package/dist/chunk-ZTATTUH7.js.map +0 -1
@@ -0,0 +1,797 @@
1
+ "use client";
2
+ import { DocSidebar } from '../../chunk-7ATBURW2.js';
3
+ import { PanelLayout } from '../../chunk-KPY7TA4D.js';
4
+ import '../../chunk-NJM5AVBM.js';
5
+ import '../../chunk-4Q5L7LDG.js';
6
+ import '../../chunk-IRYU3NTG.js';
7
+ import { ZoomInIcon, ZoomOutIcon, FitViewIcon } from '../../chunk-VQVVHMPG.js';
8
+ import '../../chunk-D5J3KW6Q.js';
9
+ import { createContext, memo, useState, useMemo, useRef, useEffect, useCallback, useSyncExternalStore, useLayoutEffect, useContext } from 'react';
10
+ import { Handle, Position, MarkerType, applyNodeChanges, ReactFlow, Background, getSmoothStepPath, BaseEdge, useNodes, useNodesInitialized, useReactFlow, useStore, EdgeLabelRenderer, Controls, ControlButton } from '@xyflow/react';
11
+ import Box2 from '@mui/material/Box';
12
+ import Chip from '@mui/material/Chip';
13
+ import Dialog from '@mui/material/Dialog';
14
+ import Button from '@mui/material/Button';
15
+ import TextField from '@mui/material/TextField';
16
+ import { useTheme } from '@mui/material/styles';
17
+ import '@xyflow/react/dist/style.css';
18
+ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
19
+
20
+ // src/components/knowledge-graph/model.ts
21
+ function validateKnowledgeGraph(data) {
22
+ const ids = /* @__PURE__ */ new Set();
23
+ for (const entity of data.entities) {
24
+ if (!entity.id || !entity.kind || !entity.label || ids.has(entity.id)) throw Error("invalid_entity");
25
+ ids.add(entity.id);
26
+ }
27
+ const relations = /* @__PURE__ */ new Set();
28
+ for (const relation of data.relations) {
29
+ if (!relation.id || !relation.kind || !relation.label || relations.has(relation.id) || !relation.inputs.length || !relation.outputs.length)
30
+ throw Error("invalid_relation");
31
+ relations.add(relation.id);
32
+ for (const port of [...relation.inputs, ...relation.outputs])
33
+ if (!ids.has(port.entity) || !port.role) throw Error("dangling_port");
34
+ }
35
+ }
36
+ function projectKnowledgeGraph(data, selection, budget = 300) {
37
+ if (!Number.isSafeInteger(budget) || budget < 1) throw Error("invalid_graph_budget");
38
+ const total = data.entities.length + data.relations.length;
39
+ if (!selection && total <= budget)
40
+ return { entities: [...data.entities], relations: [...data.relations], total, omittedRelations: 0, limited: false };
41
+ if (!selection) return { entities: [], relations: [], total, omittedRelations: data.relations.length, limited: true };
42
+ const selectedEntities = /* @__PURE__ */ new Set(), selectedRelations = [];
43
+ if (selection.type === "entity" && data.entities.some((e) => e.id === selection.id))
44
+ selectedEntities.add(selection.id);
45
+ const candidates = selection.type === "relation" ? data.relations.filter((r) => r.id === selection.id) : data.relations.filter((r) => [...r.inputs, ...r.outputs].some((p) => p.entity === selection.id));
46
+ let omittedRelations = 0;
47
+ for (const relation of candidates) {
48
+ const endpoints = new Set([...relation.inputs, ...relation.outputs].map((p) => p.entity));
49
+ const additional = [...endpoints].filter((id) => !selectedEntities.has(id)).length + 1;
50
+ if (selectedEntities.size + selectedRelations.length + additional > budget) {
51
+ omittedRelations++;
52
+ continue;
53
+ }
54
+ for (const id of endpoints) selectedEntities.add(id);
55
+ selectedRelations.push(relation);
56
+ }
57
+ return {
58
+ entities: data.entities.filter((e) => selectedEntities.has(e.id)),
59
+ relations: selectedRelations,
60
+ total,
61
+ omittedRelations,
62
+ limited: total !== selectedEntities.size + selectedRelations.length
63
+ };
64
+ }
65
+ var entityNodeId = (id) => JSON.stringify(["entity", id]);
66
+ var relationNodeId = (id) => JSON.stringify(["relation", id]);
67
+ function incidenceGraph(projection) {
68
+ const nodes = [
69
+ ...projection.entities.map((e) => ({
70
+ id: entityNodeId(e.id),
71
+ selection: { type: "entity", id: e.id },
72
+ label: e.label,
73
+ kind: e.kind,
74
+ description: e.description,
75
+ badges: e.badges
76
+ })),
77
+ ...projection.relations.map((r) => ({
78
+ id: relationNodeId(r.id),
79
+ selection: { type: "relation", id: r.id },
80
+ label: r.label,
81
+ kind: r.kind,
82
+ description: r.description,
83
+ badges: r.badges,
84
+ inputs: r.inputs.length,
85
+ outputs: r.outputs.length
86
+ }))
87
+ ];
88
+ const edges = projection.relations.flatMap(
89
+ (r) => ["inputs", "outputs"].flatMap(
90
+ (side) => r[side].map((port, index) => ({
91
+ id: JSON.stringify([r.id, side, index]),
92
+ source: side === "inputs" ? entityNodeId(port.entity) : relationNodeId(r.id),
93
+ target: side === "inputs" ? relationNodeId(r.id) : entityNodeId(port.entity),
94
+ label: port.role,
95
+ ...side === "inputs" ? { targetHandle: `inputs:${index}` } : { sourceHandle: `outputs:${index}` },
96
+ relationId: r.id,
97
+ side,
98
+ index
99
+ }))
100
+ )
101
+ );
102
+ return { nodes, edges };
103
+ }
104
+
105
+ // src/components/knowledge-graph/label-layout.ts
106
+ function nearestFree(origin, intervals) {
107
+ intervals.sort((a, b) => a[0] - b[0] || a[1] - b[1]);
108
+ const union = [];
109
+ for (const interval of intervals) {
110
+ const last = union[union.length - 1];
111
+ if (last && interval[0] < last[1]) last[1] = Math.max(last[1], interval[1]);
112
+ else union.push([...interval]);
113
+ }
114
+ const hit = union.find(([lo, hi]) => lo < origin && origin < hi);
115
+ return hit ? origin - hit[0] <= hit[1] - origin ? hit[0] : hit[1] : origin;
116
+ }
117
+ function placeEdgeLabels(labels, nodes, gap = 8) {
118
+ if (!Number.isFinite(gap) || gap < 0) throw Error("invalid_label_gap");
119
+ const occupied = [...nodes];
120
+ for (const rect of [...nodes, ...labels]) {
121
+ if (![rect.x, rect.y, rect.width, rect.height].every(Number.isFinite) || rect.width <= 0 || rect.height <= 0)
122
+ throw Error("invalid_label_geometry");
123
+ }
124
+ if (new Set(labels.map((l) => l.id)).size !== labels.length) throw Error("duplicate_label");
125
+ const ordered = [...labels].sort((a, b) => a.y - b.y || a.x - b.x || (a.id < b.id ? -1 : a.id > b.id ? 1 : 0));
126
+ return ordered.map((label) => {
127
+ const x = label.x - label.width / 2, y = label.y - label.height / 2;
128
+ const vertical = [], horizontal = [];
129
+ for (const r of occupied) {
130
+ if (x < r.x + r.width + gap && x + label.width > r.x - gap)
131
+ vertical.push([r.y - gap - label.height, r.y + r.height + gap]);
132
+ if (y < r.y + r.height + gap && y + label.height > r.y - gap)
133
+ horizontal.push([r.x - gap - label.width, r.x + r.width + gap]);
134
+ }
135
+ const vx = nearestFree(x, horizontal), vy = nearestFree(y, vertical);
136
+ const box = Math.abs(vy - y) <= Math.abs(vx - x) ? { x, y: vy, width: label.width, height: label.height } : { x: vx, y, width: label.width, height: label.height };
137
+ occupied.push(box);
138
+ return { ...label, box };
139
+ });
140
+ }
141
+ function enclosingRect(rects) {
142
+ if (!rects.length) return void 0;
143
+ let x = Infinity, y = Infinity, right = -Infinity, bottom = -Infinity;
144
+ for (const r of rects) {
145
+ x = Math.min(x, r.x);
146
+ y = Math.min(y, r.y);
147
+ right = Math.max(right, r.x + r.width);
148
+ bottom = Math.max(bottom, r.y + r.height);
149
+ }
150
+ return { x, y, width: right - x, height: bottom - y };
151
+ }
152
+ var EdgeLabelsContext = createContext(null);
153
+ function useEdgeLabel(anchor) {
154
+ const store = useContext(EdgeLabelsContext);
155
+ const { id, text, x, y } = anchor ?? {};
156
+ useLayoutEffect(() => {
157
+ if (!store || id === void 0 || text === void 0 || x === void 0 || y === void 0) return void 0;
158
+ store.set({ id, text, x, y });
159
+ return () => store.remove(id);
160
+ }, [store, id, text, x, y]);
161
+ }
162
+ function MeasuredLabel({
163
+ anchor,
164
+ box,
165
+ maxWidth,
166
+ onSize
167
+ }) {
168
+ const ref = useRef(null);
169
+ useLayoutEffect(() => {
170
+ const element = ref.current;
171
+ if (!element) return void 0;
172
+ const measure = (width, height) => {
173
+ if (width > 0 && height > 0) onSize(anchor.id, { width: Math.ceil(width), height: Math.ceil(height) });
174
+ };
175
+ measure(element.offsetWidth, element.offsetHeight);
176
+ const observer = new ResizeObserver((entries) => {
177
+ const border = entries[0]?.borderBoxSize?.[0];
178
+ measure(border?.inlineSize ?? element.offsetWidth, border?.blockSize ?? element.offsetHeight);
179
+ });
180
+ observer.observe(element);
181
+ return () => {
182
+ observer.disconnect();
183
+ onSize(anchor.id, void 0);
184
+ };
185
+ }, [anchor.id, onSize]);
186
+ return /* @__PURE__ */ jsx(
187
+ Box2,
188
+ {
189
+ component: "span",
190
+ ref,
191
+ "aria-hidden": "true",
192
+ "data-edge-label": anchor.id,
193
+ className: "nodrag nopan prism-knowledge__edge-label",
194
+ sx: {
195
+ position: "absolute",
196
+ left: box?.x ?? anchor.x,
197
+ top: box?.y ?? anchor.y,
198
+ visibility: box ? "visible" : "hidden",
199
+ width: "max-content",
200
+ maxWidth,
201
+ bgcolor: "var(--prism-graph-bg)",
202
+ color: "var(--prism-graph-text)",
203
+ borderRadius: 0.5,
204
+ px: 0.75,
205
+ py: 0.25,
206
+ fontSize: 12,
207
+ lineHeight: 1.4,
208
+ boxSizing: "border-box",
209
+ whiteSpace: "pre-wrap",
210
+ overflowWrap: "anywhere",
211
+ pointerEvents: "none",
212
+ zIndex: 1
213
+ },
214
+ children: anchor.text
215
+ }
216
+ );
217
+ }
218
+ function EdgeLabels({
219
+ store,
220
+ gap,
221
+ maxWidth,
222
+ fitLabel,
223
+ zoomInLabel,
224
+ zoomOutLabel
225
+ }) {
226
+ const anchors = useSyncExternalStore(store.subscribe, store.getSnapshot, store.getSnapshot);
227
+ const [sizes, setSizes] = useState(/* @__PURE__ */ new Map());
228
+ const nodes = useNodes();
229
+ const initialized = useNodesInitialized();
230
+ const { fitBounds, zoomIn, zoomOut } = useReactFlow();
231
+ const atMinZoom = useStore((state) => state.transform[2] <= state.minZoom);
232
+ const atMaxZoom = useStore((state) => state.transform[2] >= state.maxZoom);
233
+ const initialFit = useRef(false);
234
+ const onSize = useCallback(
235
+ (id, size) => setSizes((prior) => {
236
+ const old = prior.get(id);
237
+ if (old?.width === size?.width && old?.height === size?.height) return prior;
238
+ const next = new Map(prior);
239
+ if (size) next.set(id, size);
240
+ else next.delete(id);
241
+ return next;
242
+ }),
243
+ []
244
+ );
245
+ const obstacles = useMemo(
246
+ () => nodes.flatMap((node) => {
247
+ const width = node.measured?.width, height = node.measured?.height;
248
+ return width && height && !node.hidden ? [{ ...node.position, width, height }] : [];
249
+ }),
250
+ [nodes]
251
+ );
252
+ const placements = useMemo(
253
+ () => placeEdgeLabels(
254
+ anchors.flatMap((anchor) => {
255
+ const size = sizes.get(anchor.id);
256
+ return size ? [{ ...anchor, ...size }] : [];
257
+ }),
258
+ obstacles,
259
+ gap
260
+ ),
261
+ [anchors, sizes, obstacles, gap]
262
+ );
263
+ const boxes = useMemo(() => new Map(placements.map((l) => [l.id, l.box])), [placements]);
264
+ const bounds = useMemo(() => enclosingRect([...obstacles, ...placements.map((l) => l.box)]), [obstacles, placements]);
265
+ const fit = useCallback(() => {
266
+ if (bounds) void fitBounds(bounds, { padding: 0.12, duration: 0 });
267
+ }, [bounds, fitBounds]);
268
+ useLayoutEffect(() => {
269
+ if (!initialFit.current && initialized && anchors.length && placements.length === anchors.length) {
270
+ initialFit.current = true;
271
+ fit();
272
+ }
273
+ }, [initialized, anchors.length, placements.length, fit]);
274
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
275
+ /* @__PURE__ */ jsxs(EdgeLabelRenderer, { children: [
276
+ /* @__PURE__ */ jsx(
277
+ "svg",
278
+ {
279
+ "aria-hidden": "true",
280
+ width: "1",
281
+ height: "1",
282
+ style: { position: "absolute", overflow: "visible", pointerEvents: "none" },
283
+ children: placements.map(({ id, x, y, box }) => {
284
+ const endX = Math.max(box.x, Math.min(x, box.x + box.width));
285
+ const endY = Math.max(box.y, Math.min(y, box.y + box.height));
286
+ if (endX === x && endY === y) return null;
287
+ return /* @__PURE__ */ jsxs("g", { "data-edge-label-leader": id, stroke: "var(--prism-graph-muted)", strokeWidth: "1", children: [
288
+ /* @__PURE__ */ jsx("path", { d: `M ${x} ${y} L ${endX} ${endY}`, fill: "none", strokeDasharray: "3 3" }),
289
+ /* @__PURE__ */ jsx("circle", { cx: x, cy: y, r: "2", fill: "var(--prism-graph-bg)" })
290
+ ] }, id);
291
+ })
292
+ }
293
+ ),
294
+ anchors.map((anchor) => /* @__PURE__ */ jsx(
295
+ MeasuredLabel,
296
+ {
297
+ anchor,
298
+ box: boxes.get(anchor.id),
299
+ maxWidth,
300
+ onSize
301
+ },
302
+ anchor.id
303
+ ))
304
+ ] }),
305
+ /* @__PURE__ */ jsxs(Controls, { showInteractive: false, showFitView: false, showZoom: false, children: [
306
+ /* @__PURE__ */ jsx(
307
+ ControlButton,
308
+ {
309
+ disabled: atMaxZoom,
310
+ onClick: () => void zoomIn({ duration: 200 }),
311
+ title: zoomInLabel,
312
+ "aria-label": zoomInLabel,
313
+ children: /* @__PURE__ */ jsx(ZoomInIcon, {})
314
+ }
315
+ ),
316
+ /* @__PURE__ */ jsx(
317
+ ControlButton,
318
+ {
319
+ disabled: atMinZoom,
320
+ onClick: () => void zoomOut({ duration: 200 }),
321
+ title: zoomOutLabel,
322
+ "aria-label": zoomOutLabel,
323
+ children: /* @__PURE__ */ jsx(ZoomOutIcon, {})
324
+ }
325
+ ),
326
+ /* @__PURE__ */ jsx(ControlButton, { onClick: fit, title: fitLabel, "aria-label": fitLabel, children: /* @__PURE__ */ jsx(FitViewIcon, {}) })
327
+ ] })
328
+ ] });
329
+ }
330
+
331
+ // src/components/knowledge-graph/label-store.ts
332
+ var EdgeLabelStore = class {
333
+ anchors = /* @__PURE__ */ new Map();
334
+ snapshot = [];
335
+ listeners = /* @__PURE__ */ new Set();
336
+ pending = false;
337
+ getSnapshot = () => this.snapshot;
338
+ subscribe = (listener) => {
339
+ this.listeners.add(listener);
340
+ return () => {
341
+ this.listeners.delete(listener);
342
+ };
343
+ };
344
+ set(anchor) {
345
+ const prior = this.anchors.get(anchor.id);
346
+ if (prior?.x === anchor.x && prior.y === anchor.y && prior.text === anchor.text) return;
347
+ this.anchors.set(anchor.id, anchor);
348
+ this.publish();
349
+ }
350
+ remove(id) {
351
+ if (this.anchors.delete(id)) this.publish();
352
+ }
353
+ publish() {
354
+ if (this.pending) return;
355
+ this.pending = true;
356
+ queueMicrotask(() => {
357
+ this.pending = false;
358
+ this.snapshot = [...this.anchors.values()];
359
+ this.listeners.forEach((listener) => listener());
360
+ });
361
+ }
362
+ };
363
+ var defaultKnowledgeGraphLabels = {
364
+ title: "Knowledge map",
365
+ search: "Find an entity or relation",
366
+ all: "Whole map",
367
+ list: "Index",
368
+ indexTitle: "Objects and relations",
369
+ openIndex: "Expand graph index",
370
+ closeIndex: "Close graph index",
371
+ collapseIndex: "Collapse graph index",
372
+ map: "Map",
373
+ empty: "No objects to display.",
374
+ invalid: "The graph contains invalid identities or references.",
375
+ budget: "Choose an object to inspect its neighbourhood.",
376
+ partial: "Showing a neighbourhood",
377
+ omitted: "Relations outside the display budget",
378
+ details: "Selected object",
379
+ inputs: "Inputs",
380
+ outputs: "Outputs",
381
+ fit: "Fit to view",
382
+ zoomIn: "Zoom in",
383
+ zoomOut: "Zoom out",
384
+ lock: "Toggle interaction",
385
+ hint: "Select an object in the index or map. Dragging changes its position only.",
386
+ clear: "Clear selection",
387
+ expand: "Expand workspace",
388
+ collapse: "Close expanded workspace"
389
+ };
390
+ function Badges({ badges }) {
391
+ if (!badges?.length) return null;
392
+ return /* @__PURE__ */ jsx(Box2, { component: "span", sx: { display: "flex", gap: 0.5, flexWrap: "wrap", mt: 1 }, children: badges.map((badge, index) => /* @__PURE__ */ jsx(
393
+ Chip,
394
+ {
395
+ component: "span",
396
+ label: badge.label,
397
+ size: "small",
398
+ variant: "outlined",
399
+ color: badge.tone ?? "default",
400
+ sx: { height: "auto", minHeight: 24, "& .MuiChip-label": { whiteSpace: "normal", py: 0.25 } }
401
+ },
402
+ index
403
+ )) });
404
+ }
405
+ var EntityNode = memo(function EntityNodeView({ data, selected }) {
406
+ return /* @__PURE__ */ jsxs(
407
+ "div",
408
+ {
409
+ style: { minHeight: Math.max(76, Math.max(data.inputs ?? 0, data.outputs ?? 0) * 24 + 24) },
410
+ className: `prism-knowledge__node ${data.selection.type === "relation" ? "prism-knowledge__relation" : ""} ${selected ? "is-selected" : ""}`,
411
+ children: [
412
+ data.selection.type === "relation" ? Array.from({ length: data.inputs ?? 0 }, (_, i) => /* @__PURE__ */ jsx(
413
+ Handle,
414
+ {
415
+ id: `inputs:${i}`,
416
+ type: "target",
417
+ position: Position.Left,
418
+ style: { top: `${(i + 1) / ((data.inputs ?? 0) + 1) * 100}%` },
419
+ isConnectable: false
420
+ },
421
+ i
422
+ )) : /* @__PURE__ */ jsx(Handle, { type: "target", position: Position.Left, isConnectable: false }),
423
+ /* @__PURE__ */ jsx("span", { className: "prism-knowledge__kind", children: data.kind }),
424
+ /* @__PURE__ */ jsx("strong", { children: data.label }),
425
+ /* @__PURE__ */ jsx(Badges, { badges: data.badges }),
426
+ data.selection.type === "relation" ? Array.from({ length: data.outputs ?? 0 }, (_, i) => /* @__PURE__ */ jsx(
427
+ Handle,
428
+ {
429
+ id: `outputs:${i}`,
430
+ type: "source",
431
+ position: Position.Right,
432
+ style: { top: `${(i + 1) / ((data.outputs ?? 0) + 1) * 100}%` },
433
+ isConnectable: false
434
+ },
435
+ i
436
+ )) : /* @__PURE__ */ jsx(Handle, { type: "source", position: Position.Right, isConnectable: false })
437
+ ]
438
+ }
439
+ );
440
+ });
441
+ function KnowledgeEdge(props) {
442
+ const [path, x, y] = getSmoothStepPath(props);
443
+ useEdgeLabel(typeof props.label === "string" ? { id: props.id, text: props.label, x, y } : void 0);
444
+ return /* @__PURE__ */ jsx(
445
+ BaseEdge,
446
+ {
447
+ id: props.id,
448
+ path,
449
+ markerEnd: props.markerEnd,
450
+ markerStart: props.markerStart,
451
+ style: props.style,
452
+ interactionWidth: props.interactionWidth
453
+ }
454
+ );
455
+ }
456
+ var edgeTypes = { knowledge: KnowledgeEdge };
457
+ var nodeTypes = { knowledge: EntityNode };
458
+ function defaultLayout(p) {
459
+ const positions = {};
460
+ p.entities.forEach((e, i) => {
461
+ positions[entityNodeId(e.id)] = { x: i % 3 * 340, y: Math.floor(i / 3) * 170 };
462
+ });
463
+ p.relations.forEach((r, i) => {
464
+ positions[relationNodeId(r.id)] = {
465
+ x: i % 3 * 340 + 170,
466
+ y: Math.floor(p.entities.length / 3) * 170 + 180 + Math.floor(i / 3) * 150
467
+ };
468
+ });
469
+ return positions;
470
+ }
471
+ function KnowledgeGraph({
472
+ data,
473
+ labels: overrides,
474
+ visibleBudget = 300,
475
+ panelPersistKey,
476
+ onSelect,
477
+ onLayoutChange,
478
+ layout = defaultLayout,
479
+ renderDetails,
480
+ height = 560,
481
+ edgeLabelGap = 8,
482
+ edgeLabelMaxWidth = 240,
483
+ className,
484
+ sx
485
+ }) {
486
+ if (!Number.isFinite(edgeLabelGap) || edgeLabelGap < 0 || !Number.isFinite(edgeLabelMaxWidth) || edgeLabelMaxWidth <= 0)
487
+ throw Error("invalid_edge_label_options");
488
+ const [labelStore] = useState(() => new EdgeLabelStore());
489
+ const theme = useTheme(), labels = useMemo(() => ({ ...defaultKnowledgeGraphLabels, ...overrides }), [overrides]);
490
+ const [expanded, setExpanded] = useState(false);
491
+ const [query, setQuery] = useState(""), [selected, setSelected] = useState(), [focus, setFocus] = useState(), [view, setView] = useState("map");
492
+ const selectionRef = useRef(void 0);
493
+ const valid = useMemo(() => {
494
+ try {
495
+ validateKnowledgeGraph(data);
496
+ return true;
497
+ } catch {
498
+ return false;
499
+ }
500
+ }, [data]);
501
+ const projection = useMemo(
502
+ () => valid ? projectKnowledgeGraph(data, focus, visibleBudget) : { entities: [], relations: [], total: 0, omittedRelations: 0, limited: false },
503
+ [data, valid, focus, visibleBudget]
504
+ );
505
+ const graph = useMemo(() => incidenceGraph(projection), [projection]);
506
+ const positions = useMemo(() => layout(projection), [layout, projection]);
507
+ const [nodes, setNodes] = useState([]);
508
+ useEffect(() => {
509
+ setNodes((old) => {
510
+ const prior = new Map(old.map((n) => [n.id, n]));
511
+ return graph.nodes.map((n) => ({
512
+ ...prior.get(n.id),
513
+ id: n.id,
514
+ type: "knowledge",
515
+ position: prior.get(n.id)?.position ?? positions[n.id] ?? { x: 0, y: 0 },
516
+ data: n,
517
+ ariaLabel: `${n.kind}: ${n.label}`,
518
+ deletable: false
519
+ }));
520
+ });
521
+ }, [graph, positions]);
522
+ const displayedNodes = useMemo(
523
+ () => nodes.map((node) => ({
524
+ ...node,
525
+ selected: selected?.id === node.data.selection.id && selected.type === node.data.selection.type
526
+ })),
527
+ [nodes, selected]
528
+ );
529
+ const edges = useMemo(
530
+ () => graph.edges.map((e) => ({
531
+ ...e,
532
+ type: "knowledge",
533
+ markerEnd: { type: MarkerType.ArrowClosed },
534
+ focusable: true,
535
+ ariaLabel: e.label,
536
+ deletable: false
537
+ })),
538
+ [graph]
539
+ );
540
+ const choose = useCallback(
541
+ (s) => {
542
+ const previous = selectionRef.current;
543
+ if (previous?.id === s?.id && previous?.type === s?.type) return;
544
+ selectionRef.current = s;
545
+ setSelected(s);
546
+ onSelect?.(s);
547
+ if (projection.total > visibleBudget) setFocus(s);
548
+ },
549
+ [onSelect, projection.total, visibleBudget]
550
+ );
551
+ const onNodesChange = useCallback(
552
+ (changes) => {
553
+ const selectedChange = [...changes].reverse().find((change) => change.type === "select" && change.selected);
554
+ if (selectedChange?.type === "select") {
555
+ const node = graph.nodes.find((candidate) => candidate.id === selectedChange.id);
556
+ if (node) choose(node.selection);
557
+ } else {
558
+ const current = selectionRef.current;
559
+ const id = current && (current.type === "entity" ? entityNodeId(current.id) : relationNodeId(current.id));
560
+ if (changes.some((change) => change.type === "select" && !change.selected && change.id === id))
561
+ choose(void 0);
562
+ }
563
+ const geometry = changes.filter((change) => change.type !== "remove" && change.type !== "select");
564
+ if (geometry.length) setNodes((previous) => applyNodeChanges(geometry, previous));
565
+ },
566
+ [graph, choose]
567
+ );
568
+ const index = useMemo(
569
+ () => [
570
+ ...data.entities.map((e) => ({ ...e, selection: { type: "entity", id: e.id } })),
571
+ ...data.relations.map((r) => ({ ...r, selection: { type: "relation", id: r.id } }))
572
+ ].filter(
573
+ (e) => `${e.label}
574
+ ${e.kind}
575
+ ${e.id}
576
+ ${e.badges?.map((b) => b.label).join(" ") ?? ""}`.toLocaleLowerCase().includes(query.toLocaleLowerCase())
577
+ ),
578
+ [data, query]
579
+ );
580
+ const object = selected?.type === "entity" ? data.entities.find((e) => e.id === selected.id) : data.relations.find((r) => r.id === selected?.id);
581
+ useEffect(() => {
582
+ if (selected && !object) {
583
+ choose(void 0);
584
+ setFocus(void 0);
585
+ }
586
+ }, [selected, object, choose]);
587
+ const graphIndex = /* @__PURE__ */ jsxs(Box2, { className: "prism-knowledge__index", children: [
588
+ /* @__PURE__ */ jsx(
589
+ TextField,
590
+ {
591
+ fullWidth: true,
592
+ size: "small",
593
+ type: "search",
594
+ label: labels.search,
595
+ value: query,
596
+ onChange: (e) => setQuery(e.target.value),
597
+ sx: { mb: 2 }
598
+ }
599
+ ),
600
+ /* @__PURE__ */ jsx("ul", { className: "prism-knowledge__results", children: index.slice(0, visibleBudget).map((item) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs(
601
+ Button,
602
+ {
603
+ type: "button",
604
+ variant: "text",
605
+ "aria-current": selected?.id === item.id && selected.type === item.selection.type,
606
+ onClick: () => choose(item.selection),
607
+ children: [
608
+ /* @__PURE__ */ jsx("span", { children: item.kind }),
609
+ item.label,
610
+ /* @__PURE__ */ jsx(Badges, { badges: item.badges })
611
+ ]
612
+ }
613
+ ) }, JSON.stringify(item.selection))) }),
614
+ /* @__PURE__ */ jsxs("small", { children: [
615
+ Math.min(index.length, visibleBudget),
616
+ " / ",
617
+ index.length
618
+ ] }),
619
+ /* @__PURE__ */ jsx(
620
+ Button,
621
+ {
622
+ type: "button",
623
+ onClick: () => {
624
+ setFocus(void 0);
625
+ choose(void 0);
626
+ },
627
+ children: labels.clear
628
+ }
629
+ )
630
+ ] });
631
+ const content = /* @__PURE__ */ jsxs(
632
+ Box2,
633
+ {
634
+ className: ["prism-knowledge", view === "list" && "is-list", className].filter(Boolean).join(" "),
635
+ sx: [
636
+ {
637
+ "--prism-graph-border": theme.palette.divider,
638
+ "--prism-graph-bg": theme.palette.background.paper,
639
+ "--prism-graph-text": theme.palette.text.primary,
640
+ "--prism-graph-muted": theme.palette.text.secondary,
641
+ "--prism-graph-accent": theme.palette.primary.main,
642
+ "--prism-graph-radius": `${theme.shape.borderRadius}px`,
643
+ "--prism-graph-hover": theme.palette.action.hover
644
+ },
645
+ ...Array.isArray(sx) ? sx : [sx]
646
+ ],
647
+ children: [
648
+ /* @__PURE__ */ jsxs("header", { className: "prism-knowledge__header", children: [
649
+ /* @__PURE__ */ jsx("strong", { children: labels.title }),
650
+ /* @__PURE__ */ jsxs("span", { children: [
651
+ projection.entities.length + projection.relations.length,
652
+ " / ",
653
+ projection.total
654
+ ] }),
655
+ /* @__PURE__ */ jsx(
656
+ Button,
657
+ {
658
+ variant: view === "map" ? "contained" : "outlined",
659
+ type: "button",
660
+ "aria-pressed": view === "map",
661
+ onClick: () => setView("map"),
662
+ children: labels.map
663
+ }
664
+ ),
665
+ /* @__PURE__ */ jsx(
666
+ Button,
667
+ {
668
+ variant: view === "list" ? "contained" : "outlined",
669
+ type: "button",
670
+ "aria-pressed": view === "list",
671
+ onClick: () => setView("list"),
672
+ children: labels.list
673
+ }
674
+ ),
675
+ /* @__PURE__ */ jsx(Button, { type: "button", onClick: () => setExpanded((v) => !v), children: expanded ? labels.collapse : labels.expand })
676
+ ] }),
677
+ !valid ? /* @__PURE__ */ jsx("p", { role: "alert", children: labels.invalid }) : /* @__PURE__ */ jsxs(Fragment, { children: [
678
+ /* @__PURE__ */ jsx("p", { className: "prism-knowledge__hint", children: labels.hint }),
679
+ view === "list" ? graphIndex : /* @__PURE__ */ jsx(
680
+ PanelLayout,
681
+ {
682
+ title: labels.indexTitle,
683
+ labels: { expand: labels.openIndex, collapse: labels.collapseIndex, close: labels.closeIndex },
684
+ panel: ({ collapsed }) => /* @__PURE__ */ jsxs(Fragment, { children: [
685
+ /* @__PURE__ */ jsx(Box2, { hidden: collapsed, children: graphIndex }),
686
+ collapsed && /* @__PURE__ */ jsx(
687
+ DocSidebar,
688
+ {
689
+ compact: true,
690
+ items: index.slice(0, visibleBudget).map((item) => ({
691
+ id: JSON.stringify(item.selection),
692
+ label: item.label
693
+ })),
694
+ activeId: selected && JSON.stringify(selected),
695
+ onItemClick: (item) => {
696
+ const target = index.find((entry) => JSON.stringify(entry.selection) === item.id);
697
+ if (target) choose(target.selection);
698
+ }
699
+ }
700
+ )
701
+ ] }),
702
+ height: expanded ? "75dvh" : height,
703
+ width: 240,
704
+ offset: 88,
705
+ persistKey: panelPersistKey,
706
+ navigationKey: selected ? selected.type + ":" + selected.id : "",
707
+ sx: { px: 1, pb: 1 },
708
+ children: /* @__PURE__ */ jsx(
709
+ "div",
710
+ {
711
+ className: "prism-knowledge__canvas",
712
+ style: { height: view === "map" ? expanded ? "75dvh" : height : void 0 },
713
+ children: view === "map" && nodes.length > 0 ? /* @__PURE__ */ jsx(EdgeLabelsContext.Provider, { value: labelStore, children: /* @__PURE__ */ jsxs(
714
+ ReactFlow,
715
+ {
716
+ nodes: displayedNodes,
717
+ edges,
718
+ nodeTypes,
719
+ edgeTypes,
720
+ onNodesChange,
721
+ onNodeClick: (_e, n) => choose(n.data.selection),
722
+ onEdgeClick: (_event, edge) => {
723
+ const occurrence = graph.edges.find((item) => item.id === edge.id);
724
+ if (occurrence) choose({ type: "relation", id: occurrence.relationId });
725
+ },
726
+ onNodeDragStop: (_e, node) => onLayoutChange?.(
727
+ Object.fromEntries(nodes.map((n) => [n.id, n.id === node.id ? node.position : n.position]))
728
+ ),
729
+ nodesConnectable: false,
730
+ deleteKeyCode: null,
731
+ edgesReconnectable: false,
732
+ fitView: true,
733
+ minZoom: 0.1,
734
+ maxZoom: 2,
735
+ colorMode: theme.palette.mode,
736
+ ariaLabelConfig: {
737
+ "controls.zoomIn.ariaLabel": labels.zoomIn,
738
+ "controls.zoomOut.ariaLabel": labels.zoomOut,
739
+ "controls.fitView.ariaLabel": labels.fit,
740
+ "controls.interactive.ariaLabel": labels.lock
741
+ },
742
+ children: [
743
+ /* @__PURE__ */ jsx(Background, { gap: 24 }),
744
+ /* @__PURE__ */ jsx(
745
+ EdgeLabels,
746
+ {
747
+ store: labelStore,
748
+ gap: edgeLabelGap,
749
+ maxWidth: edgeLabelMaxWidth,
750
+ fitLabel: labels.fit,
751
+ zoomInLabel: labels.zoomIn,
752
+ zoomOutLabel: labels.zoomOut
753
+ }
754
+ )
755
+ ]
756
+ }
757
+ ) }) : /* @__PURE__ */ jsx("div", { className: "prism-knowledge__empty", children: projection.total === 0 ? labels.empty : projection.limited ? labels.budget : labels.list })
758
+ }
759
+ )
760
+ }
761
+ ),
762
+ projection.limited && /* @__PURE__ */ jsxs("p", { className: "prism-knowledge__hint", role: "status", children: [
763
+ labels.partial,
764
+ ": ",
765
+ projection.entities.length + projection.relations.length,
766
+ " / ",
767
+ projection.total,
768
+ ".",
769
+ " ",
770
+ labels.omitted,
771
+ ": ",
772
+ projection.omittedRelations,
773
+ "."
774
+ ] }),
775
+ selected && object && /* @__PURE__ */ jsxs("section", { className: "prism-knowledge__details", "aria-label": labels.details, children: [
776
+ /* @__PURE__ */ jsx("h3", { children: object.label }),
777
+ /* @__PURE__ */ jsx("p", { children: object.description }),
778
+ selected.type === "relation" && /* @__PURE__ */ jsx("div", { className: "prism-knowledge__ports", children: ["inputs", "outputs"].map((side) => /* @__PURE__ */ jsxs("div", { children: [
779
+ /* @__PURE__ */ jsx("strong", { children: labels[side] }),
780
+ /* @__PURE__ */ jsx("ol", { children: object[side].map((port, i) => /* @__PURE__ */ jsxs("li", { children: [
781
+ port.role,
782
+ ": ",
783
+ data.entities.find((e) => e.id === port.entity)?.label
784
+ ] }, i)) })
785
+ ] }, side)) }),
786
+ renderDetails?.(selected)
787
+ ] })
788
+ ] })
789
+ ]
790
+ }
791
+ );
792
+ return expanded ? /* @__PURE__ */ jsx(Dialog, { open: true, fullScreen: true, onClose: () => setExpanded(false), "aria-label": labels.title, children: content }) : content;
793
+ }
794
+
795
+ export { KnowledgeGraph, defaultKnowledgeGraphLabels, entityNodeId, incidenceGraph, projectKnowledgeGraph, relationNodeId, validateKnowledgeGraph };
796
+ //# sourceMappingURL=index.js.map
797
+ //# sourceMappingURL=index.js.map