@misoto22/design 0.6.1 → 0.8.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/AGENTS.md +87 -0
- package/CLAUDE.md +1 -0
- package/README.md +62 -5
- package/bin/misoto22-design.mjs +59 -13
- package/dist/agent/Accordion.md +24 -1
- package/dist/agent/Alert.md +23 -1
- package/dist/agent/AppShell.md +30 -2
- package/dist/agent/ArchitectureFigure.md +71 -0
- package/dist/agent/AreaChart.md +27 -2
- package/dist/agent/Article.md +26 -3
- package/dist/agent/AspectRatio.md +57 -0
- package/dist/agent/Avatar.md +25 -5
- package/dist/agent/Badge.md +22 -1
- package/dist/agent/BarChart.md +29 -2
- package/dist/agent/BarList.md +27 -1
- package/dist/agent/BigNumber.md +26 -2
- package/dist/agent/BoxPlot.md +24 -1
- package/dist/agent/Breadcrumb.md +24 -2
- package/dist/agent/BulletChart.md +23 -1
- package/dist/agent/Button.md +25 -1
- package/dist/agent/Calendar.md +37 -3
- package/dist/agent/Card.md +24 -2
- package/dist/agent/Checkbox.md +23 -2
- package/dist/agent/Code.md +50 -0
- package/dist/agent/CodeBlock.md +74 -0
- package/dist/agent/Collapsible.md +22 -1
- package/dist/agent/Combobox.md +29 -3
- package/dist/agent/Command.md +25 -2
- package/dist/agent/ComposedChart.md +26 -2
- package/dist/agent/ContextMenu.md +37 -4
- package/dist/agent/DataflowFigure.md +48 -0
- package/dist/agent/DatePicker.md +34 -6
- package/dist/agent/DescriptionList.md +68 -0
- package/dist/agent/Diagram.md +27 -3
- package/dist/agent/DiagramCanvas.md +70 -0
- package/dist/agent/DiagramExportMenu.md +64 -0
- package/dist/agent/DiagramInspector.md +72 -0
- package/dist/agent/DiagramLegend.md +55 -0
- package/dist/agent/DiagramMinimap.md +68 -0
- package/dist/agent/DiagramToolbar.md +69 -0
- package/dist/agent/Dialog.md +26 -3
- package/dist/agent/DropdownMenu.md +45 -6
- package/dist/agent/EmptyState.md +26 -1
- package/dist/agent/ErrorState.md +27 -2
- package/dist/agent/Facet.md +25 -1
- package/dist/agent/Field.md +45 -4
- package/dist/agent/FigureBand.md +24 -1
- package/dist/agent/FloatingIconButton.md +23 -1
- package/dist/agent/FunnelChart.md +23 -1
- package/dist/agent/Heading.md +64 -0
- package/dist/agent/Heatmap.md +25 -1
- package/dist/agent/Histogram.md +26 -2
- package/dist/agent/Input.md +22 -1
- package/dist/agent/Kbd.md +19 -1
- package/dist/agent/LifecycleFigure.md +49 -0
- package/dist/agent/LineChart.md +26 -2
- package/dist/agent/LinkArrow.md +20 -1
- package/dist/agent/Markdown.md +68 -0
- package/dist/agent/NativeSelect.md +23 -2
- package/dist/agent/NavItem.md +21 -1
- package/dist/agent/Pagination.md +28 -2
- package/dist/agent/PieChart.md +26 -2
- package/dist/agent/Popover.md +23 -1
- package/dist/agent/Progress.md +27 -3
- package/dist/agent/RadarChart.md +26 -2
- package/dist/agent/RadialChart.md +26 -3
- package/dist/agent/RadioGroup.md +23 -2
- package/dist/agent/SankeyChart.md +25 -2
- package/dist/agent/ScatterChart.md +27 -2
- package/dist/agent/ScrollArea.md +24 -3
- package/dist/agent/SearchableMenu.md +23 -1
- package/dist/agent/Select.md +29 -3
- package/dist/agent/Separator.md +28 -4
- package/dist/agent/SequenceFigure.md +50 -0
- package/dist/agent/Sheet.md +25 -2
- package/dist/agent/Skeleton.md +24 -2
- package/dist/agent/Slider.md +27 -4
- package/dist/agent/Sparkline.md +23 -1
- package/dist/agent/Spinner.md +24 -2
- package/dist/agent/StatusDot.md +20 -1
- package/dist/agent/StatusPill.md +28 -2
- package/dist/agent/Steps.md +24 -1
- package/dist/agent/Switch.md +21 -1
- package/dist/agent/Table.md +26 -3
- package/dist/agent/Tabs.md +24 -2
- package/dist/agent/Tag.md +40 -9
- package/dist/agent/Text.md +65 -0
- package/dist/agent/Textarea.md +20 -1
- package/dist/agent/Timestamp.md +64 -0
- package/dist/agent/Toast.md +26 -2
- package/dist/agent/ToggleGroup.md +24 -2
- package/dist/agent/Toolbar.md +71 -0
- package/dist/agent/Tooltip.md +23 -1
- package/dist/agent/TreemapChart.md +24 -1
- package/dist/agent/WaterfallChart.md +24 -1
- package/dist/agent/WorkflowFigure.md +50 -0
- package/dist/agent/catalog.json +6086 -1009
- package/dist/agent/index.md +27 -4
- package/dist/article.css +16 -4
- package/dist/charts/AreaChart/AreaChart.d.ts +9 -2
- package/dist/charts/AreaChart/AreaChart.js +12 -13
- package/dist/charts/AreaChart/AreaChart.js.map +1 -1
- package/dist/charts/BarChart/BarChart.d.ts +14 -3
- package/dist/charts/BarChart/BarChart.js +20 -12
- package/dist/charts/BarChart/BarChart.js.map +1 -1
- package/dist/charts/BarList/BarList.d.ts +9 -1
- package/dist/charts/BarList/BarList.js +9 -1
- package/dist/charts/BarList/BarList.js.map +1 -1
- package/dist/charts/BigNumber/BigNumber.d.ts +19 -3
- package/dist/charts/BigNumber/BigNumber.js +25 -5
- package/dist/charts/BigNumber/BigNumber.js.map +1 -1
- package/dist/charts/BoxPlot/BoxPlot.js +4 -2
- package/dist/charts/BoxPlot/BoxPlot.js.map +1 -1
- package/dist/charts/BulletChart/BulletChart.js +28 -7
- package/dist/charts/BulletChart/BulletChart.js.map +1 -1
- package/dist/charts/ComposedChart/ComposedChart.d.ts +9 -2
- package/dist/charts/ComposedChart/ComposedChart.js +10 -10
- package/dist/charts/ComposedChart/ComposedChart.js.map +1 -1
- package/dist/charts/FunnelChart/FunnelChart.d.ts +7 -2
- package/dist/charts/FunnelChart/FunnelChart.js +6 -16
- package/dist/charts/FunnelChart/FunnelChart.js.map +1 -1
- package/dist/charts/Heatmap/Heatmap.d.ts +17 -3
- package/dist/charts/Heatmap/Heatmap.js +20 -11
- package/dist/charts/Heatmap/Heatmap.js.map +1 -1
- package/dist/charts/Histogram/Histogram.d.ts +24 -1
- package/dist/charts/Histogram/Histogram.js +43 -11
- package/dist/charts/Histogram/Histogram.js.map +1 -1
- package/dist/charts/LineChart/LineChart.d.ts +9 -2
- package/dist/charts/LineChart/LineChart.js +11 -12
- package/dist/charts/LineChart/LineChart.js.map +1 -1
- package/dist/charts/PieChart/PieChart.d.ts +15 -3
- package/dist/charts/PieChart/PieChart.js +14 -6
- package/dist/charts/PieChart/PieChart.js.map +1 -1
- package/dist/charts/RadarChart/RadarChart.d.ts +15 -3
- package/dist/charts/RadarChart/RadarChart.js +11 -9
- package/dist/charts/RadarChart/RadarChart.js.map +1 -1
- package/dist/charts/RadialChart/RadialChart.d.ts +22 -4
- package/dist/charts/RadialChart/RadialChart.js +28 -6
- package/dist/charts/RadialChart/RadialChart.js.map +1 -1
- package/dist/charts/SankeyChart/SankeyChart.d.ts +16 -4
- package/dist/charts/SankeyChart/SankeyChart.js +14 -6
- package/dist/charts/SankeyChart/SankeyChart.js.map +1 -1
- package/dist/charts/ScatterChart/ScatterChart.d.ts +24 -3
- package/dist/charts/ScatterChart/ScatterChart.js +21 -15
- package/dist/charts/ScatterChart/ScatterChart.js.map +1 -1
- package/dist/charts/Sparkline/Sparkline.js +5 -3
- package/dist/charts/Sparkline/Sparkline.js.map +1 -1
- package/dist/charts/TreemapChart/TreemapChart.d.ts +7 -2
- package/dist/charts/TreemapChart/TreemapChart.js +20 -11
- package/dist/charts/TreemapChart/TreemapChart.js.map +1 -1
- package/dist/charts/WaterfallChart/WaterfallChart.js +4 -2
- package/dist/charts/WaterfallChart/WaterfallChart.js.map +1 -1
- package/dist/charts/index.d.ts +2 -1
- package/dist/charts/lib/export.d.ts +34 -43
- package/dist/charts/lib/export.js +16 -158
- package/dist/charts/lib/export.js.map +1 -1
- package/dist/charts/lib/figure.d.ts +21 -1
- package/dist/charts/lib/figure.js +5 -2
- package/dist/charts/lib/figure.js.map +1 -1
- package/dist/charts/lib/scale.d.ts +23 -0
- package/dist/charts/lib/scale.js +13 -0
- package/dist/charts/lib/scale.js.map +1 -0
- package/dist/charts/lib/selection.d.ts +20 -0
- package/dist/charts/lib/selection.js +18 -0
- package/dist/charts/lib/selection.js.map +1 -0
- package/dist/charts/lib/toolbar.d.ts +1 -0
- package/dist/components/Accordion/Accordion.js +8 -1
- package/dist/components/Accordion/Accordion.js.map +1 -1
- package/dist/components/AppShell/AppShell.d.ts +6 -0
- package/dist/components/AppShell/AppShell.js +34 -4
- package/dist/components/AppShell/AppShell.js.map +1 -1
- package/dist/components/Article/Article.d.ts +11 -4
- package/dist/components/Article/Article.js +13 -0
- package/dist/components/Article/Article.js.map +1 -1
- package/dist/components/AspectRatio/AspectRatio.d.ts +46 -0
- package/dist/components/AspectRatio/AspectRatio.js +33 -0
- package/dist/components/AspectRatio/AspectRatio.js.map +1 -0
- package/dist/components/Avatar/Avatar.d.ts +12 -3
- package/dist/components/Avatar/Avatar.js +6 -1
- package/dist/components/Avatar/Avatar.js.map +1 -1
- package/dist/components/Breadcrumb/Breadcrumb.d.ts +6 -0
- package/dist/components/Breadcrumb/Breadcrumb.js +15 -0
- package/dist/components/Breadcrumb/Breadcrumb.js.map +1 -1
- package/dist/components/Button/Button.js +14 -0
- package/dist/components/Button/Button.js.map +1 -1
- package/dist/components/Calendar/Calendar.d.ts +29 -3
- package/dist/components/Calendar/Calendar.js +60 -12
- package/dist/components/Calendar/Calendar.js.map +1 -1
- package/dist/components/Card/Card.d.ts +6 -0
- package/dist/components/Card/Card.js +1 -1
- package/dist/components/Card/Card.js.map +1 -1
- package/dist/components/Checkbox/Checkbox.d.ts +5 -2
- package/dist/components/Checkbox/Checkbox.js +12 -2
- package/dist/components/Checkbox/Checkbox.js.map +1 -1
- package/dist/components/Code/Code.d.ts +30 -0
- package/dist/components/Code/Code.js +21 -0
- package/dist/components/Code/Code.js.map +1 -0
- package/dist/components/CodeBlock/CodeBlock.d.ts +141 -0
- package/dist/components/CodeBlock/CodeBlock.js +123 -0
- package/dist/components/CodeBlock/CodeBlock.js.map +1 -0
- package/dist/components/Collapsible/Collapsible.js +10 -2
- package/dist/components/Collapsible/Collapsible.js.map +1 -1
- package/dist/components/Combobox/Combobox.d.ts +15 -1
- package/dist/components/Combobox/Combobox.js +25 -5
- package/dist/components/Combobox/Combobox.js.map +1 -1
- package/dist/components/Command/Command.d.ts +4 -2
- package/dist/components/Command/Command.js +13 -1
- package/dist/components/Command/Command.js.map +1 -1
- package/dist/components/ContextMenu/ContextMenu.d.ts +30 -5
- package/dist/components/ContextMenu/ContextMenu.js +32 -2
- package/dist/components/ContextMenu/ContextMenu.js.map +1 -1
- package/dist/components/DatePicker/DatePicker.d.ts +36 -4
- package/dist/components/DatePicker/DatePicker.js +55 -12
- package/dist/components/DatePicker/DatePicker.js.map +1 -1
- package/dist/components/DescriptionList/DescriptionList.d.ts +73 -0
- package/dist/components/DescriptionList/DescriptionList.js +35 -0
- package/dist/components/DescriptionList/DescriptionList.js.map +1 -0
- package/dist/components/Diagram/Diagram.d.ts +8 -3
- package/dist/components/Diagram/Diagram.js +82 -10
- package/dist/components/Diagram/Diagram.js.map +1 -1
- package/dist/components/Dialog/Dialog.d.ts +18 -3
- package/dist/components/Dialog/Dialog.js +20 -2
- package/dist/components/Dialog/Dialog.js.map +1 -1
- package/dist/components/DropdownMenu/DropdownMenu.d.ts +49 -11
- package/dist/components/DropdownMenu/DropdownMenu.js +32 -2
- package/dist/components/DropdownMenu/DropdownMenu.js.map +1 -1
- package/dist/components/EmptyState/EmptyState.d.ts +25 -1
- package/dist/components/EmptyState/EmptyState.js +3 -1
- package/dist/components/EmptyState/EmptyState.js.map +1 -1
- package/dist/components/ErrorState/ErrorState.d.ts +22 -1
- package/dist/components/ErrorState/ErrorState.js +11 -2
- package/dist/components/ErrorState/ErrorState.js.map +1 -1
- package/dist/components/Field/Field.d.ts +70 -3
- package/dist/components/Field/Field.js +53 -12
- package/dist/components/Field/Field.js.map +1 -1
- package/dist/components/Field/field-control.d.ts +31 -0
- package/dist/components/Field/field-control.js +12 -0
- package/dist/components/Field/field-control.js.map +1 -0
- package/dist/components/FloatingIconButton/FloatingIconButton.js +2 -0
- package/dist/components/FloatingIconButton/FloatingIconButton.js.map +1 -1
- package/dist/components/Heading/Heading.d.ts +62 -0
- package/dist/components/Heading/Heading.js +44 -0
- package/dist/components/Heading/Heading.js.map +1 -0
- package/dist/components/Markdown/Markdown.d.ts +139 -0
- package/dist/components/Markdown/Markdown.js +135 -0
- package/dist/components/Markdown/Markdown.js.map +1 -0
- package/dist/components/Markdown/inline.d.ts +29 -0
- package/dist/components/Markdown/inline.js +74 -0
- package/dist/components/Markdown/inline.js.map +1 -0
- package/dist/components/Markdown/nodes.d.ts +65 -0
- package/dist/components/Markdown/nodes.js +1 -0
- package/dist/components/Markdown/nodes.js.map +1 -0
- package/dist/components/Markdown/parse.d.ts +24 -0
- package/dist/components/Markdown/parse.js +110 -0
- package/dist/components/Markdown/parse.js.map +1 -0
- package/dist/components/Markdown/slug.d.ts +15 -0
- package/dist/components/Markdown/slug.js +7 -0
- package/dist/components/Markdown/slug.js.map +1 -0
- package/dist/components/NativeSelect/NativeSelect.d.ts +6 -0
- package/dist/components/NativeSelect/NativeSelect.js +2 -3
- package/dist/components/NativeSelect/NativeSelect.js.map +1 -1
- package/dist/components/Pagination/Pagination.d.ts +24 -1
- package/dist/components/Pagination/Pagination.js +6 -3
- package/dist/components/Pagination/Pagination.js.map +1 -1
- package/dist/components/Progress/Progress.d.ts +17 -5
- package/dist/components/Progress/Progress.js +18 -6
- package/dist/components/Progress/Progress.js.map +1 -1
- package/dist/components/RadioGroup/RadioGroup.d.ts +6 -0
- package/dist/components/RadioGroup/RadioGroup.js +11 -1
- package/dist/components/RadioGroup/RadioGroup.js.map +1 -1
- package/dist/components/ScrollArea/ScrollArea.d.ts +15 -0
- package/dist/components/ScrollArea/ScrollArea.js +2 -2
- package/dist/components/ScrollArea/ScrollArea.js.map +1 -1
- package/dist/components/SearchableMenu/SearchableMenu.d.ts +11 -2
- package/dist/components/SearchableMenu/SearchableMenu.js +24 -2
- package/dist/components/SearchableMenu/SearchableMenu.js.map +1 -1
- package/dist/components/Select/Select.d.ts +18 -2
- package/dist/components/Select/Select.js +20 -3
- package/dist/components/Select/Select.js.map +1 -1
- package/dist/components/Separator/Separator.d.ts +21 -3
- package/dist/components/Separator/Separator.js +9 -1
- package/dist/components/Separator/Separator.js.map +1 -1
- package/dist/components/Sheet/Sheet.d.ts +3 -0
- package/dist/components/Sheet/Sheet.js +11 -2
- package/dist/components/Sheet/Sheet.js.map +1 -1
- package/dist/components/Skeleton/Skeleton.d.ts +8 -1
- package/dist/components/Skeleton/Skeleton.js +1 -1
- package/dist/components/Skeleton/Skeleton.js.map +1 -1
- package/dist/components/Slider/Slider.d.ts +21 -3
- package/dist/components/Slider/Slider.js +54 -27
- package/dist/components/Slider/Slider.js.map +1 -1
- package/dist/components/Spinner/Spinner.d.ts +8 -0
- package/dist/components/Spinner/Spinner.js +3 -2
- package/dist/components/Spinner/Spinner.js.map +1 -1
- package/dist/components/StatusPill/StatusPill.d.ts +5 -0
- package/dist/components/StatusPill/StatusPill.js +6 -0
- package/dist/components/StatusPill/StatusPill.js.map +1 -1
- package/dist/components/Table/Table.d.ts +6 -0
- package/dist/components/Table/Table.js +3 -1
- package/dist/components/Table/Table.js.map +1 -1
- package/dist/components/Tag/Tag.d.ts +68 -9
- package/dist/components/Tag/Tag.js +50 -10
- package/dist/components/Tag/Tag.js.map +1 -1
- package/dist/components/Text/Text.d.ts +62 -0
- package/dist/components/Text/Text.js +30 -0
- package/dist/components/Text/Text.js.map +1 -0
- package/dist/components/Timestamp/Timestamp.d.ts +59 -0
- package/dist/components/Timestamp/Timestamp.js +56 -0
- package/dist/components/Timestamp/Timestamp.js.map +1 -0
- package/dist/components/Toast/Toast.d.ts +9 -1
- package/dist/components/Toast/Toast.js +27 -4
- package/dist/components/Toast/Toast.js.map +1 -1
- package/dist/components/ToggleGroup/ToggleGroup.d.ts +6 -1
- package/dist/components/ToggleGroup/ToggleGroup.js +11 -1
- package/dist/components/ToggleGroup/ToggleGroup.js.map +1 -1
- package/dist/components/Toolbar/Toolbar.d.ts +55 -0
- package/dist/components/Toolbar/Toolbar.js +43 -0
- package/dist/components/Toolbar/Toolbar.js.map +1 -0
- package/dist/diagrams/ArchitectureFigure/ArchitectureFigure.d.ts +55 -0
- package/dist/diagrams/ArchitectureFigure/ArchitectureFigure.js +175 -0
- package/dist/diagrams/ArchitectureFigure/ArchitectureFigure.js.map +1 -0
- package/dist/diagrams/DataflowFigure/DataflowFigure.d.ts +28 -0
- package/dist/diagrams/DataflowFigure/DataflowFigure.js +148 -0
- package/dist/diagrams/DataflowFigure/DataflowFigure.js.map +1 -0
- package/dist/diagrams/DiagramCanvas/DiagramCanvas.d.ts +78 -0
- package/dist/diagrams/DiagramCanvas/DiagramCanvas.js +229 -0
- package/dist/diagrams/DiagramCanvas/DiagramCanvas.js.map +1 -0
- package/dist/diagrams/DiagramExportMenu/DiagramExportMenu.d.ts +106 -0
- package/dist/diagrams/DiagramExportMenu/DiagramExportMenu.js +123 -0
- package/dist/diagrams/DiagramExportMenu/DiagramExportMenu.js.map +1 -0
- package/dist/diagrams/DiagramInspector/DiagramInspector.d.ts +70 -0
- package/dist/diagrams/DiagramInspector/DiagramInspector.js +94 -0
- package/dist/diagrams/DiagramInspector/DiagramInspector.js.map +1 -0
- package/dist/diagrams/DiagramLegend/DiagramLegend.d.ts +42 -0
- package/dist/diagrams/DiagramLegend/DiagramLegend.js +35 -0
- package/dist/diagrams/DiagramLegend/DiagramLegend.js.map +1 -0
- package/dist/diagrams/DiagramMinimap/DiagramMinimap.d.ts +77 -0
- package/dist/diagrams/DiagramMinimap/DiagramMinimap.js +106 -0
- package/dist/diagrams/DiagramMinimap/DiagramMinimap.js.map +1 -0
- package/dist/diagrams/DiagramToolbar/DiagramToolbar.d.ts +48 -0
- package/dist/diagrams/DiagramToolbar/DiagramToolbar.js +53 -0
- package/dist/diagrams/DiagramToolbar/DiagramToolbar.js.map +1 -0
- package/dist/diagrams/LifecycleFigure/LifecycleFigure.d.ts +31 -0
- package/dist/diagrams/LifecycleFigure/LifecycleFigure.js +234 -0
- package/dist/diagrams/LifecycleFigure/LifecycleFigure.js.map +1 -0
- package/dist/diagrams/SequenceFigure/SequenceFigure.d.ts +38 -0
- package/dist/diagrams/SequenceFigure/SequenceFigure.js +261 -0
- package/dist/diagrams/SequenceFigure/SequenceFigure.js.map +1 -0
- package/dist/diagrams/WorkflowFigure/WorkflowFigure.d.ts +36 -0
- package/dist/diagrams/WorkflowFigure/WorkflowFigure.js +259 -0
- package/dist/diagrams/WorkflowFigure/WorkflowFigure.js.map +1 -0
- package/dist/diagrams/index.d.ts +17 -0
- package/dist/diagrams/index.js +29 -0
- package/dist/diagrams/index.js.map +1 -0
- package/dist/diagrams/lib/dev.d.ts +61 -0
- package/dist/diagrams/lib/dev.js +96 -0
- package/dist/diagrams/lib/dev.js.map +1 -0
- package/dist/diagrams/lib/frame.d.ts +138 -0
- package/dist/diagrams/lib/frame.js +131 -0
- package/dist/diagrams/lib/frame.js.map +1 -0
- package/dist/diagrams/lib/geometry.d.ts +114 -0
- package/dist/diagrams/lib/geometry.js +113 -0
- package/dist/diagrams/lib/geometry.js.map +1 -0
- package/dist/diagrams/lib/legend.d.ts +32 -0
- package/dist/diagrams/lib/legend.js +84 -0
- package/dist/diagrams/lib/legend.js.map +1 -0
- package/dist/diagrams/lib/marks.d.ts +207 -0
- package/dist/diagrams/lib/marks.js +480 -0
- package/dist/diagrams/lib/marks.js.map +1 -0
- package/dist/diagrams/lib/route.d.ts +85 -0
- package/dist/diagrams/lib/route.js +178 -0
- package/dist/diagrams/lib/route.js.map +1 -0
- package/dist/diagrams/lib/wires.d.ts +59 -0
- package/dist/diagrams/lib/wires.js +90 -0
- package/dist/diagrams/lib/wires.js.map +1 -0
- package/dist/diagrams/spec.d.ts +405 -0
- package/dist/diagrams/spec.js +1 -0
- package/dist/diagrams/spec.js.map +1 -0
- package/dist/index.d.ts +16 -4
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -1
- package/dist/keyframes.css +57 -3
- package/dist/lib/overlay-container.d.ts +14 -4
- package/dist/lib/overlay-container.js.map +1 -1
- package/dist/lib/svg-export.d.ts +138 -0
- package/dist/lib/svg-export.js +198 -0
- package/dist/lib/svg-export.js.map +1 -0
- package/dist/lib/warn.d.ts +73 -0
- package/dist/lib/warn.js +38 -0
- package/dist/lib/warn.js.map +1 -0
- package/dist/semantic.css +51 -6
- package/dist/styles.css +1 -1
- package/dist/tokens.css +20 -2
- package/dist/tokens.d.ts +17 -1
- package/dist/tokens.js +121 -36
- package/dist/tokens.json +121 -36
- package/llms.txt +35 -0
- package/package.json +9 -2
- package/skills/misoto22-design/SKILL.md +21 -7
- package/skills/misoto22-design/evals/evals.json +84 -0
- package/skills/misoto22-design/rules/a11y.md +55 -3
- package/skills/misoto22-design/rules/forms.md +5 -0
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useId, useMemo } from "react";
|
|
4
|
+
import { cn } from "../../lib/cn.js";
|
|
5
|
+
import { liveEdges, useSpecIdentity, warnUnknownLane } from "../lib/dev.js";
|
|
6
|
+
import { DiagramFrame } from "../lib/frame.js";
|
|
7
|
+
import { inflate, round, TYPE, textWidth, union, wrapText } from "../lib/geometry.js";
|
|
8
|
+
import { resolveLegend, stateLegend } from "../lib/legend.js";
|
|
9
|
+
import { Chip, PLATE, plateHeight, StatePlate } from "../lib/marks.js";
|
|
10
|
+
import { renderWires, wiresFor } from "../lib/wires.js";
|
|
11
|
+
const KINDS = [
|
|
12
|
+
"start",
|
|
13
|
+
"active",
|
|
14
|
+
"waiting",
|
|
15
|
+
"decision",
|
|
16
|
+
"success",
|
|
17
|
+
"failure",
|
|
18
|
+
"neutral",
|
|
19
|
+
"external"
|
|
20
|
+
];
|
|
21
|
+
const GRID = { originX: 132, originY: 56, colW: 158, gapX: 62, laneGap: 52, stateH: 68 };
|
|
22
|
+
const SECONDARY_LANE_OFFSET = 2;
|
|
23
|
+
function textRoom(width, kind) {
|
|
24
|
+
return kind === "decision" ? width * 0.56 : width - PLATE.padX * 2;
|
|
25
|
+
}
|
|
26
|
+
function LifecycleFigure({
|
|
27
|
+
spec,
|
|
28
|
+
className,
|
|
29
|
+
legend = "auto",
|
|
30
|
+
cards = true,
|
|
31
|
+
heading = true,
|
|
32
|
+
activeIds,
|
|
33
|
+
onSelectNode
|
|
34
|
+
}) {
|
|
35
|
+
const uid = useId().replace(/:/g, "");
|
|
36
|
+
useSpecIdentity(spec, "LifecycleFigure");
|
|
37
|
+
const model = useMemo(
|
|
38
|
+
() => buildModel(spec, uid, activeIds, onSelectNode),
|
|
39
|
+
[spec, uid, activeIds, onSelectNode]
|
|
40
|
+
);
|
|
41
|
+
return /* @__PURE__ */ jsx(
|
|
42
|
+
DiagramFrame,
|
|
43
|
+
{
|
|
44
|
+
meta: spec.meta,
|
|
45
|
+
model,
|
|
46
|
+
cards: spec.cards,
|
|
47
|
+
showCards: cards,
|
|
48
|
+
heading,
|
|
49
|
+
legend,
|
|
50
|
+
className,
|
|
51
|
+
activeIds,
|
|
52
|
+
onSelectNode
|
|
53
|
+
}
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
function buildModel(spec, uid, activeIds, onSelectNode) {
|
|
57
|
+
const lanes = spec.lanes ?? [{ id: "", label: "" }];
|
|
58
|
+
const laneIndex = new Map(lanes.map((lane, index) => [lane.id, index]));
|
|
59
|
+
const laneOf = (state) => {
|
|
60
|
+
if (!state.lane) return { index: 0, known: true };
|
|
61
|
+
const index = laneIndex.get(state.lane);
|
|
62
|
+
if (index !== void 0) return { index, known: true };
|
|
63
|
+
warnUnknownLane("LifecycleFigure", state.id, state.lane);
|
|
64
|
+
return { index: 0, known: false };
|
|
65
|
+
};
|
|
66
|
+
const boxes = /* @__PURE__ */ new Map();
|
|
67
|
+
const placed = spec.states.map((state) => {
|
|
68
|
+
const w = state.width ?? (state.type === "decision" ? GRID.colW + 34 : GRID.colW);
|
|
69
|
+
const lines = wrapText(state.label, TYPE.label, textRoom(w, state.type), 2);
|
|
70
|
+
const h = plateHeight(lines.length, Boolean(state.sublabel), true, state.height ?? GRID.stateH);
|
|
71
|
+
const { index: lane, known } = laneOf(state);
|
|
72
|
+
const col = state.col + (lane === 0 ? 0 : SECONDARY_LANE_OFFSET);
|
|
73
|
+
const x = GRID.originX + col * (GRID.colW + GRID.gapX);
|
|
74
|
+
const y = GRID.originY + lane * (GRID.stateH + GRID.laneGap) + (state.yOffset ?? 0);
|
|
75
|
+
const box = { x, y, w, h };
|
|
76
|
+
boxes.set(state.id, box);
|
|
77
|
+
return { state, box, lane, known };
|
|
78
|
+
});
|
|
79
|
+
const rail = placed.filter((entry) => entry.lane === 0 && entry.known).sort((a, b) => a.state.col - b.state.col);
|
|
80
|
+
const declared = new Set((spec.transitions ?? []).map((t) => `${t.from}\u2192${t.to}`));
|
|
81
|
+
const implied = rail.slice(0, -1).map((entry, index) => ({ from: entry.state.id, to: rail[index + 1].state.id })).filter((edge) => !declared.has(`${edge.from}\u2192${edge.to}`));
|
|
82
|
+
const transitions = liveEdges("LifecycleFigure", spec.transitions, (id) => boxes.has(id));
|
|
83
|
+
const wires = [
|
|
84
|
+
...wiresFor(implied, boxes, () => ({ weight: 2.1 })),
|
|
85
|
+
...wiresFor(transitions, boxes)
|
|
86
|
+
];
|
|
87
|
+
const { paths, labels } = renderWires(wires, uid);
|
|
88
|
+
const extent = inflate(union([...boxes.values()]) ?? { x: 0, y: 0, w: 500, h: 240 }, 34);
|
|
89
|
+
const active = activeIds && activeIds.length > 0 ? new Set(activeIds) : null;
|
|
90
|
+
const laneRules = lanes.map((lane, index) => {
|
|
91
|
+
const inside = placed.filter((entry) => entry.lane === index).map((entry) => entry.box);
|
|
92
|
+
const span = union(inside);
|
|
93
|
+
return span ? { lane, y: span.y - 16, x1: extent.x + 18, x2: span.x + span.w } : null;
|
|
94
|
+
});
|
|
95
|
+
const artwork = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
96
|
+
laneRules.map(
|
|
97
|
+
(rule, index) => rule && rule.lane.label ? /* @__PURE__ */ jsxs("g", { "aria-hidden": "true", children: [
|
|
98
|
+
/* @__PURE__ */ jsx(
|
|
99
|
+
"path",
|
|
100
|
+
{
|
|
101
|
+
d: `M ${round(rule.x1)} ${round(rule.y)} H ${round(rule.x2)}`,
|
|
102
|
+
className: "stroke-(--diagram-rule) [stroke-width:1]"
|
|
103
|
+
}
|
|
104
|
+
),
|
|
105
|
+
/* @__PURE__ */ jsx(
|
|
106
|
+
"text",
|
|
107
|
+
{
|
|
108
|
+
x: round(rule.x1),
|
|
109
|
+
y: round(rule.y - 7),
|
|
110
|
+
className: "fill-(--diagram-ink-3) font-mono [font-size:10.5px] [letter-spacing:0.08em] uppercase",
|
|
111
|
+
children: rule.lane.label
|
|
112
|
+
}
|
|
113
|
+
)
|
|
114
|
+
] }, `lane-${index}`) : null
|
|
115
|
+
),
|
|
116
|
+
paths,
|
|
117
|
+
placed.map(({ state, box }) => {
|
|
118
|
+
const lines = wrapText(state.label, TYPE.label, textRoom(box.w, state.type), 2);
|
|
119
|
+
const bottomReserve = state.tag ? 20 : 0;
|
|
120
|
+
const blockHeight = lines.length * (TYPE.label * 1.25) + (state.sublabel ? TYPE.sub * 1.5 : 0);
|
|
121
|
+
const top = box.y + (box.h - bottomReserve - blockHeight) / 2;
|
|
122
|
+
const reversed = state.type === "start";
|
|
123
|
+
const centreX = box.x + box.w / 2;
|
|
124
|
+
return /* @__PURE__ */ jsx(
|
|
125
|
+
"g",
|
|
126
|
+
{
|
|
127
|
+
"data-node": state.id,
|
|
128
|
+
"data-active": active?.has(state.id) ? "" : void 0,
|
|
129
|
+
className: cn(
|
|
130
|
+
active && !active.has(state.id) && "opacity-25",
|
|
131
|
+
// The one figure that builds its own group instead of using
|
|
132
|
+
// NodePlate, and so the one figure whose selectable plates showed
|
|
133
|
+
// a text caret over a control.
|
|
134
|
+
onSelectNode && "cursor-pointer"
|
|
135
|
+
),
|
|
136
|
+
onClick: onSelectNode ? () => onSelectNode(state.id) : void 0,
|
|
137
|
+
children: /* @__PURE__ */ jsxs(StatePlate, { box, kind: state.type, children: [
|
|
138
|
+
active?.has(state.id) && /* @__PURE__ */ jsx(
|
|
139
|
+
"rect",
|
|
140
|
+
{
|
|
141
|
+
x: round(box.x) - 3,
|
|
142
|
+
y: round(box.y) - 3,
|
|
143
|
+
width: round(box.w) + 6,
|
|
144
|
+
height: round(box.h) + 6,
|
|
145
|
+
rx: 9,
|
|
146
|
+
fill: "none",
|
|
147
|
+
className: "stroke-(--accent) [stroke-width:1.4]"
|
|
148
|
+
}
|
|
149
|
+
),
|
|
150
|
+
state.step && /* @__PURE__ */ jsx(
|
|
151
|
+
"text",
|
|
152
|
+
{
|
|
153
|
+
x: round(box.x + 10),
|
|
154
|
+
y: round(box.y + 15),
|
|
155
|
+
className: reversed ? "fill-(--diagram-plate-ink) font-mono [font-size:9.5px] opacity-70" : "fill-(--diagram-ink-3) font-mono [font-size:9.5px]",
|
|
156
|
+
children: state.step
|
|
157
|
+
}
|
|
158
|
+
),
|
|
159
|
+
lines.map((line, index) => /* @__PURE__ */ jsx(
|
|
160
|
+
"text",
|
|
161
|
+
{
|
|
162
|
+
x: round(centreX),
|
|
163
|
+
y: round(top + (index + 1) * TYPE.label * 1.25 - 3.5),
|
|
164
|
+
textAnchor: "middle",
|
|
165
|
+
className: reversed ? "fill-(--diagram-plate-ink) font-sans [font-size:13px]" : "fill-(--diagram-ink) font-sans [font-size:13px]",
|
|
166
|
+
children: line
|
|
167
|
+
},
|
|
168
|
+
index
|
|
169
|
+
)),
|
|
170
|
+
state.sublabel && /* @__PURE__ */ jsx(
|
|
171
|
+
"text",
|
|
172
|
+
{
|
|
173
|
+
x: round(centreX),
|
|
174
|
+
y: round(top + lines.length * TYPE.label * 1.25 + TYPE.sub),
|
|
175
|
+
textAnchor: "middle",
|
|
176
|
+
className: reversed ? "fill-(--diagram-plate-ink) font-mono [font-size:10.5px] opacity-70" : "fill-(--diagram-ink-3) font-mono [font-size:10.5px]",
|
|
177
|
+
children: state.sublabel
|
|
178
|
+
}
|
|
179
|
+
),
|
|
180
|
+
state.tag && /* @__PURE__ */ jsx(Chip, { x: centreX, y: box.y + box.h - 9, text: state.tag, align: "middle" })
|
|
181
|
+
] })
|
|
182
|
+
},
|
|
183
|
+
state.id
|
|
184
|
+
);
|
|
185
|
+
}),
|
|
186
|
+
labels
|
|
187
|
+
] });
|
|
188
|
+
const used = [...new Set(spec.states.map((state) => state.type))];
|
|
189
|
+
const bands = spec.lanes && spec.lanes.length > 0 ? lanes.map((lane, index) => ({
|
|
190
|
+
kind: "Lane",
|
|
191
|
+
label: lane.label,
|
|
192
|
+
ids: placed.filter((entry) => entry.lane === index).sort((a, b) => a.state.col - b.state.col).map((entry) => entry.state.id)
|
|
193
|
+
})) : void 0;
|
|
194
|
+
const widest = Math.max(
|
|
195
|
+
0,
|
|
196
|
+
...lanes.map((lane) => textWidth(lane.label, TYPE.band))
|
|
197
|
+
);
|
|
198
|
+
const railLeft = Math.min(extent.x, GRID.originX - widest - 30);
|
|
199
|
+
return {
|
|
200
|
+
extent: { ...extent, x: railLeft, w: extent.w + (extent.x - railLeft) },
|
|
201
|
+
artwork,
|
|
202
|
+
nodes: spec.states.map((state) => ({
|
|
203
|
+
id: state.id,
|
|
204
|
+
label: state.label,
|
|
205
|
+
sublabel: state.sublabel,
|
|
206
|
+
kind: state.type,
|
|
207
|
+
// Printed in the plate's corner, inside artwork a screen reader is told
|
|
208
|
+
// to skip — and a step number is the reading order of the machine.
|
|
209
|
+
detail: state.step ? `step ${state.step}` : void 0
|
|
210
|
+
})),
|
|
211
|
+
// The implied rail is DRAWN, so it is published. Leaving it out gave the
|
|
212
|
+
// text equivalent the exceptions and none of the spine: a five-state
|
|
213
|
+
// machine reading as four disconnected states and one error path.
|
|
214
|
+
edges: [
|
|
215
|
+
...implied.map((edge) => ({ from: edge.from, to: edge.to })),
|
|
216
|
+
...transitions.map((transition) => ({
|
|
217
|
+
from: transition.from,
|
|
218
|
+
to: transition.to,
|
|
219
|
+
label: [transition.label, transition.note].filter(Boolean).join(" \u2014 ") || void 0
|
|
220
|
+
}))
|
|
221
|
+
],
|
|
222
|
+
bands,
|
|
223
|
+
legend: stateLegend(
|
|
224
|
+
resolveLegend(used, spec.meta.legend?.mode, KINDS, spec.meta.legend?.entries),
|
|
225
|
+
spec.meta.legend?.entries
|
|
226
|
+
)
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
var LifecycleFigure_default = LifecycleFigure;
|
|
230
|
+
export {
|
|
231
|
+
LifecycleFigure,
|
|
232
|
+
LifecycleFigure_default as default
|
|
233
|
+
};
|
|
234
|
+
//# sourceMappingURL=LifecycleFigure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/diagrams/LifecycleFigure/LifecycleFigure.tsx"],"sourcesContent":["'use client'\n\nimport { useId, useMemo } from 'react'\nimport { cn } from '../../lib/cn'\nimport { liveEdges, useSpecIdentity, warnUnknownLane } from '../lib/dev'\nimport { DiagramFrame, type FigureBand, type FigureChrome, type FigureModel } from '../lib/frame'\nimport { inflate, round, TYPE, textWidth, union, wrapText, type Box } from '../lib/geometry'\nimport { resolveLegend, stateLegend } from '../lib/legend'\nimport { Chip, PLATE, plateHeight, StatePlate } from '../lib/marks'\nimport { renderWires, wiresFor } from '../lib/wires'\nimport type { LifecycleSpec, LifecycleStateKind } from '../spec'\n\nconst KINDS: LifecycleStateKind[] = [\n 'start',\n 'active',\n 'waiting',\n 'decision',\n 'success',\n 'failure',\n 'neutral',\n 'external',\n]\n\nconst GRID = { originX: 132, originY: 56, colW: 158, gapX: 62, laneGap: 52, stateH: 68 }\n\n/**\n * How far a secondary lane's columns are shifted along the main rail.\n *\n * archify's lifecycle contract: the first lane holds the ordered phases in\n * columns 0–4, and a secondary lane's column N sits exactly beneath main column\n * N + 2. It is a convention rather than a derivation — the alternative would be\n * making every author restate a column index they already implied — and\n * honouring it is what keeps `executing → approval` a straight vertical drop\n * instead of a dogleg across two unrelated states.\n */\nconst SECONDARY_LANE_OFFSET = 2\n\n/** How much horizontal room a state's own shape leaves for its name. */\nfunction textRoom(width: number, kind: LifecycleStateKind): number {\n return kind === 'decision' ? width * 0.56 : width - PLATE.padX * 2\n}\n\nexport interface LifecycleFigureProps extends FigureChrome {\n spec: LifecycleSpec\n}\n\n/**\n * A state machine: what something can BE, and what moves it.\n *\n * The one figure here that spends colour, and it spends exactly the two tokens\n * this system reserves for state: `--success` on a terminal success,\n * `--danger` on a terminal failure. Nothing else in the package is allowed\n * those two, and a lifecycle diagram is the case they were reserved for — the\n * whole point of the picture is which end a run came out of.\n *\n * The other six kinds are carried by shape, so a greyscale print loses the two\n * outcomes' hue and keeps every other distinction: a start is a filled cap, a\n * decision is a diamond, a wait is a dashed frame, an external is a plate with\n * a cut corner.\n *\n * A RECOVERABLE FAILURE IS A FAILURE WITH A WAY BACK. `type: \"failure\"` says\n * how a state is drawn; a transition OUT of it is what says whether the run is\n * over. A retryable error and a terminal one look identical until you follow\n * the arrows, which is correct — the difference between them is a real edge in\n * the machine, not an adjective on a box.\n */\nexport function LifecycleFigure({\n spec,\n className,\n legend = 'auto',\n cards = true,\n heading = true,\n activeIds,\n onSelectNode,\n}: LifecycleFigureProps) {\n const uid = useId().replace(/:/g, '')\n useSpecIdentity(spec, 'LifecycleFigure')\n const model = useMemo(\n () => buildModel(spec, uid, activeIds, onSelectNode),\n [spec, uid, activeIds, onSelectNode],\n )\n\n return (\n <DiagramFrame\n meta={spec.meta}\n model={model}\n cards={spec.cards}\n showCards={cards}\n heading={heading}\n legend={legend}\n className={className}\n activeIds={activeIds}\n onSelectNode={onSelectNode}\n />\n )\n}\n\nfunction buildModel(\n spec: LifecycleSpec,\n uid: string,\n activeIds: string[] | undefined,\n onSelectNode: ((id: string) => void) | undefined,\n): FigureModel {\n const lanes = spec.lanes ?? [{ id: '', label: '' }]\n const laneIndex = new Map(lanes.map((lane, index) => [lane.id, index]))\n\n // A state that names no lane belongs to the first one — that is the documented\n // default. A state that names a lane NOTHING DECLARES is a different thing:\n // it also lands in the first lane, and the first lane is the main rail, so a\n // typo does not merely misplace a box, it enrols the state in the spine and\n // invents a transition the machine does not have. Hence the flag, and hence\n // being told.\n const laneOf = (state: { id: string; lane?: string }) => {\n if (!state.lane) return { index: 0, known: true }\n const index = laneIndex.get(state.lane)\n if (index !== undefined) return { index, known: true }\n warnUnknownLane('LifecycleFigure', state.id, state.lane)\n return { index: 0, known: false }\n }\n\n const boxes = new Map<string, Box>()\n const placed = spec.states.map((state) => {\n // A diamond is only half as wide as its box where the label crosses it, so\n // it gets a wider box for the same words. Sizing it like a rectangle is\n // what pushes a decision's name out past its own two sloping edges.\n const w = state.width ?? (state.type === 'decision' ? GRID.colW + 34 : GRID.colW)\n const lines = wrapText(state.label, TYPE.label, textRoom(w, state.type), 2)\n const h = plateHeight(lines.length, Boolean(state.sublabel), true, state.height ?? GRID.stateH)\n\n const { index: lane, known } = laneOf(state)\n const col = state.col + (lane === 0 ? 0 : SECONDARY_LANE_OFFSET)\n\n // `yOffset` is applied, the way `WorkflowFigure` and `DataflowFigure` apply\n // theirs. One field name meaning \"nudge this off its row\" in two figures\n // and \"nothing\" in a third is not a safety measure — it is a specification\n // that typechecks and draws something else, with nothing in the type to say\n // which of the two it will be. A nudge that puts two plates on top of each\n // other is visible; a nudge silently dropped is not.\n const x = GRID.originX + col * (GRID.colW + GRID.gapX)\n const y = GRID.originY + lane * (GRID.stateH + GRID.laneGap) + (state.yOffset ?? 0)\n\n const box: Box = { x, y, w, h }\n boxes.set(state.id, box)\n return { state, box, lane, known }\n })\n\n // The main rail is IMPLICIT, and has to be. archify's lifecycle contract\n // gives the first lane's columns 0..4 to the ordered phases and does not ask\n // an author to restate `queued → planning → executing` as transitions —\n // those are the diagram's spine, not its exceptions. Without them drawn, the\n // top row reads as five unconnected boxes.\n const rail = placed\n .filter((entry) => entry.lane === 0 && entry.known)\n .sort((a, b) => a.state.col - b.state.col)\n const declared = new Set((spec.transitions ?? []).map((t) => `${t.from}→${t.to}`))\n const implied = rail\n .slice(0, -1)\n .map((entry, index) => ({ from: entry.state.id, to: rail[index + 1]!.state.id }))\n .filter((edge) => !declared.has(`${edge.from}→${edge.to}`))\n\n const transitions = liveEdges('LifecycleFigure', spec.transitions, (id) => boxes.has(id))\n const wires = [\n ...wiresFor(implied, boxes, () => ({ weight: 2.1 })),\n ...wiresFor(transitions, boxes),\n ]\n const { paths, labels } = renderWires(wires, uid)\n\n const extent = inflate(union([...boxes.values()]) ?? { x: 0, y: 0, w: 500, h: 240 }, 34)\n const active = activeIds && activeIds.length > 0 ? new Set(activeIds) : null\n\n // A lane's rule spans what it actually holds. Drawing it across the figure's\n // full width would claim a band reaches columns nothing in it occupies.\n const laneRules = lanes.map((lane, index) => {\n const inside = placed.filter((entry) => entry.lane === index).map((entry) => entry.box)\n const span = union(inside)\n return span ? { lane, y: span.y - 16, x1: extent.x + 18, x2: span.x + span.w } : null\n })\n\n const artwork = (\n <>\n {laneRules.map((rule, index) =>\n rule && rule.lane.label ? (\n <g key={`lane-${index}`} aria-hidden=\"true\">\n <path\n d={`M ${round(rule.x1)} ${round(rule.y)} H ${round(rule.x2)}`}\n className=\"stroke-(--diagram-rule) [stroke-width:1]\"\n />\n <text\n x={round(rule.x1)}\n y={round(rule.y - 7)}\n className=\"fill-(--diagram-ink-3) font-mono [font-size:10.5px] [letter-spacing:0.08em] uppercase\"\n >\n {rule.lane.label}\n </text>\n </g>\n ) : null,\n )}\n\n {paths}\n\n {placed.map(({ state, box }) => {\n const lines = wrapText(state.label, TYPE.label, textRoom(box.w, state.type), 2)\n const bottomReserve = state.tag ? 20 : 0\n const blockHeight = lines.length * (TYPE.label * 1.25) + (state.sublabel ? TYPE.sub * 1.5 : 0)\n const top = box.y + (box.h - bottomReserve - blockHeight) / 2\n const reversed = state.type === 'start'\n const centreX = box.x + box.w / 2\n\n return (\n <g\n key={state.id}\n data-node={state.id}\n data-active={active?.has(state.id) ? '' : undefined}\n className={cn(\n active && !active.has(state.id) && 'opacity-25',\n // The one figure that builds its own group instead of using\n // NodePlate, and so the one figure whose selectable plates showed\n // a text caret over a control.\n onSelectNode && 'cursor-pointer',\n )}\n onClick={onSelectNode ? () => onSelectNode(state.id) : undefined}\n >\n <StatePlate box={box} kind={state.type}>\n {active?.has(state.id) && (\n <rect\n x={round(box.x) - 3}\n y={round(box.y) - 3}\n width={round(box.w) + 6}\n height={round(box.h) + 6}\n rx={9}\n fill=\"none\"\n className=\"stroke-(--accent) [stroke-width:1.4]\"\n />\n )}\n {state.step && (\n <text\n x={round(box.x + 10)}\n y={round(box.y + 15)}\n className={\n reversed\n ? 'fill-(--diagram-plate-ink) font-mono [font-size:9.5px] opacity-70'\n : 'fill-(--diagram-ink-3) font-mono [font-size:9.5px]'\n }\n >\n {state.step}\n </text>\n )}\n {lines.map((line, index) => (\n <text\n key={index}\n x={round(centreX)}\n y={round(top + (index + 1) * TYPE.label * 1.25 - 3.5)}\n textAnchor=\"middle\"\n className={\n reversed\n ? 'fill-(--diagram-plate-ink) font-sans [font-size:13px]'\n : 'fill-(--diagram-ink) font-sans [font-size:13px]'\n }\n >\n {line}\n </text>\n ))}\n {state.sublabel && (\n <text\n x={round(centreX)}\n y={round(top + lines.length * TYPE.label * 1.25 + TYPE.sub)}\n textAnchor=\"middle\"\n className={\n reversed\n ? 'fill-(--diagram-plate-ink) font-mono [font-size:10.5px] opacity-70'\n : 'fill-(--diagram-ink-3) font-mono [font-size:10.5px]'\n }\n >\n {state.sublabel}\n </text>\n )}\n {state.tag && <Chip x={centreX} y={box.y + box.h - 9} text={state.tag} align=\"middle\" />}\n </StatePlate>\n </g>\n )\n })}\n\n {labels}\n\n </>\n )\n\n const used = [...new Set(spec.states.map((state) => state.type))]\n\n // Lanes group the list only when the specification actually has them: the\n // single unnamed lane a laneless spec falls back to would publish a band\n // called nothing, around every state in the figure.\n const bands: FigureBand[] | undefined =\n spec.lanes && spec.lanes.length > 0\n ? lanes.map((lane, index) => ({\n kind: 'Lane',\n label: lane.label,\n ids: placed\n .filter((entry) => entry.lane === index)\n .sort((a, b) => a.state.col - b.state.col)\n .map((entry) => entry.state.id),\n }))\n : undefined\n const widest = Math.max(\n 0,\n ...lanes.map((lane) => textWidth(lane.label, TYPE.band)),\n )\n\n // Widening the frame to the LEFT for the lane names has to widen it, not\n // slide it: moving `x` without adding the same amount to `w` trims exactly\n // that much off the right-hand edge, which cost the last column of states.\n const railLeft = Math.min(extent.x, GRID.originX - widest - 30)\n\n return {\n extent: { ...extent, x: railLeft, w: extent.w + (extent.x - railLeft) },\n artwork,\n nodes: spec.states.map((state) => ({\n id: state.id,\n label: state.label,\n sublabel: state.sublabel,\n kind: state.type,\n // Printed in the plate's corner, inside artwork a screen reader is told\n // to skip — and a step number is the reading order of the machine.\n detail: state.step ? `step ${state.step}` : undefined,\n })),\n // The implied rail is DRAWN, so it is published. Leaving it out gave the\n // text equivalent the exceptions and none of the spine: a five-state\n // machine reading as four disconnected states and one error path.\n edges: [\n ...implied.map((edge) => ({ from: edge.from, to: edge.to })),\n ...transitions.map((transition) => ({\n from: transition.from,\n to: transition.to,\n label: [transition.label, transition.note].filter(Boolean).join(' — ') || undefined,\n })),\n ],\n bands,\n legend: stateLegend(\n resolveLegend(used, spec.meta.legend?.mode, KINDS, spec.meta.legend?.entries),\n spec.meta.legend?.entries,\n ),\n }\n}\n\nexport default LifecycleFigure\n"],"mappings":";AAmFI,SAgGA,UAhGA,KAmGM,YAnGN;AAjFJ,SAAS,OAAO,eAAe;AAC/B,SAAS,UAAU;AACnB,SAAS,WAAW,iBAAiB,uBAAuB;AAC5D,SAAS,oBAA0E;AACnF,SAAS,SAAS,OAAO,MAAM,WAAW,OAAO,gBAA0B;AAC3E,SAAS,eAAe,mBAAmB;AAC3C,SAAS,MAAM,OAAO,aAAa,kBAAkB;AACrD,SAAS,aAAa,gBAAgB;AAGtC,MAAM,QAA8B;AAAA,EAClC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA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AM,IAAI,CAAC,SAAS,UAAU,KAAK,OAAO,KAAK,IAAI,CAAC;AAAA,EACzD;AAKA,QAAM,WAAW,KAAK,IAAI,OAAO,GAAG,KAAK,UAAU,SAAS,EAAE;AAE9D,SAAO;AAAA,IACL,QAAQ,EAAE,GAAG,QAAQ,GAAG,UAAU,GAAG,OAAO,KAAK,OAAO,IAAI,UAAU;AAAA,IACtE;AAAA,IACA,OAAO,KAAK,OAAO,IAAI,CAAC,WAAW;AAAA,MACjC,IAAI,MAAM;AAAA,MACV,OAAO,MAAM;AAAA,MACb,UAAU,MAAM;AAAA,MAChB,MAAM,MAAM;AAAA;AAAA;AAAA,MAGZ,QAAQ,MAAM,OAAO,QAAQ,MAAM,IAAI,KAAK;AAAA,IAC9C,EAAE;AAAA;AAAA;AAAA;AAAA,IAIF,OAAO;AAAA,MACL,GAAG,QAAQ,IAAI,CAAC,UAAU,EAAE,MAAM,KAAK,MAAM,IAAI,KAAK,GAAG,EAAE;AAAA,MAC3D,GAAG,YAAY,IAAI,CAAC,gBAAgB;AAAA,QAClC,MAAM,WAAW;AAAA,QACjB,IAAI,WAAW;AAAA,QACf,OAAO,CAAC,WAAW,OAAO,WAAW,IAAI,EAAE,OAAO,OAAO,EAAE,KAAK,UAAK,KAAK;AAAA,MAC5E,EAAE;AAAA,IACJ;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,MACN,cAAc,MAAM,KAAK,KAAK,QAAQ,MAAM,OAAO,KAAK,KAAK,QAAQ,OAAO;AAAA,MAC5E,KAAK,KAAK,QAAQ;AAAA,IACpB;AAAA,EACF;AACF;AAEA,IAAO,0BAAQ;","names":[]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { FigureChrome } from '../lib/frame.js';
|
|
3
|
+
import { SequenceSpec } from '../spec.js';
|
|
4
|
+
import '../lib/geometry.js';
|
|
5
|
+
|
|
6
|
+
interface SequenceFigureProps extends FigureChrome {
|
|
7
|
+
spec: SequenceSpec;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* A call chain over time: who asks whom, in what order, and what comes back.
|
|
11
|
+
*
|
|
12
|
+
* The one diagram type here whose vertical axis MEANS something. Every other
|
|
13
|
+
* figure's y is layout; a sequence's y is time, which is why a message carries
|
|
14
|
+
* an explicit `y` rather than an index — two calls 8 units apart happened
|
|
15
|
+
* together, and two 200 apart did not, and an evenly spaced list of messages
|
|
16
|
+
* would erase that distinction while looking tidier.
|
|
17
|
+
*
|
|
18
|
+
* **Lifelines** are hairlines, not solid rules, because they are the axis
|
|
19
|
+
* rather than the content. A lifeline drawn at the weight of a message is a
|
|
20
|
+
* diagram where seven vertical lines compete with twelve horizontal ones.
|
|
21
|
+
*
|
|
22
|
+
* **Activation bars** say who is BUSY, which is the fact a sequence diagram
|
|
23
|
+
* carries that a list of calls does not — the third participant's bar
|
|
24
|
+
* overlapping the second's is the reason to draw them at all.
|
|
25
|
+
*
|
|
26
|
+
* **Segments** band the axis into phases — request, fallback, response —
|
|
27
|
+
* printed as a rule with a mono caption rather than as a tinted panel, for the
|
|
28
|
+
* same reason architecture boundaries are: a second ground inside the figure
|
|
29
|
+
* would sit under every message label's mask.
|
|
30
|
+
*
|
|
31
|
+
* A `return` message is dashed AND takes an open arrowhead. Two signals rather
|
|
32
|
+
* than one, because the reply is the thing a reader most often needs to pick
|
|
33
|
+
* out of a dense trace, and a dash alone is doing the same work as `dashed`
|
|
34
|
+
* already does for an asynchronous call.
|
|
35
|
+
*/
|
|
36
|
+
declare function SequenceFigure({ spec, className, legend, cards, heading, activeIds, onSelectNode, }: SequenceFigureProps): react.JSX.Element;
|
|
37
|
+
|
|
38
|
+
export { SequenceFigure, type SequenceFigureProps, SequenceFigure as default };
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useId, useMemo } from "react";
|
|
4
|
+
import { liveEdges, useSpecIdentity, warnUnknownRef } from "../lib/dev.js";
|
|
5
|
+
import { DiagramFrame } from "../lib/frame.js";
|
|
6
|
+
import { round, textWidth, TYPE } from "../lib/geometry.js";
|
|
7
|
+
import { resolveLegend, variantLegend } from "../lib/legend.js";
|
|
8
|
+
import { EdgeLabel, NodePlate } from "../lib/marks.js";
|
|
9
|
+
const HEAD = { y: 44, h: 62, w: 148, gap: 40 };
|
|
10
|
+
const VARIANTS = ["default", "emphasis", "security", "dashed", "return"];
|
|
11
|
+
function SequenceFigure({
|
|
12
|
+
spec,
|
|
13
|
+
className,
|
|
14
|
+
legend = "auto",
|
|
15
|
+
cards = true,
|
|
16
|
+
heading = true,
|
|
17
|
+
activeIds,
|
|
18
|
+
onSelectNode
|
|
19
|
+
}) {
|
|
20
|
+
const uid = useId().replace(/:/g, "");
|
|
21
|
+
useSpecIdentity(spec, "SequenceFigure");
|
|
22
|
+
const model = useMemo(
|
|
23
|
+
() => buildModel(spec, uid, activeIds, onSelectNode),
|
|
24
|
+
[spec, uid, activeIds, onSelectNode]
|
|
25
|
+
);
|
|
26
|
+
return /* @__PURE__ */ jsx(
|
|
27
|
+
DiagramFrame,
|
|
28
|
+
{
|
|
29
|
+
meta: spec.meta,
|
|
30
|
+
model,
|
|
31
|
+
cards: spec.cards,
|
|
32
|
+
showCards: cards,
|
|
33
|
+
heading,
|
|
34
|
+
legend,
|
|
35
|
+
className,
|
|
36
|
+
activeIds,
|
|
37
|
+
onSelectNode
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
function buildModel(spec, _uid, activeIds, onSelectNode) {
|
|
42
|
+
const natural = Math.max(
|
|
43
|
+
HEAD.w,
|
|
44
|
+
...spec.participants.map(
|
|
45
|
+
(participant) => Math.max(
|
|
46
|
+
textWidth(participant.label, TYPE.label),
|
|
47
|
+
textWidth(participant.sublabel ?? "", TYPE.sub)
|
|
48
|
+
) + 44
|
|
49
|
+
)
|
|
50
|
+
);
|
|
51
|
+
const colW = spec.meta.column_fit === "spread" ? natural : HEAD.w;
|
|
52
|
+
const pitch = colW + HEAD.gap;
|
|
53
|
+
const centre = /* @__PURE__ */ new Map();
|
|
54
|
+
const heads = spec.participants.map((participant, index) => {
|
|
55
|
+
const x = 40 + index * pitch;
|
|
56
|
+
centre.set(participant.id, x + colW / 2);
|
|
57
|
+
return { participant, box: { x, y: HEAD.y, w: colW, h: HEAD.h } };
|
|
58
|
+
});
|
|
59
|
+
const messages = liveEdges("SequenceFigure", spec.messages, (id) => centre.has(id));
|
|
60
|
+
const lastY = Math.max(
|
|
61
|
+
HEAD.y + HEAD.h + 80,
|
|
62
|
+
...messages.map((message) => message.y),
|
|
63
|
+
...(spec.activations ?? []).map((activation) => activation.to),
|
|
64
|
+
...(spec.segments ?? []).map((segment) => segment.to)
|
|
65
|
+
);
|
|
66
|
+
const lifelineBottom = lastY + 42;
|
|
67
|
+
const active = activeIds && activeIds.length > 0 ? new Set(activeIds) : null;
|
|
68
|
+
const width = 40 + spec.participants.length * pitch - HEAD.gap + 40;
|
|
69
|
+
const artwork = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
70
|
+
(spec.segments ?? []).map((segment, index) => /* @__PURE__ */ jsxs("g", { "aria-hidden": "true", children: [
|
|
71
|
+
/* @__PURE__ */ jsx(
|
|
72
|
+
"path",
|
|
73
|
+
{
|
|
74
|
+
d: `M 20 ${round(segment.from)} H ${round(width - 20)}`,
|
|
75
|
+
className: "stroke-(--diagram-rule) [stroke-width:1] [stroke-dasharray:2_4]"
|
|
76
|
+
}
|
|
77
|
+
),
|
|
78
|
+
/* @__PURE__ */ jsx(
|
|
79
|
+
"rect",
|
|
80
|
+
{
|
|
81
|
+
x: 20,
|
|
82
|
+
y: round(segment.from - 7),
|
|
83
|
+
width: round(textWidth(segment.label, TYPE.band) + 14),
|
|
84
|
+
height: 14,
|
|
85
|
+
className: "fill-(--diagram-surface)"
|
|
86
|
+
}
|
|
87
|
+
),
|
|
88
|
+
/* @__PURE__ */ jsx(
|
|
89
|
+
"text",
|
|
90
|
+
{
|
|
91
|
+
x: 27,
|
|
92
|
+
y: round(segment.from + 3.5),
|
|
93
|
+
className: "fill-(--diagram-ink-3) font-mono [font-size:10.5px] [letter-spacing:0.08em] uppercase",
|
|
94
|
+
children: segment.label
|
|
95
|
+
}
|
|
96
|
+
)
|
|
97
|
+
] }, `segment-${index}`)),
|
|
98
|
+
heads.map(({ participant, box }) => /* @__PURE__ */ jsx(
|
|
99
|
+
"path",
|
|
100
|
+
{
|
|
101
|
+
d: `M ${round(box.x + colW / 2)} ${round(box.y + box.h)} V ${round(lifelineBottom)}`,
|
|
102
|
+
className: "stroke-(--diagram-rule) [stroke-width:1]",
|
|
103
|
+
"aria-hidden": "true"
|
|
104
|
+
},
|
|
105
|
+
`life-${participant.id}`
|
|
106
|
+
)),
|
|
107
|
+
(spec.activations ?? []).map((activation, index) => {
|
|
108
|
+
const x = centre.get(activation.participant);
|
|
109
|
+
if (x === void 0) return null;
|
|
110
|
+
return /* @__PURE__ */ jsx(
|
|
111
|
+
"rect",
|
|
112
|
+
{
|
|
113
|
+
x: round(x - 5),
|
|
114
|
+
y: round(activation.from),
|
|
115
|
+
width: 10,
|
|
116
|
+
height: round(Math.max(6, activation.to - activation.from)),
|
|
117
|
+
rx: 2,
|
|
118
|
+
className: "fill-(--diagram-node-2) stroke-(--diagram-rule)",
|
|
119
|
+
strokeWidth: 1,
|
|
120
|
+
"aria-hidden": "true"
|
|
121
|
+
},
|
|
122
|
+
`act-${index}`
|
|
123
|
+
);
|
|
124
|
+
}),
|
|
125
|
+
messages.map((message, index) => {
|
|
126
|
+
const from = centre.get(message.from);
|
|
127
|
+
const to = centre.get(message.to);
|
|
128
|
+
if (from === void 0 || to === void 0) return null;
|
|
129
|
+
const forward = to >= from;
|
|
130
|
+
const inset = 6;
|
|
131
|
+
const x1 = forward ? from + inset : from - inset;
|
|
132
|
+
const x2 = forward ? to - inset : to + inset;
|
|
133
|
+
return /* @__PURE__ */ jsx(
|
|
134
|
+
"path",
|
|
135
|
+
{
|
|
136
|
+
d: `M ${round(x1)} ${round(message.y)} H ${round(x2)}`,
|
|
137
|
+
fill: "none",
|
|
138
|
+
"data-edge": message.id,
|
|
139
|
+
markerEnd: `url(#${_uid}-${messageMarker(message.variant)})`,
|
|
140
|
+
className: messageClasses(message.variant),
|
|
141
|
+
...messageStroke(message.variant)
|
|
142
|
+
},
|
|
143
|
+
message.id ?? `msg-${index}`
|
|
144
|
+
);
|
|
145
|
+
}),
|
|
146
|
+
heads.map(({ participant, box }) => /* @__PURE__ */ jsx(
|
|
147
|
+
NodePlate,
|
|
148
|
+
{
|
|
149
|
+
nodeId: participant.id,
|
|
150
|
+
box,
|
|
151
|
+
label: participant.label,
|
|
152
|
+
sublabel: participant.sublabel,
|
|
153
|
+
kind: participant.type,
|
|
154
|
+
active: active?.has(participant.id),
|
|
155
|
+
dimmed: active ? !active.has(participant.id) : false,
|
|
156
|
+
onSelect: onSelectNode ? () => onSelectNode(participant.id) : void 0
|
|
157
|
+
},
|
|
158
|
+
participant.id
|
|
159
|
+
)),
|
|
160
|
+
messages.map((message, index) => {
|
|
161
|
+
const from = centre.get(message.from);
|
|
162
|
+
const to = centre.get(message.to);
|
|
163
|
+
if (from === void 0 || to === void 0 || !message.label) return null;
|
|
164
|
+
return /* @__PURE__ */ jsx(
|
|
165
|
+
EdgeLabel,
|
|
166
|
+
{
|
|
167
|
+
x: (from + to) / 2,
|
|
168
|
+
y: message.y,
|
|
169
|
+
axis: "x",
|
|
170
|
+
text: message.label
|
|
171
|
+
},
|
|
172
|
+
`label-${message.id ?? index}`
|
|
173
|
+
);
|
|
174
|
+
})
|
|
175
|
+
] });
|
|
176
|
+
const used = [
|
|
177
|
+
...new Set(messages.map((message) => message.variant ?? "default"))
|
|
178
|
+
];
|
|
179
|
+
const across = (from, to) => messages.filter((message) => message.y >= from && message.y <= to && message.label).map((message) => message.label);
|
|
180
|
+
const named = new Map(spec.participants.map((p) => [p.id, p.label]));
|
|
181
|
+
return {
|
|
182
|
+
extent: { x: 0, y: 0, w: width, h: lifelineBottom + 24 },
|
|
183
|
+
artwork,
|
|
184
|
+
nodes: spec.participants.map((participant) => ({
|
|
185
|
+
id: participant.id,
|
|
186
|
+
label: participant.label,
|
|
187
|
+
sublabel: participant.sublabel,
|
|
188
|
+
kind: participant.type
|
|
189
|
+
})),
|
|
190
|
+
edges: messages.map((message) => ({
|
|
191
|
+
from: message.from,
|
|
192
|
+
to: message.to,
|
|
193
|
+
label: message.label
|
|
194
|
+
})),
|
|
195
|
+
// Segments band the TIME axis and activations sit on a lifeline, so neither
|
|
196
|
+
// groups the participants; both are statements the picture makes and the
|
|
197
|
+
// list did not carry at all.
|
|
198
|
+
notes: [
|
|
199
|
+
...(spec.segments ?? []).map((segment) => {
|
|
200
|
+
const held = across(segment.from, segment.to);
|
|
201
|
+
return held.length > 0 ? `Phase ${segment.label} covers ${held.join(", ")}.` : `Phase ${segment.label} covers no message this figure labels.`;
|
|
202
|
+
}),
|
|
203
|
+
...(spec.activations ?? []).flatMap((activation) => {
|
|
204
|
+
const who = named.get(activation.participant);
|
|
205
|
+
if (who === void 0) {
|
|
206
|
+
warnUnknownRef(
|
|
207
|
+
"SequenceFigure",
|
|
208
|
+
"activations[].participant",
|
|
209
|
+
activation.participant,
|
|
210
|
+
"the bar is drawn on no lifeline at all"
|
|
211
|
+
);
|
|
212
|
+
return [];
|
|
213
|
+
}
|
|
214
|
+
const held = across(activation.from, activation.to);
|
|
215
|
+
if (held.length > 1) return [`${who} is busy from ${held[0]} to ${held.at(-1)}.`];
|
|
216
|
+
if (held.length === 1) return [`${who} is busy during ${held[0]}.`];
|
|
217
|
+
return [`${who} is busy for a span none of the messages name.`];
|
|
218
|
+
})
|
|
219
|
+
],
|
|
220
|
+
legend: variantLegend(
|
|
221
|
+
resolveLegend(used, spec.meta.legend?.mode, VARIANTS, spec.meta.legend?.entries),
|
|
222
|
+
spec.meta.legend?.entries
|
|
223
|
+
)
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
function messageMarker(variant) {
|
|
227
|
+
if (variant === "emphasis") return "arrow-strong";
|
|
228
|
+
if (variant === "return") return "arrow-open";
|
|
229
|
+
return "arrow";
|
|
230
|
+
}
|
|
231
|
+
function messageClasses(variant) {
|
|
232
|
+
switch (variant) {
|
|
233
|
+
case "emphasis":
|
|
234
|
+
return "stroke-(--diagram-line-strong)";
|
|
235
|
+
case "return":
|
|
236
|
+
case "dashed":
|
|
237
|
+
return "stroke-(--diagram-line-soft)";
|
|
238
|
+
default:
|
|
239
|
+
return "stroke-(--diagram-line)";
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
function messageStroke(variant) {
|
|
243
|
+
switch (variant) {
|
|
244
|
+
case "emphasis":
|
|
245
|
+
return { strokeWidth: 2 };
|
|
246
|
+
case "security":
|
|
247
|
+
return { strokeWidth: 1.4, strokeDasharray: "6 3" };
|
|
248
|
+
case "return":
|
|
249
|
+
return { strokeWidth: 1.2, strokeDasharray: "4 3.5" };
|
|
250
|
+
case "dashed":
|
|
251
|
+
return { strokeWidth: 1.2, strokeDasharray: "3 3" };
|
|
252
|
+
default:
|
|
253
|
+
return { strokeWidth: 1.4 };
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
var SequenceFigure_default = SequenceFigure;
|
|
257
|
+
export {
|
|
258
|
+
SequenceFigure,
|
|
259
|
+
SequenceFigure_default as default
|
|
260
|
+
};
|
|
261
|
+
//# sourceMappingURL=SequenceFigure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/diagrams/SequenceFigure/SequenceFigure.tsx"],"sourcesContent":["'use client'\n\nimport { useId, useMemo } from 'react'\nimport { liveEdges, useSpecIdentity, warnUnknownRef } from '../lib/dev'\nimport { DiagramFrame, type FigureChrome, type FigureModel } from '../lib/frame'\nimport { round, textWidth, TYPE, type Box } from '../lib/geometry'\nimport { resolveLegend, variantLegend } from '../lib/legend'\nimport { EdgeLabel, NodePlate } from '../lib/marks'\nimport type { SequenceSpec, Variant } from '../spec'\n\nconst HEAD = { y: 44, h: 62, w: 148, gap: 40 }\nconst VARIANTS: (Variant | 'return')[] = ['default', 'emphasis', 'security', 'dashed', 'return']\n\nexport interface SequenceFigureProps extends FigureChrome {\n spec: SequenceSpec\n}\n\n/**\n * A call chain over time: who asks whom, in what order, and what comes back.\n *\n * The one diagram type here whose vertical axis MEANS something. Every other\n * figure's y is layout; a sequence's y is time, which is why a message carries\n * an explicit `y` rather than an index — two calls 8 units apart happened\n * together, and two 200 apart did not, and an evenly spaced list of messages\n * would erase that distinction while looking tidier.\n *\n * **Lifelines** are hairlines, not solid rules, because they are the axis\n * rather than the content. A lifeline drawn at the weight of a message is a\n * diagram where seven vertical lines compete with twelve horizontal ones.\n *\n * **Activation bars** say who is BUSY, which is the fact a sequence diagram\n * carries that a list of calls does not — the third participant's bar\n * overlapping the second's is the reason to draw them at all.\n *\n * **Segments** band the axis into phases — request, fallback, response —\n * printed as a rule with a mono caption rather than as a tinted panel, for the\n * same reason architecture boundaries are: a second ground inside the figure\n * would sit under every message label's mask.\n *\n * A `return` message is dashed AND takes an open arrowhead. Two signals rather\n * than one, because the reply is the thing a reader most often needs to pick\n * out of a dense trace, and a dash alone is doing the same work as `dashed`\n * already does for an asynchronous call.\n */\nexport function SequenceFigure({\n spec,\n className,\n legend = 'auto',\n cards = true,\n heading = true,\n activeIds,\n onSelectNode,\n}: SequenceFigureProps) {\n const uid = useId().replace(/:/g, '')\n useSpecIdentity(spec, 'SequenceFigure')\n const model = useMemo(\n () => buildModel(spec, uid, activeIds, onSelectNode),\n [spec, uid, activeIds, onSelectNode],\n )\n\n return (\n <DiagramFrame\n meta={spec.meta}\n model={model}\n cards={spec.cards}\n showCards={cards}\n heading={heading}\n legend={legend}\n className={className}\n activeIds={activeIds}\n onSelectNode={onSelectNode}\n />\n )\n}\n\nfunction buildModel(\n spec: SequenceSpec,\n _uid: string,\n activeIds: string[] | undefined,\n onSelectNode: ((id: string) => void) | undefined,\n): FigureModel {\n // A participant's box has to hold its own name. `spread` lets the widest\n // label set the pitch for every column, which is the layout archify reaches\n // for when a fixed 86-unit column would clip a meaningful name — and\n // shortening the name instead is not a repair, it is a different diagram.\n const natural = Math.max(\n HEAD.w,\n ...spec.participants.map(\n (participant) =>\n Math.max(\n textWidth(participant.label, TYPE.label),\n textWidth(participant.sublabel ?? '', TYPE.sub),\n ) + 44,\n ),\n )\n const colW = spec.meta.column_fit === 'spread' ? natural : HEAD.w\n const pitch = colW + HEAD.gap\n\n const centre = new Map<string, number>()\n const heads = spec.participants.map((participant, index) => {\n const x = 40 + index * pitch\n centre.set(participant.id, x + colW / 2)\n return { participant, box: { x, y: HEAD.y, w: colW, h: HEAD.h } as Box }\n })\n\n // A message to a participant nothing declares has no column to be drawn\n // between, so the artwork returned null for it and the summary list went on\n // reporting a call to a raw id — the picture and its text equivalent\n // disagreeing about what the exchange contains. Both halves read this.\n const messages = liveEdges('SequenceFigure', spec.messages, (id) => centre.has(id))\n\n const lastY = Math.max(\n HEAD.y + HEAD.h + 80,\n ...messages.map((message) => message.y),\n ...(spec.activations ?? []).map((activation) => activation.to),\n ...(spec.segments ?? []).map((segment) => segment.to),\n )\n const lifelineBottom = lastY + 42\n\n const active = activeIds && activeIds.length > 0 ? new Set(activeIds) : null\n const width = 40 + spec.participants.length * pitch - HEAD.gap + 40\n\n const artwork = (\n <>\n {/* Segments first: they are the ground the whole exchange happens on. */}\n {(spec.segments ?? []).map((segment, index) => (\n <g key={`segment-${index}`} aria-hidden=\"true\">\n <path\n d={`M 20 ${round(segment.from)} H ${round(width - 20)}`}\n className=\"stroke-(--diagram-rule) [stroke-width:1] [stroke-dasharray:2_4]\"\n />\n <rect\n x={20}\n y={round(segment.from - 7)}\n width={round(textWidth(segment.label, TYPE.band) + 14)}\n height={14}\n className=\"fill-(--diagram-surface)\"\n />\n <text\n x={27}\n y={round(segment.from + 3.5)}\n className=\"fill-(--diagram-ink-3) font-mono [font-size:10.5px] [letter-spacing:0.08em] uppercase\"\n >\n {segment.label}\n </text>\n </g>\n ))}\n\n {/* Lifelines. */}\n {heads.map(({ participant, box }) => (\n <path\n key={`life-${participant.id}`}\n d={`M ${round(box.x + colW / 2)} ${round(box.y + box.h)} V ${round(lifelineBottom)}`}\n className=\"stroke-(--diagram-rule) [stroke-width:1]\"\n aria-hidden=\"true\"\n />\n ))}\n\n {/* Activation bars. */}\n {(spec.activations ?? []).map((activation, index) => {\n const x = centre.get(activation.participant)\n if (x === undefined) return null\n\n return (\n <rect\n key={`act-${index}`}\n x={round(x - 5)}\n y={round(activation.from)}\n width={10}\n height={round(Math.max(6, activation.to - activation.from))}\n rx={2}\n className=\"fill-(--diagram-node-2) stroke-(--diagram-rule)\"\n strokeWidth={1}\n aria-hidden=\"true\"\n />\n )\n })}\n\n {/* Messages. */}\n {messages.map((message, index) => {\n const from = centre.get(message.from)\n const to = centre.get(message.to)\n if (from === undefined || to === undefined) return null\n const forward = to >= from\n const inset = 6\n const x1 = forward ? from + inset : from - inset\n const x2 = forward ? to - inset : to + inset\n return (\n <path\n key={message.id ?? `msg-${index}`}\n d={`M ${round(x1)} ${round(message.y)} H ${round(x2)}`}\n fill=\"none\"\n data-edge={message.id}\n markerEnd={`url(#${_uid}-${messageMarker(message.variant)})`}\n className={messageClasses(message.variant)}\n {...messageStroke(message.variant)}\n />\n )\n })}\n\n {/* Participants, over the lines that end at them. */}\n {heads.map(({ participant, box }) => (\n <NodePlate\n key={participant.id}\n nodeId={participant.id}\n box={box}\n label={participant.label}\n sublabel={participant.sublabel}\n kind={participant.type}\n active={active?.has(participant.id)}\n dimmed={active ? !active.has(participant.id) : false}\n onSelect={onSelectNode ? () => onSelectNode(participant.id) : undefined}\n />\n ))}\n\n {/* Message wording last, so its mask covers every line. */}\n {messages.map((message, index) => {\n const from = centre.get(message.from)\n const to = centre.get(message.to)\n if (from === undefined || to === undefined || !message.label) return null\n return (\n <EdgeLabel\n key={`label-${message.id ?? index}`}\n x={(from + to) / 2}\n y={message.y}\n axis=\"x\"\n text={message.label}\n />\n )\n })}\n </>\n )\n\n const used = [\n ...new Set(messages.map((message) => message.variant ?? 'default')),\n ] as (Variant | 'return')[]\n\n // The messages a span of the axis holds, which is what both a segment caption\n // and an activation bar are actually saying. Naming them by the calls inside\n // them rather than by their y bounds is the only version of that fact a\n // reader who cannot see the axis can use.\n const across = (from: number, to: number) =>\n messages\n .filter((message) => message.y >= from && message.y <= to && message.label)\n .map((message) => message.label as string)\n\n const named = new Map(spec.participants.map((p) => [p.id, p.label]))\n\n return {\n extent: { x: 0, y: 0, w: width, h: lifelineBottom + 24 },\n artwork,\n nodes: spec.participants.map((participant) => ({\n id: participant.id,\n label: participant.label,\n sublabel: participant.sublabel,\n kind: participant.type,\n })),\n edges: messages.map((message) => ({\n from: message.from,\n to: message.to,\n label: message.label,\n })),\n // Segments band the TIME axis and activations sit on a lifeline, so neither\n // groups the participants; both are statements the picture makes and the\n // list did not carry at all.\n notes: [\n ...(spec.segments ?? []).map((segment) => {\n const held = across(segment.from, segment.to)\n return held.length > 0\n ? `Phase ${segment.label} covers ${held.join(', ')}.`\n : `Phase ${segment.label} covers no message this figure labels.`\n }),\n ...(spec.activations ?? []).flatMap((activation) => {\n const who = named.get(activation.participant)\n if (who === undefined) {\n warnUnknownRef(\n 'SequenceFigure',\n 'activations[].participant',\n activation.participant,\n 'the bar is drawn on no lifeline at all',\n )\n return []\n }\n const held = across(activation.from, activation.to)\n if (held.length > 1) return [`${who} is busy from ${held[0]} to ${held.at(-1)}.`]\n if (held.length === 1) return [`${who} is busy during ${held[0]}.`]\n return [`${who} is busy for a span none of the messages name.`]\n }),\n ],\n legend: variantLegend(\n resolveLegend(used, spec.meta.legend?.mode, VARIANTS, spec.meta.legend?.entries),\n spec.meta.legend?.entries,\n ),\n }\n}\n\n/** Which arrowhead a message ends in. */\nfunction messageMarker(\n variant: SequenceSpec['messages'][number]['variant'],\n): 'arrow' | 'arrow-strong' | 'arrow-open' {\n if (variant === 'emphasis') return 'arrow-strong'\n if (variant === 'return') return 'arrow-open'\n return 'arrow'\n}\n\n/** A message's colour. Geometry goes through attributes — see `edgeClasses`. */\nfunction messageClasses(variant: SequenceSpec['messages'][number]['variant']): string {\n switch (variant) {\n case 'emphasis':\n return 'stroke-(--diagram-line-strong)'\n case 'return':\n case 'dashed':\n return 'stroke-(--diagram-line-soft)'\n default:\n return 'stroke-(--diagram-line)'\n }\n}\n\n/** A message's width and dash pattern. Heavier than a map's line: it IS the content. */\nfunction messageStroke(variant: SequenceSpec['messages'][number]['variant']): {\n strokeWidth: number\n strokeDasharray?: string\n} {\n switch (variant) {\n case 'emphasis':\n return { strokeWidth: 2 }\n case 'security':\n return { strokeWidth: 1.4, strokeDasharray: '6 3' }\n case 'return':\n return { strokeWidth: 1.2, strokeDasharray: '4 3.5' }\n case 'dashed':\n return { strokeWidth: 1.2, strokeDasharray: '3 3' }\n default:\n return { strokeWidth: 1.4 }\n }\n}\n\nexport default SequenceFigure\n"],"mappings":";AA6DI,SA8DA,UA9DA,KAiEI,YAjEJ;AA3DJ,SAAS,OAAO,eAAe;AAC/B,SAAS,WAAW,iBAAiB,sBAAsB;AAC3D,SAAS,oBAAyD;AAClE,SAAS,OAAO,WAAW,YAAsB;AACjD,SAAS,eAAe,qBAAqB;AAC7C,SAAS,WAAW,iBAAiB;AAGrC,MAAM,OAAO,EAAE,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,KAAK,GAAG;AAC7C,MAAM,WAAmC,CAAC,WAAW,YAAY,YAAY,UAAU,QAAQ;AAiCxF,SAAS,eAAe;AAAA,EAC7B;AAAA,EACA;AAAA,EACA,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,UAAU;AAAA,EACV;AAAA,EACA;AACF,GAAwB;AACtB,QAAM,MAAM,MAAM,EAAE,QAAQ,MAAM,EAAE;AACpC,kBAAgB,MAAM,gBAAgB;AACtC,QAAM,QAAQ;AAAA,IACZ,MAAM,WAAW,MAAM,KAAK,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AA,IACT,KAAK;AAAA,IACL,KAAK;AACH,aAAO;AAAA,IACT;AACE,aAAO;AAAA,EACX;AACF;AAGA,SAAS,cAAc,SAGrB;AACA,UAAQ,SAAS;AAAA,IACf,KAAK;AACH,aAAO,EAAE,aAAa,EAAE;AAAA,IAC1B,KAAK;AACH,aAAO,EAAE,aAAa,KAAK,iBAAiB,MAAM;AAAA,IACpD,KAAK;AACH,aAAO,EAAE,aAAa,KAAK,iBAAiB,QAAQ;AAAA,IACtD,KAAK;AACH,aAAO,EAAE,aAAa,KAAK,iBAAiB,MAAM;AAAA,IACpD;AACE,aAAO,EAAE,aAAa,IAAI;AAAA,EAC9B;AACF;AAEA,IAAO,yBAAQ;","names":[]}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { FigureChrome } from '../lib/frame.js';
|
|
3
|
+
import { WorkflowSpec } from '../spec.js';
|
|
4
|
+
import '../lib/geometry.js';
|
|
5
|
+
|
|
6
|
+
interface WorkflowFigureProps extends FigureChrome {
|
|
7
|
+
spec: WorkflowSpec;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* A process: who does what, in what order, and where it can go wrong.
|
|
11
|
+
*
|
|
12
|
+
* Three structures stacked on one grid, and they are three because they answer
|
|
13
|
+
* three different questions a reader brings to a runbook.
|
|
14
|
+
*
|
|
15
|
+
* **Lanes** are rows and answer WHO. A lane marked `exception` is the one band
|
|
16
|
+
* that gets a wash rather than a rule, and it earns the exception to the
|
|
17
|
+
* frames-are-rules law because nothing routes across it — it IS the ground for
|
|
18
|
+
* the failure path, not a frame drawn over the happy one.
|
|
19
|
+
*
|
|
20
|
+
* **Phases** are columns across every lane and answer WHEN. Printed as captions
|
|
21
|
+
* on one header rule, because a phase is an axis label. **Groups** are frames
|
|
22
|
+
* inside a single lane and answer WHAT BELONGS TOGETHER — a planning loop, an
|
|
23
|
+
* evidence path.
|
|
24
|
+
*
|
|
25
|
+
* THE MAIN PATH IS HEAVIER, and that is the whole hierarchy. `mainPath` lists
|
|
26
|
+
* the node ids a reader should be able to follow without thinking. Every edge
|
|
27
|
+
* between two consecutive ids on it is drawn at the emphasis weight whatever
|
|
28
|
+
* its own variant says, which is the one thing that turns fourteen boxes and
|
|
29
|
+
* nineteen arrows into a diagram with a subject. An `error` role goes the other
|
|
30
|
+
* way — dashed and soft — so the exception path recedes without disappearing,
|
|
31
|
+
* and so does `async`. `branch` adds no stroke of its own: a branch is an edge
|
|
32
|
+
* the main path does not list, and that is already the difference on the page.
|
|
33
|
+
*/
|
|
34
|
+
declare function WorkflowFigure({ spec, className, legend, cards, heading, activeIds, onSelectNode, }: WorkflowFigureProps): react.JSX.Element;
|
|
35
|
+
|
|
36
|
+
export { WorkflowFigure, type WorkflowFigureProps, WorkflowFigure as default };
|