framer-api 0.0.1-alpha.3
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/README.md +25 -0
- package/dist/index.d.ts +4604 -0
- package/dist/index.js +14 -0
- package/package.json +60 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,4604 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
import { CSSProperties } from 'react';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* This alias takes a type as its argument and returns a new type that has the same properties as
|
|
6
|
+
* the original, but the properties are not intersected. This makes the new type easier to read and
|
|
7
|
+
* understand.
|
|
8
|
+
*
|
|
9
|
+
* Example:
|
|
10
|
+
* ```ts
|
|
11
|
+
* // Original type:
|
|
12
|
+
* { a: string; } & { b: number; } & { c: boolean; }
|
|
13
|
+
*
|
|
14
|
+
* // New type:
|
|
15
|
+
* { a: string; b: number; c: boolean; }
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
type Prettify<T> = {
|
|
19
|
+
[K in keyof T]: T[K] extends object ? Prettify<T[K]> : T[K];
|
|
20
|
+
} & {};
|
|
21
|
+
|
|
22
|
+
declare class FramerPluginError extends Error {
|
|
23
|
+
name: string;
|
|
24
|
+
}
|
|
25
|
+
declare class FramerPluginClosedError extends Error {
|
|
26
|
+
name: string;
|
|
27
|
+
}
|
|
28
|
+
type NodeRuntimeErrorResult = {
|
|
29
|
+
type: "ModuleRuntimeError" | "ReactRenderingError";
|
|
30
|
+
message: string;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/** @alpha */
|
|
34
|
+
interface Breakpoint {
|
|
35
|
+
/** Name of the breakpoint as displayed on the node */
|
|
36
|
+
name: string;
|
|
37
|
+
/** Width of the breakpoint in pixels */
|
|
38
|
+
width: number;
|
|
39
|
+
/** The height of the viewport in pixels. This is an optional value that is used for correctly
|
|
40
|
+
* displaying fixed positioned elements on the canvas. */
|
|
41
|
+
viewportHeight?: number;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
type LintRuleNameValue = "forbid-browser-apis";
|
|
45
|
+
type LintIssueSeverityValue = "error" | "warning";
|
|
46
|
+
type LintConfig = Record<LintRuleNameValue, LintIssueSeverityValue>;
|
|
47
|
+
interface DiagnosticBase {
|
|
48
|
+
message: string;
|
|
49
|
+
span?: DiagnosticSpan;
|
|
50
|
+
}
|
|
51
|
+
interface DiagnosticSpan {
|
|
52
|
+
/** The first character, counted from the beginning of the file, 0-based. */
|
|
53
|
+
offset: number;
|
|
54
|
+
length: number;
|
|
55
|
+
/** The first character, 0-based. */
|
|
56
|
+
start: ts.LineAndCharacter;
|
|
57
|
+
/** The last character, 0-based. */
|
|
58
|
+
end: ts.LineAndCharacter;
|
|
59
|
+
}
|
|
60
|
+
interface LintLink {
|
|
61
|
+
url: string;
|
|
62
|
+
text: string;
|
|
63
|
+
}
|
|
64
|
+
interface LintDiagnostic extends DiagnosticBase {
|
|
65
|
+
/** The span of the invalid code in the file. */
|
|
66
|
+
span: DiagnosticSpan;
|
|
67
|
+
severity: LintIssueSeverityValue;
|
|
68
|
+
link?: LintLink;
|
|
69
|
+
}
|
|
70
|
+
interface TypecheckDiagnostic extends DiagnosticBase {
|
|
71
|
+
/**
|
|
72
|
+
* The span of the invalid code in the file.
|
|
73
|
+
* Could be undefined if the diagnostic is system-level (and not file-specific), like e.g. an error about invalid TS options.
|
|
74
|
+
*/
|
|
75
|
+
span?: DiagnosticSpan;
|
|
76
|
+
/** Could be undefined if the diagnostic is system-level (and not file-specific), like e.g. an error about invalid TS options */
|
|
77
|
+
fileName?: string;
|
|
78
|
+
code: number;
|
|
79
|
+
category: ts.DiagnosticCategory;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
declare const getAiServiceInfo: unique symbol;
|
|
83
|
+
declare const sendTrackingEvent: unique symbol;
|
|
84
|
+
declare const environmentInfo: unique symbol;
|
|
85
|
+
declare const showUncheckedPermissionToasts: unique symbol;
|
|
86
|
+
declare const marshal: unique symbol;
|
|
87
|
+
declare const unmarshal: unique symbol;
|
|
88
|
+
declare const getHTMLForNode: unique symbol;
|
|
89
|
+
declare const setHTMLForNode: unique symbol;
|
|
90
|
+
declare const $framerInternal: {
|
|
91
|
+
readonly getAiServiceInfo: typeof getAiServiceInfo;
|
|
92
|
+
readonly sendTrackingEvent: typeof sendTrackingEvent;
|
|
93
|
+
readonly environmentInfo: typeof environmentInfo;
|
|
94
|
+
readonly showUncheckedPermissionToasts: typeof showUncheckedPermissionToasts;
|
|
95
|
+
readonly marshal: typeof marshal;
|
|
96
|
+
readonly unmarshal: typeof unmarshal;
|
|
97
|
+
readonly getHTMLForNode: typeof getHTMLForNode;
|
|
98
|
+
readonly setHTMLForNode: typeof setHTMLForNode;
|
|
99
|
+
};
|
|
100
|
+
declare const getAiServiceInfoMessageType = "INTERNAL_getAiServiceInfo";
|
|
101
|
+
declare const sendTrackingEventMessageType = "INTERNAL_sendTrackingEvent";
|
|
102
|
+
declare const getHTMLForNodeMessageType = "INTERNAL_getHTMLForNode";
|
|
103
|
+
declare const setHTMLForNodeMessageType = "INTERNAL_setHTMLForNode";
|
|
104
|
+
|
|
105
|
+
type LocaleId = string;
|
|
106
|
+
interface Locale {
|
|
107
|
+
id: LocaleId;
|
|
108
|
+
code: string;
|
|
109
|
+
name: string;
|
|
110
|
+
slug: string;
|
|
111
|
+
fallbackLocaleId?: string;
|
|
112
|
+
}
|
|
113
|
+
interface LocalizationValueBase {
|
|
114
|
+
/** A `value` of `null` means that the value explicitly falls back to the fallback locale */
|
|
115
|
+
value: string | null;
|
|
116
|
+
lastEdited: number;
|
|
117
|
+
/**
|
|
118
|
+
* Whether the value is read only and therefore cannot be updated.
|
|
119
|
+
*
|
|
120
|
+
* For example, this is the case for localized values that were set
|
|
121
|
+
* when syncing a managed collection. To update these values, you must
|
|
122
|
+
* sync using the plugin that manages the collection.
|
|
123
|
+
*/
|
|
124
|
+
readonly: boolean;
|
|
125
|
+
}
|
|
126
|
+
interface LocalizationValueNew {
|
|
127
|
+
value: null;
|
|
128
|
+
status: "new";
|
|
129
|
+
}
|
|
130
|
+
interface LocalizationValueNeedsReview extends LocalizationValueBase {
|
|
131
|
+
status: "needsReview";
|
|
132
|
+
}
|
|
133
|
+
interface LocalizationValueDone extends LocalizationValueBase {
|
|
134
|
+
status: "done";
|
|
135
|
+
}
|
|
136
|
+
interface LocalizationValueWarning extends LocalizationValueBase {
|
|
137
|
+
status: "warning";
|
|
138
|
+
warning: string;
|
|
139
|
+
}
|
|
140
|
+
type LocalizationValue = LocalizationValueNew | LocalizationValueNeedsReview | LocalizationValueDone | LocalizationValueWarning;
|
|
141
|
+
type LocalizationValueByLocale = Record<LocaleId, LocalizationValue>;
|
|
142
|
+
type InlineLocalizationValueByLocale = Record<LocaleId, LocalizationValue>;
|
|
143
|
+
type LocalizationGroupId = string;
|
|
144
|
+
type LocalizationSourceId = string;
|
|
145
|
+
type LocalizedValueStatus = LocalizationValue["status"];
|
|
146
|
+
type LocalizationSourceType = "string" | "formattedText" | "altText" | "slug" | "link";
|
|
147
|
+
interface LocalizationSource {
|
|
148
|
+
/** A stable ID of the localization source that can be used for updating and synchronizing */
|
|
149
|
+
id: LocalizationSourceId;
|
|
150
|
+
/** The type of value for this source */
|
|
151
|
+
type: LocalizationSourceType;
|
|
152
|
+
/** Current Source value */
|
|
153
|
+
value: string;
|
|
154
|
+
/** Localized values and metadata for each locale */
|
|
155
|
+
valueByLocale: LocalizationValueByLocale;
|
|
156
|
+
}
|
|
157
|
+
type LocalizationGroupStatus = "excluded" | "ready";
|
|
158
|
+
type LocalizationGroupStatusByLocale = Record<LocaleId, LocalizationGroupStatus>;
|
|
159
|
+
interface LocalizationGroup {
|
|
160
|
+
id: LocalizationGroupId;
|
|
161
|
+
name: string;
|
|
162
|
+
type: "collection" | "collection-item" | "component" | "page" | "settings" | "template";
|
|
163
|
+
supportsExcludedStatus: boolean;
|
|
164
|
+
sources: LocalizationSource[];
|
|
165
|
+
statusByLocale: LocalizationGroupStatusByLocale;
|
|
166
|
+
}
|
|
167
|
+
type LocalizedValueUpdate = {
|
|
168
|
+
action: "set";
|
|
169
|
+
value: string;
|
|
170
|
+
needsReview?: boolean;
|
|
171
|
+
} | {
|
|
172
|
+
action: "clear";
|
|
173
|
+
} | {
|
|
174
|
+
action: "ignore";
|
|
175
|
+
needsReview?: boolean;
|
|
176
|
+
};
|
|
177
|
+
type LocalizationSourceUpdate = Record<LocaleId, LocalizedValueUpdate>;
|
|
178
|
+
interface LocalizationData {
|
|
179
|
+
valuesBySource?: Record<LocalizationSourceId, LocalizationSourceUpdate>;
|
|
180
|
+
statusByLocaleByGroup?: Record<LocalizationGroupId, LocalizationGroupStatusByLocale>;
|
|
181
|
+
}
|
|
182
|
+
interface LocalizationValueError {
|
|
183
|
+
sourceId: LocalizationSourceId;
|
|
184
|
+
localeId: LocaleId | null;
|
|
185
|
+
error: string;
|
|
186
|
+
}
|
|
187
|
+
interface LocalizationStatusByLocaleError {
|
|
188
|
+
groupId: LocalizationGroupId;
|
|
189
|
+
error: string;
|
|
190
|
+
}
|
|
191
|
+
interface SetLocalizationDataResult {
|
|
192
|
+
/** Set one or more localized values */
|
|
193
|
+
valuesBySource: {
|
|
194
|
+
errors: readonly LocalizationValueError[];
|
|
195
|
+
};
|
|
196
|
+
/** Set the hidden locale IDs of one or more localization groups */
|
|
197
|
+
statusByLocaleByGroup: {
|
|
198
|
+
errors: readonly LocalizationStatusByLocaleError[];
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* The opposite of Partial, can't omit it. Useful for making sure that you don't forget to handle a
|
|
204
|
+
* new property in all cases where objects are built.
|
|
205
|
+
*/
|
|
206
|
+
type ExplicitPartial<T> = {
|
|
207
|
+
[P in keyof T]: T[P] | undefined;
|
|
208
|
+
};
|
|
209
|
+
/** Type helper to transform a interface so that each value can be null. */
|
|
210
|
+
type NullableRecord<T> = {
|
|
211
|
+
[P in keyof T]-?: T[P] | null;
|
|
212
|
+
};
|
|
213
|
+
/** Type helper to transform a interface so that each value can be null or undefined. */
|
|
214
|
+
type NullablePartialRecord<T> = Partial<NullableRecord<T>>;
|
|
215
|
+
declare const classKey: "__class";
|
|
216
|
+
type ClassKey = typeof classKey;
|
|
217
|
+
|
|
218
|
+
type ComputedValue = UnsupportedComputedValue;
|
|
219
|
+
declare abstract class ComputedValueBase {
|
|
220
|
+
abstract readonly type: typeof unsupportedComputedValueType;
|
|
221
|
+
}
|
|
222
|
+
declare const unsupportedComputedValueClass = "UnsupportedComputedValue";
|
|
223
|
+
declare const unsupportedComputedValueType = "unsupported";
|
|
224
|
+
interface WithUnsupportedComputedValueClass {
|
|
225
|
+
[classKey]: typeof unsupportedComputedValueClass;
|
|
226
|
+
}
|
|
227
|
+
type UnsupportedComputedValueData = WithUnsupportedComputedValueClass;
|
|
228
|
+
declare class UnsupportedComputedValue extends ComputedValueBase {
|
|
229
|
+
#private;
|
|
230
|
+
readonly type = "unsupported";
|
|
231
|
+
constructor(data: UnsupportedComputedValueData);
|
|
232
|
+
static [$framerInternal.unmarshal](_: PluginEngine, data: UnsupportedComputedValueData): UnsupportedComputedValue;
|
|
233
|
+
[$framerInternal.marshal](): UnsupportedComputedValueData;
|
|
234
|
+
}
|
|
235
|
+
declare function isComputedValue(value: unknown): value is ComputedValueBase;
|
|
236
|
+
|
|
237
|
+
declare const fontClassDiscriminator = "Font";
|
|
238
|
+
type FontSelector = string;
|
|
239
|
+
interface FontData {
|
|
240
|
+
[classKey]: typeof fontClassDiscriminator;
|
|
241
|
+
selector: FontSelector;
|
|
242
|
+
family: string;
|
|
243
|
+
weight: FontWeight | null;
|
|
244
|
+
style: FontStyle$1 | null;
|
|
245
|
+
}
|
|
246
|
+
type FontAttributes = Prettify<Partial<{
|
|
247
|
+
weight: FontWeight;
|
|
248
|
+
style: FontStyle$1;
|
|
249
|
+
}>>;
|
|
250
|
+
declare const fontStyles: readonly ["normal", "italic"];
|
|
251
|
+
type FontStyle$1 = (typeof fontStyles)[number];
|
|
252
|
+
declare const fontWeights: readonly [100, 200, 300, 400, 500, 600, 700, 800, 900];
|
|
253
|
+
/**
|
|
254
|
+
* Boldness as an absolute value.
|
|
255
|
+
*
|
|
256
|
+
* These values are usually associated with the following names:
|
|
257
|
+
* - `100` - Thin
|
|
258
|
+
* - `200` - Extra Light (Ultra Light)
|
|
259
|
+
* - `300` - Light
|
|
260
|
+
* - `400` - Normal
|
|
261
|
+
* - `500` - Medium
|
|
262
|
+
* - `600` - Semi Bold (Demi Bold)
|
|
263
|
+
* - `700` - Bold
|
|
264
|
+
* - `800` - Extra Bold
|
|
265
|
+
* - `900` - Black (Heavy)
|
|
266
|
+
* */
|
|
267
|
+
type FontWeight = (typeof fontWeights)[number];
|
|
268
|
+
declare class Font {
|
|
269
|
+
/** An identifier used internally for differentiating fonts. */
|
|
270
|
+
readonly selector: string;
|
|
271
|
+
/** Name of the family the font belongs to. */
|
|
272
|
+
readonly family: string;
|
|
273
|
+
/**
|
|
274
|
+
* Specifies how thin or bold the font appears.
|
|
275
|
+
*
|
|
276
|
+
* Note: This will be `null` for custom fonts since their weight isn't
|
|
277
|
+
* calculated.
|
|
278
|
+
* */
|
|
279
|
+
readonly weight: FontWeight | null;
|
|
280
|
+
/**
|
|
281
|
+
* Specifies if the font is normal or _italic_.
|
|
282
|
+
*
|
|
283
|
+
* Note: This will be `null` for custom fonts since their weight isn't
|
|
284
|
+
* calculated.
|
|
285
|
+
* */
|
|
286
|
+
readonly style: FontStyle$1 | null;
|
|
287
|
+
constructor(data: FontData);
|
|
288
|
+
static [$framerInternal.unmarshal](_: PluginEngine, data: FontData): Font;
|
|
289
|
+
[$framerInternal.marshal](): FontData;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
declare enum CSSUnit {
|
|
293
|
+
Pixel = "px",
|
|
294
|
+
Rem = "rem",
|
|
295
|
+
Em = "em",
|
|
296
|
+
Percentage = "%",
|
|
297
|
+
Fraction = "fr",
|
|
298
|
+
ViewportWidth = "vw",
|
|
299
|
+
ViewportHeight = "vh"
|
|
300
|
+
}
|
|
301
|
+
type CSSDimension<U extends CSSUnit> = `${number}${U}`;
|
|
302
|
+
|
|
303
|
+
type TextNodeTag = "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "p";
|
|
304
|
+
type TextTransform = "none" | "inherit" | "capitalize" | "uppercase" | "lowercase";
|
|
305
|
+
type TextAlignment = "left" | "center" | "right" | "justify";
|
|
306
|
+
type TextDecoration = "none" | "underline" | "line-through";
|
|
307
|
+
type TextDecorationStyle = "solid" | "double" | "dotted" | "dashed" | "wavy";
|
|
308
|
+
type TextDecorationSkipInk = "none" | "all" | "auto";
|
|
309
|
+
interface AddTextOptions {
|
|
310
|
+
tag: TextNodeTag;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
interface WithKey {
|
|
314
|
+
key: string;
|
|
315
|
+
}
|
|
316
|
+
interface WithTitle {
|
|
317
|
+
title: string;
|
|
318
|
+
}
|
|
319
|
+
interface WithDescription$1 {
|
|
320
|
+
description: string;
|
|
321
|
+
}
|
|
322
|
+
interface ControlBase extends WithKey, Partial<WithTitle>, Partial<WithDescription$1> {
|
|
323
|
+
}
|
|
324
|
+
interface EnumOption extends Partial<WithTitle> {
|
|
325
|
+
id: string | boolean | number | null;
|
|
326
|
+
}
|
|
327
|
+
interface EnumControl extends ControlBase {
|
|
328
|
+
type: "enum";
|
|
329
|
+
/** The ID of the selected option */
|
|
330
|
+
value?: string | boolean | number | null | UnsupportedVariable | UnsupportedComputedValue | undefined;
|
|
331
|
+
options: EnumOption[];
|
|
332
|
+
}
|
|
333
|
+
interface BooleanControl extends ControlBase {
|
|
334
|
+
type: "boolean";
|
|
335
|
+
value?: boolean | BooleanVariable | UnsupportedComputedValue | undefined;
|
|
336
|
+
}
|
|
337
|
+
interface BorderControl extends ControlBase {
|
|
338
|
+
type: "border";
|
|
339
|
+
value?: Border | BorderVariable | undefined;
|
|
340
|
+
}
|
|
341
|
+
interface Shadow {
|
|
342
|
+
type: "box" | "realistic";
|
|
343
|
+
inset: boolean;
|
|
344
|
+
color: string | ColorStyle;
|
|
345
|
+
x: number;
|
|
346
|
+
y: number;
|
|
347
|
+
blur: number;
|
|
348
|
+
spread: number;
|
|
349
|
+
diffusion: number;
|
|
350
|
+
focus: number;
|
|
351
|
+
}
|
|
352
|
+
interface ShadowControl extends ControlBase {
|
|
353
|
+
type: "shadow";
|
|
354
|
+
value?: readonly Shadow[] | UnsupportedVariable | UnsupportedComputedValue | undefined;
|
|
355
|
+
}
|
|
356
|
+
interface DateControl extends ControlBase {
|
|
357
|
+
type: "date";
|
|
358
|
+
value?: string | DateVariable | UnsupportedComputedValue | undefined;
|
|
359
|
+
}
|
|
360
|
+
interface NumberControl extends ControlBase {
|
|
361
|
+
type: "number";
|
|
362
|
+
value?: number | NumberVariable | UnsupportedComputedValue | undefined;
|
|
363
|
+
}
|
|
364
|
+
interface Transition {
|
|
365
|
+
type: "spring" | "tween" | "inertia" | false;
|
|
366
|
+
ease: [number, number, number, number];
|
|
367
|
+
duration: number;
|
|
368
|
+
delay: number;
|
|
369
|
+
stiffness: number;
|
|
370
|
+
damping: number;
|
|
371
|
+
mass: number;
|
|
372
|
+
durationBasedSpring?: boolean;
|
|
373
|
+
bounce?: number;
|
|
374
|
+
stagger?: number;
|
|
375
|
+
}
|
|
376
|
+
interface TransitionControl extends ControlBase {
|
|
377
|
+
type: "transition";
|
|
378
|
+
value?: Transition | UnsupportedVariable | undefined;
|
|
379
|
+
}
|
|
380
|
+
interface StringControl extends ControlBase {
|
|
381
|
+
type: "string";
|
|
382
|
+
value?: string | StringVariable | UnsupportedVariable | UnsupportedComputedValue | undefined;
|
|
383
|
+
}
|
|
384
|
+
interface ColorControl extends ControlBase {
|
|
385
|
+
type: "color";
|
|
386
|
+
value?: string | ColorStyle | ColorVariable | UnsupportedComputedValue | undefined;
|
|
387
|
+
}
|
|
388
|
+
interface FormattedTextControl extends ControlBase {
|
|
389
|
+
type: "formattedText";
|
|
390
|
+
value?: string | FormattedTextVariable | UnsupportedComputedValue | undefined;
|
|
391
|
+
}
|
|
392
|
+
interface WithCollectionItemId {
|
|
393
|
+
collectionItemId: string;
|
|
394
|
+
}
|
|
395
|
+
interface ScrollSectionSelector extends Partial<WithCollectionItemId> {
|
|
396
|
+
targetNodeId: string;
|
|
397
|
+
}
|
|
398
|
+
interface LinkToWebPage extends Partial<WithCollectionItemId> {
|
|
399
|
+
type: "webPage";
|
|
400
|
+
webPageId: string;
|
|
401
|
+
scrollSection?: ScrollSectionSelector | undefined;
|
|
402
|
+
}
|
|
403
|
+
interface LinkToUrl {
|
|
404
|
+
type: "url";
|
|
405
|
+
url: string;
|
|
406
|
+
}
|
|
407
|
+
type Link = LinkToWebPage | LinkToUrl;
|
|
408
|
+
interface LinkControl extends ControlBase {
|
|
409
|
+
type: "link";
|
|
410
|
+
value?: Link | LinkVariable | FileVariable | UnsupportedComputedValue | undefined;
|
|
411
|
+
}
|
|
412
|
+
type Rel = "nofollow" | "noreferrer" | "me" | "ugc" | "sponsored";
|
|
413
|
+
interface LinkRelControl extends ControlBase {
|
|
414
|
+
type: "linkRel";
|
|
415
|
+
value?: readonly Rel[] | UnsupportedVariable | undefined;
|
|
416
|
+
}
|
|
417
|
+
type FontStyle = Pick<CSSProperties, "fontFamily" | "fontWeight" | "fontStyle" | "fontSize" | "lineHeight" | "textAlign" | "letterSpacing" | "fontFeatureSettings">;
|
|
418
|
+
interface FontControl extends ControlBase {
|
|
419
|
+
type: "font";
|
|
420
|
+
value?: FontStyle | undefined;
|
|
421
|
+
}
|
|
422
|
+
interface PageScopeControl extends ControlBase {
|
|
423
|
+
type: "pageScope";
|
|
424
|
+
value?: LinkToWebPage | undefined;
|
|
425
|
+
}
|
|
426
|
+
interface ScrollSectionControl extends ControlBase {
|
|
427
|
+
type: "scrollSection";
|
|
428
|
+
value?: ScrollSectionSelector | UnsupportedVariable | undefined;
|
|
429
|
+
}
|
|
430
|
+
interface CustomCursor {
|
|
431
|
+
smartComponentId?: string | undefined;
|
|
432
|
+
variant?: string | undefined;
|
|
433
|
+
follow?: boolean | undefined;
|
|
434
|
+
offsetX?: number | undefined;
|
|
435
|
+
offsetY?: number | undefined;
|
|
436
|
+
placement?: "top" | "right" | "bottom" | "left" | undefined;
|
|
437
|
+
alignment?: "start" | "center" | "end" | undefined;
|
|
438
|
+
transitionEnabled?: boolean | undefined;
|
|
439
|
+
transition?: Transition | undefined;
|
|
440
|
+
}
|
|
441
|
+
interface CustomCursorControl extends ControlBase {
|
|
442
|
+
type: "customCursor";
|
|
443
|
+
value?: CustomCursor | UnsupportedVariable | undefined;
|
|
444
|
+
}
|
|
445
|
+
type CSSCursor = "default" | "pointer" | "progress" | "copy" | "no-drop" | "not-allowed" | "grab" | "grabbing" | "context-menu" | "cell" | "crosshair" | "alias" | "zoom-in" | "zoom-out" | "help" | "nw-resize" | "n-resize" | "ne-resize" | "w-resize" | "move" | "e-resize" | "sw-resize" | "s-resize" | "se-resize" | "ew-resize" | "ns-resize" | "nwse-resize" | "nesw-resize" | "col-resize" | "row-resize" | "text" | "vertical-text" | "none";
|
|
446
|
+
interface CursorControl extends ControlBase {
|
|
447
|
+
type: "cursor";
|
|
448
|
+
value?: CSSCursor | UnsupportedVariable | undefined;
|
|
449
|
+
}
|
|
450
|
+
interface FileControl extends ControlBase {
|
|
451
|
+
type: "file";
|
|
452
|
+
value?: FileAsset | FileVariable | UnsupportedVariable | UnsupportedComputedValue | undefined;
|
|
453
|
+
}
|
|
454
|
+
type PixelNumber = `${number}px`;
|
|
455
|
+
type TwoPixelNumberShorthand = PixelNumber | `${PixelNumber} ${PixelNumber}`;
|
|
456
|
+
interface GapControl extends ControlBase {
|
|
457
|
+
type: "gap";
|
|
458
|
+
value?: TwoPixelNumberShorthand | UnsupportedVariable | NumberVariable | UnsupportedComputedValue | undefined;
|
|
459
|
+
}
|
|
460
|
+
type FourPixelNumberShorthand = PixelNumber | `${PixelNumber} ${PixelNumber} ${PixelNumber} ${PixelNumber}`;
|
|
461
|
+
interface PaddingControl extends ControlBase {
|
|
462
|
+
type: "padding";
|
|
463
|
+
value?: FourPixelNumberShorthand | UnsupportedVariable | NumberVariable | UnsupportedComputedValue | undefined;
|
|
464
|
+
}
|
|
465
|
+
type RelativeNumber = `${number}%`;
|
|
466
|
+
type RelativeOrFourPixelNumberShorthand = RelativeNumber | FourPixelNumberShorthand;
|
|
467
|
+
interface BorderRadiusControl extends ControlBase {
|
|
468
|
+
type: "borderRadius";
|
|
469
|
+
value?: RelativeOrFourPixelNumberShorthand | UnsupportedVariable | NumberVariable | UnsupportedComputedValue | undefined;
|
|
470
|
+
}
|
|
471
|
+
interface CollectionReferenceControl extends ControlBase {
|
|
472
|
+
type: "collectionReference";
|
|
473
|
+
value?: string | UnsupportedVariable | undefined;
|
|
474
|
+
}
|
|
475
|
+
interface MultiCollectionReferenceControl extends ControlBase {
|
|
476
|
+
type: "multiCollectionReference";
|
|
477
|
+
value?: readonly string[] | UnsupportedVariable | UnsupportedComputedValue | undefined;
|
|
478
|
+
}
|
|
479
|
+
interface VectorSetItemControl extends ControlBase {
|
|
480
|
+
type: "vectorSetItem";
|
|
481
|
+
value?: string | UnsupportedVariable | undefined;
|
|
482
|
+
}
|
|
483
|
+
interface TrackingIdControl extends ControlBase {
|
|
484
|
+
type: "trackingId";
|
|
485
|
+
value?: string | UnsupportedVariable | undefined;
|
|
486
|
+
}
|
|
487
|
+
interface ImageControl extends ControlBase {
|
|
488
|
+
type: "image";
|
|
489
|
+
value?: ImageAsset | ImageVariable | UnsupportedComputedValue | undefined;
|
|
490
|
+
}
|
|
491
|
+
interface FusedNumber {
|
|
492
|
+
single: number;
|
|
493
|
+
fused: [number, number, number, number];
|
|
494
|
+
isFused: boolean;
|
|
495
|
+
}
|
|
496
|
+
interface FusedNumberControl extends ControlBase {
|
|
497
|
+
type: "fusedNumber";
|
|
498
|
+
value?: FusedNumber | undefined;
|
|
499
|
+
}
|
|
500
|
+
interface ObjectControl extends ControlBase {
|
|
501
|
+
type: "object";
|
|
502
|
+
value?: Record<string, Control> | undefined;
|
|
503
|
+
}
|
|
504
|
+
type ArrayItemControl = BooleanControl | BorderControl | ColorControl | CursorControl | CustomCursorControl | DateControl | EnumControl | FileControl | FormattedTextControl | ImageControl | LinkControl | NumberControl | ObjectControl | ScrollSectionControl | SlotControl | StringControl | TransitionControl;
|
|
505
|
+
interface ArrayItem$1<T extends ArrayItemControl> {
|
|
506
|
+
id: string;
|
|
507
|
+
value: T["value"];
|
|
508
|
+
}
|
|
509
|
+
interface ArrayControlBase<T extends ArrayItemControl> extends ControlBase {
|
|
510
|
+
type: "array";
|
|
511
|
+
/** Use this to narrow the type of `value` and `itemControl`. */
|
|
512
|
+
itemType: T["type"];
|
|
513
|
+
value?: ArrayItem$1<T>[] | UnsupportedComputedValue | undefined;
|
|
514
|
+
itemControl: Omit<T, "value">;
|
|
515
|
+
}
|
|
516
|
+
type ArrayControlHelper<T extends ArrayItemControl = ArrayItemControl> = T extends unknown ? ArrayControlBase<T> : never;
|
|
517
|
+
type ArrayControl = ArrayControlHelper;
|
|
518
|
+
interface EventHandlerControl extends ControlBase {
|
|
519
|
+
type: "eventHandler";
|
|
520
|
+
value?: undefined;
|
|
521
|
+
}
|
|
522
|
+
interface SlotItem {
|
|
523
|
+
id: string;
|
|
524
|
+
nodeId?: string | undefined;
|
|
525
|
+
}
|
|
526
|
+
interface SlotControl extends ControlBase {
|
|
527
|
+
type: "slot";
|
|
528
|
+
value?: readonly SlotItem[] | undefined;
|
|
529
|
+
}
|
|
530
|
+
type Control = EnumControl | BooleanControl | BorderControl | ShadowControl | DateControl | NumberControl | TransitionControl | StringControl | ColorControl | FormattedTextControl | LinkControl | LinkRelControl | FontControl | PageScopeControl | ScrollSectionControl | CustomCursorControl | CursorControl | FileControl | GapControl | PaddingControl | BorderRadiusControl | CollectionReferenceControl | MultiCollectionReferenceControl | VectorSetItemControl | TrackingIdControl | ImageControl | FusedNumberControl | ObjectControl | ArrayControl | EventHandlerControl | SlotControl;
|
|
531
|
+
interface WithTypedControlsTrait {
|
|
532
|
+
readonly typedControls: Marshaled<Record<string, Control>>;
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
type NodeId = string;
|
|
536
|
+
interface WithIdTrait {
|
|
537
|
+
readonly id: NodeId;
|
|
538
|
+
}
|
|
539
|
+
type Gesture = "hover" | "pressed" | "loading" | "error";
|
|
540
|
+
interface WithReplicaInfoTrait {
|
|
541
|
+
readonly originalId: string | null;
|
|
542
|
+
}
|
|
543
|
+
interface WithComponentVariantTrait {
|
|
544
|
+
readonly isVariant: boolean;
|
|
545
|
+
readonly isPrimaryVariant: boolean;
|
|
546
|
+
readonly gesture: Gesture | null;
|
|
547
|
+
readonly inheritsFromId: string | null;
|
|
548
|
+
}
|
|
549
|
+
interface IsComponentVariant {
|
|
550
|
+
readonly isVariant: true;
|
|
551
|
+
readonly isPrimaryVariant: boolean;
|
|
552
|
+
readonly inheritsFromId: string;
|
|
553
|
+
}
|
|
554
|
+
interface IsComponentGestureVariant extends IsComponentVariant {
|
|
555
|
+
readonly gesture: Gesture;
|
|
556
|
+
}
|
|
557
|
+
interface WithNameTrait {
|
|
558
|
+
readonly name: string | null;
|
|
559
|
+
}
|
|
560
|
+
interface WithVisibleTrait {
|
|
561
|
+
readonly visible: boolean;
|
|
562
|
+
}
|
|
563
|
+
interface WithLockedTrait {
|
|
564
|
+
readonly locked: boolean;
|
|
565
|
+
}
|
|
566
|
+
interface WithBreakpointTrait {
|
|
567
|
+
readonly isBreakpoint: boolean;
|
|
568
|
+
readonly isPrimaryBreakpoint: boolean;
|
|
569
|
+
}
|
|
570
|
+
interface IsBreakpoint {
|
|
571
|
+
readonly isBreakpoint: true;
|
|
572
|
+
readonly isPrimaryBreakpoint: boolean;
|
|
573
|
+
}
|
|
574
|
+
interface WithBackgroundColorTrait<T extends TraitVariant> {
|
|
575
|
+
/** Color of the frame in RGBA format, e.g `rgba(242, 59, 57, 1)`, or as a `ColorStyle` instance. */
|
|
576
|
+
readonly backgroundColor: (T extends TraitVariantData ? ColorStyleData : ColorStyle) | string | null;
|
|
577
|
+
}
|
|
578
|
+
interface WithBackgroundImageTrait<T extends TraitVariant> {
|
|
579
|
+
readonly backgroundImage: (T extends TraitVariantData ? ImageAssetData : ImageAsset) | null;
|
|
580
|
+
}
|
|
581
|
+
interface WithBackgroundGradientTrait<T extends TraitVariant> {
|
|
582
|
+
readonly backgroundGradient: (T extends TraitVariantData ? GradientData : Gradient) | null;
|
|
583
|
+
}
|
|
584
|
+
interface WithRotationTrait {
|
|
585
|
+
readonly rotation: number;
|
|
586
|
+
}
|
|
587
|
+
interface WithOpacityTrait {
|
|
588
|
+
readonly opacity: number;
|
|
589
|
+
}
|
|
590
|
+
type BorderRadius = CSSDimension<CSSUnit.Percentage | CSSUnit.Pixel> | `${CSSDimension<CSSUnit.Pixel>} ${CSSDimension<CSSUnit.Pixel>} ${CSSDimension<CSSUnit.Pixel>} ${CSSDimension<CSSUnit.Pixel>}` | null;
|
|
591
|
+
interface WithBorderRadiusTrait {
|
|
592
|
+
readonly borderRadius: BorderRadius;
|
|
593
|
+
}
|
|
594
|
+
type BorderWidth = CSSDimension<CSSUnit.Pixel> | `${CSSDimension<CSSUnit.Pixel>} ${CSSDimension<CSSUnit.Pixel>} ${CSSDimension<CSSUnit.Pixel>} ${CSSDimension<CSSUnit.Pixel>}`;
|
|
595
|
+
type BorderStyle = "solid" | "dashed" | "dotted" | "double";
|
|
596
|
+
interface Border {
|
|
597
|
+
width: BorderWidth;
|
|
598
|
+
color: ColorStyle | string;
|
|
599
|
+
style: BorderStyle;
|
|
600
|
+
}
|
|
601
|
+
interface WithBorderTrait<T extends TraitVariant> {
|
|
602
|
+
readonly border: (T extends TraitVariantData ? Marshaled<Border> : Border) | null;
|
|
603
|
+
}
|
|
604
|
+
type ImageRendering = "auto" | "pixelated";
|
|
605
|
+
interface WithImageRenderingTrait {
|
|
606
|
+
readonly imageRendering: ImageRendering | null;
|
|
607
|
+
}
|
|
608
|
+
type Overflow = "visible" | "hidden" | "auto" | "clip";
|
|
609
|
+
type AxisOverflow = Overflow;
|
|
610
|
+
interface WithOverflowTrait {
|
|
611
|
+
readonly overflow: Overflow | null;
|
|
612
|
+
readonly overflowX: AxisOverflow | null;
|
|
613
|
+
readonly overflowY: AxisOverflow | null;
|
|
614
|
+
}
|
|
615
|
+
interface WithTextTruncationTrait {
|
|
616
|
+
readonly textTruncation: number | null;
|
|
617
|
+
}
|
|
618
|
+
interface WithZIndexTrait {
|
|
619
|
+
readonly zIndex: number | null;
|
|
620
|
+
}
|
|
621
|
+
interface WithRequiredComponentInfoTrait {
|
|
622
|
+
readonly componentIdentifier: string;
|
|
623
|
+
}
|
|
624
|
+
interface WithNullableComponentInfoTrait {
|
|
625
|
+
readonly insertURL: string | null;
|
|
626
|
+
readonly componentName: string | null;
|
|
627
|
+
}
|
|
628
|
+
interface WithComponentInfoTrait extends WithRequiredComponentInfoTrait, WithNullableComponentInfoTrait {
|
|
629
|
+
}
|
|
630
|
+
interface WithWebPageInfoTrait {
|
|
631
|
+
readonly path: string | null;
|
|
632
|
+
readonly collectionId: string | null;
|
|
633
|
+
}
|
|
634
|
+
interface WithLinkTrait {
|
|
635
|
+
readonly link: string | null;
|
|
636
|
+
readonly linkOpenInNewTab: boolean | null;
|
|
637
|
+
}
|
|
638
|
+
type ControlAttributes = Record<string, unknown>;
|
|
639
|
+
interface WithControlAttributesTrait {
|
|
640
|
+
readonly controls: ControlAttributes;
|
|
641
|
+
}
|
|
642
|
+
interface WithSVGTrait {
|
|
643
|
+
readonly svg: string;
|
|
644
|
+
}
|
|
645
|
+
type Position = "relative" | "absolute" | "fixed" | "sticky";
|
|
646
|
+
interface WithPositionTrait {
|
|
647
|
+
position: Position;
|
|
648
|
+
}
|
|
649
|
+
type FitContent = "fit-content";
|
|
650
|
+
type FitImage = "fit-image";
|
|
651
|
+
interface WithPinsTrait {
|
|
652
|
+
top: CSSDimension<CSSUnit.Pixel> | null;
|
|
653
|
+
right: CSSDimension<CSSUnit.Pixel> | null;
|
|
654
|
+
bottom: CSSDimension<CSSUnit.Pixel> | null;
|
|
655
|
+
left: CSSDimension<CSSUnit.Pixel> | null;
|
|
656
|
+
centerX: CSSDimension<CSSUnit.Percentage> | null;
|
|
657
|
+
centerY: CSSDimension<CSSUnit.Percentage> | null;
|
|
658
|
+
}
|
|
659
|
+
type Length = CSSDimension<CSSUnit.Pixel | CSSUnit.Percentage | CSSUnit.Fraction>;
|
|
660
|
+
type WidthLength = Length | FitContent | FitImage;
|
|
661
|
+
type HeightLength = Length | FitContent | CSSDimension<CSSUnit.ViewportHeight> | FitImage;
|
|
662
|
+
interface WithSizeTrait {
|
|
663
|
+
width: WidthLength | null;
|
|
664
|
+
height: HeightLength | null;
|
|
665
|
+
}
|
|
666
|
+
interface WithAspectRatioTrait {
|
|
667
|
+
aspectRatio: number | null;
|
|
668
|
+
}
|
|
669
|
+
type WidthConstraint = CSSDimension<CSSUnit.Pixel | CSSUnit.Percentage>;
|
|
670
|
+
type HeightConstraint = CSSDimension<CSSUnit.Pixel | CSSUnit.Percentage | CSSUnit.ViewportHeight>;
|
|
671
|
+
interface WithSizeConstraintsTrait {
|
|
672
|
+
maxWidth: WidthConstraint | null;
|
|
673
|
+
minWidth: WidthConstraint | null;
|
|
674
|
+
maxHeight: HeightConstraint | null;
|
|
675
|
+
minHeight: HeightConstraint | null;
|
|
676
|
+
}
|
|
677
|
+
interface WithInlineTextStyleTrait<T extends TraitVariant> {
|
|
678
|
+
readonly inlineTextStyle: (T extends TraitVariantData ? TextStyleData : TextStyle) | null;
|
|
679
|
+
}
|
|
680
|
+
interface WithFontTrait<T extends TraitVariant> {
|
|
681
|
+
readonly font: (T extends TraitVariantData ? FontData : Font) | null;
|
|
682
|
+
}
|
|
683
|
+
type TraitVariantData = "data";
|
|
684
|
+
type TraitVariantNode = "node";
|
|
685
|
+
type StackDirection = "horizontal" | "vertical";
|
|
686
|
+
type StackDistribution = "start" | "center" | "end" | "space-between" | "space-around" | "space-evenly";
|
|
687
|
+
type StackAlignment = "start" | "center" | "end";
|
|
688
|
+
type LayoutType = "stack" | "grid";
|
|
689
|
+
interface StackLayout {
|
|
690
|
+
stackDirection: StackDirection | null;
|
|
691
|
+
stackDistribution: StackDistribution | null;
|
|
692
|
+
stackAlignment: StackAlignment | null;
|
|
693
|
+
stackWrapEnabled: boolean | null;
|
|
694
|
+
}
|
|
695
|
+
type GridContentAlignment = "start" | "center" | "end";
|
|
696
|
+
interface GridLayout {
|
|
697
|
+
gridColumnCount: number | "auto-fill" | null;
|
|
698
|
+
gridRowCount: number | null;
|
|
699
|
+
gridAlignment: GridContentAlignment | null;
|
|
700
|
+
gridColumnWidthType: "fixed" | "minmax" | null;
|
|
701
|
+
gridColumnWidth: number | null;
|
|
702
|
+
gridColumnMinWidth: number | null;
|
|
703
|
+
gridRowHeightType: "fixed" | "auto" | "fit" | null;
|
|
704
|
+
gridRowHeight: number | null;
|
|
705
|
+
}
|
|
706
|
+
interface WithLayoutTrait extends StackLayout, GridLayout {
|
|
707
|
+
layout: LayoutType | null;
|
|
708
|
+
gap: CSSDimension<CSSUnit.Pixel> | `${CSSDimension<CSSUnit.Pixel>} ${CSSDimension<CSSUnit.Pixel>}` | null;
|
|
709
|
+
padding: CSSDimension<CSSUnit.Pixel> | `${CSSDimension<CSSUnit.Pixel>} ${CSSDimension<CSSUnit.Pixel>} ${CSSDimension<CSSUnit.Pixel>} ${CSSDimension<CSSUnit.Pixel>}` | null;
|
|
710
|
+
}
|
|
711
|
+
type GridItemAlignment = "start" | "center" | "end";
|
|
712
|
+
type GridItemColumnSpan = number | "all";
|
|
713
|
+
interface WithGridItemTrait {
|
|
714
|
+
gridItemFillCellWidth: boolean | null;
|
|
715
|
+
gridItemFillCellHeight: boolean | null;
|
|
716
|
+
gridItemHorizontalAlignment: GridItemAlignment | null;
|
|
717
|
+
gridItemVerticalAlignment: GridItemAlignment | null;
|
|
718
|
+
gridItemColumnSpan: GridItemColumnSpan | null;
|
|
719
|
+
gridItemRowSpan: number | null;
|
|
720
|
+
}
|
|
721
|
+
type TraitVariant = TraitVariantData | TraitVariantNode;
|
|
722
|
+
interface AllTraits<T extends TraitVariant = TraitVariant> extends WithIdTrait, WithNameTrait, WithVisibleTrait, WithLockedTrait, WithBackgroundColorTrait<T>, WithBackgroundImageTrait<T>, WithBackgroundGradientTrait<T>, WithRotationTrait, WithOpacityTrait, WithBorderRadiusTrait, WithBorderTrait<T>, WithOverflowTrait, WithComponentInfoTrait, WithControlAttributesTrait, WithTypedControlsTrait, WithSVGTrait, WithPositionTrait, WithPinsTrait, WithSizeTrait, WithSizeConstraintsTrait, WithAspectRatioTrait, WithTextTruncationTrait, WithImageRenderingTrait, WithZIndexTrait, WithFontTrait<T>, WithInlineTextStyleTrait<T>, WithWebPageInfoTrait, WithLayoutTrait, WithGridItemTrait, WithComponentVariantTrait, WithBreakpointTrait, WithLinkTrait {
|
|
723
|
+
}
|
|
724
|
+
type NodeAttributeKey = Prettify<Exclude<keyof AllTraits<TraitVariantNode>, "id" | "children">>;
|
|
725
|
+
type PartialNodeData = AnyNode | Partial<AnyNodeData>;
|
|
726
|
+
declare function supportsPosition<T extends PartialNodeData>(node: T): node is T & WithPositionTrait;
|
|
727
|
+
declare function supportsPins<T extends PartialNodeData>(node: T): node is T & WithPinsTrait;
|
|
728
|
+
declare function supportsSize<T extends PartialNodeData>(node: T): node is T & WithSizeTrait;
|
|
729
|
+
declare function supportsSizeConstraints<T extends PartialNodeData>(node: T): node is T & WithSizeConstraintsTrait;
|
|
730
|
+
declare function supportsAspectRatio<T extends PartialNodeData>(node: T): node is T & WithAspectRatioTrait;
|
|
731
|
+
declare function supportsName<T extends PartialNodeData>(node: T): node is T & WithNameTrait;
|
|
732
|
+
declare function supportsVisible<T extends PartialNodeData>(node: T): node is T & WithVisibleTrait;
|
|
733
|
+
declare function supportsLocked<T extends PartialNodeData>(node: T): node is T & WithLockedTrait;
|
|
734
|
+
declare function supportsBackgroundColor<T extends AnyNode>(node: T): node is T & WithBackgroundColorTrait<TraitVariantNode>;
|
|
735
|
+
declare function supportsBackgroundColorData<T extends Partial<AnyNodeData>>(node: T): node is T & WithBackgroundColorTrait<TraitVariantData>;
|
|
736
|
+
declare function supportsBackgroundImage<T extends AnyNode>(node: T): node is T & WithBackgroundImageTrait<TraitVariantNode>;
|
|
737
|
+
declare function supportsBackgroundImageData<T extends Partial<AnyNodeData>>(node: T): node is T & WithBackgroundImageTrait<TraitVariantData>;
|
|
738
|
+
declare function supportsBackgroundGradient<T extends PartialNodeData>(node: T): node is T & WithBackgroundGradientTrait<TraitVariantNode>;
|
|
739
|
+
declare function supportsBackgroundGradientData<T extends PartialNodeData>(node: T): node is T & WithBackgroundGradientTrait<TraitVariantData>;
|
|
740
|
+
declare function supportsRotation<T extends PartialNodeData>(node: T): node is T & WithRotationTrait;
|
|
741
|
+
declare function supportsOpacity<T extends PartialNodeData>(node: T): node is T & WithOpacityTrait;
|
|
742
|
+
declare function supportsBorderRadius<T extends PartialNodeData>(node: T): node is T & WithBorderRadiusTrait;
|
|
743
|
+
declare function supportsBorder<T extends AnyNode>(node: T): node is T & WithBorderTrait<TraitVariantNode>;
|
|
744
|
+
declare function supportsSVG<T extends PartialNodeData>(node: T): node is T & WithSVGTrait;
|
|
745
|
+
declare function supportsTextTruncation<T extends PartialNodeData>(node: T): node is T & WithTextTruncationTrait;
|
|
746
|
+
declare function supportsZIndex<T extends PartialNodeData>(node: T): node is T & WithZIndexTrait;
|
|
747
|
+
declare function supportsOverflow<T extends PartialNodeData>(node: T): node is T & WithOverflowTrait;
|
|
748
|
+
declare function supportsComponentInfo<T extends PartialNodeData>(node: T): node is T & WithComponentInfoTrait;
|
|
749
|
+
declare function supportsFont<T extends PartialNodeData>(node: T): node is T & WithFontTrait<TraitVariantNode>;
|
|
750
|
+
declare function supportsFontData<T extends PartialNodeData>(node: T): node is T & WithFontTrait<TraitVariantData>;
|
|
751
|
+
declare function supportsInlineTextStyle<T extends PartialNodeData>(node: T): node is T & WithInlineTextStyleTrait<TraitVariantNode>;
|
|
752
|
+
declare function supportsInlineTextStyleData<T extends PartialNodeData>(node: T): node is T & WithInlineTextStyleTrait<TraitVariantData>;
|
|
753
|
+
declare function supportsLink<T extends PartialNodeData>(node: T): node is T & WithLinkTrait;
|
|
754
|
+
declare function supportsImageRendering<T extends PartialNodeData>(node: T): node is T & WithImageRenderingTrait;
|
|
755
|
+
declare function supportsLayout<T extends PartialNodeData>(node: T): node is T & WithLayoutTrait;
|
|
756
|
+
declare function hasStackLayout<T extends PartialNodeData>(node: T): node is T & WithLayoutTrait & StackLayout;
|
|
757
|
+
declare function hasGridLayout<T extends PartialNodeData>(node: T): node is T & WithLayoutTrait & GridLayout;
|
|
758
|
+
declare function supportsComponentVariant<T extends PartialNodeData>(node: T): node is T & WithComponentVariantTrait;
|
|
759
|
+
declare function isComponentVariant<T extends AnyNode>(node: T): node is T & IsComponentVariant;
|
|
760
|
+
declare function isComponentGestureVariant<T extends AnyNode>(node: T): node is T & IsComponentGestureVariant;
|
|
761
|
+
declare function supportsBreakpoint<T extends PartialNodeData>(node: T): node is T & WithBreakpointTrait;
|
|
762
|
+
declare function isBreakpoint<T extends AnyNode>(node: T): node is T & IsBreakpoint;
|
|
763
|
+
|
|
764
|
+
declare const colorStyleDiscriminator: "ColorStyle";
|
|
765
|
+
interface WithAssetName {
|
|
766
|
+
name?: string;
|
|
767
|
+
path?: never;
|
|
768
|
+
}
|
|
769
|
+
interface WithAssetPath {
|
|
770
|
+
name?: never;
|
|
771
|
+
path?: string;
|
|
772
|
+
}
|
|
773
|
+
type AssetPath = WithAssetName | WithAssetPath;
|
|
774
|
+
interface RequiredColorStyleAttributes {
|
|
775
|
+
light: string;
|
|
776
|
+
}
|
|
777
|
+
interface OptionalColorStyleAttributes {
|
|
778
|
+
dark: string | null;
|
|
779
|
+
}
|
|
780
|
+
interface ColorStyleData extends RequiredColorStyleAttributes, OptionalColorStyleAttributes {
|
|
781
|
+
[classKey]: typeof colorStyleDiscriminator;
|
|
782
|
+
id: NodeId;
|
|
783
|
+
name: string;
|
|
784
|
+
path: string;
|
|
785
|
+
}
|
|
786
|
+
type ColorStyleAttributes = Prettify<RequiredColorStyleAttributes & Partial<OptionalColorStyleAttributes> & AssetPath>;
|
|
787
|
+
declare class ColorStyle {
|
|
788
|
+
#private;
|
|
789
|
+
readonly id: NodeId;
|
|
790
|
+
readonly name: string;
|
|
791
|
+
/**
|
|
792
|
+
* Hierarchical path to the color style in the assets folder structure, e.g. `ui/modals/background`.
|
|
793
|
+
* Used for organizing color styles in the UI and for programmatic access.
|
|
794
|
+
* Segments are separated by forward slashes.
|
|
795
|
+
*/
|
|
796
|
+
readonly path: string;
|
|
797
|
+
/** Color used for the default or light theme in RGBA format, e.g `rgba(242, 59, 57, 1)` */
|
|
798
|
+
readonly light: string;
|
|
799
|
+
/** Optional color used for the dark theme in RGBA format, e.g `rgba(242, 59, 57, 1)` */
|
|
800
|
+
readonly dark: string | null;
|
|
801
|
+
constructor(engine: PluginEngine, data: ColorStyleData);
|
|
802
|
+
static [$framerInternal.unmarshal](engine: PluginEngine, data: ColorStyleData): ColorStyle;
|
|
803
|
+
[$framerInternal.marshal](): ColorStyleData;
|
|
804
|
+
/**
|
|
805
|
+
* Set the attributes of a color style.
|
|
806
|
+
*
|
|
807
|
+
* Use `"ColorStyle.setAttributes"` to check if this method is allowed.
|
|
808
|
+
*/
|
|
809
|
+
setAttributes(update: Partial<ColorStyleAttributes>): Promise<ColorStyle | null>;
|
|
810
|
+
/**
|
|
811
|
+
* Get plugin data for this color style by key.
|
|
812
|
+
*/
|
|
813
|
+
getPluginData(key: string): Promise<string | null>;
|
|
814
|
+
/**
|
|
815
|
+
* Set plugin data on this color style by key.
|
|
816
|
+
*
|
|
817
|
+
* Use `"ColorStyle.setPluginData"` to check if this method is allowed.
|
|
818
|
+
*/
|
|
819
|
+
setPluginData(key: string, value: string | null): Promise<void>;
|
|
820
|
+
/**
|
|
821
|
+
* Get all plugin data keys for this color style.
|
|
822
|
+
*/
|
|
823
|
+
getPluginDataKeys(): Promise<string[]>;
|
|
824
|
+
/**
|
|
825
|
+
* Deletes the color style from the project.
|
|
826
|
+
*
|
|
827
|
+
* Use `"ColorStyle.remove"` to check if this method is allowed.
|
|
828
|
+
*/
|
|
829
|
+
remove(): Promise<void>;
|
|
830
|
+
}
|
|
831
|
+
declare function isColorStyle(value: unknown): value is ColorStyle;
|
|
832
|
+
type TextStyleTag = "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "p";
|
|
833
|
+
interface TextStyleBreakpointData {
|
|
834
|
+
/**
|
|
835
|
+
* How big does the window width need to be for this breakpoint's styles to
|
|
836
|
+
* take affect.
|
|
837
|
+
*
|
|
838
|
+
* This must be unique for each breakpoint.
|
|
839
|
+
* */
|
|
840
|
+
minWidth: number;
|
|
841
|
+
/** Size of the text at this breakpoint. */
|
|
842
|
+
fontSize: CSSDimension<CSSUnit.Pixel | CSSUnit.Rem>;
|
|
843
|
+
/** Size of the space between each letter at this breakpoint. */
|
|
844
|
+
letterSpacing: CSSDimension<CSSUnit.Pixel | CSSUnit.Em>;
|
|
845
|
+
/** Size of the space between each line of text at this breakpoint. */
|
|
846
|
+
lineHeight: CSSDimension<CSSUnit.Pixel | CSSUnit.Em | CSSUnit.Percentage>;
|
|
847
|
+
/** Size of the space between each paragraph at this breakpoint. */
|
|
848
|
+
paragraphSpacing: number;
|
|
849
|
+
}
|
|
850
|
+
type TextStyleBreakpointAttributes = Prettify<Partial<TextStyleBreakpointData> & Pick<TextStyleBreakpointData, "minWidth">>;
|
|
851
|
+
type TextStyleBreakpoint = Prettify<TextStyleBreakpointData>;
|
|
852
|
+
declare const textStyleDiscriminator: "TextStyle";
|
|
853
|
+
interface TextStyleData extends TextStyleBreakpointData {
|
|
854
|
+
[classKey]: typeof textStyleDiscriminator;
|
|
855
|
+
id: NodeId;
|
|
856
|
+
name: string;
|
|
857
|
+
path: string;
|
|
858
|
+
tag: TextStyleTag;
|
|
859
|
+
color: ColorStyleData | string;
|
|
860
|
+
font: FontData;
|
|
861
|
+
boldFont: FontData | null;
|
|
862
|
+
italicFont: FontData | null;
|
|
863
|
+
boldItalicFont: FontData | null;
|
|
864
|
+
transform: TextTransform;
|
|
865
|
+
alignment: TextAlignment;
|
|
866
|
+
decoration: TextDecoration;
|
|
867
|
+
decorationColor: ColorStyleData | string;
|
|
868
|
+
decorationThickness: "auto" | CSSDimension<CSSUnit.Pixel | CSSUnit.Em>;
|
|
869
|
+
decorationStyle: TextDecorationStyle;
|
|
870
|
+
decorationSkipInk: TextDecorationSkipInk;
|
|
871
|
+
decorationOffset: "auto" | CSSDimension<CSSUnit.Pixel | CSSUnit.Em>;
|
|
872
|
+
balance: boolean;
|
|
873
|
+
breakpoints: TextStyleBreakpointData[];
|
|
874
|
+
}
|
|
875
|
+
type TextStyleAttributes = Prettify<Partial<Omit<TextStyleData, "id" | "color" | "font" | "boldFont" | "italicFont" | "boldItalicFont" | "breakpoints"> & {
|
|
876
|
+
color: ColorStyle | string;
|
|
877
|
+
font: Font;
|
|
878
|
+
boldFont: Font | null;
|
|
879
|
+
italicFont: Font | null;
|
|
880
|
+
boldItalicFont: Font | null;
|
|
881
|
+
breakpoints: TextStyleBreakpointAttributes[];
|
|
882
|
+
}> & AssetPath>;
|
|
883
|
+
declare class TextStyle {
|
|
884
|
+
#private;
|
|
885
|
+
readonly id: NodeId;
|
|
886
|
+
readonly name: string;
|
|
887
|
+
/**
|
|
888
|
+
* Hierarchical path to the text style in the assets folder structure, e.g. `ui/modals/text`.
|
|
889
|
+
* Used for organizing text styles in the UI and for programmatic access.
|
|
890
|
+
* Segments are separated by forward slashes.
|
|
891
|
+
*/
|
|
892
|
+
readonly path: string;
|
|
893
|
+
/** HTML tag that the style will use. */
|
|
894
|
+
readonly tag: TextStyleTag;
|
|
895
|
+
/**
|
|
896
|
+
* Base font of the text.
|
|
897
|
+
*
|
|
898
|
+
* Setting this will automatically update `boldFont`, `italicFont` or
|
|
899
|
+
* `boldItalicFont` with the appropriate variants if they are not already
|
|
900
|
+
* specified.
|
|
901
|
+
* */
|
|
902
|
+
readonly font: Font;
|
|
903
|
+
/**
|
|
904
|
+
* Font to use for bold text.
|
|
905
|
+
*
|
|
906
|
+
* Note: This must have the same family name as the base `font` attribute.
|
|
907
|
+
* */
|
|
908
|
+
readonly boldFont: Font | null;
|
|
909
|
+
/**
|
|
910
|
+
* Font to use for italic text.
|
|
911
|
+
*
|
|
912
|
+
* Note: This must be the same family name as the base `font` attribute.
|
|
913
|
+
* */
|
|
914
|
+
readonly italicFont: Font | null;
|
|
915
|
+
/**
|
|
916
|
+
* Font to use for bold italic text.
|
|
917
|
+
*
|
|
918
|
+
* Note: This must have the same family name as the base `font` attribute.
|
|
919
|
+
* */
|
|
920
|
+
readonly boldItalicFont: Font | null;
|
|
921
|
+
/** Color of the text in RGBA format for all breakpoints, e.g `rgba(242, 59, 57, 1)` */
|
|
922
|
+
readonly color: ColorStyle | string;
|
|
923
|
+
/** Specifies how to capitalize the text for all breakpoints. */
|
|
924
|
+
readonly transform: TextTransform;
|
|
925
|
+
/** Specifies the horizontal direction of the text for all breakpoints. */
|
|
926
|
+
readonly alignment: TextAlignment;
|
|
927
|
+
/** Appearance of any decorative lines on the text for all breakpoints. */
|
|
928
|
+
readonly decoration: TextDecoration;
|
|
929
|
+
/** Color of the text decoration in RGBA format for all breakpoints, e.g `rgba(242, 59, 57, 1)` */
|
|
930
|
+
readonly decorationColor: ColorStyle | string;
|
|
931
|
+
/** Thickness of the text decoration for all breakpoints. */
|
|
932
|
+
readonly decorationThickness: "auto" | CSSDimension<CSSUnit.Pixel | CSSUnit.Em>;
|
|
933
|
+
/** Style of the text decoration for all breakpoints. */
|
|
934
|
+
readonly decorationStyle: TextDecorationStyle;
|
|
935
|
+
/** Whether to skip ink when drawing the text decoration for all breakpoints. */
|
|
936
|
+
readonly decorationSkipInk: TextDecorationSkipInk;
|
|
937
|
+
/** Offset of the text decoration for all breakpoints. */
|
|
938
|
+
readonly decorationOffset: "auto" | CSSDimension<CSSUnit.Pixel | CSSUnit.Em>;
|
|
939
|
+
/** When enabled, use a text wrap method that tries to balance the number of characters on each line for legibility. */
|
|
940
|
+
readonly balance: boolean;
|
|
941
|
+
/** A list of style overrides that take affect at specific window widths. Breakpoints are automatically sorted by `minWidth` from largest to smallest. */
|
|
942
|
+
readonly breakpoints: TextStyleBreakpoint[];
|
|
943
|
+
/**
|
|
944
|
+
* How big does the window width need to be for primary breakpoint styles to
|
|
945
|
+
* take affect.
|
|
946
|
+
*
|
|
947
|
+
* Note: This is ignored if the text style has no breakpoints.
|
|
948
|
+
* */
|
|
949
|
+
readonly minWidth: number;
|
|
950
|
+
/**
|
|
951
|
+
* Size of the text of the primary breakpoint.
|
|
952
|
+
*
|
|
953
|
+
* Note: This is used by default when there are no breakpoints.
|
|
954
|
+
* */
|
|
955
|
+
readonly fontSize: CSSDimension<CSSUnit.Pixel | CSSUnit.Rem>;
|
|
956
|
+
/**
|
|
957
|
+
* Size of the space between each letter for the primary breakpoint.
|
|
958
|
+
*
|
|
959
|
+
* Note: This is used by default when there are no breakpoints.
|
|
960
|
+
* */
|
|
961
|
+
readonly letterSpacing: CSSDimension<CSSUnit.Pixel | CSSUnit.Em>;
|
|
962
|
+
/**
|
|
963
|
+
* Size of the space between each line of text for the primary breakpoint.
|
|
964
|
+
*
|
|
965
|
+
* Note: This is used by default when there are no breakpoints.
|
|
966
|
+
* */
|
|
967
|
+
readonly lineHeight: CSSDimension<CSSUnit.Pixel | CSSUnit.Em | CSSUnit.Percentage>;
|
|
968
|
+
/**
|
|
969
|
+
* Size of the space between each paragraph for the primary breakpoint.
|
|
970
|
+
*
|
|
971
|
+
* Note: This is used by default when there are no breakpoints.
|
|
972
|
+
* */
|
|
973
|
+
readonly paragraphSpacing: number;
|
|
974
|
+
constructor(engine: PluginEngine, data: TextStyleData);
|
|
975
|
+
static [$framerInternal.unmarshal](engine: PluginEngine, data: TextStyleData): TextStyle;
|
|
976
|
+
[$framerInternal.marshal](): TextStyleData;
|
|
977
|
+
/**
|
|
978
|
+
* Set the attributes of the text style.
|
|
979
|
+
*
|
|
980
|
+
* @throws If the number of breakpoints is bigger than the limit of 4.
|
|
981
|
+
* @throws If any of the font families used for `boldFont`, `italicFont` and
|
|
982
|
+
* `boldItalicFont` do not match the family of `font`.
|
|
983
|
+
*
|
|
984
|
+
* Use `"TextStyle.setAttributes"` to check if this method is allowed.
|
|
985
|
+
*/
|
|
986
|
+
setAttributes(attributes: TextStyleAttributes): Promise<TextStyle | null>;
|
|
987
|
+
/**
|
|
988
|
+
* Get plugin data for this text style by key.
|
|
989
|
+
*/
|
|
990
|
+
getPluginData(key: string): Promise<string | null>;
|
|
991
|
+
/**
|
|
992
|
+
* Set plugin data on this text style by key.
|
|
993
|
+
*
|
|
994
|
+
* Use `"TextStyle.setPluginData"` to check if this method is allowed.
|
|
995
|
+
*/
|
|
996
|
+
setPluginData(key: string, value: string | null): Promise<void>;
|
|
997
|
+
/**
|
|
998
|
+
* Get all plugin data keys for this text style.
|
|
999
|
+
*/
|
|
1000
|
+
getPluginDataKeys(): Promise<string[]>;
|
|
1001
|
+
/**
|
|
1002
|
+
* Deletes the text style from the project.
|
|
1003
|
+
*
|
|
1004
|
+
* Use `"TextStyle.remove"` to check if this method is allowed.
|
|
1005
|
+
*/
|
|
1006
|
+
remove(): Promise<void>;
|
|
1007
|
+
}
|
|
1008
|
+
declare function isTextStyle(value: unknown): value is TextStyle;
|
|
1009
|
+
|
|
1010
|
+
interface ColorStopData {
|
|
1011
|
+
color: ColorStyleData | string;
|
|
1012
|
+
position: number;
|
|
1013
|
+
}
|
|
1014
|
+
interface BaseGradientData {
|
|
1015
|
+
stops: readonly ColorStopData[];
|
|
1016
|
+
}
|
|
1017
|
+
declare const linearGradientType: "LinearGradient";
|
|
1018
|
+
type LinearGradientType = typeof linearGradientType;
|
|
1019
|
+
interface LinearGradientData extends BaseGradientData {
|
|
1020
|
+
[classKey]: LinearGradientType;
|
|
1021
|
+
angle: number;
|
|
1022
|
+
}
|
|
1023
|
+
declare const radialGradientType: "RadialGradient";
|
|
1024
|
+
type RadialGradientType = typeof radialGradientType;
|
|
1025
|
+
interface RadialGradientData extends BaseGradientData {
|
|
1026
|
+
[classKey]: RadialGradientType;
|
|
1027
|
+
width: CSSDimension<CSSUnit.Percentage>;
|
|
1028
|
+
height: CSSDimension<CSSUnit.Percentage>;
|
|
1029
|
+
x: CSSDimension<CSSUnit.Percentage>;
|
|
1030
|
+
y: CSSDimension<CSSUnit.Percentage>;
|
|
1031
|
+
}
|
|
1032
|
+
declare const conicGradientType: "ConicGradient";
|
|
1033
|
+
type ConicGradientType = typeof conicGradientType;
|
|
1034
|
+
interface ConicGradientData extends BaseGradientData {
|
|
1035
|
+
[classKey]: ConicGradientType;
|
|
1036
|
+
angle: number;
|
|
1037
|
+
x: CSSDimension<CSSUnit.Percentage>;
|
|
1038
|
+
y: CSSDimension<CSSUnit.Percentage>;
|
|
1039
|
+
}
|
|
1040
|
+
type GradientData = LinearGradientData | RadialGradientData | ConicGradientData;
|
|
1041
|
+
interface ColorStop {
|
|
1042
|
+
/** CSS color */
|
|
1043
|
+
color: ColorStyle | string;
|
|
1044
|
+
/** 0-1 */
|
|
1045
|
+
position: number;
|
|
1046
|
+
}
|
|
1047
|
+
interface UnmarshaledGradientBase {
|
|
1048
|
+
stops: readonly ColorStop[];
|
|
1049
|
+
}
|
|
1050
|
+
interface UnmarshaledLinearGradient extends UnmarshaledGradientBase {
|
|
1051
|
+
[classKey]: LinearGradientType;
|
|
1052
|
+
angle: number;
|
|
1053
|
+
}
|
|
1054
|
+
interface UnmarshaledRadialGradient extends UnmarshaledGradientBase {
|
|
1055
|
+
[classKey]: RadialGradientType;
|
|
1056
|
+
width: CSSDimension<CSSUnit.Percentage>;
|
|
1057
|
+
height: CSSDimension<CSSUnit.Percentage>;
|
|
1058
|
+
x: CSSDimension<CSSUnit.Percentage>;
|
|
1059
|
+
y: CSSDimension<CSSUnit.Percentage>;
|
|
1060
|
+
}
|
|
1061
|
+
interface UnmarshaledConicGradient extends UnmarshaledGradientBase {
|
|
1062
|
+
[classKey]: ConicGradientType;
|
|
1063
|
+
angle: number;
|
|
1064
|
+
x: CSSDimension<CSSUnit.Percentage>;
|
|
1065
|
+
y: CSSDimension<CSSUnit.Percentage>;
|
|
1066
|
+
}
|
|
1067
|
+
type UnmarshaledGradient = UnmarshaledLinearGradient | UnmarshaledRadialGradient | UnmarshaledConicGradient;
|
|
1068
|
+
type UnmarshaledGradientAttributes = Omit<UnmarshaledGradient, ClassKey>;
|
|
1069
|
+
type ExtractUnmarshaledGradientAttributes<T extends {
|
|
1070
|
+
[classKey]: UnmarshaledGradient[ClassKey];
|
|
1071
|
+
}> = Omit<Extract<UnmarshaledGradient, {
|
|
1072
|
+
[classKey]: T[ClassKey];
|
|
1073
|
+
}>, ClassKey>;
|
|
1074
|
+
declare abstract class GradientBase {
|
|
1075
|
+
#private;
|
|
1076
|
+
abstract readonly [classKey]: UnmarshaledGradient[ClassKey];
|
|
1077
|
+
/** Color stops with position */
|
|
1078
|
+
get stops(): readonly ColorStop[];
|
|
1079
|
+
constructor(unmarshaledAttributes: UnmarshaledGradientAttributes);
|
|
1080
|
+
cloneWithAttributes(attributes: Partial<ExtractUnmarshaledGradientAttributes<typeof this>>): typeof this;
|
|
1081
|
+
}
|
|
1082
|
+
type UnmarshaledLinearGradientAttributes = Omit<UnmarshaledLinearGradient, ClassKey>;
|
|
1083
|
+
declare class LinearGradient extends GradientBase {
|
|
1084
|
+
#private;
|
|
1085
|
+
readonly [classKey]: "LinearGradient";
|
|
1086
|
+
/** 0-360 */
|
|
1087
|
+
get angle(): number;
|
|
1088
|
+
constructor(unmarshaledAttributes: UnmarshaledLinearGradientAttributes);
|
|
1089
|
+
static [$framerInternal.unmarshal](engine: PluginEngine, data: LinearGradientData): LinearGradient;
|
|
1090
|
+
[$framerInternal.marshal](): LinearGradientData;
|
|
1091
|
+
toCSS(): string;
|
|
1092
|
+
}
|
|
1093
|
+
type UnmarshaledRadialGradientAttributes = Omit<UnmarshaledRadialGradient, ClassKey>;
|
|
1094
|
+
declare class RadialGradient extends GradientBase {
|
|
1095
|
+
#private;
|
|
1096
|
+
readonly [classKey]: "RadialGradient";
|
|
1097
|
+
/** Relative width */
|
|
1098
|
+
get width(): CSSDimension<CSSUnit.Percentage>;
|
|
1099
|
+
/** Relative height */
|
|
1100
|
+
get height(): CSSDimension<CSSUnit.Percentage>;
|
|
1101
|
+
/** Relative horizontal position */
|
|
1102
|
+
get x(): CSSDimension<CSSUnit.Percentage>;
|
|
1103
|
+
/** Relative vertical position */
|
|
1104
|
+
get y(): CSSDimension<CSSUnit.Percentage>;
|
|
1105
|
+
constructor(unmarshaledAttributes: UnmarshaledRadialGradientAttributes);
|
|
1106
|
+
static [$framerInternal.unmarshal](engine: PluginEngine, data: RadialGradientData): RadialGradient;
|
|
1107
|
+
[$framerInternal.marshal](): RadialGradientData;
|
|
1108
|
+
toCSS(): string;
|
|
1109
|
+
}
|
|
1110
|
+
type UnmarshaledConicGradientAttributes = Omit<UnmarshaledConicGradient, ClassKey>;
|
|
1111
|
+
declare class ConicGradient extends GradientBase {
|
|
1112
|
+
#private;
|
|
1113
|
+
readonly [classKey]: "ConicGradient";
|
|
1114
|
+
/** 0-360 */
|
|
1115
|
+
get angle(): number;
|
|
1116
|
+
/** Relative horizontal position */
|
|
1117
|
+
get x(): CSSDimension<CSSUnit.Percentage>;
|
|
1118
|
+
/** Relative vertical position */
|
|
1119
|
+
get y(): CSSDimension<CSSUnit.Percentage>;
|
|
1120
|
+
constructor(unmarshaledAttributes: UnmarshaledConicGradientAttributes);
|
|
1121
|
+
static [$framerInternal.unmarshal](engine: PluginEngine, data: ConicGradientData): ConicGradient;
|
|
1122
|
+
[$framerInternal.marshal](): ConicGradientData;
|
|
1123
|
+
toCSS(): string;
|
|
1124
|
+
}
|
|
1125
|
+
type Gradient = LinearGradient | RadialGradient | ConicGradient;
|
|
1126
|
+
|
|
1127
|
+
type Marshaled<T> = T extends {
|
|
1128
|
+
[$framerInternal.marshal]: () => unknown;
|
|
1129
|
+
} ? ReturnType<T[typeof $framerInternal.marshal]> : T extends string & {} ? T : T extends number & {} ? T : T extends object ? {
|
|
1130
|
+
[K in keyof T]: Marshaled<T[K]>;
|
|
1131
|
+
} : T;
|
|
1132
|
+
|
|
1133
|
+
interface WithNodeId {
|
|
1134
|
+
nodeId: string;
|
|
1135
|
+
}
|
|
1136
|
+
type NodeType = "component" | "collection";
|
|
1137
|
+
interface WithNodeType {
|
|
1138
|
+
nodeType: NodeType;
|
|
1139
|
+
}
|
|
1140
|
+
interface WithId {
|
|
1141
|
+
id: string;
|
|
1142
|
+
}
|
|
1143
|
+
interface WithName {
|
|
1144
|
+
name: string;
|
|
1145
|
+
}
|
|
1146
|
+
interface WithNameByLocale {
|
|
1147
|
+
nameByLocale: InlineLocalizationValueByLocale;
|
|
1148
|
+
}
|
|
1149
|
+
interface WithNameByLocaleUpdate {
|
|
1150
|
+
nameByLocale: LocalizationSourceUpdate;
|
|
1151
|
+
}
|
|
1152
|
+
interface WithDescription {
|
|
1153
|
+
description: string;
|
|
1154
|
+
}
|
|
1155
|
+
interface BaseVariableData extends WithNodeId, WithNodeType, WithId, WithName, ExplicitPartial<WithDescription> {
|
|
1156
|
+
}
|
|
1157
|
+
interface CreateVariableBase extends WithName, Partial<WithDescription> {
|
|
1158
|
+
}
|
|
1159
|
+
interface UpdateVariableBase extends Partial<WithName>, NullablePartialRecord<WithDescription> {
|
|
1160
|
+
}
|
|
1161
|
+
type UpdateVariableAttributes<T extends {
|
|
1162
|
+
type: UpdateVariable["type"];
|
|
1163
|
+
}> = Omit<Extract<UpdateVariable, {
|
|
1164
|
+
type: T["type"];
|
|
1165
|
+
}>, "type">;
|
|
1166
|
+
declare abstract class VariableBase {
|
|
1167
|
+
#private;
|
|
1168
|
+
abstract readonly type: UpdateVariable["type"];
|
|
1169
|
+
get nodeId(): string;
|
|
1170
|
+
get nodeType(): NodeType;
|
|
1171
|
+
get id(): string;
|
|
1172
|
+
get name(): string;
|
|
1173
|
+
get description(): string | null;
|
|
1174
|
+
constructor(engine: PluginEngine, data: VariableData);
|
|
1175
|
+
/**
|
|
1176
|
+
* Use to rename or change the description of this variable:
|
|
1177
|
+
*
|
|
1178
|
+
* ```ts
|
|
1179
|
+
* const updatedVariable = await variable.setAttributes({ name: "New Name" })
|
|
1180
|
+
* ```
|
|
1181
|
+
*
|
|
1182
|
+
* And to update other attributes too, but make sure to narrow using `instanceof` first, as to
|
|
1183
|
+
* avoid potential bugs:
|
|
1184
|
+
*
|
|
1185
|
+
* ```ts
|
|
1186
|
+
* if (variable instanceof FileVariable) await variable.setAttributes({ allowedFileTypes: ["txt", "md"] })
|
|
1187
|
+
* ```
|
|
1188
|
+
*
|
|
1189
|
+
* Returns the updated variable on success, and `null` in the unlikely event of it being removed
|
|
1190
|
+
* between getting it and calling this method.
|
|
1191
|
+
*
|
|
1192
|
+
* Use `"Variable.setAttributes"` to check if this method is allowed.
|
|
1193
|
+
*/
|
|
1194
|
+
setAttributes(attributes: UpdateVariableAttributes<typeof this>): Promise<typeof this | null>;
|
|
1195
|
+
/**
|
|
1196
|
+
* Remove this variable.
|
|
1197
|
+
*
|
|
1198
|
+
* Use `"Variable.remove"` to check if this method is allowed.
|
|
1199
|
+
*/
|
|
1200
|
+
remove(): Promise<void>;
|
|
1201
|
+
}
|
|
1202
|
+
declare const booleanVariableClass = "BooleanVariable";
|
|
1203
|
+
declare const booleanVariableType: "boolean";
|
|
1204
|
+
interface WithBooleanVariableClass {
|
|
1205
|
+
[classKey]: typeof booleanVariableClass;
|
|
1206
|
+
}
|
|
1207
|
+
interface WithBooleanVariableType {
|
|
1208
|
+
type: typeof booleanVariableType;
|
|
1209
|
+
}
|
|
1210
|
+
interface WithBooleanDefaultValue {
|
|
1211
|
+
defaultValue: boolean;
|
|
1212
|
+
}
|
|
1213
|
+
interface BooleanVariableData extends WithBooleanVariableClass, BaseVariableData, WithBooleanDefaultValue {
|
|
1214
|
+
}
|
|
1215
|
+
interface CreateBooleanVariable extends WithBooleanVariableType, CreateVariableBase, Partial<WithBooleanDefaultValue> {
|
|
1216
|
+
}
|
|
1217
|
+
interface UpdateBooleanVariable extends WithBooleanVariableType, UpdateVariableBase, Partial<WithBooleanDefaultValue> {
|
|
1218
|
+
}
|
|
1219
|
+
declare class BooleanVariable extends VariableBase {
|
|
1220
|
+
#private;
|
|
1221
|
+
readonly type: "boolean";
|
|
1222
|
+
constructor(engine: PluginEngine, data: BooleanVariableData);
|
|
1223
|
+
static [$framerInternal.unmarshal](engine: PluginEngine, data: BooleanVariableData): BooleanVariable;
|
|
1224
|
+
[$framerInternal.marshal](): BooleanVariableData;
|
|
1225
|
+
}
|
|
1226
|
+
declare const numberVariableClass = "NumberVariable";
|
|
1227
|
+
declare const numberVariableType: "number";
|
|
1228
|
+
interface WithNumberVariableClass {
|
|
1229
|
+
[classKey]: typeof numberVariableClass;
|
|
1230
|
+
}
|
|
1231
|
+
interface WithNumberVariableType {
|
|
1232
|
+
type: typeof numberVariableType;
|
|
1233
|
+
}
|
|
1234
|
+
interface WithNumberDefaultValue {
|
|
1235
|
+
defaultValue: number;
|
|
1236
|
+
}
|
|
1237
|
+
interface NumberVariableData extends WithNumberVariableClass, BaseVariableData, WithNumberDefaultValue {
|
|
1238
|
+
}
|
|
1239
|
+
interface CreateNumberVariable extends WithNumberVariableType, CreateVariableBase, Partial<WithNumberDefaultValue> {
|
|
1240
|
+
}
|
|
1241
|
+
interface UpdateNumberVariable extends WithNumberVariableType, UpdateVariableBase, Partial<WithNumberDefaultValue> {
|
|
1242
|
+
}
|
|
1243
|
+
declare class NumberVariable extends VariableBase {
|
|
1244
|
+
#private;
|
|
1245
|
+
readonly type: "number";
|
|
1246
|
+
constructor(engine: PluginEngine, data: NumberVariableData);
|
|
1247
|
+
static [$framerInternal.unmarshal](engine: PluginEngine, data: NumberVariableData): NumberVariable;
|
|
1248
|
+
[$framerInternal.marshal](): NumberVariableData;
|
|
1249
|
+
}
|
|
1250
|
+
declare const stringVariableClass = "StringVariable";
|
|
1251
|
+
declare const stringVariableType: "string";
|
|
1252
|
+
interface WithStringVariableClass {
|
|
1253
|
+
[classKey]: typeof stringVariableClass;
|
|
1254
|
+
}
|
|
1255
|
+
interface WithStringVariableType {
|
|
1256
|
+
type: typeof stringVariableType;
|
|
1257
|
+
}
|
|
1258
|
+
interface WithStringDefaultValue {
|
|
1259
|
+
defaultValue: string;
|
|
1260
|
+
}
|
|
1261
|
+
interface StringVariableData extends WithStringVariableClass, BaseVariableData, WithStringDefaultValue {
|
|
1262
|
+
}
|
|
1263
|
+
interface CreateStringVariable extends WithStringVariableType, CreateVariableBase, Partial<WithStringDefaultValue> {
|
|
1264
|
+
}
|
|
1265
|
+
interface UpdateStringVariable extends WithStringVariableType, UpdateVariableBase, Partial<WithStringDefaultValue> {
|
|
1266
|
+
}
|
|
1267
|
+
declare class StringVariable extends VariableBase {
|
|
1268
|
+
#private;
|
|
1269
|
+
readonly type: "string";
|
|
1270
|
+
constructor(engine: PluginEngine, data: StringVariableData);
|
|
1271
|
+
static [$framerInternal.unmarshal](engine: PluginEngine, data: StringVariableData): StringVariable;
|
|
1272
|
+
[$framerInternal.marshal](): StringVariableData;
|
|
1273
|
+
}
|
|
1274
|
+
declare const formattedTextVariableClass = "FormattedTextVariable";
|
|
1275
|
+
declare const formattedTextVariableType: "formattedText";
|
|
1276
|
+
interface WithFormattedTextVariableClass {
|
|
1277
|
+
[classKey]: typeof formattedTextVariableClass;
|
|
1278
|
+
}
|
|
1279
|
+
interface WithFormattedTextVariableType {
|
|
1280
|
+
type: typeof formattedTextVariableType;
|
|
1281
|
+
}
|
|
1282
|
+
interface FormattedTextVariableData extends WithFormattedTextVariableClass, BaseVariableData, WithStringDefaultValue {
|
|
1283
|
+
}
|
|
1284
|
+
interface CreateFormattedTextVariable extends WithFormattedTextVariableType, CreateVariableBase, Partial<WithStringDefaultValue> {
|
|
1285
|
+
}
|
|
1286
|
+
interface UpdateFormattedTextVariable extends WithFormattedTextVariableType, UpdateVariableBase, Partial<WithStringDefaultValue> {
|
|
1287
|
+
}
|
|
1288
|
+
declare class FormattedTextVariable extends VariableBase {
|
|
1289
|
+
#private;
|
|
1290
|
+
readonly type: "formattedText";
|
|
1291
|
+
constructor(engine: PluginEngine, data: FormattedTextVariableData);
|
|
1292
|
+
static [$framerInternal.unmarshal](engine: PluginEngine, data: FormattedTextVariableData): FormattedTextVariable;
|
|
1293
|
+
[$framerInternal.marshal](): FormattedTextVariableData;
|
|
1294
|
+
}
|
|
1295
|
+
declare const enumVariableClass = "EnumVariable";
|
|
1296
|
+
declare const enumVariableType: "enum";
|
|
1297
|
+
interface EnumCaseData extends WithId, WithName, WithNameByLocale {
|
|
1298
|
+
}
|
|
1299
|
+
interface UpdateEnumCase extends Partial<WithName>, Partial<WithNameByLocaleUpdate> {
|
|
1300
|
+
}
|
|
1301
|
+
declare class EnumCase {
|
|
1302
|
+
#private;
|
|
1303
|
+
get id(): string;
|
|
1304
|
+
get name(): string;
|
|
1305
|
+
get nameByLocale(): InlineLocalizationValueByLocale;
|
|
1306
|
+
constructor(engine: PluginEngine, nodeId: string, variableId: string, enumCaseData: EnumCaseData);
|
|
1307
|
+
/**
|
|
1308
|
+
* Update a mutable enum case property, for example the name.
|
|
1309
|
+
*
|
|
1310
|
+
* Use `"EnumCase.setAttributes"` to check if this method is allowed.
|
|
1311
|
+
*/
|
|
1312
|
+
setAttributes(attributes: UpdateEnumCase): Promise<EnumCase | null>;
|
|
1313
|
+
/**
|
|
1314
|
+
* Remove the enum case.
|
|
1315
|
+
*
|
|
1316
|
+
* Use `"EnumCase.remove"` to check if this method is allowed.
|
|
1317
|
+
*/
|
|
1318
|
+
remove(): Promise<void>;
|
|
1319
|
+
}
|
|
1320
|
+
interface WithEnumVariableClass {
|
|
1321
|
+
[classKey]: typeof enumVariableClass;
|
|
1322
|
+
}
|
|
1323
|
+
interface WithEnumVariableType {
|
|
1324
|
+
type: typeof enumVariableType;
|
|
1325
|
+
}
|
|
1326
|
+
interface EnumVariableData extends WithEnumVariableClass, BaseVariableData, ExplicitPartial<WithStringDefaultValue> {
|
|
1327
|
+
cases: EnumCaseData[];
|
|
1328
|
+
}
|
|
1329
|
+
interface CreateEnumCase extends WithName, Partial<WithNameByLocaleUpdate> {
|
|
1330
|
+
}
|
|
1331
|
+
interface CreateEnumVariable extends WithEnumVariableType, CreateVariableBase {
|
|
1332
|
+
defaultCaseIndex?: number | undefined;
|
|
1333
|
+
cases: CreateEnumCase[];
|
|
1334
|
+
}
|
|
1335
|
+
interface UpdateEnumVariable extends WithEnumVariableType, UpdateVariableBase, Partial<WithStringDefaultValue> {
|
|
1336
|
+
}
|
|
1337
|
+
declare class EnumVariable extends VariableBase {
|
|
1338
|
+
#private;
|
|
1339
|
+
readonly type: "enum";
|
|
1340
|
+
get cases(): readonly EnumCase[];
|
|
1341
|
+
constructor(engine: PluginEngine, data: EnumVariableData);
|
|
1342
|
+
static [$framerInternal.unmarshal](engine: PluginEngine, data: EnumVariableData): EnumVariable;
|
|
1343
|
+
[$framerInternal.marshal](): EnumVariableData;
|
|
1344
|
+
/**
|
|
1345
|
+
* Add a new enum case.
|
|
1346
|
+
*
|
|
1347
|
+
* Use `"EnumVariable.addCase"` to check if this method is allowed.
|
|
1348
|
+
*/
|
|
1349
|
+
addCase(attributes: CreateEnumCase): Promise<EnumCase | null>;
|
|
1350
|
+
/**
|
|
1351
|
+
* Arrange enum cases in a specific order.
|
|
1352
|
+
*
|
|
1353
|
+
* Use `"EnumVariable.setCaseOrder"` to check if this method is allowed.
|
|
1354
|
+
*/
|
|
1355
|
+
setCaseOrder(caseIds: string[]): Promise<void>;
|
|
1356
|
+
}
|
|
1357
|
+
declare const colorVariableClass = "ColorVariable";
|
|
1358
|
+
declare const colorVariableType: "color";
|
|
1359
|
+
interface WithColorVariableClass {
|
|
1360
|
+
[classKey]: typeof colorVariableClass;
|
|
1361
|
+
}
|
|
1362
|
+
interface WithColorVariableType {
|
|
1363
|
+
type: typeof colorVariableType;
|
|
1364
|
+
}
|
|
1365
|
+
interface WithColorDefaultValueData {
|
|
1366
|
+
defaultValue: string | ColorStyleData;
|
|
1367
|
+
}
|
|
1368
|
+
interface ColorVariableData extends WithColorVariableClass, BaseVariableData, WithColorDefaultValueData {
|
|
1369
|
+
}
|
|
1370
|
+
interface WithColorDefaultValue {
|
|
1371
|
+
defaultValue: string | ColorStyle;
|
|
1372
|
+
}
|
|
1373
|
+
interface CreateColorVariable extends WithColorVariableType, CreateVariableBase, Partial<WithColorDefaultValue> {
|
|
1374
|
+
}
|
|
1375
|
+
interface UpdateColorVariable extends WithColorVariableType, UpdateVariableBase, Partial<WithColorDefaultValue> {
|
|
1376
|
+
}
|
|
1377
|
+
declare class ColorVariable extends VariableBase {
|
|
1378
|
+
#private;
|
|
1379
|
+
readonly type: "color";
|
|
1380
|
+
constructor(engine: PluginEngine, data: ColorVariableData);
|
|
1381
|
+
static [$framerInternal.unmarshal](engine: PluginEngine, data: ColorVariableData): ColorVariable;
|
|
1382
|
+
[$framerInternal.marshal](): ColorVariableData;
|
|
1383
|
+
}
|
|
1384
|
+
declare const imageVariableClass = "ImageVariable";
|
|
1385
|
+
declare const imageVariableType: "image";
|
|
1386
|
+
interface WithImageVariableClass {
|
|
1387
|
+
[classKey]: typeof imageVariableClass;
|
|
1388
|
+
}
|
|
1389
|
+
interface WithImageVariableType {
|
|
1390
|
+
type: typeof imageVariableType;
|
|
1391
|
+
}
|
|
1392
|
+
interface WithImageDefaultValueData {
|
|
1393
|
+
defaultValue: ImageAssetData;
|
|
1394
|
+
}
|
|
1395
|
+
interface ImageVariableData extends WithImageVariableClass, BaseVariableData, ExplicitPartial<WithImageDefaultValueData> {
|
|
1396
|
+
}
|
|
1397
|
+
interface WithImageDefaultValue {
|
|
1398
|
+
defaultValue: ImageAsset;
|
|
1399
|
+
}
|
|
1400
|
+
interface CreateImageVariable extends WithImageVariableType, CreateVariableBase, Partial<WithImageDefaultValue> {
|
|
1401
|
+
}
|
|
1402
|
+
interface UpdateImageVariable extends WithImageVariableType, UpdateVariableBase, Partial<WithImageDefaultValue> {
|
|
1403
|
+
}
|
|
1404
|
+
declare class ImageVariable extends VariableBase {
|
|
1405
|
+
#private;
|
|
1406
|
+
readonly type: "image";
|
|
1407
|
+
constructor(engine: PluginEngine, data: ImageVariableData);
|
|
1408
|
+
static [$framerInternal.unmarshal](engine: PluginEngine, data: ImageVariableData): ImageVariable;
|
|
1409
|
+
[$framerInternal.marshal](): ImageVariableData;
|
|
1410
|
+
}
|
|
1411
|
+
declare const fileVariableClass = "FileVariable";
|
|
1412
|
+
declare const fileVariableType: "file";
|
|
1413
|
+
interface WithFileVariableClass {
|
|
1414
|
+
[classKey]: typeof fileVariableClass;
|
|
1415
|
+
}
|
|
1416
|
+
interface WithFileVariableType {
|
|
1417
|
+
type: typeof fileVariableType;
|
|
1418
|
+
}
|
|
1419
|
+
interface WithFileDefaultValueData {
|
|
1420
|
+
defaultValue: FileAssetData;
|
|
1421
|
+
}
|
|
1422
|
+
interface WithAllowedFileTypes {
|
|
1423
|
+
/**
|
|
1424
|
+
* Supported types are:
|
|
1425
|
+
* 1. Valid media types (`"image/png"`, `"audio/*"`, `"✱/✱"`)
|
|
1426
|
+
* 2. File extensions with a leading dot (`".png"`)
|
|
1427
|
+
* 3. `"*"` (`.*` as a pseudo file extension was confirmed to allow everything in file pickers of all three major browser engines)
|
|
1428
|
+
* 4. File extensions WITHOUT a leading dot (`"png"`) – unlike in browser APIs – for backward compatibility and in case something doesn't parse as a media type
|
|
1429
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input/file#unique_file_type_specifiers
|
|
1430
|
+
*/
|
|
1431
|
+
allowedFileTypes: string[];
|
|
1432
|
+
}
|
|
1433
|
+
interface FileVariableData extends WithFileVariableClass, BaseVariableData, ExplicitPartial<WithFileDefaultValueData>, WithAllowedFileTypes {
|
|
1434
|
+
}
|
|
1435
|
+
interface WithFileDefaultValue {
|
|
1436
|
+
defaultValue: FileAsset;
|
|
1437
|
+
}
|
|
1438
|
+
interface CreateFileVariable extends WithFileVariableType, CreateVariableBase, Partial<WithFileDefaultValue>, WithAllowedFileTypes {
|
|
1439
|
+
}
|
|
1440
|
+
interface UpdateFileVariable extends WithFileVariableType, UpdateVariableBase, Partial<WithFileDefaultValue>, Partial<WithAllowedFileTypes> {
|
|
1441
|
+
}
|
|
1442
|
+
declare class FileVariable extends VariableBase {
|
|
1443
|
+
#private;
|
|
1444
|
+
readonly type: "file";
|
|
1445
|
+
get allowedFileTypes(): readonly string[];
|
|
1446
|
+
constructor(engine: PluginEngine, data: FileVariableData);
|
|
1447
|
+
static [$framerInternal.unmarshal](engine: PluginEngine, data: FileVariableData): FileVariable;
|
|
1448
|
+
[$framerInternal.marshal](): FileVariableData;
|
|
1449
|
+
}
|
|
1450
|
+
declare const linkVariableClass = "LinkVariable";
|
|
1451
|
+
declare const linkVariableType: "link";
|
|
1452
|
+
interface WithLinkVariableClass {
|
|
1453
|
+
[classKey]: typeof linkVariableClass;
|
|
1454
|
+
}
|
|
1455
|
+
interface WithLinkVariableType {
|
|
1456
|
+
type: typeof linkVariableType;
|
|
1457
|
+
}
|
|
1458
|
+
interface LinkVariableData extends WithLinkVariableClass, BaseVariableData {
|
|
1459
|
+
}
|
|
1460
|
+
interface CreateLinkVariable extends WithLinkVariableType, CreateVariableBase {
|
|
1461
|
+
}
|
|
1462
|
+
interface UpdateLinkVariable extends WithLinkVariableType, UpdateVariableBase {
|
|
1463
|
+
}
|
|
1464
|
+
declare class LinkVariable extends VariableBase {
|
|
1465
|
+
#private;
|
|
1466
|
+
readonly type: "link";
|
|
1467
|
+
constructor(engine: PluginEngine, data: LinkVariableData);
|
|
1468
|
+
static [$framerInternal.unmarshal](engine: PluginEngine, data: LinkVariableData): LinkVariable;
|
|
1469
|
+
[$framerInternal.marshal](): LinkVariableData;
|
|
1470
|
+
}
|
|
1471
|
+
declare const dateVariableClass = "DateVariable";
|
|
1472
|
+
declare const dateVariableType: "date";
|
|
1473
|
+
interface WithDateVariableClass {
|
|
1474
|
+
[classKey]: typeof dateVariableClass;
|
|
1475
|
+
}
|
|
1476
|
+
interface WithDateVariableType {
|
|
1477
|
+
type: typeof dateVariableType;
|
|
1478
|
+
}
|
|
1479
|
+
interface DateVariableData extends WithDateVariableClass, BaseVariableData, ExplicitPartial<WithStringDefaultValue> {
|
|
1480
|
+
}
|
|
1481
|
+
interface CreateDateVariable extends WithDateVariableType, CreateVariableBase, Partial<WithStringDefaultValue> {
|
|
1482
|
+
}
|
|
1483
|
+
interface UpdateDateVariable extends WithDateVariableType, UpdateVariableBase, Partial<WithStringDefaultValue> {
|
|
1484
|
+
}
|
|
1485
|
+
declare class DateVariable extends VariableBase {
|
|
1486
|
+
#private;
|
|
1487
|
+
readonly type: "date";
|
|
1488
|
+
constructor(engine: PluginEngine, data: DateVariableData);
|
|
1489
|
+
static [$framerInternal.unmarshal](engine: PluginEngine, data: DateVariableData): DateVariable;
|
|
1490
|
+
[$framerInternal.marshal](): DateVariableData;
|
|
1491
|
+
}
|
|
1492
|
+
declare const borderVariableClass = "BorderVariable";
|
|
1493
|
+
declare const borderVariableType: "border";
|
|
1494
|
+
interface WithBorderVariableClass {
|
|
1495
|
+
[classKey]: typeof borderVariableClass;
|
|
1496
|
+
}
|
|
1497
|
+
interface WithBorderVariableType {
|
|
1498
|
+
type: typeof borderVariableType;
|
|
1499
|
+
}
|
|
1500
|
+
interface WithBorderDefaultValueData {
|
|
1501
|
+
defaultValue: Marshaled<Border>;
|
|
1502
|
+
}
|
|
1503
|
+
interface BorderVariableData extends WithBorderVariableClass, BaseVariableData, ExplicitPartial<WithBorderDefaultValueData> {
|
|
1504
|
+
}
|
|
1505
|
+
interface WithBorderDefaultValue {
|
|
1506
|
+
defaultValue: Border;
|
|
1507
|
+
}
|
|
1508
|
+
interface CreateBorderVariable extends WithBorderVariableType, CreateVariableBase, Partial<WithBorderDefaultValue> {
|
|
1509
|
+
}
|
|
1510
|
+
interface UpdateBorderVariable extends WithBorderVariableType, UpdateVariableBase, Partial<WithBorderDefaultValue> {
|
|
1511
|
+
}
|
|
1512
|
+
declare class BorderVariable extends VariableBase {
|
|
1513
|
+
#private;
|
|
1514
|
+
readonly type: "border";
|
|
1515
|
+
constructor(engine: PluginEngine, data: BorderVariableData);
|
|
1516
|
+
static [$framerInternal.unmarshal](engine: PluginEngine, data: BorderVariableData): BorderVariable;
|
|
1517
|
+
[$framerInternal.marshal](): BorderVariableData;
|
|
1518
|
+
}
|
|
1519
|
+
declare const unsupportedVariableClass = "UnsupportedVariable";
|
|
1520
|
+
declare const unsupportedVariableType: "unsupported";
|
|
1521
|
+
interface WithUnsupportedVariableClass {
|
|
1522
|
+
[classKey]: typeof unsupportedVariableClass;
|
|
1523
|
+
}
|
|
1524
|
+
interface WithUnsupportedVariableType {
|
|
1525
|
+
type: typeof unsupportedVariableType;
|
|
1526
|
+
}
|
|
1527
|
+
interface UnsupportedVariableData extends WithUnsupportedVariableClass, BaseVariableData {
|
|
1528
|
+
}
|
|
1529
|
+
interface UpdateUnsupportedVariable extends WithUnsupportedVariableType, UpdateVariableBase {
|
|
1530
|
+
}
|
|
1531
|
+
declare class UnsupportedVariable extends VariableBase {
|
|
1532
|
+
#private;
|
|
1533
|
+
readonly type: "unsupported";
|
|
1534
|
+
constructor(engine: PluginEngine, data: UnsupportedVariableData);
|
|
1535
|
+
static [$framerInternal.unmarshal](engine: PluginEngine, data: UnsupportedVariableData): UnsupportedVariable;
|
|
1536
|
+
[$framerInternal.marshal](): UnsupportedVariableData;
|
|
1537
|
+
}
|
|
1538
|
+
type VariableData = BooleanVariableData | NumberVariableData | StringVariableData | FormattedTextVariableData | EnumVariableData | ColorVariableData | ImageVariableData | FileVariableData | LinkVariableData | DateVariableData | BorderVariableData | UnsupportedVariableData;
|
|
1539
|
+
type CreateVariable = CreateBooleanVariable | CreateNumberVariable | CreateStringVariable | CreateFormattedTextVariable | CreateEnumVariable | CreateColorVariable | CreateImageVariable | CreateFileVariable | CreateLinkVariable | CreateDateVariable | CreateBorderVariable;
|
|
1540
|
+
type UpdateVariable = UpdateBooleanVariable | UpdateNumberVariable | UpdateStringVariable | UpdateFormattedTextVariable | UpdateEnumVariable | UpdateColorVariable | UpdateImageVariable | UpdateFileVariable | UpdateLinkVariable | UpdateDateVariable | UpdateBorderVariable | UpdateUnsupportedVariable;
|
|
1541
|
+
type ComponentVariable = BooleanVariable | NumberVariable | StringVariable | FormattedTextVariable | EnumVariable | ColorVariable | ImageVariable | FileVariable | LinkVariable | DateVariable | BorderVariable | UnsupportedVariable;
|
|
1542
|
+
type Variable = ComponentVariable;
|
|
1543
|
+
declare function isVariable(value: unknown): value is Variable;
|
|
1544
|
+
declare function isComponentVariable(value: unknown): value is ComponentVariable;
|
|
1545
|
+
|
|
1546
|
+
/**
|
|
1547
|
+
* The type of the `attributes` parameter of `Field.setAttributes`:
|
|
1548
|
+
*
|
|
1549
|
+
* ```ts
|
|
1550
|
+
* const fileFieldAttributes: UpdateFieldAttributes<FileField> = {}
|
|
1551
|
+
* fileFieldAttributes.allowedFileTypes = []
|
|
1552
|
+
* fileField.setAttributes(fileFieldAttributes)
|
|
1553
|
+
* ```
|
|
1554
|
+
*
|
|
1555
|
+
* Can also use `typeof`:
|
|
1556
|
+
*
|
|
1557
|
+
* ```ts
|
|
1558
|
+
* const fileFieldAttributes: UpdateFieldAttributes<typeof fileField> = {}
|
|
1559
|
+
* ```
|
|
1560
|
+
*/
|
|
1561
|
+
type UpdateFieldAttributes<T extends {
|
|
1562
|
+
type: UpdateField["type"];
|
|
1563
|
+
}> = Omit<Extract<UpdateField, {
|
|
1564
|
+
type: T["type"];
|
|
1565
|
+
}>, // This is NOT the same as Extract<UpdateField, T>
|
|
1566
|
+
// This is NOT the same as Extract<UpdateField, T>
|
|
1567
|
+
"id" | "type">;
|
|
1568
|
+
declare abstract class FieldBase {
|
|
1569
|
+
#private;
|
|
1570
|
+
abstract readonly type: FieldDefinitionData["type"];
|
|
1571
|
+
get id(): string;
|
|
1572
|
+
get name(): string;
|
|
1573
|
+
constructor(engine: PluginEngine, collectionId: string, data: FieldDefinitionBase);
|
|
1574
|
+
/**
|
|
1575
|
+
* Use to rename any field:
|
|
1576
|
+
*
|
|
1577
|
+
* ```ts
|
|
1578
|
+
* const updatedField = await field.setAttributes({ name: "New Name" })
|
|
1579
|
+
* ```
|
|
1580
|
+
*
|
|
1581
|
+
* And to set other attributes too, but make sure to narrow based on field's `type` first, as to
|
|
1582
|
+
* avoid potential bugs:
|
|
1583
|
+
*
|
|
1584
|
+
* ```ts
|
|
1585
|
+
* if (field.type === "file") await field.setAttributes({ allowedFileTypes: ["txt", "md"] })
|
|
1586
|
+
* ```
|
|
1587
|
+
*
|
|
1588
|
+
* Returns the updated field on success, and `null` in the unlikely event of it being removed
|
|
1589
|
+
* between getting it and calling this method.
|
|
1590
|
+
*
|
|
1591
|
+
* Use `"Field.setAttributes"` to check if this method is allowed.
|
|
1592
|
+
*/
|
|
1593
|
+
setAttributes(attributes: UpdateFieldAttributes<typeof this>): Promise<typeof this | null>;
|
|
1594
|
+
/**
|
|
1595
|
+
* Remove this field.
|
|
1596
|
+
*
|
|
1597
|
+
* Use `"Field.remove"` to check if this method is allowed.
|
|
1598
|
+
*/
|
|
1599
|
+
remove(): Promise<void>;
|
|
1600
|
+
}
|
|
1601
|
+
declare abstract class FieldBaseWithRequired extends FieldBase implements WithFieldRequired {
|
|
1602
|
+
#private;
|
|
1603
|
+
get required(): boolean;
|
|
1604
|
+
constructor(engine: PluginEngine, collectionId: string, data: FieldDefinitionBase & WithFieldRequired);
|
|
1605
|
+
}
|
|
1606
|
+
declare class BooleanField extends FieldBase {
|
|
1607
|
+
readonly type = "boolean";
|
|
1608
|
+
}
|
|
1609
|
+
declare class ColorField extends FieldBase {
|
|
1610
|
+
readonly type = "color";
|
|
1611
|
+
}
|
|
1612
|
+
declare class NumberField extends FieldBase {
|
|
1613
|
+
readonly type = "number";
|
|
1614
|
+
}
|
|
1615
|
+
declare class StringField extends FieldBaseWithRequired implements WithFieldBasedOn {
|
|
1616
|
+
#private;
|
|
1617
|
+
readonly type = "string";
|
|
1618
|
+
constructor(engine: PluginEngine, collectionId: string, data: StringFieldDefinitionData);
|
|
1619
|
+
get basedOn(): string | null;
|
|
1620
|
+
}
|
|
1621
|
+
declare class FormattedTextField extends FieldBaseWithRequired {
|
|
1622
|
+
readonly type = "formattedText";
|
|
1623
|
+
}
|
|
1624
|
+
declare class ImageField extends FieldBaseWithRequired {
|
|
1625
|
+
readonly type = "image";
|
|
1626
|
+
}
|
|
1627
|
+
declare class LinkField extends FieldBaseWithRequired {
|
|
1628
|
+
readonly type = "link";
|
|
1629
|
+
}
|
|
1630
|
+
declare class DateField extends FieldBaseWithRequired {
|
|
1631
|
+
readonly type = "date";
|
|
1632
|
+
}
|
|
1633
|
+
declare class FieldDivider extends FieldBase {
|
|
1634
|
+
readonly type = "divider";
|
|
1635
|
+
}
|
|
1636
|
+
declare class UnsupportedField extends FieldBase {
|
|
1637
|
+
readonly type = "unsupported";
|
|
1638
|
+
}
|
|
1639
|
+
declare class FileField extends FieldBaseWithRequired implements WithAllowedFileTypes {
|
|
1640
|
+
#private;
|
|
1641
|
+
readonly type = "file";
|
|
1642
|
+
/** @inheritdoc */
|
|
1643
|
+
get allowedFileTypes(): string[];
|
|
1644
|
+
constructor(engine: PluginEngine, collectionId: string, data: FileFieldDefinitionData);
|
|
1645
|
+
}
|
|
1646
|
+
declare class EnumField extends FieldBase {
|
|
1647
|
+
#private;
|
|
1648
|
+
readonly type = "enum";
|
|
1649
|
+
get cases(): readonly EnumCase[];
|
|
1650
|
+
constructor(engine: PluginEngine, collectionId: string, data: EnumFieldDefinitionData);
|
|
1651
|
+
/**
|
|
1652
|
+
* Add a new enum case.
|
|
1653
|
+
*
|
|
1654
|
+
* Use `"EnumField.addCase"` to check if this method is allowed.
|
|
1655
|
+
*/
|
|
1656
|
+
addCase(attributes: CreateEnumCase): Promise<EnumCase | null>;
|
|
1657
|
+
/**
|
|
1658
|
+
* Arrange enum cases in a specific order.
|
|
1659
|
+
*
|
|
1660
|
+
* Use `"EnumField.setCaseOrder"` to check if this method is allowed.
|
|
1661
|
+
*/
|
|
1662
|
+
setCaseOrder(caseIds: string[]): Promise<void>;
|
|
1663
|
+
}
|
|
1664
|
+
declare class CollectionReferenceField extends FieldBaseWithRequired implements WithFieldCollectionId {
|
|
1665
|
+
#private;
|
|
1666
|
+
readonly type = "collectionReference";
|
|
1667
|
+
get collectionId(): string;
|
|
1668
|
+
constructor(engine: PluginEngine, collectionId: string, data: CollectionReferenceFieldDefinitionData);
|
|
1669
|
+
}
|
|
1670
|
+
declare class MultiCollectionReferenceField extends FieldBaseWithRequired implements WithFieldCollectionId {
|
|
1671
|
+
#private;
|
|
1672
|
+
readonly type = "multiCollectionReference";
|
|
1673
|
+
get collectionId(): string;
|
|
1674
|
+
constructor(engine: PluginEngine, collectionId: string, data: MultiCollectionReferenceFieldDefinitionData);
|
|
1675
|
+
}
|
|
1676
|
+
type ArrayItemField = ImageField;
|
|
1677
|
+
declare class ArrayField extends FieldBaseWithRequired {
|
|
1678
|
+
readonly type = "array";
|
|
1679
|
+
readonly fields: readonly [ArrayItemField];
|
|
1680
|
+
constructor(engine: PluginEngine, collectionId: string, data: ArrayFieldDefinitionData);
|
|
1681
|
+
}
|
|
1682
|
+
type Field = BooleanField | ColorField | NumberField | StringField | FormattedTextField | ImageField | LinkField | DateField | FieldDivider | UnsupportedField | FileField | EnumField | CollectionReferenceField | MultiCollectionReferenceField | ArrayField;
|
|
1683
|
+
declare function isField(value: unknown): value is FieldBase;
|
|
1684
|
+
|
|
1685
|
+
type ManagedCollectionManagedBy = "thisPlugin" | "anotherPlugin";
|
|
1686
|
+
type CollectionManagedBy = "user" | ManagedCollectionManagedBy;
|
|
1687
|
+
/** Controls how formatted text content is processed */
|
|
1688
|
+
type ContentType = "auto" | "markdown" | "html";
|
|
1689
|
+
interface CollectionData {
|
|
1690
|
+
id: string;
|
|
1691
|
+
name: string;
|
|
1692
|
+
slugFieldName: string | null;
|
|
1693
|
+
slugFieldBasedOn: string | null;
|
|
1694
|
+
/** @deprecated Use `managedBy` instead. */
|
|
1695
|
+
readonly: boolean;
|
|
1696
|
+
managedBy: CollectionManagedBy;
|
|
1697
|
+
}
|
|
1698
|
+
interface BooleanFieldDataEntry {
|
|
1699
|
+
type: BooleanFieldType;
|
|
1700
|
+
value: boolean;
|
|
1701
|
+
}
|
|
1702
|
+
type BooleanFieldDataEntryInput = BooleanFieldDataEntry;
|
|
1703
|
+
interface ColorFieldDataEntryInput {
|
|
1704
|
+
type: ColorFieldType;
|
|
1705
|
+
value: string | ColorStyleData | null;
|
|
1706
|
+
}
|
|
1707
|
+
interface ColorFieldDataEntrySerializable {
|
|
1708
|
+
type: ColorFieldType;
|
|
1709
|
+
value: string | ColorStyleData;
|
|
1710
|
+
}
|
|
1711
|
+
interface ColorFieldDataEntry {
|
|
1712
|
+
type: ColorFieldType;
|
|
1713
|
+
value: string | ColorStyle;
|
|
1714
|
+
}
|
|
1715
|
+
interface DateFieldDataEntryInput {
|
|
1716
|
+
type: DateFieldType;
|
|
1717
|
+
value: string | number | null;
|
|
1718
|
+
}
|
|
1719
|
+
interface DateFieldDataEntry {
|
|
1720
|
+
type: DateFieldType;
|
|
1721
|
+
value: string | undefined;
|
|
1722
|
+
}
|
|
1723
|
+
interface EnumFieldDataEntryInput {
|
|
1724
|
+
type: EnumFieldType;
|
|
1725
|
+
value: string;
|
|
1726
|
+
}
|
|
1727
|
+
interface EnumFieldDataEntry {
|
|
1728
|
+
type: EnumFieldType;
|
|
1729
|
+
value: string;
|
|
1730
|
+
}
|
|
1731
|
+
interface FileFieldDataEntryInput {
|
|
1732
|
+
type: FileFieldType;
|
|
1733
|
+
value: string | null;
|
|
1734
|
+
}
|
|
1735
|
+
interface FileFieldDataEntrySerializable {
|
|
1736
|
+
type: FileFieldType;
|
|
1737
|
+
value: FileAssetData | undefined;
|
|
1738
|
+
}
|
|
1739
|
+
interface FileFieldDataEntry {
|
|
1740
|
+
type: FileFieldType;
|
|
1741
|
+
value: FileAsset | undefined;
|
|
1742
|
+
}
|
|
1743
|
+
interface LinkFieldDataEntryInput {
|
|
1744
|
+
type: LinkFieldType;
|
|
1745
|
+
value: string | null;
|
|
1746
|
+
valueByLocale?: LocalizationSourceUpdate;
|
|
1747
|
+
}
|
|
1748
|
+
interface LinkFieldDataEntry {
|
|
1749
|
+
type: LinkFieldType;
|
|
1750
|
+
value: string | undefined;
|
|
1751
|
+
valueByLocale: InlineLocalizationValueByLocale;
|
|
1752
|
+
}
|
|
1753
|
+
interface NumberFieldDataEntry {
|
|
1754
|
+
type: NumberFieldType;
|
|
1755
|
+
value: number;
|
|
1756
|
+
}
|
|
1757
|
+
type NumberFieldDataEntryInput = NumberFieldDataEntry;
|
|
1758
|
+
interface FormattedTextFieldDataEntry {
|
|
1759
|
+
type: FormattedTextFieldType;
|
|
1760
|
+
value: string;
|
|
1761
|
+
valueByLocale: InlineLocalizationValueByLocale;
|
|
1762
|
+
}
|
|
1763
|
+
interface FormattedTextFieldDataEntryInput {
|
|
1764
|
+
type: FormattedTextFieldType;
|
|
1765
|
+
value: string;
|
|
1766
|
+
/** @default "html" */
|
|
1767
|
+
contentType?: ContentType;
|
|
1768
|
+
valueByLocale?: LocalizationSourceUpdate;
|
|
1769
|
+
}
|
|
1770
|
+
interface StringFieldDataEntry {
|
|
1771
|
+
type: StringFieldType;
|
|
1772
|
+
value: string;
|
|
1773
|
+
valueByLocale: InlineLocalizationValueByLocale;
|
|
1774
|
+
}
|
|
1775
|
+
interface StringFieldDataEntryInput {
|
|
1776
|
+
type: StringFieldType;
|
|
1777
|
+
value: string;
|
|
1778
|
+
valueByLocale?: LocalizationSourceUpdate;
|
|
1779
|
+
}
|
|
1780
|
+
interface ImageFieldDataEntryInput {
|
|
1781
|
+
type: ImageFieldType;
|
|
1782
|
+
value: string | null;
|
|
1783
|
+
alt?: string;
|
|
1784
|
+
altByLocale?: LocalizationSourceUpdate;
|
|
1785
|
+
}
|
|
1786
|
+
interface ImageFieldDataEntrySerializable {
|
|
1787
|
+
type: ImageFieldType;
|
|
1788
|
+
value: ImageAssetData | undefined;
|
|
1789
|
+
}
|
|
1790
|
+
interface ImageFieldDataEntry {
|
|
1791
|
+
type: ImageFieldType;
|
|
1792
|
+
value: ImageAsset | undefined;
|
|
1793
|
+
}
|
|
1794
|
+
interface ArrayItemSerializableData {
|
|
1795
|
+
/** Unique ID. */
|
|
1796
|
+
id: string;
|
|
1797
|
+
/** Data for the fields. */
|
|
1798
|
+
fieldData: FieldSerializableData;
|
|
1799
|
+
}
|
|
1800
|
+
type ArrayItemFieldDataEntry = ImageFieldDataEntry;
|
|
1801
|
+
type ArrayItemFieldData = Record<string, ArrayItemFieldDataEntry>;
|
|
1802
|
+
interface ArrayItemData {
|
|
1803
|
+
/** Unique ID. */
|
|
1804
|
+
id: string;
|
|
1805
|
+
/** Data for the fields. */
|
|
1806
|
+
fieldData: ArrayItemFieldData;
|
|
1807
|
+
}
|
|
1808
|
+
type ArrayItemFieldDataEntryInput = ImageFieldDataEntryInput;
|
|
1809
|
+
type ArrayItemFieldDataInput = Record<string, ArrayItemFieldDataEntryInput>;
|
|
1810
|
+
interface CreateArrayItem {
|
|
1811
|
+
/** Data for the fields. */
|
|
1812
|
+
fieldData: ArrayItemFieldDataInput | undefined;
|
|
1813
|
+
}
|
|
1814
|
+
interface EditableArrayItemAttributes {
|
|
1815
|
+
/** Data for the fields. */
|
|
1816
|
+
fieldData?: ArrayItemFieldDataInput | undefined;
|
|
1817
|
+
}
|
|
1818
|
+
interface UpdateArrayItem extends EditableArrayItemAttributes {
|
|
1819
|
+
/** The ID of an existing item if updating. Omit if adding. */
|
|
1820
|
+
id: string;
|
|
1821
|
+
}
|
|
1822
|
+
type ArrayItemInput = CreateArrayItem | UpdateArrayItem;
|
|
1823
|
+
interface ArrayFieldDataEntryInput {
|
|
1824
|
+
type: ArrayFieldType;
|
|
1825
|
+
value: ArrayItemInput[];
|
|
1826
|
+
}
|
|
1827
|
+
interface ArrayFieldDataEntrySerializable {
|
|
1828
|
+
type: ArrayFieldType;
|
|
1829
|
+
value: ArrayItemSerializableData[];
|
|
1830
|
+
}
|
|
1831
|
+
interface ArrayItem {
|
|
1832
|
+
id: string;
|
|
1833
|
+
fieldData: Readonly<ArrayItemFieldData>;
|
|
1834
|
+
}
|
|
1835
|
+
interface ArrayFieldDataEntry {
|
|
1836
|
+
type: ArrayFieldType;
|
|
1837
|
+
value: ArrayItem[];
|
|
1838
|
+
}
|
|
1839
|
+
interface CollectionReferenceFieldDataEntryInput {
|
|
1840
|
+
type: CollectionReferenceFieldType;
|
|
1841
|
+
value: string | null;
|
|
1842
|
+
}
|
|
1843
|
+
interface CollectionReferenceFieldDataEntry {
|
|
1844
|
+
type: CollectionReferenceFieldType;
|
|
1845
|
+
value: string | undefined;
|
|
1846
|
+
}
|
|
1847
|
+
interface MultiCollectionReferenceFieldDataEntryInput {
|
|
1848
|
+
type: MultiCollectionReferenceFieldType;
|
|
1849
|
+
value: readonly string[] | null;
|
|
1850
|
+
}
|
|
1851
|
+
interface MultiCollectionReferenceFieldDataEntry {
|
|
1852
|
+
type: MultiCollectionReferenceFieldType;
|
|
1853
|
+
value: readonly string[];
|
|
1854
|
+
}
|
|
1855
|
+
type FieldDataEntry = BooleanFieldDataEntry | ColorFieldDataEntry | DateFieldDataEntry | EnumFieldDataEntry | FileFieldDataEntry | LinkFieldDataEntry | NumberFieldDataEntry | FormattedTextFieldDataEntry | StringFieldDataEntry | ImageFieldDataEntry | CollectionReferenceFieldDataEntry | MultiCollectionReferenceFieldDataEntry | ArrayFieldDataEntry;
|
|
1856
|
+
type FieldDataEntrySerializable = Exclude<FieldDataEntry, ImageFieldDataEntry | FileFieldDataEntry | ColorFieldDataEntry | ArrayFieldDataEntry> | ImageFieldDataEntrySerializable | FileFieldDataEntrySerializable | ColorFieldDataEntrySerializable | ArrayFieldDataEntrySerializable;
|
|
1857
|
+
type FieldDataEntryInput = BooleanFieldDataEntryInput | ColorFieldDataEntryInput | DateFieldDataEntryInput | EnumFieldDataEntryInput | FileFieldDataEntryInput | LinkFieldDataEntryInput | NumberFieldDataEntryInput | FormattedTextFieldDataEntryInput | StringFieldDataEntryInput | ImageFieldDataEntryInput | CollectionReferenceFieldDataEntryInput | MultiCollectionReferenceFieldDataEntryInput | ArrayFieldDataEntryInput;
|
|
1858
|
+
type ApiV2FieldData = Record<string, unknown>;
|
|
1859
|
+
type FieldData = Record<string, FieldDataEntry>;
|
|
1860
|
+
type FieldSerializableData = Record<string, FieldDataEntrySerializable>;
|
|
1861
|
+
type FieldDataInput = Record<string, FieldDataEntryInput>;
|
|
1862
|
+
interface BaseCollectionItemData {
|
|
1863
|
+
/** Drafts are excluded from publishing. */
|
|
1864
|
+
draft?: boolean | undefined;
|
|
1865
|
+
}
|
|
1866
|
+
interface ApiV2CollectionItemData extends BaseCollectionItemData {
|
|
1867
|
+
/** Unique ID. */
|
|
1868
|
+
id: string;
|
|
1869
|
+
/** Unique slug. */
|
|
1870
|
+
slug: string;
|
|
1871
|
+
/** Data for the fields. */
|
|
1872
|
+
fieldData: ApiV2FieldData;
|
|
1873
|
+
}
|
|
1874
|
+
interface CollectionItemSerializableData extends BaseCollectionItemData {
|
|
1875
|
+
/** @deprecated use `externalId ?? nodeId` to emulate the old behaviour, or use `nodeId` or `externalId` directly */
|
|
1876
|
+
id: string;
|
|
1877
|
+
/** Node ID. This is a unique ID for the node that can be used to navigate to the node */
|
|
1878
|
+
nodeId: string;
|
|
1879
|
+
/** External ID. This is the ID of the node in the external system */
|
|
1880
|
+
externalId: string | undefined;
|
|
1881
|
+
/** Unique slug. */
|
|
1882
|
+
slug: string;
|
|
1883
|
+
/** Slug by locale. */
|
|
1884
|
+
slugByLocale: InlineLocalizationValueByLocale;
|
|
1885
|
+
/** Data for the fields. */
|
|
1886
|
+
fieldData: FieldSerializableData;
|
|
1887
|
+
}
|
|
1888
|
+
interface CollectionItemData extends BaseCollectionItemData {
|
|
1889
|
+
/** Unique ID. */
|
|
1890
|
+
id: string;
|
|
1891
|
+
/** Unique slug. */
|
|
1892
|
+
slug: string;
|
|
1893
|
+
/** Slug by locale. */
|
|
1894
|
+
slugByLocale: InlineLocalizationValueByLocale;
|
|
1895
|
+
/** Data for the fields. */
|
|
1896
|
+
fieldData: FieldData;
|
|
1897
|
+
}
|
|
1898
|
+
interface ApiV2ManagedCollectionItemInput extends BaseCollectionItemData {
|
|
1899
|
+
/** Required unique ID of your choice. Using an ID instead of the slug helps avoid data loss. */
|
|
1900
|
+
id: string;
|
|
1901
|
+
/** Unique on collection level. */
|
|
1902
|
+
slug: string;
|
|
1903
|
+
/** Data for the fields. */
|
|
1904
|
+
fieldData: ApiV2FieldData;
|
|
1905
|
+
}
|
|
1906
|
+
interface ManagedCollectionItemInput extends BaseCollectionItemData {
|
|
1907
|
+
/** Required unique ID of your choice. Using an ID instead of the slug helps avoid data loss. */
|
|
1908
|
+
id: string;
|
|
1909
|
+
/** Unique on collection level. */
|
|
1910
|
+
slug: string;
|
|
1911
|
+
/** Localized values for the slug */
|
|
1912
|
+
slugByLocale?: LocalizationSourceUpdate;
|
|
1913
|
+
/** Data for the fields. */
|
|
1914
|
+
fieldData: FieldDataInput;
|
|
1915
|
+
/** Status of each locale for the resulting localization group */
|
|
1916
|
+
statusByLocale?: LocalizationGroupStatusByLocale;
|
|
1917
|
+
}
|
|
1918
|
+
interface ApiV2CreateCollectionItem extends BaseCollectionItemData {
|
|
1919
|
+
/** The ID of an existing item if updating. Omit if adding. */
|
|
1920
|
+
id?: undefined;
|
|
1921
|
+
/** Unique on collection level. Required if adding, optional if updating. */
|
|
1922
|
+
slug: string;
|
|
1923
|
+
/** Data for the fields. */
|
|
1924
|
+
fieldData?: ApiV2FieldData | undefined;
|
|
1925
|
+
}
|
|
1926
|
+
interface CreateCollectionItem extends BaseCollectionItemData {
|
|
1927
|
+
/** The ID of an existing item if updating. Omit if adding. */
|
|
1928
|
+
id?: undefined;
|
|
1929
|
+
/** Unique on collection level. Required if adding, optional if updating. */
|
|
1930
|
+
slug: string;
|
|
1931
|
+
/** Localized values for the slug */
|
|
1932
|
+
slugByLocale?: LocalizationSourceUpdate;
|
|
1933
|
+
/** Data for the fields. */
|
|
1934
|
+
fieldData?: FieldDataInput | undefined;
|
|
1935
|
+
/** Status of each locale for the resulting localization group */
|
|
1936
|
+
statusByLocale?: LocalizationGroupStatusByLocale;
|
|
1937
|
+
}
|
|
1938
|
+
interface ApiV2EditableCollectionItemAttributes extends BaseCollectionItemData {
|
|
1939
|
+
/** Unique on collection level. Required if adding, optional if updating. */
|
|
1940
|
+
slug?: string | undefined;
|
|
1941
|
+
/** Data for the fields. */
|
|
1942
|
+
fieldData?: ApiV2FieldData | undefined;
|
|
1943
|
+
}
|
|
1944
|
+
interface EditableCollectionItemAttributes extends BaseCollectionItemData {
|
|
1945
|
+
/** Unique on collection level. Required if adding, optional if updating. */
|
|
1946
|
+
slug?: string | undefined;
|
|
1947
|
+
/** Localized values for the slug */
|
|
1948
|
+
slugByLocale?: LocalizationSourceUpdate;
|
|
1949
|
+
/** Data for the fields. */
|
|
1950
|
+
fieldData?: FieldDataInput | undefined;
|
|
1951
|
+
/** Status of each locale for the resulting localization group */
|
|
1952
|
+
statusByLocale?: Record<LocaleId, LocalizationGroupStatus>;
|
|
1953
|
+
}
|
|
1954
|
+
interface ApiV2EditableCollectionItemAttributesWithId extends ApiV2EditableCollectionItemAttributes {
|
|
1955
|
+
/** The ID of an existing item if updating. Omit if adding. */
|
|
1956
|
+
id: NodeId;
|
|
1957
|
+
}
|
|
1958
|
+
interface EditableCollectionItemAttributesWithId extends EditableCollectionItemAttributes {
|
|
1959
|
+
/** The ID of an existing item if updating. Omit if adding. */
|
|
1960
|
+
id: NodeId;
|
|
1961
|
+
}
|
|
1962
|
+
type ApiV2CollectionItemInput = ApiV2CreateCollectionItem | ApiV2EditableCollectionItemAttributesWithId;
|
|
1963
|
+
type CollectionItemInput = CreateCollectionItem | EditableCollectionItemAttributesWithId;
|
|
1964
|
+
interface WithFieldId {
|
|
1965
|
+
/** Required unique ID. Use a unique identifier to prevent data loss when the field is renamed. */
|
|
1966
|
+
id: string;
|
|
1967
|
+
}
|
|
1968
|
+
interface WithFieldName {
|
|
1969
|
+
/** The name of the field as displayed in the UI. */
|
|
1970
|
+
name: string;
|
|
1971
|
+
}
|
|
1972
|
+
interface WithFieldBasedOn {
|
|
1973
|
+
/**
|
|
1974
|
+
* The ID of the field on which this field is based.
|
|
1975
|
+
*
|
|
1976
|
+
* When set, this field will use the referenced field's value as a fallback
|
|
1977
|
+
* when no value is provided.
|
|
1978
|
+
*/
|
|
1979
|
+
basedOn: string | null;
|
|
1980
|
+
}
|
|
1981
|
+
interface WithFieldRequired {
|
|
1982
|
+
required: boolean;
|
|
1983
|
+
}
|
|
1984
|
+
type WithOptionalFieldRequired = Partial<WithFieldRequired>;
|
|
1985
|
+
interface FieldDefinitionBase extends WithFieldId, WithFieldName {
|
|
1986
|
+
}
|
|
1987
|
+
type CreateFieldBase = WithFieldName;
|
|
1988
|
+
interface UpdateFieldBase extends WithFieldId, Partial<WithFieldName> {
|
|
1989
|
+
}
|
|
1990
|
+
interface WithIdAndOptionalUserEditable extends WithFieldId, Partial<WithUserEditable> {
|
|
1991
|
+
}
|
|
1992
|
+
declare const booleanFieldType = "boolean";
|
|
1993
|
+
type BooleanFieldType = typeof booleanFieldType;
|
|
1994
|
+
interface BooleanFieldBase {
|
|
1995
|
+
type: BooleanFieldType;
|
|
1996
|
+
}
|
|
1997
|
+
interface BooleanFieldDefinitionData extends BooleanFieldBase, FieldDefinitionBase {
|
|
1998
|
+
}
|
|
1999
|
+
interface CreateBooleanField extends BooleanFieldBase, CreateFieldBase {
|
|
2000
|
+
}
|
|
2001
|
+
interface UpdateBooleanField extends BooleanFieldBase, UpdateFieldBase {
|
|
2002
|
+
}
|
|
2003
|
+
interface ManagedBooleanFieldInput extends CreateBooleanField, WithIdAndOptionalUserEditable {
|
|
2004
|
+
}
|
|
2005
|
+
declare const colorFieldType = "color";
|
|
2006
|
+
type ColorFieldType = typeof colorFieldType;
|
|
2007
|
+
interface ColorFieldBase {
|
|
2008
|
+
type: ColorFieldType;
|
|
2009
|
+
}
|
|
2010
|
+
interface ColorFieldDefinitionData extends ColorFieldBase, FieldDefinitionBase {
|
|
2011
|
+
}
|
|
2012
|
+
interface CreateColorField extends ColorFieldBase, CreateFieldBase {
|
|
2013
|
+
}
|
|
2014
|
+
interface UpdateColorField extends ColorFieldBase, UpdateFieldBase {
|
|
2015
|
+
}
|
|
2016
|
+
interface ManagedColorFieldInput extends CreateColorField, WithIdAndOptionalUserEditable {
|
|
2017
|
+
}
|
|
2018
|
+
declare const numberFieldType = "number";
|
|
2019
|
+
type NumberFieldType = typeof numberFieldType;
|
|
2020
|
+
interface NumberFieldBase {
|
|
2021
|
+
type: NumberFieldType;
|
|
2022
|
+
}
|
|
2023
|
+
interface NumberFieldDefinitionData extends NumberFieldBase, FieldDefinitionBase {
|
|
2024
|
+
}
|
|
2025
|
+
interface CreateNumberField extends NumberFieldBase, CreateFieldBase {
|
|
2026
|
+
}
|
|
2027
|
+
interface UpdateNumberField extends NumberFieldBase, UpdateFieldBase {
|
|
2028
|
+
}
|
|
2029
|
+
interface ManagedNumberFieldInput extends CreateNumberField, WithIdAndOptionalUserEditable {
|
|
2030
|
+
}
|
|
2031
|
+
declare const stringFieldType = "string";
|
|
2032
|
+
type StringFieldType = typeof stringFieldType;
|
|
2033
|
+
interface StringFieldBase {
|
|
2034
|
+
type: StringFieldType;
|
|
2035
|
+
}
|
|
2036
|
+
interface StringFieldDefinitionData extends StringFieldBase, WithFieldRequired, WithFieldBasedOn, FieldDefinitionBase {
|
|
2037
|
+
}
|
|
2038
|
+
interface CreateStringField extends StringFieldBase, CreateFieldBase, WithOptionalFieldRequired {
|
|
2039
|
+
}
|
|
2040
|
+
interface UpdateStringField extends StringFieldBase, UpdateFieldBase, WithOptionalFieldRequired {
|
|
2041
|
+
}
|
|
2042
|
+
interface ManagedStringFieldInput extends CreateStringField, WithIdAndOptionalUserEditable {
|
|
2043
|
+
}
|
|
2044
|
+
declare const formattedTextFieldType = "formattedText";
|
|
2045
|
+
type FormattedTextFieldType = typeof formattedTextFieldType;
|
|
2046
|
+
interface FormattedTextFieldBase {
|
|
2047
|
+
type: FormattedTextFieldType;
|
|
2048
|
+
/** Controls how formatted text content is processed: "auto" (detect), "markdown", or "html" */
|
|
2049
|
+
contentType?: ContentType;
|
|
2050
|
+
}
|
|
2051
|
+
interface FormattedTextFieldDefinitionData extends FormattedTextFieldBase, WithFieldRequired, FieldDefinitionBase {
|
|
2052
|
+
}
|
|
2053
|
+
interface CreateFormattedTextField extends FormattedTextFieldBase, CreateFieldBase, WithOptionalFieldRequired {
|
|
2054
|
+
}
|
|
2055
|
+
interface UpdateFormattedTextField extends FormattedTextFieldBase, UpdateFieldBase, WithOptionalFieldRequired {
|
|
2056
|
+
}
|
|
2057
|
+
interface FormattedTextFieldInput extends CreateFormattedTextField, WithIdAndOptionalUserEditable {
|
|
2058
|
+
}
|
|
2059
|
+
declare const imageFieldType = "image";
|
|
2060
|
+
type ImageFieldType = typeof imageFieldType;
|
|
2061
|
+
interface ImageFieldBase {
|
|
2062
|
+
type: ImageFieldType;
|
|
2063
|
+
}
|
|
2064
|
+
interface ImageFieldDefinitionData extends ImageFieldBase, WithFieldRequired, FieldDefinitionBase {
|
|
2065
|
+
}
|
|
2066
|
+
interface CreateImageField extends ImageFieldBase, CreateFieldBase, WithOptionalFieldRequired {
|
|
2067
|
+
}
|
|
2068
|
+
interface UpdateImageField extends ImageFieldBase, UpdateFieldBase, WithOptionalFieldRequired {
|
|
2069
|
+
}
|
|
2070
|
+
interface ManagedImageFieldInput extends CreateImageField, WithIdAndOptionalUserEditable {
|
|
2071
|
+
}
|
|
2072
|
+
type ArrayItemFieldBase = ImageFieldBase;
|
|
2073
|
+
interface ArrayItemFieldDefinitionData extends ArrayItemFieldBase, WithFieldRequired, FieldDefinitionBase {
|
|
2074
|
+
}
|
|
2075
|
+
interface CreateArrayItemField extends ArrayItemFieldBase, CreateFieldBase, WithOptionalFieldRequired {
|
|
2076
|
+
}
|
|
2077
|
+
interface ManagedArrayItemFieldInput extends CreateArrayItemField, WithIdAndOptionalUserEditable {
|
|
2078
|
+
}
|
|
2079
|
+
declare const arrayFieldType = "array";
|
|
2080
|
+
type ArrayFieldType = typeof arrayFieldType;
|
|
2081
|
+
interface ArrayFieldBase {
|
|
2082
|
+
type: ArrayFieldType;
|
|
2083
|
+
}
|
|
2084
|
+
interface ArrayFieldDefinitionData extends ArrayFieldBase, WithFieldRequired, FieldDefinitionBase {
|
|
2085
|
+
fields: [ArrayItemFieldDefinitionData];
|
|
2086
|
+
}
|
|
2087
|
+
interface CreateArrayField extends ArrayFieldBase, CreateFieldBase, WithOptionalFieldRequired {
|
|
2088
|
+
fields: [CreateArrayItemField];
|
|
2089
|
+
}
|
|
2090
|
+
interface UpdateArrayField extends ArrayFieldBase, UpdateFieldBase, WithOptionalFieldRequired {
|
|
2091
|
+
fields?: [CreateArrayItemField];
|
|
2092
|
+
}
|
|
2093
|
+
interface ManagedArrayFieldInput extends CreateArrayField, WithIdAndOptionalUserEditable {
|
|
2094
|
+
fields: [ManagedArrayItemFieldInput];
|
|
2095
|
+
}
|
|
2096
|
+
declare const linkFieldType = "link";
|
|
2097
|
+
type LinkFieldType = typeof linkFieldType;
|
|
2098
|
+
interface LinkFieldBase {
|
|
2099
|
+
type: LinkFieldType;
|
|
2100
|
+
}
|
|
2101
|
+
interface LinkFieldDefinitionData extends LinkFieldBase, WithFieldRequired, FieldDefinitionBase {
|
|
2102
|
+
}
|
|
2103
|
+
interface CreateLinkField extends LinkFieldBase, CreateFieldBase, WithOptionalFieldRequired {
|
|
2104
|
+
}
|
|
2105
|
+
interface UpdateLinkField extends LinkFieldBase, UpdateFieldBase, WithOptionalFieldRequired {
|
|
2106
|
+
}
|
|
2107
|
+
interface ManagedLinkFieldInput extends CreateLinkField, WithIdAndOptionalUserEditable {
|
|
2108
|
+
}
|
|
2109
|
+
declare const dateFieldType = "date";
|
|
2110
|
+
type DateFieldType = typeof dateFieldType;
|
|
2111
|
+
interface DateFieldBase {
|
|
2112
|
+
type: DateFieldType;
|
|
2113
|
+
}
|
|
2114
|
+
interface DateFieldDefinitionData extends DateFieldBase, WithFieldRequired, FieldDefinitionBase {
|
|
2115
|
+
}
|
|
2116
|
+
interface CreateDateField extends DateFieldBase, CreateFieldBase, WithOptionalFieldRequired {
|
|
2117
|
+
}
|
|
2118
|
+
interface UpdateDateField extends DateFieldBase, UpdateFieldBase, WithOptionalFieldRequired {
|
|
2119
|
+
}
|
|
2120
|
+
interface ManagedDateFieldInput extends CreateDateField, WithIdAndOptionalUserEditable {
|
|
2121
|
+
}
|
|
2122
|
+
declare const fileFieldType = "file";
|
|
2123
|
+
type FileFieldType = typeof fileFieldType;
|
|
2124
|
+
interface FileFieldBase {
|
|
2125
|
+
type: FileFieldType;
|
|
2126
|
+
}
|
|
2127
|
+
interface FileFieldDefinitionData extends FileFieldBase, FieldDefinitionBase, WithAllowedFileTypes, WithFieldRequired {
|
|
2128
|
+
}
|
|
2129
|
+
interface CreateFileField extends FileFieldBase, CreateFieldBase, WithAllowedFileTypes, WithOptionalFieldRequired {
|
|
2130
|
+
}
|
|
2131
|
+
interface UpdateFileField extends FileFieldBase, UpdateFieldBase, Partial<WithAllowedFileTypes>, WithOptionalFieldRequired {
|
|
2132
|
+
}
|
|
2133
|
+
interface ManagedFileFieldInput extends CreateFileField, WithIdAndOptionalUserEditable {
|
|
2134
|
+
}
|
|
2135
|
+
declare const enumFieldType = "enum";
|
|
2136
|
+
type EnumFieldType = typeof enumFieldType;
|
|
2137
|
+
interface EnumFieldBase {
|
|
2138
|
+
type: EnumFieldType;
|
|
2139
|
+
}
|
|
2140
|
+
interface WithEnumCaseId {
|
|
2141
|
+
id: string;
|
|
2142
|
+
}
|
|
2143
|
+
interface WithEnumCaseNameInput {
|
|
2144
|
+
name: string;
|
|
2145
|
+
nameByLocale?: LocalizationSourceUpdate;
|
|
2146
|
+
}
|
|
2147
|
+
interface WithEnumCaseNameInputForUpdate {
|
|
2148
|
+
name: string;
|
|
2149
|
+
nameByLocale?: Record<LocaleId, LocalizedValueUpdate | LocalizationValue>;
|
|
2150
|
+
}
|
|
2151
|
+
interface EnumCaseDataInput extends WithEnumCaseId, WithEnumCaseNameInput {
|
|
2152
|
+
}
|
|
2153
|
+
interface EnumCaseDataInputForUpdate extends WithEnumCaseId, WithEnumCaseNameInputForUpdate {
|
|
2154
|
+
}
|
|
2155
|
+
interface EnumFieldDefinitionData extends EnumFieldBase, FieldDefinitionBase {
|
|
2156
|
+
cases: EnumCaseData[];
|
|
2157
|
+
}
|
|
2158
|
+
interface CreateEnumField extends EnumFieldBase, CreateFieldBase {
|
|
2159
|
+
cases: CreateEnumCase[];
|
|
2160
|
+
}
|
|
2161
|
+
interface UpdateEnumField extends EnumFieldBase, UpdateFieldBase {
|
|
2162
|
+
}
|
|
2163
|
+
interface ManagedEnumFieldInput extends EnumFieldBase, CreateFieldBase, WithIdAndOptionalUserEditable {
|
|
2164
|
+
cases: EnumCaseDataInput[];
|
|
2165
|
+
}
|
|
2166
|
+
interface ManagedEnumFieldInputForSetFields extends Omit<ManagedEnumFieldInput, "cases"> {
|
|
2167
|
+
cases: EnumCaseDataInputForUpdate[];
|
|
2168
|
+
}
|
|
2169
|
+
declare const collectionReferenceFieldType = "collectionReference";
|
|
2170
|
+
type CollectionReferenceFieldType = typeof collectionReferenceFieldType;
|
|
2171
|
+
interface CollectionReferenceFieldBase {
|
|
2172
|
+
type: CollectionReferenceFieldType;
|
|
2173
|
+
}
|
|
2174
|
+
interface WithFieldCollectionId {
|
|
2175
|
+
collectionId: string;
|
|
2176
|
+
}
|
|
2177
|
+
interface CollectionReferenceFieldDefinitionData extends CollectionReferenceFieldBase, FieldDefinitionBase, WithFieldCollectionId, WithFieldRequired {
|
|
2178
|
+
}
|
|
2179
|
+
interface CreateCollectionReferenceField extends CollectionReferenceFieldBase, CreateFieldBase, WithFieldCollectionId, WithOptionalFieldRequired {
|
|
2180
|
+
}
|
|
2181
|
+
interface UpdateCollectionReferenceField extends CollectionReferenceFieldBase, UpdateFieldBase, WithOptionalFieldRequired {
|
|
2182
|
+
}
|
|
2183
|
+
interface ManagedCollectionReferenceFieldInput extends CreateCollectionReferenceField, WithIdAndOptionalUserEditable {
|
|
2184
|
+
}
|
|
2185
|
+
declare const multiCollectionReferenceFieldType = "multiCollectionReference";
|
|
2186
|
+
type MultiCollectionReferenceFieldType = typeof multiCollectionReferenceFieldType;
|
|
2187
|
+
interface MultiCollectionReferenceFieldBase {
|
|
2188
|
+
type: MultiCollectionReferenceFieldType;
|
|
2189
|
+
}
|
|
2190
|
+
interface MultiCollectionReferenceFieldDefinitionData extends MultiCollectionReferenceFieldBase, FieldDefinitionBase, WithFieldCollectionId, WithFieldRequired {
|
|
2191
|
+
}
|
|
2192
|
+
interface CreateMultiCollectionReferenceField extends MultiCollectionReferenceFieldBase, CreateFieldBase, WithFieldCollectionId, WithOptionalFieldRequired {
|
|
2193
|
+
}
|
|
2194
|
+
interface UpdateMultiCollectionReferenceField extends MultiCollectionReferenceFieldBase, UpdateFieldBase, WithOptionalFieldRequired {
|
|
2195
|
+
}
|
|
2196
|
+
interface ManagedMultiCollectionReferenceFieldInput extends CreateMultiCollectionReferenceField, WithIdAndOptionalUserEditable {
|
|
2197
|
+
}
|
|
2198
|
+
declare const fieldDividerType = "divider";
|
|
2199
|
+
type FieldDividerType = typeof fieldDividerType;
|
|
2200
|
+
interface FieldDividerBase {
|
|
2201
|
+
type: FieldDividerType;
|
|
2202
|
+
}
|
|
2203
|
+
interface FieldDividerDefinitionData extends FieldDividerBase, FieldDefinitionBase {
|
|
2204
|
+
}
|
|
2205
|
+
interface CreateFieldDivider extends FieldDividerBase, CreateFieldBase {
|
|
2206
|
+
}
|
|
2207
|
+
interface UpdateFieldDivider extends FieldDividerBase, UpdateFieldBase {
|
|
2208
|
+
}
|
|
2209
|
+
declare const unsupportedFieldType = "unsupported";
|
|
2210
|
+
type UnsupportedFieldType = typeof unsupportedFieldType;
|
|
2211
|
+
interface UnsupportedFieldBase {
|
|
2212
|
+
type: UnsupportedFieldType;
|
|
2213
|
+
}
|
|
2214
|
+
interface UnsupportedFieldDefinitionData extends UnsupportedFieldBase, FieldDefinitionBase {
|
|
2215
|
+
}
|
|
2216
|
+
interface UpdateUnsupportedField extends UnsupportedFieldBase, UpdateFieldBase {
|
|
2217
|
+
}
|
|
2218
|
+
/**
|
|
2219
|
+
* A collection field that Framer knows about and the plugin API fully supports.
|
|
2220
|
+
*/
|
|
2221
|
+
type SupportedFieldDefinitionData = BooleanFieldDefinitionData | ColorFieldDefinitionData | NumberFieldDefinitionData | StringFieldDefinitionData | FormattedTextFieldDefinitionData | ImageFieldDefinitionData | LinkFieldDefinitionData | DateFieldDefinitionData | FileFieldDefinitionData | EnumFieldDefinitionData | CollectionReferenceFieldDefinitionData | MultiCollectionReferenceFieldDefinitionData | ArrayFieldDefinitionData;
|
|
2222
|
+
type ManagedCollectionFieldInputData = ManagedBooleanFieldInput | ManagedColorFieldInput | ManagedNumberFieldInput | ManagedStringFieldInput | FormattedTextFieldInput | ManagedImageFieldInput | ManagedLinkFieldInput | ManagedDateFieldInput | ManagedFileFieldInput | ManagedEnumFieldInput | ManagedCollectionReferenceFieldInput | ManagedMultiCollectionReferenceFieldInput | ManagedArrayFieldInput;
|
|
2223
|
+
type ManagedCollectionFieldInput = Exclude<ManagedCollectionFieldInputData, ManagedEnumFieldInput> | ManagedEnumFieldInputForSetFields;
|
|
2224
|
+
/**
|
|
2225
|
+
* Any kind of collection field definition. The field may be unsupported by the
|
|
2226
|
+
* plugin API.
|
|
2227
|
+
*/
|
|
2228
|
+
type FieldDefinitionData = SupportedFieldDefinitionData | FieldDividerDefinitionData | UnsupportedFieldDefinitionData;
|
|
2229
|
+
type CreateField = CreateBooleanField | CreateColorField | CreateNumberField | CreateStringField | CreateFormattedTextField | CreateImageField | CreateLinkField | CreateDateField | CreateFileField | CreateEnumField | CreateCollectionReferenceField | CreateMultiCollectionReferenceField | CreateFieldDivider | CreateArrayField;
|
|
2230
|
+
type UpdateField = UpdateBooleanField | UpdateColorField | UpdateNumberField | UpdateStringField | UpdateFormattedTextField | UpdateImageField | UpdateLinkField | UpdateDateField | UpdateFileField | UpdateEnumField | UpdateCollectionReferenceField | UpdateMultiCollectionReferenceField | UpdateFieldDivider | UpdateUnsupportedField | UpdateArrayField;
|
|
2231
|
+
type FieldInput = Prettify<CreateField | UpdateField>;
|
|
2232
|
+
interface WithUserEditable {
|
|
2233
|
+
/** Is the user able to edit the field within the UI. */
|
|
2234
|
+
userEditable: boolean;
|
|
2235
|
+
}
|
|
2236
|
+
/**
|
|
2237
|
+
* Any kind of collection field definition that was created by a plugin and is
|
|
2238
|
+
* supported by the API.
|
|
2239
|
+
*/
|
|
2240
|
+
type ManagedCollectionField = SupportedFieldDefinitionData & WithUserEditable;
|
|
2241
|
+
/** @deprecated Use `ManagedCollectionFieldInput` instead. */
|
|
2242
|
+
type EditableManagedCollectionField = ManagedCollectionFieldInputData;
|
|
2243
|
+
declare class ManagedCollection implements Navigable {
|
|
2244
|
+
#private;
|
|
2245
|
+
readonly id: NodeId;
|
|
2246
|
+
readonly name: string;
|
|
2247
|
+
/**
|
|
2248
|
+
* @deprecated Use `managedBy` instead and the [Permissions
|
|
2249
|
+
* API](https://www.framer.com/developers/plugins-permissions) to check if users can edit the
|
|
2250
|
+
* collection.
|
|
2251
|
+
*/
|
|
2252
|
+
readonly readonly: boolean;
|
|
2253
|
+
/**
|
|
2254
|
+
* Collections managed by other plugins should are read-only.
|
|
2255
|
+
*/
|
|
2256
|
+
readonly managedBy: ManagedCollectionManagedBy;
|
|
2257
|
+
constructor(data: CollectionData, engine: PluginEngine);
|
|
2258
|
+
/**
|
|
2259
|
+
* Get item keys in their set order.
|
|
2260
|
+
*/
|
|
2261
|
+
getItemIds(): Promise<string[]>;
|
|
2262
|
+
/**
|
|
2263
|
+
* Arrange items in a specific order.
|
|
2264
|
+
*
|
|
2265
|
+
* Use `"ManagedCollection.setItemOrder"` to check if this method is allowed.
|
|
2266
|
+
*/
|
|
2267
|
+
setItemOrder(ids: string[]): Promise<void>;
|
|
2268
|
+
/**
|
|
2269
|
+
* Get all fields.
|
|
2270
|
+
*/
|
|
2271
|
+
getFields(): Promise<ManagedCollectionField[]>;
|
|
2272
|
+
/**
|
|
2273
|
+
* Create, update or remove all fields in one go.
|
|
2274
|
+
*
|
|
2275
|
+
* Use `"ManagedCollection.setFields"` to check if this method is allowed.
|
|
2276
|
+
*/
|
|
2277
|
+
setFields(fields: ManagedCollectionFieldInput[]): Promise<void>;
|
|
2278
|
+
/**
|
|
2279
|
+
* Add new items or update existing ones if their IDs match.
|
|
2280
|
+
*
|
|
2281
|
+
* Use `"ManagedCollection.addItems"` to check if this method is allowed.
|
|
2282
|
+
*/
|
|
2283
|
+
addItems(items: ManagedCollectionItemInput[]): Promise<void>;
|
|
2284
|
+
/**
|
|
2285
|
+
* Remove items by their ID.
|
|
2286
|
+
*
|
|
2287
|
+
* Use `"ManagedCollection.removeItems"` to check if this method is allowed.
|
|
2288
|
+
*/
|
|
2289
|
+
removeItems(itemIds: string[]): Promise<void>;
|
|
2290
|
+
/**
|
|
2291
|
+
* Make this the active collection.
|
|
2292
|
+
*/
|
|
2293
|
+
setAsActive(): Promise<void>;
|
|
2294
|
+
/**
|
|
2295
|
+
* Set plugin data by key.
|
|
2296
|
+
*
|
|
2297
|
+
* Use `"ManagedCollection.setPluginData"` to check if this method is allowed.
|
|
2298
|
+
*/
|
|
2299
|
+
setPluginData(key: string, value: string | null): Promise<void>;
|
|
2300
|
+
/**
|
|
2301
|
+
* Get plugin data by key.
|
|
2302
|
+
*/
|
|
2303
|
+
getPluginData(key: string): Promise<string | null>;
|
|
2304
|
+
/**
|
|
2305
|
+
* Get all plugin data keys.
|
|
2306
|
+
*/
|
|
2307
|
+
getPluginDataKeys(): Promise<string[]>;
|
|
2308
|
+
/**
|
|
2309
|
+
* Navigate to this collection. May switch modes to reveal the relevant view.
|
|
2310
|
+
*/
|
|
2311
|
+
navigateTo(opts?: NavigableOptions): Promise<void>;
|
|
2312
|
+
}
|
|
2313
|
+
declare class Collection implements Navigable {
|
|
2314
|
+
#private;
|
|
2315
|
+
readonly id: NodeId;
|
|
2316
|
+
readonly name: string;
|
|
2317
|
+
readonly slugFieldName: string | null;
|
|
2318
|
+
readonly slugFieldBasedOn: string | null;
|
|
2319
|
+
/**
|
|
2320
|
+
* @deprecated Use `managedBy` instead and the [Permissions
|
|
2321
|
+
* API](https://www.framer.com/developers/plugins-permissions) to check if users can edit the
|
|
2322
|
+
* collection.
|
|
2323
|
+
*/
|
|
2324
|
+
readonly readonly: boolean;
|
|
2325
|
+
/**
|
|
2326
|
+
* Collections managed by plugins are read-only. To be able to modify them use
|
|
2327
|
+
* `ManagedCollection` (which is only possible in `configureManagedCollection` or
|
|
2328
|
+
* `syncManagedCollection` modes).
|
|
2329
|
+
*/
|
|
2330
|
+
readonly managedBy: CollectionManagedBy;
|
|
2331
|
+
constructor(data: CollectionData, engine: PluginEngine);
|
|
2332
|
+
/**
|
|
2333
|
+
* Arrange items in a specific order.
|
|
2334
|
+
*
|
|
2335
|
+
* Use `"Collection.setItemOrder"` to check if this method is allowed.
|
|
2336
|
+
*/
|
|
2337
|
+
setItemOrder(ids: NodeId[]): Promise<void>;
|
|
2338
|
+
/**
|
|
2339
|
+
* Get all fields.
|
|
2340
|
+
*/
|
|
2341
|
+
getFields(): Promise<Field[]>;
|
|
2342
|
+
/**
|
|
2343
|
+
* Create new fields. Use `Field.setAttributes` to update.
|
|
2344
|
+
*
|
|
2345
|
+
* Use `"Collection.addFields"` to check if this method is allowed.
|
|
2346
|
+
*/
|
|
2347
|
+
addFields(fields: CreateField[]): Promise<Field[]>;
|
|
2348
|
+
/**
|
|
2349
|
+
* Remove fields by their ID.
|
|
2350
|
+
*
|
|
2351
|
+
* Use `"Collection.removeFields"` to check if this method is allowed.
|
|
2352
|
+
*/
|
|
2353
|
+
removeFields(fieldIds: string[]): Promise<void>;
|
|
2354
|
+
/**
|
|
2355
|
+
* Arrange fields in a specific order.
|
|
2356
|
+
*
|
|
2357
|
+
* Use `"Collection.setFieldOrder"` to check if this method is allowed.
|
|
2358
|
+
*/
|
|
2359
|
+
setFieldOrder(fieldIds: string[]): Promise<void>;
|
|
2360
|
+
/**
|
|
2361
|
+
* Get all items in their set order.
|
|
2362
|
+
*/
|
|
2363
|
+
getItems(): Promise<CollectionItem[]>;
|
|
2364
|
+
/**
|
|
2365
|
+
* Add new items or update existing ones if their IDs are provided.
|
|
2366
|
+
*
|
|
2367
|
+
* This creates a new item with "foo" as its slug:
|
|
2368
|
+
*
|
|
2369
|
+
* ```ts
|
|
2370
|
+
* collection.addItems([{ slug: "foo" }])
|
|
2371
|
+
* ```
|
|
2372
|
+
*
|
|
2373
|
+
* This updates an existing item with ID "aBc123" to have "bar" as its slug:
|
|
2374
|
+
*
|
|
2375
|
+
* ```ts
|
|
2376
|
+
* collection.addItems([{ id: "aBc123", slug: "bar" }])
|
|
2377
|
+
* ```
|
|
2378
|
+
*
|
|
2379
|
+
* Use `"Collection.addItems"` to check if this method is allowed.
|
|
2380
|
+
*/
|
|
2381
|
+
addItems(items: CollectionItemInput[]): Promise<void>;
|
|
2382
|
+
/**
|
|
2383
|
+
* Remove items by their ID.
|
|
2384
|
+
*
|
|
2385
|
+
* Use `"Collection.removeItems"` to check if this method is allowed.
|
|
2386
|
+
*/
|
|
2387
|
+
removeItems(itemIds: NodeId[]): Promise<void>;
|
|
2388
|
+
/**
|
|
2389
|
+
* Make this the active collection.
|
|
2390
|
+
*/
|
|
2391
|
+
setAsActive(): Promise<void>;
|
|
2392
|
+
/**
|
|
2393
|
+
* Set plugin data by key.
|
|
2394
|
+
*
|
|
2395
|
+
* Use `"Collection.setPluginData"` to check if this method is allowed.
|
|
2396
|
+
*/
|
|
2397
|
+
setPluginData(key: string, value: string | null): Promise<void>;
|
|
2398
|
+
/**
|
|
2399
|
+
* Get plugin data by key.
|
|
2400
|
+
*/
|
|
2401
|
+
getPluginData(key: string): Promise<string | null>;
|
|
2402
|
+
/**
|
|
2403
|
+
* Get all plugin data keys.
|
|
2404
|
+
*/
|
|
2405
|
+
getPluginDataKeys(): Promise<string[]>;
|
|
2406
|
+
/**
|
|
2407
|
+
* Navigate to this collection. May switch modes to reveal the relevant view.
|
|
2408
|
+
*/
|
|
2409
|
+
navigateTo(opts?: NavigableOptions): Promise<void>;
|
|
2410
|
+
}
|
|
2411
|
+
declare class CollectionItem implements Navigable {
|
|
2412
|
+
#private;
|
|
2413
|
+
readonly id: NodeId;
|
|
2414
|
+
/** External ID for managed collections, unique node ID otherwise. */
|
|
2415
|
+
readonly nodeId: NodeId;
|
|
2416
|
+
readonly slug: string;
|
|
2417
|
+
readonly slugByLocale: InlineLocalizationValueByLocale;
|
|
2418
|
+
readonly draft: boolean;
|
|
2419
|
+
readonly fieldData: Readonly<FieldData>;
|
|
2420
|
+
constructor(collectionItemData: CollectionItemSerializableData, engine: PluginEngine);
|
|
2421
|
+
/**
|
|
2422
|
+
* Remove this item.
|
|
2423
|
+
*
|
|
2424
|
+
* Use `"CollectionItem.remove"` to check if this method is allowed.
|
|
2425
|
+
*/
|
|
2426
|
+
remove(): Promise<void>;
|
|
2427
|
+
/**
|
|
2428
|
+
* Update the item.
|
|
2429
|
+
*
|
|
2430
|
+
* Use `"CollectionItem.setAttributes"` to check if this method is allowed.
|
|
2431
|
+
*/
|
|
2432
|
+
setAttributes(update: EditableCollectionItemAttributes): Promise<CollectionItem | null>;
|
|
2433
|
+
/**
|
|
2434
|
+
* Set plugin data by key.
|
|
2435
|
+
*
|
|
2436
|
+
* Use `"CollectionItem.setPluginData"` to check if this method is allowed.
|
|
2437
|
+
*/
|
|
2438
|
+
setPluginData(key: string, value: string | null): Promise<void>;
|
|
2439
|
+
/**
|
|
2440
|
+
* Get plugin data by key.
|
|
2441
|
+
*/
|
|
2442
|
+
getPluginData(key: string): Promise<string | null>;
|
|
2443
|
+
/**
|
|
2444
|
+
* Get all plugin data keys.
|
|
2445
|
+
*/
|
|
2446
|
+
getPluginDataKeys(): Promise<string[]>;
|
|
2447
|
+
/**
|
|
2448
|
+
* Navigate to this collection item. May switch modes to reveal the relevant view.
|
|
2449
|
+
*/
|
|
2450
|
+
navigateTo(opts?: NavigableOptions): Promise<void>;
|
|
2451
|
+
}
|
|
2452
|
+
|
|
2453
|
+
interface ZoomIntoViewOptions {
|
|
2454
|
+
/**
|
|
2455
|
+
* Set a percentage limit for the maximum zoom level.
|
|
2456
|
+
*
|
|
2457
|
+
* For example, use a value of `1.0` to ensure the zoom does not exceed 100%.
|
|
2458
|
+
*/
|
|
2459
|
+
maxZoom?: number;
|
|
2460
|
+
/**
|
|
2461
|
+
* If the nodes are already visible, skip the zoom.
|
|
2462
|
+
* @default false
|
|
2463
|
+
*/
|
|
2464
|
+
skipIfVisible?: boolean;
|
|
2465
|
+
}
|
|
2466
|
+
|
|
2467
|
+
interface Rect$1 {
|
|
2468
|
+
x: number;
|
|
2469
|
+
y: number;
|
|
2470
|
+
width: number;
|
|
2471
|
+
height: number;
|
|
2472
|
+
}
|
|
2473
|
+
declare const createableNodes: readonly ["FrameNode", "TextNode", "ComponentNode"];
|
|
2474
|
+
declare const otherNodes: readonly ["SVGNode", "DesignPageNode", "WebPageNode", "ComponentNode", "VectorSetNode", "VectorSetItemNode", "UnknownNode", "ComponentInstanceNode"];
|
|
2475
|
+
type CreateNodeType$1 = (typeof createableNodes)[number];
|
|
2476
|
+
type OtherNodeType = (typeof otherNodes)[number];
|
|
2477
|
+
type PluginNodeClass = OtherNodeType | CreateNodeType$1;
|
|
2478
|
+
type KnownNodeClass = Exclude<PluginNodeClass, "UnknownNode">;
|
|
2479
|
+
type NodeWithAttribute<T extends NodeAttributeKey> = Extract<AnyNode, Record<T, unknown>>;
|
|
2480
|
+
interface CommonNodeData extends WithIdTrait, WithReplicaInfoTrait {
|
|
2481
|
+
[classKey]: PluginNodeClass;
|
|
2482
|
+
}
|
|
2483
|
+
interface NodeClassToEditableAttributes {
|
|
2484
|
+
FrameNode: EditableFrameNodeAttributes;
|
|
2485
|
+
TextNode: EditableTextNodeAttributes;
|
|
2486
|
+
SVGNode: EditableSVGNodeAttributes;
|
|
2487
|
+
ComponentInstanceNode: EditableComponentInstanceNodeAttributes;
|
|
2488
|
+
DesignPageNode: EditableDesignPageNodeAttributes;
|
|
2489
|
+
WebPageNode: EditableWebPageNodeAttributes;
|
|
2490
|
+
ComponentNode: EditableComponentNodeAttributes;
|
|
2491
|
+
VectorSetNode: EditableVectorSetNodeAttributes;
|
|
2492
|
+
VectorSetItemNode: EditableVectorSetItemNodeAttributes;
|
|
2493
|
+
UnknownNode: object;
|
|
2494
|
+
}
|
|
2495
|
+
declare abstract class NodeMethods implements WithIdTrait, Navigable {
|
|
2496
|
+
#private;
|
|
2497
|
+
abstract readonly [classKey]: PluginNodeClass;
|
|
2498
|
+
readonly id: NodeId;
|
|
2499
|
+
readonly originalId: NodeId | null;
|
|
2500
|
+
constructor(data: SomeNodeData, engine: PluginEngine);
|
|
2501
|
+
get isReplica(): boolean;
|
|
2502
|
+
/**
|
|
2503
|
+
* Remove this node.
|
|
2504
|
+
*
|
|
2505
|
+
* Use `"Node.remove"` to check if this method is allowed.
|
|
2506
|
+
*/
|
|
2507
|
+
remove(): Promise<void>;
|
|
2508
|
+
/**
|
|
2509
|
+
* Select this node.
|
|
2510
|
+
*/
|
|
2511
|
+
select(): Promise<void>;
|
|
2512
|
+
/**
|
|
2513
|
+
* Clone this node.
|
|
2514
|
+
*
|
|
2515
|
+
* Use `"Node.clone"` to check if this method is allowed.
|
|
2516
|
+
*/
|
|
2517
|
+
clone(): Promise<(typeof this)[ClassKey] extends "UnknownNode" ? never : typeof this | null>;
|
|
2518
|
+
/**
|
|
2519
|
+
* Set the attributes of this node.
|
|
2520
|
+
*
|
|
2521
|
+
* Use `"Node.setAttributes"` to check if this method is allowed.
|
|
2522
|
+
*/
|
|
2523
|
+
setAttributes(update: Partial<NodeClassToEditableAttributes[(typeof this)[ClassKey]]>): Promise<(typeof this)[ClassKey] extends "UnknownNode" ? never : typeof this | null>;
|
|
2524
|
+
/**
|
|
2525
|
+
* Get the bounding box of this node.
|
|
2526
|
+
*/
|
|
2527
|
+
getRect(): Promise<Rect$1 | null>;
|
|
2528
|
+
/**
|
|
2529
|
+
* Pans and zooms the viewport to center the node.
|
|
2530
|
+
*/
|
|
2531
|
+
zoomIntoView(options?: ZoomIntoViewOptions): Promise<void>;
|
|
2532
|
+
/**
|
|
2533
|
+
* Navigate to this node. May switch modes to reveal the relevant view.
|
|
2534
|
+
*/
|
|
2535
|
+
navigateTo(opts?: Pick<NavigableOptions, "select" | "zoomIntoView">): Promise<void>;
|
|
2536
|
+
/**
|
|
2537
|
+
* Get the parent of this node.
|
|
2538
|
+
*/
|
|
2539
|
+
getParent(): Promise<AnyNode | null>;
|
|
2540
|
+
/**
|
|
2541
|
+
* Get the children of this node.
|
|
2542
|
+
*/
|
|
2543
|
+
getChildren(): Promise<CanvasNode[]>;
|
|
2544
|
+
/**
|
|
2545
|
+
* Get `type` descendants of this node.
|
|
2546
|
+
*/
|
|
2547
|
+
getNodesWithType(type: "FrameNode"): Promise<FrameNode[]>;
|
|
2548
|
+
getNodesWithType(type: "TextNode"): Promise<TextNode[]>;
|
|
2549
|
+
getNodesWithType(type: "SVGNode"): Promise<SVGNode[]>;
|
|
2550
|
+
getNodesWithType(type: "ComponentInstanceNode"): Promise<ComponentInstanceNode[]>;
|
|
2551
|
+
getNodesWithType(type: "DesignPageNode"): Promise<DesignPageNode[]>;
|
|
2552
|
+
getNodesWithType(type: "WebPageNode"): Promise<WebPageNode[]>;
|
|
2553
|
+
getNodesWithType(type: "ComponentNode"): Promise<ComponentNode[]>;
|
|
2554
|
+
/**
|
|
2555
|
+
* Get the descendants of this node that support `attribute`.
|
|
2556
|
+
*/
|
|
2557
|
+
getNodesWithAttribute<T extends NodeAttributeKey, Node = NodeWithAttribute<T>>(attribute: T): Promise<Node[]>;
|
|
2558
|
+
/**
|
|
2559
|
+
* Get the descendants of this node that have `attribute` set.
|
|
2560
|
+
*/
|
|
2561
|
+
getNodesWithAttributeSet<T extends NodeAttributeKey, Node = NodeWithAttribute<T>>(attribute: T): Promise<Node[]>;
|
|
2562
|
+
/**
|
|
2563
|
+
* Walk this node and its descendants recursively.
|
|
2564
|
+
*/
|
|
2565
|
+
walk(this: AnyNode): AsyncGenerator<AnyNode>;
|
|
2566
|
+
/**
|
|
2567
|
+
* Get plugin data by key.
|
|
2568
|
+
*/
|
|
2569
|
+
getPluginData(key: string): Promise<string | null>;
|
|
2570
|
+
/**
|
|
2571
|
+
* Set plugin data by key.
|
|
2572
|
+
*
|
|
2573
|
+
* Use `"Node.setPluginData"` to check if this method is allowed.
|
|
2574
|
+
*/
|
|
2575
|
+
setPluginData(key: string, value: string | null): Promise<void>;
|
|
2576
|
+
/**
|
|
2577
|
+
* Get all plugin data keys.
|
|
2578
|
+
*/
|
|
2579
|
+
getPluginDataKeys(): Promise<string[]>;
|
|
2580
|
+
}
|
|
2581
|
+
interface DrawableNode extends WithNameTrait, WithVisibleTrait, WithLockedTrait, WithOpacityTrait {
|
|
2582
|
+
}
|
|
2583
|
+
interface EditableFrameNodeAttributes extends DrawableNode, WithPositionTrait, WithPinsTrait, WithSizeTrait, WithSizeConstraintsTrait, WithAspectRatioTrait, WithZIndexTrait, WithOverflowTrait, WithBackgroundColorTrait<TraitVariantNode>, WithBackgroundImageTrait<TraitVariantNode>, WithBackgroundGradientTrait<TraitVariantNode>, WithRotationTrait, WithLinkTrait, WithBorderRadiusTrait, WithBorderTrait<TraitVariantNode>, WithLayoutTrait, WithGridItemTrait, WithImageRenderingTrait {
|
|
2584
|
+
}
|
|
2585
|
+
interface FrameNodeData extends CommonNodeData, Partial<DrawableNode>, WithPositionTrait, Partial<WithComponentVariantTrait>, Partial<WithPinsTrait>, Partial<WithSizeTrait>, Partial<WithSizeConstraintsTrait>, Partial<WithAspectRatioTrait>, Partial<WithZIndexTrait>, Partial<WithOverflowTrait>, Partial<WithBackgroundColorTrait<TraitVariantData>>, Partial<WithBackgroundImageTrait<TraitVariantData>>, Partial<WithBackgroundGradientTrait<TraitVariantData>>, Partial<WithRotationTrait>, Partial<WithLinkTrait>, Partial<WithBorderRadiusTrait>, Partial<WithBorderTrait<TraitVariantData>>, Partial<WithLayoutTrait>, Partial<WithGridItemTrait>, Partial<WithBreakpointTrait>, Partial<WithImageRenderingTrait> {
|
|
2586
|
+
[classKey]: "FrameNode";
|
|
2587
|
+
}
|
|
2588
|
+
declare class FrameNode extends NodeMethods implements EditableFrameNodeAttributes, WithBreakpointTrait {
|
|
2589
|
+
readonly [classKey]: FrameNodeData[ClassKey];
|
|
2590
|
+
readonly name: string | null;
|
|
2591
|
+
readonly visible: boolean;
|
|
2592
|
+
readonly locked: boolean;
|
|
2593
|
+
readonly backgroundColor: ColorStyle | string | null;
|
|
2594
|
+
readonly backgroundImage: ImageAsset | null;
|
|
2595
|
+
readonly backgroundGradient: LinearGradient | RadialGradient | ConicGradient | null;
|
|
2596
|
+
readonly rotation: number;
|
|
2597
|
+
readonly opacity: number;
|
|
2598
|
+
readonly borderRadius: BorderRadius;
|
|
2599
|
+
readonly border: Border | null;
|
|
2600
|
+
readonly imageRendering: ImageRendering | null;
|
|
2601
|
+
readonly position: Position;
|
|
2602
|
+
readonly top: CSSDimension<CSSUnit.Pixel> | null;
|
|
2603
|
+
readonly right: CSSDimension<CSSUnit.Pixel> | null;
|
|
2604
|
+
readonly bottom: CSSDimension<CSSUnit.Pixel> | null;
|
|
2605
|
+
readonly left: CSSDimension<CSSUnit.Pixel> | null;
|
|
2606
|
+
readonly centerX: CSSDimension<CSSUnit.Percentage> | null;
|
|
2607
|
+
readonly centerY: CSSDimension<CSSUnit.Percentage> | null;
|
|
2608
|
+
readonly width: WidthLength | null;
|
|
2609
|
+
readonly height: HeightLength | null;
|
|
2610
|
+
readonly maxWidth: WidthConstraint | null;
|
|
2611
|
+
readonly minWidth: WidthConstraint | null;
|
|
2612
|
+
readonly maxHeight: HeightConstraint | null;
|
|
2613
|
+
readonly minHeight: HeightConstraint | null;
|
|
2614
|
+
readonly aspectRatio: number | null;
|
|
2615
|
+
readonly zIndex: WithZIndexTrait["zIndex"];
|
|
2616
|
+
readonly link: string | null;
|
|
2617
|
+
readonly linkOpenInNewTab: boolean | null;
|
|
2618
|
+
readonly overflow: WithOverflowTrait["overflow"];
|
|
2619
|
+
readonly overflowX: WithOverflowTrait["overflowX"];
|
|
2620
|
+
readonly overflowY: WithOverflowTrait["overflowY"];
|
|
2621
|
+
readonly layout: WithLayoutTrait["layout"];
|
|
2622
|
+
readonly gap: WithLayoutTrait["gap"];
|
|
2623
|
+
readonly padding: WithLayoutTrait["padding"];
|
|
2624
|
+
readonly stackDirection: WithLayoutTrait["stackDirection"];
|
|
2625
|
+
readonly stackDistribution: WithLayoutTrait["stackDistribution"];
|
|
2626
|
+
readonly stackAlignment: WithLayoutTrait["stackAlignment"];
|
|
2627
|
+
readonly stackWrapEnabled: WithLayoutTrait["stackWrapEnabled"];
|
|
2628
|
+
readonly gridColumnCount: WithLayoutTrait["gridColumnCount"];
|
|
2629
|
+
readonly gridRowCount: WithLayoutTrait["gridRowCount"];
|
|
2630
|
+
readonly gridAlignment: WithLayoutTrait["gridAlignment"];
|
|
2631
|
+
readonly gridColumnWidthType: WithLayoutTrait["gridColumnWidthType"];
|
|
2632
|
+
readonly gridColumnWidth: WithLayoutTrait["gridColumnWidth"];
|
|
2633
|
+
readonly gridColumnMinWidth: WithLayoutTrait["gridColumnMinWidth"];
|
|
2634
|
+
readonly gridRowHeightType: WithLayoutTrait["gridRowHeightType"];
|
|
2635
|
+
readonly gridRowHeight: WithLayoutTrait["gridRowHeight"];
|
|
2636
|
+
readonly gridItemFillCellWidth: WithGridItemTrait["gridItemFillCellWidth"];
|
|
2637
|
+
readonly gridItemFillCellHeight: WithGridItemTrait["gridItemFillCellHeight"];
|
|
2638
|
+
readonly gridItemHorizontalAlignment: WithGridItemTrait["gridItemHorizontalAlignment"];
|
|
2639
|
+
readonly gridItemVerticalAlignment: WithGridItemTrait["gridItemVerticalAlignment"];
|
|
2640
|
+
readonly gridItemColumnSpan: WithGridItemTrait["gridItemColumnSpan"];
|
|
2641
|
+
readonly gridItemRowSpan: WithGridItemTrait["gridItemRowSpan"];
|
|
2642
|
+
readonly isVariant: boolean;
|
|
2643
|
+
readonly isPrimaryVariant: boolean;
|
|
2644
|
+
readonly isBreakpoint: boolean;
|
|
2645
|
+
readonly isPrimaryBreakpoint: boolean;
|
|
2646
|
+
readonly inheritsFromId: string | null;
|
|
2647
|
+
readonly gesture: Gesture | null;
|
|
2648
|
+
constructor(rawData: FrameNodeData, engine: PluginEngine);
|
|
2649
|
+
}
|
|
2650
|
+
interface EditableTextNodeAttributes extends DrawableNode, WithPositionTrait, WithPinsTrait, WithSizeTrait, WithSizeConstraintsTrait, WithRotationTrait, WithZIndexTrait, WithOverflowTrait, WithTextTruncationTrait, WithFontTrait<TraitVariantNode>, WithLinkTrait, WithInlineTextStyleTrait<TraitVariantNode>, WithGridItemTrait {
|
|
2651
|
+
}
|
|
2652
|
+
interface TextNodeData extends CommonNodeData, Partial<DrawableNode>, WithPositionTrait, Partial<WithPinsTrait>, Partial<WithSizeTrait>, Partial<WithSizeConstraintsTrait>, Partial<WithRotationTrait>, Partial<WithZIndexTrait>, Partial<WithLinkTrait>, Partial<WithOverflowTrait>, Partial<WithTextTruncationTrait>, Partial<WithFontTrait<TraitVariantData>>, Partial<WithInlineTextStyleTrait<TraitVariantData>>, Partial<WithGridItemTrait> {
|
|
2653
|
+
[classKey]: "TextNode";
|
|
2654
|
+
}
|
|
2655
|
+
declare class TextNode extends NodeMethods implements EditableTextNodeAttributes {
|
|
2656
|
+
#private;
|
|
2657
|
+
readonly [classKey]: TextNodeData[ClassKey];
|
|
2658
|
+
readonly name: string | null;
|
|
2659
|
+
readonly visible: boolean;
|
|
2660
|
+
readonly locked: boolean;
|
|
2661
|
+
readonly rotation: number;
|
|
2662
|
+
readonly opacity: number;
|
|
2663
|
+
readonly zIndex: WithZIndexTrait["zIndex"];
|
|
2664
|
+
readonly font: Font | null;
|
|
2665
|
+
readonly inlineTextStyle: TextStyle | null;
|
|
2666
|
+
readonly position: Position;
|
|
2667
|
+
readonly top: CSSDimension<CSSUnit.Pixel> | null;
|
|
2668
|
+
readonly right: CSSDimension<CSSUnit.Pixel> | null;
|
|
2669
|
+
readonly bottom: CSSDimension<CSSUnit.Pixel> | null;
|
|
2670
|
+
readonly left: CSSDimension<CSSUnit.Pixel> | null;
|
|
2671
|
+
readonly centerX: CSSDimension<CSSUnit.Percentage> | null;
|
|
2672
|
+
readonly centerY: CSSDimension<CSSUnit.Percentage> | null;
|
|
2673
|
+
readonly width: WidthLength | null;
|
|
2674
|
+
readonly height: HeightLength | null;
|
|
2675
|
+
readonly maxWidth: WidthConstraint | null;
|
|
2676
|
+
readonly minWidth: WidthConstraint | null;
|
|
2677
|
+
readonly maxHeight: HeightConstraint | null;
|
|
2678
|
+
readonly minHeight: HeightConstraint | null;
|
|
2679
|
+
readonly link: string | null;
|
|
2680
|
+
readonly linkOpenInNewTab: boolean | null;
|
|
2681
|
+
readonly gridItemFillCellWidth: WithGridItemTrait["gridItemFillCellWidth"];
|
|
2682
|
+
readonly gridItemFillCellHeight: WithGridItemTrait["gridItemFillCellHeight"];
|
|
2683
|
+
readonly gridItemHorizontalAlignment: WithGridItemTrait["gridItemHorizontalAlignment"];
|
|
2684
|
+
readonly gridItemVerticalAlignment: WithGridItemTrait["gridItemVerticalAlignment"];
|
|
2685
|
+
readonly gridItemColumnSpan: WithGridItemTrait["gridItemColumnSpan"];
|
|
2686
|
+
readonly gridItemRowSpan: WithGridItemTrait["gridItemRowSpan"];
|
|
2687
|
+
readonly overflow: WithOverflowTrait["overflow"];
|
|
2688
|
+
readonly overflowX: WithOverflowTrait["overflowX"];
|
|
2689
|
+
readonly overflowY: WithOverflowTrait["overflowY"];
|
|
2690
|
+
readonly textTruncation: WithTextTruncationTrait["textTruncation"];
|
|
2691
|
+
constructor(rawData: TextNodeData, engine: PluginEngine);
|
|
2692
|
+
/**
|
|
2693
|
+
* Set the text of this node. Plain text content, not HTML.
|
|
2694
|
+
*
|
|
2695
|
+
* Use `"TextNode.setText"` to check if this method is allowed.
|
|
2696
|
+
*/
|
|
2697
|
+
setText(text: string): Promise<void>;
|
|
2698
|
+
/**
|
|
2699
|
+
* Get the text of this node. Plain text content, not HTML.
|
|
2700
|
+
*/
|
|
2701
|
+
getText(): Promise<string | null>;
|
|
2702
|
+
/**
|
|
2703
|
+
* Set the HTML of this node
|
|
2704
|
+
*
|
|
2705
|
+
* @alpha This an early API, and maybe heavily refactored in the future.
|
|
2706
|
+
*/
|
|
2707
|
+
setHTML(html: string): Promise<void>;
|
|
2708
|
+
/**
|
|
2709
|
+
* Get HTML of this node
|
|
2710
|
+
*
|
|
2711
|
+
* @alpha This an early API, and maybe heavily refactored in the future.
|
|
2712
|
+
*/
|
|
2713
|
+
getHTML(): Promise<string | null>;
|
|
2714
|
+
}
|
|
2715
|
+
interface EditableSVGNodeAttributes extends DrawableNode, WithPositionTrait, WithPinsTrait, WithSizeTrait, WithSVGTrait, WithRotationTrait {
|
|
2716
|
+
}
|
|
2717
|
+
interface SVGNodeData extends CommonNodeData, Partial<DrawableNode>, WithPositionTrait, Partial<WithPinsTrait>, Partial<WithSizeTrait>, WithSVGTrait, Partial<WithRotationTrait> {
|
|
2718
|
+
[classKey]: "SVGNode";
|
|
2719
|
+
}
|
|
2720
|
+
declare class SVGNode extends NodeMethods implements EditableSVGNodeAttributes {
|
|
2721
|
+
readonly [classKey]: SVGNodeData[ClassKey];
|
|
2722
|
+
readonly name: string | null;
|
|
2723
|
+
readonly visible: boolean;
|
|
2724
|
+
readonly locked: boolean;
|
|
2725
|
+
readonly svg: string;
|
|
2726
|
+
readonly rotation: number;
|
|
2727
|
+
readonly opacity: number;
|
|
2728
|
+
readonly position: Position;
|
|
2729
|
+
readonly top: CSSDimension<CSSUnit.Pixel> | null;
|
|
2730
|
+
readonly right: CSSDimension<CSSUnit.Pixel> | null;
|
|
2731
|
+
readonly bottom: CSSDimension<CSSUnit.Pixel> | null;
|
|
2732
|
+
readonly left: CSSDimension<CSSUnit.Pixel> | null;
|
|
2733
|
+
readonly centerX: CSSDimension<CSSUnit.Percentage> | null;
|
|
2734
|
+
readonly centerY: CSSDimension<CSSUnit.Percentage> | null;
|
|
2735
|
+
readonly width: WidthLength | null;
|
|
2736
|
+
readonly height: HeightLength | null;
|
|
2737
|
+
constructor(rawData: SVGNodeData, engine: PluginEngine);
|
|
2738
|
+
}
|
|
2739
|
+
interface EditableVectorSetItemNodeAttributes extends WithNameTrait, WithVisibleTrait, WithLockedTrait, WithPinsTrait, WithSizeTrait {
|
|
2740
|
+
}
|
|
2741
|
+
interface VectorSetItemNodeData extends CommonNodeData, Partial<WithNameTrait>, Partial<WithVisibleTrait>, Partial<WithLockedTrait>, Partial<WithPinsTrait>, Partial<WithSizeTrait> {
|
|
2742
|
+
[classKey]: "VectorSetItemNode";
|
|
2743
|
+
}
|
|
2744
|
+
declare class VectorSetItemNode extends NodeMethods implements EditableVectorSetItemNodeAttributes {
|
|
2745
|
+
#private;
|
|
2746
|
+
readonly [classKey]: VectorSetItemNodeData[ClassKey];
|
|
2747
|
+
readonly name: string | null;
|
|
2748
|
+
readonly visible: boolean;
|
|
2749
|
+
readonly locked: boolean;
|
|
2750
|
+
readonly top: CSSDimension<CSSUnit.Pixel> | null;
|
|
2751
|
+
readonly right: CSSDimension<CSSUnit.Pixel> | null;
|
|
2752
|
+
readonly bottom: CSSDimension<CSSUnit.Pixel> | null;
|
|
2753
|
+
readonly left: CSSDimension<CSSUnit.Pixel> | null;
|
|
2754
|
+
readonly centerX: CSSDimension<CSSUnit.Percentage> | null;
|
|
2755
|
+
readonly centerY: CSSDimension<CSSUnit.Percentage> | null;
|
|
2756
|
+
readonly width: WidthLength | null;
|
|
2757
|
+
readonly height: HeightLength | null;
|
|
2758
|
+
constructor(rawData: VectorSetItemNodeData, engine: PluginEngine);
|
|
2759
|
+
getSVG(): Promise<string | null>;
|
|
2760
|
+
}
|
|
2761
|
+
interface EditableComponentInstanceNodeAttributes extends DrawableNode, WithPositionTrait, WithPinsTrait, WithSizeTrait, WithSizeConstraintsTrait, WithAspectRatioTrait, WithControlAttributesTrait, WithRotationTrait {
|
|
2762
|
+
}
|
|
2763
|
+
interface ComponentInstanceNodeData extends CommonNodeData, Partial<DrawableNode>, WithPositionTrait, Partial<WithPinsTrait>, Partial<WithSizeTrait>, Partial<WithSizeConstraintsTrait>, Partial<WithAspectRatioTrait>, Partial<WithControlAttributesTrait>, Partial<WithTypedControlsTrait>, WithRequiredComponentInfoTrait, Partial<WithNullableComponentInfoTrait>, Partial<WithRotationTrait> {
|
|
2764
|
+
[classKey]: "ComponentInstanceNode";
|
|
2765
|
+
}
|
|
2766
|
+
declare class ComponentInstanceNode extends NodeMethods implements EditableComponentInstanceNodeAttributes, WithComponentInfoTrait {
|
|
2767
|
+
#private;
|
|
2768
|
+
readonly [classKey]: ComponentInstanceNodeData[ClassKey];
|
|
2769
|
+
readonly name: string | null;
|
|
2770
|
+
readonly visible: boolean;
|
|
2771
|
+
readonly locked: boolean;
|
|
2772
|
+
readonly componentIdentifier: string;
|
|
2773
|
+
readonly insertURL: string | null;
|
|
2774
|
+
readonly componentName: string | null;
|
|
2775
|
+
readonly controls: ControlAttributes;
|
|
2776
|
+
readonly rotation: number;
|
|
2777
|
+
readonly opacity: number;
|
|
2778
|
+
readonly position: Position;
|
|
2779
|
+
readonly top: CSSDimension<CSSUnit.Pixel> | null;
|
|
2780
|
+
readonly right: CSSDimension<CSSUnit.Pixel> | null;
|
|
2781
|
+
readonly bottom: CSSDimension<CSSUnit.Pixel> | null;
|
|
2782
|
+
readonly left: CSSDimension<CSSUnit.Pixel> | null;
|
|
2783
|
+
readonly centerX: CSSDimension<CSSUnit.Percentage> | null;
|
|
2784
|
+
readonly centerY: CSSDimension<CSSUnit.Percentage> | null;
|
|
2785
|
+
readonly width: WidthLength | null;
|
|
2786
|
+
readonly height: HeightLength | null;
|
|
2787
|
+
readonly maxWidth: WidthConstraint | null;
|
|
2788
|
+
readonly minWidth: WidthConstraint | null;
|
|
2789
|
+
readonly maxHeight: HeightConstraint | null;
|
|
2790
|
+
readonly minHeight: HeightConstraint | null;
|
|
2791
|
+
readonly aspectRatio: number | null;
|
|
2792
|
+
/** @alpha */
|
|
2793
|
+
get typedControls(): Record<string, Control>;
|
|
2794
|
+
constructor(rawData: ComponentInstanceNodeData, engine: PluginEngine);
|
|
2795
|
+
/**
|
|
2796
|
+
* Get runtime error for this node.
|
|
2797
|
+
*
|
|
2798
|
+
* @alpha
|
|
2799
|
+
*/
|
|
2800
|
+
getRuntimeError(): Promise<NodeRuntimeErrorResult | null>;
|
|
2801
|
+
}
|
|
2802
|
+
type EditableWebPageNodeAttributes = object;
|
|
2803
|
+
interface WebPageNodeData extends CommonNodeData, Partial<WithWebPageInfoTrait> {
|
|
2804
|
+
[classKey]: "WebPageNode";
|
|
2805
|
+
}
|
|
2806
|
+
declare class WebPageNode extends NodeMethods implements EditableWebPageNodeAttributes, WithWebPageInfoTrait {
|
|
2807
|
+
#private;
|
|
2808
|
+
readonly [classKey]: WebPageNodeData[ClassKey];
|
|
2809
|
+
/**
|
|
2810
|
+
* The relative path to the WebPage
|
|
2811
|
+
*/
|
|
2812
|
+
readonly path: string | null;
|
|
2813
|
+
/**
|
|
2814
|
+
* The Collection ID of the CMS Collection if the WebPage is a CMS Detail Page
|
|
2815
|
+
*/
|
|
2816
|
+
readonly collectionId: string | null;
|
|
2817
|
+
constructor(rawData: WebPageNodeData, engine: PluginEngine);
|
|
2818
|
+
/**
|
|
2819
|
+
* Get a list of breakpoints suggestions that can be added to the WebPage.
|
|
2820
|
+
*
|
|
2821
|
+
* @alpha
|
|
2822
|
+
*/
|
|
2823
|
+
getBreakpointSuggestions(): Promise<readonly Breakpoint[]>;
|
|
2824
|
+
/**
|
|
2825
|
+
* Adds a new breakpoint to the web page.
|
|
2826
|
+
* @param breakpoint The breakpoint configuration to add
|
|
2827
|
+
* @returns a new FrameNode
|
|
2828
|
+
*
|
|
2829
|
+
* @alpha
|
|
2830
|
+
*/
|
|
2831
|
+
addBreakpoint(basedOn: NodeId, breakpoint: Breakpoint): Promise<FrameNode>;
|
|
2832
|
+
/**
|
|
2833
|
+
* Get the active collection item for this CMS detail page.
|
|
2834
|
+
* Returns null if this is not a detail page or the collection is empty.
|
|
2835
|
+
*
|
|
2836
|
+
* @alpha
|
|
2837
|
+
*/
|
|
2838
|
+
getActiveCollectionItem(): Promise<CollectionItem | null>;
|
|
2839
|
+
}
|
|
2840
|
+
type EditableComponentNodeAttributes = WithNameTrait;
|
|
2841
|
+
interface ComponentNodeData extends CommonNodeData, Partial<WithNameTrait>, WithRequiredComponentInfoTrait, Partial<WithNullableComponentInfoTrait> {
|
|
2842
|
+
[classKey]: "ComponentNode";
|
|
2843
|
+
}
|
|
2844
|
+
declare class ComponentNode extends NodeMethods implements EditableComponentNodeAttributes, WithComponentInfoTrait {
|
|
2845
|
+
#private;
|
|
2846
|
+
readonly [classKey]: ComponentNodeData[ClassKey];
|
|
2847
|
+
readonly name: string | null;
|
|
2848
|
+
readonly componentIdentifier: string;
|
|
2849
|
+
readonly insertURL: string | null;
|
|
2850
|
+
readonly componentName: string | null;
|
|
2851
|
+
constructor(rawData: ComponentNodeData, engine: PluginEngine);
|
|
2852
|
+
/**
|
|
2853
|
+
* Add a variant to this component.
|
|
2854
|
+
*
|
|
2855
|
+
* @param basedOn - The ID of the node to duplicate
|
|
2856
|
+
* @param attributes - Optional attributes for the variant
|
|
2857
|
+
*
|
|
2858
|
+
* Use `"ComponentNode.addVariant"` to check if this method is allowed.
|
|
2859
|
+
*
|
|
2860
|
+
* @alpha - This method requires using FramerPluginAPIAlpha
|
|
2861
|
+
*/
|
|
2862
|
+
addVariant(basedOn: NodeId, attributes?: Partial<EditableFrameNodeAttributes>): Promise<FrameNode>;
|
|
2863
|
+
/**
|
|
2864
|
+
* Add a state to this component.
|
|
2865
|
+
*
|
|
2866
|
+
* @param nodeId - The ID of the node to add the state to
|
|
2867
|
+
* @param type - The type of state to add
|
|
2868
|
+
* @param attributes - Optional attributes for the state
|
|
2869
|
+
*
|
|
2870
|
+
* Use `"ComponentNode.addGestureVariant"` to check if this method is allowed.
|
|
2871
|
+
*
|
|
2872
|
+
* @alpha - This method requires using FramerPluginAPIAlpha
|
|
2873
|
+
*/
|
|
2874
|
+
addGestureVariant(nodeId: NodeId, type: "hover" | "pressed", attributes?: Partial<EditableFrameNodeAttributes>): Promise<FrameNode & IsComponentGestureVariant>;
|
|
2875
|
+
/**
|
|
2876
|
+
* Get the variables that belong to this component.
|
|
2877
|
+
*
|
|
2878
|
+
* @alpha
|
|
2879
|
+
*/
|
|
2880
|
+
getVariables(): Promise<ComponentVariable[]>;
|
|
2881
|
+
/**
|
|
2882
|
+
* Create new variables. Use `ComponentVariable.setAttributes` to update.
|
|
2883
|
+
*
|
|
2884
|
+
* Use `"ComponentNode.addVariables"` to check if this method is allowed.
|
|
2885
|
+
*
|
|
2886
|
+
* @alpha
|
|
2887
|
+
*/
|
|
2888
|
+
addVariables(variables: CreateVariable[]): Promise<ComponentVariable[]>;
|
|
2889
|
+
/**
|
|
2890
|
+
* Remove variables by their ID.
|
|
2891
|
+
*
|
|
2892
|
+
* Use `"ComponentNode.removeVariables"` to check if this method is allowed.
|
|
2893
|
+
*
|
|
2894
|
+
* @alpha
|
|
2895
|
+
*/
|
|
2896
|
+
removeVariables(variableIds: string[]): Promise<void>;
|
|
2897
|
+
/**
|
|
2898
|
+
* Arrange variables in a specific order.
|
|
2899
|
+
*
|
|
2900
|
+
* Use `"ComponentNode.setVariableOrder"` to check if this method is allowed.
|
|
2901
|
+
*
|
|
2902
|
+
* @alpha
|
|
2903
|
+
*/
|
|
2904
|
+
setVariableOrder(variableIds: string[]): Promise<void>;
|
|
2905
|
+
}
|
|
2906
|
+
type EditableVectorSetNodeAttributes = WithNameTrait;
|
|
2907
|
+
interface VectorSetNodeData extends CommonNodeData, Partial<WithNameTrait> {
|
|
2908
|
+
[classKey]: "VectorSetNode";
|
|
2909
|
+
}
|
|
2910
|
+
declare class VectorSetNode extends NodeMethods implements EditableVectorSetNodeAttributes {
|
|
2911
|
+
readonly [classKey]: VectorSetNodeData[ClassKey];
|
|
2912
|
+
readonly name: string | null;
|
|
2913
|
+
constructor(rawData: VectorSetNodeData, engine: PluginEngine);
|
|
2914
|
+
}
|
|
2915
|
+
type EditableDesignPageNodeAttributes = WithNameTrait;
|
|
2916
|
+
interface DesignPageNodeData extends CommonNodeData, Partial<WithNameTrait> {
|
|
2917
|
+
[classKey]: "DesignPageNode";
|
|
2918
|
+
}
|
|
2919
|
+
declare class DesignPageNode extends NodeMethods implements EditableDesignPageNodeAttributes {
|
|
2920
|
+
readonly [classKey]: DesignPageNodeData[ClassKey];
|
|
2921
|
+
readonly name: string | null;
|
|
2922
|
+
constructor(rawData: DesignPageNodeData, engine: PluginEngine);
|
|
2923
|
+
}
|
|
2924
|
+
interface UnknownNodeData extends CommonNodeData {
|
|
2925
|
+
[classKey]: "UnknownNode";
|
|
2926
|
+
}
|
|
2927
|
+
declare class UnknownNode extends NodeMethods {
|
|
2928
|
+
readonly [classKey]: UnknownNodeData[ClassKey];
|
|
2929
|
+
constructor(rawData: UnknownNodeData, engine: PluginEngine);
|
|
2930
|
+
}
|
|
2931
|
+
type CanvasRootNode = WebPageNode | DesignPageNode | ComponentNode | VectorSetNode | UnknownNode;
|
|
2932
|
+
type CanvasNode = FrameNode | TextNode | ComponentInstanceNode | SVGNode | VectorSetItemNode | UnknownNode;
|
|
2933
|
+
type SomeNodeData = FrameNodeData | TextNodeData | ComponentInstanceNodeData | SVGNodeData | DesignPageNodeData | WebPageNodeData | ComponentNodeData | VectorSetNodeData | VectorSetItemNodeData | UnknownNodeData;
|
|
2934
|
+
interface AnyNodeData extends Partial<AllTraits<TraitVariantData>>, WithReplicaInfoTrait {
|
|
2935
|
+
[classKey]: PluginNodeClass;
|
|
2936
|
+
}
|
|
2937
|
+
interface AnyEditableAttributes extends EditableFrameNodeAttributes, EditableTextNodeAttributes, EditableSVGNodeAttributes, EditableComponentInstanceNodeAttributes, EditableComponentNodeAttributes, EditableWebPageNodeAttributes, EditableDesignPageNodeAttributes {
|
|
2938
|
+
}
|
|
2939
|
+
type AnyNode = CanvasNode | CanvasRootNode;
|
|
2940
|
+
declare function isFrameNode(node: unknown): node is FrameNode;
|
|
2941
|
+
declare function isTextNode(node: unknown): node is TextNode;
|
|
2942
|
+
declare function isSVGNode(node: unknown): node is SVGNode;
|
|
2943
|
+
declare function isComponentInstanceNode(node: unknown): node is ComponentInstanceNode;
|
|
2944
|
+
declare function isWebPageNode(node: unknown): node is WebPageNode;
|
|
2945
|
+
declare function isComponentNode(node: unknown): node is ComponentNode;
|
|
2946
|
+
declare function isDesignPageNode(node: unknown): node is DesignPageNode;
|
|
2947
|
+
declare function isVectorSetNode(node: unknown): node is VectorSetNode;
|
|
2948
|
+
declare function isVectorSetItemNode(node: unknown): node is VectorSetItemNode;
|
|
2949
|
+
|
|
2950
|
+
/** @alpha */
|
|
2951
|
+
interface ComponentInstancePlaceholderData {
|
|
2952
|
+
id: string;
|
|
2953
|
+
width: number;
|
|
2954
|
+
height: number;
|
|
2955
|
+
title: string;
|
|
2956
|
+
codePreview: string | null;
|
|
2957
|
+
}
|
|
2958
|
+
/** @alpha */
|
|
2959
|
+
type ComponentInstancePlaceholderAttributes = Partial<Omit<ComponentInstancePlaceholderData, "id">>;
|
|
2960
|
+
/** @alpha */
|
|
2961
|
+
declare class ComponentInstancePlaceholder {
|
|
2962
|
+
#private;
|
|
2963
|
+
constructor(data: ComponentInstancePlaceholderData, engine: PluginEngine);
|
|
2964
|
+
get id(): string;
|
|
2965
|
+
get width(): number;
|
|
2966
|
+
get height(): number;
|
|
2967
|
+
get title(): string;
|
|
2968
|
+
get codePreview(): string | null;
|
|
2969
|
+
setAttributes(attributes: ComponentInstancePlaceholderAttributes): Promise<ComponentInstancePlaceholder | null>;
|
|
2970
|
+
remove(): Promise<void>;
|
|
2971
|
+
replaceWithComponentInstance(url: string, attributes?: Partial<EditableComponentInstanceNodeAttributes>): Promise<ComponentInstanceNode | null>;
|
|
2972
|
+
}
|
|
2973
|
+
|
|
2974
|
+
interface ApiVersion1User {
|
|
2975
|
+
name: string;
|
|
2976
|
+
/** Hashed user id */
|
|
2977
|
+
id: string;
|
|
2978
|
+
}
|
|
2979
|
+
interface User extends ApiVersion1User {
|
|
2980
|
+
/** Hashed user id served by API version 1, use for migration only */
|
|
2981
|
+
apiVersion1Id: string;
|
|
2982
|
+
avatarUrl?: string | undefined;
|
|
2983
|
+
/** For when there is no avatar. */
|
|
2984
|
+
initials: string;
|
|
2985
|
+
}
|
|
2986
|
+
|
|
2987
|
+
interface CodeExportCommon {
|
|
2988
|
+
name: string;
|
|
2989
|
+
isDefaultExport: boolean;
|
|
2990
|
+
}
|
|
2991
|
+
interface CodeFileComponentExport extends CodeExportCommon {
|
|
2992
|
+
insertURL: string;
|
|
2993
|
+
type: "component";
|
|
2994
|
+
}
|
|
2995
|
+
interface CodeFileOverrideExport extends CodeExportCommon {
|
|
2996
|
+
type: "override";
|
|
2997
|
+
}
|
|
2998
|
+
declare function isCodeFileComponentExport(exportItem: CodeFileExport): exportItem is CodeFileComponentExport;
|
|
2999
|
+
declare function isCodeFileOverrideExport(exportItem: CodeFileExport): exportItem is CodeFileOverrideExport;
|
|
3000
|
+
type CodeFileExport = CodeFileComponentExport | CodeFileOverrideExport;
|
|
3001
|
+
/** @alpha */
|
|
3002
|
+
type ShowProgressOnInstancesAttributes = Pick<ComponentInstancePlaceholderAttributes, "title" | "codePreview">;
|
|
3003
|
+
interface CodeFileData {
|
|
3004
|
+
id: string;
|
|
3005
|
+
name: string;
|
|
3006
|
+
path: string;
|
|
3007
|
+
content: string;
|
|
3008
|
+
exports: readonly CodeFileExport[];
|
|
3009
|
+
versionId: string;
|
|
3010
|
+
}
|
|
3011
|
+
interface CodeFileVersionData extends Pick<CodeFileData, "id" | "name"> {
|
|
3012
|
+
fileId: string;
|
|
3013
|
+
createdAt: string;
|
|
3014
|
+
createdBy: User;
|
|
3015
|
+
}
|
|
3016
|
+
declare class CodeFileVersion {
|
|
3017
|
+
#private;
|
|
3018
|
+
get id(): string;
|
|
3019
|
+
get name(): string;
|
|
3020
|
+
get createdAt(): string;
|
|
3021
|
+
get createdBy(): Readonly<User>;
|
|
3022
|
+
constructor(data: CodeFileVersionData, engine: PluginEngine);
|
|
3023
|
+
getContent(): Promise<string>;
|
|
3024
|
+
}
|
|
3025
|
+
declare class CodeFile implements Navigable {
|
|
3026
|
+
#private;
|
|
3027
|
+
get id(): string;
|
|
3028
|
+
get name(): string;
|
|
3029
|
+
get path(): string;
|
|
3030
|
+
get content(): string;
|
|
3031
|
+
get exports(): readonly CodeFileExport[];
|
|
3032
|
+
get versionId(): string;
|
|
3033
|
+
constructor(data: CodeFileData, engine: PluginEngine);
|
|
3034
|
+
/**
|
|
3035
|
+
* Set the content of this code file.
|
|
3036
|
+
*
|
|
3037
|
+
* Use `"CodeFile.setFileContent"` to check if this method is allowed.
|
|
3038
|
+
*/
|
|
3039
|
+
setFileContent(code: string): Promise<CodeFile>;
|
|
3040
|
+
/**
|
|
3041
|
+
* Rename this code file.
|
|
3042
|
+
*
|
|
3043
|
+
* Use `"CodeFile.rename"` to check if this method is allowed.
|
|
3044
|
+
*/
|
|
3045
|
+
rename(newName: string): Promise<CodeFile>;
|
|
3046
|
+
/**
|
|
3047
|
+
* Remove this code file.
|
|
3048
|
+
*
|
|
3049
|
+
* Use `"CodeFile.remove"` to check if this method is allowed.
|
|
3050
|
+
*/
|
|
3051
|
+
remove(): Promise<void>;
|
|
3052
|
+
/**
|
|
3053
|
+
* Get all versions of this code file.
|
|
3054
|
+
*/
|
|
3055
|
+
getVersions(): Promise<readonly CodeFileVersion[]>;
|
|
3056
|
+
/** @alpha */
|
|
3057
|
+
showProgressOnInstances(attributes?: ShowProgressOnInstancesAttributes): Promise<void>;
|
|
3058
|
+
/** @alpha */
|
|
3059
|
+
removeProgressFromInstances(): Promise<void>;
|
|
3060
|
+
lint(rules: LintConfig): Promise<LintDiagnostic[]>;
|
|
3061
|
+
typecheck(compilerOptions?: ts.server.protocol.CompilerOptions): Promise<TypecheckDiagnostic[]>;
|
|
3062
|
+
/**
|
|
3063
|
+
* Navigate to this code file. May switch modes to reveal the relevant view.
|
|
3064
|
+
*/
|
|
3065
|
+
navigateTo(): Promise<void>;
|
|
3066
|
+
}
|
|
3067
|
+
|
|
3068
|
+
type CustomCodeLocation = "headStart" | "headEnd" | "bodyStart" | "bodyEnd";
|
|
3069
|
+
interface SetCustomCodeOptions {
|
|
3070
|
+
html: string | null;
|
|
3071
|
+
location: CustomCodeLocation;
|
|
3072
|
+
}
|
|
3073
|
+
type CustomCode = Record<CustomCodeLocation, {
|
|
3074
|
+
disabled: boolean;
|
|
3075
|
+
html: string | null;
|
|
3076
|
+
}>;
|
|
3077
|
+
|
|
3078
|
+
interface WithOptionalName$1 {
|
|
3079
|
+
name?: string;
|
|
3080
|
+
}
|
|
3081
|
+
interface WithOptionalPreviewImage {
|
|
3082
|
+
previewImage?: string;
|
|
3083
|
+
}
|
|
3084
|
+
interface SvgDragData extends WithOptionalName$1, WithOptionalPreviewImage {
|
|
3085
|
+
type: "svg";
|
|
3086
|
+
svg: string;
|
|
3087
|
+
/** Inverts SVG drag preview in dark mode. Defaults to true. */
|
|
3088
|
+
invertInDarkMode?: boolean;
|
|
3089
|
+
}
|
|
3090
|
+
interface ImageDragData extends WithOptionalName$1, WithOptionalPreviewImage, ImageOptions {
|
|
3091
|
+
type: "image";
|
|
3092
|
+
image: string;
|
|
3093
|
+
}
|
|
3094
|
+
interface ComponentInstanceDragData extends WithOptionalName$1, WithOptionalPreviewImage {
|
|
3095
|
+
type: "componentInstance";
|
|
3096
|
+
url: string;
|
|
3097
|
+
attributes?: Partial<EditableComponentInstanceNodeAttributes>;
|
|
3098
|
+
}
|
|
3099
|
+
interface DetachedComponentLayersDragData extends WithOptionalName$1, WithOptionalPreviewImage {
|
|
3100
|
+
type: "detachedComponentLayers";
|
|
3101
|
+
url: string;
|
|
3102
|
+
layout?: boolean;
|
|
3103
|
+
attributes?: Partial<EditableComponentInstanceNodeAttributes>;
|
|
3104
|
+
}
|
|
3105
|
+
type DragData = SvgDragData | ImageDragData | ComponentInstanceDragData | DetachedComponentLayersDragData;
|
|
3106
|
+
interface Point {
|
|
3107
|
+
x: number;
|
|
3108
|
+
y: number;
|
|
3109
|
+
}
|
|
3110
|
+
interface Size$1 {
|
|
3111
|
+
width: number;
|
|
3112
|
+
height: number;
|
|
3113
|
+
}
|
|
3114
|
+
interface DragSessionId {
|
|
3115
|
+
dragSessionId: string;
|
|
3116
|
+
}
|
|
3117
|
+
type Rect = Point & Size$1;
|
|
3118
|
+
interface Mouse {
|
|
3119
|
+
mouse: Point;
|
|
3120
|
+
}
|
|
3121
|
+
interface ElementRect {
|
|
3122
|
+
elementRect: Rect;
|
|
3123
|
+
svgRect?: Rect;
|
|
3124
|
+
}
|
|
3125
|
+
type DragStartInfo = DragSessionId & ElementRect & Mouse;
|
|
3126
|
+
type DragInfo = DragSessionId & Mouse;
|
|
3127
|
+
type DragEndInfo = DragSessionId & {
|
|
3128
|
+
cancelled: boolean;
|
|
3129
|
+
};
|
|
3130
|
+
interface DragCompleteSuccess {
|
|
3131
|
+
/** Whether the drag was successful or not. */
|
|
3132
|
+
status: "success";
|
|
3133
|
+
/** The inserted node id. */
|
|
3134
|
+
nodeId: NodeId;
|
|
3135
|
+
}
|
|
3136
|
+
interface DragCompleteError {
|
|
3137
|
+
/** Whether the drag was successful or not. */
|
|
3138
|
+
status: "error";
|
|
3139
|
+
/** Reason for the error, if available. */
|
|
3140
|
+
reason?: string;
|
|
3141
|
+
}
|
|
3142
|
+
type DragCompleteResult = DragCompleteSuccess | DragCompleteError;
|
|
3143
|
+
type DragCompleteCallback = (result: DragCompleteResult) => void;
|
|
3144
|
+
|
|
3145
|
+
interface SeparatorMenuItem {
|
|
3146
|
+
type: "separator";
|
|
3147
|
+
}
|
|
3148
|
+
interface NormalMenuItem {
|
|
3149
|
+
type?: never;
|
|
3150
|
+
label: string;
|
|
3151
|
+
secondaryLabel?: string;
|
|
3152
|
+
enabled?: boolean;
|
|
3153
|
+
visible?: boolean;
|
|
3154
|
+
checked?: boolean;
|
|
3155
|
+
submenu?: MenuItem[];
|
|
3156
|
+
onAction?: () => void;
|
|
3157
|
+
}
|
|
3158
|
+
type MenuItem = NormalMenuItem | SeparatorMenuItem;
|
|
3159
|
+
type NormalMenuItemSerializable = Omit<NormalMenuItem, "onAction" | "submenu"> & {
|
|
3160
|
+
actionId?: number;
|
|
3161
|
+
submenu?: MenuItemSerializable[];
|
|
3162
|
+
};
|
|
3163
|
+
type MenuItemSerializable = NormalMenuItemSerializable | SeparatorMenuItem;
|
|
3164
|
+
type MenuPlacementVertical = "top" | "bottom";
|
|
3165
|
+
type MenuPlacementHorizontal = "left" | "right";
|
|
3166
|
+
type MenuPlacement = MenuPlacementVertical | MenuPlacementHorizontal | `${MenuPlacementVertical}-${MenuPlacementHorizontal}`;
|
|
3167
|
+
interface ContextMenuConfig {
|
|
3168
|
+
/**
|
|
3169
|
+
* Coordinates of the anchor point.
|
|
3170
|
+
*/
|
|
3171
|
+
location: {
|
|
3172
|
+
x: number;
|
|
3173
|
+
y: number;
|
|
3174
|
+
};
|
|
3175
|
+
/**
|
|
3176
|
+
* Placement of the menu relative to the anchor point.
|
|
3177
|
+
*/
|
|
3178
|
+
placement?: MenuPlacement;
|
|
3179
|
+
/**
|
|
3180
|
+
* Sets fixed width for the menu. If not set, the menu width is based on the content.
|
|
3181
|
+
*/
|
|
3182
|
+
width?: number;
|
|
3183
|
+
}
|
|
3184
|
+
|
|
3185
|
+
type Ownership = {
|
|
3186
|
+
type: "project";
|
|
3187
|
+
} | {
|
|
3188
|
+
type: "external";
|
|
3189
|
+
name: string;
|
|
3190
|
+
};
|
|
3191
|
+
interface VectorSetData {
|
|
3192
|
+
id: string;
|
|
3193
|
+
name: string;
|
|
3194
|
+
owner: Ownership;
|
|
3195
|
+
}
|
|
3196
|
+
interface VectorSetItemData {
|
|
3197
|
+
id: string;
|
|
3198
|
+
name: string;
|
|
3199
|
+
insertUrl: string;
|
|
3200
|
+
iconUrl: string;
|
|
3201
|
+
moduleId: string;
|
|
3202
|
+
}
|
|
3203
|
+
interface VectorSetItemVariable {
|
|
3204
|
+
type: "number" | "color";
|
|
3205
|
+
id: string;
|
|
3206
|
+
name: string;
|
|
3207
|
+
}
|
|
3208
|
+
declare class VectorSet {
|
|
3209
|
+
#private;
|
|
3210
|
+
id: string;
|
|
3211
|
+
name: string;
|
|
3212
|
+
owner: Ownership;
|
|
3213
|
+
constructor(data: VectorSetData, engine: PluginEngine);
|
|
3214
|
+
getItems(): Promise<VectorSetItem[]>;
|
|
3215
|
+
}
|
|
3216
|
+
declare class VectorSetItem {
|
|
3217
|
+
#private;
|
|
3218
|
+
id: string;
|
|
3219
|
+
name: string;
|
|
3220
|
+
insertUrl: string;
|
|
3221
|
+
iconUrl: string;
|
|
3222
|
+
constructor(data: VectorSetItemData, engine: PluginEngine);
|
|
3223
|
+
getVariables(): Promise<VectorSetItemVariable[]>;
|
|
3224
|
+
}
|
|
3225
|
+
|
|
3226
|
+
type PermissionMap = {
|
|
3227
|
+
[K in keyof PluginMessageAPI]: boolean;
|
|
3228
|
+
};
|
|
3229
|
+
type NamespaceMembers<Class, Namespace extends string, Parent = undefined> = {
|
|
3230
|
+
[Member in Exclude<keyof Class, keyof Parent> as Member extends string ? `${Namespace}.${Member}` : never]: Class[Member];
|
|
3231
|
+
};
|
|
3232
|
+
type AllMembers = Omit<FramerPluginAPIAlpha, "isAllowedTo" | "subscribeToIsAllowedTo"> & NamespaceMembers<ImageAsset, "ImageAsset"> & NamespaceMembers<CodeFile, "CodeFile"> & NamespaceMembers<CodeFileVersion, "CodeFileVersion"> & NamespaceMembers<ComponentInstancePlaceholder, "ComponentInstancePlaceholder"> & NamespaceMembers<Field, "Field"> & NamespaceMembers<BooleanField, "BooleanField", Field> & NamespaceMembers<ColorField, "ColorField", Field> & NamespaceMembers<NumberField, "NumberField", Field> & NamespaceMembers<StringField, "StringField", Field> & NamespaceMembers<FormattedTextField, "FormattedTextField", Field> & NamespaceMembers<ImageField, "ImageField", Field> & NamespaceMembers<LinkField, "LinkField", Field> & NamespaceMembers<DateField, "DateField", Field> & NamespaceMembers<FieldDivider, "FieldDivider", Field> & NamespaceMembers<UnsupportedField, "UnsupportedField", Field> & NamespaceMembers<FileField, "FileField", Field> & NamespaceMembers<EnumField, "EnumField", Field> & NamespaceMembers<CollectionReferenceField, "CollectionReferenceField", Field> & NamespaceMembers<MultiCollectionReferenceField, "MultiCollectionReferenceField", Field> & NamespaceMembers<ManagedCollection, "ManagedCollection"> & NamespaceMembers<Collection, "Collection"> & NamespaceMembers<CollectionItem, "CollectionItem"> & NamespaceMembers<NodeMethods, "Node"> & NamespaceMembers<FrameNode, "FrameNode", NodeMethods> & NamespaceMembers<TextNode, "TextNode", NodeMethods> & NamespaceMembers<SVGNode, "SVGNode", NodeMethods> & NamespaceMembers<ComponentInstanceNode, "ComponentInstanceNode", NodeMethods> & NamespaceMembers<WebPageNode, "WebPageNode", NodeMethods> & NamespaceMembers<ComponentNode, "ComponentNode", NodeMethods> & NamespaceMembers<UnknownNode, "UnknownNode", NodeMethods> & NamespaceMembers<ColorStyle, "ColorStyle"> & NamespaceMembers<TextStyle, "TextStyle"> & NamespaceMembers<Variable, "Variable"> & NamespaceMembers<BooleanVariable, "BooleanVariable", Variable> & NamespaceMembers<NumberVariable, "NumberVariable", Variable> & NamespaceMembers<StringVariable, "StringVariable", Variable> & NamespaceMembers<FormattedTextVariable, "FormattedTextVariable", Variable> & NamespaceMembers<EnumCase, "EnumCase"> & NamespaceMembers<EnumVariable, "EnumVariable", Variable> & NamespaceMembers<ColorVariable, "ColorVariable", Variable> & NamespaceMembers<ImageVariable, "ImageVariable", Variable> & NamespaceMembers<FileVariable, "FileVariable", Variable> & NamespaceMembers<LinkVariable, "LinkVariable", Variable> & NamespaceMembers<DateVariable, "DateVariable", Variable> & NamespaceMembers<BorderVariable, "BorderVariable", Variable> & NamespaceMembers<UnsupportedVariable, "UnsupportedVariable", Variable> & NamespaceMembers<VectorSet, "VectorSet"> & NamespaceMembers<VectorSetItem, "VectorSetItem">;
|
|
3233
|
+
declare const unprotectedMessageTypesSource: ["closeNotification", "closePlugin", "getActiveCollection", "getActiveLocale", "getActiveManagedCollection", "getCanvasRoot", "getChildren", "getCollection", "getCollectionFields", "getCollectionFields2", "getCollectionItems", "getCollectionItems2", "getCollections", "getColorStyle", "getColorStyles", "getCurrentUser", "getCurrentUser2", "getCustomCode", "getDefaultLocale", "getFont", "getFonts", "getImage", "getImageData", "getLocales", "getLocalizationGroups", "getManagedCollection", "getManagedCollectionFields", "getManagedCollectionFields2", "getManagedCollectionItemIds", "getManagedCollections", "getNode", "getNodesWithAttribute", "getNodesWithAttributeSet", "getNodesWithType", "getParent", "getPluginData", "getPluginDataForNode", "getPluginDataKeys", "getPluginDataKeysForNode", "getProjectInfo", "getProjectInfo2", "getPublishInfo", "getRect", "getSelection", "getSVGForNode", "getText", "getTextForNode", "getTextStyle", "getTextStyles", "hideUI", "notify", "onPointerDown", "setActiveCollection", "setSelection", "showUI", "getCodeFileVersionContent", "lintCode", "typecheckCode", "getCodeFileVersions", "getCodeFiles", "getCodeFile", "getRedirects", "uploadFile", "uploadFiles", "uploadImage", "uploadImages", "zoomIntoView", "navigateTo", "getRuntimeErrorForModule", "getRuntimeErrorForCodeComponentNode", "showProgressOnInstances", "removeProgressFromInstances", "addComponentInstancePlaceholder", "updateComponentInstancePlaceholder", "removeComponentInstancePlaceholder", "setMenu", "showContextMenu", "getBreakpointSuggestionsForWebPage", "getActiveCollectionItemForWebPage", "getVariables", "getVectorSets", "getVectorSetItems", "getVectorSetItemVariables", "getChangedPagePaths", "getChangeAuthors", "INTERNAL_getAiServiceInfo", "INTERNAL_sendTrackingEvent", "INTERNAL_getHTMLForNode", "getAiServiceInfo", "sendTrackingEvent", "unstable_getCodeFile", "unstable_getCodeFiles", "unstable_getCodeFileVersionContent", "unstable_getCodeFileLint2", "unstable_getCodeFileTypecheck2", "unstable_getCodeFileVersions"];
|
|
3234
|
+
type UnprotectedMessageType = (typeof unprotectedMessageTypesSource)[number];
|
|
3235
|
+
type ProtectedMessageType = Exclude<keyof PluginMessageAPI, UnprotectedMessageType>;
|
|
3236
|
+
type Method = keyof {
|
|
3237
|
+
[K in keyof AllMembers as AllMembers[K] extends (...args: any) => unknown ? K : never]: string;
|
|
3238
|
+
};
|
|
3239
|
+
declare const methodToMessageTypes: {
|
|
3240
|
+
readonly addComponentInstance: ["addComponentInstance"];
|
|
3241
|
+
/** @alpha */
|
|
3242
|
+
readonly addComponentInstancePlaceholder: [];
|
|
3243
|
+
readonly addDetachedComponentLayers: ["addDetachedComponentLayers"];
|
|
3244
|
+
readonly addImage: ["addImage"];
|
|
3245
|
+
readonly addImages: ["addImages"];
|
|
3246
|
+
readonly addSVG: ["addSVG"];
|
|
3247
|
+
readonly addText: ["addText"];
|
|
3248
|
+
readonly addRedirects: ["addRedirects"];
|
|
3249
|
+
readonly getRedirects: [];
|
|
3250
|
+
readonly removeRedirects: ["removeRedirects"];
|
|
3251
|
+
readonly setRedirectOrder: ["setRedirectOrder"];
|
|
3252
|
+
readonly subscribeToRedirects: [];
|
|
3253
|
+
readonly cloneNode: ["cloneNode"];
|
|
3254
|
+
readonly closePlugin: [];
|
|
3255
|
+
readonly createColorStyle: ["createColorStyle"];
|
|
3256
|
+
readonly createFrameNode: ["createNode"];
|
|
3257
|
+
readonly createTextNode: ["createNode"];
|
|
3258
|
+
readonly createComponentNode: ["createNode"];
|
|
3259
|
+
readonly createTextStyle: ["createTextStyle"];
|
|
3260
|
+
readonly createDesignPage: ["createDesignPage"];
|
|
3261
|
+
readonly createWebPage: ["createWebPage"];
|
|
3262
|
+
readonly getActiveCollection: [];
|
|
3263
|
+
readonly getActiveLocale: [];
|
|
3264
|
+
readonly getActiveManagedCollection: [];
|
|
3265
|
+
readonly getCanvasRoot: [];
|
|
3266
|
+
readonly getChildren: [];
|
|
3267
|
+
readonly getCollection: [];
|
|
3268
|
+
readonly getCollections: [];
|
|
3269
|
+
readonly getColorStyle: [];
|
|
3270
|
+
readonly getColorStyles: [];
|
|
3271
|
+
readonly getCurrentUser: [];
|
|
3272
|
+
readonly getCustomCode: [];
|
|
3273
|
+
readonly getDefaultLocale: [];
|
|
3274
|
+
readonly getFont: [];
|
|
3275
|
+
readonly getFonts: [];
|
|
3276
|
+
readonly getImage: [];
|
|
3277
|
+
readonly getLocales: [];
|
|
3278
|
+
readonly getLocalizationGroups: [];
|
|
3279
|
+
readonly getManagedCollection: [];
|
|
3280
|
+
readonly getManagedCollections: [];
|
|
3281
|
+
readonly getNode: [];
|
|
3282
|
+
readonly getNodesWithAttribute: [];
|
|
3283
|
+
readonly getNodesWithAttributeSet: [];
|
|
3284
|
+
readonly getNodesWithType: [];
|
|
3285
|
+
readonly getParent: [];
|
|
3286
|
+
readonly getPluginData: [];
|
|
3287
|
+
readonly getPluginDataKeys: [];
|
|
3288
|
+
readonly getProjectInfo: [];
|
|
3289
|
+
readonly getPublishInfo: [];
|
|
3290
|
+
readonly getRect: [];
|
|
3291
|
+
readonly getSelection: [];
|
|
3292
|
+
readonly getText: [];
|
|
3293
|
+
readonly getTextStyle: [];
|
|
3294
|
+
readonly getTextStyles: [];
|
|
3295
|
+
readonly hideUI: [];
|
|
3296
|
+
/** @beta */
|
|
3297
|
+
readonly lintCode: [];
|
|
3298
|
+
readonly makeDraggable: ["onDragEnd", "onDragStart", "onDrag", "setDragData", "preloadDetachedComponentLayers", "preloadImageUrlForInsertion", "preloadDragPreviewImage"];
|
|
3299
|
+
readonly notify: [];
|
|
3300
|
+
readonly preloadDetachedComponentLayers: ["preloadDetachedComponentLayers"];
|
|
3301
|
+
readonly preloadDragPreviewImage: ["preloadDragPreviewImage"];
|
|
3302
|
+
readonly preloadImageUrlForInsertion: ["preloadImageUrlForInsertion"];
|
|
3303
|
+
readonly removeNode: ["removeNodes2"];
|
|
3304
|
+
readonly removeNodes: ["removeNodes2"];
|
|
3305
|
+
readonly setAttributes: ["setAttributes"];
|
|
3306
|
+
readonly setCustomCode: ["setCustomCode"];
|
|
3307
|
+
readonly setImage: ["setImage"];
|
|
3308
|
+
readonly setLocalizationData: ["setLocalizationData"];
|
|
3309
|
+
readonly setMenu: [];
|
|
3310
|
+
readonly showContextMenu: [];
|
|
3311
|
+
readonly setParent: ["setParent"];
|
|
3312
|
+
readonly setPluginData: ["setPluginData"];
|
|
3313
|
+
readonly setSelection: [];
|
|
3314
|
+
readonly setText: ["setText"];
|
|
3315
|
+
/** @beta */
|
|
3316
|
+
readonly typecheckCode: [];
|
|
3317
|
+
readonly showUI: [];
|
|
3318
|
+
readonly subscribeToCanvasRoot: [];
|
|
3319
|
+
readonly subscribeToColorStyles: [];
|
|
3320
|
+
readonly subscribeToCustomCode: [];
|
|
3321
|
+
readonly subscribeToImage: [];
|
|
3322
|
+
readonly subscribeToPublishInfo: [];
|
|
3323
|
+
readonly subscribeToSelection: [];
|
|
3324
|
+
readonly subscribeToText: [];
|
|
3325
|
+
readonly subscribeToTextStyles: [];
|
|
3326
|
+
readonly createCodeFile: ["createCodeFile"];
|
|
3327
|
+
readonly unstable_ensureMinimumDependencyVersion: ["unstable_ensureMinimumDependencyVersion"];
|
|
3328
|
+
readonly getCodeFiles: [];
|
|
3329
|
+
readonly getCodeFile: [];
|
|
3330
|
+
readonly subscribeToCodeFiles: [];
|
|
3331
|
+
readonly subscribeToOpenCodeFile: [];
|
|
3332
|
+
readonly uploadFile: [];
|
|
3333
|
+
readonly uploadFiles: [];
|
|
3334
|
+
readonly uploadImage: [];
|
|
3335
|
+
readonly uploadImages: [];
|
|
3336
|
+
readonly zoomIntoView: [];
|
|
3337
|
+
readonly navigateTo: [];
|
|
3338
|
+
readonly getVectorSets: [];
|
|
3339
|
+
readonly "VectorSet.getItems": [];
|
|
3340
|
+
readonly "VectorSetItem.getVariables": [];
|
|
3341
|
+
readonly "Node.navigateTo": [];
|
|
3342
|
+
readonly "CodeFile.navigateTo": [];
|
|
3343
|
+
readonly "Collection.navigateTo": [];
|
|
3344
|
+
readonly "ManagedCollection.navigateTo": [];
|
|
3345
|
+
readonly "CollectionItem.navigateTo": [];
|
|
3346
|
+
readonly "ComponentInstanceNode.getRuntimeError": [];
|
|
3347
|
+
readonly "ImageAsset.cloneWithAttributes": [];
|
|
3348
|
+
readonly "ImageAsset.getData": [];
|
|
3349
|
+
readonly "ImageAsset.loadBitmap": [];
|
|
3350
|
+
readonly "ImageAsset.loadImage": [];
|
|
3351
|
+
readonly "ImageAsset.measure": [];
|
|
3352
|
+
readonly "CodeFile.remove": ["removeCodeFile"];
|
|
3353
|
+
readonly "CodeFile.rename": ["renameCodeFile"];
|
|
3354
|
+
readonly "CodeFile.setFileContent": ["setCodeFileContent"];
|
|
3355
|
+
readonly "CodeFile.getVersions": [];
|
|
3356
|
+
/** @alpha */
|
|
3357
|
+
readonly "CodeFile.showProgressOnInstances": [];
|
|
3358
|
+
/** @alpha */
|
|
3359
|
+
readonly "CodeFile.removeProgressFromInstances": [];
|
|
3360
|
+
readonly "CodeFile.lint": [];
|
|
3361
|
+
readonly "CodeFile.typecheck": [];
|
|
3362
|
+
readonly "CodeFileVersion.getContent": [];
|
|
3363
|
+
/** @alpha */
|
|
3364
|
+
readonly "ComponentInstancePlaceholder.setAttributes": [];
|
|
3365
|
+
/** @alpha */
|
|
3366
|
+
readonly "ComponentInstancePlaceholder.remove": [];
|
|
3367
|
+
/** @alpha */
|
|
3368
|
+
readonly "ComponentInstancePlaceholder.replaceWithComponentInstance": ["replaceComponentInstancePlaceholderWithComponentInstance"];
|
|
3369
|
+
readonly "Field.remove": ["removeCollectionFields"];
|
|
3370
|
+
readonly "Field.setAttributes": ["addCollectionFields"];
|
|
3371
|
+
readonly "EnumField.addCase": ["addEnumCase"];
|
|
3372
|
+
readonly "EnumField.setCaseOrder": ["setEnumCaseOrder"];
|
|
3373
|
+
readonly "Collection.addFields": ["addCollectionFields"];
|
|
3374
|
+
readonly "Collection.addItems": ["addCollectionItems2"];
|
|
3375
|
+
readonly "Collection.getFields": [];
|
|
3376
|
+
readonly "Collection.getItems": [];
|
|
3377
|
+
readonly "Collection.getPluginData": [];
|
|
3378
|
+
readonly "Collection.getPluginDataKeys": [];
|
|
3379
|
+
readonly "Collection.removeFields": ["removeCollectionFields"];
|
|
3380
|
+
readonly "Collection.removeItems": ["removeCollectionItems"];
|
|
3381
|
+
readonly "Collection.setAsActive": [];
|
|
3382
|
+
readonly "Collection.setFieldOrder": ["setCollectionFieldOrder"];
|
|
3383
|
+
readonly "Collection.setItemOrder": ["setCollectionItemOrder"];
|
|
3384
|
+
readonly "Collection.setPluginData": ["setPluginDataForNode"];
|
|
3385
|
+
readonly "CollectionItem.getPluginData": [];
|
|
3386
|
+
readonly "CollectionItem.getPluginDataKeys": [];
|
|
3387
|
+
readonly "CollectionItem.remove": ["removeCollectionItems"];
|
|
3388
|
+
readonly "CollectionItem.setAttributes": ["setCollectionItemAttributes2"];
|
|
3389
|
+
readonly "CollectionItem.setPluginData": ["setPluginDataForNode"];
|
|
3390
|
+
readonly "ManagedCollection.addItems": ["addManagedCollectionItems2"];
|
|
3391
|
+
readonly "ManagedCollection.getFields": [];
|
|
3392
|
+
readonly "ManagedCollection.getItemIds": [];
|
|
3393
|
+
readonly "ManagedCollection.getPluginData": [];
|
|
3394
|
+
readonly "ManagedCollection.getPluginDataKeys": [];
|
|
3395
|
+
readonly "ManagedCollection.removeItems": ["removeManagedCollectionItems"];
|
|
3396
|
+
readonly "ManagedCollection.setAsActive": [];
|
|
3397
|
+
readonly "ManagedCollection.setFields": ["setManagedCollectionFields"];
|
|
3398
|
+
readonly "ManagedCollection.setItemOrder": ["setManagedCollectionItemOrder"];
|
|
3399
|
+
readonly "ManagedCollection.setPluginData": ["setPluginDataForNode"];
|
|
3400
|
+
readonly "Node.clone": ["cloneNode"];
|
|
3401
|
+
readonly "Node.getChildren": [];
|
|
3402
|
+
readonly "Node.getNodesWithAttribute": [];
|
|
3403
|
+
readonly "Node.getNodesWithAttributeSet": [];
|
|
3404
|
+
readonly "Node.getNodesWithType": [];
|
|
3405
|
+
readonly "Node.getParent": [];
|
|
3406
|
+
readonly "Node.getPluginData": [];
|
|
3407
|
+
readonly "Node.getPluginDataKeys": [];
|
|
3408
|
+
readonly "Node.getRect": [];
|
|
3409
|
+
readonly "Node.remove": ["removeNodes2"];
|
|
3410
|
+
readonly "Node.select": [];
|
|
3411
|
+
readonly "Node.setAttributes": ["setAttributes"];
|
|
3412
|
+
readonly "Node.setPluginData": ["setPluginDataForNode"];
|
|
3413
|
+
readonly "Node.walk": [];
|
|
3414
|
+
readonly "Node.zoomIntoView": [];
|
|
3415
|
+
readonly "TextNode.getText": [];
|
|
3416
|
+
readonly "TextNode.setText": ["setTextForNode"];
|
|
3417
|
+
readonly "TextNode.setHTML": ["INTERNAL_setHTMLForNode"];
|
|
3418
|
+
readonly "TextNode.getHTML": [];
|
|
3419
|
+
/** @alpha */
|
|
3420
|
+
readonly "ComponentNode.addVariant": ["addVariantToComponent"];
|
|
3421
|
+
/** @alpha */
|
|
3422
|
+
readonly "ComponentNode.addGestureVariant": ["addGestureVariantToComponent"];
|
|
3423
|
+
/** @alpha */
|
|
3424
|
+
readonly "ComponentNode.getVariables": [];
|
|
3425
|
+
/** @alpha */
|
|
3426
|
+
readonly "ComponentNode.addVariables": ["addVariables"];
|
|
3427
|
+
/** @alpha */
|
|
3428
|
+
readonly "ComponentNode.removeVariables": ["removeVariables"];
|
|
3429
|
+
readonly "WebPageNode.getBreakpointSuggestions": [];
|
|
3430
|
+
readonly "WebPageNode.addBreakpoint": ["addBreakpointToWebPage"];
|
|
3431
|
+
/** @alpha */
|
|
3432
|
+
readonly "WebPageNode.getActiveCollectionItem": [];
|
|
3433
|
+
readonly "ColorStyle.getPluginData": [];
|
|
3434
|
+
readonly "ColorStyle.getPluginDataKeys": [];
|
|
3435
|
+
readonly "ColorStyle.remove": ["removeColorStyle"];
|
|
3436
|
+
readonly "ColorStyle.setAttributes": ["setColorStyleAttributes"];
|
|
3437
|
+
readonly "ColorStyle.setPluginData": ["setPluginDataForNode"];
|
|
3438
|
+
readonly "TextStyle.getPluginData": [];
|
|
3439
|
+
readonly "TextStyle.getPluginDataKeys": [];
|
|
3440
|
+
readonly "TextStyle.remove": ["removeTextStyle"];
|
|
3441
|
+
readonly "TextStyle.setAttributes": ["setTextStyleAttributes"];
|
|
3442
|
+
readonly "TextStyle.setPluginData": ["setPluginDataForNode"];
|
|
3443
|
+
/** @alpha */
|
|
3444
|
+
readonly "Variable.setAttributes": ["updateVariable"];
|
|
3445
|
+
/** @alpha */
|
|
3446
|
+
readonly "Variable.remove": ["removeVariables"];
|
|
3447
|
+
/** @alpha */
|
|
3448
|
+
readonly "ComponentNode.setVariableOrder": ["setVariableOrder"];
|
|
3449
|
+
readonly "EnumCase.remove": ["removeEnumCase"];
|
|
3450
|
+
readonly "EnumCase.setAttributes": ["updateEnumCase"];
|
|
3451
|
+
/** @alpha */
|
|
3452
|
+
readonly "EnumVariable.addCase": ["addEnumCase"];
|
|
3453
|
+
/** @alpha */
|
|
3454
|
+
readonly "EnumVariable.setCaseOrder": ["setEnumCaseOrder"];
|
|
3455
|
+
/** @alpha */
|
|
3456
|
+
readonly publish: ["publish"];
|
|
3457
|
+
/** @alpha */
|
|
3458
|
+
readonly getChangedPagePaths: [];
|
|
3459
|
+
/** @alpha */
|
|
3460
|
+
readonly getChangeAuthors: [];
|
|
3461
|
+
/** @alpha */
|
|
3462
|
+
readonly createManagedCollection: ["createManagedCollection"];
|
|
3463
|
+
readonly [getAiServiceInfo]: [];
|
|
3464
|
+
readonly [sendTrackingEvent]: [];
|
|
3465
|
+
readonly [getHTMLForNode]: [];
|
|
3466
|
+
readonly [setHTMLForNode]: [];
|
|
3467
|
+
};
|
|
3468
|
+
type ProtectedMethod = keyof {
|
|
3469
|
+
[K in Method as (typeof methodToMessageTypes)[K] extends [] ? never : K]: (typeof methodToMessageTypes)[K];
|
|
3470
|
+
};
|
|
3471
|
+
type PerMethodPermissionMap = {
|
|
3472
|
+
[K in ProtectedMethod]: boolean;
|
|
3473
|
+
};
|
|
3474
|
+
|
|
3475
|
+
type OptimizationStatus = "optimizing" | "optimized" | "error";
|
|
3476
|
+
interface Publish {
|
|
3477
|
+
deploymentTime: number;
|
|
3478
|
+
optimizationStatus: OptimizationStatus;
|
|
3479
|
+
url: string;
|
|
3480
|
+
currentPageUrl: string;
|
|
3481
|
+
}
|
|
3482
|
+
interface PublishInfo {
|
|
3483
|
+
production: Publish | null;
|
|
3484
|
+
staging: Publish | null;
|
|
3485
|
+
}
|
|
3486
|
+
|
|
3487
|
+
interface RedirectAttributes {
|
|
3488
|
+
/** The source path to redirect from */
|
|
3489
|
+
from: string;
|
|
3490
|
+
/** Whether to expand the redirect to all locales */
|
|
3491
|
+
expandToAllLocales: boolean;
|
|
3492
|
+
}
|
|
3493
|
+
interface WithToField {
|
|
3494
|
+
/** The destination path to redirect to */
|
|
3495
|
+
to: string;
|
|
3496
|
+
}
|
|
3497
|
+
interface WithNullableToField {
|
|
3498
|
+
/** The destination path to redirect to. If the page was removed and the redirect is no longer valid, the value
|
|
3499
|
+
* will be set to null */
|
|
3500
|
+
to: string | null;
|
|
3501
|
+
}
|
|
3502
|
+
interface RedirectData extends RedirectAttributes, WithNullableToField {
|
|
3503
|
+
/** The id of the redirect */
|
|
3504
|
+
id: string;
|
|
3505
|
+
}
|
|
3506
|
+
interface CreateRedirect extends RedirectAttributes, WithToField {
|
|
3507
|
+
/** The id of the redirect, if provided, the redirect will be updated, otherwise a new redirect will be created */
|
|
3508
|
+
id?: never;
|
|
3509
|
+
}
|
|
3510
|
+
interface UpdateRedirect extends Partial<RedirectAttributes>, Partial<WithToField> {
|
|
3511
|
+
/** The id of the redirect, if provided, the redirect will be updated, otherwise a new redirect will be created */
|
|
3512
|
+
id: string;
|
|
3513
|
+
}
|
|
3514
|
+
type RedirectInput = Prettify<CreateRedirect | UpdateRedirect>;
|
|
3515
|
+
declare class Redirect {
|
|
3516
|
+
#private;
|
|
3517
|
+
/** The id of the redirect. */
|
|
3518
|
+
get id(): string;
|
|
3519
|
+
/** The source path to redirect from. */
|
|
3520
|
+
get from(): string;
|
|
3521
|
+
/** The destination path to redirect to. */
|
|
3522
|
+
get to(): string | null;
|
|
3523
|
+
/** Whether to expand the redirect to all locales. */
|
|
3524
|
+
get expandToAllLocales(): boolean;
|
|
3525
|
+
constructor(data: RedirectData, engine: PluginEngine);
|
|
3526
|
+
/**
|
|
3527
|
+
* Remove the redirect.
|
|
3528
|
+
*/
|
|
3529
|
+
remove(): Promise<void>;
|
|
3530
|
+
/**
|
|
3531
|
+
* Update the redirect attributes.
|
|
3532
|
+
*
|
|
3533
|
+
* @returns The updated redirect, or `null` if the redirect was not found.
|
|
3534
|
+
*/
|
|
3535
|
+
setAttributes(attributes: Partial<CreateRedirect>): Promise<Redirect | null>;
|
|
3536
|
+
}
|
|
3537
|
+
|
|
3538
|
+
type ThemeMode = "light" | "dark";
|
|
3539
|
+
interface ThemeTokens {
|
|
3540
|
+
"--framer-color-tint": string;
|
|
3541
|
+
"--framer-color-tint-dimmed": string;
|
|
3542
|
+
"--framer-color-tint-dark": string;
|
|
3543
|
+
"--framer-color-text": string;
|
|
3544
|
+
"--framer-color-text-secondary": string;
|
|
3545
|
+
"--framer-color-text-tertiary": string;
|
|
3546
|
+
"--framer-color-text-reversed": string;
|
|
3547
|
+
"--framer-color-bg": string;
|
|
3548
|
+
"--framer-color-bg-secondary": string;
|
|
3549
|
+
"--framer-color-bg-tertiary": string;
|
|
3550
|
+
"--framer-color-divider": string;
|
|
3551
|
+
"--framer-color-tint-extra-dark": string;
|
|
3552
|
+
}
|
|
3553
|
+
interface Theme {
|
|
3554
|
+
mode: ThemeMode;
|
|
3555
|
+
tokens: ThemeTokens;
|
|
3556
|
+
}
|
|
3557
|
+
|
|
3558
|
+
type PluginMessageId = number;
|
|
3559
|
+
declare const allModesRecord: {
|
|
3560
|
+
readonly canvas: true;
|
|
3561
|
+
readonly image: true;
|
|
3562
|
+
readonly editImage: true;
|
|
3563
|
+
readonly configureManagedCollection: true;
|
|
3564
|
+
readonly syncManagedCollection: true;
|
|
3565
|
+
readonly collection: true;
|
|
3566
|
+
readonly localization: true;
|
|
3567
|
+
readonly code: true;
|
|
3568
|
+
readonly api: true;
|
|
3569
|
+
};
|
|
3570
|
+
type Mode = keyof typeof allModesRecord;
|
|
3571
|
+
declare const typeKey = "type";
|
|
3572
|
+
type TypeKey = typeof typeKey;
|
|
3573
|
+
interface PluginMethodInvocation {
|
|
3574
|
+
[typeKey]: "methodInvocation";
|
|
3575
|
+
methodName: keyof PluginMessageAPI;
|
|
3576
|
+
id: PluginMessageId;
|
|
3577
|
+
args: unknown[];
|
|
3578
|
+
}
|
|
3579
|
+
interface PluginSubscribe {
|
|
3580
|
+
[typeKey]: "subscribe";
|
|
3581
|
+
topic: PluginSubscriptionTopic;
|
|
3582
|
+
}
|
|
3583
|
+
interface PluginUnsubscribe {
|
|
3584
|
+
[typeKey]: "unsubscribe";
|
|
3585
|
+
topic: PluginSubscriptionTopic;
|
|
3586
|
+
}
|
|
3587
|
+
interface PluginSubscription {
|
|
3588
|
+
[typeKey]: PluginSubscribe[TypeKey] | PluginUnsubscribe[TypeKey];
|
|
3589
|
+
topic: PluginSubscriptionTopic;
|
|
3590
|
+
}
|
|
3591
|
+
declare const readySignal: {
|
|
3592
|
+
readonly type: "pluginReadySignal";
|
|
3593
|
+
};
|
|
3594
|
+
type PluginReadySignal = typeof readySignal;
|
|
3595
|
+
type ReleaseChannel = "alpha" | "beta" | "stable";
|
|
3596
|
+
interface EnvironmentInfo {
|
|
3597
|
+
releaseChannel: ReleaseChannel | null;
|
|
3598
|
+
isEmployee: boolean;
|
|
3599
|
+
}
|
|
3600
|
+
interface PluginSubscriptionBase {
|
|
3601
|
+
[typeKey]: "subscriptionMessage";
|
|
3602
|
+
payload: unknown;
|
|
3603
|
+
}
|
|
3604
|
+
interface PluginSubscriptionPublishInfo extends PluginSubscriptionBase {
|
|
3605
|
+
topic: "publishInfo";
|
|
3606
|
+
payload: PublishInfo;
|
|
3607
|
+
}
|
|
3608
|
+
interface PluginSubscriptionSelection extends PluginSubscriptionBase {
|
|
3609
|
+
topic: "selection";
|
|
3610
|
+
payload: SomeNodeData[];
|
|
3611
|
+
}
|
|
3612
|
+
interface PluginSubscriptionCanvasRoot extends PluginSubscriptionBase {
|
|
3613
|
+
topic: "canvasRoot";
|
|
3614
|
+
payload: SomeNodeData;
|
|
3615
|
+
}
|
|
3616
|
+
interface PluginSubscriptionImage extends PluginSubscriptionBase {
|
|
3617
|
+
topic: "image";
|
|
3618
|
+
payload: ImageAssetData | null;
|
|
3619
|
+
}
|
|
3620
|
+
interface PluginSubscriptionText extends PluginSubscriptionBase {
|
|
3621
|
+
topic: "text";
|
|
3622
|
+
payload: string | null;
|
|
3623
|
+
}
|
|
3624
|
+
interface PluginSubscriptionCustomHTML extends PluginSubscriptionBase {
|
|
3625
|
+
topic: "customCode";
|
|
3626
|
+
payload: CustomCode;
|
|
3627
|
+
}
|
|
3628
|
+
interface PluginSubscriptionTheme extends PluginSubscriptionBase {
|
|
3629
|
+
topic: "theme";
|
|
3630
|
+
payload: Theme;
|
|
3631
|
+
}
|
|
3632
|
+
interface PluginSubscriptionColorStyle extends PluginSubscriptionBase {
|
|
3633
|
+
topic: "colorStyles";
|
|
3634
|
+
payload: ColorStyleData[];
|
|
3635
|
+
}
|
|
3636
|
+
interface PluginSubscriptionTextStyle extends PluginSubscriptionBase {
|
|
3637
|
+
topic: "textStyles";
|
|
3638
|
+
payload: TextStyleData[];
|
|
3639
|
+
}
|
|
3640
|
+
/** @alpha */
|
|
3641
|
+
interface PluginSubscriptionRedirects extends PluginSubscriptionBase {
|
|
3642
|
+
topic: "redirects";
|
|
3643
|
+
payload: RedirectData[];
|
|
3644
|
+
}
|
|
3645
|
+
interface PluginSubscriptionCodeFiles extends PluginSubscriptionBase {
|
|
3646
|
+
topic: "codeFiles";
|
|
3647
|
+
payload: readonly CodeFileData[];
|
|
3648
|
+
}
|
|
3649
|
+
/** @alpha */
|
|
3650
|
+
interface PluginSubscriptionOpenCodeFile extends PluginSubscriptionBase {
|
|
3651
|
+
topic: "openCodeFile";
|
|
3652
|
+
payload: CodeFileData | null;
|
|
3653
|
+
}
|
|
3654
|
+
type PluginSubscriptionEvent = PluginSubscriptionPublishInfo | PluginSubscriptionSelection | PluginSubscriptionCanvasRoot | PluginSubscriptionImage | PluginSubscriptionTheme | PluginSubscriptionText | PluginSubscriptionCustomHTML | PluginSubscriptionColorStyle | PluginSubscriptionTextStyle | /** @alpha */ PluginSubscriptionRedirects | PluginSubscriptionCodeFiles | /** @alpha */ PluginSubscriptionOpenCodeFile;
|
|
3655
|
+
type PluginSubscriptionTopic = PluginSubscriptionEvent["topic"];
|
|
3656
|
+
type PluginToVekterMessage = PluginMethodInvocation | PluginSubscription | PluginReadySignal;
|
|
3657
|
+
|
|
3658
|
+
type NotificationVariant = "info" | "success" | "error" | "warning";
|
|
3659
|
+
interface NotifyOptionsBase {
|
|
3660
|
+
/** The Notification variant for styling of the notification. Defaults to "info" */
|
|
3661
|
+
variant?: NotificationVariant;
|
|
3662
|
+
durationMs?: number;
|
|
3663
|
+
}
|
|
3664
|
+
interface NotifyOptions extends NotifyOptionsBase {
|
|
3665
|
+
/** A button to be displayed on the notification */
|
|
3666
|
+
button?: {
|
|
3667
|
+
/** The text of the button */
|
|
3668
|
+
text: string;
|
|
3669
|
+
/** Click handler when the button is pressed */
|
|
3670
|
+
onClick: () => void;
|
|
3671
|
+
};
|
|
3672
|
+
/** A function that is called when the notification disappears */
|
|
3673
|
+
onDisappear?: VoidFunction;
|
|
3674
|
+
}
|
|
3675
|
+
interface NotifyOptionsData extends NotifyOptionsBase {
|
|
3676
|
+
buttonText?: string;
|
|
3677
|
+
notificationId: string;
|
|
3678
|
+
}
|
|
3679
|
+
interface Notification {
|
|
3680
|
+
close: () => Promise<void>;
|
|
3681
|
+
}
|
|
3682
|
+
type NotificationCloseReason = "timeoutReachedOrDismissed" | "actionButtonClicked";
|
|
3683
|
+
type Notify = (message: string, options?: NotifyOptions) => Notification;
|
|
3684
|
+
|
|
3685
|
+
/**
|
|
3686
|
+
* Options for the `navigateTo` method.
|
|
3687
|
+
*/
|
|
3688
|
+
interface NavigableOptions {
|
|
3689
|
+
/**
|
|
3690
|
+
* Selects the item after navigation (e.g., opens the editor for a CollectionItem or selects it on the canvas).
|
|
3691
|
+
* @default true
|
|
3692
|
+
*/
|
|
3693
|
+
select?: boolean | undefined;
|
|
3694
|
+
/**
|
|
3695
|
+
* Zooms and centers the item after scrolling it into view (only applicable to canvas nodes).
|
|
3696
|
+
* @default true
|
|
3697
|
+
*/
|
|
3698
|
+
zoomIntoView?: boolean | ZoomIntoViewOptions | undefined;
|
|
3699
|
+
/**
|
|
3700
|
+
* Scrolls to and highlights a specific part of the content.
|
|
3701
|
+
*/
|
|
3702
|
+
scrollTo?: NavigableScrollToOptions | undefined;
|
|
3703
|
+
}
|
|
3704
|
+
interface NavigableScrollToOptions {
|
|
3705
|
+
collectionFieldId?: string;
|
|
3706
|
+
codeFilePosition?: CodeFilePosition;
|
|
3707
|
+
}
|
|
3708
|
+
interface CodeFilePosition {
|
|
3709
|
+
/** Start line number (1-based) */
|
|
3710
|
+
startLine: number;
|
|
3711
|
+
/** Start column number (1-based) */
|
|
3712
|
+
startColumn?: number;
|
|
3713
|
+
/** End line number (1-based) */
|
|
3714
|
+
endLine?: number;
|
|
3715
|
+
/** End column number (1-based) */
|
|
3716
|
+
endColumn?: number;
|
|
3717
|
+
}
|
|
3718
|
+
/**
|
|
3719
|
+
* Represents any object in Framer that can be navigated to, such as FramerNode, CollectionItem, or CodeFile.
|
|
3720
|
+
*/
|
|
3721
|
+
interface Navigable {
|
|
3722
|
+
/**
|
|
3723
|
+
* Navigates to the item in the Framer UI. May switch modes to reveal the relevant view.
|
|
3724
|
+
* @param opts Configuration options for the navigation behaviour.
|
|
3725
|
+
*/
|
|
3726
|
+
navigateTo(opts?: NavigableOptions): Promise<void>;
|
|
3727
|
+
}
|
|
3728
|
+
type Unsubscribe$1 = VoidFunction;
|
|
3729
|
+
type Cleanup = VoidFunction;
|
|
3730
|
+
|
|
3731
|
+
interface AiServiceInfo {
|
|
3732
|
+
endpoint: string;
|
|
3733
|
+
token: string;
|
|
3734
|
+
expiresAt: string;
|
|
3735
|
+
}
|
|
3736
|
+
declare class FramerPluginAPI {
|
|
3737
|
+
#private;
|
|
3738
|
+
constructor(engine: PluginEngine);
|
|
3739
|
+
/** Get the current mode. A plugin can launch in a special mode where only a subset of the API is allowed. */
|
|
3740
|
+
get mode(): Mode;
|
|
3741
|
+
/**
|
|
3742
|
+
* Find out if user's permissions allow them to execute all of `methods`:
|
|
3743
|
+
*
|
|
3744
|
+
* ```ts
|
|
3745
|
+
* if (framer.isAllowedTo("addImage")) await framer.addImage(...)
|
|
3746
|
+
* if (framer.isAllowedTo("Collection.setItemOrder")) await collection.setItemOrder(...)
|
|
3747
|
+
* ```
|
|
3748
|
+
*
|
|
3749
|
+
* Note that when the result of the permission check affects the UI, it's better to use the
|
|
3750
|
+
* `subscribeToIsAllowedTo` method, or `useIsAllowedTo` if using React.
|
|
3751
|
+
*/
|
|
3752
|
+
isAllowedTo(...methods: [ProtectedMethod, ...ProtectedMethod[]]): boolean;
|
|
3753
|
+
/**
|
|
3754
|
+
* Subscribe to changes in `framer.isAllowedTo(...methods)`:
|
|
3755
|
+
*
|
|
3756
|
+
* ```ts
|
|
3757
|
+
* console.log(`Initial isAllowed: ${framer.isAllowedTo("addImage")}`)
|
|
3758
|
+
* framer.subscribeToIsAllowedTo("addImage", (isAllowed) => {
|
|
3759
|
+
* console.log(`New isAllowed: ${isAllowed}`)
|
|
3760
|
+
* })
|
|
3761
|
+
* ```
|
|
3762
|
+
*
|
|
3763
|
+
* Refer to `useIsAllowedTo` for a React hook version of this.
|
|
3764
|
+
*/
|
|
3765
|
+
subscribeToIsAllowedTo(...args: [...methods: [ProtectedMethod, ...ProtectedMethod[]], callback: (isAllowed: boolean) => void]): Unsubscribe$1;
|
|
3766
|
+
/** Show the plugin UI. */
|
|
3767
|
+
showUI(options?: UIOptions): Promise<void>;
|
|
3768
|
+
/** Hide the plugin window, without stopping the plugin. */
|
|
3769
|
+
hideUI(): Promise<void>;
|
|
3770
|
+
/**
|
|
3771
|
+
* Stop the plugin. Throws `FramerPluginClosedError`, which should be ignored.
|
|
3772
|
+
* @param message - Optional message to show in the notification (ignored if options.silent is true)
|
|
3773
|
+
* @param options - Options to control the close behaviour
|
|
3774
|
+
*/
|
|
3775
|
+
closePlugin(message?: string, options?: ClosePluginOptions): never;
|
|
3776
|
+
/** Get the current user info like name and id. */
|
|
3777
|
+
getCurrentUser(): Promise<User>;
|
|
3778
|
+
/** Get the project info like name and id. */
|
|
3779
|
+
getProjectInfo(): Promise<ProjectInfo>;
|
|
3780
|
+
/** Get the current selection. */
|
|
3781
|
+
getSelection(): Promise<CanvasNode[]>;
|
|
3782
|
+
/** Set the current selection. */
|
|
3783
|
+
setSelection(nodeIds: string | Iterable<string>): Promise<void>;
|
|
3784
|
+
/** Subscribe to selection changes. */
|
|
3785
|
+
subscribeToSelection(selectionUpdate: (nodes: CanvasNode[]) => void): Unsubscribe$1;
|
|
3786
|
+
/** Get the root of the current canvas. */
|
|
3787
|
+
getCanvasRoot(): Promise<CanvasRootNode>;
|
|
3788
|
+
/** Subscribe to canvas root changes */
|
|
3789
|
+
subscribeToCanvasRoot(rootUpdate: (root: CanvasRootNode) => void): Unsubscribe$1;
|
|
3790
|
+
/** Get the current publish info. */
|
|
3791
|
+
getPublishInfo(): Promise<PublishInfo>;
|
|
3792
|
+
/** Subscribe to publish info changes. */
|
|
3793
|
+
subscribeToPublishInfo(publishInfoUpdate: (info: PublishInfo) => void): Unsubscribe$1;
|
|
3794
|
+
/** Create a new node on the canvas. */
|
|
3795
|
+
createFrameNode(attributes: Partial<EditableFrameNodeAttributes>, parentId?: string): Promise<FrameNode | null>;
|
|
3796
|
+
/** Remove nodes from the canvas. */
|
|
3797
|
+
removeNodes(nodeIds: NodeId[]): Promise<void>;
|
|
3798
|
+
/** @deprecated Use `removeNodes` directly. */
|
|
3799
|
+
removeNode(nodeId: NodeId): Promise<void>;
|
|
3800
|
+
/** Clone a node. */
|
|
3801
|
+
cloneNode(nodeId: NodeId): Promise<AnyNode | null>;
|
|
3802
|
+
/** Get a node by its id. */
|
|
3803
|
+
getNode(nodeId: NodeId): Promise<AnyNode | null>;
|
|
3804
|
+
/** Get the parent of a node. */
|
|
3805
|
+
getParent(nodeId: NodeId): Promise<AnyNode | null>;
|
|
3806
|
+
/** Get the children of a node. */
|
|
3807
|
+
getChildren(nodeId: NodeId): Promise<CanvasNode[]>;
|
|
3808
|
+
/** Get the rect of a node */
|
|
3809
|
+
getRect(nodeId: NodeId): Promise<Rect$1 | null>;
|
|
3810
|
+
/** Pans and zooms the viewport to center a single or group of nodes. */
|
|
3811
|
+
zoomIntoView(nodeIds: NodeId | Iterable<NodeId>, options?: ZoomIntoViewOptions): Promise<void>;
|
|
3812
|
+
/** Set the attributes of a node. */
|
|
3813
|
+
setAttributes(nodeId: NodeId, attributes: Partial<AnyEditableAttributes>): Promise<AnyNode | null>;
|
|
3814
|
+
/** Set the parent of a node. */
|
|
3815
|
+
setParent(nodeId: NodeId, parentId: NodeId, index?: number | undefined): Promise<void>;
|
|
3816
|
+
/** Get all nodes of a certain class. */
|
|
3817
|
+
getNodesWithType(type: "FrameNode"): Promise<FrameNode[]>;
|
|
3818
|
+
getNodesWithType(type: "TextNode"): Promise<TextNode[]>;
|
|
3819
|
+
getNodesWithType(type: "SVGNode"): Promise<SVGNode[]>;
|
|
3820
|
+
getNodesWithType(type: "ComponentInstanceNode"): Promise<ComponentInstanceNode[]>;
|
|
3821
|
+
getNodesWithType(type: "WebPageNode"): Promise<WebPageNode[]>;
|
|
3822
|
+
getNodesWithType(type: "DesignPageNode"): Promise<DesignPageNode[]>;
|
|
3823
|
+
getNodesWithType(type: "ComponentNode"): Promise<ComponentNode[]>;
|
|
3824
|
+
/** Get all nodes with a certain attribute. */
|
|
3825
|
+
getNodesWithAttribute<T extends NodeAttributeKey, Node = NodeWithAttribute<T>>(attribute: T): Promise<Node[]>;
|
|
3826
|
+
/** Get all nodes with a certain attribute which value is set. */
|
|
3827
|
+
getNodesWithAttributeSet<T extends NodeAttributeKey, Node = NodeWithAttribute<T>>(attribute: T): Promise<Node[]>;
|
|
3828
|
+
/** Get the image of the current selection or null if there is no image. */
|
|
3829
|
+
getImage(): Promise<ImageAsset | null>;
|
|
3830
|
+
/** Subscribe to single image selection changes. */
|
|
3831
|
+
subscribeToImage(imageUpdate: (image: ImageAsset | null) => void): Unsubscribe$1;
|
|
3832
|
+
/** Upload an image, and insert on the canvas. */
|
|
3833
|
+
addImage(image: NamedImageAssetInput | File): Promise<void>;
|
|
3834
|
+
/** Upload an image, and set on the selected node. */
|
|
3835
|
+
setImage(image: NamedImageAssetInput | File): Promise<void>;
|
|
3836
|
+
/** Upload an image without assigning it to a property. */
|
|
3837
|
+
uploadImage(image: NamedImageAssetInput | File): Promise<ImageAsset>;
|
|
3838
|
+
/** Add multiple images, replacing the selected images, or insert on the canvas. */
|
|
3839
|
+
addImages(images: readonly NamedImageAssetInput[]): Promise<void>;
|
|
3840
|
+
/** Upload multiple images without assigning them to properties. */
|
|
3841
|
+
uploadImages(images: readonly NamedImageAssetInput[]): Promise<ImageAsset[]>;
|
|
3842
|
+
/** Uploads a file without assigning it to a property. */
|
|
3843
|
+
uploadFile(file: NamedFileAssetInput | File): Promise<FileAsset>;
|
|
3844
|
+
/** Upload multiple files without assigning them to properties. */
|
|
3845
|
+
uploadFiles(files: readonly NamedFileAssetInput[]): Promise<FileAsset[]>;
|
|
3846
|
+
/** Add an SVG, replacing the selected SVG, or insert on the canvas. */
|
|
3847
|
+
addSVG(svg: SVGData): Promise<void>;
|
|
3848
|
+
/** Add a component instance by module URL. */
|
|
3849
|
+
addComponentInstance({ url, attributes, parentId, }: AddComponentInstanceOptions): Promise<ComponentInstanceNode>;
|
|
3850
|
+
/** Adds the layers of a component by module URL. */
|
|
3851
|
+
addDetachedComponentLayers({ url, layout, attributes, }: AddDetachedComponentLayersOptions): Promise<FrameNode>;
|
|
3852
|
+
/** Preload the component layers for detached insertion. */
|
|
3853
|
+
preloadDetachedComponentLayers(url: string): Promise<void>;
|
|
3854
|
+
preloadImageUrlForInsertion(url: string): Promise<void>;
|
|
3855
|
+
preloadDragPreviewImage(url: string): Promise<void>;
|
|
3856
|
+
/** Get plaintext of the current selection or null if there is no text. */
|
|
3857
|
+
getText(): Promise<string | null>;
|
|
3858
|
+
/** Set the text of the current selection or insert it onto the canvas. */
|
|
3859
|
+
setText(text: string): Promise<void>;
|
|
3860
|
+
/** Add a new text node to the canvas. */
|
|
3861
|
+
addText(text: string, options?: AddTextOptions): Promise<void>;
|
|
3862
|
+
/**
|
|
3863
|
+
* Set Custom HTML to be loaded in the document. A plugin can only set custom HTML once per
|
|
3864
|
+
* location.
|
|
3865
|
+
*/
|
|
3866
|
+
setCustomCode(options: SetCustomCodeOptions): Promise<void>;
|
|
3867
|
+
/** Get custom HTML settings set by the plugin. */
|
|
3868
|
+
getCustomCode(): Promise<CustomCode>;
|
|
3869
|
+
/** Subscribe to custom HTML changes set by the plugin. */
|
|
3870
|
+
subscribeToCustomCode(callback: (customHTML: CustomCode) => void): Unsubscribe$1;
|
|
3871
|
+
/** Subscribe to the current text selection. */
|
|
3872
|
+
subscribeToText(callback: (text: string | null) => void): Unsubscribe$1;
|
|
3873
|
+
/**
|
|
3874
|
+
* Allow any HTML element to become draggable. Different types of drag data can be dropped onto
|
|
3875
|
+
* Framer. A function is returned to remove the draggable behavior from the element and to stop
|
|
3876
|
+
* all of the added listeners.
|
|
3877
|
+
*/
|
|
3878
|
+
makeDraggable(element: HTMLElement, getDragData: () => DragData, onDragComplete?: DragCompleteCallback): Cleanup;
|
|
3879
|
+
/** Get the managed collection that is currently active and selected in the UI. */
|
|
3880
|
+
getActiveManagedCollection(): Promise<ManagedCollection>;
|
|
3881
|
+
/** @deprecated Use `getActiveManagedCollection` */
|
|
3882
|
+
getManagedCollection(): Promise<ManagedCollection>;
|
|
3883
|
+
/** Get all collections managed by your plugin. */
|
|
3884
|
+
getManagedCollections(): Promise<ManagedCollection[]>;
|
|
3885
|
+
/** Get a collection by its id. */
|
|
3886
|
+
getCollection(id: NodeId): Promise<Collection | null>;
|
|
3887
|
+
/** Get the collection that is currently selected in the UI. */
|
|
3888
|
+
getActiveCollection(): Promise<Collection | null>;
|
|
3889
|
+
/**
|
|
3890
|
+
* Get all collections in the project. This includes collections created by the user or a
|
|
3891
|
+
* plugin.
|
|
3892
|
+
*/
|
|
3893
|
+
getCollections(): Promise<Collection[]>;
|
|
3894
|
+
/**
|
|
3895
|
+
* Display a notification message. The message will be truncated if longer than 120 characters.
|
|
3896
|
+
*/
|
|
3897
|
+
notify: Notify;
|
|
3898
|
+
/** Get plugin data by key. */
|
|
3899
|
+
getPluginData(key: string): Promise<string | null>;
|
|
3900
|
+
/** Set plugin data by key. */
|
|
3901
|
+
setPluginData(key: string, value: string | null): Promise<void>;
|
|
3902
|
+
/** Get all plugin data keys. */
|
|
3903
|
+
getPluginDataKeys(): Promise<string[]>;
|
|
3904
|
+
/** Get all color styles in the project. */
|
|
3905
|
+
getColorStyles(): Promise<ColorStyle[]>;
|
|
3906
|
+
/** Get a specific color style. */
|
|
3907
|
+
getColorStyle(id: NodeId): Promise<ColorStyle | null>;
|
|
3908
|
+
/** Add a new color style to the project. */
|
|
3909
|
+
createColorStyle(attributes: ColorStyleAttributes): Promise<ColorStyle>;
|
|
3910
|
+
/** Fired when a color style is added, edited or removed. */
|
|
3911
|
+
subscribeToColorStyles(callback: (styles: ColorStyle[]) => void): Unsubscribe$1;
|
|
3912
|
+
/** Get all text styles in the project. */
|
|
3913
|
+
getTextStyles(): Promise<TextStyle[]>;
|
|
3914
|
+
/** Get a specific text style. */
|
|
3915
|
+
getTextStyle(id: NodeId): Promise<TextStyle | null>;
|
|
3916
|
+
/** Add a new text style to the project. */
|
|
3917
|
+
createTextStyle(attributes: TextStyleAttributes): Promise<TextStyle>;
|
|
3918
|
+
/** Fired when a text style is added, edited or removed. */
|
|
3919
|
+
subscribeToTextStyles(callback: (styles: TextStyle[]) => void): Unsubscribe$1;
|
|
3920
|
+
/** Get a specific font via it's family name, and optionally weight and style. */
|
|
3921
|
+
getFont(family: string, attributes?: FontAttributes): Promise<Font | null>;
|
|
3922
|
+
/** Get all available fonts. */
|
|
3923
|
+
getFonts(): Promise<Font[]>;
|
|
3924
|
+
/** Get all locales in the current Project */
|
|
3925
|
+
getLocales(): Promise<readonly Locale[]>;
|
|
3926
|
+
/** Get the default locale of the current Project */
|
|
3927
|
+
getDefaultLocale(): Promise<Locale>;
|
|
3928
|
+
/**
|
|
3929
|
+
* Get the currently active locale.
|
|
3930
|
+
*
|
|
3931
|
+
* - In "localization" mode, the active locale is the locale selected in the Localizations panel.
|
|
3932
|
+
* - In "canvas" mode, the active locale is the locale selected in the toolbar.
|
|
3933
|
+
* - Otherwise, the active locale is null.
|
|
3934
|
+
*/
|
|
3935
|
+
getActiveLocale(): Promise<Locale | null>;
|
|
3936
|
+
/** Get all localization groups in the current Project */
|
|
3937
|
+
getLocalizationGroups(): Promise<readonly LocalizationGroup[]>;
|
|
3938
|
+
/** Update localization data */
|
|
3939
|
+
setLocalizationData(update: LocalizationData): Promise<SetLocalizationDataResult>;
|
|
3940
|
+
/** Get all redirects in the project */
|
|
3941
|
+
getRedirects(): Promise<readonly Redirect[]>;
|
|
3942
|
+
/** Add new redirects or update existing ones if their IDs match */
|
|
3943
|
+
subscribeToRedirects(callback: (redirects: Redirect[]) => void): Unsubscribe$1;
|
|
3944
|
+
/** Add new redirects or update existing ones if their IDs match */
|
|
3945
|
+
addRedirects(redirects: RedirectInput[]): Promise<Redirect[]>;
|
|
3946
|
+
/** Remove a redirect from the project */
|
|
3947
|
+
removeRedirects(redirectIds: string[]): Promise<void>;
|
|
3948
|
+
/** Set the order of redirects */
|
|
3949
|
+
setRedirectOrder(redirectIds: string[]): Promise<void>;
|
|
3950
|
+
/** Create a new code file */
|
|
3951
|
+
createCodeFile(name: string, code: string): Promise<CodeFile>;
|
|
3952
|
+
/** Get an array of all code files */
|
|
3953
|
+
getCodeFiles(): Promise<readonly CodeFile[]>;
|
|
3954
|
+
/** Get a specific code file */
|
|
3955
|
+
getCodeFile(id: string): Promise<CodeFile | null>;
|
|
3956
|
+
/**
|
|
3957
|
+
* Lint a code file and return the diagnostics.
|
|
3958
|
+
*
|
|
3959
|
+
* @param fileName - The name of the code file, must include the extension. Use `*.tsx` for TSX files, otherwise the React JSX syntax will be rejected.
|
|
3960
|
+
* @param content - The content of the code file.
|
|
3961
|
+
* @param rules - The rules to use for linting.
|
|
3962
|
+
*/
|
|
3963
|
+
lintCode(fileName: string, content: string, rules: LintConfig): Promise<LintDiagnostic[]>;
|
|
3964
|
+
/**
|
|
3965
|
+
* Type check a code file and return the diagnostics.
|
|
3966
|
+
*
|
|
3967
|
+
* @param fileName - The name of the code file, must include the extension. Use `*.tsx` for TSX files, otherwise the React JSX syntax will be rejected.
|
|
3968
|
+
* @param content - The content of the code file.
|
|
3969
|
+
*/
|
|
3970
|
+
typecheckCode(fileName: string, content: string, compilerOptions?: ts.server.protocol.CompilerOptions): Promise<TypecheckDiagnostic[]>;
|
|
3971
|
+
/**
|
|
3972
|
+
* Subscribe to changes in code files.
|
|
3973
|
+
* This will be called when code files are added, removed, or updated and will return an array of
|
|
3974
|
+
* all code files in the project.
|
|
3975
|
+
*/
|
|
3976
|
+
subscribeToCodeFiles(callback: (codeFiles: readonly CodeFile[]) => void): Unsubscribe$1;
|
|
3977
|
+
/**
|
|
3978
|
+
* Set the plugin's menu, which is shown in the plugin window header.
|
|
3979
|
+
*/
|
|
3980
|
+
setMenu(menuItems: MenuItem[]): Promise<void>;
|
|
3981
|
+
/**
|
|
3982
|
+
* Show a context menu at the given location.
|
|
3983
|
+
*/
|
|
3984
|
+
showContextMenu(menuItems: MenuItem[], config: ContextMenuConfig): Promise<void>;
|
|
3985
|
+
/**
|
|
3986
|
+
* Updates the version of the given dependency to the
|
|
3987
|
+
* specified version.
|
|
3988
|
+
*
|
|
3989
|
+
* WARNING: This API is unstable and may change or break in the future
|
|
3990
|
+
*/
|
|
3991
|
+
unstable_ensureMinimumDependencyVersion(packageName: string, version: string): Promise<void>;
|
|
3992
|
+
/**
|
|
3993
|
+
* Navigate to a node by ID with optional selection and zoom behaviour.
|
|
3994
|
+
*
|
|
3995
|
+
* @param nodeId - The ID of the node to navigate to.
|
|
3996
|
+
* @param opts - The options for the navigation.
|
|
3997
|
+
* @returns A promise that resolves when the navigation is complete.
|
|
3998
|
+
*/
|
|
3999
|
+
navigateTo(nodeId: string, opts?: NavigableOptions): Promise<void>;
|
|
4000
|
+
/**
|
|
4001
|
+
* Subscribe to the currently open code file in the Code Editor.
|
|
4002
|
+
*
|
|
4003
|
+
* @param callback - The callback to call when the code file changes.
|
|
4004
|
+
* @returns A function to unsubscribe from the subscription.
|
|
4005
|
+
*/
|
|
4006
|
+
subscribeToOpenCodeFile(callback: (codeFile: CodeFile | null) => void): Unsubscribe$1;
|
|
4007
|
+
/**
|
|
4008
|
+
* Create a new design page.
|
|
4009
|
+
*
|
|
4010
|
+
* If you want to open the newly created design page, you can `.navigateTo()` the page after creation.
|
|
4011
|
+
*
|
|
4012
|
+
* @example
|
|
4013
|
+
* ```ts
|
|
4014
|
+
* const designPage = await framer.createDesignPage("About")
|
|
4015
|
+
* await designPage.navigateTo()
|
|
4016
|
+
* ```
|
|
4017
|
+
*/
|
|
4018
|
+
createDesignPage(pageName: string): Promise<DesignPageNode>;
|
|
4019
|
+
/**
|
|
4020
|
+
* Create a new web page.
|
|
4021
|
+
*
|
|
4022
|
+
* If you want to open the newly created web page, you can `.navigateTo()` the page after creation.
|
|
4023
|
+
*
|
|
4024
|
+
* @example
|
|
4025
|
+
* ```ts
|
|
4026
|
+
* const webPage = await framer.createWebPage("/about")
|
|
4027
|
+
* await webPage.navigateTo()
|
|
4028
|
+
* ```
|
|
4029
|
+
*/
|
|
4030
|
+
createWebPage(pagePath: string): Promise<WebPageNode>;
|
|
4031
|
+
}
|
|
4032
|
+
/** @beta */
|
|
4033
|
+
declare class FramerPluginAPIBeta extends FramerPluginAPI {
|
|
4034
|
+
}
|
|
4035
|
+
/** @alpha */
|
|
4036
|
+
declare class FramerPluginAPIAlpha extends FramerPluginAPIBeta {
|
|
4037
|
+
#private;
|
|
4038
|
+
constructor(engine: PluginEngine);
|
|
4039
|
+
/**
|
|
4040
|
+
* Adds a new component instance placeholder.
|
|
4041
|
+
*
|
|
4042
|
+
* @param attributes - The attributes of the component instance placeholder.
|
|
4043
|
+
* @returns The component instance placeholder.
|
|
4044
|
+
*/
|
|
4045
|
+
addComponentInstancePlaceholder(attributes?: ComponentInstancePlaceholderAttributes): Promise<ComponentInstancePlaceholder>;
|
|
4046
|
+
[$framerInternal.getAiServiceInfo](): Promise<AiServiceInfo>;
|
|
4047
|
+
/** @internal */
|
|
4048
|
+
[$framerInternal.sendTrackingEvent](key: string, value: string, identifier: string): Promise<void>;
|
|
4049
|
+
/** @internal */
|
|
4050
|
+
[$framerInternal.getHTMLForNode](nodeId: NodeId): Promise<string | null>;
|
|
4051
|
+
/** @internal */
|
|
4052
|
+
[$framerInternal.setHTMLForNode](nodeId: NodeId, html: string): Promise<void>;
|
|
4053
|
+
/** @internal */
|
|
4054
|
+
get [$framerInternal.environmentInfo](): EnvironmentInfo | null;
|
|
4055
|
+
/** @internal */
|
|
4056
|
+
get [$framerInternal.showUncheckedPermissionToasts](): boolean;
|
|
4057
|
+
/** @internal */
|
|
4058
|
+
set [$framerInternal.showUncheckedPermissionToasts](value: boolean);
|
|
4059
|
+
/**
|
|
4060
|
+
* Create a new text node on the canvas.
|
|
4061
|
+
*
|
|
4062
|
+
* @alpha
|
|
4063
|
+
* @param attributes - The attributes of the node.
|
|
4064
|
+
* @param parentId - The id of the parent node.
|
|
4065
|
+
* @returns The created node.
|
|
4066
|
+
*/
|
|
4067
|
+
createTextNode(attributes: Partial<EditableTextNodeAttributes>, parentId?: string): Promise<TextNode | null>;
|
|
4068
|
+
/**
|
|
4069
|
+
* Create a new smart component node.
|
|
4070
|
+
*
|
|
4071
|
+
* @alpha
|
|
4072
|
+
* @param name - The name of the node.
|
|
4073
|
+
* @param attributes - The attributes of the node.
|
|
4074
|
+
* @returns The created node.
|
|
4075
|
+
*/
|
|
4076
|
+
createComponentNode(name: string): Promise<ComponentNode | null>;
|
|
4077
|
+
/**
|
|
4078
|
+
* Get all available vector sets.
|
|
4079
|
+
*
|
|
4080
|
+
* @alpha
|
|
4081
|
+
*/
|
|
4082
|
+
getVectorSets(): Promise<VectorSet[]>;
|
|
4083
|
+
/**
|
|
4084
|
+
* Publish the project.
|
|
4085
|
+
* currently only intended to be used by framer-api
|
|
4086
|
+
* @alpha
|
|
4087
|
+
*/
|
|
4088
|
+
publish(): Promise<boolean>;
|
|
4089
|
+
/**
|
|
4090
|
+
* Get paths of pages changed between versions.
|
|
4091
|
+
* currently only intended to be used by framer-api
|
|
4092
|
+
* @alpha
|
|
4093
|
+
*/
|
|
4094
|
+
getChangedPagePaths(fromVersion?: number, toVersion?: number): Promise<{
|
|
4095
|
+
added: string[];
|
|
4096
|
+
removed: string[];
|
|
4097
|
+
modified: string[];
|
|
4098
|
+
}>;
|
|
4099
|
+
/**
|
|
4100
|
+
* Get authors who made changes between versions.
|
|
4101
|
+
* currently only intended to be used by framer-api
|
|
4102
|
+
* @alpha
|
|
4103
|
+
*/
|
|
4104
|
+
getChangeAuthors(fromVersion?: number, toVersion?: number): Promise<string[]>;
|
|
4105
|
+
/**
|
|
4106
|
+
* Create a new managed collection.
|
|
4107
|
+
* currently only intended to be used by framer-api
|
|
4108
|
+
* @alpha
|
|
4109
|
+
*/
|
|
4110
|
+
createManagedCollection(name: string): Promise<ManagedCollection>;
|
|
4111
|
+
}
|
|
4112
|
+
interface UIOptions {
|
|
4113
|
+
/** The preferred UI width. */
|
|
4114
|
+
width?: number;
|
|
4115
|
+
/** The preferred UI height. */
|
|
4116
|
+
height?: number;
|
|
4117
|
+
/** The initial window position, defaults to top left. */
|
|
4118
|
+
position?: "center" | "top left" | "bottom left" | "top right" | "bottom right";
|
|
4119
|
+
/** Whether the UI is resizable. */
|
|
4120
|
+
resizable?: true | false | "width" | "height";
|
|
4121
|
+
/** Minimum UI width. */
|
|
4122
|
+
minWidth?: number;
|
|
4123
|
+
/** Minimum UI height. */
|
|
4124
|
+
minHeight?: number;
|
|
4125
|
+
/** Maximum UI width. */
|
|
4126
|
+
maxWidth?: number;
|
|
4127
|
+
/** Maximum UI height. */
|
|
4128
|
+
maxHeight?: number;
|
|
4129
|
+
}
|
|
4130
|
+
interface ClosePluginOptions {
|
|
4131
|
+
variant?: NotificationVariant;
|
|
4132
|
+
/** When true, closes the plugin without showing a toast. */
|
|
4133
|
+
silent?: boolean;
|
|
4134
|
+
}
|
|
4135
|
+
interface ApiVersion1ProjectInfo {
|
|
4136
|
+
name: string;
|
|
4137
|
+
/** Hashed project id */
|
|
4138
|
+
id: string;
|
|
4139
|
+
}
|
|
4140
|
+
interface ProjectInfo extends ApiVersion1ProjectInfo {
|
|
4141
|
+
/** Hashed project id served by API version 1, use for migration only */
|
|
4142
|
+
apiVersion1Id: string;
|
|
4143
|
+
}
|
|
4144
|
+
interface AddComponentInstanceOptions {
|
|
4145
|
+
/** The component module URL. Can be copied from the components panel. */
|
|
4146
|
+
url: string;
|
|
4147
|
+
/** Optional component attributes. */
|
|
4148
|
+
attributes?: Partial<EditableComponentInstanceNodeAttributes>;
|
|
4149
|
+
/**
|
|
4150
|
+
* Optional parent node ID where the component instance should be inserted.
|
|
4151
|
+
* If not provided, the component will be inserted at the default location based on the current selection.
|
|
4152
|
+
*
|
|
4153
|
+
* @alpha
|
|
4154
|
+
*/
|
|
4155
|
+
parentId?: string;
|
|
4156
|
+
}
|
|
4157
|
+
interface AddDetachedComponentLayersOptions {
|
|
4158
|
+
/** The component module URL. Can be copied from the components panel. */
|
|
4159
|
+
url: string;
|
|
4160
|
+
/** Optional component attributes. */
|
|
4161
|
+
attributes?: Partial<EditableComponentInstanceNodeAttributes>;
|
|
4162
|
+
/** Insert the layers as a layout block and match variants with breakpoints. */
|
|
4163
|
+
layout?: boolean;
|
|
4164
|
+
}
|
|
4165
|
+
type Extends<T, U extends T> = U;
|
|
4166
|
+
type CreateNodeType = Extends<PluginNodeClass, "FrameNode" | "TextNode" | "ComponentNode">;
|
|
4167
|
+
type ComponentDragData = Omit<Extract<DragData, {
|
|
4168
|
+
type: "componentInstance";
|
|
4169
|
+
}>, "attributes"> & {
|
|
4170
|
+
attributes?: Record<string, unknown>;
|
|
4171
|
+
};
|
|
4172
|
+
type OtherDragData = Exclude<DragData, {
|
|
4173
|
+
type: "componentInstance";
|
|
4174
|
+
}>;
|
|
4175
|
+
type MessageApiDragData = ComponentDragData | OtherDragData;
|
|
4176
|
+
interface PluginMessageAPI {
|
|
4177
|
+
hideUI: FramerPluginAPI["hideUI"];
|
|
4178
|
+
closePlugin: (...parameters: Parameters<FramerPluginAPI["closePlugin"]>) => Promise<void>;
|
|
4179
|
+
removeNode: FramerPluginAPI["removeNode"];
|
|
4180
|
+
removeNodes: FramerPluginAPI["removeNodes"];
|
|
4181
|
+
addSVG: FramerPluginAPI["addSVG"];
|
|
4182
|
+
getRect: FramerPluginAPI["getRect"];
|
|
4183
|
+
setText: FramerPluginAPI["setText"];
|
|
4184
|
+
getText: FramerPluginAPI["getText"];
|
|
4185
|
+
addText: FramerPluginAPI["addText"];
|
|
4186
|
+
preloadDetachedComponentLayers: FramerPluginAPI["preloadDetachedComponentLayers"];
|
|
4187
|
+
preloadImageUrlForInsertion: FramerPluginAPI["preloadImageUrlForInsertion"];
|
|
4188
|
+
preloadDragPreviewImage: FramerPluginAPI["preloadDragPreviewImage"];
|
|
4189
|
+
setCustomCode: FramerPluginAPI["setCustomCode"];
|
|
4190
|
+
getCustomCode: FramerPluginAPI["getCustomCode"];
|
|
4191
|
+
setPluginData: FramerPluginAPI["setPluginData"];
|
|
4192
|
+
getPluginData: FramerPluginAPI["getPluginData"];
|
|
4193
|
+
getPluginDataKeys: FramerPluginAPI["getPluginDataKeys"];
|
|
4194
|
+
getLocales: FramerPluginAPI["getLocales"];
|
|
4195
|
+
getDefaultLocale: FramerPluginAPI["getDefaultLocale"];
|
|
4196
|
+
getActiveLocale: FramerPluginAPI["getActiveLocale"];
|
|
4197
|
+
getLocalizationGroups: FramerPluginAPI["getLocalizationGroups"];
|
|
4198
|
+
setLocalizationData: FramerPluginAPI["setLocalizationData"];
|
|
4199
|
+
unstable_ensureMinimumDependencyVersion: FramerPluginAPI["unstable_ensureMinimumDependencyVersion"];
|
|
4200
|
+
showUI: (options?: UIOptions) => Promise<void>;
|
|
4201
|
+
notify: (message: string, options: NotifyOptionsData) => Promise<NotificationCloseReason>;
|
|
4202
|
+
closeNotification: (notificationId: string) => Promise<void>;
|
|
4203
|
+
getCurrentUser(): Promise<ApiVersion1User>;
|
|
4204
|
+
getCurrentUser2(): Promise<User>;
|
|
4205
|
+
getProjectInfo(): Promise<ApiVersion1ProjectInfo>;
|
|
4206
|
+
getProjectInfo2(): Promise<ProjectInfo>;
|
|
4207
|
+
getSelection: () => Promise<SomeNodeData[]>;
|
|
4208
|
+
setSelection: (nodeIds: NodeId[]) => Promise<void>;
|
|
4209
|
+
getCanvasRoot: () => Promise<SomeNodeData>;
|
|
4210
|
+
getPublishInfo: () => Promise<PublishInfo>;
|
|
4211
|
+
createNode: (type: CreateNodeType, parentId: NodeId | null, attributes: Record<string, unknown>) => Promise<SomeNodeData | null>;
|
|
4212
|
+
cloneNode: (nodeId: NodeId) => Promise<SomeNodeData | null>;
|
|
4213
|
+
getNode: (nodeId: NodeId) => Promise<SomeNodeData | null>;
|
|
4214
|
+
getParent: (nodeId: NodeId) => Promise<SomeNodeData | null>;
|
|
4215
|
+
getChildren: (nodeId: NodeId) => Promise<SomeNodeData[]>;
|
|
4216
|
+
removeNodes2: (ids: NodeId[]) => Promise<void>;
|
|
4217
|
+
zoomIntoView: (nodeIds: NodeId[], options?: ZoomIntoViewOptions) => Promise<void>;
|
|
4218
|
+
navigateTo: (nodeId: string, opts?: NavigableOptions) => Promise<void>;
|
|
4219
|
+
setAttributes: (nodeId: NodeId, attributes: Record<string, unknown>) => Promise<SomeNodeData | null>;
|
|
4220
|
+
getTextForNode(nodeId: NodeId): Promise<string | null>;
|
|
4221
|
+
setTextForNode(nodeId: NodeId, text: string): Promise<void>;
|
|
4222
|
+
getSVGForNode: (nodeId: NodeId) => Promise<string | null>;
|
|
4223
|
+
getNodesWithType: (nodeId: NodeId | null, type: KnownNodeClass) => Promise<SomeNodeData[]>;
|
|
4224
|
+
getNodesWithAttribute: (nodeId: NodeId | null, attribute: string) => Promise<SomeNodeData[]>;
|
|
4225
|
+
getNodesWithAttributeSet: (nodeId: NodeId | null, attribute: string) => Promise<SomeNodeData[]>;
|
|
4226
|
+
addImages: (image: readonly NamedImageTransfer[]) => Promise<void>;
|
|
4227
|
+
getImage(): Promise<ImageAssetData | null>;
|
|
4228
|
+
addImage(image: NamedImageTransfer): Promise<void>;
|
|
4229
|
+
setImage(image: NamedImageTransfer): Promise<void>;
|
|
4230
|
+
uploadImage(image: NamedImageTransfer): Promise<ImageAssetData>;
|
|
4231
|
+
uploadImages: (image: readonly NamedImageTransfer[]) => Promise<ImageAssetData[]>;
|
|
4232
|
+
uploadFile: (file: NamedAssetTransfer) => Promise<FileAssetData>;
|
|
4233
|
+
uploadFiles: (files: readonly NamedAssetTransfer[]) => Promise<FileAssetData[]>;
|
|
4234
|
+
getImageData: (image: AssetIdentifier & Partial<Pick<ImageAssetData, "resolution">>) => Promise<BytesData>;
|
|
4235
|
+
setParent: (nodeId: NodeId, parentId: NodeId, index?: number) => Promise<void>;
|
|
4236
|
+
addComponentInstance: (options: {
|
|
4237
|
+
url: string;
|
|
4238
|
+
attributes?: Partial<Record<string, unknown>>;
|
|
4239
|
+
parentId?: string;
|
|
4240
|
+
}) => Promise<SomeNodeData>;
|
|
4241
|
+
addDetachedComponentLayers: (options: {
|
|
4242
|
+
url: string;
|
|
4243
|
+
layout?: boolean;
|
|
4244
|
+
attributes?: Partial<Record<string, unknown>>;
|
|
4245
|
+
}) => Promise<SomeNodeData>;
|
|
4246
|
+
setDragData: (dragSessionId: string, dragData: MessageApiDragData) => Promise<void>;
|
|
4247
|
+
onDragStart: (info: DragStartInfo) => Promise<void>;
|
|
4248
|
+
onDrag: (info: DragInfo) => Promise<string | null>;
|
|
4249
|
+
onDragEnd: (info: DragEndInfo) => Promise<DragCompleteResult>;
|
|
4250
|
+
onPointerDown: () => Promise<void>;
|
|
4251
|
+
getActiveManagedCollection: () => Promise<CollectionData>;
|
|
4252
|
+
/** @deprecated Use getActiveManagedCollection */
|
|
4253
|
+
getManagedCollection: () => Promise<CollectionData>;
|
|
4254
|
+
getManagedCollections: () => Promise<CollectionData[]>;
|
|
4255
|
+
getManagedCollectionItemIds: (id: NodeId) => Promise<string[]>;
|
|
4256
|
+
setManagedCollectionItemOrder: (id: NodeId, ids: string[]) => Promise<void>;
|
|
4257
|
+
setManagedCollectionFields: (id: NodeId, fields: ManagedCollectionFieldInputData[]) => Promise<void>;
|
|
4258
|
+
getManagedCollectionFields: (id: NodeId) => Promise<ManagedCollectionField[]>;
|
|
4259
|
+
getManagedCollectionFields2: (id: NodeId) => Promise<ManagedCollectionField[]>;
|
|
4260
|
+
addManagedCollectionItems: (id: NodeId, items: ApiV2ManagedCollectionItemInput[]) => Promise<void>;
|
|
4261
|
+
addManagedCollectionItems2: (id: NodeId, items: ManagedCollectionItemInput[]) => Promise<void>;
|
|
4262
|
+
removeManagedCollectionItems: (id: NodeId, itemIds: string[]) => Promise<void>;
|
|
4263
|
+
getCollection: (id: NodeId) => Promise<CollectionData | null>;
|
|
4264
|
+
getActiveCollection: () => Promise<CollectionData | null>;
|
|
4265
|
+
getCollections: () => Promise<CollectionData[]>;
|
|
4266
|
+
getCollectionItems: (id: NodeId) => Promise<ApiV2CollectionItemData[]>;
|
|
4267
|
+
getCollectionItems2: (id: NodeId) => Promise<CollectionItemSerializableData[]>;
|
|
4268
|
+
setCollectionItemOrder: (collectionId: NodeId, itemIds: NodeId[]) => Promise<void>;
|
|
4269
|
+
getCollectionFields: (collectionId: string, includeDividers?: true) => Promise<FieldDefinitionData[]>;
|
|
4270
|
+
getCollectionFields2: (collectionId: string, includeDividers?: true) => Promise<FieldDefinitionData[]>;
|
|
4271
|
+
addCollectionFields: (collectionId: string, fields: FieldInput[]) => Promise<(FieldDefinitionData | null)[]>;
|
|
4272
|
+
addCollectionFields2: (collectionId: string, fields: FieldInput[]) => Promise<(FieldDefinitionData | null)[]>;
|
|
4273
|
+
removeCollectionFields: (collectionId: string, fieldIds: string[]) => Promise<void>;
|
|
4274
|
+
setCollectionFieldOrder: (collectionId: string, fieldIds: string[]) => Promise<void>;
|
|
4275
|
+
addCollectionItems: (id: NodeId, items: ApiV2CollectionItemInput[]) => Promise<ApiV2CollectionItemData[]>;
|
|
4276
|
+
addCollectionItems2: (id: NodeId, items: CollectionItemInput[]) => Promise<CollectionItemSerializableData[]>;
|
|
4277
|
+
setCollectionItemAttributes: (id: NodeId, attributes: ApiV2EditableCollectionItemAttributes) => Promise<ApiV2CollectionItemData | null>;
|
|
4278
|
+
setCollectionItemAttributes2: (id: NodeId, attributes: EditableCollectionItemAttributes) => Promise<CollectionItemSerializableData | null>;
|
|
4279
|
+
setActiveCollection: (collectionId: NodeId) => Promise<void>;
|
|
4280
|
+
removeCollectionItems: (ids: NodeId[]) => Promise<void>;
|
|
4281
|
+
/** @alpha */
|
|
4282
|
+
getActiveCollectionItemForWebPage: (webPageNodeId: NodeId) => Promise<CollectionItemSerializableData | null>;
|
|
4283
|
+
addEnumCase: (collectionId: string, fieldId: string, attributes: CreateEnumCase) => Promise<EnumCaseData | null>;
|
|
4284
|
+
updateEnumCase: (collectionId: string, fieldId: string, caseId: string, attributes: UpdateEnumCase) => Promise<EnumCaseData | null>;
|
|
4285
|
+
removeEnumCase: (collectionId: string, fieldId: string, caseId: string) => Promise<void>;
|
|
4286
|
+
setEnumCaseOrder: (collectionId: string, fieldId: string, caseIds: string[]) => Promise<void>;
|
|
4287
|
+
getPluginDataForNode: (id: NodeId, key: string) => Promise<string | null>;
|
|
4288
|
+
setPluginDataForNode: (id: NodeId, key: string, value: string | null) => Promise<void>;
|
|
4289
|
+
getPluginDataKeysForNode: (id: NodeId) => Promise<string[]>;
|
|
4290
|
+
getColorStyle(id: NodeId): Promise<ColorStyleData | null>;
|
|
4291
|
+
getColorStyles(): Promise<ColorStyleData[]>;
|
|
4292
|
+
createColorStyle(attributes: Record<string, unknown>): Promise<ColorStyleData>;
|
|
4293
|
+
setColorStyleAttributes(id: NodeId, update: Record<string, unknown>): Promise<ColorStyleData | null>;
|
|
4294
|
+
removeColorStyle(id: NodeId): Promise<void>;
|
|
4295
|
+
getTextStyle: (id: NodeId) => Promise<TextStyleData | null>;
|
|
4296
|
+
getTextStyles: () => Promise<TextStyleData[]>;
|
|
4297
|
+
createTextStyle: (attributes: Record<string, unknown>) => Promise<TextStyleData>;
|
|
4298
|
+
setTextStyleAttributes: (id: NodeId, update: Record<string, unknown>) => Promise<TextStyleData | null>;
|
|
4299
|
+
removeTextStyle: (id: NodeId) => Promise<void>;
|
|
4300
|
+
getFont: (family: string, attributes?: Record<string, unknown>) => Promise<FontData | null>;
|
|
4301
|
+
getFonts: () => Promise<FontData[]>;
|
|
4302
|
+
/** @deprecated */
|
|
4303
|
+
unstable_createCodeFile: (name: string, code: string) => Promise<CodeFileData>;
|
|
4304
|
+
/** @deprecated */
|
|
4305
|
+
unstable_getCodeFiles: () => Promise<readonly CodeFileData[]>;
|
|
4306
|
+
/** @deprecated */
|
|
4307
|
+
unstable_getCodeFile: (id: string) => Promise<CodeFileData | null>;
|
|
4308
|
+
/** @deprecated */
|
|
4309
|
+
unstable_renameCodeFile: (id: string, newName: string) => Promise<CodeFileData>;
|
|
4310
|
+
/** @deprecated */
|
|
4311
|
+
unstable_removeCodeFile: (id: string) => Promise<void>;
|
|
4312
|
+
/** @deprecated */
|
|
4313
|
+
unstable_setCodeFileContent: (id: string, code: string) => Promise<CodeFileData>;
|
|
4314
|
+
/** @deprecated */
|
|
4315
|
+
unstable_getCodeFileVersions: (id: string) => Promise<readonly CodeFileVersionData[]>;
|
|
4316
|
+
/** @deprecated */
|
|
4317
|
+
unstable_getCodeFileVersionContent: (fileId: string, versionId: string) => Promise<string>;
|
|
4318
|
+
/** @deprecated */
|
|
4319
|
+
unstable_getCodeFileLint2(fileName: string, content: string, rules: LintConfig): Promise<LintDiagnostic[]>;
|
|
4320
|
+
/** @deprecated */
|
|
4321
|
+
unstable_getCodeFileTypecheck2(fileName: string, content: string, compilerOptions?: ts.server.protocol.CompilerOptions): Promise<TypecheckDiagnostic[]>;
|
|
4322
|
+
createCodeFile: (name: string, code: string) => Promise<CodeFileData>;
|
|
4323
|
+
getCodeFiles: () => Promise<readonly CodeFileData[]>;
|
|
4324
|
+
getCodeFile: (id: string) => Promise<CodeFileData | null>;
|
|
4325
|
+
renameCodeFile: (id: string, newName: string) => Promise<CodeFileData>;
|
|
4326
|
+
removeCodeFile: (id: string) => Promise<void>;
|
|
4327
|
+
setCodeFileContent: (id: string, code: string) => Promise<CodeFileData>;
|
|
4328
|
+
getCodeFileVersions: (id: string) => Promise<readonly CodeFileVersionData[]>;
|
|
4329
|
+
getCodeFileVersionContent: (fileId: string, versionId: string) => Promise<string>;
|
|
4330
|
+
lintCode(fileName: string, content: string, rules: LintConfig): Promise<LintDiagnostic[]>;
|
|
4331
|
+
typecheckCode(fileName: string, content: string, compilerOptions?: ts.server.protocol.CompilerOptions): Promise<TypecheckDiagnostic[]>;
|
|
4332
|
+
addRedirects: (redirects: RedirectInput[]) => Promise<RedirectData[]>;
|
|
4333
|
+
getRedirects: () => Promise<readonly RedirectData[]>;
|
|
4334
|
+
setRedirectOrder: (redirectIds: string[]) => Promise<void>;
|
|
4335
|
+
removeRedirects: (redirectIds: string[]) => Promise<void>;
|
|
4336
|
+
/** @deprecated Use `getRuntimeErrorForCodeComponentNode` instead. Can be removed when Workshop is updated. */
|
|
4337
|
+
getRuntimeErrorForModule: (moduleIdentifier: string) => Promise<string | null>;
|
|
4338
|
+
getRuntimeErrorForCodeComponentNode: (nodeId: NodeId) => Promise<NodeRuntimeErrorResult | null>;
|
|
4339
|
+
addComponentInstancePlaceholder: (attributes?: ComponentInstancePlaceholderAttributes) => Promise<ComponentInstancePlaceholderData>;
|
|
4340
|
+
updateComponentInstancePlaceholder: (id: string, attributes: ComponentInstancePlaceholderAttributes) => Promise<ComponentInstancePlaceholderData | null>;
|
|
4341
|
+
removeComponentInstancePlaceholder: (id: string) => Promise<void>;
|
|
4342
|
+
replaceComponentInstancePlaceholderWithComponentInstance: (id: string, url: string, attributes?: Partial<EditableComponentInstanceNodeAttributes>) => Promise<SomeNodeData | null>;
|
|
4343
|
+
showProgressOnInstances: (codeFileId: string, attributes?: ShowProgressOnInstancesAttributes) => Promise<void>;
|
|
4344
|
+
removeProgressFromInstances: (codeFileId: string) => Promise<void>;
|
|
4345
|
+
setMenu: (menuItems: MenuItemSerializable[]) => Promise<void>;
|
|
4346
|
+
showContextMenu: (menuItems: MenuItemSerializable[], config: ContextMenuConfig) => Promise<void>;
|
|
4347
|
+
/** @alpha */
|
|
4348
|
+
publish: () => Promise<boolean>;
|
|
4349
|
+
/** @alpha */
|
|
4350
|
+
getChangedPagePaths: (fromVersion?: number, toVersion?: number) => Promise<{
|
|
4351
|
+
added: string[];
|
|
4352
|
+
removed: string[];
|
|
4353
|
+
modified: string[];
|
|
4354
|
+
}>;
|
|
4355
|
+
/** @alpha */
|
|
4356
|
+
getChangeAuthors: (fromVersion?: number, toVersion?: number) => Promise<string[]>;
|
|
4357
|
+
/** @alpha */
|
|
4358
|
+
createManagedCollection: (name: string) => Promise<CollectionData>;
|
|
4359
|
+
[getAiServiceInfoMessageType]: () => Promise<AiServiceInfo>;
|
|
4360
|
+
[sendTrackingEventMessageType]: (key: string, value: string, identifier: string) => Promise<void>;
|
|
4361
|
+
[getHTMLForNodeMessageType]: (nodeId: NodeId) => Promise<string | null>;
|
|
4362
|
+
[setHTMLForNodeMessageType]: (nodeId: NodeId, html: string) => Promise<void>;
|
|
4363
|
+
/** @deprecated Use `getAiServiceInfoMessageType`. */
|
|
4364
|
+
getAiServiceInfo: () => Promise<AiServiceInfo>;
|
|
4365
|
+
/** @deprecated Use `sendTrackingEventMessageType`. */
|
|
4366
|
+
sendTrackingEvent: (key: string, value: string, identifier: string) => Promise<void>;
|
|
4367
|
+
/** @alpha */
|
|
4368
|
+
addVariantToComponent: (componentId: NodeId, basedOn: NodeId, attributes?: unknown) => Promise<SomeNodeData>;
|
|
4369
|
+
/** @alpha */
|
|
4370
|
+
addGestureVariantToComponent: (componentId: NodeId, nodeId: NodeId, type: "hover" | "pressed", attributes?: unknown) => Promise<SomeNodeData>;
|
|
4371
|
+
/** @alpha */
|
|
4372
|
+
addBreakpointToWebPage: (nodeId: NodeId, basedOn: NodeId, breakpoint: Breakpoint) => Promise<SomeNodeData>;
|
|
4373
|
+
/** @alpha */
|
|
4374
|
+
getBreakpointSuggestionsForWebPage: (nodeId: NodeId) => Promise<readonly Breakpoint[]>;
|
|
4375
|
+
/** @alpha */
|
|
4376
|
+
getVariables: (nodeId: string) => Promise<VariableData[]>;
|
|
4377
|
+
/** @alpha */
|
|
4378
|
+
addVariables: (nodeId: string, pluginCreateVariables: Marshaled<CreateVariable[]>) => Promise<VariableData[]>;
|
|
4379
|
+
/** @alpha */
|
|
4380
|
+
updateVariable: (nodeId: string, variableId: string, pluginUpdateVariable: Marshaled<UpdateVariable>) => Promise<VariableData | null>;
|
|
4381
|
+
/** @alpha */
|
|
4382
|
+
removeVariables: (nodeId: string, variableIds: string[]) => Promise<void>;
|
|
4383
|
+
/** @alpha */
|
|
4384
|
+
setVariableOrder: (nodeId: string, variableIds: string[]) => Promise<void>;
|
|
4385
|
+
/** @alpha */
|
|
4386
|
+
getVectorSets: () => Promise<VectorSetData[]>;
|
|
4387
|
+
/** @alpha */
|
|
4388
|
+
getVectorSetItems: (vectorSetId: string) => Promise<VectorSetItemData[]>;
|
|
4389
|
+
/** @alpha */
|
|
4390
|
+
getVectorSetItemVariables: (vectorSetItemId: string, moduleId: string) => Promise<VectorSetItemVariable[]>;
|
|
4391
|
+
createDesignPage: (pageName: string) => Promise<SomeNodeData>;
|
|
4392
|
+
createWebPage: (pagePath: string) => Promise<SomeNodeData>;
|
|
4393
|
+
}
|
|
4394
|
+
|
|
4395
|
+
type Unsubscribe = VoidFunction;
|
|
4396
|
+
type PostMessage = (message: PluginToVekterMessage, transfer?: Transferable[] | undefined) => void;
|
|
4397
|
+
interface PluginApiTransport {
|
|
4398
|
+
send: (message: PluginToVekterMessage, transfer?: Transferable[]) => void;
|
|
4399
|
+
onMessage: (handler: (event: unknown) => void) => void;
|
|
4400
|
+
}
|
|
4401
|
+
interface PluginApiContext {
|
|
4402
|
+
transport: PluginApiTransport;
|
|
4403
|
+
mode: Mode;
|
|
4404
|
+
permissionMap: PermissionMap;
|
|
4405
|
+
environmentInfo: EnvironmentInfo | null;
|
|
4406
|
+
origin: string | null;
|
|
4407
|
+
theme: Theme | null;
|
|
4408
|
+
}
|
|
4409
|
+
declare class PluginEngine {
|
|
4410
|
+
methodInvocationId: number;
|
|
4411
|
+
notificationId: number;
|
|
4412
|
+
readonly postMessage: PostMessage;
|
|
4413
|
+
readonly methodResponseHandlers: Map<number, {
|
|
4414
|
+
resolve: (value: any) => void;
|
|
4415
|
+
reject: (error: FramerPluginError) => void;
|
|
4416
|
+
}>;
|
|
4417
|
+
readonly mode: Mode;
|
|
4418
|
+
readonly subscriptions: Map<"text" | "image" | "publishInfo" | "selection" | "canvasRoot" | "theme" | "customCode" | "colorStyles" | "textStyles" | "redirects" | "codeFiles" | "openCodeFile", Set<(value: any) => void>>;
|
|
4419
|
+
perMethodPermissionMap: PerMethodPermissionMap;
|
|
4420
|
+
readonly permissionSubscriptions: Set<VoidFunction>;
|
|
4421
|
+
readonly messageTypesCheckedInIsAllowedTo: Set<ProtectedMessageType>;
|
|
4422
|
+
showUncheckedPermissionToasts: boolean;
|
|
4423
|
+
readonly environmentInfo: EnvironmentInfo | null;
|
|
4424
|
+
menuItemOnActionCallbackMap: Map<number, () => void>;
|
|
4425
|
+
contextMenuItemOnActionCallbackMap: Map<number, () => void>;
|
|
4426
|
+
constructor(context?: PluginApiContext);
|
|
4427
|
+
invoke<MessageType extends keyof PluginMessageAPI>(messageType: MessageType, ...args: Parameters<PluginMessageAPI[MessageType]>): Promise<Awaited<ReturnType<PluginMessageAPI[MessageType]>>>;
|
|
4428
|
+
invokeTransferable<MessageType extends keyof PluginMessageAPI>(messageType: MessageType, transfer: Transferable[] | undefined, ...args: Parameters<PluginMessageAPI[MessageType]>): Promise<Awaited<ReturnType<PluginMessageAPI[MessageType]>>>;
|
|
4429
|
+
subscribe<Topic extends PluginSubscriptionTopic>(topic: Topic, callback: (data: Extract<PluginSubscriptionEvent, {
|
|
4430
|
+
topic: Topic;
|
|
4431
|
+
}>["payload"]) => void): Unsubscribe;
|
|
4432
|
+
onMessage: (eventOrMessage: unknown) => void;
|
|
4433
|
+
private getOnActionFromCallbackMap;
|
|
4434
|
+
applyPluginTheme: (theme: Theme) => void;
|
|
4435
|
+
cloneNode(nodeId: NodeId): Promise<AnyNode | null>;
|
|
4436
|
+
setAttributes(nodeId: NodeId, attributes: Partial<AnyEditableAttributes>): Promise<AnyNode | null>;
|
|
4437
|
+
getParent(nodeId: NodeId): Promise<AnyNode | null>;
|
|
4438
|
+
getChildren(nodeId: NodeId): Promise<CanvasNode[]>;
|
|
4439
|
+
notify: Notify;
|
|
4440
|
+
setMenu(menuItems: MenuItem[]): Promise<void>;
|
|
4441
|
+
showContextMenu(menuItems: MenuItem[], config: ContextMenuConfig): Promise<void>;
|
|
4442
|
+
}
|
|
4443
|
+
|
|
4444
|
+
type AssetId = string;
|
|
4445
|
+
interface AssetIdentifier {
|
|
4446
|
+
id: string;
|
|
4447
|
+
}
|
|
4448
|
+
interface WithOptionalName {
|
|
4449
|
+
name?: string;
|
|
4450
|
+
}
|
|
4451
|
+
interface AssetData extends WithOptionalName {
|
|
4452
|
+
/** Something that can be rendered within the iFrame. Always the original size of the image */
|
|
4453
|
+
url: string;
|
|
4454
|
+
}
|
|
4455
|
+
interface ImageOptions {
|
|
4456
|
+
/**
|
|
4457
|
+
* The image rendering to use.
|
|
4458
|
+
* Defaults to "auto"
|
|
4459
|
+
*/
|
|
4460
|
+
preferredImageRendering?: ImageRendering;
|
|
4461
|
+
/**
|
|
4462
|
+
* The alt text to use for the image.
|
|
4463
|
+
*/
|
|
4464
|
+
altText?: string;
|
|
4465
|
+
/**
|
|
4466
|
+
* The resolution to use for the image.
|
|
4467
|
+
* Defaults to "auto"
|
|
4468
|
+
*/
|
|
4469
|
+
resolution?: Resolution;
|
|
4470
|
+
}
|
|
4471
|
+
interface FileAssetDataFields extends AssetData {
|
|
4472
|
+
extension: string | null;
|
|
4473
|
+
}
|
|
4474
|
+
declare const fileAssetDiscriminator: "FileAsset";
|
|
4475
|
+
interface FileAssetData extends AssetIdentifier, FileAssetDataFields {
|
|
4476
|
+
[classKey]: typeof fileAssetDiscriminator;
|
|
4477
|
+
}
|
|
4478
|
+
declare class FileAsset implements AssetIdentifier, FileAssetDataFields {
|
|
4479
|
+
readonly id: AssetId;
|
|
4480
|
+
readonly url: string;
|
|
4481
|
+
readonly extension: string | null;
|
|
4482
|
+
constructor(data: FileAssetData);
|
|
4483
|
+
static [$framerInternal.unmarshal](_: PluginEngine, data: FileAssetData): FileAsset;
|
|
4484
|
+
[$framerInternal.marshal](): FileAssetData;
|
|
4485
|
+
}
|
|
4486
|
+
declare function isFileAsset(value: unknown): value is FileAsset;
|
|
4487
|
+
interface ImageDataFields extends AssetData {
|
|
4488
|
+
/**
|
|
4489
|
+
* Thumbnail URL of the image.
|
|
4490
|
+
*/
|
|
4491
|
+
thumbnailUrl: string;
|
|
4492
|
+
/**
|
|
4493
|
+
* Optional Alt Text of the image.
|
|
4494
|
+
*/
|
|
4495
|
+
altText?: string;
|
|
4496
|
+
/**
|
|
4497
|
+
* The resolution set on the image. Defaults to "auto"
|
|
4498
|
+
*/
|
|
4499
|
+
resolution: Resolution;
|
|
4500
|
+
}
|
|
4501
|
+
declare const imageAssetDiscriminator: "ImageAsset";
|
|
4502
|
+
interface ImageAssetData extends AssetIdentifier, ImageDataFields {
|
|
4503
|
+
[classKey]: typeof imageAssetDiscriminator;
|
|
4504
|
+
}
|
|
4505
|
+
interface Size {
|
|
4506
|
+
/** Same as [HTMLImageElement.naturalWidth](https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/naturalWidth).
|
|
4507
|
+
*
|
|
4508
|
+
* **Warning**: May be zero!
|
|
4509
|
+
*/
|
|
4510
|
+
width: number;
|
|
4511
|
+
/** Same as [HTMLImageElement.naturalHeight](https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/naturalHeight).
|
|
4512
|
+
*
|
|
4513
|
+
* **Warning**: May be zero!
|
|
4514
|
+
*/
|
|
4515
|
+
height: number;
|
|
4516
|
+
}
|
|
4517
|
+
declare class ImageAsset implements ImageDataFields, AssetIdentifier {
|
|
4518
|
+
#private;
|
|
4519
|
+
readonly id: AssetId;
|
|
4520
|
+
readonly url: string;
|
|
4521
|
+
readonly thumbnailUrl: string;
|
|
4522
|
+
readonly altText: string | undefined;
|
|
4523
|
+
readonly resolution: Resolution;
|
|
4524
|
+
constructor(engine: PluginEngine, data: ImageAssetData);
|
|
4525
|
+
static [$framerInternal.unmarshal](engine: PluginEngine, data: ImageAssetData): ImageAsset;
|
|
4526
|
+
[$framerInternal.marshal](): ImageAssetData;
|
|
4527
|
+
/**
|
|
4528
|
+
* Clone this image, optionally overriding its attributes.
|
|
4529
|
+
*/
|
|
4530
|
+
cloneWithAttributes({ altText, resolution, }: Prettify<Partial<Pick<ImageAssetData, "altText" | "resolution">>>): ImageAsset;
|
|
4531
|
+
/**
|
|
4532
|
+
* Measure this image.
|
|
4533
|
+
*/
|
|
4534
|
+
measure(): Promise<Size>;
|
|
4535
|
+
/**
|
|
4536
|
+
* Get the data such as the bytes of the image. The bytes can be used to manipulate the pixels
|
|
4537
|
+
* of the image.
|
|
4538
|
+
*/
|
|
4539
|
+
getData(): Promise<BytesData>;
|
|
4540
|
+
/**
|
|
4541
|
+
* Load this image as `ImageBitmap`.
|
|
4542
|
+
*/
|
|
4543
|
+
loadBitmap(): Promise<ImageBitmap>;
|
|
4544
|
+
/**
|
|
4545
|
+
* Load this image as `HTMLImageElement`.
|
|
4546
|
+
*/
|
|
4547
|
+
loadImage(): Promise<HTMLImageElement>;
|
|
4548
|
+
}
|
|
4549
|
+
declare function isImageAsset(value: unknown): value is ImageAsset;
|
|
4550
|
+
type AssetInput = string | File | BytesData;
|
|
4551
|
+
interface NamedImageAssetInput extends ImageData {
|
|
4552
|
+
image: AssetInput;
|
|
4553
|
+
}
|
|
4554
|
+
interface NamedFileAssetInput extends WithOptionalName {
|
|
4555
|
+
file: AssetInput;
|
|
4556
|
+
}
|
|
4557
|
+
interface AssetURLDataTransfer {
|
|
4558
|
+
type: "url";
|
|
4559
|
+
url: string;
|
|
4560
|
+
}
|
|
4561
|
+
interface BytesData {
|
|
4562
|
+
bytes: Uint8Array<ArrayBuffer>;
|
|
4563
|
+
mimeType: string;
|
|
4564
|
+
}
|
|
4565
|
+
type BytesDataTransfer = BytesData & {
|
|
4566
|
+
type: "bytes";
|
|
4567
|
+
};
|
|
4568
|
+
type Resolution = "auto" | "lossless" | "small" | "medium" | "large" | "full";
|
|
4569
|
+
interface ImageData extends WithOptionalName, ImageOptions {
|
|
4570
|
+
}
|
|
4571
|
+
type AssetDataTransfer = AssetURLDataTransfer | BytesDataTransfer;
|
|
4572
|
+
type NamedImageTransfer = AssetDataTransfer & ImageData;
|
|
4573
|
+
type NamedAssetTransfer = AssetDataTransfer & WithOptionalName;
|
|
4574
|
+
interface SVGData extends WithOptionalName {
|
|
4575
|
+
svg: string;
|
|
4576
|
+
}
|
|
4577
|
+
|
|
4578
|
+
declare const framer: FramerPluginAPIAlpha;
|
|
4579
|
+
|
|
4580
|
+
declare function configure(environment: Record<string, string | undefined>): void;
|
|
4581
|
+
|
|
4582
|
+
declare const API_MODE_BLOCKED_MESSAGE_TYPES: readonly ["showUI", "hideUI", "closePlugin", "notify", "setMenu", "showContextMenu", "preloadDetachedComponentLayers", "preloadDragPreviewImage", "preloadImageUrlForInsertion", "getSelection", "getActiveCollection", "getActiveManagedCollection", "getActiveLocale", "zoomIntoView", "navigateTo", "getPluginData", "setPluginData", "getPluginDataKeys", "setDragData", "onDragStart", "onDrag", "onDragEnd"];
|
|
4583
|
+
/** Used by ActivePlugin.ts for vekter-side validation */
|
|
4584
|
+
type ApiModeBlockedMethods = (typeof API_MODE_BLOCKED_MESSAGE_TYPES)[number];
|
|
4585
|
+
/** Used to block methods at runtime */
|
|
4586
|
+
declare const PUBLIC_API_BLOCKED_METHODS: readonly ["showUI", "hideUI", "closePlugin", "notify", "setMenu", "showContextMenu", "preloadDetachedComponentLayers", "preloadDragPreviewImage", "preloadImageUrlForInsertion", "getSelection", "getActiveCollection", "getActiveManagedCollection", "getActiveLocale", "zoomIntoView", "navigateTo", "getPluginData", "setPluginData", "getPluginDataKeys", "makeDraggable", "subscribeToSelection", "subscribeToImage", "subscribeToText"];
|
|
4587
|
+
/**
|
|
4588
|
+
* Methods hidden from public API but still available in headless mode.
|
|
4589
|
+
*/
|
|
4590
|
+
declare const HIDDEN_FROM_PUBLIC_API: readonly ["setSelection"];
|
|
4591
|
+
type PublicApiBlockedMethods = (typeof PUBLIC_API_BLOCKED_METHODS)[number] | (typeof HIDDEN_FROM_PUBLIC_API)[number];
|
|
4592
|
+
type FramerHeadlessAPI = Omit<FramerPluginAPIAlpha, PublicApiBlockedMethods>;
|
|
4593
|
+
interface FramerConnectionMethods {
|
|
4594
|
+
disconnect(): Promise<void>;
|
|
4595
|
+
requestId?: string;
|
|
4596
|
+
[Symbol.dispose](): void;
|
|
4597
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
4598
|
+
}
|
|
4599
|
+
type Framer = FramerHeadlessAPI & FramerConnectionMethods;
|
|
4600
|
+
|
|
4601
|
+
declare function connect(projectUrlOrId: string, token?: string): Promise<Framer>;
|
|
4602
|
+
declare function withConnection<T>(projectUrlOrId: string, callback: (framer: Framer) => Promise<T>, token?: string): Promise<T>;
|
|
4603
|
+
|
|
4604
|
+
export { type AllTraits, type AnyNode, type ApiModeBlockedMethods, type ApiVersion1ProjectInfo, type ApiVersion1User, type ArrayControl, type ArrayFieldDataEntry, type ArrayFieldDataEntryInput, type ArrayItem, type ArrayItemData, type ArrayItemInput, type AxisOverflow, type BooleanControl, BooleanField, BooleanVariable, type Border, type BorderControl, type BorderRadius, type BorderRadiusControl, type BorderStyle, BorderVariable, type BorderWidth, type Breakpoint, type CanvasNode, type CanvasRootNode, CodeFile, type CodeFileComponentExport, type CodeFileExport, type CodeFileOverrideExport, CodeFileVersion, Collection, CollectionItem, type CollectionItemData, type CollectionItemInput, type CollectionReferenceControl, CollectionReferenceField, type ColorControl, ColorField, type ColorStop, ColorStyle, ColorVariable, ComponentInstanceNode, ComponentInstancePlaceholder, type ComponentInstancePlaceholderAttributes, type ComponentInstancePlaceholderData, ComponentNode, type ComponentVariable, type ComputedValue, ConicGradient, type Control, type ControlAttributes, type CreateField, type CreateVariable, type CursorControl, type CustomCode, type CustomCodeLocation, type CustomCursorControl, type DateControl, DateField, DateVariable, DesignPageNode, type DiagnosticSpan, type EditableManagedCollectionField, EnumCase, type EnumCaseData, type EnumControl, EnumField, EnumVariable, type Field, type FieldData, type FieldDataEntry, type FieldDataEntryInput, type FieldDataInput, FieldDivider, type FileControl, FileField, FileVariable, type FitContent, type FitImage, Font, type FontControl, type FormattedTextControl, FormattedTextField, FormattedTextVariable, FrameNode, type Framer, type FramerConnectionMethods, FramerPluginClosedError, FramerPluginError, type FusedNumberControl, type GapControl, type Gesture, type Gradient, type GridContentAlignment, type GridItemAlignment, type GridItemColumnSpan, type GridLayout, type HeightConstraint, type HeightLength, ImageAsset, type ImageControl, ImageField, type ImageRendering, ImageVariable, type InlineLocalizationValueByLocale, type IsBreakpoint, type IsComponentGestureVariant, type IsComponentVariant, type LayoutType, type Length, LinearGradient, type LinkControl, LinkField, type LinkRelControl, LinkVariable, type LintConfig, type LintDiagnostic, type LintLink, type Locale, type LocaleId, type LocalizationData, type LocalizationGroup, type LocalizationGroupStatus, type LocalizationGroupStatusByLocale, type LocalizationSource, type LocalizationSourceId, type LocalizationSourceUpdate, type LocalizationValueByLocale, type LocalizedValueStatus, type LocalizedValueUpdate, ManagedCollection, type ManagedCollectionField, type ManagedCollectionFieldInput, type ManagedCollectionItemInput, type Mode, type MultiCollectionReferenceControl, MultiCollectionReferenceField, type NodeAttributeKey, type NodeId, type NodeRuntimeErrorResult, type NumberControl, NumberField, NumberVariable, type ObjectControl, type Overflow, type Ownership, PUBLIC_API_BLOCKED_METHODS, type PaddingControl, type PageScopeControl, type Position, type ProjectInfo, type ProtectedMethod, type Publish, type PublishInfo, RadialGradient, type Rect$1 as Rect, Redirect, type RedirectInput, SVGNode, type ScrollSectionControl, type SetLocalizationDataResult, type ShadowControl, type ShowProgressOnInstancesAttributes, type StackAlignment, type StackDirection, type StackDistribution, type StackLayout, type StringControl, StringField, StringVariable, type TextAlignment, type TextDecoration, TextNode, TextStyle, type TextStyleBreakpoint, type TextStyleTag, type TextTransform, type TrackingIdControl, type TraitVariant, type TraitVariantData, type TraitVariantNode, type TransitionControl, type TypecheckDiagnostic, UnsupportedComputedValue, UnsupportedField, UnsupportedVariable, type UpdateFieldAttributes, type User, type Variable, VectorSet, type VectorSetData, VectorSetItem, type VectorSetItemControl, type VectorSetItemData, VectorSetItemNode, type VectorSetItemVariable, VectorSetNode, WebPageNode, type WidthConstraint, type WidthLength, type WithAspectRatioTrait, type WithBackgroundColorTrait, type WithBackgroundGradientTrait, type WithBackgroundImageTrait, type WithBorderRadiusTrait, type WithBorderTrait, type WithBreakpointTrait, type WithComponentInfoTrait, type WithComponentVariantTrait, type WithControlAttributesTrait, type WithFontTrait, type WithGridItemTrait, type WithIdTrait, type WithImageRenderingTrait, type WithInlineTextStyleTrait, type WithLayoutTrait, type WithLinkTrait, type WithLockedTrait, type WithNameTrait, type WithNullableComponentInfoTrait, type WithOpacityTrait, type WithOverflowTrait, type WithPinsTrait, type WithPositionTrait, type WithReplicaInfoTrait, type WithRequiredComponentInfoTrait, type WithRotationTrait, type WithSVGTrait, type WithSizeConstraintsTrait, type WithSizeTrait, type WithTextTruncationTrait, type WithVisibleTrait, type WithWebPageInfoTrait, type WithZIndexTrait, configure, connect, framer, hasGridLayout, hasStackLayout, isBreakpoint, isCodeFileComponentExport, isCodeFileOverrideExport, isColorStyle, isComponentGestureVariant, isComponentInstanceNode, isComponentNode, isComponentVariable, isComponentVariant, isComputedValue, isDesignPageNode, isField, isFileAsset, isFrameNode, isImageAsset, isSVGNode, isTextNode, isTextStyle, isVariable, isVectorSetItemNode, isVectorSetNode, isWebPageNode, supportsAspectRatio, supportsBackgroundColor, supportsBackgroundColorData, supportsBackgroundGradient, supportsBackgroundGradientData, supportsBackgroundImage, supportsBackgroundImageData, supportsBorder, supportsBorderRadius, supportsBreakpoint, supportsComponentInfo, supportsComponentVariant, supportsFont, supportsFontData, supportsImageRendering, supportsInlineTextStyle, supportsInlineTextStyleData, supportsLayout, supportsLink, supportsLocked, supportsName, supportsOpacity, supportsOverflow, supportsPins, supportsPosition, supportsRotation, supportsSVG, supportsSize, supportsSizeConstraints, supportsTextTruncation, supportsVisible, supportsZIndex, withConnection };
|