@fses/workbench-app 0.2.0 → 0.2.2
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-fYH2XNdb.js +22699 -0
- package/dist/fses-workbench-app.js +2 -2
- package/dist/{index-DbH6tMQy.js → index-CbIJlts1.js} +8 -8
- package/dist/internal/personal-workbench/components/workbench/WorkbenchStudio.vue.d.ts +2 -2
- package/dist/internal/personal-workbench/lib/deepAgentApi.d.ts +41 -2
- package/dist/internal/personal-workbench/lib/deepAgentQueueState.d.ts +111 -0
- package/dist/internal/personal-workbench/lib/vueRuntimeAdapters.d.ts +72 -0
- package/dist/internal/personal-workbench/lib/workbenchSocketClient.d.ts +1 -1
- package/dist/internal/personal-workbench/lib/workbenchStorage.d.ts +2 -0
- package/dist/runtime/index.js +1 -1
- package/dist/style.css +1 -1
- package/dist/{useWorkbenchRuntime-XpOzwm56.js → useWorkbenchRuntime-Ch8lqkjO.js} +6707 -6315
- 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 +33742 -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 +2011 -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 +83 -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.js +19950 -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 +1096 -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 +3209 -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 +2496 -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 +99 -104
- package/dist/Workspace-DMye5DU8.js +0 -43113
|
@@ -0,0 +1,1096 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview 原生卡片绑定 - 提供表单、问卷、指标、列表、天气和普通图表 helper。
|
|
3
|
+
* @author seadon
|
|
4
|
+
* @created 2026-05-20
|
|
5
|
+
*/
|
|
6
|
+
import type { Component } from 'vue';
|
|
7
|
+
import type {
|
|
8
|
+
ActionGroupData,
|
|
9
|
+
BlockVisualOptions,
|
|
10
|
+
CategoryRankingData,
|
|
11
|
+
CustomCanvasData,
|
|
12
|
+
DisplayBlockData,
|
|
13
|
+
FormBlockData,
|
|
14
|
+
FormField,
|
|
15
|
+
MetricSummaryData,
|
|
16
|
+
ReportBlockData,
|
|
17
|
+
SurveyBlockData,
|
|
18
|
+
TableRowsData,
|
|
19
|
+
TaskSummaryData,
|
|
20
|
+
WeatherCurrentData,
|
|
21
|
+
WorkbenchBlock,
|
|
22
|
+
WorkflowBlockData,
|
|
23
|
+
} from '../../types';
|
|
24
|
+
import type { WorkbenchBlockRendererProps } from '../useWorkbenchBlockRendererBindings';
|
|
25
|
+
import {
|
|
26
|
+
imageTableColumnVisible,
|
|
27
|
+
structuredTableCellText,
|
|
28
|
+
visibleImageTableColumns,
|
|
29
|
+
} from '../tableDisplay';
|
|
30
|
+
|
|
31
|
+
type NativeBindingsContext = {
|
|
32
|
+
props: WorkbenchBlockRendererProps;
|
|
33
|
+
formValuesByBlock: Record<string, Record<string, unknown>>;
|
|
34
|
+
surveyAnswersByBlock: Record<string, Record<string, unknown>>;
|
|
35
|
+
formatMetricValue: (value: number, format?: string) => string;
|
|
36
|
+
isRecord: (value: unknown) => value is Record<string, unknown>;
|
|
37
|
+
dataBindingNeedsHumanIntervention: () => (block: WorkbenchBlock) => boolean;
|
|
38
|
+
imageComposeAlertRankingCard: () => (block: WorkbenchBlock, data: CategoryRankingData) => boolean;
|
|
39
|
+
imageComposeCompactCard: () => (block: WorkbenchBlock) => boolean;
|
|
40
|
+
imageComposeBusinessGapBadgeLabel: () => (block: WorkbenchBlock) => string;
|
|
41
|
+
referenceCompositeLooksLikeChairmanRiskDirectContext: () => (block: WorkbenchBlock, data: CustomCanvasData) => boolean;
|
|
42
|
+
CircleCheck: Component;
|
|
43
|
+
UserRound: Component;
|
|
44
|
+
LayoutDashboard: Component;
|
|
45
|
+
Bot: Component;
|
|
46
|
+
CloudRain: Component;
|
|
47
|
+
CloudSun: Component;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
type ImageComposeMetricLeadingVisualKind = 'icon' | 'bars' | 'sparkline';
|
|
51
|
+
type ImageComposeChartPreviewKind = 'line' | 'bar' | 'mixed' | 'donut';
|
|
52
|
+
type ImageComposeChartPreviewBar = {
|
|
53
|
+
x: number;
|
|
54
|
+
y: number;
|
|
55
|
+
width: number;
|
|
56
|
+
height: number;
|
|
57
|
+
fill: string;
|
|
58
|
+
opacity: number;
|
|
59
|
+
label: string;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const IMAGE_COMPOSE_CHART_PREVIEW_MIN_BAR_COUNT = 4;
|
|
63
|
+
|
|
64
|
+
export interface ImageComposeChartPreviewHeader {
|
|
65
|
+
label: string;
|
|
66
|
+
metric: string;
|
|
67
|
+
status: string;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Reads a table row as a loose record for image-composed fallback data.
|
|
72
|
+
* @param row - Candidate row payload.
|
|
73
|
+
* @returns Row record, or an empty record.
|
|
74
|
+
*/
|
|
75
|
+
function tableRowRecord(row: unknown): Record<string, unknown> {
|
|
76
|
+
return row && typeof row === 'object' && !Array.isArray(row)
|
|
77
|
+
? row as Record<string, unknown>
|
|
78
|
+
: {};
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Converts an unknown table value into display text.
|
|
83
|
+
* @param value - Candidate cell value.
|
|
84
|
+
* @returns Stable visible text for a table cell.
|
|
85
|
+
*/
|
|
86
|
+
function tableCellText(value: unknown): string {
|
|
87
|
+
return structuredTableCellText(value);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Resolves display columns for normal rows and object-row image fallbacks.
|
|
92
|
+
* @param columns - Optional declared table columns.
|
|
93
|
+
* @param rows - Table rows that may omit cells and columns.
|
|
94
|
+
* @returns Columns safe for rendering.
|
|
95
|
+
*/
|
|
96
|
+
export function tableColumnsFromRows(columns: unknown, rows: unknown): string[] {
|
|
97
|
+
const declaredColumns = visibleImageTableColumns(columns);
|
|
98
|
+
if (declaredColumns.length > 0) return declaredColumns;
|
|
99
|
+
const objectRows = Array.isArray(rows)
|
|
100
|
+
? rows.map(tableRowRecord).filter((row) => Object.keys(row).some(imageTableColumnVisible))
|
|
101
|
+
: [];
|
|
102
|
+
const firstObjectRow = objectRows[0];
|
|
103
|
+
if (!firstObjectRow) return [];
|
|
104
|
+
const firstColumns = Object.keys(firstObjectRow).filter(imageTableColumnVisible);
|
|
105
|
+
const usesStableColumns = objectRows.every((row) => {
|
|
106
|
+
const rowColumns = Object.keys(row).filter(imageTableColumnVisible);
|
|
107
|
+
return rowColumns.length === firstColumns.length
|
|
108
|
+
&& rowColumns.every((column, index) => column === firstColumns[index]);
|
|
109
|
+
});
|
|
110
|
+
// 异构对象行无法共享真实列头,统一降级为逐行键值摘要,避免后续行错列或整行空白。
|
|
111
|
+
return usesStableColumns ? firstColumns.slice(0, 3) : ['字段', '内容'];
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Resolves visible cells from a declared row.cells array or key-value object row fallback.
|
|
116
|
+
* @param row - Table row payload.
|
|
117
|
+
* @param columns - Visible table columns.
|
|
118
|
+
* @returns Cell texts safe for Vue template iteration.
|
|
119
|
+
*/
|
|
120
|
+
export function tableRowCells(row: unknown, columns: string[]): string[] {
|
|
121
|
+
const record = tableRowRecord(row);
|
|
122
|
+
const cells = record.cells;
|
|
123
|
+
if (Array.isArray(cells)) {
|
|
124
|
+
return cells.slice(0, columns.length).map(tableCellText);
|
|
125
|
+
}
|
|
126
|
+
const usesKeyValueFallback = columns.length === 2
|
|
127
|
+
&& columns[0] === '字段'
|
|
128
|
+
&& columns[1] === '内容'
|
|
129
|
+
&& !columns.every((column) => Object.prototype.hasOwnProperty.call(record, column));
|
|
130
|
+
const entries = Object.entries(record)
|
|
131
|
+
.filter(([key]) => imageTableColumnVisible(key))
|
|
132
|
+
.map(([key, value]) => {
|
|
133
|
+
const text = tableCellText(value);
|
|
134
|
+
return usesKeyValueFallback && text ? `${key}:${text}` : text;
|
|
135
|
+
})
|
|
136
|
+
.filter(Boolean);
|
|
137
|
+
return entries.slice(0, columns.length);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Creates native card helpers used by WorkbenchBlockRenderer.
|
|
142
|
+
* @param context - Shared renderer state and utilities.
|
|
143
|
+
* @returns Native renderer helper functions.
|
|
144
|
+
*/
|
|
145
|
+
export function createNativeBindings(context: NativeBindingsContext) {
|
|
146
|
+
const {
|
|
147
|
+
props,
|
|
148
|
+
formValuesByBlock,
|
|
149
|
+
surveyAnswersByBlock,
|
|
150
|
+
formatMetricValue,
|
|
151
|
+
isRecord,
|
|
152
|
+
dataBindingNeedsHumanIntervention,
|
|
153
|
+
imageComposeAlertRankingCard,
|
|
154
|
+
imageComposeCompactCard,
|
|
155
|
+
imageComposeBusinessGapBadgeLabel,
|
|
156
|
+
referenceCompositeLooksLikeChairmanRiskDirectContext,
|
|
157
|
+
CircleCheck,
|
|
158
|
+
UserRound,
|
|
159
|
+
LayoutDashboard,
|
|
160
|
+
Bot,
|
|
161
|
+
CloudRain,
|
|
162
|
+
CloudSun,
|
|
163
|
+
} = context;
|
|
164
|
+
|
|
165
|
+
function isFormBlockData(value: unknown): value is FormBlockData {
|
|
166
|
+
return Boolean(value && typeof value === 'object' && Array.isArray((value as FormBlockData).fields));
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
function isSurveyBlockData(value: unknown): value is SurveyBlockData {
|
|
170
|
+
return Boolean(value && typeof value === 'object' && Array.isArray((value as SurveyBlockData).questions));
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
function isActionGroupData(value: unknown): value is ActionGroupData {
|
|
174
|
+
return Boolean(value && typeof value === 'object' && Array.isArray((value as ActionGroupData).buttons));
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
function isWorkflowBlockData(value: unknown): value is WorkflowBlockData {
|
|
178
|
+
return Boolean(value && typeof value === 'object' && Array.isArray((value as WorkflowBlockData).steps));
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
function isReportBlockData(value: unknown): value is ReportBlockData {
|
|
182
|
+
return Boolean(value && typeof value === 'object' && Array.isArray((value as ReportBlockData).sections));
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
function textValue(value: unknown, fallback = '') {
|
|
186
|
+
return typeof value === 'string' && value.trim() ? value.trim() : fallback;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
function numberValue(value: unknown, fallback = 0) {
|
|
190
|
+
const numeric = Number(value);
|
|
191
|
+
return Number.isFinite(numeric) ? numeric : fallback;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
function listValue(value: unknown): Record<string, unknown>[] {
|
|
195
|
+
return Array.isArray(value) ? value.filter(isRecord) : [];
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
function metaRecord(block: WorkbenchBlock, key: string) {
|
|
199
|
+
const value = block.meta?.[key];
|
|
200
|
+
return isRecord(value) ? value : {};
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
function metaList(block: WorkbenchBlock, key: string) {
|
|
204
|
+
return listValue(block.meta?.[key]);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Reads the original image-grid width for a reconstructed image card.
|
|
209
|
+
* @param block - Rendered workbench block.
|
|
210
|
+
* @returns Image layout width when present.
|
|
211
|
+
*/
|
|
212
|
+
function imageComposeLayoutBasisWidth(block: WorkbenchBlock): number {
|
|
213
|
+
const basis = metaRecord(block, 'layoutBasis');
|
|
214
|
+
return numberValue(basis.w, numberValue(block.layout?.w, 0));
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
function welcomeBannerMetrics(block: WorkbenchBlock) {
|
|
218
|
+
return metaList(block, 'portalMetrics').map((metric) => ({
|
|
219
|
+
label: textValue(metric.label),
|
|
220
|
+
value: textValue(metric.value, String(metric.value ?? '--')),
|
|
221
|
+
hint: textValue(metric.hint),
|
|
222
|
+
}));
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
function tierKeyForDensity(density: 'thumbnail' | 'compact' | 'standard' | 'expanded') {
|
|
226
|
+
if (density === 'thumbnail' || density === 'compact') return 'compact';
|
|
227
|
+
return density;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
function applyResponsiveTier(block: WorkbenchBlock, density: 'thumbnail' | 'compact' | 'standard' | 'expanded'): WorkbenchBlock {
|
|
231
|
+
const tiers = block.meta?.responsiveContentTiers;
|
|
232
|
+
if (!tiers) return block;
|
|
233
|
+
const preferred = tiers[tierKeyForDensity(density)] || (density === 'expanded' ? tiers.standard || tiers.compact : density === 'standard' ? tiers.compact : undefined);
|
|
234
|
+
if (!preferred) return block;
|
|
235
|
+
return {
|
|
236
|
+
...block,
|
|
237
|
+
title: preferred.title || block.title,
|
|
238
|
+
subtitle: preferred.subtitle ?? block.subtitle,
|
|
239
|
+
subType: preferred.subType || block.subType,
|
|
240
|
+
renderer: preferred.renderer || block.renderer,
|
|
241
|
+
data: preferred.data || block.data,
|
|
242
|
+
meta: { ...block.meta, visual: { ...(block.meta?.visual || {}), ...(preferred.visual || {}) } },
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
function formValues(blockId: string) {
|
|
247
|
+
if (!formValuesByBlock[blockId]) formValuesByBlock[blockId] = {};
|
|
248
|
+
return formValuesByBlock[blockId];
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
function surveyAnswers(blockId: string) {
|
|
252
|
+
if (!surveyAnswersByBlock[blockId]) surveyAnswersByBlock[blockId] = {};
|
|
253
|
+
return surveyAnswersByBlock[blockId];
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* Applies density-aware list limits while tolerating optional list fields.
|
|
258
|
+
* @param items - Source list, or an empty value when the data shape omits optional details.
|
|
259
|
+
* @param thumbnail - Maximum items in thumbnail density.
|
|
260
|
+
* @param compact - Maximum items in compact density.
|
|
261
|
+
* @returns List trimmed for the current density.
|
|
262
|
+
*/
|
|
263
|
+
function compactLimit<T>(items: T[] | undefined | null, thumbnail: number, compact: number) {
|
|
264
|
+
// 部分业务数据只提供核心指标字段,缺省的明细列表按空列表渲染,避免整张卡片渲染中断。
|
|
265
|
+
const safeItems = Array.isArray(items) ? items : [];
|
|
266
|
+
if (props.density === 'thumbnail') return safeItems.slice(0, thumbnail);
|
|
267
|
+
if (props.density === 'compact') return safeItems.slice(0, compact);
|
|
268
|
+
return safeItems;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
function toggleMultiValue(currentValue: unknown, option: string) {
|
|
272
|
+
const values = Array.isArray(currentValue) ? currentValue.map(String) : [];
|
|
273
|
+
return values.includes(option) ? values.filter((item) => item !== option) : [...values, option];
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
function formCompletedCount(blockId: string, data: FormBlockData) {
|
|
277
|
+
const values = formValues(blockId);
|
|
278
|
+
return data.fields.filter((field) => {
|
|
279
|
+
const value = values[field.id];
|
|
280
|
+
return typeof value === 'string' ? value.trim().length > 0 : Boolean(value);
|
|
281
|
+
}).length;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
function renderFieldType(field: FormField) {
|
|
285
|
+
if (field.type === 'number' || field.type === 'currency') return 'number';
|
|
286
|
+
if (field.type === 'date') return 'date';
|
|
287
|
+
return 'text';
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
function updateMatrixAnswer(blockId: string, questionId: string, row: string, option: string) {
|
|
291
|
+
const answers = surveyAnswers(blockId);
|
|
292
|
+
const current = isRecord(answers[questionId]) ? answers[questionId] : {};
|
|
293
|
+
answers[questionId] = { ...current, [row]: option };
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
function matrixAnswerValue(blockId: string, questionId: string, row: string) {
|
|
297
|
+
const value = surveyAnswers(blockId)[questionId];
|
|
298
|
+
return isRecord(value) ? value[row] : undefined;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
function multipleAnswerIncludes(blockId: string, questionId: string, option: string) {
|
|
302
|
+
const value = surveyAnswers(blockId)[questionId];
|
|
303
|
+
return Array.isArray(value) && value.map(String).includes(option);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
function taskStatusClass(status: TaskSummaryData['items'][number]['status']) {
|
|
307
|
+
return {
|
|
308
|
+
pending: 'bg-amber-50 text-amber-700',
|
|
309
|
+
reading: 'bg-[#edf3ff] text-[#1f4fd4]',
|
|
310
|
+
submitted: 'bg-emerald-50 text-emerald-700',
|
|
311
|
+
overdue: 'bg-rose-50 text-rose-700',
|
|
312
|
+
done: 'bg-slate-100 text-slate-600',
|
|
313
|
+
}[status] || 'bg-slate-100 text-slate-600';
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
function taskTypeLabel(type: TaskSummaryData['items'][number]['type']) {
|
|
317
|
+
return { form: '表单', survey: '问卷', notice: '公告', document: '公文', workflow: '流程', custom: '定制' }[type] || type;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
function taskStatusLabel(status: TaskSummaryData['items'][number]['status']) {
|
|
321
|
+
return { pending: '待处理', reading: '待阅读', submitted: '已提交', overdue: '逾期', done: '完成' }[status] || status;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
const TABLE_ROWS_PREVIEW_VISUAL_KINDS = new Set([
|
|
325
|
+
'tableRecordList',
|
|
326
|
+
'tableCompactList',
|
|
327
|
+
'tableSummary',
|
|
328
|
+
'tableComparison',
|
|
329
|
+
'tableParameter',
|
|
330
|
+
'tableIndex',
|
|
331
|
+
'tablePartition',
|
|
332
|
+
'tableMapping',
|
|
333
|
+
'tableLevel',
|
|
334
|
+
'tableDescription',
|
|
335
|
+
'tableTimeline',
|
|
336
|
+
'tableSteps',
|
|
337
|
+
'tableMatrix',
|
|
338
|
+
'tableNested',
|
|
339
|
+
'identityDirectory',
|
|
340
|
+
'workflowApprovalList',
|
|
341
|
+
]);
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* Reads the supported rows preview visual kind.
|
|
345
|
+
* @param data - Candidate rows data.
|
|
346
|
+
* @param block - Rendered block, when available.
|
|
347
|
+
* @returns Supported preview visual kind, or an empty string.
|
|
348
|
+
*/
|
|
349
|
+
function tableRowsPreviewVisualKind(data: DisplayBlockData | undefined, block?: WorkbenchBlock): string {
|
|
350
|
+
if (!data || data.shape !== 'rows' || !isRecord(data)) return '';
|
|
351
|
+
const visualKind = textValue(data.visualKind);
|
|
352
|
+
if (TABLE_ROWS_PREVIEW_VISUAL_KINDS.has(visualKind)) return visualKind;
|
|
353
|
+
return tableRowsPreviewVisualKindFromCapability(data, block);
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
/**
|
|
357
|
+
* Checks whether rows data may use the system-card preview renderer.
|
|
358
|
+
* @param block - Rendered block.
|
|
359
|
+
* @param data - Candidate rows data.
|
|
360
|
+
* @returns True when the rows came from system preview/default canvas samples.
|
|
361
|
+
*/
|
|
362
|
+
function tableRowsPreviewCard(block: WorkbenchBlock, data: DisplayBlockData | undefined): boolean {
|
|
363
|
+
if (!tableRowsPreviewVisualKind(data, block)) return false;
|
|
364
|
+
const record: Record<string, unknown> = isRecord(data) ? data : {};
|
|
365
|
+
const sourceType = textValue(block.source?.sourceType);
|
|
366
|
+
const sourceLabel = textValue(record.sourceLabel);
|
|
367
|
+
return Boolean(block.meta?.systemCardPreview)
|
|
368
|
+
|| (sourceType === 'canvas_runtime' && sourceLabel === 'Canvas Runtime')
|
|
369
|
+
|| tableRowsPreviewCapabilityId(block, data).startsWith('card.table.');
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* Infers rows preview kind from an explicit registered table capability.
|
|
374
|
+
* @param data - Candidate rows data.
|
|
375
|
+
* @param block - Rendered block, when available.
|
|
376
|
+
* @returns Preview kind matching the table capability, or an empty string.
|
|
377
|
+
*/
|
|
378
|
+
function tableRowsPreviewVisualKindFromCapability(data: DisplayBlockData | undefined, block?: WorkbenchBlock): string {
|
|
379
|
+
const capabilityId = tableRowsPreviewCapabilityId(block, data);
|
|
380
|
+
if (!capabilityId.startsWith('card.table.')) return '';
|
|
381
|
+
const tableKind = capabilityId.slice('card.table.'.length);
|
|
382
|
+
const visualKind = `table${tableKind.slice(0, 1).toUpperCase()}${tableKind.slice(1)}`;
|
|
383
|
+
return TABLE_ROWS_PREVIEW_VISUAL_KINDS.has(visualKind) ? visualKind : '';
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
/**
|
|
387
|
+
* Reads the registered table capability from block metadata or rows data.
|
|
388
|
+
* @param block - Rendered block, when available.
|
|
389
|
+
* @param data - Candidate rows data.
|
|
390
|
+
* @returns Capability id, or an empty string.
|
|
391
|
+
*/
|
|
392
|
+
function tableRowsPreviewCapabilityId(block?: WorkbenchBlock, data?: DisplayBlockData): string {
|
|
393
|
+
const record: Record<string, unknown> = isRecord(data) ? data : {};
|
|
394
|
+
return textValue(block?.meta?.capabilityId)
|
|
395
|
+
|| textValue(record.capabilityId);
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
/**
|
|
399
|
+
* Converts rows data into column-addressable records for preview layouts.
|
|
400
|
+
* @param data - Candidate rows data.
|
|
401
|
+
* @returns Row records keyed by visible column.
|
|
402
|
+
*/
|
|
403
|
+
function tableRowsPreviewRecords(data: DisplayBlockData | undefined): Array<Record<string, string>> {
|
|
404
|
+
if (!data || data.shape !== 'rows') return [];
|
|
405
|
+
const rowsData = data as TableRowsData;
|
|
406
|
+
const columns = visibleImageTableColumns(rowsData.columns);
|
|
407
|
+
const rows = Array.isArray(rowsData.rows) ? rowsData.rows : [];
|
|
408
|
+
return rows.map((row, rowIndex) => {
|
|
409
|
+
const record: Record<string, string> = { id: textValue(row.id, `row-${rowIndex + 1}`) };
|
|
410
|
+
const rowRecord = tableRowRecord(row);
|
|
411
|
+
const cells = Array.isArray(rowRecord.cells) ? rowRecord.cells : [];
|
|
412
|
+
columns.forEach((column, columnIndex) => {
|
|
413
|
+
record[column] = structuredTableCellText(rowRecord[column] ?? cells[columnIndex]);
|
|
414
|
+
});
|
|
415
|
+
return record;
|
|
416
|
+
});
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
/**
|
|
420
|
+
* Reads one preview cell by column name.
|
|
421
|
+
* @param row - Row record.
|
|
422
|
+
* @param column - Column name.
|
|
423
|
+
* @returns Cell text.
|
|
424
|
+
*/
|
|
425
|
+
function tableRowsPreviewCell(row: Record<string, string>, column: string): string {
|
|
426
|
+
return row[column] || '';
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
/**
|
|
430
|
+
* Reads the primary text for timeline/steps rows while supporting two-column query results.
|
|
431
|
+
* @param row - Preview row record.
|
|
432
|
+
* @param columns - Visible columns.
|
|
433
|
+
* @returns Main timeline label.
|
|
434
|
+
*/
|
|
435
|
+
function tableRowsTimelinePrimaryCell(row: Record<string, string>, columns: string[]): string {
|
|
436
|
+
return tableRowsPreviewCell(row, columns.length > 2 ? columns[1] : columns[0]);
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
/**
|
|
440
|
+
* Reads the trailing badge text for timeline/steps rows while supporting two-column query results.
|
|
441
|
+
* @param row - Preview row record.
|
|
442
|
+
* @param columns - Visible columns.
|
|
443
|
+
* @returns Timeline badge text.
|
|
444
|
+
*/
|
|
445
|
+
function tableRowsTimelineBadgeCell(row: Record<string, string>, columns: string[]): string {
|
|
446
|
+
return tableRowsPreviewCell(row, columns.length > 2 ? columns[2] : columns[1]);
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
/**
|
|
450
|
+
* Builds stable grid columns for rows preview cards.
|
|
451
|
+
* @param columns - Visible columns.
|
|
452
|
+
* @returns Inline grid style.
|
|
453
|
+
*/
|
|
454
|
+
function tableRowsPreviewGridStyle(columns: string[]): Record<string, string> {
|
|
455
|
+
const count = Math.max(1, columns.length);
|
|
456
|
+
if (count === 3) return { gridTemplateColumns: '0.72fr minmax(0,1.1fr) 0.72fr' };
|
|
457
|
+
if (count === 4) return { gridTemplateColumns: '0.86fr repeat(3, minmax(0,1fr))' };
|
|
458
|
+
return { gridTemplateColumns: `repeat(${count}, minmax(0, 1fr))` };
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
function formatWeatherTemp(value: number | null | undefined) {
|
|
462
|
+
return typeof value === 'number' ? `${value}°C` : '--';
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
function weatherIcon(condition: WeatherCurrentData['condition']) {
|
|
466
|
+
return condition === 'rain' || condition === 'storm' || condition === 'snow' ? CloudRain : CloudSun;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
function isChartShape(data?: DisplayBlockData) {
|
|
470
|
+
return Boolean(data && [
|
|
471
|
+
'singleSeries',
|
|
472
|
+
'multiSeries',
|
|
473
|
+
'waterfallSteps',
|
|
474
|
+
'heatmapMatrix',
|
|
475
|
+
'pieSlices',
|
|
476
|
+
'radarMetrics',
|
|
477
|
+
'scatterPoints',
|
|
478
|
+
'funnelStages',
|
|
479
|
+
'gaugeMetric',
|
|
480
|
+
'mapRegions',
|
|
481
|
+
'sankeyFlow',
|
|
482
|
+
'treeHierarchy',
|
|
483
|
+
'ganttTasks',
|
|
484
|
+
'candlestickSeries',
|
|
485
|
+
'boxplotSeries',
|
|
486
|
+
'paretoSeries',
|
|
487
|
+
'networkGraph',
|
|
488
|
+
'echartsOption',
|
|
489
|
+
'echartsScript',
|
|
490
|
+
'protocolRender',
|
|
491
|
+
].includes(data.shape));
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
/**
|
|
495
|
+
* Checks whether an image-composed chart has no trustworthy data but still needs a screenshot-like preview.
|
|
496
|
+
* @param block - Rendered chart block.
|
|
497
|
+
* @param data - Current chart renderer data.
|
|
498
|
+
* @returns True when the body would otherwise be blank while the binding asks for business input.
|
|
499
|
+
*/
|
|
500
|
+
function imageComposeEmptyChartPreview(block: WorkbenchBlock, data?: DisplayBlockData): boolean {
|
|
501
|
+
if (!imageComposeCompactCard()(block) || !dataBindingNeedsHumanIntervention()(block) || !isRecord(data)) return false;
|
|
502
|
+
const shape = textValue(data.shape);
|
|
503
|
+
const series = data.series;
|
|
504
|
+
if (shape === 'singleSeries' || shape === 'multiSeries') return !Array.isArray(series) || series.length === 0;
|
|
505
|
+
return false;
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
/**
|
|
509
|
+
* Checks whether an image-composed chart should keep its screenshot-like visual shell.
|
|
510
|
+
* @param block - Rendered chart block.
|
|
511
|
+
* @param data - Current chart renderer data.
|
|
512
|
+
* @returns True when a chart originated from image reconstruction.
|
|
513
|
+
*/
|
|
514
|
+
function imageComposeChartPreview(block: WorkbenchBlock, data?: DisplayBlockData): boolean {
|
|
515
|
+
if (!imageComposeCompactCard()(block) || !isChartShape(data)) return false;
|
|
516
|
+
if (data?.shape === 'echartsOption' || data?.shape === 'echartsScript' || data?.shape === 'protocolRender') return false;
|
|
517
|
+
return true;
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
/**
|
|
521
|
+
* Chooses the small KPI visual from generic image layout and visual metadata.
|
|
522
|
+
* @param block - Rendered metric block.
|
|
523
|
+
* @returns Generic leading visual kind for the compact metric renderer.
|
|
524
|
+
*/
|
|
525
|
+
function imageComposeMetricLeadingVisualKind(block: WorkbenchBlock): ImageComposeMetricLeadingVisualKind {
|
|
526
|
+
const visual = visualFor(block) as BlockVisualOptions & Record<string, unknown>;
|
|
527
|
+
const visualKind = textValue(
|
|
528
|
+
visual.visualKind,
|
|
529
|
+
textValue(block.meta?.visualKind, textValue(block.meta?.previewKind)),
|
|
530
|
+
);
|
|
531
|
+
const basisWidth = imageComposeLayoutBasisWidth(block);
|
|
532
|
+
if (/spark|line|trend/i.test(visualKind)) return 'sparkline';
|
|
533
|
+
if (/bar|column|chart/i.test(visualKind)) return 'bars';
|
|
534
|
+
if (/icon|avatar|logo|badge/i.test(visualKind)) return 'icon';
|
|
535
|
+
if (basisWidth > 0 && basisWidth <= 12) return 'icon';
|
|
536
|
+
if (basisWidth >= 24) return 'sparkline';
|
|
537
|
+
return 'bars';
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
/**
|
|
541
|
+
* Chooses a screenshot-like empty chart preview from generic chart protocol fields.
|
|
542
|
+
* @param block - Rendered chart block.
|
|
543
|
+
* @param data - Current chart renderer data.
|
|
544
|
+
* @returns Generic chart preview kind.
|
|
545
|
+
*/
|
|
546
|
+
function imageComposeChartPreviewKind(block: WorkbenchBlock, data?: DisplayBlockData): ImageComposeChartPreviewKind {
|
|
547
|
+
const record: Record<string, unknown> = isRecord(data) ? data : {};
|
|
548
|
+
const chartType = textValue(record.chartType, textValue(block.meta?.chartType));
|
|
549
|
+
const rendererKey = chartRendererKey(block);
|
|
550
|
+
const visual = visualFor(block) as BlockVisualOptions & Record<string, unknown>;
|
|
551
|
+
const visualChart = isRecord(visual.chart) ? visual.chart : {};
|
|
552
|
+
const visualKind = textValue(
|
|
553
|
+
visual.visualKind,
|
|
554
|
+
textValue(block.meta?.visualKind, textValue(record.visualKind, textValue(visualChart.type))),
|
|
555
|
+
);
|
|
556
|
+
const seriesTypes = Array.isArray(record.series)
|
|
557
|
+
? record.series
|
|
558
|
+
.filter(isRecord)
|
|
559
|
+
.map((series) => textValue(series.type))
|
|
560
|
+
.filter(Boolean)
|
|
561
|
+
.join(' ')
|
|
562
|
+
: '';
|
|
563
|
+
const protocol = [chartType, rendererKey, visualKind, seriesTypes].join(' ');
|
|
564
|
+
if (/pie|donut|ring|circle|doughnut/i.test(protocol)) return 'donut';
|
|
565
|
+
const wantsBar = /bar|column|histogram/i.test(protocol);
|
|
566
|
+
const wantsLine = /line|area|trend|spark/i.test(protocol);
|
|
567
|
+
if (wantsBar && !wantsLine) return 'bar';
|
|
568
|
+
if (wantsLine && !wantsBar) return 'line';
|
|
569
|
+
return 'mixed';
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
/**
|
|
573
|
+
* Converts unknown chart point values into finite numbers for preview graphics.
|
|
574
|
+
* @param value - Candidate chart point.
|
|
575
|
+
* @returns Finite numeric value, or undefined when unavailable.
|
|
576
|
+
*/
|
|
577
|
+
function imageComposeChartPreviewNumber(value: unknown): number | undefined {
|
|
578
|
+
if (typeof value === 'number' && Number.isFinite(value)) return value;
|
|
579
|
+
if (typeof value === 'string' && value.trim()) {
|
|
580
|
+
const parsed = Number(value.replace(/,/g, '').replace(/%$/, '').trim());
|
|
581
|
+
return Number.isFinite(parsed) ? parsed : undefined;
|
|
582
|
+
}
|
|
583
|
+
if (isRecord(value)) {
|
|
584
|
+
return imageComposeChartPreviewNumber(value.value ?? value.metric_value ?? value.count ?? value.amount);
|
|
585
|
+
}
|
|
586
|
+
return undefined;
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
/**
|
|
590
|
+
* Reads generic chart values from refreshed series, pie slices, rows, or source-image percentages.
|
|
591
|
+
* @param data - Current chart renderer data.
|
|
592
|
+
* @returns Numeric values for screenshot-like chart preview drawing.
|
|
593
|
+
*/
|
|
594
|
+
function imageComposeChartPreviewValues(data?: DisplayBlockData): number[] {
|
|
595
|
+
const record: Record<string, unknown> = isRecord(data) ? data : {};
|
|
596
|
+
const series = Array.isArray(record.series) ? record.series.filter(isRecord) : [];
|
|
597
|
+
const firstSeriesData = series.flatMap((item) => Array.isArray(item.data) ? item.data : []);
|
|
598
|
+
const seriesValues = firstSeriesData
|
|
599
|
+
.map(imageComposeChartPreviewNumber)
|
|
600
|
+
.filter((value): value is number => value !== undefined);
|
|
601
|
+
if (seriesValues.length > 0) return seriesValues.slice(0, 8);
|
|
602
|
+
const slices = Array.isArray(record.slices) ? record.slices.filter(isRecord) : [];
|
|
603
|
+
const sliceValues = slices
|
|
604
|
+
.map((item) => imageComposeChartPreviewNumber(item.value ?? item.percent ?? item.share))
|
|
605
|
+
.filter((value): value is number => value !== undefined);
|
|
606
|
+
if (sliceValues.length > 0) return sliceValues.slice(0, 8);
|
|
607
|
+
const rows = Array.isArray(record.rows) ? record.rows.filter(isRecord) : [];
|
|
608
|
+
const rowValues = rows
|
|
609
|
+
.map((row) => Object.values(row).map(imageComposeChartPreviewNumber).find((value) => value !== undefined))
|
|
610
|
+
.filter((value): value is number => value !== undefined);
|
|
611
|
+
if (rowValues.length > 0) return rowValues.slice(0, 8);
|
|
612
|
+
const percentages = Array.isArray(record.samplePercentages) ? record.samplePercentages : [];
|
|
613
|
+
const sampleValues = percentages
|
|
614
|
+
.map(imageComposeChartPreviewNumber)
|
|
615
|
+
.filter((value): value is number => value !== undefined);
|
|
616
|
+
return sampleValues.length > 0 ? sampleValues.slice(0, 8) : [36, 48, 28, 58, 40, 66];
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
/**
|
|
620
|
+
* Builds SVG bar geometry from refreshed chart values while keeping the screenshot-like plot shell.
|
|
621
|
+
* @param block - Rendered chart block.
|
|
622
|
+
* @param data - Current chart renderer data.
|
|
623
|
+
* @returns Bar geometry for the compact preview SVG.
|
|
624
|
+
*/
|
|
625
|
+
function imageComposeChartPreviewBars(block: WorkbenchBlock, data?: DisplayBlockData): ImageComposeChartPreviewBar[] {
|
|
626
|
+
void block;
|
|
627
|
+
const values = imageComposeChartPreviewValues(data).slice(0, 6);
|
|
628
|
+
while (values.length < IMAGE_COMPOSE_CHART_PREVIEW_MIN_BAR_COUNT) {
|
|
629
|
+
values.push(30 + values.length * 8);
|
|
630
|
+
}
|
|
631
|
+
const max = Math.max(...values.map((value) => Math.abs(value)), 1);
|
|
632
|
+
const barWidth = 24;
|
|
633
|
+
const xPositions = [30, 86, 142, 198, 254, 310];
|
|
634
|
+
return values.map((value, index) => {
|
|
635
|
+
const height = Math.max(24, Math.round(34 + (Math.abs(value) / max) * 68));
|
|
636
|
+
return {
|
|
637
|
+
x: xPositions[index] ?? (38 + index * 56),
|
|
638
|
+
y: 116 - height,
|
|
639
|
+
width: barWidth,
|
|
640
|
+
height,
|
|
641
|
+
fill: index === Math.min(3, values.length - 1) ? '#4c2cff' : '#edeff6',
|
|
642
|
+
opacity: index === Math.min(3, values.length - 1) ? 0.9 : 1,
|
|
643
|
+
label: String(value),
|
|
644
|
+
};
|
|
645
|
+
});
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
/**
|
|
649
|
+
* Builds a compact donut style from refreshed chart values.
|
|
650
|
+
* @param block - Rendered chart block.
|
|
651
|
+
* @param data - Current chart renderer data.
|
|
652
|
+
* @returns Inline style for the donut preview.
|
|
653
|
+
*/
|
|
654
|
+
function imageComposeChartPreviewDonutStyle(block: WorkbenchBlock, data?: DisplayBlockData): Record<string, string> {
|
|
655
|
+
void block;
|
|
656
|
+
const values = imageComposeChartPreviewValues(data).slice(0, 4);
|
|
657
|
+
const total = values.reduce((sum, value) => sum + Math.max(0, Math.abs(value)), 0) || 1;
|
|
658
|
+
const colors = ['#4c2cff', '#19c7ad', '#a78bfa', '#e5e7eb'];
|
|
659
|
+
let cursor = 0;
|
|
660
|
+
const stops = values.map((value, index) => {
|
|
661
|
+
const start = cursor;
|
|
662
|
+
cursor += (Math.max(0, Math.abs(value)) / total) * 100;
|
|
663
|
+
return `${colors[index % colors.length]} ${start.toFixed(2)}% ${cursor.toFixed(2)}%`;
|
|
664
|
+
});
|
|
665
|
+
return {
|
|
666
|
+
background: `conic-gradient(${stops.join(', ')})`,
|
|
667
|
+
};
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
/**
|
|
671
|
+
* Reads the compact title shown above an image-composed chart preview.
|
|
672
|
+
* @param block - Rendered chart block.
|
|
673
|
+
* @param data - Current chart renderer data.
|
|
674
|
+
* @returns Screenshot-style chart label.
|
|
675
|
+
*/
|
|
676
|
+
function imageComposeChartPreviewLabel(block: WorkbenchBlock, data?: DisplayBlockData): string {
|
|
677
|
+
const record: Record<string, unknown> = isRecord(data) ? data : {};
|
|
678
|
+
return textValue(record.primaryLabel)
|
|
679
|
+
|| textValue(record.label)
|
|
680
|
+
|| textValue(record.dimensionLabel)
|
|
681
|
+
|| textValue(block.title, 'Chart');
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
/**
|
|
685
|
+
* Reads a generic chart summary value without claiming that query data succeeded.
|
|
686
|
+
* @param block - Rendered chart block.
|
|
687
|
+
* @param data - Current chart renderer data.
|
|
688
|
+
* @returns Metric-like value text for the screenshot preview header.
|
|
689
|
+
*/
|
|
690
|
+
function imageComposeChartPreviewMetric(block: WorkbenchBlock, data?: DisplayBlockData): string {
|
|
691
|
+
const record: Record<string, unknown> = isRecord(data) ? data : {};
|
|
692
|
+
const displayValue = textValue(record.displayValue)
|
|
693
|
+
|| textValue(record.primaryValue)
|
|
694
|
+
|| textValue(record.value)
|
|
695
|
+
|| textValue(record.total)
|
|
696
|
+
|| textValue(record.summaryValue);
|
|
697
|
+
if (displayValue) return displayValue;
|
|
698
|
+
const primaryValue = Number(record.primaryValue ?? record.value ?? record.total ?? record.summaryValue);
|
|
699
|
+
if (Number.isFinite(primaryValue)) {
|
|
700
|
+
const format = textValue(record.primaryFormat, textValue(record.metricFormat, 'number'));
|
|
701
|
+
return metricSummaryDisplayValue({
|
|
702
|
+
shape: 'metricSummary',
|
|
703
|
+
primaryLabel: imageComposeChartPreviewLabel(block, data),
|
|
704
|
+
primaryFormat: format === 'currency' || format === 'percent' ? format : 'number',
|
|
705
|
+
primaryValue,
|
|
706
|
+
deltaPct: null,
|
|
707
|
+
compareLabel: '',
|
|
708
|
+
periodLabel: '',
|
|
709
|
+
sourceLabel: '',
|
|
710
|
+
secondary: [],
|
|
711
|
+
});
|
|
712
|
+
}
|
|
713
|
+
return textValue(block.subtitle) || '--';
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
/**
|
|
717
|
+
* Reads a generic status chip for image-composed chart previews.
|
|
718
|
+
* @param block - Rendered chart block.
|
|
719
|
+
* @param data - Current chart renderer data.
|
|
720
|
+
* @returns Status or delta text for the chart header.
|
|
721
|
+
*/
|
|
722
|
+
function imageComposeChartPreviewStatus(_block: WorkbenchBlock, data?: DisplayBlockData): string {
|
|
723
|
+
const record: Record<string, unknown> = isRecord(data) ? data : {};
|
|
724
|
+
const explicit = textValue(record.status)
|
|
725
|
+
|| textValue(record.statusLabel)
|
|
726
|
+
|| textValue(record.deltaLabel)
|
|
727
|
+
|| textValue(record.compareLabel);
|
|
728
|
+
if (explicit && explicit !== 'snapshot') return explicit;
|
|
729
|
+
const deltaPct = Number(record.deltaPct);
|
|
730
|
+
if (Number.isFinite(deltaPct)) return `${deltaPct >= 0 ? '+' : ''}${(deltaPct * 100).toFixed(1)}%`;
|
|
731
|
+
return '';
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
/**
|
|
735
|
+
* Builds all header fields for a generic image-composed chart preview.
|
|
736
|
+
* @param block - Rendered chart block.
|
|
737
|
+
* @param data - Current chart renderer data.
|
|
738
|
+
* @returns Compact chart preview header fields.
|
|
739
|
+
*/
|
|
740
|
+
function imageComposeChartPreviewHeader(block: WorkbenchBlock, data?: DisplayBlockData): ImageComposeChartPreviewHeader {
|
|
741
|
+
return {
|
|
742
|
+
label: imageComposeChartPreviewLabel(block, data),
|
|
743
|
+
metric: imageComposeChartPreviewMetric(block, data),
|
|
744
|
+
status: imageComposeChartPreviewStatus(block, data),
|
|
745
|
+
};
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
/**
|
|
749
|
+
* Checks whether an image-composed ranking/list card has no trustworthy rows but should keep a compact visual shell.
|
|
750
|
+
* @param block - Rendered list block.
|
|
751
|
+
* @param data - Current ranking renderer data.
|
|
752
|
+
* @returns True when the list came from image compose and has no reliable items.
|
|
753
|
+
*/
|
|
754
|
+
function imageComposeEmptyRankingPreview(block: WorkbenchBlock, data: CategoryRankingData): boolean {
|
|
755
|
+
return imageComposeCompactCard()(block)
|
|
756
|
+
&& !imageComposeAlertRankingCard()(block, data)
|
|
757
|
+
&& dataBindingNeedsHumanIntervention()(block)
|
|
758
|
+
&& (!Array.isArray(data.items) || data.items.length === 0);
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
/**
|
|
762
|
+
* Returns a compact status label for empty image-composed list previews.
|
|
763
|
+
* @param block - Rendered list block.
|
|
764
|
+
* @param data - Ranking renderer data with optional status copied from recognition.
|
|
765
|
+
* @returns Status text shown as a chip.
|
|
766
|
+
*/
|
|
767
|
+
function imageComposeEmptyRankingStatus(block: WorkbenchBlock, data: CategoryRankingData & Record<string, unknown>): string {
|
|
768
|
+
return textValue(data.status, imageComposeBusinessGapBadgeLabel()(block));
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
/**
|
|
772
|
+
* Returns a short action/detail line for empty image-composed list previews.
|
|
773
|
+
* @param block - Rendered list block.
|
|
774
|
+
* @returns Stable business-input hint without claiming successful data binding.
|
|
775
|
+
*/
|
|
776
|
+
function imageComposeEmptyRankingDetail(block: WorkbenchBlock): string {
|
|
777
|
+
return dataBindingNeedsHumanIntervention()(block) ? '需补充业务口径后回填' : '等待数据回填';
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
/**
|
|
781
|
+
* Normalizes image-composed list rows without depending on a source-image title.
|
|
782
|
+
* @param block - Rendered list block.
|
|
783
|
+
* @param data - Current ranking renderer data.
|
|
784
|
+
* @returns Supplied rows first, otherwise neutral screenshot-density placeholders.
|
|
785
|
+
*/
|
|
786
|
+
function imageComposeRankingPreviewItems(block: WorkbenchBlock, data: CategoryRankingData): Array<Record<string, unknown>> {
|
|
787
|
+
const items = Array.isArray(data.items) ? data.items.filter(isRecord) : [];
|
|
788
|
+
const fallbackItems = [
|
|
789
|
+
{ label: textValue(data.dimensionLabel, textValue(block.title, 'Item 1')), valueLabel: '--', share: 0.72, tone: 'brand' },
|
|
790
|
+
{ label: textValue(block.subtitle, 'Item 2'), valueLabel: '--', share: 0.54, tone: 'teal' },
|
|
791
|
+
{ label: 'Item 3', valueLabel: '--', share: 0.38, tone: 'neutral' },
|
|
792
|
+
];
|
|
793
|
+
return (items.length > 0 ? items : fallbackItems).slice(0, 4);
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
/**
|
|
797
|
+
* Reads the primary row label for an image-composed list preview.
|
|
798
|
+
* @param item - Ranking row record.
|
|
799
|
+
* @param index - Row index.
|
|
800
|
+
* @returns Row label text.
|
|
801
|
+
*/
|
|
802
|
+
function imageComposeRankingPreviewLabel(item: Record<string, unknown>, index: number): string {
|
|
803
|
+
return textValue(item.label, textValue(item.title, textValue(item.name, `Item ${index + 1}`)));
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
/**
|
|
807
|
+
* Reads the secondary row detail for an image-composed list preview.
|
|
808
|
+
* @param item - Ranking row record.
|
|
809
|
+
* @returns Row detail text.
|
|
810
|
+
*/
|
|
811
|
+
function imageComposeRankingPreviewDetail(item: Record<string, unknown>): string {
|
|
812
|
+
return textValue(item.badge, textValue(item.detail, textValue(item.description)));
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
/**
|
|
816
|
+
* Reads the value chip text for an image-composed list preview.
|
|
817
|
+
* @param item - Ranking row record.
|
|
818
|
+
* @param data - Current ranking renderer data.
|
|
819
|
+
* @returns Row value text.
|
|
820
|
+
*/
|
|
821
|
+
function imageComposeRankingPreviewValue(item: Record<string, unknown>, data: CategoryRankingData): string {
|
|
822
|
+
const explicit = textValue(item.valueLabel, textValue(item.valueText));
|
|
823
|
+
if (explicit) return explicit;
|
|
824
|
+
const value = Number(item.value);
|
|
825
|
+
return Number.isFinite(value) ? formatMetricValue(value, data.valueFormat) : '--';
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
/**
|
|
829
|
+
* Builds an avatar label for an image-composed list preview row.
|
|
830
|
+
* @param item - Ranking row record.
|
|
831
|
+
* @param index - Row index.
|
|
832
|
+
* @returns Short avatar text.
|
|
833
|
+
*/
|
|
834
|
+
function imageComposeRankingPreviewAvatar(item: Record<string, unknown>, index: number): string {
|
|
835
|
+
return textValue(item.avatar, imageComposeRankingPreviewLabel(item, index).slice(0, 1) || String(index + 1)).toUpperCase();
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
/**
|
|
839
|
+
* Builds avatar colors for an image-composed list preview row.
|
|
840
|
+
* @param item - Ranking row record.
|
|
841
|
+
* @param index - Row index.
|
|
842
|
+
* @returns Tailwind class list.
|
|
843
|
+
*/
|
|
844
|
+
function imageComposeRankingPreviewAvatarClass(item: Record<string, unknown>, index: number): string[] {
|
|
845
|
+
const tone = textValue(item.tone, textValue(item.status));
|
|
846
|
+
const base = ['grid h-7 w-7 shrink-0 place-items-center rounded-full text-[11px] font-semibold'];
|
|
847
|
+
if (/teal|cyan|success/i.test(tone) || index === 1) return [...base, 'bg-[#e8fbf7] text-[#0f9f8b]'];
|
|
848
|
+
if (/warn|amber/i.test(tone) || index === 2) return [...base, 'bg-[#fff3d6] text-[#d78b00]'];
|
|
849
|
+
if (/danger|error|red/i.test(tone)) return [...base, 'bg-rose-50 text-rose-600'];
|
|
850
|
+
return [...base, 'bg-[#4c2cff] text-white'];
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
/**
|
|
854
|
+
* Builds value chip colors for an image-composed list preview row.
|
|
855
|
+
* @param item - Ranking row record.
|
|
856
|
+
* @param index - Row index.
|
|
857
|
+
* @returns Tailwind class list.
|
|
858
|
+
*/
|
|
859
|
+
function imageComposeRankingPreviewValueClass(item: Record<string, unknown>, index: number): string[] {
|
|
860
|
+
const tone = textValue(item.tone, textValue(item.status));
|
|
861
|
+
const base = ['rounded-full px-2 py-0.5 text-[11px] font-semibold leading-5'];
|
|
862
|
+
if (/danger|error|red/i.test(tone)) return [...base, 'bg-rose-50 text-rose-600'];
|
|
863
|
+
if (/teal|cyan|success/i.test(tone) || index === 1) return [...base, 'bg-[#e8fbf7] text-[#0f9f8b]'];
|
|
864
|
+
if (/warn|amber/i.test(tone) || index === 2) return [...base, 'bg-[#fff3d6] text-[#d78b00]'];
|
|
865
|
+
return [...base, 'bg-[#f0efff] text-[#4c2cff]'];
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
function activeTabFor(block: WorkbenchBlock) {
|
|
869
|
+
return metaRecord(block, 'activeShowcaseTab');
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
function tabsFor(block: WorkbenchBlock) {
|
|
873
|
+
return metaList(block, 'showcaseTabs');
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
function orgMetricValues(block: WorkbenchBlock) {
|
|
877
|
+
const overview = metaRecord(block, 'showcaseOverview');
|
|
878
|
+
const activeTab = activeTabFor(block);
|
|
879
|
+
return [
|
|
880
|
+
{ label: '卡片总数', value: numberValue(overview.totalCount), icon: LayoutDashboard },
|
|
881
|
+
{ label: '验收卡片', value: numberValue(overview.acceptanceCount), icon: CircleCheck },
|
|
882
|
+
{ label: '能力分类', value: numberValue(overview.categoryCount), icon: UserRound },
|
|
883
|
+
{ label: '当前分类', value: numberValue(activeTab.count), icon: Bot },
|
|
884
|
+
];
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
function visualFor(block: WorkbenchBlock): BlockVisualOptions {
|
|
888
|
+
return block.meta?.visual || {};
|
|
889
|
+
}
|
|
890
|
+
|
|
891
|
+
/**
|
|
892
|
+
* Returns visual metadata after removing stale high-fidelity markers that do not match the current scene.
|
|
893
|
+
* @param block - Rendered workbench block.
|
|
894
|
+
* @param data - Optional customCanvas data used for scene classification.
|
|
895
|
+
* @returns Visual metadata safe for the current renderer branch.
|
|
896
|
+
*/
|
|
897
|
+
function visualForScene(block: WorkbenchBlock, data?: CustomCanvasData): BlockVisualOptions {
|
|
898
|
+
const visual = visualFor(block);
|
|
899
|
+
if (!data || visual.businessSummaryBand !== 'risk' || referenceCompositeLooksLikeChairmanRiskDirectContext()(block, data)) return visual;
|
|
900
|
+
const {
|
|
901
|
+
businessSummaryBand: _businessSummaryBand,
|
|
902
|
+
backgroundColor: _backgroundColor,
|
|
903
|
+
textColor: _textColor,
|
|
904
|
+
borderColor: _borderColor,
|
|
905
|
+
cardShadow: _cardShadow,
|
|
906
|
+
...rest
|
|
907
|
+
} = visual;
|
|
908
|
+
return rest;
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
function rowGrid(columns: string[]) {
|
|
912
|
+
return { gridTemplateColumns: `repeat(${Math.max(1, columns.length)}, minmax(0, 1fr))` };
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
/**
|
|
916
|
+
* Formats metric data while preserving image-recognized static display text.
|
|
917
|
+
* @param data - Metric summary renderer data.
|
|
918
|
+
* @returns Value text for the metric card.
|
|
919
|
+
*/
|
|
920
|
+
function metricSummaryDisplayValue(data: MetricSummaryData & Record<string, unknown>): string {
|
|
921
|
+
return textValue(data.displayValue)
|
|
922
|
+
|| formatMetricValue(data.primaryValue, data.primaryFormat);
|
|
923
|
+
}
|
|
924
|
+
|
|
925
|
+
/**
|
|
926
|
+
* Returns the unit text that should be shown beside an image-recognized KPI value.
|
|
927
|
+
* @param data - Metric summary renderer data.
|
|
928
|
+
* @returns Unit label when it is not already part of the visible value.
|
|
929
|
+
*/
|
|
930
|
+
function metricSummaryUnitLabel(data: MetricSummaryData & Record<string, unknown>): string {
|
|
931
|
+
const displayValue = metricSummaryDisplayValue(data);
|
|
932
|
+
const unit = textValue(data.unit);
|
|
933
|
+
if (!unit || displayValue.includes(unit)) return '';
|
|
934
|
+
return unit;
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
/**
|
|
938
|
+
* Returns the first compact secondary metric text from image-composed KPI data.
|
|
939
|
+
* @param data - Metric summary renderer data.
|
|
940
|
+
* @returns Secondary metric formatted for the compact right-side status slot.
|
|
941
|
+
*/
|
|
942
|
+
function imageComposeMetricSecondaryStatus(data: MetricSummaryData & Record<string, unknown>): string {
|
|
943
|
+
const secondary = Array.isArray(data.secondary) ? data.secondary.find(isRecord) : undefined;
|
|
944
|
+
if (!secondary) return '';
|
|
945
|
+
const label = textValue(secondary.label);
|
|
946
|
+
const value = textValue(secondary.value, String(secondary.value ?? ''));
|
|
947
|
+
if (!value) return '';
|
|
948
|
+
return label && !/^(同比|环比|变化|增长)$/u.test(label) ? `${label} ${value}` : value;
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
/**
|
|
952
|
+
* Reads the screenshot footer summary for image-composed KPI cards.
|
|
953
|
+
* @param data - Metric summary renderer data.
|
|
954
|
+
* @returns Footer text recognized from the source screenshot.
|
|
955
|
+
*/
|
|
956
|
+
function imageComposeMetricSubText(data: MetricSummaryData & Record<string, unknown>): string {
|
|
957
|
+
return textValue(data.subText)
|
|
958
|
+
|| textValue(data.footerText)
|
|
959
|
+
|| textValue(data.description)
|
|
960
|
+
|| textValue(data.secondaryLabel)
|
|
961
|
+
|| textValue(data.primaryLabel);
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
/**
|
|
965
|
+
* Extracts the compact right-side status from a KPI footer.
|
|
966
|
+
* @param data - Metric summary renderer data.
|
|
967
|
+
* @returns Status token such as 达标, 可控, 需处理, or a signed delta.
|
|
968
|
+
*/
|
|
969
|
+
function imageComposeMetricFooterStatus(data: MetricSummaryData & Record<string, unknown>): string {
|
|
970
|
+
const secondaryStatus = imageComposeMetricSecondaryStatus(data);
|
|
971
|
+
if (secondaryStatus) return secondaryStatus;
|
|
972
|
+
const footer = imageComposeMetricSubText(data);
|
|
973
|
+
const tokens = footer.split(/\s+/).filter(Boolean);
|
|
974
|
+
const candidate = tokens[tokens.length - 1] || '';
|
|
975
|
+
if (/^(达标|可控|需处理|告警|卡顿|延期|通过|已归档)$/u.test(candidate)) return candidate;
|
|
976
|
+
if (/^[+-]\d+(?:\.\d+)?%?$/u.test(candidate)) return candidate;
|
|
977
|
+
return '';
|
|
978
|
+
}
|
|
979
|
+
|
|
980
|
+
/**
|
|
981
|
+
* Returns the left-side KPI footer text after removing the compact status token.
|
|
982
|
+
* @param data - Metric summary renderer data.
|
|
983
|
+
* @returns Main footer text for the KPI card.
|
|
984
|
+
*/
|
|
985
|
+
function imageComposeMetricFooterMain(data: MetricSummaryData & Record<string, unknown>): string {
|
|
986
|
+
const footer = imageComposeMetricSubText(data);
|
|
987
|
+
if (imageComposeMetricSecondaryStatus(data)) return footer;
|
|
988
|
+
const status = imageComposeMetricFooterStatus(data);
|
|
989
|
+
return status ? footer.slice(0, Math.max(0, footer.length - status.length)).trim() : footer;
|
|
990
|
+
}
|
|
991
|
+
|
|
992
|
+
/**
|
|
993
|
+
* Builds the color classes for the compact KPI footer status.
|
|
994
|
+
* @param status - Status token extracted from the screenshot footer.
|
|
995
|
+
* @returns Tailwind classes for the status text.
|
|
996
|
+
*/
|
|
997
|
+
function imageComposeMetricFooterStatusClass(status: string): string[] {
|
|
998
|
+
if (/^-/.test(status)) return ['text-red-600'];
|
|
999
|
+
if (/^\+|ROI/i.test(status)) return ['text-emerald-700'];
|
|
1000
|
+
if (/需处理|告警|卡顿|延期|^\+/.test(status)) return ['text-red-600'];
|
|
1001
|
+
if (/^-|达标|可控|通过|已归档/.test(status)) return ['text-emerald-700'];
|
|
1002
|
+
return ['text-slate-600'];
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
/**
|
|
1006
|
+
* Builds the dot color for compact image-composed KPI headers.
|
|
1007
|
+
* @param status - Status token extracted from the screenshot footer.
|
|
1008
|
+
* @returns Tailwind classes for the small status dot.
|
|
1009
|
+
*/
|
|
1010
|
+
function imageComposeMetricStatusDotClass(status: string): string[] {
|
|
1011
|
+
if (/^-/.test(status)) return ['bg-red-600'];
|
|
1012
|
+
if (/^\+|ROI/i.test(status)) return ['bg-emerald-600'];
|
|
1013
|
+
if (/需处理|告警|卡顿|延期|^\+/.test(status)) return ['bg-red-600'];
|
|
1014
|
+
if (/^-|达标|可控|通过|已归档/.test(status)) return ['bg-emerald-600'];
|
|
1015
|
+
return ['bg-amber-600'];
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
function chartRendererKey(block: WorkbenchBlock) {
|
|
1019
|
+
return block.renderer?.rendererKey || String(block.subType || '');
|
|
1020
|
+
}
|
|
1021
|
+
|
|
1022
|
+
|
|
1023
|
+
return {
|
|
1024
|
+
isFormBlockData,
|
|
1025
|
+
isSurveyBlockData,
|
|
1026
|
+
isActionGroupData,
|
|
1027
|
+
isWorkflowBlockData,
|
|
1028
|
+
isReportBlockData,
|
|
1029
|
+
textValue,
|
|
1030
|
+
numberValue,
|
|
1031
|
+
listValue,
|
|
1032
|
+
metaRecord,
|
|
1033
|
+
metaList,
|
|
1034
|
+
welcomeBannerMetrics,
|
|
1035
|
+
tierKeyForDensity,
|
|
1036
|
+
applyResponsiveTier,
|
|
1037
|
+
formValues,
|
|
1038
|
+
surveyAnswers,
|
|
1039
|
+
compactLimit,
|
|
1040
|
+
toggleMultiValue,
|
|
1041
|
+
formCompletedCount,
|
|
1042
|
+
renderFieldType,
|
|
1043
|
+
updateMatrixAnswer,
|
|
1044
|
+
matrixAnswerValue,
|
|
1045
|
+
multipleAnswerIncludes,
|
|
1046
|
+
taskStatusClass,
|
|
1047
|
+
taskTypeLabel,
|
|
1048
|
+
taskStatusLabel,
|
|
1049
|
+
tableRowsPreviewVisualKind,
|
|
1050
|
+
tableRowsPreviewCard,
|
|
1051
|
+
tableRowsPreviewRecords,
|
|
1052
|
+
tableRowsPreviewCell,
|
|
1053
|
+
tableRowsTimelinePrimaryCell,
|
|
1054
|
+
tableRowsTimelineBadgeCell,
|
|
1055
|
+
tableRowsPreviewGridStyle,
|
|
1056
|
+
formatWeatherTemp,
|
|
1057
|
+
weatherIcon,
|
|
1058
|
+
isChartShape,
|
|
1059
|
+
imageComposeEmptyChartPreview,
|
|
1060
|
+
imageComposeChartPreview,
|
|
1061
|
+
imageComposeMetricLeadingVisualKind,
|
|
1062
|
+
imageComposeChartPreviewKind,
|
|
1063
|
+
imageComposeChartPreviewLabel,
|
|
1064
|
+
imageComposeChartPreviewMetric,
|
|
1065
|
+
imageComposeChartPreviewStatus,
|
|
1066
|
+
imageComposeChartPreviewHeader,
|
|
1067
|
+
imageComposeChartPreviewBars,
|
|
1068
|
+
imageComposeChartPreviewDonutStyle,
|
|
1069
|
+
imageComposeEmptyRankingPreview,
|
|
1070
|
+
imageComposeEmptyRankingStatus,
|
|
1071
|
+
imageComposeEmptyRankingDetail,
|
|
1072
|
+
imageComposeRankingPreviewItems,
|
|
1073
|
+
imageComposeRankingPreviewLabel,
|
|
1074
|
+
imageComposeRankingPreviewDetail,
|
|
1075
|
+
imageComposeRankingPreviewValue,
|
|
1076
|
+
imageComposeRankingPreviewAvatar,
|
|
1077
|
+
imageComposeRankingPreviewAvatarClass,
|
|
1078
|
+
imageComposeRankingPreviewValueClass,
|
|
1079
|
+
activeTabFor,
|
|
1080
|
+
tabsFor,
|
|
1081
|
+
orgMetricValues,
|
|
1082
|
+
visualFor,
|
|
1083
|
+
visualForScene,
|
|
1084
|
+
rowGrid,
|
|
1085
|
+
tableColumnsFromRows,
|
|
1086
|
+
tableRowCells,
|
|
1087
|
+
metricSummaryDisplayValue,
|
|
1088
|
+
metricSummaryUnitLabel,
|
|
1089
|
+
imageComposeMetricSubText,
|
|
1090
|
+
imageComposeMetricFooterStatus,
|
|
1091
|
+
imageComposeMetricFooterMain,
|
|
1092
|
+
imageComposeMetricFooterStatusClass,
|
|
1093
|
+
imageComposeMetricStatusDotClass,
|
|
1094
|
+
chartRendererKey,
|
|
1095
|
+
};
|
|
1096
|
+
}
|