@monbolc/lowcode-types 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.
- package/es/index.js +11 -0
- package/es/index.js.map +1 -0
- package/lib/index.d.ts +179 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +11 -0
- package/lib/index.js.map +1 -0
- package/package.json +43 -0
package/es/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @monbolc/lowcode-types
|
|
3
|
+
*
|
|
4
|
+
* Core type definitions for SapuLowcodeEngine.
|
|
5
|
+
* This package is a pure-types layer (L0) — no runtime side effects, no React imports.
|
|
6
|
+
*
|
|
7
|
+
* Versioning follows semver. Bumping a major version means breaking
|
|
8
|
+
* type signatures; minor means additive types.
|
|
9
|
+
*/
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
package/es/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG"}
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @monbolc/lowcode-types
|
|
3
|
+
*
|
|
4
|
+
* Core type definitions for SapuLowcodeEngine.
|
|
5
|
+
* This package is a pure-types layer (L0) — no runtime side effects, no React imports.
|
|
6
|
+
*
|
|
7
|
+
* Versioning follows semver. Bumping a major version means breaking
|
|
8
|
+
* type signatures; minor means additive types.
|
|
9
|
+
*/
|
|
10
|
+
/** Globally unique identifier (uuid v4 in practice). */
|
|
11
|
+
export type ID = string;
|
|
12
|
+
/** Human-readable label, never used as identity. */
|
|
13
|
+
export type Label = string;
|
|
14
|
+
/** JSON-compatible value (used in `props` and `data`). */
|
|
15
|
+
export type JSONValue = string | number | boolean | null | JSONValue[] | {
|
|
16
|
+
[k: string]: JSONValue;
|
|
17
|
+
};
|
|
18
|
+
/** Anything serializable; opaque to the engine. */
|
|
19
|
+
export type Unknown = unknown;
|
|
20
|
+
/** Schema for a single node in the page tree. */
|
|
21
|
+
export interface IPublicTypeNodeSchema {
|
|
22
|
+
/** Component name (e.g. "Button", "Page", "Div"). */
|
|
23
|
+
componentName: string;
|
|
24
|
+
/** Props passed to the component. */
|
|
25
|
+
props?: Record<string, JSONValue>;
|
|
26
|
+
/** Child nodes (declarative; engine resolves them at render time). */
|
|
27
|
+
children?: IPublicTypeNodeSchema[];
|
|
28
|
+
/** Optional condition: if expression is falsy, node is hidden. */
|
|
29
|
+
condition?: IPublicTypeNodeData;
|
|
30
|
+
/** Loop source: bind `item` and `index` to render a list. */
|
|
31
|
+
loop?: IPublicTypeNodeData;
|
|
32
|
+
/** Loop iteration variable name. Default: "item". */
|
|
33
|
+
loopItemName?: string;
|
|
34
|
+
/** Loop index variable name. Default: "index". */
|
|
35
|
+
loopIndexName?: string;
|
|
36
|
+
/** Unique key for diffing. If absent, the engine generates one. */
|
|
37
|
+
key?: string;
|
|
38
|
+
/** Free-form metadata; engine preserves it but does not interpret it. */
|
|
39
|
+
meta?: Record<string, Unknown>;
|
|
40
|
+
}
|
|
41
|
+
/** Inline data: either a literal value or a JS expression. */
|
|
42
|
+
export type IPublicTypeNodeData = {
|
|
43
|
+
type: 'literal';
|
|
44
|
+
value: JSONValue; /** compile-time mock value */
|
|
45
|
+
mock?: JSONValue;
|
|
46
|
+
} | {
|
|
47
|
+
type: 'expression';
|
|
48
|
+
value: string; /** compile-time mock */
|
|
49
|
+
mock?: JSONValue;
|
|
50
|
+
} | {
|
|
51
|
+
type: 'binding';
|
|
52
|
+
value: string;
|
|
53
|
+
mock?: JSONValue;
|
|
54
|
+
};
|
|
55
|
+
/** Root schema for an entire page. */
|
|
56
|
+
export interface IPublicTypeRootSchema extends IPublicTypeNodeSchema {
|
|
57
|
+
/** File name (e.g. "page.json"). */
|
|
58
|
+
fileName: string;
|
|
59
|
+
/** Optional data-source entries scoped to this page. */
|
|
60
|
+
dataSources?: Record<string, IPublicTypeDataSource>;
|
|
61
|
+
}
|
|
62
|
+
/** Description of a single component registered in the engine. */
|
|
63
|
+
export interface IPublicTypeComponentSchema {
|
|
64
|
+
/** Component name. Must match `IPublicTypeNodeSchema.componentName`. */
|
|
65
|
+
componentName: string;
|
|
66
|
+
/** Display title in the components panel. */
|
|
67
|
+
title: string;
|
|
68
|
+
/** Icon URL or inline SVG string. */
|
|
69
|
+
icon?: string;
|
|
70
|
+
/** Tag for grouping (e.g. "Layout", "Form"). */
|
|
71
|
+
category?: string;
|
|
72
|
+
/** Where this component may be placed. */
|
|
73
|
+
nestingRule?: IPublicTypeNestingRule;
|
|
74
|
+
/** Default props applied at insertion time. */
|
|
75
|
+
initialProps?: Record<string, JSONValue>;
|
|
76
|
+
/** Property descriptors (rendered in the settings panel). */
|
|
77
|
+
configure?: IPublicTypeComponentConfigure;
|
|
78
|
+
}
|
|
79
|
+
/** Restrictions on where a component may live. */
|
|
80
|
+
export interface IPublicTypeNestingRule {
|
|
81
|
+
/** Whitelist of parent component names. Empty = universal. */
|
|
82
|
+
parentWhitelist?: string[];
|
|
83
|
+
/** Blacklist of parent component names (overrides whitelist). */
|
|
84
|
+
parentBlacklist?: string[];
|
|
85
|
+
/** Whitelist of child component names. Empty = all. */
|
|
86
|
+
childWhitelist?: string[];
|
|
87
|
+
/** Blacklist of child component names. */
|
|
88
|
+
childBlacklist?: string[];
|
|
89
|
+
}
|
|
90
|
+
/** Field configurations for the settings panel. */
|
|
91
|
+
export interface IPublicTypeComponentConfigure {
|
|
92
|
+
/** Component-level props. */
|
|
93
|
+
props?: IPublicTypeFieldConfig[];
|
|
94
|
+
/** Style override panel. */
|
|
95
|
+
style?: IPublicTypeFieldConfig[];
|
|
96
|
+
/** Lifecycle events. */
|
|
97
|
+
events?: IPublicTypeEventConfig[];
|
|
98
|
+
/** Conditional rendering / looping. */
|
|
99
|
+
advanced?: IPublicTypeAdvancedConfig;
|
|
100
|
+
}
|
|
101
|
+
export interface IPublicTypeFieldConfig {
|
|
102
|
+
/** Prop name in `IPublicTypeNodeSchema.props`. */
|
|
103
|
+
name: string;
|
|
104
|
+
/** Display title in the panel. */
|
|
105
|
+
title: string;
|
|
106
|
+
/** Editor kind. */
|
|
107
|
+
setter: string | IPublicTypeSetterConfig;
|
|
108
|
+
/** Whether the prop is required. */
|
|
109
|
+
required?: boolean;
|
|
110
|
+
/** Default value if user does not provide one. */
|
|
111
|
+
defaultValue?: JSONValue;
|
|
112
|
+
/** Free-form extra config (e.g. min/max, options, regex). */
|
|
113
|
+
extraProps?: Record<string, Unknown>;
|
|
114
|
+
}
|
|
115
|
+
export interface IPublicTypeSetterConfig {
|
|
116
|
+
/** Settler component name. */
|
|
117
|
+
componentName: string;
|
|
118
|
+
/** Props forwarded to the setter. */
|
|
119
|
+
props?: Record<string, Unknown>;
|
|
120
|
+
}
|
|
121
|
+
export interface IPublicTypeEventConfig {
|
|
122
|
+
/** Event name (e.g. "onClick"). */
|
|
123
|
+
name: string;
|
|
124
|
+
/** Display title. */
|
|
125
|
+
title: string;
|
|
126
|
+
/** Default action payload. */
|
|
127
|
+
defaultAction?: IPublicTypeActionContent;
|
|
128
|
+
}
|
|
129
|
+
export interface IPublicTypeAdvancedConfig {
|
|
130
|
+
/** Show "v-if"-style condition editor. */
|
|
131
|
+
condition?: boolean;
|
|
132
|
+
/** Show loop editor. */
|
|
133
|
+
loop?: boolean;
|
|
134
|
+
}
|
|
135
|
+
export type IPublicTypeActionContent = {
|
|
136
|
+
type: 'method';
|
|
137
|
+
value: string; /** mock */
|
|
138
|
+
mock?: JSONValue;
|
|
139
|
+
} | {
|
|
140
|
+
type: 'link';
|
|
141
|
+
value: string;
|
|
142
|
+
} | {
|
|
143
|
+
type: 'script';
|
|
144
|
+
value: string;
|
|
145
|
+
mock?: JSONValue;
|
|
146
|
+
};
|
|
147
|
+
export interface IPublicTypeDataSource {
|
|
148
|
+
/** Unique id within the schema. */
|
|
149
|
+
id: ID;
|
|
150
|
+
/** Display label. */
|
|
151
|
+
title?: string;
|
|
152
|
+
/** Request handler id registered in the engine. */
|
|
153
|
+
handler: string;
|
|
154
|
+
/** Initial request options. */
|
|
155
|
+
options?: Record<string, JSONValue>;
|
|
156
|
+
/** Path into the response to extract the data array. */
|
|
157
|
+
dataHandler?: string;
|
|
158
|
+
}
|
|
159
|
+
export interface IPublicEngineOptions {
|
|
160
|
+
/** Root DOM container. */
|
|
161
|
+
container: HTMLElement | string;
|
|
162
|
+
/** Initial root schema. */
|
|
163
|
+
schema?: IPublicTypeRootSchema;
|
|
164
|
+
/** Registered component schemas (key = componentName). */
|
|
165
|
+
components?: Record<string, IPublicTypeComponentSchema>;
|
|
166
|
+
/** Theme: "light" | "dark" | custom CSS object. */
|
|
167
|
+
theme?: 'light' | 'dark' | Record<string, string>;
|
|
168
|
+
}
|
|
169
|
+
export interface IPublicApiEngine {
|
|
170
|
+
/** Mount the engine into the container. */
|
|
171
|
+
init(options: IPublicEngineOptions): Promise<void>;
|
|
172
|
+
/** Tear down and unmount. */
|
|
173
|
+
destroy(): Promise<void>;
|
|
174
|
+
/** Save current page schema. */
|
|
175
|
+
saveSchema(): IPublicTypeRootSchema;
|
|
176
|
+
/** Hot-swap the schema (used for live preview). */
|
|
177
|
+
loadSchema(schema: IPublicTypeRootSchema): void;
|
|
178
|
+
}
|
|
179
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,wDAAwD;AACxD,MAAM,MAAM,EAAE,GAAG,MAAM,CAAC;AAExB,oDAAoD;AACpD,MAAM,MAAM,KAAK,GAAG,MAAM,CAAC;AAE3B,0DAA0D;AAC1D,MAAM,MAAM,SAAS,GACjB,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ,SAAS,EAAE,GACX;IAAE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AC,CAAC;IAEpC,wDAAwD;IACxD,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAID,MAAM,WAAW,oBAAoB;IACnC,0BAA0B;IAC1B,SAAS,EAAE,WAAW,GAAG,MAAM,CAAC;IAEhC,2BAA2B;IAC3B,MAAM,CAAC,EAAE,qBAAqB,CAAC;IAE/B,0DAA0D;IAC1D,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,0BAA0B,CAAC,CAAC;IAExD,mDAAmD;IACnD,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACnD;AAID,MAAM,WAAW,gBAAgB;IAC/B,2CAA2C;IAC3C,IAAI,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEnD,6BAA6B;IAC7B,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEzB,gCAAgC;IAChC,UAAU,IAAI,qBAAqB,CAAC;IAEpC,mDAAmD;IACnD,UAAU,CAAC,MAAM,EAAE,qBAAqB,GAAG,IAAI,CAAC;CACjD"}
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @monbolc/lowcode-types
|
|
3
|
+
*
|
|
4
|
+
* Core type definitions for SapuLowcodeEngine.
|
|
5
|
+
* This package is a pure-types layer (L0) — no runtime side effects, no React imports.
|
|
6
|
+
*
|
|
7
|
+
* Versioning follows semver. Bumping a major version means breaking
|
|
8
|
+
* type signatures; minor means additive types.
|
|
9
|
+
*/
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG"}
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@monbolc/lowcode-types",
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "Core type definitions for SapuLowcodeEngine",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"main": "lib/index.js",
|
|
7
|
+
"module": "es/index.js",
|
|
8
|
+
"types": "lib/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./lib/index.d.ts",
|
|
12
|
+
"import": "./es/index.js",
|
|
13
|
+
"require": "./lib/index.js"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"lib",
|
|
18
|
+
"es"
|
|
19
|
+
],
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "tsc -p tsconfig.json",
|
|
22
|
+
"build:es": "tsc -p tsconfig.esm.json",
|
|
23
|
+
"clean": "rimraf lib es"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"rimraf": "^5.0.5",
|
|
27
|
+
"typescript": "^5.4.5"
|
|
28
|
+
},
|
|
29
|
+
"publishConfig": {
|
|
30
|
+
"access": "public",
|
|
31
|
+
"registry": "https://registry.npmjs.org/"
|
|
32
|
+
},
|
|
33
|
+
"repository": {
|
|
34
|
+
"type": "git",
|
|
35
|
+
"url": "git@github.com:monbolc/sapu-lowcode-engine.git",
|
|
36
|
+
"directory": "packages/types"
|
|
37
|
+
},
|
|
38
|
+
"keywords": [
|
|
39
|
+
"lowcode",
|
|
40
|
+
"engine",
|
|
41
|
+
"types"
|
|
42
|
+
]
|
|
43
|
+
}
|