base-screen 0.3.0 → 0.4.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/README.md +5 -2
- package/dist/_internal/contracts/diagnostics/material-error.d.ts +1 -1
- package/dist/_internal/contracts/diagnostics/material-error.js +1 -1
- package/dist/_internal/contracts/document/blueprint-graph.d.ts +3 -3
- package/dist/_internal/contracts/document/blueprint-graph.js +4 -4
- package/dist/_internal/contracts/document/component-states.d.ts +1 -1
- package/dist/_internal/contracts/document/component-states.js +1 -1
- package/dist/_internal/contracts/document/image-url.js +1 -1
- package/dist/_internal/contracts/document/json-schema.js +1 -1
- package/dist/_internal/contracts/document/limits.d.ts +5 -5
- package/dist/_internal/contracts/document/limits.js +5 -5
- package/dist/_internal/contracts/document/references.js +3 -3
- package/dist/_internal/contracts/document/schema.d.ts +9 -2
- package/dist/_internal/contracts/document/schema.js +4 -4
- package/dist/_internal/contracts/document/sub-canvas.d.ts +2 -2
- package/dist/_internal/contracts/document/sub-canvas.js +2 -2
- package/dist/_internal/contracts/document/theme.d.ts +2 -2
- package/dist/_internal/contracts/document/theme.js +2 -2
- package/dist/_internal/contracts/document/validate-blueprint.d.ts +1 -1
- package/dist/_internal/contracts/document/validate-blueprint.js +1 -1
- package/dist/_internal/contracts/document/validate-component.js +2 -2
- package/dist/_internal/contracts/document/validate-data-source.js +2 -2
- package/dist/_internal/contracts/document/validate-sub-canvas.d.ts +1 -1
- package/dist/_internal/contracts/document/validate-sub-canvas.js +1 -1
- package/dist/_internal/contracts/document/validate-value-ref.js +6 -1
- package/dist/_internal/contracts/index.d.ts +1 -1
- package/dist/_internal/contracts/migration/blueprint-graph-migration.d.ts +1 -1
- package/dist/_internal/contracts/migration/migrate-document.js +2 -2
- package/dist/_internal/contracts/push/delivery.d.ts +1 -1
- package/dist/_internal/contracts/push/delivery.js +1 -1
- package/dist/_internal/contracts/push/level-scale.d.ts +1 -1
- package/dist/_internal/contracts/push/level-scale.js +1 -1
- package/dist/_internal/contracts/screen-document.schema.json +15 -3
- package/dist/_internal/contracts/types/diagnostics.d.ts +1 -1
- package/dist/_internal/contracts/types/document.d.ts +21 -19
- package/dist/_internal/contracts/types/execution.d.ts +3 -3
- package/dist/_internal/contracts/types/host.d.ts +23 -5
- package/dist/_internal/contracts/types/host.js +1 -1
- package/dist/_internal/contracts/types/push.d.ts +3 -3
- package/dist/_internal/contracts/types/variable.d.ts +3 -3
- package/dist/_internal/contracts/variable/parse.js +5 -1
- package/dist/_internal/core/blueprint/runtime-compile.d.ts +1 -1
- package/dist/_internal/core/blueprint/runtime-compile.js +1 -1
- package/dist/_internal/core/blueprint/runtime-dispatch.js +1 -1
- package/dist/_internal/core/blueprint/runtime-simulate.d.ts +57 -0
- package/dist/_internal/core/blueprint/runtime-simulate.js +177 -0
- package/dist/_internal/core/blueprint/runtime-types.d.ts +4 -4
- package/dist/_internal/core/blueprint/runtime.d.ts +1 -0
- package/dist/_internal/core/blueprint/runtime.js +1 -0
- package/dist/_internal/core/commands/apply-collection-commands.d.ts +32 -0
- package/dist/_internal/core/commands/apply-collection-commands.js +174 -0
- package/dist/_internal/core/commands/apply-component-commands.d.ts +1 -1
- package/dist/_internal/core/commands/apply-component-commands.js +2 -2
- package/dist/_internal/core/commands/apply.js +15 -2
- package/dist/_internal/core/commands/parse-command.js +12 -0
- package/dist/_internal/core/commands/types.d.ts +33 -5
- package/dist/_internal/core/data/data-candidates.d.ts +38 -0
- package/dist/_internal/core/data/data-candidates.js +186 -0
- package/dist/_internal/core/data/data-source-dependents.d.ts +1 -1
- package/dist/_internal/core/data/data-source-dependents.js +1 -1
- package/dist/_internal/core/data/dataset-profile.d.ts +71 -0
- package/dist/_internal/core/data/dataset-profile.js +170 -0
- package/dist/_internal/core/data/host-dataset.d.ts +2 -2
- package/dist/_internal/core/data/host-dataset.js +2 -2
- package/dist/_internal/core/data/sample-values.d.ts +25 -0
- package/dist/_internal/core/data/sample-values.js +45 -0
- package/dist/_internal/core/data/value-ref.d.ts +2 -2
- package/dist/_internal/core/data/value-ref.js +1 -1
- package/dist/_internal/core/diff/screen-diff.js +6 -0
- package/dist/_internal/core/index.d.ts +7 -1
- package/dist/_internal/core/index.js +7 -1
- package/dist/_internal/core/state/state-preset.d.ts +32 -0
- package/dist/_internal/core/state/state-preset.js +37 -0
- package/dist/_internal/core/validation/layout-audit.d.ts +17 -0
- package/dist/_internal/core/validation/layout-audit.js +228 -0
- package/dist/_internal/core/validation/legibility.d.ts +9 -0
- package/dist/_internal/core/validation/legibility.js +33 -0
- package/dist/_internal/core/validation/validate-semantics.js +1 -1
- package/dist/_internal/engine/browser/controllers/blueprint/designer-blueprint-canvas-bridge.d.ts +1 -1
- package/dist/_internal/engine/browser/controllers/dataset/designer-data-source-authoring.d.ts +1 -1
- package/dist/_internal/engine/browser/controllers/dataset/designer-dataset-catalog-controller.d.ts +21 -0
- package/dist/_internal/engine/browser/controllers/dataset/designer-dataset-controller-context.d.ts +7 -2
- package/dist/_internal/engine/browser/controllers/dataset/designer-dataset-draft-controller.d.ts +7 -2
- package/dist/_internal/engine/browser/controllers/dataset/designer-dataset-effective-value.d.ts +1 -1
- package/dist/_internal/engine/browser/controllers/dataset/designer-dataset-surface-controller.d.ts +1 -1
- package/dist/_internal/engine/browser/controllers/dataset/designer-update-policy-authoring.d.ts +1 -1
- package/dist/_internal/engine/browser/controllers/designer-artboard-controller.d.ts +1 -1
- package/dist/_internal/engine/browser/controllers/designer-canvas-runtime-controller.d.ts +2 -2
- package/dist/_internal/engine/browser/controllers/designer-change-controller.d.ts +27 -0
- package/dist/_internal/engine/browser/controllers/designer-command-palette-controller.d.ts +1 -1
- package/dist/_internal/engine/browser/controllers/designer-intent-controller.d.ts +5 -0
- package/dist/_internal/engine/browser/controllers/designer-page-preview-controller.d.ts +1 -1
- package/dist/_internal/engine/browser/controllers/designer-popup-preview-controller.d.ts +1 -1
- package/dist/_internal/engine/browser/controllers/designer-reference-layer-controller.d.ts +1 -1
- package/dist/_internal/engine/browser/controllers/designer-text-edit-controller.d.ts +2 -2
- package/dist/_internal/engine/browser/controllers/designer-viewport-controller.d.ts +7 -1
- package/dist/_internal/engine/browser/controllers/gesture/designer-drag-gesture.d.ts +6 -1
- package/dist/_internal/engine/browser/controllers/gesture/designer-gesture-callbacks.d.ts +1 -1
- package/dist/_internal/engine/browser/controllers/panel/designer-component-states-controller.d.ts +1 -1
- package/dist/_internal/engine/browser/controllers/panel/designer-panel-controller-callbacks.d.ts +6 -6
- package/dist/_internal/engine/browser/controllers/panel/designer-panel-property-controller.d.ts +7 -0
- package/dist/_internal/engine/browser/controllers/variables/designer-variable-catalog-controller.d.ts +9 -1
- package/dist/_internal/engine/browser/controllers/variables/designer-variable-editor-controller.d.ts +6 -1
- package/dist/_internal/engine/browser/controllers/variables/designer-variables-controller.d.ts +16 -1
- package/dist/_internal/engine/browser/controllers/workbench/designer-workbench-controller.d.ts +2 -0
- package/dist/_internal/engine/browser/controllers/workbench/designer-workbench-tabs-controller.d.ts +2 -0
- package/dist/_internal/engine/browser/dom/blueprint/designer-blueprint-inspector-configuration.d.ts +1 -1
- package/dist/_internal/engine/browser/dom/change/designer-change-dom.d.ts +21 -5
- package/dist/_internal/engine/browser/dom/color/designer-color-palette-model.d.ts +3 -3
- package/dist/_internal/engine/browser/dom/color/designer-color-palette-types.d.ts +2 -2
- package/dist/_internal/engine/browser/dom/color/designer-color-theme-slots.d.ts +1 -1
- package/dist/_internal/engine/browser/dom/dataset/designer-data-group-dom.d.ts +1 -1
- package/dist/_internal/engine/browser/dom/dataset/designer-data-panel-notice.d.ts +1 -1
- package/dist/_internal/engine/browser/dom/dataset/designer-data-section-diff.d.ts +4 -6
- package/dist/_internal/engine/browser/dom/dataset/designer-data-state.d.ts +1 -1
- package/dist/_internal/engine/browser/dom/dataset/designer-dataset-authoring-dom.d.ts +1 -1
- package/dist/_internal/engine/browser/dom/dataset/designer-dataset-catalog-dom.d.ts +1 -1
- package/dist/_internal/engine/browser/dom/dataset/designer-dataset-sections.d.ts +1 -1
- package/dist/_internal/engine/browser/dom/dataset/designer-dataset-types.d.ts +11 -4
- package/dist/_internal/engine/browser/dom/descriptor/designer-descriptor-control-dom.d.ts +1 -1
- package/dist/_internal/engine/browser/dom/descriptor/designer-descriptor-model.d.ts +1 -1
- package/dist/_internal/engine/browser/dom/designer-field-primitives.d.ts +1 -1
- package/dist/_internal/engine/browser/dom/designer-icons.d.ts +2 -0
- package/dist/_internal/engine/browser/dom/designer-text-edit-dom.d.ts +2 -2
- package/dist/_internal/engine/browser/dom/designer-variable-inspector-dom.d.ts +7 -0
- package/dist/_internal/engine/browser/dom/designer-variables-dom.d.ts +5 -1
- package/dist/_internal/engine/browser/dom/designer-variables-editor-dom.d.ts +30 -1
- package/dist/_internal/engine/browser/dom/designer-variables-toolbar-dom.d.ts +4 -2
- package/dist/_internal/engine/browser/dom/intent/designer-intent-reference-picker-dom.d.ts +2 -0
- package/dist/_internal/engine/browser/dom/material-library/designer-material-library-dom.d.ts +1 -1
- package/dist/_internal/engine/browser/dom/menu/designer-menu-model.d.ts +3 -3
- package/dist/_internal/engine/browser/dom/menu/designer-plugin-command-menu.d.ts +5 -2
- package/dist/_internal/engine/browser/dom/panel/designer-canvas-transactions.d.ts +1 -1
- package/dist/_internal/engine/browser/dom/panel/designer-component-states-dom.d.ts +2 -2
- package/dist/_internal/engine/browser/dom/panel/designer-multi-selection-dom.d.ts +1 -1
- package/dist/_internal/engine/browser/dom/panel/designer-panel-primitives.d.ts +2 -2
- package/dist/_internal/engine/browser/dom/panel/designer-property-transactions.d.ts +1 -1
- package/dist/_internal/engine/browser/dom/value-ref/designer-value-ref-picker-dom.d.ts +1 -1
- package/dist/_internal/engine/browser/dom/value-ref/designer-value-ref-picker-mount.d.ts +1 -1
- package/dist/_internal/engine/browser/dom/value-ref/designer-value-ref-summary-dom.d.ts +1 -1
- package/dist/_internal/engine/browser/dom/value-ref/designer-value-ref-types.d.ts +6 -4
- package/dist/_internal/engine/browser/viewport/designer-canvas-aids-types.d.ts +3 -3
- package/dist/_internal/engine/browser/viewport/designer-canvas-aids.d.ts +5 -3
- package/dist/_internal/engine/browser/viewport/designer-canvas-measurements.d.ts +2 -14
- package/dist/_internal/engine/browser/viewport/designer-guide-overlay-nodes.d.ts +2 -0
- package/dist/_internal/engine/browser/viewport/designer-snap-tuning.d.ts +14 -0
- package/dist/_internal/engine/common/observability/designer-metrics.d.ts +1 -1
- package/dist/_internal/engine/common/operations/blueprint/designer-blueprint-capabilities.d.ts +1 -1
- package/dist/_internal/engine/common/operations/blueprint/designer-blueprint-graph.d.ts +5 -5
- package/dist/_internal/engine/common/operations/blueprint/designer-blueprint-model.d.ts +1 -1
- package/dist/_internal/engine/common/operations/blueprint/designer-blueprint-protocol-types.d.ts +2 -2
- package/dist/_internal/engine/common/operations/canvas/canvas-background-image.d.ts +1 -1
- package/dist/_internal/engine/common/operations/catalog/designer-catalog-refresh.d.ts +1 -1
- package/dist/_internal/engine/common/operations/change/designer-change-events.d.ts +2 -0
- package/dist/_internal/engine/common/operations/change/designer-change-proposal.d.ts +35 -2
- package/dist/_internal/engine/common/operations/designer-clipboard.d.ts +5 -1
- package/dist/_internal/engine/common/operations/designer-text-edit-operations.d.ts +1 -1
- package/dist/_internal/engine/common/operations/designer-variable-operations.d.ts +3 -3
- package/dist/_internal/engine/common/operations/display/designer-target-display.d.ts +2 -2
- package/dist/_internal/engine/common/operations/element/designer-element-operation-types.d.ts +1 -1
- package/dist/_internal/engine/common/operations/intent/designer-parameter-intent.d.ts +1 -1
- package/dist/_internal/engine/common/operations/material-component/material-component-fragment-extract.d.ts +2 -2
- package/dist/_internal/engine/common/operations/material-library/material-library-fragments.d.ts +1 -1
- package/dist/_internal/engine/common/operations/material-library/material-library-grouping.d.ts +1 -1
- package/dist/_internal/engine/common/operations/plugin/designer-plugin-commands.d.ts +2 -0
- package/dist/_internal/engine/common/operations/selection/designer-multi-selection-operations.d.ts +9 -9
- package/dist/_internal/engine/common/operations/style/designer-component-states.d.ts +12 -7
- package/dist/_internal/engine/common/operations/style/designer-material-appearance.d.ts +1 -1
- package/dist/_internal/engine/common/session/designer-artboard.d.ts +1 -1
- package/dist/_internal/engine/common/session/designer-session.d.ts +1 -1
- package/dist/_internal/engine/common/ui-text/designer-blueprint-ui-text.d.ts +3 -3
- package/dist/_internal/engine/common/ui-text/designer-ui-text.d.ts +127 -70
- package/dist/_internal/engine/{designer-blueprint-workbench-panel-CJ3iZo5v.js → designer-blueprint-workbench-panel-DVvKcSvJ.js} +269 -349
- package/dist/_internal/engine/{designer-dataset-controller-CrfOg2Ys.js → designer-dataset-controller-bSR5OB6n.js} +1512 -1348
- package/dist/_internal/engine/designer-element/api/designer-element-catalog.d.ts +2 -2
- package/dist/_internal/engine/designer-element/api/designer-element-change.d.ts +24 -0
- package/dist/_internal/engine/designer-element/api/designer-element-configuration-types.d.ts +4 -4
- package/dist/_internal/engine/designer-element/api/designer-element-fragment-save.d.ts +2 -2
- package/dist/_internal/engine/designer-element/api/designer-element-host-resource-selection.d.ts +1 -1
- package/dist/_internal/engine/designer-element/base-screen-designer-element.d.ts +21 -9
- package/dist/_internal/engine/designer-element/designer-element-public-api.d.ts +2 -1
- package/dist/_internal/engine/designer-element/runtime/designer-element-plugin-commands.d.ts +3 -3
- package/dist/_internal/engine/designer-element/runtime/designer-element-rendering.d.ts +3 -3
- package/dist/_internal/engine/designer-element/runtime/designer-element-runtime.d.ts +4 -1
- package/dist/_internal/engine/designer-element/runtime/designer-element-sample-data.d.ts +23 -0
- package/dist/_internal/engine/designer-element/runtime/designer-element-state.d.ts +7 -7
- package/dist/_internal/engine/{designer-field-primitives-KBZuWN_D.js → designer-field-primitives-C_StzrUa.js} +240 -180
- package/dist/_internal/engine/{designer-left-panel-groups-dom-N2OHOWjl.js → designer-left-panel-groups-dom-DBpI3Nc2.js} +19 -19
- package/dist/_internal/engine/{host-resource-selection-xo2mLCD4.js → host-resource-selection-BCRU23WQ.js} +446 -446
- package/dist/_internal/engine/index.js +5477 -4677
- package/dist/_internal/host-kit/index.d.ts +1 -0
- package/dist/_internal/host-kit/index.js +1 -0
- package/dist/_internal/host-kit/intent/index.d.ts +17 -0
- package/dist/_internal/host-kit/intent/index.js +14 -0
- package/dist/_internal/host-kit/intent/intent-behavior.d.ts +59 -0
- package/dist/_internal/host-kit/intent/intent-behavior.js +812 -0
- package/dist/_internal/host-kit/intent/intent-block.d.ts +66 -0
- package/dist/_internal/host-kit/intent/intent-block.js +438 -0
- package/dist/_internal/host-kit/intent/intent-catalog.d.ts +108 -0
- package/dist/_internal/host-kit/intent/intent-catalog.js +60 -0
- package/dist/_internal/host-kit/intent/intent-compile-types.d.ts +222 -0
- package/dist/_internal/host-kit/intent/intent-compile-types.js +10 -0
- package/dist/_internal/host-kit/intent/intent-compile.d.ts +35 -0
- package/dist/_internal/host-kit/intent/intent-compile.js +465 -0
- package/dist/_internal/host-kit/intent/intent-data-check.d.ts +50 -0
- package/dist/_internal/host-kit/intent/intent-data-check.js +163 -0
- package/dist/_internal/host-kit/intent/intent-data-context.d.ts +53 -0
- package/dist/_internal/host-kit/intent/intent-data-context.js +200 -0
- package/dist/_internal/host-kit/intent/intent-dataset.d.ts +52 -0
- package/dist/_internal/host-kit/intent/intent-dataset.js +125 -0
- package/dist/_internal/host-kit/intent/intent-format.d.ts +33 -0
- package/dist/_internal/host-kit/intent/intent-format.js +94 -0
- package/dist/_internal/host-kit/intent/intent-freeform.d.ts +48 -0
- package/dist/_internal/host-kit/intent/intent-freeform.js +412 -0
- package/dist/_internal/host-kit/intent/intent-kpi-bind.d.ts +29 -0
- package/dist/_internal/host-kit/intent/intent-kpi-bind.js +59 -0
- package/dist/_internal/host-kit/intent/intent-layout.d.ts +102 -0
- package/dist/_internal/host-kit/intent/intent-layout.js +264 -0
- package/dist/_internal/host-kit/intent/intent-parse.d.ts +41 -0
- package/dist/_internal/host-kit/intent/intent-parse.js +931 -0
- package/dist/_internal/host-kit/intent/intent-prepare.d.ts +55 -0
- package/dist/_internal/host-kit/intent/intent-prepare.js +156 -0
- package/dist/_internal/host-kit/intent/intent-session.d.ts +202 -0
- package/dist/_internal/host-kit/intent/intent-session.js +1001 -0
- package/dist/_internal/host-kit/intent/intent-stream.d.ts +28 -0
- package/dist/_internal/host-kit/intent/intent-stream.js +183 -0
- package/dist/_internal/host-kit/intent/intent-style.d.ts +37 -0
- package/dist/_internal/host-kit/intent/intent-style.js +77 -0
- package/dist/_internal/host-kit/intent/intent-types.d.ts +277 -0
- package/dist/_internal/host-kit/intent/intent-types.js +10 -0
- package/dist/_internal/host-kit/push-result.d.ts +1 -1
- package/dist/_internal/host-kit/push-result.js +1 -1
- package/dist/_internal/host-kit/sse-subscribe.d.ts +1 -1
- package/dist/_internal/host-kit/sse-subscribe.js +1 -1
- package/dist/_internal/host-kit/subscription-hub.d.ts +3 -3
- package/dist/_internal/host-kit/subscription-hub.js +1 -1
- package/dist/_internal/material/base-material.d.ts +3 -3
- package/dist/_internal/material/chart.js +34 -12
- package/dist/_internal/material/editor-descriptor.d.ts +3 -3
- package/dist/_internal/material/table.js +52 -21
- package/dist/_internal/plugin-core/contracts.d.ts +18 -16
- package/dist/_internal/plugin-core/contracts.js +1 -0
- package/dist/_internal/plugin-core/contribution-kind.d.ts +5 -5
- package/dist/_internal/plugin-core/contribution-kind.js +14 -6
- package/dist/_internal/plugin-core/editor/editor-descriptor-inference.d.ts +1 -1
- package/dist/_internal/plugin-core/editor/editor-descriptor-inference.js +2 -2
- package/dist/_internal/plugin-core/editor/editor-descriptor-items.d.ts +1 -1
- package/dist/_internal/plugin-core/editor/editor-descriptor-items.js +1 -1
- package/dist/_internal/plugin-core/editor/editor-descriptor-model.d.ts +2 -2
- package/dist/_internal/plugin-core/editor/editor-descriptor.js +1 -1
- package/dist/_internal/plugin-core/fragment/fragment.d.ts +4 -4
- package/dist/_internal/plugin-core/fragment/fragment.js +1 -1
- package/dist/_internal/plugin-core/material/material-manifest-fields.js +1 -1
- package/dist/_internal/plugin-core/material/material-manifest.js +1 -1
- package/dist/_internal/plugin-core/material/material-theme.d.ts +2 -2
- package/dist/_internal/plugin-core/material/material-theme.js +2 -2
- package/dist/_internal/plugin-manager/contribution-kind-plan.d.ts +5 -1
- package/dist/_internal/plugin-manager/contribution-kind-plan.js +20 -12
- package/dist/_internal/plugin-manager/manager.js +47 -30
- package/dist/_internal/plugin-manager/resolver.js +7 -13
- package/dist/_internal/plugin-manager/types.d.ts +2 -2
- package/dist/_internal/plugin-sdk/authoring-finding.d.ts +3 -3
- package/dist/_internal/plugin-sdk/fragment-audit.d.ts +6 -6
- package/dist/_internal/plugin-sdk/fragment-audit.js +8 -8
- package/dist/_internal/plugin-sdk/fragment-definition.d.ts +3 -3
- package/dist/_internal/plugin-sdk/fragment-definition.js +3 -3
- package/dist/_internal/plugin-sdk/index.d.ts +6 -0
- package/dist/_internal/plugin-sdk/index.js +6 -0
- package/dist/_internal/plugin-sdk/material-config-groups.d.ts +2 -2
- package/dist/_internal/plugin-sdk/material-definition.d.ts +5 -1
- package/dist/_internal/plugin-sdk/material-definition.js +3 -3
- package/dist/_internal/plugin-sdk/material-editor-audit.d.ts +9 -8
- package/dist/_internal/plugin-sdk/material-editor-audit.js +19 -11
- package/dist/_internal/plugin-sdk/material-isolated-csp.d.ts +38 -0
- package/dist/_internal/plugin-sdk/material-isolated-csp.js +67 -0
- package/dist/_internal/plugin-sdk/material-isolated-runtime.d.ts +22 -0
- package/dist/_internal/plugin-sdk/material-isolated-runtime.js +262 -0
- package/dist/_internal/plugin-sdk/material-isolated.d.ts +94 -0
- package/dist/_internal/plugin-sdk/material-isolated.js +1044 -0
- package/dist/_internal/plugin-sdk/material-package.d.ts +3 -3
- package/dist/_internal/plugin-sdk/material-package.js +7 -7
- package/dist/_internal/plugin-sdk/material-rendered-element.d.ts +22 -7
- package/dist/_internal/plugin-sdk/material-rendered-element.js +103 -10
- package/dist/_internal/plugin-sdk/material-spec-audit.d.ts +20 -10
- package/dist/_internal/plugin-sdk/material-spec-audit.js +108 -22
- package/dist/_internal/plugin-sdk/material-spec.d.ts +81 -16
- package/dist/_internal/plugin-sdk/material-spec.js +241 -42
- package/dist/_internal/plugin-sdk/material-style-keys.d.ts +6 -6
- package/dist/_internal/plugin-sdk/material-style-keys.js +7 -7
- package/dist/_internal/plugin-sdk/material-template-audit.d.ts +12 -0
- package/dist/_internal/plugin-sdk/material-template-audit.js +302 -0
- package/dist/_internal/plugin-sdk/material-template-expression.d.ts +98 -0
- package/dist/_internal/plugin-sdk/material-template-expression.js +549 -0
- package/dist/_internal/plugin-sdk/material-template-render.d.ts +32 -0
- package/dist/_internal/plugin-sdk/material-template-render.js +579 -0
- package/dist/_internal/plugin-sdk/material-template.d.ts +185 -0
- package/dist/_internal/plugin-sdk/material-template.js +879 -0
- package/dist/_internal/plugin-sdk/plugin-package.d.ts +2 -2
- package/dist/_internal/plugin-sdk/plugin-package.js +3 -3
- package/dist/_internal/plugin-sdk/plugin-registration.d.ts +2 -5
- package/dist/_internal/plugin-sdk/plugin-registration.js +3 -3
- package/dist/_internal/renderer/renderer/renderer-candidates.d.ts +1 -1
- package/dist/_internal/renderer/renderer/renderer-component-states.d.ts +1 -1
- package/dist/_internal/renderer/renderer/renderer-effective-style.d.ts +1 -1
- package/dist/_internal/renderer/renderer/renderer-material-dom.d.ts +1 -1
- package/dist/_internal/renderer/renderer/renderer-state.d.ts +2 -2
- package/dist/_internal/renderer/renderer/renderer-theme.d.ts +1 -1
- package/dist/_internal/renderer/renderer/renderer-types.d.ts +1 -1
- package/dist/_internal/renderer/renderer/renderer.d.ts +5 -5
- package/dist/_internal/renderer/resource/data-source-runtime.d.ts +3 -3
- package/dist/_internal/renderer/resource/push-window.d.ts +1 -1
- package/dist/_internal/renderer/resource/request-coordinator.d.ts +1 -1
- package/dist/_internal/renderer/resource/source-query-port.d.ts +3 -3
- package/dist/_internal/renderer/sub-canvas-layer.d.ts +2 -2
- package/dist/_internal/renderer/viewer/viewer-configuration.d.ts +1 -1
- package/dist/_internal/renderer/viewer/viewer.d.ts +3 -3
- package/dist/auto-register.js +10 -10
- package/dist/contracts.js +5 -5
- package/dist/contracts.js.map +1 -1
- package/dist/contrast-DRPezUIl.js +131 -0
- package/dist/contrast-DRPezUIl.js.map +1 -0
- package/dist/core.js +156 -136
- package/dist/core.js.map +1 -1
- package/dist/dataset-port-D993nOlT.js.map +1 -1
- package/dist/dataset-profile-Dk6xdtsM.js +261 -0
- package/dist/dataset-profile-Dk6xdtsM.js.map +1 -0
- package/dist/{designer-3Tb0EIDV.js → designer-DzBm8tXS.js} +2 -2
- package/dist/{designer-3Tb0EIDV.js.map → designer-DzBm8tXS.js.map} +1 -1
- package/dist/designer-auto-register.js +5 -5
- package/dist/{designer-blueprint-workbench-panel-CJ3iZo5v-BebifP4x.js → designer-blueprint-workbench-panel-DVvKcSvJ-CkRMBKZA.js} +452 -531
- package/dist/designer-blueprint-workbench-panel-DVvKcSvJ-CkRMBKZA.js.map +1 -0
- package/dist/{designer-dataset-controller-CrfOg2Ys-DhKUEJJe.js → designer-dataset-controller-bSR5OB6n-DfUP24S6.js} +1355 -1191
- package/dist/designer-dataset-controller-bSR5OB6n-DfUP24S6.js.map +1 -0
- package/dist/{designer-field-primitives-KBZuWN_D-B3h4jpYe.js → designer-field-primitives-C_StzrUa-QZpcn0yX.js} +241 -181
- package/dist/designer-field-primitives-C_StzrUa-QZpcn0yX.js.map +1 -0
- package/dist/{designer-left-panel-groups-dom-N2OHOWjl-D8CzGwbF.js → designer-left-panel-groups-dom-DBpI3Nc2-D8kYJLCg.js} +18 -18
- package/dist/{designer-left-panel-groups-dom-N2OHOWjl-D8CzGwbF.js.map → designer-left-panel-groups-dom-DBpI3Nc2-D8kYJLCg.js.map} +1 -1
- package/dist/designer.js +5 -5
- package/dist/{dist-6GRboBs-.js → dist-B2bW2Tru.js} +4 -4
- package/dist/{dist-6GRboBs-.js.map → dist-B2bW2Tru.js.map} +1 -1
- package/dist/{dist-BjLjFUy1.js → dist-YCmniYuO.js} +5636 -4838
- package/dist/dist-YCmniYuO.js.map +1 -0
- package/dist/engine.js +5 -5
- package/dist/{fragment-Y6YnW6wy.js → fragment-B-oP0Fru.js} +3 -3
- package/dist/fragment-B-oP0Fru.js.map +1 -0
- package/dist/host-kit.js +4388 -187
- package/dist/host-kit.js.map +1 -1
- package/dist/{host-resource-selection-xo2mLCD4-BR5XCcim.js → host-resource-selection-BCRU23WQ-Cedz0d14.js} +208 -208
- package/dist/host-resource-selection-BCRU23WQ-Cedz0d14.js.map +1 -0
- package/dist/image-url-D6mUcjY1.js.map +1 -1
- package/dist/index.js +10 -10
- package/dist/legibility-CS28ivEz.js +12 -0
- package/dist/legibility-CS28ivEz.js.map +1 -0
- package/dist/{level-scale-BzUjE31V.js → level-scale-CwHqFEVd.js} +2 -2
- package/dist/level-scale-CwHqFEVd.js.map +1 -0
- package/dist/{manager-Ch0RTu_i.js → manager-BcvdcZjM.js} +230 -210
- package/dist/manager-BcvdcZjM.js.map +1 -0
- package/dist/{material-UbSfiuZq.js → material-ReRzBIbb.js} +2 -2
- package/dist/{material-UbSfiuZq.js.map → material-ReRzBIbb.js.map} +1 -1
- package/dist/material-auto-register.js +1 -1
- package/dist/{material-definition-BeW34dJr.js → material-definition-BcjFM-B-.js} +9 -9
- package/dist/material-definition-BcjFM-B-.js.map +1 -0
- package/dist/material-manifest-B1XatGPx.js.map +1 -1
- package/dist/material-theme-C91eus78.js.map +1 -1
- package/dist/material.js +2 -2
- package/dist/{migrate-document-D3HhCVlZ.js → migrate-document-BM888PtC.js} +2 -2
- package/dist/migrate-document-BM888PtC.js.map +1 -0
- package/dist/{parse-B1OD1teS.js → parse-1U_-Qtn4.js} +4 -4
- package/dist/parse-1U_-Qtn4.js.map +1 -0
- package/dist/{parse-AOTE9WnD.js → parse-Ji7kE9ZT.js} +9 -4
- package/dist/parse-Ji7kE9ZT.js.map +1 -0
- package/dist/{parse-parts-BNrpdG5o.js → parse-parts-qzl4suzk.js} +2 -2
- package/dist/{parse-parts-BNrpdG5o.js.map → parse-parts-qzl4suzk.js.map} +1 -1
- package/dist/{plugin-DHgh9uHh.js → plugin-BH-4oNvT.js} +63 -55
- package/dist/plugin-BH-4oNvT.js.map +1 -0
- package/dist/plugin-core.js +2 -2
- package/dist/plugin-manager.js +1 -1
- package/dist/plugin-package-Cj-3iLv3.js +4369 -0
- package/dist/plugin-package-Cj-3iLv3.js.map +1 -0
- package/dist/{plugin-registration-rsmb4GvS.js → plugin-registration-C9_IxTxc.js} +9 -9
- package/dist/{plugin-registration-rsmb4GvS.js.map → plugin-registration-C9_IxTxc.js.map} +1 -1
- package/dist/plugin-sdk.js +6 -6
- package/dist/{plugins-DGRHgREK.js → plugins-CwATlfr0.js} +2 -2
- package/dist/{plugins-DGRHgREK.js.map → plugins-CwATlfr0.js.map} +1 -1
- package/dist/plugins.js +8 -8
- package/dist/renderer.js +1 -1
- package/dist/{runtime-dispatch-BfnRDtMe.js → runtime-dispatch-C0gyIrTv.js} +2 -2
- package/dist/runtime-dispatch-C0gyIrTv.js.map +1 -0
- package/dist/runtime-simulate-aSYO9yDX.js +147 -0
- package/dist/runtime-simulate-aSYO9yDX.js.map +1 -0
- package/dist/{src-Bm7u11mN-_0u6cMEw.js → src-Bm7u11mN-DFLnFQSk.js} +39 -39
- package/dist/{src-Bm7u11mN-_0u6cMEw.js.map → src-Bm7u11mN-DFLnFQSk.js.map} +1 -1
- package/dist/state-preset-DtpygJOH.js +22 -0
- package/dist/state-preset-DtpygJOH.js.map +1 -0
- package/dist/{text-BNksUr5J.js → text-DfKom8EG.js} +88 -35
- package/dist/text-DfKom8EG.js.map +1 -0
- package/dist/theme-CcBXf4Ay.js.map +1 -1
- package/dist/{value-ref-BG_MV9C-.js → value-ref-XkLuckGV.js} +2 -2
- package/dist/{value-ref-BG_MV9C-.js.map → value-ref-XkLuckGV.js.map} +1 -1
- package/dist/{viewer-CrJupI8I-D9dVcNw4.js → viewer-CrJupI8I-CeQS58mA.js} +5 -5
- package/dist/{viewer-CrJupI8I-D9dVcNw4.js.map → viewer-CrJupI8I-CeQS58mA.js.map} +1 -1
- package/dist/viewer-auto-register.js +2 -2
- package/dist/viewer.js +2 -2
- package/dist/{viewport-CiCKeAQH.js → viewport-BNIRWjiT.js} +354 -155
- package/dist/viewport-BNIRWjiT.js.map +1 -0
- package/package.json +12 -12
- package/dist/designer-blueprint-workbench-panel-CJ3iZo5v-BebifP4x.js.map +0 -1
- package/dist/designer-dataset-controller-CrfOg2Ys-DhKUEJJe.js.map +0 -1
- package/dist/designer-field-primitives-KBZuWN_D-B3h4jpYe.js.map +0 -1
- package/dist/dist-BjLjFUy1.js.map +0 -1
- package/dist/fragment-Y6YnW6wy.js.map +0 -1
- package/dist/host-resource-selection-xo2mLCD4-BR5XCcim.js.map +0 -1
- package/dist/level-scale-BzUjE31V.js.map +0 -1
- package/dist/manager-Ch0RTu_i.js.map +0 -1
- package/dist/material-definition-BeW34dJr.js.map +0 -1
- package/dist/migrate-document-D3HhCVlZ.js.map +0 -1
- package/dist/parse-AOTE9WnD.js.map +0 -1
- package/dist/parse-B1OD1teS.js.map +0 -1
- package/dist/plugin-DHgh9uHh.js.map +0 -1
- package/dist/plugin-package-Dr5ro6h6.js +0 -1221
- package/dist/plugin-package-Dr5ro6h6.js.map +0 -1
- package/dist/runtime-dispatch-BfnRDtMe.js.map +0 -1
- package/dist/text-BNksUr5J.js.map +0 -1
- package/dist/viewport-CiCKeAQH.js.map +0 -1
|
@@ -0,0 +1,1001 @@
|
|
|
1
|
+
import { compileScreenIntent } from './intent-compile.js';
|
|
2
|
+
import { detectIntentLanguage, formatKpiValue } from './intent-format.js';
|
|
3
|
+
import { clampText, parseIntentBlock, parseIntentKpi, parseScreenIntentInteractions, } from './intent-parse.js';
|
|
4
|
+
export function createIntentSession(input) {
|
|
5
|
+
return {
|
|
6
|
+
intent: withIdents(input.intent),
|
|
7
|
+
compiled: input.compiled,
|
|
8
|
+
catalog: input.catalog,
|
|
9
|
+
references: input.references,
|
|
10
|
+
mode: input.mode,
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
/** 会话只在画布没换尺寸时可靠:几何基线变了,差量就没有意义。 */
|
|
14
|
+
export function isSessionUsable(session, baseline) {
|
|
15
|
+
const canvas = session.compiled.document.canvas;
|
|
16
|
+
return canvas.width === baseline.canvas.width && canvas.height === baseline.canvas.height;
|
|
17
|
+
}
|
|
18
|
+
export function editIntent(session, rawOps, baseline) {
|
|
19
|
+
const applied = applyIntentOps(session.intent, rawOps, session.catalog);
|
|
20
|
+
if (!applied.ok)
|
|
21
|
+
return applied;
|
|
22
|
+
const compiled = compileScreenIntent({
|
|
23
|
+
intent: applied.intent,
|
|
24
|
+
catalog: session.catalog,
|
|
25
|
+
mode: session.mode,
|
|
26
|
+
...(session.references === undefined ? {} : { references: session.references }),
|
|
27
|
+
});
|
|
28
|
+
if (!compiled.ok)
|
|
29
|
+
return { ok: false, diagnostics: compiled.diagnostics };
|
|
30
|
+
const before = session.compiled.document;
|
|
31
|
+
const after = compiled.value.document;
|
|
32
|
+
const live = new Map(baseline.components.map((component) => [component.id, component]));
|
|
33
|
+
const previous = new Map(before.components.map((component) => [component.id, component]));
|
|
34
|
+
const next = new Map(after.components.map((component) => [component.id, component]));
|
|
35
|
+
// 用户改过:活文档里有、且与上次编译的产物不同(zIndex 不比:整屏替换时会整体抬高层级)。
|
|
36
|
+
const touched = new Set();
|
|
37
|
+
const gone = new Set();
|
|
38
|
+
for (const [id, old] of previous) {
|
|
39
|
+
const current = live.get(id);
|
|
40
|
+
if (current === undefined)
|
|
41
|
+
gone.add(id);
|
|
42
|
+
else if (!sameComponent(old, current))
|
|
43
|
+
touched.add(id);
|
|
44
|
+
}
|
|
45
|
+
const removed = [...previous.keys()].filter((id) => !next.has(id));
|
|
46
|
+
const added = after.components.filter((component) => !previous.has(component.id));
|
|
47
|
+
const changed = after.components.filter((component) => {
|
|
48
|
+
const old = previous.get(component.id);
|
|
49
|
+
return old !== undefined && !sameComponent(old, component);
|
|
50
|
+
});
|
|
51
|
+
const keptForUser = new Set();
|
|
52
|
+
const commands = [];
|
|
53
|
+
const removable = removed.filter((id) => !gone.has(id) && !touched.has(id));
|
|
54
|
+
for (const id of removed)
|
|
55
|
+
if (touched.has(id))
|
|
56
|
+
keptForUser.add(id);
|
|
57
|
+
// 物料换了(`swap`):`update-components` 改不了 `type`,所以换掉的组件先移除再用同一个 id 新增,
|
|
58
|
+
// 层级沿用它在活文档里的,位置与大小由新编译给出。用户改过的不换,原样保留。
|
|
59
|
+
const replaced = changed.filter((component) => !gone.has(component.id) &&
|
|
60
|
+
!touched.has(component.id) &&
|
|
61
|
+
previous.get(component.id)?.type !== component.type);
|
|
62
|
+
const replacedIds = new Set(replaced.map((component) => component.id));
|
|
63
|
+
// 换了取值来源的组件(`rebind`):物料没变、走 `update-components`,但它引用的数据源
|
|
64
|
+
// 也是新编出来的,要和新增组件一起按内容复用 / 换 id,否则补丁会指向活文档里不存在的实例。
|
|
65
|
+
//
|
|
66
|
+
// 每次编译数据源都从 `agent-ds-1` 重新编号:删掉前面一块之后,后面的块读的还是同一个实例,只是编号前移了。
|
|
67
|
+
// 这种「只是编号变了」的不算换来源,组件继续读活文档里的那个实例(`sameSource`),不新建重复实例。
|
|
68
|
+
// 比较时忽略引用智能体变量的参数:联动的增减不改变「读的是哪份数据」。
|
|
69
|
+
const sameSource = new Map();
|
|
70
|
+
const beforeSources = new Map((before.dataSources ?? []).map((item) => [String(item.id), item]));
|
|
71
|
+
const afterSources = new Map((after.dataSources ?? []).map((item) => [String(item.id), item]));
|
|
72
|
+
for (const component of changed) {
|
|
73
|
+
const oldId = dataSourceIdOf(previous.get(component.id)?.dataValue);
|
|
74
|
+
const newId = dataSourceIdOf(component.dataValue);
|
|
75
|
+
const liveId = dataSourceIdOf(live.get(component.id)?.dataValue);
|
|
76
|
+
if (oldId === undefined || newId === undefined || liveId === undefined || oldId === newId)
|
|
77
|
+
continue;
|
|
78
|
+
if (sameSource.has(newId))
|
|
79
|
+
continue;
|
|
80
|
+
if (sameSourceContent(beforeSources.get(oldId), afterSources.get(newId))) {
|
|
81
|
+
sameSource.set(newId, liveId);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
const rebound = changed.filter((component) => {
|
|
85
|
+
if (gone.has(component.id) || touched.has(component.id) || replacedIds.has(component.id))
|
|
86
|
+
return false;
|
|
87
|
+
const value = component.dataValue;
|
|
88
|
+
return (typeof value?.dataSourceId === 'string' &&
|
|
89
|
+
!sameSource.has(value.dataSourceId) &&
|
|
90
|
+
JSON.stringify(previous.get(component.id)?.dataValue ?? null) !== JSON.stringify(value));
|
|
91
|
+
});
|
|
92
|
+
// 新增组件用到的数据源:按内容复用,冲突就换个 id。
|
|
93
|
+
const dataSources = remapDataSources(after, [...added, ...replaced, ...rebound], baseline.dataSources ?? [], sameSource);
|
|
94
|
+
// 联动:只动智能体生成的变量与连线,用按 id 的局部命令写。命令按这个顺序排,
|
|
95
|
+
// 每一步都没有悬空引用:摘旧连线 → 摘掉对将删变量的引用 → 删变量 → 加变量 →(版面的新数据源)
|
|
96
|
+
// → 接上对新变量的引用 →(版面的组件)→ 加新连线。
|
|
97
|
+
const behavior = behaviorEdit(before, after, baseline, live);
|
|
98
|
+
const layoutIndexes = [];
|
|
99
|
+
const behaviorIndexes = [];
|
|
100
|
+
const pushBehavior = (items) => {
|
|
101
|
+
for (const command of items) {
|
|
102
|
+
behaviorIndexes.push(commands.length);
|
|
103
|
+
commands.push(command);
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
const pushLayout = (command) => {
|
|
107
|
+
layoutIndexes.push(commands.length);
|
|
108
|
+
commands.push(command);
|
|
109
|
+
};
|
|
110
|
+
pushBehavior(behavior.detach);
|
|
111
|
+
if (dataSources.fresh.length > 0) {
|
|
112
|
+
pushLayout({ type: 'add-data-sources', dataSources: dataSources.fresh });
|
|
113
|
+
}
|
|
114
|
+
pushBehavior(behavior.attach);
|
|
115
|
+
const layerBase = baseline.components.reduce((max, component) => Math.max(max, component.zIndex ?? 0), 0);
|
|
116
|
+
for (const component of changed) {
|
|
117
|
+
if (gone.has(component.id))
|
|
118
|
+
continue;
|
|
119
|
+
if (touched.has(component.id)) {
|
|
120
|
+
keptForUser.add(component.id);
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
if (replacedIds.has(component.id))
|
|
124
|
+
continue;
|
|
125
|
+
const patch = diffPatch(dataSources.applyPrevious(previous.get(component.id)), dataSources.apply(component));
|
|
126
|
+
// 只是数据源编号变了、映射回活文档后完全一致的组件:没有要改的。
|
|
127
|
+
if (Object.keys(patch).length === 0)
|
|
128
|
+
continue;
|
|
129
|
+
pushLayout({ type: 'update-components', componentIds: [component.id], patch });
|
|
130
|
+
}
|
|
131
|
+
const removals = [...removable, ...replacedIds];
|
|
132
|
+
if (removals.length > 0)
|
|
133
|
+
pushLayout({ type: 'remove-components', componentIds: removals });
|
|
134
|
+
for (const component of replaced) {
|
|
135
|
+
pushLayout({
|
|
136
|
+
type: 'add-component',
|
|
137
|
+
component: dataSources.apply({
|
|
138
|
+
...component,
|
|
139
|
+
zIndex: live.get(component.id)?.zIndex ?? component.zIndex + layerBase,
|
|
140
|
+
}),
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
for (const component of added) {
|
|
144
|
+
pushLayout({
|
|
145
|
+
type: 'add-component',
|
|
146
|
+
component: dataSources.apply({ ...component, zIndex: component.zIndex + layerBase }),
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
pushBehavior(behavior.wire);
|
|
150
|
+
const language = detectIntentLanguage(applied.intent.title, applied.intent.subtitle);
|
|
151
|
+
const notes = behaviorNotes(session.compiled.behaviors, compiled.value.behaviors, language);
|
|
152
|
+
const groups = layoutIndexes.length > 0 && behaviorIndexes.length > 0
|
|
153
|
+
? [
|
|
154
|
+
{
|
|
155
|
+
label: language === 'en' ? 'Layout and content' : '版面与内容',
|
|
156
|
+
commandIndexes: layoutIndexes,
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
label: language === 'en' ? 'Interactions' : '联动',
|
|
160
|
+
commandIndexes: behaviorIndexes,
|
|
161
|
+
...(notes.length === 0 ? {} : { notes }),
|
|
162
|
+
},
|
|
163
|
+
]
|
|
164
|
+
: undefined;
|
|
165
|
+
return {
|
|
166
|
+
ok: true,
|
|
167
|
+
session: {
|
|
168
|
+
...session,
|
|
169
|
+
intent: applied.intent,
|
|
170
|
+
compiled: compiled.value,
|
|
171
|
+
},
|
|
172
|
+
commands,
|
|
173
|
+
keptForUser: [...keptForUser],
|
|
174
|
+
summary: {
|
|
175
|
+
changed: changed.filter((component) => !touched.has(component.id) && !gone.has(component.id))
|
|
176
|
+
.length,
|
|
177
|
+
added: added.length,
|
|
178
|
+
removed: removable.length,
|
|
179
|
+
},
|
|
180
|
+
warnings: compiled.value.warnings,
|
|
181
|
+
...(groups === undefined ? {} : { groups }),
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
/** 联动单元的可读说明:新增与去掉的联动(状态随组件走,不在这里)。 */
|
|
185
|
+
function behaviorNotes(before, after, language) {
|
|
186
|
+
const text = (item) => language === 'en'
|
|
187
|
+
? `${item.from}: ${item.detail} ${item.to.join(', ')}`
|
|
188
|
+
: `点「${item.from}」${item.detail}「${item.to.join('」「')}」`;
|
|
189
|
+
const key = (item) => JSON.stringify([item.kind, item.from, item.to, item.detail]);
|
|
190
|
+
const links = (list) => list.filter((item) => item.kind !== 'state');
|
|
191
|
+
const old = new Set(links(before).map(key));
|
|
192
|
+
const now = new Set(links(after).map(key));
|
|
193
|
+
return [
|
|
194
|
+
...links(after)
|
|
195
|
+
.filter((item) => !old.has(key(item)))
|
|
196
|
+
.map((item) => `${language === 'en' ? 'Add' : '新增'}:${text(item)}`),
|
|
197
|
+
...links(before)
|
|
198
|
+
.filter((item) => !now.has(key(item)))
|
|
199
|
+
.map((item) => `${language === 'en' ? 'Remove' : '去掉'}:${text(item)}`),
|
|
200
|
+
];
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* 把操作列表依次应用到 IR 上:要么全部应用,要么一个都不应用(失败时返回带路径的诊断)。
|
|
204
|
+
* 目标是稳定标识(`ident ?? origin`):`title` / `subtitle` / 指标 / 块的模型原文路径。
|
|
205
|
+
*/
|
|
206
|
+
export function applyIntentOps(intent, rawOps, catalog) {
|
|
207
|
+
let current = withIdents(intent);
|
|
208
|
+
for (const [index, raw] of rawOps.entries()) {
|
|
209
|
+
const path = `ops[${index}]`;
|
|
210
|
+
const op = readOp(raw);
|
|
211
|
+
if (op === undefined) {
|
|
212
|
+
return fail(path, 'INTENT_OP_INVALID', 'Unknown or malformed operation.');
|
|
213
|
+
}
|
|
214
|
+
const result = applyOne(current, op, catalog, path);
|
|
215
|
+
if (!result.ok)
|
|
216
|
+
return result;
|
|
217
|
+
current = result.intent;
|
|
218
|
+
}
|
|
219
|
+
if (!current.regions.some(hasBlocks)) {
|
|
220
|
+
return fail('ops', 'INTENT_OP_INVALID', 'An edit may not leave the screen without any block.');
|
|
221
|
+
}
|
|
222
|
+
return { ok: true, intent: current };
|
|
223
|
+
}
|
|
224
|
+
function applyOne(intent, op, catalog, path) {
|
|
225
|
+
if (op.op === 'add')
|
|
226
|
+
return addBlock(intent, op, catalog, path);
|
|
227
|
+
if (op.op === 'link')
|
|
228
|
+
return linkInteraction(intent, op, path);
|
|
229
|
+
if (op.op === 'unlink')
|
|
230
|
+
return unlinkInteraction(intent, op, path);
|
|
231
|
+
if (op.target === 'title' || op.target === 'subtitle') {
|
|
232
|
+
if (op.op !== 'change') {
|
|
233
|
+
return fail(path, 'INTENT_OP_INVALID', 'The title and subtitle can only be changed.');
|
|
234
|
+
}
|
|
235
|
+
const text = typeof op.set.text === 'string' ? op.set.text.trim() : '';
|
|
236
|
+
if (text === '')
|
|
237
|
+
return fail(path, 'INTENT_OP_INVALID', 'A title change needs non-empty text.');
|
|
238
|
+
return {
|
|
239
|
+
ok: true,
|
|
240
|
+
intent: {
|
|
241
|
+
...intent,
|
|
242
|
+
[op.target]: clampText(text, op.target === 'title' ? 20 : 40),
|
|
243
|
+
},
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
const found = locate(intent, op.target);
|
|
247
|
+
if (found === undefined) {
|
|
248
|
+
return fail(path, 'INTENT_OP_TARGET_UNKNOWN', `No item is addressed by "${op.target}".`);
|
|
249
|
+
}
|
|
250
|
+
if (op.op === 'delete')
|
|
251
|
+
return { ok: true, intent: pruneInteractions(removeItem(intent, found), found) };
|
|
252
|
+
if (op.op === 'rebind')
|
|
253
|
+
return rebindItem(intent, found, op, catalog, path);
|
|
254
|
+
// 不认识的字段整批拒绝:静默忽略会让「把名字改成订单量」写成 `name` 时看起来成功、实际什么也没改。
|
|
255
|
+
if (op.op === 'change') {
|
|
256
|
+
// 指标阈值的简写:模型常把 `{ rules, suggested }` 直接写在 set 上,等同于 `states`。
|
|
257
|
+
// 也见过 `states: [...]` 配顶层 `suggested`:都折成 `states: { rules, suggested? }`。
|
|
258
|
+
if (found.kpi !== undefined && (Array.isArray(op.set.rules) || 'suggested' in op.set)) {
|
|
259
|
+
const { rules, suggested, states, ...rest } = op.set;
|
|
260
|
+
const base = Array.isArray(states)
|
|
261
|
+
? { rules: states }
|
|
262
|
+
: states !== null && typeof states === 'object'
|
|
263
|
+
? states
|
|
264
|
+
: Array.isArray(rules)
|
|
265
|
+
? { rules }
|
|
266
|
+
: undefined;
|
|
267
|
+
if (base !== undefined) {
|
|
268
|
+
op = {
|
|
269
|
+
...op,
|
|
270
|
+
set: { ...rest, states: suggested === true ? { ...base, suggested: true } : base },
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
const allowed = found.kpi !== undefined ? KPI_FIELDS : BLOCK_FIELDS;
|
|
275
|
+
const unknown = Object.keys(op.set).filter((key) => !allowed.has(key));
|
|
276
|
+
if (unknown.length > 0) {
|
|
277
|
+
return fail(path, 'INTENT_OP_INVALID', `Unknown field(s) ${unknown.join(', ')}; a ${found.kpi !== undefined ? 'KPI' : 'block'} change may set ${[...allowed].join(' / ')}.`);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
if (found.kpi !== undefined) {
|
|
281
|
+
if (op.op !== 'change')
|
|
282
|
+
return fail(path, 'INTENT_OP_INVALID', 'A KPI can only be changed or deleted.');
|
|
283
|
+
const merged = { ...kpiToRaw(found.kpi), ...op.set };
|
|
284
|
+
// 兜底占位(值为 null)的指标改别的字段时允许继续是占位;模型给的 null 仍算不合格。
|
|
285
|
+
const parsed = parseIntentKpi(merged, found.kpi.origin, {
|
|
286
|
+
placeholders: found.kpi.value === null,
|
|
287
|
+
});
|
|
288
|
+
if (parsed.value === undefined)
|
|
289
|
+
return fail(path, 'INTENT_OP_FAILED', 'The changed KPI is not usable.');
|
|
290
|
+
return {
|
|
291
|
+
ok: true,
|
|
292
|
+
intent: replaceItem(intent, found, {
|
|
293
|
+
...parsed.value,
|
|
294
|
+
ident: found.kpi.ident ?? found.kpi.origin,
|
|
295
|
+
}),
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
const block = found.block;
|
|
299
|
+
const raw = op.op === 'swap'
|
|
300
|
+
? // 换物料后角色可能不同:显式字段作废,交给编译器按列类型重新分配。
|
|
301
|
+
{ ...withoutFields(blockToRaw(block)), type: op.type, props: op.props }
|
|
302
|
+
: { ...blockToRaw(block), ...op.set };
|
|
303
|
+
const parsed = parseIntentBlock(raw, catalog, block.origin, { grid: found.grid });
|
|
304
|
+
const errors = parsed.diagnostics.filter((item) => item.severity === 'error');
|
|
305
|
+
if (parsed.value === undefined || errors.length > 0) {
|
|
306
|
+
return fail(path, 'INTENT_OP_FAILED', `The edited block is not usable (${errors[0]?.code ?? 'unknown'}).`);
|
|
307
|
+
}
|
|
308
|
+
// 换物料时 `span` 不变:版面位置是用户看到并认可的,不因为换了图表类型就挪。
|
|
309
|
+
return {
|
|
310
|
+
ok: true,
|
|
311
|
+
intent: replaceItem(intent, found, {
|
|
312
|
+
...parsed.value,
|
|
313
|
+
span: block.span,
|
|
314
|
+
ident: block.ident ?? block.origin,
|
|
315
|
+
}),
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
/** 换数据绑定:保留标题、说明、参数与版面位置,只换取值来源(与 `swap` 一样不动 `span`)。 */
|
|
319
|
+
function rebindItem(intent, found, op, catalog, path) {
|
|
320
|
+
if (found.kpi !== undefined) {
|
|
321
|
+
const parsed = parseIntentKpi({
|
|
322
|
+
label: found.kpi.label,
|
|
323
|
+
...(found.kpi.unit === undefined ? {} : { unit: found.kpi.unit }),
|
|
324
|
+
...(found.kpi.key === undefined ? {} : { key: found.kpi.key }),
|
|
325
|
+
...(found.kpi.states === undefined ? {} : { states: found.kpi.states }),
|
|
326
|
+
bind: op.bind,
|
|
327
|
+
}, found.kpi.origin);
|
|
328
|
+
if (parsed.value === undefined)
|
|
329
|
+
return fail(path, 'INTENT_OP_FAILED', 'The rebound KPI is not usable.');
|
|
330
|
+
return {
|
|
331
|
+
ok: true,
|
|
332
|
+
intent: replaceItem(intent, found, { ...parsed.value, ident: idOf(found.kpi) }),
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
const block = found.block;
|
|
336
|
+
const { table: _table, datasetId: _datasetId, fields: _fields, params: _params, text: _text, assetId: _assetId, ...kept } = blockToRaw(block);
|
|
337
|
+
const candidate = typeof op.bind.candidate === 'string' ? op.bind.candidate : undefined;
|
|
338
|
+
const raw = candidate !== undefined
|
|
339
|
+
? { ...kept, candidate, ...(isRecord(op.bind.params) ? { params: op.bind.params } : {}) }
|
|
340
|
+
: {
|
|
341
|
+
...kept,
|
|
342
|
+
...(typeof op.bind.type === 'string' ? { type: op.bind.type } : {}),
|
|
343
|
+
datasetId: op.bind.datasetId,
|
|
344
|
+
...(op.bind.fields === undefined ? {} : { fields: op.bind.fields }),
|
|
345
|
+
...(op.bind.params === undefined ? {} : { params: op.bind.params }),
|
|
346
|
+
};
|
|
347
|
+
const parsed = parseIntentBlock(raw, catalog, block.origin, { grid: found.grid });
|
|
348
|
+
const errors = parsed.diagnostics.filter((item) => item.severity === 'error');
|
|
349
|
+
if (parsed.value === undefined || errors.length > 0) {
|
|
350
|
+
return fail(path, 'INTENT_OP_FAILED', `The rebound block is not usable (${errors[0]?.code ?? 'unknown'}).`);
|
|
351
|
+
}
|
|
352
|
+
return {
|
|
353
|
+
ok: true,
|
|
354
|
+
intent: replaceItem(intent, found, { ...parsed.value, span: block.span, ident: idOf(block) }),
|
|
355
|
+
};
|
|
356
|
+
}
|
|
357
|
+
function addBlock(intent, op, catalog, path) {
|
|
358
|
+
const regionIndex = intent.regions.findIndex((region) => region.origin === op.region);
|
|
359
|
+
const region = intent.regions[regionIndex];
|
|
360
|
+
if (region === undefined || region.kind === 'band') {
|
|
361
|
+
return fail(path, 'INTENT_OP_TARGET_UNKNOWN', `"${op.region}" is not a region that holds blocks.`);
|
|
362
|
+
}
|
|
363
|
+
const part = region.kind === 'grid' ? 'blocks' : op.part === 'rail' ? 'rail' : 'main';
|
|
364
|
+
const list = region.kind === 'grid' ? region.blocks : region[part === 'rail' ? 'rail' : 'main'];
|
|
365
|
+
const index = nextIndex(list.map((block) => block.ident ?? block.origin));
|
|
366
|
+
const origin = `${region.origin === 'blocks' ? 'blocks' : `${region.origin}.${part}`}[${index}]`;
|
|
367
|
+
const parsed = parseIntentBlock(op.block, catalog, origin, { grid: region.kind === 'grid' });
|
|
368
|
+
const errors = parsed.diagnostics.filter((item) => item.severity === 'error');
|
|
369
|
+
if (parsed.value === undefined || errors.length > 0) {
|
|
370
|
+
return fail(path, 'INTENT_OP_FAILED', `The new block is not usable (${errors[0]?.code ?? 'unknown'}).`);
|
|
371
|
+
}
|
|
372
|
+
const block = { ...parsed.value, ident: origin };
|
|
373
|
+
const regions = intent.regions.map((candidate, position) => {
|
|
374
|
+
if (position !== regionIndex)
|
|
375
|
+
return candidate;
|
|
376
|
+
if (candidate.kind === 'grid')
|
|
377
|
+
return { ...candidate, blocks: [...candidate.blocks, block] };
|
|
378
|
+
if (candidate.kind === 'split') {
|
|
379
|
+
return part === 'rail'
|
|
380
|
+
? { ...candidate, rail: [...candidate.rail, block] }
|
|
381
|
+
: { ...candidate, main: [...candidate.main, block] };
|
|
382
|
+
}
|
|
383
|
+
return candidate;
|
|
384
|
+
});
|
|
385
|
+
return { ok: true, intent: { ...intent, regions } };
|
|
386
|
+
}
|
|
387
|
+
// ---------------------------------------------------------------------------
|
|
388
|
+
// 定位、替换、删除
|
|
389
|
+
// ---------------------------------------------------------------------------
|
|
390
|
+
/** `change` 能改的字段:与提示词里写给模型的一致。 */
|
|
391
|
+
const KPI_FIELDS = new Set(['label', 'value', 'unit', 'precision', 'delta', 'states', 'key']);
|
|
392
|
+
const BLOCK_FIELDS = new Set(['title', 'note', 'text', 'table', 'props', 'substituteFor', 'key']);
|
|
393
|
+
const idOf = (item) => item.ident ?? item.origin;
|
|
394
|
+
function locate(intent, target) {
|
|
395
|
+
for (const [regionIndex, region] of intent.regions.entries()) {
|
|
396
|
+
if (region.kind === 'band') {
|
|
397
|
+
const itemIndex = region.items.findIndex((item) => idOf(item) === target);
|
|
398
|
+
const kpi = region.items[itemIndex];
|
|
399
|
+
if (kpi !== undefined)
|
|
400
|
+
return { regionIndex, part: 'items', itemIndex, grid: false, kpi };
|
|
401
|
+
continue;
|
|
402
|
+
}
|
|
403
|
+
const parts = region.kind === 'grid' ? ['blocks'] : ['main', 'rail'];
|
|
404
|
+
for (const part of parts) {
|
|
405
|
+
const list = region.kind === 'grid' ? region.blocks : region[part];
|
|
406
|
+
const itemIndex = list.findIndex((item) => idOf(item) === target);
|
|
407
|
+
const block = list[itemIndex];
|
|
408
|
+
if (block !== undefined) {
|
|
409
|
+
return { regionIndex, part, itemIndex, grid: region.kind === 'grid', block };
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
return undefined;
|
|
414
|
+
}
|
|
415
|
+
function replaceItem(intent, found, item) {
|
|
416
|
+
return {
|
|
417
|
+
...intent,
|
|
418
|
+
regions: intent.regions.map((region, position) => {
|
|
419
|
+
if (position !== found.regionIndex)
|
|
420
|
+
return region;
|
|
421
|
+
const swap = (list) => list.map((candidate, index) => (index === found.itemIndex ? item : candidate));
|
|
422
|
+
if (region.kind === 'band')
|
|
423
|
+
return { ...region, items: swap(region.items) };
|
|
424
|
+
if (region.kind === 'grid')
|
|
425
|
+
return { ...region, blocks: swap(region.blocks) };
|
|
426
|
+
return found.part === 'rail'
|
|
427
|
+
? { ...region, rail: swap(region.rail) }
|
|
428
|
+
: { ...region, main: swap(region.main) };
|
|
429
|
+
}),
|
|
430
|
+
};
|
|
431
|
+
}
|
|
432
|
+
/**
|
|
433
|
+
* 删一项。区域因此空了就去掉区域;`split` 一栏空了就把剩下的块并成栅格(每块占满四列),
|
|
434
|
+
* 而不是留一个只有一栏的主侧栏。
|
|
435
|
+
*/
|
|
436
|
+
function removeItem(intent, found) {
|
|
437
|
+
const regions = [];
|
|
438
|
+
for (const [position, region] of intent.regions.entries()) {
|
|
439
|
+
if (position !== found.regionIndex) {
|
|
440
|
+
regions.push(region);
|
|
441
|
+
continue;
|
|
442
|
+
}
|
|
443
|
+
const drop = (list) => list.filter((_, index) => index !== found.itemIndex);
|
|
444
|
+
if (region.kind === 'band') {
|
|
445
|
+
const items = drop(region.items);
|
|
446
|
+
if (items.length > 0)
|
|
447
|
+
regions.push({ ...region, items });
|
|
448
|
+
}
|
|
449
|
+
else if (region.kind === 'grid') {
|
|
450
|
+
const blocks = drop(region.blocks);
|
|
451
|
+
if (blocks.length > 0)
|
|
452
|
+
regions.push({ ...region, blocks });
|
|
453
|
+
}
|
|
454
|
+
else {
|
|
455
|
+
const main = found.part === 'main' ? drop(region.main) : region.main;
|
|
456
|
+
const rail = found.part === 'rail' ? drop(region.rail) : region.rail;
|
|
457
|
+
if (main.length > 0 && rail.length > 0)
|
|
458
|
+
regions.push({ ...region, main, rail });
|
|
459
|
+
else {
|
|
460
|
+
const rest = [...main, ...rail];
|
|
461
|
+
if (rest.length > 0) {
|
|
462
|
+
regions.push({
|
|
463
|
+
kind: 'grid',
|
|
464
|
+
origin: region.origin,
|
|
465
|
+
blocks: rest.map((block) => ({ ...block, span: 4 })),
|
|
466
|
+
});
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
return { ...intent, regions };
|
|
472
|
+
}
|
|
473
|
+
function hasBlocks(region) {
|
|
474
|
+
if (region.kind === 'grid')
|
|
475
|
+
return region.blocks.length > 0;
|
|
476
|
+
if (region.kind === 'split')
|
|
477
|
+
return region.main.length > 0 || region.rail.length > 0;
|
|
478
|
+
return false;
|
|
479
|
+
}
|
|
480
|
+
function nextIndex(identifiers) {
|
|
481
|
+
let max = -1;
|
|
482
|
+
for (const identifier of identifiers) {
|
|
483
|
+
const match = /\[(\d+)\]$/.exec(identifier);
|
|
484
|
+
if (match !== null)
|
|
485
|
+
max = Math.max(max, Number(match[1]));
|
|
486
|
+
}
|
|
487
|
+
return max + 1;
|
|
488
|
+
}
|
|
489
|
+
/** 每个指标与块带上稳定标识:缺省取它的模型原文路径。 */
|
|
490
|
+
function withIdents(intent) {
|
|
491
|
+
return {
|
|
492
|
+
...intent,
|
|
493
|
+
regions: intent.regions.map((region) => {
|
|
494
|
+
const mark = (item) => ({
|
|
495
|
+
...item,
|
|
496
|
+
ident: item.ident ?? item.origin,
|
|
497
|
+
});
|
|
498
|
+
if (region.kind === 'band')
|
|
499
|
+
return { ...region, items: region.items.map(mark) };
|
|
500
|
+
if (region.kind === 'grid')
|
|
501
|
+
return { ...region, blocks: region.blocks.map(mark) };
|
|
502
|
+
return { ...region, main: region.main.map(mark), rail: region.rail.map(mark) };
|
|
503
|
+
}),
|
|
504
|
+
};
|
|
505
|
+
}
|
|
506
|
+
// ---------------------------------------------------------------------------
|
|
507
|
+
// IR ⇄ 模型原文形状
|
|
508
|
+
// ---------------------------------------------------------------------------
|
|
509
|
+
function withoutFields(raw) {
|
|
510
|
+
const { fields: _fields, ...rest } = raw;
|
|
511
|
+
return rest;
|
|
512
|
+
}
|
|
513
|
+
function kpiToRaw(kpi) {
|
|
514
|
+
// 绑数据的指标卡没有字面量:写回 `bind`,不写 `value`(否则会被当成「既绑又写数」拒绝)。
|
|
515
|
+
const behavior = {
|
|
516
|
+
...(kpi.key === undefined ? {} : { key: kpi.key }),
|
|
517
|
+
...(kpi.states === undefined ? {} : { states: kpi.states }),
|
|
518
|
+
};
|
|
519
|
+
if (kpi.bind !== undefined) {
|
|
520
|
+
return {
|
|
521
|
+
label: kpi.label,
|
|
522
|
+
...(kpi.unit === undefined ? {} : { unit: kpi.unit }),
|
|
523
|
+
bind: kpi.bind,
|
|
524
|
+
...behavior,
|
|
525
|
+
};
|
|
526
|
+
}
|
|
527
|
+
return {
|
|
528
|
+
label: kpi.label,
|
|
529
|
+
value: kpi.value,
|
|
530
|
+
...(kpi.unit === undefined ? {} : { unit: kpi.unit }),
|
|
531
|
+
...(kpi.precision === undefined ? {} : { precision: kpi.precision }),
|
|
532
|
+
...(kpi.delta === undefined ? {} : { delta: kpi.delta }),
|
|
533
|
+
...behavior,
|
|
534
|
+
};
|
|
535
|
+
}
|
|
536
|
+
function blockToRaw(block) {
|
|
537
|
+
return {
|
|
538
|
+
type: block.type,
|
|
539
|
+
title: block.title,
|
|
540
|
+
span: block.span,
|
|
541
|
+
...(block.note === undefined ? {} : { note: block.note }),
|
|
542
|
+
...(block.props === undefined ? {} : { props: block.props }),
|
|
543
|
+
...(block.substituteFor === undefined ? {} : { substituteFor: block.substituteFor }),
|
|
544
|
+
...(block.key === undefined ? {} : { key: block.key }),
|
|
545
|
+
...(block.bind.kind === 'table' ? { table: block.bind.table } : {}),
|
|
546
|
+
...(block.bind.kind === 'dataset'
|
|
547
|
+
? {
|
|
548
|
+
datasetId: block.bind.datasetId,
|
|
549
|
+
...(block.bind.fields === undefined ? {} : { fields: block.bind.fields }),
|
|
550
|
+
...(block.bind.params === undefined ? {} : { params: block.bind.params }),
|
|
551
|
+
}
|
|
552
|
+
: {}),
|
|
553
|
+
...(block.bind.kind === 'text' ? { text: block.bind.text } : {}),
|
|
554
|
+
...(block.bind.kind === 'asset' ? { assetId: block.bind.assetId } : {}),
|
|
555
|
+
};
|
|
556
|
+
}
|
|
557
|
+
function readOp(raw) {
|
|
558
|
+
if (typeof raw !== 'object' || raw === null || Array.isArray(raw))
|
|
559
|
+
return undefined;
|
|
560
|
+
const op = raw;
|
|
561
|
+
const target = typeof op.target === 'string' ? op.target : undefined;
|
|
562
|
+
switch (op.op) {
|
|
563
|
+
case 'change':
|
|
564
|
+
return target !== undefined && isRecord(op.set)
|
|
565
|
+
? { op: 'change', target, set: op.set }
|
|
566
|
+
: undefined;
|
|
567
|
+
case 'swap':
|
|
568
|
+
return target !== undefined && typeof op.type === 'string'
|
|
569
|
+
? {
|
|
570
|
+
op: 'swap',
|
|
571
|
+
target,
|
|
572
|
+
type: op.type,
|
|
573
|
+
...(isRecord(op.props) ? { props: op.props } : {}),
|
|
574
|
+
}
|
|
575
|
+
: undefined;
|
|
576
|
+
case 'delete':
|
|
577
|
+
return target === undefined ? undefined : { op: 'delete', target };
|
|
578
|
+
case 'add':
|
|
579
|
+
return typeof op.region === 'string' && op.block !== undefined
|
|
580
|
+
? {
|
|
581
|
+
op: 'add',
|
|
582
|
+
region: op.region,
|
|
583
|
+
...(op.part === 'main' || op.part === 'rail' ? { part: op.part } : {}),
|
|
584
|
+
block: op.block,
|
|
585
|
+
}
|
|
586
|
+
: undefined;
|
|
587
|
+
case 'rebind':
|
|
588
|
+
return target !== undefined && isRecord(op.bind)
|
|
589
|
+
? { op: 'rebind', target, bind: op.bind }
|
|
590
|
+
: undefined;
|
|
591
|
+
case 'link':
|
|
592
|
+
return isRecord(op.interaction) ? { op: 'link', interaction: op.interaction } : undefined;
|
|
593
|
+
case 'unlink':
|
|
594
|
+
return target === undefined ? undefined : { op: 'unlink', target };
|
|
595
|
+
default:
|
|
596
|
+
return undefined;
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
function isRecord(value) {
|
|
600
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
601
|
+
}
|
|
602
|
+
function fail(path, code, message) {
|
|
603
|
+
return { ok: false, diagnostics: [{ severity: 'error', code, path, message }] };
|
|
604
|
+
}
|
|
605
|
+
// ---------------------------------------------------------------------------
|
|
606
|
+
// 联动的编辑
|
|
607
|
+
// ---------------------------------------------------------------------------
|
|
608
|
+
function linkInteraction(intent, op, path) {
|
|
609
|
+
const existing = intent.interactions ?? [];
|
|
610
|
+
const parsed = parseScreenIntentInteractions([op.interaction], existing.length);
|
|
611
|
+
const added = parsed[0];
|
|
612
|
+
if (added === undefined) {
|
|
613
|
+
return fail(path, 'INTENT_OP_INVALID', 'The interaction is not usable.');
|
|
614
|
+
}
|
|
615
|
+
return { ok: true, intent: { ...intent, interactions: [...existing, added] } };
|
|
616
|
+
}
|
|
617
|
+
function unlinkInteraction(intent, op, path) {
|
|
618
|
+
const existing = intent.interactions ?? [];
|
|
619
|
+
const kept = existing.filter((item) => item.origin !== op.target);
|
|
620
|
+
if (kept.length === existing.length) {
|
|
621
|
+
return fail(path, 'INTENT_OP_TARGET_UNKNOWN', `No interaction is addressed by "${op.target}".`);
|
|
622
|
+
}
|
|
623
|
+
return { ok: true, intent: withInteractions(intent, kept) };
|
|
624
|
+
}
|
|
625
|
+
/** 删掉一块之后,以它为来源的联动整条去掉,以它为目标的从目标里去掉。 */
|
|
626
|
+
function pruneInteractions(intent, found) {
|
|
627
|
+
const item = found.kpi ?? found.block;
|
|
628
|
+
if (intent.interactions === undefined || item === undefined)
|
|
629
|
+
return intent;
|
|
630
|
+
const title = found.kpi !== undefined ? found.kpi.label : (found.block?.title ?? '');
|
|
631
|
+
const refers = (ref) => ref === item.key || (title !== '' && ref === title);
|
|
632
|
+
const kept = [];
|
|
633
|
+
for (const interaction of intent.interactions) {
|
|
634
|
+
if (refers(interaction.from))
|
|
635
|
+
continue;
|
|
636
|
+
const to = interaction.to.filter((ref) => !refers(ref));
|
|
637
|
+
if (to.length === 0)
|
|
638
|
+
continue;
|
|
639
|
+
kept.push({ ...interaction, to });
|
|
640
|
+
}
|
|
641
|
+
return withInteractions(intent, kept);
|
|
642
|
+
}
|
|
643
|
+
function withInteractions(intent, interactions) {
|
|
644
|
+
const { interactions: _old, ...rest } = intent;
|
|
645
|
+
return interactions.length === 0 ? rest : { ...rest, interactions };
|
|
646
|
+
}
|
|
647
|
+
const isAgentNode = (id) => typeof id === 'string' && id.startsWith('agent:');
|
|
648
|
+
const isAgentEdge = (id) => typeof id === 'string' && id.startsWith('agent-edge-');
|
|
649
|
+
const isAgentVariable = (id) => typeof id === 'string' && id.startsWith('agent-var-');
|
|
650
|
+
const isVariableRef = (ref) => isRecord(ref) && ref.kind === 'variable' && typeof ref.variableId === 'string';
|
|
651
|
+
/**
|
|
652
|
+
* 联动变化的差量:只动智能体生成的那部分(变量 `agent-var-*`、节点 `agent:*`、连线 `agent-edge-*`),
|
|
653
|
+
* 用户在蓝图里自己连的线与变量原样保留。内容没变的项不动;变了的先删后加(同 id 也一样)。
|
|
654
|
+
*/
|
|
655
|
+
function behaviorEdit(_before, after, baseline, live) {
|
|
656
|
+
const liveBlueprint = isRecord(baseline.blueprint) ? baseline.blueprint : {};
|
|
657
|
+
const liveNodes = (Array.isArray(liveBlueprint.nodes) ? liveBlueprint.nodes : []).filter(isRecord);
|
|
658
|
+
const liveEdges = (Array.isArray(liveBlueprint.edges) ? liveBlueprint.edges : []).filter(isRecord);
|
|
659
|
+
const liveVariables = (baseline.variables ?? []).filter(isRecord);
|
|
660
|
+
const oldAgent = liveVariables.filter((item) => isAgentVariable(item.id));
|
|
661
|
+
const same = (list, item) => list.some((entry) => entry.id === item.id && canonical(entry) === canonical(item));
|
|
662
|
+
// 蓝图:活文档里的智能体节点 / 连线,编译产物里没有原样对应的删掉;产物里有、活文档没有原样对应的加上。
|
|
663
|
+
const agentNodes = liveNodes.filter((node) => isAgentNode(node.id));
|
|
664
|
+
const agentEdges = liveEdges.filter((edge) => isAgentEdge(edge.id));
|
|
665
|
+
const nextNodes = after.blueprint.nodes.filter(isRecord);
|
|
666
|
+
const nextEdges = after.blueprint.edges.filter(isRecord);
|
|
667
|
+
const removeNodes = agentNodes
|
|
668
|
+
.filter((node) => !same(nextNodes, node))
|
|
669
|
+
.map((node) => String(node.id));
|
|
670
|
+
const removedNodeSet = new Set(removeNodes);
|
|
671
|
+
// 删节点会连带删掉接在它上面的连线:这些连线不再单独列,但要从「保留」里去掉,后面才会重新加上。
|
|
672
|
+
const removeEdges = agentEdges
|
|
673
|
+
.filter((edge) => !same(nextEdges, edge) &&
|
|
674
|
+
!removedNodeSet.has(String(edge.from?.node)) &&
|
|
675
|
+
!removedNodeSet.has(String(edge.to?.node)))
|
|
676
|
+
.map((edge) => String(edge.id));
|
|
677
|
+
const keptEdges = agentEdges.filter((edge) => same(nextEdges, edge) &&
|
|
678
|
+
!removedNodeSet.has(String(edge.from?.node)) &&
|
|
679
|
+
!removedNodeSet.has(String(edge.to?.node)));
|
|
680
|
+
const keptNodes = agentNodes.filter((node) => !removedNodeSet.has(String(node.id)));
|
|
681
|
+
const addNodes = nextNodes.filter((node) => !same(keptNodes, node));
|
|
682
|
+
const addEdges = nextEdges.filter((edge) => !same(keptEdges, edge));
|
|
683
|
+
// 变量:同上,先删后加。
|
|
684
|
+
const removeVariables = oldAgent.filter((item) => !same(after.variables, item));
|
|
685
|
+
const removedVariableSet = new Set(removeVariables.map((item) => String(item.id)));
|
|
686
|
+
const keptVariables = oldAgent.filter((item) => !removedVariableSet.has(String(item.id)));
|
|
687
|
+
const addVariables = after.variables.filter((item) => !same(keptVariables, item));
|
|
688
|
+
// 数据源参数:编译产物里组件读的实例 → 活文档里同一组件读的实例;只看联动相关的参数
|
|
689
|
+
// (新引用了智能体变量,或原来引用、现在不再引用)。
|
|
690
|
+
const desired = new Map();
|
|
691
|
+
const afterSources = new Map((after.dataSources ?? []).map((item) => [String(item.id), item]));
|
|
692
|
+
for (const component of after.components) {
|
|
693
|
+
const compiledId = component.dataValue?.dataSourceId;
|
|
694
|
+
const liveComponent = live.get(component.id);
|
|
695
|
+
const liveId = liveComponent?.dataValue
|
|
696
|
+
?.dataSourceId;
|
|
697
|
+
const compiled = typeof compiledId === 'string' ? afterSources.get(compiledId) : undefined;
|
|
698
|
+
if (compiled === undefined || typeof liveId !== 'string')
|
|
699
|
+
continue;
|
|
700
|
+
const params = isRecord(compiled.params) ? compiled.params : {};
|
|
701
|
+
desired.set(liveId, { ...(desired.get(liveId) ?? {}), ...params });
|
|
702
|
+
}
|
|
703
|
+
const detachParams = [];
|
|
704
|
+
const attachParams = [];
|
|
705
|
+
for (const source of baseline.dataSources ?? []) {
|
|
706
|
+
const id = String(source.id);
|
|
707
|
+
const params = isRecord(source.params) ? source.params : {};
|
|
708
|
+
const want = desired.get(id) ?? {};
|
|
709
|
+
const detach = {};
|
|
710
|
+
const attach = {};
|
|
711
|
+
for (const [name, current] of Object.entries(params)) {
|
|
712
|
+
if (!isVariableRef(current) || !isAgentVariable(current.variableId))
|
|
713
|
+
continue;
|
|
714
|
+
const target = want[name];
|
|
715
|
+
const keeps = isVariableRef(target) &&
|
|
716
|
+
target.variableId === current.variableId &&
|
|
717
|
+
!removedVariableSet.has(current.variableId);
|
|
718
|
+
if (keeps)
|
|
719
|
+
continue;
|
|
720
|
+
// 先退回常量(变量初值),变量才能删;要改成别的引用的,等新变量加上之后再接。
|
|
721
|
+
const old = oldAgent.find((item) => item.id === current.variableId);
|
|
722
|
+
detach[name] = { kind: 'inline', value: old?.initialValue ?? null };
|
|
723
|
+
if (isVariableRef(target))
|
|
724
|
+
attach[name] = target;
|
|
725
|
+
else if (target !== undefined && canonical(target) !== canonical(detach[name])) {
|
|
726
|
+
attach[name] = target;
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
for (const [name, target] of Object.entries(want)) {
|
|
730
|
+
if (!isVariableRef(target) || !isAgentVariable(target.variableId))
|
|
731
|
+
continue;
|
|
732
|
+
if (attach[name] !== undefined || detach[name] !== undefined)
|
|
733
|
+
continue;
|
|
734
|
+
if (canonical(params[name]) !== canonical(target))
|
|
735
|
+
attach[name] = target;
|
|
736
|
+
}
|
|
737
|
+
if (Object.keys(detach).length > 0) {
|
|
738
|
+
detachParams.push({ type: 'update-data-source-params', dataSourceId: id, params: detach });
|
|
739
|
+
}
|
|
740
|
+
if (Object.keys(attach).length > 0) {
|
|
741
|
+
attachParams.push({ type: 'update-data-source-params', dataSourceId: id, params: attach });
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
const detach = [];
|
|
745
|
+
if (removeNodes.length + removeEdges.length > 0) {
|
|
746
|
+
detach.push({ type: 'remove-blueprint-elements', nodeIds: removeNodes, edgeIds: removeEdges });
|
|
747
|
+
}
|
|
748
|
+
detach.push(...detachParams);
|
|
749
|
+
if (removeVariables.length > 0) {
|
|
750
|
+
detach.push({
|
|
751
|
+
type: 'remove-variables',
|
|
752
|
+
variableIds: removeVariables.map((item) => String(item.id)),
|
|
753
|
+
});
|
|
754
|
+
}
|
|
755
|
+
if (addVariables.length > 0)
|
|
756
|
+
detach.push({ type: 'add-variables', variables: addVariables });
|
|
757
|
+
const wire = addNodes.length + addEdges.length > 0
|
|
758
|
+
? [{ type: 'add-blueprint-elements', nodes: addNodes, edges: addEdges }]
|
|
759
|
+
: [];
|
|
760
|
+
return { detach, attach: attachParams, wire };
|
|
761
|
+
}
|
|
762
|
+
// ---------------------------------------------------------------------------
|
|
763
|
+
// 做差
|
|
764
|
+
// ---------------------------------------------------------------------------
|
|
765
|
+
/** 比较的字段:不含 `zIndex`(整屏替换会整体抬高层级)。 */
|
|
766
|
+
const COMPARED = [
|
|
767
|
+
'type',
|
|
768
|
+
'name',
|
|
769
|
+
'parentId',
|
|
770
|
+
'position',
|
|
771
|
+
'size',
|
|
772
|
+
'rotation',
|
|
773
|
+
'props',
|
|
774
|
+
'style',
|
|
775
|
+
'dataValue',
|
|
776
|
+
'dataBinding',
|
|
777
|
+
// 行为:阈值状态与初始显隐也是编译产物的一部分。
|
|
778
|
+
'states',
|
|
779
|
+
'status',
|
|
780
|
+
];
|
|
781
|
+
function sameComponent(a, b) {
|
|
782
|
+
const left = a;
|
|
783
|
+
const right = b;
|
|
784
|
+
return COMPARED.every((key) => canonical(left[key]) === canonical(right[key]));
|
|
785
|
+
}
|
|
786
|
+
/**
|
|
787
|
+
* 规范化比较:键顺序无关,`undefined` 与缺省等同于 `null`。
|
|
788
|
+
* 活文档里的组件经引擎读写后键顺序可能与编译产物不同,这不算用户改过。
|
|
789
|
+
*/
|
|
790
|
+
function canonical(value) {
|
|
791
|
+
return JSON.stringify(sortKeys(value ?? null));
|
|
792
|
+
}
|
|
793
|
+
function sortKeys(value) {
|
|
794
|
+
if (Array.isArray(value))
|
|
795
|
+
return value.map(sortKeys);
|
|
796
|
+
if (typeof value !== 'object' || value === null)
|
|
797
|
+
return value;
|
|
798
|
+
return Object.fromEntries(Object.entries(value)
|
|
799
|
+
.filter(([, item]) => item !== undefined)
|
|
800
|
+
.sort(([left], [right]) => (left < right ? -1 : left > right ? 1 : 0))
|
|
801
|
+
.map(([key, item]) => [key, sortKeys(item)]));
|
|
802
|
+
}
|
|
803
|
+
function diffPatch(before, after) {
|
|
804
|
+
const old = before;
|
|
805
|
+
const next = after;
|
|
806
|
+
const patch = {};
|
|
807
|
+
for (const key of COMPARED) {
|
|
808
|
+
if (key === 'type')
|
|
809
|
+
continue;
|
|
810
|
+
if (canonical(old[key]) !== canonical(next[key]))
|
|
811
|
+
patch[key] = next[key];
|
|
812
|
+
}
|
|
813
|
+
return patch;
|
|
814
|
+
}
|
|
815
|
+
/**
|
|
816
|
+
* 新增组件引用的数据源:内容相同的复用活文档里已有的实例,冲突就换 id,并把组件里的引用改过去。
|
|
817
|
+
* 没有新增就不动数据源。
|
|
818
|
+
*/
|
|
819
|
+
function remapDataSources(after, added, existing, known = new Map()) {
|
|
820
|
+
const referenced = new Set();
|
|
821
|
+
for (const component of added) {
|
|
822
|
+
const value = component.dataValue;
|
|
823
|
+
if (typeof value?.dataSourceId === 'string')
|
|
824
|
+
referenced.add(value.dataSourceId);
|
|
825
|
+
}
|
|
826
|
+
const rewrite = (map) => (component) => {
|
|
827
|
+
const value = component.dataValue;
|
|
828
|
+
const mapped = typeof value?.dataSourceId === 'string' ? map.get(value.dataSourceId) : undefined;
|
|
829
|
+
return mapped === undefined || value === null
|
|
830
|
+
? component
|
|
831
|
+
: { ...component, dataValue: { ...value, dataSourceId: mapped } };
|
|
832
|
+
};
|
|
833
|
+
// 上一次编译 → 活文档:同一组件在两边读的实例编号(只为「编号变了」的那几个)。
|
|
834
|
+
const previousMap = new Map();
|
|
835
|
+
const applyPrevious = (component) => {
|
|
836
|
+
const id = dataSourceIdOf(component.dataValue);
|
|
837
|
+
const nextId = dataSourceIdOf(after.components.find((item) => item.id === component.id)?.dataValue);
|
|
838
|
+
const liveId = nextId === undefined ? undefined : known.get(nextId);
|
|
839
|
+
if (id === undefined || liveId === undefined)
|
|
840
|
+
return component;
|
|
841
|
+
previousMap.set(id, liveId);
|
|
842
|
+
return rewrite(previousMap)(component);
|
|
843
|
+
};
|
|
844
|
+
if (referenced.size === 0) {
|
|
845
|
+
return { fresh: [], apply: rewrite(known), applyPrevious };
|
|
846
|
+
}
|
|
847
|
+
const taken = new Set(existing.map((source) => String(source.id)));
|
|
848
|
+
const remap = new Map(known);
|
|
849
|
+
const fresh = [];
|
|
850
|
+
for (const source of after.dataSources ?? []) {
|
|
851
|
+
const id = String(source.id);
|
|
852
|
+
if (!referenced.has(id) || remap.has(id))
|
|
853
|
+
continue;
|
|
854
|
+
const reusable = existing.find((candidate) => JSON.stringify({ ...candidate, id: '' }) === JSON.stringify({ ...source, id: '' }));
|
|
855
|
+
if (reusable !== undefined) {
|
|
856
|
+
remap.set(id, String(reusable.id));
|
|
857
|
+
continue;
|
|
858
|
+
}
|
|
859
|
+
let nextId = id;
|
|
860
|
+
for (let n = 2; taken.has(nextId); n += 1)
|
|
861
|
+
nextId = `${id}-e${n}`;
|
|
862
|
+
taken.add(nextId);
|
|
863
|
+
remap.set(id, nextId);
|
|
864
|
+
fresh.push({ ...source, id: nextId });
|
|
865
|
+
}
|
|
866
|
+
return {
|
|
867
|
+
fresh,
|
|
868
|
+
apply: rewrite(remap),
|
|
869
|
+
applyPrevious,
|
|
870
|
+
};
|
|
871
|
+
}
|
|
872
|
+
function dataSourceIdOf(value) {
|
|
873
|
+
return isRecord(value) &&
|
|
874
|
+
value.kind === 'data-source-field' &&
|
|
875
|
+
typeof value.dataSourceId === 'string'
|
|
876
|
+
? value.dataSourceId
|
|
877
|
+
: undefined;
|
|
878
|
+
}
|
|
879
|
+
/**
|
|
880
|
+
* 两个数据源实例「读的是不是同一份数据」:来源、名称与参数相同;任一侧引用智能体变量的参数不比
|
|
881
|
+
* (联动的增减只改这几个参数,不算换来源)。
|
|
882
|
+
*/
|
|
883
|
+
function sameSourceContent(left, right) {
|
|
884
|
+
if (left === undefined || right === undefined)
|
|
885
|
+
return false;
|
|
886
|
+
const a = isRecord(left.params) ? left.params : {};
|
|
887
|
+
const b = isRecord(right.params) ? right.params : {};
|
|
888
|
+
const agentRef = (ref) => isVariableRef(ref) && isAgentVariable(ref.variableId);
|
|
889
|
+
const ignored = new Set([...Object.keys(a), ...Object.keys(b)].filter((name) => agentRef(a[name]) || agentRef(b[name])));
|
|
890
|
+
const own = (params) => Object.fromEntries(Object.entries(params).filter(([name]) => !ignored.has(name)));
|
|
891
|
+
return (canonical({ source: left.source, name: left.name, params: own(a) }) ===
|
|
892
|
+
canonical({ source: right.source, name: right.name, params: own(b) }));
|
|
893
|
+
}
|
|
894
|
+
// ---------------------------------------------------------------------------
|
|
895
|
+
// 会话:挑出与活文档对得上的那一份、压成发给后端的摘要
|
|
896
|
+
// ---------------------------------------------------------------------------
|
|
897
|
+
/**
|
|
898
|
+
* 在几份候选会话里挑出与活文档最对得上的一份。
|
|
899
|
+
*
|
|
900
|
+
* 为什么有「几份」:提案还没被采纳时,宿主不知道用户会采纳还是拒绝,所以每次提交都留下那一份
|
|
901
|
+
* 会话;下一次请求时看活文档里剩下的是哪一份的组件。得分 = 内容完全一致的组件数 − 两边 id 的差异数;
|
|
902
|
+
* 命中的组件不到该会话的一半(或不足 3 个)就不算对得上——例如用户整屏换了别的内容,这时返回 undefined,
|
|
903
|
+
* 调用方当没有会话,让路由走别的动作。
|
|
904
|
+
*/
|
|
905
|
+
export function pickSession(candidates, baseline) {
|
|
906
|
+
const live = new Map(baseline.components.map((component) => [component.id, component]));
|
|
907
|
+
let best;
|
|
908
|
+
for (const session of candidates) {
|
|
909
|
+
if (!isSessionUsable(session, baseline))
|
|
910
|
+
continue;
|
|
911
|
+
const compiled = session.compiled.document.components;
|
|
912
|
+
let present = 0;
|
|
913
|
+
let identical = 0;
|
|
914
|
+
for (const component of compiled) {
|
|
915
|
+
const current = live.get(component.id);
|
|
916
|
+
if (current === undefined)
|
|
917
|
+
continue;
|
|
918
|
+
present += 1;
|
|
919
|
+
if (sameComponent(component, current))
|
|
920
|
+
identical += 1;
|
|
921
|
+
}
|
|
922
|
+
if (present < 3 || present < compiled.length / 2)
|
|
923
|
+
continue;
|
|
924
|
+
const missing = compiled.length - present;
|
|
925
|
+
const extra = baseline.components.filter((component) => !compiled.some((item) => item.id === component.id)).length;
|
|
926
|
+
const score = identical - missing - extra;
|
|
927
|
+
if (best === undefined || score > best.score)
|
|
928
|
+
best = { session, score };
|
|
929
|
+
}
|
|
930
|
+
return best?.session;
|
|
931
|
+
}
|
|
932
|
+
export function describeSession(session) {
|
|
933
|
+
const { intent } = session;
|
|
934
|
+
const language = detectIntentLanguage(intent.title, intent.subtitle);
|
|
935
|
+
const block = (item, part) => ({
|
|
936
|
+
target: idOf(item),
|
|
937
|
+
kind: 'block',
|
|
938
|
+
part,
|
|
939
|
+
type: item.type,
|
|
940
|
+
title: item.title === '' ? item.type : item.title,
|
|
941
|
+
...(item.key === undefined ? {} : { key: item.key }),
|
|
942
|
+
});
|
|
943
|
+
const interactions = (intent.interactions ?? []).map((item) => ({
|
|
944
|
+
target: item.origin,
|
|
945
|
+
kind: item.kind,
|
|
946
|
+
from: item.from,
|
|
947
|
+
to: item.to,
|
|
948
|
+
event: item.event,
|
|
949
|
+
...(item.kind === 'filter'
|
|
950
|
+
? {
|
|
951
|
+
param: item.param,
|
|
952
|
+
...(item.field === undefined ? {} : { field: item.field }),
|
|
953
|
+
...(item.reset === true ? { reset: true } : {}),
|
|
954
|
+
}
|
|
955
|
+
: item.kind === 'show'
|
|
956
|
+
? { mode: item.mode }
|
|
957
|
+
: { state: item.state }),
|
|
958
|
+
}));
|
|
959
|
+
return {
|
|
960
|
+
title: intent.title,
|
|
961
|
+
subtitle: intent.subtitle,
|
|
962
|
+
...(interactions.length === 0 ? {} : { interactions }),
|
|
963
|
+
regions: intent.regions.map((region) => {
|
|
964
|
+
if (region.kind === 'band') {
|
|
965
|
+
return {
|
|
966
|
+
path: region.origin,
|
|
967
|
+
kind: 'band',
|
|
968
|
+
items: region.items.map((kpi) => ({
|
|
969
|
+
target: idOf(kpi),
|
|
970
|
+
kind: 'kpi',
|
|
971
|
+
part: 'items',
|
|
972
|
+
title: kpi.label,
|
|
973
|
+
value: formatKpiValue(kpi, language),
|
|
974
|
+
...(kpi.key === undefined ? {} : { key: kpi.key }),
|
|
975
|
+
...(kpi.states === undefined || kpi.states.rules.length === 0
|
|
976
|
+
? {}
|
|
977
|
+
: {
|
|
978
|
+
states: kpi.states.rules.map((rule) => rule.label ?? `${rule.tone}`),
|
|
979
|
+
}),
|
|
980
|
+
})),
|
|
981
|
+
};
|
|
982
|
+
}
|
|
983
|
+
if (region.kind === 'grid') {
|
|
984
|
+
return {
|
|
985
|
+
path: region.origin,
|
|
986
|
+
kind: 'grid',
|
|
987
|
+
items: region.blocks.map((item) => block(item, 'blocks')),
|
|
988
|
+
};
|
|
989
|
+
}
|
|
990
|
+
return {
|
|
991
|
+
path: region.origin,
|
|
992
|
+
kind: 'split',
|
|
993
|
+
items: [
|
|
994
|
+
...region.main.map((item) => block(item, 'main')),
|
|
995
|
+
...region.rail.map((item) => block(item, 'rail')),
|
|
996
|
+
],
|
|
997
|
+
};
|
|
998
|
+
}),
|
|
999
|
+
};
|
|
1000
|
+
}
|
|
1001
|
+
//# sourceMappingURL=intent-session.js.map
|