@ccslabs/xtend 0.1.0-rc.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/CHANGELOG.md +65 -0
- package/LICENSE +201 -0
- package/README.md +184 -0
- package/a11y/motion-contrast-policy.d.ts +32 -0
- package/a11y/motion-contrast-policy.js +261 -0
- package/a11y/runtime-a11y-contract.d.ts +44 -0
- package/a11y/runtime-a11y-contract.js +385 -0
- package/a11y/screenreader-signals.d.ts +32 -0
- package/a11y/screenreader-signals.js +372 -0
- package/api.d.ts +168 -0
- package/api.js +864 -0
- package/catalog/catalog-public-types.d.ts +66 -0
- package/catalog/component-catalog-coverage.d.ts +20 -0
- package/catalog/component-catalog-coverage.js +377 -0
- package/catalog/component-long-tail-migration.d.ts +18 -0
- package/catalog/component-long-tail-migration.js +305 -0
- package/catalog/component-regression-priority.d.ts +20 -0
- package/catalog/component-regression-priority.js +305 -0
- package/catalog/enterprise-component-flex-release-handoff.d.ts +32 -0
- package/catalog/enterprise-component-flex-release-handoff.js +437 -0
- package/catalog/enterprise-component-style-audit.d.ts +22 -0
- package/catalog/enterprise-component-style-audit.js +353 -0
- package/catalog/enterprise-form-control-theme-a11y.d.ts +19 -0
- package/catalog/enterprise-form-control-theme-a11y.js +220 -0
- package/catalog/enterprise-icon-control-audit.d.ts +21 -0
- package/catalog/enterprise-icon-control-audit.js +258 -0
- package/catalog/enterprise-layout-display-media-tokenization.d.ts +20 -0
- package/catalog/enterprise-layout-display-media-tokenization.js +237 -0
- package/catalog/enterprise-navigation-routing-state-hardening.d.ts +20 -0
- package/catalog/enterprise-navigation-routing-state-hardening.js +255 -0
- package/catalog/enterprise-overlay-mode-token-parity.d.ts +15 -0
- package/catalog/enterprise-overlay-mode-token-parity.js +178 -0
- package/catalog/enterprise-third-party-authoring-guide.d.ts +23 -0
- package/catalog/enterprise-third-party-authoring-guide.js +310 -0
- package/catalog/enterprise-visual-dom-snapshot-matrix.d.ts +31 -0
- package/catalog/enterprise-visual-dom-snapshot-matrix.js +357 -0
- package/catalog/epic10-existing-component-metadata.d.ts +25 -0
- package/catalog/epic10-existing-component-metadata.js +534 -0
- package/catalog/epic10-p0-component-wave.d.ts +28 -0
- package/catalog/epic10-p0-component-wave.js +688 -0
- package/catalog/epic10-platform-gates.d.ts +31 -0
- package/catalog/epic10-platform-gates.js +425 -0
- package/catalog/epic10-release-handoff.d.ts +30 -0
- package/catalog/epic10-release-handoff.js +195 -0
- package/catalog/epic11-enterprise-ux-handoff.d.ts +29 -0
- package/catalog/epic11-enterprise-ux-handoff.js +403 -0
- package/catalog/epic12-docs-adoption.d.ts +29 -0
- package/catalog/epic12-docs-adoption.js +183 -0
- package/catalog/epic12-rc0-gate-matrix.d.ts +36 -0
- package/catalog/epic12-rc0-gate-matrix.js +439 -0
- package/catalog/epic12-rc0-handoff.d.ts +30 -0
- package/catalog/epic12-rc0-handoff.js +385 -0
- package/catalog/epic13-conditional-network-evidence-ci.d.ts +35 -0
- package/catalog/epic13-conditional-network-evidence-ci.js +278 -0
- package/catalog/epic13-conditional-network-evidence.d.ts +34 -0
- package/catalog/epic13-conditional-network-evidence.js +280 -0
- package/catalog/epic13-docs-rmt-production-hardening.d.ts +39 -0
- package/catalog/epic13-docs-rmt-production-hardening.js +286 -0
- package/catalog/epic13-hydration-performance-closure.d.ts +33 -0
- package/catalog/epic13-hydration-performance-closure.js +234 -0
- package/catalog/epic13-known-residual-triage.d.ts +32 -0
- package/catalog/epic13-known-residual-triage.js +339 -0
- package/catalog/epic13-package-export-lock.d.ts +41 -0
- package/catalog/epic13-package-export-lock.js +604 -0
- package/catalog/epic13-prod-browser-csp-smoke.d.ts +35 -0
- package/catalog/epic13-prod-browser-csp-smoke.js +218 -0
- package/catalog/epic13-rc1-gate-matrix-ci-handoff.d.ts +36 -0
- package/catalog/epic13-rc1-gate-matrix-ci-handoff.js +418 -0
- package/catalog/epic13-rc1-migration-notes.d.ts +36 -0
- package/catalog/epic13-rc1-migration-notes.js +271 -0
- package/catalog/epic13-rc1-readiness.d.ts +33 -0
- package/catalog/epic13-rc1-readiness.js +487 -0
- package/catalog/epic13-release-owner-acceptance.d.ts +33 -0
- package/catalog/epic13-release-owner-acceptance.js +354 -0
- package/catalog/epic13-release-report-pack-dry-run-evidence.d.ts +36 -0
- package/catalog/epic13-release-report-pack-dry-run-evidence.js +253 -0
- package/catalog/epic13-rmt-production-readiness.d.ts +35 -0
- package/catalog/epic13-rmt-production-readiness.js +314 -0
- package/catalog/epic13-trusted-dom-boundary.d.ts +36 -0
- package/catalog/epic13-trusted-dom-boundary.js +230 -0
- package/catalog/epic13-visual-owner-artifact.d.ts +35 -0
- package/catalog/epic13-visual-owner-artifact.js +233 -0
- package/catalog/epic14-lsp-handoff.d.ts +28 -0
- package/catalog/epic14-lsp-handoff.js +312 -0
- package/catalog/epic14-rmt-tooling.d.ts +33 -0
- package/catalog/epic14-rmt-tooling.js +282 -0
- package/catalog/surface-manager-adapter-runtime.d.ts +37 -0
- package/catalog/surface-manager-adapter-runtime.js +203 -0
- package/catalog/surface-manager-browser-lab.d.ts +39 -0
- package/catalog/surface-manager-browser-lab.js +225 -0
- package/catalog/surface-manager-controller.d.ts +43 -0
- package/catalog/surface-manager-controller.js +290 -0
- package/catalog/surface-manager-layout-engines.d.ts +32 -0
- package/catalog/surface-manager-layout-engines.js +161 -0
- package/catalog/surface-manager-lazy-loading.d.ts +35 -0
- package/catalog/surface-manager-lazy-loading.js +173 -0
- package/catalog/surface-manager-materialization.d.ts +37 -0
- package/catalog/surface-manager-materialization.js +202 -0
- package/catalog/surface-manager-native-rmt-surfaces.d.ts +48 -0
- package/catalog/surface-manager-native-rmt-surfaces.js +325 -0
- package/catalog/surface-manager-overlay-bridge.d.ts +42 -0
- package/catalog/surface-manager-overlay-bridge.js +247 -0
- package/catalog/surface-manager-persistence.d.ts +37 -0
- package/catalog/surface-manager-persistence.js +178 -0
- package/catalog/surface-manager-quality-gates.d.ts +48 -0
- package/catalog/surface-manager-quality-gates.js +324 -0
- package/catalog/surface-manager-release-handoff.d.ts +47 -0
- package/catalog/surface-manager-release-handoff.js +274 -0
- package/catalog/surface-manager-remote-policy.d.ts +34 -0
- package/catalog/surface-manager-remote-policy.js +199 -0
- package/catalog/surface-manager-rmt-authoring.d.ts +44 -0
- package/catalog/surface-manager-rmt-authoring.js +368 -0
- package/catalog/surface-manager-route-lifecycle.d.ts +32 -0
- package/catalog/surface-manager-route-lifecycle.js +162 -0
- package/catalog/surface-manager-runtime-release-handoff.d.ts +36 -0
- package/catalog/surface-manager-runtime-release-handoff.js +245 -0
- package/catalog/surface-manager-side-panel-runtime.d.ts +46 -0
- package/catalog/surface-manager-side-panel-runtime.js +307 -0
- package/catalog/surface-manager-stack-policy.d.ts +32 -0
- package/catalog/surface-manager-stack-policy.js +169 -0
- package/catalog/surface-manager-window-runtime.d.ts +45 -0
- package/catalog/surface-manager-window-runtime.js +285 -0
- package/catalog/surface-manager-workbench-fixture.d.ts +50 -0
- package/catalog/surface-manager-workbench-fixture.js +315 -0
- package/catalog/type-exports-api.js +236 -0
- package/catalog/type-exports-builder.js +405 -0
- package/catalog/type-exports-catalog.js +394 -0
- package/catalog/type-exports-loader.js +266 -0
- package/catalog/type-exports-policy.js +461 -0
- package/catalog/type-exports-rmt.js +407 -0
- package/catalog/type-exports-vendor.js +365 -0
- package/catalog/type-exports.js +574 -0
- package/components/icon-packs/core.js +154 -0
- package/components/icon-packs/lucide.js +136 -0
- package/components/manifest.json +44 -0
- package/components/prism.d.ts +73 -0
- package/components/prism.js +300 -0
- package/components/turndown.d.ts +34 -0
- package/components/turndown.js +107 -0
- package/components/x-rmt-lifecycle-demo-build.d.ts +78 -0
- package/components/x-rmt-lifecycle-demo-build.js +1175 -0
- package/components/x-rmt-lifecycle-demo.d.ts +83 -0
- package/components/x-rmt-lifecycle-demo.js +1175 -0
- package/components/xalert.d.ts +42 -0
- package/components/xalert.js +538 -0
- package/components/xbutton.d.ts +127 -0
- package/components/xbutton.js +612 -0
- package/components/xcalendar.d.ts +39 -0
- package/components/xcalendar.js +338 -0
- package/components/xcards.d.ts +34 -0
- package/components/xcards.js +253 -0
- package/components/xcheckbox.d.ts +48 -0
- package/components/xcheckbox.js +448 -0
- package/components/xcode.d.ts +35 -0
- package/components/xcode.js +370 -0
- package/components/xdialog.d.ts +48 -0
- package/components/xdialog.js +763 -0
- package/components/xdrawer.d.ts +61 -0
- package/components/xdrawer.js +654 -0
- package/components/xfooter.d.ts +41 -0
- package/components/xfooter.js +351 -0
- package/components/xform.d.ts +43 -0
- package/components/xform.js +456 -0
- package/components/xheader.d.ts +68 -0
- package/components/xheader.js +1253 -0
- package/components/xhero.d.ts +42 -0
- package/components/xhero.js +475 -0
- package/components/xicon.d.ts +146 -0
- package/components/xicon.js +688 -0
- package/components/xinput.d.ts +37 -0
- package/components/xinput.js +444 -0
- package/components/xlightbox.d.ts +48 -0
- package/components/xlightbox.js +571 -0
- package/components/xlink.d.ts +63 -0
- package/components/xlink.js +565 -0
- package/components/xmasonry.d.ts +35 -0
- package/components/xmasonry.js +666 -0
- package/components/xmenu.d.ts +118 -0
- package/components/xmenu.js +1005 -0
- package/components/xmodal.d.ts +64 -0
- package/components/xmodal.js +831 -0
- package/components/xplayer.d.ts +57 -0
- package/components/xplayer.js +1748 -0
- package/components/xpopover.d.ts +54 -0
- package/components/xpopover.js +466 -0
- package/components/xprogress.d.ts +40 -0
- package/components/xprogress.js +345 -0
- package/components/xradio.d.ts +50 -0
- package/components/xradio.js +474 -0
- package/components/xrouter.d.ts +244 -0
- package/components/xrouter.js +1841 -0
- package/components/xsection.d.ts +34 -0
- package/components/xsection.js +253 -0
- package/components/xselect.d.ts +46 -0
- package/components/xselect.js +463 -0
- package/components/xsidepanel.d.ts +56 -0
- package/components/xsidepanel.js +728 -0
- package/components/xspinner.d.ts +38 -0
- package/components/xspinner.js +388 -0
- package/components/xstate.d.ts +137 -0
- package/components/xstate.js +493 -0
- package/components/xstatus.d.ts +41 -0
- package/components/xstatus.js +381 -0
- package/components/xsummary.d.ts +43 -0
- package/components/xsummary.js +293 -0
- package/components/xsurfacemanager-controller.d.ts +130 -0
- package/components/xsurfacemanager-controller.js +699 -0
- package/components/xsurfacemanager.d.ts +452 -0
- package/components/xsurfacemanager.js +3775 -0
- package/components/xsurfaceoverlay-bridge.d.ts +43 -0
- package/components/xsurfaceoverlay-bridge.js +238 -0
- package/components/xsurfacewindow.d.ts +50 -0
- package/components/xsurfacewindow.js +576 -0
- package/components/xtabs.d.ts +73 -0
- package/components/xtabs.js +611 -0
- package/components/xtend-public-types.d.ts +208 -0
- package/components/xtextarea.d.ts +46 -0
- package/components/xtextarea.js +451 -0
- package/components/xtheme.d.ts +253 -0
- package/components/xtheme.js +1438 -0
- package/components/xtoast.d.ts +39 -0
- package/components/xtoast.js +389 -0
- package/components/xtooltip.d.ts +53 -0
- package/components/xtooltip.js +432 -0
- package/components/xtype.d.ts +42 -0
- package/components/xtype.js +244 -0
- package/components/xutils.d.ts +164 -0
- package/components/xutils.js +496 -0
- package/components/xwriter.d.ts +67 -0
- package/components/xwriter.js +854 -0
- package/design-tokens/themes/enterprise-light.json +40 -0
- package/design-tokens/themes/xtend-signature.json +126 -0
- package/design-tokens/xtend-design-tokens.d.ts +95 -0
- package/design-tokens/xtend-design-tokens.js +395 -0
- package/design-tokens/xtheme-token-alias-layer.d.ts +84 -0
- package/design-tokens/xtheme-token-alias-layer.js +423 -0
- package/docs/.htaccess +51 -0
- package/docs/README.md +340 -0
- package/docs/XTend-ADR.md +221 -0
- package/docs/a11y-keyboard-smokes.md +62 -0
- package/docs/about.md +18 -0
- package/docs/api.md +157 -0
- package/docs/best-practices.md +76 -0
- package/docs/component-catalog-coverage.md +58 -0
- package/docs/component-lab.md +103 -0
- package/docs/component-long-tail-migration.md +41 -0
- package/docs/component-platform.md +159 -0
- package/docs/component-ux-app-authoring.md +130 -0
- package/docs/component-ux-authoring.md +96 -0
- package/docs/component-ux-gates.md +45 -0
- package/docs/components/x-rmt-lifecycle-demo-build.md +60 -0
- package/docs/components/xalert.md +81 -0
- package/docs/components/xbutton.md +103 -0
- package/docs/components/xcalendar.md +82 -0
- package/docs/components/xcards.md +128 -0
- package/docs/components/xcheckbox.md +102 -0
- package/docs/components/xcode.md +126 -0
- package/docs/components/xdialog.md +92 -0
- package/docs/components/xdrawer.md +84 -0
- package/docs/components/xfooter.md +126 -0
- package/docs/components/xform.md +128 -0
- package/docs/components/xheader.md +308 -0
- package/docs/components/xhero.md +142 -0
- package/docs/components/xicon.md +125 -0
- package/docs/components/xinput.md +129 -0
- package/docs/components/xlightbox.md +98 -0
- package/docs/components/xlink.md +109 -0
- package/docs/components/xmasonry.md +124 -0
- package/docs/components/xmenu.md +158 -0
- package/docs/components/xmodal.md +82 -0
- package/docs/components/xplayer.md +104 -0
- package/docs/components/xpopover.md +67 -0
- package/docs/components/xprogress.md +56 -0
- package/docs/components/xradio.md +103 -0
- package/docs/components/xrouter.md +260 -0
- package/docs/components/xsection.md +125 -0
- package/docs/components/xselect.md +105 -0
- package/docs/components/xsidepanel.md +30 -0
- package/docs/components/xspinner.md +102 -0
- package/docs/components/xstate.md +148 -0
- package/docs/components/xstatus.md +55 -0
- package/docs/components/xsummary.md +78 -0
- package/docs/components/xsurfacemanager.md +27 -0
- package/docs/components/xsurfacewindow.md +21 -0
- package/docs/components/xtabs.md +160 -0
- package/docs/components/xtextarea.md +98 -0
- package/docs/components/xtheme.md +167 -0
- package/docs/components/xtoast.md +62 -0
- package/docs/components/xtooltip.md +66 -0
- package/docs/components/xtype.md +82 -0
- package/docs/components/xutils.md +144 -0
- package/docs/components/xwriter.md +94 -0
- package/docs/components.md +117 -0
- package/docs/conditional-network-evidence-ci.md +38 -0
- package/docs/conditional-network-evidence.md +50 -0
- package/docs/core-migration-guide.md +110 -0
- package/docs/design-tokens.md +116 -0
- package/docs/docs-rmt-production-hardening.md +31 -0
- package/docs/enterprise-adoption.md +411 -0
- package/docs/enterprise-component-flex-release-handoff.md +129 -0
- package/docs/epic10-platform-gates.md +62 -0
- package/docs/epic10-release-handoff.md +81 -0
- package/docs/epic11-enterprise-ux-handoff.md +70 -0
- package/docs/epic12-rc0-handoff.md +61 -0
- package/docs/existing-component-metadata.md +67 -0
- package/docs/hydration-performance-closure.md +34 -0
- package/docs/hydration-policies.md +71 -0
- package/docs/index.php +1625 -0
- package/docs/known-residual-triage.md +22 -0
- package/docs/manifest-import-policy.md +79 -0
- package/docs/manifest.md +106 -0
- package/docs/menu.json +1190 -0
- package/docs/motion-contrast.md +67 -0
- package/docs/package-export-lock.md +44 -0
- package/docs/performance-measurements.md +106 -0
- package/docs/performance-regression.md +89 -0
- package/docs/performance.md +94 -0
- package/docs/previews/README.md +17 -0
- package/docs/prod-browser-csp-smokes.md +40 -0
- package/docs/public-component-types.md +79 -0
- package/docs/quick-start-guide.md +152 -0
- package/docs/rc0-adoption-guide.md +102 -0
- package/docs/rc0-gate-matrix.md +58 -0
- package/docs/rc1-gate-matrix-ci-handoff.md +56 -0
- package/docs/rc1-migration-notes.md +69 -0
- package/docs/rc1-readiness.md +46 -0
- package/docs/release-owner-acceptance.md +56 -0
- package/docs/release-report-pack-dry-run-evidence.md +39 -0
- package/docs/rmt-dsl-authoring-polish.md +122 -0
- package/docs/rmt-first-demo-app.md +77 -0
- package/docs/rmt-first-xtend-apps.md +105 -0
- package/docs/rmt-kernel-panic-recovery-incident-handoff.md +61 -0
- package/docs/rmt-kernel-security-hardening-migration.md +50 -0
- package/docs/rmt-kernel-trusted-output-authoring.md +69 -0
- package/docs/rmt-language-server.md +177 -0
- package/docs/rmt-lifecycle-demo.md +25 -0
- package/docs/rmt-linter.md +140 -0
- package/docs/rmt-production-readiness.md +63 -0
- package/docs/rmt-tooling-release-gates.md +77 -0
- package/docs/rmt-vnext-authoring.md +60 -0
- package/docs/rmt-vnext-cross-surface-events.md +68 -0
- package/docs/rmt-vnext-enterprise-mfe-handoff.md +70 -0
- package/docs/rmt-vnext-migration-notes.md +62 -0
- package/docs/rmt-vnext-release-handoff.md +69 -0
- package/docs/rmt-vnext-remote-surfaces.md +90 -0
- package/docs/rmt-vnext-surface-registry-enterprise.md +76 -0
- package/docs/screenreader-signals.md +56 -0
- package/docs/supply-chain-gates.md +100 -0
- package/docs/surface-manager-authoring-guide.md +94 -0
- package/docs/surface-manager-browser-lab.md +45 -0
- package/docs/surface-manager-component-lab.md +43 -0
- package/docs/surface-manager-controller.md +66 -0
- package/docs/surface-manager-layout-engines.md +32 -0
- package/docs/surface-manager-lazy-hydration.md +63 -0
- package/docs/surface-manager-migration-guide.md +94 -0
- package/docs/surface-manager-native-rmt-surfaces.md +38 -0
- package/docs/surface-manager-overlay-bridge.md +53 -0
- package/docs/surface-manager-persistence.md +30 -0
- package/docs/surface-manager-quality-gates.md +51 -0
- package/docs/surface-manager-release-handoff.md +68 -0
- package/docs/surface-manager-remote-policy.md +54 -0
- package/docs/surface-manager-rmt-authoring.md +86 -0
- package/docs/surface-manager-route-lifecycle.md +59 -0
- package/docs/surface-manager-runtime-release-handoff.md +69 -0
- package/docs/surface-manager-side-panel-runtime.md +36 -0
- package/docs/surface-manager-stack-policy.md +39 -0
- package/docs/surface-manager-window-runtime.md +47 -0
- package/docs/surface-manager-workbench-fixture.md +43 -0
- package/docs/third-party-design-authoring.md +406 -0
- package/docs/trusted-dom-boundary-browser-proof.md +32 -0
- package/docs/trusted-dom-sanitizing.md +110 -0
- package/docs/type-exports.md +61 -0
- package/docs/typescript-components.md +63 -0
- package/docs/utils/fabric-runtime.js +650 -0
- package/docs/utils/pageloader.js +2823 -0
- package/docs/utils/parsedown.php +298 -0
- package/docs/visual-browser-regression.md +83 -0
- package/docs/visual-owner-artifacts.md +46 -0
- package/docs/visual-snapshot-automation.md +87 -0
- package/docs/xtend-api-types.md +55 -0
- package/docs/xtend-builder-types.md +55 -0
- package/docs/xtend-catalog-types.md +44 -0
- package/docs/xtend-fabric-rmt-lane-mapping.md +143 -0
- package/docs/xtend-fabric.md +474 -0
- package/docs/xtend-loader-types.md +58 -0
- package/docs/xtend-loader.md +265 -0
- package/docs/xtend-policy-types.md +38 -0
- package/docs/xtend-rmt-types.md +39 -0
- package/docs/xtend-vendor-types.md +36 -0
- package/docs/xtendrmt-app-dsl.md +269 -0
- package/docs/xtendrmt-migration-guide.md +235 -0
- package/docs/xtendrmt-native-authoring.md +337 -0
- package/docs/xtendrmt-overview.md +89 -0
- package/docs/xtendrmt-parsedown-docs.rmt +956 -0
- package/docs/xtendrmt-parsedown-scheduling.md +301 -0
- package/docs/xtendrmt-runtime-bridge.md +155 -0
- package/fabric/hydration-policy.d.ts +27 -0
- package/fabric/hydration-policy.js +306 -0
- package/fabric/package.json +58 -0
- package/fabric/rmt-lane-mapping.d.ts +47 -0
- package/fabric/rmt-lane-mapping.js +504 -0
- package/fabric/xtend-fabric.d.ts +81 -0
- package/fabric/xtend-fabric.js +2669 -0
- package/fabric/xtend-policy-public-types.d.ts +135 -0
- package/package.json +8225 -0
- package/security/README.md +54 -0
- package/security/manifest-import-policy.d.ts +43 -0
- package/security/manifest-import-policy.js +260 -0
- package/security/supply-chain-gate-policy.d.ts +45 -0
- package/security/supply-chain-gate-policy.js +249 -0
- package/security/trusted-dom-policy.d.ts +36 -0
- package/security/trusted-dom-policy.js +316 -0
- package/tools/package.json +77 -0
- package/tools/rmt-editor/vscode/README.md +33 -0
- package/tools/rmt-editor/vscode/extension.d.ts +9 -0
- package/tools/rmt-editor/vscode/extension.js +55 -0
- package/tools/rmt-editor/vscode/language-configuration.json +28 -0
- package/tools/rmt-editor/vscode/package.json +83 -0
- package/tools/rmt-editor/vscode/snippets/rmt.code-snippets +243 -0
- package/tools/rmt-editor/vscode/syntaxes/rmt.tmLanguage.json +13 -0
- package/tools/rmt-editor/vscode/xtend-rmt-language-0.0.0-enterprise-readiness.vsix +0 -0
- package/tools/rmt-language/code-actions.d.ts +15 -0
- package/tools/rmt-language/code-actions.js +566 -0
- package/tools/rmt-language/completions.d.ts +22 -0
- package/tools/rmt-language/completions.js +475 -0
- package/tools/rmt-language/definitions.d.ts +13 -0
- package/tools/rmt-language/definitions.js +212 -0
- package/tools/rmt-language/diagnostics.d.ts +23 -0
- package/tools/rmt-language/diagnostics.js +486 -0
- package/tools/rmt-language/format-adapter.d.ts +16 -0
- package/tools/rmt-language/format-adapter.js +270 -0
- package/tools/rmt-language/hover.d.ts +12 -0
- package/tools/rmt-language/hover.js +326 -0
- package/tools/rmt-language/kernel-escalation.d.ts +122 -0
- package/tools/rmt-language/kernel-escalation.js +427 -0
- package/tools/rmt-language/kernel-panic-monitor.d.ts +176 -0
- package/tools/rmt-language/kernel-panic-monitor.js +674 -0
- package/tools/rmt-language/kernel-policy-parity.d.ts +142 -0
- package/tools/rmt-language/kernel-policy-parity.js +629 -0
- package/tools/rmt-language/kernel-recovery.d.ts +173 -0
- package/tools/rmt-language/kernel-recovery.js +666 -0
- package/tools/rmt-language/kernel-scheduler-failure.d.ts +136 -0
- package/tools/rmt-language/kernel-scheduler-failure.js +486 -0
- package/tools/rmt-language/kernel-security-regression.d.ts +154 -0
- package/tools/rmt-language/kernel-security-regression.js +465 -0
- package/tools/rmt-language/kernel-trust-authority.d.ts +120 -0
- package/tools/rmt-language/kernel-trust-authority.js +549 -0
- package/tools/rmt-language/parser.d.ts +14 -0
- package/tools/rmt-language/parser.js +111 -0
- package/tools/rmt-language/rmt-tooling-public-types.d.ts +179 -0
- package/tools/rmt-language/rules/boundary-policy.js +81 -0
- package/tools/rmt-language/rules/document-policy.js +65 -0
- package/tools/rmt-language/rules/index.js +29 -0
- package/tools/rmt-language/rules/route-policy.js +81 -0
- package/tools/rmt-language/rules/scheduler-policy.js +66 -0
- package/tools/rmt-language/rules/template-policy.js +130 -0
- package/tools/rmt-language/semantic-graph.d.ts +18 -0
- package/tools/rmt-language/semantic-graph.js +827 -0
- package/tools/rmt-language/snippets/README.md +17 -0
- package/tools/rmt-language/snippets/index.d.ts +17 -0
- package/tools/rmt-language/snippets/index.js +417 -0
- package/tools/rmt-language/snippets/rmt.code-snippets +243 -0
- package/tools/rmt-language/source-model.d.ts +14 -0
- package/tools/rmt-language/source-model.js +731 -0
- package/tools/rmt-language/symbols.d.ts +13 -0
- package/tools/rmt-language/symbols.js +183 -0
- package/tools/rmt-language/vnext-compatibility.d.ts +28 -0
- package/tools/rmt-language/vnext-compatibility.js +675 -0
- package/tools/rmt-language/vnext-compiler.d.ts +17 -0
- package/tools/rmt-language/vnext-compiler.js +716 -0
- package/tools/rmt-language/vnext-composition.d.ts +30 -0
- package/tools/rmt-language/vnext-composition.js +595 -0
- package/tools/rmt-language/vnext-conditions.d.ts +25 -0
- package/tools/rmt-language/vnext-conditions.js +474 -0
- package/tools/rmt-language/vnext-cross-surface-events.d.ts +30 -0
- package/tools/rmt-language/vnext-cross-surface-events.js +607 -0
- package/tools/rmt-language/vnext-degradation.d.ts +23 -0
- package/tools/rmt-language/vnext-degradation.js +428 -0
- package/tools/rmt-language/vnext-enterprise-fixtures.d.ts +28 -0
- package/tools/rmt-language/vnext-enterprise-fixtures.js +487 -0
- package/tools/rmt-language/vnext-enterprise-registry.d.ts +21 -0
- package/tools/rmt-language/vnext-enterprise-registry.js +495 -0
- package/tools/rmt-language/vnext-enterprise-release.d.ts +44 -0
- package/tools/rmt-language/vnext-enterprise-release.js +472 -0
- package/tools/rmt-language/vnext-event-governance.d.ts +29 -0
- package/tools/rmt-language/vnext-event-governance.js +488 -0
- package/tools/rmt-language/vnext-events.d.ts +44 -0
- package/tools/rmt-language/vnext-events.js +680 -0
- package/tools/rmt-language/vnext-import-resolver.d.ts +28 -0
- package/tools/rmt-language/vnext-import-resolver.js +642 -0
- package/tools/rmt-language/vnext-lifecycle.d.ts +22 -0
- package/tools/rmt-language/vnext-lifecycle.js +404 -0
- package/tools/rmt-language/vnext-parser.d.ts +21 -0
- package/tools/rmt-language/vnext-parser.js +1391 -0
- package/tools/rmt-language/vnext-regression.d.ts +25 -0
- package/tools/rmt-language/vnext-regression.js +394 -0
- package/tools/rmt-language/vnext-release.d.ts +29 -0
- package/tools/rmt-language/vnext-release.js +293 -0
- package/tools/rmt-language/vnext-remote-compatibility.d.ts +33 -0
- package/tools/rmt-language/vnext-remote-compatibility.js +892 -0
- package/tools/rmt-language/vnext-remote-compiler.d.ts +14 -0
- package/tools/rmt-language/vnext-remote-compiler.js +520 -0
- package/tools/rmt-language/vnext-remote-manifest.d.ts +33 -0
- package/tools/rmt-language/vnext-remote-manifest.js +538 -0
- package/tools/rmt-language/vnext-remote-security.d.ts +27 -0
- package/tools/rmt-language/vnext-remote-security.js +380 -0
- package/tools/rmt-language/vnext-remote-tooling.d.ts +25 -0
- package/tools/rmt-language/vnext-remote-tooling.js +805 -0
- package/tools/rmt-language/vnext-scheduler.d.ts +24 -0
- package/tools/rmt-language/vnext-scheduler.js +469 -0
- package/tools/rmt-language/vnext-security.d.ts +28 -0
- package/tools/rmt-language/vnext-security.js +597 -0
- package/tools/rmt-language/vnext-streaming.d.ts +28 -0
- package/tools/rmt-language/vnext-streaming.js +593 -0
- package/tools/rmt-language/vnext-surfaces.d.ts +24 -0
- package/tools/rmt-language/vnext-surfaces.js +406 -0
- package/tools/rmt-language/vnext-tooling.d.ts +25 -0
- package/tools/rmt-language/vnext-tooling.js +728 -0
- package/tools/rmt-language-server/protocol.d.ts +22 -0
- package/tools/rmt-language-server/protocol.js +352 -0
- package/tools/rmt-language-server/server.d.ts +15 -0
- package/tools/rmt-language-server/server.js +622 -0
- package/tools/rmt-linter/cli.d.ts +14 -0
- package/tools/rmt-linter/cli.js +450 -0
- package/tools/rmt-linter/reporter.d.ts +16 -0
- package/tools/rmt-linter/reporter.js +472 -0
- package/xtend-builder/README.md +83 -0
- package/xtend-builder/a11y/README.md +42 -0
- package/xtend-builder/a11y/component-a11y-profile.d.ts +14 -0
- package/xtend-builder/a11y/component-a11y-profile.js +314 -0
- package/xtend-builder/blueprints/README.md +105 -0
- package/xtend-builder/blueprints/component-blueprint.contract.d.ts +16 -0
- package/xtend-builder/blueprints/component-blueprint.contract.js +343 -0
- package/xtend-builder/builder-public-types.d.ts +234 -0
- package/xtend-builder/extensions/README.md +26 -0
- package/xtend-builder/extensions/component-extension-points.d.ts +11 -0
- package/xtend-builder/extensions/component-extension-points.js +277 -0
- package/xtend-builder/generators/README.md +149 -0
- package/xtend-builder/generators/component-files.d.ts +5 -0
- package/xtend-builder/generators/component-files.js +769 -0
- package/xtend-builder/generators/component-plan.d.ts +4 -0
- package/xtend-builder/generators/component-plan.js +104 -0
- package/xtend-builder/generators/registry.d.ts +6 -0
- package/xtend-builder/generators/registry.js +118 -0
- package/xtend-builder/generators/rmt-build.js +738 -0
- package/xtend-builder/generators/rmt-lifecycle-demo.js +922 -0
- package/xtend-builder/lib/cli.d.ts +9 -0
- package/xtend-builder/lib/cli.js +543 -0
- package/xtend-builder/lib/layout.d.ts +6 -0
- package/xtend-builder/lib/layout.js +153 -0
- package/xtend-builder/lib/package-resolver.js +25 -0
- package/xtend-builder/package.json +90 -0
- package/xtend-builder/performance/README.md +31 -0
- package/xtend-builder/performance/component-performance-profile.d.ts +11 -0
- package/xtend-builder/performance/component-performance-profile.js +347 -0
- package/xtend-builder/performance/component-ux-performance-contract.d.ts +27 -0
- package/xtend-builder/performance/component-ux-performance-contract.js +424 -0
- package/xtend-builder/preview/README.md +61 -0
- package/xtend-builder/preview/component-lab-ux-inspector.d.ts +20 -0
- package/xtend-builder/preview/component-lab-ux-inspector.js +448 -0
- package/xtend-builder/preview/component-lab.d.ts +14 -0
- package/xtend-builder/preview/component-lab.js +278 -0
- package/xtend-builder/preview/component-preview.d.ts +5 -0
- package/xtend-builder/preview/component-preview.js +160 -0
- package/xtend-builder/scaffold.config.d.ts +4 -0
- package/xtend-builder/scaffold.config.js +2056 -0
- package/xtend-builder/scaffold.d.ts +3 -0
- package/xtend-builder/scaffold.js +11 -0
- package/xtend-builder/templates/README.md +33 -0
- package/xtend-builder/templates/component/a11y.template.ts +11 -0
- package/xtend-builder/templates/component/component-suite.template.d.ts +2 -0
- package/xtend-builder/templates/component/component-suite.template.js +108 -0
- package/xtend-builder/templates/component/contract.template.ts +10 -0
- package/xtend-builder/templates/component/demo-plan.template.md +73 -0
- package/xtend-builder/templates/component/docs.template.md +301 -0
- package/xtend-builder/templates/component/fixture-data.template.ts +28 -0
- package/xtend-builder/templates/component/fixture.template.html +37 -0
- package/xtend-builder/templates/component/manifest-plan.template.json +22 -0
- package/xtend-builder/templates/component/performance.template.ts +13 -0
- package/xtend-builder/templates/component/rmt.template.ts +12 -0
- package/xtend-builder/templates/component/source.template.d.ts +2 -0
- package/xtend-builder/templates/component/source.template.js +137 -0
- package/xtend-builder/templates/component/source.template.ts +110 -0
- package/xtend-builder/templates/component/types.template.d.ts +423 -0
- package/xtend-builder/templates/loader.d.ts +4 -0
- package/xtend-builder/templates/loader.js +51 -0
- package/xtend-builder/templates/registry.d.ts +6 -0
- package/xtend-builder/templates/registry.js +119 -0
- package/xtend-builder/typing/README.md +130 -0
- package/xtend-builder/typing/component-contract-v2.d.ts +15 -0
- package/xtend-builder/typing/component-contract-v2.js +248 -0
- package/xtend-builder/typing/component-network-contract.d.ts +22 -0
- package/xtend-builder/typing/component-network-contract.js +478 -0
- package/xtend-builder/typing/component-shell-contract.d.ts +21 -0
- package/xtend-builder/typing/component-shell-contract.js +312 -0
- package/xtend-builder/typing/component-styling-contract.d.ts +22 -0
- package/xtend-builder/typing/component-styling-contract.js +301 -0
- package/xtend-builder/typing/component-types.d.ts +10 -0
- package/xtend-builder/typing/component-types.js +551 -0
- package/xtend-builder/typing/enterprise-component-flex-hardening-contract.d.ts +20 -0
- package/xtend-builder/typing/enterprise-component-flex-hardening-contract.js +332 -0
- package/xtend-builder/typing/feedback-status-ux-contract.d.ts +25 -0
- package/xtend-builder/typing/feedback-status-ux-contract.js +347 -0
- package/xtend-builder/typing/form-controls-ux-contract.d.ts +25 -0
- package/xtend-builder/typing/form-controls-ux-contract.js +357 -0
- package/xtend-builder/typing/layout-display-media-ux-contract.d.ts +25 -0
- package/xtend-builder/typing/layout-display-media-ux-contract.js +420 -0
- package/xtend-builder/typing/navigation-routing-ux-contract.d.ts +17 -0
- package/xtend-builder/typing/navigation-routing-ux-contract.js +297 -0
- package/xtend-builder/typing/overlay-interaction-ux-contract.d.ts +25 -0
- package/xtend-builder/typing/overlay-interaction-ux-contract.js +383 -0
- package/xtend-builder/typing/rmt-dsl-authoring-polish.d.ts +27 -0
- package/xtend-builder/typing/rmt-dsl-authoring-polish.js +419 -0
- package/xtend-builder/typing/rmt-shell-authoring-contract.d.ts +26 -0
- package/xtend-builder/typing/rmt-shell-authoring-contract.js +315 -0
- package/xtend-builder/utils/README.md +8 -0
- package/xtend-builder/utils/naming.d.ts +7 -0
- package/xtend-builder/utils/naming.js +36 -0
- package/xtend-builder/utils/validation.d.ts +5 -0
- package/xtend-builder/utils/validation.js +95 -0
- package/xtend-builder/wiring/README.md +46 -0
- package/xtend-builder/wiring/features.d.ts +5 -0
- package/xtend-builder/wiring/features.js +165 -0
- package/xtend-builder/wiring/hydration.d.ts +4 -0
- package/xtend-builder/wiring/hydration.js +44 -0
- package/xtend-builder/wiring/manifest.d.ts +5 -0
- package/xtend-builder/wiring/manifest.js +48 -0
- package/xtend-builder/workflows/README.md +47 -0
- package/xtend-builder/workflows/developer-workflow.d.ts +6 -0
- package/xtend-builder/workflows/developer-workflow.js +125 -0
- package/xtend-builder/writing/manifest-patcher.d.ts +49 -0
- package/xtend-builder/writing/manifest-patcher.js +391 -0
- package/xtend-builder/writing/write-plan.d.ts +148 -0
- package/xtend-builder/writing/write-plan.js +646 -0
- package/xtend-dev.d.ts +23 -0
- package/xtend-dev.js +4 -0
- package/xtend-loader.d.ts +201 -0
- package/xtend-loader.js +1704 -0
- package/xtend.css +402 -0
- package/xtendrmt/package.json +64 -0
- package/xtendrmt/rmt-core.d.ts +4452 -0
- package/xtendrmt/rmt-core.esm.js +25793 -0
- package/xtendrmt/rmt-first-demo-app.js +265 -0
- package/xtendrmt/rmt-first-demo-app.rmt +737 -0
- package/xtendrmt/rmt-lifecycle-demo.app.js +493 -0
- package/xtendrmt/rmt-lifecycle-demo.core.json +810 -0
- package/xtendrmt/rmt-lifecycle-demo.rmt +35 -0
- package/xtendrmt/rmt-lifecycle-demo.rmt-build.app.js +153 -0
- package/xtendrmt/rmt-lifecycle-demo.rmt-build.core.json +810 -0
- package/xtendrmt/rmt-lifecycle-demo.rmt-build.scaffold.json +202 -0
- package/xtendrmt/rmt-lifecycle-demo.scaffold.json +187 -0
- package/xtendrmt/rmt-manifest.json +548 -0
- package/xtendrmt/rmt-runtime.browser.js +26183 -0
- package/xtendrmt/rmt-runtime.esm.js +26214 -0
- package/xtendrmt/rmt-vnext-enterprise-mfe-demo.core.json +849 -0
- package/xtendrmt/rmt-vnext-enterprise-mfe-demo.rmt +50 -0
- package/xtendrmt/rmt-vnext-reference-demo.core.json +1069 -0
- package/xtendrmt/rmt-vnext-reference-demo.rmt +50 -0
- package/xtendrmt/rmt.schema.json +3145 -0
- package/xtendrmt/surface-workbench.js +316 -0
- package/xtendrmt/surface-workbench.rmt +762 -0
- package/xtendrmt/xtendrmt-bestcase-demo.core.json +1187 -0
- package/xtendrmt/xtendrmt-bestcase-demo.js +1728 -0
- package/xtendrmt/xtendrmt-bestcase-demo.rmt +57 -0
|
@@ -0,0 +1,1005 @@
|
|
|
1
|
+
import { xstate } from './xstate.js';
|
|
2
|
+
|
|
3
|
+
const X_MENU_PERFORMANCE_PROFILE_SCHEMA = 'xtend.performance.component-profile.v1';
|
|
4
|
+
const X_MENU_PERFORMANCE_SNAPSHOT_SCHEMA = 'xtend.component.performance-snapshot.v1';
|
|
5
|
+
const X_MENU_PERFORMANCE_MEASUREMENT_SCHEMA = 'xtend.performance.measurement.v1';
|
|
6
|
+
const X_MENU_STATE_SCHEMA = 'xtend.component.x-menu.state.v1';
|
|
7
|
+
|
|
8
|
+
// <x-menu>
|
|
9
|
+
class XMenu extends HTMLElement {
|
|
10
|
+
static get xtendComponentContract() {
|
|
11
|
+
return {
|
|
12
|
+
schema: 'xtend.component.contract.v2',
|
|
13
|
+
tag: 'x-menu',
|
|
14
|
+
maturity: 'stable',
|
|
15
|
+
source: {
|
|
16
|
+
strategy: 'xtend.legacy-js-with-enterprise-profile.v1',
|
|
17
|
+
state: 'js-runtime-profiled',
|
|
18
|
+
sourcePath: 'components/xmenu.js'
|
|
19
|
+
},
|
|
20
|
+
runtime: {
|
|
21
|
+
format: 'esm',
|
|
22
|
+
artifact: 'components/xmenu.js',
|
|
23
|
+
declaration: 'components/xmenu.d.ts',
|
|
24
|
+
localOnly: true,
|
|
25
|
+
cdnAllowed: false
|
|
26
|
+
},
|
|
27
|
+
rmt: {
|
|
28
|
+
adapter: 'xtend.component',
|
|
29
|
+
kernelBoundary: 'no-rmt-kernel-import-of-xtend-types'
|
|
30
|
+
},
|
|
31
|
+
fabric: {
|
|
32
|
+
api: '@xtend-fabric',
|
|
33
|
+
defaultLane: 'user-blocking',
|
|
34
|
+
routeLane: 'transition',
|
|
35
|
+
diagnosticsLane: 'diagnostics'
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
static get xtendRmtMetadata() {
|
|
41
|
+
return {
|
|
42
|
+
schema: 'xtend.rmt.component-contract.v1',
|
|
43
|
+
adapter: 'xtend.component',
|
|
44
|
+
tag: 'x-menu',
|
|
45
|
+
componentRecordKind: 'custom_element',
|
|
46
|
+
templateMode: 'dom_descriptor',
|
|
47
|
+
eventBindingMode: 'dom-event-to-rmt-command',
|
|
48
|
+
schedules: [
|
|
49
|
+
'component.visible.mount',
|
|
50
|
+
'component.visible.hydrate',
|
|
51
|
+
'ui.user-blocking.navigation',
|
|
52
|
+
'route.transition.navigate',
|
|
53
|
+
'route.visible.render',
|
|
54
|
+
'diagnostics.snapshot'
|
|
55
|
+
],
|
|
56
|
+
hydration: { policy: 'visible', lane: 'user-blocking' },
|
|
57
|
+
performance: {
|
|
58
|
+
profile: XMenu.xtendScaffoldPerformanceProfile,
|
|
59
|
+
coalesceKey: 'x-menu:navigation'
|
|
60
|
+
},
|
|
61
|
+
shellAuthoring: {
|
|
62
|
+
schema: 'xtend.rmt.shell-authoring.component.v1',
|
|
63
|
+
host: 'x-menu',
|
|
64
|
+
accepts: ['a', 'button', 'x-link', '[role=menuitem]'],
|
|
65
|
+
stateKey: 'xmenu-active',
|
|
66
|
+
events: ['menu-item-clicked', 'menu-navigate', 'menu-keyboard-navigation'],
|
|
67
|
+
routeBinding: 'href-to-xrouter-navigation'
|
|
68
|
+
},
|
|
69
|
+
kernelBoundary: 'no-rmt-kernel-import-of-xtend-types'
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
static get xtendComponentLifecycleTelemetry() {
|
|
74
|
+
return {
|
|
75
|
+
schema: 'xtend.component.lifecycle-telemetry.v1',
|
|
76
|
+
componentRef: 'x-menu',
|
|
77
|
+
operations: ['mount', 'hydrate', 'render', 'slotchange', 'keyboard', 'navigate', 'state-sync', 'unmount'],
|
|
78
|
+
snapshotPath: 'snapshot.componentTelemetry',
|
|
79
|
+
fabric: {
|
|
80
|
+
lane: 'user-blocking',
|
|
81
|
+
routeLane: 'transition',
|
|
82
|
+
diagnosticsLane: 'diagnostics'
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
static get xtendScaffoldA11yProfile() {
|
|
88
|
+
return {
|
|
89
|
+
schema: 'xtend.a11y.profile.v1',
|
|
90
|
+
componentRef: 'x-menu',
|
|
91
|
+
role: 'menubar',
|
|
92
|
+
accessibleName: 'aria-label-or-nav-context',
|
|
93
|
+
keyboardNavigation: 'roving-tabindex',
|
|
94
|
+
activeState: 'aria-current=page',
|
|
95
|
+
screenreader: {
|
|
96
|
+
signalContract: XMenu.xtendScreenreaderSignals
|
|
97
|
+
},
|
|
98
|
+
motionContrast: {
|
|
99
|
+
policy: XMenu.xtendMotionContrastPolicy
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
static get xtendScaffoldPerformanceProfile() {
|
|
105
|
+
return {
|
|
106
|
+
schema: X_MENU_PERFORMANCE_PROFILE_SCHEMA,
|
|
107
|
+
componentRef: 'x-menu',
|
|
108
|
+
profiles: ['interactive', 'routing'],
|
|
109
|
+
primaryProfile: 'interactive',
|
|
110
|
+
budgetClass: 'navigation-small',
|
|
111
|
+
lane: 'user-blocking',
|
|
112
|
+
hydrationPolicy: 'visible',
|
|
113
|
+
budgetsMs: {
|
|
114
|
+
mount: 24,
|
|
115
|
+
hydrate: 32,
|
|
116
|
+
slotchange: 18,
|
|
117
|
+
renderUpdate: 18,
|
|
118
|
+
keyboardAction: 10,
|
|
119
|
+
routeActivation: 14,
|
|
120
|
+
stateSync: 8
|
|
121
|
+
},
|
|
122
|
+
criticalMeasurements: [
|
|
123
|
+
'xtend.component.hydrate',
|
|
124
|
+
'xtend.component.render',
|
|
125
|
+
'xtend.component.slotchange',
|
|
126
|
+
'xtend.interaction.keyboard',
|
|
127
|
+
'xtend.route.navigate',
|
|
128
|
+
'xtend.state.sync'
|
|
129
|
+
],
|
|
130
|
+
interaction: {
|
|
131
|
+
keyboardBudgetMs: 10,
|
|
132
|
+
routeActivationBudgetMs: 14,
|
|
133
|
+
touchTargetMinPx: 44,
|
|
134
|
+
rovingTabindexRequired: true,
|
|
135
|
+
xLinkCompatible: true,
|
|
136
|
+
xRouterCompatible: true
|
|
137
|
+
},
|
|
138
|
+
cleanup: ['slotchange-listener', 'item-listeners', 'xstate-subscription', 'route-listeners'],
|
|
139
|
+
rmt: {
|
|
140
|
+
scheduleRefs: ['component.visible.hydrate', 'ui.user-blocking.navigation', 'route.transition.navigate', 'diagnostics.snapshot'],
|
|
141
|
+
kernelBoundary: 'no-rmt-kernel-import-of-xtend-types'
|
|
142
|
+
},
|
|
143
|
+
fabric: {
|
|
144
|
+
lane: 'user-blocking',
|
|
145
|
+
routeLane: 'transition',
|
|
146
|
+
diagnosticsLane: 'diagnostics',
|
|
147
|
+
measurementEvent: 'menu-performance-measured',
|
|
148
|
+
snapshotPath: 'xtend.component.x-menu.performanceSnapshot'
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
static get xtendNavigationRoutingUxProfile() {
|
|
154
|
+
return {
|
|
155
|
+
schema: 'xtend.component.navigation-routing-ux-profile.v1',
|
|
156
|
+
componentRef: 'x-menu',
|
|
157
|
+
family: 'menubar-navigation',
|
|
158
|
+
role: 'menubar',
|
|
159
|
+
navigationMode: 'hash-or-history',
|
|
160
|
+
activeState: 'xmenu-active-and-aria-current-page',
|
|
161
|
+
focusRestore: 'roving-tabindex-preserves-focused-item',
|
|
162
|
+
routeAnnouncement: 'delegated-to-x-router',
|
|
163
|
+
keyboardNavigation: 'arrow-home-end-enter-space',
|
|
164
|
+
events: ['menu-item-clicked', 'menu-navigate', 'menu-keyboard-navigation'],
|
|
165
|
+
commands: ['activate-item', 'focus-next', 'focus-previous', 'sync-route', 'snapshot'],
|
|
166
|
+
stateKey: 'xmenu-active',
|
|
167
|
+
schedule: 'ui.user-blocking.navigation',
|
|
168
|
+
fabric: {
|
|
169
|
+
lane: 'user-blocking',
|
|
170
|
+
routeLane: 'transition',
|
|
171
|
+
a11yLane: 'a11y',
|
|
172
|
+
diagnosticsLane: 'diagnostics'
|
|
173
|
+
},
|
|
174
|
+
rmt: XMenu.xtendRmtMetadata,
|
|
175
|
+
routerCompatibility: {
|
|
176
|
+
xLinkHosts: true,
|
|
177
|
+
xRouterNavigateEvent: 'x-navigate',
|
|
178
|
+
xRouterStateSignal: 'router-navigate',
|
|
179
|
+
scheduleRef: 'route.transition.navigate'
|
|
180
|
+
},
|
|
181
|
+
stateSemantics: {
|
|
182
|
+
states: ['active', 'current', 'selected', 'hover', 'focus', 'disabled'],
|
|
183
|
+
current: 'aria-current=page',
|
|
184
|
+
selected: 'aria-selected=true-supported-for-composite-hosts',
|
|
185
|
+
disabled: 'disabled-or-aria-disabled'
|
|
186
|
+
},
|
|
187
|
+
disclosureControls: {
|
|
188
|
+
nestedMenus: 'icon-controls-only',
|
|
189
|
+
managedPart: 'disclosure-icon control icon'
|
|
190
|
+
},
|
|
191
|
+
signatureDesign: {
|
|
192
|
+
note: 'Enterprise menubar with quiet shell rhythm, visible current-route rail and tokenized premium navigation states.',
|
|
193
|
+
tokenStrategy: 'shared --xtend-nav-* tokens feed x-menu aliases before component-specific overrides.',
|
|
194
|
+
themeExpectation: 'third-party themes can replace active, hover, focus, disabled, typography, radius and disclosure icon styling from CSS.'
|
|
195
|
+
},
|
|
196
|
+
themeTokens: [
|
|
197
|
+
'--xtend-nav-surface',
|
|
198
|
+
'--xtend-nav-text',
|
|
199
|
+
'--xtend-nav-border-color',
|
|
200
|
+
'--xtend-nav-radius',
|
|
201
|
+
'--xtend-nav-gap',
|
|
202
|
+
'--xtend-nav-font-family',
|
|
203
|
+
'--xtend-nav-font-size',
|
|
204
|
+
'--xtend-nav-active-surface',
|
|
205
|
+
'--xtend-nav-active-text',
|
|
206
|
+
'--xtend-nav-current-indicator',
|
|
207
|
+
'--xtend-nav-hover-surface',
|
|
208
|
+
'--xtend-nav-focus-ring',
|
|
209
|
+
'--xtend-nav-disabled-opacity'
|
|
210
|
+
],
|
|
211
|
+
overflowPolicy: 'long-labels-wrap-with-overflow-wrap-anywhere'
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
static get xtendScreenreaderSignals() {
|
|
216
|
+
return {
|
|
217
|
+
schema: 'xtend.a11y.screenreader-signals.v1',
|
|
218
|
+
componentRef: 'x-menu',
|
|
219
|
+
liveRegion: 'delegated',
|
|
220
|
+
signals: ['menu-active-item', 'menu-keyboard-navigation', 'route-navigation'],
|
|
221
|
+
statusRegions: ['role=menubar', 'role=menuitem', 'aria-current=page'],
|
|
222
|
+
errorRegions: [],
|
|
223
|
+
fabric: {
|
|
224
|
+
lane: 'a11y',
|
|
225
|
+
fiberKind: 'a11y.navigation',
|
|
226
|
+
scheduleRef: 'a11y.user-blocking.navigation'
|
|
227
|
+
}
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
static get xtendMotionContrastPolicy() {
|
|
232
|
+
return {
|
|
233
|
+
schema: 'xtend.a11y.motion-contrast-policy.v1',
|
|
234
|
+
componentRef: 'x-menu',
|
|
235
|
+
motion: {
|
|
236
|
+
schema: 'xtend.a11y.motion-policy.v1',
|
|
237
|
+
mediaQuery: '(prefers-reduced-motion: reduce)',
|
|
238
|
+
reducedMotion: 'required',
|
|
239
|
+
animationPolicy: 'navigation-without-motion-dependency',
|
|
240
|
+
noMotionOnlyState: true
|
|
241
|
+
},
|
|
242
|
+
contrast: {
|
|
243
|
+
schema: 'xtend.a11y.contrast-policy.v1',
|
|
244
|
+
mediaQuery: '(forced-colors: active)',
|
|
245
|
+
highContrast: 'required',
|
|
246
|
+
forcedColorAdjust: 'auto',
|
|
247
|
+
focusVisible: 'required',
|
|
248
|
+
nonColorStatus: 'required'
|
|
249
|
+
},
|
|
250
|
+
fabric: {
|
|
251
|
+
lane: 'a11y',
|
|
252
|
+
fiberKind: 'a11y.preference',
|
|
253
|
+
scheduleRef: 'a11y.user-blocking.preference'
|
|
254
|
+
}
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
constructor() {
|
|
259
|
+
super();
|
|
260
|
+
this.attachShadow({ mode: "open" });
|
|
261
|
+
this.shadowRoot.innerHTML = `
|
|
262
|
+
<style>
|
|
263
|
+
:host {
|
|
264
|
+
display: block;
|
|
265
|
+
--xtend-nav-surface: var(--xtend-surface-panel, var(--xtend-surface-muted, Canvas));
|
|
266
|
+
--xtend-nav-text: var(--xtend-text-primary, var(--xtend-text, CanvasText));
|
|
267
|
+
--xtend-nav-border-color: var(--xtend-border-color, color-mix(in srgb, currentColor 18%, transparent));
|
|
268
|
+
--xtend-nav-radius: var(--xtend-radius-panel, var(--xtend-radius, 0.75rem));
|
|
269
|
+
--xtend-nav-gap: var(--xtend-space-1, 0.5em);
|
|
270
|
+
--xtend-nav-font-family: var(--xtend-font-family-control, var(--xtend-font-family, system-ui, sans-serif));
|
|
271
|
+
--xtend-nav-font-size: var(--xtend-font-size-control, 1em);
|
|
272
|
+
--xtend-nav-active-surface: var(--xtend-color-action-subtle, var(--xtend-surface-inset, ButtonFace));
|
|
273
|
+
--xtend-nav-active-text: var(--xtend-color-action, LinkText);
|
|
274
|
+
--xtend-nav-current-indicator: var(--xtend-color-action, Highlight);
|
|
275
|
+
--xtend-nav-hover-surface: var(--xtend-color-action-subtle, var(--xtend-surface-inset, ButtonFace));
|
|
276
|
+
--xtend-nav-focus-ring: var(--xtend-focus-ring, var(--xtend-focus-outline, 2px solid Highlight));
|
|
277
|
+
--xtend-nav-disabled-opacity: var(--xtend-disabled-opacity, 0.48);
|
|
278
|
+
--xtend-menu-min-touch-target: 44px;
|
|
279
|
+
--xtend-menu-surface: var(--xtend-nav-surface);
|
|
280
|
+
--xtend-menu-text: var(--xtend-nav-text);
|
|
281
|
+
--xtend-menu-border-color: var(--xtend-nav-border-color);
|
|
282
|
+
--xtend-menu-border-width: var(--xtend-border-width, 1px);
|
|
283
|
+
--xtend-menu-radius: var(--xtend-nav-radius);
|
|
284
|
+
--xtend-menu-elevation: var(--xtend-elevation-1, none);
|
|
285
|
+
--xtend-menu-gap: var(--xtend-nav-gap);
|
|
286
|
+
--xtend-menu-padding-y: var(--xtend-space-1, 0.5em);
|
|
287
|
+
--xtend-menu-padding-x: var(--xtend-space-3, 1.2em);
|
|
288
|
+
--xtend-menu-item-surface: transparent;
|
|
289
|
+
--xtend-menu-item-hover-surface: var(--xtend-nav-hover-surface);
|
|
290
|
+
--xtend-menu-item-active-surface: var(--xtend-nav-active-surface);
|
|
291
|
+
--xtend-menu-item-active-text: var(--xtend-nav-active-text);
|
|
292
|
+
--xtend-menu-current-indicator: var(--xtend-nav-current-indicator);
|
|
293
|
+
--xtend-menu-item-text: var(--button-text-color, var(--xtend-text-primary, var(--xtend-text, CanvasText)));
|
|
294
|
+
--xtend-menu-item-primary-surface: var(--xtend-color-action, Highlight);
|
|
295
|
+
--xtend-menu-item-primary-text: var(--xtend-text-on-action, HighlightText);
|
|
296
|
+
--xtend-menu-item-secondary-surface: var(--xtend-surface-inset, ButtonFace);
|
|
297
|
+
--xtend-menu-item-danger-surface: var(--xtend-color-danger, Mark);
|
|
298
|
+
--xtend-menu-item-radius: var(--xtend-radius-control, var(--xtend-radius, 0.75rem));
|
|
299
|
+
--xtend-menu-item-padding-y: var(--xtend-space-1, 0.6em);
|
|
300
|
+
--xtend-menu-item-padding-x: var(--xtend-space-3, 1.6em);
|
|
301
|
+
--xtend-menu-item-gap: var(--xtend-space-control-gap, 0.6em);
|
|
302
|
+
--xtend-menu-font-family: var(--xtend-nav-font-family);
|
|
303
|
+
--xtend-menu-font-size: var(--xtend-nav-font-size);
|
|
304
|
+
--xtend-menu-font-weight: var(--xtend-font-weight-control, 560);
|
|
305
|
+
--xtend-menu-focus-outline: var(--xtend-nav-focus-ring);
|
|
306
|
+
--xtend-menu-focus-elevation: var(--xtend-elevation-focus, none);
|
|
307
|
+
--xtend-menu-disabled-opacity: var(--xtend-nav-disabled-opacity);
|
|
308
|
+
--xtend-menu-disclosure-icon-size: 1em;
|
|
309
|
+
--xtend-menu-motion-duration: var(--xtend-motion-duration-fast, 160ms);
|
|
310
|
+
--xtend-menu-motion-easing: var(--xtend-motion-easing-standard, ease);
|
|
311
|
+
}
|
|
312
|
+
nav {
|
|
313
|
+
display: flex;
|
|
314
|
+
gap: var(--xtend-menu-gap);
|
|
315
|
+
background: var(--xtend-menu-surface);
|
|
316
|
+
color: var(--xtend-menu-text);
|
|
317
|
+
border: var(--xtend-menu-border-width) solid var(--xtend-menu-border-color);
|
|
318
|
+
border-radius: var(--xtend-menu-radius);
|
|
319
|
+
box-shadow: var(--xtend-menu-elevation);
|
|
320
|
+
backdrop-filter: blur(var(--xtend-glass-blur, 0px)) saturate(1.05);
|
|
321
|
+
padding: var(--xtend-menu-padding-y) var(--xtend-menu-padding-x);
|
|
322
|
+
align-items: center;
|
|
323
|
+
min-height: 3.2em;
|
|
324
|
+
transition: box-shadow var(--xtend-menu-motion-duration) var(--xtend-menu-motion-easing), background var(--xtend-menu-motion-duration) var(--xtend-menu-motion-easing);
|
|
325
|
+
}
|
|
326
|
+
::slotted(a),
|
|
327
|
+
::slotted(button),
|
|
328
|
+
::slotted(x-link),
|
|
329
|
+
::slotted([role="menuitem"]) {
|
|
330
|
+
all: unset;
|
|
331
|
+
position: relative;
|
|
332
|
+
background: var(--xtend-menu-item-surface);
|
|
333
|
+
color: var(--xtend-menu-item-text);
|
|
334
|
+
border-radius: var(--xtend-menu-item-radius);
|
|
335
|
+
padding: var(--xtend-menu-item-padding-y) var(--xtend-menu-item-padding-x);
|
|
336
|
+
min-width: var(--xtend-menu-min-touch-target, 44px);
|
|
337
|
+
min-height: var(--xtend-menu-min-touch-target, 44px);
|
|
338
|
+
box-sizing: border-box;
|
|
339
|
+
font-family: var(--xtend-menu-font-family);
|
|
340
|
+
font-size: var(--xtend-menu-font-size);
|
|
341
|
+
font-weight: var(--xtend-menu-font-weight);
|
|
342
|
+
text-align: center;
|
|
343
|
+
cursor: pointer;
|
|
344
|
+
display: inline-flex;
|
|
345
|
+
align-items: center;
|
|
346
|
+
justify-content: center;
|
|
347
|
+
gap: var(--xtend-menu-item-gap);
|
|
348
|
+
transition: background var(--xtend-menu-motion-duration) var(--xtend-menu-motion-easing), box-shadow var(--xtend-menu-motion-duration) var(--xtend-menu-motion-easing), filter var(--xtend-menu-motion-duration) var(--xtend-menu-motion-easing);
|
|
349
|
+
outline: none;
|
|
350
|
+
border: none;
|
|
351
|
+
overflow-wrap: anywhere;
|
|
352
|
+
word-break: normal;
|
|
353
|
+
white-space: normal;
|
|
354
|
+
max-width: 100%;
|
|
355
|
+
min-inline-size: 0;
|
|
356
|
+
}
|
|
357
|
+
::slotted(a.primary),
|
|
358
|
+
::slotted(button.primary),
|
|
359
|
+
::slotted(x-link.primary),
|
|
360
|
+
::slotted([role="menuitem"].primary) {
|
|
361
|
+
background: var(--xtend-menu-item-primary-surface);
|
|
362
|
+
color: var(--xtend-menu-item-primary-text);
|
|
363
|
+
}
|
|
364
|
+
::slotted(a.secondary),
|
|
365
|
+
::slotted(button.secondary),
|
|
366
|
+
::slotted(x-link.secondary),
|
|
367
|
+
::slotted([role="menuitem"].secondary) {
|
|
368
|
+
background: var(--xtend-menu-item-secondary-surface);
|
|
369
|
+
color: var(--xtend-menu-item-text);
|
|
370
|
+
}
|
|
371
|
+
::slotted(a.danger),
|
|
372
|
+
::slotted(button.danger),
|
|
373
|
+
::slotted(x-link.danger),
|
|
374
|
+
::slotted([role="menuitem"].danger) {
|
|
375
|
+
background: var(--xtend-menu-item-danger-surface);
|
|
376
|
+
color: var(--xtend-error-fg, HighlightText);
|
|
377
|
+
}
|
|
378
|
+
::slotted(a.small),
|
|
379
|
+
::slotted(button.small),
|
|
380
|
+
::slotted(x-link.small),
|
|
381
|
+
::slotted([role="menuitem"].small) {
|
|
382
|
+
font-size: 0.85em;
|
|
383
|
+
padding: 0.3em 1em;
|
|
384
|
+
}
|
|
385
|
+
::slotted(a.large),
|
|
386
|
+
::slotted(button.large),
|
|
387
|
+
::slotted(x-link.large),
|
|
388
|
+
::slotted([role="menuitem"].large) {
|
|
389
|
+
font-size: 1.2em;
|
|
390
|
+
padding: 0.9em 2em;
|
|
391
|
+
}
|
|
392
|
+
::slotted(a[aria-busy="true"]),
|
|
393
|
+
::slotted(button[aria-busy="true"]),
|
|
394
|
+
::slotted(x-link[aria-busy="true"]),
|
|
395
|
+
::slotted([role="menuitem"][aria-busy="true"]) {
|
|
396
|
+
pointer-events: none;
|
|
397
|
+
opacity: 0.7;
|
|
398
|
+
}
|
|
399
|
+
::slotted(a:focus-visible),
|
|
400
|
+
::slotted(button:focus-visible),
|
|
401
|
+
::slotted(x-link:focus-visible),
|
|
402
|
+
::slotted([role="menuitem"]:focus-visible) {
|
|
403
|
+
outline: var(--xtend-menu-focus-outline);
|
|
404
|
+
outline-offset: var(--xtend-focus-outline-offset, 2px);
|
|
405
|
+
box-shadow: var(--xtend-menu-focus-elevation);
|
|
406
|
+
}
|
|
407
|
+
::slotted(a:disabled),
|
|
408
|
+
::slotted(a[aria-disabled="true"]),
|
|
409
|
+
::slotted(button:disabled),
|
|
410
|
+
::slotted(button[aria-disabled="true"]),
|
|
411
|
+
::slotted(x-link[disabled]),
|
|
412
|
+
::slotted(x-link[aria-disabled="true"]),
|
|
413
|
+
::slotted([role="menuitem"]:disabled),
|
|
414
|
+
::slotted([role="menuitem"][aria-disabled="true"]) {
|
|
415
|
+
opacity: var(--xtend-menu-disabled-opacity);
|
|
416
|
+
cursor: not-allowed;
|
|
417
|
+
filter: grayscale(0.2);
|
|
418
|
+
}
|
|
419
|
+
::slotted(a:hover:not(:disabled)),
|
|
420
|
+
::slotted(button:hover:not(:disabled)),
|
|
421
|
+
::slotted(x-link:hover),
|
|
422
|
+
::slotted([role="menuitem"]:hover:not(:disabled)),
|
|
423
|
+
::slotted(a.active),
|
|
424
|
+
::slotted(button.active),
|
|
425
|
+
::slotted(x-link.active),
|
|
426
|
+
::slotted([role="menuitem"].active) {
|
|
427
|
+
background: var(--xtend-menu-item-hover-surface);
|
|
428
|
+
box-shadow: var(--xtend-menu-focus-elevation);
|
|
429
|
+
filter: brightness(1.03) saturate(1.05);
|
|
430
|
+
}
|
|
431
|
+
::slotted(a[aria-current="page"]),
|
|
432
|
+
::slotted(button[aria-current="page"]),
|
|
433
|
+
::slotted(x-link[aria-current="page"]),
|
|
434
|
+
::slotted(x-link[active]),
|
|
435
|
+
::slotted([role="menuitem"][aria-current="page"]),
|
|
436
|
+
::slotted(a[aria-selected="true"]),
|
|
437
|
+
::slotted(button[aria-selected="true"]),
|
|
438
|
+
::slotted(x-link[aria-selected="true"]),
|
|
439
|
+
::slotted([role="menuitem"][aria-selected="true"]),
|
|
440
|
+
::slotted(a.active),
|
|
441
|
+
::slotted(button.active),
|
|
442
|
+
::slotted(x-link.active),
|
|
443
|
+
::slotted([role="menuitem"].active) {
|
|
444
|
+
background: var(--xtend-menu-item-active-surface);
|
|
445
|
+
color: var(--xtend-menu-item-active-text);
|
|
446
|
+
box-shadow: inset 0 -3px 0 var(--xtend-menu-current-indicator), var(--xtend-menu-focus-elevation);
|
|
447
|
+
}
|
|
448
|
+
::slotted(.icon) {
|
|
449
|
+
display: inline-flex;
|
|
450
|
+
align-items: center;
|
|
451
|
+
justify-content: center;
|
|
452
|
+
width: 1.3em;
|
|
453
|
+
height: 1.3em;
|
|
454
|
+
}
|
|
455
|
+
@media (prefers-reduced-motion: reduce) {
|
|
456
|
+
nav,
|
|
457
|
+
::slotted(a),
|
|
458
|
+
::slotted(button),
|
|
459
|
+
::slotted(x-link),
|
|
460
|
+
::slotted([role="menuitem"]) {
|
|
461
|
+
transition: none !important;
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
@media (forced-colors: active) {
|
|
465
|
+
nav {
|
|
466
|
+
background: Canvas;
|
|
467
|
+
border: 1px solid CanvasText;
|
|
468
|
+
box-shadow: none;
|
|
469
|
+
}
|
|
470
|
+
::slotted(a),
|
|
471
|
+
::slotted(button),
|
|
472
|
+
::slotted(x-link),
|
|
473
|
+
::slotted([role="menuitem"]) {
|
|
474
|
+
color: LinkText;
|
|
475
|
+
forced-color-adjust: auto;
|
|
476
|
+
}
|
|
477
|
+
::slotted(a:focus-visible),
|
|
478
|
+
::slotted(button:focus-visible),
|
|
479
|
+
::slotted(x-link:focus-visible),
|
|
480
|
+
::slotted([role="menuitem"]:focus-visible) {
|
|
481
|
+
outline: 2px solid Highlight;
|
|
482
|
+
box-shadow: none;
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
@media (max-width: 700px) {
|
|
486
|
+
nav { flex-direction: column; gap: 0.2em; padding: 0.5em 0.5em; }
|
|
487
|
+
::slotted(a), ::slotted(button), ::slotted(x-link), ::slotted([role="menuitem"]) { width: 100%; justify-content: flex-start; }
|
|
488
|
+
}
|
|
489
|
+
</style>
|
|
490
|
+
<nav role="menubar" tabindex="0">
|
|
491
|
+
<slot></slot>
|
|
492
|
+
</nav>
|
|
493
|
+
`;
|
|
494
|
+
this._unsubscribeState = null;
|
|
495
|
+
this._items = [];
|
|
496
|
+
this._itemHandlers = new Map();
|
|
497
|
+
this._performanceMeasurements = [];
|
|
498
|
+
this._performanceCounters = {
|
|
499
|
+
mounts: 0,
|
|
500
|
+
renders: 0,
|
|
501
|
+
slotchanges: 0,
|
|
502
|
+
keyboardMoves: 0,
|
|
503
|
+
activations: 0,
|
|
504
|
+
routeActivations: 0,
|
|
505
|
+
stateSyncs: 0
|
|
506
|
+
};
|
|
507
|
+
this._slot = this.shadowRoot.querySelector('slot');
|
|
508
|
+
this._nav = this.shadowRoot.querySelector('nav');
|
|
509
|
+
this._synchronizingState = false;
|
|
510
|
+
this._onSlotChange = this._handleSlotChange.bind(this);
|
|
511
|
+
this._onNavFocus = this._handleNavFocus.bind(this);
|
|
512
|
+
this._onRouteChanged = this._handleRouteChanged.bind(this);
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
connectedCallback() {
|
|
516
|
+
const start = this._now();
|
|
517
|
+
if (!this.id) {
|
|
518
|
+
this.id = `xmenu-${Math.random().toString(36).slice(2, 10)}`;
|
|
519
|
+
}
|
|
520
|
+
this._slot.addEventListener('slotchange', this._onSlotChange);
|
|
521
|
+
this._nav.addEventListener('focus', this._onNavFocus);
|
|
522
|
+
window.addEventListener('popstate', this._onRouteChanged);
|
|
523
|
+
window.addEventListener('hashchange', this._onRouteChanged);
|
|
524
|
+
window.addEventListener('xrouter-after-navigate', this._onRouteChanged);
|
|
525
|
+
document.body.addEventListener('x-navigate', this._onRouteChanged);
|
|
526
|
+
this._updateMenu('mount');
|
|
527
|
+
this._subscribeState();
|
|
528
|
+
this._performanceCounters.mounts += 1;
|
|
529
|
+
this._recordPerformanceMeasurement('xtend.component.hydrate', 'hydrate', start, { reason: 'mount' });
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
disconnectedCallback() {
|
|
533
|
+
if (this._unsubscribeState) {
|
|
534
|
+
this._unsubscribeState();
|
|
535
|
+
this._unsubscribeState = null;
|
|
536
|
+
}
|
|
537
|
+
this._removeItemListeners();
|
|
538
|
+
this._slot.removeEventListener('slotchange', this._onSlotChange);
|
|
539
|
+
this._nav.removeEventListener('focus', this._onNavFocus);
|
|
540
|
+
window.removeEventListener('popstate', this._onRouteChanged);
|
|
541
|
+
window.removeEventListener('hashchange', this._onRouteChanged);
|
|
542
|
+
window.removeEventListener('xrouter-after-navigate', this._onRouteChanged);
|
|
543
|
+
document.body.removeEventListener('x-navigate', this._onRouteChanged);
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
_handleSlotChange() {
|
|
547
|
+
const start = this._now();
|
|
548
|
+
this._performanceCounters.slotchanges += 1;
|
|
549
|
+
this._updateMenu('slotchange');
|
|
550
|
+
this._recordPerformanceMeasurement('xtend.component.slotchange', 'slotchange', start);
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
_handleNavFocus() {
|
|
554
|
+
const firstItem = this._items.find((item) => !this._isItemDisabled(item));
|
|
555
|
+
if (firstItem) firstItem.focus();
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
_handleRouteChanged(event) {
|
|
559
|
+
const path = event && event.detail && (event.detail.path || event.detail.href);
|
|
560
|
+
this._syncActiveRoute(path || this._getCurrentPath(), 'route-sync', { focus: false });
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
_subscribeState() {
|
|
564
|
+
if (this._unsubscribeState || typeof xstate.subscribe !== 'function') return;
|
|
565
|
+
this._unsubscribeState = xstate.subscribe((key, value) => {
|
|
566
|
+
if (this._synchronizingState) return;
|
|
567
|
+
if (key === 'xmenu-active' && value && typeof value.index === 'number') {
|
|
568
|
+
this._setActiveItem(value.index, 'xstate', { focus: Boolean(value.focus) });
|
|
569
|
+
}
|
|
570
|
+
if (key === 'router-current' || key === 'xtend.router.current' || key === 'router-navigated') {
|
|
571
|
+
const path = typeof value === 'string' ? value : value && value.path;
|
|
572
|
+
this._syncActiveRoute(path, 'xstate-route', { focus: false });
|
|
573
|
+
}
|
|
574
|
+
}, ['xmenu-active', 'router-current', 'xtend.router.current', 'router-navigated']);
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
_updateMenu(reason = 'update') {
|
|
578
|
+
const start = this._now();
|
|
579
|
+
this._removeItemListeners();
|
|
580
|
+
const items = this._collectItems();
|
|
581
|
+
this._items = items;
|
|
582
|
+
const activeIndex = this._resolveActiveIndex(items);
|
|
583
|
+
|
|
584
|
+
items.forEach((item, index) => {
|
|
585
|
+
item.setAttribute("role", "menuitem");
|
|
586
|
+
item.setAttribute('data-xtend-menu-index', String(index));
|
|
587
|
+
this._syncDisclosureIconControl(item);
|
|
588
|
+
item.tabIndex = !this._isItemDisabled(item) && index === activeIndex ? 0 : -1;
|
|
589
|
+
this._applyItemActiveState(item, index === activeIndex);
|
|
590
|
+
|
|
591
|
+
const keydown = (event) => this._handleItemKeydown(event, item, index);
|
|
592
|
+
const click = (event) => this._handleItemClick(event, item, index);
|
|
593
|
+
item.addEventListener('keydown', keydown);
|
|
594
|
+
item.addEventListener('click', click);
|
|
595
|
+
this._itemHandlers.set(item, { keydown, click });
|
|
596
|
+
});
|
|
597
|
+
|
|
598
|
+
this._performanceCounters.renders += 1;
|
|
599
|
+
this._syncState(reason, { activeIndex });
|
|
600
|
+
this._recordPerformanceMeasurement('xtend.component.render', 'renderUpdate', start, { reason, itemCount: items.length });
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
_collectItems() {
|
|
604
|
+
return Array.from(this.querySelectorAll("a, button, x-link, [role='menuitem']"))
|
|
605
|
+
.filter((item, index, items) => items.indexOf(item) === index);
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
_removeItemListeners() {
|
|
609
|
+
this._itemHandlers.forEach((handlers, item) => {
|
|
610
|
+
item.removeEventListener('keydown', handlers.keydown);
|
|
611
|
+
item.removeEventListener('click', handlers.click);
|
|
612
|
+
});
|
|
613
|
+
this._itemHandlers.clear();
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
_handleItemKeydown(event, item, index) {
|
|
617
|
+
const start = this._now();
|
|
618
|
+
const key = event.key;
|
|
619
|
+
let nextIndex = null;
|
|
620
|
+
if (key === 'ArrowRight' || key === 'ArrowDown') {
|
|
621
|
+
nextIndex = this._resolveNextEnabledIndex(index, 1);
|
|
622
|
+
} else if (key === 'ArrowLeft' || key === 'ArrowUp') {
|
|
623
|
+
nextIndex = this._resolveNextEnabledIndex(index, -1);
|
|
624
|
+
} else if (key === 'Home') {
|
|
625
|
+
nextIndex = this._resolveFirstEnabledIndex();
|
|
626
|
+
} else if (key === 'End') {
|
|
627
|
+
nextIndex = this._resolveLastEnabledIndex();
|
|
628
|
+
} else if (key === 'Enter' || key === ' ') {
|
|
629
|
+
event.preventDefault();
|
|
630
|
+
this._activateItem(item, index, event, 'keyboard');
|
|
631
|
+
return;
|
|
632
|
+
} else {
|
|
633
|
+
return;
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
event.preventDefault();
|
|
637
|
+
if (nextIndex === null || nextIndex < 0) return;
|
|
638
|
+
this._performanceCounters.keyboardMoves += 1;
|
|
639
|
+
this._focusItem(nextIndex);
|
|
640
|
+
const measurement = this._recordPerformanceMeasurement('xtend.interaction.keyboard', 'keyboardAction', start, { key, fromIndex: index, toIndex: nextIndex });
|
|
641
|
+
this.dispatchEvent(new CustomEvent('menu-keyboard-navigation', {
|
|
642
|
+
detail: this._createKeyboardDetail(key, index, nextIndex, measurement),
|
|
643
|
+
bubbles: true,
|
|
644
|
+
composed: true
|
|
645
|
+
}));
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
_handleItemClick(event, item, index) {
|
|
649
|
+
this._activateItem(item, index, event, 'click');
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
_activateItem(item, index, event, source) {
|
|
653
|
+
if (this._isItemDisabled(item)) {
|
|
654
|
+
event.preventDefault();
|
|
655
|
+
return;
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
const start = this._now();
|
|
659
|
+
const href = this._resolveItemHref(item);
|
|
660
|
+
const isRoutable = href && this._isInternalHref(href);
|
|
661
|
+
if (isRoutable && event && typeof event.preventDefault === 'function') {
|
|
662
|
+
event.preventDefault();
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
this._performanceCounters.activations += 1;
|
|
666
|
+
const measurement = this._recordPerformanceMeasurement(
|
|
667
|
+
isRoutable ? 'xtend.route.navigate' : 'xtend.interaction.activate',
|
|
668
|
+
isRoutable ? 'routeActivation' : 'keyboardAction',
|
|
669
|
+
start,
|
|
670
|
+
{ href, index, source }
|
|
671
|
+
);
|
|
672
|
+
this._setActiveItem(index, source, { focus: source === 'keyboard' });
|
|
673
|
+
|
|
674
|
+
const clicked = this.dispatchEvent(new CustomEvent('menu-item-clicked', {
|
|
675
|
+
detail: this._createMenuItemDetail(item, index, href, source, measurement),
|
|
676
|
+
cancelable: true,
|
|
677
|
+
bubbles: true,
|
|
678
|
+
composed: true
|
|
679
|
+
}));
|
|
680
|
+
if (!clicked) return;
|
|
681
|
+
|
|
682
|
+
if (isRoutable) {
|
|
683
|
+
this._performanceCounters.routeActivations += 1;
|
|
684
|
+
this._navigateToHref(href, item, source, measurement);
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
_focusItem(index) {
|
|
689
|
+
const item = this._items[index];
|
|
690
|
+
if (!item || this._isItemDisabled(item)) return;
|
|
691
|
+
this._items.forEach((candidate, candidateIndex) => {
|
|
692
|
+
candidate.tabIndex = !this._isItemDisabled(candidate) && candidateIndex === index ? 0 : -1;
|
|
693
|
+
});
|
|
694
|
+
item.focus();
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
_setActiveItem(index, reason = 'update', options = {}) {
|
|
698
|
+
if (!this._items.length || index < 0 || index >= this._items.length) return;
|
|
699
|
+
if (this._isItemDisabled(this._items[index])) return;
|
|
700
|
+
this._items.forEach((item, itemIndex) => {
|
|
701
|
+
this._applyItemActiveState(item, itemIndex === index);
|
|
702
|
+
item.tabIndex = !this._isItemDisabled(item) && itemIndex === index ? 0 : -1;
|
|
703
|
+
});
|
|
704
|
+
if (options.focus) {
|
|
705
|
+
this._items[index].focus();
|
|
706
|
+
}
|
|
707
|
+
this._syncState(reason, { activeIndex: index });
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
_syncActiveRoute(path, reason = 'route-sync', options = {}) {
|
|
711
|
+
if (!path) return;
|
|
712
|
+
const target = this._normalizePath(path);
|
|
713
|
+
const index = this._items.findIndex((item) => {
|
|
714
|
+
if (this._isItemDisabled(item)) return false;
|
|
715
|
+
const href = this._resolveItemHref(item);
|
|
716
|
+
return href && this._normalizePath(href.replace(/^#/, '')) === target;
|
|
717
|
+
});
|
|
718
|
+
if (index >= 0) {
|
|
719
|
+
this._setActiveItem(index, reason, options);
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
_applyItemActiveState(item, active) {
|
|
724
|
+
if (active) {
|
|
725
|
+
item.classList.add('active');
|
|
726
|
+
item.setAttribute('aria-current', 'page');
|
|
727
|
+
} else {
|
|
728
|
+
item.classList.remove('active');
|
|
729
|
+
item.removeAttribute('aria-current');
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
_syncState(reason = 'update', detail = {}) {
|
|
734
|
+
if (!this.id) return;
|
|
735
|
+
const activeIndex = typeof detail.activeIndex === 'number' ? detail.activeIndex : this._resolveActiveIndex(this._items);
|
|
736
|
+
const activeItem = this._items[activeIndex] || null;
|
|
737
|
+
const state = {
|
|
738
|
+
schema: X_MENU_STATE_SCHEMA,
|
|
739
|
+
id: this.id,
|
|
740
|
+
reason,
|
|
741
|
+
index: activeIndex,
|
|
742
|
+
activeIndex,
|
|
743
|
+
href: activeItem ? this._resolveItemHref(activeItem) : null,
|
|
744
|
+
itemCount: this._items.length,
|
|
745
|
+
lane: XMenu.xtendScaffoldPerformanceProfile.lane,
|
|
746
|
+
scheduleRef: 'ui.user-blocking.navigation',
|
|
747
|
+
performanceProfile: XMenu.xtendScaffoldPerformanceProfile,
|
|
748
|
+
performanceSnapshot: this.snapshotPerformance()
|
|
749
|
+
};
|
|
750
|
+
this._performanceCounters.stateSyncs += 1;
|
|
751
|
+
this._synchronizingState = true;
|
|
752
|
+
try {
|
|
753
|
+
xstate.set('xmenu-active', state);
|
|
754
|
+
xstate.set(`xmenu-state-${this.id}`, state);
|
|
755
|
+
} finally {
|
|
756
|
+
this._synchronizingState = false;
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
_resolveActiveIndex(items = this._items) {
|
|
761
|
+
const firstEnabledIndex = items.findIndex((item) => !this._isItemDisabled(item));
|
|
762
|
+
const state = xstate.get('xmenu-active');
|
|
763
|
+
if (state && typeof state.index === 'number' && state.index >= 0 && state.index < items.length && !this._isItemDisabled(items[state.index])) {
|
|
764
|
+
return state.index;
|
|
765
|
+
}
|
|
766
|
+
if (state && typeof state.activeIndex === 'number' && state.activeIndex >= 0 && state.activeIndex < items.length && !this._isItemDisabled(items[state.activeIndex])) {
|
|
767
|
+
return state.activeIndex;
|
|
768
|
+
}
|
|
769
|
+
const currentPath = this._getCurrentPath();
|
|
770
|
+
const routeIndex = items.findIndex((item) => {
|
|
771
|
+
if (this._isItemDisabled(item)) return false;
|
|
772
|
+
const href = this._resolveItemHref(item);
|
|
773
|
+
return href && this._normalizePath(href.replace(/^#/, '')) === currentPath;
|
|
774
|
+
});
|
|
775
|
+
return routeIndex >= 0 ? routeIndex : (firstEnabledIndex >= 0 ? firstEnabledIndex : 0);
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
_resolveFirstEnabledIndex() {
|
|
779
|
+
return this._items.findIndex((item) => !this._isItemDisabled(item));
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
_resolveLastEnabledIndex() {
|
|
783
|
+
for (let index = this._items.length - 1; index >= 0; index -= 1) {
|
|
784
|
+
if (!this._isItemDisabled(this._items[index])) return index;
|
|
785
|
+
}
|
|
786
|
+
return -1;
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
_resolveNextEnabledIndex(index, direction) {
|
|
790
|
+
if (!this._items.length) return -1;
|
|
791
|
+
for (let offset = 1; offset <= this._items.length; offset += 1) {
|
|
792
|
+
const candidateIndex = (index + (offset * direction) + this._items.length) % this._items.length;
|
|
793
|
+
if (!this._isItemDisabled(this._items[candidateIndex])) return candidateIndex;
|
|
794
|
+
}
|
|
795
|
+
return -1;
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
_navigateToHref(href, item, source, measurement) {
|
|
799
|
+
const path = this._normalizePath(href.replace(/^#/, ''));
|
|
800
|
+
const mode = this._resolveRouterMode();
|
|
801
|
+
const detail = {
|
|
802
|
+
schema: 'xtend.component.x-menu.navigation.v1',
|
|
803
|
+
href,
|
|
804
|
+
path,
|
|
805
|
+
mode,
|
|
806
|
+
source: 'x-menu',
|
|
807
|
+
inputSource: source,
|
|
808
|
+
stateKey: 'xmenu-active',
|
|
809
|
+
scheduleRef: 'route.transition.navigate',
|
|
810
|
+
itemTag: item.tagName ? item.tagName.toLowerCase() : null,
|
|
811
|
+
measurement
|
|
812
|
+
};
|
|
813
|
+
|
|
814
|
+
this.dispatchEvent(new CustomEvent('menu-navigate', {
|
|
815
|
+
detail,
|
|
816
|
+
bubbles: true,
|
|
817
|
+
composed: true
|
|
818
|
+
}));
|
|
819
|
+
|
|
820
|
+
if (typeof xstate.set === 'function') {
|
|
821
|
+
xstate.set('router-navigate', path);
|
|
822
|
+
}
|
|
823
|
+
document.body.dispatchEvent(new CustomEvent('x-navigate', {
|
|
824
|
+
detail,
|
|
825
|
+
bubbles: true,
|
|
826
|
+
composed: true
|
|
827
|
+
}));
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
_resolveRouterMode() {
|
|
831
|
+
const router = this.closest('x-router') || document.querySelector('x-router');
|
|
832
|
+
return router && router.getAttribute('mode') === 'history' ? 'history' : 'hash';
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
_resolveItemHref(item) {
|
|
836
|
+
if (!item) return null;
|
|
837
|
+
const href = item.getAttribute && item.getAttribute('href');
|
|
838
|
+
if (href) return href;
|
|
839
|
+
if (typeof item.href === 'string' && item.href) return item.href;
|
|
840
|
+
const anchor = item.shadowRoot && item.shadowRoot.querySelector && item.shadowRoot.querySelector('a[href]');
|
|
841
|
+
return anchor ? anchor.getAttribute('href') : null;
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
_syncDisclosureIconControl(item) {
|
|
845
|
+
if (!item || typeof item.hasAttribute !== 'function' || !item.querySelector) return;
|
|
846
|
+
const isDisclosure = item.hasAttribute('aria-expanded') ||
|
|
847
|
+
item.hasAttribute('data-menu-disclosure') ||
|
|
848
|
+
item.getAttribute('aria-haspopup') === 'menu';
|
|
849
|
+
const existing = item.querySelector('[data-xtend-disclosure-icon]');
|
|
850
|
+
const hasAuthorIcon = item.querySelector('x-icon[part~="icon"], svg[part~="icon"], [data-disclosure-icon]');
|
|
851
|
+
if (!isDisclosure) {
|
|
852
|
+
if (existing && existing.getAttribute('data-xtend-managed') === 'true') existing.remove();
|
|
853
|
+
return;
|
|
854
|
+
}
|
|
855
|
+
if (existing || hasAuthorIcon) return;
|
|
856
|
+
|
|
857
|
+
const icon = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
|
858
|
+
icon.setAttribute('viewBox', '0 0 24 24');
|
|
859
|
+
icon.setAttribute('aria-hidden', 'true');
|
|
860
|
+
icon.setAttribute('focusable', 'false');
|
|
861
|
+
icon.setAttribute('part', 'disclosure-icon control icon');
|
|
862
|
+
icon.setAttribute('data-xtend-disclosure-icon', '');
|
|
863
|
+
icon.setAttribute('data-xtend-managed', 'true');
|
|
864
|
+
icon.style.width = 'var(--xtend-menu-disclosure-icon-size, 1em)';
|
|
865
|
+
icon.style.height = 'var(--xtend-menu-disclosure-icon-size, 1em)';
|
|
866
|
+
icon.style.flex = '0 0 auto';
|
|
867
|
+
icon.style.marginInlineStart = 'var(--xtend-menu-item-gap, 0.6em)';
|
|
868
|
+
icon.style.transform = item.getAttribute('aria-expanded') === 'true' ? 'rotate(180deg)' : 'rotate(0deg)';
|
|
869
|
+
icon.style.transition = 'transform var(--xtend-menu-motion-duration, 160ms) var(--xtend-menu-motion-easing, ease)';
|
|
870
|
+
|
|
871
|
+
const path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
|
|
872
|
+
path.setAttribute('d', 'M6 9l6 6 6-6');
|
|
873
|
+
path.setAttribute('fill', 'none');
|
|
874
|
+
path.setAttribute('stroke', 'currentColor');
|
|
875
|
+
path.setAttribute('stroke-width', '2');
|
|
876
|
+
path.setAttribute('stroke-linecap', 'round');
|
|
877
|
+
path.setAttribute('stroke-linejoin', 'round');
|
|
878
|
+
icon.appendChild(path);
|
|
879
|
+
item.appendChild(icon);
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
_isInternalHref(href) {
|
|
883
|
+
if (!href) return false;
|
|
884
|
+
return !/^(https?:|mailto:|tel:)/.test(href);
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
_normalizePath(path) {
|
|
888
|
+
if (!path) return '/';
|
|
889
|
+
const pathWithoutOrigin = path.replace(/^https?:\/\/[^/]+/, '');
|
|
890
|
+
const [purePath, query = ''] = pathWithoutOrigin.split('?');
|
|
891
|
+
let normalizedPath = purePath.replace(/^#/, '');
|
|
892
|
+
normalizedPath = normalizedPath.startsWith('/') ? normalizedPath : `/${normalizedPath}`;
|
|
893
|
+
if (normalizedPath.length > 1) {
|
|
894
|
+
normalizedPath = normalizedPath.replace(/\/+$/, '');
|
|
895
|
+
}
|
|
896
|
+
return query ? `${normalizedPath}?${query}` : normalizedPath;
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
_getCurrentPath() {
|
|
900
|
+
if (window.location.hash && window.location.hash.startsWith('#/')) {
|
|
901
|
+
return this._normalizePath(window.location.hash.replace(/^#/, ''));
|
|
902
|
+
}
|
|
903
|
+
return this._normalizePath(window.location.pathname + window.location.search);
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
_isItemDisabled(item) {
|
|
907
|
+
return Boolean(
|
|
908
|
+
item.disabled ||
|
|
909
|
+
item.hasAttribute('disabled') ||
|
|
910
|
+
item.getAttribute('aria-disabled') === 'true' ||
|
|
911
|
+
item.getAttribute('aria-busy') === 'true'
|
|
912
|
+
);
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
_createMenuItemDetail(item, index, href, source, measurement) {
|
|
916
|
+
return {
|
|
917
|
+
schema: 'xtend.component.x-menu.item-clicked.v1',
|
|
918
|
+
id: this.id,
|
|
919
|
+
href: href || null,
|
|
920
|
+
index,
|
|
921
|
+
label: (item.textContent || '').trim(),
|
|
922
|
+
source,
|
|
923
|
+
lane: XMenu.xtendScaffoldPerformanceProfile.lane,
|
|
924
|
+
routeLane: XMenu.xtendScaffoldPerformanceProfile.fabric.routeLane,
|
|
925
|
+
stateKey: 'xmenu-active',
|
|
926
|
+
scheduleRef: href && this._isInternalHref(href) ? 'route.transition.navigate' : 'ui.user-blocking.navigation',
|
|
927
|
+
measurement
|
|
928
|
+
};
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
_createKeyboardDetail(key, fromIndex, toIndex, measurement) {
|
|
932
|
+
return {
|
|
933
|
+
schema: 'xtend.component.x-menu.keyboard-navigation.v1',
|
|
934
|
+
id: this.id,
|
|
935
|
+
key,
|
|
936
|
+
fromIndex,
|
|
937
|
+
toIndex,
|
|
938
|
+
lane: XMenu.xtendScaffoldPerformanceProfile.lane,
|
|
939
|
+
stateKey: 'xmenu-active',
|
|
940
|
+
scheduleRef: 'ui.user-blocking.navigation',
|
|
941
|
+
measurement
|
|
942
|
+
};
|
|
943
|
+
}
|
|
944
|
+
|
|
945
|
+
_now() {
|
|
946
|
+
return typeof performance !== 'undefined' && typeof performance.now === 'function'
|
|
947
|
+
? performance.now()
|
|
948
|
+
: Date.now();
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
_resolvePerformanceBudget(budgetKey) {
|
|
952
|
+
return XMenu.xtendScaffoldPerformanceProfile.budgetsMs[budgetKey] || null;
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
_recordPerformanceMeasurement(name, budgetKey, startTime, detail = {}) {
|
|
956
|
+
const durationMs = Math.max(0, this._now() - startTime);
|
|
957
|
+
const budgetMs = this._resolvePerformanceBudget(budgetKey);
|
|
958
|
+
const measurement = {
|
|
959
|
+
schema: X_MENU_PERFORMANCE_MEASUREMENT_SCHEMA,
|
|
960
|
+
componentRef: 'x-menu',
|
|
961
|
+
id: this.id || null,
|
|
962
|
+
name,
|
|
963
|
+
budgetKey,
|
|
964
|
+
durationMs,
|
|
965
|
+
budgetMs,
|
|
966
|
+
withinBudget: typeof budgetMs === 'number' ? durationMs <= budgetMs : true,
|
|
967
|
+
lane: XMenu.xtendScaffoldPerformanceProfile.lane,
|
|
968
|
+
detail
|
|
969
|
+
};
|
|
970
|
+
this._performanceMeasurements.push(measurement);
|
|
971
|
+
if (this._performanceMeasurements.length > 30) {
|
|
972
|
+
this._performanceMeasurements.splice(0, this._performanceMeasurements.length - 30);
|
|
973
|
+
}
|
|
974
|
+
this.dispatchEvent(new CustomEvent('menu-performance-measured', {
|
|
975
|
+
detail: measurement,
|
|
976
|
+
bubbles: true,
|
|
977
|
+
composed: true
|
|
978
|
+
}));
|
|
979
|
+
return measurement;
|
|
980
|
+
}
|
|
981
|
+
|
|
982
|
+
getPerformanceBudget() {
|
|
983
|
+
return { ...XMenu.xtendScaffoldPerformanceProfile.budgetsMs };
|
|
984
|
+
}
|
|
985
|
+
|
|
986
|
+
getInteractionBudget() {
|
|
987
|
+
return { ...XMenu.xtendScaffoldPerformanceProfile.interaction };
|
|
988
|
+
}
|
|
989
|
+
|
|
990
|
+
snapshotPerformance() {
|
|
991
|
+
return {
|
|
992
|
+
schema: X_MENU_PERFORMANCE_SNAPSHOT_SCHEMA,
|
|
993
|
+
componentRef: 'x-menu',
|
|
994
|
+
id: this.id || null,
|
|
995
|
+
lane: XMenu.xtendScaffoldPerformanceProfile.lane,
|
|
996
|
+
routeLane: XMenu.xtendScaffoldPerformanceProfile.fabric.routeLane,
|
|
997
|
+
hydrationPolicy: XMenu.xtendScaffoldPerformanceProfile.hydrationPolicy,
|
|
998
|
+
counters: { ...this._performanceCounters },
|
|
999
|
+
budgetsMs: this.getPerformanceBudget(),
|
|
1000
|
+
measurements: this._performanceMeasurements.slice(-10)
|
|
1001
|
+
};
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
customElements.define("x-menu", XMenu);
|