animl-cli 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/NOTICE +34 -0
- package/README.md +21 -2
- package/docs/AUTHORING.md +1530 -0
- package/docs/CLI.md +627 -0
- package/docs/parity/inventory.json +34570 -0
- package/examples/bell.ani +359 -0
- package/examples/bell.animl +114 -0
- package/examples/composite.ani +110 -0
- package/examples/composite.animl +21 -0
- package/examples/feather.ani +56 -0
- package/examples/feather.animl +20 -0
- package/examples/image-paints.ani +32 -0
- package/examples/image-paints.animl +8 -0
- package/examples/lib/cards.animl +9 -0
- package/examples/lib/shared.animl +10 -0
- package/examples/lib/ui.animl +8 -0
- package/examples/moon-toggle.png +0 -0
- package/examples/moon.ani +250 -0
- package/examples/moon.animl +55 -0
- package/examples/motion.ani +94 -0
- package/examples/motion.animl +24 -0
- package/examples/paint.ani +91 -0
- package/examples/paint.animl +21 -0
- package/examples/photo.ani +29 -0
- package/examples/photo.animl +6 -0
- package/examples/progress.ani +43 -0
- package/examples/progress.animl +6 -0
- package/examples/shapes.ani +109 -0
- package/examples/shapes.animl +16 -0
- package/examples/slice.ani +32 -0
- package/examples/slice.animl +9 -0
- package/examples/switch.ani +91 -0
- package/examples/switch.animl +22 -0
- package/examples/toolbar.ani +480 -0
- package/examples/toolbar.animl +115 -0
- package/examples/trash-ring.png +0 -0
- package/examples/trash.ani +357 -0
- package/examples/trash.animl +88 -0
- package/examples/web/index.html +520 -0
- package/examples/web/template.html +162 -0
- package/fixtures/bell/rive-reference/frames/00-rest.png +0 -0
- package/fixtures/bell/rive-reference/frames/01-hover.png +0 -0
- package/fixtures/bell/rive-reference/frames/02-ring-f3.png +0 -0
- package/fixtures/bell/rive-reference/frames/03-ring-f7.png +0 -0
- package/fixtures/bell/rive-reference/frames/04-ring-f17.png +0 -0
- package/fixtures/bell/rive-reference/frames/05-ring-f27.png +0 -0
- package/fixtures/bell/rive-reference/frames/06-ring-f57.png +0 -0
- package/fixtures/bell/rive-reference/frames/07-rested.png +0 -0
- package/fixtures/bell/rive-reference/frames/08-out.png +0 -0
- package/fixtures/bell/rive-reference/frames/commands.txt +24 -0
- package/llms.txt +30 -0
- package/modules/a11y/AUTHORING.md +108 -0
- package/modules/a11y/SPEC.md +304 -0
- package/modules/a11y/capabilities/a11y-focus-condition/example.ani +69 -0
- package/modules/a11y/capabilities/a11y-focus-condition/example.animl +17 -0
- package/modules/a11y/capabilities/a11y-inferred-text/example.ani +47 -0
- package/modules/a11y/capabilities/a11y-inferred-text/example.animl +13 -0
- package/modules/a11y/capabilities/a11y-property-heading-level/example.ani +26 -0
- package/modules/a11y/capabilities/a11y-property-heading-level/example.animl +6 -0
- package/modules/a11y/capabilities/a11y-tree-bounds/example.ani +88 -0
- package/modules/a11y/capabilities/a11y-tree-bounds/example.animl +18 -0
- package/modules/a11y/capabilities/a11y-tree-visibility/example.ani +16 -0
- package/modules/a11y/capabilities/a11y-tree-visibility/example.animl +4 -0
- package/modules/a11y/core/commands.source +135 -0
- package/modules/a11y/examples/contract.ani +74 -0
- package/modules/a11y/examples/contract.animl +15 -0
- package/modules/a11y/examples/focus-ancestor-policy.ani +72 -0
- package/modules/a11y/examples/focus-ancestor-policy.animl +16 -0
- package/modules/a11y/examples/painted-extents.ani +331 -0
- package/modules/a11y/examples/painted-extents.animl +62 -0
- package/modules/a11y/examples/painted-groups.ani +88 -0
- package/modules/a11y/examples/painted-groups.animl +18 -0
- package/modules/a11y/examples/slider-value-text.ani +53 -0
- package/modules/a11y/examples/slider-value-text.animl +11 -0
- package/modules/a11y/manifest.source +49 -0
- package/modules/a11y-actions/manifest.source +22 -0
- package/modules/a11y-dom/AUTHORING.md +35 -0
- package/modules/a11y-dom/SPEC.md +165 -0
- package/modules/a11y-dom/examples/mute.ani +28 -0
- package/modules/a11y-dom/examples/mute.animl +6 -0
- package/modules/a11y-dom/examples/navigation.ani +152 -0
- package/modules/a11y-dom/examples/navigation.animl +35 -0
- package/modules/a11y-dom/manifest.source +22 -0
- package/modules/assetio/SPEC.md +16 -0
- package/modules/assetio/manifest.source +12 -0
- package/modules/assets/SPEC.md +23 -0
- package/modules/assets/capabilities/assets-audio/example.ani +60 -0
- package/modules/assets/capabilities/assets-audio/example.animl +16 -0
- package/modules/assets/capabilities/assets-audio-clip/example.ani +62 -0
- package/modules/assets/capabilities/assets-audio-clip/example.animl +17 -0
- package/modules/assets/capabilities/assets-audio-export-source/example.ani +60 -0
- package/modules/assets/capabilities/assets-audio-export-source/example.animl +16 -0
- package/modules/assets/capabilities/assets-audio-import-flac/example.ani +63 -0
- package/modules/assets/capabilities/assets-audio-import-flac/example.animl +17 -0
- package/modules/assets/capabilities/assets-audio-import-mp3/example.ani +63 -0
- package/modules/assets/capabilities/assets-audio-import-mp3/example.animl +17 -0
- package/modules/assets/capabilities/assets-audio-import-wav/example.ani +60 -0
- package/modules/assets/capabilities/assets-audio-import-wav/example.animl +16 -0
- package/modules/assets/capabilities/assets-blob/example.ani +52 -0
- package/modules/assets/capabilities/assets-blob/example.animl +13 -0
- package/modules/assets/capabilities/assets-cdn-disable/example.ani +48 -0
- package/modules/assets/capabilities/assets-cdn-disable/example.animl +12 -0
- package/modules/assets/capabilities/assets-exclude-export/example.ani +49 -0
- package/modules/assets/capabilities/assets-exclude-export/example.animl +12 -0
- package/modules/assets/capabilities/assets-host-decode-audio/example.ani +60 -0
- package/modules/assets/capabilities/assets-host-decode-audio/example.animl +16 -0
- package/modules/assets/capabilities/assets-image-encoding-jpeg/example.ani +50 -0
- package/modules/assets/capabilities/assets-image-encoding-jpeg/example.animl +12 -0
- package/modules/assets/capabilities/assets-image-encoding-png/example.ani +50 -0
- package/modules/assets/capabilities/assets-image-encoding-png/example.animl +12 -0
- package/modules/assets/capabilities/assets-image-encoding-webp/example.ani +50 -0
- package/modules/assets/capabilities/assets-image-encoding-webp/example.animl +12 -0
- package/modules/assets/capabilities/assets-image-export-controls/example.ani +49 -0
- package/modules/assets/capabilities/assets-image-export-controls/example.animl +12 -0
- package/modules/assets/capabilities/assets-image-filter-bilinear/example.ani +49 -0
- package/modules/assets/capabilities/assets-image-filter-bilinear/example.animl +12 -0
- package/modules/assets/capabilities/assets-image-filter-nearest/example.ani +49 -0
- package/modules/assets/capabilities/assets-image-filter-nearest/example.animl +12 -0
- package/modules/assets/capabilities/assets-image-import-jpeg/example.ani +49 -0
- package/modules/assets/capabilities/assets-image-import-jpeg/example.animl +12 -0
- package/modules/assets/capabilities/assets-image-import-jpg/example.ani +49 -0
- package/modules/assets/capabilities/assets-image-import-jpg/example.animl +12 -0
- package/modules/assets/capabilities/assets-image-import-png/example.ani +49 -0
- package/modules/assets/capabilities/assets-image-import-png/example.animl +12 -0
- package/modules/assets/capabilities/assets-image-import-webp/example.ani +49 -0
- package/modules/assets/capabilities/assets-image-import-webp/example.animl +12 -0
- package/modules/assets/capabilities/assets-image-wrap-x-clamp/example.ani +50 -0
- package/modules/assets/capabilities/assets-image-wrap-x-clamp/example.animl +12 -0
- package/modules/assets/capabilities/assets-image-wrap-x-mirror/example.ani +50 -0
- package/modules/assets/capabilities/assets-image-wrap-x-mirror/example.animl +12 -0
- package/modules/assets/capabilities/assets-image-wrap-x-repeat/example.ani +50 -0
- package/modules/assets/capabilities/assets-image-wrap-x-repeat/example.animl +12 -0
- package/modules/assets/capabilities/assets-image-wrap-y-clamp/example.ani +50 -0
- package/modules/assets/capabilities/assets-image-wrap-y-clamp/example.animl +12 -0
- package/modules/assets/capabilities/assets-image-wrap-y-mirror/example.ani +50 -0
- package/modules/assets/capabilities/assets-image-wrap-y-mirror/example.animl +12 -0
- package/modules/assets/capabilities/assets-image-wrap-y-repeat/example.ani +50 -0
- package/modules/assets/capabilities/assets-image-wrap-y-repeat/example.animl +12 -0
- package/modules/assets/capabilities/assets-lottie-import/example.ani +58 -0
- package/modules/assets/capabilities/assets-lottie-import/example.animl +20 -0
- package/modules/assets/capabilities/assets-metadata/example.ani +53 -0
- package/modules/assets/capabilities/assets-metadata/example.animl +12 -0
- package/modules/assets/capabilities/assets-replacement-scope-image/example.ani +48 -0
- package/modules/assets/capabilities/assets-replacement-scope-image/example.animl +12 -0
- package/modules/assets/capabilities/assets-svg-import/example.ani +52 -0
- package/modules/assets/capabilities/assets-svg-import/example.animl +11 -0
- package/modules/assets/capabilities/host-api-asset-cdn-policy/example.ani +48 -0
- package/modules/assets/capabilities/host-api-asset-cdn-policy/example.animl +12 -0
- package/modules/assets/capabilities/host-api-asset-loader/example.ani +48 -0
- package/modules/assets/capabilities/host-api-asset-loader/example.animl +12 -0
- package/modules/assets/capabilities/host-api-asset-metadata/example.ani +53 -0
- package/modules/assets/capabilities/host-api-asset-metadata/example.animl +12 -0
- package/modules/assets/manifest.source +79 -0
- package/modules/bind/AUTHORING.md +49 -0
- package/modules/bind/capabilities/data-bind-listener-actions/example.ani +30 -0
- package/modules/bind/capabilities/data-bind-listener-actions/example.animl +5 -0
- package/modules/bind/core/expression.source +224 -0
- package/modules/bind/examples/filtering-list.ani +122 -0
- package/modules/bind/examples/filtering-list.animl +29 -0
- package/modules/bind/manifest.source +58 -0
- package/modules/canvas/capabilities/host-api-device-pixel-ratio/example.ani +16 -0
- package/modules/canvas/capabilities/host-api-device-pixel-ratio/example.animl +3 -0
- package/modules/canvas/capabilities/host-api-resize-backing-surface/example.ani +16 -0
- package/modules/canvas/capabilities/host-api-resize-backing-surface/example.animl +3 -0
- package/modules/canvas/capabilities/platforms-web-canvas/example.ani +16 -0
- package/modules/canvas/capabilities/platforms-web-canvas/example.animl +3 -0
- package/modules/canvas/manifest.source +16 -0
- package/modules/colormix/examples/switch.ani +51 -0
- package/modules/colormix/examples/switch.animl +13 -0
- package/modules/colormix/manifest.source +39 -0
- package/modules/componentpaint/capabilities/drawing-paint-paint-artboard/example.ani +72 -0
- package/modules/componentpaint/capabilities/drawing-paint-paint-artboard/example.animl +13 -0
- package/modules/componentpaint/examples/live.ani +72 -0
- package/modules/componentpaint/examples/live.animl +13 -0
- package/modules/componentpaint/manifest.source +29 -0
- package/modules/components/manifest.source +61 -0
- package/modules/composite/manifest.source +49 -0
- package/modules/contour/capabilities/drawing-paint-asymmetric-vertex/example.ani +32 -0
- package/modules/contour/capabilities/drawing-paint-asymmetric-vertex/example.animl +5 -0
- package/modules/contour/capabilities/drawing-paint-detached-vertex/example.ani +32 -0
- package/modules/contour/capabilities/drawing-paint-detached-vertex/example.animl +5 -0
- package/modules/contour/capabilities/drawing-paint-effect-order/example.ani +28 -0
- package/modules/contour/capabilities/drawing-paint-effect-order/example.animl +3 -0
- package/modules/contour/capabilities/drawing-paint-fill-rule-clockwise/example.ani +17 -0
- package/modules/contour/capabilities/drawing-paint-fill-rule-clockwise/example.animl +3 -0
- package/modules/contour/capabilities/drawing-paint-geometry-origin/example.ani +35 -0
- package/modules/contour/capabilities/drawing-paint-geometry-origin/example.animl +5 -0
- package/modules/contour/capabilities/drawing-paint-mirrored-vertex/example.ani +31 -0
- package/modules/contour/capabilities/drawing-paint-mirrored-vertex/example.animl +5 -0
- package/modules/contour/capabilities/drawing-paint-rounded-vertex/example.ani +31 -0
- package/modules/contour/capabilities/drawing-paint-rounded-vertex/example.animl +5 -0
- package/modules/contour/capabilities/drawing-paint-shared-effects/example.ani +26 -0
- package/modules/contour/capabilities/drawing-paint-shared-effects/example.animl +3 -0
- package/modules/contour/capabilities/drawing-paint-straight-vertex/example.ani +30 -0
- package/modules/contour/capabilities/drawing-paint-straight-vertex/example.animl +5 -0
- package/modules/contour/capabilities/drawing-paint-trim-sequential/example.ani +22 -0
- package/modules/contour/capabilities/drawing-paint-trim-sequential/example.animl +3 -0
- package/modules/contour/capabilities/drawing-paint-trim-synchronized/example.ani +22 -0
- package/modules/contour/capabilities/drawing-paint-trim-synchronized/example.animl +3 -0
- package/modules/contour/manifest.source +47 -0
- package/modules/convert/SPEC.md +140 -0
- package/modules/convert/capabilities/data-converter-color-formatting/example.ani +44 -0
- package/modules/convert/capabilities/data-converter-color-formatting/example.animl +8 -0
- package/modules/convert/capabilities/data-converter-trigger/example.ani +78 -0
- package/modules/convert/capabilities/data-converter-trigger/example.animl +22 -0
- package/modules/convert/core/math.source +126 -0
- package/modules/convert/examples/score.ani +60 -0
- package/modules/convert/examples/score.animl +12 -0
- package/modules/convert/examples/travelling-indicator.ani +41 -0
- package/modules/convert/examples/travelling-indicator.animl +8 -0
- package/modules/convert/manifest.source +53 -0
- package/modules/corners/examples/switch.ani +20 -0
- package/modules/corners/examples/switch.animl +3 -0
- package/modules/corners/manifest.source +25 -0
- package/modules/data/SPEC.md +216 -0
- package/modules/data/capabilities/data-bind-conditions/example.ani +52 -0
- package/modules/data/capabilities/data-bind-conditions/example.animl +17 -0
- package/modules/data/capabilities/data-bind-converter-options/example.ani +16 -0
- package/modules/data/capabilities/data-bind-converter-options/example.animl +4 -0
- package/modules/data/capabilities/data-bind-instance-values/example.ani +66 -0
- package/modules/data/capabilities/data-bind-instance-values/example.animl +17 -0
- package/modules/data/capabilities/data-bind-keyframes/example.ani +16 -0
- package/modules/data/capabilities/data-bind-keyframes/example.animl +4 -0
- package/modules/data/capabilities/data-bind-script-inputs/example.ani +16 -0
- package/modules/data/capabilities/data-bind-script-inputs/example.animl +4 -0
- package/modules/data/capabilities/data-bind-text/example.ani +16 -0
- package/modules/data/capabilities/data-bind-text/example.animl +4 -0
- package/modules/data/capabilities/data-binding-absolute/example.ani +43 -0
- package/modules/data/capabilities/data-binding-absolute/example.animl +13 -0
- package/modules/data/capabilities/data-binding-once/example.ani +58 -0
- package/modules/data/capabilities/data-binding-once/example.animl +20 -0
- package/modules/data/capabilities/data-binding-relative/example.ani +16 -0
- package/modules/data/capabilities/data-binding-relative/example.animl +4 -0
- package/modules/data/capabilities/data-binding-to-source/example.ani +58 -0
- package/modules/data/capabilities/data-binding-to-source/example.animl +20 -0
- package/modules/data/capabilities/data-binding-two-way-prefer-source/example.ani +59 -0
- package/modules/data/capabilities/data-binding-two-way-prefer-source/example.animl +20 -0
- package/modules/data/capabilities/data-binding-two-way-prefer-target/example.ani +59 -0
- package/modules/data/capabilities/data-binding-two-way-prefer-target/example.animl +20 -0
- package/modules/data/capabilities/data-component-public-data/example.ani +66 -0
- package/modules/data/capabilities/data-component-public-data/example.animl +17 -0
- package/modules/data/capabilities/data-custom-property-boolean/example.ani +35 -0
- package/modules/data/capabilities/data-custom-property-boolean/example.animl +9 -0
- package/modules/data/capabilities/data-custom-property-color/example.ani +38 -0
- package/modules/data/capabilities/data-custom-property-color/example.animl +9 -0
- package/modules/data/capabilities/data-custom-property-enum/example.ani +40 -0
- package/modules/data/capabilities/data-custom-property-enum/example.animl +9 -0
- package/modules/data/capabilities/data-custom-property-number/example.ani +35 -0
- package/modules/data/capabilities/data-custom-property-number/example.animl +9 -0
- package/modules/data/capabilities/data-custom-property-string/example.ani +35 -0
- package/modules/data/capabilities/data-custom-property-string/example.animl +9 -0
- package/modules/data/capabilities/data-custom-property-trigger/example.ani +52 -0
- package/modules/data/capabilities/data-custom-property-trigger/example.animl +15 -0
- package/modules/data/capabilities/data-default-instance/example.ani +43 -0
- package/modules/data/capabilities/data-default-instance/example.animl +13 -0
- package/modules/data/capabilities/data-editor-preview-instance/example.ani +16 -0
- package/modules/data/capabilities/data-editor-preview-instance/example.animl +4 -0
- package/modules/data/capabilities/data-enum-members/example.ani +41 -0
- package/modules/data/capabilities/data-enum-members/example.animl +8 -0
- package/modules/data/capabilities/data-global-model/example.ani +64 -0
- package/modules/data/capabilities/data-global-model/example.animl +17 -0
- package/modules/data/capabilities/data-instance-export/example.ani +41 -0
- package/modules/data/capabilities/data-instance-export/example.animl +8 -0
- package/modules/data/capabilities/data-list-items/example.ani +55 -0
- package/modules/data/capabilities/data-list-items/example.animl +16 -0
- package/modules/data/capabilities/data-model-definition/example.ani +43 -0
- package/modules/data/capabilities/data-model-definition/example.animl +13 -0
- package/modules/data/capabilities/data-named-instances/example.ani +43 -0
- package/modules/data/capabilities/data-named-instances/example.animl +13 -0
- package/modules/data/capabilities/data-operation-operand-view-model/example.ani +32 -0
- package/modules/data/capabilities/data-operation-operand-view-model/example.animl +9 -0
- package/modules/data/capabilities/data-property-artboard/example.ani +16 -0
- package/modules/data/capabilities/data-property-artboard/example.animl +4 -0
- package/modules/data/capabilities/data-property-asset-blob/example.ani +40 -0
- package/modules/data/capabilities/data-property-asset-blob/example.animl +10 -0
- package/modules/data/capabilities/data-property-asset-font/example.ani +40 -0
- package/modules/data/capabilities/data-property-asset-font/example.animl +10 -0
- package/modules/data/capabilities/data-property-asset-image/example.ani +40 -0
- package/modules/data/capabilities/data-property-asset-image/example.animl +12 -0
- package/modules/data/capabilities/data-property-boolean/example.ani +28 -0
- package/modules/data/capabilities/data-property-boolean/example.animl +7 -0
- package/modules/data/capabilities/data-property-color/example.ani +29 -0
- package/modules/data/capabilities/data-property-color/example.animl +7 -0
- package/modules/data/capabilities/data-property-enum-custom/example.ani +29 -0
- package/modules/data/capabilities/data-property-enum-custom/example.animl +7 -0
- package/modules/data/capabilities/data-property-enum-system/example.ani +29 -0
- package/modules/data/capabilities/data-property-enum-system/example.animl +7 -0
- package/modules/data/capabilities/data-property-list/example.ani +55 -0
- package/modules/data/capabilities/data-property-list/example.animl +16 -0
- package/modules/data/capabilities/data-property-number/example.ani +29 -0
- package/modules/data/capabilities/data-property-number/example.animl +7 -0
- package/modules/data/capabilities/data-property-string/example.ani +29 -0
- package/modules/data/capabilities/data-property-string/example.animl +7 -0
- package/modules/data/capabilities/data-property-symbol-list-index/example.ani +16 -0
- package/modules/data/capabilities/data-property-symbol-list-index/example.animl +4 -0
- package/modules/data/capabilities/data-property-text-style/example.ani +16 -0
- package/modules/data/capabilities/data-property-text-style/example.animl +4 -0
- package/modules/data/capabilities/data-property-trigger/example.ani +51 -0
- package/modules/data/capabilities/data-property-trigger/example.animl +17 -0
- package/modules/data/capabilities/data-property-view-model/example.ani +55 -0
- package/modules/data/capabilities/data-property-view-model/example.animl +16 -0
- package/modules/data/capabilities/data-script-model-api/example.ani +16 -0
- package/modules/data/capabilities/data-script-model-api/example.animl +4 -0
- package/modules/data/capabilities/data-scripted-converter/example.ani +16 -0
- package/modules/data/capabilities/data-scripted-converter/example.animl +4 -0
- package/modules/data/capabilities/data-state-action-trigger/example.ani +51 -0
- package/modules/data/capabilities/data-state-action-trigger/example.animl +17 -0
- package/modules/data/capabilities/data-system-enum-horizontal-text-align/example.ani +29 -0
- package/modules/data/capabilities/data-system-enum-horizontal-text-align/example.animl +7 -0
- package/modules/data/capabilities/data-system-enum-layout-alignment/example.ani +29 -0
- package/modules/data/capabilities/data-system-enum-layout-alignment/example.animl +7 -0
- package/modules/data/capabilities/data-system-enum-layout-direction/example.ani +29 -0
- package/modules/data/capabilities/data-system-enum-layout-direction/example.animl +7 -0
- package/modules/data/capabilities/data-system-enum-layout-display/example.ani +29 -0
- package/modules/data/capabilities/data-system-enum-layout-display/example.animl +7 -0
- package/modules/data/capabilities/data-system-enum-layout-flex-direction/example.ani +29 -0
- package/modules/data/capabilities/data-system-enum-layout-flex-direction/example.animl +7 -0
- package/modules/data/capabilities/data-system-enum-layout-position/example.ani +29 -0
- package/modules/data/capabilities/data-system-enum-layout-position/example.animl +7 -0
- package/modules/data/capabilities/data-system-enum-layout-position-units/example.ani +29 -0
- package/modules/data/capabilities/data-system-enum-layout-position-units/example.animl +7 -0
- package/modules/data/capabilities/data-system-enum-layout-scale-type/example.ani +29 -0
- package/modules/data/capabilities/data-system-enum-layout-scale-type/example.animl +7 -0
- package/modules/data/capabilities/data-system-enum-layout-wrap/example.ani +29 -0
- package/modules/data/capabilities/data-system-enum-layout-wrap/example.animl +7 -0
- package/modules/data/capabilities/data-system-enum-scroll-direction/example.ani +29 -0
- package/modules/data/capabilities/data-system-enum-scroll-direction/example.animl +7 -0
- package/modules/data/capabilities/data-system-enum-semantic-check-state/example.ani +29 -0
- package/modules/data/capabilities/data-system-enum-semantic-check-state/example.animl +7 -0
- package/modules/data/capabilities/data-system-enum-text-box/example.ani +29 -0
- package/modules/data/capabilities/data-system-enum-text-box/example.animl +7 -0
- package/modules/data/capabilities/data-system-enum-text-overflow/example.ani +29 -0
- package/modules/data/capabilities/data-system-enum-text-overflow/example.animl +7 -0
- package/modules/data/capabilities/data-system-enum-text-trim-bottom/example.ani +29 -0
- package/modules/data/capabilities/data-system-enum-text-trim-bottom/example.animl +7 -0
- package/modules/data/capabilities/data-system-enum-text-trim-top/example.ani +29 -0
- package/modules/data/capabilities/data-system-enum-text-trim-top/example.animl +7 -0
- package/modules/data/capabilities/data-system-enum-vertical-text-align/example.ani +29 -0
- package/modules/data/capabilities/data-system-enum-vertical-text-align/example.animl +7 -0
- package/modules/data/capabilities/data-system-enum-word-wrap/example.ani +29 -0
- package/modules/data/capabilities/data-system-enum-word-wrap/example.animl +7 -0
- package/modules/data/capabilities/drawing-paint-gradient-channel-binding/example.ani +46 -0
- package/modules/data/capabilities/drawing-paint-gradient-channel-binding/example.animl +14 -0
- package/modules/data/capabilities/input-data-listener/example.ani +41 -0
- package/modules/data/capabilities/input-data-listener/example.animl +10 -0
- package/modules/data/capabilities/input-write-data-constant/example.ani +41 -0
- package/modules/data/capabilities/input-write-data-constant/example.animl +10 -0
- package/modules/data/capabilities/input-write-data-copy/example.ani +39 -0
- package/modules/data/capabilities/input-write-data-copy/example.animl +10 -0
- package/modules/data/capabilities/input-write-focused/example.ani +39 -0
- package/modules/data/capabilities/input-write-focused/example.animl +11 -0
- package/modules/data/capabilities/input-write-gamepad-axis/example.ani +38 -0
- package/modules/data/capabilities/input-write-gamepad-axis/example.animl +9 -0
- package/modules/data/capabilities/input-write-gamepad-button-pressed/example.ani +38 -0
- package/modules/data/capabilities/input-write-gamepad-button-pressed/example.animl +9 -0
- package/modules/data/capabilities/input-write-gamepad-button-value/example.ani +38 -0
- package/modules/data/capabilities/input-write-gamepad-button-value/example.animl +9 -0
- package/modules/data/capabilities/input-write-gamepad-changed-value/example.ani +38 -0
- package/modules/data/capabilities/input-write-gamepad-changed-value/example.animl +9 -0
- package/modules/data/examples/data-extras.ani +109 -0
- package/modules/data/examples/data-extras.animl +28 -0
- package/modules/data/examples/scoreboard.ani +74 -0
- package/modules/data/examples/scoreboard.animl +18 -0
- package/modules/data/manifest.source +111 -0
- package/modules/data-artboard/SPEC.md +94 -0
- package/modules/data-artboard/capabilities/components-host-artboard-reference/example.ani +16 -0
- package/modules/data-artboard/capabilities/components-host-artboard-reference/example.animl +26 -0
- package/modules/data-artboard/capabilities/data-host-artboard/example.ani +16 -0
- package/modules/data-artboard/capabilities/data-host-artboard/example.animl +18 -0
- package/modules/data-artboard/capabilities/host-api-bindable-artboards/example.ani +16 -0
- package/modules/data-artboard/capabilities/host-api-bindable-artboards/example.animl +34 -0
- package/modules/data-artboard/capabilities/host-api-data-artboard/example.ani +16 -0
- package/modules/data-artboard/capabilities/host-api-data-artboard/example.animl +18 -0
- package/modules/data-artboard/manifest.source +41 -0
- package/modules/data-host/SPEC.md +50 -0
- package/modules/data-host/examples/nested.ani +82 -0
- package/modules/data-host/examples/nested.animl +21 -0
- package/modules/data-host/manifest.source +26 -0
- package/modules/derive/SPEC.md +66 -0
- package/modules/derive/examples/scoreboard.ani +121 -0
- package/modules/derive/examples/scoreboard.animl +27 -0
- package/modules/derive/manifest.source +24 -0
- package/modules/devtools/SPEC.md +25 -0
- package/modules/devtools/capabilities/host-api-deprecation-policy/example.ani +16 -0
- package/modules/devtools/capabilities/host-api-deprecation-policy/example.animl +3 -0
- package/modules/devtools/capabilities/host-api-fps-counter/example.ani +16 -0
- package/modules/devtools/capabilities/host-api-fps-counter/example.animl +9 -0
- package/modules/devtools/capabilities/host-api-performance-marks/example.ani +16 -0
- package/modules/devtools/capabilities/host-api-performance-marks/example.animl +3 -0
- package/modules/devtools/capabilities/host-api-stop/example.ani +16 -0
- package/modules/devtools/capabilities/host-api-stop/example.animl +3 -0
- package/modules/devtools/manifest.source +13 -0
- package/modules/events/examples/events.ani +75 -0
- package/modules/events/examples/events.animl +23 -0
- package/modules/events/examples/share-evidence/README.md +48 -0
- package/modules/events/examples/share-evidence/clicks.jsonl +51 -0
- package/modules/events/examples/share-evidence/clicks.script +102 -0
- package/modules/events/examples/share-evidence/interrupt.jsonl +3 -0
- package/modules/events/examples/share-evidence/interrupt.script +7 -0
- package/modules/events/examples/share-evidence/perf.txt +4 -0
- package/modules/events/examples/share-evidence/pulse.jsonl +10 -0
- package/modules/events/examples/share-evidence/pulse.script +20 -0
- package/modules/events/examples/share-evidence/rest-diff.txt +1 -0
- package/modules/events/examples/share-evidence/size.txt +18 -0
- package/modules/events/examples/share-evidence/verify.py +48 -0
- package/modules/events/examples/share-tone.wav +0 -0
- package/modules/events/examples/share.ani +186 -0
- package/modules/events/examples/share.animl +40 -0
- package/modules/events/manifest.source +74 -0
- package/modules/focus/capabilities/input-focus-clear/example.ani +116 -0
- package/modules/focus/capabilities/input-focus-clear/example.animl +28 -0
- package/modules/focus/capabilities/input-focus-down/example.ani +116 -0
- package/modules/focus/capabilities/input-focus-down/example.animl +28 -0
- package/modules/focus/capabilities/input-focus-edge-closed-loop/example.ani +116 -0
- package/modules/focus/capabilities/input-focus-edge-closed-loop/example.animl +28 -0
- package/modules/focus/capabilities/input-focus-edge-parent-scope/example.ani +116 -0
- package/modules/focus/capabilities/input-focus-edge-parent-scope/example.animl +28 -0
- package/modules/focus/capabilities/input-focus-edge-stop/example.ani +116 -0
- package/modules/focus/capabilities/input-focus-edge-stop/example.animl +28 -0
- package/modules/focus/capabilities/input-focus-enabled/example.ani +116 -0
- package/modules/focus/capabilities/input-focus-enabled/example.animl +28 -0
- package/modules/focus/capabilities/input-focus-left/example.ani +116 -0
- package/modules/focus/capabilities/input-focus-left/example.animl +28 -0
- package/modules/focus/capabilities/input-focus-next/example.ani +116 -0
- package/modules/focus/capabilities/input-focus-next/example.animl +28 -0
- package/modules/focus/capabilities/input-focus-pointer/example.ani +116 -0
- package/modules/focus/capabilities/input-focus-pointer/example.animl +28 -0
- package/modules/focus/capabilities/input-focus-previous/example.ani +116 -0
- package/modules/focus/capabilities/input-focus-previous/example.animl +28 -0
- package/modules/focus/capabilities/input-focus-right/example.ani +116 -0
- package/modules/focus/capabilities/input-focus-right/example.animl +28 -0
- package/modules/focus/capabilities/input-focus-target/example.ani +116 -0
- package/modules/focus/capabilities/input-focus-target/example.animl +28 -0
- package/modules/focus/capabilities/input-focus-traverse/example.ani +116 -0
- package/modules/focus/capabilities/input-focus-traverse/example.animl +28 -0
- package/modules/focus/capabilities/input-focus-up/example.ani +116 -0
- package/modules/focus/capabilities/input-focus-up/example.animl +28 -0
- package/modules/focus/capabilities/input-listen-blur/example.ani +116 -0
- package/modules/focus/capabilities/input-listen-blur/example.animl +28 -0
- package/modules/focus/capabilities/input-listen-focus/example.ani +116 -0
- package/modules/focus/capabilities/input-listen-focus/example.animl +28 -0
- package/modules/focus/examples/README.md +10 -0
- package/modules/focus/examples/traversal.ani +70 -0
- package/modules/focus/examples/traversal.animl +16 -0
- package/modules/focus/manifest.source +48 -0
- package/modules/fonts/SPEC.md +92 -0
- package/modules/fonts/capabilities/assets-font/example.ani +23 -0
- package/modules/fonts/capabilities/assets-font/example.animl +5 -0
- package/modules/fonts/capabilities/assets-host-decode-font/example.ani +23 -0
- package/modules/fonts/capabilities/assets-host-decode-font/example.animl +5 -0
- package/modules/fonts/capabilities/assets-replacement-scope-font/example.ani +23 -0
- package/modules/fonts/capabilities/assets-replacement-scope-font/example.animl +5 -0
- package/modules/fonts/capabilities/data-host-font/example.ani +23 -0
- package/modules/fonts/capabilities/data-host-font/example.animl +5 -0
- package/modules/fonts/capabilities/host-api-data-font/example.ani +23 -0
- package/modules/fonts/capabilities/host-api-data-font/example.animl +5 -0
- package/modules/fonts/capabilities/host-api-font-fallback/example.ani +23 -0
- package/modules/fonts/capabilities/host-api-font-fallback/example.animl +5 -0
- package/modules/fonts/capabilities/text-font-assets/example.ani +23 -0
- package/modules/fonts/capabilities/text-font-assets/example.animl +5 -0
- package/modules/fonts/capabilities/text-font-decoding/example.ani +43 -0
- package/modules/fonts/capabilities/text-font-decoding/example.animl +9 -0
- package/modules/fonts/capabilities/text-font-fallback/example.ani +23 -0
- package/modules/fonts/capabilities/text-font-fallback/example.animl +5 -0
- package/modules/fonts/capabilities/text-font-metrics/example.ani +40 -0
- package/modules/fonts/capabilities/text-font-metrics/example.animl +9 -0
- package/modules/fonts/capabilities/text-opentype-features/example.ani +23 -0
- package/modules/fonts/capabilities/text-opentype-features/example.animl +7 -0
- package/modules/fonts/capabilities/text-variable-axes/example.ani +23 -0
- package/modules/fonts/capabilities/text-variable-axes/example.animl +9 -0
- package/modules/fonts/manifest.source +57 -0
- package/modules/host/AUTHORING.md +33 -0
- package/modules/host/SPEC.md +76 -0
- package/modules/host/examples/page.html +23 -0
- package/modules/host/examples/score.ani +48 -0
- package/modules/host/examples/score.animl +10 -0
- package/modules/host/manifest.source +19 -0
- package/modules/host-edit/AUTHORING.md +66 -0
- package/modules/host-edit/SPEC.md +96 -0
- package/modules/host-edit/examples/board.ani +72 -0
- package/modules/host-edit/examples/board.animl +17 -0
- package/modules/host-edit/examples/page.html +34 -0
- package/modules/host-edit/manifest.source +21 -0
- package/modules/host-fit/capabilities/host-api-fit-layout/example.ani +55 -0
- package/modules/host-fit/capabilities/host-api-fit-layout/example.animl +11 -0
- package/modules/host-fit/examples/tile.ani +19 -0
- package/modules/host-fit/examples/tile.animl +3 -0
- package/modules/host-fit/manifest.source +22 -0
- package/modules/host-values/SPEC.md +9 -0
- package/modules/host-values/manifest.source +22 -0
- package/modules/ik/capabilities/rigging-ik/example.ani +16 -0
- package/modules/ik/capabilities/rigging-ik/example.animl +11 -0
- package/modules/ik/capabilities/rigging-ik-bend/example.ani +16 -0
- package/modules/ik/capabilities/rigging-ik-bend/example.animl +11 -0
- package/modules/ik/examples/reach.ani +100 -0
- package/modules/ik/examples/reach.animl +18 -0
- package/modules/ik/manifest.source +30 -0
- package/modules/input/SPEC.md +397 -0
- package/modules/input/capabilities/host-api-coordinate-mapping/example.ani +32 -0
- package/modules/input/capabilities/host-api-coordinate-mapping/example.animl +7 -0
- package/modules/input/capabilities/host-api-dom-listener-control/example.ani +32 -0
- package/modules/input/capabilities/host-api-dom-listener-control/example.animl +7 -0
- package/modules/input/capabilities/host-api-gamepad/example.ani +34 -0
- package/modules/input/capabilities/host-api-gamepad/example.animl +7 -0
- package/modules/input/capabilities/host-api-low-level-pointer/example.ani +32 -0
- package/modules/input/capabilities/host-api-low-level-pointer/example.animl +7 -0
- package/modules/input/capabilities/host-api-low-level-scroll/example.ani +32 -0
- package/modules/input/capabilities/host-api-low-level-scroll/example.animl +7 -0
- package/modules/input/capabilities/host-api-manual-gamepad-batch/example.ani +34 -0
- package/modules/input/capabilities/host-api-manual-gamepad-batch/example.animl +7 -0
- package/modules/input/capabilities/host-api-multitouch/example.ani +32 -0
- package/modules/input/capabilities/host-api-multitouch/example.animl +7 -0
- package/modules/input/capabilities/host-api-pointer-exit/example.ani +31 -0
- package/modules/input/capabilities/host-api-pointer-exit/example.animl +7 -0
- package/modules/input/capabilities/host-api-scroll-hit-policy/example.ani +32 -0
- package/modules/input/capabilities/host-api-scroll-hit-policy/example.animl +7 -0
- package/modules/input/capabilities/host-api-scroll-latching/example.ani +32 -0
- package/modules/input/capabilities/host-api-scroll-latching/example.animl +7 -0
- package/modules/input/capabilities/input-align-preserve/example.ani +43 -0
- package/modules/input/capabilities/input-align-preserve/example.animl +9 -0
- package/modules/input/capabilities/input-align-snap/example.ani +43 -0
- package/modules/input/capabilities/input-align-snap/example.animl +9 -0
- package/modules/input/capabilities/input-bounded-hit-tests/example.ani +32 -0
- package/modules/input/capabilities/input-bounded-hit-tests/example.animl +7 -0
- package/modules/input/capabilities/input-button-middle/example.ani +33 -0
- package/modules/input/capabilities/input-button-middle/example.animl +7 -0
- package/modules/input/capabilities/input-button-secondary/example.ani +33 -0
- package/modules/input/capabilities/input-button-secondary/example.animl +7 -0
- package/modules/input/capabilities/input-capture-phase/example.ani +60 -0
- package/modules/input/capabilities/input-capture-phase/example.animl +11 -0
- package/modules/input/capabilities/input-cursor-arrow/example.ani +33 -0
- package/modules/input/capabilities/input-cursor-arrow/example.animl +7 -0
- package/modules/input/capabilities/input-cursor-hidden/example.ani +33 -0
- package/modules/input/capabilities/input-cursor-hidden/example.animl +7 -0
- package/modules/input/capabilities/input-cursor-intent/example.ani +33 -0
- package/modules/input/capabilities/input-cursor-intent/example.animl +7 -0
- package/modules/input/capabilities/input-cursor-pointer/example.ani +33 -0
- package/modules/input/capabilities/input-cursor-pointer/example.animl +7 -0
- package/modules/input/capabilities/input-cursor-resize-horizontal/example.ani +33 -0
- package/modules/input/capabilities/input-cursor-resize-horizontal/example.animl +7 -0
- package/modules/input/capabilities/input-cursor-resize-vertical/example.ani +33 -0
- package/modules/input/capabilities/input-cursor-resize-vertical/example.animl +7 -0
- package/modules/input/capabilities/input-cursor-text/example.ani +33 -0
- package/modules/input/capabilities/input-cursor-text/example.animl +7 -0
- package/modules/input/capabilities/input-disable-listeners/example.ani +32 -0
- package/modules/input/capabilities/input-disable-listeners/example.animl +7 -0
- package/modules/input/capabilities/input-gamepad-axis/example.ani +34 -0
- package/modules/input/capabilities/input-gamepad-axis/example.animl +7 -0
- package/modules/input/capabilities/input-gamepad-button/example.ani +32 -0
- package/modules/input/capabilities/input-gamepad-button/example.animl +7 -0
- package/modules/input/capabilities/input-gamepad-button-phases/example.ani +33 -0
- package/modules/input/capabilities/input-gamepad-button-phases/example.animl +7 -0
- package/modules/input/capabilities/input-gamepad-connected/example.ani +31 -0
- package/modules/input/capabilities/input-gamepad-connected/example.animl +7 -0
- package/modules/input/capabilities/input-gamepad-disconnected/example.ani +31 -0
- package/modules/input/capabilities/input-gamepad-disconnected/example.animl +7 -0
- package/modules/input/capabilities/input-gamepad-host/example.ani +34 -0
- package/modules/input/capabilities/input-gamepad-host/example.animl +7 -0
- package/modules/input/capabilities/input-gamepad-index-mapping/example.ani +34 -0
- package/modules/input/capabilities/input-gamepad-index-mapping/example.animl +7 -0
- package/modules/input/capabilities/input-hit-occlusion-query/example.ani +42 -0
- package/modules/input/capabilities/input-hit-occlusion-query/example.animl +8 -0
- package/modules/input/capabilities/input-hit-parent-chain/example.ani +39 -0
- package/modules/input/capabilities/input-hit-parent-chain/example.animl +9 -0
- package/modules/input/capabilities/input-hit-shape-geometry/example.ani +32 -0
- package/modules/input/capabilities/input-hit-shape-geometry/example.animl +7 -0
- package/modules/input/capabilities/input-hit-test-host/example.ani +32 -0
- package/modules/input/capabilities/input-hit-test-host/example.animl +7 -0
- package/modules/input/capabilities/input-key-down/example.ani +32 -0
- package/modules/input/capabilities/input-key-down/example.animl +7 -0
- package/modules/input/capabilities/input-key-filter/example.ani +32 -0
- package/modules/input/capabilities/input-key-filter/example.animl +7 -0
- package/modules/input/capabilities/input-key-modifiers/example.ani +33 -0
- package/modules/input/capabilities/input-key-modifiers/example.animl +7 -0
- package/modules/input/capabilities/input-key-repeat/example.ani +32 -0
- package/modules/input/capabilities/input-key-repeat/example.animl +7 -0
- package/modules/input/capabilities/input-key-up/example.ani +32 -0
- package/modules/input/capabilities/input-key-up/example.animl +7 -0
- package/modules/input/capabilities/input-keyboard-bubbling/example.ani +45 -0
- package/modules/input/capabilities/input-keyboard-bubbling/example.animl +10 -0
- package/modules/input/capabilities/input-multi-touch/example.ani +32 -0
- package/modules/input/capabilities/input-multi-touch/example.animl +7 -0
- package/modules/input/capabilities/input-multi-trigger-listener/example.ani +32 -0
- package/modules/input/capabilities/input-multi-trigger-listener/example.animl +7 -0
- package/modules/input/capabilities/input-opaque-targets/example.ani +42 -0
- package/modules/input/capabilities/input-opaque-targets/example.animl +8 -0
- package/modules/input/capabilities/input-pointer-cancel/example.ani +31 -0
- package/modules/input/capabilities/input-pointer-cancel/example.animl +7 -0
- package/modules/input/capabilities/input-pointer-drag/example.ani +58 -0
- package/modules/input/capabilities/input-pointer-drag/example.animl +17 -0
- package/modules/input/capabilities/input-pointer-drag-end/example.ani +58 -0
- package/modules/input/capabilities/input-pointer-drag-end/example.animl +17 -0
- package/modules/input/capabilities/input-pointer-drag-start/example.ani +58 -0
- package/modules/input/capabilities/input-pointer-drag-start/example.animl +17 -0
- package/modules/input/capabilities/input-pointer-enable/example.ani +32 -0
- package/modules/input/capabilities/input-pointer-enable/example.animl +7 -0
- package/modules/input/capabilities/input-touch-page-scroll/example.ani +32 -0
- package/modules/input/capabilities/input-touch-page-scroll/example.animl +7 -0
- package/modules/input/capabilities/input-trackpad-scroll/example.ani +32 -0
- package/modules/input/capabilities/input-trackpad-scroll/example.animl +7 -0
- package/modules/input/capabilities/input-wheel-scroll/example.ani +32 -0
- package/modules/input/capabilities/input-wheel-scroll/example.animl +7 -0
- package/modules/input/capabilities/input-write-key-pressed/example.ani +39 -0
- package/modules/input/capabilities/input-write-key-pressed/example.animl +7 -0
- package/modules/input/capabilities/input-write-pointer-delta-x/example.ani +39 -0
- package/modules/input/capabilities/input-write-pointer-delta-x/example.animl +7 -0
- package/modules/input/capabilities/input-write-pointer-delta-y/example.ani +39 -0
- package/modules/input/capabilities/input-write-pointer-delta-y/example.animl +7 -0
- package/modules/input/capabilities/input-write-pointer-x/example.ani +39 -0
- package/modules/input/capabilities/input-write-pointer-x/example.animl +7 -0
- package/modules/input/capabilities/input-write-pointer-y/example.ani +39 -0
- package/modules/input/capabilities/input-write-pointer-y/example.animl +7 -0
- package/modules/input/capabilities/transforms-collapse/example.ani +39 -0
- package/modules/input/capabilities/transforms-collapse/example.animl +9 -0
- package/modules/input/capabilities/transforms-solo/example.ani +48 -0
- package/modules/input/capabilities/transforms-solo/example.animl +10 -0
- package/modules/input/core/commands.source +64 -0
- package/modules/input/core/types.source +97 -0
- package/modules/input/examples/README.md +9 -0
- package/modules/input/examples/drag-slider.ani +50 -0
- package/modules/input/examples/drag-slider.animl +11 -0
- package/modules/input/manifest.source +98 -0
- package/modules/layout/SPEC.md +210 -0
- package/modules/layout/capabilities/data-bind-layout/example.ani +60 -0
- package/modules/layout/capabilities/data-bind-layout/example.animl +10 -0
- package/modules/layout/capabilities/layout-alignment/example.ani +44 -0
- package/modules/layout/capabilities/layout-alignment/example.animl +6 -0
- package/modules/layout/capabilities/layout-animated-reflow/example.ani +62 -0
- package/modules/layout/capabilities/layout-animated-reflow/example.animl +12 -0
- package/modules/layout/capabilities/layout-containers/example.ani +62 -0
- package/modules/layout/capabilities/layout-containers/example.animl +9 -0
- package/modules/layout/capabilities/layout-fill-sizing/example.ani +45 -0
- package/modules/layout/capabilities/layout-fill-sizing/example.animl +6 -0
- package/modules/layout/capabilities/layout-fixed-sizing/example.ani +46 -0
- package/modules/layout/capabilities/layout-fixed-sizing/example.animl +6 -0
- package/modules/layout/capabilities/layout-flex-align-items/example.ani +43 -0
- package/modules/layout/capabilities/layout-flex-align-items/example.animl +6 -0
- package/modules/layout/capabilities/layout-flex-direction/example.ani +43 -0
- package/modules/layout/capabilities/layout-flex-direction/example.animl +6 -0
- package/modules/layout/capabilities/layout-flex-justify/example.ani +42 -0
- package/modules/layout/capabilities/layout-flex-justify/example.animl +6 -0
- package/modules/layout/capabilities/layout-hug-sizing/example.ani +42 -0
- package/modules/layout/capabilities/layout-hug-sizing/example.animl +6 -0
- package/modules/layout/capabilities/layout-intrinsic/example.ani +40 -0
- package/modules/layout/capabilities/layout-intrinsic/example.animl +6 -0
- package/modules/layout/capabilities/layout-paint/example.ani +60 -0
- package/modules/layout/capabilities/layout-paint/example.animl +8 -0
- package/modules/layout/capabilities/layout-participants/example.ani +40 -0
- package/modules/layout/capabilities/layout-participants/example.animl +6 -0
- package/modules/layout/capabilities/layout-self-alignment/example.ani +45 -0
- package/modules/layout/capabilities/layout-self-alignment/example.animl +6 -0
- package/modules/layout/capabilities/layout-size-bounds/example.ani +49 -0
- package/modules/layout/capabilities/layout-size-bounds/example.animl +6 -0
- package/modules/layout/capabilities/layout-spacing/example.ani +45 -0
- package/modules/layout/capabilities/layout-spacing/example.animl +6 -0
- package/modules/layout/capabilities/layout-visibility/example.ani +56 -0
- package/modules/layout/capabilities/layout-visibility/example.animl +7 -0
- package/modules/layout/examples/button.ani +61 -0
- package/modules/layout/examples/button.animl +12 -0
- package/modules/layout/examples/reflow.ani +62 -0
- package/modules/layout/examples/reflow.animl +12 -0
- package/modules/layout/examples/wrapped.ani +55 -0
- package/modules/layout/examples/wrapped.animl +11 -0
- package/modules/layout/manifest.source +73 -0
- package/modules/lists/SPEC.md +44 -0
- package/modules/lists/capabilities/components-explicit-context/example.ani +81 -0
- package/modules/lists/capabilities/components-explicit-context/example.animl +22 -0
- package/modules/lists/capabilities/components-inherited-context/example.ani +99 -0
- package/modules/lists/capabilities/components-inherited-context/example.animl +24 -0
- package/modules/lists/capabilities/components-list/example.ani +77 -0
- package/modules/lists/capabilities/components-list/example.animl +19 -0
- package/modules/lists/capabilities/components-list-map/example.ani +116 -0
- package/modules/lists/capabilities/components-list-map/example.animl +29 -0
- package/modules/lists/capabilities/components-list-size-override/example.ani +83 -0
- package/modules/lists/capabilities/components-list-size-override/example.animl +20 -0
- package/modules/lists/capabilities/data-binding-relative/example.ani +77 -0
- package/modules/lists/capabilities/data-binding-relative/example.animl +19 -0
- package/modules/lists/capabilities/data-converter-number-to-list/example.ani +109 -0
- package/modules/lists/capabilities/data-converter-number-to-list/example.animl +29 -0
- package/modules/lists/capabilities/data-property-symbol-list-index/example.ani +77 -0
- package/modules/lists/capabilities/data-property-symbol-list-index/example.animl +19 -0
- package/modules/lists/examples/players.ani +77 -0
- package/modules/lists/examples/players.animl +19 -0
- package/modules/lists/manifest.source +43 -0
- package/modules/machine/capabilities/state-machine-any-state/example.ani +62 -0
- package/modules/machine/capabilities/state-machine-any-state/example.animl +22 -0
- package/modules/machine/capabilities/state-machine-blend-1d-data/example.ani +74 -0
- package/modules/machine/capabilities/state-machine-blend-1d-data/example.animl +23 -0
- package/modules/machine/capabilities/state-machine-blend-1d-input/example.ani +70 -0
- package/modules/machine/capabilities/state-machine-blend-1d-input/example.animl +23 -0
- package/modules/machine/capabilities/state-machine-blend-additive/example.ani +69 -0
- package/modules/machine/capabilities/state-machine-blend-additive/example.animl +23 -0
- package/modules/machine/capabilities/state-machine-blend-direct/example.ani +64 -0
- package/modules/machine/capabilities/state-machine-blend-direct/example.animl +21 -0
- package/modules/machine/capabilities/state-machine-blend-exit-clock/example.ani +72 -0
- package/modules/machine/capabilities/state-machine-blend-exit-clock/example.animl +25 -0
- package/modules/machine/capabilities/state-machine-blend-weight-constant/example.ani +64 -0
- package/modules/machine/capabilities/state-machine-blend-weight-constant/example.animl +21 -0
- package/modules/machine/capabilities/state-machine-blend-weight-data/example.ani +71 -0
- package/modules/machine/capabilities/state-machine-blend-weight-data/example.animl +23 -0
- package/modules/machine/capabilities/state-machine-blend-weight-input/example.ani +69 -0
- package/modules/machine/capabilities/state-machine-blend-weight-input/example.animl +23 -0
- package/modules/machine/capabilities/state-machine-condition-artboard/example.ani +50 -0
- package/modules/machine/capabilities/state-machine-condition-artboard/example.animl +13 -0
- package/modules/machine/capabilities/state-machine-condition-component/example.ani +76 -0
- package/modules/machine/capabilities/state-machine-condition-component/example.animl +19 -0
- package/modules/machine/capabilities/state-machine-condition-data/example.ani +54 -0
- package/modules/machine/capabilities/state-machine-condition-data/example.animl +15 -0
- package/modules/machine/capabilities/state-machine-condition-focus/example.ani +49 -0
- package/modules/machine/capabilities/state-machine-condition-focus/example.animl +13 -0
- package/modules/machine/capabilities/state-machine-continue-on-exit/example.ani +58 -0
- package/modules/machine/capabilities/state-machine-continue-on-exit/example.animl +21 -0
- package/modules/machine/capabilities/state-machine-entry-state/example.ani +56 -0
- package/modules/machine/capabilities/state-machine-entry-state/example.animl +19 -0
- package/modules/machine/capabilities/state-machine-exit-state/example.ani +46 -0
- package/modules/machine/capabilities/state-machine-exit-state/example.animl +15 -0
- package/modules/machine/capabilities/state-machine-exit-time-relative/example.ani +52 -0
- package/modules/machine/capabilities/state-machine-exit-time-relative/example.animl +19 -0
- package/modules/machine/capabilities/state-machine-literal-asset/example.ani +62 -0
- package/modules/machine/capabilities/state-machine-literal-asset/example.animl +18 -0
- package/modules/machine/capabilities/state-machine-literal-boolean/example.ani +53 -0
- package/modules/machine/capabilities/state-machine-literal-boolean/example.animl +15 -0
- package/modules/machine/capabilities/state-machine-literal-color/example.ani +54 -0
- package/modules/machine/capabilities/state-machine-literal-color/example.animl +15 -0
- package/modules/machine/capabilities/state-machine-literal-enum/example.ani +54 -0
- package/modules/machine/capabilities/state-machine-literal-enum/example.animl +15 -0
- package/modules/machine/capabilities/state-machine-literal-string/example.ani +54 -0
- package/modules/machine/capabilities/state-machine-literal-string/example.animl +15 -0
- package/modules/machine/capabilities/state-machine-literal-trigger/example.ani +53 -0
- package/modules/machine/capabilities/state-machine-literal-trigger/example.animl +15 -0
- package/modules/machine/capabilities/state-machine-state-entry-actions/example.ani +56 -0
- package/modules/machine/capabilities/state-machine-state-entry-actions/example.animl +16 -0
- package/modules/machine/capabilities/state-machine-state-exit-actions/example.ani +56 -0
- package/modules/machine/capabilities/state-machine-state-exit-actions/example.animl +16 -0
- package/modules/machine/capabilities/state-machine-state-random/example.ani +53 -0
- package/modules/machine/capabilities/state-machine-state-random/example.animl +17 -0
- package/modules/machine/capabilities/state-machine-state-reset/example.ani +52 -0
- package/modules/machine/capabilities/state-machine-state-reset/example.animl +18 -0
- package/modules/machine/capabilities/state-machine-transition-actions/example.ani +56 -0
- package/modules/machine/capabilities/state-machine-transition-actions/example.animl +16 -0
- package/modules/machine/capabilities/state-machine-transition-disabled/example.ani +57 -0
- package/modules/machine/capabilities/state-machine-transition-disabled/example.animl +19 -0
- package/modules/machine/capabilities/state-machine-transition-duration-relative/example.ani +57 -0
- package/modules/machine/capabilities/state-machine-transition-duration-relative/example.animl +21 -0
- package/modules/machine/capabilities/state-machine-transition-end-actions/example.ani +56 -0
- package/modules/machine/capabilities/state-machine-transition-end-actions/example.animl +16 -0
- package/modules/machine/capabilities/state-machine-transition-random-weight/example.ani +53 -0
- package/modules/machine/capabilities/state-machine-transition-random-weight/example.animl +17 -0
- package/modules/machine/examples/README.md +12 -0
- package/modules/machine/examples/blend-pulse.ani +115 -0
- package/modules/machine/examples/blend-pulse.animl +32 -0
- package/modules/machine/manifest.source +73 -0
- package/modules/markup/manifest.source +26 -0
- package/modules/markup-animation/manifest.source +23 -0
- package/modules/markup-hooks/manifest.source +13 -0
- package/modules/markup-libraries/SPEC.md +56 -0
- package/modules/markup-libraries/capabilities/components-library-export/example.ani +45 -0
- package/modules/markup-libraries/capabilities/components-library-export/example.animl +4 -0
- package/modules/markup-libraries/capabilities/components-library-models/example.ani +45 -0
- package/modules/markup-libraries/capabilities/components-library-models/example.animl +4 -0
- package/modules/markup-libraries/capabilities/components-library-update/example.ani +45 -0
- package/modules/markup-libraries/capabilities/components-library-update/example.animl +4 -0
- package/modules/markup-libraries/manifest.source +38 -0
- package/modules/media/manifest.source +21 -0
- package/modules/mesh/capabilities/rigging-mesh/example.ani +50 -0
- package/modules/mesh/capabilities/rigging-mesh/example.animl +9 -0
- package/modules/mesh/capabilities/rigging-mesh-animation/example.ani +65 -0
- package/modules/mesh/capabilities/rigging-mesh-animation/example.animl +15 -0
- package/modules/mesh/examples/flag.ani +108 -0
- package/modules/mesh/examples/flag.animl +23 -0
- package/modules/mesh/manifest.source +37 -0
- package/modules/mix/capabilities/drawing-paint-additive-strength/example.ani +34 -0
- package/modules/mix/capabilities/drawing-paint-additive-strength/example.animl +4 -0
- package/modules/mix/capabilities/drawing-paint-blend-additive/example.ani +33 -0
- package/modules/mix/capabilities/drawing-paint-blend-additive/example.animl +4 -0
- package/modules/mix/capabilities/drawing-paint-paint-blend-override/example.ani +37 -0
- package/modules/mix/capabilities/drawing-paint-paint-blend-override/example.animl +4 -0
- package/modules/mix/capabilities/host-api-factory/example.ani +16 -0
- package/modules/mix/capabilities/host-api-factory/example.animl +3 -0
- package/modules/mix/capabilities/host-api-renderer/example.ani +16 -0
- package/modules/mix/capabilities/host-api-renderer/example.animl +3 -0
- package/modules/mix/manifest.source +36 -0
- package/modules/motion/capabilities/animation-cubic-value/example.ani +40 -0
- package/modules/motion/capabilities/animation-cubic-value/example.animl +9 -0
- package/modules/motion/capabilities/animation-elastic-in/example.ani +40 -0
- package/modules/motion/capabilities/animation-elastic-in/example.animl +9 -0
- package/modules/motion/capabilities/animation-elastic-in-out/example.ani +40 -0
- package/modules/motion/capabilities/animation-elastic-in-out/example.animl +9 -0
- package/modules/motion/capabilities/animation-host-loop-override/example.ani +28 -0
- package/modules/motion/capabilities/animation-host-loop-override/example.animl +6 -0
- package/modules/motion/capabilities/animation-host-play-pause-stop/example.ani +28 -0
- package/modules/motion/capabilities/animation-host-play-pause-stop/example.animl +6 -0
- package/modules/motion/capabilities/animation-keys-reference/example.ani +55 -0
- package/modules/motion/capabilities/animation-keys-reference/example.animl +12 -0
- package/modules/motion/capabilities/animation-keys-signed-integer/example.ani +46 -0
- package/modules/motion/capabilities/animation-keys-signed-integer/example.animl +11 -0
- package/modules/motion/capabilities/animation-keys-string/example.ani +46 -0
- package/modules/motion/capabilities/animation-keys-string/example.animl +11 -0
- package/modules/motion/capabilities/animation-keys-unsigned-integer/example.ani +46 -0
- package/modules/motion/capabilities/animation-keys-unsigned-integer/example.animl +11 -0
- package/modules/motion/capabilities/animation-mix-discrete/example.ani +38 -0
- package/modules/motion/capabilities/animation-mix-discrete/example.animl +9 -0
- package/modules/motion/capabilities/animation-mix-numeric/example.ani +42 -0
- package/modules/motion/capabilities/animation-mix-numeric/example.animl +11 -0
- package/modules/motion/capabilities/animation-quantized-playback/example.ani +41 -0
- package/modules/motion/capabilities/animation-quantized-playback/example.animl +9 -0
- package/modules/motion/capabilities/animation-reverse/example.ani +47 -0
- package/modules/motion/capabilities/animation-reverse/example.animl +12 -0
- package/modules/motion/capabilities/animation-seek/example.ani +28 -0
- package/modules/motion/capabilities/animation-seek/example.animl +6 -0
- package/modules/motion/capabilities/animation-work-area/example.ani +42 -0
- package/modules/motion/capabilities/animation-work-area/example.animl +9 -0
- package/modules/motion/capabilities/data-bind-keyframes/example.ani +52 -0
- package/modules/motion/capabilities/data-bind-keyframes/example.animl +15 -0
- package/modules/motion/capabilities/host-api-animation-metadata/example.ani +31 -0
- package/modules/motion/capabilities/host-api-animation-metadata/example.animl +6 -0
- package/modules/motion/capabilities/host-api-low-level-animation/example.ani +28 -0
- package/modules/motion/capabilities/host-api-low-level-animation/example.animl +6 -0
- package/modules/motion/capabilities/host-api-low-level-scene-query/example.ani +41 -0
- package/modules/motion/capabilities/host-api-low-level-scene-query/example.animl +9 -0
- package/modules/motion/capabilities/host-api-multi-state-machine/example.ani +62 -0
- package/modules/motion/capabilities/host-api-multi-state-machine/example.animl +22 -0
- package/modules/motion/capabilities/host-api-scrub/example.ani +29 -0
- package/modules/motion/capabilities/host-api-scrub/example.animl +6 -0
- package/modules/motion/capabilities/state-machine-exit-time-seconds/example.ani +60 -0
- package/modules/motion/capabilities/state-machine-exit-time-seconds/example.animl +15 -0
- package/modules/motion/capabilities/transforms-origin-animation/example.ani +45 -0
- package/modules/motion/capabilities/transforms-origin-animation/example.animl +10 -0
- package/modules/motion/examples/README.md +42 -0
- package/modules/motion/examples/data-keys.ani +52 -0
- package/modules/motion/examples/data-keys.animl +15 -0
- package/modules/motion/examples/evidence/hover.jsonl +8 -0
- package/modules/motion/examples/evidence/phase.jsonl +9 -0
- package/modules/motion/examples/evidence/reduced.jsonl +6 -0
- package/modules/motion/examples/evidence/rest.jsonl +1 -0
- package/modules/motion/examples/evidence/spin.jsonl +6 -0
- package/modules/motion/examples/evidence/stop.jsonl +10 -0
- package/modules/motion/examples/evidence/sweep.jsonl +26 -0
- package/modules/motion/examples/scripts/hover.txt +21 -0
- package/modules/motion/examples/scripts/phase.txt +28 -0
- package/modules/motion/examples/scripts/reduced.txt +16 -0
- package/modules/motion/examples/scripts/rest.txt +2 -0
- package/modules/motion/examples/scripts/spin.txt +14 -0
- package/modules/motion/examples/scripts/stop.txt +26 -0
- package/modules/motion/examples/scripts/sweep.txt +71 -0
- package/modules/motion/examples/sync.ani +272 -0
- package/modules/motion/examples/sync.animl +64 -0
- package/modules/motion/examples/verify.py +71 -0
- package/modules/motion/manifest.source +67 -0
- package/modules/nested/SPEC.md +79 -0
- package/modules/nested/capabilities/components-leaf-fit/example.ani +50 -0
- package/modules/nested/capabilities/components-leaf-fit/example.animl +9 -0
- package/modules/nested/capabilities/components-nested-quantize/example.ani +65 -0
- package/modules/nested/capabilities/components-nested-quantize/example.animl +15 -0
- package/modules/nested/capabilities/components-nested-remap/example.ani +65 -0
- package/modules/nested/capabilities/components-nested-remap/example.animl +15 -0
- package/modules/nested/capabilities/components-stateful-output/example.ani +51 -0
- package/modules/nested/capabilities/components-stateful-output/example.animl +12 -0
- package/modules/nested/capabilities/data-property-artboard/example.ani +63 -0
- package/modules/nested/capabilities/data-property-artboard/example.animl +14 -0
- package/modules/nested/capabilities/state-machine-literal-artboard/example.ani +76 -0
- package/modules/nested/capabilities/state-machine-literal-artboard/example.animl +19 -0
- package/modules/nested/examples/component-guard.ani +76 -0
- package/modules/nested/examples/component-guard.animl +19 -0
- package/modules/nested/examples/controls.ani +100 -0
- package/modules/nested/examples/controls.animl +21 -0
- package/modules/nested/manifest.source +39 -0
- package/modules/paint/capabilities/drawing-paint-gradient-angular/example.ani +33 -0
- package/modules/paint/capabilities/drawing-paint-gradient-angular/example.animl +8 -0
- package/modules/paint/capabilities/drawing-paint-gradient-transform/example.ani +34 -0
- package/modules/paint/capabilities/drawing-paint-gradient-transform/example.animl +8 -0
- package/modules/paint/capabilities/drawing-paint-image-fit-resize/example.ani +49 -0
- package/modules/paint/capabilities/drawing-paint-image-fit-resize/example.animl +12 -0
- package/modules/paint/capabilities/drawing-paint-image-wrap-clamp/example.ani +50 -0
- package/modules/paint/capabilities/drawing-paint-image-wrap-clamp/example.animl +12 -0
- package/modules/paint/capabilities/drawing-paint-image-wrap-mirror/example.ani +50 -0
- package/modules/paint/capabilities/drawing-paint-image-wrap-mirror/example.animl +12 -0
- package/modules/paint/capabilities/drawing-paint-image-wrap-repeat/example.ani +50 -0
- package/modules/paint/capabilities/drawing-paint-image-wrap-repeat/example.animl +12 -0
- package/modules/paint/manifest.source +77 -0
- package/modules/pathfollow/capabilities/rigging-follow-path/example.ani +16 -0
- package/modules/pathfollow/capabilities/rigging-follow-path/example.animl +7 -0
- package/modules/pathfollow/capabilities/rigging-list-follow-path/example.ani +16 -0
- package/modules/pathfollow/capabilities/rigging-list-follow-path/example.animl +9 -0
- package/modules/pathfollow/examples/orbit.ani +130 -0
- package/modules/pathfollow/examples/orbit.animl +17 -0
- package/modules/pathfollow/manifest.source +35 -0
- package/modules/posepad/examples/look.ani +124 -0
- package/modules/posepad/examples/look.animl +22 -0
- package/modules/posepad/manifest.source +43 -0
- package/modules/rig/AUTHORING.md +24 -0
- package/modules/rig/capabilities/rigging-bone-chains/example.ani +61 -0
- package/modules/rig/capabilities/rigging-bone-chains/example.animl +22 -0
- package/modules/rig/capabilities/rigging-constraint-order/example.ani +123 -0
- package/modules/rig/capabilities/rigging-constraint-order/example.animl +33 -0
- package/modules/rig/capabilities/rigging-constraint-strength/example.ani +105 -0
- package/modules/rig/capabilities/rigging-constraint-strength/example.animl +28 -0
- package/modules/rig/capabilities/rigging-distance-closer/example.ani +160 -0
- package/modules/rig/capabilities/rigging-distance-closer/example.animl +44 -0
- package/modules/rig/capabilities/rigging-distance-exact/example.ani +160 -0
- package/modules/rig/capabilities/rigging-distance-exact/example.animl +44 -0
- package/modules/rig/capabilities/rigging-distance-further/example.ani +160 -0
- package/modules/rig/capabilities/rigging-distance-further/example.animl +44 -0
- package/modules/rig/capabilities/rigging-root-bones/example.ani +63 -0
- package/modules/rig/capabilities/rigging-root-bones/example.animl +22 -0
- package/modules/rig/capabilities/rigging-rotation/example.ani +143 -0
- package/modules/rig/capabilities/rigging-rotation/example.animl +32 -0
- package/modules/rig/capabilities/rigging-scale/example.ani +144 -0
- package/modules/rig/capabilities/rigging-scale/example.animl +32 -0
- package/modules/rig/capabilities/rigging-transform/example.ani +132 -0
- package/modules/rig/capabilities/rigging-transform/example.animl +30 -0
- package/modules/rig/capabilities/rigging-translation/example.ani +248 -0
- package/modules/rig/capabilities/rigging-translation/example.animl +54 -0
- package/modules/rig/examples/arm.ani +120 -0
- package/modules/rig/examples/arm.animl +29 -0
- package/modules/rig/manifest.source +55 -0
- package/modules/scroll/capabilities/rigging-scroll/example.ani +16 -0
- package/modules/scroll/capabilities/rigging-scroll/example.animl +11 -0
- package/modules/scroll/examples/list.ani +115 -0
- package/modules/scroll/examples/list.animl +15 -0
- package/modules/scroll/manifest.source +31 -0
- package/modules/skin/capabilities/rigging-cubic-weights/example.ani +66 -0
- package/modules/skin/capabilities/rigging-cubic-weights/example.animl +17 -0
- package/modules/skin/capabilities/rigging-skin/example.ani +165 -0
- package/modules/skin/capabilities/rigging-skin/example.animl +33 -0
- package/modules/skin/capabilities/rigging-weights/example.ani +147 -0
- package/modules/skin/capabilities/rigging-weights/example.animl +37 -0
- package/modules/skin/examples/sleeve.ani +91 -0
- package/modules/skin/examples/sleeve.animl +14 -0
- package/modules/skin/manifest.source +41 -0
- package/modules/surface/manifest.source +52 -0
- package/modules/text/SPEC.md +269 -0
- package/modules/text/capabilities/data-bind-text/example.ani +63 -0
- package/modules/text/capabilities/data-bind-text/example.animl +8 -0
- package/modules/text/capabilities/data-property-text-style/example.ani +63 -0
- package/modules/text/capabilities/data-property-text-style/example.animl +8 -0
- package/modules/text/capabilities/host-api-nested-text-run/example.ani +44 -0
- package/modules/text/capabilities/host-api-nested-text-run/example.animl +10 -0
- package/modules/text/capabilities/host-api-text-run/example.ani +27 -0
- package/modules/text/capabilities/host-api-text-run/example.animl +6 -0
- package/modules/text/capabilities/text-fit-baseline/example.ani +30 -0
- package/modules/text/capabilities/text-fit-baseline/example.animl +6 -0
- package/modules/text/capabilities/text-fit-layout-measure/example.ani +30 -0
- package/modules/text/capabilities/text-fit-layout-measure/example.animl +6 -0
- package/modules/text/capabilities/text-flatten/example.ani +16 -0
- package/modules/text/capabilities/text-flatten/example.animl +6 -0
- package/modules/text/capabilities/text-font-size/example.ani +59 -0
- package/modules/text/capabilities/text-font-size/example.animl +15 -0
- package/modules/text/capabilities/text-horizontal-alignment/example.ani +28 -0
- package/modules/text/capabilities/text-horizontal-alignment/example.animl +6 -0
- package/modules/text/capabilities/text-line-spacing/example.ani +28 -0
- package/modules/text/capabilities/text-line-spacing/example.animl +6 -0
- package/modules/text/capabilities/text-origin/example.ani +32 -0
- package/modules/text/capabilities/text-origin/example.animl +6 -0
- package/modules/text/capabilities/text-overflow-clipped/example.ani +29 -0
- package/modules/text/capabilities/text-overflow-clipped/example.animl +6 -0
- package/modules/text/capabilities/text-overflow-ellipsis/example.ani +29 -0
- package/modules/text/capabilities/text-overflow-ellipsis/example.animl +6 -0
- package/modules/text/capabilities/text-overflow-fit/example.ani +29 -0
- package/modules/text/capabilities/text-overflow-fit/example.animl +6 -0
- package/modules/text/capabilities/text-overflow-fit-font-size/example.ani +29 -0
- package/modules/text/capabilities/text-overflow-fit-font-size/example.animl +6 -0
- package/modules/text/capabilities/text-overflow-hidden/example.ani +29 -0
- package/modules/text/capabilities/text-overflow-hidden/example.animl +7 -0
- package/modules/text/capabilities/text-overflow-visible/example.ani +29 -0
- package/modules/text/capabilities/text-overflow-visible/example.animl +6 -0
- package/modules/text/capabilities/text-paint/example.ani +30 -0
- package/modules/text/capabilities/text-paint/example.animl +6 -0
- package/modules/text/capabilities/text-paragraph-spacing/example.ani +28 -0
- package/modules/text/capabilities/text-paragraph-spacing/example.animl +7 -0
- package/modules/text/capabilities/text-rich-runs/example.ani +34 -0
- package/modules/text/capabilities/text-rich-runs/example.animl +8 -0
- package/modules/text/capabilities/text-run-list/example.ani +59 -0
- package/modules/text/capabilities/text-run-list/example.animl +7 -0
- package/modules/text/capabilities/text-script-hit-testing/example.ani +47 -0
- package/modules/text/capabilities/text-script-hit-testing/example.animl +10 -0
- package/modules/text/capabilities/text-sizing-auto-height/example.ani +28 -0
- package/modules/text/capabilities/text-sizing-auto-height/example.animl +6 -0
- package/modules/text/capabilities/text-sizing-auto-width/example.ani +27 -0
- package/modules/text/capabilities/text-sizing-auto-width/example.animl +6 -0
- package/modules/text/capabilities/text-sizing-fixed/example.ani +26 -0
- package/modules/text/capabilities/text-sizing-fixed/example.animl +6 -0
- package/modules/text/capabilities/text-style-reference/example.ani +31 -0
- package/modules/text/capabilities/text-style-reference/example.animl +7 -0
- package/modules/text/capabilities/text-tracking/example.ani +28 -0
- package/modules/text/capabilities/text-tracking/example.animl +6 -0
- package/modules/text/capabilities/text-vertical-alignment/example.ani +28 -0
- package/modules/text/capabilities/text-vertical-alignment/example.animl +6 -0
- package/modules/text/capabilities/text-vertical-trim/example.ani +29 -0
- package/modules/text/capabilities/text-vertical-trim/example.animl +6 -0
- package/modules/text/capabilities/text-word-break/example.ani +28 -0
- package/modules/text/capabilities/text-word-break/example.animl +6 -0
- package/modules/text/capabilities/text-wrap/example.ani +28 -0
- package/modules/text/capabilities/text-wrap/example.animl +6 -0
- package/modules/text/manifest.source +92 -0
- package/modules/text-effects/SPEC.md +134 -0
- package/modules/text-effects/capabilities/text-background/example.ani +32 -0
- package/modules/text-effects/capabilities/text-background/example.animl +7 -0
- package/modules/text-effects/capabilities/text-modifier-follow-path/example.ani +34 -0
- package/modules/text-effects/capabilities/text-modifier-follow-path/example.animl +8 -0
- package/modules/text-effects/capabilities/text-modifier-opacity/example.ani +34 -0
- package/modules/text-effects/capabilities/text-modifier-opacity/example.animl +8 -0
- package/modules/text-effects/capabilities/text-modifier-origin/example.ani +36 -0
- package/modules/text-effects/capabilities/text-modifier-origin/example.animl +8 -0
- package/modules/text-effects/capabilities/text-modifier-rotation/example.ani +34 -0
- package/modules/text-effects/capabilities/text-modifier-rotation/example.animl +8 -0
- package/modules/text-effects/capabilities/text-modifier-scale/example.ani +35 -0
- package/modules/text-effects/capabilities/text-modifier-scale/example.animl +8 -0
- package/modules/text-effects/capabilities/text-modifier-translation/example.ani +35 -0
- package/modules/text-effects/capabilities/text-modifier-translation/example.animl +8 -0
- package/modules/text-effects/capabilities/text-modifier-variation/example.ani +36 -0
- package/modules/text-effects/capabilities/text-modifier-variation/example.animl +8 -0
- package/modules/text-effects/capabilities/text-range-combine/example.ani +47 -0
- package/modules/text-effects/capabilities/text-range-combine/example.animl +11 -0
- package/modules/text-effects/capabilities/text-range-easing/example.ani +38 -0
- package/modules/text-effects/capabilities/text-range-easing/example.animl +8 -0
- package/modules/text-effects/capabilities/text-range-falloff/example.ani +37 -0
- package/modules/text-effects/capabilities/text-range-falloff/example.animl +8 -0
- package/modules/text-effects/capabilities/text-range-run/example.ani +37 -0
- package/modules/text-effects/capabilities/text-range-run/example.animl +8 -0
- package/modules/text-effects/capabilities/text-range-units/example.ani +37 -0
- package/modules/text-effects/capabilities/text-range-units/example.animl +8 -0
- package/modules/text-effects/capabilities/text-script-direction/example.ani +30 -0
- package/modules/text-effects/capabilities/text-script-direction/example.animl +7 -0
- package/modules/text-effects/examples/title-wave.ani +68 -0
- package/modules/text-effects/examples/title-wave.animl +15 -0
- package/modules/text-effects/manifest.source +58 -0
- package/modules/text-input/SPEC.md +189 -0
- package/modules/text-input/capabilities/text-input-placeholder/example.ani +16 -0
- package/modules/text-input/capabilities/text-input-placeholder/example.animl +13 -0
- package/modules/text-input/capabilities/text-input-selection/example.ani +66 -0
- package/modules/text-input/capabilities/text-input-selection/example.animl +13 -0
- package/modules/text-input/examples/search-card.ani +195 -0
- package/modules/text-input/examples/search-card.animl +49 -0
- package/modules/text-input/examples/search.txt +6 -0
- package/modules/text-input/manifest.source +79 -0
- package/modules/tooling/capabilities/tooling-benchmark/example.ani +16 -0
- package/modules/tooling/capabilities/tooling-benchmark/example.animl +13 -0
- package/modules/tooling/capabilities/tooling-data-breakpoints/example.ani +75 -0
- package/modules/tooling/capabilities/tooling-data-breakpoints/example.animl +13 -0
- package/modules/tooling/capabilities/tooling-data-debugger/example.ani +16 -0
- package/modules/tooling/capabilities/tooling-data-debugger/example.animl +13 -0
- package/modules/tooling/capabilities/tooling-headless-command-session/example.ani +16 -0
- package/modules/tooling/capabilities/tooling-headless-command-session/example.animl +13 -0
- package/modules/tooling/capabilities/tooling-headless-data/example.ani +16 -0
- package/modules/tooling/capabilities/tooling-headless-data/example.animl +13 -0
- package/modules/tooling/capabilities/tooling-headless-data-dump/example.ani +16 -0
- package/modules/tooling/capabilities/tooling-headless-data-dump/example.animl +13 -0
- package/modules/tooling/capabilities/tooling-headless-data-filter/example.ani +16 -0
- package/modules/tooling/capabilities/tooling-headless-data-filter/example.animl +13 -0
- package/modules/tooling/capabilities/tooling-headless-data-stream/example.ani +16 -0
- package/modules/tooling/capabilities/tooling-headless-data-stream/example.animl +13 -0
- package/modules/tooling/capabilities/tooling-headless-gamepad/example.ani +16 -0
- package/modules/tooling/capabilities/tooling-headless-gamepad/example.animl +13 -0
- package/modules/tooling/capabilities/tooling-headless-key/example.ani +16 -0
- package/modules/tooling/capabilities/tooling-headless-key/example.animl +13 -0
- package/modules/tooling/capabilities/tooling-headless-pointer/example.ani +16 -0
- package/modules/tooling/capabilities/tooling-headless-pointer/example.animl +13 -0
- package/modules/tooling/capabilities/tooling-headless-touch/example.ani +16 -0
- package/modules/tooling/capabilities/tooling-headless-touch/example.animl +13 -0
- package/modules/tooling/capabilities/tooling-headless-wheel/example.ani +16 -0
- package/modules/tooling/capabilities/tooling-headless-wheel/example.animl +13 -0
- package/modules/tooling/capabilities/tooling-seed/example.ani +76 -0
- package/modules/tooling/capabilities/tooling-seed/example.animl +21 -0
- package/modules/tooling/capabilities/tooling-test-assertions/example.ani +16 -0
- package/modules/tooling/capabilities/tooling-test-assertions/example.animl +13 -0
- package/modules/tooling/examples/agent-tools.ani +75 -0
- package/modules/tooling/examples/agent-tools.animl +13 -0
- package/modules/tooling/manifest.source +15 -0
- package/package.json +57 -4
- package/packages/cli/package.json +4 -0
- package/packages/cli/src/asset-info.d.ts +8 -0
- package/packages/cli/src/asset-info.js +122 -0
- package/packages/cli/src/assets.d.ts +8 -0
- package/packages/cli/src/assets.js +66 -0
- package/packages/cli/src/audio.d.ts +3 -0
- package/packages/cli/src/audio.js +77 -0
- package/packages/cli/src/bench.d.ts +32 -0
- package/packages/cli/src/bench.js +46 -0
- package/packages/cli/src/build-assets.d.ts +10 -0
- package/packages/cli/src/build-assets.js +139 -0
- package/packages/cli/src/bundle.d.ts +7 -0
- package/packages/cli/src/bundle.js +53 -0
- package/packages/cli/src/cli.d.ts +19 -0
- package/packages/cli/src/cli.js +1532 -0
- package/packages/cli/src/commands.d.ts +47 -0
- package/packages/cli/src/commands.js +608 -0
- package/packages/cli/src/compare-png.d.ts +21 -0
- package/packages/cli/src/compare-png.js +39 -0
- package/packages/cli/src/compare.d.ts +7 -0
- package/packages/cli/src/compare.js +84 -0
- package/packages/cli/src/completion.d.ts +2 -0
- package/packages/cli/src/completion.js +153 -0
- package/packages/cli/src/discover/api.d.ts +55 -0
- package/packages/cli/src/discover/api.js +185 -0
- package/packages/cli/src/discover/build.d.ts +14 -0
- package/packages/cli/src/discover/build.js +590 -0
- package/packages/cli/src/discover/synonyms.d.ts +1 -0
- package/packages/cli/src/discover/synonyms.js +68 -0
- package/packages/cli/src/docs-view.d.ts +4 -0
- package/packages/cli/src/docs-view.js +279 -0
- package/packages/cli/src/doctor.d.ts +11 -0
- package/packages/cli/src/doctor.js +151 -0
- package/packages/cli/src/encode.d.ts +9 -0
- package/packages/cli/src/encode.js +100 -0
- package/packages/cli/src/font/README.md +45 -0
- package/packages/cli/src/font/binary.d.ts +8 -0
- package/packages/cli/src/font/binary.js +54 -0
- package/packages/cli/src/font/browser.d.ts +4 -0
- package/packages/cli/src/font/browser.js +54 -0
- package/packages/cli/src/font/cff.d.ts +6 -0
- package/packages/cli/src/font/cff.js +154 -0
- package/packages/cli/src/font/container.d.ts +5 -0
- package/packages/cli/src/font/container.js +97 -0
- package/packages/cli/src/font/document.d.ts +28 -0
- package/packages/cli/src/font/document.js +143 -0
- package/packages/cli/src/font/features.d.ts +1 -0
- package/packages/cli/src/font/features.js +1 -0
- package/packages/cli/src/font/flatten.d.ts +5 -0
- package/packages/cli/src/font/flatten.js +146 -0
- package/packages/cli/src/font/import.d.ts +12 -0
- package/packages/cli/src/font/import.js +92 -0
- package/packages/cli/src/font/index.d.ts +8 -0
- package/packages/cli/src/font/index.js +27 -0
- package/packages/cli/src/font/measure.d.ts +37 -0
- package/packages/cli/src/font/measure.js +131 -0
- package/packages/cli/src/font/reader.d.ts +13 -0
- package/packages/cli/src/font/reader.js +26 -0
- package/packages/cli/src/font/subset.d.ts +6 -0
- package/packages/cli/src/font/subset.js +87 -0
- package/packages/cli/src/font/svg.d.ts +3 -0
- package/packages/cli/src/font/svg.js +109 -0
- package/packages/cli/src/font/truetype.d.ts +3 -0
- package/packages/cli/src/font/truetype.js +38 -0
- package/packages/cli/src/font/variation.d.ts +1 -0
- package/packages/cli/src/font/variation.js +1 -0
- package/packages/cli/src/font/woff2.d.ts +3 -0
- package/packages/cli/src/font/woff2.js +166 -0
- package/packages/cli/src/glyphs.d.ts +5 -0
- package/packages/cli/src/glyphs.js +59 -0
- package/packages/cli/src/help.d.ts +5 -0
- package/packages/cli/src/help.js +149 -0
- package/packages/cli/src/html.d.ts +5 -0
- package/packages/cli/src/html.js +119 -0
- package/packages/cli/src/import-lottie.d.ts +2 -0
- package/packages/cli/src/import-lottie.js +274 -0
- package/packages/cli/src/import-svg.d.ts +8 -0
- package/packages/cli/src/import-svg.js +300 -0
- package/packages/cli/src/index.d.ts +1 -0
- package/packages/cli/src/index.js +4 -0
- package/packages/cli/src/inspect-summary.d.ts +7 -0
- package/packages/cli/src/inspect-summary.js +158 -0
- package/packages/cli/src/library.d.ts +6 -0
- package/packages/cli/src/library.js +67 -0
- package/packages/cli/src/locate.d.ts +13 -0
- package/packages/cli/src/locate.js +118 -0
- package/packages/cli/src/main.d.ts +2 -0
- package/packages/cli/src/main.js +13 -0
- package/packages/cli/src/playground.d.ts +11 -0
- package/packages/cli/src/playground.js +169 -0
- package/packages/cli/src/project.d.ts +15 -0
- package/packages/cli/src/project.js +160 -0
- package/packages/cli/src/render-options.d.ts +6 -0
- package/packages/cli/src/render-options.js +40 -0
- package/packages/cli/src/render.d.ts +30 -0
- package/packages/cli/src/render.js +90 -0
- package/packages/cli/src/scaffold.d.ts +17 -0
- package/packages/cli/src/scaffold.js +96 -0
- package/packages/cli/src/schema-view.d.ts +9 -0
- package/packages/cli/src/schema-view.js +493 -0
- package/packages/cli/src/session.d.ts +8 -0
- package/packages/cli/src/session.js +96 -0
- package/packages/cli/src/suggest.d.ts +3 -0
- package/packages/cli/src/suggest.js +62 -0
- package/packages/cli/src/video.d.ts +2 -0
- package/packages/cli/src/video.js +73 -0
- package/packages/core/src/script.source +897 -0
- package/spec/ANIML.md +598 -0
- package/spec/MODULES.md +406 -0
- package/spec/SPEC.md +4083 -0
|
@@ -0,0 +1,1532 @@
|
|
|
1
|
+
import { documentFonts, installToolMeasurer } from "./font/document.js";
|
|
2
|
+
import { ToolMeasurer } from "./font/measure.js";
|
|
3
|
+
import { outlineSVG } from "./font/svg.js";
|
|
4
|
+
import { browserTextPNG, embedFontCSS } from "./font/browser.js";
|
|
5
|
+
import { importFont, googleFonts } from "./font/import.js";
|
|
6
|
+
import { flattenText } from "./font/flatten.js";
|
|
7
|
+
import { componentNames } from "animl/internal/modules/components/core/names.js";
|
|
8
|
+
import { createScriptSession } from "animl/internal/packages/core/src/script.js";
|
|
9
|
+
import { resolve, basename } from "node:path";
|
|
10
|
+
import { findProject, projectSource, substituteConstants } from "./project.js";
|
|
11
|
+
import { bundleBrowser } from "./bundle.js";
|
|
12
|
+
import { doctor } from "./doctor.js";
|
|
13
|
+
import { comparePNG } from "./compare-png.js";
|
|
14
|
+
import { mixAudio } from "./audio.js";
|
|
15
|
+
import { viewportSVG, probePNG } from "./render-options.js";
|
|
16
|
+
import { wiringSummary } from "./inspect-summary.js";
|
|
17
|
+
import { listState } from "animl/internal/modules/lists/core/index.js";
|
|
18
|
+
import "animl/all";
|
|
19
|
+
import { mkdirSync, cpSync, existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
20
|
+
import {
|
|
21
|
+
Player,
|
|
22
|
+
ScriptError,
|
|
23
|
+
load,
|
|
24
|
+
runScript,
|
|
25
|
+
staticSlots
|
|
26
|
+
} from "animl";
|
|
27
|
+
import { formatAni as format } from "animl";
|
|
28
|
+
import { compile, decompile, formatMarkup } from "animl/markup";
|
|
29
|
+
import { session } from "./session.js";
|
|
30
|
+
import { bench } from "./bench.js";
|
|
31
|
+
import { startPlayground } from "./playground.js";
|
|
32
|
+
import { inspectGlyph } from "./glyphs.js";
|
|
33
|
+
import { embedAssets, imageDimensions } from "./assets.js";
|
|
34
|
+
import { buildHTML } from "./html.js";
|
|
35
|
+
import { buildAssets } from "./build-assets.js";
|
|
36
|
+
import { updateLibraries } from "./library.js";
|
|
37
|
+
import { ImageEncoder } from "./encode.js";
|
|
38
|
+
import { importSVG } from "./import-svg.js";
|
|
39
|
+
import { importLottie } from "./import-lottie.js";
|
|
40
|
+
import { lineCol, locate, syntaxErrorAt } from "./locate.js";
|
|
41
|
+
import {
|
|
42
|
+
DARK,
|
|
43
|
+
LIGHT,
|
|
44
|
+
compareSVG,
|
|
45
|
+
comparisonSVG,
|
|
46
|
+
frameSVG,
|
|
47
|
+
sheetSVG,
|
|
48
|
+
toPNG
|
|
49
|
+
} from "./render.js";
|
|
50
|
+
import { nameFromFile, newDoc, readGlyphSVG, readGlyphy, sha256 } from "./scaffold.js";
|
|
51
|
+
import { COMMANDS, GLOBAL } from "./commands.js";
|
|
52
|
+
import { commandByName, commandHelp, helpJSON, overview } from "./help.js";
|
|
53
|
+
import { resolveAlias, suggest } from "./suggest.js";
|
|
54
|
+
import { completion } from "./completion.js";
|
|
55
|
+
import * as discover from "./discover/api.js";
|
|
56
|
+
import { filteredSchema, schema, schemaAll, schemaSearch, schemaTopic } from "./schema-view.js";
|
|
57
|
+
import { docs, docsFull } from "./docs-view.js";
|
|
58
|
+
class Usage extends Error {
|
|
59
|
+
issue;
|
|
60
|
+
constructor(message, issue) {
|
|
61
|
+
super(message);
|
|
62
|
+
this.issue = issue;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
const ROOT = new URL("../../../", import.meta.url);
|
|
66
|
+
const CLI_VERSION = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8")).version;
|
|
67
|
+
const DEFAULT_DISCOVERY = {
|
|
68
|
+
search: discover.search,
|
|
69
|
+
features: discover.features,
|
|
70
|
+
examples: discover.examples
|
|
71
|
+
};
|
|
72
|
+
function wantsJSON(argv) {
|
|
73
|
+
return argv.some(
|
|
74
|
+
(arg, index) => arg === "--format=json" || arg === "--format" && argv[index + 1] === "json"
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
function usageHelp(command) {
|
|
78
|
+
return command ? `anima help ${command.name}` : "anima help";
|
|
79
|
+
}
|
|
80
|
+
function usageIssue(command, kind, word, candidates, message) {
|
|
81
|
+
return new Usage(message, {
|
|
82
|
+
kind,
|
|
83
|
+
word,
|
|
84
|
+
suggestions: suggest(word, candidates),
|
|
85
|
+
help: usageHelp(command)
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
function emitUsage(error, command, json, io) {
|
|
89
|
+
const suggestions = error.issue?.suggestions ?? [];
|
|
90
|
+
const help = error.issue?.help ?? usageHelp(command);
|
|
91
|
+
if (json) {
|
|
92
|
+
io.err(JSON.stringify({ error: error.message, suggestions, help }));
|
|
93
|
+
return 2;
|
|
94
|
+
}
|
|
95
|
+
io.err(`anima: ${error.message}`);
|
|
96
|
+
if (suggestions.length) {
|
|
97
|
+
if (error.issue?.kind === "command") {
|
|
98
|
+
io.err(
|
|
99
|
+
`${suggestions.length === 1 ? "The most similar command is" : "The most similar commands are"}
|
|
100
|
+
${suggestions.map((item) => ` ${item}`).join("\n")}`
|
|
101
|
+
);
|
|
102
|
+
} else if (suggestions.length === 1) io.err(`Did you mean '${suggestions[0]}'?`);
|
|
103
|
+
else io.err(`Did you mean one of these?
|
|
104
|
+
${suggestions.map((item) => ` ${item}`).join("\n")}`);
|
|
105
|
+
}
|
|
106
|
+
if (!error.message.includes(`See '${help}'`)) io.err(`See '${help}'.`);
|
|
107
|
+
return 2;
|
|
108
|
+
}
|
|
109
|
+
function optionsFor(command) {
|
|
110
|
+
return [...command.options, ...GLOBAL];
|
|
111
|
+
}
|
|
112
|
+
function setOption(values, option, value) {
|
|
113
|
+
if (option.multiple) {
|
|
114
|
+
const current = values[option.name];
|
|
115
|
+
values[option.name] = [...Array.isArray(current) ? current : [], String(value)];
|
|
116
|
+
} else values[option.name] = value;
|
|
117
|
+
}
|
|
118
|
+
function parseCommandArgs(argv, command) {
|
|
119
|
+
const options = optionsFor(command);
|
|
120
|
+
const byLong = new Map(options.map((option) => [option.name, option]));
|
|
121
|
+
const byShort = new Map(
|
|
122
|
+
options.flatMap((option) => option.short ? [[option.short, option]] : [])
|
|
123
|
+
);
|
|
124
|
+
const longCandidates = options.map((option) => `--${option.name}`);
|
|
125
|
+
const shortCandidates = options.flatMap((option) => option.short ? [`-${option.short}`] : []);
|
|
126
|
+
const values = { format: "text" };
|
|
127
|
+
const positionals = [];
|
|
128
|
+
let positionalOnly = false;
|
|
129
|
+
const accept = (option, raw, spelling) => {
|
|
130
|
+
if (!option.value) {
|
|
131
|
+
if (raw !== void 0)
|
|
132
|
+
throw new Usage(`option '${spelling}' does not take a value`, {
|
|
133
|
+
kind: "flag",
|
|
134
|
+
word: spelling,
|
|
135
|
+
suggestions: [],
|
|
136
|
+
help: usageHelp(command)
|
|
137
|
+
});
|
|
138
|
+
setOption(values, option, true);
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
if (raw === void 0)
|
|
142
|
+
throw new Usage(`option '${spelling}' needs <${option.value}>`, {
|
|
143
|
+
kind: "flag",
|
|
144
|
+
word: spelling,
|
|
145
|
+
suggestions: [],
|
|
146
|
+
help: usageHelp(command)
|
|
147
|
+
});
|
|
148
|
+
if (option.choices && !option.choices.includes(raw))
|
|
149
|
+
throw usageIssue(
|
|
150
|
+
command,
|
|
151
|
+
"value",
|
|
152
|
+
raw,
|
|
153
|
+
option.choices,
|
|
154
|
+
`'${raw}' is not a valid value for '${spelling}'`
|
|
155
|
+
);
|
|
156
|
+
setOption(values, option, raw);
|
|
157
|
+
};
|
|
158
|
+
for (let index = 0; index < argv.length; index++) {
|
|
159
|
+
const token = argv[index];
|
|
160
|
+
if (positionalOnly) {
|
|
161
|
+
positionals.push(token);
|
|
162
|
+
continue;
|
|
163
|
+
}
|
|
164
|
+
if (token === "--") {
|
|
165
|
+
positionalOnly = true;
|
|
166
|
+
continue;
|
|
167
|
+
}
|
|
168
|
+
if (token.startsWith("--")) {
|
|
169
|
+
const equals = token.indexOf("=");
|
|
170
|
+
const name = token.slice(2, equals < 0 ? void 0 : equals);
|
|
171
|
+
const option = byLong.get(name);
|
|
172
|
+
if (!option)
|
|
173
|
+
throw usageIssue(command, "flag", token, longCandidates, `unknown option '${token}'`);
|
|
174
|
+
const inline = equals < 0 ? void 0 : token.slice(equals + 1);
|
|
175
|
+
if (option.value && inline === void 0) {
|
|
176
|
+
const next = argv[index + 1];
|
|
177
|
+
if (next === void 0)
|
|
178
|
+
throw new Usage(`option '--${name}' needs <${option.value}>`, {
|
|
179
|
+
kind: "flag",
|
|
180
|
+
word: token,
|
|
181
|
+
suggestions: [],
|
|
182
|
+
help: usageHelp(command)
|
|
183
|
+
});
|
|
184
|
+
index++;
|
|
185
|
+
accept(option, next, `--${name}`);
|
|
186
|
+
} else accept(option, inline, `--${name}`);
|
|
187
|
+
continue;
|
|
188
|
+
}
|
|
189
|
+
if (token.startsWith("-") && token !== "-") {
|
|
190
|
+
const short = token[1];
|
|
191
|
+
const option = byShort.get(short);
|
|
192
|
+
if (!option)
|
|
193
|
+
throw usageIssue(
|
|
194
|
+
command,
|
|
195
|
+
"flag",
|
|
196
|
+
token,
|
|
197
|
+
[...shortCandidates, ...longCandidates],
|
|
198
|
+
`unknown option '${token}'`
|
|
199
|
+
);
|
|
200
|
+
const attached = token.length > 2 ? token.slice(token[2] === "=" ? 3 : 2) : void 0;
|
|
201
|
+
if (option.value && attached === void 0) {
|
|
202
|
+
const next = argv[index + 1];
|
|
203
|
+
if (next === void 0)
|
|
204
|
+
throw new Usage(`option '-${short}' needs <${option.value}>`, {
|
|
205
|
+
kind: "flag",
|
|
206
|
+
word: token,
|
|
207
|
+
suggestions: [],
|
|
208
|
+
help: usageHelp(command)
|
|
209
|
+
});
|
|
210
|
+
index++;
|
|
211
|
+
accept(option, next, `-${short}`);
|
|
212
|
+
} else accept(option, attached, `-${short}`);
|
|
213
|
+
continue;
|
|
214
|
+
}
|
|
215
|
+
positionals.push(token);
|
|
216
|
+
}
|
|
217
|
+
if (command.subcommands?.length && positionals[0]) {
|
|
218
|
+
const candidates = command.subcommands.map(({ name }) => name);
|
|
219
|
+
if (!candidates.includes(positionals[0]))
|
|
220
|
+
throw usageIssue(
|
|
221
|
+
command,
|
|
222
|
+
"subcommand",
|
|
223
|
+
positionals[0],
|
|
224
|
+
candidates,
|
|
225
|
+
`'${positionals[0]}' is not an anima ${command.name} subcommand`
|
|
226
|
+
);
|
|
227
|
+
}
|
|
228
|
+
return { values, positionals };
|
|
229
|
+
}
|
|
230
|
+
function unavailable(error, json, io) {
|
|
231
|
+
if (!(error instanceof Error) || !/discover\..*not implemented/.test(error.message))
|
|
232
|
+
return void 0;
|
|
233
|
+
if (json) io.err(JSON.stringify({ error: "not available yet" }));
|
|
234
|
+
else io.err("not available yet");
|
|
235
|
+
return 1;
|
|
236
|
+
}
|
|
237
|
+
function featureText(info) {
|
|
238
|
+
const groups = /* @__PURE__ */ new Map();
|
|
239
|
+
for (const entry of info.provides)
|
|
240
|
+
groups.set(entry.kind, [...groups.get(entry.kind) ?? [], entry]);
|
|
241
|
+
const lines = [`${info.entry.name} \u2014 ${info.entry.summary}`];
|
|
242
|
+
if (groups.size) {
|
|
243
|
+
lines.push("Provides:");
|
|
244
|
+
for (const [kind, entries] of groups)
|
|
245
|
+
lines.push(` ${kind}:`, ...entries.map((entry) => ` ${entry.name} \u2014 ${entry.summary}`));
|
|
246
|
+
}
|
|
247
|
+
lines.push(
|
|
248
|
+
`Docs: ${info.entry.docs?.join(", ") || "none"}`,
|
|
249
|
+
`Examples: ${info.entry.examples?.join(", ") || "none"}`,
|
|
250
|
+
`After: ${info.after.join(", ") || "none"}`
|
|
251
|
+
);
|
|
252
|
+
return lines.join("\n");
|
|
253
|
+
}
|
|
254
|
+
async function runFeatures(rest, json, io, discovery) {
|
|
255
|
+
if (rest.length > 1) throw new Usage("features takes at most one name");
|
|
256
|
+
try {
|
|
257
|
+
if (!rest[0]) {
|
|
258
|
+
const infos = discovery.features();
|
|
259
|
+
if (json) io.out(JSON.stringify({ features: infos }));
|
|
260
|
+
else for (const info2 of infos) io.out(`${info2.entry.name} \u2014 ${info2.entry.summary}`);
|
|
261
|
+
return 0;
|
|
262
|
+
}
|
|
263
|
+
const info = discovery.features(rest[0]);
|
|
264
|
+
if (!info)
|
|
265
|
+
throw usageIssue(
|
|
266
|
+
commandByName("features"),
|
|
267
|
+
"value",
|
|
268
|
+
rest[0],
|
|
269
|
+
discovery.features().map((f) => f.entry.name),
|
|
270
|
+
`unknown feature '${rest[0]}'`
|
|
271
|
+
);
|
|
272
|
+
if (json) io.out(JSON.stringify(info));
|
|
273
|
+
else io.out(featureText(info));
|
|
274
|
+
return 0;
|
|
275
|
+
} catch (error) {
|
|
276
|
+
const code = unavailable(error, json, io);
|
|
277
|
+
if (code !== void 0) return code;
|
|
278
|
+
throw error;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
async function runSearch(rest, options, json, io, discovery) {
|
|
282
|
+
const query = rest.join(" ").trim();
|
|
283
|
+
if (!query) throw new Usage("search needs <words\u2026>");
|
|
284
|
+
const limit = options.limit === void 0 ? 10 : Number(options.limit);
|
|
285
|
+
if (!Number.isInteger(limit) || limit < 1) throw new Usage("--limit needs a positive integer");
|
|
286
|
+
try {
|
|
287
|
+
const results = discovery.search(query, {
|
|
288
|
+
kinds: options.kind,
|
|
289
|
+
limit
|
|
290
|
+
});
|
|
291
|
+
if (json) io.out(JSON.stringify({ results }));
|
|
292
|
+
else if (!results.length) io.out("No results.");
|
|
293
|
+
else {
|
|
294
|
+
for (const hit of results)
|
|
295
|
+
io.out(`${hit.entry.kind} ${hit.entry.name} ${hit.entry.summary}`);
|
|
296
|
+
const top = results[0].entry;
|
|
297
|
+
const next = top.docs?.[0] ? `anima docs ${top.docs[0]}` : top.schema ? `anima schema ${top.schema}` : void 0;
|
|
298
|
+
if (next) io.out(`Next: ${next}`);
|
|
299
|
+
}
|
|
300
|
+
return 0;
|
|
301
|
+
} catch (error) {
|
|
302
|
+
const code = unavailable(error, json, io);
|
|
303
|
+
if (code !== void 0) return code;
|
|
304
|
+
throw error;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
async function runExamples(rest, options, json, io, discovery) {
|
|
308
|
+
if (rest.length > 1) throw new Usage("examples takes at most one topic or name");
|
|
309
|
+
if (options.print && options.out) throw new Usage("examples uses --print or -o dir, not both");
|
|
310
|
+
try {
|
|
311
|
+
const examples = discovery.examples(rest[0]);
|
|
312
|
+
if (!options.print && !options.out) {
|
|
313
|
+
if (json) io.out(JSON.stringify({ examples }));
|
|
314
|
+
else
|
|
315
|
+
for (const example2 of examples)
|
|
316
|
+
io.out(
|
|
317
|
+
`${example2.path} \u2014 ${example2.entry.summary} (requires ${example2.requires.join(", ") || "none"})`
|
|
318
|
+
);
|
|
319
|
+
return 0;
|
|
320
|
+
}
|
|
321
|
+
if (examples.length === 2 && examples[0].path.replace(/\.ani(ml)?$/, "") === examples[1].path.replace(/\.ani(ml)?$/, ""))
|
|
322
|
+
examples.splice(0, 2, examples.find((e) => e.path.endsWith(".animl")) ?? examples[0]);
|
|
323
|
+
if (examples.length !== 1)
|
|
324
|
+
throw new Usage(
|
|
325
|
+
examples.length ? "examples output needs one match; refine the topic or name" : "no matching example"
|
|
326
|
+
);
|
|
327
|
+
const example = examples[0];
|
|
328
|
+
const source = new URL(example.path, ROOT);
|
|
329
|
+
if (options.print) {
|
|
330
|
+
const text = readFileSync(source, "utf8");
|
|
331
|
+
if (json) io.out(JSON.stringify({ example, text }));
|
|
332
|
+
else if (io.write) io.write(text);
|
|
333
|
+
else io.out(text.trimEnd());
|
|
334
|
+
return 0;
|
|
335
|
+
}
|
|
336
|
+
const dir = String(options.out);
|
|
337
|
+
mkdirSync(dir, { recursive: true });
|
|
338
|
+
const wrote = resolve(dir, basename(example.path));
|
|
339
|
+
cpSync(source, wrote);
|
|
340
|
+
if (json) io.out(JSON.stringify({ example, wrote }));
|
|
341
|
+
else io.out(`wrote ${wrote}`);
|
|
342
|
+
return 0;
|
|
343
|
+
} catch (error) {
|
|
344
|
+
const code = unavailable(error, json, io);
|
|
345
|
+
if (code !== void 0) return code;
|
|
346
|
+
throw error;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
async function run(argv, io, deps = {}) {
|
|
350
|
+
const jsonRequested = wantsJSON(argv);
|
|
351
|
+
const takesValue = /* @__PURE__ */ new Map();
|
|
352
|
+
for (const option of [...GLOBAL, ...COMMANDS.flatMap((c) => c.options)]) {
|
|
353
|
+
takesValue.set("--" + option.name, !!option.value);
|
|
354
|
+
if (option.short) takesValue.set("-" + option.short, !!option.value);
|
|
355
|
+
}
|
|
356
|
+
const leading = [];
|
|
357
|
+
let index = 0;
|
|
358
|
+
while (index < argv.length) {
|
|
359
|
+
const token = argv[index];
|
|
360
|
+
if (token === "--help" || token === "-h") {
|
|
361
|
+
io.out(overview());
|
|
362
|
+
return 0;
|
|
363
|
+
}
|
|
364
|
+
if (token === "--version") {
|
|
365
|
+
io.out(jsonRequested ? JSON.stringify({ version: CLI_VERSION }) : CLI_VERSION);
|
|
366
|
+
return 0;
|
|
367
|
+
}
|
|
368
|
+
if (!token.startsWith("-") || token === "-" || token === "--") break;
|
|
369
|
+
if (!token.startsWith("--") && token.length > 2 && takesValue.get(token.slice(0, 2))) {
|
|
370
|
+
leading.push(token);
|
|
371
|
+
index++;
|
|
372
|
+
continue;
|
|
373
|
+
}
|
|
374
|
+
const name = token.split("=")[0];
|
|
375
|
+
if (!takesValue.has(name)) break;
|
|
376
|
+
leading.push(token);
|
|
377
|
+
if (takesValue.get(name) && !token.includes("=")) {
|
|
378
|
+
const value = argv[index + 1];
|
|
379
|
+
if (value === void 0)
|
|
380
|
+
return emitUsage(new Usage(`option '${name}' needs a value`), void 0, jsonRequested, io);
|
|
381
|
+
leading.push(value);
|
|
382
|
+
index++;
|
|
383
|
+
}
|
|
384
|
+
index++;
|
|
385
|
+
}
|
|
386
|
+
const formats = leading.flatMap(
|
|
387
|
+
(t, i) => t === "--format" ? [leading[i + 1]] : t.startsWith("--format=") ? [t.slice(9)] : []
|
|
388
|
+
);
|
|
389
|
+
for (const value of formats)
|
|
390
|
+
if (value !== "text" && value !== "json")
|
|
391
|
+
return emitUsage(
|
|
392
|
+
usageIssue(
|
|
393
|
+
void 0,
|
|
394
|
+
"value",
|
|
395
|
+
value,
|
|
396
|
+
["text", "json"],
|
|
397
|
+
`'${value}' is not a valid value for '--format'`
|
|
398
|
+
),
|
|
399
|
+
void 0,
|
|
400
|
+
jsonRequested,
|
|
401
|
+
io
|
|
402
|
+
);
|
|
403
|
+
if (index >= argv.length) {
|
|
404
|
+
const stray = leading.find(
|
|
405
|
+
(token, i) => token.startsWith("-") && token !== "--format" && !token.startsWith("--format=") && leading[i - 1] !== "--format"
|
|
406
|
+
);
|
|
407
|
+
if (stray)
|
|
408
|
+
return emitUsage(
|
|
409
|
+
usageIssue(
|
|
410
|
+
void 0,
|
|
411
|
+
"flag",
|
|
412
|
+
stray,
|
|
413
|
+
["--help", "--version", "--format"],
|
|
414
|
+
`option '${stray}' needs a command`
|
|
415
|
+
),
|
|
416
|
+
void 0,
|
|
417
|
+
jsonRequested,
|
|
418
|
+
io
|
|
419
|
+
);
|
|
420
|
+
io.out(overview());
|
|
421
|
+
return 0;
|
|
422
|
+
}
|
|
423
|
+
const rawCommand = argv[index];
|
|
424
|
+
if (rawCommand.startsWith("-")) {
|
|
425
|
+
const error = usageIssue(
|
|
426
|
+
void 0,
|
|
427
|
+
"flag",
|
|
428
|
+
rawCommand,
|
|
429
|
+
["--help", "-h", "--version", "--format"],
|
|
430
|
+
`unknown option '${rawCommand}'`
|
|
431
|
+
);
|
|
432
|
+
return emitUsage(error, void 0, jsonRequested, io);
|
|
433
|
+
}
|
|
434
|
+
const canonical = resolveAlias(rawCommand) ?? rawCommand;
|
|
435
|
+
const command = commandByName(canonical);
|
|
436
|
+
if (!command) {
|
|
437
|
+
const error = usageIssue(
|
|
438
|
+
void 0,
|
|
439
|
+
"command",
|
|
440
|
+
rawCommand,
|
|
441
|
+
COMMANDS.map(({ name }) => name),
|
|
442
|
+
`'${rawCommand}' is not an anima command. See 'anima help'.`
|
|
443
|
+
);
|
|
444
|
+
return emitUsage(error, void 0, jsonRequested, io);
|
|
445
|
+
}
|
|
446
|
+
let parsed;
|
|
447
|
+
try {
|
|
448
|
+
parsed = parseCommandArgs([...leading, ...argv.slice(index + 1)], command);
|
|
449
|
+
} catch (error) {
|
|
450
|
+
return emitUsage(error, command, jsonRequested, io);
|
|
451
|
+
}
|
|
452
|
+
const o = parsed.values;
|
|
453
|
+
const rest = parsed.positionals;
|
|
454
|
+
const json = o.format === "json";
|
|
455
|
+
if (o.help) {
|
|
456
|
+
io.out(commandHelp(command));
|
|
457
|
+
return 0;
|
|
458
|
+
}
|
|
459
|
+
const cmd = command.name;
|
|
460
|
+
const emit = (value) => io.out(JSON.stringify(value, null, json ? void 0 : 2));
|
|
461
|
+
const discovery = { ...DEFAULT_DISCOVERY, ...deps.discover };
|
|
462
|
+
try {
|
|
463
|
+
if (cmd === "help") {
|
|
464
|
+
if (o.json || json) return io.out(helpJSON()), 0;
|
|
465
|
+
if (rest.length > 1) throw new Usage("help takes at most one command");
|
|
466
|
+
if (!rest[0]) return io.out(overview(!!o.all)), 0;
|
|
467
|
+
const target = commandByName(resolveAlias(rest[0]) ?? rest[0]);
|
|
468
|
+
if (!target)
|
|
469
|
+
throw usageIssue(
|
|
470
|
+
command,
|
|
471
|
+
"command",
|
|
472
|
+
rest[0],
|
|
473
|
+
COMMANDS.map(({ name }) => name),
|
|
474
|
+
`'${rest[0]}' is not an anima command`
|
|
475
|
+
);
|
|
476
|
+
io.out(commandHelp(target));
|
|
477
|
+
return 0;
|
|
478
|
+
}
|
|
479
|
+
if (cmd === "version") {
|
|
480
|
+
if (rest.length) throw new Usage("version takes no positional arguments");
|
|
481
|
+
io.out(json ? JSON.stringify({ version: CLI_VERSION }) : CLI_VERSION);
|
|
482
|
+
return 0;
|
|
483
|
+
}
|
|
484
|
+
if (cmd === "completion") {
|
|
485
|
+
if (rest.length !== 1 || !["bash", "zsh", "fish"].includes(rest[0])) {
|
|
486
|
+
const word = rest[0] ?? "";
|
|
487
|
+
throw usageIssue(
|
|
488
|
+
command,
|
|
489
|
+
"value",
|
|
490
|
+
word,
|
|
491
|
+
["bash", "zsh", "fish"],
|
|
492
|
+
word ? `'${word}' is not a supported shell` : "completion needs bash, zsh, or fish"
|
|
493
|
+
);
|
|
494
|
+
}
|
|
495
|
+
const script = completion(rest[0]);
|
|
496
|
+
io.out(json ? JSON.stringify({ shell: rest[0], script }) : script.trimEnd());
|
|
497
|
+
return 0;
|
|
498
|
+
}
|
|
499
|
+
if (cmd === "features") return await runFeatures(rest, json, io, discovery);
|
|
500
|
+
if (cmd === "search") return await runSearch(rest, o, json, io, discovery);
|
|
501
|
+
if (cmd === "examples") return await runExamples(rest, o, json, io, discovery);
|
|
502
|
+
let fonts = { measurer: new ToolMeasurer(), diagnostics: [] };
|
|
503
|
+
const prepareFonts = async () => {
|
|
504
|
+
fonts = { measurer: new ToolMeasurer(), diagnostics: [] };
|
|
505
|
+
const f = file(rest), source = projectSource(f);
|
|
506
|
+
let doc;
|
|
507
|
+
let sourceMap;
|
|
508
|
+
if (f.endsWith(".animl"))
|
|
509
|
+
({ doc, map: sourceMap } = compile(source, {
|
|
510
|
+
file: f,
|
|
511
|
+
validate: false,
|
|
512
|
+
resolve: (path) => substituteConstants(readFileSync(path, "utf8"), findProject()?.constants)
|
|
513
|
+
}));
|
|
514
|
+
else {
|
|
515
|
+
try {
|
|
516
|
+
doc = JSON.parse(source);
|
|
517
|
+
} catch {
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
if (doc && typeof doc === "object" && (o.font?.length || "requires" in doc && Array.isArray(doc.requires) && doc.requires.some((r) => r === "text" || r === "fonts")))
|
|
521
|
+
fonts = documentFonts(doc, f, o.font, (pointer) => sourceMap?.get(pointer)?.file ?? f);
|
|
522
|
+
if (fonts.diagnostics.some((d) => d.severity === "error")) {
|
|
523
|
+
if (json) emit({ file: f, ok: false, diagnostics: fonts.diagnostics });
|
|
524
|
+
else report(f, fonts.diagnostics, io);
|
|
525
|
+
return false;
|
|
526
|
+
}
|
|
527
|
+
fonts.measurer.onDiagnostic = (diagnostic) => {
|
|
528
|
+
if (fonts.diagnostics.some((d) => d.code === diagnostic.code)) return;
|
|
529
|
+
fonts.diagnostics.push(diagnostic);
|
|
530
|
+
if (cmd !== "validate") report(f, [diagnostic], io);
|
|
531
|
+
};
|
|
532
|
+
await installToolMeasurer(fonts.measurer);
|
|
533
|
+
if (cmd !== "validate") report(f, fonts.diagnostics, io);
|
|
534
|
+
return true;
|
|
535
|
+
};
|
|
536
|
+
if (["sample", "validate", "render", "flatten", "build", "inspect", "bench"].includes(cmd) && !await prepareFonts())
|
|
537
|
+
return 1;
|
|
538
|
+
switch (cmd) {
|
|
539
|
+
case "bundle": {
|
|
540
|
+
if (rest.length) throw new Usage("bundle takes no positional arguments; use --modules");
|
|
541
|
+
const result = await bundleBrowser(o.modules, o.out ?? "anima.js", !!o.verbose);
|
|
542
|
+
if (json) emit(result);
|
|
543
|
+
else io.out(`${result.wrote}: ${result.min} B min; ${result.gzip} B gzip`);
|
|
544
|
+
return 0;
|
|
545
|
+
}
|
|
546
|
+
case "doctor": {
|
|
547
|
+
const result = await doctor();
|
|
548
|
+
if (json) emit(result);
|
|
549
|
+
else
|
|
550
|
+
for (const c of result.checks)
|
|
551
|
+
io.out(
|
|
552
|
+
`${c.pass ? "PASS" : "FAIL"} ${c.name}: ${c.message}${c.pass ? "" : "; hint: " + c.hint}`
|
|
553
|
+
);
|
|
554
|
+
return result.ok ? 0 : 1;
|
|
555
|
+
}
|
|
556
|
+
case "compare": {
|
|
557
|
+
if (rest.length !== 2 || !rest.every((path) => path.endsWith(".png")))
|
|
558
|
+
throw new Usage("compare needs two PNG files");
|
|
559
|
+
const tolerance = Number(o.tolerance ?? 0);
|
|
560
|
+
if (!Number.isInteger(tolerance) || tolerance < 0 || tolerance > 255)
|
|
561
|
+
throw new Usage("--tolerance must be an integer from 0 to 255");
|
|
562
|
+
if (o.out && !o.out.endsWith(".png")) throw new Usage("compare output must be .png");
|
|
563
|
+
const { diff, ...metrics } = comparePNG(
|
|
564
|
+
readFileSync(rest[0]),
|
|
565
|
+
readFileSync(rest[1]),
|
|
566
|
+
tolerance,
|
|
567
|
+
!!o.out
|
|
568
|
+
);
|
|
569
|
+
if (o.out) writeFileSync(o.out, diff);
|
|
570
|
+
emit({ ...metrics, tolerance, ...o.out ? { wrote: o.out } : {} });
|
|
571
|
+
return metrics.pass ? 0 : 1;
|
|
572
|
+
}
|
|
573
|
+
case "playground": {
|
|
574
|
+
if (rest.length > 1) throw new Usage("playground takes at most one .animl file");
|
|
575
|
+
const port = o.port === void 0 ? 4519 : Number(o.port);
|
|
576
|
+
if (!Number.isInteger(port) || port < 0 || port > 65535)
|
|
577
|
+
throw new Usage("--port takes an integer from 0 to 65535");
|
|
578
|
+
const host = await startPlayground({ file: rest[0] ?? findProject()?.entry, port });
|
|
579
|
+
if (json) emit({ url: host.url, writable: !!rest[0] });
|
|
580
|
+
else io.out(`Anima Playground: ${host.url}${rest[0] ? "" : " (example is read-only)"}`);
|
|
581
|
+
return 0;
|
|
582
|
+
}
|
|
583
|
+
case "library": {
|
|
584
|
+
if (rest[0] !== "update" || rest.length > 2)
|
|
585
|
+
throw new Usage("library update needs an AniML file");
|
|
586
|
+
try {
|
|
587
|
+
const updates = updateLibraries(file(rest.slice(1)), !!o.check);
|
|
588
|
+
if (json) emit({ updates });
|
|
589
|
+
else
|
|
590
|
+
for (const u of updates)
|
|
591
|
+
io.out(`${u.changed ? o.check ? "stale" : "updated" : "current"} ${u.file}`);
|
|
592
|
+
return o.check && updates.some((u) => u.changed) ? 1 : 0;
|
|
593
|
+
} catch (e) {
|
|
594
|
+
const error = e;
|
|
595
|
+
const diagnostic = {
|
|
596
|
+
code: error.code ?? "library-source",
|
|
597
|
+
pointer: error.pointer ?? "",
|
|
598
|
+
message: error.message,
|
|
599
|
+
hint: error.hint ?? "check local import src and source paths",
|
|
600
|
+
severity: "error"
|
|
601
|
+
};
|
|
602
|
+
if (json) emit({ diagnostics: [diagnostic] });
|
|
603
|
+
else
|
|
604
|
+
io.err(
|
|
605
|
+
`${diagnostic.code} ${diagnostic.pointer}: ${diagnostic.message}; ${diagnostic.hint}`
|
|
606
|
+
);
|
|
607
|
+
return 1;
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
case "validate":
|
|
611
|
+
return validate(file(rest), json, io, fonts.diagnostics);
|
|
612
|
+
case "inspect":
|
|
613
|
+
return inspect(file(rest), json, io, !!o.summary);
|
|
614
|
+
case "sample": {
|
|
615
|
+
const { model } = loaded(file(rest), io, json);
|
|
616
|
+
if (!model) return 1;
|
|
617
|
+
const script = scriptText(o.script, o.eval) ?? "snapshot";
|
|
618
|
+
const result = runScript(model, script, scriptOptions(o));
|
|
619
|
+
for (const item of result.output) io.out(JSON.stringify(item));
|
|
620
|
+
for (const d of result.diagnostics) io.err(JSON.stringify(d));
|
|
621
|
+
return result.diagnostics.length ? 1 : 0;
|
|
622
|
+
}
|
|
623
|
+
case "session": {
|
|
624
|
+
const f = file(rest);
|
|
625
|
+
if (rest.length !== 1) throw new Usage("session takes one file");
|
|
626
|
+
return await session(
|
|
627
|
+
async () => {
|
|
628
|
+
const next = check(f).model;
|
|
629
|
+
return next && await prepareFonts() ? next : void 0;
|
|
630
|
+
},
|
|
631
|
+
io,
|
|
632
|
+
scriptOptions(o)
|
|
633
|
+
);
|
|
634
|
+
}
|
|
635
|
+
case "bench": {
|
|
636
|
+
const f = file(rest);
|
|
637
|
+
const frames = o.frames === void 0 ? 600 : Number(o.frames);
|
|
638
|
+
if (rest.length !== 1 || !Number.isInteger(frames) || frames < 1 || frames > 1e6)
|
|
639
|
+
throw new Usage("bench --frames needs an integer from 1 to 1000000 and one file");
|
|
640
|
+
const result = bench(
|
|
641
|
+
() => loaded(f, io, json).model,
|
|
642
|
+
scriptText(o.script, o.eval) ?? "",
|
|
643
|
+
frames,
|
|
644
|
+
scriptOptions(o)
|
|
645
|
+
);
|
|
646
|
+
if (!result) return 1;
|
|
647
|
+
if (json || "diagnostics" in result) io.out(JSON.stringify(result));
|
|
648
|
+
else
|
|
649
|
+
io.out(
|
|
650
|
+
`compile ${result.compileMs.toFixed(3)} ms; ${result.frames} frames; step median ${result.step.median.toFixed(3)} \xB5s p95 ${result.step.p95.toFixed(3)} \xB5s; draw median ${result.draw.median.toFixed(3)} \xB5s p95 ${result.draw.p95.toFixed(3)} \xB5s; JS heap growth ${result.memory.growthBytes} B (${result.memory.bytesPerFrame.toFixed(2)} B/frame)`
|
|
651
|
+
);
|
|
652
|
+
return "diagnostics" in result ? 1 : 0;
|
|
653
|
+
}
|
|
654
|
+
case "render": {
|
|
655
|
+
const names = o.preset ?? [];
|
|
656
|
+
const presets = names.map((name) => {
|
|
657
|
+
const preset = findProject()?.presets?.[name];
|
|
658
|
+
if (!preset) throw new Usage("unknown render preset " + name);
|
|
659
|
+
return preset;
|
|
660
|
+
});
|
|
661
|
+
const explicit = Object.fromEntries(
|
|
662
|
+
Object.entries(o).filter(([, value]) => value !== void 0)
|
|
663
|
+
);
|
|
664
|
+
for (let i = 0; i < Math.max(1, presets.length); i++) {
|
|
665
|
+
const output = presets.length > 1 && o.out ? o.out.replace(/(\.[^.]+)$/, "-" + names[i] + "$1") : o.out;
|
|
666
|
+
const result = await render(
|
|
667
|
+
file(rest),
|
|
668
|
+
{ ...presets[i], ...explicit, out: output },
|
|
669
|
+
json,
|
|
670
|
+
io,
|
|
671
|
+
fonts.measurer
|
|
672
|
+
);
|
|
673
|
+
if (result) return result;
|
|
674
|
+
}
|
|
675
|
+
return 0;
|
|
676
|
+
}
|
|
677
|
+
case "import-font": {
|
|
678
|
+
if (!o.out) throw new Usage("import-font needs -o local.ttf|otf");
|
|
679
|
+
if (o.google ? rest.length !== 0 : rest.length !== 1)
|
|
680
|
+
throw new Usage("import-font takes a font file or --google family:axes@values");
|
|
681
|
+
const assets = o.google ? await googleFonts(o.google, o.out, o.chars) : [importFont(file(rest), o.out, o.chars)];
|
|
682
|
+
emit({ assets });
|
|
683
|
+
return 0;
|
|
684
|
+
}
|
|
685
|
+
case "flatten": {
|
|
686
|
+
const f = file(rest), result = loaded(f, io, json);
|
|
687
|
+
if (!result.model) return 1;
|
|
688
|
+
const doc = flattenText(JSON.parse(result.text), fonts.measurer, o.node), text = format(doc);
|
|
689
|
+
if (o.out) writeFileSync(o.out, o.out.endsWith(".animl") ? decompile(text) : text);
|
|
690
|
+
else if (io.write) io.write(text);
|
|
691
|
+
else io.out(text);
|
|
692
|
+
if (json && o.out) emit({ wrote: o.out });
|
|
693
|
+
return 0;
|
|
694
|
+
}
|
|
695
|
+
case "build": {
|
|
696
|
+
const dir = o["out-dir"] ?? (!o.out ? findProject()?.out : void 0);
|
|
697
|
+
if (dir) return await exportProject(file(rest), dir, json, io);
|
|
698
|
+
return await build(file(rest), o.out, json, io, !!o.embed);
|
|
699
|
+
}
|
|
700
|
+
case "import": {
|
|
701
|
+
const f = file(rest);
|
|
702
|
+
const name = nameFromFile(f.replace(/\.(svg|json)$/i, ".svg")).toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "") || "imported";
|
|
703
|
+
const source = readFileSync(f, "utf8");
|
|
704
|
+
if (!/\.(svg|json)$/i.test(f)) throw new Usage("import needs a .svg or Lottie .json file");
|
|
705
|
+
let imported;
|
|
706
|
+
try {
|
|
707
|
+
imported = /\.svg$/i.test(f) ? importSVG(source, name) : importLottie(source, name);
|
|
708
|
+
} catch (error) {
|
|
709
|
+
const diagnostics2 = [
|
|
710
|
+
{
|
|
711
|
+
code: "import-invalid",
|
|
712
|
+
severity: "error",
|
|
713
|
+
pointer: "",
|
|
714
|
+
message: error instanceof Error ? error.message : "invalid source document",
|
|
715
|
+
hint: "provide a well-formed SVG or Lottie animation with a positive viewBox/frame rate"
|
|
716
|
+
}
|
|
717
|
+
];
|
|
718
|
+
if (json) io.out(JSON.stringify({ file: f, ok: false, diagnostics: diagnostics2 }));
|
|
719
|
+
else report(f, diagnostics2, io);
|
|
720
|
+
return 1;
|
|
721
|
+
}
|
|
722
|
+
const checked = load(imported.doc);
|
|
723
|
+
const diagnostics = [...imported.diagnostics, ...checked.diagnostics];
|
|
724
|
+
if (diagnostics.some((d) => d.severity === "error")) {
|
|
725
|
+
if (json) io.out(JSON.stringify({ file: f, ok: false, diagnostics }));
|
|
726
|
+
else report(f, diagnostics, io);
|
|
727
|
+
return 1;
|
|
728
|
+
}
|
|
729
|
+
const text = decompile(format(imported.doc));
|
|
730
|
+
if (o.out) writeFileSync(o.out, text);
|
|
731
|
+
if (json)
|
|
732
|
+
io.out(
|
|
733
|
+
JSON.stringify({
|
|
734
|
+
file: f,
|
|
735
|
+
ok: true,
|
|
736
|
+
diagnostics,
|
|
737
|
+
...o.out ? { wrote: o.out } : { text }
|
|
738
|
+
})
|
|
739
|
+
);
|
|
740
|
+
else {
|
|
741
|
+
report(f, diagnostics, io);
|
|
742
|
+
if (!o.out) io.out(text.trimEnd());
|
|
743
|
+
}
|
|
744
|
+
return 0;
|
|
745
|
+
}
|
|
746
|
+
case "decompile": {
|
|
747
|
+
const f = file(rest);
|
|
748
|
+
const result = loaded(f, io, json);
|
|
749
|
+
if (!result.model) return 1;
|
|
750
|
+
const text = decompile(result.text);
|
|
751
|
+
if (o.out) writeFileSync(o.out, text);
|
|
752
|
+
else io.out(text.trimEnd());
|
|
753
|
+
return 0;
|
|
754
|
+
}
|
|
755
|
+
case "fmt": {
|
|
756
|
+
const f = file(rest);
|
|
757
|
+
const text = readFileSync(f, "utf8");
|
|
758
|
+
let output;
|
|
759
|
+
if (f.endsWith(".animl")) {
|
|
760
|
+
const result = formatMarkup(text);
|
|
761
|
+
const diagnostics = result.diagnostics.map((d) => ({ ...d, file: f }));
|
|
762
|
+
if (!result.text) {
|
|
763
|
+
if (json) emit({ file: f, ok: false, diagnostics });
|
|
764
|
+
else report(f, diagnostics, io);
|
|
765
|
+
return 1;
|
|
766
|
+
}
|
|
767
|
+
output = result.text;
|
|
768
|
+
} else {
|
|
769
|
+
let doc;
|
|
770
|
+
try {
|
|
771
|
+
doc = JSON.parse(text);
|
|
772
|
+
} catch (error) {
|
|
773
|
+
io.err(`${f}: not JSON: ${error.message}`);
|
|
774
|
+
return 1;
|
|
775
|
+
}
|
|
776
|
+
output = format(doc);
|
|
777
|
+
}
|
|
778
|
+
if (o.check) {
|
|
779
|
+
if (json) emit({ file: f, formatted: output === text });
|
|
780
|
+
else
|
|
781
|
+
io.out(
|
|
782
|
+
output === text ? `${f}: formatted` : `${f}: not formatted (run anima fmt --write)`
|
|
783
|
+
);
|
|
784
|
+
return output === text ? 0 : 1;
|
|
785
|
+
}
|
|
786
|
+
if (o.write) {
|
|
787
|
+
writeFileSync(f, output);
|
|
788
|
+
if (json) emit({ wrote: f });
|
|
789
|
+
return 0;
|
|
790
|
+
}
|
|
791
|
+
io.out(output.trimEnd());
|
|
792
|
+
return 0;
|
|
793
|
+
}
|
|
794
|
+
case "new":
|
|
795
|
+
return o.sample ? sampleProject(rest, o, json, io) : scaffold(rest, o, json, io);
|
|
796
|
+
case "schema":
|
|
797
|
+
if (rest[0]) rest[0] = schemaTopic(rest[0]);
|
|
798
|
+
if (o.all && o["json-schema"])
|
|
799
|
+
throw new Usage("schema takes --all or --json-schema, not both");
|
|
800
|
+
if (o.search !== void 0 && !String(o.search).trim())
|
|
801
|
+
throw new Usage("--search needs at least one word");
|
|
802
|
+
if (o.animatable || o.bindable || o.inherited || o["editor-only"])
|
|
803
|
+
return filteredSchema(rest[0], o, json, io);
|
|
804
|
+
if (o.all && !rest[0] && !o.search) return schemaAll(json, io);
|
|
805
|
+
return o.search ? schemaSearch(o.search, json, io) : schema(rest[0], !!o["json-schema"], json, io);
|
|
806
|
+
case "docs":
|
|
807
|
+
return (o.full ? docsFull : docs)(rest[0], !!o.list, json, io, rest[1]);
|
|
808
|
+
default:
|
|
809
|
+
throw new Usage(`command '${cmd}' has no dispatcher`);
|
|
810
|
+
}
|
|
811
|
+
} catch (error) {
|
|
812
|
+
if (error instanceof Usage) return emitUsage(error, command, json, io);
|
|
813
|
+
if (error instanceof ScriptError) {
|
|
814
|
+
io.err(
|
|
815
|
+
JSON.stringify({
|
|
816
|
+
code: error.code,
|
|
817
|
+
pointer: error.pointer,
|
|
818
|
+
message: error.message,
|
|
819
|
+
hint: error.hint
|
|
820
|
+
})
|
|
821
|
+
);
|
|
822
|
+
return 2;
|
|
823
|
+
}
|
|
824
|
+
const detail = error;
|
|
825
|
+
if (detail.code) {
|
|
826
|
+
const diagnostic = {
|
|
827
|
+
code: detail.code,
|
|
828
|
+
pointer: detail.pointer ?? "",
|
|
829
|
+
message: detail.message,
|
|
830
|
+
hint: detail.hint ?? "check local files and browser installation"
|
|
831
|
+
};
|
|
832
|
+
if (json) emit({ diagnostics: [diagnostic] });
|
|
833
|
+
else
|
|
834
|
+
io.err(
|
|
835
|
+
`${diagnostic.code} ${diagnostic.pointer}: ${diagnostic.message}; hint: ${diagnostic.hint}`
|
|
836
|
+
);
|
|
837
|
+
} else io.err(detail.message);
|
|
838
|
+
return 1;
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
function file(rest) {
|
|
842
|
+
const f = rest[0] ?? findProject()?.entry;
|
|
843
|
+
if (!f) throw new Usage("missing <file>");
|
|
844
|
+
if (!existsSync(f)) throw new Usage(`no such file: ${f}`);
|
|
845
|
+
return f;
|
|
846
|
+
}
|
|
847
|
+
function scriptOptions(o) {
|
|
848
|
+
const seed = o.seed === void 0 ? void 0 : Number(o.seed);
|
|
849
|
+
if (seed !== void 0 && (!Number.isInteger(seed) || seed < 0 || seed > 4294967295))
|
|
850
|
+
throw new Usage("--seed needs a uint32 integer");
|
|
851
|
+
return { reducedMotion: !!o["reduced-motion"], all: !!o.all, semantics: !!o.semantics, seed };
|
|
852
|
+
}
|
|
853
|
+
function scriptText(file2, inline) {
|
|
854
|
+
if (file2 && inline) throw new Usage("use --script or -e, not both");
|
|
855
|
+
if (file2) return readFileSync(file2, "utf8");
|
|
856
|
+
return inline?.replace(/;/g, "\n");
|
|
857
|
+
}
|
|
858
|
+
function subtractionHints(diagnostics) {
|
|
859
|
+
const ambiguous = diagnostics.flatMap((d) => {
|
|
860
|
+
const match = d.code === "data-path" && /unknown data path (\$[\w:.-]+)-(\d+)$/.exec(d.message);
|
|
861
|
+
return match ? [{ diagnostic: d, path: match[1], number: match[2] }] : [];
|
|
862
|
+
});
|
|
863
|
+
return diagnostics.filter(
|
|
864
|
+
(d) => !ambiguous.some(
|
|
865
|
+
({ diagnostic, path, number }) => d.code === "unknown-input" && d.pointer === diagnostic.pointer && d.message.includes(path + "-" + number)
|
|
866
|
+
)
|
|
867
|
+
).map((d) => {
|
|
868
|
+
const entry = ambiguous.find(({ diagnostic }) => diagnostic === d);
|
|
869
|
+
return entry ? {
|
|
870
|
+
...d,
|
|
871
|
+
hint: `write \`${entry.path} - ${entry.number}\` (spaces around the minus): names may contain hyphens`
|
|
872
|
+
} : d;
|
|
873
|
+
});
|
|
874
|
+
}
|
|
875
|
+
function check(f) {
|
|
876
|
+
const text = projectSource(f);
|
|
877
|
+
if (f.endsWith(".animl")) {
|
|
878
|
+
const c = compile(text, {
|
|
879
|
+
file: f,
|
|
880
|
+
resolve: (path) => substituteConstants(readFileSync(path, "utf8"), findProject()?.constants)
|
|
881
|
+
});
|
|
882
|
+
const diagnostics2 = subtractionHints(c.diagnostics);
|
|
883
|
+
if (c.doc) {
|
|
884
|
+
for (const d of glyphDiagnostics(c.doc)) {
|
|
885
|
+
let pointer = d.pointer;
|
|
886
|
+
while (!c.map.has(pointer) && pointer) pointer = pointer.slice(0, pointer.lastIndexOf("/"));
|
|
887
|
+
const pos = c.map.get(pointer);
|
|
888
|
+
diagnostics2.push({ ...d, file: f, line: pos?.line, column: pos?.col });
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
return { model: c.text ? load(c.text).model : void 0, diagnostics: diagnostics2, text: c.text ?? "" };
|
|
892
|
+
}
|
|
893
|
+
const r = load(text);
|
|
894
|
+
const diagnostics = subtractionHints(r.diagnostics);
|
|
895
|
+
let at = /* @__PURE__ */ new Map();
|
|
896
|
+
try {
|
|
897
|
+
JSON.parse(text);
|
|
898
|
+
const loc = locate(text);
|
|
899
|
+
at = loc.at;
|
|
900
|
+
for (const d of loc.duplicates)
|
|
901
|
+
diagnostics.unshift({
|
|
902
|
+
code: "duplicate-key",
|
|
903
|
+
severity: "error",
|
|
904
|
+
pointer: d.pointer,
|
|
905
|
+
message: "this key appears twice in its object; JSON parsers keep only the last",
|
|
906
|
+
hint: "remove or merge one of them"
|
|
907
|
+
});
|
|
908
|
+
const doc = JSON.parse(text);
|
|
909
|
+
diagnostics.push(...glyphDiagnostics(doc));
|
|
910
|
+
} catch {
|
|
911
|
+
}
|
|
912
|
+
for (const d of diagnostics) {
|
|
913
|
+
const off = d.code === "json-syntax" ? syntaxErrorAt(text) : at.get(d.pointer);
|
|
914
|
+
if (off !== void 0 && off !== null) [d.line, d.column] = lineCol(text, off);
|
|
915
|
+
}
|
|
916
|
+
const failed = diagnostics.some((d) => d.severity === "error");
|
|
917
|
+
return { model: failed ? void 0 : r.model, diagnostics, text };
|
|
918
|
+
}
|
|
919
|
+
function glyphDiagnostics(doc) {
|
|
920
|
+
const diagnostics = [];
|
|
921
|
+
for (const [name, g] of Object.entries(
|
|
922
|
+
doc?.glyphs ?? {}
|
|
923
|
+
))
|
|
924
|
+
if (typeof g?.sha256 === "string" && typeof g.d === "string" && sha256(g.d) !== g.sha256)
|
|
925
|
+
diagnostics.push({
|
|
926
|
+
code: "hash-mismatch",
|
|
927
|
+
severity: "warning",
|
|
928
|
+
pointer: `/glyphs/${name}/sha256`,
|
|
929
|
+
message: `glyph "${name}" changed since its hash was taken`,
|
|
930
|
+
hint: "if it was re-traced, check that subpath indices still pick the right parts, then update sha256"
|
|
931
|
+
});
|
|
932
|
+
return diagnostics;
|
|
933
|
+
}
|
|
934
|
+
function loaded(f, io, json = false) {
|
|
935
|
+
const r = check(f);
|
|
936
|
+
if (!r.model) {
|
|
937
|
+
if (json && f.endsWith(".animl"))
|
|
938
|
+
io.out(JSON.stringify({ file: f, ok: false, diagnostics: r.diagnostics }));
|
|
939
|
+
else report(f, r.diagnostics, io);
|
|
940
|
+
io.err(`${f}: fix the errors above first (anima validate ${f})`);
|
|
941
|
+
}
|
|
942
|
+
return r;
|
|
943
|
+
}
|
|
944
|
+
function report(f, ds, io) {
|
|
945
|
+
for (const d of ds) {
|
|
946
|
+
const where = d.line ? `${d.file ?? f}:${d.line}:${d.column}` : d.file ?? f;
|
|
947
|
+
for (const r of d.related ?? [])
|
|
948
|
+
io.err(` related: ${r.file ?? f}:${r.line}:${r.column}`);
|
|
949
|
+
if (d.file) {
|
|
950
|
+
io.err(`${where} ${d.severity} ${d.code} ${d.message}`);
|
|
951
|
+
if (d.hint) io.err(` hint: ${d.hint}`);
|
|
952
|
+
continue;
|
|
953
|
+
}
|
|
954
|
+
io.err(
|
|
955
|
+
`${where} ${d.severity} ${d.code} ${d.pointer || "/"}: ${d.message}${d.hint ? ` \u2014 ${d.hint}` : ""}`
|
|
956
|
+
);
|
|
957
|
+
}
|
|
958
|
+
}
|
|
959
|
+
function validate(f, json, io, extra = []) {
|
|
960
|
+
const { model, diagnostics } = check(f);
|
|
961
|
+
diagnostics.push(...extra);
|
|
962
|
+
if (json) io.out(JSON.stringify({ file: f, ok: !!model, diagnostics }));
|
|
963
|
+
else {
|
|
964
|
+
report(f, diagnostics, io);
|
|
965
|
+
const errors = diagnostics.filter((d) => d.severity === "error").length;
|
|
966
|
+
const warnings = diagnostics.length - errors;
|
|
967
|
+
io.out(
|
|
968
|
+
model ? `${f}: ok${warnings ? ` (${warnings} warning${warnings > 1 ? "s" : ""})` : ""}` : `${f}: ${errors} error${errors > 1 ? "s" : ""}${warnings ? `, ${warnings} warning${warnings > 1 ? "s" : ""}` : ""}`
|
|
969
|
+
);
|
|
970
|
+
}
|
|
971
|
+
return model ? 0 : 1;
|
|
972
|
+
}
|
|
973
|
+
function inspect(f, json, io, summaryOnly = false) {
|
|
974
|
+
const { model, diagnostics } = loaded(f, io, json);
|
|
975
|
+
if (!model) return 1;
|
|
976
|
+
if (summaryOnly) {
|
|
977
|
+
const wiring = wiringSummary(model, diagnostics);
|
|
978
|
+
if (json) io.out(JSON.stringify({ wiring }));
|
|
979
|
+
else
|
|
980
|
+
io.out(
|
|
981
|
+
[
|
|
982
|
+
"code pointer message hint",
|
|
983
|
+
...wiring.map((d) => `${d.code} ${d.pointer} ${d.message} ${d.hint}`)
|
|
984
|
+
].join("\n")
|
|
985
|
+
);
|
|
986
|
+
return 0;
|
|
987
|
+
}
|
|
988
|
+
const m = model;
|
|
989
|
+
const doc = m.doc;
|
|
990
|
+
const node = (i) => {
|
|
991
|
+
const n = m.nodes[i];
|
|
992
|
+
const animated = [...m.addrs.keys()].filter((a) => a.startsWith(n.id + ".")).map((a) => a.slice(n.id.length + 1));
|
|
993
|
+
return {
|
|
994
|
+
id: n.id,
|
|
995
|
+
type: n.type,
|
|
996
|
+
...n.raw.component ? { component: n.raw.component } : {},
|
|
997
|
+
...n.raw.glyph ? { glyph: n.raw.glyph, subpaths: n.raw.subpaths ?? "all" } : {},
|
|
998
|
+
...n.raw.pivot ? { pivot: n.raw.pivot } : {},
|
|
999
|
+
...animated.length ? { animated } : {},
|
|
1000
|
+
...n.raw.knockout !== void 0 ? { knockout: n.raw.knockout } : {},
|
|
1001
|
+
...n.children.length ? { children: n.children.map(node) } : {}
|
|
1002
|
+
};
|
|
1003
|
+
};
|
|
1004
|
+
const writers = /* @__PURE__ */ new Map();
|
|
1005
|
+
const layers = m.layers.map((l) => {
|
|
1006
|
+
const writes = [...new Set(l.states.flatMap((s) => s.writes))];
|
|
1007
|
+
for (const a of writes) writers.set(a, [...writers.get(a) ?? [], l.name]);
|
|
1008
|
+
return {
|
|
1009
|
+
name: l.name,
|
|
1010
|
+
initial: l.states[l.initial].name,
|
|
1011
|
+
writes,
|
|
1012
|
+
states: l.states.map((s) => ({
|
|
1013
|
+
name: s.name,
|
|
1014
|
+
kind: doc.machine.layers[l.name].states[s.name].kind,
|
|
1015
|
+
...s.play !== void 0 ? { play: m.timelines[s.play].name } : {
|
|
1016
|
+
pose: Object.fromEntries(
|
|
1017
|
+
[...s.pose].map(([k, v]) => [
|
|
1018
|
+
k,
|
|
1019
|
+
Array.isArray(v) ? `#${v.map((c) => c.toString(16).padStart(2, "0")).join("")}` : v
|
|
1020
|
+
])
|
|
1021
|
+
)
|
|
1022
|
+
},
|
|
1023
|
+
...s.emit ? { emit: s.emit } : {},
|
|
1024
|
+
on: (doc.machine.layers[l.name].states[s.name].on ?? []).map(
|
|
1025
|
+
(t) => `${t.when} \u2192 ${t.to}${t.blend ? ` (${t.blend}s)` : ""}`
|
|
1026
|
+
),
|
|
1027
|
+
...s.on.length || l.states.some(
|
|
1028
|
+
(a) => doc.machine.layers[l.name].states[a.name].kind === "any" && a.on.length
|
|
1029
|
+
) ? {} : { deadEnd: true }
|
|
1030
|
+
}))
|
|
1031
|
+
};
|
|
1032
|
+
});
|
|
1033
|
+
const preview = new Player(m);
|
|
1034
|
+
preview.step(0);
|
|
1035
|
+
const instances = preview.inspect().filter((l) => l.layer.includes("/"));
|
|
1036
|
+
const slots = /* @__PURE__ */ new Map();
|
|
1037
|
+
const inputs = (player, prefix = "") => {
|
|
1038
|
+
const repeated = listState(player)?.runs ?? [];
|
|
1039
|
+
const ids = repeated.map((r) => player.model.nodes[r.spec.node].id + ".");
|
|
1040
|
+
for (const name of player.model.inputs.keys())
|
|
1041
|
+
if (!(prefix && name.startsWith("$")) && !ids.some((id) => name.startsWith(id)))
|
|
1042
|
+
slots.set(prefix + name, player.model.inputs.get(name).type);
|
|
1043
|
+
for (const run2 of repeated) {
|
|
1044
|
+
for (const item of run2.items)
|
|
1045
|
+
inputs(
|
|
1046
|
+
item.player,
|
|
1047
|
+
prefix + player.model.nodes[run2.spec.node].id + "." + item.index + "."
|
|
1048
|
+
);
|
|
1049
|
+
const base = prefix + player.model.nodes[run2.spec.node].id + ".";
|
|
1050
|
+
for (const name of slots.keys())
|
|
1051
|
+
if (name.startsWith(base) && !run2.items.some((item) => name.startsWith(base + item.index + ".")))
|
|
1052
|
+
slots.delete(name);
|
|
1053
|
+
}
|
|
1054
|
+
for (const [id, child] of player.nested?.players ?? [])
|
|
1055
|
+
inputs(child, prefix + id + ".");
|
|
1056
|
+
};
|
|
1057
|
+
inputs(preview);
|
|
1058
|
+
const summary = {
|
|
1059
|
+
instances,
|
|
1060
|
+
name: doc.name,
|
|
1061
|
+
title: doc.title,
|
|
1062
|
+
grid: m.grid,
|
|
1063
|
+
viewBox: m.viewBox,
|
|
1064
|
+
glyphs: Object.fromEntries(
|
|
1065
|
+
Object.entries(doc.glyphs ?? {}).filter(([name]) => name !== "$comment").map(([name, g]) => [name, { subpaths: inspectGlyph(g.d) }])
|
|
1066
|
+
),
|
|
1067
|
+
nodes: m.nodes.flatMap((n, i) => n.parent < 0 ? [node(i)] : []),
|
|
1068
|
+
inputs: Object.fromEntries(slots),
|
|
1069
|
+
timelines: m.timelines.map((t) => ({
|
|
1070
|
+
name: t.name,
|
|
1071
|
+
duration: t.duration,
|
|
1072
|
+
loop: t.loop,
|
|
1073
|
+
reducedMotion: t.reduced,
|
|
1074
|
+
writes: t.tracks.map((x) => x.addr),
|
|
1075
|
+
events: t.events.map((e) => e[1])
|
|
1076
|
+
})),
|
|
1077
|
+
layers,
|
|
1078
|
+
bound: [
|
|
1079
|
+
...Object.keys(doc.bind ?? {}).filter((a) => a !== "$comment"),
|
|
1080
|
+
...m.nodes.flatMap(
|
|
1081
|
+
(n) => Object.entries(n.raw.inputs ?? {}).filter(([, v]) => typeof v === "string").map(([key]) => n.id + "." + key)
|
|
1082
|
+
)
|
|
1083
|
+
],
|
|
1084
|
+
overlaps: [...writers].filter(([, ls]) => ls.length > 1).map(([a, ls]) => `${a} is written by ${ls.join(", ")} (the last one wins)`),
|
|
1085
|
+
listeners: m.listeners.map(
|
|
1086
|
+
(l, i) => `${l.on}${l.target >= 0 ? ` on ${m.nodes[l.target].id}` : ""} \u2192 ${[...l.fire.map((x) => `fire ${x}`), ...l.set.map(([k, v]) => `set ${k}=${v}`), ...l.toggle.map((x) => `toggle ${x}`), ...l.emit ? [`emit ${l.emit}`] : [], ...Object.entries(doc.listeners?.[i]?.write ?? {}).map(([field, input]) => `write ${field} \u2192 ${input}`)].join(", ")}`
|
|
1087
|
+
),
|
|
1088
|
+
a11y: doc.a11y ?? null,
|
|
1089
|
+
warnings: diagnostics.filter((d) => d.severity === "warning").map((d) => `${d.code} ${d.pointer}: ${d.message}`)
|
|
1090
|
+
};
|
|
1091
|
+
if (json) return io.out(JSON.stringify(summary)), 0;
|
|
1092
|
+
const lines = [
|
|
1093
|
+
`${doc.name}${doc.title ? ` \u2014 ${doc.title}` : ""} (grid ${m.grid}, viewBox ${m.viewBox.join(" ")})`,
|
|
1094
|
+
"",
|
|
1095
|
+
"glyphs (bbox: minX minY maxX maxY, grid units; hole hints use bbox containment only)"
|
|
1096
|
+
];
|
|
1097
|
+
for (const [name, glyph] of Object.entries(summary.glyphs)) {
|
|
1098
|
+
lines.push(` ${name}`);
|
|
1099
|
+
for (const sp of glyph.subpaths)
|
|
1100
|
+
lines.push(
|
|
1101
|
+
` ${sp.index}: bbox ${sp.bbox.join(" ")}${sp.likelyHoleOf.length ? `; likely hole of ${sp.likelyHoleOf.join(", ")}` : ""}`
|
|
1102
|
+
);
|
|
1103
|
+
}
|
|
1104
|
+
lines.push("", "nodes");
|
|
1105
|
+
const tree = (n, d) => {
|
|
1106
|
+
lines.push(
|
|
1107
|
+
`${d}${n.id} (${n.type}${n.glyph ? ` ${n.glyph}[${n.subpaths}]` : ""})${n.pivot ? ` pivot ${n.pivot.join(",")}` : ""}${n.animated ? ` animates ${n.animated.join(", ")}` : ""}${n.knockout !== void 0 ? ` knockout ${n.knockout}` : ""}`
|
|
1108
|
+
);
|
|
1109
|
+
for (const c of n.children ?? []) tree(c, d + " ");
|
|
1110
|
+
};
|
|
1111
|
+
for (const n of summary.nodes) tree(n, " ");
|
|
1112
|
+
lines.push(
|
|
1113
|
+
"",
|
|
1114
|
+
`inputs: ${Object.entries(summary.inputs).map(([k, v]) => `${k} (${v})`).join(", ") || "none"}`,
|
|
1115
|
+
"",
|
|
1116
|
+
"timelines"
|
|
1117
|
+
);
|
|
1118
|
+
for (const t of summary.timelines)
|
|
1119
|
+
lines.push(
|
|
1120
|
+
` ${t.name}: ${t.duration}s ${t.loop}, reduced motion: ${t.reducedMotion}${t.events.length ? `, events ${t.events.join(", ")}` : ""}`,
|
|
1121
|
+
` writes ${t.writes.join(", ")}`
|
|
1122
|
+
);
|
|
1123
|
+
lines.push("", "machine");
|
|
1124
|
+
for (const l of layers) {
|
|
1125
|
+
lines.push(` layer ${l.name} (writes ${l.writes.join(", ") || "nothing"})`);
|
|
1126
|
+
for (const s of l.states)
|
|
1127
|
+
lines.push(
|
|
1128
|
+
` ${s.name === l.initial ? "*" : " "}${s.name}: ${s.kind ? `${s.kind} state` : "play" in s ? `play ${s.play}` : `pose ${JSON.stringify(s.pose)}`}${s.emit ? `, emit ${s.emit}` : ""}${"deadEnd" in s && s.kind !== "any" ? " (no way out)" : ""}`,
|
|
1129
|
+
...s.on.map((t) => ` ${t}`)
|
|
1130
|
+
);
|
|
1131
|
+
}
|
|
1132
|
+
if (instances.length)
|
|
1133
|
+
lines.push("", "instances", ...instances.map((l) => ` ${l.layer}: ${l.state}`));
|
|
1134
|
+
if (summary.bound.length) lines.push("", "bound", ...summary.bound.map((a) => ` ${a}`));
|
|
1135
|
+
lines.push("", "listeners", ...summary.listeners.map((l) => ` ${l}`));
|
|
1136
|
+
if (summary.overlaps.length) lines.push("", "overlaps", ...summary.overlaps.map((x) => ` ${x}`));
|
|
1137
|
+
if (summary.warnings.length) lines.push("", "warnings", ...summary.warnings.map((x) => ` ${x}`));
|
|
1138
|
+
io.out(lines.join("\n"));
|
|
1139
|
+
return 0;
|
|
1140
|
+
}
|
|
1141
|
+
async function render(f, o, json, io, measurer) {
|
|
1142
|
+
const drawFrame = (player2, look2, size2, id) => {
|
|
1143
|
+
const svg2 = frameSVG(player2, look2, size2, id);
|
|
1144
|
+
return o["browser-text"] ? embedFontCSS(svg2, measurer) : outlineSVG(svg2, measurer);
|
|
1145
|
+
};
|
|
1146
|
+
const rasterize = (svg2) => o["browser-text"] ? browserTextPNG(svg2, measurer) : Promise.resolve(toPNG(svg2));
|
|
1147
|
+
const out = o.out;
|
|
1148
|
+
const compare = o.compare;
|
|
1149
|
+
if (!compare && !out && !o.probe && !o.audio || out && !/\.(svg|png|webm)$/.test(out))
|
|
1150
|
+
throw new Usage("render needs -o <file>.svg|png|webm");
|
|
1151
|
+
let { model } = loaded(f, io, json);
|
|
1152
|
+
if (!model) return 1;
|
|
1153
|
+
if (o.component) {
|
|
1154
|
+
const names = componentNames(model.doc, String(o.component));
|
|
1155
|
+
if (names.length > 1) throw new Usage("ambiguous-component: use " + names.join(" or "));
|
|
1156
|
+
const name = names[0];
|
|
1157
|
+
const definition = name && model.doc.components?.[name];
|
|
1158
|
+
if (!definition) throw new Usage("unknown component " + o.component);
|
|
1159
|
+
const doc = model.doc;
|
|
1160
|
+
const selected = load({
|
|
1161
|
+
anima: "0.1",
|
|
1162
|
+
requires: doc.requires,
|
|
1163
|
+
components: doc.components,
|
|
1164
|
+
...doc.meta ? { meta: doc.meta } : {},
|
|
1165
|
+
...doc.data ? { data: doc.data } : {},
|
|
1166
|
+
...doc.assets ? { assets: doc.assets } : {},
|
|
1167
|
+
...doc.converters ? { converters: doc.converters } : {},
|
|
1168
|
+
name: name.replaceAll(":", "-"),
|
|
1169
|
+
...definition,
|
|
1170
|
+
...typeof definition.data === "string" ? { data: { ...doc.data, model: definition.data } } : {}
|
|
1171
|
+
});
|
|
1172
|
+
if (!selected.model) {
|
|
1173
|
+
report(f, selected.diagnostics, io);
|
|
1174
|
+
return 1;
|
|
1175
|
+
}
|
|
1176
|
+
model = selected.model;
|
|
1177
|
+
}
|
|
1178
|
+
try {
|
|
1179
|
+
embedAssets(model.doc, f, true);
|
|
1180
|
+
await imageDimensions(model.doc);
|
|
1181
|
+
} catch {
|
|
1182
|
+
const d = [
|
|
1183
|
+
{
|
|
1184
|
+
code: "asset-load",
|
|
1185
|
+
severity: "error",
|
|
1186
|
+
pointer: "/assets",
|
|
1187
|
+
message: "cannot read or decode image asset",
|
|
1188
|
+
hint: "check the source relative to the document"
|
|
1189
|
+
}
|
|
1190
|
+
];
|
|
1191
|
+
if (json) io.out(JSON.stringify({ file: f, ok: false, diagnostics: d }));
|
|
1192
|
+
else report(f, d, io);
|
|
1193
|
+
return 1;
|
|
1194
|
+
}
|
|
1195
|
+
const over = {};
|
|
1196
|
+
for (const c of o.color ?? []) {
|
|
1197
|
+
const [k, v] = c.split("=");
|
|
1198
|
+
if (!k || !v) throw new Usage("--color takes slot=value");
|
|
1199
|
+
over[k] = v;
|
|
1200
|
+
}
|
|
1201
|
+
const base = o.dark ? DARK : LIGHT;
|
|
1202
|
+
const look = {
|
|
1203
|
+
paint: staticSlots(over),
|
|
1204
|
+
color: o.current ?? base.color,
|
|
1205
|
+
background: o.background ?? base.background
|
|
1206
|
+
};
|
|
1207
|
+
const size = o.size ? Number(o.size) : compare ? 256 : 240;
|
|
1208
|
+
if (!Number.isInteger(size) || size < 1) throw new Usage("--size takes a positive integer");
|
|
1209
|
+
const tolerance = o.tolerance === void 0 ? 0 : Number(o.tolerance);
|
|
1210
|
+
if (!Number.isInteger(tolerance) || tolerance < 0 || tolerance > 255)
|
|
1211
|
+
throw new Usage("--tolerance must be an integer from 0 to 255");
|
|
1212
|
+
const fit = String(o.fit ?? "contain");
|
|
1213
|
+
if (!["contain", "cover", "fill", "none"].includes(fit))
|
|
1214
|
+
throw new Usage("--fit takes contain|cover|fill|none");
|
|
1215
|
+
if (o.viewport && !/^[1-9]\d*x[1-9]\d*$/.test(String(o.viewport)))
|
|
1216
|
+
throw new Usage("--viewport takes WxH positive integers");
|
|
1217
|
+
const [width, height] = o.viewport ? String(o.viewport).split("x").map(Number) : [size, size];
|
|
1218
|
+
const scale = Number(o.scale ?? 1);
|
|
1219
|
+
if (!Number.isFinite(scale) || scale <= 0 || scale > 1)
|
|
1220
|
+
throw new Usage("--scale takes a number in (0,1]");
|
|
1221
|
+
if (o.sheet && (o.viewport || o.scale || o.fit))
|
|
1222
|
+
throw new Usage("viewport, scale and fit require a single frame");
|
|
1223
|
+
if (o.at !== void 0 && (!Number.isFinite(Number(o.at)) || Number(o.at) < 0))
|
|
1224
|
+
throw new Usage("--at takes nonnegative seconds");
|
|
1225
|
+
const script = scriptText(o.script, o.eval) ?? "";
|
|
1226
|
+
const audioEvents = [];
|
|
1227
|
+
const session2 = createScriptSession(model, {
|
|
1228
|
+
...scriptOptions(o),
|
|
1229
|
+
onEvents: (events) => audioEvents.push(...events)
|
|
1230
|
+
});
|
|
1231
|
+
const ran = session2.execute(script);
|
|
1232
|
+
session2.finish();
|
|
1233
|
+
for (const d of ran.diagnostics) io.err(JSON.stringify(d));
|
|
1234
|
+
if (ran.diagnostics.length) return 1;
|
|
1235
|
+
session2.execute("advance 0");
|
|
1236
|
+
if (o.at) session2.execute("advance " + Number(o.at));
|
|
1237
|
+
const player = session2.player;
|
|
1238
|
+
if (compare) {
|
|
1239
|
+
if (o.sheet || o.frames !== void 0 || o.probe || o.audio || o.viewport || o.scale || o.fit || out && !out.endsWith(".png"))
|
|
1240
|
+
throw new Usage("--compare takes a single frame and optional -o diff.png");
|
|
1241
|
+
const result = o["browser-text"] ? comparePNG(
|
|
1242
|
+
await rasterize(drawFrame(player, { paint: look.paint, color: "#000" }, size)),
|
|
1243
|
+
toPNG(comparisonSVG(readFileSync(compare, "utf8"), size), size),
|
|
1244
|
+
tolerance,
|
|
1245
|
+
!!out
|
|
1246
|
+
) : compareSVG(
|
|
1247
|
+
drawFrame(player, { paint: look.paint, color: "#000" }, size),
|
|
1248
|
+
readFileSync(compare, "utf8"),
|
|
1249
|
+
size,
|
|
1250
|
+
tolerance,
|
|
1251
|
+
!!out
|
|
1252
|
+
);
|
|
1253
|
+
if (out) writeFileSync(out, result.diff);
|
|
1254
|
+
const { diff, ...metrics } = result;
|
|
1255
|
+
void diff;
|
|
1256
|
+
const report2 = { ...metrics, size, tolerance, ...out ? { wrote: out } : {} };
|
|
1257
|
+
if (json) io.out(JSON.stringify(report2));
|
|
1258
|
+
else
|
|
1259
|
+
io.out(
|
|
1260
|
+
`${metrics.pass ? "PASS" : "FAIL"}: ${metrics.differingPixels} differing pixels, max channel difference ${metrics.maxChannelDifference}; ${metrics.pixelsBeyondTolerance} pixels beyond tolerance ${tolerance}${out ? `; wrote ${out}` : ""}`
|
|
1261
|
+
);
|
|
1262
|
+
return metrics.pass ? 0 : 1;
|
|
1263
|
+
}
|
|
1264
|
+
if (o.frames !== void 0 || out?.endsWith(".webm")) {
|
|
1265
|
+
const n = Number(o.frames ?? 60), fps = Number(o.fps ?? 60);
|
|
1266
|
+
if (!Number.isInteger(n) || n < 1 || n > 1e4 || !Number.isFinite(fps) || fps <= 0 || fps > 240 || o.sheet || compare || !out)
|
|
1267
|
+
throw new Usage(
|
|
1268
|
+
"sequences need --frames 1..10000, --fps (0,240], -o file.png|file.webm; no sheet or compare"
|
|
1269
|
+
);
|
|
1270
|
+
if (!/\.(png|webm)$/.test(out)) throw new Usage("sequences output PNG or WebM");
|
|
1271
|
+
const images = [];
|
|
1272
|
+
const wrote = [];
|
|
1273
|
+
for (let i = 0; i < n; i++) {
|
|
1274
|
+
if (i) session2.execute("advance " + 1 / fps);
|
|
1275
|
+
const svg2 = viewportSVG(
|
|
1276
|
+
drawFrame(player, look, size),
|
|
1277
|
+
width,
|
|
1278
|
+
height,
|
|
1279
|
+
fit,
|
|
1280
|
+
scale,
|
|
1281
|
+
look.background
|
|
1282
|
+
);
|
|
1283
|
+
const png2 = await rasterize(svg2);
|
|
1284
|
+
if (out.endsWith(".webm")) images.push(png2);
|
|
1285
|
+
else {
|
|
1286
|
+
const path = out.replace(/\.png$/, "-" + String(i).padStart(4, "0") + ".png");
|
|
1287
|
+
writeFileSync(path, png2);
|
|
1288
|
+
wrote.push(path);
|
|
1289
|
+
}
|
|
1290
|
+
}
|
|
1291
|
+
if (out.endsWith(".webm")) {
|
|
1292
|
+
const { encodeVideo } = await import("./video.js");
|
|
1293
|
+
writeFileSync(out, await encodeVideo(images, fps));
|
|
1294
|
+
wrote.push(out);
|
|
1295
|
+
}
|
|
1296
|
+
if (o.audio) {
|
|
1297
|
+
writeFileSync(String(o.audio), await mixAudio(model, audioEvents, player.time, f));
|
|
1298
|
+
wrote.push(String(o.audio));
|
|
1299
|
+
}
|
|
1300
|
+
io.out(json ? JSON.stringify({ wrote, frames: n, fps }) : "wrote " + wrote.join(", "));
|
|
1301
|
+
return 0;
|
|
1302
|
+
}
|
|
1303
|
+
let svg;
|
|
1304
|
+
if (o.sheet) {
|
|
1305
|
+
const n = Number(o.sheet);
|
|
1306
|
+
if (!Number.isInteger(n) || n < 2) throw new Usage("--sheet takes a frame count \u2265 2");
|
|
1307
|
+
let span = o.over ? Number(o.over) : 0;
|
|
1308
|
+
if (!span) {
|
|
1309
|
+
const probe = runScript(model, script, scriptOptions(o)).player;
|
|
1310
|
+
probe.step(0);
|
|
1311
|
+
if (o.at) probe.step(Number(o.at));
|
|
1312
|
+
while (span < 10) {
|
|
1313
|
+
span += 1 / 60;
|
|
1314
|
+
if (probe.step(1 / 60).settled) break;
|
|
1315
|
+
}
|
|
1316
|
+
span = Math.max(span, 0.5) + 1e-6;
|
|
1317
|
+
}
|
|
1318
|
+
const frames = [];
|
|
1319
|
+
const t0 = player.time;
|
|
1320
|
+
for (let k = 0; k < n; k++) {
|
|
1321
|
+
if (k) player.step(span / (n - 1));
|
|
1322
|
+
frames.push([
|
|
1323
|
+
`t=${(player.time - t0).toFixed(3)}s`,
|
|
1324
|
+
drawFrame(player, look, void 0, `f${k}`)
|
|
1325
|
+
]);
|
|
1326
|
+
}
|
|
1327
|
+
svg = sheetSVG(frames, look, size >= 240 ? 160 : size);
|
|
1328
|
+
} else svg = drawFrame(player, look, size);
|
|
1329
|
+
if (!o.sheet) svg = viewportSVG(svg, width, height, fit, scale, look.background);
|
|
1330
|
+
const png = out?.endsWith(".png") || o.probe ? await rasterize(svg) : void 0;
|
|
1331
|
+
let probes;
|
|
1332
|
+
if (o.probe) {
|
|
1333
|
+
try {
|
|
1334
|
+
probes = probePNG(png, String(o.probe));
|
|
1335
|
+
} catch (e) {
|
|
1336
|
+
throw new Usage(e.message);
|
|
1337
|
+
}
|
|
1338
|
+
}
|
|
1339
|
+
if (o.audio) writeFileSync(String(o.audio), await mixAudio(model, audioEvents, player.time, f));
|
|
1340
|
+
if (out) writeFileSync(out, out.endsWith(".png") ? png : svg);
|
|
1341
|
+
if (o.probe) {
|
|
1342
|
+
io.out(JSON.stringify({ wrote: out, time: player.time, probes }));
|
|
1343
|
+
return 0;
|
|
1344
|
+
}
|
|
1345
|
+
if (json) io.out(JSON.stringify({ wrote: out, time: player.time, states: player.states() }));
|
|
1346
|
+
else io.out(`wrote ${out ?? o.audio}`);
|
|
1347
|
+
return 0;
|
|
1348
|
+
}
|
|
1349
|
+
function scaffold(rest, o, json, io) {
|
|
1350
|
+
const name = rest[0];
|
|
1351
|
+
if (!name) throw new Usage("new needs a <name>");
|
|
1352
|
+
if (!/^[a-z0-9]+(-[a-z0-9]+)*$/.test(name) || /-\d+$/.test(name))
|
|
1353
|
+
throw new Usage(`"${name}" must be kebab-case and not end in -<digits>`);
|
|
1354
|
+
if (!!o.glyph === !!o.glyphy)
|
|
1355
|
+
throw new Usage("new needs exactly one of --glyph <file.svg> or --glyphy <project-dir>");
|
|
1356
|
+
const g = o.glyph ? readGlyphSVG(o.glyph) : readGlyphy(o.glyphy, name);
|
|
1357
|
+
const doc = newDoc(name, g);
|
|
1358
|
+
const out = o.out ?? `${name}.${o.ani ? "ani" : "animl"}`;
|
|
1359
|
+
if (existsSync(out) && !o.force) {
|
|
1360
|
+
io.err(`${out} exists (use --force to overwrite)`);
|
|
1361
|
+
return 1;
|
|
1362
|
+
}
|
|
1363
|
+
const text = o.ani || out.endsWith(".ani") ? format(doc) : decompile(doc);
|
|
1364
|
+
if (out.endsWith(".animl") && !o.ani) {
|
|
1365
|
+
const c = compile(text, { file: out });
|
|
1366
|
+
if (c.diagnostics.length) {
|
|
1367
|
+
if (json) io.out(JSON.stringify({ file: out, ok: false, diagnostics: c.diagnostics }));
|
|
1368
|
+
else report(out, c.diagnostics, io);
|
|
1369
|
+
return 1;
|
|
1370
|
+
}
|
|
1371
|
+
}
|
|
1372
|
+
writeFileSync(out, text);
|
|
1373
|
+
if (json)
|
|
1374
|
+
io.out(
|
|
1375
|
+
JSON.stringify({
|
|
1376
|
+
wrote: out,
|
|
1377
|
+
glyph: o.glyph ? nameFromFile(o.glyph) : name,
|
|
1378
|
+
subpaths: (g.d.match(/[Mm]/g) ?? []).length
|
|
1379
|
+
})
|
|
1380
|
+
);
|
|
1381
|
+
else
|
|
1382
|
+
io.out(
|
|
1383
|
+
`wrote ${out} (${(g.d.match(/[Mm]/g) ?? []).length} subpaths; see them with: anima inspect ${out})`
|
|
1384
|
+
);
|
|
1385
|
+
return 0;
|
|
1386
|
+
}
|
|
1387
|
+
async function build(f, out, json, io, embed = false) {
|
|
1388
|
+
const source = f.endsWith(".animl") ? projectSource(f) : readFileSync(f, "utf8");
|
|
1389
|
+
let text;
|
|
1390
|
+
let diagnostics;
|
|
1391
|
+
let sourceMap;
|
|
1392
|
+
if (/\.html?$/i.test(f)) ({ text, diagnostics } = buildHTML(source, f));
|
|
1393
|
+
else if (f.endsWith(".animl"))
|
|
1394
|
+
({
|
|
1395
|
+
text,
|
|
1396
|
+
diagnostics,
|
|
1397
|
+
map: sourceMap
|
|
1398
|
+
} = compile(source, {
|
|
1399
|
+
file: f,
|
|
1400
|
+
resolve: (path) => substituteConstants(readFileSync(path, "utf8"), findProject()?.constants)
|
|
1401
|
+
}));
|
|
1402
|
+
else throw new Usage("build needs a .animl or .html file");
|
|
1403
|
+
if (text !== void 0) {
|
|
1404
|
+
const docs2 = [];
|
|
1405
|
+
const maps = [];
|
|
1406
|
+
if (/\.html?$/i.test(f))
|
|
1407
|
+
buildHTML(source, f, (doc, map) => {
|
|
1408
|
+
docs2.push(doc);
|
|
1409
|
+
maps.push(map);
|
|
1410
|
+
});
|
|
1411
|
+
else {
|
|
1412
|
+
docs2.push(JSON.parse(text));
|
|
1413
|
+
maps.push(sourceMap);
|
|
1414
|
+
}
|
|
1415
|
+
const encoder = new ImageEncoder();
|
|
1416
|
+
try {
|
|
1417
|
+
for (const [i, doc] of docs2.entries())
|
|
1418
|
+
diagnostics.push(
|
|
1419
|
+
...await buildAssets(
|
|
1420
|
+
doc,
|
|
1421
|
+
f,
|
|
1422
|
+
embed,
|
|
1423
|
+
encoder,
|
|
1424
|
+
(pointer) => maps[i]?.get(pointer)?.file ?? f
|
|
1425
|
+
)
|
|
1426
|
+
);
|
|
1427
|
+
} finally {
|
|
1428
|
+
await encoder.close();
|
|
1429
|
+
}
|
|
1430
|
+
if (diagnostics.some((d) => d.severity === "error")) text = void 0;
|
|
1431
|
+
else if (/\.html?$/i.test(f)) {
|
|
1432
|
+
let i = 0;
|
|
1433
|
+
({ text } = buildHTML(source, f, (doc) => Object.assign(doc, docs2[i++])));
|
|
1434
|
+
} else text = format(docs2[0]);
|
|
1435
|
+
}
|
|
1436
|
+
if (json && (text === void 0 || out))
|
|
1437
|
+
io.out(
|
|
1438
|
+
JSON.stringify({
|
|
1439
|
+
file: f,
|
|
1440
|
+
ok: text !== void 0,
|
|
1441
|
+
diagnostics,
|
|
1442
|
+
...text !== void 0 && out ? { wrote: out } : {}
|
|
1443
|
+
})
|
|
1444
|
+
);
|
|
1445
|
+
else if (json && diagnostics.length) io.err(JSON.stringify({ file: f, diagnostics }));
|
|
1446
|
+
else report(f, diagnostics, io);
|
|
1447
|
+
if (text === void 0) return 1;
|
|
1448
|
+
if (out) writeFileSync(out, text);
|
|
1449
|
+
else if (io.write) io.write(text);
|
|
1450
|
+
else io.out(text);
|
|
1451
|
+
return 0;
|
|
1452
|
+
}
|
|
1453
|
+
function sampleProject(rest, o, json, io) {
|
|
1454
|
+
const sample = String(o.sample), target = o.out ?? rest[0];
|
|
1455
|
+
if (!["bell", "moon", "progress"].includes(sample))
|
|
1456
|
+
throw new Usage("--sample takes bell|moon|progress");
|
|
1457
|
+
if (!target) throw new Usage("new --sample needs a destination directory");
|
|
1458
|
+
if (existsSync(target)) {
|
|
1459
|
+
io.err("sample destination already exists; choose a new directory");
|
|
1460
|
+
return 1;
|
|
1461
|
+
}
|
|
1462
|
+
mkdirSync(target, { recursive: true });
|
|
1463
|
+
cpSync(new URL(`examples/${sample}.animl`, ROOT), resolve(target, "main.animl"));
|
|
1464
|
+
cpSync(new URL("examples/lib", ROOT), resolve(target, "lib"), { recursive: true });
|
|
1465
|
+
writeFileSync(
|
|
1466
|
+
resolve(target, "anima.json"),
|
|
1467
|
+
JSON.stringify(
|
|
1468
|
+
{ entry: "main.animl", out: "dist", presets: { preview: { size: 240 } } },
|
|
1469
|
+
null,
|
|
1470
|
+
2
|
|
1471
|
+
) + "\n"
|
|
1472
|
+
);
|
|
1473
|
+
writeFileSync(
|
|
1474
|
+
resolve(target, "AGENTS.md"),
|
|
1475
|
+
"# Animation project\n\nRun `anima validate`, `anima render --preset preview -o preview.png`, and `anima build`.\nEdit main.animl; anima.json defines project defaults.\n"
|
|
1476
|
+
);
|
|
1477
|
+
if (json) io.out(JSON.stringify({ wrote: target, sample }));
|
|
1478
|
+
else io.out(`created ${target}`);
|
|
1479
|
+
return 0;
|
|
1480
|
+
}
|
|
1481
|
+
async function exportProject(file2, dir, json, io) {
|
|
1482
|
+
const checked = loaded(file2, io, json);
|
|
1483
|
+
if (!checked.model) return 1;
|
|
1484
|
+
let doc = structuredClone(checked.model.doc);
|
|
1485
|
+
if (file2.endsWith(".animl")) {
|
|
1486
|
+
let compiled = "";
|
|
1487
|
+
const result = await build(
|
|
1488
|
+
file2,
|
|
1489
|
+
void 0,
|
|
1490
|
+
false,
|
|
1491
|
+
{
|
|
1492
|
+
out: (s) => {
|
|
1493
|
+
compiled += s;
|
|
1494
|
+
},
|
|
1495
|
+
write: (s) => {
|
|
1496
|
+
compiled += s;
|
|
1497
|
+
},
|
|
1498
|
+
err: (s) => io.err(s)
|
|
1499
|
+
},
|
|
1500
|
+
true
|
|
1501
|
+
);
|
|
1502
|
+
if (result) return result;
|
|
1503
|
+
doc = JSON.parse(compiled);
|
|
1504
|
+
} else embedAssets(doc, file2);
|
|
1505
|
+
const { build: bundleRuntime } = await import("esbuild");
|
|
1506
|
+
const localRuntime = new URL("../../web/src/all-modules.ts", import.meta.url);
|
|
1507
|
+
const runtimeEntry = existsSync(localRuntime) ? localRuntime.pathname : new URL(import.meta.resolve("animl/internal/packages/web/src/all-modules.js")).pathname;
|
|
1508
|
+
const runtime = await bundleRuntime({
|
|
1509
|
+
entryPoints: [runtimeEntry],
|
|
1510
|
+
bundle: true,
|
|
1511
|
+
format: "esm",
|
|
1512
|
+
target: "es2022",
|
|
1513
|
+
write: false,
|
|
1514
|
+
minify: true
|
|
1515
|
+
});
|
|
1516
|
+
mkdirSync(dir, { recursive: true });
|
|
1517
|
+
const name = basename(file2).replace(/\.(animl|ani)$/, "") + ".ani";
|
|
1518
|
+
writeFileSync(resolve(dir, name), format(doc));
|
|
1519
|
+
writeFileSync(resolve(dir, "anima.js"), runtime.outputFiles[0].text);
|
|
1520
|
+
writeFileSync(
|
|
1521
|
+
resolve(dir, "index.html"),
|
|
1522
|
+
`<!doctype html>
|
|
1523
|
+
<html lang="en"><meta charset="utf-8"><title>Anima export</title><script type="module" src="./anima.js"><\/script><anima-icon style="width:240px;height:240px"><script type="application/vnd.anima+json">${format(doc).replaceAll("<", "\\u003c")}<\/script></anima-icon></html>
|
|
1524
|
+
`
|
|
1525
|
+
);
|
|
1526
|
+
if (json) io.out(JSON.stringify({ wrote: dir, files: [name, "anima.js", "index.html"] }));
|
|
1527
|
+
else io.out("wrote " + dir);
|
|
1528
|
+
return 0;
|
|
1529
|
+
}
|
|
1530
|
+
export {
|
|
1531
|
+
run
|
|
1532
|
+
};
|