@plasmicapp/host 1.0.129 → 1.0.131

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.
Files changed (36) hide show
  1. package/dist/canvas-host.d.ts +41 -41
  2. package/dist/common.d.ts +1 -1
  3. package/dist/data.d.ts +43 -43
  4. package/dist/element-types.d.ts +115 -115
  5. package/dist/exports.d.ts +10 -10
  6. package/dist/fetcher.d.ts +40 -40
  7. package/dist/global-actions.d.ts +9 -9
  8. package/dist/host.esm.js +441 -406
  9. package/dist/host.esm.js.map +1 -1
  10. package/dist/index.cjs.js +457 -422
  11. package/dist/index.cjs.js.map +1 -1
  12. package/dist/index.d.ts +1 -1
  13. package/dist/lang-utils.d.ts +3 -3
  14. package/dist/registerComponent.d.ts +590 -589
  15. package/dist/registerGlobalContext.d.ts +75 -75
  16. package/dist/registerToken.d.ts +13 -13
  17. package/dist/registerTrait.d.ts +20 -20
  18. package/dist/repeatedElement.d.ts +15 -15
  19. package/dist/useForceUpdate.d.ts +1 -1
  20. package/dist/version.d.ts +1 -1
  21. package/package.json +5 -6
  22. package/registerComponent/dist/element-types.d.ts +115 -115
  23. package/registerComponent/dist/index.cjs.js +12 -12
  24. package/registerComponent/dist/index.esm.js +12 -12
  25. package/registerComponent/dist/registerComponent.d.ts +590 -589
  26. package/registerGlobalContext/dist/element-types.d.ts +115 -115
  27. package/registerGlobalContext/dist/index.cjs.js +12 -12
  28. package/registerGlobalContext/dist/index.esm.js +12 -12
  29. package/registerGlobalContext/dist/registerComponent.d.ts +590 -589
  30. package/registerGlobalContext/dist/registerGlobalContext.d.ts +75 -75
  31. package/registerToken/dist/index.cjs.js +6 -6
  32. package/registerToken/dist/index.esm.js +6 -6
  33. package/registerToken/dist/registerToken.d.ts +13 -13
  34. package/registerTrait/dist/index.cjs.js +9 -9
  35. package/registerTrait/dist/index.esm.js +9 -9
  36. package/registerTrait/dist/registerTrait.d.ts +20 -20
@@ -1,589 +1,590 @@
1
- /// <reference types="react" />
2
- import { CodeComponentElement, CSSProperties, PlasmicElement } from "./element-types";
3
- export interface CanvasComponentProps<Data = any> {
4
- /**
5
- * This prop is only provided within the canvas of Plasmic Studio.
6
- * Allows the component to set data to be consumed by the props' controls.
7
- */
8
- setControlContextData?: (data: Data) => void;
9
- }
10
- declare type InferDataType<P> = P extends CanvasComponentProps<infer Data> ? Data : any;
11
- export declare type ControlExtras = {
12
- path: (string | number)[];
13
- };
14
- /**
15
- * Context that we pass back to control functions.
16
- */
17
- export declare type ControlContext<P> = [
18
- /**
19
- * props
20
- */
21
- P,
22
- /**
23
- * `contextData` can be `null` if the prop controls are rendering before
24
- * the component instance itself (it will re-render once the component
25
- * calls `setControlContextData`)
26
- */
27
- InferDataType<P> | null,
28
- /**
29
- * Extra information for the control to use
30
- */
31
- ControlExtras];
32
- /**
33
- * Config option that takes the context (e.g., props) of the component instance
34
- * to dynamically set its value.
35
- */
36
- export declare type ContextDependentConfig<P, R> = (...args: ControlContext<P>) => R;
37
- export interface PropTypeBase<P> {
38
- displayName?: string;
39
- description?: string;
40
- helpText?: string;
41
- /**
42
- * If the user has chosen to use a dynamic expression for this prop, provide
43
- * a hint as to the expected values that the expression should evaluate to.
44
- * This hint will be displayed alongside the code editor. You may use
45
- * markdown in the text here.
46
- */
47
- exprHint?: string;
48
- /**
49
- * Function for whether this prop should be hidden in the right panel,
50
- * given the current props for this component
51
- */
52
- hidden?: ContextDependentConfig<P, boolean>;
53
- readOnly?: boolean | ContextDependentConfig<P, boolean>;
54
- /**
55
- * If true, will hide the prop in a collapsed section; good for props that
56
- * should not usually be used.
57
- */
58
- advanced?: boolean;
59
- /**
60
- * If true, does not allow the user to use a dynamic expression for this prop
61
- */
62
- disableDynamicValue?: boolean;
63
- /**
64
- * If set to true, the component will be remounted when the prop value is updated.
65
- * (This behavior only appliees to canvas)
66
- */
67
- forceRemount?: boolean;
68
- }
69
- export declare type DefaultValueOrExpr<P, T> = {
70
- defaultExpr?: undefined;
71
- defaultExprHint?: undefined;
72
- defaultValue?: T;
73
- defaultValueHint?: T | ContextDependentConfig<P, T | undefined>;
74
- } | {
75
- defaultValue?: undefined;
76
- defaultValueHint?: undefined;
77
- defaultExpr?: string;
78
- defaultExprHint?: string;
79
- };
80
- declare type StringTypeBase<P> = PropTypeBase<P> & DefaultValueOrExpr<P, string>;
81
- export declare type StringType<P> = "string" | (({
82
- type: "string";
83
- control?: "default" | "large";
84
- } | {
85
- type: "code";
86
- lang: "css" | "html" | "javascript" | "json";
87
- } | {
88
- type: "richText";
89
- } | {
90
- type: "color";
91
- /**
92
- * If specified, and the user picks a color token in the Studio, then
93
- * the value passed in as prop is a css variable reference, like
94
- * `var(--TOKEN_ID)`, instead of the resolved hex value of the token.
95
- * You should take care in using this in the proper css context --
96
- * the css token is only defined if you are rendering under some
97
- * Plasmic component in the DOM tree, which is usually the case,
98
- * unless you are using a React portal.
99
- */
100
- keepCssVar?: boolean;
101
- } | {
102
- type: "class";
103
- /**
104
- * Additional css selectors that can change how this style should look.
105
- * Some examples:
106
- *
107
- * * `:hover` -- on hover
108
- * * `[data-something="blah"] -- when the element with this class has
109
- * an html attribute "data-something=blah"
110
- * * :component[data-something="blah"] :self -- when the root of the
111
- * component has an html attribute "data-something=blah". Note that
112
- * the non-standard `:component` selector is used to select the
113
- * component root, and the non-standard `:self` selector is used
114
- * to select the element that this class is attached to.
115
- */
116
- selectors?: {
117
- /**
118
- * A css selector, like `:hover` or `[data-something="blah"]`.
119
- */
120
- selector: string;
121
- /**
122
- * An optional human-friendly label for the selector, so the studio user
123
- * knows what this selector means.
124
- */
125
- label?: string;
126
- }[];
127
- /**
128
- * If specified, then only shows these style sections for styling this class
129
- */
130
- styleSections?: StyleSection[];
131
- } | {
132
- type: "themeResetClass";
133
- /**
134
- * Normally, theme reset class will only target Plasmic-generated tags
135
- * with the default tag styles. If you also want to target non-Plasmic-generated
136
- * tags (say, rendered by your code components, or fetched as an HTML blob
137
- * from somewhere), then specify `true` here.
138
- */
139
- targetAllTags?: boolean;
140
- } | {
141
- type: "cardPicker";
142
- modalTitle?: React.ReactNode | ContextDependentConfig<P, React.ReactNode>;
143
- options: {
144
- value: string;
145
- label?: string;
146
- imgUrl: string;
147
- footer?: React.ReactNode;
148
- }[] | ContextDependentConfig<P, {
149
- value: string;
150
- label?: string;
151
- imgUrl: string;
152
- footer?: React.ReactNode;
153
- }[]>;
154
- showInput?: boolean | ContextDependentConfig<P, boolean>;
155
- onSearch?: ContextDependentConfig<P, ((value: string) => void) | undefined>;
156
- }) & StringTypeBase<P>);
157
- export declare type BooleanType<P> = "boolean" | ({
158
- type: "boolean";
159
- } & DefaultValueOrExpr<P, boolean> & PropTypeBase<P>);
160
- declare type GraphQLValue = {
161
- query: string;
162
- variables?: Record<string, any>;
163
- };
164
- export declare type GraphQLType<P> = {
165
- type: "code";
166
- lang: "graphql";
167
- endpoint: string | ContextDependentConfig<P, string>;
168
- method?: string | ContextDependentConfig<P, string>;
169
- headers?: object | ContextDependentConfig<P, object>;
170
- } & DefaultValueOrExpr<P, GraphQLValue> & PropTypeBase<P>;
171
- declare type NumberTypeBase<P> = PropTypeBase<P> & DefaultValueOrExpr<P, number> & {
172
- type: "number";
173
- };
174
- export declare type NumberType<P> = "number" | (({
175
- control?: "default";
176
- min?: number | ContextDependentConfig<P, number>;
177
- max?: number | ContextDependentConfig<P, number>;
178
- } | {
179
- control: "slider";
180
- min: number | ContextDependentConfig<P, number>;
181
- max: number | ContextDependentConfig<P, number>;
182
- step?: number | ContextDependentConfig<P, number>;
183
- }) & NumberTypeBase<P>);
184
- /**
185
- * Expects defaultValue to be a JSON-compatible value
186
- */
187
- export declare type JSONLikeType<P> = "object" | ({
188
- type: "object";
189
- fields?: {
190
- [p: string]: PropType<P>;
191
- };
192
- /**
193
- * Optional function that generates a name for this item in the array
194
- */
195
- nameFunc?: (item: any, ...args: ControlContext<P>) => string | undefined;
196
- } & DefaultValueOrExpr<P, any> & PropTypeBase<P>) | ({
197
- type: "array";
198
- itemType?: {
199
- type: "object";
200
- fields: {
201
- [p: string]: PropType<P>;
202
- };
203
- /**
204
- * Optional function that generates a name for this item in the array
205
- */
206
- nameFunc?: (item: any, ...args: ControlContext<P>) => string | undefined;
207
- };
208
- /**
209
- * Optional function that determines whether the user can delete a given item.
210
- */
211
- unstable__canDelete?: (item: any, ...args: ControlContext<P>) => boolean;
212
- /**
213
- * Specify how to let Plasmic know how to update its own internal representation of the data when the value has
214
- * changed, or when issuing a minimalValue or shownValue that is different.
215
- *
216
- * Important to specify this if you are expecting any nested expression values in this data type!
217
- */
218
- unstable__keyFunc?: (item: any) => any;
219
- /**
220
- * Specify what would be the tentative new value that is set if the user makes any changes.
221
- *
222
- * Useful for field mappings.
223
- *
224
- * For instance, consider a Table where we have a `fields` prop:
225
- *
226
- * - Initially, the value is undefined. But if the user makes any changes, we would want to save an array of at
227
- * least three items (corresponding to, say, three columns inferred from a schema).
228
- *
229
- * - Let's say there are 5 columns in the value. The data schema changes, removing a column and adding two new
230
- * ones. Now we would want a different minimal value, containing 6 items.
231
- */
232
- unstable__minimalValue?: ContextDependentConfig<P, any>;
233
- } & DefaultValueOrExpr<P, any[]> & PropTypeBase<P>) | ({
234
- type: "dataSource";
235
- dataSource: "airtable" | "cms";
236
- } & PropTypeBase<P>);
237
- declare type DataPickerValueType = string | number | (string | number)[];
238
- export declare type DataPickerType<P> = ({
239
- type: "dataSelector";
240
- data: Record<string, any> | ContextDependentConfig<P, Record<string, any>>;
241
- alwaysShowValuePathAsLabel?: boolean;
242
- } & DefaultValueOrExpr<P, DataPickerValueType> & PropTypeBase<P>) | ({
243
- type: "exprEditor";
244
- data: Record<string, any> | ContextDependentConfig<P, Record<string, any>>;
245
- } & DefaultValueOrExpr<P, DataPickerValueType> & PropTypeBase<P>);
246
- export declare type FormValidationRulesType<P> = {
247
- type: "formValidationRules";
248
- } & DefaultValueOrExpr<P, any> & PropTypeBase<P>;
249
- export declare type EventHandlerType<P> = {
250
- type: "eventHandler";
251
- argTypes: {
252
- name: string;
253
- type: PropType<any>;
254
- }[];
255
- } & DefaultValueOrExpr<P, (...args: any) => any> & PropTypeBase<P>;
256
- interface ChoiceTypeBase<P> extends PropTypeBase<P> {
257
- type: "choice";
258
- options: string[] | {
259
- label: string;
260
- value: string | number | boolean;
261
- }[] | ContextDependentConfig<P, string[] | {
262
- label: string;
263
- value: string | number | boolean;
264
- }[]>;
265
- allowSearch?: boolean;
266
- filterOption?: boolean;
267
- onSearch?: ContextDependentConfig<P, ((value: string) => void) | undefined>;
268
- }
269
- export declare type ChoiceType<P> = (({
270
- multiSelect?: false;
271
- } & DefaultValueOrExpr<P, string | number | boolean>) | ({
272
- multiSelect: true;
273
- } & DefaultValueOrExpr<P, (string | number | boolean)[]>) | ({
274
- multiSelect: ContextDependentConfig<P, boolean>;
275
- } & DefaultValueOrExpr<P, string | number | boolean | (string | number | boolean)[]>)) & ChoiceTypeBase<P>;
276
- export interface ModalProps {
277
- show?: boolean;
278
- children?: React.ReactNode;
279
- onClose: () => void;
280
- style?: CSSProperties;
281
- }
282
- interface CustomControlProps<P> {
283
- componentProps: P;
284
- /**
285
- * `contextData` can be `null` if the prop controls are rendering before
286
- * the component instance itself (it will re-render once the component
287
- * calls `setControlContextData`)
288
- */
289
- contextData: InferDataType<P> | null;
290
- value: any;
291
- /**
292
- * Sets the value to be passed to the prop. Expects a JSON-compatible value.
293
- */
294
- updateValue: (newVal: any) => void;
295
- /**
296
- * Full screen modal component
297
- */
298
- FullscreenModal: React.ComponentType<ModalProps>;
299
- /**
300
- * Modal component for the side pane
301
- */
302
- SideModal: React.ComponentType<ModalProps>;
303
- /**
304
- * The document that the component will be rendered into; instead of using
305
- * `document` directly (for, say, `document.querySelector()` etc.), you
306
- * should use this instead.
307
- */
308
- studioDocument: typeof document;
309
- }
310
- export declare type CustomControl<P> = React.ComponentType<CustomControlProps<P>>;
311
- /**
312
- * Expects defaultValue to be a JSON-compatible value
313
- */
314
- export declare type CustomType<P> = CustomControl<P> | ({
315
- type: "custom";
316
- control: CustomControl<P>;
317
- } & PropTypeBase<P> & DefaultValueOrExpr<P, any>);
318
- declare type SlotType<P> = "slot" | ({
319
- type: "slot";
320
- /**
321
- * The unique names of all code components that can be placed in the slot
322
- */
323
- allowedComponents?: string[];
324
- /**
325
- * Whether the "empty slot" placeholder should be hidden in the canvas.
326
- */
327
- hidePlaceholder?: boolean;
328
- /**
329
- * Whether the slot is repeated, i.e., is rendered multiple times using
330
- * repeatedElement().
331
- */
332
- isRepeated?: boolean;
333
- /**
334
- * A nicer, human-readable display name for your slot prop
335
- */
336
- displayName?: string;
337
- /**
338
- * Function for whether this slot should be hidden from the left tree,
339
- * given the current props for this component
340
- */
341
- hidden?: ContextDependentConfig<P, boolean>;
342
- /**
343
- * If slot is a render prop (accepts a function that takes in some
344
- * arguments and returns some JSX), then specify the names of the
345
- * arguments expected by the render prop function.
346
- */
347
- renderPropParams?: string[];
348
- } & Omit<DefaultValueOrExpr<P, PlasmicElement | PlasmicElement[]>, "defaultValueHint" | "defaultExpr" | "defaultExprHint">);
349
- declare type ImageUrlType<P> = "imageUrl" | ({
350
- type: "imageUrl";
351
- } & DefaultValueOrExpr<P, string> & PropTypeBase<P>);
352
- export declare type PrimitiveType<P = any> = Extract<StringType<P> | BooleanType<P> | NumberType<P> | JSONLikeType<P>, String>;
353
- declare type ControlTypeBase = {
354
- editOnly?: false;
355
- } | {
356
- editOnly: true;
357
- /**
358
- * The prop where the values should be mapped to
359
- */
360
- uncontrolledProp?: string;
361
- };
362
- export declare type SupportControlled<T> = Extract<T, String | CustomControl<any>> | (Exclude<T, String | CustomControl<any>> & ControlTypeBase);
363
- export declare type PropType<P> = SupportControlled<StringType<P> | BooleanType<P> | NumberType<P> | JSONLikeType<P> | ChoiceType<P> | ImageUrlType<P> | CustomType<P> | GraphQLType<P> | DataPickerType<P> | FormValidationRulesType<P> | EventHandlerType<P>> | SlotType<P>;
364
- declare type RestrictPropType<T, P> = T extends string ? SupportControlled<StringType<P> | ChoiceType<P> | JSONLikeType<P> | ImageUrlType<P> | CustomType<P> | DataPickerType<P>> : T extends boolean ? SupportControlled<BooleanType<P> | JSONLikeType<P> | CustomType<P> | DataPickerType<P>> : T extends number ? SupportControlled<NumberType<P> | JSONLikeType<P> | CustomType<P> | DataPickerType<P>> : PropType<P>;
365
- export interface ActionProps<P> {
366
- componentProps: P;
367
- /**
368
- * `contextData` can be `null` if the prop controls are rendering before
369
- * the component instance itself (it will re-render once the component
370
- * calls `setControlContextData`)
371
- */
372
- contextData: InferDataType<P> | null;
373
- studioOps: {
374
- showModal: (modalProps: Omit<ModalProps, "onClose"> & {
375
- onClose?: () => void;
376
- }) => void;
377
- refreshQueryData: () => void;
378
- appendToSlot: (element: PlasmicElement, slotName: string) => void;
379
- removeFromSlotAt: (pos: number, slotName: string) => void;
380
- updateProps: (newValues: any) => void;
381
- };
382
- /**
383
- * The document that the component will be rendered into; instead of using
384
- * `document` directly (for, say, `document.querySelector()` etc.), you
385
- * should use this instead.
386
- */
387
- studioDocument: typeof document;
388
- }
389
- export declare type Action<P> = {
390
- type: "button-action";
391
- label: string;
392
- onClick: (props: ActionProps<P>) => void;
393
- } | {
394
- type: "custom-action";
395
- control: React.ComponentType<ActionProps<P>>;
396
- };
397
- declare type DistributedKeyOf<T> = T extends any ? keyof T : never;
398
- interface ComponentTemplate<P> extends Omit<CodeComponentElement<P>, "type" | "name"> {
399
- /**
400
- * A preview picture for the template.
401
- */
402
- previewImg?: string;
403
- }
404
- export interface ComponentTemplates<P> {
405
- [name: string]: ComponentTemplate<P>;
406
- }
407
- export declare type StateSpec = {
408
- onChangeProp: string;
409
- } & ({
410
- type: "readonly";
411
- variableType: "text";
412
- initVal?: string;
413
- } | {
414
- type: "readonly";
415
- variableType: "number";
416
- initVal?: number;
417
- } | {
418
- type: "readonly";
419
- variableType: "boolean";
420
- initVal?: boolean;
421
- } | {
422
- type: "readonly";
423
- variableType: "array";
424
- initVal?: any[];
425
- } | {
426
- type: "readonly";
427
- variableType: "object";
428
- initVal?: object;
429
- } | {
430
- type: "writable";
431
- variableType: "text" | "number" | "boolean" | "array" | "object";
432
- valueProp: string;
433
- });
434
- export interface StateHelpers<P, T> {
435
- initFunc?: ($props: P) => T;
436
- onChangeArgsToValue?: (...args: any) => T;
437
- }
438
- export declare type ComponentHelpers<P> = {
439
- states: Record<string, StateHelpers<P, any>>;
440
- };
441
- export declare type ExternalComponentHelpers<P> = {
442
- helpers: ComponentHelpers<P>;
443
- importPath: string;
444
- } & ({
445
- importName: string;
446
- } | {
447
- isDefaultExport: true;
448
- });
449
- export declare type StyleSection = "visibility" | "typography" | "sizing" | "spacing" | "background" | "transform" | "transitions" | "layout" | "overflow" | "border" | "shadows" | "effects";
450
- export interface CodeComponentMeta<P> {
451
- /**
452
- * Any unique string name used to identify that component. Each component
453
- * should be registered with a different `meta.name`, even if they have the
454
- * same name in the code.
455
- */
456
- name: string;
457
- /**
458
- * The name to be displayed for the component in Studio. Optional: if not
459
- * specified, `meta.name` is used.
460
- */
461
- displayName?: string;
462
- /**
463
- * The description of the component to be shown in Studio.
464
- */
465
- description?: string;
466
- /**
467
- * The javascript name to be used when generating code. Optional: if not
468
- * provided, `meta.name` is used.
469
- */
470
- importName?: string;
471
- /**
472
- * An object describing the component properties to be used in Studio.
473
- * For each `prop`, there should be an entry `meta.props[prop]` describing
474
- * its type.
475
- */
476
- props: {
477
- [prop in DistributedKeyOf<P>]?: RestrictPropType<P[prop], P>;
478
- } & {
479
- [prop: string]: PropType<P>;
480
- };
481
- /**
482
- * An object describing the component states to be used in Studio.
483
- */
484
- states?: Record<string, StateSpec>;
485
- /**
486
- * An object describing the components helpers to be used in Studio.
487
- * 1. states helpers: Each state can receive an "initFunc" prop to initialize
488
- * the implicit state in Studio, and an "onChangeArgsToValue" prop to
489
- * transform the event handler arguments into a value
490
- */
491
- componentHelpers?: ExternalComponentHelpers<P>;
492
- /**
493
- * An array describing the component actions to be used in Studio.
494
- */
495
- actions?: Action<P>[];
496
- /**
497
- * Whether style sections should be shown in Studio. For styles to work, the
498
- * component must accept a `className` prop. If unset, defaults to all styles.
499
- * Set to `false` if this component cannot be styled (for example, if it doesn't
500
- * render any DOM elements).
501
- */
502
- styleSections?: StyleSection[] | boolean;
503
- /**
504
- * Whether the element can be repeated in Studio. If unset, defaults to true.
505
- */
506
- isRepeatable?: boolean;
507
- /**
508
- * The path to be used when importing the component in the generated code.
509
- * It can be the name of the package that contains the component, or the path
510
- * to the file in the project (relative to the root directory).
511
- */
512
- importPath: string;
513
- /**
514
- * Whether the component is the default export from that path. Optional: if
515
- * not specified, it's considered `false`.
516
- */
517
- isDefaultExport?: boolean;
518
- /**
519
- * The prop that expects the CSS classes with styles to be applied to the
520
- * component. Optional: if not specified, Plasmic will expect it to be
521
- * `className`. Notice that if the component does not accept CSS classes, the
522
- * component will not be able to receive styles from the Studio.
523
- */
524
- classNameProp?: string;
525
- /**
526
- * The prop that receives and forwards a React `ref`. Plasmic only uses `ref`
527
- * to interact with components, so it's not used in the generated code.
528
- * Optional: If not provided, the usual `ref` is used.
529
- */
530
- refProp?: string;
531
- /**
532
- * Default styles to start with when instantiating the component in Plasmic.
533
- */
534
- defaultStyles?: CSSProperties;
535
- /**
536
- * Component templates to start with on Plasmic.
537
- */
538
- templates?: ComponentTemplates<P>;
539
- /**
540
- * Registered name of parent component, used for grouping related components.
541
- */
542
- parentComponentName?: string;
543
- /**
544
- * Whether the component can be used as an attachment to an element.
545
- */
546
- isAttachment?: boolean;
547
- /**
548
- * Whether the component provides data to its slots using DataProvider.
549
- */
550
- providesData?: boolean;
551
- /**
552
- * If specified, then Figma components with the specified names will be mapped
553
- * to this component when you paste Figma content into Plasmic
554
- */
555
- figmaMappings?: {
556
- figmaComponentName: string;
557
- }[];
558
- /**
559
- * If true, when an instance of this component is added, the element
560
- * will always be named by the name of this component.
561
- */
562
- alwaysAutoName?: boolean;
563
- unstable__refActions?: Record<string, RefActionRegistration<P>>;
564
- }
565
- /**
566
- * @deprecated use CodeComponentMeta instead
567
- */
568
- export declare type ComponentMeta<P> = CodeComponentMeta<P>;
569
- export interface FunctionParam<P> {
570
- name: string;
571
- displayName?: string;
572
- type: PropType<P>;
573
- }
574
- export interface RefActionRegistration<P> {
575
- displayName?: string;
576
- description?: string;
577
- parameters: FunctionParam<P>[];
578
- }
579
- export interface ComponentRegistration {
580
- component: React.ComponentType<any>;
581
- meta: CodeComponentMeta<any>;
582
- }
583
- declare global {
584
- interface Window {
585
- __PlasmicComponentRegistry: ComponentRegistration[];
586
- }
587
- }
588
- export default function registerComponent<T extends React.ComponentType<any>>(component: T, meta: CodeComponentMeta<React.ComponentProps<T>>): void;
589
- export {};
1
+ /// <reference types="react" />
2
+ import { CodeComponentElement, CSSProperties, PlasmicElement } from "./element-types";
3
+ export interface CanvasComponentProps<Data = any> {
4
+ /**
5
+ * This prop is only provided within the canvas of Plasmic Studio.
6
+ * Allows the component to set data to be consumed by the props' controls.
7
+ */
8
+ setControlContextData?: (data: Data) => void;
9
+ }
10
+ type InferDataType<P> = P extends CanvasComponentProps<infer Data> ? Data : any;
11
+ export type ControlExtras = {
12
+ path: (string | number)[];
13
+ };
14
+ /**
15
+ * Context that we pass back to control functions.
16
+ */
17
+ export type ControlContext<P> = [
18
+ /**
19
+ * props
20
+ */
21
+ P,
22
+ /**
23
+ * `contextData` can be `null` if the prop controls are rendering before
24
+ * the component instance itself (it will re-render once the component
25
+ * calls `setControlContextData`)
26
+ */
27
+ InferDataType<P> | null,
28
+ /**
29
+ * Extra information for the control to use
30
+ */
31
+ ControlExtras
32
+ ];
33
+ /**
34
+ * Config option that takes the context (e.g., props) of the component instance
35
+ * to dynamically set its value.
36
+ */
37
+ export type ContextDependentConfig<P, R> = (...args: ControlContext<P>) => R;
38
+ export interface PropTypeBase<P> {
39
+ displayName?: string;
40
+ description?: string;
41
+ helpText?: string;
42
+ /**
43
+ * If the user has chosen to use a dynamic expression for this prop, provide
44
+ * a hint as to the expected values that the expression should evaluate to.
45
+ * This hint will be displayed alongside the code editor. You may use
46
+ * markdown in the text here.
47
+ */
48
+ exprHint?: string;
49
+ /**
50
+ * Function for whether this prop should be hidden in the right panel,
51
+ * given the current props for this component
52
+ */
53
+ hidden?: ContextDependentConfig<P, boolean>;
54
+ readOnly?: boolean | ContextDependentConfig<P, boolean>;
55
+ /**
56
+ * If true, will hide the prop in a collapsed section; good for props that
57
+ * should not usually be used.
58
+ */
59
+ advanced?: boolean;
60
+ /**
61
+ * If true, does not allow the user to use a dynamic expression for this prop
62
+ */
63
+ disableDynamicValue?: boolean;
64
+ /**
65
+ * If set to true, the component will be remounted when the prop value is updated.
66
+ * (This behavior only appliees to canvas)
67
+ */
68
+ forceRemount?: boolean;
69
+ }
70
+ export type DefaultValueOrExpr<P, T> = {
71
+ defaultExpr?: undefined;
72
+ defaultExprHint?: undefined;
73
+ defaultValue?: T;
74
+ defaultValueHint?: T | ContextDependentConfig<P, T | undefined>;
75
+ } | {
76
+ defaultValue?: undefined;
77
+ defaultValueHint?: undefined;
78
+ defaultExpr?: string;
79
+ defaultExprHint?: string;
80
+ };
81
+ type StringTypeBase<P> = PropTypeBase<P> & DefaultValueOrExpr<P, string>;
82
+ export type StringType<P> = "string" | (({
83
+ type: "string";
84
+ control?: "default" | "large";
85
+ } | {
86
+ type: "code";
87
+ lang: "css" | "html" | "javascript" | "json";
88
+ } | {
89
+ type: "richText";
90
+ } | {
91
+ type: "color";
92
+ /**
93
+ * If specified, and the user picks a color token in the Studio, then
94
+ * the value passed in as prop is a css variable reference, like
95
+ * `var(--TOKEN_ID)`, instead of the resolved hex value of the token.
96
+ * You should take care in using this in the proper css context --
97
+ * the css token is only defined if you are rendering under some
98
+ * Plasmic component in the DOM tree, which is usually the case,
99
+ * unless you are using a React portal.
100
+ */
101
+ keepCssVar?: boolean;
102
+ } | {
103
+ type: "class";
104
+ /**
105
+ * Additional css selectors that can change how this style should look.
106
+ * Some examples:
107
+ *
108
+ * * `:hover` -- on hover
109
+ * * `[data-something="blah"] -- when the element with this class has
110
+ * an html attribute "data-something=blah"
111
+ * * :component[data-something="blah"] :self -- when the root of the
112
+ * component has an html attribute "data-something=blah". Note that
113
+ * the non-standard `:component` selector is used to select the
114
+ * component root, and the non-standard `:self` selector is used
115
+ * to select the element that this class is attached to.
116
+ */
117
+ selectors?: {
118
+ /**
119
+ * A css selector, like `:hover` or `[data-something="blah"]`.
120
+ */
121
+ selector: string;
122
+ /**
123
+ * An optional human-friendly label for the selector, so the studio user
124
+ * knows what this selector means.
125
+ */
126
+ label?: string;
127
+ }[];
128
+ /**
129
+ * If specified, then only shows these style sections for styling this class
130
+ */
131
+ styleSections?: StyleSection[];
132
+ } | {
133
+ type: "themeResetClass";
134
+ /**
135
+ * Normally, theme reset class will only target Plasmic-generated tags
136
+ * with the default tag styles. If you also want to target non-Plasmic-generated
137
+ * tags (say, rendered by your code components, or fetched as an HTML blob
138
+ * from somewhere), then specify `true` here.
139
+ */
140
+ targetAllTags?: boolean;
141
+ } | {
142
+ type: "cardPicker";
143
+ modalTitle?: React.ReactNode | ContextDependentConfig<P, React.ReactNode>;
144
+ options: {
145
+ value: string;
146
+ label?: string;
147
+ imgUrl: string;
148
+ footer?: React.ReactNode;
149
+ }[] | ContextDependentConfig<P, {
150
+ value: string;
151
+ label?: string;
152
+ imgUrl: string;
153
+ footer?: React.ReactNode;
154
+ }[]>;
155
+ showInput?: boolean | ContextDependentConfig<P, boolean>;
156
+ onSearch?: ContextDependentConfig<P, ((value: string) => void) | undefined>;
157
+ }) & StringTypeBase<P>);
158
+ export type BooleanType<P> = "boolean" | ({
159
+ type: "boolean";
160
+ } & DefaultValueOrExpr<P, boolean> & PropTypeBase<P>);
161
+ type GraphQLValue = {
162
+ query: string;
163
+ variables?: Record<string, any>;
164
+ };
165
+ export type GraphQLType<P> = {
166
+ type: "code";
167
+ lang: "graphql";
168
+ endpoint: string | ContextDependentConfig<P, string>;
169
+ method?: string | ContextDependentConfig<P, string>;
170
+ headers?: object | ContextDependentConfig<P, object>;
171
+ } & DefaultValueOrExpr<P, GraphQLValue> & PropTypeBase<P>;
172
+ type NumberTypeBase<P> = PropTypeBase<P> & DefaultValueOrExpr<P, number> & {
173
+ type: "number";
174
+ };
175
+ export type NumberType<P> = "number" | (({
176
+ control?: "default";
177
+ min?: number | ContextDependentConfig<P, number>;
178
+ max?: number | ContextDependentConfig<P, number>;
179
+ } | {
180
+ control: "slider";
181
+ min: number | ContextDependentConfig<P, number>;
182
+ max: number | ContextDependentConfig<P, number>;
183
+ step?: number | ContextDependentConfig<P, number>;
184
+ }) & NumberTypeBase<P>);
185
+ /**
186
+ * Expects defaultValue to be a JSON-compatible value
187
+ */
188
+ export type JSONLikeType<P> = "object" | ({
189
+ type: "object";
190
+ fields?: {
191
+ [p: string]: PropType<P>;
192
+ };
193
+ /**
194
+ * Optional function that generates a name for this item in the array
195
+ */
196
+ nameFunc?: (item: any, ...args: ControlContext<P>) => string | undefined;
197
+ } & DefaultValueOrExpr<P, any> & PropTypeBase<P>) | ({
198
+ type: "array";
199
+ itemType?: {
200
+ type: "object";
201
+ fields: {
202
+ [p: string]: PropType<P>;
203
+ };
204
+ /**
205
+ * Optional function that generates a name for this item in the array
206
+ */
207
+ nameFunc?: (item: any, ...args: ControlContext<P>) => string | undefined;
208
+ };
209
+ /**
210
+ * Optional function that determines whether the user can delete a given item.
211
+ */
212
+ unstable__canDelete?: (item: any, ...args: ControlContext<P>) => boolean;
213
+ /**
214
+ * Specify how to let Plasmic know how to update its own internal representation of the data when the value has
215
+ * changed, or when issuing a minimalValue or shownValue that is different.
216
+ *
217
+ * Important to specify this if you are expecting any nested expression values in this data type!
218
+ */
219
+ unstable__keyFunc?: (item: any) => any;
220
+ /**
221
+ * Specify what would be the tentative new value that is set if the user makes any changes.
222
+ *
223
+ * Useful for field mappings.
224
+ *
225
+ * For instance, consider a Table where we have a `fields` prop:
226
+ *
227
+ * - Initially, the value is undefined. But if the user makes any changes, we would want to save an array of at
228
+ * least three items (corresponding to, say, three columns inferred from a schema).
229
+ *
230
+ * - Let's say there are 5 columns in the value. The data schema changes, removing a column and adding two new
231
+ * ones. Now we would want a different minimal value, containing 6 items.
232
+ */
233
+ unstable__minimalValue?: ContextDependentConfig<P, any>;
234
+ } & DefaultValueOrExpr<P, any[]> & PropTypeBase<P>) | ({
235
+ type: "dataSource";
236
+ dataSource: "airtable" | "cms";
237
+ } & PropTypeBase<P>);
238
+ type DataPickerValueType = string | number | (string | number)[];
239
+ export type DataPickerType<P> = ({
240
+ type: "dataSelector";
241
+ data: Record<string, any> | ContextDependentConfig<P, Record<string, any>>;
242
+ alwaysShowValuePathAsLabel?: boolean;
243
+ } & DefaultValueOrExpr<P, DataPickerValueType> & PropTypeBase<P>) | ({
244
+ type: "exprEditor";
245
+ data: Record<string, any> | ContextDependentConfig<P, Record<string, any>>;
246
+ } & DefaultValueOrExpr<P, DataPickerValueType> & PropTypeBase<P>);
247
+ export type FormValidationRulesType<P> = {
248
+ type: "formValidationRules";
249
+ } & DefaultValueOrExpr<P, any> & PropTypeBase<P>;
250
+ export type EventHandlerType<P> = {
251
+ type: "eventHandler";
252
+ argTypes: {
253
+ name: string;
254
+ type: PropType<any>;
255
+ }[];
256
+ } & DefaultValueOrExpr<P, (...args: any) => any> & PropTypeBase<P>;
257
+ interface ChoiceTypeBase<P> extends PropTypeBase<P> {
258
+ type: "choice";
259
+ options: string[] | {
260
+ label: string;
261
+ value: string | number | boolean;
262
+ }[] | ContextDependentConfig<P, string[] | {
263
+ label: string;
264
+ value: string | number | boolean;
265
+ }[]>;
266
+ allowSearch?: boolean;
267
+ filterOption?: boolean;
268
+ onSearch?: ContextDependentConfig<P, ((value: string) => void) | undefined>;
269
+ }
270
+ export type ChoiceType<P> = (({
271
+ multiSelect?: false;
272
+ } & DefaultValueOrExpr<P, string | number | boolean>) | ({
273
+ multiSelect: true;
274
+ } & DefaultValueOrExpr<P, (string | number | boolean)[]>) | ({
275
+ multiSelect: ContextDependentConfig<P, boolean>;
276
+ } & DefaultValueOrExpr<P, string | number | boolean | (string | number | boolean)[]>)) & ChoiceTypeBase<P>;
277
+ export interface ModalProps {
278
+ show?: boolean;
279
+ children?: React.ReactNode;
280
+ onClose: () => void;
281
+ style?: CSSProperties;
282
+ }
283
+ interface CustomControlProps<P> {
284
+ componentProps: P;
285
+ /**
286
+ * `contextData` can be `null` if the prop controls are rendering before
287
+ * the component instance itself (it will re-render once the component
288
+ * calls `setControlContextData`)
289
+ */
290
+ contextData: InferDataType<P> | null;
291
+ value: any;
292
+ /**
293
+ * Sets the value to be passed to the prop. Expects a JSON-compatible value.
294
+ */
295
+ updateValue: (newVal: any) => void;
296
+ /**
297
+ * Full screen modal component
298
+ */
299
+ FullscreenModal: React.ComponentType<ModalProps>;
300
+ /**
301
+ * Modal component for the side pane
302
+ */
303
+ SideModal: React.ComponentType<ModalProps>;
304
+ /**
305
+ * The document that the component will be rendered into; instead of using
306
+ * `document` directly (for, say, `document.querySelector()` etc.), you
307
+ * should use this instead.
308
+ */
309
+ studioDocument: typeof document;
310
+ }
311
+ export type CustomControl<P> = React.ComponentType<CustomControlProps<P>>;
312
+ /**
313
+ * Expects defaultValue to be a JSON-compatible value
314
+ */
315
+ export type CustomType<P> = CustomControl<P> | ({
316
+ type: "custom";
317
+ control: CustomControl<P>;
318
+ } & PropTypeBase<P> & DefaultValueOrExpr<P, any>);
319
+ type SlotType<P> = "slot" | ({
320
+ type: "slot";
321
+ /**
322
+ * The unique names of all code components that can be placed in the slot
323
+ */
324
+ allowedComponents?: string[];
325
+ /**
326
+ * Whether the "empty slot" placeholder should be hidden in the canvas.
327
+ */
328
+ hidePlaceholder?: boolean;
329
+ /**
330
+ * Whether the slot is repeated, i.e., is rendered multiple times using
331
+ * repeatedElement().
332
+ */
333
+ isRepeated?: boolean;
334
+ /**
335
+ * A nicer, human-readable display name for your slot prop
336
+ */
337
+ displayName?: string;
338
+ /**
339
+ * Function for whether this slot should be hidden from the left tree,
340
+ * given the current props for this component
341
+ */
342
+ hidden?: ContextDependentConfig<P, boolean>;
343
+ /**
344
+ * If slot is a render prop (accepts a function that takes in some
345
+ * arguments and returns some JSX), then specify the names of the
346
+ * arguments expected by the render prop function.
347
+ */
348
+ renderPropParams?: string[];
349
+ } & Omit<DefaultValueOrExpr<P, PlasmicElement | PlasmicElement[]>, "defaultValueHint" | "defaultExpr" | "defaultExprHint">);
350
+ type ImageUrlType<P> = "imageUrl" | ({
351
+ type: "imageUrl";
352
+ } & DefaultValueOrExpr<P, string> & PropTypeBase<P>);
353
+ export type PrimitiveType<P = any> = Extract<StringType<P> | BooleanType<P> | NumberType<P> | JSONLikeType<P>, String>;
354
+ type ControlTypeBase = {
355
+ editOnly?: false;
356
+ } | {
357
+ editOnly: true;
358
+ /**
359
+ * The prop where the values should be mapped to
360
+ */
361
+ uncontrolledProp?: string;
362
+ };
363
+ export type SupportControlled<T> = Extract<T, String | CustomControl<any>> | (Exclude<T, String | CustomControl<any>> & ControlTypeBase);
364
+ export type PropType<P> = SupportControlled<StringType<P> | BooleanType<P> | NumberType<P> | JSONLikeType<P> | ChoiceType<P> | ImageUrlType<P> | CustomType<P> | GraphQLType<P> | DataPickerType<P> | FormValidationRulesType<P> | EventHandlerType<P>> | SlotType<P>;
365
+ type RestrictPropType<T, P> = T extends string ? SupportControlled<StringType<P> | ChoiceType<P> | JSONLikeType<P> | ImageUrlType<P> | CustomType<P> | DataPickerType<P>> : T extends boolean ? SupportControlled<BooleanType<P> | JSONLikeType<P> | CustomType<P> | DataPickerType<P>> : T extends number ? SupportControlled<NumberType<P> | JSONLikeType<P> | CustomType<P> | DataPickerType<P>> : PropType<P>;
366
+ export interface ActionProps<P> {
367
+ componentProps: P;
368
+ /**
369
+ * `contextData` can be `null` if the prop controls are rendering before
370
+ * the component instance itself (it will re-render once the component
371
+ * calls `setControlContextData`)
372
+ */
373
+ contextData: InferDataType<P> | null;
374
+ studioOps: {
375
+ showModal: (modalProps: Omit<ModalProps, "onClose"> & {
376
+ onClose?: () => void;
377
+ }) => void;
378
+ refreshQueryData: () => void;
379
+ appendToSlot: (element: PlasmicElement, slotName: string) => void;
380
+ removeFromSlotAt: (pos: number, slotName: string) => void;
381
+ updateProps: (newValues: any) => void;
382
+ };
383
+ /**
384
+ * The document that the component will be rendered into; instead of using
385
+ * `document` directly (for, say, `document.querySelector()` etc.), you
386
+ * should use this instead.
387
+ */
388
+ studioDocument: typeof document;
389
+ }
390
+ export type Action<P> = {
391
+ type: "button-action";
392
+ label: string;
393
+ onClick: (props: ActionProps<P>) => void;
394
+ } | {
395
+ type: "custom-action";
396
+ control: React.ComponentType<ActionProps<P>>;
397
+ };
398
+ type DistributedKeyOf<T> = T extends any ? keyof T : never;
399
+ interface ComponentTemplate<P> extends Omit<CodeComponentElement<P>, "type" | "name"> {
400
+ /**
401
+ * A preview picture for the template.
402
+ */
403
+ previewImg?: string;
404
+ }
405
+ export interface ComponentTemplates<P> {
406
+ [name: string]: ComponentTemplate<P>;
407
+ }
408
+ export type StateSpec = {
409
+ onChangeProp: string;
410
+ } & ({
411
+ type: "readonly";
412
+ variableType: "text";
413
+ initVal?: string;
414
+ } | {
415
+ type: "readonly";
416
+ variableType: "number";
417
+ initVal?: number;
418
+ } | {
419
+ type: "readonly";
420
+ variableType: "boolean";
421
+ initVal?: boolean;
422
+ } | {
423
+ type: "readonly";
424
+ variableType: "array";
425
+ initVal?: any[];
426
+ } | {
427
+ type: "readonly";
428
+ variableType: "object";
429
+ initVal?: object;
430
+ } | {
431
+ type: "writable";
432
+ variableType: "text" | "number" | "boolean" | "array" | "object";
433
+ valueProp: string;
434
+ });
435
+ export interface StateHelpers<P, T> {
436
+ initFunc?: ($props: P) => T;
437
+ onChangeArgsToValue?: (...args: any) => T;
438
+ }
439
+ export type ComponentHelpers<P> = {
440
+ states: Record<string, StateHelpers<P, any>>;
441
+ };
442
+ export type ExternalComponentHelpers<P> = {
443
+ helpers: ComponentHelpers<P>;
444
+ importPath: string;
445
+ } & ({
446
+ importName: string;
447
+ } | {
448
+ isDefaultExport: true;
449
+ });
450
+ export type StyleSection = "visibility" | "typography" | "sizing" | "spacing" | "background" | "transform" | "transitions" | "layout" | "overflow" | "border" | "shadows" | "effects";
451
+ export interface CodeComponentMeta<P> {
452
+ /**
453
+ * Any unique string name used to identify that component. Each component
454
+ * should be registered with a different `meta.name`, even if they have the
455
+ * same name in the code.
456
+ */
457
+ name: string;
458
+ /**
459
+ * The name to be displayed for the component in Studio. Optional: if not
460
+ * specified, `meta.name` is used.
461
+ */
462
+ displayName?: string;
463
+ /**
464
+ * The description of the component to be shown in Studio.
465
+ */
466
+ description?: string;
467
+ /**
468
+ * The javascript name to be used when generating code. Optional: if not
469
+ * provided, `meta.name` is used.
470
+ */
471
+ importName?: string;
472
+ /**
473
+ * An object describing the component properties to be used in Studio.
474
+ * For each `prop`, there should be an entry `meta.props[prop]` describing
475
+ * its type.
476
+ */
477
+ props: {
478
+ [prop in DistributedKeyOf<P>]?: RestrictPropType<P[prop], P>;
479
+ } & {
480
+ [prop: string]: PropType<P>;
481
+ };
482
+ /**
483
+ * An object describing the component states to be used in Studio.
484
+ */
485
+ states?: Record<string, StateSpec>;
486
+ /**
487
+ * An object describing the components helpers to be used in Studio.
488
+ * 1. states helpers: Each state can receive an "initFunc" prop to initialize
489
+ * the implicit state in Studio, and an "onChangeArgsToValue" prop to
490
+ * transform the event handler arguments into a value
491
+ */
492
+ componentHelpers?: ExternalComponentHelpers<P>;
493
+ /**
494
+ * An array describing the component actions to be used in Studio.
495
+ */
496
+ actions?: Action<P>[];
497
+ /**
498
+ * Whether style sections should be shown in Studio. For styles to work, the
499
+ * component must accept a `className` prop. If unset, defaults to all styles.
500
+ * Set to `false` if this component cannot be styled (for example, if it doesn't
501
+ * render any DOM elements).
502
+ */
503
+ styleSections?: StyleSection[] | boolean;
504
+ /**
505
+ * Whether the element can be repeated in Studio. If unset, defaults to true.
506
+ */
507
+ isRepeatable?: boolean;
508
+ /**
509
+ * The path to be used when importing the component in the generated code.
510
+ * It can be the name of the package that contains the component, or the path
511
+ * to the file in the project (relative to the root directory).
512
+ */
513
+ importPath: string;
514
+ /**
515
+ * Whether the component is the default export from that path. Optional: if
516
+ * not specified, it's considered `false`.
517
+ */
518
+ isDefaultExport?: boolean;
519
+ /**
520
+ * The prop that expects the CSS classes with styles to be applied to the
521
+ * component. Optional: if not specified, Plasmic will expect it to be
522
+ * `className`. Notice that if the component does not accept CSS classes, the
523
+ * component will not be able to receive styles from the Studio.
524
+ */
525
+ classNameProp?: string;
526
+ /**
527
+ * The prop that receives and forwards a React `ref`. Plasmic only uses `ref`
528
+ * to interact with components, so it's not used in the generated code.
529
+ * Optional: If not provided, the usual `ref` is used.
530
+ */
531
+ refProp?: string;
532
+ /**
533
+ * Default styles to start with when instantiating the component in Plasmic.
534
+ */
535
+ defaultStyles?: CSSProperties;
536
+ /**
537
+ * Component templates to start with on Plasmic.
538
+ */
539
+ templates?: ComponentTemplates<P>;
540
+ /**
541
+ * Registered name of parent component, used for grouping related components.
542
+ */
543
+ parentComponentName?: string;
544
+ /**
545
+ * Whether the component can be used as an attachment to an element.
546
+ */
547
+ isAttachment?: boolean;
548
+ /**
549
+ * Whether the component provides data to its slots using DataProvider.
550
+ */
551
+ providesData?: boolean;
552
+ /**
553
+ * If specified, then Figma components with the specified names will be mapped
554
+ * to this component when you paste Figma content into Plasmic
555
+ */
556
+ figmaMappings?: {
557
+ figmaComponentName: string;
558
+ }[];
559
+ /**
560
+ * If true, when an instance of this component is added, the element
561
+ * will always be named by the name of this component.
562
+ */
563
+ alwaysAutoName?: boolean;
564
+ unstable__refActions?: Record<string, RefActionRegistration<P>>;
565
+ }
566
+ /**
567
+ * @deprecated use CodeComponentMeta instead
568
+ */
569
+ export type ComponentMeta<P> = CodeComponentMeta<P>;
570
+ export interface FunctionParam<P> {
571
+ name: string;
572
+ displayName?: string;
573
+ type: PropType<P>;
574
+ }
575
+ export interface RefActionRegistration<P> {
576
+ displayName?: string;
577
+ description?: string;
578
+ parameters: FunctionParam<P>[];
579
+ }
580
+ export interface ComponentRegistration {
581
+ component: React.ComponentType<any>;
582
+ meta: CodeComponentMeta<any>;
583
+ }
584
+ declare global {
585
+ interface Window {
586
+ __PlasmicComponentRegistry: ComponentRegistration[];
587
+ }
588
+ }
589
+ export default function registerComponent<T extends React.ComponentType<any>>(component: T, meta: CodeComponentMeta<React.ComponentProps<T>>): void;
590
+ export {};