@motionscript/core 0.1.0 → 0.1.1-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/dist/assets/asset-index.d.ts +1 -8
- package/dist/assets/asset-index.d.ts.map +1 -1
- package/dist/assets/asset-index.js +1 -8
- package/dist/assets/asset-index.js.map +1 -1
- package/dist/assets/catalog.d.ts +10 -72
- package/dist/assets/catalog.d.ts.map +1 -1
- package/dist/assets/catalog.js +3 -29
- package/dist/assets/catalog.js.map +1 -1
- package/dist/assets/errors.d.ts +8 -20
- package/dist/assets/errors.d.ts.map +1 -1
- package/dist/assets/errors.js +8 -20
- package/dist/assets/errors.js.map +1 -1
- package/dist/assets/index.d.ts.map +1 -1
- package/dist/assets/index.js.map +1 -1
- package/dist/assets/manager.d.ts +9 -51
- package/dist/assets/manager.d.ts.map +1 -1
- package/dist/assets/manager.js +13 -78
- package/dist/assets/manager.js.map +1 -1
- package/dist/assets/record.d.ts +2 -18
- package/dist/assets/record.d.ts.map +1 -1
- package/dist/assets/record.js.map +1 -1
- package/dist/assets/scope.d.ts +3 -18
- package/dist/assets/scope.d.ts.map +1 -1
- package/dist/assets/scope.js +2 -11
- package/dist/assets/scope.js.map +1 -1
- package/dist/attributes/audio/effects/chain.d.ts +2 -12
- package/dist/attributes/audio/effects/chain.d.ts.map +1 -1
- package/dist/attributes/audio/effects/chain.js +1 -7
- package/dist/attributes/audio/effects/chain.js.map +1 -1
- package/dist/attributes/audio/effects/registry.d.ts +3 -18
- package/dist/attributes/audio/effects/registry.d.ts.map +1 -1
- package/dist/attributes/audio/effects/registry.js +4 -23
- package/dist/attributes/audio/effects/registry.js.map +1 -1
- package/dist/attributes/audio/ramp.d.ts +5 -38
- package/dist/attributes/audio/ramp.d.ts.map +1 -1
- package/dist/attributes/audio/ramp.js +3 -28
- package/dist/attributes/audio/ramp.js.map +1 -1
- package/dist/attributes/audio/request.d.ts +10 -80
- package/dist/attributes/audio/request.d.ts.map +1 -1
- package/dist/attributes/audio/request.js +1 -4
- package/dist/attributes/audio/request.js.map +1 -1
- package/dist/attributes/audio/schedule.d.ts +2 -12
- package/dist/attributes/audio/schedule.d.ts.map +1 -1
- package/dist/attributes/audio/schedule.js +2 -11
- package/dist/attributes/audio/schedule.js.map +1 -1
- package/dist/attributes/audio/sound.d.ts +2 -26
- package/dist/attributes/audio/sound.d.ts.map +1 -1
- package/dist/attributes/audio/sound.js +1 -9
- package/dist/attributes/audio/sound.js.map +1 -1
- package/dist/attributes/audio/transition.d.ts +1 -8
- package/dist/attributes/audio/transition.d.ts.map +1 -1
- package/dist/attributes/audio/transition.js.map +1 -1
- package/dist/attributes/layout/alignment.d.ts +6 -38
- package/dist/attributes/layout/alignment.d.ts.map +1 -1
- package/dist/attributes/layout/alignment.js.map +1 -1
- package/dist/attributes/layout/insets.d.ts +2 -27
- package/dist/attributes/layout/insets.d.ts.map +1 -1
- package/dist/attributes/layout/insets.js.map +1 -1
- package/dist/attributes/layout/matrix2d.d.ts +29 -114
- package/dist/attributes/layout/matrix2d.d.ts.map +1 -1
- package/dist/attributes/layout/matrix2d.js +26 -110
- package/dist/attributes/layout/matrix2d.js.map +1 -1
- package/dist/attributes/layout/size.d.ts +3 -25
- package/dist/attributes/layout/size.d.ts.map +1 -1
- package/dist/attributes/layout/size.js +2 -18
- package/dist/attributes/layout/size.js.map +1 -1
- package/dist/attributes/layout/space3d.d.ts +16 -79
- package/dist/attributes/layout/space3d.d.ts.map +1 -1
- package/dist/attributes/layout/space3d.js +17 -81
- package/dist/attributes/layout/space3d.js.map +1 -1
- package/dist/attributes/layout/transform3d.d.ts +2 -23
- package/dist/attributes/layout/transform3d.d.ts.map +1 -1
- package/dist/attributes/layout/transform3d.js +1 -7
- package/dist/attributes/layout/transform3d.js.map +1 -1
- package/dist/attributes/layout/world-transform.d.ts +2 -16
- package/dist/attributes/layout/world-transform.d.ts.map +1 -1
- package/dist/attributes/layout/world-transform.js.map +1 -1
- package/dist/attributes/properties/decorator.d.ts +13 -73
- package/dist/attributes/properties/decorator.d.ts.map +1 -1
- package/dist/attributes/properties/decorator.js +9 -40
- package/dist/attributes/properties/decorator.js.map +1 -1
- package/dist/attributes/properties/typed.d.ts +6 -45
- package/dist/attributes/properties/typed.d.ts.map +1 -1
- package/dist/attributes/properties/typed.js +6 -37
- package/dist/attributes/properties/typed.js.map +1 -1
- package/dist/attributes/render3d/orbit.d.ts +11 -83
- package/dist/attributes/render3d/orbit.d.ts.map +1 -1
- package/dist/attributes/render3d/orbit.js +10 -73
- package/dist/attributes/render3d/orbit.js.map +1 -1
- package/dist/attributes/shape/corners/corner-radius.d.ts +1 -6
- package/dist/attributes/shape/corners/corner-radius.d.ts.map +1 -1
- package/dist/attributes/shape/corners/corner-radius.js.map +1 -1
- package/dist/attributes/shape/corners/corner-style.d.ts +4 -25
- package/dist/attributes/shape/corners/corner-style.d.ts.map +1 -1
- package/dist/attributes/shape/corners/corner-style.js +2 -12
- package/dist/attributes/shape/corners/corner-style.js.map +1 -1
- package/dist/attributes/shape/corners/corners.d.ts +2 -21
- package/dist/attributes/shape/corners/corners.d.ts.map +1 -1
- package/dist/attributes/shape/corners/corners.js +2 -12
- package/dist/attributes/shape/corners/corners.js.map +1 -1
- package/dist/attributes/shape/effects/backdrop.d.ts +2 -18
- package/dist/attributes/shape/effects/backdrop.d.ts.map +1 -1
- package/dist/attributes/shape/effects/backdrop.js +3 -26
- package/dist/attributes/shape/effects/backdrop.js.map +1 -1
- package/dist/attributes/shape/effects/chain.d.ts +36 -328
- package/dist/attributes/shape/effects/chain.d.ts.map +1 -1
- package/dist/attributes/shape/effects/chain.js +24 -242
- package/dist/attributes/shape/effects/chain.js.map +1 -1
- package/dist/attributes/shape/effects/effect-data.d.ts +19 -127
- package/dist/attributes/shape/effects/effect-data.d.ts.map +1 -1
- package/dist/attributes/shape/effects/effect-data.js +6 -33
- package/dist/attributes/shape/effects/effect-data.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/ascii.d.ts +6 -26
- package/dist/attributes/shape/effects/implementations/ascii.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/ascii.js +0 -3
- package/dist/attributes/shape/effects/implementations/ascii.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/bit-crush.d.ts +2 -21
- package/dist/attributes/shape/effects/implementations/bit-crush.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/bit-crush.js +0 -1
- package/dist/attributes/shape/effects/implementations/bit-crush.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/block-displace.d.ts +1 -14
- package/dist/attributes/shape/effects/implementations/block-displace.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/block-displace.js +0 -1
- package/dist/attributes/shape/effects/implementations/block-displace.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/bloom.d.ts +0 -1
- package/dist/attributes/shape/effects/implementations/bloom.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/bloom.js +0 -1
- package/dist/attributes/shape/effects/implementations/bloom.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/blur.d.ts +0 -1
- package/dist/attributes/shape/effects/implementations/blur.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/blur.js +0 -1
- package/dist/attributes/shape/effects/implementations/blur.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/bulge.d.ts +0 -1
- package/dist/attributes/shape/effects/implementations/bulge.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/bulge.js +0 -1
- package/dist/attributes/shape/effects/implementations/bulge.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/chromatic-aberration.d.ts +0 -1
- package/dist/attributes/shape/effects/implementations/chromatic-aberration.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/chromatic-aberration.js +0 -1
- package/dist/attributes/shape/effects/implementations/chromatic-aberration.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/color-adjustment.d.ts +1 -12
- package/dist/attributes/shape/effects/implementations/color-adjustment.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/color-adjustment.js +0 -1
- package/dist/attributes/shape/effects/implementations/color-adjustment.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/curves.d.ts +1 -11
- package/dist/attributes/shape/effects/implementations/curves.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/curves.js +1 -6
- package/dist/attributes/shape/effects/implementations/curves.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/directional-blur.d.ts +0 -1
- package/dist/attributes/shape/effects/implementations/directional-blur.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/directional-blur.js +0 -1
- package/dist/attributes/shape/effects/implementations/directional-blur.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/dither.d.ts +4 -35
- package/dist/attributes/shape/effects/implementations/dither.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/dither.js +1 -7
- package/dist/attributes/shape/effects/implementations/dither.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/drop-shadow.d.ts +1 -22
- package/dist/attributes/shape/effects/implementations/drop-shadow.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/drop-shadow.js +0 -1
- package/dist/attributes/shape/effects/implementations/drop-shadow.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/duotone.d.ts +1 -9
- package/dist/attributes/shape/effects/implementations/duotone.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/duotone.js +0 -1
- package/dist/attributes/shape/effects/implementations/duotone.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/edges.d.ts +2 -15
- package/dist/attributes/shape/effects/implementations/edges.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/edges.js +0 -1
- package/dist/attributes/shape/effects/implementations/edges.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/glass.d.ts +1 -14
- package/dist/attributes/shape/effects/implementations/glass.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/glass.js +0 -1
- package/dist/attributes/shape/effects/implementations/glass.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/glow.d.ts +7 -47
- package/dist/attributes/shape/effects/implementations/glow.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/glow.js +1 -9
- package/dist/attributes/shape/effects/implementations/glow.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/grain.d.ts +1 -14
- package/dist/attributes/shape/effects/implementations/grain.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/grain.js +0 -1
- package/dist/attributes/shape/effects/implementations/grain.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/grayscale.d.ts +0 -1
- package/dist/attributes/shape/effects/implementations/grayscale.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/grayscale.js +0 -1
- package/dist/attributes/shape/effects/implementations/grayscale.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/halftone.d.ts +5 -29
- package/dist/attributes/shape/effects/implementations/halftone.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/halftone.js +0 -1
- package/dist/attributes/shape/effects/implementations/halftone.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/invert.d.ts +3 -12
- package/dist/attributes/shape/effects/implementations/invert.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/invert.js +0 -1
- package/dist/attributes/shape/effects/implementations/invert.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/kaleidoscope.d.ts +2 -19
- package/dist/attributes/shape/effects/implementations/kaleidoscope.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/kaleidoscope.js +1 -5
- package/dist/attributes/shape/effects/implementations/kaleidoscope.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/lut.d.ts +11 -36
- package/dist/attributes/shape/effects/implementations/lut.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/lut.js +2 -8
- package/dist/attributes/shape/effects/implementations/lut.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/magnify.d.ts +0 -1
- package/dist/attributes/shape/effects/implementations/magnify.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/magnify.js +0 -1
- package/dist/attributes/shape/effects/implementations/magnify.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/motion-blur.d.ts +3 -17
- package/dist/attributes/shape/effects/implementations/motion-blur.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/motion-blur.js +2 -11
- package/dist/attributes/shape/effects/implementations/motion-blur.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/oil-paint.d.ts +1 -12
- package/dist/attributes/shape/effects/implementations/oil-paint.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/oil-paint.js +0 -1
- package/dist/attributes/shape/effects/implementations/oil-paint.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/outline.d.ts +2 -14
- package/dist/attributes/shape/effects/implementations/outline.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/outline.js +0 -1
- package/dist/attributes/shape/effects/implementations/outline.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/pixelate.d.ts +1 -15
- package/dist/attributes/shape/effects/implementations/pixelate.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/pixelate.js +0 -1
- package/dist/attributes/shape/effects/implementations/pixelate.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/posterize.d.ts +1 -10
- package/dist/attributes/shape/effects/implementations/posterize.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/posterize.js +0 -1
- package/dist/attributes/shape/effects/implementations/posterize.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/progressive-blur.d.ts +3 -26
- package/dist/attributes/shape/effects/implementations/progressive-blur.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/progressive-blur.js +1 -2
- package/dist/attributes/shape/effects/implementations/progressive-blur.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/radial-blur.d.ts +2 -16
- package/dist/attributes/shape/effects/implementations/radial-blur.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/radial-blur.js +0 -1
- package/dist/attributes/shape/effects/implementations/radial-blur.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/rgb-shift.d.ts +1 -13
- package/dist/attributes/shape/effects/implementations/rgb-shift.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/rgb-shift.js +0 -1
- package/dist/attributes/shape/effects/implementations/rgb-shift.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/scanlines.d.ts +1 -8
- package/dist/attributes/shape/effects/implementations/scanlines.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/scanlines.js +0 -1
- package/dist/attributes/shape/effects/implementations/scanlines.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/scatter.d.ts +0 -1
- package/dist/attributes/shape/effects/implementations/scatter.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/scatter.js +0 -1
- package/dist/attributes/shape/effects/implementations/scatter.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/shader.d.ts +10 -53
- package/dist/attributes/shape/effects/implementations/shader.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/shader.js +2 -9
- package/dist/attributes/shape/effects/implementations/shader.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/sharpen.d.ts +1 -12
- package/dist/attributes/shape/effects/implementations/sharpen.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/sharpen.js +0 -1
- package/dist/attributes/shape/effects/implementations/sharpen.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/streak.d.ts +1 -8
- package/dist/attributes/shape/effects/implementations/streak.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/streak.js +0 -1
- package/dist/attributes/shape/effects/implementations/streak.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/threshold.d.ts +1 -9
- package/dist/attributes/shape/effects/implementations/threshold.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/threshold.js +0 -1
- package/dist/attributes/shape/effects/implementations/threshold.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/twirl.d.ts +1 -13
- package/dist/attributes/shape/effects/implementations/twirl.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/twirl.js +0 -1
- package/dist/attributes/shape/effects/implementations/twirl.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/vignette.d.ts +1 -9
- package/dist/attributes/shape/effects/implementations/vignette.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/vignette.js +0 -1
- package/dist/attributes/shape/effects/implementations/vignette.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/vintage.d.ts +0 -1
- package/dist/attributes/shape/effects/implementations/vintage.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/vintage.js +0 -1
- package/dist/attributes/shape/effects/implementations/vintage.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/wave.d.ts +3 -24
- package/dist/attributes/shape/effects/implementations/wave.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/wave.js +1 -5
- package/dist/attributes/shape/effects/implementations/wave.js.map +1 -1
- package/dist/attributes/shape/effects/registry.d.ts +6 -41
- package/dist/attributes/shape/effects/registry.d.ts.map +1 -1
- package/dist/attributes/shape/effects/registry.js +7 -45
- package/dist/attributes/shape/effects/registry.js.map +1 -1
- package/dist/attributes/shape/effects/spec.d.ts +6 -30
- package/dist/attributes/shape/effects/spec.d.ts.map +1 -1
- package/dist/attributes/shape/effects/spec.js +3 -9
- package/dist/attributes/shape/effects/spec.js.map +1 -1
- package/dist/attributes/shape/fill/blend.d.ts +1 -17
- package/dist/attributes/shape/fill/blend.d.ts.map +1 -1
- package/dist/attributes/shape/fill/blend.js +2 -15
- package/dist/attributes/shape/fill/blend.js.map +1 -1
- package/dist/attributes/shape/fill/chain.d.ts +17 -125
- package/dist/attributes/shape/fill/chain.d.ts.map +1 -1
- package/dist/attributes/shape/fill/chain.js +22 -109
- package/dist/attributes/shape/fill/chain.js.map +1 -1
- package/dist/attributes/shape/fill/coerce.d.ts +10 -35
- package/dist/attributes/shape/fill/coerce.d.ts.map +1 -1
- package/dist/attributes/shape/fill/coerce.js +12 -47
- package/dist/attributes/shape/fill/coerce.js.map +1 -1
- package/dist/attributes/shape/fill/color/parser.d.ts +10 -44
- package/dist/attributes/shape/fill/color/parser.d.ts.map +1 -1
- package/dist/attributes/shape/fill/color/parser.js +15 -91
- package/dist/attributes/shape/fill/color/parser.js.map +1 -1
- package/dist/attributes/shape/fill/gradient-stops.d.ts +1 -8
- package/dist/attributes/shape/fill/gradient-stops.d.ts.map +1 -1
- package/dist/attributes/shape/fill/gradient-stops.js +2 -13
- package/dist/attributes/shape/fill/gradient-stops.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/canvas3d.d.ts +2 -24
- package/dist/attributes/shape/fill/implementations/canvas3d.d.ts.map +1 -1
- package/dist/attributes/shape/fill/implementations/canvas3d.js +2 -9
- package/dist/attributes/shape/fill/implementations/canvas3d.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/dot-grid.d.ts +1 -14
- package/dist/attributes/shape/fill/implementations/dot-grid.d.ts.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 +5 -28
- package/dist/attributes/shape/fill/implementations/fractal-noise.d.ts.map +1 -1
- package/dist/attributes/shape/fill/implementations/fractal-noise.js +0 -1
- package/dist/attributes/shape/fill/implementations/fractal-noise.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/grid.d.ts +8 -21
- package/dist/attributes/shape/fill/implementations/grid.d.ts.map +1 -1
- package/dist/attributes/shape/fill/implementations/grid.js +2 -8
- package/dist/attributes/shape/fill/implementations/grid.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/image.d.ts +13 -79
- package/dist/attributes/shape/fill/implementations/image.d.ts.map +1 -1
- package/dist/attributes/shape/fill/implementations/image.js +6 -23
- package/dist/attributes/shape/fill/implementations/image.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/noise.d.ts +2 -15
- package/dist/attributes/shape/fill/implementations/noise.d.ts.map +1 -1
- package/dist/attributes/shape/fill/implementations/noise.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/shader.d.ts +11 -45
- package/dist/attributes/shape/fill/implementations/shader.d.ts.map +1 -1
- package/dist/attributes/shape/fill/implementations/shader.js +5 -17
- package/dist/attributes/shape/fill/implementations/shader.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/video.d.ts +12 -64
- package/dist/attributes/shape/fill/implementations/video.d.ts.map +1 -1
- package/dist/attributes/shape/fill/implementations/video.js +12 -50
- package/dist/attributes/shape/fill/implementations/video.js.map +1 -1
- package/dist/attributes/shape/fill/lerp.d.ts +2 -13
- package/dist/attributes/shape/fill/lerp.d.ts.map +1 -1
- package/dist/attributes/shape/fill/lerp.js +2 -9
- package/dist/attributes/shape/fill/lerp.js.map +1 -1
- package/dist/attributes/shape/fill/media-preset.d.ts +8 -49
- package/dist/attributes/shape/fill/media-preset.d.ts.map +1 -1
- package/dist/attributes/shape/fill/media-preset.js +8 -35
- package/dist/attributes/shape/fill/media-preset.js.map +1 -1
- package/dist/attributes/shape/fill/registry.d.ts +2 -26
- package/dist/attributes/shape/fill/registry.d.ts.map +1 -1
- package/dist/attributes/shape/fill/registry.js +5 -40
- package/dist/attributes/shape/fill/registry.js.map +1 -1
- package/dist/attributes/shape/fill/union.d.ts +6 -30
- package/dist/attributes/shape/fill/union.d.ts.map +1 -1
- package/dist/attributes/shape/fill/union.js +1 -9
- package/dist/attributes/shape/fill/union.js.map +1 -1
- package/dist/attributes/shape/filters/chain.d.ts +15 -168
- package/dist/attributes/shape/filters/chain.d.ts.map +1 -1
- package/dist/attributes/shape/filters/chain.js +8 -132
- package/dist/attributes/shape/filters/chain.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/color-matrix.d.ts +1 -7
- package/dist/attributes/shape/filters/implementations/color-matrix.d.ts.map +1 -1
- package/dist/attributes/shape/filters/implementations/color-matrix.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/curves.d.ts +1 -7
- package/dist/attributes/shape/filters/implementations/curves.d.ts.map +1 -1
- package/dist/attributes/shape/filters/implementations/curves.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/echo.d.ts +1 -11
- package/dist/attributes/shape/filters/implementations/echo.d.ts.map +1 -1
- package/dist/attributes/shape/filters/implementations/echo.js.map +1 -1
- package/dist/attributes/shape/filters/index.d.ts +1 -6
- package/dist/attributes/shape/filters/index.d.ts.map +1 -1
- package/dist/attributes/shape/filters/index.js +0 -2
- package/dist/attributes/shape/filters/index.js.map +1 -1
- package/dist/attributes/shape/filters/registry.d.ts +5 -35
- package/dist/attributes/shape/filters/registry.d.ts.map +1 -1
- package/dist/attributes/shape/filters/registry.js +7 -50
- package/dist/attributes/shape/filters/registry.js.map +1 -1
- package/dist/attributes/shape/filters/union.d.ts +10 -51
- 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 +18 -106
- package/dist/attributes/shape/path/anchors.d.ts.map +1 -1
- package/dist/attributes/shape/path/anchors.js +15 -124
- package/dist/attributes/shape/path/anchors.js.map +1 -1
- package/dist/attributes/shape/path/bezier.d.ts +6 -54
- package/dist/attributes/shape/path/bezier.d.ts.map +1 -1
- package/dist/attributes/shape/path/bezier.js +10 -98
- package/dist/attributes/shape/path/bezier.js.map +1 -1
- package/dist/attributes/shape/path/index.d.ts +1 -11
- package/dist/attributes/shape/path/index.d.ts.map +1 -1
- package/dist/attributes/shape/path/index.js +1 -11
- package/dist/attributes/shape/path/index.js.map +1 -1
- package/dist/attributes/shape/path/measure.d.ts +5 -41
- package/dist/attributes/shape/path/measure.d.ts.map +1 -1
- package/dist/attributes/shape/path/measure.js +8 -57
- package/dist/attributes/shape/path/measure.js.map +1 -1
- package/dist/attributes/shape/path/morph.d.ts +4 -41
- package/dist/attributes/shape/path/morph.d.ts.map +1 -1
- package/dist/attributes/shape/path/morph.js +17 -117
- package/dist/attributes/shape/path/morph.js.map +1 -1
- package/dist/attributes/shape/path/ops.d.ts +5 -19
- package/dist/attributes/shape/path/ops.d.ts.map +1 -1
- package/dist/attributes/shape/path/ops.js.map +1 -1
- package/dist/attributes/shape/path/types.d.ts +10 -67
- package/dist/attributes/shape/path/types.d.ts.map +1 -1
- package/dist/attributes/shape/path/types.js +0 -1
- package/dist/attributes/shape/path/types.js.map +1 -1
- package/dist/attributes/shape/path/walk.d.ts +9 -63
- package/dist/attributes/shape/path/walk.d.ts.map +1 -1
- package/dist/attributes/shape/path/walk.js +21 -100
- package/dist/attributes/shape/path/walk.js.map +1 -1
- package/dist/attributes/shape/shaders/language.d.ts +2 -14
- package/dist/attributes/shape/shaders/language.d.ts.map +1 -1
- package/dist/attributes/shape/shaders/language.js +1 -8
- package/dist/attributes/shape/shaders/language.js.map +1 -1
- package/dist/attributes/shape/shaders/pack.d.ts +13 -78
- package/dist/attributes/shape/shaders/pack.d.ts.map +1 -1
- package/dist/attributes/shape/shaders/pack.js +1 -10
- package/dist/attributes/shape/shaders/pack.js.map +1 -1
- package/dist/attributes/shape/shaders/resolve.d.ts +1 -11
- package/dist/attributes/shape/shaders/resolve.d.ts.map +1 -1
- package/dist/attributes/shape/shaders/resolve.js +3 -28
- package/dist/attributes/shape/shaders/resolve.js.map +1 -1
- package/dist/attributes/shape/shaders/uniforms.d.ts +3 -24
- package/dist/attributes/shape/shaders/uniforms.d.ts.map +1 -1
- package/dist/attributes/shape/shaders/uniforms.js +0 -0
- package/dist/attributes/shape/shaders/uniforms.js.map +1 -1
- package/dist/attributes/shape/shadow/shadow.d.ts +3 -20
- package/dist/attributes/shape/shadow/shadow.d.ts.map +1 -1
- package/dist/attributes/shape/shadow/shadow.js +0 -3
- package/dist/attributes/shape/shadow/shadow.js.map +1 -1
- package/dist/attributes/shape/stroke/stroke.d.ts +9 -58
- package/dist/attributes/shape/stroke/stroke.d.ts.map +1 -1
- package/dist/attributes/shape/stroke/stroke.js +0 -6
- package/dist/attributes/shape/stroke/stroke.js.map +1 -1
- package/dist/attributes/shared/operators.d.ts +1 -8
- package/dist/attributes/shared/operators.d.ts.map +1 -1
- package/dist/attributes/shared/operators.js.map +1 -1
- package/dist/attributes/text/index.d.ts +1 -11
- package/dist/attributes/text/index.d.ts.map +1 -1
- package/dist/attributes/text/index.js +1 -11
- package/dist/attributes/text/index.js.map +1 -1
- package/dist/attributes/text/ops.d.ts +4 -30
- package/dist/attributes/text/ops.d.ts.map +1 -1
- package/dist/attributes/text/ops.js +7 -23
- package/dist/attributes/text/ops.js.map +1 -1
- package/dist/attributes/text/types.d.ts +5 -28
- package/dist/attributes/text/types.d.ts.map +1 -1
- package/dist/attributes/text/types.js.map +1 -1
- package/dist/browser/chunks/chunk-3ZIUZZC7.js +13 -0
- package/dist/browser/chunks/chunk-3ZIUZZC7.js.map +7 -0
- package/dist/browser/chunks/{chunk-CCGVIR4F.js → chunk-5TDMGUXQ.js} +3 -3
- package/dist/browser/chunks/chunk-5TDMGUXQ.js.map +7 -0
- package/dist/browser/chunks/chunk-7YOYMMXK.js +6 -0
- package/dist/browser/chunks/chunk-7YOYMMXK.js.map +7 -0
- package/dist/browser/chunks/{chunk-4BDLFEOC.js → chunk-GEJEQQER.js} +1 -1
- package/dist/browser/chunks/chunk-GEJEQQER.js.map +7 -0
- package/dist/browser/component.js +1 -1
- package/dist/browser/experimental.js +1 -1
- package/dist/browser/index.js +1 -1
- package/dist/browser/index.js.map +4 -4
- package/dist/browser/manifest.json +1 -1
- package/dist/browser/sdk.js +1 -1
- package/dist/component.d.ts +3 -10
- package/dist/component.d.ts.map +1 -1
- package/dist/component.js +3 -10
- package/dist/component.js.map +1 -1
- package/dist/components/builtins/geometry/geometry.d.ts +15 -62
- package/dist/components/builtins/geometry/geometry.d.ts.map +1 -1
- package/dist/components/builtins/geometry/geometry.js.map +1 -1
- package/dist/components/builtins/geometry/shape-outline.d.ts +12 -61
- package/dist/components/builtins/geometry/shape-outline.d.ts.map +1 -1
- package/dist/components/builtins/geometry/shape-outline.js +29 -168
- package/dist/components/builtins/geometry/shape-outline.js.map +1 -1
- package/dist/components/builtins/layout/layout.d.ts +1 -14
- package/dist/components/builtins/layout/layout.d.ts.map +1 -1
- package/dist/components/builtins/layout/layout.js.map +1 -1
- package/dist/components/builtins/media/media.d.ts +11 -51
- package/dist/components/builtins/media/media.d.ts.map +1 -1
- package/dist/components/builtins/media/media.js +3 -7
- package/dist/components/builtins/media/media.js.map +1 -1
- package/dist/components/builtins/text/number-format.d.ts +14 -47
- package/dist/components/builtins/text/number-format.d.ts.map +1 -1
- package/dist/components/builtins/text/number-format.js +19 -69
- package/dist/components/builtins/text/number-format.js.map +1 -1
- package/dist/components/builtins/text/number-pattern.d.ts +3 -37
- package/dist/components/builtins/text/number-pattern.d.ts.map +1 -1
- package/dist/components/builtins/text/number-pattern.js +6 -48
- package/dist/components/builtins/text/number-pattern.js.map +1 -1
- package/dist/components/builtins/text/text-defaults.d.ts +7 -25
- package/dist/components/builtins/text/text-defaults.d.ts.map +1 -1
- package/dist/components/builtins/text/text-defaults.js +7 -25
- package/dist/components/builtins/text/text-defaults.js.map +1 -1
- package/dist/components/builtins/text/text-layout.d.ts +2 -11
- package/dist/components/builtins/text/text-layout.d.ts.map +1 -1
- package/dist/components/builtins/text/text-layout.js +7 -22
- package/dist/components/builtins/text/text-layout.js.map +1 -1
- package/dist/components/builtins/text/text.d.ts +8 -46
- package/dist/components/builtins/text/text.d.ts.map +1 -1
- package/dist/components/builtins/text/text.js.map +1 -1
- package/dist/components/builtins/three/canvas3d.d.ts +6 -51
- package/dist/components/builtins/three/canvas3d.d.ts.map +1 -1
- package/dist/components/builtins/three/canvas3d.js.map +1 -1
- package/dist/components/builtins/three/grid-geometry3d.d.ts +3 -39
- package/dist/components/builtins/three/grid-geometry3d.d.ts.map +1 -1
- package/dist/components/builtins/three/grid-geometry3d.js +8 -46
- package/dist/components/builtins/three/grid-geometry3d.js.map +1 -1
- package/dist/components/builtins/three/three.d.ts +22 -117
- package/dist/components/builtins/three/three.d.ts.map +1 -1
- package/dist/components/builtins/three/three.js +5 -17
- package/dist/components/builtins/three/three.js.map +1 -1
- package/dist/components/factory/api.d.ts.map +1 -1
- package/dist/components/factory/api.js.map +1 -1
- package/dist/components/factory/views.d.ts.map +1 -1
- package/dist/components/factory/views.js +0 -2
- package/dist/components/factory/views.js.map +1 -1
- package/dist/components/trees/2d/group-bounds.d.ts +12 -41
- package/dist/components/trees/2d/group-bounds.d.ts.map +1 -1
- package/dist/components/trees/2d/group-bounds.js +3 -22
- package/dist/components/trees/2d/group-bounds.js.map +1 -1
- package/dist/components/trees/2d/node-lifecycle.d.ts +8 -36
- package/dist/components/trees/2d/node-lifecycle.d.ts.map +1 -1
- package/dist/components/trees/2d/node-lifecycle.js +35 -127
- package/dist/components/trees/2d/node-lifecycle.js.map +1 -1
- package/dist/components/trees/2d/node-motion.d.ts +4 -36
- package/dist/components/trees/2d/node-motion.d.ts.map +1 -1
- package/dist/components/trees/2d/node-motion.js +3 -31
- package/dist/components/trees/2d/node-motion.js.map +1 -1
- package/dist/components/trees/2d/node-render.d.ts +3 -20
- package/dist/components/trees/2d/node-render.d.ts.map +1 -1
- package/dist/components/trees/2d/node-render.js +4 -23
- package/dist/components/trees/2d/node-render.js.map +1 -1
- package/dist/components/trees/2d/node-space.d.ts +4 -23
- package/dist/components/trees/2d/node-space.d.ts.map +1 -1
- package/dist/components/trees/2d/node-space.js +3 -17
- package/dist/components/trees/2d/node-space.js.map +1 -1
- package/dist/components/trees/2d/node-transform.d.ts +4 -33
- package/dist/components/trees/2d/node-transform.d.ts.map +1 -1
- package/dist/components/trees/2d/node-transform.js +4 -33
- package/dist/components/trees/2d/node-transform.js.map +1 -1
- package/dist/components/trees/2d/node2d.d.ts +112 -622
- package/dist/components/trees/2d/node2d.d.ts.map +1 -1
- package/dist/components/trees/2d/node2d.js +131 -605
- package/dist/components/trees/2d/node2d.js.map +1 -1
- package/dist/components/trees/audio/node-audio.d.ts +17 -65
- package/dist/components/trees/audio/node-audio.d.ts.map +1 -1
- package/dist/components/trees/audio/node-audio.js +18 -68
- package/dist/components/trees/audio/node-audio.js.map +1 -1
- package/dist/components/trees/node/node-editor-state.d.ts +5 -45
- package/dist/components/trees/node/node-editor-state.d.ts.map +1 -1
- package/dist/components/trees/node/node-editor-state.js +1 -13
- package/dist/components/trees/node/node-editor-state.js.map +1 -1
- package/dist/components/trees/node/node-reactive.d.ts +6 -53
- package/dist/components/trees/node/node-reactive.d.ts.map +1 -1
- package/dist/components/trees/node/node-reactive.js +4 -33
- package/dist/components/trees/node/node-reactive.js.map +1 -1
- package/dist/components/trees/node/node-time.d.ts +2 -15
- package/dist/components/trees/node/node-time.d.ts.map +1 -1
- package/dist/components/trees/node/node-time.js.map +1 -1
- package/dist/components/trees/node/node-walk.d.ts +7 -32
- package/dist/components/trees/node/node-walk.d.ts.map +1 -1
- package/dist/components/trees/node/node-walk.js +7 -32
- package/dist/components/trees/node/node-walk.js.map +1 -1
- package/dist/components/trees/node/node.d.ts +43 -248
- package/dist/components/trees/node/node.d.ts.map +1 -1
- package/dist/components/trees/node/node.js +51 -229
- package/dist/components/trees/node/node.js.map +1 -1
- package/dist/components/trees/root/canvas2d-node.d.ts +7 -60
- package/dist/components/trees/root/canvas2d-node.d.ts.map +1 -1
- package/dist/components/trees/root/canvas2d-node.js +7 -47
- package/dist/components/trees/root/canvas2d-node.js.map +1 -1
- package/dist/components/trees/three/node3d.d.ts +24 -112
- package/dist/components/trees/three/node3d.d.ts.map +1 -1
- package/dist/components/trees/three/node3d.js +22 -104
- package/dist/components/trees/three/node3d.js.map +1 -1
- package/dist/document/audio.d.ts +9 -21
- package/dist/document/audio.d.ts.map +1 -1
- package/dist/document/audio.js +13 -28
- package/dist/document/audio.js.map +1 -1
- package/dist/document/builtins.d.ts +3 -9
- package/dist/document/builtins.d.ts.map +1 -1
- package/dist/document/builtins.js +43 -89
- package/dist/document/builtins.js.map +1 -1
- package/dist/document/command-traits.d.ts +14 -37
- package/dist/document/command-traits.d.ts.map +1 -1
- package/dist/document/command-traits.js +22 -39
- package/dist/document/command-traits.js.map +1 -1
- package/dist/document/deny-globals.d.ts +9 -43
- package/dist/document/deny-globals.d.ts.map +1 -1
- package/dist/document/deny-globals.js +18 -58
- package/dist/document/deny-globals.js.map +1 -1
- package/dist/document/diff.d.ts +6 -16
- package/dist/document/diff.d.ts.map +1 -1
- package/dist/document/diff.js +5 -11
- package/dist/document/diff.js.map +1 -1
- package/dist/document/doc-index.d.ts +5 -13
- package/dist/document/doc-index.d.ts.map +1 -1
- package/dist/document/doc-index.js +0 -2
- package/dist/document/doc-index.js.map +1 -1
- package/dist/document/expression/compile.d.ts +2 -2
- package/dist/document/expression/compile.d.ts.map +1 -1
- package/dist/document/expression/compile.js +8 -18
- package/dist/document/expression/compile.js.map +1 -1
- package/dist/document/expression/index.d.ts +11 -41
- package/dist/document/expression/index.d.ts.map +1 -1
- package/dist/document/expression/index.js +11 -41
- package/dist/document/expression/index.js.map +1 -1
- package/dist/document/expression/ops.d.ts +3 -12
- package/dist/document/expression/ops.d.ts.map +1 -1
- package/dist/document/expression/ops.js +4 -20
- package/dist/document/expression/ops.js.map +1 -1
- package/dist/document/expression/parse.d.ts +4 -14
- package/dist/document/expression/parse.d.ts.map +1 -1
- package/dist/document/expression/parse.js +34 -55
- package/dist/document/expression/parse.js.map +1 -1
- package/dist/document/expression/refs.d.ts +2 -8
- package/dist/document/expression/refs.d.ts.map +1 -1
- package/dist/document/expression/refs.js +2 -6
- package/dist/document/expression/refs.js.map +1 -1
- package/dist/document/expression/types.d.ts +18 -63
- package/dist/document/expression/types.d.ts.map +1 -1
- package/dist/document/expression/types.js +4 -15
- package/dist/document/expression/types.js.map +1 -1
- package/dist/document/expression/walk.d.ts +6 -20
- package/dist/document/expression/walk.d.ts.map +1 -1
- package/dist/document/expression/walk.js +18 -44
- package/dist/document/expression/walk.js.map +1 -1
- package/dist/document/index.js +2 -3
- package/dist/document/index.js.map +1 -1
- package/dist/document/migrate.d.ts +7 -22
- package/dist/document/migrate.d.ts.map +1 -1
- package/dist/document/migrate.js +44 -15
- package/dist/document/migrate.js.map +1 -1
- package/dist/document/missing-node.d.ts +4 -11
- package/dist/document/missing-node.d.ts.map +1 -1
- package/dist/document/missing-node.js +2 -5
- package/dist/document/missing-node.js.map +1 -1
- package/dist/document/node-decorator.d.ts +12 -53
- package/dist/document/node-decorator.d.ts.map +1 -1
- package/dist/document/node-decorator.js +16 -57
- package/dist/document/node-decorator.js.map +1 -1
- package/dist/document/node-descriptor.d.ts +25 -62
- 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 +18 -41
- package/dist/document/placement.d.ts.map +1 -1
- package/dist/document/placement.js +4 -11
- package/dist/document/placement.js.map +1 -1
- package/dist/document/project.d.ts +19 -52
- package/dist/document/project.d.ts.map +1 -1
- package/dist/document/project.js +2 -6
- package/dist/document/project.js.map +1 -1
- package/dist/document/prop-evolution.d.ts +10 -20
- package/dist/document/prop-evolution.d.ts.map +1 -1
- package/dist/document/prop-evolution.js +3 -7
- package/dist/document/prop-evolution.js.map +1 -1
- package/dist/document/registry.d.ts +80 -318
- package/dist/document/registry.d.ts.map +1 -1
- package/dist/document/registry.js +43 -147
- package/dist/document/registry.js.map +1 -1
- package/dist/document/settled-index.d.ts +11 -23
- package/dist/document/settled-index.d.ts.map +1 -1
- package/dist/document/settled-index.js +15 -34
- package/dist/document/settled-index.js.map +1 -1
- package/dist/document/timeline-patch.d.ts +6 -15
- package/dist/document/timeline-patch.d.ts.map +1 -1
- package/dist/document/timeline-patch.js +12 -21
- package/dist/document/timeline-patch.js.map +1 -1
- package/dist/document/timeline.d.ts +56 -263
- package/dist/document/timeline.d.ts.map +1 -1
- package/dist/document/timeline.js +71 -275
- package/dist/document/timeline.js.map +1 -1
- package/dist/document/types.d.ts +90 -264
- package/dist/document/types.d.ts.map +1 -1
- package/dist/document/types.js +13 -30
- package/dist/document/types.js.map +1 -1
- package/dist/document/validate.d.ts +10 -40
- package/dist/document/validate.d.ts.map +1 -1
- package/dist/document/validate.js +72 -137
- package/dist/document/validate.js.map +1 -1
- package/dist/document/vocabulary.d.ts +4 -7
- package/dist/document/vocabulary.d.ts.map +1 -1
- package/dist/document/vocabulary.js +0 -1
- package/dist/document/vocabulary.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/layout/bounds.d.ts +1 -11
- package/dist/layout/bounds.d.ts.map +1 -1
- package/dist/layout/bounds.js.map +1 -1
- package/dist/layout/flex.d.ts +6 -20
- package/dist/layout/flex.d.ts.map +1 -1
- package/dist/layout/flex.js +7 -28
- package/dist/layout/flex.js.map +1 -1
- package/dist/layout/ops.d.ts +2 -11
- package/dist/layout/ops.d.ts.map +1 -1
- package/dist/layout/ops.js +2 -22
- package/dist/layout/ops.js.map +1 -1
- package/dist/layout/types.d.ts +11 -55
- package/dist/layout/types.d.ts.map +1 -1
- package/dist/layout/types.js.map +1 -1
- package/dist/platform/audio-sink.d.ts +7 -43
- package/dist/platform/audio-sink.d.ts.map +1 -1
- package/dist/platform/audio-sink.js +4 -29
- package/dist/platform/audio-sink.js.map +1 -1
- package/dist/platform/exporter.d.ts +5 -31
- package/dist/platform/exporter.d.ts.map +1 -1
- package/dist/platform/exporter.js.map +1 -1
- package/dist/platform/stepped-clock.d.ts +1 -16
- package/dist/platform/stepped-clock.d.ts.map +1 -1
- package/dist/platform/stepped-clock.js +1 -16
- package/dist/platform/stepped-clock.js.map +1 -1
- package/dist/platform/storage-adapter.d.ts +8 -68
- package/dist/platform/storage-adapter.d.ts.map +1 -1
- package/dist/platform/storage-adapter.js +8 -60
- package/dist/platform/storage-adapter.js.map +1 -1
- package/dist/platform/ticker.d.ts +11 -45
- package/dist/platform/ticker.d.ts.map +1 -1
- package/dist/platform/ticker.js +10 -37
- package/dist/platform/ticker.js.map +1 -1
- package/dist/project/config.d.ts +4 -14
- package/dist/project/config.d.ts.map +1 -1
- package/dist/project/config.js.map +1 -1
- package/dist/project/tree.d.ts +6 -35
- package/dist/project/tree.d.ts.map +1 -1
- package/dist/project/tree.js +1 -8
- package/dist/project/tree.js.map +1 -1
- package/dist/props/host.d.ts +2 -13
- package/dist/props/host.d.ts.map +1 -1
- package/dist/props/host.js.map +1 -1
- package/dist/props/layout.d.ts +1 -12
- package/dist/props/layout.d.ts.map +1 -1
- package/dist/props/layout.js +1 -12
- package/dist/props/layout.js.map +1 -1
- package/dist/props/observer.d.ts +1 -7
- package/dist/props/observer.d.ts.map +1 -1
- package/dist/props/observer.js.map +1 -1
- package/dist/props/slot.d.ts +6 -19
- package/dist/props/slot.d.ts.map +1 -1
- package/dist/props/slot.js +5 -14
- package/dist/props/slot.js.map +1 -1
- package/dist/render/canvas-render-context2d.d.ts +8 -68
- package/dist/render/canvas-render-context2d.d.ts.map +1 -1
- package/dist/render/canvas-render-context2d.js +8 -69
- package/dist/render/canvas-render-context2d.js.map +1 -1
- package/dist/render/clip-contains.d.ts +2 -16
- package/dist/render/clip-contains.d.ts.map +1 -1
- package/dist/render/clip-contains.js +21 -82
- package/dist/render/clip-contains.js.map +1 -1
- package/dist/render/clip.d.ts +7 -25
- package/dist/render/clip.d.ts.map +1 -1
- package/dist/render/clip.js +5 -17
- package/dist/render/clip.js.map +1 -1
- package/dist/render/descriptors/ellipse.d.ts.map +1 -1
- package/dist/render/descriptors/ellipse.js +0 -1
- package/dist/render/descriptors/ellipse.js.map +1 -1
- package/dist/render/descriptors/line.d.ts.map +1 -1
- package/dist/render/descriptors/line.js +0 -1
- package/dist/render/descriptors/line.js.map +1 -1
- package/dist/render/descriptors/path-builder.d.ts +4 -32
- package/dist/render/descriptors/path-builder.d.ts.map +1 -1
- package/dist/render/descriptors/path-builder.js +3 -25
- package/dist/render/descriptors/path-builder.js.map +1 -1
- package/dist/render/descriptors/path.d.ts +1 -11
- package/dist/render/descriptors/path.d.ts.map +1 -1
- package/dist/render/descriptors/path.js +0 -1
- package/dist/render/descriptors/path.js.map +1 -1
- package/dist/render/descriptors/polygon.d.ts.map +1 -1
- package/dist/render/descriptors/polygon.js +0 -1
- package/dist/render/descriptors/polygon.js.map +1 -1
- package/dist/render/descriptors/polygram.d.ts.map +1 -1
- package/dist/render/descriptors/polygram.js +0 -1
- package/dist/render/descriptors/polygram.js.map +1 -1
- package/dist/render/descriptors/rect.d.ts.map +1 -1
- package/dist/render/descriptors/rect.js +0 -1
- package/dist/render/descriptors/rect.js.map +1 -1
- package/dist/render/descriptors/richtext.d.ts.map +1 -1
- package/dist/render/descriptors/richtext.js +0 -1
- package/dist/render/descriptors/richtext.js.map +1 -1
- package/dist/render/descriptors/shape.d.ts +17 -77
- package/dist/render/descriptors/shape.d.ts.map +1 -1
- package/dist/render/descriptors/shape.js +13 -47
- package/dist/render/descriptors/shape.js.map +1 -1
- package/dist/render/descriptors/text.d.ts +15 -94
- package/dist/render/descriptors/text.d.ts.map +1 -1
- package/dist/render/descriptors/text.js +8 -50
- package/dist/render/descriptors/text.js.map +1 -1
- package/dist/render/descriptors/transform.d.ts +5 -16
- package/dist/render/descriptors/transform.d.ts.map +1 -1
- package/dist/render/descriptors/transform.js +1 -17
- package/dist/render/descriptors/transform.js.map +1 -1
- package/dist/render/graphics2d.d.ts +24 -116
- package/dist/render/graphics2d.d.ts.map +1 -1
- package/dist/render/graphics2d.js +23 -108
- package/dist/render/graphics2d.js.map +1 -1
- package/dist/render/measure-context.d.ts +5 -29
- package/dist/render/measure-context.d.ts.map +1 -1
- package/dist/render/measure-context.js.map +1 -1
- package/dist/render/null-render-context.d.ts +2 -20
- package/dist/render/null-render-context.d.ts.map +1 -1
- package/dist/render/null-render-context.js +2 -20
- package/dist/render/null-render-context.js.map +1 -1
- package/dist/render/render-context2d.d.ts +52 -208
- package/dist/render/render-context2d.d.ts.map +1 -1
- package/dist/render/render-context2d.js.map +1 -1
- package/dist/render/surface.d.ts +2 -19
- package/dist/render/surface.d.ts.map +1 -1
- package/dist/render/surface.js.map +1 -1
- package/dist/render/text-defaults.d.ts +1 -17
- package/dist/render/text-defaults.d.ts.map +1 -1
- package/dist/render/text-defaults.js +6 -40
- package/dist/render/text-defaults.js.map +1 -1
- package/dist/render/text-layout.d.ts +12 -55
- package/dist/render/text-layout.d.ts.map +1 -1
- package/dist/render/text-layout.js +2 -16
- package/dist/render/text-layout.js.map +1 -1
- package/dist/render3d/bounds3d.d.ts +10 -32
- package/dist/render3d/bounds3d.d.ts.map +1 -1
- package/dist/render3d/bounds3d.js +2 -12
- package/dist/render3d/bounds3d.js.map +1 -1
- package/dist/render3d/builders.d.ts +8 -35
- package/dist/render3d/builders.d.ts.map +1 -1
- package/dist/render3d/builders.js +8 -35
- package/dist/render3d/builders.js.map +1 -1
- package/dist/render3d/camera.d.ts +10 -57
- package/dist/render3d/camera.d.ts.map +1 -1
- package/dist/render3d/camera.js +4 -26
- package/dist/render3d/camera.js.map +1 -1
- package/dist/render3d/fill3d.d.ts +7 -45
- package/dist/render3d/fill3d.d.ts.map +1 -1
- package/dist/render3d/fill3d.js +15 -85
- package/dist/render3d/fill3d.js.map +1 -1
- package/dist/render3d/geometry.d.ts +18 -106
- package/dist/render3d/geometry.d.ts.map +1 -1
- package/dist/render3d/geometry.js +2 -20
- package/dist/render3d/geometry.js.map +1 -1
- package/dist/render3d/graphics3d.d.ts +29 -133
- package/dist/render3d/graphics3d.d.ts.map +1 -1
- package/dist/render3d/graphics3d.js +23 -110
- package/dist/render3d/graphics3d.js.map +1 -1
- package/dist/render3d/index.d.ts +1 -16
- package/dist/render3d/index.d.ts.map +1 -1
- package/dist/render3d/index.js +1 -16
- package/dist/render3d/index.js.map +1 -1
- package/dist/render3d/inert.d.ts.map +1 -1
- package/dist/render3d/inert.js +1 -14
- package/dist/render3d/inert.js.map +1 -1
- package/dist/render3d/light.d.ts +3 -26
- package/dist/render3d/light.d.ts.map +1 -1
- package/dist/render3d/light.js.map +1 -1
- package/dist/render3d/material.d.ts +13 -87
- package/dist/render3d/material.d.ts.map +1 -1
- package/dist/render3d/material.js +2 -16
- package/dist/render3d/material.js.map +1 -1
- package/dist/render3d/matrix4.d.ts +14 -68
- package/dist/render3d/matrix4.d.ts.map +1 -1
- package/dist/render3d/matrix4.js +11 -60
- package/dist/render3d/matrix4.js.map +1 -1
- package/dist/render3d/render-context3d.d.ts +13 -51
- package/dist/render3d/render-context3d.d.ts.map +1 -1
- package/dist/render3d/render-context3d.js +9 -21
- package/dist/render3d/render-context3d.js.map +1 -1
- package/dist/render3d/resources.d.ts +9 -53
- package/dist/render3d/resources.d.ts.map +1 -1
- package/dist/render3d/resources.js +8 -48
- package/dist/render3d/resources.js.map +1 -1
- package/dist/render3d/rounded-box.d.ts +7 -21
- package/dist/render3d/rounded-box.d.ts.map +1 -1
- package/dist/render3d/rounded-box.js +7 -46
- package/dist/render3d/rounded-box.js.map +1 -1
- package/dist/render3d/scene-settings.d.ts +20 -78
- 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 -53
- package/dist/render3d/scene3d.d.ts.map +1 -1
- package/dist/render3d/scene3d.js +12 -59
- package/dist/render3d/scene3d.js.map +1 -1
- package/dist/render3d/segments.d.ts +2 -25
- package/dist/render3d/segments.d.ts.map +1 -1
- package/dist/render3d/segments.js +1 -11
- package/dist/render3d/segments.js.map +1 -1
- package/dist/render3d/texture.d.ts +25 -112
- package/dist/render3d/texture.d.ts.map +1 -1
- package/dist/render3d/texture.js +3 -27
- package/dist/render3d/texture.js.map +1 -1
- package/dist/render3d/tracking.d.ts +2 -19
- package/dist/render3d/tracking.d.ts.map +1 -1
- package/dist/render3d/tracking.js +2 -19
- package/dist/render3d/tracking.js.map +1 -1
- package/dist/render3d/transform.d.ts +14 -60
- package/dist/render3d/transform.d.ts.map +1 -1
- package/dist/render3d/transform.js +0 -2
- package/dist/render3d/transform.js.map +1 -1
- package/dist/render3d/vector3.d.ts +6 -48
- package/dist/render3d/vector3.d.ts.map +1 -1
- package/dist/render3d/vector3.js +4 -38
- package/dist/render3d/vector3.js.map +1 -1
- package/dist/render3d/walk.d.ts +3 -27
- package/dist/render3d/walk.d.ts.map +1 -1
- package/dist/render3d/walk.js +5 -33
- package/dist/render3d/walk.js.map +1 -1
- package/dist/runtime/asset-refine.d.ts +34 -20
- package/dist/runtime/asset-refine.d.ts.map +1 -1
- package/dist/runtime/asset-refine.js +127 -31
- package/dist/runtime/asset-refine.js.map +1 -1
- package/dist/runtime/asset-timeline.d.ts +14 -53
- package/dist/runtime/asset-timeline.d.ts.map +1 -1
- package/dist/runtime/asset-timeline.js +6 -27
- package/dist/runtime/asset-timeline.js.map +1 -1
- package/dist/runtime/asset-update.d.ts +7 -26
- package/dist/runtime/asset-update.d.ts.map +1 -1
- package/dist/runtime/asset-update.js +6 -18
- package/dist/runtime/asset-update.js.map +1 -1
- package/dist/runtime/audio-index.d.ts +0 -2
- package/dist/runtime/audio-index.d.ts.map +1 -1
- package/dist/runtime/audio-index.js +0 -2
- package/dist/runtime/audio-index.js.map +1 -1
- package/dist/runtime/builtin-context.d.ts +3 -9
- package/dist/runtime/builtin-context.d.ts.map +1 -1
- package/dist/runtime/builtin-context.js +3 -9
- package/dist/runtime/builtin-context.js.map +1 -1
- package/dist/runtime/clip-instance.d.ts +12 -39
- package/dist/runtime/clip-instance.d.ts.map +1 -1
- package/dist/runtime/clip-instance.js +21 -45
- package/dist/runtime/clip-instance.js.map +1 -1
- package/dist/runtime/clip-store.d.ts +26 -68
- package/dist/runtime/clip-store.d.ts.map +1 -1
- package/dist/runtime/clip-store.js +47 -81
- package/dist/runtime/clip-store.js.map +1 -1
- package/dist/runtime/engine.d.ts +31 -85
- package/dist/runtime/engine.d.ts.map +1 -1
- package/dist/runtime/engine.js +16 -49
- package/dist/runtime/engine.js.map +1 -1
- package/dist/runtime/frame-time.d.ts +4 -15
- package/dist/runtime/frame-time.d.ts.map +1 -1
- package/dist/runtime/frame-time.js +5 -12
- package/dist/runtime/frame-time.js.map +1 -1
- package/dist/runtime/index.d.ts +0 -1
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +0 -1
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/node-picking.d.ts +59 -139
- package/dist/runtime/node-picking.d.ts.map +1 -1
- package/dist/runtime/node-picking.js +87 -157
- package/dist/runtime/node-picking.js.map +1 -1
- package/dist/runtime/node-picking3d.d.ts +39 -96
- package/dist/runtime/node-picking3d.d.ts.map +1 -1
- package/dist/runtime/node-picking3d.js +98 -141
- package/dist/runtime/node-picking3d.js.map +1 -1
- package/dist/runtime/placement.d.ts +8 -17
- package/dist/runtime/placement.d.ts.map +1 -1
- package/dist/runtime/placement.js +7 -16
- package/dist/runtime/placement.js.map +1 -1
- package/dist/runtime/playback-controller.d.ts +78 -207
- package/dist/runtime/playback-controller.d.ts.map +1 -1
- package/dist/runtime/playback-controller.js +111 -226
- package/dist/runtime/playback-controller.js.map +1 -1
- package/dist/runtime/playback.d.ts +6 -14
- package/dist/runtime/playback.d.ts.map +1 -1
- package/dist/runtime/playback.js +6 -14
- package/dist/runtime/playback.js.map +1 -1
- package/dist/runtime/project-assets.d.ts +6 -14
- package/dist/runtime/project-assets.d.ts.map +1 -1
- package/dist/runtime/project-assets.js +7 -16
- package/dist/runtime/project-assets.js.map +1 -1
- package/dist/runtime/session.d.ts +22 -45
- package/dist/runtime/session.d.ts.map +1 -1
- package/dist/runtime/session.js +26 -46
- package/dist/runtime/session.js.map +1 -1
- package/dist/runtime/settle.d.ts +4 -10
- package/dist/runtime/settle.d.ts.map +1 -1
- package/dist/runtime/settle.js +4 -10
- package/dist/runtime/settle.js.map +1 -1
- package/dist/runtime/state-evaluator.d.ts +15 -37
- package/dist/runtime/state-evaluator.d.ts.map +1 -1
- package/dist/runtime/state-evaluator.js +27 -44
- package/dist/runtime/state-evaluator.js.map +1 -1
- package/dist/runtime/text-geometry.d.ts +18 -47
- package/dist/runtime/text-geometry.d.ts.map +1 -1
- package/dist/runtime/text-geometry.js +13 -27
- package/dist/runtime/text-geometry.js.map +1 -1
- package/dist/sdk/index.d.ts +1 -7
- package/dist/sdk/index.d.ts.map +1 -1
- package/dist/sdk/index.js +30 -138
- package/dist/sdk/index.js.map +1 -1
- package/dist/tween/command-decorator.d.ts +6 -26
- package/dist/tween/command-decorator.d.ts.map +1 -1
- package/dist/tween/command-decorator.js +1 -6
- package/dist/tween/command-decorator.js.map +1 -1
- package/dist/tween/command.d.ts +6 -53
- package/dist/tween/command.d.ts.map +1 -1
- package/dist/tween/command.js +5 -40
- package/dist/tween/command.js.map +1 -1
- package/dist/tween/ease/curve.d.ts +2 -17
- package/dist/tween/ease/curve.d.ts.map +1 -1
- package/dist/tween/ease/curve.js +1 -6
- package/dist/tween/ease/curve.js.map +1 -1
- package/dist/tween/ease/describe.d.ts +0 -11
- package/dist/tween/ease/describe.d.ts.map +1 -1
- package/dist/tween/ease/describe.js +0 -23
- package/dist/tween/ease/describe.js.map +1 -1
- package/dist/tween/ease/spec.d.ts +2 -18
- package/dist/tween/ease/spec.d.ts.map +1 -1
- package/dist/tween/ease/spec.js.map +1 -1
- package/dist/tween/inert.d.ts +1 -14
- package/dist/tween/inert.d.ts.map +1 -1
- package/dist/tween/inert.js +1 -14
- package/dist/tween/inert.js.map +1 -1
- package/dist/tween/lerp.d.ts +2 -26
- package/dist/tween/lerp.d.ts.map +1 -1
- package/dist/tween/lerp.js +2 -26
- package/dist/tween/lerp.js.map +1 -1
- package/dist/tween/loop.d.ts +9 -50
- package/dist/tween/loop.d.ts.map +1 -1
- package/dist/tween/loop.js +6 -31
- package/dist/tween/loop.js.map +1 -1
- package/dist/tween/prepare.d.ts +2 -30
- package/dist/tween/prepare.d.ts.map +1 -1
- package/dist/tween/prepare.js +2 -30
- package/dist/tween/prepare.js.map +1 -1
- package/dist/tween/stepper.d.ts +4 -25
- package/dist/tween/stepper.d.ts.map +1 -1
- package/dist/tween/stepper.js.map +1 -1
- package/dist/tween/to-command.d.ts +1 -8
- package/dist/tween/to-command.d.ts.map +1 -1
- package/dist/tween/to-command.js +2 -25
- package/dist/tween/to-command.js.map +1 -1
- package/dist/util/context.d.ts +4 -29
- package/dist/util/context.d.ts.map +1 -1
- package/dist/util/context.js +3 -15
- package/dist/util/context.js.map +1 -1
- package/dist/util/csv.d.ts +4 -29
- package/dist/util/csv.d.ts.map +1 -1
- package/dist/util/csv.js +3 -22
- package/dist/util/csv.js.map +1 -1
- package/dist/util/metrics.d.ts +2 -26
- package/dist/util/metrics.d.ts.map +1 -1
- package/dist/util/metrics.js +2 -26
- package/dist/util/metrics.js.map +1 -1
- package/dist/util/random.d.ts +20 -87
- package/dist/util/random.d.ts.map +1 -1
- package/dist/util/random.js +20 -87
- package/dist/util/random.js.map +1 -1
- package/dist/util/reference.d.ts +6 -35
- package/dist/util/reference.d.ts.map +1 -1
- package/dist/util/reference.js +1 -4
- package/dist/util/reference.js.map +1 -1
- package/dist/util/scheduler.d.ts +6 -27
- package/dist/util/scheduler.d.ts.map +1 -1
- package/dist/util/scheduler.js +8 -35
- package/dist/util/scheduler.js.map +1 -1
- package/package.json +1 -1
- package/dist/browser/chunks/chunk-4BDLFEOC.js.map +0 -7
- package/dist/browser/chunks/chunk-CCGVIR4F.js.map +0 -7
- package/dist/browser/chunks/chunk-N4WSN5WY.js +0 -13
- package/dist/browser/chunks/chunk-N4WSN5WY.js.map +0 -7
- package/dist/browser/chunks/chunk-WZSI3GSK.js +0 -6
- package/dist/browser/chunks/chunk-WZSI3GSK.js.map +0 -7
- package/dist/renamed-scene-names.d.ts +0 -17
- package/dist/renamed-scene-names.d.ts.map +0 -1
- package/dist/renamed-scene-names.js +0 -9
- package/dist/renamed-scene-names.js.map +0 -1
- package/dist/runtime/precompisition.d.ts +0 -24
- package/dist/runtime/precompisition.d.ts.map +0 -1
- package/dist/runtime/precompisition.js +0 -7
- package/dist/runtime/precompisition.js.map +0 -1
|
@@ -1,15 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* How a chart writes a number down
|
|
2
|
+
* How a chart writes a number down: one formatter driven by a **pattern**, with the named formats being patterns
|
|
3
|
+
* too (`currency` is `$#,##0.00`), so a preset and a free-text pattern can't drift apart.
|
|
3
4
|
*
|
|
4
|
-
*
|
|
5
|
-
* too — `currency` is `$#,##0.00` and nothing more. That is the whole design:
|
|
6
|
-
* a dropdown of four presets and a free-text pattern are otherwise two features
|
|
7
|
-
* that drift, one of them gaining a thousands separator or a negative sign the
|
|
8
|
-
* other never hears about. Here the preset *is* the custom case with the
|
|
9
|
-
* pattern filled in, so there is one set of rules to get right.
|
|
10
|
-
*
|
|
11
|
-
* The grammar is the spreadsheet one, because that is where the numbers come
|
|
12
|
-
* from and what an author already knows:
|
|
5
|
+
* The grammar is the spreadsheet one:
|
|
13
6
|
*
|
|
14
7
|
* | Pattern | 1234.5 | 0.07 |
|
|
15
8
|
* | ------------ | --------- | ------ |
|
|
@@ -19,35 +12,19 @@
|
|
|
19
12
|
* | `0.#%` | `123450%` | `7%` |
|
|
20
13
|
* | `#,##0 kg` | `1,235 kg` | `0 kg` |
|
|
21
14
|
*
|
|
22
|
-
* - `0` is a digit
|
|
23
|
-
*
|
|
24
|
-
* -
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* - `%` scales by 100 as well as printing — that is what makes it a percent
|
|
28
|
-
* rather than a suffix, and it is why `0.07` under `0.#%` is `7%`. A column
|
|
29
|
-
* that is *already* in percent points wants `#,##0'%'`: quoted, so the sign
|
|
30
|
-
* is printed and nothing is scaled.
|
|
31
|
-
* - Anything else is literal, before the digits or after them. Quote it to be
|
|
32
|
-
* sure — `'#'#,##0` prints a leading hash.
|
|
33
|
-
*
|
|
34
|
-
* Deliberately **not** `Intl.NumberFormat`. Its output is locale-dependent, and
|
|
35
|
-
* a chart is a picture with a fixed layout: the same project rendering
|
|
36
|
-
* `1,234.50` on the author's machine and `1.234,50` on the export box is a
|
|
37
|
-
* silently different image, and the wider string can reflow an axis. What an
|
|
38
|
-
* author wants here is the format they *typed*.
|
|
39
|
-
*/
|
|
40
|
-
/**
|
|
41
|
-
* The pattern behind each named format.
|
|
15
|
+
* - `0` is a digit always written, `#` one written only when needed (`0.00` pads, `0.##` trims).
|
|
16
|
+
* - A `,` anywhere in the integer run turns grouping on; where it sits doesn't matter.
|
|
17
|
+
* - `%` scales by 100 as well as printing (`0.07` under `0.#%` is `7%`). A column already in percent points wants
|
|
18
|
+
* `#,##0'%'`: quoted, so the sign prints and nothing scales.
|
|
19
|
+
* - Anything else is literal, before or after the digits. Quote it to be sure: `'#'#,##0` prints a leading hash.
|
|
42
20
|
*
|
|
43
|
-
* `
|
|
44
|
-
*
|
|
45
|
-
*
|
|
21
|
+
* Deliberately **not** `Intl.NumberFormat`: its output is locale-dependent, and a chart is a picture with a fixed
|
|
22
|
+
* layout (`1,234.50` on the author's machine and `1.234,50` on the export box is a silently different image that
|
|
23
|
+
* can reflow an axis).
|
|
46
24
|
*/
|
|
25
|
+
/** The pattern behind each named format. `plain` is the historic behaviour (integers bare, else one decimal), the default so no existing chart re-labels itself. */
|
|
47
26
|
export const NUMBER_PATTERNS = {
|
|
48
|
-
// Ungrouped on purpose:
|
|
49
|
-
// formats at all, and it is the default, so every chart already drawn keeps
|
|
50
|
-
// the labels it has. Grouping is what the reader picks `number` for.
|
|
27
|
+
// Ungrouped on purpose: the default, so every chart already drawn keeps its labels; grouping is what `number` is for.
|
|
51
28
|
plain: "#.#",
|
|
52
29
|
number: "#,##0.##",
|
|
53
30
|
currency: "$#,##0.00",
|
|
@@ -107,14 +84,7 @@ function literal(text) {
|
|
|
107
84
|
});
|
|
108
85
|
return out;
|
|
109
86
|
}
|
|
110
|
-
/**
|
|
111
|
-
* The `[start, end)` of the pattern's digit run — the first stretch of `#0,.`
|
|
112
|
-
* outside quotes.
|
|
113
|
-
*
|
|
114
|
-
* Quote-aware, so `'#'#,##0` reads its leading hash as text and its run as the
|
|
115
|
-
* three characters after it. Without that, a quoted `#` would be taken for the
|
|
116
|
-
* number and the real digits for a suffix.
|
|
117
|
-
*/
|
|
87
|
+
/** The `[start, end)` of the pattern's digit run (the first stretch of `#0,.` outside quotes). Quote-aware, so `'#'#,##0` reads its leading hash as text rather than taking it for the number. */
|
|
118
88
|
function digitRun(pattern) {
|
|
119
89
|
let quoted = false;
|
|
120
90
|
let start = -1;
|
|
@@ -134,18 +104,11 @@ function digitRun(pattern) {
|
|
|
134
104
|
}
|
|
135
105
|
return start < 0 ? null : [start, pattern.length];
|
|
136
106
|
}
|
|
137
|
-
/**
|
|
138
|
-
* Split `pattern` into its literal edges and its digit run.
|
|
139
|
-
*
|
|
140
|
-
* Everything before the run is a prefix and everything after it a suffix, which
|
|
141
|
-
* is what lets `$#,##0.00`, `#,##0 kg` and `€ #,##0` all work without the
|
|
142
|
-
* language needing a quoting rule for the parts that are only ever text.
|
|
143
|
-
*/
|
|
107
|
+
/** Splits `pattern` into literal edges and a digit run: everything before is prefix, after is suffix, so `$#,##0.00`, `#,##0 kg` and `€ #,##0` work without a quoting rule for text. */
|
|
144
108
|
function parsePattern(pattern) {
|
|
145
109
|
const run = digitRun(pattern);
|
|
146
110
|
if (!run) {
|
|
147
|
-
// No digits
|
|
148
|
-
// literal for every tick, which would read as an axis of identical labels.
|
|
111
|
+
// No digits is not a number format; fall back rather than print the same literal for every tick.
|
|
149
112
|
return DEFAULT_PARSED;
|
|
150
113
|
}
|
|
151
114
|
const digits = pattern.slice(run[0], run[1]);
|
|
@@ -184,21 +147,14 @@ function parsed(pattern) {
|
|
|
184
147
|
function group(digits) {
|
|
185
148
|
return digits.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
186
149
|
}
|
|
187
|
-
/**
|
|
188
|
-
* `value` written the way `pattern` says.
|
|
189
|
-
*
|
|
190
|
-
* A non-finite value prints empty rather than `NaN`: a tick with no number
|
|
191
|
-
* behind it is a tick that shouldn't caption itself, and `NaN` on an axis reads
|
|
192
|
-
* as a broken chart rather than as missing data.
|
|
193
|
-
*/
|
|
150
|
+
/** `value` written as `pattern` says. A non-finite value prints empty: `NaN` on an axis reads as a broken chart rather than missing data. */
|
|
194
151
|
export function formatNumber(value, pattern) {
|
|
195
152
|
if (!Number.isFinite(value))
|
|
196
153
|
return "";
|
|
197
154
|
const p = parsed(pattern);
|
|
198
155
|
const scaled = p.percent ? value * 100 : value;
|
|
199
156
|
const rounded = scaled.toFixed(p.maxFrac);
|
|
200
|
-
// Rounding
|
|
201
|
-
// "0.00", and printing it as "-0.00" puts a minus sign on an axis's zero.
|
|
157
|
+
// Rounding decides the sign, not the input: -0.001 at two decimals is "0.00", not "-0.00".
|
|
202
158
|
const negative = rounded.startsWith("-");
|
|
203
159
|
const [rawInt = "0", rawFrac = ""] = (negative ? rounded.slice(1) : rounded).split(".");
|
|
204
160
|
const intDigits = rawInt.padStart(p.minInt, "0");
|
|
@@ -210,13 +166,7 @@ export function formatNumber(value, pattern) {
|
|
|
210
166
|
const sign = negative && Number(rounded) !== 0 ? "-" : "";
|
|
211
167
|
return `${sign}${p.prefix}${body}${p.suffix}`;
|
|
212
168
|
}
|
|
213
|
-
/**
|
|
214
|
-
* The pattern a `(format, custom)` pair names.
|
|
215
|
-
*
|
|
216
|
-
* A blank custom pattern falls back to the plain one rather than to the empty
|
|
217
|
-
* string, so an axis switched to Custom is readable while it is being typed
|
|
218
|
-
* into rather than a column of nothing.
|
|
219
|
-
*/
|
|
169
|
+
/** The pattern a `(format, custom)` pair names. A blank custom pattern falls back to the plain one, so an axis switched to Custom is readable while being typed into. */
|
|
220
170
|
export function patternFor(format, custom) {
|
|
221
171
|
if (format === "custom") {
|
|
222
172
|
const trimmed = custom?.trim() ?? "";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"number-format.js","sourceRoot":"","sources":["../../../../src/components/builtins/text/number-format.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAKH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,eAAe,GAAwD;IAClF,0EAA0E;IAC1E,4EAA4E;IAC5E,q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AC/C,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CACxB,MAAoC,EACpC,MAA0B;IAE1B,IAAI,MAAM,KAAK,QAAQ,EAAE,CAAC;QACxB,MAAM,OAAO,GAAG,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,CAAA;QACpC,OAAO,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAA;IACzD,CAAC;IACD,OAAO,eAAe,CAAC,MAAM,IAAI,OAAO,CAAC,IAAI,eAAe,CAAC,KAAK,CAAA;AACpE,CAAC","sourcesContent":["/**\n * How a chart writes a number down.\n *\n * One formatter, driven by a **pattern**, and the named formats are patterns\n * too — `currency` is `$#,##0.00` and nothing more. That is the whole design:\n * a dropdown of four presets and a free-text pattern are otherwise two features\n * that drift, one of them gaining a thousands separator or a negative sign the\n * other never hears about. Here the preset *is* the custom case with the\n * pattern filled in, so there is one set of rules to get right.\n *\n * The grammar is the spreadsheet one, because that is where the numbers come\n * from and what an author already knows:\n *\n * | Pattern | 1234.5 | 0.07 |\n * | ------------ | --------- | ------ |\n * | `#,##0.##` | `1,234.5` | `0.07` |\n * | `0` | `1235` | `0` |\n * | `$#,##0.00` | `$1,234.50` | `$0.07` |\n * | `0.#%` | `123450%` | `7%` |\n * | `#,##0 kg` | `1,235 kg` | `0 kg` |\n *\n * - `0` is a digit that is always written, `#` one that is written only when\n * the number needs it. So `0.00` pads to two decimals and `0.##` trims.\n * - A `,` anywhere in the integer run turns grouping on; where it sits doesn't\n * matter, since `#,##0` and `#,###,##0` mean the same thing to everyone who\n * writes them.\n * - `%` scales by 100 as well as printing — that is what makes it a percent\n * rather than a suffix, and it is why `0.07` under `0.#%` is `7%`. A column\n * that is *already* in percent points wants `#,##0'%'`: quoted, so the sign\n * is printed and nothing is scaled.\n * - Anything else is literal, before the digits or after them. Quote it to be\n * sure — `'#'#,##0` prints a leading hash.\n *\n * Deliberately **not** `Intl.NumberFormat`. Its output is locale-dependent, and\n * a chart is a picture with a fixed layout: the same project rendering\n * `1,234.50` on the author's machine and `1.234,50` on the export box is a\n * silently different image, and the wider string can reflow an axis. What an\n * author wants here is the format they *typed*.\n */\n\n/** The named formats the inspector offers, plus the escape hatch. */\nexport type NumberFormatName = \"plain\" | \"number\" | \"currency\" | \"percent\" | \"custom\"\n\n/**\n * The pattern behind each named format.\n *\n * `plain` is the historic behaviour — integers bare, everything else to one\n * decimal — kept as the default so no existing chart re-labels itself. The rest\n * are the three formats a chart of money, counts or shares actually needs.\n */\nexport const NUMBER_PATTERNS: Record<Exclude<NumberFormatName, \"custom\">, string> = {\n // Ungrouped on purpose: this is what `formatMarker` did before there were\n // formats at all, and it is the default, so every chart already drawn keeps\n // the labels it has. Grouping is what the reader picks `number` for.\n plain: \"#.#\",\n number: \"#,##0.##\",\n currency: \"$#,##0.00\",\n percent: \"#,##0.#%\",\n}\n\n/** A pattern taken apart once, so formatting a tick is not a parse. */\ninterface ParsedPattern {\n prefix: string\n suffix: string\n grouped: boolean\n /** Digits always written left of the point — the count of `0`s there. */\n minInt: number\n /** Digits always written right of it. */\n minFrac: number\n /** The most that may be written right of it. */\n maxFrac: number\n /** Scale by 100 and print a `%`. */\n percent: boolean\n}\n\n/** What a pattern with no digits in it falls back to: the `plain` reading. */\nconst DEFAULT_PARSED: ParsedPattern = {\n prefix: \"\",\n suffix: \"\",\n grouped: false,\n minInt: 1,\n minFrac: 0,\n maxFrac: 1,\n percent: false,\n}\n\n/** Walk `text`, calling `visit` with each character and whether it is quoted. */\nfunction scan(text: string, visit: (ch: string, quoted: boolean) => void): void {\n let quoted = false\n for (const ch of text) {\n if (ch === \"'\") {\n quoted = !quoted\n continue\n }\n visit(ch, quoted)\n }\n}\n\n/** Does `text` hold `ch` outside quotes? */\nfunction hasBare(text: string, ch: string): boolean {\n let found = false\n scan(text, (c, quoted) => {\n if (c === ch && !quoted) found = true\n })\n return found\n}\n\n/** `text` with every unquoted `ch` dropped, quoting preserved. */\nfunction removeBare(text: string, ch: string): string {\n let out = \"\"\n let quoted = false\n for (const c of text) {\n if (c === \"'\") {\n quoted = !quoted\n out += c\n continue\n }\n if (c === ch && !quoted) continue\n out += c\n }\n return out\n}\n\n/** `text` with its quotes taken off — what actually gets printed. */\nfunction literal(text: string): string {\n let out = \"\"\n scan(text, (ch) => {\n out += ch\n })\n return out\n}\n\n/**\n * The `[start, end)` of the pattern's digit run — the first stretch of `#0,.`\n * outside quotes.\n *\n * Quote-aware, so `'#'#,##0` reads its leading hash as text and its run as the\n * three characters after it. Without that, a quoted `#` would be taken for the\n * number and the real digits for a suffix.\n */\nfunction digitRun(pattern: string): [number, number] | null {\n let quoted = false\n let start = -1\n for (let i = 0; i < pattern.length; i++) {\n const ch = pattern[i]\n if (ch === \"'\") {\n quoted = !quoted\n if (start >= 0) return [start, i]\n continue\n }\n const isDigit = !quoted && \"#0,.\".includes(ch)\n if (isDigit && start < 0) start = i\n else if (!isDigit && start >= 0) return [start, i]\n }\n return start < 0 ? null : [start, pattern.length]\n}\n\n/**\n * Split `pattern` into its literal edges and its digit run.\n *\n * Everything before the run is a prefix and everything after it a suffix, which\n * is what lets `$#,##0.00`, `#,##0 kg` and `€ #,##0` all work without the\n * language needing a quoting rule for the parts that are only ever text.\n */\nfunction parsePattern(pattern: string): ParsedPattern {\n const run = digitRun(pattern)\n if (!run) {\n // No digits at all is not a number format. Fall back rather than print the\n // literal for every tick, which would read as an axis of identical labels.\n return DEFAULT_PARSED\n }\n\n const digits = pattern.slice(run[0], run[1])\n const rawPrefix = pattern.slice(0, run[0])\n const rawSuffix = pattern.slice(run[1])\n\n // An **unquoted** `%` is the percent operator; a quoted one is a sign the\n // author wants printed over data that is already in percent points.\n const percent = hasBare(rawPrefix, \"%\") || hasBare(rawSuffix, \"%\")\n const prefix = literal(percent ? removeBare(rawPrefix, \"%\") : rawPrefix)\n const suffix = literal(percent ? removeBare(rawSuffix, \"%\") : rawSuffix)\n\n const point = digits.indexOf(\".\")\n const intPart = point < 0 ? digits : digits.slice(0, point)\n const fracPart = point < 0 ? \"\" : digits.slice(point + 1)\n\n const count = (s: string, ch: string) => s.split(ch).length - 1\n\n return {\n prefix,\n suffix: percent ? `${suffix}%` : suffix,\n grouped: intPart.includes(\",\"),\n minInt: Math.max(1, count(intPart, \"0\")),\n minFrac: count(fracPart, \"0\"),\n maxFrac: fracPart.length,\n percent,\n }\n}\n\n/** Parsed patterns are reused across every tick of every frame. */\nconst cache = new Map<string, ParsedPattern>()\n\nfunction parsed(pattern: string): ParsedPattern {\n const held = cache.get(pattern)\n if (held) return held\n const next = parsePattern(pattern)\n cache.set(pattern, next)\n return next\n}\n\n/** `1234567` → `1,234,567`. Only the integer run is grouped. */\nfunction group(digits: string): string {\n return digits.replace(/\\B(?=(\\d{3})+(?!\\d))/g, \",\")\n}\n\n/**\n * `value` written the way `pattern` says.\n *\n * A non-finite value prints empty rather than `NaN`: a tick with no number\n * behind it is a tick that shouldn't caption itself, and `NaN` on an axis reads\n * as a broken chart rather than as missing data.\n */\nexport function formatNumber(value: number, pattern: string): string {\n if (!Number.isFinite(value)) return \"\"\n const p = parsed(pattern)\n\n const scaled = p.percent ? value * 100 : value\n const rounded = scaled.toFixed(p.maxFrac)\n // Rounding is what decides the sign, not the input: -0.001 at two decimals is\n // \"0.00\", and printing it as \"-0.00\" puts a minus sign on an axis's zero.\n const negative = rounded.startsWith(\"-\")\n const [rawInt = \"0\", rawFrac = \"\"] = (\n negative ? rounded.slice(1) : rounded\n ).split(\".\")\n\n const intDigits = rawInt.padStart(p.minInt, \"0\")\n // `#` trims, `0` pads: drop trailing zeros down to the required minimum.\n let frac = rawFrac\n while (frac.length > p.minFrac && frac.endsWith(\"0\")) frac = frac.slice(0, -1)\n\n const body = (p.grouped ? group(intDigits) : intDigits) + (frac ? `.${frac}` : \"\")\n const sign = negative && Number(rounded) !== 0 ? \"-\" : \"\"\n return `${sign}${p.prefix}${body}${p.suffix}`\n}\n\n/**\n * The pattern a `(format, custom)` pair names.\n *\n * A blank custom pattern falls back to the plain one rather than to the empty\n * string, so an axis switched to Custom is readable while it is being typed\n * into rather than a column of nothing.\n */\nexport function patternFor(\n format: NumberFormatName | undefined,\n custom: string | undefined\n): string {\n if (format === \"custom\") {\n const trimmed = custom?.trim() ?? \"\"\n return trimmed === \"\" ? NUMBER_PATTERNS.plain : trimmed\n }\n return NUMBER_PATTERNS[format ?? \"plain\"] ?? NUMBER_PATTERNS.plain\n}\n"]}
|
|
1
|
+
{"version":3,"file":"number-format.js","sourceRoot":"","sources":["../../../../src/components/builtins/text/number-format.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAKH,oKAAoK;AACpK,MAAM,CAAC,MAAM,eAAe,GAAwD;IAClF,sHAAsH;IACtH,KAAK,EAAE,KAAK;IACZ,MAAM,EAAE,UAAU;IAClB,QAAQ,EAAE,WAAW;IACrB,OAAO,EAAE,UAAU;CACpB,CAAA;AAiBD,8EAA8E;AAC9E,MAAM,cAAc,GAAkB;IACpC,MAAM,EAAE,EAAE;IACV,MAAM,EAAE,EAAE;IACV,OAAO,EAAE,KAAK;IACd,MAAM,EAAE,CAAC;IACT,OAAO,EAAE,CAAC;IACV,OAAO,EAAE,CAAC;IACV,OAAO,EAAE,KAAK;CACf,CAAA;AAED,iFAAiF;AACjF,SAAS,IAAI,CAAC,IAAY,EAAE,KAA4C;IACtE,IAAI,MAAM,GAAG,KAAK,CAAA;IAClB,KAAK,MAAM,EAAE,IAAI,IAAI,EAAE,CAAC;QACtB,IAAI,EAAE,KAAK,GAAG,EAAE,CAAC;YACf,MAAM,GAAG,CAAC,MAAM,CAAA;YAChB,SAAQ;QACV,CAAC;QACD,KAAK,CAAC,EAAE,EAAE,MAAM,CAAC,CAAA;IACnB,CAAC;AACH,CAAC;AAED,4CAA4C;AAC5C,SAAS,OAAO,CAAC,IAAY,EAAE,EAAU;IACvC,IAAI,KAAK,GAAG,KAAK,CAAA;IACjB,IAAI,CA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CAAA;IAE9E,MAAM,IAAI,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAA;IAClF,MAAM,IAAI,GAAG,QAAQ,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAA;IACzD,OAAO,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,CAAA;AAC/C,CAAC;AAED,yKAAyK;AACzK,MAAM,UAAU,UAAU,CACxB,MAAoC,EACpC,MAA0B;IAE1B,IAAI,MAAM,KAAK,QAAQ,EAAE,CAAC;QACxB,MAAM,OAAO,GAAG,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,CAAA;QACpC,OAAO,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAA;IACzD,CAAC;IACD,OAAO,eAAe,CAAC,MAAM,IAAI,OAAO,CAAC,IAAI,eAAe,CAAC,KAAK,CAAA;AACpE,CAAC","sourcesContent":["/**\n * How a chart writes a number down: one formatter driven by a **pattern**, with the named formats being patterns\n * too (`currency` is `$#,##0.00`), so a preset and a free-text pattern can't drift apart.\n *\n * The grammar is the spreadsheet one:\n *\n * | Pattern | 1234.5 | 0.07 |\n * | ------------ | --------- | ------ |\n * | `#,##0.##` | `1,234.5` | `0.07` |\n * | `0` | `1235` | `0` |\n * | `$#,##0.00` | `$1,234.50` | `$0.07` |\n * | `0.#%` | `123450%` | `7%` |\n * | `#,##0 kg` | `1,235 kg` | `0 kg` |\n *\n * - `0` is a digit always written, `#` one written only when needed (`0.00` pads, `0.##` trims).\n * - A `,` anywhere in the integer run turns grouping on; where it sits doesn't matter.\n * - `%` scales by 100 as well as printing (`0.07` under `0.#%` is `7%`). A column already in percent points wants\n * `#,##0'%'`: quoted, so the sign prints and nothing scales.\n * - Anything else is literal, before or after the digits. Quote it to be sure: `'#'#,##0` prints a leading hash.\n *\n * Deliberately **not** `Intl.NumberFormat`: its output is locale-dependent, and a chart is a picture with a fixed\n * layout (`1,234.50` on the author's machine and `1.234,50` on the export box is a silently different image that\n * can reflow an axis).\n */\n\n/** The named formats the inspector offers, plus the escape hatch. */\nexport type NumberFormatName = \"plain\" | \"number\" | \"currency\" | \"percent\" | \"custom\"\n\n/** The pattern behind each named format. `plain` is the historic behaviour (integers bare, else one decimal), the default so no existing chart re-labels itself. */\nexport const NUMBER_PATTERNS: Record<Exclude<NumberFormatName, \"custom\">, string> = {\n // Ungrouped on purpose: the default, so every chart already drawn keeps its labels; grouping is what `number` is for.\n plain: \"#.#\",\n number: \"#,##0.##\",\n currency: \"$#,##0.00\",\n percent: \"#,##0.#%\",\n}\n\n/** A pattern taken apart once, so formatting a tick is not a parse. */\ninterface ParsedPattern {\n prefix: string\n suffix: string\n grouped: boolean\n /** Digits always written left of the point — the count of `0`s there. */\n minInt: number\n /** Digits always written right of it. */\n minFrac: number\n /** The most that may be written right of it. */\n maxFrac: number\n /** Scale by 100 and print a `%`. */\n percent: boolean\n}\n\n/** What a pattern with no digits in it falls back to: the `plain` reading. */\nconst DEFAULT_PARSED: ParsedPattern = {\n prefix: \"\",\n suffix: \"\",\n grouped: false,\n minInt: 1,\n minFrac: 0,\n maxFrac: 1,\n percent: false,\n}\n\n/** Walk `text`, calling `visit` with each character and whether it is quoted. */\nfunction scan(text: string, visit: (ch: string, quoted: boolean) => void): void {\n let quoted = false\n for (const ch of text) {\n if (ch === \"'\") {\n quoted = !quoted\n continue\n }\n visit(ch, quoted)\n }\n}\n\n/** Does `text` hold `ch` outside quotes? */\nfunction hasBare(text: string, ch: string): boolean {\n let found = false\n scan(text, (c, quoted) => {\n if (c === ch && !quoted) found = true\n })\n return found\n}\n\n/** `text` with every unquoted `ch` dropped, quoting preserved. */\nfunction removeBare(text: string, ch: string): string {\n let out = \"\"\n let quoted = false\n for (const c of text) {\n if (c === \"'\") {\n quoted = !quoted\n out += c\n continue\n }\n if (c === ch && !quoted) continue\n out += c\n }\n return out\n}\n\n/** `text` with its quotes taken off — what actually gets printed. */\nfunction literal(text: string): string {\n let out = \"\"\n scan(text, (ch) => {\n out += ch\n })\n return out\n}\n\n/** The `[start, end)` of the pattern's digit run (the first stretch of `#0,.` outside quotes). Quote-aware, so `'#'#,##0` reads its leading hash as text rather than taking it for the number. */\nfunction digitRun(pattern: string): [number, number] | null {\n let quoted = false\n let start = -1\n for (let i = 0; i < pattern.length; i++) {\n const ch = pattern[i]\n if (ch === \"'\") {\n quoted = !quoted\n if (start >= 0) return [start, i]\n continue\n }\n const isDigit = !quoted && \"#0,.\".includes(ch)\n if (isDigit && start < 0) start = i\n else if (!isDigit && start >= 0) return [start, i]\n }\n return start < 0 ? null : [start, pattern.length]\n}\n\n/** Splits `pattern` into literal edges and a digit run: everything before is prefix, after is suffix, so `$#,##0.00`, `#,##0 kg` and `€ #,##0` work without a quoting rule for text. */\nfunction parsePattern(pattern: string): ParsedPattern {\n const run = digitRun(pattern)\n if (!run) {\n // No digits is not a number format; fall back rather than print the same literal for every tick.\n return DEFAULT_PARSED\n }\n\n const digits = pattern.slice(run[0], run[1])\n const rawPrefix = pattern.slice(0, run[0])\n const rawSuffix = pattern.slice(run[1])\n\n // An **unquoted** `%` is the percent operator; a quoted one is a sign the\n // author wants printed over data that is already in percent points.\n const percent = hasBare(rawPrefix, \"%\") || hasBare(rawSuffix, \"%\")\n const prefix = literal(percent ? removeBare(rawPrefix, \"%\") : rawPrefix)\n const suffix = literal(percent ? removeBare(rawSuffix, \"%\") : rawSuffix)\n\n const point = digits.indexOf(\".\")\n const intPart = point < 0 ? digits : digits.slice(0, point)\n const fracPart = point < 0 ? \"\" : digits.slice(point + 1)\n\n const count = (s: string, ch: string) => s.split(ch).length - 1\n\n return {\n prefix,\n suffix: percent ? `${suffix}%` : suffix,\n grouped: intPart.includes(\",\"),\n minInt: Math.max(1, count(intPart, \"0\")),\n minFrac: count(fracPart, \"0\"),\n maxFrac: fracPart.length,\n percent,\n }\n}\n\n/** Parsed patterns are reused across every tick of every frame. */\nconst cache = new Map<string, ParsedPattern>()\n\nfunction parsed(pattern: string): ParsedPattern {\n const held = cache.get(pattern)\n if (held) return held\n const next = parsePattern(pattern)\n cache.set(pattern, next)\n return next\n}\n\n/** `1234567` → `1,234,567`. Only the integer run is grouped. */\nfunction group(digits: string): string {\n return digits.replace(/\\B(?=(\\d{3})+(?!\\d))/g, \",\")\n}\n\n/** `value` written as `pattern` says. A non-finite value prints empty: `NaN` on an axis reads as a broken chart rather than missing data. */\nexport function formatNumber(value: number, pattern: string): string {\n if (!Number.isFinite(value)) return \"\"\n const p = parsed(pattern)\n\n const scaled = p.percent ? value * 100 : value\n const rounded = scaled.toFixed(p.maxFrac)\n // Rounding decides the sign, not the input: -0.001 at two decimals is \"0.00\", not \"-0.00\".\n const negative = rounded.startsWith(\"-\")\n const [rawInt = \"0\", rawFrac = \"\"] = (\n negative ? rounded.slice(1) : rounded\n ).split(\".\")\n\n const intDigits = rawInt.padStart(p.minInt, \"0\")\n // `#` trims, `0` pads: drop trailing zeros down to the required minimum.\n let frac = rawFrac\n while (frac.length > p.minFrac && frac.endsWith(\"0\")) frac = frac.slice(0, -1)\n\n const body = (p.grouped ? group(intDigits) : intDigits) + (frac ? `.${frac}` : \"\")\n const sign = negative && Number(rounded) !== 0 ? \"-\" : \"\"\n return `${sign}${p.prefix}${body}${p.suffix}`\n}\n\n/** The pattern a `(format, custom)` pair names. A blank custom pattern falls back to the plain one, so an axis switched to Custom is readable while being typed into. */\nexport function patternFor(\n format: NumberFormatName | undefined,\n custom: string | undefined\n): string {\n if (format === \"custom\") {\n const trimmed = custom?.trim() ?? \"\"\n return trimmed === \"\" ? NUMBER_PATTERNS.plain : trimmed\n }\n return NUMBER_PATTERNS[format ?? \"plain\"] ?? NUMBER_PATTERNS.plain\n}\n"]}
|
|
@@ -1,34 +1,9 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
3
|
-
* formatter takes.
|
|
4
|
-
*
|
|
5
|
-
* There is already exactly one answer in this package to "how is a number
|
|
6
|
-
* written down" — `./number-format`, whose docblock has the grammar and
|
|
7
|
-
* the argument for it. This module adds no second one. What it adds is the
|
|
8
|
-
* *panel's* half: a figure on the canvas is set up by picking a format and
|
|
9
|
-
* saying how many decimals, where a chart axis is set up by picking a preset,
|
|
10
|
-
* and those two are the same statement typed differently.
|
|
11
|
-
*
|
|
12
|
-
* So the controls compose a pattern rather than being honoured beside one. A
|
|
13
|
-
* Number node showing `$1,234.50` and an axis labelled `$#,##0.00` go through
|
|
14
|
-
* the same parser and round the same way, which is the thing that would drift
|
|
15
|
-
* if the node reached for `Intl.NumberFormat` instead.
|
|
16
|
-
*/
|
|
17
|
-
/**
|
|
18
|
-
* How a Number node writes its figure.
|
|
19
|
-
*
|
|
20
|
-
* The chart's five minus `plain`, which exists there only to keep charts drawn
|
|
21
|
-
* before there were formats labelling themselves the way they always have. A
|
|
22
|
-
* node has no such history, and "plain" beside "number" is a distinction
|
|
23
|
-
* nobody browsing a dropdown can make.
|
|
24
|
-
*/
|
|
1
|
+
/** The Number node's format controls, resolved into the one pattern the app's formatter takes (`./number-format` is the single answer to "how is a number written down"; its docblock has the grammar). The controls compose a pattern rather than sitting beside one, so a Number node showing `$1,234.50` and an axis labelled `$#,##0.00` go through the same parser and round alike, which would drift if the node used `Intl.NumberFormat`. */
|
|
2
|
+
/** How a Number node writes its figure: the chart's formats minus `plain`, which exists there only to keep pre-format charts labelling as they always did. */
|
|
25
3
|
export declare const NUMBER_NODE_FORMATS: readonly ["number", "currency", "percent", "custom"];
|
|
26
|
-
export type NumberNodeFormat = (typeof NUMBER_NODE_FORMATS)[number];
|
|
27
4
|
/** The most decimals the panel will let a figure carry. */
|
|
28
5
|
export declare const MAX_FRACTION_DIGITS = 10;
|
|
29
|
-
/** The Number node's format controls, as the class holds them. */
|
|
30
6
|
export interface NumberFormatOptions {
|
|
31
|
-
/** How the figure is written — see {@link NumberNode.format}. */
|
|
32
7
|
format: string;
|
|
33
8
|
/** The pattern typed by hand — read only when the format is `custom`. */
|
|
34
9
|
customPattern: string;
|
|
@@ -37,15 +12,6 @@ export interface NumberFormatOptions {
|
|
|
37
12
|
/** Printed before the figure when the format is `currency`. */
|
|
38
13
|
currencySymbol: string;
|
|
39
14
|
}
|
|
40
|
-
/**
|
|
41
|
-
* The pattern `options` names.
|
|
42
|
-
*
|
|
43
|
-
* `custom` hands the typed pattern straight to {@link patternFor}, which is what
|
|
44
|
-
* makes the escape hatch the *same* language the presets are written in rather
|
|
45
|
-
* than a second one. Every other format is composed here, because the three
|
|
46
|
-
* controls beside the dropdown — decimals, grouping, the symbol — are what a
|
|
47
|
-
* preset would otherwise have to be duplicated for (`#,##0.00` and `#,##0.000`
|
|
48
|
-
* and `0.00` and…).
|
|
49
|
-
*/
|
|
15
|
+
/** The pattern `options` names. `custom` goes straight to {@link patternFor}, so the escape hatch is the same language as the presets. Other formats are composed here, since decimals, grouping and symbol controls would otherwise need a preset duplicated per combination. */
|
|
50
16
|
export declare function numberNodePattern(options: NumberFormatOptions): string;
|
|
51
17
|
//# sourceMappingURL=number-pattern.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"number-pattern.d.ts","sourceRoot":"","sources":["../../../../src/components/builtins/text/number-pattern.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"number-pattern.d.ts","sourceRoot":"","sources":["../../../../src/components/builtins/text/number-pattern.ts"],"names":[],"mappings":"AAAA,obAAob;AAIpb,8JAA8J;AAC9J,eAAO,MAAM,mBAAmB,sDAKtB,CAAA;AAEV,2DAA2D;AAC3D,eAAO,MAAM,mBAAmB,KAAK,CAAA;AAErC,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAA;IACd,yEAAyE;IACzE,aAAa,EAAE,MAAM,CAAA;IACrB,cAAc,EAAE,MAAM,CAAA;IACtB,OAAO,EAAE,OAAO,CAAA;IAChB,+DAA+D;IAC/D,cAAc,EAAE,MAAM,CAAA;CACvB;AAED,kRAAkR;AAClR,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,mBAAmB,GAAG,MAAM,CAoBtE"}
|
|
@@ -1,28 +1,6 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The Number node's format controls, resolved into the one pattern the app's
|
|
3
|
-
* formatter takes.
|
|
4
|
-
*
|
|
5
|
-
* There is already exactly one answer in this package to "how is a number
|
|
6
|
-
* written down" — `./number-format`, whose docblock has the grammar and
|
|
7
|
-
* the argument for it. This module adds no second one. What it adds is the
|
|
8
|
-
* *panel's* half: a figure on the canvas is set up by picking a format and
|
|
9
|
-
* saying how many decimals, where a chart axis is set up by picking a preset,
|
|
10
|
-
* and those two are the same statement typed differently.
|
|
11
|
-
*
|
|
12
|
-
* So the controls compose a pattern rather than being honoured beside one. A
|
|
13
|
-
* Number node showing `$1,234.50` and an axis labelled `$#,##0.00` go through
|
|
14
|
-
* the same parser and round the same way, which is the thing that would drift
|
|
15
|
-
* if the node reached for `Intl.NumberFormat` instead.
|
|
16
|
-
*/
|
|
1
|
+
/** The Number node's format controls, resolved into the one pattern the app's formatter takes (`./number-format` is the single answer to "how is a number written down"; its docblock has the grammar). The controls compose a pattern rather than sitting beside one, so a Number node showing `$1,234.50` and an axis labelled `$#,##0.00` go through the same parser and round alike, which would drift if the node used `Intl.NumberFormat`. */
|
|
17
2
|
import { patternFor } from "./number-format.js";
|
|
18
|
-
/**
|
|
19
|
-
* How a Number node writes its figure.
|
|
20
|
-
*
|
|
21
|
-
* The chart's five minus `plain`, which exists there only to keep charts drawn
|
|
22
|
-
* before there were formats labelling themselves the way they always have. A
|
|
23
|
-
* node has no such history, and "plain" beside "number" is a distinction
|
|
24
|
-
* nobody browsing a dropdown can make.
|
|
25
|
-
*/
|
|
3
|
+
/** How a Number node writes its figure: the chart's formats minus `plain`, which exists there only to keep pre-format charts labelling as they always did. */
|
|
26
4
|
export const NUMBER_NODE_FORMATS = [
|
|
27
5
|
"number",
|
|
28
6
|
"currency",
|
|
@@ -31,16 +9,7 @@ export const NUMBER_NODE_FORMATS = [
|
|
|
31
9
|
];
|
|
32
10
|
/** The most decimals the panel will let a figure carry. */
|
|
33
11
|
export const MAX_FRACTION_DIGITS = 10;
|
|
34
|
-
/**
|
|
35
|
-
* The pattern `options` names.
|
|
36
|
-
*
|
|
37
|
-
* `custom` hands the typed pattern straight to {@link patternFor}, which is what
|
|
38
|
-
* makes the escape hatch the *same* language the presets are written in rather
|
|
39
|
-
* than a second one. Every other format is composed here, because the three
|
|
40
|
-
* controls beside the dropdown — decimals, grouping, the symbol — are what a
|
|
41
|
-
* preset would otherwise have to be duplicated for (`#,##0.00` and `#,##0.000`
|
|
42
|
-
* and `0.00` and…).
|
|
43
|
-
*/
|
|
12
|
+
/** The pattern `options` names. `custom` goes straight to {@link patternFor}, so the escape hatch is the same language as the presets. Other formats are composed here, since decimals, grouping and symbol controls would otherwise need a preset duplicated per combination. */
|
|
44
13
|
export function numberNodePattern(options) {
|
|
45
14
|
if (options.format === "custom") {
|
|
46
15
|
return patternFor("custom", options.customPattern);
|
|
@@ -52,24 +21,13 @@ export function numberNodePattern(options) {
|
|
|
52
21
|
if (options.format === "currency") {
|
|
53
22
|
return `${quoted(options.currencySymbol)}${body}`;
|
|
54
23
|
}
|
|
55
|
-
// Bare, so the parser reads it as the percent *operator* and scales by 100
|
|
56
|
-
//
|
|
57
|
-
// printed over data that is already in percent points is a custom pattern
|
|
58
|
-
// with the sign quoted, exactly as it is on an axis.
|
|
24
|
+
// Bare, so the parser reads it as the percent *operator* and scales by 100 (a stored 0.42 reads "42%"). A sign printed
|
|
25
|
+
// over data already in percent points is a custom pattern with the sign quoted.
|
|
59
26
|
if (options.format === "percent")
|
|
60
27
|
return `${body}%`;
|
|
61
28
|
return body;
|
|
62
29
|
}
|
|
63
|
-
/**
|
|
64
|
-
* `symbol` as a pattern literal.
|
|
65
|
-
*
|
|
66
|
-
* Quoted rather than concatenated, because the two most likely symbols after `$`
|
|
67
|
-
* are `€` and `£` and the two after those are whatever an author types — and an
|
|
68
|
-
* unquoted `#`, `0`, `,`, `.` or `%` in there would be read as part of the
|
|
69
|
-
* number. The quote character itself is dropped rather than escaped: the grammar
|
|
70
|
-
* has no escape for it, and a currency symbol containing an apostrophe is not a
|
|
71
|
-
* thing anyone has.
|
|
72
|
-
*/
|
|
30
|
+
/** `symbol` as a pattern literal, quoted because an unquoted `#`, `0`, `,`, `.` or `%` in a typed symbol would read as part of the number. The quote character itself is dropped: the grammar has no escape for it. */
|
|
73
31
|
function quoted(symbol) {
|
|
74
32
|
const literal = symbol.replaceAll("'", "");
|
|
75
33
|
return literal === "" ? "" : `'${literal}'`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"number-pattern.js","sourceRoot":"","sources":["../../../../src/components/builtins/text/number-pattern.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"number-pattern.js","sourceRoot":"","sources":["../../../../src/components/builtins/text/number-pattern.ts"],"names":[],"mappings":"AAAA,obAAob;AAEpb,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,8JAA8J;AAC9J,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,QAAQ;IACR,UAAU;IACV,SAAS;IACT,QAAQ;CACA,CAAA;AAEV,2DAA2D;AAC3D,MAAM,CAAC,MAAM,mBAAmB,GAAG,EAAE,CAAA;AAYrC,kRAAkR;AAClR,MAAM,UAAU,iBAAiB,CAAC,OAA4B;IAC5D,IAAI,OAAO,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;QAChC,OAAO,UAAU,CAAC,QAAQ,EAAE,OAAO,CAAC,aAAa,CAAC,CAAA;IACpD,CAAC;IAED,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CACrB,mBAAmB,EACnB,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,CAChD,CAAA;IACD,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAA;IAC/C,MAAM,QAAQ,GAAG,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAA;IAC3D,MAAM,IAAI,GAAG,GAAG,OAAO,GAAG,QAAQ,EAAE,CAAA;IAEpC,IAAI,OAAO,CAAC,MAAM,KAAK,UAAU,EAAE,CAAC;QAClC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,GAAG,IAAI,EAAE,CAAA;IACnD,CAAC;IACD,uHAAuH;IACvH,gFAAgF;IAChF,IAAI,OAAO,CAAC,MAAM,KAAK,SAAS;QAAE,OAAO,GAAG,IAAI,GAAG,CAAA;IACnD,OAAO,IAAI,CAAA;AACb,CAAC;AAED,uNAAuN;AACvN,SAAS,MAAM,CAAC,MAAc;IAC5B,MAAM,OAAO,GAAG,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC,CAAA;IAC1C,OAAO,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,OAAO,GAAG,CAAA;AAC7C,CAAC","sourcesContent":["/** The Number node's format controls, resolved into the one pattern the app's formatter takes (`./number-format` is the single answer to \"how is a number written down\"; its docblock has the grammar). The controls compose a pattern rather than sitting beside one, so a Number node showing `$1,234.50` and an axis labelled `$#,##0.00` go through the same parser and round alike, which would drift if the node used `Intl.NumberFormat`. */\n\nimport { patternFor } from \"./number-format\";\n\n/** How a Number node writes its figure: the chart's formats minus `plain`, which exists there only to keep pre-format charts labelling as they always did. */\nexport const NUMBER_NODE_FORMATS = [\n \"number\",\n \"currency\",\n \"percent\",\n \"custom\",\n] as const\n\n/** The most decimals the panel will let a figure carry. */\nexport const MAX_FRACTION_DIGITS = 10\n\nexport interface NumberFormatOptions {\n format: string\n /** The pattern typed by hand — read only when the format is `custom`. */\n customPattern: string\n fractionDigits: number\n grouped: boolean\n /** Printed before the figure when the format is `currency`. */\n currencySymbol: string\n}\n\n/** The pattern `options` names. `custom` goes straight to {@link patternFor}, so the escape hatch is the same language as the presets. Other formats are composed here, since decimals, grouping and symbol controls would otherwise need a preset duplicated per combination. */\nexport function numberNodePattern(options: NumberFormatOptions): string {\n if (options.format === \"custom\") {\n return patternFor(\"custom\", options.customPattern)\n }\n\n const digits = Math.min(\n MAX_FRACTION_DIGITS,\n Math.max(0, Math.round(options.fractionDigits))\n )\n const integer = options.grouped ? \"#,##0\" : \"0\"\n const fraction = digits > 0 ? `.${\"0\".repeat(digits)}` : \"\"\n const body = `${integer}${fraction}`\n\n if (options.format === \"currency\") {\n return `${quoted(options.currencySymbol)}${body}`\n }\n // Bare, so the parser reads it as the percent *operator* and scales by 100 (a stored 0.42 reads \"42%\"). A sign printed\n // over data already in percent points is a custom pattern with the sign quoted.\n if (options.format === \"percent\") return `${body}%`\n return body\n}\n\n/** `symbol` as a pattern literal, quoted because an unquoted `#`, `0`, `,`, `.` or `%` in a typed symbol would read as part of the number. The quote character itself is dropped: the grammar has no escape for it. */\nfunction quoted(symbol: string): string {\n const literal = symbol.replaceAll(\"'\", \"\")\n return literal === \"\" ? \"\" : `'${literal}'`\n}\n"]}
|
|
@@ -1,31 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The family a component's text falls back to when the document names none.
|
|
2
|
+
* The family a component's text falls back to when the document names none. A caption a node draws itself (a button's
|
|
3
|
+
* label, a window's title) needs *some* family: the font provider holds only what the manifest registered, and a family
|
|
4
|
+
* called `""` shapes against nothing and paints no glyphs. Which one is a fact about the application (fonts vendored
|
|
5
|
+
* or licensed), so the host's composition root *supplies* it once through {@link setHostTextFamily}; until then it is `""`.
|
|
3
6
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* only what the manifest registered and a family called `""` shapes against
|
|
7
|
-
* nothing and paints no glyphs. Which family that is, though, is a fact about
|
|
8
|
-
* the application: which fonts it vendored, which it licensed, what its UI is
|
|
9
|
-
* set in. A component shipped as its own package cannot know it, and the engine
|
|
10
|
-
* has no built-in family to offer in its place.
|
|
11
|
-
*
|
|
12
|
-
* So the answer is *supplied*, once, by the host application's composition
|
|
13
|
-
* root, through {@link setHostTextFamily}. Until a host does, the answer is
|
|
14
|
-
* `""`, and a host that ships a typeface says so instead of every node learning
|
|
15
|
-
* its name.
|
|
16
|
-
*
|
|
17
|
-
* This is deliberately **not** a prop. The prop is the node's own `fontFamily`,
|
|
18
|
-
* which a host's props mapping can fill in from here when the author has left
|
|
19
|
-
* it empty. What lives here is only the answer to "empty means what?", which is
|
|
20
|
-
* one answer for the whole application rather than one per node.
|
|
21
|
-
*/
|
|
22
|
-
/**
|
|
23
|
-
* Declares the family this application's components fall back to.
|
|
24
|
-
*
|
|
25
|
-
* Called by the composition root before the first build. Left unset, components
|
|
26
|
-
* fall back to `""`, which paints no glyphs — a legible blank rather than a
|
|
27
|
-
* silently wrong typeface, and the same bargain an unregistered node type makes.
|
|
7
|
+
* Deliberately **not** a prop: the prop is the node's own `fontFamily`, which a host's props mapping can fill from
|
|
8
|
+
* here when left empty. This is only the answer to "empty means what?", one for the whole application.
|
|
28
9
|
*/
|
|
10
|
+
/** Declares the family this application's components fall back to; called by the composition root before the first build. Unset it is `""`, which paints no glyphs: a legible blank rather than a silently wrong typeface (the bargain an unregistered node type makes). */
|
|
29
11
|
export declare function setHostTextFamily(family: string): void;
|
|
30
12
|
/** The family to use where the document names none. */
|
|
31
13
|
export declare function hostTextFamily(): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-defaults.d.ts","sourceRoot":"","sources":["../../../../src/components/builtins/text/text-defaults.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"text-defaults.d.ts","sourceRoot":"","sources":["../../../../src/components/builtins/text/text-defaults.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,4QAA4Q;AAC5Q,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAEtD;AAED,uDAAuD;AACvD,wBAAgB,cAAc,IAAI,MAAM,CAEvC"}
|
|
@@ -1,32 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The family a component's text falls back to when the document names none.
|
|
2
|
+
* The family a component's text falls back to when the document names none. A caption a node draws itself (a button's
|
|
3
|
+
* label, a window's title) needs *some* family: the font provider holds only what the manifest registered, and a family
|
|
4
|
+
* called `""` shapes against nothing and paints no glyphs. Which one is a fact about the application (fonts vendored
|
|
5
|
+
* or licensed), so the host's composition root *supplies* it once through {@link setHostTextFamily}; until then it is `""`.
|
|
3
6
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* only what the manifest registered and a family called `""` shapes against
|
|
7
|
-
* nothing and paints no glyphs. Which family that is, though, is a fact about
|
|
8
|
-
* the application: which fonts it vendored, which it licensed, what its UI is
|
|
9
|
-
* set in. A component shipped as its own package cannot know it, and the engine
|
|
10
|
-
* has no built-in family to offer in its place.
|
|
11
|
-
*
|
|
12
|
-
* So the answer is *supplied*, once, by the host application's composition
|
|
13
|
-
* root, through {@link setHostTextFamily}. Until a host does, the answer is
|
|
14
|
-
* `""`, and a host that ships a typeface says so instead of every node learning
|
|
15
|
-
* its name.
|
|
16
|
-
*
|
|
17
|
-
* This is deliberately **not** a prop. The prop is the node's own `fontFamily`,
|
|
18
|
-
* which a host's props mapping can fill in from here when the author has left
|
|
19
|
-
* it empty. What lives here is only the answer to "empty means what?", which is
|
|
20
|
-
* one answer for the whole application rather than one per node.
|
|
7
|
+
* Deliberately **not** a prop: the prop is the node's own `fontFamily`, which a host's props mapping can fill from
|
|
8
|
+
* here when left empty. This is only the answer to "empty means what?", one for the whole application.
|
|
21
9
|
*/
|
|
22
10
|
let fallbackFamily = "";
|
|
23
|
-
/**
|
|
24
|
-
* Declares the family this application's components fall back to.
|
|
25
|
-
*
|
|
26
|
-
* Called by the composition root before the first build. Left unset, components
|
|
27
|
-
* fall back to `""`, which paints no glyphs — a legible blank rather than a
|
|
28
|
-
* silently wrong typeface, and the same bargain an unregistered node type makes.
|
|
29
|
-
*/
|
|
11
|
+
/** Declares the family this application's components fall back to; called by the composition root before the first build. Unset it is `""`, which paints no glyphs: a legible blank rather than a silently wrong typeface (the bargain an unregistered node type makes). */
|
|
30
12
|
export function setHostTextFamily(family) {
|
|
31
13
|
fallbackFamily = family;
|
|
32
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-defaults.js","sourceRoot":"","sources":["../../../../src/components/builtins/text/text-defaults.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"text-defaults.js","sourceRoot":"","sources":["../../../../src/components/builtins/text/text-defaults.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,IAAI,cAAc,GAAG,EAAE,CAAA;AAEvB,4QAA4Q;AAC5Q,MAAM,UAAU,iBAAiB,CAAC,MAAc;IAC9C,cAAc,GAAG,MAAM,CAAA;AACzB,CAAC;AAED,uDAAuD;AACvD,MAAM,UAAU,cAAc;IAC5B,OAAO,cAAc,CAAA;AACvB,CAAC","sourcesContent":["/**\n * The family a component's text falls back to when the document names none. A caption a node draws itself (a button's\n * label, a window's title) needs *some* family: the font provider holds only what the manifest registered, and a family\n * called `\"\"` shapes against nothing and paints no glyphs. Which one is a fact about the application (fonts vendored\n * or licensed), so the host's composition root *supplies* it once through {@link setHostTextFamily}; until then it is `\"\"`.\n *\n * Deliberately **not** a prop: the prop is the node's own `fontFamily`, which a host's props mapping can fill from\n * here when left empty. This is only the answer to \"empty means what?\", one for the whole application.\n */\n\nlet fallbackFamily = \"\"\n\n/** Declares the family this application's components fall back to; called by the composition root before the first build. Unset it is `\"\"`, which paints no glyphs: a legible blank rather than a silently wrong typeface (the bargain an unregistered node type makes). */\nexport function setHostTextFamily(family: string): void {\n fallbackFamily = family\n}\n\n/** The family to use where the document names none. */\nexport function hostTextFamily(): string {\n return fallbackFamily\n}\n"]}
|
|
@@ -43,20 +43,11 @@ export interface TextSource {
|
|
|
43
43
|
export declare function casedText(s: TextValues, src: TextSource): string;
|
|
44
44
|
/** The block's size: hugged to its glyphs, filled across, and its own height even when it fills, so a hugging ancestor sees its content. */
|
|
45
45
|
export declare function measureGlyphs(s: TextValues, src: TextSource, constraints: SizeConstraints, scope: MeasureContext2D): Size2D;
|
|
46
|
-
/**
|
|
47
|
-
* The string cut at every style boundary, each piece styled by the runs over
|
|
48
|
-
* it, the later winning. Also folds in the Write On reveal window. `null` when neither is
|
|
49
|
-
* active, so rendering keeps its single-op path; and always `null` on a path,
|
|
50
|
-
* where the string is laid along it as one run.
|
|
51
|
-
*/
|
|
46
|
+
/** The string cut at every style boundary, each piece styled by the runs over it (the later winning), folding in the Write On reveal window. `null` when neither is active, keeping rendering's single-op path, and always `null` on a path, where the string is one run. */
|
|
52
47
|
export declare function textSegments(s: TextValues, src: TextSource): TextSegment[] | null;
|
|
53
48
|
/** The descriptor the block draws as, in a box of `size`. Picking's caret geometry reads the same one. */
|
|
54
49
|
export declare function textState(s: TextValues, src: TextSource, size: Size2D | undefined): Partial<TextState>;
|
|
55
|
-
/**
|
|
56
|
-
* The node's own face, plus whatever a piece sets in another, and the pieces'
|
|
57
|
-
* paints. Naming a family here is what lets it load before layout, rather than
|
|
58
|
-
* being discovered by measuring against the fallback face.
|
|
59
|
-
*/
|
|
50
|
+
/** The node's own face plus whatever a piece sets in another, and the pieces' paints; naming a family here lets it load before layout rather than being discovered by measuring against the fallback face. */
|
|
60
51
|
export declare function declareGlyphAssets(s: TextValues, src: TextSource, assets: Pick<AssetScope, "font" | "fill">): void;
|
|
61
52
|
/** What a rich-text node reads: spans, and the face they inherit from. */
|
|
62
53
|
export interface RichValues {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-layout.d.ts","sourceRoot":"","sources":["../../../../src/components/builtins/text/text-layout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAKlE,OAAO,KAAK,EACR,SAAS,EAAE,eAAe,EAAE,gBAAgB,EAAE,SAAS,EAAE,QAAQ,EAAE,cAAc,EAAE,QAAQ,EAAE,aAAa,EAC7G,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACxE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAGjE;;;;GAIG;AAEH,uDAAuD;AACvD,MAAM,WAAW,UAAU;IACvB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC;IACtC,QAAQ,CAAC,cAAc,EAAE,cAAc,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,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;CAC9B;AAED,qFAAqF;AACrF,wBAAgB,QAAQ,CAAC,CAAC,EAAE,UAAU,GAAG,gBAAgB,EAAE,CAU1D;AAED,gHAAgH;AAChH,wBAAgB,WAAW,CAAC,CAAC,EAAE,UAAU,EAAE,WAAW,EAAE,eAAe,EAAE,KAAK,EAAE,gBAAgB,GAAG,MAAM,CA4BxG;AAED,wBAAgB,SAAS,CAAC,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,CAEzF;AAED,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAAC,GAAG,IAAI,CAMhG"}
|
|
@@ -6,8 +6,7 @@ export function casedText(s, src) {
|
|
|
6
6
|
}
|
|
7
7
|
/** The block's size: hugged to its glyphs, filled across, and its own height even when it fills, so a hugging ancestor sees its content. */
|
|
8
8
|
export function measureGlyphs(s, src, constraints, scope) {
|
|
9
|
-
// Text-on-path: the visual extent is the path's bounding box, not a
|
|
10
|
-
// line box. Size the node to the path (node-local coords, like Path).
|
|
9
|
+
// Text-on-path: the visual extent is the path's bounding box (node-local coords, like Path), not a line box.
|
|
11
10
|
if (src.glyphPath != null) {
|
|
12
11
|
const { width, height } = pathOps.size(src.glyphPath);
|
|
13
12
|
const wm = s.width;
|
|
@@ -19,10 +18,8 @@ export function measureGlyphs(s, src, constraints, scope) {
|
|
|
19
18
|
}
|
|
20
19
|
const measureFontSize = s.fontSize === "autofit" ? 16 : s.fontSize;
|
|
21
20
|
const paragraphs = casedText(s, src).split("\n");
|
|
22
|
-
// A styled run changes the box
|
|
23
|
-
//
|
|
24
|
-
// the line taller and the block wider. So when runs are styled the
|
|
25
|
-
// intrinsic size is summed across the pieces, each in its own style.
|
|
21
|
+
// A styled run changes the box (one word set two sizes up makes the line taller and the block wider), so with styled
|
|
22
|
+
// runs the intrinsic size is summed across the pieces, each in its own style.
|
|
26
23
|
const styled = textSegments(s, src);
|
|
27
24
|
const lineStyles = styled === null
|
|
28
25
|
? null
|
|
@@ -40,9 +37,7 @@ export function measureGlyphs(s, src, constraints, scope) {
|
|
|
40
37
|
const wm = s.width;
|
|
41
38
|
const hm = s.height;
|
|
42
39
|
const resolvedW = typeof wm === "number" ? wm : wm === "hug" ? intrinsicW : constraints.maxWidth ?? 0;
|
|
43
|
-
//
|
|
44
|
-
// height needs to account for the extra lines produced by wrapping. Each
|
|
45
|
-
// line is as tall as its tallest run.
|
|
40
|
+
// With wrap on and a finite box narrower than the text, height must account for wrapped lines, each as tall as its tallest run.
|
|
46
41
|
const wraps = src.wraps && resolvedW > 0;
|
|
47
42
|
const lineSizes = lineStyles === null
|
|
48
43
|
? null
|
|
@@ -56,12 +51,7 @@ export function measureGlyphs(s, src, constraints, scope) {
|
|
|
56
51
|
: paragraphs.length) * lineH;
|
|
57
52
|
return { width: resolvedW, height: typeof hm === "number" ? hm : intrinsicH };
|
|
58
53
|
}
|
|
59
|
-
/**
|
|
60
|
-
* The string cut at every style boundary, each piece styled by the runs over
|
|
61
|
-
* it, the later winning. Also folds in the Write On reveal window. `null` when neither is
|
|
62
|
-
* active, so rendering keeps its single-op path; and always `null` on a path,
|
|
63
|
-
* where the string is laid along it as one run.
|
|
64
|
-
*/
|
|
54
|
+
/** The string cut at every style boundary, each piece styled by the runs over it (the later winning), folding in the Write On reveal window. `null` when neither is active, keeping rendering's single-op path, and always `null` on a path, where the string is one run. */
|
|
65
55
|
export function textSegments(s, src) {
|
|
66
56
|
if (src.glyphPath != null)
|
|
67
57
|
return null;
|
|
@@ -69,8 +59,7 @@ export function textSegments(s, src) {
|
|
|
69
59
|
const text = casedText(s, src);
|
|
70
60
|
if (text.length === 0)
|
|
71
61
|
return null;
|
|
72
|
-
// Write On: a glyph has no path to trim, so `start`/`end` are a
|
|
73
|
-
// character-reveal window instead: opacity over a range of characters.
|
|
62
|
+
// Write On: a glyph has no path to trim, so `start`/`end` are a character-reveal window (opacity over a range of characters).
|
|
74
63
|
const hasReveal = s.start > 0 || s.end < 1;
|
|
75
64
|
if (runs.length === 0 && !hasReveal)
|
|
76
65
|
return null;
|
|
@@ -163,11 +152,7 @@ export function textState(s, src, size) {
|
|
|
163
152
|
path: src.glyphPath,
|
|
164
153
|
};
|
|
165
154
|
}
|
|
166
|
-
/**
|
|
167
|
-
* The node's own face, plus whatever a piece sets in another, and the pieces'
|
|
168
|
-
* paints. Naming a family here is what lets it load before layout, rather than
|
|
169
|
-
* being discovered by measuring against the fallback face.
|
|
170
|
-
*/
|
|
155
|
+
/** The node's own face plus whatever a piece sets in another, and the pieces' paints; naming a family here lets it load before layout rather than being discovered by measuring against the fallback face. */
|
|
171
156
|
export function declareGlyphAssets(s, src, assets) {
|
|
172
157
|
// Nothing may name a family at all; an `undefined` key is not a font to load.
|
|
173
158
|
if (s.fontFamily)
|