@alepha/ui 0.27.0 → 0.27.1
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/README.md +56 -15
- package/dist/components/account/account-connections.d.ts.map +1 -1
- package/dist/components/account/account-connections.js +24 -13
- package/dist/components/account/account-connections.js.map +1 -1
- package/dist/components/account/account-delete-dialog.d.ts.map +1 -1
- package/dist/components/account/account-delete-dialog.js +12 -8
- package/dist/components/account/account-delete-dialog.js.map +1 -1
- package/dist/components/account/account-header.d.ts.map +1 -1
- package/dist/components/account/account-header.js +3 -1
- package/dist/components/account/account-header.js.map +1 -1
- package/dist/components/account/account-keys.d.ts.map +1 -1
- package/dist/components/account/account-keys.js +35 -21
- package/dist/components/account/account-keys.js.map +1 -1
- package/dist/components/account/account-mfa-dialog.d.ts +20 -0
- package/dist/components/account/account-mfa-dialog.d.ts.map +1 -0
- package/dist/components/account/account-mfa-dialog.js +149 -0
- package/dist/components/account/account-mfa-dialog.js.map +1 -0
- package/dist/components/account/account-password-dialog.d.ts.map +1 -1
- package/dist/components/account/account-password-dialog.js +15 -10
- package/dist/components/account/account-password-dialog.js.map +1 -1
- package/dist/components/account/account-profile.d.ts.map +1 -1
- package/dist/components/account/account-profile.js +25 -25
- package/dist/components/account/account-profile.js.map +1 -1
- package/dist/components/account/account-router.d.ts +76 -2
- package/dist/components/account/account-router.d.ts.map +1 -1
- package/dist/components/account/account-router.js +44 -4
- package/dist/components/account/account-router.js.map +1 -1
- package/dist/components/account/account-security.d.ts +11 -1
- package/dist/components/account/account-security.d.ts.map +1 -1
- package/dist/components/account/account-security.js +119 -32
- package/dist/components/account/account-security.js.map +1 -1
- package/dist/components/account/account-sessions.d.ts.map +1 -1
- package/dist/components/account/account-sessions.js +46 -24
- package/dist/components/account/account-sessions.js.map +1 -1
- package/dist/components/admin/admin-jobs-executions-panel.d.ts.map +1 -1
- package/dist/components/admin/admin-jobs-executions-panel.js +4 -9
- package/dist/components/admin/admin-jobs-executions-panel.js.map +1 -1
- package/dist/components/admin/admin-jobs-status-badge.d.ts.map +1 -1
- package/dist/components/admin/admin-jobs-status-badge.js +3 -3
- package/dist/components/admin/admin-jobs-status-badge.js.map +1 -1
- package/dist/components/admin/admin-jobs-status-labels.d.ts +26 -0
- package/dist/components/admin/admin-jobs-status-labels.d.ts.map +1 -0
- package/dist/components/admin/admin-jobs-status-labels.js +46 -0
- package/dist/components/admin/admin-jobs-status-labels.js.map +1 -0
- package/dist/components/admin/admin-layout.d.ts.map +1 -1
- package/dist/components/admin/admin-layout.js +5 -3
- package/dist/components/admin/admin-layout.js.map +1 -1
- package/dist/components/admin/admin-notifications-detail-tabs.d.ts +21 -0
- package/dist/components/admin/admin-notifications-detail-tabs.d.ts.map +1 -0
- package/dist/components/admin/admin-notifications-detail-tabs.js +122 -0
- package/dist/components/admin/admin-notifications-detail-tabs.js.map +1 -0
- package/dist/components/admin/admin-notifications-detail.d.ts +23 -0
- package/dist/components/admin/admin-notifications-detail.d.ts.map +1 -0
- package/dist/components/admin/admin-notifications-detail.js +48 -0
- package/dist/components/admin/admin-notifications-detail.js.map +1 -0
- package/dist/components/admin/admin-notifications-preview-body.d.ts +13 -0
- package/dist/components/admin/admin-notifications-preview-body.d.ts.map +1 -0
- package/dist/components/admin/admin-notifications-preview-body.js +64 -0
- package/dist/components/admin/admin-notifications-preview-body.js.map +1 -0
- package/dist/components/admin/admin-notifications-preview-tab.d.ts +24 -0
- package/dist/components/admin/admin-notifications-preview-tab.d.ts.map +1 -0
- package/dist/components/admin/admin-notifications-preview-tab.js +35 -0
- package/dist/components/admin/admin-notifications-preview-tab.js.map +1 -0
- package/dist/components/admin/admin-notifications-raw-tab.d.ts +18 -0
- package/dist/components/admin/admin-notifications-raw-tab.d.ts.map +1 -0
- package/dist/components/admin/admin-notifications-raw-tab.js +53 -0
- package/dist/components/admin/admin-notifications-raw-tab.js.map +1 -0
- package/dist/components/admin/admin-notifications-status-badge.d.ts +17 -0
- package/dist/components/admin/admin-notifications-status-badge.d.ts.map +1 -0
- package/dist/components/admin/admin-notifications-status-badge.js +32 -0
- package/dist/components/admin/admin-notifications-status-badge.js.map +1 -0
- package/dist/components/admin/admin-notifications-status-labels.d.ts +17 -0
- package/dist/components/admin/admin-notifications-status-labels.d.ts.map +1 -0
- package/dist/components/admin/admin-notifications-status-labels.js +33 -0
- package/dist/components/admin/admin-notifications-status-labels.js.map +1 -0
- package/dist/components/admin/admin-notifications-status-tones.d.ts +44 -0
- package/dist/components/admin/admin-notifications-status-tones.d.ts.map +1 -0
- package/dist/components/admin/admin-notifications-status-tones.js +64 -0
- package/dist/components/admin/admin-notifications-status-tones.js.map +1 -0
- package/dist/components/admin/admin-notifications-template-label.d.ts +16 -0
- package/dist/components/admin/admin-notifications-template-label.d.ts.map +1 -0
- package/dist/components/admin/admin-notifications-template-label.js +24 -0
- package/dist/components/admin/admin-notifications-template-label.js.map +1 -0
- package/dist/components/admin/admin-notifications.d.ts +13 -2
- package/dist/components/admin/admin-notifications.d.ts.map +1 -1
- package/dist/components/admin/admin-notifications.js +264 -29
- package/dist/components/admin/admin-notifications.js.map +1 -1
- package/dist/components/admin/admin-router.d.ts +29 -2
- package/dist/components/admin/admin-router.d.ts.map +1 -1
- package/dist/components/admin/admin-router.js +68 -8
- package/dist/components/admin/admin-router.js.map +1 -1
- package/dist/components/admin/admin-sessions.d.ts.map +1 -1
- package/dist/components/admin/admin-sessions.js +1 -1
- package/dist/components/admin/admin-sessions.js.map +1 -1
- package/dist/components/admin/admin-user-detail-security-tab.d.ts +12 -2
- package/dist/components/admin/admin-user-detail-security-tab.d.ts.map +1 -1
- package/dist/components/admin/admin-user-detail-security-tab.js +63 -44
- package/dist/components/admin/admin-user-detail-security-tab.js.map +1 -1
- package/dist/components/admin/admin-user-detail-sessions-tab.d.ts.map +1 -1
- package/dist/components/admin/admin-user-detail-sessions-tab.js +1 -1
- package/dist/components/admin/admin-user-detail-sessions-tab.js.map +1 -1
- package/dist/components/admin/admin-user-detail.d.ts.map +1 -1
- package/dist/components/admin/admin-user-detail.js +20 -15
- package/dist/components/admin/admin-user-detail.js.map +1 -1
- package/dist/components/admin/admin-users.js +1 -1
- package/dist/components/admin/admin-users.js.map +1 -1
- package/dist/components/admin/admin-workflows-executions-panel.d.ts.map +1 -1
- package/dist/components/admin/admin-workflows-executions-panel.js +4 -12
- package/dist/components/admin/admin-workflows-executions-panel.js.map +1 -1
- package/dist/components/admin/admin-workflows-status-badge.d.ts.map +1 -1
- package/dist/components/admin/admin-workflows-status-badge.js +3 -3
- package/dist/components/admin/admin-workflows-status-badge.js.map +1 -1
- package/dist/components/admin/admin-workflows-status-labels.d.ts +19 -0
- package/dist/components/admin/admin-workflows-status-labels.d.ts.map +1 -0
- package/dist/components/admin/admin-workflows-status-labels.js +48 -0
- package/dist/components/admin/admin-workflows-status-labels.js.map +1 -0
- package/dist/components/alepha-table/alepha-table.d.ts +6 -0
- package/dist/components/alepha-table/alepha-table.d.ts.map +1 -1
- package/dist/components/alepha-table/alepha-table.js +33 -5
- package/dist/components/alepha-table/alepha-table.js.map +1 -1
- package/dist/components/auth/auth-login.d.ts.map +1 -1
- package/dist/components/auth/auth-login.js +27 -17
- package/dist/components/auth/auth-login.js.map +1 -1
- package/dist/components/auth/auth-mfa-step.d.ts +25 -0
- package/dist/components/auth/auth-mfa-step.d.ts.map +1 -0
- package/dist/components/auth/auth-mfa-step.js +122 -0
- package/dist/components/auth/auth-mfa-step.js.map +1 -0
- package/dist/components/auth/auth-register.js +2 -2
- package/dist/components/auth/auth-register.js.map +1 -1
- package/dist/components/auth/auth-reset-password.js +2 -2
- package/dist/components/auth/auth-router.d.ts +20 -0
- package/dist/components/auth/auth-router.d.ts.map +1 -1
- package/dist/components/auth/provider-labels.d.ts.map +1 -1
- package/dist/components/auth/provider-labels.js +1 -0
- package/dist/components/auth/provider-labels.js.map +1 -1
- package/dist/components/control/control.d.ts +11 -2
- package/dist/components/control/control.d.ts.map +1 -1
- package/dist/components/control/control.js +7 -2
- package/dist/components/control/control.js.map +1 -1
- package/dist/components/control-array/control-array.d.ts.map +1 -1
- package/dist/components/control-array/control-array.js +55 -10
- package/dist/components/control-array/control-array.js.map +1 -1
- package/dist/components/control-number/control-number.d.ts +5 -0
- package/dist/components/control-number/control-number.d.ts.map +1 -1
- package/dist/components/control-number/control-number.js +1 -0
- package/dist/components/control-number/control-number.js.map +1 -1
- package/dist/components/control-object/control-object.d.ts +12 -1
- package/dist/components/control-object/control-object.d.ts.map +1 -1
- package/dist/components/control-object/control-object.js +2 -1
- package/dist/components/control-object/control-object.js.map +1 -1
- package/dist/components/control-password/control-password.d.ts.map +1 -1
- package/dist/components/control-password/control-password.js +1 -0
- package/dist/components/control-password/control-password.js.map +1 -1
- package/dist/components/detail/detail-layout.d.ts +6 -0
- package/dist/components/detail/detail-layout.d.ts.map +1 -1
- package/dist/components/detail/detail-layout.js +2 -1
- package/dist/components/detail/detail-layout.js.map +1 -1
- package/dist/components/email-body-frame/email-body-frame.d.ts +37 -0
- package/dist/components/email-body-frame/email-body-frame.d.ts.map +1 -0
- package/dist/components/email-body-frame/email-body-frame.js +44 -0
- package/dist/components/email-body-frame/email-body-frame.js.map +1 -0
- package/dist/components/markdown-view/diagram/DiagramLabel.d.ts +33 -0
- package/dist/components/markdown-view/diagram/DiagramLabel.d.ts.map +1 -0
- package/dist/components/markdown-view/diagram/{FlowchartDiagramLabel.js → DiagramLabel.js} +15 -6
- package/dist/components/markdown-view/diagram/DiagramLabel.js.map +1 -0
- package/dist/components/markdown-view/diagram/FlowchartDiagram.d.ts +0 -5
- package/dist/components/markdown-view/diagram/FlowchartDiagram.d.ts.map +1 -1
- package/dist/components/markdown-view/diagram/FlowchartDiagram.js +2 -6
- package/dist/components/markdown-view/diagram/FlowchartDiagram.js.map +1 -1
- package/dist/components/markdown-view/diagram/FlowchartDiagramCluster.js +1 -1
- package/dist/components/markdown-view/diagram/FlowchartDiagramCluster.js.map +1 -1
- package/dist/components/markdown-view/diagram/FlowchartDiagramEdge.d.ts.map +1 -1
- package/dist/components/markdown-view/diagram/FlowchartDiagramEdge.js +2 -3
- package/dist/components/markdown-view/diagram/FlowchartDiagramEdge.js.map +1 -1
- package/dist/components/markdown-view/diagram/FlowchartDiagramNode.d.ts.map +1 -1
- package/dist/components/markdown-view/diagram/FlowchartDiagramNode.js +2 -3
- package/dist/components/markdown-view/diagram/FlowchartDiagramNode.js.map +1 -1
- package/dist/components/markdown-view/diagram/MermaidFence.d.ts +20 -11
- package/dist/components/markdown-view/diagram/MermaidFence.d.ts.map +1 -1
- package/dist/components/markdown-view/diagram/MermaidFence.js +48 -13
- package/dist/components/markdown-view/diagram/MermaidFence.js.map +1 -1
- package/dist/components/markdown-view/diagram/SequenceDiagram.d.ts +50 -0
- package/dist/components/markdown-view/diagram/SequenceDiagram.d.ts.map +1 -0
- package/dist/components/markdown-view/diagram/SequenceDiagram.js +141 -0
- package/dist/components/markdown-view/diagram/SequenceDiagram.js.map +1 -0
- package/dist/components/markdown-view/diagram/SequenceDiagramFragment.d.ts +23 -0
- package/dist/components/markdown-view/diagram/SequenceDiagramFragment.d.ts.map +1 -0
- package/dist/components/markdown-view/diagram/SequenceDiagramFragment.js +101 -0
- package/dist/components/markdown-view/diagram/SequenceDiagramFragment.js.map +1 -0
- package/dist/components/markdown-view/diagram/SequenceDiagramMessage.d.ts +23 -0
- package/dist/components/markdown-view/diagram/SequenceDiagramMessage.d.ts.map +1 -0
- package/dist/components/markdown-view/diagram/SequenceDiagramMessage.js +77 -0
- package/dist/components/markdown-view/diagram/SequenceDiagramMessage.js.map +1 -0
- package/dist/components/markdown-view/diagram/SequenceDiagramNote.d.ts +16 -0
- package/dist/components/markdown-view/diagram/SequenceDiagramNote.d.ts.map +1 -0
- package/dist/components/markdown-view/diagram/SequenceDiagramNote.js +39 -0
- package/dist/components/markdown-view/diagram/SequenceDiagramNote.js.map +1 -0
- package/dist/components/markdown-view/diagram/SequenceDiagramParticipant.d.ts +20 -0
- package/dist/components/markdown-view/diagram/SequenceDiagramParticipant.d.ts.map +1 -0
- package/dist/components/markdown-view/diagram/SequenceDiagramParticipant.js +61 -0
- package/dist/components/markdown-view/diagram/SequenceDiagramParticipant.js.map +1 -0
- package/dist/components/markdown-view/diagram/SequenceDiagramParticipantActor.d.ts +27 -0
- package/dist/components/markdown-view/diagram/SequenceDiagramParticipantActor.d.ts.map +1 -0
- package/dist/components/markdown-view/diagram/SequenceDiagramParticipantActor.js +65 -0
- package/dist/components/markdown-view/diagram/SequenceDiagramParticipantActor.js.map +1 -0
- package/dist/components/markdown-view/diagram/layoutSequence.d.ts +155 -0
- package/dist/components/markdown-view/diagram/layoutSequence.d.ts.map +1 -0
- package/dist/components/markdown-view/diagram/layoutSequence.js +478 -0
- package/dist/components/markdown-view/diagram/layoutSequence.js.map +1 -0
- package/dist/components/markdown-view/diagram/sequenceModel.d.ts +132 -0
- package/dist/components/markdown-view/diagram/sequenceModel.d.ts.map +1 -0
- package/dist/components/markdown-view/diagram/sequenceModel.js +0 -0
- package/dist/components/markdown-view/diagram/sequenceParser.d.ts +32 -0
- package/dist/components/markdown-view/diagram/sequenceParser.d.ts.map +1 -0
- package/dist/components/markdown-view/diagram/sequenceParser.js +312 -0
- package/dist/components/markdown-view/diagram/sequenceParser.js.map +1 -0
- package/dist/components/markdown-view/markdown-view.css +65 -0
- package/dist/components/markdown-view/markdown-view.d.ts +18 -11
- package/dist/components/markdown-view/markdown-view.d.ts.map +1 -1
- package/dist/components/markdown-view/markdown-view.js +30 -16
- package/dist/components/markdown-view/markdown-view.js.map +1 -1
- package/dist/components/nav-shell/nav-page.d.ts +7 -0
- package/dist/components/nav-shell/nav-page.d.ts.map +1 -1
- package/dist/components/nav-shell/nav-page.js.map +1 -1
- package/dist/components/nav-shell/nav-tree-util.d.ts +64 -2
- package/dist/components/nav-shell/nav-tree-util.d.ts.map +1 -1
- package/dist/components/nav-shell/nav-tree-util.js +29 -6
- package/dist/components/nav-shell/nav-tree-util.js.map +1 -1
- package/dist/components/nav-shell/spotlight.d.ts +3 -2
- package/dist/components/nav-shell/spotlight.d.ts.map +1 -1
- package/dist/components/nav-shell/spotlight.js +9 -6
- package/dist/components/nav-shell/spotlight.js.map +1 -1
- package/dist/components/nav-shell/use-nav-breadcrumbs.d.ts.map +1 -1
- package/dist/components/nav-shell/use-nav-breadcrumbs.js +9 -2
- package/dist/components/nav-shell/use-nav-breadcrumbs.js.map +1 -1
- package/dist/components/nav-shell/use-nav-entries.d.ts +6 -0
- package/dist/components/nav-shell/use-nav-entries.d.ts.map +1 -1
- package/dist/components/nav-shell/use-nav-entries.js +8 -3
- package/dist/components/nav-shell/use-nav-entries.js.map +1 -1
- package/dist/components/nav-shell/use-nav-tree.d.ts.map +1 -1
- package/dist/components/nav-shell/use-nav-tree.js +1 -1
- package/dist/components/nav-shell/use-nav-tree.js.map +1 -1
- package/dist/components/ui/alert-dialog.d.ts +1 -1
- package/dist/components/ui/alert-dialog.d.ts.map +1 -1
- package/dist/components/ui/alert-dialog.js +1 -0
- package/dist/components/ui/alert-dialog.js.map +1 -1
- package/dist/components/ui/alert.d.ts +2 -2
- package/dist/components/ui/alert.d.ts.map +1 -1
- package/dist/components/ui/alert.js +1 -0
- package/dist/components/ui/alert.js.map +1 -1
- package/dist/components/ui/avatar.d.ts +2 -2
- package/dist/components/ui/avatar.d.ts.map +1 -1
- package/dist/components/ui/avatar.js +1 -0
- package/dist/components/ui/avatar.js.map +1 -1
- package/dist/components/ui/breadcrumb.d.ts +2 -2
- package/dist/components/ui/breadcrumb.d.ts.map +1 -1
- package/dist/components/ui/breadcrumb.js +1 -0
- package/dist/components/ui/breadcrumb.js.map +1 -1
- package/dist/components/ui/card.d.ts +2 -2
- package/dist/components/ui/card.d.ts.map +1 -1
- package/dist/components/ui/card.js +1 -0
- package/dist/components/ui/card.js.map +1 -1
- package/dist/components/ui/checkbox.js +1 -1
- package/dist/components/ui/checkbox.js.map +1 -1
- package/dist/components/ui/combobox.d.ts +1 -1
- package/dist/components/ui/combobox.d.ts.map +1 -1
- package/dist/components/ui/combobox.js.map +1 -1
- package/dist/components/ui/command.d.ts +2 -2
- package/dist/components/ui/command.d.ts.map +1 -1
- package/dist/components/ui/command.js +1 -0
- package/dist/components/ui/command.js.map +1 -1
- package/dist/components/ui/context-menu.d.ts +2 -2
- package/dist/components/ui/context-menu.d.ts.map +1 -1
- package/dist/components/ui/context-menu.js +1 -0
- package/dist/components/ui/context-menu.js.map +1 -1
- package/dist/components/ui/dialog.d.ts +1 -1
- package/dist/components/ui/dialog.d.ts.map +1 -1
- package/dist/components/ui/dialog.js +1 -0
- package/dist/components/ui/dialog.js.map +1 -1
- package/dist/components/ui/drawer.d.ts +1 -1
- package/dist/components/ui/drawer.d.ts.map +1 -1
- package/dist/components/ui/drawer.js.map +1 -1
- package/dist/components/ui/dropdown-menu.d.ts +2 -2
- package/dist/components/ui/dropdown-menu.d.ts.map +1 -1
- package/dist/components/ui/dropdown-menu.js +1 -0
- package/dist/components/ui/dropdown-menu.js.map +1 -1
- package/dist/components/ui/empty.d.ts +1 -1
- package/dist/components/ui/empty.d.ts.map +1 -1
- package/dist/components/ui/empty.js.map +1 -1
- package/dist/components/ui/hover-card.d.ts +1 -1
- package/dist/components/ui/hover-card.js.map +1 -1
- package/dist/components/ui/input-group.d.ts +2 -2
- package/dist/components/ui/input-group.d.ts.map +1 -1
- package/dist/components/ui/input-group.js +1 -0
- package/dist/components/ui/input-group.js.map +1 -1
- package/dist/components/ui/input-otp.d.ts +1 -1
- package/dist/components/ui/input-otp.d.ts.map +1 -1
- package/dist/components/ui/input-otp.js.map +1 -1
- package/dist/components/ui/input.d.ts +1 -1
- package/dist/components/ui/input.d.ts.map +1 -1
- package/dist/components/ui/input.js +1 -0
- package/dist/components/ui/input.js.map +1 -1
- package/dist/components/ui/label.d.ts +1 -1
- package/dist/components/ui/label.d.ts.map +1 -1
- package/dist/components/ui/label.js +1 -0
- package/dist/components/ui/label.js.map +1 -1
- package/dist/components/ui/menubar.d.ts +2 -2
- package/dist/components/ui/menubar.d.ts.map +1 -1
- package/dist/components/ui/menubar.js +1 -0
- package/dist/components/ui/menubar.js.map +1 -1
- package/dist/components/ui/pagination.d.ts +1 -1
- package/dist/components/ui/pagination.d.ts.map +1 -1
- package/dist/components/ui/pagination.js +1 -0
- package/dist/components/ui/pagination.js.map +1 -1
- package/dist/components/ui/popover.d.ts +1 -1
- package/dist/components/ui/popover.d.ts.map +1 -1
- package/dist/components/ui/popover.js +1 -0
- package/dist/components/ui/popover.js.map +1 -1
- package/dist/components/ui/progress.d.ts +1 -1
- package/dist/components/ui/progress.d.ts.map +1 -1
- package/dist/components/ui/progress.js.map +1 -1
- package/dist/components/ui/segmented.d.ts +11 -0
- package/dist/components/ui/segmented.d.ts.map +1 -1
- package/dist/components/ui/segmented.js +6 -2
- package/dist/components/ui/segmented.js.map +1 -1
- package/dist/components/ui/select.d.ts +1 -1
- package/dist/components/ui/select.d.ts.map +1 -1
- package/dist/components/ui/select.js +1 -0
- package/dist/components/ui/select.js.map +1 -1
- package/dist/components/ui/sheet.d.ts +2 -2
- package/dist/components/ui/sheet.d.ts.map +1 -1
- package/dist/components/ui/sheet.js +1 -0
- package/dist/components/ui/sheet.js.map +1 -1
- package/dist/components/ui/switch.js +1 -1
- package/dist/components/ui/switch.js.map +1 -1
- package/dist/components/ui/table.d.ts +2 -2
- package/dist/components/ui/table.d.ts.map +1 -1
- package/dist/components/ui/table.js +1 -0
- package/dist/components/ui/table.js.map +1 -1
- package/dist/components/ui/tabs.d.ts +1 -1
- package/dist/components/ui/tabs.d.ts.map +1 -1
- package/dist/components/ui/tabs.js.map +1 -1
- package/dist/components/ui/textarea.d.ts +1 -1
- package/dist/components/ui/textarea.d.ts.map +1 -1
- package/dist/components/ui/textarea.js +1 -0
- package/dist/components/ui/textarea.js.map +1 -1
- package/dist/components/ui/tooltip.d.ts +1 -11
- package/dist/components/ui/tooltip.d.ts.map +1 -1
- package/dist/components/ui/tooltip.js +0 -10
- package/dist/components/ui/tooltip.js.map +1 -1
- package/dist/hooks/use-mobile.d.ts +1 -1
- package/dist/hooks/use-mobile.js +1 -1
- package/dist/hooks/use-mobile.js.map +1 -1
- package/dist/lib/i18n-fr.d.ts.map +1 -1
- package/dist/lib/i18n-fr.js +252 -2
- package/dist/lib/i18n-fr.js.map +1 -1
- package/package.json +5 -5
- package/src/components/account/__tests__/account-router.spec.ts +25 -0
- package/src/components/account/__tests__/account-security-mfa-gate.browser.spec.tsx +76 -0
- package/src/components/account/account-connections.tsx +50 -18
- package/src/components/account/account-delete-dialog.tsx +24 -9
- package/src/components/account/account-header.tsx +4 -1
- package/src/components/account/account-keys.tsx +73 -29
- package/src/components/account/account-mfa-dialog.tsx +233 -0
- package/src/components/account/account-password-dialog.tsx +42 -12
- package/src/components/account/account-profile.tsx +66 -25
- package/src/components/account/account-router.tsx +47 -6
- package/src/components/account/account-security.tsx +209 -22
- package/src/components/account/account-sessions.tsx +87 -22
- package/src/components/action-error-toaster/__tests__/action-error-toaster.browser.spec.tsx +114 -0
- package/src/components/admin/__tests__/admin-nav-i18n.browser.spec.tsx +152 -0
- package/src/components/admin/__tests__/admin-notifications-preview-body.browser.spec.tsx +128 -0
- package/src/components/admin/__tests__/admin-notifications-raw-tab.browser.spec.tsx +76 -0
- package/src/components/admin/__tests__/admin-notifications-status-badge.browser.spec.tsx +121 -0
- package/src/components/admin/__tests__/admin-router.spec.ts +27 -0
- package/src/components/admin/__tests__/admin-status-labels.browser.spec.tsx +152 -0
- package/src/components/admin/__tests__/admin-user-detail-security-tab.browser.spec.tsx +92 -0
- package/src/components/admin/admin-jobs-executions-panel.tsx +8 -11
- package/src/components/admin/admin-jobs-status-badge.tsx +4 -5
- package/src/components/admin/admin-jobs-status-labels.ts +46 -0
- package/src/components/admin/admin-layout.tsx +9 -3
- package/src/components/admin/admin-notifications-detail-tabs.tsx +167 -0
- package/src/components/admin/admin-notifications-detail.tsx +100 -0
- package/src/components/admin/admin-notifications-preview-body.tsx +104 -0
- package/src/components/admin/admin-notifications-preview-tab.tsx +55 -0
- package/src/components/admin/admin-notifications-raw-tab.tsx +76 -0
- package/src/components/admin/admin-notifications-status-badge.tsx +44 -0
- package/src/components/admin/admin-notifications-status-labels.ts +42 -0
- package/src/components/admin/admin-notifications-status-tones.ts +85 -0
- package/src/components/admin/admin-notifications-template-label.ts +22 -0
- package/src/components/admin/admin-notifications.tsx +398 -31
- package/src/components/admin/admin-router.tsx +65 -8
- package/src/components/admin/admin-sessions.tsx +10 -3
- package/src/components/admin/admin-user-detail-security-tab.tsx +70 -5
- package/src/components/admin/admin-user-detail-sessions-tab.tsx +10 -3
- package/src/components/admin/admin-user-detail.tsx +92 -23
- package/src/components/admin/admin-users.tsx +1 -1
- package/src/components/admin/admin-workflows-executions-panel.tsx +8 -16
- package/src/components/admin/admin-workflows-status-badge.tsx +4 -5
- package/src/components/admin/admin-workflows-status-labels.ts +51 -0
- package/src/components/alepha-table/__tests__/alepha-table-row-key.browser.spec.tsx +106 -0
- package/src/components/alepha-table/alepha-table.tsx +50 -10
- package/src/components/auth/auth-login.tsx +37 -18
- package/src/components/auth/auth-mfa-step.tsx +177 -0
- package/src/components/auth/auth-register.tsx +1 -1
- package/src/components/auth/provider-labels.ts +4 -0
- package/src/components/control/__tests__/control-autofocus.browser.spec.tsx +107 -0
- package/src/components/control/control.tsx +20 -5
- package/src/components/control-array/__tests__/control-array-child-change.browser.spec.tsx +90 -0
- package/src/components/control-array/control-array.tsx +85 -13
- package/src/components/control-number/control-number.tsx +7 -0
- package/src/components/control-object/__tests__/control-object-clear.browser.spec.tsx +100 -0
- package/src/components/control-object/control-object.tsx +21 -2
- package/src/components/control-password/control-password.tsx +2 -1
- package/src/components/detail/__tests__/detail-layout.browser.spec.tsx +36 -0
- package/src/components/detail/detail-layout.tsx +20 -1
- package/src/components/email-body-frame/__tests__/email-body-frame.browser.spec.tsx +52 -0
- package/src/components/email-body-frame/email-body-frame.tsx +81 -0
- package/src/components/markdown-view/__tests__/markdown-view-mermaid.browser.spec.tsx +65 -2
- package/src/components/markdown-view/diagram/{FlowchartDiagramLabel.tsx → DiagramLabel.tsx} +14 -4
- package/src/components/markdown-view/diagram/FlowchartDiagram.tsx +1 -6
- package/src/components/markdown-view/diagram/FlowchartDiagramCluster.tsx +1 -1
- package/src/components/markdown-view/diagram/FlowchartDiagramEdge.tsx +2 -3
- package/src/components/markdown-view/diagram/FlowchartDiagramNode.tsx +2 -3
- package/src/components/markdown-view/diagram/MermaidFence.tsx +65 -15
- package/src/components/markdown-view/diagram/SequenceDiagram.tsx +203 -0
- package/src/components/markdown-view/diagram/SequenceDiagramFragment.tsx +120 -0
- package/src/components/markdown-view/diagram/SequenceDiagramMessage.tsx +100 -0
- package/src/components/markdown-view/diagram/SequenceDiagramNote.tsx +46 -0
- package/src/components/markdown-view/diagram/SequenceDiagramParticipant.tsx +80 -0
- package/src/components/markdown-view/diagram/SequenceDiagramParticipantActor.tsx +74 -0
- package/src/components/markdown-view/diagram/__tests__/sequence-diagram.browser.spec.tsx +267 -0
- package/src/components/markdown-view/diagram/layoutSequence.spec.ts +535 -0
- package/src/components/markdown-view/diagram/layoutSequence.ts +764 -0
- package/src/components/markdown-view/diagram/sequenceModel.ts +141 -0
- package/src/components/markdown-view/diagram/sequenceParser.spec.ts +495 -0
- package/src/components/markdown-view/diagram/sequenceParser.ts +443 -0
- package/src/components/markdown-view/markdown-view.css +65 -0
- package/src/components/markdown-view/markdown-view.tsx +34 -16
- package/src/components/nav-shell/__tests__/nav-tree-util.spec.ts +107 -1
- package/src/components/nav-shell/nav-page.tsx +8 -0
- package/src/components/nav-shell/nav-tree-util.ts +95 -2
- package/src/components/nav-shell/spotlight.tsx +22 -8
- package/src/components/nav-shell/use-nav-breadcrumbs.ts +9 -2
- package/src/components/nav-shell/use-nav-entries.ts +18 -2
- package/src/components/nav-shell/use-nav-tree.ts +4 -1
- package/src/components/ui/alert-dialog.tsx +1 -1
- package/src/components/ui/alert.tsx +2 -2
- package/src/components/ui/avatar.tsx +3 -3
- package/src/components/ui/breadcrumb.tsx +3 -3
- package/src/components/ui/card.tsx +5 -5
- package/src/components/ui/checkbox.tsx +1 -1
- package/src/components/ui/combobox.tsx +8 -8
- package/src/components/ui/command.tsx +4 -4
- package/src/components/ui/context-menu.tsx +7 -7
- package/src/components/ui/dialog.tsx +1 -1
- package/src/components/ui/drawer.tsx +6 -6
- package/src/components/ui/dropdown-menu.tsx +8 -14
- package/src/components/ui/empty.tsx +3 -3
- package/src/components/ui/hover-card.tsx +1 -1
- package/src/components/ui/input-group.tsx +2 -2
- package/src/components/ui/input-otp.tsx +1 -1
- package/src/components/ui/input.tsx +1 -1
- package/src/components/ui/label.tsx +1 -1
- package/src/components/ui/menubar.tsx +9 -9
- package/src/components/ui/pagination.tsx +1 -1
- package/src/components/ui/popover.tsx +1 -1
- package/src/components/ui/progress.tsx +1 -1
- package/src/components/ui/segmented.tsx +28 -0
- package/src/components/ui/select.tsx +1 -1
- package/src/components/ui/sheet.tsx +4 -4
- package/src/components/ui/switch.tsx +1 -1
- package/src/components/ui/table.tsx +6 -9
- package/src/components/ui/tabs.tsx +1 -1
- package/src/components/ui/textarea.tsx +1 -1
- package/src/components/ui/tooltip.tsx +3 -11
- package/src/components/use-dialog/__tests__/use-dialog-providers.browser.spec.tsx +61 -0
- package/src/hooks/use-mobile.ts +1 -1
- package/src/lib/__tests__/i18n-fr.spec.ts +27 -5
- package/src/lib/i18n-fr.ts +308 -1
- package/dist/components/language-toggle/language-toggle.d.ts +0 -8
- package/dist/components/language-toggle/language-toggle.d.ts.map +0 -1
- package/dist/components/language-toggle/language-toggle.js +0 -49
- package/dist/components/language-toggle/language-toggle.js.map +0 -1
- package/dist/components/markdown-view/diagram/FlowchartDiagramLabel.d.ts +0 -23
- package/dist/components/markdown-view/diagram/FlowchartDiagramLabel.d.ts.map +0 -1
- package/dist/components/markdown-view/diagram/FlowchartDiagramLabel.js.map +0 -1
- package/dist/components/ui/accordion.d.ts +0 -7
- package/dist/components/ui/accordion.d.ts.map +0 -1
- package/dist/components/ui/accordion.js +0 -55
- package/dist/components/ui/accordion.js.map +0 -1
- package/dist/components/ui/aspect-ratio.d.ts +0 -5
- package/dist/components/ui/aspect-ratio.d.ts.map +0 -1
- package/dist/components/ui/aspect-ratio.js +0 -15
- package/dist/components/ui/aspect-ratio.js.map +0 -1
- package/dist/components/ui/carousel.d.ts +0 -29
- package/dist/components/ui/carousel.d.ts.map +0 -1
- package/dist/components/ui/carousel.js +0 -144
- package/dist/components/ui/carousel.js.map +0 -1
- package/dist/components/ui/collapsible.d.ts +0 -6
- package/dist/components/ui/collapsible.d.ts.map +0 -1
- package/dist/components/ui/collapsible.js +0 -26
- package/dist/components/ui/collapsible.js.map +0 -1
- package/dist/components/ui/direction.d.ts +0 -2
- package/dist/components/ui/direction.d.ts.map +0 -1
- package/dist/components/ui/direction.js +0 -3
- package/dist/components/ui/item.d.ts +0 -23
- package/dist/components/ui/item.d.ts.map +0 -1
- package/dist/components/ui/item.js +0 -122
- package/dist/components/ui/item.js.map +0 -1
- package/dist/components/ui/navigation-menu.d.ts +0 -12
- package/dist/components/ui/navigation-menu.d.ts.map +0 -1
- package/dist/components/ui/navigation-menu.js +0 -84
- package/dist/components/ui/navigation-menu.js.map +0 -1
- package/dist/components/ui/radio-group.d.ts +0 -6
- package/dist/components/ui/radio-group.d.ts.map +0 -1
- package/dist/components/ui/radio-group.js +0 -29
- package/dist/components/ui/radio-group.js.map +0 -1
- package/dist/components/ui/scroll-area.d.ts +0 -5
- package/dist/components/ui/scroll-area.d.ts.map +0 -1
- package/dist/components/ui/scroll-area.js +0 -38
- package/dist/components/ui/scroll-area.js.map +0 -1
- package/dist/components/ui/toggle-group.d.ts +0 -12
- package/dist/components/ui/toggle-group.d.ts.map +0 -1
- package/dist/components/ui/toggle-group.js +0 -60
- package/dist/components/ui/toggle-group.js.map +0 -1
- package/dist/components/ui/toggle.d.ts +0 -9
- package/dist/components/ui/toggle.d.ts.map +0 -1
- package/dist/components/ui/toggle.js +0 -38
- package/dist/components/ui/toggle.js.map +0 -1
- package/src/components/language-toggle/language-toggle.tsx +0 -66
- package/src/components/ui/accordion.tsx +0 -77
- package/src/components/ui/aspect-ratio.tsx +0 -22
- package/src/components/ui/carousel.tsx +0 -258
- package/src/components/ui/collapsible.tsx +0 -21
- package/src/components/ui/direction.tsx +0 -6
- package/src/components/ui/item.tsx +0 -200
- package/src/components/ui/navigation-menu.tsx +0 -170
- package/src/components/ui/radio-group.tsx +0 -37
- package/src/components/ui/scroll-area.tsx +0 -53
- package/src/components/ui/toggle-group.tsx +0 -93
- package/src/components/ui/toggle.tsx +0 -44
|
@@ -0,0 +1,764 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
SequenceArrowHead,
|
|
3
|
+
SequenceFragment,
|
|
4
|
+
SequenceFragmentKind,
|
|
5
|
+
SequenceLineStyle,
|
|
6
|
+
SequenceModel,
|
|
7
|
+
SequenceNote,
|
|
8
|
+
SequenceStep,
|
|
9
|
+
} from "./sequenceModel.ts";
|
|
10
|
+
import {
|
|
11
|
+
DIAGRAM_FONT_SIZE,
|
|
12
|
+
DIAGRAM_LINE_HEIGHT,
|
|
13
|
+
measureLabel,
|
|
14
|
+
} from "./textMetrics.ts";
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The largest diagram that gets laid out. Above either cap the caller falls
|
|
18
|
+
* back to the code block.
|
|
19
|
+
*
|
|
20
|
+
* Unlike the flowchart caps these are NOT about time: layout here is O(n)
|
|
21
|
+
* arithmetic with no ranking to compute, and 300 rows lay out in under a
|
|
22
|
+
* millisecond. They are about legibility and DOM size - 30 lifelines is
|
|
23
|
+
* already far past what anyone can read, and every row is a handful of SVG
|
|
24
|
+
* elements on a page that may carry several diagrams.
|
|
25
|
+
*
|
|
26
|
+
* `MAX_SEQUENCE_MESSAGES` counts ROWS, notes included: a note occupies a
|
|
27
|
+
* row and costs a box, so counting only messages would let a note-heavy
|
|
28
|
+
* diagram past the cap it exists to enforce.
|
|
29
|
+
*/
|
|
30
|
+
export const MAX_SEQUENCE_PARTICIPANTS = 30;
|
|
31
|
+
export const MAX_SEQUENCE_MESSAGES = 300;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* The safety margin applied to the width a label needs in the gap between
|
|
35
|
+
* two lifelines. **Gap constraints only** - not participant boxes, which
|
|
36
|
+
* stay tight, and not note boxes, which carry their own padding.
|
|
37
|
+
*
|
|
38
|
+
* ## Why a margin exists here and nowhere else
|
|
39
|
+
*
|
|
40
|
+
* `textMetrics.ts` measures text from a generated per-character width table
|
|
41
|
+
* rather than from the DOM, which is what keeps this a pure function. The
|
|
42
|
+
* table was measured against `canvas.measureText` on the real Inter woff2
|
|
43
|
+
* and agrees **within ~1.3%**, all of it from rounding the ratios to three
|
|
44
|
+
* decimals.
|
|
45
|
+
*
|
|
46
|
+
* The asymmetry is what makes the margin necessary at all. A flowchart
|
|
47
|
+
* label sits INSIDE its box, so a 1.3% underestimate only eats padding. A
|
|
48
|
+
* sequence label sits IN THE GAP between two lifelines, so the same
|
|
49
|
+
* underestimate puts text on top of the neighbouring lifeline. 4% is three
|
|
50
|
+
* times the measured error.
|
|
51
|
+
*
|
|
52
|
+
* Do not "optimise" this away as a magic number: it is a measured 1.3% with
|
|
53
|
+
* headroom, and removing it makes long labels collide.
|
|
54
|
+
*/
|
|
55
|
+
export const GAP_LABEL_MARGIN = 1.04;
|
|
56
|
+
|
|
57
|
+
const DIAGRAM_PADDING = 12;
|
|
58
|
+
const PARTICIPANT_PAD_X = 14;
|
|
59
|
+
const PARTICIPANT_PAD_Y = 8;
|
|
60
|
+
const PARTICIPANT_MIN_WIDTH = 64;
|
|
61
|
+
/**
|
|
62
|
+
* Clear space between two adjacent participant boxes, before any label
|
|
63
|
+
* widens the gap.
|
|
64
|
+
*/
|
|
65
|
+
const PARTICIPANT_CLEARANCE = 26;
|
|
66
|
+
/**
|
|
67
|
+
* The stick figure an `actor` draws above its name.
|
|
68
|
+
*/
|
|
69
|
+
const ACTOR_FIGURE_HEIGHT = 32;
|
|
70
|
+
const ACTOR_LABEL_GAP = 4;
|
|
71
|
+
const ACTOR_MIN_WIDTH = 40;
|
|
72
|
+
|
|
73
|
+
const LIFELINE_TOP_GAP = 14;
|
|
74
|
+
const LIFELINE_BOTTOM_GAP = 14;
|
|
75
|
+
|
|
76
|
+
const MESSAGE_LABEL_GAP = 4;
|
|
77
|
+
const MESSAGE_ROW_GAP = 16;
|
|
78
|
+
/**
|
|
79
|
+
* Clearance between a message label and each lifeline it is centred
|
|
80
|
+
* between.
|
|
81
|
+
*/
|
|
82
|
+
const MESSAGE_LABEL_GUTTER = 10;
|
|
83
|
+
|
|
84
|
+
const SELF_LOOP_WIDTH = 32;
|
|
85
|
+
const SELF_LOOP_LABEL_GAP = 8;
|
|
86
|
+
const SELF_LOOP_MIN_HEIGHT = 26;
|
|
87
|
+
const SELF_LOOP_TOP_PAD = 4;
|
|
88
|
+
|
|
89
|
+
const NOTE_PAD_X = 10;
|
|
90
|
+
const NOTE_PAD_Y = 7;
|
|
91
|
+
const NOTE_ROW_GAP = 14;
|
|
92
|
+
/**
|
|
93
|
+
* How far a `Note over A,B` reaches past the two lifelines it spans.
|
|
94
|
+
*/
|
|
95
|
+
const NOTE_SPAN_OVERHANG = 10;
|
|
96
|
+
/**
|
|
97
|
+
* Clearance between a note box and any lifeline it is not attached to.
|
|
98
|
+
*/
|
|
99
|
+
const NOTE_CLEARANCE = 10;
|
|
100
|
+
|
|
101
|
+
const FRAGMENT_INSET = 9;
|
|
102
|
+
/**
|
|
103
|
+
* How far a depth-0 fragment box reaches past the widest content.
|
|
104
|
+
*/
|
|
105
|
+
const FRAGMENT_MARGIN = 14;
|
|
106
|
+
const FRAGMENT_TAB_PAD_X = 8;
|
|
107
|
+
const FRAGMENT_TAB_PAD_Y = 3;
|
|
108
|
+
const FRAGMENT_TOP_PAD = 8;
|
|
109
|
+
const FRAGMENT_BOTTOM_PAD = 10;
|
|
110
|
+
const FRAGMENT_AFTER_GAP = 6;
|
|
111
|
+
const FRAGMENT_MIN_WIDTH = 60;
|
|
112
|
+
const DIVIDER_GAP = 8;
|
|
113
|
+
|
|
114
|
+
export interface PositionedParticipant {
|
|
115
|
+
id: string;
|
|
116
|
+
/**
|
|
117
|
+
* The lines as MEASURED - wrapped and capped. Draw exactly these.
|
|
118
|
+
*/
|
|
119
|
+
lines: string[];
|
|
120
|
+
actor: boolean;
|
|
121
|
+
/**
|
|
122
|
+
* TOP-LEFT corner of the header box, the same convention the flowchart
|
|
123
|
+
* layout settled on. An emitter half a box off looks almost right, which
|
|
124
|
+
* is the worst way for this to be wrong.
|
|
125
|
+
*/
|
|
126
|
+
x: number;
|
|
127
|
+
y: number;
|
|
128
|
+
width: number;
|
|
129
|
+
height: number;
|
|
130
|
+
/**
|
|
131
|
+
* Where the lifeline runs. `centerX` is the lifeline's x, and the box is
|
|
132
|
+
* centred on it.
|
|
133
|
+
*/
|
|
134
|
+
centerX: number;
|
|
135
|
+
lifelineTop: number;
|
|
136
|
+
lifelineBottom: number;
|
|
137
|
+
/**
|
|
138
|
+
* TOP-LEFT y of the repeated footer box. Its `x`, `width` and `height`
|
|
139
|
+
* are the header's.
|
|
140
|
+
*/
|
|
141
|
+
bottomY: number;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export interface PositionedLabel {
|
|
145
|
+
lines: string[];
|
|
146
|
+
/**
|
|
147
|
+
* TOP-LEFT corner.
|
|
148
|
+
*/
|
|
149
|
+
x: number;
|
|
150
|
+
y: number;
|
|
151
|
+
width: number;
|
|
152
|
+
height: number;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export interface PositionedMessage {
|
|
156
|
+
from: string;
|
|
157
|
+
to: string;
|
|
158
|
+
line: SequenceLineStyle;
|
|
159
|
+
head: SequenceArrowHead;
|
|
160
|
+
self: boolean;
|
|
161
|
+
/**
|
|
162
|
+
* Two points for a normal message, four for the loop of a self-message.
|
|
163
|
+
* In from-to order, so the head marker lands on the receiver.
|
|
164
|
+
*/
|
|
165
|
+
points: Array<{ x: number; y: number }>;
|
|
166
|
+
/**
|
|
167
|
+
* Already carries the `autonumber` counter when the diagram declared one.
|
|
168
|
+
*/
|
|
169
|
+
label: PositionedLabel;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export interface PositionedNoteBox extends PositionedLabel {
|
|
173
|
+
placement: SequenceNote["placement"];
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export interface PositionedFragment {
|
|
177
|
+
kind: SequenceFragmentKind;
|
|
178
|
+
/**
|
|
179
|
+
* The condition, drawn next to the tab. May be empty.
|
|
180
|
+
*/
|
|
181
|
+
label: string;
|
|
182
|
+
depth: number;
|
|
183
|
+
/**
|
|
184
|
+
* TOP-LEFT corner of the box.
|
|
185
|
+
*/
|
|
186
|
+
x: number;
|
|
187
|
+
y: number;
|
|
188
|
+
width: number;
|
|
189
|
+
height: number;
|
|
190
|
+
/**
|
|
191
|
+
* The corner tab carrying the kind (`alt`, `opt`, `loop`).
|
|
192
|
+
*/
|
|
193
|
+
tabWidth: number;
|
|
194
|
+
tabHeight: number;
|
|
195
|
+
dividers: Array<{ y: number; label: string }>;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* A laid-out sequence diagram: data, not markup. No SVG, no React, no DOM.
|
|
200
|
+
*/
|
|
201
|
+
export interface PositionedSequence {
|
|
202
|
+
width: number;
|
|
203
|
+
height: number;
|
|
204
|
+
fontSize: number;
|
|
205
|
+
participants: PositionedParticipant[];
|
|
206
|
+
messages: PositionedMessage[];
|
|
207
|
+
notes: PositionedNoteBox[];
|
|
208
|
+
/**
|
|
209
|
+
* Outermost first, so the emitter draws them in order and gets z-order
|
|
210
|
+
* free, the way the flowchart clusters do.
|
|
211
|
+
*/
|
|
212
|
+
fragments: PositionedFragment[];
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Place a `SequenceModel` on a plane.
|
|
217
|
+
*
|
|
218
|
+
* **No layout library is involved, and none is coming back.** `graphre`
|
|
219
|
+
* ranks a node graph; here both axes are already decided by the source -
|
|
220
|
+
* participants left to right in declaration order, rows top to bottom in
|
|
221
|
+
* statement order - so layout is arithmetic. The only genuinely hard part
|
|
222
|
+
* is the column widths, which take two passes (see `columnCenters`).
|
|
223
|
+
*
|
|
224
|
+
* Returns `undefined` (never throws, never a partial diagram) for an empty
|
|
225
|
+
* model or one past the caps. The caller's fallback is the code block.
|
|
226
|
+
*/
|
|
227
|
+
export const layoutSequence = (
|
|
228
|
+
model: SequenceModel,
|
|
229
|
+
fontSize: number = DIAGRAM_FONT_SIZE,
|
|
230
|
+
): PositionedSequence | undefined => {
|
|
231
|
+
if (model.participants.length === 0 || model.steps.length === 0)
|
|
232
|
+
return undefined;
|
|
233
|
+
if (model.participants.length > MAX_SEQUENCE_PARTICIPANTS) return undefined;
|
|
234
|
+
if (model.steps.length > MAX_SEQUENCE_MESSAGES) return undefined;
|
|
235
|
+
|
|
236
|
+
const index = new Map(model.participants.map((p, i) => [p.id, i]));
|
|
237
|
+
const heads = model.participants.map((participant) =>
|
|
238
|
+
measureHead(participant.lines, participant.actor, fontSize),
|
|
239
|
+
);
|
|
240
|
+
// ⚠️ Numbering happens BEFORE anything is measured. The counter is part of
|
|
241
|
+
// the label, so measuring first and numbering after makes every column
|
|
242
|
+
// too narrow - and it stays invisible until a diagram reaches ten
|
|
243
|
+
// messages and the labels go double-digit.
|
|
244
|
+
const labels = measureSteps(model, fontSize);
|
|
245
|
+
|
|
246
|
+
const centers = columnCenters(model, index, heads, labels);
|
|
247
|
+
const headerHeight = Math.max(...heads.map((head) => head.height));
|
|
248
|
+
|
|
249
|
+
const rows = layoutRows(model, index, centers, labels, {
|
|
250
|
+
fontSize,
|
|
251
|
+
top: DIAGRAM_PADDING + headerHeight + LIFELINE_TOP_GAP,
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
const participants = model.participants.map((participant, i) => ({
|
|
255
|
+
id: participant.id,
|
|
256
|
+
lines: heads[i].lines,
|
|
257
|
+
actor: participant.actor,
|
|
258
|
+
// Header boxes are bottom-aligned so every lifeline starts on the same
|
|
259
|
+
// y, whatever mix of one-line names, wrapped names and actors is on the
|
|
260
|
+
// row.
|
|
261
|
+
x: centers[i] - heads[i].width / 2,
|
|
262
|
+
y: DIAGRAM_PADDING + headerHeight - heads[i].height,
|
|
263
|
+
width: heads[i].width,
|
|
264
|
+
height: heads[i].height,
|
|
265
|
+
centerX: centers[i],
|
|
266
|
+
lifelineTop: DIAGRAM_PADDING + headerHeight,
|
|
267
|
+
lifelineBottom: rows.bottom,
|
|
268
|
+
bottomY: rows.bottom,
|
|
269
|
+
}));
|
|
270
|
+
|
|
271
|
+
const content = contentBounds(participants, rows);
|
|
272
|
+
const fragments = layoutFragments(model, rows, content, fontSize);
|
|
273
|
+
|
|
274
|
+
const minX = fragments.length ? content.minX - FRAGMENT_MARGIN : content.minX;
|
|
275
|
+
const maxX = fragments.length ? content.maxX + FRAGMENT_MARGIN : content.maxX;
|
|
276
|
+
const dx = DIAGRAM_PADDING - minX;
|
|
277
|
+
|
|
278
|
+
return {
|
|
279
|
+
width: maxX - minX + DIAGRAM_PADDING * 2,
|
|
280
|
+
height: rows.bottom + headerHeight + DIAGRAM_PADDING,
|
|
281
|
+
fontSize,
|
|
282
|
+
participants: participants.map((participant) => ({
|
|
283
|
+
...participant,
|
|
284
|
+
x: participant.x + dx,
|
|
285
|
+
centerX: participant.centerX + dx,
|
|
286
|
+
})),
|
|
287
|
+
messages: rows.messages.map((message) => ({
|
|
288
|
+
...message,
|
|
289
|
+
points: message.points.map((point) => ({ x: point.x + dx, y: point.y })),
|
|
290
|
+
label: { ...message.label, x: message.label.x + dx },
|
|
291
|
+
})),
|
|
292
|
+
notes: rows.notes.map((note) => ({ ...note, x: note.x + dx })),
|
|
293
|
+
fragments: fragments.map((fragment) => ({
|
|
294
|
+
...fragment,
|
|
295
|
+
x: fragment.x + dx,
|
|
296
|
+
})),
|
|
297
|
+
};
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
interface Measured {
|
|
301
|
+
width: number;
|
|
302
|
+
height: number;
|
|
303
|
+
lines: string[];
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* The header box of one participant. An `actor` is a stick figure with its
|
|
308
|
+
* name underneath rather than a box around it, so it is taller and needs no
|
|
309
|
+
* horizontal padding.
|
|
310
|
+
*/
|
|
311
|
+
const measureHead = (
|
|
312
|
+
lines: string[],
|
|
313
|
+
actor: boolean,
|
|
314
|
+
fontSize: number,
|
|
315
|
+
): Measured => {
|
|
316
|
+
const label = measureLabel(lines, fontSize);
|
|
317
|
+
if (actor)
|
|
318
|
+
return {
|
|
319
|
+
width: Math.max(label.width, ACTOR_MIN_WIDTH),
|
|
320
|
+
height: ACTOR_FIGURE_HEIGHT + ACTOR_LABEL_GAP + label.height,
|
|
321
|
+
lines: label.lines,
|
|
322
|
+
};
|
|
323
|
+
return {
|
|
324
|
+
width: Math.max(label.width + PARTICIPANT_PAD_X * 2, PARTICIPANT_MIN_WIDTH),
|
|
325
|
+
height: label.height + PARTICIPANT_PAD_Y * 2,
|
|
326
|
+
lines: label.lines,
|
|
327
|
+
};
|
|
328
|
+
};
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* Measure every row's label once, applying `autonumber` first.
|
|
332
|
+
*
|
|
333
|
+
* A note's measurement is its BOX (label plus padding); a message's is its
|
|
334
|
+
* bare label, because a message label is drawn straight onto the diagram.
|
|
335
|
+
*/
|
|
336
|
+
const measureSteps = (model: SequenceModel, fontSize: number): Measured[] => {
|
|
337
|
+
let counter = model.autonumber?.start ?? 0;
|
|
338
|
+
return model.steps.map((step) => {
|
|
339
|
+
if (step.kind === "note") {
|
|
340
|
+
const label = measureLabel(step.lines, fontSize);
|
|
341
|
+
return {
|
|
342
|
+
width: label.width + NOTE_PAD_X * 2,
|
|
343
|
+
height: label.height + NOTE_PAD_Y * 2,
|
|
344
|
+
lines: label.lines,
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
if (!model.autonumber) return measureLabel(step.lines, fontSize);
|
|
348
|
+
|
|
349
|
+
const number = counter;
|
|
350
|
+
counter += model.autonumber.step;
|
|
351
|
+
const [first, ...rest] = step.lines;
|
|
352
|
+
return measureLabel(
|
|
353
|
+
[first ? `${number}. ${first}` : `${number}`, ...rest],
|
|
354
|
+
fontSize,
|
|
355
|
+
);
|
|
356
|
+
});
|
|
357
|
+
};
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
* Where each lifeline sits on the x axis, in two passes.
|
|
361
|
+
*
|
|
362
|
+
* **Pass one** gives every adjacent pair the room its two boxes need side
|
|
363
|
+
* by side.
|
|
364
|
+
*
|
|
365
|
+
* **Pass two** walks every message and note and widens the span it covers
|
|
366
|
+
* until its label fits. A label is centred over its whole span, so a
|
|
367
|
+
* message from participant 1 to participant 5 constrains the sum of four
|
|
368
|
+
* gaps rather than any one of them, and the shortfall is spread evenly
|
|
369
|
+
* across the gaps it crosses. Gaps only ever grow, so one pass over the
|
|
370
|
+
* constraints is enough: widening for a later label can never break an
|
|
371
|
+
* earlier one.
|
|
372
|
+
*
|
|
373
|
+
* The centres come back starting at 0. The caller translates once, at the
|
|
374
|
+
* end, after the true bounding box is known.
|
|
375
|
+
*/
|
|
376
|
+
const columnCenters = (
|
|
377
|
+
model: SequenceModel,
|
|
378
|
+
index: Map<string, number>,
|
|
379
|
+
heads: Measured[],
|
|
380
|
+
labels: Measured[],
|
|
381
|
+
): number[] => {
|
|
382
|
+
const count = model.participants.length;
|
|
383
|
+
const gaps: number[] = [];
|
|
384
|
+
for (let i = 0; i < count - 1; i++)
|
|
385
|
+
gaps.push(
|
|
386
|
+
heads[i].width / 2 + heads[i + 1].width / 2 + PARTICIPANT_CLEARANCE,
|
|
387
|
+
);
|
|
388
|
+
|
|
389
|
+
const widen = (from: number, to: number, required: number): void => {
|
|
390
|
+
// A constraint can legitimately point off the end of the row: a note to
|
|
391
|
+
// the left of the FIRST lifeline has no gap to widen, and the space it
|
|
392
|
+
// needs falls out of the final bounding box instead. Clamping here
|
|
393
|
+
// rather than at each call site is what keeps those cases from reading
|
|
394
|
+
// `gaps[-1]` and poisoning every later width with a NaN.
|
|
395
|
+
if (to <= from || from < 0 || to > gaps.length) return;
|
|
396
|
+
let current = 0;
|
|
397
|
+
for (let i = from; i < to; i++) current += gaps[i];
|
|
398
|
+
if (current >= required) return;
|
|
399
|
+
const extra = (required - current) / (to - from);
|
|
400
|
+
for (let i = from; i < to; i++) gaps[i] += extra;
|
|
401
|
+
};
|
|
402
|
+
|
|
403
|
+
for (const [at, step] of model.steps.entries()) {
|
|
404
|
+
const label = labels[at];
|
|
405
|
+
if (step.kind === "message") {
|
|
406
|
+
const from = index.get(step.from);
|
|
407
|
+
const to = index.get(step.to);
|
|
408
|
+
if (from === undefined || to === undefined) continue;
|
|
409
|
+
|
|
410
|
+
if (step.self) {
|
|
411
|
+
// The loop hangs to the RIGHT of its lifeline with the label beyond
|
|
412
|
+
// it, so it eats into one gap rather than spanning several. At the
|
|
413
|
+
// last participant there is no gap to eat, and the clearance falls
|
|
414
|
+
// out of the final bounding box instead.
|
|
415
|
+
if (from >= count - 1) continue;
|
|
416
|
+
widen(
|
|
417
|
+
from,
|
|
418
|
+
from + 1,
|
|
419
|
+
SELF_LOOP_WIDTH +
|
|
420
|
+
SELF_LOOP_LABEL_GAP +
|
|
421
|
+
label.width * GAP_LABEL_MARGIN +
|
|
422
|
+
MESSAGE_LABEL_GUTTER,
|
|
423
|
+
);
|
|
424
|
+
continue;
|
|
425
|
+
}
|
|
426
|
+
widen(
|
|
427
|
+
Math.min(from, to),
|
|
428
|
+
Math.max(from, to),
|
|
429
|
+
label.width * GAP_LABEL_MARGIN + MESSAGE_LABEL_GUTTER * 2,
|
|
430
|
+
);
|
|
431
|
+
continue;
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
const anchors = step.participants
|
|
435
|
+
.map((id) => index.get(id))
|
|
436
|
+
.filter((at): at is number => at !== undefined);
|
|
437
|
+
if (anchors.length === 0) continue;
|
|
438
|
+
|
|
439
|
+
if (step.placement === "over" && anchors.length > 1) {
|
|
440
|
+
const from = Math.min(...anchors);
|
|
441
|
+
const to = Math.max(...anchors);
|
|
442
|
+
// A note box carries its own padding, so no margin is applied to it -
|
|
443
|
+
// it is not text sitting in a gap.
|
|
444
|
+
widen(from, to, label.width - NOTE_SPAN_OVERHANG * 2);
|
|
445
|
+
continue;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
const anchor = anchors[0];
|
|
449
|
+
if (step.placement === "over") {
|
|
450
|
+
// Centred on one lifeline, so it eats half its width into each
|
|
451
|
+
// neighbouring gap.
|
|
452
|
+
widen(anchor - 1, anchor, label.width / 2 + NOTE_CLEARANCE);
|
|
453
|
+
widen(anchor, anchor + 1, label.width / 2 + NOTE_CLEARANCE);
|
|
454
|
+
continue;
|
|
455
|
+
}
|
|
456
|
+
if (step.placement === "left")
|
|
457
|
+
widen(anchor - 1, anchor, label.width + NOTE_CLEARANCE * 2);
|
|
458
|
+
else widen(anchor, anchor + 1, label.width + NOTE_CLEARANCE * 2);
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
const centers = [0];
|
|
462
|
+
for (const gap of gaps) centers.push(centers[centers.length - 1] + gap);
|
|
463
|
+
return centers;
|
|
464
|
+
};
|
|
465
|
+
|
|
466
|
+
interface RowContext {
|
|
467
|
+
fontSize: number;
|
|
468
|
+
top: number;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
interface Rows {
|
|
472
|
+
messages: PositionedMessage[];
|
|
473
|
+
notes: PositionedNoteBox[];
|
|
474
|
+
/**
|
|
475
|
+
* y where every lifeline stops, and the footer boxes start.
|
|
476
|
+
*/
|
|
477
|
+
bottom: number;
|
|
478
|
+
/**
|
|
479
|
+
* Per fragment, the box top and bottom and each divider's y, keyed by the
|
|
480
|
+
* fragment's position in `model.fragments`.
|
|
481
|
+
*/
|
|
482
|
+
spans: Map<number, { top: number; bottom: number; dividers: number[] }>;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
/**
|
|
486
|
+
* One sequential pass down the rows, assigning y.
|
|
487
|
+
*
|
|
488
|
+
* This is the whole reason the model is flat: a nested tree would force
|
|
489
|
+
* this to recurse while threading the cursor through it, and a fragment box
|
|
490
|
+
* would still have to be min/max over the rows it turned out to contain.
|
|
491
|
+
*/
|
|
492
|
+
const layoutRows = (
|
|
493
|
+
model: SequenceModel,
|
|
494
|
+
index: Map<string, number>,
|
|
495
|
+
centers: number[],
|
|
496
|
+
labels: Measured[],
|
|
497
|
+
context: RowContext,
|
|
498
|
+
): Rows => {
|
|
499
|
+
const messages: PositionedMessage[] = [];
|
|
500
|
+
const notes: PositionedNoteBox[] = [];
|
|
501
|
+
const spans = new Map<
|
|
502
|
+
number,
|
|
503
|
+
{ top: number; bottom: number; dividers: number[] }
|
|
504
|
+
>();
|
|
505
|
+
const tabHeight =
|
|
506
|
+
context.fontSize * DIAGRAM_LINE_HEIGHT + FRAGMENT_TAB_PAD_Y * 2;
|
|
507
|
+
|
|
508
|
+
// Outermost first on the way in, innermost first on the way out, so a
|
|
509
|
+
// nested box always sits strictly inside the one that contains it.
|
|
510
|
+
const opening = byStep(model, (fragment) => fragment.from, 1);
|
|
511
|
+
const closing = byStep(model, (fragment) => fragment.to, -1);
|
|
512
|
+
const dividing = dividersByStep(model);
|
|
513
|
+
|
|
514
|
+
let y = context.top;
|
|
515
|
+
|
|
516
|
+
for (const [at, step] of model.steps.entries()) {
|
|
517
|
+
for (const owner of opening.get(at) ?? []) {
|
|
518
|
+
spans.set(owner, { top: y, bottom: y, dividers: [] });
|
|
519
|
+
y += tabHeight + FRAGMENT_TOP_PAD;
|
|
520
|
+
}
|
|
521
|
+
for (const owner of dividing.get(at) ?? []) {
|
|
522
|
+
const span = spans.get(owner);
|
|
523
|
+
if (!span) continue;
|
|
524
|
+
y += DIVIDER_GAP;
|
|
525
|
+
span.dividers.push(y);
|
|
526
|
+
// The `else` condition is drawn BELOW its divider, because that is
|
|
527
|
+
// the branch it names, so the room for it goes below too.
|
|
528
|
+
y += context.fontSize * DIAGRAM_LINE_HEIGHT + DIVIDER_GAP;
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
const label = labels[at];
|
|
532
|
+
y =
|
|
533
|
+
step.kind === "note"
|
|
534
|
+
? placeNote(step, label, index, centers, y, notes)
|
|
535
|
+
: placeMessage(step, label, index, centers, y, messages);
|
|
536
|
+
|
|
537
|
+
for (const owner of closing.get(at) ?? []) {
|
|
538
|
+
const span = spans.get(owner);
|
|
539
|
+
if (!span) continue;
|
|
540
|
+
y += FRAGMENT_BOTTOM_PAD;
|
|
541
|
+
span.bottom = y;
|
|
542
|
+
y += FRAGMENT_AFTER_GAP;
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
return { messages, notes, bottom: y + LIFELINE_BOTTOM_GAP, spans };
|
|
547
|
+
};
|
|
548
|
+
|
|
549
|
+
/**
|
|
550
|
+
* Fragment indices grouped by the step they open or close at, sorted so
|
|
551
|
+
* outer fragments come first on the way in and last on the way out.
|
|
552
|
+
*/
|
|
553
|
+
const byStep = (
|
|
554
|
+
model: SequenceModel,
|
|
555
|
+
pick: (fragment: SequenceFragment) => number,
|
|
556
|
+
order: 1 | -1,
|
|
557
|
+
): Map<number, number[]> => {
|
|
558
|
+
const out = new Map<number, number[]>();
|
|
559
|
+
for (const [at, fragment] of model.fragments.entries())
|
|
560
|
+
push(out, pick(fragment), at);
|
|
561
|
+
for (const list of out.values())
|
|
562
|
+
list.sort(
|
|
563
|
+
(a, b) => (model.fragments[a].depth - model.fragments[b].depth) * order,
|
|
564
|
+
);
|
|
565
|
+
return out;
|
|
566
|
+
};
|
|
567
|
+
|
|
568
|
+
/**
|
|
569
|
+
* Which fragments have an `else` at each step, outermost first: a divider
|
|
570
|
+
* belonging to an outer box has to be drawn above one belonging to a box
|
|
571
|
+
* nested inside it, or the two branches read as swapped.
|
|
572
|
+
*/
|
|
573
|
+
const dividersByStep = (model: SequenceModel): Map<number, number[]> => {
|
|
574
|
+
const out = new Map<number, number[]>();
|
|
575
|
+
for (const [at, fragment] of model.fragments.entries())
|
|
576
|
+
for (const divider of fragment.dividers) push(out, divider.at, at);
|
|
577
|
+
for (const list of out.values())
|
|
578
|
+
list.sort((a, b) => model.fragments[a].depth - model.fragments[b].depth);
|
|
579
|
+
return out;
|
|
580
|
+
};
|
|
581
|
+
|
|
582
|
+
const push = (map: Map<number, number[]>, key: number, value: number): void => {
|
|
583
|
+
const list = map.get(key);
|
|
584
|
+
if (list) list.push(value);
|
|
585
|
+
else map.set(key, [value]);
|
|
586
|
+
};
|
|
587
|
+
|
|
588
|
+
const placeMessage = (
|
|
589
|
+
step: Extract<SequenceStep, { kind: "message" }>,
|
|
590
|
+
label: Measured,
|
|
591
|
+
index: Map<string, number>,
|
|
592
|
+
centers: number[],
|
|
593
|
+
y: number,
|
|
594
|
+
out: PositionedMessage[],
|
|
595
|
+
): number => {
|
|
596
|
+
const from = index.get(step.from);
|
|
597
|
+
const to = index.get(step.to);
|
|
598
|
+
if (from === undefined || to === undefined) return y;
|
|
599
|
+
|
|
600
|
+
if (step.self) {
|
|
601
|
+
const height = Math.max(SELF_LOOP_MIN_HEIGHT, label.height + 6);
|
|
602
|
+
const top = y + SELF_LOOP_TOP_PAD;
|
|
603
|
+
const bottom = top + height;
|
|
604
|
+
const x = centers[from];
|
|
605
|
+
out.push({
|
|
606
|
+
from: step.from,
|
|
607
|
+
to: step.to,
|
|
608
|
+
line: step.line,
|
|
609
|
+
head: step.head,
|
|
610
|
+
self: true,
|
|
611
|
+
points: [
|
|
612
|
+
{ x, y: top },
|
|
613
|
+
{ x: x + SELF_LOOP_WIDTH, y: top },
|
|
614
|
+
{ x: x + SELF_LOOP_WIDTH, y: bottom },
|
|
615
|
+
{ x, y: bottom },
|
|
616
|
+
],
|
|
617
|
+
label: {
|
|
618
|
+
lines: label.lines,
|
|
619
|
+
x: x + SELF_LOOP_WIDTH + SELF_LOOP_LABEL_GAP,
|
|
620
|
+
y: (top + bottom) / 2 - label.height / 2,
|
|
621
|
+
width: label.width,
|
|
622
|
+
height: label.height,
|
|
623
|
+
},
|
|
624
|
+
});
|
|
625
|
+
return bottom + MESSAGE_ROW_GAP;
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
const lineY = y + label.height + MESSAGE_LABEL_GAP;
|
|
629
|
+
out.push({
|
|
630
|
+
from: step.from,
|
|
631
|
+
to: step.to,
|
|
632
|
+
line: step.line,
|
|
633
|
+
head: step.head,
|
|
634
|
+
self: false,
|
|
635
|
+
points: [
|
|
636
|
+
{ x: centers[from], y: lineY },
|
|
637
|
+
{ x: centers[to], y: lineY },
|
|
638
|
+
],
|
|
639
|
+
label: {
|
|
640
|
+
lines: label.lines,
|
|
641
|
+
x: (centers[from] + centers[to]) / 2 - label.width / 2,
|
|
642
|
+
y,
|
|
643
|
+
width: label.width,
|
|
644
|
+
height: label.height,
|
|
645
|
+
},
|
|
646
|
+
});
|
|
647
|
+
return lineY + MESSAGE_ROW_GAP;
|
|
648
|
+
};
|
|
649
|
+
|
|
650
|
+
const placeNote = (
|
|
651
|
+
step: SequenceNote,
|
|
652
|
+
label: Measured,
|
|
653
|
+
index: Map<string, number>,
|
|
654
|
+
centers: number[],
|
|
655
|
+
y: number,
|
|
656
|
+
out: PositionedNoteBox[],
|
|
657
|
+
): number => {
|
|
658
|
+
const anchors = step.participants
|
|
659
|
+
.map((id) => index.get(id))
|
|
660
|
+
.filter((at): at is number => at !== undefined);
|
|
661
|
+
if (anchors.length === 0) return y;
|
|
662
|
+
|
|
663
|
+
const from = Math.min(...anchors);
|
|
664
|
+
const to = Math.max(...anchors);
|
|
665
|
+
const width =
|
|
666
|
+
step.placement === "over" && to > from
|
|
667
|
+
? Math.max(
|
|
668
|
+
label.width,
|
|
669
|
+
centers[to] - centers[from] + NOTE_SPAN_OVERHANG * 2,
|
|
670
|
+
)
|
|
671
|
+
: label.width;
|
|
672
|
+
|
|
673
|
+
const x =
|
|
674
|
+
step.placement === "left"
|
|
675
|
+
? centers[from] - NOTE_CLEARANCE - width
|
|
676
|
+
: step.placement === "right"
|
|
677
|
+
? centers[from] + NOTE_CLEARANCE
|
|
678
|
+
: (centers[from] + centers[to]) / 2 - width / 2;
|
|
679
|
+
|
|
680
|
+
out.push({
|
|
681
|
+
placement: step.placement,
|
|
682
|
+
lines: label.lines,
|
|
683
|
+
x,
|
|
684
|
+
y,
|
|
685
|
+
width,
|
|
686
|
+
height: label.height,
|
|
687
|
+
});
|
|
688
|
+
return y + label.height + NOTE_ROW_GAP;
|
|
689
|
+
};
|
|
690
|
+
|
|
691
|
+
interface Bounds {
|
|
692
|
+
minX: number;
|
|
693
|
+
maxX: number;
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
/**
|
|
697
|
+
* The x extent of everything except the fragment boxes, which are sized
|
|
698
|
+
* FROM it. A note hanging off the first lifeline and a self-message looping
|
|
699
|
+
* off the last one are the two things that reach past the participants.
|
|
700
|
+
*/
|
|
701
|
+
const contentBounds = (
|
|
702
|
+
participants: PositionedParticipant[],
|
|
703
|
+
rows: Rows,
|
|
704
|
+
): Bounds => {
|
|
705
|
+
let minX = Number.POSITIVE_INFINITY;
|
|
706
|
+
let maxX = Number.NEGATIVE_INFINITY;
|
|
707
|
+
const cover = (from: number, to: number) => {
|
|
708
|
+
minX = Math.min(minX, from);
|
|
709
|
+
maxX = Math.max(maxX, to);
|
|
710
|
+
};
|
|
711
|
+
|
|
712
|
+
for (const participant of participants)
|
|
713
|
+
cover(participant.x, participant.x + participant.width);
|
|
714
|
+
for (const note of rows.notes) cover(note.x, note.x + note.width);
|
|
715
|
+
for (const message of rows.messages) {
|
|
716
|
+
for (const point of message.points) cover(point.x, point.x);
|
|
717
|
+
cover(message.label.x, message.label.x + message.label.width);
|
|
718
|
+
}
|
|
719
|
+
return { minX, maxX };
|
|
720
|
+
};
|
|
721
|
+
|
|
722
|
+
/**
|
|
723
|
+
* Fragment boxes span the whole diagram, inset by depth, exactly as mermaid
|
|
724
|
+
* draws them. Fitting a box to only the participants it happens to mention
|
|
725
|
+
* was considered and dropped: a box that changes width with its contents
|
|
726
|
+
* reads as a shape rather than as a scope.
|
|
727
|
+
*/
|
|
728
|
+
const layoutFragments = (
|
|
729
|
+
model: SequenceModel,
|
|
730
|
+
rows: Rows,
|
|
731
|
+
content: Bounds,
|
|
732
|
+
fontSize: number,
|
|
733
|
+
): PositionedFragment[] =>
|
|
734
|
+
model.fragments
|
|
735
|
+
.map((fragment, at) => {
|
|
736
|
+
const span = rows.spans.get(at);
|
|
737
|
+
if (!span) return undefined;
|
|
738
|
+
const x =
|
|
739
|
+
content.minX - FRAGMENT_MARGIN + fragment.depth * FRAGMENT_INSET;
|
|
740
|
+
const right =
|
|
741
|
+
content.maxX + FRAGMENT_MARGIN - fragment.depth * FRAGMENT_INSET;
|
|
742
|
+
const label = measureLabel([fragment.kind], fontSize);
|
|
743
|
+
return {
|
|
744
|
+
kind: fragment.kind,
|
|
745
|
+
label: fragment.label,
|
|
746
|
+
depth: fragment.depth,
|
|
747
|
+
x,
|
|
748
|
+
y: span.top,
|
|
749
|
+
width: Math.max(right - x, FRAGMENT_MIN_WIDTH),
|
|
750
|
+
height: span.bottom - span.top,
|
|
751
|
+
tabWidth: label.width + FRAGMENT_TAB_PAD_X * 2,
|
|
752
|
+
tabHeight: label.height + FRAGMENT_TAB_PAD_Y * 2,
|
|
753
|
+
dividers: fragment.dividers.map((divider, i) => ({
|
|
754
|
+
y: span.dividers[i] ?? span.top,
|
|
755
|
+
label: divider.label,
|
|
756
|
+
})),
|
|
757
|
+
};
|
|
758
|
+
})
|
|
759
|
+
.filter(
|
|
760
|
+
(fragment): fragment is PositionedFragment => fragment !== undefined,
|
|
761
|
+
)
|
|
762
|
+
// Order IS z-order in SVG, so the outermost box goes down first and a
|
|
763
|
+
// nested one draws on top of it, with no z-index anywhere.
|
|
764
|
+
.sort((a, b) => a.depth - b.depth);
|