@esrf/daiquiri-lib 0.2.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +33 -13
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/{index.esm.js → index.mjs} +89 -83
- package/dist/index.mjs.map +1 -0
- package/package.json +4 -5
- package/src/index.ts +5 -1
- package/src/scss/_panel.scss +65 -0
- package/src/scss/main.scss +1 -0
- package/dist/index.esm.js.map +0 -1
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/hardware/TypeIcon.tsx","../src/utils/formatting.ts","../src/hardware/Frontend.tsx","../src/hardware/Info.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","../src/hardware/Multiposition.tsx","../src/hardware/NoObject.tsx","../src/hardware/Property.tsx","../src/hardware/ShutterDefault.tsx","../src/hardware/HardwareVariant.tsx","../src/components/FullSizer.tsx","../src/layout/Panel.tsx","../src/yaml-layout/utils.tsx","../src/yaml-layout/ErrorBoundary.tsx","../src/yaml-layout/components/asserts.ts","../src/yaml-layout/Row.tsx","../src/yaml-layout/Col.tsx","../src/yaml-layout/components/HardwareGroup.tsx","../src/yaml-layout/Component.tsx","../src/yaml-layout/Container.tsx","../src/yaml-layout/Panel.tsx","../src/yaml-layout/Tabs.tsx","../src/yaml-layout/Form.tsx","../src/yaml-layout/Grid.tsx","../src/yaml-layout/Label.tsx","../src/yaml-layout/Main.tsx","../src/monitorpanel/MonitorPanel.tsx","../src/monitorpanel/MonitorHardware.tsx"],"sourcesContent":["export interface Props {\n online: boolean;\n activeMessage?: string;\n inactiveMessage?: string;\n message?: string;\n icon: string;\n name: string;\n}\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","// https://github.com/gentooboontoo/js-quantities/issues/30\nexport function formatEng(scalar: number) {\n const powerPrefix: Record<number, string> = {\n 24: 'Y',\n 21: 'Z',\n 18: 'E',\n 15: 'P',\n 12: 'T',\n 9: 'G',\n 6: 'M',\n 3: 'k',\n '-3': 'm',\n '-6': '\\u00B5',\n '-9': 'n',\n '-12': 'p',\n '-15': 'f',\n '-18': 'a',\n '-21': 'z',\n '-24': 'y',\n };\n\n const q = Math.log(scalar) / Math.log(1e3);\n // so that for example '3 km' does not get converted to '3000 m'\n const subtrhnd = !Number.isInteger(q);\n\n const pow10 = 3 * Math.ceil(q - (subtrhnd ? 1 : 0));\n const prefix = pow10 === 0 ? '' : powerPrefix[pow10];\n\n return {\n scalar: scalar * 10 ** -pow10,\n prefix,\n multiplier: 10 ** -pow10,\n };\n}\n\n/**\n * Returns the argument as capitalized string.\n */\nexport function ucfirst(str: string) {\n return str.charAt(0).toUpperCase() + str.slice(1);\n}\n\nexport function toHoursMins(seconds: number) {\n if (seconds < 60) return `${Math.round(seconds)} sec`;\n\n const min = Math.round(seconds / 60);\n\n const mins = min % 60;\n const hours = Math.floor(min / 60);\n\n return hours ? `${hours} hr ${mins} min` : `${mins} min`;\n}\n\nexport function toEnergy(wavelength: number) {\n return wavelength > 0\n ? (\n ((6.626_070_04e-34 * 2.997_924_58e8) /\n (wavelength * 1e-10) /\n 1.602_18e-19) *\n 1e-3\n ).toFixed(4)\n : 0;\n}\n\nexport function round(value: number, digits: number) {\n return Number.parseFloat(value.toFixed(digits));\n}\n","import type { MouseEvent } from 'react';\nimport { map } from 'lodash';\nimport {\n Badge,\n Button,\n ButtonGroup,\n Container,\n Row,\n Col,\n OverlayTrigger,\n Popover,\n} from 'react-bootstrap';\n\nimport TypeIcon from './TypeIcon';\nimport { toHoursMins } from '../utils/formatting';\nimport type { HardwareWidgetProps } from './utils/types';\nimport type { FrontendSchema } from './utils/schema';\n\nfunction FrontendOverlay(props: HardwareWidgetProps<FrontendSchema>) {\n const { hardware } = props;\n function reset(e: any) {\n void hardware.requestChange({\n function: 'reset',\n });\n }\n\n type StateEnum = 'feitlk' | 'expitlk' | 'pssitlk';\n\n const itlks: { [name: string]: StateEnum } = {\n 'Front End': 'feitlk',\n Experimental: 'expitlk',\n PSS: 'pssitlk',\n };\n\n const ring = {\n Current: `${hardware.properties.current.toFixed(1)} mA`,\n Mode: hardware.properties.mode,\n Refill: toHoursMins(hardware.properties.refill),\n Message: <pre>{hardware.properties.message}</pre>,\n };\n\n function getPropertyState(key: StateEnum): string {\n if (!(key in hardware.properties)) {\n return 'UNKNOWN';\n }\n const state: any = hardware.properties[key];\n if (!state || typeof state !== 'string') {\n return 'UNKNOWN';\n }\n return state;\n }\n\n return (\n <OverlayTrigger\n trigger=\"click\"\n rootClose\n overlay={\n <Popover id=\"popid\">\n <Popover.Header>{hardware.name} Details</Popover.Header>\n <Popover.Body>\n <h6>Status</h6>\n <pre>{hardware.properties.status}</pre>\n <h6>Interlocks</h6>\n <Container>\n {map(itlks, (key, name) => (\n <Row key={name}>\n <Col>{name}:</Col>\n <Col>\n <Badge\n bg={getPropertyState(key) === 'ON' ? 'success' : 'danger'}\n >\n {getPropertyState(key)}\n </Badge>\n </Col>\n </Row>\n ))}\n </Container>\n\n <h6>Ring Status</h6>\n <Container>\n {map(ring, (prop, name) => (\n <Row key={name}>\n <Col>{name}:</Col>\n <Col>{prop}</Col>\n </Row>\n ))}\n </Container>\n\n <div className=\"d-grid gap-2\">\n <Button disabled={props.disabled} onClick={reset}>\n Reset\n </Button>\n </div>\n </Popover.Body>\n </Popover>\n }\n >\n <Button className=\"flex-grow-0\" title=\"Shutter Details\">\n <i className=\"fa fa-ellipsis-h\" />\n </Button>\n </OverlayTrigger>\n );\n}\n\nfunction Frontend(props: HardwareWidgetProps<FrontendSchema>) {\n const { hardware, options = {} } = props;\n function onClick(e: MouseEvent) {\n void hardware.requestChange({\n function: hardware.properties.frontend === 'FE open' ? 'close' : 'open',\n });\n }\n\n return (\n <div className=\"hw-component\">\n <div className=\"hw-head\">\n <TypeIcon\n name=\"Frontend\"\n icon=\"fam-hardware-frontend\"\n online={hardware.online}\n />\n <div className=\"name\">{hardware.name}</div>\n <Badge\n bg={\n hardware.properties.state === 'OPEN' ||\n hardware.properties.state === 'RUNNING'\n ? 'success'\n : 'danger'\n }\n >\n {hardware.properties.state}\n </Badge>\n </div>\n <div className=\"hw-content\">\n <ButtonGroup className=\"d-flex\">\n <Button\n variant={\n hardware.properties.frontend === 'FE open' ? 'danger' : 'success'\n }\n onClick={onClick}\n disabled={props.disabled}\n >\n {hardware.properties.frontend === 'FE open' ? 'Close' : 'Open'}\n </Button>\n <FrontendOverlay {...props} />\n </ButtonGroup>\n </div>\n </div>\n );\n}\n\nexport default Frontend;\n","import type {\n Hardware,\n HardwareWidgetProps,\n HardwareWidgetOptions,\n} from './utils/types';\n\nexport interface InfoOptions extends HardwareWidgetOptions {\n /** The property */\n property?: string;\n /** Unit for the property */\n unit?: string;\n}\n\nexport default function Info(\n props: HardwareWidgetProps<Hardware, InfoOptions>\n) {\n const { hardware, options = {} } = props;\n function getValue() {\n const propertyName = options.property;\n if (propertyName === undefined) {\n return `property is not set`;\n }\n if (propertyName === null) {\n return `property is null`;\n }\n let result: any = hardware;\n for (const segment of propertyName.split('/')) {\n result = result[segment];\n if (result === undefined) {\n return `property '${propertyName}' not found`;\n }\n }\n return `${result}`;\n }\n\n return <>{getValue()}</>;\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","import { useRef, useEffect } from 'react';\nimport { map } from 'lodash';\nimport { Badge, Button, InputGroup, Form } from 'react-bootstrap';\n\nimport TypeIcon from './TypeIcon';\nimport type { MultipositionSchema } from './utils/schema';\nimport type { HardwareWidgetProps } from './utils/types';\n\nexport default function Multiposition(\n props: HardwareWidgetProps<MultipositionSchema>\n) {\n const { hardware, options = {} } = props;\n const selectionRef = useRef<HTMLSelectElement>(null);\n\n useEffect(() => {\n if (!selectionRef.current) {\n console.error('selectionRef ref is unset');\n return;\n }\n selectionRef.current.value = hardware.properties.position;\n }, [hardware.properties.position]);\n\n function onMove(e: any) {\n console.debug('change', e);\n if (!selectionRef || !selectionRef.current) {\n console.error('selection ref is unset');\n return;\n }\n void hardware.requestChange({\n value: selectionRef.current.value,\n function: 'move',\n });\n }\n\n function stop(e: any) {\n void hardware.requestChange({\n function: 'stop',\n });\n }\n\n const opts = map(hardware.properties.positions, (p) => (\n <option key={p.position} title={p.description}>\n {p.position}\n </option>\n ));\n\n return (\n <div className=\"hw-component\">\n <div className=\"hw-head\">\n <TypeIcon\n name=\"Multiposition\"\n icon=\"fam-hardware-multiposition\"\n online={hardware.online}\n />\n <div className=\"name\">{hardware.name}</div>\n <Badge\n bg={hardware.properties.state === 'READY' ? 'success' : 'warning'}\n >\n {hardware.properties.state}\n </Badge>\n </div>\n <div className=\"hw-content\">\n <InputGroup>\n <Form.Control\n className=\"custom-select\"\n as=\"select\"\n ref={selectionRef}\n disabled={props.disabled}\n defaultValue={hardware.properties.position}\n >\n <option disabled>unknown</option>\n {opts}\n </Form.Control>\n {hardware.properties.state !== 'MOVING' && (\n <Button onClick={onMove} disabled={props.disabled}>\n Move\n </Button>\n )}\n\n {hardware.properties.state === 'MOVING' && !props.disabled && (\n <Button variant=\"danger\" onClick={stop}>\n <i className=\"fa fa-times\" />\n </Button>\n )}\n </InputGroup>\n </div>\n </div>\n );\n}\n","import debug from 'debug';\n\nimport TypeIcon from './TypeIcon';\nimport HardwareTemplate from './utils/HardwareTemplate';\nimport type { Hardware } from './utils/types';\n\nconst logger = debug('daiquiri.components.hardware.NoObject');\n\ninterface NoObjectProps {\n id: string;\n name?: string;\n options: {\n header?: string;\n emptyifnone?: boolean;\n };\n}\n\nexport default function NoObject(props: NoObjectProps) {\n if (props.options.emptyifnone) {\n logger(\n 'Component id:\"%s\" name:\"%s\" not displayed cause setup with emptyifnone.',\n props.id,\n props.name\n );\n return <></>;\n }\n\n const widgetIcon = (\n <TypeIcon name=\"NoObject\" icon=\"fam-hardware-any\" online={false} />\n );\n\n const widgetState = <></>;\n\n const widgetContent = <>Missing</>;\n\n const headerMode = props.options ? props.options.header : 'top';\n\n const hardware: Hardware = {\n id: props.id,\n name: props.name ?? '',\n alias: null,\n online: false,\n properties: {},\n type: '',\n };\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={widgetContent}\n headerMode={headerMode}\n />\n );\n}\n","import { InputGroup, Form, Badge } from 'react-bootstrap';\n\nimport TypeIcon from './TypeIcon';\nimport HardwareTemplate from './utils/HardwareTemplate';\nimport type { GenericSchema } from './utils/schema';\nimport type { HardwareWidgetProps, HardwareWidgetOptions } from './utils/types';\n\nfunction DeviceState(props: GenericSchema) {\n const state = props.online ? 'READY' : 'OFFLINE';\n return <Badge bg={state === 'READY' ? 'success' : 'warning'}>{state}</Badge>;\n}\n\ninterface PropertyWidgetOptions extends HardwareWidgetOptions {\n header?: string;\n property?: string;\n unit?: string;\n}\n\nexport default function Property(\n props: HardwareWidgetProps<GenericSchema, PropertyWidgetOptions>\n) {\n const { hardware, options = {} } = props;\n const widgetIcon = (\n <TypeIcon name=\"Optic\" icon=\"fa-cog\" online={hardware.online} />\n );\n\n const widgetState = <DeviceState {...hardware} />;\n\n function getValue() {\n const propertyName = options.property;\n if (propertyName === undefined) {\n return `property is not set`;\n }\n if (propertyName === null) {\n return `property is null`;\n }\n let result: any = hardware;\n for (const segment of propertyName.split('/')) {\n result = result[segment];\n if (result === undefined) {\n return `property '${propertyName}' not found`;\n }\n }\n return `${result}`;\n }\n\n function getUnit() {\n const unitName = options.unit;\n if (!unitName) {\n return null;\n }\n if (!unitName.includes('properties')) {\n // That's a fixed unit defined as an option\n return unitName;\n }\n\n let result: any = props;\n for (const segment of unitName.split('/')) {\n result = result[segment];\n if (result === undefined) {\n return null;\n }\n }\n return `${result}`;\n }\n\n const unit = getUnit();\n\n const widgetContent = (\n <InputGroup>\n <Form.Control value={getValue()} readOnly />\n {unit && <InputGroup.Text>{unit}</InputGroup.Text>}\n </InputGroup>\n );\n\n const headerMode = props.options.header || 'top';\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={widgetContent}\n headerMode={headerMode}\n />\n );\n}\n","import { Button, OverlayTrigger, Popover, ButtonGroup } from 'react-bootstrap';\n\nimport TypeIcon from './TypeIcon';\nimport HardwareTemplate from './utils/HardwareTemplate';\nimport { ShutterState } from './utils/State';\nimport type { ShutterSchema } from './utils/schema';\nimport type { HardwareWidgetProps, HardwareWidgetOptions } from './utils/types';\n\nfunction ShutterOverlay(\n props: HardwareWidgetProps<ShutterSchema, HardwareWidgetOptions>\n) {\n const { hardware } = props;\n const reset = () => {\n void hardware.requestChange({\n function: 'reset',\n });\n };\n\n return (\n <OverlayTrigger\n trigger=\"click\"\n rootClose\n overlay={\n <Popover id=\"popid\">\n <Popover.Header>{hardware.name} Details</Popover.Header>\n <Popover.Body>\n <h6>Status</h6>\n <pre>{hardware.properties.status}</pre>\n <div className=\"d-grid gap-2\">\n <Button onClick={reset} disabled={props.disabled}>\n Reset\n </Button>\n </div>\n </Popover.Body>\n </Popover>\n }\n >\n <Button className=\"flex-grow-0\" title=\"Shutter Details\">\n <i className=\"fa fa-ellipsis-h\" />\n </Button>\n </OverlayTrigger>\n );\n}\n\nexport default function ShutterDefault(\n props: HardwareWidgetProps<ShutterSchema, HardwareWidgetOptions>\n) {\n const { hardware, options = {} } = props;\n const widgetIcon = (\n <TypeIcon\n name=\"Shutter\"\n icon=\"fam-hardware-shutter\"\n online={hardware.online}\n />\n );\n\n const widgetState = <ShutterState hardware={hardware} />;\n\n function getState() {\n if (!hardware.properties) {\n return 'UNKNOWN';\n }\n return hardware.properties.state;\n }\n\n function getAction(s: string) {\n if (s === 'OPEN') {\n return ['Close', 'close'];\n }\n if (s === 'CLOSED') {\n return ['Open', 'open'];\n }\n if (s === 'DISABLED' || s === 'STANDBY' || s === 'FAULT') {\n return ['Closed', ''];\n }\n if (s === 'MOVING') {\n return ['...', ''];\n }\n return ['Unknown', ''];\n }\n\n const state = getState();\n // console.log(state);\n const [label, action] = getAction(state);\n const variants: { [name: string]: string } = {\n OPEN: 'danger',\n CLOSED: 'success',\n MOVING: 'warning',\n DISABLED: 'secondary',\n STANDBY: 'danger',\n FAULT: 'fatal',\n UNKNOWN: 'warning',\n };\n const variant = variants[state] || 'danger';\n\n function onClick() {\n void hardware.requestChange({\n function: action,\n });\n }\n\n const widgetContent = (\n <ButtonGroup className=\"d-flex flex-nowrap\">\n <Button\n variant={variant}\n onClick={onClick}\n disabled={props.disabled || action === ''}\n >\n {label}\n </Button>\n\n {options.extended && <ShutterOverlay {...props} />}\n </ButtonGroup>\n );\n\n const headerMode = props.options.header || 'top';\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={widgetContent}\n headerMode={headerMode}\n />\n );\n}\n","import { Component } from 'react';\nimport type { ComponentType } from 'react';\n\ninterface HardwareVariantOptions {\n options: {\n variant: string;\n };\n}\n\nexport default class HardwareVariant extends Component<\n HardwareVariantOptions,\n void\n> {\n public variants: {\n [name: string]: ComponentType<any>;\n } = {};\n\n public render() {\n let Comp = this.variants.default;\n\n if (this.props.options.variant in this.variants) {\n Comp = this.variants[this.props.options.variant];\n }\n\n return <Comp {...this.props} />;\n }\n}\n","import type { PropsWithChildren } from 'react';\nimport { useEffect, useRef, useState } from 'react';\n\ninterface Props {\n className?: string;\n}\n\nexport default function FullSizer(props: PropsWithChildren<Props>) {\n const [state, setState] = useState<Record<string, number>>({});\n const containerRef = useRef<HTMLDivElement>(null);\n useEffect(() => {\n if (containerRef.current) {\n const view = containerRef.current;\n setState({\n width: view.clientWidth,\n height: view.clientHeight,\n });\n }\n }, []);\n\n return (\n <div\n ref={containerRef}\n style={{ width: '100%', height: '100%' }}\n className={props.className}\n >\n {state.width > 0 && (\n <div\n className=\"full-sizer\"\n style={{\n width: `${state.width}px`,\n height: `${state.height}px`,\n overflow: 'scroll',\n }}\n >\n {props.children}\n </div>\n )}\n </div>\n );\n}\n","import type { ReactChild, PropsWithChildren } from 'react';\nimport { Fragment } from 'react';\nimport FullSizer from '../components/FullSizer';\n\nfunction PanelHeader(props: {\n children?: ReactChild | ReactChild[];\n style?: Record<string, any>;\n}) {\n return (\n <div className=\"panel-header\" style={props.style}>\n {props.children}\n </div>\n );\n}\n\nfunction PanelContents(props: {\n children?: ReactChild | ReactChild[];\n style?: Record<string, any>;\n}) {\n return (\n <div className=\"panel-contents\" style={props.style}>\n {props.children}\n </div>\n );\n}\n\ninterface Props {\n style?: Record<string, any>;\n scroll?: boolean;\n className?: string;\n}\n\nfunction Panel(props: PropsWithChildren<Props>) {\n const Wrap = props.scroll ? FullSizer : Fragment;\n\n return (\n <div className={`panel ${props.className ?? ''}`} style={props.style}>\n <Wrap>{props.children}</Wrap>\n </div>\n );\n}\n\nPanel.Header = PanelHeader;\nPanel.Contents = PanelContents;\n\nexport default Panel;\n","import type { ReactChild } from 'react';\nimport { Children, cloneElement, isValidElement } from 'react';\nimport Panel from '../layout/Panel';\nimport type { AnyYamlNode, YamlNode, YamlRoot } from './model';\n\n/**\n * Store the mapping from Yaml `type` to React component handling the\n * rendering of such Yaml node\n */\nexport const yamlWrapperMap: Record<string, React.ComponentType<any>> = {};\n\n/**\n * Register the Yaml type with the component used to render this Yaml node.\n */\nexport function registerYamlType(\n name: string,\n component: React.ComponentType<any>\n) {\n yamlWrapperMap[name] = component;\n}\n\n/**\n * Render a Yaml node using registred component from the node type\n */\nexport function renderYamlNode(\n yamlNode: AnyYamlNode,\n key: number | string,\n panel = true\n): ReactChild {\n // Allow null nodes to be ignored (useful for templating)\n if (!yamlNode) return <></>;\n const { type } = yamlNode;\n const Comp =\n type && type in yamlWrapperMap\n ? yamlWrapperMap[type]\n : yamlWrapperMap.component;\n return <Comp yamlNode={yamlNode} key={key} panel={panel} />;\n}\n\ninterface OptionalPanelProps {\n children?: ReactChild | ReactChild[];\n [name: string]: any;\n scroll?: boolean;\n style?: Record<string, any>;\n panel: boolean;\n key?: number | string;\n}\n\n/**\n * Wrap the children into a panel if it is requested by the options\n */\nexport function OptionalPanel({\n children,\n key,\n panel,\n options,\n}: OptionalPanelProps) {\n return panel ? (\n <Panel key={key} style={options.style} scroll={options.scroll}>\n <Panel.Contents>{children}</Panel.Contents>\n </Panel>\n ) : (\n <>\n {Children.map(children, (child) =>\n isValidElement(child)\n ? cloneElement(child, { key, ...child.props })\n : undefined\n )}\n </>\n );\n}\n\nexport function assertOnRemainingKeys(\n yamlNode: YamlNode | undefined,\n remainingContent: Record<string, any>\n) {\n const { _parentNode, _indexFromParent, ...remainingContent2 } =\n remainingContent;\n if (yamlNode) {\n if (Object.keys(remainingContent2).length > 0) {\n throw new UnknownKeysError(yamlNode, Object.keys(remainingContent2));\n }\n }\n}\n\nexport class LayoutError extends Error {\n public readonly yamlNode: YamlNode;\n public constructor(message: string, yamlNode: YamlNode) {\n super(message);\n this.yamlNode = yamlNode;\n }\n}\n\nexport class UnknownKeysError extends LayoutError {\n public readonly keys: string[];\n public constructor(yamlNode: YamlNode, unknownKeys: string[]) {\n super(`Unexpected keys: ${unknownKeys.join(', ')}`, yamlNode);\n this.keys = unknownKeys;\n }\n}\n\nexport class MissingKeysError extends LayoutError {\n public readonly keys: string[];\n public constructor(yamlNode: YamlNode, missingKeys: string[]) {\n super(`Keys ${missingKeys.join(', ')} are missing`, yamlNode);\n this.keys = missingKeys;\n }\n}\n\nexport class KeyError extends LayoutError {\n public readonly key: string;\n public readonly keyMessage: string;\n public constructor(yamlNode: YamlNode, key: string, message: string) {\n super(`Key ${key} error: ${message}`, yamlNode);\n this.key = key;\n this.keyMessage = message;\n }\n}\n\n/**\n * Returns the root of the YamlNode\n */\nexport function getYamlRoot(node: YamlNode): YamlRoot {\n let n = node;\n while (n._parentNode) {\n n = n._parentNode;\n }\n return n as YamlRoot;\n}\n\n/**\n * Returns a list of nodes from the root to this node.\n */\nexport function getYamlHierarchy(\n node: YamlNode\n): { node: YamlNode; indexFromParent: number | null }[] {\n const path: { node: YamlNode; indexFromParent: number | null }[] = [];\n let n: YamlNode | null = node;\n while (n) {\n path.push({\n node: n,\n indexFromParent: n._indexFromParent,\n });\n n = n._parentNode;\n }\n path.reverse();\n return path;\n}\n\n/**\n * Create links between layout node in order to simplify further processing\n * (mainly error handling).\n */\nexport function normalizeLayout<R extends YamlNode>(\n node: R,\n parentNode: YamlNode | null = null,\n indexFromParent: number | null = null\n): R {\n if (node._parentNode) {\n throw new Error(\n 'Attribute _parentNode was already defined by the yml layout.'\n );\n }\n const newNode = {\n ...node,\n _parentNode: parentNode,\n _indexFromParent: indexFromParent,\n };\n if (node.children) {\n // NOTE: use a map from a real array\n const children = [...node.children];\n Object.freeze(children);\n newNode.children = children.map((c, i) => normalizeLayout(c, newNode, i));\n }\n Object.freeze(newNode);\n return newNode;\n}\n","import type { PropsWithChildren } from 'react';\nimport { Component } from 'react';\nimport { Container, Alert, Button } from 'react-bootstrap';\nimport {\n KeyError,\n MissingKeysError,\n UnknownKeysError,\n getYamlHierarchy,\n getYamlRoot,\n LayoutError,\n} from './utils';\n\ninterface State {\n hasError: boolean;\n message: string;\n error?: Error;\n}\n\ntype Props = PropsWithChildren<{ resetKey?: any }>;\n\nfunction DefaultErrorMessage(props: {\n message: string;\n error: Error | undefined;\n}) {\n return <Alert variant=\"danger\">{props.message}</Alert>;\n}\n\nfunction LayoutErrorMessage(props: {\n message: string;\n error: Error | undefined;\n}) {\n const { error } = props;\n if (!(error instanceof LayoutError)) {\n return <></>;\n }\n function formatPreview(\n error: MissingKeysError | UnknownKeysError | KeyError,\n indent = 3\n ) {\n const path = getYamlHierarchy(error.yamlNode);\n const lines: string[] = [];\n let actualIndentation = '';\n for (let i = 1; i < path.length; i++) {\n const { node, indexFromParent } = path[i];\n lines.push(`${actualIndentation}children:`);\n actualIndentation += ' '.repeat(indent);\n if (indexFromParent === 1) {\n lines.push(`${actualIndentation}- type: ...`);\n } else if (indexFromParent ?? 0 > 1) {\n lines.push(\n `${actualIndentation}...`,\n `${actualIndentation}...`,\n `${actualIndentation}# children number ${indexFromParent ?? 0 + 1}`\n );\n }\n lines.push(`${actualIndentation}- type: ${node.type}`);\n actualIndentation += ' '.repeat(2);\n }\n if (error instanceof UnknownKeysError) {\n error.keys.forEach((k) => {\n lines.push(\n `${actualIndentation}${k}: ... ${' '.repeat(\n 50 - actualIndentation.length - k.length\n )}<-- unexpected key`\n );\n });\n } else if (error instanceof MissingKeysError) {\n error.keys.forEach((k) => {\n lines.push(\n `${actualIndentation}???: ${' '.repeat(\n 50 - actualIndentation.length - k.length\n )}<-- key **${k}** is expected`\n );\n });\n } else if (error instanceof KeyError) {\n lines.push(\n `${actualIndentation}${error.key}: ${' '.repeat(\n 50 - actualIndentation.length - error.key.length\n )}<-- ${error.keyMessage}`\n );\n }\n return lines.join('\\n');\n }\n const layoutRoot = getYamlRoot(error.yamlNode);\n const layoutName = layoutRoot.name;\n\n if (error instanceof UnknownKeysError) {\n const key = error.keys.length === 1 ? 'key' : 'keys';\n return (\n <Alert variant=\"danger\">\n Unexpected {key}{' '}\n {error.keys.map((k, i) => {\n return (\n <>\n {i !== 0 && ', '}\n <b>{k}</b>\n </>\n );\n })}{' '}\n from the layout name <b>{layoutName}</b>.\n <br />\n <pre className=\"mt-3\">{formatPreview(error)}</pre>\n <br />\n </Alert>\n );\n }\n if (error instanceof MissingKeysError) {\n const key = error.keys.length === 1 ? 'Key' : 'Keys';\n return (\n <Alert variant=\"danger\">\n Expected {key}{' '}\n {error.keys.map((k, i) => {\n return (\n <>\n {i !== 0 && ', '}\n <b>{k}</b>\n </>\n );\n })}{' '}\n from the layout name <b>{layoutName}</b>.\n <br />\n <pre className=\"mt-3\">{formatPreview(error)}</pre>\n <br />\n </Alert>\n );\n }\n if (error instanceof KeyError) {\n return (\n <Alert variant=\"danger\">\n Error on key <b>{error.key}</b> from the layout name <b>{layoutName}</b>\n .\n <br />\n <pre className=\"mt-3\">{formatPreview(error)}</pre>\n <br />\n </Alert>\n );\n }\n return <DefaultErrorMessage {...props} />;\n}\n\nconst INITIAL_STATE = {\n hasError: false,\n message: '',\n error: undefined,\n};\n\nexport default class ErrorBoundary extends Component<Props, State> {\n public constructor(props: Props) {\n super(props);\n this.state = INITIAL_STATE;\n }\n\n public static getDerivedStateFromError() {\n return { hasError: true };\n }\n\n private readonly reload = () => {\n window.location.reload();\n };\n\n public componentDidCatch(error: Error) {\n if (error instanceof LayoutError) {\n this.setState({\n hasError: true,\n message: error.message,\n error,\n });\n }\n }\n\n // https://github.com/bvaughn/react-error-boundary/blob/23a4d779744f3079dfe0960acaa4bdfd5dede87b/src/ErrorBoundary.ts#L53\n public componentDidUpdate(prevProps: Props, prevState: State) {\n if (\n this.state.hasError &&\n prevState.error !== undefined &&\n prevProps.resetKey !== this.props.resetKey\n ) {\n this.setState(INITIAL_STATE);\n }\n }\n\n public render() {\n if (this.state.hasError) {\n return (\n <Container className=\"mt-2\">\n <h4>Something went wrong</h4>\n <LayoutErrorMessage\n message={this.state.message}\n error={this.state.error}\n />\n <p>\n This error has been logged. Please{' '}\n <Button size=\"sm\" onClick={this.reload}>\n <i className=\"fa fa-refresh\" /> Reload\n </Button>{' '}\n the application\n </p>\n </Container>\n );\n }\n return this.props.children;\n }\n}\n","import type { YamlNode } from '../model';\nimport { KeyError, MissingKeysError, UnknownKeysError } from '../utils';\n\ntype Defined<T> = T extends undefined ? never : T;\n\nexport function assertKeyExpected<T>(\n yamlNode: YamlNode | undefined,\n key: string,\n value: T\n): asserts value is Defined<T> {\n if (yamlNode) {\n if (value === undefined) {\n throw new MissingKeysError(yamlNode, [key]);\n }\n }\n}\n\nexport function assertString(\n yamlNode: YamlNode,\n key: string,\n value: any\n): asserts value is string {\n if (typeof value !== 'string') {\n throw new KeyError(yamlNode, key, 'A string is expected');\n }\n}\n\nexport function assertBoolean(\n yamlNode: YamlNode,\n key: string,\n value: unknown\n): asserts value is boolean {\n if (typeof value !== 'boolean') {\n throw new KeyError(yamlNode, key, 'A boolean is expected');\n }\n}\n\nexport function assertNumber(\n yamlNode: YamlNode,\n key: string,\n value: unknown\n): asserts value is number {\n if (typeof value !== 'number') {\n throw new KeyError(yamlNode, key, 'A number is expected');\n }\n}\n\nexport function assertOptionalBoolean(\n yamlNode: YamlNode,\n key: string,\n value: unknown\n): asserts value is boolean | undefined {\n if (value === undefined) {\n return;\n }\n if (typeof value !== 'boolean') {\n throw new KeyError(yamlNode, key, 'An optional boolean is expected');\n }\n}\n\nexport function assertOptionalString(\n yamlNode: YamlNode,\n key: string,\n value: unknown\n): asserts value is string | undefined {\n if (value === undefined) {\n return;\n }\n if (typeof value !== 'string') {\n throw new KeyError(yamlNode, key, 'An optional string is expected');\n }\n}\n\nexport function assertStringList(\n yamlNode: YamlNode,\n key: string,\n value: unknown\n): asserts value is string[] {\n if (!Array.isArray(value)) {\n throw new KeyError(yamlNode, key, 'A list of string is expected');\n }\n value.forEach((v) => {\n if (typeof v !== 'string') {\n throw new KeyError(yamlNode, key, 'A list of string is expected');\n }\n });\n}\n\nexport function assertOptionalStringOrStringList(\n yamlNode: YamlNode,\n key: string,\n value: unknown\n): asserts value is string | string[] | undefined {\n if (value === undefined) {\n return;\n }\n if (typeof value === 'string') {\n return;\n }\n if (!Array.isArray(value)) {\n throw new KeyError(\n yamlNode,\n key,\n 'An optional string or list of string is expected'\n );\n }\n value.forEach((v) => {\n if (typeof v !== 'string') {\n throw new KeyError(\n yamlNode,\n key,\n 'An optional string or list of string is expected'\n );\n }\n });\n}\n\nexport function assertOptionalStringList(\n yamlNode: YamlNode,\n key: string,\n value: unknown\n): asserts value is string[] | undefined {\n if (value === undefined) {\n return;\n }\n if (!Array.isArray(value)) {\n throw new KeyError(yamlNode, key, 'An optional list of string is expected');\n }\n value.forEach((v) => {\n if (typeof v !== 'string') {\n throw new KeyError(\n yamlNode,\n key,\n 'A optional list of string is expected'\n );\n }\n });\n}\n\nexport function assertOptionalNumber(\n yamlNode: YamlNode,\n key: string,\n value: unknown\n): asserts value is number | undefined {\n if (value === undefined) {\n return;\n }\n if (typeof value !== 'number') {\n throw new KeyError(yamlNode, key, 'An optional number is expected');\n }\n}\n\nexport function assertOptionalNumberList(\n yamlNode: YamlNode,\n key: string,\n value: unknown\n): asserts value is string[] | undefined {\n if (value === undefined) {\n return;\n }\n if (!Array.isArray(value)) {\n throw new KeyError(\n yamlNode,\n key,\n 'An optional list of numbers is expected'\n );\n }\n value.forEach((v) => {\n if (typeof v !== 'number') {\n throw new KeyError(\n yamlNode,\n key,\n 'An optional list of numbers is expected'\n );\n }\n });\n}\n\nexport function assertNoUnknownKeys(\n yamlNode: YamlNode | undefined,\n remainingContent: Record<string, any>\n) {\n const { _parentNode, _indexFromParent, ...remainingContent2 } =\n remainingContent;\n if (yamlNode) {\n if (Object.keys(remainingContent2).length > 0) {\n throw new UnknownKeysError(yamlNode, Object.keys(remainingContent2));\n }\n }\n}\n\nexport function assertDataCollectionId(\n yamlNode: YamlNode,\n key: string,\n value: unknown\n): asserts value is number | 'last' {\n if (value === 'last') {\n return;\n }\n if (typeof value === 'number') {\n return;\n }\n throw new KeyError(yamlNode, key, '\"last\" or a number is expected');\n}\n\nexport function assertOptionalBackend(\n yamlNode: YamlNode,\n key: string,\n value: unknown\n): asserts value is 'plotly' | 'h5web' | undefined {\n if (value === undefined) {\n return;\n }\n if (value === 'h5web') {\n return;\n }\n if (value === 'plotly') {\n return;\n }\n throw new KeyError(yamlNode, key, '\"h5web\" or \"plotly\" string is expected');\n}\n","import { map } from 'lodash';\nimport { Row } from 'react-bootstrap';\nimport { renderYamlNode } from './utils';\nimport { assertNoUnknownKeys } from './components/asserts';\nimport type { AnyYamlNode } from './model';\n\ninterface Props {\n yamlNode: AnyYamlNode;\n panel: boolean;\n}\n\nexport default function YamlRow({ yamlNode, panel }: Props) {\n const { type, style, children, ...unknownOptions } = yamlNode;\n assertNoUnknownKeys(yamlNode, unknownOptions);\n return (\n <Row className=\"ymllayout-row gx-0\" style={style}>\n {map(children, (node, key) => renderYamlNode(node, key, panel))}\n </Row>\n );\n}\n","import { map } from 'lodash';\nimport { Col } from 'react-bootstrap';\nimport classNames from 'classnames';\nimport { renderYamlNode } from './utils';\nimport {\n assertNoUnknownKeys,\n assertOptionalNumber,\n} from './components/asserts';\nimport type { AnyYamlNode } from './model';\n\ninterface Props {\n yamlNode: AnyYamlNode;\n panel: boolean;\n}\n\nexport default function YamlCol({ yamlNode, panel }: Props) {\n const { type, style, xs, children, ...unknownOptions } = yamlNode;\n assertNoUnknownKeys(yamlNode, unknownOptions);\n assertOptionalNumber(yamlNode, 'xs', xs);\n return (\n <Col\n className={classNames('yamymllayout-col', { col: !!xs })}\n style={style}\n xs={xs}\n >\n {map(yamlNode.children, (node, key) => renderYamlNode(node, key, panel))}\n </Col>\n );\n}\n","import { Alert } from 'react-bootstrap';\nimport type { YamlNode } from '../model';\nimport { KeyError, MissingKeysError } from '../utils';\nimport {\n assertNoUnknownKeys,\n assertOptionalBoolean,\n assertOptionalString,\n} from './asserts';\nimport type { YamlComponent } from '../model';\n\n/**\n * Store the mapping from Yaml `type` to React component handling the\n * rendering of such Yaml node\n */\nexport const yamlHardwareComponent: Record<\n string,\n React.ComponentType<any>\n> = {};\n\n/**\n * Register the Yaml type with the component used to render this Yaml node.\n */\nexport function registerHardwareComponent(\n name: string,\n component: React.ComponentType<any>\n) {\n yamlHardwareComponent[name] = component;\n}\n\nexport interface HardwareDesc {\n id: string;\n}\n\nexport type HardwareListDesc = HardwareDesc[];\n\nexport interface HardwareGroupProps {\n fetched: boolean;\n fetchedGroups: boolean;\n ids?: HardwareListDesc;\n groupid?: string;\n actions?: {\n fetch: () => void;\n fetchGroups: () => void;\n };\n even?: boolean;\n nowrap: boolean;\n}\n\nfunction assertHardwareDesc(\n yamlNode: YamlNode,\n value: any\n): asserts value is HardwareDesc {\n if (value === undefined) {\n // FIXME: That's not a nice exception in this case, the rendering will be bad\n throw new MissingKeysError(yamlNode, ['id']);\n }\n if (typeof value.id !== 'string') {\n // FIXME: That's not a nice exception in this case, the rendering will be bad\n throw new KeyError(yamlNode, 'id', 'A string is expected');\n }\n}\n\nfunction assertOptionalHardwareListDesc(\n yamlNode: YamlNode,\n key: string,\n value: any\n): asserts value is HardwareListDesc | undefined {\n if (value === undefined) {\n return;\n }\n if (!Array.isArray(value)) {\n throw new KeyError(yamlNode, 'ids', 'A option list is expected');\n }\n\n value.forEach((hardwareDesc, i) => {\n try {\n assertHardwareDesc(yamlNode, hardwareDesc);\n } catch {\n // FIXME: For now we catch it, but assertHardwareDesc could do a better job\n throw new KeyError(\n yamlNode,\n 'ids',\n `The hardware description ${i} is wrong`\n );\n }\n });\n}\n\nexport default function YamlHardwareGroup(props: YamlComponent) {\n const {\n providers = {},\n yamlNode,\n ids,\n groupid,\n even,\n nowrap,\n ...unknownOptions\n } = props;\n assertOptionalHardwareListDesc(yamlNode, 'ids', ids);\n assertOptionalString(yamlNode, 'groupid', groupid);\n assertOptionalBoolean(yamlNode, 'even', even);\n assertOptionalBoolean(yamlNode, 'nowrap', nowrap);\n assertNoUnknownKeys(yamlNode, unknownOptions);\n\n if (!yamlHardwareComponent.HardwareGroup) {\n return (\n <Alert variant=\"warning\">No `HardwareGroup` component registered</Alert>\n );\n }\n\n const HardwareGroup = yamlHardwareComponent.HardwareGroup;\n return (\n <HardwareGroup\n providers={providers}\n ids={ids}\n groupid={groupid}\n nowrap={nowrap || false}\n even={even || false}\n />\n );\n}\n","import { Suspense } from 'react';\nimport { Alert } from 'react-bootstrap';\nimport Panel from '../layout/Panel';\nimport type { YamlNode } from './model';\nimport YamlHardwareGroup from './components/HardwareGroup';\n\nexport const componentMap: Record<string, React.ComponentType<any>> = {\n hardwaregroup: YamlHardwareGroup,\n};\nexport function registerComponent(\n name: string,\n component: React.ComponentType<any>\n) {\n componentMap[name] = component;\n}\n\ninterface YamlComponentNode extends YamlNode {\n type: string;\n [name: string]: any;\n scroll?: boolean;\n style?: Record<string, any>;\n title?: string;\n}\n\nexport default function YamlComponent(props: {\n yamlNode: YamlComponentNode;\n panel: boolean;\n}) {\n const { yamlNode, panel } = props;\n const { type, style, scroll, title, ...remainingContent } = yamlNode;\n if (!(type in componentMap)) {\n return (\n <Panel>\n <Panel.Contents>\n <Alert variant=\"warning\">Unknown component "{type}"</Alert>\n </Panel.Contents>\n </Panel>\n );\n }\n const Comp = componentMap[yamlNode.type];\n if (panel) {\n return (\n <Panel style={style} scroll={scroll}>\n <Suspense fallback={<p>Loading...</p>}>\n {title && <Panel.Header>{title}</Panel.Header>}\n <Panel.Contents>\n <Comp {...remainingContent} yamlNode={yamlNode} />\n </Panel.Contents>\n </Suspense>\n </Panel>\n );\n }\n return (\n <Suspense fallback={<p>Loading...</p>}>\n <Comp {...remainingContent} yamlNode={yamlNode} />\n </Suspense>\n );\n}\n","import { map } from 'lodash';\nimport { Container } from 'react-bootstrap';\nimport { renderYamlNode } from './utils';\n\ninterface Props {\n yamlNode: {\n children: any[];\n options?: Record<string, any>;\n };\n panel: boolean;\n}\n\nexport default function YamlContainer({ yamlNode, panel }: Props) {\n const options = yamlNode.options || {};\n return (\n <Container className=\"ymllayout-container\" {...options}>\n {map(yamlNode.children, (node, key) => renderYamlNode(node, key, panel))}\n </Container>\n );\n}\n","import type { ReactElement, CSSProperties } from 'react';\nimport { map } from 'lodash';\nimport Panel from '../layout/Panel';\nimport { renderYamlNode } from './utils';\n\ninterface Props {\n yamlNode: {\n children: any[];\n options?: Record<string, any>;\n title?: string;\n };\n panel: boolean;\n}\n\nexport default function YamlPanel(props: Props): ReactElement {\n const { yamlNode } = props;\n const options = yamlNode.options || {};\n const contentsStyle: CSSProperties = {};\n if (options.centerContent) {\n contentsStyle.margin = 'auto';\n }\n\n return (\n <Panel className=\"ymllayout-panel\" {...options}>\n {yamlNode.title && <Panel.Header>{yamlNode.title}</Panel.Header>}\n <Panel.Contents style={contentsStyle}>\n {map(yamlNode.children, (node, key) =>\n renderYamlNode(node, key, false)\n )}\n </Panel.Contents>\n </Panel>\n );\n}\n","import { each } from 'lodash';\nimport { Tab, Tabs } from 'react-bootstrap';\nimport Panel from '../layout/Panel';\nimport { renderYamlNode } from './utils';\n\nconst hash = () => {\n return (\n Math.random().toString(36).slice(2, 15) +\n Math.random().toString(36).slice(2, 15)\n );\n};\n\ninterface Props {\n yamlNode: {\n children: any[];\n options?: Record<string, any>;\n title: string;\n };\n panel: boolean;\n}\n\nexport default function YamlTabs({ yamlNode, panel }: Props) {\n const tabs: React.ReactElement[] = [];\n each(yamlNode.children, (t, i) => {\n tabs.push(\n <Tab key={i} eventKey={hash()} title={t.title}>\n {renderYamlNode(t, 0, false)}\n </Tab>\n );\n });\n\n return panel ? (\n <Panel className=\"ymllayout-tabs\">\n {yamlNode.title && <Panel.Header>{yamlNode.title}</Panel.Header>}\n <Panel.Contents>\n <Tabs mountOnEnter>{tabs}</Tabs>\n </Panel.Contents>\n </Panel>\n ) : (\n <Tabs>{tabs}</Tabs>\n );\n}\n","import { map } from 'lodash';\nimport Panel from '../layout/Panel';\nimport type { ReactChild } from 'react';\nimport { assertOnRemainingKeys, renderYamlNode } from './utils';\nimport type { YamlNode } from './model';\n\ninterface YamlFormHeaderNode extends YamlNode {\n type: 'formheader';\n title?: string;\n}\n\ninterface YamlFormRowNode extends YamlNode {\n type: string;\n title: string;\n component?: string;\n stateinheader?: boolean;\n titlealign?: string;\n id?: string;\n variant?: string;\n options?: Record<string, any>;\n even: boolean;\n}\n\ninterface YamlFormNode extends YamlNode {\n children: (YamlFormHeaderNode | YamlFormRowNode)[];\n title?: string;\n [key: string]: any;\n}\n\nfunction Header(props: { node: YamlFormHeaderNode; row: number }) {\n const { node } = props;\n const { type, title, ...remainingContent } = node;\n assertOnRemainingKeys(node, remainingContent);\n return (\n <div style={{ gridColumn: '1 / 3' }}>\n <h3>{title}</h3>\n </div>\n );\n}\n\n/**\n * Render the title of a row.\n *\n * It supports a fixed title, and can display formatted hardware id and state.\n */\nfunction RowTitle(props: {\n node: YamlFormRowNode;\n state: ReactChild | null;\n row: number;\n}) {\n const { node, state, row } = props;\n const { title } = node;\n\n function getId() {\n if (node.id) {\n return node.id;\n }\n return undefined;\n }\n\n function getText() {\n if (title !== undefined) {\n return title;\n }\n if (node.type === 'hardware') {\n const id = getId();\n const idContent = {\n _parentNode: node._parentNode,\n _indexFromParent: node._indexFromParent,\n type: 'hardware',\n id,\n variant: 'name',\n emptyifnone: true,\n };\n return renderYamlNode(idContent, 'a', false);\n }\n return '';\n }\n const text = getText();\n\n return (\n <div\n style={{\n textAlign: 'center',\n }}\n >\n <h5\n style={{\n margin: '0px',\n whiteSpace: 'nowrap',\n }}\n >\n {text}\n </h5>\n {state && <div style={{ position: 'relative', top: -5 }}>{state}</div>}\n </div>\n );\n}\n\nfunction Row(props: { node: YamlFormRowNode; row: number }) {\n const { node, row } = props;\n const {\n titlealign,\n title,\n stateinheader = false,\n variant,\n id,\n ...remainingContent\n } = node;\n let newContent;\n let state;\n if (remainingContent.type === 'hardware') {\n newContent = {\n ...remainingContent,\n id,\n variant,\n };\n if (stateinheader) {\n const stateContent = {\n ...remainingContent,\n id,\n variant: 'state',\n emptyifnone: true,\n };\n state = renderYamlNode(stateContent, 'k', false);\n } else {\n state = null;\n }\n } else {\n newContent = remainingContent;\n state = null;\n }\n return (\n <>\n <div\n style={{\n gridColumn: 1,\n alignSelf: titlealign ?? 'center',\n }}\n >\n <RowTitle node={node} state={state} row={row} />\n </div>\n <div style={{ gridColumn: 2 }}>\n {renderYamlNode(newContent, 'k', false)}\n </div>\n </>\n );\n}\n\nexport default function YamlForm(props: {\n yamlNode: YamlFormNode;\n panel: boolean;\n}) {\n const { yamlNode, panel } = props;\n const { type, children, options = {}, title, ...remainingContent } = yamlNode;\n assertOnRemainingKeys(yamlNode, remainingContent);\n\n return (\n <Panel className=\"ymllayout-form\" {...options}>\n {yamlNode.title && <Panel.Header>{yamlNode.title}</Panel.Header>}\n <Panel.Contents>\n <div\n style={{\n display: 'grid',\n gridTemplateColumns: 'min-content auto',\n }}\n >\n {map(children, (content, key) => {\n if (content.type === 'formheader') {\n return (\n <Header\n node={content as YamlFormHeaderNode}\n key={key}\n row={key}\n />\n );\n }\n return (\n <Row node={content as YamlFormRowNode} key={key} row={key} />\n );\n })}\n </div>\n </Panel.Contents>\n </Panel>\n );\n}\n","import { map } from 'lodash';\nimport { renderYamlNode } from './utils';\nimport type { YamlNode } from './model';\n\ninterface YamlGridNode extends YamlNode {\n children: YamlGridCellNode[];\n title?: string;\n columns?: string;\n rows?: string;\n}\n\ninterface YamlGridCellNode extends YamlNode {\n columnSpan?: number;\n rowSpan?: number;\n}\n\nexport default function YamlGrid(props: {\n yamlNode: YamlGridNode;\n panel: boolean;\n}) {\n const { yamlNode, panel } = props;\n return (\n <div\n className=\"ymllayout-grid\"\n style={{\n gridTemplateColumns: yamlNode.columns,\n gridTemplateRows: yamlNode.rows,\n }}\n >\n {map(yamlNode.children, (content, key) => {\n const { columnSpan = 1, rowSpan = 1, ...remainingContent } = content;\n const gridColumn = columnSpan > 1 ? `span ${columnSpan}` : undefined;\n const gridRow = rowSpan > 1 ? `span ${rowSpan}` : undefined;\n return (\n <div\n key={key}\n className=\"ymllayout-grid-cell\"\n style={{\n gridColumn,\n gridRow,\n }}\n >\n {renderYamlNode(remainingContent, key, panel)}\n </div>\n );\n })}{' '}\n </div>\n );\n}\n","import React from 'react';\nimport { OptionalPanel } from './utils';\n\ninterface Props {\n yamlNode: {\n children: any[];\n options?: {\n [name: string]: any;\n scroll?: boolean;\n style?: Record<string, any>;\n };\n label?: string;\n };\n panel: boolean;\n}\n\nexport default function YamlLabel({ yamlNode, panel }: Props) {\n const options = yamlNode.options || {};\n return (\n <OptionalPanel panel={panel} options={options}>\n <div>{yamlNode.label}</div>\n </OptionalPanel>\n );\n}\n","import { useMemo } from 'react';\nimport { Alert } from 'react-bootstrap';\nimport Panel from '../layout/Panel';\nimport ErrorBoundary from './ErrorBoundary';\nimport YamlRow from './Row';\nimport YamlCol from './Col';\nimport YamlComponent from './Component';\nimport YamlContainer from './Container';\nimport YamlPanel from './Panel';\nimport YamlTabs from './Tabs';\nimport YamlForm from './Form';\nimport YamlGrid from './Grid';\nimport YamlLabel from './Label';\nimport { renderYamlNode, registerYamlType, normalizeLayout } from './utils';\nimport type { YamlRoot } from './model';\n\nexport const yamlMap = {\n row: YamlRow,\n col: YamlCol,\n container: YamlContainer,\n component: YamlComponent,\n panel: YamlPanel,\n tabs: YamlTabs,\n form: YamlForm,\n grid: YamlGrid,\n label: YamlLabel,\n};\n\nObject.entries(yamlMap).forEach(([type, YamlComponent]) => {\n registerYamlType(type, YamlComponent);\n});\n\ninterface Props {\n id: string;\n layout: YamlRoot;\n className?: string;\n}\n\nexport default function Main(props: Props) {\n const layout = useMemo(() => {\n return normalizeLayout(props.layout);\n }, [props.layout]);\n\n if (layout.error) {\n return (\n <div className={`${props.className ?? ''} ymllayout-main`} id={props.id}>\n <Panel>\n <Panel.Header>Layout Error</Panel.Header>\n <Panel.Contents>\n <p>File: {layout.name}</p>\n <Alert variant=\"warning\">\n <pre className=\"mb-0\">{layout.error}</pre>\n </Alert>\n </Panel.Contents>\n </Panel>\n </div>\n );\n }\n\n return (\n <div className={`${props.className ?? ''} ymllayout-main`} id={props.id}>\n <ErrorBoundary resetKey={layout}>\n {layout.children?.map((node, key) => renderYamlNode(node, key))}\n </ErrorBoundary>\n </div>\n );\n}\n","import { map } from 'lodash';\nimport type { ComponentType, PropsWithChildren } from 'react';\nimport classNames from 'classnames';\nimport { Row, Col, Container } from 'react-bootstrap';\nimport { MonitorHardware } from './MonitorHardware';\nimport type { Monitor } from './types';\n\ninterface MonitorMapping {\n [name: string]: ComponentType<any>;\n}\n\nexport const monitorMap: MonitorMapping = {\n hardware: MonitorHardware,\n};\n\nexport function registerMonitorComponent(\n name: string,\n component: React.ComponentType<any>\n) {\n monitorMap[name] = component;\n}\n\nfunction YmlError(props: { monitor: Monitor; message: string }) {\n return (\n <Col\n className=\"monitor-panel-item bg-fatal\"\n title={`Error from yaml configuration: ${props.message}`}\n >\n <h1>{props.monitor.name}</h1>\n <div>Parsing error</div>\n </Col>\n );\n}\n\nexport interface MonitorPanelProps {\n monitors: Monitor[];\n margin?: 'start' | null;\n bg?: 'light' | null;\n}\n\nexport function MonitorPanel(props: MonitorPanelProps) {\n const properties = map(props.monitors, (monitor, i) => {\n const type = monitor.type ?? 'hardware';\n const Comp = monitorMap[type];\n if (Comp === undefined) {\n return (\n <YmlError\n key={`m${i}`}\n monitor={monitor}\n message={`Type ${type} unsupported`}\n />\n );\n }\n return <Comp key={`m${i}`} monitor={monitor} />;\n });\n\n return (\n <div\n className={classNames(\n { 'ms-auto': props.margin === 'start' },\n 'me-auto',\n 'monitor-panel',\n { 'monitor-panel-light': props.bg === 'light' }\n )}\n >\n <Container fluid>\n <Row className=\"flex-nowrap\">{properties}</Row>\n </Container>\n </div>\n );\n}\n\ninterface MonitorPanelItemProps {}\n\nexport function MonitorPanelItem(\n props: PropsWithChildren<MonitorPanelItemProps>\n) {\n return <Col className=\"monitor-panel-item\">{props.children}</Col>;\n}\n","import { Fragment } from 'react';\nimport type { ReactNode } from 'react';\nimport { Col, OverlayTrigger, Tooltip } from 'react-bootstrap';\nimport type { Monitor } from './types';\nimport type { Hardware } from '../hardware/utils/types';\nimport { MonitorPanelItem } from './MonitorPanel';\n\nconst runtimeHooks: Record<string, (id: string | null) => Hardware | null> = {};\n\nexport function registerRuntimeHook(\n name: string,\n hook: (id: string | null) => Hardware | null\n) {\n runtimeHooks[name] = hook;\n}\n\nfunction useHardware(id: string | null) {\n if (!runtimeHooks.useHardware) {\n throw new Error('No `useHardware` hook registered');\n }\n return runtimeHooks.useHardware(id);\n}\n\nexport const dynamicOp = (op: string, a1: any, b1: any) => {\n const operators: { [op: string]: (a: any, b: any) => boolean } = {\n '>': (a, b) => a > b,\n '<': (a, b) => a < b,\n '>=': (a, b) => a >= b,\n '<=': (a, b) => a <= b,\n '==': (a, b) => a === b,\n '!=': (a, b) => a !== b,\n in: (a, b) => b.indexOf(a) > -1,\n };\n\n if (op in operators) return operators[op](a1, b1);\n return undefined;\n};\n\nfunction rsplit(s: string, separator: string, limits?: number): string[] {\n const split = s.split(separator);\n return limits\n ? [split.slice(0, -limits).join(separator)].concat(split.slice(-limits))\n : split;\n}\n\nexport function useValue(valuePath: string | undefined): unknown {\n const path = valuePath !== undefined ? rsplit(valuePath, '.', 1) : [null, ''];\n const obj = useHardware(path[0]);\n if (!obj) {\n return undefined;\n }\n if (!obj.properties) {\n return undefined;\n }\n if (path[1] === null) {\n return undefined;\n }\n if (!Array.isArray(obj.properties[path[1]])) {\n return obj.properties[path[1]];\n }\n return obj.properties[path[1]][0];\n}\n\nexport function useUnit(unitPath?: string): string | undefined {\n const isFixedUnit = unitPath !== undefined && !unitPath.includes('.');\n const path = unitPath !== undefined ? rsplit(unitPath, '.', 1) : [null, ''];\n const obj = useHardware(path[0]);\n if (isFixedUnit) {\n // That's a fixed unit defined as an option\n return unitPath;\n }\n if (!obj) {\n return undefined;\n }\n if (!obj.properties) {\n // The unit is maybe not yet there\n return undefined;\n }\n if (path[1] === null) {\n return undefined;\n }\n return `${obj.properties[path[1]]}`;\n}\n\nexport function MonitorHardware(props: { monitor: Monitor }) {\n const { monitor } = props;\n\n let value = useValue(monitor.value) ?? '-';\n const unit = useUnit(monitor.unit);\n const overlay = useValue(monitor.overlay);\n\n const flt = Number.parseFloat(`${value}`);\n if (!Number.isNaN(flt)) {\n const str = String(flt);\n if (str.length > 5) {\n value = flt.toPrecision(5);\n }\n }\n\n let checkClass;\n if (monitor.comparator && monitor.comparison) {\n const check = dynamicOp(monitor.comparator, value, monitor.comparison);\n checkClass = check ? 'valid' : 'invalid';\n }\n\n if (!Number.isNaN(flt)) {\n if (unit !== undefined) {\n value = `${value} ${unit}`;\n }\n }\n\n let Wrap: ReactNode = Fragment;\n const wrapProps: { [name: string]: any } = {};\n\n if (overlay) {\n const overlayStr = `${overlay}`;\n let TooltipWrap: ReactNode = Fragment;\n if (overlayStr.includes('\\n')) {\n TooltipWrap = 'pre';\n }\n\n Wrap = OverlayTrigger;\n wrapProps.placement = 'bottom';\n wrapProps.overlay = (\n <Tooltip id=\"tooltipid\" className=\"monitor-panel-tooltip\">\n {\n // @ts-expect-error\n <TooltipWrap>{overlayStr}</TooltipWrap>\n }\n </Tooltip>\n );\n }\n return (\n // @ts-expect-error\n <Wrap {...wrapProps} key={monitor.name}>\n <MonitorPanelItem>\n <h1>{monitor.name}</h1>\n <div className={checkClass}>{`${value}`}</div>\n </MonitorPanelItem>\n </Wrap>\n );\n}\n"],"names":["OnlineStatus","props","activeMessage","inactiveMessage","message","jsx","TypeIcon","name","icon","jsxs","formatEng","scalar","powerPrefix","q","subtrhnd","pow10","prefix","ucfirst","str","toHoursMins","seconds","min","mins","hours","toEnergy","wavelength","round","value","digits","FrontendOverlay","hardware","reset","e","itlks","ring","getPropertyState","key","state","OverlayTrigger","Popover","Container","map","Row","Col","Badge","prop","Button","Frontend","options","onClick","ButtonGroup","Info","getValue","propertyName","result","segment","Fragment","HardwareTemplate","headerMode","getLabel","label","Form","error","HardwareState","style","MotorState","getState","s1","ShutterState","s","getVariant","NumericStep","forwardRef","ref","stepSizeRef","useRef","currentStep","setCurrentStep","useState","onStep","up","ref2","val","stepSize","onStepProp","step","overlay","incIcon","decIcon","swapIncDec","onKeyDown","horizontalArrows","largeArrows","rest","onKeyDown2","steps","classNames","InputGroup","NumericStep$1","HardwareNumericStep","valueRef","edited","setEdited","setError","useEffect","updateRef","newValue","onBlur","onChange","promise","HardwareInputNumber","normalizeNumber","_a","MotorOverlay","onMoveVelocityRequested","target","onMoveAccelerationRequested","MotorDefault","onAbortRequested","onMovePositionRequested","widgetIcon","widgetState","Multiposition","selectionRef","onMove","stop","opts","p","logger","debug","NoObject","widgetContent","DeviceState","Property","getUnit","unitName","unit","ShutterOverlay","ShutterDefault","getAction","action","variant","HardwareVariant","Component","Comp","FullSizer","setState","containerRef","view","PanelHeader","PanelContents","Panel","Wrap","yamlWrapperMap","registerYamlType","component","renderYamlNode","yamlNode","panel","type","OptionalPanel","children","Children","child","isValidElement","cloneElement","assertOnRemainingKeys","remainingContent","_parentNode","_indexFromParent","remainingContent2","UnknownKeysError","LayoutError","unknownKeys","MissingKeysError","missingKeys","KeyError","getYamlRoot","node","n","getYamlHierarchy","path","normalizeLayout","parentNode","indexFromParent","newNode","c","i","DefaultErrorMessage","Alert","LayoutErrorMessage","formatPreview","indent","lines","actualIndentation","k","layoutName","INITIAL_STATE","ErrorBoundary","prevProps","prevState","assertKeyExpected","assertString","assertBoolean","assertNumber","assertOptionalBoolean","assertOptionalString","assertStringList","v","assertOptionalStringOrStringList","assertOptionalStringList","assertOptionalNumber","assertOptionalNumberList","assertNoUnknownKeys","assertDataCollectionId","assertOptionalBackend","YamlRow","unknownOptions","YamlCol","xs","yamlHardwareComponent","registerHardwareComponent","assertHardwareDesc","assertOptionalHardwareListDesc","hardwareDesc","YamlHardwareGroup","providers","ids","groupid","even","nowrap","HardwareGroup","componentMap","registerComponent","YamlComponent","scroll","title","Suspense","YamlContainer","YamlPanel","contentsStyle","hash","YamlTabs","tabs","each","t","Tab","Tabs","Header","RowTitle","row","getId","getText","id","idContent","text","titlealign","stateinheader","newContent","stateContent","YamlForm","content","YamlGrid","columnSpan","rowSpan","gridColumn","gridRow","YamlLabel","yamlMap","Main","layout","useMemo","monitorMap","MonitorHardware","registerMonitorComponent","YmlError","MonitorPanel","properties","monitor","MonitorPanelItem","runtimeHooks","registerRuntimeHook","hook","useHardware","dynamicOp","op","a1","b1","operators","a","b","rsplit","separator","limits","split","useValue","valuePath","obj","useUnit","unitPath","isFixedUnit","flt","checkClass","wrapProps","overlayStr","TooltipWrap","Tooltip","createElement"],"mappings":"+SASO,SAASA,GAAaC,EAAc,CACnC,KAAA,CACJ,cAAAC,EAAgB,SAChB,gBAAAC,EAAkB,UAClB,QAAAC,EAAU,gBACR,EAAA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N,EAAa,GAAG1N,CAAO,GAC7B,IAAI2N,EAAyBzP,EAAAA,SACzBwP,EAAW,SAAS;AAAA,CAAI,IACZC,EAAA,OAGTzJ,EAAAlH,EAAAA,eACPyQ,EAAU,UAAY,SACtBA,EAAU,QACP1S,EAAA,IAAA6S,UAAA,CAAQ,GAAG,YAAY,UAAU,wBAG9B,SAAA7S,EAAAA,IAAC4S,GAAa,SAAWD,CAAA,CAAA,CAAA,CAE7B,CAEJ,CACA,OAEEG,EAAAA,cAAC3J,GAAM,GAAGuJ,EAAW,IAAKzB,EAAQ,aAC/BC,GACC,CAAA,SAAA,CAAClR,EAAAA,IAAA,KAAA,CAAI,WAAQ,IAAK,CAAA,QACjB,MAAI,CAAA,UAAWyS,EAAa,SAAA,GAAGnR,CAAK,GAAG,CAAA,CAAA,CAC1C,CACF,CAEJ"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/hardware/TypeIcon.tsx","../src/utils/formatting.ts","../src/hardware/Frontend.tsx","../src/hardware/Info.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","../src/hardware/Multiposition.tsx","../src/hardware/NoObject.tsx","../src/hardware/Property.tsx","../src/hardware/ShutterDefault.tsx","../src/hardware/HardwareVariant.tsx","../src/components/FullSizer.tsx","../src/layout/Panel.tsx","../src/yaml-layout/utils.tsx","../src/yaml-layout/ErrorBoundary.tsx","../src/yaml-layout/components/asserts.ts","../src/yaml-layout/Row.tsx","../src/yaml-layout/Col.tsx","../src/yaml-layout/components/HardwareGroup.tsx","../src/yaml-layout/Component.tsx","../src/yaml-layout/Container.tsx","../src/yaml-layout/Panel.tsx","../src/yaml-layout/Tabs.tsx","../src/yaml-layout/Form.tsx","../src/yaml-layout/Grid.tsx","../src/yaml-layout/Label.tsx","../src/yaml-layout/Main.tsx","../src/monitorpanel/MonitorPanel.tsx","../src/monitorpanel/MonitorHardware.tsx"],"sourcesContent":["export interface Props {\n online: boolean;\n activeMessage?: string;\n inactiveMessage?: string;\n message?: string;\n icon: string;\n name: string;\n}\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","// https://github.com/gentooboontoo/js-quantities/issues/30\nexport function formatEng(scalar: number) {\n const powerPrefix: Record<number, string> = {\n 24: 'Y',\n 21: 'Z',\n 18: 'E',\n 15: 'P',\n 12: 'T',\n 9: 'G',\n 6: 'M',\n 3: 'k',\n '-3': 'm',\n '-6': '\\u00B5',\n '-9': 'n',\n '-12': 'p',\n '-15': 'f',\n '-18': 'a',\n '-21': 'z',\n '-24': 'y',\n };\n\n const q = Math.log(scalar) / Math.log(1e3);\n // so that for example '3 km' does not get converted to '3000 m'\n const subtrhnd = !Number.isInteger(q);\n\n const pow10 = 3 * Math.ceil(q - (subtrhnd ? 1 : 0));\n const prefix = pow10 === 0 ? '' : powerPrefix[pow10];\n\n return {\n scalar: scalar * 10 ** -pow10,\n prefix,\n multiplier: 10 ** -pow10,\n };\n}\n\n/**\n * Returns the argument as capitalized string.\n */\nexport function ucfirst(str: string) {\n return str.charAt(0).toUpperCase() + str.slice(1);\n}\n\nexport function toHoursMins(seconds: number) {\n if (seconds < 60) return `${Math.round(seconds)} sec`;\n\n const min = Math.round(seconds / 60);\n\n const mins = min % 60;\n const hours = Math.floor(min / 60);\n\n return hours ? `${hours} hr ${mins} min` : `${mins} min`;\n}\n\nexport function toEnergy(wavelength: number) {\n return wavelength > 0\n ? (\n ((6.626_070_04e-34 * 2.997_924_58e8) /\n (wavelength * 1e-10) /\n 1.602_18e-19) *\n 1e-3\n ).toFixed(4)\n : 0;\n}\n\nexport function round(value: number, digits: number) {\n return Number.parseFloat(value.toFixed(digits));\n}\n","import type { MouseEvent } from 'react';\nimport { map } from 'lodash';\nimport {\n Badge,\n Button,\n ButtonGroup,\n Container,\n Row,\n Col,\n OverlayTrigger,\n Popover,\n} from 'react-bootstrap';\n\nimport TypeIcon from './TypeIcon';\nimport { toHoursMins } from '../utils/formatting';\nimport type { HardwareWidgetProps } from './utils/types';\nimport type { FrontendSchema } from './utils/schema';\n\nfunction FrontendOverlay(props: HardwareWidgetProps<FrontendSchema>) {\n const { hardware } = props;\n function reset(e: any) {\n void hardware.requestChange({\n function: 'reset',\n });\n }\n\n type StateEnum = 'feitlk' | 'expitlk' | 'pssitlk';\n\n const itlks: { [name: string]: StateEnum } = {\n 'Front End': 'feitlk',\n Experimental: 'expitlk',\n PSS: 'pssitlk',\n };\n\n const ring = {\n Current: `${hardware.properties.current.toFixed(1)} mA`,\n Mode: hardware.properties.mode,\n Refill: toHoursMins(hardware.properties.refill),\n Message: <pre>{hardware.properties.message}</pre>,\n };\n\n function getPropertyState(key: StateEnum): string {\n if (!(key in hardware.properties)) {\n return 'UNKNOWN';\n }\n const state: any = hardware.properties[key];\n if (!state || typeof state !== 'string') {\n return 'UNKNOWN';\n }\n return state;\n }\n\n return (\n <OverlayTrigger\n trigger=\"click\"\n rootClose\n overlay={\n <Popover id=\"popid\">\n <Popover.Header>{hardware.name} Details</Popover.Header>\n <Popover.Body>\n <h6>Status</h6>\n <pre>{hardware.properties.status}</pre>\n <h6>Interlocks</h6>\n <Container>\n {map(itlks, (key, name) => (\n <Row key={name}>\n <Col>{name}:</Col>\n <Col>\n <Badge\n bg={getPropertyState(key) === 'ON' ? 'success' : 'danger'}\n >\n {getPropertyState(key)}\n </Badge>\n </Col>\n </Row>\n ))}\n </Container>\n\n <h6>Ring Status</h6>\n <Container>\n {map(ring, (prop, name) => (\n <Row key={name}>\n <Col>{name}:</Col>\n <Col>{prop}</Col>\n </Row>\n ))}\n </Container>\n\n <div className=\"d-grid gap-2\">\n <Button disabled={props.disabled} onClick={reset}>\n Reset\n </Button>\n </div>\n </Popover.Body>\n </Popover>\n }\n >\n <Button className=\"flex-grow-0\" title=\"Shutter Details\">\n <i className=\"fa fa-ellipsis-h\" />\n </Button>\n </OverlayTrigger>\n );\n}\n\nfunction Frontend(props: HardwareWidgetProps<FrontendSchema>) {\n const { hardware, options = {} } = props;\n function onClick(e: MouseEvent) {\n void hardware.requestChange({\n function: hardware.properties.frontend === 'FE open' ? 'close' : 'open',\n });\n }\n\n return (\n <div className=\"hw-component\">\n <div className=\"hw-head\">\n <TypeIcon\n name=\"Frontend\"\n icon=\"fam-hardware-frontend\"\n online={hardware.online}\n />\n <div className=\"name\">{hardware.name}</div>\n <Badge\n bg={\n hardware.properties.state === 'OPEN' ||\n hardware.properties.state === 'RUNNING'\n ? 'success'\n : 'danger'\n }\n >\n {hardware.properties.state}\n </Badge>\n </div>\n <div className=\"hw-content\">\n <ButtonGroup className=\"d-flex\">\n <Button\n variant={\n hardware.properties.frontend === 'FE open' ? 'danger' : 'success'\n }\n onClick={onClick}\n disabled={props.disabled}\n >\n {hardware.properties.frontend === 'FE open' ? 'Close' : 'Open'}\n </Button>\n <FrontendOverlay {...props} />\n </ButtonGroup>\n </div>\n </div>\n );\n}\n\nexport default Frontend;\n","import type {\n Hardware,\n HardwareWidgetProps,\n HardwareWidgetOptions,\n} from './utils/types';\n\nexport interface InfoOptions extends HardwareWidgetOptions {\n /** The property */\n property?: string;\n /** Unit for the property */\n unit?: string;\n}\n\nexport default function Info(\n props: HardwareWidgetProps<Hardware, InfoOptions>\n) {\n const { hardware, options = {} } = props;\n function getValue() {\n const propertyName = options.property;\n if (propertyName === undefined) {\n return `property is not set`;\n }\n if (propertyName === null) {\n return `property is null`;\n }\n let result: any = hardware;\n for (const segment of propertyName.split('/')) {\n result = result[segment];\n if (result === undefined) {\n return `property '${propertyName}' not found`;\n }\n }\n return `${result}`;\n }\n\n return <>{getValue()}</>;\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","import { useRef, useEffect } from 'react';\nimport { map } from 'lodash';\nimport { Badge, Button, InputGroup, Form } from 'react-bootstrap';\n\nimport TypeIcon from './TypeIcon';\nimport type { MultipositionSchema } from './utils/schema';\nimport type { HardwareWidgetProps } from './utils/types';\n\nexport default function Multiposition(\n props: HardwareWidgetProps<MultipositionSchema>\n) {\n const { hardware, options = {} } = props;\n const selectionRef = useRef<HTMLSelectElement>(null);\n\n useEffect(() => {\n if (!selectionRef.current) {\n console.error('selectionRef ref is unset');\n return;\n }\n selectionRef.current.value = hardware.properties.position;\n }, [hardware.properties.position]);\n\n function onMove(e: any) {\n console.debug('change', e);\n if (!selectionRef || !selectionRef.current) {\n console.error('selection ref is unset');\n return;\n }\n void hardware.requestChange({\n value: selectionRef.current.value,\n function: 'move',\n });\n }\n\n function stop(e: any) {\n void hardware.requestChange({\n function: 'stop',\n });\n }\n\n const opts = map(hardware.properties.positions, (p) => (\n <option key={p.position} title={p.description}>\n {p.position}\n </option>\n ));\n\n return (\n <div className=\"hw-component\">\n <div className=\"hw-head\">\n <TypeIcon\n name=\"Multiposition\"\n icon=\"fam-hardware-multiposition\"\n online={hardware.online}\n />\n <div className=\"name\">{hardware.name}</div>\n <Badge\n bg={hardware.properties.state === 'READY' ? 'success' : 'warning'}\n >\n {hardware.properties.state}\n </Badge>\n </div>\n <div className=\"hw-content\">\n <InputGroup>\n <Form.Control\n className=\"custom-select\"\n as=\"select\"\n ref={selectionRef}\n disabled={props.disabled}\n defaultValue={hardware.properties.position}\n >\n <option disabled>unknown</option>\n {opts}\n </Form.Control>\n {hardware.properties.state !== 'MOVING' && (\n <Button onClick={onMove} disabled={props.disabled}>\n Move\n </Button>\n )}\n\n {hardware.properties.state === 'MOVING' && !props.disabled && (\n <Button variant=\"danger\" onClick={stop}>\n <i className=\"fa fa-times\" />\n </Button>\n )}\n </InputGroup>\n </div>\n </div>\n );\n}\n","import debug from 'debug';\n\nimport TypeIcon from './TypeIcon';\nimport HardwareTemplate from './utils/HardwareTemplate';\nimport type { Hardware } from './utils/types';\n\nconst logger = debug('daiquiri.components.hardware.NoObject');\n\ninterface NoObjectProps {\n id: string;\n name?: string;\n options: {\n header?: string;\n emptyifnone?: boolean;\n };\n}\n\nexport default function NoObject(props: NoObjectProps) {\n if (props.options.emptyifnone) {\n logger(\n 'Component id:\"%s\" name:\"%s\" not displayed cause setup with emptyifnone.',\n props.id,\n props.name\n );\n return <></>;\n }\n\n const widgetIcon = (\n <TypeIcon name=\"NoObject\" icon=\"fam-hardware-any\" online={false} />\n );\n\n const widgetState = <></>;\n\n const widgetContent = <>Missing</>;\n\n const headerMode = props.options ? props.options.header : 'top';\n\n const hardware: Hardware = {\n id: props.id,\n name: props.name ?? '',\n alias: null,\n online: false,\n properties: {},\n type: '',\n };\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={widgetContent}\n headerMode={headerMode}\n />\n );\n}\n","import { InputGroup, Form, Badge } from 'react-bootstrap';\n\nimport TypeIcon from './TypeIcon';\nimport HardwareTemplate from './utils/HardwareTemplate';\nimport type { GenericSchema } from './utils/schema';\nimport type { HardwareWidgetProps, HardwareWidgetOptions } from './utils/types';\n\nfunction DeviceState(props: GenericSchema) {\n const state = props.online ? 'READY' : 'OFFLINE';\n return <Badge bg={state === 'READY' ? 'success' : 'warning'}>{state}</Badge>;\n}\n\ninterface PropertyWidgetOptions extends HardwareWidgetOptions {\n header?: string;\n property?: string;\n unit?: string;\n}\n\nexport default function Property(\n props: HardwareWidgetProps<GenericSchema, PropertyWidgetOptions>\n) {\n const { hardware, options = {} } = props;\n const widgetIcon = (\n <TypeIcon name=\"Optic\" icon=\"fa-cog\" online={hardware.online} />\n );\n\n const widgetState = <DeviceState {...hardware} />;\n\n function getValue() {\n const propertyName = options.property;\n if (propertyName === undefined) {\n return `property is not set`;\n }\n if (propertyName === null) {\n return `property is null`;\n }\n let result: any = hardware;\n for (const segment of propertyName.split('/')) {\n result = result[segment];\n if (result === undefined) {\n return `property '${propertyName}' not found`;\n }\n }\n return `${result}`;\n }\n\n function getUnit() {\n const unitName = options.unit;\n if (!unitName) {\n return null;\n }\n if (!unitName.includes('properties')) {\n // That's a fixed unit defined as an option\n return unitName;\n }\n\n let result: any = props;\n for (const segment of unitName.split('/')) {\n result = result[segment];\n if (result === undefined) {\n return null;\n }\n }\n return `${result}`;\n }\n\n const unit = getUnit();\n\n const widgetContent = (\n <InputGroup>\n <Form.Control value={getValue()} readOnly />\n {unit && <InputGroup.Text>{unit}</InputGroup.Text>}\n </InputGroup>\n );\n\n const headerMode = props.options.header || 'top';\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={widgetContent}\n headerMode={headerMode}\n />\n );\n}\n","import { Button, OverlayTrigger, Popover, ButtonGroup } from 'react-bootstrap';\n\nimport TypeIcon from './TypeIcon';\nimport HardwareTemplate from './utils/HardwareTemplate';\nimport { ShutterState } from './utils/State';\nimport type { ShutterSchema } from './utils/schema';\nimport type { HardwareWidgetProps, HardwareWidgetOptions } from './utils/types';\n\nfunction ShutterOverlay(\n props: HardwareWidgetProps<ShutterSchema, HardwareWidgetOptions>\n) {\n const { hardware } = props;\n const reset = () => {\n void hardware.requestChange({\n function: 'reset',\n });\n };\n\n return (\n <OverlayTrigger\n trigger=\"click\"\n rootClose\n overlay={\n <Popover id=\"popid\">\n <Popover.Header>{hardware.name} Details</Popover.Header>\n <Popover.Body>\n <h6>Status</h6>\n <pre>{hardware.properties.status}</pre>\n <div className=\"d-grid gap-2\">\n <Button onClick={reset} disabled={props.disabled}>\n Reset\n </Button>\n </div>\n </Popover.Body>\n </Popover>\n }\n >\n <Button className=\"flex-grow-0\" title=\"Shutter Details\">\n <i className=\"fa fa-ellipsis-h\" />\n </Button>\n </OverlayTrigger>\n );\n}\n\nexport default function ShutterDefault(\n props: HardwareWidgetProps<ShutterSchema, HardwareWidgetOptions>\n) {\n const { hardware, options = {} } = props;\n const widgetIcon = (\n <TypeIcon\n name=\"Shutter\"\n icon=\"fam-hardware-shutter\"\n online={hardware.online}\n />\n );\n\n const widgetState = <ShutterState hardware={hardware} />;\n\n function getState() {\n if (!hardware.properties) {\n return 'UNKNOWN';\n }\n return hardware.properties.state;\n }\n\n function getAction(s: string) {\n if (s === 'OPEN') {\n return ['Close', 'close'];\n }\n if (s === 'CLOSED') {\n return ['Open', 'open'];\n }\n if (s === 'DISABLED' || s === 'STANDBY' || s === 'FAULT') {\n return ['Closed', ''];\n }\n if (s === 'MOVING') {\n return ['...', ''];\n }\n return ['Unknown', ''];\n }\n\n const state = getState();\n // console.log(state);\n const [label, action] = getAction(state);\n const variants: { [name: string]: string } = {\n OPEN: 'danger',\n CLOSED: 'success',\n MOVING: 'warning',\n DISABLED: 'secondary',\n STANDBY: 'danger',\n FAULT: 'fatal',\n UNKNOWN: 'warning',\n };\n const variant = variants[state] || 'danger';\n\n function onClick() {\n void hardware.requestChange({\n function: action,\n });\n }\n\n const widgetContent = (\n <ButtonGroup className=\"d-flex flex-nowrap\">\n <Button\n variant={variant}\n onClick={onClick}\n disabled={props.disabled || action === ''}\n >\n {label}\n </Button>\n\n {options.extended && <ShutterOverlay {...props} />}\n </ButtonGroup>\n );\n\n const headerMode = props.options.header || 'top';\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={widgetContent}\n headerMode={headerMode}\n />\n );\n}\n","import { Component } from 'react';\nimport type { ComponentType } from 'react';\n\ninterface HardwareVariantOptions {\n options: {\n variant: string;\n };\n}\n\nexport default class HardwareVariant extends Component<\n HardwareVariantOptions,\n void\n> {\n public variants: {\n [name: string]: ComponentType<any>;\n } = {};\n\n public render() {\n let Comp = this.variants.default;\n\n if (this.props.options.variant in this.variants) {\n Comp = this.variants[this.props.options.variant];\n }\n\n return <Comp {...this.props} />;\n }\n}\n","import type { PropsWithChildren } from 'react';\nimport { useEffect, useRef, useState } from 'react';\n\ninterface Props {\n className?: string;\n}\n\nexport default function FullSizer(props: PropsWithChildren<Props>) {\n const [state, setState] = useState<Record<string, number>>({});\n const containerRef = useRef<HTMLDivElement>(null);\n useEffect(() => {\n if (containerRef.current) {\n const view = containerRef.current;\n setState({\n width: view.clientWidth,\n height: view.clientHeight,\n });\n }\n }, []);\n\n return (\n <div\n ref={containerRef}\n style={{ width: '100%', height: '100%' }}\n className={props.className}\n >\n {state.width > 0 && (\n <div\n className=\"full-sizer\"\n style={{\n width: `${state.width}px`,\n height: `${state.height}px`,\n overflow: 'scroll',\n }}\n >\n {props.children}\n </div>\n )}\n </div>\n );\n}\n","import type { ReactChild, PropsWithChildren } from 'react';\nimport { Fragment } from 'react';\nimport FullSizer from '../components/FullSizer';\n\nfunction PanelHeader(props: {\n children?: ReactChild | ReactChild[];\n style?: Record<string, any>;\n}) {\n return (\n <div className=\"panel-header\" style={props.style}>\n {props.children}\n </div>\n );\n}\n\nfunction PanelContents(props: {\n children?: ReactChild | ReactChild[];\n style?: Record<string, any>;\n}) {\n return (\n <div className=\"panel-contents\" style={props.style}>\n {props.children}\n </div>\n );\n}\n\ninterface Props {\n style?: Record<string, any>;\n scroll?: boolean;\n className?: string;\n}\n\nfunction Panel(props: PropsWithChildren<Props>) {\n const Wrap = props.scroll ? FullSizer : Fragment;\n\n return (\n <div className={`panel ${props.className ?? ''}`} style={props.style}>\n <Wrap>{props.children}</Wrap>\n </div>\n );\n}\n\nPanel.Header = PanelHeader;\nPanel.Contents = PanelContents;\n\nexport default Panel;\n","import type { ReactChild } from 'react';\nimport { Children, cloneElement, isValidElement } from 'react';\nimport Panel from '../layout/Panel';\nimport type { AnyYamlNode, YamlNode, YamlRoot } from './model';\n\n/**\n * Store the mapping from Yaml `type` to React component handling the\n * rendering of such Yaml node\n */\nexport const yamlWrapperMap: Record<string, React.ComponentType<any>> = {};\n\n/**\n * Register the Yaml type with the component used to render this Yaml node.\n */\nexport function registerYamlType(\n name: string,\n component: React.ComponentType<any>\n) {\n yamlWrapperMap[name] = component;\n}\n\n/**\n * Render a Yaml node using registred component from the node type\n */\nexport function renderYamlNode(\n yamlNode: AnyYamlNode,\n key: number | string,\n panel = true\n): ReactChild {\n // Allow null nodes to be ignored (useful for templating)\n if (!yamlNode) return <></>;\n const { type } = yamlNode;\n const Comp =\n type && type in yamlWrapperMap\n ? yamlWrapperMap[type]\n : yamlWrapperMap.component;\n return <Comp yamlNode={yamlNode} key={key} panel={panel} />;\n}\n\ninterface OptionalPanelProps {\n children?: ReactChild | ReactChild[];\n [name: string]: any;\n scroll?: boolean;\n style?: Record<string, any>;\n panel: boolean;\n key?: number | string;\n}\n\n/**\n * Wrap the children into a panel if it is requested by the options\n */\nexport function OptionalPanel({\n children,\n key,\n panel,\n options,\n}: OptionalPanelProps) {\n return panel ? (\n <Panel key={key} style={options.style} scroll={options.scroll}>\n <Panel.Contents>{children}</Panel.Contents>\n </Panel>\n ) : (\n <>\n {Children.map(children, (child) =>\n isValidElement(child)\n ? cloneElement(child, { key, ...child.props })\n : undefined\n )}\n </>\n );\n}\n\nexport function assertOnRemainingKeys(\n yamlNode: YamlNode | undefined,\n remainingContent: Record<string, any>\n) {\n const { _parentNode, _indexFromParent, ...remainingContent2 } =\n remainingContent;\n if (yamlNode) {\n if (Object.keys(remainingContent2).length > 0) {\n throw new UnknownKeysError(yamlNode, Object.keys(remainingContent2));\n }\n }\n}\n\nexport class LayoutError extends Error {\n public readonly yamlNode: YamlNode;\n public constructor(message: string, yamlNode: YamlNode) {\n super(message);\n this.yamlNode = yamlNode;\n }\n}\n\nexport class UnknownKeysError extends LayoutError {\n public readonly keys: string[];\n public constructor(yamlNode: YamlNode, unknownKeys: string[]) {\n super(`Unexpected keys: ${unknownKeys.join(', ')}`, yamlNode);\n this.keys = unknownKeys;\n }\n}\n\nexport class MissingKeysError extends LayoutError {\n public readonly keys: string[];\n public constructor(yamlNode: YamlNode, missingKeys: string[]) {\n super(`Keys ${missingKeys.join(', ')} are missing`, yamlNode);\n this.keys = missingKeys;\n }\n}\n\nexport class KeyError extends LayoutError {\n public readonly key: string;\n public readonly keyMessage: string;\n public constructor(yamlNode: YamlNode, key: string, message: string) {\n super(`Key ${key} error: ${message}`, yamlNode);\n this.key = key;\n this.keyMessage = message;\n }\n}\n\n/**\n * Returns the root of the YamlNode\n */\nexport function getYamlRoot(node: YamlNode): YamlRoot {\n let n = node;\n while (n._parentNode) {\n n = n._parentNode;\n }\n return n as YamlRoot;\n}\n\n/**\n * Returns a list of nodes from the root to this node.\n */\nexport function getYamlHierarchy(\n node: YamlNode\n): { node: YamlNode; indexFromParent: number | null }[] {\n const path: { node: YamlNode; indexFromParent: number | null }[] = [];\n let n: YamlNode | null = node;\n while (n) {\n path.push({\n node: n,\n indexFromParent: n._indexFromParent,\n });\n n = n._parentNode;\n }\n path.reverse();\n return path;\n}\n\n/**\n * Create links between layout node in order to simplify further processing\n * (mainly error handling).\n */\nexport function normalizeLayout<R extends YamlNode>(\n node: R,\n parentNode: YamlNode | null = null,\n indexFromParent: number | null = null\n): R {\n if (node._parentNode) {\n throw new Error(\n 'Attribute _parentNode was already defined by the yml layout.'\n );\n }\n const newNode = {\n ...node,\n _parentNode: parentNode,\n _indexFromParent: indexFromParent,\n };\n if (node.children) {\n // NOTE: use a map from a real array\n const children = [...node.children];\n Object.freeze(children);\n newNode.children = children.map((c, i) => normalizeLayout(c, newNode, i));\n }\n Object.freeze(newNode);\n return newNode;\n}\n","import type { PropsWithChildren } from 'react';\nimport { Component } from 'react';\nimport { Container, Alert, Button } from 'react-bootstrap';\nimport {\n KeyError,\n MissingKeysError,\n UnknownKeysError,\n getYamlHierarchy,\n getYamlRoot,\n LayoutError,\n} from './utils';\n\ninterface State {\n hasError: boolean;\n message: string;\n error?: Error;\n}\n\ntype Props = PropsWithChildren<{ resetKey?: any }>;\n\nfunction DefaultErrorMessage(props: {\n message: string;\n error: Error | undefined;\n}) {\n return <Alert variant=\"danger\">{props.message}</Alert>;\n}\n\nfunction LayoutErrorMessage(props: {\n message: string;\n error: Error | undefined;\n}) {\n const { error } = props;\n if (!(error instanceof LayoutError)) {\n return <></>;\n }\n function formatPreview(\n error: MissingKeysError | UnknownKeysError | KeyError,\n indent = 3\n ) {\n const path = getYamlHierarchy(error.yamlNode);\n const lines: string[] = [];\n let actualIndentation = '';\n for (let i = 1; i < path.length; i++) {\n const { node, indexFromParent } = path[i];\n lines.push(`${actualIndentation}children:`);\n actualIndentation += ' '.repeat(indent);\n if (indexFromParent === 1) {\n lines.push(`${actualIndentation}- type: ...`);\n } else if (indexFromParent ?? 0 > 1) {\n lines.push(\n `${actualIndentation}...`,\n `${actualIndentation}...`,\n `${actualIndentation}# children number ${indexFromParent ?? 0 + 1}`\n );\n }\n lines.push(`${actualIndentation}- type: ${node.type}`);\n actualIndentation += ' '.repeat(2);\n }\n if (error instanceof UnknownKeysError) {\n error.keys.forEach((k) => {\n lines.push(\n `${actualIndentation}${k}: ... ${' '.repeat(\n 50 - actualIndentation.length - k.length\n )}<-- unexpected key`\n );\n });\n } else if (error instanceof MissingKeysError) {\n error.keys.forEach((k) => {\n lines.push(\n `${actualIndentation}???: ${' '.repeat(\n 50 - actualIndentation.length - k.length\n )}<-- key **${k}** is expected`\n );\n });\n } else if (error instanceof KeyError) {\n lines.push(\n `${actualIndentation}${error.key}: ${' '.repeat(\n 50 - actualIndentation.length - error.key.length\n )}<-- ${error.keyMessage}`\n );\n }\n return lines.join('\\n');\n }\n const layoutRoot = getYamlRoot(error.yamlNode);\n const layoutName = layoutRoot.name;\n\n if (error instanceof UnknownKeysError) {\n const key = error.keys.length === 1 ? 'key' : 'keys';\n return (\n <Alert variant=\"danger\">\n Unexpected {key}{' '}\n {error.keys.map((k, i) => {\n return (\n <>\n {i !== 0 && ', '}\n <b>{k}</b>\n </>\n );\n })}{' '}\n from the layout name <b>{layoutName}</b>.\n <br />\n <pre className=\"mt-3\">{formatPreview(error)}</pre>\n <br />\n </Alert>\n );\n }\n if (error instanceof MissingKeysError) {\n const key = error.keys.length === 1 ? 'Key' : 'Keys';\n return (\n <Alert variant=\"danger\">\n Expected {key}{' '}\n {error.keys.map((k, i) => {\n return (\n <>\n {i !== 0 && ', '}\n <b>{k}</b>\n </>\n );\n })}{' '}\n from the layout name <b>{layoutName}</b>.\n <br />\n <pre className=\"mt-3\">{formatPreview(error)}</pre>\n <br />\n </Alert>\n );\n }\n if (error instanceof KeyError) {\n return (\n <Alert variant=\"danger\">\n Error on key <b>{error.key}</b> from the layout name <b>{layoutName}</b>\n .\n <br />\n <pre className=\"mt-3\">{formatPreview(error)}</pre>\n <br />\n </Alert>\n );\n }\n return <DefaultErrorMessage {...props} />;\n}\n\nconst INITIAL_STATE = {\n hasError: false,\n message: '',\n error: undefined,\n};\n\nexport default class ErrorBoundary extends Component<Props, State> {\n public constructor(props: Props) {\n super(props);\n this.state = INITIAL_STATE;\n }\n\n public static getDerivedStateFromError() {\n return { hasError: true };\n }\n\n private readonly reload = () => {\n window.location.reload();\n };\n\n public componentDidCatch(error: Error) {\n if (error instanceof LayoutError) {\n this.setState({\n hasError: true,\n message: error.message,\n error,\n });\n }\n }\n\n // https://github.com/bvaughn/react-error-boundary/blob/23a4d779744f3079dfe0960acaa4bdfd5dede87b/src/ErrorBoundary.ts#L53\n public componentDidUpdate(prevProps: Props, prevState: State) {\n if (\n this.state.hasError &&\n prevState.error !== undefined &&\n prevProps.resetKey !== this.props.resetKey\n ) {\n this.setState(INITIAL_STATE);\n }\n }\n\n public render() {\n if (this.state.hasError) {\n return (\n <Container className=\"mt-2\">\n <h4>Something went wrong</h4>\n <LayoutErrorMessage\n message={this.state.message}\n error={this.state.error}\n />\n <p>\n This error has been logged. Please{' '}\n <Button size=\"sm\" onClick={this.reload}>\n <i className=\"fa fa-refresh\" /> Reload\n </Button>{' '}\n the application\n </p>\n </Container>\n );\n }\n return this.props.children;\n }\n}\n","import type { YamlNode } from '../model';\nimport { KeyError, MissingKeysError, UnknownKeysError } from '../utils';\n\ntype Defined<T> = T extends undefined ? never : T;\n\nexport function assertKeyExpected<T>(\n yamlNode: YamlNode | undefined,\n key: string,\n value: T\n): asserts value is Defined<T> {\n if (yamlNode) {\n if (value === undefined) {\n throw new MissingKeysError(yamlNode, [key]);\n }\n }\n}\n\nexport function assertString(\n yamlNode: YamlNode,\n key: string,\n value: any\n): asserts value is string {\n if (typeof value !== 'string') {\n throw new KeyError(yamlNode, key, 'A string is expected');\n }\n}\n\nexport function assertBoolean(\n yamlNode: YamlNode,\n key: string,\n value: unknown\n): asserts value is boolean {\n if (typeof value !== 'boolean') {\n throw new KeyError(yamlNode, key, 'A boolean is expected');\n }\n}\n\nexport function assertNumber(\n yamlNode: YamlNode,\n key: string,\n value: unknown\n): asserts value is number {\n if (typeof value !== 'number') {\n throw new KeyError(yamlNode, key, 'A number is expected');\n }\n}\n\nexport function assertOptionalBoolean(\n yamlNode: YamlNode,\n key: string,\n value: unknown\n): asserts value is boolean | undefined {\n if (value === undefined) {\n return;\n }\n if (typeof value !== 'boolean') {\n throw new KeyError(yamlNode, key, 'An optional boolean is expected');\n }\n}\n\nexport function assertOptionalString(\n yamlNode: YamlNode,\n key: string,\n value: unknown\n): asserts value is string | undefined {\n if (value === undefined) {\n return;\n }\n if (typeof value !== 'string') {\n throw new KeyError(yamlNode, key, 'An optional string is expected');\n }\n}\n\nexport function assertStringList(\n yamlNode: YamlNode,\n key: string,\n value: unknown\n): asserts value is string[] {\n if (!Array.isArray(value)) {\n throw new KeyError(yamlNode, key, 'A list of string is expected');\n }\n value.forEach((v) => {\n if (typeof v !== 'string') {\n throw new KeyError(yamlNode, key, 'A list of string is expected');\n }\n });\n}\n\nexport function assertOptionalStringOrStringList(\n yamlNode: YamlNode,\n key: string,\n value: unknown\n): asserts value is string | string[] | undefined {\n if (value === undefined) {\n return;\n }\n if (typeof value === 'string') {\n return;\n }\n if (!Array.isArray(value)) {\n throw new KeyError(\n yamlNode,\n key,\n 'An optional string or list of string is expected'\n );\n }\n value.forEach((v) => {\n if (typeof v !== 'string') {\n throw new KeyError(\n yamlNode,\n key,\n 'An optional string or list of string is expected'\n );\n }\n });\n}\n\nexport function assertOptionalStringList(\n yamlNode: YamlNode,\n key: string,\n value: unknown\n): asserts value is string[] | undefined {\n if (value === undefined) {\n return;\n }\n if (!Array.isArray(value)) {\n throw new KeyError(yamlNode, key, 'An optional list of string is expected');\n }\n value.forEach((v) => {\n if (typeof v !== 'string') {\n throw new KeyError(\n yamlNode,\n key,\n 'A optional list of string is expected'\n );\n }\n });\n}\n\nexport function assertOptionalNumber(\n yamlNode: YamlNode,\n key: string,\n value: unknown\n): asserts value is number | undefined {\n if (value === undefined) {\n return;\n }\n if (typeof value !== 'number') {\n throw new KeyError(yamlNode, key, 'An optional number is expected');\n }\n}\n\nexport function assertOptionalNumberList(\n yamlNode: YamlNode,\n key: string,\n value: unknown\n): asserts value is string[] | undefined {\n if (value === undefined) {\n return;\n }\n if (!Array.isArray(value)) {\n throw new KeyError(\n yamlNode,\n key,\n 'An optional list of numbers is expected'\n );\n }\n value.forEach((v) => {\n if (typeof v !== 'number') {\n throw new KeyError(\n yamlNode,\n key,\n 'An optional list of numbers is expected'\n );\n }\n });\n}\n\nexport function assertNoUnknownKeys(\n yamlNode: YamlNode | undefined,\n remainingContent: Record<string, any>\n) {\n const { _parentNode, _indexFromParent, ...remainingContent2 } =\n remainingContent;\n if (yamlNode) {\n if (Object.keys(remainingContent2).length > 0) {\n throw new UnknownKeysError(yamlNode, Object.keys(remainingContent2));\n }\n }\n}\n\nexport function assertDataCollectionId(\n yamlNode: YamlNode,\n key: string,\n value: unknown\n): asserts value is number | 'last' {\n if (value === 'last') {\n return;\n }\n if (typeof value === 'number') {\n return;\n }\n throw new KeyError(yamlNode, key, '\"last\" or a number is expected');\n}\n\nexport function assertOptionalBackend(\n yamlNode: YamlNode,\n key: string,\n value: unknown\n): asserts value is 'plotly' | 'h5web' | undefined {\n if (value === undefined) {\n return;\n }\n if (value === 'h5web') {\n return;\n }\n if (value === 'plotly') {\n return;\n }\n throw new KeyError(yamlNode, key, '\"h5web\" or \"plotly\" string is expected');\n}\n","import { map } from 'lodash';\nimport { Row } from 'react-bootstrap';\nimport { renderYamlNode } from './utils';\nimport { assertNoUnknownKeys } from './components/asserts';\nimport type { AnyYamlNode } from './model';\n\ninterface Props {\n yamlNode: AnyYamlNode;\n panel: boolean;\n}\n\nexport default function YamlRow({ yamlNode, panel }: Props) {\n const { type, style, children, ...unknownOptions } = yamlNode;\n assertNoUnknownKeys(yamlNode, unknownOptions);\n return (\n <Row className=\"ymllayout-row gx-0\" style={style}>\n {map(children, (node, key) => renderYamlNode(node, key, panel))}\n </Row>\n );\n}\n","import { map } from 'lodash';\nimport { Col } from 'react-bootstrap';\nimport classNames from 'classnames';\nimport { renderYamlNode } from './utils';\nimport {\n assertNoUnknownKeys,\n assertOptionalNumber,\n} from './components/asserts';\nimport type { AnyYamlNode } from './model';\n\ninterface Props {\n yamlNode: AnyYamlNode;\n panel: boolean;\n}\n\nexport default function YamlCol({ yamlNode, panel }: Props) {\n const { type, style, xs, children, ...unknownOptions } = yamlNode;\n assertNoUnknownKeys(yamlNode, unknownOptions);\n assertOptionalNumber(yamlNode, 'xs', xs);\n return (\n <Col\n className={classNames('yamymllayout-col', { col: !!xs })}\n style={style}\n xs={xs}\n >\n {map(yamlNode.children, (node, key) => renderYamlNode(node, key, panel))}\n </Col>\n );\n}\n","import { Alert } from 'react-bootstrap';\nimport type { YamlNode } from '../model';\nimport { KeyError, MissingKeysError } from '../utils';\nimport {\n assertNoUnknownKeys,\n assertOptionalBoolean,\n assertOptionalString,\n} from './asserts';\nimport type { YamlComponent } from '../model';\n\n/**\n * Store the mapping from Yaml `type` to React component handling the\n * rendering of such Yaml node\n */\nexport const yamlHardwareComponent: Record<\n string,\n React.ComponentType<any>\n> = {};\n\n/**\n * Register the Yaml type with the component used to render this Yaml node.\n */\nexport function registerHardwareComponent(\n name: string,\n component: React.ComponentType<any>\n) {\n yamlHardwareComponent[name] = component;\n}\n\nexport interface HardwareDesc {\n id: string;\n}\n\nexport type HardwareListDesc = HardwareDesc[];\n\nexport interface HardwareGroupProps {\n fetched: boolean;\n fetchedGroups: boolean;\n ids?: HardwareListDesc;\n groupid?: string;\n actions?: {\n fetch: () => void;\n fetchGroups: () => void;\n };\n even?: boolean;\n nowrap: boolean;\n}\n\nfunction assertHardwareDesc(\n yamlNode: YamlNode,\n value: any\n): asserts value is HardwareDesc {\n if (value === undefined) {\n // FIXME: That's not a nice exception in this case, the rendering will be bad\n throw new MissingKeysError(yamlNode, ['id']);\n }\n if (typeof value.id !== 'string') {\n // FIXME: That's not a nice exception in this case, the rendering will be bad\n throw new KeyError(yamlNode, 'id', 'A string is expected');\n }\n}\n\nfunction assertOptionalHardwareListDesc(\n yamlNode: YamlNode,\n key: string,\n value: any\n): asserts value is HardwareListDesc | undefined {\n if (value === undefined) {\n return;\n }\n if (!Array.isArray(value)) {\n throw new KeyError(yamlNode, 'ids', 'A option list is expected');\n }\n\n value.forEach((hardwareDesc, i) => {\n try {\n assertHardwareDesc(yamlNode, hardwareDesc);\n } catch {\n // FIXME: For now we catch it, but assertHardwareDesc could do a better job\n throw new KeyError(\n yamlNode,\n 'ids',\n `The hardware description ${i} is wrong`\n );\n }\n });\n}\n\nexport default function YamlHardwareGroup(props: YamlComponent) {\n const {\n providers = {},\n yamlNode,\n ids,\n groupid,\n even,\n nowrap,\n ...unknownOptions\n } = props;\n assertOptionalHardwareListDesc(yamlNode, 'ids', ids);\n assertOptionalString(yamlNode, 'groupid', groupid);\n assertOptionalBoolean(yamlNode, 'even', even);\n assertOptionalBoolean(yamlNode, 'nowrap', nowrap);\n assertNoUnknownKeys(yamlNode, unknownOptions);\n\n if (!yamlHardwareComponent.HardwareGroup) {\n return (\n <Alert variant=\"warning\">No `HardwareGroup` component registered</Alert>\n );\n }\n\n const HardwareGroup = yamlHardwareComponent.HardwareGroup;\n return (\n <HardwareGroup\n providers={providers}\n ids={ids}\n groupid={groupid}\n nowrap={nowrap || false}\n even={even || false}\n />\n );\n}\n","import React, { Suspense } from 'react';\nimport { Alert } from 'react-bootstrap';\nimport Panel from '../layout/Panel';\nimport type { YamlNode } from './model';\nimport YamlHardwareGroup from './components/HardwareGroup';\n\nexport const componentMap: Record<string, React.ComponentType<any>> = {\n hardwaregroup: YamlHardwareGroup,\n};\nexport function registerComponent(\n name: string,\n component: React.ComponentType<any>\n) {\n componentMap[name] = component;\n}\n\nexport function registerComponents(\n map: Record<string, React.ComponentType<any>>\n) {\n Object.entries(map).forEach(([key, component]) =>\n registerComponent(key, component)\n );\n}\n\ninterface YamlComponentNode extends YamlNode {\n type: string;\n [name: string]: any;\n scroll?: boolean;\n style?: Record<string, any>;\n title?: string;\n}\n\nexport default function YamlComponent(props: {\n yamlNode: YamlComponentNode;\n panel: boolean;\n}) {\n const { yamlNode, panel } = props;\n const { type, style, scroll, title, ...remainingContent } = yamlNode;\n if (!(type in componentMap)) {\n return (\n <Panel>\n <Panel.Contents>\n <Alert variant=\"warning\">Unknown component "{type}"</Alert>\n </Panel.Contents>\n </Panel>\n );\n }\n const Comp = componentMap[yamlNode.type];\n if (panel) {\n return (\n <Panel style={style} scroll={scroll}>\n <Suspense fallback={<p>Loading...</p>}>\n {title && <Panel.Header>{title}</Panel.Header>}\n <Panel.Contents>\n <Comp {...remainingContent} yamlNode={yamlNode} />\n </Panel.Contents>\n </Suspense>\n </Panel>\n );\n }\n return (\n <Suspense fallback={<p>Loading...</p>}>\n <Comp {...remainingContent} yamlNode={yamlNode} />\n </Suspense>\n );\n}\n","import { map } from 'lodash';\nimport { Container } from 'react-bootstrap';\nimport { renderYamlNode } from './utils';\n\ninterface Props {\n yamlNode: {\n children: any[];\n options?: Record<string, any>;\n };\n panel: boolean;\n}\n\nexport default function YamlContainer({ yamlNode, panel }: Props) {\n const options = yamlNode.options || {};\n return (\n <Container className=\"ymllayout-container\" {...options}>\n {map(yamlNode.children, (node, key) => renderYamlNode(node, key, panel))}\n </Container>\n );\n}\n","import type { ReactElement, CSSProperties } from 'react';\nimport { map } from 'lodash';\nimport Panel from '../layout/Panel';\nimport { renderYamlNode } from './utils';\n\ninterface Props {\n yamlNode: {\n children: any[];\n options?: Record<string, any>;\n title?: string;\n };\n panel: boolean;\n}\n\nexport default function YamlPanel(props: Props): ReactElement {\n const { yamlNode } = props;\n const options = yamlNode.options || {};\n const contentsStyle: CSSProperties = {};\n if (options.centerContent) {\n contentsStyle.margin = 'auto';\n }\n\n return (\n <Panel className=\"ymllayout-panel\" {...options}>\n {yamlNode.title && <Panel.Header>{yamlNode.title}</Panel.Header>}\n <Panel.Contents style={contentsStyle}>\n {map(yamlNode.children, (node, key) =>\n renderYamlNode(node, key, false)\n )}\n </Panel.Contents>\n </Panel>\n );\n}\n","import { each } from 'lodash';\nimport { Tab, Tabs } from 'react-bootstrap';\nimport Panel from '../layout/Panel';\nimport { renderYamlNode } from './utils';\n\nconst hash = () => {\n return (\n Math.random().toString(36).slice(2, 15) +\n Math.random().toString(36).slice(2, 15)\n );\n};\n\ninterface Props {\n yamlNode: {\n children: any[];\n options?: Record<string, any>;\n title: string;\n };\n panel: boolean;\n}\n\nexport default function YamlTabs({ yamlNode, panel }: Props) {\n const tabs: React.ReactElement[] = [];\n each(yamlNode.children, (t, i) => {\n tabs.push(\n <Tab key={i} eventKey={hash()} title={t.title}>\n {renderYamlNode(t, 0, false)}\n </Tab>\n );\n });\n\n return panel ? (\n <Panel className=\"ymllayout-tabs\">\n {yamlNode.title && <Panel.Header>{yamlNode.title}</Panel.Header>}\n <Panel.Contents>\n <Tabs mountOnEnter>{tabs}</Tabs>\n </Panel.Contents>\n </Panel>\n ) : (\n <Tabs>{tabs}</Tabs>\n );\n}\n","import { map } from 'lodash';\nimport Panel from '../layout/Panel';\nimport type { ReactChild } from 'react';\nimport { assertOnRemainingKeys, renderYamlNode } from './utils';\nimport type { YamlNode } from './model';\n\ninterface YamlFormHeaderNode extends YamlNode {\n type: 'formheader';\n title?: string;\n}\n\ninterface YamlFormRowNode extends YamlNode {\n type: string;\n title: string;\n component?: string;\n stateinheader?: boolean;\n titlealign?: string;\n id?: string;\n variant?: string;\n options?: Record<string, any>;\n even: boolean;\n}\n\ninterface YamlFormNode extends YamlNode {\n children: (YamlFormHeaderNode | YamlFormRowNode)[];\n title?: string;\n [key: string]: any;\n}\n\nfunction Header(props: { node: YamlFormHeaderNode; row: number }) {\n const { node } = props;\n const { type, title, ...remainingContent } = node;\n assertOnRemainingKeys(node, remainingContent);\n return (\n <div style={{ gridColumn: '1 / 3' }}>\n <h3>{title}</h3>\n </div>\n );\n}\n\n/**\n * Render the title of a row.\n *\n * It supports a fixed title, and can display formatted hardware id and state.\n */\nfunction RowTitle(props: {\n node: YamlFormRowNode;\n state: ReactChild | null;\n row: number;\n}) {\n const { node, state, row } = props;\n const { title } = node;\n\n function getId() {\n if (node.id) {\n return node.id;\n }\n return undefined;\n }\n\n function getText() {\n if (title !== undefined) {\n return title;\n }\n if (node.type === 'hardware') {\n const id = getId();\n const idContent = {\n _parentNode: node._parentNode,\n _indexFromParent: node._indexFromParent,\n type: 'hardware',\n id,\n variant: 'name',\n emptyifnone: true,\n };\n return renderYamlNode(idContent, 'a', false);\n }\n return '';\n }\n const text = getText();\n\n return (\n <div\n style={{\n textAlign: 'center',\n }}\n >\n <h5\n style={{\n margin: '0px',\n whiteSpace: 'nowrap',\n }}\n >\n {text}\n </h5>\n {state && <div style={{ position: 'relative', top: -5 }}>{state}</div>}\n </div>\n );\n}\n\nfunction Row(props: { node: YamlFormRowNode; row: number }) {\n const { node, row } = props;\n const {\n titlealign,\n title,\n stateinheader = false,\n variant,\n id,\n ...remainingContent\n } = node;\n let newContent;\n let state;\n if (remainingContent.type === 'hardware') {\n newContent = {\n ...remainingContent,\n id,\n variant,\n };\n if (stateinheader) {\n const stateContent = {\n ...remainingContent,\n id,\n variant: 'state',\n emptyifnone: true,\n };\n state = renderYamlNode(stateContent, 'k', false);\n } else {\n state = null;\n }\n } else {\n newContent = remainingContent;\n state = null;\n }\n return (\n <>\n <div\n style={{\n gridColumn: 1,\n alignSelf: titlealign ?? 'center',\n }}\n >\n <RowTitle node={node} state={state} row={row} />\n </div>\n <div style={{ gridColumn: 2 }}>\n {renderYamlNode(newContent, 'k', false)}\n </div>\n </>\n );\n}\n\nexport default function YamlForm(props: {\n yamlNode: YamlFormNode;\n panel: boolean;\n}) {\n const { yamlNode, panel } = props;\n const { type, children, options = {}, title, ...remainingContent } = yamlNode;\n assertOnRemainingKeys(yamlNode, remainingContent);\n\n return (\n <Panel className=\"ymllayout-form\" {...options}>\n {yamlNode.title && <Panel.Header>{yamlNode.title}</Panel.Header>}\n <Panel.Contents>\n <div\n style={{\n display: 'grid',\n gridTemplateColumns: 'min-content auto',\n }}\n >\n {map(children, (content, key) => {\n if (content.type === 'formheader') {\n return (\n <Header\n node={content as YamlFormHeaderNode}\n key={key}\n row={key}\n />\n );\n }\n return (\n <Row node={content as YamlFormRowNode} key={key} row={key} />\n );\n })}\n </div>\n </Panel.Contents>\n </Panel>\n );\n}\n","import { map } from 'lodash';\nimport { renderYamlNode } from './utils';\nimport type { YamlNode } from './model';\n\ninterface YamlGridNode extends YamlNode {\n children: YamlGridCellNode[];\n title?: string;\n columns?: string;\n rows?: string;\n}\n\ninterface YamlGridCellNode extends YamlNode {\n columnSpan?: number;\n rowSpan?: number;\n}\n\nexport default function YamlGrid(props: {\n yamlNode: YamlGridNode;\n panel: boolean;\n}) {\n const { yamlNode, panel } = props;\n return (\n <div\n className=\"ymllayout-grid\"\n style={{\n gridTemplateColumns: yamlNode.columns,\n gridTemplateRows: yamlNode.rows,\n }}\n >\n {map(yamlNode.children, (content, key) => {\n const { columnSpan = 1, rowSpan = 1, ...remainingContent } = content;\n const gridColumn = columnSpan > 1 ? `span ${columnSpan}` : undefined;\n const gridRow = rowSpan > 1 ? `span ${rowSpan}` : undefined;\n return (\n <div\n key={key}\n className=\"ymllayout-grid-cell\"\n style={{\n gridColumn,\n gridRow,\n }}\n >\n {renderYamlNode(remainingContent, key, panel)}\n </div>\n );\n })}{' '}\n </div>\n );\n}\n","import React from 'react';\nimport { OptionalPanel } from './utils';\n\ninterface Props {\n yamlNode: {\n children: any[];\n options?: {\n [name: string]: any;\n scroll?: boolean;\n style?: Record<string, any>;\n };\n label?: string;\n };\n panel: boolean;\n}\n\nexport default function YamlLabel({ yamlNode, panel }: Props) {\n const options = yamlNode.options || {};\n return (\n <OptionalPanel panel={panel} options={options}>\n <div>{yamlNode.label}</div>\n </OptionalPanel>\n );\n}\n","import { useMemo } from 'react';\nimport { Alert } from 'react-bootstrap';\nimport Panel from '../layout/Panel';\nimport ErrorBoundary from './ErrorBoundary';\nimport YamlRow from './Row';\nimport YamlCol from './Col';\nimport YamlComponent from './Component';\nimport YamlContainer from './Container';\nimport YamlPanel from './Panel';\nimport YamlTabs from './Tabs';\nimport YamlForm from './Form';\nimport YamlGrid from './Grid';\nimport YamlLabel from './Label';\nimport { renderYamlNode, registerYamlType, normalizeLayout } from './utils';\nimport type { YamlRoot } from './model';\n\nexport const yamlMap = {\n row: YamlRow,\n col: YamlCol,\n container: YamlContainer,\n component: YamlComponent,\n panel: YamlPanel,\n tabs: YamlTabs,\n form: YamlForm,\n grid: YamlGrid,\n label: YamlLabel,\n};\n\nObject.entries(yamlMap).forEach(([type, YamlComponent]) => {\n registerYamlType(type, YamlComponent);\n});\n\ninterface Props {\n id: string;\n layout: YamlRoot;\n className?: string;\n}\n\nexport default function Main(props: Props) {\n const layout = useMemo(() => {\n return normalizeLayout(props.layout);\n }, [props.layout]);\n\n if (layout.error) {\n return (\n <div className={`${props.className ?? ''} ymllayout-main`} id={props.id}>\n <Panel>\n <Panel.Header>Layout Error</Panel.Header>\n <Panel.Contents>\n <p>File: {layout.name}</p>\n <Alert variant=\"warning\">\n <pre className=\"mb-0\">{layout.error}</pre>\n </Alert>\n </Panel.Contents>\n </Panel>\n </div>\n );\n }\n\n return (\n <div className={`${props.className ?? ''} ymllayout-main`} id={props.id}>\n <ErrorBoundary resetKey={layout}>\n {layout.children?.map((node, key) => renderYamlNode(node, key))}\n </ErrorBoundary>\n </div>\n );\n}\n","import { map } from 'lodash';\nimport type { ComponentType, PropsWithChildren } from 'react';\nimport classNames from 'classnames';\nimport { Row, Col, Container } from 'react-bootstrap';\nimport { MonitorHardware } from './MonitorHardware';\nimport type { Monitor } from './types';\n\ninterface MonitorMapping {\n [name: string]: ComponentType<any>;\n}\n\nexport const monitorMap: MonitorMapping = {\n hardware: MonitorHardware,\n};\n\nexport function registerMonitorComponent(\n name: string,\n component: React.ComponentType<any>\n) {\n monitorMap[name] = component;\n}\n\nfunction YmlError(props: { monitor: Monitor; message: string }) {\n return (\n <Col\n className=\"monitor-panel-item bg-fatal\"\n title={`Error from yaml configuration: ${props.message}`}\n >\n <h1>{props.monitor.name}</h1>\n <div>Parsing error</div>\n </Col>\n );\n}\n\nexport interface MonitorPanelProps {\n monitors: Monitor[];\n margin?: 'start' | null;\n bg?: 'light' | null;\n}\n\nexport function MonitorPanel(props: MonitorPanelProps) {\n const properties = map(props.monitors, (monitor, i) => {\n const type = monitor.type ?? 'hardware';\n const Comp = monitorMap[type];\n if (Comp === undefined) {\n return (\n <YmlError\n key={`m${i}`}\n monitor={monitor}\n message={`Type ${type} unsupported`}\n />\n );\n }\n return <Comp key={`m${i}`} monitor={monitor} />;\n });\n\n return (\n <div\n className={classNames(\n { 'ms-auto': props.margin === 'start' },\n 'me-auto',\n 'monitor-panel',\n { 'monitor-panel-light': props.bg === 'light' }\n )}\n >\n <Container fluid>\n <Row className=\"flex-nowrap\">{properties}</Row>\n </Container>\n </div>\n );\n}\n\ninterface MonitorPanelItemProps {}\n\nexport function MonitorPanelItem(\n props: PropsWithChildren<MonitorPanelItemProps>\n) {\n return <Col className=\"monitor-panel-item\">{props.children}</Col>;\n}\n","import { Fragment } from 'react';\nimport type { ReactNode } from 'react';\nimport { Col, OverlayTrigger, Tooltip } from 'react-bootstrap';\nimport type { Monitor } from './types';\nimport type { Hardware } from '../hardware/utils/types';\nimport { MonitorPanelItem } from './MonitorPanel';\n\nconst runtimeHooks: Record<string, (id: string | null) => Hardware | null> = {};\n\nexport function registerRuntimeHook(\n name: string,\n hook: (id: string | null) => Hardware | null\n) {\n runtimeHooks[name] = hook;\n}\n\nfunction useHardware(id: string | null) {\n if (!runtimeHooks.useHardware) {\n throw new Error('No `useHardware` hook registered');\n }\n return runtimeHooks.useHardware(id);\n}\n\nexport const dynamicOp = (op: string, a1: any, b1: any) => {\n const operators: { [op: string]: (a: any, b: any) => boolean } = {\n '>': (a, b) => a > b,\n '<': (a, b) => a < b,\n '>=': (a, b) => a >= b,\n '<=': (a, b) => a <= b,\n '==': (a, b) => a === b,\n '!=': (a, b) => a !== b,\n in: (a, b) => b.indexOf(a) > -1,\n };\n\n if (op in operators) return operators[op](a1, b1);\n return undefined;\n};\n\nfunction rsplit(s: string, separator: string, limits?: number): string[] {\n const split = s.split(separator);\n return limits\n ? [split.slice(0, -limits).join(separator)].concat(split.slice(-limits))\n : split;\n}\n\nexport function useValue(valuePath: string | undefined): unknown {\n const path = valuePath !== undefined ? rsplit(valuePath, '.', 1) : [null, ''];\n const obj = useHardware(path[0]);\n if (!obj) {\n return undefined;\n }\n if (!obj.properties) {\n return undefined;\n }\n if (path[1] === null) {\n return undefined;\n }\n if (!Array.isArray(obj.properties[path[1]])) {\n return obj.properties[path[1]];\n }\n return obj.properties[path[1]][0];\n}\n\nexport function useUnit(unitPath?: string): string | undefined {\n const isFixedUnit = unitPath !== undefined && !unitPath.includes('.');\n const path = unitPath !== undefined ? rsplit(unitPath, '.', 1) : [null, ''];\n const obj = useHardware(path[0]);\n if (isFixedUnit) {\n // That's a fixed unit defined as an option\n return unitPath;\n }\n if (!obj) {\n return undefined;\n }\n if (!obj.properties) {\n // The unit is maybe not yet there\n return undefined;\n }\n if (path[1] === null) {\n return undefined;\n }\n return `${obj.properties[path[1]]}`;\n}\n\nexport function MonitorHardware(props: { monitor: Monitor }) {\n const { monitor } = props;\n\n let value = useValue(monitor.value) ?? '-';\n const unit = useUnit(monitor.unit);\n const overlay = useValue(monitor.overlay);\n\n const flt = Number.parseFloat(`${value}`);\n if (!Number.isNaN(flt)) {\n const str = String(flt);\n if (str.length > 5) {\n value = flt.toPrecision(5);\n }\n }\n\n let checkClass;\n if (monitor.comparator && monitor.comparison) {\n const check = dynamicOp(monitor.comparator, value, monitor.comparison);\n checkClass = check ? 'valid' : 'invalid';\n }\n\n if (!Number.isNaN(flt)) {\n if (unit !== undefined) {\n value = `${value} ${unit}`;\n }\n }\n\n let Wrap: ReactNode = Fragment;\n const wrapProps: { [name: string]: any } = {};\n\n if (overlay) {\n const overlayStr = `${overlay}`;\n let TooltipWrap: ReactNode = Fragment;\n if (overlayStr.includes('\\n')) {\n TooltipWrap = 'pre';\n }\n\n Wrap = OverlayTrigger;\n wrapProps.placement = 'bottom';\n wrapProps.overlay = (\n <Tooltip id=\"tooltipid\" className=\"monitor-panel-tooltip\">\n {\n // @ts-expect-error\n <TooltipWrap>{overlayStr}</TooltipWrap>\n }\n </Tooltip>\n );\n }\n return (\n // @ts-expect-error\n <Wrap {...wrapProps} key={monitor.name}>\n <MonitorPanelItem>\n <h1>{monitor.name}</h1>\n <div className={checkClass}>{`${value}`}</div>\n </MonitorPanelItem>\n </Wrap>\n );\n}\n"],"names":["OnlineStatus","props","activeMessage","inactiveMessage","message","jsx","TypeIcon","name","icon","jsxs","formatEng","scalar","powerPrefix","q","subtrhnd","pow10","prefix","ucfirst","str","toHoursMins","seconds","min","mins","hours","toEnergy","wavelength","round","value","digits","FrontendOverlay","hardware","reset","e","itlks","ring","getPropertyState","key","state","OverlayTrigger","Popover","Container","map","Row","Col","Badge","prop","Button","Frontend","options","onClick","ButtonGroup","Info","getValue","propertyName","result","segment","Fragment","HardwareTemplate","headerMode","getLabel","label","Form","error","HardwareState","style","MotorState","getState","s1","ShutterState","s","getVariant","NumericStep","forwardRef","ref","stepSizeRef","useRef","currentStep","setCurrentStep","useState","onStep","up","ref2","val","stepSize","onStepProp","step","overlay","incIcon","decIcon","swapIncDec","onKeyDown","horizontalArrows","largeArrows","rest","onKeyDown2","steps","classNames","InputGroup","NumericStep$1","HardwareNumericStep","valueRef","edited","setEdited","setError","useEffect","updateRef","newValue","onBlur","onChange","promise","HardwareInputNumber","normalizeNumber","_a","MotorOverlay","onMoveVelocityRequested","target","onMoveAccelerationRequested","MotorDefault","onAbortRequested","onMovePositionRequested","widgetIcon","widgetState","Multiposition","selectionRef","onMove","stop","opts","p","logger","debug","NoObject","widgetContent","DeviceState","Property","getUnit","unitName","unit","ShutterOverlay","ShutterDefault","getAction","action","variant","HardwareVariant","Component","Comp","FullSizer","setState","containerRef","view","PanelHeader","PanelContents","Panel","Wrap","yamlWrapperMap","registerYamlType","component","renderYamlNode","yamlNode","panel","type","OptionalPanel","children","Children","child","isValidElement","cloneElement","assertOnRemainingKeys","remainingContent","_parentNode","_indexFromParent","remainingContent2","UnknownKeysError","LayoutError","unknownKeys","MissingKeysError","missingKeys","KeyError","getYamlRoot","node","n","getYamlHierarchy","path","normalizeLayout","parentNode","indexFromParent","newNode","c","i","DefaultErrorMessage","Alert","LayoutErrorMessage","formatPreview","indent","lines","actualIndentation","k","layoutName","INITIAL_STATE","ErrorBoundary","prevProps","prevState","assertKeyExpected","assertString","assertBoolean","assertNumber","assertOptionalBoolean","assertOptionalString","assertStringList","v","assertOptionalStringOrStringList","assertOptionalStringList","assertOptionalNumber","assertOptionalNumberList","assertNoUnknownKeys","assertDataCollectionId","assertOptionalBackend","YamlRow","unknownOptions","YamlCol","xs","yamlHardwareComponent","registerHardwareComponent","assertHardwareDesc","assertOptionalHardwareListDesc","hardwareDesc","YamlHardwareGroup","providers","ids","groupid","even","nowrap","HardwareGroup","componentMap","registerComponent","registerComponents","YamlComponent","scroll","title","Suspense","YamlContainer","YamlPanel","contentsStyle","hash","YamlTabs","tabs","each","t","Tab","Tabs","Header","RowTitle","row","getId","getText","id","idContent","text","titlealign","stateinheader","newContent","stateContent","YamlForm","content","YamlGrid","columnSpan","rowSpan","gridColumn","gridRow","YamlLabel","yamlMap","Main","layout","useMemo","monitorMap","MonitorHardware","registerMonitorComponent","YmlError","MonitorPanel","properties","monitor","MonitorPanelItem","runtimeHooks","registerRuntimeHook","hook","useHardware","dynamicOp","op","a1","b1","operators","a","b","rsplit","separator","limits","split","useValue","valuePath","obj","useUnit","unitPath","isFixedUnit","flt","checkClass","wrapProps","overlayStr","TooltipWrap","Tooltip","createElement"],"mappings":"+SASO,SAASA,GAAaC,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,GAAc,CAAA,GAAGC,EAAO,CAC3B,CAAA,CAAA,CAEJ,CCjCO,SAASS,GAAUC,EAAgB,CACxC,MAAMC,EAAsC,CAC1C,GAAI,IACJ,GAAI,IACJ,GAAI,IACJ,GAAI,IACJ,GAAI,IACJ,EAAG,IACH,EAAG,IACH,EAAG,IACH,KAAM,IACN,KAAM,IACN,KAAM,IACN,MAAO,IACP,MAAO,IACP,MAAO,IACP,MAAO,IACP,MAAO,GAAA,EAGHC,EAAI,KAAK,IAAIF,CAAM,EAAI,KAAK,IAAI,GAAG,EAEnCG,EAAW,CAAC,OAAO,UAAUD,CAAC,EAE9BE,EAAQ,EAAI,KAAK,KAAKF,GAAKC,EAAW,EAAI,EAAE,EAC5CE,EAASD,IAAU,EAAI,GAAKH,EAAYG,CAAK,EAE5C,MAAA,CACL,OAAQJ,EAAS,IAAM,CAACI,EACxB,OAAAC,EACA,WAAY,IAAM,CAACD,CAAA,CAEvB,CAKO,SAASE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