@fses/workbench-app 0.1.3 → 0.2.1
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/WORKBENCH-CLOSURE.json +80 -0
- package/dist/{Workspace-CvJghuPy.js → Workspace-DMye5DU8.js} +11458 -11325
- package/dist/canvas/api/index.d.ts +7 -0
- package/dist/canvas/api/index.js +4 -0
- package/dist/canvasFacade-B0oy__da.js +1932 -0
- package/dist/cardFactory-CoDF-zsR.js +1392 -0
- package/dist/extensions/index.d.ts +2 -0
- package/dist/extensions/index.js +8 -0
- package/dist/fses-workbench-app.js +89 -86
- package/dist/index-DbH6tMQy.js +837 -0
- package/dist/internal/personal-workbench/lib/workbenchChatReplyBridge.d.ts +24 -0
- package/dist/runtime/index.js +1 -1
- package/dist/style.css +1 -1
- package/dist/{useWorkbenchRuntime-Pekhufen.js → useWorkbenchRuntime-XpOzwm56.js} +8752 -11980
- package/dist/workbenchCustomComponentRegistry-6GHzavdM.js +267 -0
- package/node_modules/@byteluck/agentic-protocol/LICENSE +9 -0
- package/node_modules/@byteluck/agentic-protocol/README.md +74 -0
- package/node_modules/@byteluck/agentic-protocol/dist/index.d.ts +1623 -0
- package/node_modules/@byteluck/agentic-protocol/dist/index.mjs +3380 -0
- package/node_modules/@byteluck/agentic-protocol/package.json +37 -0
- package/node_modules/@byteluck/workbench-skill-contracts/LICENSE +9 -0
- package/node_modules/@byteluck/workbench-skill-contracts/dist/index.d.ts +234 -0
- package/node_modules/@byteluck/workbench-skill-contracts/dist/index.mjs +394 -0
- package/node_modules/@byteluck/workbench-skill-contracts/package.json +37 -0
- package/node_modules/@fses/ai-chat/LICENSE +9 -0
- package/node_modules/@fses/ai-chat/README.md +320 -0
- package/node_modules/@fses/ai-chat/dist/chart-card/data.d.ts +12 -0
- package/node_modules/@fses/ai-chat/dist/chart-card/from-markdown.d.ts +11 -0
- package/node_modules/@fses/ai-chat/dist/chart-card/from-tool.d.ts +8 -0
- package/node_modules/@fses/ai-chat/dist/chart-card/options.d.ts +4 -0
- package/node_modules/@fses/ai-chat/dist/chart-card/trace.d.ts +19 -0
- package/node_modules/@fses/ai-chat/dist/chart-card/types.d.ts +133 -0
- package/node_modules/@fses/ai-chat/dist/components/CardRecommendationDeferredDraft.vue.d.ts +13 -0
- package/node_modules/@fses/ai-chat/dist/components/CardRecommendationDraft.vue.d.ts +18 -0
- package/node_modules/@fses/ai-chat/dist/components/ChartCardRenderer.vue.d.ts +11 -0
- package/node_modules/@fses/ai-chat/dist/components/ChatMessageItem.vue.d.ts +76 -0
- package/node_modules/@fses/ai-chat/dist/components/ChatMessageList.vue.d.ts +79 -0
- package/node_modules/@fses/ai-chat/dist/components/ChatSender.vue.d.ts +98 -0
- package/node_modules/@fses/ai-chat/dist/components/CollapsedToolActivity.vue.d.ts +9 -0
- package/node_modules/@fses/ai-chat/dist/components/ContextUsageRing.vue.d.ts +12 -0
- package/node_modules/@fses/ai-chat/dist/components/EChartsView.vue.d.ts +6 -0
- package/node_modules/@fses/ai-chat/dist/components/FsesAiChat.vue.d.ts +306 -0
- package/node_modules/@fses/ai-chat/dist/components/PlanDraftCard.vue.d.ts +19 -0
- package/node_modules/@fses/ai-chat/dist/components/ShellExecPanel.vue.d.ts +6 -0
- package/node_modules/@fses/ai-chat/dist/components/TaskTodoPlanBar.vue.d.ts +6 -0
- package/node_modules/@fses/ai-chat/dist/components/ThinkingShimmer.vue.d.ts +6 -0
- package/node_modules/@fses/ai-chat/dist/composables/context-usage.d.ts +11 -0
- package/node_modules/@fses/ai-chat/dist/composables/types.d.ts +465 -0
- package/node_modules/@fses/ai-chat/dist/composables/useChat.d.ts +2 -0
- package/node_modules/@fses/ai-chat/dist/composables/useSystemEChartsIcon.d.ts +11 -0
- package/node_modules/@fses/ai-chat/dist/fses-ai-chat.js +11408 -0
- package/node_modules/@fses/ai-chat/dist/fses-ai-chat.umd.cjs +25 -0
- package/node_modules/@fses/ai-chat/dist/index.d.ts +17 -0
- package/node_modules/@fses/ai-chat/dist/plugin.d.ts +8 -0
- package/node_modules/@fses/ai-chat/dist/style.css +1 -0
- package/node_modules/@fses/ai-chat/dist/utils/assistant-markdown.d.ts +11 -0
- package/node_modules/@fses/ai-chat/dist/utils/attachment-upload.d.ts +22 -0
- package/node_modules/@fses/ai-chat/dist/utils/card-recommendation-config-summary.d.ts +86 -0
- package/node_modules/@fses/ai-chat/dist/utils/card-recommendation-field-label.d.ts +24 -0
- package/node_modules/@fses/ai-chat/dist/utils/card-recommendation-source.d.ts +18 -0
- package/node_modules/@fses/ai-chat/dist/utils/card-recommendation-title-source.d.ts +12 -0
- package/node_modules/@fses/ai-chat/dist/utils/chart-card-visibility.d.ts +24 -0
- package/node_modules/@fses/ai-chat/dist/utils/derived-process-labels.d.ts +13 -0
- package/node_modules/@fses/ai-chat/dist/utils/echarts-recommendation-icon.d.ts +36 -0
- package/node_modules/@fses/ai-chat/dist/utils/group-messages.d.ts +30 -0
- package/node_modules/@fses/ai-chat/dist/utils/status-activity.d.ts +48 -0
- package/node_modules/@fses/ai-chat/dist/utils/system-echarts-template-icons.generated.d.ts +305 -0
- package/node_modules/@fses/ai-chat/dist/utils/system-echarts-template.d.ts +20 -0
- package/node_modules/@fses/ai-chat/dist/utils/task-todo-plan.d.ts +40 -0
- package/node_modules/@fses/ai-chat/dist/utils/workbench-echarts-theme.d.ts +35 -0
- package/node_modules/@fses/ai-chat/package.json +81 -0
- package/node_modules/@fses/workbench-card/LICENSE +9 -0
- package/node_modules/@fses/workbench-card/README.md +81 -0
- package/node_modules/@fses/workbench-card/dist/chart/index.d.ts +8 -0
- package/node_modules/@fses/workbench-card/dist/fses-workbench-card-echarts-protocol.js +2230 -0
- package/node_modules/@fses/workbench-card/dist/fses-workbench-card-renderers.js +33731 -0
- package/node_modules/@fses/workbench-card/dist/fses-workbench-card.js +21238 -0
- package/node_modules/@fses/workbench-card/dist/fses-workbench-card.umd.cjs +1 -0
- package/node_modules/@fses/workbench-card/dist/index.d.ts +11 -0
- package/node_modules/@fses/workbench-card/dist/registry/cardRegistry.d.ts +50 -0
- package/node_modules/@fses/workbench-card/dist/registry/compositeCardPatterns.d.ts +39 -0
- package/node_modules/@fses/workbench-card/dist/registry/echartsTemplateCategories.d.ts +20 -0
- package/node_modules/@fses/workbench-card/dist/registry/echartsTemplateRegistry.d.ts +1158 -0
- package/node_modules/@fses/workbench-card/dist/registry/echartsTemplateRegistry.generated.d.ts +1141 -0
- package/node_modules/@fses/workbench-card/dist/registry/echartsTemplateTypes.d.ts +76 -0
- package/node_modules/@fses/workbench-card/dist/registry/index.d.ts +10 -0
- package/node_modules/@fses/workbench-card/dist/renderers/WorkbenchBlockRenderer.vue.d.ts +55 -0
- package/node_modules/@fses/workbench-card/dist/renderers/chart/ChartRegistry.vue.d.ts +22 -0
- package/node_modules/@fses/workbench-card/dist/renderers/chart/EChartsProtocolRenderer.vue.d.ts +34 -0
- package/node_modules/@fses/workbench-card/dist/renderers/chart/chartRendererRegistry.d.ts +219 -0
- package/node_modules/@fses/workbench-card/dist/renderers/chart/chartResponsiveLayout.d.ts +47 -0
- package/node_modules/@fses/workbench-card/dist/renderers/chart/dynamicEchartOption.d.ts +30 -0
- package/node_modules/@fses/workbench-card/dist/renderers/chart/echarts-protocol/adapter.d.ts +73 -0
- package/node_modules/@fses/workbench-card/dist/renderers/chart/echarts-protocol/converters/composite.converter.d.ts +11 -0
- package/node_modules/@fses/workbench-card/dist/renderers/chart/echarts-protocol/converters/configOnly.converter.d.ts +11 -0
- package/node_modules/@fses/workbench-card/dist/renderers/chart/echarts-protocol/converters/geo.converter.d.ts +10 -0
- package/node_modules/@fses/workbench-card/dist/renderers/chart/echarts-protocol/converters/graphic.converter.d.ts +10 -0
- package/node_modules/@fses/workbench-card/dist/renderers/chart/echarts-protocol/converters/layout.converter.d.ts +11 -0
- package/node_modules/@fses/workbench-card/dist/renderers/chart/echarts-protocol/converters/network.converter.d.ts +10 -0
- package/node_modules/@fses/workbench-card/dist/renderers/chart/echarts-protocol/converters/scene3D.converter.d.ts +11 -0
- package/node_modules/@fses/workbench-card/dist/renderers/chart/echarts-protocol/converters/series.converter.d.ts +10 -0
- package/node_modules/@fses/workbench-card/dist/renderers/chart/echarts-protocol/converters/table.converter.d.ts +10 -0
- package/node_modules/@fses/workbench-card/dist/renderers/chart/echarts-protocol/converters/timeline.converter.d.ts +11 -0
- package/node_modules/@fses/workbench-card/dist/renderers/chart/echarts-protocol/converters/transition.converter.d.ts +11 -0
- package/node_modules/@fses/workbench-card/dist/renderers/chart/echarts-protocol/converters/tree.converter.d.ts +10 -0
- package/node_modules/@fses/workbench-card/dist/renderers/chart/echarts-protocol/converters/tuple.converter.d.ts +10 -0
- package/node_modules/@fses/workbench-card/dist/renderers/chart/echarts-protocol/index.d.ts +9 -0
- package/node_modules/@fses/workbench-card/dist/renderers/chart/echarts-protocol/merger.d.ts +16 -0
- package/node_modules/@fses/workbench-card/dist/renderers/chart/echarts-protocol/types.d.ts +447 -0
- package/node_modules/@fses/workbench-card/dist/renderers/chart/echartsRuntimeInteractions.d.ts +30 -0
- package/node_modules/@fses/workbench-card/dist/renderers/chart/echartsTitle.d.ts +13 -0
- package/node_modules/@fses/workbench-card/dist/renderers/chart/echartsTooltipPortal.d.ts +12 -0
- package/node_modules/@fses/workbench-card/dist/renderers/chart/types.d.ts +47 -0
- package/node_modules/@fses/workbench-card/dist/renderers/chart/useEchart.d.ts +29 -0
- package/node_modules/@fses/workbench-card/dist/renderers/chart/workbenchChartTheme.d.ts +36 -0
- package/node_modules/@fses/workbench-card/dist/renderers/custom-canvas/canvasLayoutBindings.d.ts +86 -0
- package/node_modules/@fses/workbench-card/dist/renderers/hostBridge.d.ts +61 -0
- package/node_modules/@fses/workbench-card/dist/renderers/index.d.ts +17 -0
- package/node_modules/@fses/workbench-card/dist/renderers/native/nativeBindings.d.ts +145 -0
- package/node_modules/@fses/workbench-card/dist/renderers/nested/nestedBlockBindings.d.ts +107 -0
- package/node_modules/@fses/workbench-card/dist/renderers/quickLinkDisplay.d.ts +24 -0
- package/node_modules/@fses/workbench-card/dist/renderers/reference-composite/referenceCompositeBindings.d.ts +171 -0
- package/node_modules/@fses/workbench-card/dist/renderers/reference-composite/referenceRiskAndStrategyBindings.d.ts +91 -0
- package/node_modules/@fses/workbench-card/dist/renderers/resizableTable.d.ts +51 -0
- package/node_modules/@fses/workbench-card/dist/renderers/style.css +1 -0
- package/node_modules/@fses/workbench-card/dist/renderers/tableDisplay.d.ts +25 -0
- package/node_modules/@fses/workbench-card/dist/renderers/useWorkbenchBlockRendererBindings.d.ts +580 -0
- package/node_modules/@fses/workbench-card/dist/shell/workbenchVisualShell.d.ts +48 -0
- package/node_modules/@fses/workbench-card/dist/style.css +1 -0
- package/node_modules/@fses/workbench-card/dist/types/block.d.ts +2002 -0
- package/node_modules/@fses/workbench-card/dist/types/canvas.d.ts +25 -0
- package/node_modules/@fses/workbench-card/dist/types/echartsProtocol.d.ts +445 -0
- package/node_modules/@fses/workbench-card/dist/types/index.d.ts +10 -0
- package/node_modules/@fses/workbench-card/dist/types/registry.d.ts +7 -0
- package/node_modules/@fses/workbench-card/dist/types/runtime.d.ts +34 -0
- package/node_modules/@fses/workbench-card/package.json +82 -0
- package/node_modules/@fses/workbench-card/src/chart/index.ts +8 -0
- package/node_modules/@fses/workbench-card/src/index.ts +13 -0
- package/node_modules/@fses/workbench-card/src/registry/cardRegistry.ts +476 -0
- package/node_modules/@fses/workbench-card/src/registry/compositeCardPatterns.ts +206 -0
- package/node_modules/@fses/workbench-card/src/registry/echartsTemplateCategories.ts +74 -0
- package/node_modules/@fses/workbench-card/src/registry/echartsTemplateRegistry.generated.ts +19951 -0
- package/node_modules/@fses/workbench-card/src/registry/echartsTemplateRegistry.ts +32 -0
- package/node_modules/@fses/workbench-card/src/registry/echartsTemplateTypes.ts +83 -0
- package/node_modules/@fses/workbench-card/src/registry/index.ts +10 -0
- package/node_modules/@fses/workbench-card/src/renderers/WorkbenchBlockRenderer.vue +2728 -0
- package/node_modules/@fses/workbench-card/src/renderers/chart/ChartRegistry.vue +221 -0
- package/node_modules/@fses/workbench-card/src/renderers/chart/EChartsProtocolRenderer.vue +304 -0
- package/node_modules/@fses/workbench-card/src/renderers/chart/chartRendererRegistry.ts +311 -0
- package/node_modules/@fses/workbench-card/src/renderers/chart/chartResponsiveLayout.ts +172 -0
- package/node_modules/@fses/workbench-card/src/renderers/chart/dynamicEchartOption.ts +127 -0
- package/node_modules/@fses/workbench-card/src/renderers/chart/echarts-protocol/adapter.ts +1349 -0
- package/node_modules/@fses/workbench-card/src/renderers/chart/echarts-protocol/converters/composite.converter.ts +71 -0
- package/node_modules/@fses/workbench-card/src/renderers/chart/echarts-protocol/converters/configOnly.converter.ts +45 -0
- package/node_modules/@fses/workbench-card/src/renderers/chart/echarts-protocol/converters/geo.converter.ts +97 -0
- package/node_modules/@fses/workbench-card/src/renderers/chart/echarts-protocol/converters/graphic.converter.ts +59 -0
- package/node_modules/@fses/workbench-card/src/renderers/chart/echarts-protocol/converters/layout.converter.ts +53 -0
- package/node_modules/@fses/workbench-card/src/renderers/chart/echarts-protocol/converters/network.converter.ts +82 -0
- package/node_modules/@fses/workbench-card/src/renderers/chart/echarts-protocol/converters/scene3D.converter.ts +73 -0
- package/node_modules/@fses/workbench-card/src/renderers/chart/echarts-protocol/converters/series.converter.ts +795 -0
- package/node_modules/@fses/workbench-card/src/renderers/chart/echarts-protocol/converters/table.converter.ts +195 -0
- package/node_modules/@fses/workbench-card/src/renderers/chart/echarts-protocol/converters/timeline.converter.ts +62 -0
- package/node_modules/@fses/workbench-card/src/renderers/chart/echarts-protocol/converters/transition.converter.ts +58 -0
- package/node_modules/@fses/workbench-card/src/renderers/chart/echarts-protocol/converters/tree.converter.ts +75 -0
- package/node_modules/@fses/workbench-card/src/renderers/chart/echarts-protocol/converters/tuple.converter.ts +112 -0
- package/node_modules/@fses/workbench-card/src/renderers/chart/echarts-protocol/index.ts +10 -0
- package/node_modules/@fses/workbench-card/src/renderers/chart/echarts-protocol/merger.ts +109 -0
- package/node_modules/@fses/workbench-card/src/renderers/chart/echarts-protocol/types.ts +515 -0
- package/node_modules/@fses/workbench-card/src/renderers/chart/echartsRuntimeInteractions.ts +450 -0
- package/node_modules/@fses/workbench-card/src/renderers/chart/echartsTitle.ts +94 -0
- package/node_modules/@fses/workbench-card/src/renderers/chart/echartsTooltipPortal.ts +140 -0
- package/node_modules/@fses/workbench-card/src/renderers/chart/types.ts +53 -0
- package/node_modules/@fses/workbench-card/src/renderers/chart/useEchart.ts +1820 -0
- package/node_modules/@fses/workbench-card/src/renderers/chart/workbenchChartTheme.ts +240 -0
- package/node_modules/@fses/workbench-card/src/renderers/custom-canvas/canvasLayoutBindings.ts +660 -0
- package/node_modules/@fses/workbench-card/src/renderers/hostBridge.ts +74 -0
- package/node_modules/@fses/workbench-card/src/renderers/index.ts +25 -0
- package/node_modules/@fses/workbench-card/src/renderers/native/nativeBindings.ts +1081 -0
- package/node_modules/@fses/workbench-card/src/renderers/nested/nestedBlockBindings.ts +1349 -0
- package/node_modules/@fses/workbench-card/src/renderers/quickLinkDisplay.ts +53 -0
- package/node_modules/@fses/workbench-card/src/renderers/reference-composite/referenceCompositeBindings.ts +3205 -0
- package/node_modules/@fses/workbench-card/src/renderers/reference-composite/referenceRiskAndStrategyBindings.ts +1004 -0
- package/node_modules/@fses/workbench-card/src/renderers/resizableTable.ts +136 -0
- package/node_modules/@fses/workbench-card/src/renderers/tableDisplay.ts +140 -0
- package/node_modules/@fses/workbench-card/src/renderers/useWorkbenchBlockRendererBindings.ts +3192 -0
- package/node_modules/@fses/workbench-card/src/shell/workbenchVisualShell.ts +228 -0
- package/node_modules/@fses/workbench-card/src/styles/workbench-card.css +343 -0
- package/node_modules/@fses/workbench-card/src/types/block.ts +2487 -0
- package/node_modules/@fses/workbench-card/src/types/canvas.ts +30 -0
- package/node_modules/@fses/workbench-card/src/types/echartsProtocol.ts +513 -0
- package/node_modules/@fses/workbench-card/src/types/index.ts +10 -0
- package/node_modules/@fses/workbench-card/src/types/registry.ts +17 -0
- package/node_modules/@fses/workbench-card/src/types/runtime.ts +31 -0
- package/node_modules/dompurify/LICENSE +568 -0
- package/node_modules/dompurify/README.md +523 -0
- package/node_modules/dompurify/dist/purify.cjs.d.ts +451 -0
- package/node_modules/dompurify/dist/purify.cjs.js +1472 -0
- package/node_modules/dompurify/dist/purify.cjs.js.map +1 -0
- package/node_modules/dompurify/dist/purify.es.d.mts +448 -0
- package/node_modules/dompurify/dist/purify.es.mjs +1470 -0
- package/node_modules/dompurify/dist/purify.es.mjs.map +1 -0
- package/node_modules/dompurify/dist/purify.js +1478 -0
- package/node_modules/dompurify/dist/purify.js.map +1 -0
- package/node_modules/dompurify/dist/purify.min.js +3 -0
- package/node_modules/dompurify/dist/purify.min.js.map +1 -0
- package/node_modules/dompurify/package.json +168 -0
- package/node_modules/zod/LICENSE +21 -0
- package/node_modules/zod/README.md +208 -0
- package/node_modules/zod/index.cjs +33 -0
- package/node_modules/zod/index.d.cts +4 -0
- package/node_modules/zod/index.d.ts +4 -0
- package/node_modules/zod/index.js +4 -0
- package/node_modules/zod/package.json +118 -0
- package/node_modules/zod/src/index.ts +4 -0
- package/node_modules/zod/src/v3/ZodError.ts +330 -0
- package/node_modules/zod/src/v3/benchmarks/datetime.ts +58 -0
- package/node_modules/zod/src/v3/benchmarks/discriminatedUnion.ts +80 -0
- package/node_modules/zod/src/v3/benchmarks/index.ts +59 -0
- package/node_modules/zod/src/v3/benchmarks/ipv4.ts +57 -0
- package/node_modules/zod/src/v3/benchmarks/object.ts +69 -0
- package/node_modules/zod/src/v3/benchmarks/primitives.ts +162 -0
- package/node_modules/zod/src/v3/benchmarks/realworld.ts +63 -0
- package/node_modules/zod/src/v3/benchmarks/string.ts +55 -0
- package/node_modules/zod/src/v3/benchmarks/union.ts +80 -0
- package/node_modules/zod/src/v3/errors.ts +13 -0
- package/node_modules/zod/src/v3/external.ts +6 -0
- package/node_modules/zod/src/v3/helpers/enumUtil.ts +17 -0
- package/node_modules/zod/src/v3/helpers/errorUtil.ts +8 -0
- package/node_modules/zod/src/v3/helpers/parseUtil.ts +176 -0
- package/node_modules/zod/src/v3/helpers/partialUtil.ts +34 -0
- package/node_modules/zod/src/v3/helpers/typeAliases.ts +2 -0
- package/node_modules/zod/src/v3/helpers/util.ts +224 -0
- package/node_modules/zod/src/v3/index.ts +4 -0
- package/node_modules/zod/src/v3/locales/en.ts +124 -0
- package/node_modules/zod/src/v3/standard-schema.ts +113 -0
- package/node_modules/zod/src/v3/tests/Mocker.ts +54 -0
- package/node_modules/zod/src/v3/tests/all-errors.test.ts +157 -0
- package/node_modules/zod/src/v3/tests/anyunknown.test.ts +28 -0
- package/node_modules/zod/src/v3/tests/array.test.ts +71 -0
- package/node_modules/zod/src/v3/tests/async-parsing.test.ts +388 -0
- package/node_modules/zod/src/v3/tests/async-refinements.test.ts +46 -0
- package/node_modules/zod/src/v3/tests/base.test.ts +29 -0
- package/node_modules/zod/src/v3/tests/bigint.test.ts +55 -0
- package/node_modules/zod/src/v3/tests/branded.test.ts +53 -0
- package/node_modules/zod/src/v3/tests/catch.test.ts +220 -0
- package/node_modules/zod/src/v3/tests/coerce.test.ts +133 -0
- package/node_modules/zod/src/v3/tests/complex.test.ts +56 -0
- package/node_modules/zod/src/v3/tests/custom.test.ts +31 -0
- package/node_modules/zod/src/v3/tests/date.test.ts +32 -0
- package/node_modules/zod/src/v3/tests/deepmasking.test.ts +186 -0
- package/node_modules/zod/src/v3/tests/default.test.ts +112 -0
- package/node_modules/zod/src/v3/tests/description.test.ts +33 -0
- package/node_modules/zod/src/v3/tests/discriminated-unions.test.ts +315 -0
- package/node_modules/zod/src/v3/tests/enum.test.ts +80 -0
- package/node_modules/zod/src/v3/tests/error.test.ts +551 -0
- package/node_modules/zod/src/v3/tests/firstparty.test.ts +87 -0
- package/node_modules/zod/src/v3/tests/firstpartyschematypes.test.ts +21 -0
- package/node_modules/zod/src/v3/tests/function.test.ts +257 -0
- package/node_modules/zod/src/v3/tests/generics.test.ts +48 -0
- package/node_modules/zod/src/v3/tests/instanceof.test.ts +37 -0
- package/node_modules/zod/src/v3/tests/intersection.test.ts +110 -0
- package/node_modules/zod/src/v3/tests/language-server.source.ts +76 -0
- package/node_modules/zod/src/v3/tests/language-server.test.ts +207 -0
- package/node_modules/zod/src/v3/tests/literal.test.ts +36 -0
- package/node_modules/zod/src/v3/tests/map.test.ts +110 -0
- package/node_modules/zod/src/v3/tests/masking.test.ts +4 -0
- package/node_modules/zod/src/v3/tests/mocker.test.ts +19 -0
- package/node_modules/zod/src/v3/tests/nan.test.ts +21 -0
- package/node_modules/zod/src/v3/tests/nativeEnum.test.ts +87 -0
- package/node_modules/zod/src/v3/tests/nullable.test.ts +42 -0
- package/node_modules/zod/src/v3/tests/number.test.ts +176 -0
- package/node_modules/zod/src/v3/tests/object-augmentation.test.ts +29 -0
- package/node_modules/zod/src/v3/tests/object-in-es5-env.test.ts +29 -0
- package/node_modules/zod/src/v3/tests/object.test.ts +434 -0
- package/node_modules/zod/src/v3/tests/optional.test.ts +42 -0
- package/node_modules/zod/src/v3/tests/parseUtil.test.ts +23 -0
- package/node_modules/zod/src/v3/tests/parser.test.ts +41 -0
- package/node_modules/zod/src/v3/tests/partials.test.ts +243 -0
- package/node_modules/zod/src/v3/tests/pickomit.test.ts +111 -0
- package/node_modules/zod/src/v3/tests/pipeline.test.ts +29 -0
- package/node_modules/zod/src/v3/tests/preprocess.test.ts +186 -0
- package/node_modules/zod/src/v3/tests/primitive.test.ts +440 -0
- package/node_modules/zod/src/v3/tests/promise.test.ts +90 -0
- package/node_modules/zod/src/v3/tests/readonly.test.ts +194 -0
- package/node_modules/zod/src/v3/tests/record.test.ts +171 -0
- package/node_modules/zod/src/v3/tests/recursive.test.ts +197 -0
- package/node_modules/zod/src/v3/tests/refine.test.ts +313 -0
- package/node_modules/zod/src/v3/tests/safeparse.test.ts +27 -0
- package/node_modules/zod/src/v3/tests/set.test.ts +142 -0
- package/node_modules/zod/src/v3/tests/standard-schema.test.ts +83 -0
- package/node_modules/zod/src/v3/tests/string.test.ts +916 -0
- package/node_modules/zod/src/v3/tests/transformer.test.ts +233 -0
- package/node_modules/zod/src/v3/tests/tuple.test.ts +90 -0
- package/node_modules/zod/src/v3/tests/unions.test.ts +57 -0
- package/node_modules/zod/src/v3/tests/validations.test.ts +133 -0
- package/node_modules/zod/src/v3/tests/void.test.ts +15 -0
- package/node_modules/zod/src/v3/types.ts +5136 -0
- package/node_modules/zod/src/v4/classic/checks.ts +30 -0
- package/node_modules/zod/src/v4/classic/coerce.ts +27 -0
- package/node_modules/zod/src/v4/classic/compat.ts +66 -0
- package/node_modules/zod/src/v4/classic/errors.ts +75 -0
- package/node_modules/zod/src/v4/classic/external.ts +50 -0
- package/node_modules/zod/src/v4/classic/index.ts +5 -0
- package/node_modules/zod/src/v4/classic/iso.ts +90 -0
- package/node_modules/zod/src/v4/classic/parse.ts +33 -0
- package/node_modules/zod/src/v4/classic/schemas.ts +2054 -0
- package/node_modules/zod/src/v4/classic/tests/anyunknown.test.ts +26 -0
- package/node_modules/zod/src/v4/classic/tests/array.test.ts +264 -0
- package/node_modules/zod/src/v4/classic/tests/assignability.test.ts +210 -0
- package/node_modules/zod/src/v4/classic/tests/async-parsing.test.ts +381 -0
- package/node_modules/zod/src/v4/classic/tests/async-refinements.test.ts +68 -0
- package/node_modules/zod/src/v4/classic/tests/base.test.ts +7 -0
- package/node_modules/zod/src/v4/classic/tests/bigint.test.ts +54 -0
- package/node_modules/zod/src/v4/classic/tests/brand.test.ts +63 -0
- package/node_modules/zod/src/v4/classic/tests/catch.test.ts +252 -0
- package/node_modules/zod/src/v4/classic/tests/coalesce.test.ts +20 -0
- package/node_modules/zod/src/v4/classic/tests/coerce.test.ts +160 -0
- package/node_modules/zod/src/v4/classic/tests/continuability.test.ts +352 -0
- package/node_modules/zod/src/v4/classic/tests/custom.test.ts +40 -0
- package/node_modules/zod/src/v4/classic/tests/date.test.ts +31 -0
- package/node_modules/zod/src/v4/classic/tests/datetime.test.ts +296 -0
- package/node_modules/zod/src/v4/classic/tests/default.test.ts +313 -0
- package/node_modules/zod/src/v4/classic/tests/description.test.ts +32 -0
- package/node_modules/zod/src/v4/classic/tests/discriminated-unions.test.ts +619 -0
- package/node_modules/zod/src/v4/classic/tests/enum.test.ts +285 -0
- package/node_modules/zod/src/v4/classic/tests/error-utils.test.ts +527 -0
- package/node_modules/zod/src/v4/classic/tests/error.test.ts +711 -0
- package/node_modules/zod/src/v4/classic/tests/file.test.ts +91 -0
- package/node_modules/zod/src/v4/classic/tests/firstparty.test.ts +175 -0
- package/node_modules/zod/src/v4/classic/tests/function.test.ts +268 -0
- package/node_modules/zod/src/v4/classic/tests/generics.test.ts +72 -0
- package/node_modules/zod/src/v4/classic/tests/index.test.ts +829 -0
- package/node_modules/zod/src/v4/classic/tests/instanceof.test.ts +34 -0
- package/node_modules/zod/src/v4/classic/tests/intersection.test.ts +171 -0
- package/node_modules/zod/src/v4/classic/tests/json.test.ts +108 -0
- package/node_modules/zod/src/v4/classic/tests/lazy.test.ts +227 -0
- package/node_modules/zod/src/v4/classic/tests/literal.test.ts +92 -0
- package/node_modules/zod/src/v4/classic/tests/map.test.ts +196 -0
- package/node_modules/zod/src/v4/classic/tests/nan.test.ts +21 -0
- package/node_modules/zod/src/v4/classic/tests/nested-refine.test.ts +168 -0
- package/node_modules/zod/src/v4/classic/tests/nonoptional.test.ts +86 -0
- package/node_modules/zod/src/v4/classic/tests/nullable.test.ts +22 -0
- package/node_modules/zod/src/v4/classic/tests/number.test.ts +247 -0
- package/node_modules/zod/src/v4/classic/tests/object.test.ts +563 -0
- package/node_modules/zod/src/v4/classic/tests/optional.test.ts +123 -0
- package/node_modules/zod/src/v4/classic/tests/partial.test.ts +147 -0
- package/node_modules/zod/src/v4/classic/tests/pickomit.test.ts +127 -0
- package/node_modules/zod/src/v4/classic/tests/pipe.test.ts +81 -0
- package/node_modules/zod/src/v4/classic/tests/prefault.test.ts +37 -0
- package/node_modules/zod/src/v4/classic/tests/preprocess.test.ts +298 -0
- package/node_modules/zod/src/v4/classic/tests/primitive.test.ts +175 -0
- package/node_modules/zod/src/v4/classic/tests/promise.test.ts +81 -0
- package/node_modules/zod/src/v4/classic/tests/prototypes.test.ts +23 -0
- package/node_modules/zod/src/v4/classic/tests/readonly.test.ts +252 -0
- package/node_modules/zod/src/v4/classic/tests/record.test.ts +342 -0
- package/node_modules/zod/src/v4/classic/tests/recursive-types.test.ts +356 -0
- package/node_modules/zod/src/v4/classic/tests/refine.test.ts +532 -0
- package/node_modules/zod/src/v4/classic/tests/registries.test.ts +204 -0
- package/node_modules/zod/src/v4/classic/tests/set.test.ts +179 -0
- package/node_modules/zod/src/v4/classic/tests/standard-schema.test.ts +57 -0
- package/node_modules/zod/src/v4/classic/tests/string-formats.test.ts +109 -0
- package/node_modules/zod/src/v4/classic/tests/string.test.ts +881 -0
- package/node_modules/zod/src/v4/classic/tests/stringbool.test.ts +66 -0
- package/node_modules/zod/src/v4/classic/tests/template-literal.test.ts +758 -0
- package/node_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +2314 -0
- package/node_modules/zod/src/v4/classic/tests/transform.test.ts +250 -0
- package/node_modules/zod/src/v4/classic/tests/tuple.test.ts +163 -0
- package/node_modules/zod/src/v4/classic/tests/union.test.ts +94 -0
- package/node_modules/zod/src/v4/classic/tests/validations.test.ts +283 -0
- package/node_modules/zod/src/v4/classic/tests/void.test.ts +12 -0
- package/node_modules/zod/src/v4/core/api.ts +1594 -0
- package/node_modules/zod/src/v4/core/checks.ts +1283 -0
- package/node_modules/zod/src/v4/core/config.ts +15 -0
- package/node_modules/zod/src/v4/core/core.ts +134 -0
- package/node_modules/zod/src/v4/core/doc.ts +44 -0
- package/node_modules/zod/src/v4/core/errors.ts +424 -0
- package/node_modules/zod/src/v4/core/function.ts +176 -0
- package/node_modules/zod/src/v4/core/index.ts +15 -0
- package/node_modules/zod/src/v4/core/json-schema.ts +143 -0
- package/node_modules/zod/src/v4/core/parse.ts +94 -0
- package/node_modules/zod/src/v4/core/regexes.ts +135 -0
- package/node_modules/zod/src/v4/core/registries.ts +96 -0
- package/node_modules/zod/src/v4/core/schemas.ts +3842 -0
- package/node_modules/zod/src/v4/core/standard-schema.ts +64 -0
- package/node_modules/zod/src/v4/core/tests/index.test.ts +46 -0
- package/node_modules/zod/src/v4/core/tests/locales/be.test.ts +124 -0
- package/node_modules/zod/src/v4/core/tests/locales/en.test.ts +22 -0
- package/node_modules/zod/src/v4/core/tests/locales/ru.test.ts +128 -0
- package/node_modules/zod/src/v4/core/tests/locales/tr.test.ts +69 -0
- package/node_modules/zod/src/v4/core/to-json-schema.ts +977 -0
- package/node_modules/zod/src/v4/core/util.ts +775 -0
- package/node_modules/zod/src/v4/core/versions.ts +5 -0
- package/node_modules/zod/src/v4/core/zsf.ts +323 -0
- package/node_modules/zod/src/v4/index.ts +4 -0
- package/node_modules/zod/src/v4/locales/ar.ts +125 -0
- package/node_modules/zod/src/v4/locales/az.ts +121 -0
- package/node_modules/zod/src/v4/locales/be.ts +184 -0
- package/node_modules/zod/src/v4/locales/ca.ts +127 -0
- package/node_modules/zod/src/v4/locales/cs.ts +142 -0
- package/node_modules/zod/src/v4/locales/de.ts +124 -0
- package/node_modules/zod/src/v4/locales/en.ts +127 -0
- package/node_modules/zod/src/v4/locales/eo.ts +125 -0
- package/node_modules/zod/src/v4/locales/es.ts +125 -0
- package/node_modules/zod/src/v4/locales/fa.ts +134 -0
- package/node_modules/zod/src/v4/locales/fi.ts +131 -0
- package/node_modules/zod/src/v4/locales/fr-CA.ts +126 -0
- package/node_modules/zod/src/v4/locales/fr.ts +124 -0
- package/node_modules/zod/src/v4/locales/he.ts +125 -0
- package/node_modules/zod/src/v4/locales/hu.ts +126 -0
- package/node_modules/zod/src/v4/locales/id.ts +125 -0
- package/node_modules/zod/src/v4/locales/index.ts +39 -0
- package/node_modules/zod/src/v4/locales/it.ts +125 -0
- package/node_modules/zod/src/v4/locales/ja.ts +122 -0
- package/node_modules/zod/src/v4/locales/kh.ts +126 -0
- package/node_modules/zod/src/v4/locales/ko.ts +131 -0
- package/node_modules/zod/src/v4/locales/mk.ts +127 -0
- package/node_modules/zod/src/v4/locales/ms.ts +124 -0
- package/node_modules/zod/src/v4/locales/nl.ts +126 -0
- package/node_modules/zod/src/v4/locales/no.ts +124 -0
- package/node_modules/zod/src/v4/locales/ota.ts +125 -0
- package/node_modules/zod/src/v4/locales/pl.ts +126 -0
- package/node_modules/zod/src/v4/locales/ps.ts +133 -0
- package/node_modules/zod/src/v4/locales/pt.ts +123 -0
- package/node_modules/zod/src/v4/locales/ru.ts +184 -0
- package/node_modules/zod/src/v4/locales/sl.ts +126 -0
- package/node_modules/zod/src/v4/locales/sv.ts +127 -0
- package/node_modules/zod/src/v4/locales/ta.ts +125 -0
- package/node_modules/zod/src/v4/locales/th.ts +126 -0
- package/node_modules/zod/src/v4/locales/tr.ts +121 -0
- package/node_modules/zod/src/v4/locales/ua.ts +126 -0
- package/node_modules/zod/src/v4/locales/ur.ts +126 -0
- package/node_modules/zod/src/v4/locales/vi.ts +125 -0
- package/node_modules/zod/src/v4/locales/zh-CN.ts +123 -0
- package/node_modules/zod/src/v4/locales/zh-TW.ts +125 -0
- package/node_modules/zod/src/v4/mini/checks.ts +32 -0
- package/node_modules/zod/src/v4/mini/coerce.ts +22 -0
- package/node_modules/zod/src/v4/mini/external.ts +40 -0
- package/node_modules/zod/src/v4/mini/index.ts +3 -0
- package/node_modules/zod/src/v4/mini/iso.ts +62 -0
- package/node_modules/zod/src/v4/mini/parse.ts +1 -0
- package/node_modules/zod/src/v4/mini/schemas.ts +1579 -0
- package/node_modules/zod/src/v4/mini/tests/assignability.test.ts +129 -0
- package/node_modules/zod/src/v4/mini/tests/brand.test.ts +51 -0
- package/node_modules/zod/src/v4/mini/tests/checks.test.ts +144 -0
- package/node_modules/zod/src/v4/mini/tests/computed.test.ts +36 -0
- package/node_modules/zod/src/v4/mini/tests/error.test.ts +22 -0
- package/node_modules/zod/src/v4/mini/tests/functions.test.ts +43 -0
- package/node_modules/zod/src/v4/mini/tests/index.test.ts +871 -0
- package/node_modules/zod/src/v4/mini/tests/number.test.ts +95 -0
- package/node_modules/zod/src/v4/mini/tests/object.test.ts +185 -0
- package/node_modules/zod/src/v4/mini/tests/prototypes.test.ts +43 -0
- package/node_modules/zod/src/v4/mini/tests/recursive-types.test.ts +275 -0
- package/node_modules/zod/src/v4/mini/tests/string.test.ts +299 -0
- package/node_modules/zod/src/v4-mini/index.ts +1 -0
- package/node_modules/zod/v3/ZodError.cjs +138 -0
- package/node_modules/zod/v3/ZodError.d.cts +164 -0
- package/node_modules/zod/v3/ZodError.d.ts +164 -0
- package/node_modules/zod/v3/ZodError.js +133 -0
- package/node_modules/zod/v3/errors.cjs +17 -0
- package/node_modules/zod/v3/errors.d.cts +5 -0
- package/node_modules/zod/v3/errors.d.ts +5 -0
- package/node_modules/zod/v3/errors.js +9 -0
- package/node_modules/zod/v3/external.cjs +22 -0
- package/node_modules/zod/v3/external.d.cts +6 -0
- package/node_modules/zod/v3/external.d.ts +6 -0
- package/node_modules/zod/v3/external.js +6 -0
- package/node_modules/zod/v3/helpers/enumUtil.cjs +2 -0
- package/node_modules/zod/v3/helpers/enumUtil.d.cts +8 -0
- package/node_modules/zod/v3/helpers/enumUtil.d.ts +8 -0
- package/node_modules/zod/v3/helpers/enumUtil.js +1 -0
- package/node_modules/zod/v3/helpers/errorUtil.cjs +9 -0
- package/node_modules/zod/v3/helpers/errorUtil.d.cts +9 -0
- package/node_modules/zod/v3/helpers/errorUtil.d.ts +9 -0
- package/node_modules/zod/v3/helpers/errorUtil.js +6 -0
- package/node_modules/zod/v3/helpers/parseUtil.cjs +124 -0
- package/node_modules/zod/v3/helpers/parseUtil.d.cts +78 -0
- package/node_modules/zod/v3/helpers/parseUtil.d.ts +78 -0
- package/node_modules/zod/v3/helpers/parseUtil.js +109 -0
- package/node_modules/zod/v3/helpers/partialUtil.cjs +2 -0
- package/node_modules/zod/v3/helpers/partialUtil.d.cts +8 -0
- package/node_modules/zod/v3/helpers/partialUtil.d.ts +8 -0
- package/node_modules/zod/v3/helpers/partialUtil.js +1 -0
- package/node_modules/zod/v3/helpers/typeAliases.cjs +2 -0
- package/node_modules/zod/v3/helpers/typeAliases.d.cts +2 -0
- package/node_modules/zod/v3/helpers/typeAliases.d.ts +2 -0
- package/node_modules/zod/v3/helpers/typeAliases.js +1 -0
- package/node_modules/zod/v3/helpers/util.cjs +137 -0
- package/node_modules/zod/v3/helpers/util.d.cts +85 -0
- package/node_modules/zod/v3/helpers/util.d.ts +85 -0
- package/node_modules/zod/v3/helpers/util.js +133 -0
- package/node_modules/zod/v3/index.cjs +33 -0
- package/node_modules/zod/v3/index.d.cts +4 -0
- package/node_modules/zod/v3/index.d.ts +4 -0
- package/node_modules/zod/v3/index.js +4 -0
- package/node_modules/zod/v3/locales/en.cjs +111 -0
- package/node_modules/zod/v3/locales/en.d.cts +3 -0
- package/node_modules/zod/v3/locales/en.d.ts +3 -0
- package/node_modules/zod/v3/locales/en.js +109 -0
- package/node_modules/zod/v3/standard-schema.cjs +2 -0
- package/node_modules/zod/v3/standard-schema.d.cts +102 -0
- package/node_modules/zod/v3/standard-schema.d.ts +102 -0
- package/node_modules/zod/v3/standard-schema.js +1 -0
- package/node_modules/zod/v3/types.cjs +3775 -0
- package/node_modules/zod/v3/types.d.cts +1031 -0
- package/node_modules/zod/v3/types.d.ts +1031 -0
- package/node_modules/zod/v3/types.js +3693 -0
- package/node_modules/zod/v4/classic/checks.cjs +32 -0
- package/node_modules/zod/v4/classic/checks.d.cts +1 -0
- package/node_modules/zod/v4/classic/checks.d.ts +1 -0
- package/node_modules/zod/v4/classic/checks.js +1 -0
- package/node_modules/zod/v4/classic/coerce.cjs +47 -0
- package/node_modules/zod/v4/classic/coerce.d.cts +17 -0
- package/node_modules/zod/v4/classic/coerce.d.ts +17 -0
- package/node_modules/zod/v4/classic/coerce.js +17 -0
- package/node_modules/zod/v4/classic/compat.cjs +57 -0
- package/node_modules/zod/v4/classic/compat.d.cts +46 -0
- package/node_modules/zod/v4/classic/compat.d.ts +46 -0
- package/node_modules/zod/v4/classic/compat.js +27 -0
- package/node_modules/zod/v4/classic/errors.cjs +67 -0
- package/node_modules/zod/v4/classic/errors.d.cts +30 -0
- package/node_modules/zod/v4/classic/errors.d.ts +30 -0
- package/node_modules/zod/v4/classic/errors.js +41 -0
- package/node_modules/zod/v4/classic/external.cjs +70 -0
- package/node_modules/zod/v4/classic/external.d.cts +13 -0
- package/node_modules/zod/v4/classic/external.d.ts +13 -0
- package/node_modules/zod/v4/classic/external.js +18 -0
- package/node_modules/zod/v4/classic/index.cjs +33 -0
- package/node_modules/zod/v4/classic/index.d.cts +4 -0
- package/node_modules/zod/v4/classic/index.d.ts +4 -0
- package/node_modules/zod/v4/classic/index.js +4 -0
- package/node_modules/zod/v4/classic/iso.cjs +60 -0
- package/node_modules/zod/v4/classic/iso.d.cts +22 -0
- package/node_modules/zod/v4/classic/iso.d.ts +22 -0
- package/node_modules/zod/v4/classic/iso.js +30 -0
- package/node_modules/zod/v4/classic/parse.cjs +32 -0
- package/node_modules/zod/v4/classic/parse.d.cts +23 -0
- package/node_modules/zod/v4/classic/parse.d.ts +23 -0
- package/node_modules/zod/v4/classic/parse.js +6 -0
- package/node_modules/zod/v4/classic/schemas.cjs +1109 -0
- package/node_modules/zod/v4/classic/schemas.d.cts +630 -0
- package/node_modules/zod/v4/classic/schemas.d.ts +630 -0
- package/node_modules/zod/v4/classic/schemas.js +1006 -0
- package/node_modules/zod/v4/core/api.cjs +1039 -0
- package/node_modules/zod/v4/core/api.d.cts +284 -0
- package/node_modules/zod/v4/core/api.d.ts +284 -0
- package/node_modules/zod/v4/core/api.js +906 -0
- package/node_modules/zod/v4/core/checks.cjs +591 -0
- package/node_modules/zod/v4/core/checks.d.cts +278 -0
- package/node_modules/zod/v4/core/checks.d.ts +278 -0
- package/node_modules/zod/v4/core/checks.js +565 -0
- package/node_modules/zod/v4/core/core.cjs +67 -0
- package/node_modules/zod/v4/core/core.d.cts +49 -0
- package/node_modules/zod/v4/core/core.d.ts +49 -0
- package/node_modules/zod/v4/core/core.js +61 -0
- package/node_modules/zod/v4/core/doc.cjs +39 -0
- package/node_modules/zod/v4/core/doc.d.cts +14 -0
- package/node_modules/zod/v4/core/doc.d.ts +14 -0
- package/node_modules/zod/v4/core/doc.js +35 -0
- package/node_modules/zod/v4/core/errors.cjs +226 -0
- package/node_modules/zod/v4/core/errors.d.cts +208 -0
- package/node_modules/zod/v4/core/errors.d.ts +208 -0
- package/node_modules/zod/v4/core/errors.js +195 -0
- package/node_modules/zod/v4/core/function.cjs +102 -0
- package/node_modules/zod/v4/core/function.d.cts +52 -0
- package/node_modules/zod/v4/core/function.d.ts +52 -0
- package/node_modules/zod/v4/core/function.js +75 -0
- package/node_modules/zod/v4/core/index.cjs +44 -0
- package/node_modules/zod/v4/core/index.d.cts +15 -0
- package/node_modules/zod/v4/core/index.d.ts +15 -0
- package/node_modules/zod/v4/core/index.js +15 -0
- package/node_modules/zod/v4/core/json-schema.cjs +2 -0
- package/node_modules/zod/v4/core/json-schema.d.cts +87 -0
- package/node_modules/zod/v4/core/json-schema.d.ts +87 -0
- package/node_modules/zod/v4/core/json-schema.js +1 -0
- package/node_modules/zod/v4/core/parse.cjs +87 -0
- package/node_modules/zod/v4/core/parse.d.cts +25 -0
- package/node_modules/zod/v4/core/parse.d.ts +25 -0
- package/node_modules/zod/v4/core/parse.js +57 -0
- package/node_modules/zod/v4/core/regexes.cjs +103 -0
- package/node_modules/zod/v4/core/regexes.d.cts +62 -0
- package/node_modules/zod/v4/core/regexes.d.ts +62 -0
- package/node_modules/zod/v4/core/regexes.js +95 -0
- package/node_modules/zod/v4/core/registries.cjs +56 -0
- package/node_modules/zod/v4/core/registries.d.cts +35 -0
- package/node_modules/zod/v4/core/registries.d.ts +35 -0
- package/node_modules/zod/v4/core/registries.js +51 -0
- package/node_modules/zod/v4/core/schemas.cjs +1748 -0
- package/node_modules/zod/v4/core/schemas.d.cts +1041 -0
- package/node_modules/zod/v4/core/schemas.d.ts +1041 -0
- package/node_modules/zod/v4/core/schemas.js +1717 -0
- package/node_modules/zod/v4/core/standard-schema.cjs +2 -0
- package/node_modules/zod/v4/core/standard-schema.d.cts +55 -0
- package/node_modules/zod/v4/core/standard-schema.d.ts +55 -0
- package/node_modules/zod/v4/core/standard-schema.js +1 -0
- package/node_modules/zod/v4/core/to-json-schema.cjs +854 -0
- package/node_modules/zod/v4/core/to-json-schema.d.cts +88 -0
- package/node_modules/zod/v4/core/to-json-schema.d.ts +88 -0
- package/node_modules/zod/v4/core/to-json-schema.js +849 -0
- package/node_modules/zod/v4/core/util.cjs +539 -0
- package/node_modules/zod/v4/core/util.d.cts +183 -0
- package/node_modules/zod/v4/core/util.d.ts +183 -0
- package/node_modules/zod/v4/core/util.js +493 -0
- package/node_modules/zod/v4/core/versions.cjs +8 -0
- package/node_modules/zod/v4/core/versions.d.cts +5 -0
- package/node_modules/zod/v4/core/versions.d.ts +5 -0
- package/node_modules/zod/v4/core/versions.js +5 -0
- package/node_modules/zod/v4/index.cjs +22 -0
- package/node_modules/zod/v4/index.d.cts +3 -0
- package/node_modules/zod/v4/index.d.ts +3 -0
- package/node_modules/zod/v4/index.js +3 -0
- package/node_modules/zod/v4/locales/ar.cjs +142 -0
- package/node_modules/zod/v4/locales/ar.d.cts +4 -0
- package/node_modules/zod/v4/locales/ar.d.ts +4 -0
- package/node_modules/zod/v4/locales/ar.js +116 -0
- package/node_modules/zod/v4/locales/az.cjs +141 -0
- package/node_modules/zod/v4/locales/az.d.cts +4 -0
- package/node_modules/zod/v4/locales/az.d.ts +4 -0
- package/node_modules/zod/v4/locales/az.js +115 -0
- package/node_modules/zod/v4/locales/be.cjs +190 -0
- package/node_modules/zod/v4/locales/be.d.cts +4 -0
- package/node_modules/zod/v4/locales/be.d.ts +4 -0
- package/node_modules/zod/v4/locales/be.js +164 -0
- package/node_modules/zod/v4/locales/ca.cjs +144 -0
- package/node_modules/zod/v4/locales/ca.d.cts +4 -0
- package/node_modules/zod/v4/locales/ca.d.ts +4 -0
- package/node_modules/zod/v4/locales/ca.js +118 -0
- package/node_modules/zod/v4/locales/cs.cjs +161 -0
- package/node_modules/zod/v4/locales/cs.d.cts +4 -0
- package/node_modules/zod/v4/locales/cs.d.ts +4 -0
- package/node_modules/zod/v4/locales/cs.js +135 -0
- package/node_modules/zod/v4/locales/de.cjs +142 -0
- package/node_modules/zod/v4/locales/de.d.cts +4 -0
- package/node_modules/zod/v4/locales/de.d.ts +4 -0
- package/node_modules/zod/v4/locales/de.js +116 -0
- package/node_modules/zod/v4/locales/en.cjs +145 -0
- package/node_modules/zod/v4/locales/en.d.cts +5 -0
- package/node_modules/zod/v4/locales/en.d.ts +5 -0
- package/node_modules/zod/v4/locales/en.js +117 -0
- package/node_modules/zod/v4/locales/eo.cjs +144 -0
- package/node_modules/zod/v4/locales/eo.d.cts +5 -0
- package/node_modules/zod/v4/locales/eo.d.ts +5 -0
- package/node_modules/zod/v4/locales/eo.js +116 -0
- package/node_modules/zod/v4/locales/es.cjs +143 -0
- package/node_modules/zod/v4/locales/es.d.cts +4 -0
- package/node_modules/zod/v4/locales/es.d.ts +4 -0
- package/node_modules/zod/v4/locales/es.js +117 -0
- package/node_modules/zod/v4/locales/fa.cjs +148 -0
- package/node_modules/zod/v4/locales/fa.d.cts +4 -0
- package/node_modules/zod/v4/locales/fa.d.ts +4 -0
- package/node_modules/zod/v4/locales/fa.js +122 -0
- package/node_modules/zod/v4/locales/fi.cjs +148 -0
- package/node_modules/zod/v4/locales/fi.d.cts +4 -0
- package/node_modules/zod/v4/locales/fi.d.ts +4 -0
- package/node_modules/zod/v4/locales/fi.js +122 -0
- package/node_modules/zod/v4/locales/fr-CA.cjs +143 -0
- package/node_modules/zod/v4/locales/fr-CA.d.cts +4 -0
- package/node_modules/zod/v4/locales/fr-CA.d.ts +4 -0
- package/node_modules/zod/v4/locales/fr-CA.js +117 -0
- package/node_modules/zod/v4/locales/fr.cjs +142 -0
- package/node_modules/zod/v4/locales/fr.d.cts +4 -0
- package/node_modules/zod/v4/locales/fr.d.ts +4 -0
- package/node_modules/zod/v4/locales/fr.js +116 -0
- package/node_modules/zod/v4/locales/he.cjs +143 -0
- package/node_modules/zod/v4/locales/he.d.cts +4 -0
- package/node_modules/zod/v4/locales/he.d.ts +4 -0
- package/node_modules/zod/v4/locales/he.js +117 -0
- package/node_modules/zod/v4/locales/hu.cjs +143 -0
- package/node_modules/zod/v4/locales/hu.d.cts +4 -0
- package/node_modules/zod/v4/locales/hu.d.ts +4 -0
- package/node_modules/zod/v4/locales/hu.js +117 -0
- package/node_modules/zod/v4/locales/id.cjs +142 -0
- package/node_modules/zod/v4/locales/id.d.cts +4 -0
- package/node_modules/zod/v4/locales/id.d.ts +4 -0
- package/node_modules/zod/v4/locales/id.js +116 -0
- package/node_modules/zod/v4/locales/index.cjs +84 -0
- package/node_modules/zod/v4/locales/index.d.cts +39 -0
- package/node_modules/zod/v4/locales/index.d.ts +39 -0
- package/node_modules/zod/v4/locales/index.js +39 -0
- package/node_modules/zod/v4/locales/it.cjs +143 -0
- package/node_modules/zod/v4/locales/it.d.cts +4 -0
- package/node_modules/zod/v4/locales/it.d.ts +4 -0
- package/node_modules/zod/v4/locales/it.js +117 -0
- package/node_modules/zod/v4/locales/ja.cjs +141 -0
- package/node_modules/zod/v4/locales/ja.d.cts +4 -0
- package/node_modules/zod/v4/locales/ja.d.ts +4 -0
- package/node_modules/zod/v4/locales/ja.js +115 -0
- package/node_modules/zod/v4/locales/kh.cjs +143 -0
- package/node_modules/zod/v4/locales/kh.d.cts +4 -0
- package/node_modules/zod/v4/locales/kh.d.ts +4 -0
- package/node_modules/zod/v4/locales/kh.js +117 -0
- package/node_modules/zod/v4/locales/ko.cjs +147 -0
- package/node_modules/zod/v4/locales/ko.d.cts +4 -0
- package/node_modules/zod/v4/locales/ko.d.ts +4 -0
- package/node_modules/zod/v4/locales/ko.js +121 -0
- package/node_modules/zod/v4/locales/mk.cjs +144 -0
- package/node_modules/zod/v4/locales/mk.d.cts +4 -0
- package/node_modules/zod/v4/locales/mk.d.ts +4 -0
- package/node_modules/zod/v4/locales/mk.js +118 -0
- package/node_modules/zod/v4/locales/ms.cjs +142 -0
- package/node_modules/zod/v4/locales/ms.d.cts +4 -0
- package/node_modules/zod/v4/locales/ms.d.ts +4 -0
- package/node_modules/zod/v4/locales/ms.js +116 -0
- package/node_modules/zod/v4/locales/nl.cjs +143 -0
- package/node_modules/zod/v4/locales/nl.d.cts +4 -0
- package/node_modules/zod/v4/locales/nl.d.ts +4 -0
- package/node_modules/zod/v4/locales/nl.js +117 -0
- package/node_modules/zod/v4/locales/no.cjs +142 -0
- package/node_modules/zod/v4/locales/no.d.cts +4 -0
- package/node_modules/zod/v4/locales/no.d.ts +4 -0
- package/node_modules/zod/v4/locales/no.js +116 -0
- package/node_modules/zod/v4/locales/ota.cjs +143 -0
- package/node_modules/zod/v4/locales/ota.d.cts +4 -0
- package/node_modules/zod/v4/locales/ota.d.ts +4 -0
- package/node_modules/zod/v4/locales/ota.js +117 -0
- package/node_modules/zod/v4/locales/pl.cjs +143 -0
- package/node_modules/zod/v4/locales/pl.d.cts +4 -0
- package/node_modules/zod/v4/locales/pl.d.ts +4 -0
- package/node_modules/zod/v4/locales/pl.js +117 -0
- package/node_modules/zod/v4/locales/ps.cjs +148 -0
- package/node_modules/zod/v4/locales/ps.d.cts +4 -0
- package/node_modules/zod/v4/locales/ps.d.ts +4 -0
- package/node_modules/zod/v4/locales/ps.js +122 -0
- package/node_modules/zod/v4/locales/pt.cjs +142 -0
- package/node_modules/zod/v4/locales/pt.d.cts +4 -0
- package/node_modules/zod/v4/locales/pt.d.ts +4 -0
- package/node_modules/zod/v4/locales/pt.js +116 -0
- package/node_modules/zod/v4/locales/ru.cjs +190 -0
- package/node_modules/zod/v4/locales/ru.d.cts +4 -0
- package/node_modules/zod/v4/locales/ru.d.ts +4 -0
- package/node_modules/zod/v4/locales/ru.js +164 -0
- package/node_modules/zod/v4/locales/sl.cjs +143 -0
- package/node_modules/zod/v4/locales/sl.d.cts +4 -0
- package/node_modules/zod/v4/locales/sl.d.ts +4 -0
- package/node_modules/zod/v4/locales/sl.js +117 -0
- package/node_modules/zod/v4/locales/sv.cjs +144 -0
- package/node_modules/zod/v4/locales/sv.d.cts +4 -0
- package/node_modules/zod/v4/locales/sv.d.ts +4 -0
- package/node_modules/zod/v4/locales/sv.js +118 -0
- package/node_modules/zod/v4/locales/ta.cjs +143 -0
- package/node_modules/zod/v4/locales/ta.d.cts +4 -0
- package/node_modules/zod/v4/locales/ta.d.ts +4 -0
- package/node_modules/zod/v4/locales/ta.js +117 -0
- package/node_modules/zod/v4/locales/th.cjs +143 -0
- package/node_modules/zod/v4/locales/th.d.cts +4 -0
- package/node_modules/zod/v4/locales/th.d.ts +4 -0
- package/node_modules/zod/v4/locales/th.js +117 -0
- package/node_modules/zod/v4/locales/tr.cjs +143 -0
- package/node_modules/zod/v4/locales/tr.d.cts +5 -0
- package/node_modules/zod/v4/locales/tr.d.ts +5 -0
- package/node_modules/zod/v4/locales/tr.js +115 -0
- package/node_modules/zod/v4/locales/ua.cjs +143 -0
- package/node_modules/zod/v4/locales/ua.d.cts +4 -0
- package/node_modules/zod/v4/locales/ua.d.ts +4 -0
- package/node_modules/zod/v4/locales/ua.js +117 -0
- package/node_modules/zod/v4/locales/ur.cjs +143 -0
- package/node_modules/zod/v4/locales/ur.d.cts +4 -0
- package/node_modules/zod/v4/locales/ur.d.ts +4 -0
- package/node_modules/zod/v4/locales/ur.js +117 -0
- package/node_modules/zod/v4/locales/vi.cjs +142 -0
- package/node_modules/zod/v4/locales/vi.d.cts +4 -0
- package/node_modules/zod/v4/locales/vi.d.ts +4 -0
- package/node_modules/zod/v4/locales/vi.js +116 -0
- package/node_modules/zod/v4/locales/zh-CN.cjs +142 -0
- package/node_modules/zod/v4/locales/zh-CN.d.cts +4 -0
- package/node_modules/zod/v4/locales/zh-CN.d.ts +4 -0
- package/node_modules/zod/v4/locales/zh-CN.js +116 -0
- package/node_modules/zod/v4/locales/zh-TW.cjs +143 -0
- package/node_modules/zod/v4/locales/zh-TW.d.cts +4 -0
- package/node_modules/zod/v4/locales/zh-TW.d.ts +4 -0
- package/node_modules/zod/v4/locales/zh-TW.js +117 -0
- package/node_modules/zod/v4/mini/checks.cjs +34 -0
- package/node_modules/zod/v4/mini/checks.d.cts +1 -0
- package/node_modules/zod/v4/mini/checks.d.ts +1 -0
- package/node_modules/zod/v4/mini/checks.js +1 -0
- package/node_modules/zod/v4/mini/coerce.cjs +47 -0
- package/node_modules/zod/v4/mini/coerce.d.cts +7 -0
- package/node_modules/zod/v4/mini/coerce.d.ts +7 -0
- package/node_modules/zod/v4/mini/coerce.js +17 -0
- package/node_modules/zod/v4/mini/external.cjs +62 -0
- package/node_modules/zod/v4/mini/external.d.cts +11 -0
- package/node_modules/zod/v4/mini/external.d.ts +11 -0
- package/node_modules/zod/v4/mini/external.js +13 -0
- package/node_modules/zod/v4/mini/index.cjs +32 -0
- package/node_modules/zod/v4/mini/index.d.cts +3 -0
- package/node_modules/zod/v4/mini/index.d.ts +3 -0
- package/node_modules/zod/v4/mini/index.js +3 -0
- package/node_modules/zod/v4/mini/iso.cjs +60 -0
- package/node_modules/zod/v4/mini/iso.d.cts +22 -0
- package/node_modules/zod/v4/mini/iso.d.ts +22 -0
- package/node_modules/zod/v4/mini/iso.js +30 -0
- package/node_modules/zod/v4/mini/parse.cjs +8 -0
- package/node_modules/zod/v4/mini/parse.d.cts +1 -0
- package/node_modules/zod/v4/mini/parse.d.ts +1 -0
- package/node_modules/zod/v4/mini/parse.js +1 -0
- package/node_modules/zod/v4/mini/schemas.cjs +839 -0
- package/node_modules/zod/v4/mini/schemas.d.cts +356 -0
- package/node_modules/zod/v4/mini/schemas.d.ts +356 -0
- package/node_modules/zod/v4/mini/schemas.js +732 -0
- package/node_modules/zod/v4-mini/index.cjs +17 -0
- package/node_modules/zod/v4-mini/index.d.cts +1 -0
- package/node_modules/zod/v4-mini/index.d.ts +1 -0
- package/node_modules/zod/v4-mini/index.js +1 -0
- package/package.json +100 -101
- package/dist/index-DXag5A9X.js +0 -1096
|
@@ -0,0 +1,795 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Series 协议转换器 - 将笛卡尔/径向图表协议数据转换为 ECharts option
|
|
3
|
+
* @author seadon
|
|
4
|
+
* @created 2026-05-05
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type { EChartsOption } from 'echarts';
|
|
8
|
+
|
|
9
|
+
import type {
|
|
10
|
+
ProtocolConfigPayload,
|
|
11
|
+
ProtocolConverter,
|
|
12
|
+
ProtocolDataPayload,
|
|
13
|
+
} from '../types';
|
|
14
|
+
|
|
15
|
+
interface NormalizedSeriesItem {
|
|
16
|
+
id?: string;
|
|
17
|
+
name: string;
|
|
18
|
+
typeHint?: string;
|
|
19
|
+
data: unknown[];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
interface NormalizedSeriesPayload {
|
|
23
|
+
categories: string[];
|
|
24
|
+
indicators: Array<{ name: string; max?: number }>;
|
|
25
|
+
series: NormalizedSeriesItem[];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const WORKBENCH_METRIC_ROW_CONTEXT_KEY = '__workbenchMetricRowContext';
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* 判断给定值是否为可读取字段的普通对象。
|
|
32
|
+
* @param value - 待判断的值
|
|
33
|
+
* @returns 当值为非数组对象时返回 true
|
|
34
|
+
*/
|
|
35
|
+
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
36
|
+
return Boolean(value) && typeof value === 'object' && !Array.isArray(value);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* 将数组型标签数据统一转换为字符串数组。
|
|
41
|
+
* @param value - 候选标签数组
|
|
42
|
+
* @returns 规范化后的标签列表
|
|
43
|
+
*/
|
|
44
|
+
function toStringLabels(value: unknown): string[] {
|
|
45
|
+
return Array.isArray(value) ? value.map((item) => String(item ?? '')) : [];
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* 规范化系列值,保留 ECharts 已支持的对象型 data item。
|
|
50
|
+
* @param value - 原始系列值
|
|
51
|
+
* @returns 可传给 ECharts series.data 的值
|
|
52
|
+
*/
|
|
53
|
+
function normalizeSeriesValue(value: unknown): unknown {
|
|
54
|
+
if (typeof value === 'number' && Number.isFinite(value)) return value;
|
|
55
|
+
if (typeof value === 'string' && value.trim()) {
|
|
56
|
+
const parsed = Number(value);
|
|
57
|
+
return Number.isFinite(parsed) ? parsed : value;
|
|
58
|
+
}
|
|
59
|
+
if (isRecord(value) && 'value' in value) {
|
|
60
|
+
const rawValue = value.value;
|
|
61
|
+
const parsedValue = typeof rawValue === 'string' && rawValue.trim()
|
|
62
|
+
? Number(rawValue)
|
|
63
|
+
: rawValue;
|
|
64
|
+
return {
|
|
65
|
+
...value,
|
|
66
|
+
value: typeof parsedValue === 'number' && Number.isFinite(parsedValue)
|
|
67
|
+
? parsedValue
|
|
68
|
+
: rawValue,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
return value;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* 从 canonical 或 dataset 包裹的协议数据中读取类目标签。
|
|
76
|
+
* @param source - 协议数据对象或其中的 dataset 对象
|
|
77
|
+
* @returns 主类目轴标签
|
|
78
|
+
*/
|
|
79
|
+
function readCategories(source: Record<string, unknown>): string[] {
|
|
80
|
+
const categories = source.categories;
|
|
81
|
+
if (Array.isArray(categories)) return toStringLabels(categories);
|
|
82
|
+
if (isRecord(categories)) return toStringLabels(categories.xAxis);
|
|
83
|
+
|
|
84
|
+
const xAxis = source.xAxis;
|
|
85
|
+
if (Array.isArray(xAxis)) return toStringLabels(xAxis);
|
|
86
|
+
if (isRecord(xAxis)) return toStringLabels(xAxis.data);
|
|
87
|
+
|
|
88
|
+
return [];
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Reads radar indicators from protocol categories.
|
|
93
|
+
* @param source - Protocol data object or dataset object.
|
|
94
|
+
* @returns Radar indicator definitions accepted by ECharts.
|
|
95
|
+
*/
|
|
96
|
+
function readRadarIndicators(source: Record<string, unknown>): Array<{ name: string; max?: number }> {
|
|
97
|
+
const categories = source.categories;
|
|
98
|
+
if (!isRecord(categories) || !Array.isArray(categories.indicators)) return [];
|
|
99
|
+
return categories.indicators
|
|
100
|
+
.filter(isRecord)
|
|
101
|
+
.map((item) => {
|
|
102
|
+
const name = typeof item.name === 'string' && item.name.trim() ? item.name.trim() : '';
|
|
103
|
+
const max = typeof item.max === 'number' && Number.isFinite(item.max) ? item.max : undefined;
|
|
104
|
+
return name ? { name, ...(max === undefined ? {} : { max }) } : null;
|
|
105
|
+
})
|
|
106
|
+
.filter((item): item is { name: string; max?: number } => Boolean(item));
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* 从协议数据中读取系列数组。
|
|
111
|
+
* @param source - 协议数据对象或其中的 dataset 对象
|
|
112
|
+
* @returns 规范化后的系列列表
|
|
113
|
+
*/
|
|
114
|
+
function readSeries(source: Record<string, unknown>): NormalizedSeriesItem[] {
|
|
115
|
+
const series = source.series;
|
|
116
|
+
if (!Array.isArray(series)) return [];
|
|
117
|
+
|
|
118
|
+
return series.filter(isRecord).map((item, index) => {
|
|
119
|
+
const id = typeof item.id === 'string' && item.id.trim() ? item.id.trim() : undefined;
|
|
120
|
+
const name = typeof item.name === 'string' && item.name.trim()
|
|
121
|
+
? item.name.trim()
|
|
122
|
+
: id || `series-${index + 1}`;
|
|
123
|
+
const typeHint = typeof item.typeHint === 'string' && item.typeHint.trim()
|
|
124
|
+
? item.typeHint.trim()
|
|
125
|
+
: typeof item.type === 'string' && item.type.trim()
|
|
126
|
+
? item.type.trim()
|
|
127
|
+
: undefined;
|
|
128
|
+
const data = Array.isArray(item.data) ? item.data.map(normalizeSeriesValue) : [];
|
|
129
|
+
|
|
130
|
+
return { id, name, typeHint, data };
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Reads runtime metric row contexts from protocol data metadata.
|
|
136
|
+
* @param sources - Protocol data candidates.
|
|
137
|
+
* @returns Row contexts aligned with rendered category rows.
|
|
138
|
+
*/
|
|
139
|
+
function readMetricRowContexts(...sources: Array<Record<string, unknown> | undefined>): Record<string, unknown>[] {
|
|
140
|
+
for (const source of sources) {
|
|
141
|
+
if (!source) continue;
|
|
142
|
+
const extension = isRecord(source.extension) ? source.extension : undefined;
|
|
143
|
+
const metricContext = isRecord(source.metric_context)
|
|
144
|
+
? source.metric_context
|
|
145
|
+
: isRecord(extension?.metric_context)
|
|
146
|
+
? extension.metric_context
|
|
147
|
+
: undefined;
|
|
148
|
+
const rowContexts = metricContext?.row_contexts;
|
|
149
|
+
if (Array.isArray(rowContexts)) return rowContexts.filter(isRecord);
|
|
150
|
+
}
|
|
151
|
+
return [];
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Preserves a stable row-context pointer on ECharts data items.
|
|
156
|
+
* @param value - Series data value.
|
|
157
|
+
* @param rowContext - Runtime metric row context for the same category.
|
|
158
|
+
* @returns ECharts data item with internal workbench metadata.
|
|
159
|
+
*/
|
|
160
|
+
function withMetricRowContext(value: unknown, rowContext: Record<string, unknown> | undefined): unknown {
|
|
161
|
+
if (!rowContext) return value;
|
|
162
|
+
if (isRecord(value)) return { ...value, [WORKBENCH_METRIC_ROW_CONTEXT_KEY]: rowContext };
|
|
163
|
+
return { value, [WORKBENCH_METRIC_ROW_CONTEXT_KEY]: rowContext };
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Attaches row contexts to every rendered series by category index.
|
|
168
|
+
* @param series - Normalized runtime series.
|
|
169
|
+
* @param rowContexts - Row contexts from protocol metadata.
|
|
170
|
+
* @returns Series with data items carrying stable metric row identity.
|
|
171
|
+
*/
|
|
172
|
+
function attachMetricRowContexts(
|
|
173
|
+
series: NormalizedSeriesItem[],
|
|
174
|
+
rowContexts: Record<string, unknown>[],
|
|
175
|
+
): NormalizedSeriesItem[] {
|
|
176
|
+
if (rowContexts.length === 0) return series;
|
|
177
|
+
return series.map((item) => ({
|
|
178
|
+
...item,
|
|
179
|
+
data: item.data.map((value, index) => withMetricRowContext(value, rowContexts[index])),
|
|
180
|
+
}));
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Normalizes series protocol data while preserving runtime metric row identity.
|
|
185
|
+
* @param data - Raw protocol data received by setData.
|
|
186
|
+
* @returns Categories, indicators, and renderable series values.
|
|
187
|
+
*/
|
|
188
|
+
function normalizeSeriesPayload(data: ProtocolDataPayload): NormalizedSeriesPayload {
|
|
189
|
+
const payload: Record<string, unknown> = isRecord(data) ? data : {};
|
|
190
|
+
const dataset = isRecord(payload.dataset) ? payload.dataset : undefined;
|
|
191
|
+
const categorySource = dataset && readCategories(dataset).length > 0 ? dataset : payload;
|
|
192
|
+
const seriesSource = dataset && readSeries(dataset).length > 0 ? dataset : payload;
|
|
193
|
+
const rowContexts = readMetricRowContexts(payload, dataset);
|
|
194
|
+
|
|
195
|
+
return {
|
|
196
|
+
categories: readCategories(categorySource),
|
|
197
|
+
indicators: readRadarIndicators(categorySource),
|
|
198
|
+
series: attachMetricRowContexts(readSeries(seriesSource), rowContexts),
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* 判断某个 series option 是否为饼图系列。
|
|
204
|
+
* @param seriesDef - ECharts series 配置片段
|
|
205
|
+
* @returns 当 series 类型为 pie 时返回 true
|
|
206
|
+
*/
|
|
207
|
+
function isPieSeries(seriesDef: Record<string, unknown>): boolean {
|
|
208
|
+
return seriesDef.type === 'pie';
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* 判断某个 series option 是否为雷达图系列。
|
|
213
|
+
* @param seriesDef - ECharts series 配置片段
|
|
214
|
+
* @returns 当 series 类型为 radar 时返回 true
|
|
215
|
+
*/
|
|
216
|
+
function isRadarSeries(seriesDef: Record<string, unknown>): boolean {
|
|
217
|
+
return seriesDef.type === 'radar';
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* 判断某个 series option 是否为漏斗图系列。
|
|
222
|
+
* @param seriesDef - ECharts series 配置片段
|
|
223
|
+
* @returns 当 series 类型为 funnel 时返回 true
|
|
224
|
+
*/
|
|
225
|
+
function isFunnelSeries(seriesDef: Record<string, unknown>): boolean {
|
|
226
|
+
return seriesDef.type === 'funnel';
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* 判断 option 中是否包含饼图系列。
|
|
231
|
+
* @param option - 当前 ECharts option
|
|
232
|
+
* @returns 当任意系列为 pie 时返回 true
|
|
233
|
+
*/
|
|
234
|
+
function optionHasPieSeries(option: EChartsOption): boolean {
|
|
235
|
+
const series = (option as Record<string, unknown>).series;
|
|
236
|
+
return Array.isArray(series) && series.some((item) => isRecord(item) && isPieSeries(item));
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* 判断 option 中是否包含雷达图系列。
|
|
241
|
+
* @param option - 当前 ECharts option
|
|
242
|
+
* @returns 当任意系列为 radar 时返回 true
|
|
243
|
+
*/
|
|
244
|
+
function optionHasRadarSeries(option: EChartsOption): boolean {
|
|
245
|
+
const series = (option as Record<string, unknown>).series;
|
|
246
|
+
return Array.isArray(series) && series.some((item) => isRecord(item) && isRadarSeries(item));
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* 判断 option 中是否包含漏斗图系列。
|
|
251
|
+
* @param option - 当前 ECharts option
|
|
252
|
+
* @returns 当任意系列为 funnel 时返回 true
|
|
253
|
+
*/
|
|
254
|
+
function optionHasFunnelSeries(option: EChartsOption): boolean {
|
|
255
|
+
const series = (option as Record<string, unknown>).series;
|
|
256
|
+
return Array.isArray(series) && series.some((item) => isRecord(item) && isFunnelSeries(item));
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* 判断颜色值是否为透明色。
|
|
261
|
+
* @param value - 待判断的颜色值
|
|
262
|
+
* @returns 透明色返回 true
|
|
263
|
+
*/
|
|
264
|
+
function isTransparentColor(value: unknown): boolean {
|
|
265
|
+
const normalized = typeof value === 'string' ? value.trim().toLowerCase().replace(/\s+/gu, '') : '';
|
|
266
|
+
return normalized === 'transparent'
|
|
267
|
+
|| normalized === 'rgba(0,0,0,0)'
|
|
268
|
+
|| normalized === 'rgba(255,255,255,0)';
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* 判断 series option 是否为瀑布图透明占位柱。
|
|
273
|
+
* @param seriesDef - 候选 series option
|
|
274
|
+
* @returns 透明占位柱返回 true
|
|
275
|
+
*/
|
|
276
|
+
function isWaterfallHelperSeries(seriesDef: Record<string, unknown>): boolean {
|
|
277
|
+
if (seriesDef.type !== 'bar' || typeof seriesDef.stack !== 'string') return false;
|
|
278
|
+
const itemStyle = isRecord(seriesDef.itemStyle) ? seriesDef.itemStyle : {};
|
|
279
|
+
const emphasis = isRecord(seriesDef.emphasis) ? seriesDef.emphasis : {};
|
|
280
|
+
const emphasisItemStyle = isRecord(emphasis.itemStyle) ? emphasis.itemStyle : {};
|
|
281
|
+
return isTransparentColor(itemStyle.color)
|
|
282
|
+
|| isTransparentColor(itemStyle.borderColor)
|
|
283
|
+
|| isTransparentColor(emphasisItemStyle.color)
|
|
284
|
+
|| isTransparentColor(emphasisItemStyle.borderColor);
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* 将 series 值转换为瀑布图基线计算所需的数值。
|
|
289
|
+
* @param value - 运行时 series 单项值
|
|
290
|
+
* @returns 有效数值,无效时返回 0
|
|
291
|
+
*/
|
|
292
|
+
function waterfallNumber(value: unknown): number {
|
|
293
|
+
const raw = isRecord(value) && 'value' in value ? value.value : value;
|
|
294
|
+
const parsed = typeof raw === 'string' && raw.trim() ? Number(raw) : raw;
|
|
295
|
+
return typeof parsed === 'number' && Number.isFinite(parsed) ? Math.max(0, parsed) : 0;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* 计算瀑布图透明 helper 的累计基线。
|
|
300
|
+
* @param values - 可见柱体数值
|
|
301
|
+
* @returns helper series 数据
|
|
302
|
+
*/
|
|
303
|
+
function waterfallHelperValues(values: unknown[]): number[] {
|
|
304
|
+
let cumulative = 0;
|
|
305
|
+
return values.map((value, index) => {
|
|
306
|
+
const baseline = index === 0 ? 0 : cumulative;
|
|
307
|
+
cumulative += waterfallNumber(value);
|
|
308
|
+
return baseline;
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* 为旧瀑布图协议把单条真实 series 映射到可见柱体,同时给透明 helper 填充基线。
|
|
314
|
+
* @param optionSeries - 当前 ECharts series option
|
|
315
|
+
* @param runtimeSeries - 运行时真实 series 数据
|
|
316
|
+
* @returns 已修复的瀑布图 series;不适用时返回 undefined
|
|
317
|
+
*/
|
|
318
|
+
function mergeLegacyWaterfallSeries(
|
|
319
|
+
optionSeries: unknown[],
|
|
320
|
+
runtimeSeries: NormalizedSeriesItem[],
|
|
321
|
+
): Array<Record<string, unknown>> | undefined {
|
|
322
|
+
if (runtimeSeries.length !== 1) return undefined;
|
|
323
|
+
const seriesOptions = optionSeries.filter(isRecord);
|
|
324
|
+
if (seriesOptions.length !== optionSeries.length) return undefined;
|
|
325
|
+
const helperIndex = seriesOptions.findIndex(isWaterfallHelperSeries);
|
|
326
|
+
if (helperIndex < 0) return undefined;
|
|
327
|
+
const helper = seriesOptions[helperIndex];
|
|
328
|
+
const helperStack = typeof helper.stack === 'string' ? helper.stack : undefined;
|
|
329
|
+
const visibleIndex = seriesOptions.findIndex((item, index) => (
|
|
330
|
+
index !== helperIndex
|
|
331
|
+
&& item.type === 'bar'
|
|
332
|
+
&& typeof item.stack === 'string'
|
|
333
|
+
&& item.stack === helperStack
|
|
334
|
+
&& !isWaterfallHelperSeries(item)
|
|
335
|
+
));
|
|
336
|
+
if (visibleIndex < 0) return undefined;
|
|
337
|
+
|
|
338
|
+
const runtime = runtimeSeries[0];
|
|
339
|
+
return seriesOptions.map((seriesDef, index) => {
|
|
340
|
+
if (index === helperIndex) {
|
|
341
|
+
return {
|
|
342
|
+
...seriesDef,
|
|
343
|
+
data: waterfallHelperValues(runtime.data),
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
if (index === visibleIndex) {
|
|
347
|
+
return {
|
|
348
|
+
...seriesDef,
|
|
349
|
+
data: runtime.data,
|
|
350
|
+
name: runtime.name,
|
|
351
|
+
};
|
|
352
|
+
}
|
|
353
|
+
return seriesDef;
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* 保留图例已有样式,仅补充图例展示项。
|
|
359
|
+
* @param option - 待更新的 ECharts option
|
|
360
|
+
* @param names - 图例名称列表
|
|
361
|
+
*/
|
|
362
|
+
function applyLegendData(option: EChartsOption, names: string[]): void {
|
|
363
|
+
if (names.length === 0) return;
|
|
364
|
+
|
|
365
|
+
const mutable = option as Record<string, unknown>;
|
|
366
|
+
const legend = mutable.legend;
|
|
367
|
+
|
|
368
|
+
if (Array.isArray(legend)) {
|
|
369
|
+
mutable.legend = legend.map((item, index) => (
|
|
370
|
+
index === 0 && isRecord(item) ? { ...item, data: names } : item
|
|
371
|
+
));
|
|
372
|
+
return;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
if (legend === false) return;
|
|
376
|
+
mutable.legend = isRecord(legend) ? { ...legend, data: names } : { data: names };
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* 保留 x 轴已有样式,仅补充类目数据。
|
|
381
|
+
* @param option - 待更新的 ECharts option
|
|
382
|
+
* @param categories - x 轴类目标签
|
|
383
|
+
*/
|
|
384
|
+
function applyXAxisData(option: EChartsOption, categories: string[]): void {
|
|
385
|
+
const mutable = option as Record<string, unknown>;
|
|
386
|
+
const xAxis = mutable.xAxis;
|
|
387
|
+
|
|
388
|
+
if (Array.isArray(xAxis)) {
|
|
389
|
+
mutable.xAxis = xAxis.map((axis, index) => (
|
|
390
|
+
index === 0 && isRecord(axis) ? { ...axis, data: categories } : axis
|
|
391
|
+
));
|
|
392
|
+
return;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
if (isRecord(xAxis)) {
|
|
396
|
+
mutable.xAxis = { ...xAxis, data: categories };
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
/**
|
|
401
|
+
* 判断 x 轴配置是否为时间轴。
|
|
402
|
+
* @param axis - 候选 xAxis 配置。
|
|
403
|
+
* @returns 时间轴返回 true。
|
|
404
|
+
*/
|
|
405
|
+
function isTimeAxis(axis: unknown): axis is Record<string, unknown> {
|
|
406
|
+
return isRecord(axis) && axis.type === 'time';
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
/**
|
|
410
|
+
* 判断 option 是否包含时间 x 轴。
|
|
411
|
+
* @param option - 当前 ECharts option。
|
|
412
|
+
* @returns 包含时间 x 轴返回 true。
|
|
413
|
+
*/
|
|
414
|
+
function optionHasTimeXAxis(option: EChartsOption): boolean {
|
|
415
|
+
const xAxis = (option as Record<string, unknown>).xAxis;
|
|
416
|
+
return Array.isArray(xAxis) ? xAxis.some(isTimeAxis) : isTimeAxis(xAxis);
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
/**
|
|
420
|
+
* 判断类目标签是否可以作为 ECharts time 轴值。
|
|
421
|
+
* @param value - 类目标签。
|
|
422
|
+
* @returns 时间类目返回 true。
|
|
423
|
+
*/
|
|
424
|
+
function isTimeLikeCategory(value: string): boolean {
|
|
425
|
+
const text = value.trim();
|
|
426
|
+
if (!text) return false;
|
|
427
|
+
if (/^\d{10,13}$/u.test(text)) return true;
|
|
428
|
+
if (!/(?:^\d{4}(?:[-/]\d{1,2})?|T\d{2}:\d{2}|\d{1,2}:\d{2})/u.test(text)) return false;
|
|
429
|
+
return Number.isFinite(Date.parse(text));
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
/**
|
|
433
|
+
* 判断所有运行时类目是否都适合 time 轴。
|
|
434
|
+
* @param categories - 运行时类目标签。
|
|
435
|
+
* @returns 全部为时间类目返回 true。
|
|
436
|
+
*/
|
|
437
|
+
function hasRuntimeTimeCategories(categories: string[]): boolean {
|
|
438
|
+
return categories.length > 0 && categories.every(isTimeLikeCategory);
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
/**
|
|
442
|
+
* 对运行时 x 轴类型做归一化,避免非时间类目被 time 轴解析成 1970。
|
|
443
|
+
* @param option - 当前 ECharts option。
|
|
444
|
+
* @param categories - 运行时类目标签。
|
|
445
|
+
* @returns 运行时 x 轴类型。
|
|
446
|
+
*/
|
|
447
|
+
function applyRuntimeXAxisData(option: EChartsOption, categories: string[]): 'time' | 'category' {
|
|
448
|
+
if (!optionHasTimeXAxis(option)) {
|
|
449
|
+
applyXAxisData(option, categories);
|
|
450
|
+
return 'category';
|
|
451
|
+
}
|
|
452
|
+
if (hasRuntimeTimeCategories(categories)) {
|
|
453
|
+
applyTimeXAxis(option);
|
|
454
|
+
return 'time';
|
|
455
|
+
}
|
|
456
|
+
applyCategoryXAxis(option, categories);
|
|
457
|
+
return 'category';
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
/**
|
|
461
|
+
* 保留官方 time 轴配置,但移除 category 轴专用 data。
|
|
462
|
+
* @param option - 当前 ECharts option。
|
|
463
|
+
*/
|
|
464
|
+
function applyTimeXAxis(option: EChartsOption): void {
|
|
465
|
+
const mutable = option as Record<string, unknown>;
|
|
466
|
+
const xAxis = mutable.xAxis;
|
|
467
|
+
const normalize = (axis: unknown): unknown => {
|
|
468
|
+
if (!isRecord(axis)) return axis;
|
|
469
|
+
const { data: _data, ...rest } = axis;
|
|
470
|
+
return { ...rest, type: 'time' };
|
|
471
|
+
};
|
|
472
|
+
mutable.xAxis = Array.isArray(xAxis) ? xAxis.map(normalize) : normalize(xAxis);
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
/**
|
|
476
|
+
* 将不兼容的 time 轴模板降级为 category 轴以展示真实分类标签。
|
|
477
|
+
* @param option - 当前 ECharts option。
|
|
478
|
+
* @param categories - 运行时类目标签。
|
|
479
|
+
*/
|
|
480
|
+
function applyCategoryXAxis(option: EChartsOption, categories: string[]): void {
|
|
481
|
+
const mutable = option as Record<string, unknown>;
|
|
482
|
+
const xAxis = mutable.xAxis;
|
|
483
|
+
const normalize = (axis: unknown, index = 0): unknown => (
|
|
484
|
+
index === 0 && isRecord(axis) ? { ...axis, type: 'category', data: categories } : axis
|
|
485
|
+
);
|
|
486
|
+
mutable.xAxis = Array.isArray(xAxis)
|
|
487
|
+
? xAxis.map((axis, index) => normalize(axis, index))
|
|
488
|
+
: isRecord(xAxis)
|
|
489
|
+
? normalize(xAxis)
|
|
490
|
+
: { type: 'category', data: categories };
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
/**
|
|
494
|
+
* 将 time 轴类目与数值配对成 ECharts time series 数据。
|
|
495
|
+
* @param series - 匹配到的运行时 series。
|
|
496
|
+
* @param categories - 时间类目标签。
|
|
497
|
+
* @returns `[time, value]` 数据项列表。
|
|
498
|
+
*/
|
|
499
|
+
function buildTimeAxisData(series: NormalizedSeriesItem, categories: string[]): unknown[] {
|
|
500
|
+
return series.data.map((value, index) => {
|
|
501
|
+
const pointValue = isRecord(value) && 'value' in value ? value.value : value;
|
|
502
|
+
if (isRecord(value)) return { ...value, value: [categories[index], pointValue] };
|
|
503
|
+
return [categories[index], value];
|
|
504
|
+
});
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
/**
|
|
508
|
+
* 将类目和数值序列转换为饼图需要的 name/value 切片。
|
|
509
|
+
* @param series - 匹配到的协议系列数据
|
|
510
|
+
* @param categories - 切片名称来源
|
|
511
|
+
* @returns ECharts pie series.data
|
|
512
|
+
*/
|
|
513
|
+
function buildPieData(series: NormalizedSeriesItem, categories: string[]): unknown[] {
|
|
514
|
+
if (series.data.every(isRecord)) {
|
|
515
|
+
return series.data.map((item, index) => ({
|
|
516
|
+
...item,
|
|
517
|
+
name: typeof item.name === 'string' && item.name.trim()
|
|
518
|
+
? item.name.trim()
|
|
519
|
+
: categories[index] || series.name || `item-${index + 1}`,
|
|
520
|
+
value: 'value' in item ? item.value : 0,
|
|
521
|
+
}));
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
return series.data.map((value, index) => ({
|
|
525
|
+
name: categories[index] || `item-${index + 1}`,
|
|
526
|
+
value,
|
|
527
|
+
}));
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
/**
|
|
531
|
+
* 将类目和数值序列转换为漏斗图需要的 name/value 阶段数据。
|
|
532
|
+
* @param series - 匹配到的协议系列数据
|
|
533
|
+
* @param categories - 漏斗阶段名称来源
|
|
534
|
+
* @returns ECharts funnel series.data
|
|
535
|
+
*/
|
|
536
|
+
function buildFunnelData(series: NormalizedSeriesItem, categories: string[]): unknown[] {
|
|
537
|
+
return buildPieData(series, categories);
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
/**
|
|
541
|
+
* Converts a radar series into the single-polygon data shape expected by ECharts.
|
|
542
|
+
* @param series - Matched protocol series.
|
|
543
|
+
* @returns Radar series data.
|
|
544
|
+
*/
|
|
545
|
+
function buildRadarData(series: NormalizedSeriesItem): unknown[] {
|
|
546
|
+
return [{
|
|
547
|
+
name: series.name,
|
|
548
|
+
value: series.data.map((value) => {
|
|
549
|
+
const rawValue = isRecord(value) && 'value' in value ? value.value : value;
|
|
550
|
+
const parsed = typeof rawValue === 'string' && rawValue.trim() ? Number(rawValue) : rawValue;
|
|
551
|
+
return typeof parsed === 'number' && Number.isFinite(parsed) ? parsed : 0;
|
|
552
|
+
}),
|
|
553
|
+
}];
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
/**
|
|
557
|
+
* 读取对象型展示配置,忽略后端 boolean 简写。
|
|
558
|
+
* @param value - presentation 中的配置值
|
|
559
|
+
* @returns 可合入 ECharts option 的对象配置
|
|
560
|
+
*/
|
|
561
|
+
function presentationObject(value: unknown): Record<string, unknown> {
|
|
562
|
+
return isRecord(value) ? value : {};
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
/**
|
|
566
|
+
* Series 协议转换器,处理标准笛卡尔坐标系和径向坐标系图表。
|
|
567
|
+
*/
|
|
568
|
+
export const seriesConverter: ProtocolConverter = {
|
|
569
|
+
/**
|
|
570
|
+
* 根据协议配置构建 ECharts option 骨架。
|
|
571
|
+
* @param config - 协议配置载荷,包含系列定义和展示配置
|
|
572
|
+
* @returns 包含标题、提示框、图例、坐标轴和空系列的 ECharts option
|
|
573
|
+
*/
|
|
574
|
+
buildOption(config: ProtocolConfigPayload): EChartsOption {
|
|
575
|
+
const hasPieSeries = config.series.some((def) => def.type === 'pie');
|
|
576
|
+
const hasRadarSeries = config.series.some((def) => def.type === 'radar');
|
|
577
|
+
const hasFunnelSeries = config.series.some((def) => def.type === 'funnel');
|
|
578
|
+
|
|
579
|
+
if (hasPieSeries) {
|
|
580
|
+
const pieOption: EChartsOption = {
|
|
581
|
+
title: {
|
|
582
|
+
text: config.chart.title,
|
|
583
|
+
},
|
|
584
|
+
tooltip: {
|
|
585
|
+
trigger: 'item',
|
|
586
|
+
...presentationObject(config.presentation.tooltip),
|
|
587
|
+
},
|
|
588
|
+
legend: presentationObject(config.presentation.legend),
|
|
589
|
+
series: config.series.map((def) => ({
|
|
590
|
+
id: def.id,
|
|
591
|
+
type: def.type,
|
|
592
|
+
radius: ['42%', '68%'],
|
|
593
|
+
data: [],
|
|
594
|
+
})) as any[],
|
|
595
|
+
};
|
|
596
|
+
|
|
597
|
+
if (config.optionPatch) {
|
|
598
|
+
Object.assign(pieOption, config.optionPatch);
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
return pieOption;
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
if (hasRadarSeries) {
|
|
605
|
+
const radarOption: EChartsOption = {
|
|
606
|
+
title: {
|
|
607
|
+
text: config.chart.title,
|
|
608
|
+
},
|
|
609
|
+
tooltip: {
|
|
610
|
+
trigger: 'item',
|
|
611
|
+
...presentationObject(config.presentation.tooltip),
|
|
612
|
+
},
|
|
613
|
+
legend: presentationObject(config.presentation.legend),
|
|
614
|
+
radar: {
|
|
615
|
+
indicator: [],
|
|
616
|
+
radius: '68%',
|
|
617
|
+
},
|
|
618
|
+
series: config.series.map((def) => ({
|
|
619
|
+
id: def.id,
|
|
620
|
+
type: def.type,
|
|
621
|
+
data: [],
|
|
622
|
+
})) as any[],
|
|
623
|
+
};
|
|
624
|
+
|
|
625
|
+
if (config.optionPatch) {
|
|
626
|
+
Object.assign(radarOption, config.optionPatch);
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
return radarOption;
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
if (hasFunnelSeries) {
|
|
633
|
+
const funnelOption: EChartsOption = {
|
|
634
|
+
title: {
|
|
635
|
+
text: config.chart.title,
|
|
636
|
+
},
|
|
637
|
+
tooltip: {
|
|
638
|
+
trigger: 'item',
|
|
639
|
+
...presentationObject(config.presentation.tooltip),
|
|
640
|
+
},
|
|
641
|
+
legend: presentationObject(config.presentation.legend),
|
|
642
|
+
series: config.series.map((def) => ({
|
|
643
|
+
id: def.id,
|
|
644
|
+
type: def.type,
|
|
645
|
+
data: [],
|
|
646
|
+
})) as any[],
|
|
647
|
+
};
|
|
648
|
+
|
|
649
|
+
if (config.optionPatch) {
|
|
650
|
+
Object.assign(funnelOption, config.optionPatch);
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
return funnelOption;
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
const option: EChartsOption = {
|
|
657
|
+
title: {
|
|
658
|
+
text: config.chart.title,
|
|
659
|
+
},
|
|
660
|
+
tooltip: {
|
|
661
|
+
trigger: 'axis',
|
|
662
|
+
...presentationObject(config.presentation.tooltip),
|
|
663
|
+
},
|
|
664
|
+
legend: presentationObject(config.presentation.legend),
|
|
665
|
+
xAxis: {
|
|
666
|
+
type: 'category',
|
|
667
|
+
},
|
|
668
|
+
yAxis: {
|
|
669
|
+
type: 'value',
|
|
670
|
+
},
|
|
671
|
+
// SeriesDef.type 为通用 string,需断言为 any 以满足 ECharts SeriesOption 字面量联合类型。
|
|
672
|
+
series: config.series.map((def) => ({
|
|
673
|
+
id: def.id,
|
|
674
|
+
type: def.type,
|
|
675
|
+
data: [],
|
|
676
|
+
})) as any[],
|
|
677
|
+
};
|
|
678
|
+
|
|
679
|
+
if (config.optionPatch) {
|
|
680
|
+
Object.assign(option, config.optionPatch);
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
return option;
|
|
684
|
+
},
|
|
685
|
+
|
|
686
|
+
/**
|
|
687
|
+
* 将数据载荷合并到已有的 ECharts option 中。
|
|
688
|
+
* @param option - 已有的 ECharts option
|
|
689
|
+
* @param data - 协议数据载荷,包含类别和系列数值
|
|
690
|
+
* @returns 更新后的 ECharts option
|
|
691
|
+
*/
|
|
692
|
+
mergeData(option: EChartsOption, data: ProtocolDataPayload): EChartsOption {
|
|
693
|
+
const seriesData = normalizeSeriesPayload(data);
|
|
694
|
+
const merged = { ...option };
|
|
695
|
+
const isPieChart = optionHasPieSeries(merged);
|
|
696
|
+
const isRadarChart = optionHasRadarSeries(merged);
|
|
697
|
+
const isFunnelChart = optionHasFunnelSeries(merged);
|
|
698
|
+
let cartesianXAxisKind: 'time' | 'category' = 'category';
|
|
699
|
+
|
|
700
|
+
if (!isPieChart && !isRadarChart && !isFunnelChart) {
|
|
701
|
+
cartesianXAxisKind = applyRuntimeXAxisData(merged, seriesData.categories);
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
if (Array.isArray(merged.series)) {
|
|
705
|
+
const legacyWaterfallSeries = !isPieChart && !isRadarChart && !isFunnelChart
|
|
706
|
+
? mergeLegacyWaterfallSeries(merged.series, seriesData.series)
|
|
707
|
+
: undefined;
|
|
708
|
+
merged.series = legacyWaterfallSeries ?? merged.series.map((s, index) => {
|
|
709
|
+
const seriesDef = s as Record<string, unknown>;
|
|
710
|
+
const seriesId = (seriesDef.id as string) || `series-${index + 1}`;
|
|
711
|
+
const matched = seriesData.series.find(
|
|
712
|
+
(item) => item.id === seriesId,
|
|
713
|
+
) || seriesData.series[index];
|
|
714
|
+
|
|
715
|
+
if (!matched) return seriesDef;
|
|
716
|
+
|
|
717
|
+
if (isPieSeries(seriesDef)) {
|
|
718
|
+
return {
|
|
719
|
+
...seriesDef,
|
|
720
|
+
data: buildPieData(matched, seriesData.categories),
|
|
721
|
+
name: matched.name,
|
|
722
|
+
};
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
if (isRadarSeries(seriesDef)) {
|
|
726
|
+
return {
|
|
727
|
+
...seriesDef,
|
|
728
|
+
data: buildRadarData(matched),
|
|
729
|
+
name: matched.name,
|
|
730
|
+
};
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
if (isFunnelSeries(seriesDef)) {
|
|
734
|
+
return {
|
|
735
|
+
...seriesDef,
|
|
736
|
+
data: buildFunnelData(matched, seriesData.categories),
|
|
737
|
+
name: matched.name,
|
|
738
|
+
};
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
return {
|
|
742
|
+
...seriesDef,
|
|
743
|
+
data: cartesianXAxisKind === 'time'
|
|
744
|
+
? buildTimeAxisData(matched, seriesData.categories)
|
|
745
|
+
: matched.data,
|
|
746
|
+
name: matched.name,
|
|
747
|
+
};
|
|
748
|
+
});
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
if (isPieChart) {
|
|
752
|
+
const mutable = merged as Record<string, unknown>;
|
|
753
|
+
delete mutable.xAxis;
|
|
754
|
+
delete mutable.yAxis;
|
|
755
|
+
const pieLegendData = Array.isArray(merged.series)
|
|
756
|
+
? merged.series.flatMap((item) => (
|
|
757
|
+
isRecord(item) && Array.isArray(item.data)
|
|
758
|
+
? item.data.filter(isRecord).flatMap((slice) => (
|
|
759
|
+
typeof slice.name === 'string' && slice.name.trim() ? [slice.name.trim()] : []
|
|
760
|
+
))
|
|
761
|
+
: []
|
|
762
|
+
))
|
|
763
|
+
: [];
|
|
764
|
+
applyLegendData(merged, pieLegendData);
|
|
765
|
+
} else if (isRadarChart) {
|
|
766
|
+
const mutable = merged as Record<string, unknown>;
|
|
767
|
+
delete mutable.xAxis;
|
|
768
|
+
delete mutable.yAxis;
|
|
769
|
+
const radar = mutable.radar;
|
|
770
|
+
mutable.radar = isRecord(radar)
|
|
771
|
+
? { ...radar, indicator: seriesData.indicators }
|
|
772
|
+
: { indicator: seriesData.indicators };
|
|
773
|
+
applyLegendData(
|
|
774
|
+
merged,
|
|
775
|
+
seriesData.series.flatMap((item) => (item.name ? [item.name] : [])),
|
|
776
|
+
);
|
|
777
|
+
} else if (isFunnelChart) {
|
|
778
|
+
const mutable = merged as Record<string, unknown>;
|
|
779
|
+
delete mutable.xAxis;
|
|
780
|
+
delete mutable.yAxis;
|
|
781
|
+
delete mutable.grid;
|
|
782
|
+
applyLegendData(
|
|
783
|
+
merged,
|
|
784
|
+
seriesData.series.flatMap((item) => (item.name ? [item.name] : [])),
|
|
785
|
+
);
|
|
786
|
+
} else {
|
|
787
|
+
applyLegendData(
|
|
788
|
+
merged,
|
|
789
|
+
seriesData.series.flatMap((item) => (item.name ? [item.name] : [])),
|
|
790
|
+
);
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
return merged;
|
|
794
|
+
},
|
|
795
|
+
};
|