@remotion/shapes 4.0.475 → 4.0.477

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.
@@ -175,6 +175,7 @@ var RenderSvg = ({
175
175
  pixelDensity,
176
176
  durationInFrames,
177
177
  from,
178
+ freeze,
178
179
  hidden,
179
180
  name,
180
181
  showInTimeline,
@@ -283,6 +284,7 @@ var RenderSvg = ({
283
284
  return /* @__PURE__ */ jsx(Sequence, {
284
285
  layout: "none",
285
286
  from,
287
+ freeze,
286
288
  hidden,
287
289
  showInTimeline,
288
290
  _experimentalControls: controls,
@@ -353,6 +355,7 @@ var enumField = ({
353
355
  var makeShapeSchema = (shapeFields) => {
354
356
  return {
355
357
  from: Internals2.sequenceSchema.from,
358
+ freeze: Internals2.sequenceSchema.freeze,
356
359
  durationInFrames: Internals2.sequenceSchema.durationInFrames,
357
360
  ...shapeFields,
358
361
  fill: colorField({
@@ -423,15 +426,452 @@ var ArrowInner = ({
423
426
  };
424
427
  var Arrow = Internals3.wrapInSchema({
425
428
  Component: ArrowInner,
429
+ componentIdentity: "dev.remotion.shapes.Arrow",
426
430
  schema: arrowSchema,
427
431
  supportsEffects: true
428
432
  });
429
433
  Internals3.addSequenceStackTraces(Arrow);
430
- // src/components/circle.tsx
434
+ // src/components/callout.tsx
431
435
  import { Internals as Internals4 } from "remotion";
432
436
 
433
- // src/utils/make-circle.ts
437
+ // src/utils/make-callout.ts
434
438
  import { serializeInstructions as serializeInstructions2 } from "@remotion/paths";
439
+
440
+ // src/utils/join-points.ts
441
+ var shortenVector = (vector, radius) => {
442
+ const [x, y] = vector;
443
+ const currentLength = Math.sqrt(x * x + y * y);
444
+ const scalingFactor = (currentLength - radius) / currentLength;
445
+ return [x * scalingFactor, y * scalingFactor];
446
+ };
447
+ var scaleVectorToLength = (vector, length) => {
448
+ const [x, y] = vector;
449
+ const currentLength = Math.sqrt(x * x + y * y);
450
+ const scalingFactor = length / currentLength;
451
+ return [x * scalingFactor, y * scalingFactor];
452
+ };
453
+ var joinPoints = (points, {
454
+ edgeRoundness,
455
+ cornerRadius,
456
+ roundCornerStrategy
457
+ }) => {
458
+ return points.map(([x, y], i) => {
459
+ const prevPointIndex = i === 0 ? points.length - 2 : i - 1;
460
+ const prevPoint = points[prevPointIndex];
461
+ const nextPointIndex = i === points.length - 1 ? 1 : i + 1;
462
+ const nextPoint = points[nextPointIndex];
463
+ const middleOfLine = [(x + nextPoint[0]) / 2, (y + nextPoint[1]) / 2];
464
+ const prevPointMiddleOfLine = [
465
+ (x + prevPoint[0]) / 2,
466
+ (y + prevPoint[1]) / 2
467
+ ];
468
+ const prevVector = [x - prevPoint[0], y - prevPoint[1]];
469
+ const nextVector = [nextPoint[0] - x, nextPoint[1] - y];
470
+ if (i === 0) {
471
+ if (edgeRoundness !== null) {
472
+ return [
473
+ {
474
+ type: "M",
475
+ x: middleOfLine[0],
476
+ y: middleOfLine[1]
477
+ }
478
+ ];
479
+ }
480
+ if (cornerRadius !== 0) {
481
+ const computeRadius = shortenVector(nextVector, cornerRadius);
482
+ return [
483
+ {
484
+ type: "M",
485
+ x: computeRadius[0] + x,
486
+ y: computeRadius[1] + y
487
+ }
488
+ ];
489
+ }
490
+ return [
491
+ {
492
+ type: "M",
493
+ x,
494
+ y
495
+ }
496
+ ];
497
+ }
498
+ if (cornerRadius && edgeRoundness !== null) {
499
+ throw new Error(`"cornerRadius" and "edgeRoundness" cannot be specified at the same time.`);
500
+ }
501
+ if (edgeRoundness === null) {
502
+ if (cornerRadius === 0) {
503
+ return [
504
+ {
505
+ type: "L",
506
+ x,
507
+ y
508
+ }
509
+ ];
510
+ }
511
+ const prevVectorMinusRadius = shortenVector(prevVector, cornerRadius);
512
+ const prevVectorLength = scaleVectorToLength(prevVector, cornerRadius);
513
+ const nextVectorMinusRadius = scaleVectorToLength(nextVector, cornerRadius);
514
+ const firstDraw = [
515
+ prevPoint[0] + prevVectorMinusRadius[0],
516
+ prevPoint[1] + prevVectorMinusRadius[1]
517
+ ];
518
+ return [
519
+ {
520
+ type: "L",
521
+ x: firstDraw[0],
522
+ y: firstDraw[1]
523
+ },
524
+ roundCornerStrategy === "arc" ? {
525
+ type: "a",
526
+ rx: cornerRadius,
527
+ ry: cornerRadius,
528
+ xAxisRotation: 0,
529
+ dx: prevVectorLength[0] + nextVectorMinusRadius[0],
530
+ dy: prevVectorLength[1] + nextVectorMinusRadius[1],
531
+ largeArcFlag: false,
532
+ sweepFlag: true
533
+ } : {
534
+ type: "C",
535
+ x: firstDraw[0] + prevVectorLength[0] + nextVectorMinusRadius[0],
536
+ y: firstDraw[1] + prevVectorLength[1] + nextVectorMinusRadius[1],
537
+ cp1x: x,
538
+ cp1y: y,
539
+ cp2x: x,
540
+ cp2y: y
541
+ }
542
+ ];
543
+ }
544
+ const controlPoint1 = [
545
+ prevPointMiddleOfLine[0] + prevVector[0] * edgeRoundness * 0.5,
546
+ prevPointMiddleOfLine[1] + prevVector[1] * edgeRoundness * 0.5
547
+ ];
548
+ const controlPoint2 = [
549
+ middleOfLine[0] - nextVector[0] * edgeRoundness * 0.5,
550
+ middleOfLine[1] - nextVector[1] * edgeRoundness * 0.5
551
+ ];
552
+ return [
553
+ {
554
+ type: "C",
555
+ cp1x: controlPoint1[0],
556
+ cp1y: controlPoint1[1],
557
+ cp2x: controlPoint2[0],
558
+ cp2y: controlPoint2[1],
559
+ x: middleOfLine[0],
560
+ y: middleOfLine[1]
561
+ }
562
+ ];
563
+ }).flat(1);
564
+ };
565
+
566
+ // src/utils/make-callout.ts
567
+ var ensurePositive = (name, value) => {
568
+ if (typeof value !== "number" || value <= 0) {
569
+ throw new Error(`"${name}" must be a positive number, got ${value}`);
570
+ }
571
+ };
572
+ var pointerInterval = ({
573
+ availableLength,
574
+ pointerBaseWidth,
575
+ pointerPosition
576
+ }) => {
577
+ const center = availableLength * pointerPosition;
578
+ const half = pointerBaseWidth / 2;
579
+ return {
580
+ center,
581
+ start: Math.max(0, center - half),
582
+ end: Math.min(availableLength, center + half)
583
+ };
584
+ };
585
+ var areSamePoint = (a, b) => {
586
+ return a[0] === b[0] && a[1] === b[1];
587
+ };
588
+ var normalizeClosedPoints = (points) => {
589
+ const deduplicated = points.reduce((acc, entry) => {
590
+ const previous = acc[acc.length - 1];
591
+ if (previous && areSamePoint(previous.point, entry.point)) {
592
+ acc[acc.length - 1] = {
593
+ point: previous.point,
594
+ round: previous.round && entry.round
595
+ };
596
+ return acc;
597
+ }
598
+ return [...acc, entry];
599
+ }, []);
600
+ if (deduplicated.length === 0) {
601
+ return deduplicated;
602
+ }
603
+ const first = deduplicated[0];
604
+ const last = deduplicated[deduplicated.length - 1];
605
+ if (areSamePoint(first.point, last.point)) {
606
+ const [firstEntry, ...rest] = deduplicated;
607
+ const withoutLast = rest.slice(0, -1);
608
+ const mergedFirst = {
609
+ point: firstEntry.point,
610
+ round: firstEntry.round && last.round
611
+ };
612
+ return [mergedFirst, ...withoutLast, mergedFirst];
613
+ }
614
+ return [...deduplicated, first];
615
+ };
616
+ var unitDir2 = (from, to) => {
617
+ const dx = to[0] - from[0];
618
+ const dy = to[1] - from[1];
619
+ const len = Math.sqrt(dx * dx + dy * dy);
620
+ if (len === 0) {
621
+ return [0, 0];
622
+ }
623
+ return [dx / len, dy / len];
624
+ };
625
+ var makeInstructions = ({
626
+ points,
627
+ edgeRoundness,
628
+ cornerRadius
629
+ }) => {
630
+ const rawPoints = points.map((p) => p.point);
631
+ if (edgeRoundness !== null || cornerRadius === 0) {
632
+ return [
633
+ ...joinPoints(rawPoints, {
634
+ edgeRoundness,
635
+ cornerRadius,
636
+ roundCornerStrategy: "arc"
637
+ }),
638
+ {
639
+ type: "Z"
640
+ }
641
+ ];
642
+ }
643
+ const uniquePoints = areSamePoint(points[0].point, points[points.length - 1].point) ? points.slice(0, -1) : points;
644
+ const firstPoint = uniquePoints[0];
645
+ const startDir = firstPoint.round ? unitDir2(uniquePoints[0].point, uniquePoints[1].point) : null;
646
+ const startPoint = startDir ? [
647
+ firstPoint.point[0] + startDir[0] * cornerRadius,
648
+ firstPoint.point[1] + startDir[1] * cornerRadius
649
+ ] : firstPoint.point;
650
+ const instructions = [
651
+ { type: "M", x: startPoint[0], y: startPoint[1] }
652
+ ];
653
+ for (let i = 1;i < uniquePoints.length; i++) {
654
+ const current = uniquePoints[i];
655
+ if (!current.round) {
656
+ instructions.push({
657
+ type: "L",
658
+ x: current.point[0],
659
+ y: current.point[1]
660
+ });
661
+ continue;
662
+ }
663
+ const previous = uniquePoints[i - 1].point;
664
+ const next = uniquePoints[(i + 1) % uniquePoints.length].point;
665
+ const incoming = unitDir2(previous, current.point);
666
+ const outgoing = unitDir2(current.point, next);
667
+ const arcStart = [
668
+ current.point[0] - incoming[0] * cornerRadius,
669
+ current.point[1] - incoming[1] * cornerRadius
670
+ ];
671
+ instructions.push({
672
+ type: "L",
673
+ x: arcStart[0],
674
+ y: arcStart[1]
675
+ }, {
676
+ type: "a",
677
+ rx: cornerRadius,
678
+ ry: cornerRadius,
679
+ xAxisRotation: 0,
680
+ dx: incoming[0] * cornerRadius + outgoing[0] * cornerRadius,
681
+ dy: incoming[1] * cornerRadius + outgoing[1] * cornerRadius,
682
+ largeArcFlag: false,
683
+ sweepFlag: true
684
+ });
685
+ }
686
+ if (firstPoint.round) {
687
+ const previous = uniquePoints[uniquePoints.length - 1].point;
688
+ const incoming = unitDir2(previous, firstPoint.point);
689
+ instructions.push({
690
+ type: "L",
691
+ x: firstPoint.point[0] - incoming[0] * cornerRadius,
692
+ y: firstPoint.point[1] - incoming[1] * cornerRadius
693
+ }, {
694
+ type: "a",
695
+ rx: cornerRadius,
696
+ ry: cornerRadius,
697
+ xAxisRotation: 0,
698
+ dx: incoming[0] * cornerRadius + startDir[0] * cornerRadius,
699
+ dy: incoming[1] * cornerRadius + startDir[1] * cornerRadius,
700
+ largeArcFlag: false,
701
+ sweepFlag: true
702
+ });
703
+ }
704
+ instructions.push({ type: "Z" });
705
+ return instructions;
706
+ };
707
+ var makeCallout = ({
708
+ width = 500,
709
+ height = 200,
710
+ pointerLength = 40,
711
+ pointerBaseWidth = 60,
712
+ pointerPosition = 0.5,
713
+ pointerDirection = "down",
714
+ edgeRoundness = null,
715
+ cornerRadius = 0
716
+ }) => {
717
+ ensurePositive("width", width);
718
+ ensurePositive("height", height);
719
+ ensurePositive("pointerLength", pointerLength);
720
+ ensurePositive("pointerBaseWidth", pointerBaseWidth);
721
+ if (typeof pointerPosition !== "number" || pointerPosition < 0 || pointerPosition > 1) {
722
+ throw new Error(`"pointerPosition" must be a number between 0 and 1, got ${pointerPosition}`);
723
+ }
724
+ const horizontalInterval = pointerInterval({
725
+ availableLength: width,
726
+ pointerBaseWidth,
727
+ pointerPosition
728
+ });
729
+ const verticalInterval = pointerInterval({
730
+ availableLength: height,
731
+ pointerBaseWidth,
732
+ pointerPosition
733
+ });
734
+ const pointsByDirection = {
735
+ up: [
736
+ { point: [0, pointerLength], round: true },
737
+ { point: [horizontalInterval.start, pointerLength], round: false },
738
+ { point: [horizontalInterval.center, 0], round: false },
739
+ { point: [horizontalInterval.end, pointerLength], round: false },
740
+ { point: [width, pointerLength], round: true },
741
+ { point: [width, height + pointerLength], round: true },
742
+ { point: [0, height + pointerLength], round: true },
743
+ { point: [0, pointerLength], round: true }
744
+ ],
745
+ down: [
746
+ { point: [0, 0], round: true },
747
+ { point: [width, 0], round: true },
748
+ { point: [width, height], round: true },
749
+ { point: [horizontalInterval.end, height], round: false },
750
+ {
751
+ point: [horizontalInterval.center, height + pointerLength],
752
+ round: false
753
+ },
754
+ { point: [horizontalInterval.start, height], round: false },
755
+ { point: [0, height], round: true },
756
+ { point: [0, 0], round: true }
757
+ ],
758
+ left: [
759
+ { point: [pointerLength, 0], round: true },
760
+ { point: [width + pointerLength, 0], round: true },
761
+ { point: [width + pointerLength, height], round: true },
762
+ { point: [pointerLength, height], round: true },
763
+ { point: [pointerLength, verticalInterval.end], round: false },
764
+ { point: [0, verticalInterval.center], round: false },
765
+ { point: [pointerLength, verticalInterval.start], round: false },
766
+ { point: [pointerLength, 0], round: true }
767
+ ],
768
+ right: [
769
+ { point: [0, 0], round: true },
770
+ { point: [width, 0], round: true },
771
+ { point: [width, verticalInterval.start], round: false },
772
+ { point: [width + pointerLength, verticalInterval.center], round: false },
773
+ { point: [width, verticalInterval.end], round: false },
774
+ { point: [width, height], round: true },
775
+ { point: [0, height], round: true },
776
+ { point: [0, 0], round: true }
777
+ ]
778
+ };
779
+ const points = normalizeClosedPoints(pointsByDirection[pointerDirection]);
780
+ const instructions = makeInstructions({ points, edgeRoundness, cornerRadius });
781
+ const path = serializeInstructions2(instructions);
782
+ const shapeWidth = pointerDirection === "left" || pointerDirection === "right" ? width + pointerLength : width;
783
+ const shapeHeight = pointerDirection === "up" || pointerDirection === "down" ? height + pointerLength : height;
784
+ const bodyX = pointerDirection === "left" ? pointerLength : 0;
785
+ const bodyY = pointerDirection === "up" ? pointerLength : 0;
786
+ return {
787
+ width: shapeWidth,
788
+ height: shapeHeight,
789
+ instructions,
790
+ path,
791
+ transformOrigin: `${bodyX + width / 2} ${bodyY + height / 2}`
792
+ };
793
+ };
794
+
795
+ // src/components/callout.tsx
796
+ import { jsx as jsx3 } from "react/jsx-runtime";
797
+ var calloutSchema = makeShapeSchema({
798
+ width: numberField({
799
+ defaultValue: 500,
800
+ description: "Width",
801
+ min: 1
802
+ }),
803
+ height: numberField({
804
+ defaultValue: 200,
805
+ description: "Height",
806
+ min: 1
807
+ }),
808
+ pointerLength: numberField({
809
+ defaultValue: 40,
810
+ description: "Pointer Length",
811
+ min: 1
812
+ }),
813
+ pointerBaseWidth: numberField({
814
+ defaultValue: 60,
815
+ description: "Pointer Base Width",
816
+ min: 1
817
+ }),
818
+ pointerPosition: numberField({
819
+ defaultValue: 0.5,
820
+ description: "Pointer Position",
821
+ min: 0,
822
+ max: 1,
823
+ step: 0.01
824
+ }),
825
+ pointerDirection: enumField({
826
+ defaultValue: "down",
827
+ description: "Pointer Direction",
828
+ variants: ["up", "down", "left", "right"]
829
+ }),
830
+ cornerRadius: numberField({
831
+ defaultValue: 0,
832
+ description: "Corner Radius",
833
+ min: 0
834
+ })
835
+ });
836
+ var CalloutInner = ({
837
+ width,
838
+ height,
839
+ pointerLength,
840
+ pointerBaseWidth,
841
+ pointerPosition,
842
+ pointerDirection,
843
+ edgeRoundness,
844
+ cornerRadius,
845
+ ...props
846
+ }) => {
847
+ return /* @__PURE__ */ jsx3(RenderSvg, {
848
+ defaultName: "<Callout>",
849
+ documentationLink: "https://www.remotion.dev/docs/shapes/callout",
850
+ ...makeCallout({
851
+ width,
852
+ height,
853
+ pointerLength,
854
+ pointerBaseWidth,
855
+ pointerPosition,
856
+ pointerDirection,
857
+ edgeRoundness,
858
+ cornerRadius
859
+ }),
860
+ ...props
861
+ });
862
+ };
863
+ var Callout = Internals4.wrapInSchema({
864
+ Component: CalloutInner,
865
+ componentIdentity: "dev.remotion.shapes.Callout",
866
+ schema: calloutSchema,
867
+ supportsEffects: true
868
+ });
869
+ Internals4.addSequenceStackTraces(Callout);
870
+ // src/components/circle.tsx
871
+ import { Internals as Internals5 } from "remotion";
872
+
873
+ // src/utils/make-circle.ts
874
+ import { serializeInstructions as serializeInstructions3 } from "@remotion/paths";
435
875
  var makeCircle = ({ radius }) => {
436
876
  const instructions = [
437
877
  {
@@ -463,7 +903,7 @@ var makeCircle = ({ radius }) => {
463
903
  type: "Z"
464
904
  }
465
905
  ];
466
- const path = serializeInstructions2(instructions);
906
+ const path = serializeInstructions3(instructions);
467
907
  return {
468
908
  height: radius * 2,
469
909
  width: radius * 2,
@@ -474,7 +914,7 @@ var makeCircle = ({ radius }) => {
474
914
  };
475
915
 
476
916
  // src/components/circle.tsx
477
- import { jsx as jsx3 } from "react/jsx-runtime";
917
+ import { jsx as jsx4 } from "react/jsx-runtime";
478
918
  var circleSchema = makeShapeSchema({
479
919
  radius: numberField({
480
920
  defaultValue: 100,
@@ -483,24 +923,25 @@ var circleSchema = makeShapeSchema({
483
923
  })
484
924
  });
485
925
  var CircleInner = ({ radius, ...props }) => {
486
- return /* @__PURE__ */ jsx3(RenderSvg, {
926
+ return /* @__PURE__ */ jsx4(RenderSvg, {
487
927
  defaultName: "<Circle>",
488
928
  documentationLink: "https://www.remotion.dev/docs/shapes/circle",
489
929
  ...makeCircle({ radius }),
490
930
  ...props
491
931
  });
492
932
  };
493
- var Circle = Internals4.wrapInSchema({
933
+ var Circle = Internals5.wrapInSchema({
494
934
  Component: CircleInner,
935
+ componentIdentity: "dev.remotion.shapes.Circle",
495
936
  schema: circleSchema,
496
937
  supportsEffects: true
497
938
  });
498
- Internals4.addSequenceStackTraces(Circle);
939
+ Internals5.addSequenceStackTraces(Circle);
499
940
  // src/components/ellipse.tsx
500
- import { Internals as Internals5 } from "remotion";
941
+ import { Internals as Internals6 } from "remotion";
501
942
 
502
943
  // src/utils/make-ellipse.ts
503
- import { serializeInstructions as serializeInstructions3 } from "@remotion/paths";
944
+ import { serializeInstructions as serializeInstructions4 } from "@remotion/paths";
504
945
  var makeEllipse = ({ rx, ry }) => {
505
946
  const instructions = [
506
947
  {
@@ -522,7 +963,7 @@ var makeEllipse = ({ rx, ry }) => {
522
963
  type: "Z"
523
964
  }
524
965
  ];
525
- const path = serializeInstructions3(instructions);
966
+ const path = serializeInstructions4(instructions);
526
967
  return {
527
968
  width: rx * 2,
528
969
  height: ry * 2,
@@ -533,7 +974,7 @@ var makeEllipse = ({ rx, ry }) => {
533
974
  };
534
975
 
535
976
  // src/components/ellipse.tsx
536
- import { jsx as jsx4 } from "react/jsx-runtime";
977
+ import { jsx as jsx5 } from "react/jsx-runtime";
537
978
  var ellipseSchema = makeShapeSchema({
538
979
  rx: numberField({
539
980
  defaultValue: 100,
@@ -547,24 +988,25 @@ var ellipseSchema = makeShapeSchema({
547
988
  })
548
989
  });
549
990
  var EllipseInner = ({ rx, ry, ...props }) => {
550
- return /* @__PURE__ */ jsx4(RenderSvg, {
991
+ return /* @__PURE__ */ jsx5(RenderSvg, {
551
992
  defaultName: "<Ellipse>",
552
993
  documentationLink: "https://www.remotion.dev/docs/shapes/ellipse",
553
994
  ...makeEllipse({ rx, ry }),
554
995
  ...props
555
996
  });
556
997
  };
557
- var Ellipse = Internals5.wrapInSchema({
998
+ var Ellipse = Internals6.wrapInSchema({
558
999
  Component: EllipseInner,
1000
+ componentIdentity: "dev.remotion.shapes.Ellipse",
559
1001
  schema: ellipseSchema,
560
1002
  supportsEffects: true
561
1003
  });
562
- Internals5.addSequenceStackTraces(Ellipse);
1004
+ Internals6.addSequenceStackTraces(Ellipse);
563
1005
  // src/components/heart.tsx
564
- import { Internals as Internals6 } from "remotion";
1006
+ import { Internals as Internals7 } from "remotion";
565
1007
 
566
1008
  // src/utils/make-heart.ts
567
- import { serializeInstructions as serializeInstructions4 } from "@remotion/paths";
1009
+ import { serializeInstructions as serializeInstructions5 } from "@remotion/paths";
568
1010
  var makeHeart = ({
569
1011
  height,
570
1012
  aspectRatio = 1.1,
@@ -645,7 +1087,7 @@ var makeHeart = ({
645
1087
  type: "Z"
646
1088
  }
647
1089
  ];
648
- const path = serializeInstructions4(instructions);
1090
+ const path = serializeInstructions5(instructions);
649
1091
  return {
650
1092
  path,
651
1093
  width,
@@ -656,7 +1098,7 @@ var makeHeart = ({
656
1098
  };
657
1099
 
658
1100
  // src/components/heart.tsx
659
- import { jsx as jsx5 } from "react/jsx-runtime";
1101
+ import { jsx as jsx6 } from "react/jsx-runtime";
660
1102
  var heartSchema = makeShapeSchema({
661
1103
  height: numberField({
662
1104
  defaultValue: 100,
@@ -687,7 +1129,7 @@ var HeartInner = ({
687
1129
  depthAdjustment = 0,
688
1130
  ...props
689
1131
  }) => {
690
- return /* @__PURE__ */ jsx5(RenderSvg, {
1132
+ return /* @__PURE__ */ jsx6(RenderSvg, {
691
1133
  defaultName: "<Heart>",
692
1134
  documentationLink: "https://www.remotion.dev/docs/shapes/heart",
693
1135
  ...makeHeart({
@@ -699,17 +1141,18 @@ var HeartInner = ({
699
1141
  ...props
700
1142
  });
701
1143
  };
702
- var Heart = Internals6.wrapInSchema({
1144
+ var Heart = Internals7.wrapInSchema({
703
1145
  Component: HeartInner,
1146
+ componentIdentity: "dev.remotion.shapes.Heart",
704
1147
  schema: heartSchema,
705
1148
  supportsEffects: true
706
1149
  });
707
- Internals6.addSequenceStackTraces(Heart);
1150
+ Internals7.addSequenceStackTraces(Heart);
708
1151
  // src/components/pie.tsx
709
- import { Internals as Internals7 } from "remotion";
1152
+ import { Internals as Internals8 } from "remotion";
710
1153
 
711
1154
  // src/utils/make-pie.ts
712
- import { serializeInstructions as serializeInstructions5 } from "@remotion/paths";
1155
+ import { serializeInstructions as serializeInstructions6 } from "@remotion/paths";
713
1156
  var getCoord = ({
714
1157
  counterClockwise,
715
1158
  actualProgress,
@@ -806,7 +1249,7 @@ var makePie = ({
806
1249
  type: "Z"
807
1250
  } : null
808
1251
  ].filter(Boolean);
809
- const path = serializeInstructions5(instructions);
1252
+ const path = serializeInstructions6(instructions);
810
1253
  return {
811
1254
  height: radius * 2,
812
1255
  width: radius * 2,
@@ -817,7 +1260,7 @@ var makePie = ({
817
1260
  };
818
1261
 
819
1262
  // src/components/pie.tsx
820
- import { jsx as jsx6 } from "react/jsx-runtime";
1263
+ import { jsx as jsx7 } from "react/jsx-runtime";
821
1264
  var pieSchema = makeShapeSchema({
822
1265
  radius: numberField({
823
1266
  defaultValue: 100,
@@ -853,157 +1296,30 @@ var PieInner = ({
853
1296
  rotation,
854
1297
  ...props
855
1298
  }) => {
856
- return /* @__PURE__ */ jsx6(RenderSvg, {
1299
+ return /* @__PURE__ */ jsx7(RenderSvg, {
857
1300
  defaultName: "<Pie>",
858
1301
  documentationLink: "https://www.remotion.dev/docs/shapes/pie",
859
1302
  ...makePie({ radius, progress, closePath, counterClockwise, rotation }),
860
1303
  ...props
861
1304
  });
862
1305
  };
863
- var Pie = Internals7.wrapInSchema({
1306
+ var Pie = Internals8.wrapInSchema({
864
1307
  Component: PieInner,
1308
+ componentIdentity: "dev.remotion.shapes.Pie",
865
1309
  schema: pieSchema,
866
1310
  supportsEffects: true
867
1311
  });
868
- Internals7.addSequenceStackTraces(Pie);
1312
+ Internals8.addSequenceStackTraces(Pie);
869
1313
  // src/components/polygon.tsx
870
- import { Internals as Internals8 } from "remotion";
1314
+ import { Internals as Internals9 } from "remotion";
871
1315
 
872
1316
  // src/utils/make-polygon.ts
873
1317
  import {
874
1318
  PathInternals,
875
1319
  reduceInstructions,
876
1320
  resetPath,
877
- serializeInstructions as serializeInstructions6
1321
+ serializeInstructions as serializeInstructions7
878
1322
  } from "@remotion/paths";
879
-
880
- // src/utils/join-points.ts
881
- var shortenVector = (vector, radius) => {
882
- const [x, y] = vector;
883
- const currentLength = Math.sqrt(x * x + y * y);
884
- const scalingFactor = (currentLength - radius) / currentLength;
885
- return [x * scalingFactor, y * scalingFactor];
886
- };
887
- var scaleVectorToLength = (vector, length) => {
888
- const [x, y] = vector;
889
- const currentLength = Math.sqrt(x * x + y * y);
890
- const scalingFactor = length / currentLength;
891
- return [x * scalingFactor, y * scalingFactor];
892
- };
893
- var joinPoints = (points, {
894
- edgeRoundness,
895
- cornerRadius,
896
- roundCornerStrategy
897
- }) => {
898
- return points.map(([x, y], i) => {
899
- const prevPointIndex = i === 0 ? points.length - 2 : i - 1;
900
- const prevPoint = points[prevPointIndex];
901
- const nextPointIndex = i === points.length - 1 ? 1 : i + 1;
902
- const nextPoint = points[nextPointIndex];
903
- const middleOfLine = [(x + nextPoint[0]) / 2, (y + nextPoint[1]) / 2];
904
- const prevPointMiddleOfLine = [
905
- (x + prevPoint[0]) / 2,
906
- (y + prevPoint[1]) / 2
907
- ];
908
- const prevVector = [x - prevPoint[0], y - prevPoint[1]];
909
- const nextVector = [nextPoint[0] - x, nextPoint[1] - y];
910
- if (i === 0) {
911
- if (edgeRoundness !== null) {
912
- return [
913
- {
914
- type: "M",
915
- x: middleOfLine[0],
916
- y: middleOfLine[1]
917
- }
918
- ];
919
- }
920
- if (cornerRadius !== 0) {
921
- const computeRadius = shortenVector(nextVector, cornerRadius);
922
- return [
923
- {
924
- type: "M",
925
- x: computeRadius[0] + x,
926
- y: computeRadius[1] + y
927
- }
928
- ];
929
- }
930
- return [
931
- {
932
- type: "M",
933
- x,
934
- y
935
- }
936
- ];
937
- }
938
- if (cornerRadius && edgeRoundness !== null) {
939
- throw new Error(`"cornerRadius" and "edgeRoundness" cannot be specified at the same time.`);
940
- }
941
- if (edgeRoundness === null) {
942
- if (cornerRadius === 0) {
943
- return [
944
- {
945
- type: "L",
946
- x,
947
- y
948
- }
949
- ];
950
- }
951
- const prevVectorMinusRadius = shortenVector(prevVector, cornerRadius);
952
- const prevVectorLength = scaleVectorToLength(prevVector, cornerRadius);
953
- const nextVectorMinusRadius = scaleVectorToLength(nextVector, cornerRadius);
954
- const firstDraw = [
955
- prevPoint[0] + prevVectorMinusRadius[0],
956
- prevPoint[1] + prevVectorMinusRadius[1]
957
- ];
958
- return [
959
- {
960
- type: "L",
961
- x: firstDraw[0],
962
- y: firstDraw[1]
963
- },
964
- roundCornerStrategy === "arc" ? {
965
- type: "a",
966
- rx: cornerRadius,
967
- ry: cornerRadius,
968
- xAxisRotation: 0,
969
- dx: prevVectorLength[0] + nextVectorMinusRadius[0],
970
- dy: prevVectorLength[1] + nextVectorMinusRadius[1],
971
- largeArcFlag: false,
972
- sweepFlag: true
973
- } : {
974
- type: "C",
975
- x: firstDraw[0] + prevVectorLength[0] + nextVectorMinusRadius[0],
976
- y: firstDraw[1] + prevVectorLength[1] + nextVectorMinusRadius[1],
977
- cp1x: x,
978
- cp1y: y,
979
- cp2x: x,
980
- cp2y: y
981
- }
982
- ];
983
- }
984
- const controlPoint1 = [
985
- prevPointMiddleOfLine[0] + prevVector[0] * edgeRoundness * 0.5,
986
- prevPointMiddleOfLine[1] + prevVector[1] * edgeRoundness * 0.5
987
- ];
988
- const controlPoint2 = [
989
- middleOfLine[0] - nextVector[0] * edgeRoundness * 0.5,
990
- middleOfLine[1] - nextVector[1] * edgeRoundness * 0.5
991
- ];
992
- return [
993
- {
994
- type: "C",
995
- cp1x: controlPoint1[0],
996
- cp1y: controlPoint1[1],
997
- cp2x: controlPoint2[0],
998
- cp2y: controlPoint2[1],
999
- x: middleOfLine[0],
1000
- y: middleOfLine[1]
1001
- }
1002
- ];
1003
- }).flat(1);
1004
- };
1005
-
1006
- // src/utils/make-polygon.ts
1007
1323
  function polygon({
1008
1324
  points,
1009
1325
  radius,
@@ -1049,7 +1365,7 @@ var makePolygon = ({
1049
1365
  edgeRoundness
1050
1366
  });
1051
1367
  const reduced = reduceInstructions(polygonPathInstructions);
1052
- const path = resetPath(serializeInstructions6(reduced));
1368
+ const path = resetPath(serializeInstructions7(reduced));
1053
1369
  const boundingBox = PathInternals.getBoundingBoxFromInstructions(reduced);
1054
1370
  return {
1055
1371
  path,
@@ -1061,7 +1377,7 @@ var makePolygon = ({
1061
1377
  };
1062
1378
 
1063
1379
  // src/components/polygon.tsx
1064
- import { jsx as jsx7 } from "react/jsx-runtime";
1380
+ import { jsx as jsx8 } from "react/jsx-runtime";
1065
1381
  var polygonSchema = makeShapeSchema({
1066
1382
  points: numberField({
1067
1383
  defaultValue: 5,
@@ -1087,7 +1403,7 @@ var PolygonInner = ({
1087
1403
  edgeRoundness,
1088
1404
  ...props
1089
1405
  }) => {
1090
- return /* @__PURE__ */ jsx7(RenderSvg, {
1406
+ return /* @__PURE__ */ jsx8(RenderSvg, {
1091
1407
  defaultName: "<Polygon>",
1092
1408
  documentationLink: "https://www.remotion.dev/docs/shapes/polygon",
1093
1409
  ...makePolygon({
@@ -1099,17 +1415,18 @@ var PolygonInner = ({
1099
1415
  ...props
1100
1416
  });
1101
1417
  };
1102
- var Polygon = Internals8.wrapInSchema({
1418
+ var Polygon = Internals9.wrapInSchema({
1103
1419
  Component: PolygonInner,
1420
+ componentIdentity: "dev.remotion.shapes.Polygon",
1104
1421
  schema: polygonSchema,
1105
1422
  supportsEffects: true
1106
1423
  });
1107
- Internals8.addSequenceStackTraces(Polygon);
1424
+ Internals9.addSequenceStackTraces(Polygon);
1108
1425
  // src/components/rect.tsx
1109
- import { Internals as Internals9 } from "remotion";
1426
+ import { Internals as Internals10 } from "remotion";
1110
1427
 
1111
1428
  // src/utils/make-rect.ts
1112
- import { serializeInstructions as serializeInstructions7 } from "@remotion/paths";
1429
+ import { serializeInstructions as serializeInstructions8 } from "@remotion/paths";
1113
1430
  var makeRect = ({
1114
1431
  width,
1115
1432
  height,
@@ -1129,7 +1446,7 @@ var makeRect = ({
1129
1446
  type: "Z"
1130
1447
  }
1131
1448
  ];
1132
- const path = serializeInstructions7(instructions);
1449
+ const path = serializeInstructions8(instructions);
1133
1450
  return {
1134
1451
  width,
1135
1452
  height,
@@ -1140,7 +1457,7 @@ var makeRect = ({
1140
1457
  };
1141
1458
 
1142
1459
  // src/components/rect.tsx
1143
- import { jsx as jsx8 } from "react/jsx-runtime";
1460
+ import { jsx as jsx9 } from "react/jsx-runtime";
1144
1461
  var rectSchema = makeShapeSchema({
1145
1462
  width: numberField({
1146
1463
  defaultValue: 100,
@@ -1165,28 +1482,29 @@ var RectInner = ({
1165
1482
  cornerRadius,
1166
1483
  ...props
1167
1484
  }) => {
1168
- return /* @__PURE__ */ jsx8(RenderSvg, {
1485
+ return /* @__PURE__ */ jsx9(RenderSvg, {
1169
1486
  defaultName: "<Rect>",
1170
1487
  documentationLink: "https://www.remotion.dev/docs/shapes/rect",
1171
1488
  ...makeRect({ height, width, edgeRoundness, cornerRadius }),
1172
1489
  ...props
1173
1490
  });
1174
1491
  };
1175
- var Rect = Internals9.wrapInSchema({
1492
+ var Rect = Internals10.wrapInSchema({
1176
1493
  Component: RectInner,
1494
+ componentIdentity: "dev.remotion.shapes.Rect",
1177
1495
  schema: rectSchema,
1178
1496
  supportsEffects: true
1179
1497
  });
1180
- Internals9.addSequenceStackTraces(Rect);
1498
+ Internals10.addSequenceStackTraces(Rect);
1181
1499
  // src/components/star.tsx
1182
- import { Internals as Internals10 } from "remotion";
1500
+ import { Internals as Internals11 } from "remotion";
1183
1501
 
1184
1502
  // src/utils/make-star.ts
1185
1503
  import {
1186
1504
  PathInternals as PathInternals2,
1187
1505
  reduceInstructions as reduceInstructions2,
1188
1506
  resetPath as resetPath2,
1189
- serializeInstructions as serializeInstructions8
1507
+ serializeInstructions as serializeInstructions9
1190
1508
  } from "@remotion/paths";
1191
1509
  var star = ({
1192
1510
  centerX,
@@ -1237,7 +1555,7 @@ var makeStar = ({
1237
1555
  edgeRoundness
1238
1556
  });
1239
1557
  const reduced = reduceInstructions2(starPathInstructions);
1240
- const path = resetPath2(serializeInstructions8(reduced));
1558
+ const path = resetPath2(serializeInstructions9(reduced));
1241
1559
  const boundingBox = PathInternals2.getBoundingBoxFromInstructions(reduced);
1242
1560
  return {
1243
1561
  path,
@@ -1249,7 +1567,7 @@ var makeStar = ({
1249
1567
  };
1250
1568
 
1251
1569
  // src/components/star.tsx
1252
- import { jsx as jsx9 } from "react/jsx-runtime";
1570
+ import { jsx as jsx10 } from "react/jsx-runtime";
1253
1571
  var starSchema = makeShapeSchema({
1254
1572
  points: numberField({
1255
1573
  defaultValue: 5,
@@ -1281,7 +1599,7 @@ var StarInner = ({
1281
1599
  edgeRoundness,
1282
1600
  ...props
1283
1601
  }) => {
1284
- return /* @__PURE__ */ jsx9(RenderSvg, {
1602
+ return /* @__PURE__ */ jsx10(RenderSvg, {
1285
1603
  defaultName: "<Star>",
1286
1604
  documentationLink: "https://www.remotion.dev/docs/shapes/star",
1287
1605
  ...makeStar({
@@ -1294,17 +1612,18 @@ var StarInner = ({
1294
1612
  ...props
1295
1613
  });
1296
1614
  };
1297
- var Star = Internals10.wrapInSchema({
1615
+ var Star = Internals11.wrapInSchema({
1298
1616
  Component: StarInner,
1617
+ componentIdentity: "dev.remotion.shapes.Star",
1299
1618
  schema: starSchema,
1300
1619
  supportsEffects: true
1301
1620
  });
1302
- Internals10.addSequenceStackTraces(Star);
1621
+ Internals11.addSequenceStackTraces(Star);
1303
1622
  // src/components/triangle.tsx
1304
- import { Internals as Internals11 } from "remotion";
1623
+ import { Internals as Internals12 } from "remotion";
1305
1624
 
1306
1625
  // src/utils/make-triangle.ts
1307
- import { serializeInstructions as serializeInstructions9 } from "@remotion/paths";
1626
+ import { serializeInstructions as serializeInstructions10 } from "@remotion/paths";
1308
1627
  var makeTriangle = ({
1309
1628
  length,
1310
1629
  direction = "right",
@@ -1364,7 +1683,7 @@ var makeTriangle = ({
1364
1683
  type: "Z"
1365
1684
  }
1366
1685
  ];
1367
- const path = serializeInstructions9(instructions);
1686
+ const path = serializeInstructions10(instructions);
1368
1687
  return {
1369
1688
  path,
1370
1689
  instructions,
@@ -1375,7 +1694,7 @@ var makeTriangle = ({
1375
1694
  };
1376
1695
 
1377
1696
  // src/components/triangle.tsx
1378
- import { jsx as jsx10 } from "react/jsx-runtime";
1697
+ import { jsx as jsx11 } from "react/jsx-runtime";
1379
1698
  var triangleSchema = makeShapeSchema({
1380
1699
  length: numberField({
1381
1700
  defaultValue: 100,
@@ -1400,19 +1719,20 @@ var TriangleInner = ({
1400
1719
  cornerRadius,
1401
1720
  ...props
1402
1721
  }) => {
1403
- return /* @__PURE__ */ jsx10(RenderSvg, {
1722
+ return /* @__PURE__ */ jsx11(RenderSvg, {
1404
1723
  defaultName: "<Triangle>",
1405
1724
  documentationLink: "https://www.remotion.dev/docs/shapes/triangle",
1406
1725
  ...makeTriangle({ length, direction, edgeRoundness, cornerRadius }),
1407
1726
  ...props
1408
1727
  });
1409
1728
  };
1410
- var Triangle = Internals11.wrapInSchema({
1729
+ var Triangle = Internals12.wrapInSchema({
1411
1730
  Component: TriangleInner,
1731
+ componentIdentity: "dev.remotion.shapes.Triangle",
1412
1732
  schema: triangleSchema,
1413
1733
  supportsEffects: true
1414
1734
  });
1415
- Internals11.addSequenceStackTraces(Triangle);
1735
+ Internals12.addSequenceStackTraces(Triangle);
1416
1736
  export {
1417
1737
  makeTriangle,
1418
1738
  makeStar,
@@ -1422,6 +1742,7 @@ export {
1422
1742
  makeHeart,
1423
1743
  makeEllipse,
1424
1744
  makeCircle,
1745
+ makeCallout,
1425
1746
  makeArrow,
1426
1747
  Triangle,
1427
1748
  Star,
@@ -1431,5 +1752,6 @@ export {
1431
1752
  Heart,
1432
1753
  Ellipse,
1433
1754
  Circle,
1755
+ Callout,
1434
1756
  Arrow
1435
1757
  };