@plasmicapp/host 2.0.0-test.0 → 2.0.0

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 (106) hide show
  1. package/LICENSE.md +21 -0
  2. package/dist/data.d.ts +1 -5
  3. package/dist/exports.d.ts +3 -4
  4. package/dist/host.esm.js +6 -17
  5. package/dist/host.esm.js.map +1 -1
  6. package/dist/index.cjs.js +5 -17
  7. package/dist/index.cjs.js.map +1 -1
  8. package/dist/prop-types.d.ts +6 -475
  9. package/dist/registerComponent.d.ts +8 -11
  10. package/dist/registerFunction.d.ts +2 -127
  11. package/dist/types/choice-type.d.ts +16 -0
  12. package/dist/types/component-types.d.ts +251 -0
  13. package/dist/types/container-types.d.ts +42 -0
  14. package/dist/types/function-types.d.ts +119 -0
  15. package/dist/types/misc-types.d.ts +38 -0
  16. package/dist/types/primitive-types.d.ts +123 -0
  17. package/dist/types/query-builder-types.d.ts +52 -0
  18. package/dist/types/shared-controls.d.ts +50 -0
  19. package/dist/version.d.ts +1 -1
  20. package/package.json +6 -5
  21. package/registerComponent/dist/data.d.ts +1 -5
  22. package/registerComponent/dist/exports.d.ts +3 -4
  23. package/registerComponent/dist/index.cjs.js.map +1 -1
  24. package/registerComponent/dist/index.esm.js.map +1 -1
  25. package/registerComponent/dist/prop-types.d.ts +6 -475
  26. package/registerComponent/dist/registerComponent.d.ts +8 -11
  27. package/registerComponent/dist/registerFunction.d.ts +2 -127
  28. package/registerComponent/dist/types/choice-type.d.ts +16 -0
  29. package/registerComponent/dist/types/component-types.d.ts +251 -0
  30. package/registerComponent/dist/types/container-types.d.ts +42 -0
  31. package/registerComponent/dist/types/function-types.d.ts +119 -0
  32. package/registerComponent/dist/types/misc-types.d.ts +38 -0
  33. package/registerComponent/dist/types/primitive-types.d.ts +123 -0
  34. package/registerComponent/dist/types/query-builder-types.d.ts +52 -0
  35. package/registerComponent/dist/types/shared-controls.d.ts +50 -0
  36. package/registerComponent/dist/version.d.ts +1 -1
  37. package/registerFunction/dist/data.d.ts +1 -5
  38. package/registerFunction/dist/exports.d.ts +3 -4
  39. package/registerFunction/dist/index.cjs.js.map +1 -1
  40. package/registerFunction/dist/index.esm.js.map +1 -1
  41. package/registerFunction/dist/prop-types.d.ts +6 -475
  42. package/registerFunction/dist/registerComponent.d.ts +8 -11
  43. package/registerFunction/dist/registerFunction.d.ts +2 -127
  44. package/registerFunction/dist/types/choice-type.d.ts +16 -0
  45. package/registerFunction/dist/types/component-types.d.ts +251 -0
  46. package/registerFunction/dist/types/container-types.d.ts +42 -0
  47. package/registerFunction/dist/types/function-types.d.ts +119 -0
  48. package/registerFunction/dist/types/misc-types.d.ts +38 -0
  49. package/registerFunction/dist/types/primitive-types.d.ts +123 -0
  50. package/registerFunction/dist/types/query-builder-types.d.ts +52 -0
  51. package/registerFunction/dist/types/shared-controls.d.ts +50 -0
  52. package/registerFunction/dist/version.d.ts +1 -1
  53. package/registerGlobalContext/dist/data.d.ts +1 -5
  54. package/registerGlobalContext/dist/exports.d.ts +3 -4
  55. package/registerGlobalContext/dist/prop-types.d.ts +6 -475
  56. package/registerGlobalContext/dist/registerComponent.d.ts +8 -11
  57. package/registerGlobalContext/dist/registerFunction.d.ts +2 -127
  58. package/registerGlobalContext/dist/types/choice-type.d.ts +16 -0
  59. package/registerGlobalContext/dist/types/component-types.d.ts +251 -0
  60. package/registerGlobalContext/dist/types/container-types.d.ts +42 -0
  61. package/registerGlobalContext/dist/types/function-types.d.ts +119 -0
  62. package/registerGlobalContext/dist/types/misc-types.d.ts +38 -0
  63. package/registerGlobalContext/dist/types/primitive-types.d.ts +123 -0
  64. package/registerGlobalContext/dist/types/query-builder-types.d.ts +52 -0
  65. package/registerGlobalContext/dist/types/shared-controls.d.ts +50 -0
  66. package/registerGlobalContext/dist/version.d.ts +1 -1
  67. package/registerToken/dist/data.d.ts +1 -5
  68. package/registerToken/dist/exports.d.ts +3 -4
  69. package/registerToken/dist/prop-types.d.ts +6 -475
  70. package/registerToken/dist/registerComponent.d.ts +8 -11
  71. package/registerToken/dist/registerFunction.d.ts +2 -127
  72. package/registerToken/dist/types/choice-type.d.ts +16 -0
  73. package/registerToken/dist/types/component-types.d.ts +251 -0
  74. package/registerToken/dist/types/container-types.d.ts +42 -0
  75. package/registerToken/dist/types/function-types.d.ts +119 -0
  76. package/registerToken/dist/types/misc-types.d.ts +38 -0
  77. package/registerToken/dist/types/primitive-types.d.ts +123 -0
  78. package/registerToken/dist/types/query-builder-types.d.ts +52 -0
  79. package/registerToken/dist/types/shared-controls.d.ts +50 -0
  80. package/registerToken/dist/version.d.ts +1 -1
  81. package/registerTrait/dist/data.d.ts +1 -5
  82. package/registerTrait/dist/exports.d.ts +3 -4
  83. package/registerTrait/dist/prop-types.d.ts +6 -475
  84. package/registerTrait/dist/registerComponent.d.ts +8 -11
  85. package/registerTrait/dist/registerFunction.d.ts +2 -127
  86. package/registerTrait/dist/types/choice-type.d.ts +16 -0
  87. package/registerTrait/dist/types/component-types.d.ts +251 -0
  88. package/registerTrait/dist/types/container-types.d.ts +42 -0
  89. package/registerTrait/dist/types/function-types.d.ts +119 -0
  90. package/registerTrait/dist/types/misc-types.d.ts +38 -0
  91. package/registerTrait/dist/types/primitive-types.d.ts +123 -0
  92. package/registerTrait/dist/types/query-builder-types.d.ts +52 -0
  93. package/registerTrait/dist/types/shared-controls.d.ts +50 -0
  94. package/registerTrait/dist/version.d.ts +1 -1
  95. package/dist/fetcher.d.ts +0 -40
  96. package/registerComponent/dist/fetcher.d.ts +0 -40
  97. package/registerFunction/dist/fetcher.d.ts +0 -40
  98. package/registerGlobalContext/dist/fetcher.d.ts +0 -40
  99. package/registerToken/dist/fetcher.d.ts +0 -40
  100. package/registerTrait/dist/fetcher.d.ts +0 -40
  101. /package/dist/{type-utils.d.ts → types/type-utils.d.ts} +0 -0
  102. /package/registerComponent/dist/{type-utils.d.ts → types/type-utils.d.ts} +0 -0
  103. /package/registerFunction/dist/{type-utils.d.ts → types/type-utils.d.ts} +0 -0
  104. /package/registerGlobalContext/dist/{type-utils.d.ts → types/type-utils.d.ts} +0 -0
  105. /package/registerToken/dist/{type-utils.d.ts → types/type-utils.d.ts} +0 -0
  106. /package/registerTrait/dist/{type-utils.d.ts → types/type-utils.d.ts} +0 -0
@@ -0,0 +1,50 @@
1
+ export type GenericContext<Props, Data, Extra = unknown> = [Props, Data, Extra];
2
+ /**
3
+ * Config option that takes the context (e.g., props) of the component instance
4
+ * or function to dynamically set its value.
5
+ */
6
+ export type ContextDependentConfig<Ctx extends any[], R> = (...args: Ctx) => R;
7
+ export type MaybeContextDependentConfig<Ctx extends any[], V> = V | ContextDependentConfig<Ctx, V>;
8
+ export interface CanvasComponentProps<Data = any> {
9
+ /**
10
+ * This prop is only provided within the canvas of Plasmic Studio.
11
+ * Allows the component to set data to be consumed by the props' controls.
12
+ */
13
+ setControlContextData?: (data: Data) => void;
14
+ }
15
+ export type ControlExtras = {
16
+ path: (string | number)[];
17
+ item?: any;
18
+ };
19
+ export type InferDataType<P> = P extends CanvasComponentProps<infer Data> ? Data : any;
20
+ export interface CommonTypeBase {
21
+ description?: string;
22
+ helpText?: string;
23
+ /**
24
+ * If true, will hide the prop in a collapsed section; good for props that
25
+ * should not usually be used.
26
+ */
27
+ advanced?: boolean;
28
+ /**
29
+ * If the user has chosen to use a dynamic expression for this prop, provide
30
+ * a hint as to the expected values that the expression should evaluate to.
31
+ * This hint will be displayed alongside the code editor. You may use
32
+ * markdown in the text here.
33
+ */
34
+ exprHint?: string;
35
+ /**
36
+ * If true, does not allow the user to use a dynamic expression for this prop
37
+ */
38
+ disableDynamicValue?: boolean;
39
+ }
40
+ export interface Defaultable<Ctx extends any[], T> {
41
+ /**
42
+ * Default value to set for this prop when the component is instantiated
43
+ */
44
+ defaultValue?: T;
45
+ /**
46
+ * Specify that default when no prop/param is provided,
47
+ * so the Plasmic user can see it in the studio UI
48
+ */
49
+ defaultValueHint?: T | ContextDependentConfig<Ctx, T | undefined>;
50
+ }
@@ -1 +1 @@
1
- export declare const hostVersion = "2.0.0-test.0";
1
+ export declare const hostVersion = "2.0.0";
package/dist/fetcher.d.ts DELETED
@@ -1,40 +0,0 @@
1
- import { PrimitiveType } from "./prop-types";
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,40 +0,0 @@
1
- import { PrimitiveType } from "./prop-types";
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,40 +0,0 @@
1
- import { PrimitiveType } from "./prop-types";
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,40 +0,0 @@
1
- import { PrimitiveType } from "./prop-types";
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,40 +0,0 @@
1
- import { PrimitiveType } from "./prop-types";
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,40 +0,0 @@
1
- import { PrimitiveType } from "./prop-types";
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;
File without changes