x-state-lib 0.3.42 → 0.3.44

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.d.ts CHANGED
@@ -1 +1,243 @@
1
- export * from './state';
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,145 +1 @@
1
- //#region src/state/app.ts
2
- function e({ id: e, name: t, type: n }) {
3
- return {
4
- id: e,
5
- name: t,
6
- type: n
7
- };
8
- }
9
- function t(t) {
10
- if (!t) return;
11
- let n = [];
12
- for (let r of t) n.push(e(r));
13
- return n;
14
- }
15
- function n(e) {
16
- return {
17
- version: e.version,
18
- arguments: t(e.arguments),
19
- states: t(e.states)
20
- };
21
- }
22
- function r(e) {
23
- if (!e) return;
24
- let n = [];
25
- for (let { id: r, name: i, inputs: a, outputs: o } of e) n.push({
26
- id: r,
27
- name: i,
28
- inputs: t(a),
29
- outputs: t(o)
30
- });
31
- return n;
32
- }
33
- function i(e) {
34
- if (!e) return;
35
- let n = [];
36
- for (let { id: r, name: i, params: a } of e) n.push({
37
- id: r,
38
- name: i,
39
- params: t(a)
40
- });
41
- return n;
42
- }
43
- function a(e) {
44
- if (!e) return;
45
- let n = [];
46
- for (let { id: a, name: o, properties: s, methods: c, events: l } of e) n.push({
47
- id: a,
48
- name: o,
49
- properties: t(s),
50
- methods: r(c),
51
- events: i(l)
52
- });
53
- return n;
54
- }
55
- function o(e) {
56
- return {
57
- version: e.version,
58
- properties: t(e.properties),
59
- methods: r(e.methods),
60
- events: i(e.events),
61
- slots: a(e.slots),
62
- states: t(e.states)
63
- };
64
- }
65
- function s() {
66
- return {
67
- appList: [],
68
- activeApp: {
69
- id: "",
70
- compGroups: [],
71
- comps: []
72
- },
73
- activePage: {
74
- id: "",
75
- meta: { version: "" }
76
- },
77
- activeComp: {
78
- id: "",
79
- meta: { version: "" }
80
- },
81
- activeObject: {
82
- type: "page",
83
- subtype: "",
84
- version: "",
85
- nodes: []
86
- },
87
- depends: {}
88
- };
89
- }
90
- //#endregion
91
- //#region src/state/compute.ts
92
- function c({ id: e, name: t, type: n }) {
93
- return {
94
- id: e,
95
- name: t,
96
- type: n
97
- };
98
- }
99
- function l(e) {
100
- if (!e) return;
101
- let t = [];
102
- for (let n of e) t.push(c(n));
103
- return t;
104
- }
105
- function u() {
106
- return {
107
- spaces: [],
108
- activeFunc: {
109
- id: "",
110
- name: "",
111
- inputs: [],
112
- outputs: []
113
- },
114
- activeFlow: {
115
- id: "",
116
- name: ""
117
- },
118
- activeObject: {
119
- type: "func",
120
- version: ""
121
- }
122
- };
123
- }
124
- //#endregion
125
- //#region src/state/data.ts
126
- function d() {
127
- return { spaces: [] };
128
- }
129
- //#endregion
130
- //#region src/state/resource.ts
131
- function f() {
132
- return { spaces: [] };
133
- }
134
- //#endregion
135
- //#region src/state/state.ts
136
- var p = (function() {
137
- return window.globalState || (window.globalState = {
138
- app: s(),
139
- compute: u(),
140
- data: d(),
141
- resource: f()
142
- }), window.globalState;
143
- })();
144
- //#endregion
145
- 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,56 +1,53 @@
1
1
  {
2
2
  "name": "x-state-lib",
3
- "private": false,
4
- "version": "0.3.42",
5
- "type": "module",
6
- "module": "dist/index.js",
7
- "types": "dist/index.d.ts",
3
+ "version": "0.3.44",
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.16",
31
- "x-essential-lib": "^0.9.29",
32
- "x-runtime-lib": "^0.8.223"
28
+ "vue": "^3.5.38",
29
+ "vuetify": "^4.1.2"
33
30
  },
34
31
  "devDependencies": {
35
- "@eslint/js": "^10.0.1",
36
- "@types/lodash-es": "^4.17.12",
37
- "@types/node": "^25.4.0",
38
- "@vitejs/plugin-vue": "^6.0.4",
39
- "eslint": "^10.0.3",
40
- "eslint-config-prettier": "^10.1.8",
41
- "eslint-plugin-prettier": "^5.5.5",
42
- "eslint-plugin-vue": "^10.8.0",
43
- "globals": "^17.4.0",
32
+ "@types/node": "^25.9.3",
44
33
  "husky": "^9.1.7",
45
- "lint-staged": "^16.3.3",
46
- "prettier": "3.8.1",
47
- "sass": "^1.98.0",
48
- "typescript": "^5.9.3",
49
- "typescript-eslint": "^8.57.0",
50
- "vite": "^8.0.0",
51
- "vite-plugin-css-injected-by-js": "^4.0.1",
52
- "vite-plugin-vuetify": "^2.1.3",
53
- "vue-eslint-parser": "^10.4.0",
54
- "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.8"
44
+ },
45
+ "peerDependencies": {
46
+ "x-error-lib": "^0.5.19",
47
+ "x-essential-lib": "^0.9.36",
48
+ "x-runtime-lib": "^0.9.59"
49
+ },
50
+ "lint-staged": {
51
+ "*": "oxfmt --no-error-on-unmatched-pattern"
55
52
  }
56
53
  }
@@ -1,100 +0,0 @@
1
- import { Type } from 'x-essential-lib';
2
- export type AppListEntry = {
3
- id: string;
4
- name: string;
5
- pages: {
6
- id: string;
7
- name: string;
8
- }[];
9
- };
10
- type CompGroup = {
11
- id: string;
12
- name: string;
13
- position: number;
14
- };
15
- type Comp = {
16
- id: string;
17
- groupId: string;
18
- name: string;
19
- position: number;
20
- };
21
- export type ActiveApp = {
22
- id: string;
23
- compGroups: CompGroup[];
24
- comps: Comp[];
25
- };
26
- type Field = {
27
- id: string;
28
- name: string;
29
- type: Type;
30
- };
31
- type PageMeta = {
32
- version: string;
33
- arguments?: Field[];
34
- states?: Field[];
35
- };
36
- export type ActivePage = {
37
- id: string;
38
- meta: PageMeta;
39
- };
40
- export declare function toPageMeta(src: PageMeta): PageMeta;
41
- type Method = {
42
- id: string;
43
- name: string;
44
- inputs?: Field[];
45
- outputs?: Field[];
46
- };
47
- type Event = {
48
- id: string;
49
- name: string;
50
- params?: Field[];
51
- };
52
- type Slot = {
53
- id: string;
54
- name: string;
55
- properties?: Field[];
56
- methods?: Method[];
57
- events?: Event[];
58
- };
59
- type CompMeta = {
60
- version: string;
61
- properties?: Field[];
62
- methods?: Method[];
63
- events?: Event[];
64
- slots?: Slot[];
65
- states?: Field[];
66
- };
67
- export type ActiveComp = {
68
- id: string;
69
- meta: CompMeta;
70
- };
71
- export declare function toCompMeta(src: CompMeta): CompMeta;
72
- export type ActiveObjectApp = {
73
- type: 'page' | 'comp';
74
- subtype: string;
75
- version: string;
76
- nodes: {
77
- id: string;
78
- key: string;
79
- alias: string;
80
- slot?: string;
81
- comp?: string;
82
- adaptSlot?: string;
83
- }[];
84
- };
85
- export type Depend = {
86
- name: string;
87
- meta: CompMeta;
88
- };
89
- export type App = {
90
- appList: AppListEntry[];
91
- activeApp: ActiveApp;
92
- activePage: ActivePage;
93
- activeComp: ActiveComp;
94
- activeObject: ActiveObjectApp;
95
- depends: {
96
- [key: string]: Depend;
97
- };
98
- };
99
- export declare function initApp(): App;
100
- export {};
@@ -1,72 +0,0 @@
1
- import { Type } from 'x-essential-lib';
2
- export type FuncGroup = {
3
- id: string;
4
- name: string;
5
- position: number;
6
- };
7
- export type Func = {
8
- id: string;
9
- spaceId: string;
10
- groupId: string;
11
- name: string;
12
- inputs: {
13
- id: string;
14
- name: string;
15
- type: Type;
16
- }[];
17
- outputs: {
18
- id: string;
19
- name: string;
20
- type: Type;
21
- }[];
22
- position: number;
23
- };
24
- export type FlowGroup = {
25
- id: string;
26
- name: string;
27
- position: number;
28
- };
29
- export type Flow = {
30
- id: string;
31
- spaceId: string;
32
- groupId: string;
33
- name: string;
34
- position: number;
35
- };
36
- export type ComputeSpace = {
37
- id: string;
38
- name: string;
39
- funcGroups: FuncGroup[];
40
- funcs: Func[];
41
- flowGroups: FlowGroup[];
42
- flows: Flow[];
43
- position: number;
44
- };
45
- type Field = {
46
- id: string;
47
- name: string;
48
- type: Type;
49
- };
50
- export type ActiveFunc = {
51
- id: string;
52
- name: string;
53
- inputs?: Field[];
54
- outputs?: Field[];
55
- };
56
- export declare function toFields(srcFields?: Field[]): Field[] | undefined;
57
- export type ActiveFlow = {
58
- id: string;
59
- name: string;
60
- };
61
- export type ActiveObjectCompute = {
62
- type: 'func' | 'flow';
63
- version: string;
64
- };
65
- export type Compute = {
66
- spaces: ComputeSpace[];
67
- activeFunc: ActiveFunc;
68
- activeFlow: ActiveFlow;
69
- activeObject: ActiveObjectCompute;
70
- };
71
- export declare function initCompute(): Compute;
72
- export {};
@@ -1,34 +0,0 @@
1
- export type TableGroup = {
2
- id: string;
3
- name: string;
4
- position: number;
5
- };
6
- export type Table = {
7
- id: string;
8
- spaceId: string;
9
- groupId: string;
10
- name: string;
11
- columns: {
12
- id: string;
13
- name: string;
14
- type: string;
15
- extend: string;
16
- }[];
17
- indexes: {
18
- id: string;
19
- columns: string[];
20
- unique: boolean;
21
- }[];
22
- position: number;
23
- };
24
- export type DataSpace = {
25
- id: string;
26
- name: string;
27
- tableGroups: TableGroup[];
28
- tables: Table[];
29
- position: number;
30
- };
31
- export type Data = {
32
- spaces: DataSpace[];
33
- };
34
- export declare function initData(): Data;
@@ -1,5 +0,0 @@
1
- export * from './app';
2
- export * from './compute';
3
- export * from './data';
4
- export * from './resource';
5
- export * from './state';
@@ -1,21 +0,0 @@
1
- export interface DirEntry {
2
- id: string;
3
- name: string;
4
- children: DirEntry[];
5
- }
6
- export interface ResourceEntry {
7
- id: string;
8
- dirid: string;
9
- name: string;
10
- }
11
- export type ResourceSpace = {
12
- id: string;
13
- name: string;
14
- dirTree: DirEntry;
15
- resources: ResourceEntry[];
16
- position: number;
17
- };
18
- export type Resource = {
19
- spaces: ResourceSpace[];
20
- };
21
- export declare function initResource(): Resource;
@@ -1,16 +0,0 @@
1
- import { ZProperty } from 'x-runtime-lib';
2
- type Property = {
3
- keys: string;
4
- names: string[];
5
- raw: ZProperty;
6
- };
7
- type Properties = {
8
- [key: string]: {
9
- [tag: string]: Property[];
10
- };
11
- };
12
- export type Runtime = {
13
- properties: Properties;
14
- };
15
- export declare function initRuntime(): Runtime;
16
- export {};
@@ -1,11 +0,0 @@
1
- import { App } from './app';
2
- import { Compute } from './compute';
3
- import { Data } from './data';
4
- import { Resource } from './resource';
5
- export type State = {
6
- app: App;
7
- compute: Compute;
8
- data: Data;
9
- resource: Resource;
10
- };
11
- export declare const globalState: State;