@revideo/2d 0.4.7-two.1024 → 0.4.8-alpha.1032
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/editor/editor/tsconfig.build.tsbuildinfo +1 -1
- package/editor/index.js +151 -380
- package/editor/index.js.map +1 -1
- package/lib/code/CodeCursor.d.ts +74 -74
- package/lib/code/CodeDiffer.d.ts +16 -21
- package/lib/code/CodeDiffer.js +41 -39
- package/lib/code/CodeFragment.d.ts +8 -16
- package/lib/code/CodeFragment.js +36 -36
- package/lib/code/CodeHighlighter.d.ts +59 -59
- package/lib/code/CodeHighlighter.js +1 -1
- package/lib/code/CodeMetrics.d.ts +8 -12
- package/lib/code/CodeMetrics.js +24 -26
- package/lib/code/CodeRange.d.ts +5 -21
- package/lib/code/CodeRange.js +124 -131
- package/lib/code/CodeScope.d.ts +8 -18
- package/lib/code/CodeSelection.d.ts +4 -9
- package/lib/code/CodeSelection.js +8 -8
- package/lib/code/CodeSignal.d.ts +47 -74
- package/lib/code/CodeTokenizer.d.ts +1 -1
- package/lib/code/CodeTokenizer.js +41 -41
- package/lib/code/DefaultHighlightStyle.d.ts +2 -2
- package/lib/code/DefaultHighlightStyle.js +96 -96
- package/lib/code/LezerHighlighter.d.ts +19 -21
- package/lib/code/diff.d.ts +9 -12
- package/lib/code/diff.js +205 -218
- package/lib/code/extractRange.d.ts +4 -7
- package/lib/code/extractRange.js +71 -79
- package/lib/code/index.d.ts +1 -1
- package/lib/code/index.js +1 -1
- package/lib/components/Audio.d.ts +11 -11
- package/lib/components/Bezier.d.ts +18 -18
- package/lib/components/Circle.d.ts +90 -95
- package/lib/components/Code.d.ts +211 -244
- package/lib/components/CodeBlock.d.ts +1 -1
- package/lib/components/CubicBezier.d.ts +36 -36
- package/lib/components/Curve.d.ts +198 -208
- package/lib/components/Grid.d.ts +42 -47
- package/lib/components/Icon.d.ts +50 -55
- package/lib/components/Img.d.ts +79 -86
- package/lib/components/Knot.d.ts +78 -97
- package/lib/components/Latex.d.ts +12 -12
- package/lib/components/Layout.d.ts +413 -455
- package/lib/components/Line.d.ts +49 -61
- package/lib/components/Media.d.ts +37 -37
- package/lib/components/Node.d.ts +1 -1
- package/lib/components/Path.d.ts +1 -1
- package/lib/components/Polygon.d.ts +55 -60
- package/lib/components/QuadBezier.d.ts +29 -29
- package/lib/components/Ray.d.ts +28 -28
- package/lib/components/Rect.d.ts +108 -115
- package/lib/components/SVG.d.ts +1 -1
- package/lib/components/Shape.d.ts +1 -1
- package/lib/components/Spline.d.ts +40 -46
- package/lib/components/Txt.d.ts +44 -55
- package/lib/components/TxtLeaf.d.ts +16 -20
- package/lib/components/Video.d.ts +1 -0
- package/lib/components/Video.d.ts.map +1 -1
- package/lib/components/Video.js +9 -3
- package/lib/components/View2D.d.ts +22 -22
- package/lib/components/index.d.ts +2 -1
- package/lib/components/index.d.ts.map +1 -1
- package/lib/components/index.js +2 -1
- package/lib/components/types.d.ts +9 -22
- package/lib/curves/ArcSegment.d.ts +24 -36
- package/lib/curves/CircleSegment.d.ts +16 -26
- package/lib/curves/CubicBezierSegment.d.ts +13 -18
- package/lib/curves/CurveDrawingInfo.d.ts +9 -9
- package/lib/curves/CurvePoint.d.ts +13 -13
- package/lib/curves/CurveProfile.d.ts +5 -5
- package/lib/curves/CurveProfile.js +1 -1
- package/lib/curves/KnotInfo.d.ts +8 -8
- package/lib/curves/LineSegment.d.ts +14 -19
- package/lib/curves/Polynomial.d.ts +110 -110
- package/lib/curves/Polynomial2D.d.ts +20 -20
- package/lib/curves/PolynomialSegment.d.ts +37 -42
- package/lib/curves/QuadBezierSegment.d.ts +12 -12
- package/lib/curves/Segment.d.ts +7 -12
- package/lib/curves/UniformPolynomialCurveSampler.d.ts +34 -34
- package/lib/curves/createCurveProfileLerp.d.ts +6 -17
- package/lib/curves/getBezierSplineProfile.d.ts +4 -8
- package/lib/curves/getCircleProfile.d.ts +4 -10
- package/lib/curves/getPathProfile.d.ts +2 -2
- package/lib/curves/getPointAtDistance.d.ts +4 -7
- package/lib/curves/getPolylineProfile.d.ts +4 -8
- package/lib/curves/getRectProfile.d.ts +4 -9
- package/lib/curves/index.d.ts +1 -1
- package/lib/curves/index.js +1 -1
- package/lib/decorators/canvasStyleSignal.d.ts +3 -3
- package/lib/decorators/colorSignal.d.ts +1 -1
- package/lib/decorators/compound.d.ts +2 -4
- package/lib/decorators/computed.d.ts +1 -1
- package/lib/decorators/defaultStyle.d.ts +2 -5
- package/lib/decorators/filtersSignal.d.ts +8 -28
- package/lib/decorators/index.d.ts +1 -1
- package/lib/decorators/index.js +1 -1
- package/lib/decorators/initializers.d.ts +2 -5
- package/lib/decorators/initializers.js +19 -18
- package/lib/decorators/nodeName.d.ts +1 -1
- package/lib/decorators/nodeName.js +4 -4
- package/lib/decorators/signal.d.ts +20 -40
- package/lib/decorators/spacingSignal.d.ts +1 -1
- package/lib/decorators/vector2Signal.d.ts +7 -13
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/jsx-dev-runtime.d.ts +3 -3
- package/lib/jsx-dev-runtime.js +3 -3
- package/lib/jsx-runtime.d.ts +9 -19
- package/lib/jsx-runtime.js +18 -18
- package/lib/partials/Filter.d.ts +16 -24
- package/lib/partials/Gradient.d.ts +24 -30
- package/lib/partials/Pattern.d.ts +9 -14
- package/lib/partials/ShaderConfig.d.ts +74 -81
- package/lib/partials/index.d.ts +1 -1
- package/lib/partials/index.js +1 -1
- package/lib/partials/types.d.ts +6 -19
- package/lib/scenes/Scene2D.d.ts +24 -42
- package/lib/scenes/Scene2D.d.ts.map +1 -1
- package/lib/scenes/Scene2D.js +10 -2
- package/lib/scenes/index.d.ts +1 -1
- package/lib/scenes/index.js +1 -1
- package/lib/scenes/makeScene2D.d.ts +5 -7
- package/lib/scenes/useScene2D.d.ts +2 -2
- package/lib/tsconfig.build.tsbuildinfo +1 -1
- package/lib/utils/diff.d.ts +18 -25
- package/lib/utils/diff.js +87 -84
- package/lib/utils/index.d.ts +1 -1
- package/lib/utils/index.js +1 -1
- package/lib/utils/is.d.ts +2 -4
- package/lib/utils/is.js +2 -2
- package/lib/utils/makeSignalExtensions.d.ts +4 -11
- package/lib/utils/video/mp4-parser-manager.d.ts +1 -0
- package/lib/utils/video/mp4-parser-manager.d.ts.map +1 -1
- package/lib/utils/video/mp4-parser-manager.js +21 -4
- 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 +44 -0
- package/lib/utils/video/parser/segment.d.ts.map +1 -0
- package/lib/utils/video/parser/segment.js +195 -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 +4 -4
- package/src/lib/components/Video.ts +9 -2
- package/src/lib/components/index.ts +1 -0
- package/src/lib/scenes/Scene2D.ts +11 -1
- package/src/lib/utils/video/mp4-parser-manager.ts +24 -5
- package/src/lib/utils/video/parser/index.ts +1 -0
- package/src/lib/utils/video/parser/parser.ts +256 -0
- package/src/lib/utils/video/parser/sampler.ts +72 -0
- package/src/lib/utils/video/parser/segment.ts +252 -0
- package/src/lib/utils/video/parser/sink.ts +29 -0
- package/src/lib/utils/video/parser/utils.ts +31 -0
- package/lib/components/HlsVideo.d.ts +0 -62
- package/lib/components/HlsVideo.d.ts.map +0 -1
- package/lib/components/HlsVideo.js +0 -169
- package/lib/tsconfig.tsbuildinfo +0 -1
- package/lib/utils/video/mp4-parser.d.ts +0 -63
- package/lib/utils/video/mp4-parser.d.ts.map +0 -1
- package/lib/utils/video/mp4-parser.js +0 -264
- package/src/lib/utils/video/mp4-parser.ts +0 -340
package/lib/components/Code.d.ts
CHANGED
|
@@ -1,77 +1,52 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
SignalValue,
|
|
6
|
-
SimpleSignal,
|
|
7
|
-
ThreadGenerator,
|
|
8
|
-
TimingFunction,
|
|
9
|
-
Vector2,
|
|
10
|
-
} from '@revideo/core';
|
|
11
|
-
import {
|
|
12
|
-
CodeFragmentDrawingInfo,
|
|
13
|
-
CodeHighlighter,
|
|
14
|
-
CodePoint,
|
|
15
|
-
CodeRange,
|
|
16
|
-
CodeSelection,
|
|
17
|
-
CodeSignal,
|
|
18
|
-
LezerHighlighter,
|
|
19
|
-
PossibleCodeScope,
|
|
20
|
-
PossibleCodeSelection,
|
|
21
|
-
} from '../code';
|
|
22
|
-
import {DesiredLength} from '../partials';
|
|
23
|
-
import {Shape, ShapeProps} from './Shape';
|
|
1
|
+
import { BBox, SerializedVector2, Signal, SignalValue, SimpleSignal, ThreadGenerator, TimingFunction, Vector2 } from '@revideo/core';
|
|
2
|
+
import { CodeFragmentDrawingInfo, CodeHighlighter, CodePoint, CodeRange, CodeSelection, CodeSignal, LezerHighlighter, PossibleCodeScope, PossibleCodeSelection } from '../code';
|
|
3
|
+
import { DesiredLength } from '../partials';
|
|
4
|
+
import { Shape, ShapeProps } from './Shape';
|
|
24
5
|
export interface DrawTokenHook {
|
|
25
|
-
|
|
26
|
-
ctx: CanvasRenderingContext2D,
|
|
27
|
-
text: string,
|
|
28
|
-
position: Vector2,
|
|
29
|
-
color: string,
|
|
30
|
-
selection: number,
|
|
31
|
-
): void;
|
|
6
|
+
(ctx: CanvasRenderingContext2D, text: string, position: Vector2, color: string, selection: number): void;
|
|
32
7
|
}
|
|
33
8
|
/**
|
|
34
9
|
* Describes custom drawing logic used by the Code node.
|
|
35
10
|
*/
|
|
36
11
|
export interface DrawHooks {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Custom drawing logic for individual code tokens.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* token(ctx, text, position, color, selection) {
|
|
18
|
+
* const blur = map(3, 0, selection);
|
|
19
|
+
* const alpha = map(0.5, 1, selection);
|
|
20
|
+
* ctx.globalAlpha *= alpha;
|
|
21
|
+
* ctx.filter = `blur(${blur}px)`;
|
|
22
|
+
* ctx.fillStyle = color;
|
|
23
|
+
* ctx.fillText(text, position.x, position.y);
|
|
24
|
+
* }
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
token: DrawTokenHook;
|
|
53
28
|
}
|
|
54
29
|
export interface CodeProps extends ShapeProps {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
30
|
+
/**
|
|
31
|
+
* {@inheritDoc Code.highlighter}
|
|
32
|
+
*/
|
|
33
|
+
highlighter?: SignalValue<CodeHighlighter | null>;
|
|
34
|
+
/**
|
|
35
|
+
* {@inheritDoc Code.dialect}
|
|
36
|
+
*/
|
|
37
|
+
dialect?: SignalValue<string>;
|
|
38
|
+
/**
|
|
39
|
+
* {@inheritDoc Code.code}
|
|
40
|
+
*/
|
|
41
|
+
code?: SignalValue<PossibleCodeScope>;
|
|
42
|
+
/**
|
|
43
|
+
* {@inheritDoc Code.selection}
|
|
44
|
+
*/
|
|
45
|
+
selection?: SignalValue<PossibleCodeSelection>;
|
|
46
|
+
/**
|
|
47
|
+
* {@inheritDoc Code.drawHooks}
|
|
48
|
+
*/
|
|
49
|
+
drawHooks?: SignalValue<DrawHooks>;
|
|
75
50
|
}
|
|
76
51
|
/**
|
|
77
52
|
* A node for displaying and animating code.
|
|
@@ -117,182 +92,174 @@ export interface CodeProps extends ShapeProps {
|
|
|
117
92
|
* ```
|
|
118
93
|
*/
|
|
119
94
|
export declare class Code extends Shape {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
fragments: CodeFragmentDrawingInfo[];
|
|
290
|
-
verticalOffset: number;
|
|
291
|
-
fontHeight: number;
|
|
292
|
-
};
|
|
293
|
-
protected desiredSize(): SerializedVector2<DesiredLength>;
|
|
294
|
-
protected draw(context: CanvasRenderingContext2D): Promise<void>;
|
|
295
|
-
protected applyText(context: CanvasRenderingContext2D): void;
|
|
296
|
-
protected collectAsyncResources(): void;
|
|
95
|
+
/**
|
|
96
|
+
* Create a standalone code signal.
|
|
97
|
+
*
|
|
98
|
+
* @param initial - The initial code.
|
|
99
|
+
* @param highlighter - Custom highlighter to use.
|
|
100
|
+
* @param dialect - Custom dialect to use.
|
|
101
|
+
*/
|
|
102
|
+
static createSignal(initial: PossibleCodeScope, highlighter?: SignalValue<CodeHighlighter>, dialect?: SignalValue<string>): CodeSignal<void>;
|
|
103
|
+
static readonly defaultHighlighter: LezerHighlighter;
|
|
104
|
+
/**
|
|
105
|
+
* The dialect to use for highlighting the code.
|
|
106
|
+
*
|
|
107
|
+
* @remarks
|
|
108
|
+
* This value will be passed to the {@link code.CodeHighlighter}
|
|
109
|
+
* defined by the {@link highlighter} property. Different highlighters may use
|
|
110
|
+
* it differently.
|
|
111
|
+
*
|
|
112
|
+
* The default {@link code.LezerHighlighter} uses it to select
|
|
113
|
+
* the language parser to use. The parser for the given dialect can be
|
|
114
|
+
* registered as follows:
|
|
115
|
+
* ```tsx
|
|
116
|
+
* // Import the lezer parser:
|
|
117
|
+
* import {parser} from '@lezer/javascript';
|
|
118
|
+
*
|
|
119
|
+
* // Register it in the highlighter:
|
|
120
|
+
* LezerHighlighter.registerParser(parser, 'js');
|
|
121
|
+
*
|
|
122
|
+
* // Use the dialect in a code node:
|
|
123
|
+
* <Code dialect="js" code="const a = 7;" />
|
|
124
|
+
* ```
|
|
125
|
+
* When no dialect is provided, the highlighter will use the default
|
|
126
|
+
* parser:
|
|
127
|
+
* ```tsx
|
|
128
|
+
* // Register the default parser by omitting the dialect:
|
|
129
|
+
* LezerHighlighter.registerParser(parser);
|
|
130
|
+
*
|
|
131
|
+
* // Code nodes with no dialect will now use the default parser:
|
|
132
|
+
* <Code code="const a = 7;" />
|
|
133
|
+
* ```
|
|
134
|
+
*/
|
|
135
|
+
readonly dialect: SimpleSignal<string, this>;
|
|
136
|
+
/**
|
|
137
|
+
* The code highlighter to use for this code node.
|
|
138
|
+
*
|
|
139
|
+
* @remarks
|
|
140
|
+
* Defaults to a shared {@link code.LezerHighlighter}.
|
|
141
|
+
*/
|
|
142
|
+
readonly highlighter: SimpleSignal<CodeHighlighter, this>;
|
|
143
|
+
/**
|
|
144
|
+
* The code to display.
|
|
145
|
+
*/
|
|
146
|
+
readonly code: CodeSignal<this>;
|
|
147
|
+
/**
|
|
148
|
+
* Custom drawing logic for the code.
|
|
149
|
+
*
|
|
150
|
+
* @remarks
|
|
151
|
+
* Check out {@link DrawHooks} for available render hooks.
|
|
152
|
+
*
|
|
153
|
+
* @example
|
|
154
|
+
* Make the unselected code blurry and transparent:
|
|
155
|
+
* ```tsx
|
|
156
|
+
* <Code
|
|
157
|
+
* drawHooks={{
|
|
158
|
+
* token(ctx, text, position, color, selection) {
|
|
159
|
+
* const blur = map(3, 0, selection);
|
|
160
|
+
* const alpha = map(0.5, 1, selection);
|
|
161
|
+
* ctx.globalAlpha *= alpha;
|
|
162
|
+
* ctx.filter = `blur(${blur}px)`;
|
|
163
|
+
* ctx.fillStyle = color;
|
|
164
|
+
* ctx.fillText(text, position.x, position.y);
|
|
165
|
+
* },
|
|
166
|
+
* }}
|
|
167
|
+
* // ...
|
|
168
|
+
* />
|
|
169
|
+
* ```
|
|
170
|
+
*/
|
|
171
|
+
readonly drawHooks: SimpleSignal<DrawHooks, this>;
|
|
172
|
+
/**
|
|
173
|
+
* The currently selected code range.
|
|
174
|
+
*
|
|
175
|
+
* @remarks
|
|
176
|
+
* Either a single {@link code.CodeRange} or an array of them
|
|
177
|
+
* describing which parts of the code should be visually emphasized.
|
|
178
|
+
*
|
|
179
|
+
* You can use {@link code.word} and
|
|
180
|
+
* {@link code.lines} to quickly create ranges.
|
|
181
|
+
*
|
|
182
|
+
* @example
|
|
183
|
+
* The following will select the word "console" in the code.
|
|
184
|
+
* Both lines and columns are 0-based. So it will select a 7-character-long
|
|
185
|
+
* (`7`) word in the second line (`1`) starting at the third character (`2`).
|
|
186
|
+
* ```tsx
|
|
187
|
+
* <Code
|
|
188
|
+
* selection={word(1, 2, 7)}
|
|
189
|
+
* code={`\
|
|
190
|
+
* function hello() => {
|
|
191
|
+
* console.log('Hello');
|
|
192
|
+
* }`}
|
|
193
|
+
* // ...
|
|
194
|
+
* />
|
|
195
|
+
* ```
|
|
196
|
+
*/
|
|
197
|
+
readonly selection: Signal<PossibleCodeSelection, CodeSelection, this>;
|
|
198
|
+
oldSelection: CodeSelection | null;
|
|
199
|
+
selectionProgress: SimpleSignal<number | null, void>;
|
|
200
|
+
protected tweenSelection(value: CodeRange[], duration: number, timingFunction: TimingFunction): ThreadGenerator;
|
|
201
|
+
/**
|
|
202
|
+
* Get the currently displayed code as a string.
|
|
203
|
+
*/
|
|
204
|
+
parsed(): string;
|
|
205
|
+
highlighterCache(): {
|
|
206
|
+
before: unknown;
|
|
207
|
+
after: unknown;
|
|
208
|
+
} | null;
|
|
209
|
+
private cursorCache;
|
|
210
|
+
private get cursor();
|
|
211
|
+
constructor(props: CodeProps);
|
|
212
|
+
/**
|
|
213
|
+
* Create a child code signal.
|
|
214
|
+
*
|
|
215
|
+
* @param initial - The initial code.
|
|
216
|
+
*/
|
|
217
|
+
createSignal(initial: PossibleCodeScope): CodeSignal<this>;
|
|
218
|
+
/**
|
|
219
|
+
* Find all code ranges that match the given pattern.
|
|
220
|
+
*
|
|
221
|
+
* @param pattern - Either a string or a regular expression to match.
|
|
222
|
+
*/
|
|
223
|
+
findAllRanges(pattern: string | RegExp): CodeRange[];
|
|
224
|
+
/**
|
|
225
|
+
* Find the first code range that matches the given pattern.
|
|
226
|
+
*
|
|
227
|
+
* @param pattern - Either a string or a regular expression to match.
|
|
228
|
+
*/
|
|
229
|
+
findFirstRange(pattern: string | RegExp): CodeRange;
|
|
230
|
+
/**
|
|
231
|
+
* Find the last code range that matches the given pattern.
|
|
232
|
+
*
|
|
233
|
+
* @param pattern - Either a string or a regular expression to match.
|
|
234
|
+
*/
|
|
235
|
+
findLastRange(pattern: string | RegExp): CodeRange;
|
|
236
|
+
/**
|
|
237
|
+
* Return the bounding box of the given point (character) in the code.
|
|
238
|
+
*
|
|
239
|
+
* @remarks
|
|
240
|
+
* The returned bound box is in local space of the `Code` node.
|
|
241
|
+
*
|
|
242
|
+
* @param point - The point to get the bounding box for.
|
|
243
|
+
*/
|
|
244
|
+
getPointBbox(point: CodePoint): BBox;
|
|
245
|
+
/**
|
|
246
|
+
* Return bounding boxes of all characters in the selection.
|
|
247
|
+
*
|
|
248
|
+
* @remarks
|
|
249
|
+
* The returned bound boxes are in local space of the `Code` node.
|
|
250
|
+
* Each line of code has a separate bounding box.
|
|
251
|
+
*
|
|
252
|
+
* @param selection - The selection to get the bounding boxes for.
|
|
253
|
+
*/
|
|
254
|
+
getSelectionBbox(selection: PossibleCodeSelection): BBox[];
|
|
255
|
+
protected drawingInfo(): {
|
|
256
|
+
fragments: CodeFragmentDrawingInfo[];
|
|
257
|
+
verticalOffset: number;
|
|
258
|
+
fontHeight: number;
|
|
259
|
+
};
|
|
260
|
+
protected desiredSize(): SerializedVector2<DesiredLength>;
|
|
261
|
+
protected draw(context: CanvasRenderingContext2D): Promise<void>;
|
|
262
|
+
protected applyText(context: CanvasRenderingContext2D): void;
|
|
263
|
+
protected collectAsyncResources(): void;
|
|
297
264
|
}
|
|
298
|
-
//# sourceMappingURL=Code.d.ts.map
|
|
265
|
+
//# sourceMappingURL=Code.d.ts.map
|
|
@@ -65,7 +65,7 @@ export declare class CodeBlock extends Shape {
|
|
|
65
65
|
* it instead.
|
|
66
66
|
*/
|
|
67
67
|
edit(duration?: number, changeSelection?: CodeRange[] | boolean): (strings: TemplateStringsArray, ...rest: (Code | CodeModification)[]) => ThreadGenerator;
|
|
68
|
-
tweenCode(code: CodeTree, time: number, timingFunction: TimingFunction): Generator<void | Promise<any> |
|
|
68
|
+
tweenCode(code: CodeTree, time: number, timingFunction: TimingFunction): Generator<void | ThreadGenerator | Promise<any> | import("@revideo/core").Promisable<any>, void, any>;
|
|
69
69
|
protected draw(context: CanvasRenderingContext2D): Promise<void>;
|
|
70
70
|
protected selectionStrength(x: number, y: number): number;
|
|
71
71
|
protected static selectionStrength(selection: CodeRange[], x: number, y: number): number;
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import {PossibleVector2, SignalValue, Vector2Signal} from '@revideo/core';
|
|
2
|
-
import {PolynomialSegment} from '../curves/PolynomialSegment';
|
|
3
|
-
import {Bezier, BezierOverlayInfo} from './Bezier';
|
|
4
|
-
import {CurveProps} from './Curve';
|
|
1
|
+
import { PossibleVector2, SignalValue, Vector2Signal } from '@revideo/core';
|
|
2
|
+
import { PolynomialSegment } from '../curves/PolynomialSegment';
|
|
3
|
+
import { Bezier, BezierOverlayInfo } from './Bezier';
|
|
4
|
+
import { CurveProps } from './Curve';
|
|
5
5
|
export interface CubicBezierProps extends CurveProps {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
6
|
+
p0?: SignalValue<PossibleVector2>;
|
|
7
|
+
p0X?: SignalValue<number>;
|
|
8
|
+
p0Y?: SignalValue<number>;
|
|
9
|
+
p1?: SignalValue<PossibleVector2>;
|
|
10
|
+
p1X?: SignalValue<number>;
|
|
11
|
+
p1Y?: SignalValue<number>;
|
|
12
|
+
p2?: SignalValue<PossibleVector2>;
|
|
13
|
+
p2X?: SignalValue<number>;
|
|
14
|
+
p2Y?: SignalValue<number>;
|
|
15
|
+
p3?: SignalValue<PossibleVector2>;
|
|
16
|
+
p3X?: SignalValue<number>;
|
|
17
|
+
p3Y?: SignalValue<number>;
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
20
|
* A node for drawing a cubic Bézier curve.
|
|
@@ -46,24 +46,24 @@ export interface CubicBezierProps extends CurveProps {
|
|
|
46
46
|
* ```
|
|
47
47
|
*/
|
|
48
48
|
export declare class CubicBezier extends Bezier {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
49
|
+
/**
|
|
50
|
+
* The start point of the Bézier curve.
|
|
51
|
+
*/
|
|
52
|
+
readonly p0: Vector2Signal<this>;
|
|
53
|
+
/**
|
|
54
|
+
* The first control point of the Bézier curve.
|
|
55
|
+
*/
|
|
56
|
+
readonly p1: Vector2Signal<this>;
|
|
57
|
+
/**
|
|
58
|
+
* The second control point of the Bézier curve.
|
|
59
|
+
*/
|
|
60
|
+
readonly p2: Vector2Signal<this>;
|
|
61
|
+
/**
|
|
62
|
+
* The end point of the Bézier curve.
|
|
63
|
+
*/
|
|
64
|
+
readonly p3: Vector2Signal<this>;
|
|
65
|
+
constructor(props: CubicBezierProps);
|
|
66
|
+
protected segment(): PolynomialSegment;
|
|
67
|
+
protected overlayInfo(matrix: DOMMatrix): BezierOverlayInfo;
|
|
68
68
|
}
|
|
69
|
-
//# sourceMappingURL=CubicBezier.d.ts.map
|
|
69
|
+
//# sourceMappingURL=CubicBezier.d.ts.map
|