@mastra/playground-ui 69.0.0-alpha.3 → 69.0.0-alpha.4
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/dist/{ActionRow-BlC9GAef.cjs → ActionRow-CvrBw87S.cjs} +2 -2
- package/dist/ActionRow-CvrBw87S.cjs.map +1 -0
- package/dist/{ActionRow-DCrRCvBq.js → ActionRow-yM6RsoEe.js} +2 -2
- package/dist/ActionRow-yM6RsoEe.js.map +1 -0
- package/dist/{Composer-D2BqRyb5.cjs → Composer-DNFL8qXT.cjs} +247 -78
- package/dist/Composer-DNFL8qXT.cjs.map +1 -0
- package/dist/{Composer-kjwmlIgL.js → Composer-yswP8Tls.js} +227 -82
- package/dist/Composer-yswP8Tls.js.map +1 -0
- package/dist/Composer.css +14 -0
- package/dist/{DataCodeSection-CcX8Z68Y.js → DataCodeSection-DQ86nArx.js} +2 -2
- package/dist/{DataCodeSection-CcX8Z68Y.js.map → DataCodeSection-DQ86nArx.js.map} +1 -1
- package/dist/{DataCodeSection-JPGTWLcL.cjs → DataCodeSection-vz1SFcEc.cjs} +2 -2
- package/dist/{DataCodeSection-JPGTWLcL.cjs.map → DataCodeSection-vz1SFcEc.cjs.map} +1 -1
- package/dist/{DataPanel-LfExjFpP.cjs → DataPanel-Bf7a92ew.cjs} +2 -2
- package/dist/{DataPanel-LfExjFpP.cjs.map → DataPanel-Bf7a92ew.cjs.map} +1 -1
- package/dist/{DataPanel-Rv5Mb_pf.js → DataPanel-CJsmZjPk.js} +2 -2
- package/dist/{DataPanel-Rv5Mb_pf.js.map → DataPanel-CJsmZjPk.js.map} +1 -1
- package/dist/{Dialog-Duy3M1ny.cjs → Dialog-BiKQDKFB.cjs} +3 -15
- package/dist/Dialog-BiKQDKFB.cjs.map +1 -0
- package/dist/{Dialog-OBPu3rl2.js → Dialog-DXJKTMMp.js} +2 -14
- package/dist/Dialog-DXJKTMMp.js.map +1 -0
- package/dist/{FilterBar-DgHNtsDI.js → FilterBar-BdETyj2z.js} +2 -2
- package/dist/{FilterBar-DgHNtsDI.js.map → FilterBar-BdETyj2z.js.map} +1 -1
- package/dist/{FilterBar-O8SYau_Q.cjs → FilterBar-D9aHh-m_.cjs} +2 -2
- package/dist/{FilterBar-O8SYau_Q.cjs.map → FilterBar-D9aHh-m_.cjs.map} +1 -1
- package/dist/{MarkdownRenderer-BSGb65Ze.js → MarkdownRenderer-CTKHmV9P.js} +192 -21
- package/dist/MarkdownRenderer-CTKHmV9P.js.map +1 -0
- package/dist/{MarkdownRenderer-CDwlvw0Y.cjs → MarkdownRenderer-DEfS5FJk.cjs} +192 -21
- package/dist/MarkdownRenderer-DEfS5FJk.cjs.map +1 -0
- package/dist/{MetricsLineChart-BnY9JKzc.cjs → MetricsLineChart-CFKyRZ0t.cjs} +7 -3
- package/dist/MetricsLineChart-CFKyRZ0t.cjs.map +1 -0
- package/dist/{MetricsLineChart-4w5lpH63.js → MetricsLineChart-CwQ7c3nK.js} +8 -4
- package/dist/MetricsLineChart-CwQ7c3nK.js.map +1 -0
- package/dist/{MetricsStackedBarChart-Bmk0OjYp.js → MetricsStackedBarChart-BYnCiXfI.js} +8 -6
- package/dist/MetricsStackedBarChart-BYnCiXfI.js.map +1 -0
- package/dist/{MetricsStackedBarChart-CJQF99sc.cjs → MetricsStackedBarChart-e4_hVNX6.cjs} +6 -4
- package/dist/MetricsStackedBarChart-e4_hVNX6.cjs.map +1 -0
- package/dist/{Workflow-CwIjxwC6.cjs → Workflow-BZ93cAzH.cjs} +2 -2
- package/dist/{Workflow-CwIjxwC6.cjs.map → Workflow-BZ93cAzH.cjs.map} +1 -1
- package/dist/{Workflow-BVVYys0W.js → Workflow-DZINlzVS.js} +2 -2
- package/dist/{Workflow-BVVYys0W.js.map → Workflow-DZINlzVS.js.map} +1 -1
- package/dist/{activity-BH_eegMA.js → activity-BFk77HxX.js} +2 -2
- package/dist/{activity-BH_eegMA.js.map → activity-BFk77HxX.js.map} +1 -1
- package/dist/{activity-Ciolopq8.cjs → activity-CSzzlpz0.cjs} +2 -2
- package/dist/{activity-Ciolopq8.cjs.map → activity-CSzzlpz0.cjs.map} +1 -1
- package/dist/chart-plot.css +9 -0
- package/dist/components/ActionRow.cjs.js +1 -1
- package/dist/components/ActionRow.es.js +1 -1
- package/dist/components/AlertDialog.cjs.js +1 -1
- package/dist/components/AlertDialog.es.js +1 -1
- package/dist/components/ChartSkeleton.cjs.js +2 -0
- package/dist/components/ChartSkeleton.cjs.js.map +1 -1
- package/dist/components/ChartSkeleton.es.js +2 -0
- package/dist/components/ChartSkeleton.es.js.map +1 -1
- package/dist/components/Command.cjs.js +1 -1
- package/dist/components/Command.es.js +1 -1
- package/dist/components/Composer.cjs.js +5 -1
- package/dist/components/Composer.es.js +1 -1
- package/dist/components/DataCodeSection.cjs.js +1 -1
- package/dist/components/DataCodeSection.es.js +1 -1
- package/dist/components/DataPanel.cjs.js +1 -1
- package/dist/components/DataPanel.es.js +1 -1
- package/dist/components/Dialog.cjs.js +1 -1
- package/dist/components/Dialog.es.js +1 -1
- package/dist/components/FilterBar.cjs.js +1 -1
- package/dist/components/FilterBar.es.js +1 -1
- package/dist/components/MarkdownRenderer.cjs.js +1 -1
- package/dist/components/MarkdownRenderer.es.js +1 -1
- package/dist/components/MetricsLineChart.cjs.js +1 -1
- package/dist/components/MetricsLineChart.es.js +1 -1
- package/dist/components/MetricsStackedBarChart.cjs.js +1 -1
- package/dist/components/MetricsStackedBarChart.es.js +1 -1
- package/dist/components/SeriesMark.cjs.js +1 -1
- package/dist/components/SeriesMark.cjs.js.map +1 -1
- package/dist/components/SeriesMark.es.js +1 -1
- package/dist/components/SeriesMark.es.js.map +1 -1
- package/dist/components/Sidebar.cjs.js +1 -1
- package/dist/components/Sidebar.es.js +1 -1
- package/dist/components/ThinkingLevel.cjs.js +219 -104
- package/dist/components/ThinkingLevel.cjs.js.map +1 -1
- package/dist/components/ThinkingLevel.es.js +221 -105
- package/dist/components/ThinkingLevel.es.js.map +1 -1
- package/dist/components/Workflow.cjs.js +1 -1
- package/dist/components/Workflow.es.js +1 -1
- package/dist/components/ai/activity.cjs.js +1 -1
- package/dist/components/ai/activity.es.js +1 -1
- package/dist/components/ai/plan.cjs.js +1 -1
- package/dist/components/ai/plan.es.js +1 -1
- package/dist/components/ai/tool-approval.cjs.js +1 -1
- package/dist/components/ai/tool-approval.es.js +1 -1
- package/dist/components/ai/tool-call.cjs.js +1 -1
- package/dist/components/ai/tool-call.es.js +1 -1
- package/dist/dialog-shell-BECSoKqj.cjs +26 -0
- package/dist/dialog-shell-BECSoKqj.cjs.map +1 -0
- package/dist/dialog-shell-C-PVUid_.js +16 -0
- package/dist/dialog-shell-C-PVUid_.js.map +1 -0
- package/dist/domains/chat/activity/activity-stretch-line.cjs.js +1 -1
- package/dist/domains/chat/activity/activity-stretch-line.es.js +1 -1
- package/dist/domains/chat/activity/components/activity-fold.cjs.js +1 -1
- package/dist/domains/chat/activity/components/activity-fold.es.js +1 -1
- package/dist/domains/chat/activity/components/calls-panel.cjs.js +1 -1
- package/dist/domains/chat/activity/components/calls-panel.es.js +1 -1
- package/dist/domains/chat/activity/components/stretch-content.cjs.js +1 -1
- package/dist/domains/chat/activity/components/stretch-content.es.js +1 -1
- package/dist/domains/chat/activity/components/stretch-thought.cjs.js +1 -1
- package/dist/domains/chat/activity/components/stretch-thought.es.js +1 -1
- package/dist/domains/chat/activity/model/activity-segments.cjs.js +1 -1
- package/dist/domains/chat/activity/model/activity-segments.es.js +1 -1
- package/dist/domains/chat/activity/model/activity-words.cjs.js +1 -1
- package/dist/domains/chat/activity/model/activity-words.es.js +1 -1
- package/dist/domains/chat/attachments/attachment-preview-dialog.cjs.js +1 -1
- package/dist/domains/chat/attachments/attachment-preview-dialog.es.js +1 -1
- package/dist/domains/chat/attachments/composer-attachment-list.cjs.js +1 -1
- package/dist/domains/chat/attachments/composer-attachment-list.es.js +1 -1
- package/dist/domains/chat/components/badge-wrapper.cjs.js +1 -1
- package/dist/domains/chat/components/badge-wrapper.es.js +1 -1
- package/dist/domains/chat/components/network-choice-metadata-dialog.cjs.js +1 -1
- package/dist/domains/chat/components/network-choice-metadata-dialog.es.js +1 -1
- package/dist/domains/chat/knowledge/pinned-knowledge.cjs.js +1 -1
- package/dist/domains/chat/knowledge/pinned-knowledge.es.js +1 -1
- package/dist/domains/chat/messages/dataset-save-action.cjs.js +1 -1
- package/dist/domains/chat/messages/dataset-save-action.es.js +1 -1
- package/dist/domains/chat/messages/message-row.cjs.js +2 -2
- package/dist/domains/chat/messages/message-row.es.js +2 -2
- package/dist/domains/chat/messages/notification-signal-notice.cjs.js +1 -1
- package/dist/domains/chat/messages/notification-signal-notice.es.js +1 -1
- package/dist/domains/chat/messages/reasoning-content.cjs.js +1 -1
- package/dist/domains/chat/messages/reasoning-content.es.js +1 -1
- package/dist/domains/chat/messages/renderers/message-text.cjs.js +1 -1
- package/dist/domains/chat/messages/renderers/message-text.es.js +1 -1
- package/dist/domains/chat/messages/renderers/reasoning-part-renderer.cjs.js +1 -1
- package/dist/domains/chat/messages/renderers/reasoning-part-renderer.es.js +1 -1
- package/dist/domains/chat/messages/signal-badge.cjs.js +1 -1
- package/dist/domains/chat/messages/signal-badge.es.js +1 -1
- package/dist/domains/chat/messages/skill-message.cjs.js +2 -2
- package/dist/domains/chat/messages/skill-message.es.js +2 -2
- package/dist/domains/chat/messages/system-reminder-badge.cjs.js +1 -1
- package/dist/domains/chat/messages/system-reminder-badge.es.js +1 -1
- package/dist/domains/chat/tools/badges/agent-badge-wrapper.cjs.js +1 -1
- package/dist/domains/chat/tools/badges/agent-badge-wrapper.es.js +1 -1
- package/dist/domains/chat/tools/badges/agent-badge.cjs.js +1 -1
- package/dist/domains/chat/tools/badges/agent-badge.es.js +1 -1
- package/dist/domains/chat/tools/badges/background-task-metadata-dialog.cjs.js +1 -1
- package/dist/domains/chat/tools/badges/background-task-metadata-dialog.es.js +1 -1
- package/dist/domains/chat/tools/badges/file-tree-badge.cjs.js +1 -1
- package/dist/domains/chat/tools/badges/file-tree-badge.es.js +1 -1
- package/dist/domains/chat/tools/badges/knowledge-tool-badge.cjs.js +2 -2
- package/dist/domains/chat/tools/badges/knowledge-tool-badge.es.js +2 -2
- package/dist/domains/chat/tools/badges/observation-marker-badge.cjs.js +2 -2
- package/dist/domains/chat/tools/badges/observation-marker-badge.es.js +2 -2
- package/dist/domains/chat/tools/badges/observation-marker-details.cjs.js +2 -2
- package/dist/domains/chat/tools/badges/observation-marker-details.es.js +2 -2
- package/dist/domains/chat/tools/badges/observation-renderer.cjs.js +1 -1
- package/dist/domains/chat/tools/badges/observation-renderer.es.js +1 -1
- package/dist/domains/chat/tools/badges/sandbox-execution-badge.cjs.js +1 -1
- package/dist/domains/chat/tools/badges/sandbox-execution-badge.es.js +1 -1
- package/dist/domains/chat/tools/badges/tool-approval-badge.cjs.js +1 -1
- package/dist/domains/chat/tools/badges/tool-approval-badge.es.js +1 -1
- package/dist/domains/chat/tools/badges/tool-badge.cjs.js +1 -1
- package/dist/domains/chat/tools/badges/tool-badge.es.js +1 -1
- package/dist/domains/chat/tools/badges/workflow-badge.cjs.js +1 -1
- package/dist/domains/chat/tools/badges/workflow-badge.es.js +1 -1
- package/dist/domains/chat/tools/tool-card.cjs.js +1 -1
- package/dist/domains/chat/tools/tool-card.es.js +1 -1
- package/dist/domains/chat/tools/tool-groups.cjs.js +1 -1
- package/dist/domains/chat/tools/tool-groups.es.js +1 -1
- package/dist/domains/dashboards/components/stateless-widget.cjs.js.map +1 -1
- package/dist/domains/dashboards/components/stateless-widget.es.js.map +1 -1
- package/dist/domains/dashboards/kinds/kpis/kpis-widget.cjs.js +23 -17
- package/dist/domains/dashboards/kinds/kpis/kpis-widget.cjs.js.map +1 -1
- package/dist/domains/dashboards/kinds/kpis/kpis-widget.es.js +23 -17
- package/dist/domains/dashboards/kinds/kpis/kpis-widget.es.js.map +1 -1
- package/dist/domains/dashboards/kinds/scores/options.cjs.js +1 -0
- package/dist/domains/dashboards/kinds/scores/options.cjs.js.map +1 -1
- package/dist/domains/dashboards/kinds/scores/options.es.js +1 -0
- package/dist/domains/dashboards/kinds/scores/options.es.js.map +1 -1
- package/dist/domains/dashboards/kinds/scores/scores-widget.cjs.js +3 -3
- package/dist/domains/dashboards/kinds/scores/scores-widget.cjs.js.map +1 -1
- package/dist/domains/dashboards/kinds/scores/scores-widget.es.js +3 -3
- package/dist/domains/dashboards/kinds/scores/scores-widget.es.js.map +1 -1
- package/dist/domains/dashboards/kinds/table/table-tabs.cjs.js +1 -0
- package/dist/domains/dashboards/kinds/table/table-tabs.cjs.js.map +1 -1
- package/dist/domains/dashboards/kinds/table/table-tabs.es.js +1 -0
- package/dist/domains/dashboards/kinds/table/table-tabs.es.js.map +1 -1
- package/dist/domains/dashboards/kinds/table/table-widget.cjs.js +1 -0
- package/dist/domains/dashboards/kinds/table/table-widget.cjs.js.map +1 -1
- package/dist/domains/dashboards/kinds/table/table-widget.es.js +1 -0
- package/dist/domains/dashboards/kinds/table/table-widget.es.js.map +1 -1
- package/dist/domains/dashboards/kinds/timeseries/timeseries-widget.cjs.js +6 -6
- package/dist/domains/dashboards/kinds/timeseries/timeseries-widget.cjs.js.map +1 -1
- package/dist/domains/dashboards/kinds/timeseries/timeseries-widget.es.js +6 -6
- package/dist/domains/dashboards/kinds/timeseries/timeseries-widget.es.js.map +1 -1
- package/dist/domains/dashboards/lib/chrome.cjs.js.map +1 -1
- package/dist/domains/dashboards/lib/chrome.es.js.map +1 -1
- package/dist/domains/dashboards/lib/timeseries.cjs.js +1 -0
- package/dist/domains/dashboards/lib/timeseries.cjs.js.map +1 -1
- package/dist/domains/dashboards/lib/timeseries.es.js +1 -0
- package/dist/domains/dashboards/lib/timeseries.es.js.map +1 -1
- package/dist/domains/dashboards/metrics-dashboard.cjs.js +10 -16
- package/dist/domains/dashboards/metrics-dashboard.cjs.js.map +1 -1
- package/dist/domains/dashboards/metrics-dashboard.es.js +10 -16
- package/dist/domains/dashboards/metrics-dashboard.es.js.map +1 -1
- package/dist/domains/dashboards/widget-kind.cjs.js.map +1 -1
- package/dist/domains/dashboards/widget-kind.es.js.map +1 -1
- package/dist/domains/datasets/components/add-dataset-item-dialog/add-dataset-item-dialog.cjs.js +1 -1
- package/dist/domains/datasets/components/add-dataset-item-dialog/add-dataset-item-dialog.es.js +1 -1
- package/dist/domains/datasets/components/save-as-dataset-item-dialog.cjs.js +1 -1
- package/dist/domains/datasets/components/save-as-dataset-item-dialog.es.js +1 -1
- package/dist/domains/knowledge/components/KnowledgePageDetail.cjs.js +1 -1
- package/dist/domains/knowledge/components/KnowledgePageDetail.es.js +1 -1
- package/dist/domains/knowledge/components/KnowledgePageExplorer.cjs.js +2 -2
- package/dist/domains/knowledge/components/KnowledgePageExplorer.es.js +2 -2
- package/dist/domains/llm/model-picker-option.cjs.js +39 -0
- package/dist/domains/llm/model-picker-option.cjs.js.map +1 -0
- package/dist/domains/llm/model-picker-option.d.ts +1 -0
- package/dist/domains/llm/model-picker-option.es.js +38 -0
- package/dist/domains/llm/model-picker-option.es.js.map +1 -0
- package/dist/domains/llm/model-picker-panel.cjs.js +168 -0
- package/dist/domains/llm/model-picker-panel.cjs.js.map +1 -0
- package/dist/domains/llm/model-picker-panel.d.ts +1 -0
- package/dist/domains/llm/model-picker-panel.es.js +167 -0
- package/dist/domains/llm/model-picker-panel.es.js.map +1 -0
- package/dist/domains/llm/model-picker-provider-filter.cjs.js +55 -0
- package/dist/domains/llm/model-picker-provider-filter.cjs.js.map +1 -0
- package/dist/domains/llm/model-picker-provider-filter.d.ts +1 -0
- package/dist/domains/llm/model-picker-provider-filter.es.js +54 -0
- package/dist/domains/llm/model-picker-provider-filter.es.js.map +1 -0
- package/dist/domains/llm/model-picker-provider-option.cjs.js +38 -0
- package/dist/domains/llm/model-picker-provider-option.cjs.js.map +1 -0
- package/dist/domains/llm/model-picker-provider-option.d.ts +1 -0
- package/dist/domains/llm/model-picker-provider-option.es.js +37 -0
- package/dist/domains/llm/model-picker-provider-option.es.js.map +1 -0
- package/dist/domains/llm/model-picker-types.cjs.js +0 -0
- package/dist/domains/llm/model-picker-types.d.ts +1 -0
- package/dist/domains/llm/model-picker-types.es.js +0 -0
- package/dist/domains/llm/model-picker.cjs.js +126 -0
- package/dist/domains/llm/model-picker.cjs.js.map +1 -0
- package/dist/domains/llm/model-picker.d.ts +1 -0
- package/dist/domains/llm/model-picker.es.js +125 -0
- package/dist/domains/llm/model-picker.es.js.map +1 -0
- package/dist/domains/llm.cjs.js +2 -0
- package/dist/domains/llm.es.js +2 -1
- package/dist/domains/logs/components/log-data-panel.cjs.js +1 -1
- package/dist/domains/logs/components/log-data-panel.es.js +1 -1
- package/dist/domains/metrics/components/agent-runs-card.cjs.js +2 -3
- package/dist/domains/metrics/components/agent-runs-card.cjs.js.map +1 -1
- package/dist/domains/metrics/components/agent-runs-card.es.js +2 -3
- package/dist/domains/metrics/components/agent-runs-card.es.js.map +1 -1
- package/dist/domains/metrics/components/chart-area.cjs.js +52 -7
- package/dist/domains/metrics/components/chart-area.cjs.js.map +1 -1
- package/dist/domains/metrics/components/chart-area.es.js +52 -7
- package/dist/domains/metrics/components/chart-area.es.js.map +1 -1
- package/dist/domains/metrics/components/chart-card.cjs.js +39 -5
- package/dist/domains/metrics/components/chart-card.cjs.js.map +1 -1
- package/dist/domains/metrics/components/chart-card.es.js +39 -5
- package/dist/domains/metrics/components/chart-card.es.js.map +1 -1
- package/dist/domains/metrics/components/distinct-ids/distinct-ids-chart.cjs.js +3 -4
- package/dist/domains/metrics/components/distinct-ids/distinct-ids-chart.cjs.js.map +1 -1
- package/dist/domains/metrics/components/distinct-ids/distinct-ids-chart.es.js +3 -4
- package/dist/domains/metrics/components/distinct-ids/distinct-ids-chart.es.js.map +1 -1
- package/dist/domains/metrics/components/failure-rate-card.cjs.js +1 -2
- package/dist/domains/metrics/components/failure-rate-card.cjs.js.map +1 -1
- package/dist/domains/metrics/components/failure-rate-card.es.js +1 -2
- package/dist/domains/metrics/components/failure-rate-card.es.js.map +1 -1
- package/dist/domains/metrics/components/latency-card.cjs.js +2 -8
- package/dist/domains/metrics/components/latency-card.cjs.js.map +1 -1
- package/dist/domains/metrics/components/latency-card.es.js +2 -8
- package/dist/domains/metrics/components/latency-card.es.js.map +1 -1
- package/dist/domains/metrics/components/scores-card.cjs.js +1 -2
- package/dist/domains/metrics/components/scores-card.cjs.js.map +1 -1
- package/dist/domains/metrics/components/scores-card.es.js +1 -2
- package/dist/domains/metrics/components/scores-card.es.js.map +1 -1
- package/dist/domains/metrics/components/token-usage-card.cjs.js +2 -3
- package/dist/domains/metrics/components/token-usage-card.cjs.js.map +1 -1
- package/dist/domains/metrics/components/token-usage-card.es.js +2 -3
- package/dist/domains/metrics/components/token-usage-card.es.js.map +1 -1
- package/dist/domains/observability/components/observability-histogram.cjs.js +1 -1
- package/dist/domains/observability/components/observability-histogram.es.js +1 -1
- package/dist/domains/scores/components/score-data-panel.cjs.js +1 -1
- package/dist/domains/scores/components/score-data-panel.es.js +1 -1
- package/dist/domains/scores/components/span-scoring.cjs.js +1 -1
- package/dist/domains/scores/components/span-scoring.es.js +1 -1
- package/dist/domains/scores/components/trace-scores-list.cjs.js +1 -1
- package/dist/domains/scores/components/trace-scores-list.es.js +1 -1
- package/dist/domains/skills/skill-simple-form.cjs.js +1 -1
- package/dist/domains/skills/skill-simple-form.es.js +1 -1
- package/dist/domains/spans/components/spans-explorer-body.cjs.js +1 -1
- package/dist/domains/spans/components/spans-explorer-body.es.js +1 -1
- package/dist/domains/spans/components/spans-filter-bar.cjs.js +1 -1
- package/dist/domains/spans/components/spans-filter-bar.es.js +1 -1
- package/dist/domains/threads/components/threads-explorer-body.cjs.js +1 -1
- package/dist/domains/threads/components/threads-explorer-body.es.js +1 -1
- package/dist/domains/threads/components/threads-filter-bar.cjs.js +1 -1
- package/dist/domains/threads/components/threads-filter-bar.es.js +1 -1
- package/dist/domains/traces/components/span-data-panel-view.cjs.js +1 -1
- package/dist/domains/traces/components/span-data-panel-view.es.js +1 -1
- package/dist/domains/traces/components/span-payload/span-error-renderer.cjs.js +1 -1
- package/dist/domains/traces/components/span-payload/span-error-renderer.es.js +1 -1
- package/dist/domains/traces/components/span-payload/span-input-renderers.cjs.js +1 -1
- package/dist/domains/traces/components/span-payload/span-input-renderers.es.js +1 -1
- package/dist/domains/traces/components/span-payload/span-output-renderers.cjs.js +2 -2
- package/dist/domains/traces/components/span-payload/span-output-renderers.es.js +2 -2
- package/dist/domains/traces/components/span-payload/span-payload-messages.cjs.js +2 -2
- package/dist/domains/traces/components/span-payload/span-payload-messages.es.js +2 -2
- package/dist/domains/traces/components/span-payload/span-payload-primitives.cjs.js +1 -1
- package/dist/domains/traces/components/span-payload/span-payload-primitives.es.js +1 -1
- package/dist/domains/traces/components/span-payload/span-payload-processor.cjs.js +1 -1
- package/dist/domains/traces/components/span-payload/span-payload-processor.es.js +1 -1
- package/dist/domains/traces/components/span-payload/span-payload-tool.cjs.js +1 -1
- package/dist/domains/traces/components/span-payload/span-payload-tool.es.js +1 -1
- package/dist/domains/traces/components/span-payload/span-processor-mutations.cjs.js +1 -1
- package/dist/domains/traces/components/span-payload/span-processor-mutations.es.js +1 -1
- package/dist/domains/traces/components/span-payload/span-tools-section.cjs.js +1 -1
- package/dist/domains/traces/components/span-payload/span-tools-section.es.js +1 -1
- package/dist/domains/traces/components/span-summary-description.cjs.js +1 -1
- package/dist/domains/traces/components/span-summary-description.es.js +1 -1
- package/dist/domains/traces/components/thread-trace/thread-trace-details.cjs.js +1 -1
- package/dist/domains/traces/components/thread-trace/thread-trace-details.es.js +1 -1
- package/dist/domains/traces/components/trace-columns-menu.cjs.js +1 -1
- package/dist/domains/traces/components/trace-columns-menu.es.js +1 -1
- package/dist/domains/traces/components/trace-data-panel-view.cjs.js +1 -1
- package/dist/domains/traces/components/trace-data-panel-view.es.js +1 -1
- package/dist/domains/traces/components/trace-data-panel.cjs.js +1 -1
- package/dist/domains/traces/components/trace-data-panel.es.js +1 -1
- package/dist/domains/traces/components/trace-id-button.cjs.js +1 -1
- package/dist/domains/traces/components/trace-id-button.es.js +1 -1
- package/dist/domains/traces/components/trace-summary-description.cjs.js +1 -1
- package/dist/domains/traces/components/trace-summary-description.es.js +1 -1
- package/dist/domains/traces/components/trace-thread-panel.cjs.js +1 -1
- package/dist/domains/traces/components/trace-thread-panel.es.js +1 -1
- package/dist/domains/traces/components/traces-explorer/traces-explorer-filter-bar.cjs.js +1 -1
- package/dist/domains/traces/components/traces-explorer/traces-explorer-filter-bar.es.js +1 -1
- package/dist/domains/workflows/components/workflow-layout.cjs.js +1 -1
- package/dist/domains/workflows/components/workflow-layout.es.js +1 -1
- package/dist/domains/workflows/components/workflow-step-detail.cjs.js +2 -2
- package/dist/domains/workflows/components/workflow-step-detail.es.js +2 -2
- package/dist/domains/workflows/workflow/data/workflow-data-button.cjs.js +1 -1
- package/dist/domains/workflows/workflow/data/workflow-data-button.es.js +1 -1
- package/dist/domains/workflows/workflow/use-workflow-graph-runtime.cjs.js +1 -1
- package/dist/domains/workflows/workflow/use-workflow-graph-runtime.es.js +1 -1
- package/dist/domains/workflows/workflow/utils.cjs.js +1 -1
- package/dist/domains/workflows/workflow/utils.es.js +1 -1
- package/dist/domains/workflows/workflow/workflow-body-graph.cjs.js +1 -1
- package/dist/domains/workflows/workflow/workflow-body-graph.es.js +1 -1
- package/dist/domains/workflows/workflow/workflow-data-edge.cjs.js +1 -1
- package/dist/domains/workflows/workflow/workflow-data-edge.es.js +1 -1
- package/dist/domains/workflows/workflow/workflow-debug-step-controls.cjs.js +1 -1
- package/dist/domains/workflows/workflow/workflow-debug-step-controls.es.js +1 -1
- package/dist/domains/workflows/workflow/workflow-graph-inner.cjs.js +2 -2
- package/dist/domains/workflows/workflow/workflow-graph-inner.es.js +2 -2
- package/dist/domains/workflows/workflow/workflow-graph-layout.cjs.js +1 -1
- package/dist/domains/workflows/workflow/workflow-graph-layout.es.js +1 -1
- package/dist/domains/workflows/workflow/workflow-graph-node.cjs.js +1 -1
- package/dist/domains/workflows/workflow/workflow-graph-node.es.js +1 -1
- package/dist/domains/workflows/workflow/workflow-graph.cjs.js +1 -1
- package/dist/domains/workflows/workflow/workflow-graph.es.js +1 -1
- package/dist/domains/workflows/workflow/workflow-map-config-dialog.cjs.js +2 -2
- package/dist/domains/workflows/workflow/workflow-map-config-dialog.es.js +2 -2
- package/dist/domains/workflows/workflow/workflow-nested-graph.cjs.js +1 -1
- package/dist/domains/workflows/workflow/workflow-nested-graph.es.js +1 -1
- package/dist/domains/workflows/workflow/workflow-step-action-bar.cjs.js +2 -2
- package/dist/domains/workflows/workflow/workflow-step-action-bar.es.js +2 -2
- package/dist/domains/workflows/workflow/workflow-step-node-utils.cjs.js +1 -1
- package/dist/domains/workflows/workflow/workflow-step-node-utils.es.js +1 -1
- package/dist/domains/workspace/components/workspace-add-skill-dialog.cjs.js +2 -2
- package/dist/domains/workspace/components/workspace-add-skill-dialog.es.js +2 -2
- package/dist/domains/workspace/components/workspace-create-directory.cjs.js +1 -1
- package/dist/domains/workspace/components/workspace-create-directory.es.js +1 -1
- package/dist/domains/workspace/components/workspace-markdown-preview.cjs.js +1 -1
- package/dist/domains/workspace/components/workspace-markdown-preview.es.js +1 -1
- package/dist/ee/signals/settings/signal-definition-form-dialog.cjs.js +1 -1
- package/dist/ee/signals/settings/signal-definition-form-dialog.es.js +1 -1
- package/dist/icons/DatasetsIcon.cjs.js +4 -14
- package/dist/icons/DatasetsIcon.cjs.js.map +1 -1
- package/dist/icons/DatasetsIcon.es.js +4 -12
- package/dist/icons/DatasetsIcon.es.js.map +1 -1
- package/dist/icons/ExperimentsIcon.cjs.js +4 -16
- package/dist/icons/ExperimentsIcon.cjs.js.map +1 -1
- package/dist/icons/ExperimentsIcon.es.js +4 -14
- package/dist/icons/ExperimentsIcon.es.js.map +1 -1
- package/dist/icons/LogsIcon.cjs.js +4 -48
- package/dist/icons/LogsIcon.cjs.js.map +1 -1
- package/dist/icons/LogsIcon.es.js +5 -47
- package/dist/icons/LogsIcon.es.js.map +1 -1
- package/dist/icons/MetricsIcon.cjs.js +4 -17
- package/dist/icons/MetricsIcon.cjs.js.map +1 -1
- package/dist/icons/MetricsIcon.es.js +5 -16
- package/dist/icons/MetricsIcon.es.js.map +1 -1
- package/dist/icons/ProcessorIcon.cjs.js +15 -16
- package/dist/icons/ProcessorIcon.cjs.js.map +1 -1
- package/dist/icons/ProcessorIcon.es.js +16 -16
- package/dist/icons/ProcessorIcon.es.js.map +1 -1
- package/dist/icons/PromptIcon.cjs.js +7 -16
- package/dist/icons/PromptIcon.cjs.js.map +1 -1
- package/dist/icons/PromptIcon.es.js +8 -14
- package/dist/icons/PromptIcon.es.js.map +1 -1
- package/dist/icons/ScorersIcon.cjs.js +4 -30
- package/dist/icons/ScorersIcon.cjs.js.map +1 -1
- package/dist/icons/ScorersIcon.es.js +5 -29
- package/dist/icons/ScorersIcon.es.js.map +1 -1
- package/dist/icons/SettingsIcon.cjs.js +4 -16
- package/dist/icons/SettingsIcon.cjs.js.map +1 -1
- package/dist/icons/SettingsIcon.es.js +4 -14
- package/dist/icons/SettingsIcon.es.js.map +1 -1
- package/dist/icons/ToolsIcon.cjs.js +4 -16
- package/dist/icons/ToolsIcon.cjs.js.map +1 -1
- package/dist/icons/ToolsIcon.es.js +4 -14
- package/dist/icons/ToolsIcon.es.js.map +1 -1
- package/dist/icons/TraceIcon.cjs.js +4 -28
- package/dist/icons/TraceIcon.cjs.js.map +1 -1
- package/dist/icons/TraceIcon.es.js +5 -27
- package/dist/icons/TraceIcon.es.js.map +1 -1
- package/dist/icons/WorkspacesIcon.cjs.js +4 -14
- package/dist/icons/WorkspacesIcon.cjs.js.map +1 -1
- package/dist/icons/WorkspacesIcon.es.js +4 -12
- package/dist/icons/WorkspacesIcon.es.js.map +1 -1
- package/dist/primitives/chart-layout.cjs.js +4 -0
- package/dist/primitives/chart-layout.cjs.js.map +1 -1
- package/dist/primitives/chart-layout.es.js +4 -1
- package/dist/primitives/chart-layout.es.js.map +1 -1
- package/dist/primitives/chart-plot.cjs.js +1 -1
- package/dist/primitives/chart-plot.cjs.js.map +1 -1
- package/dist/primitives/chart-plot.es.js +1 -1
- package/dist/primitives/chart-plot.es.js.map +1 -1
- package/dist/{span-payload-primitives-KxqoXspn.js → span-payload-primitives-D0Qs2g2K.js} +3 -3
- package/dist/{span-payload-primitives-KxqoXspn.js.map → span-payload-primitives-D0Qs2g2K.js.map} +1 -1
- package/dist/{span-payload-primitives-CL3hlirm.cjs → span-payload-primitives-Zl7_jWt0.cjs} +3 -3
- package/dist/{span-payload-primitives-CL3hlirm.cjs.map → span-payload-primitives-Zl7_jWt0.cjs.map} +1 -1
- package/dist/src/domains/dashboards/components/stateless-widget.d.ts +7 -0
- package/dist/src/domains/dashboards/kinds/scores/scores-widget.d.ts +1 -1
- package/dist/src/domains/dashboards/lib/chrome.d.ts +1 -1
- package/dist/src/domains/dashboards/widget-kind.d.ts +2 -0
- package/dist/src/domains/llm/index.d.ts +3 -0
- package/dist/src/domains/llm/model-picker-option.d.ts +12 -0
- package/dist/src/domains/llm/model-picker-panel.d.ts +23 -0
- package/dist/src/domains/llm/model-picker-provider-filter.d.ts +16 -0
- package/dist/src/domains/llm/model-picker-provider-option.d.ts +10 -0
- package/dist/src/domains/llm/model-picker-types.d.ts +22 -0
- package/dist/src/domains/llm/model-picker.d.ts +40 -0
- package/dist/src/domains/metrics/components/chart-area.d.ts +10 -2
- package/dist/src/domains/metrics/components/chart-card.d.ts +7 -1
- package/dist/src/ds/components/Composer/composer-attach-menu.d.ts +23 -0
- package/dist/src/ds/components/Composer/composer-header.d.ts +14 -9
- package/dist/src/ds/components/Composer/composer.d.ts +21 -14
- package/dist/src/ds/components/Composer/index.d.ts +3 -1
- package/dist/src/ds/components/MarkdownRenderer/blocks.d.ts +21 -0
- package/dist/src/ds/components/MarkdownRenderer/markdown-renderer.d.ts +3 -3
- package/dist/src/ds/components/ThinkingLevel/index.d.ts +1 -1
- package/dist/src/ds/components/ThinkingLevel/thinking-level-brain.d.ts +5 -0
- package/dist/src/ds/components/ThinkingLevel/thinking-level-icon.d.ts +9 -0
- package/dist/src/ds/components/ThinkingLevel/thinking-level-picker.d.ts +0 -5
- package/dist/src/ds/components/ThinkingLevel/thinking-level-ramp.d.ts +20 -2
- package/dist/src/ds/components/ThinkingLevel/thinking-level-story-data.d.ts +7 -0
- package/dist/src/ds/components/ThinkingLevel/use-thinking-level-stop.d.ts +4 -1
- package/dist/src/ds/icons/DatasetsIcon.d.ts +2 -2
- package/dist/src/ds/icons/ExperimentsIcon.d.ts +2 -2
- package/dist/src/ds/icons/LogsIcon.d.ts +2 -2
- package/dist/src/ds/icons/MetricsIcon.d.ts +2 -2
- package/dist/src/ds/icons/ProcessorIcon.d.ts +2 -2
- package/dist/src/ds/icons/PromptIcon.d.ts +2 -2
- package/dist/src/ds/icons/ScorersIcon.d.ts +2 -2
- package/dist/src/ds/icons/SettingsIcon.d.ts +2 -2
- package/dist/src/ds/icons/ToolsIcon.d.ts +2 -2
- package/dist/src/ds/icons/TraceIcon.d.ts +2 -2
- package/dist/src/ds/icons/WorkspacesIcon.d.ts +2 -2
- package/dist/src/ds/primitives/chart-layout.d.ts +2 -0
- package/dist/style.css +277 -45
- package/dist/{tool-approval-C4WNL8VD.cjs → tool-approval-CAi-OjD4.cjs} +3 -3
- package/dist/{tool-approval-C4WNL8VD.cjs.map → tool-approval-CAi-OjD4.cjs.map} +1 -1
- package/dist/{tool-approval-ZfL3-Vvi.js → tool-approval-D4fPjSGH.js} +3 -3
- package/dist/{tool-approval-ZfL3-Vvi.js.map → tool-approval-D4fPjSGH.js.map} +1 -1
- package/dist/{tool-call-C4TBpJ6Y.cjs → tool-call-BlhTN5zS.cjs} +2 -2
- package/dist/{tool-call-C4TBpJ6Y.cjs.map → tool-call-BlhTN5zS.cjs.map} +1 -1
- package/dist/{tool-call-BLzYTI-x.js → tool-call-DIpsUDbM.js} +2 -2
- package/dist/{tool-call-BLzYTI-x.js.map → tool-call-DIpsUDbM.js.map} +1 -1
- package/dist/{tool-card-CM0aHG3p.js → tool-card-BTpMSR77.js} +2 -2
- package/dist/{tool-card-CM0aHG3p.js.map → tool-card-BTpMSR77.js.map} +1 -1
- package/dist/{tool-card-xDlCD0m6.cjs → tool-card-DfYiJxeq.cjs} +2 -2
- package/dist/{tool-card-xDlCD0m6.cjs.map → tool-card-DfYiJxeq.cjs.map} +1 -1
- package/dist/{use-workflow-graph-runtime-DEJA9rk4.cjs → use-workflow-graph-runtime-Dm3DVQzm.cjs} +2 -2
- package/dist/{use-workflow-graph-runtime-DEJA9rk4.cjs.map → use-workflow-graph-runtime-Dm3DVQzm.cjs.map} +1 -1
- package/dist/{use-workflow-graph-runtime-DHOsA1DM.js → use-workflow-graph-runtime-RGwgMzqP.js} +2 -2
- package/dist/{use-workflow-graph-runtime-DHOsA1DM.js.map → use-workflow-graph-runtime-RGwgMzqP.js.map} +1 -1
- package/package.json +7 -7
- package/dist/ActionRow-BlC9GAef.cjs.map +0 -1
- package/dist/ActionRow-DCrRCvBq.js.map +0 -1
- package/dist/Composer-D2BqRyb5.cjs.map +0 -1
- package/dist/Composer-kjwmlIgL.js.map +0 -1
- package/dist/Dialog-Duy3M1ny.cjs.map +0 -1
- package/dist/Dialog-OBPu3rl2.js.map +0 -1
- package/dist/MarkdownRenderer-BSGb65Ze.js.map +0 -1
- package/dist/MarkdownRenderer-CDwlvw0Y.cjs.map +0 -1
- package/dist/MetricsLineChart-4w5lpH63.js.map +0 -1
- package/dist/MetricsLineChart-BnY9JKzc.cjs.map +0 -1
- package/dist/MetricsStackedBarChart-Bmk0OjYp.js.map +0 -1
- package/dist/MetricsStackedBarChart-CJQF99sc.cjs.map +0 -1
- package/dist/src/ds/components/ThinkingLevel/thinking-level-slider.d.ts +0 -13
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Composer-kjwmlIgL.js","names":[],"sources":["../src/ds/components/Composer/use-composer-pointer.ts","../src/ds/components/Composer/composer.tsx","../src/ds/components/Composer/composer-header.tsx","../src/ds/components/Composer/commands/composer-suggestions.tsx","../src/ds/components/Composer/commands/command-matches.ts","../src/ds/components/Composer/commands/use-composer-commands.ts"],"sourcesContent":["import { useState } from 'react';\nimport type { PointerEvent } from 'react';\n\nexport function useComposerPointer(enabled: boolean) {\n const [pointer, setPointer] = useState<{ x: number; y: number; angle: number }>();\n\n function trackPointer(event: PointerEvent<HTMLDivElement>) {\n if (!enabled || event.defaultPrevented) return;\n\n const bounds = event.currentTarget.getBoundingClientRect();\n const x = event.clientX - bounds.left;\n const y = event.clientY - bounds.top;\n const radians = Math.atan2(y - bounds.height / 2, x - bounds.width / 2);\n // conic-gradient starts at 12 o'clock, atan2 at 3 o'clock\n setPointer({ x, y, angle: (radians * 180) / Math.PI + 90 });\n }\n\n return {\n trackPointer,\n pointerStyle: {\n '--composer-spotlight-x': pointer && `${pointer.x}px`,\n '--composer-spotlight-y': pointer && `${pointer.y}px`,\n '--composer-ring-angle': pointer && `${pointer.angle}deg`,\n },\n };\n}\n","import type { ComponentPropsWithoutRef } from 'react';\nimport { forwardRef, useContext } from 'react';\n\nimport { ChatShellComposerInputContext } from '../ChatShell/chat-shell-context';\nimport { ScrollArea } from '../ScrollArea';\nimport { useComposerPointer } from './use-composer-pointer';\nimport { textFieldAutofillProps } from '@/ds/primitives/password-manager-autofill';\nimport { mergeRefs } from '@/lib/merge-refs';\nimport { cn } from '@/lib/utils';\n\nimport './composer.css';\nimport './composer-ring.css';\nimport './composer-sending.css';\n\nexport type ComposerProps = ComponentPropsWithoutRef<'form'>;\n\nexport interface ComposerInputProps extends ComponentPropsWithoutRef<'textarea'> {\n variant?: 'inline' | 'textarea';\n maxHeight?: string;\n}\n\nexport const Composer = forwardRef<HTMLFormElement, ComposerProps>(({ children, ...props }, ref) => (\n <form ref={ref} data-slot=\"composer\" {...props}>\n {children}\n </form>\n));\nComposer.displayName = 'Composer';\n\nexport interface ComposerBoxProps extends ComponentPropsWithoutRef<'div'> {\n sendingPulseKey?: number;\n}\n\nexport const ComposerBox = forwardRef<HTMLDivElement, ComposerBoxProps>(\n ({ children, className, sendingPulseKey = 0, ...props }, ref) => (\n <div\n ref={ref}\n data-slot=\"composer-box\"\n className={cn(\n // The suggestions list and the input scroll flush with the top corners, so their scrollbars\n // take the inset for this radius.\n 'composer-box @container relative mx-auto mt-auto w-full max-w-3xl overflow-hidden rounded-[22px] border border-border transition-colors duration-normal scrollbar-inset-[22px] focus-within:border-border-strong',\n className,\n )}\n {...props}\n >\n <ComposerSendingPulse pulseKey={sendingPulseKey} />\n <div className=\"relative z-10\">{children}</div>\n </div>\n ),\n);\nComposerBox.displayName = 'ComposerBox';\n\nexport type ComposerTone = 'default' | 'green' | 'purple' | 'orange';\n\nexport interface ComposerRingProps extends ComponentPropsWithoutRef<'div'> {\n busy?: boolean;\n tone?: ComposerTone;\n}\n\nexport const ComposerRing = ({\n busy = false,\n tone = 'green',\n className,\n style,\n onPointerEnter,\n onPointerMove,\n ...props\n}: ComposerRingProps) => {\n const { trackPointer, pointerStyle } = useComposerPointer(!busy);\n\n return (\n <div\n data-slot=\"composer-ring\"\n data-composer-tone={tone}\n data-busy={busy ? 'true' : 'false'}\n className={cn('composer-ring relative mx-auto w-full max-w-3xl rounded-[23px] p-px', className)}\n style={{ ...pointerStyle, ...style }}\n onPointerEnter={event => {\n onPointerEnter?.(event);\n trackPointer(event);\n }}\n onPointerMove={event => {\n onPointerMove?.(event);\n trackPointer(event);\n }}\n {...props}\n />\n );\n};\nComposerRing.displayName = 'ComposerRing';\n\nexport const ComposerAttachments = forwardRef<HTMLDivElement, ComponentPropsWithoutRef<'div'>>(\n ({ className, ...props }, ref) => (\n <div\n ref={ref}\n role=\"region\"\n data-slot=\"composer-attachments\"\n className={cn('mx-auto w-full max-w-3xl pb-2', className)}\n {...props}\n />\n ),\n);\nComposerAttachments.displayName = 'ComposerAttachments';\n\nexport const ComposerInput = forwardRef<HTMLTextAreaElement, ComposerInputProps>(\n ({ className, variant = 'inline', maxHeight, autoComplete, ...props }, ref) => {\n const shellInputRef = useContext(ChatShellComposerInputContext);\n return (\n <ScrollArea maxHeight={maxHeight ?? (variant === 'textarea' ? '16rem' : '13rem')}>\n <textarea\n ref={mergeRefs(ref, shellInputRef)}\n data-slot=\"composer-input\"\n className={cn(\n 'field-sizing-content w-full resize-none overflow-hidden bg-transparent px-3 pt-2.5 pb-2 text-body zoom-safe-text text-muted-foreground outline-hidden placeholder:text-placeholder focus:outline-hidden disabled:cursor-not-allowed disabled:opacity-50',\n variant === 'textarea' ? 'min-h-28' : 'min-h-10',\n className,\n )}\n {...props}\n {...textFieldAutofillProps(autoComplete)}\n />\n </ScrollArea>\n );\n },\n);\nComposerInput.displayName = 'ComposerInput';\n\nexport const ComposerActions = forwardRef<HTMLDivElement, ComponentPropsWithoutRef<'div'>>(\n ({ className, ...props }, ref) => (\n <div\n ref={ref}\n role=\"region\"\n data-slot=\"composer-actions\"\n className={cn('flex w-full flex-wrap items-end justify-between gap-2 px-3 pb-3', className)}\n {...props}\n />\n ),\n);\nComposerActions.displayName = 'ComposerActions';\n\nconst ComposerGradientColumn = ({ className }: { className?: string }) => (\n <div className={cn('flex size-full flex-col -space-y-3', className)}>\n <div className=\"w-full flex-1 bg-brand-green blur-xl\" />\n <div className=\"w-full flex-1 bg-product-observability blur-xl\" />\n <div className=\"w-full flex-1 bg-brand-green blur-xl\" />\n <div className=\"w-full flex-1 bg-product-observability blur-xl\" />\n </div>\n);\n\nconst ComposerSendingPulse = ({ pulseKey }: { pulseKey: number }) => {\n if (pulseKey === 0) return null;\n\n return (\n <div\n key={pulseKey}\n aria-hidden=\"true\"\n data-slot=\"composer-sending-pulse\"\n className=\"composer-sending pointer-events-none absolute top-0 left-[-10%] z-0 flex h-10 w-[120%] transform-gpu\"\n >\n <ComposerGradientColumn />\n <ComposerGradientColumn className=\"-translate-y-2\" />\n <ComposerGradientColumn />\n </div>\n );\n};\n\nexport interface ComposerToneLabelProps extends ComponentPropsWithoutRef<'span'> {\n tone: ComposerTone;\n}\n\nexport function ComposerToneLabel({ tone, className, ...props }: ComposerToneLabelProps) {\n return <span data-composer-tone={tone} className={cn('composer-tone-label', className)} {...props} />;\n}\n","import { Collapsible } from '@base-ui/react/collapsible';\nimport type { ComponentPropsWithoutRef } from 'react';\nimport { forwardRef } from 'react';\n\nimport { cn } from '@/lib/utils';\n\nimport './composer-header.css';\n\nexport interface ComposerHeaderProps extends ComponentPropsWithoutRef<'div'> {\n /** Animate visibility while retaining content through the closing transition. */\n open?: boolean;\n}\n\n/** Optional context above ComposerRing or ComposerBox. Empty rendered content occupies no space. */\nexport const ComposerHeader = forwardRef<HTMLDivElement, ComposerHeaderProps>(\n ({ className, children, open = true, ...props }, ref) => (\n <Collapsible.Root\n ref={ref}\n open={open}\n data-slot=\"composer-header\"\n className={cn('composer-header relative isolate mx-auto w-full max-w-3xl', className)}\n {...props}\n >\n <Collapsible.Panel className=\"composer-header-panel\">\n <div\n data-slot=\"composer-header-surface\"\n className=\"flex flex-col gap-3 overflow-hidden rounded-t-[23px] border border-b-0 border-surface-rim bg-card px-3 pt-3 pb-8 text-body-sm text-muted-foreground empty:hidden\"\n >\n {children}\n </div>\n </Collapsible.Panel>\n </Collapsible.Root>\n ),\n);\nComposerHeader.displayName = 'ComposerHeader';\n\nexport interface ComposerHeaderRowProps extends ComponentPropsWithoutRef<'div'> {\n tone?: 'default' | 'destructive' | 'success';\n}\n\nexport const ComposerHeaderRow = forwardRef<HTMLDivElement, ComposerHeaderRowProps>(\n ({ className, tone = 'default', ...props }, ref) => (\n <div\n ref={ref}\n data-slot=\"composer-header-row\"\n className={cn(\n 'flex min-w-0 flex-wrap items-center gap-2 [&>svg]:size-icon-sm [&>svg]:shrink-0',\n tone === 'destructive' && 'text-destructive-foreground',\n tone === 'success' && 'text-success-indicator',\n className,\n )}\n {...props}\n />\n ),\n);\nComposerHeaderRow.displayName = 'ComposerHeaderRow';\n\nexport type ComposerHeaderContentProps = ComponentPropsWithoutRef<'div'>;\n\nexport const ComposerHeaderContent = forwardRef<HTMLDivElement, ComposerHeaderContentProps>(\n ({ className, ...props }, ref) => (\n <div\n ref={ref}\n data-slot=\"composer-header-content\"\n className={cn('min-w-0 flex-1 wrap-anywhere', className)}\n {...props}\n />\n ),\n);\nComposerHeaderContent.displayName = 'ComposerHeaderContent';\n\nexport type ComposerHeaderActionsProps = ComponentPropsWithoutRef<'div'>;\n\nexport const ComposerHeaderActions = forwardRef<HTMLDivElement, ComposerHeaderActionsProps>(\n ({ className, ...props }, ref) => (\n <div\n ref={ref}\n data-slot=\"composer-header-actions\"\n className={cn('ml-auto flex max-w-full shrink-0 flex-wrap items-center gap-2', className)}\n {...props}\n />\n ),\n);\nComposerHeaderActions.displayName = 'ComposerHeaderActions';\n","import { Collapsible } from '@base-ui/react/collapsible';\nimport { ArrowLeft, Check } from 'lucide-react';\nimport { useEffect, useRef } from 'react';\nimport { ScrollArea, ScrollAreaViewport } from '../../ScrollArea';\nimport { cn } from '@/lib/utils';\n\nexport interface ComposerSuggestionItem {\n id: string;\n label: string;\n description?: string;\n active?: boolean;\n}\n\nexport interface ComposerSuggestionsProps {\n id: string;\n items: readonly ComposerSuggestionItem[];\n activeIndex: number;\n contextLabel?: string;\n onBack?: () => void;\n onSelect: (index: number) => void;\n}\n\nexport function ComposerSuggestions({\n id,\n items,\n activeIndex,\n contextLabel,\n onBack,\n onSelect,\n}: ComposerSuggestionsProps) {\n const activeOption = useRef<HTMLButtonElement>(null);\n const activeItemId = items[activeIndex]?.id;\n const label = contextLabel ? `${contextLabel} options` : 'Slash commands';\n\n useEffect(() => {\n activeOption.current?.scrollIntoView({ block: 'nearest' });\n }, [activeItemId]);\n\n return (\n <Collapsible.Root open={items.length > 0}>\n <Collapsible.Panel className=\"h-[var(--collapsible-panel-height)] overflow-hidden transition-[height] duration-normal ease-out-custom data-[ending-style]:h-0 data-[starting-style]:h-0 motion-reduce:transition-none\">\n <div className=\"border-b border-border\" role=\"region\" aria-label={label}>\n {contextLabel && onBack && (\n <div className=\"border-b border-border px-1.5 py-1\">\n <button\n type=\"button\"\n className=\"flex items-center gap-1.5 rounded-xl px-2 py-1.5 text-caption text-muted-foreground transition-colors duration-normal ease-out-custom hover:bg-fill-subtle hover:text-foreground motion-reduce:transition-none\"\n aria-label=\"Back to slash commands\"\n onMouseDown={event => event.preventDefault()}\n onClick={onBack}\n >\n <ArrowLeft size={14} aria-hidden />\n <span>{contextLabel}</span>\n </button>\n </div>\n )}\n <ScrollArea maxHeight=\"min(22rem, 50dvh)\">\n <ScrollAreaViewport className=\"overscroll-y-contain\">\n <div id={id} role=\"listbox\" aria-label={label} className=\"flex flex-col gap-px p-1.5\">\n {items.map((item, index) => (\n <button\n ref={index === activeIndex ? activeOption : undefined}\n id={item.id}\n key={item.id}\n type=\"button\"\n role=\"option\"\n tabIndex={-1}\n aria-selected={index === activeIndex}\n aria-current={item.active ? 'true' : undefined}\n className={cn(\n 'flex w-full cursor-pointer items-center justify-between gap-4 rounded-2xl px-2 py-1.5 text-left text-caption transition-colors duration-normal ease-out-custom motion-reduce:transition-none',\n index === activeIndex\n ? 'bg-fill-subtle text-foreground'\n : 'text-muted-foreground hover:bg-fill-subtle hover:text-foreground',\n )}\n onMouseDown={event => event.preventDefault()}\n onClick={() => onSelect(index)}\n >\n <span className=\"max-w-[60%] min-w-0 shrink-0 truncate\" title={item.label}>\n {item.label}\n </span>\n {(item.description || item.active) && (\n <span className=\"flex min-w-0 items-center gap-1.5 text-right\">\n {item.description && (\n <span className=\"truncate\" title={item.description}>\n {item.description}\n </span>\n )}\n {item.active && (\n <span className=\"flex shrink-0 items-center gap-1\">\n <Check size={13} aria-hidden />\n Current\n </span>\n )}\n </span>\n )}\n </button>\n ))}\n </div>\n </ScrollAreaViewport>\n </ScrollArea>\n </div>\n </Collapsible.Panel>\n </Collapsible.Root>\n );\n}\n","export interface ComposerCommandOption {\n value: string;\n label: string;\n description?: string;\n active?: boolean;\n}\n\nexport interface ComposerCommand {\n name: string;\n description: string;\n options?: readonly ComposerCommandOption[];\n}\n\nexport function matchCommands<T extends Pick<ComposerCommand, 'name'>>(commands: readonly T[], draft: string): T[] {\n if (!draft.startsWith('/')) return [];\n const query = draft.slice(1).toLowerCase();\n if (/\\s/.test(query)) return [];\n return commands.filter(command => command.name.toLowerCase().startsWith(query));\n}\n\nexport function matchCommandOptions<T extends ComposerCommand>(commands: readonly T[], draft: string) {\n if (!draft.startsWith('/')) return undefined;\n const firstWhitespace = draft.search(/\\s/);\n if (firstWhitespace === -1) return undefined;\n const command = commands.find(candidate => candidate.name === draft.slice(1, firstWhitespace));\n if (!command?.options) return undefined;\n const query = draft.slice(firstWhitespace).trim().toLowerCase();\n if (/\\s/.test(query)) return undefined;\n const options = command.options.filter(option => option.value.toLowerCase().startsWith(query));\n return options.length > 0 ? { command, options } : undefined;\n}\n","import type { ChangeEvent, ComponentPropsWithoutRef, RefObject } from 'react';\nimport { useId, useState } from 'react';\nimport type { ComposerCommand, ComposerCommandOption } from './command-matches';\nimport { matchCommandOptions, matchCommands } from './command-matches';\nimport type { ComposerSuggestionItem, ComposerSuggestionsProps } from './composer-suggestions';\nimport { useKeydown } from '@/lib/keyboard/use-keydown';\n\nfunction createSuggestionItems(\n listId: string,\n commands: readonly ComposerCommand[],\n options?: readonly ComposerCommandOption[],\n): ComposerSuggestionItem[] {\n if (options)\n return options.map(option => ({ ...option, id: `${listId}-option-${encodeURIComponent(option.value)}` }));\n return commands.map(command => ({\n id: `${listId}-command-${encodeURIComponent(command.name)}`,\n label: `/${command.name}`,\n description: command.description,\n }));\n}\n\nexport interface UseComposerCommandsProps {\n commands: readonly ComposerCommand[];\n value: string;\n onValueChange: (value: string) => void;\n onSubmit: (value: string) => void;\n inputRef: RefObject<HTMLTextAreaElement | null>;\n enabled?: boolean;\n}\n\nexport function useComposerCommands({\n commands,\n value,\n onValueChange,\n onSubmit,\n inputRef,\n enabled = true,\n}: UseComposerCommandsProps) {\n const listId = useId();\n const [navigation, setNavigation] = useState({ value: '', index: 0 });\n const optionMatch = enabled ? matchCommandOptions(commands, value) : undefined;\n const matchingCommands = enabled && !optionMatch ? matchCommands(commands, value) : [];\n const items = createSuggestionItems(listId, matchingCommands, optionMatch?.options);\n const boundedIndex = Math.min(navigation.index, Math.max(0, items.length - 1));\n const activeIndex = navigation.value === value ? boundedIndex : 0;\n\n function updateValue(nextValue: string) {\n setNavigation({ value: nextValue, index: 0 });\n onValueChange(nextValue);\n }\n\n function returnToCommands() {\n updateValue(optionMatch ? `/${optionMatch.command.name}` : '');\n inputRef.current?.focus();\n }\n\n function selectSuggestion(index: number) {\n inputRef.current?.focus();\n if (optionMatch) {\n const option = optionMatch.options[index];\n if (option) onSubmit(`/${optionMatch.command.name} ${option.value}`);\n return;\n }\n const command = matchingCommands[index];\n if (command) updateValue(`/${command.name} `);\n }\n\n function moveSelection(direction: number) {\n setNavigation({ value, index: (activeIndex + direction + items.length) % items.length });\n }\n\n function shouldHandleCommandKey(event: KeyboardEvent) {\n const command = matchingCommands[activeIndex];\n const submitExactCommand =\n matchingCommands.length === 1 && value.toLowerCase() === `/${command?.name}` && !command?.options?.length;\n return event.key !== 'Enter' || !submitExactCommand;\n }\n\n useKeydown(\n {\n ArrowDown: () => moveSelection(1),\n ArrowUp: () => moveSelection(-1),\n Escape: returnToCommands,\n Tab: () => selectSuggestion(activeIndex),\n Enter: () => selectSuggestion(activeIndex),\n },\n {\n target: inputRef,\n enabled: items.length > 0,\n shouldHandle: shouldHandleCommandKey,\n },\n );\n\n const inputProps = {\n value,\n onChange: (event: ChangeEvent<HTMLTextAreaElement>) => updateValue(event.target.value),\n 'aria-autocomplete': 'list',\n 'aria-controls': items.length > 0 ? listId : undefined,\n 'aria-activedescendant': items[activeIndex]?.id,\n } satisfies ComponentPropsWithoutRef<'textarea'>;\n\n const suggestionsProps: ComposerSuggestionsProps = {\n id: listId,\n items,\n activeIndex,\n contextLabel: optionMatch ? `/${optionMatch.command.name}` : undefined,\n onBack: optionMatch ? returnToCommands : undefined,\n onSelect: selectSuggestion,\n };\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AI,aAAa;GACf,MAAM,SAAS,YAAY,QAAQ;GACnC,IAAI,QAAQ,SAAS,IAAI,YAAY,QAAQ,KAAK,GAAG,OAAO,OAAO;GACnE;EACF;EACA,MAAM,UAAU,iBAAiB;EACjC,IAAI,SAAS,YAAY,IAAI,QAAQ,KAAK,EAAE;CAC9C;CAEA,SAAS,cAAc,WAAmB;EACxC,cAAc;GAAE;GAAO,QAAQ,cAAc,YAAY,MAAM,UAAU,MAAM;EAAO,CAAC;CACzF;CAEA,SAAS,uBAAuB,OAAsB;EACpD,MAAM,UAAU,iBAAiB;EACjC,MAAM,qBACJ,iBAAiB,WAAW,KAAK,MAAM,YAAY,MAAM,IAAI,SAAS,UAAU,CAAC,SAAS,SAAS;EACrG,OAAO,MAAM,QAAQ,WAAW,CAAC;CACnC;CAEA,WACE;EACE,iBAAiB,cAAc,CAAC;EAChC,eAAe,cAAc,EAAE;EAC/B,QAAQ;EACR,WAAW,iBAAiB,WAAW;EACvC,aAAa,iBAAiB,WAAW;CAC3C,GACA;EACE,QAAQ;EACR,SAAS,MAAM,SAAS;EACxB,cAAc;CAChB,CACF;CAmBA,OAAO;EAAE,YAAA;GAhBP;GACA,WAAW,UAA4C,YAAY,MAAM,OAAO,KAAK;GACrF,qBAAqB;GACrB,iBAAiB,MAAM,SAAS,IAAI,SAAS,KAAA;GAC7C,yBAAyB,MAAM,YAAY,EAAE;EAYtC;EAAY,kBAAA;GARnB,IAAI;GACJ;GACA;GACA,cAAc,cAAc,IAAI,YAAY,QAAQ,SAAS,KAAA;GAC7D,QAAQ,cAAc,mBAAmB,KAAA;GACzC,UAAU;EAGS;CAAiB;AACxC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog-Duy3M1ny.cjs","names":["createContext","useContext","useState","useRef","useId","_Fragment","Button","cn","dialogSurfaceStyle","useIsMobile","React","Drawer","DialogPrimitive","cn","Button","X","DrawerContent","ScrollArea","ScrollAreaViewport"],"sources":["../src/ds/components/Dialog/dialog-context.ts","../src/ds/components/Dialog/dialog-action.tsx","../src/ds/components/Dialog/dialog-shell.ts","../src/ds/components/Dialog/dialog.tsx"],"sourcesContent":["import { createContext, useContext } from 'react';\n\nexport type DialogIntent = 'default' | 'destructive';\n\nexport type DialogContextValue = {\n intent: DialogIntent;\n pending: boolean;\n isDrawer: boolean;\n};\n\nexport const DialogContext = createContext<DialogContextValue>({\n intent: 'default',\n pending: false,\n isDrawer: false,\n});\n\nexport function useDialogContext() {\n return useContext(DialogContext);\n}\n\nexport const dialogActionSizeClasses = {\n sm: 'min-h-control-sm',\n md: 'min-h-control-md',\n lg: 'min-h-control-lg',\n} as const;\n\nexport const dialogActionLayoutClasses = 'h-auto min-w-0 max-w-full whitespace-normal wrap-anywhere max-[22rem]:w-full';\n","import { useEffect, useId, useRef, useState } from 'react';\nimport type { ComponentProps, KeyboardEvent, MouseEvent, PointerEvent } from 'react';\nimport { dialogActionLayoutClasses, dialogActionSizeClasses, useDialogContext } from './dialog-context';\nimport { Button } from '@/ds/components/Button';\nimport type { TextButtonSize } from '@/ds/components/Button';\nimport { cn } from '@/lib/utils';\n\ntype DialogActionButtonProps = Omit<ComponentProps<typeof Button>, 'onClick' | 'variant' | 'as' | 'type' | 'size'> & {\n size?: TextButtonSize;\n};\n\ntype DialogConfirmActionProps = DialogActionButtonProps & {\n type?: 'button';\n onConfirm: () => void;\n confirmation?: 'click' | 'hold';\n holdSeconds?: number;\n};\n\ntype DialogSubmitActionProps = DialogActionButtonProps & {\n type: 'submit';\n onConfirm?: never;\n confirmation?: never;\n holdSeconds?: never;\n};\n\nexport type DialogActionProps = DialogConfirmActionProps | DialogSubmitActionProps;\n\nconst ARM_WINDOW_MS = 4000;\n\nfunction HoldAction({\n onConfirm,\n children,\n disabled,\n holdSeconds = 1.5,\n ...props\n}: Omit<DialogConfirmActionProps, 'confirmation' | 'type'>) {\n const { intent, pending } = useDialogContext();\n const [holding, setHolding] = useState(false);\n const [completed, setCompleted] = useState(false);\n const [armed, setArmed] = useState(false);\n const timer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n const armTimer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n const active = useRef(false);\n const hintId = useId();\n\n function cancel() {\n clearTimeout(timer.current);\n active.current = false;\n setHolding(false);\n }\n\n function disarm() {\n clearTimeout(armTimer.current);\n setArmed(false);\n }\n\n function complete() {\n setHolding(false);\n setCompleted(true);\n disarm();\n onConfirm();\n }\n\n function start() {\n if (disabled || active.current) return;\n active.current = true;\n setHolding(true);\n timer.current = setTimeout(complete, holdSeconds * 1000);\n }\n\n function onClick(event: MouseEvent<HTMLButtonElement>) {\n event.preventDefault();\n if (event.detail !== 0 || disabled) return;\n if (armed) {\n complete();\n return;\n }\n setArmed(true);\n armTimer.current = setTimeout(() => setArmed(false), ARM_WINDOW_MS);\n }\n\n useEffect(() => {\n function onVisibilityChange() {\n if (document.hidden) cancel();\n }\n window.addEventListener('blur', cancel);\n document.addEventListener('visibilitychange', onVisibilityChange);\n return () => {\n clearTimeout(timer.current);\n clearTimeout(armTimer.current);\n window.removeEventListener('blur', cancel);\n document.removeEventListener('visibilitychange', onVisibilityChange);\n };\n }, []);\n\n function onPointerDown(event: PointerEvent<HTMLButtonElement>) {\n props.onPointerDown?.(event);\n if (event.defaultPrevented || event.button !== 0 || !event.isPrimary) return;\n start();\n }\n\n function onKeyDown(event: KeyboardEvent<HTMLButtonElement>) {\n props.onKeyDown?.(event);\n if (event.defaultPrevented || (event.key !== ' ' && event.key !== 'Enter')) return;\n event.preventDefault();\n if (!event.repeat) start();\n }\n\n return (\n <>\n <Button\n size=\"md\"\n {...props}\n className={cn(\n 'group/hold relative isolate touch-none overflow-hidden select-none',\n dialogActionLayoutClasses,\n dialogActionSizeClasses[props.size ?? 'md'],\n props.className,\n )}\n type=\"button\"\n variant={intent === 'destructive' ? 'destructive-ghost' : 'ghost'}\n disabled={disabled}\n aria-describedby={[props['aria-describedby'], hintId].filter(Boolean).join(' ')}\n data-holding={holding || undefined}\n data-completed={completed || pending || undefined}\n onClick={onClick}\n onPointerDown={onPointerDown}\n onPointerUp={event => {\n cancel();\n props.onPointerUp?.(event);\n }}\n onPointerLeave={event => {\n cancel();\n props.onPointerLeave?.(event);\n }}\n onPointerCancel={event => {\n cancel();\n props.onPointerCancel?.(event);\n }}\n onKeyDown={onKeyDown}\n onKeyUp={event => {\n if (event.key === ' ' || event.key === 'Enter') {\n event.preventDefault();\n cancel();\n }\n props.onKeyUp?.(event);\n }}\n onBlur={event => {\n cancel();\n props.onBlur?.(event);\n }}\n >\n <span>{children}</span>\n <span\n aria-hidden=\"true\"\n className={cn(\n 'pointer-events-none absolute inset-0 flex items-center justify-center px-[inherit] [clip-path:inset(0_100%_0_0)]',\n 'transition-[clip-path] ease-linear motion-reduce:transition-none',\n 'group-data-[holding]/hold:[clip-path:inset(0)] motion-reduce:group-data-[holding]/hold:[clip-path:inset(0_50%_0_0)]',\n 'group-data-[completed]/hold:[clip-path:inset(0)]',\n intent === 'destructive'\n ? 'bg-fill-destructive text-fill-destructive-foreground'\n : 'bg-foreground text-sidebar',\n )}\n style={{ transitionDuration: holding ? `${holdSeconds}s` : '0s' }}\n >\n {children}\n </span>\n </Button>\n <span id={hintId} className=\"sr-only\">\n Hold Space or Enter for {holdSeconds} seconds to confirm. Release to cancel. Screen reader users can activate\n twice.\n </span>\n <span role=\"status\" className=\"sr-only\">\n {armed ? 'Activate again to confirm.' : ''}\n </span>\n </>\n );\n}\n\nexport function DialogAction({\n confirmation = 'click',\n holdSeconds = 1.5,\n onConfirm,\n disabled,\n type = 'button',\n ...props\n}: DialogActionProps) {\n const { intent, pending } = useDialogContext();\n const isDisabled = disabled || pending;\n if (onConfirm && confirmation === 'hold') {\n return (\n <HoldAction\n key={`${isDisabled}-${holdSeconds}`}\n holdSeconds={holdSeconds}\n {...props}\n disabled={isDisabled}\n onConfirm={onConfirm}\n />\n );\n }\n return (\n <Button\n size=\"md\"\n {...props}\n className={cn(dialogActionLayoutClasses, dialogActionSizeClasses[props.size ?? 'md'], props.className)}\n type={type}\n variant={intent === 'destructive' ? 'destructive' : 'primary'}\n disabled={isDisabled}\n onClick={onConfirm}\n />\n );\n}\n","import { dialogSurfaceStyle } from '@/ds/primitives/raised-surface';\n\nexport type DialogSize = 'sm' | 'md' | 'lg' | 'xl' | 'full';\n\nexport const DIALOG_DRAWER_BREAKPOINT_PX = 640;\n\nconst formFillsShellClassName = '[&>form]:flex [&>form]:min-h-0 [&>form]:flex-1 [&>form]:flex-col [&>form]:gap-0';\n\nexport const dialogPopupClassName = [\n 'dialog-popup-motion fixed top-1/2 left-1/2 z-50 flex w-[calc(100%-2rem)] -translate-1/2 flex-col rounded-xl py-3 outline-hidden',\n formFillsShellClassName,\n dialogSurfaceStyle,\n].join(' ');\n\nexport const dialogContentSizeClasses: Record<DialogSize, string> = {\n sm: 'max-h-[calc(100dvh-4rem)] max-w-sm',\n md: 'max-h-[calc(100dvh-4rem)] max-w-lg',\n lg: 'max-h-[calc(100dvh-4rem)] max-w-2xl',\n xl: 'max-h-[calc(100dvh-4rem)] max-w-4xl',\n full: 'h-[calc(100dvh-2rem)]',\n};\n","import { Dialog as DialogPrimitive } from '@base-ui/react/dialog';\nimport { X } from 'lucide-react';\nimport * as React from 'react';\n\nimport { DialogAction } from './dialog-action';\nimport { DialogContext, dialogActionLayoutClasses, dialogActionSizeClasses, useDialogContext } from './dialog-context';\nimport type { DialogIntent } from './dialog-context';\nimport { DIALOG_DRAWER_BREAKPOINT_PX, dialogContentSizeClasses, dialogPopupClassName } from './dialog-shell';\nimport type { DialogSize } from './dialog-shell';\nimport { Button } from '@/ds/components/Button';\nimport type { TextButtonSize } from '@/ds/components/Button';\nimport { Drawer, DrawerContent } from '@/ds/components/Drawer';\nimport type { DrawerProps } from '@/ds/components/Drawer';\nimport { ScrollArea, ScrollAreaViewport } from '@/ds/components/ScrollArea';\nimport { useIsMobile } from '@/hooks/use-is-mobile';\nimport { cn } from '@/lib/utils';\n\nimport './dialog.css';\n\ntype DialogOpenChangeDetails = Parameters<NonNullable<DialogPrimitive.Root.Props['onOpenChange']>>[1];\ntype DrawerOpenChangeDetails = Parameters<NonNullable<DrawerProps['onOpenChange']>>[1];\n\nexport type DialogProps = Omit<DialogPrimitive.Root.Props, 'handle' | 'onOpenChange'> & {\n intent?: DialogIntent;\n pending?: boolean;\n /** `details` comes from the bottom drawer on phones, where a swipe can also close it. */\n onOpenChange?: (open: boolean, details: DialogOpenChangeDetails | DrawerOpenChangeDetails) => void;\n};\n\nconst useIsDrawer = () => useIsMobile(DIALOG_DRAWER_BREAKPOINT_PX);\n\n// Below 640px every dialog is a bottom drawer. Open state lives here so crossing the breakpoint keeps it open.\nfunction Dialog({\n intent = 'default',\n pending = false,\n open,\n defaultOpen = false,\n onOpenChange,\n disablePointerDismissal,\n ...props\n}: DialogProps) {\n const isDrawer = useIsDrawer();\n const [uncontrolledOpen, setUncontrolledOpen] = React.useState(defaultOpen);\n const rootProps = {\n ...props,\n open: open ?? uncontrolledOpen,\n disablePointerDismissal: disablePointerDismissal ?? intent === 'destructive',\n };\n\n function handleOpenChange(nextOpen: boolean, details: DialogOpenChangeDetails | DrawerOpenChangeDetails) {\n if (!nextOpen && pending) {\n details.cancel();\n return;\n }\n setUncontrolledOpen(nextOpen);\n onOpenChange?.(nextOpen, details);\n }\n\n return (\n <DialogContext.Provider value={{ intent, pending, isDrawer }}>\n {isDrawer ? (\n <Drawer {...rootProps} onOpenChange={handleOpenChange} />\n ) : (\n <DialogPrimitive.Root {...rootProps} onOpenChange={handleOpenChange} />\n )}\n </DialogContext.Provider>\n );\n}\n\nconst DialogTrigger = DialogPrimitive.Trigger;\n\nconst DialogPortal = DialogPrimitive.Portal;\n\nconst DialogClose = DialogPrimitive.Close;\n\ntype DialogOverlayProps = Omit<DialogPrimitive.Backdrop.Props, 'className'> & {\n className?: string;\n};\n\nfunction DialogOverlay({ className, ...props }: DialogOverlayProps) {\n return (\n <DialogPrimitive.Backdrop\n data-slot=\"dialog-overlay\"\n className={cn('dialog-backdrop-motion fixed inset-0 z-50 bg-scrim backdrop-blur-xs', className)}\n {...props}\n />\n );\n}\n\nexport type { DialogSize };\n\n// No `render` or function `style`: the popup is a Dialog or a Drawer, and their state callbacks differ.\ntype DialogContentProps = Omit<DialogPrimitive.Popup.Props, 'className' | 'render' | 'style'> & {\n className?: string;\n style?: React.CSSProperties;\n size?: DialogSize;\n showOverlay?: boolean;\n showCloseButton?: boolean;\n overlayClassName?: string;\n};\n\nfunction DialogContent({\n className,\n children,\n size = 'md',\n showOverlay = true,\n showCloseButton = true,\n overlayClassName,\n initialFocus,\n ...props\n}: DialogContentProps) {\n const { intent, pending, isDrawer } = useDialogContext();\n const closeRef = React.useRef<HTMLButtonElement>(null);\n const isDestructive = intent === 'destructive';\n const popupProps = {\n 'data-slot': 'dialog-content',\n 'data-size': size,\n 'data-intent': intent,\n role: isDestructive ? 'alertdialog' : 'dialog',\n initialFocus: initialFocus ?? (isDestructive && showCloseButton ? closeRef : true),\n 'aria-busy': pending || undefined,\n ...props,\n };\n const closeButton = showCloseButton && (\n <DialogPrimitive.Close\n ref={closeRef}\n disabled={pending}\n data-slot=\"dialog-close\"\n className={cn('absolute right-4', isDrawer ? 'top-1.5' : 'top-4')}\n render={\n <Button variant=\"ghost\" size=\"icon-sm\" aria-label=\"Close\">\n <X />\n </Button>\n }\n />\n );\n\n if (isDrawer) {\n return (\n <DrawerContent\n {...popupProps}\n showCloseButton={false}\n className={cn(\n 'pb-3',\n size === 'full' && 'h-[calc(85vh+3rem)]',\n showCloseButton && '[&_[data-slot=dialog-header]]:pr-12',\n className,\n )}\n >\n {children}\n {closeButton}\n {/* Fills the drawer's 3rem swipe bleed below the screen edge; an element so call-site padding can't shrink it. */}\n <div aria-hidden className=\"h-12 shrink-0\" />\n </DrawerContent>\n );\n }\n\n return (\n <DialogPortal>\n {showOverlay && <DialogOverlay className={overlayClassName} />}\n <DialogPrimitive.Popup\n {...popupProps}\n className={cn(\n dialogPopupClassName,\n dialogContentSizeClasses[size],\n showCloseButton && '[&_[data-slot=dialog-header]]:pr-12',\n className,\n )}\n >\n {children}\n {closeButton}\n </DialogPrimitive.Popup>\n </DialogPortal>\n );\n}\n\nfunction DialogHeader({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"dialog-header\"\n className={cn('flex min-w-0 shrink-0 flex-col gap-1 px-5 py-2', className)}\n {...props}\n />\n );\n}\n\nfunction DialogFooter({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"dialog-footer\"\n className={cn('flex shrink-0 flex-wrap items-center justify-end gap-2 px-5 py-2', className)}\n {...props}\n />\n );\n}\n\nexport type DialogBodyProps = React.ComponentProps<'div'> & {\n /** `scroll` fades and scrolls long content; `fill` takes the remaining height and leaves scrolling to its children. */\n layout?: 'scroll' | 'fill';\n /** Drops the inset so content such as split panes or code reaches the dialog's edges. */\n flush?: boolean;\n};\n\nfunction DialogBody({ className, layout = 'scroll', flush = false, children, ...props }: DialogBodyProps) {\n const bodyClassName = cn(\n 'flex min-w-0 flex-col gap-4 text-body wrap-break-word text-muted-foreground',\n !flush && 'px-5 py-2',\n className,\n );\n if (layout === 'fill') {\n return (\n <div data-slot=\"dialog-body\" className={cn('min-h-0 flex-1', bodyClassName)} {...props}>\n {children}\n </div>\n );\n }\n return (\n <ScrollArea className=\"flex min-h-0 min-w-0 flex-1 flex-col\" mask>\n <ScrollAreaViewport className=\"h-auto min-h-0\">\n <div data-slot=\"dialog-body\" className={bodyClassName} {...props}>\n {children}\n </div>\n </ScrollAreaViewport>\n </ScrollArea>\n );\n}\n\ntype DialogTitleProps = Omit<DialogPrimitive.Title.Props, 'className'> & {\n className?: string;\n};\n\nfunction DialogTitle({ className, ...props }: DialogTitleProps) {\n return <DialogPrimitive.Title className={cn('text-heading wrap-break-word text-foreground', className)} {...props} />;\n}\n\ntype DialogDescriptionProps = Omit<DialogPrimitive.Description.Props, 'className'> & {\n className?: string;\n};\n\nfunction DialogDescription({ className, ...props }: DialogDescriptionProps) {\n return (\n <DialogPrimitive.Description\n className={cn('text-body wrap-break-word text-muted-foreground', className)}\n {...props}\n />\n );\n}\n\ntype DialogCancelProps = DialogPrimitive.Close.Props & { size?: TextButtonSize };\n\nfunction DialogCancel({ disabled, size = 'md', ...props }: DialogCancelProps) {\n const { pending } = useDialogContext();\n return (\n <DialogPrimitive.Close\n render={\n <Button\n size={size}\n variant=\"ghost\"\n className={cn(dialogActionLayoutClasses, dialogActionSizeClasses[size])}\n children={props.children}\n />\n }\n {...props}\n disabled={disabled || pending}\n />\n );\n}\n\nexport {\n Dialog,\n DialogPortal,\n DialogOverlay,\n DialogTrigger,\n DialogClose,\n DialogContent,\n DialogHeader,\n DialogFooter,\n DialogBody,\n DialogTitle,\n DialogDescription,\n DialogCancel,\n DialogAction,\n};\n"],"mappings":";;;;;;;;;;;;;AAUA,IAAa,iBAAA,GAAgBA,MAAAA,cAAAA,CAAkC;CAC7D,QAAQ;CACR,SAAS;CACT,UAAU;AACZ,CAAC;AAED,SAAgB,mBAAmB;CACjC,QAAA,GAAOC,MAAAA,WAAAA,CAAW,aAAa;AACjC;AAEA,IAAa,0BAA0B;CACrC,IAAI;CACJ,IAAI;CACJ,IAAI;AACN;AAEA,IAAa,4BAA4B;;ACCzC,IAAM,gBAAgB;AAEtB,SAAS,WAAW,EAClB,WACA,UACA,UACA,cAAc,KACd,GAAG,SACuD;CAC1D,MAAM,EAAE,QAAQ,YAAY,iBAAiB;CAC7C,MAAM,CAAC,SAAS,eAAA,GAAcC,MAAAA,SAAAA,CAAS,KAAK;CAC5C,MAAM,CAAC,WAAW,iBAAA,GAAgBA,MAAAA,SAAAA,CAAS,KAAK;CAChD,MAAM,CAAC,OAAO,aAAA,GAAYA,MAAAA,SAAAA,CAAS,KAAK;CACxC,MAAM,SAAA,GAAQC,MAAAA,OAAAA,CAAkD,KAAA,CAAS;CACzE,MAAM,YAAA,GAAWA,MAAAA,OAAAA,CAAkD,KAAA,CAAS;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,"file":"Dialog-OBPu3rl2.js","names":["_Fragment","Dialog","React","DialogPrimitive"],"sources":["../src/ds/components/Dialog/dialog-context.ts","../src/ds/components/Dialog/dialog-action.tsx","../src/ds/components/Dialog/dialog-shell.ts","../src/ds/components/Dialog/dialog.tsx"],"sourcesContent":["import { createContext, useContext } from 'react';\n\nexport type DialogIntent = 'default' | 'destructive';\n\nexport type DialogContextValue = {\n intent: DialogIntent;\n pending: boolean;\n isDrawer: boolean;\n};\n\nexport const DialogContext = createContext<DialogContextValue>({\n intent: 'default',\n pending: false,\n isDrawer: false,\n});\n\nexport function useDialogContext() {\n return useContext(DialogContext);\n}\n\nexport const dialogActionSizeClasses = {\n sm: 'min-h-control-sm',\n md: 'min-h-control-md',\n lg: 'min-h-control-lg',\n} as const;\n\nexport const dialogActionLayoutClasses = 'h-auto min-w-0 max-w-full whitespace-normal wrap-anywhere max-[22rem]:w-full';\n","import { useEffect, useId, useRef, useState } from 'react';\nimport type { ComponentProps, KeyboardEvent, MouseEvent, PointerEvent } from 'react';\nimport { dialogActionLayoutClasses, dialogActionSizeClasses, useDialogContext } from './dialog-context';\nimport { Button } from '@/ds/components/Button';\nimport type { TextButtonSize } from '@/ds/components/Button';\nimport { cn } from '@/lib/utils';\n\ntype DialogActionButtonProps = Omit<ComponentProps<typeof Button>, 'onClick' | 'variant' | 'as' | 'type' | 'size'> & {\n size?: TextButtonSize;\n};\n\ntype DialogConfirmActionProps = DialogActionButtonProps & {\n type?: 'button';\n onConfirm: () => void;\n confirmation?: 'click' | 'hold';\n holdSeconds?: number;\n};\n\ntype DialogSubmitActionProps = DialogActionButtonProps & {\n type: 'submit';\n onConfirm?: never;\n confirmation?: never;\n holdSeconds?: never;\n};\n\nexport type DialogActionProps = DialogConfirmActionProps | DialogSubmitActionProps;\n\nconst ARM_WINDOW_MS = 4000;\n\nfunction HoldAction({\n onConfirm,\n children,\n disabled,\n holdSeconds = 1.5,\n ...props\n}: Omit<DialogConfirmActionProps, 'confirmation' | 'type'>) {\n const { intent, pending } = useDialogContext();\n const [holding, setHolding] = useState(false);\n const [completed, setCompleted] = useState(false);\n const [armed, setArmed] = useState(false);\n const timer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n const armTimer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n const active = useRef(false);\n const hintId = useId();\n\n function cancel() {\n clearTimeout(timer.current);\n active.current = false;\n setHolding(false);\n }\n\n function disarm() {\n clearTimeout(armTimer.current);\n setArmed(false);\n }\n\n function complete() {\n setHolding(false);\n setCompleted(true);\n disarm();\n onConfirm();\n }\n\n function start() {\n if (disabled || active.current) return;\n active.current = true;\n setHolding(true);\n timer.current = setTimeout(complete, holdSeconds * 1000);\n }\n\n function onClick(event: MouseEvent<HTMLButtonElement>) {\n event.preventDefault();\n if (event.detail !== 0 || disabled) return;\n if (armed) {\n complete();\n return;\n }\n setArmed(true);\n armTimer.current = setTimeout(() => setArmed(false), ARM_WINDOW_MS);\n }\n\n useEffect(() => {\n function onVisibilityChange() {\n if (document.hidden) cancel();\n }\n window.addEventListener('blur', cancel);\n document.addEventListener('visibilitychange', onVisibilityChange);\n return () => {\n clearTimeout(timer.current);\n clearTimeout(armTimer.current);\n window.removeEventListener('blur', cancel);\n document.removeEventListener('visibilitychange', onVisibilityChange);\n };\n }, []);\n\n function onPointerDown(event: PointerEvent<HTMLButtonElement>) {\n props.onPointerDown?.(event);\n if (event.defaultPrevented || event.button !== 0 || !event.isPrimary) return;\n start();\n }\n\n function onKeyDown(event: KeyboardEvent<HTMLButtonElement>) {\n props.onKeyDown?.(event);\n if (event.defaultPrevented || (event.key !== ' ' && event.key !== 'Enter')) return;\n event.preventDefault();\n if (!event.repeat) start();\n }\n\n return (\n <>\n <Button\n size=\"md\"\n {...props}\n className={cn(\n 'group/hold relative isolate touch-none overflow-hidden select-none',\n dialogActionLayoutClasses,\n dialogActionSizeClasses[props.size ?? 'md'],\n props.className,\n )}\n type=\"button\"\n variant={intent === 'destructive' ? 'destructive-ghost' : 'ghost'}\n disabled={disabled}\n aria-describedby={[props['aria-describedby'], hintId].filter(Boolean).join(' ')}\n data-holding={holding || undefined}\n data-completed={completed || pending || undefined}\n onClick={onClick}\n onPointerDown={onPointerDown}\n onPointerUp={event => {\n cancel();\n props.onPointerUp?.(event);\n }}\n onPointerLeave={event => {\n cancel();\n props.onPointerLeave?.(event);\n }}\n onPointerCancel={event => {\n cancel();\n props.onPointerCancel?.(event);\n }}\n onKeyDown={onKeyDown}\n onKeyUp={event => {\n if (event.key === ' ' || event.key === 'Enter') {\n event.preventDefault();\n cancel();\n }\n props.onKeyUp?.(event);\n }}\n onBlur={event => {\n cancel();\n props.onBlur?.(event);\n }}\n >\n <span>{children}</span>\n <span\n aria-hidden=\"true\"\n className={cn(\n 'pointer-events-none absolute inset-0 flex items-center justify-center px-[inherit] [clip-path:inset(0_100%_0_0)]',\n 'transition-[clip-path] ease-linear motion-reduce:transition-none',\n 'group-data-[holding]/hold:[clip-path:inset(0)] motion-reduce:group-data-[holding]/hold:[clip-path:inset(0_50%_0_0)]',\n 'group-data-[completed]/hold:[clip-path:inset(0)]',\n intent === 'destructive'\n ? 'bg-fill-destructive text-fill-destructive-foreground'\n : 'bg-foreground text-sidebar',\n )}\n style={{ transitionDuration: holding ? `${holdSeconds}s` : '0s' }}\n >\n {children}\n </span>\n </Button>\n <span id={hintId} className=\"sr-only\">\n Hold Space or Enter for {holdSeconds} seconds to confirm. Release to cancel. Screen reader users can activate\n twice.\n </span>\n <span role=\"status\" className=\"sr-only\">\n {armed ? 'Activate again to confirm.' : ''}\n </span>\n </>\n );\n}\n\nexport function DialogAction({\n confirmation = 'click',\n holdSeconds = 1.5,\n onConfirm,\n disabled,\n type = 'button',\n ...props\n}: DialogActionProps) {\n const { intent, pending } = useDialogContext();\n const isDisabled = disabled || pending;\n if (onConfirm && confirmation === 'hold') {\n return (\n <HoldAction\n key={`${isDisabled}-${holdSeconds}`}\n holdSeconds={holdSeconds}\n {...props}\n disabled={isDisabled}\n onConfirm={onConfirm}\n />\n );\n }\n return (\n <Button\n size=\"md\"\n {...props}\n className={cn(dialogActionLayoutClasses, dialogActionSizeClasses[props.size ?? 'md'], props.className)}\n type={type}\n variant={intent === 'destructive' ? 'destructive' : 'primary'}\n disabled={isDisabled}\n onClick={onConfirm}\n />\n );\n}\n","import { dialogSurfaceStyle } from '@/ds/primitives/raised-surface';\n\nexport type DialogSize = 'sm' | 'md' | 'lg' | 'xl' | 'full';\n\nexport const DIALOG_DRAWER_BREAKPOINT_PX = 640;\n\nconst formFillsShellClassName = '[&>form]:flex [&>form]:min-h-0 [&>form]:flex-1 [&>form]:flex-col [&>form]:gap-0';\n\nexport const dialogPopupClassName = [\n 'dialog-popup-motion fixed top-1/2 left-1/2 z-50 flex w-[calc(100%-2rem)] -translate-1/2 flex-col rounded-xl py-3 outline-hidden',\n formFillsShellClassName,\n dialogSurfaceStyle,\n].join(' ');\n\nexport const dialogContentSizeClasses: Record<DialogSize, string> = {\n sm: 'max-h-[calc(100dvh-4rem)] max-w-sm',\n md: 'max-h-[calc(100dvh-4rem)] max-w-lg',\n lg: 'max-h-[calc(100dvh-4rem)] max-w-2xl',\n xl: 'max-h-[calc(100dvh-4rem)] max-w-4xl',\n full: 'h-[calc(100dvh-2rem)]',\n};\n","import { Dialog as DialogPrimitive } from '@base-ui/react/dialog';\nimport { X } from 'lucide-react';\nimport * as React from 'react';\n\nimport { DialogAction } from './dialog-action';\nimport { DialogContext, dialogActionLayoutClasses, dialogActionSizeClasses, useDialogContext } from './dialog-context';\nimport type { DialogIntent } from './dialog-context';\nimport { DIALOG_DRAWER_BREAKPOINT_PX, dialogContentSizeClasses, dialogPopupClassName } from './dialog-shell';\nimport type { DialogSize } from './dialog-shell';\nimport { Button } from '@/ds/components/Button';\nimport type { TextButtonSize } from '@/ds/components/Button';\nimport { Drawer, DrawerContent } from '@/ds/components/Drawer';\nimport type { DrawerProps } from '@/ds/components/Drawer';\nimport { ScrollArea, ScrollAreaViewport } from '@/ds/components/ScrollArea';\nimport { useIsMobile } from '@/hooks/use-is-mobile';\nimport { cn } from '@/lib/utils';\n\nimport './dialog.css';\n\ntype DialogOpenChangeDetails = Parameters<NonNullable<DialogPrimitive.Root.Props['onOpenChange']>>[1];\ntype DrawerOpenChangeDetails = Parameters<NonNullable<DrawerProps['onOpenChange']>>[1];\n\nexport type DialogProps = Omit<DialogPrimitive.Root.Props, 'handle' | 'onOpenChange'> & {\n intent?: DialogIntent;\n pending?: boolean;\n /** `details` comes from the bottom drawer on phones, where a swipe can also close it. */\n onOpenChange?: (open: boolean, details: DialogOpenChangeDetails | DrawerOpenChangeDetails) => void;\n};\n\nconst useIsDrawer = () => useIsMobile(DIALOG_DRAWER_BREAKPOINT_PX);\n\n// Below 640px every dialog is a bottom drawer. Open state lives here so crossing the breakpoint keeps it open.\nfunction Dialog({\n intent = 'default',\n pending = false,\n open,\n defaultOpen = false,\n onOpenChange,\n disablePointerDismissal,\n ...props\n}: DialogProps) {\n const isDrawer = useIsDrawer();\n const [uncontrolledOpen, setUncontrolledOpen] = React.useState(defaultOpen);\n const rootProps = {\n ...props,\n open: open ?? uncontrolledOpen,\n disablePointerDismissal: disablePointerDismissal ?? intent === 'destructive',\n };\n\n function handleOpenChange(nextOpen: boolean, details: DialogOpenChangeDetails | DrawerOpenChangeDetails) {\n if (!nextOpen && pending) {\n details.cancel();\n return;\n }\n setUncontrolledOpen(nextOpen);\n onOpenChange?.(nextOpen, details);\n }\n\n return (\n <DialogContext.Provider value={{ intent, pending, isDrawer }}>\n {isDrawer ? (\n <Drawer {...rootProps} onOpenChange={handleOpenChange} />\n ) : (\n <DialogPrimitive.Root {...rootProps} onOpenChange={handleOpenChange} />\n )}\n </DialogContext.Provider>\n );\n}\n\nconst DialogTrigger = DialogPrimitive.Trigger;\n\nconst DialogPortal = DialogPrimitive.Portal;\n\nconst DialogClose = DialogPrimitive.Close;\n\ntype DialogOverlayProps = Omit<DialogPrimitive.Backdrop.Props, 'className'> & {\n className?: string;\n};\n\nfunction DialogOverlay({ className, ...props }: DialogOverlayProps) {\n return (\n <DialogPrimitive.Backdrop\n data-slot=\"dialog-overlay\"\n className={cn('dialog-backdrop-motion fixed inset-0 z-50 bg-scrim backdrop-blur-xs', className)}\n {...props}\n />\n );\n}\n\nexport type { DialogSize };\n\n// No `render` or function `style`: the popup is a Dialog or a Drawer, and their state callbacks differ.\ntype DialogContentProps = Omit<DialogPrimitive.Popup.Props, 'className' | 'render' | 'style'> & {\n className?: string;\n style?: React.CSSProperties;\n size?: DialogSize;\n showOverlay?: boolean;\n showCloseButton?: boolean;\n overlayClassName?: string;\n};\n\nfunction DialogContent({\n className,\n children,\n size = 'md',\n showOverlay = true,\n showCloseButton = true,\n overlayClassName,\n initialFocus,\n ...props\n}: DialogContentProps) {\n const { intent, pending, isDrawer } = useDialogContext();\n const closeRef = React.useRef<HTMLButtonElement>(null);\n const isDestructive = intent === 'destructive';\n const popupProps = {\n 'data-slot': 'dialog-content',\n 'data-size': size,\n 'data-intent': intent,\n role: isDestructive ? 'alertdialog' : 'dialog',\n initialFocus: initialFocus ?? (isDestructive && showCloseButton ? closeRef : true),\n 'aria-busy': pending || undefined,\n ...props,\n };\n const closeButton = showCloseButton && (\n <DialogPrimitive.Close\n ref={closeRef}\n disabled={pending}\n data-slot=\"dialog-close\"\n className={cn('absolute right-4', isDrawer ? 'top-1.5' : 'top-4')}\n render={\n <Button variant=\"ghost\" size=\"icon-sm\" aria-label=\"Close\">\n <X />\n </Button>\n }\n />\n );\n\n if (isDrawer) {\n return (\n <DrawerContent\n {...popupProps}\n showCloseButton={false}\n className={cn(\n 'pb-3',\n size === 'full' && 'h-[calc(85vh+3rem)]',\n showCloseButton && '[&_[data-slot=dialog-header]]:pr-12',\n className,\n )}\n >\n {children}\n {closeButton}\n {/* Fills the drawer's 3rem swipe bleed below the screen edge; an element so call-site padding can't shrink it. */}\n <div aria-hidden className=\"h-12 shrink-0\" />\n </DrawerContent>\n );\n }\n\n return (\n <DialogPortal>\n {showOverlay && <DialogOverlay className={overlayClassName} />}\n <DialogPrimitive.Popup\n {...popupProps}\n className={cn(\n dialogPopupClassName,\n dialogContentSizeClasses[size],\n showCloseButton && '[&_[data-slot=dialog-header]]:pr-12',\n className,\n )}\n >\n {children}\n {closeButton}\n </DialogPrimitive.Popup>\n </DialogPortal>\n );\n}\n\nfunction DialogHeader({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"dialog-header\"\n className={cn('flex min-w-0 shrink-0 flex-col gap-1 px-5 py-2', className)}\n {...props}\n />\n );\n}\n\nfunction DialogFooter({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"dialog-footer\"\n className={cn('flex shrink-0 flex-wrap items-center justify-end gap-2 px-5 py-2', className)}\n {...props}\n />\n );\n}\n\nexport type DialogBodyProps = React.ComponentProps<'div'> & {\n /** `scroll` fades and scrolls long content; `fill` takes the remaining height and leaves scrolling to its children. */\n layout?: 'scroll' | 'fill';\n /** Drops the inset so content such as split panes or code reaches the dialog's edges. */\n flush?: boolean;\n};\n\nfunction DialogBody({ className, layout = 'scroll', flush = false, children, ...props }: DialogBodyProps) {\n const bodyClassName = cn(\n 'flex min-w-0 flex-col gap-4 text-body wrap-break-word text-muted-foreground',\n !flush && 'px-5 py-2',\n className,\n );\n if (layout === 'fill') {\n return (\n <div data-slot=\"dialog-body\" className={cn('min-h-0 flex-1', bodyClassName)} {...props}>\n {children}\n </div>\n );\n }\n return (\n <ScrollArea className=\"flex min-h-0 min-w-0 flex-1 flex-col\" mask>\n <ScrollAreaViewport className=\"h-auto min-h-0\">\n <div data-slot=\"dialog-body\" className={bodyClassName} {...props}>\n {children}\n </div>\n </ScrollAreaViewport>\n </ScrollArea>\n );\n}\n\ntype DialogTitleProps = Omit<DialogPrimitive.Title.Props, 'className'> & {\n className?: string;\n};\n\nfunction DialogTitle({ className, ...props }: DialogTitleProps) {\n return <DialogPrimitive.Title className={cn('text-heading wrap-break-word text-foreground', className)} {...props} />;\n}\n\ntype DialogDescriptionProps = Omit<DialogPrimitive.Description.Props, 'className'> & {\n className?: string;\n};\n\nfunction DialogDescription({ className, ...props }: DialogDescriptionProps) {\n return (\n <DialogPrimitive.Description\n className={cn('text-body wrap-break-word text-muted-foreground', className)}\n {...props}\n />\n );\n}\n\ntype DialogCancelProps = DialogPrimitive.Close.Props & { size?: TextButtonSize };\n\nfunction DialogCancel({ disabled, size = 'md', ...props }: DialogCancelProps) {\n const { pending } = useDialogContext();\n return (\n <DialogPrimitive.Close\n render={\n <Button\n size={size}\n variant=\"ghost\"\n className={cn(dialogActionLayoutClasses, dialogActionSizeClasses[size])}\n children={props.children}\n />\n }\n {...props}\n disabled={disabled || pending}\n />\n );\n}\n\nexport {\n Dialog,\n DialogPortal,\n DialogOverlay,\n DialogTrigger,\n DialogClose,\n DialogContent,\n DialogHeader,\n DialogFooter,\n DialogBody,\n DialogTitle,\n DialogDescription,\n DialogCancel,\n DialogAction,\n};\n"],"mappings":";;;;;;;;;;;;AAUA,IAAa,gBAAgB,cAAkC;CAC7D,QAAQ;CACR,SAAS;CACT,UAAU;AACZ,CAAC;AAED,SAAgB,mBAAmB;CACjC,OAAO,WAAW,aAAa;AACjC;AAEA,IAAa,0BAA0B;CACrC,IAAI;CACJ,IAAI;CACJ,IAAI;AACN;AAEA,IAAa,4BAA4B;;ACCzC,IAAM,gBAAgB;AAEtB,SAAS,WAAW,EAClB,WACA,UACA,UACA,cAAc,KACd,GAAG,SACuD;CAC1D,MAAM,EAAE,QAAQ,YAAY,iBAAiB;CAC7C,MAAM,CAAC,SAAS,cAAc,SAAS,KAAK;CAC5C,MAAM,CAAC,WAAW,gBAAgB,SAAS,KAAK;CAChD,MAAM,CAAC,OAAO,YAAY,SAAS,KAAK;CACxC,MAAM,QAAQ,OAAkD,KAAA,CAAS;CACzE,MAAM,WAAW,OAAkD,KAAA,CAAS;CAC5E,MAAM,SAAS,OAAO,KAAK;CAC3B,MAAM,SAAS,MAAM;CAErB,SAAS,SAAS;E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-1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MarkdownRenderer-BSGb65Ze.js","names":[],"sources":["../src/ds/components/MarkdownRenderer/arriving.ts","../src/ds/components/MarkdownRenderer/blocks.ts","../src/ds/components/MarkdownRenderer/table-csv.ts","../src/ds/components/MarkdownRenderer/markdown-table.tsx","../src/ds/components/MarkdownRenderer/table-markdown.ts","../src/ds/components/MarkdownRenderer/use-settled.ts","../src/ds/components/MarkdownRenderer/markdown-renderer.tsx"],"sourcesContent":["import type { ExtraProps } from 'react-markdown';\n\nimport { ARRIVING_CLASS } from '@/ds/tokens';\n\nimport '@/ds/components/Arrival/arrival.css';\n\ntype MarkdownElement = NonNullable<ExtraProps['node']>;\ntype MarkdownChild = MarkdownElement['children'][number];\n\n/** Fades whole: a fence renders through `CodeBlock`, and inline code carries a background. */\nconst UNBROKEN = new Set(['pre', 'code']);\n\nconst wrap = (value: string, arriving: boolean): MarkdownChild => ({\n type: 'element',\n tagName: 'span',\n properties: arriving ? { className: [ARRIVING_CLASS] } : {},\n children: [{ type: 'text', value }],\n});\n\nfunction markArriving(node: MarkdownElement): void {\n const classes = node.properties.className;\n\n node.properties.className = Array.isArray(classes) ? [...classes, ARRIVING_CLASS] : [ARRIVING_CLASS];\n}\n\nfunction rebuild(nodes: MarkdownChild[], arriving: () => boolean): MarkdownChild[] {\n const out: MarkdownChild[] = [];\n\n for (const node of nodes) {\n if (node.type === 'text') {\n for (const piece of node.value.match(/\\S+|\\s+/g) ?? []) {\n if (/\\S/.test(piece)) out.push(wrap(piece, arriving()));\n else out.push({ type: 'text', value: piece });\n }\n\n continue;\n }\n\n out.push(node);\n\n if (node.type !== 'element') continue;\n\n if (!UNBROKEN.has(node.tagName)) node.children = rebuild(node.children, arriving);\n else if (arriving()) markArriving(node);\n }\n\n return out;\n}\n\n/**\n * Gives every word of a block an element of its own, and the entrance class to\n * those past the first `settled` — the words that were not on screen yet when\n * the reader joined this reply.\n *\n * Every word, not just the arriving ones: react-markdown parses afresh on each\n * landing and React matches the children it already mounted by position, so a\n * wrapper that came and went would land where a bare text node used to be and\n * remount half the paragraph, replaying entrances that had long finished.\n * Wrapping the lot keeps every position fixed — a new word only ever appends —\n * and a word never gains the class it did not mount with, so nothing replays.\n */\nexport function rehypeArriving(settled: number) {\n return function attach() {\n return (tree: { children: MarkdownChild[] }) => {\n let word = 0;\n\n tree.children = rebuild(tree.children, () => word++ >= settled);\n };\n };\n}\n","const FENCE_OPEN = /^ {0,3}(`{3,}|~{3,})/;\nconst FENCE_CLOSE = /^ {0,3}(`{3,}|~{3,})[ \\t]*$/;\nconst LIST_ITEM = /^ {0,3}(?:[-*+]|\\d{1,9}[.)])(?:[ \\t]|$)/;\nconst INDENTED = /^(?:\\t| {2,})/;\nconst DEFINITION = /^ {0,3}\\[[^\\]]+\\]:/;\n\nfunction fenceOpenedBy(line: string): string | undefined {\n return FENCE_OPEN.exec(line)?.[1];\n}\n\n// Both are runs of one character, so `startsWith` is \"same marker, at least as long\".\nfunction closesFence(line: string, marker: string): boolean {\n return FENCE_CLOSE.exec(line)?.[1]?.startsWith(marker) ?? false;\n}\n\nfunction startsBlock(line: string, inList: boolean): boolean {\n if (INDENTED.test(line)) return false;\n\n return !(inList && LIST_ITEM.test(line));\n}\n\n/**\n * Cuts markdown into top-level blocks so a growing reply re-parses its last\n * block instead of all of them. Rejoining the result returns the input, and\n * every block renders as it would have inside the whole.\n *\n * Each rule only ever merges: over-merging costs a re-parse, while cutting a\n * construct in two changes what it renders as. Link reference and footnote\n * definitions resolve across blank lines, which no line-level rule can see, so\n * reaching one outside a fence abandons the split for the whole text.\n */\nexport function splitBlocks(markdown: string): string[] {\n const lines = markdown.split('\\n');\n const starts = [0];\n let fence: string | undefined;\n let started = false;\n let broken = false;\n let inList = false;\n\n for (const [index, line] of lines.entries()) {\n if (fence) {\n if (closesFence(line, fence)) fence = undefined;\n continue;\n }\n\n if (line.trim() === '') {\n broken = started;\n continue;\n }\n\n if (DEFINITION.test(line)) return [markdown];\n\n if (broken && startsBlock(line, inList)) {\n starts.push(index);\n started = false;\n }\n\n if (!started) inList = LIST_ITEM.test(line);\n\n started = true;\n broken = false;\n fence = fenceOpenedBy(line);\n }\n\n return starts.map((start, position) => {\n const end = starts[position + 1];\n const block = lines.slice(start, end ?? lines.length).join('\\n');\n\n return end === undefined ? block : `${block}\\n`;\n });\n}\n","function spreadsheetCell(value: string): string {\n // Quoting alone does not stop spreadsheet apps from evaluating formulas.\n const numeric = /^[+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:e[+-]?\\d+)?$/i.test(value.trim());\n const formula = /^[\\s\\uFEFF]*[=+\\-@=+-@]/u.test(value);\n const controlPrefix = /^[\\t\\r\\n]/.test(value);\n const safe = controlPrefix || (formula && !numeric) ? `'${value}` : value;\n return `\"${safe.replaceAll('\"', '\"\"')}\"`;\n}\n\nexport function tableToCsv(rows: string[][]): string {\n return rows.map(row => row.map(spreadsheetCell).join(',')).join('\\r\\n');\n}\n\nexport function downloadTableCsv(csv: string): void {\n const blob = new Blob(['\\uFEFF', csv], { type: 'text/csv;charset=utf-8' });\n const url = URL.createObjectURL(blob);\n const anchor = document.createElement('a');\n anchor.href = url;\n anchor.download = 'table.csv';\n document.body.appendChild(anchor);\n anchor.click();\n anchor.remove();\n URL.revokeObjectURL(url);\n}\n","import { CheckIcon, ChevronDownIcon, CopyIcon, DownloadIcon } from 'lucide-react';\nimport type { ComponentProps } from 'react';\nimport type { ExtraProps } from 'react-markdown';\nimport { downloadTableCsv } from './table-csv';\nimport { Button } from '@/ds/components/Button';\nimport { ButtonsGroup } from '@/ds/components/ButtonsGroup';\nimport { DropdownMenu } from '@/ds/components/DropdownMenu';\nimport { useCopyToClipboard } from '@/hooks/use-copy-to-clipboard';\n\nexport function MarkdownTable({ node, children }: ComponentProps<'table'> & ExtraProps) {\n const markdown = node?.properties.tableMarkdown;\n const csv = node?.properties.tableCsv;\n const { isCopied, copyToClipboard } = useCopyToClipboard({ copyMessage: 'Copied table markdown' });\n\n return (\n <div className=\"my-3 w-fit max-w-full min-w-0\">\n <div className=\"flex justify-end\">\n <ButtonsGroup size=\"sm\" aria-label=\"Table actions\">\n <Button\n type=\"button\"\n variant=\"ghost\"\n disabled={typeof markdown !== 'string'}\n onClick={() => {\n if (typeof markdown === 'string') copyToClipboard(markdown);\n }}\n aria-label=\"Copy table as markdown\"\n >\n {isCopied ? <CheckIcon /> : <CopyIcon />}\n {isCopied ? 'Copied!' : 'Copy table as markdown'}\n </Button>\n <DropdownMenu>\n <DropdownMenu.Trigger\n disabled={typeof csv !== 'string'}\n render={\n <Button type=\"button\" size=\"icon-sm\" variant=\"ghost\" aria-label=\"More table options\">\n <ChevronDownIcon />\n </Button>\n }\n />\n <DropdownMenu.Content align=\"end\" size=\"sm\" className=\"w-max min-w-0\">\n <DropdownMenu.Item\n size=\"sm\"\n onClick={() => {\n if (typeof csv === 'string') downloadTableCsv(csv);\n }}\n >\n <DownloadIcon />\n Download CSV\n </DropdownMenu.Item>\n </DropdownMenu.Content>\n </DropdownMenu>\n </ButtonsGroup>\n </div>\n <div className=\"max-w-full overflow-x-auto\">\n <table className=\"table min-w-full\">{children}</table>\n </div>\n </div>\n );\n}\n","import type { Definition, FootnoteDefinition, Nodes, Root, Table } from 'mdast';\nimport { gfmToMarkdown } from 'mdast-util-gfm';\nimport { toMarkdown } from 'mdast-util-to-markdown';\nimport { tableToCsv } from './table-csv';\n\nfunction cellText(node: Nodes): string {\n if (node.type === 'footnoteReference') return `[^${node.label ?? node.identifier}]`;\n if ('value' in node) return node.value;\n if (node.type === 'image' || node.type === 'imageReference') return node.alt ?? '';\n return 'children' in node ? node.children.map(cellText).join('') : '';\n}\n\nfunction walk(node: Nodes, visit: (node: Nodes) => void): void {\n visit(node);\n if ('children' in node) node.children.forEach(child => walk(child, visit));\n}\n\nconst SERIALIZE_OPTIONS = { extensions: [gfmToMarkdown()] };\n\n/** Capture table exports before rehype replaces text with animation spans. */\nexport function remarkTableMarkdown() {\n return (tree: Root, file: { value: unknown }) => {\n const source = String(file.value);\n const definitions = new Map<string, Definition | FootnoteDefinition>();\n const tables: Table[] = [];\n walk(tree, node => {\n if (node.type === 'definition' || node.type === 'footnoteDefinition') {\n const key = `${node.type}:${node.identifier}`;\n if (!definitions.has(key)) definitions.set(key, node);\n }\n if (node.type === 'table') tables.push(node);\n });\n\n const lines = source.split(/\\r\\n|\\r|\\n/);\n for (const table of tables) {\n const header = table.children[0];\n if (!header?.position) continue;\n const rows = table.children.map(row => {\n const start = row.position?.start.offset;\n const end = row.position?.end.offset;\n return start === undefined || end === undefined ? undefined : source.slice(start, end);\n });\n // Only offer exports when the parser supplied the original row locations.\n if (!rows.every(row => row !== undefined)) continue;\n // Row positions exclude list/blockquote prefixes. The delimiter has no AST node.\n const delimiter = lines[header.position.start.line]?.replace(/^[\\t >]*/, '');\n if (delimiter === undefined) continue;\n const markdown = [rows[0], delimiter, ...rows.slice(1)];\n const used = new Set<string>();\n const collectReference = (node: Nodes) => {\n if (node.type === 'linkReference' || node.type === 'imageReference') {\n used.add(`definition:${node.identifier}`);\n } else if (node.type === 'footnoteReference') {\n used.add(`footnoteDefinition:${node.identifier}`);\n }\n };\n walk(table, collectReference);\n // Visiting appended definitions also collects links/footnotes they depend on.\n // The set prevents duplicates and cycles, including self-referencing footnotes.\n for (const key of used) {\n const definition = definitions.get(key);\n if (!definition) continue;\n markdown.push('', toMarkdown(definition, SERIALIZE_OPTIONS).trimEnd());\n walk(definition, collectReference);\n }\n const cells = table.children.map(row =>\n Array.from({ length: header.children.length }, (_, index) => {\n const cell = row.children[index];\n return cell ? cellText(cell) : '';\n }),\n );\n table.data = {\n ...table.data,\n hProperties: {\n ...table.data?.hProperties,\n tableMarkdown: markdown.join('\\n'),\n tableCsv: tableToCsv(cells),\n },\n };\n }\n };\n}\n","import { useEffect, useRef, useState } from 'react';\n\nimport { useWatched } from '@/ds/components/Arrival';\nimport { ARRIVING_MS } from '@/ds/tokens';\n\ninterface Landing {\n words: number;\n at: number;\n}\n\n/**\n * How many of a reply's words have been on screen long enough that their entrance is over.\n *\n * The entrance plays on whatever mounts carrying the class, so it replays every time a\n * word's element is rebuilt — and markdown rebuilds a growing tail constantly: a `-`\n * turns a paragraph into a list item, a closing `**` splits it around a `<strong>`, the\n * stream ends and the mend comes off. Each of those swaps the element a settled word\n * lives in, which is what makes a word already read fade in again.\n *\n * Ageing them out is the whole answer: a word carries the class only while it is new,\n * so however often the tail is rebuilt, only what is genuinely arriving animates.\n *\n * What counts as new at mount is not this hook's call. A reply the reader was handed\n * is already there, and a block that mounts complete — a card's output, an expanded\n * body — enters with its container. Only a passage born streaming under the reader's\n * eyes is new from its first word: the reveal often lands several words in its first\n * commit, and they enter like every word after them.\n */\nexport function useSettledWords(words: number, streaming: boolean): number {\n const watched = useWatched();\n const [settled, setSettled] = useState(() => (watched && streaming ? 0 : words));\n const landings = useRef<Landing[]>([]);\n const recorded = useRef(settled);\n\n useEffect(() => {\n if (recorded.current !== words) {\n landings.current.push({ words, at: performance.now() });\n recorded.current = words;\n }\n\n const waiting = landings.current[0];\n if (!waiting) return;\n\n const timer = setTimeout(\n () => {\n landings.current.shift();\n setSettled(waiting.words);\n },\n Math.max(0, waiting.at + ARRIVING_MS - performance.now()),\n );\n\n return () => clearTimeout(timer);\n }, [settled, words]);\n\n // A shorter reply replacing the one on screen settles at once: nothing of it is new.\n return Math.min(settled, words);\n}\n","import { memo, useMemo } from 'react';\nimport type { MouseEvent, MouseEventHandler, ReactNode } from 'react';\nimport Markdown from 'react-markdown';\nimport type { Components, ExtraProps, Options } from 'react-markdown';\nimport remarkGfm from 'remark-gfm';\nimport remend from 'remend';\n\nimport { rehypeArriving } from './arriving';\nimport { splitBlocks } from './blocks';\nimport { MarkdownTable } from './markdown-table';\nimport { remarkTableMarkdown } from './table-markdown';\nimport { useSettledWords } from './use-settled';\nimport { CodeBlock } from '@/ds/components/CodeBlock';\nimport { cn } from '@/lib/utils';\n\nimport './markdown-renderer.css';\n\nexport type MarkdownExternalLinkTarget = 'tab' | 'window';\n\ntype RemarkPlugins = NonNullable<Options['remarkPlugins']>;\n\nexport interface MarkdownRendererProps {\n children: string;\n className?: string;\n externalLinkTarget?: MarkdownExternalLinkTarget;\n /** The text is a prefix of one still being written: close the markers the stream has not reached. */\n streaming?: boolean;\n /** Opt in to table copy/download controls; disabled while this text is streaming. */\n tableActions?: boolean;\n /** Remark plugins run after the built-in ones, e.g. to turn a syntax of the host's into elements. Keep it stable. */\n remarkPlugins?: RemarkPlugins;\n /** Element overrides merged over the built-in ones. Keep it stable: a new object re-renders every block. */\n components?: Components;\n}\n\n/**\n * Renders a markdown string. Agent output can carry attacker-influenced text\n * (file contents, tool output, web pages): react-markdown escapes raw HTML and\n * drops dangerous link schemes, so nothing here reaches the DOM as markup.\n *\n * react-markdown re-parses on every render, and a streaming reply re-renders\n * its whole transcript on every delta. Memoizing spares the settled messages;\n * rendering block by block — streaming or not — spares every block of the live\n * one but the last, and lets a reply settle without remounting what is already\n * on screen.\n *\n * The text is drawn as given: pacing a stream is `useRevealedText`, and belongs to\n * whoever owns the whole of what is being laid down — a reply is prose, tool rows\n * and cards, and they have to arrive in the order they were written. Only what\n * lands after the reader joined plays an entrance, and only while it is still new:\n * a reply opened part-written is already there, and fading in what someone is\n * halfway through reading would be both a lie and a screenful of animations at\n * once.\n */\nexport const MarkdownRenderer = memo(function MarkdownRenderer({\n children,\n className,\n externalLinkTarget = 'tab',\n streaming = false,\n tableActions = false,\n remarkPlugins: extraRemarkPlugins,\n components: extraComponents,\n}: MarkdownRendererProps) {\n const shown = decodeEscapedNewlines(children);\n const blocks = useMemo(() => splitBlocks(shown), [shown]);\n const last = blocks.length - 1;\n const baseComponents = (tableActions ? TABLE_COMPONENTS : DEFAULT_COMPONENTS)[externalLinkTarget];\n const components = useMemo(\n () => (extraComponents ? { ...baseComponents, ...extraComponents } : baseComponents),\n [baseComponents, extraComponents],\n );\n\n const spans = wordSpans(blocks);\n const settled = useSettledWords(spans.at(-1)?.end ?? 0, streaming);\n\n // A block whose words have all finished their entrance has nothing left to play,\n // which is what `undefined` says: leave it as plain text, no spans at all.\n const settledWords = (span: WordSpan | undefined): number | undefined =>\n !span || settled >= span.end ? undefined : Math.max(0, settled - span.start);\n\n const tail = blocks[last] ?? '';\n const mended = useMemo(() => (streaming ? remend(tail, REMEND_OPTIONS) : tail), [streaming, tail]);\n\n return (\n <div className={cn('mastra-markdown', className)}>\n {blocks.map((block, index) => (\n <MarkdownBlock\n key={index}\n content={index === last ? mended : block}\n settledWords={settledWords(spans[index])}\n components={components}\n streaming={streaming}\n tableActions={tableActions}\n extraRemarkPlugins={extraRemarkPlugins}\n />\n ))}\n </div>\n );\n});\n\n/** Keyed by position at the call site: a content key remounts on every character. */\nconst MarkdownBlock = memo(function MarkdownBlock({\n components,\n content,\n settledWords,\n streaming,\n tableActions,\n extraRemarkPlugins,\n}: {\n components: Components;\n content: string;\n settledWords?: number;\n streaming: boolean;\n tableActions: boolean;\n extraRemarkPlugins?: RemarkPlugins;\n}) {\n const remarkPlugins = useMemo(() => {\n const builtIn = tableActions && !streaming ? COPYABLE_REMARK_PLUGINS : REMARK_PLUGINS;\n return extraRemarkPlugins ? [...builtIn, ...extraRemarkPlugins] : builtIn;\n }, [tableActions, streaming, extraRemarkPlugins]);\n const rehypePlugins = useMemo(\n () => (settledWords === undefined ? SETTLED : [rehypeArriving(settledWords)]),\n [settledWords],\n );\n\n return (\n <Markdown remarkPlugins={remarkPlugins} rehypePlugins={rehypePlugins} components={components}>\n {content}\n </Markdown>\n );\n});\n\nconst SETTLED: Options['rehypePlugins'] = [];\n\ninterface WordSpan {\n start: number;\n end: number;\n}\n\n/**\n * Where each block's words fall in the reply's own count, so one settled count covers\n * them all. Counting the source counts its markers too, so the boundary only ever errs\n * towards leaving a word unanimated.\n */\nfunction wordSpans(blocks: string[]): WordSpan[] {\n let read = 0;\n\n return blocks.map(block => {\n const span = { start: read, end: read + countWords(block) };\n read = span.end;\n\n return span;\n });\n}\n\nfunction countWords(text: string): number {\n return text.match(/\\S+/g)?.length ?? 0;\n}\n\n// Agent networks emit their text with literal `\\n`. Only unescape when the text\n// has no real newline, otherwise a `\"a\\nb\"` inside a code fence gets shredded.\nfunction decodeEscapedNewlines(text: string): string {\n return text.includes('\\n') ? text : text.replace(/\\\\n/g, '\\n');\n}\n\ntype MarkdownNode = NonNullable<ExtraProps['node']>;\n\nfunction languageOf(node: MarkdownNode): string | undefined {\n const classNames = node.properties.className;\n if (!Array.isArray(classNames)) return undefined;\n\n const language = classNames.find(entry => typeof entry === 'string' && entry.startsWith('language-'));\n return typeof language === 'string' ? language.slice('language-'.length) : undefined;\n}\n\nfunction fencedCode(node: MarkdownNode | undefined): { code: string; language?: string } | undefined {\n const child = node?.children.find(entry => entry.type === 'element' && entry.tagName === 'code');\n if (child?.type !== 'element') return undefined;\n\n const code = child.children.map(entry => (entry.type === 'text' ? entry.value : '')).join('');\n return { code: code.replace(/\\n$/, ''), language: languageOf(child) };\n}\n\nfunction MarkdownCodeBlock({\n node,\n children,\n className,\n}: {\n node?: MarkdownNode;\n children?: ReactNode;\n className?: string;\n}) {\n const fenced = fencedCode(node);\n if (!fenced) return <pre className={className}>{children}</pre>;\n\n return (\n <CodeBlock\n code={fenced.code}\n lang={fenced.language}\n overflow=\"scroll\"\n className={cn('my-3 bg-sidebar', className)}\n copyMessage=\"Copied code to clipboard\"\n />\n );\n}\n\nconst POPUP_WINDOW_FEATURES = 'popup=yes,width=720,height=800,resizable=yes,scrollbars=yes';\n\nfunction isPlainLeftClick(event: MouseEvent): boolean {\n return event.button === 0 && !event.metaKey && !event.ctrlKey && !event.shiftKey && !event.altKey;\n}\n\nfunction markdownLink(externalLinkTarget: MarkdownExternalLinkTarget): NonNullable<Components['a']> {\n return function MarkdownLink({ href, title, children }) {\n const isExternal = /^https?:\\/\\//i.test(href ?? '');\n\n const openInPopup: MouseEventHandler<HTMLAnchorElement> = event => {\n if (!isExternal || externalLinkTarget !== 'window' || !isPlainLeftClick(event)) return;\n\n const popup = window.open(href, '_blank', POPUP_WINDOW_FEATURES);\n if (!popup) return;\n\n popup.opener = null;\n event.preventDefault();\n };\n\n return (\n <a\n href={href}\n title={title}\n onClick={openInPopup}\n target={isExternal ? '_blank' : undefined}\n rel={isExternal ? 'noopener noreferrer' : undefined}\n >\n {children}\n </a>\n );\n };\n}\n\nconst REMARK_PLUGINS = [remarkGfm];\nconst COPYABLE_REMARK_PLUGINS = [remarkGfm, remarkTableMarkdown];\n\n// Links stay text until their URL lands: remend's placeholder href would render\n// a live anchor to nowhere. No math is rendered here, so pairing `$$` would only\n// turn one literal into another.\nconst REMEND_OPTIONS = { katex: false, linkMode: 'text-only' } as const;\n\n// Elements are listed one by one: react-markdown also passes its `node`, which\n// React would forward to the DOM as a stray attribute. Everything else is\n// styled from markdown-renderer.css.\nconst COMPONENTS: Components = {\n pre: MarkdownCodeBlock,\n a: markdownLink('tab'),\n};\n\nconst WINDOW_COMPONENTS: Components = {\n ...COMPONENTS,\n a: markdownLink('window'),\n};\n\nconst DEFAULT_COMPONENTS = { tab: COMPONENTS, window: WINDOW_COMPONENTS };\nconst TABLE_COMPONENTS = {\n tab: { ...COMPONENTS, table: MarkdownTable },\n window: { ...WINDOW_COMPONENTS, table: MarkdownTable },\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAUA,IAAM,2BAAW,IAAI,IAAI,CAAC,OAAO,MAAM,CAAC;AAExC,IAAM,QAAQ,OAAe,cAAsC;CACjE,MAAM;CACN,SAAS;CACT,YAAY,WAAW,EAAE,WAAW,CAAC,cAAc,EAAE,IAAI,CAAC;CAC1D,UAAU,CAAC;EAAE,MAAM;EAAQ;CAAM,CAAC;AACpC;AAEA,SAAS,aAAa,MAA6B;CACjD,MAAM,UAAU,KAAK,WAAW;CAEhC,KAAK,WAAW,YAAY,MAAM,QAAQ,OAAO,IAAI,CAAC,GAAG,SAAS,cAAc,IAAI,CAAC,cAAc;AACrG;AAEA,SAAS,QAAQ,OAAwB,UAA0C;CACj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aAAa,WAAW,KAAA;GAChC,KAAK,aAAa,wBAAwB,KAAA;GAEzC;EACA,CAAA;CAEP;AACF;AAEA,IAAM,iBAAiB,CAAC,SAAS;AACjC,IAAM,0BAA0B,CAAC,WAAW,mBAAmB;AAK/D,IAAM,iBAAiB;CAAE,OAAO;CAAO,UAAU;AAAY;AAK7D,IAAM,aAAyB;CAC7B,KAAK;CACL,GAAG,aAAa,KAAK;AACvB;AAEA,IAAM,oBAAgC;CACpC,GAAG;CACH,GAAG,aAAa,QAAQ;AAC1B;AAEA,IAAM,qBAAqB;CAAE,KAAK;CAAY,QAAQ;AAAkB;AACxE,IAAM,mBAAmB;CACvB,KAAK;EAAE,GAAG;EAAY,OAAO;CAAc;CAC3C,QAAQ;EAAE,GAAG;EAAmB,OAAO;CAAc;AACvD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MarkdownRenderer-CDwlvw0Y.cjs","names":["ARRIVING_CLASS","useCopyToClipboard","ButtonsGroup","Button","CheckIcon","CopyIcon","DropdownMenu","ChevronDownIcon","DownloadIcon","gfmToMarkdown","toMarkdown","useWatched","useState","useRef","memo","useMemo","cn","Markdown","CodeBlock","remarkGfm"],"sources":["../src/ds/components/MarkdownRenderer/arriving.ts","../src/ds/components/MarkdownRenderer/blocks.ts","../src/ds/components/MarkdownRenderer/table-csv.ts","../src/ds/components/MarkdownRenderer/markdown-table.tsx","../src/ds/components/MarkdownRenderer/table-markdown.ts","../src/ds/components/MarkdownRenderer/use-settled.ts","../src/ds/components/MarkdownRenderer/markdown-renderer.tsx"],"sourcesContent":["import type { ExtraProps } from 'react-markdown';\n\nimport { ARRIVING_CLASS } from '@/ds/tokens';\n\nimport '@/ds/components/Arrival/arrival.css';\n\ntype MarkdownElement = NonNullable<ExtraProps['node']>;\ntype MarkdownChild = MarkdownElement['children'][number];\n\n/** Fades whole: a fence renders through `CodeBlock`, and inline code carries a background. */\nconst UNBROKEN = new Set(['pre', 'code']);\n\nconst wrap = (value: string, arriving: boolean): MarkdownChild => ({\n type: 'element',\n tagName: 'span',\n properties: arriving ? { className: [ARRIVING_CLASS] } : {},\n children: [{ type: 'text', value }],\n});\n\nfunction markArriving(node: MarkdownElement): void {\n const classes = node.properties.className;\n\n node.properties.className = Array.isArray(classes) ? [...classes, ARRIVING_CLASS] : [ARRIVING_CLASS];\n}\n\nfunction rebuild(nodes: MarkdownChild[], arriving: () => boolean): MarkdownChild[] {\n const out: MarkdownChild[] = [];\n\n for (const node of nodes) {\n if (node.type === 'text') {\n for (const piece of node.value.match(/\\S+|\\s+/g) ?? []) {\n if (/\\S/.test(piece)) out.push(wrap(piece, arriving()));\n else out.push({ type: 'text', value: piece });\n }\n\n continue;\n }\n\n out.push(node);\n\n if (node.type !== 'element') continue;\n\n if (!UNBROKEN.has(node.tagName)) node.children = rebuild(node.children, arriving);\n else if (arriving()) markArriving(node);\n }\n\n return out;\n}\n\n/**\n * Gives every word of a block an element of its own, and the entrance class to\n * those past the first `settled` — the words that were not on screen yet when\n * the reader joined this reply.\n *\n * Every word, not just the arriving ones: react-markdown parses afresh on each\n * landing and React matches the children it already mounted by position, so a\n * wrapper that came and went would land where a bare text node used to be and\n * remount half the paragraph, replaying entrances that had long finished.\n * Wrapping the lot keeps every position fixed — a new word only ever appends —\n * and a word never gains the class it did not mount with, so nothing replays.\n */\nexport function rehypeArriving(settled: number) {\n return function attach() {\n return (tree: { children: MarkdownChild[] }) => {\n let word = 0;\n\n tree.children = rebuild(tree.children, () => word++ >= settled);\n };\n };\n}\n","const FENCE_OPEN = /^ {0,3}(`{3,}|~{3,})/;\nconst FENCE_CLOSE = /^ {0,3}(`{3,}|~{3,})[ \\t]*$/;\nconst LIST_ITEM = /^ {0,3}(?:[-*+]|\\d{1,9}[.)])(?:[ \\t]|$)/;\nconst INDENTED = /^(?:\\t| {2,})/;\nconst DEFINITION = /^ {0,3}\\[[^\\]]+\\]:/;\n\nfunction fenceOpenedBy(line: string): string | undefined {\n return FENCE_OPEN.exec(line)?.[1];\n}\n\n// Both are runs of one character, so `startsWith` is \"same marker, at least as long\".\nfunction closesFence(line: string, marker: string): boolean {\n return FENCE_CLOSE.exec(line)?.[1]?.startsWith(marker) ?? false;\n}\n\nfunction startsBlock(line: string, inList: boolean): boolean {\n if (INDENTED.test(line)) return false;\n\n return !(inList && LIST_ITEM.test(line));\n}\n\n/**\n * Cuts markdown into top-level blocks so a growing reply re-parses its last\n * block instead of all of them. Rejoining the result returns the input, and\n * every block renders as it would have inside the whole.\n *\n * Each rule only ever merges: over-merging costs a re-parse, while cutting a\n * construct in two changes what it renders as. Link reference and footnote\n * definitions resolve across blank lines, which no line-level rule can see, so\n * reaching one outside a fence abandons the split for the whole text.\n */\nexport function splitBlocks(markdown: string): string[] {\n const lines = markdown.split('\\n');\n const starts = [0];\n let fence: string | undefined;\n let started = false;\n let broken = false;\n let inList = false;\n\n for (const [index, line] of lines.entries()) {\n if (fence) {\n if (closesFence(line, fence)) fence = undefined;\n continue;\n }\n\n if (line.trim() === '') {\n broken = started;\n continue;\n }\n\n if (DEFINITION.test(line)) return [markdown];\n\n if (broken && startsBlock(line, inList)) {\n starts.push(index);\n started = false;\n }\n\n if (!started) inList = LIST_ITEM.test(line);\n\n started = true;\n broken = false;\n fence = fenceOpenedBy(line);\n }\n\n return starts.map((start, position) => {\n const end = starts[position + 1];\n const block = lines.slice(start, end ?? lines.length).join('\\n');\n\n return end === undefined ? block : `${block}\\n`;\n });\n}\n","function spreadsheetCell(value: string): string {\n // Quoting alone does not stop spreadsheet apps from evaluating formulas.\n const numeric = /^[+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:e[+-]?\\d+)?$/i.test(value.trim());\n const formula = /^[\\s\\uFEFF]*[=+\\-@=+-@]/u.test(value);\n const controlPrefix = /^[\\t\\r\\n]/.test(value);\n const safe = controlPrefix || (formula && !numeric) ? `'${value}` : value;\n return `\"${safe.replaceAll('\"', '\"\"')}\"`;\n}\n\nexport function tableToCsv(rows: string[][]): string {\n return rows.map(row => row.map(spreadsheetCell).join(',')).join('\\r\\n');\n}\n\nexport function downloadTableCsv(csv: string): void {\n const blob = new Blob(['\\uFEFF', csv], { type: 'text/csv;charset=utf-8' });\n const url = URL.createObjectURL(blob);\n const anchor = document.createElement('a');\n anchor.href = url;\n anchor.download = 'table.csv';\n document.body.appendChild(anchor);\n anchor.click();\n anchor.remove();\n URL.revokeObjectURL(url);\n}\n","import { CheckIcon, ChevronDownIcon, CopyIcon, DownloadIcon } from 'lucide-react';\nimport type { ComponentProps } from 'react';\nimport type { ExtraProps } from 'react-markdown';\nimport { downloadTableCsv } from './table-csv';\nimport { Button } from '@/ds/components/Button';\nimport { ButtonsGroup } from '@/ds/components/ButtonsGroup';\nimport { DropdownMenu } from '@/ds/components/DropdownMenu';\nimport { useCopyToClipboard } from '@/hooks/use-copy-to-clipboard';\n\nexport function MarkdownTable({ node, children }: ComponentProps<'table'> & ExtraProps) {\n const markdown = node?.properties.tableMarkdown;\n const csv = node?.properties.tableCsv;\n const { isCopied, copyToClipboard } = useCopyToClipboard({ copyMessage: 'Copied table markdown' });\n\n return (\n <div className=\"my-3 w-fit max-w-full min-w-0\">\n <div className=\"flex justify-end\">\n <ButtonsGroup size=\"sm\" aria-label=\"Table actions\">\n <Button\n type=\"button\"\n variant=\"ghost\"\n disabled={typeof markdown !== 'string'}\n onClick={() => {\n if (typeof markdown === 'string') copyToClipboard(markdown);\n }}\n aria-label=\"Copy table as markdown\"\n >\n {isCopied ? <CheckIcon /> : <CopyIcon />}\n {isCopied ? 'Copied!' : 'Copy table as markdown'}\n </Button>\n <DropdownMenu>\n <DropdownMenu.Trigger\n disabled={typeof csv !== 'string'}\n render={\n <Button type=\"button\" size=\"icon-sm\" variant=\"ghost\" aria-label=\"More table options\">\n <ChevronDownIcon />\n </Button>\n }\n />\n <DropdownMenu.Content align=\"end\" size=\"sm\" className=\"w-max min-w-0\">\n <DropdownMenu.Item\n size=\"sm\"\n onClick={() => {\n if (typeof csv === 'string') downloadTableCsv(csv);\n }}\n >\n <DownloadIcon />\n Download CSV\n </DropdownMenu.Item>\n </DropdownMenu.Content>\n </DropdownMenu>\n </ButtonsGroup>\n </div>\n <div className=\"max-w-full overflow-x-auto\">\n <table className=\"table min-w-full\">{children}</table>\n </div>\n </div>\n );\n}\n","import type { Definition, FootnoteDefinition, Nodes, Root, Table } from 'mdast';\nimport { gfmToMarkdown } from 'mdast-util-gfm';\nimport { toMarkdown } from 'mdast-util-to-markdown';\nimport { tableToCsv } from './table-csv';\n\nfunction cellText(node: Nodes): string {\n if (node.type === 'footnoteReference') return `[^${node.label ?? node.identifier}]`;\n if ('value' in node) return node.value;\n if (node.type === 'image' || node.type === 'imageReference') return node.alt ?? '';\n return 'children' in node ? node.children.map(cellText).join('') : '';\n}\n\nfunction walk(node: Nodes, visit: (node: Nodes) => void): void {\n visit(node);\n if ('children' in node) node.children.forEach(child => walk(child, visit));\n}\n\nconst SERIALIZE_OPTIONS = { extensions: [gfmToMarkdown()] };\n\n/** Capture table exports before rehype replaces text with animation spans. */\nexport function remarkTableMarkdown() {\n return (tree: Root, file: { value: unknown }) => {\n const source = String(file.value);\n const definitions = new Map<string, Definition | FootnoteDefinition>();\n const tables: Table[] = [];\n walk(tree, node => {\n if (node.type === 'definition' || node.type === 'footnoteDefinition') {\n const key = `${node.type}:${node.identifier}`;\n if (!definitions.has(key)) definitions.set(key, node);\n }\n if (node.type === 'table') tables.push(node);\n });\n\n const lines = source.split(/\\r\\n|\\r|\\n/);\n for (const table of tables) {\n const header = table.children[0];\n if (!header?.position) continue;\n const rows = table.children.map(row => {\n const start = row.position?.start.offset;\n const end = row.position?.end.offset;\n return start === undefined || end === undefined ? undefined : source.slice(start, end);\n });\n // Only offer exports when the parser supplied the original row locations.\n if (!rows.every(row => row !== undefined)) continue;\n // Row positions exclude list/blockquote prefixes. The delimiter has no AST node.\n const delimiter = lines[header.position.start.line]?.replace(/^[\\t >]*/, '');\n if (delimiter === undefined) continue;\n const markdown = [rows[0], delimiter, ...rows.slice(1)];\n const used = new Set<string>();\n const collectReference = (node: Nodes) => {\n if (node.type === 'linkReference' || node.type === 'imageReference') {\n used.add(`definition:${node.identifier}`);\n } else if (node.type === 'footnoteReference') {\n used.add(`footnoteDefinition:${node.identifier}`);\n }\n };\n walk(table, collectReference);\n // Visiting appended definitions also collects links/footnotes they depend on.\n // The set prevents duplicates and cycles, including self-referencing footnotes.\n for (const key of used) {\n const definition = definitions.get(key);\n if (!definition) continue;\n markdown.push('', toMarkdown(definition, SERIALIZE_OPTIONS).trimEnd());\n walk(definition, collectReference);\n }\n const cells = table.children.map(row =>\n Array.from({ length: header.children.length }, (_, index) => {\n const cell = row.children[index];\n return cell ? cellText(cell) : '';\n }),\n );\n table.data = {\n ...table.data,\n hProperties: {\n ...table.data?.hProperties,\n tableMarkdown: markdown.join('\\n'),\n tableCsv: tableToCsv(cells),\n },\n };\n }\n };\n}\n","import { useEffect, useRef, useState } from 'react';\n\nimport { useWatched } from '@/ds/components/Arrival';\nimport { ARRIVING_MS } from '@/ds/tokens';\n\ninterface Landing {\n words: number;\n at: number;\n}\n\n/**\n * How many of a reply's words have been on screen long enough that their entrance is over.\n *\n * The entrance plays on whatever mounts carrying the class, so it replays every time a\n * word's element is rebuilt — and markdown rebuilds a growing tail constantly: a `-`\n * turns a paragraph into a list item, a closing `**` splits it around a `<strong>`, the\n * stream ends and the mend comes off. Each of those swaps the element a settled word\n * lives in, which is what makes a word already read fade in again.\n *\n * Ageing them out is the whole answer: a word carries the class only while it is new,\n * so however often the tail is rebuilt, only what is genuinely arriving animates.\n *\n * What counts as new at mount is not this hook's call. A reply the reader was handed\n * is already there, and a block that mounts complete — a card's output, an expanded\n * body — enters with its container. Only a passage born streaming under the reader's\n * eyes is new from its first word: the reveal often lands several words in its first\n * commit, and they enter like every word after them.\n */\nexport function useSettledWords(words: number, streaming: boolean): number {\n const watched = useWatched();\n const [settled, setSettled] = useState(() => (watched && streaming ? 0 : words));\n const landings = useRef<Landing[]>([]);\n const recorded = useRef(settled);\n\n useEffect(() => {\n if (recorded.current !== words) {\n landings.current.push({ words, at: performance.now() });\n recorded.current = words;\n }\n\n const waiting = landings.current[0];\n if (!waiting) return;\n\n const timer = setTimeout(\n () => {\n landings.current.shift();\n setSettled(waiting.words);\n },\n Math.max(0, waiting.at + ARRIVING_MS - performance.now()),\n );\n\n return () => clearTimeout(timer);\n }, [settled, words]);\n\n // A shorter reply replacing the one on screen settles at once: nothing of it is new.\n return Math.min(settled, words);\n}\n","import { memo, useMemo } from 'react';\nimport type { MouseEvent, MouseEventHandler, ReactNode } from 'react';\nimport Markdown from 'react-markdown';\nimport type { Components, ExtraProps, Options } from 'react-markdown';\nimport remarkGfm from 'remark-gfm';\nimport remend from 'remend';\n\nimport { rehypeArriving } from './arriving';\nimport { splitBlocks } from './blocks';\nimport { MarkdownTable } from './markdown-table';\nimport { remarkTableMarkdown } from './table-markdown';\nimport { useSettledWords } from './use-settled';\nimport { CodeBlock } from '@/ds/components/CodeBlock';\nimport { cn } from '@/lib/utils';\n\nimport './markdown-renderer.css';\n\nexport type MarkdownExternalLinkTarget = 'tab' | 'window';\n\ntype RemarkPlugins = NonNullable<Options['remarkPlugins']>;\n\nexport interface MarkdownRendererProps {\n children: string;\n className?: string;\n externalLinkTarget?: MarkdownExternalLinkTarget;\n /** The text is a prefix of one still being written: close the markers the stream has not reached. */\n streaming?: boolean;\n /** Opt in to table copy/download controls; disabled while this text is streaming. */\n tableActions?: boolean;\n /** Remark plugins run after the built-in ones, e.g. to turn a syntax of the host's into elements. Keep it stable. */\n remarkPlugins?: RemarkPlugins;\n /** Element overrides merged over the built-in ones. Keep it stable: a new object re-renders every block. */\n components?: Components;\n}\n\n/**\n * Renders a markdown string. Agent output can carry attacker-influenced text\n * (file contents, tool output, web pages): react-markdown escapes raw HTML and\n * drops dangerous link schemes, so nothing here reaches the DOM as markup.\n *\n * react-markdown re-parses on every render, and a streaming reply re-renders\n * its whole transcript on every delta. Memoizing spares the settled messages;\n * rendering block by block — streaming or not — spares every block of the live\n * one but the last, and lets a reply settle without remounting what is already\n * on screen.\n *\n * The text is drawn as given: pacing a stream is `useRevealedText`, and belongs to\n * whoever owns the whole of what is being laid down — a reply is prose, tool rows\n * and cards, and they have to arrive in the order they were written. Only what\n * lands after the reader joined plays an entrance, and only while it is still new:\n * a reply opened part-written is already there, and fading in what someone is\n * halfway through reading would be both a lie and a screenful of animations at\n * once.\n */\nexport const MarkdownRenderer = memo(function MarkdownRenderer({\n children,\n className,\n externalLinkTarget = 'tab',\n streaming = false,\n tableActions = false,\n remarkPlugins: extraRemarkPlugins,\n components: extraComponents,\n}: MarkdownRendererProps) {\n const shown = decodeEscapedNewlines(children);\n const blocks = useMemo(() => splitBlocks(shown), [shown]);\n const last = blocks.length - 1;\n const baseComponents = (tableActions ? TABLE_COMPONENTS : DEFAULT_COMPONENTS)[externalLinkTarget];\n const components = useMemo(\n () => (extraComponents ? { ...baseComponents, ...extraComponents } : baseComponents),\n [baseComponents, extraComponents],\n );\n\n const spans = wordSpans(blocks);\n const settled = useSettledWords(spans.at(-1)?.end ?? 0, streaming);\n\n // A block whose words have all finished their entrance has nothing left to play,\n // which is what `undefined` says: leave it as plain text, no spans at all.\n const settledWords = (span: WordSpan | undefined): number | undefined =>\n !span || settled >= span.end ? undefined : Math.max(0, settled - span.start);\n\n const tail = blocks[last] ?? '';\n const mended = useMemo(() => (streaming ? remend(tail, REMEND_OPTIONS) : tail), [streaming, tail]);\n\n return (\n <div className={cn('mastra-markdown', className)}>\n {blocks.map((block, index) => (\n <MarkdownBlock\n key={index}\n content={index === last ? mended : block}\n settledWords={settledWords(spans[index])}\n components={components}\n streaming={streaming}\n tableActions={tableActions}\n extraRemarkPlugins={extraRemarkPlugins}\n />\n ))}\n </div>\n );\n});\n\n/** Keyed by position at the call site: a content key remounts on every character. */\nconst MarkdownBlock = memo(function MarkdownBlock({\n components,\n content,\n settledWords,\n streaming,\n tableActions,\n extraRemarkPlugins,\n}: {\n components: Components;\n content: string;\n settledWords?: number;\n streaming: boolean;\n tableActions: boolean;\n extraRemarkPlugins?: RemarkPlugins;\n}) {\n const remarkPlugins = useMemo(() => {\n const builtIn = tableActions && !streaming ? COPYABLE_REMARK_PLUGINS : REMARK_PLUGINS;\n return extraRemarkPlugins ? [...builtIn, ...extraRemarkPlugins] : builtIn;\n }, [tableActions, streaming, extraRemarkPlugins]);\n const rehypePlugins = useMemo(\n () => (settledWords === undefined ? SETTLED : [rehypeArriving(settledWords)]),\n [settledWords],\n );\n\n return (\n <Markdown remarkPlugins={remarkPlugins} rehypePlugins={rehypePlugins} components={components}>\n {content}\n </Markdown>\n );\n});\n\nconst SETTLED: Options['rehypePlugins'] = [];\n\ninterface WordSpan {\n start: number;\n end: number;\n}\n\n/**\n * Where each block's words fall in the reply's own count, so one settled count covers\n * them all. Counting the source counts its markers too, so the boundary only ever errs\n * towards leaving a word unanimated.\n */\nfunction wordSpans(blocks: string[]): WordSpan[] {\n let read = 0;\n\n return blocks.map(block => {\n const span = { start: read, end: read + countWords(block) };\n read = span.end;\n\n return span;\n });\n}\n\nfunction countWords(text: string): number {\n return text.match(/\\S+/g)?.length ?? 0;\n}\n\n// Agent networks emit their text with literal `\\n`. Only unescape when the text\n// has no real newline, otherwise a `\"a\\nb\"` inside a code fence gets shredded.\nfunction decodeEscapedNewlines(text: string): string {\n return text.includes('\\n') ? text : text.replace(/\\\\n/g, '\\n');\n}\n\ntype MarkdownNode = NonNullable<ExtraProps['node']>;\n\nfunction languageOf(node: MarkdownNode): string | undefined {\n const classNames = node.properties.className;\n if (!Array.isArray(classNames)) return undefined;\n\n const language = classNames.find(entry => typeof entry === 'string' && entry.startsWith('language-'));\n return typeof language === 'string' ? language.slice('language-'.length) : undefined;\n}\n\nfunction fencedCode(node: MarkdownNode | undefined): { code: string; language?: string } | undefined {\n const child = node?.children.find(entry => entry.type === 'element' && entry.tagName === 'code');\n if (child?.type !== 'element') return undefined;\n\n const code = child.children.map(entry => (entry.type === 'text' ? entry.value : '')).join('');\n return { code: code.replace(/\\n$/, ''), language: languageOf(child) };\n}\n\nfunction MarkdownCodeBlock({\n node,\n children,\n className,\n}: {\n node?: MarkdownNode;\n children?: ReactNode;\n className?: string;\n}) {\n const fenced = fencedCode(node);\n if (!fenced) return <pre className={className}>{children}</pre>;\n\n return (\n <CodeBlock\n code={fenced.code}\n lang={fenced.language}\n overflow=\"scroll\"\n className={cn('my-3 bg-sidebar', className)}\n copyMessage=\"Copied code to clipboard\"\n />\n );\n}\n\nconst POPUP_WINDOW_FEATURES = 'popup=yes,width=720,height=800,resizable=yes,scrollbars=yes';\n\nfunction isPlainLeftClick(event: MouseEvent): boolean {\n return event.button === 0 && !event.metaKey && !event.ctrlKey && !event.shiftKey && !event.altKey;\n}\n\nfunction markdownLink(externalLinkTarget: MarkdownExternalLinkTarget): NonNullable<Components['a']> {\n return function MarkdownLink({ href, title, children }) {\n const isExternal = /^https?:\\/\\//i.test(href ?? '');\n\n const openInPopup: MouseEventHandler<HTMLAnchorElement> = event => {\n if (!isExternal || externalLinkTarget !== 'window' || !isPlainLeftClick(event)) return;\n\n const popup = window.open(href, '_blank', POPUP_WINDOW_FEATURES);\n if (!popup) return;\n\n popup.opener = null;\n event.preventDefault();\n };\n\n return (\n <a\n href={href}\n title={title}\n onClick={openInPopup}\n target={isExternal ? '_blank' : undefined}\n rel={isExternal ? 'noopener noreferrer' : undefined}\n >\n {children}\n </a>\n );\n };\n}\n\nconst REMARK_PLUGINS = [remarkGfm];\nconst COPYABLE_REMARK_PLUGINS = [remarkGfm, remarkTableMarkdown];\n\n// Links stay text until their URL lands: remend's placeholder href would render\n// a live anchor to nowhere. No math is rendered here, so pairing `$$` would only\n// turn one literal into another.\nconst REMEND_OPTIONS = { katex: false, linkMode: 'text-only' } as const;\n\n// Elements are listed one by one: react-markdown also passes its `node`, which\n// React would forward to the DOM as a stray attribute. Everything else is\n// styled from markdown-renderer.css.\nconst COMPONENTS: Components = {\n pre: MarkdownCodeBlock,\n a: markdownLink('tab'),\n};\n\nconst WINDOW_COMPONENTS: Components = {\n ...COMPONENTS,\n a: markdownLink('window'),\n};\n\nconst DEFAULT_COMPONENTS = { tab: COMPONENTS, window: WINDOW_COMPONENTS };\nconst TABLE_COMPONENTS = {\n tab: { ...COMPONENTS, table: MarkdownTable },\n window: { ...WINDOW_COMPONENTS, table: MarkdownTable },\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAUA,IAAM,2BAAW,IAAI,IAAI,CAAC,OAAO,MAAM,CAAC;AAExC,IAAM,QAAQ,OAAe,cAAsC;CACjE,MAAM;CACN,SAAS;CACT,YAAY,WAAW,EAAE,WAAW,CAACA,eAAAA,cAAc,EAAE,IAAI,CAAC;CAC1D,UAAU,CAAC;EAAE,MAAM;EAAQ;CAAM,CAAC;AACpC;AAEA,SAAS,aAAa,MAA6B;CACjD,MAAM,UAAU,KAAK,WAAW;CAEhC,KAAK,WAAW,YAAY,MAAM,QAAQ,OAAO,IAAI,CAAC,GAAG,SAASA,eAAAA,cAAc,IAAI,CAACA,eAAAA,cAAc;AACrG;AAEA,SAAS,QAAQ,OAAwB,UAA0C;CACjF,MAAM,MAAuB,CAAC;CAE9B,KAAK,MAAM,QAAQ,OAAO;EACxB,IAAI,KAAK,SAAS,QAAQ;GACxB,KAAK,MAAM,SAAS,KAAK,MAAM,MAAM,UAAU,KAAK,CAAC,GACnD,IAAI,KAAK,KAAK,KAAK,GAAG,IAAI,KAAK,KAAK,OAAO,SAAS,CAAC,CAAC;QACjD,IAAI,KAAK;IAAE,MAAM;IAAQ,OAAO;GAAM,CAAC;GAG9C;EACF;EAEA,IAAI,KAAK,IAAI;EAEb,IAAI,KAAK,SAAS,WAAW;EAE7B,IAAI,CAAC,SAAS,IAAI,KAAK,OAAO,GAAG,KAAK,WAAW,QAAQ,KAAK,UAAU,QAAQ;OAC3E,IAAI,SAAS,GAAG,aAAa,IAAI;CACxC;CAEA,OAAO;AACT;;;;;;;;;;;;;AAcA,SAAgB,eAAe,SAAiB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CAAC,MAAM;AAC7F;AAEA,SAAS,aAAa,oBAA8E;CAClG,OAAO,SAAS,aAAa,EAAE,MAAM,OAAO,YAAY;EACtD,MAAM,aAAa,gBAAgB,KAAK,QAAQ,EAAE;EAElD,MAAM,eAAoD,UAAS;GACjE,IAAI,CAAC,cAAc,uBAAuB,YAAY,CAAC,iBAAiB,KAAK,GAAG;GAEhF,MAAM,QAAQ,OAAO,KAAK,MAAM,UAAU,qBAAqB;GAC/D,IAAI,CAAC,OAAO;GAEZ,MAAM,SAAS;GACf,MAAM,eAAe;EACvB;EAEA,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,KAAD;GACQ;GACC;GACP,SAAS;GACT,QAAQ,aAAa,WAAW,KAAA;GAChC,KAAK,aAAa,wBAAwB,KAAA;GAEzC;EACA,CAAA;CAEP;AACF;AAEA,IAAM,iBAAiB,CAACG,WAAAA,OAAS;AACjC,IAAM,0BAA0B,CAACA,WAAAA,SAAW,mBAAmB;AAK/D,IAAM,iBAAiB;CAAE,OAAO;CAAO,UAAU;AAAY;AAK7D,IAAM,aAAyB;CAC7B,KAAK;CACL,GAAG,aAAa,KAAK;AACvB;AAEA,IAAM,oBAAgC;CACpC,GAAG;CACH,GAAG,aAAa,QAAQ;AAC1B;AAEA,IAAM,qBAAqB;CAAE,KAAK;CAAY,QAAQ;AAAkB;AACxE,IAAM,mBAAmB;CACvB,KAAK;EAAE,GAAG;EAAY,OAAO;CAAc;CAC3C,QAAQ;EAAE,GAAG;EAAmB,OAAO;CAAc;AACvD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MetricsLineChart-4w5lpH63.js","names":[],"sources":["../src/ds/components/MetricsLineChart/metrics-line-chart-legend.tsx","../src/ds/components/MetricsLineChart/metrics-line-chart-tooltip.tsx","../src/ds/components/MetricsLineChart/metrics-line-chart.tsx"],"sourcesContent":["import type { MetricsLineChartSeries } from './metrics-line-chart';\nimport { Txt } from '@/ds/components/Txt';\nimport { cn } from '@/lib/utils';\n\n/** A marker and a label per series. Totals belong in the card's header, not here. */\nexport function MetricsLineChartLegend({\n series,\n className,\n}: {\n series: Pick<MetricsLineChartSeries, 'dataKey' | 'label' | 'color' | 'dashed'>[];\n className?: string;\n}) {\n return (\n <div className={cn('flex flex-wrap items-center gap-x-4 gap-y-1', className)}>\n {series.map(s => (\n <div key={s.dataKey} className=\"inline-flex items-center gap-1.5\">\n {s.dashed ? (\n <span className=\"h-0 w-3 shrink-0 border-t-2 border-dashed\" style={{ borderColor: s.color }} />\n ) : (\n <div className=\"size-2 shrink-0 rounded-[2px]\" style={{ backgroundColor: s.color }} />\n )}\n <Txt as=\"span\" variant=\"body-sm\" tone=\"muted\" className=\"max-w-48 truncate\">\n {s.label}\n </Txt>\n </div>\n ))}\n </div>\n );\n}\n","import { ChartTooltip } from '@/ds/components/ChartTooltip';\nimport { Txt } from '@/ds/components/Txt';\n\nexport function MetricsLineChartTooltip({\n active,\n payload,\n label,\n suffix,\n formatValue = value => value.toLocaleString('en-US'),\n showTotal = false,\n labelKey,\n formatByKey,\n}: {\n active?: boolean;\n payload?: Array<{\n name: string;\n value: number;\n color: string;\n dataKey?: string | number;\n payload?: Record<string, unknown>;\n }>;\n label?: string;\n suffix?: string;\n formatValue?: (value: number) => string;\n /** Adds a \"Total\" row under a hairline: the sum of every row, e.g. a stacked column's height. */\n showTotal?: boolean;\n /** Read the heading from this field of the hovered row instead of the x-axis label. */\n labelKey?: string;\n /** Per-series formatters, by data key, for charts that mix units (counts and durations). */\n formatByKey?: Record<string, (value: number) => string>;\n}) {\n if (!active || !payload?.length) return null;\n // A missing reading (NaN, Infinity) shows as a dash and stays out of the total.\n const finite = (value: unknown): value is number => typeof value === 'number' && Number.isFinite(value);\n const total = payload.reduce((sum, entry) => sum + (finite(entry.value) ? entry.value : 0), 0);\n // A bucket with no readings at all totals to a dash, not 0.\n const hasReading = payload.some(entry => finite(entry.value));\n const heading = labelKey ? String(payload[0]?.payload?.[labelKey] ?? label ?? '') : label;\n const format = (entry: { dataKey?: string | number }) => formatByKey?.[String(entry.dataKey)] ?? formatValue;\n // A number through its formatter; a missing or non-finite one as a dash; text as it is.\n const reading = (entry: (typeof payload)[number]) => {\n if (finite(entry.value)) return format(entry)(entry.value);\n if (typeof entry.value === 'number' || entry.value == null) return '—';\n return entry.value;\n };\n return (\n // A floor like shadcn's chart tooltip, so short readouts don't size it to their own label.\n <ChartTooltip className=\"min-w-32\">\n <Txt variant=\"column\" tone=\"ink\" className=\"mb-1\">\n {heading}\n </Txt>\n <div className=\"grid grid-cols-[auto_1fr_auto] items-center gap-x-2 gap-y-1\">\n {payload.map(entry => (\n <div key={entry.name} className=\"contents\">\n <span className=\"size-2 rounded-[2px]\" style={{ backgroundColor: entry.color }} />\n <Txt as=\"span\" variant=\"caption\" tone=\"muted\" className=\"max-w-40 truncate\">\n {entry.name}\n </Txt>\n <span className=\"text-right font-mono text-foreground tabular-nums\">\n {reading(entry)}\n {finite(entry.value) && suffix}\n </span>\n </div>\n ))}\n {showTotal && (\n <div className=\"col-span-3 grid grid-cols-subgrid items-center border-t border-border pt-1\">\n <Txt as=\"span\" variant=\"caption\" tone=\"muted\" className=\"col-span-2\">\n Total\n </Txt>\n <span className=\"text-right font-mono text-foreground tabular-nums\">\n {hasReading ? formatValue(total) : '—'}\n {hasReading && suffix}\n </span>\n </div>\n )}\n </div>\n </ChartTooltip>\n );\n}\n","import { Area, CartesianGrid, ComposedChart, Line, ReferenceLine, Tooltip } from 'recharts';\nimport { MetricsLineChartLegend } from './metrics-line-chart-legend';\nimport { MetricsLineChartTooltip } from './metrics-line-chart-tooltip';\nimport { ChartSkeleton } from '@/ds/components/ChartSkeleton';\nimport { CHART_CURSOR_PROPS, CHART_GRID_PROPS, CHART_TOOLTIP_PROPS, useChartSize } from '@/ds/primitives/chart-axes';\nimport type { ChartXLabels } from '@/ds/primitives/chart-axes';\nimport { Y_AXIS_WIDTH, compactNumber, dataMax, isWholeData, timeXAxis, valueYAxis } from '@/ds/primitives/chart-frame';\nimport type { ChartHeight } from '@/ds/primitives/chart-frame';\nimport { CHART_MARGIN } from '@/ds/primitives/chart-layout';\nimport { ChartPlot } from '@/ds/primitives/chart-plot';\nimport { ChartTooltipPosition } from '@/ds/primitives/chart-tooltip-position';\nimport { useChartDefsId } from '@/ds/primitives/use-chart-defs-id';\nimport { cn } from '@/lib/utils';\n\nexport type MetricsLineChartSeries = {\n dataKey: string;\n label: string;\n color: string;\n /** A secondary reading (e.g. an average next to counts): dashed, no fill under it. */\n dashed?: boolean;\n /** The series to read first (e.g. P95 among percentiles): a slightly heavier line. */\n emphasis?: boolean;\n};\n\n/** Line weight; an emphasised series adds half a pixel. */\nconst LINE_WIDTH = 1.75;\n/** Opacity at the top of the fill under a line (it fades to nothing at the base). */\nconst AREA_OPACITY = 0.12;\n\n/**\n * How the series draw.\n * - `default`: 1.75px lines over a fill.\n * - `thin`: 1.5px lines (emphasis included) over a fainter fill (40% of the default), for small\n * cards in a grid.\n */\nexport type MetricsLineChartLineStyle = 'default' | 'thin';\n\nconst LINE_STYLES: Record<MetricsLineChartLineStyle, { width: number; emphasis: number; areaOpacity: number }> = {\n default: { width: LINE_WIDTH, emphasis: LINE_WIDTH + 0.5, areaOpacity: AREA_OPACITY },\n thin: { width: 1.5, emphasis: 1.5, areaOpacity: AREA_OPACITY * 0.4 },\n};\n\n/**\n * Fills fade out sideways over their first and last 24px, so they don't end in a hard vertical\n * edge where the line starts and stops. A mask sized to each fill's own box.\n */\nconst THIN_FILL_FADE = '[&_.recharts-area-area]:mask-x-from-[calc(100%-24px)]';\n/** A lone point draws no line at all, so it gets a dot; lines already bridge gaps (`connectNulls`). */\nconst SPARSE_POINTS = 1;\n\n// Jumps straight to the hovered point, with the dots and the tooltip.\nfunction HoverLine({ points }: { points?: { x: number; y: number }[] }) {\n const [top, bottom] = points ?? [];\n if (!top || !bottom) return null;\n return (\n <line x1={top.x} x2={top.x} y1={top.y} y2={bottom.y} {...CHART_CURSOR_PROPS} className=\"pointer-events-none\" />\n );\n}\n\nexport type MetricsLineChartPointClickHandler = (point: Record<string, unknown>, seriesKey: string) => void;\n\nexport type MetricsLineChartProps = {\n data: Record<string, unknown>[];\n series: MetricsLineChartSeries[];\n /** Pixels, or `fill` to grow with the parent (a flex column, e.g. a card's content). */\n height?: ChartHeight;\n yDomain?: [number, number];\n /** Click on a series' active dot. */\n onPointClick?: MetricsLineChartPointClickHandler;\n /** Click anywhere on a bucket (e.g. to open its traces); the plot shows a pointer cursor. */\n onBucketClick?: (row: Record<string, unknown>, index: number) => void;\n /** Row field printed under the x-axis. */\n xKey?: string;\n /** Row field with the bucket's start time (ms), which places labels on round clock times. */\n timestampKey?: string;\n /** `auto` fits as many labels as the width allows; `edges` prints only the first and last. */\n xLabels?: ChartXLabels;\n /** Row field for the tooltip heading (e.g. a longer date); defaults to the x-axis label. */\n tooltipLabelKey?: string;\n /** Render a visible dot on every point. A series with a single point gets one anyway. */\n showDots?: boolean;\n /**\n * Point markers. `auto`: on a series' lone point (or every point with `showDots`). `hover`:\n * none at rest, only the hovered point's.\n */\n dots?: 'auto' | 'hover';\n /** Line weight and fill. `thin` suits small cards in a grid. */\n lineStyle?: MetricsLineChartLineStyle;\n /** Set to `false` to render `MetricsLineChartLegend` elsewhere, e.g. next to tabs. */\n showLegend?: boolean;\n /** Formats tooltip values (e.g. `ms`, `%`), and y-axis ticks unless `axisFormatter` is set. */\n valueFormatter?: (value: number) => string;\n /** Formats y-axis ticks, when they need a shorter form than the tooltip. */\n axisFormatter?: (value: number) => string;\n /**\n * Set to `false` to drop the y-axis labels and let the plot span the card. The gridlines stay\n * for relative scale; exact values come from the tooltip and the card's summary.\n */\n showYAxis?: boolean;\n /** Show a ghost of the chart while data loads, in the chart's own footprint. */\n isLoading?: boolean;\n /**\n * Vertical lines at buckets, e.g. where a billing period starts. `x` must be one of the data's\n * `xKey` values: the axis is categorical, so any other value draws nothing.\n */\n markers?: { x: string; label?: string }[];\n className?: string;\n};\n\nexport function MetricsLineChart(props: MetricsLineChartProps) {\n const { data, series, height = 210, showLegend = true, isLoading = false, className } = props;\n const root = cn(height === 'fill' && 'flex min-h-0 flex-1 flex-col', className);\n // The legend stays while loading: it comes from the series, not the data.\n return (\n <div className={root}>\n {showLegend && <MetricsLineChartLegend series={series} className=\"mb-4\" />}\n {isLoading ? <ChartSkeleton kind=\"line\" height={height} /> : <LinePlot {...props} />}\n </div>\n );\n}\n\n/** The plot itself, once the data is in. */\nfunction LinePlot({\n data,\n series,\n height = 210,\n yDomain,\n onPointClick,\n onBucketClick,\n xKey = 'time',\n timestampKey = 'tsMs',\n xLabels = 'auto',\n tooltipLabelKey,\n showDots = false,\n dots = 'auto',\n lineStyle = 'default',\n valueFormatter,\n axisFormatter,\n showYAxis = true,\n markers = [],\n}: MetricsLineChartProps) {\n const id = useChartDefsId();\n const { size, onResize, ref } = useChartSize();\n\n const format = valueFormatter ?? compactNumber.format;\n const isSparse = (key: string) => data.filter(row => typeof row[key] === 'number').length <= SPARSE_POINTS;\n const plotWidth = size.width - (showYAxis ? Y_AXIS_WIDTH : 0);\n const line = LINE_STYLES[lineStyle];\n const restDot = (s: MetricsLineChartSeries) =>\n dots === 'auto' && (showDots || isSparse(s.dataKey)) ? { r: 3, fill: s.color, strokeWidth: 0 } : false;\n const activeDot = (s: MetricsLineChartSeries) => ({\n r: 3.5,\n fill: s.color,\n stroke: 'var(--background)',\n strokeWidth: 2,\n ...(onPointClick && {\n style: { cursor: 'pointer' },\n onClick: (_: unknown, payload: unknown) => {\n // Recharts passes the dot's props; the hovered row is under `payload`.\n if (isRecord(payload) && isRecord(payload.payload)) onPointClick(payload.payload, s.dataKey);\n },\n }),\n });\n\n return (\n <ChartPlot\n height={height}\n plotRef={ref}\n onResize={onResize}\n clickable={!!onBucketClick}\n className={cn(lineStyle === 'thin' && THIN_FILL_FADE)}\n >\n <ComposedChart\n data={data}\n margin={CHART_MARGIN}\n onClick={state => {\n const i = state?.activeTooltipIndex;\n const row = i === undefined || i === null ? undefined : data[Number(i)];\n if (onBucketClick && row) onBucketClick(row, Number(i));\n }}\n >\n <defs>\n {series.map((s, i) => (\n <linearGradient key={s.dataKey} id={`${id}-area-${i}`} x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n <stop offset=\"0%\" stopColor={s.color} stopOpacity={line.areaOpacity} />\n <stop offset=\"95%\" stopColor={s.color} stopOpacity={0} />\n </linearGradient>\n ))}\n </defs>\n <CartesianGrid {...CHART_GRID_PROPS} />\n {timeXAxis({ data, xKey, timestampKey, xLabels, plotWidth })}\n {valueYAxis({\n show: showYAxis,\n size,\n formatter: axisFormatter ?? format,\n domain: yDomain,\n max: dataMax(\n data,\n series.map(s => s.dataKey),\n ),\n integer: isWholeData(\n data,\n series.map(s => s.dataKey),\n ),\n })}\n {markers.map(m => (\n <ReferenceLine\n key={m.x}\n x={m.x}\n stroke=\"var(--border-strong)\"\n strokeDasharray=\"3 3\"\n label={\n m.label\n ? { value: m.label, position: 'insideTopLeft', fill: 'var(--muted-foreground)', fontSize: 11 }\n : undefined\n }\n />\n ))}\n <Tooltip\n {...CHART_TOOLTIP_PROPS}\n content={\n <ChartTooltipPosition>\n <MetricsLineChartTooltip formatValue={format} labelKey={tooltipLabelKey} />\n </ChartTooltipPosition>\n }\n cursor={<HoverLine />}\n />\n {series.map((s, i) => {\n const common = {\n type: 'monotone' as const,\n dataKey: s.dataKey,\n name: s.label,\n stroke: s.color,\n strokeWidth: s.emphasis ? line.emphasis : line.width,\n strokeDasharray: s.dashed ? '4 3' : undefined,\n dot: restDot(s),\n activeDot: activeDot(s),\n isAnimationActive: false,\n connectNulls: true,\n };\n return s.dashed ? (\n <Line key={s.dataKey} {...common} />\n ) : (\n <Area key={s.dataKey} {...common} fill={`url(#${id}-area-${i})`} fillOpacity={1} />\n );\n })}\n </ComposedChart>\n </ChartPlot>\n );\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null;\n}\n"],"mappings":";;;;;;;;;;;;;;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ACE,oBAAC,sBAAD,EAAA,UACE,oBAAC,yBAAD;MAAyB,aAAa;MAAQ,UAAU;KAAkB,CAAA,EACtD,CAAA;KAExB,QAAQ,oBAAC,WAAD,CAAY,CAAA;IACrB,CAAA;IACA,OAAO,KAAK,GAAG,MAAM;KACpB,MAAM,SAAS;MACb,MAAM;MACN,SAAS,EAAE;MACX,MAAM,EAAE;MACR,QAAQ,EAAE;MACV,aAAa,EAAE,WAAW,KAAK,WAAW,KAAK;MAC/C,iBAAiB,EAAE,SAAS,QAAQ,KAAA;MACpC,KAAK,QAAQ,CAAC;MACd,WAAW,UAAU,CAAC;MACtB,mBAAmB;MACnB,cAAc;KAChB;KACA,OAAO,EAAE,SACP,oBAAC,MAAD,EAAsB,GAAI,OAAS,GAAxB,EAAE,OAAsB,IAEnC,oBAAC,MAAD;MAAsB,GAAI;MAAQ,MAAM,QAAQ,GAAG,QAAQ,EAAE;MAAI,aAAa;KAAI,GAAvE,EAAE,OAAqE;IAEtF,CAAC;GACY;;CACN,CAAA;AAEf;AAEA,SAAS,SAAS,OAAkD;CAClE,OAAO,OAAO,UAAU,YAAY,UAAU;AAChD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MetricsLineChart-BnY9JKzc.cjs","names":["cn","Txt","ChartTooltip","Txt","CHART_CURSOR_PROPS","cn","ChartSkeleton","useChartDefsId","useChartSize","compactNumber","ChartPlot","ComposedChart","CHART_MARGIN","CartesianGrid","CHART_GRID_PROPS","timeXAxis","valueYAxis","dataMax","isWholeData","ReferenceLine","Tooltip","CHART_TOOLTIP_PROPS","ChartTooltipPosition","Line","Area"],"sources":["../src/ds/components/MetricsLineChart/metrics-line-chart-legend.tsx","../src/ds/components/MetricsLineChart/metrics-line-chart-tooltip.tsx","../src/ds/components/MetricsLineChart/metrics-line-chart.tsx"],"sourcesContent":["import type { MetricsLineChartSeries } from './metrics-line-chart';\nimport { Txt } from '@/ds/components/Txt';\nimport { cn } from '@/lib/utils';\n\n/** A marker and a label per series. Totals belong in the card's header, not here. */\nexport function MetricsLineChartLegend({\n series,\n className,\n}: {\n series: Pick<MetricsLineChartSeries, 'dataKey' | 'label' | 'color' | 'dashed'>[];\n className?: string;\n}) {\n return (\n <div className={cn('flex flex-wrap items-center gap-x-4 gap-y-1', className)}>\n {series.map(s => (\n <div key={s.dataKey} className=\"inline-flex items-center gap-1.5\">\n {s.dashed ? (\n <span className=\"h-0 w-3 shrink-0 border-t-2 border-dashed\" style={{ borderColor: s.color }} />\n ) : (\n <div className=\"size-2 shrink-0 rounded-[2px]\" style={{ backgroundColor: s.color }} />\n )}\n <Txt as=\"span\" variant=\"body-sm\" tone=\"muted\" className=\"max-w-48 truncate\">\n {s.label}\n </Txt>\n </div>\n ))}\n </div>\n );\n}\n","import { ChartTooltip } from '@/ds/components/ChartTooltip';\nimport { Txt } from '@/ds/components/Txt';\n\nexport function MetricsLineChartTooltip({\n active,\n payload,\n label,\n suffix,\n formatValue = value => value.toLocaleString('en-US'),\n showTotal = false,\n labelKey,\n formatByKey,\n}: {\n active?: boolean;\n payload?: Array<{\n name: string;\n value: number;\n color: string;\n dataKey?: string | number;\n payload?: Record<string, unknown>;\n }>;\n label?: string;\n suffix?: string;\n formatValue?: (value: number) => string;\n /** Adds a \"Total\" row under a hairline: the sum of every row, e.g. a stacked column's height. */\n showTotal?: boolean;\n /** Read the heading from this field of the hovered row instead of the x-axis label. */\n labelKey?: string;\n /** Per-series formatters, by data key, for charts that mix units (counts and durations). */\n formatByKey?: Record<string, (value: number) => string>;\n}) {\n if (!active || !payload?.length) return null;\n // A missing reading (NaN, Infinity) shows as a dash and stays out of the total.\n const finite = (value: unknown): value is number => typeof value === 'number' && Number.isFinite(value);\n const total = payload.reduce((sum, entry) => sum + (finite(entry.value) ? entry.value : 0), 0);\n // A bucket with no readings at all totals to a dash, not 0.\n const hasReading = payload.some(entry => finite(entry.value));\n const heading = labelKey ? String(payload[0]?.payload?.[labelKey] ?? label ?? '') : label;\n const format = (entry: { dataKey?: string | number }) => formatByKey?.[String(entry.dataKey)] ?? formatValue;\n // A number through its formatter; a missing or non-finite one as a dash; text as it is.\n const reading = (entry: (typeof payload)[number]) => {\n if (finite(entry.value)) return format(entry)(entry.value);\n if (typeof entry.value === 'number' || entry.value == null) return '—';\n return entry.value;\n };\n return (\n // A floor like shadcn's chart tooltip, so short readouts don't size it to their own label.\n <ChartTooltip className=\"min-w-32\">\n <Txt variant=\"column\" tone=\"ink\" className=\"mb-1\">\n {heading}\n </Txt>\n <div className=\"grid grid-cols-[auto_1fr_auto] items-center gap-x-2 gap-y-1\">\n {payload.map(entry => (\n <div key={entry.name} className=\"contents\">\n <span className=\"size-2 rounded-[2px]\" style={{ backgroundColor: entry.color }} />\n <Txt as=\"span\" variant=\"caption\" tone=\"muted\" className=\"max-w-40 truncate\">\n {entry.name}\n </Txt>\n <span className=\"text-right font-mono text-foreground tabular-nums\">\n {reading(entry)}\n {finite(entry.value) && suffix}\n </span>\n </div>\n ))}\n {showTotal && (\n <div className=\"col-span-3 grid grid-cols-subgrid items-center border-t border-border pt-1\">\n <Txt as=\"span\" variant=\"caption\" tone=\"muted\" className=\"col-span-2\">\n Total\n </Txt>\n <span className=\"text-right font-mono text-foreground tabular-nums\">\n {hasReading ? formatValue(total) : '—'}\n {hasReading && suffix}\n </span>\n </div>\n )}\n </div>\n </ChartTooltip>\n );\n}\n","import { Area, CartesianGrid, ComposedChart, Line, ReferenceLine, Tooltip } from 'recharts';\nimport { MetricsLineChartLegend } from './metrics-line-chart-legend';\nimport { MetricsLineChartTooltip } from './metrics-line-chart-tooltip';\nimport { ChartSkeleton } from '@/ds/components/ChartSkeleton';\nimport { CHART_CURSOR_PROPS, CHART_GRID_PROPS, CHART_TOOLTIP_PROPS, useChartSize } from '@/ds/primitives/chart-axes';\nimport type { ChartXLabels } from '@/ds/primitives/chart-axes';\nimport { Y_AXIS_WIDTH, compactNumber, dataMax, isWholeData, timeXAxis, valueYAxis } from '@/ds/primitives/chart-frame';\nimport type { ChartHeight } from '@/ds/primitives/chart-frame';\nimport { CHART_MARGIN } from '@/ds/primitives/chart-layout';\nimport { ChartPlot } from '@/ds/primitives/chart-plot';\nimport { ChartTooltipPosition } from '@/ds/primitives/chart-tooltip-position';\nimport { useChartDefsId } from '@/ds/primitives/use-chart-defs-id';\nimport { cn } from '@/lib/utils';\n\nexport type MetricsLineChartSeries = {\n dataKey: string;\n label: string;\n color: string;\n /** A secondary reading (e.g. an average next to counts): dashed, no fill under it. */\n dashed?: boolean;\n /** The series to read first (e.g. P95 among percentiles): a slightly heavier line. */\n emphasis?: boolean;\n};\n\n/** Line weight; an emphasised series adds half a pixel. */\nconst LINE_WIDTH = 1.75;\n/** Opacity at the top of the fill under a line (it fades to nothing at the base). */\nconst AREA_OPACITY = 0.12;\n\n/**\n * How the series draw.\n * - `default`: 1.75px lines over a fill.\n * - `thin`: 1.5px lines (emphasis included) over a fainter fill (40% of the default), for small\n * cards in a grid.\n */\nexport type MetricsLineChartLineStyle = 'default' | 'thin';\n\nconst LINE_STYLES: Record<MetricsLineChartLineStyle, { width: number; emphasis: number; areaOpacity: number }> = {\n default: { width: LINE_WIDTH, emphasis: LINE_WIDTH + 0.5, areaOpacity: AREA_OPACITY },\n thin: { width: 1.5, emphasis: 1.5, areaOpacity: AREA_OPACITY * 0.4 },\n};\n\n/**\n * Fills fade out sideways over their first and last 24px, so they don't end in a hard vertical\n * edge where the line starts and stops. A mask sized to each fill's own box.\n */\nconst THIN_FILL_FADE = '[&_.recharts-area-area]:mask-x-from-[calc(100%-24px)]';\n/** A lone point draws no line at all, so it gets a dot; lines already bridge gaps (`connectNulls`). */\nconst SPARSE_POINTS = 1;\n\n// Jumps straight to the hovered point, with the dots and the tooltip.\nfunction HoverLine({ points }: { points?: { x: number; y: number }[] }) {\n const [top, bottom] = points ?? [];\n if (!top || !bottom) return null;\n return (\n <line x1={top.x} x2={top.x} y1={top.y} y2={bottom.y} {...CHART_CURSOR_PROPS} className=\"pointer-events-none\" />\n );\n}\n\nexport type MetricsLineChartPointClickHandler = (point: Record<string, unknown>, seriesKey: string) => void;\n\nexport type MetricsLineChartProps = {\n data: Record<string, unknown>[];\n series: MetricsLineChartSeries[];\n /** Pixels, or `fill` to grow with the parent (a flex column, e.g. a card's content). */\n height?: ChartHeight;\n yDomain?: [number, number];\n /** Click on a series' active dot. */\n onPointClick?: MetricsLineChartPointClickHandler;\n /** Click anywhere on a bucket (e.g. to open its traces); the plot shows a pointer cursor. */\n onBucketClick?: (row: Record<string, unknown>, index: number) => void;\n /** Row field printed under the x-axis. */\n xKey?: string;\n /** Row field with the bucket's start time (ms), which places labels on round clock times. */\n timestampKey?: string;\n /** `auto` fits as many labels as the width allows; `edges` prints only the first and last. */\n xLabels?: ChartXLabels;\n /** Row field for the tooltip heading (e.g. a longer date); defaults to the x-axis label. */\n tooltipLabelKey?: string;\n /** Render a visible dot on every point. A series with a single point gets one anyway. */\n showDots?: boolean;\n /**\n * Point markers. `auto`: on a series' lone point (or every point with `showDots`). `hover`:\n * none at rest, only the hovered point's.\n */\n dots?: 'auto' | 'hover';\n /** Line weight and fill. `thin` suits small cards in a grid. */\n lineStyle?: MetricsLineChartLineStyle;\n /** Set to `false` to render `MetricsLineChartLegend` elsewhere, e.g. next to tabs. */\n showLegend?: boolean;\n /** Formats tooltip values (e.g. `ms`, `%`), and y-axis ticks unless `axisFormatter` is set. */\n valueFormatter?: (value: number) => string;\n /** Formats y-axis ticks, when they need a shorter form than the tooltip. */\n axisFormatter?: (value: number) => string;\n /**\n * Set to `false` to drop the y-axis labels and let the plot span the card. The gridlines stay\n * for relative scale; exact values come from the tooltip and the card's summary.\n */\n showYAxis?: boolean;\n /** Show a ghost of the chart while data loads, in the chart's own footprint. */\n isLoading?: boolean;\n /**\n * Vertical lines at buckets, e.g. where a billing period starts. `x` must be one of the data's\n * `xKey` values: the axis is categorical, so any other value draws nothing.\n */\n markers?: { x: string; label?: string }[];\n className?: string;\n};\n\nexport function MetricsLineChart(props: MetricsLineChartProps) {\n const { data, series, height = 210, showLegend = true, isLoading = false, className } = props;\n const root = cn(height === 'fill' && 'flex min-h-0 flex-1 flex-col', className);\n // The legend stays while loading: it comes from the series, not the data.\n return (\n <div className={root}>\n {showLegend && <MetricsLineChartLegend series={series} className=\"mb-4\" />}\n {isLoading ? <ChartSkeleton kind=\"line\" height={height} /> : <LinePlot {...props} />}\n </div>\n );\n}\n\n/** The plot itself, once the data is in. */\nfunction LinePlot({\n data,\n series,\n height = 210,\n yDomain,\n onPointClick,\n onBucketClick,\n xKey = 'time',\n timestampKey = 'tsMs',\n xLabels = 'auto',\n tooltipLabelKey,\n showDots = false,\n dots = 'auto',\n lineStyle = 'default',\n valueFormatter,\n axisFormatter,\n showYAxis = true,\n markers = [],\n}: MetricsLineChartProps) {\n const id = useChartDefsId();\n const { size, onResize, ref } = useChartSize();\n\n const format = valueFormatter ?? compactNumber.format;\n const isSparse = (key: string) => data.filter(row => typeof row[key] === 'number').length <= SPARSE_POINTS;\n const plotWidth = size.width - (showYAxis ? Y_AXIS_WIDTH : 0);\n const line = LINE_STYLES[lineStyle];\n const restDot = (s: MetricsLineChartSeries) =>\n dots === 'auto' && (showDots || isSparse(s.dataKey)) ? { r: 3, fill: s.color, strokeWidth: 0 } : false;\n const activeDot = (s: MetricsLineChartSeries) => ({\n r: 3.5,\n fill: s.color,\n stroke: 'var(--background)',\n strokeWidth: 2,\n ...(onPointClick && {\n style: { cursor: 'pointer' },\n onClick: (_: unknown, payload: unknown) => {\n // Recharts passes the dot's props; the hovered row is under `payload`.\n if (isRecord(payload) && isRecord(payload.payload)) onPointClick(payload.payload, s.dataKey);\n },\n }),\n });\n\n return (\n <ChartPlot\n height={height}\n plotRef={ref}\n onResize={onResize}\n clickable={!!onBucketClick}\n className={cn(lineStyle === 'thin' && THIN_FILL_FADE)}\n >\n <ComposedChart\n data={data}\n margin={CHART_MARGIN}\n onClick={state => {\n const i = state?.activeTooltipIndex;\n const row = i === undefined || i === null ? undefined : data[Number(i)];\n if (onBucketClick && row) onBucketClick(row, Number(i));\n }}\n >\n <defs>\n {series.map((s, i) => (\n <linearGradient key={s.dataKey} id={`${id}-area-${i}`} x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n <stop offset=\"0%\" stopColor={s.color} stopOpacity={line.areaOpacity} />\n <stop offset=\"95%\" stopColor={s.color} stopOpacity={0} />\n </linearGradient>\n ))}\n </defs>\n <CartesianGrid {...CHART_GRID_PROPS} />\n {timeXAxis({ data, xKey, timestampKey, xLabels, plotWidth })}\n {valueYAxis({\n show: showYAxis,\n size,\n formatter: axisFormatter ?? format,\n domain: yDomain,\n max: dataMax(\n data,\n series.map(s => s.dataKey),\n ),\n integer: isWholeData(\n data,\n series.map(s => s.dataKey),\n ),\n })}\n {markers.map(m => (\n <ReferenceLine\n key={m.x}\n x={m.x}\n stroke=\"var(--border-strong)\"\n strokeDasharray=\"3 3\"\n label={\n m.label\n ? { value: m.label, position: 'insideTopLeft', fill: 'var(--muted-foreground)', fontSize: 11 }\n : undefined\n }\n />\n ))}\n <Tooltip\n {...CHART_TOOLTIP_PROPS}\n content={\n <ChartTooltipPosition>\n <MetricsLineChartTooltip formatValue={format} labelKey={tooltipLabelKey} />\n </ChartTooltipPosition>\n }\n cursor={<HoverLine />}\n />\n {series.map((s, i) => {\n const common = {\n type: 'monotone' as const,\n dataKey: s.dataKey,\n name: s.label,\n stroke: s.color,\n strokeWidth: s.emphasis ? line.emphasis : line.width,\n strokeDasharray: s.dashed ? '4 3' : undefined,\n dot: restDot(s),\n activeDot: activeDot(s),\n isAnimationActive: false,\n connectNulls: true,\n };\n return s.dashed ? (\n <Line key={s.dataKey} {...common} />\n ) : (\n <Area key={s.dataKey} {...common} fill={`url(#${id}-area-${i})`} fillOpacity={1} />\n );\n })}\n </ComposedChart>\n </ChartPlot>\n );\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null;\n}\n"],"mappings":";;;;;;;;;;;;;;AAKA,SAAgB,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E;MACX,MAAM,EAAE;MACR,QAAQ,EAAE;MACV,aAAa,EAAE,WAAW,KAAK,WAAW,KAAK;MAC/C,iBAAiB,EAAE,SAAS,QAAQ,KAAA;MACpC,KAAK,QAAQ,CAAC;MACd,WAAW,UAAU,CAAC;MACtB,mBAAmB;MACnB,cAAc;KAChB;KACA,OAAO,EAAE,SACP,iBAAA,GAAA,kBAAA,IAAA,CAACC,SAAAA,MAAD,EAAsB,GAAI,OAAS,GAAxB,EAAE,OAAsB,IAEnC,iBAAA,GAAA,kBAAA,IAAA,CAACC,SAAAA,MAAD;MAAsB,GAAI;MAAQ,MAAM,QAAQ,GAAG,QAAQ,EAAE;MAAI,aAAa;KAAI,GAAvE,EAAE,OAAqE;IAEtF,CAAC;GACY;;CACN,CAAA;AAEf;AAEA,SAAS,SAAS,OAAkD;CAClE,OAAO,OAAO,UAAU,YAAY,UAAU;AAChD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MetricsStackedBarChart-Bmk0OjYp.js","names":["_Fragment"],"sources":["../src/ds/components/MetricsStackedBarChart/metrics-stacked-bar-chart.tsx"],"sourcesContent":["import { useLayoutEffect, useMemo, useRef, useState } from 'react';\nimport { Bar, CartesianGrid, ComposedChart, LabelList, Line, Rectangle, ReferenceLine, Tooltip } from 'recharts';\nimport type { LabelProps } from 'recharts';\nimport { ChartSkeleton } from '@/ds/components/ChartSkeleton';\nimport type { MetricsLineChartSeries } from '@/ds/components/MetricsLineChart';\nimport { MetricsLineChartLegend, MetricsLineChartTooltip } from '@/ds/components/MetricsLineChart';\nimport { CHART_GRID_PROPS, CHART_TOOLTIP_PROPS, useChartSize } from '@/ds/primitives/chart-axes';\nimport type { ChartXLabels } from '@/ds/primitives/chart-axes';\nimport { singleBarBox, stackedSegmentBox } from '@/ds/primitives/chart-column-layout';\nimport type { SegmentBox } from '@/ds/primitives/chart-column-layout';\nimport {\n CHART_TICK,\n Y_AXIS_WIDTH,\n compactNumber,\n dataMax,\n isWholeData,\n timeXAxis,\n valueYAxis,\n} from '@/ds/primitives/chart-frame';\nimport type { ChartHeight } from '@/ds/primitives/chart-frame';\nimport { CHART_AXIS_FONT_SIZE, CHART_MARGIN } from '@/ds/primitives/chart-layout';\nimport { ChartPlot } from '@/ds/primitives/chart-plot';\nimport { ChartTooltipPosition } from '@/ds/primitives/chart-tooltip-position';\nimport { DragSelectionBand, activeIndex, useDragSelection } from '@/ds/primitives/charts/drag-selection';\nimport type { DragSelectionRange } from '@/ds/primitives/charts/drag-selection';\nimport { useChartDefsId } from '@/ds/primitives/use-chart-defs-id';\nimport { cn } from '@/lib/utils';\n\n/** Corner radius of every segment; thin segments scale it down so they stay crisp rectangles. */\nconst RADIUS = 2;\n/** Pixels between stacked segments, so neighbouring segments read as separate blocks. */\nconst SEGMENT_GAP = 2;\n/** Opacity at the base of a segment's gradient (the top is fully opaque). */\nconst GRADIENT_BASE = 0.75;\n/** Single-series bars: translucent body under a solid cap that marks the value. */\nconst CAP_BODY = 0.55;\nconst CAP_HEIGHT = 3;\n/** Opacity of the other columns while one is hovered. */\nconst DIMMED = 0.3;\nconst COLUMN_LABEL_SPACE = 16;\n\ntype SegmentProps = {\n x?: number;\n y?: number;\n width?: number;\n height?: number;\n index?: number;\n payload?: Record<string, unknown>;\n};\n\nfunction segmentShape({\n fill,\n color,\n capped,\n keys,\n dataKey,\n}: {\n fill: string;\n color: string;\n capped: boolean;\n /** The column's data keys, bottom to top. */\n keys: string[];\n dataKey: string;\n}) {\n return function Segment({ x = 0, width = 0, index, payload, ...geo }: SegmentProps) {\n const values = keys.map(k => Number(payload?.[k]) || 0);\n const self = keys.indexOf(dataKey);\n const box = { y: geo.y ?? 0, height: Math.max(geo.height ?? 0, 0) };\n // Every non-zero value gets a few readable pixels; zeros draw nothing.\n const laid =\n keys.length > 1\n ? stackedSegmentBox(values, self, box, { gap: SEGMENT_GAP })\n : singleBarBox(values[self] ?? 0, box);\n if (!laid) return <g />;\n const { y, height: h } = laid;\n const radius = Math.min(RADIUS, Math.floor(h / 3));\n // Dimming is a CSS rule keyed on `data-bucket` (see `HoverDim`), so hovering re-renders no bars.\n const bucket = { 'data-bucket': index };\n\n if (capped) {\n return (\n <g {...bucket}>\n <Rectangle x={x} y={y} width={width} height={h} radius={radius} fill={color} fillOpacity={CAP_BODY} />\n <Rectangle x={x} y={y} width={width} height={Math.min(CAP_HEIGHT, h)} radius={radius} fill={color} />\n </g>\n );\n }\n return (\n <g {...bucket}>\n <Rectangle x={x} y={y} width={width} height={h} radius={radius} fill={fill} />\n </g>\n );\n };\n}\n\n/**\n * Dims every column outside the hovered one, or outside the range being dragged. Its own tiny\n * state, so a move only re-renders this <style> tag: with hundreds of buckets, re-rendering the\n * bars on each move froze the pointer.\n */\nfunction HoverDim({\n scope,\n setter,\n}: {\n scope: string;\n setter: { current: (range: DragSelectionRange | undefined) => void };\n}) {\n const [lit, setLit] = useState<DragSelectionRange>();\n useLayoutEffect(() => {\n setter.current = setLit;\n }, [setter]);\n if (!lit) return null;\n const columns = `[data-chart-scope=\"${scope}\"] [data-bucket]`;\n const kept = Array.from(\n { length: lit.end - lit.start + 1 },\n (_, i) => `${columns}[data-bucket=\"${lit.start + i}\"]`,\n ).join(',');\n return <style>{`${columns}{opacity:${DIMMED}}${kept}{opacity:1}`}</style>;\n}\n\n/** A line drawn over the bars on its own scale, e.g. average wake time over cold starts. */\nexport type MetricsStackedBarChartOverlay = MetricsLineChartSeries & {\n valueFormatter?: (value: number) => string;\n};\n\nexport type MetricsStackedBarChartProps = {\n data: Record<string, unknown>[];\n series: MetricsLineChartSeries[];\n /** Pixels, or `fill` to grow with the parent (a flex column, e.g. a card's content). */\n height?: ChartHeight;\n yDomain?: [number, number];\n /** Formats tooltip values, and y-axis ticks unless `axisFormatter` is set. */\n valueFormatter?: (value: number) => string;\n /** Formats y-axis ticks, when they need a shorter form than the tooltip. */\n axisFormatter?: (value: number) => string;\n showLegend?: boolean;\n referenceLine?: { value: number; label: string; color: string };\n /**\n * `gradient`: segments fade gently toward the base. Reads best for stacks.\n * `capped`: a translucent body under a solid cap that marks the value. Reads best for one\n * value per column.\n */\n variant?: 'gradient' | 'capped';\n /**\n * Set to `false` to drop the y-axis labels and let the plot span the card. The gridlines stay\n * for relative scale; exact values come from the tooltip and the card's summary.\n */\n showYAxis?: boolean;\n /** Adds a \"Total\" row (the column's height) to the tooltip. Defaults to on for stacks. */\n showTotal?: boolean;\n /** Row field printed under the x-axis. */\n xKey?: string;\n /** Row field with the bucket's start time (ms), which places labels on round clock times. */\n timestampKey?: string;\n /** `auto` fits as many labels as the width allows; `edges` prints only the first and last. */\n xLabels?: ChartXLabels;\n /** Row field for the tooltip heading (e.g. a longer date); defaults to the x-axis label. */\n tooltipLabelKey?: string;\n columnLabelKey?: string;\n /** Widest a column gets, in pixels. Defaults to 28; raise it for dense strips of many thin columns. */\n maxBarSize?: number;\n /** Click a column (e.g. to open its traces); the plot shows a pointer cursor. */\n onBucketClick?: (row: Record<string, unknown>, index: number) => void;\n /**\n * Drag across two or more columns to select them (e.g. to zoom into that time span); reports the\n * first and last selected row indices. A press and release on one column stays a click.\n */\n onZoom?: (range: DragSelectionRange) => void;\n /** One dashed line over the bars, on its own hidden scale (e.g. a duration over counts). */\n overlay?: MetricsStackedBarChartOverlay;\n /** Show a ghost of the chart while data loads, in the chart's own footprint. */\n isLoading?: boolean;\n className?: string;\n};\n\nexport function MetricsStackedBarChart(props: MetricsStackedBarChartProps) {\n const { data, series, overlay, height = 210, showLegend = true, isLoading = false, className } = props;\n const id = useChartDefsId();\n const root = cn(height === 'fill' && 'flex min-h-0 flex-1 flex-col', className);\n const legend = overlay ? [...series, { ...overlay, dashed: true }] : series;\n // The legend stays while loading: it comes from the series, not the data.\n return (\n <div className={root} data-chart-scope={id}>\n {showLegend && <MetricsLineChartLegend series={legend} className=\"mb-4\" />}\n {isLoading ? <ChartSkeleton kind=\"bar\" height={height} /> : <BarPlot {...props} id={id} />}\n </div>\n );\n}\n\n/** The plot itself, once the data is in; `id` scopes its gradients and hover rule. */\nfunction BarPlot({\n data,\n series,\n height = 210,\n yDomain,\n valueFormatter,\n axisFormatter,\n referenceLine,\n variant = 'gradient',\n showYAxis = true,\n showTotal = series.length > 1,\n xKey = 'time',\n timestampKey = 'tsMs',\n xLabels = 'auto',\n tooltipLabelKey,\n columnLabelKey,\n maxBarSize = 28,\n onBucketClick,\n onZoom,\n overlay,\n id,\n}: MetricsStackedBarChartProps & { id: string }) {\n const setLit = useRef<(range: DragSelectionRange | undefined) => void>(() => {});\n const { size, onResize, ref } = useChartSize();\n // The dragged columns stay lit through the same rule as hover, so a drag never re-renders the bars.\n const selection = useDragSelection({ onSelect: onZoom, onPreview: range => setLit.current(range) });\n\n const keyList = series.map(s => s.dataKey).join('\\u0000');\n const colorList = series.map(s => s.color).join('\\u0000');\n // Stable shapes, so Recharts doesn't re-render every bar when the parent re-renders.\n const shapes = useMemo(() => {\n const keys = keyList.split('\\u0000');\n const colors = colorList.split('\\u0000');\n return keys.map((dataKey, i) =>\n segmentShape({\n fill: `url(#${id}-bar-${i})`,\n color: colors[i] ?? '',\n capped: variant === 'capped',\n keys,\n dataKey,\n }),\n );\n }, [keyList, colorList, variant, id]);\n\n const format = valueFormatter ?? compactNumber.format;\n const plotWidth = size.width - (showYAxis ? Y_AXIS_WIDTH : 0);\n const margin = columnLabelKey ? { ...CHART_MARGIN, top: CHART_MARGIN.top + COLUMN_LABEL_SPACE } : CHART_MARGIN;\n\n return (\n <>\n <HoverDim scope={id} setter={setLit} />\n <ChartPlot\n height={height}\n plotRef={ref}\n onResize={onResize}\n clickable={!!onBucketClick && !selection.enabled}\n className={selection.className}\n >\n <ComposedChart\n data={data}\n margin={margin}\n onMouseDown={selection.onMouseDown}\n onMouseMove={state => {\n if (selection.isDragging()) return selection.onMouseMove(state);\n const index = activeIndex(state);\n setLit.current(index === undefined ? undefined : { start: index, end: index });\n }}\n onMouseLeave={() => {\n // Mid-drag the selection stays lit until the release.\n if (!selection.isDragging()) setLit.current(undefined);\n }}\n onClick={state => {\n if (selection.consumeReleaseClick()) return;\n const i = activeIndex(state);\n const row = i === undefined ? undefined : data[i];\n if (onBucketClick && row && i !== undefined) onBucketClick(row, i);\n }}\n >\n <defs>\n {series.map((s, i) => (\n <linearGradient key={s.dataKey} id={`${id}-bar-${i}`} x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n <stop offset=\"0%\" stopColor={s.color} stopOpacity={1} />\n <stop offset=\"100%\" stopColor={s.color} stopOpacity={GRADIENT_BASE} />\n </linearGradient>\n ))}\n </defs>\n <CartesianGrid {...CHART_GRID_PROPS} />\n {selection.enabled && <DragSelectionBand selection={selection} count={data.length} />}\n {timeXAxis({ data, xKey, timestampKey, xLabels, plotWidth })}\n {valueYAxis({\n show: showYAxis,\n size,\n formatter: axisFormatter ?? format,\n domain: yDomain,\n // A reference line above the bars stays on the axis.\n max: Math.max(\n dataMax(\n data,\n series.map(s => s.dataKey),\n true,\n ),\n referenceLine?.value ?? 0,\n ),\n integer: isWholeData(\n data,\n series.map(s => s.dataKey),\n ),\n })}\n {overlay &&\n valueYAxis({\n id: 'overlay',\n show: false,\n size,\n formatter: overlay.valueFormatter ?? compactNumber.format,\n max: dataMax(data, [overlay.dataKey]),\n integer: isWholeData(data, [overlay.dataKey]),\n right: true,\n })}\n <Tooltip\n {...CHART_TOOLTIP_PROPS}\n cursor={false}\n content={\n <ChartTooltipPosition>\n <MetricsLineChartTooltip\n formatValue={format}\n showTotal={showTotal && !overlay}\n labelKey={tooltipLabelKey}\n formatByKey={overlay?.valueFormatter ? { [overlay.dataKey]: overlay.valueFormatter } : undefined}\n />\n </ChartTooltipPosition>\n }\n />\n {series.map((s, i) => (\n <Bar\n key={s.dataKey}\n dataKey={s.dataKey}\n name={s.label}\n stackId=\"1\"\n fill={s.color}\n maxBarSize={maxBarSize}\n isAnimationActive={false}\n shape={shapes[i]}\n >\n {columnLabelKey && (\n <LabelList\n dataKey={columnLabelKey}\n content={(props: LabelProps) => (\n <ColumnLabel\n {...props}\n row={data[Number(props.index)]}\n keys={series.map(({ dataKey }) => dataKey)}\n self={i}\n color={s.color}\n />\n )}\n />\n )}\n </Bar>\n ))}\n {overlay && (\n <Line\n yAxisId=\"overlay\"\n type=\"monotone\"\n dataKey={overlay.dataKey}\n name={overlay.label}\n stroke={overlay.color}\n strokeWidth={1.75}\n strokeDasharray=\"4 3\"\n dot={false}\n activeDot={{ r: 3.5, fill: overlay.color, stroke: 'var(--background)', strokeWidth: 2 }}\n isAnimationActive={false}\n connectNulls\n />\n )}\n {referenceLine && (\n <ReferenceLine\n y={referenceLine.value}\n ifOverflow=\"extendDomain\"\n stroke={referenceLine.color}\n strokeDasharray=\"4 4\"\n label={{ value: referenceLine.label, position: 'insideTopLeft', ...CHART_TICK }}\n />\n )}\n </ComposedChart>\n </ChartPlot>\n </>\n );\n}\n\ntype ColumnLabelProps = LabelProps & {\n row: MetricsStackedBarChartProps['data'][number] | undefined;\n keys: string[];\n self: number;\n color: string;\n};\n\nfunction paintedTop(values: number[], self: number, box: SegmentBox) {\n if (values.length > 1) return stackedSegmentBox(values, self, box, { gap: SEGMENT_GAP })?.y;\n return singleBarBox(values[self] ?? 0, box)?.y;\n}\n\nfunction ColumnLabel({ x, y, width, height, value, row, keys, self, color }: ColumnLabelProps) {\n if (value === undefined || value === null || value === '') return null;\n const values = keys.map(key => Number(row?.[key]) || 0);\n const topmost = values.findLastIndex(v => v > 0);\n if (self !== (topmost === -1 ? keys.length - 1 : topmost)) return null;\n const top = paintedTop(values, self, { y: Number(y), height: Math.max(Number(height), 0) }) ?? Number(y);\n return (\n <text\n x={Number(x) + Number(width) / 2}\n y={top - 6}\n textAnchor=\"middle\"\n fontSize={CHART_AXIS_FONT_SIZE}\n fill={color}\n className=\"tabular-nums\"\n >\n {String(value)}\n </text>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA6BA,IAAM,SAAS;;AAEf,IAAM,cAAc;;AAEpB,IAAM,gBAAgB;;AAEtB,IA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