@exponential_app/eui 0.3.0 → 0.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/catalog/a11y.json +10 -0
- package/catalog/core.catalog.json +284 -6
- package/catalog/core.schema.json +437 -4
- package/catalog/layout.json +3 -2
- package/catalog/limits.json +10 -1
- package/catalog/macros.json +1 -0
- package/catalog/recipes.json +3 -1
- package/catalog/strings.json +9 -2
- package/catalog/style.json +21 -0
- package/catalog/theme.schema.json +4435 -3676
- package/conformance/manifest.json +2 -2
- package/conformance/motion/build-corpus.ts +232 -0
- package/conformance/motion/corpus/SOURCES.md +117 -0
- package/conformance/motion/corpus/images/footage_0.json +1 -0
- package/conformance/motion/corpus/images/img_0.jpg +0 -0
- package/conformance/motion/corpus/images/img_1.jpg +0 -0
- package/conformance/motion/corpus/images/triangle.png +0 -0
- package/conformance/motion/corpus/skottie-3d-parenting-nocamera.json +367 -0
- package/conformance/motion/corpus/skottie-auto-orient-2.json +292 -0
- package/conformance/motion/corpus/skottie-auto-orient.json +717 -0
- package/conformance/motion/corpus/skottie-bezier-extranormal.json +199 -0
- package/conformance/motion/corpus/skottie-blendmode-hardmix.json +558 -0
- package/conformance/motion/corpus/skottie-chained-mattes.json +259 -0
- package/conformance/motion/corpus/skottie-dropshadow-ramp.json +852 -0
- package/conformance/motion/corpus/skottie-dropshadow-style.json +278 -0
- package/conformance/motion/corpus/skottie-effects-transform.json +385 -0
- package/conformance/motion/corpus/skottie-fill-effect.json +358 -0
- package/conformance/motion/corpus/skottie-fill-rule.json +457 -0
- package/conformance/motion/corpus/skottie-gaussian-blur.json +670 -0
- package/conformance/motion/corpus/skottie-gradient-opacity.json +451 -0
- package/conformance/motion/corpus/skottie-gradient-radial-highlight.json +581 -0
- package/conformance/motion/corpus/skottie-hidden-shapes-layers.json +381 -0
- package/conformance/motion/corpus/skottie-huesaturation-effect.json +1117 -0
- package/conformance/motion/corpus/skottie-invert-effect.json +665 -0
- package/conformance/motion/corpus/skottie-luma-matte.json +239 -0
- package/conformance/motion/corpus/skottie-mask-feather.json +892 -0
- package/conformance/motion/corpus/skottie-masking-opaque.json +2376 -0
- package/conformance/motion/corpus/skottie-masking-translucent.json +2376 -0
- package/conformance/motion/corpus/skottie-matte-blendmode.json +196 -0
- package/conformance/motion/corpus/skottie-matte-nonsequential.json +722 -0
- package/conformance/motion/corpus/skottie-matte-visible.json +666 -0
- package/conformance/motion/corpus/skottie-mergepaths-effect.json +722 -0
- package/conformance/motion/corpus/skottie-motion-blur-mask.json +120 -0
- package/conformance/motion/corpus/skottie-nested-animation.json +253 -0
- package/conformance/motion/corpus/skottie-offsetpaths-effect.json +525 -0
- package/conformance/motion/corpus/skottie-phonehub-connecting.json +947 -0
- package/conformance/motion/corpus/skottie-puckerbloat-effect.json +339 -0
- package/conformance/motion/corpus/skottie-repeater.json +234 -0
- package/conformance/motion/corpus/skottie-sample-1.json +168 -0
- package/conformance/motion/corpus/skottie-sample-search.json +329 -0
- package/conformance/motion/corpus/skottie-spatial-supernormal.json +898 -0
- package/conformance/motion/corpus/skottie-text-animator-1.json +1286 -0
- package/conformance/motion/corpus/skottie-text-fill-over-stroke.json +1014 -0
- package/conformance/motion/corpus/skottie-text-tracking.json +950 -0
- package/conformance/motion/corpus/skottie-text-valign.json +484 -0
- package/conformance/motion/corpus/skottie-time-reverse.json +297 -0
- package/conformance/motion/corpus/skottie-transform-skew.json +290 -0
- package/conformance/motion/corpus/skottie-trimpath-fill.json +933 -0
- package/conformance/motion/corpus/skottie-trimpath-modes.json +266 -0
- package/conformance/motion/corpus/skottie-tritone-effect.json +379 -0
- package/conformance/motion/corpus/spec-blend-mode.json +531 -0
- package/conformance/motion/corpus/spec-ellipse.json +142 -0
- package/conformance/motion/corpus/spec-fill.json +193 -0
- package/conformance/motion/corpus/spec-gradient-stroke.json +1263 -0
- package/conformance/motion/corpus/spec-gradient.json +1255 -0
- package/conformance/motion/corpus/spec-mask.json +773 -0
- package/conformance/motion/corpus/spec-masks.json +676 -0
- package/conformance/motion/corpus/spec-matte.json +390 -0
- package/conformance/motion/corpus/spec-metadata.json +1 -0
- package/conformance/motion/corpus/spec-path.json +177 -0
- package/conformance/motion/corpus/spec-pucker-bloat.json +179 -0
- package/conformance/motion/corpus/spec-rectangle.json +145 -0
- package/conformance/motion/corpus/spec-rounded-corners.json +187 -0
- package/conformance/motion/corpus/spec-slots.json +325 -0
- package/conformance/motion/corpus/spec-star.json +159 -0
- package/conformance/motion/corpus/spec-stroke.json +156 -0
- package/conformance/motion/corpus/spec-test-ellipse-xy-pos.json +141 -0
- package/conformance/motion/corpus/spec-test-gradient-fill.json +1 -0
- package/conformance/motion/corpus/spec-test-gradient-stroke.json +229 -0
- package/conformance/motion/corpus/spec-test-unknown-shape.json +63 -0
- package/conformance/motion/corpus/spec-time-remap.json +1090 -0
- package/conformance/motion/corpus/spec-time-stretch.json +594 -0
- package/conformance/motion/corpus/spec-transform.json +273 -0
- package/conformance/motion/corpus/spec-trim-path.json +209 -0
- package/conformance/motion/corpus/web-adrock.json +1 -0
- package/conformance/motion/corpus/web-bacon.json +1 -0
- package/conformance/motion/corpus/web-banner.json +1 -0
- package/conformance/motion/corpus/web-bodymovin.json +1 -0
- package/conformance/motion/corpus/web-dalek.json +1 -0
- package/conformance/motion/corpus/web-footage-data.json +1 -0
- package/conformance/motion/corpus/web-lights.json +1 -0
- package/conformance/motion/corpus/web-ripple.json +1 -0
- package/conformance/motion/corpus/web-starfish.json +1 -0
- package/conformance/motion/known-gaps.json +35 -0
- package/conformance/motion/parity/group-transforms-parenting@0.png +0 -0
- package/conformance/motion/parity/group-transforms-parenting@10.png +0 -0
- package/conformance/motion/parity/hidden-unknown-inactive@0.png +0 -0
- package/conformance/motion/parity/keyframes-transform@0.png +0 -0
- package/conformance/motion/parity/keyframes-transform@10.png +0 -0
- package/conformance/motion/parity/keyframes-transform@15.png +0 -0
- package/conformance/motion/parity/keyframes-transform@5.png +0 -0
- package/conformance/motion/parity/layer-opacity-blend@0.png +0 -0
- package/conformance/motion/parity/linear-gradient@0.png +0 -0
- package/conformance/motion/parity/masks-modes@0.png +0 -0
- package/conformance/motion/parity/matte-alpha@0.png +0 -0
- package/conformance/motion/parity/matte-luma@0.png +0 -0
- package/conformance/motion/parity/matte-parent-tp@0.png +0 -0
- package/conformance/motion/parity/path-evenodd@0.png +0 -0
- package/conformance/motion/parity/precomp-clip-offset@0.png +0 -0
- package/conformance/motion/parity/precomp-clip-offset@15.png +0 -0
- package/conformance/motion/parity/precomp-clip-offset@5.png +0 -0
- package/conformance/motion/parity/radial-gradient-highlight@0.png +0 -0
- package/conformance/motion/parity/rect-solid-fill@0.png +0 -0
- package/conformance/motion/parity/repeater@0.png +0 -0
- package/conformance/motion/parity/rounded-rect-ellipse@0.png +0 -0
- package/conformance/motion/parity/solid-and-image@0.png +0 -0
- package/conformance/motion/parity/split-position-skew@0.png +0 -0
- package/conformance/motion/parity/split-position-skew@10.png +0 -0
- package/conformance/motion/parity/star-polygon@0.png +0 -0
- package/conformance/motion/parity/stroke-caps-joins@0.png +0 -0
- package/conformance/motion/parity/stroke-dashes@0.png +0 -0
- package/conformance/motion/parity/stroke-dashes@10.png +0 -0
- package/conformance/motion/parity/time-remap@0.png +0 -0
- package/conformance/motion/parity/time-remap@10.png +0 -0
- package/conformance/motion/parity/time-remap@19.png +0 -0
- package/conformance/motion/parity/time-stretch@0.png +0 -0
- package/conformance/motion/parity/time-stretch@10.png +0 -0
- package/conformance/motion/parity/trim-individually@0.png +0 -0
- package/conformance/motion/parity/trim-path@0.png +0 -0
- package/conformance/motion/parity/trim-path@10.png +0 -0
- package/conformance/motion/refs/index.json +688 -0
- package/conformance/motion/refs/skottie-3d-parenting-nocamera@0.png +0 -0
- package/conformance/motion/refs/skottie-3d-parenting-nocamera@150.png +0 -0
- package/conformance/motion/refs/skottie-3d-parenting-nocamera@270.png +0 -0
- package/conformance/motion/refs/skottie-auto-orient-2@0.png +0 -0
- package/conformance/motion/refs/skottie-auto-orient-2@210.png +0 -0
- package/conformance/motion/refs/skottie-auto-orient-2@378.png +0 -0
- package/conformance/motion/refs/skottie-auto-orient@0.png +0 -0
- package/conformance/motion/refs/skottie-auto-orient@300.png +0 -0
- package/conformance/motion/refs/skottie-auto-orient@540.png +0 -0
- package/conformance/motion/refs/skottie-bezier-extranormal@0.png +0 -0
- package/conformance/motion/refs/skottie-bezier-extranormal@150.png +0 -0
- package/conformance/motion/refs/skottie-bezier-extranormal@270.png +0 -0
- package/conformance/motion/refs/skottie-blendmode-hardmix@0.png +0 -0
- package/conformance/motion/refs/skottie-blendmode-hardmix@150.png +0 -0
- package/conformance/motion/refs/skottie-blendmode-hardmix@270.png +0 -0
- package/conformance/motion/refs/skottie-chained-mattes@0.png +0 -0
- package/conformance/motion/refs/skottie-chained-mattes@300.png +0 -0
- package/conformance/motion/refs/skottie-chained-mattes@540.png +0 -0
- package/conformance/motion/refs/skottie-dropshadow-ramp@0.png +0 -0
- package/conformance/motion/refs/skottie-dropshadow-ramp@135.png +0 -0
- package/conformance/motion/refs/skottie-dropshadow-ramp@75.png +0 -0
- package/conformance/motion/refs/skottie-dropshadow-style@0.png +0 -0
- package/conformance/motion/refs/skottie-dropshadow-style@300.png +0 -0
- package/conformance/motion/refs/skottie-dropshadow-style@540.png +0 -0
- package/conformance/motion/refs/skottie-effects-transform@0.png +0 -0
- package/conformance/motion/refs/skottie-effects-transform@450.png +0 -0
- package/conformance/motion/refs/skottie-effects-transform@810.png +0 -0
- package/conformance/motion/refs/skottie-fill-effect@0.png +0 -0
- package/conformance/motion/refs/skottie-fill-effect@300.png +0 -0
- package/conformance/motion/refs/skottie-fill-effect@540.png +0 -0
- package/conformance/motion/refs/skottie-fill-rule@0.png +0 -0
- package/conformance/motion/refs/skottie-fill-rule@150.png +0 -0
- package/conformance/motion/refs/skottie-fill-rule@270.png +0 -0
- package/conformance/motion/refs/skottie-gaussian-blur@0.png +0 -0
- package/conformance/motion/refs/skottie-gaussian-blur@150.png +0 -0
- package/conformance/motion/refs/skottie-gaussian-blur@270.png +0 -0
- package/conformance/motion/refs/skottie-gradient-opacity@0.png +0 -0
- package/conformance/motion/refs/skottie-gradient-opacity@150.png +0 -0
- package/conformance/motion/refs/skottie-gradient-opacity@270.png +0 -0
- package/conformance/motion/refs/skottie-gradient-radial-highlight@0.png +0 -0
- package/conformance/motion/refs/skottie-gradient-radial-highlight@135.png +0 -0
- package/conformance/motion/refs/skottie-gradient-radial-highlight@75.png +0 -0
- package/conformance/motion/refs/skottie-hidden-shapes-layers@0.png +0 -0
- package/conformance/motion/refs/skottie-hidden-shapes-layers@150.png +0 -0
- package/conformance/motion/refs/skottie-hidden-shapes-layers@270.png +0 -0
- package/conformance/motion/refs/skottie-huesaturation-effect@0.png +0 -0
- package/conformance/motion/refs/skottie-huesaturation-effect@30.png +0 -0
- package/conformance/motion/refs/skottie-huesaturation-effect@54.png +0 -0
- package/conformance/motion/refs/skottie-invert-effect@0.png +0 -0
- package/conformance/motion/refs/skottie-invert-effect@300.png +0 -0
- package/conformance/motion/refs/skottie-invert-effect@540.png +0 -0
- package/conformance/motion/refs/skottie-luma-matte@0.png +0 -0
- package/conformance/motion/refs/skottie-luma-matte@150.png +0 -0
- package/conformance/motion/refs/skottie-luma-matte@270.png +0 -0
- package/conformance/motion/refs/skottie-mask-feather@0.png +0 -0
- package/conformance/motion/refs/skottie-mask-feather@150.png +0 -0
- package/conformance/motion/refs/skottie-mask-feather@270.png +0 -0
- package/conformance/motion/refs/skottie-masking-opaque@0.png +0 -0
- package/conformance/motion/refs/skottie-masking-opaque@135.png +0 -0
- package/conformance/motion/refs/skottie-masking-opaque@75.png +0 -0
- package/conformance/motion/refs/skottie-masking-translucent@0.png +0 -0
- package/conformance/motion/refs/skottie-masking-translucent@135.png +0 -0
- package/conformance/motion/refs/skottie-masking-translucent@75.png +0 -0
- package/conformance/motion/refs/skottie-matte-blendmode@0.png +0 -0
- package/conformance/motion/refs/skottie-matte-blendmode@150.png +0 -0
- package/conformance/motion/refs/skottie-matte-blendmode@270.png +0 -0
- package/conformance/motion/refs/skottie-matte-nonsequential@0.png +0 -0
- package/conformance/motion/refs/skottie-matte-nonsequential@150.png +0 -0
- package/conformance/motion/refs/skottie-matte-nonsequential@270.png +0 -0
- package/conformance/motion/refs/skottie-matte-visible@0.png +0 -0
- package/conformance/motion/refs/skottie-matte-visible@150.png +0 -0
- package/conformance/motion/refs/skottie-matte-visible@270.png +0 -0
- package/conformance/motion/refs/skottie-mergepaths-effect@0.png +0 -0
- package/conformance/motion/refs/skottie-mergepaths-effect@210.png +0 -0
- package/conformance/motion/refs/skottie-mergepaths-effect@378.png +0 -0
- package/conformance/motion/refs/skottie-motion-blur-mask@0.png +0 -0
- package/conformance/motion/refs/skottie-motion-blur-mask@150.png +0 -0
- package/conformance/motion/refs/skottie-motion-blur-mask@270.png +0 -0
- package/conformance/motion/refs/skottie-nested-animation@0.png +0 -0
- package/conformance/motion/refs/skottie-nested-animation@300.png +0 -0
- package/conformance/motion/refs/skottie-nested-animation@540.png +0 -0
- package/conformance/motion/refs/skottie-offsetpaths-effect@0.png +0 -0
- package/conformance/motion/refs/skottie-offsetpaths-effect@150.png +0 -0
- package/conformance/motion/refs/skottie-offsetpaths-effect@270.png +0 -0
- package/conformance/motion/refs/skottie-phonehub-connecting@0.png +0 -0
- package/conformance/motion/refs/skottie-puckerbloat-effect@0.png +0 -0
- package/conformance/motion/refs/skottie-puckerbloat-effect@210.png +0 -0
- package/conformance/motion/refs/skottie-puckerbloat-effect@378.png +0 -0
- package/conformance/motion/refs/skottie-repeater@0.png +0 -0
- package/conformance/motion/refs/skottie-repeater@300.png +0 -0
- package/conformance/motion/refs/skottie-repeater@540.png +0 -0
- package/conformance/motion/refs/skottie-sample-1@0.png +0 -0
- package/conformance/motion/refs/skottie-sample-1@100.png +0 -0
- package/conformance/motion/refs/skottie-sample-1@180.png +0 -0
- package/conformance/motion/refs/skottie-sample-search@0.png +0 -0
- package/conformance/motion/refs/skottie-sample-search@27.png +0 -0
- package/conformance/motion/refs/skottie-sample-search@48.png +0 -0
- package/conformance/motion/refs/skottie-spatial-supernormal@0.png +0 -0
- package/conformance/motion/refs/skottie-spatial-supernormal@200.png +0 -0
- package/conformance/motion/refs/skottie-spatial-supernormal@360.png +0 -0
- package/conformance/motion/refs/skottie-text-animator-1@0.png +0 -0
- package/conformance/motion/refs/skottie-text-animator-1@150.png +0 -0
- package/conformance/motion/refs/skottie-text-animator-1@270.png +0 -0
- package/conformance/motion/refs/skottie-text-fill-over-stroke@0.png +0 -0
- package/conformance/motion/refs/skottie-text-fill-over-stroke@210.png +0 -0
- package/conformance/motion/refs/skottie-text-fill-over-stroke@378.png +0 -0
- package/conformance/motion/refs/skottie-text-tracking@0.png +0 -0
- package/conformance/motion/refs/skottie-text-tracking@108.png +0 -0
- package/conformance/motion/refs/skottie-text-tracking@60.png +0 -0
- package/conformance/motion/refs/skottie-text-valign@0.png +0 -0
- package/conformance/motion/refs/skottie-text-valign@150.png +0 -0
- package/conformance/motion/refs/skottie-text-valign@270.png +0 -0
- package/conformance/motion/refs/skottie-time-reverse@0.png +0 -0
- package/conformance/motion/refs/skottie-time-reverse@300.png +0 -0
- package/conformance/motion/refs/skottie-time-reverse@540.png +0 -0
- package/conformance/motion/refs/skottie-transform-skew@0.png +0 -0
- package/conformance/motion/refs/skottie-transform-skew@300.png +0 -0
- package/conformance/motion/refs/skottie-transform-skew@540.png +0 -0
- package/conformance/motion/refs/skottie-trimpath-fill@0.png +0 -0
- package/conformance/motion/refs/skottie-trimpath-fill@300.png +0 -0
- package/conformance/motion/refs/skottie-trimpath-fill@540.png +0 -0
- package/conformance/motion/refs/skottie-trimpath-modes@0.png +0 -0
- package/conformance/motion/refs/skottie-trimpath-modes@300.png +0 -0
- package/conformance/motion/refs/skottie-trimpath-modes@540.png +0 -0
- package/conformance/motion/refs/skottie-tritone-effect@0.png +0 -0
- package/conformance/motion/refs/skottie-tritone-effect@300.png +0 -0
- package/conformance/motion/refs/skottie-tritone-effect@540.png +0 -0
- package/conformance/motion/refs/spec-blend-mode@0.png +0 -0
- package/conformance/motion/refs/spec-blend-mode@162.png +0 -0
- package/conformance/motion/refs/spec-blend-mode@90.png +0 -0
- package/conformance/motion/refs/spec-ellipse@0.png +0 -0
- package/conformance/motion/refs/spec-ellipse@162.png +0 -0
- package/conformance/motion/refs/spec-ellipse@90.png +0 -0
- package/conformance/motion/refs/spec-fill@0.png +0 -0
- package/conformance/motion/refs/spec-fill@162.png +0 -0
- package/conformance/motion/refs/spec-fill@90.png +0 -0
- package/conformance/motion/refs/spec-gradient-stroke@0.png +0 -0
- package/conformance/motion/refs/spec-gradient-stroke@162.png +0 -0
- package/conformance/motion/refs/spec-gradient-stroke@90.png +0 -0
- package/conformance/motion/refs/spec-gradient@0.png +0 -0
- package/conformance/motion/refs/spec-gradient@162.png +0 -0
- package/conformance/motion/refs/spec-gradient@90.png +0 -0
- package/conformance/motion/refs/spec-mask@0.png +0 -0
- package/conformance/motion/refs/spec-mask@300.png +0 -0
- package/conformance/motion/refs/spec-mask@540.png +0 -0
- package/conformance/motion/refs/spec-masks@0.png +0 -0
- package/conformance/motion/refs/spec-masks@135.png +0 -0
- package/conformance/motion/refs/spec-masks@75.png +0 -0
- package/conformance/motion/refs/spec-matte@0.png +0 -0
- package/conformance/motion/refs/spec-matte@162.png +0 -0
- package/conformance/motion/refs/spec-matte@90.png +0 -0
- package/conformance/motion/refs/spec-metadata@0.png +0 -0
- package/conformance/motion/refs/spec-metadata@162.png +0 -0
- package/conformance/motion/refs/spec-metadata@90.png +0 -0
- package/conformance/motion/refs/spec-path@0.png +0 -0
- package/conformance/motion/refs/spec-path@162.png +0 -0
- package/conformance/motion/refs/spec-path@90.png +0 -0
- package/conformance/motion/refs/spec-pucker-bloat@0.png +0 -0
- package/conformance/motion/refs/spec-pucker-bloat@162.png +0 -0
- package/conformance/motion/refs/spec-pucker-bloat@90.png +0 -0
- package/conformance/motion/refs/spec-rectangle@0.png +0 -0
- package/conformance/motion/refs/spec-rectangle@162.png +0 -0
- package/conformance/motion/refs/spec-rectangle@90.png +0 -0
- package/conformance/motion/refs/spec-rounded-corners@0.png +0 -0
- package/conformance/motion/refs/spec-rounded-corners@162.png +0 -0
- package/conformance/motion/refs/spec-rounded-corners@90.png +0 -0
- package/conformance/motion/refs/spec-slots@0.png +0 -0
- package/conformance/motion/refs/spec-slots@450.png +0 -0
- package/conformance/motion/refs/spec-slots@810.png +0 -0
- package/conformance/motion/refs/spec-star@0.png +0 -0
- package/conformance/motion/refs/spec-star@162.png +0 -0
- package/conformance/motion/refs/spec-star@90.png +0 -0
- package/conformance/motion/refs/spec-stroke@0.png +0 -0
- package/conformance/motion/refs/spec-stroke@162.png +0 -0
- package/conformance/motion/refs/spec-stroke@90.png +0 -0
- package/conformance/motion/refs/spec-test-ellipse-xy-pos@0.png +0 -0
- package/conformance/motion/refs/spec-test-ellipse-xy-pos@162.png +0 -0
- package/conformance/motion/refs/spec-test-ellipse-xy-pos@90.png +0 -0
- package/conformance/motion/refs/spec-test-gradient-fill@0.png +0 -0
- package/conformance/motion/refs/spec-test-gradient-fill@30.png +0 -0
- package/conformance/motion/refs/spec-test-gradient-fill@54.png +0 -0
- package/conformance/motion/refs/spec-test-gradient-stroke@0.png +0 -0
- package/conformance/motion/refs/spec-test-gradient-stroke@30.png +0 -0
- package/conformance/motion/refs/spec-test-gradient-stroke@54.png +0 -0
- package/conformance/motion/refs/spec-test-unknown-shape@0.png +0 -0
- package/conformance/motion/refs/spec-test-unknown-shape@162.png +0 -0
- package/conformance/motion/refs/spec-test-unknown-shape@90.png +0 -0
- package/conformance/motion/refs/spec-time-remap@0.png +0 -0
- package/conformance/motion/refs/spec-time-remap@300.png +0 -0
- package/conformance/motion/refs/spec-time-remap@540.png +0 -0
- package/conformance/motion/refs/spec-time-stretch@0.png +0 -0
- package/conformance/motion/refs/spec-time-stretch@300.png +0 -0
- package/conformance/motion/refs/spec-time-stretch@540.png +0 -0
- package/conformance/motion/refs/spec-transform@0.png +0 -0
- package/conformance/motion/refs/spec-transform@162.png +0 -0
- package/conformance/motion/refs/spec-transform@90.png +0 -0
- package/conformance/motion/refs/spec-trim-path@0.png +0 -0
- package/conformance/motion/refs/spec-trim-path@162.png +0 -0
- package/conformance/motion/refs/spec-trim-path@90.png +0 -0
- package/conformance/motion/refs/web-adrock@0.png +0 -0
- package/conformance/motion/refs/web-adrock@10.png +0 -0
- package/conformance/motion/refs/web-adrock@18.png +0 -0
- package/conformance/motion/refs/web-bacon@0.png +0 -0
- package/conformance/motion/refs/web-bacon@126.png +0 -0
- package/conformance/motion/refs/web-bacon@70.png +0 -0
- package/conformance/motion/refs/web-banner@0.png +0 -0
- package/conformance/motion/refs/web-banner@301.png +0 -0
- package/conformance/motion/refs/web-banner@542.png +0 -0
- package/conformance/motion/refs/web-bodymovin@0.png +0 -0
- package/conformance/motion/refs/web-bodymovin@51.png +0 -0
- package/conformance/motion/refs/web-bodymovin@92.png +0 -0
- package/conformance/motion/refs/web-dalek@0.png +0 -0
- package/conformance/motion/refs/web-dalek@145.png +0 -0
- package/conformance/motion/refs/web-dalek@261.png +0 -0
- package/conformance/motion/refs/web-footage-data@0.png +0 -0
- package/conformance/motion/refs/web-footage-data@180.png +0 -0
- package/conformance/motion/refs/web-footage-data@324.png +0 -0
- package/conformance/motion/refs/web-lights@0.png +0 -0
- package/conformance/motion/refs/web-lights@150.png +0 -0
- package/conformance/motion/refs/web-lights@270.png +0 -0
- package/conformance/motion/refs/web-ripple@0.png +0 -0
- package/conformance/motion/refs/web-ripple@180.png +0 -0
- package/conformance/motion/refs/web-ripple@324.png +0 -0
- package/conformance/motion/refs/web-starfish@0.png +0 -0
- package/conformance/motion/refs/web-starfish@150.png +0 -0
- package/conformance/motion/refs/web-starfish@270.png +0 -0
- package/conformance/motion/render-refs.ts +126 -0
- package/conformance/motion/report.json +1367 -0
- package/conformance/motion/web-parity-gaps.json +12 -0
- package/conformance/motion-parity-entry.ts +3 -0
- package/conformance/motion-parity.ts +101 -0
- package/dist/chunks/{index-4z7f2bp1.js → index-4xczxey5.js} +35 -15
- package/dist/chunks/{index-4z7f2bp1.js.map → index-4xczxey5.js.map} +4 -4
- package/dist/chunks/{index-dx45asrf.js → index-5sjj5p84.js} +174 -8
- package/dist/chunks/{index-dx45asrf.js.map → index-5sjj5p84.js.map} +2 -2
- package/dist/chunks/{index-fy7y2nz8.js → index-cvf7bbs5.js} +23 -2
- package/dist/chunks/{index-fy7y2nz8.js.map → index-cvf7bbs5.js.map} +1 -1
- package/dist/chunks/index-dgkf6yw5.js +48 -0
- package/dist/chunks/index-dgkf6yw5.js.map +10 -0
- package/dist/chunks/{index-abcjanhc.js → index-f9wkb6aq.js} +192 -3
- package/dist/chunks/{index-abcjanhc.js.map → index-f9wkb6aq.js.map} +2 -2
- package/dist/chunks/index-t2mwfbb6.js +1515 -0
- package/dist/chunks/index-t2mwfbb6.js.map +15 -0
- package/dist/chunks/{index-h3zgfghf.js → index-vkn82srs.js} +179 -8
- package/dist/chunks/{index-h3zgfghf.js.map → index-vkn82srs.js.map} +2 -2
- package/dist/chunks/wasm-ctcc3cma.js +424 -0
- package/dist/chunks/wasm-ctcc3cma.js.map +11 -0
- package/dist/conformance.js +3154 -63
- package/dist/conformance.js.map +2 -2
- package/dist/entries/prompt.js +2 -2
- package/dist/entries/schema.js +3 -3
- package/dist/host/index.js +3 -3
- package/dist/index.js +333 -98
- package/dist/index.js.map +4 -4
- package/dist/types/src/catalog.generated.d.ts +50 -4
- package/dist/types/src/index.d.ts +2 -0
- package/dist/types/src/layout.d.ts +2 -0
- package/dist/types/src/limits.d.ts +1 -0
- package/dist/types/src/motion/index.d.ts +1 -0
- package/dist/types/src/motion/server.d.ts +9 -0
- package/dist/types/src/motion/wasm.d.ts +11 -0
- package/dist/types/src/web/coerce.d.ts +3 -0
- package/dist/types/src/web/focus.d.ts +8 -0
- package/dist/types/src/web/index.d.ts +5 -2
- package/dist/types/src/web/primitives/carousel.d.ts +1 -1
- package/dist/types/src/web/primitives/dock.d.ts +5 -2
- package/dist/types/src/web/primitives/index.d.ts +2 -0
- package/dist/types/src/web/primitives/motion-paint.d.ts +36 -0
- package/dist/types/src/web/primitives/motion.d.ts +162 -0
- package/dist/types/src/web/primitives/zoomable-image.d.ts +158 -0
- package/dist/types/src/web/table.d.ts +8 -0
- package/dist/types/src/zoom.d.ts +128 -0
- package/dist/types/wasm/motion/bytes.d.ts +1 -0
- package/dist/web/index.js +165 -230
- package/dist/web/index.js.map +8 -9
- package/dist/web/primitives/index.js +584 -7
- package/dist/web/primitives/index.js.map +7 -6
- package/docs/components.generated.json +392 -4
- package/docs/round-6-contract.md +5 -3
- package/docs/themes.generated.json +27 -0
- package/fixtures/bind-time.json +4 -0
- package/fixtures/catalog-components.json +930 -16
- package/fixtures/catalog-macros.json +11 -0
- package/fixtures/conformance-baseline.json +33020 -32952
- package/fixtures/conformance-known.json +64 -70
- package/fixtures/kitchen-sink.expanded.json +72 -0
- package/fixtures/kitchen-sink.json +33 -0
- package/fixtures/layout-geometry-round1.json +42 -42
- package/fixtures/motion-frames.json +2618 -0
- package/fixtures/motion-playback.json +528 -0
- package/fixtures/motion-state.json +722 -0
- package/fixtures/motion-validate.json +138 -0
- package/fixtures/primitive-specimens.json +1 -0
- package/fixtures/prompt-budget.json +16 -16
- package/fixtures/specimens.json +717 -21
- package/fixtures/theme-recipes.json +1518 -32
- package/fixtures/theme-resolved.json +732 -56
- package/fixtures/zoom.json +1382 -0
- package/generated/ExponentialUICatalog.generated.kt +20 -20
- package/generated/ExponentialUICatalog.generated.swift +20 -20
- package/generated/ExponentialUIThemes.generated.kt +7 -7
- package/generated/ExponentialUIThemes.generated.swift +7 -7
- package/generated/catalog.descriptions.generated.rs +1 -1
- package/generated/catalog.generated.rs +29 -29
- package/generated/catalog.themes.generated.rs +8 -8
- package/generated/core.descriptions.json +171 -5
- package/generated/core.runtime.json +189 -1
- package/package.json +1 -1
- package/themes/neutral.theme.json +172 -3
- package/dist/chunks/index-t6qz1770.js +0 -95
- package/dist/chunks/index-t6qz1770.js.map +0 -11
|
@@ -0,0 +1,1515 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __returnValue = (v) => v;
|
|
3
|
+
function __exportSetter(name, newValue) {
|
|
4
|
+
this[name] = __returnValue.bind(null, newValue);
|
|
5
|
+
}
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true,
|
|
11
|
+
configurable: true,
|
|
12
|
+
set: __exportSetter.bind(all, name)
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
var __chunkGraphs;
|
|
16
|
+
var __chunkSeen;
|
|
17
|
+
var __chunkNonce;
|
|
18
|
+
var __preload = (id, seenOnly) => {
|
|
19
|
+
for (var [base, graph, ids] of __chunkGraphs || [])
|
|
20
|
+
for (var stack = [id], g = globalThis, d = g.document, head, j, node, k, link;j = stack.pop(); )
|
|
21
|
+
if (!__chunkSeen[j] && (node = graph[j])) {
|
|
22
|
+
__chunkSeen[j] = 1;
|
|
23
|
+
for (k = 1;k < node.length; k++)
|
|
24
|
+
stack.push(ids[node[k]]);
|
|
25
|
+
if (!seenOnly && j !== id && (head = d && d.head)) {
|
|
26
|
+
if (__chunkNonce === undefined)
|
|
27
|
+
__chunkNonce = (k = d.querySelector("meta[property=csp-nonce]")) && (k.nonce || k.getAttribute("nonce")) || "";
|
|
28
|
+
link = d.createElement("link");
|
|
29
|
+
link.rel = "modulepreload";
|
|
30
|
+
link.crossOrigin = "";
|
|
31
|
+
if (__chunkNonce)
|
|
32
|
+
link.nonce = __chunkNonce;
|
|
33
|
+
link.href = new g.URL(node[0], base);
|
|
34
|
+
head.appendChild(link);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var __chunks = (base, ids, nodes, entry) => {
|
|
39
|
+
for (var graph = {}, i = 0;i < ids.length; i++)
|
|
40
|
+
graph[ids[i]] = nodes[i];
|
|
41
|
+
(__chunkGraphs ||= []).push([base, graph, ids]);
|
|
42
|
+
__chunkSeen ||= {};
|
|
43
|
+
__preload(ids[entry], 1);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
// packages/exponential-ui/src/web/urls.ts
|
|
47
|
+
import { DEFAULT_MEDIA_SCHEMES, decideUrl, isPrivateHost, mediaRequest, safeHref } from "@exponential_app/eui";
|
|
48
|
+
var documentBase = () => typeof document !== `undefined` && document.baseURI ? document.baseURI : undefined;
|
|
49
|
+
function ownPrivateHosts2() {
|
|
50
|
+
try {
|
|
51
|
+
const base = documentBase();
|
|
52
|
+
if (!base)
|
|
53
|
+
return [];
|
|
54
|
+
const host = new URL(base).hostname.toLowerCase();
|
|
55
|
+
return isPrivateHost(host) ? [host] : [];
|
|
56
|
+
} catch {
|
|
57
|
+
return [];
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function withOwnOrigin(allow) {
|
|
61
|
+
const own = ownPrivateHosts2();
|
|
62
|
+
if (!own.length)
|
|
63
|
+
return allow;
|
|
64
|
+
return [...allow ?? [], ...own.filter((h) => !(allow ?? []).includes(h))];
|
|
65
|
+
}
|
|
66
|
+
function urlPolicyOf2(host) {
|
|
67
|
+
const urls = host.urls ?? {};
|
|
68
|
+
const withBase = urls.baseUrl ? urls : { ...urls, baseUrl: host.media?.baseUrl ?? documentBase() };
|
|
69
|
+
return { ...withBase, allowPrivate: withOwnOrigin(withBase.allowPrivate) };
|
|
70
|
+
}
|
|
71
|
+
function linkHref2(host, href) {
|
|
72
|
+
return safeHref(urlPolicyOf2(host), href);
|
|
73
|
+
}
|
|
74
|
+
function mediaRequestOf2(host, src) {
|
|
75
|
+
if (typeof src !== `string` || !src)
|
|
76
|
+
return null;
|
|
77
|
+
const rewritten = host.resolveUrl ? host.resolveUrl(src) : src;
|
|
78
|
+
const req = host.mediaRequest ? host.mediaRequest(rewritten) : mediaRequest(rewritten, { baseUrl: documentBase(), ...host.media, allowPrivate: withOwnOrigin(host.media?.allowPrivate) });
|
|
79
|
+
if (!req)
|
|
80
|
+
return null;
|
|
81
|
+
return mediaUrlAllowed2(host, req.url) ? req : null;
|
|
82
|
+
}
|
|
83
|
+
function mediaUrlAllowed2(host, url) {
|
|
84
|
+
return decideUrl({ schemes: host.media?.schemes ?? DEFAULT_MEDIA_SCHEMES, hosts: host.media?.hosts, allowPrivate: withOwnOrigin(host.media?.allowPrivate) }, url).allowed;
|
|
85
|
+
}
|
|
86
|
+
function openAllowed2(host, url) {
|
|
87
|
+
const href = linkHref2(host, url);
|
|
88
|
+
if (!href)
|
|
89
|
+
return;
|
|
90
|
+
if (host.openUrl)
|
|
91
|
+
host.openUrl(href);
|
|
92
|
+
else if (typeof window !== `undefined`)
|
|
93
|
+
window.open(href, `_blank`, `noopener,noreferrer`);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// packages/exponential-ui/src/web/media.ts
|
|
97
|
+
import { MEDIA_LIMITS, mediaImageWithinLimits } from "@exponential_app/eui";
|
|
98
|
+
var MEDIA_CACHE_IDLE_MAX2 = 64;
|
|
99
|
+
var blobs = new Map;
|
|
100
|
+
function mediaCacheKey2(url, headers) {
|
|
101
|
+
return `${url}
|
|
102
|
+
${JSON.stringify(headers)}`;
|
|
103
|
+
}
|
|
104
|
+
function touch(k, e) {
|
|
105
|
+
blobs.delete(k);
|
|
106
|
+
blobs.set(k, e);
|
|
107
|
+
}
|
|
108
|
+
function acquireMedia2(k, load) {
|
|
109
|
+
let e = blobs.get(k);
|
|
110
|
+
if (!e) {
|
|
111
|
+
const entry = { refs: 0, promise: Promise.resolve(``) };
|
|
112
|
+
entry.promise = load().then((url) => {
|
|
113
|
+
entry.url = url;
|
|
114
|
+
if (blobs.get(k) !== entry)
|
|
115
|
+
URL.revokeObjectURL(url);
|
|
116
|
+
return url;
|
|
117
|
+
});
|
|
118
|
+
entry.promise.catch(() => {
|
|
119
|
+
if (blobs.get(k) === entry)
|
|
120
|
+
blobs.delete(k);
|
|
121
|
+
});
|
|
122
|
+
e = entry;
|
|
123
|
+
}
|
|
124
|
+
e.refs += 1;
|
|
125
|
+
touch(k, e);
|
|
126
|
+
return e;
|
|
127
|
+
}
|
|
128
|
+
function releaseMedia2(k, e) {
|
|
129
|
+
e.refs -= 1;
|
|
130
|
+
if (e.refs > 0 || blobs.get(k) !== e)
|
|
131
|
+
return;
|
|
132
|
+
touch(k, e);
|
|
133
|
+
let idle = 0;
|
|
134
|
+
for (const v of blobs.values())
|
|
135
|
+
if (v.refs === 0)
|
|
136
|
+
idle += 1;
|
|
137
|
+
for (const [ok, v] of blobs) {
|
|
138
|
+
if (idle <= MEDIA_CACHE_IDLE_MAX2)
|
|
139
|
+
break;
|
|
140
|
+
if (v.refs > 0)
|
|
141
|
+
continue;
|
|
142
|
+
blobs.delete(ok);
|
|
143
|
+
if (v.url)
|
|
144
|
+
URL.revokeObjectURL(v.url);
|
|
145
|
+
idle -= 1;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
function mediaCacheStats2() {
|
|
149
|
+
let inUse = 0;
|
|
150
|
+
for (const v of blobs.values())
|
|
151
|
+
if (v.refs > 0)
|
|
152
|
+
inUse += 1;
|
|
153
|
+
return { entries: blobs.size, inUse };
|
|
154
|
+
}
|
|
155
|
+
function clearMediaCache2() {
|
|
156
|
+
for (const [k, v] of blobs) {
|
|
157
|
+
if (v.refs > 0)
|
|
158
|
+
continue;
|
|
159
|
+
blobs.delete(k);
|
|
160
|
+
if (v.url)
|
|
161
|
+
URL.revokeObjectURL(v.url);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
function openMediaSource2(host, src, kind = `image`) {
|
|
165
|
+
const req = mediaRequestOf2(host, src);
|
|
166
|
+
const headers = req?.headers ?? {};
|
|
167
|
+
const fetched = req !== null && Object.keys(headers).length > 0;
|
|
168
|
+
const k = fetched ? `${kind}
|
|
169
|
+
${mediaCacheKey2(req.url, headers)}` : ``;
|
|
170
|
+
return {
|
|
171
|
+
fetched,
|
|
172
|
+
key: k,
|
|
173
|
+
direct: req ? req.url : undefined,
|
|
174
|
+
denied: Boolean(src) && req === null,
|
|
175
|
+
open: () => {
|
|
176
|
+
if (!req || !fetched)
|
|
177
|
+
return { promise: Promise.resolve(req ? req.url : ``), release: () => {} };
|
|
178
|
+
const hosted = kind === `stream` && host.mediaStreamUrl !== undefined;
|
|
179
|
+
const allowed = (url) => mediaUrlAllowed2(host, url);
|
|
180
|
+
const entry = hosted ? streamEntry2(host, req) : acquireMedia2(k, () => (kind === `stream` ? fetchStream2(req.url, headers, MEDIA_LIMITS, allowed) : fetchLimited2(req.url, headers, MEDIA_LIMITS, true, allowed)).then((b) => URL.createObjectURL(b)));
|
|
181
|
+
return { promise: entry.promise, release: hosted ? () => {} : () => releaseMedia2(k, entry) };
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
function streamEntry2(host, req) {
|
|
186
|
+
const promise = Promise.resolve(host.mediaStreamUrl(req)).then((url) => {
|
|
187
|
+
if (typeof url !== `string` || !mediaUrlAllowed2(host, url))
|
|
188
|
+
throw new Error(`stream url denied by the media policy`);
|
|
189
|
+
return url;
|
|
190
|
+
});
|
|
191
|
+
return { promise, refs: 0 };
|
|
192
|
+
}
|
|
193
|
+
function fetchStream2(url, headers, limits = MEDIA_LIMITS, allowed = defaultAllowed) {
|
|
194
|
+
return fetchLimited2(url, headers, { ...limits, maxPixels: Infinity }, false, allowed);
|
|
195
|
+
}
|
|
196
|
+
function defaultAllowed(url) {
|
|
197
|
+
return mediaUrlAllowed2({}, url);
|
|
198
|
+
}
|
|
199
|
+
async function fetchLimited2(url, headers, limits = MEDIA_LIMITS, image = true, allowed = defaultAllowed) {
|
|
200
|
+
const abort = new AbortController;
|
|
201
|
+
const timer = setTimeout(() => abort.abort(new Error(`media timed out after ${limits.timeoutMs} ms`)), limits.timeoutMs);
|
|
202
|
+
const over = () => new Error(`media is over ${limits.maxBytes} bytes`);
|
|
203
|
+
try {
|
|
204
|
+
const r = await fetch(url, { headers, signal: abort.signal });
|
|
205
|
+
if (r.redirected && !allowed(r.url)) {
|
|
206
|
+
abort.abort();
|
|
207
|
+
throw new Error(`media redirect denied by the media policy`);
|
|
208
|
+
}
|
|
209
|
+
if (!r.ok)
|
|
210
|
+
throw new Error(`HTTP ${r.status}`);
|
|
211
|
+
if (Number(r.headers.get(`content-length`) ?? NaN) > limits.maxBytes)
|
|
212
|
+
throw over();
|
|
213
|
+
const chunks = [];
|
|
214
|
+
let total = 0;
|
|
215
|
+
if (r.body) {
|
|
216
|
+
const reader = r.body.getReader();
|
|
217
|
+
for (;; ) {
|
|
218
|
+
const { done, value } = await reader.read();
|
|
219
|
+
if (done)
|
|
220
|
+
break;
|
|
221
|
+
total += value.byteLength;
|
|
222
|
+
if (total > limits.maxBytes) {
|
|
223
|
+
abort.abort();
|
|
224
|
+
throw over();
|
|
225
|
+
}
|
|
226
|
+
chunks.push(value);
|
|
227
|
+
}
|
|
228
|
+
} else {
|
|
229
|
+
const all = new Uint8Array(await r.arrayBuffer());
|
|
230
|
+
if (all.byteLength > limits.maxBytes)
|
|
231
|
+
throw over();
|
|
232
|
+
chunks.push(all);
|
|
233
|
+
}
|
|
234
|
+
if (image) {
|
|
235
|
+
const refused = mediaImageWithinLimits(chunks.length === 1 ? chunks[0] : concat(chunks), limits);
|
|
236
|
+
if (refused)
|
|
237
|
+
throw new Error(refused);
|
|
238
|
+
}
|
|
239
|
+
return new Blob(chunks, { type: r.headers.get(`content-type`) ?? `` });
|
|
240
|
+
} finally {
|
|
241
|
+
clearTimeout(timer);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
function concat(chunks) {
|
|
245
|
+
const out = new Uint8Array(chunks.reduce((n, c) => n + c.byteLength, 0));
|
|
246
|
+
let at = 0;
|
|
247
|
+
for (const c of chunks) {
|
|
248
|
+
out.set(c, at);
|
|
249
|
+
at += c.byteLength;
|
|
250
|
+
}
|
|
251
|
+
return out;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
// packages/exponential-ui/src/web/primitives/measure.ts
|
|
255
|
+
var near = (a, b) => Math.abs(a - b) < 1;
|
|
256
|
+
var unit = (v) => Math.round(v * 64) / 64;
|
|
257
|
+
var sized = (width, height) => ({ width: unit(width), height: unit(height) });
|
|
258
|
+
function layoutSize2(el, entry) {
|
|
259
|
+
const r = el.getBoundingClientRect();
|
|
260
|
+
const ow = el.offsetWidth;
|
|
261
|
+
const oh = el.offsetHeight;
|
|
262
|
+
if (ow === 0 && oh === 0)
|
|
263
|
+
return { width: r.width, height: r.height };
|
|
264
|
+
if (near(r.width, ow) && near(r.height, oh))
|
|
265
|
+
return { width: r.width, height: r.height };
|
|
266
|
+
const box = entry?.borderBoxSize?.[0];
|
|
267
|
+
if (box) {
|
|
268
|
+
if (near(box.inlineSize, ow) && near(box.blockSize, oh))
|
|
269
|
+
return sized(box.inlineSize, box.blockSize);
|
|
270
|
+
if (near(box.blockSize, ow) && near(box.inlineSize, oh))
|
|
271
|
+
return sized(box.blockSize, box.inlineSize);
|
|
272
|
+
}
|
|
273
|
+
const zoom = el.currentCSSZoom;
|
|
274
|
+
if (zoom && zoom !== 1 && near(r.width / zoom, ow) && near(r.height / zoom, oh))
|
|
275
|
+
return sized(r.width / zoom, r.height / zoom);
|
|
276
|
+
return { width: ow, height: oh };
|
|
277
|
+
}
|
|
278
|
+
function visualScale2(visual, layout) {
|
|
279
|
+
return layout > 0 && !near(visual, layout) ? visual / layout : 1;
|
|
280
|
+
}
|
|
281
|
+
function elementScale2(el, rect = el.getBoundingClientRect()) {
|
|
282
|
+
return { x: visualScale2(rect.width, el.offsetWidth), y: visualScale2(rect.height, el.offsetHeight) };
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
// packages/exponential-ui/src/web/primitives/voice-wave.ts
|
|
286
|
+
var VOICE_WAVE_SIZES2 = [`sm`, `md`, `lg`, `xl`];
|
|
287
|
+
var VOICE_WAVE_SIZE_PX2 = { sm: 32, md: 56, lg: 160, xl: 200 };
|
|
288
|
+
function voiceWaveAnimates2(activity) {
|
|
289
|
+
return activity === `listening` || activity === `thinking` || activity === `speaking`;
|
|
290
|
+
}
|
|
291
|
+
function voiceWaveQuiet2(activity) {
|
|
292
|
+
return !voiceWaveAnimates2(activity);
|
|
293
|
+
}
|
|
294
|
+
var NAMED = [`idle`, `listening`, `thinking`, `speaking`, `muted`];
|
|
295
|
+
function voiceWaveName2(label, activity) {
|
|
296
|
+
return label ? `${label}, ${NAMED.includes(activity) ? activity : `idle`}` : undefined;
|
|
297
|
+
}
|
|
298
|
+
function voiceWaveClock2(onFrame) {
|
|
299
|
+
if (typeof requestAnimationFrame !== `function`)
|
|
300
|
+
return () => {};
|
|
301
|
+
let start = null;
|
|
302
|
+
let id = 0;
|
|
303
|
+
const tick = (now) => {
|
|
304
|
+
if (start === null)
|
|
305
|
+
start = now;
|
|
306
|
+
else
|
|
307
|
+
onFrame((now - start) / 1000);
|
|
308
|
+
id = requestAnimationFrame(tick);
|
|
309
|
+
};
|
|
310
|
+
id = requestAnimationFrame(tick);
|
|
311
|
+
return () => cancelAnimationFrame(id);
|
|
312
|
+
}
|
|
313
|
+
function voiceWaveFitChild2(el, scaleOf) {
|
|
314
|
+
const apply = (width, height) => {
|
|
315
|
+
const s = scaleOf({ width, height });
|
|
316
|
+
el.style.transform = s === 1 ? `` : `scale(${s})`;
|
|
317
|
+
};
|
|
318
|
+
if (typeof ResizeObserver !== `function`) {
|
|
319
|
+
apply(el.offsetWidth, el.offsetHeight);
|
|
320
|
+
return () => {};
|
|
321
|
+
}
|
|
322
|
+
const ro = new ResizeObserver((entries) => {
|
|
323
|
+
const e = entries[entries.length - 1];
|
|
324
|
+
const b = e.borderBoxSize?.[0];
|
|
325
|
+
if (b)
|
|
326
|
+
apply(b.inlineSize, b.blockSize);
|
|
327
|
+
else
|
|
328
|
+
apply(el.offsetWidth, el.offsetHeight);
|
|
329
|
+
});
|
|
330
|
+
ro.observe(el, { box: `border-box` });
|
|
331
|
+
return () => ro.disconnect();
|
|
332
|
+
}
|
|
333
|
+
var VOICE_WAVE_CLASSES2 = {
|
|
334
|
+
root: `relative inline-flex shrink-0 items-center justify-center`,
|
|
335
|
+
quiet: `opacity-35`,
|
|
336
|
+
size: { sm: `size-8`, md: `size-14`, lg: `size-40`, xl: `size-50` },
|
|
337
|
+
svg: `pointer-events-none absolute inset-0 size-full overflow-visible`,
|
|
338
|
+
ring: { outer: `text-blue-500`, mid: `text-primary`, inner: `text-primary` },
|
|
339
|
+
ringQuiet: `text-muted-foreground`,
|
|
340
|
+
child: `relative flex shrink-0 items-center justify-center text-foreground`,
|
|
341
|
+
childHidden: `invisible pointer-events-none`,
|
|
342
|
+
childMuted: `text-muted-foreground`
|
|
343
|
+
};
|
|
344
|
+
|
|
345
|
+
// packages/exponential-ui/src/web/primitives/motion.ts
|
|
346
|
+
import { MEDIA_LIMITS as MEDIA_LIMITS2, parseColor, resolveToken } from "@exponential_app/eui";
|
|
347
|
+
|
|
348
|
+
// packages/exponential-ui/src/web/primitives/motion-paint.ts
|
|
349
|
+
var MOTION_PACKED_VERSION = 1;
|
|
350
|
+
var BLENDS = [
|
|
351
|
+
`source-over`,
|
|
352
|
+
`multiply`,
|
|
353
|
+
`screen`,
|
|
354
|
+
`overlay`,
|
|
355
|
+
`darken`,
|
|
356
|
+
`lighten`,
|
|
357
|
+
`color-dodge`,
|
|
358
|
+
`color-burn`,
|
|
359
|
+
`hard-light`,
|
|
360
|
+
`soft-light`,
|
|
361
|
+
`difference`,
|
|
362
|
+
`exclusion`,
|
|
363
|
+
`hue`,
|
|
364
|
+
`saturation`,
|
|
365
|
+
`color`,
|
|
366
|
+
`luminosity`,
|
|
367
|
+
`destination-in`,
|
|
368
|
+
`destination-out`,
|
|
369
|
+
`destination-in`,
|
|
370
|
+
`destination-out`,
|
|
371
|
+
`xor`
|
|
372
|
+
];
|
|
373
|
+
var LUMA_IN = 18;
|
|
374
|
+
var LUMA_OUT = 19;
|
|
375
|
+
var CAPS = [`butt`, `round`, `square`];
|
|
376
|
+
var JOINS = [`miter`, `round`, `bevel`];
|
|
377
|
+
function motionFitMatrix2(cw, ch, bw, bh, fit = `contain`) {
|
|
378
|
+
if (!(cw > 0) || !(ch > 0))
|
|
379
|
+
return [1, 0, 0, 1, 0, 0];
|
|
380
|
+
if (fit === `fill`)
|
|
381
|
+
return [bw / cw, 0, 0, bh / ch, 0, 0];
|
|
382
|
+
const s = fit === `cover` ? Math.max(bw / cw, bh / ch) : Math.min(bw / cw, bh / ch);
|
|
383
|
+
return [s, 0, 0, s, (bw - cw * s) / 2, (bh - ch * s) / 2];
|
|
384
|
+
}
|
|
385
|
+
function motionConcat2(a, b) {
|
|
386
|
+
return [a[0] * b[0] + a[2] * b[1], a[1] * b[0] + a[3] * b[1], a[0] * b[2] + a[2] * b[3], a[1] * b[2] + a[3] * b[3], a[0] * b[4] + a[2] * b[5] + a[4], a[1] * b[4] + a[3] * b[5] + a[5]];
|
|
387
|
+
}
|
|
388
|
+
function motionFrameSize2(packed) {
|
|
389
|
+
return { width: Number(packed[1]) || 0, height: Number(packed[2]) || 0 };
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
class MotionCanvasPool2 {
|
|
393
|
+
make;
|
|
394
|
+
free = [];
|
|
395
|
+
constructor(make = defaultCanvas) {
|
|
396
|
+
this.make = make;
|
|
397
|
+
}
|
|
398
|
+
take(w, h) {
|
|
399
|
+
let c = this.free.pop() ?? this.make(w, h);
|
|
400
|
+
if (!c)
|
|
401
|
+
return null;
|
|
402
|
+
if (c.width !== w || c.height !== h) {
|
|
403
|
+
c.width = w;
|
|
404
|
+
c.height = h;
|
|
405
|
+
}
|
|
406
|
+
const ctx = c.getContext(`2d`);
|
|
407
|
+
if (!ctx)
|
|
408
|
+
return null;
|
|
409
|
+
ctx.setTransform(1, 0, 0, 1, 0, 0);
|
|
410
|
+
ctx.globalAlpha = 1;
|
|
411
|
+
ctx.globalCompositeOperation = `source-over`;
|
|
412
|
+
ctx.clearRect(0, 0, w, h);
|
|
413
|
+
return { canvas: c, ctx };
|
|
414
|
+
}
|
|
415
|
+
give(c) {
|
|
416
|
+
if (this.free.length < 8)
|
|
417
|
+
this.free.push(c);
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
function defaultCanvas(w, h) {
|
|
421
|
+
if (typeof OffscreenCanvas === `function`)
|
|
422
|
+
return new OffscreenCanvas(w, h);
|
|
423
|
+
if (typeof document === `undefined`)
|
|
424
|
+
return null;
|
|
425
|
+
const c = document.createElement(`canvas`);
|
|
426
|
+
c.width = w;
|
|
427
|
+
c.height = h;
|
|
428
|
+
return c;
|
|
429
|
+
}
|
|
430
|
+
function paintMotionFrame2(ctx, width, height, packed, base, images = [], pool = new MotionCanvasPool2) {
|
|
431
|
+
ctx.setTransform(1, 0, 0, 1, 0, 0);
|
|
432
|
+
ctx.globalAlpha = 1;
|
|
433
|
+
ctx.globalCompositeOperation = `source-over`;
|
|
434
|
+
ctx.clearRect(0, 0, width, height);
|
|
435
|
+
if (packed[0] !== MOTION_PACKED_VERSION)
|
|
436
|
+
return false;
|
|
437
|
+
const scale = Math.sqrt(Math.abs(base[0] * base[3] - base[1] * base[2]));
|
|
438
|
+
let i = 3;
|
|
439
|
+
const n = packed.length;
|
|
440
|
+
const f = () => Number(packed[i++]);
|
|
441
|
+
const mat = () => [f(), f(), f(), f(), f(), f()];
|
|
442
|
+
const readPath = () => {
|
|
443
|
+
const count = f();
|
|
444
|
+
const p = typeof Path2D === `function` ? new Path2D : null;
|
|
445
|
+
let any = false;
|
|
446
|
+
for (let k = 0;k < count; k++) {
|
|
447
|
+
const v = f();
|
|
448
|
+
if (v === 0) {
|
|
449
|
+
const x = f(), y = f();
|
|
450
|
+
p?.moveTo(x, y);
|
|
451
|
+
any = true;
|
|
452
|
+
} else if (v === 1) {
|
|
453
|
+
const x = f(), y = f();
|
|
454
|
+
p?.lineTo(x, y);
|
|
455
|
+
any = true;
|
|
456
|
+
} else if (v === 2) {
|
|
457
|
+
const x1 = f(), y1 = f(), x2 = f(), y2 = f(), x = f(), y = f();
|
|
458
|
+
p?.bezierCurveTo(x1, y1, x2, y2, x, y);
|
|
459
|
+
any = true;
|
|
460
|
+
} else
|
|
461
|
+
p?.closePath();
|
|
462
|
+
}
|
|
463
|
+
return any ? p : null;
|
|
464
|
+
};
|
|
465
|
+
const readStops = () => {
|
|
466
|
+
const count = f();
|
|
467
|
+
const out = [];
|
|
468
|
+
for (let k = 0;k < count; k++)
|
|
469
|
+
out.push({ offset: f(), color: [f(), f(), f(), f()] });
|
|
470
|
+
return out;
|
|
471
|
+
};
|
|
472
|
+
const readBrush = () => {
|
|
473
|
+
const kind = f();
|
|
474
|
+
if (kind === 1)
|
|
475
|
+
return { kind: 1, x0: f(), y0: f(), x1: f(), y1: f(), stops: readStops() };
|
|
476
|
+
if (kind === 2)
|
|
477
|
+
return { kind: 2, cx: f(), cy: f(), fx: f(), fy: f(), r: f(), stops: readStops() };
|
|
478
|
+
return { kind: 0, color: [f(), f(), f(), f()] };
|
|
479
|
+
};
|
|
480
|
+
const readFilters = () => {
|
|
481
|
+
const count = f();
|
|
482
|
+
const out = [];
|
|
483
|
+
for (let k = 0;k < count; k++) {
|
|
484
|
+
const kind = f();
|
|
485
|
+
if (kind === 0)
|
|
486
|
+
out.push({ kind: 0, sx: f(), sy: f() });
|
|
487
|
+
else if (kind === 1) {
|
|
488
|
+
const m = [];
|
|
489
|
+
for (let j = 0;j < 20; j++)
|
|
490
|
+
m.push(f());
|
|
491
|
+
out.push({ kind: 1, m });
|
|
492
|
+
} else if (kind === 2)
|
|
493
|
+
out.push({ kind: 2, amount: f(), stops: readStops() });
|
|
494
|
+
else
|
|
495
|
+
out.push({ kind: 3, color: [f(), f(), f(), f()], dx: f(), dy: f(), sigma: f() });
|
|
496
|
+
}
|
|
497
|
+
return out;
|
|
498
|
+
};
|
|
499
|
+
const clips = [];
|
|
500
|
+
const stack = [];
|
|
501
|
+
const top = () => {
|
|
502
|
+
for (let k = stack.length - 1;k >= 0; k--) {
|
|
503
|
+
const fr = stack[k];
|
|
504
|
+
if (fr.kind === `layer`)
|
|
505
|
+
return fr.ctx;
|
|
506
|
+
}
|
|
507
|
+
return ctx;
|
|
508
|
+
};
|
|
509
|
+
const applyClips = (c, list) => {
|
|
510
|
+
for (const clip of list) {
|
|
511
|
+
if (!clip.path)
|
|
512
|
+
return false;
|
|
513
|
+
const m = motionConcat2(base, clip.m);
|
|
514
|
+
c.setTransform(m[0], m[1], m[2], m[3], m[4], m[5]);
|
|
515
|
+
c.clip(clip.path, `nonzero`);
|
|
516
|
+
}
|
|
517
|
+
return true;
|
|
518
|
+
};
|
|
519
|
+
const setStyle = (c, brush, stroke) => {
|
|
520
|
+
let style;
|
|
521
|
+
if (brush.kind === 0)
|
|
522
|
+
style = css(brush.color);
|
|
523
|
+
else {
|
|
524
|
+
const g = brush.kind === 1 ? c.createLinearGradient(brush.x0, brush.y0, brush.x1, brush.y1) : c.createRadialGradient(brush.fx, brush.fy, 0, brush.cx, brush.cy, Math.max(0, brush.r));
|
|
525
|
+
let last = 0;
|
|
526
|
+
for (const s of brush.stops) {
|
|
527
|
+
last = Math.max(last, clamp01(s.offset));
|
|
528
|
+
g.addColorStop(last, css(s.color));
|
|
529
|
+
}
|
|
530
|
+
style = g;
|
|
531
|
+
}
|
|
532
|
+
if (stroke)
|
|
533
|
+
c.strokeStyle = style;
|
|
534
|
+
else
|
|
535
|
+
c.fillStyle = style;
|
|
536
|
+
};
|
|
537
|
+
while (i < n) {
|
|
538
|
+
const op = f();
|
|
539
|
+
if (op === 1) {
|
|
540
|
+
const blend = f();
|
|
541
|
+
const alpha = f();
|
|
542
|
+
const t = mat();
|
|
543
|
+
const path = readPath();
|
|
544
|
+
const filters = readFilters();
|
|
545
|
+
const group = pool.take(width, height);
|
|
546
|
+
const clip = { m: t, path };
|
|
547
|
+
if (!group)
|
|
548
|
+
return false;
|
|
549
|
+
stack.push({ kind: `layer`, clips: clips.length, canvas: group.canvas, ctx: group.ctx, blend, alpha, filters, clip });
|
|
550
|
+
clips.push(clip);
|
|
551
|
+
} else if (op === 2) {
|
|
552
|
+
const t = mat();
|
|
553
|
+
const path = readPath();
|
|
554
|
+
stack.push({ kind: `clip`, clips: clips.length });
|
|
555
|
+
clips.push({ m: t, path });
|
|
556
|
+
} else if (op === 3) {
|
|
557
|
+
const fr = stack.pop();
|
|
558
|
+
if (!fr)
|
|
559
|
+
continue;
|
|
560
|
+
clips.length = fr.clips;
|
|
561
|
+
if (fr.kind === `clip`)
|
|
562
|
+
continue;
|
|
563
|
+
const dst = top();
|
|
564
|
+
const needsPixels = fr.blend === LUMA_IN || fr.blend === LUMA_OUT || fr.filters.length > 0;
|
|
565
|
+
if (needsPixels) {
|
|
566
|
+
const img = fr.ctx.getImageData(0, 0, width, height);
|
|
567
|
+
const px = premultiply(img.data);
|
|
568
|
+
if (fr.blend === LUMA_IN || fr.blend === LUMA_OUT)
|
|
569
|
+
lumaMask(px);
|
|
570
|
+
applyFilters(px, width, height, fr.filters, base, scale);
|
|
571
|
+
unpremultiply(px, img.data);
|
|
572
|
+
fr.ctx.putImageData(img, 0, 0);
|
|
573
|
+
}
|
|
574
|
+
dst.save();
|
|
575
|
+
if (applyClips(dst, [...clips, fr.clip])) {
|
|
576
|
+
dst.setTransform(1, 0, 0, 1, 0, 0);
|
|
577
|
+
dst.globalAlpha = clamp01(fr.alpha);
|
|
578
|
+
dst.globalCompositeOperation = BLENDS[fr.blend] ?? `source-over`;
|
|
579
|
+
dst.drawImage(fr.canvas, 0, 0);
|
|
580
|
+
}
|
|
581
|
+
dst.restore();
|
|
582
|
+
pool.give(fr.canvas);
|
|
583
|
+
} else if (op === 4 || op === 5) {
|
|
584
|
+
const t = mat();
|
|
585
|
+
let rule = `nonzero`;
|
|
586
|
+
let width_ = 0, cap = 0, join = 0, miter = 4, dashOffset = 0;
|
|
587
|
+
let dashes = [];
|
|
588
|
+
if (op === 4)
|
|
589
|
+
rule = f() === 1 ? `evenodd` : `nonzero`;
|
|
590
|
+
else {
|
|
591
|
+
width_ = f();
|
|
592
|
+
cap = f();
|
|
593
|
+
join = f();
|
|
594
|
+
miter = f();
|
|
595
|
+
dashOffset = f();
|
|
596
|
+
const dn = f();
|
|
597
|
+
for (let k = 0;k < dn; k++)
|
|
598
|
+
dashes.push(f());
|
|
599
|
+
}
|
|
600
|
+
const brush = readBrush();
|
|
601
|
+
const path = readPath();
|
|
602
|
+
if (!path)
|
|
603
|
+
continue;
|
|
604
|
+
const c = top();
|
|
605
|
+
c.save();
|
|
606
|
+
if (applyClips(c, clips)) {
|
|
607
|
+
const m = motionConcat2(base, t);
|
|
608
|
+
c.setTransform(m[0], m[1], m[2], m[3], m[4], m[5]);
|
|
609
|
+
setStyle(c, brush, op === 5);
|
|
610
|
+
if (op === 4)
|
|
611
|
+
c.fill(path, rule);
|
|
612
|
+
else if (width_ > 0) {
|
|
613
|
+
c.lineWidth = width_;
|
|
614
|
+
c.lineCap = CAPS[cap] ?? `butt`;
|
|
615
|
+
c.lineJoin = JOINS[join] ?? `miter`;
|
|
616
|
+
c.miterLimit = miter > 0 ? miter : 4;
|
|
617
|
+
if (dashes.length && dashes.every((d) => d >= 0 && Number.isFinite(d)) && dashes.some((d) => d > 0)) {
|
|
618
|
+
c.setLineDash(dashes);
|
|
619
|
+
c.lineDashOffset = dashOffset;
|
|
620
|
+
}
|
|
621
|
+
c.stroke(path);
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
c.restore();
|
|
625
|
+
} else if (op === 6) {
|
|
626
|
+
const t = mat();
|
|
627
|
+
const asset = f();
|
|
628
|
+
const alpha = f();
|
|
629
|
+
const w = f();
|
|
630
|
+
const h = f();
|
|
631
|
+
const img = images[asset];
|
|
632
|
+
if (!img || !img.width || !img.height)
|
|
633
|
+
continue;
|
|
634
|
+
const c = top();
|
|
635
|
+
c.save();
|
|
636
|
+
if (applyClips(c, clips)) {
|
|
637
|
+
const m = motionConcat2(base, t);
|
|
638
|
+
c.setTransform(m[0], m[1], m[2], m[3], m[4], m[5]);
|
|
639
|
+
c.globalAlpha = clamp01(alpha);
|
|
640
|
+
c.imageSmoothingQuality = `low`;
|
|
641
|
+
c.drawImage(img, 0, 0, w > 0 ? w : img.width, h > 0 ? h : img.height);
|
|
642
|
+
}
|
|
643
|
+
c.restore();
|
|
644
|
+
} else
|
|
645
|
+
return false;
|
|
646
|
+
}
|
|
647
|
+
return true;
|
|
648
|
+
}
|
|
649
|
+
function clamp01(v) {
|
|
650
|
+
return v < 0 ? 0 : v > 1 ? 1 : v;
|
|
651
|
+
}
|
|
652
|
+
function css(c) {
|
|
653
|
+
return `rgb(${clamp01(c[0]) * 255} ${clamp01(c[1]) * 255} ${clamp01(c[2]) * 255} / ${clamp01(c[3])})`;
|
|
654
|
+
}
|
|
655
|
+
function premultiply(src) {
|
|
656
|
+
const out = new Uint8Array(src.length);
|
|
657
|
+
for (let k = 0;k < src.length; k += 4) {
|
|
658
|
+
const a = src[k + 3];
|
|
659
|
+
out[k + 3] = a;
|
|
660
|
+
if (a === 255) {
|
|
661
|
+
out[k] = src[k];
|
|
662
|
+
out[k + 1] = src[k + 1];
|
|
663
|
+
out[k + 2] = src[k + 2];
|
|
664
|
+
} else if (a > 0) {
|
|
665
|
+
out[k] = Math.round(src[k] * a / 255);
|
|
666
|
+
out[k + 1] = Math.round(src[k + 1] * a / 255);
|
|
667
|
+
out[k + 2] = Math.round(src[k + 2] * a / 255);
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
return out;
|
|
671
|
+
}
|
|
672
|
+
function unpremultiply(src, out) {
|
|
673
|
+
for (let k = 0;k < src.length; k += 4) {
|
|
674
|
+
const a = src[k + 3];
|
|
675
|
+
out[k + 3] = a;
|
|
676
|
+
if (a === 0) {
|
|
677
|
+
out[k] = out[k + 1] = out[k + 2] = 0;
|
|
678
|
+
} else {
|
|
679
|
+
out[k] = Math.round(src[k] * 255 / a);
|
|
680
|
+
out[k + 1] = Math.round(src[k + 1] * 255 / a);
|
|
681
|
+
out[k + 2] = Math.round(src[k + 2] * 255 / a);
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
function lumaMask(p) {
|
|
686
|
+
for (let k = 0;k < p.length; k += 4) {
|
|
687
|
+
const l = Math.max(0, Math.min(255, Math.round(0.2125 * p[k] + 0.7154 * p[k + 1] + 0.0721 * p[k + 2])));
|
|
688
|
+
p[k] = p[k + 1] = p[k + 2] = p[k + 3] = l;
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
function applyFilters(p, w, h, filters, base, scale) {
|
|
692
|
+
for (const fl of filters) {
|
|
693
|
+
if (fl.kind === 0)
|
|
694
|
+
blur(p, w, h, 4, fl.sx * scale, fl.sy * scale);
|
|
695
|
+
else if (fl.kind === 1)
|
|
696
|
+
colorMatrix(p, fl.m);
|
|
697
|
+
else if (fl.kind === 2)
|
|
698
|
+
gradientMap(p, fl.stops, fl.amount);
|
|
699
|
+
else {
|
|
700
|
+
const ddx = base[0] * fl.dx + base[2] * fl.dy;
|
|
701
|
+
const ddy = base[1] * fl.dx + base[3] * fl.dy;
|
|
702
|
+
dropShadow(p, w, h, fl.color, ddx, ddy, fl.sigma * scale);
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
var BOX_SIGMA = 2;
|
|
707
|
+
var div255 = (x) => {
|
|
708
|
+
const v = x + 128;
|
|
709
|
+
return v + (v >> 8) >> 8;
|
|
710
|
+
};
|
|
711
|
+
function boxSize(sigma) {
|
|
712
|
+
return Math.max(0, Math.floor(sigma * 3 * Math.sqrt(2 * Math.PI) / 4 + 0.5));
|
|
713
|
+
}
|
|
714
|
+
function passes(sigma) {
|
|
715
|
+
if (sigma < BOX_SIGMA) {
|
|
716
|
+
const r = Math.ceil(3 * sigma);
|
|
717
|
+
const ws = [];
|
|
718
|
+
for (let k = 0;k <= 2 * r; k++) {
|
|
719
|
+
const x = k - r;
|
|
720
|
+
ws.push(Math.exp(-x * x / (2 * sigma * sigma)));
|
|
721
|
+
}
|
|
722
|
+
const sum = ws.reduce((a, b) => a + b, 0);
|
|
723
|
+
const kernel = new Uint32Array(ws.map((v) => Math.round(v / sum * 65536)));
|
|
724
|
+
const total = kernel.reduce((a, b) => a + b, 0);
|
|
725
|
+
kernel[r] = Math.max(0, kernel[r] + 65536 - total);
|
|
726
|
+
return [{ kernel }];
|
|
727
|
+
}
|
|
728
|
+
const d = boxSize(sigma);
|
|
729
|
+
if (d <= 1)
|
|
730
|
+
return [];
|
|
731
|
+
const r = Math.floor(d / 2);
|
|
732
|
+
return d % 2 === 1 ? [{ box: [r, r] }, { box: [r, r] }, { box: [r, r] }] : [{ box: [r, r - 1] }, { box: [r - 1, r] }, { box: [r, r] }];
|
|
733
|
+
}
|
|
734
|
+
function blur(buf, w, h, ch, sx, sy) {
|
|
735
|
+
if (!w || !h)
|
|
736
|
+
return;
|
|
737
|
+
if (sx > 0 && Number.isFinite(sx))
|
|
738
|
+
for (const p of passes(sx))
|
|
739
|
+
runPass(buf, w, h, ch, p, true);
|
|
740
|
+
if (sy > 0 && Number.isFinite(sy))
|
|
741
|
+
for (const p of passes(sy))
|
|
742
|
+
runPass(buf, w, h, ch, p, false);
|
|
743
|
+
}
|
|
744
|
+
function runPass(buf, w, h, ch, pass, horizontal) {
|
|
745
|
+
const len = horizontal ? w : h;
|
|
746
|
+
const lines = horizontal ? h : w;
|
|
747
|
+
const step = horizontal ? ch : w * ch;
|
|
748
|
+
const lineStep = horizontal ? w * ch : ch;
|
|
749
|
+
const tmp = new Uint32Array(len);
|
|
750
|
+
for (let line = 0;line < lines; line++) {
|
|
751
|
+
for (let c = 0;c < ch; c++) {
|
|
752
|
+
const o = line * lineStep + c;
|
|
753
|
+
for (let x = 0;x < len; x++)
|
|
754
|
+
tmp[x] = buf[o + x * step];
|
|
755
|
+
if (`box` in pass) {
|
|
756
|
+
const [l, r] = pass.box;
|
|
757
|
+
const d = l + r + 1;
|
|
758
|
+
const half = d >> 1;
|
|
759
|
+
let sum = 0;
|
|
760
|
+
for (let k = 0;k <= Math.min(r, len - 1); k++)
|
|
761
|
+
sum += tmp[k];
|
|
762
|
+
for (let x = 0;x < len; x++) {
|
|
763
|
+
buf[o + x * step] = Math.floor((sum + half) / d);
|
|
764
|
+
const add = x + r + 1;
|
|
765
|
+
if (add < len)
|
|
766
|
+
sum += tmp[add];
|
|
767
|
+
if (x >= l)
|
|
768
|
+
sum -= tmp[x - l];
|
|
769
|
+
}
|
|
770
|
+
} else {
|
|
771
|
+
const k = pass.kernel;
|
|
772
|
+
const r = k.length >> 1;
|
|
773
|
+
for (let x = 0;x < len; x++) {
|
|
774
|
+
const lo = Math.max(0, x - r);
|
|
775
|
+
const hi = Math.min(len - 1, x + r);
|
|
776
|
+
let acc = 0;
|
|
777
|
+
for (let s = lo;s <= hi; s++)
|
|
778
|
+
acc += k[s + r - x] * tmp[s];
|
|
779
|
+
buf[o + x * step] = Math.min(255, Math.floor((acc + 32768) / 65536));
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
var IDENTITY_MATRIX = [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0];
|
|
786
|
+
function colorMatrix(p, m) {
|
|
787
|
+
if (m.every((v, k) => Math.fround(v) === Math.fround(IDENTITY_MATRIX[k])))
|
|
788
|
+
return;
|
|
789
|
+
const clearAlpha = Math.max(0, Math.min(255, Math.round(m[19] * 255)));
|
|
790
|
+
for (let k = 0;k < p.length; k += 4) {
|
|
791
|
+
const a = p[k + 3];
|
|
792
|
+
if (a === 0 && clearAlpha === 0)
|
|
793
|
+
continue;
|
|
794
|
+
const [r, g, b, af] = a === 0 ? [0, 0, 0, 0] : [p[k] / a, p[k + 1] / a, p[k + 2] / a, a / 255];
|
|
795
|
+
const row = (j) => clamp01(m[j] * r + m[j + 1] * g + m[j + 2] * b + m[j + 3] * af + m[j + 4]);
|
|
796
|
+
const a8 = Math.round(row(15) * 255);
|
|
797
|
+
p[k] = Math.min(a8, Math.round(row(0) * a8));
|
|
798
|
+
p[k + 1] = Math.min(a8, Math.round(row(5) * a8));
|
|
799
|
+
p[k + 2] = Math.min(a8, Math.round(row(10) * a8));
|
|
800
|
+
p[k + 3] = a8;
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
function gradientMap(p, stops, amountRaw) {
|
|
804
|
+
const amount = clamp01(amountRaw);
|
|
805
|
+
if (amount <= 0 || !stops.length)
|
|
806
|
+
return;
|
|
807
|
+
const sorted = [...stops].sort((a, b) => a.offset - b.offset);
|
|
808
|
+
const first = sorted[0];
|
|
809
|
+
const last = sorted[sorted.length - 1];
|
|
810
|
+
const lut = [];
|
|
811
|
+
for (let k = 0;k < 256; k++) {
|
|
812
|
+
const t = k / 255;
|
|
813
|
+
let c = last.color;
|
|
814
|
+
if (t <= first.offset)
|
|
815
|
+
c = first.color;
|
|
816
|
+
else if (t < last.offset) {
|
|
817
|
+
for (let j = 0;j + 1 < sorted.length; j++) {
|
|
818
|
+
const a = sorted[j], b = sorted[j + 1];
|
|
819
|
+
if (t <= b.offset) {
|
|
820
|
+
const span = b.offset - a.offset;
|
|
821
|
+
const fr = span > 0 ? (t - a.offset) / span : 1;
|
|
822
|
+
c = a.color.map((v, q) => v + (b.color[q] - v) * fr);
|
|
823
|
+
break;
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
lut.push([...c]);
|
|
828
|
+
}
|
|
829
|
+
const mix = (o, nv) => clamp01(o + (clamp01(nv) - o) * amount);
|
|
830
|
+
for (let k = 0;k < p.length; k += 4) {
|
|
831
|
+
const a = p[k + 3];
|
|
832
|
+
if (a === 0)
|
|
833
|
+
continue;
|
|
834
|
+
const r = p[k] / a, g = p[k + 1] / a, b = p[k + 2] / a;
|
|
835
|
+
const l = clamp01(0.2126 * r + 0.7152 * g + 0.0722 * b);
|
|
836
|
+
const c = lut[Math.round(l * 255)];
|
|
837
|
+
const a8 = Math.round(clamp01(a / 255 * (1 + (clamp01(c[3]) - 1) * amount)) * 255);
|
|
838
|
+
p[k] = Math.min(a8, Math.round(mix(r, c[0]) * a8));
|
|
839
|
+
p[k + 1] = Math.min(a8, Math.round(mix(g, c[1]) * a8));
|
|
840
|
+
p[k + 2] = Math.min(a8, Math.round(mix(b, c[2]) * a8));
|
|
841
|
+
p[k + 3] = a8;
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
function dropShadow(p, w, h, color, dxRaw, dyRaw, sigma) {
|
|
845
|
+
const ok = Number.isFinite(dxRaw) && Number.isFinite(dyRaw);
|
|
846
|
+
const dx = ok ? dxRaw : 0;
|
|
847
|
+
const dy = ok ? dyRaw : 0;
|
|
848
|
+
const ix = Math.floor(dx), iy = Math.floor(dy);
|
|
849
|
+
const wx1 = Math.round((dx - ix) * 256), wy1 = Math.round((dy - iy) * 256);
|
|
850
|
+
const wx0 = 256 - wx1, wy0 = 256 - wy1;
|
|
851
|
+
const at = (x, y) => x < 0 || y < 0 || x >= w || y >= h ? 0 : p[(y * w + x) * 4 + 3];
|
|
852
|
+
const shifted = new Uint8Array(w * h);
|
|
853
|
+
for (let y = 0;y < h; y++) {
|
|
854
|
+
for (let x = 0;x < w; x++) {
|
|
855
|
+
const sx = x - ix, sy = y - iy;
|
|
856
|
+
const v = (at(sx, sy) * wx0 + at(sx - 1, sy) * wx1) * wy0 + (at(sx, sy - 1) * wx0 + at(sx - 1, sy - 1) * wx1) * wy1;
|
|
857
|
+
shifted[y * w + x] = Math.min(255, Math.floor((v + 32768) / 65536));
|
|
858
|
+
}
|
|
859
|
+
}
|
|
860
|
+
blur(shifted, w, h, 1, sigma, sigma);
|
|
861
|
+
const ca = clamp01(color[3]);
|
|
862
|
+
const rgb = [clamp01(color[0]), clamp01(color[1]), clamp01(color[2])];
|
|
863
|
+
for (let k = 0;k < w * h; k++) {
|
|
864
|
+
const o = k * 4;
|
|
865
|
+
const sa = p[o + 3];
|
|
866
|
+
const a = shifted[k];
|
|
867
|
+
let sr = 0, sg = 0, sb = 0, s8 = 0;
|
|
868
|
+
if (a) {
|
|
869
|
+
s8 = Math.min(255, Math.round(a * ca));
|
|
870
|
+
sr = Math.round(rgb[0] * s8);
|
|
871
|
+
sg = Math.round(rgb[1] * s8);
|
|
872
|
+
sb = Math.round(rgb[2] * s8);
|
|
873
|
+
}
|
|
874
|
+
const inv = 255 - sa;
|
|
875
|
+
p[o] = Math.min(255, p[o] + div255(sr * inv));
|
|
876
|
+
p[o + 1] = Math.min(255, p[o + 1] + div255(sg * inv));
|
|
877
|
+
p[o + 2] = Math.min(255, p[o + 2] + div255(sb * inv));
|
|
878
|
+
p[o + 3] = Math.min(255, sa + div255(s8 * inv));
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
// packages/exponential-ui/src/web/primitives/motion.ts
|
|
883
|
+
var MOTION_MAX_PLAYING2 = 8;
|
|
884
|
+
var MOTION_MAX_FPS2 = 60;
|
|
885
|
+
var DIALECT_KEYS = [`size`, `fps`, `duration`, `start`, `time`, `name`, `layers`, `assets`, `markers`];
|
|
886
|
+
var PLAYBACK_KEYS = [`autoplay`, `loop`, `plays`, `direction`, `speed`, `segment`, `marker`, `poster`];
|
|
887
|
+
var isObj = (v) => typeof v === `object` && v !== null && !Array.isArray(v);
|
|
888
|
+
function motionDeclaredSize2(props) {
|
|
889
|
+
if (Array.isArray(props.layers)) {
|
|
890
|
+
const s = props.size;
|
|
891
|
+
if (Array.isArray(s) && typeof s[0] === `number` && typeof s[1] === `number` && s[0] > 0 && s[1] > 0)
|
|
892
|
+
return [s[0], s[1]];
|
|
893
|
+
return null;
|
|
894
|
+
}
|
|
895
|
+
if (isObj(props.lottie)) {
|
|
896
|
+
const { w, h } = props.lottie;
|
|
897
|
+
if (typeof w === `number` && typeof h === `number` && w > 0 && h > 0)
|
|
898
|
+
return [w, h];
|
|
899
|
+
}
|
|
900
|
+
return null;
|
|
901
|
+
}
|
|
902
|
+
function motionBoxStyle2(size, nodeStyle) {
|
|
903
|
+
const style = isObj(nodeStyle) ? nodeStyle : {};
|
|
904
|
+
const hasW = style.width !== undefined;
|
|
905
|
+
const hasH = style.height !== undefined;
|
|
906
|
+
const out = {};
|
|
907
|
+
if (!size)
|
|
908
|
+
return out;
|
|
909
|
+
if (!hasW && !hasH) {
|
|
910
|
+
out.width = `${size[0]}px`;
|
|
911
|
+
out.maxWidth = `100%`;
|
|
912
|
+
}
|
|
913
|
+
if (!(hasW && hasH))
|
|
914
|
+
out.aspectRatio = `${size[0]} / ${size[1]}`;
|
|
915
|
+
return out;
|
|
916
|
+
}
|
|
917
|
+
function motionFit2(value) {
|
|
918
|
+
return value === `cover` || value === `fill` ? value : `contain`;
|
|
919
|
+
}
|
|
920
|
+
function motionA11y2(label, pressable = false) {
|
|
921
|
+
const named = typeof label === `string` && label;
|
|
922
|
+
if (pressable)
|
|
923
|
+
return named ? { role: `button`, tabIndex: 0, "aria-label": label } : { role: `button`, tabIndex: 0 };
|
|
924
|
+
return named ? { role: `img`, "aria-label": label } : { "aria-hidden": `true` };
|
|
925
|
+
}
|
|
926
|
+
function motionThemeSlots2(slotIds, theme, mode, own) {
|
|
927
|
+
const out = {};
|
|
928
|
+
for (const id of slotIds) {
|
|
929
|
+
if (!id.startsWith(`$color.`))
|
|
930
|
+
continue;
|
|
931
|
+
const c = parseColor(resolveToken(theme, id, mode));
|
|
932
|
+
if (c)
|
|
933
|
+
out[id] = { p: { a: 0, k: [c.r / 255, c.g / 255, c.b / 255, c.a] } };
|
|
934
|
+
}
|
|
935
|
+
if (mode === `dark`)
|
|
936
|
+
out.$mode = `dark`;
|
|
937
|
+
if (isObj(own))
|
|
938
|
+
Object.assign(out, own);
|
|
939
|
+
return out;
|
|
940
|
+
}
|
|
941
|
+
var surfaces = new Map;
|
|
942
|
+
var hiddenListeners = 0;
|
|
943
|
+
var hiddenWatchers = new Set;
|
|
944
|
+
var onVisibility = () => hiddenWatchers.forEach((v) => v.schedule());
|
|
945
|
+
function surfaceOf(el) {
|
|
946
|
+
return el.closest(`[data-xui-surface]`) ?? el.ownerDocument;
|
|
947
|
+
}
|
|
948
|
+
function granted(view, surface) {
|
|
949
|
+
const set = surfaces.get(surface);
|
|
950
|
+
if (!set)
|
|
951
|
+
return false;
|
|
952
|
+
const live = [...set].filter((v) => v.root.isConnected);
|
|
953
|
+
if (live.length <= MOTION_MAX_PLAYING2)
|
|
954
|
+
return set.has(view);
|
|
955
|
+
live.sort((a, b) => a.root.compareDocumentPosition(b.root) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1);
|
|
956
|
+
return live.indexOf(view) < MOTION_MAX_PLAYING2;
|
|
957
|
+
}
|
|
958
|
+
function motionCanPaint2() {
|
|
959
|
+
return typeof IntersectionObserver === `function` && typeof requestAnimationFrame === `function` && typeof Path2D === `function`;
|
|
960
|
+
}
|
|
961
|
+
async function inflate(data, method) {
|
|
962
|
+
if (method === 0)
|
|
963
|
+
return data;
|
|
964
|
+
if (method !== 8 || typeof DecompressionStream !== `function`)
|
|
965
|
+
throw new Error(`unsupported .lottie compression`);
|
|
966
|
+
const stream = new Blob([data]).stream().pipeThrough(new DecompressionStream(`deflate-raw`));
|
|
967
|
+
return new Uint8Array(await new Response(stream).arrayBuffer());
|
|
968
|
+
}
|
|
969
|
+
async function unzip(bytes) {
|
|
970
|
+
const dv = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
971
|
+
let eocd = -1;
|
|
972
|
+
for (let k = bytes.length - 22;k >= Math.max(0, bytes.length - 65557); k--) {
|
|
973
|
+
if (dv.getUint32(k, true) === 101010256) {
|
|
974
|
+
eocd = k;
|
|
975
|
+
break;
|
|
976
|
+
}
|
|
977
|
+
}
|
|
978
|
+
if (eocd < 0)
|
|
979
|
+
throw new Error(`not a .lottie archive`);
|
|
980
|
+
const count = dv.getUint16(eocd + 10, true);
|
|
981
|
+
let p = dv.getUint32(eocd + 16, true);
|
|
982
|
+
const out = new Map;
|
|
983
|
+
const dec = new TextDecoder;
|
|
984
|
+
for (let k = 0;k < count; k++) {
|
|
985
|
+
if (dv.getUint32(p, true) !== 33639248)
|
|
986
|
+
break;
|
|
987
|
+
const method = dv.getUint16(p + 10, true);
|
|
988
|
+
const size = dv.getUint32(p + 20, true);
|
|
989
|
+
const nameLen = dv.getUint16(p + 28, true);
|
|
990
|
+
const extraLen = dv.getUint16(p + 30, true);
|
|
991
|
+
const commentLen = dv.getUint16(p + 32, true);
|
|
992
|
+
const local = dv.getUint32(p + 42, true);
|
|
993
|
+
const name = dec.decode(bytes.subarray(p + 46, p + 46 + nameLen));
|
|
994
|
+
const start = local + 30 + dv.getUint16(local + 26, true) + dv.getUint16(local + 28, true);
|
|
995
|
+
if (!name.endsWith(`/`))
|
|
996
|
+
out.set(name, await inflate(bytes.subarray(start, start + size), method));
|
|
997
|
+
p += 46 + nameLen + extraLen + commentLen;
|
|
998
|
+
}
|
|
999
|
+
return out;
|
|
1000
|
+
}
|
|
1001
|
+
function base64(bytes) {
|
|
1002
|
+
let s = ``;
|
|
1003
|
+
for (let k = 0;k < bytes.length; k += 32768)
|
|
1004
|
+
s += String.fromCharCode(...bytes.subarray(k, k + 32768));
|
|
1005
|
+
return btoa(s);
|
|
1006
|
+
}
|
|
1007
|
+
async function motionFromDotLottie2(bytes) {
|
|
1008
|
+
return (await motionDotLottie2(bytes)).lottie;
|
|
1009
|
+
}
|
|
1010
|
+
async function motionDotLottie2(bytes) {
|
|
1011
|
+
const files = await unzip(bytes);
|
|
1012
|
+
const dec = new TextDecoder;
|
|
1013
|
+
const manifest = files.get(`manifest.json`) ? JSON.parse(dec.decode(files.get(`manifest.json`))) : {};
|
|
1014
|
+
const id = manifest.animations?.[0]?.id;
|
|
1015
|
+
const anims = [...files.keys()].filter((n) => /^(animations|a)\/[^/]+\.json$/.test(n));
|
|
1016
|
+
const name = id && anims.find((n) => n.endsWith(`/${id}.json`)) || anims[0];
|
|
1017
|
+
if (!name)
|
|
1018
|
+
throw new Error(`the .lottie archive has no animation`);
|
|
1019
|
+
const lottie = JSON.parse(dec.decode(files.get(name)));
|
|
1020
|
+
for (const a of lottie.assets ?? []) {
|
|
1021
|
+
const p = a.p;
|
|
1022
|
+
if (typeof p !== `string` || p.startsWith(`data:`) || a.layers)
|
|
1023
|
+
continue;
|
|
1024
|
+
const file = files.get(`images/${p}`) ?? files.get(`i/${p}`);
|
|
1025
|
+
if (!file)
|
|
1026
|
+
continue;
|
|
1027
|
+
const ext = p.split(`.`).pop()?.toLowerCase();
|
|
1028
|
+
const mime = ext === `jpg` || ext === `jpeg` ? `image/jpeg` : ext === `webp` ? `image/webp` : ext === `svg` ? `image/svg+xml` : `image/png`;
|
|
1029
|
+
a.p = `data:${mime};base64,${base64(file)}`;
|
|
1030
|
+
a.u = ``;
|
|
1031
|
+
a.e = 1;
|
|
1032
|
+
}
|
|
1033
|
+
const first = manifest.stateMachines?.[0]?.id ?? manifest.states?.map((s) => typeof s === `string` ? s : s.id)[0];
|
|
1034
|
+
const machines = [...files.keys()].filter((n) => /^(s|states)\/[^/]+\.json$/.test(n));
|
|
1035
|
+
const smName = first && machines.find((n) => n.endsWith(`/${first}.json`)) || machines[0];
|
|
1036
|
+
let stateMachine = null;
|
|
1037
|
+
if (smName) {
|
|
1038
|
+
try {
|
|
1039
|
+
const v = JSON.parse(dec.decode(files.get(smName)));
|
|
1040
|
+
if (isObj(v))
|
|
1041
|
+
stateMachine = v;
|
|
1042
|
+
} catch {}
|
|
1043
|
+
}
|
|
1044
|
+
return { lottie: JSON.stringify(lottie), stateMachine };
|
|
1045
|
+
}
|
|
1046
|
+
|
|
1047
|
+
class MotionStateDriver2 {
|
|
1048
|
+
player;
|
|
1049
|
+
emit;
|
|
1050
|
+
restart;
|
|
1051
|
+
machineKey = ``;
|
|
1052
|
+
inputsKey = ``;
|
|
1053
|
+
completeSent = false;
|
|
1054
|
+
running = false;
|
|
1055
|
+
constructor(player, emit, restart) {
|
|
1056
|
+
this.player = player;
|
|
1057
|
+
this.emit = emit;
|
|
1058
|
+
this.restart = restart;
|
|
1059
|
+
}
|
|
1060
|
+
setMachine(machine) {
|
|
1061
|
+
const key = isObj(machine) ? JSON.stringify(machine) : ``;
|
|
1062
|
+
if (key === this.machineKey)
|
|
1063
|
+
return this.running;
|
|
1064
|
+
this.machineKey = key;
|
|
1065
|
+
this.inputsKey = ``;
|
|
1066
|
+
this.running = this.player.setStateMachine(key || `{}`);
|
|
1067
|
+
if (this.running)
|
|
1068
|
+
this.changed();
|
|
1069
|
+
this.drain();
|
|
1070
|
+
return this.running;
|
|
1071
|
+
}
|
|
1072
|
+
setInputs(inputs) {
|
|
1073
|
+
if (!this.running || !isObj(inputs))
|
|
1074
|
+
return;
|
|
1075
|
+
const key = JSON.stringify(inputs);
|
|
1076
|
+
if (key === this.inputsKey)
|
|
1077
|
+
return;
|
|
1078
|
+
this.inputsKey = key;
|
|
1079
|
+
if (this.player.smSetInputs(key))
|
|
1080
|
+
this.changed();
|
|
1081
|
+
this.drain();
|
|
1082
|
+
}
|
|
1083
|
+
post(kind, layer = ``) {
|
|
1084
|
+
if (!this.running)
|
|
1085
|
+
return;
|
|
1086
|
+
if (this.player.smPost(kind, layer))
|
|
1087
|
+
this.changed();
|
|
1088
|
+
this.drain();
|
|
1089
|
+
}
|
|
1090
|
+
done() {
|
|
1091
|
+
if (!this.completeSent) {
|
|
1092
|
+
this.completeSent = true;
|
|
1093
|
+
this.emit(`complete`);
|
|
1094
|
+
}
|
|
1095
|
+
this.post(`complete`);
|
|
1096
|
+
}
|
|
1097
|
+
replay() {
|
|
1098
|
+
if (!this.running)
|
|
1099
|
+
this.completeSent = false;
|
|
1100
|
+
}
|
|
1101
|
+
changed() {
|
|
1102
|
+
this.completeSent = false;
|
|
1103
|
+
this.restart();
|
|
1104
|
+
}
|
|
1105
|
+
drain() {
|
|
1106
|
+
if (!this.running)
|
|
1107
|
+
return;
|
|
1108
|
+
const status = JSON.parse(this.player.smStatus());
|
|
1109
|
+
for (const state of status?.entered ?? [])
|
|
1110
|
+
this.emit(`state`, { state });
|
|
1111
|
+
if (status?.final && !this.completeSent) {
|
|
1112
|
+
this.completeSent = true;
|
|
1113
|
+
this.emit(`complete`);
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
}
|
|
1117
|
+
var themeIds = new WeakMap;
|
|
1118
|
+
var nextThemeId = 1;
|
|
1119
|
+
var themeId = (t) => {
|
|
1120
|
+
let id = themeIds.get(t);
|
|
1121
|
+
if (!id)
|
|
1122
|
+
themeIds.set(t, id = nextThemeId++);
|
|
1123
|
+
return id;
|
|
1124
|
+
};
|
|
1125
|
+
|
|
1126
|
+
class MotionView2 {
|
|
1127
|
+
root;
|
|
1128
|
+
canvas;
|
|
1129
|
+
props = {};
|
|
1130
|
+
nodeStyle = undefined;
|
|
1131
|
+
env = null;
|
|
1132
|
+
sourceKey = ``;
|
|
1133
|
+
slotsKey = ``;
|
|
1134
|
+
playbackKey = ``;
|
|
1135
|
+
generation = 0;
|
|
1136
|
+
lottie = null;
|
|
1137
|
+
fileMachine = null;
|
|
1138
|
+
driver = null;
|
|
1139
|
+
halfSeen = false;
|
|
1140
|
+
visibleSent = false;
|
|
1141
|
+
slotIds = [];
|
|
1142
|
+
player = null;
|
|
1143
|
+
images = [];
|
|
1144
|
+
pool = new MotionCanvasPool2;
|
|
1145
|
+
io = null;
|
|
1146
|
+
ro = null;
|
|
1147
|
+
visible = false;
|
|
1148
|
+
surface = null;
|
|
1149
|
+
raf = 0;
|
|
1150
|
+
last = 0;
|
|
1151
|
+
lastPaint = -Infinity;
|
|
1152
|
+
elapsed = 0;
|
|
1153
|
+
finished = false;
|
|
1154
|
+
restarts = 0;
|
|
1155
|
+
inTick = false;
|
|
1156
|
+
painted = ``;
|
|
1157
|
+
destroyed = false;
|
|
1158
|
+
constructor(root, canvas) {
|
|
1159
|
+
this.root = root;
|
|
1160
|
+
this.canvas = canvas;
|
|
1161
|
+
root.addEventListener(`click`, this.onClick);
|
|
1162
|
+
root.addEventListener(`keydown`, this.onKey);
|
|
1163
|
+
root.addEventListener(`pointerdown`, this.onPointer);
|
|
1164
|
+
root.addEventListener(`pointerup`, this.onPointer);
|
|
1165
|
+
root.addEventListener(`pointerenter`, this.onPointer);
|
|
1166
|
+
root.addEventListener(`pointerleave`, this.onPointer);
|
|
1167
|
+
if (!motionCanPaint2())
|
|
1168
|
+
return;
|
|
1169
|
+
this.io = new IntersectionObserver((entries) => {
|
|
1170
|
+
const e = entries[entries.length - 1];
|
|
1171
|
+
this.visible = Boolean(e?.isIntersecting);
|
|
1172
|
+
if (e && e.isIntersecting && e.intersectionRatio >= 0.5)
|
|
1173
|
+
this.halfSeen = true;
|
|
1174
|
+
this.flushVisible();
|
|
1175
|
+
this.schedule();
|
|
1176
|
+
}, { threshold: [0, 0.5] });
|
|
1177
|
+
this.io.observe(root);
|
|
1178
|
+
if (typeof ResizeObserver === `function`) {
|
|
1179
|
+
this.ro = new ResizeObserver(() => this.repaint());
|
|
1180
|
+
this.ro.observe(root);
|
|
1181
|
+
}
|
|
1182
|
+
hiddenWatchers.add(this);
|
|
1183
|
+
if (hiddenListeners++ === 0)
|
|
1184
|
+
document.addEventListener(`visibilitychange`, onVisibility);
|
|
1185
|
+
}
|
|
1186
|
+
update(props, env, nodeStyle) {
|
|
1187
|
+
if (this.destroyed)
|
|
1188
|
+
return;
|
|
1189
|
+
this.props = props;
|
|
1190
|
+
this.nodeStyle = nodeStyle;
|
|
1191
|
+
this.env = env;
|
|
1192
|
+
if (!this.io)
|
|
1193
|
+
return;
|
|
1194
|
+
this.flushVisible();
|
|
1195
|
+
const sourceKey = Array.isArray(props.layers) ? `d:${JSON.stringify(Object.fromEntries(DIALECT_KEYS.map((k) => [k, props[k]])))}` : isObj(props.lottie) ? `l:${JSON.stringify(props.lottie)}` : typeof props.src === `string` && props.src ? `s:${props.src}` : ``;
|
|
1196
|
+
const slotsKey = `${themeId(env.theme)}:${env.mode}:${JSON.stringify(props.slots ?? null)}`;
|
|
1197
|
+
if (sourceKey !== this.sourceKey) {
|
|
1198
|
+
this.sourceKey = sourceKey;
|
|
1199
|
+
this.slotsKey = slotsKey;
|
|
1200
|
+
this.load();
|
|
1201
|
+
return;
|
|
1202
|
+
}
|
|
1203
|
+
if (slotsKey !== this.slotsKey) {
|
|
1204
|
+
this.slotsKey = slotsKey;
|
|
1205
|
+
this.instantiate();
|
|
1206
|
+
return;
|
|
1207
|
+
}
|
|
1208
|
+
this.applyMachine();
|
|
1209
|
+
this.applyPlayback();
|
|
1210
|
+
this.schedule();
|
|
1211
|
+
}
|
|
1212
|
+
emit(event, payload) {
|
|
1213
|
+
if (!this.destroyed)
|
|
1214
|
+
this.env?.emit?.(event, payload);
|
|
1215
|
+
}
|
|
1216
|
+
flushVisible() {
|
|
1217
|
+
if (!this.halfSeen || this.visibleSent || !this.env)
|
|
1218
|
+
return;
|
|
1219
|
+
this.visibleSent = true;
|
|
1220
|
+
this.emit(`visible`);
|
|
1221
|
+
}
|
|
1222
|
+
onClick = () => {
|
|
1223
|
+
this.driver?.post(`click`);
|
|
1224
|
+
this.emit(`press`);
|
|
1225
|
+
};
|
|
1226
|
+
onKey = (e) => {
|
|
1227
|
+
if (!this.env?.pressable || e.key !== `Enter` && e.key !== ` ` || e.target !== this.root)
|
|
1228
|
+
return;
|
|
1229
|
+
e.preventDefault();
|
|
1230
|
+
this.onClick();
|
|
1231
|
+
};
|
|
1232
|
+
onPointer = (e) => {
|
|
1233
|
+
const kind = e.type === `pointerdown` ? `pointerDown` : e.type === `pointerup` ? `pointerUp` : e.type === `pointerenter` ? `pointerEnter` : `pointerExit`;
|
|
1234
|
+
this.driver?.post(kind);
|
|
1235
|
+
if (kind === `pointerEnter`)
|
|
1236
|
+
this.emit(`hover`);
|
|
1237
|
+
};
|
|
1238
|
+
applyMachine() {
|
|
1239
|
+
const d = this.driver;
|
|
1240
|
+
if (!d)
|
|
1241
|
+
return;
|
|
1242
|
+
const was = d.running;
|
|
1243
|
+
const running = d.setMachine(isObj(this.props.stateMachine) ? this.props.stateMachine : this.fileMachine);
|
|
1244
|
+
if (was && !running)
|
|
1245
|
+
this.playbackKey = ``;
|
|
1246
|
+
d.setInputs(this.props.inputs);
|
|
1247
|
+
}
|
|
1248
|
+
restartClock = () => {
|
|
1249
|
+
this.elapsed = 0;
|
|
1250
|
+
this.finished = false;
|
|
1251
|
+
this.restarts++;
|
|
1252
|
+
this.painted = ``;
|
|
1253
|
+
if (!this.inTick)
|
|
1254
|
+
this.schedule();
|
|
1255
|
+
};
|
|
1256
|
+
destroy() {
|
|
1257
|
+
this.destroyed = true;
|
|
1258
|
+
for (const t of [`click`, `keydown`, `pointerdown`, `pointerup`, `pointerenter`, `pointerleave`])
|
|
1259
|
+
this.root.removeEventListener(t, t === `click` ? this.onClick : t === `keydown` ? this.onKey : this.onPointer);
|
|
1260
|
+
this.generation++;
|
|
1261
|
+
this.stop();
|
|
1262
|
+
this.leaveSurface();
|
|
1263
|
+
this.io?.disconnect();
|
|
1264
|
+
this.ro?.disconnect();
|
|
1265
|
+
if (this.io) {
|
|
1266
|
+
hiddenWatchers.delete(this);
|
|
1267
|
+
if (--hiddenListeners === 0)
|
|
1268
|
+
document.removeEventListener(`visibilitychange`, onVisibility);
|
|
1269
|
+
}
|
|
1270
|
+
this.player?.free();
|
|
1271
|
+
this.player = null;
|
|
1272
|
+
}
|
|
1273
|
+
fail(message) {
|
|
1274
|
+
this.root.dataset.state = `error`;
|
|
1275
|
+
this.env?.onError?.(message);
|
|
1276
|
+
}
|
|
1277
|
+
async load() {
|
|
1278
|
+
const gen = ++this.generation;
|
|
1279
|
+
this.free();
|
|
1280
|
+
this.lottie = null;
|
|
1281
|
+
this.fileMachine = null;
|
|
1282
|
+
this.root.dataset.state = `loading`;
|
|
1283
|
+
const props = this.props;
|
|
1284
|
+
const env = this.env;
|
|
1285
|
+
try {
|
|
1286
|
+
const wasm = await (await (__preload("ctcc3cma"), import("./wasm-ctcc3cma.js"))).loadMotionWasm();
|
|
1287
|
+
let lottie;
|
|
1288
|
+
if (Array.isArray(props.layers)) {
|
|
1289
|
+
const doc = Object.fromEntries(DIALECT_KEYS.filter((k) => props[k] !== undefined).map((k) => [k, props[k]]));
|
|
1290
|
+
const out = JSON.parse(wasm.compile(JSON.stringify(doc)));
|
|
1291
|
+
if (!out.lottie)
|
|
1292
|
+
throw new Error(`Motion: ${(out.errors ?? []).map((e) => `${e.path ?? ``} ${e.message ?? ``}`.trim()).join(`; `) || `invalid layers`}`);
|
|
1293
|
+
lottie = JSON.stringify(out.lottie);
|
|
1294
|
+
} else if (isObj(props.lottie))
|
|
1295
|
+
lottie = JSON.stringify(props.lottie);
|
|
1296
|
+
else if (typeof props.src === `string` && props.src) {
|
|
1297
|
+
const req = mediaRequestOf2(env.host, props.src);
|
|
1298
|
+
if (!req)
|
|
1299
|
+
throw new Error(`Motion: src denied by the media policy`);
|
|
1300
|
+
const blob = await fetchLimited2(req.url, req.headers ?? {}, MEDIA_LIMITS2, false, (u) => mediaUrlAllowed2(env.host, u));
|
|
1301
|
+
const bytes = new Uint8Array(await blob.arrayBuffer());
|
|
1302
|
+
if (bytes[0] === 80 && bytes[1] === 75) {
|
|
1303
|
+
const dot = await motionDotLottie2(bytes);
|
|
1304
|
+
lottie = dot.lottie;
|
|
1305
|
+
this.fileMachine = dot.stateMachine;
|
|
1306
|
+
} else
|
|
1307
|
+
lottie = new TextDecoder().decode(bytes);
|
|
1308
|
+
} else
|
|
1309
|
+
throw new Error(`Motion: no source (layers, lottie or src)`);
|
|
1310
|
+
if (gen !== this.generation)
|
|
1311
|
+
return;
|
|
1312
|
+
this.lottie = lottie;
|
|
1313
|
+
const slots = JSON.parse(lottie).slots;
|
|
1314
|
+
this.slotIds = isObj(slots) ? Object.keys(slots) : [];
|
|
1315
|
+
this.instantiate();
|
|
1316
|
+
} catch (e) {
|
|
1317
|
+
if (gen !== this.generation)
|
|
1318
|
+
return;
|
|
1319
|
+
this.fail(e instanceof Error ? e.message : String(e));
|
|
1320
|
+
}
|
|
1321
|
+
}
|
|
1322
|
+
free() {
|
|
1323
|
+
this.stop();
|
|
1324
|
+
this.driver = null;
|
|
1325
|
+
this.player?.free();
|
|
1326
|
+
this.player = null;
|
|
1327
|
+
this.images = [];
|
|
1328
|
+
this.painted = ``;
|
|
1329
|
+
}
|
|
1330
|
+
instantiate() {
|
|
1331
|
+
if (!this.lottie || !this.env)
|
|
1332
|
+
return;
|
|
1333
|
+
(__preload("ctcc3cma"), import("./wasm-ctcc3cma.js")).then(async (m) => {
|
|
1334
|
+
const wasm = await m.loadMotionWasm();
|
|
1335
|
+
if (this.destroyed || !this.lottie || !this.env)
|
|
1336
|
+
return;
|
|
1337
|
+
this.free();
|
|
1338
|
+
const slots = motionThemeSlots2(this.slotIds, this.env.theme, this.env.mode, this.props.slots);
|
|
1339
|
+
try {
|
|
1340
|
+
this.player = new wasm.MotionPlayer(this.lottie, JSON.stringify(slots));
|
|
1341
|
+
} catch (e) {
|
|
1342
|
+
this.fail(`Motion: ${e instanceof Error ? e.message : String(e)}`);
|
|
1343
|
+
return;
|
|
1344
|
+
}
|
|
1345
|
+
this.root.dataset.state = `ready`;
|
|
1346
|
+
if (!motionDeclaredSize2(this.props)) {
|
|
1347
|
+
const w = this.player.width(), h = this.player.height();
|
|
1348
|
+
if (w > 0 && h > 0)
|
|
1349
|
+
Object.assign(this.root.style, motionBoxStyle2([w, h], this.nodeStyle));
|
|
1350
|
+
}
|
|
1351
|
+
this.loadImages();
|
|
1352
|
+
this.playbackKey = ``;
|
|
1353
|
+
this.applyPlayback();
|
|
1354
|
+
this.driver = new MotionStateDriver2(this.player, (event, payload) => this.emit(event, payload), this.restartClock);
|
|
1355
|
+
this.applyMachine();
|
|
1356
|
+
this.schedule();
|
|
1357
|
+
});
|
|
1358
|
+
}
|
|
1359
|
+
loadImages() {
|
|
1360
|
+
const player = this.player;
|
|
1361
|
+
if (!player || !this.env)
|
|
1362
|
+
return;
|
|
1363
|
+
const env = this.env;
|
|
1364
|
+
player.images().forEach((loc, k) => {
|
|
1365
|
+
this.images[k] = null;
|
|
1366
|
+
let url = loc;
|
|
1367
|
+
if (!loc.startsWith(`data:`))
|
|
1368
|
+
url = mediaRequestOf2(env.host, loc)?.url ?? null;
|
|
1369
|
+
if (!url)
|
|
1370
|
+
return;
|
|
1371
|
+
const img = new Image;
|
|
1372
|
+
img.decoding = `async`;
|
|
1373
|
+
img.onload = () => {
|
|
1374
|
+
if (this.player !== player)
|
|
1375
|
+
return;
|
|
1376
|
+
this.images[k] = img;
|
|
1377
|
+
this.repaint();
|
|
1378
|
+
};
|
|
1379
|
+
img.src = url;
|
|
1380
|
+
});
|
|
1381
|
+
}
|
|
1382
|
+
applyPlayback() {
|
|
1383
|
+
if (!this.player || this.driver?.running)
|
|
1384
|
+
return;
|
|
1385
|
+
const key = JSON.stringify(Object.fromEntries(PLAYBACK_KEYS.map((k) => [k, this.props[k]])));
|
|
1386
|
+
if (key === this.playbackKey)
|
|
1387
|
+
return;
|
|
1388
|
+
this.playbackKey = key;
|
|
1389
|
+
this.player.setPlayback(key);
|
|
1390
|
+
this.elapsed = 0;
|
|
1391
|
+
this.finished = false;
|
|
1392
|
+
this.driver?.replay();
|
|
1393
|
+
}
|
|
1394
|
+
wantsToAnimate() {
|
|
1395
|
+
const p = this.props;
|
|
1396
|
+
const autoplay = this.driver?.running || p.autoplay !== false;
|
|
1397
|
+
return Boolean(this.player) && typeof p.progress !== `number` && autoplay && p.play !== false && !this.env?.reducedMotion && !this.finished && this.visible && !document.hidden;
|
|
1398
|
+
}
|
|
1399
|
+
leaveSurface() {
|
|
1400
|
+
if (!this.surface)
|
|
1401
|
+
return;
|
|
1402
|
+
const set = surfaces.get(this.surface);
|
|
1403
|
+
set?.delete(this);
|
|
1404
|
+
if (set && set.size === 0)
|
|
1405
|
+
surfaces.delete(this.surface);
|
|
1406
|
+
set?.forEach((v) => v.schedule());
|
|
1407
|
+
this.surface = null;
|
|
1408
|
+
}
|
|
1409
|
+
schedule() {
|
|
1410
|
+
if (this.destroyed || !this.io)
|
|
1411
|
+
return;
|
|
1412
|
+
if (this.wantsToAnimate()) {
|
|
1413
|
+
if (!this.surface) {
|
|
1414
|
+
this.surface = surfaceOf(this.root);
|
|
1415
|
+
let set = surfaces.get(this.surface);
|
|
1416
|
+
if (!set)
|
|
1417
|
+
surfaces.set(this.surface, set = new Set);
|
|
1418
|
+
set.add(this);
|
|
1419
|
+
set.forEach((v) => v !== this && v.schedule());
|
|
1420
|
+
}
|
|
1421
|
+
if (granted(this, this.surface)) {
|
|
1422
|
+
if (!this.raf) {
|
|
1423
|
+
this.last = -1;
|
|
1424
|
+
this.raf = requestAnimationFrame(this.tick);
|
|
1425
|
+
}
|
|
1426
|
+
return;
|
|
1427
|
+
}
|
|
1428
|
+
} else
|
|
1429
|
+
this.leaveSurface();
|
|
1430
|
+
this.stop();
|
|
1431
|
+
this.repaint();
|
|
1432
|
+
}
|
|
1433
|
+
stop() {
|
|
1434
|
+
if (this.raf)
|
|
1435
|
+
cancelAnimationFrame(this.raf);
|
|
1436
|
+
this.raf = 0;
|
|
1437
|
+
}
|
|
1438
|
+
tick = (now) => {
|
|
1439
|
+
this.raf = 0;
|
|
1440
|
+
if (!this.player || this.destroyed)
|
|
1441
|
+
return;
|
|
1442
|
+
if (this.last >= 0)
|
|
1443
|
+
this.elapsed += now - this.last;
|
|
1444
|
+
this.last = now;
|
|
1445
|
+
if (this.player.done(this.elapsed)) {
|
|
1446
|
+
const before = this.restarts;
|
|
1447
|
+
this.inTick = true;
|
|
1448
|
+
this.driver?.done();
|
|
1449
|
+
if (!this.driver)
|
|
1450
|
+
this.emit(`complete`);
|
|
1451
|
+
this.inTick = false;
|
|
1452
|
+
if (this.restarts === before || !this.player) {
|
|
1453
|
+
this.finished = true;
|
|
1454
|
+
this.schedule();
|
|
1455
|
+
return;
|
|
1456
|
+
}
|
|
1457
|
+
}
|
|
1458
|
+
if (now - this.lastPaint >= 1000 / MOTION_MAX_FPS2 - 1) {
|
|
1459
|
+
this.lastPaint = now;
|
|
1460
|
+
this.paint(this.player.tick(this.elapsed));
|
|
1461
|
+
}
|
|
1462
|
+
if (!this.raf)
|
|
1463
|
+
this.raf = requestAnimationFrame(this.tick);
|
|
1464
|
+
};
|
|
1465
|
+
stillFrame() {
|
|
1466
|
+
const p = this.player;
|
|
1467
|
+
const progress = this.props.progress;
|
|
1468
|
+
if (typeof progress === `number`)
|
|
1469
|
+
return p.progressFrame(Math.max(0, Math.min(1, progress)));
|
|
1470
|
+
if (this.finished || this.elapsed > 0 && !this.env?.reducedMotion && (this.driver?.running || this.props.autoplay !== false))
|
|
1471
|
+
return p.tick(this.elapsed);
|
|
1472
|
+
return p.posterFrame();
|
|
1473
|
+
}
|
|
1474
|
+
repaint() {
|
|
1475
|
+
if (!this.player || this.raf) {
|
|
1476
|
+
if (this.raf)
|
|
1477
|
+
this.painted = ``;
|
|
1478
|
+
return;
|
|
1479
|
+
}
|
|
1480
|
+
this.painted = ``;
|
|
1481
|
+
this.paint(this.stillFrame());
|
|
1482
|
+
}
|
|
1483
|
+
paint(frame) {
|
|
1484
|
+
const player = this.player;
|
|
1485
|
+
if (!player)
|
|
1486
|
+
return;
|
|
1487
|
+
const rect = this.root.getBoundingClientRect();
|
|
1488
|
+
const dpr = typeof window !== `undefined` && window.devicePixelRatio || 1;
|
|
1489
|
+
const w = Math.max(1, Math.round(rect.width * dpr));
|
|
1490
|
+
const h = Math.max(1, Math.round(rect.height * dpr));
|
|
1491
|
+
const fit = motionFit2(this.props.fit);
|
|
1492
|
+
const key = `${frame}|${w}|${h}|${fit}`;
|
|
1493
|
+
if (key === this.painted)
|
|
1494
|
+
return;
|
|
1495
|
+
this.painted = key;
|
|
1496
|
+
if (this.canvas.width !== w || this.canvas.height !== h) {
|
|
1497
|
+
this.canvas.width = w;
|
|
1498
|
+
this.canvas.height = h;
|
|
1499
|
+
}
|
|
1500
|
+
const ctx = this.canvas.getContext(`2d`);
|
|
1501
|
+
if (!ctx)
|
|
1502
|
+
return;
|
|
1503
|
+
const base = motionConcat2([dpr, 0, 0, dpr, 0, 0], motionFitMatrix2(player.width(), player.height(), w / dpr, h / dpr, fit));
|
|
1504
|
+
paintMotionFrame2(ctx, w, h, player.sample(frame), base, this.images, this.pool);
|
|
1505
|
+
}
|
|
1506
|
+
}
|
|
1507
|
+
function resetMotionThemeIds2() {
|
|
1508
|
+
themeIds = new WeakMap;
|
|
1509
|
+
nextThemeId = 1;
|
|
1510
|
+
}
|
|
1511
|
+
|
|
1512
|
+
export { __export, __chunks, ownPrivateHosts2, urlPolicyOf2, linkHref2, mediaRequestOf2, mediaUrlAllowed2, openAllowed2, MEDIA_CACHE_IDLE_MAX2, mediaCacheKey2, acquireMedia2, releaseMedia2, mediaCacheStats2, clearMediaCache2, openMediaSource2, streamEntry2, fetchStream2, fetchLimited2, layoutSize2, visualScale2, elementScale2, VOICE_WAVE_SIZES2, VOICE_WAVE_SIZE_PX2, voiceWaveAnimates2, voiceWaveQuiet2, voiceWaveName2, voiceWaveClock2, voiceWaveFitChild2, VOICE_WAVE_CLASSES2, motionFitMatrix2, motionConcat2, motionFrameSize2, MotionCanvasPool2, paintMotionFrame2, MOTION_MAX_PLAYING2, MOTION_MAX_FPS2, motionDeclaredSize2, motionBoxStyle2, motionFit2, motionA11y2, motionThemeSlots2, motionCanPaint2, motionFromDotLottie2, motionDotLottie2, MotionStateDriver2, MotionView2, resetMotionThemeIds2 };
|
|
1513
|
+
|
|
1514
|
+
//# debugId=4B679732CF837C4A64756E2164756E21
|
|
1515
|
+
//# sourceMappingURL=index-t2mwfbb6.js.map
|