@esrf/daiquiri-lib 0.0.2-alpha.7 → 0.0.2-alpha.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -229,7 +229,7 @@ declare function Property(props: HardwareWidgetProps<GenericSchema, PropertyWidg
229
229
 
230
230
  declare function ShutterDefault(props: HardwareWidgetProps<ShutterSchema, HardwareWidgetOptions>): JSX.Element;
231
231
 
232
- interface Props$4 {
232
+ interface Props$5 {
233
233
  online: boolean;
234
234
  activeMessage?: string;
235
235
  inactiveMessage?: string;
@@ -237,9 +237,9 @@ interface Props$4 {
237
237
  icon: string;
238
238
  name: string;
239
239
  }
240
- declare function TypeIcon(props: Props$4): JSX.Element;
240
+ declare function TypeIcon(props: Props$5): JSX.Element;
241
241
 
242
- interface Props$3 {
242
+ interface Props$4 {
243
243
  hardware: Hardware;
244
244
  headerMode?: string;
245
245
  widgetIcon: ReactElement;
@@ -250,7 +250,7 @@ interface Props$3 {
250
250
  * Normalized way to compose hardware component in order to provide the same
251
251
  * kind of layout
252
252
  */
253
- declare function HardwareTemplate(props: Props$3): JSX.Element;
253
+ declare function HardwareTemplate(props: Props$4): JSX.Element;
254
254
 
255
255
  /**
256
256
  * Input number synchronized with a hardware.
@@ -367,12 +367,12 @@ declare class HardwareVariant extends Component<HardwareVariantOptions, void> {
367
367
  render(): JSX.Element;
368
368
  }
369
369
 
370
- interface Props$2 {
370
+ interface Props$3 {
371
371
  className?: string;
372
372
  }
373
- declare function FullSizer(props: PropsWithChildren<Props$2>): JSX.Element;
373
+ declare function FullSizer(props: PropsWithChildren<Props$3>): JSX.Element;
374
374
 
375
- interface Props$1 {
375
+ interface Props$2 {
376
376
  step?: number;
377
377
  steps?: number[];
378
378
  disabled: boolean;
@@ -394,7 +394,7 @@ interface Props$1 {
394
394
  }) => void;
395
395
  onKeyDown?: (e: KeyboardEvent<HTMLInputElement>) => void;
396
396
  }
397
- declare const NumericStep: react.ForwardRefExoticComponent<Props$1 & react.RefAttributes<HTMLInputElement>>;
397
+ declare const NumericStep: react.ForwardRefExoticComponent<Props$2 & react.RefAttributes<HTMLInputElement>>;
398
398
 
399
399
  interface YamlNode {
400
400
  type: string;
@@ -417,12 +417,31 @@ interface YamlComponent {
417
417
 
418
418
  declare function registerComponent(name: string, component: React.ComponentType<any>): void;
419
419
 
420
- interface Props {
420
+ interface Props$1 {
421
421
  id: string;
422
422
  layout: YamlRoot;
423
423
  className?: string;
424
424
  }
425
- declare function Main(props: Props): JSX.Element;
425
+ declare function Main(props: Props$1): JSX.Element;
426
+
427
+ interface State {
428
+ hasError: boolean;
429
+ message: string;
430
+ error?: Error;
431
+ }
432
+ declare type Props = PropsWithChildren<{
433
+ resetKey?: any;
434
+ }>;
435
+ declare class ErrorBoundary extends Component<Props, State> {
436
+ constructor(props: Props);
437
+ static getDerivedStateFromError(): {
438
+ hasError: boolean;
439
+ };
440
+ private readonly reload;
441
+ componentDidCatch(error: Error): void;
442
+ componentDidUpdate(prevProps: Props, prevState: State): void;
443
+ render(): react.ReactNode;
444
+ }
426
445
 
427
446
  /**
428
447
  * Register the Yaml type with the component used to render this Yaml node.
@@ -516,4 +535,4 @@ declare namespace HardwareObject_d {
516
535
  */
517
536
  declare function registerHardwareComponent(name: string, component: React.ComponentType<any>): void;
518
537
 
519
- export { formatting_d as Formatting, Frontend, FullSizer, HardwareObject_d as HWObject, HardwareInputNumber, HardwareNumericStep, schema_d as HardwareSchema, State_d as HardwareState, HardwareTemplate, types_d as HardwareTypes, HardwareVariant, Info, KeyError, MissingKeysError, MotorDefault, type MotorDefaultOptions, Multiposition, NoObject, NumericStep, Property, ShutterDefault, TypeIcon, Main as YAMLLayout, asserts_d as YamlAsserts, type YamlComponent, type YamlNode, registerHardwareComponent, registerComponent as registerYamlComponent, registerYamlType, renderYamlNode };
538
+ export { formatting_d as Formatting, Frontend, FullSizer, HardwareObject_d as HWObject, HardwareInputNumber, HardwareNumericStep, schema_d as HardwareSchema, State_d as HardwareState, HardwareTemplate, types_d as HardwareTypes, HardwareVariant, Info, KeyError, MissingKeysError, MotorDefault, type MotorDefaultOptions, Multiposition, NoObject, NumericStep, Property, ShutterDefault, TypeIcon, ErrorBoundary as YAMLErrorBoundary, Main as YAMLLayout, asserts_d as YamlAsserts, type YamlComponent, type YamlNode, registerHardwareComponent, registerComponent as registerYamlComponent, registerYamlType, renderYamlNode };
package/dist/index.esm.js CHANGED
@@ -1555,6 +1555,7 @@ export {
1555
1555
  Dt as Property,
1556
1556
  $t as ShutterDefault,
1557
1557
  I as TypeIcon,
1558
+ ze as YAMLErrorBoundary,
1558
1559
  Ht as YAMLLayout,
1559
1560
  Tt as YamlAsserts,
1560
1561
  Pt as registerHardwareComponent,
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),j=require("lodash"),o=require("react-bootstrap"),m=require("react"),te=require("classnames"),ne=require("debug"),L=e=>e&&typeof e=="object"&&"default"in e?e:{default:e},A=L(te),re=L(ne);function se(e){const{activeMessage:t="Online",inactiveMessage:r="Offline",message:s="This device is"}=e;return n.jsx("div",{className:`dot-indicator small bg-${e.online?"success":"danger"}`,title:`${s} ${e.online?t:r}`})}function b(e){const{name:t,icon:r}=e;return n.jsxs("div",{className:"icon",title:t,children:[n.jsx("i",{className:`fa ${r}`}),n.jsx(se,{...e})]})}function ie(e){const t={24:"Y",21:"Z",18:"E",15:"P",12:"T",9:"G",6:"M",3:"k","-3":"m","-6":"µ","-9":"n","-12":"p","-15":"f","-18":"a","-21":"z","-24":"y"},r=Math.log(e)/Math.log(1e3),s=!Number.isInteger(r),i=3*Math.ceil(r-(s?1:0)),a=i===0?"":t[i];return{scalar:e*10**-i,prefix:a,multiplier:10**-i}}function ae(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Y(e){if(e<60)return`${Math.round(e)} sec`;const t=Math.round(e/60),r=t%60,s=Math.floor(t/60);return s?`${s} hr ${r} min`:`${r} min`}function oe(e){return e>0?(662607004e-42*299792458/(e*1e-10)/160218e-24*.001).toFixed(4):0}function le(e,t){return Number.parseFloat(e.toFixed(t))}const ce=Object.freeze(Object.defineProperty({__proto__:null,formatEng:ie,round:le,toEnergy:oe,toHoursMins:Y,ucfirst:ae},Symbol.toStringTag,{value:"Module"}));function de(e){const{hardware:t}=e;function r(d){t.requestChange({function:"reset"})}const s={"Front End":"feitlk",Experimental:"expitlk",PSS:"pssitlk"},i={Current:`${t.properties.current.toFixed(1)} mA`,Mode:t.properties.mode,Refill:Y(t.properties.refill),Message:n.jsx("pre",{children:t.properties.message})};function a(d){if(!(d in t.properties))return"UNKNOWN";const l=t.properties[d];return!l||typeof l!="string"?"UNKNOWN":l}return n.jsx(o.OverlayTrigger,{trigger:"click",rootClose:!0,overlay:n.jsxs(o.Popover,{id:"popid",children:[n.jsxs(o.Popover.Header,{children:[t.name," Details"]}),n.jsxs(o.Popover.Body,{children:[n.jsx("h6",{children:"Status"}),n.jsx("pre",{children:t.properties.status}),n.jsx("h6",{children:"Interlocks"}),n.jsx(o.Container,{children:j.map(s,(d,l)=>n.jsxs(o.Row,{children:[n.jsxs(o.Col,{children:[l,":"]}),n.jsx(o.Col,{children:n.jsx(o.Badge,{bg:a(d)==="ON"?"success":"danger",children:a(d)})})]},l))}),n.jsx("h6",{children:"Ring Status"}),n.jsx(o.Container,{children:j.map(i,(d,l)=>n.jsxs(o.Row,{children:[n.jsxs(o.Col,{children:[l,":"]}),n.jsx(o.Col,{children:d})]},l))}),n.jsx("div",{className:"d-grid gap-2",children:n.jsx(o.Button,{disabled:e.disabled,onClick:r,children:"Reset"})})]})]}),children:n.jsx(o.Button,{className:"flex-grow-0",title:"Shutter Details",children:n.jsx("i",{className:"fa fa-ellipsis-h"})})})}function ue(e){const{hardware:t,options:r={}}=e;function s(i){t.requestChange({function:t.properties.frontend==="FE open"?"close":"open"})}return n.jsxs("div",{className:"hw-component",children:[n.jsxs("div",{className:"hw-head",children:[n.jsx(b,{name:"Frontend",icon:"fam-hardware-frontend",online:t.online}),n.jsx("div",{className:"name",children:t.name}),n.jsx(o.Badge,{bg:t.properties.state==="OPEN"||t.properties.state==="RUNNING"?"success":"danger",children:t.properties.state})]}),n.jsx("div",{className:"hw-content",children:n.jsxs(o.ButtonGroup,{className:"d-flex",children:[n.jsx(o.Button,{variant:t.properties.frontend==="FE open"?"danger":"success",onClick:s,disabled:e.disabled,children:t.properties.frontend==="FE open"?"Close":"Open"}),n.jsx(de,{...e})]})})]})}function he(e){const{hardware:t,options:r={}}=e;function s(){const i=r.property;if(i===void 0)return"property is not set";if(i===null)return"property is null";let a=t;for(const d of i.split("/"))if(a=a[d],a===void 0)return`property '${i}' not found`;return`${a}`}return n.jsx(n.Fragment,{children:s()})}function S(e){const{headerMode:t,hardware:r}=e;function s(){return r.alias?r.alias:r.name?r.name:r.id}const i=s();switch(t){case"front":return n.jsx("div",{className:"hw-component",children:n.jsxs("div",{className:"hw-single",children:[e.widgetIcon,n.jsx("div",{className:"name",children:i}),n.jsx("div",{className:"d-inline-block",children:e.widgetContent})]})});case"none":return n.jsx("div",{className:"hw-component",children:n.jsx("div",{className:"hw-single",children:e.widgetContent})});case"state":return e.widgetState;default:return n.jsxs("div",{className:"hw-component",children:[n.jsxs("div",{className:"hw-head",children:[e.widgetIcon,n.jsx("div",{className:"name",children:n.jsx(o.Form.Label,{htmlFor:r.id,children:i})}),e.widgetState,e.hardware.errors&&e.hardware.errors.length>0&&n.jsx(o.OverlayTrigger,{trigger:"click",placement:"bottom",rootClose:!0,overlay:n.jsxs(o.Popover,{id:e.hardware.id,style:{maxWidth:500},children:[n.jsx(o.Popover.Header,{children:"Device Errors"}),n.jsxs(o.Popover.Body,{children:["There were errors with properties on this device:",n.jsx("ul",{children:e.hardware.errors.map(a=>n.jsxs("li",{children:[a.property,":",n.jsxs("span",{className:"stack-trace",children:[a.traceback,n.jsx("br",{}),a.exception]})]}))})]})]}),children:n.jsx(o.Button,{variant:"danger",size:"sm",children:n.jsx("i",{className:"fa fa-exclamation-triangle"})})})]}),n.jsx("div",{className:"hw-content",children:e.widgetContent})]})}}function T(e){const t={display:"inline-block",minWidth:""};return e.minWidth&&(t.minWidth=`${e.minWidth}em`),n.jsx("div",{style:t,children:n.jsx(o.Badge,{bg:e.variant,children:e.state})})}function q(e){const{hardware:t}=e;function r(){if(!t.online)return"OFFLINE";let i="UNKNOWN";return e.hardware.properties.state&&([i]=e.hardware.properties.state),i}const s=r();return n.jsx(T,{state:s,minWidth:6,variant:s==="READY"?"success":"warning"})}function G(e){const{hardware:t}=e;function r(){if(!t.online)return"OFFLINE";const a=t.properties.state;return e.useReadyState&&(a==="OPEN"||a==="CLOSED")?"READY":a}const s=r();function i(){switch(s){case"READY":return"success";case"OPEN":return"success";case"CLOSED":return"danger";case"DISABLED":return"secondary";case"MOVING":case"STANDBY":case"OFFLINE":return"warning";case"FAULT":return"fatal";default:return"fatal"}}return n.jsx(T,{state:s,minWidth:6,variant:i()})}const fe=Object.freeze(Object.defineProperty({__proto__:null,HardwareState:T,MotorState:q,ShutterState:G},Symbol.toStringTag,{value:"Module"})),me=m.forwardRef((e,t)=>{const r=m.useRef(null),[s,i]=m.useState(e.step),a=w=>{const D=t;if(r.current===null)return;let B=Number.parseFloat(D.current.value);const H=Number.parseFloat(r.current.value);B+=w?H:-H,D.current.value=`${B}`,e.onStep&&e.onStep({target:D.current})},{onStep:d,step:l,overlay:h,incIcon:u,decIcon:c,swapIncDec:f,onKeyDown:x,horizontalArrows:N,largeArrows:F,...v}=e,_=w=>{w.key==="ArrowUp"?(w.preventDefault(),a(!0)):w.key==="ArrowDown"?(w.preventDefault(),a(!1)):x&&x(w)};if(!e.step)return n.jsx(o.Form.Control,{ref:t,type:"number",step:"any",onKeyDown:_,...v});const ee=j.map(e.steps||[e.step],w=>n.jsx("option",{value:w,children:w},w));return n.jsx("div",{className:A.default("numeric-step",{"numeric-step-large":F,"numeric-step-horizontal":N}),children:n.jsxs(o.InputGroup,{children:[n.jsx(o.Form.Control,{onKeyDown:_,ref:t,type:"number",step:"any",...v}),n.jsxs(n.Fragment,{children:[h,!h&&n.jsxs(o.InputGroup.Text,{className:"d-flex flex-column",children:[n.jsx(o.Form.Control,{ref:r,as:"select",className:"step-size",defaultValue:s,onChange:w=>i(Number.parseFloat(w.target.value)),children:ee}),e.unit&&n.jsx("div",{children:e.unit}),!u&&!c&&n.jsxs(n.Fragment,{children:[n.jsx(o.Button,{className:"step step-up",disabled:e.disabled,onClick:w=>a(!0)}),n.jsx(o.Button,{className:"step step-down",disabled:e.disabled,onClick:w=>a(!1)})]})]}),c&&f&&n.jsx(o.Button,{disabled:e.disabled,onClick:w=>a(!1),children:n.jsx("i",{className:`fa fa-fw fa-${c}`})}),u&&n.jsx(o.Button,{disabled:e.disabled,onClick:w=>a(!0),children:n.jsx("i",{className:`fa fa-fw fa-${u}`})}),c&&!f&&n.jsx(o.Button,{disabled:e.disabled,onClick:w=>a(!1),children:n.jsx("i",{className:`fa fa-fw fa-${c}`})})]})]})})}),K=me;function z(e){const t=m.useRef(null),[r,s]=m.useState(!1),[i,a]=m.useState(!1);m.useEffect(()=>{t.current&&(e.hardwareValue===null?t.current.value="":t.current.value=e.hardwareValue.toString(),s(!1))},[e.hardwareValue]);function d(f){let x=f;e.precision!==void 0&&(x=Number.parseFloat(x).toFixed(e.precision)),t!=null&&t.current&&(t.current.value=x)}function l(){r&&setTimeout(()=>{d(e.hardwareValue),s(!1)},3e3)}function h(f){e.hardwareValue!==null&&(s(!0),t!=null&&t.current&&(t.current.value=f.target.value),f.target.value===e.hardwareValue.toString()&&s(!1))}function u(f){s(!1),e.onMoveRequested(f.target.value)}function c(f){switch(f.key){case"Enter":{s(!1);const x=Number.parseFloat(f.target.value),N=e.onMoveRequested(x);N&&N.catch(()=>{a(!0),setTimeout(()=>{d(e.hardwareValue),a(!1)},2e3)})}f.preventDefault(),f.stopPropagation();break;case"Esc":case"Escape":r&&(a(!1),s(!1),d(e.hardwareValue)),f.target.blur(),f.preventDefault(),f.stopPropagation();break}}return n.jsx(K,{id:e.id,className:A.default({"form-control-edited":r,"form-control-error":i,"hw-moving":e.hardwareIsMoving}),type:e.readOnly?"text":"number",ref:t,precision:e.precision,onChange:h,onBlur:l,onStep:u,onKeyDown:c,disabled:e.hardwareIsDisabled||e.readOnly||!e.hardwareIsReady,step:e.step,steps:e.steps,incIcon:e.incIcon,decIcon:e.decIcon,swapIncDec:e.swapIncDec,horizontalArrows:e.horizontalArrows,largeArrows:e.largeArrows,overlay:e.hardwareIsMoving&&!e.hardwareIsDisabled?n.jsx(o.Button,{variant:"danger",onClick:e.onAbortRequested,children:n.jsx("i",{className:"fa fa-times"})}):null})}function k(e){const t=m.useRef(null),[r,s]=m.useState(!1),[i,a]=m.useState(!1);function d(c){return e.precision!==void 0?Number.parseFloat(c).toFixed(e.precision):c}m.useEffect(()=>{var c;t.current&&(t.current.value=d((c=e.hardwareValue)==null?void 0:c.toString()),s(!1))},[e.hardwareValue,e.precision]);function l(c){const f=d(c);t!=null&&t.current&&(t.current.value=f)}function h(c){switch(c.key){case"Enter":{s(!1);const f=Number.parseFloat(c.target.value),x=e.onMoveRequested(f);x&&x.catch(()=>{a(!0),setTimeout(()=>{l(e.hardwareValue),a(!1)},2e3)}),c.preventDefault(),c.stopPropagation();break}case"Esc":case"Escape":r&&(a(!1),s(!1),l(e.hardwareValue)),c.target.blur(),c.preventDefault(),c.stopPropagation();break}}function u(c){s(!0),c.target,t!=null&&t.current&&(t.current.value=c.target.value),c.target.value===e.hardwareValue.toString()&&s(!1)}return n.jsx(o.Form.Control,{className:A.default({"form-control-edited":r,"form-control-error":i,"hw-moving":e.hardwareIsMoving}),type:"number",ref:t,onChange:u,onKeyDown:h,disabled:e.readOnly||e.hardwareIsMoving||e.hardwareIsDisabled,step:e.step})}function pe(e){function t(i){return e.hardware.requestChange({property:"velocity",value:i})}function r(i){return e.hardware.requestChange({property:"acceleration",value:i})}let s="UNKNOWN";return e.hardware.properties.state&&([s]=e.hardware.properties.state),n.jsx(o.OverlayTrigger,{trigger:"click",rootClose:!0,overlay:n.jsxs(o.Popover,{id:"popid",children:[n.jsxs(o.Popover.Header,{children:[e.hardware.name," details"]}),n.jsxs(o.Popover.Body,{children:[n.jsxs(o.Form.Group,{children:[n.jsx(o.Form.Label,{children:"Velocity"}),n.jsx(k,{hardwareValue:e.hardware.properties.velocity,onMoveRequested:t,hardwareIsDisabled:e.disabled,hardwareIsReady:s==="READY",hardwareIsMoving:s==="MOVING",readOnly:e.readOnly})]}),n.jsxs(o.Form.Group,{children:[n.jsx(o.Form.Label,{children:"Acceleration"}),n.jsx(k,{hardwareValue:e.hardware.properties.acceleration,onMoveRequested:r,hardwareIsDisabled:e.disabled,hardwareIsReady:s==="READY",hardwareIsMoving:s==="MOVING",readOnly:e.readOnly})]})]})]}),children:n.jsx(o.Button,{children:n.jsx("i",{className:"fa fa-ellipsis-h"})})})}function xe(e){const{hardware:t,options:r={}}=e;function s(){t.requestChange({function:"stop"})}function i(u){return t.requestChange({property:"position",value:u,function:"move"})}let a="UNKNOWN";e.hardware.properties.state&&([a]=e.hardware.properties.state);const d=n.jsx(b,{name:"Motor",icon:"fam-hardware-motor",online:t.online}),l=n.jsx(q,{hardware:t}),h=e.options?e.options.header:"top";return n.jsx(S,{hardware:t,widgetIcon:d,widgetState:l,widgetContent:n.jsxs(o.InputGroup,{children:[n.jsx(z,{id:t.id,hardwareValue:t.properties.position,hardwareIsDisabled:e.disabled,hardwareIsReady:a==="READY",hardwareIsMoving:a==="MOVING",onMoveRequested:i,onAbortRequested:s,precision:r.precision,readOnly:r.readOnly,step:r.step,steps:r.steps,incIcon:r.incicon,decIcon:r.decicon,swapIncDec:r.swapincdec,horizontalArrows:r.horizontalarrows,largeArrows:r.largearrows}),t.properties.unit&&n.jsx(o.InputGroup.Text,{children:t.properties.unit}),a!=="MOVING"&&r.extended&&n.jsx(pe,{hardware:t,disabled:e.disabled,readOnly:r.readOnly}),a==="MOVING"&&!e.disabled&&!r.step&&n.jsx(o.Button,{variant:"danger",onClick:s,children:n.jsx("i",{className:"fa fa-times"})})]}),headerMode:h})}function ge(e){const{hardware:t,options:r={}}=e,s=m.useRef(null);m.useEffect(()=>{if(!s.current){console.error("selectionRef ref is unset");return}s.current.value=t.properties.position},[t.properties.position]);function i(l){if(console.debug("change",l),!s||!s.current){console.error("selection ref is unset");return}t.requestChange({value:s.current.value,function:"move"})}function a(l){t.requestChange({function:"stop"})}const d=j.map(t.properties.positions,l=>n.jsx("option",{title:l.description,children:l.position},l.position));return n.jsxs("div",{className:"hw-component",children:[n.jsxs("div",{className:"hw-head",children:[n.jsx(b,{name:"Multiposition",icon:"fam-hardware-multiposition",online:t.online}),n.jsx("div",{className:"name",children:t.name}),n.jsx(o.Badge,{bg:t.properties.state==="READY"?"success":"warning",children:t.properties.state})]}),n.jsx("div",{className:"hw-content",children:n.jsxs(o.InputGroup,{children:[n.jsxs(o.Form.Control,{className:"custom-select",as:"select",ref:s,disabled:e.disabled,defaultValue:t.properties.position,children:[n.jsx("option",{disabled:!0,children:"unknown"}),d]}),t.properties.state!=="MOVING"&&n.jsx(o.Button,{onClick:i,disabled:e.disabled,children:"Move"}),t.properties.state==="MOVING"&&!e.disabled&&n.jsx(o.Button,{variant:"danger",onClick:a,children:n.jsx("i",{className:"fa fa-times"})})]})})]})}const we=re.default("daiquiri.components.hardware.NoObject");function je(e){if(e.options.emptyifnone)return we('Component id:"%s" name:"%s" not displayed cause setup with emptyifnone.',e.id,e.name),n.jsx(n.Fragment,{});const t=n.jsx(b,{name:"NoObject",icon:"fam-hardware-any",online:!1}),r=n.jsx(n.Fragment,{}),s=n.jsx(n.Fragment,{children:"Missing"}),i=e.options?e.options.header:"top",a={id:e.id,name:e.name??"",alias:null,online:!1,properties:{},type:""};return n.jsx(S,{hardware:a,widgetIcon:t,widgetState:r,widgetContent:s,headerMode:i})}function ye(e){const t=e.online?"READY":"OFFLINE";return n.jsx(o.Badge,{bg:t==="READY"?"success":"warning",children:t})}function ve(e){const{hardware:t,options:r={}}=e,s=n.jsx(b,{name:"Optic",icon:"fa-cog",online:t.online}),i=n.jsx(ye,{...t});function a(){const c=r.property;if(c===void 0)return"property is not set";if(c===null)return"property is null";let f=t;for(const x of c.split("/"))if(f=f[x],f===void 0)return`property '${c}' not found`;return`${f}`}function d(){const c=r.unit;if(!c)return null;if(!c.includes("properties"))return c;let f=e;for(const x of c.split("/"))if(f=f[x],f===void 0)return null;return`${f}`}const l=d(),h=n.jsxs(o.InputGroup,{children:[n.jsx(o.Form.Control,{value:a(),readOnly:!0}),l&&n.jsx(o.InputGroup.Text,{children:l})]}),u=e.options.header||"top";return n.jsx(S,{hardware:t,widgetIcon:s,widgetState:i,widgetContent:h,headerMode:u})}function be(e){const{hardware:t}=e,r=()=>{t.requestChange({function:"reset"})};return n.jsx(o.OverlayTrigger,{trigger:"click",rootClose:!0,overlay:n.jsxs(o.Popover,{id:"popid",children:[n.jsxs(o.Popover.Header,{children:[t.name," Details"]}),n.jsxs(o.Popover.Body,{children:[n.jsx("h6",{children:"Status"}),n.jsx("pre",{children:t.properties.status}),n.jsx("div",{className:"d-grid gap-2",children:n.jsx(o.Button,{onClick:r,disabled:e.disabled,children:"Reset"})})]})]}),children:n.jsx(o.Button,{className:"flex-grow-0",title:"Shutter Details",children:n.jsx("i",{className:"fa fa-ellipsis-h"})})})}function Ne(e){const{hardware:t,options:r={}}=e,s=n.jsx(b,{name:"Shutter",icon:"fam-hardware-shutter",online:t.online}),i=n.jsx(G,{hardware:t});function a(){return t.properties?t.properties.state:"UNKNOWN"}function d(v){return v==="OPEN"?["Close","close"]:v==="CLOSED"?["Open","open"]:v==="DISABLED"||v==="STANDBY"||v==="FAULT"?["Closed",""]:v==="MOVING"?["...",""]:["Unknown",""]}const l=a(),[h,u]=d(l),f={OPEN:"danger",CLOSED:"success",MOVING:"warning",DISABLED:"secondary",STANDBY:"danger",FAULT:"fatal",UNKNOWN:"warning"}[l]||"danger";function x(){t.requestChange({function:u})}const N=n.jsxs(o.ButtonGroup,{className:"d-flex flex-nowrap",children:[n.jsx(o.Button,{variant:f,onClick:x,disabled:e.disabled||u==="",children:h}),r.extended&&n.jsx(be,{...e})]}),F=e.options.header||"top";return n.jsx(S,{hardware:t,widgetIcon:s,widgetState:i,widgetContent:N,headerMode:F})}class Ce extends m.Component{constructor(){super(...arguments),this.variants={}}render(){let t=this.variants.default;return this.props.options.variant in this.variants&&(t=this.variants[this.props.options.variant]),n.jsx(t,{...this.props})}}function U(e){const[t,r]=m.useState({}),s=m.useRef(null);return m.useEffect(()=>{if(s.current){const i=s.current;r({width:i.clientWidth,height:i.clientHeight})}},[]),n.jsx("div",{ref:s,style:{width:"100%",height:"100%"},className:e.className,children:t.width>0&&n.jsx("div",{className:"full-sizer",style:{width:`${t.width}px`,height:`${t.height}px`,overflow:"scroll"},children:e.children})})}const Se=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),Oe=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));function Ee(e){return n.jsx("div",{className:"panel-header",style:e.style,children:e.children})}function Me(e){return n.jsx("div",{className:"panel-contents",style:e.style,children:e.children})}function g(e){const t=e.scroll?U:m.Fragment;return n.jsx("div",{className:`panel ${e.className??""}`,style:e.style,children:n.jsx(t,{children:e.children})})}g.Header=Ee;g.Contents=Me;const E={};function W(e,t){E[e]=t}function y(e,t,r=!0){if(!e)return n.jsx(n.Fragment,{});const{type:s}=e,i=s&&s in E?E[s]:E.component;return n.jsx(i,{yamlNode:e,panel:r},t)}function Ae({children:e,key:t,panel:r,options:s}){return r?n.jsx(g,{style:s.style,scroll:s.scroll,children:n.jsx(g.Contents,{children:e})},t):n.jsx(n.Fragment,{children:m.Children.map(e,i=>m.isValidElement(i)?m.cloneElement(i,{key:t,...i.props}):void 0)})}function Z(e,t){const{_parentNode:r,_indexFromParent:s,...i}=t;if(e&&Object.keys(i).length>0)throw new M(e,Object.keys(i))}class O extends Error{constructor(t,r){super(t),this.yamlNode=r}}class M extends O{constructor(t,r){super(`Unexpected keys: ${r.join(", ")}`,t),this.keys=r}}class C extends O{constructor(t,r){super(`Keys ${r.join(", ")} are missing`,t),this.keys=r}}class p extends O{constructor(t,r,s){super(`Key ${r} error: ${s}`,t),this.key=r,this.keyMessage=s}}function Ie(e){let t=e;for(;t._parentNode;)t=t._parentNode;return t}function Fe(e){const t=[];let r=e;for(;r;)t.push({node:r,indexFromParent:r._indexFromParent}),r=r._parentNode;return t.reverse(),t}function J(e,t=null,r=null){if(e._parentNode)throw new Error("Attribute _parentNode was already defined by the yml layout.");const s={...e,_parentNode:t,_indexFromParent:r};if(e.children){const i=[...e.children];Object.freeze(i),s.children=i.map((a,d)=>J(a,s,d))}return Object.freeze(s),s}function De(e){return n.jsx(o.Alert,{variant:"danger",children:e.message})}function ke(e){const{error:t}=e;if(!(t instanceof O))return n.jsx(n.Fragment,{});function r(a,d=3){const l=Fe(a.yamlNode),h=[];let u="";for(let c=1;c<l.length;c++){const{node:f,indexFromParent:x}=l[c];h.push(`${u}children:`),u+=" ".repeat(d),x===1?h.push(`${u}- type: ...`):(x??0>1)&&h.push(`${u}...`,`${u}...`,`${u}# children number ${x??0+1}`),h.push(`${u}- type: ${f.type}`),u+=" ".repeat(2)}return a instanceof M?a.keys.forEach(c=>{h.push(`${u}${c}: ... ${" ".repeat(50-u.length-c.length)}<-- unexpected key`)}):a instanceof C?a.keys.forEach(c=>{h.push(`${u}???: ${" ".repeat(50-u.length-c.length)}<-- key **${c}** is expected`)}):a instanceof p&&h.push(`${u}${a.key}: ${" ".repeat(50-u.length-a.key.length)}<-- ${a.keyMessage}`),h.join(`
2
- `)}const i=Ie(t.yamlNode).name;if(t instanceof M){const a=t.keys.length===1?"key":"keys";return n.jsxs(o.Alert,{variant:"danger",children:["Unexpected ",a," ",t.keys.map((d,l)=>n.jsxs(n.Fragment,{children:[l!==0&&", ",n.jsx("b",{children:d})]}))," ","from the layout name ",n.jsx("b",{children:i}),".",n.jsx("br",{}),n.jsx("pre",{className:"mt-3",children:r(t)}),n.jsx("br",{})]})}if(t instanceof C){const a=t.keys.length===1?"Key":"Keys";return n.jsxs(o.Alert,{variant:"danger",children:["Expected ",a," ",t.keys.map((d,l)=>n.jsxs(n.Fragment,{children:[l!==0&&", ",n.jsx("b",{children:d})]}))," ","from the layout name ",n.jsx("b",{children:i}),".",n.jsx("br",{}),n.jsx("pre",{className:"mt-3",children:r(t)}),n.jsx("br",{})]})}return t instanceof p?n.jsxs(o.Alert,{variant:"danger",children:["Error on key ",n.jsx("b",{children:t.key})," from the layout name ",n.jsx("b",{children:i}),".",n.jsx("br",{}),n.jsx("pre",{className:"mt-3",children:r(t)}),n.jsx("br",{})]}):n.jsx(De,{...e})}const V={hasError:!1,message:"",error:void 0};class Pe extends m.Component{constructor(t){super(t),this.reload=()=>{window.location.reload()},this.state=V}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t){t instanceof O&&this.setState({hasError:!0,message:t.message,error:t})}componentDidUpdate(t,r){this.state.hasError&&r.error!==void 0&&t.resetKey!==this.props.resetKey&&this.setState(V)}render(){return this.state.hasError?n.jsxs(o.Container,{className:"mt-2",children:[n.jsx("h4",{children:"Something went wrong"}),n.jsx(ke,{message:this.state.message,error:this.state.error}),n.jsxs("p",{children:["This error has been logged. Please"," ",n.jsxs(o.Button,{size:"sm",onClick:this.reload,children:[n.jsx("i",{className:"fa fa-refresh"})," Reload"]})," ","the application"]})]}):this.props.children}}function Re(e,t,r){if(e&&r===void 0)throw new C(e,[t])}function $e(e,t,r){if(typeof r!="string")throw new p(e,t,"A string is expected")}function Te(e,t,r){if(typeof r!="boolean")throw new p(e,t,"A boolean is expected")}function _e(e,t,r){if(typeof r!="number")throw new p(e,t,"A number is expected")}function P(e,t,r){if(r!==void 0&&typeof r!="boolean")throw new p(e,t,"An optional boolean is expected")}function Q(e,t,r){if(r!==void 0&&typeof r!="string")throw new p(e,t,"An optional string is expected")}function Be(e,t,r){if(!Array.isArray(r))throw new p(e,t,"A list of string is expected");r.forEach(s=>{if(typeof s!="string")throw new p(e,t,"A list of string is expected")})}function He(e,t,r){if(r!==void 0&&typeof r!="string"){if(!Array.isArray(r))throw new p(e,t,"An optional string or list of string is expected");r.forEach(s=>{if(typeof s!="string")throw new p(e,t,"An optional string or list of string is expected")})}}function Ve(e,t,r){if(r!==void 0){if(!Array.isArray(r))throw new p(e,t,"An optional list of string is expected");r.forEach(s=>{if(typeof s!="string")throw new p(e,t,"A optional list of string is expected")})}}function X(e,t,r){if(r!==void 0&&typeof r!="number")throw new p(e,t,"An optional number is expected")}function Le(e,t,r){if(r!==void 0){if(!Array.isArray(r))throw new p(e,t,"An optional list of numbers is expected");r.forEach(s=>{if(typeof s!="number")throw new p(e,t,"An optional list of numbers is expected")})}}function I(e,t){const{_parentNode:r,_indexFromParent:s,...i}=t;if(e&&Object.keys(i).length>0)throw new M(e,Object.keys(i))}function Ye(e,t,r){if(r!=="last"&&typeof r!="number")throw new p(e,t,'"last" or a number is expected')}function qe(e,t,r){if(r!==void 0&&r!=="h5web"&&r!=="plotly")throw new p(e,t,'"h5web" or "plotly" string is expected')}const Ge=Object.freeze(Object.defineProperty({__proto__:null,assertBoolean:Te,assertDataCollectionId:Ye,assertKeyExpected:Re,assertNoUnknownKeys:I,assertNumber:_e,assertOptionalBackend:qe,assertOptionalBoolean:P,assertOptionalNumber:X,assertOptionalNumberList:Le,assertOptionalString:Q,assertOptionalStringList:Ve,assertOptionalStringOrStringList:He,assertString:$e,assertStringList:Be},Symbol.toStringTag,{value:"Module"}));function Ke({yamlNode:e,panel:t}){const{type:r,style:s,children:i,...a}=e;return I(e,a),n.jsx(o.Row,{className:"ymllayout-row gx-0",style:s,children:j.map(i,(d,l)=>y(d,l,t))})}function ze({yamlNode:e,panel:t}){const{type:r,style:s,xs:i,children:a,...d}=e;return I(e,d),X(e,"xs",i),n.jsx(o.Col,{className:A.default("yamymllayout-col",{col:!!i}),style:s,xs:i,children:j.map(e.children,(l,h)=>y(l,h,t))})}const R={};function Ue(e,t){R[e]=t}function We(e,t){if(t===void 0)throw new C(e,["id"]);if(typeof t.id!="string")throw new p(e,"id","A string is expected")}function Ze(e,t,r){if(r!==void 0){if(!Array.isArray(r))throw new p(e,"ids","A option list is expected");r.forEach((s,i)=>{try{We(e,s)}catch{throw new p(e,"ids",`The hardware description ${i} is wrong`)}})}}function Je(e){const{providers:t={},yamlNode:r,ids:s,groupid:i,even:a,nowrap:d,...l}=e;if(Ze(r,"ids",s),Q(r,"groupid",i),P(r,"even",a),P(r,"nowrap",d),I(r,l),!R.HardwareGroup)return n.jsx(o.Alert,{variant:"warning",children:"No `HardwareGroup` component registered"});const h=R.HardwareGroup;return n.jsx(h,{providers:t,ids:s,groupid:i,nowrap:d||!1,even:a||!1})}const $={hardwaregroup:Je};function Qe(e,t){$[e]=t}function Xe(e){const{yamlNode:t,panel:r}=e,{type:s,style:i,scroll:a,title:d,...l}=t;if(!(s in $))return n.jsx(g,{children:n.jsx(g.Contents,{children:n.jsxs(o.Alert,{variant:"warning",children:['Unknown component "',s,'"']})})});const h=$[t.type];return r?n.jsx(g,{style:i,scroll:a,children:n.jsxs(m.Suspense,{fallback:n.jsx("p",{children:"Loading..."}),children:[d&&n.jsx(g.Header,{children:d}),n.jsx(g.Contents,{children:n.jsx(h,{...l,yamlNode:t})})]})}):n.jsx(m.Suspense,{fallback:n.jsx("p",{children:"Loading..."}),children:n.jsx(h,{...l,yamlNode:t})})}function et({yamlNode:e,panel:t}){const r=e.options||{};return n.jsx(o.Container,{className:"ymllayout-container",...r,children:j.map(e.children,(s,i)=>y(s,i,t))})}function tt(e){const{yamlNode:t}=e,r=t.options||{},s={};return r.centerContent&&(s.margin="auto"),n.jsxs(g,{className:"ymllayout-panel",...r,children:[t.title&&n.jsx(g.Header,{children:t.title}),n.jsx(g.Contents,{style:s,children:j.map(t.children,(i,a)=>y(i,a,!1))})]})}const nt=()=>Math.random().toString(36).slice(2,15)+Math.random().toString(36).slice(2,15);function rt({yamlNode:e,panel:t}){const r=[];return j.each(e.children,(s,i)=>{r.push(n.jsx(o.Tab,{eventKey:nt(),title:s.title,children:y(s,0,!1)},i))}),t?n.jsxs(g,{className:"ymllayout-tabs",children:[e.title&&n.jsx(g.Header,{children:e.title}),n.jsx(g.Contents,{children:n.jsx(o.Tabs,{mountOnEnter:!0,children:r})})]}):n.jsx(o.Tabs,{children:r})}function st(e){const{node:t}=e,{type:r,title:s,...i}=t;return Z(t,i),n.jsx("div",{style:{gridColumn:"1 / 3"},children:n.jsx("h3",{children:s})})}function it(e){const{node:t,state:r,row:s}=e,{title:i}=t;function a(){if(t.id)return t.id}function d(){if(i!==void 0)return i;if(t.type==="hardware"){const h=a(),u={_parentNode:t._parentNode,_indexFromParent:t._indexFromParent,type:"hardware",id:h,variant:"name",emptyifnone:!0};return y(u,"a",!1)}return""}const l=d();return n.jsxs("div",{style:{textAlign:"center"},children:[n.jsx("h5",{style:{margin:"0px",whiteSpace:"nowrap"},children:l}),r&&n.jsx("div",{style:{position:"relative",top:-5},children:r})]})}function at(e){const{node:t,row:r}=e,{titlealign:s,title:i,stateinheader:a=!1,variant:d,id:l,...h}=t;let u,c;if(h.type==="hardware")if(u={...h,id:l,variant:d},a){const f={...h,id:l,variant:"state",emptyifnone:!0};c=y(f,"k",!1)}else c=null;else u=h,c=null;return n.jsxs(n.Fragment,{children:[n.jsx("div",{style:{gridColumn:1,alignSelf:s??"center"},children:n.jsx(it,{node:t,state:c,row:r})}),n.jsx("div",{style:{gridColumn:2},children:y(u,"k",!1)})]})}function ot(e){const{yamlNode:t,panel:r}=e,{type:s,children:i,options:a={},title:d,...l}=t;return Z(t,l),n.jsxs(g,{className:"ymllayout-form",...a,children:[t.title&&n.jsx(g.Header,{children:t.title}),n.jsx(g.Contents,{children:n.jsx("div",{style:{display:"grid",gridTemplateColumns:"min-content auto"},children:j.map(i,(h,u)=>h.type==="formheader"?n.jsx(st,{node:h,row:u},u):n.jsx(at,{node:h,row:u},u))})})]})}function lt(e){const{yamlNode:t,panel:r}=e;return n.jsxs("div",{className:"ymllayout-grid",style:{gridTemplateColumns:t.columns,gridTemplateRows:t.rows},children:[j.map(t.children,(s,i)=>{const{columnSpan:a=1,rowSpan:d=1,...l}=s,h=a>1?`span ${a}`:void 0,u=d>1?`span ${d}`:void 0;return n.jsx("div",{className:"ymllayout-grid-cell",style:{gridColumn:h,gridRow:u},children:y(l,i,r)},i)})," "]})}function ct({yamlNode:e,panel:t}){const r=e.options||{};return n.jsx(Ae,{panel:t,options:r,children:n.jsx("div",{children:e.label})})}const dt={row:Ke,col:ze,container:et,component:Xe,panel:tt,tabs:rt,form:ot,grid:lt,label:ct};Object.entries(dt).forEach(([e,t])=>{W(e,t)});function ut(e){var r;const t=m.useMemo(()=>J(e.layout),[e.layout]);return t.error?n.jsx("div",{className:`${e.className??""} ymllayout-main`,id:e.id,children:n.jsxs(g,{children:[n.jsx(g.Header,{children:"Layout Error"}),n.jsxs(g.Contents,{children:[n.jsxs("p",{children:["File: ",t.name]}),n.jsx(o.Alert,{variant:"warning",children:n.jsx("pre",{className:"mb-0",children:t.error})})]})]})}):n.jsx("div",{className:`${e.className??""} ymllayout-main`,id:e.id,children:n.jsx(Pe,{resetKey:t,children:(r=t.children)==null?void 0:r.map((s,i)=>y(s,i))})})}const ht=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));exports.Formatting=ce;exports.Frontend=ue;exports.FullSizer=U;exports.HWObject=ht;exports.HardwareInputNumber=k;exports.HardwareNumericStep=z;exports.HardwareSchema=Oe;exports.HardwareState=fe;exports.HardwareTemplate=S;exports.HardwareTypes=Se;exports.HardwareVariant=Ce;exports.Info=he;exports.KeyError=p;exports.MissingKeysError=C;exports.MotorDefault=xe;exports.Multiposition=ge;exports.NoObject=je;exports.NumericStep=K;exports.Property=ve;exports.ShutterDefault=Ne;exports.TypeIcon=b;exports.YAMLLayout=ut;exports.YamlAsserts=Ge;exports.registerHardwareComponent=Ue;exports.registerYamlComponent=Qe;exports.registerYamlType=W;exports.renderYamlNode=y;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),j=require("lodash"),o=require("react-bootstrap"),m=require("react"),ne=require("classnames"),re=require("debug"),L=e=>e&&typeof e=="object"&&"default"in e?e:{default:e},A=L(ne),se=L(re);function ie(e){const{activeMessage:t="Online",inactiveMessage:r="Offline",message:s="This device is"}=e;return n.jsx("div",{className:`dot-indicator small bg-${e.online?"success":"danger"}`,title:`${s} ${e.online?t:r}`})}function b(e){const{name:t,icon:r}=e;return n.jsxs("div",{className:"icon",title:t,children:[n.jsx("i",{className:`fa ${r}`}),n.jsx(ie,{...e})]})}function ae(e){const t={24:"Y",21:"Z",18:"E",15:"P",12:"T",9:"G",6:"M",3:"k","-3":"m","-6":"µ","-9":"n","-12":"p","-15":"f","-18":"a","-21":"z","-24":"y"},r=Math.log(e)/Math.log(1e3),s=!Number.isInteger(r),i=3*Math.ceil(r-(s?1:0)),a=i===0?"":t[i];return{scalar:e*10**-i,prefix:a,multiplier:10**-i}}function oe(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Y(e){if(e<60)return`${Math.round(e)} sec`;const t=Math.round(e/60),r=t%60,s=Math.floor(t/60);return s?`${s} hr ${r} min`:`${r} min`}function le(e){return e>0?(662607004e-42*299792458/(e*1e-10)/160218e-24*.001).toFixed(4):0}function ce(e,t){return Number.parseFloat(e.toFixed(t))}const de=Object.freeze(Object.defineProperty({__proto__:null,formatEng:ae,round:ce,toEnergy:le,toHoursMins:Y,ucfirst:oe},Symbol.toStringTag,{value:"Module"}));function ue(e){const{hardware:t}=e;function r(d){t.requestChange({function:"reset"})}const s={"Front End":"feitlk",Experimental:"expitlk",PSS:"pssitlk"},i={Current:`${t.properties.current.toFixed(1)} mA`,Mode:t.properties.mode,Refill:Y(t.properties.refill),Message:n.jsx("pre",{children:t.properties.message})};function a(d){if(!(d in t.properties))return"UNKNOWN";const l=t.properties[d];return!l||typeof l!="string"?"UNKNOWN":l}return n.jsx(o.OverlayTrigger,{trigger:"click",rootClose:!0,overlay:n.jsxs(o.Popover,{id:"popid",children:[n.jsxs(o.Popover.Header,{children:[t.name," Details"]}),n.jsxs(o.Popover.Body,{children:[n.jsx("h6",{children:"Status"}),n.jsx("pre",{children:t.properties.status}),n.jsx("h6",{children:"Interlocks"}),n.jsx(o.Container,{children:j.map(s,(d,l)=>n.jsxs(o.Row,{children:[n.jsxs(o.Col,{children:[l,":"]}),n.jsx(o.Col,{children:n.jsx(o.Badge,{bg:a(d)==="ON"?"success":"danger",children:a(d)})})]},l))}),n.jsx("h6",{children:"Ring Status"}),n.jsx(o.Container,{children:j.map(i,(d,l)=>n.jsxs(o.Row,{children:[n.jsxs(o.Col,{children:[l,":"]}),n.jsx(o.Col,{children:d})]},l))}),n.jsx("div",{className:"d-grid gap-2",children:n.jsx(o.Button,{disabled:e.disabled,onClick:r,children:"Reset"})})]})]}),children:n.jsx(o.Button,{className:"flex-grow-0",title:"Shutter Details",children:n.jsx("i",{className:"fa fa-ellipsis-h"})})})}function he(e){const{hardware:t,options:r={}}=e;function s(i){t.requestChange({function:t.properties.frontend==="FE open"?"close":"open"})}return n.jsxs("div",{className:"hw-component",children:[n.jsxs("div",{className:"hw-head",children:[n.jsx(b,{name:"Frontend",icon:"fam-hardware-frontend",online:t.online}),n.jsx("div",{className:"name",children:t.name}),n.jsx(o.Badge,{bg:t.properties.state==="OPEN"||t.properties.state==="RUNNING"?"success":"danger",children:t.properties.state})]}),n.jsx("div",{className:"hw-content",children:n.jsxs(o.ButtonGroup,{className:"d-flex",children:[n.jsx(o.Button,{variant:t.properties.frontend==="FE open"?"danger":"success",onClick:s,disabled:e.disabled,children:t.properties.frontend==="FE open"?"Close":"Open"}),n.jsx(ue,{...e})]})})]})}function fe(e){const{hardware:t,options:r={}}=e;function s(){const i=r.property;if(i===void 0)return"property is not set";if(i===null)return"property is null";let a=t;for(const d of i.split("/"))if(a=a[d],a===void 0)return`property '${i}' not found`;return`${a}`}return n.jsx(n.Fragment,{children:s()})}function S(e){const{headerMode:t,hardware:r}=e;function s(){return r.alias?r.alias:r.name?r.name:r.id}const i=s();switch(t){case"front":return n.jsx("div",{className:"hw-component",children:n.jsxs("div",{className:"hw-single",children:[e.widgetIcon,n.jsx("div",{className:"name",children:i}),n.jsx("div",{className:"d-inline-block",children:e.widgetContent})]})});case"none":return n.jsx("div",{className:"hw-component",children:n.jsx("div",{className:"hw-single",children:e.widgetContent})});case"state":return e.widgetState;default:return n.jsxs("div",{className:"hw-component",children:[n.jsxs("div",{className:"hw-head",children:[e.widgetIcon,n.jsx("div",{className:"name",children:n.jsx(o.Form.Label,{htmlFor:r.id,children:i})}),e.widgetState,e.hardware.errors&&e.hardware.errors.length>0&&n.jsx(o.OverlayTrigger,{trigger:"click",placement:"bottom",rootClose:!0,overlay:n.jsxs(o.Popover,{id:e.hardware.id,style:{maxWidth:500},children:[n.jsx(o.Popover.Header,{children:"Device Errors"}),n.jsxs(o.Popover.Body,{children:["There were errors with properties on this device:",n.jsx("ul",{children:e.hardware.errors.map(a=>n.jsxs("li",{children:[a.property,":",n.jsxs("span",{className:"stack-trace",children:[a.traceback,n.jsx("br",{}),a.exception]})]}))})]})]}),children:n.jsx(o.Button,{variant:"danger",size:"sm",children:n.jsx("i",{className:"fa fa-exclamation-triangle"})})})]}),n.jsx("div",{className:"hw-content",children:e.widgetContent})]})}}function T(e){const t={display:"inline-block",minWidth:""};return e.minWidth&&(t.minWidth=`${e.minWidth}em`),n.jsx("div",{style:t,children:n.jsx(o.Badge,{bg:e.variant,children:e.state})})}function q(e){const{hardware:t}=e;function r(){if(!t.online)return"OFFLINE";let i="UNKNOWN";return e.hardware.properties.state&&([i]=e.hardware.properties.state),i}const s=r();return n.jsx(T,{state:s,minWidth:6,variant:s==="READY"?"success":"warning"})}function G(e){const{hardware:t}=e;function r(){if(!t.online)return"OFFLINE";const a=t.properties.state;return e.useReadyState&&(a==="OPEN"||a==="CLOSED")?"READY":a}const s=r();function i(){switch(s){case"READY":return"success";case"OPEN":return"success";case"CLOSED":return"danger";case"DISABLED":return"secondary";case"MOVING":case"STANDBY":case"OFFLINE":return"warning";case"FAULT":return"fatal";default:return"fatal"}}return n.jsx(T,{state:s,minWidth:6,variant:i()})}const me=Object.freeze(Object.defineProperty({__proto__:null,HardwareState:T,MotorState:q,ShutterState:G},Symbol.toStringTag,{value:"Module"})),pe=m.forwardRef((e,t)=>{const r=m.useRef(null),[s,i]=m.useState(e.step),a=w=>{const D=t;if(r.current===null)return;let B=Number.parseFloat(D.current.value);const H=Number.parseFloat(r.current.value);B+=w?H:-H,D.current.value=`${B}`,e.onStep&&e.onStep({target:D.current})},{onStep:d,step:l,overlay:h,incIcon:u,decIcon:c,swapIncDec:f,onKeyDown:x,horizontalArrows:N,largeArrows:F,...v}=e,_=w=>{w.key==="ArrowUp"?(w.preventDefault(),a(!0)):w.key==="ArrowDown"?(w.preventDefault(),a(!1)):x&&x(w)};if(!e.step)return n.jsx(o.Form.Control,{ref:t,type:"number",step:"any",onKeyDown:_,...v});const te=j.map(e.steps||[e.step],w=>n.jsx("option",{value:w,children:w},w));return n.jsx("div",{className:A.default("numeric-step",{"numeric-step-large":F,"numeric-step-horizontal":N}),children:n.jsxs(o.InputGroup,{children:[n.jsx(o.Form.Control,{onKeyDown:_,ref:t,type:"number",step:"any",...v}),n.jsxs(n.Fragment,{children:[h,!h&&n.jsxs(o.InputGroup.Text,{className:"d-flex flex-column",children:[n.jsx(o.Form.Control,{ref:r,as:"select",className:"step-size",defaultValue:s,onChange:w=>i(Number.parseFloat(w.target.value)),children:te}),e.unit&&n.jsx("div",{children:e.unit}),!u&&!c&&n.jsxs(n.Fragment,{children:[n.jsx(o.Button,{className:"step step-up",disabled:e.disabled,onClick:w=>a(!0)}),n.jsx(o.Button,{className:"step step-down",disabled:e.disabled,onClick:w=>a(!1)})]})]}),c&&f&&n.jsx(o.Button,{disabled:e.disabled,onClick:w=>a(!1),children:n.jsx("i",{className:`fa fa-fw fa-${c}`})}),u&&n.jsx(o.Button,{disabled:e.disabled,onClick:w=>a(!0),children:n.jsx("i",{className:`fa fa-fw fa-${u}`})}),c&&!f&&n.jsx(o.Button,{disabled:e.disabled,onClick:w=>a(!1),children:n.jsx("i",{className:`fa fa-fw fa-${c}`})})]})]})})}),K=pe;function z(e){const t=m.useRef(null),[r,s]=m.useState(!1),[i,a]=m.useState(!1);m.useEffect(()=>{t.current&&(e.hardwareValue===null?t.current.value="":t.current.value=e.hardwareValue.toString(),s(!1))},[e.hardwareValue]);function d(f){let x=f;e.precision!==void 0&&(x=Number.parseFloat(x).toFixed(e.precision)),t!=null&&t.current&&(t.current.value=x)}function l(){r&&setTimeout(()=>{d(e.hardwareValue),s(!1)},3e3)}function h(f){e.hardwareValue!==null&&(s(!0),t!=null&&t.current&&(t.current.value=f.target.value),f.target.value===e.hardwareValue.toString()&&s(!1))}function u(f){s(!1),e.onMoveRequested(f.target.value)}function c(f){switch(f.key){case"Enter":{s(!1);const x=Number.parseFloat(f.target.value),N=e.onMoveRequested(x);N&&N.catch(()=>{a(!0),setTimeout(()=>{d(e.hardwareValue),a(!1)},2e3)})}f.preventDefault(),f.stopPropagation();break;case"Esc":case"Escape":r&&(a(!1),s(!1),d(e.hardwareValue)),f.target.blur(),f.preventDefault(),f.stopPropagation();break}}return n.jsx(K,{id:e.id,className:A.default({"form-control-edited":r,"form-control-error":i,"hw-moving":e.hardwareIsMoving}),type:e.readOnly?"text":"number",ref:t,precision:e.precision,onChange:h,onBlur:l,onStep:u,onKeyDown:c,disabled:e.hardwareIsDisabled||e.readOnly||!e.hardwareIsReady,step:e.step,steps:e.steps,incIcon:e.incIcon,decIcon:e.decIcon,swapIncDec:e.swapIncDec,horizontalArrows:e.horizontalArrows,largeArrows:e.largeArrows,overlay:e.hardwareIsMoving&&!e.hardwareIsDisabled?n.jsx(o.Button,{variant:"danger",onClick:e.onAbortRequested,children:n.jsx("i",{className:"fa fa-times"})}):null})}function k(e){const t=m.useRef(null),[r,s]=m.useState(!1),[i,a]=m.useState(!1);function d(c){return e.precision!==void 0?Number.parseFloat(c).toFixed(e.precision):c}m.useEffect(()=>{var c;t.current&&(t.current.value=d((c=e.hardwareValue)==null?void 0:c.toString()),s(!1))},[e.hardwareValue,e.precision]);function l(c){const f=d(c);t!=null&&t.current&&(t.current.value=f)}function h(c){switch(c.key){case"Enter":{s(!1);const f=Number.parseFloat(c.target.value),x=e.onMoveRequested(f);x&&x.catch(()=>{a(!0),setTimeout(()=>{l(e.hardwareValue),a(!1)},2e3)}),c.preventDefault(),c.stopPropagation();break}case"Esc":case"Escape":r&&(a(!1),s(!1),l(e.hardwareValue)),c.target.blur(),c.preventDefault(),c.stopPropagation();break}}function u(c){s(!0),c.target,t!=null&&t.current&&(t.current.value=c.target.value),c.target.value===e.hardwareValue.toString()&&s(!1)}return n.jsx(o.Form.Control,{className:A.default({"form-control-edited":r,"form-control-error":i,"hw-moving":e.hardwareIsMoving}),type:"number",ref:t,onChange:u,onKeyDown:h,disabled:e.readOnly||e.hardwareIsMoving||e.hardwareIsDisabled,step:e.step})}function xe(e){function t(i){return e.hardware.requestChange({property:"velocity",value:i})}function r(i){return e.hardware.requestChange({property:"acceleration",value:i})}let s="UNKNOWN";return e.hardware.properties.state&&([s]=e.hardware.properties.state),n.jsx(o.OverlayTrigger,{trigger:"click",rootClose:!0,overlay:n.jsxs(o.Popover,{id:"popid",children:[n.jsxs(o.Popover.Header,{children:[e.hardware.name," details"]}),n.jsxs(o.Popover.Body,{children:[n.jsxs(o.Form.Group,{children:[n.jsx(o.Form.Label,{children:"Velocity"}),n.jsx(k,{hardwareValue:e.hardware.properties.velocity,onMoveRequested:t,hardwareIsDisabled:e.disabled,hardwareIsReady:s==="READY",hardwareIsMoving:s==="MOVING",readOnly:e.readOnly})]}),n.jsxs(o.Form.Group,{children:[n.jsx(o.Form.Label,{children:"Acceleration"}),n.jsx(k,{hardwareValue:e.hardware.properties.acceleration,onMoveRequested:r,hardwareIsDisabled:e.disabled,hardwareIsReady:s==="READY",hardwareIsMoving:s==="MOVING",readOnly:e.readOnly})]})]})]}),children:n.jsx(o.Button,{children:n.jsx("i",{className:"fa fa-ellipsis-h"})})})}function ge(e){const{hardware:t,options:r={}}=e;function s(){t.requestChange({function:"stop"})}function i(u){return t.requestChange({property:"position",value:u,function:"move"})}let a="UNKNOWN";e.hardware.properties.state&&([a]=e.hardware.properties.state);const d=n.jsx(b,{name:"Motor",icon:"fam-hardware-motor",online:t.online}),l=n.jsx(q,{hardware:t}),h=e.options?e.options.header:"top";return n.jsx(S,{hardware:t,widgetIcon:d,widgetState:l,widgetContent:n.jsxs(o.InputGroup,{children:[n.jsx(z,{id:t.id,hardwareValue:t.properties.position,hardwareIsDisabled:e.disabled,hardwareIsReady:a==="READY",hardwareIsMoving:a==="MOVING",onMoveRequested:i,onAbortRequested:s,precision:r.precision,readOnly:r.readOnly,step:r.step,steps:r.steps,incIcon:r.incicon,decIcon:r.decicon,swapIncDec:r.swapincdec,horizontalArrows:r.horizontalarrows,largeArrows:r.largearrows}),t.properties.unit&&n.jsx(o.InputGroup.Text,{children:t.properties.unit}),a!=="MOVING"&&r.extended&&n.jsx(xe,{hardware:t,disabled:e.disabled,readOnly:r.readOnly}),a==="MOVING"&&!e.disabled&&!r.step&&n.jsx(o.Button,{variant:"danger",onClick:s,children:n.jsx("i",{className:"fa fa-times"})})]}),headerMode:h})}function we(e){const{hardware:t,options:r={}}=e,s=m.useRef(null);m.useEffect(()=>{if(!s.current){console.error("selectionRef ref is unset");return}s.current.value=t.properties.position},[t.properties.position]);function i(l){if(console.debug("change",l),!s||!s.current){console.error("selection ref is unset");return}t.requestChange({value:s.current.value,function:"move"})}function a(l){t.requestChange({function:"stop"})}const d=j.map(t.properties.positions,l=>n.jsx("option",{title:l.description,children:l.position},l.position));return n.jsxs("div",{className:"hw-component",children:[n.jsxs("div",{className:"hw-head",children:[n.jsx(b,{name:"Multiposition",icon:"fam-hardware-multiposition",online:t.online}),n.jsx("div",{className:"name",children:t.name}),n.jsx(o.Badge,{bg:t.properties.state==="READY"?"success":"warning",children:t.properties.state})]}),n.jsx("div",{className:"hw-content",children:n.jsxs(o.InputGroup,{children:[n.jsxs(o.Form.Control,{className:"custom-select",as:"select",ref:s,disabled:e.disabled,defaultValue:t.properties.position,children:[n.jsx("option",{disabled:!0,children:"unknown"}),d]}),t.properties.state!=="MOVING"&&n.jsx(o.Button,{onClick:i,disabled:e.disabled,children:"Move"}),t.properties.state==="MOVING"&&!e.disabled&&n.jsx(o.Button,{variant:"danger",onClick:a,children:n.jsx("i",{className:"fa fa-times"})})]})})]})}const je=se.default("daiquiri.components.hardware.NoObject");function ye(e){if(e.options.emptyifnone)return je('Component id:"%s" name:"%s" not displayed cause setup with emptyifnone.',e.id,e.name),n.jsx(n.Fragment,{});const t=n.jsx(b,{name:"NoObject",icon:"fam-hardware-any",online:!1}),r=n.jsx(n.Fragment,{}),s=n.jsx(n.Fragment,{children:"Missing"}),i=e.options?e.options.header:"top",a={id:e.id,name:e.name??"",alias:null,online:!1,properties:{},type:""};return n.jsx(S,{hardware:a,widgetIcon:t,widgetState:r,widgetContent:s,headerMode:i})}function ve(e){const t=e.online?"READY":"OFFLINE";return n.jsx(o.Badge,{bg:t==="READY"?"success":"warning",children:t})}function be(e){const{hardware:t,options:r={}}=e,s=n.jsx(b,{name:"Optic",icon:"fa-cog",online:t.online}),i=n.jsx(ve,{...t});function a(){const c=r.property;if(c===void 0)return"property is not set";if(c===null)return"property is null";let f=t;for(const x of c.split("/"))if(f=f[x],f===void 0)return`property '${c}' not found`;return`${f}`}function d(){const c=r.unit;if(!c)return null;if(!c.includes("properties"))return c;let f=e;for(const x of c.split("/"))if(f=f[x],f===void 0)return null;return`${f}`}const l=d(),h=n.jsxs(o.InputGroup,{children:[n.jsx(o.Form.Control,{value:a(),readOnly:!0}),l&&n.jsx(o.InputGroup.Text,{children:l})]}),u=e.options.header||"top";return n.jsx(S,{hardware:t,widgetIcon:s,widgetState:i,widgetContent:h,headerMode:u})}function Ne(e){const{hardware:t}=e,r=()=>{t.requestChange({function:"reset"})};return n.jsx(o.OverlayTrigger,{trigger:"click",rootClose:!0,overlay:n.jsxs(o.Popover,{id:"popid",children:[n.jsxs(o.Popover.Header,{children:[t.name," Details"]}),n.jsxs(o.Popover.Body,{children:[n.jsx("h6",{children:"Status"}),n.jsx("pre",{children:t.properties.status}),n.jsx("div",{className:"d-grid gap-2",children:n.jsx(o.Button,{onClick:r,disabled:e.disabled,children:"Reset"})})]})]}),children:n.jsx(o.Button,{className:"flex-grow-0",title:"Shutter Details",children:n.jsx("i",{className:"fa fa-ellipsis-h"})})})}function Ce(e){const{hardware:t,options:r={}}=e,s=n.jsx(b,{name:"Shutter",icon:"fam-hardware-shutter",online:t.online}),i=n.jsx(G,{hardware:t});function a(){return t.properties?t.properties.state:"UNKNOWN"}function d(v){return v==="OPEN"?["Close","close"]:v==="CLOSED"?["Open","open"]:v==="DISABLED"||v==="STANDBY"||v==="FAULT"?["Closed",""]:v==="MOVING"?["...",""]:["Unknown",""]}const l=a(),[h,u]=d(l),f={OPEN:"danger",CLOSED:"success",MOVING:"warning",DISABLED:"secondary",STANDBY:"danger",FAULT:"fatal",UNKNOWN:"warning"}[l]||"danger";function x(){t.requestChange({function:u})}const N=n.jsxs(o.ButtonGroup,{className:"d-flex flex-nowrap",children:[n.jsx(o.Button,{variant:f,onClick:x,disabled:e.disabled||u==="",children:h}),r.extended&&n.jsx(Ne,{...e})]}),F=e.options.header||"top";return n.jsx(S,{hardware:t,widgetIcon:s,widgetState:i,widgetContent:N,headerMode:F})}class Se extends m.Component{constructor(){super(...arguments),this.variants={}}render(){let t=this.variants.default;return this.props.options.variant in this.variants&&(t=this.variants[this.props.options.variant]),n.jsx(t,{...this.props})}}function U(e){const[t,r]=m.useState({}),s=m.useRef(null);return m.useEffect(()=>{if(s.current){const i=s.current;r({width:i.clientWidth,height:i.clientHeight})}},[]),n.jsx("div",{ref:s,style:{width:"100%",height:"100%"},className:e.className,children:t.width>0&&n.jsx("div",{className:"full-sizer",style:{width:`${t.width}px`,height:`${t.height}px`,overflow:"scroll"},children:e.children})})}const Oe=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),Ee=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));function Me(e){return n.jsx("div",{className:"panel-header",style:e.style,children:e.children})}function Ae(e){return n.jsx("div",{className:"panel-contents",style:e.style,children:e.children})}function g(e){const t=e.scroll?U:m.Fragment;return n.jsx("div",{className:`panel ${e.className??""}`,style:e.style,children:n.jsx(t,{children:e.children})})}g.Header=Me;g.Contents=Ae;const E={};function W(e,t){E[e]=t}function y(e,t,r=!0){if(!e)return n.jsx(n.Fragment,{});const{type:s}=e,i=s&&s in E?E[s]:E.component;return n.jsx(i,{yamlNode:e,panel:r},t)}function Ie({children:e,key:t,panel:r,options:s}){return r?n.jsx(g,{style:s.style,scroll:s.scroll,children:n.jsx(g.Contents,{children:e})},t):n.jsx(n.Fragment,{children:m.Children.map(e,i=>m.isValidElement(i)?m.cloneElement(i,{key:t,...i.props}):void 0)})}function Z(e,t){const{_parentNode:r,_indexFromParent:s,...i}=t;if(e&&Object.keys(i).length>0)throw new M(e,Object.keys(i))}class O extends Error{constructor(t,r){super(t),this.yamlNode=r}}class M extends O{constructor(t,r){super(`Unexpected keys: ${r.join(", ")}`,t),this.keys=r}}class C extends O{constructor(t,r){super(`Keys ${r.join(", ")} are missing`,t),this.keys=r}}class p extends O{constructor(t,r,s){super(`Key ${r} error: ${s}`,t),this.key=r,this.keyMessage=s}}function Fe(e){let t=e;for(;t._parentNode;)t=t._parentNode;return t}function De(e){const t=[];let r=e;for(;r;)t.push({node:r,indexFromParent:r._indexFromParent}),r=r._parentNode;return t.reverse(),t}function J(e,t=null,r=null){if(e._parentNode)throw new Error("Attribute _parentNode was already defined by the yml layout.");const s={...e,_parentNode:t,_indexFromParent:r};if(e.children){const i=[...e.children];Object.freeze(i),s.children=i.map((a,d)=>J(a,s,d))}return Object.freeze(s),s}function ke(e){return n.jsx(o.Alert,{variant:"danger",children:e.message})}function Pe(e){const{error:t}=e;if(!(t instanceof O))return n.jsx(n.Fragment,{});function r(a,d=3){const l=De(a.yamlNode),h=[];let u="";for(let c=1;c<l.length;c++){const{node:f,indexFromParent:x}=l[c];h.push(`${u}children:`),u+=" ".repeat(d),x===1?h.push(`${u}- type: ...`):(x??0>1)&&h.push(`${u}...`,`${u}...`,`${u}# children number ${x??0+1}`),h.push(`${u}- type: ${f.type}`),u+=" ".repeat(2)}return a instanceof M?a.keys.forEach(c=>{h.push(`${u}${c}: ... ${" ".repeat(50-u.length-c.length)}<-- unexpected key`)}):a instanceof C?a.keys.forEach(c=>{h.push(`${u}???: ${" ".repeat(50-u.length-c.length)}<-- key **${c}** is expected`)}):a instanceof p&&h.push(`${u}${a.key}: ${" ".repeat(50-u.length-a.key.length)}<-- ${a.keyMessage}`),h.join(`
2
+ `)}const i=Fe(t.yamlNode).name;if(t instanceof M){const a=t.keys.length===1?"key":"keys";return n.jsxs(o.Alert,{variant:"danger",children:["Unexpected ",a," ",t.keys.map((d,l)=>n.jsxs(n.Fragment,{children:[l!==0&&", ",n.jsx("b",{children:d})]}))," ","from the layout name ",n.jsx("b",{children:i}),".",n.jsx("br",{}),n.jsx("pre",{className:"mt-3",children:r(t)}),n.jsx("br",{})]})}if(t instanceof C){const a=t.keys.length===1?"Key":"Keys";return n.jsxs(o.Alert,{variant:"danger",children:["Expected ",a," ",t.keys.map((d,l)=>n.jsxs(n.Fragment,{children:[l!==0&&", ",n.jsx("b",{children:d})]}))," ","from the layout name ",n.jsx("b",{children:i}),".",n.jsx("br",{}),n.jsx("pre",{className:"mt-3",children:r(t)}),n.jsx("br",{})]})}return t instanceof p?n.jsxs(o.Alert,{variant:"danger",children:["Error on key ",n.jsx("b",{children:t.key})," from the layout name ",n.jsx("b",{children:i}),".",n.jsx("br",{}),n.jsx("pre",{className:"mt-3",children:r(t)}),n.jsx("br",{})]}):n.jsx(ke,{...e})}const V={hasError:!1,message:"",error:void 0};class Q extends m.Component{constructor(t){super(t),this.reload=()=>{window.location.reload()},this.state=V}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t){t instanceof O&&this.setState({hasError:!0,message:t.message,error:t})}componentDidUpdate(t,r){this.state.hasError&&r.error!==void 0&&t.resetKey!==this.props.resetKey&&this.setState(V)}render(){return this.state.hasError?n.jsxs(o.Container,{className:"mt-2",children:[n.jsx("h4",{children:"Something went wrong"}),n.jsx(Pe,{message:this.state.message,error:this.state.error}),n.jsxs("p",{children:["This error has been logged. Please"," ",n.jsxs(o.Button,{size:"sm",onClick:this.reload,children:[n.jsx("i",{className:"fa fa-refresh"})," Reload"]})," ","the application"]})]}):this.props.children}}function Re(e,t,r){if(e&&r===void 0)throw new C(e,[t])}function $e(e,t,r){if(typeof r!="string")throw new p(e,t,"A string is expected")}function Te(e,t,r){if(typeof r!="boolean")throw new p(e,t,"A boolean is expected")}function _e(e,t,r){if(typeof r!="number")throw new p(e,t,"A number is expected")}function P(e,t,r){if(r!==void 0&&typeof r!="boolean")throw new p(e,t,"An optional boolean is expected")}function X(e,t,r){if(r!==void 0&&typeof r!="string")throw new p(e,t,"An optional string is expected")}function Be(e,t,r){if(!Array.isArray(r))throw new p(e,t,"A list of string is expected");r.forEach(s=>{if(typeof s!="string")throw new p(e,t,"A list of string is expected")})}function He(e,t,r){if(r!==void 0&&typeof r!="string"){if(!Array.isArray(r))throw new p(e,t,"An optional string or list of string is expected");r.forEach(s=>{if(typeof s!="string")throw new p(e,t,"An optional string or list of string is expected")})}}function Ve(e,t,r){if(r!==void 0){if(!Array.isArray(r))throw new p(e,t,"An optional list of string is expected");r.forEach(s=>{if(typeof s!="string")throw new p(e,t,"A optional list of string is expected")})}}function ee(e,t,r){if(r!==void 0&&typeof r!="number")throw new p(e,t,"An optional number is expected")}function Le(e,t,r){if(r!==void 0){if(!Array.isArray(r))throw new p(e,t,"An optional list of numbers is expected");r.forEach(s=>{if(typeof s!="number")throw new p(e,t,"An optional list of numbers is expected")})}}function I(e,t){const{_parentNode:r,_indexFromParent:s,...i}=t;if(e&&Object.keys(i).length>0)throw new M(e,Object.keys(i))}function Ye(e,t,r){if(r!=="last"&&typeof r!="number")throw new p(e,t,'"last" or a number is expected')}function qe(e,t,r){if(r!==void 0&&r!=="h5web"&&r!=="plotly")throw new p(e,t,'"h5web" or "plotly" string is expected')}const Ge=Object.freeze(Object.defineProperty({__proto__:null,assertBoolean:Te,assertDataCollectionId:Ye,assertKeyExpected:Re,assertNoUnknownKeys:I,assertNumber:_e,assertOptionalBackend:qe,assertOptionalBoolean:P,assertOptionalNumber:ee,assertOptionalNumberList:Le,assertOptionalString:X,assertOptionalStringList:Ve,assertOptionalStringOrStringList:He,assertString:$e,assertStringList:Be},Symbol.toStringTag,{value:"Module"}));function Ke({yamlNode:e,panel:t}){const{type:r,style:s,children:i,...a}=e;return I(e,a),n.jsx(o.Row,{className:"ymllayout-row gx-0",style:s,children:j.map(i,(d,l)=>y(d,l,t))})}function ze({yamlNode:e,panel:t}){const{type:r,style:s,xs:i,children:a,...d}=e;return I(e,d),ee(e,"xs",i),n.jsx(o.Col,{className:A.default("yamymllayout-col",{col:!!i}),style:s,xs:i,children:j.map(e.children,(l,h)=>y(l,h,t))})}const R={};function Ue(e,t){R[e]=t}function We(e,t){if(t===void 0)throw new C(e,["id"]);if(typeof t.id!="string")throw new p(e,"id","A string is expected")}function Ze(e,t,r){if(r!==void 0){if(!Array.isArray(r))throw new p(e,"ids","A option list is expected");r.forEach((s,i)=>{try{We(e,s)}catch{throw new p(e,"ids",`The hardware description ${i} is wrong`)}})}}function Je(e){const{providers:t={},yamlNode:r,ids:s,groupid:i,even:a,nowrap:d,...l}=e;if(Ze(r,"ids",s),X(r,"groupid",i),P(r,"even",a),P(r,"nowrap",d),I(r,l),!R.HardwareGroup)return n.jsx(o.Alert,{variant:"warning",children:"No `HardwareGroup` component registered"});const h=R.HardwareGroup;return n.jsx(h,{providers:t,ids:s,groupid:i,nowrap:d||!1,even:a||!1})}const $={hardwaregroup:Je};function Qe(e,t){$[e]=t}function Xe(e){const{yamlNode:t,panel:r}=e,{type:s,style:i,scroll:a,title:d,...l}=t;if(!(s in $))return n.jsx(g,{children:n.jsx(g.Contents,{children:n.jsxs(o.Alert,{variant:"warning",children:['Unknown component "',s,'"']})})});const h=$[t.type];return r?n.jsx(g,{style:i,scroll:a,children:n.jsxs(m.Suspense,{fallback:n.jsx("p",{children:"Loading..."}),children:[d&&n.jsx(g.Header,{children:d}),n.jsx(g.Contents,{children:n.jsx(h,{...l,yamlNode:t})})]})}):n.jsx(m.Suspense,{fallback:n.jsx("p",{children:"Loading..."}),children:n.jsx(h,{...l,yamlNode:t})})}function et({yamlNode:e,panel:t}){const r=e.options||{};return n.jsx(o.Container,{className:"ymllayout-container",...r,children:j.map(e.children,(s,i)=>y(s,i,t))})}function tt(e){const{yamlNode:t}=e,r=t.options||{},s={};return r.centerContent&&(s.margin="auto"),n.jsxs(g,{className:"ymllayout-panel",...r,children:[t.title&&n.jsx(g.Header,{children:t.title}),n.jsx(g.Contents,{style:s,children:j.map(t.children,(i,a)=>y(i,a,!1))})]})}const nt=()=>Math.random().toString(36).slice(2,15)+Math.random().toString(36).slice(2,15);function rt({yamlNode:e,panel:t}){const r=[];return j.each(e.children,(s,i)=>{r.push(n.jsx(o.Tab,{eventKey:nt(),title:s.title,children:y(s,0,!1)},i))}),t?n.jsxs(g,{className:"ymllayout-tabs",children:[e.title&&n.jsx(g.Header,{children:e.title}),n.jsx(g.Contents,{children:n.jsx(o.Tabs,{mountOnEnter:!0,children:r})})]}):n.jsx(o.Tabs,{children:r})}function st(e){const{node:t}=e,{type:r,title:s,...i}=t;return Z(t,i),n.jsx("div",{style:{gridColumn:"1 / 3"},children:n.jsx("h3",{children:s})})}function it(e){const{node:t,state:r,row:s}=e,{title:i}=t;function a(){if(t.id)return t.id}function d(){if(i!==void 0)return i;if(t.type==="hardware"){const h=a(),u={_parentNode:t._parentNode,_indexFromParent:t._indexFromParent,type:"hardware",id:h,variant:"name",emptyifnone:!0};return y(u,"a",!1)}return""}const l=d();return n.jsxs("div",{style:{textAlign:"center"},children:[n.jsx("h5",{style:{margin:"0px",whiteSpace:"nowrap"},children:l}),r&&n.jsx("div",{style:{position:"relative",top:-5},children:r})]})}function at(e){const{node:t,row:r}=e,{titlealign:s,title:i,stateinheader:a=!1,variant:d,id:l,...h}=t;let u,c;if(h.type==="hardware")if(u={...h,id:l,variant:d},a){const f={...h,id:l,variant:"state",emptyifnone:!0};c=y(f,"k",!1)}else c=null;else u=h,c=null;return n.jsxs(n.Fragment,{children:[n.jsx("div",{style:{gridColumn:1,alignSelf:s??"center"},children:n.jsx(it,{node:t,state:c,row:r})}),n.jsx("div",{style:{gridColumn:2},children:y(u,"k",!1)})]})}function ot(e){const{yamlNode:t,panel:r}=e,{type:s,children:i,options:a={},title:d,...l}=t;return Z(t,l),n.jsxs(g,{className:"ymllayout-form",...a,children:[t.title&&n.jsx(g.Header,{children:t.title}),n.jsx(g.Contents,{children:n.jsx("div",{style:{display:"grid",gridTemplateColumns:"min-content auto"},children:j.map(i,(h,u)=>h.type==="formheader"?n.jsx(st,{node:h,row:u},u):n.jsx(at,{node:h,row:u},u))})})]})}function lt(e){const{yamlNode:t,panel:r}=e;return n.jsxs("div",{className:"ymllayout-grid",style:{gridTemplateColumns:t.columns,gridTemplateRows:t.rows},children:[j.map(t.children,(s,i)=>{const{columnSpan:a=1,rowSpan:d=1,...l}=s,h=a>1?`span ${a}`:void 0,u=d>1?`span ${d}`:void 0;return n.jsx("div",{className:"ymllayout-grid-cell",style:{gridColumn:h,gridRow:u},children:y(l,i,r)},i)})," "]})}function ct({yamlNode:e,panel:t}){const r=e.options||{};return n.jsx(Ie,{panel:t,options:r,children:n.jsx("div",{children:e.label})})}const dt={row:Ke,col:ze,container:et,component:Xe,panel:tt,tabs:rt,form:ot,grid:lt,label:ct};Object.entries(dt).forEach(([e,t])=>{W(e,t)});function ut(e){var r;const t=m.useMemo(()=>J(e.layout),[e.layout]);return t.error?n.jsx("div",{className:`${e.className??""} ymllayout-main`,id:e.id,children:n.jsxs(g,{children:[n.jsx(g.Header,{children:"Layout Error"}),n.jsxs(g.Contents,{children:[n.jsxs("p",{children:["File: ",t.name]}),n.jsx(o.Alert,{variant:"warning",children:n.jsx("pre",{className:"mb-0",children:t.error})})]})]})}):n.jsx("div",{className:`${e.className??""} ymllayout-main`,id:e.id,children:n.jsx(Q,{resetKey:t,children:(r=t.children)==null?void 0:r.map((s,i)=>y(s,i))})})}const ht=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));exports.Formatting=de;exports.Frontend=he;exports.FullSizer=U;exports.HWObject=ht;exports.HardwareInputNumber=k;exports.HardwareNumericStep=z;exports.HardwareSchema=Ee;exports.HardwareState=me;exports.HardwareTemplate=S;exports.HardwareTypes=Oe;exports.HardwareVariant=Se;exports.Info=fe;exports.KeyError=p;exports.MissingKeysError=C;exports.MotorDefault=ge;exports.Multiposition=we;exports.NoObject=ye;exports.NumericStep=K;exports.Property=be;exports.ShutterDefault=Ce;exports.TypeIcon=b;exports.YAMLErrorBoundary=Q;exports.YAMLLayout=ut;exports.YamlAsserts=Ge;exports.registerHardwareComponent=Ue;exports.registerYamlComponent=Qe;exports.registerYamlType=W;exports.renderYamlNode=y;
3
3
  //# sourceMappingURL=index.js.map
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"],"sourcesContent":["interface Props {\n online: boolean;\n activeMessage?: string;\n inactiveMessage?: string;\n message?: string;\n icon: string;\n name: string;\n}\nexport function OnlineStatus(props: Props) {\n const {\n activeMessage = 'Online',\n inactiveMessage = 'Offline',\n message = 'This device is',\n } = props;\n\n return (\n <div\n className={`dot-indicator small bg-${\n props.online ? 'success' : 'danger'\n }`}\n title={`${message} ${props.online ? activeMessage : inactiveMessage}`}\n />\n );\n}\n\nexport default function TypeIcon(props: Props) {\n const { name, icon } = props;\n return (\n <div className=\"icon\" title={name}>\n <i className={`fa ${icon}`} />\n <OnlineStatus {...props} />\n </div>\n );\n}\n","// 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 &quot;{type}&quot;</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"],"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"],"mappings":"+SAQO,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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ACL,IAAKE,GACL,UAAWoB,GACX,UAAWJ,GACX,MAAOK,GACP,KAAMG,GACN,KAAMkB,GACN,KAAME,GACN,MAAOK,EACT,EAEA,OAAO,QAAQC,EAAO,EAAE,QAAQ,CAAC,CAAC7G,EAAM2E,CAAa,IAAM,CACzDhF,EAAiBK,EAAM2E,CAAa,CACtC,CAAC,EAQD,SAAwBmC,GAAK5Q,EAAc,OACnC,MAAA6Q,EAASC,EAAAA,QAAQ,IACdzF,EAAgBrL,EAAM,MAAM,EAClC,CAACA,EAAM,MAAM,CAAC,EAEjB,OAAI6Q,EAAO,MAENzQ,EAAAA,IAAA,MAAA,CAAI,UAAW,GAAGJ,EAAM,WAAa,EAAE,kBAAmB,GAAIA,EAAM,GACnE,SAAAQ,OAAC8I,EACC,CAAA,SAAA,CAAClJ,EAAAA,IAAAkJ,EAAM,OAAN,CAAa,SAAY,cAAA,CAAA,EAC1B9I,EAAAA,KAAC8I,EAAM,SAAN,CACC,SAAA,CAAA9I,OAAC,IAAE,CAAA,SAAA,CAAA,SAAOqQ,EAAO,IAAA,EAAK,EACtBzQ,EAAA,IAACwL,EAAM,MAAA,CAAA,QAAQ,UACb,SAAAxL,EAAAA,IAAC,OAAI,UAAU,OAAQ,SAAOyQ,EAAA,KAAA,CAAM,CACtC,CAAA,CAAA,EACF,CAAA,CACF,CAAA,CACF,CAAA,EAKFzQ,EAAAA,IAAC,MAAI,CAAA,UAAW,GAAGJ,EAAM,WAAa,EAAE,kBAAmB,GAAIA,EAAM,GACnE,SAACI,EAAAA,IAAAiM,GAAA,CAAc,SAAUwE,EACtB,UAAA9J,EAAA8J,EAAO,WAAP,YAAA9J,EAAiB,IAAI,CAACkE,EAAM9I,IAAQwH,EAAesB,EAAM9I,CAAG,EAC/D,CAAA,CACF,CAAA,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"],"sourcesContent":["interface Props {\n online: boolean;\n activeMessage?: string;\n inactiveMessage?: string;\n message?: string;\n icon: string;\n name: string;\n}\nexport function OnlineStatus(props: Props) {\n const {\n activeMessage = 'Online',\n inactiveMessage = 'Offline',\n message = 'This device is',\n } = props;\n\n return (\n <div\n className={`dot-indicator small bg-${\n props.online ? 'success' : 'danger'\n }`}\n title={`${message} ${props.online ? activeMessage : inactiveMessage}`}\n />\n );\n}\n\nexport default function TypeIcon(props: Props) {\n const { name, icon } = props;\n return (\n <div className=\"icon\" title={name}>\n <i className={`fa ${icon}`} />\n <OnlineStatus {...props} />\n </div>\n );\n}\n","// 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 &quot;{type}&quot;</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"],"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"],"mappings":"+SAQO,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,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M9I,CAAG,EAC/D,CAAA,CACF,CAAA,CAEJ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@esrf/daiquiri-lib",
3
- "version": "0.0.2-alpha.7",
3
+ "version": "0.0.2-alpha.8",
4
4
  "sideEffects": false,
5
5
  "files": [
6
6
  "dist",
package/src/index.ts CHANGED
@@ -30,6 +30,7 @@ export * as HardwareSchema from './hardware/utils/schema';
30
30
 
31
31
  /* Layout */
32
32
  export { default as YAMLLayout } from './yaml-layout/Main';
33
+ export { default as YAMLErrorBoundary } from './yaml-layout/ErrorBoundary';
33
34
  export {
34
35
  renderYamlNode,
35
36
  registerYamlType,