@plasmicapp/host 1.0.211 → 1.0.213
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/dist/host.esm.js +1 -1
- package/dist/host.esm.js.map +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/prop-types.d.ts +1 -1
- package/dist/registerFunction.d.ts +95 -27
- package/dist/version.d.ts +1 -1
- package/package.json +2 -2
- package/registerComponent/dist/prop-types.d.ts +1 -1
- package/registerComponent/dist/registerFunction.d.ts +95 -27
- package/registerComponent/dist/version.d.ts +1 -1
- package/registerFunction/dist/index.cjs.js.map +1 -1
- package/registerFunction/dist/index.esm.js.map +1 -1
- package/registerFunction/dist/prop-types.d.ts +1 -1
- package/registerFunction/dist/registerFunction.d.ts +95 -27
- package/registerFunction/dist/version.d.ts +1 -1
- package/registerGlobalContext/dist/prop-types.d.ts +1 -1
- package/registerGlobalContext/dist/registerFunction.d.ts +95 -27
- package/registerGlobalContext/dist/version.d.ts +1 -1
- package/registerToken/dist/prop-types.d.ts +1 -1
- package/registerToken/dist/registerFunction.d.ts +95 -27
- package/registerToken/dist/version.d.ts +1 -1
- package/registerTrait/dist/prop-types.d.ts +1 -1
- package/registerTrait/dist/registerFunction.d.ts +95 -27
- package/registerTrait/dist/version.d.ts +1 -1
|
@@ -1,45 +1,113 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export type
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Context that we pass back to control functions.
|
|
3
|
+
*/
|
|
4
|
+
export type ControlContext<P> = [
|
|
5
|
+
/**
|
|
6
|
+
* props
|
|
7
|
+
*/
|
|
8
|
+
P
|
|
9
|
+
];
|
|
10
|
+
/**
|
|
11
|
+
* Config option that takes the context (e.g., props) of the function call
|
|
12
|
+
* to dynamically set its value.
|
|
13
|
+
*/
|
|
14
|
+
export type ContextDependentConfig<P, R> = (...args: ControlContext<P>) => R;
|
|
15
|
+
export interface BaseParam {
|
|
14
16
|
name: string;
|
|
15
|
-
type?: ParamType<T>;
|
|
16
17
|
description?: string;
|
|
17
18
|
isOptional?: boolean;
|
|
18
|
-
|
|
19
|
+
isRestParameter?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export interface ChoiceTypeBase<P, T> extends BaseParam {
|
|
22
|
+
type: "choice";
|
|
23
|
+
options: T[] | {
|
|
24
|
+
label: string;
|
|
25
|
+
value: T;
|
|
26
|
+
}[] | ContextDependentConfig<P, T[] | {
|
|
27
|
+
label: string;
|
|
28
|
+
value: T;
|
|
29
|
+
}[]>;
|
|
30
|
+
allowSearch?: boolean;
|
|
31
|
+
filterOption?: boolean;
|
|
32
|
+
onSearch?: ContextDependentConfig<P, ((value: string) => void) | undefined>;
|
|
33
|
+
}
|
|
34
|
+
export interface SingleChoiceType<P, T> extends ChoiceTypeBase<P, T> {
|
|
35
|
+
multiSelect?: false;
|
|
36
|
+
}
|
|
37
|
+
export interface MultiChoiceType<P, T> extends ChoiceTypeBase<P, T[]> {
|
|
38
|
+
multiSelect: true;
|
|
39
|
+
}
|
|
40
|
+
export interface CustomChoiceType<P, T> extends ChoiceTypeBase<P, T | T[]> {
|
|
41
|
+
multiSelect: ContextDependentConfig<P, boolean>;
|
|
42
|
+
}
|
|
43
|
+
export type ChoiceType<P, T> = SingleChoiceType<P, T> | MultiChoiceType<P, T> | CustomChoiceType<P, T>;
|
|
44
|
+
export interface PlainStringType<T extends string = string> extends BaseParam {
|
|
45
|
+
type: "string" | `'${T}'`;
|
|
46
|
+
}
|
|
47
|
+
export type StringType<P, T extends string = string> = "string" | PlainStringType<T> | ChoiceType<P, T> | AnyType;
|
|
48
|
+
export interface PlainNumberType<T extends number = number> extends BaseParam {
|
|
49
|
+
type: "number" | `${number extends T ? number : T}`;
|
|
50
|
+
}
|
|
51
|
+
export type NumberType<P, T extends number = number> = PlainNumberType<T> | ChoiceType<P, T> | AnyType;
|
|
52
|
+
export interface PlainBooleanType<T extends boolean = boolean> extends BaseParam {
|
|
53
|
+
type: "boolean" | `${boolean extends T ? boolean : T}`;
|
|
19
54
|
}
|
|
20
|
-
export
|
|
55
|
+
export type BooleanType<P, T extends boolean = boolean> = PlainBooleanType<T> | ChoiceType<P, T> | AnyType;
|
|
56
|
+
export interface PlainNullType extends BaseParam {
|
|
57
|
+
type: "null";
|
|
58
|
+
}
|
|
59
|
+
export type NullType = PlainNullType | AnyType;
|
|
60
|
+
export interface PlainUndefinedType extends BaseParam {
|
|
61
|
+
type: "undefined";
|
|
62
|
+
}
|
|
63
|
+
export type UndefinedType = PlainUndefinedType | AnyType;
|
|
64
|
+
export interface PlainArrayType extends BaseParam {
|
|
65
|
+
type: "array";
|
|
66
|
+
}
|
|
67
|
+
export type ArrayType = PlainArrayType | AnyType;
|
|
68
|
+
export interface PlainObjectType extends BaseParam {
|
|
69
|
+
type: "object";
|
|
70
|
+
}
|
|
71
|
+
export type ObjectType = PlainObjectType | AnyType;
|
|
72
|
+
export interface PlainAnyType extends BaseParam {
|
|
73
|
+
type: "any";
|
|
74
|
+
}
|
|
75
|
+
export type AnyType = PlainAnyType;
|
|
76
|
+
export interface PlainVoidType extends BaseParam {
|
|
77
|
+
type: "void";
|
|
78
|
+
}
|
|
79
|
+
export type VoidType = PlainVoidType | AnyType;
|
|
80
|
+
type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
81
|
+
type CommonType<T> = T extends null ? NullType : T extends undefined ? UndefinedType : T extends Array<any> ? ArrayType : T extends object ? ObjectType : AnyType;
|
|
82
|
+
type AnyTyping<P, T> = T extends string ? StringType<P, T> : T extends number ? NumberType<P, T> : T extends boolean ? BooleanType<P, T> : CommonType<T>;
|
|
83
|
+
export type RestrictedType<P, T> = IsAny<T> extends true ? AnyTyping<P, T> : [T] extends [string] ? StringType<P, T> : [T] extends [number] ? NumberType<P, T> : [T] extends [boolean] ? BooleanType<P, T> : CommonType<T>;
|
|
84
|
+
export type ParamType<P, T> = RestrictedType<P, T>;
|
|
85
|
+
export type RequiredParam<P, T> = ParamType<P, T> & {
|
|
21
86
|
isOptional?: false;
|
|
22
87
|
isRestParameter?: false;
|
|
23
|
-
}
|
|
24
|
-
export
|
|
88
|
+
};
|
|
89
|
+
export type OptionalParam<P, T> = ParamType<P, T> & {
|
|
25
90
|
isRestParameter?: false;
|
|
26
|
-
}
|
|
27
|
-
export
|
|
91
|
+
};
|
|
92
|
+
export type RestParam<P, T> = ParamType<P, T> & {
|
|
28
93
|
isOptional?: false;
|
|
29
94
|
isRestParameter: true;
|
|
30
|
-
}
|
|
95
|
+
};
|
|
31
96
|
type RequiredParams<T extends any[], U extends any[] = []> = Partial<T> extends T ? U : T extends [infer F, ...infer R] ? RequiredParams<R, [...U, F]> : U;
|
|
32
97
|
type OptionalParams<T extends any[]> = T extends [
|
|
33
98
|
...RequiredParams<T>,
|
|
34
99
|
...infer R
|
|
35
100
|
] ? [...R] : [];
|
|
36
|
-
type HandleRequiredParams<P extends any[]> =
|
|
37
|
-
type HandleOptionalParams<P extends any[]> =
|
|
101
|
+
type HandleRequiredParams<P, R extends any[]> = R extends [infer H, ...infer T] ? [string | RequiredParam<P, H>, ...HandleRequiredParams<P, T>] : [];
|
|
102
|
+
type HandleOptionalParams<P, R extends any[]> = R extends [infer H, ...infer T] ? [] | [
|
|
103
|
+
string | OptionalParam<P, H | undefined>,
|
|
104
|
+
...HandleOptionalParams<P, T>
|
|
105
|
+
] : R extends [] ? [] : R extends Array<infer T> ? [] | [RestParam<P, T[]>] : [];
|
|
38
106
|
export type HandleParams<P extends any[]> = [
|
|
39
|
-
...HandleRequiredParams<RequiredParams<P>>,
|
|
40
|
-
...HandleOptionalParams<Required<OptionalParams<P>>>
|
|
107
|
+
...HandleRequiredParams<P, RequiredParams<P>>,
|
|
108
|
+
...HandleOptionalParams<P, Required<OptionalParams<P>>>
|
|
41
109
|
];
|
|
42
|
-
export type HandleReturnType<T> = VoidType | ParamType<T>;
|
|
110
|
+
export type HandleReturnType<P, T> = VoidType | ParamType<P, T>;
|
|
43
111
|
export interface CustomFunctionMeta<F extends (...args: any[]) => any> {
|
|
44
112
|
/**
|
|
45
113
|
* The javascript name of the function. Notice it must be unique across all
|
|
@@ -69,7 +137,7 @@ export interface CustomFunctionMeta<F extends (...args: any[]) => any> {
|
|
|
69
137
|
/**
|
|
70
138
|
* The function return type.
|
|
71
139
|
*/
|
|
72
|
-
type?: HandleReturnType<ReturnType<F>>;
|
|
140
|
+
type?: HandleReturnType<Parameters<F>, ReturnType<F>>;
|
|
73
141
|
/**
|
|
74
142
|
* The function return value description.
|
|
75
143
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const hostVersion = "1.0.
|
|
1
|
+
export declare const hostVersion = "1.0.213";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":["../../src/registerFunction.ts"],"sourcesContent":["const root = globalThis as any;\n\nexport type
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../../src/registerFunction.ts"],"sourcesContent":["const root = globalThis as any;\n\n/**\n * Context that we pass back to control functions.\n */\nexport type ControlContext<P> = [\n /**\n * props\n */\n P\n];\n\n/**\n * Config option that takes the context (e.g., props) of the function call\n * to dynamically set its value.\n */\nexport type ContextDependentConfig<P, R> = (...args: ControlContext<P>) => R;\n\nexport interface BaseParam {\n name: string;\n description?: string;\n isOptional?: boolean;\n isRestParameter?: boolean;\n}\n\nexport interface ChoiceTypeBase<P, T> extends BaseParam {\n type: \"choice\";\n options:\n | T[]\n | {\n label: string;\n value: T;\n }[]\n | ContextDependentConfig<\n P,\n | T[]\n | {\n label: string;\n value: T;\n }[]\n >;\n allowSearch?: boolean;\n filterOption?: boolean;\n onSearch?: ContextDependentConfig<P, ((value: string) => void) | undefined>;\n}\n\nexport interface SingleChoiceType<P, T> extends ChoiceTypeBase<P, T> {\n multiSelect?: false;\n}\n\nexport interface MultiChoiceType<P, T> extends ChoiceTypeBase<P, T[]> {\n multiSelect: true;\n}\n\nexport interface CustomChoiceType<P, T> extends ChoiceTypeBase<P, T | T[]> {\n multiSelect: ContextDependentConfig<P, boolean>;\n}\n\nexport type ChoiceType<P, T> =\n | SingleChoiceType<P, T>\n | MultiChoiceType<P, T>\n | CustomChoiceType<P, T>;\n\nexport interface PlainStringType<T extends string = string> extends BaseParam {\n type: \"string\" | `'${T}'`;\n}\n\nexport type StringType<P, T extends string = string> =\n | \"string\"\n | PlainStringType<T>\n | ChoiceType<P, T>\n | AnyType;\n\nexport interface PlainNumberType<T extends number = number> extends BaseParam {\n type: \"number\" | `${number extends T ? number : T}`;\n}\n\nexport type NumberType<P, T extends number = number> =\n | PlainNumberType<T>\n | ChoiceType<P, T>\n | AnyType;\n\nexport interface PlainBooleanType<T extends boolean = boolean>\n extends BaseParam {\n type: \"boolean\" | `${boolean extends T ? boolean : T}`;\n}\n\nexport type BooleanType<P, T extends boolean = boolean> =\n | PlainBooleanType<T>\n | ChoiceType<P, T>\n | AnyType;\n\nexport interface PlainNullType extends BaseParam {\n type: \"null\";\n}\nexport type NullType = PlainNullType | AnyType;\n\nexport interface PlainUndefinedType extends BaseParam {\n type: \"undefined\";\n}\nexport type UndefinedType = PlainUndefinedType | AnyType;\n\nexport interface PlainArrayType extends BaseParam {\n type: \"array\";\n}\nexport type ArrayType = PlainArrayType | AnyType;\n\nexport interface PlainObjectType extends BaseParam {\n type: \"object\";\n}\nexport type ObjectType = PlainObjectType | AnyType;\n\nexport interface PlainAnyType extends BaseParam {\n type: \"any\";\n}\nexport type AnyType = PlainAnyType;\n\nexport interface PlainVoidType extends BaseParam {\n type: \"void\";\n}\nexport type VoidType = PlainVoidType | AnyType;\n\ntype IsAny<T> = 0 extends 1 & T ? true : false;\n\ntype CommonType<T> = T extends null\n ? NullType\n : T extends undefined\n ? UndefinedType\n : T extends Array<any>\n ? ArrayType\n : T extends object\n ? ObjectType\n : AnyType;\n\ntype AnyTyping<P, T> = T extends string\n ? StringType<P, T>\n : T extends number\n ? NumberType<P, T>\n : T extends boolean\n ? BooleanType<P, T>\n : CommonType<T>;\n\nexport type RestrictedType<P, T> = IsAny<T> extends true\n ? AnyTyping<P, T>\n : [T] extends [string]\n ? StringType<P, T>\n : [T] extends [number]\n ? NumberType<P, T>\n : [T] extends [boolean]\n ? BooleanType<P, T>\n : CommonType<T>;\n\nexport type ParamType<P, T> = RestrictedType<P, T>;\n\nexport type RequiredParam<P, T> = ParamType<P, T> & {\n isOptional?: false;\n isRestParameter?: false;\n};\n\nexport type OptionalParam<P, T> = ParamType<P, T> & {\n isRestParameter?: false;\n};\n\nexport type RestParam<P, T> = ParamType<P, T> & {\n isOptional?: false;\n isRestParameter: true;\n};\n\n// https://stackoverflow.com/questions/70684030/remove-all-optional-items-from-a-tuple-type\ntype RequiredParams<\n T extends any[],\n U extends any[] = []\n> = Partial<T> extends T\n ? U\n : T extends [infer F, ...infer R]\n ? RequiredParams<R, [...U, F]>\n : U;\n\ntype OptionalParams<T extends any[]> = T extends [\n ...RequiredParams<T>,\n ...infer R\n]\n ? [...R]\n : [];\n\ntype HandleRequiredParams<P, R extends any[]> = R extends [infer H, ...infer T]\n ? [string | RequiredParam<P, H>, ...HandleRequiredParams<P, T>]\n : [];\n\ntype HandleOptionalParams<P, R extends any[]> = R extends [infer H, ...infer T]\n ?\n | []\n | [\n string | OptionalParam<P, H | undefined>,\n ...HandleOptionalParams<P, T>\n ]\n : R extends []\n ? []\n : R extends Array<infer T>\n ? [] | [RestParam<P, T[]>]\n : [];\n\nexport type HandleParams<P extends any[]> = [\n ...HandleRequiredParams<P, RequiredParams<P>>,\n ...HandleOptionalParams<P, Required<OptionalParams<P>>>\n];\n\nexport type HandleReturnType<P, T> = VoidType | ParamType<P, T>;\n\nexport interface CustomFunctionMeta<F extends (...args: any[]) => any> {\n /**\n * The javascript name of the function. Notice it must be unique across all\n * other functions and function namespaces. If two functions have the same\n * name, they should be registered with different `meta.namespace`.\n */\n name: string;\n /**\n * A namespace for organizing groups of functions. It's also used to handle\n * function name collisions. If a function has a namespace, it will be used\n * whenever accessing the function.\n */\n namespace?: string;\n /**\n * Documentation for the registered function.\n */\n description?: string;\n /**\n * An array containing the list of parameters names the function takes.\n * Optionally they can also be registered with the expected param types.\n */\n params?: HandleParams<Parameters<F>>;\n /**\n * Return value information.\n */\n returnValue?: {\n /**\n * The function return type.\n */\n type?: HandleReturnType<Parameters<F>, ReturnType<F>>;\n /**\n * The function return value description.\n */\n description?: string;\n };\n /**\n * Typescript function declaration. If specified, it ignores the types\n * provided by `params` and `returnValue`.\n */\n typescriptDeclaration?: string;\n\n /**\n * Whether this function can be used as a query in the editor.\n */\n isQuery?: boolean;\n /**\n * The path to be used when importing the function in the generated code.\n * It can be the name of the package that contains the function, or the path\n * to the file in the project (relative to the root directory).\n */\n importPath: string;\n /**\n * Whether the function is the default export from that path. Optional: if\n * not specified, it's considered `false`.\n */\n isDefaultExport?: boolean;\n}\n\nexport interface CustomFunctionRegistration {\n function: (...args: any[]) => any;\n meta: CustomFunctionMeta<any>;\n}\n\ndeclare global {\n interface Window {\n __PlasmicFunctionsRegistry: CustomFunctionRegistration[];\n }\n}\n\nif (root.__PlasmicFunctionsRegistry == null) {\n root.__PlasmicFunctionsRegistry = [];\n}\n\nexport default function registerFunction<F extends (...args: any[]) => any>(\n fn: F,\n meta: CustomFunctionMeta<F>\n) {\n // Check for duplicates\n if (\n root.__PlasmicFunctionsRegistry.some(\n (r: CustomFunctionRegistration) =>\n r.function === fn &&\n r.meta.name === meta.name &&\n r.meta.namespace == meta.namespace\n )\n ) {\n return;\n }\n root.__PlasmicFunctionsRegistry.push({ function: fn, meta });\n}\n"],"names":[],"mappings":";;;;;AAAA,IAAM,IAAI,GAAG,UAAiB,CAAC;AAsR/B,IAAI,IAAI,CAAC,0BAA0B,IAAI,IAAI,EAAE;AAC3C,IAAA,IAAI,CAAC,0BAA0B,GAAG,EAAE,CAAC;AACtC,CAAA;AAEa,SAAU,gBAAgB,CACtC,EAAK,EACL,IAA2B,EAAA;;AAG3B,IAAA,IACE,IAAI,CAAC,0BAA0B,CAAC,IAAI,CAClC,UAAC,CAA6B,EAAA;AAC5B,QAAA,OAAA,CAAC,CAAC,QAAQ,KAAK,EAAE;AACjB,YAAA,CAAC,CAAC,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI;AACzB,YAAA,CAAC,CAAC,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,SAAS,CAAA;AAFlC,KAEkC,CACrC,EACD;QACA,OAAO;AACR,KAAA;AACD,IAAA,IAAI,CAAC,0BAA0B,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAA,IAAA,EAAE,CAAC,CAAC;AAC/D;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":["../../src/registerFunction.ts"],"sourcesContent":["const root = globalThis as any;\n\nexport type
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../../src/registerFunction.ts"],"sourcesContent":["const root = globalThis as any;\n\n/**\n * Context that we pass back to control functions.\n */\nexport type ControlContext<P> = [\n /**\n * props\n */\n P\n];\n\n/**\n * Config option that takes the context (e.g., props) of the function call\n * to dynamically set its value.\n */\nexport type ContextDependentConfig<P, R> = (...args: ControlContext<P>) => R;\n\nexport interface BaseParam {\n name: string;\n description?: string;\n isOptional?: boolean;\n isRestParameter?: boolean;\n}\n\nexport interface ChoiceTypeBase<P, T> extends BaseParam {\n type: \"choice\";\n options:\n | T[]\n | {\n label: string;\n value: T;\n }[]\n | ContextDependentConfig<\n P,\n | T[]\n | {\n label: string;\n value: T;\n }[]\n >;\n allowSearch?: boolean;\n filterOption?: boolean;\n onSearch?: ContextDependentConfig<P, ((value: string) => void) | undefined>;\n}\n\nexport interface SingleChoiceType<P, T> extends ChoiceTypeBase<P, T> {\n multiSelect?: false;\n}\n\nexport interface MultiChoiceType<P, T> extends ChoiceTypeBase<P, T[]> {\n multiSelect: true;\n}\n\nexport interface CustomChoiceType<P, T> extends ChoiceTypeBase<P, T | T[]> {\n multiSelect: ContextDependentConfig<P, boolean>;\n}\n\nexport type ChoiceType<P, T> =\n | SingleChoiceType<P, T>\n | MultiChoiceType<P, T>\n | CustomChoiceType<P, T>;\n\nexport interface PlainStringType<T extends string = string> extends BaseParam {\n type: \"string\" | `'${T}'`;\n}\n\nexport type StringType<P, T extends string = string> =\n | \"string\"\n | PlainStringType<T>\n | ChoiceType<P, T>\n | AnyType;\n\nexport interface PlainNumberType<T extends number = number> extends BaseParam {\n type: \"number\" | `${number extends T ? number : T}`;\n}\n\nexport type NumberType<P, T extends number = number> =\n | PlainNumberType<T>\n | ChoiceType<P, T>\n | AnyType;\n\nexport interface PlainBooleanType<T extends boolean = boolean>\n extends BaseParam {\n type: \"boolean\" | `${boolean extends T ? boolean : T}`;\n}\n\nexport type BooleanType<P, T extends boolean = boolean> =\n | PlainBooleanType<T>\n | ChoiceType<P, T>\n | AnyType;\n\nexport interface PlainNullType extends BaseParam {\n type: \"null\";\n}\nexport type NullType = PlainNullType | AnyType;\n\nexport interface PlainUndefinedType extends BaseParam {\n type: \"undefined\";\n}\nexport type UndefinedType = PlainUndefinedType | AnyType;\n\nexport interface PlainArrayType extends BaseParam {\n type: \"array\";\n}\nexport type ArrayType = PlainArrayType | AnyType;\n\nexport interface PlainObjectType extends BaseParam {\n type: \"object\";\n}\nexport type ObjectType = PlainObjectType | AnyType;\n\nexport interface PlainAnyType extends BaseParam {\n type: \"any\";\n}\nexport type AnyType = PlainAnyType;\n\nexport interface PlainVoidType extends BaseParam {\n type: \"void\";\n}\nexport type VoidType = PlainVoidType | AnyType;\n\ntype IsAny<T> = 0 extends 1 & T ? true : false;\n\ntype CommonType<T> = T extends null\n ? NullType\n : T extends undefined\n ? UndefinedType\n : T extends Array<any>\n ? ArrayType\n : T extends object\n ? ObjectType\n : AnyType;\n\ntype AnyTyping<P, T> = T extends string\n ? StringType<P, T>\n : T extends number\n ? NumberType<P, T>\n : T extends boolean\n ? BooleanType<P, T>\n : CommonType<T>;\n\nexport type RestrictedType<P, T> = IsAny<T> extends true\n ? AnyTyping<P, T>\n : [T] extends [string]\n ? StringType<P, T>\n : [T] extends [number]\n ? NumberType<P, T>\n : [T] extends [boolean]\n ? BooleanType<P, T>\n : CommonType<T>;\n\nexport type ParamType<P, T> = RestrictedType<P, T>;\n\nexport type RequiredParam<P, T> = ParamType<P, T> & {\n isOptional?: false;\n isRestParameter?: false;\n};\n\nexport type OptionalParam<P, T> = ParamType<P, T> & {\n isRestParameter?: false;\n};\n\nexport type RestParam<P, T> = ParamType<P, T> & {\n isOptional?: false;\n isRestParameter: true;\n};\n\n// https://stackoverflow.com/questions/70684030/remove-all-optional-items-from-a-tuple-type\ntype RequiredParams<\n T extends any[],\n U extends any[] = []\n> = Partial<T> extends T\n ? U\n : T extends [infer F, ...infer R]\n ? RequiredParams<R, [...U, F]>\n : U;\n\ntype OptionalParams<T extends any[]> = T extends [\n ...RequiredParams<T>,\n ...infer R\n]\n ? [...R]\n : [];\n\ntype HandleRequiredParams<P, R extends any[]> = R extends [infer H, ...infer T]\n ? [string | RequiredParam<P, H>, ...HandleRequiredParams<P, T>]\n : [];\n\ntype HandleOptionalParams<P, R extends any[]> = R extends [infer H, ...infer T]\n ?\n | []\n | [\n string | OptionalParam<P, H | undefined>,\n ...HandleOptionalParams<P, T>\n ]\n : R extends []\n ? []\n : R extends Array<infer T>\n ? [] | [RestParam<P, T[]>]\n : [];\n\nexport type HandleParams<P extends any[]> = [\n ...HandleRequiredParams<P, RequiredParams<P>>,\n ...HandleOptionalParams<P, Required<OptionalParams<P>>>\n];\n\nexport type HandleReturnType<P, T> = VoidType | ParamType<P, T>;\n\nexport interface CustomFunctionMeta<F extends (...args: any[]) => any> {\n /**\n * The javascript name of the function. Notice it must be unique across all\n * other functions and function namespaces. If two functions have the same\n * name, they should be registered with different `meta.namespace`.\n */\n name: string;\n /**\n * A namespace for organizing groups of functions. It's also used to handle\n * function name collisions. If a function has a namespace, it will be used\n * whenever accessing the function.\n */\n namespace?: string;\n /**\n * Documentation for the registered function.\n */\n description?: string;\n /**\n * An array containing the list of parameters names the function takes.\n * Optionally they can also be registered with the expected param types.\n */\n params?: HandleParams<Parameters<F>>;\n /**\n * Return value information.\n */\n returnValue?: {\n /**\n * The function return type.\n */\n type?: HandleReturnType<Parameters<F>, ReturnType<F>>;\n /**\n * The function return value description.\n */\n description?: string;\n };\n /**\n * Typescript function declaration. If specified, it ignores the types\n * provided by `params` and `returnValue`.\n */\n typescriptDeclaration?: string;\n\n /**\n * Whether this function can be used as a query in the editor.\n */\n isQuery?: boolean;\n /**\n * The path to be used when importing the function in the generated code.\n * It can be the name of the package that contains the function, or the path\n * to the file in the project (relative to the root directory).\n */\n importPath: string;\n /**\n * Whether the function is the default export from that path. Optional: if\n * not specified, it's considered `false`.\n */\n isDefaultExport?: boolean;\n}\n\nexport interface CustomFunctionRegistration {\n function: (...args: any[]) => any;\n meta: CustomFunctionMeta<any>;\n}\n\ndeclare global {\n interface Window {\n __PlasmicFunctionsRegistry: CustomFunctionRegistration[];\n }\n}\n\nif (root.__PlasmicFunctionsRegistry == null) {\n root.__PlasmicFunctionsRegistry = [];\n}\n\nexport default function registerFunction<F extends (...args: any[]) => any>(\n fn: F,\n meta: CustomFunctionMeta<F>\n) {\n // Check for duplicates\n if (\n root.__PlasmicFunctionsRegistry.some(\n (r: CustomFunctionRegistration) =>\n r.function === fn &&\n r.meta.name === meta.name &&\n r.meta.namespace == meta.namespace\n )\n ) {\n return;\n }\n root.__PlasmicFunctionsRegistry.push({ function: fn, meta });\n}\n"],"names":[],"mappings":";AAAA,IAAM,IAAI,GAAG,UAAiB,CAAC;AAsR/B,IAAI,IAAI,CAAC,0BAA0B,IAAI,IAAI,EAAE;AAC3C,IAAA,IAAI,CAAC,0BAA0B,GAAG,EAAE,CAAC;AACtC,CAAA;AAEa,SAAU,gBAAgB,CACtC,EAAK,EACL,IAA2B,EAAA;;AAG3B,IAAA,IACE,IAAI,CAAC,0BAA0B,CAAC,IAAI,CAClC,UAAC,CAA6B,EAAA;AAC5B,QAAA,OAAA,CAAC,CAAC,QAAQ,KAAK,EAAE;AACjB,YAAA,CAAC,CAAC,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI;AACzB,YAAA,CAAC,CAAC,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,SAAS,CAAA;AAFlC,KAEkC,CACrC,EACD;QACA,OAAO;AACR,KAAA;AACD,IAAA,IAAI,CAAC,0BAA0B,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAA,IAAA,EAAE,CAAC,CAAC;AAC/D;;;;"}
|
|
@@ -313,7 +313,7 @@ export interface EventHandlerType<P> extends PropTypeBase<P> {
|
|
|
313
313
|
}
|
|
314
314
|
export interface ChoiceTypeBase<P, T> extends PropTypeBaseDefault<P, T> {
|
|
315
315
|
type: "choice";
|
|
316
|
-
options: string[] | {
|
|
316
|
+
options: (string | number | boolean)[] | {
|
|
317
317
|
label: string;
|
|
318
318
|
value: string | number | boolean;
|
|
319
319
|
}[] | ContextDependentConfig<P, string[] | {
|
|
@@ -1,45 +1,113 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export type
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Context that we pass back to control functions.
|
|
3
|
+
*/
|
|
4
|
+
export type ControlContext<P> = [
|
|
5
|
+
/**
|
|
6
|
+
* props
|
|
7
|
+
*/
|
|
8
|
+
P
|
|
9
|
+
];
|
|
10
|
+
/**
|
|
11
|
+
* Config option that takes the context (e.g., props) of the function call
|
|
12
|
+
* to dynamically set its value.
|
|
13
|
+
*/
|
|
14
|
+
export type ContextDependentConfig<P, R> = (...args: ControlContext<P>) => R;
|
|
15
|
+
export interface BaseParam {
|
|
14
16
|
name: string;
|
|
15
|
-
type?: ParamType<T>;
|
|
16
17
|
description?: string;
|
|
17
18
|
isOptional?: boolean;
|
|
18
|
-
|
|
19
|
+
isRestParameter?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export interface ChoiceTypeBase<P, T> extends BaseParam {
|
|
22
|
+
type: "choice";
|
|
23
|
+
options: T[] | {
|
|
24
|
+
label: string;
|
|
25
|
+
value: T;
|
|
26
|
+
}[] | ContextDependentConfig<P, T[] | {
|
|
27
|
+
label: string;
|
|
28
|
+
value: T;
|
|
29
|
+
}[]>;
|
|
30
|
+
allowSearch?: boolean;
|
|
31
|
+
filterOption?: boolean;
|
|
32
|
+
onSearch?: ContextDependentConfig<P, ((value: string) => void) | undefined>;
|
|
33
|
+
}
|
|
34
|
+
export interface SingleChoiceType<P, T> extends ChoiceTypeBase<P, T> {
|
|
35
|
+
multiSelect?: false;
|
|
36
|
+
}
|
|
37
|
+
export interface MultiChoiceType<P, T> extends ChoiceTypeBase<P, T[]> {
|
|
38
|
+
multiSelect: true;
|
|
39
|
+
}
|
|
40
|
+
export interface CustomChoiceType<P, T> extends ChoiceTypeBase<P, T | T[]> {
|
|
41
|
+
multiSelect: ContextDependentConfig<P, boolean>;
|
|
42
|
+
}
|
|
43
|
+
export type ChoiceType<P, T> = SingleChoiceType<P, T> | MultiChoiceType<P, T> | CustomChoiceType<P, T>;
|
|
44
|
+
export interface PlainStringType<T extends string = string> extends BaseParam {
|
|
45
|
+
type: "string" | `'${T}'`;
|
|
46
|
+
}
|
|
47
|
+
export type StringType<P, T extends string = string> = "string" | PlainStringType<T> | ChoiceType<P, T> | AnyType;
|
|
48
|
+
export interface PlainNumberType<T extends number = number> extends BaseParam {
|
|
49
|
+
type: "number" | `${number extends T ? number : T}`;
|
|
50
|
+
}
|
|
51
|
+
export type NumberType<P, T extends number = number> = PlainNumberType<T> | ChoiceType<P, T> | AnyType;
|
|
52
|
+
export interface PlainBooleanType<T extends boolean = boolean> extends BaseParam {
|
|
53
|
+
type: "boolean" | `${boolean extends T ? boolean : T}`;
|
|
19
54
|
}
|
|
20
|
-
export
|
|
55
|
+
export type BooleanType<P, T extends boolean = boolean> = PlainBooleanType<T> | ChoiceType<P, T> | AnyType;
|
|
56
|
+
export interface PlainNullType extends BaseParam {
|
|
57
|
+
type: "null";
|
|
58
|
+
}
|
|
59
|
+
export type NullType = PlainNullType | AnyType;
|
|
60
|
+
export interface PlainUndefinedType extends BaseParam {
|
|
61
|
+
type: "undefined";
|
|
62
|
+
}
|
|
63
|
+
export type UndefinedType = PlainUndefinedType | AnyType;
|
|
64
|
+
export interface PlainArrayType extends BaseParam {
|
|
65
|
+
type: "array";
|
|
66
|
+
}
|
|
67
|
+
export type ArrayType = PlainArrayType | AnyType;
|
|
68
|
+
export interface PlainObjectType extends BaseParam {
|
|
69
|
+
type: "object";
|
|
70
|
+
}
|
|
71
|
+
export type ObjectType = PlainObjectType | AnyType;
|
|
72
|
+
export interface PlainAnyType extends BaseParam {
|
|
73
|
+
type: "any";
|
|
74
|
+
}
|
|
75
|
+
export type AnyType = PlainAnyType;
|
|
76
|
+
export interface PlainVoidType extends BaseParam {
|
|
77
|
+
type: "void";
|
|
78
|
+
}
|
|
79
|
+
export type VoidType = PlainVoidType | AnyType;
|
|
80
|
+
type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
81
|
+
type CommonType<T> = T extends null ? NullType : T extends undefined ? UndefinedType : T extends Array<any> ? ArrayType : T extends object ? ObjectType : AnyType;
|
|
82
|
+
type AnyTyping<P, T> = T extends string ? StringType<P, T> : T extends number ? NumberType<P, T> : T extends boolean ? BooleanType<P, T> : CommonType<T>;
|
|
83
|
+
export type RestrictedType<P, T> = IsAny<T> extends true ? AnyTyping<P, T> : [T] extends [string] ? StringType<P, T> : [T] extends [number] ? NumberType<P, T> : [T] extends [boolean] ? BooleanType<P, T> : CommonType<T>;
|
|
84
|
+
export type ParamType<P, T> = RestrictedType<P, T>;
|
|
85
|
+
export type RequiredParam<P, T> = ParamType<P, T> & {
|
|
21
86
|
isOptional?: false;
|
|
22
87
|
isRestParameter?: false;
|
|
23
|
-
}
|
|
24
|
-
export
|
|
88
|
+
};
|
|
89
|
+
export type OptionalParam<P, T> = ParamType<P, T> & {
|
|
25
90
|
isRestParameter?: false;
|
|
26
|
-
}
|
|
27
|
-
export
|
|
91
|
+
};
|
|
92
|
+
export type RestParam<P, T> = ParamType<P, T> & {
|
|
28
93
|
isOptional?: false;
|
|
29
94
|
isRestParameter: true;
|
|
30
|
-
}
|
|
95
|
+
};
|
|
31
96
|
type RequiredParams<T extends any[], U extends any[] = []> = Partial<T> extends T ? U : T extends [infer F, ...infer R] ? RequiredParams<R, [...U, F]> : U;
|
|
32
97
|
type OptionalParams<T extends any[]> = T extends [
|
|
33
98
|
...RequiredParams<T>,
|
|
34
99
|
...infer R
|
|
35
100
|
] ? [...R] : [];
|
|
36
|
-
type HandleRequiredParams<P extends any[]> =
|
|
37
|
-
type HandleOptionalParams<P extends any[]> =
|
|
101
|
+
type HandleRequiredParams<P, R extends any[]> = R extends [infer H, ...infer T] ? [string | RequiredParam<P, H>, ...HandleRequiredParams<P, T>] : [];
|
|
102
|
+
type HandleOptionalParams<P, R extends any[]> = R extends [infer H, ...infer T] ? [] | [
|
|
103
|
+
string | OptionalParam<P, H | undefined>,
|
|
104
|
+
...HandleOptionalParams<P, T>
|
|
105
|
+
] : R extends [] ? [] : R extends Array<infer T> ? [] | [RestParam<P, T[]>] : [];
|
|
38
106
|
export type HandleParams<P extends any[]> = [
|
|
39
|
-
...HandleRequiredParams<RequiredParams<P>>,
|
|
40
|
-
...HandleOptionalParams<Required<OptionalParams<P>>>
|
|
107
|
+
...HandleRequiredParams<P, RequiredParams<P>>,
|
|
108
|
+
...HandleOptionalParams<P, Required<OptionalParams<P>>>
|
|
41
109
|
];
|
|
42
|
-
export type HandleReturnType<T> = VoidType | ParamType<T>;
|
|
110
|
+
export type HandleReturnType<P, T> = VoidType | ParamType<P, T>;
|
|
43
111
|
export interface CustomFunctionMeta<F extends (...args: any[]) => any> {
|
|
44
112
|
/**
|
|
45
113
|
* The javascript name of the function. Notice it must be unique across all
|
|
@@ -69,7 +137,7 @@ export interface CustomFunctionMeta<F extends (...args: any[]) => any> {
|
|
|
69
137
|
/**
|
|
70
138
|
* The function return type.
|
|
71
139
|
*/
|
|
72
|
-
type?: HandleReturnType<ReturnType<F>>;
|
|
140
|
+
type?: HandleReturnType<Parameters<F>, ReturnType<F>>;
|
|
73
141
|
/**
|
|
74
142
|
* The function return value description.
|
|
75
143
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const hostVersion = "1.0.
|
|
1
|
+
export declare const hostVersion = "1.0.213";
|
|
@@ -313,7 +313,7 @@ export interface EventHandlerType<P> extends PropTypeBase<P> {
|
|
|
313
313
|
}
|
|
314
314
|
export interface ChoiceTypeBase<P, T> extends PropTypeBaseDefault<P, T> {
|
|
315
315
|
type: "choice";
|
|
316
|
-
options: string[] | {
|
|
316
|
+
options: (string | number | boolean)[] | {
|
|
317
317
|
label: string;
|
|
318
318
|
value: string | number | boolean;
|
|
319
319
|
}[] | ContextDependentConfig<P, string[] | {
|
|
@@ -1,45 +1,113 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export type
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Context that we pass back to control functions.
|
|
3
|
+
*/
|
|
4
|
+
export type ControlContext<P> = [
|
|
5
|
+
/**
|
|
6
|
+
* props
|
|
7
|
+
*/
|
|
8
|
+
P
|
|
9
|
+
];
|
|
10
|
+
/**
|
|
11
|
+
* Config option that takes the context (e.g., props) of the function call
|
|
12
|
+
* to dynamically set its value.
|
|
13
|
+
*/
|
|
14
|
+
export type ContextDependentConfig<P, R> = (...args: ControlContext<P>) => R;
|
|
15
|
+
export interface BaseParam {
|
|
14
16
|
name: string;
|
|
15
|
-
type?: ParamType<T>;
|
|
16
17
|
description?: string;
|
|
17
18
|
isOptional?: boolean;
|
|
18
|
-
|
|
19
|
+
isRestParameter?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export interface ChoiceTypeBase<P, T> extends BaseParam {
|
|
22
|
+
type: "choice";
|
|
23
|
+
options: T[] | {
|
|
24
|
+
label: string;
|
|
25
|
+
value: T;
|
|
26
|
+
}[] | ContextDependentConfig<P, T[] | {
|
|
27
|
+
label: string;
|
|
28
|
+
value: T;
|
|
29
|
+
}[]>;
|
|
30
|
+
allowSearch?: boolean;
|
|
31
|
+
filterOption?: boolean;
|
|
32
|
+
onSearch?: ContextDependentConfig<P, ((value: string) => void) | undefined>;
|
|
33
|
+
}
|
|
34
|
+
export interface SingleChoiceType<P, T> extends ChoiceTypeBase<P, T> {
|
|
35
|
+
multiSelect?: false;
|
|
36
|
+
}
|
|
37
|
+
export interface MultiChoiceType<P, T> extends ChoiceTypeBase<P, T[]> {
|
|
38
|
+
multiSelect: true;
|
|
39
|
+
}
|
|
40
|
+
export interface CustomChoiceType<P, T> extends ChoiceTypeBase<P, T | T[]> {
|
|
41
|
+
multiSelect: ContextDependentConfig<P, boolean>;
|
|
42
|
+
}
|
|
43
|
+
export type ChoiceType<P, T> = SingleChoiceType<P, T> | MultiChoiceType<P, T> | CustomChoiceType<P, T>;
|
|
44
|
+
export interface PlainStringType<T extends string = string> extends BaseParam {
|
|
45
|
+
type: "string" | `'${T}'`;
|
|
46
|
+
}
|
|
47
|
+
export type StringType<P, T extends string = string> = "string" | PlainStringType<T> | ChoiceType<P, T> | AnyType;
|
|
48
|
+
export interface PlainNumberType<T extends number = number> extends BaseParam {
|
|
49
|
+
type: "number" | `${number extends T ? number : T}`;
|
|
50
|
+
}
|
|
51
|
+
export type NumberType<P, T extends number = number> = PlainNumberType<T> | ChoiceType<P, T> | AnyType;
|
|
52
|
+
export interface PlainBooleanType<T extends boolean = boolean> extends BaseParam {
|
|
53
|
+
type: "boolean" | `${boolean extends T ? boolean : T}`;
|
|
19
54
|
}
|
|
20
|
-
export
|
|
55
|
+
export type BooleanType<P, T extends boolean = boolean> = PlainBooleanType<T> | ChoiceType<P, T> | AnyType;
|
|
56
|
+
export interface PlainNullType extends BaseParam {
|
|
57
|
+
type: "null";
|
|
58
|
+
}
|
|
59
|
+
export type NullType = PlainNullType | AnyType;
|
|
60
|
+
export interface PlainUndefinedType extends BaseParam {
|
|
61
|
+
type: "undefined";
|
|
62
|
+
}
|
|
63
|
+
export type UndefinedType = PlainUndefinedType | AnyType;
|
|
64
|
+
export interface PlainArrayType extends BaseParam {
|
|
65
|
+
type: "array";
|
|
66
|
+
}
|
|
67
|
+
export type ArrayType = PlainArrayType | AnyType;
|
|
68
|
+
export interface PlainObjectType extends BaseParam {
|
|
69
|
+
type: "object";
|
|
70
|
+
}
|
|
71
|
+
export type ObjectType = PlainObjectType | AnyType;
|
|
72
|
+
export interface PlainAnyType extends BaseParam {
|
|
73
|
+
type: "any";
|
|
74
|
+
}
|
|
75
|
+
export type AnyType = PlainAnyType;
|
|
76
|
+
export interface PlainVoidType extends BaseParam {
|
|
77
|
+
type: "void";
|
|
78
|
+
}
|
|
79
|
+
export type VoidType = PlainVoidType | AnyType;
|
|
80
|
+
type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
81
|
+
type CommonType<T> = T extends null ? NullType : T extends undefined ? UndefinedType : T extends Array<any> ? ArrayType : T extends object ? ObjectType : AnyType;
|
|
82
|
+
type AnyTyping<P, T> = T extends string ? StringType<P, T> : T extends number ? NumberType<P, T> : T extends boolean ? BooleanType<P, T> : CommonType<T>;
|
|
83
|
+
export type RestrictedType<P, T> = IsAny<T> extends true ? AnyTyping<P, T> : [T] extends [string] ? StringType<P, T> : [T] extends [number] ? NumberType<P, T> : [T] extends [boolean] ? BooleanType<P, T> : CommonType<T>;
|
|
84
|
+
export type ParamType<P, T> = RestrictedType<P, T>;
|
|
85
|
+
export type RequiredParam<P, T> = ParamType<P, T> & {
|
|
21
86
|
isOptional?: false;
|
|
22
87
|
isRestParameter?: false;
|
|
23
|
-
}
|
|
24
|
-
export
|
|
88
|
+
};
|
|
89
|
+
export type OptionalParam<P, T> = ParamType<P, T> & {
|
|
25
90
|
isRestParameter?: false;
|
|
26
|
-
}
|
|
27
|
-
export
|
|
91
|
+
};
|
|
92
|
+
export type RestParam<P, T> = ParamType<P, T> & {
|
|
28
93
|
isOptional?: false;
|
|
29
94
|
isRestParameter: true;
|
|
30
|
-
}
|
|
95
|
+
};
|
|
31
96
|
type RequiredParams<T extends any[], U extends any[] = []> = Partial<T> extends T ? U : T extends [infer F, ...infer R] ? RequiredParams<R, [...U, F]> : U;
|
|
32
97
|
type OptionalParams<T extends any[]> = T extends [
|
|
33
98
|
...RequiredParams<T>,
|
|
34
99
|
...infer R
|
|
35
100
|
] ? [...R] : [];
|
|
36
|
-
type HandleRequiredParams<P extends any[]> =
|
|
37
|
-
type HandleOptionalParams<P extends any[]> =
|
|
101
|
+
type HandleRequiredParams<P, R extends any[]> = R extends [infer H, ...infer T] ? [string | RequiredParam<P, H>, ...HandleRequiredParams<P, T>] : [];
|
|
102
|
+
type HandleOptionalParams<P, R extends any[]> = R extends [infer H, ...infer T] ? [] | [
|
|
103
|
+
string | OptionalParam<P, H | undefined>,
|
|
104
|
+
...HandleOptionalParams<P, T>
|
|
105
|
+
] : R extends [] ? [] : R extends Array<infer T> ? [] | [RestParam<P, T[]>] : [];
|
|
38
106
|
export type HandleParams<P extends any[]> = [
|
|
39
|
-
...HandleRequiredParams<RequiredParams<P>>,
|
|
40
|
-
...HandleOptionalParams<Required<OptionalParams<P>>>
|
|
107
|
+
...HandleRequiredParams<P, RequiredParams<P>>,
|
|
108
|
+
...HandleOptionalParams<P, Required<OptionalParams<P>>>
|
|
41
109
|
];
|
|
42
|
-
export type HandleReturnType<T> = VoidType | ParamType<T>;
|
|
110
|
+
export type HandleReturnType<P, T> = VoidType | ParamType<P, T>;
|
|
43
111
|
export interface CustomFunctionMeta<F extends (...args: any[]) => any> {
|
|
44
112
|
/**
|
|
45
113
|
* The javascript name of the function. Notice it must be unique across all
|
|
@@ -69,7 +137,7 @@ export interface CustomFunctionMeta<F extends (...args: any[]) => any> {
|
|
|
69
137
|
/**
|
|
70
138
|
* The function return type.
|
|
71
139
|
*/
|
|
72
|
-
type?: HandleReturnType<ReturnType<F>>;
|
|
140
|
+
type?: HandleReturnType<Parameters<F>, ReturnType<F>>;
|
|
73
141
|
/**
|
|
74
142
|
* The function return value description.
|
|
75
143
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const hostVersion = "1.0.
|
|
1
|
+
export declare const hostVersion = "1.0.213";
|
|
@@ -313,7 +313,7 @@ export interface EventHandlerType<P> extends PropTypeBase<P> {
|
|
|
313
313
|
}
|
|
314
314
|
export interface ChoiceTypeBase<P, T> extends PropTypeBaseDefault<P, T> {
|
|
315
315
|
type: "choice";
|
|
316
|
-
options: string[] | {
|
|
316
|
+
options: (string | number | boolean)[] | {
|
|
317
317
|
label: string;
|
|
318
318
|
value: string | number | boolean;
|
|
319
319
|
}[] | ContextDependentConfig<P, string[] | {
|