@redvars/peacock 4.0.0 → 4.2.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 (467) hide show
  1. package/dist/{BaseField-CAog9TIc.js → BaseField-_unSNU5x.js} +43 -4
  2. package/dist/BaseField-_unSNU5x.js.map +1 -0
  3. package/dist/{BaseInput-CcMfg1Y2.js → BaseInput-DtZH0fPJ.js} +7 -4
  4. package/dist/BaseInput-DtZH0fPJ.js.map +1 -0
  5. package/dist/accordion.js.map +1 -1
  6. package/dist/ai-badge.js +32 -6
  7. package/dist/ai-badge.js.map +1 -1
  8. package/dist/ai-summary.js +2 -2
  9. package/dist/alert.js +2 -2
  10. package/dist/anchor-nav.js +2 -2
  11. package/dist/app-shell.js +2 -2
  12. package/dist/assistant-panel.js +2 -2
  13. package/dist/assistant-step.js +2 -2
  14. package/dist/assistant-steps.js +2 -2
  15. package/dist/avatar-group.js +2 -2
  16. package/dist/banner.js +2 -2
  17. package/dist/{base-button-Do2TUy8M.js → base-button-BJMGMcMv.js} +3 -1
  18. package/dist/base-button-BJMGMcMv.js.map +1 -0
  19. package/dist/{base-progress-BiLlZVHJ.js → base-progress-D7Nmfh1s.js} +4 -2
  20. package/dist/base-progress-D7Nmfh1s.js.map +1 -0
  21. package/dist/bottom-sheet.js +2 -2
  22. package/dist/breadcrumb.js +2 -2
  23. package/dist/button-group.js +4 -4
  24. package/dist/button.js +14 -8
  25. package/dist/button.js.map +1 -1
  26. package/dist/calendar.js +2 -2
  27. package/dist/canvas-base-CWQ4rQ2s.js +788 -0
  28. package/dist/canvas-base-CWQ4rQ2s.js.map +1 -0
  29. package/dist/canvas-link-CtgsALq4.js +54 -0
  30. package/dist/canvas-link-CtgsALq4.js.map +1 -0
  31. package/dist/{cartesian-chart-C-f1frt0.js → cartesian-chart-CS5yRLfE.js} +3 -2
  32. package/dist/cartesian-chart-CS5yRLfE.js.map +1 -0
  33. package/dist/{cb-group-base-DeuCVx3a.js → cb-group-base-CO30uFQZ.js} +2 -2
  34. package/dist/{cb-group-base-DeuCVx3a.js.map → cb-group-base-CO30uFQZ.js.map} +1 -1
  35. package/dist/cb-group.js +3 -3
  36. package/dist/cb-rule.js +3 -3
  37. package/dist/chart-area.js +5 -4
  38. package/dist/chart-area.js.map +1 -1
  39. package/dist/chart-bar.js +5 -4
  40. package/dist/chart-bar.js.map +1 -1
  41. package/dist/chart-base-C_XKVyhf.js +833 -0
  42. package/dist/chart-base-C_XKVyhf.js.map +1 -0
  43. package/dist/chart-doughnut.js +4 -3
  44. package/dist/chart-doughnut.js.map +1 -1
  45. package/dist/chart-line.js +5 -4
  46. package/dist/chart-line.js.map +1 -1
  47. package/dist/chart-pie.js +4 -3
  48. package/dist/chart-pie.js.map +1 -1
  49. package/dist/chat-event.js +152 -0
  50. package/dist/chat-event.js.map +1 -0
  51. package/dist/chat-message.js +195 -19
  52. package/dist/chat-message.js.map +1 -1
  53. package/dist/chat-thread.js +26 -9
  54. package/dist/chat-thread.js.map +1 -1
  55. package/dist/checkbox-group.js +5 -5
  56. package/dist/checkbox.js +5 -5
  57. package/dist/chip-set.js +4 -4
  58. package/dist/chip.js +4 -4
  59. package/dist/circular-progress.js +3 -3
  60. package/dist/citation.js +2 -2
  61. package/dist/code-editor.js +6 -5
  62. package/dist/code-editor.js.map +1 -1
  63. package/dist/code-highlighter.js +2 -2
  64. package/dist/color-field.js +6 -6
  65. package/dist/color-picker.js +2 -2
  66. package/dist/command-palette.js +2 -2
  67. package/dist/comment-composer.js +6 -6
  68. package/dist/condition-builder.js +3 -3
  69. package/dist/confirm-dialog.js +2 -2
  70. package/dist/copy-button.js +2 -2
  71. package/dist/currency-field.js +6 -6
  72. package/dist/custom-elements-jsdocs.json +2330 -397
  73. package/dist/custom-elements.json +20464 -542
  74. package/dist/date-field.js +7 -7
  75. package/dist/date-picker.js +4 -2
  76. package/dist/date-picker.js.map +1 -1
  77. package/dist/date-range-field.js +7 -7
  78. package/dist/datetime-field.js +7 -7
  79. package/dist/dependency-map-layout-5KUueabk.js +1390 -0
  80. package/dist/dependency-map-layout-5KUueabk.js.map +1 -0
  81. package/dist/dependency-map.js +1605 -0
  82. package/dist/dependency-map.js.map +1 -0
  83. package/dist/description-item.js +2 -2
  84. package/dist/description-list.js +2 -2
  85. package/dist/diagram-Va096vj9.js +2029 -0
  86. package/dist/diagram-Va096vj9.js.map +1 -0
  87. package/dist/diagram-controls.js +345 -0
  88. package/dist/diagram-controls.js.map +1 -0
  89. package/dist/diagram-minimap.js +216 -0
  90. package/dist/diagram-minimap.js.map +1 -0
  91. package/dist/diagram.js +20 -0
  92. package/dist/diagram.js.map +1 -0
  93. package/dist/diff-viewer.js +2 -2
  94. package/dist/discussion-activity.js +4 -4
  95. package/dist/discussion-comment.js +4 -4
  96. package/dist/{discussion-time-BegaYfhf.js → discussion-time-DqykqvNy.js} +2 -2
  97. package/dist/{discussion-time-BegaYfhf.js.map → discussion-time-DqykqvNy.js.map} +1 -1
  98. package/dist/discussion.js +8 -8
  99. package/dist/{document-editor-BO7QPbO5.js → document-editor-Dc8JeFVB.js} +2 -2
  100. package/dist/{document-editor-BO7QPbO5.js.map → document-editor-Dc8JeFVB.js.map} +1 -1
  101. package/dist/document-editor.js +3 -3
  102. package/dist/draft-card.js +14 -4
  103. package/dist/draft-card.js.map +1 -1
  104. package/dist/dropdown-button.js +3 -2
  105. package/dist/dropdown-button.js.map +1 -1
  106. package/dist/erd.js +2021 -0
  107. package/dist/erd.js.map +1 -0
  108. package/dist/fab.js +4 -4
  109. package/dist/field.js +257 -43
  110. package/dist/field.js.map +1 -1
  111. package/dist/file-upload.js +38 -16
  112. package/dist/file-upload.js.map +1 -1
  113. package/dist/filter-bar.js +2 -2
  114. package/dist/flow.js +27 -970
  115. package/dist/flow.js.map +1 -1
  116. package/dist/focus-ring.js +2 -0
  117. package/dist/focus-ring.js.map +1 -1
  118. package/dist/{form-associated-D3Tn33s_.js → form-associated-BHbg72PG.js} +3 -1
  119. package/dist/{form-associated-D3Tn33s_.js.map → form-associated-BHbg72PG.js.map} +1 -1
  120. package/dist/{form-submitter-DWwv6K9-.js → form-submitter-beG1CXAn.js} +7 -1
  121. package/dist/{form-submitter-DWwv6K9-.js.map → form-submitter-beG1CXAn.js.map} +1 -1
  122. package/dist/form.js +3 -3
  123. package/dist/{generative-view-DmtpDobn.js → generative-view-BKlcuujw.js} +13 -13
  124. package/dist/generative-view-BKlcuujw.js.map +1 -0
  125. package/dist/generative-view.js +3 -3
  126. package/dist/geometry-INg82Lxq.js +305 -0
  127. package/dist/geometry-INg82Lxq.js.map +1 -0
  128. package/dist/history-YbTSQZHj.js +45 -0
  129. package/dist/history-YbTSQZHj.js.map +1 -0
  130. package/dist/host-CZK7xhzh.js +40 -0
  131. package/dist/host-CZK7xhzh.js.map +1 -0
  132. package/dist/html-editor.js +6 -6
  133. package/dist/{hyperlink-DhE9RlVS.js → hyperlink-DycWPKwU.js} +10 -1
  134. package/dist/hyperlink-DycWPKwU.js.map +1 -0
  135. package/dist/{i18n-controller-urcQKYGe.js → i18n-controller-DJHsE1YH.js} +2 -2
  136. package/dist/{i18n-controller-urcQKYGe.js.map → i18n-controller-DJHsE1YH.js.map} +1 -1
  137. package/dist/icon-button.js +11 -9
  138. package/dist/icon-button.js.map +1 -1
  139. package/dist/image.js +2 -2
  140. package/dist/index.js +42 -22
  141. package/dist/index.js.map +1 -1
  142. package/dist/inline-edit.js +2 -2
  143. package/dist/input.js +5 -5
  144. package/dist/json-viewer.js +2 -2
  145. package/dist/kanban.js +2 -2
  146. package/dist/kbd.js +2 -2
  147. package/dist/linear-progress.js +3 -3
  148. package/dist/link-button.js +9 -7
  149. package/dist/link-button.js.map +1 -1
  150. package/dist/list-item.js +2 -2
  151. package/dist/list.js +2 -2
  152. package/dist/listbox.js +4 -4
  153. package/dist/loader-full.js +17 -16
  154. package/dist/loader-full.js.map +1 -1
  155. package/dist/loader.js +51 -18
  156. package/dist/loader.js.map +1 -1
  157. package/dist/markdown-editor.js +6 -6
  158. package/dist/markers-BFmh1OCz.js +46 -0
  159. package/dist/markers-BFmh1OCz.js.map +1 -0
  160. package/dist/measure-controller-Dmc5hZKg.js +89 -0
  161. package/dist/measure-controller-Dmc5hZKg.js.map +1 -0
  162. package/dist/mention-input.js +7 -6
  163. package/dist/mention-input.js.map +1 -1
  164. package/dist/menu-item.js +3 -2
  165. package/dist/menu-item.js.map +1 -1
  166. package/dist/{menu-trigger-controller-DyLpTxM7.js → menu-trigger-controller-CEJq1ugC.js} +11 -14
  167. package/dist/menu-trigger-controller-CEJq1ugC.js.map +1 -0
  168. package/dist/menu.js +2 -2
  169. package/dist/modal.js +2 -2
  170. package/dist/navigation-bar.js +2 -2
  171. package/dist/navigation-drawer.js +2 -2
  172. package/dist/navigation-rail.js +2 -2
  173. package/dist/notification-center.js +3 -3
  174. package/dist/number-field.js +7 -6
  175. package/dist/number-field.js.map +1 -1
  176. package/dist/option.js +2 -2
  177. package/dist/page-header.js +2 -2
  178. package/dist/pagination.js +2 -2
  179. package/dist/password-field.js +6 -6
  180. package/dist/password-rules.js +2 -2
  181. package/dist/phone-field.js +6 -6
  182. package/dist/{picker-field-B4DtcJfL.js → picker-field-CUI05sWc.js} +3 -3
  183. package/dist/{picker-field-B4DtcJfL.js.map → picker-field-CUI05sWc.js.map} +1 -1
  184. package/dist/pin-input.js +6 -6
  185. package/dist/presence-indicator.js +2 -2
  186. package/dist/prompt-input.js +6 -6
  187. package/dist/radio-group.js +2 -1
  188. package/dist/radio-group.js.map +1 -1
  189. package/dist/radio.js +6 -6
  190. package/dist/radio.js.map +1 -1
  191. package/dist/rating.js +6 -5
  192. package/dist/rating.js.map +1 -1
  193. package/dist/redvars-loader.js +2 -2
  194. package/dist/{relative-time-BVQXLuHm.js → relative-time-BNxqvEbg.js} +13 -2
  195. package/dist/relative-time-BNxqvEbg.js.map +1 -0
  196. package/dist/relative-time.js +3 -3
  197. package/dist/resizable-panels.js +2 -2
  198. package/dist/{rich-text-input-DLICqof1.js → rich-text-input-N_hqnXej.js} +3 -3
  199. package/dist/{rich-text-input-DLICqof1.js.map → rich-text-input-N_hqnXej.js.map} +1 -1
  200. package/dist/ripple.js +2 -0
  201. package/dist/ripple.js.map +1 -1
  202. package/dist/{schema-hMt-NRLk.js → schema-Dy0z-80u.js} +2 -2
  203. package/dist/{schema-hMt-NRLk.js.map → schema-Dy0z-80u.js.map} +1 -1
  204. package/dist/search.js +5 -5
  205. package/dist/segmented-button-group.js +1 -1
  206. package/dist/select.js +8 -8
  207. package/dist/side-sheet.js +2 -2
  208. package/dist/signature-pad.js +6 -5
  209. package/dist/signature-pad.js.map +1 -1
  210. package/dist/slider.js +6 -5
  211. package/dist/slider.js.map +1 -1
  212. package/dist/snackbar.js +2 -2
  213. package/dist/sparkline.js +2 -2
  214. package/dist/split-button.js +109 -21
  215. package/dist/split-button.js.map +1 -1
  216. package/dist/src/__internal/ai/suggestion-controller.d.ts +2 -0
  217. package/dist/src/__internal/diagram/canvas-base.d.ts +105 -0
  218. package/dist/src/__internal/diagram/canvas-link.d.ts +21 -0
  219. package/dist/src/__internal/diagram/geometry.d.ts +49 -0
  220. package/dist/src/__internal/diagram/history.d.ts +17 -0
  221. package/dist/src/__internal/diagram/host.d.ts +45 -0
  222. package/dist/src/__internal/diagram/markers.d.ts +16 -0
  223. package/dist/src/__internal/diagram/measure-controller.d.ts +32 -0
  224. package/dist/src/__internal/diagram/motion.d.ts +22 -0
  225. package/dist/src/__internal/diagram/selection.d.ts +20 -0
  226. package/dist/src/__internal/diagram/types.d.ts +39 -0
  227. package/dist/src/__internal/diagram/viewport-controller.d.ts +89 -0
  228. package/dist/src/__internal/i18n/strings.d.ts +155 -0
  229. package/dist/src/__internal/menu-trigger-controller.d.ts +11 -8
  230. package/dist/src/__internal/toggle-base.d.ts +8 -0
  231. package/dist/src/__internal/utils/deprecate.d.ts +3 -3
  232. package/dist/src/__internal/utils/relative-time.d.ts +5 -0
  233. package/dist/src/accordion/accordion.d.ts +1 -0
  234. package/dist/src/ai-badge/ai-badge.d.ts +8 -0
  235. package/dist/src/button/button/button.d.ts +4 -0
  236. package/dist/src/chat-message/chat-message.d.ts +51 -10
  237. package/dist/src/chat-message/index.d.ts +1 -1
  238. package/dist/src/chat-thread/chat-event.d.ts +37 -0
  239. package/dist/src/chat-thread/chat-thread.d.ts +7 -4
  240. package/dist/src/chat-thread/index.d.ts +1 -0
  241. package/dist/src/code-editor/code-editor.d.ts +1 -0
  242. package/dist/src/date-picker/date-picker.d.ts +2 -0
  243. package/dist/src/dependency-map/dependency-map-layout.d.ts +48 -0
  244. package/dist/src/dependency-map/dependency-map.d.ts +241 -0
  245. package/dist/src/dependency-map/index.d.ts +2 -0
  246. package/dist/src/diagram/diagram.d.ts +300 -0
  247. package/dist/src/diagram/flow.d.ts +53 -0
  248. package/dist/src/diagram/index.d.ts +4 -0
  249. package/dist/src/diagram-controls/diagram-controls.d.ts +46 -0
  250. package/dist/src/diagram-controls/index.d.ts +1 -0
  251. package/dist/src/diagram-minimap/diagram-minimap.d.ts +39 -0
  252. package/dist/src/diagram-minimap/index.d.ts +1 -0
  253. package/dist/src/erd/erd-layout.d.ts +27 -0
  254. package/dist/src/erd/erd.d.ts +266 -0
  255. package/dist/src/erd/index.d.ts +2 -0
  256. package/dist/src/field/field.d.ts +38 -1
  257. package/dist/src/file-upload/file-upload.d.ts +3 -1
  258. package/dist/src/focus-ring/focus-ring.d.ts +2 -0
  259. package/dist/src/index.d.ts +17 -4
  260. package/dist/src/input/BaseField.d.ts +15 -1
  261. package/dist/src/input/BaseInput.d.ts +4 -0
  262. package/dist/src/menu/menu-item/menu-item.d.ts +1 -0
  263. package/dist/src/number-field/number-field.d.ts +4 -0
  264. package/dist/src/progress/base-progress.d.ts +3 -0
  265. package/dist/src/radio/radio-group.d.ts +1 -0
  266. package/dist/src/rating/rating.d.ts +1 -0
  267. package/dist/src/ripple/ripple.d.ts +2 -0
  268. package/dist/src/signature-pad/signature-pad.d.ts +1 -0
  269. package/dist/src/slider/slider.d.ts +1 -0
  270. package/dist/src/split-button/split-button.d.ts +7 -2
  271. package/dist/src/switch/switch.d.ts +1 -0
  272. package/dist/src/tabs/tab.d.ts +2 -0
  273. package/dist/src/tabs/tabs.d.ts +1 -0
  274. package/dist/src/textarea/textarea.d.ts +3 -0
  275. package/dist/src/time-picker/time-picker.d.ts +2 -0
  276. package/dist/src/transfer-list/transfer-list.d.ts +1 -0
  277. package/dist/src/tree-chart/index.d.ts +2 -0
  278. package/dist/src/tree-chart/tree-chart-layout.d.ts +49 -0
  279. package/dist/src/tree-chart/tree-chart.d.ts +221 -0
  280. package/dist/src/workflow/index.d.ts +2 -0
  281. package/dist/src/workflow/workflow-format.d.ts +5 -0
  282. package/dist/src/workflow/workflow-model.d.ts +194 -0
  283. package/dist/src/workflow/workflow.d.ts +313 -0
  284. package/dist/src/workflow-timeline/index.d.ts +1 -0
  285. package/dist/src/workflow-timeline/workflow-timeline.d.ts +41 -0
  286. package/dist/stat.js +2 -2
  287. package/dist/status-indicator.js +2 -2
  288. package/dist/step.js +2 -2
  289. package/dist/stepper.js +2 -2
  290. package/dist/{strings-DmbqMTfs.js → strings-DnYjGbbc.js} +169 -1
  291. package/dist/{strings-DmbqMTfs.js.map → strings-DnYjGbbc.js.map} +1 -1
  292. package/dist/sub-menu.js +2 -2
  293. package/dist/{suggestion-controller-CW17adxd.js → suggestion-controller-7YRQqkaI.js} +3 -1
  294. package/dist/{suggestion-controller-CW17adxd.js.map → suggestion-controller-7YRQqkaI.js.map} +1 -1
  295. package/dist/svg.js +2 -2
  296. package/dist/switch.js +6 -5
  297. package/dist/switch.js.map +1 -1
  298. package/dist/tab.js +1 -0
  299. package/dist/tab.js.map +1 -1
  300. package/dist/table.js +50 -11
  301. package/dist/table.js.map +1 -1
  302. package/dist/tabs.js +1 -0
  303. package/dist/tabs.js.map +1 -1
  304. package/dist/test/diagram-controls.test.d.ts +1 -0
  305. package/dist/test/diagram-geometry.test.d.ts +1 -0
  306. package/dist/test/diagram.test.d.ts +1 -0
  307. package/dist/test/erd.test.d.ts +1 -0
  308. package/dist/test/toggle-label.test.d.ts +1 -0
  309. package/dist/test/tree-chart.test.d.ts +1 -0
  310. package/dist/test/workflow-debug.test.d.ts +1 -0
  311. package/dist/test/workflow.test.d.ts +1 -0
  312. package/dist/textarea.js +13 -6
  313. package/dist/textarea.js.map +1 -1
  314. package/dist/time-field.js +7 -7
  315. package/dist/time-picker.js +4 -2
  316. package/dist/time-picker.js.map +1 -1
  317. package/dist/timeline-item.js +2 -2
  318. package/dist/timeline.js +2 -2
  319. package/dist/{toggle-base-BQO5pjrU.js → toggle-base-CXmFSp3b.js} +19 -3
  320. package/dist/toggle-base-CXmFSp3b.js.map +1 -0
  321. package/dist/tour.js +2 -2
  322. package/dist/transfer-list.js +6 -5
  323. package/dist/transfer-list.js.map +1 -1
  324. package/dist/{chart-base-B-gOg2Di.js → transform-CxeQFXXB.js} +9 -839
  325. package/dist/transform-CxeQFXXB.js.map +1 -0
  326. package/dist/tree-chart.js +1986 -0
  327. package/dist/tree-chart.js.map +1 -0
  328. package/dist/tree-item.js +2 -2
  329. package/dist/tree.js +2 -2
  330. package/dist/tsconfig.tsbuildinfo +1 -1
  331. package/dist/typing-indicator.js +2 -2
  332. package/dist/url-field.js +6 -6
  333. package/dist/user-menu.js +3 -3
  334. package/dist/virtual-list.js +2 -2
  335. package/dist/workflow-format-BsyveyeC.js +34 -0
  336. package/dist/workflow-format-BsyveyeC.js.map +1 -0
  337. package/dist/workflow-model-CauduOG2.js +330 -0
  338. package/dist/workflow-model-CauduOG2.js.map +1 -0
  339. package/dist/workflow-timeline.js +354 -0
  340. package/dist/workflow-timeline.js.map +1 -0
  341. package/dist/workflow.js +3337 -0
  342. package/dist/workflow.js.map +1 -0
  343. package/dist/workspace-switcher.js +3 -3
  344. package/package.json +1 -1
  345. package/readme.md +44 -2
  346. package/src/LoaderUtils.ts +9 -2
  347. package/src/__internal/ai/suggestion-controller.ts +3 -1
  348. package/src/__internal/diagram/canvas-base.ts +410 -0
  349. package/src/__internal/diagram/canvas-link.ts +66 -0
  350. package/src/__internal/diagram/geometry.ts +372 -0
  351. package/src/__internal/diagram/history.ts +49 -0
  352. package/src/__internal/diagram/host.ts +76 -0
  353. package/src/__internal/diagram/markers.ts +56 -0
  354. package/src/__internal/diagram/measure-controller.ts +104 -0
  355. package/src/__internal/diagram/motion.ts +89 -0
  356. package/src/__internal/diagram/selection.ts +69 -0
  357. package/src/__internal/diagram/types.ts +56 -0
  358. package/src/__internal/diagram/viewport-controller.ts +494 -0
  359. package/src/__internal/i18n/strings.ts +207 -0
  360. package/src/__internal/menu-trigger-controller.ts +11 -15
  361. package/src/__internal/mixins/field.ts +3 -0
  362. package/src/__internal/mixins/form-associated.ts +2 -0
  363. package/src/__internal/mixins/form-submitter.ts +6 -0
  364. package/src/__internal/mixins/hyperlink.ts +10 -0
  365. package/src/__internal/toggle-base.ts +16 -0
  366. package/src/__internal/utils/deprecate.ts +5 -4
  367. package/src/__internal/utils/relative-time.ts +20 -0
  368. package/src/accordion/accordion.ts +1 -0
  369. package/src/ai-badge/ai-badge.scss +8 -0
  370. package/src/ai-badge/ai-badge.ts +21 -4
  371. package/src/button/base-button/base-button.ts +2 -0
  372. package/src/button/button/button-base.scss +9 -2
  373. package/src/button/button/button-layers.scss +3 -1
  374. package/src/button/button/button.ts +4 -0
  375. package/src/chat-message/chat-message.scss +72 -0
  376. package/src/chat-message/chat-message.ts +137 -18
  377. package/src/chat-message/index.ts +1 -0
  378. package/src/chat-thread/chat-event.scss +36 -0
  379. package/src/chat-thread/chat-event.ts +79 -0
  380. package/src/chat-thread/chat-thread.scss +4 -1
  381. package/src/chat-thread/chat-thread.ts +22 -6
  382. package/src/chat-thread/index.ts +1 -0
  383. package/src/code-editor/code-editor.ts +1 -0
  384. package/src/date-picker/date-picker.ts +2 -0
  385. package/src/dependency-map/dependency-map-layout.ts +505 -0
  386. package/src/dependency-map/dependency-map.scss +626 -0
  387. package/src/dependency-map/dependency-map.ts +1280 -0
  388. package/src/dependency-map/index.ts +16 -0
  389. package/src/diagram/diagram.scss +513 -0
  390. package/src/diagram/diagram.ts +1852 -0
  391. package/src/diagram/flow.ts +81 -0
  392. package/src/diagram/index.ts +44 -0
  393. package/src/diagram-controls/diagram-controls.scss +68 -0
  394. package/src/diagram-controls/diagram-controls.ts +255 -0
  395. package/src/diagram-controls/index.ts +1 -0
  396. package/src/diagram-minimap/diagram-minimap.scss +41 -0
  397. package/src/diagram-minimap/diagram-minimap.ts +149 -0
  398. package/src/diagram-minimap/index.ts +1 -0
  399. package/src/draft-card/draft-card.scss +16 -2
  400. package/src/dropdown-button/dropdown-button.ts +2 -1
  401. package/src/erd/erd-layout.ts +92 -0
  402. package/src/erd/erd.scss +636 -0
  403. package/src/erd/erd.ts +1728 -0
  404. package/src/erd/index.ts +17 -0
  405. package/src/field/field.scss +197 -23
  406. package/src/field/field.ts +109 -16
  407. package/src/file-upload/file-upload.scss +37 -10
  408. package/src/file-upload/file-upload.ts +3 -1
  409. package/src/focus-ring/focus-ring.ts +2 -0
  410. package/src/generative-view/catalog.generated.ts +12 -11
  411. package/src/index.ts +123 -3
  412. package/src/input/BaseField.ts +45 -2
  413. package/src/input/BaseInput.ts +4 -1
  414. package/src/loader.ts +29 -0
  415. package/src/mention-input/mention-input.scss +2 -0
  416. package/src/menu/menu-item/menu-item.ts +1 -0
  417. package/src/number-field/number-field.ts +4 -0
  418. package/src/progress/base-progress.ts +3 -0
  419. package/src/radio/radio-group.ts +1 -0
  420. package/src/radio/radio.ts +1 -1
  421. package/src/rating/rating.ts +1 -0
  422. package/src/ripple/ripple.ts +2 -0
  423. package/src/signature-pad/signature-pad.ts +1 -0
  424. package/src/slider/slider.ts +1 -0
  425. package/src/split-button/split-button-colors.scss +9 -0
  426. package/src/split-button/split-button-sizes.scss +32 -5
  427. package/src/split-button/split-button.scss +61 -8
  428. package/src/split-button/split-button.ts +15 -8
  429. package/src/switch/switch.ts +1 -0
  430. package/src/table/table.scss +57 -9
  431. package/src/table/table.ts +3 -1
  432. package/src/tabs/tab.ts +2 -0
  433. package/src/tabs/tabs.ts +1 -0
  434. package/src/textarea/textarea.scss +2 -0
  435. package/src/textarea/textarea.ts +8 -0
  436. package/src/time-picker/time-picker.ts +2 -0
  437. package/src/transfer-list/transfer-list.ts +1 -0
  438. package/src/tree-chart/index.ts +13 -0
  439. package/src/tree-chart/tree-chart-layout.ts +185 -0
  440. package/src/tree-chart/tree-chart.scss +377 -0
  441. package/src/tree-chart/tree-chart.ts +1170 -0
  442. package/src/workflow/index.ts +35 -0
  443. package/src/workflow/workflow-format.ts +29 -0
  444. package/src/workflow/workflow-model.ts +583 -0
  445. package/src/workflow/workflow.scss +1164 -0
  446. package/src/workflow/workflow.ts +2674 -0
  447. package/src/workflow-timeline/index.ts +1 -0
  448. package/src/workflow-timeline/workflow-timeline.scss +128 -0
  449. package/src/workflow-timeline/workflow-timeline.ts +238 -0
  450. package/dist/BaseField-CAog9TIc.js.map +0 -1
  451. package/dist/BaseInput-CcMfg1Y2.js.map +0 -1
  452. package/dist/base-button-Do2TUy8M.js.map +0 -1
  453. package/dist/base-progress-BiLlZVHJ.js.map +0 -1
  454. package/dist/cartesian-chart-C-f1frt0.js.map +0 -1
  455. package/dist/chart-base-B-gOg2Di.js.map +0 -1
  456. package/dist/generative-view-DmtpDobn.js.map +0 -1
  457. package/dist/hyperlink-DhE9RlVS.js.map +0 -1
  458. package/dist/menu-trigger-controller-DyLpTxM7.js.map +0 -1
  459. package/dist/relative-time-BVQXLuHm.js.map +0 -1
  460. package/dist/src/flow/flow.d.ts +0 -178
  461. package/dist/src/flow/index.d.ts +0 -2
  462. package/dist/toggle-base-BQO5pjrU.js.map +0 -1
  463. package/src/button/button-group/readme.md +0 -23
  464. package/src/flow/flow.scss +0 -215
  465. package/src/flow/flow.ts +0 -958
  466. package/src/flow/index.ts +0 -10
  467. /package/dist/test/{flow.test.d.ts → dependency-map.test.d.ts} +0 -0
package/dist/flow.js CHANGED
@@ -1,982 +1,39 @@
1
- import { i, _ as __decorate, I as IndividualComponent, a as i$1, b, A, w } from './IndividualComponent-BK7XZjE2.js';
2
- import { n } from './property-B2TG3KEE.js';
3
- import { r } from './state-BCeDVCI9.js';
4
- import { e } from './class-map-NDIkZErE.js';
5
- import { c } from './repeat-D_ERDRYT.js';
1
+ import { _ as __decorate, I as IndividualComponent } from './IndividualComponent-BK7XZjE2.js';
2
+ import { D as Diagram, d as deprecate } from './diagram-Va096vj9.js';
3
+ import './property-B2TG3KEE.js';
4
+ import './state-BCeDVCI9.js';
5
+ import './query-CHb9Ft_d.js';
6
+ import './base-Cl6v8-BZ.js';
7
+ import './class-map-NDIkZErE.js';
6
8
  import './directive-ZPhl09Yt.js';
9
+ import './repeat-D_ERDRYT.js';
7
10
  import './directive-helpers-Bx3mu42O.js';
11
+ import './canvas-base-CWQ4rQ2s.js';
12
+ import './i18n-controller-DJHsE1YH.js';
13
+ import './strings-DnYjGbbc.js';
14
+ import './locale-DEsJZCQG.js';
15
+ import './geometry-INg82Lxq.js';
16
+ import './host-CZK7xhzh.js';
17
+ import './measure-controller-Dmc5hZKg.js';
18
+ import './markers-BFmh1OCz.js';
19
+ import './history-YbTSQZHj.js';
8
20
 
9
- var css_248z = i`* {
10
- box-sizing: border-box;
11
- -webkit-tap-highlight-color: transparent;
12
- }
13
-
14
- .screen-reader-only {
15
- position: absolute !important;
16
- inline-size: 1px !important;
17
- block-size: 1px !important;
18
- padding: 0 !important;
19
- margin: -1px !important;
20
- overflow: hidden !important;
21
- clip-path: inset(50%) !important;
22
- white-space: nowrap !important;
23
- border: 0 !important;
24
- }
25
-
26
- [hidden] {
27
- display: none !important;
28
- }
29
-
30
- @media (forced-colors: active) {
31
- .selected,
32
- [aria-selected=true],
33
- [aria-pressed=true],
34
- [aria-checked=true],
35
- [aria-current]:not([aria-current=false]) {
36
- outline: 2px solid Highlight;
37
- outline-offset: -2px;
38
- }
39
- .disabled,
40
- [aria-disabled=true] {
41
- color: GrayText;
42
- }
43
- }
44
- :host {
45
- display: block;
46
- width: 100%;
47
- height: 100%;
48
- overflow: hidden;
49
- --flow-background: var(--color-surface-container-lowest, #f4f5f8);
50
- --flow-dot-color: var(--color-outline-variant, #e1e3e8);
51
- --flow-line-color: var(--color-outline, #75777c);
52
- --flow-hover-color: var(--color-primary, #005FAF);
53
- --flow-node-bg: var(--color-surface-container-low, #f8f9fc);
54
- --flow-node-border: var(--color-outline-variant, #c5c6cb);
55
- --flow-node-shadow: var(--elevation-level1);
56
- --flow-node-active-shadow: var(--elevation-level3);
57
- }
58
-
59
- .flow-container {
60
- position: relative;
61
- width: 100%;
62
- height: 100%;
63
- background: var(--flow-background);
64
- border: 1px solid var(--color-outline-variant);
65
- border-radius: var(--shape-corner-large);
66
- overflow: auto;
67
- }
68
-
69
- .flow-workspace {
70
- position: relative;
71
- }
72
-
73
- .flow-svg {
74
- position: absolute;
75
- inset: 0;
76
- width: 100%;
77
- height: 100%;
78
- pointer-events: auto;
79
- }
80
-
81
- #dot-grid circle {
82
- fill: var(--flow-dot-color);
83
- }
84
-
85
- .flow-edge {
86
- transition: stroke 150ms ease, stroke-width 150ms ease;
87
- pointer-events: stroke;
88
- cursor: pointer;
89
- }
90
- .flow-edge:hover {
91
- stroke: var(--flow-hover-color);
92
- stroke-width: 3;
93
- }
94
- .flow-edge.variant-dashed {
95
- stroke-dasharray: 5 5;
96
- }
97
- .flow-edge.variant-animated-dashed {
98
- stroke-dasharray: 5 5;
99
- animation: flow-dash-flow 1s linear infinite;
100
- }
101
-
102
- .flow-edge-preview {
103
- stroke-dasharray: 5 5;
104
- animation: flow-dash-flow 1s linear infinite;
105
- pointer-events: none;
106
- }
107
-
108
- .flow-nodes {
109
- pointer-events: none;
110
- }
111
- .flow-nodes > * {
112
- pointer-events: auto;
113
- }
114
-
115
- .flow-node {
116
- display: inline-flex;
117
- align-items: center;
118
- justify-content: center;
119
- background: var(--flow-node-bg);
120
- border: 1px solid var(--flow-node-border);
121
- box-shadow: var(--flow-node-shadow);
122
- border-radius: var(--shape-corner-medium);
123
- min-width: 150px;
124
- min-height: 70px;
125
- cursor: grab;
126
- user-select: none;
127
- touch-action: none;
128
- z-index: 5;
129
- transition: box-shadow 150ms ease, border-color 150ms ease, transform 150ms ease;
130
- }
131
- .flow-node:active, .flow-node.is-dragging {
132
- cursor: grabbing;
133
- box-shadow: var(--flow-node-active-shadow);
134
- border-color: var(--flow-hover-color);
135
- transform: translateY(-1px);
136
- }
137
- .flow-node.is-dragging {
138
- z-index: 6;
139
- }
140
- .flow-node.is-selected {
141
- border-color: var(--flow-hover-color);
142
- }
143
- .flow-node:focus-visible {
144
- outline: 2px solid var(--color-primary);
145
- outline-offset: 2px;
146
- }
147
-
148
- .flow-node-content {
149
- width: 100%;
150
- height: 100%;
151
- padding: 12px 16px;
152
- }
153
-
154
- .flow-node-default-card {
155
- display: flex;
156
- flex-direction: column;
157
- justify-content: center;
158
- align-items: center;
159
- text-align: center;
160
- width: 100%;
161
- height: 100%;
162
- }
163
-
164
- .flow-node-title {
165
- font-family: inherit;
166
- font-size: 14px;
167
- font-weight: 500;
168
- color: var(--color-on-surface);
169
- }
170
-
171
- .handle {
172
- position: absolute;
173
- width: 12px;
174
- height: 12px;
175
- border-radius: 50%;
176
- background: var(--color-surface, #ffffff);
177
- border: 2px solid var(--color-outline, #75777c);
178
- z-index: 10;
179
- cursor: crosshair;
180
- touch-action: none;
181
- transition: transform 150ms cubic-bezier(0.4, 0, 0.2, 1), background-color 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
182
- }
183
- .handle:hover {
184
- transform: scale(1.4);
185
- background-color: var(--flow-hover-color);
186
- border-color: var(--flow-hover-color);
187
- box-shadow: 0 0 8px color-mix(in srgb, var(--flow-hover-color) 50%, transparent);
188
- }
189
- .handle:active {
190
- transform: scale(1.2);
191
- background-color: var(--flow-hover-color);
192
- border-color: var(--flow-hover-color);
193
- }
194
-
195
- /* stylelint-disable property-disallowed-list */
196
- .handle-position-left {
197
- left: -7px;
198
- top: calc(50% - 6px);
199
- }
200
-
201
- .handle-position-right {
202
- right: -7px;
203
- top: calc(50% - 6px);
204
- }
205
-
206
- .handle-position-top {
207
- top: -7px;
208
- left: calc(50% - 6px);
209
- }
210
-
211
- .handle-position-bottom {
212
- bottom: -7px;
213
- left: calc(50% - 6px);
214
- }
215
-
216
- /* stylelint-enable property-disallowed-list */
217
- @keyframes flow-dash-flow {
218
- to {
219
- stroke-dashoffset: -20;
220
- }
221
- }
222
- .flow-node-custom {
223
- background: transparent !important;
224
- border-color: transparent !important;
225
- box-shadow: none !important;
226
- min-width: 0 !important;
227
- min-height: 0 !important;
228
- }
229
- .flow-node-custom .flow-node-content {
230
- padding: 0 !important;
231
- }`;
232
-
233
- /** Canvas pixels an arrow key moves the focused node; matches the dot grid. */
234
- const KEY_STEP = 20;
235
- /** Canvas pixels Shift + arrow key moves the focused node. */
236
- const LARGE_KEY_STEP = 100;
237
- /** Pointer travel, in screen pixels, before a press on a node becomes a drag. */
238
- const DRAG_THRESHOLD = 3;
239
- /** Size assumed for a node before it has been measured. */
240
- const DEFAULT_SIZE = { width: 150, height: 70 };
241
- const OPPOSITE = {
242
- left: 'right',
243
- right: 'left',
244
- top: 'bottom',
245
- bottom: 'top',
246
- };
247
21
  /**
248
- * @label Flow
249
- * @tag wc-flow
250
- * @rawTag flow
251
- * @summary A node editor on a dotted grid, where the person moves nodes and draws connections between them.
22
+ * The deprecated name of the diagram canvas: `wc-flow` before 4.0, now `wc-diagram`. It works
23
+ * like `wc-diagram` and warns once on the console. Removed in 5.0.
252
24
  *
253
- * @overview
254
- * <p>Set <code>nodes</code> and <code>edges</code> as properties. A node shows its
255
- * <code>data.label</code> (or its id) on a default card, or renders your own element when
256
- * <code>data</code> is an element or has an <code>element</code>. Each node has input handles
257
- * (left by default) and output handles (right by default); an edge is drawn as a smooth step,
258
- * bezier or straight line, solid, dashed or animated dashed.</p>
259
- * <p>Nodes are dragged with a mouse, pen or touch; <code>node-drag</code> fires while a node moves
260
- * and <code>node-drag-end</code> once when the drag ends. A press without movement selects the
261
- * node, sets <code>selected</code> and fires <code>select</code>. Dragging from an output handle
262
- * onto another node's input handle fires <code>connect</code>; the flow does not add the edge, so
263
- * add it to <code>edges</code> yourself.</p>
264
- * <p>Each node is focusable and named by its label. Arrow keys move the focused node by one grid
265
- * step (20px), Shift + arrow by 100px, and each move fires <code>node-drag-end</code>; Enter or
266
- * Space selects it. Arrow keys follow the canvas axes, so they are not mirrored in right-to-left
267
- * layouts.</p>
268
- * <p>Moving a node never mutates the objects you passed: the flow replaces the moved node with a
269
- * new object (<code>{ ...node, position }</code>) and assigns a new array to <code>nodes</code>.
270
- * Read <code>flow.nodes</code>, or save the position from <code>node-drag-end</code>, to keep the
271
- * change. <code>zoom</code> scales the canvas and <code>padding</code> sets the space around the
272
- * nodes.</p>
25
+ * It has no tag in its JSDoc on purpose, so the custom elements manifest, the docs and the
26
+ * React, Vue and Angular bindings list only `wc-diagram`. Its own module (`dist/flow.js`) keeps
27
+ * the lazy loader's one-element-per-module rule.
273
28
  *
274
- * @example
275
- * ```html
276
- * <wc-flow id="my-flow"></wc-flow>
277
- * <script>
278
- * const flow = document.getElementById('my-flow');
279
- * flow.nodes = [
280
- * { id: '1', position: { x: 50, y: 50 }, data: { label: 'Node 1' } },
281
- * { id: '2', position: { x: 250, y: 50 }, data: { label: 'Node 2' } }
282
- * ];
283
- * flow.edges = [
284
- * { id: 'e1-2', source: '1', target: '2' }
285
- * ];
286
- * </script>
287
- * ```
288
- *
289
- * @fires {CustomEvent<FlowNodeMoveDetail>} node-drag - While a node is dragged. Detail contains `{ id, position }`.
290
- * @fires {CustomEvent<FlowNodeMoveDetail>} node-drag-end - Once when a drag ends, and after each keyboard move. Detail contains `{ id, position }`.
291
- * @fires {CustomEvent<FlowSelectDetail>} select - A node was clicked, or chosen with Enter or Space. Detail contains `{ id, node }`.
292
- * @fires {CustomEvent<FlowConnectDetail>} connect - An output handle was dragged onto another node's input handle. Detail contains `{ source, target, sourceHandle, targetHandle }`.
293
- *
294
- * @cssprop --flow-background - Background color for the canvas wrapper. Defaults to surface-container-low.
295
- * @cssprop --flow-dot-color - Color of the background grid dots. Defaults to outline-variant.
296
- * @cssprop --flow-line-color - Default stroke color for lines and connectors. Defaults to on-surface.
297
- * @cssprop --flow-hover-color - Stroke color on hover for clickable shapes. Defaults to primary.
298
- * @cssprop --flow-arrow-color - Stroke color for arrow markers. Defaults to on-surface.
29
+ * @deprecated Use `Diagram` (`wc-diagram`).
299
30
  */
300
- let Flow = class Flow extends i$1 {
301
- constructor() {
302
- // ── Static
303
- super(...arguments);
304
- // ── Properties
305
- /** Nodes to draw. Replaced with a new array, never mutated, when a node moves. */
306
- this.nodes = [];
307
- /** Connections between node handles. */
308
- this.edges = [];
309
- /** Scale of the canvas. */
310
- this.zoom = 1;
311
- /** Space around the nodes, in canvas pixels. */
312
- this.padding = 50;
313
- /** Id of the selected node. Set by clicking a node or pressing Enter or Space on it. */
314
- this.selected = '';
315
- // ── State
316
- /** Id of the node being dragged. */
317
- this.draggingNodeId = null;
318
- /** Whether a connection is being drawn from an output handle. */
319
- this.isDrawingConnection = false;
320
- /** Node the connection being drawn starts from. */
321
- this.draggingSourceId = null;
322
- /** Handle the connection being drawn starts from. */
323
- this.draggingSourceHandle = null;
324
- /** Start of the connection preview, in canvas coordinates. */
325
- this.connectionStart = { x: 0, y: 0 };
326
- /** Pointer position for the connection preview, in canvas coordinates. */
327
- this.connectionEnd = { x: 0, y: 0 };
328
- // ── Private fields
329
- /** Measured node sizes, by id. */
330
- this.nodeDimensions = new Map();
331
- this.onNodePointerMove = (event) => {
332
- const drag = this.nodeDrag;
333
- if (!drag || event.pointerId !== drag.pointerId)
334
- return;
335
- const dx = event.clientX - drag.startX;
336
- const dy = event.clientY - drag.startY;
337
- if (!drag.moved && Math.hypot(dx, dy) < DRAG_THRESHOLD)
338
- return;
339
- drag.moved = true;
340
- this.draggingNodeId = drag.id;
341
- const position = {
342
- x: drag.origin.x + dx / this.zoom,
343
- y: drag.origin.y + dy / this.zoom,
344
- };
345
- this.moveNode(drag.id, position);
346
- this.emit('node-drag', { id: drag.id, position });
347
- };
348
- this.onNodePointerUp = (event) => {
349
- if (!this.nodeDrag || event.pointerId !== this.nodeDrag.pointerId)
350
- return;
351
- this.endNodeDrag(true);
352
- };
353
- this.onNodePointerCancel = (event) => {
354
- if (!this.nodeDrag || event.pointerId !== this.nodeDrag.pointerId)
355
- return;
356
- this.endNodeDrag(true);
357
- };
358
- this.onConnectionPointerMove = (event) => {
359
- if (!this.isDrawingConnection)
360
- return;
361
- if (event.pointerId !== this.connectionDrag?.pointerId)
362
- return;
363
- this.connectionEnd = this.toCanvasPoint(event.clientX, event.clientY);
364
- };
365
- this.onConnectionPointerUp = (event) => {
366
- if (!this.isDrawingConnection)
367
- return;
368
- if (event.pointerId !== this.connectionDrag?.pointerId)
369
- return;
370
- const source = this.draggingSourceId;
371
- const sourceHandle = this.draggingSourceHandle;
372
- this.cancelConnection();
373
- // With the pointer captured, the event targets the source handle: hit-test what is under it.
374
- const target = this.shadowRoot?.elementFromPoint(event.clientX, event.clientY);
375
- const inputHandle = target?.closest('.handle-input');
376
- if (!inputHandle || !source || !sourceHandle)
377
- return;
378
- const targetNodeId = inputHandle.getAttribute('data-node-id');
379
- const targetHandle = inputHandle.getAttribute('data-position');
380
- if (targetNodeId && targetNodeId !== source) {
381
- this.emit('connect', {
382
- source,
383
- target: targetNodeId,
384
- sourceHandle,
385
- targetHandle,
386
- });
387
- }
388
- };
389
- this.onConnectionPointerCancel = () => {
390
- this.cancelConnection();
391
- };
392
- }
393
- // ── Lifecycle
394
- disconnectedCallback() {
395
- super.disconnectedCallback();
396
- this.endNodeDrag(false);
397
- this.cancelConnection();
398
- }
399
- updated() {
400
- let dimensionsChanged = false;
401
- this.shadowRoot?.querySelectorAll('.flow-node').forEach(el => {
402
- const id = el.getAttribute('data-id');
403
- if (id) {
404
- const current = this.nodeDimensions.get(id);
405
- const w = el.offsetWidth || DEFAULT_SIZE.width;
406
- const h = el.offsetHeight || DEFAULT_SIZE.height;
407
- if (!current || current.width !== w || current.height !== h) {
408
- this.nodeDimensions.set(id, { width: w, height: h });
409
- dimensionsChanged = true;
410
- }
411
- }
412
- });
413
- if (dimensionsChanged) {
414
- this.requestUpdate();
415
- }
416
- }
417
- // ── Private methods
418
- emit(type, detail) {
419
- this.dispatchEvent(new CustomEvent(type, { detail, bubbles: true, composed: true }));
420
- }
421
- /** Replaces the node with a moved copy and assigns a new `nodes` array. */
422
- moveNode(id, position) {
423
- this.nodes = this.nodes.map(node => node.id === id ? { ...node, position: { ...position } } : node);
424
- }
425
- selectNode(node) {
426
- this.selected = node.id;
427
- this.emit('select', { id: node.id, node });
428
- }
429
- nodePosition(id) {
430
- const node = this.nodes.find(n => n.id === id);
431
- return node ? { ...node.position } : undefined;
432
- }
433
- // --- Node dragging
434
- onNodePointerDown(event, node) {
435
- if (event.button !== 0)
436
- return;
437
- const target = event.target;
438
- if (target.closest('.handle') ||
439
- target.closest('button') ||
440
- target.closest('input') ||
441
- target.closest('a')) {
442
- return;
443
- }
444
- event.preventDefault();
445
- const element = event.currentTarget;
446
- element.focus({ preventScroll: true });
447
- this.nodeDrag = {
448
- id: node.id,
449
- pointerId: event.pointerId,
450
- startX: event.clientX,
451
- startY: event.clientY,
452
- origin: { ...node.position },
453
- moved: false,
454
- element,
455
- };
456
- try {
457
- element.setPointerCapture(event.pointerId);
458
- }
459
- catch {
460
- // Synthetic or already released pointers cannot be captured.
461
- }
462
- element.addEventListener('pointermove', this.onNodePointerMove);
463
- element.addEventListener('pointerup', this.onNodePointerUp);
464
- element.addEventListener('pointercancel', this.onNodePointerCancel);
465
- }
466
- /** Ends the press on a node: a drag fires `node-drag-end`, a press without movement selects. */
467
- endNodeDrag(notify) {
468
- const drag = this.nodeDrag;
469
- if (!drag)
470
- return;
471
- this.nodeDrag = undefined;
472
- this.draggingNodeId = null;
473
- const { element } = drag;
474
- element.removeEventListener('pointermove', this.onNodePointerMove);
475
- element.removeEventListener('pointerup', this.onNodePointerUp);
476
- element.removeEventListener('pointercancel', this.onNodePointerCancel);
477
- try {
478
- if (element.hasPointerCapture(drag.pointerId)) {
479
- element.releasePointerCapture(drag.pointerId);
480
- }
481
- }
482
- catch {
483
- // The pointer is already gone.
484
- }
485
- if (!notify)
486
- return;
487
- if (drag.moved) {
488
- const position = this.nodePosition(drag.id);
489
- if (position) {
490
- this.emit('node-drag-end', {
491
- id: drag.id,
492
- position,
493
- });
494
- }
495
- }
496
- else {
497
- const node = this.nodes.find(n => n.id === drag.id);
498
- if (node)
499
- this.selectNode(node);
500
- }
501
- }
502
- // --- Keyboard
503
- onNodeKeyDown(event, node) {
504
- // Keys typed into controls inside a custom node are theirs.
505
- if (event.target !== event.currentTarget)
506
- return;
507
- if (event.key === 'Enter' || event.key === ' ') {
508
- event.preventDefault();
509
- this.selectNode(node);
510
- return;
511
- }
512
- const step = event.shiftKey ? LARGE_KEY_STEP : KEY_STEP;
513
- const offsets = {
514
- ArrowLeft: { x: -step, y: 0 },
515
- ArrowRight: { x: step, y: 0 },
516
- ArrowUp: { x: 0, y: -step },
517
- ArrowDown: { x: 0, y: step },
518
- };
519
- const offset = offsets[event.key];
520
- if (!offset)
521
- return;
522
- event.preventDefault();
523
- const position = {
524
- x: node.position.x + offset.x,
525
- y: node.position.y + offset.y,
526
- };
527
- this.moveNode(node.id, position);
528
- this.emit('node-drag-end', { id: node.id, position });
529
- }
530
- // --- Handles
531
- getNodeInputs(node) {
532
- if (node.inputs && Array.isArray(node.inputs)) {
533
- return node.inputs;
534
- }
535
- if (node.data &&
536
- typeof node.data === 'object' &&
537
- Array.isArray(node.data.inputs)) {
538
- return node.data.inputs;
539
- }
540
- return ['left'];
541
- }
542
- getNodeOutputs(node) {
543
- if (node.outputs && Array.isArray(node.outputs)) {
544
- return node.outputs;
545
- }
546
- if (node.data &&
547
- typeof node.data === 'object' &&
548
- Array.isArray(node.data.outputs)) {
549
- return node.data.outputs;
550
- }
551
- return ['right'];
552
- }
553
- getHandleCoordinates(node, position, dim) {
554
- const { x, y } = node.position;
555
- const w = dim.width;
556
- const h = dim.height;
557
- switch (position) {
558
- case 'top':
559
- return { x: x + w / 2, y };
560
- case 'bottom':
561
- return { x: x + w / 2, y: y + h };
562
- case 'left':
563
- return { x, y: y + h / 2 };
564
- case 'right':
565
- default:
566
- return { x: x + w, y: y + h / 2 };
567
- }
568
- }
569
- // --- Connection dragging
570
- onHandlePointerDown(event, node, position) {
571
- if (event.button !== 0)
572
- return;
573
- event.stopPropagation();
574
- event.preventDefault();
575
- const element = event.currentTarget;
576
- const dim = this.nodeDimensions.get(node.id) || DEFAULT_SIZE;
577
- this.draggingSourceId = node.id;
578
- this.draggingSourceHandle = position;
579
- this.connectionStart = this.getHandleCoordinates(node, position, dim);
580
- this.connectionEnd = { ...this.connectionStart };
581
- this.isDrawingConnection = true;
582
- this.connectionDrag = { pointerId: event.pointerId, element };
583
- try {
584
- element.setPointerCapture(event.pointerId);
585
- }
586
- catch {
587
- // Synthetic or already released pointers cannot be captured.
588
- }
589
- element.addEventListener('pointermove', this.onConnectionPointerMove);
590
- element.addEventListener('pointerup', this.onConnectionPointerUp);
591
- element.addEventListener('pointercancel', this.onConnectionPointerCancel);
592
- }
593
- /** Stops drawing a connection and releases its pointer. */
594
- cancelConnection() {
595
- const drag = this.connectionDrag;
596
- this.connectionDrag = undefined;
597
- this.isDrawingConnection = false;
598
- this.draggingSourceId = null;
599
- this.draggingSourceHandle = null;
600
- if (!drag)
601
- return;
602
- const { element } = drag;
603
- element.removeEventListener('pointermove', this.onConnectionPointerMove);
604
- element.removeEventListener('pointerup', this.onConnectionPointerUp);
605
- element.removeEventListener('pointercancel', this.onConnectionPointerCancel);
606
- try {
607
- if (element.hasPointerCapture(drag.pointerId)) {
608
- element.releasePointerCapture(drag.pointerId);
609
- }
610
- }
611
- catch {
612
- // The pointer is already gone.
613
- }
614
- }
615
- /** Converts client coordinates to canvas coordinates. */
616
- toCanvasPoint(clientX, clientY) {
617
- const workspaceEl = this.shadowRoot?.querySelector('.flow-workspace');
618
- if (!workspaceEl)
619
- return { ...this.connectionEnd };
620
- const rect = workspaceEl.getBoundingClientRect();
621
- const bounds = this.getBounds();
622
- return {
623
- x: bounds.minX - this.padding + (clientX - rect.left) / this.zoom,
624
- y: bounds.minY - this.padding + (clientY - rect.top) / this.zoom,
625
- };
626
- }
627
- // --- Path builders
628
- getRoundedPath(points, radius = 12) {
629
- if (points.length < 3) {
630
- return points
631
- .map((p, i) => (i === 0 ? `M ${p.x} ${p.y}` : `L ${p.x} ${p.y}`))
632
- .join(' ');
633
- }
634
- let path = `M ${points[0].x} ${points[0].y}`;
635
- for (let i = 1; i < points.length - 1; i += 1) {
636
- const prev = points[i - 1];
637
- const curr = points[i];
638
- const next = points[i + 1];
639
- const dxp = prev.x - curr.x;
640
- const dyp = prev.y - curr.y;
641
- const lenp = Math.hypot(dxp, dyp);
642
- const dxn = next.x - curr.x;
643
- const dyn = next.y - curr.y;
644
- const lenn = Math.hypot(dxn, dyn);
645
- // A zero-length leg has no corner to round.
646
- const r = lenp === 0 || lenn === 0 ? 0 : Math.min(radius, lenp / 2, lenn / 2);
647
- if (r > 0) {
648
- const x1 = curr.x + (dxp / lenp) * r;
649
- const y1 = curr.y + (dyp / lenp) * r;
650
- const x2 = curr.x + (dxn / lenn) * r;
651
- const y2 = curr.y + (dyn / lenn) * r;
652
- path += ` L ${x1} ${y1} Q ${curr.x} ${curr.y} ${x2} ${y2}`;
653
- }
654
- else {
655
- path += ` L ${curr.x} ${curr.y}`;
656
- }
657
- }
658
- const last = points[points.length - 1];
659
- path += ` L ${last.x} ${last.y}`;
660
- return path;
661
- }
662
- getSmoothStepPath(x1, y1, x2, y2, sourceHandle = 'right', targetHandle = 'left') {
663
- const isSourceHorizontal = sourceHandle === 'left' || sourceHandle === 'right';
664
- const isTargetHorizontal = targetHandle === 'left' || targetHandle === 'right';
665
- let points;
666
- if (isSourceHorizontal && isTargetHorizontal) {
667
- const midX = x1 + (x2 - x1) / 2;
668
- points = [
669
- { x: x1, y: y1 },
670
- { x: midX, y: y1 },
671
- { x: midX, y: y2 },
672
- { x: x2, y: y2 },
673
- ];
674
- }
675
- else if (!isSourceHorizontal && !isTargetHorizontal) {
676
- const midY = y1 + (y2 - y1) / 2;
677
- points = [
678
- { x: x1, y: y1 },
679
- { x: x1, y: midY },
680
- { x: x2, y: midY },
681
- { x: x2, y: y2 },
682
- ];
683
- }
684
- else if (isSourceHorizontal && !isTargetHorizontal) {
685
- points = [
686
- { x: x1, y: y1 },
687
- { x: x2, y: y1 },
688
- { x: x2, y: y2 },
689
- ];
690
- }
691
- else {
692
- points = [
693
- { x: x1, y: y1 },
694
- { x: x1, y: y2 },
695
- { x: x2, y: y2 },
696
- ];
697
- }
698
- return this.getRoundedPath(points, 12);
699
- }
700
- getBezierPath(x1, y1, x2, y2, sourceHandle = 'right', targetHandle = 'left') {
701
- const normals = {
702
- left: { x: -1, y: 0 },
703
- right: { x: 1, y: 0 },
704
- top: { x: 0, y: -1 },
705
- bottom: { x: 0, y: 1 },
706
- };
707
- const sNormal = normals[sourceHandle] || { x: 1, y: 0 };
708
- const tNormal = normals[targetHandle] || { x: -1, y: 0 };
709
- const dx = x2 - x1;
710
- const dy = y2 - y1;
711
- const dist = Math.hypot(dx, dy);
712
- const offset = Math.max(dist / 2, 50);
713
- const cx1 = x1 + sNormal.x * offset;
714
- const cy1 = y1 + sNormal.y * offset;
715
- const cx2 = x2 + tNormal.x * offset;
716
- const cy2 = y2 + tNormal.y * offset;
717
- return `M ${x1} ${y1} C ${cx1} ${cy1}, ${cx2} ${cy2}, ${x2} ${y2}`;
718
- }
719
- getStraightPath(x1, y1, x2, y2) {
720
- return `M ${x1} ${y1} L ${x2} ${y2}`;
721
- }
722
- drawPath(sourceId, targetId, type, sourceHandle, targetHandle) {
723
- const sourceNode = this.nodes.find(n => n.id === sourceId);
724
- const targetNode = this.nodes.find(n => n.id === targetId);
725
- if (!sourceNode || !targetNode)
726
- return '';
727
- const sDim = this.nodeDimensions.get(sourceId) || DEFAULT_SIZE;
728
- const tDim = this.nodeDimensions.get(targetId) || DEFAULT_SIZE;
729
- const sHandle = sourceHandle || this.getNodeOutputs(sourceNode)[0] || 'right';
730
- const tHandle = targetHandle || this.getNodeInputs(targetNode)[0] || 'left';
731
- const start = this.getHandleCoordinates(sourceNode, sHandle, sDim);
732
- const end = this.getHandleCoordinates(targetNode, tHandle, tDim);
733
- const edgeType = type || 'smoothstep';
734
- if (edgeType === 'bezier') {
735
- return this.getBezierPath(start.x, start.y, end.x, end.y, sHandle, tHandle);
736
- }
737
- if (edgeType === 'straight') {
738
- return this.getStraightPath(start.x, start.y, end.x, end.y);
739
- }
740
- return this.getSmoothStepPath(start.x, start.y, end.x, end.y, sHandle, tHandle);
741
- }
742
- /** The box around every node, in canvas coordinates. */
743
- getBounds() {
744
- if (this.nodes.length === 0) {
745
- return { minX: 0, minY: 0, maxX: 400, maxY: 300 };
746
- }
747
- let minX = Infinity;
748
- let minY = Infinity;
749
- let maxX = -Infinity;
750
- let maxY = -Infinity;
751
- this.nodes.forEach(node => {
752
- const dim = this.nodeDimensions.get(node.id) || DEFAULT_SIZE;
753
- const { x, y } = node.position;
754
- if (x < minX)
755
- minX = x;
756
- if (y < minY)
757
- minY = y;
758
- if (x + dim.width > maxX)
759
- maxX = x + dim.width;
760
- if (y + dim.height > maxY)
761
- maxY = y + dim.height;
762
- });
763
- return { minX, minY, maxX, maxY };
764
- }
765
- isCustomNode(node) {
766
- if (node.data instanceof HTMLElement) {
767
- return true;
768
- }
769
- return Boolean(node.data &&
770
- typeof node.data === 'object' &&
771
- node.data.element instanceof HTMLElement);
772
- }
773
- /** The node's accessible name: its label, else its id. */
774
- nodeLabel(node) {
775
- if (node.data instanceof HTMLElement) {
776
- return node.data.getAttribute('aria-label') || node.id;
777
- }
778
- return node.data?.label || node.id;
779
- }
780
- // ── Render helpers
781
- renderNodeContent(node) {
782
- if (node.data instanceof HTMLElement) {
783
- return node.data;
784
- }
785
- if (node.data &&
786
- typeof node.data === 'object' &&
787
- node.data.element instanceof HTMLElement) {
788
- return node.data.element;
789
- }
790
- const label = node.data && typeof node.data === 'object'
791
- ? node.data.label || node.id
792
- : String(node.data);
793
- return b `
794
- <div class="flow-node-default-card">
795
- <div class="flow-node-title">${label}</div>
796
- </div>
797
- `;
798
- }
799
- renderNode(node) {
800
- const inputs = this.getNodeInputs(node);
801
- const outputs = this.getNodeOutputs(node);
802
- const selected = this.selected === node.id;
803
- return b `
804
- <div
805
- class=${e({
806
- 'flow-node': true,
807
- 'flow-node-custom': this.isCustomNode(node),
808
- 'is-dragging': this.draggingNodeId === node.id,
809
- 'is-selected': selected,
810
- })}
811
- data-id=${node.id}
812
- role="group"
813
- tabindex="0"
814
- aria-label=${this.nodeLabel(node)}
815
- aria-current=${selected ? 'true' : A}
816
- style="position: absolute; left: ${node.position.x}px; top: ${node
817
- .position.y}px;"
818
- @pointerdown=${(e) => this.onNodePointerDown(e, node)}
819
- @keydown=${(e) => this.onNodeKeyDown(e, node)}
820
- >
821
- ${inputs.map(pos => b `
822
- <div
823
- class="handle handle-input handle-position-${pos}"
824
- data-node-id=${node.id}
825
- data-position=${pos}
826
- ></div>
827
- `)}
828
-
829
- <div class="flow-node-content">${this.renderNodeContent(node)}</div>
830
-
831
- ${outputs.map(pos => b `
832
- <div
833
- class="handle handle-output handle-position-${pos}"
834
- data-node-id=${node.id}
835
- data-position=${pos}
836
- @pointerdown=${(e) => this.onHandlePointerDown(e, node, pos)}
837
- ></div>
838
- `)}
839
- </div>
840
- `;
841
- }
842
- renderEdges() {
843
- return this.edges.map(edge => {
844
- const pathString = this.drawPath(edge.source, edge.target, edge.type, edge.sourceHandle, edge.targetHandle);
845
- const color = edge.color || 'var(--flow-line-color, var(--color-outline))';
846
- const variant = edge.variant || 'solid';
847
- return w `
848
- <path
849
- class="${e({
850
- 'flow-edge': true,
851
- 'variant-dashed': variant === 'dashed' || variant === 'animated-dashed',
852
- 'variant-animated-dashed': variant === 'animated-dashed',
853
- })}"
854
- d="${pathString}"
855
- stroke="${color}"
856
- fill="none"
857
- stroke-width="2"
858
- marker-end="url(#arrowhead)"
859
- />
860
- `;
861
- });
862
- }
863
- renderConnectionPreview() {
864
- if (!this.isDrawingConnection || !this.draggingSourceHandle) {
865
- return A;
866
- }
867
- return w `
868
- <path
869
- class="flow-edge-preview"
870
- d="${this.getBezierPath(this.connectionStart.x, this.connectionStart.y, this.connectionEnd.x, this.connectionEnd.y, this.draggingSourceHandle, OPPOSITE[this.draggingSourceHandle])}"
871
- stroke="var(--flow-hover-color, var(--color-primary))"
872
- fill="none"
873
- stroke-width="2"
874
- stroke-dasharray="4 4"
875
- />
876
- `;
877
- }
878
- // ── Render
879
- render() {
880
- const bounds = this.getBounds();
881
- const viewBoxX = bounds.minX - this.padding;
882
- const viewBoxY = bounds.minY - this.padding;
883
- const viewBoxWidth = bounds.maxX - bounds.minX + 2 * this.padding;
884
- const viewBoxHeight = bounds.maxY - bounds.minY + 2 * this.padding;
885
- const svgViewBox = `${viewBoxX} ${viewBoxY} ${viewBoxWidth} ${viewBoxHeight}`;
886
- return b `
887
- <div class="flow-container">
888
- <div
889
- class="flow-scroller"
890
- style="width: ${viewBoxWidth * this.zoom}px; height: ${viewBoxHeight *
891
- this.zoom}px; position: relative;"
892
- >
893
- <div
894
- class="flow-workspace"
895
- style="transform: scale(${this
896
- .zoom}); transform-origin: top left; width: ${viewBoxWidth}px; height: ${viewBoxHeight}px; position: absolute; left: 0; top: 0;"
897
- >
898
- <svg class="flow-svg" viewBox="${svgViewBox}" aria-hidden="true">
899
- <defs>
900
- <pattern
901
- id="dot-grid"
902
- width="20"
903
- height="20"
904
- patternUnits="userSpaceOnUse"
905
- >
906
- <circle cx="1" cy="1" r="1" />
907
- </pattern>
908
- <marker
909
- id="arrowhead"
910
- markerWidth="8"
911
- markerHeight="8"
912
- refX="7"
913
- refY="4"
914
- orient="auto"
915
- >
916
- <polygon
917
- points="0 0, 8 4, 0 8"
918
- fill="var(--flow-line-color, var(--color-outline))"
919
- />
920
- </marker>
921
- </defs>
922
-
923
- <rect
924
- x="${viewBoxX}"
925
- y="${viewBoxY}"
926
- width="${viewBoxWidth}"
927
- height="${viewBoxHeight}"
928
- fill="url(#dot-grid)"
929
- />
930
-
931
- ${this.renderEdges()} ${this.renderConnectionPreview()}
932
- </svg>
933
-
934
- <div
935
- class="flow-nodes"
936
- style="position: absolute; left: ${-viewBoxX}px; top: ${-viewBoxY}px;"
937
- >
938
- ${c(this.nodes, node => node.id, node => this.renderNode(node))}
939
- </div>
940
- </div>
941
- </div>
942
- </div>
943
- `;
31
+ let Flow = class Flow extends Diagram {
32
+ connectedCallback() {
33
+ super.connectedCallback();
34
+ deprecate('wc-flow', 'the `wc-flow` tag', '`wc-diagram`');
944
35
  }
945
36
  };
946
- Flow.styles = [css_248z];
947
- __decorate([
948
- n({ type: Array })
949
- ], Flow.prototype, "nodes", void 0);
950
- __decorate([
951
- n({ type: Array })
952
- ], Flow.prototype, "edges", void 0);
953
- __decorate([
954
- n({ type: Number, reflect: true })
955
- ], Flow.prototype, "zoom", void 0);
956
- __decorate([
957
- n({ type: Number, reflect: true })
958
- ], Flow.prototype, "padding", void 0);
959
- __decorate([
960
- n({ type: String, reflect: true })
961
- ], Flow.prototype, "selected", void 0);
962
- __decorate([
963
- r()
964
- ], Flow.prototype, "draggingNodeId", void 0);
965
- __decorate([
966
- r()
967
- ], Flow.prototype, "isDrawingConnection", void 0);
968
- __decorate([
969
- r()
970
- ], Flow.prototype, "draggingSourceId", void 0);
971
- __decorate([
972
- r()
973
- ], Flow.prototype, "draggingSourceHandle", void 0);
974
- __decorate([
975
- r()
976
- ], Flow.prototype, "connectionStart", void 0);
977
- __decorate([
978
- r()
979
- ], Flow.prototype, "connectionEnd", void 0);
980
37
  Flow = __decorate([
981
38
  IndividualComponent
982
39
  ], Flow);