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.
- package/dist/cjs/canvas/workspace.js +45 -32
- package/dist/cjs/canvas/workspace.js.map +1 -1
- package/dist/cjs/index.js +78 -38
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/model/store.js +33 -6
- package/dist/cjs/model/store.js.map +1 -1
- package/dist/esm/canvas/workspace.js +46 -33
- package/dist/esm/canvas/workspace.js.map +1 -1
- package/dist/esm/index.js +78 -38
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/model/store.js +33 -6
- package/dist/esm/model/store.js.map +1 -1
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -1961,11 +1961,11 @@ var Store = mobxStateTree.types.model('Store', {
|
|
|
1961
1961
|
_toCanvas: function _toCanvas() {
|
|
1962
1962
|
var _arguments = arguments;
|
|
1963
1963
|
return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
1964
|
-
var _ref4, _ref4$pixelRatio, pixelRatio, pageId, stage, page, layer, prevX, prevY, prevScaleX, prevScaleY,
|
|
1964
|
+
var _ref4, _ref4$pixelRatio, pixelRatio, pageId, _ref4$mimeType, mimeType, stage, page, layer, prevX, prevY, prevScaleX, prevScaleY, displayOnlyNodes, rawCanvas, finalCanvas, ctx;
|
|
1965
1965
|
return _regenerator().w(function (_context) {
|
|
1966
1966
|
while (1) switch (_context.n) {
|
|
1967
1967
|
case 0:
|
|
1968
|
-
_ref4 = _arguments.length > 0 && _arguments[0] !== undefined ? _arguments[0] : {}, _ref4$pixelRatio = _ref4.pixelRatio, pixelRatio = _ref4$pixelRatio === void 0 ? 1 : _ref4$pixelRatio, _ref4.ignoreBackground, pageId = _ref4.pageId, _ref4.mimeType, _ref4.includeBleed, _ref4._skipTimeout, _ref4.quickMode;
|
|
1968
|
+
_ref4 = _arguments.length > 0 && _arguments[0] !== undefined ? _arguments[0] : {}, _ref4$pixelRatio = _ref4.pixelRatio, pixelRatio = _ref4$pixelRatio === void 0 ? 1 : _ref4$pixelRatio, _ref4.ignoreBackground, pageId = _ref4.pageId, _ref4$mimeType = _ref4.mimeType, mimeType = _ref4$mimeType === void 0 ? 'image/png' : _ref4$mimeType, _ref4.includeBleed, _ref4._skipTimeout, _ref4.quickMode;
|
|
1969
1969
|
stage = self._stageRef;
|
|
1970
1970
|
if (stage) {
|
|
1971
1971
|
_context.n = 1;
|
|
@@ -2000,20 +2000,47 @@ var Store = mobxStateTree.types.model('Store', {
|
|
|
2000
2000
|
layer.y(0);
|
|
2001
2001
|
layer.scaleX(1);
|
|
2002
2002
|
layer.scaleY(1);
|
|
2003
|
+
|
|
2004
|
+
// Hide display-only nodes (shadow, checkerboard, overlay) — not wanted in export
|
|
2005
|
+
displayOnlyNodes = layer.find('.display-only');
|
|
2006
|
+
displayOnlyNodes.forEach(function (n) {
|
|
2007
|
+
return n.hide();
|
|
2008
|
+
});
|
|
2003
2009
|
layer.draw();
|
|
2004
|
-
|
|
2010
|
+
rawCanvas = layer.toCanvas({
|
|
2005
2011
|
pixelRatio: pixelRatio,
|
|
2006
2012
|
x: 0,
|
|
2007
2013
|
y: 0,
|
|
2008
2014
|
width: self.width,
|
|
2009
2015
|
height: self.height
|
|
2010
|
-
}); // Restore
|
|
2016
|
+
}); // Restore display-only nodes
|
|
2017
|
+
displayOnlyNodes.forEach(function (n) {
|
|
2018
|
+
return n.show();
|
|
2019
|
+
});
|
|
2020
|
+
|
|
2021
|
+
// Restore layer transform
|
|
2011
2022
|
layer.x(prevX);
|
|
2012
2023
|
layer.y(prevY);
|
|
2013
2024
|
layer.scaleX(prevScaleX);
|
|
2014
2025
|
layer.scaleY(prevScaleY);
|
|
2015
2026
|
layer.draw();
|
|
2016
|
-
|
|
2027
|
+
|
|
2028
|
+
// For JPEG, composite onto a white canvas to eliminate any remaining transparency
|
|
2029
|
+
// (avoids black areas and reduces file size vs checkerboard patterns)
|
|
2030
|
+
if (!(mimeType === 'image/jpeg')) {
|
|
2031
|
+
_context.n = 4;
|
|
2032
|
+
break;
|
|
2033
|
+
}
|
|
2034
|
+
finalCanvas = document.createElement('canvas');
|
|
2035
|
+
finalCanvas.width = rawCanvas.width;
|
|
2036
|
+
finalCanvas.height = rawCanvas.height;
|
|
2037
|
+
ctx = finalCanvas.getContext('2d');
|
|
2038
|
+
ctx.fillStyle = '#ffffff';
|
|
2039
|
+
ctx.fillRect(0, 0, finalCanvas.width, finalCanvas.height);
|
|
2040
|
+
ctx.drawImage(rawCanvas, 0, 0);
|
|
2041
|
+
return _context.a(2, finalCanvas);
|
|
2042
|
+
case 4:
|
|
2043
|
+
return _context.a(2, rawCanvas);
|
|
2017
2044
|
}
|
|
2018
2045
|
}, _callee);
|
|
2019
2046
|
}))();
|
|
@@ -2044,7 +2071,7 @@ var Store = mobxStateTree.types.model('Store', {
|
|
|
2044
2071
|
return _regenerator().w(function (_context3) {
|
|
2045
2072
|
while (1) switch (_context3.n) {
|
|
2046
2073
|
case 0:
|
|
2047
|
-
_ref6 = _arguments3.length > 0 && _arguments3[0] !== undefined ? _arguments3[0] : {}, _ref6$mimeType = _ref6.mimeType, mimeType = _ref6$mimeType === void 0 ? 'image/png' : _ref6$mimeType, _ref6$quality = _ref6.quality, quality = _ref6$quality === void 0 ?
|
|
2074
|
+
_ref6 = _arguments3.length > 0 && _arguments3[0] !== undefined ? _arguments3[0] : {}, _ref6$mimeType = _ref6.mimeType, mimeType = _ref6$mimeType === void 0 ? 'image/png' : _ref6$mimeType, _ref6$quality = _ref6.quality, quality = _ref6$quality === void 0 ? 0.92 : _ref6$quality, rest = _objectWithoutProperties(_ref6, _excluded2$1);
|
|
2048
2075
|
_context3.n = 1;
|
|
2049
2076
|
return self._toCanvas(_objectSpread2({
|
|
2050
2077
|
mimeType: mimeType
|
|
@@ -10689,6 +10716,32 @@ var InputFieldsDialog = mobxReactLite.observer(function (_ref2) {
|
|
|
10689
10716
|
}
|
|
10690
10717
|
}, [fields.length]);
|
|
10691
10718
|
var totalCount = initialTotalRef.current || fields.length;
|
|
10719
|
+
|
|
10720
|
+
// Back-from-summary: triggered by parent incrementing backTrigger prop
|
|
10721
|
+
// Must be defined and its useEffect called BEFORE any early returns (Rules of Hooks)
|
|
10722
|
+
var handleBackFromSummary = function handleBackFromSummary() {
|
|
10723
|
+
var last = completedHistoryRef.current.pop();
|
|
10724
|
+
if (!last) return;
|
|
10725
|
+
var el = last.el,
|
|
10726
|
+
previousValue = last.previousValue;
|
|
10727
|
+
if (el) {
|
|
10728
|
+
var isImage = el.custom && el.custom.inputType === 'image';
|
|
10729
|
+
el.set(isImage ? {
|
|
10730
|
+
src: previousValue || ''
|
|
10731
|
+
} : {
|
|
10732
|
+
text: previousValue || ''
|
|
10733
|
+
});
|
|
10734
|
+
isGoingBackRef.current = true;
|
|
10735
|
+
store._unresolveInputField(el);
|
|
10736
|
+
}
|
|
10737
|
+
// displayIndex stays unchanged — it already points to the last step (N-1)
|
|
10738
|
+
};
|
|
10739
|
+
React.useEffect(function () {
|
|
10740
|
+
if (backTrigger !== prevBackTriggerRef.current) {
|
|
10741
|
+
prevBackTriggerRef.current = backTrigger;
|
|
10742
|
+
handleBackFromSummary();
|
|
10743
|
+
}
|
|
10744
|
+
}, [backTrigger]);
|
|
10692
10745
|
if (!enabled || fields.length === 0) return null;
|
|
10693
10746
|
|
|
10694
10747
|
// Always show the first remaining field — the array shrinks as fields are resolved
|
|
@@ -10764,31 +10817,6 @@ var InputFieldsDialog = mobxReactLite.observer(function (_ref2) {
|
|
|
10764
10817
|
};
|
|
10765
10818
|
var canGoBack = displayIndex > 0;
|
|
10766
10819
|
|
|
10767
|
-
// Back-from-summary: triggered by parent incrementing backTrigger prop
|
|
10768
|
-
var handleBackFromSummary = function handleBackFromSummary() {
|
|
10769
|
-
var last = completedHistoryRef.current.pop();
|
|
10770
|
-
if (!last) return;
|
|
10771
|
-
var el = last.el,
|
|
10772
|
-
previousValue = last.previousValue;
|
|
10773
|
-
if (el) {
|
|
10774
|
-
var isImage = el.custom && el.custom.inputType === 'image';
|
|
10775
|
-
el.set(isImage ? {
|
|
10776
|
-
src: previousValue || ''
|
|
10777
|
-
} : {
|
|
10778
|
-
text: previousValue || ''
|
|
10779
|
-
});
|
|
10780
|
-
isGoingBackRef.current = true;
|
|
10781
|
-
store._unresolveInputField(el);
|
|
10782
|
-
}
|
|
10783
|
-
// displayIndex stays unchanged — it already points to the last step (N-1)
|
|
10784
|
-
};
|
|
10785
|
-
React.useEffect(function () {
|
|
10786
|
-
if (backTrigger !== prevBackTriggerRef.current) {
|
|
10787
|
-
prevBackTriggerRef.current = backTrigger;
|
|
10788
|
-
handleBackFromSummary();
|
|
10789
|
-
}
|
|
10790
|
-
}, [backTrigger]);
|
|
10791
|
-
|
|
10792
10820
|
// ── Resolve which dialog component to use ───────────────────────────
|
|
10793
10821
|
// Priority: per-type custom dialog > global CustomDialog > built-in
|
|
10794
10822
|
var TYPE_DIALOG_MAP = {
|
|
@@ -10880,7 +10908,7 @@ var CheckerboardBackground = function CheckerboardBackground(_ref) {
|
|
|
10880
10908
|
height: h,
|
|
10881
10909
|
fill: "#ffffff",
|
|
10882
10910
|
listening: false,
|
|
10883
|
-
name: "
|
|
10911
|
+
name: "display-only"
|
|
10884
10912
|
});
|
|
10885
10913
|
return /*#__PURE__*/jsxRuntime.jsx(reactKonva.Rect, {
|
|
10886
10914
|
x: 0,
|
|
@@ -10890,7 +10918,7 @@ var CheckerboardBackground = function CheckerboardBackground(_ref) {
|
|
|
10890
10918
|
fillPatternImage: imgRef.current,
|
|
10891
10919
|
fillPatternRepeat: "repeat",
|
|
10892
10920
|
listening: false,
|
|
10893
|
-
name: "
|
|
10921
|
+
name: "display-only"
|
|
10894
10922
|
});
|
|
10895
10923
|
};
|
|
10896
10924
|
var ImageBackground = function ImageBackground(_ref2) {
|
|
@@ -10974,9 +11002,19 @@ var PageBackground = mobxReactLite.observer(function (_ref3) {
|
|
|
10974
11002
|
});
|
|
10975
11003
|
}
|
|
10976
11004
|
if (bg === 'transparent') {
|
|
10977
|
-
return /*#__PURE__*/jsxRuntime.
|
|
10978
|
-
|
|
10979
|
-
|
|
11005
|
+
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
11006
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(reactKonva.Rect, {
|
|
11007
|
+
x: 0,
|
|
11008
|
+
y: 0,
|
|
11009
|
+
width: w,
|
|
11010
|
+
height: h,
|
|
11011
|
+
fill: "#ffffff",
|
|
11012
|
+
listening: false,
|
|
11013
|
+
name: "page-background"
|
|
11014
|
+
}), /*#__PURE__*/jsxRuntime.jsx(CheckerboardBackground, {
|
|
11015
|
+
w: w,
|
|
11016
|
+
h: h
|
|
11017
|
+
})]
|
|
10980
11018
|
});
|
|
10981
11019
|
}
|
|
10982
11020
|
|
|
@@ -11073,7 +11111,8 @@ var PageOverlayFrame = mobxReactLite.observer(function (_ref4) {
|
|
|
11073
11111
|
ctx.fillStrokeShape(shape);
|
|
11074
11112
|
},
|
|
11075
11113
|
fill: "rgba(240,240,240,0.5)",
|
|
11076
|
-
listening: false
|
|
11114
|
+
listening: false,
|
|
11115
|
+
name: "display-only"
|
|
11077
11116
|
});
|
|
11078
11117
|
});
|
|
11079
11118
|
var ALL_ANCHORS = ['top-left', 'top-center', 'top-right', 'middle-left', 'middle-right', 'bottom-left', 'bottom-center', 'bottom-right'];
|
|
@@ -11408,7 +11447,8 @@ var Workspace = mobxReactLite.observer(function (_ref6) {
|
|
|
11408
11447
|
height: store.height,
|
|
11409
11448
|
fill: "rgba(0,0,0,0.1)",
|
|
11410
11449
|
cornerRadius: 0,
|
|
11411
|
-
listening: false
|
|
11450
|
+
listening: false,
|
|
11451
|
+
name: "display-only"
|
|
11412
11452
|
}), /*#__PURE__*/jsxRuntime.jsx(PageBackground, {
|
|
11413
11453
|
store: store
|
|
11414
11454
|
}), page && page.children.map(function (element) {
|