@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown-view.js","names":["pre"],"sources":["../../../src/components/markdown-view/markdown-view.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport \"./markdown-view.css\";\nimport { lazy, Suspense } from \"react\";\nimport ReactMarkdown from \"react-markdown\";\nimport rehypeHighlight from \"rehype-highlight\";\nimport remarkGfm from \"remark-gfm\";\n\nimport { DiagramErrorBoundary } from \"./diagram/DiagramErrorBoundary.tsx\";\n\n/**\n * Parser + `graphre` + emitter, pulled in ONLY when a document actually\n * contains a mermaid fence.\n *\n * This is the constraint the whole diagram layer exists under: a document\n * with no diagram must pay nothing at all. One with a diagram pays roughly\n * 20-25 kB gzip once, then it is cached.\n *\n * ⚠️ A lazy import a bundler decides to inline fails silently: the feature\n * still works and the cost moves into the entry chunk. After changing this,\n * build and confirm `graphre` is in a chunk of its own:\n *\n * yarn w lore build\n * grep -rl addBorderSegments apps/lore/dist/\n */\nconst MermaidFence = lazy(() => import(\"./diagram/MermaidFence.tsx\"));\n\nexport interface MarkdownViewProps {\n content: string;\n /**\n * Extra classes for the prose root, merged after the defaults so a caller\n * can set its own reading face or measure. The defaults it overrides are\n * `text-sm leading-relaxed` — a surface that sets prose in a display serif\n * needs both, and no parent wrapper can supply them, since they sit on\n * this element rather than being inherited.\n */\n className?: string;\n}\n\n/**\n * Renders markdown as formatted prose.\n *\n * ## Diagrams\n *\n * A ` ```mermaid ` fence containing a **`flowchart`** is drawn as an SVG\n * diagram instead of a code block, themed from the app's own CSS variables\n * so dark mode needs no second palette. The renderer is in-house: only\n * layout is imported (`graphre`, dagre in TypeScript, ~15.5 kB gzip), and\n * the whole thing is one lazy chunk pulled in only when a document actually\n * contains a fence, so a document with no diagram pays nothing.\n *\n * The drawn subset is `flowchart TD|TB|LR|RL|BT`; the four node shapes\n * `[rect]` `(rounded)` `{diamond}` `((circle))`, with every other mermaid\n * bracket pair consumed and mapped onto them; edges `-->` `---` `-.->`\n * `==>` `<-->` with labels in both the `-->|text|` and `-- text -->` forms;\n * chains, `&` fans, `<br/>` line breaks and nested `subgraph`.\n *\n * **Everything else degrades to the code block, silently.**\n * `sequenceDiagram`, `classDiagram`, `gantt` and mindmaps are not drawn,\n * `style` / `classDef` are ignored, and a parse failure or a graph past the\n * node cap renders the plain fence rather than an error. Agents write\n * invalid mermaid, and a red box in the middle of a document is worse than\n * a grey fence. See `packages/@alepha/ui/DOC.md` for the full table.\n *\n * ## Raw HTML\n *\n * No raw HTML is ever rendered as markup: react-markdown's default is to\n * escape a raw node to text, and this component deliberately mounts no\n * plugin that changes that. A narrow `rehypeSafeImg` plugin used to promote\n * a lone `<img …>` — the one thing MDXEditor emitted for a *resized* image —\n * and was deleted along with the editor that produced it, since nothing\n * writes that markup anymore.\n *\n * Do not reach for `rehype-raw` to bring the capability back: this renders\n * content authored by one user to another, so every raw tag becoming live\n * markup turns every markdown surface in every app into an injection point.\n */\nexport const MarkdownView = (props: MarkdownViewProps) => {\n return (\n <div\n className={`max-w-none text-sm leading-relaxed ${props.className ?? \"\"}`}\n >\n <ReactMarkdown\n remarkPlugins={[remarkGfm]}\n rehypePlugins={[\n // `plainText` claims the fence BEFORE highlighting runs: hljs would\n // otherwise tokenise the diagram source, and the fallback would be a\n // soup of spans instead of the text the author wrote.\n //\n // `ignoreMissing` is gone: it no longer exists in v7, where an\n // unknown language already produces a vfile message rather than a\n // throw.\n [rehypeHighlight, { detect: true, plainText: [\"mermaid\"] }],\n ]}\n components={{\n h1: ({ children }) => (\n <h1 className=\"mt-6 mb-3 text-2xl font-semibold tracking-tight\">\n {children}\n </h1>\n ),\n h2: ({ children }) => (\n <h2 className=\"mt-6 mb-2 text-xl font-semibold tracking-tight\">\n {children}\n </h2>\n ),\n h3: ({ children }) => (\n <h3 className=\"mt-4 mb-2 text-base font-semibold\">{children}</h3>\n ),\n p: ({ children }) => <p className=\"my-3\">{children}</p>,\n ul: ({ children }) => (\n <ul className=\"my-3 list-disc space-y-1 pl-5\">{children}</ul>\n ),\n ol: ({ children }) => (\n <ol className=\"my-3 list-decimal space-y-1 pl-5\">{children}</ol>\n ),\n li: ({ children }) => <li className=\"pl-1\">{children}</li>,\n a: ({ href, children }) => (\n <a\n href={href}\n className=\"text-primary decoration-primary/50 hover:decoration-primary underline underline-offset-4\"\n >\n {children}\n </a>\n ),\n code: ({ children, className }) => {\n const isBlock =\n className?.includes(\"language-\") || className?.includes(\"hljs\");\n if (isBlock) {\n return <code className={`${className} text-xs`}>{children}</code>;\n }\n return (\n <code className=\"bg-muted rounded px-1.5 py-0.5 font-mono text-[0.85em]\">\n {children}\n </code>\n );\n },\n pre: ({ children, node }) => {\n const block = (\n <pre className=\"border-border my-4 overflow-auto rounded-md border bg-transparent p-3 text-xs\">\n {children}\n </pre>\n );\n const source = mermaidSource(node);\n if (!source) return block;\n return (\n <DiagramErrorBoundary fallback={block}>\n {/*\n The loading state IS the code block: the fence is already on\n screen, and swapping it for the diagram when the chunk lands\n costs no spinner and no second layout.\n */}\n <Suspense fallback={block}>\n <MermaidFence source={source} fallback={block} />\n </Suspense>\n </DiagramErrorBoundary>\n );\n },\n blockquote: ({ children }) => (\n <blockquote className=\"border-muted-foreground/30 my-3 border-l-2 pl-4 italic\">\n {children}\n </blockquote>\n ),\n hr: () => <hr className=\"border-border my-6\" />,\n table: ({ children }) => (\n <table className=\"my-4 border-collapse text-xs\">{children}</table>\n ),\n th: ({ children }) => (\n <th className=\"border-border border px-2 py-1 text-left font-medium\">\n {children}\n </th>\n ),\n td: ({ children }) => (\n <td className=\"border-border border px-2 py-1\">{children}</td>\n ),\n }}\n >\n {props.content}\n </ReactMarkdown>\n </div>\n );\n};\n\n/**\n * The text of a ` ```mermaid ` fence, or `undefined` for every other `<pre>`.\n *\n * Reads the hast node rather than the rendered children because the source\n * has to arrive at the parser exactly as the author typed it, and walking React\n * children would mean reassembling it from whatever the renderer produced.\n *\n * The alternative wiring, a remark plugin, is more code for the same result:\n * `mdast-util-to-hast` applies `data.hName` to the `<code>` element BEFORE\n * wrapping it in `<pre>`, so renaming the code node still leaves the diagram\n * inside this bordered box. Going that way needs a custom node type and a\n * cast into `components`, whose type is keyed on intrinsic elements.\n */\nconst mermaidSource = (node: unknown): string | undefined => {\n const pre = node as\n | {\n children?: Array<{\n type?: string;\n tagName?: string;\n properties?: { className?: unknown };\n children?: Array<{ type?: string; value?: string }>;\n }>;\n }\n | undefined;\n const code = pre?.children?.[0];\n if (code?.type !== \"element\" || code.tagName !== \"code\") return undefined;\n\n const className = code.properties?.className;\n const names = Array.isArray(className)\n ? className.map(String)\n : typeof className === \"string\"\n ? className.split(/\\s+/)\n : [];\n if (!names.includes(\"language-mermaid\")) return undefined;\n\n const text = code.children\n ?.filter((child) => child.type === \"text\")\n .map((child) => child.value ?? \"\")\n .join(\"\");\n return text?.trim() ? text : undefined;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA2BA,MAAM,eAAe,WAAW,OAAO,4BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoDpE,MAAa,gBAAgB,UAA6B;CACxD,OACE,oBAAC,OAAD;EACE,WAAW,sCAAsC,MAAM,aAAa;EAEpE,UAAA,oBAAC,eAAD;GACE,eAAe,CAAC,SAAS;GACzB,eAAe,CAQb,CAAC,iBAAiB;IAAE,QAAQ;IAAM,WAAW,CAAC,SAAS;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,EAAE,eACR,oBAAC,SAAD;KAAO,WAAU;KAAgC;IAAgB,CAAA;IAEnE,KAAK,EAAE,eACL,oBAAC,MAAD;KAAI,WAAU;KACX;IACC,CAAA;IAEN,KAAK,EAAE,eACL,oBAAC,MAAD;KAAI,WAAU;KAAkC;IAAa,CAAA;GAEjE;GAEC,UAAA,MAAM;EACM,CAAA;CACZ,CAAA;AAET;;;;;;;;;;;;;;AAeA,MAAM,iBAAiB,SAAsC;CAW3D,MAAM,OAAOA,MAAK,WAAW;CAC7B,IAAI,MAAM,SAAS,aAAa,KAAK,YAAY,QAAQ,OAAO,KAAA;CAEhE,MAAM,YAAY,KAAK,YAAY;CAMnC,IAAI,EALU,MAAM,QAAQ,SAAS,IACjC,UAAU,IAAI,MAAM,IACpB,OAAO,cAAc,WACnB,UAAU,MAAM,KAAK,IACrB,CAAC,EAAA,CACI,SAAS,kBAAkB,GAAG,OAAO,KAAA;CAEhD,MAAM,OAAO,KAAK,UACd,QAAQ,UAAU,MAAM,SAAS,MAAM,CAAC,CACzC,KAAK,UAAU,MAAM,SAAS,EAAE,CAAC,CACjC,KAAK,EAAE;CACV,OAAO,MAAM,KAAK,IAAI,OAAO,KAAA;AAC/B"}
|
|
1
|
+
{"version":3,"file":"markdown-view.js","names":["pre"],"sources":["../../../src/components/markdown-view/markdown-view.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport \"./markdown-view.css\";\nimport { lazy, Suspense } from \"react\";\nimport ReactMarkdown from \"react-markdown\";\nimport rehypeHighlight from \"rehype-highlight\";\nimport remarkGfm from \"remark-gfm\";\n\nimport { DiagramErrorBoundary } from \"./diagram/DiagramErrorBoundary.tsx\";\n\n/**\n * Both parsers, both layouts (`graphre` for the flowchart, arithmetic for\n * the sequence diagram) and both emitters, pulled in ONLY when a document\n * actually contains a mermaid fence.\n *\n * This is the constraint the whole diagram layer exists under: a document\n * with no diagram must pay nothing at all. One with a diagram pays one\n * chunk once, then it is cached. Measured on 2026-08-28 with both diagram\n * types in it: 64.5 kB raw, **22.2 kB gzip**, 19.4 kB brotli - against\n * 17.95 kB gzip when it drew flowcharts only. If it ever passes ~26 kB,\n * split the two pipelines into two chunks so a flowchart-only document\n * stops paying for the sequence one.\n *\n * ⚠️ A lazy import a bundler decides to inline fails silently: the feature\n * still works and the cost moves into the entry chunk. After changing this,\n * build and confirm the diagram code is in a chunk of its own and the entry\n * has none of it:\n *\n * yarn w lore build\n * grep -rl 'addBorderSegments\\|sequenceDiagram' apps/lore/dist/public/\n */\nconst MermaidFence = lazy(() => import(\"./diagram/MermaidFence.tsx\"));\n\nexport interface MarkdownViewProps {\n content: string;\n /**\n * Extra classes for the prose root, merged after the defaults so a caller\n * can set its own reading face or measure. The defaults it overrides are\n * `text-sm leading-relaxed` — a surface that sets prose in a display serif\n * needs both, and no parent wrapper can supply them, since they sit on\n * this element rather than being inherited.\n */\n className?: string;\n}\n\n/**\n * Renders markdown as formatted prose.\n *\n * ## Diagrams\n *\n * A ` ```mermaid ` fence containing a **`flowchart`** or a\n * **`sequenceDiagram`** is drawn as an SVG diagram instead of a code block,\n * themed from the app's own CSS variables so dark mode needs no second\n * palette. The renderer is in-house: only flowchart layout is imported\n * (`graphre`, dagre in TypeScript, ~15.5 kB gzip), and the whole thing is\n * one lazy chunk pulled in only when a document actually contains a fence,\n * so a document with no diagram pays nothing.\n *\n * The flowchart subset is `flowchart TD|TB|LR|RL|BT`; the four node shapes\n * `[rect]` `(rounded)` `{diamond}` `((circle))`, with every other mermaid\n * bracket pair consumed and mapped onto them; edges `-->` `---` `-.->`\n * `==>` `<-->` with labels in both the `-->|text|` and `-- text -->` forms;\n * chains, `&` fans, `<br/>` line breaks and nested `subgraph`.\n *\n * The sequence subset is participants and actors, the eight arrow forms,\n * notes, `autonumber`, self-messages and the `alt` / `else` / `opt` /\n * `loop` fragment boxes. Activation bars are ignored. A wide sequence\n * diagram keeps its natural size in a scroll frame rather than shrinking\n * into the prose column.\n *\n * **Everything else degrades to the code block, silently.**\n * `classDiagram`, `gantt` and mindmaps are not drawn, `style` / `classDef`\n * are ignored, and a parse failure, a refused construct or a diagram past\n * its cap renders the plain fence rather than an error. Agents write\n * invalid mermaid, and a red box in the middle of a document is worse than\n * a grey fence. See `packages/@alepha/ui/DOC.md` for the full table.\n *\n * ## Raw HTML\n *\n * No raw HTML is ever rendered as markup: react-markdown's default is to\n * escape a raw node to text, and this component deliberately mounts no\n * plugin that changes that. A narrow `rehypeSafeImg` plugin used to promote\n * a lone `<img …>` — the one thing MDXEditor emitted for a *resized* image —\n * and was deleted along with the editor that produced it, since nothing\n * writes that markup anymore.\n *\n * Do not reach for `rehype-raw` to bring the capability back: this renders\n * content authored by one user to another, so every raw tag becoming live\n * markup turns every markdown surface in every app into an injection point.\n */\nexport const MarkdownView = (props: MarkdownViewProps) => {\n return (\n <div\n // `data-slot`, matching every other block here, so a host page can\n // reach the prose root without a wrapper class. Lore's folio\n // document uses it to make this inherit the reading size instead\n // of the `text-sm` default below.\n data-slot=\"markdown-view\"\n className={`max-w-none text-sm leading-relaxed ${props.className ?? \"\"}`}\n >\n <ReactMarkdown\n remarkPlugins={[remarkGfm]}\n rehypePlugins={[\n // `plainText` claims the fence BEFORE highlighting runs: hljs would\n // otherwise tokenise the diagram source, and the fallback would be a\n // soup of spans instead of the text the author wrote.\n //\n // `ignoreMissing` is gone: it no longer exists in v7, where an\n // unknown language already produces a vfile message rather than a\n // throw.\n [rehypeHighlight, { detect: true, plainText: [\"mermaid\"] }],\n ]}\n components={{\n h1: ({ children }) => (\n <h1 className=\"mt-6 mb-3 text-2xl font-semibold tracking-tight\">\n {children}\n </h1>\n ),\n h2: ({ children }) => (\n <h2 className=\"mt-6 mb-2 text-xl font-semibold tracking-tight\">\n {children}\n </h2>\n ),\n h3: ({ children }) => (\n <h3 className=\"mt-4 mb-2 text-base font-semibold\">{children}</h3>\n ),\n p: ({ children }) => <p className=\"my-3\">{children}</p>,\n ul: ({ children }) => (\n <ul className=\"my-3 list-disc space-y-1 pl-5\">{children}</ul>\n ),\n ol: ({ children }) => (\n <ol className=\"my-3 list-decimal space-y-1 pl-5\">{children}</ol>\n ),\n li: ({ children }) => <li className=\"pl-1\">{children}</li>,\n a: ({ href, children }) => (\n <a\n href={href}\n className=\"text-primary decoration-primary/50 hover:decoration-primary underline underline-offset-4\"\n >\n {children}\n </a>\n ),\n code: ({ children, className }) => {\n const isBlock =\n className?.includes(\"language-\") || className?.includes(\"hljs\");\n if (isBlock) {\n return <code className={`${className} text-xs`}>{children}</code>;\n }\n return (\n <code className=\"bg-muted rounded px-1.5 py-0.5 font-mono text-[0.85em]\">\n {children}\n </code>\n );\n },\n pre: ({ children, node }) => {\n const block = (\n <pre className=\"border-border my-4 overflow-auto rounded-md border bg-transparent p-3 text-xs\">\n {children}\n </pre>\n );\n const source = mermaidSource(node);\n if (!source) return block;\n return (\n <DiagramErrorBoundary fallback={block}>\n {/*\n The loading state IS the code block: the fence is already on\n screen, and swapping it for the diagram when the chunk lands\n costs no spinner and no second layout.\n */}\n <Suspense fallback={block}>\n <MermaidFence source={source} fallback={block} />\n </Suspense>\n </DiagramErrorBoundary>\n );\n },\n blockquote: ({ children }) => (\n <blockquote className=\"border-muted-foreground/30 my-3 border-l-2 pl-4 italic\">\n {children}\n </blockquote>\n ),\n hr: () => <hr className=\"border-border my-6\" />,\n table: ({ children }) => (\n <table className=\"my-4 border-collapse text-xs\">{children}</table>\n ),\n th: ({ children }) => (\n <th className=\"border-border border px-2 py-1 text-left font-medium\">\n {children}\n </th>\n ),\n td: ({ children }) => (\n <td className=\"border-border border px-2 py-1\">{children}</td>\n ),\n }}\n >\n {props.content}\n </ReactMarkdown>\n </div>\n );\n};\n\n/**\n * The text of a ` ```mermaid ` fence, or `undefined` for every other `<pre>`.\n *\n * Reads the hast node rather than the rendered children because the source\n * has to arrive at the parser exactly as the author typed it, and walking React\n * children would mean reassembling it from whatever the renderer produced.\n *\n * The alternative wiring, a remark plugin, is more code for the same result:\n * `mdast-util-to-hast` applies `data.hName` to the `<code>` element BEFORE\n * wrapping it in `<pre>`, so renaming the code node still leaves the diagram\n * inside this bordered box. Going that way needs a custom node type and a\n * cast into `components`, whose type is keyed on intrinsic elements.\n */\nconst mermaidSource = (node: unknown): string | undefined => {\n const pre = node as\n | {\n children?: Array<{\n type?: string;\n tagName?: string;\n properties?: { className?: unknown };\n children?: Array<{ type?: string; value?: string }>;\n }>;\n }\n | undefined;\n const code = pre?.children?.[0];\n if (code?.type !== \"element\" || code.tagName !== \"code\") return undefined;\n\n const className = code.properties?.className;\n const names = Array.isArray(className)\n ? className.map(String)\n : typeof className === \"string\"\n ? className.split(/\\s+/)\n : [];\n if (!names.includes(\"language-mermaid\")) return undefined;\n\n const text = code.children\n ?.filter((child) => child.type === \"text\")\n .map((child) => child.value ?? \"\")\n .join(\"\");\n return text?.trim() ? text : undefined;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,MAAM,eAAe,WAAW,OAAO,4BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2DpE,MAAa,gBAAgB,UAA6B;CACxD,OACE,oBAAC,OAAD;EAKE,aAAU;EACV,WAAW,sCAAsC,MAAM,aAAa;EAEpE,UAAA,oBAAC,eAAD;GACE,eAAe,CAAC,SAAS;GACzB,eAAe,CAQb,CAAC,iBAAiB;IAAE,QAAQ;IAAM,WAAW,CAAC,SAAS;GAAE,CAAC,CAC5D;GACA,YAAY;IACV,KAAK,EAAE,eACL,oBAAC,MAAD;KAAI,WAAU;KACX;IACC,CAAA;IAEN,KAAK,EAAE,eACL,oBAAC,MAAD;KAAI,WAAU;KACX;IACC,CAAA;IAEN,KAAK,EAAE,eACL,oBAAC,MAAD;KAAI,WAAU;KAAqC;IAAa,CAAA;IAElE,IAAI,EAAE,eAAe,oBAAC,KAAD;KAAG,WAAU;KAAQ;IAAY,CAAA;IACtD,KAAK,EAAE,eACL,oBAAC,MAAD;KAAI,WAAU;KAAiC;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a,KAAK,YAAY,QAAQ,OAAO,KAAA;CAEhE,MAAM,YAAY,KAAK,YAAY;CAMnC,IAAI,EALU,MAAM,QAAQ,SAAS,IACjC,UAAU,IAAI,MAAM,IACpB,OAAO,cAAc,WACnB,UAAU,MAAM,KAAK,IACrB,CAAC,EAAA,CACI,SAAS,kBAAkB,GAAG,OAAO,KAAA;CAEhD,MAAM,OAAO,KAAK,UACd,QAAQ,UAAU,MAAM,SAAS,MAAM,CAAC,CACzC,KAAK,UAAU,MAAM,SAAS,EAAE,CAAC,CACjC,KAAK,EAAE;CACV,OAAO,MAAM,KAAK,IAAI,OAAO,KAAA;AAC/B"}
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { type PageConfigSchema, type PagePrimitive, type PagePrimitiveOptions, type TPropsDefault, type TPropsParentDefault } from "alepha/react/router";
|
|
2
|
+
import type { NavMeta } from "./nav-tree-util.ts";
|
|
2
3
|
export interface PageNavOptions<TConfig extends PageConfigSchema = PageConfigSchema, TProps extends object = TPropsDefault, TPropsParent extends object = TPropsParentDefault> extends PagePrimitiveOptions<TConfig, TProps, TPropsParent> {
|
|
4
|
+
/**
|
|
5
|
+
* Nav metadata, widened to {@link NavMeta} so an entry can name the
|
|
6
|
+
* catalogue keys the shell resolves for its label and its group heading.
|
|
7
|
+
* Everything else is `$page`'s own `nav`.
|
|
8
|
+
*/
|
|
9
|
+
nav?: NavMeta;
|
|
3
10
|
/**
|
|
4
11
|
* Permission(s) required for this page — wired into BOTH the route gate
|
|
5
12
|
* (`use: [$secure({ permissions })]`) and the nav-entry gate
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nav-page.d.ts","sourceRoot":"","sources":["../../../src/components/nav-shell/nav-page.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,oBAAoB,EACzB,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACzB,MAAM,qBAAqB,CAAC;AAG7B,M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AAS,gBAAgB,GAAG,gBAAgB,EACnD,MAAM,SAAS,MAAM,GAAG,aAAa,EACrC,YAAY,SAAS,MAAM,GAAG,mBAAmB,WAExC,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,CAAC,KACrD,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,CAa7C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nav-page.js","names":[],"sources":["../../../src/components/nav-shell/nav-page.tsx"],"sourcesContent":["import {\n $page,\n type PageConfigSchema,\n type PagePrimitive,\n type PagePrimitiveOptions,\n type TPropsDefault,\n type TPropsParentDefault,\n} from \"alepha/react/router\";\nimport { $secure } from \"alepha/security\";\n\nexport interface PageNavOptions<\n TConfig extends PageConfigSchema = PageConfigSchema,\n TProps extends object = TPropsDefault,\n TPropsParent extends object = TPropsParentDefault,\n> extends PagePrimitiveOptions<TConfig, TProps, TPropsParent> {\n /**\n * Permission(s) required for this page — wired into BOTH the route gate\n * (`use: [$secure({ permissions })]`) and the nav-entry gate\n * (`nav.permission`) so the two can never drift. A single string requires\n * that permission; an array requires ALL of them (AND), matching `$secure`.\n *\n * For OR / custom logic use `can` instead. An explicit `nav.permission`\n * still takes precedence over this when both are set.\n */\n permission?: string | string[];\n}\n\n/**\n * `$page` sugar for shell pages: declares the page's `nav` metadata and its\n * permission in one place. The single `permission` value feeds both the real\n * route gate and the UI nav gate, eliminating the repeated permission string\n * that the two would otherwise both need.\n *\n * Pages declared this way are picked up by {@link useNavTree} /\n * {@link NavShell} purely from their `nav` field — no separate nav list.\n */\nexport const $pageNav = <\n TConfig extends PageConfigSchema = PageConfigSchema,\n TProps extends object = TPropsDefault,\n TPropsParent extends object = TPropsParentDefault,\n>(\n options: PageNavOptions<TConfig, TProps, TPropsParent>,\n): PagePrimitive<TConfig, TProps, TPropsParent> => {\n const { permission, use, nav, ...rest } = options;\n const permissions = permission\n ? Array.isArray(permission)\n ? permission\n : [permission]\n : undefined;\n\n return $page<TConfig, TProps, TPropsParent>({\n ...rest,\n use: permissions ? [$secure({ permissions }), ...(use ?? [])] : use,\n nav: nav ? { ...nav, permission: nav.permission ?? permission } : nav,\n });\n};\n"],"mappings":";;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"nav-page.js","names":[],"sources":["../../../src/components/nav-shell/nav-page.tsx"],"sourcesContent":["import {\n $page,\n type PageConfigSchema,\n type PagePrimitive,\n type PagePrimitiveOptions,\n type TPropsDefault,\n type TPropsParentDefault,\n} from \"alepha/react/router\";\nimport { $secure } from \"alepha/security\";\n\nimport type { NavMeta } from \"./nav-tree-util.ts\";\n\nexport interface PageNavOptions<\n TConfig extends PageConfigSchema = PageConfigSchema,\n TProps extends object = TPropsDefault,\n TPropsParent extends object = TPropsParentDefault,\n> extends PagePrimitiveOptions<TConfig, TProps, TPropsParent> {\n /**\n * Nav metadata, widened to {@link NavMeta} so an entry can name the\n * catalogue keys the shell resolves for its label and its group heading.\n * Everything else is `$page`'s own `nav`.\n */\n nav?: NavMeta;\n /**\n * Permission(s) required for this page — wired into BOTH the route gate\n * (`use: [$secure({ permissions })]`) and the nav-entry gate\n * (`nav.permission`) so the two can never drift. A single string requires\n * that permission; an array requires ALL of them (AND), matching `$secure`.\n *\n * For OR / custom logic use `can` instead. An explicit `nav.permission`\n * still takes precedence over this when both are set.\n */\n permission?: string | string[];\n}\n\n/**\n * `$page` sugar for shell pages: declares the page's `nav` metadata and its\n * permission in one place. The single `permission` value feeds both the real\n * route gate and the UI nav gate, eliminating the repeated permission string\n * that the two would otherwise both need.\n *\n * Pages declared this way are picked up by {@link useNavTree} /\n * {@link NavShell} purely from their `nav` field — no separate nav list.\n */\nexport const $pageNav = <\n TConfig extends PageConfigSchema = PageConfigSchema,\n TProps extends object = TPropsDefault,\n TPropsParent extends object = TPropsParentDefault,\n>(\n options: PageNavOptions<TConfig, TProps, TPropsParent>,\n): PagePrimitive<TConfig, TProps, TPropsParent> => {\n const { permission, use, nav, ...rest } = options;\n const permissions = permission\n ? Array.isArray(permission)\n ? permission\n : [permission]\n : undefined;\n\n return $page<TConfig, TProps, TPropsParent>({\n ...rest,\n use: permissions ? [$secure({ permissions }), ...(use ?? [])] : use,\n nav: nav ? { ...nav, permission: nav.permission ?? permission } : nav,\n });\n};\n"],"mappings":";;;;;;;;;;;;AA4CA,MAAa,YAKX,YACiD;CACjD,MAAM,EAAE,YAAY,KAAK,KAAK,GAAG,SAAS;CAC1C,MAAM,cAAc,aAChB,MAAM,QAAQ,UAAU,IACtB,aACA,CAAC,UAAU,IACb,KAAA;CAEJ,OAAO,MAAqC;EAC1C,GAAG;EACH,KAAK,cAAc,CAAC,QAAQ,EAAE,YAAY,CAAC,GAAG,GAAI,OAAO,CAAC,CAAE,IAAI;EAChE,KAAK,MAAM;GAAE,GAAG;GAAK,YAAY,IAAI,cAAc;EAAW,IAAI;CACpE,CAAC;AACH"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PageRoute } from "alepha/react/router";
|
|
1
|
+
import type { PageNav, PageRoute } from "alepha/react/router";
|
|
2
2
|
import type { ReactNode } from "react";
|
|
3
3
|
/**
|
|
4
4
|
* Shared helpers for deriving navigation surfaces (sidebar, breadcrumbs,
|
|
@@ -6,11 +6,73 @@ import type { ReactNode } from "react";
|
|
|
6
6
|
* metadata, so there is no separate hand-maintained nav list to keep in sync
|
|
7
7
|
* — see {@link useNavTree} and {@link useNavBreadcrumbs}.
|
|
8
8
|
*/
|
|
9
|
+
/**
|
|
10
|
+
* A page's `nav` metadata plus the catalogue keys the shell resolves for it.
|
|
11
|
+
*
|
|
12
|
+
* The keys live here rather than in the framework's own {@link PageNav}
|
|
13
|
+
* because they mean nothing to the router: `$page` never reads them, and
|
|
14
|
+
* `alepha/react/router` must not learn about i18n to carry a string. Every
|
|
15
|
+
* surface that turns nav metadata into visible text goes through this module,
|
|
16
|
+
* so this is the one place that has to know.
|
|
17
|
+
*
|
|
18
|
+
* A key is optional and additive: `label` stays the English text and is used
|
|
19
|
+
* verbatim when no key is declared, and as the `tr` default when one is - so
|
|
20
|
+
* an application that registers no French catalogue sees exactly what it saw
|
|
21
|
+
* before.
|
|
22
|
+
*/
|
|
23
|
+
export interface NavMeta extends PageNav {
|
|
24
|
+
/**
|
|
25
|
+
* Catalogue key for {@link PageNav.label}, resolved at render time so the
|
|
26
|
+
* entry follows a language switch.
|
|
27
|
+
*
|
|
28
|
+
* A `$page`'s class field is evaluated once, at construction, outside React
|
|
29
|
+
* - which is why the label cannot simply be `tr(...)` there. Declaring the
|
|
30
|
+
* key instead moves the lookup to {@link navLabel}, which the sidebar,
|
|
31
|
+
* breadcrumbs and command palette all call from inside a component.
|
|
32
|
+
*/
|
|
33
|
+
labelKey?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Catalogue key for {@link PageNav.group} - the sidebar section heading.
|
|
36
|
+
*
|
|
37
|
+
* `group` itself stays the untranslated string because it is the grouping
|
|
38
|
+
* KEY: entries are bucketed by it, and two pages in the same section must
|
|
39
|
+
* agree on it in every language. Only the heading is translated.
|
|
40
|
+
*
|
|
41
|
+
* Declared per page, like `group`, rather than once per section: there is no
|
|
42
|
+
* section object to hang it on, and the pair reads as one decision at the
|
|
43
|
+
* call site.
|
|
44
|
+
*/
|
|
45
|
+
groupKey?: string;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Looks up a catalogue key. Structurally `I18nProvider.tr`, redeclared here so
|
|
49
|
+
* this module stays a plain utility - it is called from hooks, which is where
|
|
50
|
+
* the real `tr` comes from.
|
|
51
|
+
*/
|
|
52
|
+
export type NavTranslate = (key: string, options?: {
|
|
53
|
+
default?: string;
|
|
54
|
+
}) => string;
|
|
55
|
+
/**
|
|
56
|
+
* A page's nav metadata, widened to the shell's own {@link NavMeta}.
|
|
57
|
+
*
|
|
58
|
+
* `$page` types `nav` as {@link PageNav} and copies it through untouched, so
|
|
59
|
+
* the extra keys are there at runtime; only the type has to be re-stated.
|
|
60
|
+
*/
|
|
61
|
+
export declare function navMeta(page: PageRoute): NavMeta | undefined;
|
|
9
62
|
/**
|
|
10
63
|
* Resolve the display label for a page: `nav.label`, then the page `label`,
|
|
11
64
|
* then a static `head.title`, then the route name as a last resort.
|
|
65
|
+
*
|
|
66
|
+
* With `tr` and a `nav.labelKey`, the catalogue wins and the chain above
|
|
67
|
+
* becomes the default passed to it - so a missing entry still renders the
|
|
68
|
+
* English text the page declared, never a raw key.
|
|
69
|
+
*/
|
|
70
|
+
export declare function navLabel(page: PageRoute, tr?: NavTranslate): ReactNode;
|
|
71
|
+
/**
|
|
72
|
+
* Resolve the sidebar / palette heading for a page's section: the catalogue
|
|
73
|
+
* entry named by `nav.groupKey`, defaulting to `nav.group` itself.
|
|
12
74
|
*/
|
|
13
|
-
export declare function
|
|
75
|
+
export declare function navGroupLabel(page: PageRoute, tr?: NavTranslate): string | undefined;
|
|
14
76
|
/**
|
|
15
77
|
* Walk the `parent` chain to decide whether `page` is a (strict) descendant of
|
|
16
78
|
* the route named `root`. The root itself is excluded — it anchors the shell
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nav-tree-util.d.ts","sourceRoot":"","sources":["../../../src/components/nav-shell/nav-tree-util.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"nav-tree-util.d.ts","sourceRoot":"","sources":["../../../src/components/nav-shell/nav-tree-util.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC;;;;;GAKG;AAEH;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,OAAQ,SAAQ,OAAO;IACtC;;;;;;;;OAQG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,EAAE,MAAM,C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own {@link NavMeta}.
|
|
4
|
+
*
|
|
5
|
+
* `$page` types `nav` as {@link PageNav} and copies it through untouched, so
|
|
6
|
+
* the extra keys are there at runtime; only the type has to be re-stated.
|
|
7
7
|
*/
|
|
8
|
+
function navMeta(page) {
|
|
9
|
+
return page.nav;
|
|
10
|
+
}
|
|
8
11
|
/**
|
|
9
12
|
* Resolve the display label for a page: `nav.label`, then the page `label`,
|
|
10
13
|
* then a static `head.title`, then the route name as a last resort.
|
|
14
|
+
*
|
|
15
|
+
* With `tr` and a `nav.labelKey`, the catalogue wins and the chain above
|
|
16
|
+
* becomes the default passed to it - so a missing entry still renders the
|
|
17
|
+
* English text the page declared, never a raw key.
|
|
11
18
|
*/
|
|
12
|
-
function navLabel(page) {
|
|
19
|
+
function navLabel(page, tr) {
|
|
20
|
+
const fallback = navLabelFallback(page);
|
|
21
|
+
const key = navMeta(page)?.labelKey;
|
|
22
|
+
if (tr && key) return tr(key, { default: typeof fallback === "string" ? fallback : page.name });
|
|
23
|
+
return fallback;
|
|
24
|
+
}
|
|
25
|
+
function navLabelFallback(page) {
|
|
13
26
|
if (page.nav?.label != null) return page.nav.label;
|
|
14
27
|
if (page.label != null) return page.label;
|
|
15
28
|
const head = page.head;
|
|
@@ -17,6 +30,16 @@ function navLabel(page) {
|
|
|
17
30
|
return page.name;
|
|
18
31
|
}
|
|
19
32
|
/**
|
|
33
|
+
* Resolve the sidebar / palette heading for a page's section: the catalogue
|
|
34
|
+
* entry named by `nav.groupKey`, defaulting to `nav.group` itself.
|
|
35
|
+
*/
|
|
36
|
+
function navGroupLabel(page, tr) {
|
|
37
|
+
const nav = navMeta(page);
|
|
38
|
+
if (!nav?.group) return void 0;
|
|
39
|
+
if (tr && nav.groupKey) return tr(nav.groupKey, { default: nav.group });
|
|
40
|
+
return nav.group;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
20
43
|
* Walk the `parent` chain to decide whether `page` is a (strict) descendant of
|
|
21
44
|
* the route named `root`. The root itself is excluded — it anchors the shell
|
|
22
45
|
* but is not a nav entry.
|
|
@@ -82,6 +105,6 @@ function keepDeepestActive(entries) {
|
|
|
82
105
|
return entries;
|
|
83
106
|
}
|
|
84
107
|
//#endregion
|
|
85
|
-
export { hasNavPermission, isActivePath, isDescendantOf, keepDeepestActive, navLabel };
|
|
108
|
+
export { hasNavPermission, isActivePath, isDescendantOf, keepDeepestActive, navGroupLabel, navLabel, navMeta };
|
|
86
109
|
|
|
87
110
|
//# sourceMappingURL=nav-tree-util.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nav-tree-util.js","names":[],"sources":["../../../src/components/nav-shell/nav-tree-util.ts"],"sourcesContent":["import type { PageRoute } from \"alepha/react/router\";\nimport type { ReactNode } from \"react\";\n\n/**\n * Shared helpers for deriving navigation surfaces (sidebar, breadcrumbs,\n * command palette) from the route tree. Each `$page` carries its own `nav`\n * metadata, so there is no separate hand-maintained nav list to keep in sync\n * — see {@link useNavTree} and {@link useNavBreadcrumbs}.\n */\n\n/**\n * Resolve the display label for a page: `nav.label`, then the page `label`,\n * then a static `head.title`, then the route name as a last resort.\n */\nexport function navLabel(page: PageRoute): ReactNode {\n if (page.nav?.label != null) return page.nav.label;\n if (page.label != null) return page.label;\n const head = page.head;\n // `head` may be a `(props) => Head` function — only a static object carries a\n // usable title here (the nav builder has no props to call it with).\n if (head && typeof head === \"object\" && \"title\" in head && head.title) {\n return head.title;\n }\n return page.name;\n}\n\n/**\n * Walk the `parent` chain to decide whether `page` is a (strict) descendant of\n * the route named `root`. The root itself is excluded — it anchors the shell\n * but is not a nav entry.\n */\nexport function isDescendantOf(page: PageRoute, root: string): boolean {\n let parent = page.parent;\n while (parent) {\n if (parent.name === root) return true;\n parent = parent.parent;\n }\n return false;\n}\n\n/**\n * AND-semantics permission probe matching `$secure({ permissions })`: a single\n * string requires that one permission; an array requires ALL of them. No\n * permission means \"always visible\".\n */\nexport function hasNavPermission(\n permission: string | string[] | undefined,\n has: (permission: string) => boolean,\n): boolean {\n if (!permission) return true;\n const list = Array.isArray(permission) ? permission : [permission];\n return list.every(has);\n}\n\n/**\n * Whether `current` (the active pathname) is on or under `href`. Mirrors the\n * legacy hand-rolled check — exact match, or a path segment below it — so the\n * sidebar highlights `/admin/users` while viewing `/admin/users/:id`.\n *\n * ⚠️ On its own this over-matches, because it can only see one entry at a time.\n * Run the results through {@link keepDeepestActive} — see there for why.\n */\nexport function isActivePath(current: string, href: string): boolean {\n return current === href || current.startsWith(`${href}/`);\n}\n\n/**\n * Given entries already marked by {@link isActivePath}, keep only the deepest\n * match and clear the rest.\n *\n * `isActivePath` answers \"is the current page on or under this entry\", which is\n * the right question for a section that owns a subtree — `/admin/users` must\n * stay lit while a user detail page is open. But it is a per-entry predicate,\n * so it cannot tell that a *different* entry matched more specifically.\n *\n * That is not hypothetical. A page at `path: \"/\"` under a shell contributes no\n * segment of its own, and `ReactPageProvider.createMatch` collapses the result\n * (`/account` + `/` → `/account/` → `/account`), so its `match` comes out\n * **identical to the shell's**. The entry is then a path-prefix of every one of\n * its siblings, and lights up on all of them. `AccountRouter.profile` is\n * exactly this: Profile rendered active on Security, Sessions, API keys,\n * Connected apps and both Lore pages.\n *\n * Deepest-wins rather than a narrower \"an index entry must match exactly\"\n * rule, because the narrow version breaks the case the loose predicate exists\n * for: an index page that legitimately owns child routes of its own would stop\n * highlighting while one of those children is open. Comparing candidates keeps\n * both behaviours without either needing to know it is an index.\n *\n * Length is a safe proxy for depth here: every candidate is a prefix of the\n * same `current`, so of any two, the longer is under the shorter.\n */\nexport function keepDeepestActive<T extends { href: string; active: boolean }>(\n entries: T[],\n): T[] {\n let deepest = -1;\n for (const entry of entries) {\n if (entry.active && entry.href.length > deepest) {\n deepest = entry.href.length;\n }\n }\n\n for (const entry of entries) {\n if (entry.active && entry.href.length < deepest) {\n entry.active = false;\n }\n }\n\n return entries;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"nav-tree-util.js","names":[],"sources":["../../../src/components/nav-shell/nav-tree-util.ts"],"sourcesContent":["import type { PageNav, PageRoute } from \"alepha/react/router\";\nimport type { ReactNode } from \"react\";\n\n/**\n * Shared helpers for deriving navigation surfaces (sidebar, breadcrumbs,\n * command palette) from the route tree. Each `$page` carries its own `nav`\n * metadata, so there is no separate hand-maintained nav list to keep in sync\n * — see {@link useNavTree} and {@link useNavBreadcrumbs}.\n */\n\n/**\n * A page's `nav` metadata plus the catalogue keys the shell resolves for it.\n *\n * The keys live here rather than in the framework's own {@link PageNav}\n * because they mean nothing to the router: `$page` never reads them, and\n * `alepha/react/router` must not learn about i18n to carry a string. Every\n * surface that turns nav metadata into visible text goes through this module,\n * so this is the one place that has to know.\n *\n * A key is optional and additive: `label` stays the English text and is used\n * verbatim when no key is declared, and as the `tr` default when one is - so\n * an application that registers no French catalogue sees exactly what it saw\n * before.\n */\nexport interface NavMeta extends PageNav {\n /**\n * Catalogue key for {@link PageNav.label}, resolved at render time so the\n * entry follows a language switch.\n *\n * A `$page`'s class field is evaluated once, at construction, outside React\n * - which is why the label cannot simply be `tr(...)` there. Declaring the\n * key instead moves the lookup to {@link navLabel}, which the sidebar,\n * breadcrumbs and command palette all call from inside a component.\n */\n labelKey?: string;\n\n /**\n * Catalogue key for {@link PageNav.group} - the sidebar section heading.\n *\n * `group` itself stays the untranslated string because it is the grouping\n * KEY: entries are bucketed by it, and two pages in the same section must\n * agree on it in every language. Only the heading is translated.\n *\n * Declared per page, like `group`, rather than once per section: there is no\n * section object to hang it on, and the pair reads as one decision at the\n * call site.\n */\n groupKey?: string;\n}\n\n/**\n * Looks up a catalogue key. Structurally `I18nProvider.tr`, redeclared here so\n * this module stays a plain utility - it is called from hooks, which is where\n * the real `tr` comes from.\n */\nexport type NavTranslate = (\n key: string,\n options?: { default?: string },\n) => string;\n\n/**\n * A page's nav metadata, widened to the shell's own {@link NavMeta}.\n *\n * `$page` types `nav` as {@link PageNav} and copies it through untouched, so\n * the extra keys are there at runtime; only the type has to be re-stated.\n */\nexport function navMeta(page: PageRoute): NavMeta | undefined {\n return page.nav as NavMeta | undefined;\n}\n\n/**\n * Resolve the display label for a page: `nav.label`, then the page `label`,\n * then a static `head.title`, then the route name as a last resort.\n *\n * With `tr` and a `nav.labelKey`, the catalogue wins and the chain above\n * becomes the default passed to it - so a missing entry still renders the\n * English text the page declared, never a raw key.\n */\nexport function navLabel(page: PageRoute, tr?: NavTranslate): ReactNode {\n const fallback = navLabelFallback(page);\n const key = navMeta(page)?.labelKey;\n if (tr && key) {\n return tr(key, {\n // `tr` needs a string; a label declared as an element cannot be one, so\n // the route name stands in - it is what the chain ends on anyway.\n default: typeof fallback === \"string\" ? fallback : page.name,\n });\n }\n return fallback;\n}\n\nfunction navLabelFallback(page: PageRoute): ReactNode {\n if (page.nav?.label != null) return page.nav.label;\n if (page.label != null) return page.label;\n const head = page.head;\n // `head` may be a `(props) => Head` function — only a static object carries a\n // usable title here (the nav builder has no props to call it with).\n if (head && typeof head === \"object\" && \"title\" in head && head.title) {\n return head.title;\n }\n return page.name;\n}\n\n/**\n * Resolve the sidebar / palette heading for a page's section: the catalogue\n * entry named by `nav.groupKey`, defaulting to `nav.group` itself.\n */\nexport function navGroupLabel(\n page: PageRoute,\n tr?: NavTranslate,\n): string | undefined {\n const nav = navMeta(page);\n if (!nav?.group) return undefined;\n if (tr && nav.groupKey) {\n return tr(nav.groupKey, { default: nav.group });\n }\n return nav.group;\n}\n\n/**\n * Walk the `parent` chain to decide whether `page` is a (strict) descendant of\n * the route named `root`. The root itself is excluded — it anchors the shell\n * but is not a nav entry.\n */\nexport function isDescendantOf(page: PageRoute, root: string): boolean {\n let parent = page.parent;\n while (parent) {\n if (parent.name === root) return true;\n parent = parent.parent;\n }\n return false;\n}\n\n/**\n * AND-semantics permission probe matching `$secure({ permissions })`: a single\n * string requires that one permission; an array requires ALL of them. No\n * permission means \"always visible\".\n */\nexport function hasNavPermission(\n permission: string | string[] | undefined,\n has: (permission: string) => boolean,\n): boolean {\n if (!permission) return true;\n const list = Array.isArray(permission) ? permission : [permission];\n return list.every(has);\n}\n\n/**\n * Whether `current` (the active pathname) is on or under `href`. Mirrors the\n * legacy hand-rolled check — exact match, or a path segment below it — so the\n * sidebar highlights `/admin/users` while viewing `/admin/users/:id`.\n *\n * ⚠️ On its own this over-matches, because it can only see one entry at a time.\n * Run the results through {@link keepDeepestActive} — see there for why.\n */\nexport function isActivePath(current: string, href: string): boolean {\n return current === href || current.startsWith(`${href}/`);\n}\n\n/**\n * Given entries already marked by {@link isActivePath}, keep only the deepest\n * match and clear the rest.\n *\n * `isActivePath` answers \"is the current page on or under this entry\", which is\n * the right question for a section that owns a subtree — `/admin/users` must\n * stay lit while a user detail page is open. But it is a per-entry predicate,\n * so it cannot tell that a *different* entry matched more specifically.\n *\n * That is not hypothetical. A page at `path: \"/\"` under a shell contributes no\n * segment of its own, and `ReactPageProvider.createMatch` collapses the result\n * (`/account` + `/` → `/account/` → `/account`), so its `match` comes out\n * **identical to the shell's**. The entry is then a path-prefix of every one of\n * its siblings, and lights up on all of them. `AccountRouter.profile` is\n * exactly this: Profile rendered active on Security, Sessions, API keys,\n * Connected apps and both Lore pages.\n *\n * Deepest-wins rather than a narrower \"an index entry must match exactly\"\n * rule, because the narrow version breaks the case the loose predicate exists\n * for: an index page that legitimately owns child routes of its own would stop\n * highlighting while one of those children is open. Comparing candidates keeps\n * both behaviours without either needing to know it is an index.\n *\n * Length is a safe proxy for depth here: every candidate is a prefix of the\n * same `current`, so of any two, the longer is under the shorter.\n */\nexport function keepDeepestActive<T extends { href: string; active: boolean }>(\n entries: T[],\n): T[] {\n let deepest = -1;\n for (const entry of entries) {\n if (entry.active && entry.href.length > deepest) {\n deepest = entry.href.length;\n }\n }\n\n for (const entry of entries) {\n if (entry.active && entry.href.length < deepest) {\n entry.active = false;\n }\n }\n\n return entries;\n}\n"],"mappings":";;;;;;;AAkEA,SAAgB,QAAQ,MAAsC;CAC5D,OAAO,KAAK;AACd;;;;;;;;;AAUA,SAAgB,SAAS,MAAiB,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AAK;CAIzB,KAAK,MAAM,SAAS,SAClB,IAAI,MAAM,UAAU,MAAM,KAAK,SAAS,SACtC,MAAM,SAAS;CAInB,OAAO;AACT"}
|
|
@@ -14,11 +14,12 @@ export interface SpotlightProps {
|
|
|
14
14
|
open?: boolean;
|
|
15
15
|
onOpenChange?: (open: boolean) => void;
|
|
16
16
|
/**
|
|
17
|
-
* Search input placeholder.
|
|
17
|
+
* Search input placeholder. Defaults to the localised `nav.spotlight.search`.
|
|
18
18
|
*/
|
|
19
19
|
placeholder?: string;
|
|
20
20
|
/**
|
|
21
|
-
* Message shown when nothing matches the query.
|
|
21
|
+
* Message shown when nothing matches the query. Defaults to the localised
|
|
22
|
+
* `nav.spotlight.empty`.
|
|
22
23
|
*/
|
|
23
24
|
emptyMessage?: ReactNode;
|
|
24
25
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spotlight.d.ts","sourceRoot":"","sources":["../../../src/components/nav-shell/spotlight.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"spotlight.d.ts","sourceRoot":"","sources":["../../../src/components/nav-shell/spotlight.tsx"],"names":[],"mappings":"AAWA,OAAO,EACL,KAAK,SAAS,EAKf,MAAM,OAAO,CAAC;AAIf,MAAM,WAAW,cAAc;IAC7B;;;;;OAKG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;GAKG;AACH,eAAO,MAAM,SAAS,UAAW,cAAc,gCA8G9C,CAAC"}
|
|
@@ -2,6 +2,7 @@ import { useNavEntries } from "./use-nav-entries.js";
|
|
|
2
2
|
import { Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList } from "../ui/command.js";
|
|
3
3
|
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { useI18n } from "alepha/react/i18n";
|
|
5
6
|
import { useRouter } from "alepha/react/router";
|
|
6
7
|
//#region src/components/nav-shell/spotlight.tsx
|
|
7
8
|
/**
|
|
@@ -11,9 +12,11 @@ import { useRouter } from "alepha/react/router";
|
|
|
11
12
|
* sidebar, so it never drifts from the routes.
|
|
12
13
|
*/
|
|
13
14
|
const Spotlight = (props) => {
|
|
14
|
-
const { root,
|
|
15
|
+
const { root, shortcut = true } = props;
|
|
15
16
|
const router = useRouter();
|
|
17
|
+
const { tr } = useI18n();
|
|
16
18
|
const entries = useNavEntries({ root });
|
|
19
|
+
const placeholder = props.placeholder ?? tr("nav.spotlight.search", { default: "Search…" });
|
|
17
20
|
const isControlled = props.open !== void 0;
|
|
18
21
|
const [internalOpen, setInternalOpen] = useState(false);
|
|
19
22
|
const open = isControlled ? !!props.open : internalOpen;
|
|
@@ -47,7 +50,7 @@ const Spotlight = (props) => {
|
|
|
47
50
|
byKey.set(key, items);
|
|
48
51
|
out.push({
|
|
49
52
|
key,
|
|
50
|
-
label: entry.group || void 0,
|
|
53
|
+
label: entry.groupLabel || entry.group || void 0,
|
|
51
54
|
items
|
|
52
55
|
});
|
|
53
56
|
}
|
|
@@ -63,9 +66,9 @@ const Spotlight = (props) => {
|
|
|
63
66
|
return /* @__PURE__ */ jsx(CommandDialog, {
|
|
64
67
|
open,
|
|
65
68
|
onOpenChange: setOpen,
|
|
66
|
-
title: "Search",
|
|
67
|
-
description: "Jump to a page",
|
|
68
|
-
children: /* @__PURE__ */ jsxs(Command, { children: [/* @__PURE__ */ jsx(CommandInput, { placeholder }), /* @__PURE__ */ jsxs(CommandList, { children: [/* @__PURE__ */ jsx(CommandEmpty, { children: props.emptyMessage ?? "No results." }), groups.map((group) => /* @__PURE__ */ jsx(CommandGroup, {
|
|
69
|
+
title: tr("nav.spotlight.title", { default: "Search" }),
|
|
70
|
+
description: tr("nav.spotlight.description", { default: "Jump to a page" }),
|
|
71
|
+
children: /* @__PURE__ */ jsxs(Command, { children: [/* @__PURE__ */ jsx(CommandInput, { placeholder }), /* @__PURE__ */ jsxs(CommandList, { children: [/* @__PURE__ */ jsx(CommandEmpty, { children: props.emptyMessage ?? tr("nav.spotlight.empty", { default: "No results." }) }), groups.map((group) => /* @__PURE__ */ jsx(CommandGroup, {
|
|
69
72
|
heading: group.label,
|
|
70
73
|
children: group.items.map((entry) => /* @__PURE__ */ jsxs(CommandItem, {
|
|
71
74
|
value: `${entry.name} ${toText(entry.label)}`,
|
|
@@ -73,7 +76,7 @@ const Spotlight = (props) => {
|
|
|
73
76
|
toText(entry.label),
|
|
74
77
|
toText(entry.description),
|
|
75
78
|
...entry.keywords ?? [],
|
|
76
|
-
entry.group ?? ""
|
|
79
|
+
entry.groupLabel ?? entry.group ?? ""
|
|
77
80
|
].filter(Boolean),
|
|
78
81
|
disabled: entry.disabled,
|
|
79
82
|
onSelect: () => onSelect(entry),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spotlight.js","names":[],"sources":["../../../src/components/nav-shell/spotlight.tsx"],"sourcesContent":["import {\n Command,\n CommandDialog,\n CommandEmpty,\n CommandGroup,\n CommandInput,\n CommandItem,\n CommandList,\n} from \"@alepha/ui/components/ui/command\";\nimport { useRouter } from \"alepha/react/router\";\nimport {\n type ReactNode,\n useCallback,\n useEffect,\n useMemo,\n useState,\n} from \"react\";\n\nimport { type NavEntry, useNavEntries } from \"./use-nav-entries.ts\";\n\nexport interface SpotlightProps {\n /**\n * Route name anchoring the palette — the same `root` passed to\n * {@link NavShell}. The palette lists the navigable pages of that subtree,\n * derived from each page's `nav` metadata (label / icon / group / keywords /\n * description). One source for sidebar, breadcrumbs and palette.\n */\n root: string;\n /**\n * Controlled open state. Omit to let the palette manage its own state (it\n * still toggles on the keyboard shortcut).\n */\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n /**\n * Search input placeholder
|
|
1
|
+
{"version":3,"file":"spotlight.js","names":[],"sources":["../../../src/components/nav-shell/spotlight.tsx"],"sourcesContent":["import {\n Command,\n CommandDialog,\n CommandEmpty,\n CommandGroup,\n CommandInput,\n CommandItem,\n CommandList,\n} from \"@alepha/ui/components/ui/command\";\nimport { useI18n } from \"alepha/react/i18n\";\nimport { useRouter } from \"alepha/react/router\";\nimport {\n type ReactNode,\n useCallback,\n useEffect,\n useMemo,\n useState,\n} from \"react\";\n\nimport { type NavEntry, useNavEntries } from \"./use-nav-entries.ts\";\n\nexport interface SpotlightProps {\n /**\n * Route name anchoring the palette — the same `root` passed to\n * {@link NavShell}. The palette lists the navigable pages of that subtree,\n * derived from each page's `nav` metadata (label / icon / group / keywords /\n * description). One source for sidebar, breadcrumbs and palette.\n */\n root: string;\n /**\n * Controlled open state. Omit to let the palette manage its own state (it\n * still toggles on the keyboard shortcut).\n */\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n /**\n * Search input placeholder. Defaults to the localised `nav.spotlight.search`.\n */\n placeholder?: string;\n /**\n * Message shown when nothing matches the query. Defaults to the localised\n * `nav.spotlight.empty`.\n */\n emptyMessage?: ReactNode;\n /**\n * Bind the global ⌘K / Ctrl+K shortcut to toggle the palette. Defaults to\n * `true`.\n */\n shortcut?: boolean;\n}\n\n/**\n * Command palette over the navigation tree. Opens on ⌘K / Ctrl+K (or via\n * controlled `open`), searches page labels / keywords / descriptions, and\n * navigates on select. Reads the same {@link useNavEntries} source as the\n * sidebar, so it never drifts from the routes.\n */\nexport const Spotlight = (props: SpotlightProps) => {\n const { root, shortcut = true } = props;\n const router = useRouter<any>();\n const { tr } = useI18n();\n const entries = useNavEntries({ root });\n const placeholder =\n props.placeholder ?? tr(\"nav.spotlight.search\", { default: \"Search…\" });\n\n const isControlled = props.open !== undefined;\n const [internalOpen, setInternalOpen] = useState(false);\n const open = isControlled ? !!props.open : internalOpen;\n\n const setOpen = useCallback(\n (next: boolean) => {\n if (!isControlled) setInternalOpen(next);\n props.onOpenChange?.(next);\n },\n [isControlled, props.onOpenChange],\n );\n\n useEffect(() => {\n if (!shortcut) return;\n const onKeyDown = (event: KeyboardEvent) => {\n if ((event.metaKey || event.ctrlKey) && event.key.toLowerCase() === \"k\") {\n event.preventDefault();\n setOpen(!open);\n }\n };\n document.addEventListener(\"keydown\", onKeyDown);\n return () => document.removeEventListener(\"keydown\", onKeyDown);\n }, [shortcut, open, setOpen]);\n\n // Bucket the already-sorted entries into their groups, preserving order.\n const groups = useMemo(() => {\n const out: { key: string; label?: string; items: NavEntry[] }[] = [];\n const byKey = new Map<string, NavEntry[]>();\n for (const entry of entries) {\n const key = entry.group ?? \"\";\n let items = byKey.get(key);\n if (!items) {\n items = [];\n byKey.set(key, items);\n out.push({\n key,\n label: entry.groupLabel || entry.group || undefined,\n items,\n });\n }\n items.push(entry);\n }\n return out;\n }, [entries]);\n\n const onSelect = useCallback(\n (entry: NavEntry) => {\n if (entry.disabled) return;\n setOpen(false);\n void router.push(entry.name);\n },\n [router, setOpen],\n );\n\n return (\n <CommandDialog\n open={open}\n onOpenChange={setOpen}\n title={tr(\"nav.spotlight.title\", { default: \"Search\" })}\n description={tr(\"nav.spotlight.description\", {\n default: \"Jump to a page\",\n })}\n >\n <Command>\n <CommandInput placeholder={placeholder} />\n <CommandList>\n <CommandEmpty>\n {props.emptyMessage ??\n tr(\"nav.spotlight.empty\", { default: \"No results.\" })}\n </CommandEmpty>\n {groups.map((group) => (\n <CommandGroup key={group.key || \"_ungrouped\"} heading={group.label}>\n {group.items.map((entry) => (\n <CommandItem\n key={entry.name}\n // cmdk matches the query against `value` + `keywords`;\n // include the human label plus any explicit synonyms.\n value={`${entry.name} ${toText(entry.label)}`}\n keywords={[\n toText(entry.label),\n toText(entry.description),\n ...(entry.keywords ?? []),\n entry.groupLabel ?? entry.group ?? \"\",\n ].filter(Boolean)}\n disabled={entry.disabled}\n onSelect={() => onSelect(entry)}\n >\n {entry.icon}\n <span>{entry.label}</span>\n {entry.description ? (\n <span className=\"text-muted-foreground ml-2 truncate text-xs\">\n {entry.description}\n </span>\n ) : null}\n </CommandItem>\n ))}\n </CommandGroup>\n ))}\n </CommandList>\n </Command>\n </CommandDialog>\n );\n};\n\n/**\n * cmdk filters on plain text; coerce a ReactNode label to a searchable string\n * (component labels contribute nothing — callers should add `nav.keywords`).\n */\nfunction toText(node: ReactNode): string {\n return typeof node === \"string\" || typeof node === \"number\"\n ? String(node)\n : \"\";\n}\n"],"mappings":";;;;;;;;;;;;;AAyDA,MAAa,aAAa,UAA0B;CAClD,MAAM,EAAE,MAAM,WAAW,SAAS;CAClC,MAAM,SAAS,UAAe;CAC9B,MAAM,EAAE,OAAO,QAAQ;CACvB,MAAM,UAAU,cAAc,EAAE,KAAK,CAAC;CACtC,MAAM,cACJ,MAAM,eAAe,GAAG,wBAAwB,EAAE,SAAS,UAAU,CAAC;CAExE,MAAM,eAAe,MAAM,SAAS,KAAA;CACpC,MAAM,CAAC,cAAc,mBAAmB,SAAS,KAAK;CACtD,MAAM,OAAO,eAAe,CAAC,CAAC,MAAM,OAAO;CAE3C,MAAM,UAAU,aACb,SAAkB;EACjB,IAAI,CAAC,cAAc,gBAAgB,IAAI;EACvC,MAAM,eAAe,IAAI;CAC3B,GACA,CAAC,cAAc,MAAM,YAAY,CACnC;CAEA,gBAAgB;EACd,IAAI,CAAC,UAAU;EACf,MAAM,aAAa,UAAyB;GAC1C,KAAK,MAAM,WAAW,MAAM,YAAY,MAAM,IAAI,YAAY,MAAM,KAAK;IACvE,MAAM,eAAe;IACrB,QAAQ,CAAC,IAAI;GACf;EACF;EACA,SAAS,iBAAiB,WAAW,SAAS;EAC9C,aAAa,SAAS,oBAAoB,WAAW,SAAS;CAChE,GAAG;EAAC;EAAU;EAAM;CAAO,CAAC;CAG5B,MAAM,SAAS,cAAc;EAC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AcG,MAAM;KACP,oBAAC,QAAD,EAAA,UAAO,MAAM,MAAY,CAAA;KACxB,MAAM,cACL,oBAAC,QAAD;MAAM,WAAU;MACb,UAAA,MAAM;KACH,CAAA,IACJ;IACO;GApBN,GAAA,MAAM,IAoBA,CACd;EACW,GAzBK,MAAM,OAAO,YAyBlB,CACf,CACU,EAAA,CAAA,CACN,EAAA,CAAA;CACI,CAAA;AAEnB;;;;;AAMA,SAAS,OAAO,MAAyB;CACvC,OAAO,OAAO,SAAS,YAAY,OAAO,SAAS,WAC/C,OAAO,IAAI,IACX;AACN"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-nav-breadcrumbs.d.ts","sourceRoot":"","sources":["../../../src/components/nav-shell/use-nav-breadcrumbs.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-nav-breadcrumbs.d.ts","sourceRoot":"","sources":["../../../src/components/nav-shell/use-nav-breadcrumbs.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKvC,MAAM,WAAW,wBAAwB;IACvC;;;;OAIG;IACH,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,SAAS,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,wBAAwB,GAChC,QAAQ,EAAE,CA2BZ"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { navLabel } from "./nav-tree-util.js";
|
|
2
2
|
import { useMemo } from "react";
|
|
3
|
+
import { useI18n } from "alepha/react/i18n";
|
|
3
4
|
import { useRouterState } from "alepha/react/router";
|
|
4
5
|
//#region src/components/nav-shell/use-nav-breadcrumbs.ts
|
|
5
6
|
/**
|
|
@@ -13,6 +14,8 @@ import { useRouterState } from "alepha/react/router";
|
|
|
13
14
|
*/
|
|
14
15
|
function useNavBreadcrumbs(options) {
|
|
15
16
|
const state = useRouterState();
|
|
17
|
+
const i18n = useI18n();
|
|
18
|
+
const lang = i18n.lang;
|
|
16
19
|
return useMemo(() => {
|
|
17
20
|
const layers = state.layers ?? [];
|
|
18
21
|
const rootIndex = layers.findIndex((l) => l.route?.name === options.root);
|
|
@@ -22,13 +25,17 @@ function useNavBreadcrumbs(options) {
|
|
|
22
25
|
const route = layer.route;
|
|
23
26
|
if (!route) continue;
|
|
24
27
|
crumbs.push({
|
|
25
|
-
label: navLabel(route),
|
|
28
|
+
label: navLabel(route, i18n.tr),
|
|
26
29
|
href: route.match
|
|
27
30
|
});
|
|
28
31
|
}
|
|
29
32
|
if (crumbs.length > 0) crumbs[crumbs.length - 1] = { label: crumbs[crumbs.length - 1].label };
|
|
30
33
|
return crumbs;
|
|
31
|
-
}, [
|
|
34
|
+
}, [
|
|
35
|
+
state.layers,
|
|
36
|
+
options.root,
|
|
37
|
+
lang
|
|
38
|
+
]);
|
|
32
39
|
}
|
|
33
40
|
//#endregion
|
|
34
41
|
export { useNavBreadcrumbs };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-nav-breadcrumbs.js","names":[],"sources":["../../../src/components/nav-shell/use-nav-breadcrumbs.ts"],"sourcesContent":["import { useRouterState } from \"alepha/react/router\";\nimport type { ReactNode } from \"react\";\nimport { useMemo } from \"react\";\n\nimport { navLabel } from \"./nav-tree-util.ts\";\n\nexport interface UseNavBreadcrumbsOptions {\n /**\n * Route name anchoring the shell. The trail starts at this layer and walks\n * down to the active leaf; ancestors above it (e.g. the global app layout)\n * are dropped.\n */\n root: string;\n}\n\nexport interface NavCrumb {\n label: ReactNode;\n href?: string;\n}\n\n/**\n * Derive the breadcrumb trail from the active route layers. Each rendered\n * layer that carries a route becomes a crumb (labelled via {@link navLabel});\n * the last one is the current page and is rendered without a link.\n *\n * Because the trail is the genuine nested-route chain, a detail page mounted\n * directly under the shell layout (rather than under its list page) yields\n * `Shell > Detail` — there is no synthetic \"list\" crumb in between.\n */\nexport function useNavBreadcrumbs(\n options: UseNavBreadcrumbsOptions,\n): NavCrumb[] {\n const state = useRouterState();\n\n return useMemo(() => {\n const layers = state.layers ?? [];\n const rootIndex = layers.findIndex((l) => l.route?.name === options.root);\n const chain = rootIndex >= 0 ? layers.slice(rootIndex) : layers;\n\n const crumbs: NavCrumb[] = [];\n for (const layer of chain) {\n const route = layer.route;\n if (!route) continue;\n crumbs.push({ label: navLabel(route), href: route.match });\n }\n\n // The current page is a label, not a link.\n if (crumbs.length > 0) {\n crumbs[crumbs.length - 1] = { label: crumbs[crumbs.length - 1].label };\n }\n return crumbs;\n }, [state.layers, options.root]);\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-nav-breadcrumbs.js","names":[],"sources":["../../../src/components/nav-shell/use-nav-breadcrumbs.ts"],"sourcesContent":["import { useI18n } from \"alepha/react/i18n\";\nimport { useRouterState } from \"alepha/react/router\";\nimport type { ReactNode } from \"react\";\nimport { useMemo } from \"react\";\n\nimport { navLabel } from \"./nav-tree-util.ts\";\n\nexport interface UseNavBreadcrumbsOptions {\n /**\n * Route name anchoring the shell. The trail starts at this layer and walks\n * down to the active leaf; ancestors above it (e.g. the global app layout)\n * are dropped.\n */\n root: string;\n}\n\nexport interface NavCrumb {\n label: ReactNode;\n href?: string;\n}\n\n/**\n * Derive the breadcrumb trail from the active route layers. Each rendered\n * layer that carries a route becomes a crumb (labelled via {@link navLabel});\n * the last one is the current page and is rendered without a link.\n *\n * Because the trail is the genuine nested-route chain, a detail page mounted\n * directly under the shell layout (rather than under its list page) yields\n * `Shell > Detail` — there is no synthetic \"list\" crumb in between.\n */\nexport function useNavBreadcrumbs(\n options: UseNavBreadcrumbsOptions,\n): NavCrumb[] {\n const state = useRouterState();\n const i18n = useI18n();\n // Load-bearing, and pinned by `admin-nav-i18n.browser.spec.tsx`: `tr` never\n // changes identity and `state.layers` does not move on a language switch, so\n // without `lang` in the list below the trail keeps its first language until\n // the next navigation.\n const lang = i18n.lang;\n\n return useMemo(() => {\n const layers = state.layers ?? [];\n const rootIndex = layers.findIndex((l) => l.route?.name === options.root);\n const chain = rootIndex >= 0 ? layers.slice(rootIndex) : layers;\n\n const crumbs: NavCrumb[] = [];\n for (const layer of chain) {\n const route = layer.route;\n if (!route) continue;\n crumbs.push({ label: navLabel(route, i18n.tr), href: route.match });\n }\n\n // The current page is a label, not a link.\n if (crumbs.length > 0) {\n crumbs[crumbs.length - 1] = { label: crumbs[crumbs.length - 1].label };\n }\n return crumbs;\n }, [state.layers, options.root, lang]);\n}\n"],"mappings":";;;;;;;;;;;;;;AA8BA,SAAgB,kBACd,SACY;CACZ,MAAM,QAAQ,eAAe;CAC7B,MAAM,OAAO,QAAQ;CAKrB,MAAM,OAAO,KAAK;CAElB,OAAO,cAAc;EACnB,MAAM,SAAS,MAAM,UAAU,CAAC;EAChC,MAAM,YAAY,OAAO,WAAW,MAAM,EAAE,OAAO,SAAS,QAAQ,IAAI;EACxE,MAAM,QAAQ,aAAa,IAAI,OAAO,MAAM,SAAS,IAAI;EAEzD,MAAM,SAAqB,CAAC;EAC5B,KAAK,MAAM,SAAS,OAAO;GACzB,MAAM,QAAQ,MAAM;GACpB,IAAI,CAAC,OAAO;GACZ,OAAO,KAAK;IAAE,OAAO,SAAS,OAAO,KAAK,EAAE;IAAG,MAAM,MAAM;GAAM,CAAC;EACpE;EAGA,IAAI,OAAO,SAAS,GAClB,OAAO,OAAO,SAAS,KAAK,EAAE,OAAO,OAAO,OAAO,SAAS,EAAE,CAAC,MAAM;EAEvE,OAAO;CACT,GAAG;EAAC,MAAM;EAAQ,QAAQ;EAAM;CAAI,CAAC;AACvC"}
|
|
@@ -23,6 +23,12 @@ export interface NavEntry {
|
|
|
23
23
|
label: ReactNode;
|
|
24
24
|
icon?: ReactNode;
|
|
25
25
|
group?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Section heading, already localised. `nav.group` stays the raw grouping key
|
|
28
|
+
* - two entries are in the same section when they agree on it, in every
|
|
29
|
+
* language - so the text a consumer renders is this, never `group`.
|
|
30
|
+
*/
|
|
31
|
+
groupLabel?: string;
|
|
26
32
|
/**
|
|
27
33
|
* `nav.order` within the group.
|
|
28
34
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-nav-entries.d.ts","sourceRoot":"","sources":["../../../src/components/nav-shell/use-nav-entries.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-nav-entries.d.ts","sourceRoot":"","sources":["../../../src/components/nav-shell/use-nav-entries.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAYvC,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;GAIG;AACH,MAAM,WAAW,QAAQ;IACvB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,SAAS,CAAC;IACjB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;OAEG;IACH,QAAQ,EAAE,OAAO,CAAC;IAClB;;;;OAIG;IACH,MAAM,EAAE,OAAO,CAAC;CACjB;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,QAAQ,EAAE,CA6DvE"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { hasNavPermission, isActivePath, isDescendantOf, keepDeepestActive, navLabel } from "./nav-tree-util.js";
|
|
1
|
+
import { hasNavPermission, isActivePath, isDescendantOf, keepDeepestActive, navGroupLabel, navLabel } from "./nav-tree-util.js";
|
|
2
2
|
import { useMemo } from "react";
|
|
3
|
+
import { useI18n } from "alepha/react/i18n";
|
|
3
4
|
import { useAuth } from "alepha/react/auth";
|
|
4
5
|
import { useRouter, useRouterState } from "alepha/react/router";
|
|
5
6
|
//#region src/components/nav-shell/use-nav-entries.ts
|
|
@@ -13,8 +14,10 @@ function useNavEntries(options) {
|
|
|
13
14
|
const router = useRouter();
|
|
14
15
|
const state = useRouterState();
|
|
15
16
|
const { has } = useAuth();
|
|
17
|
+
const i18n = useI18n();
|
|
16
18
|
const pages = router.pages;
|
|
17
19
|
const current = state.url?.pathname ?? "/";
|
|
20
|
+
const lang = i18n.lang;
|
|
18
21
|
return useMemo(() => {
|
|
19
22
|
const entries = [];
|
|
20
23
|
const groupOrders = /* @__PURE__ */ new Map();
|
|
@@ -32,9 +35,10 @@ function useNavEntries(options) {
|
|
|
32
35
|
entries.push({
|
|
33
36
|
name: page.name,
|
|
34
37
|
href: page.match,
|
|
35
|
-
label: navLabel(page),
|
|
38
|
+
label: navLabel(page, i18n.tr),
|
|
36
39
|
icon: nav.icon,
|
|
37
40
|
group: nav.group,
|
|
41
|
+
groupLabel: navGroupLabel(page, i18n.tr),
|
|
38
42
|
order,
|
|
39
43
|
groupOrder: 0,
|
|
40
44
|
keywords: nav.keywords,
|
|
@@ -51,7 +55,8 @@ function useNavEntries(options) {
|
|
|
51
55
|
pages,
|
|
52
56
|
current,
|
|
53
57
|
has,
|
|
54
|
-
options.root
|
|
58
|
+
options.root,
|
|
59
|
+
lang
|
|
55
60
|
]);
|
|
56
61
|
}
|
|
57
62
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-nav-entries.js","names":[],"sources":["../../../src/components/nav-shell/use-nav-entries.ts"],"sourcesContent":["import { useAuth } from \"alepha/react/auth\";\nimport { useRouter, useRouterState } from \"alepha/react/router\";\nimport type { ReactNode } from \"react\";\nimport { useMemo } from \"react\";\n\nimport {\n hasNavPermission,\n isActivePath,\n isDescendantOf,\n keepDeepestActive,\n navLabel,\n} from \"./nav-tree-util.ts\";\n\nexport interface UseNavEntriesOptions {\n /**\n * Route name anchoring the shell — only descendant pages contribute entries.\n * See {@link UseNavTreeOptions}.\n */\n root: string;\n}\n\n/**\n * A single resolved navigation entry derived from a `$page`'s `nav` metadata.\n * Shared by the sidebar ({@link useNavTree}) and the command palette\n * ({@link Spotlight}) so both stay in sync from one source.\n */\nexport interface NavEntry {\n /**\n * Route name — used for navigation (`router.push(name)`) and as a stable key.\n */\n name: string;\n /**\n * Resolved pathname (the page's full `match`).\n */\n href: string;\n label: ReactNode;\n icon?: ReactNode;\n group?: string;\n /**\n * `nav.order` within the group.\n */\n order: number;\n /**\n * Smallest `order` in this entry's group — drives group ordering.\n */\n groupOrder: number;\n keywords?: string[];\n description?: ReactNode;\n badge?: ReactNode;\n /**\n * `can()` returned `\"disabled\"` — show muted, block navigation.\n */\n disabled: boolean;\n /**\n * The current route is on or under this entry, and no sibling entry matched\n * it more specifically. At most one entry in a list is active — see\n * {@link keepDeepestActive}.\n */\n active: boolean;\n}\n\n/**\n * Flat, filtered, sorted list of nav entries for the subtree under `root`.\n * Filtering (hidden / permission / `can`), labelling and active-state matching\n * are applied here; consumers decide how to present them. Entries are sorted by\n * group order, then by item order.\n */\nexport function useNavEntries(options: UseNavEntriesOptions): NavEntry[] {\n const router = useRouter<any>();\n const state = useRouterState();\n const { has } = useAuth();\n const pages = router.pages;\n const current = state.url?.pathname ?? \"/\";\n\n return useMemo(() => {\n const entries: NavEntry[] = [];\n // Smallest order seen per group, so a group sorts by its earliest item.\n const groupOrders = new Map<string, number>();\n\n for (const page of pages) {\n const nav = page.nav;\n if (!nav || nav.hidden) continue;\n if (!isDescendantOf(page, options.root)) continue;\n if (!hasNavPermission(nav.permission, has)) continue;\n\n // `can` escape hatch: `false` hides, `\"disabled\"` shows muted.\n const canResult = page.can ? page.can({ has }) : true;\n if (canResult === false) continue;\n\n const order = nav.order ?? 0;\n const key = nav.group ?? \"\";\n const prev = groupOrders.get(key);\n if (prev === undefined || order < prev) groupOrders.set(key, order);\n\n entries.push({\n name: page.name,\n href: page.match,\n label: navLabel(page),\n icon: nav.icon,\n group: nav.group,\n order,\n groupOrder: 0,\n keywords: nav.keywords,\n description: nav.description,\n badge: nav.badge,\n disabled: canResult === \"disabled\",\n active: isActivePath(current, page.match),\n });\n }\n\n for (const entry of entries) {\n entry.groupOrder = groupOrders.get(entry.group ?? \"\") ?? 0;\n }\n entries.sort((a, b) => a.groupOrder - b.groupOrder || a.order - b.order);\n\n // `isActivePath` sees one entry at a time and so cannot tell that another\n // matched more specifically. Only now, with the whole set in hand, can the\n // shallower matches be dropped.\n return keepDeepestActive(entries);\n }, [pages, current, has, options.root]);\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-nav-entries.js","names":[],"sources":["../../../src/components/nav-shell/use-nav-entries.ts"],"sourcesContent":["import { useAuth } from \"alepha/react/auth\";\nimport { useI18n } from \"alepha/react/i18n\";\nimport { useRouter, useRouterState } from \"alepha/react/router\";\nimport type { ReactNode } from \"react\";\nimport { useMemo } from \"react\";\n\nimport {\n hasNavPermission,\n isActivePath,\n isDescendantOf,\n keepDeepestActive,\n navGroupLabel,\n navLabel,\n} from \"./nav-tree-util.ts\";\n\nexport interface UseNavEntriesOptions {\n /**\n * Route name anchoring the shell — only descendant pages contribute entries.\n * See {@link UseNavTreeOptions}.\n */\n root: string;\n}\n\n/**\n * A single resolved navigation entry derived from a `$page`'s `nav` metadata.\n * Shared by the sidebar ({@link useNavTree}) and the command palette\n * ({@link Spotlight}) so both stay in sync from one source.\n */\nexport interface NavEntry {\n /**\n * Route name — used for navigation (`router.push(name)`) and as a stable key.\n */\n name: string;\n /**\n * Resolved pathname (the page's full `match`).\n */\n href: string;\n label: ReactNode;\n icon?: ReactNode;\n group?: string;\n /**\n * Section heading, already localised. `nav.group` stays the raw grouping key\n * - two entries are in the same section when they agree on it, in every\n * language - so the text a consumer renders is this, never `group`.\n */\n groupLabel?: string;\n /**\n * `nav.order` within the group.\n */\n order: number;\n /**\n * Smallest `order` in this entry's group — drives group ordering.\n */\n groupOrder: number;\n keywords?: string[];\n description?: ReactNode;\n badge?: ReactNode;\n /**\n * `can()` returned `\"disabled\"` — show muted, block navigation.\n */\n disabled: boolean;\n /**\n * The current route is on or under this entry, and no sibling entry matched\n * it more specifically. At most one entry in a list is active — see\n * {@link keepDeepestActive}.\n */\n active: boolean;\n}\n\n/**\n * Flat, filtered, sorted list of nav entries for the subtree under `root`.\n * Filtering (hidden / permission / `can`), labelling and active-state matching\n * are applied here; consumers decide how to present them. Entries are sorted by\n * group order, then by item order.\n */\nexport function useNavEntries(options: UseNavEntriesOptions): NavEntry[] {\n const router = useRouter<any>();\n const state = useRouterState();\n const { has } = useAuth();\n const i18n = useI18n();\n const pages = router.pages;\n const current = state.url?.pathname ?? \"/\";\n // `tr` is a stable bound field on the provider, so it can never be what\n // tells the memo below that the labels changed: the active language has to\n // be a dependency in its own right. (`has` happens to be a fresh closure per\n // render today, which recomputes everything anyway - that is an accident of\n // `useAuth`, not something the labels may rely on.)\n const lang = i18n.lang;\n\n return useMemo(() => {\n const entries: NavEntry[] = [];\n // Smallest order seen per group, so a group sorts by its earliest item.\n const groupOrders = new Map<string, number>();\n\n for (const page of pages) {\n const nav = page.nav;\n if (!nav || nav.hidden) continue;\n if (!isDescendantOf(page, options.root)) continue;\n if (!hasNavPermission(nav.permission, has)) continue;\n\n // `can` escape hatch: `false` hides, `\"disabled\"` shows muted.\n const canResult = page.can ? page.can({ has }) : true;\n if (canResult === false) continue;\n\n const order = nav.order ?? 0;\n const key = nav.group ?? \"\";\n const prev = groupOrders.get(key);\n if (prev === undefined || order < prev) groupOrders.set(key, order);\n\n entries.push({\n name: page.name,\n href: page.match,\n label: navLabel(page, i18n.tr),\n icon: nav.icon,\n group: nav.group,\n groupLabel: navGroupLabel(page, i18n.tr),\n order,\n groupOrder: 0,\n keywords: nav.keywords,\n description: nav.description,\n badge: nav.badge,\n disabled: canResult === \"disabled\",\n active: isActivePath(current, page.match),\n });\n }\n\n for (const entry of entries) {\n entry.groupOrder = groupOrders.get(entry.group ?? \"\") ?? 0;\n }\n entries.sort((a, b) => a.groupOrder - b.groupOrder || a.order - b.order);\n\n // `isActivePath` sees one entry at a time and so cannot tell that another\n // matched more specifically. Only now, with the whole set in hand, can the\n // shallower matches be dropped.\n return keepDeepestActive(entries);\n }, [pages, current, has, options.root, lang]);\n}\n"],"mappings":";;;;;;;;;;;;AA2EA,SAAgB,cAAc,SAA2C;CACvE,MAAM,SAAS,UAAe;CAC9B,MAAM,QAAQ,eAAe;CAC7B,MAAM,EAAE,QAAQ,QAAQ;CACxB,MAAM,OAAO,QAAQ;CACrB,MAAM,QAAQ,OAAO;CACrB,MAAM,UAAU,MAAM,KAAK,YAAY;CAMvC,MAAM,OAAO,KAAK;CAElB,OAAO,cAAc;EACnB,MAAM,UAAsB,CAAC;EAE7B,MAAM,8BAAc,IAAI,IAAoB;EAE5C,KAAK,MAAM,QAAQ,OAAO;GACxB,MAAM,MAAM,KAAK;GACjB,IAAI,CAAC,OAAO,IAAI,QAAQ;GACxB,IAAI,CAAC,eAAe,MAAM,QAAQ,IAAI,GAAG;GACzC,IAAI,CAAC,iBAAiB,IAAI,YAAY,GAAG,GAAG;GAG5C,MAAM,YAAY,KAAK,MAAM,KAAK,IAAI,EAAE,IAAI,CAAC,IAAI;GACjD,IAAI,cAAc,OAAO;GAEzB,MAAM,QAAQ,IAAI,SAAS;GAC3B,MAAM,MAAM,IAAI,SAAS;GACzB,MAAM,OAAO,YAAY,IAAI,GAAG;GAChC,IAAI,SAAS,KAAA,KAAa,QAAQ,MAAM,YAAY,IAAI,KAAK,KAAK;GAElE,QAAQ,KAAK;IACX,MAAM,KAAK;IACX,MAAM,KAAK;IACX,OAAO,SAAS,MAAM,KAAK,EAAE;IAC7B,MAAM,IAAI;IACV,OAAO,IAAI;IACX,YAAY,cAAc,MAAM,KAAK,EAAE;IACvC;IACA,YAAY;IACZ,UAAU,IAAI;IACd,aAAa,IAAI;IACjB,OAAO,IAAI;IACX,UAAU,cAAc;IACxB,QAAQ,aAAa,SAAS,KAAK,KAAK;GAC1C,CAAC;EACH;EAEA,KAAK,MAAM,SAAS,SAClB,MAAM,aAAa,YAAY,IAAI,MAAM,SAAS,EAAE,KAAK;EAE3D,QAAQ,MAAM,GAAG,MAAM,EAAE,aAAa,EAAE,cAAc,EAAE,QAAQ,EAAE,KAAK;EAKvE,OAAO,kBAAkB,OAAO;CAClC,GAAG;EAAC;EAAO;EAAS;EAAK,QAAQ;EAAM;CAAI,CAAC;AAC9C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-nav-tree.d.ts","sourceRoot":"","sources":["../../../src/components/nav-shell/use-nav-tree.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,QAAQ,EAET,MAAM,2CAA2C,CAAC;AAKnD,MAAM,WAAW,iBAAiB;IAChC;;;;;OAKG;IACH,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,QAAQ,EAAE,
|
|
1
|
+
{"version":3,"file":"use-nav-tree.d.ts","sourceRoot":"","sources":["../../../src/components/nav-shell/use-nav-tree.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,QAAQ,EAET,MAAM,2CAA2C,CAAC;AAKnD,MAAM,WAAW,iBAAiB;IAChC;;;;;OAKG;IACH,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,QAAQ,EAAE,CAyBjE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-nav-tree.js","names":[],"sources":["../../../src/components/nav-shell/use-nav-tree.ts"],"sourcesContent":["import type {\n NavGroup,\n NavItem,\n} from \"@alepha/ui/components/app-shell/app-shell\";\nimport { useMemo } from \"react\";\n\nimport { type NavEntry, useNavEntries } from \"./use-nav-entries.ts\";\n\nexport interface UseNavTreeOptions {\n /**\n * Route name that anchors the shell (e.g. the `/admin` layout page). Only\n * its descendant pages with `nav` metadata become entries — this is what\n * lets an app host several shells (a `/` app shell and a `/admin` shell),\n * each scoped to its own subtree.\n */\n root: string;\n}\n\n/**\n * Derive sidebar navigation groups from the route tree. Built on the shared\n * {@link useNavEntries} (which handles filtering, permissions, `can`, labelling\n * and active-state); this hook only buckets the already-sorted entries into\n * `nav.group` sections for {@link AppShell}.\n *\n * This replaces the hand-synced nav list that used to live alongside the\n * router and breadcrumb definitions.\n */\nexport function useNavTree(options: UseNavTreeOptions): NavGroup[] {\n const entries = useNavEntries(options);\n\n return useMemo(() => {\n const groups: NavGroup[] = [];\n const byKey = new Map<string, NavItem[]>();\n\n for (const entry of entries) {\n const key = entry.group ?? \"\";\n let items = byKey.get(key);\n if (!items) {\n items = [];\n byKey.set(key, items);\n // Entries are pre-sorted by (groupOrder, order), so the first time we\n // see a group it lands in the right position.\n groups.push({
|
|
1
|
+
{"version":3,"file":"use-nav-tree.js","names":[],"sources":["../../../src/components/nav-shell/use-nav-tree.ts"],"sourcesContent":["import type {\n NavGroup,\n NavItem,\n} from \"@alepha/ui/components/app-shell/app-shell\";\nimport { useMemo } from \"react\";\n\nimport { type NavEntry, useNavEntries } from \"./use-nav-entries.ts\";\n\nexport interface UseNavTreeOptions {\n /**\n * Route name that anchors the shell (e.g. the `/admin` layout page). Only\n * its descendant pages with `nav` metadata become entries — this is what\n * lets an app host several shells (a `/` app shell and a `/admin` shell),\n * each scoped to its own subtree.\n */\n root: string;\n}\n\n/**\n * Derive sidebar navigation groups from the route tree. Built on the shared\n * {@link useNavEntries} (which handles filtering, permissions, `can`, labelling\n * and active-state); this hook only buckets the already-sorted entries into\n * `nav.group` sections for {@link AppShell}.\n *\n * This replaces the hand-synced nav list that used to live alongside the\n * router and breadcrumb definitions.\n */\nexport function useNavTree(options: UseNavTreeOptions): NavGroup[] {\n const entries = useNavEntries(options);\n\n return useMemo(() => {\n const groups: NavGroup[] = [];\n const byKey = new Map<string, NavItem[]>();\n\n for (const entry of entries) {\n const key = entry.group ?? \"\";\n let items = byKey.get(key);\n if (!items) {\n items = [];\n byKey.set(key, items);\n // Entries are pre-sorted by (groupOrder, order), so the first time we\n // see a group it lands in the right position.\n groups.push({\n label: entry.groupLabel || entry.group || undefined,\n items,\n });\n }\n items.push(toNavItem(entry));\n }\n\n return groups;\n }, [entries]);\n}\n\nfunction toNavItem(entry: NavEntry): NavItem {\n return {\n label: entry.label,\n href: entry.href,\n icon: entry.icon,\n badge: entry.badge,\n tooltip: entry.description,\n disabled: entry.disabled,\n active: entry.active,\n };\n}\n"],"mappings":";;;;;;;;;;;;AA2BA,SAAgB,WAAW,SAAwC;CACjE,MAAM,UAAU,cAAc,OAAO;CAErC,OAAO,cAAc;EACnB,MAAM,SAAqB,CAAC;EAC5B,MAAM,wBAAQ,IAAI,IAAuB;EAEzC,KAAK,MAAM,SAAS,SAAS;GAC3B,MAAM,MAAM,MAAM,SAAS;GAC3B,IAAI,QAAQ,MAAM,IAAI,GAAG;GACzB,IAAI,CAAC,OAAO;IACV,QAAQ,CAAC;IACT,MAAM,IAAI,KAAK,KAAK;IAGpB,OAAO,KAAK;KACV,OAAO,MAAM,cAAc,MAAM,SAAS,KAAA;KAC1C;IACF,CAAC;GACH;GACA,MAAM,KAAK,UAAU,KAAK,CAAC;EAC7B;EAEA,OAAO;CACT,GAAG,CAAC,OAAO,CAAC;AACd;AAEA,SAAS,UAAU,OAA0B;CAC3C,OAAO;EACL,OAAO,MAAM;EACb,MAAM,MAAM;EACZ,MAAM,MAAM;EACZ,OAAO,MAAM;EACb,SAAS,MAAM;EACf,UAAU,MAAM;EAChB,QAAQ,MAAM;CAChB;AACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Button } from "@alepha/ui/components/ui/button";
|
|
2
2
|
import { AlertDialog as AlertDialogPrimitive } from "@base-ui/react/alert-dialog";
|
|
3
|
-
import
|
|
3
|
+
import * as React from "react";
|
|
4
4
|
declare function AlertDialog({ ...props }: AlertDialogPrimitive.Root.Props): React.JSX.Element;
|
|
5
5
|
declare function AlertDialogTrigger({ ...props }: AlertDialogPrimitive.Trigger.Props): React.JSX.Element;
|
|
6
6
|
declare function AlertDialogPortal({ ...props }: AlertDialogPrimitive.Portal.Props): React.JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alert-dialog.d.ts","sourceRoot":"","sources":["../../../src/components/ui/alert-dialog.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AAEzD,OAAO,EAAE,WAAW,IAAI,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAClF,OAAO,KAAK,KAAK,
|
|
1
|
+
{"version":3,"file":"alert-dialog.d.ts","sourceRoot":"","sources":["../../../src/components/ui/alert-dialog.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AAEzD,OAAO,EAAE,WAAW,IAAI,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAClF,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,iBAAS,WAAW,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,oBAAoB,CAAC,IAAI,CAAC,KAAK,qBAEjE;AAED,iBAAS,kBAAkB,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,oBAAoB,CAAC,OAAO,CAAC,KAAK,qBAI3E;AAED,iBAAS,iBAAiB,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,oBAAoB,CAAC,MAAM,CAAC,KAAK,qBAIzE;AAED,iBAAS,kBAAkB,CAAC,EAC1B,SAAS,EACT,GAAG,KAAK,E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