@esrf/daiquiri-lib 0.0.2-alpha.4 → 0.0.2-alpha.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import * as react from 'react';
3
- import { ReactElement, PropsWithChildren, ReactChild, ChangeEvent, KeyboardEvent } from 'react';
3
+ import { ReactElement, Component, ComponentType, PropsWithChildren, ReactChild, ChangeEvent, KeyboardEvent } from 'react';
4
4
 
5
5
  interface HardwareError {
6
6
  property: string;
@@ -229,7 +229,7 @@ declare function Property(props: HardwareWidgetProps<GenericSchema, PropertyWidg
229
229
 
230
230
  declare function ShutterDefault(props: HardwareWidgetProps<ShutterSchema, HardwareWidgetOptions>): JSX.Element;
231
231
 
232
- interface Props$3 {
232
+ interface Props$4 {
233
233
  online: boolean;
234
234
  activeMessage?: string;
235
235
  inactiveMessage?: string;
@@ -237,9 +237,9 @@ interface Props$3 {
237
237
  icon: string;
238
238
  name: string;
239
239
  }
240
- declare function TypeIcon(props: Props$3): JSX.Element;
240
+ declare function TypeIcon(props: Props$4): JSX.Element;
241
241
 
242
- interface Props$2 {
242
+ interface Props$3 {
243
243
  hardware: Hardware;
244
244
  headerMode?: string;
245
245
  widgetIcon: ReactElement;
@@ -250,7 +250,7 @@ interface Props$2 {
250
250
  * Normalized way to compose hardware component in order to provide the same
251
251
  * kind of layout
252
252
  */
253
- declare function HardwareTemplate(props: Props$2): JSX.Element;
253
+ declare function HardwareTemplate(props: Props$3): JSX.Element;
254
254
 
255
255
  /**
256
256
  * Input number synchronized with a hardware.
@@ -355,12 +355,24 @@ declare namespace formatting_d {
355
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
356
  }
357
357
 
358
- interface Props$1 {
358
+ interface HardwareVariantOptions {
359
+ options: {
360
+ variant: string;
361
+ };
362
+ }
363
+ declare class HardwareVariant extends Component<HardwareVariantOptions, void> {
364
+ variants: {
365
+ [name: string]: ComponentType<any>;
366
+ };
367
+ render(): JSX.Element;
368
+ }
369
+
370
+ interface Props$2 {
359
371
  className?: string;
360
372
  }
361
- declare function FullSizer(props: PropsWithChildren<Props$1>): JSX.Element;
373
+ declare function FullSizer(props: PropsWithChildren<Props$2>): JSX.Element;
362
374
 
363
- interface Props {
375
+ interface Props$1 {
364
376
  step?: number;
365
377
  steps?: number[];
366
378
  disabled: boolean;
@@ -382,6 +394,119 @@ interface Props {
382
394
  }) => void;
383
395
  onKeyDown?: (e: KeyboardEvent<HTMLInputElement>) => void;
384
396
  }
385
- declare const NumericStep: react.ForwardRefExoticComponent<Props & react.RefAttributes<HTMLInputElement>>;
397
+ declare const NumericStep: react.ForwardRefExoticComponent<Props$1 & react.RefAttributes<HTMLInputElement>>;
398
+
399
+ interface YamlNode {
400
+ type: string;
401
+ children?: YamlNode[];
402
+ _parentNode: YamlNode | null;
403
+ _indexFromParent: number | null;
404
+ }
405
+ interface YamlRoot extends YamlNode {
406
+ name: string;
407
+ error: string;
408
+ }
409
+ interface YamlComponent {
410
+ providers?: Record<string, any>;
411
+ yamlNode: YamlNode;
412
+ [option: string]: unknown;
413
+ }
414
+
415
+ declare function registerComponent(name: string, component: React.ComponentType<any>): void;
416
+
417
+ interface Props {
418
+ id: string;
419
+ layout: YamlRoot;
420
+ className?: string;
421
+ }
422
+ declare function Main(props: Props): JSX.Element;
423
+
424
+ /**
425
+ * Register the Yaml type with the component used to render this Yaml node.
426
+ */
427
+ declare function registerYamlType(name: string, component: React.ComponentType<any>): void;
428
+ declare class LayoutError extends Error {
429
+ readonly yamlNode: YamlNode;
430
+ constructor(message: string, yamlNode: YamlNode);
431
+ }
432
+ declare class MissingKeysError extends LayoutError {
433
+ readonly keys: string[];
434
+ constructor(yamlNode: YamlNode, missingKeys: string[]);
435
+ }
436
+ declare class KeyError extends LayoutError {
437
+ readonly key: string;
438
+ readonly keyMessage: string;
439
+ constructor(yamlNode: YamlNode, key: string, message: string);
440
+ }
441
+
442
+ declare type Defined<T> = T extends undefined ? never : T;
443
+ declare function assertKeyExpected<T>(yamlNode: YamlNode | undefined, key: string, value: T): asserts value is Defined<T>;
444
+ declare function assertString(yamlNode: YamlNode, key: string, value: any): asserts value is string;
445
+ declare function assertBoolean(yamlNode: YamlNode, key: string, value: unknown): asserts value is boolean;
446
+ declare function assertNumber(yamlNode: YamlNode, key: string, value: unknown): asserts value is number;
447
+ declare function assertOptionalBoolean(yamlNode: YamlNode, key: string, value: unknown): asserts value is boolean | undefined;
448
+ declare function assertOptionalString(yamlNode: YamlNode, key: string, value: unknown): asserts value is string | undefined;
449
+ declare function assertStringList(yamlNode: YamlNode, key: string, value: unknown): asserts value is string[];
450
+ declare function assertOptionalStringOrStringList(yamlNode: YamlNode, key: string, value: unknown): asserts value is string | string[] | undefined;
451
+ declare function assertOptionalStringList(yamlNode: YamlNode, key: string, value: unknown): asserts value is string[] | undefined;
452
+ declare function assertOptionalNumber(yamlNode: YamlNode, key: string, value: unknown): asserts value is number | undefined;
453
+ declare function assertOptionalNumberList(yamlNode: YamlNode, key: string, value: unknown): asserts value is string[] | undefined;
454
+ declare function assertNoUnknownKeys(yamlNode: YamlNode | undefined, remainingContent: Record<string, any>): void;
455
+ declare function assertDataCollectionId(yamlNode: YamlNode, key: string, value: unknown): asserts value is number | 'last';
456
+ declare function assertOptionalBackend(yamlNode: YamlNode, key: string, value: unknown): asserts value is 'plotly' | 'h5web' | undefined;
457
+
458
+ declare const asserts_d_assertBoolean: typeof assertBoolean;
459
+ declare const asserts_d_assertDataCollectionId: typeof assertDataCollectionId;
460
+ declare const asserts_d_assertKeyExpected: typeof assertKeyExpected;
461
+ declare const asserts_d_assertNoUnknownKeys: typeof assertNoUnknownKeys;
462
+ declare const asserts_d_assertNumber: typeof assertNumber;
463
+ declare const asserts_d_assertOptionalBackend: typeof assertOptionalBackend;
464
+ declare const asserts_d_assertOptionalBoolean: typeof assertOptionalBoolean;
465
+ declare const asserts_d_assertOptionalNumber: typeof assertOptionalNumber;
466
+ declare const asserts_d_assertOptionalNumberList: typeof assertOptionalNumberList;
467
+ declare const asserts_d_assertOptionalString: typeof assertOptionalString;
468
+ declare const asserts_d_assertOptionalStringList: typeof assertOptionalStringList;
469
+ declare const asserts_d_assertOptionalStringOrStringList: typeof assertOptionalStringOrStringList;
470
+ declare const asserts_d_assertString: typeof assertString;
471
+ declare const asserts_d_assertStringList: typeof assertStringList;
472
+ declare namespace asserts_d {
473
+ export { asserts_d_assertBoolean as assertBoolean, asserts_d_assertDataCollectionId as assertDataCollectionId, asserts_d_assertKeyExpected as assertKeyExpected, asserts_d_assertNoUnknownKeys as assertNoUnknownKeys, asserts_d_assertNumber as assertNumber, asserts_d_assertOptionalBackend as assertOptionalBackend, asserts_d_assertOptionalBoolean as assertOptionalBoolean, asserts_d_assertOptionalNumber as assertOptionalNumber, asserts_d_assertOptionalNumberList as assertOptionalNumberList, asserts_d_assertOptionalString as assertOptionalString, asserts_d_assertOptionalStringList as assertOptionalStringList, asserts_d_assertOptionalStringOrStringList as assertOptionalStringOrStringList, asserts_d_assertString as assertString, asserts_d_assertStringList as assertStringList };
474
+ }
475
+
476
+ interface HardwareObjectProps {
477
+ id: string;
478
+ actions: {
479
+ requestChange: (data: any) => void;
480
+ addToast: (data: any) => void;
481
+ };
482
+ options: {
483
+ variant?: string;
484
+ header?: string;
485
+ width?: number;
486
+ colWidth?: number;
487
+ emptyifnone?: boolean;
488
+ };
489
+ propertiesSchema?: Record<string, unknown>;
490
+ callablesSchema?: Record<string, unknown>;
491
+ }
492
+ interface ResolvedHardwareObjectProps extends HardwareObjectProps {
493
+ operator?: boolean;
494
+ obj: Hardware | null;
495
+ }
496
+ interface ComponentMapping {
497
+ [name: string]: ComponentType<any> | typeof HardwareVariant;
498
+ }
499
+
500
+ type HardwareObject_d_ComponentMapping = ComponentMapping;
501
+ type HardwareObject_d_HardwareObjectProps = HardwareObjectProps;
502
+ type HardwareObject_d_ResolvedHardwareObjectProps = ResolvedHardwareObjectProps;
503
+ declare namespace HardwareObject_d {
504
+ export type { HardwareObject_d_ComponentMapping as ComponentMapping, HardwareObject_d_HardwareObjectProps as HardwareObjectProps, HardwareObject_d_ResolvedHardwareObjectProps as ResolvedHardwareObjectProps };
505
+ }
506
+
507
+ /**
508
+ * Register the Yaml type with the component used to render this Yaml node.
509
+ */
510
+ declare function registerHardwareComponent(name: string, component: React.ComponentType<any>): void;
386
511
 
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 };
512
+ export { formatting_d as Formatting, Frontend, FullSizer, HardwareObject_d as HWObject, HardwareInputNumber, HardwareNumericStep, schema_d as HardwareSchema, State_d as HardwareState, HardwareTemplate, types_d as HardwareTypes, HardwareVariant, Info, KeyError, MissingKeysError, MotorDefault, type MotorDefaultOptions, Multiposition, NoObject, NumericStep, Property, ShutterDefault, TypeIcon, Main as YAMLLayout, asserts_d as YamlAsserts, type YamlComponent, type YamlNode, registerHardwareComponent, registerComponent as registerYamlComponent, registerYamlType };