base-screen 0.2.0 → 0.3.0
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 +3 -12
- package/dist/_internal/contracts/document/blueprint-capabilities.d.ts +9 -1
- package/dist/_internal/contracts/document/blueprint-capabilities.js +16 -0
- package/dist/_internal/contracts/document/blueprint-graph.d.ts +68 -0
- package/dist/_internal/contracts/document/blueprint-graph.js +424 -0
- package/dist/_internal/contracts/document/blueprint-strict.d.ts +3 -1
- package/dist/_internal/contracts/document/blueprint-strict.js +77 -91
- package/dist/_internal/contracts/document/component-states.d.ts +54 -0
- package/dist/_internal/contracts/document/component-states.js +171 -0
- package/dist/_internal/contracts/document/json-schema.js +49 -17
- package/dist/_internal/contracts/document/limits.d.ts +40 -8
- package/dist/_internal/contracts/document/limits.js +40 -8
- package/dist/_internal/contracts/document/parse-parts.d.ts +12 -0
- package/dist/_internal/contracts/document/parse-parts.js +56 -0
- package/dist/_internal/contracts/document/parse.js +1 -1
- package/dist/_internal/contracts/document/references.js +108 -41
- package/dist/_internal/contracts/document/schema.d.ts +525 -186
- package/dist/_internal/contracts/document/schema.js +234 -95
- package/dist/_internal/contracts/document/sub-canvas.d.ts +27 -0
- package/dist/_internal/contracts/document/sub-canvas.js +38 -0
- package/dist/_internal/contracts/document/theme.d.ts +22 -0
- package/dist/_internal/contracts/document/theme.js +65 -0
- package/dist/_internal/contracts/document/validate-blueprint.d.ts +7 -0
- package/dist/_internal/contracts/document/validate-blueprint.js +223 -25
- package/dist/_internal/contracts/document/validate-component.d.ts +2 -0
- package/dist/_internal/contracts/document/validate-component.js +111 -54
- package/dist/_internal/contracts/document/validate-data-source.js +84 -9
- package/dist/_internal/contracts/document/validate-sub-canvas.d.ts +9 -0
- package/dist/_internal/contracts/document/validate-sub-canvas.js +92 -0
- package/dist/_internal/contracts/document/validate-theme.d.ts +4 -0
- package/dist/_internal/contracts/document/validate-theme.js +20 -0
- package/dist/_internal/contracts/document/validate.js +19 -2
- package/dist/_internal/contracts/index.d.ts +11 -4
- package/dist/_internal/contracts/index.js +8 -2
- package/dist/_internal/contracts/migration/blueprint-graph-migration.d.ts +21 -0
- package/dist/_internal/contracts/migration/blueprint-graph-migration.js +328 -0
- package/dist/_internal/contracts/migration/migrate-document.d.ts +2 -1
- package/dist/_internal/contracts/migration/migrate-document.js +11 -3
- package/dist/_internal/contracts/push/delivery.d.ts +16 -0
- package/dist/_internal/contracts/push/delivery.js +70 -0
- package/dist/_internal/contracts/push/level-scale.d.ts +7 -0
- package/dist/_internal/contracts/push/level-scale.js +91 -0
- package/dist/_internal/contracts/screen-document.schema.json +1056 -383
- package/dist/_internal/contracts/types/document.d.ts +277 -76
- package/dist/_internal/contracts/types/execution.d.ts +12 -2
- package/dist/_internal/contracts/types/execution.js +0 -5
- package/dist/_internal/contracts/types/host.d.ts +35 -1
- package/dist/_internal/contracts/types/host.js +7 -1
- package/dist/_internal/contracts/types/push.d.ts +86 -0
- package/dist/_internal/contracts/types/push.js +1 -0
- package/dist/_internal/contracts/types/variable.d.ts +5 -0
- package/dist/_internal/contracts/variable/parse.js +30 -1
- package/dist/_internal/core/blueprint/runtime-compile.d.ts +4 -0
- package/dist/_internal/core/blueprint/runtime-compile.js +45 -21
- package/dist/_internal/core/blueprint/runtime-dispatch.js +270 -156
- package/dist/_internal/core/blueprint/runtime-types.d.ts +112 -6
- package/dist/_internal/core/blueprint/runtime.d.ts +1 -1
- package/dist/_internal/core/commands/apply-component-commands.d.ts +5 -0
- package/dist/_internal/core/commands/apply-component-commands.js +74 -2
- package/dist/_internal/core/commands/apply.js +63 -3
- package/dist/_internal/core/commands/parse-command.js +12 -0
- package/dist/_internal/core/commands/types.d.ts +28 -3
- package/dist/_internal/core/diff/screen-diff.js +1 -1
- package/dist/_internal/core/index.d.ts +1 -1
- package/dist/_internal/engine/browser/controllers/blueprint/designer-blueprint-canvas-bridge-helpers.d.ts +1 -1
- package/dist/_internal/engine/browser/controllers/blueprint/designer-blueprint-canvas-bridge.d.ts +11 -1
- package/dist/_internal/engine/browser/controllers/blueprint/designer-blueprint-panels-controller.d.ts +18 -4
- package/dist/_internal/engine/browser/controllers/blueprint/designer-blueprint-timer-scheduler.d.ts +21 -0
- package/dist/_internal/engine/browser/controllers/blueprint/designer-blueprint-workbench-panel.d.ts +8 -1
- package/dist/_internal/engine/browser/controllers/dataset/designer-data-source-authoring.d.ts +25 -1
- package/dist/_internal/engine/browser/controllers/dataset/designer-dataset-controller-context.d.ts +6 -2
- package/dist/_internal/engine/browser/controllers/dataset/designer-dataset-draft-controller.d.ts +8 -0
- package/dist/_internal/engine/browser/controllers/dataset/designer-dataset-surface-controller.d.ts +14 -0
- package/dist/_internal/engine/browser/controllers/dataset/designer-update-policy-authoring.d.ts +52 -0
- package/dist/_internal/engine/browser/controllers/designer-artboard-controller.d.ts +80 -0
- package/dist/_internal/engine/browser/controllers/designer-canvas-runtime-controller.d.ts +21 -3
- package/dist/_internal/engine/browser/controllers/designer-change-controller.d.ts +2 -0
- package/dist/_internal/engine/browser/controllers/designer-command-palette-controller.d.ts +2 -0
- package/dist/_internal/engine/browser/controllers/designer-notification-controller.d.ts +7 -0
- package/dist/_internal/engine/browser/controllers/designer-page-preview-controller.d.ts +34 -0
- package/dist/_internal/engine/browser/controllers/designer-popup-preview-controller.d.ts +40 -0
- package/dist/_internal/engine/browser/controllers/designer-preview-controller.d.ts +1 -3
- package/dist/_internal/engine/browser/controllers/designer-reference-layer-controller.d.ts +45 -0
- package/dist/_internal/engine/browser/controllers/designer-viewport-controller.d.ts +10 -0
- package/dist/_internal/engine/browser/controllers/gesture/designer-gesture-callbacks.d.ts +5 -1
- package/dist/_internal/engine/browser/controllers/gesture/designer-gesture-controller.d.ts +2 -0
- package/dist/_internal/engine/browser/controllers/gesture/designer-gesture-environment.d.ts +18 -7
- package/dist/_internal/engine/browser/controllers/gesture/designer-group-editing-controller.d.ts +8 -1
- package/dist/_internal/engine/browser/controllers/layers/designer-layers-controller.d.ts +11 -0
- package/dist/_internal/engine/browser/controllers/panel/designer-component-states-controller.d.ts +26 -0
- package/dist/_internal/engine/browser/controllers/panel/designer-inspector-focus.d.ts +30 -0
- package/dist/_internal/engine/browser/controllers/panel/designer-panel-controller-callbacks.d.ts +23 -6
- package/dist/_internal/engine/browser/controllers/panel/designer-panel-controller.d.ts +2 -2
- package/dist/_internal/engine/browser/controllers/panel/designer-panel-material-controller.d.ts +4 -0
- package/dist/_internal/engine/browser/controllers/panel/designer-panel-property-controller.d.ts +2 -0
- package/dist/_internal/engine/browser/controllers/workbench/designer-snap-controller.d.ts +5 -1
- package/dist/_internal/engine/browser/controllers/workbench/designer-workbench-controller.d.ts +7 -1
- package/dist/_internal/engine/browser/dom/blueprint/designer-blueprint-inspector-configuration.d.ts +12 -0
- package/dist/_internal/engine/browser/dom/blueprint/designer-blueprint-library-dom.d.ts +18 -2
- package/dist/_internal/engine/browser/dom/change/designer-change-dom.d.ts +1 -0
- package/dist/_internal/engine/browser/dom/color/designer-color-palette-dom.d.ts +1 -0
- package/dist/_internal/engine/browser/dom/color/designer-color-palette-theme.d.ts +10 -0
- package/dist/_internal/engine/browser/dom/color/designer-color-palette-types.d.ts +13 -0
- package/dist/_internal/engine/browser/dom/color/designer-color-theme-slots.d.ts +10 -0
- package/dist/_internal/engine/browser/dom/dataset/designer-dataset-types.d.ts +17 -6
- package/dist/_internal/engine/browser/dom/descriptor/designer-descriptor-control-dom.d.ts +17 -1
- package/dist/_internal/engine/browser/dom/descriptor/designer-descriptor-model.d.ts +2 -0
- package/dist/_internal/engine/browser/dom/designer-field-primitives.d.ts +43 -1
- package/dist/_internal/engine/browser/dom/designer-icons.d.ts +2 -0
- package/dist/_internal/engine/browser/dom/designer-select-dom.d.ts +2 -0
- package/dist/_internal/engine/browser/dom/designer-ui-primitives.d.ts +5 -0
- package/dist/_internal/engine/browser/dom/layers/designer-layers-model.d.ts +28 -0
- package/dist/_internal/engine/browser/dom/material-library/designer-material-library-dom.d.ts +18 -2
- package/dist/_internal/engine/browser/dom/material-library/designer-material-library-group-view.d.ts +1 -0
- package/dist/_internal/engine/browser/dom/menu/designer-menu-model.d.ts +4 -2
- package/dist/_internal/engine/browser/dom/panel/designer-canvas-properties-dom.d.ts +10 -2
- package/dist/_internal/engine/browser/dom/panel/designer-canvas-transactions.d.ts +5 -1
- package/dist/_internal/engine/browser/dom/panel/designer-chrome-primitives.d.ts +12 -0
- package/dist/_internal/engine/browser/dom/panel/designer-color-group-dom.d.ts +45 -0
- package/dist/_internal/engine/browser/dom/panel/designer-component-properties-dom.d.ts +4 -3
- package/dist/_internal/engine/browser/dom/panel/designer-component-states-dom.d.ts +22 -0
- package/dist/_internal/engine/browser/dom/panel/designer-panel-primitives.d.ts +18 -2
- package/dist/_internal/engine/browser/dom/workspace/designer-workspace-template.d.ts +13 -0
- package/dist/_internal/engine/browser/dom/workspace/designer-workspace.d.ts +2 -1
- package/dist/_internal/engine/browser/viewport/designer-canvas-aids-types.d.ts +8 -2
- package/dist/_internal/engine/browser/viewport/designer-canvas-aids.d.ts +14 -4
- package/dist/_internal/engine/browser/viewport/designer-canvas-coordinates.d.ts +7 -0
- package/dist/_internal/engine/browser/viewport/designer-canvas-measurements.d.ts +12 -1
- package/dist/_internal/engine/browser/viewport/designer-canvas-snap-alignment-index.d.ts +27 -0
- package/dist/_internal/engine/browser/viewport/designer-canvas-snap-geometry.d.ts +13 -2
- package/dist/_internal/engine/browser/viewport/designer-canvas-snap-preview.d.ts +1 -1
- package/dist/_internal/engine/browser/viewport/designer-canvas-snap-spacing.d.ts +12 -0
- package/dist/_internal/engine/browser/viewport/designer-guide-overlay-nodes.d.ts +2 -0
- package/dist/_internal/engine/common/observability/designer-metrics.d.ts +1 -1
- package/dist/_internal/engine/common/operations/blueprint/designer-blueprint-geometry.d.ts +12 -0
- package/dist/_internal/engine/common/operations/blueprint/designer-blueprint-graph.d.ts +203 -0
- package/dist/_internal/engine/common/operations/blueprint/designer-blueprint-model-types.d.ts +6 -2
- package/dist/_internal/engine/common/operations/blueprint/designer-blueprint-model.d.ts +58 -7
- package/dist/_internal/engine/common/operations/blueprint/designer-blueprint-protocol-types.d.ts +131 -51
- package/dist/_internal/engine/common/operations/blueprint/designer-blueprint-value-sources.d.ts +7 -3
- package/dist/_internal/engine/common/operations/catalog/designer-catalog-refresh.d.ts +13 -1
- package/dist/_internal/engine/common/operations/designer-operation-registry.d.ts +5 -1
- package/dist/_internal/engine/common/operations/designer-variable-operations.d.ts +8 -0
- package/dist/_internal/engine/common/operations/element/designer-element-operation-types.d.ts +8 -0
- package/dist/_internal/engine/common/operations/host-resource/host-resource-authoring.d.ts +1 -1
- package/dist/_internal/engine/common/operations/material-component/material-component-fragment-extract.d.ts +34 -0
- package/dist/_internal/engine/common/operations/material-component/material-component-fragment.d.ts +24 -41
- package/dist/_internal/engine/common/operations/material-component/material-component.d.ts +1 -1
- package/dist/_internal/engine/common/operations/material-library/material-library-fragments.d.ts +46 -0
- package/dist/_internal/engine/common/operations/material-library/material-library-grouping.d.ts +11 -0
- package/dist/_internal/engine/common/operations/selection/designer-group.d.ts +16 -4
- package/dist/_internal/engine/common/operations/selection/designer-multi-selection-operations.d.ts +4 -3
- package/dist/_internal/engine/common/operations/selection/designer-selection-actions.d.ts +6 -0
- package/dist/_internal/engine/common/operations/selection/designer-selection.d.ts +8 -0
- package/dist/_internal/engine/common/operations/style/designer-component-states.d.ts +62 -0
- package/dist/_internal/engine/common/operations/style/designer-material-appearance.d.ts +30 -0
- package/dist/_internal/engine/common/session/designer-artboard.d.ts +40 -0
- package/dist/_internal/engine/common/session/designer-session.d.ts +21 -0
- package/dist/_internal/engine/common/ui-text/designer-blueprint-ui-text.d.ts +169 -0
- package/dist/_internal/engine/common/ui-text/designer-ui-text.d.ts +422 -88
- package/dist/_internal/engine/designer-blueprint-workbench-panel-CJ3iZo5v.js +2872 -0
- package/dist/_internal/engine/{designer-dataset-controller-CPytVNBK.js → designer-dataset-controller-CrfOg2Ys.js} +1764 -1507
- package/dist/_internal/engine/designer-element/api/designer-element-catalog.d.ts +4 -3
- package/dist/_internal/engine/designer-element/api/designer-element-configuration-types.d.ts +11 -8
- package/dist/_internal/engine/designer-element/api/designer-element-fragment-save.d.ts +16 -0
- package/dist/_internal/engine/designer-element/api/designer-element-host-properties.d.ts +0 -5
- package/dist/_internal/engine/designer-element/api/designer-element-insert-component-fragment.d.ts +9 -2
- package/dist/_internal/engine/designer-element/api/designer-element-material-library-fragments.d.ts +17 -0
- package/dist/_internal/engine/designer-element/api/designer-element-project.d.ts +0 -1
- package/dist/_internal/engine/designer-element/base-screen-designer-element.d.ts +24 -24
- package/dist/_internal/engine/designer-element/designer-element-public-api.d.ts +5 -5
- package/dist/_internal/engine/designer-element/runtime/designer-element-guards.d.ts +0 -2
- package/dist/_internal/engine/designer-element/runtime/designer-element-host.d.ts +6 -7
- package/dist/_internal/engine/designer-element/runtime/designer-element-rendering.d.ts +11 -1
- package/dist/_internal/engine/designer-element/runtime/designer-element-runtime.d.ts +15 -14
- package/dist/_internal/engine/designer-element/runtime/designer-element-state.d.ts +29 -10
- package/dist/_internal/engine/{designer-ui-primitives-CH4RNiMa.js → designer-field-primitives-KBZuWN_D.js} +876 -346
- package/dist/_internal/engine/designer-left-panel-groups-dom-N2OHOWjl.js +1282 -0
- package/dist/_internal/engine/host-resource-selection-xo2mLCD4.js +2482 -0
- package/dist/_internal/engine/host-tokens.css +12 -12
- package/dist/_internal/engine/index.js +8643 -6102
- package/dist/_internal/host-kit/index.d.ts +2 -0
- package/dist/_internal/host-kit/index.js +2 -0
- package/dist/_internal/host-kit/push-result.d.ts +5 -0
- package/dist/_internal/host-kit/push-result.js +8 -0
- package/dist/_internal/host-kit/sse-subscribe.d.ts +59 -0
- package/dist/_internal/host-kit/sse-subscribe.js +253 -0
- package/dist/_internal/host-kit/subscription-hub.d.ts +41 -0
- package/dist/_internal/host-kit/subscription-hub.js +179 -0
- package/dist/_internal/material/base-material.d.ts +1 -0
- package/dist/_internal/material/chart.d.ts +4 -0
- package/dist/_internal/material/chart.js +101 -58
- package/dist/_internal/material/container.js +19 -33
- package/dist/_internal/material/{base-material-BArgjOeL.js → editor-descriptor-DJZYygOa.js} +49 -20
- package/dist/_internal/material/editor-descriptor.d.ts +18 -0
- package/dist/_internal/material/image.js +30 -34
- package/dist/_internal/material/rule.js +29 -42
- package/dist/_internal/material/shapes.js +57 -74
- package/dist/_internal/material/table.d.ts +4 -0
- package/dist/_internal/material/table.js +118 -71
- package/dist/_internal/material/text.js +40 -68
- package/dist/_internal/plugin-core/contracts.d.ts +38 -49
- package/dist/_internal/plugin-core/contribution-kind.js +47 -2
- package/dist/_internal/plugin-core/editor/editor-ai-description.d.ts +3 -0
- package/dist/_internal/plugin-core/editor/editor-ai-description.js +124 -0
- package/dist/_internal/plugin-core/editor/editor-descriptor-conditions.js +5 -0
- package/dist/_internal/plugin-core/editor/editor-descriptor-inference.d.ts +32 -0
- package/dist/_internal/plugin-core/editor/editor-descriptor-inference.js +83 -0
- package/dist/_internal/plugin-core/editor/editor-descriptor-items.d.ts +6 -0
- package/dist/_internal/plugin-core/editor/editor-descriptor-items.js +41 -12
- package/dist/_internal/plugin-core/editor/editor-descriptor-model.d.ts +24 -1
- package/dist/_internal/plugin-core/editor/editor-descriptor-model.js +6 -1
- package/dist/_internal/plugin-core/editor/editor-descriptor-schema.js +21 -0
- package/dist/_internal/plugin-core/editor/editor-descriptor-sections.js +5 -7
- package/dist/_internal/plugin-core/editor/editor-descriptor.d.ts +1 -0
- package/dist/_internal/plugin-core/editor/editor-descriptor.js +55 -2
- package/dist/_internal/plugin-core/fragment/fragment.d.ts +96 -0
- package/dist/_internal/plugin-core/fragment/fragment.js +535 -0
- package/dist/_internal/plugin-core/index.d.ts +7 -4
- package/dist/_internal/plugin-core/index.js +5 -2
- package/dist/_internal/plugin-core/material/material-manifest.js +14 -2
- package/dist/_internal/plugin-core/material/material-schema.d.ts +9 -0
- package/dist/_internal/plugin-core/material/material-schema.js +31 -1
- package/dist/_internal/plugin-core/material/material-theme.d.ts +25 -0
- package/dist/_internal/plugin-core/material/material-theme.js +77 -0
- package/dist/_internal/plugin-core/material/material-validation-constants.js +2 -0
- package/dist/_internal/plugin-core/material/material.d.ts +1 -1
- package/dist/_internal/plugin-core/material/material.js +1 -1
- package/dist/_internal/plugin-manager/contribution-kind-plan.d.ts +2 -1
- package/dist/_internal/plugin-manager/contribution-kind-plan.js +6 -0
- package/dist/_internal/plugin-manager/contributions.js +10 -0
- package/dist/_internal/plugin-sdk/authoring-finding.d.ts +19 -0
- package/dist/_internal/plugin-sdk/authoring-finding.js +12 -0
- package/dist/_internal/plugin-sdk/fragment-audit.d.ts +14 -0
- package/dist/_internal/plugin-sdk/fragment-audit.js +170 -0
- package/dist/_internal/plugin-sdk/fragment-definition.d.ts +11 -0
- package/dist/_internal/plugin-sdk/fragment-definition.js +16 -0
- package/dist/_internal/plugin-sdk/index.d.ts +9 -0
- package/dist/_internal/plugin-sdk/index.js +9 -0
- package/dist/_internal/plugin-sdk/material-config-groups.d.ts +44 -0
- package/dist/_internal/plugin-sdk/material-config-groups.js +80 -0
- package/dist/_internal/plugin-sdk/material-editor-audit.d.ts +24 -0
- package/dist/_internal/plugin-sdk/material-editor-audit.js +160 -0
- package/dist/_internal/plugin-sdk/material-rendered-element.d.ts +69 -0
- package/dist/_internal/plugin-sdk/material-rendered-element.js +165 -0
- package/dist/_internal/plugin-sdk/material-spec-audit.d.ts +22 -0
- package/dist/_internal/plugin-sdk/material-spec-audit.js +184 -0
- package/dist/_internal/plugin-sdk/material-spec.d.ts +114 -0
- package/dist/_internal/plugin-sdk/material-spec.js +635 -0
- package/dist/_internal/plugin-sdk/material-style-keys.d.ts +17 -0
- package/dist/_internal/plugin-sdk/material-style-keys.js +82 -0
- package/dist/_internal/renderer/index.d.ts +2 -0
- package/dist/_internal/renderer/index.js +1745 -616
- package/dist/_internal/renderer/renderer/renderer-component-states.d.ts +34 -0
- package/dist/_internal/renderer/renderer/renderer-effective-style.d.ts +12 -6
- package/dist/_internal/renderer/renderer/renderer-material-dom.d.ts +19 -3
- package/dist/_internal/renderer/renderer/renderer-mounted-material.d.ts +11 -10
- package/dist/_internal/renderer/renderer/renderer-state.d.ts +17 -1
- package/dist/_internal/renderer/renderer/renderer-theme.d.ts +11 -0
- package/dist/_internal/renderer/renderer/renderer-types.d.ts +15 -5
- package/dist/_internal/renderer/renderer/renderer.d.ts +30 -9
- package/dist/_internal/renderer/resource/data-source-runtime.d.ts +25 -2
- package/dist/_internal/renderer/resource/push-window.d.ts +43 -0
- package/dist/_internal/renderer/resource/source-query-port.d.ts +8 -1
- package/dist/_internal/renderer/sub-canvas-layer.d.ts +83 -0
- package/dist/_internal/renderer/viewer/viewer-blueprint-timer-scheduler.d.ts +23 -0
- package/dist/_internal/renderer/viewer/viewer-configuration-guards.d.ts +0 -1
- package/dist/_internal/renderer/viewer/viewer-configuration.d.ts +6 -3
- package/dist/_internal/renderer/viewer/viewer-stale-style.d.ts +3 -0
- package/dist/_internal/renderer/viewer/viewer-variable-controller.d.ts +2 -0
- package/dist/_internal/renderer/viewer/viewer.d.ts +18 -7
- package/dist/_internal/sdk/auto-register.js +7 -7
- package/dist/_internal/sdk/designer-auto-register.js +3 -3
- package/dist/_internal/sdk/designer.d.ts +1 -1
- package/dist/_internal/sdk/designer.js +8 -8
- package/dist/_internal/sdk/host-tokens.css +12 -12
- package/dist/_internal/sdk/index.d.ts +1 -1
- package/dist/_internal/sdk/index.js +6 -6
- package/dist/auto-register.js +11 -11
- package/dist/auto-register.js.map +1 -1
- package/dist/contracts.js +73 -43
- package/dist/contracts.js.map +1 -1
- package/dist/core.js +151 -23
- package/dist/core.js.map +1 -1
- package/dist/{data-contracts-BFld0hw_.js → data-contracts-CnnB5KC9.js} +2 -2
- package/dist/{data-contracts-BFld0hw_.js.map → data-contracts-CnnB5KC9.js.map} +1 -1
- package/dist/dataset-port-D993nOlT.js +182 -0
- package/dist/dataset-port-D993nOlT.js.map +1 -0
- package/dist/{designer-Byw45cUM.js → designer-3Tb0EIDV.js} +3 -3
- package/dist/designer-3Tb0EIDV.js.map +1 -0
- package/dist/designer-auto-register.js +6 -6
- package/dist/designer-auto-register.js.map +1 -1
- package/dist/designer-blueprint-workbench-panel-CJ3iZo5v-BebifP4x.js +2852 -0
- package/dist/designer-blueprint-workbench-panel-CJ3iZo5v-BebifP4x.js.map +1 -0
- package/dist/{designer-dataset-controller-CPytVNBK-DWL3SRTP.js → designer-dataset-controller-CrfOg2Ys-DhKUEJJe.js} +1487 -1232
- package/dist/designer-dataset-controller-CrfOg2Ys-DhKUEJJe.js.map +1 -0
- package/dist/{designer-ui-primitives-CH4RNiMa-BNXQwJPZ.js → designer-field-primitives-KBZuWN_D-B3h4jpYe.js} +871 -343
- package/dist/designer-field-primitives-KBZuWN_D-B3h4jpYe.js.map +1 -0
- package/dist/designer-left-panel-groups-dom-N2OHOWjl-D8CzGwbF.js +1265 -0
- package/dist/designer-left-panel-groups-dom-N2OHOWjl-D8CzGwbF.js.map +1 -0
- package/dist/designer.js +5 -5
- package/dist/dist-6GRboBs-.js +3305 -0
- package/dist/dist-6GRboBs-.js.map +1 -0
- package/dist/{dist-BHTClwId.js → dist-BjLjFUy1.js} +8564 -6030
- package/dist/dist-BjLjFUy1.js.map +1 -0
- package/dist/engine.js +5 -4
- package/dist/fragment-Y6YnW6wy.js +393 -0
- package/dist/fragment-Y6YnW6wy.js.map +1 -0
- package/dist/host-kit.js +297 -3
- package/dist/host-kit.js.map +1 -1
- package/dist/{host-resource-selection-5Cf_gclK-Sv4Z8UXS.js → host-resource-selection-xo2mLCD4-BR5XCcim.js} +1233 -937
- package/dist/host-resource-selection-xo2mLCD4-BR5XCcim.js.map +1 -0
- package/dist/host-tokens.css +12 -12
- package/dist/index.js +10 -10
- package/dist/level-scale-BzUjE31V.js +139 -0
- package/dist/level-scale-BzUjE31V.js.map +1 -0
- package/dist/{manager-B2CZ2b5I.js → manager-Ch0RTu_i.js} +20 -10
- package/dist/manager-Ch0RTu_i.js.map +1 -0
- package/dist/material-UbSfiuZq.js +12 -0
- package/dist/{material-BPlvEmDi.js.map → material-UbSfiuZq.js.map} +1 -1
- package/dist/material-auto-register.js +6 -6
- package/dist/material-auto-register.js.map +1 -1
- package/dist/{material-definition-B9xCZcD-.js → material-definition-BeW34dJr.js} +2 -2
- package/dist/{material-definition-B9xCZcD-.js.map → material-definition-BeW34dJr.js.map} +1 -1
- package/dist/{material-manifest-bsGl6vZZ.js → material-manifest-B1XatGPx.js} +222 -137
- package/dist/material-manifest-B1XatGPx.js.map +1 -0
- package/dist/material-schema-CLoDx-Tl.js +203 -0
- package/dist/material-schema-CLoDx-Tl.js.map +1 -0
- package/dist/{editor-descriptor-schema-Be30Wv8w.js → material-theme-C91eus78.js} +90 -28
- package/dist/material-theme-C91eus78.js.map +1 -0
- package/dist/material-validation-utils-ku_6Xxk2.js +125 -0
- package/dist/material-validation-utils-ku_6Xxk2.js.map +1 -0
- package/dist/material.js +3 -3
- package/dist/migrate-document-D3HhCVlZ.js +768 -0
- package/dist/migrate-document-D3HhCVlZ.js.map +1 -0
- package/dist/parse-AOTE9WnD.js +2308 -0
- package/dist/parse-AOTE9WnD.js.map +1 -0
- package/dist/{parse-B0hwp_yj.js → parse-B1OD1teS.js} +69 -61
- package/dist/{parse-B0hwp_yj.js.map → parse-B1OD1teS.js.map} +1 -1
- package/dist/parse-parts-BNrpdG5o.js +42 -0
- package/dist/parse-parts-BNrpdG5o.js.map +1 -0
- package/dist/{plugin-B9Xxtw7G.js → plugin-DHgh9uHh.js} +140 -94
- package/dist/plugin-DHgh9uHh.js.map +1 -0
- package/dist/plugin-core.js +93 -8
- package/dist/plugin-core.js.map +1 -0
- package/dist/plugin-manager.js +1 -1
- package/dist/plugin-package-Dr5ro6h6.js +1221 -0
- package/dist/plugin-package-Dr5ro6h6.js.map +1 -0
- package/dist/{plugin-registration-BjS_CXJU.js → plugin-registration-rsmb4GvS.js} +4 -4
- package/dist/{plugin-registration-BjS_CXJU.js.map → plugin-registration-rsmb4GvS.js.map} +1 -1
- package/dist/plugin-sdk.js +6 -6
- package/dist/{plugins-B9bwk-t6.js → plugins-DGRHgREK.js} +2 -2
- package/dist/{plugins-B9bwk-t6.js.map → plugins-DGRHgREK.js.map} +1 -1
- package/dist/plugins.js +8 -8
- package/dist/renderer.js +1 -1
- package/dist/runtime-dispatch-BfnRDtMe.js +479 -0
- package/dist/runtime-dispatch-BfnRDtMe.js.map +1 -0
- package/dist/{src-Bm7u11mN-BMeb9fvV.js → src-Bm7u11mN-_0u6cMEw.js} +60 -60
- package/dist/{src-Bm7u11mN-BMeb9fvV.js.map → src-Bm7u11mN-_0u6cMEw.js.map} +1 -1
- package/dist/{text-BVzTcUas.js → text-BNksUr5J.js} +401 -360
- package/dist/text-BNksUr5J.js.map +1 -0
- package/dist/theme-CcBXf4Ay.js +48 -0
- package/dist/theme-CcBXf4Ay.js.map +1 -0
- package/dist/{value-ref-y4_YKUP5.js → value-ref-BG_MV9C-.js} +2 -2
- package/dist/{value-ref-y4_YKUP5.js.map → value-ref-BG_MV9C-.js.map} +1 -1
- package/dist/{viewer-CrJupI8I-DZZfdHXr.js → viewer-CrJupI8I-D9dVcNw4.js} +5 -5
- package/dist/{viewer-CrJupI8I-DZZfdHXr.js.map → viewer-CrJupI8I-D9dVcNw4.js.map} +1 -1
- package/dist/viewer-auto-register.js +2 -2
- package/dist/viewer.js +2 -2
- package/dist/{contrast-CZFqj1I5.js → viewport-CiCKeAQH.js} +369 -411
- package/dist/viewport-CiCKeAQH.js.map +1 -0
- package/package.json +11 -11
- package/dist/_internal/contracts/document/blueprint-relations.d.ts +0 -16
- package/dist/_internal/contracts/document/blueprint-relations.js +0 -196
- package/dist/_internal/engine/browser/controllers/blueprint/designer-blueprint-panel-mutations.d.ts +0 -5
- package/dist/_internal/engine/browser/controllers/designer-guard-controller.d.ts +0 -27
- package/dist/_internal/engine/browser/controllers/designer-scene-controller.d.ts +0 -47
- package/dist/_internal/engine/browser/controllers/panel/designer-style-rules-controller.d.ts +0 -12
- package/dist/_internal/engine/browser/dom/guard/designer-contrast-measure.d.ts +0 -24
- package/dist/_internal/engine/browser/dom/guard/designer-guard-dom.d.ts +0 -15
- package/dist/_internal/engine/browser/dom/workspace/designer-canvas-hint-dom.d.ts +0 -6
- package/dist/_internal/engine/browser/viewport/designer-canvas-snap-index.d.ts +0 -9
- package/dist/_internal/engine/common/operations/blueprint/designer-blueprint-connection.d.ts +0 -14
- package/dist/_internal/engine/common/operations/blueprint/designer-blueprint-mutation-helpers.d.ts +0 -20
- package/dist/_internal/engine/common/operations/blueprint/designer-blueprint-mutations.d.ts +0 -15
- package/dist/_internal/engine/common/operations/blueprint/designer-blueprint-node-ids.d.ts +0 -12
- package/dist/_internal/engine/common/operations/designer-name-validation.d.ts +0 -2
- package/dist/_internal/engine/common/operations/scene/designer-scene.d.ts +0 -55
- package/dist/_internal/engine/common/operations/style/designer-host-conditional-style.d.ts +0 -21
- package/dist/_internal/engine/common/operations/style/designer-style-rules.d.ts +0 -25
- package/dist/_internal/engine/common/validation/designer-guard.d.ts +0 -49
- package/dist/_internal/engine/designer-blueprint-workbench-panel-C2MoZwKA.js +0 -3548
- package/dist/_internal/engine/designer-element/api/designer-element-guard.d.ts +0 -13
- package/dist/_internal/engine/designer-element/api/designer-element-scene.d.ts +0 -14
- package/dist/_internal/engine/designer-left-panel-groups-dom-WMsH33zw.js +0 -573
- package/dist/_internal/engine/host-resource-selection-5Cf_gclK.js +0 -2188
- package/dist/_internal/renderer/style-rules.d.ts +0 -9
- package/dist/contrast-CZFqj1I5.js.map +0 -1
- package/dist/dataset-port-CUsMmX2x.js +0 -65
- package/dist/dataset-port-CUsMmX2x.js.map +0 -1
- package/dist/designer-Byw45cUM.js.map +0 -1
- package/dist/designer-blueprint-workbench-panel-C2MoZwKA-CbXkv78O.js +0 -3517
- package/dist/designer-blueprint-workbench-panel-C2MoZwKA-CbXkv78O.js.map +0 -1
- package/dist/designer-dataset-controller-CPytVNBK-DWL3SRTP.js.map +0 -1
- package/dist/designer-left-panel-groups-dom-WMsH33zw-B9pl8loh.js +0 -557
- package/dist/designer-left-panel-groups-dom-WMsH33zw-B9pl8loh.js.map +0 -1
- package/dist/designer-ui-primitives-CH4RNiMa-BNXQwJPZ.js.map +0 -1
- package/dist/dist-BHTClwId.js.map +0 -1
- package/dist/dist-DfAV2jGI.js +0 -2185
- package/dist/dist-DfAV2jGI.js.map +0 -1
- package/dist/editor-descriptor-schema-Be30Wv8w.js.map +0 -1
- package/dist/host-resource-selection-5Cf_gclK-Sv4Z8UXS.js.map +0 -1
- package/dist/manager-B2CZ2b5I.js.map +0 -1
- package/dist/material-BPlvEmDi.js +0 -12
- package/dist/material-manifest-bsGl6vZZ.js.map +0 -1
- package/dist/material-schema-CtxTkCP2.js +0 -267
- package/dist/material-schema-CtxTkCP2.js.map +0 -1
- package/dist/migrate-document-BJUN7NPv.js +0 -436
- package/dist/migrate-document-BJUN7NPv.js.map +0 -1
- package/dist/parse-BQw3u9_4.js +0 -1126
- package/dist/parse-BQw3u9_4.js.map +0 -1
- package/dist/plugin-B9Xxtw7G.js.map +0 -1
- package/dist/plugin-package-BT-pCoTt.js +0 -174
- package/dist/plugin-package-BT-pCoTt.js.map +0 -1
- package/dist/runtime-dispatch-Dt9fhcI5.js +0 -360
- package/dist/runtime-dispatch-Dt9fhcI5.js.map +0 -1
- package/dist/schema-C38FI_z2.js +0 -541
- package/dist/schema-C38FI_z2.js.map +0 -1
- package/dist/text-BVzTcUas.js.map +0 -1
|
@@ -0,0 +1,2872 @@
|
|
|
1
|
+
import { A as e, D as t, F as n, G as r, H as i, I as a, K as o, L as s, M as c, N as l, O as u, R as d, U as f, W as p, _ as m, b as h, c as g, d as _, f as v, g as y, h as b, i as x, j as S, k as ee, l as te, m as ne, n as C, p as re, q as w, r as ie, s as ae, t as oe, u as T, w as E, y as se, z as D } from "./designer-left-panel-groups-dom-N2OHOWjl.js";
|
|
2
|
+
import { A as O, O as k, a as ce, c as le, p as A } from "./designer-field-primitives-KBZuWN_D.js";
|
|
3
|
+
import { compileScreenBlueprint as ue, traceScreenBlueprintEvent as de } from "@base-screen/core";
|
|
4
|
+
import { MAX_VALUE_REF_PATH_SEGMENTS as fe, SCREEN_BLUEPRINT_CAPABILITIES as pe, SCREEN_BLUEPRINT_FIXED_INPUT_PORTS as j, SCREEN_BLUEPRINT_FIXED_OUTPUT_PORTS as M, VALUE_REF_PATH_SEGMENT_PATTERN as me, parseScreenDocument as he, parseScreenJsonValue as ge, readScreenBlueprintActionPort as _e, readScreenBlueprintEdgeCategory as ve, readScreenBlueprintEventPort as N, resolveScreenStartPageId as ye, screenBlueprintPortTrigger as be, screenJsonEquals as xe } from "@base-screen/contracts";
|
|
5
|
+
//#region src/common/operations/blueprint/designer-blueprint-model.ts
|
|
6
|
+
var Se = 260, Ce = 176, P = 80;
|
|
7
|
+
function F(e, t, n) {
|
|
8
|
+
let r = ae(n, pe.materialEvent);
|
|
9
|
+
return e.components.flatMap((e) => {
|
|
10
|
+
let i = t?.get(e.type)?.manifest, a = new Map((i?.editorDescriptor?.events ?? []).map((e) => [e.name, e]));
|
|
11
|
+
return (i?.events ?? []).map((t) => {
|
|
12
|
+
let i = a.get(t), o = i?.requiredCapability, s = i?.triggerContexts === void 0 || i.triggerContexts.includes("blueprint");
|
|
13
|
+
return {
|
|
14
|
+
componentId: e.id,
|
|
15
|
+
componentName: e.name,
|
|
16
|
+
materialType: e.type,
|
|
17
|
+
name: t,
|
|
18
|
+
label: i?.label ?? t,
|
|
19
|
+
available: s && r && (o === void 0 || ae(n, o)),
|
|
20
|
+
...o === void 0 ? {} : { requiredCapability: o }
|
|
21
|
+
};
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
function we(e, t, n) {
|
|
26
|
+
let r = F(e, t, n);
|
|
27
|
+
return {
|
|
28
|
+
isEventAvailable: (e, t) => r.some((n) => n.componentId === e && n.name === t && n.available),
|
|
29
|
+
isHostActionAvailable: (e) => g(n, e),
|
|
30
|
+
componentStateIds: (t) => e.components.find((e) => e.id === t)?.states?.items.map((e) => e.id) ?? []
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
function Te(e, t, n) {
|
|
34
|
+
let r = F(e, t, n), i = Pe(e);
|
|
35
|
+
return e.components.map((t) => {
|
|
36
|
+
let n = s(e.blueprint, t.id);
|
|
37
|
+
return {
|
|
38
|
+
kind: "component",
|
|
39
|
+
entityId: t.id,
|
|
40
|
+
name: t.name,
|
|
41
|
+
subtitle: t.type,
|
|
42
|
+
depth: i.get(t.id) ?? 0,
|
|
43
|
+
...n === void 0 ? {} : { nodeId: n.id },
|
|
44
|
+
eventCount: r.filter((e) => e.componentId === t.id && e.available).length
|
|
45
|
+
};
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
function Ee(e, t) {
|
|
49
|
+
return A(e).map((n) => {
|
|
50
|
+
let r = d(e.blueprint, n.id);
|
|
51
|
+
return {
|
|
52
|
+
kind: "variable",
|
|
53
|
+
entityId: n.id,
|
|
54
|
+
name: n.name,
|
|
55
|
+
subtitle: t.variableKind[n.type],
|
|
56
|
+
depth: 0,
|
|
57
|
+
...r === void 0 ? {} : { nodeId: r.id },
|
|
58
|
+
eventCount: 1
|
|
59
|
+
};
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
function De(e, n, r, a) {
|
|
63
|
+
let o = a.graph, s = e.blueprint, c = F(e, n, r), l = te(r), u = new Map(e.components.map((e) => [e.id, e])), d = new Map(A(e).map((e) => [e.id, e])), f = new Map((e.subCanvases ?? []).map((e) => [e.id, e])), p = new Map(s.layout?.nodes.map((e) => [e.id, e])), m = Ne(s.nodes, s.edges), h = /* @__PURE__ */ new Set(), g = /* @__PURE__ */ new Map(), _ = /* @__PURE__ */ new Map();
|
|
64
|
+
for (let e of s.edges) _.set(e.from.node, (_.get(e.from.node) ?? 0) + 1), g.set(e.to.node, (g.get(e.to.node) ?? 0) + 1), e.kind === "flow" && (h.add(`${e.from.node}\u0000out\u0000${e.from.port}`), h.add(`${e.to.node}\u0000in\u0000${e.to.port}`));
|
|
65
|
+
let v = (e, t, n, r, i = !0) => ({
|
|
66
|
+
id: n,
|
|
67
|
+
direction: t,
|
|
68
|
+
label: r,
|
|
69
|
+
available: i,
|
|
70
|
+
connected: h.has(`${e.id}\u0000${t}\u0000${n}`),
|
|
71
|
+
...i ? {} : { unavailableReason: o.unavailablePort }
|
|
72
|
+
}), y = (e, t) => {
|
|
73
|
+
let n = [];
|
|
74
|
+
for (let r of s.edges) {
|
|
75
|
+
if (r.kind !== "flow") continue;
|
|
76
|
+
let i = t === "out" ? r.from : r.to;
|
|
77
|
+
i.node === e.id && !n.includes(i.port) && n.push(i.port);
|
|
78
|
+
}
|
|
79
|
+
return n;
|
|
80
|
+
}, b = s.nodes.map((e) => {
|
|
81
|
+
let t = p.get(e.id) ?? m.get(e.id) ?? {
|
|
82
|
+
x: P,
|
|
83
|
+
y: P
|
|
84
|
+
}, n = j[e.kind].map((t) => v(e, "in", t, o.ports[t] ?? t)), r = M[e.kind].map((t) => v(e, "out", t, o.ports[t] ?? t)), i = {
|
|
85
|
+
id: e.id,
|
|
86
|
+
kind: e.kind,
|
|
87
|
+
x: t.x,
|
|
88
|
+
y: t.y,
|
|
89
|
+
enabled: e.enabled !== !1,
|
|
90
|
+
semantic: !1,
|
|
91
|
+
renamable: e.kind === "timer" || e.kind === "condition",
|
|
92
|
+
duplicable: e.kind === "timer" || e.kind === "condition",
|
|
93
|
+
inboundCount: g.get(e.id) ?? 0,
|
|
94
|
+
outboundCount: _.get(e.id) ?? 0
|
|
95
|
+
};
|
|
96
|
+
switch (e.kind) {
|
|
97
|
+
case "component": {
|
|
98
|
+
let t = u.get(e.componentId), r = c.filter((t) => t.componentId === e.componentId).map((t) => v(e, "out", `event:${t.name}`, t.label, t.available)), a = t?.states !== void 0;
|
|
99
|
+
a && r.push(v(e, "out", "state-changed", o.ports["state-changed"] ?? "state"));
|
|
100
|
+
for (let t of y(e, "out")) {
|
|
101
|
+
if (r.some((e) => e.id === t)) continue;
|
|
102
|
+
let n = N(t) ?? t;
|
|
103
|
+
r.push(v(e, "out", t, o.missingEventPort(n), !1));
|
|
104
|
+
}
|
|
105
|
+
return {
|
|
106
|
+
...i,
|
|
107
|
+
title: t?.name ?? e.componentId,
|
|
108
|
+
subtitle: t === void 0 ? o.missingEntity : t.type,
|
|
109
|
+
outputs: r,
|
|
110
|
+
inputs: a ? n : n.filter((e) => e.id !== "set-state" && e.id !== "reset-state"),
|
|
111
|
+
semantic: !0,
|
|
112
|
+
componentId: e.componentId,
|
|
113
|
+
...t === void 0 ? {} : {
|
|
114
|
+
materialType: t.type,
|
|
115
|
+
hidden: t.status.hidden
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
case "variable": {
|
|
120
|
+
let t = d.get(e.variableId);
|
|
121
|
+
return {
|
|
122
|
+
...i,
|
|
123
|
+
title: t?.name ?? e.variableId,
|
|
124
|
+
subtitle: t === void 0 ? o.missingEntity : a.variableKind[t.type],
|
|
125
|
+
outputs: r,
|
|
126
|
+
inputs: n,
|
|
127
|
+
variableId: e.variableId,
|
|
128
|
+
...t === void 0 ? {} : { variableType: t.type }
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
case "host": {
|
|
132
|
+
let t = [];
|
|
133
|
+
for (let n of y(e, "in")) {
|
|
134
|
+
let r = N(n);
|
|
135
|
+
r !== void 0 && t.push(v(e, "in", n, o.hostEventPort(r)));
|
|
136
|
+
}
|
|
137
|
+
t.push(v(e, "in", `event:${ke(s, e.id)}`, o.newHostEventPort));
|
|
138
|
+
for (let n of l) t.push(v(e, "in", `action:${n.actionId}`, o.hostActionPort(n.name)));
|
|
139
|
+
for (let n of y(e, "in")) {
|
|
140
|
+
let r = _e(n);
|
|
141
|
+
r === void 0 || t.some((e) => e.id === n) || t.push(v(e, "in", n, a.hostActionUndeclared(r), !1));
|
|
142
|
+
}
|
|
143
|
+
return {
|
|
144
|
+
...i,
|
|
145
|
+
title: o.nodeKinds.host,
|
|
146
|
+
subtitle: o.nodeKindHints.host,
|
|
147
|
+
outputs: [],
|
|
148
|
+
inputs: t
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
case "lifecycle": return {
|
|
152
|
+
...i,
|
|
153
|
+
title: o.nodeKinds.lifecycle,
|
|
154
|
+
subtitle: o.nodeKindHints.lifecycle,
|
|
155
|
+
outputs: r,
|
|
156
|
+
inputs: []
|
|
157
|
+
};
|
|
158
|
+
case "timer": return {
|
|
159
|
+
...i,
|
|
160
|
+
title: e.name ?? o.timerTitle(e.intervalSeconds),
|
|
161
|
+
subtitle: o.nodeKinds.timer,
|
|
162
|
+
outputs: r,
|
|
163
|
+
inputs: [],
|
|
164
|
+
intervalSeconds: e.intervalSeconds,
|
|
165
|
+
...e.name === void 0 ? {} : { name: e.name }
|
|
166
|
+
};
|
|
167
|
+
case "sub-canvas": {
|
|
168
|
+
let t = f.get(e.canvasId), n = o.subCanvasPorts[t?.display ?? "popup"];
|
|
169
|
+
return {
|
|
170
|
+
...i,
|
|
171
|
+
title: t?.name ?? e.canvasId,
|
|
172
|
+
subtitle: t === void 0 ? o.missingEntity : o.subCanvasKinds[t.display],
|
|
173
|
+
outputs: M["sub-canvas"].map((t) => v(e, "out", t, n[t] ?? t)),
|
|
174
|
+
inputs: j["sub-canvas"].map((t) => v(e, "in", t, n[t] ?? t)),
|
|
175
|
+
canvasId: e.canvasId,
|
|
176
|
+
...t === void 0 ? {} : { canvasDisplay: t.display }
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
case "main-canvas": return {
|
|
180
|
+
...i,
|
|
181
|
+
title: o.nodeKinds["main-canvas"],
|
|
182
|
+
subtitle: o.nodeKindHints["main-canvas"],
|
|
183
|
+
outputs: M["main-canvas"].map((t) => v(e, "out", t, o.mainCanvasPorts[t] ?? t)),
|
|
184
|
+
inputs: j["main-canvas"].map((t) => v(e, "in", t, o.mainCanvasPorts[t] ?? t))
|
|
185
|
+
};
|
|
186
|
+
case "condition": return {
|
|
187
|
+
...i,
|
|
188
|
+
title: e.name ?? o.conditionTitle,
|
|
189
|
+
subtitle: Ae(e.condition, a),
|
|
190
|
+
outputs: r,
|
|
191
|
+
inputs: n,
|
|
192
|
+
condition: e.condition,
|
|
193
|
+
...e.name === void 0 ? {} : { name: e.name }
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
Me(b, p);
|
|
198
|
+
let x = new Map(b.map((e) => [e.id, e])), S = t(s);
|
|
199
|
+
return {
|
|
200
|
+
nodes: b,
|
|
201
|
+
edges: s.edges.map((e) => {
|
|
202
|
+
let t = x.get(e.from.node), n = x.get(e.to.node), r = t?.enabled !== !1 && n?.enabled !== !1;
|
|
203
|
+
if (e.kind === "semantic") return {
|
|
204
|
+
id: e.id,
|
|
205
|
+
kind: "semantic",
|
|
206
|
+
category: "semantic",
|
|
207
|
+
source: e.from.node,
|
|
208
|
+
sourcePort: "semantic",
|
|
209
|
+
target: e.to.node,
|
|
210
|
+
targetPort: "semantic",
|
|
211
|
+
label: a.semanticRoles[e.role],
|
|
212
|
+
role: e.role,
|
|
213
|
+
active: r
|
|
214
|
+
};
|
|
215
|
+
let o = i(s, e.id), c = n?.inputs.find((t) => t.id === e.to.port);
|
|
216
|
+
return {
|
|
217
|
+
id: e.id,
|
|
218
|
+
kind: "flow",
|
|
219
|
+
category: ve(e, S),
|
|
220
|
+
source: e.from.node,
|
|
221
|
+
sourcePort: e.from.port,
|
|
222
|
+
target: e.to.node,
|
|
223
|
+
targetPort: e.to.port,
|
|
224
|
+
label: c?.label ?? e.to.port,
|
|
225
|
+
...o === void 0 ? {} : {
|
|
226
|
+
order: o.order,
|
|
227
|
+
siblingCount: o.count
|
|
228
|
+
},
|
|
229
|
+
...e.value === void 0 ? {} : { value: e.value },
|
|
230
|
+
...e.payload === void 0 ? {} : { payload: e.payload },
|
|
231
|
+
...e.transition === void 0 ? {} : { transition: e.transition },
|
|
232
|
+
...e.stateId === void 0 ? {} : { stateId: e.stateId },
|
|
233
|
+
active: r
|
|
234
|
+
};
|
|
235
|
+
}),
|
|
236
|
+
...s.layout?.viewport === void 0 ? {} : { viewport: s.layout.viewport }
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
function Oe(e, t) {
|
|
240
|
+
let n = [];
|
|
241
|
+
for (let r of t.blueprint.nodes) {
|
|
242
|
+
if (r.enabled === !1) continue;
|
|
243
|
+
let t = e.nodes.find((e) => e.id === r.id);
|
|
244
|
+
for (let e of t?.outputs ?? []) e.connected && be(r, e.id) !== void 0 && n.push({
|
|
245
|
+
nodeId: r.id,
|
|
246
|
+
port: e.id,
|
|
247
|
+
label: `${t?.title ?? r.id} · ${e.label}`
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
return n;
|
|
251
|
+
}
|
|
252
|
+
function ke(e, t) {
|
|
253
|
+
let n = new Set(e.edges.flatMap((e) => e.kind === "flow" && e.to.node === t ? [e.to.port] : []));
|
|
254
|
+
for (let e = 1;; e++) if (!n.has(`event:event${e}`)) return `event${e}`;
|
|
255
|
+
}
|
|
256
|
+
function Ae(e, t) {
|
|
257
|
+
let n = (e) => {
|
|
258
|
+
switch (e.kind) {
|
|
259
|
+
case "literal": return JSON.stringify(e.value) ?? "null";
|
|
260
|
+
case "event-payload": return e.path.length === 0 ? "payload" : `payload.${e.path.join(".")}`;
|
|
261
|
+
case "variable": return e.variableId;
|
|
262
|
+
default: return e.kind;
|
|
263
|
+
}
|
|
264
|
+
}, r = t.conditionOperator(e.operator);
|
|
265
|
+
return e.right === void 0 ? `${n(e.left)} ${r}` : `${n(e.left)} ${r} ${n(e.right)}`;
|
|
266
|
+
}
|
|
267
|
+
function je(e) {
|
|
268
|
+
let t = e.inputs.length + e.outputs.length + +!!e.semantic;
|
|
269
|
+
return Math.max(108, 71 + t * 27);
|
|
270
|
+
}
|
|
271
|
+
function Me(e, t) {
|
|
272
|
+
let n = /* @__PURE__ */ new Map();
|
|
273
|
+
e.forEach((e, r) => {
|
|
274
|
+
if (t.has(e.id)) return;
|
|
275
|
+
let i = n.get(e.x) ?? [];
|
|
276
|
+
i.push(r), n.set(e.x, i);
|
|
277
|
+
});
|
|
278
|
+
for (let t of n.values()) {
|
|
279
|
+
let n = P;
|
|
280
|
+
for (let r of t) {
|
|
281
|
+
let t = e[r];
|
|
282
|
+
e[r] = {
|
|
283
|
+
...t,
|
|
284
|
+
y: n
|
|
285
|
+
}, n += je(t) + 28;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
function Ne(e, t) {
|
|
290
|
+
let n = /* @__PURE__ */ new Map();
|
|
291
|
+
for (let e of t) {
|
|
292
|
+
if (e.kind !== "flow") continue;
|
|
293
|
+
let t = n.get(e.to.node);
|
|
294
|
+
t === void 0 ? n.set(e.to.node, [e.from.node]) : t.push(e.from.node);
|
|
295
|
+
}
|
|
296
|
+
let r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Set(), a = (e) => {
|
|
297
|
+
let t = r.get(e);
|
|
298
|
+
if (t !== void 0) return t;
|
|
299
|
+
if (i.has(e)) return 0;
|
|
300
|
+
i.add(e);
|
|
301
|
+
let o = 0;
|
|
302
|
+
for (let t of n.get(e) ?? []) o = Math.max(o, a(t) + 1);
|
|
303
|
+
return i.delete(e), r.set(e, Math.min(o, 12)), r.get(e);
|
|
304
|
+
}, o = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
|
|
305
|
+
for (let t of e) {
|
|
306
|
+
let e = a(t.id), n = o.get(e) ?? 0;
|
|
307
|
+
o.set(e, n + 1), s.set(t.id, {
|
|
308
|
+
x: P + e * Se,
|
|
309
|
+
y: P + n * Ce
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
return s;
|
|
313
|
+
}
|
|
314
|
+
function Pe(e) {
|
|
315
|
+
let t = new Map(e.components.map((e) => [e.id, e])), n = /* @__PURE__ */ new Map();
|
|
316
|
+
for (let r of e.components) {
|
|
317
|
+
let e = 0, i = r.parentId, a = /* @__PURE__ */ new Set([r.id]);
|
|
318
|
+
for (; i !== null && !a.has(i);) a.add(i), e += 1, i = t.get(i)?.parentId ?? null;
|
|
319
|
+
n.set(r.id, e);
|
|
320
|
+
}
|
|
321
|
+
return n;
|
|
322
|
+
}
|
|
323
|
+
//#endregion
|
|
324
|
+
//#region src/browser/dom/blueprint/designer-blueprint-default-canvas.ts
|
|
325
|
+
var Fe = 0, I = 8, L = .3, Ie = 2, R = O.blueprint.graph, Le = [
|
|
326
|
+
"lifecycle",
|
|
327
|
+
"timer",
|
|
328
|
+
"condition",
|
|
329
|
+
"host"
|
|
330
|
+
], Re = {
|
|
331
|
+
component: "cube",
|
|
332
|
+
variable: "variable",
|
|
333
|
+
host: "database",
|
|
334
|
+
lifecycle: "play",
|
|
335
|
+
timer: "activity",
|
|
336
|
+
condition: "sliders",
|
|
337
|
+
"sub-canvas": "copy",
|
|
338
|
+
"main-canvas": "grid"
|
|
339
|
+
};
|
|
340
|
+
function ze(e) {
|
|
341
|
+
let t = new Be(e);
|
|
342
|
+
return {
|
|
343
|
+
element: t.element,
|
|
344
|
+
destroy: () => t.destroy()
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
var Be = class {
|
|
348
|
+
element;
|
|
349
|
+
#e;
|
|
350
|
+
#t;
|
|
351
|
+
#n;
|
|
352
|
+
#r;
|
|
353
|
+
#i;
|
|
354
|
+
#a;
|
|
355
|
+
#o;
|
|
356
|
+
#s;
|
|
357
|
+
#c;
|
|
358
|
+
#l;
|
|
359
|
+
#u;
|
|
360
|
+
#d;
|
|
361
|
+
#f = {
|
|
362
|
+
x: 40,
|
|
363
|
+
y: 40,
|
|
364
|
+
z: 1
|
|
365
|
+
};
|
|
366
|
+
#p = !1;
|
|
367
|
+
#m = /* @__PURE__ */ new Map();
|
|
368
|
+
#h = {
|
|
369
|
+
nodes: [],
|
|
370
|
+
edges: []
|
|
371
|
+
};
|
|
372
|
+
#g;
|
|
373
|
+
#_;
|
|
374
|
+
#v;
|
|
375
|
+
#y = !0;
|
|
376
|
+
#b = !0;
|
|
377
|
+
#x = !1;
|
|
378
|
+
#S;
|
|
379
|
+
#C = !1;
|
|
380
|
+
#w = {
|
|
381
|
+
x: 0,
|
|
382
|
+
y: 0
|
|
383
|
+
};
|
|
384
|
+
#T = -1;
|
|
385
|
+
#E = 0;
|
|
386
|
+
#D = "";
|
|
387
|
+
#O = "";
|
|
388
|
+
#k = "";
|
|
389
|
+
#A = "";
|
|
390
|
+
#j = /* @__PURE__ */ new Set();
|
|
391
|
+
#M = [];
|
|
392
|
+
constructor(e) {
|
|
393
|
+
this.#e = e;
|
|
394
|
+
let t = e.createElement("div");
|
|
395
|
+
t.className = "designer-blueprint-canvas", t.tabIndex = 0, t.setAttribute("role", "application"), t.setAttribute("aria-label", O.blueprint.canvas), t.dataset.designerBlueprintCanvas = "true", t.innerHTML = `<div class="bp-toolbar" role="toolbar" aria-label="${T(O.blueprint.localToolbar)}"></div>
|
|
396
|
+
<div class="bp-stage" data-bp-stage>
|
|
397
|
+
<div class="bp-world" data-bp-world>
|
|
398
|
+
<svg class="bp-edges" data-bp-edges aria-hidden="true"></svg>
|
|
399
|
+
<div class="bp-nodes" data-bp-nodes></div>
|
|
400
|
+
<div class="bp-labels" data-bp-labels></div>
|
|
401
|
+
</div>
|
|
402
|
+
<div class="bp-marquee" data-bp-marquee hidden></div>
|
|
403
|
+
<div class="bp-empty" data-bp-empty hidden></div>
|
|
404
|
+
</div>
|
|
405
|
+
<div class="bp-simulation" data-bp-simulation hidden></div>
|
|
406
|
+
<div class="designer-context-menu bp-context-menu" data-bp-menu role="menu" hidden tabindex="-1"></div>`, this.element = t, this.#c = t.querySelector(".bp-toolbar"), this.#t = t.querySelector("[data-bp-stage]"), this.#n = t.querySelector("[data-bp-world]"), this.#r = t.querySelector("[data-bp-edges]"), this.#i = t.querySelector("[data-bp-nodes]"), this.#a = t.querySelector("[data-bp-labels]"), this.#o = t.querySelector("[data-bp-marquee]"), this.#s = t.querySelector("[data-bp-menu]"), this.#l = t.querySelector("[data-bp-simulation]"), this.#u = t.querySelector("[data-bp-empty]"), this.listen(t, y, (e) => this.receive(e.detail.state)), this.listen(this.#t, "pointerdown", (e) => this.onPointerDown(e)), this.listen(this.#t, "pointermove", (e) => this.onPointerMove(e)), this.listen(this.#t, "pointerup", (e) => this.onPointerUp(e)), this.listen(this.#t, "pointercancel", () => this.cancelDrag()), this.listen(this.#t, "pointerleave", () => this.setHoverEdge(void 0)), this.listen(this.#t, "contextmenu", (e) => e.preventDefault()), this.listen(this.#t, "dblclick", (e) => this.onDoubleClick(e)), this.listen(this.#t, "wheel", (e) => this.onWheel(e), { passive: !1 }), this.listen(this.#t, "dragover", (e) => this.onDragOver(e)), this.listen(this.#t, "drop", (e) => this.onDrop(e)), this.listen(t, "keydown", (e) => this.onKeyDown(e)), this.listen(t, "keyup", (e) => {
|
|
407
|
+
e.code === "Space" && (this.#C = !1, this.#t.classList.remove("is-space"));
|
|
408
|
+
}), this.listen(this.#c, "click", (e) => this.onToolbarClick(e)), this.listen(this.#s, "click", (e) => this.onMenuClick(e)), this.listen(this.#l, "click", (e) => this.onSimulationClick(e)), this.listen(this.#l, "change", (e) => {
|
|
409
|
+
let t = e.target.closest("[data-bp-sim-trigger]");
|
|
410
|
+
t !== null && (this.#S = t.value);
|
|
411
|
+
}), this.listen(e, "pointerdown", (e) => {
|
|
412
|
+
!this.#s.hidden && !e.composedPath().includes(this.#s) && this.closeMenu();
|
|
413
|
+
}), this.renderToolbar(), this.applyView(), queueMicrotask(() => this.send({ type: "ready" }));
|
|
414
|
+
}
|
|
415
|
+
destroy() {
|
|
416
|
+
for (let [e, t, n, r] of this.#M) e.removeEventListener(t, n, r);
|
|
417
|
+
this.#M.length = 0;
|
|
418
|
+
}
|
|
419
|
+
listen(e, t, n, r) {
|
|
420
|
+
e.addEventListener(t, n, r), this.#M.push([
|
|
421
|
+
e,
|
|
422
|
+
t,
|
|
423
|
+
n,
|
|
424
|
+
r
|
|
425
|
+
]);
|
|
426
|
+
}
|
|
427
|
+
receive(e) {
|
|
428
|
+
let t = this.#d;
|
|
429
|
+
this.#d = e, this.#h = e.selection, (t === void 0 || t.documentRevision !== e.documentRevision) && this.#m.clear(), !this.#p && e.graph.viewport !== void 0 && (this.#f = {
|
|
430
|
+
x: e.graph.viewport.x,
|
|
431
|
+
y: e.graph.viewport.y,
|
|
432
|
+
z: z(e.graph.viewport.zoom, L, Ie)
|
|
433
|
+
}, this.#p = !0), this.element.dataset.active = String(e.active), this.render();
|
|
434
|
+
let n = e.viewRequest;
|
|
435
|
+
n !== void 0 && n.id !== this.#T ? (this.#T = n.id, n.type === "fit" ? this.fit() : n.type === "auto-layout" ? this.autoLayout() : n.targetId !== void 0 && this.focus(n.targetId)) : !this.#p && e.graph.nodes.length > 0 && (this.#p = !0, this.fit());
|
|
436
|
+
}
|
|
437
|
+
send(e) {
|
|
438
|
+
let t = this.#d, n = {
|
|
439
|
+
...e,
|
|
440
|
+
commandId: `default-canvas-${++this.#E}`,
|
|
441
|
+
generation: t?.generation ?? 0,
|
|
442
|
+
documentRevision: t?.documentRevision ?? 0
|
|
443
|
+
};
|
|
444
|
+
this.element.dispatchEvent(new CustomEvent(b, {
|
|
445
|
+
bubbles: !0,
|
|
446
|
+
composed: !0,
|
|
447
|
+
detail: { command: n }
|
|
448
|
+
}));
|
|
449
|
+
}
|
|
450
|
+
select(e) {
|
|
451
|
+
this.#h = e, this.renderSelection(), this.send({
|
|
452
|
+
type: "select",
|
|
453
|
+
selection: e
|
|
454
|
+
});
|
|
455
|
+
}
|
|
456
|
+
get graph() {
|
|
457
|
+
return this.#d?.graph ?? {
|
|
458
|
+
nodes: [],
|
|
459
|
+
edges: []
|
|
460
|
+
};
|
|
461
|
+
}
|
|
462
|
+
node(e) {
|
|
463
|
+
return this.graph.nodes.find((t) => t.id === e);
|
|
464
|
+
}
|
|
465
|
+
position(e) {
|
|
466
|
+
return this.#m.get(e.id) ?? {
|
|
467
|
+
x: e.x,
|
|
468
|
+
y: e.y
|
|
469
|
+
};
|
|
470
|
+
}
|
|
471
|
+
rows(e) {
|
|
472
|
+
return [
|
|
473
|
+
...e.outputs,
|
|
474
|
+
...e.inputs,
|
|
475
|
+
...e.semantic ? ["semantic"] : []
|
|
476
|
+
];
|
|
477
|
+
}
|
|
478
|
+
height(e) {
|
|
479
|
+
return Math.max(108, 56 + this.rows(e).length * 27 + 13 + 2);
|
|
480
|
+
}
|
|
481
|
+
portPoint(e, t, n) {
|
|
482
|
+
let r = this.rows(e), i = Math.max(0, r.findIndex((e) => t === "semantic" ? e === "semantic" : e !== "semantic" && e.id === t && e.direction === n)), a = this.position(e);
|
|
483
|
+
return {
|
|
484
|
+
x: n === "out" ? a.x + 164 + Fe : a.x - Fe,
|
|
485
|
+
y: a.y + 1 + 44 + 12 + i * 27 + 27 / 2
|
|
486
|
+
};
|
|
487
|
+
}
|
|
488
|
+
toWorld(e, t) {
|
|
489
|
+
let n = this.#t.getBoundingClientRect();
|
|
490
|
+
return {
|
|
491
|
+
x: (e - n.left - this.#f.x) / this.#f.z,
|
|
492
|
+
y: (t - n.top - this.#f.y) / this.#f.z
|
|
493
|
+
};
|
|
494
|
+
}
|
|
495
|
+
visibleEdge(e) {
|
|
496
|
+
return e.kind !== "semantic" || this.#b && (this.#d?.showSemantic ?? !0);
|
|
497
|
+
}
|
|
498
|
+
render() {
|
|
499
|
+
this.renderNodes(), this.renderEdges(), this.renderToolbar(), this.renderSimulation();
|
|
500
|
+
let e = this.graph.nodes.length === 0;
|
|
501
|
+
this.#u.hidden = !e, e && (this.#u.innerHTML = `<strong>${_(O.blueprint.directNodeHint)}</strong>`);
|
|
502
|
+
}
|
|
503
|
+
renderNodes() {
|
|
504
|
+
let e = this.#y ? this.#d?.trace : null;
|
|
505
|
+
this.#j = new Set(e?.visitedNodeIds ?? []);
|
|
506
|
+
let t = this.connectedPorts(), n = this.portCategories(), r = this.graph.nodes.map((e) => {
|
|
507
|
+
let r = this.position(e), i = this.rows(e).map((r) => {
|
|
508
|
+
if (r === "semantic") {
|
|
509
|
+
let n = t.has(`${e.id}\u0000semantic`);
|
|
510
|
+
return `<div class="bp-anchor bp-anchor-semantic"><span class="bp-port bp-port-semantic${n ? " is-used" : ""}" data-bp-node="${T(e.id)}" data-bp-port="semantic" data-bp-dir="in"></span><span class="bp-anchor-label">${_(R.ports.semantic ?? "")}</span><span class="bp-port bp-port-semantic${n ? " is-used" : ""}" data-bp-node="${T(e.id)}" data-bp-port="semantic" data-bp-dir="out"></span></div>`;
|
|
511
|
+
}
|
|
512
|
+
let i = r.unavailableReason === void 0 ? r.id : `${r.id} · ${r.unavailableReason}`, a = n.get(`${e.id}\u0000${r.direction}\u0000${r.id}`);
|
|
513
|
+
return `<div class="bp-anchor" data-dir="${r.direction}" data-available="${String(r.available)}" title="${T(i)}"><span class="bp-port${r.connected ? " is-used" : ""}" data-bp-node="${T(e.id)}" data-bp-port="${T(r.id)}" data-bp-dir="${r.direction}" data-available="${String(r.available)}"${a === void 0 ? "" : ` data-category="${a}"`}></span><span class="bp-anchor-label">${_(r.label)}</span></div>`;
|
|
514
|
+
}).join(""), a = e.kind === "sub-canvas" && e.canvasDisplay !== void 0 ? R.subCanvasKinds[e.canvasDisplay] : R.nodeKinds[e.kind], o = e.kind === "sub-canvas" && e.canvasDisplay === "page" ? "doc" : Re[e.kind], s = this.#v === e.id ? `<input class="bp-rename" data-bp-rename-input value="${T(e.name ?? e.title)}" maxlength="64" aria-label="${T(R.nodeName)}">` : _(e.title);
|
|
515
|
+
return `<div class="bp-node" data-bp-node-id="${T(e.id)}" data-kind="${e.kind}" data-enabled="${String(e.enabled)}" style="left:${r.x}px;top:${r.y}px;min-height:${this.height(e)}px" role="group" aria-label="${T(`${a} ${e.title}`)}">
|
|
516
|
+
<div class="bp-node-header" data-bp-drag="${T(e.id)}" title="${T(`${e.title} · ${e.subtitle}`)}"><span class="bp-node-icon" aria-hidden="true">${k(o)}</span><span class="bp-node-heading"><span class="bp-node-title" data-bp-rename="${T(e.id)}">${s}</span>${e.title === a ? "" : `<span class="bp-node-kind">${_(a)}</span>`}</span></div>
|
|
517
|
+
<div class="bp-node-content">${i}</div>
|
|
518
|
+
</div>`;
|
|
519
|
+
}).join("");
|
|
520
|
+
if (r === this.#D) {
|
|
521
|
+
this.applyNodeState();
|
|
522
|
+
return;
|
|
523
|
+
}
|
|
524
|
+
this.#D = r, this.#i.innerHTML = r, this.applyNodeState();
|
|
525
|
+
let i = this.#i.querySelector("[data-bp-rename-input]");
|
|
526
|
+
i !== null && (i.focus(), i.select(), i.addEventListener("pointerdown", (e) => e.stopPropagation()), i.addEventListener("keydown", (e) => {
|
|
527
|
+
e.stopPropagation(), e.key === "Enter" && i.blur(), e.key === "Escape" && (this.#v = void 0, this.renderNodes());
|
|
528
|
+
}), i.addEventListener("blur", () => this.finishRename(i.value)));
|
|
529
|
+
}
|
|
530
|
+
connectedPorts() {
|
|
531
|
+
let e = /* @__PURE__ */ new Set();
|
|
532
|
+
for (let t of this.graph.edges) t.kind === "semantic" && (e.add(`${t.source}\u0000semantic`), e.add(`${t.target}\u0000semantic`));
|
|
533
|
+
return e;
|
|
534
|
+
}
|
|
535
|
+
portCategories() {
|
|
536
|
+
let e = /* @__PURE__ */ new Map();
|
|
537
|
+
for (let t of this.graph.edges) {
|
|
538
|
+
if (t.kind === "semantic") continue;
|
|
539
|
+
let n = `${t.source}\u0000out\u0000${t.sourcePort}`, r = `${t.target}\u0000in\u0000${t.targetPort}`;
|
|
540
|
+
e.has(n) || e.set(n, t.category), e.has(r) || e.set(r, t.category);
|
|
541
|
+
}
|
|
542
|
+
return e;
|
|
543
|
+
}
|
|
544
|
+
renderEdges(e) {
|
|
545
|
+
let t = this.#y ? this.#d?.trace : null, n = new Set(t?.executedEdgeIds ?? []), r = "", i = "";
|
|
546
|
+
for (let e of this.graph.edges) {
|
|
547
|
+
if (!this.visibleEdge(e)) continue;
|
|
548
|
+
let t = this.node(e.source), a = this.node(e.target);
|
|
549
|
+
if (t === void 0 || a === void 0) continue;
|
|
550
|
+
let o = Ve(this.portPoint(t, e.sourcePort, "out"), this.portPoint(a, e.targetPort, "in")), s = [
|
|
551
|
+
"bp-edge",
|
|
552
|
+
`is-${e.kind}`,
|
|
553
|
+
e.active ? "" : "is-off",
|
|
554
|
+
n.has(e.id) ? "is-traced" : ""
|
|
555
|
+
].filter((e) => e !== "").join(" ");
|
|
556
|
+
r += `<g class="${s}" data-bp-edge-group="${T(e.id)}" data-bp-edge-source="${T(e.source)}" data-bp-edge-target="${T(e.target)}" data-category="${e.category}"><path class="bp-edge-line" d="${o.d}"/><path class="bp-edge-flow" d="${o.d}"/><path class="bp-edge-arrow" d="M-4.5,-4 L4,0 L-4.5,4 L-2.5,0 Z" transform="translate(${o.mid.x} ${o.mid.y}) rotate(${o.angle})"/><path class="bp-edge-hit" data-bp-edge="${T(e.id)}" d="${o.d}"/></g>`;
|
|
557
|
+
let c = e.order !== void 0 && (e.siblingCount ?? 1) > 1 ? `#${e.order} ` : "";
|
|
558
|
+
i += `<div class="bp-edge-label" data-bp-edge-label="${T(e.id)}" data-category="${e.category}" style="left:${o.mid.x}px;top:${o.mid.y}px">${_(c + e.label)}</div>`;
|
|
559
|
+
}
|
|
560
|
+
e !== void 0 && (r += `<path class="bp-edge-ghost" d="${Ve(e.from, e.to).d}"/><circle class="bp-edge-ghost-end" cx="${e.to.x}" cy="${e.to.y}" r="4"/>`);
|
|
561
|
+
let a = `${r}\u0000${i}`;
|
|
562
|
+
a !== this.#O && (this.#O = a, this.#r.innerHTML = r, this.#a.innerHTML = i), this.applyEdgeState();
|
|
563
|
+
}
|
|
564
|
+
renderSelection() {
|
|
565
|
+
this.applyNodeState(), this.applyEdgeState();
|
|
566
|
+
}
|
|
567
|
+
focusSets() {
|
|
568
|
+
let e = new Set(this.#h.nodes), t = new Set(this.#h.edges), n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
|
|
569
|
+
for (let i of this.graph.edges) this.visibleEdge(i) && (t.has(i.id) || e.has(i.source) || e.has(i.target)) && (r.add(i.id), n.add(i.source), n.add(i.target));
|
|
570
|
+
return {
|
|
571
|
+
nodes: n,
|
|
572
|
+
edges: r
|
|
573
|
+
};
|
|
574
|
+
}
|
|
575
|
+
applyFocus() {
|
|
576
|
+
let e = this.#h.nodes.length + this.#h.edges.length;
|
|
577
|
+
this.#t.dataset.focus = String(e > 0);
|
|
578
|
+
}
|
|
579
|
+
applyNodeState() {
|
|
580
|
+
this.applyFocus();
|
|
581
|
+
let e = this.focusSets().nodes;
|
|
582
|
+
for (let t of this.#i.querySelectorAll("[data-bp-node-id]")) {
|
|
583
|
+
let n = t.dataset.bpNodeId ?? "", r = this.#h.nodes.includes(n);
|
|
584
|
+
t.dataset.selected = String(r), t.dataset.related = String(!r && e.has(n)), t.dataset.traced = String(this.#j.has(n) && !r);
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
applyEdgeState() {
|
|
588
|
+
this.applyFocus();
|
|
589
|
+
let e = new Set(this.#h.edges), t = this.focusSets().edges;
|
|
590
|
+
for (let n of this.#r.querySelectorAll("[data-bp-edge-group]")) {
|
|
591
|
+
let r = n.dataset.bpEdgeGroup ?? "";
|
|
592
|
+
n.classList.toggle("is-selected", e.has(r)), n.classList.toggle("is-related", t.has(r)), n.classList.toggle("is-hover", r === this.#_);
|
|
593
|
+
}
|
|
594
|
+
for (let t of this.#a.querySelectorAll("[data-bp-edge-label]")) {
|
|
595
|
+
let n = t.dataset.bpEdgeLabel ?? "";
|
|
596
|
+
t.classList.toggle("is-selected", e.has(n)), t.classList.toggle("is-visible", n === this.#_);
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
setHoverEdge(e) {
|
|
600
|
+
if (this.#_ !== e) {
|
|
601
|
+
this.#_ = e;
|
|
602
|
+
for (let t of this.#r.querySelectorAll("[data-bp-edge-group]")) t.classList.toggle("is-hover", t.dataset.bpEdgeGroup === e);
|
|
603
|
+
for (let t of this.#a.querySelectorAll("[data-bp-edge-label]")) t.classList.toggle("is-visible", t.dataset.bpEdgeLabel === e);
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
renderToolbar() {
|
|
607
|
+
let e = this.#d, t = O.blueprint.graph.toolbar, n = (e, t, n, r = "") => `<button type="button" class="designer-control designer-button bp-tool" data-bp-tool="${e}" aria-label="${T(n)}" data-tip="${T(n)}"${r}>${k(t)}</button>`, r = e?.diagnostics.filter((e) => e.severity === "error").length ?? 0, i = `<div class="bp-tool-group">
|
|
608
|
+
<button type="button" class="designer-control designer-button bp-tool bp-tool-wide" data-bp-tool="add" aria-haspopup="menu" aria-label="${T(t.addNode)}" data-tip="${T(t.addNode)}">${k("plus")}<span>${_(t.addNode)}</span></button>
|
|
609
|
+
${n("auto-layout", "grid", t.autoLayout)}
|
|
610
|
+
</div>
|
|
611
|
+
<div class="bp-tool-group">
|
|
612
|
+
${n("undo", "undo", O.blueprint.graph.toolbar.undo, e?.canUndo === !0 ? "" : " disabled")}
|
|
613
|
+
${n("redo", "redo", O.blueprint.graph.toolbar.redo, e?.canRedo === !0 ? "" : " disabled")}
|
|
614
|
+
</div>
|
|
615
|
+
<div class="bp-tool-group">
|
|
616
|
+
${n("semantic", "link", t.semantic, ` aria-pressed="${String(this.#b)}"`)}
|
|
617
|
+
${n("trace", "activity", t.highlightTrace, ` aria-pressed="${String(this.#y)}"`)}
|
|
618
|
+
<span class="bp-tool-status" data-state="${r === 0 ? "ok" : "error"}" aria-live="polite">${k(r === 0 ? "check-circle" : "x-circle")}<span>${_(r === 0 ? O.blueprint.problemsHealthy : `${O.blueprint.problemsTitle} ${r}`)}</span></span>
|
|
619
|
+
</div>
|
|
620
|
+
<div class="bp-tool-group bp-tool-group-end">
|
|
621
|
+
${n("zoom-out", "zoom-out", t.zoomOut)}
|
|
622
|
+
<span class="bp-zoom-value" data-bp-zoom>${Math.round(this.#f.z * 100)}%</span>
|
|
623
|
+
${n("zoom-in", "zoom-in", t.zoomIn)}
|
|
624
|
+
${n("fit", "fit", t.fit)}
|
|
625
|
+
<button type="button" class="designer-control designer-button bp-tool bp-tool-wide" data-bp-tool="simulate" data-variant="${this.#x ? "primary" : "neutral"}" aria-pressed="${String(this.#x)}" aria-label="${T(t.simulate)}" data-tip="${T(t.simulate)}">${k("play")}<span>${_(t.simulate)}</span></button>
|
|
626
|
+
</div>`;
|
|
627
|
+
i !== this.#k && (this.#k = i, this.#c.innerHTML = i, v(this.#c));
|
|
628
|
+
}
|
|
629
|
+
renderSimulation() {
|
|
630
|
+
if (this.#l.hidden = !this.#x, !this.#x) {
|
|
631
|
+
this.#A = "";
|
|
632
|
+
return;
|
|
633
|
+
}
|
|
634
|
+
let e = R.simulation, t = this.#d?.simulationTriggers ?? [], n = (e) => `${e.nodeId}\u0000${e.port}`;
|
|
635
|
+
(this.#S === void 0 || !t.some((e) => n(e) === this.#S)) && (this.#S = t[0] === void 0 ? void 0 : n(t[0]));
|
|
636
|
+
let r = this.#l.querySelector("[data-bp-sim-payload]")?.value ?? "{}", i = t.length === 0 ? `<p class="bp-simulation-empty">${_(e.noTriggers)}</p>` : `<label class="designer-field"><span class="designer-field-label">${_(e.trigger)}</span><select class="designer-control designer-select" data-bp-sim-trigger>${t.map((e) => `<option value="${T(n(e))}"${n(e) === this.#S ? " selected" : ""}>${_(e.label)}</option>`).join("")}</select></label>
|
|
637
|
+
<label class="designer-field bp-simulation-payload"><span class="designer-field-label">${_(e.payload)}</span><textarea class="designer-control designer-input" data-bp-sim-payload rows="2" spellcheck="false">${_(r)}</textarea></label>
|
|
638
|
+
<div class="bp-simulation-actions">
|
|
639
|
+
<button type="button" class="designer-control designer-button" data-variant="primary" data-bp-sim="run">${k("play")}<span>${_(e.run)}</span></button>
|
|
640
|
+
<button type="button" class="designer-control designer-button" data-bp-sim="clear"${this.#d?.trace === null ? " disabled" : ""}>${_(e.clear)}</button>
|
|
641
|
+
</div>
|
|
642
|
+
<p class="bp-simulation-message" data-bp-sim-message aria-live="polite"></p>`;
|
|
643
|
+
i !== this.#A && (this.#A = i, this.#l.innerHTML = i, v(this.#l));
|
|
644
|
+
}
|
|
645
|
+
applyView() {
|
|
646
|
+
this.#n.style.transform = `translate(${this.#f.x}px, ${this.#f.y}px) scale(${this.#f.z})`, this.#t.style.setProperty("--bp-pan-x", `${this.#f.x}px`), this.#t.style.setProperty("--bp-pan-y", `${this.#f.y}px`), this.#t.style.setProperty("--bp-zoom", String(this.#f.z)), this.#t.dataset.zoomFar = String(this.#f.z < .6);
|
|
647
|
+
let e = this.#c.querySelector("[data-bp-zoom]");
|
|
648
|
+
e !== null && (e.textContent = `${Math.round(this.#f.z * 100)}%`);
|
|
649
|
+
}
|
|
650
|
+
zoomAt(e, t, n) {
|
|
651
|
+
let r = z(this.#f.z * e, L, Ie), i = r / this.#f.z;
|
|
652
|
+
this.#f = {
|
|
653
|
+
x: t - (t - this.#f.x) * i,
|
|
654
|
+
y: n - (n - this.#f.y) * i,
|
|
655
|
+
z: r
|
|
656
|
+
}, this.applyView();
|
|
657
|
+
}
|
|
658
|
+
fit() {
|
|
659
|
+
let e = this.graph.nodes, t = this.#t.getBoundingClientRect();
|
|
660
|
+
if (e.length === 0 || t.width === 0 || t.height === 0) return;
|
|
661
|
+
let n = e.map((e) => ({
|
|
662
|
+
...this.position(e),
|
|
663
|
+
h: this.height(e)
|
|
664
|
+
})), r = Math.min(...n.map((e) => e.x)), i = Math.min(...n.map((e) => e.y)), a = Math.max(...n.map((e) => e.x + 164)), o = Math.max(...n.map((e) => e.y + e.h)), s = z(Math.min((t.width - 64) / (a - r), (t.height - 64) / (o - i)), L, 1.1);
|
|
665
|
+
this.#f = {
|
|
666
|
+
z: s,
|
|
667
|
+
x: 32 + (t.width - 64 - (a - r) * s) / 2 - r * s,
|
|
668
|
+
y: 32 + (t.height - 64 - (o - i) * s) / 2 - i * s
|
|
669
|
+
}, this.applyView();
|
|
670
|
+
}
|
|
671
|
+
focus(e) {
|
|
672
|
+
let t = this.node(e), n = this.graph.edges.find((t) => t.id === e), r = t ?? (n === void 0 ? void 0 : this.node(n.source));
|
|
673
|
+
if (r === void 0) return;
|
|
674
|
+
let i = this.#t.getBoundingClientRect(), a = this.position(r);
|
|
675
|
+
this.#f = {
|
|
676
|
+
...this.#f,
|
|
677
|
+
x: i.width / 2 - (a.x + 164 / 2) * this.#f.z,
|
|
678
|
+
y: i.height / 2 - (a.y + this.height(r) / 2) * this.#f.z
|
|
679
|
+
}, this.applyView();
|
|
680
|
+
let o = this.#i.querySelector(`[data-bp-node-id="${Ue(r.id)}"]`);
|
|
681
|
+
o?.classList.add("is-flash"), setTimeout(() => o?.classList.remove("is-flash"), 600);
|
|
682
|
+
}
|
|
683
|
+
autoLayout() {
|
|
684
|
+
let e = this.graph.nodes, t = new Map(e.map((e) => [e.id, 0]));
|
|
685
|
+
for (let n = 0; n < e.length; n++) {
|
|
686
|
+
let e = !1;
|
|
687
|
+
for (let n of this.graph.edges) {
|
|
688
|
+
if (n.kind !== "flow") continue;
|
|
689
|
+
let r = Math.min((t.get(n.source) ?? 0) + 1, 24);
|
|
690
|
+
r > (t.get(n.target) ?? 0) && (t.set(n.target, r), e = !0);
|
|
691
|
+
}
|
|
692
|
+
if (!e) break;
|
|
693
|
+
}
|
|
694
|
+
let n = /* @__PURE__ */ new Map();
|
|
695
|
+
for (let r of e) {
|
|
696
|
+
let e = t.get(r.id) ?? 0, i = n.get(e) ?? [];
|
|
697
|
+
i.push(r), n.set(e, i);
|
|
698
|
+
}
|
|
699
|
+
for (let [e, t] of n) {
|
|
700
|
+
let n = 24;
|
|
701
|
+
t.sort((e, t) => this.position(e).y - this.position(t).y);
|
|
702
|
+
for (let r of t) this.#m.set(r.id, {
|
|
703
|
+
x: 40 + e * 248,
|
|
704
|
+
y: n
|
|
705
|
+
}), n += this.height(r) + 28;
|
|
706
|
+
}
|
|
707
|
+
this.render(), this.fit(), this.commitLayout();
|
|
708
|
+
}
|
|
709
|
+
commitLayout() {
|
|
710
|
+
let e = this.graph.nodes.map((e) => {
|
|
711
|
+
let t = this.position(e);
|
|
712
|
+
return {
|
|
713
|
+
id: e.id,
|
|
714
|
+
x: Math.round(t.x),
|
|
715
|
+
y: Math.round(t.y)
|
|
716
|
+
};
|
|
717
|
+
});
|
|
718
|
+
this.send({
|
|
719
|
+
type: "commit-layout",
|
|
720
|
+
nodes: e,
|
|
721
|
+
viewport: {
|
|
722
|
+
x: Math.round(this.#f.x),
|
|
723
|
+
y: Math.round(this.#f.y),
|
|
724
|
+
zoom: Math.round(this.#f.z * 1e3) / 1e3
|
|
725
|
+
}
|
|
726
|
+
});
|
|
727
|
+
}
|
|
728
|
+
onPointerDown(e) {
|
|
729
|
+
let t = e.target instanceof Element ? e.target : null;
|
|
730
|
+
if (t?.closest("[data-bp-rename-input]") !== null && t !== null) return;
|
|
731
|
+
this.element.focus({ preventScroll: !0 }), this.closeMenu();
|
|
732
|
+
let n = t?.closest("[data-bp-port]") ?? null, r = t?.closest("[data-bp-edge]") ?? null, i = t?.closest("[data-bp-node-id]") ?? null, a = e.ctrlKey || e.metaKey || e.shiftKey;
|
|
733
|
+
if (e.button === 2) {
|
|
734
|
+
this.#g = {
|
|
735
|
+
type: "context",
|
|
736
|
+
startX: e.clientX,
|
|
737
|
+
startY: e.clientY,
|
|
738
|
+
viewX: this.#f.x,
|
|
739
|
+
viewY: this.#f.y,
|
|
740
|
+
moved: !1,
|
|
741
|
+
target: t,
|
|
742
|
+
additive: a
|
|
743
|
+
}, this.#t.setPointerCapture(e.pointerId);
|
|
744
|
+
return;
|
|
745
|
+
}
|
|
746
|
+
if (this.#C || e.button === 1) {
|
|
747
|
+
this.#g = {
|
|
748
|
+
type: "pan",
|
|
749
|
+
startX: e.clientX,
|
|
750
|
+
startY: e.clientY,
|
|
751
|
+
viewX: this.#f.x,
|
|
752
|
+
viewY: this.#f.y,
|
|
753
|
+
moved: !1,
|
|
754
|
+
target: t,
|
|
755
|
+
additive: a
|
|
756
|
+
}, this.#t.classList.add("is-panning"), this.#t.setPointerCapture(e.pointerId);
|
|
757
|
+
return;
|
|
758
|
+
}
|
|
759
|
+
if (e.button === 0) {
|
|
760
|
+
if (n !== null) {
|
|
761
|
+
let t = this.node(n.dataset.bpNode ?? ""), r = n.dataset.bpPort, i = n.dataset.bpDir === "in" ? "in" : "out";
|
|
762
|
+
if (t !== void 0 && r !== void 0 && n.dataset.available !== "false") {
|
|
763
|
+
let n = {
|
|
764
|
+
node: t.id,
|
|
765
|
+
port: r
|
|
766
|
+
};
|
|
767
|
+
this.#g = {
|
|
768
|
+
type: "link",
|
|
769
|
+
from: n,
|
|
770
|
+
direction: i,
|
|
771
|
+
anchor: this.portPoint(t, r, i),
|
|
772
|
+
snap: void 0
|
|
773
|
+
}, this.#t.classList.add("is-connecting"), this.markConnectable(n, i), this.#t.setPointerCapture(e.pointerId);
|
|
774
|
+
return;
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
if (i !== null) {
|
|
778
|
+
let t = i.dataset.bpNodeId ?? "";
|
|
779
|
+
if (a) {
|
|
780
|
+
let e = this.#h.nodes.includes(t) ? this.#h.nodes.filter((e) => e !== t) : [...this.#h.nodes, t];
|
|
781
|
+
this.select({
|
|
782
|
+
nodes: e,
|
|
783
|
+
edges: this.#h.edges
|
|
784
|
+
});
|
|
785
|
+
return;
|
|
786
|
+
}
|
|
787
|
+
this.#h.nodes.includes(t) || this.select({
|
|
788
|
+
nodes: [t],
|
|
789
|
+
edges: []
|
|
790
|
+
});
|
|
791
|
+
let n = this.#h.nodes;
|
|
792
|
+
this.#g = {
|
|
793
|
+
type: "node",
|
|
794
|
+
ids: n,
|
|
795
|
+
origins: n.map((e) => {
|
|
796
|
+
let t = this.node(e);
|
|
797
|
+
return t === void 0 ? {
|
|
798
|
+
x: 0,
|
|
799
|
+
y: 0
|
|
800
|
+
} : this.position(t);
|
|
801
|
+
}),
|
|
802
|
+
startX: e.clientX,
|
|
803
|
+
startY: e.clientY,
|
|
804
|
+
moved: !1
|
|
805
|
+
}, this.#t.setPointerCapture(e.pointerId);
|
|
806
|
+
return;
|
|
807
|
+
}
|
|
808
|
+
if (r !== null) {
|
|
809
|
+
let e = r.dataset.bpEdge ?? "";
|
|
810
|
+
this.select(a ? {
|
|
811
|
+
nodes: this.#h.nodes,
|
|
812
|
+
edges: this.#h.edges.includes(e) ? this.#h.edges.filter((t) => t !== e) : [...this.#h.edges, e]
|
|
813
|
+
} : {
|
|
814
|
+
nodes: [],
|
|
815
|
+
edges: [e]
|
|
816
|
+
});
|
|
817
|
+
return;
|
|
818
|
+
}
|
|
819
|
+
this.#g = {
|
|
820
|
+
type: "marquee",
|
|
821
|
+
startX: e.clientX,
|
|
822
|
+
startY: e.clientY,
|
|
823
|
+
world: this.toWorld(e.clientX, e.clientY),
|
|
824
|
+
moved: !1,
|
|
825
|
+
additive: a,
|
|
826
|
+
base: this.#h.nodes
|
|
827
|
+
}, this.#t.setPointerCapture(e.pointerId);
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
onPointerMove(e) {
|
|
831
|
+
let t = this.#g;
|
|
832
|
+
if (t === void 0) {
|
|
833
|
+
let t = e.target?.closest("[data-bp-edge]");
|
|
834
|
+
this.setHoverEdge(t?.dataset.bpEdge);
|
|
835
|
+
return;
|
|
836
|
+
}
|
|
837
|
+
if (t.type === "pan" || t.type === "context") {
|
|
838
|
+
let n = e.clientX - t.startX, r = e.clientY - t.startY;
|
|
839
|
+
if (!t.moved && n * n + r * r < 16) return;
|
|
840
|
+
t.moved = !0, this.#t.classList.add("is-panning"), this.#f = {
|
|
841
|
+
...this.#f,
|
|
842
|
+
x: t.viewX + n,
|
|
843
|
+
y: t.viewY + r
|
|
844
|
+
}, this.applyView();
|
|
845
|
+
return;
|
|
846
|
+
}
|
|
847
|
+
if (t.type === "node") {
|
|
848
|
+
let n = (e.clientX - t.startX) / this.#f.z, r = (e.clientY - t.startY) / this.#f.z;
|
|
849
|
+
if (!t.moved && Math.abs(n) + Math.abs(r) <= 2) return;
|
|
850
|
+
t.moved = !0, t.ids.forEach((e, i) => {
|
|
851
|
+
let a = t.origins[i] ?? {
|
|
852
|
+
x: 0,
|
|
853
|
+
y: 0
|
|
854
|
+
}, o = {
|
|
855
|
+
x: Math.round((a.x + n) / I) * I,
|
|
856
|
+
y: Math.round((a.y + r) / I) * I
|
|
857
|
+
};
|
|
858
|
+
this.#m.set(e, o);
|
|
859
|
+
let s = this.#i.querySelector(`[data-bp-node-id="${Ue(e)}"]`);
|
|
860
|
+
s !== null && (s.style.left = `${o.x}px`, s.style.top = `${o.y}px`);
|
|
861
|
+
}), this.#D = "", this.renderEdges();
|
|
862
|
+
return;
|
|
863
|
+
}
|
|
864
|
+
if (t.type === "link") {
|
|
865
|
+
let n = t.direction === "out" ? "in" : "out", r, i = 784;
|
|
866
|
+
for (let t of this.#i.querySelectorAll(`[data-bp-dir="${n}"]:not(.is-blocked)`)) {
|
|
867
|
+
let n = t.getBoundingClientRect(), a = (n.left + n.width / 2 - e.clientX) ** 2 + (n.top + n.height / 2 - e.clientY) ** 2;
|
|
868
|
+
a < i && (i = a, r = t);
|
|
869
|
+
}
|
|
870
|
+
for (let e of this.#i.querySelectorAll(".is-snap")) e.classList.remove("is-snap");
|
|
871
|
+
r?.classList.add("is-snap"), t.snap = r === void 0 ? void 0 : {
|
|
872
|
+
node: r.dataset.bpNode ?? "",
|
|
873
|
+
port: r.dataset.bpPort ?? ""
|
|
874
|
+
};
|
|
875
|
+
let a = t.snap === void 0 ? void 0 : this.node(t.snap.node), o = a === void 0 || t.snap === void 0 ? this.toWorld(e.clientX, e.clientY) : this.portPoint(a, t.snap.port, n);
|
|
876
|
+
this.renderEdges(t.direction === "out" ? {
|
|
877
|
+
from: t.anchor,
|
|
878
|
+
to: o
|
|
879
|
+
} : {
|
|
880
|
+
from: o,
|
|
881
|
+
to: t.anchor
|
|
882
|
+
});
|
|
883
|
+
return;
|
|
884
|
+
}
|
|
885
|
+
if (t.type !== "marquee") return;
|
|
886
|
+
let n = e.clientX - t.startX, r = e.clientY - t.startY;
|
|
887
|
+
if (!t.moved && n * n + r * r < 16) return;
|
|
888
|
+
t.moved = !0;
|
|
889
|
+
let i = this.#t.getBoundingClientRect();
|
|
890
|
+
this.#o.hidden = !1, Object.assign(this.#o.style, {
|
|
891
|
+
left: `${Math.min(e.clientX, t.startX) - i.left}px`,
|
|
892
|
+
top: `${Math.min(e.clientY, t.startY) - i.top}px`,
|
|
893
|
+
width: `${Math.abs(n)}px`,
|
|
894
|
+
height: `${Math.abs(r)}px`
|
|
895
|
+
});
|
|
896
|
+
let a = this.toWorld(e.clientX, e.clientY), o = Math.min(a.x, t.world.x), s = Math.max(a.x, t.world.x), c = Math.min(a.y, t.world.y), l = Math.max(a.y, t.world.y), u = this.graph.nodes.filter((e) => {
|
|
897
|
+
let t = this.position(e);
|
|
898
|
+
return t.x < s && t.x + 164 > o && t.y < l && t.y + this.height(e) > c;
|
|
899
|
+
}).map((e) => e.id);
|
|
900
|
+
this.#h = {
|
|
901
|
+
nodes: t.additive ? [.../* @__PURE__ */ new Set([...t.base, ...u])] : u,
|
|
902
|
+
edges: []
|
|
903
|
+
}, this.renderSelection();
|
|
904
|
+
}
|
|
905
|
+
onPointerUp(e) {
|
|
906
|
+
let t = this.#g;
|
|
907
|
+
if (this.#g = void 0, this.#t.classList.remove("is-panning"), t !== void 0) {
|
|
908
|
+
if (t.type === "context") {
|
|
909
|
+
t.moved || this.openMenu(e.clientX, e.clientY, t.target, t.additive);
|
|
910
|
+
return;
|
|
911
|
+
}
|
|
912
|
+
if (t.type === "link") {
|
|
913
|
+
this.#t.classList.remove("is-connecting");
|
|
914
|
+
for (let e of this.#i.querySelectorAll(".is-blocked, .is-snap")) e.classList.remove("is-blocked", "is-snap");
|
|
915
|
+
let e = t.snap;
|
|
916
|
+
if (e !== void 0) {
|
|
917
|
+
let [n, r] = t.direction === "out" ? [t.from, e] : [e, t.from];
|
|
918
|
+
this.send({
|
|
919
|
+
type: "connect",
|
|
920
|
+
from: n,
|
|
921
|
+
to: r
|
|
922
|
+
});
|
|
923
|
+
}
|
|
924
|
+
this.renderEdges();
|
|
925
|
+
return;
|
|
926
|
+
}
|
|
927
|
+
if (t.type === "node") {
|
|
928
|
+
t.moved && this.commitLayout();
|
|
929
|
+
return;
|
|
930
|
+
}
|
|
931
|
+
t.type === "marquee" && (this.#o.hidden = !0, t.moved ? this.select(this.#h) : t.additive || this.select({
|
|
932
|
+
nodes: [],
|
|
933
|
+
edges: []
|
|
934
|
+
}));
|
|
935
|
+
}
|
|
936
|
+
}
|
|
937
|
+
cancelDrag() {
|
|
938
|
+
this.#g = void 0, this.#o.hidden = !0, this.#t.classList.remove("is-panning", "is-connecting"), this.renderEdges();
|
|
939
|
+
}
|
|
940
|
+
markConnectable(e, t) {
|
|
941
|
+
let n = t === "out" ? "in" : "out", r = e.port === "semantic";
|
|
942
|
+
for (let t of this.#i.querySelectorAll("[data-bp-port]")) {
|
|
943
|
+
let i = t.dataset.bpDir !== n || t.dataset.bpNode === e.node || t.dataset.bpPort === "semantic" !== r || t.dataset.available === "false";
|
|
944
|
+
t.classList.toggle("is-blocked", i);
|
|
945
|
+
}
|
|
946
|
+
}
|
|
947
|
+
onDoubleClick(e) {
|
|
948
|
+
let t = (this.#e.elementFromPoint?.(e.clientX, e.clientY)?.closest("[data-bp-rename]"))?.dataset.bpRename ?? e.target?.closest("[data-bp-rename]")?.dataset.bpRename;
|
|
949
|
+
t !== void 0 && (e.preventDefault(), this.startRename(t));
|
|
950
|
+
}
|
|
951
|
+
onWheel(e) {
|
|
952
|
+
if (e.preventDefault(), e.ctrlKey || e.metaKey) {
|
|
953
|
+
let t = this.#t.getBoundingClientRect();
|
|
954
|
+
this.zoomAt(e.deltaY < 0 ? 1.1 : 1 / 1.1, e.clientX - t.left, e.clientY - t.top);
|
|
955
|
+
return;
|
|
956
|
+
}
|
|
957
|
+
this.#f = {
|
|
958
|
+
...this.#f,
|
|
959
|
+
x: this.#f.x - (e.shiftKey ? e.deltaY : e.deltaX),
|
|
960
|
+
y: this.#f.y - (e.shiftKey ? 0 : e.deltaY)
|
|
961
|
+
}, this.applyView();
|
|
962
|
+
}
|
|
963
|
+
onDragOver(e) {
|
|
964
|
+
e.dataTransfer?.types.includes("application/x-base-screen-blueprint-node") === !0 && (e.preventDefault(), e.dataTransfer.dropEffect = "copy");
|
|
965
|
+
}
|
|
966
|
+
onDrop(e) {
|
|
967
|
+
let t = e.dataTransfer?.getData(m);
|
|
968
|
+
if (t === void 0 || t === "") return;
|
|
969
|
+
e.preventDefault();
|
|
970
|
+
let n;
|
|
971
|
+
try {
|
|
972
|
+
n = JSON.parse(t);
|
|
973
|
+
} catch {
|
|
974
|
+
return;
|
|
975
|
+
}
|
|
976
|
+
let r = this.toWorld(e.clientX, e.clientY);
|
|
977
|
+
this.send({
|
|
978
|
+
type: "insert-node",
|
|
979
|
+
...n,
|
|
980
|
+
position: {
|
|
981
|
+
x: Math.round(r.x - 164 / 2),
|
|
982
|
+
y: Math.round(r.y - 44 / 2)
|
|
983
|
+
}
|
|
984
|
+
});
|
|
985
|
+
}
|
|
986
|
+
onKeyDown(e) {
|
|
987
|
+
if (e.target?.closest("input, textarea, select") !== null) return;
|
|
988
|
+
let t = e.ctrlKey || e.metaKey;
|
|
989
|
+
if (e.code === "Space") {
|
|
990
|
+
this.#C = !0, this.#t.classList.add("is-space"), e.preventDefault();
|
|
991
|
+
return;
|
|
992
|
+
}
|
|
993
|
+
if (e.key === "Escape") {
|
|
994
|
+
this.#s.hidden ? this.select({
|
|
995
|
+
nodes: [],
|
|
996
|
+
edges: []
|
|
997
|
+
}) : this.closeMenu();
|
|
998
|
+
return;
|
|
999
|
+
}
|
|
1000
|
+
if (e.key === "Delete" || e.key === "Backspace") {
|
|
1001
|
+
if (this.#h.nodes.length + this.#h.edges.length === 0) return;
|
|
1002
|
+
e.preventDefault(), this.send({
|
|
1003
|
+
type: "delete-selection",
|
|
1004
|
+
selection: this.#h
|
|
1005
|
+
});
|
|
1006
|
+
return;
|
|
1007
|
+
}
|
|
1008
|
+
if (e.key === "F2" && this.#h.nodes.length === 1) {
|
|
1009
|
+
e.preventDefault(), this.startRename(this.#h.nodes[0] ?? "");
|
|
1010
|
+
return;
|
|
1011
|
+
}
|
|
1012
|
+
if (!t) return;
|
|
1013
|
+
let n = e.key.toLowerCase();
|
|
1014
|
+
n === "a" ? (e.preventDefault(), this.select({
|
|
1015
|
+
nodes: this.graph.nodes.map((e) => e.id),
|
|
1016
|
+
edges: []
|
|
1017
|
+
})) : n === "d" ? (e.preventDefault(), this.#h.nodes.length > 0 && this.send({
|
|
1018
|
+
type: "duplicate-nodes",
|
|
1019
|
+
nodeIds: this.#h.nodes
|
|
1020
|
+
})) : n === "0" ? (e.preventDefault(), this.fit()) : n === "z" ? (e.preventDefault(), this.send({ type: e.shiftKey ? "history-redo" : "history-undo" })) : n === "y" && (e.preventDefault(), this.send({ type: "history-redo" }));
|
|
1021
|
+
}
|
|
1022
|
+
startRename(e) {
|
|
1023
|
+
let t = this.node(e);
|
|
1024
|
+
t === void 0 || !t.renamable || (this.#v = e, this.renderNodes());
|
|
1025
|
+
}
|
|
1026
|
+
finishRename(e) {
|
|
1027
|
+
let t = this.#v;
|
|
1028
|
+
this.#v = void 0;
|
|
1029
|
+
let n = t === void 0 ? void 0 : this.node(t);
|
|
1030
|
+
if (n !== void 0) {
|
|
1031
|
+
let t = e.trim();
|
|
1032
|
+
t !== (n.name ?? "") && t !== n.title && this.send({
|
|
1033
|
+
type: "update-node",
|
|
1034
|
+
nodeIds: [n.id],
|
|
1035
|
+
update: {
|
|
1036
|
+
type: "name",
|
|
1037
|
+
name: t === "" ? null : t
|
|
1038
|
+
}
|
|
1039
|
+
});
|
|
1040
|
+
}
|
|
1041
|
+
this.renderNodes();
|
|
1042
|
+
}
|
|
1043
|
+
onToolbarClick(e) {
|
|
1044
|
+
let t = e.target.closest("[data-bp-tool]");
|
|
1045
|
+
if (t === null || t.disabled) return;
|
|
1046
|
+
let n = this.#t.getBoundingClientRect();
|
|
1047
|
+
switch (t.dataset.bpTool) {
|
|
1048
|
+
case "add": {
|
|
1049
|
+
let e = t.getBoundingClientRect();
|
|
1050
|
+
this.#w = this.toWorld(n.left + n.width / 2, n.top + n.height / 2), this.openAddMenu(e.left, e.bottom + 4);
|
|
1051
|
+
break;
|
|
1052
|
+
}
|
|
1053
|
+
case "auto-layout":
|
|
1054
|
+
this.autoLayout();
|
|
1055
|
+
break;
|
|
1056
|
+
case "undo":
|
|
1057
|
+
this.send({ type: "history-undo" });
|
|
1058
|
+
break;
|
|
1059
|
+
case "redo":
|
|
1060
|
+
this.send({ type: "history-redo" });
|
|
1061
|
+
break;
|
|
1062
|
+
case "semantic":
|
|
1063
|
+
this.#b = !this.#b, this.render();
|
|
1064
|
+
break;
|
|
1065
|
+
case "trace":
|
|
1066
|
+
this.#y = !this.#y, this.render();
|
|
1067
|
+
break;
|
|
1068
|
+
case "zoom-in":
|
|
1069
|
+
this.zoomAt(1.1, n.width / 2, n.height / 2);
|
|
1070
|
+
break;
|
|
1071
|
+
case "zoom-out":
|
|
1072
|
+
this.zoomAt(1 / 1.1, n.width / 2, n.height / 2);
|
|
1073
|
+
break;
|
|
1074
|
+
case "fit":
|
|
1075
|
+
this.fit();
|
|
1076
|
+
break;
|
|
1077
|
+
case "simulate": this.#x = !this.#x, this.renderToolbar(), this.renderSimulation();
|
|
1078
|
+
}
|
|
1079
|
+
}
|
|
1080
|
+
onSimulationClick(e) {
|
|
1081
|
+
let t = e.target.closest("[data-bp-sim]")?.dataset.bpSim;
|
|
1082
|
+
if (t === "clear") {
|
|
1083
|
+
this.send({ type: "clear-simulation" });
|
|
1084
|
+
return;
|
|
1085
|
+
}
|
|
1086
|
+
if (t !== "run" || this.#S === void 0) return;
|
|
1087
|
+
let [n, r] = this.#S.split("\0"), i = this.#l.querySelector("[data-bp-sim-payload]"), a;
|
|
1088
|
+
try {
|
|
1089
|
+
a = JSON.parse(i?.value.trim() || "null");
|
|
1090
|
+
} catch {
|
|
1091
|
+
let e = this.#l.querySelector("[data-bp-sim-message]");
|
|
1092
|
+
e !== null && (e.textContent = R.simulation.invalidPayload);
|
|
1093
|
+
return;
|
|
1094
|
+
}
|
|
1095
|
+
n !== void 0 && r !== void 0 && this.send({
|
|
1096
|
+
type: "run-simulation",
|
|
1097
|
+
nodeId: n,
|
|
1098
|
+
port: r,
|
|
1099
|
+
payload: a
|
|
1100
|
+
});
|
|
1101
|
+
}
|
|
1102
|
+
menuItem(e, t, n, r = {}) {
|
|
1103
|
+
return `<button type="button" class="designer-control designer-button designer-menu-item" role="menuitem" data-bp-menu-action="${T(e)}"${r.danger === !0 ? " data-menu-tone=\"danger\"" : ""}${r.disabled === !0 ? " disabled" : ""}><span class="menu-item-icon" aria-hidden="true">${k(t)}</span><span class="menu-item-label">${_(n)}</span>${r.kbd === void 0 ? "" : `<kbd>${_(r.kbd)}</kbd>`}</button>`;
|
|
1104
|
+
}
|
|
1105
|
+
addItems() {
|
|
1106
|
+
let e = new Set(this.graph.nodes.map((e) => e.kind));
|
|
1107
|
+
return Le.map((t) => this.menuItem(`add:${t}`, Re[t], R.nodeKinds[t], { disabled: (t === "host" || t === "lifecycle") && e.has(t) })).join("");
|
|
1108
|
+
}
|
|
1109
|
+
openMenu(e, t, n, r) {
|
|
1110
|
+
let i = n?.closest("[data-bp-node-id]") ?? null, a = n?.closest("[data-bp-edge]") ?? null;
|
|
1111
|
+
if (i !== null) {
|
|
1112
|
+
let e = i.dataset.bpNodeId ?? "";
|
|
1113
|
+
this.#h.nodes.includes(e) || this.select({
|
|
1114
|
+
nodes: [e],
|
|
1115
|
+
edges: []
|
|
1116
|
+
});
|
|
1117
|
+
} else if (a !== null) {
|
|
1118
|
+
let e = a.dataset.bpEdge ?? "";
|
|
1119
|
+
this.#h.edges.includes(e) || this.select({
|
|
1120
|
+
nodes: [],
|
|
1121
|
+
edges: [e]
|
|
1122
|
+
});
|
|
1123
|
+
} else !r && this.#h.nodes.length + this.#h.edges.length > 0 && this.select({
|
|
1124
|
+
nodes: [],
|
|
1125
|
+
edges: []
|
|
1126
|
+
});
|
|
1127
|
+
this.#w = this.toWorld(e, t);
|
|
1128
|
+
let o = R.menu, s = this.#h.nodes.map((e) => this.node(e)).filter(He), c = s.length === 1 ? s[0] : void 0, l = "";
|
|
1129
|
+
if (s.length > 1 && (l += `<div class="designer-context-menu-heading"><span class="designer-context-menu-heading-icon" aria-hidden="true">${k("select-all")}</span><span class="designer-context-menu-heading-label">${_(R.multiSelection(s.length, this.#h.edges.length))}</span></div>`), s.length > 0) {
|
|
1130
|
+
let e = s.some((e) => e.enabled);
|
|
1131
|
+
l += this.menuItem("delete", "trash", o.delete, {
|
|
1132
|
+
kbd: "Delete",
|
|
1133
|
+
danger: !0
|
|
1134
|
+
}), c !== void 0 && (l += this.menuItem("rename", "pencil", o.rename, {
|
|
1135
|
+
kbd: "F2",
|
|
1136
|
+
disabled: !c.renamable
|
|
1137
|
+
})), l += this.menuItem("duplicate", "duplicate", o.duplicate, {
|
|
1138
|
+
kbd: "Ctrl D",
|
|
1139
|
+
disabled: !s.some((e) => e.duplicable)
|
|
1140
|
+
}), l += this.menuItem(e ? "disable" : "enable", e ? "eye-off" : "eye", e ? o.disable : o.enable);
|
|
1141
|
+
let t = (this.#d?.simulationTriggers ?? []).filter((e) => c !== void 0 && e.nodeId === c.id);
|
|
1142
|
+
c !== void 0 && t.length > 0 && (l += this.menuItem("simulate", "play", o.simulateFrom)), l += "<div class=\"designer-menu-separator\" role=\"separator\"></div>";
|
|
1143
|
+
} else this.#h.edges.length > 0 && (l += this.menuItem("delete", "trash", o.deleteEdge, {
|
|
1144
|
+
kbd: "Delete",
|
|
1145
|
+
danger: !0
|
|
1146
|
+
}), l += "<div class=\"designer-menu-separator\" role=\"separator\"></div>");
|
|
1147
|
+
l += `<div class="designer-menu-section-label">${_(o.addHere)}</div>`, l += this.addItems(), l += "<div class=\"designer-menu-separator\" role=\"separator\"></div>", l += this.menuItem("select-all", "select-all", o.selectAll, { kbd: "Ctrl A" }), l += this.menuItem("auto-layout", "grid", o.autoLayout), l += this.menuItem("fit", "fit", o.fit, { kbd: "Ctrl 0" }), this.showMenu(l, e, t);
|
|
1148
|
+
}
|
|
1149
|
+
openAddMenu(e, t) {
|
|
1150
|
+
this.showMenu(`<div class="designer-menu-section-label">${_(R.toolbar.addNode)}</div>${this.addItems()}`, e, t);
|
|
1151
|
+
}
|
|
1152
|
+
showMenu(e, t, n) {
|
|
1153
|
+
this.#s.innerHTML = e, v(this.#s), this.#s.hidden = !1;
|
|
1154
|
+
let r = this.element.getBoundingClientRect();
|
|
1155
|
+
this.#s.style.left = "0px", this.#s.style.top = "0px";
|
|
1156
|
+
let i = t - r.left, a = n - r.top, o = this.#s.offsetWidth, s = this.#s.offsetHeight;
|
|
1157
|
+
i + o > r.width - 8 && (i = Math.max(8, i - o)), a + s > r.height - 8 && (a = Math.max(8, r.height - 8 - s)), this.#s.style.left = `${i}px`, this.#s.style.top = `${a}px`, this.#s.focus({ preventScroll: !0 });
|
|
1158
|
+
}
|
|
1159
|
+
closeMenu() {
|
|
1160
|
+
this.#s.hidden = !0, this.#s.innerHTML = "";
|
|
1161
|
+
}
|
|
1162
|
+
onMenuClick(e) {
|
|
1163
|
+
let t = e.target.closest("[data-bp-menu-action]");
|
|
1164
|
+
if (t === null || t.disabled) return;
|
|
1165
|
+
let n = t.dataset.bpMenuAction ?? "";
|
|
1166
|
+
this.closeMenu();
|
|
1167
|
+
let r = this.#h.nodes;
|
|
1168
|
+
if (n.startsWith("add:")) {
|
|
1169
|
+
let e = n.slice(4);
|
|
1170
|
+
(e === "host" || e === "lifecycle" || e === "timer" || e === "condition") && this.send({
|
|
1171
|
+
type: "insert-node",
|
|
1172
|
+
kind: e,
|
|
1173
|
+
position: {
|
|
1174
|
+
x: Math.round(this.#w.x),
|
|
1175
|
+
y: Math.round(this.#w.y)
|
|
1176
|
+
}
|
|
1177
|
+
});
|
|
1178
|
+
return;
|
|
1179
|
+
}
|
|
1180
|
+
switch (n) {
|
|
1181
|
+
case "delete":
|
|
1182
|
+
this.send({
|
|
1183
|
+
type: "delete-selection",
|
|
1184
|
+
selection: this.#h
|
|
1185
|
+
});
|
|
1186
|
+
break;
|
|
1187
|
+
case "rename":
|
|
1188
|
+
r[0] !== void 0 && this.startRename(r[0]);
|
|
1189
|
+
break;
|
|
1190
|
+
case "duplicate":
|
|
1191
|
+
this.send({
|
|
1192
|
+
type: "duplicate-nodes",
|
|
1193
|
+
nodeIds: r
|
|
1194
|
+
});
|
|
1195
|
+
break;
|
|
1196
|
+
case "disable":
|
|
1197
|
+
case "enable":
|
|
1198
|
+
this.send({
|
|
1199
|
+
type: "update-node",
|
|
1200
|
+
nodeIds: r,
|
|
1201
|
+
update: {
|
|
1202
|
+
type: "enabled",
|
|
1203
|
+
enabled: n === "enable"
|
|
1204
|
+
}
|
|
1205
|
+
});
|
|
1206
|
+
break;
|
|
1207
|
+
case "simulate": {
|
|
1208
|
+
let e = (this.#d?.simulationTriggers ?? []).find((e) => e.nodeId === r[0]);
|
|
1209
|
+
e !== void 0 && (this.#S = `${e.nodeId}\u0000${e.port}`, this.#x = !0, this.renderToolbar(), this.renderSimulation());
|
|
1210
|
+
break;
|
|
1211
|
+
}
|
|
1212
|
+
case "select-all":
|
|
1213
|
+
this.select({
|
|
1214
|
+
nodes: this.graph.nodes.map((e) => e.id),
|
|
1215
|
+
edges: []
|
|
1216
|
+
});
|
|
1217
|
+
break;
|
|
1218
|
+
case "auto-layout":
|
|
1219
|
+
this.autoLayout();
|
|
1220
|
+
break;
|
|
1221
|
+
case "fit": this.fit();
|
|
1222
|
+
}
|
|
1223
|
+
}
|
|
1224
|
+
};
|
|
1225
|
+
function Ve(e, t) {
|
|
1226
|
+
let n = Math.abs(t.x - e.x), r = t.x < e.x ? .8 : .5, i = {
|
|
1227
|
+
x: e.x + n * r,
|
|
1228
|
+
y: e.y
|
|
1229
|
+
}, a = {
|
|
1230
|
+
x: t.x - n * r,
|
|
1231
|
+
y: t.y
|
|
1232
|
+
}, o = .5, s = .5, c = {
|
|
1233
|
+
x: s ** 3 * e.x + 3 * s * s * o * i.x + 3 * s * o * o * a.x + o ** 3 * t.x,
|
|
1234
|
+
y: s ** 3 * e.y + 3 * s * s * o * i.y + 3 * s * o * o * a.y + o ** 3 * t.y
|
|
1235
|
+
}, l = 3 * s * s * (i.x - e.x) + 6 * s * o * (a.x - i.x) + 3 * o * o * (t.x - a.x), u = 3 * s * s * (i.y - e.y) + 6 * s * o * (a.y - i.y) + 3 * o * o * (t.y - a.y);
|
|
1236
|
+
return {
|
|
1237
|
+
d: `M${e.x},${e.y} C${i.x},${i.y} ${a.x},${a.y} ${t.x},${t.y}`,
|
|
1238
|
+
mid: c,
|
|
1239
|
+
angle: Math.round(Math.atan2(u, l) * 180 / Math.PI)
|
|
1240
|
+
};
|
|
1241
|
+
}
|
|
1242
|
+
function z(e, t, n) {
|
|
1243
|
+
return Math.min(n, Math.max(t, e));
|
|
1244
|
+
}
|
|
1245
|
+
function He(e) {
|
|
1246
|
+
return e !== void 0;
|
|
1247
|
+
}
|
|
1248
|
+
function Ue(e) {
|
|
1249
|
+
return typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(e) : e.replace(/["\\]/g, "\\$&");
|
|
1250
|
+
}
|
|
1251
|
+
//#endregion
|
|
1252
|
+
//#region src/browser/dom/blueprint/designer-blueprint-workbench-dom.ts
|
|
1253
|
+
function We(e, t, n, r) {
|
|
1254
|
+
let i = e.querySelector(".designer");
|
|
1255
|
+
i !== null && (i.dataset.authoringMode = t);
|
|
1256
|
+
let a = e.querySelector("[data-blueprint-surface]");
|
|
1257
|
+
a !== null && (a.hidden = t !== "blueprint" || !n, a.dataset.slotReady = String(n));
|
|
1258
|
+
for (let r of e.querySelectorAll("[data-workbench-mode-tab]")) {
|
|
1259
|
+
let e = r.dataset.workbenchModeTab, i = e === t, a = e === "blueprint" && !n;
|
|
1260
|
+
r.disabled = a, r.dataset.active = String(i), r.setAttribute("aria-selected", String(i)), r.tabIndex = i ? 0 : -1;
|
|
1261
|
+
let o = a ? O.interactionWorkspaceUnavailable : e === "blueprint" ? O.interactionWorkspaceHint : O.canvasWorkspace;
|
|
1262
|
+
r.setAttribute("data-tip", o), r.ariaLabel = o;
|
|
1263
|
+
}
|
|
1264
|
+
let o = t === "blueprint" ? O.commandPalette.blueprintTrigger : O.commandPalette.trigger, s = e.querySelector("[data-command-palette-trigger-label]");
|
|
1265
|
+
s !== null && (s.textContent = o);
|
|
1266
|
+
let c = e.querySelector("[data-command-palette-toggle]");
|
|
1267
|
+
if (c !== null && (c.ariaLabel = o, c.setAttribute("data-tip", o)), Ge(e, t, r.nodes), t !== "blueprint") return;
|
|
1268
|
+
let l = e.querySelector("[data-status-selection]");
|
|
1269
|
+
l !== null && (l.textContent = O.blueprint.workbench);
|
|
1270
|
+
let u = e.querySelector("[data-status-canvas]");
|
|
1271
|
+
u !== null && (u.textContent = O.blueprint.status(r.nodes, r.relations, r.semantic, r.structural, r.problems));
|
|
1272
|
+
}
|
|
1273
|
+
function Ge(e, t, n) {
|
|
1274
|
+
let r = t === "blueprint", i = e.querySelector("[data-blueprint-library]"), a = e.querySelector("[data-blueprint-inspector]");
|
|
1275
|
+
i !== null && (i.hidden = !r), a !== null && (a.hidden = !r), Ke(e, "left", r, O.blueprint.library, n), Ke(e, "right", r, O.blueprint.inspector);
|
|
1276
|
+
}
|
|
1277
|
+
function Ke(e, t, n, r, i) {
|
|
1278
|
+
let a = e.querySelector(`[data-${t}-panel-title]`), o = e.querySelector(`[data-${t}-panel-count]`);
|
|
1279
|
+
a !== null && (n ? (a.dataset.canvasTitle ??= a.textContent ?? "", a.textContent = r) : a.dataset.canvasTitle !== void 0 && (a.textContent = a.dataset.canvasTitle, delete a.dataset.canvasTitle)), o !== null && (n ? (o.dataset.canvasCount ??= o.textContent ?? "", o.dataset.canvasAriaLabel ??= o.getAttribute("aria-label") ?? "", o.textContent = String(i ?? 0), o.setAttribute("aria-label", O.blueprint.panelCount(r, i ?? 0))) : o.dataset.canvasCount !== void 0 && (o.textContent = o.dataset.canvasCount, o.setAttribute("aria-label", o.dataset.canvasAriaLabel ?? ""), delete o.dataset.canvasCount, delete o.dataset.canvasAriaLabel));
|
|
1280
|
+
}
|
|
1281
|
+
//#endregion
|
|
1282
|
+
//#region src/browser/controllers/blueprint/designer-blueprint-canvas-bridge-helpers.ts
|
|
1283
|
+
function qe(e) {
|
|
1284
|
+
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
1285
|
+
}
|
|
1286
|
+
function B(e, t) {
|
|
1287
|
+
return {
|
|
1288
|
+
severity: "error",
|
|
1289
|
+
code: e,
|
|
1290
|
+
path: [],
|
|
1291
|
+
message: t
|
|
1292
|
+
};
|
|
1293
|
+
}
|
|
1294
|
+
function V(e, t) {
|
|
1295
|
+
return {
|
|
1296
|
+
ok: !1,
|
|
1297
|
+
diagnostics: [B(e, t)]
|
|
1298
|
+
};
|
|
1299
|
+
}
|
|
1300
|
+
function Je(e, t) {
|
|
1301
|
+
let n = qe(e) && typeof e.commandId == "string" ? e.commandId.slice(0, 128) : "invalid-command";
|
|
1302
|
+
return w({
|
|
1303
|
+
commandId: n,
|
|
1304
|
+
status: "rejected",
|
|
1305
|
+
diagnostics: t
|
|
1306
|
+
});
|
|
1307
|
+
}
|
|
1308
|
+
function Ye(e) {
|
|
1309
|
+
return { hasBlueprintCapability: (t) => {
|
|
1310
|
+
try {
|
|
1311
|
+
return e()?.hasBlueprintCapability(t) === !0;
|
|
1312
|
+
} catch {
|
|
1313
|
+
return !1;
|
|
1314
|
+
}
|
|
1315
|
+
} };
|
|
1316
|
+
}
|
|
1317
|
+
function Xe(e) {
|
|
1318
|
+
let t = O.blueprint.graph.connection;
|
|
1319
|
+
return e === "duplicate" ? t.duplicate : e === "cycle" ? t.cycle : e === "unavailable" ? t.unavailable : t.invalid;
|
|
1320
|
+
}
|
|
1321
|
+
//#endregion
|
|
1322
|
+
//#region src/browser/controllers/blueprint/designer-blueprint-canvas-bridge.ts
|
|
1323
|
+
var Ze = 256, Qe = 32, H = O.blueprint.graph, $e = class {
|
|
1324
|
+
callbacks;
|
|
1325
|
+
#e;
|
|
1326
|
+
#t;
|
|
1327
|
+
#n = null;
|
|
1328
|
+
#r;
|
|
1329
|
+
#i = 0;
|
|
1330
|
+
#a = /* @__PURE__ */ new Map();
|
|
1331
|
+
#o = (e) => this.receive(e);
|
|
1332
|
+
constructor(e) {
|
|
1333
|
+
this.callbacks = e;
|
|
1334
|
+
}
|
|
1335
|
+
get canvas() {
|
|
1336
|
+
return this.#t;
|
|
1337
|
+
}
|
|
1338
|
+
get trace() {
|
|
1339
|
+
return this.#n;
|
|
1340
|
+
}
|
|
1341
|
+
connect(e) {
|
|
1342
|
+
this.#e !== e && (this.disconnect(), this.#e = e, e.addEventListener(b, this.#o));
|
|
1343
|
+
}
|
|
1344
|
+
disconnect() {
|
|
1345
|
+
this.#e?.removeEventListener(b, this.#o), this.#e = void 0;
|
|
1346
|
+
}
|
|
1347
|
+
setCanvas(e) {
|
|
1348
|
+
return e !== this.#t && (this.#t = e, this.#i++, this.#a.clear(), this.#r = void 0, !0);
|
|
1349
|
+
}
|
|
1350
|
+
reset() {
|
|
1351
|
+
this.#n = null, this.#r = void 0, this.#a.clear();
|
|
1352
|
+
}
|
|
1353
|
+
clearTrace() {
|
|
1354
|
+
this.#n = null;
|
|
1355
|
+
}
|
|
1356
|
+
dispatchState(e = this.callbacks.getGraph()) {
|
|
1357
|
+
let t = this.#t;
|
|
1358
|
+
if (t === void 0) return;
|
|
1359
|
+
let n = this.callbacks.getDocument(), r = this.callbacks.getViewRequest(), i = w({
|
|
1360
|
+
generation: this.#i,
|
|
1361
|
+
documentRevision: this.callbacks.getDocumentRevision(),
|
|
1362
|
+
projectRevision: this.callbacks.getProjectRevision(),
|
|
1363
|
+
active: this.callbacks.getMode() === "blueprint",
|
|
1364
|
+
canUndo: this.callbacks.canUndo(),
|
|
1365
|
+
canRedo: this.callbacks.canRedo(),
|
|
1366
|
+
graph: e,
|
|
1367
|
+
selection: this.callbacks.getSelection(),
|
|
1368
|
+
diagnostics: this.stateDiagnostics(),
|
|
1369
|
+
trace: this.#n,
|
|
1370
|
+
simulationTriggers: n === void 0 ? [] : Oe(e, n),
|
|
1371
|
+
showSemantic: this.callbacks.getShowSemantic(),
|
|
1372
|
+
...r === void 0 ? {} : { viewRequest: r },
|
|
1373
|
+
...this.#r === void 0 ? {} : { lastCommand: this.#r }
|
|
1374
|
+
});
|
|
1375
|
+
t.dispatchEvent(new CustomEvent(y, { detail: { state: i } }));
|
|
1376
|
+
}
|
|
1377
|
+
commitBlueprint(e) {
|
|
1378
|
+
let t = this.callbacks.getDocument();
|
|
1379
|
+
if (t === void 0) return V("AUTHORING_EXPIRED", O.lifecycle.unloaded);
|
|
1380
|
+
if (e === null) return V("AUTHORING_REQUEST_INVALID", O.blueprint.invalidCommand);
|
|
1381
|
+
if (xe(e, t.blueprint)) return {
|
|
1382
|
+
ok: !0,
|
|
1383
|
+
value: t,
|
|
1384
|
+
diagnostics: []
|
|
1385
|
+
};
|
|
1386
|
+
let n = he({
|
|
1387
|
+
...t,
|
|
1388
|
+
blueprint: e
|
|
1389
|
+
});
|
|
1390
|
+
return n.ok ? this.callbacks.executeCommand({
|
|
1391
|
+
type: "replace-blueprint",
|
|
1392
|
+
blueprint: n.value.blueprint
|
|
1393
|
+
}) : n;
|
|
1394
|
+
}
|
|
1395
|
+
stateDiagnostics() {
|
|
1396
|
+
let e = this.callbacks.getDocument(), t = e === void 0 ? void 0 : ue(e, this.capabilities);
|
|
1397
|
+
return [...t !== void 0 && !t.ok ? t.diagnostics : [], ...this.#r?.diagnostics ?? []];
|
|
1398
|
+
}
|
|
1399
|
+
simulate(e, t, n) {
|
|
1400
|
+
let r = this.runSimulation(e, t, n);
|
|
1401
|
+
return r.ok && this.callbacks.onSimulated?.(), this.callbacks.render(), r.ok || this.callbacks.emitDiagnostics(r.diagnostics), r;
|
|
1402
|
+
}
|
|
1403
|
+
receive(e) {
|
|
1404
|
+
if (this.#t === void 0 || !e.composedPath().includes(this.#t)) return;
|
|
1405
|
+
let t = e.detail, n = qe(t) && Object.keys(t).length === 1 && "command" in t ? t.command : void 0, r = ne(n);
|
|
1406
|
+
if (!r.ok) {
|
|
1407
|
+
this.rejectUnknown(n, r.diagnostics);
|
|
1408
|
+
return;
|
|
1409
|
+
}
|
|
1410
|
+
let i = r.value, a = this.#a.get(i.commandId);
|
|
1411
|
+
if (a !== void 0) {
|
|
1412
|
+
this.#r = a, this.dispatchState();
|
|
1413
|
+
return;
|
|
1414
|
+
}
|
|
1415
|
+
let o = i.type === "select" || i.type === "run-simulation" || i.type === "clear-simulation";
|
|
1416
|
+
if (i.generation !== this.#i || !o && i.documentRevision !== this.callbacks.getDocumentRevision()) {
|
|
1417
|
+
this.finish(i.commandId, "rejected", [B("AUTHORING_EXPIRED", O.blueprint.staleCommand)]);
|
|
1418
|
+
return;
|
|
1419
|
+
}
|
|
1420
|
+
this.execute(i);
|
|
1421
|
+
}
|
|
1422
|
+
execute(t) {
|
|
1423
|
+
if (t.type === "ready") {
|
|
1424
|
+
this.finish(t.commandId, "accepted", []);
|
|
1425
|
+
return;
|
|
1426
|
+
}
|
|
1427
|
+
let n = this.callbacks.getDocument();
|
|
1428
|
+
if (n === void 0) {
|
|
1429
|
+
this.finish(t.commandId, "rejected", [B("AUTHORING_EXPIRED", O.lifecycle.unloaded)]);
|
|
1430
|
+
return;
|
|
1431
|
+
}
|
|
1432
|
+
let r = {
|
|
1433
|
+
ok: !0,
|
|
1434
|
+
value: null,
|
|
1435
|
+
diagnostics: []
|
|
1436
|
+
};
|
|
1437
|
+
switch (t.type) {
|
|
1438
|
+
case "select":
|
|
1439
|
+
r = this.callbacks.select(t.selection, !1);
|
|
1440
|
+
break;
|
|
1441
|
+
case "connect": {
|
|
1442
|
+
let i = e(n.blueprint, t.from, t.to, we(n, this.callbacks.getCatalog(), this.callbacks.getRuntimeContributions()));
|
|
1443
|
+
r = i.ok ? this.commitBlueprint(i.blueprint) : V("AUTHORING_REQUEST_INVALID", Xe(i.reason)), r.ok && i.ok && (r = this.callbacks.select({
|
|
1444
|
+
nodes: [],
|
|
1445
|
+
edges: [i.edgeId]
|
|
1446
|
+
}, !1));
|
|
1447
|
+
break;
|
|
1448
|
+
}
|
|
1449
|
+
case "delete-selection":
|
|
1450
|
+
r = this.commitBlueprint(S(n.blueprint, t.selection)), r.ok && this.callbacks.select(h, !1);
|
|
1451
|
+
break;
|
|
1452
|
+
case "insert-node": {
|
|
1453
|
+
let { type: e, commandId: i, generation: a, documentRevision: o, position: s, ...c } = t, l = D(n, c, s);
|
|
1454
|
+
r = this.commitBlueprint(l?.blueprint ?? null), r.ok && l !== null && (r = this.callbacks.select({
|
|
1455
|
+
nodes: [l.nodeId],
|
|
1456
|
+
edges: []
|
|
1457
|
+
}, !1));
|
|
1458
|
+
break;
|
|
1459
|
+
}
|
|
1460
|
+
case "update-node": {
|
|
1461
|
+
let e = n.blueprint;
|
|
1462
|
+
for (let n of t.nodeIds) {
|
|
1463
|
+
if (e === null) break;
|
|
1464
|
+
e = o(e, n, t.update);
|
|
1465
|
+
}
|
|
1466
|
+
r = this.commitBlueprint(e);
|
|
1467
|
+
break;
|
|
1468
|
+
}
|
|
1469
|
+
case "reorder-edge":
|
|
1470
|
+
r = this.commitBlueprint(f(n.blueprint, t.edgeId, t.direction));
|
|
1471
|
+
break;
|
|
1472
|
+
case "duplicate-nodes": {
|
|
1473
|
+
let e = l(n.blueprint, t.nodeIds);
|
|
1474
|
+
r = this.commitBlueprint(e?.blueprint ?? null), r.ok && e !== null && (r = this.callbacks.select({
|
|
1475
|
+
nodes: e.nodeIds,
|
|
1476
|
+
edges: []
|
|
1477
|
+
}, !1));
|
|
1478
|
+
break;
|
|
1479
|
+
}
|
|
1480
|
+
case "commit-layout":
|
|
1481
|
+
r = this.commitBlueprint(u(n.blueprint, t.nodes, t.viewport));
|
|
1482
|
+
break;
|
|
1483
|
+
case "commit-viewport":
|
|
1484
|
+
r = this.commitBlueprint(ee(n.blueprint, t.viewport));
|
|
1485
|
+
break;
|
|
1486
|
+
case "history-undo":
|
|
1487
|
+
r = this.callbacks.undo();
|
|
1488
|
+
break;
|
|
1489
|
+
case "history-redo":
|
|
1490
|
+
r = this.callbacks.redo();
|
|
1491
|
+
break;
|
|
1492
|
+
case "run-simulation":
|
|
1493
|
+
r = this.runSimulation(t.nodeId, t.port, t.payload), r.ok && this.callbacks.onSimulated?.();
|
|
1494
|
+
break;
|
|
1495
|
+
case "clear-simulation": this.#n = null;
|
|
1496
|
+
}
|
|
1497
|
+
this.finish(t.commandId, r.ok ? "accepted" : "rejected", r.diagnostics);
|
|
1498
|
+
}
|
|
1499
|
+
runSimulation(e, t, n) {
|
|
1500
|
+
let r = this.callbacks.getDocument();
|
|
1501
|
+
if (r === void 0) return V("AUTHORING_EXPIRED", O.lifecycle.unloaded);
|
|
1502
|
+
let i = a(r.blueprint, e), o = i === void 0 ? void 0 : et(i, t, n);
|
|
1503
|
+
if (o === void 0) return V("AUTHORING_REQUEST_INVALID", O.blueprint.invalidCommand);
|
|
1504
|
+
let s = ue(r, { hasBlueprintCapability: () => !0 });
|
|
1505
|
+
if (!s.ok) return s;
|
|
1506
|
+
let c = s.value, l = [], u = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Set([e]), f = new Map(this.callbacks.getGraph().nodes.map((e) => [e.id, e.title])), p = c.initialVariables, m = /* @__PURE__ */ new Set(), h = (r.subCanvases ?? []).filter((e) => e.display === "page").map((e) => e.id), g = ye(r), _ = [], v = (e, t) => {
|
|
1507
|
+
x.push({
|
|
1508
|
+
event: e,
|
|
1509
|
+
depth: t
|
|
1510
|
+
});
|
|
1511
|
+
}, y = (e, t, n, r) => {
|
|
1512
|
+
if (e === void 0 || e === g || !h.includes(e)) return;
|
|
1513
|
+
for (let e of [...m].reverse()) m.delete(e), v({
|
|
1514
|
+
type: "canvas-event",
|
|
1515
|
+
canvasId: e,
|
|
1516
|
+
name: "closed",
|
|
1517
|
+
payload: null
|
|
1518
|
+
}, r);
|
|
1519
|
+
let i = g;
|
|
1520
|
+
i !== null && (n && _.push(i), v({
|
|
1521
|
+
type: "canvas-event",
|
|
1522
|
+
canvasId: i,
|
|
1523
|
+
name: "closed",
|
|
1524
|
+
payload: null
|
|
1525
|
+
}, r)), g = e, v({
|
|
1526
|
+
type: "canvas-event",
|
|
1527
|
+
canvasId: e,
|
|
1528
|
+
name: "opened",
|
|
1529
|
+
payload: t ?? null
|
|
1530
|
+
}, r), v({
|
|
1531
|
+
type: "page-changed",
|
|
1532
|
+
name: "page-changed",
|
|
1533
|
+
payload: {
|
|
1534
|
+
from: i,
|
|
1535
|
+
to: e
|
|
1536
|
+
}
|
|
1537
|
+
}, r);
|
|
1538
|
+
}, b = !1, x = [{
|
|
1539
|
+
event: o,
|
|
1540
|
+
depth: 0
|
|
1541
|
+
}];
|
|
1542
|
+
for (; x.length > 0;) {
|
|
1543
|
+
let { event: e, depth: t } = x.shift();
|
|
1544
|
+
if (t > Qe) {
|
|
1545
|
+
l.push({
|
|
1546
|
+
kind: "error",
|
|
1547
|
+
depth: t,
|
|
1548
|
+
text: H.simulation.depthExceeded
|
|
1549
|
+
}), b = !0;
|
|
1550
|
+
break;
|
|
1551
|
+
}
|
|
1552
|
+
let n = de(c, p, e);
|
|
1553
|
+
if (!n.ok) {
|
|
1554
|
+
l.push({
|
|
1555
|
+
kind: "error",
|
|
1556
|
+
depth: t,
|
|
1557
|
+
text: n.diagnostics[0]?.message ?? O.blueprint.invalidCommand
|
|
1558
|
+
}), b = !0;
|
|
1559
|
+
break;
|
|
1560
|
+
}
|
|
1561
|
+
for (let e of n.value.ruleTraces) {
|
|
1562
|
+
if (!e.triggerMatched) continue;
|
|
1563
|
+
let n = c.rules.find((t) => t.id === e.ruleId);
|
|
1564
|
+
if (n === void 0) continue;
|
|
1565
|
+
d.add(n.nodeId), l.push({
|
|
1566
|
+
kind: t === 0 ? "trigger" : "cascade",
|
|
1567
|
+
nodeId: n.nodeId,
|
|
1568
|
+
depth: t,
|
|
1569
|
+
text: f.get(n.nodeId) ?? n.nodeId
|
|
1570
|
+
});
|
|
1571
|
+
let i = [...e.conditions], a = [...e.actions], o = (e, t) => {
|
|
1572
|
+
for (let n of e) {
|
|
1573
|
+
if (n.type === "condition") {
|
|
1574
|
+
let e = i[0];
|
|
1575
|
+
if (e === void 0 || e.nodeId !== n.nodeId) return;
|
|
1576
|
+
i.shift(), u.add(n.edgeId), d.add(n.nodeId), l.push({
|
|
1577
|
+
kind: "condition",
|
|
1578
|
+
nodeId: n.nodeId,
|
|
1579
|
+
edgeId: n.edgeId,
|
|
1580
|
+
passed: e.passed,
|
|
1581
|
+
depth: t,
|
|
1582
|
+
text: `${f.get(n.nodeId) ?? n.nodeId} · ${e.passed ? H.simulation.passed : H.simulation.failed}`
|
|
1583
|
+
}), o(e.passed ? n.yes : n.no, t + 1);
|
|
1584
|
+
continue;
|
|
1585
|
+
}
|
|
1586
|
+
let e = a[0];
|
|
1587
|
+
if (e === void 0 || e.edgeId !== n.edgeId) continue;
|
|
1588
|
+
a.shift(), u.add(n.edgeId);
|
|
1589
|
+
let s = r.blueprint.edges.find((e) => e.id === n.edgeId)?.to.node;
|
|
1590
|
+
s !== void 0 && d.add(s), l.push({
|
|
1591
|
+
kind: n.action.type === "request-variable" || n.action.type === "request-component-data" ? "request" : "action",
|
|
1592
|
+
edgeId: n.edgeId,
|
|
1593
|
+
...s === void 0 ? {} : { nodeId: s },
|
|
1594
|
+
depth: t,
|
|
1595
|
+
text: tt(n.action, r)
|
|
1596
|
+
});
|
|
1597
|
+
}
|
|
1598
|
+
};
|
|
1599
|
+
o(n.steps, t + 1);
|
|
1600
|
+
}
|
|
1601
|
+
let i = n.value.variables;
|
|
1602
|
+
for (let [e, n] of Object.entries(i)) xe(n, p[e] ?? null) && e in p || x.push({
|
|
1603
|
+
event: {
|
|
1604
|
+
type: "variable-event",
|
|
1605
|
+
variableId: e,
|
|
1606
|
+
name: "data-updated",
|
|
1607
|
+
payload: n
|
|
1608
|
+
},
|
|
1609
|
+
depth: t + 1
|
|
1610
|
+
});
|
|
1611
|
+
p = i;
|
|
1612
|
+
for (let e of n.value.canvasEffects) {
|
|
1613
|
+
if (e.type === "page-navigation") {
|
|
1614
|
+
if (e.operation === "back") y(_.pop(), void 0, !1, t + 1);
|
|
1615
|
+
else {
|
|
1616
|
+
let n = g === null ? -1 : h.indexOf(g);
|
|
1617
|
+
y(h[e.operation === "next" ? n + 1 : n - 1], void 0, !0, t + 1);
|
|
1618
|
+
}
|
|
1619
|
+
continue;
|
|
1620
|
+
}
|
|
1621
|
+
if (h.includes(e.canvasId)) {
|
|
1622
|
+
e.operation === "open" || e.operation === "toggle" && e.canvasId !== g ? y(e.canvasId, e.payload, !0, t + 1) : e.canvasId === g && y(_.pop(), void 0, !1, t + 1);
|
|
1623
|
+
continue;
|
|
1624
|
+
}
|
|
1625
|
+
let n = e.operation === "open" || e.operation !== "close" && !m.has(e.canvasId);
|
|
1626
|
+
n !== m.has(e.canvasId) && (n ? m.add(e.canvasId) : m.delete(e.canvasId), v({
|
|
1627
|
+
type: "canvas-event",
|
|
1628
|
+
canvasId: e.canvasId,
|
|
1629
|
+
name: n ? "opened" : "closed",
|
|
1630
|
+
payload: n ? e.payload ?? null : null
|
|
1631
|
+
}, t + 1));
|
|
1632
|
+
}
|
|
1633
|
+
}
|
|
1634
|
+
return this.#n = {
|
|
1635
|
+
trigger: {
|
|
1636
|
+
nodeId: e,
|
|
1637
|
+
port: t
|
|
1638
|
+
},
|
|
1639
|
+
executedEdgeIds: [...u],
|
|
1640
|
+
visitedNodeIds: [...d],
|
|
1641
|
+
steps: l,
|
|
1642
|
+
failed: b
|
|
1643
|
+
}, {
|
|
1644
|
+
ok: !0,
|
|
1645
|
+
value: null,
|
|
1646
|
+
diagnostics: []
|
|
1647
|
+
};
|
|
1648
|
+
}
|
|
1649
|
+
finish(e, t, n) {
|
|
1650
|
+
let r = w({
|
|
1651
|
+
commandId: e,
|
|
1652
|
+
status: t,
|
|
1653
|
+
diagnostics: n
|
|
1654
|
+
});
|
|
1655
|
+
this.#r = r, this.#a.set(e, r), this.#a.size > Ze && this.#a.delete(this.#a.keys().next().value), this.callbacks.render(), t === "rejected" && this.callbacks.emitDiagnostics(n);
|
|
1656
|
+
}
|
|
1657
|
+
rejectUnknown(e, t) {
|
|
1658
|
+
this.#r = Je(e, t), this.callbacks.render(), this.callbacks.emitDiagnostics(t);
|
|
1659
|
+
}
|
|
1660
|
+
get capabilities() {
|
|
1661
|
+
return Ye(this.callbacks.getRuntimeContributions);
|
|
1662
|
+
}
|
|
1663
|
+
};
|
|
1664
|
+
function et(e, t, n) {
|
|
1665
|
+
if (e.kind === "component") {
|
|
1666
|
+
if (t === "state-changed") return {
|
|
1667
|
+
type: "component-state-changed",
|
|
1668
|
+
componentId: e.componentId,
|
|
1669
|
+
name: "state-changed",
|
|
1670
|
+
payload: n
|
|
1671
|
+
};
|
|
1672
|
+
let r = N(t);
|
|
1673
|
+
return r === void 0 ? void 0 : {
|
|
1674
|
+
componentId: e.componentId,
|
|
1675
|
+
name: r,
|
|
1676
|
+
payload: n
|
|
1677
|
+
};
|
|
1678
|
+
}
|
|
1679
|
+
if (e.kind === "variable" && t === "data-updated") return {
|
|
1680
|
+
type: "variable-event",
|
|
1681
|
+
variableId: e.variableId,
|
|
1682
|
+
name: "data-updated",
|
|
1683
|
+
payload: n
|
|
1684
|
+
};
|
|
1685
|
+
if (e.kind === "lifecycle" && t === "ready") return {
|
|
1686
|
+
type: "lifecycle",
|
|
1687
|
+
name: "ready",
|
|
1688
|
+
payload: n
|
|
1689
|
+
};
|
|
1690
|
+
if (e.kind === "timer" && t === "tick") return {
|
|
1691
|
+
type: "timer",
|
|
1692
|
+
name: "tick",
|
|
1693
|
+
intervalSeconds: e.intervalSeconds,
|
|
1694
|
+
payload: n
|
|
1695
|
+
};
|
|
1696
|
+
if (e.kind === "sub-canvas" && (t === "opened" || t === "closed")) return {
|
|
1697
|
+
type: "canvas-event",
|
|
1698
|
+
canvasId: e.canvasId,
|
|
1699
|
+
name: t,
|
|
1700
|
+
payload: n
|
|
1701
|
+
};
|
|
1702
|
+
if (e.kind === "main-canvas" && t === "page-changed") return {
|
|
1703
|
+
type: "page-changed",
|
|
1704
|
+
name: "page-changed",
|
|
1705
|
+
payload: n
|
|
1706
|
+
};
|
|
1707
|
+
}
|
|
1708
|
+
function tt(e, t) {
|
|
1709
|
+
let n = (e) => t.components.find((t) => t.id === e)?.name ?? e;
|
|
1710
|
+
switch (e.type) {
|
|
1711
|
+
case "component-visibility": return `${H.ports[e.operation] ?? e.operation} · ${n(e.componentId)}`;
|
|
1712
|
+
case "request-component-data": return H.simulation.requested(n(e.componentId));
|
|
1713
|
+
case "request-variable": return H.simulation.requested(e.variableId);
|
|
1714
|
+
case "set-variable": return O.blueprint.setVariableAction(e.variableId);
|
|
1715
|
+
case "emit-host-event": return O.blueprint.emitHostEventAction(e.eventName);
|
|
1716
|
+
case "host-action": return O.blueprint.hostAction(e.actionId);
|
|
1717
|
+
case "canvas-visibility": {
|
|
1718
|
+
let n = t.subCanvases?.find((t) => t.id === e.canvasId);
|
|
1719
|
+
return O.blueprint.canvasAction(H.subCanvasPorts[n?.display ?? "popup"][e.operation] ?? e.operation, n?.name ?? e.canvasId);
|
|
1720
|
+
}
|
|
1721
|
+
case "page-navigation": return H.mainCanvasPorts[e.operation] ?? e.operation;
|
|
1722
|
+
case "component-state": {
|
|
1723
|
+
let r = t.components.find((t) => t.id === e.componentId)?.states?.items.find((t) => t.id === e.stateId);
|
|
1724
|
+
return `${H.ports[e.operation === "set" ? "set-state" : "reset-state"] ?? e.operation} · ${n(e.componentId)}${r === void 0 ? "" : ` · ${r.name}`}`;
|
|
1725
|
+
}
|
|
1726
|
+
}
|
|
1727
|
+
}
|
|
1728
|
+
//#endregion
|
|
1729
|
+
//#region src/common/operations/blueprint/designer-blueprint-value-sources.ts
|
|
1730
|
+
var nt = new RegExp(me);
|
|
1731
|
+
function rt(e, t) {
|
|
1732
|
+
return c(e.blueprint, t).some((e) => e.node.kind === "component" || e.node.kind === "sub-canvas" && e.port === "opened" || e.node.kind === "main-canvas" && e.port === "page-changed");
|
|
1733
|
+
}
|
|
1734
|
+
function it(e) {
|
|
1735
|
+
let t = e.split(".").map((e) => e.trim());
|
|
1736
|
+
return t.length === 0 || t.length > fe || t.some((e) => e === "" || !nt.test(e)) ? null : t;
|
|
1737
|
+
}
|
|
1738
|
+
function at(e) {
|
|
1739
|
+
return e.kind === "literal" ? "literal" : e.kind === "event-payload" ? e.path.length === 0 ? "event" : "event-field" : e.kind === "variable" ? "variable" : "advanced";
|
|
1740
|
+
}
|
|
1741
|
+
function ot(e, t, n) {
|
|
1742
|
+
let r = [], i = /* @__PURE__ */ new Set();
|
|
1743
|
+
for (let a of c(e.blueprint, t)) {
|
|
1744
|
+
if (a.node.kind !== "component") continue;
|
|
1745
|
+
if (a.port === "state-changed") {
|
|
1746
|
+
for (let e of [
|
|
1747
|
+
"from",
|
|
1748
|
+
"to",
|
|
1749
|
+
"cause"
|
|
1750
|
+
]) i.has(e) || (i.add(e), r.push([e]));
|
|
1751
|
+
continue;
|
|
1752
|
+
}
|
|
1753
|
+
let t = a.node.componentId, o = N(a.port), s = e.components.find((e) => e.id === t), c = n?.get(s?.type ?? "")?.manifest.editorDescriptor?.events?.find((e) => e.name === o)?.payloadSchema;
|
|
1754
|
+
if (c !== void 0) for (let e of st(c)) {
|
|
1755
|
+
let t = e.join(".");
|
|
1756
|
+
i.has(t) || (i.add(t), r.push(e));
|
|
1757
|
+
}
|
|
1758
|
+
}
|
|
1759
|
+
return r;
|
|
1760
|
+
}
|
|
1761
|
+
function st(e, t = []) {
|
|
1762
|
+
return Object.entries(e.properties).flatMap(([e, n]) => {
|
|
1763
|
+
let r = [...t, e];
|
|
1764
|
+
return n.kind === "object" ? [r, ...st(n, r)] : [r];
|
|
1765
|
+
});
|
|
1766
|
+
}
|
|
1767
|
+
//#endregion
|
|
1768
|
+
//#region src/browser/dom/blueprint/designer-blueprint-host-left-panel-dom.ts
|
|
1769
|
+
function ct(e, t, n) {
|
|
1770
|
+
for (let n of e.querySelectorAll(".host-left-panel-view[data-host-left-panel-group]")) {
|
|
1771
|
+
let e = n.dataset.hostLeftPanelGroup === t?.id;
|
|
1772
|
+
n.hidden = !e, e && t !== void 0 && n.setAttribute("aria-labelledby", oe(t.id));
|
|
1773
|
+
}
|
|
1774
|
+
let r = e.querySelector("[data-left-panel-count]");
|
|
1775
|
+
r !== null && (r.hidden = t !== void 0, t === void 0 ? (r.textContent = String(n), r.setAttribute("aria-label", O.blueprint.panelCount(O.blueprint.library, n))) : (r.textContent = "", r.removeAttribute("aria-label")));
|
|
1776
|
+
let i = e.querySelector("[data-left-panel-title]");
|
|
1777
|
+
i !== null && (i.textContent = t?.label ?? O.blueprint.library);
|
|
1778
|
+
let a = e.querySelector("[data-left-panel-scope]");
|
|
1779
|
+
a !== null && (a.textContent = t === void 0 ? O.panelScope.builtin : O.panelScope.host);
|
|
1780
|
+
}
|
|
1781
|
+
//#endregion
|
|
1782
|
+
//#region src/browser/dom/blueprint/designer-blueprint-inspector-configuration.ts
|
|
1783
|
+
var U = O.blueprint, W = U.graph, lt = [
|
|
1784
|
+
"eq",
|
|
1785
|
+
"neq",
|
|
1786
|
+
"gt",
|
|
1787
|
+
"gte",
|
|
1788
|
+
"lt",
|
|
1789
|
+
"lte",
|
|
1790
|
+
"contains",
|
|
1791
|
+
"exists"
|
|
1792
|
+
], ut = [
|
|
1793
|
+
"appear",
|
|
1794
|
+
"fade",
|
|
1795
|
+
"slide-up"
|
|
1796
|
+
], dt = [
|
|
1797
|
+
"related",
|
|
1798
|
+
"detail",
|
|
1799
|
+
"group",
|
|
1800
|
+
"drill-down"
|
|
1801
|
+
];
|
|
1802
|
+
function ft(e, t, n, r) {
|
|
1803
|
+
let i = n.nodes.length + n.edges.length;
|
|
1804
|
+
if (e === void 0 || i === 0) return `<div class="designer-empty"><span class="designer-empty-icon" aria-hidden="true">${k("sliders")}</span><p class="designer-empty-title">${U.inspectorEmpty}</p><p class="designer-empty-hint">${U.inspectorEmptyHint}</p></div>`;
|
|
1805
|
+
if (i > 1) return pt(n);
|
|
1806
|
+
let a = n.nodes[0];
|
|
1807
|
+
if (a !== void 0) {
|
|
1808
|
+
let n = t.nodes.find((e) => e.id === a);
|
|
1809
|
+
return n === void 0 ? "" : gt(e, t, n);
|
|
1810
|
+
}
|
|
1811
|
+
let o = t.edges.find((e) => e.id === n.edges[0]);
|
|
1812
|
+
return o === void 0 ? "" : vt(e, t, o, r);
|
|
1813
|
+
}
|
|
1814
|
+
function pt(e) {
|
|
1815
|
+
let t = e.nodes.length === 0 ? "" : `<button type="button" class="designer-control designer-button" data-blueprint-nodes-enabled="true">${W.enableNodes}</button><button type="button" class="designer-control designer-button" data-blueprint-nodes-enabled="false">${W.disableNodes}</button>`;
|
|
1816
|
+
return `<div class="blueprint-config" data-blueprint-multi>
|
|
1817
|
+
${G("multi", U.selectionOverview, `<p class="blueprint-config-summary">${_(W.multiSelection(e.nodes.length, e.edges.length))}</p>
|
|
1818
|
+
<div class="blueprint-config-actions">${t}</div>`)}
|
|
1819
|
+
${ht(W.menu.delete)}
|
|
1820
|
+
</div>`;
|
|
1821
|
+
}
|
|
1822
|
+
function G(e, t, n, r = "") {
|
|
1823
|
+
return `<details class="designer-panel-section designer-inspector-section designer-inspector-disclosure blueprint-config-section" data-inspector-search-key="blueprint-${e}" open><summary class="designer-panel-section-title designer-inspector-section-title designer-inspector-section-summary designer-panel-section-summary">${_(t)}${r === "" ? "" : `<span class="designer-inspector-section-meta">${_(r)}</span>`}<span class="designer-panel-section-disclosure designer-inspector-section-disclosure" aria-hidden="true">${k("chevron-down")}</span></summary><div class="blueprint-config-content">${n}</div></details>`;
|
|
1824
|
+
}
|
|
1825
|
+
function K(e, t, n = "row") {
|
|
1826
|
+
return `<div data-blueprint-field-row="${T(e)}" data-blueprint-field-variant="${n}">${t}</div>`;
|
|
1827
|
+
}
|
|
1828
|
+
function q(e, t, n = "") {
|
|
1829
|
+
return K(e, `<span class="blueprint-config-value">${t === "" ? "" : `<span>${_(t)}</span>`}${n === "" ? "" : `<code>${_(n)}</code>`}</span>`);
|
|
1830
|
+
}
|
|
1831
|
+
function mt(e, t, n) {
|
|
1832
|
+
return `<span data-blueprint-field-switch="${T(e)}" data-checked="${String(t)}" ${n}></span>`;
|
|
1833
|
+
}
|
|
1834
|
+
function ht(e) {
|
|
1835
|
+
return `<div class="blueprint-config-footer"><button type="button" class="designer-control designer-button blueprint-delete-button" data-variant="danger" data-blueprint-delete>${_(e)}</button></div>`;
|
|
1836
|
+
}
|
|
1837
|
+
function J(e) {
|
|
1838
|
+
return `<p class="blueprint-config-empty">${_(e)}</p>`;
|
|
1839
|
+
}
|
|
1840
|
+
function gt(e, t, n) {
|
|
1841
|
+
let r = (e, t) => e.map((e) => `<li class="blueprint-anchor" data-direction="${t}" data-connected="${String(e.connected)}" data-available="${String(e.available)}"><span class="designer-badge" data-tone="${t === "in" ? "success" : "accent"}">${t === "in" ? W.inputs : W.outputs}</span><span class="blueprint-anchor-label">${_(e.label)}</span><code>${_(e.id)}</code></li>`).join(""), i = `${r(n.outputs, "out")}${r(n.inputs, "in")}`, a = i === "" ? J(W.noEdges) : `<ul class="blueprint-anchor-list">${i}</ul>`, o = T(n.id), s = [n.renamable ? K(W.nodeName, `<input type="text" class="designer-control designer-input" data-blueprint-node-field="name" data-node-id="${o}" value="${T(n.name ?? "")}" placeholder="${T(W.nodeNamePlaceholder)}" maxlength="64">`) : "", mt(W.enabledState, n.enabled, `data-blueprint-node-field="enabled" data-node-id="${o}"`)].join(""), c = _t(e, n), l = t.edges.filter((e) => e.source === n.id || e.target === n.id), u = new Map(t.nodes.map((e) => [e.id, e.title])), d = l.length === 0 ? J(W.noEdges) : `<ul class="blueprint-config-edges">${l.map((e) => {
|
|
1842
|
+
let t = e.target === n.id, r = t ? e.source : e.target;
|
|
1843
|
+
return `<li><button type="button" class="blueprint-config-link" data-blueprint-select-edge="${T(e.id)}" data-category="${e.category}"><span class="designer-badge" data-tone="${t ? "success" : "accent"}">${t ? W.upstream : W.downstream}</span><span class="blueprint-config-link-copy"><strong>${_(u.get(r) ?? r)}</strong><small>${_(e.label)}</small></span><span class="blueprint-config-link-arrow" aria-hidden="true">${k("chevron-right")}</span></button></li>`;
|
|
1844
|
+
}).join("")}</ul>`;
|
|
1845
|
+
return `<div class="blueprint-config" data-blueprint-node-config="${o}" data-node-kind="${n.kind}">
|
|
1846
|
+
${G("anchors", W.anchorInfo, a, String(n.inputs.length + n.outputs.length))}
|
|
1847
|
+
${G("basic", W.basicConfig, s)}
|
|
1848
|
+
${c === "" ? "" : G("node", W.nodeConfig, c)}
|
|
1849
|
+
${G("edges", W.edgeList, d, String(l.length))}
|
|
1850
|
+
</div>`;
|
|
1851
|
+
}
|
|
1852
|
+
function _t(e, t) {
|
|
1853
|
+
let n = T(t.id);
|
|
1854
|
+
switch (t.kind) {
|
|
1855
|
+
case "timer": return K(U.timerInterval, `<input type="number" class="designer-control designer-input" min="1" max="86400" step="1" data-blueprint-node-field="interval" data-node-id="${n}" value="${t.intervalSeconds ?? 5}">`);
|
|
1856
|
+
case "condition": {
|
|
1857
|
+
let r = t.condition;
|
|
1858
|
+
return r === void 0 ? "" : [
|
|
1859
|
+
Y(e, "node", t.id, "left", W.conditionLeft, r.left, !0),
|
|
1860
|
+
K(U.conditionOperatorLabel, `<select class="designer-control designer-select" data-blueprint-node-field="operator" data-node-id="${n}">${lt.map((e) => `<option value="${e}"${e === r.operator ? " selected" : ""}>${_(U.conditionOperator(e))}</option>`).join("")}</select>`),
|
|
1861
|
+
r.operator === "exists" || r.right === void 0 ? "" : Y(e, "node", t.id, "right", W.conditionRight, r.right, !0)
|
|
1862
|
+
].join("");
|
|
1863
|
+
}
|
|
1864
|
+
case "component": return q(W.material, "", t.materialType ?? t.subtitle);
|
|
1865
|
+
case "variable": {
|
|
1866
|
+
let n = A(e).find((e) => e.id === t.variableId);
|
|
1867
|
+
return [q(U.variableId, "", t.variableId ?? ""), q(W.initialValue, "", bt(JSON.stringify(n?.initialValue ?? null) ?? "null"))].join("");
|
|
1868
|
+
}
|
|
1869
|
+
default: return J(t.subtitle);
|
|
1870
|
+
}
|
|
1871
|
+
}
|
|
1872
|
+
function vt(e, t, n, r) {
|
|
1873
|
+
let i = new Map(t.nodes.map((e) => [e.id, e])), a = i.get(n.source), o = i.get(n.target), s = T(n.id), c = a?.outputs.find((e) => e.id === n.sourcePort), l = o?.inputs.find((e) => e.id === n.targetPort), u = [q(W.source, `${a?.title ?? n.source} · ${c?.label ?? n.sourcePort}`, n.sourcePort), q(W.target, n.kind === "semantic" ? o?.title ?? n.target : `${o?.title ?? n.target} · ${l?.label ?? n.targetPort}`, n.kind === "semantic" ? "" : n.targetPort)].join(""), d = [];
|
|
1874
|
+
if (n.kind === "semantic") d.push(K(W.role, `<select class="designer-control designer-select" data-blueprint-edge-field="role" data-edge-id="${s}">${dt.map((e) => `<option value="${e}"${e === n.role ? " selected" : ""}>${_(U.semanticRoles[e])}</option>`).join("")}</select>`), J(U.semanticHint));
|
|
1875
|
+
else {
|
|
1876
|
+
let t = o?.inputs.filter((e) => e.available) ?? [];
|
|
1877
|
+
o?.kind === "host" && n.targetPort.startsWith("event:") ? d.push(K(W.hostEventName, `<input type="text" class="designer-control designer-input" data-blueprint-edge-field="host-event" data-edge-id="${s}" value="${T(n.targetPort.slice(6))}" maxlength="128">`)) : t.length > 1 && d.push(K(W.targetPort, `<select class="designer-control designer-select" data-blueprint-edge-field="target-port" data-edge-id="${s}">${t.map((e) => `<option value="${T(e.id)}"${e.id === n.targetPort ? " selected" : ""}>${_(e.label)}</option>`).join("")}</select>`));
|
|
1878
|
+
let i = rt(e, n.id);
|
|
1879
|
+
if (n.value !== void 0 && d.push(Y(e, "edge", n.id, "value", W.writeValue, n.value, i, r)), o?.kind === "sub-canvas" && (n.targetPort === "open" || n.targetPort === "toggle") && d.push(mt(W.popupPayload, n.payload !== void 0, `data-blueprint-edge-field="payload-enabled" data-edge-id="${s}"`)), n.payload !== void 0 && d.push(Y(e, "edge", n.id, "payload", o?.kind === "sub-canvas" ? W.popupPayloadValue : W.payload, n.payload, i, r)), o?.kind === "component" && n.targetPort === "set-state") {
|
|
1880
|
+
let t = e.components.find((e) => e.id === o.componentId)?.states?.items ?? [];
|
|
1881
|
+
d.push(K(W.targetState, `<select class="designer-control designer-select" data-blueprint-edge-field="state" data-edge-id="${s}">${t.map((e) => `<option value="${T(e.id)}"${e.id === n.stateId ? " selected" : ""}>${_(e.name)}</option>`).join("")}</select>`));
|
|
1882
|
+
}
|
|
1883
|
+
if (o?.kind === "component" && [
|
|
1884
|
+
"show",
|
|
1885
|
+
"hide",
|
|
1886
|
+
"toggle"
|
|
1887
|
+
].includes(n.targetPort)) {
|
|
1888
|
+
let e = n.transition;
|
|
1889
|
+
d.push(K(W.transition, `<select class="designer-control designer-select" data-blueprint-edge-field="transition-effect" data-edge-id="${s}">
|
|
1890
|
+
<option value=""${e === void 0 ? " selected" : ""}>${W.noTransition}</option>
|
|
1891
|
+
${ut.map((t) => `<option value="${t}"${e?.effect === t ? " selected" : ""}>${_(W.transitionEffects[t])}</option>`).join("")}
|
|
1892
|
+
</select>`), e === void 0 ? "" : K(W.durationMs, `<input type="number" class="designer-control designer-input" min="0" max="10000" step="50" data-blueprint-edge-field="transition-duration" data-edge-id="${s}" value="${e.durationMs}">`));
|
|
1893
|
+
}
|
|
1894
|
+
n.order !== void 0 && (n.siblingCount ?? 1) > 1 && d.push(K(W.executionOrder, `<span class="blueprint-config-order"><span>${_(W.edgeOrder(n.order, n.siblingCount ?? 1))}</span><button type="button" class="designer-control designer-icon-button" data-blueprint-edge-order="earlier" data-edge-id="${s}" data-tip="${T(W.earlier)}" aria-label="${T(W.earlier)}"${n.order <= 1 ? " disabled" : ""}>${k("arrow-up")}</button><button type="button" class="designer-control designer-icon-button" data-blueprint-edge-order="later" data-edge-id="${s}" data-tip="${T(W.later)}" aria-label="${T(W.later)}"${n.order >= (n.siblingCount ?? 1) ? " disabled" : ""}>${k("arrow-down")}</button></span>`));
|
|
1895
|
+
}
|
|
1896
|
+
return `<div class="blueprint-config" data-blueprint-edge-config="${s}" data-category="${n.category}">
|
|
1897
|
+
${G("anchors", W.anchorInfo, u)}
|
|
1898
|
+
${d.length === 0 ? "" : G("edge", W.edgeConfig, d.join(""))}
|
|
1899
|
+
${ht(W.menu.deleteEdge)}
|
|
1900
|
+
</div>`;
|
|
1901
|
+
}
|
|
1902
|
+
function Y(e, t, n, r, i, a, o, s) {
|
|
1903
|
+
let c = at(a), l = `data-blueprint-expression="${r}" data-expression-owner="${t}" data-expression-owner-id="${T(n)}"`, u = [
|
|
1904
|
+
["literal", U.valueSources.literal],
|
|
1905
|
+
["event", U.valueSources.event],
|
|
1906
|
+
["event-field", U.valueSources.eventField],
|
|
1907
|
+
["variable", U.valueSources.variable],
|
|
1908
|
+
...c === "advanced" ? [["advanced", U.valueSources.advanced]] : []
|
|
1909
|
+
].filter(([e]) => e !== "event-field" || o || c === "event-field").map(([e, t]) => `<option value="${e}"${e === c ? " selected" : ""}${e === "advanced" ? " disabled" : ""}>${_(t)}</option>`).join(""), d = "";
|
|
1910
|
+
if (a.kind === "literal") d = `<input type="text" class="designer-control designer-input" data-expression-part="literal" value="${T(JSON.stringify(a.value) ?? "null")}" aria-label="${T(U.literalJson)}">`;
|
|
1911
|
+
else if (a.kind === "event-payload" && a.path.length > 0) {
|
|
1912
|
+
let i = `blueprint-fields-${t}-${n}-${r}`.replace(/[^A-Za-z0-9_-]/g, "-"), o = t === "edge" ? ot(e, n, s) : [];
|
|
1913
|
+
d = `<input type="text" class="designer-control designer-input" data-expression-part="field" list="${i}" value="${T(a.path.join("."))}" aria-label="${T(U.eventField)}"><datalist id="${i}">${o.map((e) => `<option value="${T(e.join("."))}"></option>`).join("")}</datalist>`;
|
|
1914
|
+
} else if (a.kind === "variable") {
|
|
1915
|
+
let t = A(e);
|
|
1916
|
+
d = `<select class="designer-control designer-select" data-expression-part="variable" aria-label="${T(U.sourceVariable)}">${t.map((e) => `<option value="${T(e.id)}"${e.id === a.variableId ? " selected" : ""}>${_(e.name)}</option>`).join("")}</select>`;
|
|
1917
|
+
} else c === "advanced" && (d = `<code class="blueprint-config-advanced">${_(bt(JSON.stringify(a) ?? ""))}</code>`);
|
|
1918
|
+
return `<div class="blueprint-expression" ${l}>${K(i, `<span class="blueprint-expression-stack"><select class="designer-control designer-select" data-expression-part="source" aria-label="${T(U.valueSource)}">${u}</select>${d}</span>`, "expression")}</div>`;
|
|
1919
|
+
}
|
|
1920
|
+
function yt(e) {
|
|
1921
|
+
if (typeof e.querySelectorAll != "function") return;
|
|
1922
|
+
let t = e.ownerDocument ?? e;
|
|
1923
|
+
for (let n of e.querySelectorAll("[data-blueprint-field-row]")) {
|
|
1924
|
+
let e = n.dataset.blueprintFieldRow ?? "", r = n.dataset.blueprintFieldVariant === "expression", i = n.querySelector("input, select, textarea") !== null, a = ce(t, {
|
|
1925
|
+
label: e,
|
|
1926
|
+
tagName: i && !r ? "label" : "div",
|
|
1927
|
+
className: r ? "blueprint-config-field blueprint-expression-row" : "blueprint-config-field"
|
|
1928
|
+
});
|
|
1929
|
+
if (r) {
|
|
1930
|
+
let n = t.createElement("span");
|
|
1931
|
+
n.className = "blueprint-expression-label", n.textContent = e, a.labelText.replaceChildren(n);
|
|
1932
|
+
}
|
|
1933
|
+
a.control.append(...n.childNodes), n.replaceWith(a.field);
|
|
1934
|
+
}
|
|
1935
|
+
for (let n of e.querySelectorAll("[data-blueprint-field-switch]")) {
|
|
1936
|
+
let { field: e, input: r } = le(t, {
|
|
1937
|
+
label: n.dataset.blueprintFieldSwitch ?? "",
|
|
1938
|
+
checked: n.dataset.checked === "true",
|
|
1939
|
+
className: "blueprint-config-field"
|
|
1940
|
+
});
|
|
1941
|
+
for (let [e, t] of Object.entries(n.dataset)) e !== "blueprintFieldSwitch" && e !== "checked" && t !== void 0 && (r.dataset[e] = t);
|
|
1942
|
+
n.replaceWith(e);
|
|
1943
|
+
}
|
|
1944
|
+
}
|
|
1945
|
+
function bt(e, t = 96) {
|
|
1946
|
+
return e.length <= t ? e : `${e.slice(0, t - 1)}…`;
|
|
1947
|
+
}
|
|
1948
|
+
//#endregion
|
|
1949
|
+
//#region src/browser/dom/blueprint/designer-blueprint-inspector-dom.ts
|
|
1950
|
+
var xt = [
|
|
1951
|
+
"configuration",
|
|
1952
|
+
"problems",
|
|
1953
|
+
"trace"
|
|
1954
|
+
];
|
|
1955
|
+
function St(e, t, n, r, i, a, o, s) {
|
|
1956
|
+
if (e === void 0) return;
|
|
1957
|
+
let c = {
|
|
1958
|
+
configuration: 0,
|
|
1959
|
+
problems: a.length,
|
|
1960
|
+
trace: o?.steps.length ?? 0
|
|
1961
|
+
}, l = Et(t, n, r, i);
|
|
1962
|
+
e.innerHTML = `<div class="blueprint-inspector-shell">
|
|
1963
|
+
<header class="blueprint-inspector-topbar">
|
|
1964
|
+
<span><strong>${_(l.title)}</strong><small>${_(l.detail)}</small></span>
|
|
1965
|
+
<div class="blueprint-inspector-modes" role="tablist" aria-label="${O.blueprint.inspector}">
|
|
1966
|
+
${xt.map((e) => Dt(e, i, c[e])).join("")}
|
|
1967
|
+
</div>
|
|
1968
|
+
</header>
|
|
1969
|
+
<div class="blueprint-panel-scroll inspector-pane" data-blueprint-inspector-pane id="designer-blueprint-inspector-${i}-panel" role="tabpanel" aria-labelledby="designer-blueprint-inspector-${i}-tab" tabindex="0" aria-live="polite">
|
|
1970
|
+
${Ct(i, t, n, r, a, o, s)}
|
|
1971
|
+
</div>
|
|
1972
|
+
</div>`, yt(e);
|
|
1973
|
+
}
|
|
1974
|
+
function Ct(e, t, n, r, i, a, o) {
|
|
1975
|
+
return e === "problems" ? wt(i) : e === "trace" ? Tt(a) : ft(t, n, r, o);
|
|
1976
|
+
}
|
|
1977
|
+
function wt(e) {
|
|
1978
|
+
let t = e.slice(0, 8);
|
|
1979
|
+
return t.length === 0 ? `<div class="designer-empty" data-tone="success"><span class="designer-empty-icon" aria-hidden="true">${k("check")}</span><p class="designer-empty-title">${O.blueprint.problemsHealthy}</p><p class="designer-empty-hint">${O.blueprint.problemsHealthyHint}</p></div>` : `<section class="blueprint-inspector-status" data-blueprint-problems><ul>${t.map((e) => `<li data-severity="${e.severity}"><strong>${_(e.code)}</strong><span>${_(e.message)}</span><small>${_(e.path.join(".") || "—")}</small></li>`).join("")}</ul></section>`;
|
|
1980
|
+
}
|
|
1981
|
+
function Tt(e) {
|
|
1982
|
+
if (e === null) return `<div class="designer-empty"><span class="designer-empty-icon" aria-hidden="true">${k("terminal")}</span><p class="designer-empty-title">${O.blueprint.noTrace}</p><p class="designer-empty-hint">${O.blueprint.noTraceHint}</p></div>`;
|
|
1983
|
+
let t = e.steps.filter((e) => e.kind === "condition" && e.passed === !1).length;
|
|
1984
|
+
return `<section class="blueprint-inspector-status" data-blueprint-trace data-failed="${String(e.failed)}">
|
|
1985
|
+
<div class="blueprint-trace-summary">${O.blueprint.traceSummary(e.executedEdgeIds.length, t)}</div>
|
|
1986
|
+
<ol class="blueprint-trace-steps">${e.steps.slice(0, 200).map((e) => `<li data-kind="${e.kind}"${e.passed === void 0 ? "" : ` data-passed="${String(e.passed)}"`} style="--bp-trace-depth: ${Math.min(e.depth, 12)}">${e.nodeId === void 0 ? _(e.text) : `<button type="button" class="blueprint-trace-step" data-blueprint-select-node="${_(e.nodeId)}">${_(e.text)}</button>`}</li>`).join("")}</ol>
|
|
1987
|
+
<button type="button" class="designer-button" data-blueprint-clear-trace>${O.blueprint.graph.simulation.clear}</button>
|
|
1988
|
+
</section>`;
|
|
1989
|
+
}
|
|
1990
|
+
function Et(e, t, n, r) {
|
|
1991
|
+
let i = O.blueprint;
|
|
1992
|
+
if (r === "problems") return {
|
|
1993
|
+
title: i.problemsTitle,
|
|
1994
|
+
detail: i.inspector
|
|
1995
|
+
};
|
|
1996
|
+
if (r === "trace") return {
|
|
1997
|
+
title: i.traceTitle,
|
|
1998
|
+
detail: i.inspector
|
|
1999
|
+
};
|
|
2000
|
+
let a = n.nodes.length + n.edges.length;
|
|
2001
|
+
if (a === 0) return {
|
|
2002
|
+
title: i.inspector,
|
|
2003
|
+
detail: i.inspectorEmpty
|
|
2004
|
+
};
|
|
2005
|
+
if (a > 1) return {
|
|
2006
|
+
title: i.selectionOverview,
|
|
2007
|
+
detail: i.graph.multiSelection(n.nodes.length, n.edges.length)
|
|
2008
|
+
};
|
|
2009
|
+
let o = t.nodes.find((e) => e.id === n.nodes[0]);
|
|
2010
|
+
if (o !== void 0) return {
|
|
2011
|
+
title: o.title,
|
|
2012
|
+
detail: `${o.id} | ${i.graph.nodeKinds[o.kind]}`
|
|
2013
|
+
};
|
|
2014
|
+
let s = t.edges.find((e) => e.id === n.edges[0]);
|
|
2015
|
+
return {
|
|
2016
|
+
title: s?.label ?? i.selectionType.edge,
|
|
2017
|
+
detail: s === void 0 ? i.selectionType.edge : `${s.id} | ${i.graph.edgeCategories[s.category]}`
|
|
2018
|
+
};
|
|
2019
|
+
}
|
|
2020
|
+
function Dt(e, t, n) {
|
|
2021
|
+
let r = O.blueprint.inspectorTabs[e];
|
|
2022
|
+
return `<button type="button" class="blueprint-inspector-mode" id="designer-blueprint-inspector-${e}-tab" role="tab" aria-controls="designer-blueprint-inspector-${e}-panel" aria-selected="${String(e === t)}" tabindex="${e === t ? 0 : -1}" data-blueprint-inspector-tab="${e}" data-tip="${r}" aria-label="${r}"><span aria-hidden="true">${k(e === "configuration" ? "sliders" : e === "problems" ? "check" : "terminal")}</span>${n === 0 ? "" : `<em data-tone="${e === "problems" ? "danger" : "neutral"}">${n}</em>`}</button>`;
|
|
2023
|
+
}
|
|
2024
|
+
//#endregion
|
|
2025
|
+
//#region src/browser/dom/blueprint/designer-blueprint-library-dom.ts
|
|
2026
|
+
var Ot = [
|
|
2027
|
+
"components",
|
|
2028
|
+
"relations",
|
|
2029
|
+
"variables"
|
|
2030
|
+
], kt = [
|
|
2031
|
+
"lifecycle",
|
|
2032
|
+
"timer",
|
|
2033
|
+
"condition",
|
|
2034
|
+
"host"
|
|
2035
|
+
], X = O.blueprint;
|
|
2036
|
+
function At(e, t) {
|
|
2037
|
+
if (e === void 0) return;
|
|
2038
|
+
let n = (t.groups ?? []).filter((e) => E(e, "blueprint")), r = C(t.activeTab), i = n.some((e) => e.id === r) ? r : void 0, a = Rt(t.activeTab) ? t.activeTab : "components", o = i === void 0 ? a : x(i), s = a === "relations" ? X.relationList.search : X.librarySearch;
|
|
2039
|
+
e.innerHTML = `<div class="blueprint-library-shell">
|
|
2040
|
+
<nav class="rail-tabs blueprint-library-rail" role="tablist" aria-orientation="vertical" aria-label="${X.library}">
|
|
2041
|
+
${Ot.map((e) => It(e, o)).join("")}
|
|
2042
|
+
${n.map((e) => Lt(e, i)).join("")}
|
|
2043
|
+
</nav>
|
|
2044
|
+
<section class="rail-view blueprint-library-main"${i === void 0 ? "" : " hidden"}>
|
|
2045
|
+
<div class="layer-panel-controls blueprint-library-controls">
|
|
2046
|
+
<label class="designer-field layer-search blueprint-library-search">
|
|
2047
|
+
<span class="layer-search-glyph" aria-hidden="true">${k("search")}</span>
|
|
2048
|
+
<input type="search" class="designer-control designer-input" data-blueprint-library-search value="${T(t.query)}" placeholder="${s}" aria-label="${s}">
|
|
2049
|
+
</label>
|
|
2050
|
+
</div>
|
|
2051
|
+
<div class="blueprint-panel-scroll" id="designer-blueprint-library-${a}-panel" role="tabpanel" aria-labelledby="designer-blueprint-library-${a}-tab" tabindex="0">
|
|
2052
|
+
${jt(a, t)}
|
|
2053
|
+
</div>
|
|
2054
|
+
</section>
|
|
2055
|
+
</div>`;
|
|
2056
|
+
}
|
|
2057
|
+
function jt(e, t) {
|
|
2058
|
+
let n = t.query.trim().toLocaleLowerCase();
|
|
2059
|
+
return e === "components" ? Mt(t.components, t.selection, n, X.layers, X.noComponentNodes) : e === "variables" ? Mt(t.variables, t.selection, n, X.globalVariables, X.noVariables) : Pt(t, n);
|
|
2060
|
+
}
|
|
2061
|
+
function Mt(e, t, n, r, i) {
|
|
2062
|
+
let a = e.filter((e) => n.length === 0 || `${e.name} ${e.entityId} ${e.subtitle}`.toLocaleLowerCase().includes(n));
|
|
2063
|
+
return a.length === 0 ? Z(i) : `<section class="blueprint-palette-group" aria-label="${T(r)}">
|
|
2064
|
+
<header><strong>${_(r)}</strong><span>${a.length}</span></header>
|
|
2065
|
+
<div class="blueprint-palette-list">
|
|
2066
|
+
${a.map((e) => Nt(e, t)).join("")}
|
|
2067
|
+
</div>
|
|
2068
|
+
<p class="blueprint-library-hint">${X.componentNodeHint}</p>
|
|
2069
|
+
</section>`;
|
|
2070
|
+
}
|
|
2071
|
+
function Nt(e, t) {
|
|
2072
|
+
let n = e.nodeId !== void 0, r = n && t.nodes.includes(e.nodeId ?? ""), i = e.kind === "component", a = n ? `data-blueprint-select-node="${T(e.nodeId ?? "")}"` : i ? `data-blueprint-add-component="${T(e.entityId)}"` : `data-blueprint-add-variable="${T(e.entityId)}"`, o = n ? i ? X.locateComponent(e.name) : X.locateVariable(e.name) : i ? X.addComponent(e.name) : X.addVariableNode(e.name), s = n ? "" : ` draggable="true" data-blueprint-drag-kind="${e.kind}" data-${i ? "component" : "variable"}-id="${T(e.entityId)}" data-blueprint-drag-label="${T(e.name)}"`, c = i ? "layers" : "variable", l = i ? X.componentEventCount(e.eventCount) : e.subtitle;
|
|
2073
|
+
return `<div class="designer-list-row blueprint-palette-item" data-density="default" data-depth="${e.depth}" style="--bp-indent: ${e.depth * 16}px" data-placed="${String(n)}" data-selected="${String(r)}" data-node-kind="${e.kind}"${s}>
|
|
2074
|
+
<button type="button" class="blueprint-palette-primary" ${a} aria-label="${T(o)}" data-tip="${T(o)}">
|
|
2075
|
+
<span class="blueprint-palette-glyph" aria-hidden="true">${k(c)}</span>
|
|
2076
|
+
<span class="blueprint-palette-copy"><strong>${_(e.name)}</strong><small>${_(l)}</small></span>
|
|
2077
|
+
<span class="blueprint-palette-state" aria-hidden="true">${k(n ? "check" : "plus")}</span>
|
|
2078
|
+
</button>
|
|
2079
|
+
</div>`;
|
|
2080
|
+
}
|
|
2081
|
+
function Pt(e, t) {
|
|
2082
|
+
let n = X.graph, r = new Set(e.graph.nodes.filter((e) => e.kind === "host" || e.kind === "lifecycle").map((e) => e.kind)), i = kt.filter((e) => t.length === 0 || `${n.nodeKinds[e]} ${n.nodeKindHints[e]} ${e}`.toLocaleLowerCase().includes(t)), a = i.map((t) => {
|
|
2083
|
+
let i = t === "host" || t === "lifecycle" ? e.graph.nodes.find((e) => e.kind === t) : void 0, a = r.has(t), o = i === void 0 ? `data-blueprint-insert-node="${t}"` : `data-blueprint-select-node="${T(i.id)}"`, s = X.addLogicNode(n.nodeKinds[t]), c = t === "timer" ? "activity" : t === "condition" ? "sliders" : t === "host" ? "terminal" : "play";
|
|
2084
|
+
return `<div class="designer-list-row blueprint-palette-item" data-density="default" data-placed="${String(a)}" data-node-kind="${t}"${a ? "" : ` draggable="true" data-blueprint-drag-kind="${t}" data-blueprint-drag-label="${T(n.nodeKinds[t])}"`}>
|
|
2085
|
+
<button type="button" class="blueprint-palette-primary" ${o} aria-label="${T(s)}" data-tip="${T(s)}">
|
|
2086
|
+
<span class="blueprint-palette-glyph" aria-hidden="true">${k(c)}</span>
|
|
2087
|
+
<span class="blueprint-palette-copy"><strong>${_(n.nodeKinds[t])}</strong><small>${_(n.nodeKindHints[t])}</small></span>
|
|
2088
|
+
<span class="blueprint-palette-state" aria-hidden="true">${k(a ? "check" : "plus")}</span>
|
|
2089
|
+
</button>
|
|
2090
|
+
</div>`;
|
|
2091
|
+
}).join(""), o = new Map(e.graph.nodes.map((e) => [e.id, e.title])), s = e.graph.edges.filter((e) => t.length === 0 || `${o.get(e.source) ?? ""} ${o.get(e.target) ?? ""} ${e.label} ${e.sourcePort} ${e.targetPort}`.toLocaleLowerCase().includes(t)), c = s.map((t) => {
|
|
2092
|
+
let r = e.selection.edges.includes(t.id), i = `${o.get(t.source) ?? t.source} → ${o.get(t.target) ?? t.target}`;
|
|
2093
|
+
return `<div class="designer-list-row blueprint-relation-item" data-density="default" data-selected="${String(r)}" data-category="${t.category}" data-active="${String(t.active)}">
|
|
2094
|
+
<button type="button" class="blueprint-palette-primary" data-blueprint-select-edge="${T(t.id)}" aria-label="${T(i)}">
|
|
2095
|
+
<span class="blueprint-relation-swatch" aria-hidden="true"></span>
|
|
2096
|
+
<span class="blueprint-palette-copy"><strong>${_(i)}</strong><small>${_(`${n.edgeCategories[t.category]} · ${t.label}`)}</small></span>
|
|
2097
|
+
</button>
|
|
2098
|
+
</div>`;
|
|
2099
|
+
}).join("");
|
|
2100
|
+
return `<section class="blueprint-palette-group" aria-label="${X.logic}">
|
|
2101
|
+
<header><strong>${X.logic}</strong><span>${i.length}</span></header>
|
|
2102
|
+
<div class="blueprint-palette-list">${a || Z(X.noLogicNodes)}</div>
|
|
2103
|
+
<p class="blueprint-library-hint">${X.directNodeHint}</p>
|
|
2104
|
+
</section>
|
|
2105
|
+
${Ft(e, t)}
|
|
2106
|
+
<section class="blueprint-palette-group" aria-label="${X.graph.edgeList}">
|
|
2107
|
+
<header><strong>${X.graph.edgeList}</strong><span>${s.length}</span></header>
|
|
2108
|
+
<div class="blueprint-palette-list">${c || Z(n.noEdges)}</div>
|
|
2109
|
+
</section>`;
|
|
2110
|
+
}
|
|
2111
|
+
function Ft(e, t) {
|
|
2112
|
+
let n = e.document?.subCanvases ?? [], r = [...n.some((e) => e.display === "page") ? [{
|
|
2113
|
+
id: "",
|
|
2114
|
+
name: X.graph.nodeKinds["main-canvas"],
|
|
2115
|
+
detail: X.mainCanvasEntry,
|
|
2116
|
+
icon: "grid",
|
|
2117
|
+
kind: "main-canvas"
|
|
2118
|
+
}] : [], ...n.map((e) => ({
|
|
2119
|
+
id: e.id,
|
|
2120
|
+
name: e.name,
|
|
2121
|
+
detail: e.display === "page" ? X.pageSize : `${X.graph.subCanvasKinds.popup} · ${X.popupSize(e.width, e.height)}`,
|
|
2122
|
+
icon: e.display === "page" ? "doc" : "copy",
|
|
2123
|
+
kind: "sub-canvas"
|
|
2124
|
+
}))].filter((e) => t.length === 0 || `${e.name} ${e.id}`.toLocaleLowerCase().includes(t)), i = r.map((t) => {
|
|
2125
|
+
let n = e.graph.nodes.find((e) => t.kind === "main-canvas" ? e.kind === "main-canvas" : e.kind === "sub-canvas" && e.canvasId === t.id), r = n !== void 0, i = r && e.selection.nodes.includes(n.id), a = r ? `data-blueprint-select-node="${T(n.id)}"` : `data-blueprint-add-canvas="${T(t.id)}"`, o = r ? X.locateCanvas(t.name) : X.addCanvasNode(t.name), s = r ? "" : ` draggable="true" data-blueprint-drag-kind="${t.kind}"${t.kind === "sub-canvas" ? ` data-canvas-id="${T(t.id)}"` : ""} data-blueprint-drag-label="${T(t.name)}"`;
|
|
2126
|
+
return `<div class="designer-list-row blueprint-palette-item" data-density="default" data-placed="${String(r)}" data-selected="${String(i)}" data-node-kind="${t.kind}"${s}>
|
|
2127
|
+
<button type="button" class="blueprint-palette-primary" ${a} aria-label="${T(o)}" data-tip="${T(o)}">
|
|
2128
|
+
<span class="blueprint-palette-glyph" aria-hidden="true">${k(t.icon)}</span>
|
|
2129
|
+
<span class="blueprint-palette-copy"><strong>${_(t.name)}</strong><small>${_(t.detail)}</small></span>
|
|
2130
|
+
<span class="blueprint-palette-state" aria-hidden="true">${k(r ? "check" : "plus")}</span>
|
|
2131
|
+
</button>
|
|
2132
|
+
</div>`;
|
|
2133
|
+
}).join("");
|
|
2134
|
+
return `<section class="blueprint-palette-group" aria-label="${X.canvases}">
|
|
2135
|
+
<header><strong>${X.canvases}</strong><span>${r.length}</span></header>
|
|
2136
|
+
<div class="blueprint-palette-list">${i || Z(X.noSubCanvases)}</div>
|
|
2137
|
+
</section>`;
|
|
2138
|
+
}
|
|
2139
|
+
function It(e, t) {
|
|
2140
|
+
let n = X.libraryTabs[e], r = e === "components" ? X.layers : e === "relations" ? X.logic : X.globalVariables;
|
|
2141
|
+
return `<button type="button" class="designer-tab blueprint-library-rail-tab" id="designer-blueprint-library-${e}-tab" role="tab" aria-controls="designer-blueprint-library-${e}-panel" aria-selected="${String(e === t)}" tabindex="${e === t ? 0 : -1}" data-blueprint-library-tab="${e}" data-tip="${r}" aria-label="${r}"><span class="rail-tab-glyph" aria-hidden="true">${k(e === "components" ? "layers" : e === "relations" ? "link" : "variable")}</span><span class="rail-tab-label">${n}</span></button>`;
|
|
2142
|
+
}
|
|
2143
|
+
function Lt(e, t) {
|
|
2144
|
+
let n = e.id === t, r = x(e.id), i = T(e.label);
|
|
2145
|
+
return `<button type="button" class="designer-tab blueprint-library-rail-tab" id="${oe(e.id)}" role="tab" aria-controls="${ie(e.id)}" aria-selected="${String(n)}" tabindex="${n ? 0 : -1}" data-blueprint-library-tab="${r}" data-host-left-panel-group="${T(e.id)}" data-host-left-panel-mode="blueprint" data-tip="${i}" aria-label="${i}"><span class="rail-tab-glyph" aria-hidden="true">${k(e.icon ?? "shapes")}</span><span class="rail-tab-label">${_(e.label)}</span></button>`;
|
|
2146
|
+
}
|
|
2147
|
+
function Rt(e) {
|
|
2148
|
+
return e === "components" || e === "relations" || e === "variables";
|
|
2149
|
+
}
|
|
2150
|
+
function Z(e) {
|
|
2151
|
+
return `<div class="designer-empty"><span class="designer-empty-icon" aria-hidden="true">${k("search")}</span><p class="designer-empty-title">${e}</p></div>`;
|
|
2152
|
+
}
|
|
2153
|
+
//#endregion
|
|
2154
|
+
//#region src/browser/controllers/blueprint/designer-blueprint-panel-tabs.ts
|
|
2155
|
+
function zt(e, t) {
|
|
2156
|
+
if (e === void 0) return !1;
|
|
2157
|
+
if (Rt(e)) return !0;
|
|
2158
|
+
let n = C(e);
|
|
2159
|
+
return n !== void 0 && t?.some((e) => e.id === n && E(e, "blueprint")) === !0;
|
|
2160
|
+
}
|
|
2161
|
+
function Bt(e) {
|
|
2162
|
+
return e === "configuration" || e === "problems" || e === "trace";
|
|
2163
|
+
}
|
|
2164
|
+
//#endregion
|
|
2165
|
+
//#region src/browser/controllers/blueprint/designer-blueprint-panels-controller.ts
|
|
2166
|
+
var Vt = /* @__PURE__ */ new Set([
|
|
2167
|
+
"eq",
|
|
2168
|
+
"neq",
|
|
2169
|
+
"gt",
|
|
2170
|
+
"gte",
|
|
2171
|
+
"lt",
|
|
2172
|
+
"lte",
|
|
2173
|
+
"contains",
|
|
2174
|
+
"exists"
|
|
2175
|
+
]), Ht = /^[A-Za-z_][A-Za-z0-9_]{0,127}$/, Ut = class {
|
|
2176
|
+
callbacks;
|
|
2177
|
+
#e;
|
|
2178
|
+
#t;
|
|
2179
|
+
#n = "";
|
|
2180
|
+
#r = "components";
|
|
2181
|
+
#i = "configuration";
|
|
2182
|
+
constructor(e) {
|
|
2183
|
+
this.callbacks = e;
|
|
2184
|
+
}
|
|
2185
|
+
connect(e) {
|
|
2186
|
+
this.#e = e.querySelector("[data-blueprint-library]") ?? void 0, this.#t = e.querySelector("[data-blueprint-inspector]") ?? void 0;
|
|
2187
|
+
}
|
|
2188
|
+
release() {
|
|
2189
|
+
this.#e = void 0, this.#t = void 0;
|
|
2190
|
+
}
|
|
2191
|
+
reset() {
|
|
2192
|
+
this.#n = "", this.#r = "components", this.#i = "configuration";
|
|
2193
|
+
}
|
|
2194
|
+
showTrace() {
|
|
2195
|
+
this.#i = "trace";
|
|
2196
|
+
}
|
|
2197
|
+
get selectedLeftPanelGroupId() {
|
|
2198
|
+
return C(this.#r);
|
|
2199
|
+
}
|
|
2200
|
+
selectLeftPanelGroup(e) {
|
|
2201
|
+
let t = this.blueprintHostGroup(e);
|
|
2202
|
+
return t !== void 0 && (this.#r = x(t.id), this.callbacks.expandLeftPanel(), this.render(), !0);
|
|
2203
|
+
}
|
|
2204
|
+
refreshLeftPanelGroups() {
|
|
2205
|
+
this.reconcileLibraryTab();
|
|
2206
|
+
}
|
|
2207
|
+
render() {
|
|
2208
|
+
let e = this.hasLibraryTabFocus();
|
|
2209
|
+
this.reconcileLibraryTab();
|
|
2210
|
+
let t = this.callbacks.getDocument(), n = this.callbacks.getGraph(), r = this.callbacks.getSelection(), i = t === void 0 ? [] : Te(t, this.callbacks.getCatalog(), this.callbacks.getRuntimeContributions());
|
|
2211
|
+
At(this.#e, {
|
|
2212
|
+
document: t,
|
|
2213
|
+
graph: n,
|
|
2214
|
+
components: i,
|
|
2215
|
+
variables: t === void 0 ? [] : Ee(t, O.blueprint),
|
|
2216
|
+
selection: r,
|
|
2217
|
+
query: this.#n,
|
|
2218
|
+
activeTab: this.#r,
|
|
2219
|
+
groups: this.callbacks.getLeftPanelGroups()
|
|
2220
|
+
}), St(this.#t, t, n, r, this.#i, this.callbacks.getDiagnostics(), this.callbacks.getTrace(), this.callbacks.getCatalog()), this.#e !== void 0 && v(this.#e), this.#t !== void 0 && v(this.#t), this.callbacks.getMode() === "blueprint" && this.#e !== void 0 && (ct(this.#e.getRootNode(), this.blueprintHostGroup(this.selectedLeftPanelGroupId), n.nodes.length), this.callbacks.onActiveLeftPanelGroupChange()), e && this.#e?.querySelector(`[data-blueprint-library-tab="${this.#r}"]`)?.focus();
|
|
2221
|
+
}
|
|
2222
|
+
onClick(e) {
|
|
2223
|
+
let t = e.closest("[data-blueprint-library-tab]")?.dataset.blueprintLibraryTab;
|
|
2224
|
+
if (zt(t, this.callbacks.getLeftPanelGroups())) return this.#r = t, this.callbacks.expandLeftPanel(), this.render(), this.#e?.querySelector(`[data-blueprint-library-tab="${t}"]`)?.focus(), !0;
|
|
2225
|
+
let n = e.closest("[data-blueprint-inspector-tab]")?.dataset.blueprintInspectorTab;
|
|
2226
|
+
if (Bt(n)) return this.#i = n, this.render(), this.#t?.querySelector(`[data-blueprint-inspector-tab="${n}"]`)?.focus(), !0;
|
|
2227
|
+
let r = e.closest("[data-blueprint-select-node], [data-blueprint-select-edge], [data-blueprint-add-component], [data-blueprint-add-variable], [data-blueprint-add-canvas], [data-blueprint-insert-node], [data-blueprint-delete], [data-blueprint-nodes-enabled], [data-blueprint-edge-order], [data-blueprint-clear-trace]");
|
|
2228
|
+
if (r === null) return !1;
|
|
2229
|
+
let i = r.dataset;
|
|
2230
|
+
if (i.blueprintSelectNode !== void 0) return this.callbacks.select({
|
|
2231
|
+
nodes: [i.blueprintSelectNode],
|
|
2232
|
+
edges: []
|
|
2233
|
+
}, !0), !0;
|
|
2234
|
+
if (i.blueprintSelectEdge !== void 0) return this.callbacks.select({
|
|
2235
|
+
nodes: [],
|
|
2236
|
+
edges: [i.blueprintSelectEdge]
|
|
2237
|
+
}, !0), !0;
|
|
2238
|
+
if (i.blueprintAddComponent !== void 0) return this.insert({
|
|
2239
|
+
kind: "component",
|
|
2240
|
+
componentId: i.blueprintAddComponent
|
|
2241
|
+
}), !0;
|
|
2242
|
+
if (i.blueprintAddVariable !== void 0) return this.insert({
|
|
2243
|
+
kind: "variable",
|
|
2244
|
+
variableId: i.blueprintAddVariable
|
|
2245
|
+
}), !0;
|
|
2246
|
+
if (i.blueprintAddCanvas !== void 0) return this.insert(i.blueprintAddCanvas === "" ? { kind: "main-canvas" } : {
|
|
2247
|
+
kind: "sub-canvas",
|
|
2248
|
+
canvasId: i.blueprintAddCanvas
|
|
2249
|
+
}), !0;
|
|
2250
|
+
let a = i.blueprintInsertNode;
|
|
2251
|
+
if (a === "host" || a === "lifecycle" || a === "timer" || a === "condition") return this.insert({ kind: a }), !0;
|
|
2252
|
+
if (i.blueprintClearTrace !== void 0) return this.callbacks.clearTrace(), !0;
|
|
2253
|
+
let o = this.callbacks.getDocument();
|
|
2254
|
+
if (o === void 0) return !0;
|
|
2255
|
+
if (i.blueprintDelete !== void 0) {
|
|
2256
|
+
let e = this.callbacks.commitBlueprint(S(o.blueprint, this.callbacks.getSelection()));
|
|
2257
|
+
return e.ok && this.callbacks.select(h, !1), this.report(e), !0;
|
|
2258
|
+
}
|
|
2259
|
+
if (i.blueprintNodesEnabled !== void 0) return this.report(this.callbacks.commitBlueprint(p(o.blueprint, new Set(this.callbacks.getSelection().nodes), i.blueprintNodesEnabled === "true"))), !0;
|
|
2260
|
+
let s = i.blueprintEdgeOrder;
|
|
2261
|
+
return (s === "earlier" || s === "later") && i.edgeId !== void 0 && this.report(this.callbacks.commitBlueprint(f(o.blueprint, i.edgeId, s))), !0;
|
|
2262
|
+
}
|
|
2263
|
+
onDragStart(e) {
|
|
2264
|
+
let t = (e.target instanceof Element ? e.target : null)?.closest("[data-blueprint-drag-kind]"), n = e.dataTransfer;
|
|
2265
|
+
if (t == null || n === null) return !1;
|
|
2266
|
+
let r = t.dataset.blueprintDragKind, i;
|
|
2267
|
+
return r === "component" && t.dataset.componentId !== void 0 ? i = {
|
|
2268
|
+
kind: r,
|
|
2269
|
+
componentId: t.dataset.componentId
|
|
2270
|
+
} : r === "variable" && t.dataset.variableId !== void 0 ? i = {
|
|
2271
|
+
kind: r,
|
|
2272
|
+
variableId: t.dataset.variableId
|
|
2273
|
+
} : r === "sub-canvas" && t.dataset.canvasId !== void 0 ? i = {
|
|
2274
|
+
kind: r,
|
|
2275
|
+
canvasId: t.dataset.canvasId
|
|
2276
|
+
} : (r === "main-canvas" || r === "host" || r === "lifecycle" || r === "timer" || r === "condition") && (i = { kind: r }), i !== void 0 && (n.effectAllowed = "copy", n.setData(m, JSON.stringify(i)), n.setData("text/plain", t.dataset.blueprintDragLabel ?? i.kind), !0);
|
|
2277
|
+
}
|
|
2278
|
+
onKeyDown(e) {
|
|
2279
|
+
let t = e.target?.closest("[data-blueprint-library-tab], [data-blueprint-inspector-tab]");
|
|
2280
|
+
if (t == null || ![
|
|
2281
|
+
"ArrowLeft",
|
|
2282
|
+
"ArrowRight",
|
|
2283
|
+
"ArrowUp",
|
|
2284
|
+
"ArrowDown",
|
|
2285
|
+
"Home",
|
|
2286
|
+
"End"
|
|
2287
|
+
].includes(e.key)) return !1;
|
|
2288
|
+
e.preventDefault();
|
|
2289
|
+
let n = t.dataset.blueprintLibraryTab === void 0 ? "[data-blueprint-inspector-tab]" : "[data-blueprint-library-tab]", r = [...(t.dataset.blueprintLibraryTab === void 0 ? this.#t : this.#e)?.querySelectorAll(n) ?? []];
|
|
2290
|
+
if (r.length === 0) return !0;
|
|
2291
|
+
let i = r.indexOf(t);
|
|
2292
|
+
return (e.key === "Home" ? r[0] : e.key === "End" ? r.at(-1) : r[(i + (e.key === "ArrowRight" || e.key === "ArrowDown" ? 1 : -1) + r.length) % r.length])?.click(), !0;
|
|
2293
|
+
}
|
|
2294
|
+
onInput(e) {
|
|
2295
|
+
let t = e.closest("[data-blueprint-library-search]");
|
|
2296
|
+
if (t === null) return !1;
|
|
2297
|
+
this.#n = t.value, this.render();
|
|
2298
|
+
let n = this.#e?.querySelector("[data-blueprint-library-search]");
|
|
2299
|
+
return n?.focus(), n?.setSelectionRange(n.value.length, n.value.length), !0;
|
|
2300
|
+
}
|
|
2301
|
+
onChange(e) {
|
|
2302
|
+
let t = this.callbacks.getDocument(), n = e, r = e.closest("[data-blueprint-expression]");
|
|
2303
|
+
if (r !== null) return t !== void 0 && this.changeExpression(t, r, n), !0;
|
|
2304
|
+
let i = n.dataset.blueprintNodeField, a = n.dataset.nodeId;
|
|
2305
|
+
if (i !== void 0 && a !== void 0) {
|
|
2306
|
+
let e = n instanceof HTMLInputElement && n.type === "checkbox" ? String(n.checked) : n.value;
|
|
2307
|
+
return t !== void 0 && this.changeNode(t, a, i, e), !0;
|
|
2308
|
+
}
|
|
2309
|
+
let o = n.dataset.blueprintEdgeField, s = n.dataset.edgeId;
|
|
2310
|
+
if (o !== void 0 && s !== void 0) {
|
|
2311
|
+
let e = n instanceof HTMLInputElement && n.type === "checkbox" ? String(n.checked) : n.value;
|
|
2312
|
+
return t !== void 0 && this.changeEdge(t, s, o, e), !0;
|
|
2313
|
+
}
|
|
2314
|
+
return !1;
|
|
2315
|
+
}
|
|
2316
|
+
insert(e) {
|
|
2317
|
+
let t = this.callbacks.getDocument();
|
|
2318
|
+
if (t === void 0) return;
|
|
2319
|
+
let n = D(t, e);
|
|
2320
|
+
if (n === null) {
|
|
2321
|
+
this.report({
|
|
2322
|
+
ok: !1,
|
|
2323
|
+
diagnostics: [{
|
|
2324
|
+
severity: "error",
|
|
2325
|
+
code: "AUTHORING_REQUEST_INVALID",
|
|
2326
|
+
path: [],
|
|
2327
|
+
message: O.blueprint.invalidCommand
|
|
2328
|
+
}]
|
|
2329
|
+
});
|
|
2330
|
+
return;
|
|
2331
|
+
}
|
|
2332
|
+
let r = n.created ? this.callbacks.commitBlueprint(n.blueprint) : {
|
|
2333
|
+
ok: !0,
|
|
2334
|
+
value: t,
|
|
2335
|
+
diagnostics: []
|
|
2336
|
+
};
|
|
2337
|
+
r.ok && this.callbacks.select({
|
|
2338
|
+
nodes: [n.nodeId],
|
|
2339
|
+
edges: []
|
|
2340
|
+
}, !0), this.report(r);
|
|
2341
|
+
}
|
|
2342
|
+
changeNode(e, t, n, r) {
|
|
2343
|
+
let i = a(e.blueprint, t);
|
|
2344
|
+
if (i === void 0) return;
|
|
2345
|
+
let s = null;
|
|
2346
|
+
if (n === "name") s = o(e.blueprint, t, {
|
|
2347
|
+
type: "name",
|
|
2348
|
+
name: r
|
|
2349
|
+
});
|
|
2350
|
+
else if (n === "enabled") s = o(e.blueprint, t, {
|
|
2351
|
+
type: "enabled",
|
|
2352
|
+
enabled: r === "true"
|
|
2353
|
+
});
|
|
2354
|
+
else if (n === "interval") s = o(e.blueprint, t, {
|
|
2355
|
+
type: "interval",
|
|
2356
|
+
intervalSeconds: Number(r)
|
|
2357
|
+
});
|
|
2358
|
+
else if (n === "operator" && i.kind === "condition" && Vt.has(r)) {
|
|
2359
|
+
let n = r, a = n === "exists" ? {
|
|
2360
|
+
left: i.condition.left,
|
|
2361
|
+
operator: n
|
|
2362
|
+
} : {
|
|
2363
|
+
left: i.condition.left,
|
|
2364
|
+
operator: n,
|
|
2365
|
+
right: i.condition.right ?? {
|
|
2366
|
+
kind: "literal",
|
|
2367
|
+
value: null
|
|
2368
|
+
}
|
|
2369
|
+
};
|
|
2370
|
+
s = o(e.blueprint, t, {
|
|
2371
|
+
type: "condition",
|
|
2372
|
+
condition: a
|
|
2373
|
+
});
|
|
2374
|
+
}
|
|
2375
|
+
this.commitOrRestore(s);
|
|
2376
|
+
}
|
|
2377
|
+
changeEdge(e, t, i, a) {
|
|
2378
|
+
let o = n(e.blueprint, t);
|
|
2379
|
+
if (o === void 0) return;
|
|
2380
|
+
let s = null;
|
|
2381
|
+
if (i === "role" && (a === "related" || a === "detail" || a === "group" || a === "drill-down")) s = r(e.blueprint, t, {
|
|
2382
|
+
type: "role",
|
|
2383
|
+
role: a
|
|
2384
|
+
});
|
|
2385
|
+
else if (i === "target-port") {
|
|
2386
|
+
let n = e.blueprint.nodes.find((e) => e.id === o.to.node), i = n?.kind === "component" ? e.components.find((e) => e.id === n.componentId)?.states?.items[0]?.id : void 0;
|
|
2387
|
+
s = r(e.blueprint, t, {
|
|
2388
|
+
type: "target-port",
|
|
2389
|
+
port: a,
|
|
2390
|
+
...i === void 0 ? {} : { stateId: i }
|
|
2391
|
+
});
|
|
2392
|
+
} else if (i === "state" && o.kind === "flow") s = r(e.blueprint, t, {
|
|
2393
|
+
type: "state",
|
|
2394
|
+
stateId: a
|
|
2395
|
+
});
|
|
2396
|
+
else if (i === "host-event" && Ht.test(a.trim())) s = r(e.blueprint, t, {
|
|
2397
|
+
type: "target-port",
|
|
2398
|
+
port: `event:${a.trim()}`
|
|
2399
|
+
});
|
|
2400
|
+
else if (i === "payload-enabled" && o.kind === "flow") s = r(e.blueprint, t, {
|
|
2401
|
+
type: "payload",
|
|
2402
|
+
payload: a === "true" ? {
|
|
2403
|
+
kind: "event-payload",
|
|
2404
|
+
path: []
|
|
2405
|
+
} : null
|
|
2406
|
+
});
|
|
2407
|
+
else if (i === "transition-effect" && o.kind === "flow") s = r(e.blueprint, t, {
|
|
2408
|
+
type: "transition",
|
|
2409
|
+
transition: a === "appear" || a === "fade" || a === "slide-up" ? {
|
|
2410
|
+
effect: a,
|
|
2411
|
+
durationMs: o.transition?.durationMs ?? 200,
|
|
2412
|
+
easing: o.transition?.easing ?? "ease-in-out-quad"
|
|
2413
|
+
} : null
|
|
2414
|
+
});
|
|
2415
|
+
else if (i === "transition-duration" && o.kind === "flow" && o.transition !== void 0) {
|
|
2416
|
+
let n = Number(a);
|
|
2417
|
+
Number.isInteger(n) && n >= 0 && n <= 1e4 && (s = r(e.blueprint, t, {
|
|
2418
|
+
type: "transition",
|
|
2419
|
+
transition: {
|
|
2420
|
+
...o.transition,
|
|
2421
|
+
durationMs: n
|
|
2422
|
+
}
|
|
2423
|
+
}));
|
|
2424
|
+
}
|
|
2425
|
+
this.commitOrRestore(s);
|
|
2426
|
+
}
|
|
2427
|
+
changeExpression(e, t, n) {
|
|
2428
|
+
let i = t.dataset.blueprintExpression, s = t.dataset.expressionOwner, c = t.dataset.expressionOwnerId;
|
|
2429
|
+
if (i === void 0 || c === void 0) return;
|
|
2430
|
+
let l = n.dataset.expressionPart, u;
|
|
2431
|
+
if (l === "source") {
|
|
2432
|
+
let t = n.value;
|
|
2433
|
+
if (t === "literal") u = {
|
|
2434
|
+
kind: "literal",
|
|
2435
|
+
value: null
|
|
2436
|
+
};
|
|
2437
|
+
else if (t === "event") u = {
|
|
2438
|
+
kind: "event-payload",
|
|
2439
|
+
path: []
|
|
2440
|
+
};
|
|
2441
|
+
else if (t === "event-field") u = {
|
|
2442
|
+
kind: "event-payload",
|
|
2443
|
+
path: (s === "edge" ? ot(e, c, this.callbacks.getCatalog()) : [])[0] ?? ["value"]
|
|
2444
|
+
};
|
|
2445
|
+
else if (t === "variable") {
|
|
2446
|
+
let t = A(e)[0];
|
|
2447
|
+
t !== void 0 && (u = {
|
|
2448
|
+
kind: "variable",
|
|
2449
|
+
variableId: t.id
|
|
2450
|
+
});
|
|
2451
|
+
}
|
|
2452
|
+
} else if (l === "literal") try {
|
|
2453
|
+
let e = ge(JSON.parse(n.value));
|
|
2454
|
+
e.ok && (u = {
|
|
2455
|
+
kind: "literal",
|
|
2456
|
+
value: e.value
|
|
2457
|
+
});
|
|
2458
|
+
} catch {
|
|
2459
|
+
u = void 0;
|
|
2460
|
+
}
|
|
2461
|
+
else if (l === "field") {
|
|
2462
|
+
let e = it(n.value);
|
|
2463
|
+
e !== null && (u = {
|
|
2464
|
+
kind: "event-payload",
|
|
2465
|
+
path: e
|
|
2466
|
+
});
|
|
2467
|
+
} else l === "variable" && (u = {
|
|
2468
|
+
kind: "variable",
|
|
2469
|
+
variableId: n.value
|
|
2470
|
+
});
|
|
2471
|
+
if (u === void 0) {
|
|
2472
|
+
this.report({
|
|
2473
|
+
ok: !1,
|
|
2474
|
+
diagnostics: [{
|
|
2475
|
+
severity: "error",
|
|
2476
|
+
code: "AUTHORING_REQUEST_INVALID",
|
|
2477
|
+
path: [],
|
|
2478
|
+
message: l === "field" ? O.blueprint.eventFieldInvalid : O.blueprint.graph.simulation.invalidPayload
|
|
2479
|
+
}]
|
|
2480
|
+
}), this.render();
|
|
2481
|
+
return;
|
|
2482
|
+
}
|
|
2483
|
+
let d = null;
|
|
2484
|
+
if (s === "edge" && (i === "value" || i === "payload")) d = r(e.blueprint, c, i === "value" ? {
|
|
2485
|
+
type: "value",
|
|
2486
|
+
value: u
|
|
2487
|
+
} : {
|
|
2488
|
+
type: "payload",
|
|
2489
|
+
payload: u
|
|
2490
|
+
});
|
|
2491
|
+
else if (s === "node" && (i === "left" || i === "right")) {
|
|
2492
|
+
let t = a(e.blueprint, c);
|
|
2493
|
+
t?.kind === "condition" && (d = o(e.blueprint, c, {
|
|
2494
|
+
type: "condition",
|
|
2495
|
+
condition: {
|
|
2496
|
+
...t.condition,
|
|
2497
|
+
[i]: u
|
|
2498
|
+
}
|
|
2499
|
+
}));
|
|
2500
|
+
}
|
|
2501
|
+
this.commitOrRestore(d);
|
|
2502
|
+
}
|
|
2503
|
+
commitOrRestore(e) {
|
|
2504
|
+
if (e === null) {
|
|
2505
|
+
this.render();
|
|
2506
|
+
return;
|
|
2507
|
+
}
|
|
2508
|
+
let t = this.callbacks.commitBlueprint(e);
|
|
2509
|
+
t.ok || this.render(), this.report(t);
|
|
2510
|
+
}
|
|
2511
|
+
report(e) {
|
|
2512
|
+
e.ok || this.callbacks.emitDiagnostics(e.diagnostics);
|
|
2513
|
+
}
|
|
2514
|
+
reconcileLibraryTab() {
|
|
2515
|
+
let e = this.selectedLeftPanelGroupId;
|
|
2516
|
+
e !== void 0 && this.blueprintHostGroup(e) === void 0 && (this.#r = "components");
|
|
2517
|
+
}
|
|
2518
|
+
hasLibraryTabFocus() {
|
|
2519
|
+
return (this.#e?.getRootNode())?.activeElement?.closest("[data-blueprint-library-tab]") != null;
|
|
2520
|
+
}
|
|
2521
|
+
blueprintHostGroup(e) {
|
|
2522
|
+
if (e !== void 0) return this.callbacks.getLeftPanelGroups()?.find((t) => t.id === e && E(t, "blueprint"));
|
|
2523
|
+
}
|
|
2524
|
+
}, Wt = Object.freeze({
|
|
2525
|
+
nodes: Object.freeze([]),
|
|
2526
|
+
edges: Object.freeze([])
|
|
2527
|
+
}), Gt = class {
|
|
2528
|
+
callbacks;
|
|
2529
|
+
#e;
|
|
2530
|
+
#t;
|
|
2531
|
+
#n;
|
|
2532
|
+
#r;
|
|
2533
|
+
#i = "canvas";
|
|
2534
|
+
#a = h;
|
|
2535
|
+
#o = !0;
|
|
2536
|
+
#s;
|
|
2537
|
+
#c = 0;
|
|
2538
|
+
#l;
|
|
2539
|
+
#u;
|
|
2540
|
+
#d;
|
|
2541
|
+
#f = () => this.resolveCanvas();
|
|
2542
|
+
constructor(e) {
|
|
2543
|
+
this.callbacks = e, this.#u = new $e({
|
|
2544
|
+
getDocument: e.getDocument,
|
|
2545
|
+
getGraph: () => this.graph,
|
|
2546
|
+
getMode: () => this.#i,
|
|
2547
|
+
getSelection: () => this.#a,
|
|
2548
|
+
getShowSemantic: () => this.#o,
|
|
2549
|
+
getViewRequest: () => this.#s,
|
|
2550
|
+
getCatalog: e.getCatalog,
|
|
2551
|
+
getRuntimeContributions: e.getRuntimeContributions,
|
|
2552
|
+
getDocumentRevision: e.getDocumentRevision,
|
|
2553
|
+
getProjectRevision: e.getProjectRevision,
|
|
2554
|
+
canUndo: e.canUndo,
|
|
2555
|
+
canRedo: e.canRedo,
|
|
2556
|
+
select: (e, t) => this.select(e, t),
|
|
2557
|
+
executeCommand: e.executeCommand,
|
|
2558
|
+
undo: e.undo,
|
|
2559
|
+
redo: e.redo,
|
|
2560
|
+
render: () => this.render(),
|
|
2561
|
+
emitDiagnostics: e.emitDiagnostics,
|
|
2562
|
+
onSimulated: () => this.#d.showTrace()
|
|
2563
|
+
}), this.#d = new Ut({
|
|
2564
|
+
getDocument: e.getDocument,
|
|
2565
|
+
getGraph: () => this.graph,
|
|
2566
|
+
getCatalog: e.getCatalog,
|
|
2567
|
+
getRuntimeContributions: e.getRuntimeContributions,
|
|
2568
|
+
getSelection: () => this.#a,
|
|
2569
|
+
getShowSemantic: () => this.#o,
|
|
2570
|
+
setShowSemantic: (e) => {
|
|
2571
|
+
this.#o = e, this.render();
|
|
2572
|
+
},
|
|
2573
|
+
requestView: (e) => {
|
|
2574
|
+
this.#s = {
|
|
2575
|
+
id: ++this.#c,
|
|
2576
|
+
type: e
|
|
2577
|
+
}, this.render();
|
|
2578
|
+
},
|
|
2579
|
+
simulate: (e, t, n) => this.#u.simulate(e, t, n),
|
|
2580
|
+
clearTrace: () => {
|
|
2581
|
+
this.#u.clearTrace(), this.render();
|
|
2582
|
+
},
|
|
2583
|
+
getDiagnostics: () => this.#u.stateDiagnostics(),
|
|
2584
|
+
getTrace: () => this.#u.trace,
|
|
2585
|
+
getLeftPanelGroups: e.getLeftPanelGroups,
|
|
2586
|
+
getMode: () => this.#i,
|
|
2587
|
+
select: (t, n) => {
|
|
2588
|
+
let r = this.select(t, n);
|
|
2589
|
+
r.ok || e.emitDiagnostics(r.diagnostics);
|
|
2590
|
+
},
|
|
2591
|
+
commitBlueprint: (e) => this.#u.commitBlueprint(e),
|
|
2592
|
+
expandLeftPanel: e.expandLeftPanel,
|
|
2593
|
+
onActiveLeftPanelGroupChange: e.onActiveLeftPanelGroupChange,
|
|
2594
|
+
emitDiagnostics: e.emitDiagnostics
|
|
2595
|
+
});
|
|
2596
|
+
}
|
|
2597
|
+
get mode() {
|
|
2598
|
+
return this.#i;
|
|
2599
|
+
}
|
|
2600
|
+
get available() {
|
|
2601
|
+
return this.#u.canvas !== void 0;
|
|
2602
|
+
}
|
|
2603
|
+
get selectedLeftPanelGroupId() {
|
|
2604
|
+
return this.#d.selectedLeftPanelGroupId;
|
|
2605
|
+
}
|
|
2606
|
+
setInitialMode(e) {
|
|
2607
|
+
this.#i = e;
|
|
2608
|
+
}
|
|
2609
|
+
connect(e) {
|
|
2610
|
+
if (this.#e === e) {
|
|
2611
|
+
this.bindSlot(e.querySelector("[data-blueprint-canvas-slot]") ?? void 0), this.#n = e.querySelector("[data-blueprint-default-canvas]") ?? void 0, this.mountDefaultCanvas(), this.#d.connect(e), this.resolveCanvas(), this.render();
|
|
2612
|
+
return;
|
|
2613
|
+
}
|
|
2614
|
+
this.disconnect(), this.#e = e, this.bindSlot(e.querySelector("[data-blueprint-canvas-slot]") ?? void 0), this.#n = e.querySelector("[data-blueprint-default-canvas]") ?? void 0, this.mountDefaultCanvas(), this.#d.connect(e), this.#u.connect(this.callbacks.getHost()), this.resolveCanvas(), this.render();
|
|
2615
|
+
}
|
|
2616
|
+
bindSlot(e) {
|
|
2617
|
+
this.#t !== e && (this.#t?.removeEventListener("slotchange", this.#f), this.#t = e, this.#t?.addEventListener("slotchange", this.#f));
|
|
2618
|
+
}
|
|
2619
|
+
disconnect() {
|
|
2620
|
+
this.#t?.removeEventListener("slotchange", this.#f), this.#u.disconnect(), this.#d.release(), this.#r?.destroy(), this.#r?.element.remove(), this.#r = void 0, this.#n = void 0, this.#e = void 0, this.#t = void 0;
|
|
2621
|
+
}
|
|
2622
|
+
addVariableNode(e) {
|
|
2623
|
+
let t = this.callbacks.getDocument();
|
|
2624
|
+
if (t === void 0) return;
|
|
2625
|
+
let n = D(t, {
|
|
2626
|
+
kind: "variable",
|
|
2627
|
+
variableId: e
|
|
2628
|
+
});
|
|
2629
|
+
if (n?.created === !0) {
|
|
2630
|
+
let e = this.callbacks.executeCommand({
|
|
2631
|
+
type: "replace-blueprint",
|
|
2632
|
+
blueprint: n.blueprint
|
|
2633
|
+
});
|
|
2634
|
+
if (!e.ok) {
|
|
2635
|
+
this.callbacks.emitDiagnostics(e.diagnostics);
|
|
2636
|
+
return;
|
|
2637
|
+
}
|
|
2638
|
+
}
|
|
2639
|
+
this.setMode("blueprint", { focus: {
|
|
2640
|
+
kind: "variable",
|
|
2641
|
+
id: e
|
|
2642
|
+
} });
|
|
2643
|
+
}
|
|
2644
|
+
resetSession() {
|
|
2645
|
+
this.#a = h, this.#o = !0, this.#s = void 0, this.#d.reset(), this.#u.reset(), this.render();
|
|
2646
|
+
}
|
|
2647
|
+
selectLeftPanelGroup(e) {
|
|
2648
|
+
return this.#i === "blueprint" && this.#d.selectLeftPanelGroup(e);
|
|
2649
|
+
}
|
|
2650
|
+
refreshLeftPanelGroups() {
|
|
2651
|
+
this.#d.refreshLeftPanelGroups(), this.render();
|
|
2652
|
+
}
|
|
2653
|
+
setMode(e, t = {}, n = "api") {
|
|
2654
|
+
let r = re(e, t);
|
|
2655
|
+
if (!r.ok) return r;
|
|
2656
|
+
if (e === "blueprint" && !this.available) return $("BLUEPRINT_CAPABILITY_UNAVAILABLE", O.blueprint.noHostCanvas);
|
|
2657
|
+
if (t.focus !== void 0) {
|
|
2658
|
+
let e = this.ensureFocusNode(t.focus);
|
|
2659
|
+
if (!e.ok) return e;
|
|
2660
|
+
let n = this.resolveFocus(t.focus);
|
|
2661
|
+
if (n === void 0) return $("AUTHORING_REQUEST_INVALID", O.blueprint.invalidSelection);
|
|
2662
|
+
this.#a = this.graphHasEdge(n) ? {
|
|
2663
|
+
nodes: [],
|
|
2664
|
+
edges: [n]
|
|
2665
|
+
} : {
|
|
2666
|
+
nodes: [n],
|
|
2667
|
+
edges: []
|
|
2668
|
+
}, this.#s = {
|
|
2669
|
+
id: ++this.#c,
|
|
2670
|
+
type: "focus",
|
|
2671
|
+
targetId: n
|
|
2672
|
+
};
|
|
2673
|
+
}
|
|
2674
|
+
let i = this.#i;
|
|
2675
|
+
return this.#i = e, this.render(), i !== e && this.emitModeChange(i, e, n), Q(null);
|
|
2676
|
+
}
|
|
2677
|
+
render() {
|
|
2678
|
+
let e = this.graph;
|
|
2679
|
+
this.reconcileSelection(e), this.renderChrome(), this.callbacks.setWorkbenchAuthoringMode(this.#i), this.#d.render(), this.#u.dispatchState(e), this.callbacks.onActiveLeftPanelGroupChange();
|
|
2680
|
+
}
|
|
2681
|
+
dispatchState() {
|
|
2682
|
+
this.#u.dispatchState();
|
|
2683
|
+
}
|
|
2684
|
+
onClick(e) {
|
|
2685
|
+
let t = e.closest("[data-workbench-mode-tab]");
|
|
2686
|
+
if (t !== null) {
|
|
2687
|
+
let e = t.dataset.workbenchModeTab;
|
|
2688
|
+
if (e === "canvas" || e === "blueprint") {
|
|
2689
|
+
let t = this.setMode(e, {}, "user");
|
|
2690
|
+
t.ok || this.callbacks.emitDiagnostics(t.diagnostics);
|
|
2691
|
+
}
|
|
2692
|
+
return !0;
|
|
2693
|
+
}
|
|
2694
|
+
let n = e.closest("[data-blueprint-search-id]")?.dataset.blueprintSearchId;
|
|
2695
|
+
if (n !== void 0) {
|
|
2696
|
+
let e = qt(n), t = e === void 0 ? $("AUTHORING_REQUEST_INVALID", O.blueprint.invalidSelection) : this.focusOrInsert(e);
|
|
2697
|
+
return t.ok || this.callbacks.emitDiagnostics(t.diagnostics), !0;
|
|
2698
|
+
}
|
|
2699
|
+
return this.#d.onClick(e);
|
|
2700
|
+
}
|
|
2701
|
+
onInput(e) {
|
|
2702
|
+
return this.#d.onInput(e);
|
|
2703
|
+
}
|
|
2704
|
+
onChange(e) {
|
|
2705
|
+
return this.#d.onChange(e);
|
|
2706
|
+
}
|
|
2707
|
+
onDragStart(e) {
|
|
2708
|
+
return this.#d.onDragStart(e);
|
|
2709
|
+
}
|
|
2710
|
+
onKeyDown(e) {
|
|
2711
|
+
if (this.#d.onKeyDown(e)) return !0;
|
|
2712
|
+
let t = e.target?.closest("[data-workbench-mode-tab]");
|
|
2713
|
+
if (t == null || ![
|
|
2714
|
+
"ArrowLeft",
|
|
2715
|
+
"ArrowRight",
|
|
2716
|
+
"Home",
|
|
2717
|
+
"End"
|
|
2718
|
+
].includes(e.key)) return !1;
|
|
2719
|
+
e.preventDefault();
|
|
2720
|
+
let n = [...this.#e?.querySelectorAll("[data-workbench-mode-tab]:not(:disabled)") ?? []];
|
|
2721
|
+
if (n.length === 0) return !0;
|
|
2722
|
+
let r = n.indexOf(t), i = e.key === "Home" ? n[0] : e.key === "End" ? n.at(-1) : n[(r + (e.key === "ArrowRight" ? 1 : -1) + n.length) % n.length];
|
|
2723
|
+
return i?.focus(), i?.click(), !0;
|
|
2724
|
+
}
|
|
2725
|
+
get graph() {
|
|
2726
|
+
let e = this.callbacks.getDocument();
|
|
2727
|
+
if (e === void 0) return Wt;
|
|
2728
|
+
let t = this.callbacks.getCatalog(), n = this.callbacks.getRuntimeContributions(), r = this.#l;
|
|
2729
|
+
if (r !== void 0 && r.document === e && r.catalog === t && r.contributions === n) return r.graph;
|
|
2730
|
+
let i = De(e, t, n, O.blueprint);
|
|
2731
|
+
return this.#l = {
|
|
2732
|
+
document: e,
|
|
2733
|
+
catalog: t,
|
|
2734
|
+
contributions: n,
|
|
2735
|
+
graph: i
|
|
2736
|
+
}, i;
|
|
2737
|
+
}
|
|
2738
|
+
focusOrInsert(e) {
|
|
2739
|
+
return this.setMode("blueprint", { focus: e }, "user");
|
|
2740
|
+
}
|
|
2741
|
+
ensureFocusNode(e) {
|
|
2742
|
+
let t = this.callbacks.getDocument();
|
|
2743
|
+
if (t !== void 0 && (e.kind === "component" || e.kind === "variable")) {
|
|
2744
|
+
let n = D(t, e.kind === "component" ? {
|
|
2745
|
+
kind: "component",
|
|
2746
|
+
componentId: e.id
|
|
2747
|
+
} : {
|
|
2748
|
+
kind: "variable",
|
|
2749
|
+
variableId: e.id
|
|
2750
|
+
});
|
|
2751
|
+
if (n?.created === !0) {
|
|
2752
|
+
let e = this.callbacks.executeCommand({
|
|
2753
|
+
type: "replace-blueprint",
|
|
2754
|
+
blueprint: n.blueprint
|
|
2755
|
+
});
|
|
2756
|
+
if (!e.ok) return {
|
|
2757
|
+
ok: !1,
|
|
2758
|
+
diagnostics: e.diagnostics
|
|
2759
|
+
};
|
|
2760
|
+
}
|
|
2761
|
+
}
|
|
2762
|
+
return Q(null);
|
|
2763
|
+
}
|
|
2764
|
+
mountDefaultCanvas() {
|
|
2765
|
+
if (this.#r !== void 0 || this.#n === void 0) return;
|
|
2766
|
+
let e = ze(this.#n.ownerDocument);
|
|
2767
|
+
this.#n.append(e.element), this.#r = e;
|
|
2768
|
+
}
|
|
2769
|
+
resolveCanvas() {
|
|
2770
|
+
let e = this.#t?.assignedElements({ flatten: !0 })[0], t = this.#r?.element;
|
|
2771
|
+
t !== void 0 && (t.hidden = e !== void 0), this.#n !== void 0 && (this.#n.hidden = e !== void 0);
|
|
2772
|
+
let n = e ?? t, r = this.#u.canvas;
|
|
2773
|
+
if (!this.#u.setCanvas(n)) {
|
|
2774
|
+
n === void 0 && this.#i === "blueprint" ? this.fallbackToCanvas(!1) : (this.renderChrome(), this.#u.dispatchState());
|
|
2775
|
+
return;
|
|
2776
|
+
}
|
|
2777
|
+
if (n === void 0 && this.#i === "blueprint") {
|
|
2778
|
+
this.fallbackToCanvas(r !== void 0);
|
|
2779
|
+
return;
|
|
2780
|
+
}
|
|
2781
|
+
this.render();
|
|
2782
|
+
}
|
|
2783
|
+
fallbackToCanvas(e) {
|
|
2784
|
+
let t = this.#i;
|
|
2785
|
+
this.#i = "canvas", this.render(), this.emitModeChange(t, "canvas", "fallback"), e && this.callbacks.emitDiagnostics([Kt("BLUEPRINT_CAPABILITY_UNAVAILABLE", O.blueprint.noHostCanvas)]);
|
|
2786
|
+
}
|
|
2787
|
+
select(e, t) {
|
|
2788
|
+
let n = this.graph, r = new Set(n.nodes.map((e) => e.id)), i = new Set(n.edges.map((e) => e.id));
|
|
2789
|
+
if (e.nodes.some((e) => !r.has(e)) || e.edges.some((e) => !i.has(e))) return $("AUTHORING_REQUEST_INVALID", O.blueprint.invalidSelection);
|
|
2790
|
+
this.#a = {
|
|
2791
|
+
nodes: [...e.nodes],
|
|
2792
|
+
edges: [...e.edges]
|
|
2793
|
+
};
|
|
2794
|
+
let a = e.nodes[0] ?? e.edges[0];
|
|
2795
|
+
return t && a !== void 0 && (this.#s = {
|
|
2796
|
+
id: ++this.#c,
|
|
2797
|
+
type: "focus",
|
|
2798
|
+
targetId: a
|
|
2799
|
+
}), this.render(), Q(null);
|
|
2800
|
+
}
|
|
2801
|
+
reconcileSelection(e) {
|
|
2802
|
+
let t = new Set(e.nodes.map((e) => e.id)), n = new Set(e.edges.map((e) => e.id)), r = this.#a.nodes.filter((e) => t.has(e)), i = this.#a.edges.filter((e) => n.has(e));
|
|
2803
|
+
(r.length !== this.#a.nodes.length || i.length !== this.#a.edges.length) && (this.#a = {
|
|
2804
|
+
nodes: r,
|
|
2805
|
+
edges: i
|
|
2806
|
+
});
|
|
2807
|
+
}
|
|
2808
|
+
resolveFocus(e) {
|
|
2809
|
+
let t = this.callbacks.getDocument();
|
|
2810
|
+
if (t !== void 0) return e.kind === "component" ? s(t.blueprint, e.id)?.id : e.kind === "variable" ? d(t.blueprint, e.id)?.id : e.kind === "node" ? t.blueprint.nodes.some((t) => t.id === e.id) ? e.id : void 0 : this.graphHasEdge(e.id) ? e.id : void 0;
|
|
2811
|
+
}
|
|
2812
|
+
graphHasEdge(e) {
|
|
2813
|
+
return this.graph.edges.some((t) => t.id === e);
|
|
2814
|
+
}
|
|
2815
|
+
renderChrome() {
|
|
2816
|
+
let e = this.#e;
|
|
2817
|
+
if (e === void 0) return;
|
|
2818
|
+
let t = this.callbacks.getDocument(), n = this.#u.stateDiagnostics().filter((e) => e.severity === "error").length, r = t?.blueprint.edges ?? [];
|
|
2819
|
+
We(e, this.#i, this.available, {
|
|
2820
|
+
nodes: t?.blueprint.nodes.length ?? 0,
|
|
2821
|
+
relations: r.filter((e) => e.kind === "flow").length,
|
|
2822
|
+
semantic: r.filter((e) => e.kind === "semantic").length,
|
|
2823
|
+
structural: 0,
|
|
2824
|
+
problems: n
|
|
2825
|
+
});
|
|
2826
|
+
}
|
|
2827
|
+
emitModeChange(e, t, n) {
|
|
2828
|
+
this.callbacks.getHost().dispatchEvent(new CustomEvent(se, {
|
|
2829
|
+
bubbles: !0,
|
|
2830
|
+
composed: !0,
|
|
2831
|
+
detail: {
|
|
2832
|
+
previousMode: e,
|
|
2833
|
+
mode: t,
|
|
2834
|
+
reason: n
|
|
2835
|
+
}
|
|
2836
|
+
}));
|
|
2837
|
+
}
|
|
2838
|
+
};
|
|
2839
|
+
function Kt(e, t) {
|
|
2840
|
+
return {
|
|
2841
|
+
severity: "error",
|
|
2842
|
+
code: e,
|
|
2843
|
+
path: [],
|
|
2844
|
+
message: t
|
|
2845
|
+
};
|
|
2846
|
+
}
|
|
2847
|
+
function Q(e) {
|
|
2848
|
+
return {
|
|
2849
|
+
ok: !0,
|
|
2850
|
+
value: e,
|
|
2851
|
+
diagnostics: []
|
|
2852
|
+
};
|
|
2853
|
+
}
|
|
2854
|
+
function $(e, t) {
|
|
2855
|
+
return {
|
|
2856
|
+
ok: !1,
|
|
2857
|
+
diagnostics: [Kt(e, t)]
|
|
2858
|
+
};
|
|
2859
|
+
}
|
|
2860
|
+
function qt(e) {
|
|
2861
|
+
let t = e.indexOf(":");
|
|
2862
|
+
if (t <= 0) return;
|
|
2863
|
+
let n = e.slice(0, t), r = e.slice(t + 1);
|
|
2864
|
+
if (r !== "") return n === "component" || n === "variable" || n === "node" || n === "edge" ? {
|
|
2865
|
+
kind: n,
|
|
2866
|
+
id: r
|
|
2867
|
+
} : void 0;
|
|
2868
|
+
}
|
|
2869
|
+
//#endregion
|
|
2870
|
+
export { Gt as DesignerBlueprintWorkbenchPanel };
|
|
2871
|
+
|
|
2872
|
+
//# sourceMappingURL=designer-blueprint-workbench-panel-CJ3iZo5v.js.map
|