@esrf/daiquiri-lib 0.2.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -65,7 +65,7 @@ function De(e) {
65
65
  function Fe(e, t) {
66
66
  return Number.parseFloat(e.toFixed(t));
67
67
  }
68
- const Ht = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
68
+ const _t = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
69
69
  __proto__: null,
70
70
  formatEng: Ie,
71
71
  round: Fe,
@@ -138,7 +138,7 @@ function Re(e) {
138
138
  }
139
139
  );
140
140
  }
141
- function _t(e) {
141
+ function Pt(e) {
142
142
  const { hardware: t, options: n = {} } = e;
143
143
  function i(a) {
144
144
  t.requestChange({
@@ -178,7 +178,7 @@ function _t(e) {
178
178
  ] }) })
179
179
  ] });
180
180
  }
181
- function Pt(e) {
181
+ function Vt(e) {
182
182
  const { hardware: t, options: n = {} } = e;
183
183
  function i() {
184
184
  const a = n.property;
@@ -302,7 +302,7 @@ function de(e) {
302
302
  }
303
303
  return /* @__PURE__ */ r(J, { state: i, minWidth: 6, variant: a() });
304
304
  }
305
- const Vt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
305
+ const Lt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
306
306
  __proto__: null,
307
307
  HardwareState: J,
308
308
  MotorState: ce,
@@ -581,7 +581,7 @@ function Pe(e) {
581
581
  }
582
582
  );
583
583
  }
584
- function Lt(e) {
584
+ function jt(e) {
585
585
  const { hardware: t, options: n = {} } = e;
586
586
  function i() {
587
587
  t.requestChange({
@@ -641,7 +641,7 @@ function Lt(e) {
641
641
  }
642
642
  );
643
643
  }
644
- function jt(e) {
644
+ function Yt(e) {
645
645
  const { hardware: t, options: n = {} } = e, i = R(null);
646
646
  j(() => {
647
647
  if (!i.current) {
@@ -706,7 +706,7 @@ function jt(e) {
706
706
  ] });
707
707
  }
708
708
  const Ve = Ae("daiquiri.components.hardware.NoObject");
709
- function Yt(e) {
709
+ function Kt(e) {
710
710
  if (e.options.emptyifnone)
711
711
  return Ve(
712
712
  'Component id:"%s" name:"%s" not displayed cause setup with emptyifnone.',
@@ -736,7 +736,7 @@ function Le(e) {
736
736
  const t = e.online ? "READY" : "OFFLINE";
737
737
  return /* @__PURE__ */ r(D, { bg: t === "READY" ? "success" : "warning", children: t });
738
738
  }
739
- function Kt(e) {
739
+ function zt(e) {
740
740
  const { hardware: t, options: n = {} } = e, i = /* @__PURE__ */ r(I, { name: "Optic", icon: "fa-cog", online: t.online }), a = /* @__PURE__ */ r(Le, { ...t });
741
741
  function o() {
742
742
  const c = n.property;
@@ -803,7 +803,7 @@ function je(e) {
803
803
  }
804
804
  );
805
805
  }
806
- function zt(e) {
806
+ function qt(e) {
807
807
  const { hardware: t, options: n = {} } = e, i = /* @__PURE__ */ r(
808
808
  I,
809
809
  {
@@ -855,7 +855,7 @@ function zt(e) {
855
855
  }
856
856
  );
857
857
  }
858
- class qt extends se {
858
+ class Ut extends se {
859
859
  constructor() {
860
860
  super(...arguments), this.variants = {};
861
861
  }
@@ -895,11 +895,6 @@ function Ye(e) {
895
895
  }
896
896
  );
897
897
  }
898
- const Ut = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
899
- __proto__: null
900
- }, Symbol.toStringTag, { value: "Module" })), Gt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
901
- __proto__: null
902
- }, Symbol.toStringTag, { value: "Module" }));
903
898
  function Ke(e) {
904
899
  return /* @__PURE__ */ r("div", { className: "panel-header", style: e.style, children: e.children });
905
900
  }
@@ -912,7 +907,11 @@ function p(e) {
912
907
  }
913
908
  p.Header = Ke;
914
909
  p.Contents = ze;
915
- const _ = {};
910
+ const Gt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
911
+ __proto__: null
912
+ }, Symbol.toStringTag, { value: "Module" })), Wt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
913
+ __proto__: null
914
+ }, Symbol.toStringTag, { value: "Module" })), _ = {};
916
915
  function qe(e, t) {
917
916
  _[e] = t;
918
917
  }
@@ -1224,7 +1223,7 @@ function st(e, t, n) {
1224
1223
  if (n !== void 0 && n !== "h5web" && n !== "plotly")
1225
1224
  throw new g(e, t, '"h5web" or "plotly" string is expected');
1226
1225
  }
1227
- const Wt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1226
+ const Bt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1228
1227
  __proto__: null,
1229
1228
  assertBoolean: et,
1230
1229
  assertDataCollectionId: ot,
@@ -1258,7 +1257,7 @@ function ct({ yamlNode: e, panel: t }) {
1258
1257
  );
1259
1258
  }
1260
1259
  const W = {};
1261
- function Bt(e, t) {
1260
+ function Zt(e, t) {
1262
1261
  W[e] = t;
1263
1262
  }
1264
1263
  function dt(e, t) {
@@ -1311,10 +1310,15 @@ function ht(e) {
1311
1310
  const B = {
1312
1311
  hardwaregroup: ht
1313
1312
  };
1314
- function Zt(e, t) {
1313
+ function ft(e, t) {
1315
1314
  B[e] = t;
1316
1315
  }
1317
- function ft(e) {
1316
+ function Jt(e) {
1317
+ Object.entries(e).forEach(
1318
+ ([t, n]) => ft(t, n)
1319
+ );
1320
+ }
1321
+ function mt(e) {
1318
1322
  const { yamlNode: t, panel: n } = e, { type: i, style: a, scroll: o, title: d, ...s } = t;
1319
1323
  if (!(i in B))
1320
1324
  return /* @__PURE__ */ r(p, { children: /* @__PURE__ */ r(p.Contents, { children: /* @__PURE__ */ l(x, { variant: "warning", children: [
@@ -1328,11 +1332,11 @@ function ft(e) {
1328
1332
  /* @__PURE__ */ r(p.Contents, { children: /* @__PURE__ */ r(h, { ...s, yamlNode: t }) })
1329
1333
  ] }) }) : /* @__PURE__ */ r(ne, { fallback: /* @__PURE__ */ r("p", { children: "Loading..." }), children: /* @__PURE__ */ r(h, { ...s, yamlNode: t }) });
1330
1334
  }
1331
- function mt({ yamlNode: e, panel: t }) {
1335
+ function pt({ yamlNode: e, panel: t }) {
1332
1336
  const n = e.options || {};
1333
1337
  return /* @__PURE__ */ r($, { className: "ymllayout-container", ...n, children: C(e.children, (i, a) => O(i, a, t)) });
1334
1338
  }
1335
- function pt(e) {
1339
+ function gt(e) {
1336
1340
  const { yamlNode: t } = e, n = t.options || {}, i = {};
1337
1341
  return n.centerContent && (i.margin = "auto"), /* @__PURE__ */ l(p, { className: "ymllayout-panel", ...n, children: [
1338
1342
  t.title && /* @__PURE__ */ r(p.Header, { children: t.title }),
@@ -1342,23 +1346,23 @@ function pt(e) {
1342
1346
  ) })
1343
1347
  ] });
1344
1348
  }
1345
- const gt = () => Math.random().toString(36).slice(2, 15) + Math.random().toString(36).slice(2, 15);
1346
- function wt({ yamlNode: e, panel: t }) {
1349
+ const wt = () => Math.random().toString(36).slice(2, 15) + Math.random().toString(36).slice(2, 15);
1350
+ function yt({ yamlNode: e, panel: t }) {
1347
1351
  const n = [];
1348
1352
  return ve(e.children, (i, a) => {
1349
1353
  n.push(
1350
- /* @__PURE__ */ r(be, { eventKey: gt(), title: i.title, children: O(i, 0, !1) }, a)
1354
+ /* @__PURE__ */ r(be, { eventKey: wt(), title: i.title, children: O(i, 0, !1) }, a)
1351
1355
  );
1352
1356
  }), t ? /* @__PURE__ */ l(p, { className: "ymllayout-tabs", children: [
1353
1357
  e.title && /* @__PURE__ */ r(p.Header, { children: e.title }),
1354
1358
  /* @__PURE__ */ r(p.Contents, { children: /* @__PURE__ */ r(te, { mountOnEnter: !0, children: n }) })
1355
1359
  ] }) : /* @__PURE__ */ r(te, { children: n });
1356
1360
  }
1357
- function yt(e) {
1361
+ function vt(e) {
1358
1362
  const { node: t } = e, { type: n, title: i, ...a } = t;
1359
1363
  return ue(t, a), /* @__PURE__ */ r("div", { style: { gridColumn: "1 / 3" }, children: /* @__PURE__ */ r("h3", { children: i }) });
1360
1364
  }
1361
- function vt(e) {
1365
+ function bt(e) {
1362
1366
  const { node: t, state: n, row: i } = e, { title: a } = t;
1363
1367
  function o() {
1364
1368
  if (t.id)
@@ -1403,7 +1407,7 @@ function vt(e) {
1403
1407
  }
1404
1408
  );
1405
1409
  }
1406
- function bt(e) {
1410
+ function Nt(e) {
1407
1411
  const { node: t, row: n } = e, {
1408
1412
  titlealign: i,
1409
1413
  title: a,
@@ -1438,13 +1442,13 @@ function bt(e) {
1438
1442
  gridColumn: 1,
1439
1443
  alignSelf: i ?? "center"
1440
1444
  },
1441
- children: /* @__PURE__ */ r(vt, { node: t, state: c, row: n })
1445
+ children: /* @__PURE__ */ r(bt, { node: t, state: c, row: n })
1442
1446
  }
1443
1447
  ),
1444
1448
  /* @__PURE__ */ r("div", { style: { gridColumn: 2 }, children: O(u, "k", !1) })
1445
1449
  ] });
1446
1450
  }
1447
- function Nt(e) {
1451
+ function Ct(e) {
1448
1452
  const { yamlNode: t, panel: n } = e, { type: i, children: a, options: o = {}, title: d, ...s } = t;
1449
1453
  return ue(t, s), /* @__PURE__ */ l(p, { className: "ymllayout-form", ...o, children: [
1450
1454
  t.title && /* @__PURE__ */ r(p.Header, { children: t.title }),
@@ -1456,18 +1460,18 @@ function Nt(e) {
1456
1460
  gridTemplateColumns: "min-content auto"
1457
1461
  },
1458
1462
  children: C(a, (h, u) => h.type === "formheader" ? /* @__PURE__ */ r(
1459
- yt,
1463
+ vt,
1460
1464
  {
1461
1465
  node: h,
1462
1466
  row: u
1463
1467
  },
1464
1468
  u
1465
- ) : /* @__PURE__ */ r(bt, { node: h, row: u }, u))
1469
+ ) : /* @__PURE__ */ r(Nt, { node: h, row: u }, u))
1466
1470
  }
1467
1471
  ) })
1468
1472
  ] });
1469
1473
  }
1470
- function Ct(e) {
1474
+ function Ot(e) {
1471
1475
  const { yamlNode: t, panel: n } = e;
1472
1476
  return /* @__PURE__ */ l(
1473
1477
  "div",
@@ -1498,25 +1502,25 @@ function Ct(e) {
1498
1502
  }
1499
1503
  );
1500
1504
  }
1501
- function Ot({ yamlNode: e, panel: t }) {
1505
+ function St({ yamlNode: e, panel: t }) {
1502
1506
  const n = e.options || {};
1503
1507
  return /* @__PURE__ */ r(Ue, { panel: t, options: n, children: /* @__PURE__ */ r("div", { children: e.label }) });
1504
1508
  }
1505
- const St = {
1509
+ const Et = {
1506
1510
  row: lt,
1507
1511
  col: ct,
1508
- container: mt,
1509
- component: ft,
1510
- panel: pt,
1511
- tabs: wt,
1512
- form: Nt,
1513
- grid: Ct,
1514
- label: Ot
1512
+ container: pt,
1513
+ component: mt,
1514
+ panel: gt,
1515
+ tabs: yt,
1516
+ form: Ct,
1517
+ grid: Ot,
1518
+ label: St
1515
1519
  };
1516
- Object.entries(St).forEach(([e, t]) => {
1520
+ Object.entries(Et).forEach(([e, t]) => {
1517
1521
  qe(e, t);
1518
1522
  });
1519
- function Jt(e) {
1523
+ function Qt(e) {
1520
1524
  var n;
1521
1525
  const t = xe(() => he(e.layout), [e.layout]);
1522
1526
  return t.error ? /* @__PURE__ */ r("div", { className: `${e.className ?? ""} ymllayout-main`, id: e.id, children: /* @__PURE__ */ l(p, { children: [
@@ -1530,15 +1534,15 @@ function Jt(e) {
1530
1534
  ] })
1531
1535
  ] }) }) : /* @__PURE__ */ r("div", { className: `${e.className ?? ""} ymllayout-main`, id: e.id, children: /* @__PURE__ */ r(Je, { resetKey: t, children: (n = t.children) == null ? void 0 : n.map((i, a) => O(i, a)) }) });
1532
1536
  }
1533
- const Qt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1537
+ const Xt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1534
1538
  __proto__: null
1535
1539
  }, Symbol.toStringTag, { value: "Module" })), pe = {
1536
- hardware: kt
1540
+ hardware: It
1537
1541
  };
1538
- function Xt(e, t) {
1542
+ function en(e, t) {
1539
1543
  pe[e] = t;
1540
1544
  }
1541
- function Et(e) {
1545
+ function xt(e) {
1542
1546
  return /* @__PURE__ */ l(
1543
1547
  E,
1544
1548
  {
@@ -1551,11 +1555,11 @@ function Et(e) {
1551
1555
  }
1552
1556
  );
1553
1557
  }
1554
- function en(e) {
1558
+ function tn(e) {
1555
1559
  const t = C(e.monitors, (n, i) => {
1556
1560
  const a = n.type ?? "hardware", o = pe[a];
1557
1561
  return o === void 0 ? /* @__PURE__ */ r(
1558
- Et,
1562
+ xt,
1559
1563
  {
1560
1564
  monitor: n,
1561
1565
  message: `Type ${a} unsupported`
@@ -1576,11 +1580,11 @@ function en(e) {
1576
1580
  }
1577
1581
  );
1578
1582
  }
1579
- function xt(e) {
1583
+ function Mt(e) {
1580
1584
  return /* @__PURE__ */ r(E, { className: "monitor-panel-item", children: e.children });
1581
1585
  }
1582
1586
  const Z = {};
1583
- function tn(e, t) {
1587
+ function nn(e, t) {
1584
1588
  Z[e] = t;
1585
1589
  }
1586
1590
  function ge(e) {
@@ -1588,7 +1592,7 @@ function ge(e) {
1588
1592
  throw new Error("No `useHardware` hook registered");
1589
1593
  return Z.useHardware(e);
1590
1594
  }
1591
- const Mt = (e, t, n) => {
1595
+ const At = (e, t, n) => {
1592
1596
  const i = {
1593
1597
  ">": (a, o) => a > o,
1594
1598
  "<": (a, o) => a < o,
@@ -1610,20 +1614,20 @@ function ae(e) {
1610
1614
  if (n && n.properties && t[1] !== null)
1611
1615
  return Array.isArray(n.properties[t[1]]) ? n.properties[t[1]][0] : n.properties[t[1]];
1612
1616
  }
1613
- function At(e) {
1617
+ function kt(e) {
1614
1618
  const t = e !== void 0 && !e.includes("."), n = e !== void 0 ? we(e, ".", 1) : [null, ""], i = ge(n[0]);
1615
1619
  if (t)
1616
1620
  return e;
1617
1621
  if (i && i.properties && n[1] !== null)
1618
1622
  return `${i.properties[n[1]]}`;
1619
1623
  }
1620
- function kt(e) {
1624
+ function It(e) {
1621
1625
  const { monitor: t } = e;
1622
1626
  let n = ae(t.value) ?? "-";
1623
- const i = At(t.unit), a = ae(t.overlay), o = Number.parseFloat(`${n}`);
1627
+ const i = kt(t.unit), a = ae(t.overlay), o = Number.parseFloat(`${n}`);
1624
1628
  Number.isNaN(o) || String(o).length > 5 && (n = o.toPrecision(5));
1625
1629
  let d;
1626
- t.comparator && t.comparison && (d = Mt(t.comparator, n, t.comparison) ? "valid" : "invalid"), Number.isNaN(o) || i !== void 0 && (n = `${n} ${i}`);
1630
+ t.comparator && t.comparison && (d = At(t.comparator, n, t.comparison) ? "valid" : "invalid"), Number.isNaN(o) || i !== void 0 && (n = `${n} ${i}`);
1627
1631
  let s = U;
1628
1632
  const h = {};
1629
1633
  if (a) {
@@ -1639,47 +1643,49 @@ function kt(e) {
1639
1643
  }
1640
1644
  return (
1641
1645
  // @ts-expect-error
1642
- /* @__PURE__ */ Me(s, { ...h, key: t.name }, /* @__PURE__ */ l(xt, { children: [
1646
+ /* @__PURE__ */ Me(s, { ...h, key: t.name }, /* @__PURE__ */ l(Mt, { children: [
1643
1647
  /* @__PURE__ */ r("h1", { children: t.name }),
1644
1648
  /* @__PURE__ */ r("div", { className: d, children: `${n}` })
1645
1649
  ] }))
1646
1650
  );
1647
1651
  }
1648
1652
  export {
1649
- Ht as Formatting,
1650
- _t as Frontend,
1653
+ _t as Formatting,
1654
+ Pt as Frontend,
1651
1655
  Ye as FullSizer,
1652
- Qt as HWObject,
1656
+ Xt as HWObject,
1653
1657
  re as HardwareInputNumber,
1654
1658
  _e as HardwareNumericStep,
1655
- Gt as HardwareSchema,
1656
- Vt as HardwareState,
1659
+ Wt as HardwareSchema,
1660
+ Lt as HardwareState,
1657
1661
  Y as HardwareTemplate,
1658
- Ut as HardwareTypes,
1659
- qt as HardwareVariant,
1660
- Pt as Info,
1662
+ Gt as HardwareTypes,
1663
+ Ut as HardwareVariant,
1664
+ Vt as Info,
1661
1665
  g as KeyError,
1662
1666
  L as MissingKeysError,
1663
- kt as MonitorHardware,
1664
- en as MonitorPanel,
1665
- xt as MonitorPanelItem,
1666
- Lt as MotorDefault,
1667
- jt as Multiposition,
1668
- Yt as NoObject,
1667
+ It as MonitorHardware,
1668
+ tn as MonitorPanel,
1669
+ Mt as MonitorPanelItem,
1670
+ jt as MotorDefault,
1671
+ Yt as Multiposition,
1672
+ Kt as NoObject,
1669
1673
  He as NumericStep,
1670
- Kt as Property,
1671
- zt as ShutterDefault,
1674
+ p as Panel,
1675
+ zt as Property,
1676
+ qt as ShutterDefault,
1672
1677
  I as TypeIcon,
1673
1678
  Je as YAMLErrorBoundary,
1674
- Jt as YAMLLayout,
1675
- Wt as YamlAsserts,
1676
- Mt as dynamicOp,
1677
- Bt as registerHardwareComponent,
1678
- Xt as registerMonitorComponent,
1679
- tn as registerRuntimeHook,
1680
- Zt as registerYamlComponent,
1679
+ Qt as YAMLLayout,
1680
+ Bt as YamlAsserts,
1681
+ At as dynamicOp,
1682
+ Zt as registerHardwareComponent,
1683
+ en as registerMonitorComponent,
1684
+ nn as registerRuntimeHook,
1685
+ ft as registerYamlComponent,
1686
+ Jt as registerYamlComponents,
1681
1687
  qe as registerYamlType,
1682
1688
  O as renderYamlNode,
1683
- St as yamlMap
1689
+ Et as yamlMap
1684
1690
  };
1685
- //# sourceMappingURL=index.esm.js.map
1691
+ //# sourceMappingURL=index.mjs.map