frame.identify 0.3.12 → 0.4.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.
@@ -2,5 +2,6 @@ import { identifyMachine } from './state/machine';
2
2
  import { ActorRefFrom } from 'xstate';
3
3
  export declare function EnterValues(props: {
4
4
  actor: ActorRefFrom<typeof identifyMachine>;
5
+ testMode?: boolean;
5
6
  }): import("react").JSX.Element;
6
7
  //# sourceMappingURL=EnterValues.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"EnterValues.d.ts","sourceRoot":"","sources":["../src/EnterValues.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAkB,MAAM,iBAAiB,CAAC;AAClE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAK3C,wBAAgB,WAAW,CAAC,KAAK,EAAE;IACjC,KAAK,EAAE,YAAY,CAAC,OAAO,eAAe,CAAC,CAAC;CAC7C,+BAqGA"}
1
+ {"version":3,"file":"EnterValues.d.ts","sourceRoot":"","sources":["../src/EnterValues.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAkB,MAAM,iBAAiB,CAAC;AAClE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAK3C,wBAAgB,WAAW,CAAC,KAAK,EAAE;IACjC,KAAK,EAAE,YAAY,CAAC,OAAO,eAAe,CAAC,CAAC;IAC5C,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,+BAgGA"}
@@ -2,5 +2,6 @@ import { identifyMachine } from './state/machine';
2
2
  import { ActorRefFrom } from 'xstate';
3
3
  export declare function MachineState(props: {
4
4
  actor: ActorRefFrom<typeof identifyMachine>;
5
+ testMode?: boolean;
5
6
  }): import("react").JSX.Element;
6
7
  //# sourceMappingURL=MachineState.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MachineState.d.ts","sourceRoot":"","sources":["../src/MachineState.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,EAQhB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAGtC,wBAAgB,YAAY,CAAC,KAAK,EAAE;IAClC,KAAK,EAAE,YAAY,CAAC,OAAO,eAAe,CAAC,CAAC;CAC7C,+BAiEA"}
1
+ {"version":3,"file":"MachineState.d.ts","sourceRoot":"","sources":["../src/MachineState.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,EAQhB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAGtC,wBAAgB,YAAY,CAAC,KAAK,EAAE;IAClC,KAAK,EAAE,YAAY,CAAC,OAAO,eAAe,CAAC,CAAC;IAC5C,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,+BAmEA"}
@@ -1 +1 @@
1
- {"version":3,"file":"ModalImageCropped.d.ts","sourceRoot":"","sources":["../src/ModalImageCropped.tsx"],"names":[],"mappings":"AASA,OAAO,EAUL,eAAe,EAChB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAG3C,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,CAAC;AAG1B;;;;;;;;;GASG;AAEH;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE;IACvC,KAAK,EAAE,YAAY,CAAC,OAAO,eAAe,CAAC,CAAC;IAC5C,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,OAAO,KAAK,MAAM,IAAI,CAAC;IAC5D,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,+BAutBA"}
1
+ {"version":3,"file":"ModalImageCropped.d.ts","sourceRoot":"","sources":["../src/ModalImageCropped.tsx"],"names":[],"mappings":"AASA,OAAO,E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oot":"","sources":["../src/ModalImageLoaded.tsx"],"names":[],"mappings":"AAIA,OAAO,EAKL,eAAe,EAIhB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAI3C,OAAO,EAAqB,KAAK,EAAE,MAAM,GAAG,CAAC;AAG7C,MAAM,MAAM,sBAAsB,GAAG;IACnC,cAAc,EAAE,MAAM,IAAI,CAAC;CAC5B,CAAC;AAIF,wBAAgB,gBAAgB,CAAC,KAAK,EAAE;IACtC,KAAK,EAAE,YAAY,CAAC,OAAO,eAAe,CAAC,CAAC;IAC5C,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,CACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,GAAG,EAAE,MAAM,EACX,MAAM,CAAC,EAAE,KAAK,EAAE,EAChB,KAAK,CAAC,EAAE,OAAO,KACZ,MAAM,IAAI,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,+BAoTA"}
@@ -13,5 +13,6 @@ export declare function NumberInput(props: {
13
13
  };
14
14
  dataTestid: string;
15
15
  readonly?: boolean;
16
+ autofocus?: boolean;
16
17
  }): import("react").JSX.Element;
17
18
  //# sourceMappingURL=NumberInput.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"NumberInput.d.ts","sourceRoot":"","sources":["../src/NumberInput.tsx"],"names":[],"mappings":"AAGA,wBAAgB,WAAW,CAAC,KAAK,EAAE;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,KAAK,IAAI,CAAC;IACvE,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE;QACb,QAAQ,EAAE,MAAM,CAAC;QACjB,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,EAAE,MAAM,CAAC;QACjB,YAAY,EAAE,MAAM,CAAC;KACtB,CAAC;IACF,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,+BAqEA"}
1
+ {"version":3,"file":"NumberInput.d.ts","sourceRoot":"","sources":["../src/NumberInput.tsx"],"names":[],"mappings":"AAGA,wBAAgB,WAAW,CAAC,KAAK,EAAE;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,KAAK,IAAI,CAAC;IACvE,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE;QACb,QAAQ,EAAE,MAAM,CAAC;QACjB,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,EAAE,MAAM,CAAC;QACjB,YAAY,EAAE,MAAM,CAAC;KACtB,CAAC;IACF,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,+BAqEA"}
@@ -4402,16 +4402,16 @@ function $o(e) {
4402
4402
  n = t("main.identify.defineValues", { defaultValue: "Please define SL, SH, AZG values and click \"Submit\"" });
4403
4403
  break;
4404
4404
  case No:
4405
- n = t("main.identify.cropFrame", { defaultValue: "Please crop the frame by clicking and dragging the mouse over the image" });
4405
+ n = t("main.identify.cropImage", { defaultValue: "Please crop the image by clicking and dragging the mouse" });
4406
4406
  break;
4407
4407
  case Po:
4408
- n = t("main.identify.defineHorizontalLine", { defaultValue: "Please define a horizontal line" });
4408
+ n = t("main.identify.defineHorizontalLine", { defaultValue: "Please define a horizontal line (point 1)" });
4409
4409
  break;
4410
4410
  case Fo:
4411
- n = t("main.identify.finishHorizontalLine", { defaultValue: "Please finish defining the horizontal line by clicking and dragging the mouse over the image" });
4411
+ n = t("main.identify.finishHorizontalLine", { defaultValue: "Please define a horizontal line (point 2))" });
4412
4412
  break;
4413
4413
  case Io:
4414
- n = t("main.identify.addPoints", { defaultValue: "Please add some points to define the contour of the object" });
4414
+ n = t("main.identify.addPoints", { defaultValue: "Please mark some points to define the frame contour" });
4415
4415
  break;
4416
4416
  case Lo:
4417
4417
  n = t("main.identify.clickDone", { defaultValue: "Please click \"Done\" to finish the process" });
@@ -4421,7 +4421,7 @@ function $o(e) {
4421
4421
  value: r.value
4422
4422
  });
4423
4423
  }
4424
- return /* @__PURE__ */ c("div", { children: [/* @__PURE__ */ c(x, {
4424
+ return /* @__PURE__ */ c("div", { children: [e.testMode && /* @__PURE__ */ c(x, {
4425
4425
  sx: {
4426
4426
  textAlign: "left",
4427
4427
  paddingLeft: 1,
@@ -4466,7 +4466,7 @@ function es(e) {
4466
4466
  e
4467
4467
  ]), /* @__PURE__ */ s("div", { children: /* @__PURE__ */ s(b, {
4468
4468
  "data-testid": `NumberInput.Textfield.${e.dataTestid}`,
4469
- focused: !0,
4469
+ autoFocus: e.autofocus ?? !1,
4470
4470
  color: "secondary",
4471
4471
  label: e.label,
4472
4472
  variant: "filled",
@@ -4494,28 +4494,27 @@ function es(e) {
4494
4494
  //#endregion
4495
4495
  //#region src/EnterValues.tsx
4496
4496
  function ts(e) {
4497
- let [t, n] = a("50"), [i, l] = a("44"), [u, d] = a("15");
4498
- r(() => {}, [e.actor]);
4499
- let f = T(e.actor, (e) => e), p = (e, t) => {
4497
+ let [t, n] = a(e.testMode ? "50" : ""), [r, i] = a(e.testMode ? "44" : ""), [l, u] = a(e.testMode ? "15" : ""), d = T(e.actor, (e) => e), f = (e, t) => {
4500
4498
  let n = parseFloat(e);
4501
4499
  t(n < 0 ? "Number must be\npositive" : n === 0 ? "Number must not be zero" : n > 40 ? "Number must not be\ngreater than 40" : "");
4502
- }, h = {
4500
+ }, p = {
4501
+ textTransform: "none",
4503
4502
  width: "calc(100% - 100px)",
4504
4503
  marginLeft: "50px",
4505
4504
  marginRight: "50px"
4506
4505
  };
4507
- function _(t, n, r) {
4508
- console.log("Submitted Scheibenlänge:", t), console.log("Submitted Scheibenhöhe:", n), console.log("Submitted AZG:", r), e.actor.send({
4506
+ function h(t, n, r) {
4507
+ e.actor.send({
4509
4508
  type: "ENTER_VALUES",
4510
4509
  SL: Number(t),
4511
4510
  SH: Number(n),
4512
4511
  AZG: Number(r)
4513
4512
  });
4514
4513
  }
4515
- let v = f.value === "Values defined" || t === "0" || i === "0" || u === "0", { t: y } = m();
4514
+ let _ = d.value === "Values defined" || t === "0" || r === "0" || l === "0", { t: v } = m();
4516
4515
  return /* @__PURE__ */ s(o, { children: /* @__PURE__ */ s("form", {
4517
4516
  onSubmit: (e) => {
4518
- e.preventDefault(), _(t, i, u);
4517
+ e.preventDefault(), h(t, r, l);
4519
4518
  },
4520
4519
  children: /* @__PURE__ */ c("div", {
4521
4520
  style: {
@@ -4532,23 +4531,24 @@ function ts(e) {
4532
4531
  children: [
4533
4532
  /* @__PURE__ */ s(es, {
4534
4533
  value: t,
4535
- checkValue: p,
4534
+ checkValue: f,
4536
4535
  onChange: n,
4537
- label: y("main.identify.label.scheibenlaenge", { defaultValue: "box length" }),
4538
- dataTestid: "scheibenlaenge-input"
4536
+ label: v("main.identify.label.scheibenlaenge", { defaultValue: "box length" }),
4537
+ dataTestid: "scheibenlaenge-input",
4538
+ autofocus: !0
4539
4539
  }),
4540
4540
  /* @__PURE__ */ s(es, {
4541
- value: i,
4542
- checkValue: p,
4543
- onChange: l,
4544
- label: y("main.identify.label.scheibenhoehe", { defaultValue: "box height" }),
4541
+ value: r,
4542
+ checkValue: f,
4543
+ onChange: i,
4544
+ label: v("main.identify.label.scheibenhoehe", { defaultValue: "box height" }),
4545
4545
  dataTestid: "scheibenhoehe-input"
4546
4546
  }),
4547
4547
  /* @__PURE__ */ s(es, {
4548
- value: u,
4549
- checkValue: p,
4550
- onChange: d,
4551
- label: y("main.identify.label.azg", { defaultValue: "distance between lenses" }),
4548
+ value: l,
4549
+ checkValue: f,
4550
+ onChange: u,
4551
+ label: v("main.identify.label.azg", { defaultValue: "distance between lenses" }),
4552
4552
  dataTestid: "azg-input"
4553
4553
  })
4554
4554
  ]
@@ -4556,10 +4556,10 @@ function ts(e) {
4556
4556
  color: "secondary",
4557
4557
  variant: "contained",
4558
4558
  size: "small",
4559
- disabled: v,
4560
- sx: h,
4559
+ disabled: _,
4560
+ sx: p,
4561
4561
  type: "submit",
4562
- children: y("main.identify.button.confirmValues")
4562
+ children: v("main.identify.button.confirmValues")
4563
4563
  })]
4564
4564
  })
4565
4565
  }) });
@@ -4664,8 +4664,14 @@ function ns(e) {
4664
4664
  },
4665
4665
  testMode: e.testMode
4666
4666
  }, _),
4667
- /* @__PURE__ */ s($o, { actor: e.actor }),
4668
- w.value === "Image loaded" && /* @__PURE__ */ s(ts, { actor: e.actor }),
4667
+ /* @__PURE__ */ s($o, {
4668
+ actor: e.actor,
4669
+ testMode: e.testMode
4670
+ }),
4671
+ w.value === "Image loaded" && /* @__PURE__ */ s(ts, {
4672
+ actor: e.actor,
4673
+ testMode: e.testMode
4674
+ }),
4669
4675
  w.value !== "idle" && /* @__PURE__ */ s("div", {
4670
4676
  style: {
4671
4677
  background: "#fff",
@@ -6574,7 +6580,10 @@ function Fc(e) {
6574
6580
  backgroundColor: A.palette.primary.main
6575
6581
  },
6576
6582
  children: [
6577
- /* @__PURE__ */ s($o, { actor: e.actor }, h),
6583
+ /* @__PURE__ */ s($o, {
6584
+ actor: e.actor,
6585
+ testMode: e.testMode
6586
+ }, h),
6578
6587
  /* @__PURE__ */ s("canvas", {
6579
6588
  ref: o,
6580
6589
  style: {