@ccslabs/xtend 0.1.0-rc.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/README.md +4 -0
- package/catalog/component-catalog-coverage.js +2 -0
- package/catalog/epic13-package-export-lock.js +11 -1
- package/catalog/epic13-rmt-production-readiness.js +0 -1
- package/catalog/epic18-rmt-action-effect-runtime.d.ts +36 -0
- package/catalog/epic18-rmt-action-effect-runtime.js +249 -0
- package/catalog/epic18-rmt-app-platform-authoring.d.ts +39 -0
- package/catalog/epic18-rmt-app-platform-authoring.js +319 -0
- package/catalog/epic18-rmt-app-platform-fixture.d.ts +33 -0
- package/catalog/epic18-rmt-app-platform-fixture.js +221 -0
- package/catalog/epic18-rmt-app-platform-release-handoff.d.ts +30 -0
- package/catalog/epic18-rmt-app-platform-release-handoff.js +231 -0
- package/catalog/epic18-rmt-app-platform-tooling.d.ts +38 -0
- package/catalog/epic18-rmt-app-platform-tooling.js +242 -0
- package/catalog/epic18-rmt-component-template-primitives.d.ts +33 -0
- package/catalog/epic18-rmt-component-template-primitives.js +240 -0
- package/catalog/epic18-rmt-dom-descriptor-renderer.d.ts +35 -0
- package/catalog/epic18-rmt-dom-descriptor-renderer.js +232 -0
- package/catalog/epic18-rmt-event-routing-runtime.d.ts +35 -0
- package/catalog/epic18-rmt-event-routing-runtime.js +234 -0
- package/catalog/epic18-rmt-state-selector-runtime.d.ts +34 -0
- package/catalog/epic18-rmt-state-selector-runtime.js +216 -0
- package/catalog/epic18-rmt-surface-resource-graph-runtime.d.ts +36 -0
- package/catalog/epic18-rmt-surface-resource-graph-runtime.js +256 -0
- package/catalog/surface-manager-controller.js +5 -1
- package/catalog/surface-manager-materialization.js +7 -1
- package/catalog/surface-manager-overlay-bridge.js +41 -6
- package/catalog/surface-manager-workbench-fixture.js +1 -1
- package/catalog/surface-type-capability-matrix.d.ts +61 -0
- package/catalog/surface-type-capability-matrix.js +183 -0
- package/catalog/type-exports-rmt.js +37 -1
- package/catalog/type-exports.js +3 -3
- package/components/icon-packs/lucide.js +4 -0
- package/components/manifest.json +2 -0
- package/components/prism-rmt.d.ts +34 -0
- package/components/prism-rmt.js +130 -0
- package/components/xcards.js +15 -0
- package/components/xcode.d.ts +36 -1
- package/components/xcode.js +215 -20
- package/components/xfooter.js +17 -0
- package/components/xheader.js +14 -0
- package/components/xhero.js +16 -1
- package/components/xlink.js +97 -14
- package/components/xmasonry.js +15 -0
- package/components/xplayer.d.ts +44 -2
- package/components/xplayer.js +242 -15
- package/components/xrouter.js +27 -2
- package/components/xsection.js +15 -0
- package/components/xsidepanel.js +10 -2
- package/components/xsurfacemanager-controller.d.ts +2 -1
- package/components/xsurfacemanager-controller.js +27 -3
- package/components/xsurfacemanager.d.ts +2 -0
- package/components/xsurfacemanager.js +20 -8
- package/components/xsurfaceoverlay-bridge.d.ts +20 -5
- package/components/xsurfaceoverlay-bridge.js +114 -18
- package/components/xsurfaceportal.d.ts +29 -0
- package/components/xsurfaceportal.js +122 -0
- package/components/xsurfaceregion.d.ts +50 -0
- package/components/xsurfaceregion.js +285 -0
- package/components/xsurfacewindow.js +2 -1
- package/components/xtooltip.js +89 -23
- package/docs/README.md +222 -298
- package/docs/changelog.md +107 -0
- package/docs/component-catalog-coverage.md +9 -9
- package/docs/component-platform.md +19 -1
- package/docs/component-ux-app-authoring.md +56 -63
- package/docs/components/xcode.md +83 -53
- package/docs/components/xsurfaceportal.md +32 -0
- package/docs/components/xsurfaceregion.md +37 -0
- package/docs/components.md +105 -69
- package/docs/de/README.md +264 -0
- package/docs/de/XTend-ADR.md +221 -0
- package/docs/de/a11y-keyboard-smokes.md +62 -0
- package/docs/de/about.md +18 -0
- package/docs/de/api.md +157 -0
- package/docs/de/best-practices.md +76 -0
- package/docs/de/changelog.md +107 -0
- package/docs/de/component-catalog-coverage.md +58 -0
- package/docs/de/component-lab.md +103 -0
- package/docs/de/component-long-tail-migration.md +41 -0
- package/docs/de/component-platform.md +177 -0
- package/docs/de/component-ux-app-authoring.md +123 -0
- package/docs/de/component-ux-authoring.md +96 -0
- package/docs/de/component-ux-gates.md +45 -0
- package/docs/de/components/x-rmt-lifecycle-demo-build.md +60 -0
- package/docs/de/components/xalert.md +81 -0
- package/docs/de/components/xbutton.md +103 -0
- package/docs/de/components/xcalendar.md +82 -0
- package/docs/de/components/xcards.md +128 -0
- package/docs/de/components/xcheckbox.md +102 -0
- package/docs/de/components/xcode.md +156 -0
- package/docs/de/components/xdialog.md +92 -0
- package/docs/de/components/xdrawer.md +84 -0
- package/docs/de/components/xfooter.md +126 -0
- package/docs/de/components/xform.md +128 -0
- package/docs/de/components/xheader.md +308 -0
- package/docs/de/components/xhero.md +142 -0
- package/docs/de/components/xicon.md +125 -0
- package/docs/de/components/xinput.md +129 -0
- package/docs/de/components/xlightbox.md +98 -0
- package/docs/de/components/xlink.md +109 -0
- package/docs/de/components/xmasonry.md +124 -0
- package/docs/de/components/xmenu.md +158 -0
- package/docs/de/components/xmodal.md +82 -0
- package/docs/de/components/xplayer.md +104 -0
- package/docs/de/components/xpopover.md +67 -0
- package/docs/de/components/xprogress.md +56 -0
- package/docs/de/components/xradio.md +103 -0
- package/docs/de/components/xrouter.md +260 -0
- package/docs/de/components/xsection.md +125 -0
- package/docs/de/components/xselect.md +105 -0
- package/docs/de/components/xsidepanel.md +30 -0
- package/docs/de/components/xspinner.md +102 -0
- package/docs/de/components/xstate.md +148 -0
- package/docs/de/components/xstatus.md +55 -0
- package/docs/de/components/xsummary.md +78 -0
- package/docs/de/components/xsurfacemanager.md +27 -0
- package/docs/de/components/xsurfacewindow.md +21 -0
- package/docs/de/components/xtabs.md +160 -0
- package/docs/de/components/xtextarea.md +98 -0
- package/docs/de/components/xtheme.md +167 -0
- package/docs/de/components/xtoast.md +62 -0
- package/docs/de/components/xtooltip.md +66 -0
- package/docs/de/components/xtype.md +82 -0
- package/docs/de/components/xutils.md +144 -0
- package/docs/de/components/xwriter.md +94 -0
- package/docs/de/components.md +153 -0
- package/docs/de/conditional-network-evidence-ci.md +38 -0
- package/docs/de/conditional-network-evidence.md +50 -0
- package/docs/de/core-migration-guide.md +110 -0
- package/docs/de/design-tokens.md +116 -0
- package/docs/de/docs-rmt-production-hardening.md +31 -0
- package/docs/de/enterprise-adoption.md +413 -0
- package/docs/de/enterprise-component-flex-release-handoff.md +129 -0
- package/docs/de/epic10-platform-gates.md +62 -0
- package/docs/de/epic10-release-handoff.md +81 -0
- package/docs/de/epic11-enterprise-ux-handoff.md +70 -0
- package/docs/de/epic12-rc0-handoff.md +61 -0
- package/docs/de/epic18-media-manager-vendor-upstream.md +318 -0
- package/docs/de/epic18-rmt-app-platform-release-handoff.md +67 -0
- package/docs/de/epic18-vendor-bugfixes.md +34 -0
- package/docs/de/existing-component-metadata.md +67 -0
- package/docs/de/hydration-performance-closure.md +34 -0
- package/docs/de/hydration-policies.md +71 -0
- package/docs/de/known-residual-triage.md +22 -0
- package/docs/de/manifest-import-policy.md +79 -0
- package/docs/de/manifest.md +112 -0
- package/docs/de/motion-contrast.md +67 -0
- package/docs/de/package-export-lock.md +44 -0
- package/docs/de/performance-measurements.md +106 -0
- package/docs/de/performance-regression.md +89 -0
- package/docs/de/performance.md +94 -0
- package/docs/de/previews/README.md +17 -0
- package/docs/de/prod-browser-csp-smokes.md +40 -0
- package/docs/de/public-component-types.md +79 -0
- package/docs/de/quick-start-guide.md +220 -0
- package/docs/de/rc0-adoption-guide.md +102 -0
- package/docs/de/rc0-gate-matrix.md +58 -0
- package/docs/de/rc1-gate-matrix-ci-handoff.md +56 -0
- package/docs/de/rc1-migration-notes.md +69 -0
- package/docs/de/rc1-readiness.md +46 -0
- package/docs/de/release-owner-acceptance.md +56 -0
- package/docs/de/release-report-pack-dry-run-evidence.md +39 -0
- package/docs/de/rmt-action-effect-runtime.md +81 -0
- package/docs/de/rmt-app-platform-authoring.md +54 -0
- package/docs/de/rmt-app-platform-fixture.md +46 -0
- package/docs/de/rmt-app-platform-migration-guide.md +88 -0
- package/docs/de/rmt-app-platform-tooling.md +79 -0
- package/docs/de/rmt-component-template-primitives.md +57 -0
- package/docs/de/rmt-dom-descriptor-renderer.md +64 -0
- package/docs/de/rmt-dsl-authoring-polish.md +145 -0
- package/docs/de/rmt-event-routing-runtime.md +81 -0
- package/docs/de/rmt-first-demo-app.md +77 -0
- package/docs/de/rmt-first-xtend-apps.md +129 -0
- package/docs/de/rmt-kernel-panic-recovery-incident-handoff.md +61 -0
- package/docs/de/rmt-kernel-security-hardening-migration.md +50 -0
- package/docs/de/rmt-kernel-trusted-output-authoring.md +69 -0
- package/docs/de/rmt-language-server.md +234 -0
- package/docs/de/rmt-lifecycle-demo.md +24 -0
- package/docs/de/rmt-linter.md +140 -0
- package/docs/de/rmt-node-ssr-adapter.md +100 -0
- package/docs/de/rmt-php-ssr-adapter.md +120 -0
- package/docs/de/rmt-production-readiness.md +63 -0
- package/docs/de/rmt-state-selector-runtime.md +47 -0
- package/docs/de/rmt-surface-resource-graph-runtime.md +92 -0
- package/docs/de/rmt-tooling-release-gates.md +77 -0
- package/docs/de/rmt-vnext-authoring.md +170 -0
- package/docs/de/rmt-vnext-component-primitives.md +188 -0
- package/docs/de/rmt-vnext-cross-surface-events.md +68 -0
- package/docs/de/rmt-vnext-enterprise-mfe-handoff.md +70 -0
- package/docs/de/rmt-vnext-fabric-bridge-evidence.md +81 -0
- package/docs/de/rmt-vnext-migration-notes.md +62 -0
- package/docs/de/rmt-vnext-primitive-authoring-tooling.md +247 -0
- package/docs/de/rmt-vnext-primitive-grammar-design.md +289 -0
- package/docs/de/rmt-vnext-primitive-lowering.md +108 -0
- package/docs/de/rmt-vnext-primitive-migration.md +119 -0
- package/docs/de/rmt-vnext-primitive-parser-ast.md +76 -0
- package/docs/de/rmt-vnext-primitive-semantic-graph.md +118 -0
- package/docs/de/rmt-vnext-primitives-compiler-backlog.md +739 -0
- package/docs/de/rmt-vnext-release-handoff.md +83 -0
- package/docs/de/rmt-vnext-remote-surfaces.md +90 -0
- package/docs/de/rmt-vnext-source-to-sea-gate.md +612 -0
- package/docs/de/rmt-vnext-surface-registry-enterprise.md +76 -0
- package/docs/de/screenreader-signals.md +56 -0
- package/docs/de/supply-chain-gates.md +100 -0
- package/docs/de/surface-manager-authoring-guide.md +94 -0
- package/docs/de/surface-manager-browser-lab.md +45 -0
- package/docs/de/surface-manager-component-lab.md +43 -0
- package/docs/de/surface-manager-controller.md +66 -0
- package/docs/de/surface-manager-layout-engines.md +32 -0
- package/docs/de/surface-manager-lazy-hydration.md +63 -0
- package/docs/de/surface-manager-migration-guide.md +122 -0
- package/docs/de/surface-manager-native-rmt-surfaces.md +38 -0
- package/docs/de/surface-manager-overlay-bridge.md +53 -0
- package/docs/de/surface-manager-persistence.md +30 -0
- package/docs/de/surface-manager-quality-gates.md +51 -0
- package/docs/de/surface-manager-release-handoff.md +68 -0
- package/docs/de/surface-manager-remote-policy.md +54 -0
- package/docs/de/surface-manager-rmt-authoring.md +102 -0
- package/docs/de/surface-manager-route-lifecycle.md +59 -0
- package/docs/de/surface-manager-runtime-release-handoff.md +69 -0
- package/docs/de/surface-manager-side-panel-runtime.md +36 -0
- package/docs/de/surface-manager-stack-policy.md +39 -0
- package/docs/de/surface-manager-window-runtime.md +47 -0
- package/docs/de/surface-manager-workbench-fixture.md +43 -0
- package/docs/de/third-party-design-authoring.md +406 -0
- package/docs/de/trusted-dom-boundary-browser-proof.md +32 -0
- package/docs/de/trusted-dom-sanitizing.md +110 -0
- package/docs/de/type-exports.md +61 -0
- package/docs/de/typescript-components.md +63 -0
- package/docs/de/visual-browser-regression.md +83 -0
- package/docs/de/visual-owner-artifacts.md +46 -0
- package/docs/de/visual-snapshot-automation.md +87 -0
- package/docs/de/xtend-api-types.md +55 -0
- package/docs/de/xtend-builder-types.md +55 -0
- package/docs/de/xtend-catalog-types.md +44 -0
- package/docs/de/xtend-fabric-rmt-lane-mapping.md +143 -0
- package/docs/de/xtend-fabric.md +474 -0
- package/docs/de/xtend-loader-types.md +58 -0
- package/docs/de/xtend-loader.md +265 -0
- package/docs/de/xtend-policy-types.md +38 -0
- package/docs/de/xtend-rmt-types.md +40 -0
- package/docs/de/xtend-vendor-types.md +36 -0
- package/docs/de/xtendrmt-app-dsl.md +334 -0
- package/docs/de/xtendrmt-migration-guide.md +266 -0
- package/docs/de/xtendrmt-native-authoring.md +333 -0
- package/docs/de/xtendrmt-overview.md +109 -0
- package/docs/de/xtendrmt-parsedown-scheduling.md +301 -0
- package/docs/de/xtendrmt-runtime-bridge.md +155 -0
- package/docs/en/README.md +163 -0
- package/docs/en/XTend-ADR.md +221 -0
- package/docs/en/a11y-keyboard-smokes.md +68 -0
- package/docs/en/about.md +25 -0
- package/docs/en/api.md +171 -0
- package/docs/en/best-practices.md +125 -0
- package/docs/en/changelog.md +104 -0
- package/docs/en/component-catalog-coverage.md +104 -0
- package/docs/en/component-lab.md +103 -0
- package/docs/en/component-long-tail-migration.md +41 -0
- package/docs/en/component-platform.md +243 -0
- package/docs/en/component-ux-app-authoring.md +118 -0
- package/docs/en/component-ux-authoring.md +96 -0
- package/docs/en/component-ux-gates.md +45 -0
- package/docs/en/components/x-rmt-lifecycle-demo-build.md +75 -0
- package/docs/en/components/xalert.md +94 -0
- package/docs/en/components/xbutton.md +118 -0
- package/docs/en/components/xcalendar.md +95 -0
- package/docs/en/components/xcards.md +139 -0
- package/docs/en/components/xcheckbox.md +118 -0
- package/docs/en/components/xcode.md +153 -0
- package/docs/en/components/xdialog.md +108 -0
- package/docs/en/components/xdrawer.md +110 -0
- package/docs/en/components/xfooter.md +138 -0
- package/docs/en/components/xform.md +147 -0
- package/docs/en/components/xheader.md +308 -0
- package/docs/en/components/xhero.md +157 -0
- package/docs/en/components/xicon.md +149 -0
- package/docs/en/components/xinput.md +147 -0
- package/docs/en/components/xlightbox.md +113 -0
- package/docs/en/components/xlink.md +130 -0
- package/docs/en/components/xmasonry.md +136 -0
- package/docs/en/components/xmenu.md +185 -0
- package/docs/en/components/xmodal.md +102 -0
- package/docs/en/components/xplayer.md +114 -0
- package/docs/en/components/xpopover.md +87 -0
- package/docs/en/components/xprogress.md +73 -0
- package/docs/en/components/xradio.md +119 -0
- package/docs/en/components/xrouter.md +260 -0
- package/docs/en/components/xsection.md +136 -0
- package/docs/en/components/xselect.md +122 -0
- package/docs/en/components/xsidepanel.md +48 -0
- package/docs/en/components/xspinner.md +118 -0
- package/docs/en/components/xstate.md +163 -0
- package/docs/en/components/xstatus.md +71 -0
- package/docs/en/components/xsummary.md +90 -0
- package/docs/en/components/xsurfacemanager.md +42 -0
- package/docs/en/components/xsurfacewindow.md +31 -0
- package/docs/en/components/xtabs.md +187 -0
- package/docs/en/components/xtextarea.md +115 -0
- package/docs/en/components/xtheme.md +203 -0
- package/docs/en/components/xtoast.md +78 -0
- package/docs/en/components/xtooltip.md +85 -0
- package/docs/en/components/xtype.md +91 -0
- package/docs/en/components/xutils.md +161 -0
- package/docs/en/components/xwriter.md +106 -0
- package/docs/en/components.md +151 -0
- package/docs/en/conditional-network-evidence-ci.md +38 -0
- package/docs/en/conditional-network-evidence.md +50 -0
- package/docs/en/core-migration-guide.md +110 -0
- package/docs/en/design-tokens.md +137 -0
- package/docs/en/docs-rmt-production-hardening.md +31 -0
- package/docs/en/enterprise-adoption.md +413 -0
- package/docs/en/enterprise-component-flex-release-handoff.md +129 -0
- package/docs/en/epic10-platform-gates.md +62 -0
- package/docs/en/epic10-release-handoff.md +81 -0
- package/docs/en/epic11-enterprise-ux-handoff.md +70 -0
- package/docs/en/epic12-rc0-handoff.md +61 -0
- package/docs/en/epic18-media-manager-vendor-upstream.md +232 -0
- package/docs/en/epic18-rmt-app-platform-release-handoff.md +60 -0
- package/docs/en/epic18-vendor-bugfixes.md +29 -0
- package/docs/en/existing-component-metadata.md +67 -0
- package/docs/en/hydration-performance-closure.md +34 -0
- package/docs/en/hydration-policies.md +75 -0
- package/docs/en/known-residual-triage.md +22 -0
- package/docs/en/manifest-import-policy.md +81 -0
- package/docs/en/manifest.md +135 -0
- package/docs/en/motion-contrast.md +67 -0
- package/docs/en/package-export-lock.md +44 -0
- package/docs/en/performance-measurements.md +106 -0
- package/docs/en/performance-regression.md +89 -0
- package/docs/en/performance.md +132 -0
- package/docs/en/previews/README.md +17 -0
- package/docs/en/prod-browser-csp-smokes.md +40 -0
- package/docs/en/public-component-types.md +79 -0
- package/docs/en/quick-start-guide.md +189 -0
- package/docs/en/rc0-adoption-guide.md +102 -0
- package/docs/en/rc0-gate-matrix.md +58 -0
- package/docs/en/rc1-gate-matrix-ci-handoff.md +56 -0
- package/docs/en/rc1-migration-notes.md +69 -0
- package/docs/en/rc1-readiness.md +46 -0
- package/docs/en/release-owner-acceptance.md +56 -0
- package/docs/en/release-report-pack-dry-run-evidence.md +39 -0
- package/docs/en/rmt-action-effect-runtime.md +101 -0
- package/docs/en/rmt-app-platform-authoring.md +47 -0
- package/docs/en/rmt-app-platform-fixture.md +35 -0
- package/docs/en/rmt-app-platform-migration-guide.md +75 -0
- package/docs/en/rmt-app-platform-tooling.md +58 -0
- package/docs/en/rmt-component-template-primitives.md +49 -0
- package/docs/en/rmt-dom-descriptor-renderer.md +54 -0
- package/docs/en/rmt-dsl-authoring-polish.md +143 -0
- package/docs/en/rmt-event-routing-runtime.md +98 -0
- package/docs/en/rmt-first-demo-app.md +87 -0
- package/docs/en/rmt-first-xtend-apps.md +127 -0
- package/docs/en/rmt-kernel-panic-recovery-incident-handoff.md +60 -0
- package/docs/en/rmt-kernel-security-hardening-migration.md +49 -0
- package/docs/en/rmt-kernel-trusted-output-authoring.md +68 -0
- package/docs/en/rmt-language-server.md +243 -0
- package/docs/en/rmt-lifecycle-demo.md +23 -0
- package/docs/en/rmt-linter.md +146 -0
- package/docs/en/rmt-node-ssr-adapter.md +99 -0
- package/docs/en/rmt-php-ssr-adapter.md +118 -0
- package/docs/en/rmt-production-readiness.md +63 -0
- package/docs/en/rmt-state-selector-runtime.md +34 -0
- package/docs/en/rmt-surface-resource-graph-runtime.md +68 -0
- package/docs/en/rmt-tooling-release-gates.md +77 -0
- package/docs/en/rmt-vnext-authoring.md +102 -0
- package/docs/en/rmt-vnext-component-primitives.md +185 -0
- package/docs/en/rmt-vnext-cross-surface-events.md +59 -0
- package/docs/en/rmt-vnext-enterprise-mfe-handoff.md +62 -0
- package/docs/en/rmt-vnext-fabric-bridge-evidence.md +64 -0
- package/docs/en/rmt-vnext-migration-notes.md +62 -0
- package/docs/en/rmt-vnext-primitive-authoring-tooling.md +174 -0
- package/docs/en/rmt-vnext-primitive-grammar-design.md +268 -0
- package/docs/en/rmt-vnext-primitive-lowering.md +91 -0
- package/docs/en/rmt-vnext-primitive-migration.md +93 -0
- package/docs/en/rmt-vnext-primitive-parser-ast.md +59 -0
- package/docs/en/rmt-vnext-primitive-semantic-graph.md +103 -0
- package/docs/en/rmt-vnext-primitives-compiler-backlog.md +327 -0
- package/docs/en/rmt-vnext-release-handoff.md +83 -0
- package/docs/en/rmt-vnext-remote-surfaces.md +81 -0
- package/docs/en/rmt-vnext-source-to-sea-gate.md +482 -0
- package/docs/en/rmt-vnext-surface-registry-enterprise.md +68 -0
- package/docs/en/screenreader-signals.md +56 -0
- package/docs/en/supply-chain-gates.md +106 -0
- package/docs/en/surface-manager-authoring-guide.md +94 -0
- package/docs/en/surface-manager-browser-lab.md +45 -0
- package/docs/en/surface-manager-component-lab.md +43 -0
- package/docs/en/surface-manager-controller.md +66 -0
- package/docs/en/surface-manager-layout-engines.md +32 -0
- package/docs/en/surface-manager-lazy-hydration.md +63 -0
- package/docs/en/surface-manager-migration-guide.md +113 -0
- package/docs/en/surface-manager-native-rmt-surfaces.md +38 -0
- package/docs/en/surface-manager-overlay-bridge.md +53 -0
- package/docs/en/surface-manager-persistence.md +30 -0
- package/docs/en/surface-manager-quality-gates.md +51 -0
- package/docs/en/surface-manager-release-handoff.md +68 -0
- package/docs/en/surface-manager-remote-policy.md +54 -0
- package/docs/en/surface-manager-rmt-authoring.md +89 -0
- package/docs/en/surface-manager-route-lifecycle.md +59 -0
- package/docs/en/surface-manager-runtime-release-handoff.md +69 -0
- package/docs/en/surface-manager-side-panel-runtime.md +36 -0
- package/docs/en/surface-manager-stack-policy.md +39 -0
- package/docs/en/surface-manager-window-runtime.md +47 -0
- package/docs/en/surface-manager-workbench-fixture.md +43 -0
- package/docs/en/third-party-design-authoring.md +406 -0
- package/docs/en/trusted-dom-boundary-browser-proof.md +32 -0
- package/docs/en/trusted-dom-sanitizing.md +124 -0
- package/docs/en/type-exports.md +61 -0
- package/docs/en/typescript-components.md +63 -0
- package/docs/en/visual-browser-regression.md +83 -0
- package/docs/en/visual-owner-artifacts.md +46 -0
- package/docs/en/visual-snapshot-automation.md +87 -0
- package/docs/en/xtend-api-types.md +55 -0
- package/docs/en/xtend-builder-types.md +55 -0
- package/docs/en/xtend-catalog-types.md +44 -0
- package/docs/en/xtend-fabric-rmt-lane-mapping.md +143 -0
- package/docs/en/xtend-fabric.md +474 -0
- package/docs/en/xtend-loader-types.md +58 -0
- package/docs/en/xtend-loader.md +265 -0
- package/docs/en/xtend-policy-types.md +38 -0
- package/docs/en/xtend-rmt-types.md +40 -0
- package/docs/en/xtend-vendor-types.md +36 -0
- package/docs/en/xtendrmt-app-dsl.md +331 -0
- package/docs/en/xtendrmt-migration-guide.md +256 -0
- package/docs/en/xtendrmt-native-authoring.md +336 -0
- package/docs/en/xtendrmt-overview.md +63 -0
- package/docs/en/xtendrmt-parsedown-scheduling.md +301 -0
- package/docs/en/xtendrmt-runtime-bridge.md +155 -0
- package/docs/enterprise-adoption.md +4 -2
- package/docs/epic18-media-manager-vendor-upstream.md +318 -0
- package/docs/epic18-rmt-app-platform-release-handoff.md +67 -0
- package/docs/epic18-vendor-bugfixes.md +34 -0
- package/docs/index.php +1056 -109
- package/docs/manifest.md +8 -2
- package/docs/menu.json +986 -133
- package/docs/package-export-lock.md +2 -2
- package/docs/public-component-types.md +2 -2
- package/docs/quick-start-guide.md +126 -58
- package/docs/rmt-action-effect-runtime.md +101 -0
- package/docs/rmt-app-platform-authoring.md +54 -0
- package/docs/rmt-app-platform-fixture.md +46 -0
- package/docs/rmt-app-platform-migration-guide.md +88 -0
- package/docs/rmt-app-platform-tooling.md +79 -0
- package/docs/rmt-component-template-primitives.md +57 -0
- package/docs/rmt-dom-descriptor-renderer.md +64 -0
- package/docs/rmt-dsl-authoring-polish.md +67 -44
- package/docs/rmt-event-routing-runtime.md +98 -0
- package/docs/rmt-first-demo-app.md +2 -2
- package/docs/rmt-first-xtend-apps.md +70 -46
- package/docs/rmt-language-server.md +61 -4
- package/docs/rmt-lifecycle-demo.md +1 -2
- package/docs/rmt-node-ssr-adapter.md +144 -0
- package/docs/rmt-php-ssr-adapter.md +158 -0
- package/docs/rmt-state-selector-runtime.md +47 -0
- package/docs/rmt-surface-resource-graph-runtime.md +92 -0
- package/docs/rmt-vnext-authoring.md +128 -18
- package/docs/rmt-vnext-component-primitives.md +188 -0
- package/docs/rmt-vnext-fabric-bridge-evidence.md +81 -0
- package/docs/rmt-vnext-primitive-authoring-tooling.md +247 -0
- package/docs/rmt-vnext-primitive-grammar-design.md +289 -0
- package/docs/rmt-vnext-primitive-lowering.md +108 -0
- package/docs/rmt-vnext-primitive-migration.md +119 -0
- package/docs/rmt-vnext-primitive-parser-ast.md +76 -0
- package/docs/rmt-vnext-primitive-semantic-graph.md +118 -0
- package/docs/rmt-vnext-primitives-compiler-backlog.md +742 -0
- package/docs/rmt-vnext-release-handoff.md +14 -0
- package/docs/rmt-vnext-source-to-sea-gate.md +629 -0
- package/docs/surface-manager-migration-guide.md +34 -6
- package/docs/surface-manager-overlay-bridge.md +9 -4
- package/docs/surface-manager-rmt-authoring.md +50 -34
- package/docs/surface-manager-workbench-fixture.md +1 -2
- package/docs/third-party-design-authoring.md +1 -1
- package/docs/type-exports.md +3 -3
- package/docs/utils/pageloader.js +811 -62
- package/docs/visual-browser-regression.md +1 -1
- package/docs/xtend-rmt-types.md +3 -2
- package/docs/xtendrmt-app-dsl.md +187 -122
- package/docs/xtendrmt-docs-shell-vnext.rmt +165 -0
- package/docs/xtendrmt-migration-guide.md +48 -17
- package/docs/xtendrmt-native-authoring.md +213 -217
- package/docs/xtendrmt-overview.md +81 -61
- package/docs/xtendrmt-parsedown-scheduling.md +23 -8
- package/fabric/package.json +1 -1
- package/package.json +684 -21
- package/tools/package.json +5 -1
- package/tools/rmt-editor/vscode/README.md +72 -5
- package/tools/rmt-editor/vscode/XTend-Logo.png +0 -0
- package/tools/rmt-editor/vscode/extension.d.ts +33 -0
- package/tools/rmt-editor/vscode/extension.js +1816 -7
- package/tools/rmt-editor/vscode/language-configuration.json +2 -1
- package/tools/rmt-editor/vscode/package.json +193 -2
- package/tools/rmt-editor/vscode/snippets/rmt.code-snippets +41 -0
- package/tools/rmt-editor/vscode/syntaxes/rmt.tmLanguage.json +103 -1
- package/tools/rmt-editor/vscode/templates/launch.json +70 -0
- package/tools/rmt-editor/vscode/templates/tasks.json +172 -0
- package/tools/rmt-editor/vscode/xtend-rmt-language-0.0.0-enterprise-readiness.vsix +0 -0
- package/tools/rmt-language/app-platform-tooling.d.ts +128 -0
- package/tools/rmt-language/app-platform-tooling.js +677 -0
- package/tools/rmt-language/completions.d.ts +5 -0
- package/tools/rmt-language/completions.js +185 -3
- package/tools/rmt-language/diagnostics.js +54 -0
- package/tools/rmt-language/hover.js +36 -0
- package/tools/rmt-language/rmt-tooling-public-types.d.ts +7 -0
- package/tools/rmt-language/rules/app-platform-policy.js +39 -0
- package/tools/rmt-language/rules/index.js +5 -1
- package/tools/rmt-language/semantic-graph.d.ts +6 -0
- package/tools/rmt-language/semantic-graph.js +928 -0
- package/tools/rmt-language/snippets/index.js +44 -0
- package/tools/rmt-language/snippets/rmt.code-snippets +41 -0
- package/tools/rmt-language/vnext-compatibility.d.ts +10 -0
- package/tools/rmt-language/vnext-compatibility.js +642 -0
- package/tools/rmt-language/vnext-compiler.d.ts +5 -0
- package/tools/rmt-language/vnext-compiler.js +863 -17
- package/tools/rmt-language/vnext-parser.js +725 -9
- package/tools/rmt-language/vnext-release.d.ts +1 -0
- package/tools/rmt-language/vnext-release.js +20 -0
- package/tools/rmt-language/vnext-source-to-sea.d.ts +33 -0
- package/tools/rmt-language/vnext-source-to-sea.js +2227 -0
- package/tools/rmt-language/vnext-surfaces.js +111 -52
- package/tools/rmt-language/vnext-tooling.d.ts +19 -1
- package/tools/rmt-language/vnext-tooling.js +1247 -5
- package/tools/rmt-language-server/protocol.js +3 -0
- package/tools/rmt-language-server/server.d.ts +2 -0
- package/tools/rmt-language-server/server.js +176 -22
- package/tools/rmt-linter/cli.d.ts +2 -0
- package/tools/rmt-linter/cli.js +62 -0
- package/xtend-builder/generators/registry.js +11 -0
- package/xtend-builder/generators/rmt-app-platform.js +239 -0
- package/xtend-builder/generators/rmt-lifecycle-demo.js +3 -11
- package/xtend-builder/lib/cli.js +38 -0
- package/xtend-builder/package.json +3 -3
- package/xtend-builder/scaffold.config.js +29 -2
- package/xtend.css +49 -2
- package/xtendrmt/package.json +49 -1
- package/xtendrmt/rmt-action-effect-runtime.d.ts +126 -0
- package/xtendrmt/rmt-action-effect-runtime.js +494 -0
- package/xtendrmt/rmt-component-capability-registry.d.ts +180 -0
- package/xtendrmt/rmt-component-capability-registry.js +636 -0
- package/xtendrmt/rmt-core.d.ts +6 -0
- package/xtendrmt/rmt-core.esm.js +32 -6
- package/xtendrmt/rmt-dom-descriptor-renderer.d.ts +107 -0
- package/xtendrmt/rmt-dom-descriptor-renderer.js +1066 -0
- package/xtendrmt/rmt-event-routing-runtime.d.ts +144 -0
- package/xtendrmt/rmt-event-routing-runtime.js +666 -0
- package/xtendrmt/rmt-lifecycle-demo.app.js +2 -2
- package/xtendrmt/rmt-lifecycle-demo.core.json +4 -0
- package/xtendrmt/rmt-lifecycle-demo.rmt-build.app.js +1 -1
- package/xtendrmt/rmt-lifecycle-demo.rmt-build.scaffold.json +2 -2
- package/xtendrmt/rmt-lifecycle-demo.scaffold.json +4 -4
- package/xtendrmt/rmt-native-shell-runtime.d.ts +77 -0
- package/xtendrmt/rmt-native-shell-runtime.js +309 -0
- package/xtendrmt/rmt-node-ssr-adapter.d.ts +197 -0
- package/xtendrmt/rmt-node-ssr-adapter.js +1006 -0
- package/xtendrmt/rmt-php-ssr-adapter.php +976 -0
- package/xtendrmt/rmt-runtime.browser.js +32 -6
- package/xtendrmt/rmt-runtime.esm.js +32 -6
- package/xtendrmt/rmt-state-selector-runtime.d.ts +166 -0
- package/xtendrmt/rmt-state-selector-runtime.js +866 -0
- package/xtendrmt/rmt-surface-resource-graph-runtime.d.ts +224 -0
- package/xtendrmt/rmt-surface-resource-graph-runtime.js +932 -0
- package/xtendrmt/rmt-vnext-enterprise-mfe-demo.core.json +3 -0
- package/xtendrmt/rmt-vnext-reference-demo.core.json +3 -0
- package/xtendrmt/xtendrmt-bestcase-demo.core.json +3420 -372
- package/xtendrmt/xtendrmt-bestcase-demo.js +424 -8
- package/xtendrmt/xtendrmt-bestcase-demo.rmt +214 -6
|
@@ -0,0 +1,932 @@
|
|
|
1
|
+
(function attachRmtSurfaceResourceGraphRuntime(globalTarget) {
|
|
2
|
+
const RMT_SURFACE_RESOURCE_GRAPH_RUNTIME_SCHEMA = 'xtend.epic18.rmt-surface-resource-graph-runtime.v1';
|
|
3
|
+
const RMT_SURFACE_RESOURCE_GRAPH_DIAGNOSTIC_SCHEMA = 'xtend.epic18.rmt-surface-resource-graph-diagnostic.v1';
|
|
4
|
+
const DEFAULT_DIAGNOSTIC_CHANNEL = 'rmt.app_platform.surface_resource_graph';
|
|
5
|
+
const DEFAULT_PORTAL_ID = 'portal.app';
|
|
6
|
+
const DEFAULT_BOUNDS = Object.freeze({ x: 0, y: 0, width: 480, height: 320 });
|
|
7
|
+
|
|
8
|
+
function clampString(value, fallback = '') {
|
|
9
|
+
const normalized = String(value == null ? '' : value).trim();
|
|
10
|
+
return normalized || fallback;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function toArray(value) {
|
|
14
|
+
return Array.isArray(value) ? value : (value == null ? [] : [value]);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function objectRecord(value) {
|
|
18
|
+
return value && typeof value === 'object' && !Array.isArray(value) ? value : {};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function cloneValue(value, fallback = null) {
|
|
22
|
+
if (typeof value === 'undefined') return fallback;
|
|
23
|
+
if (value === null || typeof value !== 'object') return value;
|
|
24
|
+
try {
|
|
25
|
+
return JSON.parse(JSON.stringify(value));
|
|
26
|
+
} catch (_) {
|
|
27
|
+
return value;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function cloneOverlayInstance(overlay, fallback = null) {
|
|
32
|
+
if (!overlay) return fallback;
|
|
33
|
+
const { element, ...safeOverlay } = overlay;
|
|
34
|
+
return {
|
|
35
|
+
...cloneValue(safeOverlay, safeOverlay),
|
|
36
|
+
elementMounted: Boolean(element)
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function readPath(source, path) {
|
|
41
|
+
if (!path) return source;
|
|
42
|
+
if (source && typeof source === 'object' && Object.prototype.hasOwnProperty.call(source, path)) return source[path];
|
|
43
|
+
const parts = String(path).split('.').filter(Boolean);
|
|
44
|
+
let cursor = source;
|
|
45
|
+
for (const part of parts) {
|
|
46
|
+
if (cursor == null) return undefined;
|
|
47
|
+
if (part === 'length' && (Array.isArray(cursor) || typeof cursor === 'string')) return cursor.length;
|
|
48
|
+
cursor = cursor[part];
|
|
49
|
+
}
|
|
50
|
+
return cursor;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function resourceIds(resources) {
|
|
54
|
+
return toArray(resources)
|
|
55
|
+
.map((resource) => typeof resource === 'string' ? resource : clampString(resource && resource.id))
|
|
56
|
+
.filter(Boolean);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function normalizeBounds(bounds, fallback = DEFAULT_BOUNDS) {
|
|
60
|
+
const source = objectRecord(bounds);
|
|
61
|
+
const base = objectRecord(fallback);
|
|
62
|
+
return {
|
|
63
|
+
x: Number.isFinite(source.x) ? source.x : (Number.isFinite(base.x) ? base.x : DEFAULT_BOUNDS.x),
|
|
64
|
+
y: Number.isFinite(source.y) ? source.y : (Number.isFinite(base.y) ? base.y : DEFAULT_BOUNDS.y),
|
|
65
|
+
width: Number.isFinite(source.width) ? source.width : (Number.isFinite(base.width) ? base.width : DEFAULT_BOUNDS.width),
|
|
66
|
+
height: Number.isFinite(source.height) ? source.height : (Number.isFinite(base.height) ? base.height : DEFAULT_BOUNDS.height)
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function resolveTemplateValue(value, context = {}) {
|
|
71
|
+
if (Array.isArray(value)) return value.map((entry) => resolveTemplateValue(entry, context));
|
|
72
|
+
if (value && typeof value === 'object') {
|
|
73
|
+
const resolved = {};
|
|
74
|
+
Object.entries(value).forEach(([key, entry]) => {
|
|
75
|
+
resolved[key] = resolveTemplateValue(entry, context);
|
|
76
|
+
});
|
|
77
|
+
return resolved;
|
|
78
|
+
}
|
|
79
|
+
if (typeof value !== 'string') return value;
|
|
80
|
+
|
|
81
|
+
const record = context.record || {};
|
|
82
|
+
const surface = context.surface || {};
|
|
83
|
+
const instance = context.instance || {};
|
|
84
|
+
if (value === '$record') return record;
|
|
85
|
+
if (value.startsWith('$record.')) return readPath(record, value.slice(8));
|
|
86
|
+
if (value === '$surface') return surface;
|
|
87
|
+
if (value.startsWith('$surface.')) return readPath(surface, value.slice(9));
|
|
88
|
+
if (value === '$instance') return instance;
|
|
89
|
+
if (value.startsWith('$instance.')) return readPath(instance, value.slice(10));
|
|
90
|
+
if (value === '$index') return context.index;
|
|
91
|
+
|
|
92
|
+
return value
|
|
93
|
+
.replace(/\$\{record\.([^}]+)\}/gu, (_, path) => clampString(readPath(record, path), ''))
|
|
94
|
+
.replace(/\$\{surface\.([^}]+)\}/gu, (_, path) => clampString(readPath(surface, path), ''))
|
|
95
|
+
.replace(/\$\{instance\.([^}]+)\}/gu, (_, path) => clampString(readPath(instance, path), ''))
|
|
96
|
+
.replace(/\$\{index\}/gu, clampString(context.index, '0'));
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function createDiagnosticsRecorder(deps = {}) {
|
|
100
|
+
const diagnostics = [];
|
|
101
|
+
const diagnosticsHub = deps.diagnosticsHub || null;
|
|
102
|
+
const channel = clampString(deps.diagnosticChannel, DEFAULT_DIAGNOSTIC_CHANNEL);
|
|
103
|
+
return {
|
|
104
|
+
diagnostics,
|
|
105
|
+
publish(diagnostic) {
|
|
106
|
+
diagnostics.push(diagnostic);
|
|
107
|
+
if (diagnosticsHub && typeof diagnosticsHub.publish === 'function') {
|
|
108
|
+
diagnosticsHub.publish(channel, diagnostic, {
|
|
109
|
+
schema: RMT_SURFACE_RESOURCE_GRAPH_DIAGNOSTIC_SCHEMA
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
return diagnostic;
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function createDiagnostic(code, message, details = {}, severity = 'info') {
|
|
118
|
+
return {
|
|
119
|
+
schema: RMT_SURFACE_RESOURCE_GRAPH_DIAGNOSTIC_SCHEMA,
|
|
120
|
+
code,
|
|
121
|
+
message,
|
|
122
|
+
severity,
|
|
123
|
+
details: cloneValue(details, {})
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function normalizePortals(input) {
|
|
128
|
+
const portals = toArray(input).map((portal) => {
|
|
129
|
+
const source = objectRecord(portal);
|
|
130
|
+
return {
|
|
131
|
+
...source,
|
|
132
|
+
id: clampString(source.id),
|
|
133
|
+
root: clampString(source.root || source.target, ''),
|
|
134
|
+
layer: clampString(source.layer, source.id || 'app'),
|
|
135
|
+
policy: clampString(source.policy, 'stacked'),
|
|
136
|
+
focusPolicy: clampString(source.focusPolicy, 'preserve'),
|
|
137
|
+
pointerPolicy: clampString(source.pointerPolicy, 'auto'),
|
|
138
|
+
scrollPolicy: clampString(source.scrollPolicy, 'contain'),
|
|
139
|
+
zIndexStart: Number.isFinite(source.zIndexStart) ? source.zIndexStart : 1000,
|
|
140
|
+
zStep: Number.isFinite(source.zStep) ? source.zStep : 10,
|
|
141
|
+
element: null,
|
|
142
|
+
target: null,
|
|
143
|
+
mounted: false
|
|
144
|
+
};
|
|
145
|
+
}).filter((portal) => portal.id);
|
|
146
|
+
if (!portals.some((portal) => portal.id === DEFAULT_PORTAL_ID)) {
|
|
147
|
+
portals.unshift({
|
|
148
|
+
id: DEFAULT_PORTAL_ID,
|
|
149
|
+
root: '',
|
|
150
|
+
layer: 'app',
|
|
151
|
+
policy: 'stacked',
|
|
152
|
+
focusPolicy: 'preserve',
|
|
153
|
+
pointerPolicy: 'auto',
|
|
154
|
+
scrollPolicy: 'contain',
|
|
155
|
+
zIndexStart: 1000,
|
|
156
|
+
zStep: 10,
|
|
157
|
+
element: null,
|
|
158
|
+
target: null,
|
|
159
|
+
mounted: false
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
return portals;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function normalizeSurfaces(input) {
|
|
166
|
+
return toArray(input).map((surface) => {
|
|
167
|
+
const source = objectRecord(surface);
|
|
168
|
+
const hasSource = Boolean(source.source || source.from || source.records);
|
|
169
|
+
return {
|
|
170
|
+
...source,
|
|
171
|
+
id: clampString(source.id),
|
|
172
|
+
kind: clampString(source.kind || source.type, 'surface'),
|
|
173
|
+
source: clampString(source.source || source.from, ''),
|
|
174
|
+
repeat: source.repeat === true || hasSource,
|
|
175
|
+
key: source.key || source.keyPath || '$record.id',
|
|
176
|
+
owner: source.owner || source.ownerId || '',
|
|
177
|
+
component: clampString(source.component || source.tag, ''),
|
|
178
|
+
template: source.template || null,
|
|
179
|
+
portal: clampString(source.portal, DEFAULT_PORTAL_ID),
|
|
180
|
+
resources: resourceIds(source.resources),
|
|
181
|
+
bounds: normalizeBounds(source.bounds || source.defaultBounds),
|
|
182
|
+
placement: clampString(source.placement, ''),
|
|
183
|
+
mode: clampString(source.mode, ''),
|
|
184
|
+
initialState: clampString(source.initialState || source.state, 'closed'),
|
|
185
|
+
persistent: source.persistent !== false,
|
|
186
|
+
closeReleasesResources: source.closeReleasesResources === true,
|
|
187
|
+
destroyOnClose: source.destroyOnClose === true,
|
|
188
|
+
focusOnOpen: source.focusOnOpen !== false,
|
|
189
|
+
preserveOnMinimize: source.preserveOnMinimize !== false
|
|
190
|
+
};
|
|
191
|
+
}).filter((surface) => surface.id);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
function normalizeOverlays(input) {
|
|
195
|
+
return toArray(input).map((overlay) => {
|
|
196
|
+
const source = objectRecord(overlay);
|
|
197
|
+
return {
|
|
198
|
+
...source,
|
|
199
|
+
id: clampString(source.id),
|
|
200
|
+
kind: clampString(source.kind || source.type, 'popover'),
|
|
201
|
+
portal: clampString(source.portal, DEFAULT_PORTAL_ID),
|
|
202
|
+
layer: clampString(source.layer, source.kind || source.type || 'overlay'),
|
|
203
|
+
surface: clampString(source.surface, ''),
|
|
204
|
+
component: clampString(source.component || source.tag, ''),
|
|
205
|
+
template: source.template || null,
|
|
206
|
+
attributes: objectRecord(source.attributes),
|
|
207
|
+
resources: resourceIds(source.resources),
|
|
208
|
+
dismissible: source.dismissible !== false,
|
|
209
|
+
singleton: source.singleton !== false,
|
|
210
|
+
focusPolicy: clampString(source.focusPolicy, 'restore-origin'),
|
|
211
|
+
escapePolicy: clampString(source.escapePolicy, 'close-top'),
|
|
212
|
+
pointerPolicy: clampString(source.pointerPolicy, 'auto'),
|
|
213
|
+
scrollPolicy: clampString(source.scrollPolicy, 'contain'),
|
|
214
|
+
closeReleasesResources: source.closeReleasesResources !== false
|
|
215
|
+
};
|
|
216
|
+
}).filter((overlay) => overlay.id);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
function createRmtSurfaceResourceGraphRuntime(options = {}) {
|
|
220
|
+
const portals = normalizePortals(options.portals);
|
|
221
|
+
const surfaces = normalizeSurfaces(options.surfaces || options.surfaceTemplates || options.surfaceDefinitions);
|
|
222
|
+
const overlays = normalizeOverlays(options.overlays || options.overlayDefinitions);
|
|
223
|
+
const portalIndex = new Map(portals.map((portal) => [portal.id, portal]));
|
|
224
|
+
const surfaceIndex = new Map(surfaces.map((surface) => [surface.id, surface]));
|
|
225
|
+
const overlayIndex = new Map(overlays.map((overlay) => [overlay.id, overlay]));
|
|
226
|
+
const instances = new Map();
|
|
227
|
+
const overlayStack = [];
|
|
228
|
+
const resourceManager = options.resourceManager || null;
|
|
229
|
+
const eventRuntime = options.eventRuntime || null;
|
|
230
|
+
const persistenceAdapter = options.persistenceAdapter || null;
|
|
231
|
+
const focusAdapter = options.focusAdapter || null;
|
|
232
|
+
const documentTarget = options.documentTarget || options.document || (globalTarget && globalTarget.document) || null;
|
|
233
|
+
const surfaceManagerTarget = options.surfaceManager || options.managerElement || options.xSurfaceManager || null;
|
|
234
|
+
const diagnosticsRecorder = createDiagnosticsRecorder(options);
|
|
235
|
+
let focusSequence = 0;
|
|
236
|
+
let overlaySequence = 0;
|
|
237
|
+
|
|
238
|
+
function publish(code, message, details = {}, severity = 'info') {
|
|
239
|
+
return diagnosticsRecorder.publish(createDiagnostic(code, message, details, severity));
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
function resolveSurfaceManagerTarget() {
|
|
243
|
+
if (typeof surfaceManagerTarget === 'function') return surfaceManagerTarget();
|
|
244
|
+
return surfaceManagerTarget;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
function surfaceRuntimeType(kind) {
|
|
248
|
+
const normalized = clampString(kind, 'surface').toLowerCase();
|
|
249
|
+
if (['root', 'workspace', 'page', 'card', 'list', 'region', 'overlay-host', 'surface'].includes(normalized)) return 'region';
|
|
250
|
+
if (['panel', 'side-panel', 'sidepanel'].includes(normalized)) return 'side-panel';
|
|
251
|
+
if (['window', 'modal', 'dialog', 'drawer', 'popover', 'tooltip', 'toast', 'lightbox', 'menu'].includes(normalized)) return normalized;
|
|
252
|
+
return 'region';
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
function surfaceManagerRecordForInstance(instance) {
|
|
256
|
+
return {
|
|
257
|
+
schema: 'xtend.surface.record.v1',
|
|
258
|
+
id: instance.id,
|
|
259
|
+
type: surfaceRuntimeType(instance.kind),
|
|
260
|
+
kind: instance.kind,
|
|
261
|
+
manager: clampString(options.managerId, 'xtend.surface.manager'),
|
|
262
|
+
label: clampString(instance.label || instance.id, instance.id),
|
|
263
|
+
stateKey: `xtend.surface.${instance.id}.state`,
|
|
264
|
+
defaultOpen: instance.state === 'open',
|
|
265
|
+
open: instance.state === 'open',
|
|
266
|
+
bounds: cloneValue(instance.bounds, {}),
|
|
267
|
+
placement: instance.placement || null,
|
|
268
|
+
mode: instance.mode || (surfaceRuntimeType(instance.kind) === 'region' ? 'region' : 'floating'),
|
|
269
|
+
capabilities: ['open', 'focus', 'close', 'minimize', 'restore', 'update', 'snapshot'],
|
|
270
|
+
contentRef: instance.component,
|
|
271
|
+
metadata: {
|
|
272
|
+
source: 'rmt-surface-resource-graph-runtime',
|
|
273
|
+
surfaceId: instance.surfaceId,
|
|
274
|
+
portal: instance.portal,
|
|
275
|
+
owner: instance.owner
|
|
276
|
+
}
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
function surfaceManagerRecordForOverlay(overlay, definition = {}) {
|
|
281
|
+
return {
|
|
282
|
+
schema: 'xtend.surface.record.v1',
|
|
283
|
+
id: overlay.id,
|
|
284
|
+
type: surfaceRuntimeType(overlay.kind),
|
|
285
|
+
kind: overlay.kind,
|
|
286
|
+
manager: clampString(options.managerId, 'xtend.surface.manager'),
|
|
287
|
+
label: clampString(definition.label || definition.id || overlay.id, overlay.id),
|
|
288
|
+
stateKey: `xtend.surface.${overlay.id}.state`,
|
|
289
|
+
defaultOpen: true,
|
|
290
|
+
open: true,
|
|
291
|
+
placement: definition.placement || null,
|
|
292
|
+
mode: 'overlay',
|
|
293
|
+
capabilities: ['open', 'focus', 'close', 'update', 'snapshot'],
|
|
294
|
+
contentRef: definition.component || '',
|
|
295
|
+
metadata: {
|
|
296
|
+
source: 'rmt-surface-resource-graph-runtime',
|
|
297
|
+
overlayId: overlay.overlayId,
|
|
298
|
+
portal: overlay.portal,
|
|
299
|
+
ownerId: overlay.ownerId
|
|
300
|
+
}
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
function callSurfaceManager(methodName, args, details = {}) {
|
|
305
|
+
const manager = resolveSurfaceManagerTarget();
|
|
306
|
+
if (!manager || typeof manager[methodName] !== 'function') return null;
|
|
307
|
+
try {
|
|
308
|
+
return manager[methodName](...args);
|
|
309
|
+
} catch (error) {
|
|
310
|
+
publish('rmt.surface.manager_proxy.failed', `SurfaceManager proxy ${methodName} failed.`, {
|
|
311
|
+
...details,
|
|
312
|
+
methodName,
|
|
313
|
+
error: error && error.message || String(error)
|
|
314
|
+
}, 'warning');
|
|
315
|
+
return null;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
function proxySurfaceManager(operation, instance, payload = {}) {
|
|
320
|
+
if (!instance) return null;
|
|
321
|
+
const record = surfaceManagerRecordForInstance(instance);
|
|
322
|
+
if (operation === 'register') return callSurfaceManager('registerSurface', [record], { instanceId: instance.id, operation });
|
|
323
|
+
if (operation === 'open') return callSurfaceManager('openSurface', [instance.id, { bounds: instance.bounds, ...objectRecord(payload) }], { instanceId: instance.id, operation });
|
|
324
|
+
if (operation === 'focus') return callSurfaceManager('focusSurface', [instance.id], { instanceId: instance.id, operation });
|
|
325
|
+
if (operation === 'minimize') return callSurfaceManager('minimizeSurface', [instance.id], { instanceId: instance.id, operation });
|
|
326
|
+
if (operation === 'restore') return callSurfaceManager('restoreSurface', [instance.id], { instanceId: instance.id, operation });
|
|
327
|
+
if (operation === 'close' || operation === 'destroy') return callSurfaceManager('closeSurface', [instance.id, payload.reason || operation], { instanceId: instance.id, operation });
|
|
328
|
+
if (operation === 'update') return callSurfaceManager('updateSurface', [instance.id, payload], { instanceId: instance.id, operation });
|
|
329
|
+
return null;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
function resolveRecords(surface, input) {
|
|
333
|
+
if (Array.isArray(input)) return input;
|
|
334
|
+
const sourceId = surface.source;
|
|
335
|
+
const source = objectRecord(input);
|
|
336
|
+
if (sourceId && Array.isArray(source[sourceId])) return source[sourceId];
|
|
337
|
+
if (source.records && Array.isArray(source.records[sourceId])) return source.records[sourceId];
|
|
338
|
+
if (source.data && Array.isArray(source.data[sourceId])) return source.data[sourceId];
|
|
339
|
+
if (Array.isArray(surface.records)) return surface.records;
|
|
340
|
+
return surface.repeat ? [] : [null];
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
function createInstanceId(surface, record, index) {
|
|
344
|
+
if (!surface.repeat) return surface.id;
|
|
345
|
+
const key = resolveTemplateValue(surface.key, { surface, record, index });
|
|
346
|
+
const normalizedKey = clampString(key, Number.isFinite(index) ? String(index) : '0');
|
|
347
|
+
return `${surface.id}:${normalizedKey}`;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
function createInstance(surface, record = null, index = 0, existing = null) {
|
|
351
|
+
const id = existing ? existing.id : createInstanceId(surface, record, index);
|
|
352
|
+
const instanceShell = { id };
|
|
353
|
+
const owner = clampString(resolveTemplateValue(surface.owner, {
|
|
354
|
+
surface,
|
|
355
|
+
record,
|
|
356
|
+
index,
|
|
357
|
+
instance: instanceShell
|
|
358
|
+
}), id);
|
|
359
|
+
const next = {
|
|
360
|
+
id,
|
|
361
|
+
surfaceId: surface.id,
|
|
362
|
+
kind: surface.kind,
|
|
363
|
+
key: surface.repeat ? id.slice(surface.id.length + 1) : surface.id,
|
|
364
|
+
owner,
|
|
365
|
+
source: surface.source,
|
|
366
|
+
record: cloneValue(record, record),
|
|
367
|
+
component: surface.component,
|
|
368
|
+
template: surface.template,
|
|
369
|
+
portal: surface.portal,
|
|
370
|
+
placement: surface.placement,
|
|
371
|
+
mode: surface.mode,
|
|
372
|
+
persistent: surface.persistent,
|
|
373
|
+
resources: surface.resources.slice(),
|
|
374
|
+
resourcesAcquired: existing ? Boolean(existing.resourcesAcquired) : false,
|
|
375
|
+
state: existing ? existing.state : surface.initialState,
|
|
376
|
+
bounds: normalizeBounds(existing && existing.bounds || surface.bounds),
|
|
377
|
+
previousBounds: existing ? cloneValue(existing.previousBounds, null) : null,
|
|
378
|
+
minimizedAt: existing ? existing.minimizedAt : null,
|
|
379
|
+
closedAt: existing ? existing.closedAt : null,
|
|
380
|
+
destroyedAt: existing ? existing.destroyedAt : null,
|
|
381
|
+
zIndex: existing ? existing.zIndex : 0,
|
|
382
|
+
focusOrder: existing ? existing.focusOrder : 0,
|
|
383
|
+
metadata: existing ? cloneValue(existing.metadata, {}) : {}
|
|
384
|
+
};
|
|
385
|
+
return next;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
function ensureSurface(surfaceRef, optionsForCreate = {}) {
|
|
389
|
+
const id = clampString(surfaceRef);
|
|
390
|
+
const existing = instances.get(id);
|
|
391
|
+
if (existing) return existing;
|
|
392
|
+
const definition = surfaceIndex.get(id);
|
|
393
|
+
if (!definition) throw new Error(`RMT Surface ${surfaceRef} ist nicht definiert.`);
|
|
394
|
+
const created = createInstance(definition, optionsForCreate.record || null, 0, null);
|
|
395
|
+
instances.set(created.id, created);
|
|
396
|
+
publish('rmt.surface.materialized', `RMT Surface ${created.id} wurde materialisiert.`, {
|
|
397
|
+
surfaceId: definition.id,
|
|
398
|
+
instanceId: created.id,
|
|
399
|
+
kind: created.kind
|
|
400
|
+
});
|
|
401
|
+
proxySurfaceManager('register', created);
|
|
402
|
+
return created;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
async function acquireResources(instance, context = {}) {
|
|
406
|
+
if (!instance || instance.resourcesAcquired || instance.resources.length === 0) return [];
|
|
407
|
+
if (!resourceManager || typeof resourceManager.acquireMany !== 'function') {
|
|
408
|
+
publish('rmt.surface.resources.missing_manager', `RMT Surface ${instance.id} hat Ressourcen ohne Resource Manager.`, {
|
|
409
|
+
instanceId: instance.id,
|
|
410
|
+
resources: instance.resources
|
|
411
|
+
}, 'warning');
|
|
412
|
+
return [];
|
|
413
|
+
}
|
|
414
|
+
const records = await resourceManager.acquireMany(instance.resources, instance.owner, {
|
|
415
|
+
surface: cloneValue(instance, instance),
|
|
416
|
+
...objectRecord(context)
|
|
417
|
+
});
|
|
418
|
+
instance.resourcesAcquired = true;
|
|
419
|
+
publish('rmt.surface.resources.acquired', `RMT Surface ${instance.id} hat Ressourcen uebernommen.`, {
|
|
420
|
+
instanceId: instance.id,
|
|
421
|
+
owner: instance.owner,
|
|
422
|
+
count: instance.resources.length
|
|
423
|
+
});
|
|
424
|
+
return records;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
function releaseResources(instance, reason = 'release') {
|
|
428
|
+
if (!instance || !instance.resourcesAcquired) return null;
|
|
429
|
+
let report = null;
|
|
430
|
+
if (resourceManager && typeof resourceManager.releaseOwner === 'function') {
|
|
431
|
+
report = resourceManager.releaseOwner(instance.owner);
|
|
432
|
+
}
|
|
433
|
+
instance.resourcesAcquired = false;
|
|
434
|
+
publish('rmt.surface.resources.released', `RMT Surface ${instance.id} hat Ressourcen freigegeben.`, {
|
|
435
|
+
instanceId: instance.id,
|
|
436
|
+
owner: instance.owner,
|
|
437
|
+
reason,
|
|
438
|
+
releasedCount: report && report.releasedCount || 0
|
|
439
|
+
});
|
|
440
|
+
return report;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
function focusSurface(surfaceRef, metadata = {}) {
|
|
444
|
+
const instance = ensureSurface(surfaceRef);
|
|
445
|
+
focusSequence += 1;
|
|
446
|
+
instance.focusOrder = focusSequence;
|
|
447
|
+
instance.zIndex = Math.max(instance.zIndex, 100 + focusSequence);
|
|
448
|
+
if (focusAdapter && typeof focusAdapter.focus === 'function') {
|
|
449
|
+
focusAdapter.focus(cloneValue(instance, instance), metadata);
|
|
450
|
+
}
|
|
451
|
+
proxySurfaceManager('focus', instance, metadata);
|
|
452
|
+
publish('rmt.surface.focused', `RMT Surface ${instance.id} wurde fokussiert.`, {
|
|
453
|
+
instanceId: instance.id,
|
|
454
|
+
focusOrder: instance.focusOrder,
|
|
455
|
+
zIndex: instance.zIndex
|
|
456
|
+
});
|
|
457
|
+
return cloneValue(instance, instance);
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
function materialize(recordsBySource = {}, materializeOptions = {}) {
|
|
461
|
+
const created = [];
|
|
462
|
+
const reused = [];
|
|
463
|
+
surfaces.forEach((surface) => {
|
|
464
|
+
const records = resolveRecords(surface, recordsBySource);
|
|
465
|
+
records.forEach((record, index) => {
|
|
466
|
+
const id = createInstanceId(surface, record, index);
|
|
467
|
+
const existing = instances.get(id);
|
|
468
|
+
const next = createInstance(surface, record, index, existing && existing.state !== 'destroyed' ? existing : null);
|
|
469
|
+
instances.set(id, next);
|
|
470
|
+
if (existing && existing.state !== 'destroyed') reused.push(id);
|
|
471
|
+
else created.push(id);
|
|
472
|
+
proxySurfaceManager('register', next);
|
|
473
|
+
publish('rmt.surface.materialized', `RMT Surface ${id} wurde materialisiert.`, {
|
|
474
|
+
surfaceId: surface.id,
|
|
475
|
+
instanceId: id,
|
|
476
|
+
kind: surface.kind,
|
|
477
|
+
reused: Boolean(existing && existing.state !== 'destroyed')
|
|
478
|
+
});
|
|
479
|
+
});
|
|
480
|
+
});
|
|
481
|
+
if (materializeOptions.hydrate === true) hydrateSnapshot();
|
|
482
|
+
return {
|
|
483
|
+
schema: 'xtend.epic18.rmt-surface-materialize-report.v1',
|
|
484
|
+
createdCount: created.length,
|
|
485
|
+
reusedCount: reused.length,
|
|
486
|
+
created,
|
|
487
|
+
reused
|
|
488
|
+
};
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
async function openSurface(surfaceRef, openOptions = {}) {
|
|
492
|
+
const instance = ensureSurface(surfaceRef, openOptions);
|
|
493
|
+
if (instance.state === 'destroyed') instance.state = 'closed';
|
|
494
|
+
await acquireResources(instance, openOptions);
|
|
495
|
+
instance.state = 'open';
|
|
496
|
+
instance.closedAt = null;
|
|
497
|
+
instance.destroyedAt = null;
|
|
498
|
+
if (openOptions.focus !== false && surfaceIndex.get(instance.surfaceId).focusOnOpen) {
|
|
499
|
+
focusSurface(instance.id, openOptions);
|
|
500
|
+
}
|
|
501
|
+
publish('rmt.surface.opened', `RMT Surface ${instance.id} wurde geoeffnet.`, {
|
|
502
|
+
instanceId: instance.id,
|
|
503
|
+
resourcesAcquired: instance.resourcesAcquired
|
|
504
|
+
});
|
|
505
|
+
proxySurfaceManager('open', instance, openOptions);
|
|
506
|
+
return cloneValue(instance, instance);
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
function minimizeSurface(surfaceRef, metadata = {}) {
|
|
510
|
+
const instance = ensureSurface(surfaceRef);
|
|
511
|
+
if (instance.state === 'destroyed') throw new Error(`RMT Surface ${surfaceRef} ist bereits zerstoert.`);
|
|
512
|
+
instance.previousBounds = cloneValue(instance.bounds, instance.bounds);
|
|
513
|
+
instance.state = 'minimized';
|
|
514
|
+
instance.minimizedAt = metadata.at || 'static-local';
|
|
515
|
+
publish('rmt.surface.minimized', `RMT Surface ${instance.id} wurde minimiert.`, {
|
|
516
|
+
instanceId: instance.id,
|
|
517
|
+
resourcesPreserved: instance.resourcesAcquired
|
|
518
|
+
});
|
|
519
|
+
proxySurfaceManager('minimize', instance, metadata);
|
|
520
|
+
return cloneValue(instance, instance);
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
function restoreSurface(surfaceRef, metadata = {}) {
|
|
524
|
+
const instance = ensureSurface(surfaceRef);
|
|
525
|
+
if (instance.state === 'destroyed') throw new Error(`RMT Surface ${surfaceRef} ist bereits zerstoert.`);
|
|
526
|
+
instance.state = 'open';
|
|
527
|
+
if (instance.previousBounds) instance.bounds = normalizeBounds(instance.previousBounds, instance.bounds);
|
|
528
|
+
publish('rmt.surface.restored', `RMT Surface ${instance.id} wurde wiederhergestellt.`, {
|
|
529
|
+
instanceId: instance.id,
|
|
530
|
+
bounds: instance.bounds
|
|
531
|
+
});
|
|
532
|
+
if (metadata.focus !== false) focusSurface(instance.id, metadata);
|
|
533
|
+
proxySurfaceManager('restore', instance, metadata);
|
|
534
|
+
return cloneValue(instance, instance);
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
function closeSurface(surfaceRef, metadata = {}) {
|
|
538
|
+
const instance = ensureSurface(surfaceRef);
|
|
539
|
+
const definition = surfaceIndex.get(instance.surfaceId) || {};
|
|
540
|
+
if (definition.destroyOnClose || metadata.destroy === true) return destroySurface(instance.id, { reason: 'close' });
|
|
541
|
+
instance.state = 'closed';
|
|
542
|
+
instance.closedAt = metadata.at || 'static-local';
|
|
543
|
+
if (definition.closeReleasesResources || metadata.releaseResources === true) {
|
|
544
|
+
releaseResources(instance, 'close');
|
|
545
|
+
}
|
|
546
|
+
publish('rmt.surface.closed', `RMT Surface ${instance.id} wurde geschlossen.`, {
|
|
547
|
+
instanceId: instance.id,
|
|
548
|
+
resourcesAcquired: instance.resourcesAcquired
|
|
549
|
+
});
|
|
550
|
+
proxySurfaceManager('close', instance, metadata);
|
|
551
|
+
return cloneValue(instance, instance);
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
function destroySurface(surfaceRef, metadata = {}) {
|
|
555
|
+
const instance = ensureSurface(surfaceRef);
|
|
556
|
+
overlayStack
|
|
557
|
+
.filter((overlay) => overlay.state === 'open' && overlay.ownerId === instance.id)
|
|
558
|
+
.forEach((overlay) => closeOverlay(overlay.id, { reason: 'surface-destroy' }));
|
|
559
|
+
releaseResources(instance, metadata.reason || 'destroy');
|
|
560
|
+
if (eventRuntime && typeof eventRuntime.detachOwner === 'function') {
|
|
561
|
+
eventRuntime.detachOwner(instance.owner);
|
|
562
|
+
}
|
|
563
|
+
instance.state = 'destroyed';
|
|
564
|
+
instance.destroyedAt = metadata.at || 'static-local';
|
|
565
|
+
publish('rmt.surface.destroyed', `RMT Surface ${instance.id} wurde zerstoert.`, {
|
|
566
|
+
instanceId: instance.id,
|
|
567
|
+
owner: instance.owner
|
|
568
|
+
});
|
|
569
|
+
proxySurfaceManager('destroy', instance, metadata);
|
|
570
|
+
return cloneValue(instance, instance);
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
function setBounds(surfaceRef, bounds, metadata = {}) {
|
|
574
|
+
const instance = ensureSurface(surfaceRef);
|
|
575
|
+
instance.previousBounds = cloneValue(instance.bounds, instance.bounds);
|
|
576
|
+
instance.bounds = normalizeBounds(bounds, instance.bounds);
|
|
577
|
+
publish('rmt.surface.bounds.changed', `RMT Surface ${instance.id} hat neue Bounds.`, {
|
|
578
|
+
instanceId: instance.id,
|
|
579
|
+
bounds: instance.bounds,
|
|
580
|
+
reason: metadata.reason || 'set-bounds'
|
|
581
|
+
});
|
|
582
|
+
proxySurfaceManager('update', instance, { bounds: instance.bounds, reason: metadata.reason || 'set-bounds' });
|
|
583
|
+
return cloneValue(instance, instance);
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
function moveSurface(surfaceRef, x, y) {
|
|
587
|
+
const instance = ensureSurface(surfaceRef);
|
|
588
|
+
return setBounds(instance.id, { ...instance.bounds, x, y }, { reason: 'move' });
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
function resizeSurface(surfaceRef, width, height) {
|
|
592
|
+
const instance = ensureSurface(surfaceRef);
|
|
593
|
+
return setBounds(instance.id, { ...instance.bounds, width, height }, { reason: 'resize' });
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
function mountPortal(portalRef, target) {
|
|
597
|
+
const portal = portalIndex.get(clampString(portalRef));
|
|
598
|
+
if (!portal) throw new Error(`RMT Portal ${portalRef} ist nicht definiert.`);
|
|
599
|
+
portal.target = target || null;
|
|
600
|
+
portal.mounted = true;
|
|
601
|
+
if (!portal.element && portal.target && typeof portal.target.appendChild === 'function' && documentTarget && typeof documentTarget.createElement === 'function') {
|
|
602
|
+
const portalElement = documentTarget.createElement('x-surface-portal');
|
|
603
|
+
setDomAttribute(portalElement, 'portal-id', portal.id);
|
|
604
|
+
setDomAttribute(portalElement, 'policy', portal.policy);
|
|
605
|
+
setDomAttribute(portalElement, 'layer', portal.layer);
|
|
606
|
+
setDomAttribute(portalElement, 'z-index-start', portal.zIndexStart);
|
|
607
|
+
setDomAttribute(portalElement, 'z-step', portal.zStep);
|
|
608
|
+
portal.target.appendChild(portalElement);
|
|
609
|
+
portal.element = portalElement;
|
|
610
|
+
}
|
|
611
|
+
publish('rmt.portal.mounted', `RMT Portal ${portal.id} wurde gemountet.`, {
|
|
612
|
+
portalId: portal.id,
|
|
613
|
+
layer: portal.layer
|
|
614
|
+
});
|
|
615
|
+
return cloneValue(portal, portal);
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
function setDomAttribute(element, name, value) {
|
|
619
|
+
if (!element || typeof element.setAttribute !== 'function' || value === null || typeof value === 'undefined' || value === false) return;
|
|
620
|
+
element.setAttribute(name, value === true ? '' : String(value));
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
function resolvePortalTarget(portal, metadata = {}) {
|
|
624
|
+
if (metadata.target && typeof metadata.target.appendChild === 'function') return metadata.target;
|
|
625
|
+
if (portal && portal.target && typeof portal.target.appendChild === 'function') return portal.target;
|
|
626
|
+
if (documentTarget && documentTarget.body && typeof documentTarget.body.appendChild === 'function') return documentTarget.body;
|
|
627
|
+
return null;
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
function materializeOverlayElement(overlay, definition, portal, metadata = {}) {
|
|
631
|
+
if (metadata.materialize === false) return null;
|
|
632
|
+
const target = resolvePortalTarget(portal, metadata);
|
|
633
|
+
if (!target || !documentTarget || typeof documentTarget.createElement !== 'function') return null;
|
|
634
|
+
const tag = clampString(metadata.tag || definition.component || definition.tag, definition.kind === 'dialog' ? 'x-dialog' : definition.kind === 'lightbox' ? 'x-lightbox' : 'div');
|
|
635
|
+
const element = documentTarget.createElement(tag);
|
|
636
|
+
setDomAttribute(element, 'data-rmt-overlay', overlay.id);
|
|
637
|
+
setDomAttribute(element, 'data-rmt-overlay-ref', overlay.overlayId);
|
|
638
|
+
setDomAttribute(element, 'data-rmt-owner', overlay.ownerId);
|
|
639
|
+
setDomAttribute(element, 'data-rmt-portal', overlay.portal);
|
|
640
|
+
setDomAttribute(element, 'data-overlay-kind', overlay.kind);
|
|
641
|
+
setDomAttribute(element, 'role', definition.kind === 'dialog' || definition.kind === 'lightbox' ? 'dialog' : undefined);
|
|
642
|
+
setDomAttribute(element, 'open', true);
|
|
643
|
+
Object.entries(objectRecord(definition.attributes)).forEach(([name, value]) => setDomAttribute(element, name, value));
|
|
644
|
+
if (element.style && typeof element.style.setProperty === 'function') {
|
|
645
|
+
element.style.setProperty('z-index', String(overlay.zIndex));
|
|
646
|
+
}
|
|
647
|
+
if (metadata.text && typeof documentTarget.createTextNode === 'function' && typeof element.appendChild === 'function') {
|
|
648
|
+
element.appendChild(documentTarget.createTextNode(String(metadata.text)));
|
|
649
|
+
}
|
|
650
|
+
target.appendChild(element);
|
|
651
|
+
portal.mounted = true;
|
|
652
|
+
overlay.element = element;
|
|
653
|
+
publish('rmt.overlay.materialized', `RMT Overlay ${overlay.id} wurde im Portal materialisiert.`, {
|
|
654
|
+
overlayId: overlay.overlayId,
|
|
655
|
+
instanceId: overlay.id,
|
|
656
|
+
portal: portal.id,
|
|
657
|
+
tag
|
|
658
|
+
});
|
|
659
|
+
return element;
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
function removeOverlayElement(overlay) {
|
|
663
|
+
const element = overlay && overlay.element;
|
|
664
|
+
if (!element) return false;
|
|
665
|
+
if (typeof element.remove === 'function') {
|
|
666
|
+
element.remove();
|
|
667
|
+
overlay.element = null;
|
|
668
|
+
return true;
|
|
669
|
+
}
|
|
670
|
+
if (element.parentNode && typeof element.parentNode.removeChild === 'function') {
|
|
671
|
+
element.parentNode.removeChild(element);
|
|
672
|
+
overlay.element = null;
|
|
673
|
+
return true;
|
|
674
|
+
}
|
|
675
|
+
overlay.element = null;
|
|
676
|
+
return false;
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
async function openOverlay(overlayRef, metadata = {}) {
|
|
680
|
+
const definition = overlayIndex.get(clampString(overlayRef));
|
|
681
|
+
if (!definition) throw new Error(`RMT Overlay ${overlayRef} ist nicht definiert.`);
|
|
682
|
+
const portal = portalIndex.get(clampString(metadata.portal, definition.portal)) || portalIndex.get(DEFAULT_PORTAL_ID);
|
|
683
|
+
const ownerId = clampString(metadata.ownerId || metadata.surfaceId || definition.surface, 'global');
|
|
684
|
+
if (definition.singleton) {
|
|
685
|
+
const existing = overlayStack.find((entry) => entry.state === 'open' && entry.overlayId === definition.id && entry.ownerId === ownerId);
|
|
686
|
+
if (existing) return cloneOverlayInstance(existing, existing);
|
|
687
|
+
}
|
|
688
|
+
overlaySequence += 1;
|
|
689
|
+
const openInPortal = overlayStack.filter((entry) => entry.state === 'open' && entry.portal === portal.id).length;
|
|
690
|
+
const id = `${definition.id}:${ownerId}:${overlaySequence}`;
|
|
691
|
+
const overlay = {
|
|
692
|
+
id,
|
|
693
|
+
overlayId: definition.id,
|
|
694
|
+
kind: definition.kind,
|
|
695
|
+
ownerId,
|
|
696
|
+
portal: portal.id,
|
|
697
|
+
layer: definition.layer,
|
|
698
|
+
state: 'open',
|
|
699
|
+
dismissible: definition.dismissible,
|
|
700
|
+
focusPolicy: definition.focusPolicy,
|
|
701
|
+
escapePolicy: definition.escapePolicy,
|
|
702
|
+
pointerPolicy: definition.pointerPolicy,
|
|
703
|
+
scrollPolicy: definition.scrollPolicy,
|
|
704
|
+
zIndex: portal.zIndexStart + openInPortal * portal.zStep,
|
|
705
|
+
resources: definition.resources.slice(),
|
|
706
|
+
resourcesAcquired: false,
|
|
707
|
+
payload: cloneValue(metadata.payload, {}),
|
|
708
|
+
openedAt: metadata.at || 'static-local',
|
|
709
|
+
closedAt: null,
|
|
710
|
+
element: null
|
|
711
|
+
};
|
|
712
|
+
overlayStack.push(overlay);
|
|
713
|
+
const overlayRecord = surfaceManagerRecordForOverlay(overlay, definition);
|
|
714
|
+
callSurfaceManager('registerSurface', [overlayRecord], { overlayId: overlay.overlayId, instanceId: overlay.id, operation: 'register-overlay' });
|
|
715
|
+
callSurfaceManager('openSurface', [overlay.id, { zIndex: overlay.zIndex, portal: overlay.portal }], { overlayId: overlay.overlayId, instanceId: overlay.id, operation: 'open-overlay' });
|
|
716
|
+
if (definition.resources.length > 0) {
|
|
717
|
+
const overlayOwner = overlay.id;
|
|
718
|
+
if (resourceManager && typeof resourceManager.acquireMany === 'function') {
|
|
719
|
+
await resourceManager.acquireMany(definition.resources, overlayOwner, {
|
|
720
|
+
overlay: cloneValue(overlay, overlay),
|
|
721
|
+
surface: instances.get(ownerId) || null
|
|
722
|
+
});
|
|
723
|
+
overlay.resourcesAcquired = true;
|
|
724
|
+
} else {
|
|
725
|
+
publish('rmt.overlay.resources.missing_manager', `RMT Overlay ${definition.id} hat Ressourcen ohne Resource Manager.`, {
|
|
726
|
+
overlayId: definition.id,
|
|
727
|
+
resources: definition.resources
|
|
728
|
+
}, 'warning');
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
materializeOverlayElement(overlay, definition, portal, metadata);
|
|
732
|
+
publish('rmt.overlay.opened', `RMT Overlay ${definition.id} wurde geoeffnet.`, {
|
|
733
|
+
overlayId: definition.id,
|
|
734
|
+
instanceId: overlay.id,
|
|
735
|
+
kind: overlay.kind,
|
|
736
|
+
portal: overlay.portal,
|
|
737
|
+
zIndex: overlay.zIndex
|
|
738
|
+
});
|
|
739
|
+
return cloneOverlayInstance(overlay, overlay);
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
function closeOverlay(overlayRef, metadata = {}) {
|
|
743
|
+
const ref = clampString(overlayRef);
|
|
744
|
+
const openOverlays = overlayStack.filter((entry) => entry.state === 'open');
|
|
745
|
+
const overlay = openOverlays
|
|
746
|
+
.filter((entry) => entry.id === ref || entry.overlayId === ref)
|
|
747
|
+
.sort((left, right) => right.zIndex - left.zIndex)[0];
|
|
748
|
+
if (!overlay) {
|
|
749
|
+
return {
|
|
750
|
+
schema: 'xtend.epic18.rmt-overlay-close-report.v1',
|
|
751
|
+
closed: false,
|
|
752
|
+
overlay: ref
|
|
753
|
+
};
|
|
754
|
+
}
|
|
755
|
+
overlay.state = 'closed';
|
|
756
|
+
overlay.closedAt = metadata.at || 'static-local';
|
|
757
|
+
const definition = overlayIndex.get(overlay.overlayId) || {};
|
|
758
|
+
const removedElement = removeOverlayElement(overlay);
|
|
759
|
+
if (overlay.resourcesAcquired && definition.closeReleasesResources !== false && resourceManager && typeof resourceManager.releaseOwner === 'function') {
|
|
760
|
+
resourceManager.releaseOwner(overlay.id);
|
|
761
|
+
overlay.resourcesAcquired = false;
|
|
762
|
+
}
|
|
763
|
+
publish('rmt.overlay.closed', `RMT Overlay ${overlay.overlayId} wurde geschlossen.`, {
|
|
764
|
+
overlayId: overlay.overlayId,
|
|
765
|
+
instanceId: overlay.id,
|
|
766
|
+
reason: metadata.reason || 'close',
|
|
767
|
+
removedElement
|
|
768
|
+
});
|
|
769
|
+
callSurfaceManager('closeSurface', [overlay.id, metadata.reason || 'close'], { overlayId: overlay.overlayId, instanceId: overlay.id, operation: 'close-overlay' });
|
|
770
|
+
return {
|
|
771
|
+
schema: 'xtend.epic18.rmt-overlay-close-report.v1',
|
|
772
|
+
closed: true,
|
|
773
|
+
overlay: cloneOverlayInstance(overlay, overlay)
|
|
774
|
+
};
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
function closeTopOverlay(metadata = {}) {
|
|
778
|
+
const reason = clampString(metadata.reason, 'escape');
|
|
779
|
+
const portal = clampString(metadata.portal, '');
|
|
780
|
+
const candidate = overlayStack
|
|
781
|
+
.filter((entry) => entry.state === 'open')
|
|
782
|
+
.filter((entry) => !portal || entry.portal === portal)
|
|
783
|
+
.filter((entry) => entry.dismissible)
|
|
784
|
+
.filter((entry) => reason !== 'escape' || entry.escapePolicy !== 'ignore')
|
|
785
|
+
.sort((left, right) => right.zIndex - left.zIndex)[0];
|
|
786
|
+
if (!candidate) {
|
|
787
|
+
return {
|
|
788
|
+
schema: 'xtend.epic18.rmt-overlay-close-report.v1',
|
|
789
|
+
closed: false,
|
|
790
|
+
reason
|
|
791
|
+
};
|
|
792
|
+
}
|
|
793
|
+
return closeOverlay(candidate.id, { reason });
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
function getSnapshot() {
|
|
797
|
+
return {
|
|
798
|
+
schema: 'xtend.epic18.rmt-surface-resource-graph-snapshot.v1',
|
|
799
|
+
runtimeSchema: RMT_SURFACE_RESOURCE_GRAPH_RUNTIME_SCHEMA,
|
|
800
|
+
surfaces: [...instances.values()].map((instance) => ({
|
|
801
|
+
id: instance.id,
|
|
802
|
+
surfaceId: instance.surfaceId,
|
|
803
|
+
kind: instance.kind,
|
|
804
|
+
key: instance.key,
|
|
805
|
+
owner: instance.owner,
|
|
806
|
+
state: instance.state,
|
|
807
|
+
bounds: cloneValue(instance.bounds, instance.bounds),
|
|
808
|
+
previousBounds: cloneValue(instance.previousBounds, null),
|
|
809
|
+
zIndex: instance.zIndex,
|
|
810
|
+
focusOrder: instance.focusOrder,
|
|
811
|
+
resourcesAcquired: instance.resourcesAcquired,
|
|
812
|
+
metadata: cloneValue(instance.metadata, {})
|
|
813
|
+
})),
|
|
814
|
+
overlays: overlayStack.filter((entry) => entry.state === 'open').map((entry) => cloneOverlayInstance(entry, entry)),
|
|
815
|
+
portals: portals.map((portal) => ({
|
|
816
|
+
id: portal.id,
|
|
817
|
+
layer: portal.layer,
|
|
818
|
+
policy: portal.policy,
|
|
819
|
+
zIndexStart: portal.zIndexStart,
|
|
820
|
+
zStep: portal.zStep,
|
|
821
|
+
mounted: portal.mounted
|
|
822
|
+
}))
|
|
823
|
+
};
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
function persistSnapshot() {
|
|
827
|
+
const snapshot = getSnapshot();
|
|
828
|
+
if (persistenceAdapter && typeof persistenceAdapter.save === 'function') {
|
|
829
|
+
persistenceAdapter.save(snapshot);
|
|
830
|
+
}
|
|
831
|
+
publish('rmt.surface.snapshot.persisted', 'RMT Surface Graph Snapshot wurde persistiert.', {
|
|
832
|
+
surfaceCount: snapshot.surfaces.length,
|
|
833
|
+
overlayCount: snapshot.overlays.length
|
|
834
|
+
});
|
|
835
|
+
return snapshot;
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
function hydrateSnapshot(snapshot) {
|
|
839
|
+
const source = snapshot || (persistenceAdapter && typeof persistenceAdapter.load === 'function' ? persistenceAdapter.load() : null);
|
|
840
|
+
if (!source || !Array.isArray(source.surfaces)) {
|
|
841
|
+
return {
|
|
842
|
+
schema: 'xtend.epic18.rmt-surface-hydrate-report.v1',
|
|
843
|
+
hydratedCount: 0
|
|
844
|
+
};
|
|
845
|
+
}
|
|
846
|
+
let hydratedCount = 0;
|
|
847
|
+
source.surfaces.forEach((entry) => {
|
|
848
|
+
const current = instances.get(entry.id);
|
|
849
|
+
if (!current) return;
|
|
850
|
+
current.state = clampString(entry.state, current.state);
|
|
851
|
+
current.bounds = normalizeBounds(entry.bounds, current.bounds);
|
|
852
|
+
current.previousBounds = cloneValue(entry.previousBounds, current.previousBounds);
|
|
853
|
+
current.zIndex = Number.isFinite(entry.zIndex) ? entry.zIndex : current.zIndex;
|
|
854
|
+
current.focusOrder = Number.isFinite(entry.focusOrder) ? entry.focusOrder : current.focusOrder;
|
|
855
|
+
current.metadata = cloneValue(entry.metadata, current.metadata);
|
|
856
|
+
hydratedCount += 1;
|
|
857
|
+
});
|
|
858
|
+
publish('rmt.surface.snapshot.hydrated', 'RMT Surface Graph Snapshot wurde hydriert.', {
|
|
859
|
+
hydratedCount
|
|
860
|
+
});
|
|
861
|
+
return {
|
|
862
|
+
schema: 'xtend.epic18.rmt-surface-hydrate-report.v1',
|
|
863
|
+
hydratedCount
|
|
864
|
+
};
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
return Object.freeze({
|
|
868
|
+
schema: RMT_SURFACE_RESOURCE_GRAPH_RUNTIME_SCHEMA,
|
|
869
|
+
materialize,
|
|
870
|
+
openSurface,
|
|
871
|
+
closeSurface,
|
|
872
|
+
destroySurface,
|
|
873
|
+
minimizeSurface,
|
|
874
|
+
restoreSurface,
|
|
875
|
+
focusSurface,
|
|
876
|
+
setBounds,
|
|
877
|
+
moveSurface,
|
|
878
|
+
resizeSurface,
|
|
879
|
+
openOverlay,
|
|
880
|
+
closeOverlay,
|
|
881
|
+
closeTopOverlay,
|
|
882
|
+
mountPortal,
|
|
883
|
+
persistSnapshot,
|
|
884
|
+
hydrateSnapshot,
|
|
885
|
+
getSnapshot,
|
|
886
|
+
getSurface(surfaceRef) {
|
|
887
|
+
const instance = instances.get(clampString(surfaceRef));
|
|
888
|
+
return instance ? cloneValue(instance, instance) : null;
|
|
889
|
+
},
|
|
890
|
+
listSurfaces() {
|
|
891
|
+
return surfaces.map((surface) => cloneValue(surface, surface));
|
|
892
|
+
},
|
|
893
|
+
listInstances(optionsForList = {}) {
|
|
894
|
+
return [...instances.values()]
|
|
895
|
+
.filter((instance) => optionsForList.includeDestroyed === true || instance.state !== 'destroyed')
|
|
896
|
+
.map((instance) => cloneValue(instance, instance));
|
|
897
|
+
},
|
|
898
|
+
listOverlays(optionsForList = {}) {
|
|
899
|
+
return overlayStack
|
|
900
|
+
.filter((overlay) => optionsForList.includeClosed === true || overlay.state === 'open')
|
|
901
|
+
.map((overlay) => cloneOverlayInstance(overlay, overlay));
|
|
902
|
+
},
|
|
903
|
+
listPortals() {
|
|
904
|
+
return portals.map((portal) => cloneValue(portal, portal));
|
|
905
|
+
},
|
|
906
|
+
listDiagnostics() {
|
|
907
|
+
return diagnosticsRecorder.diagnostics.slice();
|
|
908
|
+
}
|
|
909
|
+
});
|
|
910
|
+
}
|
|
911
|
+
|
|
912
|
+
const api = {
|
|
913
|
+
RMT_SURFACE_RESOURCE_GRAPH_DIAGNOSTIC_SCHEMA,
|
|
914
|
+
RMT_SURFACE_RESOURCE_GRAPH_RUNTIME_SCHEMA,
|
|
915
|
+
createRmtSurfaceResourceGraphRuntime
|
|
916
|
+
};
|
|
917
|
+
|
|
918
|
+
if (typeof module !== 'undefined' && module.exports) {
|
|
919
|
+
module.exports = api;
|
|
920
|
+
}
|
|
921
|
+
if (globalTarget) {
|
|
922
|
+
globalTarget.XTendRmtSurfaceResourceGraphRuntime = api;
|
|
923
|
+
}
|
|
924
|
+
})(typeof globalThis !== 'undefined' ? globalThis : (typeof window !== 'undefined' ? window : this));
|
|
925
|
+
|
|
926
|
+
const __XTEND_RMT_SURFACE_RESOURCE_GRAPH_RUNTIME_API__ = globalThis.XTendRmtSurfaceResourceGraphRuntime;
|
|
927
|
+
|
|
928
|
+
export const RMT_SURFACE_RESOURCE_GRAPH_DIAGNOSTIC_SCHEMA = __XTEND_RMT_SURFACE_RESOURCE_GRAPH_RUNTIME_API__.RMT_SURFACE_RESOURCE_GRAPH_DIAGNOSTIC_SCHEMA;
|
|
929
|
+
export const RMT_SURFACE_RESOURCE_GRAPH_RUNTIME_SCHEMA = __XTEND_RMT_SURFACE_RESOURCE_GRAPH_RUNTIME_API__.RMT_SURFACE_RESOURCE_GRAPH_RUNTIME_SCHEMA;
|
|
930
|
+
export const createRmtSurfaceResourceGraphRuntime = __XTEND_RMT_SURFACE_RESOURCE_GRAPH_RUNTIME_API__.createRmtSurfaceResourceGraphRuntime;
|
|
931
|
+
|
|
932
|
+
export default __XTEND_RMT_SURFACE_RESOURCE_GRAPH_RUNTIME_API__;
|