labellife-design-tool 2.5.8 → 2.7.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.
- package/README.md +42 -0
- package/dist/cjs/canvas/workspace.js +202 -5
- package/dist/cjs/canvas/workspace.js.map +1 -1
- package/dist/cjs/config.js +215 -0
- package/dist/cjs/config.js.map +1 -1
- package/dist/cjs/index.js +884 -11
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/model/store.js +854 -7
- package/dist/cjs/model/store.js.map +1 -1
- package/dist/cjs/side-panel/index.js +173 -0
- package/dist/cjs/side-panel/index.js.map +1 -1
- package/dist/cjs/side-panel/side-panel.js +173 -0
- package/dist/cjs/side-panel/side-panel.js.map +1 -1
- package/dist/cjs/toolbar/toolbar.js +173 -0
- package/dist/cjs/toolbar/toolbar.js.map +1 -1
- package/dist/esm/canvas/workspace.js +202 -5
- package/dist/esm/canvas/workspace.js.map +1 -1
- package/dist/esm/config.js +214 -1
- package/dist/esm/config.js.map +1 -1
- package/dist/esm/index.js +883 -12
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/model/store.js +854 -7
- package/dist/esm/model/store.js.map +1 -1
- package/dist/esm/side-panel/index.js +173 -0
- package/dist/esm/side-panel/index.js.map +1 -1
- package/dist/esm/side-panel/side-panel.js +173 -0
- package/dist/esm/side-panel/side-panel.js.map +1 -1
- package/dist/esm/toolbar/toolbar.js +173 -0
- package/dist/esm/toolbar/toolbar.js.map +1 -1
- package/package.json +2 -2
|
@@ -392,6 +392,179 @@ function t(key, defaultValue) {
|
|
|
392
392
|
return defaultValue || key;
|
|
393
393
|
}
|
|
394
394
|
|
|
395
|
+
function clip(text, max) {
|
|
396
|
+
var s = String(text == null ? '' : text);
|
|
397
|
+
return s.length > max ? "".concat(s.slice(0, max), "\u2026") : s;
|
|
398
|
+
}
|
|
399
|
+
function imageSource(src) {
|
|
400
|
+
var s = String(src || '');
|
|
401
|
+
if (s.startsWith('data:') || s.startsWith('blob:')) return 'uploaded';
|
|
402
|
+
if (s.toLowerCase().includes('unsplash')) return 'stock photo';
|
|
403
|
+
return '';
|
|
404
|
+
}
|
|
405
|
+
var _short = function _short(v) {
|
|
406
|
+
var s = String(v == null ? '' : v);
|
|
407
|
+
return "".concat(s.length, ":").concat(s.slice(0, 40));
|
|
408
|
+
};
|
|
409
|
+
var isLocked = function isLocked(el) {
|
|
410
|
+
return el.draggable === false && el.resizable === false && el.contentEditable === false && el.styleEditable === false;
|
|
411
|
+
};
|
|
412
|
+
var quotedText = function quotedText(el, n, opts) {
|
|
413
|
+
return opts.includeTextContent && el.text ? "\"".concat(clip(el.text, opts.maxTextLength), "\"") : n;
|
|
414
|
+
};
|
|
415
|
+
|
|
416
|
+
// One row per property group: how to read its value, and how to word the change.
|
|
417
|
+
// A new property is one new row. `render(ctx)` returns (from, to) => sentence so a
|
|
418
|
+
// merged entry can be re-worded with its first `from` and last `to`.
|
|
419
|
+
var ROWS = [{
|
|
420
|
+
key: 'text',
|
|
421
|
+
props: ['text'],
|
|
422
|
+
render: function render(_ref8) {
|
|
423
|
+
var opts = _ref8.opts;
|
|
424
|
+
return function (f, t) {
|
|
425
|
+
return opts.includeTextContent ? "Changed the text \"".concat(clip(f, opts.maxTextLength), "\" to \"").concat(clip(t, opts.maxTextLength), "\".") : 'Changed the text.';
|
|
426
|
+
};
|
|
427
|
+
}
|
|
428
|
+
}, {
|
|
429
|
+
key: 'fontFamily',
|
|
430
|
+
props: ['fontFamily'],
|
|
431
|
+
render: function render(_ref9) {
|
|
432
|
+
var n = _ref9.n;
|
|
433
|
+
return function (f, t) {
|
|
434
|
+
return "Changed the font of ".concat(n, " to ").concat(t, ".");
|
|
435
|
+
};
|
|
436
|
+
}
|
|
437
|
+
}, {
|
|
438
|
+
key: 'fontSize',
|
|
439
|
+
props: ['fontSize'],
|
|
440
|
+
render: function render(_ref0) {
|
|
441
|
+
var n = _ref0.n;
|
|
442
|
+
return function (f, t) {
|
|
443
|
+
return "Changed the font size of ".concat(n, " from ").concat(f, " to ").concat(t, ".");
|
|
444
|
+
};
|
|
445
|
+
}
|
|
446
|
+
}, {
|
|
447
|
+
key: 'fill',
|
|
448
|
+
props: ['fill'],
|
|
449
|
+
render: function render(_ref1) {
|
|
450
|
+
var n = _ref1.n;
|
|
451
|
+
return function (f, t) {
|
|
452
|
+
return "Changed the colour of ".concat(n, " to ").concat(t, ".");
|
|
453
|
+
};
|
|
454
|
+
}
|
|
455
|
+
}, {
|
|
456
|
+
key: 'position',
|
|
457
|
+
props: ['x', 'y'],
|
|
458
|
+
render: function render(_ref10) {
|
|
459
|
+
var n = _ref10.n;
|
|
460
|
+
return function () {
|
|
461
|
+
return "Moved ".concat(n, ".");
|
|
462
|
+
};
|
|
463
|
+
}
|
|
464
|
+
}, {
|
|
465
|
+
key: 'size',
|
|
466
|
+
props: ['width', 'height'],
|
|
467
|
+
render: function render(_ref11) {
|
|
468
|
+
var n = _ref11.n;
|
|
469
|
+
return function () {
|
|
470
|
+
return "Resized ".concat(n, ".");
|
|
471
|
+
};
|
|
472
|
+
}
|
|
473
|
+
}, {
|
|
474
|
+
key: 'rotation',
|
|
475
|
+
props: ['rotation'],
|
|
476
|
+
render: function render(_ref12) {
|
|
477
|
+
var n = _ref12.n;
|
|
478
|
+
return function (f, t) {
|
|
479
|
+
return "Rotated ".concat(n, " to ").concat(t, " degrees.");
|
|
480
|
+
};
|
|
481
|
+
}
|
|
482
|
+
}, {
|
|
483
|
+
key: 'visible',
|
|
484
|
+
props: ['visible'],
|
|
485
|
+
render: function render(_ref13) {
|
|
486
|
+
var n = _ref13.n;
|
|
487
|
+
return function (f, t) {
|
|
488
|
+
return t ? "Showed ".concat(n, ".") : "Hid ".concat(n, ".");
|
|
489
|
+
};
|
|
490
|
+
}
|
|
491
|
+
}, {
|
|
492
|
+
key: 'lock',
|
|
493
|
+
props: ['draggable', 'resizable', 'contentEditable', 'styleEditable'],
|
|
494
|
+
value: isLocked,
|
|
495
|
+
render: function render(_ref14) {
|
|
496
|
+
var n = _ref14.n;
|
|
497
|
+
return function (f, t) {
|
|
498
|
+
return t ? "Locked ".concat(n, ".") : "Unlocked ".concat(n, ".");
|
|
499
|
+
};
|
|
500
|
+
}
|
|
501
|
+
}, {
|
|
502
|
+
key: 'crop',
|
|
503
|
+
props: ['cropX', 'cropY', 'cropWidth', 'cropHeight'],
|
|
504
|
+
render: function render(_ref15) {
|
|
505
|
+
var n = _ref15.n;
|
|
506
|
+
return function () {
|
|
507
|
+
return "Cropped ".concat(n, ".");
|
|
508
|
+
};
|
|
509
|
+
}
|
|
510
|
+
}, {
|
|
511
|
+
key: 'clipSrc',
|
|
512
|
+
props: ['clipSrc'],
|
|
513
|
+
render: function render(_ref16) {
|
|
514
|
+
var n = _ref16.n;
|
|
515
|
+
return function (f, t) {
|
|
516
|
+
return t ? "Applied a mask to ".concat(n, ".") : "Removed the mask from ".concat(n, ".");
|
|
517
|
+
};
|
|
518
|
+
}
|
|
519
|
+
}, {
|
|
520
|
+
key: 'curveEnabled',
|
|
521
|
+
props: ['curveEnabled'],
|
|
522
|
+
render: function render(_ref17) {
|
|
523
|
+
var n = _ref17.n,
|
|
524
|
+
next = _ref17.next,
|
|
525
|
+
opts = _ref17.opts;
|
|
526
|
+
return function (f, t) {
|
|
527
|
+
return t ? "Applied curved text to ".concat(quotedText(next, n, opts), ".") : "Removed the curve from ".concat(n, ".");
|
|
528
|
+
};
|
|
529
|
+
}
|
|
530
|
+
}, {
|
|
531
|
+
key: 'shadowEnabled',
|
|
532
|
+
props: ['shadowEnabled'],
|
|
533
|
+
render: function render(_ref18) {
|
|
534
|
+
var n = _ref18.n;
|
|
535
|
+
return function (f, t) {
|
|
536
|
+
return t ? "Added a shadow to ".concat(n, ".") : "Removed the shadow from ".concat(n, ".");
|
|
537
|
+
};
|
|
538
|
+
}
|
|
539
|
+
}, {
|
|
540
|
+
key: 'grayscaleEnabled',
|
|
541
|
+
props: ['grayscaleEnabled'],
|
|
542
|
+
render: function render(_ref19) {
|
|
543
|
+
var n = _ref19.n;
|
|
544
|
+
return function (f, t) {
|
|
545
|
+
return t ? "Made ".concat(n, " grayscale.") : "Removed the grayscale from ".concat(n, ".");
|
|
546
|
+
};
|
|
547
|
+
}
|
|
548
|
+
}, {
|
|
549
|
+
key: 'src',
|
|
550
|
+
props: ['src'],
|
|
551
|
+
value: function value(el) {
|
|
552
|
+
return _short(el.src);
|
|
553
|
+
},
|
|
554
|
+
render: function render(_ref20) {
|
|
555
|
+
var n = _ref20.n,
|
|
556
|
+
next = _ref20.next;
|
|
557
|
+
return function () {
|
|
558
|
+
var source = imageSource(next.src);
|
|
559
|
+
var note = source === 'uploaded' ? ' (uploaded by the user)' : source ? " (".concat(source, ")") : '';
|
|
560
|
+
return "Replaced ".concat(n).concat(note, ".");
|
|
561
|
+
};
|
|
562
|
+
}
|
|
563
|
+
}];
|
|
564
|
+
new Set(['id', 'type', 'custom', 'children'].concat(_toConsumableArray(ROWS.flatMap(function (r) {
|
|
565
|
+
return r.props;
|
|
566
|
+
}))));
|
|
567
|
+
|
|
395
568
|
// ── Input Fields Dialog Config ───────────────────────────────────────
|
|
396
569
|
var INPUT_FIELDS_CONFIG_KEY = '__labellife_input_fields_config__';
|
|
397
570
|
if (typeof window !== 'undefined' && !window[INPUT_FIELDS_CONFIG_KEY]) {
|