@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
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
//#region src/components/markdown-view/diagram/flowchartParser.ts
|
|
2
|
+
/**
|
|
3
|
+
* Parse the text inside a ` ```mermaid ` fence into a `GraphModel`.
|
|
4
|
+
*
|
|
5
|
+
* Pure string in, data out: no layout knowledge, no DOM, no React. The
|
|
6
|
+
* subset is mermaid's `flowchart` as agents actually write it, not as the
|
|
7
|
+
* documentation leads with - inline node declarations, both label forms,
|
|
8
|
+
* chains, fans, `<br/>`, and every bracket pair mermaid has, mapped onto
|
|
9
|
+
* the four shapes the emitter draws.
|
|
10
|
+
*
|
|
11
|
+
* **It never throws and it never fails loudly.** The caller's fallback is
|
|
12
|
+
* the original code block, so an unreadable statement is skipped and an
|
|
13
|
+
* unreadable document returns `undefined`. Anything that is not a
|
|
14
|
+
* `flowchart` / `graph` (a `sequenceDiagram`, a `gantt`) returns
|
|
15
|
+
* `undefined` on the header line and degrades to the fence.
|
|
16
|
+
*/
|
|
17
|
+
const parseFlowchart = (source) => {
|
|
18
|
+
try {
|
|
19
|
+
return parseChecked(source);
|
|
20
|
+
} catch {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
const parseChecked = (source) => {
|
|
25
|
+
const statements = splitStatements(stripPreamble(source));
|
|
26
|
+
if (statements.length === 0) return void 0;
|
|
27
|
+
const header = /^(?:flowchart|graph)(?:\s+(TD|TB|BT|LR|RL))?\s*$/i.exec(statements[0]);
|
|
28
|
+
if (!header) return void 0;
|
|
29
|
+
const state = {
|
|
30
|
+
direction: header[1] ? normalizeDirection(header[1]) : "TB",
|
|
31
|
+
nodes: /* @__PURE__ */ new Map(),
|
|
32
|
+
clusters: /* @__PURE__ */ new Map(),
|
|
33
|
+
edges: [],
|
|
34
|
+
stack: []
|
|
35
|
+
};
|
|
36
|
+
for (const statement of statements.slice(1)) try {
|
|
37
|
+
readStatement(statement, state);
|
|
38
|
+
} catch {}
|
|
39
|
+
if (state.nodes.size === 0) return void 0;
|
|
40
|
+
return {
|
|
41
|
+
direction: state.direction,
|
|
42
|
+
nodes: [...state.nodes.values()],
|
|
43
|
+
clusters: [...state.clusters.values()],
|
|
44
|
+
edges: retargetClusterEdges(state)
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Statements that carry styling or interaction rather than structure. Our
|
|
49
|
+
* theme decides colours, so all of them are skipped in silence.
|
|
50
|
+
*/
|
|
51
|
+
const IGNORED = /^(?:classDef|class|style|linkStyle|click|accTitle|accDescr)\b/i;
|
|
52
|
+
const readStatement = (statement, state) => {
|
|
53
|
+
if (!statement) return;
|
|
54
|
+
if (IGNORED.test(statement)) return;
|
|
55
|
+
if (/^direction\s+/i.test(statement)) return;
|
|
56
|
+
if (/^end$/i.test(statement)) {
|
|
57
|
+
state.stack.pop();
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
const subgraph = /^subgraph\s+(.*)$/i.exec(statement);
|
|
61
|
+
if (subgraph) {
|
|
62
|
+
openCluster(subgraph[1].trim(), state);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
readEdgeStatement(statement, state);
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* `subgraph id [Title]`, `subgraph id["Title"]` or `subgraph Title`, where
|
|
69
|
+
* the title doubles as the id.
|
|
70
|
+
*/
|
|
71
|
+
const openCluster = (rest, state) => {
|
|
72
|
+
const bracket = /^(\S+)\s*[[(]\s*(.*?)\s*[\])]$/.exec(rest);
|
|
73
|
+
const id = bracket ? bracket[1] : rest;
|
|
74
|
+
const label = bracket ? unquote(bracket[2]) : unquote(rest);
|
|
75
|
+
if (!id) return;
|
|
76
|
+
if (!state.clusters.has(id)) state.clusters.set(id, {
|
|
77
|
+
id,
|
|
78
|
+
label: label || id,
|
|
79
|
+
...state.stack.length ? { parent: state.stack[state.stack.length - 1] } : {}
|
|
80
|
+
});
|
|
81
|
+
state.stack.push(id);
|
|
82
|
+
};
|
|
83
|
+
const readEdgeStatement = (statement, state) => {
|
|
84
|
+
const parts = splitOnLinks(statement);
|
|
85
|
+
if (!parts) return;
|
|
86
|
+
let previous;
|
|
87
|
+
for (const part of parts) {
|
|
88
|
+
const ids = part.group.split(/&/).map((item) => declareNode(item.trim(), state)).filter((id) => id !== void 0);
|
|
89
|
+
if (ids.length === 0) {
|
|
90
|
+
previous = void 0;
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
if (previous && part.link) for (const from of previous) for (const to of ids) state.edges.push({
|
|
94
|
+
from,
|
|
95
|
+
to,
|
|
96
|
+
...part.link
|
|
97
|
+
});
|
|
98
|
+
previous = ids;
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* Declare (or re-find) a node from one item of an edge statement.
|
|
103
|
+
*
|
|
104
|
+
* The first shape seen for an id wins, so a later bare mention of `A` keeps
|
|
105
|
+
* the label `A[Start]` gave it. Getting that wrong produces a diagram where
|
|
106
|
+
* every box shows a single letter.
|
|
107
|
+
*/
|
|
108
|
+
const declareNode = (item, state) => {
|
|
109
|
+
const text = item.replace(/:::[\w-]+\s*$/, "").trim();
|
|
110
|
+
if (!text) return void 0;
|
|
111
|
+
const open = text.search(/[[({>]/);
|
|
112
|
+
const id = (open === -1 ? text : text.slice(0, open)).trim();
|
|
113
|
+
if (!id || /\s/.test(id)) return void 0;
|
|
114
|
+
if (state.nodes.get(id)) return id;
|
|
115
|
+
if (state.clusters.has(id)) return id;
|
|
116
|
+
const shaped = open === -1 ? void 0 : readShape(text.slice(open));
|
|
117
|
+
state.nodes.set(id, {
|
|
118
|
+
id,
|
|
119
|
+
lines: shaped ? shaped.lines : [id],
|
|
120
|
+
shape: shaped ? shaped.shape : "rect",
|
|
121
|
+
...state.stack.length ? { parent: state.stack[state.stack.length - 1] } : {}
|
|
122
|
+
});
|
|
123
|
+
return id;
|
|
124
|
+
};
|
|
125
|
+
/**
|
|
126
|
+
* Every mermaid bracket pair, longest opener first, mapped onto the four
|
|
127
|
+
* shapes the emitter draws. The pairs that do not draw still have to be
|
|
128
|
+
* CONSUMED, or their brackets end up in the label.
|
|
129
|
+
*/
|
|
130
|
+
const SHAPES = [
|
|
131
|
+
[
|
|
132
|
+
"(((",
|
|
133
|
+
")))",
|
|
134
|
+
"circle"
|
|
135
|
+
],
|
|
136
|
+
[
|
|
137
|
+
"([",
|
|
138
|
+
"])",
|
|
139
|
+
"rounded"
|
|
140
|
+
],
|
|
141
|
+
[
|
|
142
|
+
"[[",
|
|
143
|
+
"]]",
|
|
144
|
+
"rect"
|
|
145
|
+
],
|
|
146
|
+
[
|
|
147
|
+
"[(",
|
|
148
|
+
")]",
|
|
149
|
+
"rect"
|
|
150
|
+
],
|
|
151
|
+
[
|
|
152
|
+
"[/",
|
|
153
|
+
"/]",
|
|
154
|
+
"rect"
|
|
155
|
+
],
|
|
156
|
+
[
|
|
157
|
+
"[\\",
|
|
158
|
+
"\\]",
|
|
159
|
+
"rect"
|
|
160
|
+
],
|
|
161
|
+
[
|
|
162
|
+
"{{",
|
|
163
|
+
"}}",
|
|
164
|
+
"diamond"
|
|
165
|
+
],
|
|
166
|
+
[
|
|
167
|
+
"((",
|
|
168
|
+
"))",
|
|
169
|
+
"circle"
|
|
170
|
+
],
|
|
171
|
+
[
|
|
172
|
+
">",
|
|
173
|
+
"]",
|
|
174
|
+
"rect"
|
|
175
|
+
],
|
|
176
|
+
[
|
|
177
|
+
"[",
|
|
178
|
+
"]",
|
|
179
|
+
"rect"
|
|
180
|
+
],
|
|
181
|
+
[
|
|
182
|
+
"(",
|
|
183
|
+
")",
|
|
184
|
+
"rounded"
|
|
185
|
+
],
|
|
186
|
+
[
|
|
187
|
+
"{",
|
|
188
|
+
"}",
|
|
189
|
+
"diamond"
|
|
190
|
+
]
|
|
191
|
+
];
|
|
192
|
+
const readShape = (text) => {
|
|
193
|
+
for (const [open, close, shape] of SHAPES) {
|
|
194
|
+
if (!text.startsWith(open)) continue;
|
|
195
|
+
const body = text.endsWith(close) || close.length === 2 && text.length > open.length && text.endsWith("]") ? text.slice(open.length, text.length - close.length) : text.slice(open.length);
|
|
196
|
+
return {
|
|
197
|
+
lines: splitLabelLines(unquote(body)),
|
|
198
|
+
shape
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
/**
|
|
203
|
+
* `"quoted"` and `` `markdown` `` labels both come out as plain text: no
|
|
204
|
+
* raw HTML is ever promoted to markup on this path, and a literal backtick
|
|
205
|
+
* inside a box is the visible failure.
|
|
206
|
+
*/
|
|
207
|
+
const unquote = (raw) => {
|
|
208
|
+
let text = raw.trim();
|
|
209
|
+
if (text.length > 1 && text.startsWith("\"") && text.endsWith("\"")) text = text.slice(1, -1).trim();
|
|
210
|
+
if (text.length > 1 && text.startsWith("`") && text.endsWith("`")) text = text.slice(1, -1).trim();
|
|
211
|
+
return text;
|
|
212
|
+
};
|
|
213
|
+
/**
|
|
214
|
+
* `<br/>`, `<br>` and `<br />` are line breaks. Claude writes one in most
|
|
215
|
+
* multi-word nodes, and with no raw HTML anywhere in `MarkdownView` the
|
|
216
|
+
* literal tag would otherwise show up inside the box.
|
|
217
|
+
*/
|
|
218
|
+
const splitLabelLines = (label) => {
|
|
219
|
+
const lines = label.split(/<br\s*\/?>/i).map((line) => line.trim()).filter((line) => line.length > 0);
|
|
220
|
+
return lines.length > 0 ? lines : [label.trim()];
|
|
221
|
+
};
|
|
222
|
+
/**
|
|
223
|
+
* The link operators, tried in this order at every position.
|
|
224
|
+
*
|
|
225
|
+
* The plain forms come FIRST on purpose: `A --- B --- C` is two links, and
|
|
226
|
+
* the inline-text form would otherwise read the middle node as a label
|
|
227
|
+
* (`--- B ---`). The inline-text forms then match only where a plain one
|
|
228
|
+
* cannot, which is exactly where a label is.
|
|
229
|
+
*
|
|
230
|
+
* `<` is the only start marker supported. `o--o` / `x--x` are not, because
|
|
231
|
+
* a leading `o` or `x` is indistinguishable from the last character of an
|
|
232
|
+
* id - `box-->B` would lose its `x`.
|
|
233
|
+
*/
|
|
234
|
+
const LINK = new RegExp([
|
|
235
|
+
String.raw`(?<s1><)?(?<dash1>-\.+-+)(?<a1>[>ox])?`,
|
|
236
|
+
String.raw`(?<s2><)?(?<thick2>={3,}|={2,}(?=[>ox]))(?<a2>[>ox])?`,
|
|
237
|
+
String.raw`(?<s3><)?(?:-{3,}|-{2,}(?=[>ox]))(?<a3>[>ox])?`,
|
|
238
|
+
String.raw`(?<s4><)?(?<dash4>-\.)\s*(?<t4>[^\n<>|]*?[^\n<>|\s.])\s*\.-+(?<a4>[>ox])?`,
|
|
239
|
+
String.raw`(?<s5><)?(?<thick5>={2,})\s*(?<t5>[^\n<>|=]*?[^\n<>|=\s])\s*={2,}(?<a5>[>ox])?`,
|
|
240
|
+
String.raw`(?<s6><)?-{2,}\s*(?<t6>[^\n<>|]*?[^\n<>|\s-])\s*-{2,}(?<a6>[>ox])?`
|
|
241
|
+
].join("|"), "g");
|
|
242
|
+
/**
|
|
243
|
+
* Cut an edge statement into node groups and the links between them.
|
|
244
|
+
* Returns `undefined` for a statement that holds no node at all.
|
|
245
|
+
*/
|
|
246
|
+
const splitOnLinks = (statement) => {
|
|
247
|
+
const parts = [];
|
|
248
|
+
let cursor = 0;
|
|
249
|
+
let pending;
|
|
250
|
+
LINK.lastIndex = 0;
|
|
251
|
+
let match = LINK.exec(statement);
|
|
252
|
+
while (match) {
|
|
253
|
+
const groups = match.groups ?? {};
|
|
254
|
+
const style = groups.dash1 ?? groups.dash4 ? "dashed" : groups.thick2 ?? groups.thick5 ? "thick" : "solid";
|
|
255
|
+
const label = groups.t4 ?? groups.t5 ?? groups.t6;
|
|
256
|
+
const arrowEnd = groups.a1 ?? groups.a2 ?? groups.a3 ?? groups.a4 ?? groups.a5 ?? groups.a6;
|
|
257
|
+
const arrowStart = groups.s1 ?? groups.s2 ?? groups.s3 ?? groups.s4 ?? groups.s5 ?? groups.s6;
|
|
258
|
+
parts.push({
|
|
259
|
+
group: statement.slice(cursor, match.index),
|
|
260
|
+
link: pending
|
|
261
|
+
});
|
|
262
|
+
cursor = match.index + match[0].length;
|
|
263
|
+
const piped = /^\s*\|([^|]*)\|/.exec(statement.slice(cursor));
|
|
264
|
+
if (piped) cursor += piped[0].length;
|
|
265
|
+
const text = piped ? piped[1] : label;
|
|
266
|
+
pending = {
|
|
267
|
+
...text?.trim() ? { label: splitLabelLines(unquote(text)).join("\n") } : {},
|
|
268
|
+
style,
|
|
269
|
+
arrowStart: arrowStart === "<",
|
|
270
|
+
arrowEnd: arrowEnd !== void 0
|
|
271
|
+
};
|
|
272
|
+
LINK.lastIndex = cursor;
|
|
273
|
+
match = LINK.exec(statement);
|
|
274
|
+
}
|
|
275
|
+
parts.push({
|
|
276
|
+
group: statement.slice(cursor),
|
|
277
|
+
link: pending
|
|
278
|
+
});
|
|
279
|
+
return parts.some((p) => p.group.trim()) ? parts : void 0;
|
|
280
|
+
};
|
|
281
|
+
/**
|
|
282
|
+
* Point every edge that names a `subgraph` at one of its member nodes.
|
|
283
|
+
*
|
|
284
|
+
* graphre throws outright on an edge whose endpoint is a cluster
|
|
285
|
+
* (`Cannot set properties of undefined (setting 'rank')`), the same
|
|
286
|
+
* limitation dagre has, so this must happen before the model leaves the
|
|
287
|
+
* parser. A cluster with no node anywhere inside it has nothing to re-target
|
|
288
|
+
* to, and the edge is dropped - visibly less than mermaid draws, but the
|
|
289
|
+
* alternative is no diagram at all.
|
|
290
|
+
*/
|
|
291
|
+
const retargetClusterEdges = (state) => {
|
|
292
|
+
const out = [];
|
|
293
|
+
for (const edge of state.edges) {
|
|
294
|
+
const from = state.clusters.has(edge.from) ? firstMember(edge.from, state) : edge.from;
|
|
295
|
+
const to = state.clusters.has(edge.to) ? firstMember(edge.to, state) : edge.to;
|
|
296
|
+
if (!from || !to) continue;
|
|
297
|
+
out.push({
|
|
298
|
+
...edge,
|
|
299
|
+
from,
|
|
300
|
+
to,
|
|
301
|
+
...from === edge.from ? {} : { fromCluster: edge.from },
|
|
302
|
+
...to === edge.to ? {} : { toCluster: edge.to }
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
return out;
|
|
306
|
+
};
|
|
307
|
+
const firstMember = (clusterId, state) => {
|
|
308
|
+
for (const node of state.nodes.values()) if (node.parent === clusterId) return node.id;
|
|
309
|
+
for (const cluster of state.clusters.values()) {
|
|
310
|
+
if (cluster.parent !== clusterId) continue;
|
|
311
|
+
const nested = firstMember(cluster.id, state);
|
|
312
|
+
if (nested) return nested;
|
|
313
|
+
}
|
|
314
|
+
};
|
|
315
|
+
/**
|
|
316
|
+
* Drop the YAML frontmatter block and any `%%{init: …}%%` directives, both
|
|
317
|
+
* of which mermaid allows above the header line.
|
|
318
|
+
*/
|
|
319
|
+
const stripPreamble = (source) => source.replace(/^\s*---\r?\n[\s\S]*?\r?\n---\r?\n/, "").replace(/%%\{[\s\S]*?\}%%/g, "");
|
|
320
|
+
/**
|
|
321
|
+
* Cut the source into statements on newlines and `;`, dropping `%%`
|
|
322
|
+
* comments. Quotes and brackets are tracked so a `;` inside a label does not
|
|
323
|
+
* end the statement, and a `%` inside one is not read as a comment.
|
|
324
|
+
*/
|
|
325
|
+
const splitStatements = (source) => {
|
|
326
|
+
const statements = [];
|
|
327
|
+
let current = "";
|
|
328
|
+
let quoted = false;
|
|
329
|
+
let depth = 0;
|
|
330
|
+
const flush = () => {
|
|
331
|
+
const statement = current.trim();
|
|
332
|
+
if (statement) statements.push(statement);
|
|
333
|
+
current = "";
|
|
334
|
+
};
|
|
335
|
+
for (let i = 0; i < source.length; i++) {
|
|
336
|
+
const char = source[i];
|
|
337
|
+
if (quoted) {
|
|
338
|
+
current += char;
|
|
339
|
+
if (char === "\"") quoted = false;
|
|
340
|
+
continue;
|
|
341
|
+
}
|
|
342
|
+
if (char === "\"") {
|
|
343
|
+
quoted = true;
|
|
344
|
+
current += char;
|
|
345
|
+
continue;
|
|
346
|
+
}
|
|
347
|
+
if (char === "%" && source[i + 1] === "%" && depth === 0) {
|
|
348
|
+
while (i < source.length && source[i] !== "\n") i++;
|
|
349
|
+
flush();
|
|
350
|
+
continue;
|
|
351
|
+
}
|
|
352
|
+
if (char === "[" || char === "(" || char === "{") depth++;
|
|
353
|
+
else if (char === "]" || char === ")" || char === "}") depth = Math.max(0, depth - 1);
|
|
354
|
+
if ((char === "\n" || char === ";") && depth === 0) {
|
|
355
|
+
flush();
|
|
356
|
+
continue;
|
|
357
|
+
}
|
|
358
|
+
current += char;
|
|
359
|
+
}
|
|
360
|
+
flush();
|
|
361
|
+
return statements;
|
|
362
|
+
};
|
|
363
|
+
const normalizeDirection = (raw) => {
|
|
364
|
+
const upper = raw.toUpperCase();
|
|
365
|
+
return upper === "TD" ? "TB" : upper;
|
|
366
|
+
};
|
|
367
|
+
//#endregion
|
|
368
|
+
export { parseFlowchart };
|
|
369
|
+
|
|
370
|
+
//# sourceMappingURL=flowchartParser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flowchartParser.js","names":[],"sources":["../../../../src/components/markdown-view/diagram/flowchartParser.ts"],"sourcesContent":["import type {\n GraphCluster,\n GraphDirection,\n GraphEdge,\n GraphEdgeStyle,\n GraphModel,\n GraphNode,\n GraphNodeShape,\n} from \"./graphModel.ts\";\n\n/**\n * Parse the text inside a ` ```mermaid ` fence into a `GraphModel`.\n *\n * Pure string in, data out: no layout knowledge, no DOM, no React. The\n * subset is mermaid's `flowchart` as agents actually write it, not as the\n * documentation leads with - inline node declarations, both label forms,\n * chains, fans, `<br/>`, and every bracket pair mermaid has, mapped onto\n * the four shapes the emitter draws.\n *\n * **It never throws and it never fails loudly.** The caller's fallback is\n * the original code block, so an unreadable statement is skipped and an\n * unreadable document returns `undefined`. Anything that is not a\n * `flowchart` / `graph` (a `sequenceDiagram`, a `gantt`) returns\n * `undefined` on the header line and degrades to the fence.\n */\nexport const parseFlowchart = (source: string): GraphModel | undefined => {\n try {\n return parseChecked(source);\n } catch {\n // A parser bug must cost the diagram, never the page it sits on.\n return undefined;\n }\n};\n\nconst parseChecked = (source: string): GraphModel | undefined => {\n const statements = splitStatements(stripPreamble(source));\n if (statements.length === 0) return undefined;\n\n const header = /^(?:flowchart|graph)(?:\\s+(TD|TB|BT|LR|RL))?\\s*$/i.exec(\n statements[0],\n );\n if (!header) return undefined;\n\n const state: ParseState = {\n direction: header[1] ? normalizeDirection(header[1]) : \"TB\",\n nodes: new Map(),\n clusters: new Map(),\n edges: [],\n stack: [],\n };\n\n for (const statement of statements.slice(1)) {\n try {\n readStatement(statement, state);\n } catch {\n // Degrade, never fail: one bad statement must not lose the diagram.\n }\n }\n\n if (state.nodes.size === 0) return undefined;\n\n return {\n direction: state.direction,\n nodes: [...state.nodes.values()],\n clusters: [...state.clusters.values()],\n edges: retargetClusterEdges(state),\n };\n};\n\ninterface ParseState {\n direction: GraphDirection;\n nodes: Map<string, GraphNode>;\n clusters: Map<string, GraphCluster>;\n edges: GraphEdge[];\n /**\n * Open `subgraph` ids, innermost last.\n */\n stack: string[];\n}\n\n/**\n * Statements that carry styling or interaction rather than structure. Our\n * theme decides colours, so all of them are skipped in silence.\n */\nconst IGNORED =\n /^(?:classDef|class|style|linkStyle|click|accTitle|accDescr)\\b/i;\n\nconst readStatement = (statement: string, state: ParseState): void => {\n if (!statement) return;\n if (IGNORED.test(statement)) return;\n // A `direction` inside a subgraph is parsed and ignored in v1: graphre\n // ranks the whole graph one way.\n if (/^direction\\s+/i.test(statement)) return;\n\n if (/^end$/i.test(statement)) {\n state.stack.pop();\n return;\n }\n\n const subgraph = /^subgraph\\s+(.*)$/i.exec(statement);\n if (subgraph) {\n openCluster(subgraph[1].trim(), state);\n return;\n }\n\n readEdgeStatement(statement, state);\n};\n\n/**\n * `subgraph id [Title]`, `subgraph id[\"Title\"]` or `subgraph Title`, where\n * the title doubles as the id.\n */\nconst openCluster = (rest: string, state: ParseState): void => {\n const bracket = /^(\\S+)\\s*[[(]\\s*(.*?)\\s*[\\])]$/.exec(rest);\n const id = bracket ? bracket[1] : rest;\n const label = bracket ? unquote(bracket[2]) : unquote(rest);\n if (!id) return;\n\n if (!state.clusters.has(id)) {\n state.clusters.set(id, {\n id,\n label: label || id,\n ...(state.stack.length\n ? { parent: state.stack[state.stack.length - 1] }\n : {}),\n });\n }\n state.stack.push(id);\n};\n\nconst readEdgeStatement = (statement: string, state: ParseState): void => {\n const parts = splitOnLinks(statement);\n if (!parts) return;\n\n let previous: string[] | undefined;\n for (const part of parts) {\n const ids = part.group\n .split(/&/)\n .map((item) => declareNode(item.trim(), state))\n .filter((id): id is string => id !== undefined);\n if (ids.length === 0) {\n previous = undefined;\n continue;\n }\n if (previous && part.link) {\n for (const from of previous) {\n for (const to of ids) {\n state.edges.push({ from, to, ...part.link });\n }\n }\n }\n previous = ids;\n }\n};\n\n/**\n * Declare (or re-find) a node from one item of an edge statement.\n *\n * The first shape seen for an id wins, so a later bare mention of `A` keeps\n * the label `A[Start]` gave it. Getting that wrong produces a diagram where\n * every box shows a single letter.\n */\nconst declareNode = (item: string, state: ParseState): string | undefined => {\n // `A[Start]:::warn` - the class is a styling hook, and styling is ours.\n const text = item.replace(/:::[\\w-]+\\s*$/, \"\").trim();\n if (!text) return undefined;\n\n const open = text.search(/[[({>]/);\n const id = (open === -1 ? text : text.slice(0, open)).trim();\n if (!id || /\\s/.test(id)) return undefined;\n\n const existing = state.nodes.get(id);\n if (existing) return id;\n\n // An id that names a subgraph is an edge endpoint, not a node. Declaring\n // it would put an empty box next to the cluster it means.\n if (state.clusters.has(id)) return id;\n\n const shaped = open === -1 ? undefined : readShape(text.slice(open));\n state.nodes.set(id, {\n id,\n lines: shaped ? shaped.lines : [id],\n shape: shaped ? shaped.shape : \"rect\",\n ...(state.stack.length\n ? { parent: state.stack[state.stack.length - 1] }\n : {}),\n });\n return id;\n};\n\n/**\n * Every mermaid bracket pair, longest opener first, mapped onto the four\n * shapes the emitter draws. The pairs that do not draw still have to be\n * CONSUMED, or their brackets end up in the label.\n */\nconst SHAPES: Array<[open: string, close: string, shape: GraphNodeShape]> = [\n [\"(((\", \")))\", \"circle\"],\n [\"([\", \"])\", \"rounded\"],\n [\"[[\", \"]]\", \"rect\"],\n [\"[(\", \")]\", \"rect\"],\n [\"[/\", \"/]\", \"rect\"],\n [\"[\\\\\", \"\\\\]\", \"rect\"],\n [\"{{\", \"}}\", \"diamond\"],\n [\"((\", \"))\", \"circle\"],\n [\">\", \"]\", \"rect\"],\n [\"[\", \"]\", \"rect\"],\n [\"(\", \")\", \"rounded\"],\n [\"{\", \"}\", \"diamond\"],\n];\n\nconst readShape = (\n text: string,\n): { lines: string[]; shape: GraphNodeShape } | undefined => {\n for (const [open, close, shape] of SHAPES) {\n if (!text.startsWith(open)) continue;\n // `[/x\\]` and `[\\x/]` are trapezoids: same opener, the other closer.\n const closed =\n text.endsWith(close) ||\n (close.length === 2 && text.length > open.length && text.endsWith(\"]\"));\n const body = closed\n ? text.slice(open.length, text.length - close.length)\n : text.slice(open.length);\n return { lines: splitLabelLines(unquote(body)), shape };\n }\n return undefined;\n};\n\n/**\n * `\"quoted\"` and `` `markdown` `` labels both come out as plain text: no\n * raw HTML is ever promoted to markup on this path, and a literal backtick\n * inside a box is the visible failure.\n */\nconst unquote = (raw: string): string => {\n let text = raw.trim();\n if (text.length > 1 && text.startsWith('\"') && text.endsWith('\"')) {\n text = text.slice(1, -1).trim();\n }\n if (text.length > 1 && text.startsWith(\"`\") && text.endsWith(\"`\")) {\n text = text.slice(1, -1).trim();\n }\n return text;\n};\n\n/**\n * `<br/>`, `<br>` and `<br />` are line breaks. Claude writes one in most\n * multi-word nodes, and with no raw HTML anywhere in `MarkdownView` the\n * literal tag would otherwise show up inside the box.\n */\nconst splitLabelLines = (label: string): string[] => {\n const lines = label\n .split(/<br\\s*\\/?>/i)\n .map((line) => line.trim())\n .filter((line) => line.length > 0);\n return lines.length > 0 ? lines : [label.trim()];\n};\n\n/**\n * The link operators, tried in this order at every position.\n *\n * The plain forms come FIRST on purpose: `A --- B --- C` is two links, and\n * the inline-text form would otherwise read the middle node as a label\n * (`--- B ---`). The inline-text forms then match only where a plain one\n * cannot, which is exactly where a label is.\n *\n * `<` is the only start marker supported. `o--o` / `x--x` are not, because\n * a leading `o` or `x` is indistinguishable from the last character of an\n * id - `box-->B` would lose its `x`.\n */\nconst LINK = new RegExp(\n [\n // plain: -.-> -.- -..->\n String.raw`(?<s1><)?(?<dash1>-\\.+-+)(?<a1>[>ox])?`,\n // plain: ==> === ==x\n String.raw`(?<s2><)?(?<thick2>={3,}|={2,}(?=[>ox]))(?<a2>[>ox])?`,\n // plain: --> --- --o --x ---->\n String.raw`(?<s3><)?(?:-{3,}|-{2,}(?=[>ox]))(?<a3>[>ox])?`,\n // labelled: -. text .->\n String.raw`(?<s4><)?(?<dash4>-\\.)\\s*(?<t4>[^\\n<>|]*?[^\\n<>|\\s.])\\s*\\.-+(?<a4>[>ox])?`,\n // labelled: == text ==>\n String.raw`(?<s5><)?(?<thick5>={2,})\\s*(?<t5>[^\\n<>|=]*?[^\\n<>|=\\s])\\s*={2,}(?<a5>[>ox])?`,\n // labelled: -- text -->\n String.raw`(?<s6><)?-{2,}\\s*(?<t6>[^\\n<>|]*?[^\\n<>|\\s-])\\s*-{2,}(?<a6>[>ox])?`,\n ].join(\"|\"),\n \"g\",\n);\n\ninterface LinkSpec {\n label?: string;\n style: GraphEdgeStyle;\n arrowStart: boolean;\n arrowEnd: boolean;\n}\n\ninterface StatementPart {\n /**\n * The node group left of `link`, or the whole statement for the first part.\n */\n group: string;\n /**\n * The link that JOINS this group to the previous one.\n */\n link?: LinkSpec;\n}\n\n/**\n * Cut an edge statement into node groups and the links between them.\n * Returns `undefined` for a statement that holds no node at all.\n */\nconst splitOnLinks = (statement: string): StatementPart[] | undefined => {\n const parts: StatementPart[] = [];\n let cursor = 0;\n let pending: LinkSpec | undefined;\n\n LINK.lastIndex = 0;\n let match = LINK.exec(statement);\n while (match) {\n const groups = match.groups ?? {};\n // Read the style off WHICH alternative matched, never off the matched\n // text: an inline label is part of that text, so `-- v1.0 -->` and\n // `== 1.5x ==>` both looked dashed when this sniffed for a dot.\n const style: GraphEdgeStyle =\n (groups.dash1 ?? groups.dash4)\n ? \"dashed\"\n : (groups.thick2 ?? groups.thick5)\n ? \"thick\"\n : \"solid\";\n const label = groups.t4 ?? groups.t5 ?? groups.t6;\n const arrowEnd =\n groups.a1 ??\n groups.a2 ??\n groups.a3 ??\n groups.a4 ??\n groups.a5 ??\n groups.a6;\n const arrowStart =\n groups.s1 ??\n groups.s2 ??\n groups.s3 ??\n groups.s4 ??\n groups.s5 ??\n groups.s6;\n\n parts.push({ group: statement.slice(cursor, match.index), link: pending });\n cursor = match.index + match[0].length;\n\n // `-->|yes|` - the other label form, sitting after the operator.\n const piped = /^\\s*\\|([^|]*)\\|/.exec(statement.slice(cursor));\n if (piped) cursor += piped[0].length;\n\n const text = piped ? piped[1] : label;\n pending = {\n ...(text?.trim()\n ? { label: splitLabelLines(unquote(text)).join(\"\\n\") }\n : {}),\n style,\n arrowStart: arrowStart === \"<\",\n arrowEnd: arrowEnd !== undefined,\n };\n\n LINK.lastIndex = cursor;\n match = LINK.exec(statement);\n }\n\n parts.push({ group: statement.slice(cursor), link: pending });\n return parts.some((p) => p.group.trim()) ? parts : undefined;\n};\n\n/**\n * Point every edge that names a `subgraph` at one of its member nodes.\n *\n * graphre throws outright on an edge whose endpoint is a cluster\n * (`Cannot set properties of undefined (setting 'rank')`), the same\n * limitation dagre has, so this must happen before the model leaves the\n * parser. A cluster with no node anywhere inside it has nothing to re-target\n * to, and the edge is dropped - visibly less than mermaid draws, but the\n * alternative is no diagram at all.\n */\nconst retargetClusterEdges = (state: ParseState): GraphEdge[] => {\n const out: GraphEdge[] = [];\n for (const edge of state.edges) {\n const from = state.clusters.has(edge.from)\n ? firstMember(edge.from, state)\n : edge.from;\n const to = state.clusters.has(edge.to)\n ? firstMember(edge.to, state)\n : edge.to;\n if (!from || !to) continue;\n out.push({\n ...edge,\n from,\n to,\n ...(from === edge.from ? {} : { fromCluster: edge.from }),\n ...(to === edge.to ? {} : { toCluster: edge.to }),\n });\n }\n return out;\n};\n\nconst firstMember = (\n clusterId: string,\n state: ParseState,\n): string | undefined => {\n for (const node of state.nodes.values()) {\n if (node.parent === clusterId) return node.id;\n }\n for (const cluster of state.clusters.values()) {\n if (cluster.parent !== clusterId) continue;\n const nested = firstMember(cluster.id, state);\n if (nested) return nested;\n }\n return undefined;\n};\n\n/**\n * Drop the YAML frontmatter block and any `%%{init: …}%%` directives, both\n * of which mermaid allows above the header line.\n */\nconst stripPreamble = (source: string): string =>\n source\n .replace(/^\\s*---\\r?\\n[\\s\\S]*?\\r?\\n---\\r?\\n/, \"\")\n .replace(/%%\\{[\\s\\S]*?\\}%%/g, \"\");\n\n/**\n * Cut the source into statements on newlines and `;`, dropping `%%`\n * comments. Quotes and brackets are tracked so a `;` inside a label does not\n * end the statement, and a `%` inside one is not read as a comment.\n */\nconst splitStatements = (source: string): string[] => {\n const statements: string[] = [];\n let current = \"\";\n let quoted = false;\n let depth = 0;\n\n const flush = () => {\n const statement = current.trim();\n if (statement) statements.push(statement);\n current = \"\";\n };\n\n for (let i = 0; i < source.length; i++) {\n const char = source[i];\n if (quoted) {\n current += char;\n if (char === '\"') quoted = false;\n continue;\n }\n if (char === '\"') {\n quoted = true;\n current += char;\n continue;\n }\n if (char === \"%\" && source[i + 1] === \"%\" && depth === 0) {\n while (i < source.length && source[i] !== \"\\n\") i++;\n flush();\n continue;\n }\n if (char === \"[\" || char === \"(\" || char === \"{\") depth++;\n else if (char === \"]\" || char === \")\" || char === \"}\")\n depth = Math.max(0, depth - 1);\n\n if ((char === \"\\n\" || char === \";\") && depth === 0) {\n flush();\n continue;\n }\n current += char;\n }\n flush();\n return statements;\n};\n\nconst normalizeDirection = (raw: string): GraphDirection => {\n const upper = raw.toUpperCase();\n // Mermaid's TD and TB are the same ranking; graphre only knows TB.\n return upper === \"TD\" ? \"TB\" : (upper as GraphDirection);\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAyBA,MAAa,kBAAkB,WAA2C;CACxE,IAAI;EACF,OAAO,aAAa,MAAM;CAC5B,QAAQ;EAEN;CACF;AACF;AAEA,MAAM,gBAAgB,WAA2C;CAC/D,MAAM,aAAa,gBAAgB,cAAc,MAAM,CAAC;CACxD,IAAI,WAAW,WAAW,GAAG,OAAO,KAAA;CAEpC,MAAM,SAAS,oDAAoD,KACjE,WAAW,EACb;CACA,IAAI,CAAC,QAAQ,OAAO,KAAA;CAEpB,MAAM,QAAoB;EACxB,WAAW,OAAO,KAAK,mBAAmB,OAAO,EAAE,IAAI;EACvD,uBAAO,IAAI,IAAI;EACf,0BAAU,IAAI,IAAI;EAClB,OAAO,CAAC;EACR,OAAO,CAAC;CACV;CAEA,K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,QAAQ,KAAK;EACtC,MAAM,OAAO,OAAO;EACpB,IAAI,QAAQ;GACV,WAAW;GACX,IAAI,SAAS,MAAK,SAAS;GAC3B;EACF;EACA,IAAI,SAAS,MAAK;GAChB,SAAS;GACT,WAAW;GACX;EACF;EACA,IAAI,SAAS,OAAO,OAAO,IAAI,OAAO,OAAO,UAAU,GAAG;GACxD,OAAO,IAAI,OAAO,UAAU,OAAO,OAAO,MAAM;GAChD,MAAM;GACN;EACF;EACA,IAAI,SAAS,OAAO,SAAS,OAAO,SAAS,KAAK;OAC7C,IAAI,SAAS,OAAO,SAAS,OAAO,SAAS,KAChD,QAAQ,KAAK,IAAI,GAAG,QAAQ,CAAC;EAE/B,KAAK,SAAS,QAAQ,SAAS,QAAQ,UAAU,GAAG;GAClD,MAAM;GACN;EACF;EACA,WAAW;CACb;CACA,MAAM;CACN,OAAO;AACT;AAEA,MAAM,sBAAsB,QAAgC;CAC1D,MAAM,QAAQ,IAAI,YAAY;CAE9B,OAAO,UAAU,OAAO,OAAQ;AAClC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The direction a flowchart ranks in, in the spelling the layout engine
|
|
3
|
+
* uses. Mermaid's `TD` is folded into `TB` at parse time so nothing
|
|
4
|
+
* downstream has to know they are the same thing.
|
|
5
|
+
*/
|
|
6
|
+
export type GraphDirection = "TB" | "BT" | "LR" | "RL";
|
|
7
|
+
/**
|
|
8
|
+
* The four shapes the emitter draws. Every other mermaid bracket pair is
|
|
9
|
+
* consumed by the parser and mapped onto the nearest of these, so a diagram
|
|
10
|
+
* using a cylinder or a stadium still renders, with a clean label.
|
|
11
|
+
*/
|
|
12
|
+
export type GraphNodeShape = "rect" | "rounded" | "diamond" | "circle";
|
|
13
|
+
/**
|
|
14
|
+
* How an edge is stroked. `-.->` is dashed, `==>` is thick, everything else
|
|
15
|
+
* is solid.
|
|
16
|
+
*/
|
|
17
|
+
export type GraphEdgeStyle = "solid" | "dashed" | "thick";
|
|
18
|
+
export interface GraphNode {
|
|
19
|
+
id: string;
|
|
20
|
+
/**
|
|
21
|
+
* The label, already split on `<br/>`. Never empty: a bare id is its own label.
|
|
22
|
+
*/
|
|
23
|
+
lines: string[];
|
|
24
|
+
shape: GraphNodeShape;
|
|
25
|
+
/**
|
|
26
|
+
* The id of the enclosing `subgraph`, if any.
|
|
27
|
+
*/
|
|
28
|
+
parent?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface GraphCluster {
|
|
31
|
+
id: string;
|
|
32
|
+
label: string;
|
|
33
|
+
/**
|
|
34
|
+
* The id of the enclosing `subgraph`, for nested ones.
|
|
35
|
+
*/
|
|
36
|
+
parent?: string;
|
|
37
|
+
}
|
|
38
|
+
export interface GraphEdge {
|
|
39
|
+
from: string;
|
|
40
|
+
to: string;
|
|
41
|
+
/**
|
|
42
|
+
* May contain `\n` when the author wrote `<br/>`.
|
|
43
|
+
*/
|
|
44
|
+
label?: string;
|
|
45
|
+
style: GraphEdgeStyle;
|
|
46
|
+
arrowStart: boolean;
|
|
47
|
+
arrowEnd: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Set when the author pointed the edge at a `subgraph` id and the parser
|
|
50
|
+
* re-targeted it to a member node: graphre throws on an edge whose
|
|
51
|
+
* endpoint is a cluster. Kept so an emitter could one day draw to the
|
|
52
|
+
* cluster border instead of to the member it landed on.
|
|
53
|
+
*/
|
|
54
|
+
fromCluster?: string;
|
|
55
|
+
toCluster?: string;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* A flowchart as data: what the parser produces and the layout adapter
|
|
59
|
+
* consumes. Nothing positional, nothing rendered, no DOM.
|
|
60
|
+
*/
|
|
61
|
+
export interface GraphModel {
|
|
62
|
+
direction: GraphDirection;
|
|
63
|
+
nodes: GraphNode[];
|
|
64
|
+
clusters: GraphCluster[];
|
|
65
|
+
edges: GraphEdge[];
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=graphModel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphModel.d.ts","sourceRoot":"","sources":["../../../../src/components/markdown-view/diagram/graphModel.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAEvD;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;AAEvE;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE1D,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,KAAK,EAAE,cAAc,CAAC;IACtB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,cAAc,CAAC;IACtB,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;IAClB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB,SAAS,EAAE,cAAc,CAAC;IAC1B,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,KAAK,EAAE,SAAS,EAAE,CAAC;CACpB"}
|
|
File without changes
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import type { GraphEdgeStyle, GraphModel, GraphNodeShape } from "./graphModel.ts";
|
|
2
|
+
/**
|
|
3
|
+
* The largest graph that gets laid out. Above it the caller falls back to
|
|
4
|
+
* the code block.
|
|
5
|
+
*
|
|
6
|
+
* Measured on an M-series laptop under Node 26, tree-shaped graphs: 50 nodes
|
|
7
|
+
* 8 ms, 200 nodes 31 ms, 500 nodes 106 ms, 1000 nodes 310 ms, 2000 nodes
|
|
8
|
+
* 1.2 s. Phones are several times slower. A pasted graph dump must not be
|
|
9
|
+
* able to freeze the page.
|
|
10
|
+
*/
|
|
11
|
+
export declare const MAX_GRAPH_NODES = 200;
|
|
12
|
+
export declare const MAX_GRAPH_EDGES = 400;
|
|
13
|
+
export interface PositionedNode {
|
|
14
|
+
id: string;
|
|
15
|
+
/**
|
|
16
|
+
* TOP-LEFT corner, in graph units. graphre reports CENTRES, for nodes and
|
|
17
|
+
* clusters alike; the conversion happens here, once, rather than in the
|
|
18
|
+
* emitter - an emitter half a box off looks almost right, which is the
|
|
19
|
+
* worst way for this to be wrong.
|
|
20
|
+
*/
|
|
21
|
+
x: number;
|
|
22
|
+
y: number;
|
|
23
|
+
width: number;
|
|
24
|
+
height: number;
|
|
25
|
+
/**
|
|
26
|
+
* The lines as MEASURED - wrapped and capped. Draw exactly these.
|
|
27
|
+
*/
|
|
28
|
+
lines: string[];
|
|
29
|
+
shape: GraphNodeShape;
|
|
30
|
+
}
|
|
31
|
+
export interface PositionedCluster {
|
|
32
|
+
id: string;
|
|
33
|
+
label: string;
|
|
34
|
+
/**
|
|
35
|
+
* TOP-LEFT corner, same convention as `PositionedNode`.
|
|
36
|
+
*/
|
|
37
|
+
x: number;
|
|
38
|
+
y: number;
|
|
39
|
+
width: number;
|
|
40
|
+
height: number;
|
|
41
|
+
/**
|
|
42
|
+
* 0 for an outermost `subgraph`, 1 for one nested inside it, and so on.
|
|
43
|
+
*/
|
|
44
|
+
depth: number;
|
|
45
|
+
}
|
|
46
|
+
export interface PositionedEdgeLabel {
|
|
47
|
+
lines: string[];
|
|
48
|
+
/**
|
|
49
|
+
* TOP-LEFT corner, same convention as `PositionedNode`.
|
|
50
|
+
*/
|
|
51
|
+
x: number;
|
|
52
|
+
y: number;
|
|
53
|
+
width: number;
|
|
54
|
+
height: number;
|
|
55
|
+
}
|
|
56
|
+
export interface PositionedEdge {
|
|
57
|
+
from: string;
|
|
58
|
+
to: string;
|
|
59
|
+
style: GraphEdgeStyle;
|
|
60
|
+
arrowStart: boolean;
|
|
61
|
+
arrowEnd: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* The polyline graphre routed, in order, in graph units.
|
|
64
|
+
*/
|
|
65
|
+
points: Array<{
|
|
66
|
+
x: number;
|
|
67
|
+
y: number;
|
|
68
|
+
}>;
|
|
69
|
+
label?: PositionedEdgeLabel;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* A laid-out flowchart: data, not markup. No SVG, no React, no strings, no
|
|
73
|
+
* DOM. This is the seam that keeps a second emitter possible without
|
|
74
|
+
* redoing the hard part.
|
|
75
|
+
*/
|
|
76
|
+
export interface PositionedGraph {
|
|
77
|
+
width: number;
|
|
78
|
+
height: number;
|
|
79
|
+
fontSize: number;
|
|
80
|
+
nodes: PositionedNode[];
|
|
81
|
+
/**
|
|
82
|
+
* Outermost first, so an emitter can draw them in order and get z-order free.
|
|
83
|
+
*/
|
|
84
|
+
clusters: PositionedCluster[];
|
|
85
|
+
edges: PositionedEdge[];
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Run `graphre` over a `GraphModel` and read positions back out.
|
|
89
|
+
*
|
|
90
|
+
* Returns `undefined` (never throws, and never returns a partial graph)
|
|
91
|
+
* for an empty model, a model past the caps, or anything graphre refuses.
|
|
92
|
+
* The caller's fallback is the original code block, and graphre must never
|
|
93
|
+
* throw into React.
|
|
94
|
+
*
|
|
95
|
+
* ## Why graphre
|
|
96
|
+
*
|
|
97
|
+
* It is dagre reimplemented in TypeScript with no dependencies: 62 kB
|
|
98
|
+
* unpacked (~15.5 kB gzip) against `@dagrejs/dagre`'s 1.4 MB, same
|
|
99
|
+
* algorithm, compound graphs included. It is frozen (last publish
|
|
100
|
+
* 2022-05, CJS/UMD only, no ESM build) and that is accepted with eyes
|
|
101
|
+
* open - Vite bundles it in both the client and the worker target, and
|
|
102
|
+
* `@dagrejs/dagre` 3.1.1 is the drop-in fallback.
|
|
103
|
+
*
|
|
104
|
+
* **It is imported in this file and nowhere else**, deliberately: plain
|
|
105
|
+
* Node ESM without a bundler sees only the default export, so if the
|
|
106
|
+
* interop ever bites, it is a one-line fix in one place.
|
|
107
|
+
*/
|
|
108
|
+
export declare const layoutFlowchart: (model: GraphModel, fontSize?: number) => PositionedGraph | undefined;
|
|
109
|
+
//# sourceMappingURL=layoutFlowchart.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layoutFlowchart.d.ts","sourceRoot":"","sources":["../../../../src/components/markdown-view/diagram/layoutFlowchart.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,cAAc,EACd,UAAU,EACV,cAAc,EACf,MAAM,iBAAiB,CAAC;AAGzB;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe,MAAM,CAAC;AACnC,eAAO,MAAM,eAAe,MAAM,CAAC;AAEnC,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX;;;;;OAKG;IACH,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,KAAK,EAAE,cAAc,CAAC;CACvB;AAED,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,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