@redvars/peacock 4.0.0 → 4.1.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.
- package/dist/{BaseField-CAog9TIc.js → BaseField-BMumJpkW.js} +6 -3
- package/dist/BaseField-BMumJpkW.js.map +1 -0
- package/dist/{BaseInput-CcMfg1Y2.js → BaseInput-mWdyYv27.js} +6 -3
- package/dist/BaseInput-mWdyYv27.js.map +1 -0
- package/dist/accordion.js.map +1 -1
- package/dist/ai-badge.js +2 -2
- package/dist/ai-summary.js +2 -2
- package/dist/alert.js +2 -2
- package/dist/anchor-nav.js +2 -2
- package/dist/app-shell.js +2 -2
- package/dist/assistant-panel.js +2 -2
- package/dist/assistant-step.js +2 -2
- package/dist/assistant-steps.js +2 -2
- package/dist/avatar-group.js +2 -2
- package/dist/banner.js +2 -2
- package/dist/{base-button-Do2TUy8M.js → base-button-BJMGMcMv.js} +3 -1
- package/dist/base-button-BJMGMcMv.js.map +1 -0
- package/dist/{base-progress-BiLlZVHJ.js → base-progress-CvLVSjuy.js} +4 -2
- package/dist/base-progress-CvLVSjuy.js.map +1 -0
- package/dist/bottom-sheet.js +2 -2
- package/dist/breadcrumb.js +2 -2
- package/dist/button-group.js +4 -4
- package/dist/button.js +3 -3
- package/dist/calendar.js +2 -2
- package/dist/canvas-base-BTQMEVn_.js +788 -0
- package/dist/canvas-base-BTQMEVn_.js.map +1 -0
- package/dist/canvas-link-CtgsALq4.js +54 -0
- package/dist/canvas-link-CtgsALq4.js.map +1 -0
- package/dist/{cartesian-chart-C-f1frt0.js → cartesian-chart-DM1FC_XT.js} +3 -2
- package/dist/cartesian-chart-DM1FC_XT.js.map +1 -0
- package/dist/{cb-group-base-DeuCVx3a.js → cb-group-base-B6fa4Lll.js} +2 -2
- package/dist/{cb-group-base-DeuCVx3a.js.map → cb-group-base-B6fa4Lll.js.map} +1 -1
- package/dist/cb-group.js +3 -3
- package/dist/cb-rule.js +3 -3
- package/dist/chart-area.js +5 -4
- package/dist/chart-area.js.map +1 -1
- package/dist/chart-bar.js +5 -4
- package/dist/chart-bar.js.map +1 -1
- package/dist/chart-base-Dhxuw_Mw.js +833 -0
- package/dist/chart-base-Dhxuw_Mw.js.map +1 -0
- package/dist/chart-doughnut.js +4 -3
- package/dist/chart-doughnut.js.map +1 -1
- package/dist/chart-line.js +5 -4
- package/dist/chart-line.js.map +1 -1
- package/dist/chart-pie.js +4 -3
- package/dist/chart-pie.js.map +1 -1
- package/dist/chat-message.js +2 -2
- package/dist/chat-thread.js +2 -2
- package/dist/checkbox-group.js +4 -4
- package/dist/checkbox.js +4 -4
- package/dist/chip-set.js +3 -3
- package/dist/chip.js +4 -4
- package/dist/circular-progress.js +3 -3
- package/dist/citation.js +2 -2
- package/dist/code-editor.js +5 -4
- package/dist/code-editor.js.map +1 -1
- package/dist/code-highlighter.js +2 -2
- package/dist/color-field.js +5 -5
- package/dist/color-picker.js +2 -2
- package/dist/command-palette.js +2 -2
- package/dist/comment-composer.js +5 -5
- package/dist/condition-builder.js +3 -3
- package/dist/confirm-dialog.js +2 -2
- package/dist/copy-button.js +2 -2
- package/dist/currency-field.js +5 -5
- package/dist/custom-elements-jsdocs.json +2115 -336
- package/dist/custom-elements.json +19483 -615
- package/dist/date-field.js +6 -6
- package/dist/date-picker.js +4 -2
- package/dist/date-picker.js.map +1 -1
- package/dist/date-range-field.js +6 -6
- package/dist/datetime-field.js +6 -6
- package/dist/dependency-map-layout-5KUueabk.js +1390 -0
- package/dist/dependency-map-layout-5KUueabk.js.map +1 -0
- package/dist/dependency-map.js +1605 -0
- package/dist/dependency-map.js.map +1 -0
- package/dist/description-item.js +2 -2
- package/dist/description-list.js +2 -2
- package/dist/diagram-2r11KySs.js +2029 -0
- package/dist/diagram-2r11KySs.js.map +1 -0
- package/dist/diagram-controls.js +345 -0
- package/dist/diagram-controls.js.map +1 -0
- package/dist/diagram-minimap.js +216 -0
- package/dist/diagram-minimap.js.map +1 -0
- package/dist/diagram.js +20 -0
- package/dist/diagram.js.map +1 -0
- package/dist/diff-viewer.js +2 -2
- package/dist/discussion-activity.js +2 -2
- package/dist/discussion-comment.js +2 -2
- package/dist/discussion.js +5 -5
- package/dist/{document-editor-BO7QPbO5.js → document-editor-BnEugM3E.js} +2 -2
- package/dist/{document-editor-BO7QPbO5.js.map → document-editor-BnEugM3E.js.map} +1 -1
- package/dist/document-editor.js +3 -3
- package/dist/draft-card.js +2 -2
- package/dist/erd.js +2021 -0
- package/dist/erd.js.map +1 -0
- package/dist/fab.js +4 -4
- package/dist/field.js +257 -43
- package/dist/field.js.map +1 -1
- package/dist/file-upload.js +37 -15
- package/dist/file-upload.js.map +1 -1
- package/dist/filter-bar.js +2 -2
- package/dist/flow.js +27 -970
- package/dist/flow.js.map +1 -1
- package/dist/focus-ring.js +2 -0
- package/dist/focus-ring.js.map +1 -1
- package/dist/{form-associated-D3Tn33s_.js → form-associated-BHbg72PG.js} +3 -1
- package/dist/{form-associated-D3Tn33s_.js.map → form-associated-BHbg72PG.js.map} +1 -1
- package/dist/{form-submitter-DWwv6K9-.js → form-submitter-beG1CXAn.js} +7 -1
- package/dist/{form-submitter-DWwv6K9-.js.map → form-submitter-beG1CXAn.js.map} +1 -1
- package/dist/form.js +2 -2
- package/dist/{generative-view-DmtpDobn.js → generative-view-BgOcLRXr.js} +13 -13
- package/dist/generative-view-BgOcLRXr.js.map +1 -0
- package/dist/generative-view.js +3 -3
- package/dist/geometry-INg82Lxq.js +305 -0
- package/dist/geometry-INg82Lxq.js.map +1 -0
- package/dist/history-YbTSQZHj.js +45 -0
- package/dist/history-YbTSQZHj.js.map +1 -0
- package/dist/host-CZK7xhzh.js +40 -0
- package/dist/host-CZK7xhzh.js.map +1 -0
- package/dist/html-editor.js +5 -5
- package/dist/{hyperlink-DhE9RlVS.js → hyperlink-DycWPKwU.js} +10 -1
- package/dist/hyperlink-DycWPKwU.js.map +1 -0
- package/dist/{i18n-controller-urcQKYGe.js → i18n-controller-Cp43HjJl.js} +2 -2
- package/dist/{i18n-controller-urcQKYGe.js.map → i18n-controller-Cp43HjJl.js.map} +1 -1
- package/dist/icon-button.js +4 -4
- package/dist/image.js +2 -2
- package/dist/index.js +37 -18
- package/dist/index.js.map +1 -1
- package/dist/inline-edit.js +2 -2
- package/dist/input.js +4 -4
- package/dist/json-viewer.js +2 -2
- package/dist/kanban.js +2 -2
- package/dist/kbd.js +2 -2
- package/dist/linear-progress.js +3 -3
- package/dist/link-button.js +2 -2
- package/dist/list-item.js +2 -2
- package/dist/list.js +2 -2
- package/dist/listbox.js +3 -3
- package/dist/loader-full.js +13 -13
- package/dist/loader.js +44 -15
- package/dist/loader.js.map +1 -1
- package/dist/markdown-editor.js +5 -5
- package/dist/markers-BFmh1OCz.js +46 -0
- package/dist/markers-BFmh1OCz.js.map +1 -0
- package/dist/measure-controller-Dmc5hZKg.js +89 -0
- package/dist/measure-controller-Dmc5hZKg.js.map +1 -0
- package/dist/mention-input.js +6 -5
- package/dist/mention-input.js.map +1 -1
- package/dist/menu-item.js +3 -2
- package/dist/menu-item.js.map +1 -1
- package/dist/menu.js +2 -2
- package/dist/modal.js +2 -2
- package/dist/navigation-bar.js +2 -2
- package/dist/navigation-drawer.js +2 -2
- package/dist/navigation-rail.js +2 -2
- package/dist/notification-center.js +2 -2
- package/dist/number-field.js +6 -5
- package/dist/number-field.js.map +1 -1
- package/dist/option.js +2 -2
- package/dist/page-header.js +2 -2
- package/dist/pagination.js +2 -2
- package/dist/password-field.js +5 -5
- package/dist/password-rules.js +2 -2
- package/dist/phone-field.js +5 -5
- package/dist/{picker-field-B4DtcJfL.js → picker-field-dTlIMAQn.js} +3 -3
- package/dist/{picker-field-B4DtcJfL.js.map → picker-field-dTlIMAQn.js.map} +1 -1
- package/dist/pin-input.js +5 -5
- package/dist/presence-indicator.js +2 -2
- package/dist/prompt-input.js +5 -5
- package/dist/radio-group.js +1 -0
- package/dist/radio-group.js.map +1 -1
- package/dist/radio.js +5 -5
- package/dist/radio.js.map +1 -1
- package/dist/rating.js +5 -4
- package/dist/rating.js.map +1 -1
- package/dist/redvars-loader.js +2 -2
- package/dist/relative-time.js +2 -2
- package/dist/resizable-panels.js +2 -2
- package/dist/{rich-text-input-DLICqof1.js → rich-text-input-DM_BOzgk.js} +3 -3
- package/dist/{rich-text-input-DLICqof1.js.map → rich-text-input-DM_BOzgk.js.map} +1 -1
- package/dist/ripple.js +2 -0
- package/dist/ripple.js.map +1 -1
- package/dist/{schema-hMt-NRLk.js → schema-B8g30A_n.js} +2 -2
- package/dist/{schema-hMt-NRLk.js.map → schema-B8g30A_n.js.map} +1 -1
- package/dist/search.js +4 -4
- package/dist/segmented-button-group.js +1 -1
- package/dist/select.js +7 -7
- package/dist/side-sheet.js +2 -2
- package/dist/signature-pad.js +5 -4
- package/dist/signature-pad.js.map +1 -1
- package/dist/slider.js +5 -4
- package/dist/slider.js.map +1 -1
- package/dist/snackbar.js +2 -2
- package/dist/sparkline.js +2 -2
- package/dist/split-button.js +2 -2
- package/dist/src/__internal/diagram/canvas-base.d.ts +105 -0
- package/dist/src/__internal/diagram/canvas-link.d.ts +21 -0
- package/dist/src/__internal/diagram/geometry.d.ts +49 -0
- package/dist/src/__internal/diagram/history.d.ts +17 -0
- package/dist/src/__internal/diagram/host.d.ts +45 -0
- package/dist/src/__internal/diagram/markers.d.ts +16 -0
- package/dist/src/__internal/diagram/measure-controller.d.ts +32 -0
- package/dist/src/__internal/diagram/motion.d.ts +22 -0
- package/dist/src/__internal/diagram/selection.d.ts +20 -0
- package/dist/src/__internal/diagram/types.d.ts +39 -0
- package/dist/src/__internal/diagram/viewport-controller.d.ts +89 -0
- package/dist/src/__internal/i18n/strings.d.ts +149 -0
- package/dist/src/__internal/toggle-base.d.ts +8 -0
- package/dist/src/__internal/utils/deprecate.d.ts +3 -3
- package/dist/src/accordion/accordion.d.ts +1 -0
- package/dist/src/code-editor/code-editor.d.ts +1 -0
- package/dist/src/date-picker/date-picker.d.ts +2 -0
- package/dist/src/dependency-map/dependency-map-layout.d.ts +48 -0
- package/dist/src/dependency-map/dependency-map.d.ts +241 -0
- package/dist/src/dependency-map/index.d.ts +2 -0
- package/dist/src/diagram/diagram.d.ts +300 -0
- package/dist/src/diagram/flow.d.ts +53 -0
- package/dist/src/diagram/index.d.ts +4 -0
- package/dist/src/diagram-controls/diagram-controls.d.ts +46 -0
- package/dist/src/diagram-controls/index.d.ts +1 -0
- package/dist/src/diagram-minimap/diagram-minimap.d.ts +39 -0
- package/dist/src/diagram-minimap/index.d.ts +1 -0
- package/dist/src/erd/erd-layout.d.ts +27 -0
- package/dist/src/erd/erd.d.ts +266 -0
- package/dist/src/erd/index.d.ts +2 -0
- package/dist/src/field/field.d.ts +38 -1
- package/dist/src/file-upload/file-upload.d.ts +3 -1
- package/dist/src/focus-ring/focus-ring.d.ts +2 -0
- package/dist/src/index.d.ts +15 -2
- package/dist/src/input/BaseField.d.ts +3 -0
- package/dist/src/input/BaseInput.d.ts +3 -0
- package/dist/src/menu/menu-item/menu-item.d.ts +1 -0
- package/dist/src/number-field/number-field.d.ts +4 -0
- package/dist/src/progress/base-progress.d.ts +3 -0
- package/dist/src/radio/radio-group.d.ts +1 -0
- package/dist/src/rating/rating.d.ts +1 -0
- package/dist/src/ripple/ripple.d.ts +2 -0
- package/dist/src/signature-pad/signature-pad.d.ts +1 -0
- package/dist/src/slider/slider.d.ts +1 -0
- package/dist/src/switch/switch.d.ts +1 -0
- package/dist/src/tabs/tab.d.ts +2 -0
- package/dist/src/tabs/tabs.d.ts +1 -0
- package/dist/src/textarea/textarea.d.ts +1 -0
- package/dist/src/time-picker/time-picker.d.ts +2 -0
- package/dist/src/transfer-list/transfer-list.d.ts +1 -0
- package/dist/src/tree-chart/index.d.ts +2 -0
- package/dist/src/tree-chart/tree-chart-layout.d.ts +49 -0
- package/dist/src/tree-chart/tree-chart.d.ts +221 -0
- package/dist/src/workflow/index.d.ts +2 -0
- package/dist/src/workflow/workflow-format.d.ts +5 -0
- package/dist/src/workflow/workflow-model.d.ts +194 -0
- package/dist/src/workflow/workflow.d.ts +313 -0
- package/dist/src/workflow-timeline/index.d.ts +1 -0
- package/dist/src/workflow-timeline/workflow-timeline.d.ts +41 -0
- package/dist/stat.js +2 -2
- package/dist/status-indicator.js +2 -2
- package/dist/step.js +2 -2
- package/dist/stepper.js +2 -2
- package/dist/{strings-DmbqMTfs.js → strings-BJPuhKJk.js} +163 -1
- package/dist/{strings-DmbqMTfs.js.map → strings-BJPuhKJk.js.map} +1 -1
- package/dist/sub-menu.js +2 -2
- package/dist/svg.js +2 -2
- package/dist/switch.js +5 -4
- package/dist/switch.js.map +1 -1
- package/dist/tab.js +1 -0
- package/dist/tab.js.map +1 -1
- package/dist/table.js +2 -2
- package/dist/tabs.js +1 -0
- package/dist/tabs.js.map +1 -1
- package/dist/test/diagram-controls.test.d.ts +1 -0
- package/dist/test/diagram-geometry.test.d.ts +1 -0
- package/dist/test/diagram.test.d.ts +1 -0
- package/dist/test/erd.test.d.ts +1 -0
- package/dist/test/toggle-label.test.d.ts +1 -0
- package/dist/test/tree-chart.test.d.ts +1 -0
- package/dist/test/workflow-debug.test.d.ts +1 -0
- package/dist/test/workflow.test.d.ts +1 -0
- package/dist/textarea.js +7 -5
- package/dist/textarea.js.map +1 -1
- package/dist/time-field.js +6 -6
- package/dist/time-picker.js +4 -2
- package/dist/time-picker.js.map +1 -1
- package/dist/timeline-item.js +2 -2
- package/dist/timeline.js +2 -2
- package/dist/{toggle-base-BQO5pjrU.js → toggle-base-BlaHalfS.js} +19 -3
- package/dist/toggle-base-BlaHalfS.js.map +1 -0
- package/dist/tour.js +2 -2
- package/dist/transfer-list.js +5 -4
- package/dist/transfer-list.js.map +1 -1
- package/dist/{chart-base-B-gOg2Di.js → transform-CxeQFXXB.js} +9 -839
- package/dist/transform-CxeQFXXB.js.map +1 -0
- package/dist/tree-chart.js +1986 -0
- package/dist/tree-chart.js.map +1 -0
- package/dist/tree-item.js +2 -2
- package/dist/tree.js +2 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/typing-indicator.js +2 -2
- package/dist/url-field.js +5 -5
- package/dist/user-menu.js +2 -2
- package/dist/virtual-list.js +2 -2
- package/dist/workflow-format-BsyveyeC.js +34 -0
- package/dist/workflow-format-BsyveyeC.js.map +1 -0
- package/dist/workflow-model-CauduOG2.js +330 -0
- package/dist/workflow-model-CauduOG2.js.map +1 -0
- package/dist/workflow-timeline.js +354 -0
- package/dist/workflow-timeline.js.map +1 -0
- package/dist/workflow.js +3337 -0
- package/dist/workflow.js.map +1 -0
- package/dist/workspace-switcher.js +2 -2
- package/package.json +1 -1
- package/readme.md +44 -2
- package/src/LoaderUtils.ts +9 -2
- package/src/__internal/diagram/canvas-base.ts +410 -0
- package/src/__internal/diagram/canvas-link.ts +66 -0
- package/src/__internal/diagram/geometry.ts +372 -0
- package/src/__internal/diagram/history.ts +49 -0
- package/src/__internal/diagram/host.ts +76 -0
- package/src/__internal/diagram/markers.ts +56 -0
- package/src/__internal/diagram/measure-controller.ts +104 -0
- package/src/__internal/diagram/motion.ts +89 -0
- package/src/__internal/diagram/selection.ts +69 -0
- package/src/__internal/diagram/types.ts +56 -0
- package/src/__internal/diagram/viewport-controller.ts +494 -0
- package/src/__internal/i18n/strings.ts +201 -0
- package/src/__internal/mixins/field.ts +3 -0
- package/src/__internal/mixins/form-associated.ts +2 -0
- package/src/__internal/mixins/form-submitter.ts +6 -0
- package/src/__internal/mixins/hyperlink.ts +10 -0
- package/src/__internal/toggle-base.ts +16 -0
- package/src/__internal/utils/deprecate.ts +5 -4
- package/src/accordion/accordion.ts +1 -0
- package/src/button/base-button/base-button.ts +2 -0
- package/src/code-editor/code-editor.ts +1 -0
- package/src/date-picker/date-picker.ts +2 -0
- package/src/dependency-map/dependency-map-layout.ts +505 -0
- package/src/dependency-map/dependency-map.scss +626 -0
- package/src/dependency-map/dependency-map.ts +1280 -0
- package/src/dependency-map/index.ts +16 -0
- package/src/diagram/diagram.scss +513 -0
- package/src/diagram/diagram.ts +1852 -0
- package/src/diagram/flow.ts +81 -0
- package/src/diagram/index.ts +44 -0
- package/src/diagram-controls/diagram-controls.scss +68 -0
- package/src/diagram-controls/diagram-controls.ts +255 -0
- package/src/diagram-controls/index.ts +1 -0
- package/src/diagram-minimap/diagram-minimap.scss +41 -0
- package/src/diagram-minimap/diagram-minimap.ts +149 -0
- package/src/diagram-minimap/index.ts +1 -0
- package/src/erd/erd-layout.ts +92 -0
- package/src/erd/erd.scss +636 -0
- package/src/erd/erd.ts +1728 -0
- package/src/erd/index.ts +17 -0
- package/src/field/field.scss +197 -23
- package/src/field/field.ts +109 -16
- package/src/file-upload/file-upload.scss +37 -10
- package/src/file-upload/file-upload.ts +3 -1
- package/src/focus-ring/focus-ring.ts +2 -0
- package/src/generative-view/catalog.generated.ts +12 -11
- package/src/index.ts +121 -2
- package/src/input/BaseField.ts +3 -0
- package/src/input/BaseInput.ts +3 -0
- package/src/loader.ts +25 -0
- package/src/mention-input/mention-input.scss +2 -0
- package/src/menu/menu-item/menu-item.ts +1 -0
- package/src/number-field/number-field.ts +4 -0
- package/src/progress/base-progress.ts +3 -0
- package/src/radio/radio-group.ts +1 -0
- package/src/radio/radio.ts +1 -1
- package/src/rating/rating.ts +1 -0
- package/src/ripple/ripple.ts +2 -0
- package/src/signature-pad/signature-pad.ts +1 -0
- package/src/slider/slider.ts +1 -0
- package/src/switch/switch.ts +1 -0
- package/src/tabs/tab.ts +2 -0
- package/src/tabs/tabs.ts +1 -0
- package/src/textarea/textarea.scss +2 -0
- package/src/textarea/textarea.ts +1 -0
- package/src/time-picker/time-picker.ts +2 -0
- package/src/transfer-list/transfer-list.ts +1 -0
- package/src/tree-chart/index.ts +13 -0
- package/src/tree-chart/tree-chart-layout.ts +185 -0
- package/src/tree-chart/tree-chart.scss +377 -0
- package/src/tree-chart/tree-chart.ts +1170 -0
- package/src/workflow/index.ts +35 -0
- package/src/workflow/workflow-format.ts +29 -0
- package/src/workflow/workflow-model.ts +583 -0
- package/src/workflow/workflow.scss +1164 -0
- package/src/workflow/workflow.ts +2674 -0
- package/src/workflow-timeline/index.ts +1 -0
- package/src/workflow-timeline/workflow-timeline.scss +128 -0
- package/src/workflow-timeline/workflow-timeline.ts +238 -0
- package/dist/BaseField-CAog9TIc.js.map +0 -1
- package/dist/BaseInput-CcMfg1Y2.js.map +0 -1
- package/dist/base-button-Do2TUy8M.js.map +0 -1
- package/dist/base-progress-BiLlZVHJ.js.map +0 -1
- package/dist/cartesian-chart-C-f1frt0.js.map +0 -1
- package/dist/chart-base-B-gOg2Di.js.map +0 -1
- package/dist/generative-view-DmtpDobn.js.map +0 -1
- package/dist/hyperlink-DhE9RlVS.js.map +0 -1
- package/dist/src/flow/flow.d.ts +0 -178
- package/dist/src/flow/index.d.ts +0 -2
- package/dist/toggle-base-BQO5pjrU.js.map +0 -1
- package/src/button/button-group/readme.md +0 -23
- package/src/flow/flow.scss +0 -215
- package/src/flow/flow.ts +0 -958
- package/src/flow/index.ts +0 -10
- /package/dist/test/{flow.test.d.ts → dependency-map.test.d.ts} +0 -0
package/src/index.ts
CHANGED
|
@@ -440,7 +440,115 @@ export type {
|
|
|
440
440
|
EventType,
|
|
441
441
|
CalendarDateChangeDetail,
|
|
442
442
|
} from './calendar/index.js';
|
|
443
|
-
export {
|
|
443
|
+
export { Diagram } from './diagram/index.js';
|
|
444
|
+
// Deprecated alias of Diagram: wc-flow was renamed to wc-diagram. Removed in 5.0.
|
|
445
|
+
export { Flow } from './diagram/index.js';
|
|
446
|
+
export { DiagramControls } from './diagram-controls/index.js';
|
|
447
|
+
export { Workflow, WORKFLOW_LOGIC_STEPS } from './workflow/index.js';
|
|
448
|
+
export { WorkflowTimeline } from './workflow-timeline/index.js';
|
|
449
|
+
export { TreeChart } from './tree-chart/index.js';
|
|
450
|
+
export type {
|
|
451
|
+
TreeChartAccent,
|
|
452
|
+
TreeChartAddDetail,
|
|
453
|
+
TreeChartChangeDetail,
|
|
454
|
+
TreeChartChangeReason,
|
|
455
|
+
TreeChartDeleteDetail,
|
|
456
|
+
TreeChartItem,
|
|
457
|
+
TreeChartItemDetail,
|
|
458
|
+
TreeChartOrientation,
|
|
459
|
+
TreeChartReparentDetail,
|
|
460
|
+
TreeChartViewportDetail,
|
|
461
|
+
} from './tree-chart/index.js';
|
|
462
|
+
export { DependencyMap } from './dependency-map/index.js';
|
|
463
|
+
export type {
|
|
464
|
+
DependencyMapEdge,
|
|
465
|
+
DependencyMapFilter,
|
|
466
|
+
DependencyMapFilterDetail,
|
|
467
|
+
DependencyMapFocusDetail,
|
|
468
|
+
DependencyMapGroup,
|
|
469
|
+
DependencyMapGroupDetail,
|
|
470
|
+
DependencyMapImpact,
|
|
471
|
+
DependencyMapLayout,
|
|
472
|
+
DependencyMapMoveDetail,
|
|
473
|
+
DependencyMapNode,
|
|
474
|
+
DependencyMapSelectDetail,
|
|
475
|
+
DependencyMapStatus,
|
|
476
|
+
DependencyMapViewportDetail,
|
|
477
|
+
} from './dependency-map/index.js';
|
|
478
|
+
export { Erd } from './erd/index.js';
|
|
479
|
+
export type {
|
|
480
|
+
ErdAccent,
|
|
481
|
+
ErdCardinality,
|
|
482
|
+
ErdChangeDetail,
|
|
483
|
+
ErdChangeReason,
|
|
484
|
+
ErdColumn,
|
|
485
|
+
ErdConnectDetail,
|
|
486
|
+
ErdDeleteDetail,
|
|
487
|
+
ErdEntity,
|
|
488
|
+
ErdFocusDetail,
|
|
489
|
+
ErdMoveDetail,
|
|
490
|
+
ErdRelation,
|
|
491
|
+
ErdSelectDetail,
|
|
492
|
+
ErdToggleDetail,
|
|
493
|
+
ErdViewportDetail,
|
|
494
|
+
} from './erd/index.js';
|
|
495
|
+
export type {
|
|
496
|
+
WorkflowBreakpointDetail,
|
|
497
|
+
WorkflowDebugAction,
|
|
498
|
+
WorkflowDebugActionDetail,
|
|
499
|
+
WorkflowIterationDetail,
|
|
500
|
+
WorkflowMode,
|
|
501
|
+
WorkflowRun,
|
|
502
|
+
WorkflowRunStep,
|
|
503
|
+
WorkflowRunStepStatus,
|
|
504
|
+
WorkflowAccent,
|
|
505
|
+
WorkflowActionStep,
|
|
506
|
+
WorkflowAssignee,
|
|
507
|
+
WorkflowBranchStep,
|
|
508
|
+
WorkflowChangeDetail,
|
|
509
|
+
WorkflowChangeReason,
|
|
510
|
+
WorkflowDeleteDetail,
|
|
511
|
+
WorkflowDensity,
|
|
512
|
+
WorkflowDirection,
|
|
513
|
+
WorkflowEndStep,
|
|
514
|
+
WorkflowField,
|
|
515
|
+
WorkflowListRef,
|
|
516
|
+
WorkflowLoopStep,
|
|
517
|
+
WorkflowOutput,
|
|
518
|
+
WorkflowPath,
|
|
519
|
+
WorkflowProblem,
|
|
520
|
+
WorkflowSelectDetail,
|
|
521
|
+
WorkflowStep,
|
|
522
|
+
WorkflowStepAddDetail,
|
|
523
|
+
WorkflowStepType,
|
|
524
|
+
WorkflowTool,
|
|
525
|
+
WorkflowValue,
|
|
526
|
+
WorkflowViewportDetail,
|
|
527
|
+
WorkflowWaitStep,
|
|
528
|
+
} from './workflow/index.js';
|
|
529
|
+
export { DiagramMinimap } from './diagram-minimap/index.js';
|
|
530
|
+
export type {
|
|
531
|
+
DiagramNode,
|
|
532
|
+
DiagramEdge,
|
|
533
|
+
DiagramStrokeVariant,
|
|
534
|
+
DiagramConnectDetail,
|
|
535
|
+
DiagramHandlePosition,
|
|
536
|
+
DiagramNodeMoveDetail,
|
|
537
|
+
DiagramPoint,
|
|
538
|
+
DiagramSelectDetail,
|
|
539
|
+
DiagramChangeDetail,
|
|
540
|
+
DiagramChangeReason,
|
|
541
|
+
DiagramConnector,
|
|
542
|
+
DiagramDeleteDetail,
|
|
543
|
+
DiagramEdgeType,
|
|
544
|
+
DiagramIntent,
|
|
545
|
+
DiagramMarker,
|
|
546
|
+
DiagramPort,
|
|
547
|
+
DiagramStartPosition,
|
|
548
|
+
DiagramView,
|
|
549
|
+
DiagramViewportDetail,
|
|
550
|
+
} from './diagram/index.js';
|
|
551
|
+
// Deprecated aliases of the Diagram* types above (wc-flow was renamed to wc-diagram), until 5.0.
|
|
444
552
|
export type {
|
|
445
553
|
FlowNode,
|
|
446
554
|
FlowEdge,
|
|
@@ -449,7 +557,18 @@ export type {
|
|
|
449
557
|
FlowHandlePosition,
|
|
450
558
|
FlowNodeMoveDetail,
|
|
451
559
|
FlowSelectDetail,
|
|
452
|
-
|
|
560
|
+
FlowChangeDetail,
|
|
561
|
+
FlowChangeReason,
|
|
562
|
+
FlowConnector,
|
|
563
|
+
FlowDeleteDetail,
|
|
564
|
+
FlowEdgeType,
|
|
565
|
+
FlowIntent,
|
|
566
|
+
FlowMarker,
|
|
567
|
+
FlowPort,
|
|
568
|
+
FlowStartPosition,
|
|
569
|
+
FlowView,
|
|
570
|
+
FlowViewportDetail,
|
|
571
|
+
} from './diagram/index.js';
|
|
453
572
|
export {
|
|
454
573
|
ConditionBuilder,
|
|
455
574
|
CbGroup,
|
package/src/input/BaseField.ts
CHANGED
|
@@ -43,6 +43,7 @@ export default abstract class BaseField extends BaseInput {
|
|
|
43
43
|
/** Label shown above the field; also the control's accessible name. */
|
|
44
44
|
@property({ type: String }) label = '';
|
|
45
45
|
|
|
46
|
+
/** Hint shown inside the empty control. */
|
|
46
47
|
@property({ type: String }) placeholder = '';
|
|
47
48
|
|
|
48
49
|
/** Help text shown below the field. */
|
|
@@ -51,11 +52,13 @@ export default abstract class BaseField extends BaseInput {
|
|
|
51
52
|
/** Shows the field in its error state with `error-text`. */
|
|
52
53
|
@property({ type: Boolean }) error = false;
|
|
53
54
|
|
|
55
|
+
/** Error message shown below the field while `error` is set; replaces the help text. */
|
|
54
56
|
@property({ type: String, attribute: 'error-text' }) errorText = '';
|
|
55
57
|
|
|
56
58
|
/** Shows the field in its warning state with `warning-text`. */
|
|
57
59
|
@property({ type: Boolean }) warning = false;
|
|
58
60
|
|
|
61
|
+
/** Warning message shown below the field while `warning` is set; replaces the help text. */
|
|
59
62
|
@property({ type: String, attribute: 'warning-text' }) warningText = '';
|
|
60
63
|
|
|
61
64
|
/** Visual variant of the field. */
|
package/src/input/BaseInput.ts
CHANGED
|
@@ -88,12 +88,15 @@ export default abstract class BaseInput extends mixinFormAssociated(
|
|
|
88
88
|
/** Each control declares its own `value` (a property, or an accessor such as Switch's). */
|
|
89
89
|
abstract value?: any;
|
|
90
90
|
|
|
91
|
+
/** Shows the value but stops the user changing it; unlike `disabled`, it stays focusable and is submitted. */
|
|
91
92
|
@property({ type: Boolean, reflect: true })
|
|
92
93
|
readonly: boolean = false;
|
|
93
94
|
|
|
95
|
+
/** Requires a value before the form can submit. */
|
|
94
96
|
@property({ type: Boolean, reflect: true })
|
|
95
97
|
required: boolean = false;
|
|
96
98
|
|
|
99
|
+
/** Shows a loading placeholder in place of the control. */
|
|
97
100
|
@property({ type: Boolean, reflect: true })
|
|
98
101
|
skeleton = false;
|
|
99
102
|
|
package/src/loader.ts
CHANGED
|
@@ -684,9 +684,34 @@ const loaderConfig: LoaderConfig = {
|
|
|
684
684
|
'wc-calendar-month-view': {
|
|
685
685
|
importPath: `${distDirectory}/calendar-month-view.js`,
|
|
686
686
|
},
|
|
687
|
+
'wc-diagram': {
|
|
688
|
+
importPath: `${distDirectory}/diagram.js`,
|
|
689
|
+
},
|
|
690
|
+
// Deprecated alias of wc-diagram, until 5.0.
|
|
687
691
|
'wc-flow': {
|
|
688
692
|
importPath: `${distDirectory}/flow.js`,
|
|
689
693
|
},
|
|
694
|
+
'wc-workflow': {
|
|
695
|
+
importPath: `${distDirectory}/workflow.js`,
|
|
696
|
+
},
|
|
697
|
+
'wc-tree-chart': {
|
|
698
|
+
importPath: `${distDirectory}/tree-chart.js`,
|
|
699
|
+
},
|
|
700
|
+
'wc-dependency-map': {
|
|
701
|
+
importPath: `${distDirectory}/dependency-map.js`,
|
|
702
|
+
},
|
|
703
|
+
'wc-erd': {
|
|
704
|
+
importPath: `${distDirectory}/erd.js`,
|
|
705
|
+
},
|
|
706
|
+
'wc-workflow-timeline': {
|
|
707
|
+
importPath: `${distDirectory}/workflow-timeline.js`,
|
|
708
|
+
},
|
|
709
|
+
'wc-diagram-controls': {
|
|
710
|
+
importPath: `${distDirectory}/diagram-controls.js`,
|
|
711
|
+
},
|
|
712
|
+
'wc-diagram-minimap': {
|
|
713
|
+
importPath: `${distDirectory}/diagram-minimap.js`,
|
|
714
|
+
},
|
|
690
715
|
'wc-chart-doughnut': {
|
|
691
716
|
importPath: `${distDirectory}/chart-doughnut.js`,
|
|
692
717
|
},
|
|
@@ -25,6 +25,8 @@
|
|
|
25
25
|
align-items: flex-start;
|
|
26
26
|
--field-height: auto;
|
|
27
27
|
--field-padding-block: var(--spacing-100);
|
|
28
|
+
// The outlined label rests on the first line, not in the middle of a tall box.
|
|
29
|
+
--field-label-rest-top: calc(var(--spacing-100) + var(--typography-body-large-line-height) / 2);
|
|
28
30
|
}
|
|
29
31
|
|
|
30
32
|
.control {
|
|
@@ -134,6 +134,7 @@ export class MenuItem extends mixinBaseButton(
|
|
|
134
134
|
this.renderRoot.querySelector<LitElement>('wc-item')?.requestUpdate();
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
+
/** The item's tab index, managed by the parent menu's roving focus and applied to the inner control. */
|
|
137
138
|
override get tabIndex() {
|
|
138
139
|
return this._rovingTabIndex;
|
|
139
140
|
}
|
|
@@ -46,15 +46,19 @@ export class NumberField extends BaseField {
|
|
|
46
46
|
@property({ type: Number })
|
|
47
47
|
value?: number;
|
|
48
48
|
|
|
49
|
+
/** The largest value allowed. */
|
|
49
50
|
@property({ type: Number })
|
|
50
51
|
max?: number;
|
|
51
52
|
|
|
53
|
+
/** The smallest value allowed. */
|
|
52
54
|
@property({ type: Number })
|
|
53
55
|
min?: number;
|
|
54
56
|
|
|
57
|
+
/** How much the value changes per step, and the granularity a valid value must match. */
|
|
55
58
|
@property({ type: Number })
|
|
56
59
|
step?: number;
|
|
57
60
|
|
|
61
|
+
/** Whether the browser may autofill the field: `"on"` or `"off"` (default). */
|
|
58
62
|
@property({ type: String })
|
|
59
63
|
autocomplete: 'on' | 'off' = 'off';
|
|
60
64
|
|
|
@@ -15,6 +15,7 @@ export class BaseProgress extends mixinDelegatesAria(LitElement) {
|
|
|
15
15
|
/** The value at which the task is complete. Defaults to `100`. */
|
|
16
16
|
@property({ type: Number }) max = 100;
|
|
17
17
|
|
|
18
|
+
/** Shows ongoing activity with no known completion, ignoring `value`. */
|
|
18
19
|
@property({ type: Boolean }) indeterminate = false;
|
|
19
20
|
|
|
20
21
|
/**
|
|
@@ -23,8 +24,10 @@ export class BaseProgress extends mixinDelegatesAria(LitElement) {
|
|
|
23
24
|
*/
|
|
24
25
|
@property({ type: String }) label?: string;
|
|
25
26
|
|
|
27
|
+
/** Help text shown below the progress indicator. */
|
|
26
28
|
@property({ type: String, attribute: 'helper-text' }) helperText?: string;
|
|
27
29
|
|
|
30
|
+
/** Lays out the label and the indicator on one line instead of stacking them. */
|
|
28
31
|
@property({ type: Boolean }) inline = false;
|
|
29
32
|
|
|
30
33
|
/** Peacock's strings, for the fallback accessible name. */
|
package/src/radio/radio-group.ts
CHANGED
|
@@ -94,6 +94,7 @@ export class RadioGroup extends LitElement {
|
|
|
94
94
|
@property({ type: Boolean, reflect: true })
|
|
95
95
|
error = false;
|
|
96
96
|
|
|
97
|
+
/** Error message shown below the group while `error` is set; replaces the help text. */
|
|
97
98
|
@property({ type: String, attribute: 'error-text' })
|
|
98
99
|
errorText = '';
|
|
99
100
|
|
package/src/radio/radio.ts
CHANGED
|
@@ -217,7 +217,6 @@ export class Radio extends ToggleBase {
|
|
|
217
217
|
class="container"
|
|
218
218
|
role="radio"
|
|
219
219
|
aria-checked=${String(this.checked)}
|
|
220
|
-
@click=${this.clickHandler}
|
|
221
220
|
@mousedown=${this.handleMouseDown}
|
|
222
221
|
@keydown=${this.keyDownHandler}
|
|
223
222
|
@focus=${this.handleFocusChange}
|
|
@@ -237,6 +236,7 @@ export class Radio extends ToggleBase {
|
|
|
237
236
|
aria-hidden="true"
|
|
238
237
|
?disabled=${this.disabled}
|
|
239
238
|
tabindex="-1"
|
|
239
|
+
@click=${this.clickHandler}
|
|
240
240
|
/>
|
|
241
241
|
|
|
242
242
|
${this.renderLabel()}
|
package/src/rating/rating.ts
CHANGED
|
@@ -100,6 +100,7 @@ export class Rating extends BaseInput {
|
|
|
100
100
|
@property({ type: Boolean, reflect: true })
|
|
101
101
|
error = false;
|
|
102
102
|
|
|
103
|
+
/** Error message shown below the rating while `error` is set; replaces the help text. */
|
|
103
104
|
@property({ type: String, attribute: 'error-text' })
|
|
104
105
|
errorText = '';
|
|
105
106
|
|
package/src/ripple/ripple.ts
CHANGED
|
@@ -226,6 +226,7 @@ export class Ripple extends LitElement implements Attachable {
|
|
|
226
226
|
/** Bound reference to `handleEvent` passed to `addEventListener` / `removeEventListener`. */
|
|
227
227
|
private readonly _boundHandleEvent = this.handleEvent.bind(this);
|
|
228
228
|
|
|
229
|
+
/** The id of the control the ripple attaches to, as the `for` attribute. */
|
|
229
230
|
get htmlFor() {
|
|
230
231
|
return this.attachableController.htmlFor;
|
|
231
232
|
}
|
|
@@ -234,6 +235,7 @@ export class Ripple extends LitElement implements Attachable {
|
|
|
234
235
|
this.attachableController.htmlFor = htmlFor;
|
|
235
236
|
}
|
|
236
237
|
|
|
238
|
+
/** The control whose presses show the ripple; without `for` or this, it follows its parent. */
|
|
237
239
|
get control() {
|
|
238
240
|
return this.attachableController.control;
|
|
239
241
|
}
|
|
@@ -157,6 +157,7 @@ export class SignaturePad extends BaseInput {
|
|
|
157
157
|
@property({ type: Boolean, reflect: true })
|
|
158
158
|
error = false;
|
|
159
159
|
|
|
160
|
+
/** Error message shown below the pad while `error` is set; replaces the help text. */
|
|
160
161
|
@property({ type: String, attribute: 'error-text' })
|
|
161
162
|
errorText = '';
|
|
162
163
|
|
package/src/slider/slider.ts
CHANGED
|
@@ -92,6 +92,7 @@ export class Slider extends BaseInput {
|
|
|
92
92
|
/** Shows the slider in its error state with `error-text`. */
|
|
93
93
|
@property({ type: Boolean, reflect: true }) error = false;
|
|
94
94
|
|
|
95
|
+
/** Error message shown below the slider while `error` is set; replaces the help text. */
|
|
95
96
|
@property({ type: String, attribute: 'error-text' }) errorText = '';
|
|
96
97
|
|
|
97
98
|
/** Size of the track and thumb: `sm` (default), `md` or `lg`. */
|
package/src/switch/switch.ts
CHANGED
|
@@ -51,6 +51,7 @@ export class Switch extends ToggleBase {
|
|
|
51
51
|
@property({ type: Boolean })
|
|
52
52
|
rounded: boolean = true;
|
|
53
53
|
|
|
54
|
+
/** Shows a check icon in the handle when on and a close icon when off. */
|
|
54
55
|
@property({ type: Boolean, reflect: true, attribute: 'with-icon' })
|
|
55
56
|
withIcon: boolean = false;
|
|
56
57
|
|
package/src/tabs/tab.ts
CHANGED
|
@@ -61,6 +61,7 @@ export class Tab extends LitElement {
|
|
|
61
61
|
/** Whether this is the chosen tab. Reflects to `aria-selected` (or `aria-current` on a link tab). */
|
|
62
62
|
@property({ type: Boolean, reflect: true }) selected = false;
|
|
63
63
|
|
|
64
|
+
/** Disables the tab: it can't be selected. */
|
|
64
65
|
@property({ type: Boolean, reflect: true }) disabled = false;
|
|
65
66
|
|
|
66
67
|
/** Why the tab is disabled; read to screen reader users. */
|
|
@@ -79,6 +80,7 @@ export class Tab extends LitElement {
|
|
|
79
80
|
*/
|
|
80
81
|
@property() target: string = '_self';
|
|
81
82
|
|
|
83
|
+
/** The URL to link to. When set, the tab renders as a link for page navigation. */
|
|
82
84
|
@property({ type: String, reflect: true }) href?: string;
|
|
83
85
|
|
|
84
86
|
/**
|
package/src/tabs/tabs.ts
CHANGED
|
@@ -50,6 +50,7 @@ export class Tabs extends LitElement {
|
|
|
50
50
|
|
|
51
51
|
// ── Properties
|
|
52
52
|
|
|
53
|
+
/** The visual style of the tabs: `"primary"` (default), `"secondary"`, `"contained"` or `"filled"`. */
|
|
53
54
|
@property({ reflect: true })
|
|
54
55
|
variant: 'primary' | 'secondary' | 'contained' | 'filled' = 'primary';
|
|
55
56
|
|
|
@@ -20,6 +20,8 @@
|
|
|
20
20
|
align-items: flex-start;
|
|
21
21
|
--field-height: auto;
|
|
22
22
|
--field-padding-block: var(--spacing-100);
|
|
23
|
+
// The outlined label rests on the first line, not in the middle of a tall box.
|
|
24
|
+
--field-label-rest-top: calc(var(--spacing-100) + var(--typography-body-large-line-height) / 2);
|
|
23
25
|
|
|
24
26
|
.input {
|
|
25
27
|
flex: 1;
|
package/src/textarea/textarea.ts
CHANGED
|
@@ -54,6 +54,7 @@ export class Textarea extends BaseField {
|
|
|
54
54
|
@property({ type: String })
|
|
55
55
|
value = '';
|
|
56
56
|
|
|
57
|
+
/** Whether the browser may autofill the field: `"on"` or `"off"` (default). */
|
|
57
58
|
@property({ type: String }) autocomplete: 'on' | 'off' = 'off';
|
|
58
59
|
|
|
59
60
|
/** Visible lines of text; the starting height with `auto-grow`. */
|
|
@@ -83,8 +83,10 @@ export class TimePicker extends LitElement {
|
|
|
83
83
|
/** BCP 47 locale for AM/PM names and the default hour cycle. */
|
|
84
84
|
@property({ type: String }) locale = '';
|
|
85
85
|
|
|
86
|
+
/** Disables the picker: no time can be focused or picked. */
|
|
86
87
|
@property({ type: Boolean, reflect: true }) disabled = false;
|
|
87
88
|
|
|
89
|
+
/** Shows the selected time but stops the user changing it. */
|
|
88
90
|
@property({ type: Boolean, reflect: true }) readonly = false;
|
|
89
91
|
|
|
90
92
|
// ── State ────────────────────────────────────────────────────────────────
|
|
@@ -127,6 +127,7 @@ export class TransferList extends BaseInput {
|
|
|
127
127
|
@property({ type: Boolean, reflect: true })
|
|
128
128
|
error = false;
|
|
129
129
|
|
|
130
|
+
/** Error message shown below the component while `error` is set; replaces the help text. */
|
|
130
131
|
@property({ type: String, attribute: 'error-text' })
|
|
131
132
|
errorText = '';
|
|
132
133
|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { TreeChart } from './tree-chart.js';
|
|
2
|
+
export type {
|
|
3
|
+
TreeChartAccent,
|
|
4
|
+
TreeChartAddDetail,
|
|
5
|
+
TreeChartChangeDetail,
|
|
6
|
+
TreeChartChangeReason,
|
|
7
|
+
TreeChartDeleteDetail,
|
|
8
|
+
TreeChartItem,
|
|
9
|
+
TreeChartItemDetail,
|
|
10
|
+
TreeChartOrientation,
|
|
11
|
+
TreeChartReparentDetail,
|
|
12
|
+
TreeChartViewportDetail,
|
|
13
|
+
} from './tree-chart.js';
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { hierarchy, tree } from 'd3';
|
|
2
|
+
import type { DiagramPoint, DiagramSize } from '@/__internal/diagram/types.js';
|
|
3
|
+
|
|
4
|
+
/** A node to lay out: its size and the ids of its visible children. */
|
|
5
|
+
export interface LayoutInput {
|
|
6
|
+
id: string;
|
|
7
|
+
children: string[];
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface LayoutOptions {
|
|
11
|
+
orientation: 'vertical' | 'horizontal';
|
|
12
|
+
/** Stack children that are all leaves in a column under their parent (vertical only). */
|
|
13
|
+
compact: boolean;
|
|
14
|
+
/** Space between siblings, in canvas pixels. */
|
|
15
|
+
siblingGap: number;
|
|
16
|
+
/** Space between levels. */
|
|
17
|
+
levelGap: number;
|
|
18
|
+
/** Space between the cards of a compact stack. */
|
|
19
|
+
stackGap: number;
|
|
20
|
+
/** Indent of a compact stack from its connector lane. */
|
|
21
|
+
stackIndent: number;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface LayoutResult {
|
|
25
|
+
/** Top-left corner of each laid-out node. */
|
|
26
|
+
positions: Map<string, DiagramPoint>;
|
|
27
|
+
/** Parents whose children are drawn as a compact stack. */
|
|
28
|
+
stacked: Set<string>;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* The corner points of the connector from a parent box to a child box: down to a fork halfway
|
|
33
|
+
* across the level gap, across, and down into the child. For a compact stack, across to a lane on
|
|
34
|
+
* the stack's left and into the child's side.
|
|
35
|
+
*/
|
|
36
|
+
export function linkPoints(
|
|
37
|
+
parent: { x: number; y: number; width: number; height: number },
|
|
38
|
+
child: { x: number; y: number; width: number; height: number },
|
|
39
|
+
options: Pick<LayoutOptions, 'orientation' | 'levelGap' | 'stackIndent'> & {
|
|
40
|
+
stacked: boolean;
|
|
41
|
+
},
|
|
42
|
+
): DiagramPoint[] {
|
|
43
|
+
if (options.orientation === 'horizontal') {
|
|
44
|
+
const start = {
|
|
45
|
+
x: parent.x + parent.width,
|
|
46
|
+
y: parent.y + parent.height / 2,
|
|
47
|
+
};
|
|
48
|
+
const end = { x: child.x, y: child.y + child.height / 2 };
|
|
49
|
+
const fork = start.x + options.levelGap / 2;
|
|
50
|
+
return [start, { x: fork, y: start.y }, { x: fork, y: end.y }, end];
|
|
51
|
+
}
|
|
52
|
+
const start = { x: parent.x + parent.width / 2, y: parent.y + parent.height };
|
|
53
|
+
const fork = start.y + options.levelGap / 2;
|
|
54
|
+
if (options.stacked) {
|
|
55
|
+
const lane = child.x - options.stackIndent;
|
|
56
|
+
const mid = child.y + child.height / 2;
|
|
57
|
+
return [
|
|
58
|
+
start,
|
|
59
|
+
{ x: start.x, y: fork },
|
|
60
|
+
{ x: lane, y: fork },
|
|
61
|
+
{ x: lane, y: mid },
|
|
62
|
+
{ x: child.x, y: mid },
|
|
63
|
+
];
|
|
64
|
+
}
|
|
65
|
+
const end = { x: child.x + child.width / 2, y: child.y };
|
|
66
|
+
return [start, { x: start.x, y: fork }, { x: end.x, y: fork }, end];
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
interface Box {
|
|
70
|
+
id: string;
|
|
71
|
+
/** Width across the tree (breadth) and along it (depth). */
|
|
72
|
+
breadth: number;
|
|
73
|
+
depth: number;
|
|
74
|
+
/** For a compact stack: the leaves inside, top to bottom. */
|
|
75
|
+
stack?: string[];
|
|
76
|
+
children: Box[];
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const VIRTUAL_ROOT = '\u0000root';
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Lays out a forest as tidy trees (d3's Buchheim algorithm) with each node's real size. Roots sit
|
|
83
|
+
* side by side. With `compact`, a parent whose visible children are all leaves gets them as one
|
|
84
|
+
* column, which keeps wide teams narrow.
|
|
85
|
+
*/
|
|
86
|
+
export function layoutTree(
|
|
87
|
+
roots: string[],
|
|
88
|
+
nodes: Map<string, LayoutInput>,
|
|
89
|
+
size: (id: string) => DiagramSize,
|
|
90
|
+
options: LayoutOptions,
|
|
91
|
+
): LayoutResult {
|
|
92
|
+
const vertical = options.orientation === 'vertical';
|
|
93
|
+
const breadthOf = (s: DiagramSize) => (vertical ? s.width : s.height);
|
|
94
|
+
const depthOf = (s: DiagramSize) => (vertical ? s.height : s.width);
|
|
95
|
+
const stacked = new Set<string>();
|
|
96
|
+
|
|
97
|
+
const build = (id: string): Box => {
|
|
98
|
+
const s = size(id);
|
|
99
|
+
const kids = nodes.get(id)?.children ?? [];
|
|
100
|
+
const allLeaves =
|
|
101
|
+
kids.length > 1 &&
|
|
102
|
+
kids.every(k => (nodes.get(k)?.children.length ?? 0) === 0);
|
|
103
|
+
if (vertical && options.compact && allLeaves) {
|
|
104
|
+
stacked.add(id);
|
|
105
|
+
const widths = kids.map(k => size(k).width);
|
|
106
|
+
const heights = kids.map(k => size(k).height);
|
|
107
|
+
const stackBox: Box = {
|
|
108
|
+
id: `${id}\u0000stack`,
|
|
109
|
+
breadth: Math.max(...widths) + options.stackIndent * 2,
|
|
110
|
+
depth:
|
|
111
|
+
heights.reduce((a, b) => a + b, 0) +
|
|
112
|
+
options.stackGap * (kids.length - 1),
|
|
113
|
+
stack: kids,
|
|
114
|
+
children: [],
|
|
115
|
+
};
|
|
116
|
+
return {
|
|
117
|
+
id,
|
|
118
|
+
breadth: breadthOf(s),
|
|
119
|
+
depth: depthOf(s),
|
|
120
|
+
children: [stackBox],
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
return {
|
|
124
|
+
id,
|
|
125
|
+
breadth: breadthOf(s),
|
|
126
|
+
depth: depthOf(s),
|
|
127
|
+
children: kids.map(build),
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
const forest: Box = {
|
|
132
|
+
id: VIRTUAL_ROOT,
|
|
133
|
+
breadth: 0,
|
|
134
|
+
depth: 0,
|
|
135
|
+
children: roots.map(build),
|
|
136
|
+
};
|
|
137
|
+
const root = hierarchy(forest, b => b.children);
|
|
138
|
+
|
|
139
|
+
// Depth extent per level, so levels line up even when cards differ in height. A compact stack
|
|
140
|
+
// has nothing below it, so its height does not push deeper levels down.
|
|
141
|
+
const levelDepth: number[] = [];
|
|
142
|
+
root.each(n => {
|
|
143
|
+
const extent = n.data.stack ? 0 : n.data.depth;
|
|
144
|
+
levelDepth[n.depth] = Math.max(levelDepth[n.depth] ?? 0, extent);
|
|
145
|
+
});
|
|
146
|
+
const levelStart: number[] = [];
|
|
147
|
+
let cursor = 0;
|
|
148
|
+
levelDepth.forEach((d, i) => {
|
|
149
|
+
levelStart[i] = cursor;
|
|
150
|
+
cursor += d + (i === 0 ? 0 : options.levelGap);
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
tree<Box>()
|
|
154
|
+
.nodeSize([1, 1])
|
|
155
|
+
.separation(
|
|
156
|
+
(a, b) =>
|
|
157
|
+
(a.data.breadth + b.data.breadth) / 2 +
|
|
158
|
+
options.siblingGap * (a.parent === b.parent ? 1 : 1.5),
|
|
159
|
+
)(root);
|
|
160
|
+
|
|
161
|
+
const positions = new Map<string, DiagramPoint>();
|
|
162
|
+
root.each(node => {
|
|
163
|
+
const n = node as typeof node & { x: number };
|
|
164
|
+
if (n.data.id === VIRTUAL_ROOT) return;
|
|
165
|
+
const start = levelStart[n.depth];
|
|
166
|
+
const center = n.x;
|
|
167
|
+
if (n.data.stack) {
|
|
168
|
+
// A compact stack: one column with its lane on the left, starting at this level.
|
|
169
|
+
const left = center - n.data.breadth / 2 + options.stackIndent * 2;
|
|
170
|
+
let y = start;
|
|
171
|
+
for (const leaf of n.data.stack) {
|
|
172
|
+
positions.set(leaf, { x: left, y });
|
|
173
|
+
y += size(leaf).height + options.stackGap;
|
|
174
|
+
}
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
const b = center - breadthOf(size(n.data.id)) / 2;
|
|
178
|
+
positions.set(
|
|
179
|
+
n.data.id,
|
|
180
|
+
vertical ? { x: b, y: start } : { x: start, y: b },
|
|
181
|
+
);
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
return { positions, stacked };
|
|
185
|
+
}
|