@remotion/shapes 4.0.478 → 4.0.481

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.
@@ -58,8 +58,9 @@ const ArrowInner = ({ length, headWidth, headLength, shaftWidth, direction, corn
58
58
  cornerRadius,
59
59
  }), ...props }));
60
60
  };
61
- exports.Arrow = remotion_1.Internals.wrapInSchema({
61
+ exports.Arrow = remotion_1.Interactive.withSchema({
62
62
  Component: ArrowInner,
63
+ componentName: '<Arrow>',
63
64
  componentIdentity: 'dev.remotion.shapes.Arrow',
64
65
  schema: arrowSchema,
65
66
  supportsEffects: true,
@@ -69,8 +69,9 @@ const CalloutInner = ({ width, height, pointerLength, pointerBaseWidth, pointerP
69
69
  cornerRadius,
70
70
  }), ...props }));
71
71
  };
72
- exports.Callout = remotion_1.Internals.wrapInSchema({
72
+ exports.Callout = remotion_1.Interactive.withSchema({
73
73
  Component: CalloutInner,
74
+ componentName: '<Callout>',
74
75
  componentIdentity: 'dev.remotion.shapes.Callout',
75
76
  schema: calloutSchema,
76
77
  supportsEffects: true,
@@ -21,8 +21,9 @@ const circleSchema = (0, schema_1.makeShapeSchema)({
21
21
  const CircleInner = ({ radius, ...props }) => {
22
22
  return (jsx_runtime_1.jsx(render_svg_1.RenderSvg, { defaultName: "<Circle>", documentationLink: "https://www.remotion.dev/docs/shapes/circle", ...(0, make_circle_1.makeCircle)({ radius }), ...props }));
23
23
  };
24
- exports.Circle = remotion_1.Internals.wrapInSchema({
24
+ exports.Circle = remotion_1.Interactive.withSchema({
25
25
  Component: CircleInner,
26
+ componentName: '<Circle>',
26
27
  componentIdentity: 'dev.remotion.shapes.Circle',
27
28
  schema: circleSchema,
28
29
  supportsEffects: true,
@@ -27,8 +27,9 @@ const ellipseSchema = (0, schema_1.makeShapeSchema)({
27
27
  const EllipseInner = ({ rx, ry, ...props }) => {
28
28
  return (jsx_runtime_1.jsx(render_svg_1.RenderSvg, { defaultName: "<Ellipse>", documentationLink: "https://www.remotion.dev/docs/shapes/ellipse", ...(0, make_ellipse_1.makeEllipse)({ rx, ry }), ...props }));
29
29
  };
30
- exports.Ellipse = remotion_1.Internals.wrapInSchema({
30
+ exports.Ellipse = remotion_1.Interactive.withSchema({
31
31
  Component: EllipseInner,
32
+ componentName: '<Ellipse>',
32
33
  componentIdentity: 'dev.remotion.shapes.Ellipse',
33
34
  schema: ellipseSchema,
34
35
  supportsEffects: true,
@@ -42,8 +42,9 @@ const HeartInner = ({ aspectRatio, height, bottomRoundnessAdjustment = 0, depthA
42
42
  depthAdjustment,
43
43
  }), ...props }));
44
44
  };
45
- exports.Heart = remotion_1.Internals.wrapInSchema({
45
+ exports.Heart = remotion_1.Interactive.withSchema({
46
46
  Component: HeartInner,
47
+ componentName: '<Heart>',
47
48
  componentIdentity: 'dev.remotion.shapes.Heart',
48
49
  schema: heartSchema,
49
50
  supportsEffects: true,
@@ -45,8 +45,9 @@ const pieSchema = (0, schema_1.makeShapeSchema)({
45
45
  const PieInner = ({ radius, progress, closePath, counterClockwise, rotation, ...props }) => {
46
46
  return (jsx_runtime_1.jsx(render_svg_1.RenderSvg, { defaultName: "<Pie>", documentationLink: "https://www.remotion.dev/docs/shapes/pie", ...(0, make_pie_1.makePie)({ radius, progress, closePath, counterClockwise, rotation }), ...props }));
47
47
  };
48
- exports.Pie = remotion_1.Internals.wrapInSchema({
48
+ exports.Pie = remotion_1.Interactive.withSchema({
49
49
  Component: PieInner,
50
+ componentName: '<Pie>',
50
51
  componentIdentity: 'dev.remotion.shapes.Pie',
51
52
  schema: pieSchema,
52
53
  supportsEffects: true,
@@ -32,8 +32,9 @@ const PolygonInner = ({ points, radius, cornerRadius, edgeRoundness, ...props })
32
32
  radius,
33
33
  }), ...props }));
34
34
  };
35
- exports.Polygon = remotion_1.Internals.wrapInSchema({
35
+ exports.Polygon = remotion_1.Interactive.withSchema({
36
36
  Component: PolygonInner,
37
+ componentName: '<Polygon>',
37
38
  componentIdentity: 'dev.remotion.shapes.Polygon',
38
39
  schema: polygonSchema,
39
40
  supportsEffects: true,
@@ -34,8 +34,9 @@ const rectSchema = (0, schema_1.makeShapeSchema)({
34
34
  const RectInner = ({ width, edgeRoundness, height, cornerRadius, ...props }) => {
35
35
  return (jsx_runtime_1.jsx(render_svg_1.RenderSvg, { defaultName: "<Rect>", documentationLink: "https://www.remotion.dev/docs/shapes/rect", ...(0, make_rect_1.makeRect)({ height, width, edgeRoundness, cornerRadius }), ...props }));
36
36
  };
37
- exports.Rect = remotion_1.Internals.wrapInSchema({
37
+ exports.Rect = remotion_1.Interactive.withSchema({
38
38
  Component: RectInner,
39
+ componentName: '<Rect>',
39
40
  componentIdentity: 'dev.remotion.shapes.Rect',
40
41
  schema: rectSchema,
41
42
  supportsEffects: true,
@@ -1,8 +1,8 @@
1
1
  import type { Instruction } from '@remotion/paths';
2
2
  import React from 'react';
3
- import { type EffectsProp, type HtmlInCanvasPixelDensity, type SequenceControls, type SequenceProps } from 'remotion';
4
- type ShapeSequenceProps = Pick<SequenceProps, 'durationInFrames' | 'from' | 'freeze' | 'hidden' | 'name' | 'showInTimeline'> & {
5
- readonly _experimentalControls?: SequenceControls;
3
+ import { type EffectsProp, type HtmlInCanvasPixelDensity, type InteractiveBaseProps, type SequenceControls } from 'remotion';
4
+ type ShapeSequenceProps = InteractiveBaseProps & {
5
+ readonly controls?: SequenceControls;
6
6
  };
7
7
  export type AllShapesProps = Omit<React.SVGProps<SVGPathElement>, 'width' | 'height' | 'd' | 'hidden' | 'name'> & ShapeSequenceProps & {
8
8
  readonly debug?: boolean;
@@ -14,7 +14,7 @@ export type AllShapesProps = Omit<React.SVGProps<SVGPathElement>, 'width' | 'hei
14
14
  */
15
15
  readonly stack?: string;
16
16
  };
17
- export declare const RenderSvg: ({ defaultName, documentationLink, width, height, path, style, pathStyle, transformOrigin, debug, effects, instructions, pixelDensity, durationInFrames, from, freeze, hidden, name, showInTimeline, _experimentalControls: controls, stack, ...props }: {
17
+ export declare const RenderSvg: ({ defaultName, documentationLink, width, height, path, style, pathStyle, transformOrigin, debug, effects, instructions, pixelDensity, durationInFrames, from, freeze, hidden, name, showInTimeline, controls, stack, ...props }: {
18
18
  readonly defaultName: string;
19
19
  readonly documentationLink: string;
20
20
  readonly width: number;
@@ -22,8 +22,8 @@ export declare const RenderSvg: ({ defaultName, documentationLink, width, height
22
22
  readonly path: string;
23
23
  readonly instructions: Instruction[];
24
24
  readonly transformOrigin: string;
25
- } & Omit<React.SVGProps<SVGPathElement>, "d" | "height" | "hidden" | "name" | "width"> & Pick<SequenceProps, "durationInFrames" | "freeze" | "from" | "hidden" | "name" | "showInTimeline"> & {
26
- readonly _experimentalControls?: SequenceControls | undefined;
25
+ } & Omit<React.SVGProps<SVGPathElement>, "d" | "height" | "hidden" | "name" | "width"> & InteractiveBaseProps & {
26
+ readonly controls?: SequenceControls | undefined;
27
27
  } & {
28
28
  readonly debug?: boolean | undefined;
29
29
  readonly effects?: EffectsProp | undefined;
@@ -39,7 +39,8 @@ const react_1 = __importStar(require("react"));
39
39
  const react_dom_1 = require("react-dom");
40
40
  const remotion_1 = require("remotion");
41
41
  const does_react_support_canary_1 = require("../utils/does-react-support-canary");
42
- const RenderSvg = ({ defaultName, documentationLink, width, height, path, style, pathStyle, transformOrigin, debug, effects = [], instructions, pixelDensity, durationInFrames, from, freeze, hidden, name, showInTimeline, _experimentalControls: controls, stack, ...props }) => {
42
+ const HtmlInCanvasWithPrivateProps = remotion_1.HtmlInCanvas;
43
+ const RenderSvg = ({ defaultName, documentationLink, width, height, path, style, pathStyle, transformOrigin, debug, effects = [], instructions, pixelDensity, durationInFrames, from, freeze, hidden, name, showInTimeline, controls, stack, ...props }) => {
43
44
  const actualStyle = (0, react_1.useMemo)(() => {
44
45
  return {
45
46
  overflow: 'visible',
@@ -102,11 +103,11 @@ const RenderSvg = ({ defaultName, documentationLink, width, height, path, style,
102
103
  return null;
103
104
  })
104
105
  : null] }));
105
- const content = effects.length === 0 ? (svg) : (jsx_runtime_1.jsx(remotion_1.HtmlInCanvas, { ref: setCanvasRef, width: Math.ceil(width), height: Math.ceil(height), effects: effects, pixelDensity: pixelDensity, showInTimeline: false, style: actualStyle, _experimentalControls: controls, children: svg }));
106
+ const content = effects.length === 0 ? (svg) : (jsx_runtime_1.jsx(HtmlInCanvasWithPrivateProps, { ref: setCanvasRef, width: Math.ceil(width), height: Math.ceil(height), effects: effects, pixelDensity: pixelDensity, showInTimeline: false, style: actualStyle, controls: controls, children: svg }));
106
107
  const stackProps = stack === undefined ? null : { stack };
107
108
  if (!videoConfig) {
108
109
  return svg;
109
110
  }
110
- return (jsx_runtime_1.jsx(remotion_1.Sequence, { layout: "none", from: from, freeze: freeze, hidden: hidden, showInTimeline: showInTimeline, _experimentalControls: controls, _remotionInternalEffects: memoizedEffectDefinitions, durationInFrames: durationInFrames, name: name !== null && name !== void 0 ? name : defaultName, _remotionInternalRefForOutline: outlineRef, _remotionInternalDocumentationLink: name === undefined ? documentationLink : undefined, ...stackProps, children: content }));
111
+ return (jsx_runtime_1.jsx(remotion_1.Sequence, { layout: "none", from: from, freeze: freeze, hidden: hidden, showInTimeline: showInTimeline, controls: controls, _remotionInternalEffects: memoizedEffectDefinitions, durationInFrames: durationInFrames, name: name !== null && name !== void 0 ? name : defaultName, outlineRef: outlineRef, _remotionInternalDocumentationLink: name === undefined ? documentationLink : undefined, ...stackProps, children: content }));
111
112
  };
112
113
  exports.RenderSvg = RenderSvg;
@@ -1,4 +1,4 @@
1
- import { type SequenceFieldSchema, type SequenceSchema } from 'remotion';
1
+ import { type InteractivitySchemaField, type InteractivitySchema } from 'remotion';
2
2
  export declare const numberField: ({ defaultValue, description, hiddenFromList, max, min, step, }: {
3
3
  readonly defaultValue: number | undefined;
4
4
  readonly description: string;
@@ -6,18 +6,18 @@ export declare const numberField: ({ defaultValue, description, hiddenFromList,
6
6
  readonly max?: number | undefined;
7
7
  readonly min?: number | undefined;
8
8
  readonly step?: number | undefined;
9
- }) => SequenceFieldSchema;
9
+ }) => InteractivitySchemaField;
10
10
  export declare const booleanField: ({ defaultValue, description, }: {
11
11
  readonly defaultValue: boolean;
12
12
  readonly description: string;
13
- }) => SequenceFieldSchema;
13
+ }) => InteractivitySchemaField;
14
14
  export declare const colorField: ({ defaultValue, description, }: {
15
15
  readonly defaultValue: string | undefined;
16
16
  readonly description: string;
17
- }) => SequenceFieldSchema;
17
+ }) => InteractivitySchemaField;
18
18
  export declare const enumField: <T extends string>({ defaultValue, description, variants, }: {
19
19
  readonly defaultValue: T;
20
20
  readonly description: string;
21
21
  readonly variants: readonly T[];
22
- }) => SequenceFieldSchema;
23
- export declare const makeShapeSchema: (shapeFields: SequenceSchema) => SequenceSchema;
22
+ }) => InteractivitySchemaField;
23
+ export declare const makeShapeSchema: (shapeFields: InteractivitySchema) => InteractivitySchema;
@@ -41,16 +41,13 @@ const enumField = ({ defaultValue, description, variants, }) => {
41
41
  exports.enumField = enumField;
42
42
  const makeShapeSchema = (shapeFields) => {
43
43
  return {
44
- from: remotion_1.Internals.sequenceSchema.from,
45
- freeze: remotion_1.Internals.sequenceSchema.freeze,
46
- durationInFrames: remotion_1.Internals.sequenceSchema.durationInFrames,
44
+ ...remotion_1.Internals.baseSchema,
47
45
  ...shapeFields,
48
46
  fill: (0, exports.colorField)({
49
47
  defaultValue: '#0b84ff',
50
48
  description: 'Fill',
51
49
  }),
52
- ...remotion_1.Internals.sequenceVisualStyleSchema,
53
- hidden: remotion_1.Internals.sequenceSchema.hidden,
50
+ ...remotion_1.Internals.transformSchema,
54
51
  };
55
52
  };
56
53
  exports.makeShapeSchema = makeShapeSchema;
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import type { MakeSparkProps } from '../utils/make-spark';
3
+ import type { AllShapesProps } from './render-svg';
4
+ export type SparkProps = MakeSparkProps & AllShapesProps;
5
+ export declare const Spark: React.FC<SparkProps>;
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Spark = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const remotion_1 = require("remotion");
6
+ const make_spark_1 = require("../utils/make-spark");
7
+ const render_svg_1 = require("./render-svg");
8
+ const schema_1 = require("./schema");
9
+ const sparkSchema = (0, schema_1.makeShapeSchema)({
10
+ width: (0, schema_1.numberField)({
11
+ defaultValue: 100,
12
+ description: 'Width',
13
+ min: 0,
14
+ }),
15
+ height: (0, schema_1.numberField)({
16
+ defaultValue: 140,
17
+ description: 'Height',
18
+ min: 0,
19
+ }),
20
+ edgeRoundness: (0, schema_1.numberField)({
21
+ defaultValue: 1,
22
+ description: 'Edge Roundness',
23
+ min: 0,
24
+ step: 0.01,
25
+ }),
26
+ cornerRadius: (0, schema_1.numberField)({
27
+ defaultValue: 0,
28
+ description: 'Corner Radius',
29
+ min: 0,
30
+ }),
31
+ });
32
+ /**
33
+ * @description Renders an SVG element containing a spark.
34
+ * @param {Number} width The width of the spark.
35
+ * @param {Number} height The height of the spark.
36
+ * @param {Number} edgeRoundness Controls the inward curvature between the points. Default 1.
37
+ * @param {Number} cornerRadius Rounds the four points. Default 0.
38
+ * @see [Documentation](https://www.remotion.dev/docs/shapes/spark)
39
+ */
40
+ const SparkInner = ({ width, height, edgeRoundness, cornerRadius, ...props }) => {
41
+ return (jsx_runtime_1.jsx(render_svg_1.RenderSvg, { defaultName: "<Spark>", documentationLink: "https://www.remotion.dev/docs/shapes/spark", ...(0, make_spark_1.makeSpark)({ width, height, edgeRoundness, cornerRadius }), ...props }));
42
+ };
43
+ exports.Spark = remotion_1.Interactive.withSchema({
44
+ Component: SparkInner,
45
+ componentName: '<Spark>',
46
+ componentIdentity: 'dev.remotion.shapes.Spark',
47
+ schema: sparkSchema,
48
+ supportsEffects: true,
49
+ });
50
+ remotion_1.Internals.addSequenceStackTraces(exports.Spark);
@@ -47,8 +47,9 @@ const StarInner = ({ innerRadius, outerRadius, points, cornerRadius, edgeRoundne
47
47
  edgeRoundness,
48
48
  }), ...props }));
49
49
  };
50
- exports.Star = remotion_1.Internals.wrapInSchema({
50
+ exports.Star = remotion_1.Interactive.withSchema({
51
51
  Component: StarInner,
52
+ componentName: '<Star>',
52
53
  componentIdentity: 'dev.remotion.shapes.Star',
53
54
  schema: starSchema,
54
55
  supportsEffects: true,
@@ -34,8 +34,9 @@ const triangleSchema = (0, schema_1.makeShapeSchema)({
34
34
  const TriangleInner = ({ length, direction, edgeRoundness, cornerRadius, ...props }) => {
35
35
  return (jsx_runtime_1.jsx(render_svg_1.RenderSvg, { defaultName: "<Triangle>", documentationLink: "https://www.remotion.dev/docs/shapes/triangle", ...(0, make_triangle_1.makeTriangle)({ length, direction, edgeRoundness, cornerRadius }), ...props }));
36
36
  };
37
- exports.Triangle = remotion_1.Internals.wrapInSchema({
37
+ exports.Triangle = remotion_1.Interactive.withSchema({
38
38
  Component: TriangleInner,
39
+ componentName: '<Triangle>',
39
40
  componentIdentity: 'dev.remotion.shapes.Triangle',
40
41
  schema: triangleSchema,
41
42
  supportsEffects: true,
@@ -1,5 +1,5 @@
1
1
  // src/components/arrow.tsx
2
- import { Internals as Internals3 } from "remotion";
2
+ import { Internals as Internals3, Interactive } from "remotion";
3
3
 
4
4
  // src/utils/make-arrow.ts
5
5
  import { serializeInstructions } from "@remotion/paths";
@@ -160,6 +160,7 @@ var doesReactSupportTransformOriginProperty = (version) => {
160
160
 
161
161
  // src/components/render-svg.tsx
162
162
  import { jsx, jsxs } from "react/jsx-runtime";
163
+ var HtmlInCanvasWithPrivateProps = HtmlInCanvas;
163
164
  var RenderSvg = ({
164
165
  defaultName,
165
166
  documentationLink,
@@ -179,7 +180,7 @@ var RenderSvg = ({
179
180
  hidden,
180
181
  name,
181
182
  showInTimeline,
182
- _experimentalControls: controls,
183
+ controls,
183
184
  stack,
184
185
  ...props
185
186
  }) => {
@@ -266,7 +267,7 @@ var RenderSvg = ({
266
267
  }) : null
267
268
  ]
268
269
  });
269
- const content = effects.length === 0 ? svg : /* @__PURE__ */ jsx(HtmlInCanvas, {
270
+ const content = effects.length === 0 ? svg : /* @__PURE__ */ jsx(HtmlInCanvasWithPrivateProps, {
270
271
  ref: setCanvasRef,
271
272
  width: Math.ceil(width),
272
273
  height: Math.ceil(height),
@@ -274,7 +275,7 @@ var RenderSvg = ({
274
275
  pixelDensity,
275
276
  showInTimeline: false,
276
277
  style: actualStyle,
277
- _experimentalControls: controls,
278
+ controls,
278
279
  children: svg
279
280
  });
280
281
  const stackProps = stack === undefined ? null : { stack };
@@ -287,11 +288,11 @@ var RenderSvg = ({
287
288
  freeze,
288
289
  hidden,
289
290
  showInTimeline,
290
- _experimentalControls: controls,
291
+ controls,
291
292
  _remotionInternalEffects: memoizedEffectDefinitions,
292
293
  durationInFrames,
293
294
  name: name ?? defaultName,
294
- _remotionInternalRefForOutline: outlineRef,
295
+ outlineRef,
295
296
  _remotionInternalDocumentationLink: name === undefined ? documentationLink : undefined,
296
297
  ...stackProps,
297
298
  children: content
@@ -354,16 +355,13 @@ var enumField = ({
354
355
  };
355
356
  var makeShapeSchema = (shapeFields) => {
356
357
  return {
357
- from: Internals2.sequenceSchema.from,
358
- freeze: Internals2.sequenceSchema.freeze,
359
- durationInFrames: Internals2.sequenceSchema.durationInFrames,
358
+ ...Internals2.baseSchema,
360
359
  ...shapeFields,
361
360
  fill: colorField({
362
361
  defaultValue: "#0b84ff",
363
362
  description: "Fill"
364
363
  }),
365
- ...Internals2.sequenceVisualStyleSchema,
366
- hidden: Internals2.sequenceSchema.hidden
364
+ ...Internals2.transformSchema
367
365
  };
368
366
  };
369
367
 
@@ -424,15 +422,16 @@ var ArrowInner = ({
424
422
  ...props
425
423
  });
426
424
  };
427
- var Arrow = Internals3.wrapInSchema({
425
+ var Arrow = Interactive.withSchema({
428
426
  Component: ArrowInner,
427
+ componentName: "<Arrow>",
429
428
  componentIdentity: "dev.remotion.shapes.Arrow",
430
429
  schema: arrowSchema,
431
430
  supportsEffects: true
432
431
  });
433
432
  Internals3.addSequenceStackTraces(Arrow);
434
433
  // src/components/callout.tsx
435
- import { Internals as Internals4 } from "remotion";
434
+ import { Internals as Internals4, Interactive as Interactive2 } from "remotion";
436
435
 
437
436
  // src/utils/make-callout.ts
438
437
  import { serializeInstructions as serializeInstructions2 } from "@remotion/paths";
@@ -860,15 +859,16 @@ var CalloutInner = ({
860
859
  ...props
861
860
  });
862
861
  };
863
- var Callout = Internals4.wrapInSchema({
862
+ var Callout = Interactive2.withSchema({
864
863
  Component: CalloutInner,
864
+ componentName: "<Callout>",
865
865
  componentIdentity: "dev.remotion.shapes.Callout",
866
866
  schema: calloutSchema,
867
867
  supportsEffects: true
868
868
  });
869
869
  Internals4.addSequenceStackTraces(Callout);
870
870
  // src/components/circle.tsx
871
- import { Internals as Internals5 } from "remotion";
871
+ import { Internals as Internals5, Interactive as Interactive3 } from "remotion";
872
872
 
873
873
  // src/utils/make-circle.ts
874
874
  import { serializeInstructions as serializeInstructions3 } from "@remotion/paths";
@@ -930,15 +930,16 @@ var CircleInner = ({ radius, ...props }) => {
930
930
  ...props
931
931
  });
932
932
  };
933
- var Circle = Internals5.wrapInSchema({
933
+ var Circle = Interactive3.withSchema({
934
934
  Component: CircleInner,
935
+ componentName: "<Circle>",
935
936
  componentIdentity: "dev.remotion.shapes.Circle",
936
937
  schema: circleSchema,
937
938
  supportsEffects: true
938
939
  });
939
940
  Internals5.addSequenceStackTraces(Circle);
940
941
  // src/components/ellipse.tsx
941
- import { Internals as Internals6 } from "remotion";
942
+ import { Internals as Internals6, Interactive as Interactive4 } from "remotion";
942
943
 
943
944
  // src/utils/make-ellipse.ts
944
945
  import { serializeInstructions as serializeInstructions4 } from "@remotion/paths";
@@ -995,15 +996,16 @@ var EllipseInner = ({ rx, ry, ...props }) => {
995
996
  ...props
996
997
  });
997
998
  };
998
- var Ellipse = Internals6.wrapInSchema({
999
+ var Ellipse = Interactive4.withSchema({
999
1000
  Component: EllipseInner,
1001
+ componentName: "<Ellipse>",
1000
1002
  componentIdentity: "dev.remotion.shapes.Ellipse",
1001
1003
  schema: ellipseSchema,
1002
1004
  supportsEffects: true
1003
1005
  });
1004
1006
  Internals6.addSequenceStackTraces(Ellipse);
1005
1007
  // src/components/heart.tsx
1006
- import { Internals as Internals7 } from "remotion";
1008
+ import { Internals as Internals7, Interactive as Interactive5 } from "remotion";
1007
1009
 
1008
1010
  // src/utils/make-heart.ts
1009
1011
  import { serializeInstructions as serializeInstructions5 } from "@remotion/paths";
@@ -1141,15 +1143,16 @@ var HeartInner = ({
1141
1143
  ...props
1142
1144
  });
1143
1145
  };
1144
- var Heart = Internals7.wrapInSchema({
1146
+ var Heart = Interactive5.withSchema({
1145
1147
  Component: HeartInner,
1148
+ componentName: "<Heart>",
1146
1149
  componentIdentity: "dev.remotion.shapes.Heart",
1147
1150
  schema: heartSchema,
1148
1151
  supportsEffects: true
1149
1152
  });
1150
1153
  Internals7.addSequenceStackTraces(Heart);
1151
1154
  // src/components/pie.tsx
1152
- import { Internals as Internals8 } from "remotion";
1155
+ import { Internals as Internals8, Interactive as Interactive6 } from "remotion";
1153
1156
 
1154
1157
  // src/utils/make-pie.ts
1155
1158
  import { serializeInstructions as serializeInstructions6 } from "@remotion/paths";
@@ -1303,15 +1306,16 @@ var PieInner = ({
1303
1306
  ...props
1304
1307
  });
1305
1308
  };
1306
- var Pie = Internals8.wrapInSchema({
1309
+ var Pie = Interactive6.withSchema({
1307
1310
  Component: PieInner,
1311
+ componentName: "<Pie>",
1308
1312
  componentIdentity: "dev.remotion.shapes.Pie",
1309
1313
  schema: pieSchema,
1310
1314
  supportsEffects: true
1311
1315
  });
1312
1316
  Internals8.addSequenceStackTraces(Pie);
1313
1317
  // src/components/polygon.tsx
1314
- import { Internals as Internals9 } from "remotion";
1318
+ import { Internals as Internals9, Interactive as Interactive7 } from "remotion";
1315
1319
 
1316
1320
  // src/utils/make-polygon.ts
1317
1321
  import {
@@ -1415,15 +1419,16 @@ var PolygonInner = ({
1415
1419
  ...props
1416
1420
  });
1417
1421
  };
1418
- var Polygon = Internals9.wrapInSchema({
1422
+ var Polygon = Interactive7.withSchema({
1419
1423
  Component: PolygonInner,
1424
+ componentName: "<Polygon>",
1420
1425
  componentIdentity: "dev.remotion.shapes.Polygon",
1421
1426
  schema: polygonSchema,
1422
1427
  supportsEffects: true
1423
1428
  });
1424
1429
  Internals9.addSequenceStackTraces(Polygon);
1425
1430
  // src/components/rect.tsx
1426
- import { Internals as Internals10 } from "remotion";
1431
+ import { Internals as Internals10, Interactive as Interactive8 } from "remotion";
1427
1432
 
1428
1433
  // src/utils/make-rect.ts
1429
1434
  import { serializeInstructions as serializeInstructions8 } from "@remotion/paths";
@@ -1489,22 +1494,243 @@ var RectInner = ({
1489
1494
  ...props
1490
1495
  });
1491
1496
  };
1492
- var Rect = Internals10.wrapInSchema({
1497
+ var Rect = Interactive8.withSchema({
1493
1498
  Component: RectInner,
1499
+ componentName: "<Rect>",
1494
1500
  componentIdentity: "dev.remotion.shapes.Rect",
1495
1501
  schema: rectSchema,
1496
1502
  supportsEffects: true
1497
1503
  });
1498
1504
  Internals10.addSequenceStackTraces(Rect);
1505
+ // src/components/spark.tsx
1506
+ import { Internals as Internals11, Interactive as Interactive9 } from "remotion";
1507
+
1508
+ // src/utils/make-spark.ts
1509
+ import { serializeInstructions as serializeInstructions9 } from "@remotion/paths";
1510
+ var KAPPA = 0.5522847498307936;
1511
+ var CAP_HANDLE = 4 / 3;
1512
+ var curve = ({
1513
+ to,
1514
+ cp1,
1515
+ cp2
1516
+ }) => {
1517
+ return {
1518
+ type: "C",
1519
+ cp1x: cp1[0],
1520
+ cp1y: cp1[1],
1521
+ cp2x: cp2[0],
1522
+ cp2y: cp2[1],
1523
+ x: to[0],
1524
+ y: to[1]
1525
+ };
1526
+ };
1527
+ var cap = ({
1528
+ from,
1529
+ to,
1530
+ radius,
1531
+ direction
1532
+ }) => {
1533
+ if (direction === "top") {
1534
+ return curve({
1535
+ to,
1536
+ cp1: [from[0], from[1] - radius * CAP_HANDLE],
1537
+ cp2: [to[0], to[1] - radius * CAP_HANDLE]
1538
+ });
1539
+ }
1540
+ if (direction === "right") {
1541
+ return curve({
1542
+ to,
1543
+ cp1: [from[0] + radius * CAP_HANDLE, from[1]],
1544
+ cp2: [to[0] + radius * CAP_HANDLE, to[1]]
1545
+ });
1546
+ }
1547
+ if (direction === "bottom") {
1548
+ return curve({
1549
+ to,
1550
+ cp1: [from[0], from[1] + radius * CAP_HANDLE],
1551
+ cp2: [to[0], to[1] + radius * CAP_HANDLE]
1552
+ });
1553
+ }
1554
+ return curve({
1555
+ to,
1556
+ cp1: [from[0] - radius * CAP_HANDLE, from[1]],
1557
+ cp2: [to[0] - radius * CAP_HANDLE, to[1]]
1558
+ });
1559
+ };
1560
+ var edge = ({
1561
+ from,
1562
+ to,
1563
+ edgeRoundness,
1564
+ direction
1565
+ }) => {
1566
+ const dx = to[0] - from[0];
1567
+ const dy = to[1] - from[1];
1568
+ const handleX = Math.abs(dx) * KAPPA * edgeRoundness;
1569
+ const handleY = Math.abs(dy) * KAPPA * edgeRoundness;
1570
+ if (direction === "top-right") {
1571
+ return curve({
1572
+ to,
1573
+ cp1: [from[0], from[1] + handleY],
1574
+ cp2: [to[0] - handleX, to[1]]
1575
+ });
1576
+ }
1577
+ if (direction === "right-bottom") {
1578
+ return curve({
1579
+ to,
1580
+ cp1: [from[0] - handleX, from[1]],
1581
+ cp2: [to[0], to[1] - handleY]
1582
+ });
1583
+ }
1584
+ if (direction === "bottom-left") {
1585
+ return curve({
1586
+ to,
1587
+ cp1: [from[0], from[1] - handleY],
1588
+ cp2: [to[0] + handleX, to[1]]
1589
+ });
1590
+ }
1591
+ return curve({
1592
+ to,
1593
+ cp1: [from[0] + handleX, from[1]],
1594
+ cp2: [to[0], to[1] + handleY]
1595
+ });
1596
+ };
1597
+ var clampCornerRadius = ({
1598
+ cornerRadius,
1599
+ width,
1600
+ height
1601
+ }) => {
1602
+ return Math.min(Math.max(cornerRadius, 0), width / 2, height / 2);
1603
+ };
1604
+ var makeSpark = ({
1605
+ width,
1606
+ height,
1607
+ edgeRoundness = 1,
1608
+ cornerRadius = 0
1609
+ }) => {
1610
+ const centerX = width / 2;
1611
+ const centerY = height / 2;
1612
+ const radius = clampCornerRadius({ cornerRadius, width, height });
1613
+ const top = [centerX, 0];
1614
+ const right = [width, centerY];
1615
+ const bottom = [centerX, height];
1616
+ const left = [0, centerY];
1617
+ const topRight = radius === 0 ? top : [centerX + radius, radius];
1618
+ const rightTop = radius === 0 ? right : [width - radius, centerY - radius];
1619
+ const rightBottom = radius === 0 ? right : [width - radius, centerY + radius];
1620
+ const bottomRight = radius === 0 ? bottom : [centerX + radius, height - radius];
1621
+ const bottomLeft = radius === 0 ? bottom : [centerX - radius, height - radius];
1622
+ const leftBottom = radius === 0 ? left : [radius, centerY + radius];
1623
+ const leftTop = radius === 0 ? left : [radius, centerY - radius];
1624
+ const topLeft = radius === 0 ? top : [centerX - radius, radius];
1625
+ const instructions = [
1626
+ {
1627
+ type: "M",
1628
+ x: topRight[0],
1629
+ y: topRight[1]
1630
+ },
1631
+ edge({
1632
+ from: topRight,
1633
+ to: rightTop,
1634
+ edgeRoundness,
1635
+ direction: "top-right"
1636
+ })
1637
+ ];
1638
+ if (radius > 0) {
1639
+ instructions.push(cap({ from: rightTop, to: rightBottom, radius, direction: "right" }));
1640
+ }
1641
+ instructions.push(edge({
1642
+ from: rightBottom,
1643
+ to: bottomRight,
1644
+ edgeRoundness,
1645
+ direction: "right-bottom"
1646
+ }));
1647
+ if (radius > 0) {
1648
+ instructions.push(cap({ from: bottomRight, to: bottomLeft, radius, direction: "bottom" }));
1649
+ }
1650
+ instructions.push(edge({
1651
+ from: bottomLeft,
1652
+ to: leftBottom,
1653
+ edgeRoundness,
1654
+ direction: "bottom-left"
1655
+ }));
1656
+ if (radius > 0) {
1657
+ instructions.push(cap({ from: leftBottom, to: leftTop, radius, direction: "left" }));
1658
+ }
1659
+ instructions.push(edge({
1660
+ from: leftTop,
1661
+ to: topLeft,
1662
+ edgeRoundness,
1663
+ direction: "left-top"
1664
+ }));
1665
+ if (radius > 0) {
1666
+ instructions.push(cap({ from: topLeft, to: topRight, radius, direction: "top" }));
1667
+ }
1668
+ instructions.push({ type: "Z" });
1669
+ return {
1670
+ path: serializeInstructions9(instructions),
1671
+ width,
1672
+ height,
1673
+ transformOrigin: `${centerX} ${centerY}`,
1674
+ instructions
1675
+ };
1676
+ };
1677
+
1678
+ // src/components/spark.tsx
1679
+ import { jsx as jsx10 } from "react/jsx-runtime";
1680
+ var sparkSchema = makeShapeSchema({
1681
+ width: numberField({
1682
+ defaultValue: 100,
1683
+ description: "Width",
1684
+ min: 0
1685
+ }),
1686
+ height: numberField({
1687
+ defaultValue: 140,
1688
+ description: "Height",
1689
+ min: 0
1690
+ }),
1691
+ edgeRoundness: numberField({
1692
+ defaultValue: 1,
1693
+ description: "Edge Roundness",
1694
+ min: 0,
1695
+ step: 0.01
1696
+ }),
1697
+ cornerRadius: numberField({
1698
+ defaultValue: 0,
1699
+ description: "Corner Radius",
1700
+ min: 0
1701
+ })
1702
+ });
1703
+ var SparkInner = ({
1704
+ width,
1705
+ height,
1706
+ edgeRoundness,
1707
+ cornerRadius,
1708
+ ...props
1709
+ }) => {
1710
+ return /* @__PURE__ */ jsx10(RenderSvg, {
1711
+ defaultName: "<Spark>",
1712
+ documentationLink: "https://www.remotion.dev/docs/shapes/spark",
1713
+ ...makeSpark({ width, height, edgeRoundness, cornerRadius }),
1714
+ ...props
1715
+ });
1716
+ };
1717
+ var Spark = Interactive9.withSchema({
1718
+ Component: SparkInner,
1719
+ componentName: "<Spark>",
1720
+ componentIdentity: "dev.remotion.shapes.Spark",
1721
+ schema: sparkSchema,
1722
+ supportsEffects: true
1723
+ });
1724
+ Internals11.addSequenceStackTraces(Spark);
1499
1725
  // src/components/star.tsx
1500
- import { Internals as Internals11 } from "remotion";
1726
+ import { Internals as Internals12, Interactive as Interactive10 } from "remotion";
1501
1727
 
1502
1728
  // src/utils/make-star.ts
1503
1729
  import {
1504
1730
  PathInternals as PathInternals2,
1505
1731
  reduceInstructions as reduceInstructions2,
1506
1732
  resetPath as resetPath2,
1507
- serializeInstructions as serializeInstructions9
1733
+ serializeInstructions as serializeInstructions10
1508
1734
  } from "@remotion/paths";
1509
1735
  var star = ({
1510
1736
  centerX,
@@ -1555,7 +1781,7 @@ var makeStar = ({
1555
1781
  edgeRoundness
1556
1782
  });
1557
1783
  const reduced = reduceInstructions2(starPathInstructions);
1558
- const path = resetPath2(serializeInstructions9(reduced));
1784
+ const path = resetPath2(serializeInstructions10(reduced));
1559
1785
  const boundingBox = PathInternals2.getBoundingBoxFromInstructions(reduced);
1560
1786
  return {
1561
1787
  path,
@@ -1567,7 +1793,7 @@ var makeStar = ({
1567
1793
  };
1568
1794
 
1569
1795
  // src/components/star.tsx
1570
- import { jsx as jsx10 } from "react/jsx-runtime";
1796
+ import { jsx as jsx11 } from "react/jsx-runtime";
1571
1797
  var starSchema = makeShapeSchema({
1572
1798
  points: numberField({
1573
1799
  defaultValue: 5,
@@ -1599,7 +1825,7 @@ var StarInner = ({
1599
1825
  edgeRoundness,
1600
1826
  ...props
1601
1827
  }) => {
1602
- return /* @__PURE__ */ jsx10(RenderSvg, {
1828
+ return /* @__PURE__ */ jsx11(RenderSvg, {
1603
1829
  defaultName: "<Star>",
1604
1830
  documentationLink: "https://www.remotion.dev/docs/shapes/star",
1605
1831
  ...makeStar({
@@ -1612,18 +1838,19 @@ var StarInner = ({
1612
1838
  ...props
1613
1839
  });
1614
1840
  };
1615
- var Star = Internals11.wrapInSchema({
1841
+ var Star = Interactive10.withSchema({
1616
1842
  Component: StarInner,
1843
+ componentName: "<Star>",
1617
1844
  componentIdentity: "dev.remotion.shapes.Star",
1618
1845
  schema: starSchema,
1619
1846
  supportsEffects: true
1620
1847
  });
1621
- Internals11.addSequenceStackTraces(Star);
1848
+ Internals12.addSequenceStackTraces(Star);
1622
1849
  // src/components/triangle.tsx
1623
- import { Internals as Internals12 } from "remotion";
1850
+ import { Internals as Internals13, Interactive as Interactive11 } from "remotion";
1624
1851
 
1625
1852
  // src/utils/make-triangle.ts
1626
- import { serializeInstructions as serializeInstructions10 } from "@remotion/paths";
1853
+ import { serializeInstructions as serializeInstructions11 } from "@remotion/paths";
1627
1854
  var makeTriangle = ({
1628
1855
  length,
1629
1856
  direction = "right",
@@ -1683,7 +1910,7 @@ var makeTriangle = ({
1683
1910
  type: "Z"
1684
1911
  }
1685
1912
  ];
1686
- const path = serializeInstructions10(instructions);
1913
+ const path = serializeInstructions11(instructions);
1687
1914
  return {
1688
1915
  path,
1689
1916
  instructions,
@@ -1694,7 +1921,7 @@ var makeTriangle = ({
1694
1921
  };
1695
1922
 
1696
1923
  // src/components/triangle.tsx
1697
- import { jsx as jsx11 } from "react/jsx-runtime";
1924
+ import { jsx as jsx12 } from "react/jsx-runtime";
1698
1925
  var triangleSchema = makeShapeSchema({
1699
1926
  length: numberField({
1700
1927
  defaultValue: 100,
@@ -1719,23 +1946,25 @@ var TriangleInner = ({
1719
1946
  cornerRadius,
1720
1947
  ...props
1721
1948
  }) => {
1722
- return /* @__PURE__ */ jsx11(RenderSvg, {
1949
+ return /* @__PURE__ */ jsx12(RenderSvg, {
1723
1950
  defaultName: "<Triangle>",
1724
1951
  documentationLink: "https://www.remotion.dev/docs/shapes/triangle",
1725
1952
  ...makeTriangle({ length, direction, edgeRoundness, cornerRadius }),
1726
1953
  ...props
1727
1954
  });
1728
1955
  };
1729
- var Triangle = Internals12.wrapInSchema({
1956
+ var Triangle = Interactive11.withSchema({
1730
1957
  Component: TriangleInner,
1958
+ componentName: "<Triangle>",
1731
1959
  componentIdentity: "dev.remotion.shapes.Triangle",
1732
1960
  schema: triangleSchema,
1733
1961
  supportsEffects: true
1734
1962
  });
1735
- Internals12.addSequenceStackTraces(Triangle);
1963
+ Internals13.addSequenceStackTraces(Triangle);
1736
1964
  export {
1737
1965
  makeTriangle,
1738
1966
  makeStar,
1967
+ makeSpark,
1739
1968
  makeRect,
1740
1969
  makePolygon,
1741
1970
  makePie,
@@ -1746,6 +1975,7 @@ export {
1746
1975
  makeArrow,
1747
1976
  Triangle,
1748
1977
  Star,
1978
+ Spark,
1749
1979
  Rect,
1750
1980
  Polygon,
1751
1981
  Pie,
package/dist/index.d.ts CHANGED
@@ -7,6 +7,7 @@ export { Heart, HeartProps } from './components/heart';
7
7
  export { Pie, PieProps } from './components/pie';
8
8
  export { Polygon, PolygonProps } from './components/polygon';
9
9
  export { Rect, RectProps } from './components/rect';
10
+ export { Spark, SparkProps } from './components/spark';
10
11
  export { Star, StarProps } from './components/star';
11
12
  export { Triangle, TriangleProps } from './components/triangle';
12
13
  export { MakeArrowProps, makeArrow } from './utils/make-arrow';
@@ -17,5 +18,6 @@ export { MakeHeartProps, makeHeart } from './utils/make-heart';
17
18
  export { MakePieProps, makePie } from './utils/make-pie';
18
19
  export { MakePolygonProps, makePolygon } from './utils/make-polygon';
19
20
  export { MakeRectOptions, makeRect } from './utils/make-rect';
21
+ export { MakeSparkProps, makeSpark } from './utils/make-spark';
20
22
  export { MakeStarProps, makeStar } from './utils/make-star';
21
23
  export { MakeTriangleProps, makeTriangle } from './utils/make-triangle';
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.makeTriangle = exports.makeStar = exports.makeRect = exports.makePolygon = exports.makePie = exports.makeHeart = exports.makeEllipse = exports.makeCircle = exports.makeCallout = exports.makeArrow = exports.Triangle = exports.Star = exports.Rect = exports.Polygon = exports.Pie = exports.Heart = exports.Ellipse = exports.Circle = exports.Callout = exports.Arrow = void 0;
3
+ exports.makeTriangle = exports.makeStar = exports.makeSpark = exports.makeRect = exports.makePolygon = exports.makePie = exports.makeHeart = exports.makeEllipse = exports.makeCircle = exports.makeCallout = exports.makeArrow = exports.Triangle = exports.Star = exports.Spark = exports.Rect = exports.Polygon = exports.Pie = exports.Heart = exports.Ellipse = exports.Circle = exports.Callout = exports.Arrow = void 0;
4
4
  const arrow_1 = require("./components/arrow");
5
5
  Object.defineProperty(exports, "Arrow", { enumerable: true, get: function () { return arrow_1.Arrow; } });
6
6
  const callout_1 = require("./components/callout");
@@ -17,6 +17,8 @@ const polygon_1 = require("./components/polygon");
17
17
  Object.defineProperty(exports, "Polygon", { enumerable: true, get: function () { return polygon_1.Polygon; } });
18
18
  const rect_1 = require("./components/rect");
19
19
  Object.defineProperty(exports, "Rect", { enumerable: true, get: function () { return rect_1.Rect; } });
20
+ const spark_1 = require("./components/spark");
21
+ Object.defineProperty(exports, "Spark", { enumerable: true, get: function () { return spark_1.Spark; } });
20
22
  const star_1 = require("./components/star");
21
23
  Object.defineProperty(exports, "Star", { enumerable: true, get: function () { return star_1.Star; } });
22
24
  const triangle_1 = require("./components/triangle");
@@ -37,6 +39,8 @@ const make_polygon_1 = require("./utils/make-polygon");
37
39
  Object.defineProperty(exports, "makePolygon", { enumerable: true, get: function () { return make_polygon_1.makePolygon; } });
38
40
  const make_rect_1 = require("./utils/make-rect");
39
41
  Object.defineProperty(exports, "makeRect", { enumerable: true, get: function () { return make_rect_1.makeRect; } });
42
+ const make_spark_1 = require("./utils/make-spark");
43
+ Object.defineProperty(exports, "makeSpark", { enumerable: true, get: function () { return make_spark_1.makeSpark; } });
40
44
  const make_star_1 = require("./utils/make-star");
41
45
  Object.defineProperty(exports, "makeStar", { enumerable: true, get: function () { return make_star_1.makeStar; } });
42
46
  const make_triangle_1 = require("./utils/make-triangle");
@@ -0,0 +1,16 @@
1
+ import type { ShapeInfo } from './shape-info';
2
+ export type MakeSparkProps = {
3
+ width: number;
4
+ height: number;
5
+ edgeRoundness?: number;
6
+ cornerRadius?: number;
7
+ };
8
+ /**
9
+ * @description Generates a spark SVG path.
10
+ * @param {Number} width The width of the spark.
11
+ * @param {Number} height The height of the spark.
12
+ * @param {Number} edgeRoundness Controls the inward curvature between the points. Default 1.
13
+ * @param {Number} cornerRadius Rounds the four points. Default 0.
14
+ * @see [Documentation](https://www.remotion.dev/docs/shapes/make-spark)
15
+ */
16
+ export declare const makeSpark: ({ width, height, edgeRoundness, cornerRadius, }: MakeSparkProps) => ShapeInfo;
@@ -0,0 +1,157 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.makeSpark = void 0;
4
+ const paths_1 = require("@remotion/paths");
5
+ const KAPPA = 0.5522847498307936;
6
+ const CAP_HANDLE = 4 / 3;
7
+ const curve = ({ to, cp1, cp2, }) => {
8
+ return {
9
+ type: 'C',
10
+ cp1x: cp1[0],
11
+ cp1y: cp1[1],
12
+ cp2x: cp2[0],
13
+ cp2y: cp2[1],
14
+ x: to[0],
15
+ y: to[1],
16
+ };
17
+ };
18
+ const cap = ({ from, to, radius, direction, }) => {
19
+ if (direction === 'top') {
20
+ return curve({
21
+ to,
22
+ cp1: [from[0], from[1] - radius * CAP_HANDLE],
23
+ cp2: [to[0], to[1] - radius * CAP_HANDLE],
24
+ });
25
+ }
26
+ if (direction === 'right') {
27
+ return curve({
28
+ to,
29
+ cp1: [from[0] + radius * CAP_HANDLE, from[1]],
30
+ cp2: [to[0] + radius * CAP_HANDLE, to[1]],
31
+ });
32
+ }
33
+ if (direction === 'bottom') {
34
+ return curve({
35
+ to,
36
+ cp1: [from[0], from[1] + radius * CAP_HANDLE],
37
+ cp2: [to[0], to[1] + radius * CAP_HANDLE],
38
+ });
39
+ }
40
+ return curve({
41
+ to,
42
+ cp1: [from[0] - radius * CAP_HANDLE, from[1]],
43
+ cp2: [to[0] - radius * CAP_HANDLE, to[1]],
44
+ });
45
+ };
46
+ const edge = ({ from, to, edgeRoundness, direction, }) => {
47
+ const dx = to[0] - from[0];
48
+ const dy = to[1] - from[1];
49
+ const handleX = Math.abs(dx) * KAPPA * edgeRoundness;
50
+ const handleY = Math.abs(dy) * KAPPA * edgeRoundness;
51
+ if (direction === 'top-right') {
52
+ return curve({
53
+ to,
54
+ cp1: [from[0], from[1] + handleY],
55
+ cp2: [to[0] - handleX, to[1]],
56
+ });
57
+ }
58
+ if (direction === 'right-bottom') {
59
+ return curve({
60
+ to,
61
+ cp1: [from[0] - handleX, from[1]],
62
+ cp2: [to[0], to[1] - handleY],
63
+ });
64
+ }
65
+ if (direction === 'bottom-left') {
66
+ return curve({
67
+ to,
68
+ cp1: [from[0], from[1] - handleY],
69
+ cp2: [to[0] + handleX, to[1]],
70
+ });
71
+ }
72
+ return curve({
73
+ to,
74
+ cp1: [from[0] + handleX, from[1]],
75
+ cp2: [to[0], to[1] + handleY],
76
+ });
77
+ };
78
+ const clampCornerRadius = ({ cornerRadius, width, height, }) => {
79
+ return Math.min(Math.max(cornerRadius, 0), width / 2, height / 2);
80
+ };
81
+ /**
82
+ * @description Generates a spark SVG path.
83
+ * @param {Number} width The width of the spark.
84
+ * @param {Number} height The height of the spark.
85
+ * @param {Number} edgeRoundness Controls the inward curvature between the points. Default 1.
86
+ * @param {Number} cornerRadius Rounds the four points. Default 0.
87
+ * @see [Documentation](https://www.remotion.dev/docs/shapes/make-spark)
88
+ */
89
+ const makeSpark = ({ width, height, edgeRoundness = 1, cornerRadius = 0, }) => {
90
+ const centerX = width / 2;
91
+ const centerY = height / 2;
92
+ const radius = clampCornerRadius({ cornerRadius, width, height });
93
+ const top = [centerX, 0];
94
+ const right = [width, centerY];
95
+ const bottom = [centerX, height];
96
+ const left = [0, centerY];
97
+ const topRight = radius === 0 ? top : [centerX + radius, radius];
98
+ const rightTop = radius === 0 ? right : [width - radius, centerY - radius];
99
+ const rightBottom = radius === 0 ? right : [width - radius, centerY + radius];
100
+ const bottomRight = radius === 0 ? bottom : [centerX + radius, height - radius];
101
+ const bottomLeft = radius === 0 ? bottom : [centerX - radius, height - radius];
102
+ const leftBottom = radius === 0 ? left : [radius, centerY + radius];
103
+ const leftTop = radius === 0 ? left : [radius, centerY - radius];
104
+ const topLeft = radius === 0 ? top : [centerX - radius, radius];
105
+ const instructions = [
106
+ {
107
+ type: 'M',
108
+ x: topRight[0],
109
+ y: topRight[1],
110
+ },
111
+ edge({
112
+ from: topRight,
113
+ to: rightTop,
114
+ edgeRoundness,
115
+ direction: 'top-right',
116
+ }),
117
+ ];
118
+ if (radius > 0) {
119
+ instructions.push(cap({ from: rightTop, to: rightBottom, radius, direction: 'right' }));
120
+ }
121
+ instructions.push(edge({
122
+ from: rightBottom,
123
+ to: bottomRight,
124
+ edgeRoundness,
125
+ direction: 'right-bottom',
126
+ }));
127
+ if (radius > 0) {
128
+ instructions.push(cap({ from: bottomRight, to: bottomLeft, radius, direction: 'bottom' }));
129
+ }
130
+ instructions.push(edge({
131
+ from: bottomLeft,
132
+ to: leftBottom,
133
+ edgeRoundness,
134
+ direction: 'bottom-left',
135
+ }));
136
+ if (radius > 0) {
137
+ instructions.push(cap({ from: leftBottom, to: leftTop, radius, direction: 'left' }));
138
+ }
139
+ instructions.push(edge({
140
+ from: leftTop,
141
+ to: topLeft,
142
+ edgeRoundness,
143
+ direction: 'left-top',
144
+ }));
145
+ if (radius > 0) {
146
+ instructions.push(cap({ from: topLeft, to: topRight, radius, direction: 'top' }));
147
+ }
148
+ instructions.push({ type: 'Z' });
149
+ return {
150
+ path: (0, paths_1.serializeInstructions)(instructions),
151
+ width,
152
+ height,
153
+ transformOrigin: `${centerX} ${centerY}`,
154
+ instructions,
155
+ };
156
+ };
157
+ exports.makeSpark = makeSpark;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "url": "https://github.com/remotion-dev/remotion/tree/main/packages/shapes"
4
4
  },
5
5
  "name": "@remotion/shapes",
6
- "version": "4.0.478",
6
+ "version": "4.0.481",
7
7
  "description": "Generate SVG shapes",
8
8
  "main": "dist/index.js",
9
9
  "scripts": {
@@ -34,7 +34,7 @@
34
34
  "react": "19.2.3",
35
35
  "react-dom": "19.2.3",
36
36
  "@happy-dom/global-registrator": "14.5.1",
37
- "@remotion/eslint-config-internal": "4.0.478",
37
+ "@remotion/eslint-config-internal": "4.0.481",
38
38
  "eslint": "9.19.0",
39
39
  "@typescript/native-preview": "7.0.0-dev.20260217.1"
40
40
  },
@@ -51,8 +51,8 @@
51
51
  "react-dom": ">=16.8.0"
52
52
  },
53
53
  "dependencies": {
54
- "@remotion/paths": "4.0.478",
55
- "remotion": "4.0.478"
54
+ "@remotion/paths": "4.0.481",
55
+ "remotion": "4.0.481"
56
56
  },
57
57
  "homepage": "https://www.remotion.dev/docs/shapes"
58
58
  }