@plasmicapp/host 1.0.130 → 1.0.132

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 +380 -383
  9. package/dist/host.esm.js.map +1 -1
  10. package/dist/index.cjs.js +380 -383
  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,41 +1,41 @@
1
- import * as React from "react";
2
- declare global {
3
- interface Window {
4
- __PlasmicHostVersion: string;
5
- }
6
- }
7
- export declare function setPlasmicRootNode(node: React.ReactElement | null): void;
8
- export interface PlasmicCanvasContextValue {
9
- componentName: string | null;
10
- globalVariants: Record<string, string>;
11
- interactive?: boolean;
12
- }
13
- /**
14
- * React context to detect whether the component is rendered on Plasmic editor.
15
- * If not, return false.
16
- * If so, return an object with more information about the component
17
- */
18
- export declare const PlasmicCanvasContext: React.Context<false | PlasmicCanvasContextValue>;
19
- export declare const usePlasmicCanvasContext: () => false | PlasmicCanvasContextValue;
20
- interface PlasmicCanvasHostProps {
21
- /**
22
- * Webpack hmr uses EventSource to listen to hot reloads, but that
23
- * resultsin a persistent connection from each window. In Plasmic
24
- * Studio, if a project is configured to use app-hosting with a
25
- * nextjs or gatsby server running in dev mode, each artboard will
26
- * be holding a persistent connection to the dev server.
27
- * Because browsers have a limit to how many connections can
28
- * be held at a time by domain, this means after X artboards, new
29
- * artboards will freeze and not load.
30
- *
31
- * By default, <PlasmicCanvasHost /> will globally mutate
32
- * window.EventSource to avoid using EventSource for HMR, which you
33
- * typically don't need for your custom host page. If you do still
34
- * want to retain HRM, then youc an pass enableWebpackHmr={true}.
35
- */
36
- enableWebpackHmr?: boolean;
37
- }
38
- export declare const PlasmicCanvasHost: React.FunctionComponent<PlasmicCanvasHostProps>;
39
- declare type RenderErrorListener = (err: Error) => void;
40
- export declare function registerRenderErrorListener(listener: RenderErrorListener): () => void;
41
- export {};
1
+ import * as React from "react";
2
+ declare global {
3
+ interface Window {
4
+ __PlasmicHostVersion: string;
5
+ }
6
+ }
7
+ export declare function setPlasmicRootNode(node: React.ReactElement | null): void;
8
+ export interface PlasmicCanvasContextValue {
9
+ componentName: string | null;
10
+ globalVariants: Record<string, string>;
11
+ interactive?: boolean;
12
+ }
13
+ /**
14
+ * React context to detect whether the component is rendered on Plasmic editor.
15
+ * If not, return false.
16
+ * If so, return an object with more information about the component
17
+ */
18
+ export declare const PlasmicCanvasContext: React.Context<false | PlasmicCanvasContextValue>;
19
+ export declare const usePlasmicCanvasContext: () => false | PlasmicCanvasContextValue;
20
+ interface PlasmicCanvasHostProps {
21
+ /**
22
+ * Webpack hmr uses EventSource to listen to hot reloads, but that
23
+ * resultsin a persistent connection from each window. In Plasmic
24
+ * Studio, if a project is configured to use app-hosting with a
25
+ * nextjs or gatsby server running in dev mode, each artboard will
26
+ * be holding a persistent connection to the dev server.
27
+ * Because browsers have a limit to how many connections can
28
+ * be held at a time by domain, this means after X artboards, new
29
+ * artboards will freeze and not load.
30
+ *
31
+ * By default, <PlasmicCanvasHost /> will globally mutate
32
+ * window.EventSource to avoid using EventSource for HMR, which you
33
+ * typically don't need for your custom host page. If you do still
34
+ * want to retain HRM, then youc an pass enableWebpackHmr={true}.
35
+ */
36
+ enableWebpackHmr?: boolean;
37
+ }
38
+ export declare const PlasmicCanvasHost: React.FunctionComponent<PlasmicCanvasHostProps>;
39
+ type RenderErrorListener = (err: Error) => void;
40
+ export declare function registerRenderErrorListener(listener: RenderErrorListener): () => void;
41
+ export {};
package/dist/common.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const tuple: <T extends any[]>(...args: T) => T;
1
+ export declare const tuple: <T extends any[]>(...args: T) => T;
package/dist/data.d.ts CHANGED
@@ -1,43 +1,43 @@
1
- import React, { ReactNode } from "react";
2
- export declare type DataDict = Record<string, any>;
3
- export declare const DataContext: React.Context<Record<string, any> | undefined>;
4
- export declare type DataMeta = {
5
- hidden?: boolean;
6
- label?: string;
7
- };
8
- export declare function mkMetaName(name: string): string;
9
- export declare function mkMetaValue(meta: Partial<DataMeta>): DataMeta;
10
- export declare function applySelector(rawData: DataDict | undefined, selector: string | undefined): any;
11
- export declare type SelectorDict = Record<string, string | undefined>;
12
- export declare function useSelector(selector: string | undefined): any;
13
- export declare function useSelectors(selectors?: SelectorDict): any;
14
- export declare function useDataEnv(): Record<string, any> | undefined;
15
- export interface DataProviderProps {
16
- /**
17
- * Key to set in data context.
18
- */
19
- name?: string;
20
- /**
21
- * Value to set for `name` in data context.
22
- */
23
- data?: any;
24
- /**
25
- * If true, hide this entry in studio (data binding).
26
- */
27
- hidden?: boolean;
28
- /**
29
- * Label to be shown in the studio data picker for easier navigation (data binding).
30
- */
31
- label?: string;
32
- children?: ReactNode;
33
- }
34
- export declare function DataProvider({ name, data, hidden, label, children, }: DataProviderProps): JSX.Element;
35
- export interface PageParamsProviderProps {
36
- params?: Record<string, string | string[] | undefined>;
37
- query?: Record<string, string | string[] | undefined>;
38
- children?: ReactNode;
39
- }
40
- export declare function PageParamsProvider({ children, params, query, }: PageParamsProviderProps): JSX.Element;
41
- export declare function DataCtxReader({ children, }: {
42
- children: ($ctx: DataDict | undefined) => ReactNode;
43
- }): React.ReactElement<any, string | ((props: any) => React.ReactElement<any, any> | null) | (new (props: any) => React.Component<any, any, any>)> | null;
1
+ import React, { ReactNode } from "react";
2
+ export type DataDict = Record<string, any>;
3
+ export declare const DataContext: React.Context<DataDict | undefined>;
4
+ export type DataMeta = {
5
+ hidden?: boolean;
6
+ label?: string;
7
+ };
8
+ export declare function mkMetaName(name: string): string;
9
+ export declare function mkMetaValue(meta: Partial<DataMeta>): DataMeta;
10
+ export declare function applySelector(rawData: DataDict | undefined, selector: string | undefined): any;
11
+ export type SelectorDict = Record<string, string | undefined>;
12
+ export declare function useSelector(selector: string | undefined): any;
13
+ export declare function useSelectors(selectors?: SelectorDict): any;
14
+ export declare function useDataEnv(): DataDict | undefined;
15
+ export interface DataProviderProps {
16
+ /**
17
+ * Key to set in data context.
18
+ */
19
+ name?: string;
20
+ /**
21
+ * Value to set for `name` in data context.
22
+ */
23
+ data?: any;
24
+ /**
25
+ * If true, hide this entry in studio (data binding).
26
+ */
27
+ hidden?: boolean;
28
+ /**
29
+ * Label to be shown in the studio data picker for easier navigation (data binding).
30
+ */
31
+ label?: string;
32
+ children?: ReactNode;
33
+ }
34
+ export declare function DataProvider({ name, data, hidden, label, children, }: DataProviderProps): JSX.Element;
35
+ export interface PageParamsProviderProps {
36
+ params?: Record<string, string | string[] | undefined>;
37
+ query?: Record<string, string | string[] | undefined>;
38
+ children?: ReactNode;
39
+ }
40
+ export declare function PageParamsProvider({ children, params, query, }: PageParamsProviderProps): JSX.Element;
41
+ export declare function DataCtxReader({ children, }: {
42
+ children: ($ctx: DataDict | undefined) => ReactNode;
43
+ }): React.ReactElement<any, string | React.JSXElementConstructor<any>> | null;
@@ -1,115 +1,115 @@
1
- import type { Properties } from "csstype";
2
- export declare type CSSProperties = Properties<string | number> & {
3
- layout?: "vbox" | "hbox" | "box" | "page-section";
4
- };
5
- declare type ContainerTags = "a" | "address" | "article" | "aside" | "blockquote" | "button" | "code" | "dd" | "div" | "dl" | "dt" | "form" | "footer" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "header" | "hgroup" | "label" | "li" | "main" | "nav" | "ol" | "p" | "pre" | "section" | "span" | "ul";
6
- declare type CommonAttrKeys = "title" | "tabIndex" | "className" | "id" | "aria-label" | "aria-hidden" | "aria-labelledby" | "aria-describedby" | "role";
7
- declare type PictureAttrKeys = "alt" | "loading" | CommonAttrKeys;
8
- declare type LinkAttrKeys = "href" | "target" | CommonAttrKeys;
9
- declare type TextAreaAttrKeys = "disabled" | "value" | "cols" | "rows" | "placeholder" | CommonAttrKeys;
10
- declare type InputAttrKeys = "disabled" | "value" | "defaultValue" | "name" | "autoComplete" | "checked" | "placeholder" | CommonAttrKeys;
11
- declare type ButtonAttrKeys = "disabled" | CommonAttrKeys;
12
- declare type Attrs<Keys extends string> = Partial<Record<Keys, string>>;
13
- export interface PictureElement {
14
- type: "img";
15
- src: string;
16
- styles?: CSSProperties;
17
- attrs?: Attrs<PictureAttrKeys>;
18
- }
19
- export declare type ImageElement = PictureElement;
20
- interface LinkTextElement {
21
- type: "text";
22
- tag: "a";
23
- value: string;
24
- styles?: CSSProperties;
25
- attrs?: Attrs<LinkAttrKeys>;
26
- }
27
- interface ButtonTextElement {
28
- type: "text";
29
- tag: "button";
30
- value: string;
31
- styles?: CSSProperties;
32
- attrs?: Attrs<ButtonAttrKeys>;
33
- }
34
- interface GenericTextElement {
35
- type: "text";
36
- /**
37
- * Default: "div"
38
- */
39
- tag?: Exclude<ContainerTags, "a" | "button">;
40
- value: string;
41
- styles?: CSSProperties;
42
- attrs?: Attrs<CommonAttrKeys>;
43
- }
44
- export declare type TextElement = string | LinkTextElement | ButtonTextElement | GenericTextElement;
45
- interface LinkContainerElement {
46
- type: "box" | "vbox" | "hbox";
47
- tag: "a";
48
- children?: PlasmicElement | PlasmicElement[];
49
- styles?: CSSProperties;
50
- attrs?: Attrs<LinkAttrKeys>;
51
- }
52
- interface ButtonContainerElement {
53
- type: "box" | "vbox" | "hbox";
54
- tag: "button";
55
- children?: PlasmicElement | PlasmicElement[];
56
- styles?: CSSProperties;
57
- attrs?: Attrs<ButtonAttrKeys>;
58
- }
59
- interface GenericContainerElement {
60
- type: "box" | "vbox" | "hbox" | "page-section";
61
- /**
62
- * Default: "div"
63
- */
64
- tag?: Exclude<ContainerTags, "a" | "button">;
65
- children?: PlasmicElement | PlasmicElement[];
66
- styles?: CSSProperties;
67
- attrs?: Attrs<CommonAttrKeys>;
68
- }
69
- export declare type ContainerElement = LinkContainerElement | ButtonContainerElement | GenericContainerElement;
70
- export interface ButtonElement {
71
- type: "button";
72
- value: string;
73
- styles?: CSSProperties;
74
- attrs?: Attrs<ButtonAttrKeys>;
75
- }
76
- interface InputElement {
77
- type: "input" | "password";
78
- styles?: CSSProperties;
79
- attrs?: Attrs<InputAttrKeys>;
80
- }
81
- interface TextAreaElement {
82
- type: "textarea";
83
- styles?: CSSProperties;
84
- attrs?: Attrs<TextAreaAttrKeys>;
85
- }
86
- export declare type TextInputElement = InputElement | TextAreaElement;
87
- interface JsonElement {
88
- type: "json";
89
- value: any;
90
- }
91
- export interface DefaultComponentElement<P> {
92
- type: "default-component";
93
- kind: "button" | "text-input";
94
- props?: {
95
- [prop in keyof Partial<P>]: number | string | boolean | null | undefined | JsonElement | PlasmicElement | PlasmicElement[];
96
- } & {
97
- [prop: string]: number | string | boolean | null | undefined | JsonElement | PlasmicElement | PlasmicElement[];
98
- };
99
- styles?: CSSProperties;
100
- }
101
- export interface CodeComponentElement<P> {
102
- type: "component";
103
- /**
104
- * The registered component name
105
- */
106
- name: string;
107
- styles?: CSSProperties;
108
- props?: {
109
- [prop in keyof Partial<P>]: number | string | boolean | null | undefined | JsonElement | PlasmicElement | PlasmicElement[];
110
- } & {
111
- [prop: string]: number | string | boolean | null | undefined | JsonElement | PlasmicElement | PlasmicElement[];
112
- };
113
- }
114
- export declare type PlasmicElement = ImageElement | TextElement | ContainerElement | ButtonElement | TextInputElement | CodeComponentElement<{}> | DefaultComponentElement<{}>;
115
- export {};
1
+ import type { Properties } from "csstype";
2
+ export type CSSProperties = Properties<string | number> & {
3
+ layout?: "vbox" | "hbox" | "box" | "page-section";
4
+ };
5
+ type ContainerTags = "a" | "address" | "article" | "aside" | "blockquote" | "button" | "code" | "dd" | "div" | "dl" | "dt" | "form" | "footer" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "header" | "hgroup" | "label" | "li" | "main" | "nav" | "ol" | "p" | "pre" | "section" | "span" | "ul";
6
+ type CommonAttrKeys = "title" | "tabIndex" | "className" | "id" | "aria-label" | "aria-hidden" | "aria-labelledby" | "aria-describedby" | "role";
7
+ type PictureAttrKeys = "alt" | "loading" | CommonAttrKeys;
8
+ type LinkAttrKeys = "href" | "target" | CommonAttrKeys;
9
+ type TextAreaAttrKeys = "disabled" | "value" | "cols" | "rows" | "placeholder" | CommonAttrKeys;
10
+ type InputAttrKeys = "disabled" | "value" | "defaultValue" | "name" | "autoComplete" | "checked" | "placeholder" | CommonAttrKeys;
11
+ type ButtonAttrKeys = "disabled" | CommonAttrKeys;
12
+ type Attrs<Keys extends string> = Partial<Record<Keys, string>>;
13
+ export interface PictureElement {
14
+ type: "img";
15
+ src: string;
16
+ styles?: CSSProperties;
17
+ attrs?: Attrs<PictureAttrKeys>;
18
+ }
19
+ export type ImageElement = PictureElement;
20
+ interface LinkTextElement {
21
+ type: "text";
22
+ tag: "a";
23
+ value: string;
24
+ styles?: CSSProperties;
25
+ attrs?: Attrs<LinkAttrKeys>;
26
+ }
27
+ interface ButtonTextElement {
28
+ type: "text";
29
+ tag: "button";
30
+ value: string;
31
+ styles?: CSSProperties;
32
+ attrs?: Attrs<ButtonAttrKeys>;
33
+ }
34
+ interface GenericTextElement {
35
+ type: "text";
36
+ /**
37
+ * Default: "div"
38
+ */
39
+ tag?: Exclude<ContainerTags, "a" | "button">;
40
+ value: string;
41
+ styles?: CSSProperties;
42
+ attrs?: Attrs<CommonAttrKeys>;
43
+ }
44
+ export type TextElement = string | LinkTextElement | ButtonTextElement | GenericTextElement;
45
+ interface LinkContainerElement {
46
+ type: "box" | "vbox" | "hbox";
47
+ tag: "a";
48
+ children?: PlasmicElement | PlasmicElement[];
49
+ styles?: CSSProperties;
50
+ attrs?: Attrs<LinkAttrKeys>;
51
+ }
52
+ interface ButtonContainerElement {
53
+ type: "box" | "vbox" | "hbox";
54
+ tag: "button";
55
+ children?: PlasmicElement | PlasmicElement[];
56
+ styles?: CSSProperties;
57
+ attrs?: Attrs<ButtonAttrKeys>;
58
+ }
59
+ interface GenericContainerElement {
60
+ type: "box" | "vbox" | "hbox" | "page-section";
61
+ /**
62
+ * Default: "div"
63
+ */
64
+ tag?: Exclude<ContainerTags, "a" | "button">;
65
+ children?: PlasmicElement | PlasmicElement[];
66
+ styles?: CSSProperties;
67
+ attrs?: Attrs<CommonAttrKeys>;
68
+ }
69
+ export type ContainerElement = LinkContainerElement | ButtonContainerElement | GenericContainerElement;
70
+ export interface ButtonElement {
71
+ type: "button";
72
+ value: string;
73
+ styles?: CSSProperties;
74
+ attrs?: Attrs<ButtonAttrKeys>;
75
+ }
76
+ interface InputElement {
77
+ type: "input" | "password";
78
+ styles?: CSSProperties;
79
+ attrs?: Attrs<InputAttrKeys>;
80
+ }
81
+ interface TextAreaElement {
82
+ type: "textarea";
83
+ styles?: CSSProperties;
84
+ attrs?: Attrs<TextAreaAttrKeys>;
85
+ }
86
+ export type TextInputElement = InputElement | TextAreaElement;
87
+ interface JsonElement {
88
+ type: "json";
89
+ value: any;
90
+ }
91
+ export interface DefaultComponentElement<P> {
92
+ type: "default-component";
93
+ kind: "button" | "text-input";
94
+ props?: {
95
+ [prop in keyof Partial<P>]: number | string | boolean | null | undefined | JsonElement | PlasmicElement | PlasmicElement[];
96
+ } & {
97
+ [prop: string]: number | string | boolean | null | undefined | JsonElement | PlasmicElement | PlasmicElement[];
98
+ };
99
+ styles?: CSSProperties;
100
+ }
101
+ export interface CodeComponentElement<P> {
102
+ type: "component";
103
+ /**
104
+ * The registered component name
105
+ */
106
+ name: string;
107
+ styles?: CSSProperties;
108
+ props?: {
109
+ [prop in keyof Partial<P>]: number | string | boolean | null | undefined | JsonElement | PlasmicElement | PlasmicElement[];
110
+ } & {
111
+ [prop: string]: number | string | boolean | null | undefined | JsonElement | PlasmicElement | PlasmicElement[];
112
+ };
113
+ }
114
+ export type PlasmicElement = ImageElement | TextElement | ContainerElement | ButtonElement | TextInputElement | CodeComponentElement<{}> | DefaultComponentElement<{}>;
115
+ export {};
package/dist/exports.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- export { PlasmicCanvasContext, PlasmicCanvasHost, usePlasmicCanvasContext, } from "./canvas-host";
2
- export * from "./data";
3
- export { PlasmicElement } from "./element-types";
4
- export { registerFetcher as unstable_registerFetcher } from "./fetcher";
5
- export * from "./global-actions";
6
- export { Action, ActionProps, CodeComponentMeta, ComponentHelpers, ComponentMeta, ComponentRegistration, ComponentTemplates, ContextDependentConfig, default as registerComponent, DefaultValueOrExpr, PrimitiveType, PropType, PropTypeBase, StateHelpers, StateSpec, } from "./registerComponent";
7
- export { default as registerGlobalContext, GlobalContextMeta, GlobalContextRegistration, PropType as GlobalContextPropType, } from "./registerGlobalContext";
8
- export { default as registerToken, TokenRegistration, TokenType, } from "./registerToken";
9
- export { BasicTrait, ChoiceTrait, default as registerTrait, TraitMeta, TraitRegistration, } from "./registerTrait";
10
- export { default as repeatedElement } from "./repeatedElement";
1
+ export { PlasmicCanvasContext, PlasmicCanvasHost, usePlasmicCanvasContext, } from "./canvas-host";
2
+ export * from "./data";
3
+ export { PlasmicElement } from "./element-types";
4
+ export { registerFetcher as unstable_registerFetcher } from "./fetcher";
5
+ export * from "./global-actions";
6
+ export { Action, ActionProps, CodeComponentMeta, ComponentHelpers, ComponentMeta, ComponentRegistration, ComponentTemplates, ContextDependentConfig, default as registerComponent, DefaultValueOrExpr, PrimitiveType, PropType, PropTypeBase, StateHelpers, StateSpec, } from "./registerComponent";
7
+ export { default as registerGlobalContext, GlobalContextMeta, GlobalContextRegistration, PropType as GlobalContextPropType, } from "./registerGlobalContext";
8
+ export { default as registerToken, TokenRegistration, TokenType, } from "./registerToken";
9
+ export { BasicTrait, ChoiceTrait, default as registerTrait, TraitMeta, TraitRegistration, } from "./registerTrait";
10
+ export { default as repeatedElement } from "./repeatedElement";
package/dist/fetcher.d.ts CHANGED
@@ -1,40 +1,40 @@
1
- import { PrimitiveType } from "./registerComponent";
2
- export declare type Fetcher = (...args: any[]) => Promise<any>;
3
- export interface FetcherMeta {
4
- /**
5
- * Any unique identifying string for this fetcher.
6
- */
7
- name: string;
8
- /**
9
- * The Studio-user-friendly display name.
10
- */
11
- displayName?: string;
12
- /**
13
- * The symbol to import from the importPath.
14
- */
15
- importName?: string;
16
- args: {
17
- name: string;
18
- type: PrimitiveType;
19
- }[];
20
- returns: PrimitiveType;
21
- /**
22
- * Either the path to the fetcher relative to `rootDir` or the npm
23
- * package name
24
- */
25
- importPath: string;
26
- /**
27
- * Whether it's a default export or named export
28
- */
29
- isDefaultExport?: boolean;
30
- }
31
- export interface FetcherRegistration {
32
- fetcher: Fetcher;
33
- meta: FetcherMeta;
34
- }
35
- declare global {
36
- interface Window {
37
- __PlasmicFetcherRegistry: FetcherRegistration[];
38
- }
39
- }
40
- export declare function registerFetcher(fetcher: Fetcher, meta: FetcherMeta): void;
1
+ import { PrimitiveType } from "./registerComponent";
2
+ export type Fetcher = (...args: any[]) => Promise<any>;
3
+ export interface FetcherMeta {
4
+ /**
5
+ * Any unique identifying string for this fetcher.
6
+ */
7
+ name: string;
8
+ /**
9
+ * The Studio-user-friendly display name.
10
+ */
11
+ displayName?: string;
12
+ /**
13
+ * The symbol to import from the importPath.
14
+ */
15
+ importName?: string;
16
+ args: {
17
+ name: string;
18
+ type: PrimitiveType;
19
+ }[];
20
+ returns: PrimitiveType;
21
+ /**
22
+ * Either the path to the fetcher relative to `rootDir` or the npm
23
+ * package name
24
+ */
25
+ importPath: string;
26
+ /**
27
+ * Whether it's a default export or named export
28
+ */
29
+ isDefaultExport?: boolean;
30
+ }
31
+ export interface FetcherRegistration {
32
+ fetcher: Fetcher;
33
+ meta: FetcherMeta;
34
+ }
35
+ declare global {
36
+ interface Window {
37
+ __PlasmicFetcherRegistry: FetcherRegistration[];
38
+ }
39
+ }
40
+ export declare function registerFetcher(fetcher: Fetcher, meta: FetcherMeta): void;
@@ -1,9 +1,9 @@
1
- import React from "react";
2
- export declare type GlobalActionDict = Record<string, Function>;
3
- export declare const GlobalActionsContext: React.Context<Record<string, Function> | undefined>;
4
- export declare function GlobalActionsProvider(props: {
5
- contextName: string;
6
- children?: React.ReactNode;
7
- actions: GlobalActionDict;
8
- }): JSX.Element;
9
- export declare function useGlobalActions(): Record<string, Function>;
1
+ import React from "react";
2
+ export type GlobalActionDict = Record<string, Function>;
3
+ export declare const GlobalActionsContext: React.Context<GlobalActionDict | undefined>;
4
+ export declare function GlobalActionsProvider(props: {
5
+ contextName: string;
6
+ children?: React.ReactNode;
7
+ actions: GlobalActionDict;
8
+ }): JSX.Element;
9
+ export declare function useGlobalActions(): GlobalActionDict;