@sdata-plugin-adapter/types 0.0.0-alpha.1
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/index.cjs +17 -0
- package/dist/index.d.cts +73 -0
- package/dist/index.d.ts +73 -0
- package/dist/index.js +0 -0
- package/package.json +28 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
+
|
|
15
|
+
// index.ts
|
|
16
|
+
var index_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(index_exports);
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import * as ReactDOMClientType from 'react-dom/client';
|
|
2
|
+
|
|
3
|
+
interface CustomConfig {
|
|
4
|
+
componentId: string;
|
|
5
|
+
id: string;
|
|
6
|
+
appId?: string;
|
|
7
|
+
[key: string]: any;
|
|
8
|
+
}
|
|
9
|
+
type ConfigType = "default" | "data" | "style" | "interaction";
|
|
10
|
+
type ActionsFunction = {
|
|
11
|
+
[key: string]: (...args: any[]) => any;
|
|
12
|
+
};
|
|
13
|
+
type ActionsPayload = {
|
|
14
|
+
key: string;
|
|
15
|
+
name: string;
|
|
16
|
+
params: {
|
|
17
|
+
key: string;
|
|
18
|
+
name: string;
|
|
19
|
+
dataType: string;
|
|
20
|
+
}[];
|
|
21
|
+
hasReturn: boolean;
|
|
22
|
+
};
|
|
23
|
+
type EventsPayload = {
|
|
24
|
+
key: string;
|
|
25
|
+
name: string;
|
|
26
|
+
payload: {
|
|
27
|
+
name: string;
|
|
28
|
+
key: string;
|
|
29
|
+
dataType: string;
|
|
30
|
+
}[];
|
|
31
|
+
}[];
|
|
32
|
+
interface EventActionDefinitions {
|
|
33
|
+
actions: ActionsPayload;
|
|
34
|
+
events: EventsPayload;
|
|
35
|
+
}
|
|
36
|
+
interface UseRegisterComponentParams {
|
|
37
|
+
actions?: ActionsFunction;
|
|
38
|
+
eventActionDefinitions?: EventActionDefinitions;
|
|
39
|
+
}
|
|
40
|
+
interface AppTriggerEventPayload {
|
|
41
|
+
componentId?: string;
|
|
42
|
+
event: string;
|
|
43
|
+
payload?: Record<string, any>;
|
|
44
|
+
[key: string]: any;
|
|
45
|
+
}
|
|
46
|
+
interface AdapterProps {
|
|
47
|
+
isConfig?: boolean;
|
|
48
|
+
changeCustomConfig?: (customConfigStr: string) => void;
|
|
49
|
+
onConfigChange: (config: any) => void;
|
|
50
|
+
componentId?: string;
|
|
51
|
+
customConfig: CustomConfig;
|
|
52
|
+
configType?: ConfigType;
|
|
53
|
+
type?: string;
|
|
54
|
+
appTriggerEvent?: (payload: AppTriggerEventPayload) => void;
|
|
55
|
+
triggerEvent?: (eventName: string, payload?: Record<string, any>) => void;
|
|
56
|
+
useRegisterComponent?: (params: UseRegisterComponentParams) => void;
|
|
57
|
+
[key: string]: any;
|
|
58
|
+
}
|
|
59
|
+
type PluginProps = AdapterProps & Record<string, any>;
|
|
60
|
+
interface createPluginOptions {
|
|
61
|
+
App: React.ComponentType;
|
|
62
|
+
setAttributes: (dom: Element, props: PluginProps) => Promise<any>;
|
|
63
|
+
adapter: (props: AdapterProps) => AdapterProps;
|
|
64
|
+
beforeBootstrap?: (callback: () => void) => void;
|
|
65
|
+
}
|
|
66
|
+
interface EventBus {
|
|
67
|
+
emit: (props: Record<string, any>) => void;
|
|
68
|
+
on: (callback: (payload?: any) => void) => void;
|
|
69
|
+
remove: () => void;
|
|
70
|
+
}
|
|
71
|
+
type PluginRun = (dom: Element, props: PluginProps, context?: Record<string, any>, eventBus?: EventBus, setCompRoot?: (root: ReactDOMClientType.Root) => void) => void;
|
|
72
|
+
|
|
73
|
+
export type { ActionsFunction, ActionsPayload, AdapterProps, AppTriggerEventPayload, CustomConfig, EventActionDefinitions, EventBus, EventsPayload, PluginProps, PluginRun, UseRegisterComponentParams, createPluginOptions };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import * as ReactDOMClientType from 'react-dom/client';
|
|
2
|
+
|
|
3
|
+
interface CustomConfig {
|
|
4
|
+
componentId: string;
|
|
5
|
+
id: string;
|
|
6
|
+
appId?: string;
|
|
7
|
+
[key: string]: any;
|
|
8
|
+
}
|
|
9
|
+
type ConfigType = "default" | "data" | "style" | "interaction";
|
|
10
|
+
type ActionsFunction = {
|
|
11
|
+
[key: string]: (...args: any[]) => any;
|
|
12
|
+
};
|
|
13
|
+
type ActionsPayload = {
|
|
14
|
+
key: string;
|
|
15
|
+
name: string;
|
|
16
|
+
params: {
|
|
17
|
+
key: string;
|
|
18
|
+
name: string;
|
|
19
|
+
dataType: string;
|
|
20
|
+
}[];
|
|
21
|
+
hasReturn: boolean;
|
|
22
|
+
};
|
|
23
|
+
type EventsPayload = {
|
|
24
|
+
key: string;
|
|
25
|
+
name: string;
|
|
26
|
+
payload: {
|
|
27
|
+
name: string;
|
|
28
|
+
key: string;
|
|
29
|
+
dataType: string;
|
|
30
|
+
}[];
|
|
31
|
+
}[];
|
|
32
|
+
interface EventActionDefinitions {
|
|
33
|
+
actions: ActionsPayload;
|
|
34
|
+
events: EventsPayload;
|
|
35
|
+
}
|
|
36
|
+
interface UseRegisterComponentParams {
|
|
37
|
+
actions?: ActionsFunction;
|
|
38
|
+
eventActionDefinitions?: EventActionDefinitions;
|
|
39
|
+
}
|
|
40
|
+
interface AppTriggerEventPayload {
|
|
41
|
+
componentId?: string;
|
|
42
|
+
event: string;
|
|
43
|
+
payload?: Record<string, any>;
|
|
44
|
+
[key: string]: any;
|
|
45
|
+
}
|
|
46
|
+
interface AdapterProps {
|
|
47
|
+
isConfig?: boolean;
|
|
48
|
+
changeCustomConfig?: (customConfigStr: string) => void;
|
|
49
|
+
onConfigChange: (config: any) => void;
|
|
50
|
+
componentId?: string;
|
|
51
|
+
customConfig: CustomConfig;
|
|
52
|
+
configType?: ConfigType;
|
|
53
|
+
type?: string;
|
|
54
|
+
appTriggerEvent?: (payload: AppTriggerEventPayload) => void;
|
|
55
|
+
triggerEvent?: (eventName: string, payload?: Record<string, any>) => void;
|
|
56
|
+
useRegisterComponent?: (params: UseRegisterComponentParams) => void;
|
|
57
|
+
[key: string]: any;
|
|
58
|
+
}
|
|
59
|
+
type PluginProps = AdapterProps & Record<string, any>;
|
|
60
|
+
interface createPluginOptions {
|
|
61
|
+
App: React.ComponentType;
|
|
62
|
+
setAttributes: (dom: Element, props: PluginProps) => Promise<any>;
|
|
63
|
+
adapter: (props: AdapterProps) => AdapterProps;
|
|
64
|
+
beforeBootstrap?: (callback: () => void) => void;
|
|
65
|
+
}
|
|
66
|
+
interface EventBus {
|
|
67
|
+
emit: (props: Record<string, any>) => void;
|
|
68
|
+
on: (callback: (payload?: any) => void) => void;
|
|
69
|
+
remove: () => void;
|
|
70
|
+
}
|
|
71
|
+
type PluginRun = (dom: Element, props: PluginProps, context?: Record<string, any>, eventBus?: EventBus, setCompRoot?: (root: ReactDOMClientType.Root) => void) => void;
|
|
72
|
+
|
|
73
|
+
export type { ActionsFunction, ActionsPayload, AdapterProps, AppTriggerEventPayload, CustomConfig, EventActionDefinitions, EventBus, EventsPayload, PluginProps, PluginRun, UseRegisterComponentParams, createPluginOptions };
|
package/dist/index.js
ADDED
|
File without changes
|
package/package.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sdata-plugin-adapter/types",
|
|
3
|
+
"version": "0.0.0-alpha.1",
|
|
4
|
+
"description": "adapter types of smdata plugin",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.cjs",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js",
|
|
13
|
+
"require": "./dist/index.cjs"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
19
|
+
"author": "",
|
|
20
|
+
"license": "ISC",
|
|
21
|
+
"publishConfig": {
|
|
22
|
+
"access": "public"
|
|
23
|
+
},
|
|
24
|
+
"scripts": {
|
|
25
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
26
|
+
"build": "tsup"
|
|
27
|
+
}
|
|
28
|
+
}
|