@apia/speed-ui 5.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/dist/index.d.ts +174 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +352 -0
- package/dist/index.js.map +1 -0
- package/package.json +40 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { Collector } from '@apia/validations';
|
|
2
|
+
import * as _apia_util from '@apia/util';
|
|
3
|
+
import { EventEmitter } from '@apia/util';
|
|
4
|
+
|
|
5
|
+
type SpeedUIEvent<Type extends string, T extends Record<string, unknown>> = T & {
|
|
6
|
+
type: Type;
|
|
7
|
+
};
|
|
8
|
+
declare abstract class SpeedUIRunable {
|
|
9
|
+
protected label: string;
|
|
10
|
+
readonly parent?: SpeedUIRunable | undefined;
|
|
11
|
+
protected emitter: EventEmitter<{
|
|
12
|
+
cancel: SpeedUIEvent<"cancel", {
|
|
13
|
+
target: SpeedUIRunable;
|
|
14
|
+
}>;
|
|
15
|
+
finish: SpeedUIEvent<"finish", {
|
|
16
|
+
target: SpeedUIRunable;
|
|
17
|
+
}>;
|
|
18
|
+
start: SpeedUIEvent<"start", {
|
|
19
|
+
target: SpeedUIRunable;
|
|
20
|
+
}>;
|
|
21
|
+
}>;
|
|
22
|
+
constructor(label: string, parent?: SpeedUIRunable | undefined);
|
|
23
|
+
getLabel(): string;
|
|
24
|
+
cancel(): void;
|
|
25
|
+
finish(): void;
|
|
26
|
+
protected emit: (typeof this.emitter)['emit'];
|
|
27
|
+
on: <K extends "cancel" | "finish" | "start">(event: K, cb: _apia_util.Callback<{
|
|
28
|
+
cancel: SpeedUIEvent<"cancel", {
|
|
29
|
+
target: SpeedUIRunable;
|
|
30
|
+
}>;
|
|
31
|
+
finish: SpeedUIEvent<"finish", {
|
|
32
|
+
target: SpeedUIRunable;
|
|
33
|
+
}>;
|
|
34
|
+
start: SpeedUIEvent<"start", {
|
|
35
|
+
target: SpeedUIRunable;
|
|
36
|
+
}>;
|
|
37
|
+
}, K>) => _apia_util.UnSubscriber;
|
|
38
|
+
run(): void;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
declare class SpeedUIScreen extends SpeedUIRunable {
|
|
42
|
+
getChildren: () => SpeedUIRunable[];
|
|
43
|
+
readonly parent?: SpeedUIRunable | undefined;
|
|
44
|
+
constructor(label: string, getChildren: () => SpeedUIRunable[], parent?: SpeedUIRunable | undefined);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
declare class SpeedUIExecution extends SpeedUIRunable {
|
|
48
|
+
label: string;
|
|
49
|
+
cb: () => unknown;
|
|
50
|
+
readonly parent?: SpeedUIRunable | undefined;
|
|
51
|
+
constructor(label: string, cb: () => unknown, parent?: SpeedUIRunable | undefined);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
declare class SpeedUIForm extends SpeedUIRunable {
|
|
55
|
+
protected label: string;
|
|
56
|
+
makeFields: (collector: Collector) => void;
|
|
57
|
+
onConfirm: (fields: any) => unknown;
|
|
58
|
+
readonly parent?: SpeedUIRunable | undefined;
|
|
59
|
+
constructor(label: string, makeFields: (collector: Collector) => void, onConfirm: (fields: any) => unknown, parent?: SpeedUIRunable | undefined);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
type SpeedAction = {
|
|
63
|
+
label: string;
|
|
64
|
+
action: () => unknown;
|
|
65
|
+
};
|
|
66
|
+
type SpeedForm = {
|
|
67
|
+
label: string;
|
|
68
|
+
getItems(collector: Collector): void;
|
|
69
|
+
action: (res: any) => unknown;
|
|
70
|
+
};
|
|
71
|
+
type SpeedScreen = {
|
|
72
|
+
children: (() => SpeedItem[]) | SpeedItem[];
|
|
73
|
+
label: string;
|
|
74
|
+
};
|
|
75
|
+
type SpeedItem = SpeedScreen | SpeedAction | SpeedForm;
|
|
76
|
+
declare function isSpeedAction(item: SpeedItem): item is SpeedAction;
|
|
77
|
+
declare function isSpeedForm(item: SpeedItem): item is SpeedForm;
|
|
78
|
+
declare function isSpeedScreen(item: SpeedItem): item is SpeedScreen;
|
|
79
|
+
/**
|
|
80
|
+
* Esta función permite cargar un árbol de SpeedUI desde un objeto sencillo.
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
*
|
|
84
|
+
* export const BPASpeedGraph: SpeedScreen = {
|
|
85
|
+
label: 'BPA',
|
|
86
|
+
children: [
|
|
87
|
+
{
|
|
88
|
+
label: 'Using',
|
|
89
|
+
children: [
|
|
90
|
+
{
|
|
91
|
+
label: 'Process',
|
|
92
|
+
children: () => {
|
|
93
|
+
return window.analysisTree.collections.processes
|
|
94
|
+
.getAll()
|
|
95
|
+
.map((c) => {
|
|
96
|
+
return {
|
|
97
|
+
label: c.serialize().title,
|
|
98
|
+
children: [],
|
|
99
|
+
};
|
|
100
|
+
});
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
],
|
|
104
|
+
},
|
|
105
|
+
],
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
const speedScreen = loadGraph(BPASpeedGraph);
|
|
109
|
+
*/
|
|
110
|
+
declare function loadGraph(level: SpeedScreen, parent?: SpeedUIRunable): SpeedUIScreen;
|
|
111
|
+
declare function loadRunableItem(c: SpeedItem): SpeedUIScreen | SpeedUIExecution | SpeedUIForm;
|
|
112
|
+
|
|
113
|
+
declare class SpeedUIReactVisitResult {
|
|
114
|
+
/**
|
|
115
|
+
* Esta clase representa el resutlado de una ejecución de SpeedUIReactVisitor.
|
|
116
|
+
*
|
|
117
|
+
* Los valores posibles para result son:
|
|
118
|
+
*
|
|
119
|
+
* - **null**: No hacer nada.
|
|
120
|
+
* - **SpeedUIRunable**: Ejecutar este SpeedUIRunable a continuación.
|
|
121
|
+
* - **'finish'**: Terminar la ejecución del SpeedUIRunable actual.
|
|
122
|
+
* - **'exit'**: Termina la ejecución del SpeedUI
|
|
123
|
+
*/
|
|
124
|
+
readonly result: null | SpeedUIRunable | 'exit' | 'finish';
|
|
125
|
+
constructor(
|
|
126
|
+
/**
|
|
127
|
+
* Esta clase representa el resutlado de una ejecución de SpeedUIReactVisitor.
|
|
128
|
+
*
|
|
129
|
+
* Los valores posibles para result son:
|
|
130
|
+
*
|
|
131
|
+
* - **null**: No hacer nada.
|
|
132
|
+
* - **SpeedUIRunable**: Ejecutar este SpeedUIRunable a continuación.
|
|
133
|
+
* - **'finish'**: Terminar la ejecución del SpeedUIRunable actual.
|
|
134
|
+
* - **'exit'**: Termina la ejecución del SpeedUI
|
|
135
|
+
*/
|
|
136
|
+
result: null | SpeedUIRunable | 'exit' | 'finish');
|
|
137
|
+
}
|
|
138
|
+
interface SpeedUIReactVisitor {
|
|
139
|
+
/**
|
|
140
|
+
* @see SpeedUIReactVisitResult.result
|
|
141
|
+
*/
|
|
142
|
+
visit(host: SpeedUIRunable): Promise<SpeedUIReactVisitResult>;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
declare class SpeedUIFormReact implements SpeedUIReactVisitor {
|
|
146
|
+
visit(host: SpeedUIRunable): Promise<SpeedUIReactVisitResult>;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
declare class SpeedUIScreenReact implements SpeedUIReactVisitor {
|
|
150
|
+
private RenderUI;
|
|
151
|
+
private modal;
|
|
152
|
+
visit(host: SpeedUIRunable): Promise<SpeedUIReactVisitResult>;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
declare class SpeedUIReactBusyError extends Error {
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Esta clase será la encargada de implementar el rol de Visitor en la estructura,
|
|
159
|
+
* decidiendo qué se debe hacer con cada elemento.
|
|
160
|
+
*
|
|
161
|
+
* Además, la clase SpeedUIReact también implementará el patrón Chain of Responsibility,
|
|
162
|
+
* delegando la actuación en cada visita a clases que implementen SpeedUIReactVisitor
|
|
163
|
+
*/
|
|
164
|
+
declare class SpeedUIReact {
|
|
165
|
+
protected visitors: SpeedUIReactVisitor[];
|
|
166
|
+
protected runStack: SpeedUIRunable[];
|
|
167
|
+
constructor();
|
|
168
|
+
findVisitor(fn: (current: SpeedUIReactVisitor) => boolean): void;
|
|
169
|
+
registerVisitor(visitor: SpeedUIReactVisitor): void;
|
|
170
|
+
run(ui: SpeedUIRunable): Promise<void>;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
export { type SpeedAction, type SpeedForm, type SpeedItem, type SpeedScreen, SpeedUIExecution, SpeedUIForm, SpeedUIFormReact, SpeedUIReact, SpeedUIReactBusyError, SpeedUIReactVisitResult, type SpeedUIReactVisitor, SpeedUIRunable, SpeedUIScreen, SpeedUIScreenReact, isSpeedAction, isSpeedForm, isSpeedScreen, loadGraph, loadRunableItem };
|
|
174
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
import { EventEmitter, addBoundary } from '@apia/util';
|
|
2
|
+
import { Collector } from '@apia/validations';
|
|
3
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
|
+
import { ApiaUtil } from '@apia/components';
|
|
5
|
+
import { Box } from '@apia/theme';
|
|
6
|
+
import { useState, useRef, useEffect } from 'react';
|
|
7
|
+
|
|
8
|
+
var __defProp$2 = Object.defineProperty;
|
|
9
|
+
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
|
+
var __publicField$2 = (obj, key, value) => {
|
|
11
|
+
__defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
12
|
+
return value;
|
|
13
|
+
};
|
|
14
|
+
class SpeedUIRunable {
|
|
15
|
+
constructor(label, parent) {
|
|
16
|
+
this.label = label;
|
|
17
|
+
this.parent = parent;
|
|
18
|
+
__publicField$2(this, "emitter", new EventEmitter());
|
|
19
|
+
__publicField$2(this, "emit", (evName, ev) => {
|
|
20
|
+
this.emitter.emit(evName, ev);
|
|
21
|
+
this.parent?.emit(evName, ev);
|
|
22
|
+
});
|
|
23
|
+
__publicField$2(this, "on", this.emitter.on.bind(this.emitter));
|
|
24
|
+
}
|
|
25
|
+
getLabel() {
|
|
26
|
+
return this.label;
|
|
27
|
+
}
|
|
28
|
+
cancel() {
|
|
29
|
+
this.emit("cancel", { target: this, type: "cancel" });
|
|
30
|
+
}
|
|
31
|
+
finish() {
|
|
32
|
+
this.emit("finish", { target: this, type: "finish" });
|
|
33
|
+
}
|
|
34
|
+
run() {
|
|
35
|
+
this.emit("start", { target: this, type: "start" });
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
class SpeedUIScreen extends SpeedUIRunable {
|
|
40
|
+
constructor(label, getChildren, parent) {
|
|
41
|
+
super(label, parent);
|
|
42
|
+
this.getChildren = getChildren;
|
|
43
|
+
this.parent = parent;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
class SpeedUIExecution extends SpeedUIRunable {
|
|
48
|
+
constructor(label, cb, parent) {
|
|
49
|
+
super(label, parent);
|
|
50
|
+
this.label = label;
|
|
51
|
+
this.cb = cb;
|
|
52
|
+
this.parent = parent;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
class SpeedUIForm extends SpeedUIRunable {
|
|
57
|
+
constructor(label, makeFields, onConfirm, parent) {
|
|
58
|
+
super(label, parent);
|
|
59
|
+
this.label = label;
|
|
60
|
+
this.makeFields = makeFields;
|
|
61
|
+
this.onConfirm = onConfirm;
|
|
62
|
+
this.parent = parent;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function isSpeedAction(item) {
|
|
67
|
+
const spi = item;
|
|
68
|
+
return !!spi.label && !!spi.action && Object.keys(spi).length === 2;
|
|
69
|
+
}
|
|
70
|
+
function isSpeedForm(item) {
|
|
71
|
+
const spf = item;
|
|
72
|
+
return !!spf.label && !!spf.action && !!spf.getItems && Object.keys(spf).length === 3;
|
|
73
|
+
}
|
|
74
|
+
function isSpeedScreen(item) {
|
|
75
|
+
const sps = item;
|
|
76
|
+
return !!sps.children && !!sps.label && Object.keys(sps).length === 2 || !!sps.children && !!sps.label && Object.keys(sps).length === 3;
|
|
77
|
+
}
|
|
78
|
+
function loadGraph(level, parent) {
|
|
79
|
+
const screen = new SpeedUIScreen(
|
|
80
|
+
level.label,
|
|
81
|
+
() => {
|
|
82
|
+
const children = Array.isArray(level.children) ? level.children : level.children();
|
|
83
|
+
const newChildren = children.map((c) => {
|
|
84
|
+
if (isSpeedAction(c)) {
|
|
85
|
+
return new SpeedUIExecution(c.label, c.action, screen);
|
|
86
|
+
} else if (isSpeedForm(c)) {
|
|
87
|
+
return new SpeedUIForm(c.label, c.getItems, c.action, screen);
|
|
88
|
+
} else if (isSpeedScreen(c)) {
|
|
89
|
+
return loadGraph(c, screen);
|
|
90
|
+
} else {
|
|
91
|
+
throw new Error("Cannot parse item", c);
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
return newChildren;
|
|
95
|
+
},
|
|
96
|
+
parent
|
|
97
|
+
);
|
|
98
|
+
return screen;
|
|
99
|
+
}
|
|
100
|
+
function loadRunableItem(c) {
|
|
101
|
+
if (isSpeedAction(c)) {
|
|
102
|
+
return new SpeedUIExecution(c.label, c.action);
|
|
103
|
+
} else if (isSpeedForm(c)) {
|
|
104
|
+
return new SpeedUIForm(c.label, c.getItems, c.action);
|
|
105
|
+
} else if (isSpeedScreen(c)) {
|
|
106
|
+
return loadGraph(c);
|
|
107
|
+
} else {
|
|
108
|
+
throw new Error("Cannot parse item", c);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
class SpeedUIReactVisitResult {
|
|
113
|
+
constructor(result) {
|
|
114
|
+
this.result = result;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
class SpeedUIFormReact {
|
|
119
|
+
async visit(host) {
|
|
120
|
+
if (host instanceof SpeedUIForm) {
|
|
121
|
+
return new Promise((resolve) => {
|
|
122
|
+
const collector = new Collector();
|
|
123
|
+
host.run();
|
|
124
|
+
host.makeFields(collector);
|
|
125
|
+
collector.show({
|
|
126
|
+
title: host.getLabel()
|
|
127
|
+
}).then((res) => {
|
|
128
|
+
if (res) {
|
|
129
|
+
host.finish();
|
|
130
|
+
host.onConfirm(res);
|
|
131
|
+
} else {
|
|
132
|
+
host.cancel();
|
|
133
|
+
}
|
|
134
|
+
resolve(new SpeedUIReactVisitResult("exit"));
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
return new SpeedUIReactVisitResult(null);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function matches(str, search) {
|
|
143
|
+
if (str.match(new RegExp(search, "i"))) {
|
|
144
|
+
return true;
|
|
145
|
+
}
|
|
146
|
+
const separatedSearch = search.replaceAll(" ", ".*");
|
|
147
|
+
if (str.match(new RegExp(separatedSearch, "i"))) {
|
|
148
|
+
return true;
|
|
149
|
+
}
|
|
150
|
+
const extremeSearch = search.replaceAll(" ", "").split("").join(".*");
|
|
151
|
+
return !!str.match(new RegExp(extremeSearch, "i"));
|
|
152
|
+
}
|
|
153
|
+
const Selector = ({
|
|
154
|
+
label,
|
|
155
|
+
options
|
|
156
|
+
}) => {
|
|
157
|
+
const [filtered, setFiltered] = useState(options);
|
|
158
|
+
const [index, setIndex] = useState(0);
|
|
159
|
+
const willSelect = useRef(false);
|
|
160
|
+
useEffect(() => {
|
|
161
|
+
document.querySelector(
|
|
162
|
+
".speedui__selector .speedui__option.selected"
|
|
163
|
+
)?.scrollIntoView({
|
|
164
|
+
behavior: "auto",
|
|
165
|
+
block: "nearest",
|
|
166
|
+
inline: "nearest"
|
|
167
|
+
});
|
|
168
|
+
}, [index]);
|
|
169
|
+
return /* @__PURE__ */ jsxs(
|
|
170
|
+
Box,
|
|
171
|
+
{
|
|
172
|
+
className: "speedui__selector",
|
|
173
|
+
onKeyDown: (ev) => {
|
|
174
|
+
switch (ev.code) {
|
|
175
|
+
case "ArrowUp":
|
|
176
|
+
setIndex((c) => addBoundary(c - 1, 0, filtered.length - 1, true));
|
|
177
|
+
break;
|
|
178
|
+
case "ArrowDown":
|
|
179
|
+
setIndex((c) => addBoundary(c + 1, 0, filtered.length - 1, true));
|
|
180
|
+
break;
|
|
181
|
+
case "Enter":
|
|
182
|
+
filtered[index].action();
|
|
183
|
+
break;
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
children: [
|
|
187
|
+
/* @__PURE__ */ jsx(
|
|
188
|
+
"input",
|
|
189
|
+
{
|
|
190
|
+
className: "speedui__autocomplete",
|
|
191
|
+
placeholder: label,
|
|
192
|
+
onChange: (ev) => {
|
|
193
|
+
if (ev.target.value.toLowerCase() === filtered[0]?.label.toLowerCase() && filtered.length === 1 || willSelect.current && filtered.length === 1) {
|
|
194
|
+
filtered[0].action();
|
|
195
|
+
} else {
|
|
196
|
+
willSelect.current = filtered.length === 1;
|
|
197
|
+
setFiltered(
|
|
198
|
+
options.filter((c) => matches(c.label, ev.target.value))
|
|
199
|
+
);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
),
|
|
204
|
+
/* @__PURE__ */ jsx(Box, { children: filtered.map((c, i) => /* @__PURE__ */ jsx(
|
|
205
|
+
Box,
|
|
206
|
+
{
|
|
207
|
+
className: `speedui__option ${index === i ? "selected" : ""}`,
|
|
208
|
+
onClick: () => {
|
|
209
|
+
c.action();
|
|
210
|
+
},
|
|
211
|
+
children: c.label
|
|
212
|
+
},
|
|
213
|
+
c.label
|
|
214
|
+
)) })
|
|
215
|
+
]
|
|
216
|
+
}
|
|
217
|
+
);
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
var __defProp$1 = Object.defineProperty;
|
|
221
|
+
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
222
|
+
var __publicField$1 = (obj, key, value) => {
|
|
223
|
+
__defNormalProp$1(obj, key + "" , value);
|
|
224
|
+
return value;
|
|
225
|
+
};
|
|
226
|
+
class SpeedUIScreenReact {
|
|
227
|
+
constructor() {
|
|
228
|
+
__publicField$1(this, "modal", null);
|
|
229
|
+
}
|
|
230
|
+
RenderUI({
|
|
231
|
+
host,
|
|
232
|
+
resolve
|
|
233
|
+
}) {
|
|
234
|
+
return /* @__PURE__ */ jsx(Box, { className: "speedui-react__screen", children: /* @__PURE__ */ jsx(
|
|
235
|
+
Selector,
|
|
236
|
+
{
|
|
237
|
+
label: host.getLabel(),
|
|
238
|
+
options: host.getChildren().map((c) => ({
|
|
239
|
+
label: c.getLabel(),
|
|
240
|
+
action() {
|
|
241
|
+
const runable = c;
|
|
242
|
+
resolve(new SpeedUIReactVisitResult(runable || "finish"));
|
|
243
|
+
}
|
|
244
|
+
}))
|
|
245
|
+
}
|
|
246
|
+
) });
|
|
247
|
+
}
|
|
248
|
+
async visit(host) {
|
|
249
|
+
if (host instanceof SpeedUIScreen) {
|
|
250
|
+
return new Promise((resolve) => {
|
|
251
|
+
host.run();
|
|
252
|
+
let hasConfirmed = false;
|
|
253
|
+
this.modal = ApiaUtil.instance.modals.open({
|
|
254
|
+
variant: "layout.util.speedui.modal",
|
|
255
|
+
children: /* @__PURE__ */ jsx(
|
|
256
|
+
this.RenderUI,
|
|
257
|
+
{
|
|
258
|
+
host,
|
|
259
|
+
resolve: (v) => {
|
|
260
|
+
hasConfirmed = true;
|
|
261
|
+
this.modal?.close();
|
|
262
|
+
resolve(v);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
),
|
|
266
|
+
initialFocusGetter(modalInnerRef) {
|
|
267
|
+
return modalInnerRef.querySelector(
|
|
268
|
+
".autocomplete__search"
|
|
269
|
+
);
|
|
270
|
+
},
|
|
271
|
+
onExited: () => {
|
|
272
|
+
if (hasConfirmed) {
|
|
273
|
+
host.finish();
|
|
274
|
+
} else {
|
|
275
|
+
host.cancel();
|
|
276
|
+
}
|
|
277
|
+
resolve(new SpeedUIReactVisitResult("exit"));
|
|
278
|
+
},
|
|
279
|
+
title: host.getLabel(),
|
|
280
|
+
defaultPosition: {
|
|
281
|
+
top: "20px"
|
|
282
|
+
},
|
|
283
|
+
noHeader: true,
|
|
284
|
+
size: "flex"
|
|
285
|
+
});
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
return new SpeedUIReactVisitResult(null);
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
class SpeedUIExecutionReact {
|
|
293
|
+
async visit(host) {
|
|
294
|
+
if (host instanceof SpeedUIExecution) {
|
|
295
|
+
host.run();
|
|
296
|
+
host.cb();
|
|
297
|
+
host.finish();
|
|
298
|
+
return new SpeedUIReactVisitResult("exit");
|
|
299
|
+
}
|
|
300
|
+
return new SpeedUIReactVisitResult(null);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
var __defProp = Object.defineProperty;
|
|
305
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
306
|
+
var __publicField = (obj, key, value) => {
|
|
307
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
308
|
+
return value;
|
|
309
|
+
};
|
|
310
|
+
class SpeedUIReactBusyError extends Error {
|
|
311
|
+
}
|
|
312
|
+
class SpeedUIReact {
|
|
313
|
+
constructor() {
|
|
314
|
+
__publicField(this, "visitors", []);
|
|
315
|
+
__publicField(this, "runStack", []);
|
|
316
|
+
this.visitors.push(new SpeedUIFormReact());
|
|
317
|
+
this.visitors.push(new SpeedUIScreenReact());
|
|
318
|
+
this.visitors.push(new SpeedUIExecutionReact());
|
|
319
|
+
}
|
|
320
|
+
findVisitor(fn) {
|
|
321
|
+
for (const visitor of this.visitors) {
|
|
322
|
+
if (fn(visitor)) {
|
|
323
|
+
break;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
registerVisitor(visitor) {
|
|
328
|
+
this.visitors.push(visitor);
|
|
329
|
+
}
|
|
330
|
+
async run(ui) {
|
|
331
|
+
if (this.runStack.length !== 0) {
|
|
332
|
+
throw new SpeedUIReactBusyError();
|
|
333
|
+
}
|
|
334
|
+
this.runStack.push(ui);
|
|
335
|
+
while (this.runStack.length) {
|
|
336
|
+
const runable = this.runStack[this.runStack.length - 1];
|
|
337
|
+
for await (const processor of this.visitors) {
|
|
338
|
+
const { result } = await processor.visit(runable);
|
|
339
|
+
if (result === null) ; else if (result === "finish") {
|
|
340
|
+
this.runStack.pop();
|
|
341
|
+
} else if (result === "exit") {
|
|
342
|
+
this.runStack = [];
|
|
343
|
+
} else if (result instanceof SpeedUIRunable) {
|
|
344
|
+
this.runStack.push(result);
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
export { SpeedUIExecution, SpeedUIForm, SpeedUIFormReact, SpeedUIReact, SpeedUIReactBusyError, SpeedUIReactVisitResult, SpeedUIRunable, SpeedUIScreen, SpeedUIScreenReact, isSpeedAction, isSpeedForm, isSpeedScreen, loadGraph, loadRunableItem };
|
|
352
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/data/SpeedUIRunable.ts","../src/data/SpeedUIScreen.ts","../src/data/SpeedUIExecution.ts","../src/data/SpeedUIForm.ts","../src/graphLoader/graphLoader.ts","../src/ui/SpeedUIReactVisitor.tsx","../src/ui/defaults/SpeedUIFormReact/SpeedUIFormReact.tsx","../src/ui/defaults/SpeedUIScreenReact/Selector.tsx","../src/ui/defaults/SpeedUIScreenReact/SpeedUIScreenReact.tsx","../src/ui/defaults/SpeedUIExecutionReact/SpeedUIExecutionReact.tsx","../src/ui/SpeedUIReact.tsx"],"sourcesContent":["import { EventEmitter } from '@apia/util';\r\n\r\ntype SpeedUIEvent<\r\n Type extends string,\r\n T extends Record<string, unknown>,\r\n> = T & {\r\n type: Type;\r\n};\r\n\r\nexport abstract class SpeedUIRunable {\r\n protected emitter = new EventEmitter<{\r\n cancel: SpeedUIEvent<'cancel', { target: SpeedUIRunable }>;\r\n finish: SpeedUIEvent<'finish', { target: SpeedUIRunable }>;\r\n start: SpeedUIEvent<'start', { target: SpeedUIRunable }>;\r\n }>();\r\n\r\n constructor(\r\n protected label: string,\r\n public readonly parent?: SpeedUIRunable,\r\n ) {}\r\n\r\n getLabel(): string {\r\n return this.label;\r\n }\r\n\r\n cancel() {\r\n this.emit('cancel', { target: this, type: 'cancel' });\r\n }\r\n\r\n finish() {\r\n this.emit('finish', { target: this, type: 'finish' });\r\n }\r\n\r\n protected emit: (typeof this.emitter)['emit'] = (evName, ev) => {\r\n this.emitter.emit(evName, ev);\r\n this.parent?.emit(evName, ev);\r\n };\r\n\r\n on = this.emitter.on.bind(this.emitter);\r\n\r\n run() {\r\n this.emit('start', { target: this, type: 'start' });\r\n }\r\n}\r\n","import { SpeedUIRunable } from './SpeedUIRunable';\r\n\r\nexport class SpeedUIScreen extends SpeedUIRunable {\r\n constructor(\r\n label: string,\r\n public getChildren: () => SpeedUIRunable[],\r\n public readonly parent?: SpeedUIRunable,\r\n ) {\r\n super(label, parent);\r\n }\r\n}\r\n","import { SpeedUIRunable } from './SpeedUIRunable';\r\n\r\nexport class SpeedUIExecution extends SpeedUIRunable {\r\n constructor(\r\n public label: string,\r\n public cb: () => unknown,\r\n public readonly parent?: SpeedUIRunable,\r\n ) {\r\n super(label, parent);\r\n }\r\n}\r\n","import { Collector } from '@apia/validations';\r\nimport { SpeedUIRunable } from './SpeedUIRunable';\r\n\r\nexport class SpeedUIForm extends SpeedUIRunable {\r\n constructor(\r\n protected label: string,\r\n public makeFields: (collector: Collector) => void,\r\n public onConfirm: (fields: any) => unknown,\r\n public readonly parent?: SpeedUIRunable,\r\n ) {\r\n super(label, parent);\r\n }\r\n}\r\n","import { Collector } from '@apia/validations';\r\nimport { SpeedUIScreen } from '../data/SpeedUIScreen';\r\nimport { SpeedUIExecution } from '../data/SpeedUIExecution';\r\nimport { SpeedUIForm } from '../data/SpeedUIForm';\r\nimport { SpeedUIRunable } from '../data/SpeedUIRunable';\r\n\r\nexport type SpeedAction = {\r\n label: string;\r\n action: () => unknown;\r\n};\r\n\r\nexport type SpeedForm = {\r\n label: string;\r\n getItems(collector: Collector): void;\r\n action: (res: any) => unknown;\r\n};\r\n\r\nexport type SpeedScreen = {\r\n children: (() => SpeedItem[]) | SpeedItem[];\r\n label: string;\r\n};\r\n\r\nexport type SpeedItem = SpeedScreen | SpeedAction | SpeedForm;\r\n\r\nexport function isSpeedAction(item: SpeedItem): item is SpeedAction {\r\n const spi = item as SpeedAction;\r\n return !!spi.label && !!spi.action && Object.keys(spi).length === 2;\r\n}\r\n\r\nexport function isSpeedForm(item: SpeedItem): item is SpeedForm {\r\n const spf = item as SpeedForm;\r\n return (\r\n !!spf.label &&\r\n !!spf.action &&\r\n !!spf.getItems &&\r\n Object.keys(spf).length === 3\r\n );\r\n}\r\n\r\nexport function isSpeedScreen(item: SpeedItem): item is SpeedScreen {\r\n const sps = item as SpeedScreen;\r\n return (\r\n (!!sps.children && !!sps.label && Object.keys(sps).length === 2) ||\r\n (!!sps.children && !!sps.label && Object.keys(sps).length === 3)\r\n );\r\n}\r\n\r\n/**\r\n * Esta función permite cargar un árbol de SpeedUI desde un objeto sencillo.\r\n *\r\n * @example\r\n *\r\n * export const BPASpeedGraph: SpeedScreen = {\r\n label: 'BPA',\r\n children: [\r\n {\r\n label: 'Using',\r\n children: [\r\n {\r\n label: 'Process',\r\n children: () => {\r\n return window.analysisTree.collections.processes\r\n .getAll()\r\n .map((c) => {\r\n return {\r\n label: c.serialize().title,\r\n children: [],\r\n };\r\n });\r\n },\r\n },\r\n ],\r\n },\r\n ],\r\n };\r\n\r\n const speedScreen = loadGraph(BPASpeedGraph);\r\n */\r\nexport function loadGraph(\r\n level: SpeedScreen,\r\n parent?: SpeedUIRunable,\r\n): SpeedUIScreen {\r\n const screen = new SpeedUIScreen(\r\n level.label,\r\n () => {\r\n const children = Array.isArray(level.children)\r\n ? level.children\r\n : level.children();\r\n\r\n const newChildren = children.map((c) => {\r\n if (isSpeedAction(c)) {\r\n return new SpeedUIExecution(c.label, c.action, screen);\r\n } else if (isSpeedForm(c)) {\r\n return new SpeedUIForm(c.label, c.getItems, c.action, screen);\r\n } else if (isSpeedScreen(c)) {\r\n return loadGraph(c, screen);\r\n } else {\r\n throw new Error('Cannot parse item', c);\r\n }\r\n }) as SpeedUIRunable[];\r\n\r\n return newChildren;\r\n },\r\n parent,\r\n );\r\n\r\n return screen;\r\n}\r\n\r\nexport function loadRunableItem(c: SpeedItem) {\r\n if (isSpeedAction(c)) {\r\n return new SpeedUIExecution(c.label, c.action);\r\n } else if (isSpeedForm(c)) {\r\n return new SpeedUIForm(c.label, c.getItems, c.action);\r\n } else if (isSpeedScreen(c)) {\r\n return loadGraph(c);\r\n } else {\r\n throw new Error('Cannot parse item', c);\r\n }\r\n}\r\n","import { SpeedUIRunable } from '../data/SpeedUIRunable';\r\n\r\nexport class SpeedUIReactVisitResult {\r\n constructor(\r\n /**\r\n * Esta clase representa el resutlado de una ejecución de SpeedUIReactVisitor.\r\n *\r\n * Los valores posibles para result son:\r\n *\r\n * - **null**: No hacer nada.\r\n * - **SpeedUIRunable**: Ejecutar este SpeedUIRunable a continuación.\r\n * - **'finish'**: Terminar la ejecución del SpeedUIRunable actual.\r\n * - **'exit'**: Termina la ejecución del SpeedUI\r\n */\r\n public readonly result: null | SpeedUIRunable | 'exit' | 'finish',\r\n ) {}\r\n}\r\n\r\nexport interface SpeedUIReactVisitor {\r\n /**\r\n * @see SpeedUIReactVisitResult.result\r\n */\r\n visit(host: SpeedUIRunable): Promise<SpeedUIReactVisitResult>;\r\n}\r\n","import { Collector } from '@apia/validations';\r\nimport { SpeedUIForm } from '../../../data/SpeedUIForm';\r\nimport { SpeedUIRunable } from '../../../data/SpeedUIRunable';\r\nimport {\r\n SpeedUIReactVisitor,\r\n SpeedUIReactVisitResult,\r\n} from '../../SpeedUIReactVisitor';\r\n\r\nexport class SpeedUIFormReact implements SpeedUIReactVisitor {\r\n async visit(host: SpeedUIRunable): Promise<SpeedUIReactVisitResult> {\r\n if (host instanceof SpeedUIForm) {\r\n return new Promise<SpeedUIReactVisitResult>((resolve) => {\r\n const collector = new Collector();\r\n\r\n host.run();\r\n host.makeFields(collector);\r\n\r\n collector\r\n .show({\r\n title: host.getLabel(),\r\n })\r\n .then((res) => {\r\n if (res) {\r\n host.finish();\r\n host.onConfirm(res);\r\n } else {\r\n host.cancel();\r\n }\r\n resolve(new SpeedUIReactVisitResult('exit'));\r\n });\r\n });\r\n }\r\n\r\n return new SpeedUIReactVisitResult(null);\r\n }\r\n}\r\n","import { Box } from '@apia/theme';\r\nimport { addBoundary } from '@apia/util';\r\nimport { useEffect, useRef, useState } from 'react';\r\n\r\nfunction matches(str: string, search: string) {\r\n if (str.match(new RegExp(search, 'i'))) {\r\n return true;\r\n }\r\n\r\n const separatedSearch = search.replaceAll(' ', '.*');\r\n if (str.match(new RegExp(separatedSearch, 'i'))) {\r\n return true;\r\n }\r\n\r\n const extremeSearch = search.replaceAll(' ', '').split('').join('.*');\r\n return !!str.match(new RegExp(extremeSearch, 'i'));\r\n}\r\n\r\nexport const Selector = ({\r\n label,\r\n options,\r\n}: {\r\n label: string;\r\n options: { label: string; action: () => unknown }[];\r\n}) => {\r\n const [filtered, setFiltered] = useState(options);\r\n const [index, setIndex] = useState(0);\r\n\r\n const willSelect = useRef(false);\r\n\r\n useEffect(() => {\r\n document\r\n .querySelector<HTMLElement>(\r\n '.speedui__selector .speedui__option.selected',\r\n )\r\n ?.scrollIntoView({\r\n behavior: 'auto',\r\n block: 'nearest',\r\n inline: 'nearest',\r\n });\r\n }, [index]);\r\n\r\n return (\r\n <Box\r\n className=\"speedui__selector\"\r\n onKeyDown={(ev) => {\r\n switch (ev.code) {\r\n case 'ArrowUp':\r\n setIndex((c) => addBoundary(c - 1, 0, filtered.length - 1, true));\r\n break;\r\n case 'ArrowDown':\r\n setIndex((c) => addBoundary(c + 1, 0, filtered.length - 1, true));\r\n break;\r\n case 'Enter':\r\n filtered[index].action();\r\n break;\r\n }\r\n }}\r\n >\r\n <input\r\n className=\"speedui__autocomplete\"\r\n placeholder={label}\r\n onChange={(ev) => {\r\n if (\r\n (ev.target.value.toLowerCase() ===\r\n filtered[0]?.label.toLowerCase() &&\r\n filtered.length === 1) ||\r\n (willSelect.current && filtered.length === 1)\r\n ) {\r\n filtered[0].action();\r\n } else {\r\n willSelect.current = filtered.length === 1;\r\n\r\n setFiltered(\r\n options.filter((c) => matches(c.label, ev.target.value)),\r\n );\r\n }\r\n }}\r\n />\r\n <Box>\r\n {filtered.map((c, i) => (\r\n <Box\r\n className={`speedui__option ${index === i ? 'selected' : ''}`}\r\n onClick={() => {\r\n c.action();\r\n }}\r\n key={c.label}\r\n >\r\n {c.label}\r\n </Box>\r\n ))}\r\n </Box>\r\n </Box>\r\n );\r\n};\r\n","import { ApiaUtil, ApiaUtilModalHandler } from '@apia/components';\r\nimport { SpeedUIRunable } from '../../../data/SpeedUIRunable';\r\nimport { SpeedUIScreen } from '../../../data/SpeedUIScreen';\r\nimport {\r\n SpeedUIReactVisitor,\r\n SpeedUIReactVisitResult,\r\n} from '../../SpeedUIReactVisitor';\r\nimport { Box } from '@apia/theme';\r\nimport { Selector } from './Selector';\r\n\r\nexport class SpeedUIScreenReact implements SpeedUIReactVisitor {\r\n private RenderUI({\r\n host,\r\n resolve,\r\n }: {\r\n host: SpeedUIScreen;\r\n resolve: (value: SpeedUIReactVisitResult) => void;\r\n }) {\r\n return (\r\n <Box className=\"speedui-react__screen\">\r\n <Selector\r\n label={host.getLabel()}\r\n options={host.getChildren().map((c) => ({\r\n label: c.getLabel(),\r\n action() {\r\n const runable = c;\r\n\r\n resolve(new SpeedUIReactVisitResult(runable || 'finish'));\r\n },\r\n }))}\r\n />\r\n </Box>\r\n );\r\n }\r\n\r\n private modal: ApiaUtilModalHandler | null = null;\r\n\r\n async visit(host: SpeedUIRunable): Promise<SpeedUIReactVisitResult> {\r\n if (host instanceof SpeedUIScreen) {\r\n return new Promise<SpeedUIReactVisitResult>((resolve) => {\r\n host.run();\r\n\r\n let hasConfirmed = false;\r\n\r\n this.modal = ApiaUtil.instance.modals.open({\r\n variant: 'layout.util.speedui.modal',\r\n children: (\r\n <this.RenderUI\r\n host={host}\r\n resolve={(v) => {\r\n hasConfirmed = true;\r\n this.modal?.close();\r\n resolve(v);\r\n }}\r\n />\r\n ),\r\n initialFocusGetter(modalInnerRef) {\r\n return modalInnerRef.querySelector<HTMLElement>(\r\n '.autocomplete__search',\r\n );\r\n },\r\n onExited: () => {\r\n if (hasConfirmed) {\r\n host.finish();\r\n } else {\r\n host.cancel();\r\n }\r\n resolve(new SpeedUIReactVisitResult('exit'));\r\n },\r\n title: host.getLabel(),\r\n defaultPosition: {\r\n top: '20px',\r\n },\r\n noHeader: true,\r\n size: 'flex',\r\n });\r\n });\r\n }\r\n\r\n return new SpeedUIReactVisitResult(null);\r\n }\r\n}\r\n","import { SpeedUIExecution } from '../../../data/SpeedUIExecution';\r\nimport { SpeedUIRunable } from '../../../data/SpeedUIRunable';\r\nimport {\r\n SpeedUIReactVisitor,\r\n SpeedUIReactVisitResult,\r\n} from '../../SpeedUIReactVisitor';\r\n\r\nexport class SpeedUIExecutionReact implements SpeedUIReactVisitor {\r\n async visit(host: SpeedUIRunable): Promise<SpeedUIReactVisitResult> {\r\n if (host instanceof SpeedUIExecution) {\r\n host.run();\r\n host.cb();\r\n host.finish();\r\n\r\n return new SpeedUIReactVisitResult('exit');\r\n }\r\n\r\n return new SpeedUIReactVisitResult(null);\r\n }\r\n}\r\n","import { SpeedUIRunable } from '../data/SpeedUIRunable';\r\nimport { SpeedUIExecutionReact } from './defaults/SpeedUIExecutionReact/SpeedUIExecutionReact';\r\nimport { SpeedUIFormReact } from './defaults/SpeedUIFormReact/SpeedUIFormReact';\r\nimport { SpeedUIScreenReact } from './defaults/SpeedUIScreenReact/SpeedUIScreenReact';\r\nimport { SpeedUIReactVisitor } from './SpeedUIReactVisitor';\r\n\r\nexport class SpeedUIReactBusyError extends Error {}\r\n\r\n/**\r\n * Esta clase será la encargada de implementar el rol de Visitor en la estructura,\r\n * decidiendo qué se debe hacer con cada elemento.\r\n *\r\n * Además, la clase SpeedUIReact también implementará el patrón Chain of Responsibility,\r\n * delegando la actuación en cada visita a clases que implementen SpeedUIReactVisitor\r\n */\r\nexport class SpeedUIReact {\r\n protected visitors: SpeedUIReactVisitor[] = [];\r\n protected runStack: SpeedUIRunable[] = [];\r\n\r\n constructor() {\r\n this.visitors.push(new SpeedUIFormReact());\r\n this.visitors.push(new SpeedUIScreenReact());\r\n this.visitors.push(new SpeedUIExecutionReact());\r\n }\r\n\r\n findVisitor(fn: (current: SpeedUIReactVisitor) => boolean) {\r\n for (const visitor of this.visitors) {\r\n if (fn(visitor)) {\r\n break;\r\n }\r\n }\r\n }\r\n\r\n registerVisitor(visitor: SpeedUIReactVisitor) {\r\n this.visitors.push(visitor);\r\n }\r\n\r\n async run(ui: SpeedUIRunable) {\r\n if (this.runStack.length !== 0) {\r\n throw new SpeedUIReactBusyError();\r\n }\r\n\r\n this.runStack.push(ui);\r\n\r\n while (this.runStack.length) {\r\n const runable = this.runStack[this.runStack.length - 1];\r\n for await (const processor of this.visitors) {\r\n const { result } = await processor.visit(runable);\r\n\r\n if (result === null) {\r\n // No hacer nada\r\n } else if (result === 'finish') {\r\n this.runStack.pop();\r\n } else if (result === 'exit') {\r\n this.runStack = [];\r\n } else if (result instanceof SpeedUIRunable) {\r\n this.runStack.push(result);\r\n }\r\n }\r\n }\r\n }\r\n}\r\n"],"names":["__publicField"],"mappings":";;;;;;;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MAAM,OAAO,CAAA;AAEhD,QAAA,IAAI,WAAW,IAAA,EAAM,CAErB,MAAA,IAAW,WAAW,QAAA,EAAU;AAC9B,UAAA,IAAA,CAAK,SAAS,GAAA,EAAI;AAAA,SACpB,MAAA,IAAW,WAAW,MAAA,EAAQ;AAC5B,UAAA,IAAA,CAAK,WAAW,EAAC;AAAA,SACnB,MAAA,IAAW,kBAAkB,cAAA,EAAgB;AAC3C,UAAA,IAAA,CAAK,QAAA,CAAS,KAAK,MAAM,CAAA;AAAA;AAC3B;AACF;AACF;AAEJ;;;;"}
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@apia/speed-ui",
|
|
3
|
+
"version": "5.0.0",
|
|
4
|
+
"sideEffects": false,
|
|
5
|
+
"author": "Alexis Leite <alexisleite@live.com>",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"module": "dist/index.js",
|
|
8
|
+
"type": "module",
|
|
9
|
+
"typings": "dist/index.d.ts",
|
|
10
|
+
"scripts": {
|
|
11
|
+
"libDev": "rollup --config ../../config/rollup.common.mjs --environment MODE:development,ENTRY:index.ts",
|
|
12
|
+
"libBuild": "rollup --config ../../config/rollup.common.mjs --environment MODE:production,ENTRY:index.ts",
|
|
13
|
+
"libWatch": "rollup --watch --config ../../config/rollup.common.mjs --environment MODE:development,ENTRY:index.ts,WATCH:true",
|
|
14
|
+
"libWatchForExecution": "rollup --watch --config ../../config/rollup.common.mjs --environment MODE:development,ENTRY:index.ts,WATCH:true,DEV_SERVER_MODULE:execution",
|
|
15
|
+
"libWatchForDashboards": "rollup --watch --config ../../config/rollup.common.mjs --environment MODE:development,ENTRY:index.ts,WATCH:true,DEV_SERVER_MODULE:dashboards"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"@types/react": "^18.2.43",
|
|
19
|
+
"@types/react-dom": "^18.2.17",
|
|
20
|
+
"@typescript-eslint/eslint-plugin": "^6.14.0",
|
|
21
|
+
"axios": "^1.11.0",
|
|
22
|
+
"typescript": "5.4.2"
|
|
23
|
+
},
|
|
24
|
+
"peerDependencies": {
|
|
25
|
+
"react": "^18.2.0",
|
|
26
|
+
"react-dom": "^18.2.0"
|
|
27
|
+
},
|
|
28
|
+
"publishConfig": {
|
|
29
|
+
"access": "public",
|
|
30
|
+
"registry": "https://registry.npmjs.org/"
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@apia/components": "^5.0.0",
|
|
34
|
+
"@apia/theme": "^5.0.0",
|
|
35
|
+
"@apia/validations": "^5.0.0",
|
|
36
|
+
"mobx": "^6.13.0",
|
|
37
|
+
"mobx-react-lite": "^4.0.7"
|
|
38
|
+
},
|
|
39
|
+
"gitHead": "985b675635fb9d3dc5e26a90a6d9898864418b84"
|
|
40
|
+
}
|