@arbisoft/react-design-tool 1.0.50 → 1.0.52
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 +33 -14
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +33 -14
- package/dist/esm/index.js.map +1 -1
- package/package.json +2 -2
package/dist/cjs/index.js
CHANGED
|
@@ -282,19 +282,17 @@ function _regeneratorDefine(e, r, n, t) {
|
|
|
282
282
|
i = 0;
|
|
283
283
|
}
|
|
284
284
|
_regeneratorDefine = function (e, r, n, t) {
|
|
285
|
-
|
|
285
|
+
function o(r, n) {
|
|
286
|
+
_regeneratorDefine(e, r, function (e) {
|
|
287
|
+
return this._invoke(r, n, e);
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
r ? i ? i(e, r, {
|
|
286
291
|
value: n,
|
|
287
292
|
enumerable: !t,
|
|
288
293
|
configurable: !t,
|
|
289
294
|
writable: !t
|
|
290
|
-
}) : e[r] = n;
|
|
291
|
-
function o(r, n) {
|
|
292
|
-
_regeneratorDefine(e, r, function (e) {
|
|
293
|
-
return this._invoke(r, n, e);
|
|
294
|
-
});
|
|
295
|
-
}
|
|
296
|
-
o("next", 0), o("throw", 1), o("return", 2);
|
|
297
|
-
}
|
|
295
|
+
}) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2));
|
|
298
296
|
}, _regeneratorDefine(e, r, n, t);
|
|
299
297
|
}
|
|
300
298
|
function _slicedToArray(r, e) {
|
|
@@ -2942,7 +2940,7 @@ var exportStageAsImage = /*#__PURE__*/function () {
|
|
|
2942
2940
|
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(resolve, reject) {
|
|
2943
2941
|
var stage, canvas, dataURL, _t;
|
|
2944
2942
|
return _regenerator().w(function (_context2) {
|
|
2945
|
-
while (1) switch (_context2.n) {
|
|
2943
|
+
while (1) switch (_context2.p = _context2.n) {
|
|
2946
2944
|
case 0:
|
|
2947
2945
|
_context2.p = 0;
|
|
2948
2946
|
stage = stageRef === null || stageRef === void 0 ? void 0 : stageRef.current;
|
|
@@ -4277,7 +4275,7 @@ var CanvasImage = function CanvasImage(_ref) {
|
|
|
4277
4275
|
_load = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
4278
4276
|
var res, blob, img, _t;
|
|
4279
4277
|
return _regenerator().w(function (_context) {
|
|
4280
|
-
while (1) switch (_context.n) {
|
|
4278
|
+
while (1) switch (_context.p = _context.n) {
|
|
4281
4279
|
case 0:
|
|
4282
4280
|
_context.p = 0;
|
|
4283
4281
|
setLoading(true);
|
|
@@ -4451,7 +4449,7 @@ var QrElement = function QrElement(_ref) {
|
|
|
4451
4449
|
_loadLogo = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
|
|
4452
4450
|
var res, blob, img, _t;
|
|
4453
4451
|
return _regenerator().w(function (_context2) {
|
|
4454
|
-
while (1) switch (_context2.n) {
|
|
4452
|
+
while (1) switch (_context2.p = _context2.n) {
|
|
4455
4453
|
case 0:
|
|
4456
4454
|
if (element !== null && element !== void 0 && element.qrLogo) {
|
|
4457
4455
|
_context2.n = 1;
|
|
@@ -6422,7 +6420,7 @@ function memoize(fn) {
|
|
|
6422
6420
|
}
|
|
6423
6421
|
|
|
6424
6422
|
// eslint-disable-next-line no-undef
|
|
6425
|
-
var reactPropsRegex = /^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|disableRemotePlayback|download|draggable|encType|enterKeyHint|fetchpriority|fetchPriority|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/; // https://esbench.com/bench/5bfee68a4cd7e6009ef61d23
|
|
6423
|
+
var reactPropsRegex = /^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|disableRemotePlayback|download|draggable|encType|enterKeyHint|fetchpriority|fetchPriority|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|popover|popoverTarget|popoverTargetAction|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/; // https://esbench.com/bench/5bfee68a4cd7e6009ef61d23
|
|
6426
6424
|
|
|
6427
6425
|
var isPropValid = /* #__PURE__ */memoize(function (prop) {
|
|
6428
6426
|
return reactPropsRegex.test(prop) || prop.charCodeAt(0) === 111
|
|
@@ -6550,6 +6548,7 @@ var Studio = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
6550
6548
|
_useState18 = _slicedToArray(_useState17, 2),
|
|
6551
6549
|
elements = _useState18[0],
|
|
6552
6550
|
setElements = _useState18[1];
|
|
6551
|
+
var elementsRef = React.useRef(elements);
|
|
6553
6552
|
var _useState19 = React.useState(1),
|
|
6554
6553
|
_useState20 = _slicedToArray(_useState19, 2),
|
|
6555
6554
|
backgroundImageOpacity = _useState20[0],
|
|
@@ -7261,6 +7260,9 @@ var Studio = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
7261
7260
|
copyElements === null || copyElements === void 0 || copyElements.push(selectedElem);
|
|
7262
7261
|
saveHistory(_toConsumableArray(copyElements));
|
|
7263
7262
|
};
|
|
7263
|
+
console.log({
|
|
7264
|
+
elements: elements
|
|
7265
|
+
});
|
|
7264
7266
|
var createNewTemplate = function createNewTemplate() {
|
|
7265
7267
|
var elems = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [].concat(_toConsumableArray(defaultElements), [{
|
|
7266
7268
|
type: elementTypes.qr,
|
|
@@ -7278,6 +7280,20 @@ var Studio = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
7278
7280
|
opacity: 1,
|
|
7279
7281
|
logoVisible: false
|
|
7280
7282
|
}]);
|
|
7283
|
+
var prevElements = elementsRef.current;
|
|
7284
|
+
var prevQrIdText = prevElements.find(function (element) {
|
|
7285
|
+
return element.id === QRID_ELEMENT_ID;
|
|
7286
|
+
});
|
|
7287
|
+
var newQrIdText = elems.find(function (element) {
|
|
7288
|
+
return element.id === QRID_ELEMENT_ID;
|
|
7289
|
+
});
|
|
7290
|
+
if (!(newQrIdText !== null && newQrIdText !== void 0 && newQrIdText.id) && prevQrIdText !== null && prevQrIdText !== void 0 && prevQrIdText.id) {
|
|
7291
|
+
var qrIdPill = prevElements.find(function (element) {
|
|
7292
|
+
return element.id === "element-qrid-text-pill";
|
|
7293
|
+
});
|
|
7294
|
+
if (qrIdPill.id) elems.push(qrIdPill);
|
|
7295
|
+
elems.push(prevQrIdText);
|
|
7296
|
+
}
|
|
7281
7297
|
setElements(_toConsumableArray(elems));
|
|
7282
7298
|
setHistory([]);
|
|
7283
7299
|
setRedoStack([]);
|
|
@@ -7290,6 +7306,9 @@ var Studio = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
7290
7306
|
onTemplateSelect(null);
|
|
7291
7307
|
}
|
|
7292
7308
|
};
|
|
7309
|
+
React.useEffect(function () {
|
|
7310
|
+
elementsRef.current = elements;
|
|
7311
|
+
}, [elements]);
|
|
7293
7312
|
var sendSelectedElementToBack = function sendSelectedElementToBack() {
|
|
7294
7313
|
var copyElements = _toConsumableArray(elements);
|
|
7295
7314
|
var index = copyElements === null || copyElements === void 0 ? void 0 : copyElements.findIndex(function (elem) {
|
|
@@ -7461,7 +7480,7 @@ var Studio = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
7461
7480
|
var _ref6 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
|
|
7462
7481
|
var file, result, imageUrl, reader, _t;
|
|
7463
7482
|
return _regenerator().w(function (_context2) {
|
|
7464
|
-
while (1) switch (_context2.n) {
|
|
7483
|
+
while (1) switch (_context2.p = _context2.n) {
|
|
7465
7484
|
case 0:
|
|
7466
7485
|
_context2.n = 1;
|
|
7467
7486
|
return pickImage();
|