@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 +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OAAO,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;gBACnD,MAAM,IAAI,eAAe,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC;YAC1E,CAAC;YACD;gBACI,MAAM,IAAI,eAAe,CACrB,CAAC,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,IAAI,GAAG,EACrE,MAAM,EAAE,CAAC,CAAC,GAAG,CAChB,CAAC;QACV,CAAC;IACL,CAAC;IAED,MAAM,IAAI,GAAG,aAAa,EAAE,CAAC;IAC7B,MAAM,QAAQ,GAAG,IAAI,EAAE,CAAC;IACxB,IAAI,QAAQ,CAAC,IAAI,KAAK,KAAK;QAAE,MAAM,IAAI,eAAe,CAAC,eAAe,QAAQ,CAAC,IAAI,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC;IAE9G,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,CAAC,IAAI,KAAK,KAAK,EAAE,CAAC;AACpE,CAAC","sourcesContent":["/**\n * The one scanner and the one grammar, plus the document's own dialect.\n *\n * There were two of each — this module's, and the function-plot language in\n * `@motionscript/plot` — and they agreed on every rule they documented while\n * disagreeing on the parts nobody wrote down. Plot scanned `1.2.3` as a single\n * token, which `Number` turned into a `NaN` that parsed, compiled and rendered\n * an entirely invisible surface with no diagnostic anywhere. It treated `\\r` as\n * an unexpected character, so a pasted CRLF equation failed. It checked no arity\n * on its variadic functions, so `atan2(1)` was a silent `NaN`.\n *\n * What the two genuinely disagree about is a *table*: which functions exist,\n * whether `sin` takes degrees or radians, and how a reference is spelled. That\n * is {@link ExpressionDialect}, and it is the only thing this file is\n * parameterized by.\n *\n * Precedence is the ordinary arithmetic one, with `^` right-associative and\n * **implicit multiplication** between adjacent primaries — which is what makes\n * `4[g]+3` mean what it reads as. Note `unary` sits *above* `power`, so `-2^2`\n * is `-4` as in maths, and the exponent parses as a unary so `2^3^2` is 512 and\n * `2^-3` is legal.\n */\nimport { ExpressionError } from \"./types\";\nimport type { BinaryOp, ExpressionDialect, ExpressionNode, FnArity, ParsedExpression } from \"./types\";\n\nconst DEG = Math.PI / 180;\n\ninterface DocumentFn extends FnArity {\n apply(args: number[]): number;\n}\n\n/**\n * The document's function library.\n *\n * Deliberately small and closed: an expression is stored in a document and\n * evaluated by whatever version of the library opens it later, so every name\n * here is as much a public contract as an exported symbol. Trig is in **degrees**\n * because every other angle in the library is.\n */\nexport const DOCUMENT_FUNCTIONS: Record<string, DocumentFn> = {\n abs: { arity: [1, 1], apply: (a) => Math.abs(a[0]) },\n sign: { arity: [1, 1], apply: (a) => Math.sign(a[0]) },\n sqrt: { arity: [1, 1], apply: (a) => Math.sqrt(a[0]) },\n floor: { arity: [1, 1], apply: (a) => Math.floor(a[0]) },\n ceil: { arity: [1, 1], apply: (a) => Math.ceil(a[0]) },\n round: { arity: [1, 2], apply: (a) => (a.length > 1 && a[1] !== 0 ? Math.round(a[0] / a[1]) * a[1] : Math.round(a[0])) },\n min: { arity: [1, Infinity], apply: (a) => Math.min(...a) },\n max: { arity: [1, Infinity], apply: (a) => Math.max(...a) },\n clamp: { arity: [3, 3], apply: (a) => Math.min(Math.max(a[0], a[1]), a[2]) },\n mod: { arity: [2, 2], apply: (a) => ((a[0] % a[1]) + a[1]) % a[1] },\n pow: { arity: [2, 2], apply: (a) => a[0] ** a[1] },\n log: { arity: [1, 2], apply: (a) => (a.length > 1 ? Math.log(a[0]) / Math.log(a[1]) : Math.log(a[0])) },\n exp: { arity: [1, 1], apply: (a) => Math.exp(a[0]) },\n mix: { arity: [3, 3], apply: (a) => a[0] + (a[1] - a[0]) * a[2] },\n smoothstep: {\n arity: [3, 3],\n apply: (a) => {\n const t = Math.min(Math.max((a[2] - a[0]) / (a[1] - a[0] || 1), 0), 1);\n return t * t * (3 - 2 * t);\n },\n },\n step: { arity: [2, 2], apply: (a) => (a[1] < a[0] ? 0 : 1) },\n sin: { arity: [1, 1], apply: (a) => Math.sin(a[0] * DEG) },\n cos: { arity: [1, 1], apply: (a) => Math.cos(a[0] * DEG) },\n tan: { arity: [1, 1], apply: (a) => Math.tan(a[0] * DEG) },\n asin: { arity: [1, 1], apply: (a) => Math.asin(a[0]) / DEG },\n acos: { arity: [1, 1], apply: (a) => Math.acos(a[0]) / DEG },\n atan: { arity: [1, 1], apply: (a) => Math.atan(a[0]) / DEG },\n atan2: { arity: [2, 2], apply: (a) => Math.atan2(a[0], a[1]) / DEG },\n hypot: { arity: [2, Infinity], apply: (a) => Math.hypot(...a) },\n};\n\n/** Bare identifiers that are values rather than calls. */\nconst DOCUMENT_CONSTANTS: Record<string, number> = {\n pi: Math.PI,\n tau: Math.PI * 2,\n e: Math.E,\n};\n\n/** The language a `\"=…\"` prop is written in. */\nexport const DOCUMENT_DIALECT: ExpressionDialect = {\n functions: DOCUMENT_FUNCTIONS,\n constants: DOCUMENT_CONSTANTS,\n refs: \"bracket\",\n unknownName: (name) =>\n `unknown name \"${name}\" — a variable is referenced as \"[${name}]\"; ` +\n `bare names are the constants ${sortedKeys(DOCUMENT_CONSTANTS).join(\", \")}`,\n};\n\n/** Sorted, so a message or a completion list is stable. */\nexport function sortedKeys(table: Record<string, unknown>): string[] {\n return Object.keys(table).sort();\n}\n\n// ── Scanner ──────────────────────────────────────────────────────────────────\n\ntype TokenKind = \"number\" | \"ref\" | \"ident\" | \"op\" | \"(\" | \")\" | \",\" | \"end\";\n\ninterface Token {\n kind: TokenKind;\n /** The identifier, operator or reference name. Empty for numbers. */\n text: string;\n /** Parsed value, for numbers. */\n value: number;\n pos: number;\n}\n\nconst OPERATORS = new Set([\"+\", \"-\", \"*\", \"/\", \"%\", \"^\"]);\n\nfunction isDigit(ch: string | undefined): boolean {\n return ch !== undefined && ch >= \"0\" && ch <= \"9\";\n}\n\nfunction tokenize(source: string, dialect: ExpressionDialect): Token[] {\n const tokens: Token[] = [];\n let i = 0;\n\n while (i < source.length) {\n const ch = source[i];\n\n if (ch === \" \" || ch === \"\\t\" || ch === \"\\n\" || ch === \"\\r\") {\n i++;\n continue;\n }\n\n if (isDigit(ch) || (ch === \".\" && isDigit(source[i + 1]))) {\n const start = i;\n while (isDigit(source[i])) i++;\n if (source[i] === \".\") {\n i++;\n while (isDigit(source[i])) i++;\n }\n if (source[i] === \"e\" || source[i] === \"E\") {\n const mark = i;\n i++;\n if (source[i] === \"+\" || source[i] === \"-\") i++;\n if (isDigit(source[i])) {\n while (isDigit(source[i])) i++;\n } else {\n // `2e` followed by something else is `2` times the identifier\n // `e`, not a malformed exponent.\n i = mark;\n }\n }\n // A second `.` ends a number that has already had one. Both parsers\n // this replaces got here differently and both got it wrong: one\n // scanned `1.2.3` as a single token that `Number` turned into a\n // silent `NaN`, the other split it into `1.2 * 0.3`. Neither is\n // anything anyone wrote on purpose.\n if (source[i] === \".\") throw new ExpressionError('unexpected character \".\"', source, i);\n tokens.push({ kind: \"number\", text: \"\", value: Number(source.slice(start, i)), pos: start });\n continue;\n }\n\n // `[` is legal only where a reference is spelled with one, so a plot\n // equation gets \"unexpected character\" here rather than failing later\n // with a message about variable references it has never heard of.\n if (ch === \"[\" && dialect.refs === \"bracket\") {\n const start = i;\n const end = source.indexOf(\"]\", i + 1);\n if (end === -1) throw new ExpressionError(\"unclosed `[` — a variable reference is written `[id]`\", source, start);\n const name = source.slice(i + 1, end).trim();\n if (name.length === 0) throw new ExpressionError(\"empty variable reference `[]`\", source, start);\n if (name.includes(\"[\")) throw new ExpressionError(\"variable references cannot nest\", source, start);\n tokens.push({ kind: \"ref\", text: name, value: 0, pos: start });\n i = end + 1;\n continue;\n }\n\n if (/[A-Za-z_]/.test(ch)) {\n const start = i;\n while (i < source.length && /[A-Za-z0-9_]/.test(source[i])) i++;\n tokens.push({ kind: \"ident\", text: source.slice(start, i), value: 0, pos: start });\n continue;\n }\n\n if (OPERATORS.has(ch)) {\n tokens.push({ kind: \"op\", text: ch, value: 0, pos: i++ });\n continue;\n }\n if (ch === \"(\" || ch === \")\" || ch === \",\") {\n tokens.push({ kind: ch as TokenKind, text: ch, value: 0, pos: i++ });\n continue;\n }\n\n throw new ExpressionError(`unexpected character \"${ch}\"`, source, i);\n }\n\n tokens.push({ kind: \"end\", text: \"\", value: 0, pos: source.length });\n return tokens;\n}\n\n// ── Grammar ──────────────────────────────────────────────────────────────────\n\n/**\n * Parse a formula against a dialect.\n *\n * `source` is the formula alone — the document's `=` is stripped by the walk\n * that recognised it, because the marker is not part of any grammar.\n */\nexport function parse(source: string, dialect: ExpressionDialect = DOCUMENT_DIALECT): ParsedExpression {\n if (source.trim().length === 0) throw new ExpressionError(\"empty expression\", source);\n\n const tokens = tokenize(source, dialect);\n const refs: string[] = [];\n let index = 0;\n\n const peek = (): Token => tokens[index];\n const next = (): Token => tokens[index++];\n\n const addRef = (name: string): ExpressionNode => {\n if (!refs.includes(name)) refs.push(name);\n return { kind: \"ref\", name };\n };\n\n /** True when the token can begin a primary — the test implicit `*` turns on. */\n const startsPrimary = (t: Token): boolean =>\n t.kind === \"number\" || t.kind === \"ref\" || t.kind === \"ident\" || t.kind === \"(\";\n\n function parseAdditive(): ExpressionNode {\n let left = parseMultiplicative();\n for (;;) {\n const t = peek();\n if (t.kind === \"op\" && (t.text === \"+\" || t.text === \"-\")) {\n next();\n left = { kind: \"binary\", op: t.text, left, right: parseMultiplicative() };\n continue;\n }\n return left;\n }\n }\n\n function parseMultiplicative(): ExpressionNode {\n let left = parseUnary();\n for (;;) {\n const t = peek();\n if (t.kind === \"op\" && (t.text === \"*\" || t.text === \"/\" || t.text === \"%\")) {\n next();\n left = { kind: \"binary\", op: t.text as BinaryOp, left, right: parseUnary() };\n continue;\n }\n // `4[g]`, `2(x+1)`, `[a][b]`, `2pi` — juxtaposition is multiplication.\n if (startsPrimary(t)) {\n left = { kind: \"binary\", op: \"*\", left, right: parseUnary() };\n continue;\n }\n return left;\n }\n }\n\n function parseUnary(): ExpressionNode {\n const t = peek();\n if (t.kind === \"op\" && (t.text === \"-\" || t.text === \"+\")) {\n next();\n const operand = parseUnary();\n return t.text === \"-\" ? { kind: \"unary\", op: \"-\", operand } : operand;\n }\n return parsePower();\n }\n\n function parsePower(): ExpressionNode {\n const base = parsePrimary();\n const t = peek();\n if (t.kind === \"op\" && t.text === \"^\") {\n next();\n // Right-associative, and binding tighter than unary minus on its\n // right: `2^-1` is a half, not an error.\n return { kind: \"binary\", op: \"^\", left: base, right: parseUnary() };\n }\n return base;\n }\n\n function parseCall(name: string, pos: number): ExpressionNode {\n const def = dialect.functions[name];\n if (!def) {\n throw new ExpressionError(\n `unknown function \"${name}\" — available: ${sortedKeys(dialect.functions).join(\", \")}`,\n source, pos,\n );\n }\n const args: ExpressionNode[] = [];\n if (peek().kind !== \")\") {\n for (;;) {\n args.push(parseAdditive());\n if (peek().kind !== \",\") break;\n next();\n }\n }\n const close = next();\n if (close.kind !== \")\") throw new ExpressionError(`expected \\`)\\` closing ${name}(`, source, close.pos);\n\n const [min, max] = def.arity;\n if (args.length < min || args.length > max) {\n const want = max === Infinity ? `at least ${min}` : min === max ? `${min}` : `${min}–${max}`;\n throw new ExpressionError(\n `${name}() takes ${want} argument${max === 1 ? \"\" : \"s\"}, got ${args.length}`,\n source, pos,\n );\n }\n return { kind: \"call\", name, args };\n }\n\n function parsePrimary(): ExpressionNode {\n const t = next();\n switch (t.kind) {\n case \"number\":\n return { kind: \"const\", value: t.value };\n case \"ref\":\n return addRef(t.text);\n case \"(\": {\n const inner = parseAdditive();\n const close = next();\n if (close.kind !== \")\") throw new ExpressionError(\"expected `)`\", source, close.pos);\n return inner;\n }\n case \"ident\": {\n if (peek().kind === \"(\") {\n next();\n return parseCall(t.text, t.pos);\n }\n // A constant is folded here, before a bare identifier can become\n // a reference — so a dialect's constant name can never also be\n // one of its free variables.\n const constant = dialect.constants[t.text];\n if (constant !== undefined) return { kind: \"const\", value: constant };\n if (dialect.refs === \"bare\") return addRef(t.text);\n throw new ExpressionError(dialect.unknownName(t.text), source, t.pos);\n }\n default:\n throw new ExpressionError(\n t.kind === \"end\" ? \"expression ends early\" : `unexpected \"${t.text}\"`,\n source, t.pos,\n );\n }\n }\n\n const root = parseAdditive();\n const trailing = peek();\n if (trailing.kind !== \"end\") throw new ExpressionError(`unexpected \"${trailing.text}\"`, source, trailing.pos);\n\n return { source, root, refs, passthrough: root.kind === \"ref\" };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"parse.js","sourceRoot":"","sources":["../../../src/document/expression/parse.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAG1C,MAAM,GAAG,GAAG,IAAI,CAAC,EAAE,GAAG,GAAG,CAAC;AAM1B;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAA+B;IAC1D,GAAG,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE;IACpD,IAAI,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE;IACtD,IAAI,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE;IACtD,KAAK,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE,EAA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,CAAC,IAAI,CAAC,CAAC;gBACnD,MAAM,IAAI,eAAe,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC;YAC1E,CAAC;YACD;gBACI,MAAM,IAAI,eAAe,CACrB,CAAC,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,IAAI,GAAG,EACrE,MAAM,EAAE,CAAC,CAAC,GAAG,CAChB,CAAC;QACV,CAAC;IACL,CAAC;IAED,MAAM,IAAI,GAAG,aAAa,EAAE,CAAC;IAC7B,MAAM,QAAQ,GAAG,IAAI,EAAE,CAAC;IACxB,IAAI,QAAQ,CAAC,IAAI,KAAK,KAAK;QAAE,MAAM,IAAI,eAAe,CAAC,eAAe,QAAQ,CAAC,IAAI,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC;IAE9G,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,CAAC,IAAI,KAAK,KAAK,EAAE,CAAC;AACpE,CAAC","sourcesContent":["/**\r\n * The one scanner and the one grammar, plus the document's own dialect.\r\n *\r\n * There were two of each — this module's, and the function-plot language in\r\n * `@motionscript/math` — and they agreed on every rule they documented while\r\n * disagreeing on the parts nobody wrote down. Plot scanned `1.2.3` as a single\r\n * token, which `Number` turned into a `NaN` that parsed, compiled and rendered\r\n * an entirely invisible surface with no diagnostic anywhere. It treated `\\r` as\r\n * an unexpected character, so a pasted CRLF equation failed. It checked no arity\r\n * on its variadic functions, so `atan2(1)` was a silent `NaN`.\r\n *\r\n * What the two genuinely disagree about is a *table*: which functions exist,\r\n * whether `sin` takes degrees or radians, and how a reference is spelled. That\r\n * is {@link ExpressionDialect}, and it is the only thing this file is\r\n * parameterized by.\r\n *\r\n * Precedence is the ordinary arithmetic one, with `^` right-associative and\r\n * **implicit multiplication** between adjacent primaries — which is what makes\r\n * `4[g]+3` mean what it reads as. Note `unary` sits *above* `power`, so `-2^2`\r\n * is `-4` as in maths, and the exponent parses as a unary so `2^3^2` is 512 and\r\n * `2^-3` is legal.\r\n */\r\nimport { ExpressionError } from \"./types\";\r\nimport type { BinaryOp, ExpressionDialect, ExpressionNode, FnArity, ParsedExpression } from \"./types\";\r\n\r\nconst DEG = Math.PI / 180;\r\n\r\ninterface DocumentFn extends FnArity {\r\n apply(args: number[]): number;\r\n}\r\n\r\n/**\r\n * The document's function library.\r\n *\r\n * Deliberately small and closed: an expression is stored in a document and\r\n * evaluated by whatever version of the library opens it later, so every name\r\n * here is as much a public contract as an exported symbol. Trig is in **degrees**\r\n * because every other angle in the library is.\r\n */\r\nexport const DOCUMENT_FUNCTIONS: Record<string, DocumentFn> = {\r\n abs: { arity: [1, 1], apply: (a) => Math.abs(a[0]) },\r\n sign: { arity: [1, 1], apply: (a) => Math.sign(a[0]) },\r\n sqrt: { arity: [1, 1], apply: (a) => Math.sqrt(a[0]) },\r\n floor: { arity: [1, 1], apply: (a) => Math.floor(a[0]) },\r\n ceil: { arity: [1, 1], apply: (a) => Math.ceil(a[0]) },\r\n round: { arity: [1, 2], apply: (a) => (a.length > 1 && a[1] !== 0 ? Math.round(a[0] / a[1]) * a[1] : Math.round(a[0])) },\r\n min: { arity: [1, Infinity], apply: (a) => Math.min(...a) },\r\n max: { arity: [1, Infinity], apply: (a) => Math.max(...a) },\r\n clamp: { arity: [3, 3], apply: (a) => Math.min(Math.max(a[0], a[1]), a[2]) },\r\n mod: { arity: [2, 2], apply: (a) => ((a[0] % a[1]) + a[1]) % a[1] },\r\n pow: { arity: [2, 2], apply: (a) => a[0] ** a[1] },\r\n log: { arity: [1, 2], apply: (a) => (a.length > 1 ? Math.log(a[0]) / Math.log(a[1]) : Math.log(a[0])) },\r\n exp: { arity: [1, 1], apply: (a) => Math.exp(a[0]) },\r\n mix: { arity: [3, 3], apply: (a) => a[0] + (a[1] - a[0]) * a[2] },\r\n smoothstep: {\r\n arity: [3, 3],\r\n apply: (a) => {\r\n if (Number.isNaN(a[0]) || Number.isNaN(a[1]) || Number.isNaN(a[2])) return NaN;\r\n // Equal edges: a step at the edge, like `step` — no divide by zero.\r\n if (a[0] === a[1]) return a[2] < a[0] ? 0 : 1;\r\n const t = Math.min(Math.max((a[2] - a[0]) / (a[1] - a[0]), 0), 1);\r\n return t * t * (3 - 2 * t);\r\n },\r\n },\r\n step: { arity: [2, 2], apply: (a) => (Number.isNaN(a[0]) || Number.isNaN(a[1]) ? NaN : a[1] < a[0] ? 0 : 1) },\r\n sin: { arity: [1, 1], apply: (a) => Math.sin(a[0] * DEG) },\r\n cos: { arity: [1, 1], apply: (a) => Math.cos(a[0] * DEG) },\r\n tan: { arity: [1, 1], apply: (a) => Math.tan(a[0] * DEG) },\r\n asin: { arity: [1, 1], apply: (a) => Math.asin(a[0]) / DEG },\r\n acos: { arity: [1, 1], apply: (a) => Math.acos(a[0]) / DEG },\r\n atan: { arity: [1, 1], apply: (a) => Math.atan(a[0]) / DEG },\r\n atan2: { arity: [2, 2], apply: (a) => Math.atan2(a[0], a[1]) / DEG },\r\n hypot: { arity: [2, Infinity], apply: (a) => Math.hypot(...a) },\r\n};\r\n\r\n/** Bare identifiers that are values rather than calls. */\r\nconst DOCUMENT_CONSTANTS: Record<string, number> = {\r\n pi: Math.PI,\r\n tau: Math.PI * 2,\r\n e: Math.E,\r\n};\r\n\r\n/** The language a `\"=…\"` prop is written in. */\r\nexport const DOCUMENT_DIALECT: ExpressionDialect = {\r\n functions: DOCUMENT_FUNCTIONS,\r\n constants: DOCUMENT_CONSTANTS,\r\n refs: \"bracket\",\r\n unknownName: (name) =>\r\n `unknown name \"${name}\" — a variable is referenced as \"[${name}]\"; ` +\r\n `bare names are the constants ${sortedKeys(DOCUMENT_CONSTANTS).join(\", \")}`,\r\n};\r\n\r\n/** Sorted, so a message or a completion list is stable. */\r\nexport function sortedKeys(table: Record<string, unknown>): string[] {\r\n return Object.keys(table).sort();\r\n}\r\n\r\n// ── Scanner ──────────────────────────────────────────────────────────────────\r\n\r\ntype TokenKind = \"number\" | \"ref\" | \"ident\" | \"op\" | \"(\" | \")\" | \",\" | \"end\";\r\n\r\ninterface Token {\r\n kind: TokenKind;\r\n /** The identifier, operator or reference name. Empty for numbers. */\r\n text: string;\r\n /** Parsed value, for numbers. */\r\n value: number;\r\n pos: number;\r\n}\r\n\r\nconst OPERATORS = new Set([\"+\", \"-\", \"*\", \"/\", \"%\", \"^\"]);\r\n\r\nfunction isDigit(ch: string | undefined): boolean {\r\n return ch !== undefined && ch >= \"0\" && ch <= \"9\";\r\n}\r\n\r\nfunction tokenize(source: string, dialect: ExpressionDialect): Token[] {\r\n const tokens: Token[] = [];\r\n let i = 0;\r\n\r\n while (i < source.length) {\r\n const ch = source[i];\r\n\r\n if (ch === \" \" || ch === \"\\t\" || ch === \"\\n\" || ch === \"\\r\") {\r\n i++;\r\n continue;\r\n }\r\n\r\n if (isDigit(ch) || (ch === \".\" && isDigit(source[i + 1]))) {\r\n const start = i;\r\n while (isDigit(source[i])) i++;\r\n if (source[i] === \".\") {\r\n i++;\r\n while (isDigit(source[i])) i++;\r\n }\r\n if (source[i] === \"e\" || source[i] === \"E\") {\r\n const mark = i;\r\n i++;\r\n if (source[i] === \"+\" || source[i] === \"-\") i++;\r\n if (isDigit(source[i])) {\r\n while (isDigit(source[i])) i++;\r\n } else {\r\n // `2e` followed by something else is `2` times the identifier\r\n // `e`, not a malformed exponent.\r\n i = mark;\r\n }\r\n }\r\n // A second `.` ends a number that has already had one. Both parsers\r\n // this replaces got here differently and both got it wrong: one\r\n // scanned `1.2.3` as a single token that `Number` turned into a\r\n // silent `NaN`, the other split it into `1.2 * 0.3`. Neither is\r\n // anything anyone wrote on purpose.\r\n if (source[i] === \".\") throw new ExpressionError('unexpected character \".\"', source, i);\r\n tokens.push({ kind: \"number\", text: \"\", value: Number(source.slice(start, i)), pos: start });\r\n continue;\r\n }\r\n\r\n // `[` is legal only where a reference is spelled with one, so a plot\r\n // equation gets \"unexpected character\" here rather than failing later\r\n // with a message about variable references it has never heard of.\r\n if (ch === \"[\" && dialect.refs === \"bracket\") {\r\n const start = i;\r\n const end = source.indexOf(\"]\", i + 1);\r\n if (end === -1) throw new ExpressionError(\"unclosed `[` — a variable reference is written `[id]`\", source, start);\r\n const name = source.slice(i + 1, end).trim();\r\n if (name.length === 0) throw new ExpressionError(\"empty variable reference `[]`\", source, start);\r\n if (name.includes(\"[\")) throw new ExpressionError(\"variable references cannot nest\", source, start);\r\n tokens.push({ kind: \"ref\", text: name, value: 0, pos: start });\r\n i = end + 1;\r\n continue;\r\n }\r\n\r\n if (/[A-Za-z_]/.test(ch)) {\r\n const start = i;\r\n while (i < source.length && /[A-Za-z0-9_]/.test(source[i])) i++;\r\n tokens.push({ kind: \"ident\", text: source.slice(start, i), value: 0, pos: start });\r\n continue;\r\n }\r\n\r\n if (OPERATORS.has(ch)) {\r\n tokens.push({ kind: \"op\", text: ch, value: 0, pos: i++ });\r\n continue;\r\n }\r\n if (ch === \"(\" || ch === \")\" || ch === \",\") {\r\n tokens.push({ kind: ch as TokenKind, text: ch, value: 0, pos: i++ });\r\n continue;\r\n }\r\n\r\n throw new ExpressionError(`unexpected character \"${ch}\"`, source, i);\r\n }\r\n\r\n tokens.push({ kind: \"end\", text: \"\", value: 0, pos: source.length });\r\n return tokens;\r\n}\r\n\r\n// ── Grammar ──────────────────────────────────────────────────────────────────\r\n\r\n/**\r\n * Parse a formula against a dialect.\r\n *\r\n * `source` is the formula alone — the document's `=` is stripped by the walk\r\n * that recognised it, because the marker is not part of any grammar.\r\n */\r\nexport function parse(source: string, dialect: ExpressionDialect = DOCUMENT_DIALECT): ParsedExpression {\r\n if (source.trim().length === 0) throw new ExpressionError(\"empty expression\", source);\r\n\r\n const tokens = tokenize(source, dialect);\r\n const refs: string[] = [];\r\n let index = 0;\r\n\r\n const peek = (): Token => tokens[index];\r\n const next = (): Token => tokens[index++];\r\n\r\n const addRef = (name: string): ExpressionNode => {\r\n if (!refs.includes(name)) refs.push(name);\r\n return { kind: \"ref\", name };\r\n };\r\n\r\n /** True when the token can begin a primary — the test implicit `*` turns on. */\r\n const startsPrimary = (t: Token): boolean =>\r\n t.kind === \"number\" || t.kind === \"ref\" || t.kind === \"ident\" || t.kind === \"(\";\r\n\r\n function parseAdditive(): ExpressionNode {\r\n let left = parseMultiplicative();\r\n for (;;) {\r\n const t = peek();\r\n if (t.kind === \"op\" && (t.text === \"+\" || t.text === \"-\")) {\r\n next();\r\n left = { kind: \"binary\", op: t.text, left, right: parseMultiplicative() };\r\n continue;\r\n }\r\n return left;\r\n }\r\n }\r\n\r\n function parseMultiplicative(): ExpressionNode {\r\n let left = parseUnary();\r\n for (;;) {\r\n const t = peek();\r\n if (t.kind === \"op\" && (t.text === \"*\" || t.text === \"/\" || t.text === \"%\")) {\r\n next();\r\n left = { kind: \"binary\", op: t.text as BinaryOp, left, right: parseUnary() };\r\n continue;\r\n }\r\n // `4[g]`, `2(x+1)`, `[a][b]`, `2pi` — juxtaposition is multiplication.\r\n if (startsPrimary(t)) {\r\n left = { kind: \"binary\", op: \"*\", left, right: parseUnary() };\r\n continue;\r\n }\r\n return left;\r\n }\r\n }\r\n\r\n function parseUnary(): ExpressionNode {\r\n const t = peek();\r\n if (t.kind === \"op\" && (t.text === \"-\" || t.text === \"+\")) {\r\n next();\r\n const operand = parseUnary();\r\n return t.text === \"-\" ? { kind: \"unary\", op: \"-\", operand } : operand;\r\n }\r\n return parsePower();\r\n }\r\n\r\n function parsePower(): ExpressionNode {\r\n const base = parsePrimary();\r\n const t = peek();\r\n if (t.kind === \"op\" && t.text === \"^\") {\r\n next();\r\n // Right-associative, and binding tighter than unary minus on its\r\n // right: `2^-1` is a half, not an error.\r\n return { kind: \"binary\", op: \"^\", left: base, right: parseUnary() };\r\n }\r\n return base;\r\n }\r\n\r\n function parseCall(name: string, pos: number): ExpressionNode {\r\n // Own keys only: `toString(1)` must be an unknown function, not a lookup\r\n // that finds `Object.prototype`'s.\r\n const def = Object.hasOwn(dialect.functions, name) ? dialect.functions[name] : undefined;\r\n if (!def) {\r\n throw new ExpressionError(\r\n `unknown function \"${name}\" — available: ${sortedKeys(dialect.functions).join(\", \")}`,\r\n source, pos,\r\n );\r\n }\r\n const args: ExpressionNode[] = [];\r\n if (peek().kind !== \")\") {\r\n for (;;) {\r\n args.push(parseAdditive());\r\n if (peek().kind !== \",\") break;\r\n next();\r\n }\r\n }\r\n const close = next();\r\n if (close.kind !== \")\") throw new ExpressionError(`expected \\`)\\` closing ${name}(`, source, close.pos);\r\n\r\n const [min, max] = def.arity;\r\n if (args.length < min || args.length > max) {\r\n const want = max === Infinity ? `at least ${min}` : min === max ? `${min}` : `${min}–${max}`;\r\n // Singular only when `want` names the number one (`1`, `at least 1`), never for a range.\r\n const plural = (max === Infinity || min === max) && min === 1 ? \"\" : \"s\";\r\n throw new ExpressionError(\r\n `${name}() takes ${want} argument${plural}, got ${args.length}`,\r\n source, pos,\r\n );\r\n }\r\n return { kind: \"call\", name, args };\r\n }\r\n\r\n function parsePrimary(): ExpressionNode {\r\n const t = next();\r\n switch (t.kind) {\r\n case \"number\":\r\n return { kind: \"const\", value: t.value };\r\n case \"ref\":\r\n return addRef(t.text);\r\n case \"(\": {\r\n const inner = parseAdditive();\r\n const close = next();\r\n if (close.kind !== \")\") throw new ExpressionError(\"expected `)`\", source, close.pos);\r\n return inner;\r\n }\r\n case \"ident\": {\r\n if (peek().kind === \"(\") {\r\n next();\r\n return parseCall(t.text, t.pos);\r\n }\r\n // A constant is folded here, before a bare identifier can become\r\n // a reference — so a dialect's constant name can never also be\r\n // one of its free variables.\r\n const constant = Object.hasOwn(dialect.constants, t.text) ? dialect.constants[t.text] : undefined;\r\n if (constant !== undefined) return { kind: \"const\", value: constant };\r\n if (dialect.refs === \"bare\") return addRef(t.text);\r\n throw new ExpressionError(dialect.unknownName(t.text), source, t.pos);\r\n }\r\n default:\r\n throw new ExpressionError(\r\n t.kind === \"end\" ? \"expression ends early\" : `unexpected \"${t.text}\"`,\r\n source, t.pos,\r\n );\r\n }\r\n }\r\n\r\n const root = parseAdditive();\r\n const trailing = peek();\r\n if (trailing.kind !== \"end\") throw new ExpressionError(`unexpected \"${trailing.text}\"`, source, trailing.pos);\r\n\r\n return { source, root, refs, passthrough: root.kind === \"ref\" };\r\n}\r\n"]}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* has no dot and so names a variable instead.
|
|
4
4
|
*
|
|
5
5
|
* The dot is the whole discriminator, in the parser (which hands the bracket's
|
|
6
|
-
* contents over as one opaque name), the validator, and `
|
|
6
|
+
* contents over as one opaque name), the validator, and `ClipTimeline`.
|
|
7
7
|
*/
|
|
8
8
|
export declare function splitNodeRef(ref: string): {
|
|
9
9
|
key: string;
|
|
@@ -4,7 +4,7 @@ import { expressionOps } from "./ops.js";
|
|
|
4
4
|
* has no dot and so names a variable instead.
|
|
5
5
|
*
|
|
6
6
|
* The dot is the whole discriminator, in the parser (which hands the bracket's
|
|
7
|
-
* contents over as one opaque name), the validator, and `
|
|
7
|
+
* contents over as one opaque name), the validator, and `ClipTimeline`.
|
|
8
8
|
*/
|
|
9
9
|
export function splitNodeRef(ref) {
|
|
10
10
|
const dot = ref.indexOf(".");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refs.js","sourceRoot":"","sources":["../../../src/document/expression/refs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAAC,GAAW;IACpC,MAAM,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC7B,OAAO,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,EAAE,CAAC;AACtF,CAAC;AAWD,kFAAkF;AAClF,MAAM,UAAU,cAAc,CAAC,KAAc,EAAE,IAAI,GAAG,EAAE;IACpD,MAAM,IAAI,GAAa,EAAE,CAAC;IAC1B,MAAM,IAAI,GAA4B,EAAE,CAAC;IACzC,IAAI,UAAU,GAAG,CAAC,CAAC;IACnB,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,KAAK,MAAM,IAAI,IAAI,aAAa,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC;QACpD,MAAM,MAAM,GAAG,aAAa,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACnD,IAAI,OAAO,IAAI,MAAM,EAAE,CAAC;YACpB,UAAU,EAAE,CAAC;YACb,SAAS;QACb,CAAC;QACD,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC;YACvC,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;gBAAE,SAAS;YAC5B,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACd,MAAM,IAAI,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC;YAC/B,IAAI,IAAI;gBAAE,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;;gBACtC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACxB,CAAC;IACL,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;AACtC,CAAC","sourcesContent":["import { expressionOps } from \"./ops\";\n\n/**\n * A reference split into the node key and prop it names, or `undefined` when it\n * has no dot and so names a variable instead.\n *\n * The dot is the whole discriminator, in the parser (which hands the bracket's\n * contents over as one opaque name), the validator, and `
|
|
1
|
+
{"version":3,"file":"ref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AC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;;gBACtC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACxB,CAAC;IACL,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;AACtC,CAAC","sourcesContent":["import { expressionOps } from \"./ops\";\r\n\r\n/**\r\n * A reference split into the node key and prop it names, or `undefined` when it\r\n * has no dot and so names a variable instead.\r\n *\r\n * The dot is the whole discriminator, in the parser (which hands the bracket's\r\n * contents over as one opaque name), the validator, and `ClipTimeline`.\r\n */\r\nexport function splitNodeRef(ref: string): { key: string; prop: string } | undefined {\r\n const dot = ref.indexOf(\".\");\r\n return dot < 0 ? undefined : { key: ref.slice(0, dot), prop: ref.slice(dot + 1) };\r\n}\r\n\r\nexport interface ExpressionRefs {\r\n /** Variable ids read, de-duplicated, in first-seen order. */\r\n vars: string[];\r\n /** `[key, prop]` pairs read, de-duplicated, in first-seen order. */\r\n keys: Array<[key: string, prop: string]>;\r\n /** Expressions that failed to parse; their references are not in the lists above. */\r\n unparsable: number;\r\n}\r\n\r\n/** Every reference inside every expression in an authored value, at any depth. */\r\nexport function expressionRefs(value: unknown, path = \"\"): ExpressionRefs {\r\n const vars: string[] = [];\r\n const keys: Array<[string, string]> = [];\r\n let unparsable = 0;\r\n const seen = new Set<string>();\r\n for (const site of expressionOps.collect(value, path)) {\r\n const parsed = expressionOps.tryParse(site.source);\r\n if (\"error\" in parsed) {\r\n unparsable++;\r\n continue;\r\n }\r\n for (const ref of parsed.expression.refs) {\r\n if (seen.has(ref)) continue;\r\n seen.add(ref);\r\n const node = splitNodeRef(ref);\r\n if (node) keys.push([node.key, node.prop]);\r\n else vars.push(ref);\r\n }\r\n }\r\n return { vars, keys, unparsable };\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/document/expression/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,yFAAyF;AACzF,MAAM,OAAO,eAAgB,SAAQ,KAAK;IACtC,iFAAiF;IACxE,MAAM,CAAS;IACxB,sFAAsF;IAC7E,QAAQ,CAAS;IAC1B,6EAA6E;IACpE,IAAI,CAAU;IAEvB,YAAY,OAAe,EAAE,MAAc,EAAE,QAAQ,GAAG,CAAC,CAAC,EAAE,IAAa;QACrE,MAAM,KAAK,GAAG,QAAQ,IAAI,CAAC,CAAC,CAAC,CAAC,kBAAkB,QAAQ,GAAG,CAAC,QAAQ,MAAM,IAAI,CAAC,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC;QACrG,KAAK,CAAC,GAAG,OAAO,GAAG,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACxD,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;QAC9B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACrB,CAAC;CACJ","sourcesContent":["/**\n * Every type the expression module names, in one place.\n *\n * The vocabulary is small and worth seeing at once, because the whole module is\n * four representations and the steps between them:\n *\n * a prop value ──▶ \"=4[g]+3\" ──▶ ExpressionNode ──▶ () => unknown\n * at any depth the marked the AST, per a prop binding\n * (walk) string dialect (parse) (compile)\n *\n * The `=` appears in exactly one of those steps. It marks a *document prop* as a\n * formula, which is recognition, not grammar — `=` is not a legal character in\n * any dialect — so the walk strips it and the parser never sees one.\n */\n\n/** Thrown for a formula that cannot be parsed or whose reference resolves to nothing. */\nexport class ExpressionError extends Error {\n /** The formula as the parser received it: no marker, and no surrounding prop. */\n readonly source: string;\n /** Character offset into {@link source}, or `-1` when the whole thing is at fault. */\n readonly position: number;\n /** Where in the props bag it was written, JSON-Pointer style, when known. */\n readonly path?: string;\n\n constructor(message: string, source: string, position = -1, path?: string) {\n const where = position >= 0 ? ` (at character ${position + 1} of \"${source}\")` : ` (in \"${source}\")`;\n super(`${message}${where}${path ? ` at ${path}` : \"\"}`);\n this.name = \"ExpressionError\";\n this.source = source;\n this.position = position;\n this.path = path;\n }\n}\n\n// ── The syntax tree ──────────────────────────────────────────────────────────\n\nexport type BinaryOp = \"+\" | \"-\" | \"*\" | \"/\" | \"%\" | \"^\";\n\n/** One node of a parsed formula. Kept public so a host can lint or rewrite one. */\nexport type ExpressionNode =\n | { kind: \"const\"; value: number }\n | { kind: \"ref\"; name: string }\n | { kind: \"unary\"; op: \"-\"; operand: ExpressionNode }\n | { kind: \"binary\"; op: BinaryOp; left: ExpressionNode; right: ExpressionNode }\n | { kind: \"call\"; name: string; args: ExpressionNode[] };\n\n/** A formula, parsed. Resolver-free, so it can be checked without a scene. */\nexport interface ParsedExpression {\n /** The formula's text as the parser received it — no marker. */\n readonly source: string;\n readonly root: ExpressionNode;\n /** Names it reads, de-duplicated, in first-seen order. */\n readonly refs: readonly string[];\n /**\n * True when the formula is exactly one reference and nothing else.\n *\n * The passthrough case: the document's compiled binding returns the\n * variable's value untouched rather than coercing it to a number, which is\n * what lets a variable hold a colour, a `Vector2` or any other prop value.\n * A dialect whose references are bare identifiers sets it for a lone\n * variable too (`\"x\"`), where it means nothing — only the document's\n * compiler reads it.\n */\n readonly passthrough: boolean;\n}\n\n// ── Dialects ─────────────────────────────────────────────────────────────────\n\n/** What the parser needs to know about a function. What it *does* is the back end's. */\nexport interface FnArity {\n /** Minimum and maximum argument count; `Infinity` for variadic. */\n arity: [number, number];\n}\n\n/**\n * One language over the shared grammar.\n *\n * The grammar is fixed — precedence, implicit multiplication, right-associative\n * `^`, the scientific-notation rule — and everything a language is free to\n * disagree about is here. That is what lets the document's `sin` be degrees and\n * a function plot's be radians without two parsers: the trig unit is a property\n * of a table, not of the grammar.\n */\nexport interface ExpressionDialect {\n /** Names callable as `f(…)`, and how many arguments each takes. */\n functions: Record<string, FnArity>;\n /** Bare identifiers that are values. Folded at parse time, so one can never also be a reference. */\n constants: Record<string, number>;\n /**\n * How a reference is spelled. `\"bracket\"` is `[id]`, and is the only mode in\n * which `[` is a legal character; `\"bare\"` makes any identifier that is not a\n * call or a constant a reference.\n */\n refs: \"bracket\" | \"bare\";\n /** What an identifier that resolves to nothing says. The document points at `[id]`; a plot does not. */\n unknownName(name: string): string;\n}\n\n// ── Compilation ──────────────────────────────────────────────────────────────\n\n/**\n * Resolves a name to a read function, or `undefined` when nothing in the\n * document declares it. The read is what the compiled binding calls, once per\n * evaluation of the prop it drives.\n */\nexport type VariableResolver = (name: string) => (() => unknown) | undefined;\n\n/**\n * A prop value, compiled: either a plain value or the binding an expression\n * somewhere inside it produced.\n */\nexport type CompiledValue =\n | { dynamic: false; value: unknown }\n | { dynamic: true; read: () => unknown };\n\n/** A props bag, split into what a constructor can take and what has to be bound. */\nexport interface CompiledProps {\n /**\n * Props with no expression in them.\n *\n * Handed to the node's constructor as-is. A bound prop is deliberately\n * *absent* here rather than present as a placeholder: a node's constructor\n * reads its raw props to decide things like a default size, and a\n * placeholder would answer those questions with a lie.\n */\n literal: Record<string, unknown>;\n /** Field → binding, applied with `node.set()` once the variables exist. */\n bindings: Record<string, () => unknown>;\n /** True when {@link CompiledProps.bindings} has anything in it. */\n hasBindings: boolean;\n}\n\n/** One expression found in a document, and where. */\nexport interface ExpressionSite {\n /** JSON-Pointer-style path, matching `ValidationIssue.path`. */\n path: string;\n /** The raw prop value, `=` and all. */\n source: string;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/document/expression/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,yFAAyF;AACzF,MAAM,OAAO,eAAgB,SAAQ,KAAK;IACtC,iFAAiF;IACxE,MAAM,CAAS;IACxB,sFAAsF;IAC7E,QAAQ,CAAS;IAC1B,6EAA6E;IACpE,IAAI,CAAU;IAEvB,YAAY,OAAe,EAAE,MAAc,EAAE,QAAQ,GAAG,CAAC,CAAC,EAAE,IAAa;QACrE,MAAM,KAAK,GAAG,QAAQ,IAAI,CAAC,CAAC,CAAC,CAAC,kBAAkB,QAAQ,GAAG,CAAC,QAAQ,MAAM,IAAI,CAAC,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC;QACrG,KAAK,CAAC,GAAG,OAAO,GAAG,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACxD,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;QAC9B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACrB,CAAC;CACJ","sourcesContent":["/**\r\n * Every type the expression module names, in one place.\r\n *\r\n * The vocabulary is small and worth seeing at once, because the whole module is\r\n * four representations and the steps between them:\r\n *\r\n * a prop value ──▶ \"=4[g]+3\" ──▶ ExpressionNode ──▶ () => unknown\r\n * at any depth the marked the AST, per a prop binding\r\n * (walk) string dialect (parse) (compile)\r\n *\r\n * The `=` appears in exactly one of those steps. It marks a *document prop* as a\r\n * formula, which is recognition, not grammar — `=` is not a legal character in\r\n * any dialect — so the walk strips it and the parser never sees one.\r\n */\r\n\r\n/** Thrown for a formula that cannot be parsed or whose reference resolves to nothing. */\r\nexport class ExpressionError extends Error {\r\n /** The formula as the parser received it: no marker, and no surrounding prop. */\r\n readonly source: string;\r\n /** Character offset into {@link source}, or `-1` when the whole thing is at fault. */\r\n readonly position: number;\r\n /** Where in the props bag it was written, JSON-Pointer style, when known. */\r\n readonly path?: string;\r\n\r\n constructor(message: string, source: string, position = -1, path?: string) {\r\n const where = position >= 0 ? ` (at character ${position + 1} of \"${source}\")` : ` (in \"${source}\")`;\r\n super(`${message}${where}${path ? ` at ${path}` : \"\"}`);\r\n this.name = \"ExpressionError\";\r\n this.source = source;\r\n this.position = position;\r\n this.path = path;\r\n }\r\n}\r\n\r\n// ── The syntax tree ──────────────────────────────────────────────────────────\r\n\r\nexport type BinaryOp = \"+\" | \"-\" | \"*\" | \"/\" | \"%\" | \"^\";\r\n\r\n/** One node of a parsed formula. Kept public so a host can lint or rewrite one. */\r\nexport type ExpressionNode =\r\n | { kind: \"const\"; value: number }\r\n | { kind: \"ref\"; name: string }\r\n | { kind: \"unary\"; op: \"-\"; operand: ExpressionNode }\r\n | { kind: \"binary\"; op: BinaryOp; left: ExpressionNode; right: ExpressionNode }\r\n | { kind: \"call\"; name: string; args: ExpressionNode[] };\r\n\r\n/** A formula, parsed. Resolver-free, so it can be checked without a scene. */\r\nexport interface ParsedExpression {\r\n /** The formula's text as the parser received it — no marker. */\r\n readonly source: string;\r\n readonly root: ExpressionNode;\r\n /** Names it reads, de-duplicated, in first-seen order. */\r\n readonly refs: readonly string[];\r\n /**\r\n * True when the formula is exactly one reference and nothing else.\r\n *\r\n * The passthrough case: the document's compiled binding returns the\r\n * variable's value untouched rather than coercing it to a number, which is\r\n * what lets a variable hold a colour, a `Vector2` or any other prop value.\r\n * A dialect whose references are bare identifiers sets it for a lone\r\n * variable too (`\"x\"`), where it means nothing — only the document's\r\n * compiler reads it.\r\n */\r\n readonly passthrough: boolean;\r\n}\r\n\r\n// ── Dialects ─────────────────────────────────────────────────────────────────\r\n\r\n/** What the parser needs to know about a function. What it *does* is the back end's. */\r\nexport interface FnArity {\r\n /** Minimum and maximum argument count; `Infinity` for variadic. */\r\n arity: [number, number];\r\n}\r\n\r\n/**\r\n * One language over the shared grammar.\r\n *\r\n * The grammar is fixed — precedence, implicit multiplication, right-associative\r\n * `^`, the scientific-notation rule — and everything a language is free to\r\n * disagree about is here. That is what lets the document's `sin` be degrees and\r\n * a function plot's be radians without two parsers: the trig unit is a property\r\n * of a table, not of the grammar.\r\n */\r\nexport interface ExpressionDialect {\r\n /** Names callable as `f(…)`, and how many arguments each takes. */\r\n functions: Record<string, FnArity>;\r\n /** Bare identifiers that are values. Folded at parse time, so one can never also be a reference. */\r\n constants: Record<string, number>;\r\n /**\r\n * How a reference is spelled. `\"bracket\"` is `[id]`, and is the only mode in\r\n * which `[` is a legal character; `\"bare\"` makes any identifier that is not a\r\n * call or a constant a reference.\r\n */\r\n refs: \"bracket\" | \"bare\";\r\n /** What an identifier that resolves to nothing says. The document points at `[id]`; a plot does not. */\r\n unknownName(name: string): string;\r\n}\r\n\r\n// ── Compilation ──────────────────────────────────────────────────────────────\r\n\r\n/**\r\n * Resolves a name to a read function, or `undefined` when nothing in the\r\n * document declares it. The read is what the compiled binding calls, once per\r\n * evaluation of the prop it drives.\r\n */\r\nexport type VariableResolver = (name: string) => (() => unknown) | undefined;\r\n\r\n/**\r\n * A prop value, compiled: either a plain value or the binding an expression\r\n * somewhere inside it produced.\r\n */\r\nexport type CompiledValue =\r\n | { dynamic: false; value: unknown }\r\n | { dynamic: true; read: () => unknown };\r\n\r\n/** A props bag, split into what a constructor can take and what has to be bound. */\r\nexport interface CompiledProps {\r\n /**\r\n * Props with no expression in them.\r\n *\r\n * Handed to the node's constructor as-is. A bound prop is deliberately\r\n * *absent* here rather than present as a placeholder: a node's constructor\r\n * reads its raw props to decide things like a default size, and a\r\n * placeholder would answer those questions with a lie.\r\n */\r\n literal: Record<string, unknown>;\r\n /** Field → binding, applied with `node.set()` once the variables exist. */\r\n bindings: Record<string, () => unknown>;\r\n /** True when {@link CompiledProps.bindings} has anything in it. */\r\n hasBindings: boolean;\r\n}\r\n\r\n/** One expression found in a document, and where. */\r\nexport interface ExpressionSite {\r\n /** JSON-Pointer-style path, matching `ValidationIssue.path`. */\r\n path: string;\r\n /** The raw prop value, `=` and all. */\r\n source: string;\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"walk.d.ts","sourceRoot":"","sources":["../../../src/document/expression/walk.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,E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E,IAAI,SAAU,GAAG,aAAa,CAO7F;AAED,4DAA4D;AAC5D,wBAAgB,SAAS,CACrB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EAC1C,OAAO,EAAE,gBAAgB,EACzB,IAAI,SAAU,GACf,aAAa,CAef;AAED;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,cAAc,EAAE,CAOtE;AAKD;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,GAAG,CAAC,CAUtF"}
|
|
@@ -130,7 +130,8 @@ export function renameRefs(value, rename) {
|
|
|
130
130
|
if (!isSource(source))
|
|
131
131
|
return STATIC(source);
|
|
132
132
|
return STATIC(source.replace(REF, (whole, ref) => {
|
|
133
|
-
|
|
133
|
+
// The parser trims a reference's name (`[ g ]` reads `g`), so the callback sees it trimmed too.
|
|
134
|
+
const next = rename(ref.trim());
|
|
134
135
|
return next === undefined ? whole : `[${next}]`;
|
|
135
136
|
}));
|
|
136
137
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"walk.js","sourceRoot":"","sources":["../../../src/document/expression/walk.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAGhC;;;;;;GAMG;AACH,MAAM,UAAU,QAAQ,CAAC,KAAc;IACnC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC;AACjG,CAAC;AAED,qFAAqF;AAC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,CAAC;QACpD,CAAC,CAAC,CAAC,CAAC;IACR,CAAC,CAAC,CAAC;IACH,OAAQ,MAAuB,CAAC,KAAK,CAAC;AAC1C,CAAC;AAED,SAAS,aAAa,CAAC,CAAU;IAC7B,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AACpE,CAAC","sourcesContent":["/**\n * Recognition, and the one walk over an authored prop value.\n *\n * There were two walks — one compiling, one collecting — with the same three\n * cases and different leaves, and they had already drifted: the compiling one\n * read `Object.keys`, the collecting one `for…in`. Neither carried a path, so an\n * `ExpressionError` from a formula nested inside a `fill` array named the\n * formula and left the reader to find which prop it was written in.\n *\n * One recursion now, parameterized by what to do with a string. `bind` returns a\n * replacement, so containers are rebuilt around it; `collect` returns its input,\n * so nothing is rebuilt and the result is thrown away.\n */\nimport { compile } from \"./compile\";\nimport { parse } from \"./parse\";\nimport type { CompiledProps, CompiledValue, ExpressionSite, VariableResolver } from \"./types\";\n\n/**\n * True when a value is a formula rather than a string.\n *\n * `\"==\"` is the escape, so `\"==total\"` is the literal `\"=total\"` and not an\n * expression; a bare `\"=\"` is likewise just that string. Both are handled by\n * {@link unescape}, which every literal path runs values through.\n */\nexport function isSource(value: unknown): value is string {\n return typeof value === \"string\" && value.length > 1 && value[0] === \"=\" && value[1] !== \"=\";\n}\n\n/** Strip the escape from a literal string that begins with `=`. `\"==x\"` → `\"=x\"`. */\nexport function unescape(value: string): string {\n return value.startsWith(\"==\") ? value.slice(1) : value;\n}\n\n/** What the walk does with each string it reaches. Returns the value to put back. */\ntype StringHandler = (source: string, path: string) => CompiledValue;\n\nconst STATIC = (value: unknown): CompiledValue => ({ dynamic: false, value });\n\n/**\n * Visit every string in an authored value, at any depth.\n *\n * An expression is recognised at any depth, not just as a whole prop, because\n * half the props worth driving are compound: `{\"origin\": {\"x\": \"=[g]\", \"y\": 0}}`,\n * `{\"fill\": [\"#111\", {\"type\": \"solid\", \"color\": \"=[c]\"}]}`. A container holding\n * one is rebuilt on each recompute; a container holding none is passed through\n * **by identity**, so a scene that uses no expressions allocates nothing and\n * compares equal to the document it came from.\n */\nfunction walk(value: unknown, path: string, onString: StringHandler): CompiledValue {\n if (typeof value === \"string\") return onString(value, path);\n\n if (Array.isArray(value)) {\n const parts = value.map((v, i) => walk(v, `${path}[${i}]`, onString));\n if (parts.some((p) => p.dynamic)) {\n return { dynamic: true, read: () => parts.map((p) => (p.dynamic ? p.read() : p.value)) };\n }\n // Rebuild only if a leaf actually changed, so the common case keeps the\n // document's own array.\n const rebuilt = parts.map((p) => (p as { value: unknown }).value);\n return STATIC(rebuilt.every((v, i) => v === value[i]) ? value : rebuilt);\n }\n\n if (isPlainObject(value)) {\n const keys = Object.keys(value);\n const parts = keys.map((k) => walk(value[k], `${path}.${k}`, onString));\n if (parts.some((p) => p.dynamic)) {\n return {\n dynamic: true,\n read: () => {\n const out: Record<string, unknown> = {};\n keys.forEach((k, i) => {\n const part = parts[i];\n out[k] = part.dynamic ? part.read() : part.value;\n });\n return out;\n },\n };\n }\n if (!parts.some((p, i) => (p as { value: unknown }).value !== value[keys[i]])) return STATIC(value);\n const rebuilt: Record<string, unknown> = {};\n keys.forEach((k, i) => { rebuilt[k] = (parts[i] as { value: unknown }).value; });\n return STATIC(rebuilt);\n }\n\n return STATIC(value);\n}\n\n/** Compile one authored prop value: a plain value, or the binding it produced. */\nexport function bind(value: unknown, resolve: VariableResolver, path = \"props\"): CompiledValue {\n return walk(value, path, (source, at) =>\n isSource(source)\n // The `=` is the document's marker, not the grammar's — strip it here\n // and the parser never sees one.\n ? { dynamic: true, read: compile(parse(source.slice(1)), resolve, at) }\n : STATIC(unescape(source)));\n}\n\n/** Compile a whole props bag. See {@link CompiledProps}. */\nexport function bindProps(\n props: Record<string, unknown> | undefined,\n resolve: VariableResolver,\n path = \"props\",\n): CompiledProps {\n const literal: Record<string, unknown> = {};\n const bindings: Record<string, () => unknown> = {};\n let hasBindings = false;\n\n for (const key of Object.keys(props ?? {})) {\n const compiled = bind(props![key], resolve, `${path}.${key}`);\n if (compiled.dynamic) {\n bindings[key] = compiled.read;\n hasBindings = true;\n } else {\n literal[key] = compiled.value;\n }\n }\n return { literal, bindings, hasBindings };\n}\n\n/**\n * Find every expression inside an authored value, at any depth.\n *\n * Used by the validator, which checks that each one parses and names a declared\n * variable — the two failures worth catching before anything is built.\n */\nexport function collect(value: unknown, path: string): ExpressionSite[] {\n const out: ExpressionSite[] = [];\n walk(value, path, (source, at) => {\n if (isSource(source)) out.push({ path: at, source });\n return STATIC(source);\n });\n return out;\n}\n\n/** A bracketed reference. The grammar has no string literals, so a `[` is always one. */\nconst REF = /\\[([^[\\]]+)\\]/g;\n\n/**\n * Rewrite the references inside every expression in an authored value.\n *\n * `rename` sees each reference as written (`\"fade\"`, `\"card.x\"`) and returns its\n * replacement, or `undefined` to keep it. What a host moving a subtree between\n * documents needs when ids or keys change on the way; a value with nothing to\n * rewrite comes back **by identity**, the same as {@link bind}'s static path.\n */\nexport function renameRefs<T>(value: T, rename: (ref: string) => string | undefined): T {\n const result = walk(value, \"\", (source) => {\n if (!isSource(source)) return STATIC(source);\n return STATIC(source.replace(REF, (whole, ref: string) => {\n const next = rename(ref);\n return next === undefined ? whole : `[${next}]`;\n }));\n });\n return (result as { value: T }).value;\n}\n\nfunction isPlainObject(v: unknown): v is Record<string, unknown> {\n return typeof v === \"object\" && v !== null && !Array.isArray(v);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"walk.js","sourceRoot":"","sources":["../../../src/document/expression/walk.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAGhC;;;;;;GAMG;AACH,MAAM,UAAU,QAAQ,CAAC,KAAc;IACnC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK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YACrD,gGAAgG;YAChG,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;YAChC,OAAO,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,GAAG,CAAC;QACpD,CAAC,CAAC,CAAC,CAAC;IACR,CAAC,CAAC,CAAC;IACH,OAAQ,MAAuB,CAAC,KAAK,CAAC;AAC1C,CAAC;AAED,SAAS,aAAa,CAAC,CAAU;IAC7B,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AACpE,CAAC","sourcesContent":["/**\r\n * Recognition, and the one walk over an authored prop value.\r\n *\r\n * There were two walks — one compiling, one collecting — with the same three\r\n * cases and different leaves, and they had already drifted: the compiling one\r\n * read `Object.keys`, the collecting one `for…in`. Neither carried a path, so an\r\n * `ExpressionError` from a formula nested inside a `fill` array named the\r\n * formula and left the reader to find which prop it was written in.\r\n *\r\n * One recursion now, parameterized by what to do with a string. `bind` returns a\r\n * replacement, so containers are rebuilt around it; `collect` returns its input,\r\n * so nothing is rebuilt and the result is thrown away.\r\n */\r\nimport { compile } from \"./compile\";\r\nimport { parse } from \"./parse\";\r\nimport type { CompiledProps, CompiledValue, ExpressionSite, VariableResolver } from \"./types\";\r\n\r\n/**\r\n * True when a value is a formula rather than a string.\r\n *\r\n * `\"==\"` is the escape, so `\"==total\"` is the literal `\"=total\"` and not an\r\n * expression; a bare `\"=\"` is likewise just that string. Both are handled by\r\n * {@link unescape}, which every literal path runs values through.\r\n */\r\nexport function isSource(value: unknown): value is string {\r\n return typeof value === \"string\" && value.length > 1 && value[0] === \"=\" && value[1] !== \"=\";\r\n}\r\n\r\n/** Strip the escape from a literal string that begins with `=`. `\"==x\"` → `\"=x\"`. */\r\nexport function unescape(value: string): string {\r\n return value.startsWith(\"==\") ? value.slice(1) : value;\r\n}\r\n\r\n/** What the walk does with each string it reaches. Returns the value to put back. */\r\ntype StringHandler = (source: string, path: string) => CompiledValue;\r\n\r\nconst STATIC = (value: unknown): CompiledValue => ({ dynamic: false, value });\r\n\r\n/**\r\n * Visit every string in an authored value, at any depth.\r\n *\r\n * An expression is recognised at any depth, not just as a whole prop, because\r\n * half the props worth driving are compound: `{\"origin\": {\"x\": \"=[g]\", \"y\": 0}}`,\r\n * `{\"fill\": [\"#111\", {\"type\": \"solid\", \"color\": \"=[c]\"}]}`. A container holding\r\n * one is rebuilt on each recompute; a container holding none is passed through\r\n * **by identity**, so a scene that uses no expressions allocates nothing and\r\n * compares equal to the document it came from.\r\n */\r\nfunction walk(value: unknown, path: string, onString: StringHandler): CompiledValue {\r\n if (typeof value === \"string\") return onString(value, path);\r\n\r\n if (Array.isArray(value)) {\r\n const parts = value.map((v, i) => walk(v, `${path}[${i}]`, onString));\r\n if (parts.some((p) => p.dynamic)) {\r\n return { dynamic: true, read: () => parts.map((p) => (p.dynamic ? p.read() : p.value)) };\r\n }\r\n // Rebuild only if a leaf actually changed, so the common case keeps the\r\n // document's own array.\r\n const rebuilt = parts.map((p) => (p as { value: unknown }).value);\r\n return STATIC(rebuilt.every((v, i) => v === value[i]) ? value : rebuilt);\r\n }\r\n\r\n if (isPlainObject(value)) {\r\n const keys = Object.keys(value);\r\n const parts = keys.map((k) => walk(value[k], `${path}.${k}`, onString));\r\n if (parts.some((p) => p.dynamic)) {\r\n return {\r\n dynamic: true,\r\n read: () => {\r\n const out: Record<string, unknown> = {};\r\n keys.forEach((k, i) => {\r\n const part = parts[i];\r\n out[k] = part.dynamic ? part.read() : part.value;\r\n });\r\n return out;\r\n },\r\n };\r\n }\r\n if (!parts.some((p, i) => (p as { value: unknown }).value !== value[keys[i]])) return STATIC(value);\r\n const rebuilt: Record<string, unknown> = {};\r\n keys.forEach((k, i) => { rebuilt[k] = (parts[i] as { value: unknown }).value; });\r\n return STATIC(rebuilt);\r\n }\r\n\r\n return STATIC(value);\r\n}\r\n\r\n/** Compile one authored prop value: a plain value, or the binding it produced. */\r\nexport function bind(value: unknown, resolve: VariableResolver, path = \"props\"): CompiledValue {\r\n return walk(value, path, (source, at) =>\r\n isSource(source)\r\n // The `=` is the document's marker, not the grammar's — strip it here\r\n // and the parser never sees one.\r\n ? { dynamic: true, read: compile(parse(source.slice(1)), resolve, at) }\r\n : STATIC(unescape(source)));\r\n}\r\n\r\n/** Compile a whole props bag. See {@link CompiledProps}. */\r\nexport function bindProps(\r\n props: Record<string, unknown> | undefined,\r\n resolve: VariableResolver,\r\n path = \"props\",\r\n): CompiledProps {\r\n const literal: Record<string, unknown> = {};\r\n const bindings: Record<string, () => unknown> = {};\r\n let hasBindings = false;\r\n\r\n for (const key of Object.keys(props ?? {})) {\r\n const compiled = bind(props![key], resolve, `${path}.${key}`);\r\n if (compiled.dynamic) {\r\n bindings[key] = compiled.read;\r\n hasBindings = true;\r\n } else {\r\n literal[key] = compiled.value;\r\n }\r\n }\r\n return { literal, bindings, hasBindings };\r\n}\r\n\r\n/**\r\n * Find every expression inside an authored value, at any depth.\r\n *\r\n * Used by the validator, which checks that each one parses and names a declared\r\n * variable — the two failures worth catching before anything is built.\r\n */\r\nexport function collect(value: unknown, path: string): ExpressionSite[] {\r\n const out: ExpressionSite[] = [];\r\n walk(value, path, (source, at) => {\r\n if (isSource(source)) out.push({ path: at, source });\r\n return STATIC(source);\r\n });\r\n return out;\r\n}\r\n\r\n/** A bracketed reference. The grammar has no string literals, so a `[` is always one. */\r\nconst REF = /\\[([^[\\]]+)\\]/g;\r\n\r\n/**\r\n * Rewrite the references inside every expression in an authored value.\r\n *\r\n * `rename` sees each reference as written (`\"fade\"`, `\"card.x\"`) and returns its\r\n * replacement, or `undefined` to keep it. What a host moving a subtree between\r\n * documents needs when ids or keys change on the way; a value with nothing to\r\n * rewrite comes back **by identity**, the same as {@link bind}'s static path.\r\n */\r\nexport function renameRefs<T>(value: T, rename: (ref: string) => string | undefined): T {\r\n const result = walk(value, \"\", (source) => {\r\n if (!isSource(source)) return STATIC(source);\r\n return STATIC(source.replace(REF, (whole, ref: string) => {\r\n // The parser trims a reference's name (`[ g ]` reads `g`), so the callback sees it trimmed too.\r\n const next = rename(ref.trim());\r\n return next === undefined ? whole : `[${next}]`;\r\n }));\r\n });\r\n return (result as { value: T }).value;\r\n}\r\n\r\nfunction isPlainObject(v: unknown): v is Record<string, unknown> {\r\n return typeof v === \"object\" && v !== null && !Array.isArray(v);\r\n}\r\n"]}
|
package/dist/document/index.d.ts
CHANGED
|
@@ -5,6 +5,8 @@ export * from "./validate.js";
|
|
|
5
5
|
export * from "./registry.js";
|
|
6
6
|
export * from "./node-descriptor.js";
|
|
7
7
|
export * from "./node-decorator.js";
|
|
8
|
+
export * from "./withdraw.js";
|
|
9
|
+
export * from "./placement.js";
|
|
8
10
|
export * from "./timeline.js";
|
|
9
11
|
export * from "./audio.js";
|
|
10
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/document/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/document/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC"}
|
package/dist/document/index.js
CHANGED
|
@@ -5,6 +5,8 @@ export * from "./validate.js";
|
|
|
5
5
|
export * from "./registry.js";
|
|
6
6
|
export * from "./node-descriptor.js";
|
|
7
7
|
export * from "./node-decorator.js";
|
|
8
|
+
export * from "./withdraw.js";
|
|
9
|
+
export * from "./placement.js";
|
|
8
10
|
export * from "./timeline.js";
|
|
9
11
|
export * from "./audio.js";
|
|
10
12
|
// `installBuiltins` is deliberately NOT exported: a `Registry` seeds itself from
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/document/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,iFAAiF;AACjF,2EAA2E;AAC3E,mBAAmB","sourcesContent":["export * from \"./types\";\nexport * from \"./project\";\nexport * from \"./expression\";\nexport * from \"./validate\";\nexport * from \"./registry\";\nexport * from \"./node-descriptor\";\nexport * from \"./node-decorator\";\nexport * from \"./timeline\";\nexport * from \"./audio\";\n// `installBuiltins` is deliberately NOT exported: a `Registry` seeds itself from\n// its own constructor, so a host has no module-scope call for a bundler to\n// tree-shake away.\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/document/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,iFAAiF;AACjF,2EAA2E;AAC3E,mBAAmB","sourcesContent":["export * from \"./types\";\r\nexport * from \"./project\";\r\nexport * from \"./expression\";\r\nexport * from \"./validate\";\r\nexport * from \"./registry\";\r\nexport * from \"./node-descriptor\";\r\nexport * from \"./node-decorator\";\r\nexport * from \"./withdraw\";\r\nexport * from \"./placement\";\r\nexport * from \"./timeline\";\r\nexport * from \"./audio\";\r\n// `installBuiltins` is deliberately NOT exported: a `Registry` seeds itself from\r\n// its own constructor, so a host has no module-scope call for a bundler to\r\n// tree-shake away.\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-decorator.js","sourceRoot":"","sources":["../../src/document/node-decorator.ts"],"names":[],"mappings":"AAEA,0EAA0E;AAC1E,MAAM,CAAC,MAAM,SAAS,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;AAE5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,MAAM,UAAU,IAAI,CAAC,IAAiC;IAClD,iEAAiE;IACjE,4EAA4E;IAC5E,2EAA2E;IAC3E,OAAO;IACP,OAAO,UAAsD,IAAO;QAChE,MAAM,UAAU,GAAuB,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;QACtF,IAAI,CAAC,SAAqC,CAAC,SAAS,CAAC,GAAG,UAAU,CAAC;QACpE,OAAO,IAAI,CAAC;IAChB,CAAC,CAAC;AACN,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAsC;IACpE,MAAM,KAAK,GAAG,IAAI,CAAC,SAAgD,CAAC;IACpE,IAAI,CAAC,KAAK,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,EAAE,SAAS,CAAC;QAAE,OAAO,SAAS,CAAC;IACxF,OAAO,KAAK,CAAC,SAAS,CAAuB,CAAC;AAClD,CAAC","sourcesContent":["import type { NodeTypeDescriptor } from \"./node-descriptor\";\n\n/** Symbol under which `@node` metadata is stored on a class prototype. */\nexport const NODE_META = Symbol(\"nodeMeta\");\n\n/**\n * Declare a node class's document key — and nothing else.\n *\n * **It does not register.** Registration happens when the class is handed to a\n * `Registry` (`new Engine(platform, { nodes: [Blob] })`), because a registry is\n * a value an engine owns rather than a table the module graph writes into. A\n * decorator that registered made the *order modules happened to be imported in*\n * part of the engine's state: whichever host loaded first won the key, a second\n * engine in the same process inherited a vocabulary it never asked for, and a\n * class that was merely imported was already registered whether or not anything\n * meant to offer it.\n *\n * What is left is a declaration, read back by {@link getNodeDescriptor}:\n *\n * ```ts\n * @node(\"blob\")\n * class Blob extends Node2D<BlobProps> {\n * @property({ default: 0.4 }) declare readonly wobble: number;\n *\n * @command({ args: [\"wobble\"] })\n * wobbleTo(args: CommandArgs<{ wobble: number }>) { … }\n * }\n *\n * const registry = new Registry({ nodes: [Blob] });\n * // { \"type\": \"blob\", \"props\": { \"wobble\": 0.4 } }\n * ```\n *\n * The full form declares everything a host needs to *offer* the type — the\n * shelves it sits on, how it lays children out, what a freshly placed one is\n * seeded with — which is what a component package used to restate in a\n * `manifest.json` beside a class nothing checked it against:\n *\n * ```ts\n * @node({\n * key: \"lineChart\",\n * forkable: true,\n * layout: { children: \"freeform\", acceptsChildren: true },\n * seed: { width: 760, height: 460 },\n * })\n * ```\n *\n * None of it is read while rendering — see {@link NodeTypeDescriptor}.\n *\n * **The key is written out, not taken from the class name.** A minifier is free\n * to rename `Blob` to `o`, and the key is what stored documents contain — so a\n * derived one would work in development and silently rewrite every document's\n * vocabulary in a production bundle. It is public API, and spelled like it.\n */\nexport function node(type: string | NodeTypeDescriptor) {\n // Deliberately looser than `NodeConstructor`, which takes a bare\n // `Record<string, unknown>`: a real node class declares its own props type,\n // and requiring assignability would reject exactly the classes this exists\n // for.\n return function <T extends new (...args: never[]) => object>(ctor: T): T {\n const descriptor: NodeTypeDescriptor = typeof type === \"string\" ? { key: type } : type;\n (ctor.prototype as Record<symbol, unknown>)[NODE_META] = descriptor;\n return ctor;\n };\n}\n\n/**\n * What `@node` declared on this exact class, or `undefined`.\n *\n * Own prototype only, deliberately: a subclass inherits its parent's methods but\n * not its identity, and a `Card extends Rect` that answered to `\"rect\"` would\n * collide with the real one the moment both were registered.\n */\nexport function getNodeDescriptor(ctor: new (...args: never[]) => object): NodeTypeDescriptor | undefined {\n const proto = ctor.prototype as Record<symbol, unknown> | undefined;\n if (!proto || !Object.prototype.hasOwnProperty.call(proto, NODE_META)) return undefined;\n return proto[NODE_META] as NodeTypeDescriptor;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"node-decorator.js","sourceRoot":"","sources":["../../src/document/node-decorator.ts"],"names":[],"mappings":"AAEA,0EAA0E;AAC1E,MAAM,CAAC,MAAM,SAAS,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;AAE5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,MAAM,UAAU,IAAI,CAAC,IAAiC;IAClD,iEAAiE;IACjE,4EAA4E;IAC5E,2EAA2E;IAC3E,OAAO;IACP,OAAO,UAAsD,IAAO;QAChE,MAAM,UAAU,GAAuB,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;QACtF,IAAI,CAAC,SAAqC,CAAC,SAAS,CAAC,GAAG,UAAU,CAAC;QACpE,OAAO,IAAI,CAAC;IAChB,CAAC,CAAC;AACN,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAsC;IACpE,MAAM,KAAK,GAAG,IAAI,CAAC,SAAgD,CAAC;IACpE,IAAI,CAAC,KAAK,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,EAAE,SAAS,CAAC;QAAE,OAAO,SAAS,CAAC;IACxF,OAAO,KAAK,CAAC,SAAS,CAAuB,CAAC;AAClD,CAAC","sourcesContent":["import type { NodeTypeDescriptor } from \"./node-descriptor\";\r\n\r\n/** Symbol under which `@node` metadata is stored on a class prototype. */\r\nexport const NODE_META = Symbol(\"nodeMeta\");\r\n\r\n/**\r\n * Declare a node class's document key — and nothing else.\r\n *\r\n * **It does not register.** Registration happens when the class is handed to a\r\n * `Registry` (`new Engine(platform, { nodes: [Blob] })`), because a registry is\r\n * a value an engine owns rather than a table the module graph writes into. A\r\n * decorator that registered made the *order modules happened to be imported in*\r\n * part of the engine's state: whichever host loaded first won the key, a second\r\n * engine in the same process inherited a vocabulary it never asked for, and a\r\n * class that was merely imported was already registered whether or not anything\r\n * meant to offer it.\r\n *\r\n * What is left is a declaration, read back by {@link getNodeDescriptor}:\r\n *\r\n * ```ts\r\n * @node(\"blob\")\r\n * class Blob extends Node2D<BlobProps> {\r\n * @property({ default: 0.4 }) declare readonly wobble: number;\r\n *\r\n * @command({ args: [\"wobble\"] })\r\n * wobbleTo(args: CommandArgs<{ wobble: number }>) { … }\r\n * }\r\n *\r\n * const registry = new Registry({ nodes: [Blob] });\r\n * // { \"type\": \"blob\", \"props\": { \"wobble\": 0.4 } }\r\n * ```\r\n *\r\n * The full form declares everything a host needs to *offer* the type — the\r\n * shelves it sits on, how it lays children out, what a freshly placed one is\r\n * seeded with — which is what a component package used to restate in a\r\n * `manifest.json` beside a class nothing checked it against:\r\n *\r\n * ```ts\r\n * @node({\r\n * key: \"lineChart\",\r\n * forkable: true,\r\n * layout: { children: \"freeform\", acceptsChildren: true },\r\n * seed: { width: 760, height: 460 },\r\n * })\r\n * ```\r\n *\r\n * None of it is read while rendering — see {@link NodeTypeDescriptor}.\r\n *\r\n * **The key is written out, not taken from the class name.** A minifier is free\r\n * to rename `Blob` to `o`, and the key is what stored documents contain — so a\r\n * derived one would work in development and silently rewrite every document's\r\n * vocabulary in a production bundle. It is public API, and spelled like it.\r\n */\r\nexport function node(type: string | NodeTypeDescriptor) {\r\n // Deliberately looser than `NodeConstructor`, which takes a bare\r\n // `Record<string, unknown>`: a real node class declares its own props type,\r\n // and requiring assignability would reject exactly the classes this exists\r\n // for.\r\n return function <T extends new (...args: never[]) => object>(ctor: T): T {\r\n const descriptor: NodeTypeDescriptor = typeof type === \"string\" ? { key: type } : type;\r\n (ctor.prototype as Record<symbol, unknown>)[NODE_META] = descriptor;\r\n return ctor;\r\n };\r\n}\r\n\r\n/**\r\n * What `@node` declared on this exact class, or `undefined`.\r\n *\r\n * Own prototype only, deliberately: a subclass inherits its parent's methods but\r\n * not its identity, and a `Card extends Rect` that answered to `\"rect\"` would\r\n * collide with the real one the moment both were registered.\r\n */\r\nexport function getNodeDescriptor(ctor: new (...args: never[]) => object): NodeTypeDescriptor | undefined {\r\n const proto = ctor.prototype as Record<symbol, unknown> | undefined;\r\n if (!proto || !Object.prototype.hasOwnProperty.call(proto, NODE_META)) return undefined;\r\n return proto[NODE_META] as NodeTypeDescriptor;\r\n}\r\n"]}
|
|
@@ -36,6 +36,12 @@ export interface NodeTypeDescriptor {
|
|
|
36
36
|
* catching the throw.
|
|
37
37
|
*/
|
|
38
38
|
dimension?: NodeDimension;
|
|
39
|
+
/**
|
|
40
|
+
* The trees it takes children from: its own, or a viewport's two (a Canvas
|
|
41
|
+
* 3D takes 2D and 3D); empty for a type that takes none. **Derived** from
|
|
42
|
+
* the class, as {@link dimension} is.
|
|
43
|
+
*/
|
|
44
|
+
holds?: readonly NodeDimension[];
|
|
39
45
|
/**
|
|
40
46
|
* Whether a host may copy this component's source.
|
|
41
47
|
*
|
|
@@ -46,6 +52,25 @@ export interface NodeTypeDescriptor {
|
|
|
46
52
|
layout?: NodeLayoutDescriptor;
|
|
47
53
|
/** What a freshly placed one's props are seeded with. */
|
|
48
54
|
seed?: Record<string, unknown>;
|
|
55
|
+
/**
|
|
56
|
+
* The types this one goes inside: a plot in a coordinate system, a tangent
|
|
57
|
+
* in a plot. A name also stands for every type built on it ({@link parentKey}).
|
|
58
|
+
* Unsaid, it goes wherever its {@link dimension} allows.
|
|
59
|
+
*
|
|
60
|
+
* A statement about the class, not a rule the engine enforces: a node put
|
|
61
|
+
* elsewhere still builds and usually draws nothing, which is exactly what
|
|
62
|
+
* a host is told here so it can offer the type only where it works. See
|
|
63
|
+
* `placement.ts`.
|
|
64
|
+
*/
|
|
65
|
+
within?: readonly string[];
|
|
66
|
+
/**
|
|
67
|
+
* Types it needs at least one of beside it, under the same parent: an area
|
|
68
|
+
* between curves needs a curve. For a requirement that is not a parent,
|
|
69
|
+
* because the thing needed is shared or there may be several of it.
|
|
70
|
+
*/
|
|
71
|
+
beside?: readonly string[];
|
|
72
|
+
/** Takes only the children that name it in their {@link within}: a plot holds its marks, not a photograph. */
|
|
73
|
+
closed?: boolean;
|
|
49
74
|
/**
|
|
50
75
|
* The editable properties, by key — **derived from `@property`**, never
|
|
51
76
|
* written here.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-descriptor.d.ts","sourceRoot":"","sources":["../../src/document/node-descriptor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,kBAAkB;IAC/B;;;;;OAKG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ,4FAA4F;IAC5F,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,MAAM,CAAC,EAAE,oBAAoB,CAAC;IAC9B,yDAAyD;IACzD,IAAI,CAAC,EAAE,M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IACjC;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,MAAM,CAAC,EAAE,oBAAoB,CAAC;IAC9B,yDAAyD;IACzD,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAE/B;;;;;;;;;OASG;IACH,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3B;;;;OAIG;IACH,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3B,8GAA8G;IAC9G,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB;;;;;;;;;OASG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,sBAAsB,CAAC,CAAC;CACvD;AAED,iDAAiD;AACjD,MAAM,WAAW,sBAAuB,SAAQ,cAAc;IAC1D,4EAA4E;IAC5E,IAAI,EAAE,MAAM,CAAC;IACb,qEAAqE;IACrE,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,4DAA4D;AAC5D,MAAM,WAAW,oBAAoB;IACjC,QAAQ,CAAC,EAAE,MAAM,GAAG,YAAY,GAAG,UAAU,GAAG,MAAM,GAAG,UAAU,CAAC;IACpE,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,gBAAgB,CAAC,EAAE,YAAY,CAAC;IAChC,iBAAiB,CAAC,EAAE,YAAY,CAAC;IACjC,6CAA6C;IAC7C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,mEAAmE;IACnE,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,sCAAsC;AACtC,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,KAAK,GAAG,MAAM,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-descriptor.js","sourceRoot":"","sources":["../../src/document/node-descriptor.ts"],"names":[],"mappings":"","sourcesContent":["import type { PropertyEditor } from \"@/attributes/properties/decorator\";\nimport type { NodeDimension } from \"@/nodes/node/node\";\n\n/**\n * What a node type declares about itself beyond its key.\n *\n * The **technical** description of a type — how it lays children out, what a\n * fresh one is seeded with, what it inherits from. Deliberately *not* how it is\n * presented: no display name, no icon, no shelf, no copy. Those are a host's to\n * resolve and to translate, and a component that carried them would be shipping\n * one language's product decisions inside an engine artifact.\n *\n * It replaced a `manifest.json` written beside each package. Two descriptions of\n * one class is the shape that drifts, and it did: eight of nine packages ended\n * up promising commands their classes had never implemented.\n *\n * **Nothing here is read while rendering.** A frame is identical whether a type\n * declares a seed or not. It exists so a host has one place to ask.\n */\nexport interface NodeTypeDescriptor {\n /**\n * The document key, matching `NodeSpec.type`.\n *\n * **Frozen** for anything already published: a stored document naming it has\n * to keep meaning the same thing forever.\n */\n key: string;\n /** The type it inherits editing sections and commands from, for a host that groups them. */\n parentKey?: string;\n /**\n * Which scene graph the type belongs to — **derived from the class**, never\n * written here, for the same reason {@link properties} is.\n *\n * `dimension` is a getter on the prototype precisely so it answers before a\n * node is constructed, which is what lets a host ask \"can this type go in\n * that tree?\" from the registry alone rather than by building one and\n * catching the throw.\n */\n dimension?: NodeDimension;\n /**\n * Whether a host may copy this component's source.\n *\n * False for anything a host reaches into by identity — its own primitives. A\n * type is forkable exactly when the host knows nothing about it beyond this.\n */\n forkable?: boolean;\n\n layout?: NodeLayoutDescriptor;\n /** What a freshly placed one's props are seeded with. */\n seed?: Record<string, unknown>;\n\n /**\n * The editable properties, by key — **derived from `@property`**, never\n * written here.\n *\n * A hand-written list of a class's properties, beside a class of\n * properties, is exactly the restatement this whole descriptor exists to\n * remove. What a host needs beyond the key — a range, an enum's choices, the\n * controls inside an object-valued prop — is declared on the `@property`\n * itself, which is the thing being edited.\n */\n properties?: Record<string, NodePropertyDescriptor>;\n}\n\n/** One editable property, as a host draws it. */\nexport interface NodePropertyDescriptor extends PropertyEditor {\n /** The control to draw. Always present here, inferred when not declared. */\n kind: string;\n /** What a freshly placed node holds, when the class declares one. */\n default?: unknown;\n}\n\n/** The layout answer a node type's children get from it. */\nexport interface NodeLayoutDescriptor {\n children?: \"flow\" | \"horizontal\" | \"vertical\" | \"grid\" | \"freeform\";\n acceptsChildren?: boolean;\n defaultWidthMode?: NodeSizeMode;\n defaultHeightMode?: NodeSizeMode;\n /** What a freshly placed one is sized to. */\n defaultWidth?: number;\n defaultHeight?: number;\n /** A locked width:height, for a type whose box *is* its design. */\n aspectRatio?: number;\n}\n\n/** How a node type sizes one axis. */\nexport type NodeSizeMode = \"fixed\" | \"hug\" | \"fill\";\n"]}
|
|
1
|
+
{"version":3,"file":"node-descriptor.js","sourceRoot":"","sources":["../../src/document/node-descriptor.ts"],"names":[],"mappings":"","sourcesContent":["import type { PropertyEditor } from \"@/attributes/properties/decorator\";\r\nimport type { NodeDimension } from \"@/nodes/node/node\";\r\n\r\n/**\r\n * What a node type declares about itself beyond its key.\r\n *\r\n * The **technical** description of a type — how it lays children out, what a\r\n * fresh one is seeded with, what it inherits from. Deliberately *not* how it is\r\n * presented: no display name, no icon, no shelf, no copy. Those are a host's to\r\n * resolve and to translate, and a component that carried them would be shipping\r\n * one language's product decisions inside an engine artifact.\r\n *\r\n * It replaced a `manifest.json` written beside each package. Two descriptions of\r\n * one class is the shape that drifts, and it did: eight of nine packages ended\r\n * up promising commands their classes had never implemented.\r\n *\r\n * **Nothing here is read while rendering.** A frame is identical whether a type\r\n * declares a seed or not. It exists so a host has one place to ask.\r\n */\r\nexport interface NodeTypeDescriptor {\r\n /**\r\n * The document key, matching `NodeSpec.type`.\r\n *\r\n * **Frozen** for anything already published: a stored document naming it has\r\n * to keep meaning the same thing forever.\r\n */\r\n key: string;\r\n /** The type it inherits editing sections and commands from, for a host that groups them. */\r\n parentKey?: string;\r\n /**\r\n * Which scene graph the type belongs to — **derived from the class**, never\r\n * written here, for the same reason {@link properties} is.\r\n *\r\n * `dimension` is a getter on the prototype precisely so it answers before a\r\n * node is constructed, which is what lets a host ask \"can this type go in\r\n * that tree?\" from the registry alone rather than by building one and\r\n * catching the throw.\r\n */\r\n dimension?: NodeDimension;\r\n /**\r\n * The trees it takes children from: its own, or a viewport's two (a Canvas\r\n * 3D takes 2D and 3D); empty for a type that takes none. **Derived** from\r\n * the class, as {@link dimension} is.\r\n */\r\n holds?: readonly NodeDimension[];\r\n /**\r\n * Whether a host may copy this component's source.\r\n *\r\n * False for anything a host reaches into by identity — its own primitives. A\r\n * type is forkable exactly when the host knows nothing about it beyond this.\r\n */\r\n forkable?: boolean;\r\n\r\n layout?: NodeLayoutDescriptor;\r\n /** What a freshly placed one's props are seeded with. */\r\n seed?: Record<string, unknown>;\r\n\r\n /**\r\n * The types this one goes inside: a plot in a coordinate system, a tangent\r\n * in a plot. A name also stands for every type built on it ({@link parentKey}).\r\n * Unsaid, it goes wherever its {@link dimension} allows.\r\n *\r\n * A statement about the class, not a rule the engine enforces: a node put\r\n * elsewhere still builds and usually draws nothing, which is exactly what\r\n * a host is told here so it can offer the type only where it works. See\r\n * `placement.ts`.\r\n */\r\n within?: readonly string[];\r\n /**\r\n * Types it needs at least one of beside it, under the same parent: an area\r\n * between curves needs a curve. For a requirement that is not a parent,\r\n * because the thing needed is shared or there may be several of it.\r\n */\r\n beside?: readonly string[];\r\n /** Takes only the children that name it in their {@link within}: a plot holds its marks, not a photograph. */\r\n closed?: boolean;\r\n\r\n /**\r\n * The editable properties, by key — **derived from `@property`**, never\r\n * written here.\r\n *\r\n * A hand-written list of a class's properties, beside a class of\r\n * properties, is exactly the restatement this whole descriptor exists to\r\n * remove. What a host needs beyond the key — a range, an enum's choices, the\r\n * controls inside an object-valued prop — is declared on the `@property`\r\n * itself, which is the thing being edited.\r\n */\r\n properties?: Record<string, NodePropertyDescriptor>;\r\n}\r\n\r\n/** One editable property, as a host draws it. */\r\nexport interface NodePropertyDescriptor extends PropertyEditor {\r\n /** The control to draw. Always present here, inferred when not declared. */\r\n kind: string;\r\n /** What a freshly placed node holds, when the class declares one. */\r\n default?: unknown;\r\n}\r\n\r\n/** The layout answer a node type's children get from it. */\r\nexport interface NodeLayoutDescriptor {\r\n children?: \"flow\" | \"horizontal\" | \"vertical\" | \"grid\" | \"freeform\";\r\n acceptsChildren?: boolean;\r\n defaultWidthMode?: NodeSizeMode;\r\n defaultHeightMode?: NodeSizeMode;\r\n /** What a freshly placed one is sized to. */\r\n defaultWidth?: number;\r\n defaultHeight?: number;\r\n /** A locked width:height, for a type whose box *is* its design. */\r\n aspectRatio?: number;\r\n}\r\n\r\n/** How a node type sizes one axis. */\r\nexport type NodeSizeMode = \"fixed\" | \"hug\" | \"fill\";\r\n"]}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { Registry } from "./registry.js";
|
|
2
|
+
import { type NodeSpec } from "./types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Where a node type may go, read off the registry without building anything:
|
|
5
|
+
* the answer a host needs before it offers a type under a parent, accepts a
|
|
6
|
+
* drop, or lets an assistant create a row.
|
|
7
|
+
*
|
|
8
|
+
* Four things decide it. A parent that takes no children takes none. The two
|
|
9
|
+
* trees do not mix: a `Node3D` lives under a Canvas 3D or another 3D node, and
|
|
10
|
+
* nothing else does. A type that names where it goes ({@link
|
|
11
|
+
* NodeTypeDescriptor.within}) goes only there, and a {@link
|
|
12
|
+
* NodeTypeDescriptor.closed} parent takes only the types that name it. Those
|
|
13
|
+
* are about the parent; {@link NodeTypeDescriptor.beside} is about the
|
|
14
|
+
* siblings, and is kept apart because a host can meet it by adding one.
|
|
15
|
+
*
|
|
16
|
+
* None of it is enforced when a document is built. A node in the wrong place
|
|
17
|
+
* builds and, as a rule, draws nothing; this says why.
|
|
18
|
+
*/
|
|
19
|
+
/** Why a node of a type is not where it can work. */
|
|
20
|
+
export type PlacementIssue =
|
|
21
|
+
/** The parent takes no children. */
|
|
22
|
+
{
|
|
23
|
+
kind: "leaf";
|
|
24
|
+
parent: string;
|
|
25
|
+
}
|
|
26
|
+
/** A 3D node outside a 3D tree, or anything else inside one. */
|
|
27
|
+
| {
|
|
28
|
+
kind: "dimension";
|
|
29
|
+
parent: string | null;
|
|
30
|
+
}
|
|
31
|
+
/** It goes inside one of `within`, and the parent is none of them. */
|
|
32
|
+
| {
|
|
33
|
+
kind: "within";
|
|
34
|
+
within: readonly string[];
|
|
35
|
+
}
|
|
36
|
+
/** The parent takes only the types that name it. */
|
|
37
|
+
| {
|
|
38
|
+
kind: "closed";
|
|
39
|
+
parent: string;
|
|
40
|
+
}
|
|
41
|
+
/** It needs one of `beside` under the same parent, and there is none. */
|
|
42
|
+
| {
|
|
43
|
+
kind: "beside";
|
|
44
|
+
beside: readonly string[];
|
|
45
|
+
};
|
|
46
|
+
export interface PlacementOptions {
|
|
47
|
+
/**
|
|
48
|
+
* A host's own sense of one type standing for another, beside the
|
|
49
|
+
* registry's: a copy of a component it made under a new key is still that
|
|
50
|
+
* component to whatever goes inside it.
|
|
51
|
+
*/
|
|
52
|
+
isA?: (type: string, name: string) => boolean;
|
|
53
|
+
}
|
|
54
|
+
/** Whether `type` is `name`, or is built on it through `parentKey`. */
|
|
55
|
+
export declare function nodeTypeIsA(registry: Registry, type: string, name: string): boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Why a node of `child` cannot go directly inside one of `parent`, or `null`
|
|
58
|
+
* when it can. A `null` parent is the document's own root, which is 2D and
|
|
59
|
+
* names nothing.
|
|
60
|
+
*/
|
|
61
|
+
export declare function parentIssue(registry: Registry, child: string, parent: string | null, options?: PlacementOptions): PlacementIssue | null;
|
|
62
|
+
/** The sibling `child` needs that `siblings`, the types already under its parent, do not include; `null` when it needs none or has one. */
|
|
63
|
+
export declare function siblingIssue(registry: Registry, child: string, siblings: readonly string[], options?: PlacementOptions): PlacementIssue | null;
|
|
64
|
+
/**
|
|
65
|
+
* Every node of `nodes` that is not where its type says it goes, by id, with
|
|
66
|
+
* the first reason. A node of an unregistered type is left out: that is a build
|
|
67
|
+
* error, and says so itself.
|
|
68
|
+
*/
|
|
69
|
+
export declare function placementIssues(registry: Registry, nodes: readonly Pick<NodeSpec, "id" | "type" | "parentId">[], options?: PlacementOptions): Map<string, PlacementIssue>;
|
|
70
|
+
//# sourceMappingURL=placement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"placement.d.ts","sourceRoot":"","sources":["../../src/document/placement.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAgB,KAAK,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEtD;;;;;;;;;;;;;;;GAeG;AAEH,qDAAqD;AACrD,MAAM,MAAM,cAAc;AACtB,oCAAoC;AAClC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE;AAClC,gEAAgE;GAC9D;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE;AAC9C,sEAAsE;GACpE;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE;AAC/C,oDAAoD;GAClD;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE;AACpC,yEAAyE;GACvE;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,CAAC;AAEpD,MAAM,WAAW,gBAAgB;IAC7B;;;;OAIG;IACH,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;CACjD;AAKD,uEAAuE;AACvE,wBAAgB,WAAW,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAOnF;AAMD;;;;GAIG;AACH,wBAAgB,WAAW,CACvB,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,G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