@alepha/ui 0.26.0 → 0.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +86 -12
- package/dist/components/account/account-connections.js +5 -5
- package/dist/components/account/account-connections.js.map +1 -1
- package/dist/components/account/account-delete-dialog.js +4 -4
- 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.js +7 -7
- package/dist/components/account/account-keys.js.map +1 -1
- package/dist/components/account/account-layout.d.ts.map +1 -1
- package/dist/components/account/account-layout.js +7 -4
- package/dist/components/account/account-layout.js.map +1 -1
- package/dist/components/account/account-password-dialog.js +3 -3
- package/dist/components/account/account-profile.js +8 -8
- package/dist/components/account/account-profile.js.map +1 -1
- package/dist/components/account/account-router-options.d.ts.map +1 -1
- package/dist/components/account/account-router-options.js.map +1 -1
- package/dist/components/account/account-router-page.d.ts.map +1 -1
- package/dist/components/account/account-router-page.js.map +1 -1
- package/dist/components/account/account-router.d.ts +3 -2
- package/dist/components/account/account-router.d.ts.map +1 -1
- package/dist/components/account/account-router.js +4 -3
- package/dist/components/account/account-router.js.map +1 -1
- package/dist/components/account/account-security.d.ts.map +1 -1
- package/dist/components/account/account-security.js +6 -6
- 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 +19 -6
- package/dist/components/account/account-sessions.js.map +1 -1
- package/dist/components/admin/admin-analytics-query-panel.d.ts +1 -1
- package/dist/components/admin/admin-analytics-query-panel.d.ts.map +1 -1
- package/dist/components/admin/admin-analytics-query-panel.js +5 -5
- package/dist/components/admin/admin-analytics-query-panel.js.map +1 -1
- package/dist/components/admin/admin-analytics-results.d.ts +1 -1
- package/dist/components/admin/admin-analytics-results.d.ts.map +1 -1
- package/dist/components/admin/admin-analytics-results.js +2 -2
- package/dist/components/admin/admin-analytics-results.js.map +1 -1
- package/dist/components/admin/admin-analytics.d.ts +1 -1
- package/dist/components/admin/admin-analytics.d.ts.map +1 -1
- package/dist/components/admin/admin-analytics.js +3 -3
- package/dist/components/admin/admin-analytics.js.map +1 -1
- package/dist/components/admin/admin-audits.d.ts +1 -1
- package/dist/components/admin/admin-audits.d.ts.map +1 -1
- package/dist/components/admin/admin-audits.js +4 -4
- package/dist/components/admin/admin-audits.js.map +1 -1
- package/dist/components/admin/admin-dashboard-card.d.ts +42 -0
- package/dist/components/admin/admin-dashboard-card.d.ts.map +1 -0
- package/dist/components/admin/admin-dashboard-card.js +0 -0
- package/dist/components/admin/admin-dashboard-count-card.d.ts +34 -0
- package/dist/components/admin/admin-dashboard-count-card.d.ts.map +1 -0
- package/dist/components/admin/admin-dashboard-count-card.js +42 -0
- package/dist/components/admin/admin-dashboard-count-card.js.map +1 -0
- package/dist/components/admin/admin-dashboard.d.ts +20 -0
- package/dist/components/admin/admin-dashboard.d.ts.map +1 -0
- package/dist/components/admin/admin-dashboard.js +32 -0
- package/dist/components/admin/admin-dashboard.js.map +1 -0
- package/dist/components/admin/admin-files.d.ts +1 -1
- package/dist/components/admin/admin-files.d.ts.map +1 -1
- package/dist/components/admin/admin-files.js +3 -3
- package/dist/components/admin/admin-files.js.map +1 -1
- package/dist/components/admin/admin-jobs-executions-panel.d.ts +2 -2
- package/dist/components/admin/admin-jobs-executions-panel.d.ts.map +1 -1
- package/dist/components/admin/admin-jobs-executions-panel.js +16 -31
- package/dist/components/admin/admin-jobs-executions-panel.js.map +1 -1
- package/dist/components/admin/admin-jobs-status-badge.d.ts +2 -2
- package/dist/components/admin/admin-jobs-status-badge.d.ts.map +1 -1
- package/dist/components/admin/admin-jobs-status-badge.js +2 -2
- package/dist/components/admin/admin-jobs-status-badge.js.map +1 -1
- package/dist/components/admin/admin-jobs.d.ts +1 -1
- package/dist/components/admin/admin-jobs.d.ts.map +1 -1
- package/dist/components/admin/admin-jobs.js +5 -5
- package/dist/components/admin/admin-jobs.js.map +1 -1
- package/dist/components/admin/admin-keys-token-dialog.js +3 -3
- package/dist/components/admin/admin-keys-token-dialog.js.map +1 -1
- package/dist/components/admin/admin-keys.d.ts +1 -1
- package/dist/components/admin/admin-keys.d.ts.map +1 -1
- package/dist/components/admin/admin-keys.js +4 -4
- package/dist/components/admin/admin-keys.js.map +1 -1
- package/dist/components/admin/admin-layout.d.ts.map +1 -1
- package/dist/components/admin/admin-layout.js +1 -3
- package/dist/components/admin/admin-layout.js.map +1 -1
- package/dist/components/admin/admin-notifications.d.ts +1 -1
- package/dist/components/admin/admin-notifications.d.ts.map +1 -1
- package/dist/components/admin/admin-notifications.js +3 -3
- package/dist/components/admin/admin-notifications.js.map +1 -1
- package/dist/components/admin/admin-parameters.d.ts +1 -1
- package/dist/components/admin/admin-parameters.d.ts.map +1 -1
- package/dist/components/admin/admin-parameters.js +10 -10
- package/dist/components/admin/admin-parameters.js.map +1 -1
- package/dist/components/admin/admin-payments.d.ts +1 -1
- package/dist/components/admin/admin-payments.d.ts.map +1 -1
- package/dist/components/admin/admin-payments.js +3 -3
- package/dist/components/admin/admin-payments.js.map +1 -1
- package/dist/components/admin/admin-router-options.d.ts +13 -10
- package/dist/components/admin/admin-router-options.d.ts.map +1 -1
- package/dist/components/admin/admin-router-options.js.map +1 -1
- package/dist/components/admin/admin-router-page.d.ts +7 -5
- package/dist/components/admin/admin-router-page.d.ts.map +1 -1
- package/dist/components/admin/admin-router-page.js +7 -5
- package/dist/components/admin/admin-router-page.js.map +1 -1
- package/dist/components/admin/admin-router.d.ts +72 -27
- package/dist/components/admin/admin-router.d.ts.map +1 -1
- package/dist/components/admin/admin-router.js +103 -40
- package/dist/components/admin/admin-router.js.map +1 -1
- package/dist/components/admin/admin-sessions.d.ts +1 -1
- package/dist/components/admin/admin-sessions.d.ts.map +1 -1
- package/dist/components/admin/admin-sessions.js +12 -4
- package/dist/components/admin/admin-sessions.js.map +1 -1
- package/dist/components/admin/admin-user-detail-audits-tab.d.ts +2 -2
- package/dist/components/admin/admin-user-detail-audits-tab.d.ts.map +1 -1
- package/dist/components/admin/admin-user-detail-audits-tab.js.map +1 -1
- package/dist/components/admin/admin-user-detail-identity-aside.d.ts +4 -3
- package/dist/components/admin/admin-user-detail-identity-aside.d.ts.map +1 -1
- package/dist/components/admin/admin-user-detail-identity-aside.js +13 -69
- package/dist/components/admin/admin-user-detail-identity-aside.js.map +1 -1
- package/dist/components/admin/admin-user-detail-overview-tab.d.ts.map +1 -1
- package/dist/components/admin/admin-user-detail-overview-tab.js.map +1 -1
- package/dist/components/admin/admin-user-detail-password-dialog.d.ts.map +1 -1
- package/dist/components/admin/admin-user-detail-password-dialog.js.map +1 -1
- package/dist/components/admin/admin-user-detail-profile-policy.d.ts.map +1 -1
- package/dist/components/admin/admin-user-detail-profile-policy.js.map +1 -1
- package/dist/components/admin/admin-user-detail-security-tab.d.ts.map +1 -1
- package/dist/components/admin/admin-user-detail-security-tab.js +2 -2
- package/dist/components/admin/admin-user-detail-security-tab.js.map +1 -1
- package/dist/components/admin/admin-user-detail-sessions-tab.d.ts +2 -2
- package/dist/components/admin/admin-user-detail-sessions-tab.d.ts.map +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 +68 -111
- package/dist/components/admin/admin-user-detail.js.map +1 -1
- package/dist/components/admin/admin-users-roles-picker.d.ts +6 -1
- package/dist/components/admin/admin-users-roles-picker.d.ts.map +1 -1
- package/dist/components/admin/admin-users-roles-picker.js +11 -8
- package/dist/components/admin/admin-users-roles-picker.js.map +1 -1
- package/dist/components/admin/admin-users.d.ts.map +1 -1
- package/dist/components/admin/admin-users.js +9 -12
- package/dist/components/admin/admin-users.js.map +1 -1
- package/dist/components/admin/admin-workflows-execution-sheet.d.ts +2 -2
- package/dist/components/admin/admin-workflows-execution-sheet.d.ts.map +1 -1
- package/dist/components/admin/admin-workflows-execution-sheet.js +10 -10
- package/dist/components/admin/admin-workflows-execution-sheet.js.map +1 -1
- package/dist/components/admin/admin-workflows-executions-panel.d.ts +2 -2
- package/dist/components/admin/admin-workflows-executions-panel.d.ts.map +1 -1
- package/dist/components/admin/admin-workflows-executions-panel.js +20 -44
- package/dist/components/admin/admin-workflows-executions-panel.js.map +1 -1
- package/dist/components/admin/admin-workflows-status-badge.d.ts +2 -2
- package/dist/components/admin/admin-workflows-status-badge.d.ts.map +1 -1
- package/dist/components/admin/admin-workflows-status-badge.js +2 -2
- package/dist/components/admin/admin-workflows-status-badge.js.map +1 -1
- package/dist/components/admin/admin-workflows.d.ts +1 -1
- package/dist/components/admin/admin-workflows.d.ts.map +1 -1
- package/dist/components/admin/admin-workflows.js +5 -5
- package/dist/components/admin/admin-workflows.js.map +1 -1
- package/dist/components/admin/diff-lines.js +1 -1
- package/dist/components/admin/diff-lines.js.map +1 -1
- package/dist/components/admin/parameter-diff-dialog.d.ts.map +1 -1
- package/dist/components/admin/parameter-diff-dialog.js +1 -1
- package/dist/components/admin/parameter-diff-dialog.js.map +1 -1
- package/dist/components/admin/parameter-history-item.d.ts.map +1 -1
- package/dist/components/admin/parameter-history-item.js +4 -4
- package/dist/components/admin/parameter-history-item.js.map +1 -1
- package/dist/components/admin/parameter-json-dialog.js +1 -1
- package/dist/components/admin/parameter-save-dialog.js +2 -2
- package/dist/components/admin/use-confirmed-action.js +1 -1
- package/dist/components/alepha-table/alepha-table.d.ts +103 -8
- package/dist/components/alepha-table/alepha-table.d.ts.map +1 -1
- package/dist/components/alepha-table/alepha-table.js +128 -26
- package/dist/components/alepha-table/alepha-table.js.map +1 -1
- package/dist/components/alepha-table/paginate-local.d.ts +43 -0
- package/dist/components/alepha-table/paginate-local.d.ts.map +1 -0
- package/dist/components/alepha-table/paginate-local.js +84 -0
- package/dist/components/alepha-table/paginate-local.js.map +1 -0
- package/dist/components/app-actions/app-actions.js +1 -1
- package/dist/components/app-shell/app-shell.d.ts +10 -1
- package/dist/components/app-shell/app-shell.d.ts.map +1 -1
- package/dist/components/app-shell/app-shell.js +27 -20
- package/dist/components/app-shell/app-shell.js.map +1 -1
- package/dist/components/auth/auth-login.d.ts +1 -1
- package/dist/components/auth/auth-login.d.ts.map +1 -1
- package/dist/components/auth/auth-login.js +7 -18
- package/dist/components/auth/auth-login.js.map +1 -1
- package/dist/components/auth/auth-register.d.ts +1 -1
- package/dist/components/auth/auth-register.d.ts.map +1 -1
- package/dist/components/auth/auth-register.js +20 -21
- package/dist/components/auth/auth-register.js.map +1 -1
- package/dist/components/auth/auth-reset-password.d.ts +1 -1
- package/dist/components/auth/auth-reset-password.d.ts.map +1 -1
- package/dist/components/auth/auth-reset-password.js +16 -13
- package/dist/components/auth/auth-reset-password.js.map +1 -1
- package/dist/components/auth/auth-router.d.ts +3 -3
- package/dist/components/auth/auth-router.d.ts.map +1 -1
- package/dist/components/auth/auth-router.js +3 -3
- package/dist/components/auth/auth-router.js.map +1 -1
- package/dist/components/auth/auth-verify-email.d.ts +1 -1
- package/dist/components/auth/auth-verify-email.d.ts.map +1 -1
- package/dist/components/auth/auth-verify-email.js +8 -8
- package/dist/components/auth/auth-verify-email.js.map +1 -1
- package/dist/components/auth/safe-redirect.d.ts +9 -0
- package/dist/components/auth/safe-redirect.d.ts.map +1 -0
- package/dist/components/auth/safe-redirect.js +19 -0
- package/dist/components/auth/safe-redirect.js.map +1 -0
- package/dist/components/auto-form/auto-form.d.ts.map +1 -1
- package/dist/components/auto-form/auto-form.js +32 -32
- package/dist/components/auto-form/auto-form.js.map +1 -1
- package/dist/components/brand-icon/brand-icon.d.ts +1 -1
- package/dist/components/brand-icon/brand-icon.d.ts.map +1 -1
- package/dist/components/brand-icon/brand-icon.js +2 -2
- package/dist/components/brand-icon/brand-icon.js.map +1 -1
- package/dist/components/button-dark/button-dark.d.ts +1 -1
- package/dist/components/button-dark/button-dark.d.ts.map +1 -1
- package/dist/components/button-dark/button-dark.js +2 -2
- package/dist/components/button-dark/button-dark.js.map +1 -1
- package/dist/components/button-language/button-language.d.ts +1 -1
- package/dist/components/button-language/button-language.d.ts.map +1 -1
- package/dist/components/button-language/button-language.js +2 -2
- package/dist/components/button-language/button-language.js.map +1 -1
- package/dist/components/button-theme/button-theme.d.ts +1 -1
- package/dist/components/button-theme/button-theme.d.ts.map +1 -1
- package/dist/components/button-theme/button-theme.js +3 -3
- package/dist/components/button-theme/button-theme.js.map +1 -1
- package/dist/components/button-user/button-user.d.ts +2 -20
- package/dist/components/button-user/button-user.d.ts.map +1 -1
- package/dist/components/button-user/button-user.js +3 -3
- package/dist/components/button-user/button-user.js.map +1 -1
- package/dist/components/captcha/turnstile-widget.d.ts +2 -2
- package/dist/components/captcha/turnstile-widget.d.ts.map +1 -1
- package/dist/components/captcha/turnstile-widget.js +5 -4
- package/dist/components/captcha/turnstile-widget.js.map +1 -1
- package/dist/components/control/control.d.ts +1 -1
- package/dist/components/control/control.d.ts.map +1 -1
- package/dist/components/control/control.js +8 -11
- package/dist/components/control/control.js.map +1 -1
- package/dist/components/control-array/control-array.d.ts +1 -1
- package/dist/components/control-array/control-array.d.ts.map +1 -1
- package/dist/components/control-array/control-array.js +23 -16
- package/dist/components/control-array/control-array.js.map +1 -1
- package/dist/components/control-base/field-i18n.d.ts +5 -3
- package/dist/components/control-base/field-i18n.d.ts.map +1 -1
- package/dist/components/control-base/field-i18n.js +4 -2
- package/dist/components/control-base/field-i18n.js.map +1 -1
- package/dist/components/control-base/form-field.d.ts +7 -7
- package/dist/components/control-base/form-field.d.ts.map +1 -1
- package/dist/components/control-base/form-field.js +10 -10
- package/dist/components/control-base/form-field.js.map +1 -1
- package/dist/components/control-base/icon-hint.d.ts +1 -1
- package/dist/components/control-base/icon-hint.d.ts.map +1 -1
- package/dist/components/control-base/icon-hint.js.map +1 -1
- package/dist/components/control-date/control-date.d.ts +1 -1
- package/dist/components/control-date/control-date.d.ts.map +1 -1
- package/dist/components/control-date/control-date.js +23 -7
- package/dist/components/control-date/control-date.js.map +1 -1
- package/dist/components/control-number/control-number.d.ts +2 -2
- package/dist/components/control-number/control-number.d.ts.map +1 -1
- package/dist/components/control-number/control-number.js +3 -3
- package/dist/components/control-number/control-number.js.map +1 -1
- package/dist/components/control-object/control-object.d.ts +4 -2
- package/dist/components/control-object/control-object.d.ts.map +1 -1
- package/dist/components/control-object/control-object.js +8 -8
- package/dist/components/control-object/control-object.js.map +1 -1
- package/dist/components/control-password/control-password.js +2 -3
- package/dist/components/control-password/control-password.js.map +1 -1
- package/dist/components/control-select/control-select.d.ts +2 -2
- package/dist/components/control-select/control-select.d.ts.map +1 -1
- package/dist/components/control-select/control-select.js +17 -17
- package/dist/components/control-select/control-select.js.map +1 -1
- package/dist/components/control-upload/control-upload.d.ts +1 -1
- package/dist/components/control-upload/control-upload.d.ts.map +1 -1
- package/dist/components/control-upload/control-upload.js +11 -11
- package/dist/components/control-upload/control-upload.js.map +1 -1
- package/dist/components/detail/detail-aside.d.ts +58 -0
- package/dist/components/detail/detail-aside.d.ts.map +1 -0
- package/dist/components/detail/detail-aside.js +95 -0
- package/dist/components/detail/detail-aside.js.map +1 -0
- package/dist/components/detail/detail-layout.d.ts +90 -0
- package/dist/components/detail/detail-layout.d.ts.map +1 -0
- package/dist/components/detail/detail-layout.js +102 -0
- package/dist/components/detail/detail-layout.js.map +1 -0
- package/dist/components/detail/use-detail-tab.d.ts +15 -0
- package/dist/components/detail/use-detail-tab.d.ts.map +1 -0
- package/dist/components/detail/use-detail-tab.js +37 -0
- package/dist/components/detail/use-detail-tab.js.map +1 -0
- package/dist/components/file-image/file-image.d.ts.map +1 -1
- package/dist/components/file-image/file-image.js.map +1 -1
- package/dist/components/language-toggle/language-toggle.d.ts +1 -1
- package/dist/components/language-toggle/language-toggle.d.ts.map +1 -1
- package/dist/components/language-toggle/language-toggle.js +2 -2
- package/dist/components/language-toggle/language-toggle.js.map +1 -1
- package/dist/components/markdown-view/diagram/DiagramErrorBoundary.d.ts +28 -0
- package/dist/components/markdown-view/diagram/DiagramErrorBoundary.d.ts.map +1 -0
- package/dist/components/markdown-view/diagram/DiagramErrorBoundary.js +25 -0
- package/dist/components/markdown-view/diagram/DiagramErrorBoundary.js.map +1 -0
- package/dist/components/markdown-view/diagram/FlowchartDiagram.d.ts +44 -0
- package/dist/components/markdown-view/diagram/FlowchartDiagram.d.ts.map +1 -0
- package/dist/components/markdown-view/diagram/FlowchartDiagram.js +98 -0
- package/dist/components/markdown-view/diagram/FlowchartDiagram.js.map +1 -0
- package/dist/components/markdown-view/diagram/FlowchartDiagramCluster.d.ts +14 -0
- package/dist/components/markdown-view/diagram/FlowchartDiagramCluster.d.ts.map +1 -0
- package/dist/components/markdown-view/diagram/FlowchartDiagramCluster.js +45 -0
- package/dist/components/markdown-view/diagram/FlowchartDiagramCluster.js.map +1 -0
- package/dist/components/markdown-view/diagram/FlowchartDiagramEdge.d.ts +19 -0
- package/dist/components/markdown-view/diagram/FlowchartDiagramEdge.d.ts.map +1 -0
- package/dist/components/markdown-view/diagram/FlowchartDiagramEdge.js +69 -0
- package/dist/components/markdown-view/diagram/FlowchartDiagramEdge.js.map +1 -0
- package/dist/components/markdown-view/diagram/FlowchartDiagramLabel.d.ts +23 -0
- package/dist/components/markdown-view/diagram/FlowchartDiagramLabel.d.ts.map +1 -0
- package/dist/components/markdown-view/diagram/FlowchartDiagramLabel.js +34 -0
- package/dist/components/markdown-view/diagram/FlowchartDiagramLabel.js.map +1 -0
- package/dist/components/markdown-view/diagram/FlowchartDiagramNode.d.ts +17 -0
- package/dist/components/markdown-view/diagram/FlowchartDiagramNode.d.ts.map +1 -0
- package/dist/components/markdown-view/diagram/FlowchartDiagramNode.js +63 -0
- package/dist/components/markdown-view/diagram/FlowchartDiagramNode.js.map +1 -0
- package/dist/components/markdown-view/diagram/MermaidFence.d.ts +30 -0
- package/dist/components/markdown-view/diagram/MermaidFence.d.ts.map +1 -0
- package/dist/components/markdown-view/diagram/MermaidFence.js +30 -0
- package/dist/components/markdown-view/diagram/MermaidFence.js.map +1 -0
- package/dist/components/markdown-view/diagram/flowchartParser.d.ts +18 -0
- package/dist/components/markdown-view/diagram/flowchartParser.d.ts.map +1 -0
- package/dist/components/markdown-view/diagram/flowchartParser.js +370 -0
- package/dist/components/markdown-view/diagram/flowchartParser.js.map +1 -0
- package/dist/components/markdown-view/diagram/graphModel.d.ts +67 -0
- package/dist/components/markdown-view/diagram/graphModel.d.ts.map +1 -0
- package/dist/components/markdown-view/diagram/graphModel.js +0 -0
- package/dist/components/markdown-view/diagram/layoutFlowchart.d.ts +109 -0
- package/dist/components/markdown-view/diagram/layoutFlowchart.d.ts.map +1 -0
- package/dist/components/markdown-view/diagram/layoutFlowchart.js +185 -0
- package/dist/components/markdown-view/diagram/layoutFlowchart.js.map +1 -0
- package/dist/components/markdown-view/diagram/textMetrics.d.ts +63 -0
- package/dist/components/markdown-view/diagram/textMetrics.d.ts.map +1 -0
- package/dist/components/markdown-view/diagram/textMetrics.js +228 -0
- package/dist/components/markdown-view/diagram/textMetrics.js.map +1 -0
- package/dist/components/markdown-view/markdown-view.d.ts +32 -0
- package/dist/components/markdown-view/markdown-view.d.ts.map +1 -1
- package/dist/components/markdown-view/markdown-view.js +85 -9
- package/dist/components/markdown-view/markdown-view.js.map +1 -1
- package/dist/components/nav-shell/nav-shell.d.ts +1 -1
- package/dist/components/nav-shell/nav-shell.d.ts.map +1 -1
- package/dist/components/nav-shell/nav-shell.js +1 -1
- package/dist/components/nav-shell/nav-shell.js.map +1 -1
- package/dist/components/nav-shell/spotlight.d.ts.map +1 -1
- 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.map +1 -1
- package/dist/components/nav-shell/use-nav-entries.d.ts +15 -5
- package/dist/components/nav-shell/use-nav-entries.d.ts.map +1 -1
- package/dist/components/nav-shell/use-nav-entries.js +1 -1
- 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.map +1 -1
- package/dist/components/settings/settings-card-edge.d.ts +25 -0
- package/dist/components/settings/settings-card-edge.d.ts.map +1 -0
- package/dist/components/settings/settings-card-edge.js +29 -0
- package/dist/components/settings/settings-card-edge.js.map +1 -0
- package/dist/components/settings/settings-danger-section.d.ts.map +1 -1
- package/dist/components/settings/settings-danger-section.js +2 -1
- package/dist/components/settings/settings-danger-section.js.map +1 -1
- package/dist/components/settings/settings-layout.d.ts.map +1 -1
- package/dist/components/settings/settings-layout.js +1 -1
- package/dist/components/settings/settings-layout.js.map +1 -1
- package/dist/components/settings/settings-nav.d.ts.map +1 -1
- package/dist/components/settings/settings-nav.js +3 -3
- package/dist/components/settings/settings-nav.js.map +1 -1
- package/dist/components/settings/settings-row.js +2 -2
- package/dist/components/settings/settings-row.js.map +1 -1
- package/dist/components/settings/settings-section.d.ts.map +1 -1
- package/dist/components/settings/settings-section.js +3 -2
- package/dist/components/settings/settings-section.js.map +1 -1
- package/dist/components/ui/accordion.js +3 -3
- package/dist/components/ui/accordion.js.map +1 -1
- package/dist/components/ui/alert-dialog.js +5 -5
- package/dist/components/ui/alert-dialog.js.map +1 -1
- package/dist/components/ui/alert.js +2 -2
- package/dist/components/ui/alert.js.map +1 -1
- package/dist/components/ui/avatar.js +5 -5
- package/dist/components/ui/avatar.js.map +1 -1
- package/dist/components/ui/badge.d.ts +13 -2
- package/dist/components/ui/badge.d.ts.map +1 -1
- package/dist/components/ui/badge.js +51 -12
- package/dist/components/ui/badge.js.map +1 -1
- package/dist/components/ui/breadcrumb.js +3 -3
- package/dist/components/ui/breadcrumb.js.map +1 -1
- package/dist/components/ui/button-group.js +2 -2
- package/dist/components/ui/button-group.js.map +1 -1
- package/dist/components/ui/button.js +2 -2
- package/dist/components/ui/button.js.map +1 -1
- package/dist/components/ui/calendar.js +8 -8
- package/dist/components/ui/calendar.js.map +1 -1
- package/dist/components/ui/card.js +3 -3
- package/dist/components/ui/card.js.map +1 -1
- package/dist/components/ui/carousel.d.ts.map +1 -1
- package/dist/components/ui/carousel.js +20 -10
- package/dist/components/ui/carousel.js.map +1 -1
- package/dist/components/ui/chart.d.ts.map +1 -1
- package/dist/components/ui/chart.js +7 -6
- package/dist/components/ui/chart.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.map +1 -1
- package/dist/components/ui/combobox.js +8 -8
- package/dist/components/ui/combobox.js.map +1 -1
- package/dist/components/ui/command.d.ts.map +1 -1
- package/dist/components/ui/command.js +6 -6
- package/dist/components/ui/command.js.map +1 -1
- package/dist/components/ui/context-menu.js +8 -8
- package/dist/components/ui/context-menu.js.map +1 -1
- package/dist/components/ui/dialog.js +4 -4
- package/dist/components/ui/dialog.js.map +1 -1
- package/dist/components/ui/drawer.js +4 -4
- package/dist/components/ui/drawer.js.map +1 -1
- package/dist/components/ui/dropdown-menu.js +9 -9
- package/dist/components/ui/dropdown-menu.js.map +1 -1
- package/dist/components/ui/empty.js +2 -2
- package/dist/components/ui/empty.js.map +1 -1
- package/dist/components/ui/hover-card.js +1 -1
- package/dist/components/ui/hover-card.js.map +1 -1
- package/dist/components/ui/input-group.d.ts.map +1 -1
- package/dist/components/ui/input-group.js +3 -3
- package/dist/components/ui/input-group.js.map +1 -1
- package/dist/components/ui/input-otp.js +3 -3
- package/dist/components/ui/input-otp.js.map +1 -1
- package/dist/components/ui/input.js +1 -1
- package/dist/components/ui/input.js.map +1 -1
- package/dist/components/ui/item.js +3 -3
- package/dist/components/ui/item.js.map +1 -1
- package/dist/components/ui/kbd.js +1 -1
- package/dist/components/ui/kbd.js.map +1 -1
- package/dist/components/ui/label.d.ts.map +1 -1
- package/dist/components/ui/label.js.map +1 -1
- package/dist/components/ui/menubar.js +9 -9
- package/dist/components/ui/menubar.js.map +1 -1
- package/dist/components/ui/navigation-menu.js +7 -7
- package/dist/components/ui/navigation-menu.js.map +1 -1
- package/dist/components/ui/pagination.d.ts.map +1 -1
- package/dist/components/ui/pagination.js.map +1 -1
- package/dist/components/ui/popover.js +1 -1
- package/dist/components/ui/popover.js.map +1 -1
- package/dist/components/ui/progress.js +3 -3
- package/dist/components/ui/progress.js.map +1 -1
- package/dist/components/ui/radio-group.js +2 -2
- package/dist/components/ui/radio-group.js.map +1 -1
- package/dist/components/ui/resizable.js +2 -2
- package/dist/components/ui/resizable.js.map +1 -1
- package/dist/components/ui/scroll-area.js +2 -2
- package/dist/components/ui/scroll-area.js.map +1 -1
- package/dist/components/ui/segmented.d.ts.map +1 -1
- package/dist/components/ui/segmented.js +1 -1
- package/dist/components/ui/segmented.js.map +1 -1
- package/dist/components/ui/select.js +8 -8
- package/dist/components/ui/select.js.map +1 -1
- package/dist/components/ui/separator.js +1 -1
- package/dist/components/ui/separator.js.map +1 -1
- package/dist/components/ui/sheet.js +3 -3
- package/dist/components/ui/sheet.js.map +1 -1
- package/dist/components/ui/sidebar.js +17 -17
- package/dist/components/ui/sidebar.js.map +1 -1
- package/dist/components/ui/skeleton.js +1 -1
- package/dist/components/ui/skeleton.js.map +1 -1
- package/dist/components/ui/slider.js +2 -2
- package/dist/components/ui/slider.js.map +1 -1
- package/dist/components/ui/sonner.js +1 -1
- package/dist/components/ui/switch.js +2 -2
- package/dist/components/ui/switch.js.map +1 -1
- package/dist/components/ui/table.d.ts.map +1 -1
- package/dist/components/ui/table.js +5 -5
- package/dist/components/ui/table.js.map +1 -1
- package/dist/components/ui/tabs.js +2 -2
- package/dist/components/ui/tabs.js.map +1 -1
- package/dist/components/ui/textarea.js +1 -1
- package/dist/components/ui/textarea.js.map +1 -1
- package/dist/components/ui/toggle-group.d.ts.map +1 -1
- package/dist/components/ui/toggle-group.js +13 -7
- package/dist/components/ui/toggle-group.js.map +1 -1
- package/dist/components/ui/toggle.js +2 -2
- package/dist/components/ui/toggle.js.map +1 -1
- package/dist/components/ui/tooltip.d.ts +10 -0
- package/dist/components/ui/tooltip.d.ts.map +1 -1
- package/dist/components/ui/tooltip.js +13 -3
- package/dist/components/ui/tooltip.js.map +1 -1
- package/dist/components/use-dialog/use-dialog.d.ts +2 -2
- package/dist/components/use-dialog/use-dialog.d.ts.map +1 -1
- package/dist/components/use-dialog/use-dialog.js +10 -6
- package/dist/components/use-dialog/use-dialog.js.map +1 -1
- package/dist/components/use-toast/use-toast.d.ts +9 -3
- package/dist/components/use-toast/use-toast.d.ts.map +1 -1
- package/dist/components/use-toast/use-toast.js +23 -22
- package/dist/components/use-toast/use-toast.js.map +1 -1
- package/dist/hooks/use-mobile.d.ts +10 -0
- package/dist/hooks/use-mobile.d.ts.map +1 -1
- package/dist/hooks/use-mobile.js +19 -12
- package/dist/hooks/use-mobile.js.map +1 -1
- package/dist/lib/i18n-fr.d.ts +3 -3
- package/dist/lib/i18n-fr.d.ts.map +1 -1
- package/dist/lib/i18n-fr.js +13 -8
- package/dist/lib/i18n-fr.js.map +1 -1
- package/dist/styles.css +5 -5
- package/package.json +46 -45
- package/src/components/account/__tests__/account-router.spec.ts +4 -2
- package/src/components/account/account-connections.tsx +1 -1
- package/src/components/account/account-header.tsx +6 -1
- package/src/components/account/account-keys.tsx +1 -1
- package/src/components/account/account-layout.tsx +8 -1
- package/src/components/account/account-profile.tsx +3 -3
- package/src/components/account/account-router-options.tsx +1 -0
- package/src/components/account/account-router-page.tsx +1 -0
- package/src/components/account/account-router.tsx +4 -2
- package/src/components/account/account-security.tsx +1 -0
- package/src/components/account/account-sessions.tsx +21 -4
- package/src/components/admin/__tests__/admin-keys-token-dialog.browser.spec.tsx +1 -0
- package/src/components/admin/__tests__/admin-layout.browser.spec.tsx +2 -1
- package/src/components/admin/__tests__/admin-router-page.spec.ts +2 -1
- package/src/components/admin/__tests__/admin-router.spec.ts +57 -1
- package/src/components/admin/__tests__/admin-user-cell.browser.spec.tsx +1 -0
- package/src/components/admin/__tests__/admin-user-detail.spec.ts +1 -0
- package/src/components/admin/admin-analytics-query-panel.tsx +4 -3
- package/src/components/admin/admin-analytics-results.tsx +2 -2
- package/src/components/admin/admin-analytics.tsx +3 -3
- package/src/components/admin/admin-audits.tsx +3 -3
- package/src/components/admin/admin-dashboard-card.tsx +45 -0
- package/src/components/admin/admin-dashboard-count-card.tsx +89 -0
- package/src/components/admin/admin-dashboard.tsx +60 -0
- package/src/components/admin/admin-files.tsx +2 -2
- package/src/components/admin/admin-jobs-executions-panel.tsx +19 -12
- package/src/components/admin/admin-jobs-status-badge.tsx +2 -2
- package/src/components/admin/admin-jobs.tsx +4 -4
- package/src/components/admin/admin-keys-token-dialog.tsx +2 -2
- package/src/components/admin/admin-keys.tsx +2 -2
- package/src/components/admin/admin-layout.tsx +1 -2
- package/src/components/admin/admin-notifications.tsx +2 -2
- package/src/components/admin/admin-parameters.tsx +16 -9
- package/src/components/admin/admin-payments.tsx +2 -2
- package/src/components/admin/admin-router-options.tsx +14 -10
- package/src/components/admin/admin-router-page.tsx +8 -5
- package/src/components/admin/admin-router.tsx +112 -40
- package/src/components/admin/admin-sessions.tsx +13 -2
- package/src/components/admin/admin-user-detail-audits-tab.tsx +5 -2
- package/src/components/admin/admin-user-detail-identity-aside.tsx +16 -93
- package/src/components/admin/admin-user-detail-overview-tab.tsx +1 -0
- package/src/components/admin/admin-user-detail-password-dialog.tsx +1 -0
- package/src/components/admin/admin-user-detail-profile-policy.spec.ts +1 -0
- package/src/components/admin/admin-user-detail-profile-policy.ts +1 -0
- package/src/components/admin/admin-user-detail-security-tab.tsx +1 -0
- package/src/components/admin/admin-user-detail-sessions-tab.tsx +5 -2
- package/src/components/admin/admin-user-detail.tsx +49 -87
- package/src/components/admin/admin-users-roles-picker.tsx +22 -15
- package/src/components/admin/admin-users.tsx +8 -14
- package/src/components/admin/admin-workflows-execution-sheet.tsx +18 -10
- package/src/components/admin/admin-workflows-executions-panel.tsx +24 -17
- package/src/components/admin/admin-workflows-status-badge.tsx +4 -2
- package/src/components/admin/admin-workflows.tsx +6 -4
- package/src/components/admin/diff-lines.spec.ts +1 -0
- package/src/components/admin/diff-lines.ts +1 -1
- package/src/components/admin/parameter-diff-dialog.tsx +3 -2
- package/src/components/admin/parameter-history-item.tsx +6 -5
- package/src/components/alepha-table/__tests__/alepha-table-static.browser.spec.tsx +190 -0
- package/src/components/alepha-table/__tests__/paginate-local.spec.ts +286 -0
- package/src/components/alepha-table/__tests__/use-table-selection.browser.spec.tsx +1 -0
- package/src/components/alepha-table/alepha-table.tsx +362 -79
- package/src/components/alepha-table/paginate-local.ts +174 -0
- package/src/components/app-actions/__tests__/app-actions.browser.spec.tsx +1 -0
- package/src/components/app-shell/app-shell.tsx +42 -19
- package/src/components/auth/__tests__/auth-router.spec.ts +2 -1
- package/src/components/auth/auth-login.tsx +5 -16
- package/src/components/auth/auth-register.tsx +26 -25
- package/src/components/auth/auth-reset-password.tsx +24 -17
- package/src/components/auth/auth-router.tsx +4 -3
- package/src/components/auth/auth-verify-email.tsx +7 -7
- package/src/components/auth/safe-redirect.ts +14 -0
- package/src/components/auto-form/__tests__/auto-form-settings-card.browser.spec.tsx +1 -0
- package/src/components/auto-form/auto-form.tsx +60 -39
- package/src/components/brand-icon/brand-icon.tsx +2 -2
- package/src/components/button-dark/button-dark.tsx +2 -2
- package/src/components/button-language/button-language.tsx +2 -2
- package/src/components/button-theme/button-theme.tsx +2 -2
- package/src/components/button-user/button-user.tsx +4 -4
- package/src/components/captcha/turnstile-widget.tsx +6 -5
- package/src/components/control/control.tsx +6 -6
- package/src/components/control-array/control-array.tsx +28 -15
- package/src/components/control-base/__tests__/form-field-a11y.browser.spec.tsx +1 -0
- package/src/components/control-base/field-i18n.ts +5 -3
- package/src/components/control-base/form-field.tsx +13 -13
- package/src/components/control-base/icon-hint.tsx +1 -1
- package/src/components/control-date/control-date.tsx +29 -6
- package/src/components/control-number/control-number.tsx +3 -3
- package/src/components/control-object/control-object.tsx +11 -8
- package/src/components/control-password/control-password.tsx +2 -2
- package/src/components/control-select/__tests__/control-select-clear-label.browser.spec.tsx +1 -0
- package/src/components/control-select/__tests__/control-select-deselect.browser.spec.tsx +1 -0
- package/src/components/control-select/__tests__/control-select-searchable.browser.spec.tsx +1 -0
- package/src/components/control-select/control-select.tsx +32 -18
- package/src/components/control-upload/control-upload.tsx +16 -10
- package/src/components/detail/__tests__/detail-aside.browser.spec.tsx +135 -0
- package/src/components/detail/__tests__/detail-layout.browser.spec.tsx +151 -0
- package/src/components/detail/detail-aside.tsx +198 -0
- package/src/components/detail/detail-layout.tsx +181 -0
- package/src/components/detail/use-detail-tab.tsx +41 -0
- package/src/components/file-image/file-image.tsx +4 -2
- package/src/components/language-toggle/language-toggle.tsx +2 -2
- package/src/components/markdown-view/__tests__/markdown-view-mermaid.browser.spec.tsx +148 -0
- package/src/components/markdown-view/__tests__/markdown-view-raw-html.browser.spec.tsx +1 -0
- package/src/components/markdown-view/diagram/DiagramErrorBoundary.tsx +42 -0
- package/src/components/markdown-view/diagram/FlowchartDiagram.tsx +136 -0
- package/src/components/markdown-view/diagram/FlowchartDiagramCluster.tsx +59 -0
- package/src/components/markdown-view/diagram/FlowchartDiagramEdge.tsx +95 -0
- package/src/components/markdown-view/diagram/FlowchartDiagramLabel.tsx +58 -0
- package/src/components/markdown-view/diagram/FlowchartDiagramNode.tsx +78 -0
- package/src/components/markdown-view/diagram/MermaidFence.tsx +46 -0
- package/src/components/markdown-view/diagram/__tests__/flowchart-diagram.browser.spec.tsx +210 -0
- package/src/components/markdown-view/diagram/flowchartParser.spec.ts +379 -0
- package/src/components/markdown-view/diagram/flowchartParser.ts +475 -0
- package/src/components/markdown-view/diagram/graphModel.ts +72 -0
- package/src/components/markdown-view/diagram/layoutFlowchart.spec.ts +235 -0
- package/src/components/markdown-view/diagram/layoutFlowchart.ts +324 -0
- package/src/components/markdown-view/diagram/textMetrics.spec.ts +128 -0
- package/src/components/markdown-view/diagram/textMetrics.ts +296 -0
- package/src/components/markdown-view/markdown-view.tsx +128 -9
- package/src/components/nav-shell/__tests__/nav-tree-util.spec.ts +1 -0
- package/src/components/nav-shell/nav-shell.tsx +6 -3
- package/src/components/nav-shell/spotlight.tsx +2 -1
- package/src/components/nav-shell/use-nav-breadcrumbs.ts +1 -0
- package/src/components/nav-shell/use-nav-entries.ts +16 -5
- package/src/components/nav-shell/use-nav-tree.ts +1 -0
- package/src/components/settings/__tests__/settings-nav.browser.spec.tsx +1 -0
- package/src/components/settings/__tests__/settings-section.browser.spec.tsx +1 -0
- package/src/components/settings/settings-card-edge.ts +24 -0
- package/src/components/settings/settings-danger-section.tsx +7 -1
- package/src/components/settings/settings-layout.tsx +16 -1
- package/src/components/settings/settings-nav.tsx +12 -3
- package/src/components/settings/settings-row.tsx +2 -2
- package/src/components/settings/settings-section.tsx +2 -1
- package/src/components/ui/accordion.tsx +3 -3
- package/src/components/ui/alert-dialog.tsx +5 -5
- package/src/components/ui/alert.tsx +2 -2
- package/src/components/ui/avatar.tsx +5 -5
- package/src/components/ui/badge.tsx +48 -2
- package/src/components/ui/breadcrumb.tsx +3 -3
- package/src/components/ui/button-group.tsx +2 -2
- package/src/components/ui/button.tsx +2 -2
- package/src/components/ui/calendar.tsx +8 -8
- package/src/components/ui/card.tsx +3 -3
- package/src/components/ui/carousel.tsx +30 -13
- package/src/components/ui/chart.tsx +18 -6
- package/src/components/ui/checkbox.tsx +1 -1
- package/src/components/ui/combobox.tsx +8 -9
- package/src/components/ui/command.tsx +6 -7
- package/src/components/ui/context-menu.tsx +8 -8
- package/src/components/ui/dialog.tsx +4 -4
- package/src/components/ui/drawer.tsx +4 -4
- package/src/components/ui/dropdown-menu.tsx +9 -9
- package/src/components/ui/empty.tsx +2 -2
- package/src/components/ui/hover-card.tsx +1 -1
- package/src/components/ui/input-group.tsx +6 -3
- package/src/components/ui/input-otp.tsx +3 -3
- package/src/components/ui/input.tsx +1 -1
- package/src/components/ui/item.tsx +3 -3
- package/src/components/ui/kbd.tsx +1 -1
- package/src/components/ui/label.tsx +3 -0
- package/src/components/ui/menubar.tsx +9 -9
- package/src/components/ui/navigation-menu.tsx +7 -7
- package/src/components/ui/pagination.tsx +0 -1
- package/src/components/ui/popover.tsx +1 -1
- package/src/components/ui/progress.tsx +3 -3
- package/src/components/ui/radio-group.tsx +2 -2
- package/src/components/ui/resizable.tsx +2 -2
- package/src/components/ui/scroll-area.tsx +2 -2
- package/src/components/ui/segmented.tsx +8 -3
- package/src/components/ui/select.tsx +8 -8
- package/src/components/ui/separator.tsx +1 -1
- package/src/components/ui/sheet.tsx +3 -3
- package/src/components/ui/sidebar.tsx +20 -20
- package/src/components/ui/skeleton.tsx +1 -1
- package/src/components/ui/slider.tsx +2 -2
- package/src/components/ui/switch.tsx +2 -2
- package/src/components/ui/table.tsx +10 -5
- package/src/components/ui/tabs.tsx +3 -3
- package/src/components/ui/textarea.tsx +1 -1
- package/src/components/ui/toggle-group.tsx +9 -4
- package/src/components/ui/toggle.tsx +2 -2
- package/src/components/ui/tooltip.tsx +13 -3
- package/src/components/use-dialog/use-dialog.tsx +19 -6
- package/src/components/use-toast/__tests__/use-toast.browser.spec.tsx +19 -0
- package/src/components/use-toast/use-toast.tsx +38 -26
- package/src/hooks/use-mobile.ts +27 -14
- package/src/lib/__tests__/i18n-fr.spec.ts +5 -1
- package/src/lib/i18n-fr.ts +18 -10
- package/src/styles.css +5 -5
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ npm install @alepha/ui
|
|
|
17
17
|
Base UI and Tailwind, with [lucide](https://lucide.dev) icons.
|
|
18
18
|
|
|
19
19
|
Unlike the rest of the framework, these components are **meant to be edited
|
|
20
|
-
directly
|
|
20
|
+
directly**: `src/` ships alongside the built `dist/`, so you can copy a
|
|
21
21
|
component into your app and change it, or depend on the package and let
|
|
22
22
|
bugfixes arrive through normal dependency updates.
|
|
23
23
|
|
|
@@ -41,34 +41,37 @@ import "@alepha/ui/styles.css";
|
|
|
41
41
|
|
|
42
42
|
## What's inside
|
|
43
43
|
|
|
44
|
-
**`components/ui/*`**
|
|
44
|
+
**`components/ui/*`** - the shadcn primitives, unmodified in spirit: `button`,
|
|
45
45
|
`input`, `card`, `badge`, `dialog`, `sheet`, `tooltip`, `label`, `accordion`,
|
|
46
46
|
`avatar`, and the rest. Reach for these first.
|
|
47
47
|
|
|
48
|
-
**Schema-driven forms**
|
|
48
|
+
**Schema-driven forms** - `auto-form` renders a complete form from a `z.object()`
|
|
49
49
|
schema, driven by the `$control` metadata on each field. `control`,
|
|
50
50
|
`control-array`, `control-object`, `control-date`, `control-number`,
|
|
51
51
|
`control-select`, `control-password`, and `control-upload` are the per-type
|
|
52
52
|
field renderers it dispatches to; use them directly when you want to lay a form
|
|
53
53
|
out by hand.
|
|
54
54
|
|
|
55
|
-
**`alepha-table`**
|
|
55
|
+
**`alepha-table`** - data table wired for server-side pagination, sorting and
|
|
56
56
|
filtering.
|
|
57
57
|
|
|
58
|
-
**Application shells**
|
|
58
|
+
**Application shells** - `app-shell` and `nav-shell` for page scaffolding,
|
|
59
59
|
`app-actions` for toolbars, plus ready-made `auth`, `account`, `settings`, and
|
|
60
60
|
`admin` screens.
|
|
61
61
|
|
|
62
|
-
|
|
62
|
+
**`markdown-view`** - renders markdown as prose, with diagrams. See the section
|
|
63
|
+
below.
|
|
64
|
+
|
|
65
|
+
**Hooks** - `use-toast` and `use-dialog` (imperative toasts and modals) live
|
|
63
66
|
under `components/`; `use-mobile` lives under `hooks/`.
|
|
64
67
|
|
|
65
|
-
**`lib/*`**
|
|
66
|
-
component uses. Also `resize-image
|
|
68
|
+
**`lib/*`** - `utils` exports `cn()`, the `clsx` + `tailwind-merge` helper every
|
|
69
|
+
component uses. Also `resize-image` and `i18n-fr`.
|
|
67
70
|
|
|
68
71
|
## Example
|
|
69
72
|
|
|
70
73
|
`AutoForm` pairs with `useForm` from `alepha/react/form`. The schema is the
|
|
71
|
-
single source of truth
|
|
74
|
+
single source of truth - field types, validation, and layout hints all come
|
|
72
75
|
from it:
|
|
73
76
|
|
|
74
77
|
```tsx
|
|
@@ -77,7 +80,11 @@ import { z } from "alepha";
|
|
|
77
80
|
import { useForm } from "alepha/react/form";
|
|
78
81
|
|
|
79
82
|
const profileSchema = z.object({
|
|
80
|
-
username: z
|
|
83
|
+
username: z
|
|
84
|
+
.string()
|
|
85
|
+
.min(2)
|
|
86
|
+
.max(32)
|
|
87
|
+
.meta({ $control: { icon: "user" } }),
|
|
81
88
|
email: z.string(),
|
|
82
89
|
newsletter: z.boolean(),
|
|
83
90
|
});
|
|
@@ -85,7 +92,7 @@ const profileSchema = z.object({
|
|
|
85
92
|
export const ProfilePage = () => {
|
|
86
93
|
const form = useForm({
|
|
87
94
|
schema: profileSchema,
|
|
88
|
-
|
|
95
|
+
initialValues: { username: "", email: "", newsletter: false },
|
|
89
96
|
handler: (values) => save(values),
|
|
90
97
|
});
|
|
91
98
|
|
|
@@ -128,13 +135,65 @@ bar is the card's own last row. Each group carries its own `title` and
|
|
|
128
135
|
```
|
|
129
136
|
|
|
130
137
|
So a settings card whose rows are all form fields should be an `AutoForm`.
|
|
131
|
-
Reach for `SettingsSection` directly for the rows that are
|
|
138
|
+
Reach for `SettingsSection` directly for the rows that are _not_ fields - an
|
|
132
139
|
avatar picker, a read-only value, a lone button.
|
|
133
140
|
|
|
134
141
|
Add `autoSave` to commit on change instead, which hides the action bar. Text
|
|
135
142
|
fields still never commit on keystroke: they commit on Enter, or on the inline
|
|
136
143
|
tick that appears in the input once the field is dirty.
|
|
137
144
|
|
|
145
|
+
## Markdown, and diagrams in it
|
|
146
|
+
|
|
147
|
+
`MarkdownView` renders markdown as formatted prose. Raw HTML is always escaped
|
|
148
|
+
to text, never promoted to markup: it renders content authored by one user to
|
|
149
|
+
another, so a live raw tag would be an injection point on every surface built on
|
|
150
|
+
this package.
|
|
151
|
+
|
|
152
|
+
A ` ```mermaid ` fence containing a **`flowchart`** is drawn as an SVG diagram
|
|
153
|
+
instead of a code block. The renderer is in-house rather than mermaid itself:
|
|
154
|
+
mermaid is roughly 500-900 kB gzip in a browser and cannot run without a DOM,
|
|
155
|
+
because it measures text in a hidden element. Here the only imported piece is
|
|
156
|
+
`graphre` (dagre in TypeScript, ~15.5 kB gzip) for layout; parsing, text
|
|
157
|
+
measurement and drawing are ours. The whole thing is one lazy chunk of about
|
|
158
|
+
18 kB gzip, imported only when a document actually contains a fence, so a
|
|
159
|
+
document with no diagram pays nothing.
|
|
160
|
+
|
|
161
|
+
Drawing it ourselves is what makes the diagram look like the app: the SVG uses
|
|
162
|
+
`--card`, `--border`, `--muted-foreground` and `--muted`, so dark mode works
|
|
163
|
+
with no second palette and no theme prop.
|
|
164
|
+
|
|
165
|
+
The syntax is mermaid's so a document stays portable to GitHub, Obsidian and
|
|
166
|
+
anywhere else, but only a subset is drawn:
|
|
167
|
+
|
|
168
|
+
| | |
|
|
169
|
+
| ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
170
|
+
| Header | `flowchart` / `graph`, `TD` `TB` `LR` `RL` `BT` |
|
|
171
|
+
| Nodes | `[rect]` `(rounded)` `{diamond}` `((circle))`; `([ ])` `[[ ]]` `[( )]` `{{ }}` `> ]` `[/ /]` `[\ \]` `((( )))` are consumed and mapped onto those four |
|
|
172
|
+
| Edges | `-->` `---` `-.->` `==>` `<-->`; `--o` and `--x` parse, but the emitter has one end marker, so they draw the same arrowhead as `-->` rather than mermaid's circle and cross |
|
|
173
|
+
| Edge labels | both `-->\|text\|` and `-- text -->` |
|
|
174
|
+
| Structure | chains `A --> B --> C`, fans `A & B --> C`, nested `subgraph` |
|
|
175
|
+
| Text | `<br/>` becomes a line break; quoted and backtick-quoted labels |
|
|
176
|
+
|
|
177
|
+
Everything else degrades to the code block it renders as today, silently:
|
|
178
|
+
`sequenceDiagram`, `classDiagram`, `gantt` and mindmaps are not drawn, `style`
|
|
179
|
+
and `classDef` are ignored (the theme picks the colours), and a malformed
|
|
180
|
+
diagram, a parse failure or a graph past the 200-node / 400-edge cap all render
|
|
181
|
+
the plain fence rather than an error.
|
|
182
|
+
|
|
183
|
+
⚠️ **A node label must not contain a link operator.** The statement is scanned
|
|
184
|
+
for links before anything knows where the labels are, so a `--`, `==` or `-.`
|
|
185
|
+
sequence inside `[...]` is read as an edge and the label is cut. `A[--o]` yields
|
|
186
|
+
an empty `A` and a bogus node named `]`; `A[pre--post]` truncates to `pre`.
|
|
187
|
+
Quoting does NOT protect it - `A["-->"]` is damaged identically, because
|
|
188
|
+
`splitOnLinks` runs with no quote awareness. A single hyphen (`A[well-known]`)
|
|
189
|
+
is safe. There is no escape that works today, and the failure is silent: the
|
|
190
|
+
graph still draws, with the wrong text.
|
|
191
|
+
|
|
192
|
+
The font is pinned rather than inherited. Layout needs node sizes before it can
|
|
193
|
+
place anything, and node width comes from a generated per-character width table
|
|
194
|
+
measured against Inter at one size; inheriting the surrounding face would make
|
|
195
|
+
text and box disagree, differently on every surface.
|
|
196
|
+
|
|
138
197
|
## Adding a shadcn component
|
|
139
198
|
|
|
140
199
|
`components.json` is configured for this package, so the shadcn CLI drops new
|
|
@@ -144,3 +203,18 @@ components in the right place with the right aliases:
|
|
|
144
203
|
npx shadcn@latest add <component>
|
|
145
204
|
```
|
|
146
205
|
|
|
206
|
+
## Refreshing stock primitives
|
|
207
|
+
|
|
208
|
+
`yarn w @alepha/ui sync` re-fetches the stock `components/ui/*` primitives from
|
|
209
|
+
the public `ui.shadcn.com/r/styles/base-nova` registry and rewrites their
|
|
210
|
+
`@/registry/...` imports to `@alepha/ui/...`. It touches only the stock
|
|
211
|
+
primitives - the hand-maintained blocks (controls, admin, auth, app-shell,
|
|
212
|
+
alepha-table, …) are never overwritten. After a sync, diff for removed
|
|
213
|
+
`from "alepha/` imports before committing: the registry copy does not know
|
|
214
|
+
about local patches.
|
|
215
|
+
|
|
216
|
+
## API Reference
|
|
217
|
+
|
|
218
|
+
### React Hooks
|
|
219
|
+
|
|
220
|
+
- [`useIsMobile`](https://alepha.dev/docs/reference-react-hooks-useismobile) - Upstream's version seeds `undefined` and fills it in from an effect, which
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { useToast } from "../use-toast/use-toast.js";
|
|
2
|
-
import { Button } from "../ui/button.js";
|
|
3
|
-
import { useDialog } from "../use-dialog/use-dialog.js";
|
|
4
1
|
import { SettingsRow } from "../settings/settings-row.js";
|
|
5
2
|
import { SettingsSection } from "../settings/settings-section.js";
|
|
3
|
+
import { Button } from "../ui/button.js";
|
|
4
|
+
import { useDialog } from "../use-dialog/use-dialog.js";
|
|
5
|
+
import { useToast } from "../use-toast/use-toast.js";
|
|
6
6
|
import { useState } from "react";
|
|
7
|
-
import { useClient, useInject } from "alepha/react";
|
|
8
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
8
|
import { Plug } from "lucide-react";
|
|
10
9
|
import { DateTimeProvider } from "alepha/datetime";
|
|
10
|
+
import { useClient, useInject } from "alepha/react";
|
|
11
11
|
//#region src/components/account/account-connections.tsx
|
|
12
12
|
/**
|
|
13
13
|
* Applications holding access to this account through OAuth — an MCP client,
|
|
@@ -43,7 +43,7 @@ const AccountConnections = (props) => {
|
|
|
43
43
|
description: "Applications that can act on your behalf.",
|
|
44
44
|
children: /* @__PURE__ */ jsx(SettingsRow, {
|
|
45
45
|
label: /* @__PURE__ */ jsxs("span", {
|
|
46
|
-
className: "flex items-center gap-2
|
|
46
|
+
className: "text-muted-foreground flex items-center gap-2",
|
|
47
47
|
children: [/* @__PURE__ */ jsx(Plug, { className: "size-4" }), "Nothing is connected"]
|
|
48
48
|
}),
|
|
49
49
|
description: "Applications you authorize will appear here."
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account-connections.js","names":[],"sources":["../../../src/components/account/account-connections.tsx"],"sourcesContent":["import { SettingsRow } from \"@alepha/ui/components/settings/settings-row\";\nimport { SettingsSection } from \"@alepha/ui/components/settings/settings-section\";\nimport { Button } from \"@alepha/ui/components/ui/button\";\nimport { useDialog } from \"@alepha/ui/components/use-dialog/use-dialog\";\nimport { useToast } from \"@alepha/ui/components/use-toast/use-toast\";\nimport type { MyConnection, MyConnectionController } from \"alepha/api/users\";\nimport { DateTimeProvider } from \"alepha/datetime\";\nimport { useClient, useInject } from \"alepha/react\";\nimport { Plug } from \"lucide-react\";\nimport { useState } from \"react\";\n\nexport interface AccountConnectionsProps {\n connections?: MyConnection[];\n}\n\n/**\n * Applications holding access to this account through OAuth — an MCP client,\n * a CLI, a third-party integration.\n *\n * Confirmed on revoke, unlike a plain session. A session comes back by\n * signing in again; a connection comes back only by re-running whatever\n * authorization flow created it, which for an MCP client means the person has\n * to go and reconnect it from the other side.\n */\nconst AccountConnections = (props: AccountConnectionsProps) => {\n const api = useClient<MyConnectionController>();\n const dt = useInject(DateTimeProvider);\n const dialog = useDialog();\n const toaster = useToast();\n\n const [connections, setConnections] = useState<MyConnection[]>(\n props.connections ?? [],\n );\n\n const revoke = async (connection: MyConnection) => {\n const ok = await dialog.confirm({\n title: `Disconnect ${connection.clientName}?`,\n description:\n \"It loses access immediately and has to be authorized again to come back.\",\n confirmLabel: \"Disconnect\",\n destructive: true,\n });\n if (!ok) {\n return;\n }\n try {\n await api.revokeMyConnection({ params: { id: connection.id } });\n setConnections((prev) => prev.filter((it) => it.id !== connection.id));\n } catch (error: any) {\n toaster.show(error?.message ?? \"Could not disconnect it\", \"danger\");\n }\n };\n\n if (connections.length === 0) {\n /*\n Same title AND description as the populated branch below. An empty page\n that drops its description reads as a different page, and the sentence is\n exactly what a reader with nothing on screen needs.\n */\n return (\n <SettingsSection\n title=\"Connected apps\"\n description=\"Applications that can act on your behalf.\"\n >\n <SettingsRow\n label={\n <span className=\"flex items-center gap-2
|
|
1
|
+
{"version":3,"file":"account-connections.js","names":[],"sources":["../../../src/components/account/account-connections.tsx"],"sourcesContent":["import { SettingsRow } from \"@alepha/ui/components/settings/settings-row\";\nimport { SettingsSection } from \"@alepha/ui/components/settings/settings-section\";\nimport { Button } from \"@alepha/ui/components/ui/button\";\nimport { useDialog } from \"@alepha/ui/components/use-dialog/use-dialog\";\nimport { useToast } from \"@alepha/ui/components/use-toast/use-toast\";\nimport type { MyConnection, MyConnectionController } from \"alepha/api/users\";\nimport { DateTimeProvider } from \"alepha/datetime\";\nimport { useClient, useInject } from \"alepha/react\";\nimport { Plug } from \"lucide-react\";\nimport { useState } from \"react\";\n\nexport interface AccountConnectionsProps {\n connections?: MyConnection[];\n}\n\n/**\n * Applications holding access to this account through OAuth — an MCP client,\n * a CLI, a third-party integration.\n *\n * Confirmed on revoke, unlike a plain session. A session comes back by\n * signing in again; a connection comes back only by re-running whatever\n * authorization flow created it, which for an MCP client means the person has\n * to go and reconnect it from the other side.\n */\nconst AccountConnections = (props: AccountConnectionsProps) => {\n const api = useClient<MyConnectionController>();\n const dt = useInject(DateTimeProvider);\n const dialog = useDialog();\n const toaster = useToast();\n\n const [connections, setConnections] = useState<MyConnection[]>(\n props.connections ?? [],\n );\n\n const revoke = async (connection: MyConnection) => {\n const ok = await dialog.confirm({\n title: `Disconnect ${connection.clientName}?`,\n description:\n \"It loses access immediately and has to be authorized again to come back.\",\n confirmLabel: \"Disconnect\",\n destructive: true,\n });\n if (!ok) {\n return;\n }\n try {\n await api.revokeMyConnection({ params: { id: connection.id } });\n setConnections((prev) => prev.filter((it) => it.id !== connection.id));\n } catch (error: any) {\n toaster.show(error?.message ?? \"Could not disconnect it\", \"danger\");\n }\n };\n\n if (connections.length === 0) {\n /*\n Same title AND description as the populated branch below. An empty page\n that drops its description reads as a different page, and the sentence is\n exactly what a reader with nothing on screen needs.\n */\n return (\n <SettingsSection\n title=\"Connected apps\"\n description=\"Applications that can act on your behalf.\"\n >\n <SettingsRow\n label={\n <span className=\"text-muted-foreground flex items-center gap-2\">\n <Plug className=\"size-4\" />\n Nothing is connected\n </span>\n }\n description=\"Applications you authorize will appear here.\"\n />\n </SettingsSection>\n );\n }\n\n return (\n <SettingsSection\n title=\"Connected apps\"\n description=\"Applications that can act on your behalf.\"\n >\n {connections.map((connection) => (\n <SettingsRow\n key={connection.id}\n label={\n <span className=\"flex items-center gap-2\">\n {connection.clientName}\n {connection.current ? (\n <span className=\"text-muted-foreground text-xs\">\n (this one)\n </span>\n ) : null}\n </span>\n }\n description={`Connected ${dt.of(connection.createdAt).fromNow()}${\n connection.lastUsedAt\n ? ` · last used ${dt.of(connection.lastUsedAt).fromNow()}`\n : \" · never used\"\n }`}\n >\n <Button variant=\"ghost\" size=\"sm\" onClick={() => revoke(connection)}>\n Disconnect\n </Button>\n </SettingsRow>\n ))}\n </SettingsSection>\n );\n};\n\nexport default AccountConnections;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAwBA,MAAM,sBAAsB,UAAmC;CAC7D,MAAM,MAAM,UAAkC;CAC9C,MAAM,KAAK,UAAU,gBAAgB;CACrC,MAAM,SAAS,UAAU;CACzB,MAAM,UAAU,SAAS;CAEzB,MAAM,CAAC,aAAa,kBAAkB,SACpC,MAAM,eAAe,CAAC,CACxB;CAEA,MAAM,SAAS,OAAO,eAA6B;EAQjD,IAAI,CAAC,MAPY,OAAO,QAAQ;GAC9B,OAAO,cAAc,WAAW,WAAW;GAC3C,aACE;GACF,cAAc;GACd,aAAa;EACf,CAAC,GAEC;EAEF,IAAI;GACF,MAAM,IAAI,mBAAmB,EAAE,QAAQ,EAAE,IAAI,WAAW,GAAG,EAAE,CAAC;GAC9D,gBAAgB,SAAS,KAAK,QAAQ,OAAO,GAAG,OAAO,WAAW,EAAE,CAAC;EACvE,SAAS,OAAY;GACnB,QAAQ,KAAK,OAAO,WAAW,2BAA2B,QAAQ;EACpE;CACF;CAEA,IAAI,YAAY,WAAW,GAMzB,OACE,oBAAC,iBAAD;EACE,OAAM;EACN,aAAY;EAEZ,UAAA,oBAAC,aAAD;GACE,OACE,qBAAC,QAAD;IAAM,WAAU;IAAhB,UAAA,CACE,oBAAC,MAAD,EAAM,WAAU,SAAU,CAAA,GAAC,sBAEvB;;GAER,aAAY;EACb,CAAA;CACc,CAAA;CAIrB,OACE,oBAAC,iBAAD;EACE,OAAM;EACN,aAAY;EAEX,UAAA,YAAY,KAAK,eAChB,oBAAC,aAAD;GAEE,OACE,qBAAC,QAAD;IAAM,WAAU;IAAhB,UAAA,CACG,WAAW,YACX,WAAW,UACV,oBAAC,QAAD;KAAM,WAAU;KAAgC,UAAA;IAE1C,CAAA,IACJ,IACA;;GAER,aAAa,aAAa,GAAG,GAAG,WAAW,SAAS,CAAC,CAAC,QAAQ,IAC5D,WAAW,aACP,gBAAgB,GAAG,GAAG,WAAW,UAAU,CAAC,CAAC,QAAQ,MACrD;GAGN,UAAA,oBAAC,QAAD;IAAQ,SAAQ;IAAQ,MAAK;IAAK,eAAe,OAAO,UAAU;IAAG,UAAA;GAE7D,CAAA;EACG,GApBN,WAAW,EAoBL,CACd;CACc,CAAA;AAErB"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { useToast } from "../use-toast/use-toast.js";
|
|
2
1
|
import { Button } from "../ui/button.js";
|
|
3
|
-
import { Dialog, DialogContent, DialogHeader, DialogTitle } from "../ui/dialog.js";
|
|
4
|
-
import { Label } from "../ui/label.js";
|
|
5
2
|
import { Input } from "../ui/input.js";
|
|
3
|
+
import { useToast } from "../use-toast/use-toast.js";
|
|
4
|
+
import { Label } from "../ui/label.js";
|
|
6
5
|
import { ControlPassword } from "../control-password/control-password.js";
|
|
6
|
+
import { Dialog, DialogContent, DialogHeader, DialogTitle } from "../ui/dialog.js";
|
|
7
7
|
import { useEffect, useState } from "react";
|
|
8
|
-
import { useClient } from "alepha/react";
|
|
9
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
import { useClient } from "alepha/react";
|
|
10
10
|
//#region src/components/account/account-delete-dialog.tsx
|
|
11
11
|
/**
|
|
12
12
|
* Permanently delete your own account.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account-header.d.ts","sourceRoot":"","sources":["../../../src/components/account/account-header.tsx"],"names":[],"mappings":"AAKA,MAAM,WAAW,kBAAkB;IACjC;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,aAAa,UAAW,kBAAkB,
|
|
1
|
+
{"version":3,"file":"account-header.d.ts","sourceRoot":"","sources":["../../../src/components/account/account-header.tsx"],"names":[],"mappings":"AAKA,MAAM,WAAW,kBAAkB;IACjC;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,aAAa,UAAW,kBAAkB,gCAuBtD,CAAC"}
|
|
@@ -29,8 +29,10 @@ const AccountHeader = (props) => {
|
|
|
29
29
|
children: [/* @__PURE__ */ jsxs(Button, {
|
|
30
30
|
variant: "ghost",
|
|
31
31
|
size: "sm",
|
|
32
|
-
className: "
|
|
32
|
+
className: "text-muted-foreground hover:text-foreground -ml-2",
|
|
33
33
|
render: /* @__PURE__ */ jsx(Link$1, { href: router.path(home) }),
|
|
34
|
+
nativeButton: false,
|
|
35
|
+
role: "link",
|
|
34
36
|
children: [/* @__PURE__ */ jsx(ArrowLeft, { className: "size-4" }), props.backLabel ?? "Back to site"]
|
|
35
37
|
}), /* @__PURE__ */ jsx(AppActions, {})]
|
|
36
38
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account-header.js","names":["Link"],"sources":["../../../src/components/account/account-header.tsx"],"sourcesContent":["import { AppActions } from \"@alepha/ui/components/app-actions/app-actions\";\nimport { Button } from \"@alepha/ui/components/ui/button\";\nimport { Link, useRouter } from \"alepha/react/router\";\nimport { ArrowLeft } from \"lucide-react\";\n\nexport interface AccountHeaderProps {\n /**\n * Route name the back link points at.\n *\n * @default \"home\"\n */\n homeRouteName?: string;\n\n /**\n * Label for the back link.\n *\n * @default \"Back to site\"\n */\n backLabel?: string;\n}\n\n/**\n * The account area's top bar: a way out on the left, the ambient controls on\n * the right.\n *\n * The way out is the point. `/account` is a destination you arrive at from\n * somewhere else and leave again, and unlike `/admin` it has no sidebar to\n * carry a brand or a home affordance — without this the only exit is the\n * browser's back button.\n *\n * It is a real `<Link href>`, not a button that calls `router.push`, so the\n * middle-click / open-in-new-tab / copy-link behaviours all work and the\n * destination is visible in the status bar on hover.\n *\n * Replaceable wholesale: `AccountRouterOptions.header` overrides this, for an\n * application whose account area sits inside its own chrome and needs no\n * second header.\n */\nexport const AccountHeader = (props: AccountHeaderProps) => {\n const router = useRouter<any>();\n const home = props.homeRouteName ?? \"home\";\n\n return (\n <div className=\"flex items-center justify-between gap-4 border-b pb-3\">\n <Button\n variant=\"ghost\"\n size=\"sm\"\n className=\"
|
|
1
|
+
{"version":3,"file":"account-header.js","names":["Link"],"sources":["../../../src/components/account/account-header.tsx"],"sourcesContent":["import { AppActions } from \"@alepha/ui/components/app-actions/app-actions\";\nimport { Button } from \"@alepha/ui/components/ui/button\";\nimport { Link, useRouter } from \"alepha/react/router\";\nimport { ArrowLeft } from \"lucide-react\";\n\nexport interface AccountHeaderProps {\n /**\n * Route name the back link points at.\n *\n * @default \"home\"\n */\n homeRouteName?: string;\n\n /**\n * Label for the back link.\n *\n * @default \"Back to site\"\n */\n backLabel?: string;\n}\n\n/**\n * The account area's top bar: a way out on the left, the ambient controls on\n * the right.\n *\n * The way out is the point. `/account` is a destination you arrive at from\n * somewhere else and leave again, and unlike `/admin` it has no sidebar to\n * carry a brand or a home affordance — without this the only exit is the\n * browser's back button.\n *\n * It is a real `<Link href>`, not a button that calls `router.push`, so the\n * middle-click / open-in-new-tab / copy-link behaviours all work and the\n * destination is visible in the status bar on hover.\n *\n * Replaceable wholesale: `AccountRouterOptions.header` overrides this, for an\n * application whose account area sits inside its own chrome and needs no\n * second header.\n */\nexport const AccountHeader = (props: AccountHeaderProps) => {\n const router = useRouter<any>();\n const home = props.homeRouteName ?? \"home\";\n\n return (\n <div className=\"flex items-center justify-between gap-4 border-b pb-3\">\n <Button\n variant=\"ghost\"\n size=\"sm\"\n className=\"text-muted-foreground hover:text-foreground -ml-2\"\n render={<Link href={router.path(home)} />}\n // A link wearing a button's clothes: `nativeButton={false}` stops Base UI\n // assuming a native <button> (it warns otherwise), and `role` puts back the\n // link semantics its non-native branch would overwrite with `role=\"button\"`.\n nativeButton={false}\n role=\"link\"\n >\n <ArrowLeft className=\"size-4\" />\n {props.backLabel ?? \"Back to site\"}\n </Button>\n <AppActions />\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAsCA,MAAa,iBAAiB,UAA8B;CAC1D,MAAM,SAAS,UAAe;CAC9B,MAAM,OAAO,MAAM,iBAAiB;CAEpC,OACE,qBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,qBAAC,QAAD;GACE,SAAQ;GACR,MAAK;GACL,WAAU;GACV,QAAQ,oBAACA,QAAD,EAAM,MAAM,OAAO,KAAK,IAAI,EAAI,CAAA;GAIxC,cAAc;GACd,MAAK;GATP,UAAA,CAWE,oBAAC,WAAD,EAAW,WAAU,SAAU,CAAA,GAC9B,MAAM,aAAa,cACd;EACR,CAAA,GAAA,oBAAC,YAAD,CAAa,CAAA,CACV;;AAET"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SettingsRow } from "../settings/settings-row.js";
|
|
2
|
+
import { SettingsSection } from "../settings/settings-section.js";
|
|
2
3
|
import { Button } from "../ui/button.js";
|
|
3
|
-
import { Dialog, DialogContent, DialogHeader, DialogTitle } from "../ui/dialog.js";
|
|
4
|
-
import { Label } from "../ui/label.js";
|
|
5
4
|
import { Input } from "../ui/input.js";
|
|
6
5
|
import { useDialog } from "../use-dialog/use-dialog.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
6
|
+
import { useToast } from "../use-toast/use-toast.js";
|
|
7
|
+
import { Label } from "../ui/label.js";
|
|
8
|
+
import { Dialog, DialogContent, DialogHeader, DialogTitle } from "../ui/dialog.js";
|
|
9
9
|
import { useState } from "react";
|
|
10
|
-
import { useClient, useInject } from "alepha/react";
|
|
11
10
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
12
11
|
import { Check, Clipboard, Plus, Trash2 } from "lucide-react";
|
|
13
12
|
import { DateTimeProvider } from "alepha/datetime";
|
|
13
|
+
import { useClient, useInject } from "alepha/react";
|
|
14
14
|
//#region src/components/account/account-keys.tsx
|
|
15
15
|
/**
|
|
16
16
|
* Your own API keys: mint, see, revoke.
|
|
@@ -140,7 +140,7 @@ const AccountKeys = (props) => {
|
|
|
140
140
|
children: "This is the only time it is shown. Store it somewhere safe before closing this dialog."
|
|
141
141
|
}),
|
|
142
142
|
/* @__PURE__ */ jsx("code", {
|
|
143
|
-
className: "
|
|
143
|
+
className: "bg-muted rounded-md border p-3 font-mono text-xs break-all",
|
|
144
144
|
children: freshToken
|
|
145
145
|
}),
|
|
146
146
|
/* @__PURE__ */ jsxs("div", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account-keys.js","names":[],"sources":["../../../src/components/account/account-keys.tsx"],"sourcesContent":["import { SettingsRow } from \"@alepha/ui/components/settings/settings-row\";\nimport { SettingsSection } from \"@alepha/ui/components/settings/settings-section\";\nimport { Button } from \"@alepha/ui/components/ui/button\";\nimport {\n Dialog,\n DialogContent,\n DialogHeader,\n DialogTitle,\n} from \"@alepha/ui/components/ui/dialog\";\nimport { Input } from \"@alepha/ui/components/ui/input\";\nimport { Label } from \"@alepha/ui/components/ui/label\";\nimport { useDialog } from \"@alepha/ui/components/use-dialog/use-dialog\";\nimport { useToast } from \"@alepha/ui/components/use-toast/use-toast\";\nimport type { Infer } from \"alepha\";\nimport type { ApiKeyController, listApiKeyItemSchema } from \"alepha/api/keys\";\nimport { DateTimeProvider } from \"alepha/datetime\";\nimport { useClient, useInject } from \"alepha/react\";\nimport { Check, Clipboard, Plus, Trash2 } from \"lucide-react\";\nimport { type FormEvent, useState } from \"react\";\n\n/**\n * Derived from the framework's own response schema rather than restated, so a\n * field added to the endpoint is available here the day it lands — and a\n * field removed is a compile error rather than a blank cell.\n */\ntype ApiKeyRow = Infer<typeof listApiKeyItemSchema>;\n\nexport interface AccountKeysProps {\n apiKeys?: ApiKeyRow[];\n}\n\n/**\n * Your own API keys: mint, see, revoke.\n *\n * The freshly created token is shown **once**, in a dialog that stays open\n * until dismissed, because the server stores only a hash and cannot show it\n * again. That is also why the create form and the reveal are separate steps\n * rather than one inline row — a token that scrolls out of view behind a\n * re-render is gone.\n */\nconst AccountKeys = (props: AccountKeysProps) => {\n const api = useClient<ApiKeyController>();\n const dt = useInject(DateTimeProvider);\n const dialog = useDialog();\n const toaster = useToast();\n\n const [keys, setKeys] = useState<ApiKeyRow[]>(props.apiKeys ?? []);\n const [createOpen, setCreateOpen] = useState(false);\n const [name, setName] = useState(\"\");\n const [creating, setCreating] = useState(false);\n const [freshToken, setFreshToken] = useState<string | undefined>();\n const [copied, setCopied] = useState(false);\n\n const create = async (event: FormEvent) => {\n event.preventDefault();\n setCreating(true);\n try {\n const created: any = await api.createApiKey({ body: { name } });\n setFreshToken(created.token);\n setKeys(await (api.listApiKeys() as Promise<any>));\n setName(\"\");\n setCreateOpen(false);\n } catch (error: any) {\n toaster.show(error?.message ?? \"Could not create that key\", \"danger\");\n } finally {\n setCreating(false);\n }\n };\n\n const revoke = async (key: ApiKeyRow) => {\n const ok = await dialog.confirm({\n title: `Revoke ${key.name}?`,\n description:\n \"Anything still using this key stops working immediately. This cannot be undone.\",\n confirmLabel: \"Revoke\",\n destructive: true,\n });\n if (!ok) {\n return;\n }\n try {\n await api.revokeMyApiKey({ params: { id: key.id } });\n setKeys((prev) => prev.filter((it) => it.id !== key.id));\n } catch (error: any) {\n toaster.show(error?.message ?? \"Could not revoke that key\", \"danger\");\n }\n };\n\n const copy = async () => {\n if (!freshToken) {\n return;\n }\n await navigator.clipboard.writeText(freshToken);\n setCopied(true);\n };\n\n return (\n <>\n <SettingsSection\n title=\"API keys\"\n description=\"Keys act as you. Revoke any you no longer recognise.\"\n >\n {keys.map((key) => (\n <SettingsRow\n key={key.id}\n label={key.name}\n description={`…${key.tokenSuffix} · created ${dt\n .of(key.createdAt)\n .fromNow()}${\n key.lastUsedAt\n ? ` · last used ${dt.of(key.lastUsedAt).fromNow()}`\n : \" · never used\"\n }`}\n >\n <Button\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => revoke(key)}\n aria-label={`Revoke ${key.name}`}\n >\n <Trash2 className=\"size-4\" />\n </Button>\n </SettingsRow>\n ))}\n\n <SettingsRow\n label=\"Create a key\"\n description=\"Shown once, at creation. It cannot be recovered afterwards.\"\n >\n <Button\n variant=\"secondary\"\n size=\"sm\"\n onClick={() => setCreateOpen(true)}\n >\n <Plus className=\"size-4\" />\n New key\n </Button>\n </SettingsRow>\n </SettingsSection>\n\n <Dialog open={createOpen} onOpenChange={setCreateOpen}>\n <DialogContent>\n <DialogHeader>\n <DialogTitle>New API key</DialogTitle>\n </DialogHeader>\n <form onSubmit={create} className=\"flex flex-col gap-4\">\n <div className=\"flex flex-col gap-1.5\">\n <Label htmlFor=\"apiKeyName\">Name</Label>\n <Input\n id=\"apiKeyName\"\n value={name}\n onChange={(event) => setName(event.target.value)}\n placeholder=\"CI pipeline\"\n required\n />\n </div>\n <div className=\"flex justify-end gap-2\">\n <Button\n type=\"button\"\n variant=\"ghost\"\n onClick={() => setCreateOpen(false)}\n >\n Cancel\n </Button>\n <Button type=\"submit\" disabled={creating}>\n Create\n </Button>\n </div>\n </form>\n </DialogContent>\n </Dialog>\n\n {/* Deliberately not auto-dismissed: this is the only time the token\n exists in a readable form. */}\n <Dialog\n open={Boolean(freshToken)}\n onOpenChange={(next) => {\n if (!next) {\n setFreshToken(undefined);\n setCopied(false);\n }\n }}\n >\n <DialogContent>\n <DialogHeader>\n <DialogTitle>Copy your key now</DialogTitle>\n </DialogHeader>\n <div className=\"flex flex-col gap-4\">\n <span className=\"text-muted-foreground text-sm\">\n This is the only time it is shown. Store it somewhere safe before\n closing this dialog.\n </span>\n <code className=\"break-all rounded-md border bg-muted p-3 font-mono text-xs\">\n {freshToken}\n </code>\n <div className=\"flex justify-end gap-2\">\n <Button variant=\"secondary\" onClick={copy}>\n {copied ? (\n <Check className=\"size-4\" />\n ) : (\n <Clipboard className=\"size-4\" />\n )}\n {copied ? \"Copied\" : \"Copy\"}\n </Button>\n <Button\n onClick={() => {\n setFreshToken(undefined);\n setCopied(false);\n }}\n >\n Done\n </Button>\n </div>\n </div>\n </DialogContent>\n </Dialog>\n </>\n );\n};\n\nexport default AccountKeys;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAwCA,MAAM,eAAe,UAA4B;CAC/C,MAAM,MAAM,UAA4B;CACxC,MAAM,KAAK,UAAU,gBAAgB;CACrC,MAAM,SAAS,UAAU;CACzB,MAAM,UAAU,SAAS;CAEzB,MAAM,CAAC,MAAM,WAAW,SAAsB,MAAM,WAAW,CAAC,CAAC;CACjE,MAAM,CAAC,YAAY,iBAAiB,SAAS,KAAK;CAClD,MAAM,CAAC,MAAM,WAAW,SAAS,EAAE;CACnC,MAAM,CAAC,UAAU,eAAe,SAAS,KAAK;CAC9C,MAAM,CAAC,YAAY,iBAAiB,SAA6B;CACjE,MAAM,CAAC,QAAQ,aAAa,SAAS,KAAK;CAE1C,MAAM,SAAS,OAAO,UAAqB;EACzC,MAAM,eAAe;EACrB,YAAY,IAAI;EAChB,IAAI;GACF,MAAM,UAAe,MAAM,IAAI,aAAa,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;GAC9D,cAAc,QAAQ,KAAK;GAC3B,QAAQ,MAAO,IAAI,YAAY,CAAkB;GACjD,QAAQ,EAAE;GACV,cAAc,KAAK;EACrB,SAAS,OAAY;GACnB,QAAQ,KAAK,OAAO,WAAW,6BAA6B,QAAQ;EACtE,UAAU;GACR,YAAY,KAAK;EACnB;CACF;CAEA,MAAM,SAAS,OAAO,QAAmB;EAQvC,IAAI,CAAC,MAPY,OAAO,QAAQ;GA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E,eAAe;QACb,cAAc,KAAA,CAAS;QACvB,UAAU,KAAK;OACjB;OACD,UAAA;MAEO,CAAA,CACL;;IACF;GACQ,CAAA,CAAA,EAAA,CAAA;EACT,CAAA;CACR,EAAA,CAAA;AAEN"}
|
|
1
|
+
{"version":3,"file":"account-keys.js","names":[],"sources":["../../../src/components/account/account-keys.tsx"],"sourcesContent":["import { SettingsRow } from \"@alepha/ui/components/settings/settings-row\";\nimport { SettingsSection } from \"@alepha/ui/components/settings/settings-section\";\nimport { Button } from \"@alepha/ui/components/ui/button\";\nimport {\n Dialog,\n DialogContent,\n DialogHeader,\n DialogTitle,\n} from \"@alepha/ui/components/ui/dialog\";\nimport { Input } from \"@alepha/ui/components/ui/input\";\nimport { Label } from \"@alepha/ui/components/ui/label\";\nimport { useDialog } from \"@alepha/ui/components/use-dialog/use-dialog\";\nimport { useToast } from \"@alepha/ui/components/use-toast/use-toast\";\nimport type { Infer } from \"alepha\";\nimport type { ApiKeyController, listApiKeyItemSchema } from \"alepha/api/keys\";\nimport { DateTimeProvider } from \"alepha/datetime\";\nimport { useClient, useInject } from \"alepha/react\";\nimport { Check, Clipboard, Plus, Trash2 } from \"lucide-react\";\nimport { type FormEvent, useState } from \"react\";\n\n/**\n * Derived from the framework's own response schema rather than restated, so a\n * field added to the endpoint is available here the day it lands — and a\n * field removed is a compile error rather than a blank cell.\n */\ntype ApiKeyRow = Infer<typeof listApiKeyItemSchema>;\n\nexport interface AccountKeysProps {\n apiKeys?: ApiKeyRow[];\n}\n\n/**\n * Your own API keys: mint, see, revoke.\n *\n * The freshly created token is shown **once**, in a dialog that stays open\n * until dismissed, because the server stores only a hash and cannot show it\n * again. That is also why the create form and the reveal are separate steps\n * rather than one inline row — a token that scrolls out of view behind a\n * re-render is gone.\n */\nconst AccountKeys = (props: AccountKeysProps) => {\n const api = useClient<ApiKeyController>();\n const dt = useInject(DateTimeProvider);\n const dialog = useDialog();\n const toaster = useToast();\n\n const [keys, setKeys] = useState<ApiKeyRow[]>(props.apiKeys ?? []);\n const [createOpen, setCreateOpen] = useState(false);\n const [name, setName] = useState(\"\");\n const [creating, setCreating] = useState(false);\n const [freshToken, setFreshToken] = useState<string | undefined>();\n const [copied, setCopied] = useState(false);\n\n const create = async (event: FormEvent) => {\n event.preventDefault();\n setCreating(true);\n try {\n const created: any = await api.createApiKey({ body: { name } });\n setFreshToken(created.token);\n setKeys(await (api.listApiKeys() as Promise<any>));\n setName(\"\");\n setCreateOpen(false);\n } catch (error: any) {\n toaster.show(error?.message ?? \"Could not create that key\", \"danger\");\n } finally {\n setCreating(false);\n }\n };\n\n const revoke = async (key: ApiKeyRow) => {\n const ok = await dialog.confirm({\n title: `Revoke ${key.name}?`,\n description:\n \"Anything still using this key stops working immediately. This cannot be undone.\",\n confirmLabel: \"Revoke\",\n destructive: true,\n });\n if (!ok) {\n return;\n }\n try {\n await api.revokeMyApiKey({ params: { id: key.id } });\n setKeys((prev) => prev.filter((it) => it.id !== key.id));\n } catch (error: any) {\n toaster.show(error?.message ?? \"Could not revoke that key\", \"danger\");\n }\n };\n\n const copy = async () => {\n if (!freshToken) {\n return;\n }\n await navigator.clipboard.writeText(freshToken);\n setCopied(true);\n };\n\n return (\n <>\n <SettingsSection\n title=\"API keys\"\n description=\"Keys act as you. Revoke any you no longer recognise.\"\n >\n {keys.map((key) => (\n <SettingsRow\n key={key.id}\n label={key.name}\n description={`…${key.tokenSuffix} · created ${dt\n .of(key.createdAt)\n .fromNow()}${\n key.lastUsedAt\n ? ` · last used ${dt.of(key.lastUsedAt).fromNow()}`\n : \" · never used\"\n }`}\n >\n <Button\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => revoke(key)}\n aria-label={`Revoke ${key.name}`}\n >\n <Trash2 className=\"size-4\" />\n </Button>\n </SettingsRow>\n ))}\n\n <SettingsRow\n label=\"Create a key\"\n description=\"Shown once, at creation. It cannot be recovered afterwards.\"\n >\n <Button\n variant=\"secondary\"\n size=\"sm\"\n onClick={() => setCreateOpen(true)}\n >\n <Plus className=\"size-4\" />\n New key\n </Button>\n </SettingsRow>\n </SettingsSection>\n\n <Dialog open={createOpen} onOpenChange={setCreateOpen}>\n <DialogContent>\n <DialogHeader>\n <DialogTitle>New API key</DialogTitle>\n </DialogHeader>\n <form onSubmit={create} className=\"flex flex-col gap-4\">\n <div className=\"flex flex-col gap-1.5\">\n <Label htmlFor=\"apiKeyName\">Name</Label>\n <Input\n id=\"apiKeyName\"\n value={name}\n onChange={(event) => setName(event.target.value)}\n placeholder=\"CI pipeline\"\n required\n />\n </div>\n <div className=\"flex justify-end gap-2\">\n <Button\n type=\"button\"\n variant=\"ghost\"\n onClick={() => setCreateOpen(false)}\n >\n Cancel\n </Button>\n <Button type=\"submit\" disabled={creating}>\n Create\n </Button>\n </div>\n </form>\n </DialogContent>\n </Dialog>\n\n {/* Deliberately not auto-dismissed: this is the only time the token\n exists in a readable form. */}\n <Dialog\n open={Boolean(freshToken)}\n onOpenChange={(next) => {\n if (!next) {\n setFreshToken(undefined);\n setCopied(false);\n }\n }}\n >\n <DialogContent>\n <DialogHeader>\n <DialogTitle>Copy your key now</DialogTitle>\n </DialogHeader>\n <div className=\"flex flex-col gap-4\">\n <span className=\"text-muted-foreground text-sm\">\n This is the only time it is shown. Store it somewhere safe before\n closing this dialog.\n </span>\n <code className=\"bg-muted rounded-md border p-3 font-mono text-xs break-all\">\n {freshToken}\n </code>\n <div className=\"flex justify-end gap-2\">\n <Button variant=\"secondary\" onClick={copy}>\n {copied ? (\n <Check className=\"size-4\" />\n ) : (\n <Clipboard className=\"size-4\" />\n )}\n {copied ? \"Copied\" : \"Copy\"}\n </Button>\n <Button\n onClick={() => {\n setFreshToken(undefined);\n setCopied(false);\n }}\n >\n Done\n </Button>\n </div>\n </div>\n </DialogContent>\n </Dialog>\n </>\n );\n};\n\nexport default AccountKeys;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAwCA,MAAM,eAAe,UAA4B;CAC/C,MAAM,MAAM,UAA4B;CACxC,MA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,oBAAC,QAAD;MAAQ,MAAK;MAAS,UAAU;MAAU,UAAA;KAElC,CAAA,CACL;IACD,CAAA,CAAA;GACO,CAAA,CAAA,EAAA,CAAA;EACT,CAAA;EAIR,oBAAC,QAAD;GACE,MAAM,QAAQ,UAAU;GACxB,eAAe,SAAS;IACtB,IAAI,CAAC,MAAM;KACT,cAAc,KAAA,CAAS;KACvB,UAAU,KAAK;IACjB;GACF;GAEA,UAAA,qBAAC,eAAD,EAAA,UAAA,CACE,oBAAC,cAAD,EAAA,UACE,oBAAC,aAAD,EAAA,UAAa,oBAA8B,CAAA,EAC/B,CAAA,GACd,qBAAC,OAAD;IAAK,WAAU;IAAf,UAAA;KACE,oBAAC,QAAD;MAAM,WAAU;MAAgC,UAAA;KAG1C,CAAA;KACN,oBAAC,QAAD;MAAM,WAAU;MACb,UAAA;KACG,CAAA;KACN,qBAAC,OAAD;MAAK,WAAU;MAAf,UAAA,CACE,qBAAC,QAAD;OAAQ,SAAQ;OAAY,SAAS;OAArC,UAAA,CACG,SACC,oBAAC,OAAD,EAAO,WAAU,SAAU,CAAA,IAE3B,oBAAC,WAAD,EAAW,WAAU,SAAU,CAAA,GAEhC,SAAS,WAAW,MACf;MACR,CAAA,GAAA,oBAAC,QAAD;OACE,eAAe;QACb,cAAc,KAAA,CAAS;QACvB,UAAU,KAAK;OACjB;OACD,UAAA;MAEO,CAAA,CACL;;IACF;GACQ,CAAA,CAAA,EAAA,CAAA;EACT,CAAA;CACR,EAAA,CAAA;AAEN"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account-layout.d.ts","sourceRoot":"","sources":["../../../src/components/account/account-layout.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"account-layout.d.ts","sourceRoot":"","sources":["../../../src/components/account/account-layout.tsx"],"names":[],"mappings":"AASA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,aAAa,mCAgCzB,CAAC;eAEa,aAAa"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AccountHeader } from "./account-header.js";
|
|
2
2
|
import { SettingsLayout } from "../settings/settings-layout.js";
|
|
3
3
|
import { SettingsNav } from "../settings/settings-nav.js";
|
|
4
|
-
import {
|
|
4
|
+
import { useNavEntries } from "../nav-shell/use-nav-entries.js";
|
|
5
5
|
import { accountRouterOptionsAtom } from "./account-router-options.js";
|
|
6
|
-
import { useStore } from "alepha/react";
|
|
7
6
|
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
import { useStore } from "alepha/react";
|
|
8
8
|
import { NestedView } from "alepha/react/router";
|
|
9
9
|
//#region src/components/account/account-layout.tsx
|
|
10
10
|
/**
|
|
@@ -43,7 +43,10 @@ const AccountLayout = () => {
|
|
|
43
43
|
className: options.className,
|
|
44
44
|
fill: options.fill,
|
|
45
45
|
header: options.header !== void 0 ? options.header : /* @__PURE__ */ jsx(AccountHeader, { homeRouteName: options.homeRouteName }),
|
|
46
|
-
nav: /* @__PURE__ */ jsx(SettingsNav, {
|
|
46
|
+
nav: /* @__PURE__ */ jsx(SettingsNav, {
|
|
47
|
+
items: entries,
|
|
48
|
+
size: "default"
|
|
49
|
+
}),
|
|
47
50
|
children: /* @__PURE__ */ jsx(NestedView, {})
|
|
48
51
|
});
|
|
49
52
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account-layout.js","names":[],"sources":["../../../src/components/account/account-layout.tsx"],"sourcesContent":["import { AccountHeader } from \"@alepha/ui/components/account/account-header\";\nimport { SettingsLayout } from \"@alepha/ui/components/settings/settings-layout\";\nimport { SettingsNav } from \"@alepha/ui/components/settings/settings-nav\";\nimport { useStore } from \"alepha/react\";\nimport { NestedView } from \"alepha/react/router\";\nimport { useNavEntries } from \"../nav-shell/use-nav-entries.ts\";\nimport { accountRouterOptionsAtom } from \"./account-router-options.tsx\";\n\n/**\n * The account shell: a centred column with a settings rail, deliberately not\n * the admin console's chrome.\n *\n * The rail is derived from the route subtree anchored at `account` — every\n * page carries its own `nav`, so there is no hand-synced list and a page\n * added with `$pageAccount` appears without registering anywhere.\n *\n * Two things this does *not* do, both on purpose:\n *\n * - **No `<ColorScheme />`.** `AdminLayout` mounts one because `/admin` is\n * never a child of the application's layout, so nothing else would apply\n * the dark-mode class to `<html>`. This shell is normally adopted *into*\n * the application's own layout (see `AccountRouter`'s `children` note), and\n * an application mounting it standalone is already supplying `header` and\n * owns its chrome. A second component writing to `<html>` would be the\n * surprise, not the service.\n * - **No scroll container by default.** The page scrolls, and a nested\n * `overflow-auto` would strand the sticky rail against the wrong scroll\n * root. An application whose own shell has already taken the viewport\n * height and hidden its overflow has no page scroll to lend, and opts in\n * with `fill` on the options atom — see `SettingsLayout`.\n *\n * `useNavEntries` returns entries already filtered by `can` and permission,\n * and sorted by group then order — and its `NavEntry` is structurally a\n * superset of `SettingsNavItem`, so it passes straight through. That is safe\n * here specifically because none of these routes is parameterised: see\n * `SettingsNav` for why it takes resolved items rather than a route name.\n */\nexport const AccountLayout = () => {\n const [options] = useStore(accountRouterOptionsAtom);\n const entries = useNavEntries({ root: \"account\" });\n\n return (\n <SettingsLayout\n className={options.className}\n fill={options.fill}\n /*\n `!== undefined`, not `??`. `null ?? x` yields `x`, so nullish\n coalescing would silently ignore `header: null` — the documented way\n to say \"this account area is nested in my own chrome, draw no bar\".\n Absent means default; explicit null means none.\n */\n header={\n options.header !== undefined ? (\n options.header\n ) : (\n <AccountHeader homeRouteName={options.homeRouteName} />\n )\n }\n nav={<SettingsNav items={entries} />}\n >\n <NestedView />\n </SettingsLayout>\n );\n};\n\nexport default AccountLayout;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"account-layout.js","names":[],"sources":["../../../src/components/account/account-layout.tsx"],"sourcesContent":["import { AccountHeader } from \"@alepha/ui/components/account/account-header\";\nimport { SettingsLayout } from \"@alepha/ui/components/settings/settings-layout\";\nimport { SettingsNav } from \"@alepha/ui/components/settings/settings-nav\";\nimport { useStore } from \"alepha/react\";\nimport { NestedView } from \"alepha/react/router\";\n\nimport { useNavEntries } from \"../nav-shell/use-nav-entries.ts\";\nimport { accountRouterOptionsAtom } from \"./account-router-options.tsx\";\n\n/**\n * The account shell: a centred column with a settings rail, deliberately not\n * the admin console's chrome.\n *\n * The rail is derived from the route subtree anchored at `account` — every\n * page carries its own `nav`, so there is no hand-synced list and a page\n * added with `$pageAccount` appears without registering anywhere.\n *\n * Two things this does *not* do, both on purpose:\n *\n * - **No `<ColorScheme />`.** `AdminLayout` mounts one because `/admin` is\n * never a child of the application's layout, so nothing else would apply\n * the dark-mode class to `<html>`. This shell is normally adopted *into*\n * the application's own layout (see `AccountRouter`'s `children` note), and\n * an application mounting it standalone is already supplying `header` and\n * owns its chrome. A second component writing to `<html>` would be the\n * surprise, not the service.\n * - **No scroll container by default.** The page scrolls, and a nested\n * `overflow-auto` would strand the sticky rail against the wrong scroll\n * root. An application whose own shell has already taken the viewport\n * height and hidden its overflow has no page scroll to lend, and opts in\n * with `fill` on the options atom — see `SettingsLayout`.\n *\n * `useNavEntries` returns entries already filtered by `can` and permission,\n * and sorted by group then order — and its `NavEntry` is structurally a\n * superset of `SettingsNavItem`, so it passes straight through. That is safe\n * here specifically because none of these routes is parameterised: see\n * `SettingsNav` for why it takes resolved items rather than a route name.\n */\nexport const AccountLayout = () => {\n const [options] = useStore(accountRouterOptionsAtom);\n const entries = useNavEntries({ root: \"account\" });\n\n return (\n <SettingsLayout\n className={options.className}\n fill={options.fill}\n /*\n `!== undefined`, not `??`. `null ?? x` yields `x`, so nullish\n coalescing would silently ignore `header: null` — the documented way\n to say \"this account area is nested in my own chrome, draw no bar\".\n Absent means default; explicit null means none.\n */\n header={\n options.header !== undefined ? (\n options.header\n ) : (\n <AccountHeader homeRouteName={options.homeRouteName} />\n )\n }\n /*\n `size=\"default\"` so this rail and `apps/lore`'s project-settings one\n are the same size as well as the same component. `default` rather than\n the `sm` this used to take because the metrics both rails borrow are\n `SidebarMenuButton`'s, and the sidebar itself renders at `default`.\n */\n nav={<SettingsNav items={entries} size=\"default\" />}\n >\n <NestedView />\n </SettingsLayout>\n );\n};\n\nexport default AccountLayout;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCA,MAAa,sBAAsB;CACjC,MAAM,CAAC,WAAW,SAAS,wBAAwB;CACnD,MAAM,UAAU,cAAc,EAAE,MAAM,UAAU,CAAC;CAEjD,OACE,oBAAC,gBAAD;EACE,WAAW,QAAQ;EACnB,MAAM,QAAQ;EAOd,QACE,QAAQ,WAAW,KAAA,IACjB,QAAQ,SAER,oBAAC,eAAD,EAAe,eAAe,QAAQ,cAAgB,CAAA;EAS1D,KAAK,oBAAC,aAAD;GAAa,OAAO;GAAS,MAAK;EAAW,CAAA;EAElD,UAAA,oBAAC,YAAD,CAAa,CAAA;CACC,CAAA;AAEpB"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { useToast } from "../use-toast/use-toast.js";
|
|
2
1
|
import { Button } from "../ui/button.js";
|
|
3
|
-
import {
|
|
2
|
+
import { useToast } from "../use-toast/use-toast.js";
|
|
4
3
|
import { ControlPassword } from "../control-password/control-password.js";
|
|
4
|
+
import { Dialog, DialogContent, DialogHeader, DialogTitle } from "../ui/dialog.js";
|
|
5
5
|
import { useState } from "react";
|
|
6
|
-
import { useClient } from "alepha/react";
|
|
7
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { useClient } from "alepha/react";
|
|
8
8
|
//#region src/components/account/account-password-dialog.tsx
|
|
9
9
|
/**
|
|
10
10
|
* Set a first password, or change an existing one.
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SettingsRow } from "../settings/settings-row.js";
|
|
2
|
+
import { SettingsSection } from "../settings/settings-section.js";
|
|
2
3
|
import { Button } from "../ui/button.js";
|
|
4
|
+
import { useToast } from "../use-toast/use-toast.js";
|
|
3
5
|
import { AutoForm } from "../auto-form/auto-form.js";
|
|
4
|
-
import { Badge } from "../ui/badge.js";
|
|
5
6
|
import { FileImage } from "../file-image/file-image.js";
|
|
6
|
-
import {
|
|
7
|
-
import { SettingsSection } from "../settings/settings-section.js";
|
|
7
|
+
import { Badge } from "../ui/badge.js";
|
|
8
8
|
import { useRef, useState } from "react";
|
|
9
|
-
import { useClient } from "alepha/react";
|
|
10
9
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
11
10
|
import { AtSign, Camera, Trash2, User } from "lucide-react";
|
|
12
|
-
import { useForm } from "alepha/react/form";
|
|
13
11
|
import { useI18n } from "alepha/react/i18n";
|
|
12
|
+
import { useClient } from "alepha/react";
|
|
13
|
+
import { useForm } from "alepha/react/form";
|
|
14
14
|
import { updateMyProfileBodySchema } from "alepha/api/users";
|
|
15
15
|
//#region src/components/account/account-profile.tsx
|
|
16
16
|
/**
|
|
@@ -110,7 +110,7 @@ const AccountProfile = (props) => {
|
|
|
110
110
|
"aria-label": "Change avatar",
|
|
111
111
|
className: "relative size-14 shrink-0 cursor-pointer",
|
|
112
112
|
children: [/* @__PURE__ */ jsx("div", {
|
|
113
|
-
className: "size-full overflow-hidden rounded-full border
|
|
113
|
+
className: "bg-muted size-full overflow-hidden rounded-full border",
|
|
114
114
|
children: /* @__PURE__ */ jsx(FileImage, {
|
|
115
115
|
id: profile.picture,
|
|
116
116
|
public: true,
|
|
@@ -122,7 +122,7 @@ const AccountProfile = (props) => {
|
|
|
122
122
|
})
|
|
123
123
|
})
|
|
124
124
|
}), /* @__PURE__ */ jsx("div", {
|
|
125
|
-
className: "absolute right-0 bottom-0 flex size-5 items-center justify-center rounded-full border
|
|
125
|
+
className: "bg-card absolute right-0 bottom-0 flex size-5 items-center justify-center rounded-full border",
|
|
126
126
|
children: /* @__PURE__ */ jsx(Camera, { className: "size-3" })
|
|
127
127
|
})]
|
|
128
128
|
}), profile.picture ? /* @__PURE__ */ jsxs(Button, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account-profile.js","names":[],"sources":["../../../src/components/account/account-profile.tsx"],"sourcesContent":["import { AutoForm } from \"@alepha/ui/components/auto-form/auto-form\";\nimport { FileImage } from \"@alepha/ui/components/file-image/file-image\";\nimport { SettingsRow } from \"@alepha/ui/components/settings/settings-row\";\nimport { SettingsSection } from \"@alepha/ui/components/settings/settings-section\";\nimport { Badge } from \"@alepha/ui/components/ui/badge\";\nimport { Button } from \"@alepha/ui/components/ui/button\";\nimport { useToast } from \"@alepha/ui/components/use-toast/use-toast\";\nimport type {\n MyAvatarController,\n MyProfile,\n MyProfileController,\n RealmConfig,\n} from \"alepha/api/users\";\nimport { updateMyProfileBodySchema } from \"alepha/api/users\";\nimport { useClient } from \"alepha/react\";\nimport { useForm } from \"alepha/react/form\";\nimport { useI18n } from \"alepha/react/i18n\";\nimport { AtSign, Camera, Trash2, User } from \"lucide-react\";\nimport { type ChangeEvent, useRef, useState } from \"react\";\n\nexport interface AccountProfileProps {\n /**\n * Supplied by the route loader. Optional so the page can also be rendered\n * standalone in a story or a test.\n */\n profile?: MyProfile;\n\n /**\n * Supplied by the route loader, and read for one thing: whether this realm\n * collects usernames at all.\n *\n * Optional for the same reason `profile` is. Absent, the username field\n * renders — the historical behaviour, and the right guess for a realm nobody\n * described.\n */\n realmConfig?: RealmConfig;\n}\n\n/**\n * Who you are: avatar, name, and the read-only facts about the account.\n *\n * Email is shown but not editable — changing it is a verification flow, not a\n * profile edit, and `updateMyProfile` deliberately refuses it. Rather than\n * render a disabled input with no explanation, the row says so.\n */\nconst AccountProfile = (props: AccountProfileProps) => {\n const api = useClient<MyProfileController>();\n const avatarApi = useClient<MyAvatarController>();\n const toaster = useToast();\n const { l } = useI18n();\n const fileInput = useRef<HTMLInputElement>(null);\n\n const [profile, setProfile] = useState<MyProfile | undefined>(props.profile);\n const [uploading, setUploading] = useState(false);\n\n /*\n * Does this realm have usernames at all?\n *\n * The avatar section above reads its switch through `can()`, because a realm\n * with `features.avatars` off registers no avatar action and the capability\n * is simply absent from `/api/_links`. That cannot work here:\n * `updateMyProfile` is the same call that saves first and last name, so it\n * exists in every realm and its presence says nothing about usernames.\n *\n * The realm's own `settings.username` is the switch, and `\"none\"` is the\n * only value that hides the row: it is the one that means this realm has no\n * such thing as a username, so there is nothing to show and nothing the user\n * could set.\n *\n * Without this, a `\"none\"` realm did not merely render a pointless field:\n * `?? \"\"` seeded an empty string into a column that is `.optional()` but\n * `minLength: 3`, `FormModel` decodes its initial values on construction,\n * and the whole page died at `useForm` with \"Too small: expected string to\n * have >=3 characters at /username\" — before anything rendered. `apps/shop`\n * is such a realm, and `\"none\"` is also the framework default, so this is\n * what any new app hits first.\n *\n * ⚠️ `auth-register.tsx` excludes `\"email\"` here as well, and this\n * deliberately does not. In that mode `RegistrationService` derives the\n * handle from the address and drops whatever the client sent, so the\n * registration form is right to hide a field the user does not choose — but\n * the account page is where an existing, already-derived username is shown,\n * and `apps/lore` runs exactly this mode. Whether editing it there should be\n * possible at all is a real question (a rename desyncs it from the email\n * that produced it, and `updateMyProfile` does not re-run the slugger), but\n * it is a separate one from \"this realm has no usernames\", and answering it\n * by quietly deleting the field is not the place to start.\n */\n const hasUsername = props.realmConfig?.settings?.username !== \"none\";\n\n /**\n * Validated against the server's own body schema, so \"3 to 30 characters\"\n * is enforced before the request rather than only by the 400 that comes\n * back — and is stated in exactly one place.\n *\n * The schema stays whole and `username` is dropped from the *values*: the\n * column is `.optional()`, so an absent key decodes cleanly, while the empty\n * string does not. Omitting it from `groups` below is what hides the row —\n * `AutoForm` renders the fields its groups name and nothing else — and an\n * absent value is what keeps it out of the request.\n *\n * ⚠️ **`username` is never seeded as `\"\"`, even when the field is shown.**\n * The old `?? \"\"` was not only a `\"none\"`-realm problem: `\"optional\"` is a\n * realm that collects usernames and does not insist, so an account without\n * one is the normal case there — and it crashed the page for exactly those\n * users while working for everyone who had set one. `undefined` is what an\n * empty optional field means, and it is what the two name fields would use\n * too if they were not `.nullable()` with a real \"clear me\" state.\n */\n const form = useForm({\n initialValues: {\n ...(hasUsername ? { username: props.profile?.username } : {}),\n firstName: props.profile?.firstName ?? \"\",\n lastName: props.profile?.lastName ?? \"\",\n },\n schema: updateMyProfileBodySchema,\n handler: async (values) => {\n try {\n setProfile(\n await api.updateMyProfile({\n body: {\n // Empty is \"unset\", which the API spells `null` — NOT\n // `undefined`, which means \"leave this column alone\" and made\n // clearing a name a silent no-op that still toasted success.\n firstName: values.firstName || null,\n lastName: values.lastName || null,\n // Absent, not `null`, in a realm without usernames: `null` is the\n // \"clear this column\" signal the two name fields use, and\n // `username` has no such state — absent is \"leave it alone\".\n username: values.username,\n },\n }),\n );\n toaster.show(\"Profile updated\", \"success\");\n } catch (error: any) {\n // The username-taken 409 arrives here with its own message, which is\n // the only one worth showing. Toasted *and* rethrown: the toast is\n // what the user reads, and the throw is what keeps the form dirty and\n // errored so Save stays actionable for the retry.\n toaster.show(\n error?.message ?? \"Could not update your profile\",\n \"danger\",\n );\n throw error;\n }\n },\n });\n\n if (!profile) {\n return null;\n }\n\n const onPickAvatar = async (event: ChangeEvent<HTMLInputElement>) => {\n const file = event.target.files?.[0];\n if (!file) {\n return;\n }\n setUploading(true);\n try {\n setProfile(await avatarApi.updateMyAvatar({ body: { file } }));\n toaster.show(\"Avatar updated\", \"success\");\n } catch (error: any) {\n toaster.show(error?.message ?? \"Could not upload that image\", \"danger\");\n } finally {\n setUploading(false);\n // Reset so picking the same file again still fires a change event.\n if (fileInput.current) {\n fileInput.current.value = \"\";\n }\n }\n };\n\n const removeAvatar = async () => {\n setUploading(true);\n try {\n setProfile(await avatarApi.deleteMyAvatar());\n } catch (error: any) {\n toaster.show(error?.message ?? \"Could not remove your avatar\", \"danger\");\n } finally {\n setUploading(false);\n }\n };\n\n // Realms opt into avatars (`features.avatars`, off by default), and an\n // unregistered action is absent from `/api/_links` — so this is the realm's\n // own switch read through the mechanism that cannot drift from it. Checking\n // a flag mirrored into the client instead would let the picker render\n // against endpoints that answer 404.\n const canEditAvatar = avatarApi.updateMyAvatar.can();\n\n return (\n <>\n {canEditAvatar && (\n <>\n <SettingsSection\n title=\"Profile picture\"\n description=\"Shown next to your name wherever you appear.\"\n >\n <SettingsRow\n label=\"Avatar\"\n description=\"PNG, JPEG, GIF or WebP, up to 5 MB.\"\n >\n <div className=\"flex items-center gap-3\">\n <button\n type=\"button\"\n onClick={() => fileInput.current?.click()}\n disabled={uploading}\n aria-label=\"Change avatar\"\n className=\"relative size-14 shrink-0 cursor-pointer\"\n >\n {/* Only the image is clipped to a circle; the camera badge sits\n outside the wrapper so the round mask cannot crop it. */}\n <div className=\"size-full overflow-hidden rounded-full border bg-muted\">\n <FileImage\n id={profile.picture}\n public\n alt=\"\"\n className=\"size-full object-cover\"\n fallback={\n <div className=\"flex size-full items-center justify-center\">\n <User className=\"size-6\" />\n </div>\n }\n />\n </div>\n <div className=\"absolute right-0 bottom-0 flex size-5 items-center justify-center rounded-full border bg-card\">\n <Camera className=\"size-3\" />\n </div>\n </button>\n {profile.picture ? (\n <Button\n variant=\"ghost\"\n size=\"sm\"\n onClick={removeAvatar}\n disabled={uploading}\n >\n <Trash2 className=\"size-4\" />\n Remove\n </Button>\n ) : null}\n </div>\n </SettingsRow>\n </SettingsSection>\n\n <input\n type=\"file\"\n ref={fileInput}\n onChange={onPickAvatar}\n accept=\"image/jpeg,image/png,image/webp,image/gif\"\n className=\"hidden\"\n />\n </>\n )}\n\n {/* The one section here whose rows are all form fields, so it is an\n `AutoForm` in row layout rather than hand-wired `SettingsRow`s — same\n card, same rows, same heading, plus schema validation, the error\n popover, Reset, and a Save that knows whether anything changed. The\n sections above and below stay hand-wired because their rows are an\n avatar picker and read-only values, not fields. */}\n <AutoForm\n form={form}\n layout=\"row\"\n disabledIfPristine\n groups={[\n {\n title: \"Name\",\n description: \"How you are identified to other people.\",\n fields: hasUsername\n ? [\"username\", \"firstName\", \"lastName\"]\n : [\"firstName\", \"lastName\"],\n },\n ]}\n fields={{\n // Labels are explicit rather than derived: `prettyName` would title\n // -case them into \"First Name\", and this page's wording is settled.\n //\n // Icons are explicit because `Control`'s own fallback would resolve\n // the schema hint, and for a plain string that is the generic \"T\"\n // glyph — the same mark three times, saying \"this is text\" next to a\n // label that already said so. A field earns an icon by having one\n // that means something: `@` is what a handle looks like everywhere.\n username: {\n label: \"Username\",\n description: \"Unique across this site.\",\n autoComplete: \"username\",\n icon: AtSign,\n // No clear button: `updateMyProfile` has no \"unset\" for a\n // username, so the × would offer a deletion the server cannot\n // perform. First and last name keep theirs — those genuinely\n // clear, via `null`.\n clearable: false,\n },\n firstName: {\n label: \"First name\",\n autoComplete: \"given-name\",\n icon: User,\n },\n lastName: {\n label: \"Last name\",\n autoComplete: \"family-name\",\n icon: User,\n },\n }}\n />\n\n <SettingsSection\n title=\"Account\"\n description=\"Details you cannot change from this page.\"\n >\n <SettingsRow\n label=\"Email\"\n description=\"Changing your email needs verification, so it is not a profile edit.\"\n >\n <span className=\"text-muted-foreground text-sm\">\n {profile.email ?? \"Not set\"}\n </span>\n </SettingsRow>\n <SettingsRow label=\"Roles\">\n <div className=\"flex flex-wrap gap-1\">\n {profile.roles.length > 0 ? (\n profile.roles.map((role) => (\n <Badge key={role} variant=\"outline\" className=\"text-xs\">\n {role}\n </Badge>\n ))\n ) : (\n <span className=\"text-muted-foreground text-sm\">—</span>\n )}\n </div>\n </SettingsRow>\n <SettingsRow label=\"Member since\">\n <span className=\"text-muted-foreground text-sm\">\n {String(l(profile.createdAt, { date: \"LL\" }))}\n </span>\n </SettingsRow>\n </SettingsSection>\n </>\n );\n};\n\nexport default AccountProfile;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA6CA,MAAM,kBAAkB,UAA+B;CACrD,MAAM,MAAM,UAA+B;CAC3C,MAAM,YAAY,UAA8B;CAChD,MAAM,UAAU,SAAS;CACzB,MAAM,EAAE,MAAM,QAAQ;CACtB,MAAM,YAAY,OAAyB,IAAI;CAE/C,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AAc;KACd,MAAM;IACR;IACA,UAAU;KACR,OAAO;KACP,cAAc;KACd,MAAM;IACR;GACF;EACD,CAAA;EAED,qBAAC,iBAAD;GACE,OAAM;GACN,aAAY;GAFd,UAAA;IAIE,oBAAC,aAAD;KACE,OAAM;KACN,aAAY;KAEZ,UAAA,oBAAC,QAAD;MAAM,WAAU;MACb,UAAA,QAAQ,SAAS;KACd,CAAA;IACK,CAAA;IACb,oBAAC,aAAD;KAAa,OAAM;KACjB,UAAA,oBAAC,OAAD;MAAK,WAAU;MACZ,UAAA,QAAQ,MAAM,SAAS,IACtB,QAAQ,MAAM,KAAK,SACjB,oBAAC,OAAD;OAAkB,SAAQ;OAAU,WAAU;OAC3C,UAAA;MACI,GAFK,IAEL,CACR,IAED,oBAAC,QAAD;OAAM,WAAU;OAAgC,UAAA;MAAO,CAAA;KAEtD,CAAA;IACM,CAAA;IACb,oBAAC,aAAD;KAAa,OAAM;KACjB,UAAA,oBAAC,QAAD;MAAM,WAAU;MACb,UAAA,OAAO,EAAE,QAAQ,WAAW,EAAE,MAAM,KAAK,CAAC,CAAC;KACxC,CAAA;IACK,CAAA;GACE;;CACjB,EAAA,CAAA;AAEN"}
|
|
1
|
+
{"version":3,"file":"account-profile.js","names":[],"sources":["../../../src/components/account/account-profile.tsx"],"sourcesContent":["import { AutoForm } from \"@alepha/ui/components/auto-form/auto-form\";\nimport { FileImage } from \"@alepha/ui/components/file-image/file-image\";\nimport { SettingsRow } from \"@alepha/ui/components/settings/settings-row\";\nimport { SettingsSection } from \"@alepha/ui/components/settings/settings-section\";\nimport { Badge } from \"@alepha/ui/components/ui/badge\";\nimport { Button } from \"@alepha/ui/components/ui/button\";\nimport { useToast } from \"@alepha/ui/components/use-toast/use-toast\";\nimport type {\n MyAvatarController,\n MyProfile,\n MyProfileController,\n RealmConfig,\n} from \"alepha/api/users\";\nimport { updateMyProfileBodySchema } from \"alepha/api/users\";\nimport { useClient } from \"alepha/react\";\nimport { useForm } from \"alepha/react/form\";\nimport { useI18n } from \"alepha/react/i18n\";\nimport { AtSign, Camera, Trash2, User } from \"lucide-react\";\nimport { type ChangeEvent, useRef, useState } from \"react\";\n\nexport interface AccountProfileProps {\n /**\n * Supplied by the route loader. Optional so the page can also be rendered\n * standalone in a story or a test.\n */\n profile?: MyProfile;\n\n /**\n * Supplied by the route loader, and read for one thing: whether this realm\n * collects usernames at all.\n *\n * Optional for the same reason `profile` is. Absent, the username field\n * renders — the historical behaviour, and the right guess for a realm nobody\n * described.\n */\n realmConfig?: RealmConfig;\n}\n\n/**\n * Who you are: avatar, name, and the read-only facts about the account.\n *\n * Email is shown but not editable — changing it is a verification flow, not a\n * profile edit, and `updateMyProfile` deliberately refuses it. Rather than\n * render a disabled input with no explanation, the row says so.\n */\nconst AccountProfile = (props: AccountProfileProps) => {\n const api = useClient<MyProfileController>();\n const avatarApi = useClient<MyAvatarController>();\n const toaster = useToast();\n const { l } = useI18n();\n const fileInput = useRef<HTMLInputElement>(null);\n\n const [profile, setProfile] = useState<MyProfile | undefined>(props.profile);\n const [uploading, setUploading] = useState(false);\n\n /*\n * Does this realm have usernames at all?\n *\n * The avatar section above reads its switch through `can()`, because a realm\n * with `features.avatars` off registers no avatar action and the capability\n * is simply absent from `/api/_links`. That cannot work here:\n * `updateMyProfile` is the same call that saves first and last name, so it\n * exists in every realm and its presence says nothing about usernames.\n *\n * The realm's own `settings.username` is the switch, and `\"none\"` is the\n * only value that hides the row: it is the one that means this realm has no\n * such thing as a username, so there is nothing to show and nothing the user\n * could set.\n *\n * Without this, a `\"none\"` realm did not merely render a pointless field:\n * `?? \"\"` seeded an empty string into a column that is `.optional()` but\n * `minLength: 3`, `FormModel` decodes its initial values on construction,\n * and the whole page died at `useForm` with \"Too small: expected string to\n * have >=3 characters at /username\" — before anything rendered. `apps/examples/shop`\n * is such a realm, and `\"none\"` is also the framework default, so this is\n * what any new app hits first.\n *\n * ⚠️ `auth-register.tsx` excludes `\"email\"` here as well, and this\n * deliberately does not. In that mode `RegistrationService` derives the\n * handle from the address and drops whatever the client sent, so the\n * registration form is right to hide a field the user does not choose — but\n * the account page is where an existing, already-derived username is shown,\n * and `apps/lore` runs exactly this mode. Whether editing it there should be\n * possible at all is a real question (a rename desyncs it from the email\n * that produced it, and `updateMyProfile` does not re-run the slugger), but\n * it is a separate one from \"this realm has no usernames\", and answering it\n * by quietly deleting the field is not the place to start.\n */\n const hasUsername = props.realmConfig?.settings?.username !== \"none\";\n\n /**\n * Validated against the server's own body schema, so \"3 to 30 characters\"\n * is enforced before the request rather than only by the 400 that comes\n * back — and is stated in exactly one place.\n *\n * The schema stays whole and `username` is dropped from the *values*: the\n * column is `.optional()`, so an absent key decodes cleanly, while the empty\n * string does not. Omitting it from `groups` below is what hides the row —\n * `AutoForm` renders the fields its groups name and nothing else — and an\n * absent value is what keeps it out of the request.\n *\n * ⚠️ **`username` is never seeded as `\"\"`, even when the field is shown.**\n * The old `?? \"\"` was not only a `\"none\"`-realm problem: `\"optional\"` is a\n * realm that collects usernames and does not insist, so an account without\n * one is the normal case there — and it crashed the page for exactly those\n * users while working for everyone who had set one. `undefined` is what an\n * empty optional field means, and it is what the two name fields would use\n * too if they were not `.nullable()` with a real \"clear me\" state.\n */\n const form = useForm({\n initialValues: {\n ...(hasUsername ? { username: props.profile?.username } : {}),\n firstName: props.profile?.firstName ?? \"\",\n lastName: props.profile?.lastName ?? \"\",\n },\n schema: updateMyProfileBodySchema,\n handler: async (values) => {\n try {\n setProfile(\n await api.updateMyProfile({\n body: {\n // Empty is \"unset\", which the API spells `null` — NOT\n // `undefined`, which means \"leave this column alone\" and made\n // clearing a name a silent no-op that still toasted success.\n firstName: values.firstName || null,\n lastName: values.lastName || null,\n // Absent, not `null`, in a realm without usernames: `null` is the\n // \"clear this column\" signal the two name fields use, and\n // `username` has no such state — absent is \"leave it alone\".\n username: values.username,\n },\n }),\n );\n toaster.show(\"Profile updated\", \"success\");\n } catch (error: any) {\n // The username-taken 409 arrives here with its own message, which is\n // the only one worth showing. Toasted *and* rethrown: the toast is\n // what the user reads, and the throw is what keeps the form dirty and\n // errored so Save stays actionable for the retry.\n toaster.show(\n error?.message ?? \"Could not update your profile\",\n \"danger\",\n );\n throw error;\n }\n },\n });\n\n if (!profile) {\n return null;\n }\n\n const onPickAvatar = async (event: ChangeEvent<HTMLInputElement>) => {\n const file = event.target.files?.[0];\n if (!file) {\n return;\n }\n setUploading(true);\n try {\n setProfile(await avatarApi.updateMyAvatar({ body: { file } }));\n toaster.show(\"Avatar updated\", \"success\");\n } catch (error: any) {\n toaster.show(error?.message ?? \"Could not upload that image\", \"danger\");\n } finally {\n setUploading(false);\n // Reset so picking the same file again still fires a change event.\n if (fileInput.current) {\n fileInput.current.value = \"\";\n }\n }\n };\n\n const removeAvatar = async () => {\n setUploading(true);\n try {\n setProfile(await avatarApi.deleteMyAvatar());\n } catch (error: any) {\n toaster.show(error?.message ?? \"Could not remove your avatar\", \"danger\");\n } finally {\n setUploading(false);\n }\n };\n\n // Realms opt into avatars (`features.avatars`, off by default), and an\n // unregistered action is absent from `/api/_links` — so this is the realm's\n // own switch read through the mechanism that cannot drift from it. Checking\n // a flag mirrored into the client instead would let the picker render\n // against endpoints that answer 404.\n const canEditAvatar = avatarApi.updateMyAvatar.can();\n\n return (\n <>\n {canEditAvatar && (\n <>\n <SettingsSection\n title=\"Profile picture\"\n description=\"Shown next to your name wherever you appear.\"\n >\n <SettingsRow\n label=\"Avatar\"\n description=\"PNG, JPEG, GIF or WebP, up to 5 MB.\"\n >\n <div className=\"flex items-center gap-3\">\n <button\n type=\"button\"\n onClick={() => fileInput.current?.click()}\n disabled={uploading}\n aria-label=\"Change avatar\"\n className=\"relative size-14 shrink-0 cursor-pointer\"\n >\n {/* Only the image is clipped to a circle; the camera badge sits\n outside the wrapper so the round mask cannot crop it. */}\n <div className=\"bg-muted size-full overflow-hidden rounded-full border\">\n <FileImage\n id={profile.picture}\n public\n alt=\"\"\n className=\"size-full object-cover\"\n fallback={\n <div className=\"flex size-full items-center justify-center\">\n <User className=\"size-6\" />\n </div>\n }\n />\n </div>\n <div className=\"bg-card absolute right-0 bottom-0 flex size-5 items-center justify-center rounded-full border\">\n <Camera className=\"size-3\" />\n </div>\n </button>\n {profile.picture ? (\n <Button\n variant=\"ghost\"\n size=\"sm\"\n onClick={removeAvatar}\n disabled={uploading}\n >\n <Trash2 className=\"size-4\" />\n Remove\n </Button>\n ) : null}\n </div>\n </SettingsRow>\n </SettingsSection>\n\n <input\n type=\"file\"\n ref={fileInput}\n onChange={onPickAvatar}\n accept=\"image/jpeg,image/png,image/webp,image/gif\"\n className=\"hidden\"\n />\n </>\n )}\n\n {/* The one section here whose rows are all form fields, so it is an\n `AutoForm` in row layout rather than hand-wired `SettingsRow`s — same\n card, same rows, same heading, plus schema validation, the error\n popover, Reset, and a Save that knows whether anything changed. The\n sections above and below stay hand-wired because their rows are an\n avatar picker and read-only values, not fields. */}\n <AutoForm\n form={form}\n layout=\"row\"\n disabledIfPristine\n groups={[\n {\n title: \"Name\",\n description: \"How you are identified to other people.\",\n fields: hasUsername\n ? [\"username\", \"firstName\", \"lastName\"]\n : [\"firstName\", \"lastName\"],\n },\n ]}\n fields={{\n // Labels are explicit rather than derived: `prettyName` would title\n // -case them into \"First Name\", and this page's wording is settled.\n //\n // Icons are explicit because `Control`'s own fallback would resolve\n // the schema hint, and for a plain string that is the generic \"T\"\n // glyph — the same mark three times, saying \"this is text\" next to a\n // label that already said so. A field earns an icon by having one\n // that means something: `@` is what a handle looks like everywhere.\n username: {\n label: \"Username\",\n description: \"Unique across this site.\",\n autoComplete: \"username\",\n icon: AtSign,\n // No clear button: `updateMyProfile` has no \"unset\" for a\n // username, so the × would offer a deletion the server cannot\n // perform. First and last name keep theirs — those genuinely\n // clear, via `null`.\n clearable: false,\n },\n firstName: {\n label: \"First name\",\n autoComplete: \"given-name\",\n icon: User,\n },\n lastName: {\n label: \"Last name\",\n autoComplete: \"family-name\",\n icon: User,\n },\n }}\n />\n\n <SettingsSection\n title=\"Account\"\n description=\"Details you cannot change from this page.\"\n >\n <SettingsRow\n label=\"Email\"\n description=\"Changing your email needs verification, so it is not a profile edit.\"\n >\n <span className=\"text-muted-foreground text-sm\">\n {profile.email ?? \"Not set\"}\n </span>\n </SettingsRow>\n <SettingsRow label=\"Roles\">\n <div className=\"flex flex-wrap gap-1\">\n {profile.roles.length > 0 ? (\n profile.roles.map((role) => (\n <Badge key={role} variant=\"outline\" className=\"text-xs\">\n {role}\n </Badge>\n ))\n ) : (\n <span className=\"text-muted-foreground text-sm\">—</span>\n )}\n </div>\n </SettingsRow>\n <SettingsRow label=\"Member since\">\n <span className=\"text-muted-foreground text-sm\">\n {String(l(profile.createdAt, { date: \"LL\" }))}\n </span>\n </SettingsRow>\n </SettingsSection>\n </>\n );\n};\n\nexport default AccountProfile;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA6CA,MAAM,kBAAkB,UAA+B;CACrD,MAAM,MAAM,UAA+B;CAC3C,MAAM,YAAY,UAA8B;CAChD,MAAM,UAAU,SAAS;CACzB,MAAM,EAAE,MAAM,QAAQ;CACtB,MAAM,YAAY,OAAyB,IAAI;CAE/C,MAAM,CAAC,SAAS,cAAc,SAAgC,MAAM,OAAO;CAC3E,MAAM,CAAC,WAAW,gBAAgB,SAAS,KAAK;CAmChD,MAAM,cAAc,MAAM,aAAa,UAAU,aAAa;;;;;;;;;;;;;;;;;;;;CAqB9D,MAAM,OAAO,QAAQ;EACnB,eAAe;GACb,GAAI,cAAc,EAAE,UAAU,MAAM,SAAS,SAAS,IAAI,CAAC;GAC3D,WAAW,MAAM,SAAS,aAAa;GACvC,UAAU,MAAM,SAAS,YAAY;EACvC;EACA,QAAQ;EACR,SAAS,OAAO,WAAW;GACzB,IAAI;IACF,WACE,MAAM,IAAI,gBAAgB,EACxB,MAAM;KAIJ,WAAW,OAAO,aAAa;KAC/B,UAAU,OAAO,YAAY;KAI7B,UAAU,OAAO;IACnB,EACF,CAAC,CACH;IACA,QAAQ,KAAK,mBAA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EtD,CAAA;IACM,CAAA;IACb,oBAAC,aAAD;KAAa,OAAM;KACjB,UAAA,oBAAC,QAAD;MAAM,WAAU;MACb,UAAA,OAAO,EAAE,QAAQ,WAAW,EAAE,MAAM,KAAK,CAAC,CAAC;KACxC,CAAA;IACK,CAAA;GACE;;CACjB,EAAA,CAAA;AAEN"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account-router-options.d.ts","sourceRoot":"","sources":["../../../src/components/account/account-router-options.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"account-router-options.d.ts","sourceRoot":"","sources":["../../../src/components/account/account-router-options.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAEnE;;;;;;;;GAQG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;IAEnB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;;;;;;;;OAWG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IAEf;;;;;;OAMG;IACH,KAAK,CAAC,EAAE;QACN,OAAO,CAAC,EAAE,mBAAmB,CAAC;QAC9B,QAAQ,CAAC,EAAE,oBAAoB,CAAC;QAChC,QAAQ,CAAC,EAAE,oBAAoB,CAAC;QAChC,IAAI,CAAC,EAAE,gBAAgB,CAAC;QACxB,WAAW,CAAC,EAAE,uBAAuB,CAAC;KACvC,CAAC;CACH;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,wBAAwB,gIAKnC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account-router-options.js","names":[],"sources":["../../../src/components/account/account-router-options.tsx"],"sourcesContent":["import { $atom, z } from \"alepha\";\nimport type { ReactNode } from \"react\";\nimport type { AccountConnectionsProps } from \"./account-connections.tsx\";\nimport type { AccountKeysProps } from \"./account-keys.tsx\";\nimport type { AccountProfileProps } from \"./account-profile.tsx\";\nimport type { AccountSecurityProps } from \"./account-security.tsx\";\nimport type { AccountSessionsProps } from \"./account-sessions.tsx\";\n\n/**\n * Everything an application can change about `AccountRouter` without writing\n * its own.\n *\n * The seam is narrower than the admin one, and deliberately so — an account\n * area is a handful of forms, not a console. An application wanting different\n * URLs or a different page set writes its own router; the same trade\n * `AuthRouter` documents.\n */\nexport interface AccountRouterOptions {\n /**\n * Replaces the default {@link AccountHeader} — the back link plus the\n * ambient controls — entirely. Supply the whole bar, not an addition to it.\n *\n * Set it to `null` for an account area nested inside an application's own\n * chrome, where a second header would just be a second row of the same\n * controls.\n */\n header?: ReactNode;\n\n /**\n * Route name the default header's back link points at. Ignored when\n * `header` is supplied, since that replaces the link too.\n *\n * @default \"home\"\n */\n homeRouteName?: string;\n\n /**\n * Extra class(es) merged onto the shell's root element, for an account area\n * living inside a document the application does not fully own.\n */\n className?: string;\n\n /**\n * Bound the account area to its parent's height and let its content column\n * scroll, rather than relying on the document to scroll.\n *\n * Set it whenever the application adopts `AccountRouter.layout` into a shell\n * that has taken the viewport height and hidden its overflow — the common\n * `h-svh … overflow-hidden` app frame. Without it those pages have no\n * scrollbar at all in such a shell, and everything past the fold is\n * unreachable rather than merely below.\n *\n * @default false — the account area scrolls with the document.\n */\n fill?: boolean;\n\n /**\n * Props forwarded to the pages, keyed by page.\n *\n * Each entry reuses that component's own exported props interface rather\n * than restating its fields, so a prop added to a page is passable the day\n * it exists.\n */\n pages?: {\n profile?: AccountProfileProps;\n security?: AccountSecurityProps;\n sessions?: AccountSessionsProps;\n keys?: AccountKeysProps;\n connections?: AccountConnectionsProps;\n };\n}\n\n/**\n * Boot-time configuration for `AccountRouter`, following the\n * `adminRouterOptionsAtom` pattern: the application calls\n * `alepha.set(accountRouterOptionsAtom, { … })` once, before start.\n *\n * `z.custom` passthrough because the value carries React nodes, whose shape\n * TypeScript already owns. Being boot-configured also keeps it out of the SSR\n * payload — `StateManager.exportAtoms()` reads request scope only, and a\n * `ReactNode` would not survive JSON serialization.\n */\nexport const accountRouterOptionsAtom = $atom({\n name: \"alepha.ui.account.router.options\",\n description: \"Chrome slot and per-page props for the account router.\",\n schema: z.custom<AccountRouterOptions>(),\n default: {} satisfies AccountRouterOptions,\n});\n"],"mappings":";;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"account-router-options.js","names":[],"sources":["../../../src/components/account/account-router-options.tsx"],"sourcesContent":["import { $atom, z } from \"alepha\";\nimport type { ReactNode } from \"react\";\n\nimport type { AccountConnectionsProps } from \"./account-connections.tsx\";\nimport type { AccountKeysProps } from \"./account-keys.tsx\";\nimport type { AccountProfileProps } from \"./account-profile.tsx\";\nimport type { AccountSecurityProps } from \"./account-security.tsx\";\nimport type { AccountSessionsProps } from \"./account-sessions.tsx\";\n\n/**\n * Everything an application can change about `AccountRouter` without writing\n * its own.\n *\n * The seam is narrower than the admin one, and deliberately so — an account\n * area is a handful of forms, not a console. An application wanting different\n * URLs or a different page set writes its own router; the same trade\n * `AuthRouter` documents.\n */\nexport interface AccountRouterOptions {\n /**\n * Replaces the default {@link AccountHeader} — the back link plus the\n * ambient controls — entirely. Supply the whole bar, not an addition to it.\n *\n * Set it to `null` for an account area nested inside an application's own\n * chrome, where a second header would just be a second row of the same\n * controls.\n */\n header?: ReactNode;\n\n /**\n * Route name the default header's back link points at. Ignored when\n * `header` is supplied, since that replaces the link too.\n *\n * @default \"home\"\n */\n homeRouteName?: string;\n\n /**\n * Extra class(es) merged onto the shell's root element, for an account area\n * living inside a document the application does not fully own.\n */\n className?: string;\n\n /**\n * Bound the account area to its parent's height and let its content column\n * scroll, rather than relying on the document to scroll.\n *\n * Set it whenever the application adopts `AccountRouter.layout` into a shell\n * that has taken the viewport height and hidden its overflow — the common\n * `h-svh … overflow-hidden` app frame. Without it those pages have no\n * scrollbar at all in such a shell, and everything past the fold is\n * unreachable rather than merely below.\n *\n * @default false — the account area scrolls with the document.\n */\n fill?: boolean;\n\n /**\n * Props forwarded to the pages, keyed by page.\n *\n * Each entry reuses that component's own exported props interface rather\n * than restating its fields, so a prop added to a page is passable the day\n * it exists.\n */\n pages?: {\n profile?: AccountProfileProps;\n security?: AccountSecurityProps;\n sessions?: AccountSessionsProps;\n keys?: AccountKeysProps;\n connections?: AccountConnectionsProps;\n };\n}\n\n/**\n * Boot-time configuration for `AccountRouter`, following the\n * `adminRouterOptionsAtom` pattern: the application calls\n * `alepha.set(accountRouterOptionsAtom, { … })` once, before start.\n *\n * `z.custom` passthrough because the value carries React nodes, whose shape\n * TypeScript already owns. Being boot-configured also keeps it out of the SSR\n * payload — `StateManager.exportAtoms()` reads request scope only, and a\n * `ReactNode` would not survive JSON serialization.\n */\nexport const accountRouterOptionsAtom = $atom({\n name: \"alepha.ui.account.router.options\",\n description: \"Chrome slot and per-page props for the account router.\",\n schema: z.custom<AccountRouterOptions>(),\n default: {} satisfies AccountRouterOptions,\n});\n"],"mappings":";;;;;;;;;;;;AAmFA,MAAa,2BAA2B,MAAM;CAC5C,MAAM;CACN,aAAa;CACb,QAAQ,EAAE,OAA6B;CACvC,SAAS,CAAC;AACZ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account-router-page.d.ts","sourceRoot":"","sources":["../../../src/components/account/account-router-page.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,mBAAmB,EACpB,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"account-router-page.d.ts","sourceRoot":"","sources":["../../../src/components/account/account-router-page.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,mBAAmB,EACpB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAG1E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,eAAO,MAAM,YAAY,GACvB,OAAO,SAAS,gBAAgB,GAAG,gBAAgB,EACnD,MAAM,SAAS,MAAM,GAAG,aAAa,EACrC,YAAY,SAAS,MAAM,GAAG,mBAAmB,WAExC,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,QAAQ,CAAC,KACrE,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,CAO7C,CAAC"}
|