@esrf/daiquiri-lib 0.0.2-alpha.6 → 0.0.2-alpha.7
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 +8 -1
- package/dist/index.esm.js +2 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/src/index.ts +1 -0
package/dist/index.d.ts
CHANGED
|
@@ -406,6 +406,9 @@ interface YamlRoot extends YamlNode {
|
|
|
406
406
|
name: string;
|
|
407
407
|
error: string;
|
|
408
408
|
}
|
|
409
|
+
interface AnyYamlNode extends YamlNode {
|
|
410
|
+
[key: string]: any;
|
|
411
|
+
}
|
|
409
412
|
interface YamlComponent {
|
|
410
413
|
providers?: Record<string, any>;
|
|
411
414
|
yamlNode: YamlNode;
|
|
@@ -425,6 +428,10 @@ declare function Main(props: Props): JSX.Element;
|
|
|
425
428
|
* Register the Yaml type with the component used to render this Yaml node.
|
|
426
429
|
*/
|
|
427
430
|
declare function registerYamlType(name: string, component: React.ComponentType<any>): void;
|
|
431
|
+
/**
|
|
432
|
+
* Render a Yaml node using registred component from the node type
|
|
433
|
+
*/
|
|
434
|
+
declare function renderYamlNode(yamlNode: AnyYamlNode, key: number | string, panel?: boolean): ReactChild;
|
|
428
435
|
declare class LayoutError extends Error {
|
|
429
436
|
readonly yamlNode: YamlNode;
|
|
430
437
|
constructor(message: string, yamlNode: YamlNode);
|
|
@@ -509,4 +516,4 @@ declare namespace HardwareObject_d {
|
|
|
509
516
|
*/
|
|
510
517
|
declare function registerHardwareComponent(name: string, component: React.ComponentType<any>): void;
|
|
511
518
|
|
|
512
|
-
export { formatting_d as Formatting, Frontend, FullSizer, HardwareObject_d as HWObject, HardwareInputNumber, HardwareNumericStep, schema_d as HardwareSchema, State_d as HardwareState, HardwareTemplate, types_d as HardwareTypes, HardwareVariant, Info, KeyError, MissingKeysError, MotorDefault, type MotorDefaultOptions, Multiposition, NoObject, NumericStep, Property, ShutterDefault, TypeIcon, Main as YAMLLayout, asserts_d as YamlAsserts, type YamlComponent, type YamlNode, registerHardwareComponent, registerComponent as registerYamlComponent, registerYamlType };
|
|
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 };
|
package/dist/index.esm.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
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;
|
|
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;
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED