soma-core 2.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -19
- package/bin/codegen.cjs +191 -0
- package/bin/eject.cjs +25 -12
- package/bin/service-codegen.cjs +98 -0
- package/bin/soma-lsp.cjs +140 -23
- package/bin/soma-runtime.cjs +193 -0
- package/bin/soma-sync-runtime.cjs +130 -0
- package/bin/soma.cjs +200 -13
- package/bin/soma.ts +182 -0
- package/core/build/compiler/flat-page.ts +305 -0
- package/core/build/compiler/full-manifest-builder.ts +68 -27
- package/core/build/{blocks → compiler}/html-index.ts +64 -15
- package/core/build/compiler/page-assets.ts +30 -7
- package/core/build/compiler/page-base-resolver.ts +11 -0
- package/core/build/compiler/page-declaration-compiler.ts +265 -226
- package/core/build/compiler/rollup-plugin-soma.ts +7 -2
- package/core/build/compiler/soma-manifest-webpack-plugin.js +114 -229
- package/core/build/compiler/soma-precompile.js +3733 -1892
- package/core/build/compiler/soma-precompile.ts +15 -20
- package/core/build/compiler/soma-rspack-yaml-loader.js +4 -3
- package/core/build/compiler/soma-webpack-loader.js +8 -4
- package/core/build/compiler/vite-plugin-soma.ts +8 -8
- package/core/build/component/component-graph.ts +1 -1
- package/core/build/component-tree/artifact-codec.ts +9 -42
- package/core/build/component-tree/collection-binding-lowerer.ts +1 -1
- package/core/build/component-tree/definition-preparation.ts +4 -5
- package/core/build/component-tree/parser.ts +1 -1
- package/core/build/component-tree/registry-snapshot.ts +45 -10
- package/core/build/component-tree/source-preflight.ts +2 -90
- package/core/build/component-tree/structure-topology.ts +1 -1
- package/core/build/eject/plan-eject.ts +9 -11
- package/core/build/lsp/component-tree-service.ts +4 -1
- package/core/build/lsp/component-tree.cjs +1 -1
- package/core/build/lsp/cross-file-diagnostics.cjs +5 -21
- package/core/build/lsp/soma-declaration.cjs +50 -46
- package/core/build/lsp/std-completion.generated.json +26 -0
- package/core/build/lsp/ui-yaml-completion.cjs +25 -37
- package/core/client/a11y/a11y-config.ts +50 -0
- package/core/client/a11y/announcer.ts +140 -0
- package/core/client/a11y/dom-id.ts +31 -0
- package/core/client/a11y/index.ts +40 -0
- package/core/client/a11y/motion-hook.ts +48 -0
- package/core/client/a11y/motion.ts +95 -0
- package/core/client/base/SomaPageRootBase.ts +44 -2
- package/core/client/base/index.ts +10 -8
- package/core/client/behavior/adapter-collection.ts +65 -0
- package/core/client/behavior/adapter-popper.ts +60 -0
- package/core/client/behavior/aria-hide-outside.ts +144 -0
- package/core/client/behavior/css-escape.ts +51 -0
- package/core/client/behavior/focus-scope.ts +433 -0
- package/core/client/behavior/focus-traversal.ts +68 -0
- package/core/client/behavior/index.ts +109 -0
- package/core/client/behavior/layer-stack.ts +234 -0
- package/core/client/behavior/overlay-host/index.ts +192 -0
- package/core/client/behavior/overlay-host/port.ts +76 -0
- package/core/client/behavior/overlay-wiring.ts +186 -0
- package/core/client/behavior/port.ts +85 -0
- package/core/client/behavior/positioner.ts +32 -0
- package/core/client/behavior/presence.ts +197 -0
- package/core/client/behavior/zag/adapter-vanilla.ts +96 -0
- package/core/client/behavior/zag/layer-bridge.ts +51 -0
- package/core/client/behavior/zag/machine-host.ts +69 -0
- package/core/client/behavior/zag/machines.ts +52 -0
- package/core/client/compiler/manifest-compiler.ts +33 -70
- package/core/client/component/adapter/adapt.ts +79 -0
- package/core/client/component/adapter/index.ts +3 -0
- package/core/client/component/adapter/types.ts +37 -0
- package/core/client/component/adapter/web-component.ts +130 -0
- package/core/client/component/component-defaults.ts +1 -1
- package/core/client/component/component-definition.types.ts +27 -5
- package/core/client/component/component-expander.ts +24 -16
- package/core/client/component/component-manager.ts +245 -814
- package/core/client/component/component-pack.ts +58 -216
- package/core/client/component/component-registry.ts +53 -29
- package/core/client/component/projection-admission.ts +63 -0
- package/core/client/component/projection-registry.ts +653 -0
- package/core/client/component/projection.types.ts +48 -0
- package/core/client/component/region-unavailable.ts +37 -0
- package/core/client/component/scoped-adapter.ts +3 -3
- package/core/client/component/structure-adapter.ts +93 -8
- package/core/client/container/IContainerAdapter.ts +4 -3
- package/core/client/container/SomaContainerAdapter.ts +22 -123
- package/core/client/data/collection-payload.ts +2 -0
- package/core/client/data/data-object-resolver.ts +827 -330
- package/core/client/data/data-polling.ts +110 -0
- package/core/client/data/data-subscriptions.ts +98 -0
- package/core/client/data/data-write-actions.ts +118 -0
- package/core/client/data/envelope-failure.ts +48 -0
- package/core/client/data/format-config.ts +62 -0
- package/core/client/data/region-scope-port.ts +265 -0
- package/core/client/data/region-scope-views.ts +96 -0
- package/core/client/data/role-gate.ts +44 -0
- package/core/client/data/write-outcome-store.ts +101 -0
- package/core/client/data/write-outcome.ts +175 -0
- package/core/client/engine/asset-resolver.ts +12 -21
- package/core/client/engine/dom-renderer.ts +85 -460
- package/core/client/engine/event-engine.ts +348 -317
- package/core/client/engine/locale-text-binder.ts +168 -0
- package/core/client/engine/property-watcher.ts +18 -164
- package/core/client/engine/reactive-proxy.ts +23 -194
- package/core/client/engine/render-engine.ts +16 -118
- package/core/client/engine/row-range.ts +11 -0
- package/core/client/engine/runtime-builder.ts +10 -13
- package/core/client/engine/scope-resolver.ts +3 -3
- package/core/client/engine/soma-bootstrap.ts +1246 -323
- package/core/client/engine/step-runner.ts +90 -12
- package/core/client/engine/style-binder.ts +2 -162
- package/core/client/engine/timer-engine.ts +2 -1
- package/core/client/engines/chart/adapter-echarts.ts +144 -0
- package/core/client/engines/chart/echarts-subpaths.d.ts +3 -0
- package/core/client/engines/chart/index.ts +90 -0
- package/core/client/engines/chart/kind-modules.ts +74 -0
- package/core/client/engines/chart/port.ts +44 -0
- package/core/client/engines/diff/adapter-jsdiff.ts +35 -0
- package/core/client/engines/diff/index.ts +33 -0
- package/core/client/engines/diff/port.ts +26 -0
- package/core/client/engines/dnd/adapter-pragmatic.ts +159 -0
- package/core/client/engines/dnd/index.ts +67 -0
- package/core/client/engines/dnd/port.ts +45 -0
- package/core/client/engines/engine-adapters.ts +29 -0
- package/core/client/engines/load.ts +44 -0
- package/core/client/engines/qrcode/adapter-qrcode-generator.ts +52 -0
- package/core/client/engines/qrcode/index.ts +30 -0
- package/core/client/engines/qrcode/port.ts +27 -0
- package/core/client/engines/table/adapter-tanstack.ts +132 -0
- package/core/client/engines/table/index.ts +80 -0
- package/core/client/engines/table/port.ts +55 -0
- package/core/client/engines/temporal/adapter-polyfill.ts +158 -0
- package/core/client/engines/temporal/index.ts +84 -0
- package/core/client/engines/temporal/port.ts +53 -0
- package/core/client/engines/virtual/adapter-tanstack.ts +133 -0
- package/core/client/engines/virtual/index.ts +43 -0
- package/core/client/engines/virtual/port.ts +43 -0
- package/core/client/format/formatter.ts +32 -0
- package/core/client/format/index.ts +26 -0
- package/core/client/format/zoned.ts +10 -0
- package/core/client/host-bridge/index.ts +17 -0
- package/core/client/host-bridge/load-host-domain-class.ts +15 -4
- package/core/client/host-bridge/resolve-host-bootstrap.ts +63 -11
- package/core/client/host-bridge/soma-app-host.stub.ts +3 -0
- package/core/client/host-bridge/soma-bootstrap-from-app.ts +25 -0
- package/core/client/infra/auth/IAuthService.ts +18 -13
- package/core/client/infra/auth/TokenAuthService.ts +126 -112
- package/core/client/infra/config/SomaConfig.ts +16 -0
- package/core/client/infra/config/feature-flags.ts +28 -0
- package/core/client/infra/http/IHttpClient.ts +2 -0
- package/core/client/infra/http/SomaHttpService.ts +1 -0
- package/core/client/infra/i18n/II18n.ts +24 -6
- package/core/client/infra/i18n/builtin-locale.ts +31 -0
- package/core/client/infra/i18n/index.ts +4 -0
- package/core/client/infra/i18n/interpolate.ts +28 -0
- package/core/client/infra/i18n/locale-catalog.ts +230 -0
- package/core/client/infra/i18n/pack-locales.ts +117 -0
- package/core/client/infra/identity/identity-port.ts +178 -0
- package/core/client/infra/notify/DefaultNotifyService.ts +86 -31
- package/core/client/infra/notify/INotifyService.ts +2 -14
- package/core/client/infra/notify/notify-declaration.ts +37 -0
- package/core/client/infra/permission/SomaPermission.ts +58 -48
- package/core/client/infra/router/IRouter.ts +24 -19
- package/core/client/infra/router/SomaRouter.ts +78 -66
- package/core/client/keyboard/collection.ts +197 -0
- package/core/client/keyboard/compose-keys.ts +68 -0
- package/core/client/keyboard/cursor.ts +117 -0
- package/core/client/keyboard/delegate.ts +195 -0
- package/core/client/keyboard/ime.ts +8 -0
- package/core/client/keyboard/index.ts +74 -0
- package/core/client/keyboard/intents.ts +60 -0
- package/core/client/keyboard/matrix.ts +269 -0
- package/core/client/keyboard/submit.ts +30 -0
- package/core/client/keyboard/typeahead.ts +203 -0
- package/core/client/keyboard/wiring.ts +327 -0
- package/core/client/middleware/createPermissionMiddleware.ts +20 -11
- package/core/client/mount/domain-rule.ts +43 -0
- package/core/client/mount/index.ts +3 -0
- package/core/client/mount/mount-page.ts +163 -0
- package/core/client/mount/types.ts +93 -0
- package/core/client/observability/runtime-observer.ts +136 -0
- package/core/client/parser/annotation-extractor.ts +1 -1
- package/core/client/parser/confirm-spec.ts +139 -0
- package/core/client/parser/data-config-parser.ts +416 -217
- package/core/client/parser/duration.ts +2 -16
- package/core/client/parser/page-state-parser.ts +59 -64
- package/core/client/parser/pipeline-parser.ts +178 -236
- package/core/client/parser/style-config-parser.ts +15 -81
- package/core/client/parser/subscribe-parser.ts +83 -0
- package/core/client/parser/timer-parser.ts +1 -1
- package/core/client/parser/trigger-parser.ts +1 -1
- package/core/client/parser/ui-config-parser.ts +247 -243
- package/core/client/pipes/pipe-registry.ts +304 -76
- package/core/client/registry/declaration-renderer.ts +20 -8
- package/core/client/registry/page-lifecycle.ts +4 -4
- package/core/client/registry/remote-page.ts +4 -4
- package/core/client/render-ports/index.ts +18 -0
- package/core/client/render-ports/notify-renderer.ts +45 -0
- package/core/client/render-ports/region-fallback.ts +8 -0
- package/core/client/render-ports/scheduling/prompt-queue.ts +102 -0
- package/core/client/render-ports/scheduling/toast-scheduler.ts +253 -0
- package/core/client/runtime/SomaRuntimeServices.ts +180 -16
- package/core/client/runtime/SomaSnapshotStore.ts +100 -100
- package/core/client/runtime/nav-history.ts +147 -0
- package/core/client/runtime/nav-port.ts +68 -0
- package/core/client/runtime/shortcuts.ts +360 -0
- package/core/client/runtime/write-feedback.ts +71 -0
- package/core/client/runtime-entry.ts +29 -0
- package/core/client/scheduler/SomaScheduler.ts +13 -3
- package/core/client/{adaptive → scheduling}/flush-scheduler.ts +16 -12
- package/core/client/scheduling/index.ts +22 -0
- package/core/client/scheduling/observer-pool.ts +109 -0
- package/core/client/security/attribute-presence.ts +1 -3
- package/core/client/security/html-sanitizer.ts +23 -1
- package/core/client/security/url-guard.ts +0 -0
- package/core/client/styles/compiled-styles.ts +47 -0
- package/core/client/styles/index.ts +10 -0
- package/core/client/styles/pack-styles.ts +169 -0
- package/core/client/styles/sheet-mount.ts +48 -0
- package/core/client/{component → styles}/style-features.ts +3 -3
- package/core/client/time/clock.ts +36 -0
- package/core/client/time/instant.ts +2 -0
- package/core/client/url-state/index.ts +15 -0
- package/core/client/url-state/page-tabs-controller.ts +47 -0
- package/core/client/url-state/state-query-binding.ts +114 -0
- package/core/client/url-state/url-state.ts +149 -0
- package/core/client/validation/async-check-registry.ts +129 -0
- package/core/client/validation/async-rules.ts +259 -0
- package/core/client/validation/contract-validator.ts +44 -5
- package/core/client/validation/field-rules.ts +49 -0
- package/core/client/validation/index.ts +53 -0
- package/core/client/validation/object-rules.ts +72 -0
- package/core/index.ts +290 -264
- package/core/inspect/check-product.ts +542 -0
- package/core/inspect/check-runtime.ts +866 -0
- package/core/inspect/runtime.ts +98 -0
- package/core/page-target/index.ts +9 -0
- package/core/page-target/provenance.ts +119 -0
- package/core/page-target/slug.ts +7 -0
- package/core/page-target/testing/index.ts +329 -0
- package/core/page-target/types.ts +279 -0
- package/core/predicates-entry.ts +43 -0
- package/core/server/api/load-host-service.ts +3 -0
- package/core/server/compile-port.ts +18 -0
- package/core/server/diagnostic-gate-entry.ts +14 -0
- package/core/server/engines/style/candidate-guard.ts +59 -0
- package/core/server/engines/style/index.ts +57 -0
- package/core/server/engines/style/port.ts +34 -0
- package/core/server/engines/style/tailwind-adapter.ts +68 -0
- package/core/server/host/content-security-policy.ts +12 -5
- package/core/server/host/host-assembly-entry.ts +16 -0
- package/core/server/host/host-assembly.ts +249 -0
- package/core/server/host/invoke-host-request-hook.ts +5 -0
- package/core/server/host/locale-yaml.ts +51 -0
- package/core/server/host/page-markup-config.ts +13 -0
- package/core/server/host/published-page-artifact-cache.ts +355 -124
- package/core/server/host/published-page-assets.ts +90 -45
- package/core/server/host/resolve-host-request-hook.ts +8 -0
- package/core/server/host/resolve-host-tree-context.ts +15 -1
- package/core/server/host/server-page-assets.ts +178 -38
- package/core/server/host/soma-page-compile.ts +57 -16
- package/core/server/host/source-packages.cjs +185 -0
- package/core/server/host/source-packages.ts +18 -126
- package/core/server/host/virtual-pages.ts +255 -0
- package/core/server/index.ts +13 -42
- package/core/server/node.ts +53 -0
- package/core/server/page-assets.ts +91 -0
- package/core/server/page-declaration.ts +83 -7
- package/core/server/registry/api-registry-store.ts +38 -29
- package/core/server/registry/asset-store.ts +35 -19
- package/core/server/registry/batch-publish.ts +38 -0
- package/core/server/registry/batch-stage.ts +130 -0
- package/core/server/registry/component-supply.ts +31 -0
- package/core/server/registry/declaration-precompiler.ts +48 -34
- package/core/server/registry/index.ts +78 -1
- package/core/server/registry/page-registry-repository.ts +479 -60
- package/core/server/registry/page-registry-store.ts +627 -80
- package/core/server/registry/publish-asset-pin.ts +19 -16
- package/core/server/registry/registry-file-lock.ts +16 -3
- package/core/server/registry/registry-write-pipeline.ts +65 -1
- package/core/server/registry/request-body-limit.ts +3 -1
- package/core/server/registry/rollback-plan.ts +184 -0
- package/core/server/registry/services/index.ts +14 -1
- package/core/server/registry/services/pages/Get.ts +26 -4
- package/core/server/registry/services/pages/Register.ts +29 -7
- package/core/server/registry/services/pages/RegisterBatch.ts +68 -0
- package/core/server/registry/services/pages/Rollback.ts +14 -4
- package/core/server/registry/services/pages/Unregister.ts +2 -1
- package/core/server/registry/source/canonical.ts +57 -0
- package/core/server/registry/source/errors.ts +81 -0
- package/core/server/registry/source/index.ts +49 -0
- package/core/server/registry/source/ledger.ts +306 -0
- package/core/server/registry/source/snapshot.ts +29 -0
- package/core/server/registry/source/source-name.ts +48 -0
- package/core/server/registry/source/types.ts +106 -0
- package/core/server/registry/source/version-store.ts +371 -0
- package/core/server/registry/standard-product.ts +185 -0
- package/core/server/registry/validation/compile-gate.ts +39 -50
- package/core/server/registry/validation/cross-check.ts +18 -5
- package/core/server/registry/validation/declaration-safety-scan.ts +12 -10
- package/core/server/registry/validation/region-scopes.ts +50 -0
- package/core/server/runtime-space/access-gate.ts +206 -0
- package/core/server/runtime-space/advice-log.ts +67 -0
- package/core/server/runtime-space/artifact-evict.ts +15 -0
- package/core/server/runtime-space/bindings.ts +481 -0
- package/core/server/runtime-space/digest.ts +62 -0
- package/core/server/runtime-space/dynamic-pages.ts +379 -0
- package/core/server/runtime-space/errors.ts +96 -0
- package/core/server/runtime-space/gc.ts +117 -0
- package/core/server/runtime-space/index.ts +106 -0
- package/core/server/runtime-space/inject.ts +498 -0
- package/core/server/runtime-space/migrate-sources.ts +124 -0
- package/core/server/runtime-space/nav-catalog.ts +140 -0
- package/core/server/runtime-space/page-grants.ts +436 -0
- package/core/server/runtime-space/prewarm.ts +234 -0
- package/core/server/runtime-space/registry-cold-start.ts +69 -0
- package/core/server/runtime-space/resolve.ts +552 -0
- package/core/server/runtime-space/root.cjs +251 -0
- package/core/server/runtime-space/root.ts +46 -0
- package/core/server/runtime-space/static-source.ts +85 -0
- package/core/server/runtime-space/store.ts +253 -0
- package/core/server/runtime-space/submit-steps.ts +412 -0
- package/core/server/runtime-space/types.ts +325 -0
- package/core/shared/anchor-space.ts +48 -0
- package/core/shared/artifact-compatibility.ts +166 -0
- package/core/shared/behavior-machine-names.ts +8 -0
- package/core/shared/calc/coerce.ts +2 -29
- package/core/shared/calc/errors.ts +4 -7
- package/core/shared/calc/evaluator.ts +23 -11
- package/core/shared/calc/index.ts +3 -4
- package/core/shared/calc/lexer.ts +7 -12
- package/core/shared/calc/parser.ts +8 -19
- package/core/shared/calc/typer.ts +10 -23
- package/core/shared/component-tree-artifact.ts +85 -7
- package/core/shared/contract-a11y.ts +335 -0
- package/core/shared/contract-sections.ts +344 -0
- package/core/shared/core-diagnostic-codes.ts +210 -0
- package/core/shared/data-declaration-checks.ts +211 -0
- package/core/shared/date-parts.ts +2 -0
- package/core/shared/declaration-errors.ts +14 -0
- package/core/shared/declaration-keys.ts +36 -0
- package/core/shared/diagnostic-code-index-entry.ts +14 -0
- package/core/shared/diagnostic-gate.ts +139 -0
- package/core/shared/engines/engine-error.ts +33 -0
- package/core/shared/engines/style/style-engine.types.ts +28 -0
- package/core/shared/envelope-text-width.generated.d.mts +19 -0
- package/core/shared/envelope-text-width.generated.mjs +413 -0
- package/core/shared/fragments-section.ts +10 -0
- package/core/shared/generation-diagnostics.ts +58 -0
- package/core/shared/generation-error.ts +73 -0
- package/core/shared/hook-attributes.ts +159 -0
- package/core/shared/inert-data-element.ts +50 -0
- package/core/shared/nav-back.ts +120 -0
- package/core/shared/page-access-text.ts +7 -0
- package/core/shared/page-envelope-runtime.ts +88 -0
- package/core/shared/page-envelope.ts +618 -0
- package/core/shared/page-scopes.ts +83 -0
- package/core/shared/pipeline-error-codes-view.ts +31 -0
- package/core/shared/pipeline-limits-view.ts +27 -0
- package/core/shared/predicates/index.ts +85 -497
- package/core/shared/predicates/relative-window.ts +19 -0
- package/core/shared/published-page-route.ts +4 -8
- package/core/shared/region-scope-decl.ts +488 -0
- package/core/shared/registry-generated/compile-purposes.ts +53 -0
- package/core/shared/registry-generated/diagnostic-registry-index.ts +798 -0
- package/core/shared/registry-generated/diagnostic-registry.ts +5886 -0
- package/core/shared/registry-generated/error-codes.ts +137 -0
- package/core/shared/registry-generated/index.ts +13 -0
- package/core/shared/registry-generated/limits.ts +552 -0
- package/core/shared/registry-generated/platform-keys.ts +56 -0
- package/core/shared/registry-generated/region-scope.ts +823 -0
- package/core/shared/registry-generated/std-grammar-completion.ts +216 -0
- package/core/shared/registry-generated/std-grammar-views.ts +139 -0
- package/core/shared/registry-generated/std-grammar.ts +161 -0
- package/core/shared/rule-step.ts +2 -0
- package/core/shared/runtime-address.ts +244 -0
- package/core/shared/scope-decl.ts +77 -0
- package/core/shared/sha256.ts +108 -0
- package/core/shared/show-when.ts +77 -0
- package/core/shared/source-compat.ts +9 -0
- package/core/shared/std-auth-scan.ts +158 -0
- package/core/shared/types/choice-confirm.types.ts +2 -0
- package/core/shared/types/compile-diagnostic.types.ts +42 -0
- package/core/shared/types/compile-port.types.ts +41 -0
- package/core/shared/types/component-contract.types.ts +145 -156
- package/core/shared/types/component-tree-artifact.types.ts +31 -2
- package/core/shared/types/component-tree.types.ts +17 -6
- package/core/shared/types/data-config.types.ts +182 -222
- package/core/shared/types/domain.types.ts +20 -5
- package/core/shared/types/engine.types.ts +2 -0
- package/core/shared/types/event.types.ts +78 -8
- package/core/shared/types/generation-error.types.ts +83 -0
- package/core/shared/types/host-assembly.types.ts +97 -0
- package/core/shared/types/locale.types.ts +46 -0
- package/core/shared/types/manifest.types.ts +2 -7
- package/core/shared/types/nav-context.types.ts +46 -0
- package/core/shared/types/nav.types.ts +57 -0
- package/core/shared/types/notify.types.ts +45 -0
- package/core/shared/types/observation.types.ts +76 -0
- package/core/shared/types/page-envelope.types.ts +125 -0
- package/core/shared/types/page-state.types.ts +21 -42
- package/core/shared/types/region-scope.types.ts +177 -0
- package/core/shared/types/registry-batch.types.ts +45 -0
- package/core/shared/types/shortcuts.types.ts +61 -0
- package/core/shared/types/source.types.ts +10 -0
- package/core/shared/types/style-config.types.ts +61 -82
- package/core/shared/types/temporal.types.ts +3 -0
- package/core/shared/types/ui-config.types.ts +85 -152
- package/core/shared/types/write-outcome-view.types.ts +24 -0
- package/core/shared/types/write-runtime.types.ts +10 -0
- package/core/shared/types/write.types.ts +86 -0
- package/dist/browser/runtime-bundle.manifest.json +938 -0
- package/dist/browser/soma-runtime.js +120276 -0
- package/dist/cli/soma.js +131 -454
- package/dist/core/adaptive-pure.cjs +41 -0
- package/dist/core/index.cjs +119747 -22518
- package/dist/core/theme-pure.cjs +38 -0
- package/dist/diagnostics/telemetry.cjs +2 -1
- package/dist/lsp/component-tree.cjs +6412 -8261
- package/dist/preview-export.cjs +3401 -0
- package/dist/types/build/compiler/flat-page.d.ts +52 -0
- package/dist/types/build/compiler/full-manifest-builder.d.ts +26 -1
- package/dist/types/build/{blocks → compiler}/html-index.d.ts +19 -8
- package/dist/types/build/compiler/page-assets.d.ts +11 -3
- package/dist/types/build/compiler/page-base-resolver.d.ts +5 -0
- package/dist/types/build/compiler/page-declaration-compiler.d.ts +97 -56
- package/dist/types/build/compiler/soma-precompile.d.ts +3 -3
- package/dist/types/build/compiler/vite-plugin-soma.d.ts +2 -2
- package/dist/types/build/component/component-graph.d.ts +1 -1
- package/dist/types/build/component-tree/artifact-codec.d.ts +5 -8
- package/dist/types/build/component-tree/registry-snapshot.d.ts +18 -0
- package/dist/types/build/component-tree/source-preflight.d.ts +4 -14
- package/dist/types/build/component-tree/structure-topology.d.ts +1 -1
- package/dist/types/build/eject/plan-eject.d.ts +0 -1
- package/dist/types/build/lsp/component-tree-service.d.ts +2 -0
- package/dist/types/client/a11y/a11y-config.d.ts +15 -0
- package/dist/types/client/a11y/announcer.d.ts +45 -0
- package/dist/types/client/a11y/dom-id.d.ts +4 -0
- package/dist/types/client/a11y/index.d.ts +5 -0
- package/dist/types/client/a11y/motion-hook.d.ts +13 -0
- package/dist/types/client/a11y/motion.d.ts +24 -0
- package/dist/types/client/base/SomaPageRootBase.d.ts +17 -2
- package/dist/types/client/base/index.d.ts +8 -8
- package/dist/types/client/behavior/adapter-collection.d.ts +39 -0
- package/dist/types/client/behavior/adapter-popper.d.ts +2 -0
- package/dist/types/client/behavior/aria-hide-outside.d.ts +13 -0
- package/dist/types/client/behavior/css-escape.d.ts +11 -0
- package/dist/types/client/behavior/focus-scope.d.ts +69 -0
- package/dist/types/client/behavior/focus-traversal.d.ts +3 -0
- package/dist/types/client/behavior/index.d.ts +17 -0
- package/dist/types/client/behavior/layer-stack.d.ts +39 -0
- package/dist/types/client/behavior/overlay-host/index.d.ts +5 -0
- package/dist/types/client/behavior/overlay-host/port.d.ts +55 -0
- package/dist/types/client/behavior/overlay-wiring.d.ts +59 -0
- package/dist/types/client/behavior/port.d.ts +79 -0
- package/dist/types/client/behavior/positioner.d.ts +2 -0
- package/dist/types/client/behavior/presence.d.ts +27 -0
- package/dist/types/client/behavior/zag/adapter-vanilla.d.ts +2 -0
- package/dist/types/client/behavior/zag/layer-bridge.d.ts +15 -0
- package/dist/types/client/behavior/zag/machine-host.d.ts +22 -0
- package/dist/types/client/behavior/zag/machines.d.ts +23 -0
- package/dist/types/client/compiler/manifest-compiler.d.ts +4 -14
- package/dist/types/client/component/adapter/adapt.d.ts +9 -0
- package/dist/types/client/component/adapter/index.d.ts +3 -0
- package/dist/types/client/component/adapter/types.d.ts +33 -0
- package/dist/types/client/component/adapter/web-component.d.ts +9 -0
- package/dist/types/client/component/component-definition.types.d.ts +23 -5
- package/dist/types/client/component/component-expander.d.ts +1 -12
- package/dist/types/client/component/component-manager.d.ts +39 -89
- package/dist/types/client/component/component-pack.d.ts +21 -54
- package/dist/types/client/component/component-registry.d.ts +5 -0
- package/dist/types/client/component/projection-admission.d.ts +5 -0
- package/dist/types/client/component/projection-registry.d.ts +6 -0
- package/dist/types/client/component/projection.types.d.ts +44 -0
- package/dist/types/client/component/region-unavailable.d.ts +10 -0
- package/dist/types/client/component/scoped-adapter.d.ts +2 -3
- package/dist/types/client/container/IContainerAdapter.d.ts +8 -3
- package/dist/types/client/container/SomaContainerAdapter.d.ts +7 -10
- package/dist/types/client/data/collection-payload.d.ts +1 -0
- package/dist/types/client/data/data-object-resolver.d.ts +231 -110
- package/dist/types/client/data/data-polling.d.ts +28 -0
- package/dist/types/client/data/data-subscriptions.d.ts +20 -0
- package/dist/types/client/data/data-write-actions.d.ts +9 -0
- package/dist/types/client/data/envelope-failure.d.ts +17 -0
- package/dist/types/client/data/format-config.d.ts +13 -0
- package/dist/types/client/data/region-scope-port.d.ts +34 -0
- package/dist/types/client/data/region-scope-views.d.ts +15 -0
- package/dist/types/client/data/role-gate.d.ts +10 -0
- package/dist/types/client/data/write-outcome-store.d.ts +23 -0
- package/dist/types/client/data/write-outcome.d.ts +48 -0
- package/dist/types/client/engine/asset-resolver.d.ts +2 -7
- package/dist/types/client/engine/dom-renderer.d.ts +5 -111
- package/dist/types/client/engine/event-engine.d.ts +52 -61
- package/dist/types/client/engine/locale-text-binder.d.ts +28 -0
- package/dist/types/client/engine/property-watcher.d.ts +1 -41
- package/dist/types/client/engine/reactive-proxy.d.ts +2 -42
- package/dist/types/client/engine/render-engine.d.ts +3 -54
- package/dist/types/client/engine/row-range.d.ts +1 -0
- package/dist/types/client/engine/runtime-builder.d.ts +7 -3
- package/dist/types/client/engine/soma-bootstrap.d.ts +315 -91
- package/dist/types/client/engine/step-runner.d.ts +20 -2
- package/dist/types/client/engine/style-binder.d.ts +2 -16
- package/dist/types/client/engines/chart/adapter-echarts.d.ts +6 -0
- package/dist/types/client/engines/chart/index.d.ts +8 -0
- package/dist/types/client/engines/chart/kind-modules.d.ts +8 -0
- package/dist/types/client/engines/chart/port.d.ts +46 -0
- package/dist/types/client/engines/diff/adapter-jsdiff.d.ts +6 -0
- package/dist/types/client/engines/diff/index.d.ts +8 -0
- package/dist/types/client/engines/diff/port.d.ts +16 -0
- package/dist/types/client/engines/dnd/adapter-pragmatic.d.ts +9 -0
- package/dist/types/client/engines/dnd/index.d.ts +6 -0
- package/dist/types/client/engines/dnd/port.d.ts +33 -0
- package/dist/types/client/engines/engine-adapters.d.ts +23 -0
- package/dist/types/client/engines/load.d.ts +11 -0
- package/dist/types/client/engines/qrcode/adapter-qrcode-generator.d.ts +6 -0
- package/dist/types/client/engines/qrcode/index.d.ts +8 -0
- package/dist/types/client/engines/qrcode/port.d.ts +16 -0
- package/dist/types/client/engines/table/adapter-tanstack.d.ts +6 -0
- package/dist/types/client/engines/table/index.d.ts +8 -0
- package/dist/types/client/engines/table/port.d.ts +51 -0
- package/dist/types/client/engines/temporal/adapter-polyfill.d.ts +6 -0
- package/dist/types/client/engines/temporal/index.d.ts +8 -0
- package/dist/types/client/engines/temporal/port.d.ts +41 -0
- package/dist/types/client/engines/virtual/adapter-tanstack.d.ts +9 -0
- package/dist/types/client/engines/virtual/index.d.ts +8 -0
- package/dist/types/client/engines/virtual/port.d.ts +33 -0
- package/dist/types/client/format/formatter.d.ts +3 -0
- package/dist/types/client/format/index.d.ts +2 -0
- package/dist/types/client/format/zoned.d.ts +1 -0
- package/dist/types/client/host-bridge/index.d.ts +3 -0
- package/dist/types/client/host-bridge/resolve-host-bootstrap.d.ts +7 -1
- package/dist/types/client/host-bridge/soma-app-host.stub.d.ts +3 -0
- package/dist/types/client/host-bridge/soma-bootstrap-from-app.d.ts +9 -0
- package/dist/types/client/infra/auth/IAuthService.d.ts +5 -0
- package/dist/types/client/infra/auth/TokenAuthService.d.ts +1 -0
- package/dist/types/client/infra/config/SomaConfig.d.ts +4 -0
- package/dist/types/client/infra/config/feature-flags.d.ts +10 -0
- package/dist/types/client/infra/http/IHttpClient.d.ts +4 -0
- package/dist/types/client/infra/i18n/II18n.d.ts +18 -1
- package/dist/types/client/infra/i18n/builtin-locale.d.ts +11 -0
- package/dist/types/client/infra/i18n/index.d.ts +1 -0
- package/dist/types/client/infra/i18n/interpolate.d.ts +12 -0
- package/dist/types/client/infra/i18n/locale-catalog.d.ts +71 -0
- package/dist/types/client/infra/i18n/pack-locales.d.ts +29 -0
- package/dist/types/client/infra/identity/identity-port.d.ts +54 -0
- package/dist/types/client/infra/notify/DefaultNotifyService.d.ts +29 -7
- package/dist/types/client/infra/notify/INotifyService.d.ts +1 -12
- package/dist/types/client/infra/notify/notify-declaration.d.ts +10 -0
- package/dist/types/client/infra/permission/SomaPermission.d.ts +7 -0
- package/dist/types/client/infra/router/IRouter.d.ts +5 -1
- package/dist/types/client/infra/router/SomaRouter.d.ts +6 -2
- package/dist/types/client/keyboard/collection.d.ts +58 -0
- package/dist/types/client/keyboard/compose-keys.d.ts +24 -0
- package/dist/types/client/keyboard/cursor.d.ts +48 -0
- package/dist/types/client/keyboard/delegate.d.ts +48 -0
- package/dist/types/client/keyboard/ime.d.ts +2 -0
- package/dist/types/client/keyboard/index.d.ts +10 -0
- package/dist/types/client/keyboard/intents.d.ts +35 -0
- package/dist/types/client/keyboard/matrix.d.ts +29 -0
- package/dist/types/client/keyboard/submit.d.ts +7 -0
- package/dist/types/client/keyboard/typeahead.d.ts +28 -0
- package/dist/types/client/keyboard/wiring.d.ts +87 -0
- package/dist/types/client/middleware/createPermissionMiddleware.d.ts +5 -0
- package/dist/types/client/mount/domain-rule.d.ts +17 -0
- package/dist/types/client/mount/index.d.ts +3 -0
- package/dist/types/client/mount/mount-page.d.ts +11 -0
- package/dist/types/client/mount/types.d.ts +100 -0
- package/dist/types/client/observability/runtime-observer.d.ts +24 -0
- package/dist/types/client/parser/confirm-spec.d.ts +37 -0
- package/dist/types/client/parser/data-config-parser.d.ts +23 -17
- package/dist/types/client/parser/duration.d.ts +1 -1
- package/dist/types/client/parser/page-state-parser.d.ts +1 -6
- package/dist/types/client/parser/pipeline-parser.d.ts +7 -12
- package/dist/types/client/parser/style-config-parser.d.ts +2 -1
- package/dist/types/client/parser/subscribe-parser.d.ts +5 -0
- package/dist/types/client/parser/ui-config-parser.d.ts +26 -25
- package/dist/types/client/pipes/pipe-registry.d.ts +30 -40
- package/dist/types/client/registry/declaration-renderer.d.ts +11 -3
- package/dist/types/client/registry/page-lifecycle.d.ts +3 -3
- package/dist/types/client/registry/remote-page.d.ts +3 -3
- package/dist/types/client/render-ports/index.d.ts +15 -0
- package/dist/types/client/render-ports/notify-renderer.d.ts +55 -0
- package/dist/types/client/render-ports/region-fallback.d.ts +10 -0
- package/dist/types/client/render-ports/scheduling/prompt-queue.d.ts +19 -0
- package/dist/types/client/render-ports/scheduling/toast-scheduler.d.ts +60 -0
- package/dist/types/client/runtime/SomaRuntimeServices.d.ts +102 -5
- package/dist/types/client/runtime/nav-history.d.ts +31 -0
- package/dist/types/client/runtime/nav-port.d.ts +12 -0
- package/dist/types/client/runtime/shortcuts.d.ts +41 -0
- package/dist/types/client/runtime/write-feedback.d.ts +22 -0
- package/dist/types/client/runtime-entry.d.ts +13 -0
- package/dist/types/client/scheduler/SomaScheduler.d.ts +5 -0
- package/dist/types/client/{adaptive → scheduling}/flush-scheduler.d.ts +2 -2
- package/dist/types/client/scheduling/index.d.ts +4 -0
- package/dist/types/client/scheduling/observer-pool.d.ts +15 -0
- package/dist/types/client/security/url-guard.d.ts +18 -0
- package/dist/types/client/styles/compiled-styles.d.ts +10 -0
- package/dist/types/client/styles/index.d.ts +3 -0
- package/dist/types/client/styles/pack-styles.d.ts +51 -0
- package/dist/types/client/styles/sheet-mount.d.ts +7 -0
- package/dist/types/client/{component → styles}/style-features.d.ts +1 -1
- package/dist/types/client/time/clock.d.ts +10 -0
- package/dist/types/client/time/instant.d.ts +1 -0
- package/dist/types/client/url-state/index.d.ts +6 -0
- package/dist/types/client/url-state/page-tabs-controller.d.ts +22 -0
- package/dist/types/client/url-state/state-query-binding.d.ts +22 -0
- package/dist/types/client/url-state/url-state.d.ts +47 -0
- package/dist/types/client/validation/async-check-registry.d.ts +41 -0
- package/dist/types/client/validation/async-rules.d.ts +81 -0
- package/dist/types/client/validation/contract-validator.d.ts +10 -0
- package/dist/types/client/validation/field-rules.d.ts +6 -0
- package/dist/types/client/validation/index.d.ts +5 -0
- package/dist/types/client/validation/object-rules.d.ts +22 -0
- package/dist/types/index.d.ts +97 -61
- package/dist/types/inspect/check-product.d.ts +123 -0
- package/dist/types/inspect/check-runtime.d.ts +19 -0
- package/dist/types/inspect/runtime.d.ts +39 -0
- package/dist/types/page-target/index.d.ts +3 -0
- package/dist/types/page-target/provenance.d.ts +20 -0
- package/dist/types/page-target/slug.d.ts +7 -0
- package/dist/types/page-target/testing/index.d.ts +55 -0
- package/dist/types/page-target/types.d.ts +260 -0
- package/dist/types/predicates-entry.d.ts +3 -0
- package/dist/types/server/compile-port.d.ts +13 -0
- package/dist/types/server/diagnostic-gate-entry.d.ts +3 -0
- package/dist/types/server/engines/style/candidate-guard.d.ts +14 -0
- package/dist/types/server/engines/style/index.d.ts +10 -0
- package/dist/types/server/engines/style/port.d.ts +8 -0
- package/dist/types/server/engines/style/tailwind-adapter.d.ts +6 -0
- package/dist/types/server/host/content-security-policy.d.ts +5 -0
- package/dist/types/server/host/host-assembly-entry.d.ts +2 -0
- package/dist/types/server/host/host-assembly.d.ts +56 -0
- package/dist/types/server/host/host-config-paths.d.cts +7 -0
- package/dist/types/server/host/locale-yaml.d.ts +3 -0
- package/dist/types/server/host/page-markup-config.d.ts +6 -0
- package/dist/types/server/host/published-page-artifact-cache.d.ts +99 -22
- package/dist/types/server/host/published-page-assets.d.ts +74 -4
- package/dist/types/server/host/server-page-assets.d.ts +29 -1
- package/dist/types/server/host/soma-page-compile.d.ts +26 -4
- package/dist/types/server/host/source-packages.d.cts +23 -0
- package/dist/types/server/host/source-packages.d.ts +15 -2
- package/dist/types/server/host/virtual-pages.d.ts +43 -0
- package/dist/types/server/index.d.ts +8 -12
- package/dist/types/server/node.d.ts +16 -0
- package/dist/types/server/page-assets.d.ts +10 -0
- package/dist/types/server/page-declaration.d.ts +21 -6
- package/dist/types/server/registry/api-registry-store.d.ts +9 -7
- package/dist/types/server/registry/asset-store.d.ts +13 -7
- package/dist/types/server/registry/batch-publish.d.ts +12 -0
- package/dist/types/server/registry/batch-stage.d.ts +24 -0
- package/dist/types/server/registry/component-supply.d.ts +6 -0
- package/dist/types/server/registry/declaration-precompiler.d.ts +22 -8
- package/dist/types/server/registry/index.d.ts +12 -3
- package/dist/types/server/registry/page-registry-repository.d.ts +46 -0
- package/dist/types/server/registry/page-registry-store.d.ts +225 -23
- package/dist/types/server/registry/publish-asset-pin.d.ts +5 -4
- package/dist/types/server/registry/registry-file-lock.d.ts +5 -0
- package/dist/types/server/registry/registry-write-pipeline.d.ts +22 -0
- package/dist/types/server/registry/request-body-limit.d.ts +1 -1
- package/dist/types/server/registry/rollback-plan.d.ts +61 -0
- package/dist/types/server/registry/services/index.d.ts +5 -0
- package/dist/types/server/registry/services/pages/Register.d.ts +1 -1
- package/dist/types/server/registry/services/pages/RegisterBatch.d.ts +12 -0
- package/dist/types/server/registry/services/pages/Rollback.d.ts +4 -1
- package/dist/types/server/registry/source/canonical.d.ts +2 -0
- package/dist/types/server/registry/source/errors.d.ts +44 -0
- package/dist/types/server/registry/source/index.d.ts +7 -0
- package/dist/types/server/registry/source/ledger.d.ts +99 -0
- package/dist/types/server/registry/source/snapshot.d.ts +6 -0
- package/dist/types/server/registry/source/source-name.d.ts +20 -0
- package/dist/types/server/registry/source/types.d.ts +89 -0
- package/dist/types/server/registry/source/version-store.d.ts +66 -0
- package/dist/types/server/registry/standard-product.d.ts +78 -0
- package/dist/types/server/registry/validation/compile-gate.d.ts +12 -45
- package/dist/types/server/registry/validation/cross-check.d.ts +7 -0
- package/dist/types/server/registry/validation/declaration-safety-scan.d.ts +0 -1
- package/dist/types/server/registry/validation/region-scopes.d.ts +10 -0
- package/dist/types/server/runtime-space/access-gate.d.ts +41 -0
- package/dist/types/server/runtime-space/advice-log.d.ts +18 -0
- package/dist/types/server/runtime-space/artifact-evict.d.ts +4 -0
- package/dist/types/server/runtime-space/bindings.d.ts +115 -0
- package/dist/types/server/runtime-space/digest.d.ts +19 -0
- package/dist/types/server/runtime-space/dynamic-pages.d.ts +120 -0
- package/dist/types/server/runtime-space/errors.d.ts +37 -0
- package/dist/types/server/runtime-space/gc.d.ts +6 -0
- package/dist/types/server/runtime-space/index.d.ts +19 -0
- package/dist/types/server/runtime-space/inject.d.ts +55 -0
- package/dist/types/server/runtime-space/migrate-sources.d.ts +19 -0
- package/dist/types/server/runtime-space/nav-catalog.d.ts +33 -0
- package/dist/types/server/runtime-space/page-grants.d.ts +90 -0
- package/dist/types/server/runtime-space/prewarm.d.ts +60 -0
- package/dist/types/server/runtime-space/registry-cold-start.d.ts +4 -0
- package/dist/types/server/runtime-space/resolve.d.ts +38 -0
- package/dist/types/server/runtime-space/root.d.cts +88 -0
- package/dist/types/server/runtime-space/root.d.ts +21 -0
- package/dist/types/server/runtime-space/static-source.d.ts +8 -0
- package/dist/types/server/runtime-space/store.d.ts +63 -0
- package/dist/types/server/runtime-space/submit-steps.d.ts +116 -0
- package/dist/types/server/runtime-space/types.d.ts +264 -0
- package/dist/types/shared/anchor-space.d.ts +17 -0
- package/dist/types/shared/artifact-compatibility.d.ts +77 -0
- package/dist/types/shared/behavior-machine-names.d.ts +2 -0
- package/dist/types/shared/calc/coerce.d.ts +1 -4
- package/dist/types/shared/calc/lexer.d.ts +1 -2
- package/dist/types/shared/calc/parser.d.ts +1 -7
- package/dist/types/shared/calc/typer.d.ts +1 -6
- package/dist/types/shared/component-tree-artifact.d.ts +16 -2
- package/dist/types/shared/contract-a11y.d.ts +33 -0
- package/dist/types/shared/contract-sections.d.ts +50 -0
- package/dist/types/shared/core-diagnostic-codes.d.ts +28 -0
- package/dist/types/shared/data-declaration-checks.d.ts +71 -0
- package/dist/types/shared/date-parts.d.ts +1 -0
- package/dist/types/shared/declaration-errors.d.ts +12 -0
- package/dist/types/shared/declaration-keys.d.ts +9 -0
- package/dist/types/shared/diagnostic-code-index-entry.d.ts +5 -0
- package/dist/types/shared/diagnostic-gate.d.ts +60 -0
- package/dist/types/shared/engines/engine-error.d.ts +14 -0
- package/dist/types/shared/engines/style/style-engine.types.d.ts +22 -0
- package/dist/types/shared/fragments-section.d.ts +2 -0
- package/dist/types/shared/generation-diagnostics.d.ts +7 -0
- package/dist/types/shared/generation-error.d.ts +20 -0
- package/dist/types/shared/hook-attributes.d.ts +220 -0
- package/dist/types/shared/inert-data-element.d.ts +14 -0
- package/dist/types/shared/nav-back.d.ts +22 -0
- package/dist/types/shared/page-access-text.d.ts +4 -0
- package/dist/types/shared/page-envelope-runtime.d.ts +32 -0
- package/dist/types/shared/page-envelope.d.ts +61 -0
- package/dist/types/shared/page-scopes.d.ts +35 -0
- package/dist/types/shared/pipeline-error-codes-view.d.ts +11 -0
- package/dist/types/shared/pipeline-limits-view.d.ts +8 -0
- package/dist/types/shared/predicates/index.d.ts +24 -67
- package/dist/types/shared/predicates/relative-window.d.ts +1 -0
- package/dist/types/shared/published-page-route.d.ts +2 -2
- package/dist/types/shared/region-scope-decl.d.ts +121 -0
- package/dist/types/shared/registry-generated/compile-purposes.d.ts +37 -0
- package/dist/types/shared/registry-generated/diagnostic-registry-index.d.ts +2 -0
- package/dist/types/shared/registry-generated/diagnostic-registry.d.ts +5023 -0
- package/dist/types/shared/registry-generated/error-codes.d.ts +115 -0
- package/dist/types/shared/registry-generated/index.d.ts +10 -0
- package/dist/types/shared/registry-generated/limits.d.ts +461 -0
- package/dist/types/shared/registry-generated/platform-keys.d.ts +42 -0
- package/dist/types/shared/registry-generated/region-scope.d.ts +511 -0
- package/dist/types/shared/registry-generated/std-grammar-completion.d.ts +773 -0
- package/dist/types/shared/registry-generated/std-grammar-views.d.ts +203 -0
- package/dist/types/shared/registry-generated/std-grammar.d.ts +3515 -0
- package/dist/types/shared/rule-step.d.ts +1 -0
- package/dist/types/shared/runtime-address.d.ts +70 -0
- package/dist/types/shared/scope-decl.d.ts +15 -0
- package/dist/types/shared/sha256.d.ts +4 -0
- package/dist/types/shared/show-when.d.ts +21 -0
- package/dist/types/shared/source-compat.d.ts +2 -0
- package/dist/types/shared/std-auth-scan.d.ts +45 -0
- package/dist/types/shared/types/choice-confirm.types.d.ts +1 -0
- package/dist/types/shared/types/compile-diagnostic.types.d.ts +34 -0
- package/dist/types/shared/types/compile-port.types.d.ts +30 -0
- package/dist/types/shared/types/component-contract.types.d.ts +134 -129
- package/dist/types/shared/types/component-tree-artifact.types.d.ts +29 -2
- package/dist/types/shared/types/component-tree.types.d.ts +15 -6
- package/dist/types/shared/types/data-config.types.d.ts +175 -191
- package/dist/types/shared/types/domain.types.d.ts +20 -5
- package/dist/types/shared/types/engine.types.d.ts +2 -0
- package/dist/types/shared/types/event.types.d.ts +59 -9
- package/dist/types/shared/types/generation-error.types.d.ts +28 -0
- package/dist/types/shared/types/host-assembly.types.d.ts +95 -0
- package/dist/types/shared/types/locale.types.d.ts +17 -0
- package/dist/types/shared/types/manifest.types.d.ts +2 -7
- package/dist/types/shared/types/nav-context.types.d.ts +41 -0
- package/dist/types/shared/types/nav.types.d.ts +53 -0
- package/dist/types/shared/types/notify.types.d.ts +37 -0
- package/dist/types/shared/types/observation.types.d.ts +72 -0
- package/dist/types/shared/types/page-envelope.types.d.ts +98 -0
- package/dist/types/shared/types/page-state.types.d.ts +17 -33
- package/dist/types/shared/types/region-scope.types.d.ts +150 -0
- package/dist/types/shared/types/registry-batch.types.d.ts +48 -0
- package/dist/types/shared/types/shortcuts.types.d.ts +67 -0
- package/dist/types/shared/types/source.types.d.ts +10 -0
- package/dist/types/shared/types/style-config.types.d.ts +0 -19
- package/dist/types/shared/types/temporal.types.d.ts +1 -0
- package/dist/types/shared/types/ui-config.types.d.ts +82 -148
- package/dist/types/shared/types/write-outcome-view.types.d.ts +19 -0
- package/dist/types/shared/types/write-runtime.types.d.ts +1 -0
- package/dist/types/shared/types/write.types.d.ts +70 -0
- package/global.d.ts +2 -1
- package/package.json +216 -62
- package/tsconfig.json +2 -10
- package/app/SomaPageClient.tsx +0 -313
- package/app/[...path]/page.tsx +0 -22
- package/app/api/[...path]/route.ts +0 -86
- package/app/api/soma-registry/[...path]/route.ts +0 -67
- package/app/components/SomaHostPage.tsx +0 -128
- package/app/components/SomaHydrationShell.tsx +0 -20
- package/app/components/SomaPageClientBoundary.tsx +0 -13
- package/app/favicon.ico/route.ts +0 -13
- package/app/globals.css +0 -126
- package/app/layout.tsx +0 -27
- package/app/page.tsx +0 -9
- package/app/soma/[...path]/route.ts +0 -9
- package/app/soma/manifest/route.ts +0 -43
- package/app/soma/page/route.ts +0 -44
- package/app/soma/page-object/route.ts +0 -159
- package/app/soma/route.ts +0 -9
- package/bin/component.cjs +0 -240
- package/bin/migrate.cjs +0 -432
- package/bin/soma-db.cjs +0 -13
- package/bin/soma-mock.mjs +0 -38
- package/bin/soma-sync.cjs +0 -3
- package/core/build/blocks/block-compile.ts +0 -373
- package/core/build/blocks/block-container.ts +0 -207
- package/core/build/blocks/block-loader.ts +0 -33
- package/core/build/blocks/migrate-flat.ts +0 -463
- package/core/build/compiler/precompiled-manifest-loader.ts +0 -41
- package/core/build/component/pack-from-dir.ts +0 -58
- package/core/build/component/package-loader.ts +0 -358
- package/core/build/component-tree/binding-bridge.ts +0 -272
- package/core/build/component-tree/migration-files.ts +0 -214
- package/core/build/component-tree/migration.ts +0 -170
- package/core/build/component-tree/validator.ts +0 -318
- package/core/build/db/cli.ts +0 -10
- package/core/build/db/emit-entities.ts +0 -45
- package/core/build/db/emit-mappers.ts +0 -175
- package/core/build/db/emit-prisma-schema.ts +0 -92
- package/core/build/db/generate.ts +0 -166
- package/core/build/db/ir.ts +0 -75
- package/core/build/db/load-db-yaml.ts +0 -241
- package/core/build/eject/component-eject.ts +0 -480
- package/core/build/eject/component-upgrade.ts +0 -359
- package/core/build/layout/constraint-solver.ts +0 -350
- package/core/build/layout/css-emitter.ts +0 -135
- package/core/build/layout/page-layout.ts +0 -85
- package/core/build/ooui/artifact/artifact.types.ts +0 -275
- package/core/build/ooui/artifact/emit-artifact.ts +0 -269
- package/core/build/ooui/artifact/emit-html.ts +0 -204
- package/core/build/ooui/artifact/index.ts +0 -53
- package/core/build/ooui/artifact/spatial-tree.ts +0 -268
- package/core/build/ooui/artifact/utility-class.ts +0 -83
- package/core/build/ooui/composition/candidate.types.ts +0 -323
- package/core/build/ooui/composition/control-model.ts +0 -114
- package/core/build/ooui/composition/registry.ts +0 -520
- package/core/build/ooui/composition/select.ts +0 -232
- package/core/build/ooui/diagnostics/codes.ts +0 -230
- package/core/build/ooui/diagnostics/error.ts +0 -235
- package/core/build/ooui/diagnostics/format.ts +0 -106
- package/core/build/ooui/diagnostics/index.ts +0 -62
- package/core/build/ooui/diagnostics/issue.types.ts +0 -112
- package/core/build/ooui/engine-slot.ts +0 -184
- package/core/build/ooui/index.ts +0 -1427
- package/core/build/ooui/intent/derive-intent.ts +0 -450
- package/core/build/ooui/intent/field-rules.ts +0 -330
- package/core/build/ooui/intent/intent.types.ts +0 -476
- package/core/build/ooui/intent/verb-events.ts +0 -285
- package/core/build/ooui/page/budget.ts +0 -503
- package/core/build/ooui/page/compose-page.ts +0 -736
- package/core/build/ooui/page/index.ts +0 -66
- package/core/build/ooui/page/page.types.ts +0 -402
- package/core/build/ooui/page/region-row.ts +0 -241
- package/core/build/ooui/semantic/expand-page-surface.ts +0 -180
- package/core/build/ooui/semantic/kernel.types.ts +0 -187
- package/core/build/ooui/semantic/normalize.ts +0 -784
- package/core/build/ooui/semantic/origin.types.ts +0 -211
- package/core/build/ooui/semantic/role-alias.ts +0 -154
- package/core/build/ooui/semantic/shorthand.ts +0 -233
- package/core/build/ooui/semantic/surface.types.ts +0 -78
- package/core/build/ooui/semantic/validate-request.ts +0 -267
- package/core/build/ooui/spatial/emit-utility.ts +0 -480
- package/core/build/ooui/spatial/ir.types.ts +0 -443
- package/core/build/ooui/spatial/registry.ts +0 -565
- package/core/build/ooui/spatial/solve.ts +0 -769
- package/core/build/ooui/spatial/utility.types.ts +0 -242
- package/core/build/ooui/trace/index.ts +0 -40
- package/core/build/ooui/trace/render.ts +0 -190
- package/core/build/ooui/trace/source.types.ts +0 -69
- package/core/build/ooui/trace/trace.types.ts +0 -326
- package/core/build/pack/pack-init.ts +0 -270
- package/core/client/adaptive/hysteresis.ts +0 -56
- package/core/client/adaptive/index.ts +0 -23
- package/core/client/adaptive/observer-pool.ts +0 -204
- package/core/client/compiler/adaptive-compile.ts +0 -136
- package/core/client/component/ai-catalog.ts +0 -432
- package/core/client/component/catalog-examples.ts +0 -60
- package/core/client/component/contract-compat.ts +0 -161
- package/core/client/component/example-blocks.ts +0 -126
- package/core/client/component/keyboard-matrix.ts +0 -144
- package/core/client/component/pack-styles.ts +0 -152
- package/core/client/component/theme-component-tokens.ts +0 -80
- package/core/client/component/verify-pack.ts +0 -429
- package/core/client/container/MiniProgramContainerAdapter.ts +0 -204
- package/core/client/container/ReactNativeContainerAdapter.ts +0 -203
- package/core/client/data/reaction-engine.ts +0 -176
- package/core/client/data/window-engine.ts +0 -477
- package/core/client/infra/i18n/DefaultI18n.ts +0 -29
- package/core/client/infra/notify/DomNotifyService.ts +0 -99
- package/core/client/infra/notify/INotifyTheme.ts +0 -22
- package/core/client/parser/adaptive-parser.ts +0 -264
- package/core/client/parser/blocks/namespace.ts +0 -207
- package/core/client/parser/blocks/page-parser.ts +0 -466
- package/core/client/parser/blocks/use-parser.ts +0 -646
- package/core/client/parser/layout-parser.ts +0 -158
- package/core/client/parser/reaction-parser.ts +0 -458
- package/core/client/parser/reaction-sugar.ts +0 -47
- package/core/client/parser/window-parser.ts +0 -294
- package/core/client/quality/SomaQualityRegistry.ts +0 -71
- package/core/client/runtime/serialize-page-state.ts +0 -152
- package/core/client/theme/harmony.ts +0 -429
- package/core/client/theme/scene-tokens.ts +0 -155
- package/core/client/theme/theme-axes.ts +0 -323
- package/core/client/theme/theme-engine.ts +0 -2390
- package/core/client/theme/tone-solver.ts +0 -119
- package/core/client/typography/typography-base.ts +0 -34
- package/core/server/headless/soma-headless-page.ts +0 -103
- package/core/server/infra/db/errors.ts +0 -11
- package/core/server/infra/db/mapper/PrismaSomaMapper.ts +0 -313
- package/core/server/infra/db/mapper/SomaBaseMapper.ts +0 -23
- package/core/server/infra/db/mapper/SomaMapperHooks.ts +0 -13
- package/core/server/infra/db/query/SomaQuery.ts +0 -149
- package/core/server/infra/db/service/SomaDbService.ts +0 -64
- package/core/server/infra/db/soma-db.ts +0 -120
- package/core/server/infra/db/types.ts +0 -21
- package/core/server/mock/node/catch-all.mjs +0 -35
- package/core/server/mock/node/cli.d.mts +0 -58
- package/core/server/mock/node/cli.mjs +0 -244
- package/core/server/mock/node/context.mjs +0 -167
- package/core/server/mock/node/environment-policy.mjs +0 -52
- package/core/server/mock/node/plugin-loader.mjs +0 -212
- package/core/server/mock/node/preload.mjs +0 -91
- package/core/server/mock/node/process-lifecycle.mjs +0 -236
- package/core/server/mock/node/public.d.mts +0 -110
- package/core/server/mock/node/public.mjs +0 -4
- package/core/server/mock/node/registry.mjs +0 -336
- package/core/server/mock/node/schema-generator.mjs +0 -1309
- package/core/server/mock/testing/host-harness.d.mts +0 -66
- package/core/server/mock/testing/host-harness.mjs +0 -276
- package/core/server/mock/testing/host-runtime.mjs +0 -48
- package/core/server/ooui.ts +0 -34
- package/core/shared/block-errors.ts +0 -11
- package/core/shared/component/derive-sample.ts +0 -290
- package/core/shared/component/field-lines.ts +0 -563
- package/core/shared/container-breakpoints.ts +0 -46
- package/core/shared/object-semantics.ts +0 -240
- package/core/shared/ooui-declaration.ts +0 -235
- package/core/shared/path-algebra.ts +0 -169
- package/core/shared/types/adaptive.types.ts +0 -109
- package/core/shared/types/layout-constraint.types.ts +0 -89
- package/core/shared/types/reaction.types.ts +0 -144
- package/core/shared/types/window.types.ts +0 -177
- package/dist/types/build/blocks/block-compile.d.ts +0 -52
- package/dist/types/build/blocks/block-container.d.ts +0 -40
- package/dist/types/build/blocks/block-loader.d.ts +0 -9
- package/dist/types/build/blocks/migrate-flat.d.ts +0 -49
- package/dist/types/build/compiler/precompiled-manifest-loader.d.ts +0 -5
- package/dist/types/build/component/pack-from-dir.d.ts +0 -17
- package/dist/types/build/component/package-loader.d.ts +0 -50
- package/dist/types/build/component-tree/binding-bridge.d.ts +0 -19
- package/dist/types/build/component-tree/migration-files.d.ts +0 -35
- package/dist/types/build/component-tree/migration.d.ts +0 -28
- package/dist/types/build/component-tree/validator.d.ts +0 -9
- package/dist/types/build/db/cli.d.ts +0 -2
- package/dist/types/build/db/emit-entities.d.ts +0 -5
- package/dist/types/build/db/emit-mappers.d.ts +0 -15
- package/dist/types/build/db/emit-prisma-schema.d.ts +0 -2
- package/dist/types/build/db/generate.d.ts +0 -7
- package/dist/types/build/db/ir.d.ts +0 -58
- package/dist/types/build/db/load-db-yaml.d.ts +0 -14
- package/dist/types/build/eject/component-eject.d.ts +0 -121
- package/dist/types/build/eject/component-upgrade.d.ts +0 -43
- package/dist/types/build/layout/constraint-solver.d.ts +0 -78
- package/dist/types/build/layout/css-emitter.d.ts +0 -18
- package/dist/types/build/layout/page-layout.d.ts +0 -24
- package/dist/types/build/ooui/artifact/artifact.types.d.ts +0 -180
- package/dist/types/build/ooui/artifact/emit-artifact.d.ts +0 -58
- package/dist/types/build/ooui/artifact/emit-html.d.ts +0 -53
- package/dist/types/build/ooui/artifact/index.d.ts +0 -5
- package/dist/types/build/ooui/artifact/spatial-tree.d.ts +0 -48
- package/dist/types/build/ooui/artifact/utility-class.d.ts +0 -46
- package/dist/types/build/ooui/composition/candidate.types.d.ts +0 -206
- package/dist/types/build/ooui/composition/control-model.d.ts +0 -37
- package/dist/types/build/ooui/composition/registry.d.ts +0 -66
- package/dist/types/build/ooui/composition/select.d.ts +0 -63
- package/dist/types/build/ooui/diagnostics/codes.d.ts +0 -28
- package/dist/types/build/ooui/diagnostics/error.d.ts +0 -135
- package/dist/types/build/ooui/diagnostics/format.d.ts +0 -51
- package/dist/types/build/ooui/diagnostics/index.d.ts +0 -25
- package/dist/types/build/ooui/diagnostics/issue.types.d.ts +0 -56
- package/dist/types/build/ooui/engine-slot.d.ts +0 -41
- package/dist/types/build/ooui/index.d.ts +0 -286
- package/dist/types/build/ooui/intent/derive-intent.d.ts +0 -32
- package/dist/types/build/ooui/intent/field-rules.d.ts +0 -99
- package/dist/types/build/ooui/intent/intent.types.d.ts +0 -318
- package/dist/types/build/ooui/intent/verb-events.d.ts +0 -70
- package/dist/types/build/ooui/page/budget.d.ts +0 -28
- package/dist/types/build/ooui/page/compose-page.d.ts +0 -41
- package/dist/types/build/ooui/page/index.d.ts +0 -4
- package/dist/types/build/ooui/page/page.types.d.ts +0 -264
- package/dist/types/build/ooui/page/region-row.d.ts +0 -16
- package/dist/types/build/ooui/semantic/expand-page-surface.d.ts +0 -33
- package/dist/types/build/ooui/semantic/kernel.types.d.ts +0 -125
- package/dist/types/build/ooui/semantic/normalize.d.ts +0 -45
- package/dist/types/build/ooui/semantic/origin.types.d.ts +0 -95
- package/dist/types/build/ooui/semantic/role-alias.d.ts +0 -35
- package/dist/types/build/ooui/semantic/shorthand.d.ts +0 -60
- package/dist/types/build/ooui/semantic/surface.types.d.ts +0 -16
- package/dist/types/build/ooui/semantic/validate-request.d.ts +0 -19
- package/dist/types/build/ooui/spatial/emit-utility.d.ts +0 -43
- package/dist/types/build/ooui/spatial/ir.types.d.ts +0 -280
- package/dist/types/build/ooui/spatial/registry.d.ts +0 -110
- package/dist/types/build/ooui/spatial/solve.d.ts +0 -42
- package/dist/types/build/ooui/spatial/utility.types.d.ts +0 -191
- package/dist/types/build/ooui/trace/index.d.ts +0 -3
- package/dist/types/build/ooui/trace/render.d.ts +0 -42
- package/dist/types/build/ooui/trace/source.types.d.ts +0 -25
- package/dist/types/build/ooui/trace/trace.types.d.ts +0 -143
- package/dist/types/build/pack/pack-init.d.ts +0 -8
- package/dist/types/client/adaptive/hysteresis.d.ts +0 -16
- package/dist/types/client/adaptive/index.d.ts +0 -5
- package/dist/types/client/adaptive/observer-pool.d.ts +0 -22
- package/dist/types/client/compiler/adaptive-compile.d.ts +0 -26
- package/dist/types/client/component/ai-catalog.d.ts +0 -122
- package/dist/types/client/component/catalog-examples.d.ts +0 -18
- package/dist/types/client/component/contract-compat.d.ts +0 -16
- package/dist/types/client/component/example-blocks.d.ts +0 -7
- package/dist/types/client/component/keyboard-matrix.d.ts +0 -24
- package/dist/types/client/component/pack-styles.d.ts +0 -43
- package/dist/types/client/component/theme-component-tokens.d.ts +0 -17
- package/dist/types/client/component/verify-pack.d.ts +0 -24
- package/dist/types/client/container/MiniProgramContainerAdapter.d.ts +0 -52
- package/dist/types/client/container/ReactNativeContainerAdapter.d.ts +0 -47
- package/dist/types/client/data/reaction-engine.d.ts +0 -21
- package/dist/types/client/data/window-engine.d.ts +0 -27
- package/dist/types/client/infra/i18n/DefaultI18n.d.ts +0 -7
- package/dist/types/client/infra/notify/DomNotifyService.d.ts +0 -17
- package/dist/types/client/infra/notify/INotifyTheme.d.ts +0 -12
- package/dist/types/client/parser/adaptive-parser.d.ts +0 -28
- package/dist/types/client/parser/blocks/namespace.d.ts +0 -72
- package/dist/types/client/parser/blocks/page-parser.d.ts +0 -30
- package/dist/types/client/parser/blocks/use-parser.d.ts +0 -124
- package/dist/types/client/parser/layout-parser.d.ts +0 -9
- package/dist/types/client/parser/reaction-parser.d.ts +0 -16
- package/dist/types/client/parser/reaction-sugar.d.ts +0 -13
- package/dist/types/client/parser/window-parser.d.ts +0 -25
- package/dist/types/client/quality/SomaQualityRegistry.d.ts +0 -31
- package/dist/types/client/runtime/serialize-page-state.d.ts +0 -10
- package/dist/types/client/theme/harmony.d.ts +0 -119
- package/dist/types/client/theme/scene-tokens.d.ts +0 -41
- package/dist/types/client/theme/theme-axes.d.ts +0 -174
- package/dist/types/client/theme/theme-engine.d.ts +0 -119
- package/dist/types/client/theme/tone-solver.d.ts +0 -51
- package/dist/types/client/typography/typography-base.d.ts +0 -15
- package/dist/types/server/headless/soma-headless-page.d.ts +0 -12
- package/dist/types/server/infra/db/errors.d.ts +0 -5
- package/dist/types/server/infra/db/mapper/PrismaSomaMapper.d.ts +0 -77
- package/dist/types/server/infra/db/mapper/SomaBaseMapper.d.ts +0 -20
- package/dist/types/server/infra/db/mapper/SomaMapperHooks.d.ts +0 -12
- package/dist/types/server/infra/db/query/SomaQuery.d.ts +0 -42
- package/dist/types/server/infra/db/service/SomaDbService.d.ts +0 -24
- package/dist/types/server/infra/db/soma-db.d.ts +0 -45
- package/dist/types/server/infra/db/types.d.ts +0 -18
- package/dist/types/server/ooui.d.ts +0 -18
- package/dist/types/shared/block-errors.d.ts +0 -5
- package/dist/types/shared/component/derive-sample.d.ts +0 -37
- package/dist/types/shared/component/field-lines.d.ts +0 -19
- package/dist/types/shared/container-breakpoints.d.ts +0 -42
- package/dist/types/shared/object-semantics.d.ts +0 -42
- package/dist/types/shared/ooui-declaration.d.ts +0 -135
- package/dist/types/shared/path-algebra.d.ts +0 -56
- package/dist/types/shared/types/adaptive.types.d.ts +0 -88
- package/dist/types/shared/types/layout-constraint.types.d.ts +0 -53
- package/dist/types/shared/types/reaction.types.d.ts +0 -115
- package/dist/types/shared/types/window.types.d.ts +0 -171
- package/next.config.js +0 -387
- package/proxy.ts +0 -62
|
@@ -1,736 +0,0 @@
|
|
|
1
|
-
// 页面组合层 · 联动契约的编译期裁决(架构 REQ-014 §29.2)。**本层最有价值的闸门。**
|
|
2
|
-
//
|
|
3
|
-
// ── 为什么这个失败模式是静默的 ─────────────────────────────────────
|
|
4
|
-
// 这道闸门防的是一句业务上人人见过的话:**「点了左边列表,右边没反应」**。
|
|
5
|
-
// 它今天只能在运行时被人发现,而且发现它的人查不到任何线索:
|
|
6
|
-
//
|
|
7
|
-
// ① 「没有人监听这个事件」与「这个事件还没发生」在运行期是同一件事——
|
|
8
|
-
// 控制台没有警告、网络面板没有请求、DOM 上什么都不缺。
|
|
9
|
-
// ② 于是排查会从右边那个区域的取数开始查,一路查到接口、查到权限,
|
|
10
|
-
// **而错误在左边那个区域的动词上**:它根本不产生这个事件。
|
|
11
|
-
// ③ 修好之后也没有任何东西能防止它再来一次——因为从来没有一处声明
|
|
12
|
-
// 说过「这条线成不成立」是可判定的。
|
|
13
|
-
//
|
|
14
|
-
// 而它**是可判定的**:`boundTo.as` 引用的是语义事件(§16.3 的「体系的公事」),
|
|
15
|
-
// 每个动词在每个控制模型下产生哪些事件是意图层的既有事实(§35.2 的表)。
|
|
16
|
-
// 所以:
|
|
17
|
-
//
|
|
18
|
-
// detail ← list.select list 是 browse,browse(受控型)必然产生 select → 通过(带 caveat)
|
|
19
|
-
// b ← a.select a 是 inspect,inspect 两种模型下都不产生 select → 编译期红
|
|
20
|
-
//
|
|
21
|
-
// ── 三条比原型更紧的地方(原型 `compose-page.mjs` 是移植源,不是判据源)──
|
|
22
|
-
// 1. **事件表不再手抄**。原型的 `PRODUCES` 只列了四个动词,另外四个走
|
|
23
|
-
// `?? []` 兜底,被一律判成不成立——**把正例误判成反例**,而误判的表现是
|
|
24
|
-
// 「作者删掉一条本来对的联动」,没有任何东西会红。本文件全部走
|
|
25
|
-
// `../intent/verb-events` 的真源。
|
|
26
|
-
// 2. **控制模型这一半被接上了**。「browse 产生 select」只在受控型下成立;
|
|
27
|
-
// 自治型的 `QueryConsole` 一辈子 emit 不出 `select`。原型把它记成无条件通过,
|
|
28
|
-
// 于是「声明期绿 → 构件层选了自治型 → 运行期线是死的」是一条全绿路径。
|
|
29
|
-
// 本文件把它记成 `holdsFor: ['controlled']` + 一条 `caveat`,
|
|
30
|
-
// 并允许调用方在构件选定后**喂回控制模型或真实 emit 再核一遍**。
|
|
31
|
-
// 3. **成环被检出**。原型没有这一项(它只跑两区域)。三区域以上
|
|
32
|
-
// `a ← b.select`、`b ← c.pick`、`c ← a.select` 不会抛异常,
|
|
33
|
-
// 运行期表现是互相触发刷新——轻则每次交互多取几轮数,重则页面卡住,
|
|
34
|
-
// 而「页面卡住」指不回任何一句声明。检环照 `component-graph.ts` 的先例,
|
|
35
|
-
// **报出整条回路而不只是「成环了」**:只说成环的话,作者得自己把链条走一遍
|
|
36
|
-
// 才知道该断哪一条。
|
|
37
|
-
//
|
|
38
|
-
// ── 为什么返回 issues 而不是逐条抛 ─────────────────────────────────
|
|
39
|
-
// 照 `validateSemanticRequest` / `verifyTypeTable` 的先例:一页里可能同时有
|
|
40
|
-
// 三条坏联动,逐条抛只能让作者改一条跑一轮。要「编译期必须失败」这条铁律的
|
|
41
|
-
// 硬形态,用 `assertPageComposition`——它把一次列全的 issues 汇成一个错误抛出。
|
|
42
|
-
|
|
43
|
-
// 区域名会成为空间 IR 的节点 id、`ooui:` 的锚点名也就是区域名,三处必须是**同一条**文法
|
|
44
|
-
// (真源在 `shared/ooui-declaration.ts`,空间层与产物层也用它)。
|
|
45
|
-
// 此前本层借空间层那份「字母或数字开头」,产物层是「字母开头」:`1list` 在本层放行、
|
|
46
|
-
// 到产物层才红,而那条错误指着的是派生出来的 `1list-shell`,不是作者写错的那行区域名。
|
|
47
|
-
import {
|
|
48
|
-
SOMA_OOUI_ANCHOR_GRAMMAR,
|
|
49
|
-
SOMA_OOUI_ANCHOR_PATTERN,
|
|
50
|
-
SOMA_OOUI_BINDING_KEYS,
|
|
51
|
-
SOMA_OOUI_LAYOUT_KEYS,
|
|
52
|
-
SOMA_OOUI_SIZINGS,
|
|
53
|
-
findOouiBindingUnknownKey,
|
|
54
|
-
findOouiLayoutProblem,
|
|
55
|
-
isOouiMap,
|
|
56
|
-
} from '../../../shared/ooui-declaration';
|
|
57
|
-
import { describeOouiValue, foldOouiIssues, oouiIssue } from '../diagnostics';
|
|
58
|
-
import type { SomaOouiIssue } from '../diagnostics/issue.types';
|
|
59
|
-
import {
|
|
60
|
-
SOMA_CONTROL_MODELS,
|
|
61
|
-
SOMA_INTERACTION_KINDS,
|
|
62
|
-
isSomaInteractionKind,
|
|
63
|
-
type SomaControlModel,
|
|
64
|
-
type SomaInteractionKind,
|
|
65
|
-
} from '../intent/intent.types';
|
|
66
|
-
import { VERB_EVENTS_BY_MODEL, semanticEnablement } from '../intent/verb-events';
|
|
67
|
-
import { SOMA_VERBS, isSomaVerb, type SomaObject, type SomaVerb } from '../semantic/kernel.types';
|
|
68
|
-
import type {
|
|
69
|
-
SomaBindingVerdict,
|
|
70
|
-
SomaPageCheckOptions,
|
|
71
|
-
SomaPageComposition,
|
|
72
|
-
SomaPageCompositionPlan,
|
|
73
|
-
SomaPageCompositionResult,
|
|
74
|
-
SomaPageDecision,
|
|
75
|
-
SomaRegion,
|
|
76
|
-
} from './page.types';
|
|
77
|
-
|
|
78
|
-
/** 页面区域组的缺省节点 id。区域不得重名于它——见 `SomaPageBudgetOptions.rootId` */
|
|
79
|
-
export const SOMA_PAGE_ROOT_ID = 'page';
|
|
80
|
-
|
|
81
|
-
// ─────────────────────────────────────────────────────────────
|
|
82
|
-
// 事件可得性:唯一判据
|
|
83
|
-
// ─────────────────────────────────────────────────────────────
|
|
84
|
-
|
|
85
|
-
/** 某个控制模型下这个区域会发生哪些事:必然的与可能的 */
|
|
86
|
-
export interface SomaEventAvailability {
|
|
87
|
-
readonly required: readonly SomaInteractionKind[];
|
|
88
|
-
readonly optional: readonly SomaInteractionKind[];
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* 一个 `{动词, 对象}` 在两种控制模型下各产生哪些语义事件。**本层唯一的判据来源。**
|
|
93
|
-
*
|
|
94
|
-
* 两个来源合并,缺一不可:
|
|
95
|
-
* · `VERB_EVENTS_BY_MODEL` —— 动词本质决定的那部分(§35.2);
|
|
96
|
-
* · `semanticEnablement` —— 对象的 `window` 段启用的那部分(§17.2)。
|
|
97
|
-
* 少了它,`monitor` 区域上声明了 `window.selection: all` 之后依然会被判成
|
|
98
|
-
* 「不产生 select」——**把正例误判成反例**,而误判的表现是作者删掉一条本来对的联动。
|
|
99
|
-
*
|
|
100
|
-
* 语义启用的事件只落在它自己的 `requiredFor` 模型上(今天恒为 `controlled`):
|
|
101
|
-
* 自治型自己排序、自己翻页,不需要把意图 emit 出来(§17.2 的能力/事件分家)。
|
|
102
|
-
* 把它同时算进自治型的话,一个自治型区域会被当成「能把排序意图交出去」,
|
|
103
|
-
* 而它交不出来——那正是 §35 修掉的那个判据缺陷换个位置重演。
|
|
104
|
-
*/
|
|
105
|
-
export function producedEvents(
|
|
106
|
-
verb: SomaVerb,
|
|
107
|
-
object: SomaObject,
|
|
108
|
-
): Readonly<Record<SomaControlModel, SomaEventAvailability>> {
|
|
109
|
-
const spec = VERB_EVENTS_BY_MODEL[verb];
|
|
110
|
-
const required: Record<SomaControlModel, Set<SomaInteractionKind>> = {
|
|
111
|
-
autonomous: new Set(spec.autonomous.required),
|
|
112
|
-
controlled: new Set(spec.controlled.required),
|
|
113
|
-
};
|
|
114
|
-
const optional: Record<SomaControlModel, Set<SomaInteractionKind>> = {
|
|
115
|
-
autonomous: new Set(spec.autonomous.optional),
|
|
116
|
-
controlled: new Set(spec.controlled.optional),
|
|
117
|
-
};
|
|
118
|
-
for (const event of semanticEnablement(verb, object).events) {
|
|
119
|
-
for (const model of event.requiredFor) {
|
|
120
|
-
required[model].add(event.kind);
|
|
121
|
-
optional[model].delete(event.kind);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
// 输出序固定为封闭集序:产物要能逐字比对(§19.3 幂等)
|
|
125
|
-
const order = (set: ReadonlySet<SomaInteractionKind>): readonly SomaInteractionKind[] => (
|
|
126
|
-
SOMA_INTERACTION_KINDS.filter((kind) => set.has(kind))
|
|
127
|
-
);
|
|
128
|
-
return {
|
|
129
|
-
autonomous: { required: order(required.autonomous), optional: order(optional.autonomous) },
|
|
130
|
-
controlled: { required: order(required.controlled), optional: order(optional.controlled) },
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
// ─────────────────────────────────────────────────────────────
|
|
135
|
-
// 校验
|
|
136
|
-
// ─────────────────────────────────────────────────────────────
|
|
137
|
-
|
|
138
|
-
const at = (slug: string, rest: string): string => `${slug}.${rest}`;
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* 校验一页的组合声明:形状 → 区域名 → 区域约束 → 动词 → 联动引用 → 成环 → 联动契约。
|
|
142
|
-
*
|
|
143
|
-
* **次序不是随意的**:区域名不合法时后面每一条联动都会指着一个不存在的区域,
|
|
144
|
-
* 一次报出十条互为因果的错误比报一条更难读。所以前置检查一旦有问题就不再往下判,
|
|
145
|
-
* 只把已经确定的那批 issues 返回——这与「一次列全」不冲突:
|
|
146
|
-
* 列全的是**同一层面**的问题,不是把下游的连带反应也列出来。
|
|
147
|
-
*/
|
|
148
|
-
export function validatePageComposition(
|
|
149
|
-
page: SomaPageComposition,
|
|
150
|
-
options: SomaPageCheckOptions = {},
|
|
151
|
-
): SomaPageCompositionResult {
|
|
152
|
-
const issues: SomaOouiIssue[] = [];
|
|
153
|
-
const decisions: SomaPageDecision[] = [];
|
|
154
|
-
|
|
155
|
-
if (page === null || typeof page !== 'object' || Array.isArray(page)) {
|
|
156
|
-
return { plan: null, issues: [shapeIssue('page', '页面组合声明不是映射。', describeOouiValue(page))] };
|
|
157
|
-
}
|
|
158
|
-
const slug = typeof page.slug === 'string' && page.slug.trim() !== '' ? page.slug : '<page>';
|
|
159
|
-
if (typeof page.slug !== 'string' || page.slug.trim() === '') {
|
|
160
|
-
issues.push(shapeIssue('page.slug', 'slug 不是非空字符串。', describeOouiValue(page.slug)));
|
|
161
|
-
}
|
|
162
|
-
if (!Array.isArray(page.regions)) {
|
|
163
|
-
issues.push(shapeIssue('page.regions', 'regions 不是数组。', describeOouiValue(page.regions)));
|
|
164
|
-
return { plan: null, issues };
|
|
165
|
-
}
|
|
166
|
-
if (page.regions.length === 0) {
|
|
167
|
-
issues.push(oouiIssue(
|
|
168
|
-
'OOUI-SEM-REGIONS-EMPTY',
|
|
169
|
-
at(slug, 'regions'),
|
|
170
|
-
'页面组合声明了 regions: [],一个区域都没有。',
|
|
171
|
-
'零区域的页面照常编译、照常上线,产物里 regions 是空数组——'
|
|
172
|
-
+ '而「这一页什么都没演绎」与「这一页的接口还没返回」在浏览器里长得一模一样,'
|
|
173
|
-
+ '既没有异常也没有日志。',
|
|
174
|
-
'至少写一个区域:\n'
|
|
175
|
-
+ " regions:\n"
|
|
176
|
-
+ ' - name: list\n'
|
|
177
|
-
+ ' request: { object: ticket, verb: browse }',
|
|
178
|
-
));
|
|
179
|
-
return { plan: null, issues };
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
// ── ① 区域名:文法与唯一性 ───────────────────────────────────────
|
|
183
|
-
const seen = new Map<string, number>();
|
|
184
|
-
const rootId = SOMA_PAGE_ROOT_ID;
|
|
185
|
-
page.regions.forEach((region, index) => {
|
|
186
|
-
const path = at(slug, `regions[${index}]`);
|
|
187
|
-
if (region === null || typeof region !== 'object' || Array.isArray(region)) {
|
|
188
|
-
issues.push(shapeIssue(path, '区域不是映射。', describeOouiValue(region)));
|
|
189
|
-
return;
|
|
190
|
-
}
|
|
191
|
-
const name = region.name;
|
|
192
|
-
if (typeof name !== 'string' || !SOMA_OOUI_ANCHOR_PATTERN.test(name) || name === rootId) {
|
|
193
|
-
issues.push(oouiIssue(
|
|
194
|
-
'OOUI-SEM-REGION-NAME',
|
|
195
|
-
`${path}.name`,
|
|
196
|
-
name === rootId
|
|
197
|
-
? `区域名 "${name}" 与页面区域组的节点 id 撞车。`
|
|
198
|
-
: `区域名 ${describeOouiValue(name)} 不是合法的节点标识。`,
|
|
199
|
-
'区域名会成为空间 IR 的节点 id 并**原样进 CSS 属性选择器**。'
|
|
200
|
-
+ '带引号或括号会让选择器提前闭合,而被吃掉的那部分规则**不报错**,只是不生效;'
|
|
201
|
-
+ `与根节点 id 撞车则两者共用同一条规则,后解出的覆盖先解出的,`
|
|
202
|
-
+ '表现是「其中一处的宽度莫名其妙跟另一处一样」。',
|
|
203
|
-
`区域名文法:${SOMA_OOUI_ANCHOR_GRAMMAR}(正则 ${SOMA_OOUI_ANCHOR_PATTERN.source}),`
|
|
204
|
-
+ `且不得等于页面区域组的 id "${rootId}"(要改这个 id 走 solvePageBudget 的 rootId 选项):\n`
|
|
205
|
-
+ ` - name: detail\n request: { object: ticket, verb: inspect }`,
|
|
206
|
-
region.request?.src,
|
|
207
|
-
));
|
|
208
|
-
return;
|
|
209
|
-
}
|
|
210
|
-
const first = seen.get(name);
|
|
211
|
-
if (first !== undefined) {
|
|
212
|
-
issues.push(oouiIssue(
|
|
213
|
-
'OOUI-SEM-REGION-DUPLICATE',
|
|
214
|
-
`${path}.name`,
|
|
215
|
-
`区域名 "${name}" 出现了两次(regions[${first}] 与 regions[${index}])。`,
|
|
216
|
-
'重名的两个区域会共用同一个节点 id:布局解与产物选择器完全重合,'
|
|
217
|
-
+ '后注入的那份静默盖住先注入的,而两块都还渲染着——只是其中一块的样式来自另一块。'
|
|
218
|
-
+ '`boundTo` 指向重名区域时更坏:指到哪一个取决于遍历顺序。',
|
|
219
|
-
`给其中一个换个名字(如 "${name}2")——两个区域必须能被分别指到。`,
|
|
220
|
-
region.request?.src,
|
|
221
|
-
));
|
|
222
|
-
return;
|
|
223
|
-
}
|
|
224
|
-
seen.set(name, index);
|
|
225
|
-
});
|
|
226
|
-
if (issues.length > 0) return { plan: null, issues };
|
|
227
|
-
|
|
228
|
-
// ── ①½ 区域约束:键白名单 + 值的原始类型 + sizing 三档 ───────────────
|
|
229
|
-
// 约束会被摊进空间 IR 的叶子,而叶子上还有 `id` / `kind` / `anchor` / `classes` 这些结构键。
|
|
230
|
-
// 放行一个 `layout: { id: x }`,叶子就被改了名,求解结果里再也找不到这个区域——
|
|
231
|
-
// 此前那里读成 0rem,于是这个区域静默降到最窄的候选,页面照常渲染。
|
|
232
|
-
// sizing 写出闭集(`fil`)是同一族:求解器既不按 fixed 也不按 fill 处理,区域缩到下界。
|
|
233
|
-
for (const region of page.regions) {
|
|
234
|
-
const layout: unknown = region.layout;
|
|
235
|
-
if (layout === undefined) continue;
|
|
236
|
-
const path = at(slug, `${region.name}.layout`);
|
|
237
|
-
if (!isOouiMap(layout)) {
|
|
238
|
-
issues.push(layoutIssue(
|
|
239
|
-
region,
|
|
240
|
-
path,
|
|
241
|
-
`区域 "${region.name}" 的 layout 不是映射(收到 ${describeOouiValue(layout)})。`,
|
|
242
|
-
));
|
|
243
|
-
continue;
|
|
244
|
-
}
|
|
245
|
-
const problem = findOouiLayoutProblem(layout);
|
|
246
|
-
if (problem === undefined) continue;
|
|
247
|
-
if (problem.kind === 'sizing-unknown') {
|
|
248
|
-
issues.push(sizingIssue(region, `${path}.sizing`, layout.sizing));
|
|
249
|
-
continue;
|
|
250
|
-
}
|
|
251
|
-
issues.push(layoutIssue(
|
|
252
|
-
region,
|
|
253
|
-
`${path}.${problem.key}`,
|
|
254
|
-
problem.kind === 'unknown-key'
|
|
255
|
-
? `区域 "${region.name}" 的 layout 里有约束键之外的 "${problem.key}"。`
|
|
256
|
-
: `区域 "${region.name}" 的 layout.${problem.key} 应当是 ${problem.expected}`
|
|
257
|
-
+ `(收到 ${describeOouiValue(layout[problem.key])})。`,
|
|
258
|
-
));
|
|
259
|
-
}
|
|
260
|
-
if (issues.length > 0) return { plan: null, issues };
|
|
261
|
-
|
|
262
|
-
const byName = new Map<string, SomaRegion>();
|
|
263
|
-
for (const region of page.regions) byName.set(region.name, region);
|
|
264
|
-
const names = page.regions.map((region) => region.name);
|
|
265
|
-
|
|
266
|
-
// ── ② 动词:闭集。不合法的话下面取事件表会取到 undefined ────────
|
|
267
|
-
for (const region of page.regions) {
|
|
268
|
-
if (!isSomaVerb(region.request?.verb)) {
|
|
269
|
-
issues.push(oouiIssue(
|
|
270
|
-
'OOUI-SEM-VERB-UNKNOWN',
|
|
271
|
-
at(slug, `${region.name}.request.verb`),
|
|
272
|
-
`区域 "${region.name}" 的动词是 ${describeOouiValue(region.request?.verb)},不在八动词封闭集里。`,
|
|
273
|
-
'动词是根形态与事件契约的唯一分派依据。取不到它时本层的联动判据会拿一个 '
|
|
274
|
-
+ 'undefined 去查事件表,查不到就退化成「这个区域不产生任何事件」——'
|
|
275
|
-
+ '于是所有指向它的联动被一次性判成不成立,报出来的十条错误全都指错了方向。',
|
|
276
|
-
`八动词:${SOMA_VERBS.join(' / ')}。`,
|
|
277
|
-
region.request?.src,
|
|
278
|
-
));
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
if (issues.length > 0) return { plan: null, issues };
|
|
282
|
-
|
|
283
|
-
// ── ③ 联动引用:区域存在、事件名在闭集里 ─────────────────────────
|
|
284
|
-
for (const region of page.regions) {
|
|
285
|
-
const binding = region.boundTo;
|
|
286
|
-
if (binding === undefined) continue;
|
|
287
|
-
const path = at(slug, `${region.name}.boundTo`);
|
|
288
|
-
if (binding === null || typeof binding !== 'object' || Array.isArray(binding)) {
|
|
289
|
-
issues.push(shapeIssue(path, 'boundTo 不是映射(至少含 region 与 as)。', describeOouiValue(binding)));
|
|
290
|
-
continue;
|
|
291
|
-
}
|
|
292
|
-
// 键闭集与 `ooui:` 的 `bound_to` 同一份(`SOMA_OOUI_BINDING_KEYS`):多出来的键此前没有任何一层读,
|
|
293
|
-
// 作者以为钉住了的那一项从声明那一刻起就不存在。
|
|
294
|
-
const unknownKey = findOouiBindingUnknownKey(binding);
|
|
295
|
-
if (unknownKey !== undefined) {
|
|
296
|
-
issues.push(bindingKeyIssue(region, `${path}.${unknownKey}`, unknownKey));
|
|
297
|
-
continue;
|
|
298
|
-
}
|
|
299
|
-
if (typeof binding.region !== 'string' || !byName.has(binding.region)) {
|
|
300
|
-
issues.push(oouiIssue(
|
|
301
|
-
'OOUI-SEM-BINDING-REGION-UNKNOWN',
|
|
302
|
-
`${path}.region`,
|
|
303
|
-
`联动源 ${describeOouiValue(binding.region)} 不是本页任何一个区域。`,
|
|
304
|
-
'指不到区域的联动**不会抛异常**:它只是一条永远不会被触发的线。'
|
|
305
|
-
+ '页面照常渲染、左边照常能点,右边永远停在初始态——'
|
|
306
|
-
+ '而「没有人监听这个事件」与「这个事件还没发生」在运行期是同一件事。',
|
|
307
|
-
`本页区域:${names.join(' / ')}。写成其中之一:\n`
|
|
308
|
-
+ ` boundTo: { region: ${names[0]}, as: select }`,
|
|
309
|
-
region.request?.src,
|
|
310
|
-
));
|
|
311
|
-
continue;
|
|
312
|
-
}
|
|
313
|
-
if (binding.region === region.name) {
|
|
314
|
-
issues.push(cycleIssue(slug, [region.name, region.name], region));
|
|
315
|
-
continue;
|
|
316
|
-
}
|
|
317
|
-
if (!isSomaInteractionKind(binding.as)) {
|
|
318
|
-
issues.push(oouiIssue(
|
|
319
|
-
'OOUI-SEM-BINDING-EVENT-UNKNOWN',
|
|
320
|
-
`${path}.as`,
|
|
321
|
-
`联动事件 ${describeOouiValue(binding.as)} 不在语义事件封闭集里。`,
|
|
322
|
-
'语义事件名是**体系的公事**(§16.3),组件的 emit 名是组件库的私事。'
|
|
323
|
-
+ '把 `row_open` 写成 `rowOpen` 的表现不是报错,而是这条线接到了一个'
|
|
324
|
-
+ '没人监听的名字上——与「组件根本没 emit」在运行期完全无法区分。',
|
|
325
|
-
`语义事件闭集(受控语汇在前、自治语汇在后):\n ${SOMA_INTERACTION_KINDS.join(' / ')}`,
|
|
326
|
-
region.request?.src,
|
|
327
|
-
));
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
if (issues.length > 0) return { plan: null, issues };
|
|
331
|
-
|
|
332
|
-
// ── ④ 成环 ───────────────────────────────────────────────────────
|
|
333
|
-
const { order, cycles } = topoOrder(names, byName);
|
|
334
|
-
for (const cycle of cycles) {
|
|
335
|
-
issues.push(cycleIssue(slug, cycle, byName.get(cycle[0])));
|
|
336
|
-
}
|
|
337
|
-
if (issues.length > 0) return { plan: null, issues };
|
|
338
|
-
|
|
339
|
-
// ── ⑤ 联动契约:源区域的动词到底产不产生这个事件 ─────────────────
|
|
340
|
-
const bindings: SomaBindingVerdict[] = [];
|
|
341
|
-
for (const region of page.regions) {
|
|
342
|
-
const binding = region.boundTo;
|
|
343
|
-
if (binding === undefined) continue;
|
|
344
|
-
const source = byName.get(binding.region)!;
|
|
345
|
-
const sourceVerb = source.request.verb;
|
|
346
|
-
const available = producedEvents(sourceVerb, source.request.object);
|
|
347
|
-
|
|
348
|
-
const requiredUnder = SOMA_CONTROL_MODELS.filter(
|
|
349
|
-
(model) => available[model].required.includes(binding.as),
|
|
350
|
-
);
|
|
351
|
-
const optionalUnder = SOMA_CONTROL_MODELS.filter(
|
|
352
|
-
(model) => available[model].optional.includes(binding.as),
|
|
353
|
-
);
|
|
354
|
-
let holdsFor = SOMA_CONTROL_MODELS.filter(
|
|
355
|
-
(model) => requiredUnder.includes(model) || optionalUnder.includes(model),
|
|
356
|
-
);
|
|
357
|
-
|
|
358
|
-
if (holdsFor.length === 0) {
|
|
359
|
-
issues.push(unsupportedIssue({
|
|
360
|
-
slug, region, binding, source, sourceVerb, available, names, byName,
|
|
361
|
-
}));
|
|
362
|
-
continue;
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
// 第二遍:构件选定之后收紧。**给了才收,不给不假装核过**。
|
|
366
|
-
let confirmedBy: SomaBindingVerdict['confirmedBy'];
|
|
367
|
-
const model = options.controlModels?.[source.name];
|
|
368
|
-
if (model !== undefined) {
|
|
369
|
-
holdsFor = holdsFor.filter((candidate) => candidate === model);
|
|
370
|
-
confirmedBy = 'control-model';
|
|
371
|
-
if (holdsFor.length === 0) {
|
|
372
|
-
issues.push(narrowedIssue({ slug, region, binding, source, sourceVerb, model, available }));
|
|
373
|
-
continue;
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
const emits = options.emits?.[source.name];
|
|
377
|
-
if (emits !== undefined) {
|
|
378
|
-
confirmedBy = 'emits';
|
|
379
|
-
if (!emits.includes(binding.as)) {
|
|
380
|
-
issues.push(emitsIssue({ slug, region, binding, source, emits }));
|
|
381
|
-
continue;
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
const caveat = caveatFor({
|
|
386
|
-
source: source.name, sourceVerb, as: binding.as, holdsFor, requiredUnder, confirmedBy,
|
|
387
|
-
});
|
|
388
|
-
bindings.push({
|
|
389
|
-
region: region.name,
|
|
390
|
-
source: source.name,
|
|
391
|
-
as: binding.as,
|
|
392
|
-
sourceVerb,
|
|
393
|
-
requiredUnder,
|
|
394
|
-
optionalUnder,
|
|
395
|
-
holdsFor,
|
|
396
|
-
...(caveat !== undefined ? { caveat } : {}),
|
|
397
|
-
...(confirmedBy !== undefined ? { confirmedBy } : {}),
|
|
398
|
-
...(region.request.src !== undefined ? { src: region.request.src } : {}),
|
|
399
|
-
});
|
|
400
|
-
}
|
|
401
|
-
if (issues.length > 0) return { plan: null, issues };
|
|
402
|
-
|
|
403
|
-
// ── ⑥ 把「哪一半没核」记进产物:不给则不核,且不假装核过了 ───────
|
|
404
|
-
const unchecked = names.filter((name) => (
|
|
405
|
-
options.controlModels?.[name] === undefined && options.emits?.[name] === undefined
|
|
406
|
-
));
|
|
407
|
-
if (bindings.length > 0 && unchecked.length > 0) {
|
|
408
|
-
decisions.push({
|
|
409
|
-
path: at(slug, 'bindings'),
|
|
410
|
-
conclusion: `${unchecked.length} 个区域只跑了声明期这一遍:`
|
|
411
|
-
+ `${unchecked.join(' / ')} 的控制模型与真实 emit 都没喂回来,`
|
|
412
|
-
+ '带 caveat 的联动尚未收紧',
|
|
413
|
-
rule: 'options.controlModels / options.emits 缺席',
|
|
414
|
-
origin: 'defaulted',
|
|
415
|
-
});
|
|
416
|
-
}
|
|
417
|
-
if (bindings.length === 0) {
|
|
418
|
-
decisions.push({
|
|
419
|
-
path: at(slug, 'bindings'),
|
|
420
|
-
conclusion: '本页没有任何区域间联动——各区域各自独立演绎',
|
|
421
|
-
rule: 'boundTo 未声明',
|
|
422
|
-
origin: 'declared',
|
|
423
|
-
});
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
return {
|
|
427
|
-
plan: { slug, regions: names, bindings, order, decisions },
|
|
428
|
-
issues: [],
|
|
429
|
-
};
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
/**
|
|
433
|
-
* 校验,不过就抛(铁律二的硬形态)。
|
|
434
|
-
*
|
|
435
|
-
* 折叠口径(码取第一条、一次列全、单条时直接给那一条的修法)归横切层
|
|
436
|
-
* `foldOouiIssues` 一处——此前这里与编排层、表层入口各折叠一遍,措辞已经漂开。
|
|
437
|
-
*/
|
|
438
|
-
export function assertPageComposition(
|
|
439
|
-
page: SomaPageComposition,
|
|
440
|
-
options: SomaPageCheckOptions = {},
|
|
441
|
-
): SomaPageCompositionPlan {
|
|
442
|
-
const result = validatePageComposition(page, options);
|
|
443
|
-
if (result.plan !== null) return result.plan;
|
|
444
|
-
throw foldOouiIssues({
|
|
445
|
-
layer: 'semantic',
|
|
446
|
-
headline: '页面组合声明不成立',
|
|
447
|
-
issues: result.issues,
|
|
448
|
-
src: { file: `<page:${typeof page?.slug === 'string' ? page.slug : '?'}>`, path: 'regions' },
|
|
449
|
-
fallback: {
|
|
450
|
-
code: 'OOUI-SEM-PAGE-SHAPE',
|
|
451
|
-
problem: '联动不成立时产出的是一个能渲染、能点、看着正常的页面,只是点了没反应。',
|
|
452
|
-
},
|
|
453
|
-
});
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
// ─────────────────────────────────────────────────────────────
|
|
457
|
-
// 内部
|
|
458
|
-
// ─────────────────────────────────────────────────────────────
|
|
459
|
-
|
|
460
|
-
/** 区域约束的形状拒收。码仍是 `OOUI-SEM-PAGE-SHAPE`(形状问题),修法专说约束的写法 */
|
|
461
|
-
function layoutIssue(region: SomaRegion, path: string, situation: string): SomaOouiIssue {
|
|
462
|
-
return oouiIssue(
|
|
463
|
-
'OOUI-SEM-PAGE-SHAPE',
|
|
464
|
-
path,
|
|
465
|
-
situation,
|
|
466
|
-
'区域约束会被摊进空间 IR 的叶子,而叶子上还有 id / kind / anchor / classes 这些结构键:'
|
|
467
|
-
+ '约束键之外的键要么被静默丢弃,要么顶掉结构键——`layout: { id: x }` 会把叶子改名,'
|
|
468
|
-
+ '求解结果里从此找不到这个区域,而页面照常渲染。',
|
|
469
|
-
`区域约束只收 ${SOMA_OOUI_LAYOUT_KEYS.join(' / ')}(长度写带单位的字符串,priority 写数字):\n`
|
|
470
|
-
+ ` { name: '${region.name}', request: …, layout: { sizing: 'fill', min: '10rem', priority: 750 } }`,
|
|
471
|
-
region.request?.src,
|
|
472
|
-
);
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
/**
|
|
476
|
-
* 区域约束的 sizing 不在三档里。码是 `OOUI-SPA-SIZING-UNKNOWN`——被违反的是空间层的闭集
|
|
477
|
-
* (前缀按「谁的契约」取),发现它的是本层:在声明期指着那一行报,而不是等 IR 树求解时报一个
|
|
478
|
-
* 指着 `page.<区域名>` 的路径。
|
|
479
|
-
*/
|
|
480
|
-
function sizingIssue(region: SomaRegion, path: string, got: unknown): SomaOouiIssue {
|
|
481
|
-
return oouiIssue(
|
|
482
|
-
'OOUI-SPA-SIZING-UNKNOWN',
|
|
483
|
-
path,
|
|
484
|
-
`区域 "${region.name}" 的 layout.sizing 是 ${describeOouiValue(got)},不在尺寸意图三档里。`,
|
|
485
|
-
'闭集之外的 sizing 既不是 fixed(按 width 定宽)也不是 fill(分余量),求解器只剩「从 min 起步」一条路:'
|
|
486
|
-
+ '这个区域静默缩到下界(没写 min 就是 0rem),构件选型随之降到最窄的候选——页面照常渲染。',
|
|
487
|
-
`sizing 只能是 ${SOMA_OOUI_SIZINGS.join(' / ')};省略即 fill(与其余区域等分):\n`
|
|
488
|
-
+ ` { name: '${region.name}', request: …, layout: { sizing: 'fill', min: '10rem', priority: 750 } }`,
|
|
489
|
-
region.request?.src,
|
|
490
|
-
);
|
|
491
|
-
}
|
|
492
|
-
|
|
493
|
-
/** `boundTo` 里有 `region` / `as` 之外的键 */
|
|
494
|
-
function bindingKeyIssue(region: SomaRegion, path: string, key: string): SomaOouiIssue {
|
|
495
|
-
return oouiIssue(
|
|
496
|
-
'OOUI-SEM-BINDING-KEY-UNKNOWN',
|
|
497
|
-
path,
|
|
498
|
-
`区域 "${region.name}" 的 boundTo 里有闭集之外的键 "${key}"。`,
|
|
499
|
-
'联动只认两项:源区域(region)与语义事件(as)。多出来的键没有任何一层会读——'
|
|
500
|
-
+ '作者以为钉住了的那一项(比如组件的 emit 名)从声明那一刻起就不存在,'
|
|
501
|
-
+ '而「写了没生效」与「这个能力不存在」在页面上分不开。',
|
|
502
|
-
`boundTo 只收 ${SOMA_OOUI_BINDING_KEYS.join(' / ')};as 写语义事件名,组件的 emit 名由候选表的 eventMap 接:\n`
|
|
503
|
-
+ ` { name: '${region.name}', request: …, boundTo: { region: 'list', as: 'select' } }`,
|
|
504
|
-
region.request?.src,
|
|
505
|
-
);
|
|
506
|
-
}
|
|
507
|
-
|
|
508
|
-
function shapeIssue(path: string, situation: string, got: string): SomaOouiIssue {
|
|
509
|
-
return oouiIssue(
|
|
510
|
-
'OOUI-SEM-PAGE-SHAPE',
|
|
511
|
-
path,
|
|
512
|
-
`${situation}(收到 ${got})`,
|
|
513
|
-
'形状不对的那一段会被整条跳过——页面照常编译、照常上线,只是少了一块或少了一条联动,'
|
|
514
|
-
+ '而「少一块」与「这一块本来就没写」长得一模一样,没有任何日志。',
|
|
515
|
-
'页面组合的形状:\n'
|
|
516
|
-
+ ' { slug: \'/tickets\', regions: [\n'
|
|
517
|
-
+ ' { name: \'list\', request: { object: ticket, verb: \'browse\' } },\n'
|
|
518
|
-
+ ' { name: \'detail\', request: { object: ticket, verb: \'inspect\' },\n'
|
|
519
|
-
+ ' boundTo: { region: \'list\', as: \'select\' } },\n'
|
|
520
|
-
+ ' ] }',
|
|
521
|
-
);
|
|
522
|
-
}
|
|
523
|
-
|
|
524
|
-
/**
|
|
525
|
-
* 联动图的拓扑序 + 检环。照 `core/build/component/component-graph.ts` 的先例:
|
|
526
|
-
* **报出整条回路而不只是「成环了」**——只说成环的话,作者得自己把链条走一遍
|
|
527
|
-
* 才知道该断哪一条。
|
|
528
|
-
*
|
|
529
|
-
* 每个区域至多一个 `boundTo`(§29.1),所以这是一张函数图,一条回路只会被报一次。
|
|
530
|
-
* 仍然写成通用 DFS 而不是「顺着单链走」:`boundTo` 哪天变成数组时,
|
|
531
|
-
* 单链版本会**静默只看第一条**,而那正是本文件在防的那类失效。
|
|
532
|
-
*/
|
|
533
|
-
function topoOrder(
|
|
534
|
-
names: readonly string[],
|
|
535
|
-
byName: ReadonlyMap<string, SomaRegion>,
|
|
536
|
-
): { order: string[]; cycles: string[][] } {
|
|
537
|
-
const order: string[] = [];
|
|
538
|
-
const cycles: string[][] = [];
|
|
539
|
-
const state = new Map<string, 'visiting' | 'done'>();
|
|
540
|
-
const stack: string[] = [];
|
|
541
|
-
|
|
542
|
-
const visit = (name: string): void => {
|
|
543
|
-
const seen = state.get(name);
|
|
544
|
-
if (seen === 'done') return;
|
|
545
|
-
if (seen === 'visiting') {
|
|
546
|
-
const from = stack.indexOf(name);
|
|
547
|
-
if (from !== -1) cycles.push([...stack.slice(from), name]);
|
|
548
|
-
return;
|
|
549
|
-
}
|
|
550
|
-
state.set(name, 'visiting');
|
|
551
|
-
stack.push(name);
|
|
552
|
-
const source = byName.get(name)?.boundTo?.region;
|
|
553
|
-
if (source !== undefined && byName.has(source)) visit(source);
|
|
554
|
-
stack.pop();
|
|
555
|
-
state.set(name, 'done');
|
|
556
|
-
order.push(name);
|
|
557
|
-
};
|
|
558
|
-
|
|
559
|
-
for (const name of names) visit(name);
|
|
560
|
-
return { order, cycles };
|
|
561
|
-
}
|
|
562
|
-
|
|
563
|
-
function cycleIssue(slug: string, cycle: readonly string[], region?: SomaRegion): SomaOouiIssue {
|
|
564
|
-
const loop = cycle.join(' ← ');
|
|
565
|
-
const selfLoop = cycle.length === 2 && cycle[0] === cycle[1];
|
|
566
|
-
return oouiIssue(
|
|
567
|
-
'OOUI-SEM-BINDING-CYCLE',
|
|
568
|
-
at(slug, `${cycle[0]}.boundTo`),
|
|
569
|
-
selfLoop
|
|
570
|
-
? `区域 "${cycle[0]}" 的联动指向它自己。`
|
|
571
|
-
: `区域联动成环:${loop}。`,
|
|
572
|
-
'成环的联动图**不会抛异常**。运行期表现是这几个区域互相触发对方刷新:'
|
|
573
|
-
+ '轻则每次交互多取几轮数(用户只觉得「有点卡」),重则死循环——'
|
|
574
|
-
+ '而死循环在浏览器里表现为「页面卡住」,指不回任何一句声明。'
|
|
575
|
-
+ '指向自己的那条更隐蔽:它的输入是它自己的输出,第一次交互之后就再也不会稳定下来。',
|
|
576
|
-
selfLoop
|
|
577
|
-
? `删掉这条 boundTo,或把 region 改成**另一个**区域的名字——`
|
|
578
|
-
+ '一个区域的输入不能是它自己的输出。'
|
|
579
|
-
: `把回路上任意一条边断开。整条回路:${loop}。\n`
|
|
580
|
-
+ ` 断哪一条的判据:谁是这一页的**主区**(用户先操作的那个),主区不该有 boundTo。`,
|
|
581
|
-
region?.request.src,
|
|
582
|
-
);
|
|
583
|
-
}
|
|
584
|
-
|
|
585
|
-
interface UnsupportedInput {
|
|
586
|
-
slug: string;
|
|
587
|
-
region: SomaRegion;
|
|
588
|
-
binding: { region: string; as: SomaInteractionKind };
|
|
589
|
-
source: SomaRegion;
|
|
590
|
-
sourceVerb: SomaVerb;
|
|
591
|
-
available: Readonly<Record<SomaControlModel, SomaEventAvailability>>;
|
|
592
|
-
names: readonly string[];
|
|
593
|
-
byName: ReadonlyMap<string, SomaRegion>;
|
|
594
|
-
}
|
|
595
|
-
|
|
596
|
-
/** §29.2 的那条红线:源区域的动词在**两种控制模型下都**不产生这个事件 */
|
|
597
|
-
function unsupportedIssue(input: UnsupportedInput): SomaOouiIssue {
|
|
598
|
-
const { slug, region, binding, source, sourceVerb, available, names, byName } = input;
|
|
599
|
-
const produces = SOMA_CONTROL_MODELS
|
|
600
|
-
.map((model) => {
|
|
601
|
-
const list = [...available[model].required, ...available[model].optional];
|
|
602
|
-
return ` ${model}:${list.length > 0 ? list.join(' / ') : '(一个都不产生)'}`;
|
|
603
|
-
})
|
|
604
|
-
.join('\n');
|
|
605
|
-
// 「本页哪些区域产生这个事件」——不给这一行的话,作者只知道错了,不知道改成什么。
|
|
606
|
-
const alternatives = names.filter((name) => {
|
|
607
|
-
if (name === region.name) return false;
|
|
608
|
-
const other = byName.get(name)!;
|
|
609
|
-
const events = producedEvents(other.request.verb, other.request.object);
|
|
610
|
-
return SOMA_CONTROL_MODELS.some(
|
|
611
|
-
(model) => events[model].required.includes(binding.as) || events[model].optional.includes(binding.as),
|
|
612
|
-
);
|
|
613
|
-
});
|
|
614
|
-
return oouiIssue(
|
|
615
|
-
'OOUI-SEM-BINDING-UNSUPPORTED',
|
|
616
|
-
at(slug, `${region.name}.boundTo.as`),
|
|
617
|
-
`区域 "${region.name}" 监听 "${source.name}" 的 ${binding.as} 事件,`
|
|
618
|
-
+ `但 "${source.name}" 的动词是 ${sourceVerb}——它在两种控制模型下都不产生 ${binding.as}。`,
|
|
619
|
-
'这条线永远不会被触发,而**没有任何东西会报错**:页面照常编译、两个区域照常渲染、'
|
|
620
|
-
+ `点 "${source.name}" 照常有 hover,只是 "${region.name}" 永远不动。`
|
|
621
|
-
+ '「没有人监听这个事件」与「这个事件还没发生」在运行期是同一件事,'
|
|
622
|
-
+ '所以排查会从被绑区域的取数开始,一路查到接口、查到权限,而错在这一行。',
|
|
623
|
-
`三选一:\n`
|
|
624
|
-
+ ` (a) 改成 "${source.name}" 真会产生的事件:\n${produces}\n`
|
|
625
|
-
+ (alternatives.length > 0
|
|
626
|
-
? ` (b) 改成本页真会产生 ${binding.as} 的区域:${alternatives.join(' / ')}\n`
|
|
627
|
-
: ` (b) 本页没有任何区域产生 ${binding.as}——要它就得有一个动词产生它的区域。\n`)
|
|
628
|
-
+ ` (c) 换 "${source.name}" 的动词:${verbsProducing(binding.as).join(' / ') || '(八动词都不产生它,它只由对象的 window 段启用)'}`,
|
|
629
|
-
region.request.src,
|
|
630
|
-
);
|
|
631
|
-
}
|
|
632
|
-
|
|
633
|
-
/** 哪些动词(不看对象语义)会产生这个事件——建议里要报得出来,作者才知道该换成什么 */
|
|
634
|
-
function verbsProducing(kind: SomaInteractionKind): readonly SomaVerb[] {
|
|
635
|
-
return SOMA_VERBS.filter((verb) => SOMA_CONTROL_MODELS.some((model) => {
|
|
636
|
-
const spec = VERB_EVENTS_BY_MODEL[verb][model];
|
|
637
|
-
return spec.required.includes(kind) || spec.optional.includes(kind);
|
|
638
|
-
}));
|
|
639
|
-
}
|
|
640
|
-
|
|
641
|
-
interface NarrowedInput {
|
|
642
|
-
slug: string;
|
|
643
|
-
region: SomaRegion;
|
|
644
|
-
binding: { region: string; as: SomaInteractionKind };
|
|
645
|
-
source: SomaRegion;
|
|
646
|
-
sourceVerb: SomaVerb;
|
|
647
|
-
model: SomaControlModel;
|
|
648
|
-
available: Readonly<Record<SomaControlModel, SomaEventAvailability>>;
|
|
649
|
-
}
|
|
650
|
-
|
|
651
|
-
/**
|
|
652
|
-
* 第二遍收紧后才发作的那一条:声明期通过了,构件层选了另一种控制模型的候选。
|
|
653
|
-
*
|
|
654
|
-
* **这是文件头 ② 那条全绿路径的落点**,也是本层与原型最大的差别。
|
|
655
|
-
*/
|
|
656
|
-
function narrowedIssue(input: NarrowedInput): SomaOouiIssue {
|
|
657
|
-
const { slug, region, binding, source, sourceVerb, model, available } = input;
|
|
658
|
-
const other: SomaControlModel = model === 'controlled' ? 'autonomous' : 'controlled';
|
|
659
|
-
const list = [...available[model].required, ...available[model].optional];
|
|
660
|
-
return oouiIssue(
|
|
661
|
-
'OOUI-SEM-BINDING-UNSUPPORTED',
|
|
662
|
-
at(slug, `${region.name}.boundTo.as`),
|
|
663
|
-
`区域 "${region.name}" 监听 "${source.name}" 的 ${binding.as}:`
|
|
664
|
-
+ `${sourceVerb} 只在 ${other} 型下产生它,而构件层给 "${source.name}" 选中的是 ${model} 型组件。`,
|
|
665
|
-
'声明期这条联动是通过的——「动词产生这个事件」这句话本身没错,'
|
|
666
|
-
+ '错在它**只在另一种控制模型下**成立。自治型组件自己取数、自己翻页,'
|
|
667
|
-
+ '它的语汇是过去式的完成通知(loaded / row_open / action_done),'
|
|
668
|
-
+ '永远 emit 不出进行时的意图事件。于是这条线在运行期是死的,'
|
|
669
|
-
+ '而声明、产物、单测三处全绿。',
|
|
670
|
-
`三选一:\n`
|
|
671
|
-
+ ` (a) 改成 ${model} 型下真会产生的事件:${list.length > 0 ? list.join(' / ') : '(一个都不产生)'}\n`
|
|
672
|
-
+ ` (b) 让 "${source.name}" 落到 ${other} 型组件上——`
|
|
673
|
-
+ `给该区域的请求加 form 逃生门,或在 env.availableComponents 里把 ${model} 型候选摘掉;\n`
|
|
674
|
-
+ ` (c) 这条联动确实不该有,删掉 boundTo。`,
|
|
675
|
-
region.request.src,
|
|
676
|
-
);
|
|
677
|
-
}
|
|
678
|
-
|
|
679
|
-
interface EmitsInput {
|
|
680
|
-
slug: string;
|
|
681
|
-
region: SomaRegion;
|
|
682
|
-
binding: { region: string; as: SomaInteractionKind };
|
|
683
|
-
source: SomaRegion;
|
|
684
|
-
emits: readonly SomaInteractionKind[];
|
|
685
|
-
}
|
|
686
|
-
|
|
687
|
-
/** 最紧的一道:选中组件的 eventMap 压根没接这个语义事件 */
|
|
688
|
-
function emitsIssue(input: EmitsInput): SomaOouiIssue {
|
|
689
|
-
const { slug, region, binding, source, emits } = input;
|
|
690
|
-
return oouiIssue(
|
|
691
|
-
'OOUI-SEM-BINDING-UNSUPPORTED',
|
|
692
|
-
at(slug, `${region.name}.boundTo.as`),
|
|
693
|
-
`区域 "${region.name}" 监听 "${source.name}" 的 ${binding.as},`
|
|
694
|
-
+ `但构件层给 "${source.name}" 选中的组件只路由出 `
|
|
695
|
-
+ `${emits.length > 0 ? emits.join(' / ') : '(一个语义事件都没有)'}。`,
|
|
696
|
-
'动词层面这条联动成立,组件层面不成立:候选表的 eventMap 没有把该组件的某个 emit '
|
|
697
|
-
+ `接到 ${binding.as} 上。表现与「组件根本没 emit」完全一样——点了没反应,`
|
|
698
|
-
+ '而候选表看着完全正常(漏接的那个 emit 躺在候选的 `unmappedEmits` 里,那只是告警面)。',
|
|
699
|
-
`三选一:\n`
|
|
700
|
-
+ ` (a) 在候选表里把该组件的对应 emit 接上:eventMap: { <emit 名>: '${binding.as}' }\n`
|
|
701
|
-
+ ` (b) 改成它真会路由出的事件:${emits.join(' / ') || '(没有)'}\n`
|
|
702
|
-
+ ` (c) 换一个能产生 ${binding.as} 的组件(收窄 env.availableComponents,或给该区域写 form 逃生门)。`,
|
|
703
|
-
region.request.src,
|
|
704
|
-
);
|
|
705
|
-
}
|
|
706
|
-
|
|
707
|
-
/** 这条结论在什么条件下会变(铁律四的可读形态)。无条件成立时返回 undefined */
|
|
708
|
-
function caveatFor(input: {
|
|
709
|
-
source: string;
|
|
710
|
-
sourceVerb: SomaVerb;
|
|
711
|
-
as: SomaInteractionKind;
|
|
712
|
-
holdsFor: readonly SomaControlModel[];
|
|
713
|
-
requiredUnder: readonly SomaControlModel[];
|
|
714
|
-
confirmedBy: SomaBindingVerdict['confirmedBy'];
|
|
715
|
-
}): string | undefined {
|
|
716
|
-
const { source, sourceVerb, as, holdsFor, requiredUnder, confirmedBy } = input;
|
|
717
|
-
if (confirmedBy === 'emits') return undefined; // 已按真实 emit 核过,没有可变量了
|
|
718
|
-
const clauses: string[] = [];
|
|
719
|
-
if (confirmedBy !== 'control-model' && holdsFor.length === 1) {
|
|
720
|
-
const only = holdsFor[0];
|
|
721
|
-
const other: SomaControlModel = only === 'controlled' ? 'autonomous' : 'controlled';
|
|
722
|
-
clauses.push(
|
|
723
|
-
`只在 "${source}" 落到${only === 'controlled' ? '受控' : '自治'}型组件时成立:`
|
|
724
|
-
+ `${sourceVerb} 在${other === 'controlled' ? '受控' : '自治'}型下不产生 ${as}`,
|
|
725
|
-
);
|
|
726
|
-
}
|
|
727
|
-
const notGuaranteed = holdsFor.filter((model) => !requiredUnder.includes(model));
|
|
728
|
-
if (notGuaranteed.length > 0) {
|
|
729
|
-
clauses.push(
|
|
730
|
-
`${as} 在 ${notGuaranteed.join(' / ')} 型下只是**可选**事件:`
|
|
731
|
-
+ '成不成立取决于选中组件的 eventMap 有没有接它',
|
|
732
|
-
);
|
|
733
|
-
}
|
|
734
|
-
if (clauses.length === 0) return undefined;
|
|
735
|
-
return `${clauses.join(';')}。构件选定后把 controlModels / emits 喂回 validatePageComposition 再核一遍`;
|
|
736
|
-
}
|