@masters-union/union-stack 0.3.17 → 0.4.1
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 +1 -1
- package/dist/cdn/loader.v1.global.js +45 -3
- package/dist/cdn/loader.v1.global.js.map +1 -1
- package/dist/{chunk-QQFNG3ZF.js → chunk-3BQ6RNXE.js} +4 -4
- package/dist/chunk-3BQ6RNXE.js.map +1 -0
- package/dist/{chunk-RYS4MXXL.js → chunk-JAO2DEL3.js} +3 -3
- package/dist/{chunk-RYS4MXXL.js.map → chunk-JAO2DEL3.js.map} +1 -1
- package/dist/{chunk-PVM2ZX45.cjs → chunk-ULC3GQ5J.cjs} +3 -3
- package/dist/{chunk-PVM2ZX45.cjs.map → chunk-ULC3GQ5J.cjs.map} +1 -1
- package/dist/{chunk-4645KBSE.cjs → chunk-Z7JOL2OE.cjs} +5 -5
- package/dist/chunk-Z7JOL2OE.cjs.map +1 -0
- package/dist/index.cjs +4 -4
- package/dist/index.js +3 -3
- package/dist/node.cjs +4 -4
- package/dist/node.cjs.map +1 -1
- package/dist/node.js +2 -2
- package/dist/node.js.map +1 -1
- package/dist/picker.cjs +108 -3
- package/dist/picker.cjs.map +1 -1
- package/dist/picker.d.cts +1 -0
- package/dist/picker.d.ts +1 -0
- package/dist/picker.js +108 -3
- package/dist/picker.js.map +1 -1
- package/dist/react.cjs +3 -3
- package/dist/react.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-4645KBSE.cjs.map +0 -1
- package/dist/chunk-QQFNG3ZF.js.map +0 -1
package/dist/picker.d.cts
CHANGED
package/dist/picker.d.ts
CHANGED
package/dist/picker.js
CHANGED
|
@@ -450,14 +450,56 @@ var BASE_CSS = `
|
|
|
450
450
|
width: 28px; height: 28px;
|
|
451
451
|
display: inline-flex; align-items: center; justify-content: center;
|
|
452
452
|
color: var(--us-muted); border-radius: 6px;
|
|
453
|
-
transition: color 100ms, background 0ms;
|
|
453
|
+
transition: color 100ms, background 0ms, transform 90ms ease;
|
|
454
454
|
}
|
|
455
455
|
.us-file-action:hover { background: var(--us-overlay); color: var(--us-fg); }
|
|
456
456
|
.us-file-action:focus-visible { outline: 2px solid var(--us-primary); outline-offset: 1px; }
|
|
457
|
+
.us-file-action:active { transform: scale(0.92); }
|
|
457
458
|
.us-file-action svg { width: 15px; height: 15px; }
|
|
458
459
|
.us-file-action[data-edited="true"] { color: var(--us-accent); }
|
|
459
460
|
.us-file:not([data-state="queued"]) .us-file-action { display: none; }
|
|
460
461
|
|
|
462
|
+
/* \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 per-row remove button \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
463
|
+
/* Destructive affordance \u2014 reads as danger on hover, not before. */
|
|
464
|
+
.us-file-remove:hover {
|
|
465
|
+
color: var(--us-danger);
|
|
466
|
+
background: color-mix(in srgb, var(--us-danger) 12%, transparent);
|
|
467
|
+
}
|
|
468
|
+
/* Rows that failed validation at selection time keep their remove button so
|
|
469
|
+
the user can clear them (the generic rule above hides non-queued actions). */
|
|
470
|
+
.us-file[data-state="failed"] .us-file-remove { display: inline-flex; }
|
|
471
|
+
/* Once upload starts the batch is locked \u2014 no row removal anywhere. */
|
|
472
|
+
.us-picker[data-uploading="true"] .us-file-remove { display: none; }
|
|
473
|
+
|
|
474
|
+
/* Row exit: content slips up and fades (130ms), then the emptied slot
|
|
475
|
+
collapses (190ms, same spring-out curve as the entrance) so neighbors
|
|
476
|
+
glide into place instead of snapping. Total \u2248240ms \u2014 faster than the
|
|
477
|
+
280ms entrance, per exit-faster-than-enter. */
|
|
478
|
+
.us-file[data-removing="true"] {
|
|
479
|
+
animation: none;
|
|
480
|
+
pointer-events: none;
|
|
481
|
+
opacity: 0;
|
|
482
|
+
transform: translateY(-4px) scale(0.98);
|
|
483
|
+
height: 0 !important;
|
|
484
|
+
min-height: 0 !important;
|
|
485
|
+
padding-top: 0 !important;
|
|
486
|
+
padding-bottom: 0 !important;
|
|
487
|
+
border-top-width: 0 !important;
|
|
488
|
+
border-bottom-width: 0 !important;
|
|
489
|
+
overflow: hidden;
|
|
490
|
+
transition:
|
|
491
|
+
opacity 130ms cubic-bezier(0.4, 0, 1, 1),
|
|
492
|
+
transform 130ms cubic-bezier(0.4, 0, 1, 1),
|
|
493
|
+
height 190ms cubic-bezier(0.16, 1, 0.3, 1) 50ms,
|
|
494
|
+
padding 190ms cubic-bezier(0.16, 1, 0.3, 1) 50ms,
|
|
495
|
+
margin 190ms cubic-bezier(0.16, 1, 0.3, 1) 50ms,
|
|
496
|
+
border-width 190ms cubic-bezier(0.16, 1, 0.3, 1) 50ms;
|
|
497
|
+
}
|
|
498
|
+
/* Absorb the flex gap the row leaves behind so the list height lands exactly
|
|
499
|
+
where it will be once the node is detached \u2014 no end-of-animation snap. */
|
|
500
|
+
.us-file[data-removing="true"]:not(:last-child) { margin-bottom: -8px !important; }
|
|
501
|
+
.us-file[data-removing="true"]:last-child:not(:only-child) { margin-top: -8px !important; }
|
|
502
|
+
|
|
461
503
|
/* \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 image editor overlay \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
462
504
|
.us-editor {
|
|
463
505
|
position: absolute; inset: 0; z-index: 2;
|
|
@@ -1251,7 +1293,7 @@ function mergeConfig(server, runtime) {
|
|
|
1251
1293
|
return merged;
|
|
1252
1294
|
}
|
|
1253
1295
|
var DEFAULT_TITLE = "Upload files";
|
|
1254
|
-
var FOOTER_LINK = "https://unionstack.
|
|
1296
|
+
var FOOTER_LINK = "https://unionstack.in";
|
|
1255
1297
|
var ICON2 = {
|
|
1256
1298
|
upload: `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="17 8 12 3 7 8"/><line x1="12" y1="3" x2="12" y2="15"/></svg>`,
|
|
1257
1299
|
fileUp: `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><polyline points="14 2 14 8 20 8"/><path d="M12 18v-6"/><path d="m9 15 3-3 3 3"/></svg>`,
|
|
@@ -1269,7 +1311,8 @@ var ICON2 = {
|
|
|
1269
1311
|
zap: `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"/></svg>`,
|
|
1270
1312
|
device: `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="3" width="20" height="14" rx="2"/><line x1="8" y1="21" x2="16" y2="21"/><line x1="12" y1="17" x2="12" y2="21"/></svg>`,
|
|
1271
1313
|
link: `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.72"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.72-1.72"/></svg>`,
|
|
1272
|
-
pencil: `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"><path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/><path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"/></svg
|
|
1314
|
+
pencil: `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"><path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/><path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"/></svg>`,
|
|
1315
|
+
trash: `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"><path d="M3 6h18"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"/><path d="M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/><line x1="10" y1="11" x2="10" y2="17"/><line x1="14" y1="11" x2="14" y2="17"/></svg>`
|
|
1273
1316
|
};
|
|
1274
1317
|
function iconForMime(mime) {
|
|
1275
1318
|
if (!mime) return ICON2.file;
|
|
@@ -1799,6 +1842,16 @@ var Picker = class {
|
|
|
1799
1842
|
row.appendChild(edit);
|
|
1800
1843
|
item.$edit = edit;
|
|
1801
1844
|
}
|
|
1845
|
+
if (item.state === "queued" || item.state === "failed") {
|
|
1846
|
+
const remove = document.createElement("button");
|
|
1847
|
+
remove.type = "button";
|
|
1848
|
+
remove.className = "us-file-action us-file-remove";
|
|
1849
|
+
remove.setAttribute("aria-label", `Remove ${item.file.name}`);
|
|
1850
|
+
remove.title = "Remove file";
|
|
1851
|
+
remove.innerHTML = ICON2.trash;
|
|
1852
|
+
remove.onclick = () => this.removeItem(item);
|
|
1853
|
+
row.appendChild(remove);
|
|
1854
|
+
}
|
|
1802
1855
|
const status = el2("div", "us-file-status");
|
|
1803
1856
|
status.setAttribute("aria-label", this.statusLabel(item));
|
|
1804
1857
|
status.innerHTML = this.statusIcon(item.state);
|
|
@@ -1844,6 +1897,57 @@ var Picker = class {
|
|
|
1844
1897
|
}
|
|
1845
1898
|
if (item.$edit) item.$edit.dataset.edited = edited ? "true" : "false";
|
|
1846
1899
|
}
|
|
1900
|
+
// Drop a file from the batch before upload starts. The row animates out
|
|
1901
|
+
// (content fades, then the slot collapses so neighbors glide up) unless the
|
|
1902
|
+
// user prefers reduced motion. State is pruned synchronously — only the DOM
|
|
1903
|
+
// exit is deferred.
|
|
1904
|
+
removeItem(item) {
|
|
1905
|
+
if (this.uploadStarted) return;
|
|
1906
|
+
const idx = this.items.indexOf(item);
|
|
1907
|
+
if (idx === -1) return;
|
|
1908
|
+
this.items.splice(idx, 1);
|
|
1909
|
+
item.validateSeq = ++this.validateSeqCounter;
|
|
1910
|
+
item.validating = false;
|
|
1911
|
+
if (item.objectUrl) {
|
|
1912
|
+
URL.revokeObjectURL(item.objectUrl);
|
|
1913
|
+
item.objectUrl = void 0;
|
|
1914
|
+
}
|
|
1915
|
+
const row = item.$row;
|
|
1916
|
+
item.$row = void 0;
|
|
1917
|
+
if (row) {
|
|
1918
|
+
if (row.contains(document.activeElement)) {
|
|
1919
|
+
const rows = Array.from(
|
|
1920
|
+
this.$list?.querySelectorAll(".us-file:not([data-removing])") ?? []
|
|
1921
|
+
);
|
|
1922
|
+
const pos = rows.indexOf(row);
|
|
1923
|
+
const neighbor = rows[pos + 1] ?? rows[pos - 1];
|
|
1924
|
+
const target = neighbor?.querySelector(".us-file-remove") ?? this.$panel?.querySelector('.us-source-tab[data-active="true"]') ?? this.$panel;
|
|
1925
|
+
target?.focus();
|
|
1926
|
+
}
|
|
1927
|
+
const reduceMotion = typeof matchMedia === "function" && matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
1928
|
+
if (reduceMotion) {
|
|
1929
|
+
row.remove();
|
|
1930
|
+
} else {
|
|
1931
|
+
row.style.height = `${row.offsetHeight}px`;
|
|
1932
|
+
void row.offsetHeight;
|
|
1933
|
+
row.dataset.removing = "true";
|
|
1934
|
+
let removed = false;
|
|
1935
|
+
const finalize = () => {
|
|
1936
|
+
if (!removed) {
|
|
1937
|
+
removed = true;
|
|
1938
|
+
row.remove();
|
|
1939
|
+
}
|
|
1940
|
+
};
|
|
1941
|
+
row.addEventListener("transitionend", (e) => {
|
|
1942
|
+
if (e.target === row && e.propertyName === "height") finalize();
|
|
1943
|
+
});
|
|
1944
|
+
setTimeout(finalize, 400);
|
|
1945
|
+
}
|
|
1946
|
+
}
|
|
1947
|
+
this.updateSummary();
|
|
1948
|
+
this.refreshConfirm();
|
|
1949
|
+
this.maybeAutoUpload();
|
|
1950
|
+
}
|
|
1847
1951
|
// Mount the image editor overlay on top of the picker panel for the given
|
|
1848
1952
|
// queued item. The editor calls back with either an edited File (Apply) or
|
|
1849
1953
|
// nothing (Cancel/Back).
|
|
@@ -2063,6 +2167,7 @@ var Picker = class {
|
|
|
2063
2167
|
const queued = this.items.filter((i) => i.state === "queued");
|
|
2064
2168
|
if (queued.length === 0) return;
|
|
2065
2169
|
this.uploadStarted = true;
|
|
2170
|
+
this.$panel?.setAttribute("data-uploading", "true");
|
|
2066
2171
|
if (this.$confirm) {
|
|
2067
2172
|
this.$confirm.disabled = true;
|
|
2068
2173
|
this.$confirm.textContent = "Uploading\u2026";
|