@singlebase/elements 0.5.0 → 0.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/dist/{authui-display-BCZBP7HR.js → authui-display-BM_F3-5e.js} +426 -436
- package/dist/authui-display-BM_F3-5e.js.map +1 -0
- package/dist/{authui-display-CLGFSqRi.cjs → authui-display-CMVHTNFz.cjs} +45 -65
- package/dist/authui-display-CMVHTNFz.cjs.map +1 -0
- package/dist/authui.cjs +1 -1
- package/dist/authui.js +2 -2
- package/dist/{chat-bXaRWel7.js → chat-BH_3e1jT.js} +2081 -1121
- package/dist/chat-BH_3e1jT.js.map +1 -0
- package/dist/chat-ezUmd9II.cjs +3281 -0
- package/dist/chat-ezUmd9II.cjs.map +1 -0
- package/dist/chat-messages.d.ts +19 -6
- package/dist/chat.cjs +1 -1
- package/dist/chat.d.ts +4 -3
- package/dist/chat.js +8 -6
- package/dist/elements/authui-base.d.ts +2 -0
- package/dist/elements/authui-buttons.d.ts +1 -1
- package/dist/elements/authui-display.d.ts +1 -1
- package/dist/elements/authui.d.ts +1 -1
- package/dist/elements/chat.d.ts +192 -11
- package/dist/elements/uploader.d.ts +8 -0
- package/dist/files-4T62wkwj.cjs +77 -0
- package/dist/files-4T62wkwj.cjs.map +1 -0
- package/dist/{files-BOwtpYyQ.js → files-DS-H-3yN.js} +93 -47
- package/dist/files-DS-H-3yN.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +24 -22
- package/dist/messages.d.ts +0 -2
- package/dist/singlebase-elements.min.js +3838 -2844
- package/dist/singlebase-elements.min.js.map +1 -1
- package/dist/styles/branding.d.ts +5 -0
- package/dist/styles/tokens.d.ts +2 -0
- package/dist/upload-messages.d.ts +0 -1
- package/dist/{uploader-DGV2y9uT.cjs → uploader-COP8PkJ6.cjs} +53 -76
- package/dist/uploader-COP8PkJ6.cjs.map +1 -0
- package/dist/{uploader-abQoem5q.js → uploader-tdMU9Gxv.js} +249 -253
- package/dist/uploader-tdMU9Gxv.js.map +1 -0
- package/dist/uploader.cjs +1 -1
- package/dist/uploader.js +2 -2
- package/dist/utils/branding.d.ts +8 -0
- package/dist/utils/markdown.d.ts +69 -12
- package/dist/utils/svg.d.ts +10 -0
- package/package.json +3 -3
- package/dist/authui-display-BCZBP7HR.js.map +0 -1
- package/dist/authui-display-CLGFSqRi.cjs.map +0 -1
- package/dist/chat-DRenTJlI.cjs +0 -3001
- package/dist/chat-DRenTJlI.cjs.map +0 -1
- package/dist/chat-bXaRWel7.js.map +0 -1
- package/dist/files-BOwtpYyQ.js.map +0 -1
- package/dist/files-DW8A4Jl-.cjs +0 -38
- package/dist/files-DW8A4Jl-.cjs.map +0 -1
- package/dist/uploader-DGV2y9uT.cjs.map +0 -1
- package/dist/uploader-abQoem5q.js.map +0 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
var
|
|
1
|
+
var fe = (r) => {
|
|
2
2
|
throw TypeError(r);
|
|
3
3
|
};
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
import { css as
|
|
7
|
-
import { property as b, state as
|
|
8
|
-
import { getDefaultClient as
|
|
9
|
-
import { t as
|
|
10
|
-
const
|
|
4
|
+
var be = (r, e, t) => e.has(r) || fe("Cannot " + t);
|
|
5
|
+
var l = (r, e, t) => (be(r, e, "read from private field"), t ? t.call(r) : e.get(r)), d = (r, e, t) => e.has(r) ? fe("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(r) : e.set(r, t), c = (r, e, t, i) => (be(r, e, "write to private field"), i ? i.call(r, t) : e.set(r, t), t);
|
|
6
|
+
import { css as xe, LitElement as Ue, nothing as x, html as u } from "lit";
|
|
7
|
+
import { property as b, state as Q, customElement as Se } from "lit/decorators.js";
|
|
8
|
+
import { getDefaultClient as Me } from "@singlebase/core";
|
|
9
|
+
import { t as Ce, b as je, r as Fe, f as oe, a as v, c as Oe, p as ne, e as te, g as De, h as Ee, i as Le, j as Te, k as Ae } from "./files-DS-H-3yN.js";
|
|
10
|
+
const Ne = xe`
|
|
11
11
|
/* ── layout primitives ───────────────────────────────────── */
|
|
12
12
|
.stack {
|
|
13
13
|
display: flex;
|
|
@@ -131,7 +131,7 @@ const Le = me`
|
|
|
131
131
|
color: var(--sb-ink, #16181a);
|
|
132
132
|
background: var(--sb-surface-alt, #fafafa);
|
|
133
133
|
border: 1px solid var(--sb-border, #e4e6e9);
|
|
134
|
-
border-radius: var(--sb-radius, 4px);
|
|
134
|
+
border-radius: calc(var(--sb-radius, 4px) * var(--sb-radius-scale, 1));
|
|
135
135
|
padding: var(--sb-field-pad, 11px 13px);
|
|
136
136
|
outline: none;
|
|
137
137
|
}
|
|
@@ -201,7 +201,7 @@ const Le = me`
|
|
|
201
201
|
font: inherit;
|
|
202
202
|
font-size: 13.5px;
|
|
203
203
|
font-weight: 500;
|
|
204
|
-
border-radius: var(--sb-radius, 4px);
|
|
204
|
+
border-radius: calc(var(--sb-radius, 4px) * var(--sb-radius-scale, 1));
|
|
205
205
|
cursor: pointer;
|
|
206
206
|
padding: 9px 14px;
|
|
207
207
|
border: 1px solid transparent;
|
|
@@ -377,7 +377,7 @@ const Le = me`
|
|
|
377
377
|
.notice {
|
|
378
378
|
font-size: 13px;
|
|
379
379
|
line-height: 1.45;
|
|
380
|
-
border-radius: var(--sb-radius, 4px);
|
|
380
|
+
border-radius: calc(var(--sb-radius, 4px) * var(--sb-radius-scale, 1));
|
|
381
381
|
padding: 10px 12px;
|
|
382
382
|
}
|
|
383
383
|
|
|
@@ -495,7 +495,7 @@ const Le = me`
|
|
|
495
495
|
|
|
496
496
|
.acc-item {
|
|
497
497
|
border: 1px solid var(--sb-border, #e4e6e9);
|
|
498
|
-
border-radius: var(--sb-radius, 4px);
|
|
498
|
+
border-radius: calc(var(--sb-radius, 4px) * var(--sb-radius-scale, 1));
|
|
499
499
|
overflow: hidden;
|
|
500
500
|
background: transparent;
|
|
501
501
|
transition:
|
|
@@ -610,7 +610,7 @@ const Le = me`
|
|
|
610
610
|
padding: 10px 12px;
|
|
611
611
|
background: var(--sb-surface-alt, #fafafa);
|
|
612
612
|
border: 1px solid var(--sb-border, #e4e6e9);
|
|
613
|
-
border-radius: var(--sb-radius, 4px);
|
|
613
|
+
border-radius: calc(var(--sb-radius, 4px) * var(--sb-radius-scale, 1));
|
|
614
614
|
}
|
|
615
615
|
|
|
616
616
|
.invite-label {
|
|
@@ -777,7 +777,7 @@ const Le = me`
|
|
|
777
777
|
padding: 14px;
|
|
778
778
|
background: var(--sb-surface-alt, #fafafa);
|
|
779
779
|
border: 1px solid var(--sb-border, #e4e6e9);
|
|
780
|
-
border-radius: var(--sb-radius, 4px);
|
|
780
|
+
border-radius: calc(var(--sb-radius, 4px) * var(--sb-radius-scale, 1));
|
|
781
781
|
}
|
|
782
782
|
|
|
783
783
|
/* 2FA switch */
|
|
@@ -826,7 +826,7 @@ const Le = me`
|
|
|
826
826
|
flex: 0 0 auto;
|
|
827
827
|
width: 74px;
|
|
828
828
|
height: 74px;
|
|
829
|
-
border-radius: var(--sb-radius, 4px);
|
|
829
|
+
border-radius: calc(var(--sb-radius, 4px) * var(--sb-radius-scale, 1));
|
|
830
830
|
background: var(--sb-surface-alt, #fafafa);
|
|
831
831
|
border: 1px dashed var(--sb-border-strong, #cdd1d6);
|
|
832
832
|
display: flex;
|
|
@@ -858,7 +858,7 @@ const Le = me`
|
|
|
858
858
|
gap: 12px;
|
|
859
859
|
padding: 10px 12px;
|
|
860
860
|
border: 1px solid var(--sb-border, #e4e6e9);
|
|
861
|
-
border-radius: var(--sb-radius, 4px);
|
|
861
|
+
border-radius: calc(var(--sb-radius, 4px) * var(--sb-radius-scale, 1));
|
|
862
862
|
background: var(--sb-surface-alt, #fafafa);
|
|
863
863
|
}
|
|
864
864
|
|
|
@@ -922,7 +922,7 @@ const Le = me`
|
|
|
922
922
|
font: inherit;
|
|
923
923
|
text-align: left;
|
|
924
924
|
padding: 10px 11px;
|
|
925
|
-
border-radius: var(--sb-radius, 4px);
|
|
925
|
+
border-radius: calc(var(--sb-radius, 4px) * var(--sb-radius-scale, 1));
|
|
926
926
|
border: 1px dashed var(--sb-border-strong, #cdd1d6);
|
|
927
927
|
background: transparent;
|
|
928
928
|
cursor: pointer;
|
|
@@ -974,7 +974,7 @@ const Le = me`
|
|
|
974
974
|
gap: 12px;
|
|
975
975
|
padding: 14px;
|
|
976
976
|
border: 1px solid var(--sb-danger-panel-border, #efd9d6);
|
|
977
|
-
border-radius: var(--sb-radius, 4px);
|
|
977
|
+
border-radius: calc(var(--sb-radius, 4px) * var(--sb-radius-scale, 1));
|
|
978
978
|
background: var(--sb-danger-panel-bg, #fdf7f6);
|
|
979
979
|
}
|
|
980
980
|
|
|
@@ -984,7 +984,7 @@ const Le = me`
|
|
|
984
984
|
font-style: italic;
|
|
985
985
|
}
|
|
986
986
|
`;
|
|
987
|
-
function
|
|
987
|
+
function Pe(r, e, t) {
|
|
988
988
|
if (!r || !e) return null;
|
|
989
989
|
let i;
|
|
990
990
|
try {
|
|
@@ -992,32 +992,32 @@ function Te(r, e, t) {
|
|
|
992
992
|
} catch {
|
|
993
993
|
return null;
|
|
994
994
|
}
|
|
995
|
-
let
|
|
995
|
+
let o;
|
|
996
996
|
try {
|
|
997
|
-
|
|
997
|
+
o = new URL(r, i.href);
|
|
998
998
|
} catch {
|
|
999
999
|
return t == null || t(`"${r}" is not a valid URL`), null;
|
|
1000
1000
|
}
|
|
1001
|
-
return
|
|
1001
|
+
return o.protocol !== "http:" && o.protocol !== "https:" ? (t == null || t(`refusing redirect to unsupported scheme "${o.protocol}"`), null) : o.origin !== i.origin ? (t == null || t(`refusing cross-origin redirect to ${o.origin}; same-origin only`), null) : o.href === i.href ? null : o.href;
|
|
1002
1002
|
}
|
|
1003
|
-
const
|
|
1004
|
-
async function
|
|
1003
|
+
const ve = { pages: null, encrypted: null }, ge = 16 * 1024 * 1024, Re = 2 * 1024 * 1024, Be = 40, Ge = 4 * 1024 * 1024, ye = /* @__PURE__ */ new Set(["docx", "pptx", "xlsx"]);
|
|
1004
|
+
async function Ie(r, e) {
|
|
1005
1005
|
try {
|
|
1006
|
-
if (e === "pdf") return await
|
|
1007
|
-
if (
|
|
1006
|
+
if (e === "pdf") return await Ke(r);
|
|
1007
|
+
if (ye.has(e)) return await Ve(r, e);
|
|
1008
1008
|
} catch {
|
|
1009
1009
|
}
|
|
1010
|
-
return
|
|
1010
|
+
return ve;
|
|
1011
1011
|
}
|
|
1012
|
-
function
|
|
1013
|
-
return r === "pdf" ||
|
|
1012
|
+
function _e(r) {
|
|
1013
|
+
return r === "pdf" || ye.has(r);
|
|
1014
1014
|
}
|
|
1015
|
-
async function
|
|
1016
|
-
const e = await
|
|
1017
|
-
let g =
|
|
1018
|
-
return g === null && (g = await
|
|
1015
|
+
async function Ke(r) {
|
|
1016
|
+
const e = await re(r.slice(0, ge)), t = r.size > ge ? await re(r.slice(Math.max(0, r.size - Re))) : null, i = ie(e) + (t ? ie(t) : ""), o = /\/Encrypt[\s/<>\]]/.test(i);
|
|
1017
|
+
let g = we(i);
|
|
1018
|
+
return g === null && (g = await qe(e)), { pages: g, encrypted: o };
|
|
1019
1019
|
}
|
|
1020
|
-
function
|
|
1020
|
+
function we(r) {
|
|
1021
1021
|
if (/\/Type\s*\/Pages/.test(r)) {
|
|
1022
1022
|
let t = 0;
|
|
1023
1023
|
for (const i of r.matchAll(/\/Count\s+(\d+)/g))
|
|
@@ -1027,80 +1027,80 @@ function ye(r) {
|
|
|
1027
1027
|
const e = r.match(/\/Type\s*\/Page[^s]/g);
|
|
1028
1028
|
return e != null && e.length ? e.length : null;
|
|
1029
1029
|
}
|
|
1030
|
-
async function
|
|
1030
|
+
async function qe(r) {
|
|
1031
1031
|
if (typeof DecompressionStream > "u") return null;
|
|
1032
|
-
const e =
|
|
1032
|
+
const e = ie(r);
|
|
1033
1033
|
let t = "", i = 0;
|
|
1034
|
-
for (const
|
|
1035
|
-
if (i >=
|
|
1036
|
-
const g =
|
|
1037
|
-
let
|
|
1038
|
-
if (
|
|
1039
|
-
for (;
|
|
1040
|
-
` || e[
|
|
1034
|
+
for (const o of e.matchAll(/stream\r?\n/g)) {
|
|
1035
|
+
if (i >= Be || t.length >= Ge) break;
|
|
1036
|
+
const g = o.index + o[0].length;
|
|
1037
|
+
let s = e.indexOf("endstream", g);
|
|
1038
|
+
if (s < 0) break;
|
|
1039
|
+
for (; s > g && (e[s - 1] === `
|
|
1040
|
+
` || e[s - 1] === "\r"); ) s -= 1;
|
|
1041
1041
|
i += 1;
|
|
1042
1042
|
try {
|
|
1043
|
-
const a = await
|
|
1044
|
-
t +=
|
|
1043
|
+
const a = await ke(r.subarray(g, s), "deflate");
|
|
1044
|
+
t += ie(a);
|
|
1045
1045
|
} catch {
|
|
1046
1046
|
}
|
|
1047
1047
|
}
|
|
1048
|
-
return t ?
|
|
1048
|
+
return t ? we(t) : null;
|
|
1049
1049
|
}
|
|
1050
|
-
async function
|
|
1051
|
-
const t = await
|
|
1052
|
-
if (
|
|
1053
|
-
if (t[0] !== 80 || t[1] !== 75) return
|
|
1054
|
-
const i = await
|
|
1050
|
+
async function Ve(r, e) {
|
|
1051
|
+
const t = await re(r.slice(0, 8));
|
|
1052
|
+
if (Ye(t)) return { pages: null, encrypted: !0 };
|
|
1053
|
+
if (t[0] !== 80 || t[1] !== 75) return ve;
|
|
1054
|
+
const i = await He(r, "docProps/app.xml");
|
|
1055
1055
|
if (!i) return { pages: null, encrypted: !1 };
|
|
1056
|
-
const
|
|
1056
|
+
const o = e === "pptx" ? "Slides" : "Pages", g = new TextDecoder().decode(i).match(new RegExp(`<${o}>(\\d+)</${o}>`));
|
|
1057
1057
|
return { pages: g ? Number(g[1]) : null, encrypted: !1 };
|
|
1058
1058
|
}
|
|
1059
|
-
function
|
|
1059
|
+
function Ye(r) {
|
|
1060
1060
|
return [208, 207, 17, 224, 161, 177, 26, 225].every((t, i) => r[i] === t);
|
|
1061
1061
|
}
|
|
1062
|
-
async function
|
|
1062
|
+
async function He(r, e) {
|
|
1063
1063
|
const t = Math.min(r.size, 66e3), i = new DataView(await r.slice(r.size - t).arrayBuffer());
|
|
1064
|
-
let
|
|
1064
|
+
let o = -1;
|
|
1065
1065
|
for (let h = i.byteLength - 22; h >= 0; h--)
|
|
1066
1066
|
if (i.getUint32(h, !0) === 101010256) {
|
|
1067
|
-
|
|
1067
|
+
o = h;
|
|
1068
1068
|
break;
|
|
1069
1069
|
}
|
|
1070
|
-
if (
|
|
1071
|
-
const g = i.getUint32(
|
|
1072
|
-
if (!g ||
|
|
1073
|
-
const a = new DataView(await r.slice(
|
|
1070
|
+
if (o < 0) return null;
|
|
1071
|
+
const g = i.getUint32(o + 12, !0), s = i.getUint32(o + 16, !0);
|
|
1072
|
+
if (!g || s === 4294967295) return null;
|
|
1073
|
+
const a = new DataView(await r.slice(s, s + g).arrayBuffer()), m = new TextDecoder();
|
|
1074
1074
|
let f = 0;
|
|
1075
1075
|
for (; f + 46 <= a.byteLength && a.getUint32(f, !0) === 33639248; ) {
|
|
1076
|
-
const h = a.getUint16(f + 10, !0),
|
|
1076
|
+
const h = a.getUint16(f + 10, !0), ee = a.getUint32(f + 20, !0), y = a.getUint16(f + 28, !0), ae = a.getUint16(f + 30, !0), $e = a.getUint16(f + 32, !0), se = a.getUint32(f + 42, !0);
|
|
1077
1077
|
if (m.decode(new Uint8Array(a.buffer, a.byteOffset + f + 46, y)) === e) {
|
|
1078
|
-
const
|
|
1079
|
-
return h === 0 ?
|
|
1078
|
+
const ce = new DataView(await r.slice(se, se + 30).arrayBuffer()), pe = se + 30 + ce.getUint16(26, !0) + ce.getUint16(28, !0), ue = await re(r.slice(pe, pe + ee));
|
|
1079
|
+
return h === 0 ? ue : h === 8 && typeof DecompressionStream < "u" ? await ke(ue, "deflate-raw") : null;
|
|
1080
1080
|
}
|
|
1081
|
-
f += 46 + y +
|
|
1081
|
+
f += 46 + y + ae + $e;
|
|
1082
1082
|
}
|
|
1083
1083
|
return null;
|
|
1084
1084
|
}
|
|
1085
|
-
async function
|
|
1085
|
+
async function re(r) {
|
|
1086
1086
|
return new Uint8Array(await r.arrayBuffer());
|
|
1087
1087
|
}
|
|
1088
|
-
async function
|
|
1088
|
+
async function ke(r, e) {
|
|
1089
1089
|
const t = new Blob([r]).stream().pipeThrough(new DecompressionStream(e));
|
|
1090
1090
|
return new Uint8Array(await new Response(t).arrayBuffer());
|
|
1091
1091
|
}
|
|
1092
|
-
function
|
|
1092
|
+
function ie(r) {
|
|
1093
1093
|
let e = "";
|
|
1094
1094
|
for (let i = 0; i < r.length; i += 32768)
|
|
1095
1095
|
e += String.fromCharCode(...r.subarray(i, i + 32768));
|
|
1096
1096
|
return e;
|
|
1097
1097
|
}
|
|
1098
|
-
var
|
|
1099
|
-
for (var
|
|
1100
|
-
(
|
|
1101
|
-
return i &&
|
|
1102
|
-
},
|
|
1103
|
-
const
|
|
1098
|
+
var ze = Object.defineProperty, Je = Object.getOwnPropertyDescriptor, Xe = (r, e, t) => e in r ? ze(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, p = (r, e, t, i) => {
|
|
1099
|
+
for (var o = i > 1 ? void 0 : i ? Je(e, t) : e, g = r.length - 1, s; g >= 0; g--)
|
|
1100
|
+
(s = r[g]) && (o = (i ? s(e, t, o) : s(o)) || o);
|
|
1101
|
+
return i && o && ze(e, t, o), o;
|
|
1102
|
+
}, We = (r, e, t) => Xe(r, e + "", t);
|
|
1103
|
+
const le = {
|
|
1104
1104
|
fromAttribute: (r) => {
|
|
1105
1105
|
if (!r) return {};
|
|
1106
1106
|
try {
|
|
@@ -1114,7 +1114,7 @@ const ne = {
|
|
|
1114
1114
|
}, de = {
|
|
1115
1115
|
fromAttribute: (r) => r === null ? !0 : r !== "false",
|
|
1116
1116
|
toAttribute: (r) => r ? null : "false"
|
|
1117
|
-
},
|
|
1117
|
+
}, he = [
|
|
1118
1118
|
"view",
|
|
1119
1119
|
"dropzone",
|
|
1120
1120
|
"allowRename",
|
|
@@ -1137,230 +1137,238 @@ const ne = {
|
|
|
1137
1137
|
"messages",
|
|
1138
1138
|
"theme",
|
|
1139
1139
|
"density",
|
|
1140
|
+
"radius",
|
|
1140
1141
|
"onComplete",
|
|
1141
1142
|
"onError"
|
|
1142
1143
|
];
|
|
1143
|
-
var k, z, $, U, S, M, C, j, F, O, D, E, L, T, A, N, P, R,
|
|
1144
|
-
let n = (
|
|
1144
|
+
var k, z, $, U, S, M, C, j, F, O, D, E, L, T, A, N, P, R, B, G, I, _, K, q, V, Y, H, J, X, W, Z, me;
|
|
1145
|
+
let n = (me = class extends Ue {
|
|
1145
1146
|
constructor() {
|
|
1146
1147
|
super(...arguments);
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1148
|
+
d(this, k, null);
|
|
1149
|
+
d(this, z, {});
|
|
1150
|
+
d(this, $);
|
|
1151
|
+
d(this, U);
|
|
1152
|
+
d(this, S);
|
|
1153
|
+
d(this, M, "full");
|
|
1154
|
+
d(this, C, !0);
|
|
1155
|
+
d(this, j, !0);
|
|
1156
|
+
d(this, F, !1);
|
|
1157
|
+
d(this, O, !0);
|
|
1158
|
+
d(this, D, "");
|
|
1159
|
+
d(this, E, "");
|
|
1160
|
+
d(this, L, "");
|
|
1161
|
+
d(this, T, "");
|
|
1162
|
+
d(this, A, 10);
|
|
1163
|
+
d(this, N, "25MB");
|
|
1164
|
+
d(this, P, 0);
|
|
1165
|
+
d(this, R, "");
|
|
1166
|
+
d(this, B, {});
|
|
1167
|
+
d(this, G, "default");
|
|
1168
|
+
d(this, I, {});
|
|
1169
|
+
d(this, _, {});
|
|
1170
|
+
d(this, K, !1);
|
|
1171
|
+
d(this, q, "");
|
|
1172
|
+
d(this, V, null);
|
|
1173
|
+
d(this, Y, null);
|
|
1174
|
+
d(this, H, []);
|
|
1175
|
+
d(this, J, "");
|
|
1176
|
+
d(this, X, !1);
|
|
1177
|
+
d(this, W, !1);
|
|
1178
|
+
d(this, Z, "");
|
|
1177
1179
|
}
|
|
1178
1180
|
get client() {
|
|
1179
|
-
return
|
|
1181
|
+
return l(this, k);
|
|
1180
1182
|
}
|
|
1181
1183
|
set client(e) {
|
|
1182
1184
|
c(this, k, e);
|
|
1183
1185
|
}
|
|
1184
1186
|
get messages() {
|
|
1185
|
-
return
|
|
1187
|
+
return l(this, z);
|
|
1186
1188
|
}
|
|
1187
1189
|
set messages(e) {
|
|
1188
1190
|
c(this, z, e);
|
|
1189
1191
|
}
|
|
1190
1192
|
get theme() {
|
|
1191
|
-
return
|
|
1193
|
+
return l(this, $);
|
|
1192
1194
|
}
|
|
1193
1195
|
set theme(e) {
|
|
1194
1196
|
c(this, $, e);
|
|
1195
1197
|
}
|
|
1196
1198
|
get density() {
|
|
1197
|
-
return
|
|
1199
|
+
return l(this, U);
|
|
1198
1200
|
}
|
|
1199
1201
|
set density(e) {
|
|
1200
1202
|
c(this, U, e);
|
|
1201
1203
|
}
|
|
1204
|
+
get radius() {
|
|
1205
|
+
return l(this, S);
|
|
1206
|
+
}
|
|
1207
|
+
set radius(e) {
|
|
1208
|
+
c(this, S, e);
|
|
1209
|
+
}
|
|
1202
1210
|
get view() {
|
|
1203
|
-
return
|
|
1211
|
+
return l(this, M);
|
|
1204
1212
|
}
|
|
1205
1213
|
set view(e) {
|
|
1206
|
-
c(this,
|
|
1214
|
+
c(this, M, e);
|
|
1207
1215
|
}
|
|
1208
1216
|
get dropzone() {
|
|
1209
|
-
return
|
|
1217
|
+
return l(this, C);
|
|
1210
1218
|
}
|
|
1211
1219
|
set dropzone(e) {
|
|
1212
|
-
c(this,
|
|
1220
|
+
c(this, C, e);
|
|
1213
1221
|
}
|
|
1214
1222
|
get allowRename() {
|
|
1215
|
-
return
|
|
1223
|
+
return l(this, j);
|
|
1216
1224
|
}
|
|
1217
1225
|
set allowRename(e) {
|
|
1218
|
-
c(this,
|
|
1226
|
+
c(this, j, e);
|
|
1219
1227
|
}
|
|
1220
1228
|
get autoUpload() {
|
|
1221
|
-
return
|
|
1229
|
+
return l(this, F);
|
|
1222
1230
|
}
|
|
1223
1231
|
set autoUpload(e) {
|
|
1224
|
-
c(this,
|
|
1232
|
+
c(this, F, e);
|
|
1225
1233
|
}
|
|
1226
1234
|
get branding() {
|
|
1227
|
-
return
|
|
1235
|
+
return l(this, O);
|
|
1228
1236
|
}
|
|
1229
1237
|
set branding(e) {
|
|
1230
|
-
c(this,
|
|
1238
|
+
c(this, O, e);
|
|
1231
1239
|
}
|
|
1232
1240
|
get logoUrl() {
|
|
1233
|
-
return
|
|
1241
|
+
return l(this, D);
|
|
1234
1242
|
}
|
|
1235
1243
|
set logoUrl(e) {
|
|
1236
|
-
c(this,
|
|
1244
|
+
c(this, D, e);
|
|
1237
1245
|
}
|
|
1238
1246
|
get logoText() {
|
|
1239
|
-
return
|
|
1247
|
+
return l(this, E);
|
|
1240
1248
|
}
|
|
1241
1249
|
set logoText(e) {
|
|
1242
|
-
c(this,
|
|
1250
|
+
c(this, E, e);
|
|
1243
1251
|
}
|
|
1244
1252
|
get heading() {
|
|
1245
|
-
return
|
|
1253
|
+
return l(this, L);
|
|
1246
1254
|
}
|
|
1247
1255
|
set heading(e) {
|
|
1248
|
-
c(this,
|
|
1256
|
+
c(this, L, e);
|
|
1249
1257
|
}
|
|
1250
1258
|
get description() {
|
|
1251
|
-
return
|
|
1259
|
+
return l(this, T);
|
|
1252
1260
|
}
|
|
1253
1261
|
set description(e) {
|
|
1254
|
-
c(this,
|
|
1262
|
+
c(this, T, e);
|
|
1255
1263
|
}
|
|
1256
1264
|
get maxFiles() {
|
|
1257
|
-
return
|
|
1265
|
+
return l(this, A);
|
|
1258
1266
|
}
|
|
1259
1267
|
set maxFiles(e) {
|
|
1260
|
-
c(this,
|
|
1268
|
+
c(this, A, e);
|
|
1261
1269
|
}
|
|
1262
1270
|
get maxSize() {
|
|
1263
|
-
return
|
|
1271
|
+
return l(this, N);
|
|
1264
1272
|
}
|
|
1265
1273
|
set maxSize(e) {
|
|
1266
|
-
c(this,
|
|
1274
|
+
c(this, N, e);
|
|
1267
1275
|
}
|
|
1268
1276
|
get minSize() {
|
|
1269
|
-
return
|
|
1277
|
+
return l(this, P);
|
|
1270
1278
|
}
|
|
1271
1279
|
set minSize(e) {
|
|
1272
|
-
c(this,
|
|
1280
|
+
c(this, P, e);
|
|
1273
1281
|
}
|
|
1274
1282
|
get accept() {
|
|
1275
|
-
return
|
|
1283
|
+
return l(this, R);
|
|
1276
1284
|
}
|
|
1277
1285
|
set accept(e) {
|
|
1278
|
-
c(this,
|
|
1286
|
+
c(this, R, e);
|
|
1279
1287
|
}
|
|
1280
1288
|
get rules() {
|
|
1281
|
-
return
|
|
1289
|
+
return l(this, B);
|
|
1282
1290
|
}
|
|
1283
1291
|
set rules(e) {
|
|
1284
|
-
c(this,
|
|
1292
|
+
c(this, B, e);
|
|
1285
1293
|
}
|
|
1286
1294
|
get bucket() {
|
|
1287
|
-
return
|
|
1295
|
+
return l(this, G);
|
|
1288
1296
|
}
|
|
1289
1297
|
set bucket(e) {
|
|
1290
1298
|
c(this, G, e);
|
|
1291
1299
|
}
|
|
1292
1300
|
get metadata() {
|
|
1293
|
-
return
|
|
1301
|
+
return l(this, I);
|
|
1294
1302
|
}
|
|
1295
1303
|
set metadata(e) {
|
|
1296
|
-
c(this,
|
|
1304
|
+
c(this, I, e);
|
|
1297
1305
|
}
|
|
1298
1306
|
get options() {
|
|
1299
|
-
return
|
|
1307
|
+
return l(this, _);
|
|
1300
1308
|
}
|
|
1301
1309
|
set options(e) {
|
|
1302
|
-
c(this,
|
|
1310
|
+
c(this, _, e);
|
|
1303
1311
|
}
|
|
1304
1312
|
get publicRead() {
|
|
1305
|
-
return
|
|
1313
|
+
return l(this, K);
|
|
1306
1314
|
}
|
|
1307
1315
|
set publicRead(e) {
|
|
1308
|
-
c(this,
|
|
1316
|
+
c(this, K, e);
|
|
1309
1317
|
}
|
|
1310
1318
|
get redirectUrl() {
|
|
1311
|
-
return
|
|
1319
|
+
return l(this, q);
|
|
1312
1320
|
}
|
|
1313
1321
|
set redirectUrl(e) {
|
|
1314
|
-
c(this,
|
|
1322
|
+
c(this, q, e);
|
|
1315
1323
|
}
|
|
1316
1324
|
get onComplete() {
|
|
1317
|
-
return
|
|
1325
|
+
return l(this, V);
|
|
1318
1326
|
}
|
|
1319
1327
|
set onComplete(e) {
|
|
1320
|
-
c(this,
|
|
1328
|
+
c(this, V, e);
|
|
1321
1329
|
}
|
|
1322
1330
|
get onError() {
|
|
1323
|
-
return
|
|
1331
|
+
return l(this, Y);
|
|
1324
1332
|
}
|
|
1325
1333
|
set onError(e) {
|
|
1326
|
-
c(this,
|
|
1334
|
+
c(this, Y, e);
|
|
1327
1335
|
}
|
|
1328
1336
|
get items() {
|
|
1329
|
-
return
|
|
1337
|
+
return l(this, H);
|
|
1330
1338
|
}
|
|
1331
1339
|
set items(e) {
|
|
1332
|
-
c(this,
|
|
1340
|
+
c(this, H, e);
|
|
1333
1341
|
}
|
|
1334
1342
|
get notice() {
|
|
1335
|
-
return
|
|
1343
|
+
return l(this, J);
|
|
1336
1344
|
}
|
|
1337
1345
|
set notice(e) {
|
|
1338
|
-
c(this,
|
|
1346
|
+
c(this, J, e);
|
|
1339
1347
|
}
|
|
1340
1348
|
get busy() {
|
|
1341
|
-
return
|
|
1349
|
+
return l(this, X);
|
|
1342
1350
|
}
|
|
1343
1351
|
set busy(e) {
|
|
1344
|
-
c(this,
|
|
1352
|
+
c(this, X, e);
|
|
1345
1353
|
}
|
|
1346
1354
|
get dragging() {
|
|
1347
|
-
return
|
|
1355
|
+
return l(this, W);
|
|
1348
1356
|
}
|
|
1349
1357
|
set dragging(e) {
|
|
1350
|
-
c(this,
|
|
1358
|
+
c(this, W, e);
|
|
1351
1359
|
}
|
|
1352
1360
|
get editing() {
|
|
1353
|
-
return
|
|
1361
|
+
return l(this, Z);
|
|
1354
1362
|
}
|
|
1355
1363
|
set editing(e) {
|
|
1356
|
-
c(this,
|
|
1364
|
+
c(this, Z, e);
|
|
1357
1365
|
}
|
|
1358
1366
|
get msg() {
|
|
1359
|
-
return
|
|
1367
|
+
return Fe(this.messages);
|
|
1360
1368
|
}
|
|
1361
1369
|
/** An explicit `.client`, else the page default. */
|
|
1362
1370
|
get resolvedClient() {
|
|
1363
|
-
return this.client ??
|
|
1371
|
+
return this.client ?? Me() ?? null;
|
|
1364
1372
|
}
|
|
1365
1373
|
/** The staging list, for host code that wants to inspect or persist it. */
|
|
1366
1374
|
get files() {
|
|
@@ -1386,12 +1394,19 @@ let n = (he = class extends $e {
|
|
|
1386
1394
|
*/
|
|
1387
1395
|
set config(e) {
|
|
1388
1396
|
const t = this;
|
|
1389
|
-
for (const i of
|
|
1397
|
+
for (const i of he)
|
|
1390
1398
|
e && i in e && (t[i] = e[i]);
|
|
1391
1399
|
}
|
|
1400
|
+
/**
|
|
1401
|
+
* Changes settings on the fly. Only the keys you pass change; staged files
|
|
1402
|
+
* stay. Returns the element, so calls chain.
|
|
1403
|
+
*/
|
|
1404
|
+
configure(e) {
|
|
1405
|
+
return this.config = e, this;
|
|
1406
|
+
}
|
|
1392
1407
|
get config() {
|
|
1393
1408
|
const e = this;
|
|
1394
|
-
return Object.fromEntries(
|
|
1409
|
+
return Object.fromEntries(he.map((t) => [t, e[t]]));
|
|
1395
1410
|
}
|
|
1396
1411
|
/** Drops every staged file and any notice. */
|
|
1397
1412
|
clear() {
|
|
@@ -1404,7 +1419,7 @@ let n = (he = class extends $e {
|
|
|
1404
1419
|
async upload() {
|
|
1405
1420
|
var g;
|
|
1406
1421
|
if (this.busy) return;
|
|
1407
|
-
const e = this.items.filter((
|
|
1422
|
+
const e = this.items.filter((s) => s.status === "ready" || s.status === "error");
|
|
1408
1423
|
if (!e.length) return;
|
|
1409
1424
|
const t = this.resolvedClient;
|
|
1410
1425
|
if (!t) {
|
|
@@ -1412,35 +1427,35 @@ let n = (he = class extends $e {
|
|
|
1412
1427
|
return;
|
|
1413
1428
|
}
|
|
1414
1429
|
this.busy = !0, this.notice = "";
|
|
1415
|
-
for (const
|
|
1416
|
-
|
|
1430
|
+
for (const s of e)
|
|
1431
|
+
s.status = "uploading", s.percent = 0, s.error = "";
|
|
1417
1432
|
this.items = [...this.items];
|
|
1418
|
-
const i = /* @__PURE__ */ new Map(),
|
|
1419
|
-
const a = { file:
|
|
1420
|
-
return this.bucket && (a.bucket = this.bucket), this.publicRead && (a.publicRead = !0),
|
|
1433
|
+
const i = /* @__PURE__ */ new Map(), o = e.map((s) => {
|
|
1434
|
+
const a = { file: s.file, filename: s.file.name };
|
|
1435
|
+
return this.bucket && (a.bucket = this.bucket), this.publicRead && (a.publicRead = !0), s.name !== s.file.name && (a.newName = s.name), Object.keys(this.metadata ?? {}).length && (a.metadata = { ...this.metadata }), Object.keys(this.options ?? {}).length && (a.options = { ...this.options }), i.set(a, s), a;
|
|
1421
1436
|
});
|
|
1422
1437
|
try {
|
|
1423
|
-
const
|
|
1438
|
+
const s = await t.files.upload(o, {
|
|
1424
1439
|
onProgress: (f) => {
|
|
1425
1440
|
const h = i.get(f.input);
|
|
1426
1441
|
h && (h.percent = f.percent, this.items = [...this.items], this.emit("singlebase-upload-progress", { file: h, percent: this.percent }));
|
|
1427
1442
|
}
|
|
1428
1443
|
});
|
|
1429
|
-
for (const f of
|
|
1444
|
+
for (const f of s.completed) {
|
|
1430
1445
|
const h = i.get(f.input);
|
|
1431
1446
|
h && (h.status = "done", h.percent = 100, h.record = f.file);
|
|
1432
1447
|
}
|
|
1433
|
-
for (const f of
|
|
1448
|
+
for (const f of s.failed) {
|
|
1434
1449
|
const h = i.get(f.input);
|
|
1435
1450
|
h && (h.status = "error", h.error = f.error.message || f.error.code);
|
|
1436
1451
|
}
|
|
1437
1452
|
this.items = [...this.items];
|
|
1438
|
-
const a =
|
|
1453
|
+
const a = s.completed.map((f) => i.get(f.input)).filter(Boolean), m = s.failed.map((f) => i.get(f.input)).filter(Boolean);
|
|
1439
1454
|
this.emit("singlebase-upload-complete", { completed: a, failed: m }), (g = this.onComplete) == null || g.call(this, { completed: a, failed: m }), m.length ? this.notice = this.msg.errUpload : this.redirect();
|
|
1440
|
-
} catch (
|
|
1455
|
+
} catch (s) {
|
|
1441
1456
|
for (const a of e)
|
|
1442
1457
|
a.status = "error", a.error = "";
|
|
1443
|
-
this.items = [...this.items], this.fail(
|
|
1458
|
+
this.items = [...this.items], this.fail(Qe(s) || this.msg.errUpload);
|
|
1444
1459
|
} finally {
|
|
1445
1460
|
this.busy = !1;
|
|
1446
1461
|
}
|
|
@@ -1450,8 +1465,8 @@ let n = (he = class extends $e {
|
|
|
1450
1465
|
ruleFor(e) {
|
|
1451
1466
|
const t = oe(e);
|
|
1452
1467
|
if (!t) return null;
|
|
1453
|
-
for (const [i,
|
|
1454
|
-
if (i.toLowerCase().replace(/^\./, "") === t) return
|
|
1468
|
+
for (const [i, o] of Object.entries(this.rules ?? {}))
|
|
1469
|
+
if (i.toLowerCase().replace(/^\./, "") === t) return o;
|
|
1455
1470
|
return null;
|
|
1456
1471
|
}
|
|
1457
1472
|
async add(e) {
|
|
@@ -1459,33 +1474,33 @@ let n = (he = class extends $e {
|
|
|
1459
1474
|
const a = this.items.filter((m) => m.status === "done" || m.status === "error");
|
|
1460
1475
|
a.forEach(w), this.items = this.items.filter((m) => !a.includes(m));
|
|
1461
1476
|
}
|
|
1462
|
-
const t = this.maxFiles > 0 ? this.maxFiles : Number.POSITIVE_INFINITY, i = [...this.items],
|
|
1463
|
-
let
|
|
1477
|
+
const t = this.maxFiles > 0 ? this.maxFiles : Number.POSITIVE_INFINITY, i = [...this.items], o = i.length, g = [];
|
|
1478
|
+
let s = "";
|
|
1464
1479
|
for (const a of Array.from(e)) {
|
|
1465
1480
|
if (i.length >= t) {
|
|
1466
|
-
|
|
1481
|
+
s = v(this.msg.errTooMany, { max: t });
|
|
1467
1482
|
break;
|
|
1468
1483
|
}
|
|
1469
|
-
if (this.accept && !
|
|
1470
|
-
|
|
1484
|
+
if (this.accept && !Oe(this.accept, a.name, a.type)) {
|
|
1485
|
+
s = v(this.msg.errType, { name: a.name });
|
|
1471
1486
|
continue;
|
|
1472
1487
|
}
|
|
1473
|
-
const m = this.ruleFor(a.name), f =
|
|
1488
|
+
const m = this.ruleFor(a.name), f = ne((m == null ? void 0 : m.maxSize) ?? this.maxSize), h = ne((m == null ? void 0 : m.minSize) ?? this.minSize);
|
|
1474
1489
|
if (f && a.size > f) {
|
|
1475
|
-
|
|
1490
|
+
s = v(this.msg.errTooLarge, { name: a.name, size: te(f) });
|
|
1476
1491
|
continue;
|
|
1477
1492
|
}
|
|
1478
1493
|
if (h && a.size < h) {
|
|
1479
|
-
|
|
1494
|
+
s = v(this.msg.errTooSmall, { name: a.name, size: te(h) });
|
|
1480
1495
|
continue;
|
|
1481
1496
|
}
|
|
1482
|
-
const
|
|
1483
|
-
if (i.some((
|
|
1484
|
-
|
|
1497
|
+
const ee = De(a);
|
|
1498
|
+
if (i.some((ae) => ae.key === ee)) {
|
|
1499
|
+
s = v(this.msg.errDuplicate, { name: a.name });
|
|
1485
1500
|
continue;
|
|
1486
1501
|
}
|
|
1487
1502
|
const y = {
|
|
1488
|
-
key:
|
|
1503
|
+
key: ee,
|
|
1489
1504
|
file: a,
|
|
1490
1505
|
name: a.name,
|
|
1491
1506
|
// Reading bytes takes a moment, so the row appears immediately as
|
|
@@ -1496,16 +1511,16 @@ let n = (he = class extends $e {
|
|
|
1496
1511
|
record: null,
|
|
1497
1512
|
pages: null,
|
|
1498
1513
|
encrypted: null,
|
|
1499
|
-
preview:
|
|
1514
|
+
preview: Ze(a)
|
|
1500
1515
|
};
|
|
1501
1516
|
i.push(y), g.push(y);
|
|
1502
1517
|
}
|
|
1503
|
-
this.notice =
|
|
1518
|
+
this.notice = s, s && this.emit("singlebase-upload-rejected", { message: s }), i.length !== o && (this.items = i, this.emit("singlebase-upload-selected", { files: this.items }), await Promise.all(
|
|
1504
1519
|
g.filter((a) => a.status === "checking").map((a) => this.inspect(a, this.ruleFor(a.file.name)))
|
|
1505
1520
|
), (this.autoUpload || this.view === "button") && this.upload());
|
|
1506
1521
|
}
|
|
1507
1522
|
needsInspection(e, t) {
|
|
1508
|
-
return !e || !
|
|
1523
|
+
return !e || !_e(oe(t)) ? !1 : e.maxPages !== void 0 || e.allowProtected === !1;
|
|
1509
1524
|
}
|
|
1510
1525
|
/**
|
|
1511
1526
|
* Reads the file and applies the rule. A fact the reader could not
|
|
@@ -1513,21 +1528,21 @@ let n = (he = class extends $e {
|
|
|
1513
1528
|
* the page rule simply doesn't apply to that file.
|
|
1514
1529
|
*/
|
|
1515
1530
|
async inspect(e, t) {
|
|
1516
|
-
const i = await
|
|
1531
|
+
const i = await Ie(e.file, oe(e.file.name));
|
|
1517
1532
|
e.pages = i.pages, e.encrypted = i.encrypted;
|
|
1518
|
-
let
|
|
1519
|
-
t.allowProtected === !1 && i.encrypted === !0 ?
|
|
1533
|
+
let o = "";
|
|
1534
|
+
t.allowProtected === !1 && i.encrypted === !0 ? o = v(this.msg.errProtected, { name: e.name }) : t.maxPages && i.pages !== null && i.pages > t.maxPages && (o = v(this.msg.errTooManyPages, {
|
|
1520
1535
|
name: e.name,
|
|
1521
1536
|
pages: i.pages,
|
|
1522
1537
|
max: t.maxPages
|
|
1523
|
-
})),
|
|
1538
|
+
})), o ? (w(e), this.items = this.items.filter((g) => g !== e), this.notice = o, this.emit("singlebase-upload-rejected", { message: o })) : (e.status = "ready", this.items = [...this.items]);
|
|
1524
1539
|
}
|
|
1525
1540
|
/** Drops one staged file. Named for the row action, not Element.remove(). */
|
|
1526
1541
|
removeItem(e) {
|
|
1527
1542
|
this.items.filter((t) => t.key === e).forEach(w), this.items = this.items.filter((t) => t.key !== e), this.notice = "";
|
|
1528
1543
|
}
|
|
1529
1544
|
commitRename(e, t) {
|
|
1530
|
-
e.name =
|
|
1545
|
+
e.name = Ee(e.file.name, t), this.editing = "", this.items = [...this.items];
|
|
1531
1546
|
}
|
|
1532
1547
|
fail(e) {
|
|
1533
1548
|
var t;
|
|
@@ -1538,7 +1553,7 @@ let n = (he = class extends $e {
|
|
|
1538
1553
|
}
|
|
1539
1554
|
redirect() {
|
|
1540
1555
|
if (!this.redirectUrl || typeof location > "u") return;
|
|
1541
|
-
const e =
|
|
1556
|
+
const e = Pe(
|
|
1542
1557
|
this.redirectUrl,
|
|
1543
1558
|
location.href,
|
|
1544
1559
|
(t) => console.warn(`[singlebase-uploader] ${t}`)
|
|
@@ -1575,7 +1590,7 @@ let n = (he = class extends $e {
|
|
|
1575
1590
|
return this.items.filter((e) => e.status === "ready" || e.status === "error").length;
|
|
1576
1591
|
}
|
|
1577
1592
|
get hint() {
|
|
1578
|
-
const e =
|
|
1593
|
+
const e = Le(this.accept), t = ne(this.maxSize), i = t ? v(this.msg.hintUpTo, { size: te(t) }) : "";
|
|
1579
1594
|
return [e, i].filter(Boolean).join(" · ");
|
|
1580
1595
|
}
|
|
1581
1596
|
renderInput() {
|
|
@@ -1596,11 +1611,7 @@ let n = (he = class extends $e {
|
|
|
1596
1611
|
/>` : this.logoText ? u`<div class="brand-mark" part="logo">${this.logoText}</div>` : x;
|
|
1597
1612
|
}
|
|
1598
1613
|
renderBranding() {
|
|
1599
|
-
return this.branding
|
|
1600
|
-
<a href="https://singlebase.cloud" target="_blank" rel="noopener noreferrer"
|
|
1601
|
-
>${this.msg.brandingLabel}</a
|
|
1602
|
-
>
|
|
1603
|
-
</div>` : x;
|
|
1614
|
+
return Te(this.branding, "Files");
|
|
1604
1615
|
}
|
|
1605
1616
|
renderNotice() {
|
|
1606
1617
|
return this.notice ? u`<div class="banner" role="alert" part="error">${this.notice}</div>` : x;
|
|
@@ -1613,7 +1624,7 @@ let n = (he = class extends $e {
|
|
|
1613
1624
|
</div>`;
|
|
1614
1625
|
}
|
|
1615
1626
|
renderStatus(e) {
|
|
1616
|
-
const t =
|
|
1627
|
+
const t = te(e.file.size);
|
|
1617
1628
|
if (e.status === "checking") return `${t} · ${this.msg.checking}`;
|
|
1618
1629
|
if (e.status === "uploading") return `${t} · ${this.msg.uploading}`;
|
|
1619
1630
|
if (e.status === "done") return `${t} · ${this.msg.uploaded}`;
|
|
@@ -1626,7 +1637,7 @@ let n = (he = class extends $e {
|
|
|
1626
1637
|
const t = this.allowRename && e.status === "ready";
|
|
1627
1638
|
return e.status === "uploading" || e.status, u`<div class="row" part="file">
|
|
1628
1639
|
<div class="chip" part="file-type">
|
|
1629
|
-
${e.preview ? u`<img class="thumb" src=${e.preview} alt="" part="preview" />` :
|
|
1640
|
+
${e.preview ? u`<img class="thumb" src=${e.preview} alt="" part="preview" />` : Ae(e.name) || "FILE"}
|
|
1630
1641
|
</div>
|
|
1631
1642
|
<div class="meta">
|
|
1632
1643
|
${this.editing === e.key ? u`<input
|
|
@@ -1748,11 +1759,12 @@ let n = (he = class extends $e {
|
|
|
1748
1759
|
render() {
|
|
1749
1760
|
return u`${this.renderInput()}${this.view === "button" ? this.renderButton() : this.view === "compact" ? this.renderCompact() : this.renderFull()}`;
|
|
1750
1761
|
}
|
|
1751
|
-
}, k = new WeakMap(), z = new WeakMap(), $ = new WeakMap(), U = new WeakMap(), S = new WeakMap(), M = new WeakMap(), C = new WeakMap(), j = new WeakMap(), F = new WeakMap(), O = new WeakMap(), D = new WeakMap(), E = new WeakMap(), L = new WeakMap(), T = new WeakMap(), A = new WeakMap(), N = new WeakMap(), P = new WeakMap(), R = new WeakMap(),
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1762
|
+
}, k = new WeakMap(), z = new WeakMap(), $ = new WeakMap(), U = new WeakMap(), S = new WeakMap(), M = new WeakMap(), C = new WeakMap(), j = new WeakMap(), F = new WeakMap(), O = new WeakMap(), D = new WeakMap(), E = new WeakMap(), L = new WeakMap(), T = new WeakMap(), A = new WeakMap(), N = new WeakMap(), P = new WeakMap(), R = new WeakMap(), B = new WeakMap(), G = new WeakMap(), I = new WeakMap(), _ = new WeakMap(), K = new WeakMap(), q = new WeakMap(), V = new WeakMap(), Y = new WeakMap(), H = new WeakMap(), J = new WeakMap(), X = new WeakMap(), W = new WeakMap(), Z = new WeakMap(), me);
|
|
1763
|
+
We(n, "styles", [
|
|
1764
|
+
Ce,
|
|
1765
|
+
Ne,
|
|
1766
|
+
je,
|
|
1767
|
+
xe`
|
|
1756
1768
|
.card {
|
|
1757
1769
|
display: flex;
|
|
1758
1770
|
flex-direction: column;
|
|
@@ -1762,7 +1774,7 @@ He(n, "styles", [
|
|
|
1762
1774
|
background: var(--sb-surface, #ffffff);
|
|
1763
1775
|
color: var(--sb-ink, #16181a);
|
|
1764
1776
|
border: 1px solid var(--sb-border, #e4e6e9);
|
|
1765
|
-
border-radius: calc(var(--sb-radius, 4px) + 4px);
|
|
1777
|
+
border-radius: calc((var(--sb-radius, 4px) + 4px) * var(--sb-radius-scale, 1));
|
|
1766
1778
|
}
|
|
1767
1779
|
|
|
1768
1780
|
.logo-img {
|
|
@@ -1804,7 +1816,7 @@ He(n, "styles", [
|
|
|
1804
1816
|
padding: 30px 20px;
|
|
1805
1817
|
text-align: center;
|
|
1806
1818
|
border: 1px dashed var(--sb-border-strong, #cdd1d6);
|
|
1807
|
-
border-radius: calc(var(--sb-radius, 4px) + 2px);
|
|
1819
|
+
border-radius: calc((var(--sb-radius, 4px) + 2px) * var(--sb-radius-scale, 1));
|
|
1808
1820
|
background: var(--sb-surface, #ffffff);
|
|
1809
1821
|
transition:
|
|
1810
1822
|
border-color 0.15s,
|
|
@@ -1844,7 +1856,7 @@ He(n, "styles", [
|
|
|
1844
1856
|
gap: 12px;
|
|
1845
1857
|
padding: 10px 12px;
|
|
1846
1858
|
border: 1px solid var(--sb-border, #e4e6e9);
|
|
1847
|
-
border-radius: calc(var(--sb-radius, 4px) + 2px);
|
|
1859
|
+
border-radius: calc((var(--sb-radius, 4px) + 2px) * var(--sb-radius-scale, 1));
|
|
1848
1860
|
background: var(--sb-surface-alt, #fafafa);
|
|
1849
1861
|
transition:
|
|
1850
1862
|
border-color 0.15s,
|
|
@@ -1891,7 +1903,7 @@ He(n, "styles", [
|
|
|
1891
1903
|
color: var(--sb-muted-ink, #61666c);
|
|
1892
1904
|
background: var(--sb-surface-alt, #fafafa);
|
|
1893
1905
|
border: 1px solid var(--sb-border, #e4e6e9);
|
|
1894
|
-
border-radius: var(--sb-radius, 4px);
|
|
1906
|
+
border-radius: calc(var(--sb-radius, 4px) * var(--sb-radius-scale, 1));
|
|
1895
1907
|
overflow: hidden;
|
|
1896
1908
|
}
|
|
1897
1909
|
|
|
@@ -1980,7 +1992,7 @@ He(n, "styles", [
|
|
|
1980
1992
|
color: var(--sb-ink, #16181a);
|
|
1981
1993
|
background: none;
|
|
1982
1994
|
border: 1px dashed var(--sb-border-strong, #cdd1d6);
|
|
1983
|
-
border-radius: calc(var(--sb-radius, 4px) + 2px);
|
|
1995
|
+
border-radius: calc((var(--sb-radius, 4px) + 2px) * var(--sb-radius-scale, 1));
|
|
1984
1996
|
}
|
|
1985
1997
|
|
|
1986
1998
|
button.add-more:hover:not(:disabled) {
|
|
@@ -1993,25 +2005,6 @@ He(n, "styles", [
|
|
|
1993
2005
|
font-size: 14px;
|
|
1994
2006
|
}
|
|
1995
2007
|
|
|
1996
|
-
.branding {
|
|
1997
|
-
text-align: center;
|
|
1998
|
-
font-family: var(--sb-mono, "Geist Mono", ui-monospace, monospace);
|
|
1999
|
-
font-size: 10.5px;
|
|
2000
|
-
letter-spacing: 0.06em;
|
|
2001
|
-
color: var(--sb-muted-ink, #61666c);
|
|
2002
|
-
}
|
|
2003
|
-
|
|
2004
|
-
.branding a {
|
|
2005
|
-
color: inherit;
|
|
2006
|
-
text-decoration: none;
|
|
2007
|
-
}
|
|
2008
|
-
|
|
2009
|
-
.branding a:hover {
|
|
2010
|
-
color: var(--sb-ink, #16181a);
|
|
2011
|
-
text-decoration: underline;
|
|
2012
|
-
text-underline-offset: 3px;
|
|
2013
|
-
}
|
|
2014
|
-
|
|
2015
2008
|
/* the button view is just a control, not a card */
|
|
2016
2009
|
:host([view="button"]) {
|
|
2017
2010
|
display: inline-block;
|
|
@@ -2036,6 +2029,9 @@ p([
|
|
|
2036
2029
|
p([
|
|
2037
2030
|
b({ reflect: !0 })
|
|
2038
2031
|
], n.prototype, "density", 1);
|
|
2032
|
+
p([
|
|
2033
|
+
b({ reflect: !0 })
|
|
2034
|
+
], n.prototype, "radius", 1);
|
|
2039
2035
|
p([
|
|
2040
2036
|
b({ reflect: !0 })
|
|
2041
2037
|
], n.prototype, "view", 1);
|
|
@@ -2076,16 +2072,16 @@ p([
|
|
|
2076
2072
|
b()
|
|
2077
2073
|
], n.prototype, "accept", 1);
|
|
2078
2074
|
p([
|
|
2079
|
-
b({ converter:
|
|
2075
|
+
b({ converter: le })
|
|
2080
2076
|
], n.prototype, "rules", 1);
|
|
2081
2077
|
p([
|
|
2082
2078
|
b()
|
|
2083
2079
|
], n.prototype, "bucket", 1);
|
|
2084
2080
|
p([
|
|
2085
|
-
b({ converter:
|
|
2081
|
+
b({ converter: le })
|
|
2086
2082
|
], n.prototype, "metadata", 1);
|
|
2087
2083
|
p([
|
|
2088
|
-
b({ converter:
|
|
2084
|
+
b({ converter: le })
|
|
2089
2085
|
], n.prototype, "options", 1);
|
|
2090
2086
|
p([
|
|
2091
2087
|
b({ type: Boolean, attribute: "public-read" })
|
|
@@ -2100,37 +2096,37 @@ p([
|
|
|
2100
2096
|
b({ attribute: !1 })
|
|
2101
2097
|
], n.prototype, "onError", 1);
|
|
2102
2098
|
p([
|
|
2103
|
-
|
|
2099
|
+
Q()
|
|
2104
2100
|
], n.prototype, "items", 1);
|
|
2105
2101
|
p([
|
|
2106
|
-
|
|
2102
|
+
Q()
|
|
2107
2103
|
], n.prototype, "notice", 1);
|
|
2108
2104
|
p([
|
|
2109
|
-
|
|
2105
|
+
Q()
|
|
2110
2106
|
], n.prototype, "busy", 1);
|
|
2111
2107
|
p([
|
|
2112
|
-
|
|
2108
|
+
Q()
|
|
2113
2109
|
], n.prototype, "dragging", 1);
|
|
2114
2110
|
p([
|
|
2115
|
-
|
|
2111
|
+
Q()
|
|
2116
2112
|
], n.prototype, "editing", 1);
|
|
2117
2113
|
n = p([
|
|
2118
|
-
|
|
2114
|
+
Se("singlebase-uploader")
|
|
2119
2115
|
], n);
|
|
2120
|
-
function
|
|
2116
|
+
function Ze(r) {
|
|
2121
2117
|
return !r.type.startsWith("image/") || typeof URL.createObjectURL != "function" ? "" : URL.createObjectURL(r);
|
|
2122
2118
|
}
|
|
2123
2119
|
function w(r) {
|
|
2124
2120
|
r.preview && URL.revokeObjectURL(r.preview);
|
|
2125
2121
|
}
|
|
2126
|
-
function
|
|
2122
|
+
function Qe(r) {
|
|
2127
2123
|
return r instanceof Error ? r.message : "";
|
|
2128
2124
|
}
|
|
2129
2125
|
export {
|
|
2130
2126
|
n as S,
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2127
|
+
_e as a,
|
|
2128
|
+
Ie as i,
|
|
2129
|
+
Pe as r,
|
|
2130
|
+
Ne as s
|
|
2135
2131
|
};
|
|
2136
|
-
//# sourceMappingURL=uploader-
|
|
2132
|
+
//# sourceMappingURL=uploader-tdMU9Gxv.js.map
|