labellife-design-tool 2.4.0 → 2.4.2

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/cjs/index.js CHANGED
@@ -60,6 +60,7 @@ require('@mui/icons-material/AlignVerticalCenter');
60
60
  require('@mui/icons-material/AlignVerticalBottom');
61
61
  var VerticalAlignTopIcon = require('@mui/icons-material/VerticalAlignTop');
62
62
  var VerticalAlignBottomIcon = require('@mui/icons-material/VerticalAlignBottom');
63
+ var GestureIcon = require('@mui/icons-material/Gesture');
63
64
  var ZoomInIcon = require('@mui/icons-material/ZoomIn');
64
65
  var ZoomOutIcon = require('@mui/icons-material/ZoomOut');
65
66
  var FitScreenIcon = require('@mui/icons-material/FitScreen');
@@ -7274,18 +7275,30 @@ var MONTH_NAMES$1 = ['January', 'February', 'March', 'April', 'May', 'June', 'Ju
7274
7275
  var DATE_FORMATS = [{
7275
7276
  key: 'MM-DD-YYYY',
7276
7277
  label: 'MM-DD-YYYY'
7278
+ }, {
7279
+ key: 'DD-MM-YYYY',
7280
+ label: 'DD-MM-YYYY'
7277
7281
  }, {
7278
7282
  key: 'MMMM-DD-YYYY',
7279
7283
  label: 'Month Name-DD-YYYY'
7284
+ }, {
7285
+ key: 'DD-MMMM-YYYY',
7286
+ label: 'DD-Month Name-YYYY'
7280
7287
  }, {
7281
7288
  key: 'MMMM-DD',
7282
7289
  label: 'Month Name-DD'
7290
+ }, {
7291
+ key: 'DD-MMMM',
7292
+ label: 'DD-Month Name'
7283
7293
  }, {
7284
7294
  key: 'YYYY',
7285
7295
  label: 'YYYY'
7286
7296
  }, {
7287
7297
  key: 'MM-DD',
7288
7298
  label: 'MM-DD'
7299
+ }, {
7300
+ key: 'DD-MM',
7301
+ label: 'DD-MM'
7289
7302
  }];
7290
7303
  function formatDate$1(date, format) {
7291
7304
  var mm = String(date.getMonth() + 1).padStart(2, '0');
@@ -7295,14 +7308,22 @@ function formatDate$1(date, format) {
7295
7308
  switch (format) {
7296
7309
  case 'MM-DD-YYYY':
7297
7310
  return "".concat(mm, "-").concat(dd, "-").concat(yyyy);
7311
+ case 'DD-MM-YYYY':
7312
+ return "".concat(dd, "-").concat(mm, "-").concat(yyyy);
7298
7313
  case 'MMMM-DD-YYYY':
7299
7314
  return "".concat(monthName, "-").concat(dd, "-").concat(yyyy);
7315
+ case 'DD-MMMM-YYYY':
7316
+ return "".concat(dd, "-").concat(monthName, "-").concat(yyyy);
7300
7317
  case 'MMMM-DD':
7301
7318
  return "".concat(monthName, "-").concat(dd);
7319
+ case 'DD-MMMM':
7320
+ return "".concat(dd, "-").concat(monthName);
7302
7321
  case 'YYYY':
7303
7322
  return yyyy;
7304
7323
  case 'MM-DD':
7305
7324
  return "".concat(mm, "-").concat(dd);
7325
+ case 'DD-MM':
7326
+ return "".concat(dd, "-").concat(mm);
7306
7327
  default:
7307
7328
  return "".concat(mm, "-").concat(dd, "-").concat(yyyy);
7308
7329
  }
@@ -9816,10 +9837,85 @@ var PositionButton = mobxReactLite.observer(function (_ref8) {
9816
9837
  });
9817
9838
  });
9818
9839
 
9840
+ // Curve (text-only) slider popover — same button/popover pattern as
9841
+ // PositionButton, holding the same control previously in the Text
9842
+ // Effects panel's Curve section. No separate enable toggle: curvePower
9843
+ // itself is the on/off state (0 = straight, matching how the renderer
9844
+ // already treats curvePower === 0 as "no curve").
9845
+ var CurveButton = mobxReactLite.observer(function (_ref0) {
9846
+ var element = _ref0.element;
9847
+ var _useState5 = React.useState(null),
9848
+ _useState6 = _slicedToArray(_useState5, 2),
9849
+ anchorEl = _useState6[0],
9850
+ setAnchorEl = _useState6[1];
9851
+ var open = Boolean(anchorEl);
9852
+ return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
9853
+ children: [/*#__PURE__*/jsxRuntime.jsx(material.Button, {
9854
+ size: "small",
9855
+ onClick: function onClick(e) {
9856
+ return setAnchorEl(e.currentTarget);
9857
+ },
9858
+ startIcon: /*#__PURE__*/jsxRuntime.jsx(GestureIcon, {
9859
+ sx: {
9860
+ fontSize: '16px !important'
9861
+ }
9862
+ }),
9863
+ sx: _objectSpread2({
9864
+ textTransform: 'none',
9865
+ fontSize: 12,
9866
+ whiteSpace: 'nowrap',
9867
+ px: 1.5,
9868
+ minWidth: 'auto'
9869
+ }, open ? {
9870
+ backgroundColor: '#e3f2fd',
9871
+ color: '#0d83cd'
9872
+ } : {}),
9873
+ children: t('toolbar.curve', 'Curve')
9874
+ }), /*#__PURE__*/jsxRuntime.jsx(material.Popover, {
9875
+ open: open,
9876
+ anchorEl: anchorEl,
9877
+ onClose: function onClose() {
9878
+ return setAnchorEl(null);
9879
+ },
9880
+ anchorOrigin: {
9881
+ vertical: 'bottom',
9882
+ horizontal: 'left'
9883
+ },
9884
+ transformOrigin: {
9885
+ vertical: 'top',
9886
+ horizontal: 'left'
9887
+ },
9888
+ slotProps: {
9889
+ paper: {
9890
+ sx: {
9891
+ mt: 0.5,
9892
+ p: 2,
9893
+ width: 260,
9894
+ borderRadius: '10px',
9895
+ boxShadow: '0 4px 20px rgba(0,0,0,0.12)'
9896
+ }
9897
+ }
9898
+ },
9899
+ children: /*#__PURE__*/jsxRuntime.jsx(SliderRow, {
9900
+ label: t('toolbar.curve', 'Curve'),
9901
+ value: element.curvePower,
9902
+ onChange: function onChange(v) {
9903
+ return element.set({
9904
+ curveEnabled: true,
9905
+ curvePower: v
9906
+ });
9907
+ },
9908
+ min: -500,
9909
+ max: 500
9910
+ })
9911
+ })]
9912
+ });
9913
+ });
9914
+
9819
9915
  // Common controls for all element types
9820
- var CommonControls = mobxReactLite.observer(function (_ref0) {
9821
- var element = _ref0.element,
9822
- store = _ref0.store;
9916
+ var CommonControls = mobxReactLite.observer(function (_ref1) {
9917
+ var element = _ref1.element,
9918
+ store = _ref1.store;
9823
9919
  var isLocked = element.locked;
9824
9920
  var handleDuplicate = function handleDuplicate() {
9825
9921
  if (element.clone) {
@@ -9897,6 +9993,9 @@ var CommonControls = mobxReactLite.observer(function (_ref0) {
9897
9993
  }), /*#__PURE__*/jsxRuntime.jsx(PositionButton, {
9898
9994
  element: element,
9899
9995
  store: store
9996
+ }), element.type === 'text' && /*#__PURE__*/jsxRuntime.jsx(CurveButton, {
9997
+ element: element,
9998
+ store: store
9900
9999
  }), /*#__PURE__*/jsxRuntime.jsx(material.Divider, {
9901
10000
  orientation: "vertical",
9902
10001
  flexItem: true,
@@ -9940,26 +10039,26 @@ var CommonControls = mobxReactLite.observer(function (_ref0) {
9940
10039
  });
9941
10040
 
9942
10041
  // Download button with format/quality popover
9943
- var DefaultDownloadButton = mobxReactLite.observer(function (_ref1) {
9944
- var store = _ref1.store;
9945
- var _useState5 = React.useState(null),
9946
- _useState6 = _slicedToArray(_useState5, 2),
9947
- anchorEl = _useState6[0],
9948
- setAnchorEl = _useState6[1];
9949
- var _useState7 = React.useState('png'),
10042
+ var DefaultDownloadButton = mobxReactLite.observer(function (_ref10) {
10043
+ var store = _ref10.store;
10044
+ var _useState7 = React.useState(null),
9950
10045
  _useState8 = _slicedToArray(_useState7, 2),
9951
- fileType = _useState8[0],
9952
- setFileType = _useState8[1];
10046
+ anchorEl = _useState8[0],
10047
+ setAnchorEl = _useState8[1];
10048
+ var _useState9 = React.useState('png'),
10049
+ _useState0 = _slicedToArray(_useState9, 2),
10050
+ fileType = _useState0[0],
10051
+ setFileType = _useState0[1];
9953
10052
  // Default quality so pixelRatio=1 (output = template's own pixel size).
9954
10053
  // qualityToPixelRatio(q) = q * 3, so q = 1/3 → pixelRatio = 1.
9955
- var _useState9 = React.useState(1 / 3),
9956
- _useState0 = _slicedToArray(_useState9, 2),
9957
- quality = _useState0[0],
9958
- setQuality = _useState0[1];
9959
- var _useState1 = React.useState(false),
10054
+ var _useState1 = React.useState(1 / 3),
9960
10055
  _useState10 = _slicedToArray(_useState1, 2),
9961
- exporting = _useState10[0],
9962
- setExporting = _useState10[1];
10056
+ quality = _useState10[0],
10057
+ setQuality = _useState10[1];
10058
+ var _useState11 = React.useState(false),
10059
+ _useState12 = _slicedToArray(_useState11, 2),
10060
+ exporting = _useState12[0],
10061
+ setExporting = _useState12[1];
9963
10062
  var open = Boolean(anchorEl);
9964
10063
  var handleClick = function handleClick(e) {
9965
10064
  setAnchorEl(e.currentTarget);
@@ -10192,15 +10291,15 @@ var DefaultDownloadButton = mobxReactLite.observer(function (_ref1) {
10192
10291
  });
10193
10292
 
10194
10293
  // Import button — loads a JSON template file into the store
10195
- var DefaultImportButton = mobxReactLite.observer(function (_ref11) {
10196
- var store = _ref11.store;
10197
- var _useState11 = React.useState(false),
10198
- _useState12 = _slicedToArray(_useState11, 2),
10199
- importing = _useState12[0],
10200
- setImporting = _useState12[1];
10294
+ var DefaultImportButton = mobxReactLite.observer(function (_ref12) {
10295
+ var store = _ref12.store;
10296
+ var _useState13 = React.useState(false),
10297
+ _useState14 = _slicedToArray(_useState13, 2),
10298
+ importing = _useState14[0],
10299
+ setImporting = _useState14[1];
10201
10300
  var fileInputRef = React.useRef(null);
10202
10301
  var handleFileChange = React.useCallback(/*#__PURE__*/function () {
10203
- var _ref12 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(e) {
10302
+ var _ref13 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(e) {
10204
10303
  var _e$target$files;
10205
10304
  var file, text, jsonData, _t3;
10206
10305
  return _regenerator().w(function (_context2) {
@@ -10238,7 +10337,7 @@ var DefaultImportButton = mobxReactLite.observer(function (_ref11) {
10238
10337
  }, _callee2, null, [[2, 4, 5, 6]]);
10239
10338
  }));
10240
10339
  return function (_x) {
10241
- return _ref12.apply(this, arguments);
10340
+ return _ref13.apply(this, arguments);
10242
10341
  };
10243
10342
  }(), [store]);
10244
10343
  return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
@@ -10304,10 +10403,10 @@ var rowSx = {
10304
10403
  display: 'none'
10305
10404
  }
10306
10405
  };
10307
- var Toolbar = mobxReactLite.observer(function (_ref13) {
10308
- var store = _ref13.store,
10309
- _ref13$components = _ref13.components,
10310
- components = _ref13$components === void 0 ? {} : _ref13$components;
10406
+ var Toolbar = mobxReactLite.observer(function (_ref14) {
10407
+ var store = _ref14.store,
10408
+ _ref14$components = _ref14.components,
10409
+ components = _ref14$components === void 0 ? {} : _ref14$components;
10311
10410
  var ActionControls = components.ActionControls;
10312
10411
  var ImportButton = 'ImportButton' in components ? components.ImportButton : DefaultImportButton;
10313
10412
  var DownloadButton = 'DownloadButton' in components ? components.DownloadButton : DefaultDownloadButton;
@@ -11027,6 +11126,203 @@ var ImageElementComponent = mobxReactLite.observer(function (_ref) {
11027
11126
  });
11028
11127
  ImageElementComponent.displayName = 'ImageElement';
11029
11128
 
11129
+ // Composes a canvas/Konva font-style string (e.g. "italic bold") from the
11130
+ // element model's separate fontStyle/fontWeight fields. Shared by
11131
+ // text-element.js (KonvaText) and curved-text.js (custom Shape), which
11132
+ // both need to build a canvas `ctx.font` / Konva fontStyle string the same
11133
+ // way.
11134
+ function composeFontStyle(fontStyle, fontWeight) {
11135
+ var parts = [];
11136
+ var style = String(fontStyle || '').trim();
11137
+ var weight = String(fontWeight || '').trim();
11138
+ if (style === 'italic' || style.includes('italic')) parts.push('italic');
11139
+ if (weight && weight !== 'normal') parts.push(weight);
11140
+ return parts.length > 0 ? parts.join(' ') : 'normal';
11141
+ }
11142
+
11143
+ // src/canvas/curved-text-geometry.js
11144
+ //
11145
+ // Pure, framework-free geometry math for the curved-text effect.
11146
+ // Deliberately authored as CommonJS (not ESM like the rest of src/canvas)
11147
+ // so this one file can be unit-tested with plain `node`, no jest/babel
11148
+ // required — this repo has no test framework installed. Rollup's
11149
+ // commonjs() plugin (already in rollup.config.mjs) interops this into the
11150
+ // ESM build correctly when curved-text.js imports it with `import`.
11151
+
11152
+ // At curvePower = 100 (max), the radius is this many multiples of
11153
+ // fontSize. Tuned empirically: 3x let realistic multi-word labels wrap
11154
+ // into a nearly-closed loop well before the slider reached 100 (e.g. a
11155
+ // ~500px-wide line swept ~341° — individual glyphs rotate past horizontal
11156
+ // once a line wraps past ~180°, which read as "letters rotating wrong").
11157
+ // 6x keeps the same line under ~170° at max curvePower, a clearly-open arc.
11158
+ // Adjust this constant (and re-run curved-text-geometry.test.js, which
11159
+ // exercises it) if the on-screen result needs to be tighter/looser.
11160
+ var MAX_RADIUS_FONT_MULTIPLIER = 6;
11161
+
11162
+ // Maps curvePower (-100..100) to a positive radius magnitude in px.
11163
+ // Direction (smile vs frown) is NOT encoded here — callers apply
11164
+ // Math.sign(curvePower) separately (see curved-text.js). curvePower = 0
11165
+ // returns Infinity (a "straight line" radius) for defensiveness, though
11166
+ // callers should treat curvePower === 0 as "don't curve at all" before
11167
+ // reaching here (falls back to plain KonvaText).
11168
+ function computeArcRadius(curvePower, fontSize) {
11169
+ var power = Math.abs(curvePower);
11170
+ if (power === 0) return Infinity;
11171
+ return fontSize * MAX_RADIUS_FONT_MULTIPLIER / (power / 100);
11172
+ }
11173
+
11174
+ // Computes the radius for line `lineIndex` (0-based, top to bottom) of a
11175
+ // multi-line curved text block, so all lines share one arc center
11176
+ // (concentric) and stack in normal reading order.
11177
+ //
11178
+ // For curvePower > 0 ("smile", center below the text), later lines move
11179
+ // closer to the center (smaller radius). For curvePower < 0 ("frown",
11180
+ // center above the text), later lines move away from the center (larger
11181
+ // radius).
11182
+ function computeLineRadius(baseRadius, lineIndex, lineHeight, curvePower) {
11183
+ var direction = curvePower > 0 ? -1 : 1;
11184
+ return baseRadius + lineIndex * lineHeight * direction;
11185
+ }
11186
+
11187
+ // Distributes characters of one line along an arc of the given radius,
11188
+ // centered so the line's midpoint sits at angle 0 — i.e. center-aligned.
11189
+ //
11190
+ // charWidths: array of per-glyph advance widths (px), in reading order.
11191
+ // radius: positive, finite radius magnitude (px) for this line.
11192
+ //
11193
+ // Returns an array, one entry per character, each: { angle } — the angle
11194
+ // (radians) from the arc's center-line, in reading order. Callers convert
11195
+ // `angle` + `radius` into an (x, y) position and a tangent rotation for
11196
+ // drawing (see curved-text.js).
11197
+ function layoutCharsOnArc(charWidths, radius) {
11198
+ if (!Number.isFinite(radius) || radius <= 0) {
11199
+ throw new Error('layoutCharsOnArc requires a finite, positive radius');
11200
+ }
11201
+ var totalWidth = charWidths.reduce(function (sum, w) {
11202
+ return sum + w;
11203
+ }, 0);
11204
+ var totalAngle = totalWidth / radius;
11205
+ var cumBefore = 0;
11206
+ return charWidths.map(function (w) {
11207
+ var cumMid = cumBefore + w / 2;
11208
+ cumBefore += w;
11209
+ var angleFromStart = cumMid / radius;
11210
+ return {
11211
+ angle: angleFromStart - totalAngle / 2
11212
+ };
11213
+ });
11214
+ }
11215
+ var curvedTextGeometry = {
11216
+ computeArcRadius: computeArcRadius,
11217
+ computeLineRadius: computeLineRadius,
11218
+ layoutCharsOnArc: layoutCharsOnArc
11219
+ };
11220
+
11221
+ var CurvedText = mobxReactLite.observer(/*#__PURE__*/React.forwardRef(function (_ref, ref) {
11222
+ var element = _ref.element,
11223
+ displayText = _ref.displayText,
11224
+ width = _ref.width;
11225
+ var fontStyleStr = composeFontStyle(element.fontStyle, element.fontWeight);
11226
+ var lineHeightMultiplier = typeof element.lineHeight === 'number' ? element.lineHeight : parseFloat(element.lineHeight) || 1.2;
11227
+ var lineHeightPx = element.fontSize * lineHeightMultiplier;
11228
+ var letterSpacing = element.letterSpacing || 0;
11229
+ var curvePower = element.curvePower;
11230
+
11231
+ // Precondition: caller must not mount this component with curvePower === 0.
11232
+ // Defensive guard to avoid passing Infinity to layoutCharsOnArc.
11233
+ if (curvePower === 0) return null;
11234
+ var direction = curvePower > 0 ? 1 : -1;
11235
+ var baseRadius = curvedTextGeometry.computeArcRadius(curvePower, element.fontSize);
11236
+ var lines = (displayText || '').split('\n');
11237
+
11238
+ // Shared per-character geometry: walks every line/character and invokes
11239
+ // `draw(ctx, ch, x, y, angle)` inside the same save/translate/rotate/
11240
+ // restore frame. Used by both sceneFunc (real glyph fill/stroke) and
11241
+ // hitFunc (hit-region rects) so the clickable area always matches what's
11242
+ // actually painted — duplicating this math between the two would risk
11243
+ // them drifting apart.
11244
+ var forEachChar = function forEachChar(ctx, draw) {
11245
+ var centerX = width / 2;
11246
+ lines.forEach(function (lineText, lineIndex) {
11247
+ var chars = Array.from(lineText);
11248
+ if (chars.length === 0) return;
11249
+ var charWidths = chars.map(function (ch) {
11250
+ return ctx.measureText(ch).width + letterSpacing;
11251
+ });
11252
+ var lineRadius = curvedTextGeometry.computeLineRadius(baseRadius, lineIndex, lineHeightPx, curvePower);
11253
+ var signedRadius = direction * lineRadius;
11254
+ var baselineY = lineIndex * lineHeightPx + element.fontSize;
11255
+ var centerY = baselineY + signedRadius;
11256
+ var layout = curvedTextGeometry.layoutCharsOnArc(charWidths, lineRadius);
11257
+ chars.forEach(function (ch, idx) {
11258
+ var angle = layout[idx].angle;
11259
+ var x = centerX + lineRadius * Math.sin(angle);
11260
+ var y = centerY - signedRadius * Math.cos(angle);
11261
+ draw(ctx, ch, x, y, angle, charWidths[idx]);
11262
+ });
11263
+ });
11264
+ };
11265
+ return /*#__PURE__*/jsxRuntime.jsx(reactKonva.Shape, {
11266
+ ref: ref,
11267
+ width: width,
11268
+ height: lines.length * lineHeightPx,
11269
+ sceneFunc: function sceneFunc(ctx) {
11270
+ ctx.font = "".concat(fontStyleStr, " ").concat(element.fontSize, "px \"").concat(element.fontFamily, "\"");
11271
+ ctx.textAlign = 'center';
11272
+ ctx.textBaseline = 'alphabetic';
11273
+ forEachChar(ctx, function (c, ch, x, y, angle) {
11274
+ c.save();
11275
+ c.translate(x, y);
11276
+ c.rotate(direction * angle);
11277
+ if (element.strokeWidth > 0) {
11278
+ c.strokeStyle = element.stroke || '#000000';
11279
+ c.lineWidth = element.strokeWidth;
11280
+ c.strokeText(ch, 0, 0);
11281
+ }
11282
+ c.fillStyle = element.fill;
11283
+ c.fillText(ch, 0, 0);
11284
+ c.restore();
11285
+ });
11286
+ },
11287
+ hitFunc: function hitFunc(ctx, shape) {
11288
+ ctx.font = "".concat(fontStyleStr, " ").concat(element.fontSize, "px \"").concat(element.fontFamily, "\"");
11289
+ ctx.textAlign = 'center';
11290
+ ctx.textBaseline = 'alphabetic';
11291
+ ctx.beginPath();
11292
+ forEachChar(ctx, function (c, ch, x, y, angle, charWidth) {
11293
+ c.save();
11294
+ c.translate(x, y);
11295
+ c.rotate(direction * angle);
11296
+ c.rect(-charWidth / 2, -element.fontSize * 0.8, charWidth, element.fontSize * 1.1);
11297
+ c.restore();
11298
+ });
11299
+ ctx.fillStrokeShape(shape);
11300
+ }
11301
+ });
11302
+ }));
11303
+ CurvedText.displayName = 'CurvedText';
11304
+
11305
+ function computeCurvedCacheBounds(element) {
11306
+ var lineCount = (element.text || element.placeholder || '').split('\n').length;
11307
+ var lineHeightMultiplier = typeof element.lineHeight === 'number' ? element.lineHeight : parseFloat(element.lineHeight) || 1.2;
11308
+ var lineHeightPx = element.fontSize * lineHeightMultiplier;
11309
+ var baseRadius = curvedTextGeometry.computeArcRadius(element.curvePower, element.fontSize);
11310
+ var halfChord = element.width / 2;
11311
+ var maxSagitta = 0;
11312
+ for (var lineIndex = 0; lineIndex < lineCount; lineIndex++) {
11313
+ var lineRadius = curvedTextGeometry.computeLineRadius(baseRadius, lineIndex, lineHeightPx, element.curvePower);
11314
+ var sagitta = halfChord >= lineRadius ? lineRadius : lineRadius - Math.sqrt(lineRadius * lineRadius - halfChord * halfChord);
11315
+ if (sagitta > maxSagitta) maxSagitta = sagitta;
11316
+ }
11317
+ var declaredHeight = lineCount * lineHeightPx;
11318
+ var xPad = maxSagitta / 2;
11319
+ return {
11320
+ x: -xPad,
11321
+ y: -maxSagitta,
11322
+ width: element.width + xPad * 2,
11323
+ height: declaredHeight + maxSagitta * 2
11324
+ };
11325
+ }
11030
11326
  var TextElementComponent = mobxReactLite.observer(function (_ref) {
11031
11327
  var _element$backgroundOp;
11032
11328
  var element = _ref.element;
@@ -11041,13 +11337,24 @@ var TextElementComponent = mobxReactLite.observer(function (_ref) {
11041
11337
  _useState2 = _slicedToArray(_useState, 2),
11042
11338
  textHeight = _useState2[0],
11043
11339
  setTextHeight = _useState2[1];
11340
+ var isCurved = element.curveEnabled && element.curvePower !== 0;
11044
11341
 
11045
11342
  // Force Konva to recalculate text layout when fonts finish loading.
11046
11343
  React.useEffect(function () {
11047
11344
  var onFontLoaded = function onFontLoaded() {
11048
- var _node$getLayer;
11345
+ var _node$getLayer2;
11049
11346
  var node = textRef.current;
11050
11347
  if (!node) return;
11348
+
11349
+ // CurvedText's sceneFunc re-measures glyphs via ctx.measureText on
11350
+ // every draw (no internal cached layout like Konva.Text has), so
11351
+ // there's no stale-layout workaround needed — just repaint.
11352
+ if (element.curveEnabled && element.curvePower !== 0) {
11353
+ var _node$getLayer;
11354
+ if (element.blurEnabled) node.cache(computeCurvedCacheBounds(element));
11355
+ (_node$getLayer = node.getLayer()) === null || _node$getLayer === void 0 || _node$getLayer.batchDraw();
11356
+ return;
11357
+ }
11051
11358
  var f = node.fontFamily();
11052
11359
  node.fontFamily('serif');
11053
11360
  node.fontFamily(f);
@@ -11062,7 +11369,7 @@ var TextElementComponent = mobxReactLite.observer(function (_ref) {
11062
11369
  if (element.blurEnabled && node) {
11063
11370
  node.cache();
11064
11371
  }
11065
- (_node$getLayer = node.getLayer()) === null || _node$getLayer === void 0 || _node$getLayer.batchDraw();
11372
+ (_node$getLayer2 = node.getLayer()) === null || _node$getLayer2 === void 0 || _node$getLayer2.batchDraw();
11066
11373
  };
11067
11374
  document.fonts.addEventListener('loadingdone', onFontLoaded);
11068
11375
  return function () {
@@ -11071,7 +11378,10 @@ var TextElementComponent = mobxReactLite.observer(function (_ref) {
11071
11378
  }, []);
11072
11379
 
11073
11380
  // Sync Konva auto-sized height back to element model after text reflows
11381
+ // (straight text only — curved text's height is computed synchronously
11382
+ // below, since it doesn't width-wrap and doesn't need a measured node).
11074
11383
  React.useEffect(function () {
11384
+ if (element.curveEnabled && element.curvePower !== 0) return;
11075
11385
  var node = textRef.current;
11076
11386
  if (!node) return;
11077
11387
  var frame = requestAnimationFrame(function () {
@@ -11086,23 +11396,40 @@ var TextElementComponent = mobxReactLite.observer(function (_ref) {
11086
11396
  return function () {
11087
11397
  return cancelAnimationFrame(frame);
11088
11398
  };
11089
- }, [element.text, element.fontSize, element.fontFamily, element.fontWeight, element.width]);
11399
+ }, [element.text, element.fontSize, element.fontFamily, element.fontWeight, element.width, element.curveEnabled, element.curvePower]);
11400
+
11401
+ // Curved text: height is deterministic from line count (no width-based
11402
+ // wrapping), so sync it directly without waiting on Konva measurement.
11403
+ React.useEffect(function () {
11404
+ if (!(element.curveEnabled && element.curvePower !== 0)) return;
11405
+ var lineCount = (element.text || element.placeholder || '').split('\n').length;
11406
+ var lineHeightMultiplier = typeof element.lineHeight === 'number' ? element.lineHeight : parseFloat(element.lineHeight) || 1.2;
11407
+ var h = lineCount * element.fontSize * lineHeightMultiplier;
11408
+ setTextHeight(h);
11409
+ if (Math.abs(h - element.height) > 1) element.set({
11410
+ height: h
11411
+ });
11412
+ }, [element.text, element.placeholder, element.fontSize, element.lineHeight, element.curveEnabled, element.curvePower]);
11090
11413
 
11091
11414
  // Apply blur filter: cache the text node when blur is enabled
11092
11415
  React.useEffect(function () {
11093
- var _node$getLayer2;
11416
+ var _node$getLayer3;
11094
11417
  var node = textRef.current;
11095
11418
  if (!node) return;
11096
11419
  if (element.blurEnabled) {
11097
11420
  node.filters([Konva.Filters.Blur]);
11098
11421
  node.blurRadius(element.blurRadius);
11099
- node.cache();
11422
+ if (isCurved) {
11423
+ node.cache(computeCurvedCacheBounds(element));
11424
+ } else {
11425
+ node.cache();
11426
+ }
11100
11427
  } else {
11101
11428
  node.filters([]);
11102
11429
  node.clearCache();
11103
11430
  }
11104
- (_node$getLayer2 = node.getLayer()) === null || _node$getLayer2 === void 0 || _node$getLayer2.batchDraw();
11105
- }, [element.blurEnabled, element.blurRadius, element.text, element.fontSize, element.width]);
11431
+ (_node$getLayer3 = node.getLayer()) === null || _node$getLayer3 === void 0 || _node$getLayer3.batchDraw();
11432
+ }, [element.blurEnabled, element.blurRadius, element.text, element.fontSize, element.width, isCurved, element.curvePower, element.lineHeight]);
11106
11433
  if (!element.visible) return null;
11107
11434
  var handleDragEnd = function handleDragEnd(e) {
11108
11435
  element.set({
@@ -11127,7 +11454,9 @@ var TextElementComponent = mobxReactLite.observer(function (_ref) {
11127
11454
  var tNode = textRef.current;
11128
11455
  if (tNode) {
11129
11456
  tNode.width(newWidth);
11130
- tNode.fontSize(newFontSize);
11457
+ if (typeof tNode.fontSize === 'function') {
11458
+ tNode.fontSize(newFontSize);
11459
+ }
11131
11460
  }
11132
11461
  node.scaleX(1);
11133
11462
  node.scaleY(1);
@@ -11241,14 +11570,7 @@ var TextElementComponent = mobxReactLite.observer(function (_ref) {
11241
11570
  return c.toUpperCase();
11242
11571
  });
11243
11572
  }
11244
- var fontStyleStr = function () {
11245
- var parts = [];
11246
- var style = String(element.fontStyle || '').trim();
11247
- var weight = String(element.fontWeight || '').trim();
11248
- if (style === 'italic' || style.includes('italic')) parts.push('italic');
11249
- if (weight && weight !== 'normal') parts.push(weight);
11250
- return parts.length > 0 ? parts.join(' ') : 'normal';
11251
- }();
11573
+ var fontStyleStr = composeFontStyle(element.fontStyle, element.fontWeight);
11252
11574
  var pad = element.backgroundEnabled ? element.backgroundPadding || 0 : 0;
11253
11575
  return /*#__PURE__*/jsxRuntime.jsxs(reactKonva.Group, {
11254
11576
  ref: groupRef,
@@ -11282,7 +11604,12 @@ var TextElementComponent = mobxReactLite.observer(function (_ref) {
11282
11604
  opacity: (_element$backgroundOp = element.backgroundOpacity) !== null && _element$backgroundOp !== void 0 ? _element$backgroundOp : 1,
11283
11605
  cornerRadius: element.backgroundCornerRadius || 0,
11284
11606
  listening: false
11285
- }), /*#__PURE__*/jsxRuntime.jsx(reactKonva.Text, {
11607
+ }), isCurved ? /*#__PURE__*/jsxRuntime.jsx(CurvedText, {
11608
+ ref: textRef,
11609
+ element: element,
11610
+ displayText: displayText,
11611
+ width: element.width
11612
+ }) : /*#__PURE__*/jsxRuntime.jsx(reactKonva.Text, {
11286
11613
  ref: textRef,
11287
11614
  text: displayText,
11288
11615
  width: element.width,
@@ -11868,9 +12195,19 @@ function parseDateFromFormat(dateStr, format) {
11868
12195
  return new Date();
11869
12196
  }
11870
12197
 
12198
+ // Shared sizing for the popup's action row (Back / Continue / Do it later),
12199
+ // exported so a custom `PopupActions` component can visually match them.
12200
+ var popupActionButtonSx = {
12201
+ textTransform: 'none',
12202
+ fontSize: 21,
12203
+ py: 1.65,
12204
+ borderRadius: '10px'
12205
+ };
12206
+
11871
12207
  // ── Default single-field dialog (full-page overlay) ──────────────────
11872
12208
  var SingleFieldDialog = function SingleFieldDialog(_ref) {
11873
12209
  var field = _ref.field,
12210
+ store = _ref.store,
11874
12211
  onSubmit = _ref.onSubmit,
11875
12212
  onSkip = _ref.onSkip,
11876
12213
  onBack = _ref.onBack,
@@ -12431,36 +12768,30 @@ var SingleFieldDialog = function SingleFieldDialog(_ref) {
12431
12768
  mt: 4.5,
12432
12769
  flexShrink: 0
12433
12770
  },
12434
- children: [canGoBack && /*#__PURE__*/jsxRuntime.jsx(material.Button, {
12771
+ children: [config.PopupActions && /*#__PURE__*/jsxRuntime.jsx(config.PopupActions, {
12772
+ store: store
12773
+ }), canGoBack && /*#__PURE__*/jsxRuntime.jsx(material.Button, {
12435
12774
  variant: "outlined",
12436
12775
  onClick: onBack,
12437
12776
  startIcon: /*#__PURE__*/jsxRuntime.jsx(ArrowBackIcon, {}),
12438
- sx: {
12439
- textTransform: 'none',
12777
+ sx: _objectSpread2(_objectSpread2({}, popupActionButtonSx), {}, {
12440
12778
  fontWeight: 500,
12441
- fontSize: 21,
12442
12779
  px: 3,
12443
- py: 1.65,
12444
- borderRadius: '10px',
12445
12780
  color: '#555',
12446
12781
  borderColor: '#d0d5dd',
12447
12782
  '&:hover': {
12448
12783
  borderColor: '#aaa',
12449
12784
  backgroundColor: 'rgba(0,0,0,0.02)'
12450
12785
  }
12451
- },
12786
+ }),
12452
12787
  children: t('inputFieldsDialog.back', 'Back')
12453
12788
  }), /*#__PURE__*/jsxRuntime.jsx(material.Button, {
12454
12789
  variant: "contained",
12455
12790
  onClick: handleSubmit,
12456
12791
  disabled: isSubmitDisabled,
12457
- sx: _objectSpread2({
12458
- textTransform: 'none',
12792
+ sx: _objectSpread2(_objectSpread2({}, popupActionButtonSx), {}, {
12459
12793
  fontWeight: 600,
12460
- fontSize: 21,
12461
12794
  px: 5,
12462
- py: 1.65,
12463
- borderRadius: '10px',
12464
12795
  backgroundColor: accentColor,
12465
12796
  boxShadow: 'none',
12466
12797
  '&:hover': {
@@ -12474,13 +12805,9 @@ var SingleFieldDialog = function SingleFieldDialog(_ref) {
12474
12805
  onClick: function onClick() {
12475
12806
  return onSkip(field.id);
12476
12807
  },
12477
- sx: _objectSpread2({
12478
- textTransform: 'none',
12808
+ sx: _objectSpread2(_objectSpread2({}, popupActionButtonSx), {}, {
12479
12809
  fontWeight: 500,
12480
- fontSize: 21,
12481
12810
  px: 4.5,
12482
- py: 1.65,
12483
- borderRadius: '10px',
12484
12811
  color: '#555',
12485
12812
  borderColor: '#d0d5dd',
12486
12813
  '&:hover': {
@@ -12723,6 +13050,7 @@ var InputFieldsDialog = mobxReactLite.observer(function (_ref2) {
12723
13050
  }
12724
13051
  return /*#__PURE__*/jsxRuntime.jsx(SingleFieldDialog, {
12725
13052
  field: currentField,
13053
+ store: store,
12726
13054
  onSubmit: handleSubmit,
12727
13055
  onSkip: handleSkip,
12728
13056
  onBack: handleBack,
@@ -13498,6 +13826,7 @@ exports.getTheme = getTheme;
13498
13826
  exports.getTranslations = getTranslations;
13499
13827
  exports.loadGoogleFont = loadGoogleFont;
13500
13828
  exports.loadImage = loadImage;
13829
+ exports.popupActionButtonSx = popupActionButtonSx;
13501
13830
  exports.pxToUnit = pxToUnit;
13502
13831
  exports.setInputFieldsConfig = setInputFieldsConfig;
13503
13832
  exports.setTheme = setTheme;