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