@esrf/daiquiri-lib 0.0.1-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/LICENSE +21 -0
- package/dist/index.d.ts +134 -0
- package/dist/index.esm.js +441 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/package.json +83 -0
- package/src/index.ts +2 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 ui
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
interface HardwareError {
|
|
3
|
+
property: string;
|
|
4
|
+
exception: string;
|
|
5
|
+
traceback: string;
|
|
6
|
+
}
|
|
7
|
+
interface HardwareSchemaDescription {
|
|
8
|
+
properties: {
|
|
9
|
+
additionalProperties?: boolean;
|
|
10
|
+
properties: {
|
|
11
|
+
[property: string]: any;
|
|
12
|
+
};
|
|
13
|
+
type: string;
|
|
14
|
+
uischema: {
|
|
15
|
+
position: [Record<string, unknown>];
|
|
16
|
+
};
|
|
17
|
+
uiorder?: string[];
|
|
18
|
+
};
|
|
19
|
+
callables: {
|
|
20
|
+
additionalProperties?: boolean;
|
|
21
|
+
properties: {
|
|
22
|
+
[property: string]: any;
|
|
23
|
+
};
|
|
24
|
+
type: string;
|
|
25
|
+
uischema: {
|
|
26
|
+
position: [Record<string, unknown>];
|
|
27
|
+
};
|
|
28
|
+
uiorder?: string[];
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
interface Hardware {
|
|
32
|
+
/** Object name */
|
|
33
|
+
name: string;
|
|
34
|
+
/** Object id */
|
|
35
|
+
id: string;
|
|
36
|
+
/** An optional object alias */
|
|
37
|
+
alias: string | null;
|
|
38
|
+
/** The object properties as defined in the relevant schema */
|
|
39
|
+
properties: {
|
|
40
|
+
[name: string]: any;
|
|
41
|
+
};
|
|
42
|
+
/** Whether the device is available */
|
|
43
|
+
online: boolean;
|
|
44
|
+
/** The object type as defined by the REST API */
|
|
45
|
+
type: string;
|
|
46
|
+
/** Any potential errors initialising this object */
|
|
47
|
+
errors?: HardwareError[];
|
|
48
|
+
}
|
|
49
|
+
interface HardwareChangeAction {
|
|
50
|
+
property?: string;
|
|
51
|
+
function?: string;
|
|
52
|
+
value?: any;
|
|
53
|
+
}
|
|
54
|
+
declare type HardwareChangeHandler = (action: HardwareChangeAction) => Promise<void> | null;
|
|
55
|
+
/**
|
|
56
|
+
* Common options exposed to user as yaml configuration for hardware widgets
|
|
57
|
+
*/
|
|
58
|
+
interface HardwareWidgetOptions {
|
|
59
|
+
/** Whether to show the extended popup */
|
|
60
|
+
extended?: boolean;
|
|
61
|
+
/** Kind of header displayed */
|
|
62
|
+
header?: string;
|
|
63
|
+
}
|
|
64
|
+
declare type EditableHardware<H extends Hardware = Hardware> = H & {
|
|
65
|
+
/** Call the API to make a change on the hardware object */
|
|
66
|
+
requestChange: HardwareChangeHandler;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Properties which are passed to the widgets
|
|
70
|
+
*/
|
|
71
|
+
interface HardwareWidgetProps<H extends Hardware = Hardware, O extends HardwareWidgetOptions = HardwareWidgetOptions> {
|
|
72
|
+
/** Dynamic state of the hardware */
|
|
73
|
+
hardware: EditableHardware<H>;
|
|
74
|
+
/** Static schema describing the hardware */
|
|
75
|
+
schema: HardwareSchemaDescription;
|
|
76
|
+
/** Options passed to the widget by the yaml configuration */
|
|
77
|
+
options: O;
|
|
78
|
+
/** Add temporary message on the Daiquiri top level interface */
|
|
79
|
+
addToast: (props: {
|
|
80
|
+
type: string;
|
|
81
|
+
title: string;
|
|
82
|
+
text: string;
|
|
83
|
+
}) => void;
|
|
84
|
+
/** Global state of the widget (aggregating scan/operator/hardware states) */
|
|
85
|
+
disabled: boolean;
|
|
86
|
+
/** True if the session have the control */
|
|
87
|
+
operator: boolean;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
interface MotorSchema extends Hardware {
|
|
91
|
+
properties: {
|
|
92
|
+
position: number;
|
|
93
|
+
target: number;
|
|
94
|
+
tolerance: number;
|
|
95
|
+
acceleration: number;
|
|
96
|
+
velocity: number;
|
|
97
|
+
limits: number[];
|
|
98
|
+
state: string[];
|
|
99
|
+
unit: string;
|
|
100
|
+
offset: number;
|
|
101
|
+
sign: number;
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
interface MotorDefaultOptions extends HardwareWidgetOptions {
|
|
106
|
+
/** Default step size to use for up / down arrows */
|
|
107
|
+
step?: number;
|
|
108
|
+
/** Array of selectable step sizes */
|
|
109
|
+
steps?: number[];
|
|
110
|
+
/** Number of decimals to show */
|
|
111
|
+
precision?: number;
|
|
112
|
+
/** Whether to show popup to configure extended parameters */
|
|
113
|
+
extended?: boolean;
|
|
114
|
+
/** Whether this widget is read only */
|
|
115
|
+
readOnly?: boolean;
|
|
116
|
+
/** Kind of header displayed */
|
|
117
|
+
header?: string;
|
|
118
|
+
/** Specify a fontawesome to inc the value */
|
|
119
|
+
incicon?: string;
|
|
120
|
+
/** Specify a fontawesome to dec the value */
|
|
121
|
+
decicon?: string;
|
|
122
|
+
/** If true inc and dec icon are swapped */
|
|
123
|
+
swapincdec?: boolean;
|
|
124
|
+
/** Show the step arrows horizontally instead of vertically */
|
|
125
|
+
horizontalarrows?: boolean;
|
|
126
|
+
/** Show large step arrows */
|
|
127
|
+
largearrows?: boolean;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* The default motor widget
|
|
131
|
+
*/
|
|
132
|
+
declare function MotorDefault(props: HardwareWidgetProps<MotorSchema, MotorDefaultOptions>): JSX.Element;
|
|
133
|
+
|
|
134
|
+
export { MotorDefault };
|
|
@@ -0,0 +1,441 @@
|
|
|
1
|
+
import { jsxs as o, jsx as a, Fragment as A } from "react/jsx-runtime";
|
|
2
|
+
import { Form as m, OverlayTrigger as E, Popover as b, Button as w, Badge as z, InputGroup as I } from "react-bootstrap";
|
|
3
|
+
import { forwardRef as T, useRef as M, useState as N, useEffect as q } from "react";
|
|
4
|
+
import V from "classnames";
|
|
5
|
+
import { map as $ } from "lodash";
|
|
6
|
+
function K(e) {
|
|
7
|
+
const {
|
|
8
|
+
activeMessage: t = "Online",
|
|
9
|
+
inactiveMessage: r = "Offline",
|
|
10
|
+
message: n = "This device is"
|
|
11
|
+
} = e;
|
|
12
|
+
return /* @__PURE__ */ a(
|
|
13
|
+
"div",
|
|
14
|
+
{
|
|
15
|
+
className: `dot-indicator small bg-${e.online ? "success" : "danger"}`,
|
|
16
|
+
title: `${n} ${e.online ? t : r}`
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
function W(e) {
|
|
21
|
+
const { name: t, icon: r } = e;
|
|
22
|
+
return /* @__PURE__ */ o("div", { className: "icon", title: t, children: [
|
|
23
|
+
/* @__PURE__ */ a("i", { className: `fa ${r}` }),
|
|
24
|
+
/* @__PURE__ */ a(K, { ...e })
|
|
25
|
+
] });
|
|
26
|
+
}
|
|
27
|
+
function G(e) {
|
|
28
|
+
const { headerMode: t, hardware: r } = e;
|
|
29
|
+
function n() {
|
|
30
|
+
return r.alias ? r.alias : r.name ? r.name : r.id;
|
|
31
|
+
}
|
|
32
|
+
const s = n();
|
|
33
|
+
switch (t) {
|
|
34
|
+
case "front":
|
|
35
|
+
return /* @__PURE__ */ a("div", { className: "hw-component", children: /* @__PURE__ */ o("div", { className: "hw-single", children: [
|
|
36
|
+
e.widgetIcon,
|
|
37
|
+
/* @__PURE__ */ a("div", { className: "name", children: s }),
|
|
38
|
+
/* @__PURE__ */ a("div", { className: "d-inline-block", children: e.widgetContent })
|
|
39
|
+
] }) });
|
|
40
|
+
case "none":
|
|
41
|
+
return /* @__PURE__ */ a("div", { className: "hw-component", children: /* @__PURE__ */ a("div", { className: "hw-single", children: e.widgetContent }) });
|
|
42
|
+
case "state":
|
|
43
|
+
return e.widgetState;
|
|
44
|
+
default:
|
|
45
|
+
return /* @__PURE__ */ o("div", { className: "hw-component", children: [
|
|
46
|
+
/* @__PURE__ */ o("div", { className: "hw-head", children: [
|
|
47
|
+
e.widgetIcon,
|
|
48
|
+
/* @__PURE__ */ a("div", { className: "name", children: /* @__PURE__ */ a(m.Label, { htmlFor: r.id, children: s }) }),
|
|
49
|
+
e.widgetState,
|
|
50
|
+
e.hardware.errors && e.hardware.errors.length > 0 && /* @__PURE__ */ a(
|
|
51
|
+
E,
|
|
52
|
+
{
|
|
53
|
+
trigger: "click",
|
|
54
|
+
placement: "bottom",
|
|
55
|
+
rootClose: !0,
|
|
56
|
+
overlay: /* @__PURE__ */ o(b, { id: e.hardware.id, style: { maxWidth: 500 }, children: [
|
|
57
|
+
/* @__PURE__ */ a(b.Header, { children: "Device Errors" }),
|
|
58
|
+
/* @__PURE__ */ o(b.Body, { children: [
|
|
59
|
+
"There were errors with properties on this device:",
|
|
60
|
+
/* @__PURE__ */ a("ul", { children: e.hardware.errors.map((l) => /* @__PURE__ */ o("li", { children: [
|
|
61
|
+
l.property,
|
|
62
|
+
":",
|
|
63
|
+
/* @__PURE__ */ o("span", { className: "stack-trace", children: [
|
|
64
|
+
l.traceback,
|
|
65
|
+
/* @__PURE__ */ a("br", {}),
|
|
66
|
+
l.exception
|
|
67
|
+
] })
|
|
68
|
+
] })) })
|
|
69
|
+
] })
|
|
70
|
+
] }),
|
|
71
|
+
children: /* @__PURE__ */ a(w, { variant: "danger", size: "sm", children: /* @__PURE__ */ a("i", { className: "fa fa-exclamation-triangle" }) })
|
|
72
|
+
}
|
|
73
|
+
)
|
|
74
|
+
] }),
|
|
75
|
+
/* @__PURE__ */ a("div", { className: "hw-content", children: e.widgetContent })
|
|
76
|
+
] });
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
function P(e) {
|
|
80
|
+
const t = {
|
|
81
|
+
display: "inline-block",
|
|
82
|
+
minWidth: ""
|
|
83
|
+
};
|
|
84
|
+
return e.minWidth && (t.minWidth = `${e.minWidth}em`), /* @__PURE__ */ a("div", { style: t, children: /* @__PURE__ */ a(z, { bg: e.variant, children: e.state }) });
|
|
85
|
+
}
|
|
86
|
+
function H(e) {
|
|
87
|
+
const { hardware: t } = e;
|
|
88
|
+
function r() {
|
|
89
|
+
if (!t.online)
|
|
90
|
+
return "OFFLINE";
|
|
91
|
+
let s = "UNKNOWN";
|
|
92
|
+
return e.hardware.properties.state && ([s] = e.hardware.properties.state), s;
|
|
93
|
+
}
|
|
94
|
+
const n = r();
|
|
95
|
+
return /* @__PURE__ */ a(
|
|
96
|
+
P,
|
|
97
|
+
{
|
|
98
|
+
state: n,
|
|
99
|
+
minWidth: 6,
|
|
100
|
+
variant: n === "READY" ? "success" : "warning"
|
|
101
|
+
}
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
const B = T((e, t) => {
|
|
105
|
+
const r = M(null), [n, s] = N(e.step), l = (d) => {
|
|
106
|
+
const D = t;
|
|
107
|
+
if (r.current === null)
|
|
108
|
+
return;
|
|
109
|
+
let S = Number.parseFloat(D.current.value);
|
|
110
|
+
const k = Number.parseFloat(r.current.value);
|
|
111
|
+
S += d ? k : -k, D.current.value = `${S}`, e.onStep && e.onStep({
|
|
112
|
+
target: D.current
|
|
113
|
+
});
|
|
114
|
+
}, {
|
|
115
|
+
onStep: h,
|
|
116
|
+
step: g,
|
|
117
|
+
overlay: v,
|
|
118
|
+
incIcon: f,
|
|
119
|
+
decIcon: i,
|
|
120
|
+
swapIncDec: c,
|
|
121
|
+
onKeyDown: u,
|
|
122
|
+
horizontalArrows: y,
|
|
123
|
+
largeArrows: x,
|
|
124
|
+
...C
|
|
125
|
+
} = e, O = (d) => {
|
|
126
|
+
d.key === "ArrowUp" ? (d.preventDefault(), l(!0)) : d.key === "ArrowDown" ? (d.preventDefault(), l(!1)) : u && u(d);
|
|
127
|
+
};
|
|
128
|
+
if (!e.step)
|
|
129
|
+
return /* @__PURE__ */ a(
|
|
130
|
+
m.Control,
|
|
131
|
+
{
|
|
132
|
+
ref: t,
|
|
133
|
+
type: "number",
|
|
134
|
+
step: "any",
|
|
135
|
+
onKeyDown: O,
|
|
136
|
+
...C
|
|
137
|
+
}
|
|
138
|
+
);
|
|
139
|
+
const F = $(e.steps || [e.step], (d) => /* @__PURE__ */ a("option", { value: d, children: d }, d));
|
|
140
|
+
return /* @__PURE__ */ a(
|
|
141
|
+
"div",
|
|
142
|
+
{
|
|
143
|
+
className: V("numeric-step", {
|
|
144
|
+
"numeric-step-large": x,
|
|
145
|
+
"numeric-step-horizontal": y
|
|
146
|
+
}),
|
|
147
|
+
children: /* @__PURE__ */ o(I, { children: [
|
|
148
|
+
/* @__PURE__ */ a(
|
|
149
|
+
m.Control,
|
|
150
|
+
{
|
|
151
|
+
onKeyDown: O,
|
|
152
|
+
ref: t,
|
|
153
|
+
type: "number",
|
|
154
|
+
step: "any",
|
|
155
|
+
...C
|
|
156
|
+
}
|
|
157
|
+
),
|
|
158
|
+
/* @__PURE__ */ o(A, { children: [
|
|
159
|
+
v,
|
|
160
|
+
!v && /* @__PURE__ */ o(I.Text, { className: "d-flex flex-column", children: [
|
|
161
|
+
/* @__PURE__ */ a(
|
|
162
|
+
m.Control,
|
|
163
|
+
{
|
|
164
|
+
ref: r,
|
|
165
|
+
as: "select",
|
|
166
|
+
className: "step-size",
|
|
167
|
+
defaultValue: n,
|
|
168
|
+
onChange: (d) => s(Number.parseFloat(d.target.value)),
|
|
169
|
+
children: F
|
|
170
|
+
}
|
|
171
|
+
),
|
|
172
|
+
e.unit && /* @__PURE__ */ a("div", { children: e.unit }),
|
|
173
|
+
!f && !i && /* @__PURE__ */ o(A, { children: [
|
|
174
|
+
/* @__PURE__ */ a(
|
|
175
|
+
w,
|
|
176
|
+
{
|
|
177
|
+
className: "step step-up",
|
|
178
|
+
disabled: e.disabled,
|
|
179
|
+
onClick: (d) => l(!0)
|
|
180
|
+
}
|
|
181
|
+
),
|
|
182
|
+
/* @__PURE__ */ a(
|
|
183
|
+
w,
|
|
184
|
+
{
|
|
185
|
+
className: "step step-down",
|
|
186
|
+
disabled: e.disabled,
|
|
187
|
+
onClick: (d) => l(!1)
|
|
188
|
+
}
|
|
189
|
+
)
|
|
190
|
+
] })
|
|
191
|
+
] }),
|
|
192
|
+
i && c && /* @__PURE__ */ a(w, { disabled: e.disabled, onClick: (d) => l(!1), children: /* @__PURE__ */ a("i", { className: `fa fa-fw fa-${i}` }) }),
|
|
193
|
+
f && /* @__PURE__ */ a(w, { disabled: e.disabled, onClick: (d) => l(!0), children: /* @__PURE__ */ a("i", { className: `fa fa-fw fa-${f}` }) }),
|
|
194
|
+
i && !c && /* @__PURE__ */ a(w, { disabled: e.disabled, onClick: (d) => l(!1), children: /* @__PURE__ */ a("i", { className: `fa fa-fw fa-${i}` }) })
|
|
195
|
+
] })
|
|
196
|
+
] })
|
|
197
|
+
}
|
|
198
|
+
);
|
|
199
|
+
}), L = B;
|
|
200
|
+
function U(e) {
|
|
201
|
+
const t = M(null), [r, n] = N(!1), [s, l] = N(!1);
|
|
202
|
+
q(() => {
|
|
203
|
+
t.current && (e.hardwareValue === null ? t.current.value = "" : t.current.value = e.hardwareValue.toString(), n(!1));
|
|
204
|
+
}, [e.hardwareValue]);
|
|
205
|
+
function h(c) {
|
|
206
|
+
let u = c;
|
|
207
|
+
e.precision !== void 0 && (u = Number.parseFloat(u).toFixed(e.precision)), t != null && t.current && (t.current.value = u);
|
|
208
|
+
}
|
|
209
|
+
function g() {
|
|
210
|
+
r && setTimeout(() => {
|
|
211
|
+
h(e.hardwareValue), n(!1);
|
|
212
|
+
}, 3e3);
|
|
213
|
+
}
|
|
214
|
+
function v(c) {
|
|
215
|
+
e.hardwareValue !== null && (n(!0), t != null && t.current && (t.current.value = c.target.value), c.target.value === e.hardwareValue.toString() && n(!1));
|
|
216
|
+
}
|
|
217
|
+
function f(c) {
|
|
218
|
+
n(!1), e.onMoveRequested(c.target.value);
|
|
219
|
+
}
|
|
220
|
+
function i(c) {
|
|
221
|
+
switch (c.key) {
|
|
222
|
+
case "Enter":
|
|
223
|
+
{
|
|
224
|
+
n(!1);
|
|
225
|
+
const u = Number.parseFloat(c.target.value), y = e.onMoveRequested(u);
|
|
226
|
+
y && y.catch(() => {
|
|
227
|
+
l(!0), setTimeout(() => {
|
|
228
|
+
h(e.hardwareValue), l(!1);
|
|
229
|
+
}, 2e3);
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
c.preventDefault(), c.stopPropagation();
|
|
233
|
+
break;
|
|
234
|
+
case "Esc":
|
|
235
|
+
case "Escape":
|
|
236
|
+
r && (l(!1), n(!1), h(e.hardwareValue)), c.target.blur(), c.preventDefault(), c.stopPropagation();
|
|
237
|
+
break;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
return /* @__PURE__ */ a(
|
|
241
|
+
L,
|
|
242
|
+
{
|
|
243
|
+
id: e.id,
|
|
244
|
+
className: V({
|
|
245
|
+
"form-control-edited": r,
|
|
246
|
+
"form-control-error": s,
|
|
247
|
+
"hw-moving": e.hardwareIsMoving
|
|
248
|
+
}),
|
|
249
|
+
type: e.readOnly ? "text" : "number",
|
|
250
|
+
ref: t,
|
|
251
|
+
precision: e.precision,
|
|
252
|
+
onChange: v,
|
|
253
|
+
onBlur: g,
|
|
254
|
+
onStep: f,
|
|
255
|
+
onKeyDown: i,
|
|
256
|
+
disabled: e.hardwareIsDisabled || e.readOnly || !e.hardwareIsReady,
|
|
257
|
+
step: e.step,
|
|
258
|
+
steps: e.steps,
|
|
259
|
+
incIcon: e.incIcon,
|
|
260
|
+
decIcon: e.decIcon,
|
|
261
|
+
swapIncDec: e.swapIncDec,
|
|
262
|
+
horizontalArrows: e.horizontalArrows,
|
|
263
|
+
largeArrows: e.largeArrows,
|
|
264
|
+
overlay: e.hardwareIsMoving && !e.hardwareIsDisabled ? /* @__PURE__ */ a(w, { variant: "danger", onClick: e.onAbortRequested, children: /* @__PURE__ */ a("i", { className: "fa fa-times" }) }) : null
|
|
265
|
+
}
|
|
266
|
+
);
|
|
267
|
+
}
|
|
268
|
+
function R(e) {
|
|
269
|
+
const t = M(null), [r, n] = N(!1), [s, l] = N(!1);
|
|
270
|
+
function h(i) {
|
|
271
|
+
return e.precision !== void 0 ? Number.parseFloat(i).toFixed(e.precision) : i;
|
|
272
|
+
}
|
|
273
|
+
q(() => {
|
|
274
|
+
var i;
|
|
275
|
+
t.current && (t.current.value = h((i = e.hardwareValue) == null ? void 0 : i.toString()), n(!1));
|
|
276
|
+
}, [e.hardwareValue, e.precision]);
|
|
277
|
+
function g(i) {
|
|
278
|
+
const c = h(i);
|
|
279
|
+
t != null && t.current && (t.current.value = c);
|
|
280
|
+
}
|
|
281
|
+
function v(i) {
|
|
282
|
+
switch (i.key) {
|
|
283
|
+
case "Enter": {
|
|
284
|
+
n(!1);
|
|
285
|
+
const c = Number.parseFloat(i.target.value), u = e.onMoveRequested(c);
|
|
286
|
+
u && u.catch(() => {
|
|
287
|
+
l(!0), setTimeout(() => {
|
|
288
|
+
g(e.hardwareValue), l(!1);
|
|
289
|
+
}, 2e3);
|
|
290
|
+
}), i.preventDefault(), i.stopPropagation();
|
|
291
|
+
break;
|
|
292
|
+
}
|
|
293
|
+
case "Esc":
|
|
294
|
+
case "Escape":
|
|
295
|
+
r && (l(!1), n(!1), g(e.hardwareValue)), i.target.blur(), i.preventDefault(), i.stopPropagation();
|
|
296
|
+
break;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
function f(i) {
|
|
300
|
+
n(!0), i.target, t != null && t.current && (t.current.value = i.target.value), i.target.value === e.hardwareValue.toString() && n(!1);
|
|
301
|
+
}
|
|
302
|
+
return /* @__PURE__ */ a(
|
|
303
|
+
m.Control,
|
|
304
|
+
{
|
|
305
|
+
className: V({
|
|
306
|
+
"form-control-edited": r,
|
|
307
|
+
"form-control-error": s,
|
|
308
|
+
"hw-moving": e.hardwareIsMoving
|
|
309
|
+
}),
|
|
310
|
+
type: "number",
|
|
311
|
+
ref: t,
|
|
312
|
+
onChange: f,
|
|
313
|
+
onKeyDown: v,
|
|
314
|
+
disabled: e.readOnly || e.hardwareIsMoving || e.hardwareIsDisabled,
|
|
315
|
+
step: e.step
|
|
316
|
+
}
|
|
317
|
+
);
|
|
318
|
+
}
|
|
319
|
+
function Y(e) {
|
|
320
|
+
function t(s) {
|
|
321
|
+
return e.hardware.requestChange({
|
|
322
|
+
property: "velocity",
|
|
323
|
+
value: s
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
function r(s) {
|
|
327
|
+
return e.hardware.requestChange({
|
|
328
|
+
property: "acceleration",
|
|
329
|
+
value: s
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
let n = "UNKNOWN";
|
|
333
|
+
return e.hardware.properties.state && ([n] = e.hardware.properties.state), /* @__PURE__ */ a(
|
|
334
|
+
E,
|
|
335
|
+
{
|
|
336
|
+
trigger: "click",
|
|
337
|
+
rootClose: !0,
|
|
338
|
+
overlay: /* @__PURE__ */ o(b, { id: "popid", children: [
|
|
339
|
+
/* @__PURE__ */ o(b.Header, { children: [
|
|
340
|
+
e.hardware.name,
|
|
341
|
+
" details"
|
|
342
|
+
] }),
|
|
343
|
+
/* @__PURE__ */ o(b.Body, { children: [
|
|
344
|
+
/* @__PURE__ */ o(m.Group, { children: [
|
|
345
|
+
/* @__PURE__ */ a(m.Label, { children: "Velocity" }),
|
|
346
|
+
/* @__PURE__ */ a(
|
|
347
|
+
R,
|
|
348
|
+
{
|
|
349
|
+
hardwareValue: e.hardware.properties.velocity,
|
|
350
|
+
onMoveRequested: t,
|
|
351
|
+
hardwareIsDisabled: e.disabled,
|
|
352
|
+
hardwareIsReady: n === "READY",
|
|
353
|
+
hardwareIsMoving: n === "MOVING",
|
|
354
|
+
readOnly: e.readOnly
|
|
355
|
+
}
|
|
356
|
+
)
|
|
357
|
+
] }),
|
|
358
|
+
/* @__PURE__ */ o(m.Group, { children: [
|
|
359
|
+
/* @__PURE__ */ a(m.Label, { children: "Acceleration" }),
|
|
360
|
+
/* @__PURE__ */ a(
|
|
361
|
+
R,
|
|
362
|
+
{
|
|
363
|
+
hardwareValue: e.hardware.properties.acceleration,
|
|
364
|
+
onMoveRequested: r,
|
|
365
|
+
hardwareIsDisabled: e.disabled,
|
|
366
|
+
hardwareIsReady: n === "READY",
|
|
367
|
+
hardwareIsMoving: n === "MOVING",
|
|
368
|
+
readOnly: e.readOnly
|
|
369
|
+
}
|
|
370
|
+
)
|
|
371
|
+
] })
|
|
372
|
+
] })
|
|
373
|
+
] }),
|
|
374
|
+
children: /* @__PURE__ */ a(w, { children: /* @__PURE__ */ a("i", { className: "fa fa-ellipsis-h" }) })
|
|
375
|
+
}
|
|
376
|
+
);
|
|
377
|
+
}
|
|
378
|
+
function _(e) {
|
|
379
|
+
const { hardware: t, options: r = {} } = e;
|
|
380
|
+
function n() {
|
|
381
|
+
t.requestChange({
|
|
382
|
+
function: "stop"
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
function s(f) {
|
|
386
|
+
return t.requestChange({
|
|
387
|
+
property: "position",
|
|
388
|
+
value: f,
|
|
389
|
+
function: "move"
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
let l = "UNKNOWN";
|
|
393
|
+
e.hardware.properties.state && ([l] = e.hardware.properties.state);
|
|
394
|
+
const h = /* @__PURE__ */ a(W, { name: "Motor", icon: "fam-hardware-motor", online: t.online }), g = /* @__PURE__ */ a(H, { hardware: t }), v = e.options ? e.options.header : "top";
|
|
395
|
+
return /* @__PURE__ */ a(
|
|
396
|
+
G,
|
|
397
|
+
{
|
|
398
|
+
hardware: t,
|
|
399
|
+
widgetIcon: h,
|
|
400
|
+
widgetState: g,
|
|
401
|
+
widgetContent: /* @__PURE__ */ o(I, { children: [
|
|
402
|
+
/* @__PURE__ */ a(
|
|
403
|
+
U,
|
|
404
|
+
{
|
|
405
|
+
id: t.id,
|
|
406
|
+
hardwareValue: t.properties.position,
|
|
407
|
+
hardwareIsDisabled: e.disabled,
|
|
408
|
+
hardwareIsReady: l === "READY",
|
|
409
|
+
hardwareIsMoving: l === "MOVING",
|
|
410
|
+
onMoveRequested: s,
|
|
411
|
+
onAbortRequested: n,
|
|
412
|
+
precision: r.precision,
|
|
413
|
+
readOnly: r.readOnly,
|
|
414
|
+
step: r.step,
|
|
415
|
+
steps: r.steps,
|
|
416
|
+
incIcon: r.incicon,
|
|
417
|
+
decIcon: r.decicon,
|
|
418
|
+
swapIncDec: r.swapincdec,
|
|
419
|
+
horizontalArrows: r.horizontalarrows,
|
|
420
|
+
largeArrows: r.largearrows
|
|
421
|
+
}
|
|
422
|
+
),
|
|
423
|
+
t.properties.unit && /* @__PURE__ */ a(I.Text, { children: t.properties.unit }),
|
|
424
|
+
l !== "MOVING" && r.extended && /* @__PURE__ */ a(
|
|
425
|
+
Y,
|
|
426
|
+
{
|
|
427
|
+
hardware: t,
|
|
428
|
+
disabled: e.disabled,
|
|
429
|
+
readOnly: r.readOnly
|
|
430
|
+
}
|
|
431
|
+
),
|
|
432
|
+
l === "MOVING" && !e.disabled && !r.step && /* @__PURE__ */ a(w, { variant: "danger", onClick: n, children: /* @__PURE__ */ a("i", { className: "fa fa-times" }) })
|
|
433
|
+
] }),
|
|
434
|
+
headerMode: v
|
|
435
|
+
}
|
|
436
|
+
);
|
|
437
|
+
}
|
|
438
|
+
export {
|
|
439
|
+
_ as MotorDefault
|
|
440
|
+
};
|
|
441
|
+
//# sourceMappingURL=index.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../src/hardware/TypeIcon.tsx","../src/hardware/utils/HardwareTemplate.tsx","../src/hardware/utils/State.tsx","../src/components/NumericStep.tsx","../src/hardware/utils/HardwareNumericStep.tsx","../src/hardware/utils/HardwareInputNumber.tsx","../src/hardware/MotorDefault.tsx"],"sourcesContent":["interface Props {\n online: boolean;\n activeMessage?: string;\n inactiveMessage?: string;\n message?: string;\n icon: string;\n name: string;\n}\nexport function OnlineStatus(props: Props) {\n const {\n activeMessage = 'Online',\n inactiveMessage = 'Offline',\n message = 'This device is',\n } = props;\n\n return (\n <div\n className={`dot-indicator small bg-${\n props.online ? 'success' : 'danger'\n }`}\n title={`${message} ${props.online ? activeMessage : inactiveMessage}`}\n />\n );\n}\n\nexport default function TypeIcon(props: Props) {\n const { name, icon } = props;\n return (\n <div className=\"icon\" title={name}>\n <i className={`fa ${icon}`} />\n <OnlineStatus {...props} />\n </div>\n );\n}\n","import type { ReactElement } from 'react';\nimport { Form, OverlayTrigger, Popover, Button } from 'react-bootstrap';\nimport type { Hardware } from './types';\n\ninterface Props {\n hardware: Hardware;\n headerMode?: string;\n widgetIcon: ReactElement;\n widgetState: ReactElement;\n widgetContent: ReactElement;\n}\n\n/**\n * Normalized way to compose hardware component in order to provide the same\n * kind of layout\n */\nexport default function HardwareTemplate(props: Props) {\n const { headerMode, hardware } = props;\n\n function getLabel() {\n if (hardware.alias) {\n return hardware.alias;\n }\n if (hardware.name) {\n return hardware.name;\n }\n return hardware.id;\n }\n\n const label = getLabel();\n\n switch (headerMode) {\n case 'front':\n return (\n <div className=\"hw-component\">\n <div className=\"hw-single\">\n {props.widgetIcon}\n <div className=\"name\">{label}</div>\n <div className=\"d-inline-block\">{props.widgetContent}</div>\n </div>\n </div>\n );\n case 'none':\n return (\n <div className=\"hw-component\">\n <div className=\"hw-single\">{props.widgetContent}</div>\n </div>\n );\n case 'state':\n return props.widgetState;\n // case 'top':\n default:\n return (\n <div className=\"hw-component\">\n <div className=\"hw-head\">\n {props.widgetIcon}\n <div className=\"name\">\n <Form.Label htmlFor={hardware.id}>{label}</Form.Label>\n </div>\n {props.widgetState}\n {props.hardware.errors && props.hardware.errors.length > 0 && (\n <OverlayTrigger\n trigger=\"click\"\n placement=\"bottom\"\n rootClose\n overlay={\n <Popover id={props.hardware.id} style={{ maxWidth: 500 }}>\n <Popover.Header>Device Errors</Popover.Header>\n <Popover.Body>\n There were errors with properties on this device:\n <ul>\n {props.hardware.errors.map((error) => (\n <li>\n {error.property}:\n <span className=\"stack-trace\">\n {error.traceback}\n <br />\n {error.exception}\n </span>\n </li>\n ))}\n </ul>\n </Popover.Body>\n </Popover>\n }\n >\n <Button variant=\"danger\" size=\"sm\">\n <i className=\"fa fa-exclamation-triangle\" />\n </Button>\n </OverlayTrigger>\n )}\n </div>\n <div className=\"hw-content\">{props.widgetContent}</div>\n </div>\n );\n }\n}\n","import { Badge } from 'react-bootstrap';\nimport type * as Schema from './schema';\n\n/**\n * Normalize the way to display an hardware state.\n *\n * If `minWidth` is pecified (in `em`) it ensure the widget width will stay the\n * same when the state change\n */\nexport function HardwareState(props: {\n state: string;\n variant: string;\n minWidth?: number;\n}) {\n const style = {\n display: 'inline-block',\n minWidth: '',\n };\n\n if (props.minWidth) style.minWidth = `${props.minWidth}em`;\n return (\n <div style={style}>\n <Badge bg={props.variant}>{props.state}</Badge>\n </div>\n );\n}\n\nexport function MotorState(props: { hardware: Schema.MotorSchema }) {\n const { hardware } = props;\n function getState() {\n if (!hardware.online) {\n return 'OFFLINE';\n }\n let s1 = 'UNKNOWN';\n if (props.hardware.properties.state) {\n [s1] = props.hardware.properties.state;\n }\n return s1;\n }\n const state = getState();\n return (\n <HardwareState\n state={state}\n minWidth={6}\n variant={state === 'READY' ? 'success' : 'warning'}\n />\n );\n}\n\nexport function ShutterState(props: {\n hardware: Schema.ShutterSchema;\n useReadyState?: boolean;\n}) {\n const { hardware } = props;\n function getState() {\n if (!hardware.online) {\n return 'OFFLINE';\n }\n const s = hardware.properties.state;\n if (props.useReadyState && (s === 'OPEN' || s === 'CLOSED')) {\n return 'READY';\n }\n return s;\n }\n\n const state = getState();\n\n function getVariant() {\n switch (state) {\n case 'READY':\n return 'success';\n case 'OPEN':\n return 'success';\n case 'CLOSED':\n return 'danger';\n case 'DISABLED':\n return 'secondary';\n case 'MOVING':\n case 'STANDBY':\n case 'OFFLINE':\n return 'warning';\n case 'FAULT':\n return 'fatal';\n default:\n return 'fatal';\n }\n }\n\n return <HardwareState state={state} minWidth={6} variant={getVariant()} />;\n}\n","import type {\n KeyboardEvent,\n ChangeEvent,\n MutableRefObject,\n ReactChild,\n} from 'react';\nimport { forwardRef, useRef, useState } from 'react';\nimport { map } from 'lodash';\n\nimport { Form, Button, InputGroup } from 'react-bootstrap';\nimport classNames from 'classnames';\n\ninterface Props {\n step?: number;\n steps?: number[];\n disabled: boolean;\n id?: string;\n unit?: string;\n overlay?: ReactChild | null;\n incIcon?: string;\n decIcon?: string;\n swapIncDec?: boolean;\n className?: string;\n type?: 'number' | 'text';\n precision?: number;\n horizontalArrows?: boolean;\n largeArrows?: boolean;\n onBlur: () => void;\n onChange: (e: ChangeEvent<HTMLInputElement>) => void;\n onStep: (params: { target: HTMLInputElement }) => void;\n onKeyDown?: (e: KeyboardEvent<HTMLInputElement>) => void;\n}\n\nconst NumericStep = forwardRef<HTMLInputElement, Props>((props, ref) => {\n const stepSizeRef = useRef<HTMLSelectElement>(null);\n const [currentStep, setCurrentStep] = useState(props.step);\n const onStep = (up: boolean) => {\n // FIXME: Would be good to remove that cast\n const ref2 = ref as MutableRefObject<HTMLInputElement>;\n if (stepSizeRef.current === null) {\n return;\n }\n let val = Number.parseFloat(ref2.current.value);\n const stepSize = Number.parseFloat(stepSizeRef.current.value);\n val += up ? stepSize : -stepSize;\n ref2.current.value = `${val}`;\n\n if (props.onStep) {\n props.onStep({\n target: ref2.current,\n });\n }\n };\n\n const {\n onStep: onStepProp,\n step,\n overlay,\n incIcon,\n decIcon,\n swapIncDec,\n onKeyDown,\n horizontalArrows,\n largeArrows,\n ...rest\n } = props;\n\n const onKeyDown2 = (e: KeyboardEvent<HTMLInputElement>) => {\n if (e.key === 'ArrowUp') {\n e.preventDefault();\n onStep(true);\n } else if (e.key === 'ArrowDown') {\n e.preventDefault();\n onStep(false);\n } else if (onKeyDown) {\n onKeyDown(e);\n }\n };\n\n if (!props.step) {\n return (\n <Form.Control\n ref={ref}\n type=\"number\"\n step=\"any\"\n onKeyDown={onKeyDown2}\n {...rest}\n />\n );\n }\n\n const steps = map(props.steps || [props.step], (s) => (\n <option value={s} key={s}>\n {s}\n </option>\n ));\n\n return (\n <div\n className={classNames('numeric-step', {\n 'numeric-step-large': largeArrows,\n 'numeric-step-horizontal': horizontalArrows,\n })}\n >\n <InputGroup>\n <Form.Control\n onKeyDown={onKeyDown2}\n ref={ref}\n type=\"number\"\n step=\"any\"\n {...rest}\n />\n <>\n {overlay}\n {!overlay && (\n <InputGroup.Text className=\"d-flex flex-column\">\n <Form.Control\n ref={stepSizeRef}\n as=\"select\"\n className=\"step-size\"\n defaultValue={currentStep}\n onChange={(e) =>\n setCurrentStep(Number.parseFloat(e.target.value))\n }\n >\n {steps}\n </Form.Control>\n {props.unit && <div>{props.unit}</div>}\n {!incIcon && !decIcon && (\n <>\n <Button\n className=\"step step-up\"\n disabled={props.disabled}\n onClick={(e) => onStep(true)}\n />\n <Button\n className=\"step step-down\"\n disabled={props.disabled}\n onClick={(e) => onStep(false)}\n />\n </>\n )}\n </InputGroup.Text>\n )}\n {decIcon && swapIncDec && (\n <Button disabled={props.disabled} onClick={(e) => onStep(false)}>\n <i className={`fa fa-fw fa-${decIcon}`} />\n </Button>\n )}\n {incIcon && (\n <Button disabled={props.disabled} onClick={(e) => onStep(true)}>\n <i className={`fa fa-fw fa-${incIcon}`} />\n </Button>\n )}\n {decIcon && !swapIncDec && (\n <Button disabled={props.disabled} onClick={(e) => onStep(false)}>\n <i className={`fa fa-fw fa-${decIcon}`} />\n </Button>\n )}\n </>\n </InputGroup>\n </div>\n );\n});\n\nexport default NumericStep;\n","import { useRef, useState, useEffect } from 'react';\nimport type { KeyboardEvent, ChangeEvent } from 'react';\nimport classNames from 'classnames';\nimport { Button, Form, OverlayTrigger, InputGroup } from 'react-bootstrap';\nimport NumericStep from '../../components/NumericStep';\n\n/**\n * NumericStep handled hardware properties.\n *\n * Input related to hardware have specificities because the hardware state can\n * change during the user interaction.\n */\nexport default function HardwareNumericStep(props: {\n hardwareValue: number | null;\n hardwareIsDisabled: boolean;\n hardwareIsMoving: boolean;\n hardwareIsReady: boolean;\n onMoveRequested: (value: number) => Promise<void> | null;\n onAbortRequested: () => void;\n /** Default step size to use for up / down arrows */\n step?: number;\n /** Array of selectable step sizes */\n steps?: number[];\n /** Number of decimals to show */\n precision?: number;\n /** Whether this widget is read only */\n readOnly?: boolean;\n /** Specify a fontawesome to inc the value */\n incIcon?: string;\n /** Specify a fontawesome to dec the value */\n decIcon?: string;\n /** If true inc and dec icon are swapped */\n swapIncDec?: boolean;\n /** Show the step arrows horizontally instead of vertically */\n horizontalArrows?: boolean;\n /** Show large step arrows */\n largeArrows?: boolean;\n /** Identifier passed to the input element */\n id?: string;\n}) {\n const valueRef = useRef<HTMLInputElement>(null);\n const [edited, setEdited] = useState(false);\n const [error, setError] = useState(false);\n useEffect(() => {\n if (valueRef.current) {\n if (props.hardwareValue === null) {\n valueRef.current.value = '';\n } else {\n valueRef.current.value = props.hardwareValue.toString();\n }\n setEdited(false);\n }\n }, [props.hardwareValue]);\n\n function updateRef(value: any) {\n let newValue = value;\n if (props.precision !== undefined) {\n newValue = Number.parseFloat(newValue).toFixed(props.precision);\n }\n if (valueRef?.current) {\n valueRef.current.value = newValue;\n }\n }\n\n function onBlur() {\n if (edited) {\n setTimeout(() => {\n updateRef(props.hardwareValue);\n setEdited(false);\n }, 3000);\n }\n }\n\n function onChange(e: ChangeEvent<HTMLInputElement>) {\n if (props.hardwareValue === null) {\n return;\n }\n setEdited(true);\n if (valueRef?.current) {\n valueRef.current.value = e.target.value;\n }\n if (e.target.value === props.hardwareValue.toString()) {\n setEdited(false);\n }\n }\n\n function onStep(e: any) {\n setEdited(false);\n void props.onMoveRequested(e.target.value);\n }\n\n function onKeyDown(e: KeyboardEvent<HTMLInputElement>) {\n switch (e.key) {\n case 'Enter':\n {\n setEdited(false);\n // @ts-expect-error\n const value: number = Number.parseFloat(e.target.value);\n const promise = props.onMoveRequested(value);\n if (promise) {\n promise.catch(() => {\n setError(true);\n setTimeout(() => {\n updateRef(props.hardwareValue);\n setError(false);\n }, 2000);\n });\n }\n }\n e.preventDefault();\n e.stopPropagation();\n break;\n case 'Esc': // IE/Edge specific value\n case 'Escape':\n if (edited) {\n setError(false);\n setEdited(false);\n updateRef(props.hardwareValue);\n }\n // @ts-expect-error\n e.target.blur();\n e.preventDefault();\n e.stopPropagation();\n break;\n }\n }\n\n return (\n <NumericStep\n id={props.id}\n className={classNames({\n 'form-control-edited': edited,\n 'form-control-error': error,\n 'hw-moving': props.hardwareIsMoving,\n })}\n type={props.readOnly ? 'text' : 'number'}\n ref={valueRef}\n precision={props.precision}\n onChange={onChange}\n onBlur={onBlur}\n onStep={onStep}\n onKeyDown={onKeyDown}\n disabled={\n props.hardwareIsDisabled || props.readOnly || !props.hardwareIsReady\n }\n step={props.step}\n steps={props.steps}\n incIcon={props.incIcon}\n decIcon={props.decIcon}\n swapIncDec={props.swapIncDec}\n horizontalArrows={props.horizontalArrows}\n largeArrows={props.largeArrows}\n overlay={\n props.hardwareIsMoving && !props.hardwareIsDisabled ? (\n <Button variant=\"danger\" onClick={props.onAbortRequested}>\n <i className=\"fa fa-times\" />\n </Button>\n ) : null\n }\n />\n );\n}\n","import { useEffect, useRef, useState } from 'react';\nimport type { KeyboardEvent, ChangeEvent } from 'react';\nimport { Form } from 'react-bootstrap';\nimport classNames from 'classnames';\n\n/**\n * Input number synchronized with a hardware.\n *\n * Input related to hardware have specificities because the hardware state can\n * change during the user interaction.\n *\n * TODO: Maybe normalize `precision` and `step` together\n */\nexport default function HardwareInputNumber(props: {\n hardwareValue: number;\n hardwareIsDisabled: boolean;\n hardwareIsMoving?: boolean;\n hardwareIsReady?: boolean;\n onMoveRequested: (value: number) => Promise<void> | null;\n onAbortRequested?: () => void;\n readOnly?: boolean;\n precision?: number;\n step?: number;\n}) {\n const valueRef = useRef<HTMLInputElement>(null);\n const [edited, setEdited] = useState(false);\n const [error, setError] = useState(false);\n\n function normalizeNumber(value: string): string {\n if (props.precision !== undefined) {\n return Number.parseFloat(value).toFixed(props.precision);\n }\n return value;\n }\n\n useEffect(() => {\n if (valueRef.current) {\n valueRef.current.value = normalizeNumber(props.hardwareValue?.toString());\n setEdited(false);\n }\n }, [props.hardwareValue, props.precision]);\n\n function updateRef(value: any) {\n const newValue = normalizeNumber(value);\n if (valueRef?.current) {\n valueRef.current.value = newValue;\n }\n }\n\n function onKeyDown(e: KeyboardEvent<HTMLInputElement>) {\n switch (e.key) {\n case 'Enter': {\n setEdited(false);\n // @ts-expect-error\n const value: number = Number.parseFloat(e.target.value);\n const promise = props.onMoveRequested(value);\n if (promise) {\n promise.catch(() => {\n setError(true);\n setTimeout(() => {\n updateRef(props.hardwareValue);\n setError(false);\n }, 2000);\n });\n }\n e.preventDefault();\n e.stopPropagation();\n break;\n }\n case 'Esc': // IE/Edge specific value\n case 'Escape':\n if (edited) {\n setError(false);\n setEdited(false);\n updateRef(props.hardwareValue);\n }\n // @ts-expect-error\n e.target.blur();\n e.preventDefault();\n e.stopPropagation();\n break;\n }\n }\n\n function onChange(e: ChangeEvent<HTMLInputElement>) {\n setEdited(true);\n const { name } = e.target;\n if (valueRef?.current) {\n valueRef.current.value = e.target.value;\n }\n if (e.target.value === props.hardwareValue.toString()) {\n setEdited(false);\n }\n }\n\n return (\n <Form.Control\n className={classNames({\n 'form-control-edited': edited,\n 'form-control-error': error,\n 'hw-moving': props.hardwareIsMoving,\n })}\n type=\"number\"\n ref={valueRef}\n onChange={onChange}\n onKeyDown={onKeyDown}\n disabled={\n props.readOnly || props.hardwareIsMoving || props.hardwareIsDisabled\n }\n step={props.step}\n />\n );\n}\n","import {\n Button,\n Form,\n OverlayTrigger,\n InputGroup,\n Popover,\n} from 'react-bootstrap';\n\nimport TypeIcon from './TypeIcon';\nimport HardwareTemplate from './utils/HardwareTemplate';\nimport { MotorState } from './utils/State';\nimport HardwareNumericStep from './utils/HardwareNumericStep';\nimport HardwareInputNumber from './utils/HardwareInputNumber';\nimport type { MotorSchema } from './utils/schema';\nimport type {\n HardwareWidgetProps,\n HardwareWidgetOptions,\n EditableHardware,\n} from './utils/types';\n\ninterface MotorOverlayProps {\n hardware: EditableHardware<MotorSchema>;\n disabled: boolean;\n readOnly?: boolean;\n}\n\nfunction MotorOverlay(props: MotorOverlayProps) {\n function onMoveVelocityRequested(target: number) {\n return props.hardware.requestChange({\n property: 'velocity',\n value: target,\n });\n }\n\n function onMoveAccelerationRequested(target: number) {\n return props.hardware.requestChange({\n property: 'acceleration',\n value: target,\n });\n }\n\n let s1 = 'UNKNOWN';\n if (props.hardware.properties.state) {\n [s1] = props.hardware.properties.state;\n }\n\n return (\n <OverlayTrigger\n trigger=\"click\"\n rootClose\n overlay={\n <Popover id=\"popid\">\n <Popover.Header>{props.hardware.name} details</Popover.Header>\n <Popover.Body>\n <Form.Group>\n <Form.Label>Velocity</Form.Label>\n <HardwareInputNumber\n hardwareValue={props.hardware.properties.velocity}\n onMoveRequested={onMoveVelocityRequested}\n hardwareIsDisabled={props.disabled}\n hardwareIsReady={s1 === 'READY'}\n hardwareIsMoving={s1 === 'MOVING'}\n readOnly={props.readOnly}\n />\n </Form.Group>\n <Form.Group>\n <Form.Label>Acceleration</Form.Label>\n <HardwareInputNumber\n hardwareValue={props.hardware.properties.acceleration}\n onMoveRequested={onMoveAccelerationRequested}\n hardwareIsDisabled={props.disabled}\n hardwareIsReady={s1 === 'READY'}\n hardwareIsMoving={s1 === 'MOVING'}\n readOnly={props.readOnly}\n />\n </Form.Group>\n </Popover.Body>\n </Popover>\n }\n >\n <Button>\n <i className=\"fa fa-ellipsis-h\" />\n </Button>\n </OverlayTrigger>\n );\n}\n\nexport interface MotorDefaultOptions extends HardwareWidgetOptions {\n /** Default step size to use for up / down arrows */\n step?: number;\n /** Array of selectable step sizes */\n steps?: number[];\n /** Number of decimals to show */\n precision?: number;\n /** Whether to show popup to configure extended parameters */\n extended?: boolean;\n /** Whether this widget is read only */\n readOnly?: boolean;\n /** Kind of header displayed */\n header?: string;\n /** Specify a fontawesome to inc the value */\n incicon?: string;\n /** Specify a fontawesome to dec the value */\n decicon?: string;\n /** If true inc and dec icon are swapped */\n swapincdec?: boolean;\n /** Show the step arrows horizontally instead of vertically */\n horizontalarrows?: boolean;\n /** Show large step arrows */\n largearrows?: boolean;\n}\n\n/**\n * The default motor widget\n */\nexport default function MotorDefault(\n props: HardwareWidgetProps<MotorSchema, MotorDefaultOptions>\n) {\n const { hardware, options = {} } = props;\n function onAbortRequested() {\n void hardware.requestChange({\n function: 'stop',\n });\n }\n\n function onMovePositionRequested(target: number) {\n return hardware.requestChange({\n property: 'position',\n value: target,\n function: 'move',\n });\n }\n\n let s1 = 'UNKNOWN';\n if (props.hardware.properties.state) {\n [s1] = props.hardware.properties.state;\n }\n\n const widgetIcon = (\n <TypeIcon name=\"Motor\" icon=\"fam-hardware-motor\" online={hardware.online} />\n );\n\n const widgetState = <MotorState hardware={hardware} />;\n\n const headerMode = props.options ? props.options.header : 'top';\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={\n <InputGroup>\n <HardwareNumericStep\n id={hardware.id}\n hardwareValue={hardware.properties.position}\n hardwareIsDisabled={props.disabled}\n hardwareIsReady={s1 === 'READY'}\n hardwareIsMoving={s1 === 'MOVING'}\n onMoveRequested={onMovePositionRequested}\n onAbortRequested={onAbortRequested}\n precision={options.precision}\n readOnly={options.readOnly}\n step={options.step}\n steps={options.steps}\n incIcon={options.incicon}\n decIcon={options.decicon}\n swapIncDec={options.swapincdec}\n horizontalArrows={options.horizontalarrows}\n largeArrows={options.largearrows}\n />\n {hardware.properties.unit && (\n <InputGroup.Text>{hardware.properties.unit}</InputGroup.Text>\n )}\n\n {s1 !== 'MOVING' && options.extended && (\n <MotorOverlay\n hardware={hardware}\n disabled={props.disabled}\n readOnly={options.readOnly}\n />\n )}\n\n {s1 === 'MOVING' && !props.disabled && !options.step && (\n <Button variant=\"danger\" onClick={onAbortRequested}>\n <i className=\"fa fa-times\" />\n </Button>\n )}\n </InputGroup>\n }\n headerMode={headerMode}\n />\n );\n}\n"],"names":["OnlineStatus","props","activeMessage","inactiveMessage","message","jsx","TypeIcon","name","icon","jsxs","HardwareTemplate","headerMode","hardware","getLabel","label","Form","OverlayTrigger","Popover","error","Button","HardwareState","style","Badge","MotorState","getState","s1","state","NumericStep","forwardRef","ref","stepSizeRef","useRef","currentStep","setCurrentStep","useState","onStep","up","ref2","val","stepSize","onStepProp","step","overlay","incIcon","decIcon","swapIncDec","onKeyDown","horizontalArrows","largeArrows","rest","onKeyDown2","e","steps","map","s","classNames","InputGroup","Fragment","NumericStep$1","HardwareNumericStep","valueRef","edited","setEdited","setError","useEffect","updateRef","value","newValue","onBlur","onChange","promise","HardwareInputNumber","normalizeNumber","_a","MotorOverlay","onMoveVelocityRequested","target","onMoveAccelerationRequested","MotorDefault","options","onAbortRequested","onMovePositionRequested","widgetIcon","widgetState"],"mappings":";;;;;AAQO,SAASA,EAAaC,GAAc;AACnC,QAAA;AAAA,IACJ,eAAAC,IAAgB;AAAA,IAChB,iBAAAC,IAAkB;AAAA,IAClB,SAAAC,IAAU;AAAA,EACR,IAAAH;AAGF,SAAA,gBAAAI;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAW,0BACTJ,EAAM,SAAS,YAAY,QAC7B;AAAA,MACA,OAAO,GAAGG,CAAO,IAAIH,EAAM,SAASC,IAAgBC,CAAe;AAAA,IAAA;AAAA,EAAA;AAGzE;AAEA,SAAwBG,EAASL,GAAc;AACvC,QAAA,EAAE,MAAAM,GAAM,MAAAC,EAAS,IAAAP;AACvB,SACG,gBAAAQ,EAAA,OAAA,EAAI,WAAU,QAAO,OAAOF,GAC3B,UAAA;AAAA,IAAA,gBAAAF,EAAC,KAAE,EAAA,WAAW,MAAMG,CAAI,IAAI;AAAA,IAC5B,gBAAAH,EAACL,GAAc,EAAA,GAAGC,GAAO;AAAA,EAC3B,EAAA,CAAA;AAEJ;ACjBA,SAAwBS,EAAiBT,GAAc;AAC/C,QAAA,EAAE,YAAAU,GAAY,UAAAC,EAAa,IAAAX;AAEjC,WAASY,IAAW;AAClB,WAAID,EAAS,QACJA,EAAS,QAEdA,EAAS,OACJA,EAAS,OAEXA,EAAS;AAAA,EAClB;AAEA,QAAME,IAAQD;AAEd,UAAQF,GAAY;AAAA,IAClB,KAAK;AACH,+BACG,OAAI,EAAA,WAAU,gBACb,UAAC,gBAAAF,EAAA,OAAA,EAAI,WAAU,aACZ,UAAA;AAAA,QAAMR,EAAA;AAAA,QACN,gBAAAI,EAAA,OAAA,EAAI,WAAU,QAAQ,UAAMS,GAAA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OAAOA,EAAQ;AAAA,YACf,SAASA,EAAQ;AAAA,YACjB,SAASA,EAAQ;AAAA,YACjB,YAAYA,EAAQ;AAAA,YACpB,kBAAkBA,EAAQ;AAAA,YAC1B,aAAaA,EAAQ;AAAA,UAAA;AAAA,QACvB;AAAA,QACCnE,EAAS,WAAW,QACnB,gBAAAP,EAACmD,EAAW,MAAX,EAAiB,UAAS5C,EAAA,WAAW,KAAK,CAAA;AAAA,QAG5Ca,MAAO,YAAYsD,EAAQ,YAC1B,gBAAA1E;AAAA,UAACqE;AAAA,UAAA;AAAA,YACC,UAAA9D;AAAA,YACA,UAAUX,EAAM;AAAA,YAChB,UAAU8E,EAAQ;AAAA,UAAA;AAAA,QACpB;AAAA,QAGDtD,MAAO,YAAY,CAACxB,EAAM,YAAY,CAAC8E,EAAQ,QAC9C,gBAAA1E,EAACc,GAAO,EAAA,SAAQ,UAAS,SAAS6D,GAChC,4BAAC,KAAE,EAAA,WAAU,cAAc,CAAA,GAC7B;AAAA,MAAA,GAEJ;AAAA,MAEF,YAAArE;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),i=require("react-bootstrap"),h=require("react"),O=require("classnames"),C=require("lodash"),V=e=>e&&typeof e=="object"&&"default"in e?e:{default:e},j=V(O);function F(e){const{activeMessage:a="Online",inactiveMessage:r="Offline",message:n="This device is"}=e;return t.jsx("div",{className:`dot-indicator small bg-${e.online?"success":"danger"}`,title:`${n} ${e.online?a:r}`})}function k(e){const{name:a,icon:r}=e;return t.jsxs("div",{className:"icon",title:a,children:[t.jsx("i",{className:`fa ${r}`}),t.jsx(F,{...e})]})}function R(e){const{headerMode:a,hardware:r}=e;function n(){return r.alias?r.alias:r.name?r.name:r.id}const d=n();switch(a){case"front":return t.jsx("div",{className:"hw-component",children:t.jsxs("div",{className:"hw-single",children:[e.widgetIcon,t.jsx("div",{className:"name",children:d}),t.jsx("div",{className:"d-inline-block",children:e.widgetContent})]})});case"none":return t.jsx("div",{className:"hw-component",children:t.jsx("div",{className:"hw-single",children:e.widgetContent})});case"state":return e.widgetState;default:return t.jsxs("div",{className:"hw-component",children:[t.jsxs("div",{className:"hw-head",children:[e.widgetIcon,t.jsx("div",{className:"name",children:t.jsx(i.Form.Label,{htmlFor:r.id,children:d})}),e.widgetState,e.hardware.errors&&e.hardware.errors.length>0&&t.jsx(i.OverlayTrigger,{trigger:"click",placement:"bottom",rootClose:!0,overlay:t.jsxs(i.Popover,{id:e.hardware.id,style:{maxWidth:500},children:[t.jsx(i.Popover.Header,{children:"Device Errors"}),t.jsxs(i.Popover.Body,{children:["There were errors with properties on this device:",t.jsx("ul",{children:e.hardware.errors.map(l=>t.jsxs("li",{children:[l.property,":",t.jsxs("span",{className:"stack-trace",children:[l.traceback,t.jsx("br",{}),l.exception]})]}))})]})]}),children:t.jsx(i.Button,{variant:"danger",size:"sm",children:t.jsx("i",{className:"fa fa-exclamation-triangle"})})})]}),t.jsx("div",{className:"hw-content",children:e.widgetContent})]})}}function q(e){const a={display:"inline-block",minWidth:""};return e.minWidth&&(a.minWidth=`${e.minWidth}em`),t.jsx("div",{style:a,children:t.jsx(i.Badge,{bg:e.variant,children:e.state})})}function A(e){const{hardware:a}=e;function r(){if(!a.online)return"OFFLINE";let d="UNKNOWN";return e.hardware.properties.state&&([d]=e.hardware.properties.state),d}const n=r();return t.jsx(q,{state:n,minWidth:6,variant:n==="READY"?"success":"warning"})}const E=h.forwardRef((e,a)=>{const r=h.useRef(null),[n,d]=h.useState(e.step),l=c=>{const g=a;if(r.current===null)return;let y=Number.parseFloat(g.current.value);const I=Number.parseFloat(r.current.value);y+=c?I:-I,g.current.value=`${y}`,e.onStep&&e.onStep({target:g.current})},{onStep:f,step:v,overlay:m,incIcon:w,decIcon:s,swapIncDec:o,onKeyDown:u,horizontalArrows:x,largeArrows:M,...b}=e,N=c=>{c.key==="ArrowUp"?(c.preventDefault(),l(!0)):c.key==="ArrowDown"?(c.preventDefault(),l(!1)):u&&u(c)};if(!e.step)return t.jsx(i.Form.Control,{ref:a,type:"number",step:"any",onKeyDown:N,...b});const S=C.map(e.steps||[e.step],c=>t.jsx("option",{value:c,children:c},c));return t.jsx("div",{className:j.default("numeric-step",{"numeric-step-large":M,"numeric-step-horizontal":x}),children:t.jsxs(i.InputGroup,{children:[t.jsx(i.Form.Control,{onKeyDown:N,ref:a,type:"number",step:"any",...b}),t.jsxs(t.Fragment,{children:[m,!m&&t.jsxs(i.InputGroup.Text,{className:"d-flex flex-column",children:[t.jsx(i.Form.Control,{ref:r,as:"select",className:"step-size",defaultValue:n,onChange:c=>d(Number.parseFloat(c.target.value)),children:S}),e.unit&&t.jsx("div",{children:e.unit}),!w&&!s&&t.jsxs(t.Fragment,{children:[t.jsx(i.Button,{className:"step step-up",disabled:e.disabled,onClick:c=>l(!0)}),t.jsx(i.Button,{className:"step step-down",disabled:e.disabled,onClick:c=>l(!1)})]})]}),s&&o&&t.jsx(i.Button,{disabled:e.disabled,onClick:c=>l(!1),children:t.jsx("i",{className:`fa fa-fw fa-${s}`})}),w&&t.jsx(i.Button,{disabled:e.disabled,onClick:c=>l(!0),children:t.jsx("i",{className:`fa fa-fw fa-${w}`})}),s&&!o&&t.jsx(i.Button,{disabled:e.disabled,onClick:c=>l(!1),children:t.jsx("i",{className:`fa fa-fw fa-${s}`})})]})]})})}),B=E;function P(e){const a=h.useRef(null),[r,n]=h.useState(!1),[d,l]=h.useState(!1);h.useEffect(()=>{a.current&&(e.hardwareValue===null?a.current.value="":a.current.value=e.hardwareValue.toString(),n(!1))},[e.hardwareValue]);function f(o){let u=o;e.precision!==void 0&&(u=Number.parseFloat(u).toFixed(e.precision)),a!=null&&a.current&&(a.current.value=u)}function v(){r&&setTimeout(()=>{f(e.hardwareValue),n(!1)},3e3)}function m(o){e.hardwareValue!==null&&(n(!0),a!=null&&a.current&&(a.current.value=o.target.value),o.target.value===e.hardwareValue.toString()&&n(!1))}function w(o){n(!1),e.onMoveRequested(o.target.value)}function s(o){switch(o.key){case"Enter":{n(!1);const u=Number.parseFloat(o.target.value),x=e.onMoveRequested(u);x&&x.catch(()=>{l(!0),setTimeout(()=>{f(e.hardwareValue),l(!1)},2e3)})}o.preventDefault(),o.stopPropagation();break;case"Esc":case"Escape":r&&(l(!1),n(!1),f(e.hardwareValue)),o.target.blur(),o.preventDefault(),o.stopPropagation();break}}return t.jsx(B,{id:e.id,className:j.default({"form-control-edited":r,"form-control-error":d,"hw-moving":e.hardwareIsMoving}),type:e.readOnly?"text":"number",ref:a,precision:e.precision,onChange:m,onBlur:v,onStep:w,onKeyDown:s,disabled:e.hardwareIsDisabled||e.readOnly||!e.hardwareIsReady,step:e.step,steps:e.steps,incIcon:e.incIcon,decIcon:e.decIcon,swapIncDec:e.swapIncDec,horizontalArrows:e.horizontalArrows,largeArrows:e.largeArrows,overlay:e.hardwareIsMoving&&!e.hardwareIsDisabled?t.jsx(i.Button,{variant:"danger",onClick:e.onAbortRequested,children:t.jsx("i",{className:"fa fa-times"})}):null})}function D(e){const a=h.useRef(null),[r,n]=h.useState(!1),[d,l]=h.useState(!1);function f(s){return e.precision!==void 0?Number.parseFloat(s).toFixed(e.precision):s}h.useEffect(()=>{var s;a.current&&(a.current.value=f((s=e.hardwareValue)==null?void 0:s.toString()),n(!1))},[e.hardwareValue,e.precision]);function v(s){const o=f(s);a!=null&&a.current&&(a.current.value=o)}function m(s){switch(s.key){case"Enter":{n(!1);const o=Number.parseFloat(s.target.value),u=e.onMoveRequested(o);u&&u.catch(()=>{l(!0),setTimeout(()=>{v(e.hardwareValue),l(!1)},2e3)}),s.preventDefault(),s.stopPropagation();break}case"Esc":case"Escape":r&&(l(!1),n(!1),v(e.hardwareValue)),s.target.blur(),s.preventDefault(),s.stopPropagation();break}}function w(s){n(!0),s.target,a!=null&&a.current&&(a.current.value=s.target.value),s.target.value===e.hardwareValue.toString()&&n(!1)}return t.jsx(i.Form.Control,{className:j.default({"form-control-edited":r,"form-control-error":d,"hw-moving":e.hardwareIsMoving}),type:"number",ref:a,onChange:w,onKeyDown:m,disabled:e.readOnly||e.hardwareIsMoving||e.hardwareIsDisabled,step:e.step})}function T(e){function a(d){return e.hardware.requestChange({property:"velocity",value:d})}function r(d){return e.hardware.requestChange({property:"acceleration",value:d})}let n="UNKNOWN";return e.hardware.properties.state&&([n]=e.hardware.properties.state),t.jsx(i.OverlayTrigger,{trigger:"click",rootClose:!0,overlay:t.jsxs(i.Popover,{id:"popid",children:[t.jsxs(i.Popover.Header,{children:[e.hardware.name," details"]}),t.jsxs(i.Popover.Body,{children:[t.jsxs(i.Form.Group,{children:[t.jsx(i.Form.Label,{children:"Velocity"}),t.jsx(D,{hardwareValue:e.hardware.properties.velocity,onMoveRequested:a,hardwareIsDisabled:e.disabled,hardwareIsReady:n==="READY",hardwareIsMoving:n==="MOVING",readOnly:e.readOnly})]}),t.jsxs(i.Form.Group,{children:[t.jsx(i.Form.Label,{children:"Acceleration"}),t.jsx(D,{hardwareValue:e.hardware.properties.acceleration,onMoveRequested:r,hardwareIsDisabled:e.disabled,hardwareIsReady:n==="READY",hardwareIsMoving:n==="MOVING",readOnly:e.readOnly})]})]})]}),children:t.jsx(i.Button,{children:t.jsx("i",{className:"fa fa-ellipsis-h"})})})}function z(e){const{hardware:a,options:r={}}=e;function n(){a.requestChange({function:"stop"})}function d(w){return a.requestChange({property:"position",value:w,function:"move"})}let l="UNKNOWN";e.hardware.properties.state&&([l]=e.hardware.properties.state);const f=t.jsx(k,{name:"Motor",icon:"fam-hardware-motor",online:a.online}),v=t.jsx(A,{hardware:a}),m=e.options?e.options.header:"top";return t.jsx(R,{hardware:a,widgetIcon:f,widgetState:v,widgetContent:t.jsxs(i.InputGroup,{children:[t.jsx(P,{id:a.id,hardwareValue:a.properties.position,hardwareIsDisabled:e.disabled,hardwareIsReady:l==="READY",hardwareIsMoving:l==="MOVING",onMoveRequested:d,onAbortRequested:n,precision:r.precision,readOnly:r.readOnly,step:r.step,steps:r.steps,incIcon:r.incicon,decIcon:r.decicon,swapIncDec:r.swapincdec,horizontalArrows:r.horizontalarrows,largeArrows:r.largearrows}),a.properties.unit&&t.jsx(i.InputGroup.Text,{children:a.properties.unit}),l!=="MOVING"&&r.extended&&t.jsx(T,{hardware:a,disabled:e.disabled,readOnly:r.readOnly}),l==="MOVING"&&!e.disabled&&!r.step&&t.jsx(i.Button,{variant:"danger",onClick:n,children:t.jsx("i",{className:"fa fa-times"})})]}),headerMode:m})}exports.MotorDefault=z;
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/hardware/TypeIcon.tsx","../src/hardware/utils/HardwareTemplate.tsx","../src/hardware/utils/State.tsx","../src/components/NumericStep.tsx","../src/hardware/utils/HardwareNumericStep.tsx","../src/hardware/utils/HardwareInputNumber.tsx","../src/hardware/MotorDefault.tsx"],"sourcesContent":["interface Props {\n online: boolean;\n activeMessage?: string;\n inactiveMessage?: string;\n message?: string;\n icon: string;\n name: string;\n}\nexport function OnlineStatus(props: Props) {\n const {\n activeMessage = 'Online',\n inactiveMessage = 'Offline',\n message = 'This device is',\n } = props;\n\n return (\n <div\n className={`dot-indicator small bg-${\n props.online ? 'success' : 'danger'\n }`}\n title={`${message} ${props.online ? activeMessage : inactiveMessage}`}\n />\n );\n}\n\nexport default function TypeIcon(props: Props) {\n const { name, icon } = props;\n return (\n <div className=\"icon\" title={name}>\n <i className={`fa ${icon}`} />\n <OnlineStatus {...props} />\n </div>\n );\n}\n","import type { ReactElement } from 'react';\nimport { Form, OverlayTrigger, Popover, Button } from 'react-bootstrap';\nimport type { Hardware } from './types';\n\ninterface Props {\n hardware: Hardware;\n headerMode?: string;\n widgetIcon: ReactElement;\n widgetState: ReactElement;\n widgetContent: ReactElement;\n}\n\n/**\n * Normalized way to compose hardware component in order to provide the same\n * kind of layout\n */\nexport default function HardwareTemplate(props: Props) {\n const { headerMode, hardware } = props;\n\n function getLabel() {\n if (hardware.alias) {\n return hardware.alias;\n }\n if (hardware.name) {\n return hardware.name;\n }\n return hardware.id;\n }\n\n const label = getLabel();\n\n switch (headerMode) {\n case 'front':\n return (\n <div className=\"hw-component\">\n <div className=\"hw-single\">\n {props.widgetIcon}\n <div className=\"name\">{label}</div>\n <div className=\"d-inline-block\">{props.widgetContent}</div>\n </div>\n </div>\n );\n case 'none':\n return (\n <div className=\"hw-component\">\n <div className=\"hw-single\">{props.widgetContent}</div>\n </div>\n );\n case 'state':\n return props.widgetState;\n // case 'top':\n default:\n return (\n <div className=\"hw-component\">\n <div className=\"hw-head\">\n {props.widgetIcon}\n <div className=\"name\">\n <Form.Label htmlFor={hardware.id}>{label}</Form.Label>\n </div>\n {props.widgetState}\n {props.hardware.errors && props.hardware.errors.length > 0 && (\n <OverlayTrigger\n trigger=\"click\"\n placement=\"bottom\"\n rootClose\n overlay={\n <Popover id={props.hardware.id} style={{ maxWidth: 500 }}>\n <Popover.Header>Device Errors</Popover.Header>\n <Popover.Body>\n There were errors with properties on this device:\n <ul>\n {props.hardware.errors.map((error) => (\n <li>\n {error.property}:\n <span className=\"stack-trace\">\n {error.traceback}\n <br />\n {error.exception}\n </span>\n </li>\n ))}\n </ul>\n </Popover.Body>\n </Popover>\n }\n >\n <Button variant=\"danger\" size=\"sm\">\n <i className=\"fa fa-exclamation-triangle\" />\n </Button>\n </OverlayTrigger>\n )}\n </div>\n <div className=\"hw-content\">{props.widgetContent}</div>\n </div>\n );\n }\n}\n","import { Badge } from 'react-bootstrap';\nimport type * as Schema from './schema';\n\n/**\n * Normalize the way to display an hardware state.\n *\n * If `minWidth` is pecified (in `em`) it ensure the widget width will stay the\n * same when the state change\n */\nexport function HardwareState(props: {\n state: string;\n variant: string;\n minWidth?: number;\n}) {\n const style = {\n display: 'inline-block',\n minWidth: '',\n };\n\n if (props.minWidth) style.minWidth = `${props.minWidth}em`;\n return (\n <div style={style}>\n <Badge bg={props.variant}>{props.state}</Badge>\n </div>\n );\n}\n\nexport function MotorState(props: { hardware: Schema.MotorSchema }) {\n const { hardware } = props;\n function getState() {\n if (!hardware.online) {\n return 'OFFLINE';\n }\n let s1 = 'UNKNOWN';\n if (props.hardware.properties.state) {\n [s1] = props.hardware.properties.state;\n }\n return s1;\n }\n const state = getState();\n return (\n <HardwareState\n state={state}\n minWidth={6}\n variant={state === 'READY' ? 'success' : 'warning'}\n />\n );\n}\n\nexport function ShutterState(props: {\n hardware: Schema.ShutterSchema;\n useReadyState?: boolean;\n}) {\n const { hardware } = props;\n function getState() {\n if (!hardware.online) {\n return 'OFFLINE';\n }\n const s = hardware.properties.state;\n if (props.useReadyState && (s === 'OPEN' || s === 'CLOSED')) {\n return 'READY';\n }\n return s;\n }\n\n const state = getState();\n\n function getVariant() {\n switch (state) {\n case 'READY':\n return 'success';\n case 'OPEN':\n return 'success';\n case 'CLOSED':\n return 'danger';\n case 'DISABLED':\n return 'secondary';\n case 'MOVING':\n case 'STANDBY':\n case 'OFFLINE':\n return 'warning';\n case 'FAULT':\n return 'fatal';\n default:\n return 'fatal';\n }\n }\n\n return <HardwareState state={state} minWidth={6} variant={getVariant()} />;\n}\n","import type {\n KeyboardEvent,\n ChangeEvent,\n MutableRefObject,\n ReactChild,\n} from 'react';\nimport { forwardRef, useRef, useState } from 'react';\nimport { map } from 'lodash';\n\nimport { Form, Button, InputGroup } from 'react-bootstrap';\nimport classNames from 'classnames';\n\ninterface Props {\n step?: number;\n steps?: number[];\n disabled: boolean;\n id?: string;\n unit?: string;\n overlay?: ReactChild | null;\n incIcon?: string;\n decIcon?: string;\n swapIncDec?: boolean;\n className?: string;\n type?: 'number' | 'text';\n precision?: number;\n horizontalArrows?: boolean;\n largeArrows?: boolean;\n onBlur: () => void;\n onChange: (e: ChangeEvent<HTMLInputElement>) => void;\n onStep: (params: { target: HTMLInputElement }) => void;\n onKeyDown?: (e: KeyboardEvent<HTMLInputElement>) => void;\n}\n\nconst NumericStep = forwardRef<HTMLInputElement, Props>((props, ref) => {\n const stepSizeRef = useRef<HTMLSelectElement>(null);\n const [currentStep, setCurrentStep] = useState(props.step);\n const onStep = (up: boolean) => {\n // FIXME: Would be good to remove that cast\n const ref2 = ref as MutableRefObject<HTMLInputElement>;\n if (stepSizeRef.current === null) {\n return;\n }\n let val = Number.parseFloat(ref2.current.value);\n const stepSize = Number.parseFloat(stepSizeRef.current.value);\n val += up ? stepSize : -stepSize;\n ref2.current.value = `${val}`;\n\n if (props.onStep) {\n props.onStep({\n target: ref2.current,\n });\n }\n };\n\n const {\n onStep: onStepProp,\n step,\n overlay,\n incIcon,\n decIcon,\n swapIncDec,\n onKeyDown,\n horizontalArrows,\n largeArrows,\n ...rest\n } = props;\n\n const onKeyDown2 = (e: KeyboardEvent<HTMLInputElement>) => {\n if (e.key === 'ArrowUp') {\n e.preventDefault();\n onStep(true);\n } else if (e.key === 'ArrowDown') {\n e.preventDefault();\n onStep(false);\n } else if (onKeyDown) {\n onKeyDown(e);\n }\n };\n\n if (!props.step) {\n return (\n <Form.Control\n ref={ref}\n type=\"number\"\n step=\"any\"\n onKeyDown={onKeyDown2}\n {...rest}\n />\n );\n }\n\n const steps = map(props.steps || [props.step], (s) => (\n <option value={s} key={s}>\n {s}\n </option>\n ));\n\n return (\n <div\n className={classNames('numeric-step', {\n 'numeric-step-large': largeArrows,\n 'numeric-step-horizontal': horizontalArrows,\n })}\n >\n <InputGroup>\n <Form.Control\n onKeyDown={onKeyDown2}\n ref={ref}\n type=\"number\"\n step=\"any\"\n {...rest}\n />\n <>\n {overlay}\n {!overlay && (\n <InputGroup.Text className=\"d-flex flex-column\">\n <Form.Control\n ref={stepSizeRef}\n as=\"select\"\n className=\"step-size\"\n defaultValue={currentStep}\n onChange={(e) =>\n setCurrentStep(Number.parseFloat(e.target.value))\n }\n >\n {steps}\n </Form.Control>\n {props.unit && <div>{props.unit}</div>}\n {!incIcon && !decIcon && (\n <>\n <Button\n className=\"step step-up\"\n disabled={props.disabled}\n onClick={(e) => onStep(true)}\n />\n <Button\n className=\"step step-down\"\n disabled={props.disabled}\n onClick={(e) => onStep(false)}\n />\n </>\n )}\n </InputGroup.Text>\n )}\n {decIcon && swapIncDec && (\n <Button disabled={props.disabled} onClick={(e) => onStep(false)}>\n <i className={`fa fa-fw fa-${decIcon}`} />\n </Button>\n )}\n {incIcon && (\n <Button disabled={props.disabled} onClick={(e) => onStep(true)}>\n <i className={`fa fa-fw fa-${incIcon}`} />\n </Button>\n )}\n {decIcon && !swapIncDec && (\n <Button disabled={props.disabled} onClick={(e) => onStep(false)}>\n <i className={`fa fa-fw fa-${decIcon}`} />\n </Button>\n )}\n </>\n </InputGroup>\n </div>\n );\n});\n\nexport default NumericStep;\n","import { useRef, useState, useEffect } from 'react';\nimport type { KeyboardEvent, ChangeEvent } from 'react';\nimport classNames from 'classnames';\nimport { Button, Form, OverlayTrigger, InputGroup } from 'react-bootstrap';\nimport NumericStep from '../../components/NumericStep';\n\n/**\n * NumericStep handled hardware properties.\n *\n * Input related to hardware have specificities because the hardware state can\n * change during the user interaction.\n */\nexport default function HardwareNumericStep(props: {\n hardwareValue: number | null;\n hardwareIsDisabled: boolean;\n hardwareIsMoving: boolean;\n hardwareIsReady: boolean;\n onMoveRequested: (value: number) => Promise<void> | null;\n onAbortRequested: () => void;\n /** Default step size to use for up / down arrows */\n step?: number;\n /** Array of selectable step sizes */\n steps?: number[];\n /** Number of decimals to show */\n precision?: number;\n /** Whether this widget is read only */\n readOnly?: boolean;\n /** Specify a fontawesome to inc the value */\n incIcon?: string;\n /** Specify a fontawesome to dec the value */\n decIcon?: string;\n /** If true inc and dec icon are swapped */\n swapIncDec?: boolean;\n /** Show the step arrows horizontally instead of vertically */\n horizontalArrows?: boolean;\n /** Show large step arrows */\n largeArrows?: boolean;\n /** Identifier passed to the input element */\n id?: string;\n}) {\n const valueRef = useRef<HTMLInputElement>(null);\n const [edited, setEdited] = useState(false);\n const [error, setError] = useState(false);\n useEffect(() => {\n if (valueRef.current) {\n if (props.hardwareValue === null) {\n valueRef.current.value = '';\n } else {\n valueRef.current.value = props.hardwareValue.toString();\n }\n setEdited(false);\n }\n }, [props.hardwareValue]);\n\n function updateRef(value: any) {\n let newValue = value;\n if (props.precision !== undefined) {\n newValue = Number.parseFloat(newValue).toFixed(props.precision);\n }\n if (valueRef?.current) {\n valueRef.current.value = newValue;\n }\n }\n\n function onBlur() {\n if (edited) {\n setTimeout(() => {\n updateRef(props.hardwareValue);\n setEdited(false);\n }, 3000);\n }\n }\n\n function onChange(e: ChangeEvent<HTMLInputElement>) {\n if (props.hardwareValue === null) {\n return;\n }\n setEdited(true);\n if (valueRef?.current) {\n valueRef.current.value = e.target.value;\n }\n if (e.target.value === props.hardwareValue.toString()) {\n setEdited(false);\n }\n }\n\n function onStep(e: any) {\n setEdited(false);\n void props.onMoveRequested(e.target.value);\n }\n\n function onKeyDown(e: KeyboardEvent<HTMLInputElement>) {\n switch (e.key) {\n case 'Enter':\n {\n setEdited(false);\n // @ts-expect-error\n const value: number = Number.parseFloat(e.target.value);\n const promise = props.onMoveRequested(value);\n if (promise) {\n promise.catch(() => {\n setError(true);\n setTimeout(() => {\n updateRef(props.hardwareValue);\n setError(false);\n }, 2000);\n });\n }\n }\n e.preventDefault();\n e.stopPropagation();\n break;\n case 'Esc': // IE/Edge specific value\n case 'Escape':\n if (edited) {\n setError(false);\n setEdited(false);\n updateRef(props.hardwareValue);\n }\n // @ts-expect-error\n e.target.blur();\n e.preventDefault();\n e.stopPropagation();\n break;\n }\n }\n\n return (\n <NumericStep\n id={props.id}\n className={classNames({\n 'form-control-edited': edited,\n 'form-control-error': error,\n 'hw-moving': props.hardwareIsMoving,\n })}\n type={props.readOnly ? 'text' : 'number'}\n ref={valueRef}\n precision={props.precision}\n onChange={onChange}\n onBlur={onBlur}\n onStep={onStep}\n onKeyDown={onKeyDown}\n disabled={\n props.hardwareIsDisabled || props.readOnly || !props.hardwareIsReady\n }\n step={props.step}\n steps={props.steps}\n incIcon={props.incIcon}\n decIcon={props.decIcon}\n swapIncDec={props.swapIncDec}\n horizontalArrows={props.horizontalArrows}\n largeArrows={props.largeArrows}\n overlay={\n props.hardwareIsMoving && !props.hardwareIsDisabled ? (\n <Button variant=\"danger\" onClick={props.onAbortRequested}>\n <i className=\"fa fa-times\" />\n </Button>\n ) : null\n }\n />\n );\n}\n","import { useEffect, useRef, useState } from 'react';\nimport type { KeyboardEvent, ChangeEvent } from 'react';\nimport { Form } from 'react-bootstrap';\nimport classNames from 'classnames';\n\n/**\n * Input number synchronized with a hardware.\n *\n * Input related to hardware have specificities because the hardware state can\n * change during the user interaction.\n *\n * TODO: Maybe normalize `precision` and `step` together\n */\nexport default function HardwareInputNumber(props: {\n hardwareValue: number;\n hardwareIsDisabled: boolean;\n hardwareIsMoving?: boolean;\n hardwareIsReady?: boolean;\n onMoveRequested: (value: number) => Promise<void> | null;\n onAbortRequested?: () => void;\n readOnly?: boolean;\n precision?: number;\n step?: number;\n}) {\n const valueRef = useRef<HTMLInputElement>(null);\n const [edited, setEdited] = useState(false);\n const [error, setError] = useState(false);\n\n function normalizeNumber(value: string): string {\n if (props.precision !== undefined) {\n return Number.parseFloat(value).toFixed(props.precision);\n }\n return value;\n }\n\n useEffect(() => {\n if (valueRef.current) {\n valueRef.current.value = normalizeNumber(props.hardwareValue?.toString());\n setEdited(false);\n }\n }, [props.hardwareValue, props.precision]);\n\n function updateRef(value: any) {\n const newValue = normalizeNumber(value);\n if (valueRef?.current) {\n valueRef.current.value = newValue;\n }\n }\n\n function onKeyDown(e: KeyboardEvent<HTMLInputElement>) {\n switch (e.key) {\n case 'Enter': {\n setEdited(false);\n // @ts-expect-error\n const value: number = Number.parseFloat(e.target.value);\n const promise = props.onMoveRequested(value);\n if (promise) {\n promise.catch(() => {\n setError(true);\n setTimeout(() => {\n updateRef(props.hardwareValue);\n setError(false);\n }, 2000);\n });\n }\n e.preventDefault();\n e.stopPropagation();\n break;\n }\n case 'Esc': // IE/Edge specific value\n case 'Escape':\n if (edited) {\n setError(false);\n setEdited(false);\n updateRef(props.hardwareValue);\n }\n // @ts-expect-error\n e.target.blur();\n e.preventDefault();\n e.stopPropagation();\n break;\n }\n }\n\n function onChange(e: ChangeEvent<HTMLInputElement>) {\n setEdited(true);\n const { name } = e.target;\n if (valueRef?.current) {\n valueRef.current.value = e.target.value;\n }\n if (e.target.value === props.hardwareValue.toString()) {\n setEdited(false);\n }\n }\n\n return (\n <Form.Control\n className={classNames({\n 'form-control-edited': edited,\n 'form-control-error': error,\n 'hw-moving': props.hardwareIsMoving,\n })}\n type=\"number\"\n ref={valueRef}\n onChange={onChange}\n onKeyDown={onKeyDown}\n disabled={\n props.readOnly || props.hardwareIsMoving || props.hardwareIsDisabled\n }\n step={props.step}\n />\n );\n}\n","import {\n Button,\n Form,\n OverlayTrigger,\n InputGroup,\n Popover,\n} from 'react-bootstrap';\n\nimport TypeIcon from './TypeIcon';\nimport HardwareTemplate from './utils/HardwareTemplate';\nimport { MotorState } from './utils/State';\nimport HardwareNumericStep from './utils/HardwareNumericStep';\nimport HardwareInputNumber from './utils/HardwareInputNumber';\nimport type { MotorSchema } from './utils/schema';\nimport type {\n HardwareWidgetProps,\n HardwareWidgetOptions,\n EditableHardware,\n} from './utils/types';\n\ninterface MotorOverlayProps {\n hardware: EditableHardware<MotorSchema>;\n disabled: boolean;\n readOnly?: boolean;\n}\n\nfunction MotorOverlay(props: MotorOverlayProps) {\n function onMoveVelocityRequested(target: number) {\n return props.hardware.requestChange({\n property: 'velocity',\n value: target,\n });\n }\n\n function onMoveAccelerationRequested(target: number) {\n return props.hardware.requestChange({\n property: 'acceleration',\n value: target,\n });\n }\n\n let s1 = 'UNKNOWN';\n if (props.hardware.properties.state) {\n [s1] = props.hardware.properties.state;\n }\n\n return (\n <OverlayTrigger\n trigger=\"click\"\n rootClose\n overlay={\n <Popover id=\"popid\">\n <Popover.Header>{props.hardware.name} details</Popover.Header>\n <Popover.Body>\n <Form.Group>\n <Form.Label>Velocity</Form.Label>\n <HardwareInputNumber\n hardwareValue={props.hardware.properties.velocity}\n onMoveRequested={onMoveVelocityRequested}\n hardwareIsDisabled={props.disabled}\n hardwareIsReady={s1 === 'READY'}\n hardwareIsMoving={s1 === 'MOVING'}\n readOnly={props.readOnly}\n />\n </Form.Group>\n <Form.Group>\n <Form.Label>Acceleration</Form.Label>\n <HardwareInputNumber\n hardwareValue={props.hardware.properties.acceleration}\n onMoveRequested={onMoveAccelerationRequested}\n hardwareIsDisabled={props.disabled}\n hardwareIsReady={s1 === 'READY'}\n hardwareIsMoving={s1 === 'MOVING'}\n readOnly={props.readOnly}\n />\n </Form.Group>\n </Popover.Body>\n </Popover>\n }\n >\n <Button>\n <i className=\"fa fa-ellipsis-h\" />\n </Button>\n </OverlayTrigger>\n );\n}\n\nexport interface MotorDefaultOptions extends HardwareWidgetOptions {\n /** Default step size to use for up / down arrows */\n step?: number;\n /** Array of selectable step sizes */\n steps?: number[];\n /** Number of decimals to show */\n precision?: number;\n /** Whether to show popup to configure extended parameters */\n extended?: boolean;\n /** Whether this widget is read only */\n readOnly?: boolean;\n /** Kind of header displayed */\n header?: string;\n /** Specify a fontawesome to inc the value */\n incicon?: string;\n /** Specify a fontawesome to dec the value */\n decicon?: string;\n /** If true inc and dec icon are swapped */\n swapincdec?: boolean;\n /** Show the step arrows horizontally instead of vertically */\n horizontalarrows?: boolean;\n /** Show large step arrows */\n largearrows?: boolean;\n}\n\n/**\n * The default motor widget\n */\nexport default function MotorDefault(\n props: HardwareWidgetProps<MotorSchema, MotorDefaultOptions>\n) {\n const { hardware, options = {} } = props;\n function onAbortRequested() {\n void hardware.requestChange({\n function: 'stop',\n });\n }\n\n function onMovePositionRequested(target: number) {\n return hardware.requestChange({\n property: 'position',\n value: target,\n function: 'move',\n });\n }\n\n let s1 = 'UNKNOWN';\n if (props.hardware.properties.state) {\n [s1] = props.hardware.properties.state;\n }\n\n const widgetIcon = (\n <TypeIcon name=\"Motor\" icon=\"fam-hardware-motor\" online={hardware.online} />\n );\n\n const widgetState = <MotorState hardware={hardware} />;\n\n const headerMode = props.options ? props.options.header : 'top';\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={\n <InputGroup>\n <HardwareNumericStep\n id={hardware.id}\n hardwareValue={hardware.properties.position}\n hardwareIsDisabled={props.disabled}\n hardwareIsReady={s1 === 'READY'}\n hardwareIsMoving={s1 === 'MOVING'}\n onMoveRequested={onMovePositionRequested}\n onAbortRequested={onAbortRequested}\n precision={options.precision}\n readOnly={options.readOnly}\n step={options.step}\n steps={options.steps}\n incIcon={options.incicon}\n decIcon={options.decicon}\n swapIncDec={options.swapincdec}\n horizontalArrows={options.horizontalarrows}\n largeArrows={options.largearrows}\n />\n {hardware.properties.unit && (\n <InputGroup.Text>{hardware.properties.unit}</InputGroup.Text>\n )}\n\n {s1 !== 'MOVING' && options.extended && (\n <MotorOverlay\n hardware={hardware}\n disabled={props.disabled}\n readOnly={options.readOnly}\n />\n )}\n\n {s1 === 'MOVING' && !props.disabled && !options.step && (\n <Button variant=\"danger\" onClick={onAbortRequested}>\n <i className=\"fa fa-times\" />\n </Button>\n )}\n </InputGroup>\n }\n headerMode={headerMode}\n />\n );\n}\n"],"names":["OnlineStatus","props","activeMessage","inactiveMessage","message","jsx","TypeIcon","name","icon","jsxs","HardwareTemplate","headerMode","hardware","getLabel","label","Form","OverlayTrigger","Popover","error","Button","HardwareState","style","Badge","MotorState","getState","s1","state","NumericStep","forwardRef","ref","stepSizeRef","useRef","currentStep","setCurrentStep","useState","onStep","up","ref2","val","stepSize","onStepProp","step","overlay","incIcon","decIcon","swapIncDec","onKeyDown","horizontalArrows","largeArrows","rest","onKeyDown2","e","steps","map","s","classNames","InputGroup","Fragment","NumericStep$1","HardwareNumericStep","valueRef","edited","setEdited","setError","useEffect","updateRef","value","newValue","onBlur","onChange","promise","HardwareInputNumber","normalizeNumber","_a","MotorOverlay","onMoveVelocityRequested","target","onMoveAccelerationRequested","MotorDefault","options","onAbortRequested","onMovePositionRequested","widgetIcon","widgetState"],"mappings":"gRAQO,SAASA,EAAaC,EAAc,CACnC,KAAA,CACJ,cAAAC,EAAgB,SAChB,gBAAAC,EAAkB,UAClB,QAAAC,EAAU,gBACR,EAAAH,EAGF,OAAAI,EAAA,IAAC,MAAA,CACC,UAAW,0BACTJ,EAAM,OAAS,UAAY,QAC7B,GACA,MAAO,GAAGG,CAAO,IAAIH,EAAM,OAASC,EAAgBC,CAAe,EAAA,CAAA,CAGzE,CAEA,SAAwBG,EAASL,EAAc,CACvC,KAAA,CAAE,KAAAM,EAAM,KAAAC,CAAS,EAAAP,EACvB,OACGQ,EAAAA,KAAA,MAAA,CAAI,UAAU,OAAO,MAAOF,EAC3B,SAAA,CAAAF,EAAA,IAAC,IAAE,CAAA,UAAW,MAAMG,CAAI,GAAI,EAC5BH,EAAAA,IAACL,EAAc,CAAA,GAAGC,EAAO,CAC3B,CAAA,CAAA,CAEJ,CCjBA,SAAwBS,EAAiBT,EAAc,CAC/C,KAAA,CAAE,WAAAU,EAAY,SAAAC,CAAa,EAAAX,EAEjC,SAASY,GAAW,CAClB,OAAID,EAAS,MACJA,EAAS,MAEdA,EAAS,KACJA,EAAS,KAEXA,EAAS,EAClB,CAEA,MAAME,EAAQD,IAEd,OAAQF,EAAY,CAClB,IAAK,QACH,aACG,MAAI,CAAA,UAAU,eACb,SAACF,EAAA,KAAA,MAAA,CAAI,UAAU,YACZ,SAAA,CAAMR,EAAA,WACNI,EAAA,IAAA,MAAA,CAAI,UAAU,OAAQ,SAAMS,EAAA,EAC5BT,EAAA,IAAA,MAAA,CAAI,UAAU,iBAAkB,WAAM,cAAc,CAAA,CACvD,CAAA,CACF,CAAA,EAEJ,IAAK,OAED,OAAAA,EAAAA,IAAC,MAAI,CAAA,UAAU,eACb,SAAAA,MAAC,OAAI,UAAU,YAAa,SAAMJ,EAAA,aAAA,CAAc,CAClD,CAAA,EAEJ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A,IAAAkB,EAAA,CAAW,SAAAX,CAAoB,CAAA,EAE9CD,EAAaV,EAAM,QAAUA,EAAM,QAAQ,OAAS,MAGxD,OAAAI,EAAA,IAACK,EAAA,CACC,SAAAE,EACA,WAAAsE,EACA,YAAAC,EACA,qBACG3B,aACC,CAAA,SAAA,CAAAnD,EAAA,IAACsD,EAAA,CACC,GAAI/C,EAAS,GACb,cAAeA,EAAS,WAAW,SACnC,mBAAoBX,EAAM,SAC1B,gBAAiBwB,IAAO,QACxB,iBAAkBA,IAAO,SACzB,gBAAiBwD,EACjB,iBAAAD,EACA,UAAWD,EAAQ,UACnB,SAAUA,EAAQ,SAClB,KAAMA,EAAQ,KACd,MAAOA,EAAQ,MACf,QAASA,EAAQ,QACjB,QAASA,EAAQ,QACjB,WAAYA,EAAQ,WACpB,iBAAkBA,EAAQ,iBAC1B,YAAaA,EAAQ,WAAA,CACvB,EACCnE,EAAS,WAAW,MACnBP,EAAAA,IAACmD,aAAW,KAAX,CAAiB,SAAS5C,EAAA,WAAW,IAAK,CAAA,EAG5Ca,IAAO,UAAYsD,EAAQ,UAC1B1E,EAAA,IAACqE,EAAA,CACC,SAAA9D,EACA,SAAUX,EAAM,SAChB,SAAU8E,EAAQ,QAAA,CACpB,EAGDtD,IAAO,UAAY,CAACxB,EAAM,UAAY,CAAC8E,EAAQ,MAC9C1E,MAACc,EAAAA,OAAO,CAAA,QAAQ,SAAS,QAAS6D,EAChC,eAAC,IAAE,CAAA,UAAU,aAAc,CAAA,EAC7B,CAAA,EAEJ,EAEF,WAAArE,CAAA,CAAA,CAGN"}
|
package/package.json
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@esrf/daiquiri-lib",
|
|
3
|
+
"version": "0.0.1-alpha.1",
|
|
4
|
+
"sideEffects": false,
|
|
5
|
+
"files": [
|
|
6
|
+
"dist"
|
|
7
|
+
],
|
|
8
|
+
"main": "dist/index.js",
|
|
9
|
+
"peerDependencies": {
|
|
10
|
+
"react": ">=17",
|
|
11
|
+
"react-dom": ">=17",
|
|
12
|
+
"typescript": ">=4.5"
|
|
13
|
+
},
|
|
14
|
+
"peerDependenciesMeta": {
|
|
15
|
+
"typescript": {
|
|
16
|
+
"optional": true
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"bootstrap": "5.3.2",
|
|
21
|
+
"classnames": "2.3.1",
|
|
22
|
+
"debug": "4.3.4",
|
|
23
|
+
"lodash": "4.17.21",
|
|
24
|
+
"react-bootstrap": "2.9.1"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@rollup/plugin-alias": "5.0.0",
|
|
28
|
+
"@types/react": "17.0.39",
|
|
29
|
+
"@types/react-dom": "17.0.11",
|
|
30
|
+
"@vitejs/plugin-react": "4.0.4",
|
|
31
|
+
"concat": "1.0.3",
|
|
32
|
+
"eslint": "8.18.0",
|
|
33
|
+
"eslint-config-galex": "4.1.8",
|
|
34
|
+
"npm-run-all": "4.1.5",
|
|
35
|
+
"react": "17.0.2",
|
|
36
|
+
"react-dom": "17.0.2",
|
|
37
|
+
"rimraf": "5.0.1",
|
|
38
|
+
"rollup": "3.29.1",
|
|
39
|
+
"rollup-plugin-dts": "6.0.2",
|
|
40
|
+
"sass": "1.54.4",
|
|
41
|
+
"sass-loader": "13.2.0",
|
|
42
|
+
"style-loader": "3.3.1",
|
|
43
|
+
"typescript": "4.5.5",
|
|
44
|
+
"vite": "4.4.9"
|
|
45
|
+
},
|
|
46
|
+
"browserslist": {
|
|
47
|
+
"production": [
|
|
48
|
+
">0.5%",
|
|
49
|
+
"not dead",
|
|
50
|
+
"not op_mini all"
|
|
51
|
+
],
|
|
52
|
+
"development": [
|
|
53
|
+
"last 1 chrome version",
|
|
54
|
+
"last 1 firefox version",
|
|
55
|
+
"last 1 safari version"
|
|
56
|
+
]
|
|
57
|
+
},
|
|
58
|
+
"repository": {
|
|
59
|
+
"type": "git",
|
|
60
|
+
"url": "https://gitlab.esrf.fr/ui/daiquiri-ui/lib"
|
|
61
|
+
},
|
|
62
|
+
"author": "ESRF",
|
|
63
|
+
"license": "MIT",
|
|
64
|
+
"description": "",
|
|
65
|
+
"scripts": {
|
|
66
|
+
"build": "vite build && run-p build:*",
|
|
67
|
+
"build:dts": "tsc --project tsconfig.build.json && rollup -c",
|
|
68
|
+
"lint:eslint": "eslint \"**/*.{js,cjs,ts,tsx}\" --max-warnings=0",
|
|
69
|
+
"lint:tsc": "tsc",
|
|
70
|
+
"test": "jest",
|
|
71
|
+
"analyze": "pnpm dlx source-map-explorer dist/index.js --no-border-checks"
|
|
72
|
+
},
|
|
73
|
+
"module": "dist/index.esm.js",
|
|
74
|
+
"types": "dist/index.d.ts",
|
|
75
|
+
"exports": {
|
|
76
|
+
"./styles.css": "./dist/styles.css",
|
|
77
|
+
".": {
|
|
78
|
+
"types": "./dist/index.d.ts",
|
|
79
|
+
"import": "./dist/index.esm.js",
|
|
80
|
+
"default": "./dist/index.js"
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
package/src/index.ts
ADDED