Repository navigation
Commit 5b0200b
committed
feat(image): printer-storage UI for ~DY+^XG upload/recall
Makes the ~DY+^XG feature from PR #84 usable for new images in the
designer — until now it only kicked in when importing existing labels
that already used the upload+recall pattern.
Properties-panel section at the end of the image properties, with a
consistent 'Printer storage' header (info icon, border-t separator)
visible in both states:
- Off-state: 'Activate' button. Toggling on sets storedAs to
{ device: 'R', name: 'IMG_xxxx' } with an auto-generated 4-char UUID.
- On-state: device dropdown (R/E/B/A as plain letters), name input
(max 8 chars, auto-uppercase, [A-Z0-9_] filter, empty-guard against
broken ZPL), path preview, 'Ship bytes' checkbox + hint (decouples
upload from recall: off = ^XG only, on = ~DY+^XG), 'Embed inline'
button as the toggle-off.
Parser extension: ^XG without a preceding ~DY is now a valid import
(recall-only). Creates an image object with storedAs.embedInZpl=false
and no cached bytes; surfaced as a partial finding so the import
report flags the degraded preview.
Cache deletion: trash button next to the image-source dropdown opens
a ConfirmDialog (destructive, autoFocus on Cancel) explaining that
the bytes vanish for ALL labels referencing this image. Previously
only the image *object* could be removed (Del key), not the cached
bytes — so old uploads accumulated in localStorage with no UI to
clean them up.
Canvas resize via handles: the image registry had no commitTransform,
so Konva applied sx/sy as a visual scale but nothing translated that
back into widthDots — the only way to resize was the properties
panel. Now: cached PNG = aspect-locked via the dominant-axis drag
(Math.abs heuristic so all 8 handles work for both grow and shrink);
no cache (placeholder) = free-form via heightDots so the user can
shape the box as a layout placeholder.
Empty source selection: handleImageSelect bailed early on an empty
imageId, leaving the 'Select image…' placeholder option functionally
dead. Now it clears imageId + _gfaCache, which is the right answer
for recall-only setups where the user wants a storedAs path without
local preview bytes.
Canvas placeholder: 🖼 emoji replaced by a Konva.Path rendering the
Heroicons 'photo' outline. The emoji rendered inconsistently across
OSes (color on macOS, monochrome on Linux, missing on some Windows
configurations); the vector path is deterministic.
Shared infrastructure that fell out of the work:
- src/lib/storagePath.ts extended with STORAGE_DEVICES, StorageDevice,
MAX_STORAGE_NAME_LEN, STORAGE_NAME_FILTER_RE, defaultStorageName —
all storage-path concepts living in one canonical place so the
parser, emitter, and image registry stay in lockstep.
- src/components/Properties/styles.ts: new buttonCls for secondary-
action buttons (Upload, toggle, Embed inline), eliminating the
four-times-repeated Tailwind string across image.tsx and text.tsx.
ZPL codes (^XG, ~DY) are kept to tooltips only, never in user-visible
labels. New locale keys (storage, storeOnPrinter, storeOnPrinterHint,
storeInline, embedInZpl, embedInZplHint, removeFromCache,
removeFromCacheConfirm) cover all 32 locales.1 parent 3e9a321 commit 5b0200b
41 files changed
Lines changed: 597 additions & 67 deletions
File tree
- src
- components
- Canvas
- Properties
- lib
- locales
- registry
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
| 1 | + | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
33 | | - | |
34 | | - | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
35 | 36 | | |
36 | 37 | | |
37 | | - | |
| 38 | + | |
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
| |||
120 | 121 | | |
121 | 122 | | |
122 | 123 | | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
| 124 | + | |
130 | 125 | | |
131 | 126 | | |
132 | 127 | | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
11 | 32 | | |
12 | 33 | | |
13 | 34 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
| |||
573 | 574 | | |
574 | 575 | | |
575 | 576 | | |
576 | | - | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
577 | 591 | | |
578 | | - | |
| 592 | + | |
579 | 593 | | |
580 | 594 | | |
581 | | - | |
582 | | - | |
583 | | - | |
584 | | - | |
585 | | - | |
586 | | - | |
587 | | - | |
588 | | - | |
589 | | - | |
590 | | - | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
591 | 598 | | |
592 | 599 | | |
593 | 600 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
116 | 120 | | |
117 | 121 | | |
118 | 122 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
676 | 676 | | |
677 | 677 | | |
678 | 678 | | |
679 | | - | |
| 679 | + | |
680 | 680 | | |
681 | 681 | | |
682 | 682 | | |
| |||
690 | 690 | | |
691 | 691 | | |
692 | 692 | | |
693 | | - | |
| 693 | + | |
694 | 694 | | |
695 | 695 | | |
696 | 696 | | |
697 | | - | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
698 | 702 | | |
699 | 703 | | |
700 | | - | |
701 | | - | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
702 | 709 | | |
703 | 710 | | |
704 | 711 | | |
| |||
709 | 716 | | |
710 | 717 | | |
711 | 718 | | |
712 | | - | |
| 719 | + | |
713 | 720 | | |
714 | 721 | | |
715 | 722 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1468 | 1468 | | |
1469 | 1469 | | |
1470 | 1470 | | |
1471 | | - | |
1472 | | - | |
1473 | | - | |
| 1471 | + | |
| 1472 | + | |
| 1473 | + | |
| 1474 | + | |
| 1475 | + | |
| 1476 | + | |
| 1477 | + | |
1474 | 1478 | | |
1475 | 1479 | | |
1476 | | - | |
1477 | | - | |
1478 | | - | |
1479 | | - | |
1480 | | - | |
1481 | | - | |
1482 | | - | |
1483 | | - | |
1484 | 1480 | | |
1485 | 1481 | | |
1486 | | - | |
| 1482 | + | |
| 1483 | + | |
1487 | 1484 | | |
1488 | 1485 | | |
1489 | 1486 | | |
1490 | | - | |
1491 | | - | |
| 1487 | + | |
| 1488 | + | |
| 1489 | + | |
| 1490 | + | |
| 1491 | + | |
| 1492 | + | |
| 1493 | + | |
| 1494 | + | |
| 1495 | + | |
| 1496 | + | |
| 1497 | + | |
| 1498 | + | |
| 1499 | + | |
| 1500 | + | |
| 1501 | + | |
| 1502 | + | |
| 1503 | + | |
| 1504 | + | |
1492 | 1505 | | |
1493 | 1506 | | |
1494 | | - | |
| 1507 | + | |
| 1508 | + | |
| 1509 | + | |
| 1510 | + | |
1495 | 1511 | | |
1496 | 1512 | | |
1497 | 1513 | | |
1498 | 1514 | | |
1499 | 1515 | | |
1500 | 1516 | | |
1501 | | - | |
1502 | | - | |
| 1517 | + | |
| 1518 | + | |
1503 | 1519 | | |
1504 | | - | |
1505 | | - | |
| 1520 | + | |
1506 | 1521 | | |
1507 | 1522 | | |
1508 | 1523 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
295 | 295 | | |
296 | 296 | | |
297 | 297 | | |
| 298 | + | |
| 299 | + | |
298 | 300 | | |
299 | 301 | | |
300 | 302 | | |
301 | 303 | | |
302 | 304 | | |
303 | 305 | | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
304 | 312 | | |
305 | 313 | | |
306 | 314 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
295 | 295 | | |
296 | 296 | | |
297 | 297 | | |
| 298 | + | |
| 299 | + | |
298 | 300 | | |
299 | 301 | | |
300 | 302 | | |
301 | 303 | | |
302 | 304 | | |
303 | 305 | | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
304 | 312 | | |
305 | 313 | | |
306 | 314 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
295 | 295 | | |
296 | 296 | | |
297 | 297 | | |
| 298 | + | |
| 299 | + | |
298 | 300 | | |
299 | 301 | | |
300 | 302 | | |
301 | 303 | | |
302 | 304 | | |
303 | 305 | | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
304 | 312 | | |
305 | 313 | | |
306 | 314 | | |
| |||
0 commit comments