labellife-design-tool 2.2.3 → 2.2.5

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.
@@ -3,7 +3,7 @@ import { Image, Group, Rect, Text, Arrow, Path, RegularPolygon, Star, Circle, Li
3
3
  import { observer } from 'mobx-react-lite';
4
4
  import { Box, Typography, IconButton, Button, TextField } from '@mui/material';
5
5
  import CloseIcon from '@mui/icons-material/Close';
6
- import { jsxs, jsx } from 'react/jsx-runtime';
6
+ import { jsxs, jsx, Fragment as Fragment$1 } from 'react/jsx-runtime';
7
7
  import Konva from 'konva';
8
8
  import CloudUploadIcon from '@mui/icons-material/CloudUpload';
9
9
  import ArrowBackIcon from '@mui/icons-material/ArrowBack';
@@ -2097,6 +2097,32 @@ var InputFieldsDialog = observer(function (_ref2) {
2097
2097
  }
2098
2098
  }, [fields.length]);
2099
2099
  var totalCount = initialTotalRef.current || fields.length;
2100
+
2101
+ // Back-from-summary: triggered by parent incrementing backTrigger prop
2102
+ // Must be defined and its useEffect called BEFORE any early returns (Rules of Hooks)
2103
+ var handleBackFromSummary = function handleBackFromSummary() {
2104
+ var last = completedHistoryRef.current.pop();
2105
+ if (!last) return;
2106
+ var el = last.el,
2107
+ previousValue = last.previousValue;
2108
+ if (el) {
2109
+ var isImage = el.custom && el.custom.inputType === 'image';
2110
+ el.set(isImage ? {
2111
+ src: previousValue || ''
2112
+ } : {
2113
+ text: previousValue || ''
2114
+ });
2115
+ isGoingBackRef.current = true;
2116
+ store._unresolveInputField(el);
2117
+ }
2118
+ // displayIndex stays unchanged — it already points to the last step (N-1)
2119
+ };
2120
+ useEffect(function () {
2121
+ if (backTrigger !== prevBackTriggerRef.current) {
2122
+ prevBackTriggerRef.current = backTrigger;
2123
+ handleBackFromSummary();
2124
+ }
2125
+ }, [backTrigger]);
2100
2126
  if (!enabled || fields.length === 0) return null;
2101
2127
 
2102
2128
  // Always show the first remaining field — the array shrinks as fields are resolved
@@ -2172,31 +2198,6 @@ var InputFieldsDialog = observer(function (_ref2) {
2172
2198
  };
2173
2199
  var canGoBack = displayIndex > 0;
2174
2200
 
2175
- // Back-from-summary: triggered by parent incrementing backTrigger prop
2176
- var handleBackFromSummary = function handleBackFromSummary() {
2177
- var last = completedHistoryRef.current.pop();
2178
- if (!last) return;
2179
- var el = last.el,
2180
- previousValue = last.previousValue;
2181
- if (el) {
2182
- var isImage = el.custom && el.custom.inputType === 'image';
2183
- el.set(isImage ? {
2184
- src: previousValue || ''
2185
- } : {
2186
- text: previousValue || ''
2187
- });
2188
- isGoingBackRef.current = true;
2189
- store._unresolveInputField(el);
2190
- }
2191
- // displayIndex stays unchanged — it already points to the last step (N-1)
2192
- };
2193
- useEffect(function () {
2194
- if (backTrigger !== prevBackTriggerRef.current) {
2195
- prevBackTriggerRef.current = backTrigger;
2196
- handleBackFromSummary();
2197
- }
2198
- }, [backTrigger]);
2199
-
2200
2201
  // ── Resolve which dialog component to use ───────────────────────────
2201
2202
  // Priority: per-type custom dialog > global CustomDialog > built-in
2202
2203
  var TYPE_DIALOG_MAP = {
@@ -2288,7 +2289,7 @@ var CheckerboardBackground = function CheckerboardBackground(_ref) {
2288
2289
  height: h,
2289
2290
  fill: "#ffffff",
2290
2291
  listening: false,
2291
- name: "page-background"
2292
+ name: "display-only"
2292
2293
  });
2293
2294
  return /*#__PURE__*/jsx(Rect, {
2294
2295
  x: 0,
@@ -2298,7 +2299,7 @@ var CheckerboardBackground = function CheckerboardBackground(_ref) {
2298
2299
  fillPatternImage: imgRef.current,
2299
2300
  fillPatternRepeat: "repeat",
2300
2301
  listening: false,
2301
- name: "page-background"
2302
+ name: "display-only"
2302
2303
  });
2303
2304
  };
2304
2305
  var ImageBackground = function ImageBackground(_ref2) {
@@ -2382,9 +2383,19 @@ var PageBackground = observer(function (_ref3) {
2382
2383
  });
2383
2384
  }
2384
2385
  if (bg === 'transparent') {
2385
- return /*#__PURE__*/jsx(CheckerboardBackground, {
2386
- w: w,
2387
- h: h
2386
+ return /*#__PURE__*/jsxs(Fragment$1, {
2387
+ children: [/*#__PURE__*/jsx(Rect, {
2388
+ x: 0,
2389
+ y: 0,
2390
+ width: w,
2391
+ height: h,
2392
+ fill: "#ffffff",
2393
+ listening: false,
2394
+ name: "page-background"
2395
+ }), /*#__PURE__*/jsx(CheckerboardBackground, {
2396
+ w: w,
2397
+ h: h
2398
+ })]
2388
2399
  });
2389
2400
  }
2390
2401
 
@@ -2481,7 +2492,8 @@ var PageOverlayFrame = observer(function (_ref4) {
2481
2492
  ctx.fillStrokeShape(shape);
2482
2493
  },
2483
2494
  fill: "rgba(240,240,240,0.5)",
2484
- listening: false
2495
+ listening: false,
2496
+ name: "display-only"
2485
2497
  });
2486
2498
  });
2487
2499
  var ALL_ANCHORS = ['top-left', 'top-center', 'top-right', 'middle-left', 'middle-right', 'bottom-left', 'bottom-center', 'bottom-right'];
@@ -2816,7 +2828,8 @@ var Workspace = observer(function (_ref6) {
2816
2828
  height: store.height,
2817
2829
  fill: "rgba(0,0,0,0.1)",
2818
2830
  cornerRadius: 0,
2819
- listening: false
2831
+ listening: false,
2832
+ name: "display-only"
2820
2833
  }), /*#__PURE__*/jsx(PageBackground, {
2821
2834
  store: store
2822
2835
  }), page && page.children.map(function (element) {