use-scroll-animate 10.2.0 → 10.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +4 -0
- package/CHANGELOG.md +35 -0
- package/README.md +67 -0
- package/bin/motionary-mcp.mjs +265 -0
- package/dist/chunks/anim-image-DDdb9q3X.js +166 -0
- package/dist/chunks/anim-image-DDdb9q3X.js.map +1 -0
- package/dist/chunks/anim-image-blQgPFFS.cjs +174 -0
- package/dist/chunks/anim-image-blQgPFFS.cjs.map +1 -0
- package/dist/chunks/audio-BpU-A1m1.cjs.map +1 -1
- package/dist/chunks/{audio-D95jwlOh.js → audio-CWt1xdZB.js} +3 -3
- package/dist/chunks/{audio-D95jwlOh.js.map → audio-CWt1xdZB.js.map} +1 -1
- package/dist/chunks/{base-BnRyfuyM.js → base-BTev8qxg.js} +2 -2
- package/dist/chunks/{base-BnRyfuyM.js.map → base-BTev8qxg.js.map} +1 -1
- package/dist/chunks/base-DBheNxJu.cjs.map +1 -1
- package/dist/chunks/bind-B_CTL6Qn.js.map +1 -1
- package/dist/chunks/bind-Ui43-n2d.cjs.map +1 -1
- package/dist/chunks/builtins-CKKZNR95.cjs.map +1 -1
- package/dist/chunks/{builtins-CqIq1zBv.js → builtins-CPmS6aDB.js} +3 -3
- package/dist/chunks/{builtins-CqIq1zBv.js.map → builtins-CPmS6aDB.js.map} +1 -1
- package/dist/chunks/core-B5T0dhFH.cjs.map +1 -1
- package/dist/chunks/{core-DsGoL9EY.js → core-BviA7nFa.js} +2 -2
- package/dist/chunks/{core-DsGoL9EY.js.map → core-BviA7nFa.js.map} +1 -1
- package/dist/chunks/core-D74Fz-dL.cjs.map +1 -1
- package/dist/chunks/core-D7cVumUu.js.map +1 -1
- package/dist/chunks/{core-XA2yhn1b.js → core-KiM7MXjL.js} +2 -2
- package/dist/chunks/{core-XA2yhn1b.js.map → core-KiM7MXjL.js.map} +1 -1
- package/dist/chunks/core-MQlXZKUG.cjs.map +1 -1
- package/dist/chunks/ease-HwYZnZat.cjs +94 -0
- package/dist/chunks/ease-HwYZnZat.cjs.map +1 -0
- package/dist/chunks/ease-XN8_0sXu.js +89 -0
- package/dist/chunks/ease-XN8_0sXu.js.map +1 -0
- package/dist/chunks/fx-B_pbhpDp.cjs.map +1 -1
- package/dist/chunks/{fx-CtnrFEg9.js → fx-CgWKqVsn.js} +2 -2
- package/dist/chunks/{fx-CtnrFEg9.js.map → fx-CgWKqVsn.js.map} +1 -1
- package/dist/chunks/generative-2LhxG5BJ.js.map +1 -1
- package/dist/chunks/generative-BHIj-NU0.cjs.map +1 -1
- package/dist/chunks/{gpu-CDcXiNA8.js → gpu-BWfgYWMY.js} +2 -2
- package/dist/chunks/{gpu-CDcXiNA8.js.map → gpu-BWfgYWMY.js.map} +1 -1
- package/dist/chunks/gpu-cUixt7kT.cjs.map +1 -1
- package/dist/chunks/index-tags-B-JBecYg.js.map +1 -1
- package/dist/chunks/index-tags-hLIF2Clq.cjs.map +1 -1
- package/dist/chunks/{keyframes-W-474DMc.js → keyframes-B5PWe5bU.js} +3 -2
- package/dist/chunks/keyframes-B5PWe5bU.js.map +1 -0
- package/dist/chunks/{keyframes-ZheOkpt0.cjs → keyframes-tC3I7anQ.cjs} +4 -3
- package/dist/chunks/keyframes-tC3I7anQ.cjs.map +1 -0
- package/dist/chunks/{manifest-D58HXVY-.js → manifest-BHx5yPN6.js} +2 -2
- package/dist/chunks/{manifest-D58HXVY-.js.map → manifest-BHx5yPN6.js.map} +1 -1
- package/dist/chunks/manifest-PaF9B8Vt.cjs.map +1 -1
- package/dist/chunks/{player-48Zy_NBG.js → player-BfHMNtiM.js} +4 -4
- package/dist/chunks/{player-48Zy_NBG.js.map → player-BfHMNtiM.js.map} +1 -1
- package/dist/chunks/player-C4y4jXSv.cjs.map +1 -1
- package/dist/chunks/presets-BYBVJVeP.js.map +1 -1
- package/dist/chunks/presets-CUHys3sK.cjs.map +1 -1
- package/dist/chunks/{registry-gFJRpPES.js → registry-BKzyg1JV.js} +2 -2
- package/dist/chunks/{registry-gFJRpPES.js.map → registry-BKzyg1JV.js.map} +1 -1
- package/dist/chunks/{registry-BIEjKngP.js → registry-CT-TT_bx.js} +3 -3
- package/dist/chunks/{registry-BIEjKngP.js.map → registry-CT-TT_bx.js.map} +1 -1
- package/dist/chunks/{registry-eJgpFAzI.cjs → registry-tzwKkldE.cjs} +2 -2
- package/dist/chunks/{registry-eJgpFAzI.cjs.map → registry-tzwKkldE.cjs.map} +1 -1
- package/dist/chunks/registry-xQZnSqqV.cjs.map +1 -1
- package/dist/chunks/shared-CkKHWrtJ.js.map +1 -1
- package/dist/chunks/shared-jkgRH-Hx.cjs.map +1 -1
- package/dist/chunks/{spring-CZDNyqWp.js → spring-BHuP55DR.js} +2 -2
- package/dist/chunks/{spring-CZDNyqWp.js.map → spring-BHuP55DR.js.map} +1 -1
- package/dist/chunks/spring-BlTQD2AV.cjs.map +1 -1
- package/dist/chunks/stagger-CCFyhzSw.cjs.map +1 -1
- package/dist/chunks/stagger-DtMKo2SK.js.map +1 -1
- package/dist/chunks/{ticker-CM_56oVy.js → ticker-C8lSGml9.js} +2 -2
- package/dist/chunks/{ticker-CM_56oVy.js.map → ticker-C8lSGml9.js.map} +1 -1
- package/dist/chunks/{ticker-D4o6enH0.cjs → ticker-Un0bvTWR.cjs} +2 -2
- package/dist/chunks/{ticker-D4o6enH0.cjs.map → ticker-Un0bvTWR.cjs.map} +1 -1
- package/dist/chunks/{tween-CqX1JBuj.js → tween-BcejKpsx.js} +15 -91
- package/dist/chunks/tween-BcejKpsx.js.map +1 -0
- package/dist/chunks/{tween-CBuWYpI-.cjs → tween-CwLLC3Ko.cjs} +15 -95
- package/dist/chunks/tween-CwLLC3Ko.cjs.map +1 -0
- package/dist/chunks/variants-CrDDJoYK.cjs.map +1 -1
- package/dist/chunks/{variants-GU3yIL4F.js → variants-CsRGUIyA.js} +2 -2
- package/dist/chunks/{variants-GU3yIL4F.js.map → variants-CsRGUIyA.js.map} +1 -1
- package/dist/components/a11y.cjs.map +1 -1
- package/dist/components/a11y.js +2 -2
- package/dist/components/a11y.js.map +1 -1
- package/dist/components/angular.cjs.map +1 -1
- package/dist/components/angular.js +8 -8
- package/dist/components/angular.js.map +1 -1
- package/dist/components/background.cjs.map +1 -1
- package/dist/components/background.js +2 -2
- package/dist/components/background.js.map +1 -1
- package/dist/components/bridge.cjs.map +1 -1
- package/dist/components/bridge.js +1 -1
- package/dist/components/bridge.js.map +1 -1
- package/dist/components/cards.cjs.map +1 -1
- package/dist/components/cards.js +2 -2
- package/dist/components/cards.js.map +1 -1
- package/dist/components/click.cjs.map +1 -1
- package/dist/components/click.js +3 -3
- package/dist/components/click.js.map +1 -1
- package/dist/components/core.cjs.map +1 -1
- package/dist/components/core.js.map +1 -1
- package/dist/components/depth.cjs.map +1 -1
- package/dist/components/depth.js +3 -3
- package/dist/components/depth.js.map +1 -1
- package/dist/components/design.cjs.map +1 -1
- package/dist/components/design.js +3 -3
- package/dist/components/design.js.map +1 -1
- package/dist/components/dsl.cjs.map +1 -1
- package/dist/components/dsl.js +2 -2
- package/dist/components/dsl.js.map +1 -1
- package/dist/components/effects.cjs.map +1 -1
- package/dist/components/effects.js +9 -9
- package/dist/components/effects.js.map +1 -1
- package/dist/components/engine.cjs.map +1 -1
- package/dist/components/engine.js +2 -2
- package/dist/components/engine.js.map +1 -1
- package/dist/components/feedback.cjs.map +1 -1
- package/dist/components/feedback.js +1 -1
- package/dist/components/feedback.js.map +1 -1
- package/dist/components/fx-3d.cjs.map +1 -1
- package/dist/components/fx-3d.js +2 -2
- package/dist/components/fx-3d.js.map +1 -1
- package/dist/components/fx-ai.cjs.map +1 -1
- package/dist/components/fx-ai.js +2 -2
- package/dist/components/fx-ai.js.map +1 -1
- package/dist/components/fx-chart.cjs.map +1 -1
- package/dist/components/fx-chart.js +2 -2
- package/dist/components/fx-chart.js.map +1 -1
- package/dist/components/fx-cinema.cjs.map +1 -1
- package/dist/components/fx-cinema.js +2 -2
- package/dist/components/fx-cinema.js.map +1 -1
- package/dist/components/fx-cyber.cjs.map +1 -1
- package/dist/components/fx-cyber.js +2 -2
- package/dist/components/fx-cyber.js.map +1 -1
- package/dist/components/fx-festival.cjs.map +1 -1
- package/dist/components/fx-festival.js +2 -2
- package/dist/components/fx-festival.js.map +1 -1
- package/dist/components/fx-focus.cjs.map +1 -1
- package/dist/components/fx-focus.js +2 -2
- package/dist/components/fx-focus.js.map +1 -1
- package/dist/components/fx-form.cjs.map +1 -1
- package/dist/components/fx-form.js +2 -2
- package/dist/components/fx-form.js.map +1 -1
- package/dist/components/fx-game.cjs.map +1 -1
- package/dist/components/fx-game.js +2 -2
- package/dist/components/fx-game.js.map +1 -1
- package/dist/components/fx-genart.cjs.map +1 -1
- package/dist/components/fx-genart.js +2 -2
- package/dist/components/fx-genart.js.map +1 -1
- package/dist/components/fx-geo.cjs.map +1 -1
- package/dist/components/fx-geo.js +2 -2
- package/dist/components/fx-geo.js.map +1 -1
- package/dist/components/fx-gesture.cjs.map +1 -1
- package/dist/components/fx-gesture.js +2 -2
- package/dist/components/fx-gesture.js.map +1 -1
- package/dist/components/fx-gpu.js +3 -3
- package/dist/components/fx-light.cjs.map +1 -1
- package/dist/components/fx-light.js +2 -2
- package/dist/components/fx-light.js.map +1 -1
- package/dist/components/fx-lottie.cjs.map +1 -1
- package/dist/components/fx-lottie.js +2 -2
- package/dist/components/fx-lottie.js.map +1 -1
- package/dist/components/fx-morph.cjs.map +1 -1
- package/dist/components/fx-morph.js +2 -2
- package/dist/components/fx-morph.js.map +1 -1
- package/dist/components/fx-music.cjs.map +1 -1
- package/dist/components/fx-music.js +3 -3
- package/dist/components/fx-music.js.map +1 -1
- package/dist/components/fx-organic.cjs.map +1 -1
- package/dist/components/fx-organic.js +2 -2
- package/dist/components/fx-organic.js.map +1 -1
- package/dist/components/fx-paper.cjs.map +1 -1
- package/dist/components/fx-paper.js +2 -2
- package/dist/components/fx-paper.js.map +1 -1
- package/dist/components/fx-perf.cjs.map +1 -1
- package/dist/components/fx-perf.js +2 -2
- package/dist/components/fx-perf.js.map +1 -1
- package/dist/components/fx-physics.cjs.map +1 -1
- package/dist/components/fx-physics.js +2 -2
- package/dist/components/fx-physics.js.map +1 -1
- package/dist/components/fx-retro.cjs.map +1 -1
- package/dist/components/fx-retro.js +2 -2
- package/dist/components/fx-retro.js.map +1 -1
- package/dist/components/fx-safe.cjs.map +1 -1
- package/dist/components/fx-safe.js +2 -2
- package/dist/components/fx-safe.js.map +1 -1
- package/dist/components/fx-shop.cjs.map +1 -1
- package/dist/components/fx-shop.js +2 -2
- package/dist/components/fx-shop.js.map +1 -1
- package/dist/components/fx-social.cjs.map +1 -1
- package/dist/components/fx-social.js +2 -2
- package/dist/components/fx-social.js.map +1 -1
- package/dist/components/fx-spatial.cjs.map +1 -1
- package/dist/components/fx-spatial.js +2 -2
- package/dist/components/fx-spatial.js.map +1 -1
- package/dist/components/fx-surface.cjs.map +1 -1
- package/dist/components/fx-surface.js +2 -2
- package/dist/components/fx-surface.js.map +1 -1
- package/dist/components/fx-text.cjs.map +1 -1
- package/dist/components/fx-text.js +2 -2
- package/dist/components/fx-text.js.map +1 -1
- package/dist/components/fx-transitions.cjs.map +1 -1
- package/dist/components/fx-transitions.js +3 -3
- package/dist/components/fx-transitions.js.map +1 -1
- package/dist/components/fx-video.cjs.map +1 -1
- package/dist/components/fx-video.js +2 -2
- package/dist/components/fx-video.js.map +1 -1
- package/dist/components/fx-weather.cjs.map +1 -1
- package/dist/components/fx-weather.js +2 -2
- package/dist/components/fx-weather.js.map +1 -1
- package/dist/components/fx.cjs.map +1 -1
- package/dist/components/fx.js +6 -6
- package/dist/components/fx.js.map +1 -1
- package/dist/components/fx2.cjs.map +1 -1
- package/dist/components/fx2.js +6 -6
- package/dist/components/fx2.js.map +1 -1
- package/dist/components/gesture.cjs.map +1 -1
- package/dist/components/gesture.js +4 -4
- package/dist/components/gesture.js.map +1 -1
- package/dist/components/interaction.cjs.map +1 -1
- package/dist/components/interaction.js +1 -1
- package/dist/components/interaction.js.map +1 -1
- package/dist/components/layout.cjs.map +1 -1
- package/dist/components/layout.js +1 -1
- package/dist/components/layout.js.map +1 -1
- package/dist/components/lazy.cjs.map +1 -1
- package/dist/components/lazy.js.map +1 -1
- package/dist/components/lite.cjs.map +1 -1
- package/dist/components/lite.js.map +1 -1
- package/dist/components/marketplace.cjs.map +1 -1
- package/dist/components/marketplace.js +4 -4
- package/dist/components/marketplace.js.map +1 -1
- package/dist/components/native.cjs.map +1 -1
- package/dist/components/native.js +3 -3
- package/dist/components/native.js.map +1 -1
- package/dist/components/packs.cjs.map +1 -1
- package/dist/components/packs.js +1 -1
- package/dist/components/packs.js.map +1 -1
- package/dist/components/page.cjs.map +1 -1
- package/dist/components/page.js +3 -3
- package/dist/components/page.js.map +1 -1
- package/dist/components/perf.cjs.map +1 -1
- package/dist/components/perf.js +2 -2
- package/dist/components/perf.js.map +1 -1
- package/dist/components/physics.cjs.map +1 -1
- package/dist/components/physics.js +3 -3
- package/dist/components/physics.js.map +1 -1
- package/dist/components/plugins.cjs.map +1 -1
- package/dist/components/plugins.js +4 -4
- package/dist/components/plugins.js.map +1 -1
- package/dist/components/react.cjs.map +1 -1
- package/dist/components/react.js.map +1 -1
- package/dist/components/reveal.cjs.map +1 -1
- package/dist/components/reveal.js +1 -1
- package/dist/components/reveal.js.map +1 -1
- package/dist/components/solid.cjs.map +1 -1
- package/dist/components/solid.js +8 -8
- package/dist/components/solid.js.map +1 -1
- package/dist/components/svelte.cjs.map +1 -1
- package/dist/components/svelte.js +8 -8
- package/dist/components/svelte.js.map +1 -1
- package/dist/components/svg.cjs.map +1 -1
- package/dist/components/svg.js +1 -1
- package/dist/components/svg.js.map +1 -1
- package/dist/components/text.cjs.map +1 -1
- package/dist/components/text.js +2 -2
- package/dist/components/text.js.map +1 -1
- package/dist/components/timeline.cjs.map +1 -1
- package/dist/components/timeline.js +3 -3
- package/dist/components/timeline.js.map +1 -1
- package/dist/components/tokens.cjs.map +1 -1
- package/dist/components/tokens.js.map +1 -1
- package/dist/components/transitions.cjs.map +1 -1
- package/dist/components/transitions.js +1 -1
- package/dist/components/transitions.js.map +1 -1
- package/dist/components/ui.cjs.map +1 -1
- package/dist/components/ui.js +4 -4
- package/dist/components/ui.js.map +1 -1
- package/dist/components/vue.cjs.map +1 -1
- package/dist/components/vue.js +8 -8
- package/dist/components/vue.js.map +1 -1
- package/dist/components/webgl.cjs.map +1 -1
- package/dist/components/webgl.js +1 -1
- package/dist/components/webgl.js.map +1 -1
- package/dist/components/widgets.cjs +766 -212
- package/dist/components/widgets.cjs.map +1 -1
- package/dist/components/widgets.d.cts +207 -2
- package/dist/components/widgets.d.ts +207 -2
- package/dist/components/widgets.js +770 -221
- package/dist/components/widgets.js.map +1 -1
- package/dist/components.cjs.map +1 -1
- package/dist/components.js +10 -10
- package/dist/components.js.map +1 -1
- package/dist/element.cjs.map +1 -1
- package/dist/element.js.map +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/llms-full.txt +250 -1
- package/dist/llms.txt +13 -2
- package/dist/manifest.json +646 -1
- package/dist/presets/extended.cjs.map +1 -1
- package/dist/presets/extended.js.map +1 -1
- package/dist/react.cjs.map +1 -1
- package/dist/react.js.map +1 -1
- package/dist/runtime/format-apng.cjs +131 -0
- package/dist/runtime/format-apng.cjs.map +1 -0
- package/dist/runtime/format-apng.d.cts +250 -0
- package/dist/runtime/format-apng.d.ts +250 -0
- package/dist/runtime/format-apng.iife.js +2 -0
- package/dist/runtime/format-apng.iife.js.map +1 -0
- package/dist/runtime/format-apng.js +123 -0
- package/dist/runtime/format-apng.js.map +1 -0
- package/dist/runtime/format-css.cjs +5 -4
- package/dist/runtime/format-css.cjs.map +1 -1
- package/dist/runtime/format-css.js +5 -4
- package/dist/runtime/format-css.js.map +1 -1
- package/dist/runtime/format-gif.cjs +206 -0
- package/dist/runtime/format-gif.cjs.map +1 -0
- package/dist/runtime/format-gif.d.cts +223 -0
- package/dist/runtime/format-gif.d.ts +223 -0
- package/dist/runtime/format-gif.iife.js +2 -0
- package/dist/runtime/format-gif.iife.js.map +1 -0
- package/dist/runtime/format-gif.js +199 -0
- package/dist/runtime/format-gif.js.map +1 -0
- package/dist/runtime/format-motion.cjs +9 -8
- package/dist/runtime/format-motion.cjs.map +1 -1
- package/dist/runtime/format-motion.js +5 -4
- package/dist/runtime/format-motion.js.map +1 -1
- package/dist/runtime/format-sprite.cjs +226 -0
- package/dist/runtime/format-sprite.cjs.map +1 -0
- package/dist/runtime/format-sprite.d.cts +224 -0
- package/dist/runtime/format-sprite.d.ts +224 -0
- package/dist/runtime/format-sprite.iife.js +2 -0
- package/dist/runtime/format-sprite.iife.js.map +1 -0
- package/dist/runtime/format-sprite.js +216 -0
- package/dist/runtime/format-sprite.js.map +1 -0
- package/dist/runtime/format-svg.cjs +5 -4
- package/dist/runtime/format-svg.cjs.map +1 -1
- package/dist/runtime/format-svg.iife.js.map +1 -1
- package/dist/runtime/format-svg.js +4 -3
- package/dist/runtime/format-svg.js.map +1 -1
- package/dist/runtime/format-webp.cjs +123 -0
- package/dist/runtime/format-webp.cjs.map +1 -0
- package/dist/runtime/format-webp.d.cts +245 -0
- package/dist/runtime/format-webp.d.ts +245 -0
- package/dist/runtime/format-webp.iife.js +2 -0
- package/dist/runtime/format-webp.iife.js.map +1 -0
- package/dist/runtime/format-webp.js +115 -0
- package/dist/runtime/format-webp.js.map +1 -0
- package/dist/runtime/scroll.cjs +2 -2
- package/dist/runtime/scroll.cjs.map +1 -1
- package/dist/runtime/scroll.js +2 -2
- package/dist/runtime/scroll.js.map +1 -1
- package/dist/runtime/smooth.cjs +284 -0
- package/dist/runtime/smooth.cjs.map +1 -0
- package/dist/runtime/smooth.d.cts +137 -0
- package/dist/runtime/smooth.d.ts +137 -0
- package/dist/runtime/smooth.iife.js +2 -0
- package/dist/runtime/smooth.iife.js.map +1 -0
- package/dist/runtime/smooth.js +279 -0
- package/dist/runtime/smooth.js.map +1 -0
- package/dist/runtime/text.cjs +147 -0
- package/dist/runtime/text.cjs.map +1 -0
- package/dist/runtime/text.d.cts +65 -0
- package/dist/runtime/text.d.ts +65 -0
- package/dist/runtime/text.iife.js +2 -0
- package/dist/runtime/text.iife.js.map +1 -0
- package/dist/runtime/text.js +143 -0
- package/dist/runtime/text.js.map +1 -0
- package/dist/runtime.cjs +9 -8
- package/dist/runtime.cjs.map +1 -1
- package/dist/runtime.d.cts +9 -2
- package/dist/runtime.d.ts +9 -2
- package/dist/runtime.iife.js +1 -1
- package/dist/runtime.iife.js.map +1 -1
- package/dist/runtime.js +6 -5
- package/dist/runtime.js.map +1 -1
- package/dist/solid.cjs.map +1 -1
- package/dist/solid.js.map +1 -1
- package/dist/svelte.cjs.map +1 -1
- package/dist/svelte.js.map +1 -1
- package/dist/vue.cjs.map +1 -1
- package/dist/vue.js.map +1 -1
- package/dist/widgets.umd.js +1 -1
- package/dist/widgets.umd.js.map +1 -1
- package/docs/ROADMAP.md +2 -2
- package/docs/components/README.md +12 -7
- package/docs/components/usa-parallax-layers.md +38 -0
- package/docs/components/usa-route-transition.md +38 -0
- package/docs/components/usa-scroll-ring.md +32 -0
- package/docs/components/usa-smooth-scroll.md +60 -0
- package/docs/components/usa-text-splitter.md +60 -0
- package/docs/components.md +94 -0
- package/docs/mcp.md +50 -0
- package/docs/runtime/format-apng.md +59 -0
- package/docs/runtime/format-gif.md +60 -0
- package/docs/runtime/format-sprite.md +60 -0
- package/docs/runtime/format-webp.md +58 -0
- package/docs/runtime/smooth.md +60 -0
- package/docs/runtime/text.md +59 -0
- package/package.json +64 -2
- package/dist/chunks/keyframes-W-474DMc.js.map +0 -1
- package/dist/chunks/keyframes-ZheOkpt0.cjs.map +0 -1
- package/dist/chunks/tween-CBuWYpI-.cjs.map +0 -1
- package/dist/chunks/tween-CqX1JBuj.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"a11y.cjs","sources":["../../src/components/a11y/baseline.ts","../../src/components/a11y/index.ts"],"sourcesContent":["/**\n * 4.9 — the 5.0 modern-browser baseline. `baselineReport()` lists which\n * required / progressive features this browser has; `warnBaseline()` logs\n * once in development when a required one is missing.\n */\nimport { deprecate } from '../base';\n\nexport interface BaselineFeature {\n id: string;\n required: boolean;\n supported: boolean;\n}\n\n/** Required in 5.0: Custom Elements, WAAPI, IntersectionObserver, ResizeObserver, adoptedStyleSheets. Progressive: View Transitions, scroll-driven animations, WebGL. */\nexport function baselineReport(): BaselineFeature[] {\n const w = (typeof window !== 'undefined' ? window : {}) as any;\n const d = (typeof document !== 'undefined' ? document : {}) as any;\n const css = (q: string) => typeof w.CSS?.supports === 'function' && w.CSS.supports(q);\n return [\n { id: 'custom-elements', required: true, supported: !!w.customElements },\n { id: 'web-animations', required: true, supported: typeof w.Element?.prototype?.animate === 'function' },\n { id: 'intersection-observer', required: true, supported: typeof w.IntersectionObserver === 'function' },\n { id: 'resize-observer', required: true, supported: typeof w.ResizeObserver === 'function' },\n { id: 'adopted-stylesheets', required: true, supported: 'adoptedStyleSheets' in d },\n { id: 'view-transitions', required: false, supported: typeof d.startViewTransition === 'function' },\n { id: 'scroll-driven-animations', required: false, supported: css('animation-timeline: view()') },\n { id: 'webgl', required: false, supported: !!(d.createElement && (() => { try { return d.createElement('canvas').getContext('webgl'); } catch { return null; } })()) },\n ];\n}\n\n/** Log (once) which required 5.0 features are missing here. Returns the missing ids. */\nexport function warnBaseline(): string[] {\n const missing = baselineReport().filter((f) => f.required && !f.supported).map((f) => f.id);\n if (missing.length) deprecate('baseline', `this browser lacks ${missing.join(', ')}; motionary 5.0 requires them (modern-browser baseline, see docs/upgrading-5.md).`);\n return missing;\n}\n","/**\n * motionary/components/a11y — accessibility toolkit (4.4).\n *\n * - Motion-sensitivity levels: `setMotionSensitivity('full' | 'gentle' | 'minimal' | 'static')`.\n * - Static alternatives: what every component shows when motion is off, and\n * `staticAlternative(root)` to freeze any subtree at its final state.\n * - `aria-live` conventions: one shared polite and one assertive region,\n * `announce(message, { politeness })`.\n * - `auditMotionA11y(root)`: the rules the automated regression tests run\n * over every `<usa-*>` element — usable in your own tests too.\n *\n * ```ts\n * import { setMotionSensitivity, announce, auditMotionA11y } from 'motionary/components/a11y';\n * setMotionSensitivity('gentle', true); // no spins / zooms / parallax, remembered\n * announce('3 items added to cart'); // polite live region\n * expect(auditMotionA11y(document.body).errors).toEqual([]);\n * ```\n */\nimport {\n configureComponents,\n getMotionSensitivity,\n adaptKeyframes,\n adoptStyles,\n MOTION_SENSITIVITY_LEVELS,\n type MotionSensitivity,\n} from '../base';\nimport { COMPONENT_CATEGORIES, type ComponentCategory } from '../index-tags';\n\nexport { getMotionSensitivity, adaptKeyframes, MOTION_SENSITIVITY_LEVELS };\nexport { baselineReport, warnBaseline } from './baseline';\nexport type { BaselineFeature } from './baseline';\nexport type { MotionSensitivity };\n\nconst KEY = 'usa:sensitivity';\n\n/** What each level allows, for docs and settings UIs. */\nexport const MOTION_SENSITIVITY: Record<MotionSensitivity, { en: string; zh: string; allows: string[] }> = {\n full: { en: 'All motion', zh: '全部动效', allows: ['fade', 'translate', 'scale', 'rotate', 'parallax', 'loop', 'flash'] },\n gentle: { en: 'Gentle — no spins, zooms or parallax', zh: '温和 —— 无旋转、缩放与视差', allows: ['fade', 'translate', 'loop'] },\n minimal: { en: 'Minimal — fades only', zh: '最少 —— 仅淡入淡出', allows: ['fade'] },\n static: { en: 'Static — no animation', zh: '静态 —— 无动画', allows: [] },\n};\n\n/** CSS applied at the `static` / `minimal` / `gentle` levels (also stops your own CSS animations under `static`). */\nexport const SENSITIVITY_CSS =\n 'html[data-usa-sensitivity=\"static\"] *,html[data-usa-sensitivity=\"static\"] *::before,html[data-usa-sensitivity=\"static\"] *::after{animation:none!important;transition:none!important;scroll-behavior:auto!important}' +\n 'html[data-usa-sensitivity=\"minimal\"] *,html[data-usa-sensitivity=\"minimal\"] *::before,html[data-usa-sensitivity=\"minimal\"] *::after{animation-duration:1ms!important;animation-iteration-count:1!important;scroll-behavior:auto!important}' +\n 'html[data-usa-sensitivity=\"gentle\"]{--usa-parallax:0;--usa-tilt:0}';\n\n/**\n * Set the motion-sensitivity level for every `<usa-*>` component and the page:\n * sets `data-usa-sensitivity` on `<html>`, adapts component keyframes, and\n * with `persist` remembers the choice (`restoreMotionSensitivity()`).\n * Dispatches `usa:sensitivity` on `document`.\n */\nexport function setMotionSensitivity(level: MotionSensitivity, persist = false): void {\n if (!MOTION_SENSITIVITY_LEVELS.includes(level)) return;\n configureComponents({ motionSensitivity: level });\n adoptStyles('a11y-sensitivity', SENSITIVITY_CSS);\n if (persist) {\n try {\n localStorage.setItem(KEY, level);\n } catch {\n /* private mode */\n }\n }\n if (level === 'static' && typeof document !== 'undefined') staticAlternative(document.documentElement);\n if (typeof document !== 'undefined') document.dispatchEvent(new CustomEvent('usa:sensitivity', { detail: { level } }));\n}\n\n/** Re-apply a persisted level (call early on page load). Returns the active level. */\nexport function restoreMotionSensitivity(): MotionSensitivity {\n try {\n const v = localStorage.getItem(KEY) as MotionSensitivity | null;\n if (v && MOTION_SENSITIVITY_LEVELS.includes(v)) setMotionSensitivity(v);\n } catch {\n /* ignore */\n }\n return getMotionSensitivity();\n}\n\n/** `true` when the current level allows a kind of motion (`'rotate'`, `'parallax'`, `'loop'`…). */\nexport function motionAllowed(kind: string, level: MotionSensitivity = getMotionSensitivity()): boolean {\n return MOTION_SENSITIVITY[level].allows.includes(kind);\n}\n\n/** The static alternative of each category: what its elements show without motion. */\nexport const STATIC_ALTERNATIVES: Record<ComponentCategory, string> = {\n reveal: 'Content visible in place; progress bars show the current value.',\n text: 'Full final text (screen readers always get a plain copy).',\n interaction: 'Normal hover / focus styles; no tilt, magnet or ripple.',\n feedback: 'Spinners become a static busy indicator; progress shows its value; toasts appear without sliding.',\n background: 'A still frame of the background (gradient / pattern); particles and marquees stop.',\n transitions: 'Dialogs, accordions and views switch instantly.',\n physics: 'Values jump to their target; drag still works, without inertia.',\n cards: 'Cards are shown flat and fully readable; stacks become lists.',\n click: 'Clicks work and states are announced; no bursts, confetti or deformation.',\n ui: 'Tabs, drawers, sheets and popovers open instantly with focus management intact.',\n page: 'Page transitions are instant; cursors and ambient layers are hidden.',\n timeline: 'Every step is shown at its final state.',\n gesture: 'Buttons / keys provide the same actions as swipes and pinches.',\n svg: 'Drawings and icons are shown complete.',\n webgl: 'A static poster image or CSS gradient instead of the shader.',\n depth: 'Flat, front-facing layout.',\n layout: 'Items reflow instantly.',\n packs: 'Roles are styled but not animated.',\n fx: 'Effects are skipped or reduced to a short fade; the content is unchanged.',\n};\n\n/**\n * Freeze a subtree at its static alternative: finishes running animations\n * (`finish()`, so content lands on its final state), marks the root with\n * `data-usa-static` and returns an undo that removes the mark.\n */\nexport function staticAlternative(root: Element): () => void {\n const getAll = (root as any).getAnimations as undefined | ((o: { subtree: boolean }) => Animation[]);\n if (typeof getAll === 'function') {\n for (const a of getAll.call(root, { subtree: true })) {\n try {\n const it = a.effect?.getComputedTiming().iterations;\n if (it === Infinity) a.cancel();\n else a.finish();\n } catch {\n /* finished already */\n }\n }\n }\n root.setAttribute('data-usa-static', '');\n return () => root.removeAttribute('data-usa-static');\n}\n\n// --- aria-live conventions ---------------------------------------------------\n\nexport type Politeness = 'polite' | 'assertive';\n/** The ids of the shared live regions. */\nexport const LIVE_REGION_IDS: Record<Politeness, string> = { polite: 'usa-live-polite', assertive: 'usa-live-assertive' };\n\n/** The shared live region (created once, visually hidden, `role=\"status\"` / `role=\"alert\"`). */\nexport function liveRegion(politeness: Politeness = 'polite'): HTMLElement | null {\n if (typeof document === 'undefined' || !document.body) return null;\n const id = LIVE_REGION_IDS[politeness];\n let el = document.getElementById(id);\n if (!el) {\n el = document.createElement('div');\n el.id = id;\n el.className = 'usa-sr';\n el.setAttribute('role', politeness === 'assertive' ? 'alert' : 'status');\n el.setAttribute('aria-live', politeness);\n el.setAttribute('aria-atomic', 'true');\n document.body.appendChild(el);\n }\n return el;\n}\n\nlet lastMsg = '';\nlet lastAt = 0;\n/**\n * Announce a message through the shared live region. Conventions: `polite`\n * for results of the user's own actions (added, saved, copied), `assertive`\n * only for errors that block them. Identical messages within `dedupe` ms\n * (default 500) are dropped; the region is cleared first so repeats are read.\n */\nexport function announce(message: string, options: { politeness?: Politeness; dedupe?: number } = {}): boolean {\n const { politeness = 'polite', dedupe = 500 } = options;\n const t = Date.now();\n if (!message || (message === lastMsg && t - lastAt < dedupe)) return false;\n lastMsg = message;\n lastAt = t;\n const el = liveRegion(politeness);\n if (!el) return false;\n el.textContent = '';\n el.textContent = message;\n return true;\n}\n\n// --- audit ---------------------------------------------------------------------\n\nexport interface A11yIssue {\n rule: string;\n level: 'error' | 'warning';\n element: Element;\n message: string;\n}\n\nconst FOCUSABLE = 'a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex=\"-1\"])';\nconst NAMED_ROLES = ['button', 'switch', 'checkbox', 'slider', 'tab', 'progressbar', 'radiogroup', 'dialog'];\n\nfunction accessibleName(el: Element): string {\n const label = el.getAttribute('aria-label');\n if (label) return label;\n const by = el.getAttribute('aria-labelledby');\n if (by) return by.split(/\\s+/).map((id) => el.ownerDocument.getElementById(id)?.textContent || '').join(' ').trim();\n return (el.textContent || el.getAttribute('title') || '').trim();\n}\n\n/**\n * Check a subtree against the library's motion-a11y rules:\n * - `aria-hidden-focusable` (error): focusable content inside `aria-hidden`.\n * - `role-name` (error): a widget role without an accessible name.\n * - `range-value` (error): a slider / determinate progressbar without `aria-valuenow`.\n * - `img-alt` (error): an `<img>` without `alt`.\n * - `assertive-live` (warning): `aria-live=\"assertive\"` outside `role=\"alert\"`.\n * - `infinite-no-control` (warning, WCAG 2.2.2): an endless animation on a\n * page with no way to pause motion (`<usa-motion-switch>` or `[data-usa-pause]`).\n */\nexport function auditMotionA11y(root: Element | Document): { errors: A11yIssue[]; warnings: A11yIssue[] } {\n const issues: A11yIssue[] = [];\n const add = (rule: string, level: A11yIssue['level'], element: Element, message: string) => issues.push({ rule, level, element, message });\n const scope = root as ParentNode;\n scope.querySelectorAll('[aria-hidden=\"true\"]').forEach((h) => {\n const f = (h.matches(FOCUSABLE) ? [h] : Array.from(h.querySelectorAll(FOCUSABLE))).filter((x) => !x.closest('[inert]'));\n f.forEach((x) => add('aria-hidden-focusable', 'error', x, `focusable <${x.tagName.toLowerCase()}> inside aria-hidden`));\n });\n scope.querySelectorAll('[role]').forEach((el) => {\n const role = el.getAttribute('role')!;\n if (NAMED_ROLES.includes(role) && !accessibleName(el)) add('role-name', 'error', el, `role=\"${role}\" has no accessible name`);\n if (role === 'slider' && !el.hasAttribute('aria-valuenow'))\n add('range-value', 'error', el, 'slider without aria-valuenow');\n });\n scope.querySelectorAll('img:not([alt])').forEach((el) => add('img-alt', 'error', el, '<img> without alt'));\n scope.querySelectorAll('[aria-live=\"assertive\"]').forEach((el) => {\n if (el.getAttribute('role') !== 'alert') add('assertive-live', 'warning', el, 'assertive live region outside role=\"alert\"');\n });\n const doc = (root as Node).ownerDocument || (root as Document);\n const anims = typeof (root as any).getAnimations === 'function' ? ((root as any).getAnimations({ subtree: true }) as Animation[]) : [];\n const control = doc && (doc.querySelector('usa-motion-switch, [data-usa-pause]') || doc.documentElement.hasAttribute('data-usa-sensitivity'));\n if (!control)\n anims.forEach((a) => {\n try {\n if (a.effect?.getComputedTiming().iterations === Infinity) {\n const t = (a.effect as KeyframeEffect).target;\n if (t) add('infinite-no-control', 'warning', t, 'endless animation and no motion control on the page');\n }\n } catch {\n /* ignore */\n }\n });\n return { errors: issues.filter((i) => i.level === 'error'), warnings: issues.filter((i) => i.level === 'warning') };\n}\n\n/** Every `<usa-*>` tag, for sweeping audits. */\nexport const ALL_TAGS: string[] = (Object.values(COMPONENT_CATEGORIES) as readonly (readonly string[])[]).flat();\n"],"names":["deprecate","MOTION_SENSITIVITY_LEVELS","configureComponents","adoptStyles","getMotionSensitivity","COMPONENT_CATEGORIES"],"mappings":";;;;;AAA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,KAAK,KAAK,OAAO,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,KAAK,SAAS,CAAC,EAAE;AACrH;AAEA;AACO,MAAM,QAAQ,GAAc,MAAM,CAAC,MAAM,CAACC,8BAAoB,CAAoC,CAAC,IAAI;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"a11y.cjs","sources":["../../src/components/a11y/baseline.ts","../../src/components/a11y/index.ts"],"sourcesContent":["/**\n * 4.9 — the 5.0 modern-browser baseline. `baselineReport()` lists which\n * required / progressive features this browser has; `warnBaseline()` logs\n * once in development when a required one is missing.\n */\nimport { deprecate } from '../base';\n\nexport interface BaselineFeature {\n id: string;\n required: boolean;\n supported: boolean;\n}\n\n/** Required in 5.0: Custom Elements, WAAPI, IntersectionObserver, ResizeObserver, adoptedStyleSheets. Progressive: View Transitions, scroll-driven animations, WebGL. */\nexport function baselineReport(): BaselineFeature[] {\n const w = (typeof window !== 'undefined' ? window : {}) as any;\n const d = (typeof document !== 'undefined' ? document : {}) as any;\n const css = (q: string) => typeof w.CSS?.supports === 'function' && w.CSS.supports(q);\n return [\n { id: 'custom-elements', required: true, supported: !!w.customElements },\n { id: 'web-animations', required: true, supported: typeof w.Element?.prototype?.animate === 'function' },\n { id: 'intersection-observer', required: true, supported: typeof w.IntersectionObserver === 'function' },\n { id: 'resize-observer', required: true, supported: typeof w.ResizeObserver === 'function' },\n { id: 'adopted-stylesheets', required: true, supported: 'adoptedStyleSheets' in d },\n { id: 'view-transitions', required: false, supported: typeof d.startViewTransition === 'function' },\n { id: 'scroll-driven-animations', required: false, supported: css('animation-timeline: view()') },\n { id: 'webgl', required: false, supported: !!(d.createElement && (() => { try { return d.createElement('canvas').getContext('webgl'); } catch { return null; } })()) },\n ];\n}\n\n/** Log (once) which required 5.0 features are missing here. Returns the missing ids. */\nexport function warnBaseline(): string[] {\n const missing = baselineReport().filter((f) => f.required && !f.supported).map((f) => f.id);\n if (missing.length) deprecate('baseline', `this browser lacks ${missing.join(', ')}; motionary 5.0 requires them (modern-browser baseline, see docs/upgrading-5.md).`);\n return missing;\n}\n","/**\n * motionary/components/a11y — accessibility toolkit (4.4).\n *\n * - Motion-sensitivity levels: `setMotionSensitivity('full' | 'gentle' | 'minimal' | 'static')`.\n * - Static alternatives: what every component shows when motion is off, and\n * `staticAlternative(root)` to freeze any subtree at its final state.\n * - `aria-live` conventions: one shared polite and one assertive region,\n * `announce(message, { politeness })`.\n * - `auditMotionA11y(root)`: the rules the automated regression tests run\n * over every `<usa-*>` element — usable in your own tests too.\n *\n * ```ts\n * import { setMotionSensitivity, announce, auditMotionA11y } from 'motionary/components/a11y';\n * setMotionSensitivity('gentle', true); // no spins / zooms / parallax, remembered\n * announce('3 items added to cart'); // polite live region\n * expect(auditMotionA11y(document.body).errors).toEqual([]);\n * ```\n */\nimport {\n configureComponents,\n getMotionSensitivity,\n adaptKeyframes,\n adoptStyles,\n MOTION_SENSITIVITY_LEVELS,\n type MotionSensitivity,\n} from '../base';\nimport { COMPONENT_CATEGORIES, type ComponentCategory } from '../index-tags';\n\nexport { getMotionSensitivity, adaptKeyframes, MOTION_SENSITIVITY_LEVELS };\nexport { baselineReport, warnBaseline } from './baseline';\nexport type { BaselineFeature } from './baseline';\nexport type { MotionSensitivity };\n\nconst KEY = 'usa:sensitivity';\n\n/** What each level allows, for docs and settings UIs. */\nexport const MOTION_SENSITIVITY: Record<MotionSensitivity, { en: string; zh: string; allows: string[] }> = {\n full: { en: 'All motion', zh: '全部动效', allows: ['fade', 'translate', 'scale', 'rotate', 'parallax', 'loop', 'flash'] },\n gentle: { en: 'Gentle — no spins, zooms or parallax', zh: '温和 —— 无旋转、缩放与视差', allows: ['fade', 'translate', 'loop'] },\n minimal: { en: 'Minimal — fades only', zh: '最少 —— 仅淡入淡出', allows: ['fade'] },\n static: { en: 'Static — no animation', zh: '静态 —— 无动画', allows: [] },\n};\n\n/** CSS applied at the `static` / `minimal` / `gentle` levels (also stops your own CSS animations under `static`). */\nexport const SENSITIVITY_CSS =\n 'html[data-usa-sensitivity=\"static\"] *,html[data-usa-sensitivity=\"static\"] *::before,html[data-usa-sensitivity=\"static\"] *::after{animation:none!important;transition:none!important;scroll-behavior:auto!important}' +\n 'html[data-usa-sensitivity=\"minimal\"] *,html[data-usa-sensitivity=\"minimal\"] *::before,html[data-usa-sensitivity=\"minimal\"] *::after{animation-duration:1ms!important;animation-iteration-count:1!important;scroll-behavior:auto!important}' +\n 'html[data-usa-sensitivity=\"gentle\"]{--usa-parallax:0;--usa-tilt:0}';\n\n/**\n * Set the motion-sensitivity level for every `<usa-*>` component and the page:\n * sets `data-usa-sensitivity` on `<html>`, adapts component keyframes, and\n * with `persist` remembers the choice (`restoreMotionSensitivity()`).\n * Dispatches `usa:sensitivity` on `document`.\n */\nexport function setMotionSensitivity(level: MotionSensitivity, persist = false): void {\n if (!MOTION_SENSITIVITY_LEVELS.includes(level)) return;\n configureComponents({ motionSensitivity: level });\n adoptStyles('a11y-sensitivity', SENSITIVITY_CSS);\n if (persist) {\n try {\n localStorage.setItem(KEY, level);\n } catch {\n /* private mode */\n }\n }\n if (level === 'static' && typeof document !== 'undefined') staticAlternative(document.documentElement);\n if (typeof document !== 'undefined') document.dispatchEvent(new CustomEvent('usa:sensitivity', { detail: { level } }));\n}\n\n/** Re-apply a persisted level (call early on page load). Returns the active level. */\nexport function restoreMotionSensitivity(): MotionSensitivity {\n try {\n const v = localStorage.getItem(KEY) as MotionSensitivity | null;\n if (v && MOTION_SENSITIVITY_LEVELS.includes(v)) setMotionSensitivity(v);\n } catch {\n /* ignore */\n }\n return getMotionSensitivity();\n}\n\n/** `true` when the current level allows a kind of motion (`'rotate'`, `'parallax'`, `'loop'`…). */\nexport function motionAllowed(kind: string, level: MotionSensitivity = getMotionSensitivity()): boolean {\n return MOTION_SENSITIVITY[level].allows.includes(kind);\n}\n\n/** The static alternative of each category: what its elements show without motion. */\nexport const STATIC_ALTERNATIVES: Record<ComponentCategory, string> = {\n reveal: 'Content visible in place; progress bars show the current value.',\n text: 'Full final text (screen readers always get a plain copy).',\n interaction: 'Normal hover / focus styles; no tilt, magnet or ripple.',\n feedback: 'Spinners become a static busy indicator; progress shows its value; toasts appear without sliding.',\n background: 'A still frame of the background (gradient / pattern); particles and marquees stop.',\n transitions: 'Dialogs, accordions and views switch instantly.',\n physics: 'Values jump to their target; drag still works, without inertia.',\n cards: 'Cards are shown flat and fully readable; stacks become lists.',\n click: 'Clicks work and states are announced; no bursts, confetti or deformation.',\n ui: 'Tabs, drawers, sheets and popovers open instantly with focus management intact.',\n page: 'Page transitions are instant; cursors and ambient layers are hidden.',\n timeline: 'Every step is shown at its final state.',\n gesture: 'Buttons / keys provide the same actions as swipes and pinches.',\n svg: 'Drawings and icons are shown complete.',\n webgl: 'A static poster image or CSS gradient instead of the shader.',\n depth: 'Flat, front-facing layout.',\n layout: 'Items reflow instantly.',\n packs: 'Roles are styled but not animated.',\n fx: 'Effects are skipped or reduced to a short fade; the content is unchanged.',\n};\n\n/**\n * Freeze a subtree at its static alternative: finishes running animations\n * (`finish()`, so content lands on its final state), marks the root with\n * `data-usa-static` and returns an undo that removes the mark.\n */\nexport function staticAlternative(root: Element): () => void {\n const getAll = (root as any).getAnimations as undefined | ((o: { subtree: boolean }) => Animation[]);\n if (typeof getAll === 'function') {\n for (const a of getAll.call(root, { subtree: true })) {\n try {\n const it = a.effect?.getComputedTiming().iterations;\n if (it === Infinity) a.cancel();\n else a.finish();\n } catch {\n /* finished already */\n }\n }\n }\n root.setAttribute('data-usa-static', '');\n return () => root.removeAttribute('data-usa-static');\n}\n\n// --- aria-live conventions ---------------------------------------------------\n\nexport type Politeness = 'polite' | 'assertive';\n/** The ids of the shared live regions. */\nexport const LIVE_REGION_IDS: Record<Politeness, string> = { polite: 'usa-live-polite', assertive: 'usa-live-assertive' };\n\n/** The shared live region (created once, visually hidden, `role=\"status\"` / `role=\"alert\"`). */\nexport function liveRegion(politeness: Politeness = 'polite'): HTMLElement | null {\n if (typeof document === 'undefined' || !document.body) return null;\n const id = LIVE_REGION_IDS[politeness];\n let el = document.getElementById(id);\n if (!el) {\n el = document.createElement('div');\n el.id = id;\n el.className = 'usa-sr';\n el.setAttribute('role', politeness === 'assertive' ? 'alert' : 'status');\n el.setAttribute('aria-live', politeness);\n el.setAttribute('aria-atomic', 'true');\n document.body.appendChild(el);\n }\n return el;\n}\n\nlet lastMsg = '';\nlet lastAt = 0;\n/**\n * Announce a message through the shared live region. Conventions: `polite`\n * for results of the user's own actions (added, saved, copied), `assertive`\n * only for errors that block them. Identical messages within `dedupe` ms\n * (default 500) are dropped; the region is cleared first so repeats are read.\n */\nexport function announce(message: string, options: { politeness?: Politeness; dedupe?: number } = {}): boolean {\n const { politeness = 'polite', dedupe = 500 } = options;\n const t = Date.now();\n if (!message || (message === lastMsg && t - lastAt < dedupe)) return false;\n lastMsg = message;\n lastAt = t;\n const el = liveRegion(politeness);\n if (!el) return false;\n el.textContent = '';\n el.textContent = message;\n return true;\n}\n\n// --- audit ---------------------------------------------------------------------\n\nexport interface A11yIssue {\n rule: string;\n level: 'error' | 'warning';\n element: Element;\n message: string;\n}\n\nconst FOCUSABLE = 'a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex=\"-1\"])';\nconst NAMED_ROLES = ['button', 'switch', 'checkbox', 'slider', 'tab', 'progressbar', 'radiogroup', 'dialog'];\n\nfunction accessibleName(el: Element): string {\n const label = el.getAttribute('aria-label');\n if (label) return label;\n const by = el.getAttribute('aria-labelledby');\n if (by) return by.split(/\\s+/).map((id) => el.ownerDocument.getElementById(id)?.textContent || '').join(' ').trim();\n return (el.textContent || el.getAttribute('title') || '').trim();\n}\n\n/**\n * Check a subtree against the library's motion-a11y rules:\n * - `aria-hidden-focusable` (error): focusable content inside `aria-hidden`.\n * - `role-name` (error): a widget role without an accessible name.\n * - `range-value` (error): a slider / determinate progressbar without `aria-valuenow`.\n * - `img-alt` (error): an `<img>` without `alt`.\n * - `assertive-live` (warning): `aria-live=\"assertive\"` outside `role=\"alert\"`.\n * - `infinite-no-control` (warning, WCAG 2.2.2): an endless animation on a\n * page with no way to pause motion (`<usa-motion-switch>` or `[data-usa-pause]`).\n */\nexport function auditMotionA11y(root: Element | Document): { errors: A11yIssue[]; warnings: A11yIssue[] } {\n const issues: A11yIssue[] = [];\n const add = (rule: string, level: A11yIssue['level'], element: Element, message: string) => issues.push({ rule, level, element, message });\n const scope = root as ParentNode;\n scope.querySelectorAll('[aria-hidden=\"true\"]').forEach((h) => {\n const f = (h.matches(FOCUSABLE) ? [h] : Array.from(h.querySelectorAll(FOCUSABLE))).filter((x) => !x.closest('[inert]'));\n f.forEach((x) => add('aria-hidden-focusable', 'error', x, `focusable <${x.tagName.toLowerCase()}> inside aria-hidden`));\n });\n scope.querySelectorAll('[role]').forEach((el) => {\n const role = el.getAttribute('role')!;\n if (NAMED_ROLES.includes(role) && !accessibleName(el)) add('role-name', 'error', el, `role=\"${role}\" has no accessible name`);\n if (role === 'slider' && !el.hasAttribute('aria-valuenow'))\n add('range-value', 'error', el, 'slider without aria-valuenow');\n });\n scope.querySelectorAll('img:not([alt])').forEach((el) => add('img-alt', 'error', el, '<img> without alt'));\n scope.querySelectorAll('[aria-live=\"assertive\"]').forEach((el) => {\n if (el.getAttribute('role') !== 'alert') add('assertive-live', 'warning', el, 'assertive live region outside role=\"alert\"');\n });\n const doc = (root as Node).ownerDocument || (root as Document);\n const anims = typeof (root as any).getAnimations === 'function' ? ((root as any).getAnimations({ subtree: true }) as Animation[]) : [];\n const control = doc && (doc.querySelector('usa-motion-switch, [data-usa-pause]') || doc.documentElement.hasAttribute('data-usa-sensitivity'));\n if (!control)\n anims.forEach((a) => {\n try {\n if (a.effect?.getComputedTiming().iterations === Infinity) {\n const t = (a.effect as KeyframeEffect).target;\n if (t) add('infinite-no-control', 'warning', t, 'endless animation and no motion control on the page');\n }\n } catch {\n /* ignore */\n }\n });\n return { errors: issues.filter((i) => i.level === 'error'), warnings: issues.filter((i) => i.level === 'warning') };\n}\n\n/** Every `<usa-*>` tag, for sweeping audits. */\nexport const ALL_TAGS: string[] = (Object.values(COMPONENT_CATEGORIES) as readonly (readonly string[])[]).flat();\n"],"names":["deprecate","MOTION_SENSITIVITY_LEVELS","configureComponents","adoptStyles","getMotionSensitivity","COMPONENT_CATEGORIES"],"mappings":";;;;;AAAA;;;;AAIG;AASH;SACgB,cAAc,GAAA;AAC5B,IAAA,MAAM,CAAC,IAAI,OAAO,MAAM,KAAK,WAAW,GAAG,MAAM,GAAG,EAAE,CAAQ;AAC9D,IAAA,MAAM,CAAC,IAAI,OAAO,QAAQ,KAAK,WAAW,GAAG,QAAQ,GAAG,EAAE,CAAQ;IAClE,MAAM,GAAG,GAAG,CAAC,CAAS,KAAK,OAAO,CAAC,CAAC,GAAG,EAAE,QAAQ,KAAK,UAAU,IAAI,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC;IACrF,OAAO;AACL,QAAA,EAAE,EAAE,EAAE,iBAAiB,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC,cAAc,EAAE;QACxE,EAAE,EAAE,EAAE,gBAAgB,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC,OAAO,EAAE,SAAS,EAAE,OAAO,KAAK,UAAU,EAAE;AACxG,QAAA,EAAE,EAAE,EAAE,uBAAuB,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC,oBAAoB,KAAK,UAAU,EAAE;AACxG,QAAA,EAAE,EAAE,EAAE,iBAAiB,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC,cAAc,KAAK,UAAU,EAAE;AAC5F,QAAA,EAAE,EAAE,EAAE,qBAAqB,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EA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C,CAAC,MAAyB,CAAC,MAAM;AAC7C,oBAAA,IAAI,CAAC;wBAAE,GAAG,CAAC,qBAAqB,EAAE,SAAS,EAAE,CAAC,EAAE,qDAAqD,CAAC;gBACxG;YACF;AAAE,YAAA,MAAM;;YAER;AACF,QAAA,CAAC,CAAC;AACJ,IAAA,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,KAAK,OAAO,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,KAAK,SAAS,CAAC,EAAE;AACrH;AAEA;AACO,MAAM,QAAQ,GAAc,MAAM,CAAC,MAAM,CAACC,8BAAoB,CAAoC,CAAC,IAAI;;;;;;;;;;;;;;;;;;"}
|
package/dist/components/a11y.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { B as deprecate, g as getMotionSensitivity, M as MOTION_SENSITIVITY_LEVELS, c as configureComponents, C as adoptStyles } from '../chunks/base-BTev8qxg.js';
|
|
2
|
+
export { l as adaptKeyframes } from '../chunks/base-BTev8qxg.js';
|
|
3
3
|
import { C as COMPONENT_CATEGORIES } from '../chunks/index-tags-B-JBecYg.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"a11y.js","sources":["../../src/components/a11y/baseline.ts","../../src/components/a11y/index.ts"],"sourcesContent":["/**\n * 4.9 — the 5.0 modern-browser baseline. `baselineReport()` lists which\n * required / progressive features this browser has; `warnBaseline()` logs\n * once in development when a required one is missing.\n */\nimport { deprecate } from '../base';\n\nexport interface BaselineFeature {\n id: string;\n required: boolean;\n supported: boolean;\n}\n\n/** Required in 5.0: Custom Elements, WAAPI, IntersectionObserver, ResizeObserver, adoptedStyleSheets. Progressive: View Transitions, scroll-driven animations, WebGL. */\nexport function baselineReport(): BaselineFeature[] {\n const w = (typeof window !== 'undefined' ? window : {}) as any;\n const d = (typeof document !== 'undefined' ? document : {}) as any;\n const css = (q: string) => typeof w.CSS?.supports === 'function' && w.CSS.supports(q);\n return [\n { id: 'custom-elements', required: true, supported: !!w.customElements },\n { id: 'web-animations', required: true, supported: typeof w.Element?.prototype?.animate === 'function' },\n { id: 'intersection-observer', required: true, supported: typeof w.IntersectionObserver === 'function' },\n { id: 'resize-observer', required: true, supported: typeof w.ResizeObserver === 'function' },\n { id: 'adopted-stylesheets', required: true, supported: 'adoptedStyleSheets' in d },\n { id: 'view-transitions', required: false, supported: typeof d.startViewTransition === 'function' },\n { id: 'scroll-driven-animations', required: false, supported: css('animation-timeline: view()') },\n { id: 'webgl', required: false, supported: !!(d.createElement && (() => { try { return d.createElement('canvas').getContext('webgl'); } catch { return null; } })()) },\n ];\n}\n\n/** Log (once) which required 5.0 features are missing here. Returns the missing ids. */\nexport function warnBaseline(): string[] {\n const missing = baselineReport().filter((f) => f.required && !f.supported).map((f) => f.id);\n if (missing.length) deprecate('baseline', `this browser lacks ${missing.join(', ')}; motionary 5.0 requires them (modern-browser baseline, see docs/upgrading-5.md).`);\n return missing;\n}\n","/**\n * motionary/components/a11y — accessibility toolkit (4.4).\n *\n * - Motion-sensitivity levels: `setMotionSensitivity('full' | 'gentle' | 'minimal' | 'static')`.\n * - Static alternatives: what every component shows when motion is off, and\n * `staticAlternative(root)` to freeze any subtree at its final state.\n * - `aria-live` conventions: one shared polite and one assertive region,\n * `announce(message, { politeness })`.\n * - `auditMotionA11y(root)`: the rules the automated regression tests run\n * over every `<usa-*>` element — usable in your own tests too.\n *\n * ```ts\n * import { setMotionSensitivity, announce, auditMotionA11y } from 'motionary/components/a11y';\n * setMotionSensitivity('gentle', true); // no spins / zooms / parallax, remembered\n * announce('3 items added to cart'); // polite live region\n * expect(auditMotionA11y(document.body).errors).toEqual([]);\n * ```\n */\nimport {\n configureComponents,\n getMotionSensitivity,\n adaptKeyframes,\n adoptStyles,\n MOTION_SENSITIVITY_LEVELS,\n type MotionSensitivity,\n} from '../base';\nimport { COMPONENT_CATEGORIES, type ComponentCategory } from '../index-tags';\n\nexport { getMotionSensitivity, adaptKeyframes, MOTION_SENSITIVITY_LEVELS };\nexport { baselineReport, warnBaseline } from './baseline';\nexport type { BaselineFeature } from './baseline';\nexport type { MotionSensitivity };\n\nconst KEY = 'usa:sensitivity';\n\n/** What each level allows, for docs and settings UIs. */\nexport const MOTION_SENSITIVITY: Record<MotionSensitivity, { en: string; zh: string; allows: string[] }> = {\n full: { en: 'All motion', zh: '全部动效', allows: ['fade', 'translate', 'scale', 'rotate', 'parallax', 'loop', 'flash'] },\n gentle: { en: 'Gentle — no spins, zooms or parallax', zh: '温和 —— 无旋转、缩放与视差', allows: ['fade', 'translate', 'loop'] },\n minimal: { en: 'Minimal — fades only', zh: '最少 —— 仅淡入淡出', allows: ['fade'] },\n static: { en: 'Static — no animation', zh: '静态 —— 无动画', allows: [] },\n};\n\n/** CSS applied at the `static` / `minimal` / `gentle` levels (also stops your own CSS animations under `static`). */\nexport const SENSITIVITY_CSS =\n 'html[data-usa-sensitivity=\"static\"] *,html[data-usa-sensitivity=\"static\"] *::before,html[data-usa-sensitivity=\"static\"] *::after{animation:none!important;transition:none!important;scroll-behavior:auto!important}' +\n 'html[data-usa-sensitivity=\"minimal\"] *,html[data-usa-sensitivity=\"minimal\"] *::before,html[data-usa-sensitivity=\"minimal\"] *::after{animation-duration:1ms!important;animation-iteration-count:1!important;scroll-behavior:auto!important}' +\n 'html[data-usa-sensitivity=\"gentle\"]{--usa-parallax:0;--usa-tilt:0}';\n\n/**\n * Set the motion-sensitivity level for every `<usa-*>` component and the page:\n * sets `data-usa-sensitivity` on `<html>`, adapts component keyframes, and\n * with `persist` remembers the choice (`restoreMotionSensitivity()`).\n * Dispatches `usa:sensitivity` on `document`.\n */\nexport function setMotionSensitivity(level: MotionSensitivity, persist = false): void {\n if (!MOTION_SENSITIVITY_LEVELS.includes(level)) return;\n configureComponents({ motionSensitivity: level });\n adoptStyles('a11y-sensitivity', SENSITIVITY_CSS);\n if (persist) {\n try {\n localStorage.setItem(KEY, level);\n } catch {\n /* private mode */\n }\n }\n if (level === 'static' && typeof document !== 'undefined') staticAlternative(document.documentElement);\n if (typeof document !== 'undefined') document.dispatchEvent(new CustomEvent('usa:sensitivity', { detail: { level } }));\n}\n\n/** Re-apply a persisted level (call early on page load). Returns the active level. */\nexport function restoreMotionSensitivity(): MotionSensitivity {\n try {\n const v = localStorage.getItem(KEY) as MotionSensitivity | null;\n if (v && MOTION_SENSITIVITY_LEVELS.includes(v)) setMotionSensitivity(v);\n } catch {\n /* ignore */\n }\n return getMotionSensitivity();\n}\n\n/** `true` when the current level allows a kind of motion (`'rotate'`, `'parallax'`, `'loop'`…). */\nexport function motionAllowed(kind: string, level: MotionSensitivity = getMotionSensitivity()): boolean {\n return MOTION_SENSITIVITY[level].allows.includes(kind);\n}\n\n/** The static alternative of each category: what its elements show without motion. */\nexport const STATIC_ALTERNATIVES: Record<ComponentCategory, string> = {\n reveal: 'Content visible in place; progress bars show the current value.',\n text: 'Full final text (screen readers always get a plain copy).',\n interaction: 'Normal hover / focus styles; no tilt, magnet or ripple.',\n feedback: 'Spinners become a static busy indicator; progress shows its value; toasts appear without sliding.',\n background: 'A still frame of the background (gradient / pattern); particles and marquees stop.',\n transitions: 'Dialogs, accordions and views switch instantly.',\n physics: 'Values jump to their target; drag still works, without inertia.',\n cards: 'Cards are shown flat and fully readable; stacks become lists.',\n click: 'Clicks work and states are announced; no bursts, confetti or deformation.',\n ui: 'Tabs, drawers, sheets and popovers open instantly with focus management intact.',\n page: 'Page transitions are instant; cursors and ambient layers are hidden.',\n timeline: 'Every step is shown at its final state.',\n gesture: 'Buttons / keys provide the same actions as swipes and pinches.',\n svg: 'Drawings and icons are shown complete.',\n webgl: 'A static poster image or CSS gradient instead of the shader.',\n depth: 'Flat, front-facing layout.',\n layout: 'Items reflow instantly.',\n packs: 'Roles are styled but not animated.',\n fx: 'Effects are skipped or reduced to a short fade; the content is unchanged.',\n};\n\n/**\n * Freeze a subtree at its static alternative: finishes running animations\n * (`finish()`, so content lands on its final state), marks the root with\n * `data-usa-static` and returns an undo that removes the mark.\n */\nexport function staticAlternative(root: Element): () => void {\n const getAll = (root as any).getAnimations as undefined | ((o: { subtree: boolean }) => Animation[]);\n if (typeof getAll === 'function') {\n for (const a of getAll.call(root, { subtree: true })) {\n try {\n const it = a.effect?.getComputedTiming().iterations;\n if (it === Infinity) a.cancel();\n else a.finish();\n } catch {\n /* finished already */\n }\n }\n }\n root.setAttribute('data-usa-static', '');\n return () => root.removeAttribute('data-usa-static');\n}\n\n// --- aria-live conventions ---------------------------------------------------\n\nexport type Politeness = 'polite' | 'assertive';\n/** The ids of the shared live regions. */\nexport const LIVE_REGION_IDS: Record<Politeness, string> = { polite: 'usa-live-polite', assertive: 'usa-live-assertive' };\n\n/** The shared live region (created once, visually hidden, `role=\"status\"` / `role=\"alert\"`). */\nexport function liveRegion(politeness: Politeness = 'polite'): HTMLElement | null {\n if (typeof document === 'undefined' || !document.body) return null;\n const id = LIVE_REGION_IDS[politeness];\n let el = document.getElementById(id);\n if (!el) {\n el = document.createElement('div');\n el.id = id;\n el.className = 'usa-sr';\n el.setAttribute('role', politeness === 'assertive' ? 'alert' : 'status');\n el.setAttribute('aria-live', politeness);\n el.setAttribute('aria-atomic', 'true');\n document.body.appendChild(el);\n }\n return el;\n}\n\nlet lastMsg = '';\nlet lastAt = 0;\n/**\n * Announce a message through the shared live region. Conventions: `polite`\n * for results of the user's own actions (added, saved, copied), `assertive`\n * only for errors that block them. Identical messages within `dedupe` ms\n * (default 500) are dropped; the region is cleared first so repeats are read.\n */\nexport function announce(message: string, options: { politeness?: Politeness; dedupe?: number } = {}): boolean {\n const { politeness = 'polite', dedupe = 500 } = options;\n const t = Date.now();\n if (!message || (message === lastMsg && t - lastAt < dedupe)) return false;\n lastMsg = message;\n lastAt = t;\n const el = liveRegion(politeness);\n if (!el) return false;\n el.textContent = '';\n el.textContent = message;\n return true;\n}\n\n// --- audit ---------------------------------------------------------------------\n\nexport interface A11yIssue {\n rule: string;\n level: 'error' | 'warning';\n element: Element;\n message: string;\n}\n\nconst FOCUSABLE = 'a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex=\"-1\"])';\nconst NAMED_ROLES = ['button', 'switch', 'checkbox', 'slider', 'tab', 'progressbar', 'radiogroup', 'dialog'];\n\nfunction accessibleName(el: Element): string {\n const label = el.getAttribute('aria-label');\n if (label) return label;\n const by = el.getAttribute('aria-labelledby');\n if (by) return by.split(/\\s+/).map((id) => el.ownerDocument.getElementById(id)?.textContent || '').join(' ').trim();\n return (el.textContent || el.getAttribute('title') || '').trim();\n}\n\n/**\n * Check a subtree against the library's motion-a11y rules:\n * - `aria-hidden-focusable` (error): focusable content inside `aria-hidden`.\n * - `role-name` (error): a widget role without an accessible name.\n * - `range-value` (error): a slider / determinate progressbar without `aria-valuenow`.\n * - `img-alt` (error): an `<img>` without `alt`.\n * - `assertive-live` (warning): `aria-live=\"assertive\"` outside `role=\"alert\"`.\n * - `infinite-no-control` (warning, WCAG 2.2.2): an endless animation on a\n * page with no way to pause motion (`<usa-motion-switch>` or `[data-usa-pause]`).\n */\nexport function auditMotionA11y(root: Element | Document): { errors: A11yIssue[]; warnings: A11yIssue[] } {\n const issues: A11yIssue[] = [];\n const add = (rule: string, level: A11yIssue['level'], element: Element, message: string) => issues.push({ rule, level, element, message });\n const scope = root as ParentNode;\n scope.querySelectorAll('[aria-hidden=\"true\"]').forEach((h) => {\n const f = (h.matches(FOCUSABLE) ? [h] : Array.from(h.querySelectorAll(FOCUSABLE))).filter((x) => !x.closest('[inert]'));\n f.forEach((x) => add('aria-hidden-focusable', 'error', x, `focusable <${x.tagName.toLowerCase()}> inside aria-hidden`));\n });\n scope.querySelectorAll('[role]').forEach((el) => {\n const role = el.getAttribute('role')!;\n if (NAMED_ROLES.includes(role) && !accessibleName(el)) add('role-name', 'error', el, `role=\"${role}\" has no accessible name`);\n if (role === 'slider' && !el.hasAttribute('aria-valuenow'))\n add('range-value', 'error', el, 'slider without aria-valuenow');\n });\n scope.querySelectorAll('img:not([alt])').forEach((el) => add('img-alt', 'error', el, '<img> without alt'));\n scope.querySelectorAll('[aria-live=\"assertive\"]').forEach((el) => {\n if (el.getAttribute('role') !== 'alert') add('assertive-live', 'warning', el, 'assertive live region outside role=\"alert\"');\n });\n const doc = (root as Node).ownerDocument || (root as Document);\n const anims = typeof (root as any).getAnimations === 'function' ? ((root as any).getAnimations({ subtree: true }) as Animation[]) : [];\n const control = doc && (doc.querySelector('usa-motion-switch, [data-usa-pause]') || doc.documentElement.hasAttribute('data-usa-sensitivity'));\n if (!control)\n anims.forEach((a) => {\n try {\n if (a.effect?.getComputedTiming().iterations === Infinity) {\n const t = (a.effect as KeyframeEffect).target;\n if (t) add('infinite-no-control', 'warning', t, 'endless animation and no motion control on the page');\n }\n } catch {\n /* ignore */\n }\n });\n return { errors: issues.filter((i) => i.level === 'error'), warnings: issues.filter((i) => i.level === 'warning') };\n}\n\n/** Every `<usa-*>` tag, for sweeping audits. */\nexport const ALL_TAGS: string[] = (Object.values(COMPONENT_CATEGORIES) as readonly (readonly string[])[]).flat();\n"],"names":[],"mappings":";;;;AAAA;;;;AAIG;AASH;SACgB,cAAc,GAAA;AAC5B,IAAA,MAAM,CAAC,IAAI,OAAO,MAAM,KAAK,WAAW,GAAG,MAAM,GAAG,EAAE,CAAQ;AAC9D,IAAA,MAAM,CAAC,IAAI,OAAO,QAAQ,KAAK,WAAW,GAAG,QAAQ,GAAG,EAAE,CAAQ;IAClE,MAAM,GAAG,GAAG,CAAC,CAAS,KAAK,OAAO,CAAC,CAAC,GAAG,EAAE,QAAQ,KAAK,UAAU,IAAI,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC;IACrF,OAAO;AACL,QAAA,EAAE,EAAE,EAAE,iBAAiB,EAAE,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,GAAI,IAAa,CAAC,aAAa,IAAK,IAAiB;IAC9D,MAAM,KAAK,GAAG,OAAQ,IAAY,CAAC,aAAa,KAAK,UAAU,GAAK,IAAY,CAAC,aAAa,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAiB,GAAG,EAAE;IACtI,MAAM,OAAO,GAAG,GAAG,KAAK,GAAG,CAAC,aAAa,CAAC,qCAAqC,CAAC,IAAI,GAAG,CAAC,eAAe,CAAC,YAAY,CAAC,sBAAsB,CAAC,CAAC;AAC7I,IAAA,IAAI,CAAC,OAAO;AACV,QAAA,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAI;AAClB,YAAA,IAAI;gBACF,IAAI,CAAC,CAAC,MAAM,EAAE,iBAAiB,EAAE,CAAC,UAAU,KAAK,QAAQ,EAAE;AACzD,oBAAA,MAAM,CAAC,GAAI,CAAC,CAAC,MAAyB,CAAC,MAAM;AAC7C,oBAAA,IAAI,CAAC;wBAAE,GAAG,CAAC,qBAAqB,EAAE,SAAS,EAAE,CAAC,EAAE,qDAAqD,CAAC;gBACxG;YACF;AAAE,YAAA,MAAM;;YAER;AACF,QAAA,CAAC,CAAC;AACJ,IAAA,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,KAAK,OAAO,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,KAAK,SAAS,CAAC,EAAE;AACrH;AAEA;AACO,MAAM,QAAQ,GAAc,MAAM,CAAC,MAAM,CAAC,oBAAoB,CAAoC,CAAC,IAAI;;;;"}
|
|
1
|
+
{"version":3,"file":"a11y.js","sources":["../../src/components/a11y/baseline.ts","../../src/components/a11y/index.ts"],"sourcesContent":["/**\n * 4.9 — the 5.0 modern-browser baseline. `baselineReport()` lists which\n * required / progressive features this browser has; `warnBaseline()` logs\n * once in development when a required one is missing.\n */\nimport { deprecate } from '../base';\n\nexport interface BaselineFeature {\n id: string;\n required: boolean;\n supported: boolean;\n}\n\n/** Required in 5.0: Custom Elements, WAAPI, IntersectionObserver, ResizeObserver, adoptedStyleSheets. Progressive: View Transitions, scroll-driven animations, WebGL. */\nexport function baselineReport(): BaselineFeature[] {\n const w = (typeof window !== 'undefined' ? window : {}) as any;\n const d = (typeof document !== 'undefined' ? document : {}) as any;\n const css = (q: string) => typeof w.CSS?.supports === 'function' && w.CSS.supports(q);\n return [\n { id: 'custom-elements', required: true, supported: !!w.customElements },\n { id: 'web-animations', required: true, supported: typeof w.Element?.prototype?.animate === 'function' },\n { id: 'intersection-observer', required: true, supported: typeof w.IntersectionObserver === 'function' },\n { id: 'resize-observer', required: true, supported: typeof w.ResizeObserver === 'function' },\n { id: 'adopted-stylesheets', required: true, supported: 'adoptedStyleSheets' in d },\n { id: 'view-transitions', required: false, supported: typeof d.startViewTransition === 'function' },\n { id: 'scroll-driven-animations', required: false, supported: css('animation-timeline: view()') },\n { id: 'webgl', required: false, supported: !!(d.createElement && (() => { try { return d.createElement('canvas').getContext('webgl'); } catch { return null; } })()) },\n ];\n}\n\n/** Log (once) which required 5.0 features are missing here. Returns the missing ids. */\nexport function warnBaseline(): string[] {\n const missing = baselineReport().filter((f) => f.required && !f.supported).map((f) => f.id);\n if (missing.length) deprecate('baseline', `this browser lacks ${missing.join(', ')}; motionary 5.0 requires them (modern-browser baseline, see docs/upgrading-5.md).`);\n return missing;\n}\n","/**\n * motionary/components/a11y — accessibility toolkit (4.4).\n *\n * - Motion-sensitivity levels: `setMotionSensitivity('full' | 'gentle' | 'minimal' | 'static')`.\n * - Static alternatives: what every component shows when motion is off, and\n * `staticAlternative(root)` to freeze any subtree at its final state.\n * - `aria-live` conventions: one shared polite and one assertive region,\n * `announce(message, { politeness })`.\n * - `auditMotionA11y(root)`: the rules the automated regression tests run\n * over every `<usa-*>` element — usable in your own tests too.\n *\n * ```ts\n * import { setMotionSensitivity, announce, auditMotionA11y } from 'motionary/components/a11y';\n * setMotionSensitivity('gentle', true); // no spins / zooms / parallax, remembered\n * announce('3 items added to cart'); // polite live region\n * expect(auditMotionA11y(document.body).errors).toEqual([]);\n * ```\n */\nimport {\n configureComponents,\n getMotionSensitivity,\n adaptKeyframes,\n adoptStyles,\n MOTION_SENSITIVITY_LEVELS,\n type MotionSensitivity,\n} from '../base';\nimport { COMPONENT_CATEGORIES, type ComponentCategory } from '../index-tags';\n\nexport { getMotionSensitivity, adaptKeyframes, MOTION_SENSITIVITY_LEVELS };\nexport { baselineReport, warnBaseline } from './baseline';\nexport type { BaselineFeature } from './baseline';\nexport type { MotionSensitivity };\n\nconst KEY = 'usa:sensitivity';\n\n/** What each level allows, for docs and settings UIs. */\nexport const MOTION_SENSITIVITY: Record<MotionSensitivity, { en: string; zh: string; allows: string[] }> = {\n full: { en: 'All motion', zh: '全部动效', allows: ['fade', 'translate', 'scale', 'rotate', 'parallax', 'loop', 'flash'] },\n gentle: { en: 'Gentle — no spins, zooms or parallax', zh: '温和 —— 无旋转、缩放与视差', allows: ['fade', 'translate', 'loop'] },\n minimal: { en: 'Minimal — fades only', zh: '最少 —— 仅淡入淡出', allows: ['fade'] },\n static: { en: 'Static — no animation', zh: '静态 —— 无动画', allows: [] },\n};\n\n/** CSS applied at the `static` / `minimal` / `gentle` levels (also stops your own CSS animations under `static`). */\nexport const SENSITIVITY_CSS =\n 'html[data-usa-sensitivity=\"static\"] *,html[data-usa-sensitivity=\"static\"] *::before,html[data-usa-sensitivity=\"static\"] *::after{animation:none!important;transition:none!important;scroll-behavior:auto!important}' +\n 'html[data-usa-sensitivity=\"minimal\"] *,html[data-usa-sensitivity=\"minimal\"] *::before,html[data-usa-sensitivity=\"minimal\"] *::after{animation-duration:1ms!important;animation-iteration-count:1!important;scroll-behavior:auto!important}' +\n 'html[data-usa-sensitivity=\"gentle\"]{--usa-parallax:0;--usa-tilt:0}';\n\n/**\n * Set the motion-sensitivity level for every `<usa-*>` component and the page:\n * sets `data-usa-sensitivity` on `<html>`, adapts component keyframes, and\n * with `persist` remembers the choice (`restoreMotionSensitivity()`).\n * Dispatches `usa:sensitivity` on `document`.\n */\nexport function setMotionSensitivity(level: MotionSensitivity, persist = false): void {\n if (!MOTION_SENSITIVITY_LEVELS.includes(level)) return;\n configureComponents({ motionSensitivity: level });\n adoptStyles('a11y-sensitivity', SENSITIVITY_CSS);\n if (persist) {\n try {\n localStorage.setItem(KEY, level);\n } catch {\n /* private mode */\n }\n }\n if (level === 'static' && typeof document !== 'undefined') staticAlternative(document.documentElement);\n if (typeof document !== 'undefined') document.dispatchEvent(new CustomEvent('usa:sensitivity', { detail: { level } }));\n}\n\n/** Re-apply a persisted level (call early on page load). Returns the active level. */\nexport function restoreMotionSensitivity(): MotionSensitivity {\n try {\n const v = localStorage.getItem(KEY) as MotionSensitivity | null;\n if (v && MOTION_SENSITIVITY_LEVELS.includes(v)) setMotionSensitivity(v);\n } catch {\n /* ignore */\n }\n return getMotionSensitivity();\n}\n\n/** `true` when the current level allows a kind of motion (`'rotate'`, `'parallax'`, `'loop'`…). */\nexport function motionAllowed(kind: string, level: MotionSensitivity = getMotionSensitivity()): boolean {\n return MOTION_SENSITIVITY[level].allows.includes(kind);\n}\n\n/** The static alternative of each category: what its elements show without motion. */\nexport const STATIC_ALTERNATIVES: Record<ComponentCategory, string> = {\n reveal: 'Content visible in place; progress bars show the current value.',\n text: 'Full final text (screen readers always get a plain copy).',\n interaction: 'Normal hover / focus styles; no tilt, magnet or ripple.',\n feedback: 'Spinners become a static busy indicator; progress shows its value; toasts appear without sliding.',\n background: 'A still frame of the background (gradient / pattern); particles and marquees stop.',\n transitions: 'Dialogs, accordions and views switch instantly.',\n physics: 'Values jump to their target; drag still works, without inertia.',\n cards: 'Cards are shown flat and fully readable; stacks become lists.',\n click: 'Clicks work and states are announced; no bursts, confetti or deformation.',\n ui: 'Tabs, drawers, sheets and popovers open instantly with focus management intact.',\n page: 'Page transitions are instant; cursors and ambient layers are hidden.',\n timeline: 'Every step is shown at its final state.',\n gesture: 'Buttons / keys provide the same actions as swipes and pinches.',\n svg: 'Drawings and icons are shown complete.',\n webgl: 'A static poster image or CSS gradient instead of the shader.',\n depth: 'Flat, front-facing layout.',\n layout: 'Items reflow instantly.',\n packs: 'Roles are styled but not animated.',\n fx: 'Effects are skipped or reduced to a short fade; the content is unchanged.',\n};\n\n/**\n * Freeze a subtree at its static alternative: finishes running animations\n * (`finish()`, so content lands on its final state), marks the root with\n * `data-usa-static` and returns an undo that removes the mark.\n */\nexport function staticAlternative(root: Element): () => void {\n const getAll = (root as any).getAnimations as undefined | ((o: { subtree: boolean }) => Animation[]);\n if (typeof getAll === 'function') {\n for (const a of getAll.call(root, { subtree: true })) {\n try {\n const it = a.effect?.getComputedTiming().iterations;\n if (it === Infinity) a.cancel();\n else a.finish();\n } catch {\n /* finished already */\n }\n }\n }\n root.setAttribute('data-usa-static', '');\n return () => root.removeAttribute('data-usa-static');\n}\n\n// --- aria-live conventions ---------------------------------------------------\n\nexport type Politeness = 'polite' | 'assertive';\n/** The ids of the shared live regions. */\nexport const LIVE_REGION_IDS: Record<Politeness, string> = { polite: 'usa-live-polite', assertive: 'usa-live-assertive' };\n\n/** The shared live region (created once, visually hidden, `role=\"status\"` / `role=\"alert\"`). */\nexport function liveRegion(politeness: Politeness = 'polite'): HTMLElement | null {\n if (typeof document === 'undefined' || !document.body) return null;\n const id = LIVE_REGION_IDS[politeness];\n let el = document.getElementById(id);\n if (!el) {\n el = document.createElement('div');\n el.id = id;\n el.className = 'usa-sr';\n el.setAttribute('role', politeness === 'assertive' ? 'alert' : 'status');\n el.setAttribute('aria-live', politeness);\n el.setAttribute('aria-atomic', 'true');\n document.body.appendChild(el);\n }\n return el;\n}\n\nlet lastMsg = '';\nlet lastAt = 0;\n/**\n * Announce a message through the shared live region. Conventions: `polite`\n * for results of the user's own actions (added, saved, copied), `assertive`\n * only for errors that block them. Identical messages within `dedupe` ms\n * (default 500) are dropped; the region is cleared first so repeats are read.\n */\nexport function announce(message: string, options: { politeness?: Politeness; dedupe?: number } = {}): boolean {\n const { politeness = 'polite', dedupe = 500 } = options;\n const t = Date.now();\n if (!message || (message === lastMsg && t - lastAt < dedupe)) return false;\n lastMsg = message;\n lastAt = t;\n const el = liveRegion(politeness);\n if (!el) return false;\n el.textContent = '';\n el.textContent = message;\n return true;\n}\n\n// --- audit ---------------------------------------------------------------------\n\nexport interface A11yIssue {\n rule: string;\n level: 'error' | 'warning';\n element: Element;\n message: string;\n}\n\nconst FOCUSABLE = 'a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex=\"-1\"])';\nconst NAMED_ROLES = ['button', 'switch', 'checkbox', 'slider', 'tab', 'progressbar', 'radiogroup', 'dialog'];\n\nfunction accessibleName(el: Element): string {\n const label = el.getAttribute('aria-label');\n if (label) return label;\n const by = el.getAttribute('aria-labelledby');\n if (by) return by.split(/\\s+/).map((id) => el.ownerDocument.getElementById(id)?.textContent || '').join(' ').trim();\n return (el.textContent || el.getAttribute('title') || '').trim();\n}\n\n/**\n * Check a subtree against the library's motion-a11y rules:\n * - `aria-hidden-focusable` (error): focusable content inside `aria-hidden`.\n * - `role-name` (error): a widget role without an accessible name.\n * - `range-value` (error): a slider / determinate progressbar without `aria-valuenow`.\n * - `img-alt` (error): an `<img>` without `alt`.\n * - `assertive-live` (warning): `aria-live=\"assertive\"` outside `role=\"alert\"`.\n * - `infinite-no-control` (warning, WCAG 2.2.2): an endless animation on a\n * page with no way to pause motion (`<usa-motion-switch>` or `[data-usa-pause]`).\n */\nexport function auditMotionA11y(root: Element | Document): { errors: A11yIssue[]; warnings: A11yIssue[] } {\n const issues: A11yIssue[] = [];\n const add = (rule: string, level: A11yIssue['level'], element: Element, message: string) => issues.push({ rule, level, element, message });\n const scope = root as ParentNode;\n scope.querySelectorAll('[aria-hidden=\"true\"]').forEach((h) => {\n const f = (h.matches(FOCUSABLE) ? [h] : Array.from(h.querySelectorAll(FOCUSABLE))).filter((x) => !x.closest('[inert]'));\n f.forEach((x) => add('aria-hidden-focusable', 'error', x, `focusable <${x.tagName.toLowerCase()}> inside aria-hidden`));\n });\n scope.querySelectorAll('[role]').forEach((el) => {\n const role = el.getAttribute('role')!;\n if (NAMED_ROLES.includes(role) && !accessibleName(el)) add('role-name', 'error', el, `role=\"${role}\" has no accessible name`);\n if (role === 'slider' && !el.hasAttribute('aria-valuenow'))\n add('range-value', 'error', el, 'slider without aria-valuenow');\n });\n scope.querySelectorAll('img:not([alt])').forEach((el) => add('img-alt', 'error', el, '<img> without alt'));\n scope.querySelectorAll('[aria-live=\"assertive\"]').forEach((el) => {\n if (el.getAttribute('role') !== 'alert') add('assertive-live', 'warning', el, 'assertive live region outside role=\"alert\"');\n });\n const doc = (root as Node).ownerDocument || (root as Document);\n const anims = typeof (root as any).getAnimations === 'function' ? ((root as any).getAnimations({ subtree: true }) as Animation[]) : [];\n const control = doc && (doc.querySelector('usa-motion-switch, [data-usa-pause]') || doc.documentElement.hasAttribute('data-usa-sensitivity'));\n if (!control)\n anims.forEach((a) => {\n try {\n if (a.effect?.getComputedTiming().iterations === Infinity) {\n const t = (a.effect as KeyframeEffect).target;\n if (t) add('infinite-no-control', 'warning', t, 'endless animation and no motion control on the page');\n }\n } catch {\n /* ignore */\n }\n });\n return { errors: issues.filter((i) => i.level === 'error'), warnings: issues.filter((i) => i.level === 'warning') };\n}\n\n/** Every `<usa-*>` tag, for sweeping audits. */\nexport const ALL_TAGS: string[] = (Object.values(COMPONENT_CATEGORIES) as readonly (readonly string[])[]).flat();\n"],"names":[],"mappings":";;;;AAAA;;;;AAIG;AASH;SACgB,cAAc,GAAA;AAC5B,IAAA,MAAM,CAAC,IAAI,OAAO,MAAM,KAAK,WAAW,GAAG,MAAM,GAAG,EAAE,CAAQ;AAC9D,IAAA,MAAM,CAAC,IAAI,OAAO,QAAQ,KAAK,WAAW,GAAG,QAAQ,GAAG,EAAE,CAAQ;IAClE,MAAM,GAAG,GAAG,CAAC,CAAS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
{"version":3,"file":"angular.cjs","sources":["../../src/components/frameworks/angular.ts"],"sourcesContent":["/**\n * motionary/components/angular — Angular integration (v3.8).\n * Angular renders `<usa-*>` tags once the component (or NgModule) allows\n * custom elements with `CUSTOM_ELEMENTS_SCHEMA`; property binding\n * `[checked]=\"on\"` and event binding `(usa:change)=\"…\"` then work as is.\n * This entry is framework-free (no `@angular/*` import):\n *\n * ```ts\n * import { CUSTOM_ELEMENTS_SCHEMA, Component, APP_INITIALIZER } from '@angular/core';\n * import { usaInitializer } from 'motionary/components/angular';\n *\n * // app.config.ts\n * providers: [{ provide: APP_INITIALIZER, multi: true, useFactory: usaInitializer(['click', 'ui']) }]\n *\n * @Component({ standalone: true, schemas: [CUSTOM_ELEMENTS_SCHEMA],\n * template: `<usa-switch [checked]=\"on\" (usa:change)=\"on = $any($event).detail.checked\"></usa-switch>` })\n * ```\n * `bindUsa(el, { props, on })` is available for directives that bind imperatively.\n */\nimport { defineComponents, type ComponentCategory } from '../index';\n\nexport { bindUsa, usaEventName } from './bind';\nexport type { UsaBinding } from './bind';\n\n/** `APP_INITIALIZER` factory: registers the elements in the browser (no-op during SSR). */\nexport function usaInitializer(categories?: ComponentCategory[]): () => () => void {\n return () => () => {\n if (typeof window !== 'undefined') defineComponents(categories);\n };\n}\n\n/** Register the elements directly (e.g. in `main.ts` before `bootstrapApplication`). */\nexport function defineUsa(categories?: ComponentCategory[]): void {\n if (typeof window !== 'undefined') defineComponents(categories);\n}\n\n/** Read `event.detail` from a `usa:*` event in a template handler: `(usa:change)=\"on = usaDetail($event).checked\"`. */\nexport const usaDetail = <T = any>(e: Event): T => (e as CustomEvent<T>).detail;\n"],"names":["defineComponents"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;AAkBG;AAMH;AACM,SAAU,cAAc,CAAC,UAAgC,EAAA;AAC7D,IAAA,OAAO,MAAM,MAAK;QAChB,IAAI,OAAO,MAAM,KAAK,WAAW;YAAEA,2BAAgB,CAAC,UAAU,CAAC;AACjE,IAAA,CAAC;AACH;AAEA;AACM,SAAU,SAAS,CAAC,UAAgC,EAAA;IACxD,IAAI,OAAO,MAAM,KAAK,WAAW;QAAEA,2BAAgB,CAAC,UAAU,CAAC;AACjE;AAEA;AACO,MAAM,SAAS,GAAG,CAAU,CAAQ,KAAS,CAAoB,CAAC
|
|
1
|
+
{"version":3,"file":"angular.cjs","sources":["../../src/components/frameworks/angular.ts"],"sourcesContent":["/**\n * motionary/components/angular — Angular integration (v3.8).\n * Angular renders `<usa-*>` tags once the component (or NgModule) allows\n * custom elements with `CUSTOM_ELEMENTS_SCHEMA`; property binding\n * `[checked]=\"on\"` and event binding `(usa:change)=\"…\"` then work as is.\n * This entry is framework-free (no `@angular/*` import):\n *\n * ```ts\n * import { CUSTOM_ELEMENTS_SCHEMA, Component, APP_INITIALIZER } from '@angular/core';\n * import { usaInitializer } from 'motionary/components/angular';\n *\n * // app.config.ts\n * providers: [{ provide: APP_INITIALIZER, multi: true, useFactory: usaInitializer(['click', 'ui']) }]\n *\n * @Component({ standalone: true, schemas: [CUSTOM_ELEMENTS_SCHEMA],\n * template: `<usa-switch [checked]=\"on\" (usa:change)=\"on = $any($event).detail.checked\"></usa-switch>` })\n * ```\n * `bindUsa(el, { props, on })` is available for directives that bind imperatively.\n */\nimport { defineComponents, type ComponentCategory } from '../index';\n\nexport { bindUsa, usaEventName } from './bind';\nexport type { UsaBinding } from './bind';\n\n/** `APP_INITIALIZER` factory: registers the elements in the browser (no-op during SSR). */\nexport function usaInitializer(categories?: ComponentCategory[]): () => () => void {\n return () => () => {\n if (typeof window !== 'undefined') defineComponents(categories);\n };\n}\n\n/** Register the elements directly (e.g. in `main.ts` before `bootstrapApplication`). */\nexport function defineUsa(categories?: ComponentCategory[]): void {\n if (typeof window !== 'undefined') defineComponents(categories);\n}\n\n/** Read `event.detail` from a `usa:*` event in a template handler: `(usa:change)=\"on = usaDetail($event).checked\"`. */\nexport const usaDetail = <T = any>(e: Event): T => (e as CustomEvent<T>).detail;\n"],"names":["defineComponents"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;AAkBG;AAMH;AACM,SAAU,cAAc,CAAC,UAAgC,EAAA;AAC7D,IAAA,OAAO,MAAM,MAAK;QAChB,IAAI,OAAO,MAAM,KAAK,WAAW;YAAEA,2BAAgB,CAAC,UAAU,CAAC;AACjE,IAAA,CAAC;AACH;AAEA;AACM,SAAU,SAAS,CAAC,UAAgC,EAAA;IACxD,IAAI,OAAO,MAAM,KAAK,WAAW;QAAEA,2BAAgB,CAAC,UAAU,CAAC;AACjE;AAEA;AACO,MAAM,SAAS,GAAG,CAAU,CAAQ,KAAS,CAAoB,CAAC;;;;;;"}
|
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
import { defineComponents } from '../components.js';
|
|
2
2
|
export { b as bindUsa, u as usaEventName } from '../chunks/bind-B_CTL6Qn.js';
|
|
3
3
|
import './reveal.js';
|
|
4
|
-
import '../chunks/base-
|
|
4
|
+
import '../chunks/base-BTev8qxg.js';
|
|
5
5
|
import './text.js';
|
|
6
|
-
import '../chunks/core-
|
|
6
|
+
import '../chunks/core-BviA7nFa.js';
|
|
7
7
|
import './tokens.js';
|
|
8
8
|
import './interaction.js';
|
|
9
9
|
import './feedback.js';
|
|
10
10
|
import './background.js';
|
|
11
|
-
import '../chunks/variants-
|
|
11
|
+
import '../chunks/variants-CsRGUIyA.js';
|
|
12
12
|
import './transitions.js';
|
|
13
13
|
import './physics.js';
|
|
14
|
-
import '../chunks/spring-
|
|
14
|
+
import '../chunks/spring-BHuP55DR.js';
|
|
15
15
|
import './cards.js';
|
|
16
16
|
import './click.js';
|
|
17
|
-
import '../chunks/fx-
|
|
17
|
+
import '../chunks/fx-CgWKqVsn.js';
|
|
18
18
|
import './ui.js';
|
|
19
19
|
import './page.js';
|
|
20
20
|
import './timeline.js';
|
|
21
21
|
import './gesture.js';
|
|
22
|
-
import '../chunks/core-
|
|
22
|
+
import '../chunks/core-KiM7MXjL.js';
|
|
23
23
|
import './svg.js';
|
|
24
24
|
import './webgl.js';
|
|
25
25
|
import './depth.js';
|
|
26
26
|
import './layout.js';
|
|
27
27
|
import './packs.js';
|
|
28
28
|
import './fx.js';
|
|
29
|
-
import '../chunks/registry-
|
|
30
|
-
import '../chunks/builtins-
|
|
29
|
+
import '../chunks/registry-BKzyg1JV.js';
|
|
30
|
+
import '../chunks/builtins-CPmS6aDB.js';
|
|
31
31
|
import './a11y.js';
|
|
32
32
|
import '../chunks/index-tags-B-JBecYg.js';
|
|
33
33
|
import './perf.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"angular.js","sources":["../../src/components/frameworks/angular.ts"],"sourcesContent":["/**\n * motionary/components/angular — Angular integration (v3.8).\n * Angular renders `<usa-*>` tags once the component (or NgModule) allows\n * custom elements with `CUSTOM_ELEMENTS_SCHEMA`; property binding\n * `[checked]=\"on\"` and event binding `(usa:change)=\"…\"` then work as is.\n * This entry is framework-free (no `@angular/*` import):\n *\n * ```ts\n * import { CUSTOM_ELEMENTS_SCHEMA, Component, APP_INITIALIZER } from '@angular/core';\n * import { usaInitializer } from 'motionary/components/angular';\n *\n * // app.config.ts\n * providers: [{ provide: APP_INITIALIZER, multi: true, useFactory: usaInitializer(['click', 'ui']) }]\n *\n * @Component({ standalone: true, schemas: [CUSTOM_ELEMENTS_SCHEMA],\n * template: `<usa-switch [checked]=\"on\" (usa:change)=\"on = $any($event).detail.checked\"></usa-switch>` })\n * ```\n * `bindUsa(el, { props, on })` is available for directives that bind imperatively.\n */\nimport { defineComponents, type ComponentCategory } from '../index';\n\nexport { bindUsa, usaEventName } from './bind';\nexport type { UsaBinding } from './bind';\n\n/** `APP_INITIALIZER` factory: registers the elements in the browser (no-op during SSR). */\nexport function usaInitializer(categories?: ComponentCategory[]): () => () => void {\n return () => () => {\n if (typeof window !== 'undefined') defineComponents(categories);\n };\n}\n\n/** Register the elements directly (e.g. in `main.ts` before `bootstrapApplication`). */\nexport function defineUsa(categories?: ComponentCategory[]): void {\n if (typeof window !== 'undefined') defineComponents(categories);\n}\n\n/** Read `event.detail` from a `usa:*` event in a template handler: `(usa:change)=\"on = usaDetail($event).checked\"`. */\nexport const usaDetail = <T = any>(e: Event): T => (e as CustomEvent<T>).detail;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;AAkBG;AAMH;AACM,SAAU,cAAc,CAAC,UAAgC,EAAA;AAC7D,IAAA,OAAO,MAAM,MAAK;QAChB,IAAI,OAAO,MAAM,KAAK,WAAW;YAAE,gBAAgB,CAAC,UAAU,CAAC;AACjE,IAAA,CAAC;AACH;AAEA;AACM,SAAU,SAAS,CAAC,UAAgC,EAAA;IACxD,IAAI,OAAO,MAAM,KAAK,WAAW;QAAE,gBAAgB,CAAC,UAAU,CAAC;AACjE;AAEA;AACO,MAAM,SAAS,GAAG,CAAU,CAAQ,KAAS,CAAoB,CAAC
|
|
1
|
+
{"version":3,"file":"angular.js","sources":["../../src/components/frameworks/angular.ts"],"sourcesContent":["/**\n * motionary/components/angular — Angular integration (v3.8).\n * Angular renders `<usa-*>` tags once the component (or NgModule) allows\n * custom elements with `CUSTOM_ELEMENTS_SCHEMA`; property binding\n * `[checked]=\"on\"` and event binding `(usa:change)=\"…\"` then work as is.\n * This entry is framework-free (no `@angular/*` import):\n *\n * ```ts\n * import { CUSTOM_ELEMENTS_SCHEMA, Component, APP_INITIALIZER } from '@angular/core';\n * import { usaInitializer } from 'motionary/components/angular';\n *\n * // app.config.ts\n * providers: [{ provide: APP_INITIALIZER, multi: true, useFactory: usaInitializer(['click', 'ui']) }]\n *\n * @Component({ standalone: true, schemas: [CUSTOM_ELEMENTS_SCHEMA],\n * template: `<usa-switch [checked]=\"on\" (usa:change)=\"on = $any($event).detail.checked\"></usa-switch>` })\n * ```\n * `bindUsa(el, { props, on })` is available for directives that bind imperatively.\n */\nimport { defineComponents, type ComponentCategory } from '../index';\n\nexport { bindUsa, usaEventName } from './bind';\nexport type { UsaBinding } from './bind';\n\n/** `APP_INITIALIZER` factory: registers the elements in the browser (no-op during SSR). */\nexport function usaInitializer(categories?: ComponentCategory[]): () => () => void {\n return () => () => {\n if (typeof window !== 'undefined') defineComponents(categories);\n };\n}\n\n/** Register the elements directly (e.g. in `main.ts` before `bootstrapApplication`). */\nexport function defineUsa(categories?: ComponentCategory[]): void {\n if (typeof window !== 'undefined') defineComponents(categories);\n}\n\n/** Read `event.detail` from a `usa:*` event in a template handler: `(usa:change)=\"on = usaDetail($event).checked\"`. */\nexport const usaDetail = <T = any>(e: Event): T => (e as CustomEvent<T>).detail;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;AAkBG;AAMH;AACM,SAAU,cAAc,CAAC,UAAgC,EAAA;AAC7D,IAAA,OAAO,MAAM,MAAK;QAChB,IAAI,OAAO,MAAM,KAAK,WAAW;YAAE,gBAAgB,CAAC,UAAU,CAAC;AACjE,IAAA,CAAC;AACH;AAEA;AACM,SAAU,SAAS,CAAC,UAAgC,EAAA;IACxD,IAAI,OAAO,MAAM,KAAK,WAAW;QAAE,gBAAgB,CAAC,UAAU,CAAC;AACjE;AAEA;AACO,MAAM,SAAS,GAAG,CAAU,CAAQ,KAAS,CAAoB,CAAC;;"}
|