@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
@@ -0,0 +1,788 @@
1
+ import { _ as __decorate, a as i, A, b } from './IndividualComponent-BK7XZjE2.js';
2
+ import { n } from './property-B2TG3KEE.js';
3
+ import { I as I18nController } from './i18n-controller-DJHsE1YH.js';
4
+ import { b as boundsOf, i as inflateRect, a as rectsIntersect } from './geometry-INg82Lxq.js';
5
+ import { D as DiagramListeners } from './host-CZK7xhzh.js';
6
+
7
+ /** Whether the person asked for less motion. Diagram animations jump to their end state when true. */
8
+ function prefersReducedMotion() {
9
+ return (typeof matchMedia === 'function' &&
10
+ matchMedia('(prefers-reduced-motion: reduce)').matches);
11
+ }
12
+ const easeInOutCubic = (p) => p < 0.5 ? 4 * p ** 3 : 1 - (-2 * p + 2) ** 3 / 2;
13
+ const easeOutCubic = (p) => 1 - (1 - p) ** 3;
14
+ /**
15
+ * Runs `onUpdate` every animation frame for `duration` milliseconds. Under reduced motion it
16
+ * calls `onUpdate(1)` and `onDone` straight away. Returns a function that stops the tween without
17
+ * calling `onDone`.
18
+ */
19
+ function tween({ duration, easing = easeInOutCubic, onUpdate, onDone, }) {
20
+ if (duration <= 0 || prefersReducedMotion()) {
21
+ onUpdate(1);
22
+ onDone?.();
23
+ return () => { };
24
+ }
25
+ let frame = 0;
26
+ let stopped = false;
27
+ const start = performance.now();
28
+ const step = (now) => {
29
+ if (stopped)
30
+ return;
31
+ const p = Math.min(1, (now - start) / duration);
32
+ onUpdate(easing(p));
33
+ if (p < 1) {
34
+ frame = requestAnimationFrame(step);
35
+ }
36
+ else {
37
+ onDone?.();
38
+ }
39
+ };
40
+ frame = requestAnimationFrame(step);
41
+ return () => {
42
+ stopped = true;
43
+ cancelAnimationFrame(frame);
44
+ };
45
+ }
46
+ /**
47
+ * Fades and shrinks elements before they are removed, then calls `done`. Resolves at once under
48
+ * reduced motion or when the Web Animations API is missing.
49
+ */
50
+ function animateOut(elements, done, duration = 160) {
51
+ if (elements.length === 0 || prefersReducedMotion()) {
52
+ done();
53
+ return;
54
+ }
55
+ const animations = elements
56
+ .filter(el => typeof el.animate === 'function')
57
+ .map(el => el.animate([
58
+ { opacity: 1, transform: 'scale(1)' },
59
+ { opacity: 0, transform: 'scale(0.95)' },
60
+ ], { duration, easing: 'ease-in', fill: 'forwards' }));
61
+ if (animations.length === 0) {
62
+ done();
63
+ return;
64
+ }
65
+ Promise.all(animations.map(a => a.finished.catch(() => undefined))).then(done);
66
+ }
67
+
68
+ /** Pointer travel, in screen pixels, before a press becomes a pan. */
69
+ const PAN_THRESHOLD = 3;
70
+ /** Milliseconds without wheel input before a wheel gesture counts as settled. */
71
+ const WHEEL_SETTLE_MS = 150;
72
+ const clamp = (v, a, b) => Math.min(b, Math.max(a, v));
73
+ /**
74
+ * The camera of an infinite canvas: pans with a background drag, Space + drag, the middle button,
75
+ * a trackpad or the wheel, and zooms around the pointer with Ctrl/⌘ + wheel or a pinch. There are
76
+ * no bounds, so content can sit anywhere, including at negative coordinates.
77
+ *
78
+ * A canvas point `c` is drawn at `c * zoom + (x, y)` relative to the element's top-left corner.
79
+ */
80
+ class ViewportController {
81
+ constructor(host, options) {
82
+ this.view = { x: 0, y: 0, zoom: 1 };
83
+ /** Whether Space is held, so any drag pans. */
84
+ this.spaceHeld = false;
85
+ /** Whether a pan gesture is moving the view. */
86
+ this.panning = false;
87
+ this.touches = new Map();
88
+ this.onWheel = (event) => {
89
+ const zooming = event.ctrlKey || event.metaKey;
90
+ const inside = this.wheelBelongsInside(event);
91
+ if (inside === 'overlay' || (inside === 'scroll' && !zooming)) {
92
+ // Let the overlay or scroller have it; only stop the browser zooming the page.
93
+ if (zooming)
94
+ event.preventDefault();
95
+ return;
96
+ }
97
+ event.preventDefault();
98
+ this.cancelAnimation();
99
+ let dx = event.deltaX;
100
+ let dy = event.deltaY;
101
+ if (event.deltaMode === 1) {
102
+ dx *= 16;
103
+ dy *= 16;
104
+ }
105
+ else if (event.deltaMode === 2) {
106
+ dx *= this.size().width;
107
+ dy *= this.size().height;
108
+ }
109
+ if (event.ctrlKey || event.metaKey) {
110
+ this.zoomBy(Math.exp(-clamp(dy, -60, 60) * 0.0125), event.clientX, event.clientY, false);
111
+ }
112
+ else {
113
+ if (event.shiftKey && dx === 0) {
114
+ dx = dy;
115
+ dy = 0;
116
+ }
117
+ this.panBy(-dx, -dy, false);
118
+ }
119
+ clearTimeout(this.wheelTimer);
120
+ this.wheelTimer = setTimeout(() => this.options.onChange(this.view, true), WHEEL_SETTLE_MS);
121
+ };
122
+ this.onPointerDown = (event) => {
123
+ if (event.pointerType === 'touch') {
124
+ this.touches.set(event.pointerId, { x: event.clientX, y: event.clientY });
125
+ if (this.touches.size === 2) {
126
+ this.startPinch();
127
+ return;
128
+ }
129
+ }
130
+ const primary = event.button === 0;
131
+ const middle = event.button === 1;
132
+ if (!primary && !middle)
133
+ return;
134
+ const background = this.options.isBackground(event.composedPath()[0] ?? event.target);
135
+ if (!middle && !this.spaceHeld && !background)
136
+ return;
137
+ if (primary &&
138
+ background &&
139
+ !this.spaceHeld &&
140
+ this.options.onBackgroundPointerDown?.(event)) {
141
+ return;
142
+ }
143
+ if (background) {
144
+ this.options.element()?.focus({ preventScroll: true });
145
+ }
146
+ this.beginPan(event, background && primary);
147
+ };
148
+ this.onPointerMove = (event) => {
149
+ if (this.touches.has(event.pointerId)) {
150
+ this.touches.set(event.pointerId, { x: event.clientX, y: event.clientY });
151
+ if (this.pinch) {
152
+ this.movePinch();
153
+ return;
154
+ }
155
+ }
156
+ const { pan } = this;
157
+ if (!pan || event.pointerId !== pan.pointerId)
158
+ return;
159
+ const dx = event.clientX - pan.startX;
160
+ const dy = event.clientY - pan.startY;
161
+ if (!pan.moved && Math.hypot(dx, dy) < PAN_THRESHOLD)
162
+ return;
163
+ if (!pan.moved) {
164
+ pan.moved = true;
165
+ this.panning = true;
166
+ this.host.requestUpdate();
167
+ }
168
+ this.apply({ ...pan.origin, x: pan.origin.x + dx, y: pan.origin.y + dy }, false);
169
+ };
170
+ this.onPointerUp = (event) => {
171
+ this.touches.delete(event.pointerId);
172
+ if (this.pinch && this.touches.size < 2) {
173
+ this.pinch = undefined;
174
+ this.options.onChange(this.view, true);
175
+ }
176
+ const { pan } = this;
177
+ if (!pan || event.pointerId !== pan.pointerId)
178
+ return;
179
+ this.pan = undefined;
180
+ try {
181
+ if (pan.element.hasPointerCapture(event.pointerId)) {
182
+ pan.element.releasePointerCapture(event.pointerId);
183
+ }
184
+ }
185
+ catch {
186
+ // The pointer is already gone.
187
+ }
188
+ if (pan.moved) {
189
+ this.panning = false;
190
+ this.host.requestUpdate();
191
+ this.options.onChange(this.view, true);
192
+ }
193
+ else if (pan.background && event.type === 'pointerup') {
194
+ this.options.onBackgroundClick?.(event);
195
+ }
196
+ };
197
+ this.onKeyDown = (event) => {
198
+ if (event.key === ' ' && event.target === this.attachedTo) {
199
+ event.preventDefault();
200
+ if (!this.spaceHeld) {
201
+ this.spaceHeld = true;
202
+ this.host.requestUpdate();
203
+ }
204
+ }
205
+ };
206
+ this.onKeyUp = (event) => {
207
+ if (event.key === ' ' && this.spaceHeld) {
208
+ this.spaceHeld = false;
209
+ this.host.requestUpdate();
210
+ }
211
+ };
212
+ this.onBlur = () => {
213
+ if (this.spaceHeld) {
214
+ this.spaceHeld = false;
215
+ this.host.requestUpdate();
216
+ }
217
+ };
218
+ this.host = host;
219
+ this.options = options;
220
+ host.addController(this);
221
+ }
222
+ hostUpdated() {
223
+ const element = this.options.element();
224
+ if (element && element !== this.attachedTo) {
225
+ this.detach();
226
+ this.attach(element);
227
+ }
228
+ }
229
+ hostDisconnected() {
230
+ this.detach();
231
+ this.cancelAnimation();
232
+ clearTimeout(this.wheelTimer);
233
+ }
234
+ // ── Geometry
235
+ /** The element's size in screen pixels. */
236
+ size() {
237
+ const el = this.options.element();
238
+ return { width: el?.clientWidth ?? 0, height: el?.clientHeight ?? 0 };
239
+ }
240
+ /** The part of the canvas in view, in canvas coordinates. */
241
+ visibleRect() {
242
+ const { width, height } = this.size();
243
+ const { x, y, zoom } = this.view;
244
+ return {
245
+ x: -x / zoom,
246
+ y: -y / zoom,
247
+ width: width / zoom,
248
+ height: height / zoom,
249
+ };
250
+ }
251
+ /** Converts client (page viewport) coordinates to canvas coordinates. */
252
+ toCanvas(clientX, clientY) {
253
+ const rect = this.options.element()?.getBoundingClientRect();
254
+ const left = rect?.left ?? 0;
255
+ const top = rect?.top ?? 0;
256
+ return {
257
+ x: (clientX - left - this.view.x) / this.view.zoom,
258
+ y: (clientY - top - this.view.y) / this.view.zoom,
259
+ };
260
+ }
261
+ clampZoom(zoom) {
262
+ return clamp(zoom, this.options.minZoom(), this.options.maxZoom());
263
+ }
264
+ /** The view that fits `rect` with `padding` screen pixels around it, never above `maxZoom`. */
265
+ viewForRect(rect, padding, maxZoom = 1) {
266
+ const { width, height } = this.size();
267
+ const fitW = (width - 2 * padding) / Math.max(rect.width, 1);
268
+ const fitH = (height - 2 * padding) / Math.max(rect.height, 1);
269
+ const zoom = this.clampZoom(Math.min(fitW, fitH, maxZoom, this.options.maxZoom()));
270
+ return {
271
+ zoom,
272
+ x: width / 2 - (rect.x + rect.width / 2) * zoom,
273
+ y: height / 2 - (rect.y + rect.height / 2) * zoom,
274
+ };
275
+ }
276
+ /** The view that centres canvas `point` at `zoom`. */
277
+ viewCentering(point, zoom = this.view.zoom) {
278
+ const { width, height } = this.size();
279
+ const z = this.clampZoom(zoom);
280
+ return { zoom: z, x: width / 2 - point.x * z, y: height / 2 - point.y * z };
281
+ }
282
+ // ── Moving the camera
283
+ /** Moves the camera at once. */
284
+ setView(view, settled = true) {
285
+ this.cancelAnimation();
286
+ this.apply(view, settled);
287
+ }
288
+ panBy(dx, dy, settled = true) {
289
+ this.setView({ ...this.view, x: this.view.x + dx, y: this.view.y + dy }, settled);
290
+ }
291
+ /** Zooms by `factor` around a client point, or around the centre. */
292
+ zoomBy(factor, clientX, clientY, settled = true) {
293
+ this.zoomToValue(this.view.zoom * factor, clientX, clientY, settled);
294
+ }
295
+ zoomToValue(zoom, clientX, clientY, settled = true) {
296
+ const el = this.options.element();
297
+ const rect = el?.getBoundingClientRect();
298
+ const { width, height } = this.size();
299
+ const px = clientX !== undefined && rect ? clientX - rect.left : width / 2;
300
+ const py = clientY !== undefined && rect ? clientY - rect.top : height / 2;
301
+ const next = this.clampZoom(zoom);
302
+ const cx = (px - this.view.x) / this.view.zoom;
303
+ const cy = (py - this.view.y) / this.view.zoom;
304
+ this.setView({ zoom: next, x: px - cx * next, y: py - cy * next }, settled);
305
+ }
306
+ /**
307
+ * Flies the camera to `target`. Long trips zoom out on the way, like a map. Jumps at once under
308
+ * reduced motion.
309
+ */
310
+ animateTo(target, duration = 500) {
311
+ this.cancelAnimation();
312
+ const goal = { ...target, zoom: this.clampZoom(target.zoom) };
313
+ const { width, height } = this.size();
314
+ if (prefersReducedMotion() || width === 0 || height === 0) {
315
+ this.apply(goal, true);
316
+ return;
317
+ }
318
+ const from = { ...this.view };
319
+ const c0 = {
320
+ x: (width / 2 - from.x) / from.zoom,
321
+ y: (height / 2 - from.y) / from.zoom,
322
+ };
323
+ const c1 = {
324
+ x: (width / 2 - goal.x) / goal.zoom,
325
+ y: (height / 2 - goal.y) / goal.zoom,
326
+ };
327
+ const travel = Math.hypot(c1.x - c0.x, c1.y - c0.y) * Math.min(from.zoom, goal.zoom);
328
+ const far = travel > Math.max(width, height);
329
+ const lz0 = Math.log(from.zoom);
330
+ const lz1 = Math.log(goal.zoom);
331
+ this.stopAnimation = tween({
332
+ duration,
333
+ onUpdate: p => {
334
+ const dip = far ? 1 - 0.4 * Math.sin(Math.PI * p) : 1;
335
+ const zoom = Math.exp(lz0 + (lz1 - lz0) * p) * dip;
336
+ const cx = c0.x + (c1.x - c0.x) * p;
337
+ const cy = c0.y + (c1.y - c0.y) * p;
338
+ const view = p >= 1
339
+ ? goal
340
+ : { zoom, x: width / 2 - cx * zoom, y: height / 2 - cy * zoom };
341
+ this.apply(view, false);
342
+ },
343
+ onDone: () => {
344
+ this.stopAnimation = undefined;
345
+ this.apply(goal, true);
346
+ },
347
+ });
348
+ }
349
+ cancelAnimation() {
350
+ this.stopAnimation?.();
351
+ this.stopAnimation = undefined;
352
+ }
353
+ apply(view, settled) {
354
+ this.view = { x: view.x, y: view.y, zoom: view.zoom };
355
+ this.options.onChange(this.view, settled);
356
+ }
357
+ /** Starts a pan from a pointer press anywhere, for Space + drag over content. */
358
+ beginPan(event, background = false) {
359
+ const element = this.options.element();
360
+ if (!element)
361
+ return;
362
+ this.cancelAnimation();
363
+ event.preventDefault();
364
+ this.pan = {
365
+ pointerId: event.pointerId,
366
+ startX: event.clientX,
367
+ startY: event.clientY,
368
+ origin: { ...this.view },
369
+ moved: false,
370
+ background,
371
+ element,
372
+ };
373
+ try {
374
+ element.setPointerCapture(event.pointerId);
375
+ }
376
+ catch {
377
+ // Synthetic pointers cannot be captured.
378
+ }
379
+ }
380
+ // ── Input
381
+ attach(element) {
382
+ this.attachedTo = element;
383
+ element.addEventListener('wheel', this.onWheel, { passive: false });
384
+ element.addEventListener('pointerdown', this.onPointerDown);
385
+ element.addEventListener('pointermove', this.onPointerMove);
386
+ element.addEventListener('pointerup', this.onPointerUp);
387
+ element.addEventListener('pointercancel', this.onPointerUp);
388
+ element.addEventListener('keydown', this.onKeyDown);
389
+ element.addEventListener('keyup', this.onKeyUp);
390
+ element.addEventListener('blur', this.onBlur);
391
+ }
392
+ detach() {
393
+ const element = this.attachedTo;
394
+ if (!element)
395
+ return;
396
+ element.removeEventListener('wheel', this.onWheel);
397
+ element.removeEventListener('pointerdown', this.onPointerDown);
398
+ element.removeEventListener('pointermove', this.onPointerMove);
399
+ element.removeEventListener('pointerup', this.onPointerUp);
400
+ element.removeEventListener('pointercancel', this.onPointerUp);
401
+ element.removeEventListener('keydown', this.onKeyDown);
402
+ element.removeEventListener('keyup', this.onKeyUp);
403
+ element.removeEventListener('blur', this.onBlur);
404
+ this.attachedTo = undefined;
405
+ }
406
+ /**
407
+ * Whether a wheel event belongs to something inside the canvas: an overlay marked
408
+ * `data-diagram-overlay` (a palette, a popover), or an element that can scroll that way.
409
+ */
410
+ wheelBelongsInside(event) {
411
+ for (const node of event.composedPath()) {
412
+ if (node === this.attachedTo)
413
+ break;
414
+ if (node instanceof HTMLElement) {
415
+ if (node.hasAttribute('data-diagram-overlay'))
416
+ return 'overlay';
417
+ const style = getComputedStyle(node);
418
+ const scrollsY = event.deltaY !== 0 &&
419
+ /(auto|scroll)/.test(style.overflowY) &&
420
+ node.scrollHeight > node.clientHeight;
421
+ const scrollsX = event.deltaX !== 0 &&
422
+ /(auto|scroll)/.test(style.overflowX) &&
423
+ node.scrollWidth > node.clientWidth;
424
+ if (scrollsY || scrollsX)
425
+ return 'scroll';
426
+ }
427
+ }
428
+ return undefined;
429
+ }
430
+ startPinch() {
431
+ const [a, b] = [...this.touches.values()];
432
+ if (this.pan) {
433
+ this.pan = undefined;
434
+ this.panning = false;
435
+ }
436
+ const mid = { x: (a.x + b.x) / 2, y: (a.y + b.y) / 2 };
437
+ this.pinch = {
438
+ distance: Math.max(Math.hypot(a.x - b.x, a.y - b.y), 1),
439
+ zoom: this.view.zoom,
440
+ anchor: this.toCanvas(mid.x, mid.y),
441
+ };
442
+ }
443
+ movePinch() {
444
+ const { pinch } = this;
445
+ if (!pinch)
446
+ return;
447
+ const [a, b] = [...this.touches.values()];
448
+ const rect = this.options.element()?.getBoundingClientRect();
449
+ const mid = {
450
+ x: (a.x + b.x) / 2 - (rect?.left ?? 0),
451
+ y: (a.y + b.y) / 2 - (rect?.top ?? 0),
452
+ };
453
+ const zoom = this.clampZoom(pinch.zoom * (Math.hypot(a.x - b.x, a.y - b.y) / pinch.distance));
454
+ this.apply({
455
+ zoom,
456
+ x: mid.x - pinch.anchor.x * zoom,
457
+ y: mid.y - pinch.anchor.y * zoom,
458
+ }, false);
459
+ }
460
+ }
461
+
462
+ /** Screen pixels arrow keys pan the empty canvas. */
463
+ const PAN_STEP = 60;
464
+ const ZOOM_STEP = 1.25;
465
+ /**
466
+ * The camera, start position and chrome hooks every diagram canvas shares: `wc-diagram`,
467
+ * `wc-workflow` and the later diagram components. Subclasses render their content inside the
468
+ * element returned by `viewportElement()` and describe it through the abstract hooks.
469
+ */
470
+ class DiagramCanvasElement extends i {
471
+ constructor() {
472
+ // ── Properties
473
+ super(...arguments);
474
+ /** The camera's scale. Follows wheel and pinch zooming; set it to zoom around the centre. */
475
+ this.zoom = 1;
476
+ /** Screen pixels kept around content when fitting it. */
477
+ this.padding = 50;
478
+ /** Where the camera starts: fit all content, the canvas origin at 100%, or the first item at 100%. */
479
+ this.startPosition = 'fit';
480
+ /** Smallest zoom. */
481
+ this.minZoom = 0.1;
482
+ /** Largest zoom. */
483
+ this.maxZoom = 4;
484
+ /** Spacing of the background dots, in canvas pixels. */
485
+ this.gridSize = 20;
486
+ /** Turns on editing. */
487
+ this.editable = false;
488
+ /** Keeps content in place; the person can still pan, zoom and select. */
489
+ this.readonly = false;
490
+ /** The canvas's accessible name. */
491
+ this.label = '';
492
+ // ── Protected fields
493
+ this.i18n = new I18nController(this);
494
+ this.listeners = new DiagramListeners();
495
+ this.viewport = new ViewportController(this, {
496
+ element: () => this.viewportElement(),
497
+ minZoom: () => this.minZoom,
498
+ maxZoom: () => this.maxZoom,
499
+ onChange: (view, settled) => this.onViewChange(view, settled),
500
+ isBackground: target => this.isBackground(target),
501
+ onBackgroundPointerDown: event => this.onBackgroundPointerDown(event),
502
+ onBackgroundClick: event => this.onBackgroundClick(event),
503
+ });
504
+ /** Whether the camera has been placed at the start position. */
505
+ this.startApplied = false;
506
+ this.viewportFrame = 0;
507
+ }
508
+ /** Return true to take over a primary press on the background, for example for a marquee. */
509
+ // eslint-disable-next-line class-methods-use-this, @typescript-eslint/no-unused-vars
510
+ onBackgroundPointerDown(_event) {
511
+ return false;
512
+ }
513
+ /** A background press released without moving. */
514
+ // eslint-disable-next-line class-methods-use-this, @typescript-eslint/no-unused-vars
515
+ onBackgroundClick(_event) {
516
+ // Nothing by default.
517
+ }
518
+ // ── Lifecycle
519
+ connectedCallback() {
520
+ super.connectedCallback();
521
+ if (typeof ResizeObserver !== 'undefined') {
522
+ this.resizeObserver = new ResizeObserver(() => {
523
+ this.requestUpdate();
524
+ this.maybeApplyStart();
525
+ });
526
+ this.resizeObserver.observe(this);
527
+ }
528
+ }
529
+ disconnectedCallback() {
530
+ super.disconnectedCallback();
531
+ this.resizeObserver?.disconnect();
532
+ cancelAnimationFrame(this.viewportFrame);
533
+ }
534
+ willUpdate(changed) {
535
+ if (changed.has('zoom') &&
536
+ Math.abs(this.zoom - this.viewport.view.zoom) > 1e-6) {
537
+ this.viewport.zoomToValue(this.zoom);
538
+ }
539
+ }
540
+ updated(changed) {
541
+ super.updated(changed);
542
+ this.maybeApplyStart();
543
+ this.listeners.notify();
544
+ }
545
+ // ── Public API
546
+ /** The camera: canvas point `c` is drawn at `c * zoom + (x, y)`. Setting it moves the camera at once. */
547
+ get view() {
548
+ return { ...this.viewport.view };
549
+ }
550
+ set view(value) {
551
+ this.viewport.setView(value);
552
+ }
553
+ /** Fits all content in view, never zooming past 100%. */
554
+ fit() {
555
+ const bounds = this.contentBounds();
556
+ if (!bounds)
557
+ return;
558
+ this.viewport.animateTo(this.viewport.viewForRect(bounds, this.padding));
559
+ }
560
+ /** Flies back to the start position. */
561
+ home() {
562
+ this.viewport.animateTo(this.homeView ?? this.computeStartView());
563
+ }
564
+ zoomIn() {
565
+ this.animateZoom(this.viewport.view.zoom * ZOOM_STEP);
566
+ }
567
+ zoomOut() {
568
+ this.animateZoom(this.viewport.view.zoom / ZOOM_STEP);
569
+ }
570
+ /** Zooms to a level (`1` is 100%), or centres the item with that id at 100%. */
571
+ zoomTo(target) {
572
+ if (typeof target === 'number') {
573
+ this.animateZoom(target);
574
+ return;
575
+ }
576
+ const r = this.itemRect(target);
577
+ if (!r)
578
+ return;
579
+ this.viewport.animateTo(this.viewport.viewCentering({ x: r.x + r.width / 2, y: r.y + r.height / 2 }, 1));
580
+ }
581
+ /** Fits the selection in view. */
582
+ zoomToSelection() {
583
+ const bounds = boundsOf(this.selectionRects());
584
+ if (!bounds)
585
+ return;
586
+ this.viewport.animateTo(this.viewport.viewForRect(bounds, this.padding));
587
+ }
588
+ /** Centres canvas point `x, y`; animated unless `instant`. */
589
+ centerOn(x, y, instant = false) {
590
+ const view = this.viewport.viewCentering({ x, y });
591
+ if (instant)
592
+ this.viewport.setView(view);
593
+ else
594
+ this.viewport.animateTo(view, 300);
595
+ }
596
+ _diagramSubscribe(listener) {
597
+ return this.listeners.add(listener);
598
+ }
599
+ _diagramOverview() {
600
+ return {
601
+ items: this.overviewItems(),
602
+ visible: this.viewport.visibleRect(),
603
+ };
604
+ }
605
+ // ── Protected methods
606
+ emit(type, detail, cancelable = false) {
607
+ return this.dispatchEvent(new CustomEvent(type, {
608
+ detail,
609
+ bubbles: true,
610
+ composed: true,
611
+ cancelable,
612
+ }));
613
+ }
614
+ /** The start view for the current `start-position`; subclasses may adjust `fit`. */
615
+ computeStartView() {
616
+ if (this.startView) {
617
+ return {
618
+ ...this.startView,
619
+ zoom: this.viewport.clampZoom(this.startView.zoom),
620
+ };
621
+ }
622
+ const { zoom } = this.viewport.view;
623
+ if (this.startPosition === 'origin')
624
+ return { x: 0, y: 0, zoom };
625
+ const first = this.firstItemRect();
626
+ if (this.startPosition === 'first' && first) {
627
+ return this.viewport.viewCentering({ x: first.x + first.width / 2, y: first.y + first.height / 2 }, 1);
628
+ }
629
+ const bounds = this.contentBounds();
630
+ return bounds
631
+ ? this.viewport.viewForRect(bounds, this.padding)
632
+ : { x: 0, y: 0, zoom };
633
+ }
634
+ /** Whether there is anything to place the camera on yet. */
635
+ hasContent() {
636
+ return !!this.contentBounds();
637
+ }
638
+ /** Places the camera once, when the canvas has a size and something to show. */
639
+ maybeApplyStart() {
640
+ if (this.startApplied || !this.hasUpdated)
641
+ return;
642
+ const { width, height } = this.viewport.size();
643
+ if (!width || !height)
644
+ return;
645
+ if (!this.hasContent() &&
646
+ !this.startView &&
647
+ this.startPosition !== 'origin') {
648
+ return;
649
+ }
650
+ this.startApplied = true;
651
+ this.homeView = this.computeStartView();
652
+ this.viewport.setView(this.homeView);
653
+ }
654
+ /**
655
+ * Canvas-wide shortcuts: zoom (+, -, Ctrl/⌘+0), fit (Shift+1), selection (Shift+2), back to start
656
+ * (Home) and arrow keys on the empty canvas. Returns whether the key was handled.
657
+ */
658
+ handleCanvasKey(event) {
659
+ const mod = event.ctrlKey || event.metaKey;
660
+ const key = event.key.toLowerCase();
661
+ const origin = event.composedPath()[0];
662
+ let action;
663
+ if (mod && key === '0')
664
+ action = () => this.zoomTo(1);
665
+ else if (!mod && (key === '+' || key === '='))
666
+ action = () => this.zoomIn();
667
+ else if (!mod && key === '-')
668
+ action = () => this.zoomOut();
669
+ else if (event.shiftKey && event.code === 'Digit1')
670
+ action = () => this.fit();
671
+ else if (event.shiftKey && event.code === 'Digit2') {
672
+ action = () => this.zoomToSelection();
673
+ }
674
+ else if (key === 'home')
675
+ action = () => this.home();
676
+ else if (origin === this.viewportElement() && key.startsWith('arrow')) {
677
+ const d = {
678
+ arrowleft: [PAN_STEP, 0],
679
+ arrowright: [-PAN_STEP, 0],
680
+ arrowup: [0, PAN_STEP],
681
+ arrowdown: [0, -PAN_STEP],
682
+ }[key];
683
+ if (d)
684
+ action = () => this.viewport.panBy(d[0], d[1]);
685
+ }
686
+ if (!action)
687
+ return false;
688
+ event.preventDefault();
689
+ action();
690
+ return true;
691
+ }
692
+ /** Inline style that scrolls and scales the background dots with the camera. */
693
+ gridStyle() {
694
+ const { x, y, zoom } = this.viewport.view;
695
+ let dot = this.gridSize * zoom;
696
+ while (dot < 12)
697
+ dot *= 2;
698
+ return `background-size: ${dot}px ${dot}px; background-position: ${x}px ${y}px;`;
699
+ }
700
+ /** Whether `rect` is near the view, for rendering only what can be seen. */
701
+ nearView(rect, margin = 200) {
702
+ const { width, height } = this.viewport.size();
703
+ if (!this.startApplied || !width || !height)
704
+ return true;
705
+ const visible = inflateRect(this.viewport.visibleRect(), margin / this.viewport.view.zoom);
706
+ return rectsIntersect(rect, visible);
707
+ }
708
+ /** The "Back to content" button, shown when nothing is in view. */
709
+ renderBackToContent() {
710
+ const bounds = this.contentBounds();
711
+ if (!this.startApplied || !bounds)
712
+ return A;
713
+ if (rectsIntersect(bounds, this.viewport.visibleRect()))
714
+ return A;
715
+ return b `<wc-button
716
+ class="back-to-content"
717
+ level="secondary"
718
+ size="sm"
719
+ @click=${() => this.fit()}
720
+ ><wc-icon slot="icon" name="center_focus_strong"></wc-icon>${this.i18n.t('diagramBackToContent')}</wc-button
721
+ >`;
722
+ }
723
+ // ── Private methods
724
+ onViewChange(view, settled) {
725
+ if (this.zoom !== view.zoom)
726
+ this.zoom = view.zoom;
727
+ this.requestUpdate();
728
+ this.pendingViewport = { ...view, settled };
729
+ if (settled) {
730
+ cancelAnimationFrame(this.viewportFrame);
731
+ this.viewportFrame = 0;
732
+ this.flushViewport();
733
+ }
734
+ else if (!this.viewportFrame) {
735
+ this.viewportFrame = requestAnimationFrame(() => {
736
+ this.viewportFrame = 0;
737
+ this.flushViewport();
738
+ });
739
+ }
740
+ }
741
+ flushViewport() {
742
+ const detail = this.pendingViewport;
743
+ this.pendingViewport = undefined;
744
+ if (detail)
745
+ this.emit('viewport-change', detail);
746
+ }
747
+ animateZoom(zoom) {
748
+ const { width, height } = this.viewport.size();
749
+ const { x, y, zoom: current } = this.viewport.view;
750
+ const next = this.viewport.clampZoom(zoom);
751
+ const cx = (width / 2 - x) / current;
752
+ const cy = (height / 2 - y) / current;
753
+ this.viewport.animateTo({ zoom: next, x: width / 2 - cx * next, y: height / 2 - cy * next }, 200);
754
+ }
755
+ }
756
+ __decorate([
757
+ n({ type: Number, reflect: true })
758
+ ], DiagramCanvasElement.prototype, "zoom", void 0);
759
+ __decorate([
760
+ n({ type: Number, reflect: true })
761
+ ], DiagramCanvasElement.prototype, "padding", void 0);
762
+ __decorate([
763
+ n({ type: String, attribute: 'start-position' })
764
+ ], DiagramCanvasElement.prototype, "startPosition", void 0);
765
+ __decorate([
766
+ n({ type: Object, attribute: 'start-view' })
767
+ ], DiagramCanvasElement.prototype, "startView", void 0);
768
+ __decorate([
769
+ n({ type: Number, attribute: 'min-zoom' })
770
+ ], DiagramCanvasElement.prototype, "minZoom", void 0);
771
+ __decorate([
772
+ n({ type: Number, attribute: 'max-zoom' })
773
+ ], DiagramCanvasElement.prototype, "maxZoom", void 0);
774
+ __decorate([
775
+ n({ type: Number, attribute: 'grid-size' })
776
+ ], DiagramCanvasElement.prototype, "gridSize", void 0);
777
+ __decorate([
778
+ n({ type: Boolean, reflect: true })
779
+ ], DiagramCanvasElement.prototype, "editable", void 0);
780
+ __decorate([
781
+ n({ type: Boolean, reflect: true })
782
+ ], DiagramCanvasElement.prototype, "readonly", void 0);
783
+ __decorate([
784
+ n({ type: String })
785
+ ], DiagramCanvasElement.prototype, "label", void 0);
786
+
787
+ export { DiagramCanvasElement as D, animateOut as a, easeOutCubic as b, easeInOutCubic as e, prefersReducedMotion as p, tween as t };
788
+ //# sourceMappingURL=canvas-base-CWQ4rQ2s.js.map