@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
|
@@ -0,0 +1,1390 @@
|
|
|
1
|
+
import { t as timer, f as dispatch } from './transform-CxeQFXXB.js';
|
|
2
|
+
|
|
3
|
+
function tree_add(d) {
|
|
4
|
+
const x = +this._x.call(null, d),
|
|
5
|
+
y = +this._y.call(null, d);
|
|
6
|
+
return add(this.cover(x, y), x, y, d);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
function add(tree, x, y, d) {
|
|
10
|
+
if (isNaN(x) || isNaN(y)) return tree; // ignore invalid points
|
|
11
|
+
|
|
12
|
+
var parent,
|
|
13
|
+
node = tree._root,
|
|
14
|
+
leaf = {data: d},
|
|
15
|
+
x0 = tree._x0,
|
|
16
|
+
y0 = tree._y0,
|
|
17
|
+
x1 = tree._x1,
|
|
18
|
+
y1 = tree._y1,
|
|
19
|
+
xm,
|
|
20
|
+
ym,
|
|
21
|
+
xp,
|
|
22
|
+
yp,
|
|
23
|
+
right,
|
|
24
|
+
bottom,
|
|
25
|
+
i,
|
|
26
|
+
j;
|
|
27
|
+
|
|
28
|
+
// If the tree is empty, initialize the root as a leaf.
|
|
29
|
+
if (!node) return tree._root = leaf, tree;
|
|
30
|
+
|
|
31
|
+
// Find the existing leaf for the new point, or add it.
|
|
32
|
+
while (node.length) {
|
|
33
|
+
if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm; else x1 = xm;
|
|
34
|
+
if (bottom = y >= (ym = (y0 + y1) / 2)) y0 = ym; else y1 = ym;
|
|
35
|
+
if (parent = node, !(node = node[i = bottom << 1 | right])) return parent[i] = leaf, tree;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Is the new point is exactly coincident with the existing point?
|
|
39
|
+
xp = +tree._x.call(null, node.data);
|
|
40
|
+
yp = +tree._y.call(null, node.data);
|
|
41
|
+
if (x === xp && y === yp) return leaf.next = node, parent ? parent[i] = leaf : tree._root = leaf, tree;
|
|
42
|
+
|
|
43
|
+
// Otherwise, split the leaf node until the old and new point are separated.
|
|
44
|
+
do {
|
|
45
|
+
parent = parent ? parent[i] = new Array(4) : tree._root = new Array(4);
|
|
46
|
+
if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm; else x1 = xm;
|
|
47
|
+
if (bottom = y >= (ym = (y0 + y1) / 2)) y0 = ym; else y1 = ym;
|
|
48
|
+
} while ((i = bottom << 1 | right) === (j = (yp >= ym) << 1 | (xp >= xm)));
|
|
49
|
+
return parent[j] = node, parent[i] = leaf, tree;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function addAll(data) {
|
|
53
|
+
var d, i, n = data.length,
|
|
54
|
+
x,
|
|
55
|
+
y,
|
|
56
|
+
xz = new Array(n),
|
|
57
|
+
yz = new Array(n),
|
|
58
|
+
x0 = Infinity,
|
|
59
|
+
y0 = Infinity,
|
|
60
|
+
x1 = -Infinity,
|
|
61
|
+
y1 = -Infinity;
|
|
62
|
+
|
|
63
|
+
// Compute the points and their extent.
|
|
64
|
+
for (i = 0; i < n; ++i) {
|
|
65
|
+
if (isNaN(x = +this._x.call(null, d = data[i])) || isNaN(y = +this._y.call(null, d))) continue;
|
|
66
|
+
xz[i] = x;
|
|
67
|
+
yz[i] = y;
|
|
68
|
+
if (x < x0) x0 = x;
|
|
69
|
+
if (x > x1) x1 = x;
|
|
70
|
+
if (y < y0) y0 = y;
|
|
71
|
+
if (y > y1) y1 = y;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// If there were no (valid) points, abort.
|
|
75
|
+
if (x0 > x1 || y0 > y1) return this;
|
|
76
|
+
|
|
77
|
+
// Expand the tree to cover the new points.
|
|
78
|
+
this.cover(x0, y0).cover(x1, y1);
|
|
79
|
+
|
|
80
|
+
// Add the new points.
|
|
81
|
+
for (i = 0; i < n; ++i) {
|
|
82
|
+
add(this, xz[i], yz[i], data[i]);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return this;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function tree_cover(x, y) {
|
|
89
|
+
if (isNaN(x = +x) || isNaN(y = +y)) return this; // ignore invalid points
|
|
90
|
+
|
|
91
|
+
var x0 = this._x0,
|
|
92
|
+
y0 = this._y0,
|
|
93
|
+
x1 = this._x1,
|
|
94
|
+
y1 = this._y1;
|
|
95
|
+
|
|
96
|
+
// If the quadtree has no extent, initialize them.
|
|
97
|
+
// Integer extent are necessary so that if we later double the extent,
|
|
98
|
+
// the existing quadrant boundaries don’t change due to floating point error!
|
|
99
|
+
if (isNaN(x0)) {
|
|
100
|
+
x1 = (x0 = Math.floor(x)) + 1;
|
|
101
|
+
y1 = (y0 = Math.floor(y)) + 1;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// Otherwise, double repeatedly to cover.
|
|
105
|
+
else {
|
|
106
|
+
var z = x1 - x0 || 1,
|
|
107
|
+
node = this._root,
|
|
108
|
+
parent,
|
|
109
|
+
i;
|
|
110
|
+
|
|
111
|
+
while (x0 > x || x >= x1 || y0 > y || y >= y1) {
|
|
112
|
+
i = (y < y0) << 1 | (x < x0);
|
|
113
|
+
parent = new Array(4), parent[i] = node, node = parent, z *= 2;
|
|
114
|
+
switch (i) {
|
|
115
|
+
case 0: x1 = x0 + z, y1 = y0 + z; break;
|
|
116
|
+
case 1: x0 = x1 - z, y1 = y0 + z; break;
|
|
117
|
+
case 2: x1 = x0 + z, y0 = y1 - z; break;
|
|
118
|
+
case 3: x0 = x1 - z, y0 = y1 - z; break;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if (this._root && this._root.length) this._root = node;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
this._x0 = x0;
|
|
126
|
+
this._y0 = y0;
|
|
127
|
+
this._x1 = x1;
|
|
128
|
+
this._y1 = y1;
|
|
129
|
+
return this;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function tree_data() {
|
|
133
|
+
var data = [];
|
|
134
|
+
this.visit(function(node) {
|
|
135
|
+
if (!node.length) do data.push(node.data); while (node = node.next)
|
|
136
|
+
});
|
|
137
|
+
return data;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function tree_extent(_) {
|
|
141
|
+
return arguments.length
|
|
142
|
+
? this.cover(+_[0][0], +_[0][1]).cover(+_[1][0], +_[1][1])
|
|
143
|
+
: isNaN(this._x0) ? undefined : [[this._x0, this._y0], [this._x1, this._y1]];
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function Quad(node, x0, y0, x1, y1) {
|
|
147
|
+
this.node = node;
|
|
148
|
+
this.x0 = x0;
|
|
149
|
+
this.y0 = y0;
|
|
150
|
+
this.x1 = x1;
|
|
151
|
+
this.y1 = y1;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function tree_find(x, y, radius) {
|
|
155
|
+
var data,
|
|
156
|
+
x0 = this._x0,
|
|
157
|
+
y0 = this._y0,
|
|
158
|
+
x1,
|
|
159
|
+
y1,
|
|
160
|
+
x2,
|
|
161
|
+
y2,
|
|
162
|
+
x3 = this._x1,
|
|
163
|
+
y3 = this._y1,
|
|
164
|
+
quads = [],
|
|
165
|
+
node = this._root,
|
|
166
|
+
q,
|
|
167
|
+
i;
|
|
168
|
+
|
|
169
|
+
if (node) quads.push(new Quad(node, x0, y0, x3, y3));
|
|
170
|
+
if (radius == null) radius = Infinity;
|
|
171
|
+
else {
|
|
172
|
+
x0 = x - radius, y0 = y - radius;
|
|
173
|
+
x3 = x + radius, y3 = y + radius;
|
|
174
|
+
radius *= radius;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
while (q = quads.pop()) {
|
|
178
|
+
|
|
179
|
+
// Stop searching if this quadrant can’t contain a closer node.
|
|
180
|
+
if (!(node = q.node)
|
|
181
|
+
|| (x1 = q.x0) > x3
|
|
182
|
+
|| (y1 = q.y0) > y3
|
|
183
|
+
|| (x2 = q.x1) < x0
|
|
184
|
+
|| (y2 = q.y1) < y0) continue;
|
|
185
|
+
|
|
186
|
+
// Bisect the current quadrant.
|
|
187
|
+
if (node.length) {
|
|
188
|
+
var xm = (x1 + x2) / 2,
|
|
189
|
+
ym = (y1 + y2) / 2;
|
|
190
|
+
|
|
191
|
+
quads.push(
|
|
192
|
+
new Quad(node[3], xm, ym, x2, y2),
|
|
193
|
+
new Quad(node[2], x1, ym, xm, y2),
|
|
194
|
+
new Quad(node[1], xm, y1, x2, ym),
|
|
195
|
+
new Quad(node[0], x1, y1, xm, ym)
|
|
196
|
+
);
|
|
197
|
+
|
|
198
|
+
// Visit the closest quadrant first.
|
|
199
|
+
if (i = (y >= ym) << 1 | (x >= xm)) {
|
|
200
|
+
q = quads[quads.length - 1];
|
|
201
|
+
quads[quads.length - 1] = quads[quads.length - 1 - i];
|
|
202
|
+
quads[quads.length - 1 - i] = q;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// Visit this point. (Visiting coincident points isn’t necessary!)
|
|
207
|
+
else {
|
|
208
|
+
var dx = x - +this._x.call(null, node.data),
|
|
209
|
+
dy = y - +this._y.call(null, node.data),
|
|
210
|
+
d2 = dx * dx + dy * dy;
|
|
211
|
+
if (d2 < radius) {
|
|
212
|
+
var d = Math.sqrt(radius = d2);
|
|
213
|
+
x0 = x - d, y0 = y - d;
|
|
214
|
+
x3 = x + d, y3 = y + d;
|
|
215
|
+
data = node.data;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
return data;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
function tree_remove(d) {
|
|
224
|
+
if (isNaN(x = +this._x.call(null, d)) || isNaN(y = +this._y.call(null, d))) return this; // ignore invalid points
|
|
225
|
+
|
|
226
|
+
var parent,
|
|
227
|
+
node = this._root,
|
|
228
|
+
retainer,
|
|
229
|
+
previous,
|
|
230
|
+
next,
|
|
231
|
+
x0 = this._x0,
|
|
232
|
+
y0 = this._y0,
|
|
233
|
+
x1 = this._x1,
|
|
234
|
+
y1 = this._y1,
|
|
235
|
+
x,
|
|
236
|
+
y,
|
|
237
|
+
xm,
|
|
238
|
+
ym,
|
|
239
|
+
right,
|
|
240
|
+
bottom,
|
|
241
|
+
i,
|
|
242
|
+
j;
|
|
243
|
+
|
|
244
|
+
// If the tree is empty, initialize the root as a leaf.
|
|
245
|
+
if (!node) return this;
|
|
246
|
+
|
|
247
|
+
// Find the leaf node for the point.
|
|
248
|
+
// While descending, also retain the deepest parent with a non-removed sibling.
|
|
249
|
+
if (node.length) while (true) {
|
|
250
|
+
if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm; else x1 = xm;
|
|
251
|
+
if (bottom = y >= (ym = (y0 + y1) / 2)) y0 = ym; else y1 = ym;
|
|
252
|
+
if (!(parent = node, node = node[i = bottom << 1 | right])) return this;
|
|
253
|
+
if (!node.length) break;
|
|
254
|
+
if (parent[(i + 1) & 3] || parent[(i + 2) & 3] || parent[(i + 3) & 3]) retainer = parent, j = i;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
// Find the point to remove.
|
|
258
|
+
while (node.data !== d) if (!(previous = node, node = node.next)) return this;
|
|
259
|
+
if (next = node.next) delete node.next;
|
|
260
|
+
|
|
261
|
+
// If there are multiple coincident points, remove just the point.
|
|
262
|
+
if (previous) return (next ? previous.next = next : delete previous.next), this;
|
|
263
|
+
|
|
264
|
+
// If this is the root point, remove it.
|
|
265
|
+
if (!parent) return this._root = next, this;
|
|
266
|
+
|
|
267
|
+
// Remove this leaf.
|
|
268
|
+
next ? parent[i] = next : delete parent[i];
|
|
269
|
+
|
|
270
|
+
// If the parent now contains exactly one leaf, collapse superfluous parents.
|
|
271
|
+
if ((node = parent[0] || parent[1] || parent[2] || parent[3])
|
|
272
|
+
&& node === (parent[3] || parent[2] || parent[1] || parent[0])
|
|
273
|
+
&& !node.length) {
|
|
274
|
+
if (retainer) retainer[j] = node;
|
|
275
|
+
else this._root = node;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
return this;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
function removeAll(data) {
|
|
282
|
+
for (var i = 0, n = data.length; i < n; ++i) this.remove(data[i]);
|
|
283
|
+
return this;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
function tree_root() {
|
|
287
|
+
return this._root;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
function tree_size() {
|
|
291
|
+
var size = 0;
|
|
292
|
+
this.visit(function(node) {
|
|
293
|
+
if (!node.length) do ++size; while (node = node.next)
|
|
294
|
+
});
|
|
295
|
+
return size;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
function tree_visit(callback) {
|
|
299
|
+
var quads = [], q, node = this._root, child, x0, y0, x1, y1;
|
|
300
|
+
if (node) quads.push(new Quad(node, this._x0, this._y0, this._x1, this._y1));
|
|
301
|
+
while (q = quads.pop()) {
|
|
302
|
+
if (!callback(node = q.node, x0 = q.x0, y0 = q.y0, x1 = q.x1, y1 = q.y1) && node.length) {
|
|
303
|
+
var xm = (x0 + x1) / 2, ym = (y0 + y1) / 2;
|
|
304
|
+
if (child = node[3]) quads.push(new Quad(child, xm, ym, x1, y1));
|
|
305
|
+
if (child = node[2]) quads.push(new Quad(child, x0, ym, xm, y1));
|
|
306
|
+
if (child = node[1]) quads.push(new Quad(child, xm, y0, x1, ym));
|
|
307
|
+
if (child = node[0]) quads.push(new Quad(child, x0, y0, xm, ym));
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
return this;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
function tree_visitAfter(callback) {
|
|
314
|
+
var quads = [], next = [], q;
|
|
315
|
+
if (this._root) quads.push(new Quad(this._root, this._x0, this._y0, this._x1, this._y1));
|
|
316
|
+
while (q = quads.pop()) {
|
|
317
|
+
var node = q.node;
|
|
318
|
+
if (node.length) {
|
|
319
|
+
var child, x0 = q.x0, y0 = q.y0, x1 = q.x1, y1 = q.y1, xm = (x0 + x1) / 2, ym = (y0 + y1) / 2;
|
|
320
|
+
if (child = node[0]) quads.push(new Quad(child, x0, y0, xm, ym));
|
|
321
|
+
if (child = node[1]) quads.push(new Quad(child, xm, y0, x1, ym));
|
|
322
|
+
if (child = node[2]) quads.push(new Quad(child, x0, ym, xm, y1));
|
|
323
|
+
if (child = node[3]) quads.push(new Quad(child, xm, ym, x1, y1));
|
|
324
|
+
}
|
|
325
|
+
next.push(q);
|
|
326
|
+
}
|
|
327
|
+
while (q = next.pop()) {
|
|
328
|
+
callback(q.node, q.x0, q.y0, q.x1, q.y1);
|
|
329
|
+
}
|
|
330
|
+
return this;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
function defaultX(d) {
|
|
334
|
+
return d[0];
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
function tree_x(_) {
|
|
338
|
+
return arguments.length ? (this._x = _, this) : this._x;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
function defaultY(d) {
|
|
342
|
+
return d[1];
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
function tree_y(_) {
|
|
346
|
+
return arguments.length ? (this._y = _, this) : this._y;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
function quadtree(nodes, x, y) {
|
|
350
|
+
var tree = new Quadtree(x == null ? defaultX : x, y == null ? defaultY : y, NaN, NaN, NaN, NaN);
|
|
351
|
+
return nodes == null ? tree : tree.addAll(nodes);
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
function Quadtree(x, y, x0, y0, x1, y1) {
|
|
355
|
+
this._x = x;
|
|
356
|
+
this._y = y;
|
|
357
|
+
this._x0 = x0;
|
|
358
|
+
this._y0 = y0;
|
|
359
|
+
this._x1 = x1;
|
|
360
|
+
this._y1 = y1;
|
|
361
|
+
this._root = undefined;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
function leaf_copy(leaf) {
|
|
365
|
+
var copy = {data: leaf.data}, next = copy;
|
|
366
|
+
while (leaf = leaf.next) next = next.next = {data: leaf.data};
|
|
367
|
+
return copy;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
var treeProto = quadtree.prototype = Quadtree.prototype;
|
|
371
|
+
|
|
372
|
+
treeProto.copy = function() {
|
|
373
|
+
var copy = new Quadtree(this._x, this._y, this._x0, this._y0, this._x1, this._y1),
|
|
374
|
+
node = this._root,
|
|
375
|
+
nodes,
|
|
376
|
+
child;
|
|
377
|
+
|
|
378
|
+
if (!node) return copy;
|
|
379
|
+
|
|
380
|
+
if (!node.length) return copy._root = leaf_copy(node), copy;
|
|
381
|
+
|
|
382
|
+
nodes = [{source: node, target: copy._root = new Array(4)}];
|
|
383
|
+
while (node = nodes.pop()) {
|
|
384
|
+
for (var i = 0; i < 4; ++i) {
|
|
385
|
+
if (child = node.source[i]) {
|
|
386
|
+
if (child.length) nodes.push({source: child, target: node.target[i] = new Array(4)});
|
|
387
|
+
else node.target[i] = leaf_copy(child);
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
return copy;
|
|
393
|
+
};
|
|
394
|
+
|
|
395
|
+
treeProto.add = tree_add;
|
|
396
|
+
treeProto.addAll = addAll;
|
|
397
|
+
treeProto.cover = tree_cover;
|
|
398
|
+
treeProto.data = tree_data;
|
|
399
|
+
treeProto.extent = tree_extent;
|
|
400
|
+
treeProto.find = tree_find;
|
|
401
|
+
treeProto.remove = tree_remove;
|
|
402
|
+
treeProto.removeAll = removeAll;
|
|
403
|
+
treeProto.root = tree_root;
|
|
404
|
+
treeProto.size = tree_size;
|
|
405
|
+
treeProto.visit = tree_visit;
|
|
406
|
+
treeProto.visitAfter = tree_visitAfter;
|
|
407
|
+
treeProto.x = tree_x;
|
|
408
|
+
treeProto.y = tree_y;
|
|
409
|
+
|
|
410
|
+
function constant(x) {
|
|
411
|
+
return function() {
|
|
412
|
+
return x;
|
|
413
|
+
};
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
function jiggle(random) {
|
|
417
|
+
return (random() - 0.5) * 1e-6;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
function x$1(d) {
|
|
421
|
+
return d.x + d.vx;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
function y$1(d) {
|
|
425
|
+
return d.y + d.vy;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
function forceCollide(radius) {
|
|
429
|
+
var nodes,
|
|
430
|
+
radii,
|
|
431
|
+
random,
|
|
432
|
+
strength = 1,
|
|
433
|
+
iterations = 1;
|
|
434
|
+
|
|
435
|
+
if (typeof radius !== "function") radius = constant(radius == null ? 1 : +radius);
|
|
436
|
+
|
|
437
|
+
function force() {
|
|
438
|
+
var i, n = nodes.length,
|
|
439
|
+
tree,
|
|
440
|
+
node,
|
|
441
|
+
xi,
|
|
442
|
+
yi,
|
|
443
|
+
ri,
|
|
444
|
+
ri2;
|
|
445
|
+
|
|
446
|
+
for (var k = 0; k < iterations; ++k) {
|
|
447
|
+
tree = quadtree(nodes, x$1, y$1).visitAfter(prepare);
|
|
448
|
+
for (i = 0; i < n; ++i) {
|
|
449
|
+
node = nodes[i];
|
|
450
|
+
ri = radii[node.index], ri2 = ri * ri;
|
|
451
|
+
xi = node.x + node.vx;
|
|
452
|
+
yi = node.y + node.vy;
|
|
453
|
+
tree.visit(apply);
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
function apply(quad, x0, y0, x1, y1) {
|
|
458
|
+
var data = quad.data, rj = quad.r, r = ri + rj;
|
|
459
|
+
if (data) {
|
|
460
|
+
if (data.index > node.index) {
|
|
461
|
+
var x = xi - data.x - data.vx,
|
|
462
|
+
y = yi - data.y - data.vy,
|
|
463
|
+
l = x * x + y * y;
|
|
464
|
+
if (l < r * r) {
|
|
465
|
+
if (x === 0) x = jiggle(random), l += x * x;
|
|
466
|
+
if (y === 0) y = jiggle(random), l += y * y;
|
|
467
|
+
l = (r - (l = Math.sqrt(l))) / l * strength;
|
|
468
|
+
node.vx += (x *= l) * (r = (rj *= rj) / (ri2 + rj));
|
|
469
|
+
node.vy += (y *= l) * r;
|
|
470
|
+
data.vx -= x * (r = 1 - r);
|
|
471
|
+
data.vy -= y * r;
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
return;
|
|
475
|
+
}
|
|
476
|
+
return x0 > xi + r || x1 < xi - r || y0 > yi + r || y1 < yi - r;
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
function prepare(quad) {
|
|
481
|
+
if (quad.data) return quad.r = radii[quad.data.index];
|
|
482
|
+
for (var i = quad.r = 0; i < 4; ++i) {
|
|
483
|
+
if (quad[i] && quad[i].r > quad.r) {
|
|
484
|
+
quad.r = quad[i].r;
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
function initialize() {
|
|
490
|
+
if (!nodes) return;
|
|
491
|
+
var i, n = nodes.length, node;
|
|
492
|
+
radii = new Array(n);
|
|
493
|
+
for (i = 0; i < n; ++i) node = nodes[i], radii[node.index] = +radius(node, i, nodes);
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
force.initialize = function(_nodes, _random) {
|
|
497
|
+
nodes = _nodes;
|
|
498
|
+
random = _random;
|
|
499
|
+
initialize();
|
|
500
|
+
};
|
|
501
|
+
|
|
502
|
+
force.iterations = function(_) {
|
|
503
|
+
return arguments.length ? (iterations = +_, force) : iterations;
|
|
504
|
+
};
|
|
505
|
+
|
|
506
|
+
force.strength = function(_) {
|
|
507
|
+
return arguments.length ? (strength = +_, force) : strength;
|
|
508
|
+
};
|
|
509
|
+
|
|
510
|
+
force.radius = function(_) {
|
|
511
|
+
return arguments.length ? (radius = typeof _ === "function" ? _ : constant(+_), initialize(), force) : radius;
|
|
512
|
+
};
|
|
513
|
+
|
|
514
|
+
return force;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
function index(d) {
|
|
518
|
+
return d.index;
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
function find(nodeById, nodeId) {
|
|
522
|
+
var node = nodeById.get(nodeId);
|
|
523
|
+
if (!node) throw new Error("node not found: " + nodeId);
|
|
524
|
+
return node;
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
function forceLink(links) {
|
|
528
|
+
var id = index,
|
|
529
|
+
strength = defaultStrength,
|
|
530
|
+
strengths,
|
|
531
|
+
distance = constant(30),
|
|
532
|
+
distances,
|
|
533
|
+
nodes,
|
|
534
|
+
count,
|
|
535
|
+
bias,
|
|
536
|
+
random,
|
|
537
|
+
iterations = 1;
|
|
538
|
+
|
|
539
|
+
if (links == null) links = [];
|
|
540
|
+
|
|
541
|
+
function defaultStrength(link) {
|
|
542
|
+
return 1 / Math.min(count[link.source.index], count[link.target.index]);
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
function force(alpha) {
|
|
546
|
+
for (var k = 0, n = links.length; k < iterations; ++k) {
|
|
547
|
+
for (var i = 0, link, source, target, x, y, l, b; i < n; ++i) {
|
|
548
|
+
link = links[i], source = link.source, target = link.target;
|
|
549
|
+
x = target.x + target.vx - source.x - source.vx || jiggle(random);
|
|
550
|
+
y = target.y + target.vy - source.y - source.vy || jiggle(random);
|
|
551
|
+
l = Math.sqrt(x * x + y * y);
|
|
552
|
+
l = (l - distances[i]) / l * alpha * strengths[i];
|
|
553
|
+
x *= l, y *= l;
|
|
554
|
+
target.vx -= x * (b = bias[i]);
|
|
555
|
+
target.vy -= y * b;
|
|
556
|
+
source.vx += x * (b = 1 - b);
|
|
557
|
+
source.vy += y * b;
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
function initialize() {
|
|
563
|
+
if (!nodes) return;
|
|
564
|
+
|
|
565
|
+
var i,
|
|
566
|
+
n = nodes.length,
|
|
567
|
+
m = links.length,
|
|
568
|
+
nodeById = new Map(nodes.map((d, i) => [id(d, i, nodes), d])),
|
|
569
|
+
link;
|
|
570
|
+
|
|
571
|
+
for (i = 0, count = new Array(n); i < m; ++i) {
|
|
572
|
+
link = links[i], link.index = i;
|
|
573
|
+
if (typeof link.source !== "object") link.source = find(nodeById, link.source);
|
|
574
|
+
if (typeof link.target !== "object") link.target = find(nodeById, link.target);
|
|
575
|
+
count[link.source.index] = (count[link.source.index] || 0) + 1;
|
|
576
|
+
count[link.target.index] = (count[link.target.index] || 0) + 1;
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
for (i = 0, bias = new Array(m); i < m; ++i) {
|
|
580
|
+
link = links[i], bias[i] = count[link.source.index] / (count[link.source.index] + count[link.target.index]);
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
strengths = new Array(m), initializeStrength();
|
|
584
|
+
distances = new Array(m), initializeDistance();
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
function initializeStrength() {
|
|
588
|
+
if (!nodes) return;
|
|
589
|
+
|
|
590
|
+
for (var i = 0, n = links.length; i < n; ++i) {
|
|
591
|
+
strengths[i] = +strength(links[i], i, links);
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
function initializeDistance() {
|
|
596
|
+
if (!nodes) return;
|
|
597
|
+
|
|
598
|
+
for (var i = 0, n = links.length; i < n; ++i) {
|
|
599
|
+
distances[i] = +distance(links[i], i, links);
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
force.initialize = function(_nodes, _random) {
|
|
604
|
+
nodes = _nodes;
|
|
605
|
+
random = _random;
|
|
606
|
+
initialize();
|
|
607
|
+
};
|
|
608
|
+
|
|
609
|
+
force.links = function(_) {
|
|
610
|
+
return arguments.length ? (links = _, initialize(), force) : links;
|
|
611
|
+
};
|
|
612
|
+
|
|
613
|
+
force.id = function(_) {
|
|
614
|
+
return arguments.length ? (id = _, force) : id;
|
|
615
|
+
};
|
|
616
|
+
|
|
617
|
+
force.iterations = function(_) {
|
|
618
|
+
return arguments.length ? (iterations = +_, force) : iterations;
|
|
619
|
+
};
|
|
620
|
+
|
|
621
|
+
force.strength = function(_) {
|
|
622
|
+
return arguments.length ? (strength = typeof _ === "function" ? _ : constant(+_), initializeStrength(), force) : strength;
|
|
623
|
+
};
|
|
624
|
+
|
|
625
|
+
force.distance = function(_) {
|
|
626
|
+
return arguments.length ? (distance = typeof _ === "function" ? _ : constant(+_), initializeDistance(), force) : distance;
|
|
627
|
+
};
|
|
628
|
+
|
|
629
|
+
return force;
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
// https://en.wikipedia.org/wiki/Linear_congruential_generator#Parameters_in_common_use
|
|
633
|
+
const a = 1664525;
|
|
634
|
+
const c = 1013904223;
|
|
635
|
+
const m = 4294967296; // 2^32
|
|
636
|
+
|
|
637
|
+
function lcg() {
|
|
638
|
+
let s = 1;
|
|
639
|
+
return () => (s = (a * s + c) % m) / m;
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
function x(d) {
|
|
643
|
+
return d.x;
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
function y(d) {
|
|
647
|
+
return d.y;
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
var initialRadius = 10,
|
|
651
|
+
initialAngle = Math.PI * (3 - Math.sqrt(5));
|
|
652
|
+
|
|
653
|
+
function forceSimulation(nodes) {
|
|
654
|
+
var simulation,
|
|
655
|
+
alpha = 1,
|
|
656
|
+
alphaMin = 0.001,
|
|
657
|
+
alphaDecay = 1 - Math.pow(alphaMin, 1 / 300),
|
|
658
|
+
alphaTarget = 0,
|
|
659
|
+
velocityDecay = 0.6,
|
|
660
|
+
forces = new Map(),
|
|
661
|
+
stepper = timer(step),
|
|
662
|
+
event = dispatch("tick", "end"),
|
|
663
|
+
random = lcg();
|
|
664
|
+
|
|
665
|
+
if (nodes == null) nodes = [];
|
|
666
|
+
|
|
667
|
+
function step() {
|
|
668
|
+
tick();
|
|
669
|
+
event.call("tick", simulation);
|
|
670
|
+
if (alpha < alphaMin) {
|
|
671
|
+
stepper.stop();
|
|
672
|
+
event.call("end", simulation);
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
function tick(iterations) {
|
|
677
|
+
var i, n = nodes.length, node;
|
|
678
|
+
|
|
679
|
+
if (iterations === undefined) iterations = 1;
|
|
680
|
+
|
|
681
|
+
for (var k = 0; k < iterations; ++k) {
|
|
682
|
+
alpha += (alphaTarget - alpha) * alphaDecay;
|
|
683
|
+
|
|
684
|
+
forces.forEach(function(force) {
|
|
685
|
+
force(alpha);
|
|
686
|
+
});
|
|
687
|
+
|
|
688
|
+
for (i = 0; i < n; ++i) {
|
|
689
|
+
node = nodes[i];
|
|
690
|
+
if (node.fx == null) node.x += node.vx *= velocityDecay;
|
|
691
|
+
else node.x = node.fx, node.vx = 0;
|
|
692
|
+
if (node.fy == null) node.y += node.vy *= velocityDecay;
|
|
693
|
+
else node.y = node.fy, node.vy = 0;
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
return simulation;
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
function initializeNodes() {
|
|
701
|
+
for (var i = 0, n = nodes.length, node; i < n; ++i) {
|
|
702
|
+
node = nodes[i], node.index = i;
|
|
703
|
+
if (node.fx != null) node.x = node.fx;
|
|
704
|
+
if (node.fy != null) node.y = node.fy;
|
|
705
|
+
if (isNaN(node.x) || isNaN(node.y)) {
|
|
706
|
+
var radius = initialRadius * Math.sqrt(0.5 + i), angle = i * initialAngle;
|
|
707
|
+
node.x = radius * Math.cos(angle);
|
|
708
|
+
node.y = radius * Math.sin(angle);
|
|
709
|
+
}
|
|
710
|
+
if (isNaN(node.vx) || isNaN(node.vy)) {
|
|
711
|
+
node.vx = node.vy = 0;
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
function initializeForce(force) {
|
|
717
|
+
if (force.initialize) force.initialize(nodes, random);
|
|
718
|
+
return force;
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
initializeNodes();
|
|
722
|
+
|
|
723
|
+
return simulation = {
|
|
724
|
+
tick: tick,
|
|
725
|
+
|
|
726
|
+
restart: function() {
|
|
727
|
+
return stepper.restart(step), simulation;
|
|
728
|
+
},
|
|
729
|
+
|
|
730
|
+
stop: function() {
|
|
731
|
+
return stepper.stop(), simulation;
|
|
732
|
+
},
|
|
733
|
+
|
|
734
|
+
nodes: function(_) {
|
|
735
|
+
return arguments.length ? (nodes = _, initializeNodes(), forces.forEach(initializeForce), simulation) : nodes;
|
|
736
|
+
},
|
|
737
|
+
|
|
738
|
+
alpha: function(_) {
|
|
739
|
+
return arguments.length ? (alpha = +_, simulation) : alpha;
|
|
740
|
+
},
|
|
741
|
+
|
|
742
|
+
alphaMin: function(_) {
|
|
743
|
+
return arguments.length ? (alphaMin = +_, simulation) : alphaMin;
|
|
744
|
+
},
|
|
745
|
+
|
|
746
|
+
alphaDecay: function(_) {
|
|
747
|
+
return arguments.length ? (alphaDecay = +_, simulation) : +alphaDecay;
|
|
748
|
+
},
|
|
749
|
+
|
|
750
|
+
alphaTarget: function(_) {
|
|
751
|
+
return arguments.length ? (alphaTarget = +_, simulation) : alphaTarget;
|
|
752
|
+
},
|
|
753
|
+
|
|
754
|
+
velocityDecay: function(_) {
|
|
755
|
+
return arguments.length ? (velocityDecay = 1 - _, simulation) : 1 - velocityDecay;
|
|
756
|
+
},
|
|
757
|
+
|
|
758
|
+
randomSource: function(_) {
|
|
759
|
+
return arguments.length ? (random = _, forces.forEach(initializeForce), simulation) : random;
|
|
760
|
+
},
|
|
761
|
+
|
|
762
|
+
force: function(name, _) {
|
|
763
|
+
return arguments.length > 1 ? ((_ == null ? forces.delete(name) : forces.set(name, initializeForce(_))), simulation) : forces.get(name);
|
|
764
|
+
},
|
|
765
|
+
|
|
766
|
+
find: function(x, y, radius) {
|
|
767
|
+
var i = 0,
|
|
768
|
+
n = nodes.length,
|
|
769
|
+
dx,
|
|
770
|
+
dy,
|
|
771
|
+
d2,
|
|
772
|
+
node,
|
|
773
|
+
closest;
|
|
774
|
+
|
|
775
|
+
if (radius == null) radius = Infinity;
|
|
776
|
+
else radius *= radius;
|
|
777
|
+
|
|
778
|
+
for (i = 0; i < n; ++i) {
|
|
779
|
+
node = nodes[i];
|
|
780
|
+
dx = x - node.x;
|
|
781
|
+
dy = y - node.y;
|
|
782
|
+
d2 = dx * dx + dy * dy;
|
|
783
|
+
if (d2 < radius) closest = node, radius = d2;
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
return closest;
|
|
787
|
+
},
|
|
788
|
+
|
|
789
|
+
on: function(name, _) {
|
|
790
|
+
return arguments.length > 1 ? (event.on(name, _), simulation) : event.on(name);
|
|
791
|
+
}
|
|
792
|
+
};
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
function forceManyBody() {
|
|
796
|
+
var nodes,
|
|
797
|
+
node,
|
|
798
|
+
random,
|
|
799
|
+
alpha,
|
|
800
|
+
strength = constant(-30),
|
|
801
|
+
strengths,
|
|
802
|
+
distanceMin2 = 1,
|
|
803
|
+
distanceMax2 = Infinity,
|
|
804
|
+
theta2 = 0.81;
|
|
805
|
+
|
|
806
|
+
function force(_) {
|
|
807
|
+
var i, n = nodes.length, tree = quadtree(nodes, x, y).visitAfter(accumulate);
|
|
808
|
+
for (alpha = _, i = 0; i < n; ++i) node = nodes[i], tree.visit(apply);
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
function initialize() {
|
|
812
|
+
if (!nodes) return;
|
|
813
|
+
var i, n = nodes.length, node;
|
|
814
|
+
strengths = new Array(n);
|
|
815
|
+
for (i = 0; i < n; ++i) node = nodes[i], strengths[node.index] = +strength(node, i, nodes);
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
function accumulate(quad) {
|
|
819
|
+
var strength = 0, q, c, weight = 0, x, y, i;
|
|
820
|
+
|
|
821
|
+
// For internal nodes, accumulate forces from child quadrants.
|
|
822
|
+
if (quad.length) {
|
|
823
|
+
for (x = y = i = 0; i < 4; ++i) {
|
|
824
|
+
if ((q = quad[i]) && (c = Math.abs(q.value))) {
|
|
825
|
+
strength += q.value, weight += c, x += c * q.x, y += c * q.y;
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
quad.x = x / weight;
|
|
829
|
+
quad.y = y / weight;
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
// For leaf nodes, accumulate forces from coincident quadrants.
|
|
833
|
+
else {
|
|
834
|
+
q = quad;
|
|
835
|
+
q.x = q.data.x;
|
|
836
|
+
q.y = q.data.y;
|
|
837
|
+
do strength += strengths[q.data.index];
|
|
838
|
+
while (q = q.next);
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
quad.value = strength;
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
function apply(quad, x1, _, x2) {
|
|
845
|
+
if (!quad.value) return true;
|
|
846
|
+
|
|
847
|
+
var x = quad.x - node.x,
|
|
848
|
+
y = quad.y - node.y,
|
|
849
|
+
w = x2 - x1,
|
|
850
|
+
l = x * x + y * y;
|
|
851
|
+
|
|
852
|
+
// Apply the Barnes-Hut approximation if possible.
|
|
853
|
+
// Limit forces for very close nodes; randomize direction if coincident.
|
|
854
|
+
if (w * w / theta2 < l) {
|
|
855
|
+
if (l < distanceMax2) {
|
|
856
|
+
if (x === 0) x = jiggle(random), l += x * x;
|
|
857
|
+
if (y === 0) y = jiggle(random), l += y * y;
|
|
858
|
+
if (l < distanceMin2) l = Math.sqrt(distanceMin2 * l);
|
|
859
|
+
node.vx += x * quad.value * alpha / l;
|
|
860
|
+
node.vy += y * quad.value * alpha / l;
|
|
861
|
+
}
|
|
862
|
+
return true;
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
// Otherwise, process points directly.
|
|
866
|
+
else if (quad.length || l >= distanceMax2) return;
|
|
867
|
+
|
|
868
|
+
// Limit forces for very close nodes; randomize direction if coincident.
|
|
869
|
+
if (quad.data !== node || quad.next) {
|
|
870
|
+
if (x === 0) x = jiggle(random), l += x * x;
|
|
871
|
+
if (y === 0) y = jiggle(random), l += y * y;
|
|
872
|
+
if (l < distanceMin2) l = Math.sqrt(distanceMin2 * l);
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
do if (quad.data !== node) {
|
|
876
|
+
w = strengths[quad.data.index] * alpha / l;
|
|
877
|
+
node.vx += x * w;
|
|
878
|
+
node.vy += y * w;
|
|
879
|
+
} while (quad = quad.next);
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
force.initialize = function(_nodes, _random) {
|
|
883
|
+
nodes = _nodes;
|
|
884
|
+
random = _random;
|
|
885
|
+
initialize();
|
|
886
|
+
};
|
|
887
|
+
|
|
888
|
+
force.strength = function(_) {
|
|
889
|
+
return arguments.length ? (strength = typeof _ === "function" ? _ : constant(+_), initialize(), force) : strength;
|
|
890
|
+
};
|
|
891
|
+
|
|
892
|
+
force.distanceMin = function(_) {
|
|
893
|
+
return arguments.length ? (distanceMin2 = _ * _, force) : Math.sqrt(distanceMin2);
|
|
894
|
+
};
|
|
895
|
+
|
|
896
|
+
force.distanceMax = function(_) {
|
|
897
|
+
return arguments.length ? (distanceMax2 = _ * _, force) : Math.sqrt(distanceMax2);
|
|
898
|
+
};
|
|
899
|
+
|
|
900
|
+
force.theta = function(_) {
|
|
901
|
+
return arguments.length ? (theta2 = _ * _, force) : Math.sqrt(theta2);
|
|
902
|
+
};
|
|
903
|
+
|
|
904
|
+
return force;
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
function forceX(x) {
|
|
908
|
+
var strength = constant(0.1),
|
|
909
|
+
nodes,
|
|
910
|
+
strengths,
|
|
911
|
+
xz;
|
|
912
|
+
|
|
913
|
+
if (typeof x !== "function") x = constant(x == null ? 0 : +x);
|
|
914
|
+
|
|
915
|
+
function force(alpha) {
|
|
916
|
+
for (var i = 0, n = nodes.length, node; i < n; ++i) {
|
|
917
|
+
node = nodes[i], node.vx += (xz[i] - node.x) * strengths[i] * alpha;
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
function initialize() {
|
|
922
|
+
if (!nodes) return;
|
|
923
|
+
var i, n = nodes.length;
|
|
924
|
+
strengths = new Array(n);
|
|
925
|
+
xz = new Array(n);
|
|
926
|
+
for (i = 0; i < n; ++i) {
|
|
927
|
+
strengths[i] = isNaN(xz[i] = +x(nodes[i], i, nodes)) ? 0 : +strength(nodes[i], i, nodes);
|
|
928
|
+
}
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
force.initialize = function(_) {
|
|
932
|
+
nodes = _;
|
|
933
|
+
initialize();
|
|
934
|
+
};
|
|
935
|
+
|
|
936
|
+
force.strength = function(_) {
|
|
937
|
+
return arguments.length ? (strength = typeof _ === "function" ? _ : constant(+_), initialize(), force) : strength;
|
|
938
|
+
};
|
|
939
|
+
|
|
940
|
+
force.x = function(_) {
|
|
941
|
+
return arguments.length ? (x = typeof _ === "function" ? _ : constant(+_), initialize(), force) : x;
|
|
942
|
+
};
|
|
943
|
+
|
|
944
|
+
return force;
|
|
945
|
+
}
|
|
946
|
+
|
|
947
|
+
function forceY(y) {
|
|
948
|
+
var strength = constant(0.1),
|
|
949
|
+
nodes,
|
|
950
|
+
strengths,
|
|
951
|
+
yz;
|
|
952
|
+
|
|
953
|
+
if (typeof y !== "function") y = constant(y == null ? 0 : +y);
|
|
954
|
+
|
|
955
|
+
function force(alpha) {
|
|
956
|
+
for (var i = 0, n = nodes.length, node; i < n; ++i) {
|
|
957
|
+
node = nodes[i], node.vy += (yz[i] - node.y) * strengths[i] * alpha;
|
|
958
|
+
}
|
|
959
|
+
}
|
|
960
|
+
|
|
961
|
+
function initialize() {
|
|
962
|
+
if (!nodes) return;
|
|
963
|
+
var i, n = nodes.length;
|
|
964
|
+
strengths = new Array(n);
|
|
965
|
+
yz = new Array(n);
|
|
966
|
+
for (i = 0; i < n; ++i) {
|
|
967
|
+
strengths[i] = isNaN(yz[i] = +y(nodes[i], i, nodes)) ? 0 : +strength(nodes[i], i, nodes);
|
|
968
|
+
}
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
force.initialize = function(_) {
|
|
972
|
+
nodes = _;
|
|
973
|
+
initialize();
|
|
974
|
+
};
|
|
975
|
+
|
|
976
|
+
force.strength = function(_) {
|
|
977
|
+
return arguments.length ? (strength = typeof _ === "function" ? _ : constant(+_), initialize(), force) : strength;
|
|
978
|
+
};
|
|
979
|
+
|
|
980
|
+
force.y = function(_) {
|
|
981
|
+
return arguments.length ? (y = typeof _ === "function" ? _ : constant(+_), initialize(), force) : y;
|
|
982
|
+
};
|
|
983
|
+
|
|
984
|
+
return force;
|
|
985
|
+
}
|
|
986
|
+
|
|
987
|
+
/** Room a group box takes around its nodes, matching how the map draws groups. */
|
|
988
|
+
const GROUP_PADDING = { x: 28, top: 44, bottom: 28 };
|
|
989
|
+
/**
|
|
990
|
+
* Moves whole groups (and nodes outside any group) apart until no group box overlaps another
|
|
991
|
+
* group box or a loose node. Groups with a pinned node stay where they are.
|
|
992
|
+
*/
|
|
993
|
+
function separateGroups(result, nodes, options) {
|
|
994
|
+
const clusters = new Map();
|
|
995
|
+
for (const n of nodes) {
|
|
996
|
+
const key = n.group ? `g:${n.group}` : `n:${n.id}`;
|
|
997
|
+
clusters.set(key, [...(clusters.get(key) ?? []), n]);
|
|
998
|
+
}
|
|
999
|
+
if (![...clusters.keys()].some(k => k.startsWith('g:')))
|
|
1000
|
+
return;
|
|
1001
|
+
const gap = 24;
|
|
1002
|
+
const hw = options.nodeWidth / 2;
|
|
1003
|
+
const hh = options.nodeHeight / 2;
|
|
1004
|
+
const items = [...clusters].map(([key, members]) => ({
|
|
1005
|
+
group: key.startsWith('g:'),
|
|
1006
|
+
fixed: members.some(m => m.pinned),
|
|
1007
|
+
members,
|
|
1008
|
+
}));
|
|
1009
|
+
const box = (item) => {
|
|
1010
|
+
const pad = item.group ? GROUP_PADDING : { x: 0, top: 0, bottom: 0 };
|
|
1011
|
+
const ps = item.members.map(m => result.get(m.id) ?? { x: 0, y: 0 });
|
|
1012
|
+
return {
|
|
1013
|
+
x1: Math.min(...ps.map(p => p.x)) - hw - pad.x - gap / 2,
|
|
1014
|
+
x2: Math.max(...ps.map(p => p.x)) + hw + pad.x + gap / 2,
|
|
1015
|
+
y1: Math.min(...ps.map(p => p.y)) - hh - pad.top - gap / 2,
|
|
1016
|
+
y2: Math.max(...ps.map(p => p.y)) + hh + pad.bottom + gap / 2,
|
|
1017
|
+
};
|
|
1018
|
+
};
|
|
1019
|
+
const shift = (item, dx, dy) => {
|
|
1020
|
+
for (const m of item.members) {
|
|
1021
|
+
const p = result.get(m.id);
|
|
1022
|
+
if (p)
|
|
1023
|
+
result.set(m.id, { x: p.x + dx, y: p.y + dy });
|
|
1024
|
+
}
|
|
1025
|
+
};
|
|
1026
|
+
// Pushes one overlapping pair apart along the axis that needs the smaller move.
|
|
1027
|
+
const resolve = (a, b) => {
|
|
1028
|
+
const ba = box(a);
|
|
1029
|
+
const bb = box(b);
|
|
1030
|
+
const ox = Math.min(ba.x2, bb.x2) - Math.max(ba.x1, bb.x1);
|
|
1031
|
+
const oy = Math.min(ba.y2, bb.y2) - Math.max(ba.y1, bb.y1);
|
|
1032
|
+
if (ox <= 0 || oy <= 0)
|
|
1033
|
+
return false;
|
|
1034
|
+
const horizontal = ox < oy;
|
|
1035
|
+
const ca = horizontal ? ba.x1 + ba.x2 : ba.y1 + ba.y2;
|
|
1036
|
+
const cb = horizontal ? bb.x1 + bb.x2 : bb.y1 + bb.y2;
|
|
1037
|
+
const dir = ca <= cb ? -1 : 1;
|
|
1038
|
+
const amount = (horizontal ? ox : oy) + 1;
|
|
1039
|
+
let shareA = 0.5;
|
|
1040
|
+
if (a.fixed)
|
|
1041
|
+
shareA = 0;
|
|
1042
|
+
else if (b.fixed)
|
|
1043
|
+
shareA = 1;
|
|
1044
|
+
const da = dir * amount * shareA;
|
|
1045
|
+
const db = -dir * amount * (1 - shareA);
|
|
1046
|
+
shift(a, horizontal ? da : 0, horizontal ? 0 : da);
|
|
1047
|
+
shift(b, horizontal ? db : 0, horizontal ? 0 : db);
|
|
1048
|
+
return true;
|
|
1049
|
+
};
|
|
1050
|
+
for (let round = 0; round < 60; round += 1) {
|
|
1051
|
+
let moved = false;
|
|
1052
|
+
for (let i = 0; i < items.length; i += 1) {
|
|
1053
|
+
for (let j = i + 1; j < items.length; j += 1) {
|
|
1054
|
+
const a = items[i];
|
|
1055
|
+
const b = items[j];
|
|
1056
|
+
if ((a.group || b.group) && !(a.fixed && b.fixed) && resolve(a, b))
|
|
1057
|
+
moved = true;
|
|
1058
|
+
}
|
|
1059
|
+
}
|
|
1060
|
+
if (!moved)
|
|
1061
|
+
break;
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
/**
|
|
1065
|
+
* An organic layout: connected nodes attract, all nodes repel, nodes of a group drift together.
|
|
1066
|
+
* Starts from `previous` positions when given, so live updates are stable. Deterministic for the
|
|
1067
|
+
* same input (no random start).
|
|
1068
|
+
*/
|
|
1069
|
+
function forceLayout(nodes, edges, options) {
|
|
1070
|
+
const known = options.previous ?? new Map();
|
|
1071
|
+
const sim = nodes.map((n, i) => {
|
|
1072
|
+
const { pinned } = n;
|
|
1073
|
+
const prev = known.get(n.id);
|
|
1074
|
+
const start = pinned ?? prev;
|
|
1075
|
+
// A golden-angle spiral for nodes without a position.
|
|
1076
|
+
const angle = i * 2.399963;
|
|
1077
|
+
const radius = 40 * Math.sqrt(i + 1);
|
|
1078
|
+
return {
|
|
1079
|
+
id: n.id,
|
|
1080
|
+
group: n.group,
|
|
1081
|
+
x: start?.x ?? Math.cos(angle) * radius,
|
|
1082
|
+
y: start?.y ?? Math.sin(angle) * radius,
|
|
1083
|
+
fx: pinned?.x,
|
|
1084
|
+
fy: pinned?.y,
|
|
1085
|
+
};
|
|
1086
|
+
});
|
|
1087
|
+
const byId = new Map(sim.map(n => [n.id, n]));
|
|
1088
|
+
const links = edges
|
|
1089
|
+
.filter(e => byId.has(e.source) && byId.has(e.target) && e.source !== e.target)
|
|
1090
|
+
.map(e => ({ source: e.source, target: e.target }));
|
|
1091
|
+
// Group centres on a ring, so groups settle apart from each other.
|
|
1092
|
+
const groups = [
|
|
1093
|
+
...new Set(nodes.map(n => n.group).filter((g) => !!g)),
|
|
1094
|
+
];
|
|
1095
|
+
const ring = Math.max(260, groups.length * 110);
|
|
1096
|
+
const groupCenter = new Map(groups.map((g, i) => {
|
|
1097
|
+
const a = (i / Math.max(groups.length, 1)) * Math.PI * 2;
|
|
1098
|
+
return [g, { x: Math.cos(a) * ring, y: Math.sin(a) * ring }];
|
|
1099
|
+
}));
|
|
1100
|
+
const spread = Math.hypot(options.nodeWidth, options.nodeHeight);
|
|
1101
|
+
const simulation = forceSimulation(sim)
|
|
1102
|
+
.force('link', forceLink(links)
|
|
1103
|
+
.id(d => d.id)
|
|
1104
|
+
.distance(spread * 1.1)
|
|
1105
|
+
.strength(0.35))
|
|
1106
|
+
.force('charge', forceManyBody().strength(-spread * 4))
|
|
1107
|
+
.force('collide', forceCollide(spread / 2 + 8))
|
|
1108
|
+
.force('x', forceX(d => d.group ? (groupCenter.get(d.group)?.x ?? 0) : 0).strength(d => (d.group ? 0.12 : 0.03)))
|
|
1109
|
+
.force('y', forceY(d => d.group ? (groupCenter.get(d.group)?.y ?? 0) : 0).strength(d => (d.group ? 0.12 : 0.03)))
|
|
1110
|
+
.stop();
|
|
1111
|
+
// Warm starts need fewer ticks.
|
|
1112
|
+
const ticks = known.size ? 120 : 300;
|
|
1113
|
+
simulation.alpha(known.size ? 0.4 : 1);
|
|
1114
|
+
for (let i = 0; i < ticks; i += 1)
|
|
1115
|
+
simulation.tick();
|
|
1116
|
+
const result = new Map(sim.map(n => [n.id, { x: n.x ?? 0, y: n.y ?? 0 }]));
|
|
1117
|
+
separateGroups(result, nodes, options);
|
|
1118
|
+
return result;
|
|
1119
|
+
}
|
|
1120
|
+
/**
|
|
1121
|
+
* A layered layout, upstream on the left and downstream on the right: each node goes one column
|
|
1122
|
+
* after its furthest caller, and nodes in a column are ordered to keep lines short (barycentre
|
|
1123
|
+
* sweeps). Cycles are broken at the edge that closes them.
|
|
1124
|
+
*/
|
|
1125
|
+
function layeredLayout(nodes, edges, options) {
|
|
1126
|
+
const ids = new Set(nodes.map(n => n.id));
|
|
1127
|
+
const out = new Map();
|
|
1128
|
+
const incoming = new Map();
|
|
1129
|
+
for (const id of ids) {
|
|
1130
|
+
out.set(id, []);
|
|
1131
|
+
incoming.set(id, []);
|
|
1132
|
+
}
|
|
1133
|
+
// Drop the edges that close a cycle, found with a depth-first search.
|
|
1134
|
+
const state = new Map();
|
|
1135
|
+
const kept = [];
|
|
1136
|
+
const adjacency = new Map();
|
|
1137
|
+
for (const e of edges) {
|
|
1138
|
+
if (ids.has(e.source) && ids.has(e.target) && e.source !== e.target) {
|
|
1139
|
+
adjacency.set(e.source, [...(adjacency.get(e.source) ?? []), e.target]);
|
|
1140
|
+
}
|
|
1141
|
+
}
|
|
1142
|
+
const visit = (id) => {
|
|
1143
|
+
state.set(id, 1);
|
|
1144
|
+
for (const next of adjacency.get(id) ?? []) {
|
|
1145
|
+
if (state.get(next) === 1) ;
|
|
1146
|
+
else {
|
|
1147
|
+
kept.push({ source: id, target: next });
|
|
1148
|
+
if (!state.get(next))
|
|
1149
|
+
visit(next);
|
|
1150
|
+
}
|
|
1151
|
+
}
|
|
1152
|
+
state.set(id, 2);
|
|
1153
|
+
};
|
|
1154
|
+
for (const n of nodes)
|
|
1155
|
+
if (!state.get(n.id))
|
|
1156
|
+
visit(n.id);
|
|
1157
|
+
for (const e of kept) {
|
|
1158
|
+
out.get(e.source)?.push(e.target);
|
|
1159
|
+
incoming.get(e.target)?.push(e.source);
|
|
1160
|
+
}
|
|
1161
|
+
// Longest path from the sources gives each node its column.
|
|
1162
|
+
const rank = new Map();
|
|
1163
|
+
const rankOf = (id, seen = new Set()) => {
|
|
1164
|
+
const known = rank.get(id);
|
|
1165
|
+
if (known !== undefined)
|
|
1166
|
+
return known;
|
|
1167
|
+
if (seen.has(id))
|
|
1168
|
+
return 0;
|
|
1169
|
+
seen.add(id);
|
|
1170
|
+
const callers = incoming.get(id) ?? [];
|
|
1171
|
+
const r = callers.length
|
|
1172
|
+
? Math.max(...callers.map(c => rankOf(c, seen) + 1))
|
|
1173
|
+
: 0;
|
|
1174
|
+
rank.set(id, r);
|
|
1175
|
+
return r;
|
|
1176
|
+
};
|
|
1177
|
+
for (const n of nodes)
|
|
1178
|
+
rankOf(n.id);
|
|
1179
|
+
const columns = [];
|
|
1180
|
+
for (const n of nodes) {
|
|
1181
|
+
const r = rank.get(n.id) ?? 0;
|
|
1182
|
+
(columns[r] = columns[r] ?? []).push(n.id);
|
|
1183
|
+
}
|
|
1184
|
+
// Order each column by the average position of its neighbours, sweeping both ways.
|
|
1185
|
+
const position = new Map();
|
|
1186
|
+
const index = () => columns.forEach(col => col.forEach((id, i) => position.set(id, i)));
|
|
1187
|
+
index();
|
|
1188
|
+
const barycentre = (id, neighbours) => neighbours.length
|
|
1189
|
+
? neighbours.reduce((s, n) => s + (position.get(n) ?? 0), 0) /
|
|
1190
|
+
neighbours.length
|
|
1191
|
+
: (position.get(id) ?? 0);
|
|
1192
|
+
for (let sweep = 0; sweep < 4; sweep += 1) {
|
|
1193
|
+
const forward = sweep % 2 === 0;
|
|
1194
|
+
const order = forward ? columns.keys() : [...columns.keys()].reverse();
|
|
1195
|
+
for (const c of order) {
|
|
1196
|
+
const col = columns[c];
|
|
1197
|
+
if (col) {
|
|
1198
|
+
col.sort((a, b) => barycentre(a, forward ? (incoming.get(a) ?? []) : (out.get(a) ?? [])) -
|
|
1199
|
+
barycentre(b, forward ? (incoming.get(b) ?? []) : (out.get(b) ?? [])));
|
|
1200
|
+
col.forEach((id, i) => position.set(id, i));
|
|
1201
|
+
}
|
|
1202
|
+
}
|
|
1203
|
+
}
|
|
1204
|
+
const colGap = options.nodeWidth + 120;
|
|
1205
|
+
const rowGap = options.nodeHeight + 40;
|
|
1206
|
+
const result = new Map();
|
|
1207
|
+
const groupOf = new Map(nodes.map(n => [n.id, n.group ?? '']));
|
|
1208
|
+
const lanes = [...new Set(nodes.map(n => n.group ?? ''))];
|
|
1209
|
+
if (lanes.length < 2) {
|
|
1210
|
+
columns.forEach((col, c) => {
|
|
1211
|
+
const height = (col.length - 1) * rowGap;
|
|
1212
|
+
col.forEach((id, i) => result.set(id, { x: c * colGap, y: i * rowGap - height / 2 }));
|
|
1213
|
+
});
|
|
1214
|
+
}
|
|
1215
|
+
else {
|
|
1216
|
+
// Groups become horizontal lanes, so their boxes never overlap. Lanes are ordered by where
|
|
1217
|
+
// their nodes sit on average, which keeps the barycentre order as far as possible.
|
|
1218
|
+
const avg = (lane) => {
|
|
1219
|
+
const ps = nodes
|
|
1220
|
+
.filter(n => (n.group ?? '') === lane)
|
|
1221
|
+
.map(n => (position.get(n.id) ?? 0) /
|
|
1222
|
+
Math.max(1, (columns[rank.get(n.id) ?? 0] ?? []).length));
|
|
1223
|
+
return ps.reduce((s, p) => s + p, 0) / Math.max(1, ps.length);
|
|
1224
|
+
};
|
|
1225
|
+
lanes.sort((a, b) => avg(a) - avg(b));
|
|
1226
|
+
let top = 0;
|
|
1227
|
+
for (const lane of lanes) {
|
|
1228
|
+
const perColumn = columns.map(col => (col ?? []).filter(id => groupOf.get(id) === lane));
|
|
1229
|
+
const rows = Math.max(...perColumn.map(c => c.length));
|
|
1230
|
+
const height = (rows - 1) * rowGap;
|
|
1231
|
+
const laneTop = top;
|
|
1232
|
+
perColumn.forEach((col, c) => {
|
|
1233
|
+
const offset = (height - (col.length - 1) * rowGap) / 2;
|
|
1234
|
+
col.forEach((id, i) => result.set(id, { x: c * colGap, y: laneTop + offset + i * rowGap }));
|
|
1235
|
+
});
|
|
1236
|
+
const boxed = lane ? GROUP_PADDING.top + GROUP_PADDING.bottom : 0;
|
|
1237
|
+
top += height + rowGap + boxed + 24;
|
|
1238
|
+
}
|
|
1239
|
+
}
|
|
1240
|
+
for (const n of nodes)
|
|
1241
|
+
if (n.pinned)
|
|
1242
|
+
result.set(n.id, n.pinned);
|
|
1243
|
+
return result;
|
|
1244
|
+
}
|
|
1245
|
+
/**
|
|
1246
|
+
* A radial layout around `center`: rings by the number of hops (either direction), with each
|
|
1247
|
+
* ring's nodes ordered to sit near the node that reached them. Unreached nodes go on an outer ring.
|
|
1248
|
+
*/
|
|
1249
|
+
function radialLayout(nodes, edges, options) {
|
|
1250
|
+
const ids = nodes.map(n => n.id);
|
|
1251
|
+
const center = options.center && ids.includes(options.center) ? options.center : ids[0];
|
|
1252
|
+
const neighbours = new Map(ids.map(id => [id, []]));
|
|
1253
|
+
for (const e of edges) {
|
|
1254
|
+
if (neighbours.has(e.source) &&
|
|
1255
|
+
neighbours.has(e.target) &&
|
|
1256
|
+
e.source !== e.target) {
|
|
1257
|
+
neighbours.get(e.source)?.push(e.target);
|
|
1258
|
+
neighbours.get(e.target)?.push(e.source);
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1261
|
+
const hop = new Map();
|
|
1262
|
+
const parent = new Map();
|
|
1263
|
+
const rings = [];
|
|
1264
|
+
if (center) {
|
|
1265
|
+
hop.set(center, 0);
|
|
1266
|
+
rings[0] = [center];
|
|
1267
|
+
const queue = [center];
|
|
1268
|
+
while (queue.length) {
|
|
1269
|
+
const id = queue.shift();
|
|
1270
|
+
const h = hop.get(id) ?? 0;
|
|
1271
|
+
for (const n of neighbours.get(id) ?? []) {
|
|
1272
|
+
if (!hop.has(n)) {
|
|
1273
|
+
hop.set(n, h + 1);
|
|
1274
|
+
parent.set(n, id);
|
|
1275
|
+
(rings[h + 1] = rings[h + 1] ?? []).push(n);
|
|
1276
|
+
queue.push(n);
|
|
1277
|
+
}
|
|
1278
|
+
}
|
|
1279
|
+
}
|
|
1280
|
+
}
|
|
1281
|
+
const rest = ids.filter(id => !hop.has(id));
|
|
1282
|
+
// Each node gets a slice of the circle sized by the leaves below it in the BFS tree, and its
|
|
1283
|
+
// children share that slice, so branches fan out without crossing.
|
|
1284
|
+
const children = new Map();
|
|
1285
|
+
for (const [child, p] of parent)
|
|
1286
|
+
children.set(p, [...(children.get(p) ?? []), child]);
|
|
1287
|
+
const leaves = new Map();
|
|
1288
|
+
const countLeaves = (id) => {
|
|
1289
|
+
const kids = children.get(id) ?? [];
|
|
1290
|
+
const n = kids.length ? kids.reduce((s, k) => s + countLeaves(k), 0) : 1;
|
|
1291
|
+
leaves.set(id, n);
|
|
1292
|
+
return n;
|
|
1293
|
+
};
|
|
1294
|
+
const angle = new Map();
|
|
1295
|
+
const assign = (id, from, to) => {
|
|
1296
|
+
angle.set(id, (from + to) / 2);
|
|
1297
|
+
const kids = children.get(id) ?? [];
|
|
1298
|
+
const total = kids.reduce((s, k) => s + (leaves.get(k) ?? 1), 0);
|
|
1299
|
+
let at = from;
|
|
1300
|
+
for (const k of kids) {
|
|
1301
|
+
const span = ((to - from) * (leaves.get(k) ?? 1)) / total;
|
|
1302
|
+
assign(k, at, at + span);
|
|
1303
|
+
at += span;
|
|
1304
|
+
}
|
|
1305
|
+
};
|
|
1306
|
+
if (center) {
|
|
1307
|
+
countLeaves(center);
|
|
1308
|
+
assign(center, -Math.PI / 2, (Math.PI * 3) / 2);
|
|
1309
|
+
}
|
|
1310
|
+
// Each ring is far enough out for its nodes to fit side by side.
|
|
1311
|
+
const step = Math.max(options.nodeWidth, options.nodeHeight * 3) + 40;
|
|
1312
|
+
const radii = [0];
|
|
1313
|
+
rings.forEach((ring, r) => {
|
|
1314
|
+
if (r > 0) {
|
|
1315
|
+
const room = options.nodeWidth + 24;
|
|
1316
|
+
const fit = (ring.length * room) / (Math.PI * 2);
|
|
1317
|
+
// The tightest pair of neighbours on the ring decides how far out it must go.
|
|
1318
|
+
const as = ring.map(id => angle.get(id) ?? 0).sort((a, b) => a - b);
|
|
1319
|
+
let tightest = Math.PI * 2;
|
|
1320
|
+
for (let i = 1; i < as.length; i += 1)
|
|
1321
|
+
tightest = Math.min(tightest, as[i] - as[i - 1]);
|
|
1322
|
+
const spread = as.length > 1 ? room / Math.max(tightest, 0.05) : 0;
|
|
1323
|
+
const prev = radii[r - 1];
|
|
1324
|
+
radii[r] = Math.max(prev + step, fit, Math.min(spread, prev + step * 3));
|
|
1325
|
+
}
|
|
1326
|
+
});
|
|
1327
|
+
const result = new Map();
|
|
1328
|
+
for (const [id, h] of hop) {
|
|
1329
|
+
const a = angle.get(id) ?? 0;
|
|
1330
|
+
const radius = radii[h] ?? 0;
|
|
1331
|
+
result.set(id, h ? { x: Math.cos(a) * radius, y: Math.sin(a) * radius } : { x: 0, y: 0 });
|
|
1332
|
+
}
|
|
1333
|
+
if (rest.length) {
|
|
1334
|
+
const outer = Math.max((radii[radii.length - 1] ?? 0) + step, (rest.length * (options.nodeWidth + 24)) / (Math.PI * 2));
|
|
1335
|
+
rest.forEach((id, i) => {
|
|
1336
|
+
const a = (i / rest.length) * Math.PI * 2 - Math.PI / 2;
|
|
1337
|
+
result.set(id, { x: Math.cos(a) * outer, y: Math.sin(a) * outer });
|
|
1338
|
+
});
|
|
1339
|
+
}
|
|
1340
|
+
for (const n of nodes)
|
|
1341
|
+
if (n.pinned)
|
|
1342
|
+
result.set(n.id, n.pinned);
|
|
1343
|
+
return result;
|
|
1344
|
+
}
|
|
1345
|
+
/** Ids reachable from `start` along edges: `upstream` follows edges backwards (who depends on it). */
|
|
1346
|
+
function reachable(start, edges, direction) {
|
|
1347
|
+
const next = new Map();
|
|
1348
|
+
for (const e of edges) {
|
|
1349
|
+
const [from, to] = direction === 'downstream' ? [e.source, e.target] : [e.target, e.source];
|
|
1350
|
+
next.set(from, [...(next.get(from) ?? []), to]);
|
|
1351
|
+
}
|
|
1352
|
+
const seen = new Set([start]);
|
|
1353
|
+
const queue = [start];
|
|
1354
|
+
while (queue.length) {
|
|
1355
|
+
const id = queue.shift();
|
|
1356
|
+
for (const n of next.get(id) ?? []) {
|
|
1357
|
+
if (!seen.has(n)) {
|
|
1358
|
+
seen.add(n);
|
|
1359
|
+
queue.push(n);
|
|
1360
|
+
}
|
|
1361
|
+
}
|
|
1362
|
+
}
|
|
1363
|
+
return seen;
|
|
1364
|
+
}
|
|
1365
|
+
/** Ids within `hops` steps of `start`, in either direction. */
|
|
1366
|
+
function withinHops(start, edges, hops) {
|
|
1367
|
+
const neighbours = new Map();
|
|
1368
|
+
for (const e of edges) {
|
|
1369
|
+
neighbours.set(e.source, [...(neighbours.get(e.source) ?? []), e.target]);
|
|
1370
|
+
neighbours.set(e.target, [...(neighbours.get(e.target) ?? []), e.source]);
|
|
1371
|
+
}
|
|
1372
|
+
const seen = new Map([[start, 0]]);
|
|
1373
|
+
const queue = [start];
|
|
1374
|
+
while (queue.length) {
|
|
1375
|
+
const id = queue.shift();
|
|
1376
|
+
const h = seen.get(id) ?? 0;
|
|
1377
|
+
if (h < hops) {
|
|
1378
|
+
for (const n of neighbours.get(id) ?? []) {
|
|
1379
|
+
if (!seen.has(n)) {
|
|
1380
|
+
seen.set(n, h + 1);
|
|
1381
|
+
queue.push(n);
|
|
1382
|
+
}
|
|
1383
|
+
}
|
|
1384
|
+
}
|
|
1385
|
+
}
|
|
1386
|
+
return new Set(seen.keys());
|
|
1387
|
+
}
|
|
1388
|
+
|
|
1389
|
+
export { reachable as a, forceLayout as f, layeredLayout as l, radialLayout as r, withinHops as w };
|
|
1390
|
+
//# sourceMappingURL=dependency-map-layout-5KUueabk.js.map
|