@flanksource/clicky-ui 0.3.83 → 0.3.85
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/components/Combobox.cjs +8 -6
- package/dist/components/Combobox.cjs.map +1 -1
- package/dist/components/Combobox.d.ts.map +1 -1
- package/dist/components/Combobox.js +8 -6
- package/dist/components/Combobox.js.map +1 -1
- package/dist/components/ComboboxMenu.cjs +7 -4
- package/dist/components/ComboboxMenu.cjs.map +1 -1
- package/dist/components/ComboboxMenu.d.ts +3 -2
- package/dist/components/ComboboxMenu.d.ts.map +1 -1
- package/dist/components/ComboboxMenu.js +7 -4
- package/dist/components/ComboboxMenu.js.map +1 -1
- package/dist/components/DateField.cjs.map +1 -1
- package/dist/components/DateField.d.ts +3 -2
- package/dist/components/DateField.d.ts.map +1 -1
- package/dist/components/DateField.js.map +1 -1
- package/dist/components/DatePicker.cjs +9 -61
- package/dist/components/DatePicker.cjs.map +1 -1
- package/dist/components/DatePicker.d.ts +5 -19
- package/dist/components/DatePicker.d.ts.map +1 -1
- package/dist/components/DatePicker.js +11 -63
- package/dist/components/DatePicker.js.map +1 -1
- package/dist/components/DateTimePicker.cjs +9 -78
- package/dist/components/DateTimePicker.cjs.map +1 -1
- package/dist/components/DateTimePicker.d.ts +5 -19
- package/dist/components/DateTimePicker.d.ts.map +1 -1
- package/dist/components/DateTimePicker.js +11 -80
- package/dist/components/DateTimePicker.js.map +1 -1
- package/dist/components/FilterBar.cjs +64 -47
- package/dist/components/FilterBar.cjs.map +1 -1
- package/dist/components/FilterBar.d.ts +20 -2
- package/dist/components/FilterBar.d.ts.map +1 -1
- package/dist/components/FilterBar.js +63 -46
- package/dist/components/FilterBar.js.map +1 -1
- package/dist/components/TimeRange.cjs +156 -128
- package/dist/components/TimeRange.cjs.map +1 -1
- package/dist/components/TimeRange.d.ts +8 -1
- package/dist/components/TimeRange.d.ts.map +1 -1
- package/dist/components/TimeRange.js +156 -128
- package/dist/components/TimeRange.js.map +1 -1
- package/dist/components/calendar-grid.cjs +83 -0
- package/dist/components/calendar-grid.cjs.map +1 -0
- package/dist/components/calendar-grid.d.ts +9 -0
- package/dist/components/calendar-grid.d.ts.map +1 -0
- package/dist/components/calendar-grid.js +83 -0
- package/dist/components/calendar-grid.js.map +1 -0
- package/dist/components/combobox-types.d.ts +5 -0
- package/dist/components/combobox-types.d.ts.map +1 -1
- package/dist/components/date-input-field.cjs +88 -0
- package/dist/components/date-input-field.cjs.map +1 -0
- package/dist/components/date-input-field.d.ts +37 -0
- package/dist/components/date-input-field.d.ts.map +1 -0
- package/dist/components/date-input-field.js +88 -0
- package/dist/components/date-input-field.js.map +1 -0
- package/dist/components/date-math.cjs +67 -0
- package/dist/components/date-math.cjs.map +1 -0
- package/dist/components/date-math.d.ts +33 -0
- package/dist/components/date-math.d.ts.map +1 -0
- package/dist/components/date-math.js +60 -0
- package/dist/components/date-math.js.map +1 -0
- package/dist/components/date-picker-menu.cjs +129 -0
- package/dist/components/date-picker-menu.cjs.map +1 -0
- package/dist/components/date-picker-menu.d.ts +18 -0
- package/dist/components/date-picker-menu.d.ts.map +1 -0
- package/dist/components/date-picker-menu.js +129 -0
- package/dist/components/date-picker-menu.js.map +1 -0
- package/dist/components/filter-bar-context.cjs.map +1 -1
- package/dist/components/filter-bar-context.d.ts +2 -0
- package/dist/components/filter-bar-context.d.ts.map +1 -1
- package/dist/components/filter-bar-context.js.map +1 -1
- package/dist/components/filter-bar-field-utils.cjs +18 -4
- package/dist/components/filter-bar-field-utils.cjs.map +1 -1
- package/dist/components/filter-bar-field-utils.d.ts +3 -2
- package/dist/components/filter-bar-field-utils.d.ts.map +1 -1
- package/dist/components/filter-bar-field-utils.js +19 -5
- package/dist/components/filter-bar-field-utils.js.map +1 -1
- package/dist/components/filter-bar-menu.cjs +189 -0
- package/dist/components/filter-bar-menu.cjs.map +1 -0
- package/dist/components/filter-bar-menu.d.ts +25 -0
- package/dist/components/filter-bar-menu.d.ts.map +1 -0
- package/dist/components/filter-bar-menu.js +189 -0
- package/dist/components/filter-bar-menu.js.map +1 -0
- package/dist/components/filter-bar-multi.cjs +1 -1
- package/dist/components/filter-bar-multi.cjs.map +1 -1
- package/dist/components/filter-bar-multi.js +2 -2
- package/dist/components/filter-bar-multi.js.map +1 -1
- package/dist/components/filter-bar-popup.cjs +37 -0
- package/dist/components/filter-bar-popup.cjs.map +1 -0
- package/dist/components/filter-bar-popup.d.ts +32 -0
- package/dist/components/filter-bar-popup.d.ts.map +1 -0
- package/dist/components/filter-bar-popup.js +37 -0
- package/dist/components/filter-bar-popup.js.map +1 -0
- package/dist/components/filter-bar-tree.cjs +1 -1
- package/dist/components/filter-bar-tree.cjs.map +1 -1
- package/dist/components/filter-bar-tree.js +2 -2
- package/dist/components/filter-bar-tree.js.map +1 -1
- package/dist/components/json-schema-form-date-math.cjs +15 -11
- package/dist/components/json-schema-form-date-math.cjs.map +1 -1
- package/dist/components/json-schema-form-date-math.d.ts +3 -0
- package/dist/components/json-schema-form-date-math.d.ts.map +1 -1
- package/dist/components/json-schema-form-date-math.js +15 -12
- package/dist/components/json-schema-form-date-math.js.map +1 -1
- package/dist/components/json-schema-form-table-array.cjs +5 -3
- package/dist/components/json-schema-form-table-array.cjs.map +1 -1
- package/dist/components/json-schema-form-table-array.d.ts.map +1 -1
- package/dist/components/json-schema-form-table-array.js +5 -3
- package/dist/components/json-schema-form-table-array.js.map +1 -1
- package/dist/components.cjs +1 -1
- package/dist/components.d.ts +1 -0
- package/dist/components.d.ts.map +1 -1
- package/dist/components.js +1 -1
- package/dist/connections/ConnectionPicker.cjs +6 -2
- package/dist/connections/ConnectionPicker.cjs.map +1 -1
- package/dist/connections/ConnectionPicker.d.ts.map +1 -1
- package/dist/connections/ConnectionPicker.js +6 -2
- package/dist/connections/ConnectionPicker.js.map +1 -1
- package/dist/connections/CreateConnectionDialog.cjs +8 -21
- package/dist/connections/CreateConnectionDialog.cjs.map +1 -1
- package/dist/connections/CreateConnectionDialog.d.ts +2 -1
- package/dist/connections/CreateConnectionDialog.d.ts.map +1 -1
- package/dist/connections/CreateConnectionDialog.js +8 -21
- package/dist/connections/CreateConnectionDialog.js.map +1 -1
- package/dist/data/ExpandableMarkdown.cjs +59 -0
- package/dist/data/ExpandableMarkdown.cjs.map +1 -0
- package/dist/data/ExpandableMarkdown.d.ts +17 -0
- package/dist/data/ExpandableMarkdown.d.ts.map +1 -0
- package/dist/data/ExpandableMarkdown.js +59 -0
- package/dist/data/ExpandableMarkdown.js.map +1 -0
- package/dist/data/MultiGaugeBar.cjs +49 -21
- package/dist/data/MultiGaugeBar.cjs.map +1 -1
- package/dist/data/MultiGaugeBar.d.ts +5 -2
- package/dist/data/MultiGaugeBar.d.ts.map +1 -1
- package/dist/data/MultiGaugeBar.js +49 -21
- package/dist/data/MultiGaugeBar.js.map +1 -1
- package/dist/data/PromptDialog.cjs +19 -5
- package/dist/data/PromptDialog.cjs.map +1 -1
- package/dist/data/PromptDialog.d.ts +15 -1
- package/dist/data/PromptDialog.d.ts.map +1 -1
- package/dist/data/PromptDialog.js +19 -5
- package/dist/data/PromptDialog.js.map +1 -1
- package/dist/data/PromptIndicator.cjs +3 -2
- package/dist/data/PromptIndicator.cjs.map +1 -1
- package/dist/data/PromptIndicator.d.ts +4 -1
- package/dist/data/PromptIndicator.d.ts.map +1 -1
- package/dist/data/PromptIndicator.js +3 -2
- package/dist/data/PromptIndicator.js.map +1 -1
- package/dist/data/diagnostics/ErrorDetails.cjs +155 -110
- package/dist/data/diagnostics/ErrorDetails.cjs.map +1 -1
- package/dist/data/diagnostics/ErrorDetails.d.ts.map +1 -1
- package/dist/data/diagnostics/ErrorDetails.js +155 -110
- package/dist/data/diagnostics/ErrorDetails.js.map +1 -1
- package/dist/data/flow-node/BoxNode.cjs +45 -0
- package/dist/data/flow-node/BoxNode.cjs.map +1 -0
- package/dist/data/flow-node/BoxNode.d.ts +28 -0
- package/dist/data/flow-node/BoxNode.d.ts.map +1 -0
- package/dist/data/flow-node/BoxNode.js +45 -0
- package/dist/data/flow-node/BoxNode.js.map +1 -0
- package/dist/data/flow-node/FlowMetrics.cjs +208 -0
- package/dist/data/flow-node/FlowMetrics.cjs.map +1 -0
- package/dist/data/flow-node/FlowMetrics.d.ts +60 -0
- package/dist/data/flow-node/FlowMetrics.d.ts.map +1 -0
- package/dist/data/flow-node/FlowMetrics.js +206 -0
- package/dist/data/flow-node/FlowMetrics.js.map +1 -0
- package/dist/data/flow-node/WorkloadNode.cjs +63 -0
- package/dist/data/flow-node/WorkloadNode.cjs.map +1 -0
- package/dist/data/flow-node/WorkloadNode.d.ts +42 -0
- package/dist/data/flow-node/WorkloadNode.d.ts.map +1 -0
- package/dist/data/flow-node/WorkloadNode.js +63 -0
- package/dist/data/flow-node/WorkloadNode.js.map +1 -0
- package/dist/data/flow-node/index.d.ts +5 -0
- package/dist/data/flow-node/index.d.ts.map +1 -0
- package/dist/data/flow-node/latency.cjs +37 -0
- package/dist/data/flow-node/latency.cjs.map +1 -0
- package/dist/data/flow-node/latency.d.ts +13 -0
- package/dist/data/flow-node/latency.d.ts.map +1 -0
- package/dist/data/flow-node/latency.js +35 -0
- package/dist/data/flow-node/latency.js.map +1 -0
- package/dist/data/test-runner/TestDetailPanel.cjs +109 -46
- package/dist/data/test-runner/TestDetailPanel.cjs.map +1 -1
- package/dist/data/test-runner/TestDetailPanel.d.ts.map +1 -1
- package/dist/data/test-runner/TestDetailPanel.js +110 -47
- package/dist/data/test-runner/TestDetailPanel.js.map +1 -1
- package/dist/data/test-runner/TestTreeNode.cjs +84 -63
- package/dist/data/test-runner/TestTreeNode.cjs.map +1 -1
- package/dist/data/test-runner/TestTreeNode.d.ts.map +1 -1
- package/dist/data/test-runner/TestTreeNode.js +84 -63
- package/dist/data/test-runner/TestTreeNode.js.map +1 -1
- package/dist/data/test-runner/adapter.cjs.map +1 -1
- package/dist/data/test-runner/adapter.d.ts +2 -2
- package/dist/data/test-runner/adapter.d.ts.map +1 -1
- package/dist/data/test-runner/adapter.js.map +1 -1
- package/dist/data/test-runner/copy.cjs +62 -10
- package/dist/data/test-runner/copy.cjs.map +1 -1
- package/dist/data/test-runner/copy.d.ts +52 -9
- package/dist/data/test-runner/copy.d.ts.map +1 -1
- package/dist/data/test-runner/copy.js +60 -11
- package/dist/data/test-runner/copy.js.map +1 -1
- package/dist/data/test-runner/index.d.ts +1 -1
- package/dist/data/test-runner/index.d.ts.map +1 -1
- package/dist/data/traces/index.d.ts +1 -0
- package/dist/data/traces/index.d.ts.map +1 -1
- package/dist/data/traces/otel/OtelTraceDetail.cjs +4 -7
- package/dist/data/traces/otel/OtelTraceDetail.cjs.map +1 -1
- package/dist/data/traces/otel/OtelTraceDetail.js +4 -7
- package/dist/data/traces/otel/OtelTraceDetail.js.map +1 -1
- package/dist/data/traces/otel/OtelTraceSearch.cjs +90 -56
- package/dist/data/traces/otel/OtelTraceSearch.cjs.map +1 -1
- package/dist/data/traces/otel/OtelTraceSearch.d.ts.map +1 -1
- package/dist/data/traces/otel/OtelTraceSearch.js +91 -57
- package/dist/data/traces/otel/OtelTraceSearch.js.map +1 -1
- package/dist/data/traces/otel/QueryBar.cjs +83 -10
- package/dist/data/traces/otel/QueryBar.cjs.map +1 -1
- package/dist/data/traces/otel/QueryBar.d.ts.map +1 -1
- package/dist/data/traces/otel/QueryBar.js +83 -10
- package/dist/data/traces/otel/QueryBar.js.map +1 -1
- package/dist/data/traces/otel/TraceResults.cjs +81 -13
- package/dist/data/traces/otel/TraceResults.cjs.map +1 -1
- package/dist/data/traces/otel/TraceResults.d.ts +11 -3
- package/dist/data/traces/otel/TraceResults.d.ts.map +1 -1
- package/dist/data/traces/otel/TraceResults.js +81 -13
- package/dist/data/traces/otel/TraceResults.js.map +1 -1
- package/dist/data/traces/otel/api.cjs.map +1 -1
- package/dist/data/traces/otel/api.d.ts +14 -0
- package/dist/data/traces/otel/api.d.ts.map +1 -1
- package/dist/data/traces/otel/api.js.map +1 -1
- package/dist/data/traces/otel/query.cjs +2 -2
- package/dist/data/traces/otel/query.cjs.map +1 -1
- package/dist/data/traces/otel/query.d.ts +1 -1
- package/dist/data/traces/otel/query.d.ts.map +1 -1
- package/dist/data/traces/otel/query.js +2 -2
- package/dist/data/traces/otel/query.js.map +1 -1
- package/dist/data/verification/StepFilesView.cjs +90 -0
- package/dist/data/verification/StepFilesView.cjs.map +1 -0
- package/dist/data/verification/StepFilesView.d.ts +9 -0
- package/dist/data/verification/StepFilesView.d.ts.map +1 -0
- package/dist/data/verification/StepFilesView.js +90 -0
- package/dist/data/verification/StepFilesView.js.map +1 -0
- package/dist/data/verification/adapterViews.cjs +129 -69
- package/dist/data/verification/adapterViews.cjs.map +1 -1
- package/dist/data/verification/adapterViews.d.ts +3 -1
- package/dist/data/verification/adapterViews.d.ts.map +1 -1
- package/dist/data/verification/adapterViews.js +130 -70
- package/dist/data/verification/adapterViews.js.map +1 -1
- package/dist/data/verification/adapters.cjs +9 -0
- package/dist/data/verification/adapters.cjs.map +1 -1
- package/dist/data/verification/adapters.d.ts +2 -0
- package/dist/data/verification/adapters.d.ts.map +1 -1
- package/dist/data/verification/adapters.js +11 -2
- package/dist/data/verification/adapters.js.map +1 -1
- package/dist/data/verification/index.d.ts +2 -1
- package/dist/data/verification/index.d.ts.map +1 -1
- package/dist/data/verification/stepKind.cjs +63 -7
- package/dist/data/verification/stepKind.cjs.map +1 -1
- package/dist/data/verification/stepKind.d.ts +55 -6
- package/dist/data/verification/stepKind.d.ts.map +1 -1
- package/dist/data/verification/stepKind.js +62 -8
- package/dist/data/verification/stepKind.js.map +1 -1
- package/dist/data/verification/stepKindViews.cjs +318 -106
- package/dist/data/verification/stepKindViews.cjs.map +1 -1
- package/dist/data/verification/stepKindViews.d.ts +17 -6
- package/dist/data/verification/stepKindViews.d.ts.map +1 -1
- package/dist/data/verification/stepKindViews.js +319 -108
- package/dist/data/verification/stepKindViews.js.map +1 -1
- package/dist/data/version-info.cjs +3 -3
- package/dist/data/version-info.cjs.map +1 -1
- package/dist/data/version-info.js +3 -3
- package/dist/data/version-info.js.map +1 -1
- package/dist/data/workload-panel/MemoryStack.cjs +38 -1
- package/dist/data/workload-panel/MemoryStack.cjs.map +1 -1
- package/dist/data/workload-panel/MemoryStack.d.ts.map +1 -1
- package/dist/data/workload-panel/MemoryStack.js +38 -1
- package/dist/data/workload-panel/MemoryStack.js.map +1 -1
- package/dist/data.cjs +22 -1
- package/dist/data.d.ts +3 -1
- package/dist/data.d.ts.map +1 -1
- package/dist/data.js +10 -3
- package/dist/file-findings/AnnotatedCode.cjs +18 -2
- package/dist/file-findings/AnnotatedCode.cjs.map +1 -1
- package/dist/file-findings/AnnotatedCode.d.ts +2 -0
- package/dist/file-findings/AnnotatedCode.d.ts.map +1 -1
- package/dist/file-findings/AnnotatedCode.js +18 -2
- package/dist/file-findings/AnnotatedCode.js.map +1 -1
- package/dist/file-findings/FileFindingsView.cjs.map +1 -1
- package/dist/file-findings/FileFindingsView.d.ts +2 -0
- package/dist/file-findings/FileFindingsView.d.ts.map +1 -1
- package/dist/file-findings/FileFindingsView.js.map +1 -1
- package/dist/file-findings/file-review/FileReview.cjs +2 -1
- package/dist/file-findings/file-review/FileReview.cjs.map +1 -1
- package/dist/file-findings/file-review/FileReview.d.ts +3 -1
- package/dist/file-findings/file-review/FileReview.d.ts.map +1 -1
- package/dist/file-findings/file-review/FileReview.js +2 -1
- package/dist/file-findings/file-review/FileReview.js.map +1 -1
- package/dist/hooks/use-prompts.cjs +52 -30
- package/dist/hooks/use-prompts.cjs.map +1 -1
- package/dist/hooks/use-prompts.d.ts +6 -0
- package/dist/hooks/use-prompts.d.ts.map +1 -1
- package/dist/hooks/use-prompts.js +52 -30
- package/dist/hooks/use-prompts.js.map +1 -1
- package/dist/index.cjs +23 -2
- package/dist/index.js +11 -4
- package/dist/profiles/editor/profileEditor.cjs +29 -30
- package/dist/profiles/editor/profileEditor.cjs.map +1 -1
- package/dist/profiles/editor/profileEditor.d.ts.map +1 -1
- package/dist/profiles/editor/profileEditor.js +29 -30
- package/dist/profiles/editor/profileEditor.js.map +1 -1
- package/dist/profiles/editor/profileEditorPreview.cjs +44 -43
- package/dist/profiles/editor/profileEditorPreview.cjs.map +1 -1
- package/dist/profiles/editor/profileEditorPreview.d.ts +10 -5
- package/dist/profiles/editor/profileEditorPreview.d.ts.map +1 -1
- package/dist/profiles/editor/profileEditorPreview.js +44 -43
- package/dist/profiles/editor/profileEditorPreview.js.map +1 -1
- package/dist/profiles/editor/profileMappingPreview.cjs +153 -48
- package/dist/profiles/editor/profileMappingPreview.cjs.map +1 -1
- package/dist/profiles/editor/profileMappingPreview.d.ts +16 -2
- package/dist/profiles/editor/profileMappingPreview.d.ts.map +1 -1
- package/dist/profiles/editor/profileMappingPreview.js +155 -50
- package/dist/profiles/editor/profileMappingPreview.js.map +1 -1
- package/dist/profiles/editor/sampleError.cjs +29 -0
- package/dist/profiles/editor/sampleError.cjs.map +1 -0
- package/dist/profiles/editor/sampleError.d.ts +16 -0
- package/dist/profiles/editor/sampleError.d.ts.map +1 -0
- package/dist/profiles/editor/sampleError.js +27 -0
- package/dist/profiles/editor/sampleError.js.map +1 -0
- package/dist/profiles/query/profileSampleResult.cjs.map +1 -1
- package/dist/profiles/query/profileSampleResult.d.ts +2 -0
- package/dist/profiles/query/profileSampleResult.d.ts.map +1 -1
- package/dist/profiles/query/profileSampleResult.js.map +1 -1
- package/dist/profiles/wizard/profileWizardQueryStep.cjs +1 -0
- package/dist/profiles/wizard/profileWizardQueryStep.cjs.map +1 -1
- package/dist/profiles/wizard/profileWizardQueryStep.d.ts +2 -0
- package/dist/profiles/wizard/profileWizardQueryStep.d.ts.map +1 -1
- package/dist/profiles/wizard/profileWizardQueryStep.js +1 -0
- package/dist/profiles/wizard/profileWizardQueryStep.js.map +1 -1
- package/dist/react-grab/core/index.js +1 -1
- package/dist/react-grab/{core-BERtFDWh.js → core-BK5CU6Lb.js} +2 -2
- package/dist/react-grab/index.js +1 -1
- package/dist/react-grab/{renderer-KT3FY3K2.js → renderer-DcHrsQ8k.js} +1 -1
- package/dist/rpc/apiClient.cjs +12 -15
- package/dist/rpc/apiClient.cjs.map +1 -1
- package/dist/rpc/apiClient.js +12 -15
- package/dist/rpc/apiClient.js.map +1 -1
- package/dist/runtime/barrels.json +6507 -6460
- package/dist/runtime/importmap.json +2198 -2185
- package/dist/styles.css +1 -1
- package/package.json +1 -1
|
@@ -110,29 +110,10 @@ function TestTreeNode({ node, selected }) {
|
|
|
110
110
|
const runner = useTestRunner();
|
|
111
111
|
const hasChildren = (node.children?.length ?? 0) > 0;
|
|
112
112
|
const status = testStatus(node);
|
|
113
|
-
const outcome = outcomeFor(node);
|
|
114
|
-
const fwNode = runner.adapters.resolveFrameworkIcon(node, runner)?.renderFrameworkIcon?.({
|
|
115
|
-
node,
|
|
116
|
-
runner
|
|
117
|
-
});
|
|
118
113
|
const leadingAdapter = runner.adapters.resolveRowLeading(node, runner);
|
|
119
|
-
const
|
|
120
|
-
const live = !!node.running && !!node.started && !node.duration;
|
|
121
|
-
const canRerun = !!runner.onRerun && node.framework !== "task";
|
|
122
|
-
const canStop = !!runner.onStop && !!node.can_stop && !!node.task_id;
|
|
123
|
-
const message = status && (MESSAGE_STATUSES.has(status) || node.framework === "task" && (status === "running" || status === "pending")) ? (node.message ?? "").trim() : "";
|
|
114
|
+
const message = rowMessage(node, status);
|
|
124
115
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
125
|
-
|
|
126
|
-
icon: UiClass,
|
|
127
|
-
className: "shrink-0 text-muted-foreground"
|
|
128
|
-
}),
|
|
129
|
-
fwNode != null ? /* @__PURE__ */ jsx("span", {
|
|
130
|
-
className: "flex shrink-0 items-center text-sm",
|
|
131
|
-
children: fwNode
|
|
132
|
-
}) : /* @__PURE__ */ jsx(ToolIcon, {
|
|
133
|
-
tool: toolKeyFor(node),
|
|
134
|
-
className: "text-sm"
|
|
135
|
-
}),
|
|
116
|
+
/* @__PURE__ */ jsx(RowIcons, { node }),
|
|
136
117
|
leadingAdapter?.renderRowLeading?.({
|
|
137
118
|
node,
|
|
138
119
|
runner
|
|
@@ -148,52 +129,92 @@ function TestTreeNode({ node, selected }) {
|
|
|
148
129
|
"data-row-message": "",
|
|
149
130
|
children: message
|
|
150
131
|
}) : /* @__PURE__ */ jsx("span", { className: "flex-1" }),
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
className: "truncate",
|
|
156
|
-
title: node.progress.phase,
|
|
157
|
-
children: node.progress.phase
|
|
158
|
-
}), node.progress.total > 0 && /* @__PURE__ */ jsxs("span", {
|
|
159
|
-
className: "shrink-0 tabular-nums",
|
|
160
|
-
children: [
|
|
161
|
-
node.progress.done,
|
|
162
|
-
"/",
|
|
163
|
-
node.progress.total
|
|
164
|
-
]
|
|
165
|
-
})]
|
|
166
|
-
}),
|
|
167
|
-
live ? /* @__PURE__ */ jsx(ElapsedDuration, {
|
|
168
|
-
startedAt: node.started,
|
|
169
|
-
finishedAt: void 0,
|
|
170
|
-
format: (ms) => formatTestDuration(ms * 1e6),
|
|
171
|
-
className: "shrink-0 text-xs text-muted-foreground"
|
|
172
|
-
}) : dur > 0 && /* @__PURE__ */ jsx("span", {
|
|
173
|
-
className: "shrink-0 text-xs text-muted-foreground",
|
|
174
|
-
children: formatTestDuration(dur)
|
|
132
|
+
/* @__PURE__ */ jsx(RowProgress, { node }),
|
|
133
|
+
/* @__PURE__ */ jsx(RowDuration, {
|
|
134
|
+
node,
|
|
135
|
+
hasChildren
|
|
175
136
|
}),
|
|
176
137
|
hasChildren && /* @__PURE__ */ jsx(CountBadges, { node }),
|
|
177
|
-
|
|
178
|
-
icon: UiStop,
|
|
179
|
-
label: "Stop",
|
|
180
|
-
disabled: runner.busy.stop,
|
|
181
|
-
onClick: (e) => {
|
|
182
|
-
e.stopPropagation();
|
|
183
|
-
runner.onStop(node);
|
|
184
|
-
}
|
|
185
|
-
}),
|
|
186
|
-
canRerun && /* @__PURE__ */ jsx(IconButton, {
|
|
187
|
-
icon: UiRefresh,
|
|
188
|
-
label: "Rerun",
|
|
189
|
-
disabled: runner.busy.rerun,
|
|
190
|
-
onClick: (e) => {
|
|
191
|
-
e.stopPropagation();
|
|
192
|
-
runner.onRerun(node);
|
|
193
|
-
}
|
|
194
|
-
})
|
|
138
|
+
/* @__PURE__ */ jsx(RowActions, { node })
|
|
195
139
|
] });
|
|
196
140
|
}
|
|
141
|
+
function rowMessage(node, status) {
|
|
142
|
+
const taskInFlight = node.framework === "task" && (status === "running" || status === "pending");
|
|
143
|
+
return status && (MESSAGE_STATUSES.has(status) || taskInFlight) ? (node.message ?? "").trim() : "";
|
|
144
|
+
}
|
|
145
|
+
function RowIcons({ node }) {
|
|
146
|
+
const runner = useTestRunner();
|
|
147
|
+
const outcome = outcomeFor(node);
|
|
148
|
+
const fwNode = runner.adapters.resolveFrameworkIcon(node, runner)?.renderFrameworkIcon?.({
|
|
149
|
+
node,
|
|
150
|
+
runner
|
|
151
|
+
});
|
|
152
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [outcome ? /* @__PURE__ */ jsx(OutcomeIcon, { outcome }) : /* @__PURE__ */ jsx(Icon, {
|
|
153
|
+
icon: UiClass,
|
|
154
|
+
className: "shrink-0 text-muted-foreground"
|
|
155
|
+
}), fwNode != null ? /* @__PURE__ */ jsx("span", {
|
|
156
|
+
className: "flex shrink-0 items-center text-sm",
|
|
157
|
+
children: fwNode
|
|
158
|
+
}) : /* @__PURE__ */ jsx(ToolIcon, {
|
|
159
|
+
tool: toolKeyFor(node),
|
|
160
|
+
className: "text-sm"
|
|
161
|
+
})] });
|
|
162
|
+
}
|
|
163
|
+
function RowProgress({ node }) {
|
|
164
|
+
const { progress } = node;
|
|
165
|
+
if (!progress || !(progress.total > 0 || progress.phase) || node.passed || node.failed) return null;
|
|
166
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
167
|
+
className: "flex min-w-0 items-center gap-1 text-xs text-blue-600 dark:text-blue-400",
|
|
168
|
+
"data-row-progress": "",
|
|
169
|
+
children: [progress.phase && /* @__PURE__ */ jsx("span", {
|
|
170
|
+
className: "truncate",
|
|
171
|
+
title: progress.phase,
|
|
172
|
+
children: progress.phase
|
|
173
|
+
}), progress.total > 0 && /* @__PURE__ */ jsxs("span", {
|
|
174
|
+
className: "shrink-0 tabular-nums",
|
|
175
|
+
children: [
|
|
176
|
+
progress.done,
|
|
177
|
+
"/",
|
|
178
|
+
progress.total
|
|
179
|
+
]
|
|
180
|
+
})]
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
function RowDuration({ node, hasChildren }) {
|
|
184
|
+
const dur = node.duration || (hasChildren ? totalDuration(node) : 0);
|
|
185
|
+
if (!!node.running && !!node.started && !node.duration) return /* @__PURE__ */ jsx(ElapsedDuration, {
|
|
186
|
+
startedAt: node.started,
|
|
187
|
+
finishedAt: void 0,
|
|
188
|
+
format: (ms) => formatTestDuration(ms * 1e6),
|
|
189
|
+
className: "shrink-0 text-xs text-muted-foreground"
|
|
190
|
+
});
|
|
191
|
+
return dur > 0 ? /* @__PURE__ */ jsx("span", {
|
|
192
|
+
className: "shrink-0 text-xs text-muted-foreground",
|
|
193
|
+
children: formatTestDuration(dur)
|
|
194
|
+
}) : null;
|
|
195
|
+
}
|
|
196
|
+
function RowActions({ node }) {
|
|
197
|
+
const runner = useTestRunner();
|
|
198
|
+
const canRerun = !!runner.onRerun && node.framework !== "task" && !node.running;
|
|
199
|
+
const canStop = !!runner.onStop && !!node.can_stop && !!node.task_id;
|
|
200
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [canStop && /* @__PURE__ */ jsx(IconButton, {
|
|
201
|
+
icon: UiStop,
|
|
202
|
+
label: "Stop",
|
|
203
|
+
disabled: runner.busy.stop,
|
|
204
|
+
onClick: (e) => {
|
|
205
|
+
e.stopPropagation();
|
|
206
|
+
runner.onStop(node);
|
|
207
|
+
}
|
|
208
|
+
}), canRerun && /* @__PURE__ */ jsx(IconButton, {
|
|
209
|
+
icon: UiRefresh,
|
|
210
|
+
label: "Rerun",
|
|
211
|
+
disabled: runner.busy.rerun,
|
|
212
|
+
onClick: (e) => {
|
|
213
|
+
e.stopPropagation();
|
|
214
|
+
runner.onRerun(node);
|
|
215
|
+
}
|
|
216
|
+
})] });
|
|
217
|
+
}
|
|
197
218
|
export { TestTreeNode };
|
|
198
219
|
|
|
199
220
|
//# sourceMappingURL=TestTreeNode.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TestTreeNode.js","names":["_Fragment"],"sources":["../../../src/data/test-runner/TestTreeNode.tsx"],"sourcesContent":["import { Icon } from \"../Icon\";\nimport { ElapsedDuration } from \"../ElapsedDuration\";\nimport { Badge } from \"../Badge\";\nimport { IconButton } from \"../../components/IconButton\";\nimport { UiClass, UiRefresh, UiStop } from \"../../icons\";\nimport { cn } from \"../../lib/utils\";\nimport type { Test } from \"./types\";\nimport { useTestRunner } from \"./context\";\nimport {\n formatTestDuration,\n humanizeName,\n outcomeFor,\n sum,\n testStatus,\n totalDuration,\n} from \"./status\";\nimport { toolKeyFor } from \"./marks\";\nimport { OutcomeIcon, ToolIcon } from \"./MarkIcons\";\n\nconst NAME_TONE: Record<string, string> = {\n failed: \"text-red-600 dark:text-red-400\",\n timedout: \"text-amber-600 dark:text-amber-400\",\n warned: \"text-amber-600 dark:text-amber-400\",\n aborted: \"text-muted-foreground\",\n running: \"text-blue-600 dark:text-blue-400\",\n skipped: \"text-muted-foreground\",\n pending: \"text-muted-foreground\",\n passed: \"text-foreground\",\n};\n\nconst MESSAGE_STATUSES = new Set([\"failed\", \"timedout\", \"warned\", \"aborted\", \"skipped\"]);\n\n/**\n * Per-status roll-up count badges shown on a container row. A roll-up that is\n * all passed shows none: the row's green outcome icon already says so, and a\n * lone green count only repeats it. The passed count shows beside any other\n * status.\n */\nfunction CountBadges({ node }: { node: Test }) {\n const s = sum(node);\n if (s.total === 0 || s.passed === s.total) return null;\n return (\n <span className=\"flex shrink-0 items-center gap-1\">\n {s.passed > 0 && <Badge tone=\"success\" variant=\"outline\" className=\"rounded-sm\" size=\"xxs\" count={s.passed} />}\n {s.failed > 0 && <Badge tone=\"danger\" variant=\"outline\" className=\"rounded-sm\" size=\"xxs\" count={s.failed} />}\n {s.warned > 0 && <Badge tone=\"warning\" variant=\"outline\" className=\"rounded-sm\" size=\"xxs\" count={s.warned} />}\n {s.timedout > 0 && <Badge tone=\"danger\" variant=\"outline\" className=\"rounded-sm\" size=\"xxs\" count={s.timedout} />}\n {s.aborted > 0 && <Badge tone=\"neutral\" variant=\"outline\" className=\"rounded-sm\" size=\"xxs\" count={s.aborted} />}\n {s.skipped > 0 && <Badge tone=\"neutral\" variant=\"outline\" className=\"rounded-sm\" size=\"xxs\" count={s.skipped} />}\n {s.running > 0 && <Badge tone=\"info\" variant=\"outline\" className=\"rounded-sm\" size=\"xxs\" count={s.running} />}\n {s.pending > 0 && <Badge tone=\"neutral\" variant=\"outline\" className=\"rounded-sm\" size=\"xxs\" count={s.pending} />}\n </span>\n );\n}\n\n/**\n * Renders one test tree row: status icon, optional adapter decoration + framework\n * icon, status-colored name, duration, per-status count badges, and (when the\n * runner exposes the handlers) rerun/stop buttons. Designed as the `renderRow`\n * for the clicky `Tree`.\n */\nexport function TestTreeNode({ node, selected }: { node: Test; selected: boolean }) {\n const runner = useTestRunner();\n const hasChildren = (node.children?.length ?? 0) > 0;\n const status = testStatus(node);\n const outcome = outcomeFor(node);\n const fwAdapter = runner.adapters.resolveFrameworkIcon(node, runner);\n const fwNode = fwAdapter?.renderFrameworkIcon?.({ node, runner });\n const leadingAdapter = runner.adapters.resolveRowLeading(node, runner);\n const dur = node.duration || (hasChildren ? totalDuration(node) : 0);\n const live = !!node.running && !!node.started && !node.duration;\n const canRerun = !!runner.onRerun && node.framework !== \"task\";\n const canStop = !!runner.onStop && !!node.can_stop && !!node.task_id;\n const showMessage = status && (MESSAGE_STATUSES.has(status) || (node.framework === \"task\" && (status === \"running\" || status === \"pending\")));\n const message = showMessage ? (node.message ?? \"\").trim() : \"\";\n\n return (\n <>\n {outcome ? (\n <OutcomeIcon outcome={outcome} />\n ) : (\n <Icon icon={UiClass} className=\"shrink-0 text-muted-foreground\" />\n )}\n\n {fwNode != null ? (\n <span className=\"flex shrink-0 items-center text-sm\">{fwNode}</span>\n ) : (\n <ToolIcon tool={toolKeyFor(node)} className=\"text-sm\" />\n )}\n\n {leadingAdapter?.renderRowLeading?.({ node, runner })}\n\n <span\n className={cn(\n \"min-w-0 truncate\",\n selected ? \"font-semibold\" : \"font-medium\",\n (status && NAME_TONE[status]) || \"text-foreground\",\n )}\n title={message || undefined}\n >\n {runner.adapters.resolveRowLabel(node, runner) ?? humanizeName(node.name, node.framework)}\n </span>\n {/* The verdict trails the name on the same line and gives way first. */}\n {message ? (\n <span\n className=\"min-w-0 flex-1 shrink-[100] truncate text-xs text-muted-foreground\"\n title={message}\n data-row-message=\"\"\n >\n {message}\n </span>\n ) : (\n <span className=\"flex-1\" />\n )}\n\n {node.progress && (node.progress.total > 0 || node.progress.phase) && !node.passed && !node.failed && (\n <span className=\"flex min-w-0 items-center gap-1 text-xs text-blue-600 dark:text-blue-400\" data-row-progress=\"\">\n {node.progress.phase && <span className=\"truncate\" title={node.progress.phase}>{node.progress.phase}</span>}\n {node.progress.total > 0 && (\n <span className=\"shrink-0 tabular-nums\">\n {node.progress.done}/{node.progress.total}\n </span>\n )}\n </span>\n )}\n\n {live ? (\n <ElapsedDuration\n startedAt={node.started}\n finishedAt={undefined}\n format={(ms) => formatTestDuration(ms * 1e6)}\n className=\"shrink-0 text-xs text-muted-foreground\"\n />\n ) : (\n dur > 0 && <span className=\"shrink-0 text-xs text-muted-foreground\">{formatTestDuration(dur)}</span>\n )}\n\n {hasChildren && <CountBadges node={node} />}\n\n {canStop && (\n <IconButton\n icon={UiStop}\n label=\"Stop\"\n disabled={runner.busy.stop}\n onClick={(e) => {\n e.stopPropagation();\n runner.onStop!(node);\n }}\n />\n )}\n\n {canRerun && (\n <IconButton\n icon={UiRefresh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AO,KAAK;GACtB,UAAU,MAAM;IACd,EAAE,gBAAgB;IAClB,OAAO,QAAS,IAAI;GACtB;EACD,CAAA;CAEH,EAAA,CAAA;AAEN"}
|
|
1
|
+
{"version":3,"file":"TestTreeNode.js","names":["_Fragment"],"sources":["../../../src/data/test-runner/TestTreeNode.tsx"],"sourcesContent":["import { Icon } from \"../Icon\";\nimport { ElapsedDuration } from \"../ElapsedDuration\";\nimport { Badge } from \"../Badge\";\nimport { IconButton } from \"../../components/IconButton\";\nimport { UiClass, UiRefresh, UiStop } from \"../../icons\";\nimport { cn } from \"../../lib/utils\";\nimport type { Test } from \"./types\";\nimport { useTestRunner } from \"./context\";\nimport {\n formatTestDuration,\n humanizeName,\n outcomeFor,\n sum,\n testStatus,\n totalDuration,\n} from \"./status\";\nimport { toolKeyFor } from \"./marks\";\nimport { OutcomeIcon, ToolIcon } from \"./MarkIcons\";\n\nconst NAME_TONE: Record<string, string> = {\n failed: \"text-red-600 dark:text-red-400\",\n timedout: \"text-amber-600 dark:text-amber-400\",\n warned: \"text-amber-600 dark:text-amber-400\",\n aborted: \"text-muted-foreground\",\n running: \"text-blue-600 dark:text-blue-400\",\n skipped: \"text-muted-foreground\",\n pending: \"text-muted-foreground\",\n passed: \"text-foreground\",\n};\n\nconst MESSAGE_STATUSES = new Set([\"failed\", \"timedout\", \"warned\", \"aborted\", \"skipped\"]);\n\n/**\n * Per-status roll-up count badges shown on a container row. A roll-up that is\n * all passed shows none: the row's green outcome icon already says so, and a\n * lone green count only repeats it. The passed count shows beside any other\n * status.\n */\nfunction CountBadges({ node }: { node: Test }) {\n const s = sum(node);\n if (s.total === 0 || s.passed === s.total) return null;\n return (\n <span className=\"flex shrink-0 items-center gap-1\">\n {s.passed > 0 && <Badge tone=\"success\" variant=\"outline\" className=\"rounded-sm\" size=\"xxs\" count={s.passed} />}\n {s.failed > 0 && <Badge tone=\"danger\" variant=\"outline\" className=\"rounded-sm\" size=\"xxs\" count={s.failed} />}\n {s.warned > 0 && <Badge tone=\"warning\" variant=\"outline\" className=\"rounded-sm\" size=\"xxs\" count={s.warned} />}\n {s.timedout > 0 && <Badge tone=\"danger\" variant=\"outline\" className=\"rounded-sm\" size=\"xxs\" count={s.timedout} />}\n {s.aborted > 0 && <Badge tone=\"neutral\" variant=\"outline\" className=\"rounded-sm\" size=\"xxs\" count={s.aborted} />}\n {s.skipped > 0 && <Badge tone=\"neutral\" variant=\"outline\" className=\"rounded-sm\" size=\"xxs\" count={s.skipped} />}\n {s.running > 0 && <Badge tone=\"info\" variant=\"outline\" className=\"rounded-sm\" size=\"xxs\" count={s.running} />}\n {s.pending > 0 && <Badge tone=\"neutral\" variant=\"outline\" className=\"rounded-sm\" size=\"xxs\" count={s.pending} />}\n </span>\n );\n}\n\n/**\n * Renders one test tree row: status icon, optional adapter decoration + framework\n * icon, status-colored name, duration, per-status count badges, and (when the\n * runner exposes the handlers) rerun/stop buttons. Designed as the `renderRow`\n * for the clicky `Tree`.\n */\nexport function TestTreeNode({ node, selected }: { node: Test; selected: boolean }) {\n const runner = useTestRunner();\n const hasChildren = (node.children?.length ?? 0) > 0;\n const status = testStatus(node);\n const leadingAdapter = runner.adapters.resolveRowLeading(node, runner);\n const message = rowMessage(node, status);\n\n return (\n <>\n <RowIcons node={node} />\n {leadingAdapter?.renderRowLeading?.({ node, runner })}\n\n <span\n className={cn(\n \"min-w-0 truncate\",\n selected ? \"font-semibold\" : \"font-medium\",\n (status && NAME_TONE[status]) || \"text-foreground\",\n )}\n title={message || undefined}\n >\n {runner.adapters.resolveRowLabel(node, runner) ?? humanizeName(node.name, node.framework)}\n </span>\n {/* The verdict trails the name on the same line and gives way first. */}\n {message ? (\n <span\n className=\"min-w-0 flex-1 shrink-[100] truncate text-xs text-muted-foreground\"\n title={message}\n data-row-message=\"\"\n >\n {message}\n </span>\n ) : (\n <span className=\"flex-1\" />\n )}\n\n <RowProgress node={node} />\n <RowDuration node={node} hasChildren={hasChildren} />\n {hasChildren && <CountBadges node={node} />}\n <RowActions node={node} />\n </>\n );\n}\n\nfunction rowMessage(node: Test, status: string | null | undefined): string {\n const taskInFlight = node.framework === \"task\" && (status === \"running\" || status === \"pending\");\n const showMessage = status && (MESSAGE_STATUSES.has(status) || taskInFlight);\n return showMessage ? (node.message ?? \"\").trim() : \"\";\n}\n\nfunction RowIcons({ node }: { node: Test }) {\n const runner = useTestRunner();\n const outcome = outcomeFor(node);\n const fwNode = runner.adapters.resolveFrameworkIcon(node, runner)?.renderFrameworkIcon?.({ node, runner });\n return (\n <>\n {outcome ? (\n <OutcomeIcon outcome={outcome} />\n ) : (\n <Icon icon={UiClass} className=\"shrink-0 text-muted-foreground\" />\n )}\n {fwNode != null ? (\n <span className=\"flex shrink-0 items-center text-sm\">{fwNode}</span>\n ) : (\n <ToolIcon tool={toolKeyFor(node)} className=\"text-sm\" />\n )}\n </>\n );\n}\n\nfunction RowProgress({ node }: { node: Test }) {\n const { progress } = node;\n if (!progress || !(progress.total > 0 || progress.phase) || node.passed || node.failed) return null;\n return (\n <span className=\"flex min-w-0 items-center gap-1 text-xs text-blue-600 dark:text-blue-400\" data-row-progress=\"\">\n {progress.phase && <span className=\"truncate\" title={progress.phase}>{progress.phase}</span>}\n {progress.total > 0 && (\n <span className=\"shrink-0 tabular-nums\">\n {progress.done}/{progress.total}\n </span>\n )}\n </span>\n );\n}\n\nfunction RowDuration({ node, hasChildren }: { node: Test; hasChildren: boolean }) {\n const dur = node.duration || (hasChildren ? totalDuration(node) : 0);\n const live = !!node.running && !!node.started && !node.duration;\n if (live) {\n return (\n <ElapsedDuration\n startedAt={node.started}\n finishedAt={undefined}\n format={(ms) => formatTestDuration(ms * 1e6)}\n className=\"shrink-0 text-xs text-muted-foreground\"\n />\n );\n }\n return dur > 0 ? <span className=\"shrink-0 text-xs text-muted-foreground\">{formatTestDuration(dur)}</span> : null;\n}\n\nfunction RowActions({ node }: { node: Test }) {\n const runner = useTestRunner();\n // A running row's trailing slot is its elapsed timer, not a rerun it cannot take yet.\n const canRerun = !!runner.onRerun && node.framework !== \"task\" && !node.running;\n const canStop = !!runner.onStop && !!node.can_stop && !!node.task_id;\n return (\n <>\n {canStop && (\n <IconButton\n icon={UiStop}\n label=\"Stop\"\n disabled={runner.busy.stop}\n onClick={(e) => {\n e.stopPropagation();\n runner.onStop!(node);\n }}\n />\n )}\n {canRerun && (\n <IconButton\n icon={UiRefresh}\n label=\"Rerun\"\n disabled={runner.busy.rerun}\n onClick={(e) => {\n e.stopPropagation();\n runner.onRerun!(node);\n }}\n />\n )}\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AAmBA,IAAM,YAAoC;CACxC,QAAQ;CACR,UAAU;CACV,QAAQ;CACR,SAAS;CACT,SAAS;CACT,SAAS;CACT,SAAS;CACT,QAAQ;AACV;AAEA,IAAM,mCAAmB,IAAI,IAAI;CAAC;CAAU;CAAY;CAAU;CAAW;AAAS,CAAC;;;;;;;AAQvF,SAAS,YAAY,EAAE,QAAwB;CAC7C,MAAM,IAAI,IAAI,IAAI;CAClB,IAAI,EAAE,UAAU,KAAK,EAAE,WAAW,EAAE,OAAO,OAAO;CAClD,OACE,qBAAC,QAAD;EAAM,WAAU;EAAhB,UAAA;GACG,EAAE,SAAS,KAAK,oBAAC,OAAD;IAAO,MAAK;IAAU,SAAQ;IAAU,WAAU;IAAa,MAAK;IAAM,OAAO,EAAE;GAAS,CAAA;GAC5G,EAAE,SAAS,KAAK,oBAAC,OAAD;IAAO,MAAK;IAAS,SAAQ;IAAU,WAAU;IAAa,MAAK;IAAM,OAAO,EAAE;GAAS,CAAA;GAC3G,EAAE,SAAS,KAAK,oBAAC,OAAD;IAAO,MAAK;IAAU,SAAQ;IAAU,WAAU;IAAa,MAAK;IAAM,OAAO,EAAE;GAAS,CAAA;GAC5G,EAAE,WAAW,KAAK,oBAAC,OAAD;IAAO,MAAK;IAAS,SAAQ;IAAU,WAAU;IAAa,MAAK;IAAM,OAAO,EAAE;GAAW,CAAA;GAC/G,EAAE,UAAU,KAAK,oB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AM,eAAqD;CAChF,MAAM,MAAM,KAAK,aAAa,cAAc,cAAc,IAAI,IAAI;CAElE,IADa,CAAC,CAAC,KAAK,WAAW,CAAC,CAAC,KAAK,WAAW,CAAC,KAAK,UAErD,OACE,oBAAC,iBAAD;EACE,WAAW,KAAK;EAChB,YAAY,KAAA;EACZ,SAAS,OAAO,mBAAmB,KAAK,GAAG;EAC3C,WAAU;CACX,CAAA;CAGL,OAAO,MAAM,IAAI,oBAAC,QAAD;EAAM,WAAU;EAA0C,UAAA,mBAAmB,GAAG;CAAQ,CAAA,IAAI;AAC/G;AAEA,SAAS,WAAW,EAAE,QAAwB;CAC5C,MAAM,SAAS,cAAc;CAE7B,MAAM,WAAW,CAAC,CAAC,OAAO,WAAW,KAAK,cAAc,UAAU,CAAC,KAAK;CACxE,MAAM,UAAU,CAAC,CAAC,OAAO,UAAU,CAAC,CAAC,KAAK,YAAY,CAAC,CAAC,KAAK;CAC7D,OACE,qBAAAA,UAAA,EAAA,UAAA,CACG,WACC,oBAAC,YAAD;EACE,MAAM;EACN,OAAM;EACN,UAAU,OAAO,KAAK;EACtB,UAAU,MAAM;GACd,EAAE,gBAAgB;GAClB,OAAO,OAAQ,IAAI;EACrB;CACD,CAAA,GAEF,YACC,oBAAC,YAAD;EACE,MAAM;EACN,OAAM;EACN,UAAU,OAAO,KAAK;EACtB,UAAU,MAAM;GACd,EAAE,gBAAgB;GAClB,OAAO,QAAS,IAAI;EACtB;CACD,CAAA,CAEH,EAAA,CAAA;AAEN"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.cjs","names":["testAttemptViews","mergeCopySections"],"sources":["../../../src/data/test-runner/adapter.ts"],"sourcesContent":["// Node adapters let a host plug domain-specific rendering into the test runner\n// without forking it. An adapter claims nodes via `match` and contributes how\n// they render in each surface (tree row, detail body, detail tabs, header\n// actions). The registry resolves the first matching adapter per surface;\n// surfaces with no match fall back to the runner's built-in default rendering.\n//\n// This formalizes the wrapper-with-an-if-chain pattern hosts use today (e.g.\n// a ResultDetailPane fall-through over domain panels + tab providers + per-step\n// actions) into a registered, composable contract.\n\nimport type { ReactNode } from \"react\";\nimport type { Test } from \"./types\";\nimport type { TestRunnerContext } from \"./context\";\nimport { mergeCopySections, type CopySections } from \"./copy\";\nimport { testAttemptViews } from \"./attempts\";\n\nexport type AdapterContext = {\n node: Test;\n runner: TestRunnerContext;\n};\n\nexport type DetailTab = {\n id: string;\n label: string;\n render: () => ReactNode;\n};\n\nexport type DetailAttempt = { id: number; status: string; durationMs?: number; node: Test };\n\nexport type TestNodeAdapter = {\n /** Stable identifier, used as a React key and for debugging. */\n id: string;\n /** Claim the node. The first registered adapter to return true wins per surface. */\n match: (node: Test, runner: TestRunnerContext) => boolean;\n /**\n * Children shown in the navigation tree; results and status rollups stay intact.\n * Return [] to render a node as a leaf. Without a matching hook, uses node.children.\n * @example { id: \"setup-leaf\", match: node => node.name === \"setup\", treeChildren: () => [] }\n */\n treeChildren?: (c: AdapterContext) => Test[] | undefined;\n /**\n * Replace the framework icon for the node — return any node, or null to fall\n * back to the built-in tool mark (`TEST_TOOLS`). For a tool the catalog\n * lacks, prefer adding it to `TEST_TOOLS` so every surface shows it.\n */\n renderFrameworkIcon?: (c: AdapterContext) => ReactNode;\n /** Extra decoration rendered between the framework icon and the node name. */\n renderRowLeading?: (c: AdapterContext) => ReactNode;\n /**\n * The tree row's text in place of the humanized node name, e.g. a step name\n * without the kind prefix a `renderRowLeading` icon already shows. Return\n * undefined to keep the default. The node's name is unchanged everywhere else.\n */\n rowLabel?: (c: AdapterContext) => string | undefined;\n /**\n * Extra content inside the detail header's framework badge, after the\n * framework name (e.g. how the node ran). Return null to show the name alone.\n */\n frameworkBadge?: (c: AdapterContext) => ReactNode;\n /** Primary detail body for the node, replacing the default panel body. */\n renderDetail?: (c: AdapterContext) => ReactNode;\n /** Extra detail tabs, merged (in registration order) across all matching adapters. */\n detailTabs?: (c: AdapterContext) => DetailTab[];\n /** Stored attempt views for the header chooser; tree and run totals remain step-level. */\n detailAttempts?: (c: AdapterContext) => DetailAttempt[];\n /** Node-scoped action buttons rendered in the detail header. */\n nodeActions?: (c: AdapterContext) => ReactNode;\n /**\n * Domain facts, brief sections and menu items for the header's \"Copy details\"\n * button, merged (in registration order) across all matching adapters on top\n * of the generic sections every node gets.\n */\n copy?: (c: AdapterContext) => CopySections;\n /**\n * Whether `renderDetail` owns its own full-height scroll container. When\n * false (the default for custom bodies), the panel wraps it in a scroll\n * region. The built-in default body owns its scroll.\n */\n ownsScroll?: (c: AdapterContext) => boolean;\n};\n\n/**\n * Ordered set of node adapters. First match wins per surface; `detailTabs` and\n * `copy` are the exceptions — they merge across every matching adapter so\n * independent adapters can each contribute a tab or a copy section.\n */\nexport class TestNodeAdapterRegistry {\n readonly adapters: TestNodeAdapter[];\n\n constructor(adapters: TestNodeAdapter[] = []) {\n this.adapters = adapters;\n }\n\n private firstWith(\n node: Test,\n runner: TestRunnerContext,\n has: (a: TestNodeAdapter) => boolean,\n ): TestNodeAdapter | null {\n for (const a of this.adapters) {\n if (has(a) && a.match(node, runner)) return a;\n }\n return null;\n }\n\n /** Adapter whose `renderDetail` should drive the body, or null for the default. */\n resolveDetail(node: Test, runner: TestRunnerContext): TestNodeAdapter | null {\n return this.firstWith(node, runner, (a) => !!a.renderDetail);\n }\n\n resolveRowLeading(node: Test, runner: TestRunnerContext): TestNodeAdapter | null {\n return this.firstWith(node, runner, (a) => !!a.renderRowLeading);\n }\n\n /** The first matching adapter's `rowLabel`, or undefined for the default name. */\n resolveRowLabel(node: Test, runner: TestRunnerContext): string | undefined {\n return this.firstWith(node, runner, (a) => !!a.rowLabel)?.rowLabel?.({ node, runner });\n }\n\n /** The first matching adapter's `frameworkBadge` content, or null for the name alone. */\n resolveFrameworkBadge(node: Test, runner: TestRunnerContext): ReactNode {\n return this.firstWith(node, runner, (a) => !!a.frameworkBadge)?.frameworkBadge?.({ node, runner }) ?? null;\n }\n\n resolveFrameworkIcon(node: Test, runner: TestRunnerContext): TestNodeAdapter | null {\n return this.firstWith(node, runner, (a) => !!a.renderFrameworkIcon);\n }\n\n resolveActions(node: Test, runner: TestRunnerContext): TestNodeAdapter | null {\n return this.firstWith(node, runner, (a) => !!a.nodeActions);\n }\n\n resolveTreeChildren(node: Test, runner: TestRunnerContext): Test[] | undefined {\n const adapter = this.firstWith(node, runner, (a) => !!a.treeChildren);\n return adapter?.treeChildren ? adapter.treeChildren({ node, runner }) : node.children;\n }\n\n /**\n * Attempts for the header chooser: the first matching adapter's\n * `detailAttempts`, else the node's own `attempts` (the built-in default,\n * which always sits behind the registered adapters).\n */\n resolveAttempts(node: Test, runner: TestRunnerContext): DetailAttempt[] {\n const adapted = this.firstWith(node, runner, (a) => !!a.detailAttempts)?.detailAttempts?.({ node, runner });\n if (adapted && adapted.length > 0) return adapted;\n return testAttemptViews(node);\n }\n\n /** Merge `detailTabs` from every matching adapter, de-duplicated by tab id. */\n resolveTabs(node: Test, runner: TestRunnerContext): DetailTab[] {\n const ctx: AdapterContext = { node, runner };\n const seen = new Set<string>();\n const tabs: DetailTab[] = [];\n for (const a of this.adapters) {\n if (!a.detailTabs || !a.match(node, runner)) continue;\n for (const tab of a.detailTabs(ctx)) {\n if (seen.has(tab.id)) continue;\n seen.add(tab.id);\n tabs.push(tab);\n }\n }\n return tabs;\n }\n\n /**\n * Merge `copy` sections from every matching adapter, de-duplicated by fact\n * label, section title and item label — the first contributor wins.\n */\n resolveCopy(node: Test, runner: TestRunnerContext): Required<CopySections> {\n const ctx: AdapterContext = { node, runner };\n return mergeCopySections(\n this.adapters.flatMap((a) => (a.copy && a.match(node, runner) ? [a.copy(ctx)] : [])),\n );\n }\n\n /** True when the resolved detail adapter owns its own scroll region. */\n ownsScroll(node: Test, runner: TestRunnerContext): boolean {\n const a = this.resolveDetail(node, runner);\n if (!a?.ownsScroll) return false;\n return a.ownsScroll({ node, runner });\n }\n}\n\nexport function createTestRunnerRegistry(\n adapters: TestNodeAdapter[] = [],\n): TestNode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K,UAAU,MAAM,SAAS,MAAM,CAAC,CAAC,EAAE,cAAc,CAAC,EAAE,iBAAiB;GAAE;GAAM;EAAO,CAAC;EAC1G,IAAI,WAAW,QAAQ,SAAS,GAAG,OAAO;EAC1C,OAAOA,iBAAAA,iBAAiB,IAAI;CAC9B;;CAGA,YAAY,MAAY,QAAwC;EAC9D,MAAM,MAAsB;GAAE;GAAM;EAAO;EAC3C,MAAM,uBAAO,IAAI,IAAY;EAC7B,MAAM,OAAoB,CAAC;EAC3B,KAAK,MAAM,KAAK,KAAK,UAAU;GAC7B,IAAI,CAAC,EAAE,cAAc,CAAC,EAAE,MAAM,MAAM,MAAM,GAAG;GAC7C,KAAK,MAAM,OAAO,EAAE,WAAW,GAAG,GAAG;IACnC,IAAI,KAAK,IAAI,IAAI,EAAE,GAAG;IACtB,KAAK,IAAI,IAAI,EAAE;IACf,KAAK,KAAK,GAAG;GACf;EACF;EACA,OAAO;CACT;;;;;CAMA,YAAY,MAAY,QAAmD;EACzE,MAAM,MAAsB;GAAE;GAAM;EAAO;EAC3C,OAAOC,aAAAA,kBACL,KAAK,SAAS,SAAS,MAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,MAAM,IAAI,CAAC,EAAE,KAAK,GAAG,CAAC,IAAI,CAAC,CAAE,CACrF;CACF;;CAGA,WAAW,MAAY,QAAoC;EACzD,MAAM,IAAI,KAAK,cAAc,MAAM,MAAM;EACzC,IAAI,CAAC,GAAG,YAAY,OAAO;EAC3B,OAAO,EAAE,WAAW;GAAE;GAAM;EAAO,CAAC;CACtC;AACF;AAEA,SAAgB,yBACd,WAA8B,CAAC,GACN;CACzB,OAAO,IAAI,wBAAwB,QAAQ;AAC7C"}
|
|
1
|
+
{"version":3,"file":"adapter.cjs","names":["testAttemptViews","mergeCopySections"],"sources":["../../../src/data/test-runner/adapter.ts"],"sourcesContent":["// Node adapters let a host plug domain-specific rendering into the test runner\n// without forking it. An adapter claims nodes via `match` and contributes how\n// they render in each surface (tree row, detail body, detail tabs, header\n// actions). The registry resolves the first matching adapter per surface;\n// surfaces with no match fall back to the runner's built-in default rendering.\n//\n// This formalizes the wrapper-with-an-if-chain pattern hosts use today (e.g.\n// a ResultDetailPane fall-through over domain panels + tab providers + per-step\n// actions) into a registered, composable contract.\n\nimport type { ReactNode } from \"react\";\nimport type { Test } from \"./types\";\nimport type { TestRunnerContext } from \"./context\";\nimport { mergeCopySections, type CopySections, type MergedCopySections } from \"./copy\";\nimport { testAttemptViews } from \"./attempts\";\n\nexport type AdapterContext = {\n node: Test;\n runner: TestRunnerContext;\n};\n\nexport type DetailTab = {\n id: string;\n label: string;\n render: () => ReactNode;\n};\n\nexport type DetailAttempt = { id: number; status: string; durationMs?: number; node: Test };\n\nexport type TestNodeAdapter = {\n /** Stable identifier, used as a React key and for debugging. */\n id: string;\n /** Claim the node. The first registered adapter to return true wins per surface. */\n match: (node: Test, runner: TestRunnerContext) => boolean;\n /**\n * Children shown in the navigation tree; results and status rollups stay intact.\n * Return [] to render a node as a leaf. Without a matching hook, uses node.children.\n * @example { id: \"setup-leaf\", match: node => node.name === \"setup\", treeChildren: () => [] }\n */\n treeChildren?: (c: AdapterContext) => Test[] | undefined;\n /**\n * Replace the framework icon for the node — return any node, or null to fall\n * back to the built-in tool mark (`TEST_TOOLS`). For a tool the catalog\n * lacks, prefer adding it to `TEST_TOOLS` so every surface shows it.\n */\n renderFrameworkIcon?: (c: AdapterContext) => ReactNode;\n /** Extra decoration rendered between the framework icon and the node name. */\n renderRowLeading?: (c: AdapterContext) => ReactNode;\n /**\n * The tree row's text in place of the humanized node name, e.g. a step name\n * without the kind prefix a `renderRowLeading` icon already shows. Return\n * undefined to keep the default. The node's name is unchanged everywhere else.\n */\n rowLabel?: (c: AdapterContext) => string | undefined;\n /**\n * Extra content inside the detail header's framework badge, after the\n * framework name (e.g. how the node ran). Return null to show the name alone.\n */\n frameworkBadge?: (c: AdapterContext) => ReactNode;\n /** Primary detail body for the node, replacing the default panel body. */\n renderDetail?: (c: AdapterContext) => ReactNode;\n /** Extra detail tabs, merged (in registration order) across all matching adapters. */\n detailTabs?: (c: AdapterContext) => DetailTab[];\n /** Stored attempt views for the header chooser; tree and run totals remain step-level. */\n detailAttempts?: (c: AdapterContext) => DetailAttempt[];\n /** Node-scoped action buttons rendered in the detail header. */\n nodeActions?: (c: AdapterContext) => ReactNode;\n /**\n * Domain facts, brief sections and menu items for the header's \"Copy details\"\n * button, merged (in registration order) across all matching adapters on top\n * of the generic sections every node gets.\n */\n copy?: (c: AdapterContext) => CopySections;\n /**\n * Whether `renderDetail` owns its own full-height scroll container. When\n * false (the default for custom bodies), the panel wraps it in a scroll\n * region. The built-in default body owns its scroll.\n */\n ownsScroll?: (c: AdapterContext) => boolean;\n};\n\n/**\n * Ordered set of node adapters. First match wins per surface; `detailTabs` and\n * `copy` are the exceptions — they merge across every matching adapter so\n * independent adapters can each contribute a tab or a copy section.\n */\nexport class TestNodeAdapterRegistry {\n readonly adapters: TestNodeAdapter[];\n\n constructor(adapters: TestNodeAdapter[] = []) {\n this.adapters = adapters;\n }\n\n private firstWith(\n node: Test,\n runner: TestRunnerContext,\n has: (a: TestNodeAdapter) => boolean,\n ): TestNodeAdapter | null {\n for (const a of this.adapters) {\n if (has(a) && a.match(node, runner)) return a;\n }\n return null;\n }\n\n /** Adapter whose `renderDetail` should drive the body, or null for the default. */\n resolveDetail(node: Test, runner: TestRunnerContext): TestNodeAdapter | null {\n return this.firstWith(node, runner, (a) => !!a.renderDetail);\n }\n\n resolveRowLeading(node: Test, runner: TestRunnerContext): TestNodeAdapter | null {\n return this.firstWith(node, runner, (a) => !!a.renderRowLeading);\n }\n\n /** The first matching adapter's `rowLabel`, or undefined for the default name. */\n resolveRowLabel(node: Test, runner: TestRunnerContext): string | undefined {\n return this.firstWith(node, runner, (a) => !!a.rowLabel)?.rowLabel?.({ node, runner });\n }\n\n /** The first matching adapter's `frameworkBadge` content, or null for the name alone. */\n resolveFrameworkBadge(node: Test, runner: TestRunnerContext): ReactNode {\n return this.firstWith(node, runner, (a) => !!a.frameworkBadge)?.frameworkBadge?.({ node, runner }) ?? null;\n }\n\n resolveFrameworkIcon(node: Test, runner: TestRunnerContext): TestNodeAdapter | null {\n return this.firstWith(node, runner, (a) => !!a.renderFrameworkIcon);\n }\n\n resolveActions(node: Test, runner: TestRunnerContext): TestNodeAdapter | null {\n return this.firstWith(node, runner, (a) => !!a.nodeActions);\n }\n\n resolveTreeChildren(node: Test, runner: TestRunnerContext): Test[] | undefined {\n const adapter = this.firstWith(node, runner, (a) => !!a.treeChildren);\n return adapter?.treeChildren ? adapter.treeChildren({ node, runner }) : node.children;\n }\n\n /**\n * Attempts for the header chooser: the first matching adapter's\n * `detailAttempts`, else the node's own `attempts` (the built-in default,\n * which always sits behind the registered adapters).\n */\n resolveAttempts(node: Test, runner: TestRunnerContext): DetailAttempt[] {\n const adapted = this.firstWith(node, runner, (a) => !!a.detailAttempts)?.detailAttempts?.({ node, runner });\n if (adapted && adapted.length > 0) return adapted;\n return testAttemptViews(node);\n }\n\n /** Merge `detailTabs` from every matching adapter, de-duplicated by tab id. */\n resolveTabs(node: Test, runner: TestRunnerContext): DetailTab[] {\n const ctx: AdapterContext = { node, runner };\n const seen = new Set<string>();\n const tabs: DetailTab[] = [];\n for (const a of this.adapters) {\n if (!a.detailTabs || !a.match(node, runner)) continue;\n for (const tab of a.detailTabs(ctx)) {\n if (seen.has(tab.id)) continue;\n seen.add(tab.id);\n tabs.push(tab);\n }\n }\n return tabs;\n }\n\n /**\n * Merge `copy` sections from every matching adapter, de-duplicated by fact\n * label, section title and item label — the first contributor wins.\n */\n resolveCopy(node: Test, runner: TestRunnerContext): MergedCopySections {\n const ctx: AdapterContext = { node, runner };\n return mergeCopySections(\n this.adapters.flatMap((a) => (a.copy && a.match(node, runner) ? [a.copy(ctx)] : [])),\n );\n }\n\n /** True when the resolved detail adapter owns its own scroll region. */\n ownsScroll(node: Test, runner: TestRunnerContext): boolean {\n const a = this.resolveDetail(node, runner);\n if (!a?.ownsScroll) return false;\n return a.ownsScroll({ node, runner });\n }\n}\n\nexport function createTestRunnerRegistry(\n adapters: TestNodeAdapter[] = [],\n): TestNodeAdapterRegistry {\n return new TestNodeAdapterRegistry(adapters);\n}\n"],"mappings":";;;;;;;;AAsFA,IAAa,0BAAb,MAAqC;CACnC;CAEA,YAAY,WAA8B,CAAC,GAAG;EAC5C,KAAK,WAAW;CAClB;CAEA,UACE,MACA,QACA,KACwB;EACxB,KAAK,MAAM,KAAK,KAAK,UACnB,IAAI,IAAI,CAAC,KAAK,EAAE,MAAM,MAAM,MAAM,GAAG,OAAO;EAE9C,OAAO;CACT;;CAGA,cAAc,MAAY,QAAmD;EAC3E,OAAO,KAAK,UAAU,MAAM,SAAS,MAAM,CAAC,CAAC,EAAE,YAAY;CAC7D;CAEA,kBAAkB,MAAY,QAAmD;EAC/E,OAAO,KAAK,UAAU,MAAM,SAAS,MAAM,CAAC,CAAC,EAAE,gBAAgB;CACjE;;CAGA,gBAAgB,MAAY,QAA+C;EACzE,OAAO,KAAK,UAAU,MAAM,SAAS,MAAM,CAAC,CAAC,EAAE,QAAQ,CAAC,EAAE,WAAW;GAAE;GAAM;EAAO,CAAC;CACvF;;CAGA,sBAAsB,MAAY,QAAsC;EACtE,OAAO,KAAK,UAAU,MAAM,SAAS,MAAM,CAAC,CAAC,EAAE,cAAc,CAAC,EAAE,iBAAiB;GAAE;GAAM;EAAO,CAAC,KAAK;CACxG;CAEA,qBAAqB,MAAY,QAAmD;EAClF,OAAO,KAAK,UAAU,MAAM,SAAS,MAAM,CAAC,CAAC,EAAE,mBAAmB;CACpE;CAEA,eAAe,MAAY,QAAmD;EAC5E,OAAO,KAAK,UAAU,MAAM,SAAS,MAAM,CAAC,CAAC,EAAE,WAAW;CAC5D;CAEA,oBAAoB,MAAY,QAA+C;EAC7E,MAAM,UAAU,KAAK,UAAU,MAAM,SAAS,MAAM,CAAC,CAAC,EAAE,YAAY;EACpE,OAAO,SAAS,eAAe,QAAQ,aA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
|
|
3
3
|
import { TestRunnerContext } from './context.js';
|
|
4
|
-
import { CopySections } from './copy.js';
|
|
4
|
+
import { CopySections, MergedCopySections } from './copy.js';
|
|
5
5
|
export type AdapterContext = {
|
|
6
6
|
node: Test;
|
|
7
7
|
runner: TestRunnerContext;
|
|
@@ -99,7 +99,7 @@ export declare class TestNodeAdapterRegistry {
|
|
|
99
99
|
* Merge `copy` sections from every matching adapter, de-duplicated by fact
|
|
100
100
|
* label, section title and item label — the first contributor wins.
|
|
101
101
|
*/
|
|
102
|
-
resolveCopy(node: Test, runner: TestRunnerContext):
|
|
102
|
+
resolveCopy(node: Test, runner: TestRunnerContext): MergedCopySections;
|
|
103
103
|
/** True when the resolved detail adapter owns its own scroll region. */
|
|
104
104
|
ownsScroll(node: Test, runner: TestRunnerContext): boolean;
|
|
105
105
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../src/data/test-runner/adapter.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAqB,KAAK,YAAY,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../src/data/test-runner/adapter.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAqB,KAAK,YAAY,EAAE,KAAK,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAGvF,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,IA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BAAiB,GAAG,SAAS,EAAE;IAe/D;;;OAGG;IACH,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,iBAAiB,GAAG,kBAAkB;IAOtE,wEAAwE;IACxE,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,iBAAiB,GAAG,OAAO;CAK3D;AAED,wBAAgB,wBAAwB,CACtC,QAAQ,GAAE,eAAe,EAAO,GAC/B,uBAAuB,CAEzB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.js","names":[],"sources":["../../../src/data/test-runner/adapter.ts"],"sourcesContent":["// Node adapters let a host plug domain-specific rendering into the test runner\n// without forking it. An adapter claims nodes via `match` and contributes how\n// they render in each surface (tree row, detail body, detail tabs, header\n// actions). The registry resolves the first matching adapter per surface;\n// surfaces with no match fall back to the runner's built-in default rendering.\n//\n// This formalizes the wrapper-with-an-if-chain pattern hosts use today (e.g.\n// a ResultDetailPane fall-through over domain panels + tab providers + per-step\n// actions) into a registered, composable contract.\n\nimport type { ReactNode } from \"react\";\nimport type { Test } from \"./types\";\nimport type { TestRunnerContext } from \"./context\";\nimport { mergeCopySections, type CopySections } from \"./copy\";\nimport { testAttemptViews } from \"./attempts\";\n\nexport type AdapterContext = {\n node: Test;\n runner: TestRunnerContext;\n};\n\nexport type DetailTab = {\n id: string;\n label: string;\n render: () => ReactNode;\n};\n\nexport type DetailAttempt = { id: number; status: string; durationMs?: number; node: Test };\n\nexport type TestNodeAdapter = {\n /** Stable identifier, used as a React key and for debugging. */\n id: string;\n /** Claim the node. The first registered adapter to return true wins per surface. */\n match: (node: Test, runner: TestRunnerContext) => boolean;\n /**\n * Children shown in the navigation tree; results and status rollups stay intact.\n * Return [] to render a node as a leaf. Without a matching hook, uses node.children.\n * @example { id: \"setup-leaf\", match: node => node.name === \"setup\", treeChildren: () => [] }\n */\n treeChildren?: (c: AdapterContext) => Test[] | undefined;\n /**\n * Replace the framework icon for the node — return any node, or null to fall\n * back to the built-in tool mark (`TEST_TOOLS`). For a tool the catalog\n * lacks, prefer adding it to `TEST_TOOLS` so every surface shows it.\n */\n renderFrameworkIcon?: (c: AdapterContext) => ReactNode;\n /** Extra decoration rendered between the framework icon and the node name. */\n renderRowLeading?: (c: AdapterContext) => ReactNode;\n /**\n * The tree row's text in place of the humanized node name, e.g. a step name\n * without the kind prefix a `renderRowLeading` icon already shows. Return\n * undefined to keep the default. The node's name is unchanged everywhere else.\n */\n rowLabel?: (c: AdapterContext) => string | undefined;\n /**\n * Extra content inside the detail header's framework badge, after the\n * framework name (e.g. how the node ran). Return null to show the name alone.\n */\n frameworkBadge?: (c: AdapterContext) => ReactNode;\n /** Primary detail body for the node, replacing the default panel body. */\n renderDetail?: (c: AdapterContext) => ReactNode;\n /** Extra detail tabs, merged (in registration order) across all matching adapters. */\n detailTabs?: (c: AdapterContext) => DetailTab[];\n /** Stored attempt views for the header chooser; tree and run totals remain step-level. */\n detailAttempts?: (c: AdapterContext) => DetailAttempt[];\n /** Node-scoped action buttons rendered in the detail header. */\n nodeActions?: (c: AdapterContext) => ReactNode;\n /**\n * Domain facts, brief sections and menu items for the header's \"Copy details\"\n * button, merged (in registration order) across all matching adapters on top\n * of the generic sections every node gets.\n */\n copy?: (c: AdapterContext) => CopySections;\n /**\n * Whether `renderDetail` owns its own full-height scroll container. When\n * false (the default for custom bodies), the panel wraps it in a scroll\n * region. The built-in default body owns its scroll.\n */\n ownsScroll?: (c: AdapterContext) => boolean;\n};\n\n/**\n * Ordered set of node adapters. First match wins per surface; `detailTabs` and\n * `copy` are the exceptions — they merge across every matching adapter so\n * independent adapters can each contribute a tab or a copy section.\n */\nexport class TestNodeAdapterRegistry {\n readonly adapters: TestNodeAdapter[];\n\n constructor(adapters: TestNodeAdapter[] = []) {\n this.adapters = adapters;\n }\n\n private firstWith(\n node: Test,\n runner: TestRunnerContext,\n has: (a: TestNodeAdapter) => boolean,\n ): TestNodeAdapter | null {\n for (const a of this.adapters) {\n if (has(a) && a.match(node, runner)) return a;\n }\n return null;\n }\n\n /** Adapter whose `renderDetail` should drive the body, or null for the default. */\n resolveDetail(node: Test, runner: TestRunnerContext): TestNodeAdapter | null {\n return this.firstWith(node, runner, (a) => !!a.renderDetail);\n }\n\n resolveRowLeading(node: Test, runner: TestRunnerContext): TestNodeAdapter | null {\n return this.firstWith(node, runner, (a) => !!a.renderRowLeading);\n }\n\n /** The first matching adapter's `rowLabel`, or undefined for the default name. */\n resolveRowLabel(node: Test, runner: TestRunnerContext): string | undefined {\n return this.firstWith(node, runner, (a) => !!a.rowLabel)?.rowLabel?.({ node, runner });\n }\n\n /** The first matching adapter's `frameworkBadge` content, or null for the name alone. */\n resolveFrameworkBadge(node: Test, runner: TestRunnerContext): ReactNode {\n return this.firstWith(node, runner, (a) => !!a.frameworkBadge)?.frameworkBadge?.({ node, runner }) ?? null;\n }\n\n resolveFrameworkIcon(node: Test, runner: TestRunnerContext): TestNodeAdapter | null {\n return this.firstWith(node, runner, (a) => !!a.renderFrameworkIcon);\n }\n\n resolveActions(node: Test, runner: TestRunnerContext): TestNodeAdapter | null {\n return this.firstWith(node, runner, (a) => !!a.nodeActions);\n }\n\n resolveTreeChildren(node: Test, runner: TestRunnerContext): Test[] | undefined {\n const adapter = this.firstWith(node, runner, (a) => !!a.treeChildren);\n return adapter?.treeChildren ? adapter.treeChildren({ node, runner }) : node.children;\n }\n\n /**\n * Attempts for the header chooser: the first matching adapter's\n * `detailAttempts`, else the node's own `attempts` (the built-in default,\n * which always sits behind the registered adapters).\n */\n resolveAttempts(node: Test, runner: TestRunnerContext): DetailAttempt[] {\n const adapted = this.firstWith(node, runner, (a) => !!a.detailAttempts)?.detailAttempts?.({ node, runner });\n if (adapted && adapted.length > 0) return adapted;\n return testAttemptViews(node);\n }\n\n /** Merge `detailTabs` from every matching adapter, de-duplicated by tab id. */\n resolveTabs(node: Test, runner: TestRunnerContext): DetailTab[] {\n const ctx: AdapterContext = { node, runner };\n const seen = new Set<string>();\n const tabs: DetailTab[] = [];\n for (const a of this.adapters) {\n if (!a.detailTabs || !a.match(node, runner)) continue;\n for (const tab of a.detailTabs(ctx)) {\n if (seen.has(tab.id)) continue;\n seen.add(tab.id);\n tabs.push(tab);\n }\n }\n return tabs;\n }\n\n /**\n * Merge `copy` sections from every matching adapter, de-duplicated by fact\n * label, section title and item label — the first contributor wins.\n */\n resolveCopy(node: Test, runner: TestRunnerContext): Required<CopySections> {\n const ctx: AdapterContext = { node, runner };\n return mergeCopySections(\n this.adapters.flatMap((a) => (a.copy && a.match(node, runner) ? [a.copy(ctx)] : [])),\n );\n }\n\n /** True when the resolved detail adapter owns its own scroll region. */\n ownsScroll(node: Test, runner: TestRunnerContext): boolean {\n const a = this.resolveDetail(node, runner);\n if (!a?.ownsScroll) return false;\n return a.ownsScroll({ node, runner });\n }\n}\n\nexport function createTestRunnerRegistry(\n adapters: TestNodeAdapter[] = [],\n): TestNodeAdapterRegistry {\n return new TestNodeAdapterRegistry(adapters);\n}\n"],"mappings":";;;;;;;;AAsFA,IAAa,0BAAb,MAAqC;CACnC;CAEA,YAAY,WAA8B,CAAC,GAAG;EAC5C,KAAK,WAAW;CAClB;CAEA,UACE,MACA,QACA,KACwB;EACxB,KAAK,MAAM,KAAK,KAAK,UACnB,IAAI,IAAI,CAAC,KAAK,EAAE,MAAM,MAAM,MAAM,GAAG,OAAO;EAE9C,OAAO;CACT;;CAGA,cAAc,MAAY,QAAmD;EAC3E,OAAO,KAAK,UAAU,MAAM,SAAS,MAAM,CAAC,CAAC,EAAE,YAAY;CAC7D;CAEA,kBAAkB,MAAY,QAAmD;EAC/E,OAAO,KAAK,UAAU,MAAM,SAAS,MAAM,CAAC,CAAC,EAAE,gBAAgB;CACjE;;CAGA,gBAAgB,MAAY,QAA+C;EACzE,OAAO,KAAK,UAAU,MAAM,SAAS,MAAM,CAAC,CAAC,EAAE,QAAQ,CAAC,EAAE,WAAW;GAAE;GAAM;EAAO,CAAC;CACvF;;CAGA,sBAAsB,MAAY,Q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,SAAS,SAAS,MAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,MAAM,IAAI,CAAC,EAAE,KAAK,GAAG,CAAC,IAAI,CAAC,CAAE,CACrF;CACF;;CAGA,WAAW,MAAY,QAAoC;EACzD,MAAM,IAAI,KAAK,cAAc,MAAM,MAAM;EACzC,IAAI,CAAC,GAAG,YAAY,OAAO;EAC3B,OAAO,EAAE,WAAW;GAAE;GAAM;EAAO,CAAC;CACtC;AACF;AAEA,SAAgB,yBACd,WAA8B,CAAC,GACN;CACzB,OAAO,IAAI,wBAAwB,QAAQ;AAC7C"}
|
|
1
|
+
{"version":3,"file":"adapter.js","names":[],"sources":["../../../src/data/test-runner/adapter.ts"],"sourcesContent":["// Node adapters let a host plug domain-specific rendering into the test runner\n// without forking it. An adapter claims nodes via `match` and contributes how\n// they render in each surface (tree row, detail body, detail tabs, header\n// actions). The registry resolves the first matching adapter per surface;\n// surfaces with no match fall back to the runner's built-in default rendering.\n//\n// This formalizes the wrapper-with-an-if-chain pattern hosts use today (e.g.\n// a ResultDetailPane fall-through over domain panels + tab providers + per-step\n// actions) into a registered, composable contract.\n\nimport type { ReactNode } from \"react\";\nimport type { Test } from \"./types\";\nimport type { TestRunnerContext } from \"./context\";\nimport { mergeCopySections, type CopySections, type MergedCopySections } from \"./copy\";\nimport { testAttemptViews } from \"./attempts\";\n\nexport type AdapterContext = {\n node: Test;\n runner: TestRunnerContext;\n};\n\nexport type DetailTab = {\n id: string;\n label: string;\n render: () => ReactNode;\n};\n\nexport type DetailAttempt = { id: number; status: string; durationMs?: number; node: Test };\n\nexport type TestNodeAdapter = {\n /** Stable identifier, used as a React key and for debugging. */\n id: string;\n /** Claim the node. The first registered adapter to return true wins per surface. */\n match: (node: Test, runner: TestRunnerContext) => boolean;\n /**\n * Children shown in the navigation tree; results and status rollups stay intact.\n * Return [] to render a node as a leaf. Without a matching hook, uses node.children.\n * @example { id: \"setup-leaf\", match: node => node.name === \"setup\", treeChildren: () => [] }\n */\n treeChildren?: (c: AdapterContext) => Test[] | undefined;\n /**\n * Replace the framework icon for the node — return any node, or null to fall\n * back to the built-in tool mark (`TEST_TOOLS`). For a tool the catalog\n * lacks, prefer adding it to `TEST_TOOLS` so every surface shows it.\n */\n renderFrameworkIcon?: (c: AdapterContext) => ReactNode;\n /** Extra decoration rendered between the framework icon and the node name. */\n renderRowLeading?: (c: AdapterContext) => ReactNode;\n /**\n * The tree row's text in place of the humanized node name, e.g. a step name\n * without the kind prefix a `renderRowLeading` icon already shows. Return\n * undefined to keep the default. The node's name is unchanged everywhere else.\n */\n rowLabel?: (c: AdapterContext) => string | undefined;\n /**\n * Extra content inside the detail header's framework badge, after the\n * framework name (e.g. how the node ran). Return null to show the name alone.\n */\n frameworkBadge?: (c: AdapterContext) => ReactNode;\n /** Primary detail body for the node, replacing the default panel body. */\n renderDetail?: (c: AdapterContext) => ReactNode;\n /** Extra detail tabs, merged (in registration order) across all matching adapters. */\n detailTabs?: (c: AdapterContext) => DetailTab[];\n /** Stored attempt views for the header chooser; tree and run totals remain step-level. */\n detailAttempts?: (c: AdapterContext) => DetailAttempt[];\n /** Node-scoped action buttons rendered in the detail header. */\n nodeActions?: (c: AdapterContext) => ReactNode;\n /**\n * Domain facts, brief sections and menu items for the header's \"Copy details\"\n * button, merged (in registration order) across all matching adapters on top\n * of the generic sections every node gets.\n */\n copy?: (c: AdapterContext) => CopySections;\n /**\n * Whether `renderDetail` owns its own full-height scroll container. When\n * false (the default for custom bodies), the panel wraps it in a scroll\n * region. The built-in default body owns its scroll.\n */\n ownsScroll?: (c: AdapterContext) => boolean;\n};\n\n/**\n * Ordered set of node adapters. First match wins per surface; `detailTabs` and\n * `copy` are the exceptions — they merge across every matching adapter so\n * independent adapters can each contribute a tab or a copy section.\n */\nexport class TestNodeAdapterRegistry {\n readonly adapters: TestNodeAdapter[];\n\n constructor(adapters: TestNodeAdapter[] = []) {\n this.adapters = adapters;\n }\n\n private firstWith(\n node: Test,\n runner: TestRunnerContext,\n has: (a: TestNodeAdapter) => boolean,\n ): TestNodeAdapter | null {\n for (const a of this.adapters) {\n if (has(a) && a.match(node, runner)) return a;\n }\n return null;\n }\n\n /** Adapter whose `renderDetail` should drive the body, or null for the default. */\n resolveDetail(node: Test, runner: TestRunnerContext): TestNodeAdapter | null {\n return this.firstWith(node, runner, (a) => !!a.renderDetail);\n }\n\n resolveRowLeading(node: Test, runner: TestRunnerContext): TestNodeAdapter | null {\n return this.firstWith(node, runner, (a) => !!a.renderRowLeading);\n }\n\n /** The first matching adapter's `rowLabel`, or undefined for the default name. */\n resolveRowLabel(node: Test, runner: TestRunnerContext): string | undefined {\n return this.firstWith(node, runner, (a) => !!a.rowLabel)?.rowLabel?.({ node, runner });\n }\n\n /** The first matching adapter's `frameworkBadge` content, or null for the name alone. */\n resolveFrameworkBadge(node: Test, runner: TestRunnerContext): ReactNode {\n return this.firstWith(node, runner, (a) => !!a.frameworkBadge)?.frameworkBadge?.({ node, runner }) ?? null;\n }\n\n resolveFrameworkIcon(node: Test, runner: TestRunnerContext): TestNodeAdapter | null {\n return this.firstWith(node, runner, (a) => !!a.renderFrameworkIcon);\n }\n\n resolveActions(node: Test, runner: TestRunnerContext): TestNodeAdapter | null {\n return this.firstWith(node, runner, (a) => !!a.nodeActions);\n }\n\n resolveTreeChildren(node: Test, runner: TestRunnerContext): Test[] | undefined {\n const adapter = this.firstWith(node, runner, (a) => !!a.treeChildren);\n return adapter?.treeChildren ? adapter.treeChildren({ node, runner }) : node.children;\n }\n\n /**\n * Attempts for the header chooser: the first matching adapter's\n * `detailAttempts`, else the node's own `attempts` (the built-in default,\n * which always sits behind the registered adapters).\n */\n resolveAttempts(node: Test, runner: TestRunnerContext): DetailAttempt[] {\n const adapted = this.firstWith(node, runner, (a) => !!a.detailAttempts)?.detailAttempts?.({ node, runner });\n if (adapted && adapted.length > 0) return adapted;\n return testAttemptViews(node);\n }\n\n /** Merge `detailTabs` from every matching adapter, de-duplicated by tab id. */\n resolveTabs(node: Test, runner: TestRunnerContext): DetailTab[] {\n const ctx: AdapterContext = { node, runner };\n const seen = new Set<string>();\n const tabs: DetailTab[] = [];\n for (const a of this.adapters) {\n if (!a.detailTabs || !a.match(node, runner)) continue;\n for (const tab of a.detailTabs(ctx)) {\n if (seen.has(tab.id)) continue;\n seen.add(tab.id);\n tabs.push(tab);\n }\n }\n return tabs;\n }\n\n /**\n * Merge `copy` sections from every matching adapter, de-duplicated by fact\n * label, section title and item label — the first contributor wins.\n */\n resolveCopy(node: Test, runner: TestRunnerContext): MergedCopySections {\n const ctx: AdapterContext = { node, runner };\n return mergeCopySections(\n this.adapters.flatMap((a) => (a.copy && a.match(node, runner) ? [a.copy(ctx)] : [])),\n );\n }\n\n /** True when the resolved detail adapter owns its own scroll region. */\n ownsScroll(node: Test, runner: TestRunnerContext): boolean {\n const a = this.resolveDetail(node, runner);\n if (!a?.ownsScroll) return false;\n return a.ownsScroll({ node, runner });\n }\n}\n\nexport function createTestRunnerRegistry(\n adapters: TestNodeAdapter[] = [],\n): TestNodeAdapterRegistry {\n return new TestNodeAdapterRegistry(adapters);\n}\n"],"mappings":";;;;;;;;AAsFA,IAAa,0BAAb,MAAqC;CACnC;CAEA,YAAY,WAA8B,CAAC,GAAG;EAC5C,KAAK,WAAW;CAClB;CAEA,UACE,MACA,QACA,KACwB;EACxB,KAAK,MAAM,KAAK,KAAK,UACnB,IAAI,IAAI,CAAC,KAAK,EAAE,MAAM,MAAM,MAAM,GAAG,OAAO;EAE9C,OAAO;CACT;;CAGA,cAAc,MAAY,QAAmD;EAC3E,OAAO,KAAK,UAAU,MAAM,SAAS,MAAM,CAAC,CAAC,EAAE,YAAY;CAC7D;CAEA,kBAAkB,MAAY,QAAmD;EAC/E,OAAO,KAAK,UAAU,MAAM,SAAS,MAAM,CAAC,CAAC,EAAE,gBAAgB;CACjE;;CAGA,gBAAgB,MAAY,QAA+C;EACzE,OAAO,KAAK,UAAU,MAAM,SAAS,MAAM,CAAC,CAAC,EAAE,QAAQ,CAAC,EA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;EACrE,MAAM,MAAsB;GAAE;GAAM;EAAO;EAC3C,OAAO,kBACL,KAAK,SAAS,SAAS,MAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,MAAM,IAAI,CAAC,EAAE,KAAK,GAAG,CAAC,IAAI,CAAC,CAAE,CACrF;CACF;;CAGA,WAAW,MAAY,QAAoC;EACzD,MAAM,IAAI,KAAK,cAAc,MAAM,MAAM;EACzC,IAAI,CAAC,GAAG,YAAY,OAAO;EAC3B,OAAO,EAAE,WAAW;GAAE;GAAM;EAAO,CAAC;CACtC;AACF;AAEA,SAAgB,yBACd,WAA8B,CAAC,GACN;CACzB,OAAO,IAAI,wBAAwB,QAAQ;AAC7C"}
|
|
@@ -1,7 +1,27 @@
|
|
|
1
1
|
const require_status = require("./status.cjs");
|
|
2
2
|
// src/data/test-runner/copy.ts
|
|
3
|
+
/** The copyable item a copy button defaults to, if an adapter marked one `primary`. */
|
|
4
|
+
function primaryCopyItem(items) {
|
|
5
|
+
return items.find((item) => "value" in item && item.primary === true);
|
|
6
|
+
}
|
|
7
|
+
/** Where a node's evidence lives on disk: its full results file, then the adapters' references. */
|
|
8
|
+
function copyReferences(sections) {
|
|
9
|
+
return [...sections.source ? [{
|
|
10
|
+
label: "Full results",
|
|
11
|
+
value: sections.source
|
|
12
|
+
}] : [], ...sections.references];
|
|
13
|
+
}
|
|
14
|
+
/** How much of each fenced section a summarized brief keeps, and how long a kept line may run. */
|
|
15
|
+
var BRIEF_LIMITS = {
|
|
16
|
+
lines: 20,
|
|
17
|
+
lineChars: 300
|
|
18
|
+
};
|
|
3
19
|
/** Generic sections rendered after every adapter section, so evidence reads before raw output. */
|
|
4
|
-
var OUTPUT_TITLES = /* @__PURE__ */ new Set([
|
|
20
|
+
var OUTPUT_TITLES = /* @__PURE__ */ new Set([
|
|
21
|
+
"stdout",
|
|
22
|
+
"stderr",
|
|
23
|
+
"output"
|
|
24
|
+
]);
|
|
5
25
|
function fact(label, value) {
|
|
6
26
|
return value ? [{
|
|
7
27
|
label,
|
|
@@ -45,6 +65,7 @@ function genericCopySections(node) {
|
|
|
45
65
|
...fact("Result", require_status.outcomeFor(node) ?? void 0),
|
|
46
66
|
...fact("Tool", node.framework),
|
|
47
67
|
...fact("Location", nodeLocation(node)),
|
|
68
|
+
...fact("Work dir", node.work_dir),
|
|
48
69
|
...fact("Duration", duration)
|
|
49
70
|
],
|
|
50
71
|
brief: [
|
|
@@ -65,20 +86,42 @@ function uniqueBy(values, key) {
|
|
|
65
86
|
return true;
|
|
66
87
|
});
|
|
67
88
|
}
|
|
68
|
-
/** Concatenates sections in order, keeping the first fact/section/item per label or title. */
|
|
89
|
+
/** Concatenates sections in order, keeping the first fact/section/item per label or title, and the first source. */
|
|
69
90
|
function mergeCopySections(parts) {
|
|
91
|
+
const source = parts.find((p) => p.source)?.source;
|
|
70
92
|
return {
|
|
93
|
+
...source ? { source } : {},
|
|
71
94
|
facts: uniqueBy(parts.flatMap((p) => p.facts ?? []), (f) => f.label),
|
|
72
95
|
brief: uniqueBy(parts.flatMap((p) => p.brief ?? []), (s) => s.title),
|
|
73
|
-
items: uniqueBy(parts.flatMap((p) => p.items ?? []), (i) => i.label)
|
|
96
|
+
items: uniqueBy(parts.flatMap((p) => p.items ?? []), (i) => i.label),
|
|
97
|
+
references: uniqueBy(parts.flatMap((p) => p.references ?? []), (r) => `${r.label}\u0000${r.value}`)
|
|
74
98
|
};
|
|
75
99
|
}
|
|
76
100
|
function fence(body) {
|
|
77
101
|
const longest = Math.max(0, ...(body.match(/`+/g) ?? []).map((run) => run.length));
|
|
78
102
|
return "`".repeat(Math.max(3, longest + 1));
|
|
79
103
|
}
|
|
104
|
+
function clipLine(line) {
|
|
105
|
+
return line.length > BRIEF_LIMITS.lineChars ? `${line.slice(0, BRIEF_LIMITS.lineChars)}… (${line.length - BRIEF_LIMITS.lineChars} more chars)` : line;
|
|
106
|
+
}
|
|
107
|
+
/** The kept part of a fenced section's body, and a note naming what was cut and where the rest is. */
|
|
108
|
+
function summarize(s, source) {
|
|
109
|
+
const all = s.body.split("\n");
|
|
110
|
+
const keepTail = OUTPUT_TITLES.has(s.title);
|
|
111
|
+
const kept = all.length <= BRIEF_LIMITS.lines ? all : keepTail ? all.slice(-BRIEF_LIMITS.lines) : all.slice(0, BRIEF_LIMITS.lines);
|
|
112
|
+
const clipped = kept.map(clipLine);
|
|
113
|
+
const omitted = all.length - kept.length;
|
|
114
|
+
const shortened = clipped.some((line, i) => line !== kept[i]);
|
|
115
|
+
if (omitted === 0 && !shortened) return { body: s.body };
|
|
116
|
+
const what = omitted > 0 ? `${omitted} ${keepTail ? "earlier" : "more"} line${omitted === 1 ? "" : "s"} omitted` : "long lines shortened";
|
|
117
|
+
const where = s.source ?? source;
|
|
118
|
+
return {
|
|
119
|
+
body: clipped.join("\n"),
|
|
120
|
+
note: `_… ${what}; full text in ${where ? `\`${where}\`` : "Copy full details"}_`
|
|
121
|
+
};
|
|
122
|
+
}
|
|
80
123
|
/** The Markdown brief: `# name`, the facts as bullets, then each non-empty section (fenced unless `markdown`). */
|
|
81
|
-
function buildBrief(node, sections, facts) {
|
|
124
|
+
function buildBrief(node, sections, facts, options = {}) {
|
|
82
125
|
const lines = [`# ${node.name}`];
|
|
83
126
|
if (facts.length > 0) lines.push("", ...facts.map((f) => `- **${f.label}:** ${f.value}`));
|
|
84
127
|
for (const s of sections) {
|
|
@@ -88,16 +131,19 @@ function buildBrief(node, sections, facts) {
|
|
|
88
131
|
lines.push(s.body);
|
|
89
132
|
continue;
|
|
90
133
|
}
|
|
91
|
-
const
|
|
92
|
-
|
|
134
|
+
const { body, note } = options.full ? { body: s.body } : summarize(s, options.source);
|
|
135
|
+
const marker = fence(body);
|
|
136
|
+
lines.push(`${marker}${s.lang ?? ""}`, body, marker);
|
|
137
|
+
if (note) lines.push(note);
|
|
93
138
|
}
|
|
94
139
|
return lines.join("\n");
|
|
95
140
|
}
|
|
96
141
|
/**
|
|
97
|
-
* The
|
|
98
|
-
*
|
|
142
|
+
* The "Copy details" payload: generic facts and error/expectation sections,
|
|
143
|
+
* then the adapters' sections, then the captured stdout/stderr. Summarized
|
|
144
|
+
* unless `full`; the facts carry where the node and its full results live on disk.
|
|
99
145
|
*/
|
|
100
|
-
function buildNodeBrief(node, adapter) {
|
|
146
|
+
function buildNodeBrief(node, adapter, { full = false } = {}) {
|
|
101
147
|
const generic = genericCopySections(node);
|
|
102
148
|
const merged = mergeCopySections([
|
|
103
149
|
{
|
|
@@ -107,17 +153,23 @@ function buildNodeBrief(node, adapter) {
|
|
|
107
153
|
adapter,
|
|
108
154
|
{ brief: generic.brief.filter((s) => OUTPUT_TITLES.has(s.title)) }
|
|
109
155
|
]);
|
|
110
|
-
return buildBrief(node, merged.brief, merged.facts)
|
|
156
|
+
return buildBrief(node, merged.brief, [...merged.facts, ...copyReferences(merged)], {
|
|
157
|
+
full,
|
|
158
|
+
...merged.source ? { source: merged.source } : {}
|
|
159
|
+
});
|
|
111
160
|
}
|
|
112
161
|
/** "Copy as JSON": the node without its children subtree, 2-space indented. */
|
|
113
162
|
function buildNodeJson(node) {
|
|
114
163
|
const { children: _children, ...rest } = node;
|
|
115
164
|
return JSON.stringify(rest, null, 2);
|
|
116
165
|
}
|
|
166
|
+
exports.BRIEF_LIMITS = BRIEF_LIMITS;
|
|
117
167
|
exports.buildBrief = buildBrief;
|
|
118
168
|
exports.buildNodeBrief = buildNodeBrief;
|
|
119
169
|
exports.buildNodeJson = buildNodeJson;
|
|
170
|
+
exports.copyReferences = copyReferences;
|
|
120
171
|
exports.genericCopySections = genericCopySections;
|
|
121
172
|
exports.mergeCopySections = mergeCopySections;
|
|
173
|
+
exports.primaryCopyItem = primaryCopyItem;
|
|
122
174
|
|
|
123
175
|
//# sourceMappingURL=copy.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copy.cjs","names":["formatTestDuration","outcomeFor"],"sources":["../../../src/data/test-runner/copy.ts"],"sourcesContent":["// Clipboard payloads for the detail header's \"Copy details\" split button. The\n// primary payload is a Markdown brief: a `# name` heading, `- **Label:** value`\n// facts, then one fenced `## Title` section per piece of evidence. The generic\n// sections here read only common `Test` fields; node adapters contribute the\n// domain sections (a command, a CEL assertion, a recording) and extra menu items\n// through `TestNodeAdapter.copy`. Pure — no React, no clipboard — so every\n// payload is unit-testable as a string.\n\nimport type { StaticIconComponent } from \"../Icon\";\nimport type { Test } from \"./types\";\nimport { formatTestDuration, outcomeFor } from \"./status\";\n\n/** One `- **label:** value` line under the brief's heading. */\nexport type BriefFact = { label: string; value: string };\n\n/**\n * One `## title` block of the brief: fenced (tagged with `lang`) by default, or\n * inserted as-is when `markdown` — for lists and links that must stay live.\n */\nexport type BriefSection = { title: string; lang?: string; markdown?: boolean; body: string };\n\ntype CopyItemBase = { label: string; icon?: StaticIconComponent | string };\n\n/** A copy menu item: the text it copies, or why there is nothing to copy. */\nexport type CopyItem = (CopyItemBase & { value: string }) | (CopyItemBase & { reason: string });\n\nexport type CopySections = {\n facts?: BriefFact[];\n brief?: BriefSection[];\n items?: CopyItem[];\n};\n\n/** Generic sections rendered after every adapter section, so evidence reads before raw output. */\nconst OUTPUT_TITLES = new Set([\"stdout\", \"stderr\"]);\n\nfunction fact(label: string, value: string | undefined): BriefFact[] {\n return value ? [{ label, value }] : [];\n}\n\nfunction section(title: string, body: string | undefined, lang?: string): BriefSection[] {\n if (!body) return [];\n return [lang ? { title, lang, body } : { title, body }];\n}\n\nfunction nodeLocation(node: Test): string | undefined {\n if (!node.file) return undefined;\n return node.line ? `${node.file}:${node.line}` : node.file;\n}\n\nfunction errorBody(node: Test): string {\n const summary = node.failure_detail?.summary;\n const lines = [node.message, summary !== node.message ? summary : undefined];\n return lines.filter(Boolean).join(\"\\n\");\n}\n\nfunction expectationBody(node: Test): string {\n const failure = node.failure_detail;\n if (!failure) return \"\";\n return [\n failure.matcher && `matcher: ${failure.matcher}`,\n failure.expected && `expected: ${failure.expected}`,\n failure.actual && `actual: ${failure.actual}`,\n failure.location && `at: ${failure.location}`,\n ]\n .filter(Boolean)\n .join(\"\\n\");\n}\n\n/** Sections every node gets, read from the common `Test` fields only. */\nexport function genericCopySections(node: Test): Required<CopySections> {\n const duration = node.duration ? formatTestDuration(node.duration) : undefined;\n return {\n facts: [\n ...fact(\"Result\", outcomeFor(node) ?? undefined),\n ...fact(\"Tool\", node.framework),\n ...fact(\"Location\", nodeLocation(node)),\n ...fact(\"Duration\", duration),\n ],\n brief: [\n ...section(\"Error\", errorBody(node)),\n ...section(\"Expectation\", expectationBody(node)),\n ...section(\"Stack\", node.failure_detail?.stack),\n ...(node.log ? section(\"output\", node.log) : [...section(\"stdout\", node.stdout), ...section(\"stderr\", node.stderr)]),\n ],\n items: [],\n };\n}\n\nfunction uniqueBy<T>(values: T[], key: (value: T) => string): T[] {\n const seen = new Set<string>();\n return values.filter((value) => {\n const k = key(value);\n if (seen.has(k)) return false;\n seen.add(k);\n return true;\n });\n}\n\n/** Concatenates sections in order, keeping the first fact/section/item per label or title. */\nexport function mergeCopySections(parts: CopySections[]): Required<CopySections> {\n return {\n facts: uniqueBy(\n parts.flatMap((p) => p.facts ?? []),\n (f) => f.label,\n ),\n brief: uniqueBy(\n parts.flatMap((p) => p.brief ?? []),\n (s) => s.title,\n ),\n items: uniqueBy(\n parts.flatMap((p) => p.items ?? []),\n (i) => i.label,\n ),\n };\n}\n\n// A fence one backtick longer than any run in the body, so captured output that\n// itself contains ``` cannot close the block early (CommonMark).\nfunction fence(body: string): string {\n const longest = Math.max(0, ...(body.match(/`+/g) ?? []).map((run) => run.length));\n return \"`\".repeat(Math.max(3, longest + 1));\n}\n\n/** The Markdown brief: `# name`, the facts as bullets, then each non-empty section (fenced unless `markdown`). */\nexport function buildBrief(node: Test, sections: BriefSection[], facts: BriefFact[]): string {\n const lines = [`# ${node.name}`];\n if (facts.length > 0) lines.push(\"\", ...facts.map((f) => `- **${f.label}:** ${f.value}`));\n for (const s of sections) {\n if (!s.body) continue;\n lines.push(\"\", `## ${s.title}`, \"\");\n if (s.markdown) {\n lines.push(s.body);\n continue;\n }\n const marker = fence(s.body);\n lines.push(`${marker}${s.lang ?? \"\"}`, s.body, marker);\n }\n return lines.join(\"\\n\");\n}\n\n/**\n * The primary \"Copy details\" payload: generic facts and error/expectation\n * sections, then the adapters' sections, then the captured stdout/stderr.\n */\nexport function buildNodeBrief(node: Test, adapter: CopySections): string {\n const generic = genericCopySections(node);\n const merged = mergeCopySections([\n { facts: generic.facts, brief: generic.brief.filter((s) => !OUTPUT_TITLES.has(s.title)) },\n adapter,\n { brief: generic.brief.filter((s) => OUTPUT_TITLES.has(s.title)) },\n ]);\n return buildBrief(node, merged.brief, merged.facts);\n}\n\n/** \"Copy as JSON\": the node without its children subtree, 2-space indented. */\nexport function buildNodeJson(node: Test): string {\n const { children: _children, ...rest } = node;\n return JSON.stringify(rest, null, 2);\n}\n"],"mappings":";;;AAiCA,IAAM,gCAAgB,IAAI,IAAI,CAAC,UAAU,QAAQ,CAAC;AAElD,SAAS,KAAK,OAAe,OAAwC;CACnE,OAAO,QAAQ,CAAC;EAAE;EAAO;CAAM,CAAC,IAAI,CAAC;AACvC;AAEA,SAAS,QAAQ,OAAe,MAA0B,MAA+B;CACvF,IAAI,CAAC,MAAM,OAAO,CAAC;CACnB,OAAO,CAAC,OAAO;EAAE;EAAO;EAAM;CAAK,IAAI;EAAE;EAAO;CAAK,CAAC;AACxD;AAEA,SAAS,aAAa,MAAgC;CACpD,IAAI,CAAC,KAAK,MAAM,OAAO,KAAA;CACvB,OAAO,KAAK,OAAO,GAAG,KAAK,KAAK,GAAG,KAAK,SAAS,KAAK;AACxD;AAEA,SAAS,UAAU,MAAoB;CACrC,MAAM,UAAU,KAAK,gBAAgB;CAErC,OAAO,CADQ,KAAK,SAAS,YAAY,KAAK,UAAU,UAAU,KAAA,CAC3D,CAAA,CAAM,OAAO,OAAO,CAAC,CAAC,KAAK,IAAI;AACxC;AAEA,SAAS,gBAAgB,MAAoB;CAC3C,MAAM,UAAU,KAAK;CACrB,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AChD,MAAM,EAAE,UAAU,WAAW,GAAG,SAAS;CACzC,OAAO,KAAK,UAAU,MAAM,MAAM,CAAC;AACrC"}
|
|
1
|
+
{"version":3,"file":"copy.cjs","names":["formatTestDuration","outcomeFor"],"sources":["../../../src/data/test-runner/copy.ts"],"sourcesContent":["// Clipboard payloads for the detail header's \"Copy details\" split button. The\n// primary payload is a Markdown brief: a `# name` heading, `- **Label:** value`\n// facts, then one fenced `## Title` section per piece of evidence. The generic\n// sections here read only common `Test` fields; node adapters contribute the\n// domain sections (a command, a CEL assertion, a recording) and extra menu items\n// through `TestNodeAdapter.copy`. Pure — no React, no clipboard — so every\n// payload is unit-testable as a string.\n\nimport type { StaticIconComponent } from \"../Icon\";\nimport type { Test } from \"./types\";\nimport { formatTestDuration, outcomeFor } from \"./status\";\n\n/** One `- **label:** value` line under the brief's heading. */\nexport type BriefFact = { label: string; value: string };\n\n/**\n * One `## title` block of the brief: fenced (tagged with `lang`) by default, or\n * inserted as-is when `markdown` — for lists and links that must stay live.\n * `source` is the file on disk holding the section's full text, which a\n * summarized brief points to when it cuts the section short.\n */\nexport type BriefSection = { title: string; lang?: string; markdown?: boolean; body: string; source?: string };\n\ntype CopyItemBase = { label: string; icon?: StaticIconComponent | string };\n\n/**\n * A copy menu item: the text it copies (or a loader for text that has to be\n * fetched), or why there is nothing to copy. A `primary` item becomes the\n * button's default action in place of the brief, which moves into the menu as\n * \"Copy details\"; the first primary item across the adapters wins.\n */\nexport type CopyItem =\n | (CopyItemBase & { value: string | (() => Promise<string>); primary?: boolean })\n | (CopyItemBase & { reason: string });\n\n/** The copyable item a copy button defaults to, if an adapter marked one `primary`. */\nexport function primaryCopyItem(items: CopyItem[]): Extract<CopyItem, { value: unknown }> | undefined {\n return items.find((item): item is Extract<CopyItem, { value: unknown }> => \"value\" in item && item.primary === true);\n}\n\nexport type CopySections = {\n facts?: BriefFact[];\n brief?: BriefSection[];\n items?: CopyItem[];\n /** The file on disk with the node's full results, which a summarized brief cites for whatever it cut. */\n source?: string;\n /**\n * Other places on disk that hold the node's evidence — a record store's\n * database, a trace store — listed under the brief's facts and in the\n * copied failure details, so a reader can open them.\n */\n references?: BriefFact[];\n};\n\n/** Every part of `CopySections` present, except `source`, which only some nodes have. */\nexport type MergedCopySections = Required<Omit<CopySections, \"source\">> & Pick<CopySections, \"source\">;\n\n/** Where a node's evidence lives on disk: its full results file, then the adapters' references. */\nexport function copyReferences(sections: Pick<MergedCopySections, \"source\" | \"references\">): BriefFact[] {\n return [...(sections.source ? [{ label: \"Full results\", value: sections.source }] : []), ...sections.references];\n}\n\n/** How much of each fenced section a summarized brief keeps, and how long a kept line may run. */\nexport const BRIEF_LIMITS = { lines: 20, lineChars: 300 } as const;\n\n/** Generic sections rendered after every adapter section, so evidence reads before raw output. */\nconst OUTPUT_TITLES = new Set([\"stdout\", \"stderr\", \"output\"]);\n\nfunction fact(label: string, value: string | undefined): BriefFact[] {\n return value ? [{ label, value }] : [];\n}\n\nfunction section(title: string, body: string | undefined, lang?: string): BriefSection[] {\n if (!body) return [];\n return [lang ? { title, lang, body } : { title, body }];\n}\n\nfunction nodeLocation(node: Test): string | undefined {\n if (!node.file) return undefined;\n return node.line ? `${node.file}:${node.line}` : node.file;\n}\n\nfunction errorBody(node: Test): string {\n const summary = node.failure_detail?.summary;\n const lines = [node.message, summary !== node.message ? summary : undefined];\n return lines.filter(Boolean).join(\"\\n\");\n}\n\nfunction expectationBody(node: Test): string {\n const failure = node.failure_detail;\n if (!failure) return \"\";\n return [\n failure.matcher && `matcher: ${failure.matcher}`,\n failure.expected && `expected: ${failure.expected}`,\n failure.actual && `actual: ${failure.actual}`,\n failure.location && `at: ${failure.location}`,\n ]\n .filter(Boolean)\n .join(\"\\n\");\n}\n\n/** Sections every node gets, read from the common `Test` fields only. */\nexport function genericCopySections(node: Test): Required<Omit<CopySections, \"source\" | \"references\">> {\n const duration = node.duration ? formatTestDuration(node.duration) : undefined;\n return {\n facts: [\n ...fact(\"Result\", outcomeFor(node) ?? undefined),\n ...fact(\"Tool\", node.framework),\n ...fact(\"Location\", nodeLocation(node)),\n ...fact(\"Work dir\", node.work_dir),\n ...fact(\"Duration\", duration),\n ],\n brief: [\n ...section(\"Error\", errorBody(node)),\n ...section(\"Expectation\", expectationBody(node)),\n ...section(\"Stack\", node.failure_detail?.stack),\n ...(node.log ? section(\"output\", node.log) : [...section(\"stdout\", node.stdout), ...section(\"stderr\", node.stderr)]),\n ],\n items: [],\n };\n}\n\nfunction uniqueBy<T>(values: T[], key: (value: T) => string): T[] {\n const seen = new Set<string>();\n return values.filter((value) => {\n const k = key(value);\n if (seen.has(k)) return false;\n seen.add(k);\n return true;\n });\n}\n\n/** Concatenates sections in order, keeping the first fact/section/item per label or title, and the first source. */\nexport function mergeCopySections(parts: CopySections[]): MergedCopySections {\n const source = parts.find((p) => p.source)?.source;\n return {\n ...(source ? { source } : {}),\n facts: uniqueBy(\n parts.flatMap((p) => p.facts ?? []),\n (f) => f.label,\n ),\n brief: uniqueBy(\n parts.flatMap((p) => p.brief ?? []),\n (s) => s.title,\n ),\n items: uniqueBy(\n parts.flatMap((p) => p.items ?? []),\n (i) => i.label,\n ),\n references: uniqueBy(\n parts.flatMap((p) => p.references ?? []),\n (r) => `${r.label}\\u0000${r.value}`,\n ),\n };\n}\n\n// A fence one backtick longer than any run in the body, so captured output that\n// itself contains ``` cannot close the block early (CommonMark).\nfunction fence(body: string): string {\n const longest = Math.max(0, ...(body.match(/`+/g) ?? []).map((run) => run.length));\n return \"`\".repeat(Math.max(3, longest + 1));\n}\n\n/**\n * Options of a brief. A summarized brief (the default) keeps the first\n * `BRIEF_LIMITS.lines` lines of each fenced section — the last ones of captured\n * output, where a failure shows — and cuts long lines, noting what it dropped\n * and the file on disk that has it. `full` keeps every section whole.\n */\nexport type BriefOptions = { full?: boolean; source?: string };\n\nfunction clipLine(line: string): string {\n return line.length > BRIEF_LIMITS.lineChars ? `${line.slice(0, BRIEF_LIMITS.lineChars)}… (${line.length - BRIEF_LIMITS.lineChars} more chars)` : line;\n}\n\n/** The kept part of a fenced section's body, and a note naming what was cut and where the rest is. */\nfunction summarize(s: BriefSection, source: string | undefined): { body: string; note?: string } {\n const all = s.body.split(\"\\n\");\n const keepTail = OUTPUT_TITLES.has(s.title);\n const kept = all.length <= BRIEF_LIMITS.lines ? all : keepTail ? all.slice(-BRIEF_LIMITS.lines) : all.slice(0, BRIEF_LIMITS.lines);\n const clipped = kept.map(clipLine);\n const omitted = all.length - kept.length;\n const shortened = clipped.some((line, i) => line !== kept[i]);\n if (omitted === 0 && !shortened) return { body: s.body };\n const what = omitted > 0 ? `${omitted} ${keepTail ? \"earlier\" : \"more\"} line${omitted === 1 ? \"\" : \"s\"} omitted` : \"long lines shortened\";\n const where = s.source ?? source;\n return { body: clipped.join(\"\\n\"), note: `_… ${what}; full text in ${where ? `\\`${where}\\`` : \"Copy full details\"}_` };\n}\n\n/** The Markdown brief: `# name`, the facts as bullets, then each non-empty section (fenced unless `markdown`). */\nexport function buildBrief(node: Test, sections: BriefSection[], facts: BriefFact[], options: BriefOptions = {}): string {\n const lines = [`# ${node.name}`];\n if (facts.length > 0) lines.push(\"\", ...facts.map((f) => `- **${f.label}:** ${f.value}`));\n for (const s of sections) {\n if (!s.body) continue;\n lines.push(\"\", `## ${s.title}`, \"\");\n if (s.markdown) {\n lines.push(s.body);\n continue;\n }\n const { body, note } = options.full ? { body: s.body } : summarize(s, options.source);\n const marker = fence(body);\n lines.push(`${marker}${s.lang ?? \"\"}`, body, marker);\n if (note) lines.push(note);\n }\n return lines.join(\"\\n\");\n}\n\n/**\n * The \"Copy details\" payload: generic facts and error/expectation sections,\n * then the adapters' sections, then the captured stdout/stderr. Summarized\n * unless `full`; the facts carry where the node and its full results live on disk.\n */\nexport function buildNodeBrief(node: Test, adapter: CopySections, { full = false }: { full?: boolean } = {}): string {\n const generic = genericCopySections(node);\n const merged = mergeCopySections([\n { facts: generic.facts, brief: generic.brief.filter((s) => !OUTPUT_TITLES.has(s.title)) },\n adapter,\n { brief: generic.brief.filter((s) => OUTPUT_TITLES.has(s.title)) },\n ]);\n return buildBrief(node, merged.brief, [...merged.facts, ...copyReferences(merged)], { full, ...(merged.source ? { source: merged.source } : {}) });\n}\n\n/** \"Copy as JSON\": the node without its children subtree, 2-space indented. */\nexport function buildNodeJson(node: Test): string {\n const { children: _children, ...rest } = node;\n return JSON.stringify(rest, null, 2);\n}\n"],"mappings":";;;AAoCA,SAAgB,gBAAgB,OAAsE;CACpG,OAAO,MAAM,MAAM,SAAwD,WAAW,QAAQ,KAAK,YAAY,IAAI;AACrH;;AAoBA,SAAgB,eAAe,UAA0E;CACvG,OAAO,CAAC,GAAI,SAAS,SAAS,CAAC;EAAE,OAAO;EAAgB,OAAO,SAAS;CAAO,CAAC,IAAI,CAAC,GAAI,GAAG,SAAS,UAAU;AACjH;;AAGA,IAAa,eAAe;CAAE,OAAO;CAAI,WAAW;AAAI;;AAGxD,IAAM,gCAAgB,IAAI,IAAI;CAAC;CAAU;CAAU;AAAQ,CAAC;AAE5D,SAAS,KAAK,OAAe,OAAwC;CACnE,OAAO,QAAQ,CAAC;EAAE;EAAO;CAAM,CAAC,IAAI,CAAC;AACvC;AAEA,SAAS,QAAQ,OAAe,MAA0B,MAA+B;CACvF,IAAI,CAAC,MAAM,OAAO,CAAC;CACnB,OAAO,CAAC,OAAO;EAAE;EAAO;EAAM;CAAK,IAAI;EAAE;EAAO;CAAK,CAAC;AACxD;AAEA,SAAS,aAAa,MAAgC;CACpD,IAAI,CAAC,KAAK,MAAM,OAAO,KAAA;CACvB,OAAO,KAAK,OAAO,GAAG,KAAK,KAAK,GAAG,KAAK,SAAS,KAAK;AACxD;AAEA,SAAS,UAAU,MAAoB;CACrC,MAAM,UAAU,KAAK,gBAAgB;CAErC,OAAO,CADQ,KAAK,SAAS,YAAY,KAAK,UAAU,UAAU,KAAA,CAC3D,CAAA,CAAM,OAAO,OAAO,CAAC,CAAC,KAAK,IAAI;AACxC;AAEA,SAAS,gBAAgB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