x-state-lib 0.3.43 → 0.3.45

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 (3) hide show
  1. package/dist/index.d.ts +243 -275
  2. package/dist/index.js +1 -146
  3. package/package.json +38 -45
package/dist/index.d.ts CHANGED
@@ -1,275 +1,243 @@
1
- import { Type } from 'x-essential-lib';
2
-
3
- export declare type ActiveApp = {
4
- id: string;
5
- compGroups: CompGroup[];
6
- comps: Comp[];
7
- };
8
-
9
- export declare type ActiveComp = {
10
- id: string;
11
- meta: CompMeta;
12
- };
13
-
14
- export declare type ActiveFlow = {
15
- id: string;
16
- name: string;
17
- };
18
-
19
- export declare type ActiveFunc = {
20
- id: string;
21
- name: string;
22
- inputs?: Field_2[];
23
- outputs?: Field_2[];
24
- };
25
-
26
- export declare type ActiveObjectApp = {
27
- type: 'page' | 'comp';
28
- subtype: string;
29
- version: string;
30
- nodes: {
31
- id: string;
32
- key: string;
33
- alias: string;
34
- slot?: string;
35
- comp?: string;
36
- adaptSlot?: string;
37
- }[];
38
- };
39
-
40
- export declare type ActiveObjectCompute = {
41
- type: 'func' | 'flow';
42
- version: string;
43
- };
44
-
45
- export declare type ActivePage = {
46
- id: string;
47
- meta: PageMeta;
48
- };
49
-
50
- export declare type App = {
51
- appList: AppListEntry[];
52
- activeApp: ActiveApp;
53
- activePage: ActivePage;
54
- activeComp: ActiveComp;
55
- activeObject: ActiveObjectApp;
56
- depends: {
57
- [key: string]: Depend;
58
- };
59
- };
60
-
61
- export declare type AppListEntry = {
62
- id: string;
63
- name: string;
64
- pages: {
65
- id: string;
66
- name: string;
67
- }[];
68
- };
69
-
70
- declare type Comp = {
71
- id: string;
72
- groupId: string;
73
- name: string;
74
- position: number;
75
- };
76
-
77
- declare type CompGroup = {
78
- id: string;
79
- name: string;
80
- position: number;
81
- };
82
-
83
- declare type CompMeta = {
84
- version: string;
85
- properties?: Field[];
86
- methods?: Method[];
87
- events?: Event_2[];
88
- slots?: Slot[];
89
- states?: Field[];
90
- };
91
-
92
- export declare type Compute = {
93
- spaces: ComputeSpace[];
94
- activeFunc: ActiveFunc;
95
- activeFlow: ActiveFlow;
96
- activeObject: ActiveObjectCompute;
97
- };
98
-
99
- export declare type ComputeSpace = {
100
- id: string;
101
- name: string;
102
- funcGroups: FuncGroup[];
103
- funcs: Func[];
104
- flowGroups: FlowGroup[];
105
- flows: Flow[];
106
- position: number;
107
- };
108
-
109
- export declare type Data = {
110
- spaces: DataSpace[];
111
- };
112
-
113
- export declare type DataSpace = {
114
- id: string;
115
- name: string;
116
- tableGroups: TableGroup[];
117
- tables: Table[];
118
- position: number;
119
- };
120
-
121
- export declare type Depend = {
122
- name: string;
123
- meta: CompMeta;
124
- };
125
-
126
- export declare interface DirEntry {
127
- id: string;
128
- name: string;
129
- children: DirEntry[];
130
- }
131
-
132
- declare type Event_2 = {
133
- id: string;
134
- name: string;
135
- params?: Field[];
136
- };
137
-
138
- declare type Field = {
139
- id: string;
140
- name: string;
141
- type: Type;
142
- };
143
-
144
- declare type Field_2 = {
145
- id: string;
146
- name: string;
147
- type: Type;
148
- };
149
-
150
- export declare type Flow = {
151
- id: string;
152
- spaceId: string;
153
- groupId: string;
154
- name: string;
155
- position: number;
156
- };
157
-
158
- export declare type FlowGroup = {
159
- id: string;
160
- name: string;
161
- position: number;
162
- };
163
-
164
- export declare type Func = {
165
- id: string;
166
- spaceId: string;
167
- groupId: string;
168
- name: string;
169
- inputs: {
170
- id: string;
171
- name: string;
172
- type: Type;
173
- }[];
174
- outputs: {
175
- id: string;
176
- name: string;
177
- type: Type;
178
- }[];
179
- position: number;
180
- };
181
-
182
- export declare type FuncGroup = {
183
- id: string;
184
- name: string;
185
- position: number;
186
- };
187
-
188
- export declare const globalState: State;
189
-
190
- export declare function initApp(): App;
191
-
192
- export declare function initCompute(): Compute;
193
-
194
- export declare function initData(): Data;
195
-
196
- export declare function initResource(): Resource;
197
-
198
- declare type Method = {
199
- id: string;
200
- name: string;
201
- inputs?: Field[];
202
- outputs?: Field[];
203
- };
204
-
205
- declare type PageMeta = {
206
- version: string;
207
- arguments?: Field[];
208
- states?: Field[];
209
- };
210
-
211
- export declare type Resource = {
212
- spaces: ResourceSpace[];
213
- };
214
-
215
- export declare interface ResourceEntry {
216
- id: string;
217
- dirid: string;
218
- name: string;
219
- }
220
-
221
- export declare type ResourceSpace = {
222
- id: string;
223
- name: string;
224
- dirTree: DirEntry;
225
- resources: ResourceEntry[];
226
- position: number;
227
- };
228
-
229
- declare type Slot = {
230
- id: string;
231
- name: string;
232
- properties?: Field[];
233
- methods?: Method[];
234
- events?: Event_2[];
235
- };
236
-
237
- export declare type State = {
238
- app: App;
239
- compute: Compute;
240
- data: Data;
241
- resource: Resource;
242
- };
243
-
244
- export declare type Table = {
245
- id: string;
246
- spaceId: string;
247
- groupId: string;
248
- name: string;
249
- columns: {
250
- id: string;
251
- name: string;
252
- type: string;
253
- extend: string;
254
- }[];
255
- indexes: {
256
- id: string;
257
- columns: string[];
258
- unique: boolean;
259
- }[];
260
- position: number;
261
- };
262
-
263
- export declare type TableGroup = {
264
- id: string;
265
- name: string;
266
- position: number;
267
- };
268
-
269
- export declare function toCompMeta(src: CompMeta): CompMeta;
270
-
271
- export declare function toFields(srcFields?: Field_2[]): Field_2[] | undefined;
272
-
273
- export declare function toPageMeta(src: PageMeta): PageMeta;
274
-
275
- export { }
1
+ import { Type } from "x-essential-lib";
2
+
3
+ //#region src/state/app.d.ts
4
+ type AppListEntry = {
5
+ id: string;
6
+ name: string;
7
+ pages: {
8
+ id: string;
9
+ name: string;
10
+ }[];
11
+ };
12
+ type CompGroup = {
13
+ id: string;
14
+ name: string;
15
+ position: number;
16
+ };
17
+ type Comp = {
18
+ id: string;
19
+ groupId: string;
20
+ name: string;
21
+ position: number;
22
+ };
23
+ type ActiveApp = {
24
+ id: string;
25
+ compGroups: CompGroup[];
26
+ comps: Comp[];
27
+ };
28
+ type Field$1 = {
29
+ id: string;
30
+ name: string;
31
+ type: Type;
32
+ };
33
+ type PageMeta = {
34
+ version: string;
35
+ arguments?: Field$1[];
36
+ states?: Field$1[];
37
+ };
38
+ type ActivePage = {
39
+ id: string;
40
+ meta: PageMeta;
41
+ };
42
+ declare function toPageMeta(src: PageMeta): PageMeta;
43
+ type Method = {
44
+ id: string;
45
+ name: string;
46
+ inputs?: Field$1[];
47
+ outputs?: Field$1[];
48
+ };
49
+ type Event = {
50
+ id: string;
51
+ name: string;
52
+ params?: Field$1[];
53
+ };
54
+ type Slot = {
55
+ id: string;
56
+ name: string;
57
+ properties?: Field$1[];
58
+ methods?: Method[];
59
+ events?: Event[];
60
+ };
61
+ type CompMeta = {
62
+ version: string;
63
+ properties?: Field$1[];
64
+ methods?: Method[];
65
+ events?: Event[];
66
+ slots?: Slot[];
67
+ states?: Field$1[];
68
+ };
69
+ type ActiveComp = {
70
+ id: string;
71
+ meta: CompMeta;
72
+ };
73
+ declare function toCompMeta(src: CompMeta): CompMeta;
74
+ type ActiveObjectApp = {
75
+ type: 'page' | 'comp';
76
+ subtype: string;
77
+ version: string;
78
+ nodes: {
79
+ id: string;
80
+ key: string;
81
+ alias: string;
82
+ slot?: string;
83
+ comp?: string;
84
+ adaptSlot?: string;
85
+ }[];
86
+ };
87
+ type Depend = {
88
+ name: string;
89
+ meta: CompMeta;
90
+ };
91
+ type App = {
92
+ appList: AppListEntry[];
93
+ activeApp: ActiveApp;
94
+ activePage: ActivePage;
95
+ activeComp: ActiveComp;
96
+ activeObject: ActiveObjectApp;
97
+ depends: {
98
+ [key: string]: Depend;
99
+ };
100
+ };
101
+ declare function initApp(): App;
102
+ //#endregion
103
+ //#region src/state/compute.d.ts
104
+ type FuncGroup = {
105
+ id: string;
106
+ name: string;
107
+ position: number;
108
+ };
109
+ type Func = {
110
+ id: string;
111
+ spaceId: string;
112
+ groupId: string;
113
+ name: string;
114
+ inputs: {
115
+ id: string;
116
+ name: string;
117
+ type: Type;
118
+ }[];
119
+ outputs: {
120
+ id: string;
121
+ name: string;
122
+ type: Type;
123
+ }[];
124
+ position: number;
125
+ };
126
+ type FlowGroup = {
127
+ id: string;
128
+ name: string;
129
+ position: number;
130
+ };
131
+ type Flow = {
132
+ id: string;
133
+ spaceId: string;
134
+ groupId: string;
135
+ name: string;
136
+ position: number;
137
+ };
138
+ type ComputeSpace = {
139
+ id: string;
140
+ name: string;
141
+ funcGroups: FuncGroup[];
142
+ funcs: Func[];
143
+ flowGroups: FlowGroup[];
144
+ flows: Flow[];
145
+ position: number;
146
+ };
147
+ type Field = {
148
+ id: string;
149
+ name: string;
150
+ type: Type;
151
+ };
152
+ type ActiveFunc = {
153
+ id: string;
154
+ name: string;
155
+ inputs?: Field[];
156
+ outputs?: Field[];
157
+ };
158
+ declare function toFields(srcFields?: Field[]): Field[] | undefined;
159
+ type ActiveFlow = {
160
+ id: string;
161
+ name: string;
162
+ };
163
+ type ActiveObjectCompute = {
164
+ type: 'func' | 'flow';
165
+ version: string;
166
+ };
167
+ type Compute = {
168
+ spaces: ComputeSpace[];
169
+ activeFunc: ActiveFunc;
170
+ activeFlow: ActiveFlow;
171
+ activeObject: ActiveObjectCompute;
172
+ };
173
+ declare function initCompute(): Compute;
174
+ //#endregion
175
+ //#region src/state/data.d.ts
176
+ type TableGroup = {
177
+ id: string;
178
+ name: string;
179
+ position: number;
180
+ };
181
+ type Table = {
182
+ id: string;
183
+ spaceId: string;
184
+ groupId: string;
185
+ name: string;
186
+ columns: {
187
+ id: string;
188
+ name: string;
189
+ type: string;
190
+ extend: string;
191
+ }[];
192
+ indexes: {
193
+ id: string;
194
+ columns: string[];
195
+ unique: boolean;
196
+ }[];
197
+ position: number;
198
+ };
199
+ type DataSpace = {
200
+ id: string;
201
+ name: string;
202
+ tableGroups: TableGroup[];
203
+ tables: Table[];
204
+ position: number;
205
+ };
206
+ type Data = {
207
+ spaces: DataSpace[];
208
+ };
209
+ declare function initData(): Data;
210
+ //#endregion
211
+ //#region src/state/resource.d.ts
212
+ interface DirEntry {
213
+ id: string;
214
+ name: string;
215
+ children: DirEntry[];
216
+ }
217
+ interface ResourceEntry {
218
+ id: string;
219
+ dirid: string;
220
+ name: string;
221
+ }
222
+ type ResourceSpace = {
223
+ id: string;
224
+ name: string;
225
+ dirTree: DirEntry;
226
+ resources: ResourceEntry[];
227
+ position: number;
228
+ };
229
+ type Resource = {
230
+ spaces: ResourceSpace[];
231
+ };
232
+ declare function initResource(): Resource;
233
+ //#endregion
234
+ //#region src/state/state.d.ts
235
+ type State = {
236
+ app: App;
237
+ compute: Compute;
238
+ data: Data;
239
+ resource: Resource;
240
+ };
241
+ declare const globalState: State;
242
+ //#endregion
243
+ export { ActiveApp, ActiveComp, ActiveFlow, ActiveFunc, ActiveObjectApp, ActiveObjectCompute, ActivePage, App, AppListEntry, Compute, ComputeSpace, Data, DataSpace, Depend, DirEntry, Flow, FlowGroup, Func, FuncGroup, Resource, ResourceEntry, ResourceSpace, State, Table, TableGroup, globalState, initApp, initCompute, initData, initResource, toCompMeta, toFields, toPageMeta };
package/dist/index.js CHANGED
@@ -1,146 +1 @@
1
- import "x-essential-lib";
2
- //#region src/state/app.ts
3
- function e({ id: e, name: t, type: n }) {
4
- return {
5
- id: e,
6
- name: t,
7
- type: n
8
- };
9
- }
10
- function t(t) {
11
- if (!t) return;
12
- let n = [];
13
- for (let r of t) n.push(e(r));
14
- return n;
15
- }
16
- function n(e) {
17
- return {
18
- version: e.version,
19
- arguments: t(e.arguments),
20
- states: t(e.states)
21
- };
22
- }
23
- function r(e) {
24
- if (!e) return;
25
- let n = [];
26
- for (let { id: r, name: i, inputs: a, outputs: o } of e) n.push({
27
- id: r,
28
- name: i,
29
- inputs: t(a),
30
- outputs: t(o)
31
- });
32
- return n;
33
- }
34
- function i(e) {
35
- if (!e) return;
36
- let n = [];
37
- for (let { id: r, name: i, params: a } of e) n.push({
38
- id: r,
39
- name: i,
40
- params: t(a)
41
- });
42
- return n;
43
- }
44
- function a(e) {
45
- if (!e) return;
46
- let n = [];
47
- for (let { id: a, name: o, properties: s, methods: c, events: l } of e) n.push({
48
- id: a,
49
- name: o,
50
- properties: t(s),
51
- methods: r(c),
52
- events: i(l)
53
- });
54
- return n;
55
- }
56
- function o(e) {
57
- return {
58
- version: e.version,
59
- properties: t(e.properties),
60
- methods: r(e.methods),
61
- events: i(e.events),
62
- slots: a(e.slots),
63
- states: t(e.states)
64
- };
65
- }
66
- function s() {
67
- return {
68
- appList: [],
69
- activeApp: {
70
- id: "",
71
- compGroups: [],
72
- comps: []
73
- },
74
- activePage: {
75
- id: "",
76
- meta: { version: "" }
77
- },
78
- activeComp: {
79
- id: "",
80
- meta: { version: "" }
81
- },
82
- activeObject: {
83
- type: "page",
84
- subtype: "",
85
- version: "",
86
- nodes: []
87
- },
88
- depends: {}
89
- };
90
- }
91
- //#endregion
92
- //#region src/state/compute.ts
93
- function c({ id: e, name: t, type: n }) {
94
- return {
95
- id: e,
96
- name: t,
97
- type: n
98
- };
99
- }
100
- function l(e) {
101
- if (!e) return;
102
- let t = [];
103
- for (let n of e) t.push(c(n));
104
- return t;
105
- }
106
- function u() {
107
- return {
108
- spaces: [],
109
- activeFunc: {
110
- id: "",
111
- name: "",
112
- inputs: [],
113
- outputs: []
114
- },
115
- activeFlow: {
116
- id: "",
117
- name: ""
118
- },
119
- activeObject: {
120
- type: "func",
121
- version: ""
122
- }
123
- };
124
- }
125
- //#endregion
126
- //#region src/state/data.ts
127
- function d() {
128
- return { spaces: [] };
129
- }
130
- //#endregion
131
- //#region src/state/resource.ts
132
- function f() {
133
- return { spaces: [] };
134
- }
135
- //#endregion
136
- //#region src/state/state.ts
137
- var p = (function() {
138
- return window.globalState || (window.globalState = {
139
- app: s(),
140
- compute: u(),
141
- data: d(),
142
- resource: f()
143
- }), window.globalState;
144
- })();
145
- //#endregion
146
- export { p as globalState, s as initApp, u as initCompute, d as initData, f as initResource, o as toCompMeta, l as toFields, n as toPageMeta };
1
+ import"x-essential-lib";function e({id:e,name:t,type:n}){return{id:e,name:t,type:n}}function t(t){if(!t)return;let n=[];for(let r of t)n.push(e(r));return n}function n(e){return{version:e.version,arguments:t(e.arguments),states:t(e.states)}}function r(e){if(!e)return;let n=[];for(let{id:r,name:i,inputs:a,outputs:o}of e)n.push({id:r,name:i,inputs:t(a),outputs:t(o)});return n}function i(e){if(!e)return;let n=[];for(let{id:r,name:i,params:a}of e)n.push({id:r,name:i,params:t(a)});return n}function a(e){if(!e)return;let n=[];for(let{id:a,name:o,properties:s,methods:c,events:l}of e)n.push({id:a,name:o,properties:t(s),methods:r(c),events:i(l)});return n}function o(e){return{version:e.version,properties:t(e.properties),methods:r(e.methods),events:i(e.events),slots:a(e.slots),states:t(e.states)}}function s(){return{appList:[],activeApp:{id:``,compGroups:[],comps:[]},activePage:{id:``,meta:{version:``}},activeComp:{id:``,meta:{version:``}},activeObject:{type:`page`,subtype:``,version:``,nodes:[]},depends:{}}}function c({id:e,name:t,type:n}){return{id:e,name:t,type:n}}function l(e){if(!e)return;let t=[];for(let n of e)t.push(c(n));return t}function u(){return{spaces:[],activeFunc:{id:``,name:``,inputs:[],outputs:[]},activeFlow:{id:``,name:``},activeObject:{type:`func`,version:``}}}function d(){return{spaces:[]}}function f(){return{spaces:[]}}const p=(function(){return window.globalState||(window.globalState={app:s(),compute:u(),data:d(),resource:f()}),window.globalState})();export{p as globalState,s as initApp,u as initCompute,d as initData,f as initResource,o as toCompMeta,l as toFields,n as toPageMeta};
package/package.json CHANGED
@@ -1,60 +1,53 @@
1
1
  {
2
2
  "name": "x-state-lib",
3
- "private": false,
4
- "version": "0.3.43",
5
- "type": "module",
6
- "module": "dist/index.js",
7
- "types": "dist/index.d.ts",
3
+ "version": "0.3.45",
8
4
  "files": [
9
5
  "dist"
10
6
  ],
7
+ "type": "module",
8
+ "main": "./dist/index.js",
9
+ "module": "./dist/index.js",
10
+ "types": "./dist/index.d.ts",
11
+ "exports": {
12
+ ".": "./dist/index.js",
13
+ "./package.json": "./package.json"
14
+ },
15
+ "publishConfig": {
16
+ "registry": "https://registry.npmjs.org"
17
+ },
11
18
  "scripts": {
12
- "dev": "vite",
13
- "build": "vue-tsc && vite build",
14
- "preview": "vite preview",
15
- "lint": "eslint --fix --ignore-pattern dist/ --ignore-pattern public/ .",
16
- "format": "prettier --write .",
19
+ "play": "vite",
20
+ "test": "vitest",
21
+ "lint": "oxlint",
22
+ "fmt": "oxfmt",
23
+ "build": "tsdown",
17
24
  "lint-staged": "lint-staged",
18
25
  "prepare": "husky"
19
26
  },
20
- "lint-staged": {
21
- "*.{vue,js,jsx,cjs,mjs,ts,tsx,cts,mts}": "eslint --fix --ignore-pattern dist/ --ignore-pattern public/ .",
22
- "*": "prettier --write ."
23
- },
24
27
  "dependencies": {
25
- "lodash-es": "^4.17.23",
26
- "vue": "^3.5.30",
27
- "vuetify": "^4.0.2"
28
- },
29
- "peerDependencies": {
30
- "x-error-lib": "^0.5.17",
31
- "x-essential-lib": "^0.9.30",
32
- "x-runtime-lib": "^0.9.31"
28
+ "vue": "^3.5.38",
29
+ "vuetify": "^4.1.2"
33
30
  },
34
31
  "devDependencies": {
35
- "@eslint/js": "^10.0.1",
36
- "@tsconfig/node24": "^24.0.4",
37
- "@types/lodash-es": "^4.17.12",
38
- "@types/node": "^25.4.0",
39
- "@vitejs/plugin-vue": "^6.0.4",
40
- "@vue/tsconfig": "^0.9.1",
41
- "eslint": "^10.0.3",
42
- "eslint-config-prettier": "^10.1.8",
43
- "eslint-plugin-prettier": "^5.5.5",
44
- "eslint-plugin-simple-import-sort": "^12.1.1",
45
- "eslint-plugin-vue": "^10.8.0",
46
- "globals": "^17.4.0",
32
+ "@types/node": "^26.0.0",
47
33
  "husky": "^9.1.7",
48
- "lint-staged": "^16.3.3",
49
- "prettier": "3.8.1",
50
- "sass": "^1.98.0",
51
- "typescript": "^5.9.3",
52
- "typescript-eslint": "^8.57.0",
53
- "vite": "^8.0.0",
54
- "vite-plugin-css-injected-by-js": "^4.0.1",
55
- "vite-plugin-dts": "^4.5.4",
56
- "vite-plugin-vuetify": "^2.1.3",
57
- "vue-eslint-parser": "^10.4.0",
58
- "vue-tsc": "^3.2.5"
34
+ "lint-staged": "^17.0.7",
35
+ "oxfmt": "^0.55.0",
36
+ "oxlint": "^1.70.0",
37
+ "sass": "^1.101.0",
38
+ "tsdown": "^0.22.3",
39
+ "typescript": "^6.0.3",
40
+ "vite": "^8.0.16",
41
+ "x-config-oxfmt": "^0.1.3",
42
+ "x-config-oxlint": "^0.1.2",
43
+ "x-config-vite-lib": "^0.1.10"
44
+ },
45
+ "peerDependencies": {
46
+ "x-error-lib": "^0.5.21",
47
+ "x-essential-lib": "^0.9.37",
48
+ "x-runtime-lib": "^0.9.60"
49
+ },
50
+ "lint-staged": {
51
+ "*": "oxfmt --no-error-on-unmatched-pattern"
59
52
  }
60
53
  }