@twick/2d 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/editor/editor/NodeInspectorConfig.d.ts +3 -0
- package/editor/editor/NodeInspectorConfig.d.ts.map +1 -0
- package/editor/editor/PreviewOverlayConfig.d.ts +3 -0
- package/editor/editor/PreviewOverlayConfig.d.ts.map +1 -0
- package/editor/editor/Provider.d.ts +17 -0
- package/editor/editor/Provider.d.ts.map +1 -0
- package/editor/editor/SceneGraphTabConfig.d.ts +3 -0
- package/editor/editor/SceneGraphTabConfig.d.ts.map +1 -0
- package/editor/editor/icons/CircleIcon.d.ts +2 -0
- package/editor/editor/icons/CircleIcon.d.ts.map +1 -0
- package/editor/editor/icons/CodeBlockIcon.d.ts +2 -0
- package/editor/editor/icons/CodeBlockIcon.d.ts.map +1 -0
- package/editor/editor/icons/CurveIcon.d.ts +2 -0
- package/editor/editor/icons/CurveIcon.d.ts.map +1 -0
- package/editor/editor/icons/GridIcon.d.ts +2 -0
- package/editor/editor/icons/GridIcon.d.ts.map +1 -0
- package/editor/editor/icons/IconMap.d.ts +3 -0
- package/editor/editor/icons/IconMap.d.ts.map +1 -0
- package/editor/editor/icons/ImgIcon.d.ts +2 -0
- package/editor/editor/icons/ImgIcon.d.ts.map +1 -0
- package/editor/editor/icons/LayoutIcon.d.ts +2 -0
- package/editor/editor/icons/LayoutIcon.d.ts.map +1 -0
- package/editor/editor/icons/LineIcon.d.ts +2 -0
- package/editor/editor/icons/LineIcon.d.ts.map +1 -0
- package/editor/editor/icons/NodeIcon.d.ts +2 -0
- package/editor/editor/icons/NodeIcon.d.ts.map +1 -0
- package/editor/editor/icons/RayIcon.d.ts +2 -0
- package/editor/editor/icons/RayIcon.d.ts.map +1 -0
- package/editor/editor/icons/RectIcon.d.ts +2 -0
- package/editor/editor/icons/RectIcon.d.ts.map +1 -0
- package/editor/editor/icons/ShapeIcon.d.ts +2 -0
- package/editor/editor/icons/ShapeIcon.d.ts.map +1 -0
- package/editor/editor/icons/TxtIcon.d.ts +2 -0
- package/editor/editor/icons/TxtIcon.d.ts.map +1 -0
- package/editor/editor/icons/VideoIcon.d.ts +2 -0
- package/editor/editor/icons/VideoIcon.d.ts.map +1 -0
- package/editor/editor/icons/View2DIcon.d.ts +2 -0
- package/editor/editor/icons/View2DIcon.d.ts.map +1 -0
- package/editor/editor/index.d.ts +4 -0
- package/editor/editor/index.d.ts.map +1 -0
- package/editor/editor/tree/DetachedRoot.d.ts +2 -0
- package/editor/editor/tree/DetachedRoot.d.ts.map +1 -0
- package/editor/editor/tree/NodeElement.d.ts +8 -0
- package/editor/editor/tree/NodeElement.d.ts.map +1 -0
- package/editor/editor/tree/TreeElement.d.ts +15 -0
- package/editor/editor/tree/TreeElement.d.ts.map +1 -0
- package/editor/editor/tree/TreeRoot.d.ts +3 -0
- package/editor/editor/tree/TreeRoot.d.ts.map +1 -0
- package/editor/editor/tree/ViewRoot.d.ts +2 -0
- package/editor/editor/tree/ViewRoot.d.ts.map +1 -0
- package/editor/editor/tree/index.d.ts +4 -0
- package/editor/editor/tree/index.d.ts.map +1 -0
- package/editor/editor/tsconfig.build.tsbuildinfo +1 -0
- package/editor/index.css +33 -0
- package/editor/index.js +341 -0
- package/editor/index.js.map +1 -0
- package/lib/code/CodeCursor.d.ts +83 -0
- package/lib/code/CodeCursor.d.ts.map +1 -0
- package/lib/code/CodeCursor.js +306 -0
- package/lib/code/CodeDiffer.d.ts +28 -0
- package/lib/code/CodeDiffer.d.ts.map +1 -0
- package/lib/code/CodeDiffer.js +51 -0
- package/lib/code/CodeFragment.d.ts +42 -0
- package/lib/code/CodeFragment.d.ts.map +1 -0
- package/lib/code/CodeFragment.js +72 -0
- package/lib/code/CodeHighlighter.d.ts +71 -0
- package/lib/code/CodeHighlighter.d.ts.map +1 -0
- package/lib/code/CodeHighlighter.js +2 -0
- package/lib/code/CodeMetrics.d.ts +11 -0
- package/lib/code/CodeMetrics.d.ts.map +1 -0
- package/lib/code/CodeMetrics.js +29 -0
- package/lib/code/CodeRange.d.ts +41 -0
- package/lib/code/CodeRange.d.ts.map +1 -0
- package/lib/code/CodeRange.js +179 -0
- package/lib/code/CodeScope.d.ts +16 -0
- package/lib/code/CodeScope.d.ts.map +1 -0
- package/lib/code/CodeScope.js +72 -0
- package/lib/code/CodeSelection.d.ts +6 -0
- package/lib/code/CodeSelection.d.ts.map +1 -0
- package/lib/code/CodeSelection.js +13 -0
- package/lib/code/CodeSignal.d.ts +60 -0
- package/lib/code/CodeSignal.d.ts.map +1 -0
- package/lib/code/CodeSignal.js +194 -0
- package/lib/code/CodeTokenizer.d.ts +8 -0
- package/lib/code/CodeTokenizer.d.ts.map +1 -0
- package/lib/code/CodeTokenizer.js +50 -0
- package/lib/code/DefaultHighlightStyle.d.ts +3 -0
- package/lib/code/DefaultHighlightStyle.d.ts.map +1 -0
- package/lib/code/DefaultHighlightStyle.js +98 -0
- package/lib/code/LezerHighlighter.d.ts +22 -0
- package/lib/code/LezerHighlighter.d.ts.map +1 -0
- package/lib/code/LezerHighlighter.js +89 -0
- package/lib/code/diff.d.ts +31 -0
- package/lib/code/diff.d.ts.map +1 -0
- package/lib/code/diff.js +236 -0
- package/lib/code/extractRange.d.ts +17 -0
- package/lib/code/extractRange.d.ts.map +1 -0
- package/lib/code/extractRange.js +102 -0
- package/lib/code/index.d.ts +14 -0
- package/lib/code/index.d.ts.map +1 -0
- package/lib/code/index.js +14 -0
- package/lib/components/Audio.d.ts +14 -0
- package/lib/components/Audio.d.ts.map +1 -0
- package/lib/components/Audio.js +118 -0
- package/lib/components/Bezier.d.ts +23 -0
- package/lib/components/Bezier.d.ts.map +1 -0
- package/lib/components/Bezier.js +81 -0
- package/lib/components/Circle.d.ts +193 -0
- package/lib/components/Circle.d.ts.map +1 -0
- package/lib/components/Circle.js +178 -0
- package/lib/components/Code.d.ts +231 -0
- package/lib/components/Code.d.ts.map +1 -0
- package/lib/components/Code.js +325 -0
- package/lib/components/CodeBlock.d.ts +133 -0
- package/lib/components/CodeBlock.d.ts.map +1 -0
- package/lib/components/CodeBlock.js +461 -0
- package/lib/components/CubicBezier.d.ts +70 -0
- package/lib/components/CubicBezier.d.ts.map +1 -0
- package/lib/components/CubicBezier.js +81 -0
- package/lib/components/Curve.d.ts +204 -0
- package/lib/components/Curve.d.ts.map +1 -0
- package/lib/components/Curve.js +284 -0
- package/lib/components/Grid.d.ts +76 -0
- package/lib/components/Grid.d.ts.map +1 -0
- package/lib/components/Grid.js +91 -0
- package/lib/components/Icon.d.ts +59 -0
- package/lib/components/Icon.d.ts.map +1 -0
- package/lib/components/Icon.js +58 -0
- package/lib/components/Img.d.ts +118 -0
- package/lib/components/Img.d.ts.map +1 -0
- package/lib/components/Img.js +245 -0
- package/lib/components/Knot.d.ts +90 -0
- package/lib/components/Knot.d.ts.map +1 -0
- package/lib/components/Knot.js +68 -0
- package/lib/components/Latex.d.ts +39 -0
- package/lib/components/Latex.d.ts.map +1 -0
- package/lib/components/Latex.js +101 -0
- package/lib/components/Layout.d.ts +419 -0
- package/lib/components/Layout.d.ts.map +1 -0
- package/lib/components/Layout.js +706 -0
- package/lib/components/Line.d.ts +160 -0
- package/lib/components/Line.d.ts.map +1 -0
- package/lib/components/Line.js +346 -0
- package/lib/components/Media.d.ts +65 -0
- package/lib/components/Media.d.ts.map +1 -0
- package/lib/components/Media.js +303 -0
- package/lib/components/Node.d.ts +836 -0
- package/lib/components/Node.d.ts.map +1 -0
- package/lib/components/Node.js +1317 -0
- package/lib/components/Path.d.ts +20 -0
- package/lib/components/Path.d.ts.map +1 -0
- package/lib/components/Path.js +97 -0
- package/lib/components/Polygon.d.ts +113 -0
- package/lib/components/Polygon.d.ts.map +1 -0
- package/lib/components/Polygon.js +123 -0
- package/lib/components/QuadBezier.d.ts +62 -0
- package/lib/components/QuadBezier.d.ts.map +1 -0
- package/lib/components/QuadBezier.js +76 -0
- package/lib/components/Ray.d.ts +62 -0
- package/lib/components/Ray.d.ts.map +1 -0
- package/lib/components/Ray.js +96 -0
- package/lib/components/Rect.d.ts +114 -0
- package/lib/components/Rect.d.ts.map +1 -0
- package/lib/components/Rect.js +76 -0
- package/lib/components/Rive.d.ts +22 -0
- package/lib/components/Rive.d.ts.map +1 -0
- package/lib/components/Rive.js +117 -0
- package/lib/components/SVG.d.ts +178 -0
- package/lib/components/SVG.d.ts.map +1 -0
- package/lib/components/SVG.js +577 -0
- package/lib/components/Shape.d.ts +40 -0
- package/lib/components/Shape.d.ts.map +1 -0
- package/lib/components/Shape.js +134 -0
- package/lib/components/Spline.d.ts +89 -0
- package/lib/components/Spline.d.ts.map +1 -0
- package/lib/components/Spline.js +256 -0
- package/lib/components/Txt.d.ts +53 -0
- package/lib/components/Txt.d.ts.map +1 -0
- package/lib/components/Txt.js +173 -0
- package/lib/components/TxtLeaf.d.ts +21 -0
- package/lib/components/TxtLeaf.d.ts.map +1 -0
- package/lib/components/TxtLeaf.js +181 -0
- package/lib/components/Video.d.ts +69 -0
- package/lib/components/Video.d.ts.map +1 -0
- package/lib/components/Video.js +283 -0
- package/lib/components/View2D.d.ts +28 -0
- package/lib/components/View2D.d.ts.map +1 -0
- package/lib/components/View2D.js +93 -0
- package/lib/components/index.d.ts +29 -0
- package/lib/components/index.d.ts.map +1 -0
- package/lib/components/index.js +29 -0
- package/lib/components/types.d.ts +17 -0
- package/lib/components/types.d.ts.map +1 -0
- package/lib/components/types.js +2 -0
- package/lib/curves/ArcSegment.d.ts +26 -0
- package/lib/curves/ArcSegment.d.ts.map +1 -0
- package/lib/curves/ArcSegment.js +97 -0
- package/lib/curves/CircleSegment.d.ts +18 -0
- package/lib/curves/CircleSegment.d.ts.map +1 -0
- package/lib/curves/CircleSegment.js +52 -0
- package/lib/curves/CubicBezierSegment.d.ts +18 -0
- package/lib/curves/CubicBezierSegment.d.ts.map +1 -0
- package/lib/curves/CubicBezierSegment.js +55 -0
- package/lib/curves/CurveDrawingInfo.d.ts +11 -0
- package/lib/curves/CurveDrawingInfo.d.ts.map +1 -0
- package/lib/curves/CurveDrawingInfo.js +2 -0
- package/lib/curves/CurvePoint.d.ts +15 -0
- package/lib/curves/CurvePoint.d.ts.map +1 -0
- package/lib/curves/CurvePoint.js +2 -0
- package/lib/curves/CurveProfile.d.ts +7 -0
- package/lib/curves/CurveProfile.d.ts.map +1 -0
- package/lib/curves/CurveProfile.js +2 -0
- package/lib/curves/KnotInfo.d.ts +12 -0
- package/lib/curves/KnotInfo.d.ts.map +1 -0
- package/lib/curves/KnotInfo.js +2 -0
- package/lib/curves/LineSegment.d.ts +16 -0
- package/lib/curves/LineSegment.d.ts.map +1 -0
- package/lib/curves/LineSegment.js +45 -0
- package/lib/curves/Polynomial.d.ts +118 -0
- package/lib/curves/Polynomial.d.ts.map +1 -0
- package/lib/curves/Polynomial.js +259 -0
- package/lib/curves/Polynomial2D.d.ts +22 -0
- package/lib/curves/Polynomial2D.d.ts.map +1 -0
- package/lib/curves/Polynomial2D.js +45 -0
- package/lib/curves/PolynomialSegment.d.ts +39 -0
- package/lib/curves/PolynomialSegment.d.ts.map +1 -0
- package/lib/curves/PolynomialSegment.js +86 -0
- package/lib/curves/QuadBezierSegment.d.ts +17 -0
- package/lib/curves/QuadBezierSegment.d.ts.map +1 -0
- package/lib/curves/QuadBezierSegment.js +49 -0
- package/lib/curves/Segment.d.ts +9 -0
- package/lib/curves/Segment.d.ts.map +1 -0
- package/lib/curves/Segment.js +3 -0
- package/lib/curves/UniformPolynomialCurveSampler.d.ts +43 -0
- package/lib/curves/UniformPolynomialCurveSampler.d.ts.map +1 -0
- package/lib/curves/UniformPolynomialCurveSampler.js +73 -0
- package/lib/curves/createCurveProfileLerp.d.ts +32 -0
- package/lib/curves/createCurveProfileLerp.d.ts.map +1 -0
- package/lib/curves/createCurveProfileLerp.js +351 -0
- package/lib/curves/getBezierSplineProfile.d.ts +12 -0
- package/lib/curves/getBezierSplineProfile.d.ts.map +1 -0
- package/lib/curves/getBezierSplineProfile.js +137 -0
- package/lib/curves/getCircleProfile.d.ts +4 -0
- package/lib/curves/getCircleProfile.d.ts.map +1 -0
- package/lib/curves/getCircleProfile.js +44 -0
- package/lib/curves/getPathProfile.d.ts +3 -0
- package/lib/curves/getPathProfile.d.ts.map +1 -0
- package/lib/curves/getPathProfile.js +128 -0
- package/lib/curves/getPointAtDistance.d.ts +4 -0
- package/lib/curves/getPointAtDistance.d.ts.map +1 -0
- package/lib/curves/getPointAtDistance.js +15 -0
- package/lib/curves/getPolylineProfile.d.ts +4 -0
- package/lib/curves/getPolylineProfile.d.ts.map +1 -0
- package/lib/curves/getPolylineProfile.js +58 -0
- package/lib/curves/getRectProfile.d.ts +4 -0
- package/lib/curves/getRectProfile.d.ts.map +1 -0
- package/lib/curves/getRectProfile.js +57 -0
- package/lib/curves/index.d.ts +17 -0
- package/lib/curves/index.d.ts.map +1 -0
- package/lib/curves/index.js +17 -0
- package/lib/decorators/canvasStyleSignal.d.ts +5 -0
- package/lib/decorators/canvasStyleSignal.d.ts.map +1 -0
- package/lib/decorators/canvasStyleSignal.js +12 -0
- package/lib/decorators/colorSignal.d.ts +2 -0
- package/lib/decorators/colorSignal.d.ts.map +1 -0
- package/lib/decorators/colorSignal.js +9 -0
- package/lib/decorators/compound.d.ts +26 -0
- package/lib/decorators/compound.d.ts.map +1 -0
- package/lib/decorators/compound.js +49 -0
- package/lib/decorators/computed.d.ts +9 -0
- package/lib/decorators/computed.d.ts.map +1 -0
- package/lib/decorators/computed.js +18 -0
- package/lib/decorators/defaultStyle.d.ts +2 -0
- package/lib/decorators/defaultStyle.d.ts.map +1 -0
- package/lib/decorators/defaultStyle.js +14 -0
- package/lib/decorators/filtersSignal.d.ts +13 -0
- package/lib/decorators/filtersSignal.d.ts.map +1 -0
- package/lib/decorators/filtersSignal.js +73 -0
- package/lib/decorators/index.d.ts +11 -0
- package/lib/decorators/index.d.ts.map +1 -0
- package/lib/decorators/index.js +11 -0
- package/lib/decorators/initializers.d.ts +4 -0
- package/lib/decorators/initializers.d.ts.map +1 -0
- package/lib/decorators/initializers.js +27 -0
- package/lib/decorators/nodeName.d.ts +9 -0
- package/lib/decorators/nodeName.d.ts.map +1 -0
- package/lib/decorators/nodeName.js +13 -0
- package/lib/decorators/signal.d.ts +183 -0
- package/lib/decorators/signal.d.ts.map +1 -0
- package/lib/decorators/signal.js +285 -0
- package/lib/decorators/spacingSignal.d.ts +2 -0
- package/lib/decorators/spacingSignal.d.ts.map +1 -0
- package/lib/decorators/spacingSignal.js +15 -0
- package/lib/decorators/vector2Signal.d.ts +9 -0
- package/lib/decorators/vector2Signal.d.ts.map +1 -0
- package/lib/decorators/vector2Signal.js +15 -0
- package/lib/index.d.ts +9 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +9 -0
- package/lib/jsx-dev-runtime.d.ts +3 -0
- package/lib/jsx-dev-runtime.d.ts.map +1 -0
- package/lib/jsx-dev-runtime.js +3 -0
- package/lib/jsx-runtime.d.ts +12 -0
- package/lib/jsx-runtime.d.ts.map +1 -0
- package/lib/jsx-runtime.js +23 -0
- package/lib/partials/Filter.d.ts +82 -0
- package/lib/partials/Filter.d.ts.map +1 -0
- package/lib/partials/Filter.js +135 -0
- package/lib/partials/Gradient.d.ts +31 -0
- package/lib/partials/Gradient.d.ts.map +1 -0
- package/lib/partials/Gradient.js +63 -0
- package/lib/partials/Pattern.d.ts +13 -0
- package/lib/partials/Pattern.d.ts.map +1 -0
- package/lib/partials/Pattern.js +27 -0
- package/lib/partials/ShaderConfig.d.ts +81 -0
- package/lib/partials/ShaderConfig.d.ts.map +1 -0
- package/lib/partials/ShaderConfig.js +25 -0
- package/lib/partials/index.d.ts +5 -0
- package/lib/partials/index.d.ts.map +1 -0
- package/lib/partials/index.js +5 -0
- package/lib/partials/types.d.ts +35 -0
- package/lib/partials/types.d.ts.map +1 -0
- package/lib/partials/types.js +2 -0
- package/lib/scenes/Scene2D.d.ts +29 -0
- package/lib/scenes/Scene2D.d.ts.map +1 -0
- package/lib/scenes/Scene2D.js +180 -0
- package/lib/scenes/index.d.ts +4 -0
- package/lib/scenes/index.d.ts.map +1 -0
- package/lib/scenes/index.js +4 -0
- package/lib/scenes/makeScene2D.d.ts +5 -0
- package/lib/scenes/makeScene2D.d.ts.map +1 -0
- package/lib/scenes/makeScene2D.js +11 -0
- package/lib/scenes/useScene2D.d.ts +3 -0
- package/lib/scenes/useScene2D.d.ts.map +1 -0
- package/lib/scenes/useScene2D.js +5 -0
- package/lib/tsconfig.build.tsbuildinfo +1 -0
- package/lib/utils/CanvasUtils.d.ts +23 -0
- package/lib/utils/CanvasUtils.d.ts.map +1 -0
- package/lib/utils/CanvasUtils.js +138 -0
- package/lib/utils/diff.d.ts +31 -0
- package/lib/utils/diff.d.ts.map +1 -0
- package/lib/utils/diff.js +97 -0
- package/lib/utils/index.d.ts +3 -0
- package/lib/utils/index.d.ts.map +1 -0
- package/lib/utils/index.js +3 -0
- package/lib/utils/is.d.ts +8 -0
- package/lib/utils/is.d.ts.map +1 -0
- package/lib/utils/is.js +10 -0
- package/lib/utils/makeSignalExtensions.d.ts +4 -0
- package/lib/utils/makeSignalExtensions.d.ts.map +1 -0
- package/lib/utils/makeSignalExtensions.js +20 -0
- package/lib/utils/video/ffmpeg-client.d.ts +5 -0
- package/lib/utils/video/ffmpeg-client.d.ts.map +1 -0
- package/lib/utils/video/ffmpeg-client.js +32 -0
- package/lib/utils/video/mp4-parser-manager.d.ts +3 -0
- package/lib/utils/video/mp4-parser-manager.d.ts.map +1 -0
- package/lib/utils/video/mp4-parser-manager.js +55 -0
- package/lib/utils/video/parser/index.d.ts +2 -0
- package/lib/utils/video/parser/index.d.ts.map +1 -0
- package/lib/utils/video/parser/index.js +2 -0
- package/lib/utils/video/parser/parser.d.ts +21 -0
- package/lib/utils/video/parser/parser.d.ts.map +1 -0
- package/lib/utils/video/parser/parser.js +168 -0
- package/lib/utils/video/parser/sampler.d.ts +16 -0
- package/lib/utils/video/parser/sampler.d.ts.map +1 -0
- package/lib/utils/video/parser/sampler.js +56 -0
- package/lib/utils/video/parser/segment.d.ts +48 -0
- package/lib/utils/video/parser/segment.d.ts.map +1 -0
- package/lib/utils/video/parser/segment.js +239 -0
- package/lib/utils/video/parser/sink.d.ts +9 -0
- package/lib/utils/video/parser/sink.d.ts.map +1 -0
- package/lib/utils/video/parser/sink.js +22 -0
- package/lib/utils/video/parser/utils.d.ts +10 -0
- package/lib/utils/video/parser/utils.d.ts.map +1 -0
- package/lib/utils/video/parser/utils.js +22 -0
- package/package.json +53 -0
- package/src/editor/NodeInspectorConfig.tsx +76 -0
- package/src/editor/PreviewOverlayConfig.tsx +67 -0
- package/src/editor/Provider.tsx +93 -0
- package/src/editor/SceneGraphTabConfig.tsx +81 -0
- package/src/editor/icons/CircleIcon.tsx +7 -0
- package/src/editor/icons/CodeBlockIcon.tsx +8 -0
- package/src/editor/icons/CurveIcon.tsx +7 -0
- package/src/editor/icons/GridIcon.tsx +7 -0
- package/src/editor/icons/IconMap.ts +35 -0
- package/src/editor/icons/ImgIcon.tsx +8 -0
- package/src/editor/icons/LayoutIcon.tsx +9 -0
- package/src/editor/icons/LineIcon.tsx +7 -0
- package/src/editor/icons/NodeIcon.tsx +7 -0
- package/src/editor/icons/RayIcon.tsx +7 -0
- package/src/editor/icons/RectIcon.tsx +7 -0
- package/src/editor/icons/ShapeIcon.tsx +7 -0
- package/src/editor/icons/TxtIcon.tsx +8 -0
- package/src/editor/icons/VideoIcon.tsx +7 -0
- package/src/editor/icons/View2DIcon.tsx +10 -0
- package/src/editor/index.css +0 -0
- package/src/editor/index.ts +17 -0
- package/src/editor/tree/DetachedRoot.tsx +23 -0
- package/src/editor/tree/NodeElement.tsx +74 -0
- package/src/editor/tree/TreeElement.tsx +72 -0
- package/src/editor/tree/TreeRoot.tsx +10 -0
- package/src/editor/tree/ViewRoot.tsx +20 -0
- package/src/editor/tree/index.module.scss +38 -0
- package/src/editor/tree/index.ts +3 -0
- package/src/editor/tsconfig.build.json +5 -0
- package/src/editor/tsconfig.json +12 -0
- package/src/editor/tsdoc.json +4 -0
- package/src/editor/vite-env.d.ts +1 -0
- package/src/lib/code/CodeCursor.ts +445 -0
- package/src/lib/code/CodeDiffer.ts +78 -0
- package/src/lib/code/CodeFragment.ts +97 -0
- package/src/lib/code/CodeHighlighter.ts +75 -0
- package/src/lib/code/CodeMetrics.ts +47 -0
- package/src/lib/code/CodeRange.test.ts +74 -0
- package/src/lib/code/CodeRange.ts +216 -0
- package/src/lib/code/CodeScope.ts +101 -0
- package/src/lib/code/CodeSelection.ts +24 -0
- package/src/lib/code/CodeSignal.ts +327 -0
- package/src/lib/code/CodeTokenizer.ts +54 -0
- package/src/lib/code/DefaultHighlightStyle.ts +98 -0
- package/src/lib/code/LezerHighlighter.ts +113 -0
- package/src/lib/code/diff.test.ts +311 -0
- package/src/lib/code/diff.ts +319 -0
- package/src/lib/code/extractRange.ts +126 -0
- package/src/lib/code/index.ts +13 -0
- package/src/lib/components/Audio.ts +131 -0
- package/src/lib/components/Bezier.ts +105 -0
- package/src/lib/components/Circle.ts +266 -0
- package/src/lib/components/Code.ts +526 -0
- package/src/lib/components/CodeBlock.ts +576 -0
- package/src/lib/components/CubicBezier.ts +112 -0
- package/src/lib/components/Curve.ts +455 -0
- package/src/lib/components/Grid.ts +135 -0
- package/src/lib/components/Icon.ts +96 -0
- package/src/lib/components/Img.ts +319 -0
- package/src/lib/components/Knot.ts +157 -0
- package/src/lib/components/Latex.ts +122 -0
- package/src/lib/components/Layout.ts +1092 -0
- package/src/lib/components/Line.ts +429 -0
- package/src/lib/components/Media.ts +379 -0
- package/src/lib/components/Node.ts +1940 -0
- package/src/lib/components/Path.ts +137 -0
- package/src/lib/components/Polygon.ts +171 -0
- package/src/lib/components/QuadBezier.ts +100 -0
- package/src/lib/components/Ray.ts +125 -0
- package/src/lib/components/Rect.ts +187 -0
- package/src/lib/components/Rive.ts +156 -0
- package/src/lib/components/SVG.ts +797 -0
- package/src/lib/components/Shape.ts +143 -0
- package/src/lib/components/Spline.ts +344 -0
- package/src/lib/components/Txt.test.tsx +81 -0
- package/src/lib/components/Txt.ts +203 -0
- package/src/lib/components/TxtLeaf.ts +205 -0
- package/src/lib/components/Video.ts +397 -0
- package/src/lib/components/View2D.ts +98 -0
- package/src/lib/components/__tests__/children.test.tsx +142 -0
- package/src/lib/components/__tests__/clone.test.tsx +126 -0
- package/src/lib/components/__tests__/generatorTest.ts +28 -0
- package/src/lib/components/__tests__/mockScene2D.ts +45 -0
- package/src/lib/components/__tests__/query.test.tsx +122 -0
- package/src/lib/components/__tests__/state.test.tsx +60 -0
- package/src/lib/components/index.ts +28 -0
- package/src/lib/components/types.ts +35 -0
- package/src/lib/curves/ArcSegment.ts +159 -0
- package/src/lib/curves/CircleSegment.ts +77 -0
- package/src/lib/curves/CubicBezierSegment.ts +78 -0
- package/src/lib/curves/CurveDrawingInfo.ts +11 -0
- package/src/lib/curves/CurvePoint.ts +15 -0
- package/src/lib/curves/CurveProfile.ts +7 -0
- package/src/lib/curves/KnotInfo.ts +10 -0
- package/src/lib/curves/LineSegment.ts +62 -0
- package/src/lib/curves/Polynomial.ts +355 -0
- package/src/lib/curves/Polynomial2D.ts +62 -0
- package/src/lib/curves/PolynomialSegment.ts +124 -0
- package/src/lib/curves/QuadBezierSegment.ts +64 -0
- package/src/lib/curves/Segment.ts +17 -0
- package/src/lib/curves/UniformPolynomialCurveSampler.ts +94 -0
- package/src/lib/curves/createCurveProfileLerp.ts +471 -0
- package/src/lib/curves/getBezierSplineProfile.ts +223 -0
- package/src/lib/curves/getCircleProfile.ts +86 -0
- package/src/lib/curves/getPathProfile.ts +178 -0
- package/src/lib/curves/getPointAtDistance.ts +21 -0
- package/src/lib/curves/getPolylineProfile.test.ts +21 -0
- package/src/lib/curves/getPolylineProfile.ts +89 -0
- package/src/lib/curves/getRectProfile.ts +139 -0
- package/src/lib/curves/index.ts +16 -0
- package/src/lib/decorators/canvasStyleSignal.ts +16 -0
- package/src/lib/decorators/colorSignal.ts +9 -0
- package/src/lib/decorators/compound.ts +72 -0
- package/src/lib/decorators/computed.ts +18 -0
- package/src/lib/decorators/defaultStyle.ts +18 -0
- package/src/lib/decorators/filtersSignal.ts +136 -0
- package/src/lib/decorators/index.ts +10 -0
- package/src/lib/decorators/initializers.ts +32 -0
- package/src/lib/decorators/nodeName.ts +13 -0
- package/src/lib/decorators/signal.test.ts +90 -0
- package/src/lib/decorators/signal.ts +345 -0
- package/src/lib/decorators/spacingSignal.ts +15 -0
- package/src/lib/decorators/vector2Signal.ts +30 -0
- package/src/lib/globals.d.ts +2 -0
- package/src/lib/index.ts +8 -0
- package/src/lib/jsx-dev-runtime.ts +2 -0
- package/src/lib/jsx-runtime.ts +46 -0
- package/src/lib/parse-svg-path.d.ts +14 -0
- package/src/lib/partials/Filter.ts +180 -0
- package/src/lib/partials/Gradient.ts +102 -0
- package/src/lib/partials/Pattern.ts +34 -0
- package/src/lib/partials/ShaderConfig.ts +117 -0
- package/src/lib/partials/index.ts +4 -0
- package/src/lib/partials/types.ts +58 -0
- package/src/lib/scenes/Scene2D.ts +242 -0
- package/src/lib/scenes/index.ts +3 -0
- package/src/lib/scenes/makeScene2D.ts +16 -0
- package/src/lib/scenes/useScene2D.ts +6 -0
- package/src/lib/tsconfig.build.json +5 -0
- package/src/lib/tsconfig.json +10 -0
- package/src/lib/tsdoc.json +4 -0
- package/src/lib/utils/CanvasUtils.ts +306 -0
- package/src/lib/utils/diff.test.ts +453 -0
- package/src/lib/utils/diff.ts +148 -0
- package/src/lib/utils/index.ts +2 -0
- package/src/lib/utils/is.ts +11 -0
- package/src/lib/utils/makeSignalExtensions.ts +30 -0
- package/src/lib/utils/video/declarations.d.ts +1 -0
- package/src/lib/utils/video/ffmpeg-client.ts +50 -0
- package/src/lib/utils/video/mp4-parser-manager.ts +72 -0
- package/src/lib/utils/video/parser/index.ts +1 -0
- package/src/lib/utils/video/parser/parser.ts +257 -0
- package/src/lib/utils/video/parser/sampler.ts +72 -0
- package/src/lib/utils/video/parser/segment.ts +302 -0
- package/src/lib/utils/video/parser/sink.ts +29 -0
- package/src/lib/utils/video/parser/utils.ts +31 -0
- package/src/tsconfig.base.json +19 -0
- package/src/tsconfig.build.json +8 -0
- package/src/tsconfig.json +5 -0
- package/tsconfig.project.json +7 -0
|
@@ -0,0 +1,836 @@
|
|
|
1
|
+
import type { ColorSignal, PossibleColor, PossibleSpacing, PossibleVector2, Promisable, ReferenceReceiver, Signal, SignalValue, SimpleSignal, SimpleVector2Signal, SpacingSignal, ThreadGenerator, TimingFunction, Vector2Signal } from '@twick/core';
|
|
2
|
+
import { BBox, Vector2 } from '@twick/core';
|
|
3
|
+
import { NODE_NAME } from '../decorators';
|
|
4
|
+
import type { FiltersSignal } from '../decorators/filtersSignal';
|
|
5
|
+
import type { Filter } from '../partials';
|
|
6
|
+
import type { PossibleShaderConfig, ShaderConfig } from '../partials/ShaderConfig';
|
|
7
|
+
import type { View2D } from './View2D';
|
|
8
|
+
import type { ComponentChildren } from './types';
|
|
9
|
+
export type NodeState = NodeProps & Record<string, any>;
|
|
10
|
+
export interface NodeProps {
|
|
11
|
+
ref?: ReferenceReceiver<any>;
|
|
12
|
+
children?: SignalValue<ComponentChildren>;
|
|
13
|
+
/**
|
|
14
|
+
* @deprecated Use {@link children} instead.
|
|
15
|
+
*/
|
|
16
|
+
spawner?: SignalValue<ComponentChildren>;
|
|
17
|
+
key?: string;
|
|
18
|
+
x?: SignalValue<number>;
|
|
19
|
+
y?: SignalValue<number>;
|
|
20
|
+
position?: SignalValue<PossibleVector2>;
|
|
21
|
+
rotation?: SignalValue<number>;
|
|
22
|
+
scaleX?: SignalValue<number>;
|
|
23
|
+
scaleY?: SignalValue<number>;
|
|
24
|
+
scale?: SignalValue<PossibleVector2>;
|
|
25
|
+
skewX?: SignalValue<number>;
|
|
26
|
+
skewY?: SignalValue<number>;
|
|
27
|
+
skew?: SignalValue<PossibleVector2>;
|
|
28
|
+
zIndex?: SignalValue<number>;
|
|
29
|
+
opacity?: SignalValue<number>;
|
|
30
|
+
filters?: SignalValue<Filter[]>;
|
|
31
|
+
shadowColor?: SignalValue<PossibleColor>;
|
|
32
|
+
shadowBlur?: SignalValue<number>;
|
|
33
|
+
shadowOffsetX?: SignalValue<number>;
|
|
34
|
+
shadowOffsetY?: SignalValue<number>;
|
|
35
|
+
shadowOffset?: SignalValue<PossibleVector2>;
|
|
36
|
+
cache?: SignalValue<boolean>;
|
|
37
|
+
/**
|
|
38
|
+
* {@inheritDoc Node.cachePadding}
|
|
39
|
+
*/
|
|
40
|
+
cachePaddingTop?: SignalValue<number>;
|
|
41
|
+
/**
|
|
42
|
+
* {@inheritDoc Node.cachePadding}
|
|
43
|
+
*/
|
|
44
|
+
cachePaddingBottom?: SignalValue<number>;
|
|
45
|
+
/**
|
|
46
|
+
* {@inheritDoc Node.cachePadding}
|
|
47
|
+
*/
|
|
48
|
+
cachePaddingLeft?: SignalValue<number>;
|
|
49
|
+
/**
|
|
50
|
+
* {@inheritDoc Node.cachePadding}
|
|
51
|
+
*/
|
|
52
|
+
cachePaddingRight?: SignalValue<number>;
|
|
53
|
+
/**
|
|
54
|
+
* {@inheritDoc Node.cachePadding}
|
|
55
|
+
*/
|
|
56
|
+
cachePadding?: SignalValue<PossibleSpacing>;
|
|
57
|
+
composite?: SignalValue<boolean>;
|
|
58
|
+
compositeOperation?: SignalValue<GlobalCompositeOperation>;
|
|
59
|
+
/**
|
|
60
|
+
* @experimental
|
|
61
|
+
*/
|
|
62
|
+
shaders?: PossibleShaderConfig;
|
|
63
|
+
}
|
|
64
|
+
export declare class Node implements Promisable<Node> {
|
|
65
|
+
/**
|
|
66
|
+
* @internal
|
|
67
|
+
*/
|
|
68
|
+
readonly [NODE_NAME]: string;
|
|
69
|
+
isClass: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Represents the position of this node in local space of its parent.
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* Initializing the position:
|
|
75
|
+
* ```tsx
|
|
76
|
+
* // with a possible vector:
|
|
77
|
+
* <Node position={[1, 2]} />
|
|
78
|
+
* // with individual components:
|
|
79
|
+
* <Node x={1} y={2} />
|
|
80
|
+
* ```
|
|
81
|
+
*
|
|
82
|
+
* Accessing the position:
|
|
83
|
+
* ```tsx
|
|
84
|
+
* // retrieving the vector:
|
|
85
|
+
* const position = node.position();
|
|
86
|
+
* // retrieving an individual component:
|
|
87
|
+
* const x = node.position.x();
|
|
88
|
+
* ```
|
|
89
|
+
*
|
|
90
|
+
* Setting the position:
|
|
91
|
+
* ```tsx
|
|
92
|
+
* // with a possible vector:
|
|
93
|
+
* node.position([1, 2]);
|
|
94
|
+
* node.position(() => [1, 2]);
|
|
95
|
+
* // with individual components:
|
|
96
|
+
* node.position.x(1);
|
|
97
|
+
* node.position.x(() => 1);
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
100
|
+
readonly position: Vector2Signal<this>;
|
|
101
|
+
get x(): SimpleSignal<number, this>;
|
|
102
|
+
get y(): SimpleSignal<number, this>;
|
|
103
|
+
/**
|
|
104
|
+
* A helper signal for operating on the position in world space.
|
|
105
|
+
*
|
|
106
|
+
* @remarks
|
|
107
|
+
* Retrieving the position using this signal returns the position in world
|
|
108
|
+
* space. Similarly, setting the position using this signal transforms the
|
|
109
|
+
* new value to local space.
|
|
110
|
+
*
|
|
111
|
+
* If the new value is a function, the position of this node will be
|
|
112
|
+
* continuously updated to always match the position returned by the function.
|
|
113
|
+
* This can be useful to "pin" the node in a specific place or to make it
|
|
114
|
+
* follow another node's position.
|
|
115
|
+
*
|
|
116
|
+
* Unlike {@link position}, this signal is not compound - it doesn't contain
|
|
117
|
+
* separate signals for the `x` and `y` components.
|
|
118
|
+
*/
|
|
119
|
+
readonly absolutePosition: SimpleVector2Signal<this>;
|
|
120
|
+
protected getAbsolutePosition(): Vector2;
|
|
121
|
+
protected setAbsolutePosition(value: SignalValue<PossibleVector2>): void;
|
|
122
|
+
/**
|
|
123
|
+
* Represents the rotation (in degrees) of this node relative to its parent.
|
|
124
|
+
*/
|
|
125
|
+
readonly rotation: SimpleSignal<number, this>;
|
|
126
|
+
/**
|
|
127
|
+
* A helper signal for operating on the rotation in world space.
|
|
128
|
+
*
|
|
129
|
+
* @remarks
|
|
130
|
+
* Retrieving the rotation using this signal returns the rotation in world
|
|
131
|
+
* space. Similarly, setting the rotation using this signal transforms the
|
|
132
|
+
* new value to local space.
|
|
133
|
+
*
|
|
134
|
+
* If the new value is a function, the rotation of this node will be
|
|
135
|
+
* continuously updated to always match the rotation returned by the function.
|
|
136
|
+
*/
|
|
137
|
+
readonly absoluteRotation: SimpleSignal<number, this>;
|
|
138
|
+
protected getAbsoluteRotation(): number;
|
|
139
|
+
protected setAbsoluteRotation(value: SignalValue<number>): void;
|
|
140
|
+
/**
|
|
141
|
+
* Represents the scale of this node in local space of its parent.
|
|
142
|
+
*
|
|
143
|
+
* @example
|
|
144
|
+
* Initializing the scale:
|
|
145
|
+
* ```tsx
|
|
146
|
+
* // with a possible vector:
|
|
147
|
+
* <Node scale={[1, 2]} />
|
|
148
|
+
* // with individual components:
|
|
149
|
+
* <Node scaleX={1} scaleY={2} />
|
|
150
|
+
* ```
|
|
151
|
+
*
|
|
152
|
+
* Accessing the scale:
|
|
153
|
+
* ```tsx
|
|
154
|
+
* // retrieving the vector:
|
|
155
|
+
* const scale = node.scale();
|
|
156
|
+
* // retrieving an individual component:
|
|
157
|
+
* const scaleX = node.scale.x();
|
|
158
|
+
* ```
|
|
159
|
+
*
|
|
160
|
+
* Setting the scale:
|
|
161
|
+
* ```tsx
|
|
162
|
+
* // with a possible vector:
|
|
163
|
+
* node.scale([1, 2]);
|
|
164
|
+
* node.scale(() => [1, 2]);
|
|
165
|
+
* // with individual components:
|
|
166
|
+
* node.scale.x(1);
|
|
167
|
+
* node.scale.x(() => 1);
|
|
168
|
+
* ```
|
|
169
|
+
*/
|
|
170
|
+
readonly scale: Vector2Signal<this>;
|
|
171
|
+
/**
|
|
172
|
+
* Represents the skew of this node in local space of its parent.
|
|
173
|
+
*
|
|
174
|
+
* @example
|
|
175
|
+
* Initializing the skew:
|
|
176
|
+
* ```tsx
|
|
177
|
+
* // with a possible vector:
|
|
178
|
+
* <Node skew={[40, 20]} />
|
|
179
|
+
* // with individual components:
|
|
180
|
+
* <Node skewX={40} skewY={20} />
|
|
181
|
+
* ```
|
|
182
|
+
*
|
|
183
|
+
* Accessing the skew:
|
|
184
|
+
* ```tsx
|
|
185
|
+
* // retrieving the vector:
|
|
186
|
+
* const skew = node.skew();
|
|
187
|
+
* // retrieving an individual component:
|
|
188
|
+
* const skewX = node.skew.x();
|
|
189
|
+
* ```
|
|
190
|
+
*
|
|
191
|
+
* Setting the skew:
|
|
192
|
+
* ```tsx
|
|
193
|
+
* // with a possible vector:
|
|
194
|
+
* node.skew([40, 20]);
|
|
195
|
+
* node.skew(() => [40, 20]);
|
|
196
|
+
* // with individual components:
|
|
197
|
+
* node.skew.x(40);
|
|
198
|
+
* node.skew.x(() => 40);
|
|
199
|
+
* ```
|
|
200
|
+
*/
|
|
201
|
+
readonly skew: Vector2Signal<this>;
|
|
202
|
+
/**
|
|
203
|
+
* A helper signal for operating on the scale in world space.
|
|
204
|
+
*
|
|
205
|
+
* @remarks
|
|
206
|
+
* Retrieving the scale using this signal returns the scale in world space.
|
|
207
|
+
* Similarly, setting the scale using this signal transforms the new value to
|
|
208
|
+
* local space.
|
|
209
|
+
*
|
|
210
|
+
* If the new value is a function, the scale of this node will be continuously
|
|
211
|
+
* updated to always match the position returned by the function.
|
|
212
|
+
*
|
|
213
|
+
* Unlike {@link scale}, this signal is not compound - it doesn't contain
|
|
214
|
+
* separate signals for the `x` and `y` components.
|
|
215
|
+
*/
|
|
216
|
+
readonly absoluteScale: SimpleVector2Signal<this>;
|
|
217
|
+
protected getAbsoluteScale(): Vector2;
|
|
218
|
+
protected setAbsoluteScale(value: SignalValue<PossibleVector2>): void;
|
|
219
|
+
private getRelativeScale;
|
|
220
|
+
readonly zIndex: SimpleSignal<number, this>;
|
|
221
|
+
readonly cache: SimpleSignal<boolean, this>;
|
|
222
|
+
/**
|
|
223
|
+
* Controls the padding of the cached canvas used by this node.
|
|
224
|
+
*
|
|
225
|
+
* @remarks
|
|
226
|
+
* By default, the size of the cache is determined based on the bounding box
|
|
227
|
+
* of the node and its children. That includes effects such as stroke or
|
|
228
|
+
* shadow. This property can be used to expand the cache area further.
|
|
229
|
+
* Usually used to account for custom effects created by {@link shaders}.
|
|
230
|
+
*/
|
|
231
|
+
readonly cachePadding: SpacingSignal<this>;
|
|
232
|
+
readonly composite: SimpleSignal<boolean, this>;
|
|
233
|
+
readonly compositeOperation: SimpleSignal<GlobalCompositeOperation, this>;
|
|
234
|
+
private readonly compositeOverride;
|
|
235
|
+
protected tweenCompositeOperation(value: SignalValue<GlobalCompositeOperation>, time: number, timingFunction: TimingFunction): Generator<void | ThreadGenerator | Promise<any> | Promisable<any>, void, any>;
|
|
236
|
+
/**
|
|
237
|
+
* Represents the opacity of this node in the range 0-1.
|
|
238
|
+
*
|
|
239
|
+
* @remarks
|
|
240
|
+
* The value is clamped to the range 0-1.
|
|
241
|
+
*/
|
|
242
|
+
readonly opacity: SimpleSignal<number, this>;
|
|
243
|
+
absoluteOpacity(): number;
|
|
244
|
+
readonly filters: FiltersSignal<this>;
|
|
245
|
+
readonly shadowColor: ColorSignal<this>;
|
|
246
|
+
readonly shadowBlur: SimpleSignal<number, this>;
|
|
247
|
+
readonly shadowOffset: Vector2Signal<this>;
|
|
248
|
+
/**
|
|
249
|
+
* @experimental
|
|
250
|
+
*/
|
|
251
|
+
readonly shaders: Signal<PossibleShaderConfig, ShaderConfig[], this>;
|
|
252
|
+
protected hasFilters(): boolean;
|
|
253
|
+
protected hasShadow(): boolean;
|
|
254
|
+
protected filterString(): string;
|
|
255
|
+
/**
|
|
256
|
+
* @deprecated Use {@link children} instead.
|
|
257
|
+
*/
|
|
258
|
+
protected readonly spawner: SimpleSignal<ComponentChildren, this>;
|
|
259
|
+
protected getSpawner(): ComponentChildren;
|
|
260
|
+
protected setSpawner(value: SignalValue<ComponentChildren>): void;
|
|
261
|
+
readonly children: Signal<ComponentChildren, Node[], this>;
|
|
262
|
+
protected setChildren(value: SignalValue<ComponentChildren>): void;
|
|
263
|
+
protected getChildren(): Node[];
|
|
264
|
+
protected spawnedChildren(): Node[];
|
|
265
|
+
protected sortedChildren(): Node[];
|
|
266
|
+
protected view2D: View2D;
|
|
267
|
+
private stateStack;
|
|
268
|
+
protected realChildren: Node[];
|
|
269
|
+
protected hasSpawnedChildren: boolean;
|
|
270
|
+
private unregister;
|
|
271
|
+
readonly parent: SimpleSignal<Node | null, void>;
|
|
272
|
+
readonly properties: Record<string, import("../decorators").PropertyMetadata<any>>;
|
|
273
|
+
readonly key: string;
|
|
274
|
+
readonly creationStack?: string;
|
|
275
|
+
constructor({ children, spawner, key, ...rest }: NodeProps);
|
|
276
|
+
/**
|
|
277
|
+
* Get the local-to-world matrix for this node.
|
|
278
|
+
*
|
|
279
|
+
* @remarks
|
|
280
|
+
* This matrix transforms vectors from local space of this node to world
|
|
281
|
+
* space.
|
|
282
|
+
*
|
|
283
|
+
* @example
|
|
284
|
+
* Calculate the absolute position of a point located 200 pixels to the right
|
|
285
|
+
* of the node:
|
|
286
|
+
* ```ts
|
|
287
|
+
* const local = new Vector2(0, 200);
|
|
288
|
+
* const world = transformVectorAsPoint(local, node.localToWorld());
|
|
289
|
+
* ```
|
|
290
|
+
*/
|
|
291
|
+
localToWorld(): DOMMatrix;
|
|
292
|
+
/**
|
|
293
|
+
* Get the world-to-local matrix for this node.
|
|
294
|
+
*
|
|
295
|
+
* @remarks
|
|
296
|
+
* This matrix transforms vectors from world space to local space of this
|
|
297
|
+
* node.
|
|
298
|
+
*
|
|
299
|
+
* @example
|
|
300
|
+
* Calculate the position relative to this node for a point located in the
|
|
301
|
+
* top-left corner of the screen:
|
|
302
|
+
* ```ts
|
|
303
|
+
* const world = new Vector2(0, 0);
|
|
304
|
+
* const local = transformVectorAsPoint(world, node.worldToLocal());
|
|
305
|
+
* ```
|
|
306
|
+
*/
|
|
307
|
+
worldToLocal(): DOMMatrix;
|
|
308
|
+
/**
|
|
309
|
+
* Get the world-to-parent matrix for this node.
|
|
310
|
+
*
|
|
311
|
+
* @remarks
|
|
312
|
+
* This matrix transforms vectors from world space to local space of this
|
|
313
|
+
* node's parent.
|
|
314
|
+
*/
|
|
315
|
+
worldToParent(): DOMMatrix;
|
|
316
|
+
/**
|
|
317
|
+
* Get the local-to-parent matrix for this node.
|
|
318
|
+
*
|
|
319
|
+
* @remarks
|
|
320
|
+
* This matrix transforms vectors from local space of this node to local space
|
|
321
|
+
* of this node's parent.
|
|
322
|
+
*/
|
|
323
|
+
localToParent(): DOMMatrix;
|
|
324
|
+
/**
|
|
325
|
+
* A matrix mapping composite space to world space.
|
|
326
|
+
*
|
|
327
|
+
* @remarks
|
|
328
|
+
* Certain effects such as blur and shadows ignore the current transformation.
|
|
329
|
+
* This matrix can be used to transform their parameters so that the effect
|
|
330
|
+
* appears relative to the closest composite root.
|
|
331
|
+
*/
|
|
332
|
+
compositeToWorld(): DOMMatrix;
|
|
333
|
+
protected compositeRoot(): Node | null;
|
|
334
|
+
compositeToLocal(): DOMMatrix;
|
|
335
|
+
view(): View2D;
|
|
336
|
+
/**
|
|
337
|
+
* Add the given node(s) as the children of this node.
|
|
338
|
+
*
|
|
339
|
+
* @remarks
|
|
340
|
+
* The nodes will be appended at the end of the children list.
|
|
341
|
+
*
|
|
342
|
+
* @example
|
|
343
|
+
* ```tsx
|
|
344
|
+
* const node = <Layout />;
|
|
345
|
+
* node.add(<Rect />);
|
|
346
|
+
* node.add(<Circle />);
|
|
347
|
+
* ```
|
|
348
|
+
* Result:
|
|
349
|
+
* ```mermaid
|
|
350
|
+
* graph TD;
|
|
351
|
+
* layout([Layout])
|
|
352
|
+
* circle([Circle])
|
|
353
|
+
* rect([Rect])
|
|
354
|
+
* layout-->rect;
|
|
355
|
+
* layout-->circle;
|
|
356
|
+
* ```
|
|
357
|
+
*
|
|
358
|
+
* @param node - A node or an array of nodes to append.
|
|
359
|
+
*/
|
|
360
|
+
add(node: ComponentChildren): this;
|
|
361
|
+
/**
|
|
362
|
+
* Insert the given node(s) at the specified index in the children list.
|
|
363
|
+
*
|
|
364
|
+
* @example
|
|
365
|
+
* ```tsx
|
|
366
|
+
* const node = (
|
|
367
|
+
* <Layout>
|
|
368
|
+
* <Rect />
|
|
369
|
+
* <Circle />
|
|
370
|
+
* </Layout>
|
|
371
|
+
* );
|
|
372
|
+
*
|
|
373
|
+
* node.insert(<Txt />, 1);
|
|
374
|
+
* ```
|
|
375
|
+
*
|
|
376
|
+
* Result:
|
|
377
|
+
* ```mermaid
|
|
378
|
+
* graph TD;
|
|
379
|
+
* layout([Layout])
|
|
380
|
+
* circle([Circle])
|
|
381
|
+
* text([Text])
|
|
382
|
+
* rect([Rect])
|
|
383
|
+
* layout-->rect;
|
|
384
|
+
* layout-->text;
|
|
385
|
+
* layout-->circle;
|
|
386
|
+
* ```
|
|
387
|
+
*
|
|
388
|
+
* @param node - A node or an array of nodes to insert.
|
|
389
|
+
* @param index - An index at which to insert the node(s).
|
|
390
|
+
*/
|
|
391
|
+
insert(node: ComponentChildren, index?: number): this;
|
|
392
|
+
/**
|
|
393
|
+
* Remove this node from the tree.
|
|
394
|
+
*/
|
|
395
|
+
remove(): this;
|
|
396
|
+
/**
|
|
397
|
+
* Rearrange this node in relation to its siblings.
|
|
398
|
+
*
|
|
399
|
+
* @remarks
|
|
400
|
+
* Children are rendered starting from the beginning of the children list.
|
|
401
|
+
* We can change the rendering order by rearranging said list.
|
|
402
|
+
*
|
|
403
|
+
* A positive `by` arguments move the node up (it will be rendered on top of
|
|
404
|
+
* the elements it has passed). Negative values move it down.
|
|
405
|
+
*
|
|
406
|
+
* @param by - Number of places by which the node should be moved.
|
|
407
|
+
*/
|
|
408
|
+
move(by?: number): this;
|
|
409
|
+
/**
|
|
410
|
+
* Move the node up in relation to its siblings.
|
|
411
|
+
*
|
|
412
|
+
* @remarks
|
|
413
|
+
* The node will exchange places with the sibling right above it (if any) and
|
|
414
|
+
* from then on will be rendered on top of it.
|
|
415
|
+
*/
|
|
416
|
+
moveUp(): this;
|
|
417
|
+
/**
|
|
418
|
+
* Move the node down in relation to its siblings.
|
|
419
|
+
*
|
|
420
|
+
* @remarks
|
|
421
|
+
* The node will exchange places with the sibling right below it (if any) and
|
|
422
|
+
* from then on will be rendered under it.
|
|
423
|
+
*/
|
|
424
|
+
moveDown(): this;
|
|
425
|
+
/**
|
|
426
|
+
* Move the node to the top in relation to its siblings.
|
|
427
|
+
*
|
|
428
|
+
* @remarks
|
|
429
|
+
* The node will be placed at the end of the children list and from then on
|
|
430
|
+
* will be rendered on top of all of its siblings.
|
|
431
|
+
*/
|
|
432
|
+
moveToTop(): this;
|
|
433
|
+
/**
|
|
434
|
+
* Move the node to the bottom in relation to its siblings.
|
|
435
|
+
*
|
|
436
|
+
* @remarks
|
|
437
|
+
* The node will be placed at the beginning of the children list and from then
|
|
438
|
+
* on will be rendered below all of its siblings.
|
|
439
|
+
*/
|
|
440
|
+
moveToBottom(): this;
|
|
441
|
+
/**
|
|
442
|
+
* Move the node to the provided position relative to its siblings.
|
|
443
|
+
*
|
|
444
|
+
* @remarks
|
|
445
|
+
* If the node is getting moved to a lower position, it will be placed below
|
|
446
|
+
* the sibling that's currently at the provided index (if any).
|
|
447
|
+
* If the node is getting moved to a higher position, it will be placed above
|
|
448
|
+
* the sibling that's currently at the provided index (if any).
|
|
449
|
+
*
|
|
450
|
+
* @param index - The index to move the node to.
|
|
451
|
+
*/
|
|
452
|
+
moveTo(index: number): this;
|
|
453
|
+
/**
|
|
454
|
+
* Move the node below the provided node in the parent's layout.
|
|
455
|
+
*
|
|
456
|
+
* @remarks
|
|
457
|
+
* The node will be moved below the provided node and from then on will be
|
|
458
|
+
* rendered below it. By default, if the node is already positioned lower than
|
|
459
|
+
* the sibling node, it will not get moved.
|
|
460
|
+
*
|
|
461
|
+
* @param node - The sibling node below which to move.
|
|
462
|
+
* @param directlyBelow - Whether the node should be positioned directly below
|
|
463
|
+
* the sibling. When true, will move the node even if
|
|
464
|
+
* it is already positioned below the sibling.
|
|
465
|
+
*/
|
|
466
|
+
moveBelow(node: Node, directlyBelow?: boolean): this;
|
|
467
|
+
/**
|
|
468
|
+
* Move the node above the provided node in the parent's layout.
|
|
469
|
+
*
|
|
470
|
+
* @remarks
|
|
471
|
+
* The node will be moved above the provided node and from then on will be
|
|
472
|
+
* rendered on top of it. By default, if the node is already positioned
|
|
473
|
+
* higher than the sibling node, it will not get moved.
|
|
474
|
+
*
|
|
475
|
+
* @param node - The sibling node below which to move.
|
|
476
|
+
* @param directlyAbove - Whether the node should be positioned directly above the
|
|
477
|
+
* sibling. When true, will move the node even if it is
|
|
478
|
+
* already positioned above the sibling.
|
|
479
|
+
*/
|
|
480
|
+
moveAbove(node: Node, directlyAbove?: boolean): this;
|
|
481
|
+
/**
|
|
482
|
+
* Change the parent of this node while keeping the absolute transform.
|
|
483
|
+
*
|
|
484
|
+
* @remarks
|
|
485
|
+
* After performing this operation, the node will stay in the same place
|
|
486
|
+
* visually, but its parent will be changed.
|
|
487
|
+
*
|
|
488
|
+
* @param newParent - The new parent of this node.
|
|
489
|
+
*/
|
|
490
|
+
reparent(newParent: Node): void;
|
|
491
|
+
/**
|
|
492
|
+
* Remove all children of this node.
|
|
493
|
+
*/
|
|
494
|
+
removeChildren(): void;
|
|
495
|
+
/**
|
|
496
|
+
* Get the current children of this node.
|
|
497
|
+
*
|
|
498
|
+
* @remarks
|
|
499
|
+
* Unlike {@link children}, this method does not have any side effects.
|
|
500
|
+
* It does not register the `children` signal as a dependency, and it does not
|
|
501
|
+
* spawn any children. It can be used to safely retrieve the current state of
|
|
502
|
+
* the scene graph for debugging purposes.
|
|
503
|
+
*/
|
|
504
|
+
peekChildren(): readonly Node[];
|
|
505
|
+
/**
|
|
506
|
+
* Find all descendants of this node that match the given predicate.
|
|
507
|
+
*
|
|
508
|
+
* @param predicate - A function that returns true if the node matches.
|
|
509
|
+
*/
|
|
510
|
+
findAll<T extends Node>(predicate: (node: any) => node is T): T[];
|
|
511
|
+
/**
|
|
512
|
+
* Find all descendants of this node that match the given predicate.
|
|
513
|
+
*
|
|
514
|
+
* @param predicate - A function that returns true if the node matches.
|
|
515
|
+
*/
|
|
516
|
+
findAll<T extends Node = Node>(predicate: (node: any) => boolean): T[];
|
|
517
|
+
/**
|
|
518
|
+
* Find the first descendant of this node that matches the given predicate.
|
|
519
|
+
*
|
|
520
|
+
* @param predicate - A function that returns true if the node matches.
|
|
521
|
+
*/
|
|
522
|
+
findFirst<T extends Node>(predicate: (node: Node) => node is T): T | null;
|
|
523
|
+
/**
|
|
524
|
+
* Find the first descendant of this node that matches the given predicate.
|
|
525
|
+
*
|
|
526
|
+
* @param predicate - A function that returns true if the node matches.
|
|
527
|
+
*/
|
|
528
|
+
findFirst<T extends Node = Node>(predicate: (node: Node) => boolean): T | null;
|
|
529
|
+
/**
|
|
530
|
+
* Find the last descendant of this node that matches the given predicate.
|
|
531
|
+
*
|
|
532
|
+
* @param predicate - A function that returns true if the node matches.
|
|
533
|
+
*/
|
|
534
|
+
findLast<T extends Node>(predicate: (node: Node) => node is T): T | null;
|
|
535
|
+
/**
|
|
536
|
+
* Find the last descendant of this node that matches the given predicate.
|
|
537
|
+
*
|
|
538
|
+
* @param predicate - A function that returns true if the node matches.
|
|
539
|
+
*/
|
|
540
|
+
findLast<T extends Node = Node>(predicate: (node: Node) => boolean): T | null;
|
|
541
|
+
/**
|
|
542
|
+
* Find the closest ancestor of this node that matches the given predicate.
|
|
543
|
+
*
|
|
544
|
+
* @param predicate - A function that returns true if the node matches.
|
|
545
|
+
*/
|
|
546
|
+
findAncestor<T extends Node>(predicate: (node: Node) => node is T): T | null;
|
|
547
|
+
/**
|
|
548
|
+
* Find the closest ancestor of this node that matches the given predicate.
|
|
549
|
+
*
|
|
550
|
+
* @param predicate - A function that returns true if the node matches.
|
|
551
|
+
*/
|
|
552
|
+
findAncestor<T extends Node = Node>(predicate: (node: Node) => boolean): T | null;
|
|
553
|
+
/**
|
|
554
|
+
* Get the nth children cast to the specified type.
|
|
555
|
+
*
|
|
556
|
+
* @param index - The index of the child to retrieve.
|
|
557
|
+
*/
|
|
558
|
+
childAs<T extends Node = Node>(index: number): T | null;
|
|
559
|
+
/**
|
|
560
|
+
* Get the children array cast to the specified type.
|
|
561
|
+
*/
|
|
562
|
+
childrenAs<T extends Node = Node>(): T[];
|
|
563
|
+
/**
|
|
564
|
+
* Get the parent cast to the specified type.
|
|
565
|
+
*/
|
|
566
|
+
parentAs<T extends Node = Node>(): T | null;
|
|
567
|
+
/**
|
|
568
|
+
* Prepare this node to be disposed of.
|
|
569
|
+
*
|
|
570
|
+
* @remarks
|
|
571
|
+
* This method is called automatically when a scene is refreshed. It will
|
|
572
|
+
* be called even if the node is not currently attached to the tree.
|
|
573
|
+
*
|
|
574
|
+
* The goal of this method is to clean any external references to allow the
|
|
575
|
+
* node to be garbage collected.
|
|
576
|
+
*/
|
|
577
|
+
dispose(): void;
|
|
578
|
+
/**
|
|
579
|
+
* Create a copy of this node.
|
|
580
|
+
*
|
|
581
|
+
* @param customProps - Properties to override.
|
|
582
|
+
*/
|
|
583
|
+
clone(customProps?: NodeState): this;
|
|
584
|
+
/**
|
|
585
|
+
* Create a copy of this node.
|
|
586
|
+
*
|
|
587
|
+
* @remarks
|
|
588
|
+
* Unlike {@link clone}, a snapshot clone calculates any reactive properties
|
|
589
|
+
* at the moment of cloning and passes the raw values to the copy.
|
|
590
|
+
*
|
|
591
|
+
* @param customProps - Properties to override.
|
|
592
|
+
*/
|
|
593
|
+
snapshotClone(customProps?: NodeState): this;
|
|
594
|
+
/**
|
|
595
|
+
* Create a reactive copy of this node.
|
|
596
|
+
*
|
|
597
|
+
* @remarks
|
|
598
|
+
* A reactive copy has all its properties dynamically updated to match the
|
|
599
|
+
* source node.
|
|
600
|
+
*
|
|
601
|
+
* @param customProps - Properties to override.
|
|
602
|
+
*/
|
|
603
|
+
reactiveClone(customProps?: NodeState): this;
|
|
604
|
+
/**
|
|
605
|
+
* Create an instance of this node's class.
|
|
606
|
+
*
|
|
607
|
+
* @param props - Properties to pass to the constructor.
|
|
608
|
+
*/
|
|
609
|
+
instantiate(props?: NodeProps): this;
|
|
610
|
+
/**
|
|
611
|
+
* Set the children without parsing them.
|
|
612
|
+
*
|
|
613
|
+
* @remarks
|
|
614
|
+
* This method assumes that the caller took care of parsing the children and
|
|
615
|
+
* updating the hierarchy.
|
|
616
|
+
*
|
|
617
|
+
* @param value - The children to set.
|
|
618
|
+
*/
|
|
619
|
+
protected setParsedChildren(value: Node[]): void;
|
|
620
|
+
protected spawnChildren(reactive: boolean, children: ComponentChildren): void;
|
|
621
|
+
/**
|
|
622
|
+
* Parse any `ComponentChildren` into an array of nodes.
|
|
623
|
+
*
|
|
624
|
+
* @param children - The children to parse.
|
|
625
|
+
*/
|
|
626
|
+
protected parseChildren(children: ComponentChildren): Node[];
|
|
627
|
+
/**
|
|
628
|
+
* Remove the given child.
|
|
629
|
+
*/
|
|
630
|
+
protected removeChild(child: Node): void;
|
|
631
|
+
/**
|
|
632
|
+
* Whether this node should be cached or not.
|
|
633
|
+
*/
|
|
634
|
+
protected requiresCache(): boolean;
|
|
635
|
+
protected cacheCanvas(): CanvasRenderingContext2D;
|
|
636
|
+
/**
|
|
637
|
+
* Get a cache canvas with the contents of this node rendered onto it.
|
|
638
|
+
*/
|
|
639
|
+
protected cachedCanvas(): Promise<CanvasRenderingContext2D>;
|
|
640
|
+
/**
|
|
641
|
+
* Get a bounding box for the contents rendered by this node.
|
|
642
|
+
*
|
|
643
|
+
* @remarks
|
|
644
|
+
* The returned bounding box should be in local space.
|
|
645
|
+
*/
|
|
646
|
+
protected getCacheBBox(): BBox;
|
|
647
|
+
/**
|
|
648
|
+
* Get a bounding box for the contents rendered by this node as well
|
|
649
|
+
* as its children.
|
|
650
|
+
*/
|
|
651
|
+
cacheBBox(): BBox;
|
|
652
|
+
/**
|
|
653
|
+
* Get a bounding box for the contents rendered by this node (including
|
|
654
|
+
* effects applied after caching).
|
|
655
|
+
*
|
|
656
|
+
* @remarks
|
|
657
|
+
* The returned bounding box should be in local space.
|
|
658
|
+
*/
|
|
659
|
+
protected fullCacheBBox(): BBox;
|
|
660
|
+
/**
|
|
661
|
+
* Get a bounding box in world space for the contents rendered by this node as
|
|
662
|
+
* well as its children.
|
|
663
|
+
*
|
|
664
|
+
* @remarks
|
|
665
|
+
* This is the same the bounding box returned by {@link cacheBBox} only
|
|
666
|
+
* transformed to world space.
|
|
667
|
+
*/
|
|
668
|
+
protected worldSpaceCacheBBox(): BBox;
|
|
669
|
+
protected parentWorldSpaceCacheBBox(): BBox;
|
|
670
|
+
/**
|
|
671
|
+
* Prepare the given context for drawing a cached node onto it.
|
|
672
|
+
*
|
|
673
|
+
* @remarks
|
|
674
|
+
* This method is called before the contents of the cache canvas are drawn
|
|
675
|
+
* on the screen. It can be used to apply effects to the entire node together
|
|
676
|
+
* with its children, instead of applying them individually.
|
|
677
|
+
* Effects such as transparency, shadows, and filters use this technique.
|
|
678
|
+
*
|
|
679
|
+
* Whether the node is cached is decided by the {@link requiresCache} method.
|
|
680
|
+
*
|
|
681
|
+
* @param context - The context using which the cache will be drawn.
|
|
682
|
+
*/
|
|
683
|
+
protected setupDrawFromCache(context: CanvasRenderingContext2D): void;
|
|
684
|
+
protected renderFromSource(context: CanvasRenderingContext2D, source: CanvasImageSource, x: number, y: number): void;
|
|
685
|
+
private shaderCanvas;
|
|
686
|
+
/**
|
|
687
|
+
* Render this node onto the given canvas.
|
|
688
|
+
*
|
|
689
|
+
* @param context - The context to draw with.
|
|
690
|
+
*/
|
|
691
|
+
render(context: CanvasRenderingContext2D): Promise<void>;
|
|
692
|
+
/**
|
|
693
|
+
* Draw this node onto the canvas.
|
|
694
|
+
*
|
|
695
|
+
* @remarks
|
|
696
|
+
* This method is used when drawing directly onto the screen as well as onto
|
|
697
|
+
* the cache canvas.
|
|
698
|
+
* It assumes that the context have already been transformed to local space.
|
|
699
|
+
*
|
|
700
|
+
* @param context - The context to draw with.
|
|
701
|
+
*/
|
|
702
|
+
protected draw(context: CanvasRenderingContext2D): Promise<void>;
|
|
703
|
+
protected drawChildren(context: CanvasRenderingContext2D): Promise<void>;
|
|
704
|
+
/**
|
|
705
|
+
* Draw an overlay for this node.
|
|
706
|
+
*
|
|
707
|
+
* @remarks
|
|
708
|
+
* The overlay for the currently inspected node is displayed on top of the
|
|
709
|
+
* canvas.
|
|
710
|
+
*
|
|
711
|
+
* The provided context is in screen space. The local-to-screen matrix can be
|
|
712
|
+
* used to transform all shapes that need to be displayed.
|
|
713
|
+
* This approach allows to keep the line widths and gizmo sizes consistent,
|
|
714
|
+
* no matter how zoomed-in the view is.
|
|
715
|
+
*
|
|
716
|
+
* @param context - The context to draw with.
|
|
717
|
+
* @param matrix - A local-to-screen matrix.
|
|
718
|
+
*/
|
|
719
|
+
drawOverlay(context: CanvasRenderingContext2D, matrix: DOMMatrix): void;
|
|
720
|
+
protected transformContext(context: CanvasRenderingContext2D): void;
|
|
721
|
+
/**
|
|
722
|
+
* Try to find a node intersecting the given position.
|
|
723
|
+
*
|
|
724
|
+
* @param position - The searched position.
|
|
725
|
+
*/
|
|
726
|
+
hit(position: Vector2): Node | null;
|
|
727
|
+
/**
|
|
728
|
+
* Collect all asynchronous resources used by this node.
|
|
729
|
+
*/
|
|
730
|
+
protected collectAsyncResources(): void;
|
|
731
|
+
/**
|
|
732
|
+
* Wait for any asynchronous resources that this node or its children have.
|
|
733
|
+
*
|
|
734
|
+
* @remarks
|
|
735
|
+
* Certain resources like images are always loaded asynchronously.
|
|
736
|
+
* Awaiting this method makes sure that all such resources are done loading
|
|
737
|
+
* before continuing the animation.
|
|
738
|
+
*/
|
|
739
|
+
toPromise(): Promise<this>;
|
|
740
|
+
/**
|
|
741
|
+
* Return a snapshot of the node's current signal values.
|
|
742
|
+
*
|
|
743
|
+
* @remarks
|
|
744
|
+
* This method will calculate the values of any reactive properties of the
|
|
745
|
+
* node at the time the method is called.
|
|
746
|
+
*/
|
|
747
|
+
getState(): NodeState;
|
|
748
|
+
/**
|
|
749
|
+
* Apply the given state to the node, setting all matching signal values to
|
|
750
|
+
* the provided values.
|
|
751
|
+
*
|
|
752
|
+
* @param state - The state to apply to the node.
|
|
753
|
+
*/
|
|
754
|
+
applyState(state: NodeState): void;
|
|
755
|
+
/**
|
|
756
|
+
* Smoothly transition between the current state of the node and the given
|
|
757
|
+
* state.
|
|
758
|
+
*
|
|
759
|
+
* @param state - The state to transition to.
|
|
760
|
+
* @param duration - The duration of the transition.
|
|
761
|
+
* @param timing - The timing function to use for the transition.
|
|
762
|
+
*/
|
|
763
|
+
applyState(state: NodeState, duration: number, timing?: TimingFunction): ThreadGenerator;
|
|
764
|
+
/**
|
|
765
|
+
* Push a snapshot of the node's current state onto the node's state stack.
|
|
766
|
+
*
|
|
767
|
+
* @remarks
|
|
768
|
+
* This method can be used together with the {@link restore} method to save a
|
|
769
|
+
* node's current state and later restore it. It is possible to store more
|
|
770
|
+
* than one state by calling `save` method multiple times.
|
|
771
|
+
*/
|
|
772
|
+
save(): void;
|
|
773
|
+
/**
|
|
774
|
+
* Restore the node to its last saved state.
|
|
775
|
+
*
|
|
776
|
+
* @remarks
|
|
777
|
+
* This method can be used together with the {@link save} method to restore a
|
|
778
|
+
* node to a previously saved state. Restoring a node to a previous state
|
|
779
|
+
* removes that state from the state stack.
|
|
780
|
+
*
|
|
781
|
+
* @example
|
|
782
|
+
* ```tsx
|
|
783
|
+
* const node = <Circle width={100} height={100} fill={"lightseagreen"} />
|
|
784
|
+
*
|
|
785
|
+
* view.add(node);
|
|
786
|
+
*
|
|
787
|
+
* // Save the node's current state
|
|
788
|
+
* node.save();
|
|
789
|
+
*
|
|
790
|
+
* // Modify some of the node's properties
|
|
791
|
+
* yield* node.scale(2, 1);
|
|
792
|
+
* yield* node.fill('hotpink', 1);
|
|
793
|
+
*
|
|
794
|
+
* // Restore the node to its saved state
|
|
795
|
+
* node.restore();
|
|
796
|
+
* ```
|
|
797
|
+
*/
|
|
798
|
+
restore(): void;
|
|
799
|
+
/**
|
|
800
|
+
* Tween the node to its last saved state.
|
|
801
|
+
*
|
|
802
|
+
* @remarks
|
|
803
|
+
* This method can be used together with the {@link save} method to restore a
|
|
804
|
+
* node to a previously saved state. Restoring a node to a previous state
|
|
805
|
+
* removes that state from the state stack.
|
|
806
|
+
*
|
|
807
|
+
* @example
|
|
808
|
+
* ```tsx
|
|
809
|
+
* const node = <Circle width={100} height={100} fill={"lightseagreen"} />
|
|
810
|
+
*
|
|
811
|
+
* view.add(node);
|
|
812
|
+
*
|
|
813
|
+
* // Save the node's current state
|
|
814
|
+
* node.save();
|
|
815
|
+
*
|
|
816
|
+
* // Modify some of the node's properties
|
|
817
|
+
* yield* node.scale(2, 1);
|
|
818
|
+
* yield* node.fill('hotpink', 1);
|
|
819
|
+
*
|
|
820
|
+
* // Tween the node to its saved state over 1 second
|
|
821
|
+
* yield* node.restore(1);
|
|
822
|
+
* ```
|
|
823
|
+
*
|
|
824
|
+
* @param duration - The duration of the transition.
|
|
825
|
+
* @param timing - The timing function to use for the transition.
|
|
826
|
+
*/
|
|
827
|
+
restore(duration: number, timing?: TimingFunction): ThreadGenerator;
|
|
828
|
+
[Symbol.iterator](): Generator<{
|
|
829
|
+
meta: import("../decorators").PropertyMetadata<any>;
|
|
830
|
+
signal: SimpleSignal<any>;
|
|
831
|
+
key: string;
|
|
832
|
+
}, void, unknown>;
|
|
833
|
+
private signalByKey;
|
|
834
|
+
private reversedChildren;
|
|
835
|
+
}
|
|
836
|
+
//# sourceMappingURL=Node.d.ts.map
|