framer-api 0.1.4-alpha.2 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/index.d.ts +566 -173
- package/dist/index.js +2 -2
- package/package.json +5 -7
package/dist/index.d.ts
CHANGED
|
@@ -386,6 +386,10 @@ interface WithUnsupportedComputedValueClass {
|
|
|
386
386
|
[classKey]: typeof unsupportedComputedValueClass;
|
|
387
387
|
}
|
|
388
388
|
type UnsupportedComputedValueData = WithUnsupportedComputedValueClass;
|
|
389
|
+
/**
|
|
390
|
+
* A computed value type not yet supported by the plugin API.
|
|
391
|
+
* @category canvas
|
|
392
|
+
*/
|
|
389
393
|
declare class UnsupportedComputedValue extends ComputedValueBase {
|
|
390
394
|
#private;
|
|
391
395
|
readonly type = "unsupported";
|
|
@@ -426,7 +430,10 @@ declare const fontWeights: readonly [100, 200, 300, 400, 500, 600, 700, 800, 900
|
|
|
426
430
|
* - `900` - Black (Heavy)
|
|
427
431
|
* */
|
|
428
432
|
type FontWeight = (typeof fontWeights)[number];
|
|
429
|
-
/**
|
|
433
|
+
/**
|
|
434
|
+
* A font available in the project, including custom uploaded fonts.
|
|
435
|
+
* @category canvas
|
|
436
|
+
*/
|
|
430
437
|
declare class Font {
|
|
431
438
|
/** An identifier used internally for differentiating fonts. */
|
|
432
439
|
readonly selector: string;
|
|
@@ -738,6 +745,7 @@ interface IsComponentGestureVariant extends IsComponentVariant {
|
|
|
738
745
|
interface WithNameTrait {
|
|
739
746
|
/**
|
|
740
747
|
* The name of the node displayed in the layers panel.
|
|
748
|
+
*
|
|
741
749
|
* Supported by FrameNode, TextNode, SVGNode, ComponentInstanceNode,
|
|
742
750
|
* ComponentNode, VectorSetNode, VectorSetItemNode.
|
|
743
751
|
*/
|
|
@@ -745,14 +753,18 @@ interface WithNameTrait {
|
|
|
745
753
|
}
|
|
746
754
|
interface WithVisibleTrait {
|
|
747
755
|
/**
|
|
748
|
-
* Whether the node is visible on the canvas.
|
|
756
|
+
* Whether the node is visible on the canvas.
|
|
757
|
+
*
|
|
758
|
+
* Defaults to `true`.
|
|
749
759
|
* Supported by FrameNode, TextNode, SVGNode, ComponentInstanceNode, VectorSetItemNode.
|
|
750
760
|
*/
|
|
751
761
|
readonly visible: boolean;
|
|
752
762
|
}
|
|
753
763
|
interface WithLockedTrait {
|
|
754
764
|
/**
|
|
755
|
-
* Whether the node is locked for editing.
|
|
765
|
+
* Whether the node is locked for editing.
|
|
766
|
+
*
|
|
767
|
+
* Defaults to `false`.
|
|
756
768
|
* Supported by FrameNode, TextNode, SVGNode, ComponentInstanceNode, VectorSetItemNode.
|
|
757
769
|
*/
|
|
758
770
|
readonly locked: boolean;
|
|
@@ -770,6 +782,7 @@ interface IsBreakpoint {
|
|
|
770
782
|
interface WithBackgroundColorTrait<T extends TraitVariant> {
|
|
771
783
|
/**
|
|
772
784
|
* Background color in RGBA format (e.g. `rgba(242, 59, 57, 1)`) or as a {@link ColorStyle} instance.
|
|
785
|
+
*
|
|
773
786
|
* Setting to `null` removes the background color. Supported by FrameNode.
|
|
774
787
|
*/
|
|
775
788
|
readonly backgroundColor: (T extends TraitVariantData ? ColorStyleData : ColorStyle) | string | null;
|
|
@@ -784,22 +797,26 @@ interface WithBackgroundGradientTrait<T extends TraitVariant> {
|
|
|
784
797
|
}
|
|
785
798
|
interface WithRotationTrait {
|
|
786
799
|
/**
|
|
787
|
-
* Rotation angle in degrees.
|
|
788
|
-
*
|
|
800
|
+
* Rotation angle in degrees.
|
|
801
|
+
*
|
|
802
|
+
* Defaults to `0`. Supported by FrameNode, TextNode, SVGNode, ComponentInstanceNode.
|
|
789
803
|
*/
|
|
790
804
|
readonly rotation: number;
|
|
791
805
|
}
|
|
792
806
|
interface WithOpacityTrait {
|
|
793
807
|
/**
|
|
794
|
-
* Opacity of the node, from `0` (fully transparent) to `1` (fully opaque).
|
|
795
|
-
*
|
|
808
|
+
* Opacity of the node, from `0` (fully transparent) to `1` (fully opaque).
|
|
809
|
+
*
|
|
810
|
+
* Defaults to `1`. Supported by FrameNode, TextNode, SVGNode, ComponentInstanceNode.
|
|
796
811
|
*/
|
|
797
812
|
readonly opacity: number;
|
|
798
813
|
}
|
|
799
814
|
type BorderRadius = CSSDimension<CSSUnit.Percentage | CSSUnit.Pixel> | `${CSSDimension<CSSUnit.Pixel>} ${CSSDimension<CSSUnit.Pixel>} ${CSSDimension<CSSUnit.Pixel>} ${CSSDimension<CSSUnit.Pixel>}` | null;
|
|
800
815
|
interface WithBorderRadiusTrait {
|
|
801
816
|
/**
|
|
802
|
-
* Border radius for rounded corners.
|
|
817
|
+
* Border radius for rounded corners.
|
|
818
|
+
*
|
|
819
|
+
* Single value (e.g. `"10px"` or `"50%"`)
|
|
803
820
|
* or per-corner (e.g. `"10px 20px 30px 40px"` for top-left, top-right, bottom-right, bottom-left).
|
|
804
821
|
* Setting to `null` removes the border radius. Supported by FrameNode.
|
|
805
822
|
*/
|
|
@@ -815,6 +832,7 @@ interface Border {
|
|
|
815
832
|
interface WithBorderTrait<T extends TraitVariant> {
|
|
816
833
|
/**
|
|
817
834
|
* Border properties including width, color, and style.
|
|
835
|
+
*
|
|
818
836
|
* Styles: `"solid"`, `"dashed"`, `"dotted"`, `"double"`.
|
|
819
837
|
* Width can be per-side (e.g. `"1px 2px 3px 4px"`).
|
|
820
838
|
* Setting to `null` removes the border. Supported by FrameNode.
|
|
@@ -826,6 +844,7 @@ type ImageRendering = "auto" | "pixelated";
|
|
|
826
844
|
interface WithImageRenderingTrait {
|
|
827
845
|
/**
|
|
828
846
|
* How images should be rendered when scaled: `"auto"` or `"pixelated"`.
|
|
847
|
+
*
|
|
829
848
|
* Only applies to frames with image backgrounds.
|
|
830
849
|
* Setting to `null` uses default rendering. Supported by FrameNode.
|
|
831
850
|
*/
|
|
@@ -837,24 +856,28 @@ type AxisOverflow = Overflow;
|
|
|
837
856
|
interface WithOverflowTrait {
|
|
838
857
|
/**
|
|
839
858
|
* Controls how content that exceeds the element's box is handled.
|
|
859
|
+
*
|
|
840
860
|
* Setting to `null` removes the overflow property. Will overwrite `overflowX` or `overflowY`.
|
|
841
861
|
* Supported by FrameNode, TextNode.
|
|
842
862
|
*/
|
|
843
863
|
readonly overflow: Overflow | null;
|
|
844
864
|
/**
|
|
845
865
|
* Controls horizontal overflow behavior.
|
|
866
|
+
*
|
|
846
867
|
* Setting to `null` removes the overflow X property. Supported by FrameNode, TextNode.
|
|
847
868
|
*/
|
|
848
869
|
readonly overflowX: AxisOverflow | null;
|
|
849
870
|
/**
|
|
850
871
|
* Controls vertical overflow behavior.
|
|
872
|
+
*
|
|
851
873
|
* Setting to `null` removes the overflow Y property. Supported by FrameNode, TextNode.
|
|
852
874
|
*/
|
|
853
875
|
readonly overflowY: AxisOverflow | null;
|
|
854
876
|
}
|
|
855
877
|
interface WithTextTruncationTrait {
|
|
856
878
|
/**
|
|
857
|
-
* Maximum number of lines
|
|
879
|
+
* Maximum number of lines before text is truncated with an ellipsis.
|
|
880
|
+
*
|
|
858
881
|
* Must be used alongside `overflow`. Setting to `null` removes the text truncation property.
|
|
859
882
|
* Supported by TextNode.
|
|
860
883
|
*/
|
|
@@ -862,7 +885,9 @@ interface WithTextTruncationTrait {
|
|
|
862
885
|
}
|
|
863
886
|
interface WithZIndexTrait {
|
|
864
887
|
/**
|
|
865
|
-
* Stacking order of positioned elements.
|
|
888
|
+
* Stacking order of positioned elements.
|
|
889
|
+
*
|
|
890
|
+
* Higher values appear on top of lower values.
|
|
866
891
|
* Setting to `null` removes the z-index property. Supported by FrameNode, TextNode.
|
|
867
892
|
*/
|
|
868
893
|
readonly zIndex: number | null;
|
|
@@ -888,13 +913,17 @@ interface WithWebPageInfoTrait {
|
|
|
888
913
|
type SupportedLinkRelValue = "nofollow" | "noreferrer" | "me" | "ugc" | "sponsored";
|
|
889
914
|
interface WithLinkTrait {
|
|
890
915
|
/**
|
|
891
|
-
* URL or internal page link.
|
|
916
|
+
* URL or internal page link.
|
|
917
|
+
*
|
|
918
|
+
* External: `"https://example.com"`, internal: `"/about"`,
|
|
892
919
|
* email: `"mailto:user@example.com"`. Setting to `null` removes the link.
|
|
893
920
|
* Supported by FrameNode, TextNode.
|
|
894
921
|
*/
|
|
895
922
|
readonly link: string | null;
|
|
896
923
|
/**
|
|
897
|
-
* Whether to open the link in a new tab.
|
|
924
|
+
* Whether to open the link in a new tab.
|
|
925
|
+
*
|
|
926
|
+
* Default is automatically determined based on link type.
|
|
898
927
|
* Supported by FrameNode, TextNode.
|
|
899
928
|
*/
|
|
900
929
|
readonly linkOpenInNewTab: boolean | null;
|
|
@@ -947,36 +976,42 @@ type FitImage = "fit-image";
|
|
|
947
976
|
interface WithPinsTrait {
|
|
948
977
|
/**
|
|
949
978
|
* Distance from top edge when using absolute/fixed positioning.
|
|
979
|
+
*
|
|
950
980
|
* Only applies when position is not `"relative"`.
|
|
951
981
|
* Supported by FrameNode, TextNode, SVGNode, ComponentInstanceNode, VectorSetItemNode.
|
|
952
982
|
*/
|
|
953
983
|
top: CSSDimension<CSSUnit.Pixel> | null;
|
|
954
984
|
/**
|
|
955
985
|
* Distance from right edge when using absolute/fixed positioning.
|
|
986
|
+
*
|
|
956
987
|
* Only applies when position is not `"relative"`.
|
|
957
988
|
* Supported by FrameNode, TextNode, SVGNode, ComponentInstanceNode, VectorSetItemNode.
|
|
958
989
|
*/
|
|
959
990
|
right: CSSDimension<CSSUnit.Pixel> | null;
|
|
960
991
|
/**
|
|
961
992
|
* Distance from bottom edge when using absolute/fixed positioning.
|
|
993
|
+
*
|
|
962
994
|
* Only applies when position is not `"relative"`.
|
|
963
995
|
* Supported by FrameNode, TextNode, SVGNode, ComponentInstanceNode, VectorSetItemNode.
|
|
964
996
|
*/
|
|
965
997
|
bottom: CSSDimension<CSSUnit.Pixel> | null;
|
|
966
998
|
/**
|
|
967
999
|
* Distance from left edge when using absolute/fixed positioning.
|
|
1000
|
+
*
|
|
968
1001
|
* Only applies when position is not `"relative"`.
|
|
969
1002
|
* Supported by FrameNode, TextNode, SVGNode, ComponentInstanceNode, VectorSetItemNode.
|
|
970
1003
|
*/
|
|
971
1004
|
left: CSSDimension<CSSUnit.Pixel> | null;
|
|
972
1005
|
/**
|
|
973
1006
|
* Center anchor horizontal position as percentage (e.g. `"50%"`).
|
|
1007
|
+
*
|
|
974
1008
|
* Used when pins are not set.
|
|
975
1009
|
* Supported by FrameNode, TextNode, SVGNode, ComponentInstanceNode, VectorSetItemNode.
|
|
976
1010
|
*/
|
|
977
1011
|
centerX: CSSDimension<CSSUnit.Percentage> | null;
|
|
978
1012
|
/**
|
|
979
1013
|
* Center anchor vertical position as percentage (e.g. `"50%"`).
|
|
1014
|
+
*
|
|
980
1015
|
* Used when pins are not set.
|
|
981
1016
|
* Supported by FrameNode, TextNode, SVGNode, ComponentInstanceNode, VectorSetItemNode.
|
|
982
1017
|
*/
|
|
@@ -987,12 +1022,16 @@ type WidthLength = Length | FitContent | FitImage;
|
|
|
987
1022
|
type HeightLength = Length | FitContent | CSSDimension<CSSUnit.ViewportHeight> | FitImage;
|
|
988
1023
|
interface WithSizeTrait {
|
|
989
1024
|
/**
|
|
990
|
-
* Width of the node.
|
|
1025
|
+
* Width of the node.
|
|
1026
|
+
*
|
|
1027
|
+
* Accepts pixel, percentage, fraction values, or `"fit-content"`.
|
|
991
1028
|
* Supported by FrameNode, TextNode, SVGNode, ComponentInstanceNode, VectorSetItemNode.
|
|
992
1029
|
*/
|
|
993
1030
|
width: WidthLength | null;
|
|
994
1031
|
/**
|
|
995
|
-
* Height of the node.
|
|
1032
|
+
* Height of the node.
|
|
1033
|
+
*
|
|
1034
|
+
* Accepts pixel, percentage, fraction, viewport-height values, or `"fit-content"`.
|
|
996
1035
|
* Supported by FrameNode, TextNode, SVGNode, ComponentInstanceNode, VectorSetItemNode.
|
|
997
1036
|
*/
|
|
998
1037
|
height: HeightLength | null;
|
|
@@ -1000,6 +1039,7 @@ interface WithSizeTrait {
|
|
|
1000
1039
|
interface WithAspectRatioTrait {
|
|
1001
1040
|
/**
|
|
1002
1041
|
* Width-to-height ratio (e.g. `1.5` for 3:2).
|
|
1042
|
+
*
|
|
1003
1043
|
* Setting to `null` removes the aspect ratio constraint.
|
|
1004
1044
|
* Supported by FrameNode, ComponentInstanceNode.
|
|
1005
1045
|
*/
|
|
@@ -1019,8 +1059,9 @@ interface WithSizeConstraintsTrait {
|
|
|
1019
1059
|
}
|
|
1020
1060
|
interface WithInlineTextStyleTrait<T extends TraitVariant> {
|
|
1021
1061
|
/**
|
|
1022
|
-
* Apply a text style preset.
|
|
1023
|
-
*
|
|
1062
|
+
* Apply a text style preset.
|
|
1063
|
+
*
|
|
1064
|
+
* Setting to `null` removes the text style. Supported by TextNode.
|
|
1024
1065
|
*/
|
|
1025
1066
|
readonly inlineTextStyle: (T extends TraitVariantData ? TextStyleData : TextStyle) | null;
|
|
1026
1067
|
}
|
|
@@ -1069,18 +1110,24 @@ interface GridLayout {
|
|
|
1069
1110
|
}
|
|
1070
1111
|
interface WithLayoutTrait extends StackLayout, GridLayout {
|
|
1071
1112
|
/**
|
|
1072
|
-
* Enables stack or grid layout.
|
|
1113
|
+
* Enables stack or grid layout.
|
|
1114
|
+
*
|
|
1115
|
+
* Setting to `null` disables any applied layout.
|
|
1073
1116
|
* Operation is deferred and applied after the current update cycle. Supported by FrameNode.
|
|
1074
1117
|
*/
|
|
1075
1118
|
layout: LayoutType | null;
|
|
1076
1119
|
/**
|
|
1077
|
-
* Spacing between items in a layout.
|
|
1120
|
+
* Spacing between items in a layout.
|
|
1121
|
+
*
|
|
1122
|
+
* Single value (e.g. `"10px"`) applies to both axes;
|
|
1078
1123
|
* two values (e.g. `"10px 20px"`) set horizontal and vertical separately.
|
|
1079
1124
|
* Only works with layout enabled. Supported by FrameNode.
|
|
1080
1125
|
*/
|
|
1081
1126
|
gap: CSSDimension<CSSUnit.Pixel> | `${CSSDimension<CSSUnit.Pixel>} ${CSSDimension<CSSUnit.Pixel>}` | null;
|
|
1082
1127
|
/**
|
|
1083
|
-
* Inner spacing of a container with layout.
|
|
1128
|
+
* Inner spacing of a container with layout.
|
|
1129
|
+
*
|
|
1130
|
+
* Single value (e.g. `"10px"`) applies to all sides;
|
|
1084
1131
|
* four values (e.g. `"10px 20px 30px 40px"`) set top, right, bottom, left.
|
|
1085
1132
|
* Only works with layout enabled. Supported by FrameNode.
|
|
1086
1133
|
*/
|
|
@@ -1089,17 +1136,41 @@ interface WithLayoutTrait extends StackLayout, GridLayout {
|
|
|
1089
1136
|
type GridItemAlignment = "start" | "center" | "end";
|
|
1090
1137
|
type GridItemColumnSpan = number | "all";
|
|
1091
1138
|
interface WithGridItemTrait {
|
|
1092
|
-
/**
|
|
1139
|
+
/**
|
|
1140
|
+
* Whether to fill the grid cell width.
|
|
1141
|
+
*
|
|
1142
|
+
* For nodes inside a grid container. Defaults to `true`. Supported by FrameNode, TextNode.
|
|
1143
|
+
*/
|
|
1093
1144
|
gridItemFillCellWidth: boolean | null;
|
|
1094
|
-
/**
|
|
1145
|
+
/**
|
|
1146
|
+
* Whether to fill the grid cell height.
|
|
1147
|
+
*
|
|
1148
|
+
* For nodes inside a grid container. Defaults to `true`. Supported by FrameNode, TextNode.
|
|
1149
|
+
*/
|
|
1095
1150
|
gridItemFillCellHeight: boolean | null;
|
|
1096
|
-
/**
|
|
1151
|
+
/**
|
|
1152
|
+
* Horizontal alignment within grid cell.
|
|
1153
|
+
*
|
|
1154
|
+
* For nodes inside a grid container. Defaults to `"center"`. Supported by FrameNode, TextNode.
|
|
1155
|
+
*/
|
|
1097
1156
|
gridItemHorizontalAlignment: GridItemAlignment | null;
|
|
1098
|
-
/**
|
|
1157
|
+
/**
|
|
1158
|
+
* Vertical alignment within grid cell.
|
|
1159
|
+
*
|
|
1160
|
+
* For nodes inside a grid container. Defaults to `"center"`. Supported by FrameNode, TextNode.
|
|
1161
|
+
*/
|
|
1099
1162
|
gridItemVerticalAlignment: GridItemAlignment | null;
|
|
1100
|
-
/**
|
|
1163
|
+
/**
|
|
1164
|
+
* Number of columns to span, or `"all"` for all columns.
|
|
1165
|
+
*
|
|
1166
|
+
* For nodes inside a grid container. Defaults to `1`. Supported by FrameNode, TextNode.
|
|
1167
|
+
*/
|
|
1101
1168
|
gridItemColumnSpan: GridItemColumnSpan | null;
|
|
1102
|
-
/**
|
|
1169
|
+
/**
|
|
1170
|
+
* Number of rows to span.
|
|
1171
|
+
*
|
|
1172
|
+
* For nodes inside a grid container. Defaults to `1`. Supported by FrameNode, TextNode.
|
|
1173
|
+
*/
|
|
1103
1174
|
gridItemRowSpan: number | null;
|
|
1104
1175
|
}
|
|
1105
1176
|
type TraitVariant = TraitVariantData | TraitVariantNode;
|
|
@@ -1200,6 +1271,7 @@ type ColorStyleAttributes = Prettify<RequiredColorStyleAttributes & Partial<Opti
|
|
|
1200
1271
|
* // Store plugin data on a color style.
|
|
1201
1272
|
* await colorStyle.setPluginData("key", "value")
|
|
1202
1273
|
* ```
|
|
1274
|
+
* @category canvas
|
|
1203
1275
|
*/
|
|
1204
1276
|
declare class ColorStyle {
|
|
1205
1277
|
#private;
|
|
@@ -1379,6 +1451,7 @@ type TextStyleAttributes = Prettify<Partial<Omit<TextStyleData, "id" | "color" |
|
|
|
1379
1451
|
* // Remove a text style from the project.
|
|
1380
1452
|
* await textStyle.remove()
|
|
1381
1453
|
* ```
|
|
1454
|
+
* @category canvas
|
|
1382
1455
|
*/
|
|
1383
1456
|
declare class TextStyle {
|
|
1384
1457
|
#private;
|
|
@@ -1632,6 +1705,10 @@ declare abstract class GradientBase {
|
|
|
1632
1705
|
cloneWithAttributes(attributes: Partial<ExtractUnmarshaledGradientAttributes<typeof this>>): typeof this;
|
|
1633
1706
|
}
|
|
1634
1707
|
type UnmarshaledLinearGradientAttributes = Omit<UnmarshaledLinearGradient, ClassKey>;
|
|
1708
|
+
/**
|
|
1709
|
+
* A linear gradient with two or more color stops.
|
|
1710
|
+
* @category canvas
|
|
1711
|
+
*/
|
|
1635
1712
|
declare class LinearGradient extends GradientBase {
|
|
1636
1713
|
#private;
|
|
1637
1714
|
readonly [classKey]: "LinearGradient";
|
|
@@ -1643,6 +1720,10 @@ declare class LinearGradient extends GradientBase {
|
|
|
1643
1720
|
toCSS(): string;
|
|
1644
1721
|
}
|
|
1645
1722
|
type UnmarshaledRadialGradientAttributes = Omit<UnmarshaledRadialGradient, ClassKey>;
|
|
1723
|
+
/**
|
|
1724
|
+
* A radial gradient with two or more color stops.
|
|
1725
|
+
* @category canvas
|
|
1726
|
+
*/
|
|
1646
1727
|
declare class RadialGradient extends GradientBase {
|
|
1647
1728
|
#private;
|
|
1648
1729
|
readonly [classKey]: "RadialGradient";
|
|
@@ -1660,6 +1741,10 @@ declare class RadialGradient extends GradientBase {
|
|
|
1660
1741
|
toCSS(): string;
|
|
1661
1742
|
}
|
|
1662
1743
|
type UnmarshaledConicGradientAttributes = Omit<UnmarshaledConicGradient, ClassKey>;
|
|
1744
|
+
/**
|
|
1745
|
+
* A conic (angular) gradient with two or more color stops.
|
|
1746
|
+
* @category canvas
|
|
1747
|
+
*/
|
|
1663
1748
|
declare class ConicGradient extends GradientBase {
|
|
1664
1749
|
#private;
|
|
1665
1750
|
readonly [classKey]: "ConicGradient";
|
|
@@ -1768,6 +1853,10 @@ interface CreateBooleanVariable extends WithBooleanVariableType, CreateVariableB
|
|
|
1768
1853
|
}
|
|
1769
1854
|
interface UpdateBooleanVariable extends WithBooleanVariableType, UpdateVariableBase, Partial<WithBooleanDefaultValue> {
|
|
1770
1855
|
}
|
|
1856
|
+
/**
|
|
1857
|
+
* A boolean variable.
|
|
1858
|
+
* @category canvas
|
|
1859
|
+
*/
|
|
1771
1860
|
declare class BooleanVariable extends VariableBase {
|
|
1772
1861
|
#private;
|
|
1773
1862
|
readonly type: "boolean";
|
|
@@ -1792,6 +1881,10 @@ interface CreateNumberVariable extends WithNumberVariableType, CreateVariableBas
|
|
|
1792
1881
|
}
|
|
1793
1882
|
interface UpdateNumberVariable extends WithNumberVariableType, UpdateVariableBase, Partial<WithNumberDefaultValue> {
|
|
1794
1883
|
}
|
|
1884
|
+
/**
|
|
1885
|
+
* A number variable.
|
|
1886
|
+
* @category canvas
|
|
1887
|
+
*/
|
|
1795
1888
|
declare class NumberVariable extends VariableBase {
|
|
1796
1889
|
#private;
|
|
1797
1890
|
readonly type: "number";
|
|
@@ -1816,6 +1909,10 @@ interface CreateStringVariable extends WithStringVariableType, CreateVariableBas
|
|
|
1816
1909
|
}
|
|
1817
1910
|
interface UpdateStringVariable extends WithStringVariableType, UpdateVariableBase, Partial<WithStringDefaultValue> {
|
|
1818
1911
|
}
|
|
1912
|
+
/**
|
|
1913
|
+
* A string variable.
|
|
1914
|
+
* @category canvas
|
|
1915
|
+
*/
|
|
1819
1916
|
declare class StringVariable extends VariableBase {
|
|
1820
1917
|
#private;
|
|
1821
1918
|
readonly type: "string";
|
|
@@ -1837,6 +1934,10 @@ interface CreateFormattedTextVariable extends WithFormattedTextVariableType, Cre
|
|
|
1837
1934
|
}
|
|
1838
1935
|
interface UpdateFormattedTextVariable extends WithFormattedTextVariableType, UpdateVariableBase, Partial<WithStringDefaultValue> {
|
|
1839
1936
|
}
|
|
1937
|
+
/**
|
|
1938
|
+
* A formatted text (rich text) variable.
|
|
1939
|
+
* @category canvas
|
|
1940
|
+
*/
|
|
1840
1941
|
declare class FormattedTextVariable extends VariableBase {
|
|
1841
1942
|
#private;
|
|
1842
1943
|
readonly type: "formattedText";
|
|
@@ -1850,7 +1951,10 @@ interface EnumCaseData extends WithId, WithName, WithNameByLocale {
|
|
|
1850
1951
|
}
|
|
1851
1952
|
interface UpdateEnumCase extends Partial<WithName>, Partial<WithNameByLocaleUpdate> {
|
|
1852
1953
|
}
|
|
1853
|
-
/**
|
|
1954
|
+
/**
|
|
1955
|
+
* An individual case (option) within an Enum Field or Enum Variable.
|
|
1956
|
+
* @category cms
|
|
1957
|
+
*/
|
|
1854
1958
|
declare class EnumCase {
|
|
1855
1959
|
#private;
|
|
1856
1960
|
/** A unique identifier for the enum case. */
|
|
@@ -1915,6 +2019,10 @@ interface CreateEnumVariable extends WithEnumVariableType, CreateVariableBase {
|
|
|
1915
2019
|
}
|
|
1916
2020
|
interface UpdateEnumVariable extends WithEnumVariableType, UpdateVariableBase, Partial<WithStringDefaultValue> {
|
|
1917
2021
|
}
|
|
2022
|
+
/**
|
|
2023
|
+
* An enum variable with a fixed set of cases.
|
|
2024
|
+
* @category canvas
|
|
2025
|
+
*/
|
|
1918
2026
|
declare class EnumVariable extends VariableBase {
|
|
1919
2027
|
#private;
|
|
1920
2028
|
readonly type: "enum";
|
|
@@ -1955,6 +2063,10 @@ interface CreateColorVariable extends WithColorVariableType, CreateVariableBase,
|
|
|
1955
2063
|
}
|
|
1956
2064
|
interface UpdateColorVariable extends WithColorVariableType, UpdateVariableBase, Partial<WithColorDefaultValue> {
|
|
1957
2065
|
}
|
|
2066
|
+
/**
|
|
2067
|
+
* A color variable.
|
|
2068
|
+
* @category canvas
|
|
2069
|
+
*/
|
|
1958
2070
|
declare class ColorVariable extends VariableBase {
|
|
1959
2071
|
#private;
|
|
1960
2072
|
readonly type: "color";
|
|
@@ -1982,6 +2094,10 @@ interface CreateImageVariable extends WithImageVariableType, CreateVariableBase,
|
|
|
1982
2094
|
}
|
|
1983
2095
|
interface UpdateImageVariable extends WithImageVariableType, UpdateVariableBase, Partial<WithImageDefaultValue> {
|
|
1984
2096
|
}
|
|
2097
|
+
/**
|
|
2098
|
+
* An image variable.
|
|
2099
|
+
* @category canvas
|
|
2100
|
+
*/
|
|
1985
2101
|
declare class ImageVariable extends VariableBase {
|
|
1986
2102
|
#private;
|
|
1987
2103
|
readonly type: "image";
|
|
@@ -2020,6 +2136,10 @@ interface CreateFileVariable extends WithFileVariableType, CreateVariableBase, P
|
|
|
2020
2136
|
}
|
|
2021
2137
|
interface UpdateFileVariable extends WithFileVariableType, UpdateVariableBase, Partial<WithFileDefaultValue>, Partial<WithAllowedFileTypes> {
|
|
2022
2138
|
}
|
|
2139
|
+
/**
|
|
2140
|
+
* A file variable.
|
|
2141
|
+
* @category canvas
|
|
2142
|
+
*/
|
|
2023
2143
|
declare class FileVariable extends VariableBase {
|
|
2024
2144
|
#private;
|
|
2025
2145
|
readonly type: "file";
|
|
@@ -2042,6 +2162,10 @@ interface CreateLinkVariable extends WithLinkVariableType, CreateVariableBase {
|
|
|
2042
2162
|
}
|
|
2043
2163
|
interface UpdateLinkVariable extends WithLinkVariableType, UpdateVariableBase {
|
|
2044
2164
|
}
|
|
2165
|
+
/**
|
|
2166
|
+
* A link variable.
|
|
2167
|
+
* @category canvas
|
|
2168
|
+
*/
|
|
2045
2169
|
declare class LinkVariable extends VariableBase {
|
|
2046
2170
|
#private;
|
|
2047
2171
|
readonly type: "link";
|
|
@@ -2066,6 +2190,10 @@ interface CreateDateVariable extends WithDateVariableType, CreateVariableBase, P
|
|
|
2066
2190
|
}
|
|
2067
2191
|
interface UpdateDateVariable extends WithDateVariableType, UpdateVariableBase, Partial<WithStringDefaultValue>, Partial<WithDisplayTime> {
|
|
2068
2192
|
}
|
|
2193
|
+
/**
|
|
2194
|
+
* A date variable.
|
|
2195
|
+
* @category canvas
|
|
2196
|
+
*/
|
|
2069
2197
|
declare class DateVariable extends VariableBase {
|
|
2070
2198
|
#private;
|
|
2071
2199
|
readonly type: "date";
|
|
@@ -2094,6 +2222,10 @@ interface CreateBorderVariable extends WithBorderVariableType, CreateVariableBas
|
|
|
2094
2222
|
}
|
|
2095
2223
|
interface UpdateBorderVariable extends WithBorderVariableType, UpdateVariableBase, Partial<WithBorderDefaultValue> {
|
|
2096
2224
|
}
|
|
2225
|
+
/**
|
|
2226
|
+
* A border variable.
|
|
2227
|
+
* @category canvas
|
|
2228
|
+
*/
|
|
2097
2229
|
declare class BorderVariable extends VariableBase {
|
|
2098
2230
|
#private;
|
|
2099
2231
|
readonly type: "border";
|
|
@@ -2113,6 +2245,10 @@ interface UnsupportedVariableData extends WithUnsupportedVariableClass, BaseVari
|
|
|
2113
2245
|
}
|
|
2114
2246
|
interface UpdateUnsupportedVariable extends WithUnsupportedVariableType, UpdateVariableBase {
|
|
2115
2247
|
}
|
|
2248
|
+
/**
|
|
2249
|
+
* A variable type not yet supported by the plugin API.
|
|
2250
|
+
* @category canvas
|
|
2251
|
+
*/
|
|
2116
2252
|
declare class UnsupportedVariable extends VariableBase {
|
|
2117
2253
|
#private;
|
|
2118
2254
|
readonly type: "unsupported";
|
|
@@ -2197,38 +2333,62 @@ declare abstract class FieldBaseWithRequired extends FieldBase implements WithFi
|
|
|
2197
2333
|
get required(): boolean;
|
|
2198
2334
|
constructor(engine: PluginEngine, collectionId: string, data: FieldDefinitionBase & WithFieldRequired);
|
|
2199
2335
|
}
|
|
2200
|
-
/**
|
|
2336
|
+
/**
|
|
2337
|
+
* A CMS Collection field that stores a boolean (true or false) value.
|
|
2338
|
+
* @category cms
|
|
2339
|
+
*/
|
|
2201
2340
|
declare class BooleanField extends FieldBase {
|
|
2202
2341
|
readonly type = "boolean";
|
|
2203
2342
|
}
|
|
2204
|
-
/**
|
|
2343
|
+
/**
|
|
2344
|
+
* A CMS Collection field that stores a color value (RGBA/HSL/HEX format).
|
|
2345
|
+
* @category cms
|
|
2346
|
+
*/
|
|
2205
2347
|
declare class ColorField extends FieldBase {
|
|
2206
2348
|
readonly type = "color";
|
|
2207
2349
|
}
|
|
2208
|
-
/**
|
|
2350
|
+
/**
|
|
2351
|
+
* A CMS Collection field that stores a numeric value.
|
|
2352
|
+
* @category cms
|
|
2353
|
+
*/
|
|
2209
2354
|
declare class NumberField extends FieldBase {
|
|
2210
2355
|
readonly type = "number";
|
|
2211
2356
|
}
|
|
2212
|
-
/**
|
|
2357
|
+
/**
|
|
2358
|
+
* A CMS Collection field that stores a text string value.
|
|
2359
|
+
* @category cms
|
|
2360
|
+
*/
|
|
2213
2361
|
declare class StringField extends FieldBaseWithRequired implements WithFieldBasedOn {
|
|
2214
2362
|
#private;
|
|
2215
2363
|
readonly type = "string";
|
|
2216
2364
|
constructor(engine: PluginEngine, collectionId: string, data: StringFieldDefinitionData);
|
|
2217
2365
|
get basedOn(): string | null;
|
|
2218
2366
|
}
|
|
2219
|
-
/**
|
|
2367
|
+
/**
|
|
2368
|
+
* A CMS Collection field that stores HTML-formatted text content (H1-H6, P, and other standard content elements).
|
|
2369
|
+
* @category cms
|
|
2370
|
+
*/
|
|
2220
2371
|
declare class FormattedTextField extends FieldBaseWithRequired {
|
|
2221
2372
|
readonly type = "formattedText";
|
|
2222
2373
|
}
|
|
2223
|
-
/**
|
|
2374
|
+
/**
|
|
2375
|
+
* A CMS Collection field that stores an image asset (`ImageAsset`).
|
|
2376
|
+
* @category cms
|
|
2377
|
+
*/
|
|
2224
2378
|
declare class ImageField extends FieldBaseWithRequired {
|
|
2225
2379
|
readonly type = "image";
|
|
2226
2380
|
}
|
|
2227
|
-
/**
|
|
2381
|
+
/**
|
|
2382
|
+
* A CMS Collection field that stores a URL in string format.
|
|
2383
|
+
* @category cms
|
|
2384
|
+
*/
|
|
2228
2385
|
declare class LinkField extends FieldBaseWithRequired {
|
|
2229
2386
|
readonly type = "link";
|
|
2230
2387
|
}
|
|
2231
|
-
/**
|
|
2388
|
+
/**
|
|
2389
|
+
* A CMS Collection field that stores a date in UTC format. Optionally displays time.
|
|
2390
|
+
* @category cms
|
|
2391
|
+
*/
|
|
2232
2392
|
declare class DateField extends FieldBaseWithRequired {
|
|
2233
2393
|
#private;
|
|
2234
2394
|
readonly type = "date";
|
|
@@ -2236,18 +2396,25 @@ declare class DateField extends FieldBaseWithRequired {
|
|
|
2236
2396
|
get displayTime(): boolean | undefined;
|
|
2237
2397
|
constructor(engine: PluginEngine, collectionId: string, data: DateFieldDefinitionData);
|
|
2238
2398
|
}
|
|
2239
|
-
/**
|
|
2399
|
+
/**
|
|
2400
|
+
* A visual divider between fields in the CMS UI. Not a data field.
|
|
2401
|
+
* @category cms
|
|
2402
|
+
*/
|
|
2240
2403
|
declare class FieldDivider extends FieldBase {
|
|
2241
2404
|
readonly type = "divider";
|
|
2242
2405
|
}
|
|
2243
2406
|
/**
|
|
2244
2407
|
* A field type that is not yet supported by the plugin API.
|
|
2245
2408
|
* Returned when Framer uses a field type that the plugin API does not recognize.
|
|
2409
|
+
* @category cms
|
|
2246
2410
|
*/
|
|
2247
2411
|
declare class UnsupportedField extends FieldBase {
|
|
2248
2412
|
readonly type = "unsupported";
|
|
2249
2413
|
}
|
|
2250
|
-
/**
|
|
2414
|
+
/**
|
|
2415
|
+
* A CMS Collection field that stores a file asset (`FileAsset`).
|
|
2416
|
+
* @category cms
|
|
2417
|
+
*/
|
|
2251
2418
|
declare class FileField extends FieldBaseWithRequired implements WithAllowedFileTypes {
|
|
2252
2419
|
#private;
|
|
2253
2420
|
readonly type = "file";
|
|
@@ -2259,6 +2426,7 @@ declare class FileField extends FieldBaseWithRequired implements WithAllowedFile
|
|
|
2259
2426
|
* A CMS Collection field with a fixed set of enum cases (options) that the user
|
|
2260
2427
|
* can choose from. Enum cases must be defined as options before they can be
|
|
2261
2428
|
* assigned to CMS items.
|
|
2429
|
+
* @category cms
|
|
2262
2430
|
*/
|
|
2263
2431
|
declare class EnumField extends FieldBase {
|
|
2264
2432
|
#private;
|
|
@@ -2302,7 +2470,10 @@ declare class EnumField extends FieldBase {
|
|
|
2302
2470
|
*/
|
|
2303
2471
|
setCaseOrder(caseIds: string[]): Promise<void>;
|
|
2304
2472
|
}
|
|
2305
|
-
/**
|
|
2473
|
+
/**
|
|
2474
|
+
* A field that references an item in another collection.
|
|
2475
|
+
* @category cms
|
|
2476
|
+
*/
|
|
2306
2477
|
declare class CollectionReferenceField extends FieldBaseWithRequired implements WithFieldCollectionId {
|
|
2307
2478
|
#private;
|
|
2308
2479
|
readonly type = "collectionReference";
|
|
@@ -2310,7 +2481,10 @@ declare class CollectionReferenceField extends FieldBaseWithRequired implements
|
|
|
2310
2481
|
get collectionId(): string;
|
|
2311
2482
|
constructor(engine: PluginEngine, collectionId: string, data: CollectionReferenceFieldDefinitionData);
|
|
2312
2483
|
}
|
|
2313
|
-
/**
|
|
2484
|
+
/**
|
|
2485
|
+
* A field that references multiple items in another collection.
|
|
2486
|
+
* @category cms
|
|
2487
|
+
*/
|
|
2314
2488
|
declare class MultiCollectionReferenceField extends FieldBaseWithRequired implements WithFieldCollectionId {
|
|
2315
2489
|
#private;
|
|
2316
2490
|
readonly type = "multiCollectionReference";
|
|
@@ -2322,6 +2496,7 @@ type ArrayItemField = ImageField;
|
|
|
2322
2496
|
/**
|
|
2323
2497
|
* A CMS Collection field that stores an array of nested fields. Currently only
|
|
2324
2498
|
* supports a single image field, which creates a Gallery in the CMS.
|
|
2499
|
+
* @category cms
|
|
2325
2500
|
*/
|
|
2326
2501
|
declare class ArrayField extends FieldBaseWithRequired {
|
|
2327
2502
|
readonly type = "array";
|
|
@@ -2893,16 +3068,19 @@ type ManagedCollectionField = SupportedFieldDefinitionData & WithUserEditable;
|
|
|
2893
3068
|
/** @deprecated Use `ManagedCollectionFieldInput` instead. */
|
|
2894
3069
|
type EditableManagedCollectionField = ManagedCollectionFieldInputData;
|
|
2895
3070
|
/**
|
|
2896
|
-
* A CMS Collection that is fully controlled by a plugin.
|
|
2897
|
-
*
|
|
2898
|
-
*
|
|
2899
|
-
*
|
|
3071
|
+
* A CMS Collection that is fully controlled by a plugin.
|
|
3072
|
+
*
|
|
3073
|
+
* Managed Collections allow plugins to define fields and sync items
|
|
3074
|
+
* programmatically. Fields and items can only be added, edited, and deleted
|
|
3075
|
+
* by the owning plugin, not by the user (unless a field is marked
|
|
3076
|
+
* `userEditable`).
|
|
2900
3077
|
*
|
|
2901
3078
|
* A Managed Collection plugin becomes available within the CMS when it supports
|
|
2902
3079
|
* both `configureManagedCollection` and `syncManagedCollection` modes.
|
|
2903
3080
|
*
|
|
2904
3081
|
* Use `framer.getManagedCollection()` to obtain an instance when the plugin is
|
|
2905
3082
|
* launched in either of those modes.
|
|
3083
|
+
* @category cms
|
|
2906
3084
|
*/
|
|
2907
3085
|
declare class ManagedCollection implements Navigable {
|
|
2908
3086
|
#private;
|
|
@@ -2960,8 +3138,10 @@ declare class ManagedCollection implements Navigable {
|
|
|
2960
3138
|
*/
|
|
2961
3139
|
getFields(): Promise<ManagedCollectionField[]>;
|
|
2962
3140
|
/**
|
|
2963
|
-
* Add, update, or remove Collection fields.
|
|
2964
|
-
*
|
|
3141
|
+
* Add, update, or remove Collection fields.
|
|
3142
|
+
*
|
|
3143
|
+
* Fields not included in the array will be removed. You can configure
|
|
3144
|
+
* up to 30 custom fields.
|
|
2965
3145
|
*
|
|
2966
3146
|
* Each field requires an `id`, `name`, and `type`. For the `id`, use a
|
|
2967
3147
|
* unique identifier that stays the same across future synchronizations.
|
|
@@ -2988,9 +3168,10 @@ declare class ManagedCollection implements Navigable {
|
|
|
2988
3168
|
*/
|
|
2989
3169
|
setFields(fields: ManagedCollectionFieldInput[]): Promise<void>;
|
|
2990
3170
|
/**
|
|
2991
|
-
* Add new items or update existing ones if their IDs match.
|
|
2992
|
-
*
|
|
2993
|
-
*
|
|
3171
|
+
* Add new items or update existing ones if their IDs match.
|
|
3172
|
+
*
|
|
3173
|
+
* This method performs an upsert: items with matching IDs are updated,
|
|
3174
|
+
* new IDs are inserted.
|
|
2994
3175
|
*
|
|
2995
3176
|
* Each item requires an `id` and `slug`. Custom field data is provided via
|
|
2996
3177
|
* the `fieldData` object, using field IDs as keys.
|
|
@@ -3045,9 +3226,11 @@ declare class ManagedCollection implements Navigable {
|
|
|
3045
3226
|
*/
|
|
3046
3227
|
setAsActive(): Promise<void>;
|
|
3047
3228
|
/**
|
|
3048
|
-
* Set plugin data by key.
|
|
3049
|
-
*
|
|
3050
|
-
*
|
|
3229
|
+
* Set plugin data by key.
|
|
3230
|
+
*
|
|
3231
|
+
* Similar to local storage, you can store custom data on the Managed
|
|
3232
|
+
* Collection (e.g., the last synchronization date or a connected database
|
|
3233
|
+
* ID).
|
|
3051
3234
|
*
|
|
3052
3235
|
* Use `"ManagedCollection.setPluginData"` to check if this method is allowed.
|
|
3053
3236
|
*
|
|
@@ -3077,17 +3260,19 @@ declare class ManagedCollection implements Navigable {
|
|
|
3077
3260
|
*/
|
|
3078
3261
|
getPluginDataKeys(): Promise<string[]>;
|
|
3079
3262
|
/**
|
|
3080
|
-
* Navigate to this collection.
|
|
3263
|
+
* Navigate to this collection.
|
|
3264
|
+
*
|
|
3265
|
+
* May switch modes to reveal the relevant view.
|
|
3081
3266
|
*/
|
|
3082
3267
|
navigateTo(opts?: NavigableOptions): Promise<void>;
|
|
3083
3268
|
}
|
|
3084
3269
|
/**
|
|
3085
|
-
* A CMS Collection in the project.
|
|
3086
|
-
* managed by plugins. Use `managedBy` to check the owner.
|
|
3270
|
+
* A CMS Collection in the project.
|
|
3087
3271
|
*
|
|
3088
|
-
*
|
|
3089
|
-
*
|
|
3090
|
-
*
|
|
3272
|
+
* Collections can be created by users or managed by plugins. Use `managedBy`
|
|
3273
|
+
* to check the owner. Any kind of Collection can be read from, while those
|
|
3274
|
+
* managed by other plugins are read-only.
|
|
3275
|
+
* @category cms
|
|
3091
3276
|
*/
|
|
3092
3277
|
declare class Collection implements Navigable {
|
|
3093
3278
|
#private;
|
|
@@ -3147,6 +3332,7 @@ declare class Collection implements Navigable {
|
|
|
3147
3332
|
constructor(data: CollectionData, engine: PluginEngine);
|
|
3148
3333
|
/**
|
|
3149
3334
|
* Reorder the items in this Collection based on an array of item IDs.
|
|
3335
|
+
*
|
|
3150
3336
|
* Unknown item IDs are ignored.
|
|
3151
3337
|
*
|
|
3152
3338
|
* Use `"Collection.setItemOrder"` to check if this method is allowed.
|
|
@@ -3174,8 +3360,9 @@ declare class Collection implements Navigable {
|
|
|
3174
3360
|
*/
|
|
3175
3361
|
getFields(): Promise<Field[]>;
|
|
3176
3362
|
/**
|
|
3177
|
-
* Create new unmanaged Collection fields.
|
|
3178
|
-
*
|
|
3363
|
+
* Create new unmanaged Collection fields.
|
|
3364
|
+
*
|
|
3365
|
+
* Use `Field.setAttributes` to update existing fields.
|
|
3179
3366
|
*
|
|
3180
3367
|
* Use `"Collection.addFields"` to check if this method is allowed.
|
|
3181
3368
|
*
|
|
@@ -3208,6 +3395,7 @@ declare class Collection implements Navigable {
|
|
|
3208
3395
|
removeFields(fieldIds: string[]): Promise<void>;
|
|
3209
3396
|
/**
|
|
3210
3397
|
* Reorder the fields in this Collection based on an array of field IDs.
|
|
3398
|
+
*
|
|
3211
3399
|
* Unknown field IDs are ignored.
|
|
3212
3400
|
*
|
|
3213
3401
|
* Use `"Collection.setFieldOrder"` to check if this method is allowed.
|
|
@@ -3222,6 +3410,7 @@ declare class Collection implements Navigable {
|
|
|
3222
3410
|
setFieldOrder(fieldIds: string[]): Promise<void>;
|
|
3223
3411
|
/**
|
|
3224
3412
|
* Retrieve all items within this Collection, in their current order.
|
|
3413
|
+
*
|
|
3225
3414
|
* Items may include drafts (unpublished items).
|
|
3226
3415
|
*
|
|
3227
3416
|
* @returns An array of CollectionItem instances.
|
|
@@ -3304,13 +3493,18 @@ declare class Collection implements Navigable {
|
|
|
3304
3493
|
*/
|
|
3305
3494
|
getPluginDataKeys(): Promise<string[]>;
|
|
3306
3495
|
/**
|
|
3307
|
-
* Navigate to this collection.
|
|
3496
|
+
* Navigate to this collection.
|
|
3497
|
+
*
|
|
3498
|
+
* May switch modes to reveal the relevant view.
|
|
3308
3499
|
*/
|
|
3309
3500
|
navigateTo(opts?: NavigableOptions): Promise<void>;
|
|
3310
3501
|
}
|
|
3311
3502
|
/**
|
|
3312
|
-
* An item (row) in a CMS Collection.
|
|
3313
|
-
*
|
|
3503
|
+
* An item (row) in a CMS Collection.
|
|
3504
|
+
*
|
|
3505
|
+
* Each item contains field data keyed by field ID, a unique slug, and a
|
|
3506
|
+
* draft status.
|
|
3507
|
+
* @category cms
|
|
3314
3508
|
*/
|
|
3315
3509
|
declare class CollectionItem implements Navigable {
|
|
3316
3510
|
#private;
|
|
@@ -3324,8 +3518,9 @@ declare class CollectionItem implements Navigable {
|
|
|
3324
3518
|
/** Drafts are excluded from publishing. */
|
|
3325
3519
|
readonly draft: boolean;
|
|
3326
3520
|
/**
|
|
3327
|
-
* The fields and corresponding values of this Collection item.
|
|
3328
|
-
*
|
|
3521
|
+
* The fields and corresponding values of this Collection item.
|
|
3522
|
+
*
|
|
3523
|
+
* Field data uses the field `id` as keys in an object.
|
|
3329
3524
|
*
|
|
3330
3525
|
* @example
|
|
3331
3526
|
* ```ts
|
|
@@ -3446,9 +3641,10 @@ interface NodeClassToEditableAttributes {
|
|
|
3446
3641
|
UnknownNode: object;
|
|
3447
3642
|
}
|
|
3448
3643
|
/**
|
|
3449
|
-
* Base class providing common methods shared by all node types.
|
|
3450
|
-
*
|
|
3451
|
-
*
|
|
3644
|
+
* Base class providing common methods shared by all node types.
|
|
3645
|
+
*
|
|
3646
|
+
* Nodes are the building blocks that make up the content in a project.
|
|
3647
|
+
* They are represented as "layers" in the editor UI.
|
|
3452
3648
|
*
|
|
3453
3649
|
* Every node has a unique {@link NodeMethods.id | id}. Nodes support
|
|
3454
3650
|
* plugin data storage, tree traversal (parent/children), cloning,
|
|
@@ -3500,8 +3696,10 @@ declare abstract class NodeMethods implements WithIdTrait, Navigable {
|
|
|
3500
3696
|
*/
|
|
3501
3697
|
clone(): Promise<typeof this | null>;
|
|
3502
3698
|
/**
|
|
3503
|
-
* Set the attributes of this node.
|
|
3504
|
-
*
|
|
3699
|
+
* Set the attributes of this node.
|
|
3700
|
+
*
|
|
3701
|
+
* Attributes are merged with existing values, so only the provided
|
|
3702
|
+
* attributes are updated.
|
|
3505
3703
|
*
|
|
3506
3704
|
* @param update - The attributes to update.
|
|
3507
3705
|
* @returns The updated node, or `null` if the node was not found.
|
|
@@ -3523,7 +3721,9 @@ declare abstract class NodeMethods implements WithIdTrait, Navigable {
|
|
|
3523
3721
|
*/
|
|
3524
3722
|
zoomIntoView(options?: ZoomIntoViewOptions): Promise<void>;
|
|
3525
3723
|
/**
|
|
3526
|
-
* Navigate to this node.
|
|
3724
|
+
* Navigate to this node.
|
|
3725
|
+
*
|
|
3726
|
+
* May switch modes to reveal the relevant view.
|
|
3527
3727
|
*/
|
|
3528
3728
|
navigateTo(opts?: Pick<NavigableOptions, "select" | "zoomIntoView">): Promise<void>;
|
|
3529
3729
|
/**
|
|
@@ -3539,8 +3739,9 @@ declare abstract class NodeMethods implements WithIdTrait, Navigable {
|
|
|
3539
3739
|
*/
|
|
3540
3740
|
getChildren(): Promise<CanvasNode[]>;
|
|
3541
3741
|
/**
|
|
3542
|
-
* Get descendants of this node that match the given type.
|
|
3543
|
-
*
|
|
3742
|
+
* Get descendants of this node that match the given type.
|
|
3743
|
+
*
|
|
3744
|
+
* This can also be used to query within a selection subtree.
|
|
3544
3745
|
*
|
|
3545
3746
|
* @param type - The node type to search for.
|
|
3546
3747
|
* @returns An array of matching descendant nodes.
|
|
@@ -3565,8 +3766,9 @@ declare abstract class NodeMethods implements WithIdTrait, Navigable {
|
|
|
3565
3766
|
getNodesWithType(type: "WebPageNode"): Promise<WebPageNode[]>;
|
|
3566
3767
|
getNodesWithType(type: "ComponentNode"): Promise<ComponentNode[]>;
|
|
3567
3768
|
/**
|
|
3568
|
-
* Get the descendants of this node that support `attribute`.
|
|
3569
|
-
*
|
|
3769
|
+
* Get the descendants of this node that support `attribute`.
|
|
3770
|
+
*
|
|
3771
|
+
* This returns nodes that have the given attribute defined in their type,
|
|
3570
3772
|
* regardless of whether it has been set.
|
|
3571
3773
|
*
|
|
3572
3774
|
* @param attribute - The attribute name to filter by.
|
|
@@ -3594,21 +3796,26 @@ declare abstract class NodeMethods implements WithIdTrait, Navigable {
|
|
|
3594
3796
|
*/
|
|
3595
3797
|
getNodesWithAttributeSet<T extends NodeAttributeKey, Node = NodeWithAttribute<T>>(attribute: T): Promise<Node[]>;
|
|
3596
3798
|
/**
|
|
3597
|
-
* Walk this node and its descendants recursively
|
|
3598
|
-
*
|
|
3799
|
+
* Walk this node and its descendants recursively.
|
|
3800
|
+
*
|
|
3801
|
+
* Uses an async generator. Yields nodes depth-first.
|
|
3599
3802
|
*/
|
|
3600
3803
|
walk(this: AnyNode): AsyncGenerator<AnyNode>;
|
|
3601
3804
|
/**
|
|
3602
|
-
* Get plugin data by key.
|
|
3603
|
-
*
|
|
3805
|
+
* Get plugin data by key.
|
|
3806
|
+
*
|
|
3807
|
+
* Plugin data lets you store arbitrary string values on individual
|
|
3808
|
+
* nodes, scoped to your plugin.
|
|
3604
3809
|
*
|
|
3605
3810
|
* @param key - The plugin data key.
|
|
3606
3811
|
* @returns The stored value, or `null` if no data exists for the key.
|
|
3607
3812
|
*/
|
|
3608
3813
|
getPluginData(key: string): Promise<string | null>;
|
|
3609
3814
|
/**
|
|
3610
|
-
* Set plugin data by key.
|
|
3611
|
-
*
|
|
3815
|
+
* Set plugin data by key.
|
|
3816
|
+
*
|
|
3817
|
+
* Plugin data lets you store arbitrary string values on individual
|
|
3818
|
+
* nodes, scoped to your plugin.
|
|
3612
3819
|
*
|
|
3613
3820
|
* @param key - The plugin data key.
|
|
3614
3821
|
* @param value - The value to set, or `null` to remove.
|
|
@@ -3631,9 +3838,11 @@ interface FrameNodeData extends CommonNodeData, Partial<DrawableNode>, WithPosit
|
|
|
3631
3838
|
[classKey]: "FrameNode";
|
|
3632
3839
|
}
|
|
3633
3840
|
/**
|
|
3634
|
-
* A frame layer on the canvas, the most common container node.
|
|
3635
|
-
*
|
|
3636
|
-
* can
|
|
3841
|
+
* A frame layer on the canvas, the most common container node.
|
|
3842
|
+
*
|
|
3843
|
+
* Frames can contain children, have layout settings, backgrounds, borders,
|
|
3844
|
+
* and can serve as breakpoint or component variants.
|
|
3845
|
+
* @category canvas
|
|
3637
3846
|
*/
|
|
3638
3847
|
declare class FrameNode extends NodeMethods implements EditableFrameNodeAttributes, WithBreakpointTrait {
|
|
3639
3848
|
readonly [classKey]: FrameNodeData[ClassKey];
|
|
@@ -3707,7 +3916,9 @@ interface TextNodeData extends CommonNodeData, Partial<DrawableNode>, WithPositi
|
|
|
3707
3916
|
[classKey]: "TextNode";
|
|
3708
3917
|
}
|
|
3709
3918
|
/**
|
|
3710
|
-
* A text layer on the canvas.
|
|
3919
|
+
* A text layer on the canvas.
|
|
3920
|
+
*
|
|
3921
|
+
* Use {@link TextNode.setText | setText} and
|
|
3711
3922
|
* {@link TextNode.getText | getText} to work with plain text, or
|
|
3712
3923
|
* {@link TextNode.setHTML | setHTML} and {@link TextNode.getHTML | getHTML}
|
|
3713
3924
|
* for rich text content.
|
|
@@ -3721,6 +3932,7 @@ interface TextNodeData extends CommonNodeData, Partial<DrawableNode>, WithPositi
|
|
|
3721
3932
|
* }
|
|
3722
3933
|
* }
|
|
3723
3934
|
* ```
|
|
3935
|
+
* @category canvas
|
|
3724
3936
|
*/
|
|
3725
3937
|
declare class TextNode extends NodeMethods implements EditableTextNodeAttributes {
|
|
3726
3938
|
#private;
|
|
@@ -3764,13 +3976,17 @@ declare class TextNode extends NodeMethods implements EditableTextNodeAttributes
|
|
|
3764
3976
|
readonly textTruncation: WithTextTruncationTrait["textTruncation"];
|
|
3765
3977
|
constructor(rawData: TextNodeData, engine: PluginEngine);
|
|
3766
3978
|
/**
|
|
3767
|
-
* Set the text of this node.
|
|
3979
|
+
* Set the text of this node.
|
|
3980
|
+
*
|
|
3981
|
+
* Plain text content, not HTML.
|
|
3768
3982
|
*
|
|
3769
3983
|
* Use `"TextNode.setText"` to check if this method is allowed.
|
|
3770
3984
|
*/
|
|
3771
3985
|
setText(text: string): Promise<void>;
|
|
3772
3986
|
/**
|
|
3773
|
-
* Get the text of this node.
|
|
3987
|
+
* Get the text of this node.
|
|
3988
|
+
*
|
|
3989
|
+
* Plain text content, not HTML.
|
|
3774
3990
|
*/
|
|
3775
3991
|
getText(): Promise<string | null>;
|
|
3776
3992
|
/**
|
|
@@ -3792,8 +4008,11 @@ interface SVGNodeData extends CommonNodeData, Partial<DrawableNode>, WithPositio
|
|
|
3792
4008
|
[classKey]: "SVGNode";
|
|
3793
4009
|
}
|
|
3794
4010
|
/**
|
|
3795
|
-
* An SVG graphic layer on the canvas.
|
|
3796
|
-
*
|
|
4011
|
+
* An SVG graphic layer on the canvas.
|
|
4012
|
+
*
|
|
4013
|
+
* Contains the raw SVG string and supports positioning, sizing,
|
|
4014
|
+
* rotation, and visibility.
|
|
4015
|
+
* @category canvas
|
|
3797
4016
|
*/
|
|
3798
4017
|
declare class SVGNode extends NodeMethods implements EditableSVGNodeAttributes {
|
|
3799
4018
|
readonly [classKey]: SVGNodeData[ClassKey];
|
|
@@ -3819,7 +4038,10 @@ interface EditableVectorSetItemNodeAttributes extends WithNameTrait, WithVisible
|
|
|
3819
4038
|
interface VectorSetItemNodeData extends CommonNodeData, Partial<WithNameTrait>, Partial<WithVisibleTrait>, Partial<WithLockedTrait>, Partial<WithPinsTrait>, Partial<WithSizeTrait> {
|
|
3820
4039
|
[classKey]: "VectorSetItemNode";
|
|
3821
4040
|
}
|
|
3822
|
-
/**
|
|
4041
|
+
/**
|
|
4042
|
+
* An individual item within a VectorSet node.
|
|
4043
|
+
* @category canvas
|
|
4044
|
+
*/
|
|
3823
4045
|
declare class VectorSetItemNode extends NodeMethods implements EditableVectorSetItemNodeAttributes {
|
|
3824
4046
|
#private;
|
|
3825
4047
|
readonly [classKey]: VectorSetItemNodeData[ClassKey];
|
|
@@ -3843,8 +4065,10 @@ interface ComponentInstanceNodeData extends CommonNodeData, Partial<DrawableNode
|
|
|
3843
4065
|
[classKey]: "ComponentInstanceNode";
|
|
3844
4066
|
}
|
|
3845
4067
|
/**
|
|
3846
|
-
* An instance of a code or design component on the canvas.
|
|
3847
|
-
*
|
|
4068
|
+
* An instance of a code or design component on the canvas.
|
|
4069
|
+
*
|
|
4070
|
+
* Component instances are identified by their
|
|
4071
|
+
* {@link ComponentInstanceNode.componentIdentifier | componentIdentifier}
|
|
3848
4072
|
* and can have their control properties updated via
|
|
3849
4073
|
* {@link NodeMethods.setAttributes | setAttributes}.
|
|
3850
4074
|
*
|
|
@@ -3856,6 +4080,7 @@ interface ComponentInstanceNodeData extends CommonNodeData, Partial<DrawableNode
|
|
|
3856
4080
|
* })
|
|
3857
4081
|
* }
|
|
3858
4082
|
* ```
|
|
4083
|
+
* @category canvas
|
|
3859
4084
|
*/
|
|
3860
4085
|
declare class ComponentInstanceNode extends NodeMethods implements EditableComponentInstanceNodeAttributes, WithComponentInfoTrait {
|
|
3861
4086
|
#private;
|
|
@@ -3901,9 +4126,11 @@ interface WebPageNodeData extends CommonNodeData, Partial<WithWebPageInfoTrait>
|
|
|
3901
4126
|
[classKey]: "WebPageNode";
|
|
3902
4127
|
}
|
|
3903
4128
|
/**
|
|
3904
|
-
* A web page in the project's site map.
|
|
3905
|
-
*
|
|
3906
|
-
*
|
|
4129
|
+
* A web page in the project's site map.
|
|
4130
|
+
*
|
|
4131
|
+
* Web pages have a {@link WebPageNode.path | path} and may be associated
|
|
4132
|
+
* with a CMS collection when used as a detail page.
|
|
4133
|
+
* @category canvas
|
|
3907
4134
|
*/
|
|
3908
4135
|
declare class WebPageNode extends NodeMethods implements EditableWebPageNodeAttributes, WithWebPageInfoTrait {
|
|
3909
4136
|
#private;
|
|
@@ -3938,6 +4165,7 @@ declare class WebPageNode extends NodeMethods implements EditableWebPageNodeAttr
|
|
|
3938
4165
|
addBreakpoint(basedOn: NodeId, breakpoint: Breakpoint): Promise<FrameNode>;
|
|
3939
4166
|
/**
|
|
3940
4167
|
* Get the active collection item for this CMS detail page.
|
|
4168
|
+
*
|
|
3941
4169
|
* Returns null if this is not a detail page or the collection is empty.
|
|
3942
4170
|
*
|
|
3943
4171
|
* @alpha
|
|
@@ -3949,9 +4177,11 @@ interface ComponentNodeData extends CommonNodeData, Partial<WithNameTrait>, With
|
|
|
3949
4177
|
[classKey]: "ComponentNode";
|
|
3950
4178
|
}
|
|
3951
4179
|
/**
|
|
3952
|
-
* A reusable design component definition.
|
|
3953
|
-
*
|
|
3954
|
-
*
|
|
4180
|
+
* A reusable design component definition.
|
|
4181
|
+
*
|
|
4182
|
+
* Component nodes contain variants, gesture states, and variables.
|
|
4183
|
+
* They can be inserted as instances via their module URL.
|
|
4184
|
+
* @category canvas
|
|
3955
4185
|
*/
|
|
3956
4186
|
declare class ComponentNode extends NodeMethods implements EditableComponentNodeAttributes, WithComponentInfoTrait {
|
|
3957
4187
|
#private;
|
|
@@ -4019,7 +4249,10 @@ type EditableVectorSetNodeAttributes = WithNameTrait;
|
|
|
4019
4249
|
interface VectorSetNodeData extends CommonNodeData, Partial<WithNameTrait> {
|
|
4020
4250
|
[classKey]: "VectorSetNode";
|
|
4021
4251
|
}
|
|
4022
|
-
/**
|
|
4252
|
+
/**
|
|
4253
|
+
* A container node for a set of vector icons.
|
|
4254
|
+
* @category canvas
|
|
4255
|
+
*/
|
|
4023
4256
|
declare class VectorSetNode extends NodeMethods implements EditableVectorSetNodeAttributes {
|
|
4024
4257
|
readonly [classKey]: VectorSetNodeData[ClassKey];
|
|
4025
4258
|
readonly name: string | null;
|
|
@@ -4032,7 +4265,10 @@ interface DesignPageCloneOptions {
|
|
|
4032
4265
|
interface DesignPageNodeData extends CommonNodeData, Partial<WithNameTrait> {
|
|
4033
4266
|
[classKey]: "DesignPageNode";
|
|
4034
4267
|
}
|
|
4035
|
-
/**
|
|
4268
|
+
/**
|
|
4269
|
+
* A design page (non-web canvas) in the project.
|
|
4270
|
+
* @category canvas
|
|
4271
|
+
*/
|
|
4036
4272
|
declare class DesignPageNode extends NodeMethods implements EditableDesignPageNodeAttributes {
|
|
4037
4273
|
#private;
|
|
4038
4274
|
readonly [classKey]: DesignPageNodeData[ClassKey];
|
|
@@ -4154,6 +4390,7 @@ interface CodeFileVersionData extends Pick<CodeFileData, "id" | "name"> {
|
|
|
4154
4390
|
}
|
|
4155
4391
|
/**
|
|
4156
4392
|
* A saved version (snapshot) of a code file.
|
|
4393
|
+
* @category code-files
|
|
4157
4394
|
*/
|
|
4158
4395
|
declare class CodeFileVersion {
|
|
4159
4396
|
#private;
|
|
@@ -4181,6 +4418,7 @@ declare class CodeFileVersion {
|
|
|
4181
4418
|
/**
|
|
4182
4419
|
* Represents a code file in the Framer project, such as a code component
|
|
4183
4420
|
* or code override.
|
|
4421
|
+
* @category code-files
|
|
4184
4422
|
*/
|
|
4185
4423
|
declare class CodeFile implements Navigable {
|
|
4186
4424
|
#private;
|
|
@@ -4819,6 +5057,7 @@ type RedirectInput = Prettify<CreateRedirect | UpdateRedirect>;
|
|
|
4819
5057
|
/**
|
|
4820
5058
|
* A URL redirect configured in the project. Redirects are applied when
|
|
4821
5059
|
* the site is published.
|
|
5060
|
+
* @category settings
|
|
4822
5061
|
*/
|
|
4823
5062
|
declare class Redirect {
|
|
4824
5063
|
#private;
|
|
@@ -5140,9 +5379,11 @@ declare class FramerPluginAPI {
|
|
|
5140
5379
|
#private;
|
|
5141
5380
|
constructor(engine: PluginEngine);
|
|
5142
5381
|
/**
|
|
5143
|
-
* Get the current mode.
|
|
5144
|
-
*
|
|
5145
|
-
*
|
|
5382
|
+
* Get the current mode.
|
|
5383
|
+
*
|
|
5384
|
+
* A plugin can launch in a special mode where only a subset of the API is
|
|
5385
|
+
* allowed. The mode is set when the plugin launches and never changes while
|
|
5386
|
+
* the plugin is active.
|
|
5146
5387
|
*
|
|
5147
5388
|
* @example
|
|
5148
5389
|
* ```ts
|
|
@@ -5151,6 +5392,7 @@ declare class FramerPluginAPI {
|
|
|
5151
5392
|
* return
|
|
5152
5393
|
* }
|
|
5153
5394
|
* ```
|
|
5395
|
+
* @category settings
|
|
5154
5396
|
*/
|
|
5155
5397
|
get mode(): Mode;
|
|
5156
5398
|
/**
|
|
@@ -5173,6 +5415,7 @@ declare class FramerPluginAPI {
|
|
|
5173
5415
|
*
|
|
5174
5416
|
* @param methods - The methods to check, at least one.
|
|
5175
5417
|
* @returns `true` if all of `methods` can be executed, `false` otherwise.
|
|
5418
|
+
* @category permissions
|
|
5176
5419
|
*/
|
|
5177
5420
|
isAllowedTo(...methods: [ProtectedMethod, ...ProtectedMethod[]]): boolean;
|
|
5178
5421
|
/**
|
|
@@ -5205,6 +5448,7 @@ declare class FramerPluginAPI {
|
|
|
5205
5448
|
* width: 220
|
|
5206
5449
|
* })
|
|
5207
5450
|
* ```
|
|
5451
|
+
* @category plugin-ui
|
|
5208
5452
|
*/
|
|
5209
5453
|
showUI(options?: UIOptions): Promise<void>;
|
|
5210
5454
|
/**
|
|
@@ -5217,14 +5461,14 @@ declare class FramerPluginAPI {
|
|
|
5217
5461
|
* ```ts
|
|
5218
5462
|
* framer.hideUI()
|
|
5219
5463
|
* ```
|
|
5464
|
+
* @category plugin-ui
|
|
5220
5465
|
*/
|
|
5221
5466
|
hideUI(): Promise<void>;
|
|
5222
5467
|
/**
|
|
5223
5468
|
* Update the background status text shown while the plugin UI is hidden.
|
|
5224
|
-
* This allows plugins running in the background to communicate their current
|
|
5225
|
-
* status to users.
|
|
5226
5469
|
*
|
|
5227
|
-
*
|
|
5470
|
+
* This allows plugins running in the background to communicate their current
|
|
5471
|
+
* status to users. Set to `null` to clear the message.
|
|
5228
5472
|
*
|
|
5229
5473
|
* @param status - The message to display, or `null` to clear.
|
|
5230
5474
|
*
|
|
@@ -5236,10 +5480,13 @@ declare class FramerPluginAPI {
|
|
|
5236
5480
|
* // Clear the status message
|
|
5237
5481
|
* await framer.setBackgroundMessage(null)
|
|
5238
5482
|
* ```
|
|
5483
|
+
* @category plugin-ui
|
|
5239
5484
|
*/
|
|
5240
5485
|
setBackgroundMessage(status: string | null): Promise<void>;
|
|
5241
5486
|
/**
|
|
5242
|
-
* Close and terminate the plugin.
|
|
5487
|
+
* Close and terminate the plugin.
|
|
5488
|
+
*
|
|
5489
|
+
* Throws `FramerPluginClosedError`, which should be ignored.
|
|
5243
5490
|
*
|
|
5244
5491
|
* @param message - Optional message to show in the notification (ignored if options.silent is true)
|
|
5245
5492
|
* @param options - Options to control the close behaviour
|
|
@@ -5250,6 +5497,7 @@ declare class FramerPluginAPI {
|
|
|
5250
5497
|
* variant: "success",
|
|
5251
5498
|
* })
|
|
5252
5499
|
* ```
|
|
5500
|
+
* @category plugin-ui
|
|
5253
5501
|
*/
|
|
5254
5502
|
closePlugin(message?: string, options?: ClosePluginOptions): never;
|
|
5255
5503
|
/**
|
|
@@ -5259,32 +5507,45 @@ declare class FramerPluginAPI {
|
|
|
5259
5507
|
* ```ts
|
|
5260
5508
|
* const user = await framer.getCurrentUser();
|
|
5261
5509
|
* ```
|
|
5510
|
+
* @category user
|
|
5262
5511
|
*/
|
|
5263
5512
|
getCurrentUser(): Promise<User>;
|
|
5264
|
-
/** Get the project info like name and id.
|
|
5513
|
+
/** Get the project info like name and id.
|
|
5514
|
+
* @category settings
|
|
5515
|
+
*/
|
|
5265
5516
|
getProjectInfo(): Promise<ProjectInfo>;
|
|
5266
|
-
/** Get the current selection.
|
|
5517
|
+
/** Get the current selection.
|
|
5518
|
+
* @category canvas
|
|
5519
|
+
*/
|
|
5267
5520
|
getSelection(): Promise<CanvasNode[]>;
|
|
5268
|
-
/** Set the current selection.
|
|
5521
|
+
/** Set the current selection.
|
|
5522
|
+
* @category canvas
|
|
5523
|
+
*/
|
|
5269
5524
|
setSelection(nodeIds: string | Iterable<string>): Promise<void>;
|
|
5270
5525
|
/** Subscribe to selection changes. */
|
|
5271
5526
|
subscribeToSelection(selectionUpdate: (nodes: CanvasNode[]) => void): Unsubscribe$1;
|
|
5272
|
-
/** Get the root of the current canvas.
|
|
5527
|
+
/** Get the root of the current canvas.
|
|
5528
|
+
* @category canvas
|
|
5529
|
+
*/
|
|
5273
5530
|
getCanvasRoot(): Promise<CanvasRootNode>;
|
|
5274
5531
|
/** Subscribe to canvas root changes */
|
|
5275
5532
|
subscribeToCanvasRoot(rootUpdate: (root: CanvasRootNode) => void): Unsubscribe$1;
|
|
5276
5533
|
/**
|
|
5277
|
-
* Get information about the published website
|
|
5278
|
-
*
|
|
5279
|
-
*
|
|
5280
|
-
*
|
|
5534
|
+
* Get information about the published website.
|
|
5535
|
+
*
|
|
5536
|
+
* Provides details such as the time of the most recent deploy or the URL of
|
|
5537
|
+
* the current page. Covers both `staging` and `production` environments
|
|
5538
|
+
* (either may be `null` if the site has never been published).
|
|
5281
5539
|
*
|
|
5282
5540
|
* @returns The current publish info for both staging and production.
|
|
5541
|
+
* @category settings
|
|
5283
5542
|
*/
|
|
5284
5543
|
getPublishInfo(): Promise<PublishInfo>;
|
|
5285
5544
|
/**
|
|
5286
|
-
* Subscribe to publish info changes.
|
|
5287
|
-
*
|
|
5545
|
+
* Subscribe to publish info changes.
|
|
5546
|
+
*
|
|
5547
|
+
* The callback is called whenever publish info is updated (e.g., after a
|
|
5548
|
+
* new deployment).
|
|
5288
5549
|
*
|
|
5289
5550
|
* @param publishInfoUpdate - Called when publish info changes.
|
|
5290
5551
|
* @returns A function to unsubscribe from updates.
|
|
@@ -5301,21 +5562,35 @@ declare class FramerPluginAPI {
|
|
|
5301
5562
|
* ```
|
|
5302
5563
|
*/
|
|
5303
5564
|
subscribeToPublishInfo(publishInfoUpdate: (info: PublishInfo) => void): Unsubscribe$1;
|
|
5304
|
-
/** Create a new node on the canvas.
|
|
5565
|
+
/** Create a new node on the canvas.
|
|
5566
|
+
* @category canvas
|
|
5567
|
+
*/
|
|
5305
5568
|
createFrameNode(attributes: Partial<EditableFrameNodeAttributes>, parentId?: string): Promise<FrameNode | null>;
|
|
5306
|
-
/** Remove nodes from the canvas.
|
|
5569
|
+
/** Remove nodes from the canvas.
|
|
5570
|
+
* @category canvas
|
|
5571
|
+
*/
|
|
5307
5572
|
removeNodes(nodeIds: NodeId[]): Promise<void>;
|
|
5308
5573
|
/** @deprecated Use `removeNodes` directly. */
|
|
5309
5574
|
removeNode(nodeId: NodeId): Promise<void>;
|
|
5310
|
-
/** Clone a node.
|
|
5575
|
+
/** Clone a node.
|
|
5576
|
+
* @category canvas
|
|
5577
|
+
*/
|
|
5311
5578
|
cloneNode(nodeId: NodeId): Promise<AnyNode | null>;
|
|
5312
|
-
/** Get a node by its id.
|
|
5579
|
+
/** Get a node by its id.
|
|
5580
|
+
* @category canvas
|
|
5581
|
+
*/
|
|
5313
5582
|
getNode(nodeId: NodeId): Promise<AnyNode | null>;
|
|
5314
|
-
/** Get the parent of a node.
|
|
5583
|
+
/** Get the parent of a node.
|
|
5584
|
+
* @category canvas
|
|
5585
|
+
*/
|
|
5315
5586
|
getParent(nodeId: NodeId): Promise<AnyNode | null>;
|
|
5316
|
-
/** Get the children of a node.
|
|
5587
|
+
/** Get the children of a node.
|
|
5588
|
+
* @category canvas
|
|
5589
|
+
*/
|
|
5317
5590
|
getChildren(nodeId: NodeId): Promise<CanvasNode[]>;
|
|
5318
|
-
/** Get the rect of a node
|
|
5591
|
+
/** Get the rect of a node
|
|
5592
|
+
* @category canvas
|
|
5593
|
+
*/
|
|
5319
5594
|
getRect(nodeId: NodeId): Promise<Rect$1 | null>;
|
|
5320
5595
|
/**
|
|
5321
5596
|
* Pans and zooms the viewport to center a single or group of nodes.
|
|
@@ -5331,13 +5606,21 @@ declare class FramerPluginAPI {
|
|
|
5331
5606
|
* // Scroll and zoom to fit multiple nodes into the viewport.
|
|
5332
5607
|
* await framer.zoomIntoView(["node-id-1", "node-id-2"])
|
|
5333
5608
|
* ```
|
|
5609
|
+
* @category navigation
|
|
5334
5610
|
*/
|
|
5335
5611
|
zoomIntoView(nodeIds: NodeId | Iterable<NodeId>, options?: ZoomIntoViewOptions): Promise<void>;
|
|
5336
|
-
/** Set the attributes of a node.
|
|
5612
|
+
/** Set the attributes of a node.
|
|
5613
|
+
* @category canvas
|
|
5614
|
+
*/
|
|
5337
5615
|
setAttributes(nodeId: NodeId, attributes: Partial<AnyEditableAttributes>): Promise<AnyNode | null>;
|
|
5338
|
-
/** Set the parent of a node.
|
|
5616
|
+
/** Set the parent of a node.
|
|
5617
|
+
* @category canvas
|
|
5618
|
+
*/
|
|
5339
5619
|
setParent(nodeId: NodeId, parentId: NodeId, index?: number | undefined): Promise<void>;
|
|
5340
|
-
/**
|
|
5620
|
+
/**
|
|
5621
|
+
* Get all nodes of a certain class.
|
|
5622
|
+
* @category canvas
|
|
5623
|
+
*/
|
|
5341
5624
|
getNodesWithType(type: "FrameNode"): Promise<FrameNode[]>;
|
|
5342
5625
|
getNodesWithType(type: "TextNode"): Promise<TextNode[]>;
|
|
5343
5626
|
getNodesWithType(type: "SVGNode"): Promise<SVGNode[]>;
|
|
@@ -5345,39 +5628,59 @@ declare class FramerPluginAPI {
|
|
|
5345
5628
|
getNodesWithType(type: "WebPageNode"): Promise<WebPageNode[]>;
|
|
5346
5629
|
getNodesWithType(type: "DesignPageNode"): Promise<DesignPageNode[]>;
|
|
5347
5630
|
getNodesWithType(type: "ComponentNode"): Promise<ComponentNode[]>;
|
|
5348
|
-
/** Get all nodes with a certain attribute.
|
|
5631
|
+
/** Get all nodes with a certain attribute.
|
|
5632
|
+
* @category canvas
|
|
5633
|
+
*/
|
|
5349
5634
|
getNodesWithAttribute<T extends NodeAttributeKey, Node = NodeWithAttribute<T>>(attribute: T): Promise<Node[]>;
|
|
5350
|
-
/** Get all nodes with a certain attribute which value is set.
|
|
5635
|
+
/** Get all nodes with a certain attribute which value is set.
|
|
5636
|
+
* @category canvas
|
|
5637
|
+
*/
|
|
5351
5638
|
getNodesWithAttributeSet<T extends NodeAttributeKey, Node = NodeWithAttribute<T>>(attribute: T): Promise<Node[]>;
|
|
5352
5639
|
/**
|
|
5353
5640
|
* Get the image of the current selection or `null` if there is no image.
|
|
5354
5641
|
*
|
|
5355
5642
|
* In `editImage` mode, this returns the image the user already has set,
|
|
5356
5643
|
* which your plugin can then modify.
|
|
5644
|
+
* @category canvas
|
|
5357
5645
|
*/
|
|
5358
5646
|
getImage(): Promise<ImageAsset | null>;
|
|
5359
5647
|
/** Subscribe to single image selection changes. */
|
|
5360
5648
|
subscribeToImage(imageUpdate: (image: ImageAsset | null) => void): Unsubscribe$1;
|
|
5361
|
-
/** Upload an image, and insert on the canvas.
|
|
5649
|
+
/** Upload an image, and insert on the canvas.
|
|
5650
|
+
* @category canvas
|
|
5651
|
+
*/
|
|
5362
5652
|
addImage(image: NamedImageAssetInput | File): Promise<void>;
|
|
5363
5653
|
/**
|
|
5364
5654
|
* Upload an image and set it on the selected node.
|
|
5365
5655
|
*
|
|
5366
5656
|
* In `image` or `editImage` mode, this is the primary method to send the
|
|
5367
5657
|
* selected or edited image back to Framer.
|
|
5658
|
+
* @category canvas
|
|
5368
5659
|
*/
|
|
5369
5660
|
setImage(image: NamedImageAssetInput | File): Promise<void>;
|
|
5370
|
-
/** Upload an image without assigning it to a property.
|
|
5661
|
+
/** Upload an image without assigning it to a property.
|
|
5662
|
+
* @category canvas
|
|
5663
|
+
*/
|
|
5371
5664
|
uploadImage(image: NamedImageAssetInput | File): Promise<ImageAsset>;
|
|
5372
|
-
/** Add multiple images, replacing the selected images, or insert on the canvas.
|
|
5665
|
+
/** Add multiple images, replacing the selected images, or insert on the canvas.
|
|
5666
|
+
* @category canvas
|
|
5667
|
+
*/
|
|
5373
5668
|
addImages(images: readonly NamedImageAssetInput[]): Promise<void>;
|
|
5374
|
-
/** Upload multiple images without assigning them to properties.
|
|
5669
|
+
/** Upload multiple images without assigning them to properties.
|
|
5670
|
+
* @category canvas
|
|
5671
|
+
*/
|
|
5375
5672
|
uploadImages(images: readonly NamedImageAssetInput[]): Promise<ImageAsset[]>;
|
|
5376
|
-
/** Uploads a file without assigning it to a property.
|
|
5673
|
+
/** Uploads a file without assigning it to a property.
|
|
5674
|
+
* @category canvas
|
|
5675
|
+
*/
|
|
5377
5676
|
uploadFile(file: NamedFileAssetInput | File): Promise<FileAsset>;
|
|
5378
|
-
/** Upload multiple files without assigning them to properties.
|
|
5677
|
+
/** Upload multiple files without assigning them to properties.
|
|
5678
|
+
* @category canvas
|
|
5679
|
+
*/
|
|
5379
5680
|
uploadFiles(files: readonly NamedFileAssetInput[]): Promise<FileAsset[]>;
|
|
5380
|
-
/** Add an SVG, replacing the selected SVG, or insert on the canvas.
|
|
5681
|
+
/** Add an SVG, replacing the selected SVG, or insert on the canvas.
|
|
5682
|
+
* @category canvas
|
|
5683
|
+
*/
|
|
5381
5684
|
addSVG(svg: SVGData): Promise<void>;
|
|
5382
5685
|
/**
|
|
5383
5686
|
* Add a component instance by module URL.
|
|
@@ -5386,22 +5689,34 @@ declare class FramerPluginAPI {
|
|
|
5386
5689
|
* @param attributes - Optional component attributes.
|
|
5387
5690
|
*
|
|
5388
5691
|
* @returns The newly created component instance node.
|
|
5692
|
+
* @category canvas
|
|
5389
5693
|
*/
|
|
5390
5694
|
addComponentInstance({ url, attributes, parentId, }: AddComponentInstanceOptions): Promise<ComponentInstanceNode>;
|
|
5391
|
-
/** Adds the layers of a component by module URL.
|
|
5695
|
+
/** Adds the layers of a component by module URL.
|
|
5696
|
+
* @category canvas
|
|
5697
|
+
*/
|
|
5392
5698
|
addDetachedComponentLayers({ url, layout, attributes }: AddDetachedComponentLayersOptions): Promise<FrameNode>;
|
|
5393
|
-
/** Preload the component layers for detached insertion.
|
|
5699
|
+
/** Preload the component layers for detached insertion.
|
|
5700
|
+
* @category canvas
|
|
5701
|
+
*/
|
|
5394
5702
|
preloadDetachedComponentLayers(url: string): Promise<void>;
|
|
5395
5703
|
preloadImageUrlForInsertion(url: string): Promise<void>;
|
|
5396
5704
|
preloadDragPreviewImage(url: string): Promise<void>;
|
|
5397
|
-
/** Get plaintext of the current selection or null if there is no text.
|
|
5705
|
+
/** Get plaintext of the current selection or null if there is no text.
|
|
5706
|
+
* @category canvas
|
|
5707
|
+
*/
|
|
5398
5708
|
getText(): Promise<string | null>;
|
|
5399
|
-
/** Set the text of the current selection or insert it onto the canvas.
|
|
5709
|
+
/** Set the text of the current selection or insert it onto the canvas.
|
|
5710
|
+
* @category canvas
|
|
5711
|
+
*/
|
|
5400
5712
|
setText(text: string): Promise<void>;
|
|
5401
|
-
/** Add a new text node to the canvas.
|
|
5713
|
+
/** Add a new text node to the canvas.
|
|
5714
|
+
* @category canvas
|
|
5715
|
+
*/
|
|
5402
5716
|
addText(text: string, options?: AddTextOptions): Promise<void>;
|
|
5403
5717
|
/**
|
|
5404
5718
|
* Install a custom code snippet in the user's website via `<script>` tags.
|
|
5719
|
+
*
|
|
5405
5720
|
* A plugin can only set custom HTML once per location. Custom code should be
|
|
5406
5721
|
* valid HTML. Setting `html` to `null` clears the installed code snippet.
|
|
5407
5722
|
*
|
|
@@ -5414,11 +5729,14 @@ declare class FramerPluginAPI {
|
|
|
5414
5729
|
* location: "bodyEnd"
|
|
5415
5730
|
* })
|
|
5416
5731
|
* ```
|
|
5732
|
+
* @category code-files
|
|
5417
5733
|
*/
|
|
5418
5734
|
setCustomCode(options: SetCustomCodeOptions): Promise<void>;
|
|
5419
5735
|
/**
|
|
5420
|
-
* Get custom code settings set by the plugin.
|
|
5421
|
-
*
|
|
5736
|
+
* Get custom code settings set by the plugin.
|
|
5737
|
+
*
|
|
5738
|
+
* Your plugin can detect if custom code was set and whether the user has
|
|
5739
|
+
* disabled it.
|
|
5422
5740
|
*
|
|
5423
5741
|
* @example
|
|
5424
5742
|
* ```ts
|
|
@@ -5427,11 +5745,14 @@ declare class FramerPluginAPI {
|
|
|
5427
5745
|
* // Custom code was disabled by the user in settings
|
|
5428
5746
|
* }
|
|
5429
5747
|
* ```
|
|
5748
|
+
* @category code-files
|
|
5430
5749
|
*/
|
|
5431
5750
|
getCustomCode(): Promise<CustomCode>;
|
|
5432
5751
|
/**
|
|
5433
|
-
* Subscribe to custom code changes.
|
|
5434
|
-
*
|
|
5752
|
+
* Subscribe to custom code changes.
|
|
5753
|
+
*
|
|
5754
|
+
* Called when custom code is registered or when changes to the settings
|
|
5755
|
+
* are made.
|
|
5435
5756
|
*
|
|
5436
5757
|
* @param callback - Called when custom code settings change.
|
|
5437
5758
|
* @returns A function to unsubscribe from updates.
|
|
@@ -5449,9 +5770,12 @@ declare class FramerPluginAPI {
|
|
|
5449
5770
|
/** Subscribe to the current text selection. */
|
|
5450
5771
|
subscribeToText(callback: (text: string | null) => void): Unsubscribe$1;
|
|
5451
5772
|
/**
|
|
5452
|
-
* Allow any HTML element to become draggable.
|
|
5453
|
-
*
|
|
5773
|
+
* Allow any HTML element to become draggable.
|
|
5774
|
+
*
|
|
5775
|
+
* Different types of drag data can be dropped onto Framer. A function is
|
|
5776
|
+
* returned to remove the draggable behavior from the element and to stop
|
|
5454
5777
|
* all of the added listeners.
|
|
5778
|
+
* @category canvas
|
|
5455
5779
|
*/
|
|
5456
5780
|
makeDraggable(element: HTMLElement, getDragData: () => DragData, onDragComplete?: DragCompleteCallback): Cleanup;
|
|
5457
5781
|
/**
|
|
@@ -5463,9 +5787,12 @@ declare class FramerPluginAPI {
|
|
|
5463
5787
|
* ```ts
|
|
5464
5788
|
* const collection = await framer.getActiveManagedCollection();
|
|
5465
5789
|
* ```
|
|
5790
|
+
* @category cms
|
|
5466
5791
|
*/
|
|
5467
5792
|
getActiveManagedCollection(): Promise<ManagedCollection>;
|
|
5468
|
-
/** @deprecated Use `getActiveManagedCollection`
|
|
5793
|
+
/** @deprecated Use `getActiveManagedCollection`
|
|
5794
|
+
* @category cms
|
|
5795
|
+
*/
|
|
5469
5796
|
getManagedCollection(): Promise<ManagedCollection>;
|
|
5470
5797
|
/**
|
|
5471
5798
|
* Retrieve Collections that are managed by the current Plugin.
|
|
@@ -5477,9 +5804,12 @@ declare class FramerPluginAPI {
|
|
|
5477
5804
|
* ```ts
|
|
5478
5805
|
* const managedCollections = await framer.getManagedCollections();
|
|
5479
5806
|
* ```
|
|
5807
|
+
* @category cms
|
|
5480
5808
|
*/
|
|
5481
5809
|
getManagedCollections(): Promise<ManagedCollection[]>;
|
|
5482
|
-
/** Get a collection by its id.
|
|
5810
|
+
/** Get a collection by its id.
|
|
5811
|
+
* @category cms
|
|
5812
|
+
*/
|
|
5483
5813
|
getCollection(id: NodeId): Promise<Collection | null>;
|
|
5484
5814
|
/**
|
|
5485
5815
|
* Retrieve the Collection currently active (selected) in the Framer UI.
|
|
@@ -5493,6 +5823,7 @@ declare class FramerPluginAPI {
|
|
|
5493
5823
|
* ```ts
|
|
5494
5824
|
* const collection = await framer.getActiveCollection();
|
|
5495
5825
|
* ```
|
|
5826
|
+
* @category cms
|
|
5496
5827
|
*/
|
|
5497
5828
|
getActiveCollection(): Promise<Collection | null>;
|
|
5498
5829
|
/**
|
|
@@ -5502,10 +5833,13 @@ declare class FramerPluginAPI {
|
|
|
5502
5833
|
* ```ts
|
|
5503
5834
|
* const collections = await framer.getCollections()
|
|
5504
5835
|
* ```
|
|
5836
|
+
* @category cms
|
|
5505
5837
|
*/
|
|
5506
5838
|
getCollections(): Promise<Collection[]>;
|
|
5507
5839
|
/**
|
|
5508
|
-
* Display a notification message.
|
|
5840
|
+
* Display a notification message.
|
|
5841
|
+
*
|
|
5842
|
+
* The message will be truncated if longer than 120 characters.
|
|
5509
5843
|
*
|
|
5510
5844
|
* @param message - The message to display. Truncated if longer than 120 characters.
|
|
5511
5845
|
* @param options - Options like `variant` (`"info"`, `"success"`, `"warning"`, `"error"`), `durationMs`, `button`, and `onDisappear`.
|
|
@@ -5523,34 +5857,55 @@ declare class FramerPluginAPI {
|
|
|
5523
5857
|
* // Close the notification programmatically
|
|
5524
5858
|
* notification.close()
|
|
5525
5859
|
* ```
|
|
5860
|
+
* @category plugin-ui
|
|
5526
5861
|
*/
|
|
5527
5862
|
notify: Notify;
|
|
5528
|
-
/** Get plugin data by key.
|
|
5863
|
+
/** Get plugin data by key.
|
|
5864
|
+
* @category plugin-ui
|
|
5865
|
+
*/
|
|
5529
5866
|
getPluginData(key: string): Promise<string | null>;
|
|
5530
|
-
/** Set plugin data by key.
|
|
5867
|
+
/** Set plugin data by key.
|
|
5868
|
+
* @category plugin-ui
|
|
5869
|
+
*/
|
|
5531
5870
|
setPluginData(key: string, value: string | null): Promise<void>;
|
|
5532
|
-
/** Get all plugin data keys.
|
|
5871
|
+
/** Get all plugin data keys.
|
|
5872
|
+
* @category plugin-ui
|
|
5873
|
+
*/
|
|
5533
5874
|
getPluginDataKeys(): Promise<string[]>;
|
|
5534
|
-
/** Get all color styles in the project.
|
|
5875
|
+
/** Get all color styles in the project.
|
|
5876
|
+
* @category canvas
|
|
5877
|
+
*/
|
|
5535
5878
|
getColorStyles(): Promise<ColorStyle[]>;
|
|
5536
|
-
/** Get a specific color style.
|
|
5879
|
+
/** Get a specific color style.
|
|
5880
|
+
* @category canvas
|
|
5881
|
+
*/
|
|
5537
5882
|
getColorStyle(id: NodeId): Promise<ColorStyle | null>;
|
|
5538
|
-
/** Add a new color style to the project.
|
|
5883
|
+
/** Add a new color style to the project.
|
|
5884
|
+
* @category canvas
|
|
5885
|
+
*/
|
|
5539
5886
|
createColorStyle(attributes: ColorStyleAttributes): Promise<ColorStyle>;
|
|
5540
5887
|
/** Fired when a color style is added, edited or removed. */
|
|
5541
5888
|
subscribeToColorStyles(callback: (styles: ColorStyle[]) => void): Unsubscribe$1;
|
|
5542
|
-
/** Get all text styles in the project.
|
|
5889
|
+
/** Get all text styles in the project.
|
|
5890
|
+
* @category canvas
|
|
5891
|
+
*/
|
|
5543
5892
|
getTextStyles(): Promise<TextStyle[]>;
|
|
5544
|
-
/** Get a specific text style.
|
|
5893
|
+
/** Get a specific text style.
|
|
5894
|
+
* @category canvas
|
|
5895
|
+
*/
|
|
5545
5896
|
getTextStyle(id: NodeId): Promise<TextStyle | null>;
|
|
5546
|
-
/** Add a new text style to the project.
|
|
5897
|
+
/** Add a new text style to the project.
|
|
5898
|
+
* @category canvas
|
|
5899
|
+
*/
|
|
5547
5900
|
createTextStyle(attributes: TextStyleAttributes): Promise<TextStyle>;
|
|
5548
5901
|
/** Fired when a text style is added, edited or removed. */
|
|
5549
5902
|
subscribeToTextStyles(callback: (styles: TextStyle[]) => void): Unsubscribe$1;
|
|
5550
5903
|
/**
|
|
5551
|
-
* Get a specific font from a family by name.
|
|
5552
|
-
*
|
|
5553
|
-
*
|
|
5904
|
+
* Get a specific font from a family by name.
|
|
5905
|
+
*
|
|
5906
|
+
* This is not case sensitive. By default, returns a font with normal weight
|
|
5907
|
+
* and style. Returns `null` if the font does not exist or lacks the
|
|
5908
|
+
* requested weight/style combination.
|
|
5554
5909
|
*
|
|
5555
5910
|
* Note: Custom fonts are not available to plugins.
|
|
5556
5911
|
*
|
|
@@ -5569,12 +5924,15 @@ declare class FramerPluginAPI {
|
|
|
5569
5924
|
* style: "italic"
|
|
5570
5925
|
* })
|
|
5571
5926
|
* ```
|
|
5927
|
+
* @category canvas
|
|
5572
5928
|
*/
|
|
5573
5929
|
getFont(family: string, attributes?: FontAttributes): Promise<Font | null>;
|
|
5574
5930
|
/**
|
|
5575
|
-
* Get all available fonts.
|
|
5576
|
-
*
|
|
5577
|
-
*
|
|
5931
|
+
* Get all available fonts.
|
|
5932
|
+
*
|
|
5933
|
+
* Unlike the Font Picker which groups fonts by typeface, this lists
|
|
5934
|
+
* individual fonts for each weight and style (each representing a separate
|
|
5935
|
+
* font file).
|
|
5578
5936
|
*
|
|
5579
5937
|
* Note: Custom fonts are not available to plugins.
|
|
5580
5938
|
*
|
|
@@ -5584,6 +5942,7 @@ declare class FramerPluginAPI {
|
|
|
5584
5942
|
* ```ts
|
|
5585
5943
|
* const fonts = await framer.getFonts()
|
|
5586
5944
|
* ```
|
|
5945
|
+
* @category canvas
|
|
5587
5946
|
*/
|
|
5588
5947
|
getFonts(): Promise<Font[]>;
|
|
5589
5948
|
/**
|
|
@@ -5595,6 +5954,7 @@ declare class FramerPluginAPI {
|
|
|
5595
5954
|
* ```ts
|
|
5596
5955
|
* const locales = await framer.getLocales()
|
|
5597
5956
|
* ```
|
|
5957
|
+
* @category localization
|
|
5598
5958
|
*/
|
|
5599
5959
|
getLocales(): Promise<readonly Locale[]>;
|
|
5600
5960
|
/**
|
|
@@ -5604,6 +5964,7 @@ declare class FramerPluginAPI {
|
|
|
5604
5964
|
* ```ts
|
|
5605
5965
|
* const defaultLocale = await framer.getDefaultLocale()
|
|
5606
5966
|
* ```
|
|
5967
|
+
* @category localization
|
|
5607
5968
|
*/
|
|
5608
5969
|
getDefaultLocale(): Promise<Locale>;
|
|
5609
5970
|
/**
|
|
@@ -5617,6 +5978,7 @@ declare class FramerPluginAPI {
|
|
|
5617
5978
|
* ```ts
|
|
5618
5979
|
* const activeLocale = await framer.getActiveLocale()
|
|
5619
5980
|
* ```
|
|
5981
|
+
* @category localization
|
|
5620
5982
|
*/
|
|
5621
5983
|
getActiveLocale(): Promise<Locale | null>;
|
|
5622
5984
|
/**
|
|
@@ -5635,6 +5997,7 @@ declare class FramerPluginAPI {
|
|
|
5635
5997
|
* // Get specific groups by ID
|
|
5636
5998
|
* const specific = await framer.getLocalizationGroups({ groupIds: ["id1", "id2"] })
|
|
5637
5999
|
* ```
|
|
6000
|
+
* @category localization
|
|
5638
6001
|
*/
|
|
5639
6002
|
getLocalizationGroups(filter?: GetLocalizationGroupsFilter): Promise<readonly LocalizationGroup[]>;
|
|
5640
6003
|
/**
|
|
@@ -5658,6 +6021,7 @@ declare class FramerPluginAPI {
|
|
|
5658
6021
|
* }
|
|
5659
6022
|
* })
|
|
5660
6023
|
* ```
|
|
6024
|
+
* @category localization
|
|
5661
6025
|
*/
|
|
5662
6026
|
setLocalizationData(update: LocalizationData): Promise<SetLocalizationDataResult>;
|
|
5663
6027
|
/**
|
|
@@ -5669,6 +6033,7 @@ declare class FramerPluginAPI {
|
|
|
5669
6033
|
* ```ts
|
|
5670
6034
|
* const redirects = await framer.getRedirects()
|
|
5671
6035
|
* ```
|
|
6036
|
+
* @category settings
|
|
5672
6037
|
*/
|
|
5673
6038
|
getRedirects(): Promise<readonly Redirect[]>;
|
|
5674
6039
|
/** Subscribe to redirect changes. */
|
|
@@ -5694,10 +6059,13 @@ declare class FramerPluginAPI {
|
|
|
5694
6059
|
* { from: "/posts/*", to: "/blog/:1", expandToAllLocales: false },
|
|
5695
6060
|
* ])
|
|
5696
6061
|
* ```
|
|
6062
|
+
* @category settings
|
|
5697
6063
|
*/
|
|
5698
6064
|
addRedirects(redirects: RedirectInput[]): Promise<Redirect[]>;
|
|
5699
6065
|
/**
|
|
5700
|
-
* Remove Redirects from the project.
|
|
6066
|
+
* Remove Redirects from the project.
|
|
6067
|
+
*
|
|
6068
|
+
* Unknown Redirect IDs are ignored.
|
|
5701
6069
|
*
|
|
5702
6070
|
* Throws a `FramerPluginError` when the user lacks Site Settings permissions
|
|
5703
6071
|
* or when the project plan does not include Redirects.
|
|
@@ -5708,10 +6076,13 @@ declare class FramerPluginAPI {
|
|
|
5708
6076
|
* ```ts
|
|
5709
6077
|
* await framer.removeRedirects([aboutPageRedirect.id, blogPageRedirect.id])
|
|
5710
6078
|
* ```
|
|
6079
|
+
* @category settings
|
|
5711
6080
|
*/
|
|
5712
6081
|
removeRedirects(redirectIds: string[]): Promise<void>;
|
|
5713
6082
|
/**
|
|
5714
|
-
* Set the order of Redirects in the list.
|
|
6083
|
+
* Set the order of Redirects in the list.
|
|
6084
|
+
*
|
|
6085
|
+
* Unknown Redirect IDs are ignored.
|
|
5715
6086
|
*
|
|
5716
6087
|
* Throws a `FramerPluginError` when the user lacks Site Settings permissions
|
|
5717
6088
|
* or when the project plan does not include Redirects.
|
|
@@ -5722,6 +6093,7 @@ declare class FramerPluginAPI {
|
|
|
5722
6093
|
* ```ts
|
|
5723
6094
|
* await framer.setRedirectOrder([aboutPageRedirect.id, blogPageRedirect.id])
|
|
5724
6095
|
* ```
|
|
6096
|
+
* @category settings
|
|
5725
6097
|
*/
|
|
5726
6098
|
setRedirectOrder(redirectIds: string[]): Promise<void>;
|
|
5727
6099
|
/**
|
|
@@ -5741,6 +6113,7 @@ declare class FramerPluginAPI {
|
|
|
5741
6113
|
* }`
|
|
5742
6114
|
* )
|
|
5743
6115
|
* ```
|
|
6116
|
+
* @category code-files
|
|
5744
6117
|
*/
|
|
5745
6118
|
createCodeFile(name: string, code: string, options?: {
|
|
5746
6119
|
editViaPlugin?: boolean;
|
|
@@ -5755,6 +6128,7 @@ declare class FramerPluginAPI {
|
|
|
5755
6128
|
* const allFiles = await framer.getCodeFiles()
|
|
5756
6129
|
* console.log(`Project has ${allFiles.length} code files`)
|
|
5757
6130
|
* ```
|
|
6131
|
+
* @category code-files
|
|
5758
6132
|
*/
|
|
5759
6133
|
getCodeFiles(): Promise<readonly CodeFile[]>;
|
|
5760
6134
|
/**
|
|
@@ -5767,6 +6141,7 @@ declare class FramerPluginAPI {
|
|
|
5767
6141
|
* ```ts
|
|
5768
6142
|
* const codeFile = await framer.getCodeFile("code-file-id")
|
|
5769
6143
|
* ```
|
|
6144
|
+
* @category code-files
|
|
5770
6145
|
*/
|
|
5771
6146
|
getCodeFile(id: string): Promise<CodeFile | null>;
|
|
5772
6147
|
/**
|
|
@@ -5786,12 +6161,14 @@ declare class FramerPluginAPI {
|
|
|
5786
6161
|
* @param content - The content of the code file.
|
|
5787
6162
|
* @param compilerOptions - Optional compiler options to override the default compiler options for type checking.
|
|
5788
6163
|
* @param sessionId - Optional session ID. Pass it when repeatedly type checking the same file. If not provided, a new session will be created for each type check, which is slow.
|
|
6164
|
+
* @category code-files
|
|
5789
6165
|
*/
|
|
5790
6166
|
typecheckCode(fileName: string, content: string, compilerOptions?: ts.server.protocol.CompilerOptions, sessionId?: string): Promise<TypecheckDiagnostic[]>;
|
|
5791
6167
|
/**
|
|
5792
|
-
* Subscribe to changes in code files across the project.
|
|
5793
|
-
*
|
|
5794
|
-
*
|
|
6168
|
+
* Subscribe to changes in code files across the project.
|
|
6169
|
+
*
|
|
6170
|
+
* The callback is called when code files are added, removed, or updated,
|
|
6171
|
+
* and receives an array of all code files in the project.
|
|
5795
6172
|
*
|
|
5796
6173
|
* @param callback - Function called when code files change.
|
|
5797
6174
|
* @returns A function to stop listening to changes.
|
|
@@ -5828,6 +6205,7 @@ declare class FramerPluginAPI {
|
|
|
5828
6205
|
* },
|
|
5829
6206
|
* ])
|
|
5830
6207
|
* ```
|
|
6208
|
+
* @category plugin-ui
|
|
5831
6209
|
*/
|
|
5832
6210
|
setMenu(menuItems: MenuItem[]): Promise<void>;
|
|
5833
6211
|
/**
|
|
@@ -5860,6 +6238,7 @@ declare class FramerPluginAPI {
|
|
|
5860
6238
|
* }
|
|
5861
6239
|
* )
|
|
5862
6240
|
* ```
|
|
6241
|
+
* @category plugin-ui
|
|
5863
6242
|
*/
|
|
5864
6243
|
showContextMenu(menuItems: MenuItem[], config: ContextMenuConfig): Promise<void>;
|
|
5865
6244
|
/**
|
|
@@ -5867,11 +6246,14 @@ declare class FramerPluginAPI {
|
|
|
5867
6246
|
* specified version.
|
|
5868
6247
|
*
|
|
5869
6248
|
* WARNING: This API is unstable and may change or break in the future
|
|
6249
|
+
* @category code-files
|
|
5870
6250
|
*/
|
|
5871
6251
|
unstable_ensureMinimumDependencyVersion(packageName: string, version: string): Promise<void>;
|
|
5872
6252
|
/**
|
|
5873
|
-
* Navigate the Framer UI to a target by its ID.
|
|
5874
|
-
*
|
|
6253
|
+
* Navigate the Framer UI to a target by its ID.
|
|
6254
|
+
*
|
|
6255
|
+
* When the target isn't in the current mode, it might terminate or restart
|
|
6256
|
+
* the plugin in the new mode.
|
|
5875
6257
|
*
|
|
5876
6258
|
* @param nodeId - The ID of the node to navigate to.
|
|
5877
6259
|
* @param opts - The options for the navigation.
|
|
@@ -5881,11 +6263,13 @@ declare class FramerPluginAPI {
|
|
|
5881
6263
|
* ```ts
|
|
5882
6264
|
* await framer.navigateTo(nodeId, opts)
|
|
5883
6265
|
* ```
|
|
6266
|
+
* @category navigation
|
|
5884
6267
|
*/
|
|
5885
6268
|
navigateTo(nodeId: string, opts?: NavigableOptions): Promise<void>;
|
|
5886
6269
|
/**
|
|
5887
|
-
* Subscribe to changes in the Code Editor's active file.
|
|
5888
|
-
*
|
|
6270
|
+
* Subscribe to changes in the Code Editor's active file.
|
|
6271
|
+
*
|
|
6272
|
+
* This function is primarily useful when the plugin's mode is `"code"`.
|
|
5889
6273
|
*
|
|
5890
6274
|
* @param callback - Function called when the active code file changes.
|
|
5891
6275
|
* @returns A function to stop listening to changes.
|
|
@@ -5915,6 +6299,7 @@ declare class FramerPluginAPI {
|
|
|
5915
6299
|
* const designPage = await framer.createDesignPage("About")
|
|
5916
6300
|
* await designPage.navigateTo()
|
|
5917
6301
|
* ```
|
|
6302
|
+
* @category canvas
|
|
5918
6303
|
*/
|
|
5919
6304
|
createDesignPage(pageName: string): Promise<DesignPageNode>;
|
|
5920
6305
|
/**
|
|
@@ -5929,12 +6314,14 @@ declare class FramerPluginAPI {
|
|
|
5929
6314
|
* const webPage = await framer.createWebPage("/about")
|
|
5930
6315
|
* await webPage.navigateTo()
|
|
5931
6316
|
* ```
|
|
6317
|
+
* @category canvas
|
|
5932
6318
|
*/
|
|
5933
6319
|
createWebPage(pagePath: string): Promise<WebPageNode>;
|
|
5934
6320
|
/**
|
|
5935
6321
|
* Create a new collection.
|
|
5936
6322
|
*
|
|
5937
6323
|
* @param name - The name to give the new collection.
|
|
6324
|
+
* @category cms
|
|
5938
6325
|
*/
|
|
5939
6326
|
createCollection(name: string): Promise<Collection>;
|
|
5940
6327
|
/**
|
|
@@ -5948,6 +6335,7 @@ declare class FramerPluginAPI {
|
|
|
5948
6335
|
* ```ts
|
|
5949
6336
|
* const newCollection = await framer.createManagedCollection(name)
|
|
5950
6337
|
* ```
|
|
6338
|
+
* @category cms
|
|
5951
6339
|
*/
|
|
5952
6340
|
createManagedCollection(name: string): Promise<ManagedCollection>;
|
|
5953
6341
|
/**
|
|
@@ -5965,6 +6353,7 @@ declare class FramerPluginAPI {
|
|
|
5965
6353
|
* // Remove the close warning
|
|
5966
6354
|
* await framer.setCloseWarning(false)
|
|
5967
6355
|
* ```
|
|
6356
|
+
* @category settings
|
|
5968
6357
|
*/
|
|
5969
6358
|
setCloseWarning(message: string | false): Promise<void>;
|
|
5970
6359
|
/**
|
|
@@ -6579,7 +6968,10 @@ declare const fileAssetDiscriminator: "FileAsset";
|
|
|
6579
6968
|
interface FileAssetData extends AssetIdentifier, FileAssetDataFields {
|
|
6580
6969
|
[classKey]: typeof fileAssetDiscriminator;
|
|
6581
6970
|
}
|
|
6582
|
-
/**
|
|
6971
|
+
/**
|
|
6972
|
+
* A file asset uploaded to the Framer project.
|
|
6973
|
+
* @category canvas
|
|
6974
|
+
*/
|
|
6583
6975
|
declare class FileAsset implements AssetIdentifier, FileAssetDataFields {
|
|
6584
6976
|
readonly id: AssetId;
|
|
6585
6977
|
readonly url: string;
|
|
@@ -6622,6 +7014,7 @@ interface Size {
|
|
|
6622
7014
|
/**
|
|
6623
7015
|
* An image that has been uploaded to the Framer project. Provides methods
|
|
6624
7016
|
* to access image data, measure dimensions, and load as bitmap or HTML element.
|
|
7017
|
+
* @category canvas
|
|
6625
7018
|
*/
|
|
6626
7019
|
declare class ImageAsset implements ImageDataFields, AssetIdentifier {
|
|
6627
7020
|
#private;
|