@esrf/daiquiri-lib 0.0.1-alpha.2 → 0.0.2-alpha.2
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 +254 -1
- package/dist/index.esm.js +670 -198
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +25 -22
- package/src/index.ts +26 -0
- package/src/scss/_base.scss +0 -0
- package/src/scss/_indicator.scss +23 -0
- package/src/scss/_numericstep.scss +153 -0
- package/src/scss/main.scss +5 -2
- package/LICENSE +0 -21
- package/src/scss/_lib.scss +0 -9
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import * as react from 'react';
|
|
3
|
+
import { ReactElement, PropsWithChildren, ReactChild, ChangeEvent, KeyboardEvent } from 'react';
|
|
4
|
+
|
|
2
5
|
interface HardwareError {
|
|
3
6
|
property: string;
|
|
4
7
|
exception: string;
|
|
@@ -87,6 +90,22 @@ interface HardwareWidgetProps<H extends Hardware = Hardware, O extends HardwareW
|
|
|
87
90
|
operator: boolean;
|
|
88
91
|
}
|
|
89
92
|
|
|
93
|
+
type types_d_EditableHardware<H extends Hardware = Hardware> = EditableHardware<H>;
|
|
94
|
+
type types_d_Hardware = Hardware;
|
|
95
|
+
type types_d_HardwareChangeAction = HardwareChangeAction;
|
|
96
|
+
type types_d_HardwareChangeHandler = HardwareChangeHandler;
|
|
97
|
+
type types_d_HardwareSchemaDescription = HardwareSchemaDescription;
|
|
98
|
+
type types_d_HardwareWidgetOptions = HardwareWidgetOptions;
|
|
99
|
+
type types_d_HardwareWidgetProps<H extends Hardware = Hardware, O extends HardwareWidgetOptions = HardwareWidgetOptions> = HardwareWidgetProps<H, O>;
|
|
100
|
+
declare namespace types_d {
|
|
101
|
+
export type { types_d_EditableHardware as EditableHardware, types_d_Hardware as Hardware, types_d_HardwareChangeAction as HardwareChangeAction, types_d_HardwareChangeHandler as HardwareChangeHandler, types_d_HardwareSchemaDescription as HardwareSchemaDescription, types_d_HardwareWidgetOptions as HardwareWidgetOptions, types_d_HardwareWidgetProps as HardwareWidgetProps };
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
interface GenericSchema extends Hardware {
|
|
105
|
+
properties: {
|
|
106
|
+
state: string;
|
|
107
|
+
};
|
|
108
|
+
}
|
|
90
109
|
interface MotorSchema extends Hardware {
|
|
91
110
|
properties: {
|
|
92
111
|
position: number;
|
|
@@ -101,6 +120,64 @@ interface MotorSchema extends Hardware {
|
|
|
101
120
|
sign: number;
|
|
102
121
|
};
|
|
103
122
|
}
|
|
123
|
+
interface MultipositionSchema extends Hardware {
|
|
124
|
+
properties: {
|
|
125
|
+
position: string;
|
|
126
|
+
positions: {
|
|
127
|
+
position: string;
|
|
128
|
+
description: string;
|
|
129
|
+
target: {
|
|
130
|
+
axis: string;
|
|
131
|
+
destination: number;
|
|
132
|
+
tolerance: number;
|
|
133
|
+
}[];
|
|
134
|
+
}[];
|
|
135
|
+
state: string;
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
interface ShutterSchema extends Hardware {
|
|
139
|
+
properties: {
|
|
140
|
+
state: string;
|
|
141
|
+
status: string;
|
|
142
|
+
valid: boolean;
|
|
143
|
+
open_text: string;
|
|
144
|
+
closed_text: string;
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
interface FrontendSchema extends Hardware {
|
|
148
|
+
properties: {
|
|
149
|
+
state: string;
|
|
150
|
+
status: string;
|
|
151
|
+
automatic: boolean;
|
|
152
|
+
frontend: string;
|
|
153
|
+
current: number;
|
|
154
|
+
refill: number;
|
|
155
|
+
mode: string;
|
|
156
|
+
message: string;
|
|
157
|
+
feitlk: string;
|
|
158
|
+
pssitlk: string;
|
|
159
|
+
expitlk: string;
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
type schema_d_FrontendSchema = FrontendSchema;
|
|
164
|
+
type schema_d_GenericSchema = GenericSchema;
|
|
165
|
+
type schema_d_MotorSchema = MotorSchema;
|
|
166
|
+
type schema_d_MultipositionSchema = MultipositionSchema;
|
|
167
|
+
type schema_d_ShutterSchema = ShutterSchema;
|
|
168
|
+
declare namespace schema_d {
|
|
169
|
+
export type { schema_d_FrontendSchema as FrontendSchema, schema_d_GenericSchema as GenericSchema, schema_d_MotorSchema as MotorSchema, schema_d_MultipositionSchema as MultipositionSchema, schema_d_ShutterSchema as ShutterSchema };
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
declare function Frontend(props: HardwareWidgetProps<FrontendSchema>): JSX.Element;
|
|
173
|
+
|
|
174
|
+
interface InfoOptions extends HardwareWidgetOptions {
|
|
175
|
+
/** The property */
|
|
176
|
+
property?: string;
|
|
177
|
+
/** Unit for the property */
|
|
178
|
+
unit?: string;
|
|
179
|
+
}
|
|
180
|
+
declare function Info(props: HardwareWidgetProps<Hardware, InfoOptions>): JSX.Element;
|
|
104
181
|
|
|
105
182
|
interface MotorDefaultOptions extends HardwareWidgetOptions {
|
|
106
183
|
/** Default step size to use for up / down arrows */
|
|
@@ -131,4 +208,180 @@ interface MotorDefaultOptions extends HardwareWidgetOptions {
|
|
|
131
208
|
*/
|
|
132
209
|
declare function MotorDefault(props: HardwareWidgetProps<MotorSchema, MotorDefaultOptions>): JSX.Element;
|
|
133
210
|
|
|
134
|
-
|
|
211
|
+
declare function Multiposition(props: HardwareWidgetProps<MultipositionSchema>): JSX.Element;
|
|
212
|
+
|
|
213
|
+
interface NoObjectProps {
|
|
214
|
+
id: string;
|
|
215
|
+
name?: string;
|
|
216
|
+
options: {
|
|
217
|
+
header?: string;
|
|
218
|
+
emptyifnone?: boolean;
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
declare function NoObject(props: NoObjectProps): JSX.Element;
|
|
222
|
+
|
|
223
|
+
interface PropertyWidgetOptions extends HardwareWidgetOptions {
|
|
224
|
+
header?: string;
|
|
225
|
+
property?: string;
|
|
226
|
+
unit?: string;
|
|
227
|
+
}
|
|
228
|
+
declare function Property(props: HardwareWidgetProps<GenericSchema, PropertyWidgetOptions>): JSX.Element;
|
|
229
|
+
|
|
230
|
+
declare function ShutterDefault(props: HardwareWidgetProps<ShutterSchema, HardwareWidgetOptions>): JSX.Element;
|
|
231
|
+
|
|
232
|
+
interface Props$3 {
|
|
233
|
+
online: boolean;
|
|
234
|
+
activeMessage?: string;
|
|
235
|
+
inactiveMessage?: string;
|
|
236
|
+
message?: string;
|
|
237
|
+
icon: string;
|
|
238
|
+
name: string;
|
|
239
|
+
}
|
|
240
|
+
declare function TypeIcon(props: Props$3): JSX.Element;
|
|
241
|
+
|
|
242
|
+
interface Props$2 {
|
|
243
|
+
hardware: Hardware;
|
|
244
|
+
headerMode?: string;
|
|
245
|
+
widgetIcon: ReactElement;
|
|
246
|
+
widgetState: ReactElement;
|
|
247
|
+
widgetContent: ReactElement;
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Normalized way to compose hardware component in order to provide the same
|
|
251
|
+
* kind of layout
|
|
252
|
+
*/
|
|
253
|
+
declare function HardwareTemplate(props: Props$2): JSX.Element;
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Input number synchronized with a hardware.
|
|
257
|
+
*
|
|
258
|
+
* Input related to hardware have specificities because the hardware state can
|
|
259
|
+
* change during the user interaction.
|
|
260
|
+
*
|
|
261
|
+
* TODO: Maybe normalize `precision` and `step` together
|
|
262
|
+
*/
|
|
263
|
+
declare function HardwareInputNumber(props: {
|
|
264
|
+
hardwareValue: number;
|
|
265
|
+
hardwareIsDisabled: boolean;
|
|
266
|
+
hardwareIsMoving?: boolean;
|
|
267
|
+
hardwareIsReady?: boolean;
|
|
268
|
+
onMoveRequested: (value: number) => Promise<void> | null;
|
|
269
|
+
onAbortRequested?: () => void;
|
|
270
|
+
readOnly?: boolean;
|
|
271
|
+
precision?: number;
|
|
272
|
+
step?: number;
|
|
273
|
+
}): JSX.Element;
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* NumericStep handled hardware properties.
|
|
277
|
+
*
|
|
278
|
+
* Input related to hardware have specificities because the hardware state can
|
|
279
|
+
* change during the user interaction.
|
|
280
|
+
*/
|
|
281
|
+
declare function HardwareNumericStep(props: {
|
|
282
|
+
hardwareValue: number | null;
|
|
283
|
+
hardwareIsDisabled: boolean;
|
|
284
|
+
hardwareIsMoving: boolean;
|
|
285
|
+
hardwareIsReady: boolean;
|
|
286
|
+
onMoveRequested: (value: number) => Promise<void> | null;
|
|
287
|
+
onAbortRequested: () => void;
|
|
288
|
+
/** Default step size to use for up / down arrows */
|
|
289
|
+
step?: number;
|
|
290
|
+
/** Array of selectable step sizes */
|
|
291
|
+
steps?: number[];
|
|
292
|
+
/** Number of decimals to show */
|
|
293
|
+
precision?: number;
|
|
294
|
+
/** Whether this widget is read only */
|
|
295
|
+
readOnly?: boolean;
|
|
296
|
+
/** Specify a fontawesome to inc the value */
|
|
297
|
+
incIcon?: string;
|
|
298
|
+
/** Specify a fontawesome to dec the value */
|
|
299
|
+
decIcon?: string;
|
|
300
|
+
/** If true inc and dec icon are swapped */
|
|
301
|
+
swapIncDec?: boolean;
|
|
302
|
+
/** Show the step arrows horizontally instead of vertically */
|
|
303
|
+
horizontalArrows?: boolean;
|
|
304
|
+
/** Show large step arrows */
|
|
305
|
+
largeArrows?: boolean;
|
|
306
|
+
/** Identifier passed to the input element */
|
|
307
|
+
id?: string;
|
|
308
|
+
}): JSX.Element;
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* Normalize the way to display an hardware state.
|
|
312
|
+
*
|
|
313
|
+
* If `minWidth` is pecified (in `em`) it ensure the widget width will stay the
|
|
314
|
+
* same when the state change
|
|
315
|
+
*/
|
|
316
|
+
declare function HardwareState(props: {
|
|
317
|
+
state: string;
|
|
318
|
+
variant: string;
|
|
319
|
+
minWidth?: number;
|
|
320
|
+
}): JSX.Element;
|
|
321
|
+
declare function MotorState(props: {
|
|
322
|
+
hardware: MotorSchema;
|
|
323
|
+
}): JSX.Element;
|
|
324
|
+
declare function ShutterState(props: {
|
|
325
|
+
hardware: ShutterSchema;
|
|
326
|
+
useReadyState?: boolean;
|
|
327
|
+
}): JSX.Element;
|
|
328
|
+
|
|
329
|
+
declare const State_d_HardwareState: typeof HardwareState;
|
|
330
|
+
declare const State_d_MotorState: typeof MotorState;
|
|
331
|
+
declare const State_d_ShutterState: typeof ShutterState;
|
|
332
|
+
declare namespace State_d {
|
|
333
|
+
export { State_d_HardwareState as HardwareState, State_d_MotorState as MotorState, State_d_ShutterState as ShutterState };
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
declare function formatEng(scalar: number): {
|
|
337
|
+
scalar: number;
|
|
338
|
+
prefix: string;
|
|
339
|
+
multiplier: number;
|
|
340
|
+
};
|
|
341
|
+
/**
|
|
342
|
+
* Returns the argument as capitalized string.
|
|
343
|
+
*/
|
|
344
|
+
declare function ucfirst(str: string): string;
|
|
345
|
+
declare function toHoursMins(seconds: number): string;
|
|
346
|
+
declare function toEnergy(wavelength: number): string | 0;
|
|
347
|
+
declare function round(value: number, digits: number): number;
|
|
348
|
+
|
|
349
|
+
declare const formatting_d_formatEng: typeof formatEng;
|
|
350
|
+
declare const formatting_d_round: typeof round;
|
|
351
|
+
declare const formatting_d_toEnergy: typeof toEnergy;
|
|
352
|
+
declare const formatting_d_toHoursMins: typeof toHoursMins;
|
|
353
|
+
declare const formatting_d_ucfirst: typeof ucfirst;
|
|
354
|
+
declare namespace formatting_d {
|
|
355
|
+
export { formatting_d_formatEng as formatEng, formatting_d_round as round, formatting_d_toEnergy as toEnergy, formatting_d_toHoursMins as toHoursMins, formatting_d_ucfirst as ucfirst };
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
interface Props$1 {
|
|
359
|
+
className?: string;
|
|
360
|
+
}
|
|
361
|
+
declare function FullSizer(props: PropsWithChildren<Props$1>): JSX.Element;
|
|
362
|
+
|
|
363
|
+
interface Props {
|
|
364
|
+
step?: number;
|
|
365
|
+
steps?: number[];
|
|
366
|
+
disabled: boolean;
|
|
367
|
+
id?: string;
|
|
368
|
+
unit?: string;
|
|
369
|
+
overlay?: ReactChild | null;
|
|
370
|
+
incIcon?: string;
|
|
371
|
+
decIcon?: string;
|
|
372
|
+
swapIncDec?: boolean;
|
|
373
|
+
className?: string;
|
|
374
|
+
type?: 'number' | 'text';
|
|
375
|
+
precision?: number;
|
|
376
|
+
horizontalArrows?: boolean;
|
|
377
|
+
largeArrows?: boolean;
|
|
378
|
+
onBlur: () => void;
|
|
379
|
+
onChange: (e: ChangeEvent<HTMLInputElement>) => void;
|
|
380
|
+
onStep: (params: {
|
|
381
|
+
target: HTMLInputElement;
|
|
382
|
+
}) => void;
|
|
383
|
+
onKeyDown?: (e: KeyboardEvent<HTMLInputElement>) => void;
|
|
384
|
+
}
|
|
385
|
+
declare const NumericStep: react.ForwardRefExoticComponent<Props & react.RefAttributes<HTMLInputElement>>;
|
|
386
|
+
|
|
387
|
+
export { formatting_d as Formatting, Frontend, FullSizer, HardwareInputNumber, HardwareNumericStep, schema_d as HardwareSchema, State_d as HardwareState, HardwareTemplate, types_d as HardwareTypes, Info, MotorDefault, type MotorDefaultOptions, Multiposition, NoObject, NumericStep, Property, ShutterDefault, TypeIcon };
|