@motionscript/core 0.1.0-alpha.3 → 0.1.0-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +247 -0
- package/LICENSE +201 -201
- package/NOTICE +48 -0
- package/README.md +93 -72
- package/dist/assets/asset-index.js.map +1 -1
- package/dist/assets/catalog.d.ts +9 -0
- package/dist/assets/catalog.d.ts.map +1 -1
- package/dist/assets/catalog.js +11 -0
- package/dist/assets/catalog.js.map +1 -1
- package/dist/assets/errors.d.ts.map +1 -1
- package/dist/assets/errors.js +8 -3
- package/dist/assets/errors.js.map +1 -1
- package/dist/assets/index.js.map +1 -1
- package/dist/assets/manager.d.ts +26 -1
- package/dist/assets/manager.d.ts.map +1 -1
- package/dist/assets/manager.js +79 -4
- package/dist/assets/manager.js.map +1 -1
- package/dist/assets/manifest.js.map +1 -1
- package/dist/assets/record.js.map +1 -1
- package/dist/assets/scope.d.ts +3 -3
- package/dist/assets/scope.d.ts.map +1 -1
- package/dist/assets/scope.js.map +1 -1
- package/dist/attributes/audio/filters/chain.d.ts +1 -1
- package/dist/attributes/audio/filters/chain.js.map +1 -1
- package/dist/attributes/audio/filters/curve.d.ts +8 -8
- package/dist/attributes/audio/filters/curve.d.ts.map +1 -1
- package/dist/attributes/audio/filters/curve.js +20 -19
- package/dist/attributes/audio/filters/curve.js.map +1 -1
- package/dist/attributes/audio/filters/implementations/echo.js.map +1 -1
- package/dist/attributes/audio/filters/implementations/gain.js.map +1 -1
- package/dist/attributes/audio/filters/implementations/highpass.js.map +1 -1
- package/dist/attributes/audio/filters/implementations/lowpass.js.map +1 -1
- package/dist/attributes/audio/filters/implementations/speed.d.ts +2 -2
- package/dist/attributes/audio/filters/implementations/speed.js.map +1 -1
- package/dist/attributes/audio/filters/implementations/tremolo.js.map +1 -1
- package/dist/attributes/audio/filters/index.d.ts +1 -1
- package/dist/attributes/audio/filters/index.d.ts.map +1 -1
- package/dist/attributes/audio/filters/index.js +1 -1
- package/dist/attributes/audio/filters/index.js.map +1 -1
- package/dist/attributes/audio/filters/registry.js.map +1 -1
- package/dist/attributes/audio/filters/union.js.map +1 -1
- package/dist/attributes/audio/request.d.ts +17 -2
- package/dist/attributes/audio/request.d.ts.map +1 -1
- package/dist/attributes/audio/request.js.map +1 -1
- package/dist/attributes/audio/schedule.d.ts +4 -2
- package/dist/attributes/audio/schedule.d.ts.map +1 -1
- package/dist/attributes/audio/schedule.js +15 -8
- package/dist/attributes/audio/schedule.js.map +1 -1
- package/dist/attributes/audio/sound.d.ts +4 -2
- package/dist/attributes/audio/sound.d.ts.map +1 -1
- package/dist/attributes/audio/sound.js +8 -4
- package/dist/attributes/audio/sound.js.map +1 -1
- package/dist/attributes/index.js.map +1 -1
- package/dist/attributes/layout/alignment.js +1 -1
- package/dist/attributes/layout/alignment.js.map +1 -1
- package/dist/attributes/layout/index.js.map +1 -1
- package/dist/attributes/layout/insets.js.map +1 -1
- package/dist/attributes/layout/matrix2d.js.map +1 -1
- package/dist/attributes/layout/size.js.map +1 -1
- package/dist/attributes/layout/transform3d.js.map +1 -1
- package/dist/attributes/layout/vector2.js.map +1 -1
- package/dist/attributes/layout/world-transform.js.map +1 -1
- package/dist/attributes/mask/boolean.js.map +1 -1
- package/dist/attributes/mask/mask.js.map +1 -1
- package/dist/attributes/properties/decorator.d.ts +3 -1
- package/dist/attributes/properties/decorator.d.ts.map +1 -1
- package/dist/attributes/properties/decorator.js.map +1 -1
- package/dist/attributes/properties/inputs.js.map +1 -1
- package/dist/attributes/properties/typed.d.ts +9 -2
- package/dist/attributes/properties/typed.d.ts.map +1 -1
- package/dist/attributes/properties/typed.js +15 -1
- package/dist/attributes/properties/typed.js.map +1 -1
- package/dist/attributes/render3d/orbit.d.ts +8 -8
- package/dist/attributes/render3d/orbit.js +7 -7
- package/dist/attributes/render3d/orbit.js.map +1 -1
- package/dist/attributes/shape/corners/corner-radius.js.map +1 -1
- package/dist/attributes/shape/corners/corner-style.js.map +1 -1
- package/dist/attributes/shape/corners/corners.js.map +1 -1
- package/dist/attributes/shape/corners/index.js.map +1 -1
- package/dist/attributes/shape/effects/backdrop.d.ts +4 -4
- package/dist/attributes/shape/effects/backdrop.d.ts.map +1 -1
- package/dist/attributes/shape/effects/backdrop.js.map +1 -1
- package/dist/attributes/shape/effects/chain.d.ts +28 -120
- package/dist/attributes/shape/effects/chain.d.ts.map +1 -1
- package/dist/attributes/shape/effects/chain.js +16 -88
- package/dist/attributes/shape/effects/chain.js.map +1 -1
- package/dist/attributes/shape/effects/effect-data.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/ascii.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/bit-crush.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/block-displace.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/bloom.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/blur.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/bulge.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/chromatic-aberration.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/color-adjustment.d.ts +2 -2
- package/dist/attributes/shape/effects/implementations/color-adjustment.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/curves.d.ts +1 -1
- package/dist/attributes/shape/effects/implementations/curves.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/directional-blur.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/dither.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/drop-shadow.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/duotone.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/edges.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/glass.d.ts +15 -24
- package/dist/attributes/shape/effects/implementations/glass.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/glass.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/glow.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/grain.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/grayscale.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/halftone.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/invert.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/kaleidoscope.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/lut.d.ts +1 -1
- package/dist/attributes/shape/effects/implementations/lut.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/magnify.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/motion-blur.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/oil-paint.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/outline.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/pixelate.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/posterize.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/progressive-blur.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/radial-blur.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/rgb-shift.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/scanlines.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/scatter.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/shader.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/shader.js +15 -8
- package/dist/attributes/shape/effects/implementations/shader.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/sharpen.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/streak.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/threshold.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/twirl.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/vignette.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/vintage.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/wave.js.map +1 -1
- package/dist/attributes/shape/effects/index.d.ts +2 -6
- package/dist/attributes/shape/effects/index.d.ts.map +1 -1
- package/dist/attributes/shape/effects/index.js.map +1 -1
- package/dist/attributes/shape/effects/registry.d.ts +23 -6
- package/dist/attributes/shape/effects/registry.d.ts.map +1 -1
- package/dist/attributes/shape/effects/registry.js +44 -10
- package/dist/attributes/shape/effects/registry.js.map +1 -1
- package/dist/attributes/shape/effects/union.d.ts +2 -6
- package/dist/attributes/shape/effects/union.d.ts.map +1 -1
- package/dist/attributes/shape/effects/union.js.map +1 -1
- package/dist/attributes/shape/fill/blend.js.map +1 -1
- package/dist/attributes/shape/fill/chain.js.map +1 -1
- package/dist/attributes/shape/fill/coerce.js.map +1 -1
- package/dist/attributes/shape/fill/color/constants.js.map +1 -1
- package/dist/attributes/shape/fill/color/parser.d.ts.map +1 -1
- package/dist/attributes/shape/fill/color/parser.js +81 -44
- package/dist/attributes/shape/fill/color/parser.js.map +1 -1
- package/dist/attributes/shape/fill/gradient-stops.d.ts +16 -0
- package/dist/attributes/shape/fill/gradient-stops.d.ts.map +1 -0
- package/dist/attributes/shape/fill/gradient-stops.js +65 -0
- package/dist/attributes/shape/fill/gradient-stops.js.map +1 -0
- package/dist/attributes/shape/fill/implementations/canvas3d.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/color.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/conic-gradient.d.ts.map +1 -1
- package/dist/attributes/shape/fill/implementations/conic-gradient.js +2 -5
- package/dist/attributes/shape/fill/implementations/conic-gradient.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/dot-grid.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/fractal-noise.d.ts.map +1 -1
- package/dist/attributes/shape/fill/implementations/fractal-noise.js +2 -10
- package/dist/attributes/shape/fill/implementations/fractal-noise.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/grid.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/image.d.ts.map +1 -1
- package/dist/attributes/shape/fill/implementations/image.js +5 -4
- package/dist/attributes/shape/fill/implementations/image.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/linear-gradient.d.ts.map +1 -1
- package/dist/attributes/shape/fill/implementations/linear-gradient.js +2 -6
- package/dist/attributes/shape/fill/implementations/linear-gradient.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/noise.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/radial-gradient.d.ts.map +1 -1
- package/dist/attributes/shape/fill/implementations/radial-gradient.js +2 -5
- package/dist/attributes/shape/fill/implementations/radial-gradient.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/shader.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/stripe.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/video.js +1 -1
- package/dist/attributes/shape/fill/implementations/video.js.map +1 -1
- package/dist/attributes/shape/fill/index.js.map +1 -1
- package/dist/attributes/shape/fill/lerp.js.map +1 -1
- package/dist/attributes/shape/fill/media-preset.js.map +1 -1
- package/dist/attributes/shape/fill/registry.js.map +1 -1
- package/dist/attributes/shape/fill/union.js.map +1 -1
- package/dist/attributes/shape/filters/chain.d.ts +4 -10
- package/dist/attributes/shape/filters/chain.d.ts.map +1 -1
- package/dist/attributes/shape/filters/chain.js +1 -13
- package/dist/attributes/shape/filters/chain.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/alpha.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/blur.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/color-adjustment.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/color-matrix.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/curves.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/echo.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/exposure.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/grayscale.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/posterize-time.js.map +1 -1
- package/dist/attributes/shape/filters/index.d.ts +1 -1
- package/dist/attributes/shape/filters/index.js.map +1 -1
- package/dist/attributes/shape/filters/registry.d.ts +2 -2
- package/dist/attributes/shape/filters/registry.js +3 -3
- package/dist/attributes/shape/filters/registry.js.map +1 -1
- package/dist/attributes/shape/filters/union.d.ts +6 -7
- package/dist/attributes/shape/filters/union.d.ts.map +1 -1
- package/dist/attributes/shape/filters/union.js.map +1 -1
- package/dist/attributes/shape/path/anchors.d.ts.map +1 -1
- package/dist/attributes/shape/path/anchors.js +12 -5
- package/dist/attributes/shape/path/anchors.js.map +1 -1
- package/dist/attributes/shape/path/bezier.js.map +1 -1
- package/dist/attributes/shape/path/index.js.map +1 -1
- package/dist/attributes/shape/path/measure.js.map +1 -1
- package/dist/attributes/shape/path/morph.d.ts.map +1 -1
- package/dist/attributes/shape/path/morph.js +16 -4
- package/dist/attributes/shape/path/morph.js.map +1 -1
- package/dist/attributes/shape/path/ops.js.map +1 -1
- package/dist/attributes/shape/path/types.js.map +1 -1
- package/dist/attributes/shape/path/walk.js.map +1 -1
- package/dist/attributes/shape/shaders/index.js.map +1 -1
- package/dist/attributes/shape/shaders/pack.js.map +1 -1
- package/dist/attributes/shape/shaders/resolve.js.map +1 -1
- package/dist/attributes/shape/shadow/index.js.map +1 -1
- package/dist/attributes/shape/shadow/shadow.js.map +1 -1
- package/dist/attributes/shape/stroke/index.d.ts +2 -2
- package/dist/attributes/shape/stroke/index.d.ts.map +1 -1
- package/dist/attributes/shape/stroke/index.js +1 -1
- package/dist/attributes/shape/stroke/index.js.map +1 -1
- package/dist/attributes/shape/stroke/stroke.d.ts +27 -6
- package/dist/attributes/shape/stroke/stroke.d.ts.map +1 -1
- package/dist/attributes/shape/stroke/stroke.js +22 -2
- package/dist/attributes/shape/stroke/stroke.js.map +1 -1
- package/dist/attributes/shared/operators.js.map +1 -1
- package/dist/attributes/text/index.js.map +1 -1
- package/dist/attributes/text/ops.d.ts +6 -0
- package/dist/attributes/text/ops.d.ts.map +1 -1
- package/dist/attributes/text/ops.js +1 -0
- package/dist/attributes/text/ops.js.map +1 -1
- package/dist/attributes/text/types.js.map +1 -1
- package/dist/browser/chunks/chunk-2RIYH36X.js +3 -0
- package/dist/browser/chunks/chunk-2RIYH36X.js.map +7 -0
- package/dist/browser/chunks/chunk-DDJN3QII.js +15 -0
- package/dist/browser/chunks/chunk-DDJN3QII.js.map +7 -0
- package/dist/browser/chunks/chunk-DHB4COFY.js +2 -0
- package/dist/browser/chunks/chunk-DHB4COFY.js.map +7 -0
- package/dist/browser/chunks/chunk-EJDPYDQI.js +5 -0
- package/dist/browser/chunks/chunk-EJDPYDQI.js.map +7 -0
- package/dist/browser/chunks/chunk-SFNJRPBV.js +2 -0
- package/dist/browser/chunks/chunk-SFNJRPBV.js.map +7 -0
- package/dist/browser/chunks/chunk-XAWE4EAK.js +2 -0
- package/dist/browser/chunks/chunk-XAWE4EAK.js.map +7 -0
- package/dist/browser/component.js +1 -1
- package/dist/browser/component.js.map +4 -4
- package/dist/browser/experimental.js +2 -0
- package/dist/browser/experimental.js.map +7 -0
- package/dist/browser/index.js +1 -1
- package/dist/browser/index.js.map +4 -4
- package/dist/browser/jsx-jsx-dev-runtime.js +1 -1
- package/dist/browser/jsx-jsx-runtime.js +1 -1
- package/dist/browser/manifest.json +4 -2
- package/dist/browser/sdk.js +1 -1
- package/dist/component/api.d.ts +508 -0
- package/dist/component/api.d.ts.map +1 -0
- package/dist/component/api.js +4 -0
- package/dist/component/api.js.map +1 -0
- package/dist/component/builtins/audio.d.ts +26 -0
- package/dist/component/builtins/audio.d.ts.map +1 -0
- package/dist/component/builtins/audio.js +41 -0
- package/dist/component/builtins/audio.js.map +1 -0
- package/dist/component/builtins/canvas3d.d.ts +98 -0
- package/dist/component/builtins/canvas3d.d.ts.map +1 -0
- package/dist/component/builtins/canvas3d.js +21 -0
- package/dist/component/builtins/canvas3d.js.map +1 -0
- package/dist/component/builtins/composite.d.ts +56 -0
- package/dist/component/builtins/composite.d.ts.map +1 -0
- package/dist/component/builtins/composite.js +25 -0
- package/dist/component/builtins/composite.js.map +1 -0
- package/dist/component/builtins/geometry.d.ts +505 -0
- package/dist/component/builtins/geometry.d.ts.map +1 -0
- package/dist/component/builtins/geometry.js +107 -0
- package/dist/component/builtins/geometry.js.map +1 -0
- package/dist/component/builtins/layout.d.ts +88 -0
- package/dist/component/builtins/layout.d.ts.map +1 -0
- package/dist/component/builtins/layout.js +84 -0
- package/dist/component/builtins/layout.js.map +1 -0
- package/dist/component/builtins/media.d.ts +95 -0
- package/dist/component/builtins/media.d.ts.map +1 -0
- package/dist/component/builtins/media.js +149 -0
- package/dist/component/builtins/media.js.map +1 -0
- package/dist/component/builtins/providers.d.ts +23 -0
- package/dist/component/builtins/providers.d.ts.map +1 -0
- package/dist/component/builtins/providers.js +30 -0
- package/dist/component/builtins/providers.js.map +1 -0
- package/dist/component/builtins/text.d.ts +193 -0
- package/dist/component/builtins/text.d.ts.map +1 -0
- package/dist/component/builtins/text.js +113 -0
- package/dist/component/builtins/text.js.map +1 -0
- package/dist/component/builtins/three.d.ts +1085 -0
- package/dist/component/builtins/three.d.ts.map +1 -0
- package/dist/component/builtins/three.js +265 -0
- package/dist/component/builtins/three.js.map +1 -0
- package/dist/component/clip-of.d.ts +5 -0
- package/dist/component/clip-of.d.ts.map +1 -0
- package/dist/component/clip-of.js +33 -0
- package/dist/component/clip-of.js.map +1 -0
- package/dist/component/commands-for.d.ts +19 -0
- package/dist/component/commands-for.d.ts.map +1 -0
- package/dist/component/commands-for.js +5 -0
- package/dist/component/commands-for.js.map +1 -0
- package/dist/component/component-audio.d.ts +9 -0
- package/dist/component/component-audio.d.ts.map +1 -0
- package/dist/component/component-audio.js +18 -0
- package/dist/component/component-audio.js.map +1 -0
- package/dist/component/component2d.d.ts +9 -0
- package/dist/component/component2d.d.ts.map +1 -0
- package/dist/component/component2d.js +239 -0
- package/dist/component/component2d.js.map +1 -0
- package/dist/component/component3d.d.ts +9 -0
- package/dist/component/component3d.d.ts.map +1 -0
- package/dist/component/component3d.js +99 -0
- package/dist/component/component3d.js.map +1 -0
- package/dist/component/factory.d.ts +63 -0
- package/dist/component/factory.d.ts.map +1 -0
- package/dist/component/factory.js +313 -0
- package/dist/component/factory.js.map +1 -0
- package/dist/component/modules/aim.d.ts +30 -0
- package/dist/component/modules/aim.d.ts.map +1 -0
- package/dist/component/modules/aim.js +39 -0
- package/dist/component/modules/aim.js.map +1 -0
- package/dist/component/modules/corners.d.ts +13 -0
- package/dist/component/modules/corners.d.ts.map +1 -0
- package/dist/component/modules/corners.js +12 -0
- package/dist/component/modules/corners.js.map +1 -0
- package/dist/component/modules/flow.d.ts +26 -0
- package/dist/component/modules/flow.d.ts.map +1 -0
- package/dist/component/modules/flow.js +55 -0
- package/dist/component/modules/flow.js.map +1 -0
- package/dist/component/modules/material.d.ts +40 -0
- package/dist/component/modules/material.d.ts.map +1 -0
- package/dist/component/modules/material.js +75 -0
- package/dist/component/modules/material.js.map +1 -0
- package/dist/component/modules/paint.d.ts +71 -0
- package/dist/component/modules/paint.d.ts.map +1 -0
- package/dist/component/modules/paint.js +106 -0
- package/dist/component/modules/paint.js.map +1 -0
- package/dist/component/modules/shapes.d.ts +31 -0
- package/dist/component/modules/shapes.d.ts.map +1 -0
- package/dist/component/modules/shapes.js +43 -0
- package/dist/component/modules/shapes.js.map +1 -0
- package/dist/component/modules/text-layout.d.ts +26 -0
- package/dist/component/modules/text-layout.d.ts.map +1 -0
- package/dist/component/modules/text-layout.js +57 -0
- package/dist/component/modules/text-layout.js.map +1 -0
- package/dist/component/modules/text-style.d.ts +48 -0
- package/dist/component/modules/text-style.d.ts.map +1 -0
- package/dist/component/modules/text-style.js +63 -0
- package/dist/component/modules/text-style.js.map +1 -0
- package/dist/component/modules/three-entries.d.ts +23 -0
- package/dist/component/modules/three-entries.d.ts.map +1 -0
- package/dist/component/modules/three-entries.js +41 -0
- package/dist/component/modules/three-entries.js.map +1 -0
- package/dist/component/modules/view3d.d.ts +55 -0
- package/dist/component/modules/view3d.d.ts.map +1 -0
- package/dist/component/modules/view3d.js +160 -0
- package/dist/component/modules/view3d.js.map +1 -0
- package/dist/component/timeline.d.ts +22 -0
- package/dist/component/timeline.d.ts.map +1 -0
- package/dist/component/timeline.js +128 -0
- package/dist/component/timeline.js.map +1 -0
- package/dist/component/type-def.d.ts +26 -0
- package/dist/component/type-def.d.ts.map +1 -0
- package/dist/component/type-def.js +16 -0
- package/dist/component/type-def.js.map +1 -0
- package/dist/component/types.d.ts +91 -0
- package/dist/component/types.d.ts.map +1 -0
- package/dist/component/types.js +88 -0
- package/dist/component/types.js.map +1 -0
- package/dist/component/views.d.ts +121 -0
- package/dist/component/views.d.ts.map +1 -0
- package/dist/component/views.js +413 -0
- package/dist/component/views.js.map +1 -0
- package/dist/component.d.ts +4 -5
- package/dist/component.d.ts.map +1 -1
- package/dist/component.js +3 -5
- package/dist/component.js.map +1 -1
- package/dist/document/audio.d.ts +10 -2
- package/dist/document/audio.d.ts.map +1 -1
- package/dist/document/audio.js +45 -4
- package/dist/document/audio.js.map +1 -1
- package/dist/document/builtins.d.ts.map +1 -1
- package/dist/document/builtins.js +15 -39
- package/dist/document/builtins.js.map +1 -1
- package/dist/document/command-traits.d.ts +1 -1
- package/dist/document/command-traits.js +16 -1
- package/dist/document/command-traits.js.map +1 -1
- package/dist/document/deny-globals.js.map +1 -1
- package/dist/document/diff.d.ts.map +1 -1
- package/dist/document/diff.js +3 -3
- package/dist/document/diff.js.map +1 -1
- package/dist/document/doc-index.d.ts +2 -2
- package/dist/document/doc-index.d.ts.map +1 -1
- package/dist/document/doc-index.js +3 -3
- package/dist/document/doc-index.js.map +1 -1
- package/dist/document/expression/compile.d.ts.map +1 -1
- package/dist/document/expression/compile.js +8 -5
- package/dist/document/expression/compile.js.map +1 -1
- package/dist/document/expression/index.js.map +1 -1
- package/dist/document/expression/ops.js +1 -1
- package/dist/document/expression/ops.js.map +1 -1
- package/dist/document/expression/parse.d.ts.map +1 -1
- package/dist/document/expression/parse.js +15 -6
- package/dist/document/expression/parse.js.map +1 -1
- package/dist/document/expression/refs.d.ts +1 -1
- package/dist/document/expression/refs.js +1 -1
- package/dist/document/expression/refs.js.map +1 -1
- package/dist/document/expression/types.js.map +1 -1
- package/dist/document/expression/walk.d.ts.map +1 -1
- package/dist/document/expression/walk.js +2 -1
- package/dist/document/expression/walk.js.map +1 -1
- package/dist/document/index.d.ts +2 -0
- package/dist/document/index.d.ts.map +1 -1
- package/dist/document/index.js +2 -0
- package/dist/document/index.js.map +1 -1
- package/dist/document/node-decorator.js.map +1 -1
- package/dist/document/node-descriptor.d.ts +25 -0
- package/dist/document/node-descriptor.d.ts.map +1 -1
- package/dist/document/node-descriptor.js.map +1 -1
- package/dist/document/placement.d.ts +70 -0
- package/dist/document/placement.d.ts.map +1 -0
- package/dist/document/placement.js +83 -0
- package/dist/document/placement.js.map +1 -0
- package/dist/document/project.d.ts +2 -2
- package/dist/document/project.d.ts.map +1 -1
- package/dist/document/project.js.map +1 -1
- package/dist/document/registry.d.ts +23 -11
- package/dist/document/registry.d.ts.map +1 -1
- package/dist/document/registry.js +46 -19
- package/dist/document/registry.js.map +1 -1
- package/dist/document/settled-index.d.ts +49 -0
- package/dist/document/settled-index.d.ts.map +1 -0
- package/dist/document/settled-index.js +247 -0
- package/dist/document/settled-index.js.map +1 -0
- package/dist/document/timeline-patch.js.map +1 -1
- package/dist/document/timeline.d.ts +100 -19
- package/dist/document/timeline.d.ts.map +1 -1
- package/dist/document/timeline.js +290 -42
- package/dist/document/timeline.js.map +1 -1
- package/dist/document/types.d.ts +12 -12
- package/dist/document/types.d.ts.map +1 -1
- package/dist/document/types.js +2 -2
- package/dist/document/types.js.map +1 -1
- package/dist/document/validate.d.ts +2 -2
- package/dist/document/validate.d.ts.map +1 -1
- package/dist/document/validate.js +37 -31
- package/dist/document/validate.js.map +1 -1
- package/dist/document/withdraw.d.ts +28 -0
- package/dist/document/withdraw.d.ts.map +1 -0
- package/dist/document/withdraw.js +61 -0
- package/dist/document/withdraw.js.map +1 -0
- package/dist/experimental.d.ts +22 -0
- package/dist/experimental.d.ts.map +1 -0
- package/dist/experimental.js +20 -0
- package/dist/experimental.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -1
- package/dist/jsx/jsx-dev-runtime.js.map +1 -1
- package/dist/jsx/jsx-runtime.d.ts +9 -1
- package/dist/jsx/jsx-runtime.d.ts.map +1 -1
- package/dist/jsx/jsx-runtime.js +13 -3
- package/dist/jsx/jsx-runtime.js.map +1 -1
- package/dist/layout/bounds.d.ts +0 -1
- package/dist/layout/bounds.d.ts.map +1 -1
- package/dist/layout/bounds.js.map +1 -1
- package/dist/layout/constraints.js.map +1 -1
- package/dist/layout/flex.d.ts +4 -2
- package/dist/layout/flex.d.ts.map +1 -1
- package/dist/layout/flex.js +27 -11
- package/dist/layout/flex.js.map +1 -1
- package/dist/layout/freeform.js.map +1 -1
- package/dist/layout/grid.js.map +1 -1
- package/dist/layout/index.js.map +1 -1
- package/dist/layout/item.js.map +1 -1
- package/dist/layout/ops.d.ts +6 -0
- package/dist/layout/ops.d.ts.map +1 -1
- package/dist/layout/ops.js +6 -0
- package/dist/layout/ops.js.map +1 -1
- package/dist/layout/types.js.map +1 -1
- package/dist/nodes/2d/node-lifecycle.js.map +1 -1
- package/dist/nodes/2d/node-motion.js.map +1 -1
- package/dist/nodes/2d/node-render.d.ts +3 -3
- package/dist/nodes/2d/node-render.d.ts.map +1 -1
- package/dist/nodes/2d/node-render.js.map +1 -1
- package/dist/nodes/2d/node-transform.js.map +1 -1
- package/dist/nodes/2d/node2d.d.ts +115 -3
- package/dist/nodes/2d/node2d.d.ts.map +1 -1
- package/dist/nodes/2d/node2d.js +180 -28
- package/dist/nodes/2d/node2d.js.map +1 -1
- package/dist/nodes/2d/paint-node.d.ts +27 -0
- package/dist/nodes/2d/paint-node.d.ts.map +1 -1
- package/dist/nodes/2d/paint-node.js +42 -0
- package/dist/nodes/2d/paint-node.js.map +1 -1
- package/dist/nodes/audio/audio-bus.js.map +1 -1
- package/dist/nodes/audio/index.d.ts +2 -2
- package/dist/nodes/audio/index.d.ts.map +1 -1
- package/dist/nodes/audio/index.js +0 -2
- package/dist/nodes/audio/index.js.map +1 -1
- package/dist/nodes/audio/node-audio.js.map +1 -1
- package/dist/nodes/audio/sound-node.d.ts +4 -3
- package/dist/nodes/audio/sound-node.d.ts.map +1 -1
- package/dist/nodes/audio/sound-node.js +4 -1
- package/dist/nodes/audio/sound-node.js.map +1 -1
- package/dist/nodes/geometry/bounds-shape-node.d.ts +4 -4
- package/dist/nodes/geometry/bounds-shape-node.js +2 -2
- package/dist/nodes/geometry/bounds-shape-node.js.map +1 -1
- package/dist/nodes/geometry/box-path-node.d.ts +3 -3
- package/dist/nodes/geometry/box-path-node.js +2 -2
- package/dist/nodes/geometry/box-path-node.js.map +1 -1
- package/dist/nodes/geometry/ellipse-node.js.map +1 -1
- package/dist/nodes/geometry/group-bounds.d.ts +2 -2
- package/dist/nodes/geometry/group-bounds.d.ts.map +1 -1
- package/dist/nodes/geometry/group-bounds.js +1 -2
- package/dist/nodes/geometry/group-bounds.js.map +1 -1
- package/dist/nodes/geometry/path-node.d.ts.map +1 -1
- package/dist/nodes/geometry/path-node.js +6 -0
- package/dist/nodes/geometry/path-node.js.map +1 -1
- package/dist/nodes/geometry/polygon-node.js.map +1 -1
- package/dist/nodes/geometry/polygram-node.js.map +1 -1
- package/dist/nodes/geometry/rect-node.js.map +1 -1
- package/dist/nodes/geometry/shape-node.js.map +1 -1
- package/dist/nodes/geometry/shape-outline.d.ts +2 -2
- package/dist/nodes/geometry/shape-outline.d.ts.map +1 -1
- package/dist/nodes/geometry/shape-outline.js +2 -13
- package/dist/nodes/geometry/shape-outline.js.map +1 -1
- package/dist/nodes/index.d.ts +40 -33
- package/dist/nodes/index.d.ts.map +1 -1
- package/dist/nodes/index.js +17 -36
- package/dist/nodes/index.js.map +1 -1
- package/dist/nodes/layout/camera-node.d.ts +9 -0
- package/dist/nodes/layout/camera-node.d.ts.map +1 -1
- package/dist/nodes/layout/camera-node.js +38 -3
- package/dist/nodes/layout/camera-node.js.map +1 -1
- package/dist/nodes/layout/orbit-camera-node.d.ts +1 -1
- package/dist/nodes/layout/orbit-camera-node.js +1 -1
- package/dist/nodes/layout/orbit-camera-node.js.map +1 -1
- package/dist/nodes/layout/rotated-box.js.map +1 -1
- package/dist/nodes/media/video-node.d.ts.map +1 -1
- package/dist/nodes/media/video-node.js +2 -0
- package/dist/nodes/media/video-node.js.map +1 -1
- package/dist/nodes/node/declare-paints.js.map +1 -1
- package/dist/nodes/node/node-editor-state.js.map +1 -1
- package/dist/nodes/node/node-reactive.js.map +1 -1
- package/dist/nodes/node/node-time.d.ts +3 -3
- package/dist/nodes/node/node-time.d.ts.map +1 -1
- package/dist/nodes/node/node-time.js +1 -1
- package/dist/nodes/node/node-time.js.map +1 -1
- package/dist/nodes/node/node-walk.js.map +1 -1
- package/dist/nodes/node/node.d.ts +12 -4
- package/dist/nodes/node/node.d.ts.map +1 -1
- package/dist/nodes/node/node.js +67 -27
- package/dist/nodes/node/node.js.map +1 -1
- package/dist/nodes/node/text-defaults.d.ts +10 -12
- package/dist/nodes/node/text-defaults.d.ts.map +1 -1
- package/dist/nodes/node/text-defaults.js +10 -12
- package/dist/nodes/node/text-defaults.js.map +1 -1
- package/dist/nodes/{scene → root}/canvas2d-node.d.ts +4 -3
- package/dist/nodes/root/canvas2d-node.d.ts.map +1 -0
- package/dist/nodes/{scene → root}/canvas2d-node.js +5 -2
- package/dist/nodes/root/canvas2d-node.js.map +1 -0
- package/dist/nodes/root/provider-node.d.ts.map +1 -0
- package/dist/nodes/root/provider-node.js.map +1 -0
- package/dist/nodes/root/theme-provider-node.d.ts.map +1 -0
- package/dist/nodes/root/theme-provider-node.js.map +1 -0
- package/dist/nodes/text/default-text-style-node.d.ts +5 -2
- package/dist/nodes/text/default-text-style-node.d.ts.map +1 -1
- package/dist/nodes/text/default-text-style-node.js +10 -4
- package/dist/nodes/text/default-text-style-node.js.map +1 -1
- package/dist/nodes/text/number-format.d.ts +1 -1
- package/dist/nodes/text/number-format.js +1 -1
- package/dist/nodes/text/number-format.js.map +1 -1
- package/dist/nodes/text/number-node.js.map +1 -1
- package/dist/nodes/text/number-pattern.js.map +1 -1
- package/dist/nodes/text/richtext-node.d.ts +0 -5
- package/dist/nodes/text/richtext-node.d.ts.map +1 -1
- package/dist/nodes/text/richtext-node.js +6 -72
- package/dist/nodes/text/richtext-node.js.map +1 -1
- package/dist/nodes/text/text-base.d.ts +5 -22
- package/dist/nodes/text/text-base.d.ts.map +1 -1
- package/dist/nodes/text/text-base.js +13 -364
- package/dist/nodes/text/text-base.js.map +1 -1
- package/dist/nodes/text/text-layout.d.ts +87 -0
- package/dist/nodes/text/text-layout.d.ts.map +1 -0
- package/dist/nodes/text/text-layout.js +368 -0
- package/dist/nodes/text/text-layout.js.map +1 -0
- package/dist/nodes/text/text-node.js.map +1 -1
- package/dist/nodes/text/text-selection.js.map +1 -1
- package/dist/nodes/three/camera-nodes.d.ts +21 -3
- package/dist/nodes/three/camera-nodes.d.ts.map +1 -1
- package/dist/nodes/three/camera-nodes.js +42 -1
- package/dist/nodes/three/camera-nodes.js.map +1 -1
- package/dist/nodes/three/canvas3d-node.d.ts +32 -7
- package/dist/nodes/three/canvas3d-node.d.ts.map +1 -1
- package/dist/nodes/three/canvas3d-node.js +50 -2
- package/dist/nodes/three/canvas3d-node.js.map +1 -1
- package/dist/nodes/three/drawable-nodes.d.ts +25 -11
- package/dist/nodes/three/drawable-nodes.d.ts.map +1 -1
- package/dist/nodes/three/drawable-nodes.js +43 -13
- package/dist/nodes/three/drawable-nodes.js.map +1 -1
- package/dist/nodes/three/environment-nodes.d.ts +9 -3
- package/dist/nodes/three/environment-nodes.d.ts.map +1 -1
- package/dist/nodes/three/environment-nodes.js.map +1 -1
- package/dist/nodes/three/geometry-nodes.d.ts +2 -2
- package/dist/nodes/three/geometry-nodes.js +2 -2
- package/dist/nodes/three/geometry-nodes.js.map +1 -1
- package/dist/nodes/three/grid-geometry3d.js.map +1 -1
- package/dist/nodes/three/group3d.js.map +1 -1
- package/dist/nodes/three/light-nodes.d.ts.map +1 -1
- package/dist/nodes/three/light-nodes.js +3 -3
- package/dist/nodes/three/light-nodes.js.map +1 -1
- package/dist/nodes/three/mesh3d.js.map +1 -1
- package/dist/nodes/three/node3d.d.ts +48 -0
- package/dist/nodes/three/node3d.d.ts.map +1 -1
- package/dist/nodes/three/node3d.js +53 -3
- package/dist/nodes/three/node3d.js.map +1 -1
- package/dist/platform/audio-sink.d.ts +2 -2
- package/dist/platform/audio-sink.d.ts.map +1 -1
- package/dist/platform/audio-sink.js.map +1 -1
- package/dist/platform/exporter.d.ts +13 -8
- package/dist/platform/exporter.d.ts.map +1 -1
- package/dist/platform/exporter.js.map +1 -1
- package/dist/platform/index.d.ts +1 -1
- package/dist/platform/index.d.ts.map +1 -1
- package/dist/platform/index.js.map +1 -1
- package/dist/platform/stepped-clock.js.map +1 -1
- package/dist/platform/storage-adapter.d.ts +12 -6
- package/dist/platform/storage-adapter.d.ts.map +1 -1
- package/dist/platform/storage-adapter.js +4 -0
- package/dist/platform/storage-adapter.js.map +1 -1
- package/dist/platform/ticker.d.ts +6 -0
- package/dist/platform/ticker.d.ts.map +1 -1
- package/dist/platform/ticker.js +6 -0
- package/dist/platform/ticker.js.map +1 -1
- package/dist/project/config.js.map +1 -1
- package/dist/project/index.js.map +1 -1
- package/dist/project/tree.d.ts +3 -3
- package/dist/project/tree.d.ts.map +1 -1
- package/dist/project/tree.js.map +1 -1
- package/dist/props/host.js.map +1 -1
- package/dist/props/index.js.map +1 -1
- package/dist/props/observer.js.map +1 -1
- package/dist/props/slot.js.map +1 -1
- package/dist/renamed-scene-names.d.ts +17 -0
- package/dist/renamed-scene-names.d.ts.map +1 -0
- package/dist/renamed-scene-names.js +9 -0
- package/dist/renamed-scene-names.js.map +1 -0
- package/dist/render/canvas-render-context2d.d.ts +2 -2
- package/dist/render/canvas-render-context2d.d.ts.map +1 -1
- package/dist/render/canvas-render-context2d.js.map +1 -1
- package/dist/render/clip-contains.js.map +1 -1
- package/dist/render/clip.js.map +1 -1
- package/dist/render/descriptors/ellipse.js.map +1 -1
- package/dist/render/descriptors/latex.js.map +1 -1
- package/dist/render/descriptors/line.js.map +1 -1
- package/dist/render/descriptors/path-builder.js.map +1 -1
- package/dist/render/descriptors/path.js.map +1 -1
- package/dist/render/descriptors/polygon.js.map +1 -1
- package/dist/render/descriptors/polygram.js.map +1 -1
- package/dist/render/descriptors/rect.js.map +1 -1
- package/dist/render/descriptors/richtext.js.map +1 -1
- package/dist/render/descriptors/shape.d.ts +12 -0
- package/dist/render/descriptors/shape.d.ts.map +1 -1
- package/dist/render/descriptors/shape.js.map +1 -1
- package/dist/render/descriptors/text.d.ts +2 -2
- package/dist/render/descriptors/text.js +2 -2
- package/dist/render/descriptors/text.js.map +1 -1
- package/dist/render/descriptors/transform.d.ts +2 -2
- package/dist/render/descriptors/transform.d.ts.map +1 -1
- package/dist/render/descriptors/transform.js.map +1 -1
- package/dist/render/graphics2d.d.ts +3 -3
- package/dist/render/graphics2d.d.ts.map +1 -1
- package/dist/render/graphics2d.js +1 -1
- package/dist/render/graphics2d.js.map +1 -1
- package/dist/render/index.js.map +1 -1
- package/dist/render/measure-context.js.map +1 -1
- package/dist/render/null-render-context.js.map +1 -1
- package/dist/render/render-context2d.d.ts +2 -2
- package/dist/render/render-context2d.d.ts.map +1 -1
- package/dist/render/render-context2d.js.map +1 -1
- package/dist/render/surface.js.map +1 -1
- package/dist/render/text-defaults.js.map +1 -1
- package/dist/render/text-layout.js.map +1 -1
- package/dist/render3d/bounds3d.d.ts.map +1 -1
- package/dist/render3d/bounds3d.js +4 -2
- package/dist/render3d/bounds3d.js.map +1 -1
- package/dist/render3d/builders.js.map +1 -1
- package/dist/render3d/camera.d.ts +6 -0
- package/dist/render3d/camera.d.ts.map +1 -1
- package/dist/render3d/camera.js +5 -3
- package/dist/render3d/camera.js.map +1 -1
- package/dist/render3d/fill3d.d.ts +2 -9
- package/dist/render3d/fill3d.d.ts.map +1 -1
- package/dist/render3d/fill3d.js +2 -13
- package/dist/render3d/fill3d.js.map +1 -1
- package/dist/render3d/geometry.d.ts +8 -1
- package/dist/render3d/geometry.d.ts.map +1 -1
- package/dist/render3d/geometry.js.map +1 -1
- package/dist/render3d/graphics3d.d.ts +8 -4
- package/dist/render3d/graphics3d.d.ts.map +1 -1
- package/dist/render3d/graphics3d.js +18 -10
- package/dist/render3d/graphics3d.js.map +1 -1
- package/dist/render3d/index.d.ts +1 -1
- package/dist/render3d/index.js +1 -1
- package/dist/render3d/index.js.map +1 -1
- package/dist/render3d/inert.d.ts +14 -0
- package/dist/render3d/inert.d.ts.map +1 -0
- package/dist/render3d/inert.js +62 -0
- package/dist/render3d/inert.js.map +1 -0
- package/dist/render3d/light.js.map +1 -1
- package/dist/render3d/material.d.ts +10 -5
- package/dist/render3d/material.d.ts.map +1 -1
- package/dist/render3d/material.js.map +1 -1
- package/dist/render3d/matrix4.js.map +1 -1
- package/dist/render3d/render-context3d.js.map +1 -1
- package/dist/render3d/resources.js.map +1 -1
- package/dist/render3d/rounded-box.js.map +1 -1
- package/dist/render3d/scene-settings.d.ts +23 -4
- package/dist/render3d/scene-settings.d.ts.map +1 -1
- package/dist/render3d/scene-settings.js.map +1 -1
- package/dist/render3d/scene3d.d.ts +11 -0
- package/dist/render3d/scene3d.d.ts.map +1 -1
- package/dist/render3d/scene3d.js +39 -6
- package/dist/render3d/scene3d.js.map +1 -1
- package/dist/render3d/segments.js.map +1 -1
- package/dist/render3d/texture.d.ts +9 -0
- package/dist/render3d/texture.d.ts.map +1 -1
- package/dist/render3d/texture.js +13 -0
- package/dist/render3d/texture.js.map +1 -1
- package/dist/render3d/tracking.js.map +1 -1
- package/dist/render3d/transform.d.ts +1 -1
- package/dist/render3d/transform.js.map +1 -1
- package/dist/render3d/vector3.d.ts +18 -1
- package/dist/render3d/vector3.d.ts.map +1 -1
- package/dist/render3d/vector3.js +27 -0
- package/dist/render3d/vector3.js.map +1 -1
- package/dist/render3d/walk.d.ts +1 -1
- package/dist/render3d/walk.d.ts.map +1 -1
- package/dist/render3d/walk.js +5 -1
- package/dist/render3d/walk.js.map +1 -1
- package/dist/runtime/asset-refine.js.map +1 -1
- package/dist/runtime/asset-timeline.js.map +1 -1
- package/dist/runtime/asset-update.js.map +1 -1
- package/dist/runtime/audio-index.js.map +1 -1
- package/dist/runtime/builtin-context.js.map +1 -1
- package/dist/runtime/clip-instance.d.ts +9 -4
- package/dist/runtime/clip-instance.d.ts.map +1 -1
- package/dist/runtime/clip-instance.js +27 -9
- package/dist/runtime/clip-instance.js.map +1 -1
- package/dist/runtime/clip-store.d.ts +18 -0
- package/dist/runtime/clip-store.d.ts.map +1 -1
- package/dist/runtime/clip-store.js +97 -0
- package/dist/runtime/clip-store.js.map +1 -1
- package/dist/runtime/engine.d.ts +5 -0
- package/dist/runtime/engine.d.ts.map +1 -1
- package/dist/runtime/engine.js +2 -0
- package/dist/runtime/engine.js.map +1 -1
- package/dist/runtime/frame-time.d.ts +31 -0
- package/dist/runtime/frame-time.d.ts.map +1 -0
- package/dist/runtime/frame-time.js +29 -0
- package/dist/runtime/frame-time.js.map +1 -0
- package/dist/runtime/index.d.ts +1 -0
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +1 -0
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/node-picking.d.ts +44 -3
- package/dist/runtime/node-picking.d.ts.map +1 -1
- package/dist/runtime/node-picking.js +124 -10
- package/dist/runtime/node-picking.js.map +1 -1
- package/dist/runtime/node-picking3d.d.ts +13 -5
- package/dist/runtime/node-picking3d.d.ts.map +1 -1
- package/dist/runtime/node-picking3d.js +10 -2
- package/dist/runtime/node-picking3d.js.map +1 -1
- package/dist/runtime/placement.d.ts.map +1 -1
- package/dist/runtime/placement.js +4 -5
- package/dist/runtime/placement.js.map +1 -1
- package/dist/runtime/playback-controller.d.ts +31 -2
- package/dist/runtime/playback-controller.d.ts.map +1 -1
- package/dist/runtime/playback-controller.js +63 -6
- package/dist/runtime/playback-controller.js.map +1 -1
- package/dist/runtime/playback.js.map +1 -1
- package/dist/runtime/precompisition.js.map +1 -1
- package/dist/runtime/project-assets.js.map +1 -1
- package/dist/runtime/session.d.ts +9 -7
- package/dist/runtime/session.d.ts.map +1 -1
- package/dist/runtime/session.js +12 -4
- package/dist/runtime/session.js.map +1 -1
- package/dist/runtime/settle.js.map +1 -1
- package/dist/runtime/state-evaluator.d.ts +1 -1
- package/dist/runtime/state-evaluator.d.ts.map +1 -1
- package/dist/runtime/state-evaluator.js +4 -3
- package/dist/runtime/state-evaluator.js.map +1 -1
- package/dist/runtime/text-geometry.d.ts.map +1 -1
- package/dist/runtime/text-geometry.js +7 -3
- package/dist/runtime/text-geometry.js.map +1 -1
- package/dist/sdk/index.d.ts +50 -25
- package/dist/sdk/index.d.ts.map +1 -1
- package/dist/sdk/index.js +52 -42
- package/dist/sdk/index.js.map +1 -1
- package/dist/tween/command-decorator.d.ts +2 -0
- package/dist/tween/command-decorator.d.ts.map +1 -1
- package/dist/tween/command-decorator.js.map +1 -1
- package/dist/tween/command.d.ts +12 -0
- package/dist/tween/command.d.ts.map +1 -1
- package/dist/tween/command.js +14 -0
- package/dist/tween/command.js.map +1 -1
- package/dist/tween/ease/constants.d.ts.map +1 -1
- package/dist/tween/ease/constants.js +8 -5
- package/dist/tween/ease/constants.js.map +1 -1
- package/dist/tween/ease/curve.d.ts.map +1 -1
- package/dist/tween/ease/curve.js +4 -3
- package/dist/tween/ease/curve.js.map +1 -1
- package/dist/tween/ease/describe.d.ts +15 -0
- package/dist/tween/ease/describe.d.ts.map +1 -0
- package/dist/tween/ease/describe.js +37 -0
- package/dist/tween/ease/describe.js.map +1 -0
- package/dist/tween/ease/type.js.map +1 -1
- package/dist/tween/index.js.map +1 -1
- package/dist/tween/inert.js.map +1 -1
- package/dist/tween/lerp.js.map +1 -1
- package/dist/tween/loop.js.map +1 -1
- package/dist/tween/prepare.d.ts +3 -3
- package/dist/tween/prepare.js +3 -3
- package/dist/tween/prepare.js.map +1 -1
- package/dist/tween/seekable.d.ts +1 -1
- package/dist/tween/seekable.js.map +1 -1
- package/dist/tween/stepper.js.map +1 -1
- package/dist/tween/to-command.js.map +1 -1
- package/dist/util/clamp.js.map +1 -1
- package/dist/util/context.js.map +1 -1
- package/dist/util/csv.js.map +1 -1
- package/dist/util/generateList.js.map +1 -1
- package/dist/util/index.js.map +1 -1
- package/dist/util/metrics.d.ts +1 -1
- package/dist/util/metrics.js +1 -1
- package/dist/util/metrics.js.map +1 -1
- package/dist/util/random.js.map +1 -1
- package/dist/util/reference.js.map +1 -1
- package/dist/util/scheduler.js.map +1 -1
- package/package.json +7 -1
- package/dist/attributes/shape/effects/implementations/displace.d.ts +0 -48
- package/dist/attributes/shape/effects/implementations/displace.d.ts.map +0 -1
- package/dist/attributes/shape/effects/implementations/displace.js +0 -30
- package/dist/attributes/shape/effects/implementations/displace.js.map +0 -1
- package/dist/attributes/shape/effects/implementations/god-rays.d.ts +0 -28
- package/dist/attributes/shape/effects/implementations/god-rays.d.ts.map +0 -1
- package/dist/attributes/shape/effects/implementations/god-rays.js +0 -26
- package/dist/attributes/shape/effects/implementations/god-rays.js.map +0 -1
- package/dist/attributes/shape/effects/implementations/texture.d.ts +0 -28
- package/dist/attributes/shape/effects/implementations/texture.d.ts.map +0 -1
- package/dist/attributes/shape/effects/implementations/texture.js +0 -25
- package/dist/attributes/shape/effects/implementations/texture.js.map +0 -1
- package/dist/attributes/shape/effects/implementations/trails.d.ts +0 -41
- package/dist/attributes/shape/effects/implementations/trails.d.ts.map +0 -1
- package/dist/attributes/shape/effects/implementations/trails.js +0 -22
- package/dist/attributes/shape/effects/implementations/trails.js.map +0 -1
- package/dist/browser/chunks/chunk-2T3HXSC2.js +0 -2
- package/dist/browser/chunks/chunk-2T3HXSC2.js.map +0 -7
- package/dist/browser/chunks/chunk-KJXGRHOL.js +0 -3
- package/dist/browser/chunks/chunk-KJXGRHOL.js.map +0 -7
- package/dist/browser/chunks/chunk-TGDX2SS2.js +0 -18
- package/dist/browser/chunks/chunk-TGDX2SS2.js.map +0 -7
- package/dist/nodes/geometry/dot-grid-node.d.ts +0 -105
- package/dist/nodes/geometry/dot-grid-node.d.ts.map +0 -1
- package/dist/nodes/geometry/dot-grid-node.js +0 -142
- package/dist/nodes/geometry/dot-grid-node.js.map +0 -1
- package/dist/nodes/geometry/grid-lines.d.ts +0 -101
- package/dist/nodes/geometry/grid-lines.d.ts.map +0 -1
- package/dist/nodes/geometry/grid-lines.js +0 -128
- package/dist/nodes/geometry/grid-lines.js.map +0 -1
- package/dist/nodes/geometry/grid-pattern-node.d.ts +0 -58
- package/dist/nodes/geometry/grid-pattern-node.d.ts.map +0 -1
- package/dist/nodes/geometry/grid-pattern-node.js +0 -172
- package/dist/nodes/geometry/grid-pattern-node.js.map +0 -1
- package/dist/nodes/geometry/line-grid-node.d.ts +0 -62
- package/dist/nodes/geometry/line-grid-node.d.ts.map +0 -1
- package/dist/nodes/geometry/line-grid-node.js +0 -127
- package/dist/nodes/geometry/line-grid-node.js.map +0 -1
- package/dist/nodes/geometry/line-node.d.ts +0 -58
- package/dist/nodes/geometry/line-node.d.ts.map +0 -1
- package/dist/nodes/geometry/line-node.js +0 -123
- package/dist/nodes/geometry/line-node.js.map +0 -1
- package/dist/nodes/geometry/viewport-pattern-node.d.ts +0 -39
- package/dist/nodes/geometry/viewport-pattern-node.d.ts.map +0 -1
- package/dist/nodes/geometry/viewport-pattern-node.js +0 -79
- package/dist/nodes/geometry/viewport-pattern-node.js.map +0 -1
- package/dist/nodes/scene/canvas2d-node.d.ts.map +0 -1
- package/dist/nodes/scene/canvas2d-node.js.map +0 -1
- package/dist/nodes/scene/provider-node.d.ts.map +0 -1
- package/dist/nodes/scene/provider-node.js.map +0 -1
- package/dist/nodes/scene/theme-provider-node.d.ts.map +0 -1
- package/dist/nodes/scene/theme-provider-node.js.map +0 -1
- /package/dist/nodes/{scene → root}/provider-node.d.ts +0 -0
- /package/dist/nodes/{scene → root}/provider-node.js +0 -0
- /package/dist/nodes/{scene → root}/theme-provider-node.d.ts +0 -0
- /package/dist/nodes/{scene → root}/theme-provider-node.js +0 -0
package/dist/document/audio.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isAudioDocument, isStillDocument, nodeSpan } from "./types.js";
|
|
1
2
|
/**
|
|
2
3
|
* The id the authored root bus is rewritten to.
|
|
3
4
|
*
|
|
@@ -9,15 +10,15 @@ const AUDIO_ROOT_ID = "@bus";
|
|
|
9
10
|
function defaultRootBus() {
|
|
10
11
|
return { id: AUDIO_ROOT_ID, type: "audioBus", parentId: null, layerOrder: 0, props: {} };
|
|
11
12
|
}
|
|
12
|
-
/** The
|
|
13
|
-
function
|
|
13
|
+
/** The root a lowered audio clip hangs from. Draws nothing; lays out once. */
|
|
14
|
+
function clipRoot() {
|
|
14
15
|
return { id: "", type: "canvas2d", parentId: null, layerOrder: 0, props: {} };
|
|
15
16
|
}
|
|
16
17
|
/**
|
|
17
18
|
* An audio document, as the composition it already is.
|
|
18
19
|
*
|
|
19
20
|
* There is no second evaluator for sound, and this is what keeps it that way:
|
|
20
|
-
* an audio clip is compiled, seeked and restored by `
|
|
21
|
+
* an audio clip is compiled, seeked and restored by `ClipTimeline` like any
|
|
21
22
|
* other, so a bus fade and a rectangle's fade cannot drift because there is only
|
|
22
23
|
* one machine running them.
|
|
23
24
|
*
|
|
@@ -29,7 +30,7 @@ function sceneRoot() {
|
|
|
29
30
|
* clip that is only sound.
|
|
30
31
|
*/
|
|
31
32
|
export function loweredAudioDocument(doc) {
|
|
32
|
-
const nodes = [
|
|
33
|
+
const nodes = [clipRoot()];
|
|
33
34
|
if (!doc.nodes.some(isRootBus))
|
|
34
35
|
nodes.push(defaultRootBus());
|
|
35
36
|
for (const spec of doc.nodes)
|
|
@@ -64,4 +65,44 @@ function retarget(command) {
|
|
|
64
65
|
return command;
|
|
65
66
|
}
|
|
66
67
|
export { AUDIO_ROOT_ID };
|
|
68
|
+
/**
|
|
69
|
+
* A `sound` or `video` row with no `play` command of its own plays as it did
|
|
70
|
+
* before sound came only from commands: a sound over its span (open-ended, to
|
|
71
|
+
* its own end), a video once per segment, or over its span while it plays.
|
|
72
|
+
*/
|
|
73
|
+
export function withPlayedSounds(doc) {
|
|
74
|
+
const played = new Set(doc.commands.filter((c) => c.type === "play").map((c) => c.targetId));
|
|
75
|
+
const added = [];
|
|
76
|
+
for (const spec of doc.nodes) {
|
|
77
|
+
if ((spec.type !== "sound" && spec.type !== "video") || played.has(spec.id))
|
|
78
|
+
continue;
|
|
79
|
+
const { start, end } = nodeSpan(spec);
|
|
80
|
+
const segments = spec.type === "video" ? spec.props.segments : undefined;
|
|
81
|
+
if (Array.isArray(segments) && segments.length > 0) {
|
|
82
|
+
segments.forEach((segment, i) => {
|
|
83
|
+
added.push({
|
|
84
|
+
// An endless segment plays to the source's end: a command has no endless length.
|
|
85
|
+
id: `@play:${spec.id}:${i}`, type: "play", targetId: spec.id, at: start + segment.at,
|
|
86
|
+
duration: Number.isFinite(segment.duration) ? segment.duration : 0,
|
|
87
|
+
args: {
|
|
88
|
+
from: segment.from,
|
|
89
|
+
...(segment.speed !== undefined && { speed: segment.speed }),
|
|
90
|
+
...(segment.volume !== undefined && { volume: segment.volume }),
|
|
91
|
+
},
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
added.push({
|
|
97
|
+
id: `@play:${spec.id}`, type: "play", targetId: spec.id, at: start,
|
|
98
|
+
duration: Number.isFinite(end) ? end - start : 0, args: {},
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
return added.length === 0 ? doc : { ...doc, commands: [...doc.commands, ...added] };
|
|
102
|
+
}
|
|
103
|
+
/** A clip as its timeline builds it: an audio document lowered to the composition it is, its sounds played. */
|
|
104
|
+
export function clipDocument(doc) {
|
|
105
|
+
const lowered = isAudioDocument(doc) ? loweredAudioDocument(doc) : doc;
|
|
106
|
+
return isStillDocument(lowered) ? lowered : withPlayedSounds(lowered);
|
|
107
|
+
}
|
|
67
108
|
//# sourceMappingURL=audio.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audio.js","sourceRoot":"","sources":["../../src/document/audio.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"audio.js","sourceRoot":"","sources":["../../src/document/audio.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAErE;;;;;GAKG;AACH,MAAM,aAAa,GAAG,MAAM,CAAC;AAE7B,yEAAyE;AACzE,SAAS,cAAc;IACnB,OAAO,EAAE,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;AAC7F,CAAC;AAED,8EAA8E;AAC9E,SAAS,QAAQ;IACb,OAAO,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;AAClF,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,oBAAoB,CAAC,GAAkB;IACnD,MAAM,KAAK,GAAoB,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC5C,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC;QAAE,KAAK,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC;IAC7D,KAAK,MAAM,IAAI,IAAI,GAAG,CAAC,KAAK;QAAE,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;IAEzD,OAAO;QACH,IAAI,EAAE,aAAa;QACnB,QAAQ,EAAE,GAAG,CAAC,QAAQ;QACtB,SAAS,EAAE,GAAG,CAAC,SAAS;QACxB,KAAK;QACL,QAAQ,EAAE,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC;KACvC,CAAC;AACN,CAA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AAE,EAAE,SAAS,IAAI,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,CAAC,EAAE,EAAE,EAAE,EAAE,KAAK;YAClE,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE;SAC7D,CAAC,CAAC;IACP,CAAC;IACD,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,EAAE,QAAQ,EAAE,CAAC,GAAG,GAAG,CAAC,QAAQ,EAAE,GAAG,KAAK,CAAC,EAAE,CAAC;AACxF,CAAC;AAED,+GAA+G;AAC/G,MAAM,UAAU,YAAY,CAAC,GAAiB;IAC1C,MAAM,OAAO,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,oBAAoB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IACvE,OAAO,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;AAC1E,CAAC","sourcesContent":["import type { AudioDocument, ClipDocument, CommandSpec, CompositionDocument, NodeSpec, TimedNodeSpec, VisualDocument } from \"./types\";\r\nimport { isAudioDocument, isStillDocument, nodeSpan } from \"./types\";\r\n\r\n/**\r\n * The id the authored root bus is rewritten to.\r\n *\r\n * Namespaced like every other synthesized id in the document layer, so it can\r\n * never collide with one a document authored itself.\r\n */\r\nconst AUDIO_ROOT_ID = \"@bus\";\r\n\r\n/** The root bus when an audio document doesn't author one explicitly. */\r\nfunction defaultRootBus(): NodeSpec {\r\n return { id: AUDIO_ROOT_ID, type: \"audioBus\", parentId: null, layerOrder: 0, props: {} };\r\n}\r\n\r\n/** The root a lowered audio clip hangs from. Draws nothing; lays out once. */\r\nfunction clipRoot(): NodeSpec {\r\n return { id: \"\", type: \"canvas2d\", parentId: null, layerOrder: 0, props: {} };\r\n}\r\n\r\n/**\r\n * An audio document, as the composition it already is.\r\n *\r\n * There is no second evaluator for sound, and this is what keeps it that way:\r\n * an audio clip is compiled, seeked and restored by `ClipTimeline` like any\r\n * other, so a bus fade and a rectangle's fade cannot drift because there is only\r\n * one machine running them.\r\n *\r\n * The only thing that has to be arranged is the root. An audio document's own\r\n * root is a bus, but a clip's root is always a `Canvas2D` — so the bus\r\n * becomes that canvas's single audio child under {@link AUDIO_ROOT_ID}, and\r\n * every `targetId: null` / `parentId: null` is rewritten to name it. The canvas\r\n * draws nothing and lays out an empty box once, which is the whole cost of a\r\n * clip that is only sound.\r\n */\r\nexport function loweredAudioDocument(doc: AudioDocument): CompositionDocument {\r\n const nodes: TimedNodeSpec[] = [clipRoot()];\r\n if (!doc.nodes.some(isRootBus)) nodes.push(defaultRootBus());\r\n for (const spec of doc.nodes) nodes.push(reparent(spec));\r\n\r\n return {\r\n kind: \"composition\",\r\n duration: doc.duration,\r\n variables: doc.variables,\r\n nodes,\r\n commands: doc.commands.map(retarget),\r\n };\r\n}\r\n\r\n/** The row an audio document means as its root bus. */\r\nfunction isRootBus(spec: NodeSpec): boolean {\r\n return spec.id === \"\" && spec.type === \"audioBus\";\r\n}\r\n\r\n/** A node spec with the implicit root resolved to {@link AUDIO_ROOT_ID}. */\r\nfunction reparent(spec: TimedNodeSpec): TimedNodeSpec {\r\n if (isRootBus(spec)) return { ...spec, id: AUDIO_ROOT_ID, parentId: null };\r\n // `null` is the document's own convention for \"the root\"; `\"\"` is the same\r\n // row named by id, which `checkTree` also resolves. Both mean the bus.\r\n if (spec.parentId === null || spec.parentId === \"\") return { ...spec, parentId: AUDIO_ROOT_ID };\r\n return spec;\r\n}\r\n\r\n/** A command with the implicit root resolved to {@link AUDIO_ROOT_ID}. */\r\nfunction retarget(command: CommandSpec): CommandSpec {\r\n if (command.targetId === null || command.targetId === \"\") {\r\n return { ...command, targetId: AUDIO_ROOT_ID };\r\n }\r\n return command;\r\n}\r\n\r\nexport { AUDIO_ROOT_ID };\r\n\r\n/**\r\n * A `sound` or `video` row with no `play` command of its own plays as it did\r\n * before sound came only from commands: a sound over its span (open-ended, to\r\n * its own end), a video once per segment, or over its span while it plays.\r\n */\r\nexport function withPlayedSounds(doc: CompositionDocument): CompositionDocument {\r\n const played = new Set(doc.commands.filter((c) => c.type === \"play\").map((c) => c.targetId));\r\n const added: CommandSpec[] = [];\r\n for (const spec of doc.nodes) {\r\n if ((spec.type !== \"sound\" && spec.type !== \"video\") || played.has(spec.id)) continue;\r\n const { start, end } = nodeSpan(spec);\r\n const segments = spec.type === \"video\" ? (spec.props as { segments?: unknown }).segments : undefined;\r\n if (Array.isArray(segments) && segments.length > 0) {\r\n (segments as { at: number; from: number; duration: number; speed?: number; volume?: number }[]).forEach((segment, i) => {\r\n added.push({\r\n // An endless segment plays to the source's end: a command has no endless length.\r\n id: `@play:${spec.id}:${i}`, type: \"play\", targetId: spec.id, at: start + segment.at,\r\n duration: Number.isFinite(segment.duration) ? segment.duration : 0,\r\n args: {\r\n from: segment.from,\r\n ...(segment.speed !== undefined && { speed: segment.speed }),\r\n ...(segment.volume !== undefined && { volume: segment.volume }),\r\n },\r\n });\r\n });\r\n continue;\r\n }\r\n added.push({\r\n id: `@play:${spec.id}`, type: \"play\", targetId: spec.id, at: start,\r\n duration: Number.isFinite(end) ? end - start : 0, args: {},\r\n });\r\n }\r\n return added.length === 0 ? doc : { ...doc, commands: [...doc.commands, ...added] };\r\n}\r\n\r\n/** A clip as its timeline builds it: an audio document lowered to the composition it is, its sounds played. */\r\nexport function clipDocument(doc: ClipDocument): VisualDocument {\r\n const lowered = isAudioDocument(doc) ? loweredAudioDocument(doc) : doc;\r\n return isStillDocument(lowered) ? lowered : withPlayedSounds(lowered);\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builtins.d.ts","sourceRoot":"","sources":["../../src/document/builtins.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAC;AAC1D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"builtins.d.ts","sourceRoot":"","sources":["../../src/document/builtins.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAC;AAC1D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AA2B3D,OAAO,KAAK,EAAmB,QAAQ,EAAgB,MAAM,YAAY,CAAC;AAkJ1E;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAmGxD;AAED,2EAA2E;AAC3E,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC"}
|
|
@@ -1,35 +1,14 @@
|
|
|
1
1
|
import { driveCommand } from "../tween/command.js";
|
|
2
|
-
import { BooleanGroup } from "../
|
|
3
|
-
import { Ellipse } from "../
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { Camera } from "../nodes/layout/camera-node.js";
|
|
13
|
-
import { OrbitCamera } from "../nodes/layout/orbit-camera-node.js";
|
|
14
|
-
import { RotatedBox } from "../nodes/layout/rotated-box.js";
|
|
15
|
-
import { Video } from "../nodes/media/video-node.js";
|
|
16
|
-
import { AudioBus } from "../nodes/audio/audio-bus.js";
|
|
17
|
-
import { SoundNode } from "../nodes/audio/sound-node.js";
|
|
18
|
-
import { Canvas2D } from "../nodes/scene/canvas2d-node.js";
|
|
19
|
-
import { Provider } from "../nodes/scene/provider-node.js";
|
|
20
|
-
import { ThemeProvider } from "../nodes/scene/theme-provider-node.js";
|
|
21
|
-
import { DefaultTextStyle } from "../nodes/text/default-text-style-node.js";
|
|
22
|
-
import { NumberNode } from "../nodes/text/number-node.js";
|
|
23
|
-
import { RichText } from "../nodes/text/richtext-node.js";
|
|
24
|
-
import { Text } from "../nodes/text/text-node.js";
|
|
25
|
-
import { Canvas3D } from "../nodes/three/canvas3d-node.js";
|
|
26
|
-
import { Group3D } from "../nodes/three/group3d.js";
|
|
27
|
-
import { Mesh3D } from "../nodes/three/mesh3d.js";
|
|
28
|
-
import { Box3D, Capsule3D, Circle3D, Cone3D, Cylinder3D, Extrude3D, Lathe3D, Plane3D, Polyhedron3D, Ring3D, Sphere3D, Torus3D, TorusKnot3D, Tube3D, } from "../nodes/three/geometry-nodes.js";
|
|
29
|
-
import { Instances3D, Line3D, Model3D, Points3D, Sprite3D } from "../nodes/three/drawable-nodes.js";
|
|
30
|
-
import { AmbientLight3D, AreaLight3D, DirectionalLight3D, HemisphereLight3D, PointLight3D, SpotLight3D, } from "../nodes/three/light-nodes.js";
|
|
31
|
-
import { Camera3D } from "../nodes/three/camera-nodes.js";
|
|
32
|
-
import { Environment3D, Fog3D } from "../nodes/three/environment-nodes.js";
|
|
2
|
+
import { BooleanGroup, MaskGroup } from "../component/builtins/composite.js";
|
|
3
|
+
import { Ellipse, PathShape, Polygon, Polygram, Rect } from "../component/builtins/geometry.js";
|
|
4
|
+
import { Camera, OrbitCamera, RotatedBox } from "../component/builtins/layout.js";
|
|
5
|
+
import { Video } from "../component/builtins/media.js";
|
|
6
|
+
import { AudioBus, SoundNode } from "../component/builtins/audio.js";
|
|
7
|
+
import { Canvas2D } from "../nodes/root/canvas2d-node.js";
|
|
8
|
+
import { Provider, ThemeProvider } from "../component/builtins/providers.js";
|
|
9
|
+
import { DefaultTextStyle, NumberNode, RichText, Text } from "../component/builtins/text.js";
|
|
10
|
+
import { Canvas3D } from "../component/builtins/canvas3d.js";
|
|
11
|
+
import { AmbientLight3D, AreaLight3D, Box3D, Camera3D, Capsule3D, Circle3D, Cone3D, Cylinder3D, DirectionalLight3D, Environment3D, Extrude3D, Fog3D, Group3D, HemisphereLight3D, Instances3D, Lathe3D, Line3D, Mesh3D, Model3D, Plane3D, PointLight3D, Points3D, Polyhedron3D, Ring3D, Sphere3D, SpotLight3D, Sprite3D, Torus3D, TorusKnot3D, Tube3D, } from "../component/builtins/three.js";
|
|
33
12
|
import { lerpVector2 } from "../attributes/layout/vector2.js";
|
|
34
13
|
import { lerpColor } from "../attributes/shape/fill/lerp.js";
|
|
35
14
|
import { parseColor } from "../attributes/shape/fill/color/parser.js";
|
|
@@ -46,7 +25,7 @@ import { lerpNumber } from "../tween/lerp.js";
|
|
|
46
25
|
*/
|
|
47
26
|
/** Every built-in node type, keyed as a document names it. */
|
|
48
27
|
const NODE_TYPES = {
|
|
49
|
-
//
|
|
28
|
+
// Clip root and structural
|
|
50
29
|
canvas2d: Canvas2D,
|
|
51
30
|
provider: Provider,
|
|
52
31
|
"theme-provider": ThemeProvider,
|
|
@@ -54,7 +33,6 @@ const NODE_TYPES = {
|
|
|
54
33
|
// Geometry
|
|
55
34
|
rect: Rect,
|
|
56
35
|
ellipse: Ellipse,
|
|
57
|
-
line: Line,
|
|
58
36
|
// The **unit-box** path, not `path-node.ts`'s face-value `Path`. A stored
|
|
59
37
|
// document's `data` is a fraction of the node's own box, so a resize is an
|
|
60
38
|
// ordinary `width`/`height` write and every editor gizmo works on it
|
|
@@ -65,8 +43,6 @@ const NODE_TYPES = {
|
|
|
65
43
|
path: PathShape,
|
|
66
44
|
polygon: Polygon,
|
|
67
45
|
polygram: Polygram,
|
|
68
|
-
"line-grid": LineGrid,
|
|
69
|
-
"grid-pattern": GridPattern,
|
|
70
46
|
boolean: BooleanGroup,
|
|
71
47
|
mask: MaskGroup,
|
|
72
48
|
// Layout
|
|
@@ -213,10 +189,10 @@ export function installBuiltins(registry) {
|
|
|
213
189
|
// table dispatches through.
|
|
214
190
|
// Each declares the one key it reads, in the kind its property uses, so a
|
|
215
191
|
// host draws the same paint stack for the command as for the prop.
|
|
216
|
-
registry.addCommand("fillTo", paintCommand("fillTo", "fill"), { args: [{ key: "fill", kind: "fills" }] });
|
|
217
|
-
registry.addCommand("overlayTo", paintCommand("overlayTo", "overlay"), { args: [{ key: "overlay", kind: "fills" }] });
|
|
218
|
-
registry.addCommand("strokeTo", paintCommand("strokeTo", "stroke"), { args: [{ key: "stroke", kind: "strokes" }] });
|
|
219
|
-
registry.addCommand("shadowTo", paintCommand("shadowTo", "shadow"), { args: [{ key: "shadow", kind: "shadows" }] });
|
|
192
|
+
registry.addCommand("fillTo", paintCommand("fillTo", "fill"), { args: [{ key: "fill", kind: "fills" }], method: "fillTo" });
|
|
193
|
+
registry.addCommand("overlayTo", paintCommand("overlayTo", "overlay"), { args: [{ key: "overlay", kind: "fills" }], method: "overlayTo" });
|
|
194
|
+
registry.addCommand("strokeTo", paintCommand("strokeTo", "stroke"), { args: [{ key: "stroke", kind: "strokes" }], method: "strokeTo" });
|
|
195
|
+
registry.addCommand("shadowTo", paintCommand("shadowTo", "shadow"), { args: [{ key: "shadow", kind: "shadows" }], method: "shadowTo" });
|
|
220
196
|
// Transform, camera, text and `restore` commands are not registered here:
|
|
221
197
|
// they are `@command()` methods, and `Registry.addNode` publishes them off
|
|
222
198
|
// the classes above. See `document/registry.ts`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builtins.js","sourceRoot":"","sources":["../../src/document/builtins.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAkC,MAAM,iBAAiB,CAAC;AAK/E,OAAO,EAAE,YAAY,EA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AE,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,CACxD,YAAY,CAAC,CAAC,EAAE,GAAG,EAAE;QACjB,MAAM,CAAC,GAAG,CAAE,IAA4B,CAAC,KAAK,CAAC,CAAC;IACpD,CAAC,CAAgD,CAAC,CAAC;IAEvD,4EAA4E;IAC5E,8EAA8E;IAC9E,uEAAuE;IACvE,2EAA2E;IAC3E,0EAA0E;IAC1E,gEAAgE;IAChE,QAAQ,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE,CACnC,YAAY,CAAC,CAAC,EAAE,GAAG,EAAE;QAChB,MAAiB,CAAC,IAAI,EAAE,CAAC;IAC9B,CAAC,CAAgD,CAAC,CAAC;AAC3D,CAAC","sourcesContent":["import type { Fill } from \"@/attributes/shape/fill/chain\";\nimport type { Shadow } from \"@/attributes/shape/shadow/shadow\";\nimport type { Stroke } from \"@/attributes/shape/stroke/stroke\";\nimport type { Vector2 } from \"@/attributes/layout/vector2\";\nimport { driveCommand, type Command, type CommandArgs } from \"@/tween/command\";\nimport type { EasingFunction } from \"@/tween/ease/type\";\nimport type { Node } from \"@/nodes/node/node\";\nimport type { Node2D } from \"@/nodes/2d/node2d\";\n\nimport { BooleanGroup } from \"@/nodes/geometry/boolean-node\";\nimport { Ellipse } from \"@/nodes/geometry/ellipse-node\";\nimport { GridPattern } from \"@/nodes/geometry/grid-pattern-node\";\nimport { Line } from \"@/nodes/geometry/line-node\";\nimport { LineGrid } from \"@/nodes/geometry/line-grid-node\";\nimport { MaskGroup } from \"@/nodes/geometry/mask-node\";\nimport { PathShape } from \"@/nodes/geometry/box-path-node\";\nimport { Polygon } from \"@/nodes/geometry/polygon-node\";\nimport { Polygram } from \"@/nodes/geometry/polygram-node\";\nimport { Rect } from \"@/nodes/geometry/rect-node\";\nimport { Camera } from \"@/nodes/layout/camera-node\";\nimport { OrbitCamera } from \"@/nodes/layout/orbit-camera-node\";\nimport { RotatedBox } from \"@/nodes/layout/rotated-box\";\nimport { Video } from \"@/nodes/media/video-node\";\nimport { AudioBus } from \"@/nodes/audio/audio-bus\";\nimport { SoundNode } from \"@/nodes/audio/sound-node\";\nimport { Canvas2D } from \"@/nodes/scene/canvas2d-node\";\nimport { Provider } from \"@/nodes/scene/provider-node\";\nimport { ThemeProvider } from \"@/nodes/scene/theme-provider-node\";\nimport { DefaultTextStyle } from \"@/nodes/text/default-text-style-node\";\nimport { NumberNode } from \"@/nodes/text/number-node\";\nimport { RichText } from \"@/nodes/text/richtext-node\";\nimport { Text } from \"@/nodes/text/text-node\";\nimport { Canvas3D } from \"@/nodes/three/canvas3d-node\";\nimport { Group3D } from \"@/nodes/three/group3d\";\nimport { Mesh3D } from \"@/nodes/three/mesh3d\";\nimport {\n Box3D, Capsule3D, Circle3D, Cone3D, Cylinder3D, Extrude3D, Lathe3D,\n Plane3D, Polyhedron3D, Ring3D, Sphere3D, Torus3D, TorusKnot3D, Tube3D,\n} from \"@/nodes/three/geometry-nodes\";\nimport { Instances3D, Line3D, Model3D, Points3D, Sprite3D } from \"@/nodes/three/drawable-nodes\";\nimport {\n AmbientLight3D, AreaLight3D, DirectionalLight3D, HemisphereLight3D,\n PointLight3D, SpotLight3D,\n} from \"@/nodes/three/light-nodes\";\nimport { Camera3D } from \"@/nodes/three/camera-nodes\";\nimport { Environment3D, Fog3D } from \"@/nodes/three/environment-nodes\";\n\nimport { lerpVector2 } from \"@/attributes/layout/vector2\";\nimport { lerpColor } from \"@/attributes/shape/fill/lerp\";\nimport { parseColor } from \"@/attributes/shape/fill/color/parser\";\nimport { lerpVector3 } from \"@/render3d/vector3\";\nimport { lerpNumber } from \"@/tween/lerp\";\n\nimport type { NodeConstructor, Registry, VariableLerp } from \"./registry\";\n\n/**\n * Registration of everything `@motionscript/core` itself ships.\n *\n * The keys here are **document API**. A stored scene names its nodes and its\n * animations with these strings, so renaming one silently breaks every document\n * that used it — they are as much a public contract as an exported symbol, and\n * are deliberately spelled out rather than derived from `constructor.name`\n * (which a minifier is free to mangle).\n */\n\n/** Every built-in node type, keyed as a document names it. */\nconst NODE_TYPES: Record<string, NodeConstructor> = {\n // Scene root and structural\n canvas2d: Canvas2D as unknown as NodeConstructor,\n provider: Provider as unknown as NodeConstructor,\n \"theme-provider\": ThemeProvider as unknown as NodeConstructor,\n \"default-text-style\": DefaultTextStyle as unknown as NodeConstructor,\n\n // Geometry\n rect: Rect as unknown as NodeConstructor,\n ellipse: Ellipse as unknown as NodeConstructor,\n line: Line as unknown as NodeConstructor,\n // The **unit-box** path, not `path-node.ts`'s face-value `Path`. A stored\n // document's `data` is a fraction of the node's own box, so a resize is an\n // ordinary `width`/`height` write and every editor gizmo works on it\n // unchanged (`box-path-node.ts` has the whole argument). `Path` draws its\n // `d` at face value and hugs it, which is right for geometry somebody wrote\n // in code — it stays exported for that, and is reached by importing the\n // class rather than by naming a type in a document.\n path: PathShape as unknown as NodeConstructor,\n polygon: Polygon as unknown as NodeConstructor,\n polygram: Polygram as unknown as NodeConstructor,\n \"line-grid\": LineGrid as unknown as NodeConstructor,\n \"grid-pattern\": GridPattern as unknown as NodeConstructor,\n boolean: BooleanGroup as unknown as NodeConstructor,\n mask: MaskGroup as unknown as NodeConstructor,\n\n // Layout\n camera: Camera as unknown as NodeConstructor,\n orbitCamera: OrbitCamera as unknown as NodeConstructor,\n \"rotated-box\": RotatedBox as unknown as NodeConstructor,\n\n // Text\n text: Text as unknown as NodeConstructor,\n richtext: RichText as unknown as NodeConstructor,\n number: NumberNode as unknown as NodeConstructor,\n\n // Media\n video: Video as unknown as NodeConstructor,\n\n // Audio — a bus groups, a sound plays. `audioBus` is also the root of an\n // AudioDocument, the way `canvas2d` is the root of a scene.\n audioBus: AudioBus as unknown as NodeConstructor,\n sound: SoundNode as unknown as NodeConstructor,\n\n // 3D — the viewport, then the tree that lives inside it\n canvas3d: Canvas3D as unknown as NodeConstructor,\n group3d: Group3D as unknown as NodeConstructor,\n mesh3d: Mesh3D as unknown as NodeConstructor,\n box3d: Box3D as unknown as NodeConstructor,\n sphere3d: Sphere3D as unknown as NodeConstructor,\n plane3d: Plane3D as unknown as NodeConstructor,\n circle3d: Circle3D as unknown as NodeConstructor,\n cylinder3d: Cylinder3D as unknown as NodeConstructor,\n cone3d: Cone3D as unknown as NodeConstructor,\n capsule3d: Capsule3D as unknown as NodeConstructor,\n torus3d: Torus3D as unknown as NodeConstructor,\n \"torus-knot3d\": TorusKnot3D as unknown as NodeConstructor,\n tube3d: Tube3D as unknown as NodeConstructor,\n lathe3d: Lathe3D as unknown as NodeConstructor,\n extrude3d: Extrude3D as unknown as NodeConstructor,\n ring3d: Ring3D as unknown as NodeConstructor,\n polyhedron3d: Polyhedron3D as unknown as NodeConstructor,\n points3d: Points3D as unknown as NodeConstructor,\n line3d: Line3D as unknown as NodeConstructor,\n sprite3d: Sprite3D as unknown as NodeConstructor,\n instances3d: Instances3D as unknown as NodeConstructor,\n model3d: Model3D as unknown as NodeConstructor,\n camera3d: Camera3D as unknown as NodeConstructor,\n \"ambient-light3d\": AmbientLight3D as unknown as NodeConstructor,\n \"directional-light3d\": DirectionalLight3D as unknown as NodeConstructor,\n \"point-light3d\": PointLight3D as unknown as NodeConstructor,\n \"spot-light3d\": SpotLight3D as unknown as NodeConstructor,\n \"hemisphere-light3d\": HemisphereLight3D as unknown as NodeConstructor,\n \"area-light3d\": AreaLight3D as unknown as NodeConstructor,\n fog3d: Fog3D as unknown as NodeConstructor,\n environment3d: Environment3D as unknown as NodeConstructor,\n};\n\n/** A node method taking one {@link CommandArgs}. */\ntype EasedMethod = (args: CommandArgs) => Command<Record<string, unknown>>;\n\n/** Call a paint command (`fillTo`/`overlayTo`/`strokeTo`/`shadowTo`). */\nfunction paintCommand(method: string, argKey: string) {\n return (\n target: Node,\n args: Record<string, unknown>,\n duration: number,\n easing?: EasingFunction,\n ): Command<Record<string, unknown>> => {\n const fn = (target as unknown as Record<string, unknown>)[method];\n if (typeof fn !== \"function\") {\n throw new Error(\n `Command \"${method}\" is not available on ${target.constructor.name}.`,\n );\n }\n return (fn as EasedMethod).call(target, { data: args[argKey] as Record<string, unknown>, duration, easing });\n };\n}\n\n/**\n * The interpolations a document can name in `VariableSpec.lerp`.\n *\n * Deliberately the small set a variable actually holds — a number, a point, a\n * colour — rather than one entry per attribute in the library. A variable drives\n * props *through* an expression, so it only has to carry the quantity that\n * varies: a gradient that shifts is one `stop` number bound into a fill, not a\n * whole fill being interpolated a second time. Anything else is a\n * `registry.addLerp` away.\n */\nconst VARIABLE_LERPS: Record<string, VariableLerp> = {\n number: lerpNumber as VariableLerp,\n vector2: lerpVector2 as VariableLerp,\n vector3: lerpVector3 as VariableLerp,\n /**\n * Parse both ends, blend per channel, hand back a CSS string.\n *\n * A string rather than the parsed tuple because that is what the prop on the\n * far side of the expression takes — every fill, stroke and shadow resolves\n * a colour from CSS text, and `parseColor` reads theme tokens and the\n * `\"white/10\"` opacity suffix too, so a variable can hold either.\n */\n color: ((from, to, t) => {\n const [r, g, b, a] = lerpColor(parseColor(String(from)), parseColor(String(to)), t);\n const channel = (v: number) => Math.round(Math.min(Math.max(v, 0), 1) * 255);\n return `rgba(${channel(r)}, ${channel(g)}, ${channel(b)}, ${Number(a.toFixed(4))})`;\n }) as VariableLerp,\n /**\n * No interpolation: hold `from` until the tween lands, then take `to`.\n *\n * The default for a non-numeric variable: a discrete value (a string of\n * text, an enum, a boolean) has no midpoint, and inventing one produces a\n * frame that is neither state.\n */\n step: ((from, to, t) => (t >= 1 ? to : from)) as VariableLerp,\n};\n\n/**\n * Seed a {@link Registry} with everything `@motionscript/core` itself ships.\n *\n * **Internal, and called from `Registry`'s own constructor.** It used to be\n * public and every host had to call it at module scope before compiling\n * anything — which `sideEffects: false` is entitled to delete, with a failure\n * mode (\"unknown node type rect\") that points nowhere near the cause. A registry\n * that seeds itself makes the vocabulary a value dependency of the engine\n * instead, so there is nothing left to tree-shake and nothing to remember.\n *\n * @internal\n */\nexport function installBuiltins(registry: Registry): void {\n for (const [key, ctor] of Object.entries(NODE_TYPES)) {\n registry.addNode(key, ctor);\n }\n for (const [key, lerp] of Object.entries(VARIABLE_LERPS)) {\n registry.addLerp(key, lerp);\n }\n\n // ── Props ────────────────────────────────────────────────────────────────\n // `args` *is* the props diff — no wrapper key, since `to`/`set` each carry\n // exactly one argument and a node's own props are already a fixed,\n // known-shape bag (not something a second command parameter could collide\n // with the way `to`/`set` never gained one).\n registry.addCommand(\"to\", (target, args, duration, easing) =>\n (target as Node2D).to({\n // Copied: `_prepareStep` expands sugar into its target in place, which\n // would rewrite the document row a diff compares by identity.\n data: { ...args } as Record<string, never>,\n duration,\n easing,\n }) as unknown as Command<Record<string, unknown>>);\n\n // A stamp: write props with no tween. `duration` is ignored, which is what\n // makes it usable as the \"set this here\" a keyframe editor needs.\n //\n // `binds` because its args reach `set()` verbatim, so an expression among\n // them is a binding — this is how a prop starts following a variable partway\n // through a scene rather than from the moment its node is authored.\n registry.addCommand(\"set\", (target, args) => {\n const props = args as Record<string, never>;\n return driveCommand(0, () => {\n (target as Node2D).set(props);\n }) as unknown as Command<Record<string, unknown>>;\n }, { binds: true });\n\n // ── Paint (PaintNode / Canvas2D) ───────────────────────────────────────\n // Node-less rather than per-type, like `to` and `set` above: these are\n // generic over every painted node, and they take a `TweenOptions` bag where\n // an ordinary command takes a bare easing function — so they need a factory\n // that knows that convention rather than the uniform one a node type's own\n // table dispatches through.\n // Each declares the one key it reads, in the kind its property uses, so a\n // host draws the same paint stack for the command as for the prop.\n registry.addCommand(\"fillTo\", paintCommand(\"fillTo\", \"fill\"), { args: [{ key: \"fill\", kind: \"fills\" }] });\n registry.addCommand(\"overlayTo\", paintCommand(\"overlayTo\", \"overlay\"), { args: [{ key: \"overlay\", kind: \"fills\" }] });\n registry.addCommand(\"strokeTo\", paintCommand(\"strokeTo\", \"stroke\"), { args: [{ key: \"stroke\", kind: \"strokes\" }] });\n registry.addCommand(\"shadowTo\", paintCommand(\"shadowTo\", \"shadow\"), { args: [{ key: \"shadow\", kind: \"shadows\" }] });\n\n // Transform, camera, text and `restore` commands are not registered here:\n // they are `@command()` methods, and `Registry.addNode` publishes them off\n // the classes above. See `document/registry.ts`.\n\n // ── Variables ────────────────────────────────────────────────────────────\n // Tween a variable. The one command that drives many nodes at once: every\n // prop bound to `\"=[id]\"` follows what this writes, with no command of its\n // own and nothing to keep in sync.\n registry.addVariableCommand(\"variableTo\", (target, args, duration, easing) => {\n const to = (args as { value?: unknown }).value;\n const lerpKey = (args as { lerp?: unknown }).lerp;\n const override = typeof lerpKey === \"string\" ? registry.lerp(lerpKey) : undefined;\n if (lerpKey !== undefined && !override) {\n throw new Error(\n `A \"lerp\" param must name a registered lerp (variable \"${target.id}\"), ` +\n `got ${JSON.stringify(lerpKey)}. Registered: ${registry.lerpKeys().join(\", \")}.`,\n );\n }\n const lerp = override ?? target.lerp;\n\n // `from` is captured on the command's first evaluation rather than here,\n // exactly as a node's `to()` does: the timeline builds commands in order\n // and runs each to `at(1)`, so the capture sees the state its\n // predecessors left. Captured once, it is then a pure function of `t`.\n let from: unknown;\n let captured = false;\n return driveCommand(duration, (t) => {\n if (!captured) {\n from = target.get();\n captured = true;\n }\n target.set(lerp(from, to, t));\n }, easing) as unknown as Command<Record<string, unknown>>;\n });\n\n // A stamp, matching `set`: write the value with no tween, ignoring duration.\n registry.addVariableCommand(\"variableSet\", (target, args) =>\n driveCommand(0, () => {\n target.set((args as { value?: unknown }).value);\n }) as unknown as Command<Record<string, unknown>>);\n\n // ── State ────────────────────────────────────────────────────────────────\n // `restore` pops the layer a `save` pushed, and is published off `Node`'s own\n // `@command()`. `save` is not one, so it is registered here — both are\n // commands so the pair is placed on the timeline like anything else, and a\n // seek past the save still produces the same frame: the value is computed\n // from the chain rather than accumulated as the playhead moves.\n registry.addCommand(\"save\", (target) =>\n driveCommand(0, () => {\n (target as Node2D).save();\n }) as unknown as Command<Record<string, unknown>>);\n}\n\n/** Type-only re-exports, so a caller writing args gets the same shapes. */\nexport type { Fill, Shadow, Stroke, Vector2 };\n"]}
|
|
1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,IAAI,MAAM,CAAC,IAAI,CAAC;QAErC,yEAAyE;QACzE,yEAAyE;QACzE,8DAA8D;QAC9D,uEAAuE;QACvE,IAAI,IAAa,CAAC;QAClB,IAAI,QAAQ,GAAG,KAAK,CAAC;QACrB,OAAO,YAAY,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE;YAChC,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACZ,IAAI,GAAG,MAAM,CAAC,GAAG,EAAE,CAAC;gBACpB,QAAQ,GAAG,IAAI,CAAC;YACpB,CAAC;YACD,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;QAClC,CAAC,EAAE,MAAM,CAAgD,CAAC;IAC9D,CAAC,CAAC,CAAC;IAEH,6EAA6E;IAC7E,QAAQ,CAAC,kBAAkB,CAAC,aAAa,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,CACxD,YAAY,CAAC,CAAC,EAAE,GAAG,EAAE;QACjB,MAAM,CAAC,GAAG,CAAE,IAA4B,CAAC,KAAK,CAAC,CAAC;IACpD,CAAC,CAAgD,CAAC,CAAC;IAEvD,4EAA4E;IAC5E,8EAA8E;IAC9E,uEAAuE;IACvE,2EAA2E;IAC3E,0EAA0E;IAC1E,gEAAgE;IAChE,QAAQ,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE,CACnC,YAAY,CAAC,CAAC,EAAE,GAAG,EAAE;QAChB,MAAiB,CAAC,IAAI,EAAE,CAAC;IAC9B,CAAC,CAAgD,CAAC,CAAC;AAC3D,CAAC","sourcesContent":["import type { Fill } from \"@/attributes/shape/fill/chain\";\r\nimport type { Shadow } from \"@/attributes/shape/shadow/shadow\";\r\nimport type { Stroke } from \"@/attributes/shape/stroke/stroke\";\r\nimport type { Vector2 } from \"@/attributes/layout/vector2\";\r\nimport { driveCommand, type Command, type CommandArgs } from \"@/tween/command\";\r\nimport type { EasingFunction } from \"@/tween/ease/type\";\r\nimport type { Node } from \"@/nodes/node/node\";\r\nimport type { Node2D } from \"@/nodes/2d/node2d\";\r\n\r\nimport { BooleanGroup, MaskGroup } from \"@/component/builtins/composite\";\r\nimport { Ellipse, PathShape, Polygon, Polygram, Rect } from \"@/component/builtins/geometry\";\r\nimport { Camera, OrbitCamera, RotatedBox } from \"@/component/builtins/layout\";\r\nimport { Video } from \"@/component/builtins/media\";\r\nimport { AudioBus, SoundNode } from \"@/component/builtins/audio\";\r\nimport { Canvas2D } from \"@/nodes/root/canvas2d-node\";\r\nimport { Provider, ThemeProvider } from \"@/component/builtins/providers\";\r\nimport { DefaultTextStyle, NumberNode, RichText, Text } from \"@/component/builtins/text\";\r\nimport { Canvas3D } from \"@/component/builtins/canvas3d\";\r\nimport {\r\n AmbientLight3D, AreaLight3D, Box3D, Camera3D, Capsule3D, Circle3D, Cone3D, Cylinder3D, DirectionalLight3D,\r\n Environment3D, Extrude3D, Fog3D, Group3D, HemisphereLight3D, Instances3D, Lathe3D, Line3D, Mesh3D, Model3D,\r\n Plane3D, PointLight3D, Points3D, Polyhedron3D, Ring3D, Sphere3D, SpotLight3D, Sprite3D, Torus3D, TorusKnot3D, Tube3D,\r\n} from \"@/component/builtins/three\";\r\n\r\nimport { lerpVector2 } from \"@/attributes/layout/vector2\";\r\nimport { lerpColor } from \"@/attributes/shape/fill/lerp\";\r\nimport { parseColor } from \"@/attributes/shape/fill/color/parser\";\r\nimport { lerpVector3 } from \"@/render3d/vector3\";\r\nimport { lerpNumber } from \"@/tween/lerp\";\r\n\r\nimport type { NodeConstructor, Registry, VariableLerp } from \"./registry\";\r\n\r\n/**\r\n * Registration of everything `@motionscript/core` itself ships.\r\n *\r\n * The keys here are **document API**. A stored scene names its nodes and its\r\n * animations with these strings, so renaming one silently breaks every document\r\n * that used it — they are as much a public contract as an exported symbol, and\r\n * are deliberately spelled out rather than derived from `constructor.name`\r\n * (which a minifier is free to mangle).\r\n */\r\n\r\n/** Every built-in node type, keyed as a document names it. */\r\nconst NODE_TYPES: Record<string, NodeConstructor> = {\r\n // Clip root and structural\r\n canvas2d: Canvas2D as unknown as NodeConstructor,\r\n provider: Provider as unknown as NodeConstructor,\r\n \"theme-provider\": ThemeProvider as unknown as NodeConstructor,\r\n \"default-text-style\": DefaultTextStyle as unknown as NodeConstructor,\r\n\r\n // Geometry\r\n rect: Rect as unknown as NodeConstructor,\r\n ellipse: Ellipse as unknown as NodeConstructor,\r\n // The **unit-box** path, not `path-node.ts`'s face-value `Path`. A stored\r\n // document's `data` is a fraction of the node's own box, so a resize is an\r\n // ordinary `width`/`height` write and every editor gizmo works on it\r\n // unchanged (`box-path-node.ts` has the whole argument). `Path` draws its\r\n // `d` at face value and hugs it, which is right for geometry somebody wrote\r\n // in code — it stays exported for that, and is reached by importing the\r\n // class rather than by naming a type in a document.\r\n path: PathShape as unknown as NodeConstructor,\r\n polygon: Polygon as unknown as NodeConstructor,\r\n polygram: Polygram as unknown as NodeConstructor,\r\n boolean: BooleanGroup as unknown as NodeConstructor,\r\n mask: MaskGroup as unknown as NodeConstructor,\r\n\r\n // Layout\r\n camera: Camera as unknown as NodeConstructor,\r\n orbitCamera: OrbitCamera as unknown as NodeConstructor,\r\n \"rotated-box\": RotatedBox as unknown as NodeConstructor,\r\n\r\n // Text\r\n text: Text as unknown as NodeConstructor,\r\n richtext: RichText as unknown as NodeConstructor,\r\n number: NumberNode as unknown as NodeConstructor,\r\n\r\n // Media\r\n video: Video as unknown as NodeConstructor,\r\n\r\n // Audio — a bus groups, a sound plays. `audioBus` is also the root of an\r\n // AudioDocument, the way `canvas2d` is the root of a scene.\r\n audioBus: AudioBus as unknown as NodeConstructor,\r\n sound: SoundNode as unknown as NodeConstructor,\r\n\r\n // 3D — the viewport, then the tree that lives inside it\r\n canvas3d: Canvas3D as unknown as NodeConstructor,\r\n group3d: Group3D as unknown as NodeConstructor,\r\n mesh3d: Mesh3D as unknown as NodeConstructor,\r\n box3d: Box3D as unknown as NodeConstructor,\r\n sphere3d: Sphere3D as unknown as NodeConstructor,\r\n plane3d: Plane3D as unknown as NodeConstructor,\r\n circle3d: Circle3D as unknown as NodeConstructor,\r\n cylinder3d: Cylinder3D as unknown as NodeConstructor,\r\n cone3d: Cone3D as unknown as NodeConstructor,\r\n capsule3d: Capsule3D as unknown as NodeConstructor,\r\n torus3d: Torus3D as unknown as NodeConstructor,\r\n \"torus-knot3d\": TorusKnot3D as unknown as NodeConstructor,\r\n tube3d: Tube3D as unknown as NodeConstructor,\r\n lathe3d: Lathe3D as unknown as NodeConstructor,\r\n extrude3d: Extrude3D as unknown as NodeConstructor,\r\n ring3d: Ring3D as unknown as NodeConstructor,\r\n polyhedron3d: Polyhedron3D as unknown as NodeConstructor,\r\n points3d: Points3D as unknown as NodeConstructor,\r\n line3d: Line3D as unknown as NodeConstructor,\r\n sprite3d: Sprite3D as unknown as NodeConstructor,\r\n instances3d: Instances3D as unknown as NodeConstructor,\r\n model3d: Model3D as unknown as NodeConstructor,\r\n camera3d: Camera3D as unknown as NodeConstructor,\r\n \"ambient-light3d\": AmbientLight3D as unknown as NodeConstructor,\r\n \"directional-light3d\": DirectionalLight3D as unknown as NodeConstructor,\r\n \"point-light3d\": PointLight3D as unknown as NodeConstructor,\r\n \"spot-light3d\": SpotLight3D as unknown as NodeConstructor,\r\n \"hemisphere-light3d\": HemisphereLight3D as unknown as NodeConstructor,\r\n \"area-light3d\": AreaLight3D as unknown as NodeConstructor,\r\n fog3d: Fog3D as unknown as NodeConstructor,\r\n environment3d: Environment3D as unknown as NodeConstructor,\r\n};\r\n\r\n/** A node method taking one {@link CommandArgs}. */\r\ntype EasedMethod = (args: CommandArgs) => Command<Record<string, unknown>>;\r\n\r\n/** Call a paint command (`fillTo`/`overlayTo`/`strokeTo`/`shadowTo`). */\r\nfunction paintCommand(method: string, argKey: string) {\r\n return (\r\n target: Node,\r\n args: Record<string, unknown>,\r\n duration: number,\r\n easing?: EasingFunction,\r\n ): Command<Record<string, unknown>> => {\r\n const fn = (target as unknown as Record<string, unknown>)[method];\r\n if (typeof fn !== \"function\") {\r\n throw new Error(\r\n `Command \"${method}\" is not available on ${target.constructor.name}.`,\r\n );\r\n }\r\n return (fn as EasedMethod).call(target, { data: args[argKey] as Record<string, unknown>, duration, easing });\r\n };\r\n}\r\n\r\n/**\r\n * The interpolations a document can name in `VariableSpec.lerp`.\r\n *\r\n * Deliberately the small set a variable actually holds — a number, a point, a\r\n * colour — rather than one entry per attribute in the library. A variable drives\r\n * props *through* an expression, so it only has to carry the quantity that\r\n * varies: a gradient that shifts is one `stop` number bound into a fill, not a\r\n * whole fill being interpolated a second time. Anything else is a\r\n * `registry.addLerp` away.\r\n */\r\nconst VARIABLE_LERPS: Record<string, VariableLerp> = {\r\n number: lerpNumber as VariableLerp,\r\n vector2: lerpVector2 as VariableLerp,\r\n vector3: lerpVector3 as VariableLerp,\r\n /**\r\n * Parse both ends, blend per channel, hand back a CSS string.\r\n *\r\n * A string rather than the parsed tuple because that is what the prop on the\r\n * far side of the expression takes — every fill, stroke and shadow resolves\r\n * a colour from CSS text, and `parseColor` reads theme tokens and the\r\n * `\"white/10\"` opacity suffix too, so a variable can hold either.\r\n */\r\n color: ((from, to, t) => {\r\n const [r, g, b, a] = lerpColor(parseColor(String(from)), parseColor(String(to)), t);\r\n const channel = (v: number) => Math.round(Math.min(Math.max(v, 0), 1) * 255);\r\n return `rgba(${channel(r)}, ${channel(g)}, ${channel(b)}, ${Number(a.toFixed(4))})`;\r\n }) as VariableLerp,\r\n /**\r\n * No interpolation: hold `from` until the tween lands, then take `to`.\r\n *\r\n * The default for a non-numeric variable: a discrete value (a string of\r\n * text, an enum, a boolean) has no midpoint, and inventing one produces a\r\n * frame that is neither state.\r\n */\r\n step: ((from, to, t) => (t >= 1 ? to : from)) as VariableLerp,\r\n};\r\n\r\n/**\r\n * Seed a {@link Registry} with everything `@motionscript/core` itself ships.\r\n *\r\n * **Internal, and called from `Registry`'s own constructor.** It used to be\r\n * public and every host had to call it at module scope before compiling\r\n * anything — which `sideEffects: false` is entitled to delete, with a failure\r\n * mode (\"unknown node type rect\") that points nowhere near the cause. A registry\r\n * that seeds itself makes the vocabulary a value dependency of the engine\r\n * instead, so there is nothing left to tree-shake and nothing to remember.\r\n *\r\n * @internal\r\n */\r\nexport function installBuiltins(registry: Registry): void {\r\n for (const [key, ctor] of Object.entries(NODE_TYPES)) {\r\n registry.addNode(key, ctor);\r\n }\r\n for (const [key, lerp] of Object.entries(VARIABLE_LERPS)) {\r\n registry.addLerp(key, lerp);\r\n }\r\n\r\n // ── Props ────────────────────────────────────────────────────────────────\r\n // `args` *is* the props diff — no wrapper key, since `to`/`set` each carry\r\n // exactly one argument and a node's own props are already a fixed,\r\n // known-shape bag (not something a second command parameter could collide\r\n // with the way `to`/`set` never gained one).\r\n registry.addCommand(\"to\", (target, args, duration, easing) =>\r\n (target as Node2D).to({\r\n // Copied: `_prepareStep` expands sugar into its target in place, which\r\n // would rewrite the document row a diff compares by identity.\r\n data: { ...args } as Record<string, never>,\r\n duration,\r\n easing,\r\n }) as unknown as Command<Record<string, unknown>>);\r\n\r\n // A stamp: write props with no tween. `duration` is ignored, which is what\r\n // makes it usable as the \"set this here\" a keyframe editor needs.\r\n //\r\n // `binds` because its args reach `set()` verbatim, so an expression among\r\n // them is a binding — this is how a prop starts following a variable partway\r\n // through a scene rather than from the moment its node is authored.\r\n registry.addCommand(\"set\", (target, args) => {\r\n const props = args as Record<string, never>;\r\n return driveCommand(0, () => {\r\n (target as Node2D).set(props);\r\n }) as unknown as Command<Record<string, unknown>>;\r\n }, { binds: true });\r\n\r\n // ── Paint (PaintNode / Canvas2D) ───────────────────────────────────────\r\n // Node-less rather than per-type, like `to` and `set` above: these are\r\n // generic over every painted node, and they take a `TweenOptions` bag where\r\n // an ordinary command takes a bare easing function — so they need a factory\r\n // that knows that convention rather than the uniform one a node type's own\r\n // table dispatches through.\r\n // Each declares the one key it reads, in the kind its property uses, so a\r\n // host draws the same paint stack for the command as for the prop.\r\n registry.addCommand(\"fillTo\", paintCommand(\"fillTo\", \"fill\"), { args: [{ key: \"fill\", kind: \"fills\" }], method: \"fillTo\" });\r\n registry.addCommand(\"overlayTo\", paintCommand(\"overlayTo\", \"overlay\"), { args: [{ key: \"overlay\", kind: \"fills\" }], method: \"overlayTo\" });\r\n registry.addCommand(\"strokeTo\", paintCommand(\"strokeTo\", \"stroke\"), { args: [{ key: \"stroke\", kind: \"strokes\" }], method: \"strokeTo\" });\r\n registry.addCommand(\"shadowTo\", paintCommand(\"shadowTo\", \"shadow\"), { args: [{ key: \"shadow\", kind: \"shadows\" }], method: \"shadowTo\" });\r\n\r\n // Transform, camera, text and `restore` commands are not registered here:\r\n // they are `@command()` methods, and `Registry.addNode` publishes them off\r\n // the classes above. See `document/registry.ts`.\r\n\r\n // ── Variables ────────────────────────────────────────────────────────────\r\n // Tween a variable. The one command that drives many nodes at once: every\r\n // prop bound to `\"=[id]\"` follows what this writes, with no command of its\r\n // own and nothing to keep in sync.\r\n registry.addVariableCommand(\"variableTo\", (target, args, duration, easing) => {\r\n const to = (args as { value?: unknown }).value;\r\n const lerpKey = (args as { lerp?: unknown }).lerp;\r\n const override = typeof lerpKey === \"string\" ? registry.lerp(lerpKey) : undefined;\r\n if (lerpKey !== undefined && !override) {\r\n throw new Error(\r\n `A \"lerp\" param must name a registered lerp (variable \"${target.id}\"), ` +\r\n `got ${JSON.stringify(lerpKey)}. Registered: ${registry.lerpKeys().join(\", \")}.`,\r\n );\r\n }\r\n const lerp = override ?? target.lerp;\r\n\r\n // `from` is captured on the command's first evaluation rather than here,\r\n // exactly as a node's `to()` does: the timeline builds commands in order\r\n // and runs each to `at(1)`, so the capture sees the state its\r\n // predecessors left. Captured once, it is then a pure function of `t`.\r\n let from: unknown;\r\n let captured = false;\r\n return driveCommand(duration, (t) => {\r\n if (!captured) {\r\n from = target.get();\r\n captured = true;\r\n }\r\n target.set(lerp(from, to, t));\r\n }, easing) as unknown as Command<Record<string, unknown>>;\r\n });\r\n\r\n // A stamp, matching `set`: write the value with no tween, ignoring duration.\r\n registry.addVariableCommand(\"variableSet\", (target, args) =>\r\n driveCommand(0, () => {\r\n target.set((args as { value?: unknown }).value);\r\n }) as unknown as Command<Record<string, unknown>>);\r\n\r\n // ── State ────────────────────────────────────────────────────────────────\r\n // `restore` pops the layer a `save` pushed, and is published off `Node`'s own\r\n // `@command()`. `save` is not one, so it is registered here — both are\r\n // commands so the pair is placed on the timeline like anything else, and a\r\n // seek past the save still produces the same frame: the value is computed\r\n // from the chain rather than accumulated as the playhead moves.\r\n registry.addCommand(\"save\", (target) =>\r\n driveCommand(0, () => {\r\n (target as Node2D).save();\r\n }) as unknown as Command<Record<string, unknown>>);\r\n}\r\n\r\n/** Type-only re-exports, so a caller writing args gets the same shapes. */\r\nexport type { Fill, Shadow, Stroke, Vector2 };\r\n"]}
|
|
@@ -21,7 +21,7 @@ export interface CommandTraits {
|
|
|
21
21
|
/** The nine named alignment props, which position a node against its own laid-out box. */
|
|
22
22
|
export declare const ALIGNMENT_KEYS: readonly string[];
|
|
23
23
|
/**
|
|
24
|
-
* How a document command resolves, as `
|
|
24
|
+
* How a document command resolves, as `ClipTimeline._buildPlaced` resolves it,
|
|
25
25
|
* and what it does — or `null` when it resolves to nothing (compiling it throws).
|
|
26
26
|
* `target` is the command's target row; for `targetId: null` a document with no
|
|
27
27
|
* explicit root row may pass `undefined`.
|
|
@@ -8,7 +8,7 @@ export const ALIGNMENT_KEYS = [
|
|
|
8
8
|
"topCenter", "bottomCenter", "centerLeft", "centerRight",
|
|
9
9
|
];
|
|
10
10
|
/**
|
|
11
|
-
* How a document command resolves, as `
|
|
11
|
+
* How a document command resolves, as `ClipTimeline._buildPlaced` resolves it,
|
|
12
12
|
* and what it does — or `null` when it resolves to nothing (compiling it throws).
|
|
13
13
|
* `target` is the command's target row; for `targetId: null` a document with no
|
|
14
14
|
* explicit root row may pass `undefined`.
|
|
@@ -127,6 +127,12 @@ const NODE_COMMANDS = {
|
|
|
127
127
|
fadeTo: ["fadeTo", ...TO],
|
|
128
128
|
rotateTo: ["rotateTo", ...TO],
|
|
129
129
|
scaleTo: ["scaleTo", ...TO],
|
|
130
|
+
layoutTo: ["layoutTo", ...TO],
|
|
131
|
+
effectTo: ["effectTo", ...TO],
|
|
132
|
+
progressTo: ["progressTo", ...TO],
|
|
133
|
+
pulse: ["pulse", ...PAINT],
|
|
134
|
+
wiggle: ["wiggle", ...PAINT],
|
|
135
|
+
flash: ["flash", ...PAINT],
|
|
130
136
|
moveTo: ["moveTo", ...TO, "command", "set"],
|
|
131
137
|
zoomTo: ["zoomTo", ...TO],
|
|
132
138
|
panTo: ["panTo", ...TO],
|
|
@@ -134,12 +140,20 @@ const NODE_COMMANDS = {
|
|
|
134
140
|
countTo: ["countTo", ...TO],
|
|
135
141
|
append: ["append", ...TO],
|
|
136
142
|
prepend: ["prepend", ...TO],
|
|
143
|
+
// Plays its node's sound: scheduled ahead of time, writing nothing.
|
|
144
|
+
play: ["play"],
|
|
137
145
|
};
|
|
138
146
|
/** Named commands' writes. `to`/`set` write their args; absent means "anything". */
|
|
139
147
|
const WRITES = {
|
|
140
148
|
fadeTo: ["opacity"],
|
|
141
149
|
rotateTo: ["rotation"],
|
|
142
150
|
scaleTo: ["scale"],
|
|
151
|
+
layoutTo: ["width", "height", "padding"],
|
|
152
|
+
effectTo: ["effects"],
|
|
153
|
+
progressTo: ["start", "end"],
|
|
154
|
+
pulse: ["scale"],
|
|
155
|
+
wiggle: ["rotation"],
|
|
156
|
+
flash: ["start", "end"],
|
|
143
157
|
moveTo: ["x", "y"],
|
|
144
158
|
zoomTo: ["zoom"],
|
|
145
159
|
panTo: ["lookAt"],
|
|
@@ -148,6 +162,7 @@ const WRITES = {
|
|
|
148
162
|
overlayTo: ["overlay"],
|
|
149
163
|
strokeTo: ["stroke"],
|
|
150
164
|
shadowTo: ["shadow"],
|
|
165
|
+
play: [],
|
|
151
166
|
};
|
|
152
167
|
/** What a known command reads `from` — every command but the stamps. */
|
|
153
168
|
const READS_FROM = new Set(Object.keys(NODE_COMMANDS).filter((type) => type !== "set" && type !== "save"));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-traits.js","sourceRoot":"","sources":["../../src/document/command-traits.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAwB,MAAM,YAAY,CAAC;AAE5D,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAqBvC,0FAA0F;AAC1F,MAAM,CAAC,MAAM,cAAc,GAAsB;IAC7C,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa;IAC5D,WAAW,EAAE,cAAc,EAAE,YAAY,EAAE,aAAa;CAC3D,CAAC;AAEF;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,QAAkB,EAAE,IAAiB,EAAE,MAA4B;IAC7F,MAAM,SAAS,GAAG,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC3C,MAAM,MAAM,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC3C,IAAI,MAAM,EAAE,KAAK,KAAK,UAAU,EAAE,CAAC;QAC/B,MAAM,KAAK,GAAG,iBAAiB,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC/C,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC;IAC7F,CAAC;IAED,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IAC1E,MAAM,MAAM,GAAG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Q,EAAE,CAAC;QAC9B,IAAI,GAAG,EAAE,KAAK,EAAE,IAAI,GAAG,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAE,CAAC,IAAI,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,GAAG,EAAE,EAAE,CAAC;IAC1G,CAAC;IACD,OAAO,IAAI,CAAC;AAChB,CAAC;AAED,2EAA2E;AAC3E,SAAS,mBAAmB,CAAC,IAAY;IACrC,MAAM,OAAO,GAAG,WAAW,EAAE,CAAC;IAC9B,IAAI,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACtC,IAAI,CAAC,KAAK,EAAE,CAAC;QACT,MAAM,KAAK,GAAG,IAAI,GAAG,EAAW,CAAC;QACjC,KAAK,MAAM,IAAI,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;YAC/B,KAAK,IAAI,KAAK,GAAG,IAAI,CAAC,SAAS,EAAE,KAAK,IAAI,KAAK,KAAK,MAAM,CAAC,SAAS,EAAE,KAAK,GAAG,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC;gBACzG,MAAM,GAAG,GAAG,MAAM,CAAC,wBAAwB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;gBACzD,IAAI,GAAG,IAAI,OAAO,GAAG,CAAC,KAAK,KAAK,UAAU;oBAAE,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YACrE,CAAC;QACL,CAAC;QACD,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC;IAC/C,CAAC;IACD,OAAO,KAAK,CAAC;AACjB,CAAC","sourcesContent":["import { Node } from \"@/nodes/node/node\";\nimport { expressionOps } from \"./expression/ops\";\nimport { Registry, type NodeConstructor } from \"./registry\";\nimport type { CommandSpec, NodeSpec } from \"./types\";\nimport { ROOT_NODE_ID } from \"./types\";\n\n/**\n * What a command can do to the tree around it, read off the document and the\n * registry without building anything.\n *\n * Only the library's own implementations are described: a command resolving to a\n * subclass override or a component's method could do anything, so it is `known:\n * false` and assumed to read and write layout.\n */\nexport interface CommandTraits {\n scope: \"node\" | \"variable\";\n /** Resolves to the library's own implementation, so the rules below hold for it. */\n known: boolean;\n lifecycle: boolean;\n /** Building it can read a laid-out box, so it must be built against a settled tree. */\n readsLayout: boolean;\n /** Running it can change what layout computes. */\n writesLayout: boolean;\n}\n\n/** The nine named alignment props, which position a node against its own laid-out box. */\nexport const ALIGNMENT_KEYS: readonly string[] = [\n \"center\", \"topLeft\", \"topRight\", \"bottomLeft\", \"bottomRight\",\n \"topCenter\", \"bottomCenter\", \"centerLeft\", \"centerRight\",\n];\n\n/**\n * How a document command resolves, as `SceneTimeline._buildPlaced` resolves it,\n * and what it does — or `null` when it resolves to nothing (compiling it throws).\n * `target` is the command's target row; for `targetId: null` a document with no\n * explicit root row may pass `undefined`.\n */\nexport function commandTraits(registry: Registry, spec: CommandSpec, target: NodeSpec | undefined): CommandTraits | null {\n const lifecycle = LIFECYCLE.has(spec.type);\n const global = registry.command(spec.type);\n if (global?.scope === \"variable\") {\n const known = VARIABLE_COMMANDS.has(spec.type);\n return { scope: \"variable\", known, lifecycle, readsLayout: !known, writesLayout: false };\n }\n\n const row = target ?? (spec.targetId === null ? DEFAULT_ROOT : undefined);\n const record = row ? registry.node(row.type) : undefined;\n if (!row || !record) return null;\n\n let chain: readonly string[] | undefined;\n if (global) {\n chain = GLOBAL_NODE_COMMANDS[spec.type];\n if (chain && typeof methodOf(record.ctor, chain[0]) !== \"function\") return null;\n } else {\n const entry = record.commands.get(spec.type);\n if (!entry) return null;\n // A method published under a core command's key is not the core command.\n chain = entry.method === spec.type ? NODE_COMMANDS[spec.type] : undefined;\n }\n\n const known = !lifecycle && chain !== undefined && implementsCore(record.ctor, chain);\n if (!known) return { scope: \"node\", known, lifecycle, readsLayout: true, writesLayout: true };\n\n const args = spec.args ?? {};\n const props = row.props ?? {};\n const written = writtenKeys(spec.type, args);\n return {\n scope: \"node\",\n known,\n lifecycle,\n readsLayout: readsLayout(spec.type, args, props, written),\n writesLayout: written === undefined || written.some((key) => !isLayoutNeutralProp(registry, row.type, key)),\n };\n}\n\n/**\n * The node ids a command's args name through a `nodeRef` argument — the nodes\n * whose boxes it may read when it is built, beside its own target.\n */\nexport function commandNodeRefs(registry: Registry, spec: CommandSpec, target: NodeSpec | undefined): string[] {\n const global = registry.command(spec.type);\n const row = target ?? (spec.targetId === null ? DEFAULT_ROOT : undefined);\n const descriptors = global\n ? (global.scope === \"node\" ? global.args : undefined)\n : row ? registry.node(row.type)?.commands.get(spec.type)?.args : undefined;\n const refs: string[] = [];\n for (const descriptor of descriptors ?? []) {\n const value = spec.args?.[descriptor.key];\n if (descriptor.kind === \"nodeRef\" && typeof value === \"string\" && value !== \"\") refs.push(value);\n }\n return refs;\n}\n\n/** Whether `type` hands its descendants a context of its own. */\nexport function isContextProvider(registry: Registry, type: string): boolean {\n const ctor = registry.node(type)?.ctor;\n return ctor !== undefined && methodOf(ctor, \"provideContext\") !== methodOf(Node, \"provideContext\");\n}\n\n/**\n * Whether an authored value holds an expression reading another node's prop\n * (`[card.x]`), at any depth. An unparsable one counts: it fails the build anyway.\n */\nexport function hasNodeRef(value: unknown): boolean {\n for (const site of expressionOps.collect(value, \"\")) {\n const parsed = expressionOps.tryParse(site.source);\n if (\"error\" in parsed || parsed.expression.refs.some((ref) => ref.includes(\".\"))) return true;\n }\n return false;\n}\n\n/**\n * Whether writing `key` on a node of `type` leaves every laid-out box unchanged.\n *\n * Answered only for the library's own classes — a custom node may lay itself out\n * from anything — and there only for the props layout never reads.\n */\nexport function isLayoutNeutralProp(registry: Registry, type: string, key: string): boolean {\n const record = registry.node(type);\n if (!record || !coreLibrary().ctors.has(record.ctor)) return false;\n // Sound has no box, and the 2D walk skips an audio child.\n if (record.descriptor.dimension === \"audio\") return true;\n return NEUTRAL_KEYS.has(key);\n}\n\nconst LIFECYCLE = new Set([\"removeChildAt\", \"addChildAt\", \"reparent\"]);\n\nconst VARIABLE_COMMANDS = new Set([\"variableTo\", \"variableSet\"]);\n\nconst NEUTRAL_KEYS = new Set([\n \"x\", \"y\", \"rotation\", \"scale\", \"opacity\", \"fill\", \"stroke\", \"shadow\", \"overlay\",\n \"effects\", \"blend\", \"transformOrigin\", \"zoom\", \"lookAt\", \"heading\",\n]);\n\nconst DEFAULT_ROOT: NodeSpec = { id: ROOT_NODE_ID, type: \"canvas2d\", parentId: null, layerOrder: 0, props: {} };\n\n// Each command's behaviour, as the methods on its target it runs through. A class\n// overriding any of them is running something else under the command's name.\nconst TO = [\"to\", \"_prepareStep\", \"_writeProp\"];\nconst PAINT = [\"command\", \"set\", \"_writeProp\"];\n\nconst GLOBAL_NODE_COMMANDS: Readonly<Record<string, readonly string[]>> = {\n to: TO,\n set: [\"set\", \"_writeProp\"],\n save: [\"save\"],\n fillTo: [\"fillTo\", ...PAINT],\n overlayTo: [\"overlayTo\", ...PAINT],\n strokeTo: [\"strokeTo\", ...PAINT],\n shadowTo: [\"shadowTo\", ...PAINT],\n};\n\nconst NODE_COMMANDS: Readonly<Record<string, readonly string[]>> = {\n ...GLOBAL_NODE_COMMANDS,\n restore: [\"restore\", \"_prepareStep\", \"_writeProp\"],\n fadeTo: [\"fadeTo\", ...TO],\n rotateTo: [\"rotateTo\", ...TO],\n scaleTo: [\"scaleTo\", ...TO],\n moveTo: [\"moveTo\", ...TO, \"command\", \"set\"],\n zoomTo: [\"zoomTo\", ...TO],\n panTo: [\"panTo\", ...TO],\n headingTo: [\"headingTo\", ...TO],\n countTo: [\"countTo\", ...TO],\n append: [\"append\", ...TO],\n prepend: [\"prepend\", ...TO],\n};\n\n/** Named commands' writes. `to`/`set` write their args; absent means \"anything\". */\nconst WRITES: Readonly<Record<string, readonly string[]>> = {\n fadeTo: [\"opacity\"],\n rotateTo: [\"rotation\"],\n scaleTo: [\"scale\"],\n moveTo: [\"x\", \"y\"],\n zoomTo: [\"zoom\"],\n panTo: [\"lookAt\"],\n headingTo: [\"heading\"],\n fillTo: [\"fill\"],\n overlayTo: [\"overlay\"],\n strokeTo: [\"stroke\"],\n shadowTo: [\"shadow\"],\n};\n\n/** What a known command reads `from` — every command but the stamps. */\nconst READS_FROM = new Set(Object.keys(NODE_COMMANDS).filter((type) => type !== \"set\" && type !== \"save\"));\n\nfunction readsLayout(\n type: string,\n args: Record<string, unknown>,\n props: Record<string, unknown>,\n written: readonly string[] | undefined,\n): boolean {\n // Resolved against the node's own box the moment the step is prepared.\n if (hasAlignmentKey(args)) return true;\n // Aimed at another node's box.\n if (type === \"moveTo\" && typeof args.target === \"string\" && args.target !== \"\") return true;\n // An alignment-authored node's x/y are bindings over its box, and a node-ref\n // expression may read another node's (`[card.x]` on an aligned card); taking a\n // `from`, or a snapshot, evaluates them.\n const aligned = hasAlignmentKey(props);\n const refBound = nodeRefKeys(props);\n if (type === \"save\" || type === \"restore\") return aligned || refBound.size > 0;\n if (!READS_FROM.has(type)) return false;\n const touched = type === \"append\" || type === \"prepend\" ? [\"text\"] : type === \"countTo\" ? [\"value\"] : written ?? [];\n return touched.some((key) => refBound.has(key) || (aligned && (key === \"x\" || key === \"y\")));\n}\n\nfunction writtenKeys(type: string, args: Record<string, unknown>): readonly string[] | undefined {\n const named = WRITES[type];\n if (named) return named;\n if (type !== \"to\" && type !== \"set\") return undefined;\n const keys: string[] = [];\n for (const key of Object.keys(args)) {\n if (key === \"size\") keys.push(\"width\", \"height\");\n else if (type === \"to\" && key === \"pivot\") keys.push(\"transformOrigin\");\n else if (type === \"to\" && ALIGNMENT_KEYS.includes(key)) keys.push(\"x\", \"y\", \"transformOrigin\");\n else keys.push(key);\n }\n return keys;\n}\n\nfunction hasAlignmentKey(values: Record<string, unknown>): boolean {\n return ALIGNMENT_KEYS.some((key) => values[key] !== undefined);\n}\n\nconst REF_KEYS = new WeakMap<object, ReadonlySet<string>>();\n\n/** The top-level props of a row whose authored value reads another node. */\nfunction nodeRefKeys(props: Record<string, unknown>): ReadonlySet<string> {\n let keys = REF_KEYS.get(props);\n if (!keys) {\n const found = new Set<string>();\n for (const key of Object.keys(props)) {\n if (hasNodeRef(props[key])) found.add(key);\n }\n REF_KEYS.set(props, (keys = found));\n }\n return keys;\n}\n\nfunction methodOf(ctor: abstract new (...args: never[]) => unknown, name: string): unknown {\n return (ctor.prototype as Record<string, unknown>)[name];\n}\n\nconst KNOWN = new WeakMap<object, Map<readonly string[], boolean>>();\n\nfunction implementsCore(ctor: NodeConstructor, chain: readonly string[]): boolean {\n let byChain = KNOWN.get(ctor);\n if (!byChain) KNOWN.set(ctor, (byChain = new Map()));\n let known = byChain.get(chain);\n if (known === undefined) {\n // A method the class lacks entirely is not an override of one.\n known = chain.every((name) => {\n const impl = methodOf(ctor, name);\n return impl === undefined || coreImplementations(name).has(impl);\n });\n byChain.set(chain, known);\n }\n return known;\n}\n\ninterface CoreLibrary {\n ctors: ReadonlySet<NodeConstructor>;\n methods: Map<string, ReadonlySet<unknown>>;\n}\n\nlet core: CoreLibrary | null = null;\n\nfunction coreLibrary(): CoreLibrary {\n if (!core) {\n // A registry seeds itself with exactly what the library ships, so a fresh one is that list.\n const seeded = new Registry();\n core = { ctors: new Set(seeded.nodeKeys().map((key) => seeded.node(key)!.ctor)), methods: new Map() };\n }\n return core;\n}\n\n/** Every body the library's classes give `name`, base classes included. */\nfunction coreImplementations(name: string): ReadonlySet<unknown> {\n const library = coreLibrary();\n let impls = library.methods.get(name);\n if (!impls) {\n const found = new Set<unknown>();\n for (const ctor of library.ctors) {\n for (let proto = ctor.prototype; proto && proto !== Object.prototype; proto = Object.getPrototypeOf(proto)) {\n const own = Object.getOwnPropertyDescriptor(proto, name);\n if (own && typeof own.value === \"function\") found.add(own.value);\n }\n }\n library.methods.set(name, (impls = found));\n }\n return impls;\n}\n"]}
|
|
1
|
+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AAE,KAAK,IAAI,KAAK,KAAK,MAAM,CAAC,SAAS,EAAE,KAAK,GAAG,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC;gBACzG,MAAM,GAAG,GAAG,MAAM,CAAC,wBAAwB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;gBACzD,IAAI,GAAG,IAAI,OAAO,GAAG,CAAC,KAAK,KAAK,UAAU;oBAAE,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YACrE,CAAC;QACL,CAAC;QACD,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC;IAC/C,CAAC;IACD,OAAO,KAAK,CAAC;AACjB,CAAC","sourcesContent":["import { Node } from \"@/nodes/node/node\";\r\nimport { expressionOps } from \"./expression/ops\";\r\nimport { Registry, type NodeConstructor } from \"./registry\";\r\nimport type { CommandSpec, NodeSpec } from \"./types\";\r\nimport { ROOT_NODE_ID } from \"./types\";\r\n\r\n/**\r\n * What a command can do to the tree around it, read off the document and the\r\n * registry without building anything.\r\n *\r\n * Only the library's own implementations are described: a command resolving to a\r\n * subclass override or a component's method could do anything, so it is `known:\r\n * false` and assumed to read and write layout.\r\n */\r\nexport interface CommandTraits {\r\n scope: \"node\" | \"variable\";\r\n /** Resolves to the library's own implementation, so the rules below hold for it. */\r\n known: boolean;\r\n lifecycle: boolean;\r\n /** Building it can read a laid-out box, so it must be built against a settled tree. */\r\n readsLayout: boolean;\r\n /** Running it can change what layout computes. */\r\n writesLayout: boolean;\r\n}\r\n\r\n/** The nine named alignment props, which position a node against its own laid-out box. */\r\nexport const ALIGNMENT_KEYS: readonly string[] = [\r\n \"center\", \"topLeft\", \"topRight\", \"bottomLeft\", \"bottomRight\",\r\n \"topCenter\", \"bottomCenter\", \"centerLeft\", \"centerRight\",\r\n];\r\n\r\n/**\r\n * How a document command resolves, as `ClipTimeline._buildPlaced` resolves it,\r\n * and what it does — or `null` when it resolves to nothing (compiling it throws).\r\n * `target` is the command's target row; for `targetId: null` a document with no\r\n * explicit root row may pass `undefined`.\r\n */\r\nexport function commandTraits(registry: Registry, spec: CommandSpec, target: NodeSpec | undefined): CommandTraits | null {\r\n const lifecycle = LIFECYCLE.has(spec.type);\r\n const global = registry.command(spec.type);\r\n if (global?.scope === \"variable\") {\r\n const known = VARIABLE_COMMANDS.has(spec.type);\r\n return { scope: \"variable\", known, lifecycle, readsLayout: !known, writesLayout: false };\r\n }\r\n\r\n const row = target ?? (spec.targetId === null ? DEFAULT_ROOT : undefined);\r\n const record = row ? registry.node(row.type) : undefined;\r\n if (!row || !record) return null;\r\n\r\n let chain: readonly string[] | undefined;\r\n if (global) {\r\n chain = GLOBAL_NODE_COMMANDS[spec.type];\r\n if (chain && typeof methodOf(record.ctor, chain[0]) !== \"function\") return null;\r\n } else {\r\n const entry = record.commands.get(spec.type);\r\n if (!entry) return null;\r\n // A method published under a core command's key is not the core command.\r\n chain = entry.method === spec.type ? NODE_COMMANDS[spec.type] : undefined;\r\n }\r\n\r\n const known = !lifecycle && chain !== undefined && implementsCore(record.ctor, chain);\r\n if (!known) return { scope: \"node\", known, lifecycle, readsLayout: true, writesLayout: true };\r\n\r\n const args = spec.args ?? {};\r\n const props = row.props ?? {};\r\n const written = writtenKeys(spec.type, args);\r\n return {\r\n scope: \"node\",\r\n known,\r\n lifecycle,\r\n readsLayout: readsLayout(spec.type, args, props, written),\r\n writesLayout: written === undefined || written.some((key) => !isLayoutNeutralProp(registry, row.type, key)),\r\n };\r\n}\r\n\r\n/**\r\n * The node ids a command's args name through a `nodeRef` argument — the nodes\r\n * whose boxes it may read when it is built, beside its own target.\r\n */\r\nexport function commandNodeRefs(registry: Registry, spec: CommandSpec, target: NodeSpec | undefined): string[] {\r\n const global = registry.command(spec.type);\r\n const row = target ?? (spec.targetId === null ? DEFAULT_ROOT : undefined);\r\n const descriptors = global\r\n ? (global.scope === \"node\" ? global.args : undefined)\r\n : row ? registry.node(row.type)?.commands.get(spec.type)?.args : undefined;\r\n const refs: string[] = [];\r\n for (const descriptor of descriptors ?? []) {\r\n const value = spec.args?.[descriptor.key];\r\n if (descriptor.kind === \"nodeRef\" && typeof value === \"string\" && value !== \"\") refs.push(value);\r\n }\r\n return refs;\r\n}\r\n\r\n/** Whether `type` hands its descendants a context of its own. */\r\nexport function isContextProvider(registry: Registry, type: string): boolean {\r\n const ctor = registry.node(type)?.ctor;\r\n return ctor !== undefined && methodOf(ctor, \"provideContext\") !== methodOf(Node, \"provideContext\");\r\n}\r\n\r\n/**\r\n * Whether an authored value holds an expression reading another node's prop\r\n * (`[card.x]`), at any depth. An unparsable one counts: it fails the build anyway.\r\n */\r\nexport function hasNodeRef(value: unknown): boolean {\r\n for (const site of expressionOps.collect(value, \"\")) {\r\n const parsed = expressionOps.tryParse(site.source);\r\n if (\"error\" in parsed || parsed.expression.refs.some((ref) => ref.includes(\".\"))) return true;\r\n }\r\n return false;\r\n}\r\n\r\n/**\r\n * Whether writing `key` on a node of `type` leaves every laid-out box unchanged.\r\n *\r\n * Answered only for the library's own classes — a custom node may lay itself out\r\n * from anything — and there only for the props layout never reads.\r\n */\r\nexport function isLayoutNeutralProp(registry: Registry, type: string, key: string): boolean {\r\n const record = registry.node(type);\r\n if (!record || !coreLibrary().ctors.has(record.ctor)) return false;\r\n // Sound has no box, and the 2D walk skips an audio child.\r\n if (record.descriptor.dimension === \"audio\") return true;\r\n return NEUTRAL_KEYS.has(key);\r\n}\r\n\r\nconst LIFECYCLE = new Set([\"removeChildAt\", \"addChildAt\", \"reparent\"]);\r\n\r\nconst VARIABLE_COMMANDS = new Set([\"variableTo\", \"variableSet\"]);\r\n\r\nconst NEUTRAL_KEYS = new Set([\r\n \"x\", \"y\", \"rotation\", \"scale\", \"opacity\", \"fill\", \"stroke\", \"shadow\", \"overlay\",\r\n \"effects\", \"blend\", \"transformOrigin\", \"zoom\", \"lookAt\", \"heading\",\r\n]);\r\n\r\nconst DEFAULT_ROOT: NodeSpec = { id: ROOT_NODE_ID, type: \"canvas2d\", parentId: null, layerOrder: 0, props: {} };\r\n\r\n// Each command's behaviour, as the methods on its target it runs through. A class\r\n// overriding any of them is running something else under the command's name.\r\nconst TO = [\"to\", \"_prepareStep\", \"_writeProp\"];\r\nconst PAINT = [\"command\", \"set\", \"_writeProp\"];\r\n\r\nconst GLOBAL_NODE_COMMANDS: Readonly<Record<string, readonly string[]>> = {\r\n to: TO,\r\n set: [\"set\", \"_writeProp\"],\r\n save: [\"save\"],\r\n fillTo: [\"fillTo\", ...PAINT],\r\n overlayTo: [\"overlayTo\", ...PAINT],\r\n strokeTo: [\"strokeTo\", ...PAINT],\r\n shadowTo: [\"shadowTo\", ...PAINT],\r\n};\r\n\r\nconst NODE_COMMANDS: Readonly<Record<string, readonly string[]>> = {\r\n ...GLOBAL_NODE_COMMANDS,\r\n restore: [\"restore\", \"_prepareStep\", \"_writeProp\"],\r\n fadeTo: [\"fadeTo\", ...TO],\r\n rotateTo: [\"rotateTo\", ...TO],\r\n scaleTo: [\"scaleTo\", ...TO],\r\n layoutTo: [\"layoutTo\", ...TO],\r\n effectTo: [\"effectTo\", ...TO],\r\n progressTo: [\"progressTo\", ...TO],\r\n pulse: [\"pulse\", ...PAINT],\r\n wiggle: [\"wiggle\", ...PAINT],\r\n flash: [\"flash\", ...PAINT],\r\n moveTo: [\"moveTo\", ...TO, \"command\", \"set\"],\r\n zoomTo: [\"zoomTo\", ...TO],\r\n panTo: [\"panTo\", ...TO],\r\n headingTo: [\"headingTo\", ...TO],\r\n countTo: [\"countTo\", ...TO],\r\n append: [\"append\", ...TO],\r\n prepend: [\"prepend\", ...TO],\r\n // Plays its node's sound: scheduled ahead of time, writing nothing.\r\n play: [\"play\"],\r\n};\r\n\r\n/** Named commands' writes. `to`/`set` write their args; absent means \"anything\". */\r\nconst WRITES: Readonly<Record<string, readonly string[]>> = {\r\n fadeTo: [\"opacity\"],\r\n rotateTo: [\"rotation\"],\r\n scaleTo: [\"scale\"],\r\n layoutTo: [\"width\", \"height\", \"padding\"],\r\n effectTo: [\"effects\"],\r\n progressTo: [\"start\", \"end\"],\r\n pulse: [\"scale\"],\r\n wiggle: [\"rotation\"],\r\n flash: [\"start\", \"end\"],\r\n moveTo: [\"x\", \"y\"],\r\n zoomTo: [\"zoom\"],\r\n panTo: [\"lookAt\"],\r\n headingTo: [\"heading\"],\r\n fillTo: [\"fill\"],\r\n overlayTo: [\"overlay\"],\r\n strokeTo: [\"stroke\"],\r\n shadowTo: [\"shadow\"],\r\n play: [],\r\n};\r\n\r\n/** What a known command reads `from` — every command but the stamps. */\r\nconst READS_FROM = new Set(Object.keys(NODE_COMMANDS).filter((type) => type !== \"set\" && type !== \"save\"));\r\n\r\nfunction readsLayout(\r\n type: string,\r\n args: Record<string, unknown>,\r\n props: Record<string, unknown>,\r\n written: readonly string[] | undefined,\r\n): boolean {\r\n // Resolved against the node's own box the moment the step is prepared.\r\n if (hasAlignmentKey(args)) return true;\r\n // Aimed at another node's box.\r\n if (type === \"moveTo\" && typeof args.target === \"string\" && args.target !== \"\") return true;\r\n // An alignment-authored node's x/y are bindings over its box, and a node-ref\r\n // expression may read another node's (`[card.x]` on an aligned card); taking a\r\n // `from`, or a snapshot, evaluates them.\r\n const aligned = hasAlignmentKey(props);\r\n const refBound = nodeRefKeys(props);\r\n if (type === \"save\" || type === \"restore\") return aligned || refBound.size > 0;\r\n if (!READS_FROM.has(type)) return false;\r\n const touched = type === \"append\" || type === \"prepend\" ? [\"text\"] : type === \"countTo\" ? [\"value\"] : written ?? [];\r\n return touched.some((key) => refBound.has(key) || (aligned && (key === \"x\" || key === \"y\")));\r\n}\r\n\r\nfunction writtenKeys(type: string, args: Record<string, unknown>): readonly string[] | undefined {\r\n const named = WRITES[type];\r\n if (named) return named;\r\n if (type !== \"to\" && type !== \"set\") return undefined;\r\n const keys: string[] = [];\r\n for (const key of Object.keys(args)) {\r\n if (key === \"size\") keys.push(\"width\", \"height\");\r\n else if (type === \"to\" && key === \"pivot\") keys.push(\"transformOrigin\");\r\n else if (type === \"to\" && ALIGNMENT_KEYS.includes(key)) keys.push(\"x\", \"y\", \"transformOrigin\");\r\n else keys.push(key);\r\n }\r\n return keys;\r\n}\r\n\r\nfunction hasAlignmentKey(values: Record<string, unknown>): boolean {\r\n return ALIGNMENT_KEYS.some((key) => values[key] !== undefined);\r\n}\r\n\r\nconst REF_KEYS = new WeakMap<object, ReadonlySet<string>>();\r\n\r\n/** The top-level props of a row whose authored value reads another node. */\r\nfunction nodeRefKeys(props: Record<string, unknown>): ReadonlySet<string> {\r\n let keys = REF_KEYS.get(props);\r\n if (!keys) {\r\n const found = new Set<string>();\r\n for (const key of Object.keys(props)) {\r\n if (hasNodeRef(props[key])) found.add(key);\r\n }\r\n REF_KEYS.set(props, (keys = found));\r\n }\r\n return keys;\r\n}\r\n\r\nfunction methodOf(ctor: abstract new (...args: never[]) => unknown, name: string): unknown {\r\n return (ctor.prototype as Record<string, unknown>)[name];\r\n}\r\n\r\nconst KNOWN = new WeakMap<object, Map<readonly string[], boolean>>();\r\n\r\nfunction implementsCore(ctor: NodeConstructor, chain: readonly string[]): boolean {\r\n let byChain = KNOWN.get(ctor);\r\n if (!byChain) KNOWN.set(ctor, (byChain = new Map()));\r\n let known = byChain.get(chain);\r\n if (known === undefined) {\r\n // A method the class lacks entirely is not an override of one.\r\n known = chain.every((name) => {\r\n const impl = methodOf(ctor, name);\r\n return impl === undefined || coreImplementations(name).has(impl);\r\n });\r\n byChain.set(chain, known);\r\n }\r\n return known;\r\n}\r\n\r\ninterface CoreLibrary {\r\n ctors: ReadonlySet<NodeConstructor>;\r\n methods: Map<string, ReadonlySet<unknown>>;\r\n}\r\n\r\nlet core: CoreLibrary | null = null;\r\n\r\nfunction coreLibrary(): CoreLibrary {\r\n if (!core) {\r\n // A registry seeds itself with exactly what the library ships, so a fresh one is that list.\r\n const seeded = new Registry();\r\n core = { ctors: new Set(seeded.nodeKeys().map((key) => seeded.node(key)!.ctor)), methods: new Map() };\r\n }\r\n return core;\r\n}\r\n\r\n/** Every body the library's classes give `name`, base classes included. */\r\nfunction coreImplementations(name: string): ReadonlySet<unknown> {\r\n const library = coreLibrary();\r\n let impls = library.methods.get(name);\r\n if (!impls) {\r\n const found = new Set<unknown>();\r\n for (const ctor of library.ctors) {\r\n for (let proto = ctor.prototype; proto && proto !== Object.prototype; proto = Object.getPrototypeOf(proto)) {\r\n const own = Object.getOwnPropertyDescriptor(proto, name);\r\n if (own && typeof own.value === \"function\") found.add(own.value);\r\n }\r\n }\r\n library.methods.set(name, (impls = found));\r\n }\r\n return impls;\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deny-globals.js","sourceRoot":"","sources":["../../src/document/deny-globals.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,cAAc,GAAsB;IAC7C,2DAA2D;IAC3D,YAAY;IACZ,QAAQ;IACR,MAAM;IACN,KAAK;IACL,QAAQ;IACR,QAAQ;IAER,wBAAwB;IACxB,EAAE;IACF,2EAA2E;IAC3E,kEAAkE;IAClE,yEAAyE;IACzE,2EAA2E;IAC3E,yDAAyD;IACzD,UAAU;IACV,eAAe;IAEf,oDAAoD;IACpD,UAAU;IACV,WAAW;IACX,UAAU;IACV,SAAS;IACT,QAAQ;IACR,gBAAgB;IAEhB,iEAAiE;IACjE,+CAA+C;IAC/C,OAAO;IACP,gBAAgB;IAChB,WAAW;IACX,aAAa;IACb,SAAS;IACT,UAAU;IACV,SAAS;IAET,sCAAsC;IACtC,cAAc;IACd,gBAAgB;IAChB,WAAW;IACX,QAAQ;IACR,aAAa;IACb,QAAQ;IAER,qCAAqC;IACrC,QAAQ;IACR,cAAc;IACd,eAAe;IACf,gBAAgB;IAChB,kBAAkB;IAClB,aAAa;IAEb,6DAA6D;IAC7D,OAAO;IACP,SAAS;IACT,QAAQ;IACR,MAAM;IACN,OAAO;IACP,cAAc;CACjB,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC;AAElD,MAAM,OAAO,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;AACtE,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;IACrB,MAAM,IAAI,KAAK,CACX,iCAAiC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,wBAAwB;QACvE,uFAAuF,CAC9F,CAAC;AACN,CAAC","sourcesContent":["/**\n * The ambient capabilities a dynamic node's compiled source is denied.\n *\n * ## What this is, and what it very deliberately is not\n *\n * A dynamic node's compiled JS is evaluated with `new Function` **in the\n * host's own realm**, and that is forced by the architecture rather than\n * chosen: the node it produces has to be a live class that satisfies\n * `instanceof` against the host's own already-loaded `core`, and participate\n * in the same per-frame reactive `@property` graph. A live class instance\n * cannot cross a worker or cross-origin iframe boundary, so the usual \"run it\n * in another realm\" answer is closed off by what the renderer is, not by how\n * much effort is spent on it.\n *\n * What *is* possible in one realm is taking the dangerous names out of scope.\n * Every identifier below becomes a parameter of the `new Function` factory\n * bound to `undefined`, so `fetch(...)` inside a compiled node is a call on\n * `undefined` rather than a network request. Under `\"use strict\"` — which the\n * factory already sets — a bare `this` is `undefined` too, so the usual back\n * door is shut.\n *\n * **This is hardening, not a sandbox.** A determined script can still reach\n * the real global object through the intrinsics: `({}).constructor.constructor`\n * is `Function`, and `Function(\"return globalThis\")()` walks straight back\n * out. Closing that would mean freezing or poisoning `Object.prototype`,\n * `Function` and every async/generator constructor, which breaks the engine\n * itself — it subclasses, it uses decorators, it builds objects constantly.\n * So the honest security boundary is not this file. It is whatever gate the\n * *host* puts in front of calling `Registry.addNodeFromSource` at all — a\n * compiled node's source is not evaluated until something upstream decides\n * it should be.\n *\n * This file's job is to make the easy paths closed, the accidents impossible,\n * and the escape require obvious intent that a reviewer would notice.\n */\n\n/**\n * Names bound to `undefined` in every dynamic node module's scope.\n *\n * Grouped by what they'd be used for, because the list is only auditable if\n * you can see what each entry is keeping out. Adding a browser API here is\n * cheap; leaving one out is the bug.\n *\n * This engine's `Registry` only ever evaluates a dynamic node inside a\n * browser-realm page (a real browser tab, or headless's own Playwright page —\n * never bare Node), so this list is scoped to that one realm rather than also\n * covering Node globals (`process`, `require`, `global`) that never apply\n * here.\n */\nexport const DENIED_GLOBALS: readonly string[] = [\n // Reaching the global object, and from it everything else.\n \"globalThis\",\n \"window\",\n \"self\",\n \"top\",\n \"parent\",\n \"frames\",\n\n // Evaluating more code.\n //\n // `eval` is missing on purpose and cannot be added: strict mode forbids it\n // as a binding name, so naming it here makes `new Function` throw\n // \"Unexpected eval or arguments in strict mode\" and *every* dynamic node\n // stops linking. It stays reachable, which is one more reason this file is\n // not the security boundary — see the module note above.\n \"Function\",\n \"importScripts\",\n\n // The DOM: reading the page, and `document.cookie`.\n \"document\",\n \"navigator\",\n \"location\",\n \"history\",\n \"screen\",\n \"customElements\",\n\n // Anywhere to send what was found. (`navigator.sendBeacon` needs\n // `navigator`, which is already denied above.)\n \"fetch\",\n \"XMLHttpRequest\",\n \"WebSocket\",\n \"EventSource\",\n \"Request\",\n \"Response\",\n \"Headers\",\n\n // Anywhere to read a credential from.\n \"localStorage\",\n \"sessionStorage\",\n \"indexedDB\",\n \"caches\",\n \"cookieStore\",\n \"crypto\",\n\n // Other threads and other documents.\n \"Worker\",\n \"SharedWorker\",\n \"ServiceWorker\",\n \"MessageChannel\",\n \"BroadcastChannel\",\n \"postMessage\",\n\n // Things that ask the user for something, or leave the page.\n \"alert\",\n \"confirm\",\n \"prompt\",\n \"open\",\n \"print\",\n \"Notification\",\n];\n\n/**\n * Names strict mode refuses to bind, and which would therefore break linking\n * for every dynamic node rather than protecting anything.\n *\n * Checked rather than trusted: adding one to the list above is an easy\n * mistake that fails at *evaluation* time, on whichever node happens to\n * compile first, with an error naming neither the list nor the culprit.\n */\nconst UNBINDABLE = new Set([\"eval\", \"arguments\"]);\n\nconst illegal = DENIED_GLOBALS.filter((name) => UNBINDABLE.has(name));\nif (illegal.length > 0) {\n throw new Error(\n `DENIED_GLOBALS cannot contain ${illegal.join(\", \")}: strict mode forbids ` +\n `binding those names, so no dynamic node would link at all. See the note in this file.`,\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"deny-globals.js","sourceRoot":"","sources":["../../src/document/deny-globals.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,cAAc,GAAsB;IAC7C,2DAA2D;IAC3D,YAAY;IACZ,QAAQ;IACR,MAAM;IACN,KAAK;IACL,QAAQ;IACR,QAAQ;IAER,wBAAwB;IACxB,EAAE;IACF,2EAA2E;IAC3E,kEAAkE;IAClE,yEAAyE;IACzE,2EAA2E;IAC3E,yDAAyD;IACzD,UAAU;IACV,eAAe;IAEf,oDAAoD;IACpD,UAAU;IACV,WAAW;IACX,UAAU;IACV,SAAS;IACT,QAAQ;IACR,gBAAgB;IAEhB,iEAAiE;IACjE,+CAA+C;IAC/C,OAAO;IACP,gBAAgB;IAChB,WAAW;IACX,aAAa;IACb,SAAS;IACT,UAAU;IACV,SAAS;IAET,sCAAsC;IACtC,cAAc;IACd,gBAAgB;IAChB,WAAW;IACX,QAAQ;IACR,aAAa;IACb,QAAQ;IAER,qCAAqC;IACrC,QAAQ;IACR,cAAc;IACd,eAAe;IACf,gBAAgB;IAChB,kBAAkB;IAClB,aAAa;IAEb,6DAA6D;IAC7D,OAAO;IACP,SAAS;IACT,QAAQ;IACR,MAAM;IACN,OAAO;IACP,cAAc;CACjB,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC;AAElD,MAAM,OAAO,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;AACtE,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;IACrB,MAAM,IAAI,KAAK,CACX,iCAAiC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,wBAAwB;QACvE,uFAAuF,CAC9F,CAAC;AACN,CAAC","sourcesContent":["/**\r\n * The ambient capabilities a dynamic node's compiled source is denied.\r\n *\r\n * ## What this is, and what it very deliberately is not\r\n *\r\n * A dynamic node's compiled JS is evaluated with `new Function` **in the\r\n * host's own realm**, and that is forced by the architecture rather than\r\n * chosen: the node it produces has to be a live class that satisfies\r\n * `instanceof` against the host's own already-loaded `core`, and participate\r\n * in the same per-frame reactive `@property` graph. A live class instance\r\n * cannot cross a worker or cross-origin iframe boundary, so the usual \"run it\r\n * in another realm\" answer is closed off by what the renderer is, not by how\r\n * much effort is spent on it.\r\n *\r\n * What *is* possible in one realm is taking the dangerous names out of scope.\r\n * Every identifier below becomes a parameter of the `new Function` factory\r\n * bound to `undefined`, so `fetch(...)` inside a compiled node is a call on\r\n * `undefined` rather than a network request. Under `\"use strict\"` — which the\r\n * factory already sets — a bare `this` is `undefined` too, so the usual back\r\n * door is shut.\r\n *\r\n * **This is hardening, not a sandbox.** A determined script can still reach\r\n * the real global object through the intrinsics: `({}).constructor.constructor`\r\n * is `Function`, and `Function(\"return globalThis\")()` walks straight back\r\n * out. Closing that would mean freezing or poisoning `Object.prototype`,\r\n * `Function` and every async/generator constructor, which breaks the engine\r\n * itself — it subclasses, it uses decorators, it builds objects constantly.\r\n * So the honest security boundary is not this file. It is whatever gate the\r\n * *host* puts in front of calling `Registry.addNodeFromSource` at all — a\r\n * compiled node's source is not evaluated until something upstream decides\r\n * it should be.\r\n *\r\n * This file's job is to make the easy paths closed, the accidents impossible,\r\n * and the escape require obvious intent that a reviewer would notice.\r\n */\r\n\r\n/**\r\n * Names bound to `undefined` in every dynamic node module's scope.\r\n *\r\n * Grouped by what they'd be used for, because the list is only auditable if\r\n * you can see what each entry is keeping out. Adding a browser API here is\r\n * cheap; leaving one out is the bug.\r\n *\r\n * This engine's `Registry` only ever evaluates a dynamic node inside a\r\n * browser-realm page (a real browser tab, or headless's own Playwright page —\r\n * never bare Node), so this list is scoped to that one realm rather than also\r\n * covering Node globals (`process`, `require`, `global`) that never apply\r\n * here.\r\n */\r\nexport const DENIED_GLOBALS: readonly string[] = [\r\n // Reaching the global object, and from it everything else.\r\n \"globalThis\",\r\n \"window\",\r\n \"self\",\r\n \"top\",\r\n \"parent\",\r\n \"frames\",\r\n\r\n // Evaluating more code.\r\n //\r\n // `eval` is missing on purpose and cannot be added: strict mode forbids it\r\n // as a binding name, so naming it here makes `new Function` throw\r\n // \"Unexpected eval or arguments in strict mode\" and *every* dynamic node\r\n // stops linking. It stays reachable, which is one more reason this file is\r\n // not the security boundary — see the module note above.\r\n \"Function\",\r\n \"importScripts\",\r\n\r\n // The DOM: reading the page, and `document.cookie`.\r\n \"document\",\r\n \"navigator\",\r\n \"location\",\r\n \"history\",\r\n \"screen\",\r\n \"customElements\",\r\n\r\n // Anywhere to send what was found. (`navigator.sendBeacon` needs\r\n // `navigator`, which is already denied above.)\r\n \"fetch\",\r\n \"XMLHttpRequest\",\r\n \"WebSocket\",\r\n \"EventSource\",\r\n \"Request\",\r\n \"Response\",\r\n \"Headers\",\r\n\r\n // Anywhere to read a credential from.\r\n \"localStorage\",\r\n \"sessionStorage\",\r\n \"indexedDB\",\r\n \"caches\",\r\n \"cookieStore\",\r\n \"crypto\",\r\n\r\n // Other threads and other documents.\r\n \"Worker\",\r\n \"SharedWorker\",\r\n \"ServiceWorker\",\r\n \"MessageChannel\",\r\n \"BroadcastChannel\",\r\n \"postMessage\",\r\n\r\n // Things that ask the user for something, or leave the page.\r\n \"alert\",\r\n \"confirm\",\r\n \"prompt\",\r\n \"open\",\r\n \"print\",\r\n \"Notification\",\r\n];\r\n\r\n/**\r\n * Names strict mode refuses to bind, and which would therefore break linking\r\n * for every dynamic node rather than protecting anything.\r\n *\r\n * Checked rather than trusted: adding one to the list above is an easy\r\n * mistake that fails at *evaluation* time, on whichever node happens to\r\n * compile first, with an error naming neither the list nor the culprit.\r\n */\r\nconst UNBINDABLE = new Set([\"eval\", \"arguments\"]);\r\n\r\nconst illegal = DENIED_GLOBALS.filter((name) => UNBINDABLE.has(name));\r\nif (illegal.length > 0) {\r\n throw new Error(\r\n `DENIED_GLOBALS cannot contain ${illegal.join(\", \")}: strict mode forbids ` +\r\n `binding those names, so no dynamic node would link at all. See the note in this file.`,\r\n );\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diff.d.ts","sourceRoot":"","sources":["../../src/document/diff.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"diff.d.ts","sourceRoot":"","sources":["../../src/document/diff.ts"],"names":[],"mappings":"AACA,OAAO,EAIH,KAAK,YAAY,EAMpB,MAAM,SAAS,CAAC;AAEjB;;;GAGG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,GAAG,OAAO,CA0BzD;AAED,MAAM,WAAW,UAAU;IACvB,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACnB,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACrB,+DAA+D;IAC/D,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CACxB;AAED,MAAM,WAAW,QAAQ;IACrB,wEAAwE;IACxE,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,EAAE,OAAO,CAAC;IACrB,YAAY,EAAE,OAAO,CAAC;IACtB,WAAW,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,UAAU,GAAG;QAChB,uCAAuC;QACvC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;QACpB,0BAA0B;QAC1B,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;QACnB,6CAA6C;QAC7C,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;QAClB,yFAAyF;QACzF,gBAAgB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;KACjC,CAAC;IACF,QAAQ,EAAE,UAAU,GAAG;QACnB,kFAAkF;QAClF,YAAY,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;KAC7B,CAAC;IACF,4EAA4E;IAC5E,SAAS,EAAE,UAAU,CAAC;IACtB,gEAAgE;IAChE,YAAY,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CAC7B;AAmBD;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,YAAY,GAAG,QAAQ,CA8BzE"}
|
package/dist/document/diff.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { documentDuration,
|
|
1
|
+
import { clipDocument } from "./audio.js";
|
|
2
|
+
import { documentDuration, nodeSpan, ROOT_NODE_ID, } from "./types.js";
|
|
3
3
|
/**
|
|
4
4
|
* Deep equality over JSON values: key order is irrelevant, an `undefined`-valued
|
|
5
5
|
* key equals an absent one (neither survives serialization), arrays are ordered.
|
|
@@ -92,7 +92,7 @@ export function diffClip(prev, next) {
|
|
|
92
92
|
return diff;
|
|
93
93
|
}
|
|
94
94
|
function lowered(doc) {
|
|
95
|
-
return
|
|
95
|
+
return clipDocument(doc);
|
|
96
96
|
}
|
|
97
97
|
function rowsEmpty(rows) {
|
|
98
98
|
return rows.added.size === 0 && rows.removed.size === 0 && rows.changed.size === 0;
|