@brett_lamy/ui 4.0.0 → 5.1.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 +1 -1
- package/dist/components/animated-height.d.ts +3 -1
- package/dist/components/animated-height.d.ts.map +1 -1
- package/dist/components/animated-height.js +11 -11
- package/dist/components/artifact-chat-container.d.ts.map +1 -1
- package/dist/components/artifact-chat-container.js +81 -82
- package/dist/components/button.d.ts +4 -3
- package/dist/components/button.d.ts.map +1 -1
- package/dist/components/button.js +22 -9
- package/dist/components/calendar.d.ts +26 -0
- package/dist/components/calendar.d.ts.map +1 -0
- package/dist/components/calendar.js +97 -0
- package/dist/components/canvas.d.ts +91 -0
- package/dist/components/canvas.d.ts.map +1 -0
- package/dist/components/canvas.js +296 -0
- package/dist/components/color-field.d.ts +22 -0
- package/dist/components/color-field.d.ts.map +1 -0
- package/dist/components/color-field.js +60 -0
- package/dist/components/color-picker.d.ts +49 -0
- package/dist/components/color-picker.d.ts.map +1 -0
- package/dist/components/color-picker.js +121 -0
- package/dist/components/composer/composer-cards.d.ts +55 -0
- package/dist/components/composer/composer-cards.d.ts.map +1 -0
- package/dist/components/composer/composer-cards.js +351 -0
- package/dist/components/composer/composer.d.ts +9 -1
- package/dist/components/composer/composer.d.ts.map +1 -1
- package/dist/components/composer/composer.js +179 -154
- package/dist/components/context-menu.d.ts +25 -0
- package/dist/components/context-menu.d.ts.map +1 -0
- package/dist/components/context-menu.js +127 -0
- package/dist/components/credenza.d.ts.map +1 -1
- package/dist/components/credenza.js +52 -92
- package/dist/components/cron-editor.d.ts +47 -0
- package/dist/components/cron-editor.d.ts.map +1 -0
- package/dist/components/cron-editor.js +297 -0
- package/dist/components/date-field.d.ts +19 -0
- package/dist/components/date-field.d.ts.map +1 -0
- package/dist/components/date-field.js +79 -0
- package/dist/components/date-picker.d.ts +38 -0
- package/dist/components/date-picker.d.ts.map +1 -0
- package/dist/components/date-picker.js +110 -0
- package/dist/components/dropdown-menu.d.ts +3 -1
- package/dist/components/dropdown-menu.d.ts.map +1 -1
- package/dist/components/dropdown-menu.js +5 -5
- package/dist/components/edge-drawer.d.ts.map +1 -1
- package/dist/components/edge-drawer.js +1 -0
- package/dist/components/file-upload.d.ts +121 -0
- package/dist/components/file-upload.d.ts.map +1 -0
- package/dist/components/file-upload.js +405 -0
- package/dist/components/filter-input.d.ts +22 -0
- package/dist/components/filter-input.d.ts.map +1 -0
- package/dist/components/filter-input.js +126 -0
- package/dist/components/filter.d.ts +154 -0
- package/dist/components/filter.d.ts.map +1 -0
- package/dist/components/filter.js +815 -0
- package/dist/components/floating-chat.d.ts.map +1 -1
- package/dist/components/floating-chat.js +71 -88
- package/dist/components/floating-sheet.d.ts.map +1 -1
- package/dist/components/floating-sheet.js +93 -104
- package/dist/components/markdown-editor.d.ts +2 -0
- package/dist/components/markdown-editor.d.ts.map +1 -1
- package/dist/components/markdown-editor.js +46 -45
- package/dist/components/markdown-view.d.ts +6 -1
- package/dist/components/markdown-view.d.ts.map +1 -1
- package/dist/components/markdown-view.js +13 -11
- package/dist/components/navigation-stack.d.ts +3 -5
- package/dist/components/navigation-stack.d.ts.map +1 -1
- package/dist/components/navigation-stack.js +212 -382
- package/dist/components/passkey-enroll-dialog.d.ts +36 -0
- package/dist/components/passkey-enroll-dialog.d.ts.map +1 -0
- package/dist/components/passkey-enroll-dialog.js +234 -0
- package/dist/components/result-table.d.ts +38 -0
- package/dist/components/result-table.d.ts.map +1 -0
- package/dist/components/result-table.js +161 -0
- package/dist/components/schema-tree.d.ts +19 -0
- package/dist/components/schema-tree.d.ts.map +1 -0
- package/dist/components/schema-tree.js +172 -0
- package/dist/components/side-drawer.d.ts.map +1 -1
- package/dist/components/side-drawer.js +117 -143
- package/dist/components/slider.d.ts.map +1 -1
- package/dist/components/slider.js +4 -1
- package/dist/components/spinner-shapes.d.ts +299 -0
- package/dist/components/spinner-shapes.d.ts.map +1 -0
- package/dist/components/spinner-shapes.js +876 -0
- package/dist/components/spinner.d.ts +133 -3
- package/dist/components/spinner.d.ts.map +1 -1
- package/dist/components/spinner.js +445 -29
- package/dist/components/sql-console.d.ts +28 -0
- package/dist/components/sql-console.d.ts.map +1 -0
- package/dist/components/sql-console.js +348 -0
- package/dist/components/sql-editor.d.ts +47 -0
- package/dist/components/sql-editor.d.ts.map +1 -0
- package/dist/components/sql-editor.js +170 -0
- package/dist/components/tab-view.d.ts +2 -2
- package/dist/components/tab-view.d.ts.map +1 -1
- package/dist/components/tab-view.js +63 -49
- package/dist/components/tailscale-login-button.d.ts +53 -0
- package/dist/components/tailscale-login-button.d.ts.map +1 -0
- package/dist/components/tailscale-login-button.js +197 -0
- package/dist/components/time-input.d.ts +46 -0
- package/dist/components/time-input.d.ts.map +1 -0
- package/dist/components/time-input.js +258 -0
- package/dist/components/toast.d.ts +5 -2
- package/dist/components/toast.d.ts.map +1 -1
- package/dist/components/toast.js +249 -125
- package/dist/components/vault-gate.d.ts +60 -0
- package/dist/components/vault-gate.d.ts.map +1 -0
- package/dist/components/vault-gate.js +382 -0
- package/dist/index.css +1 -1
- package/dist/index.d.ts +90 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +134 -83
- package/dist/lib/back-history.d.ts +5 -0
- package/dist/lib/back-history.d.ts.map +1 -0
- package/dist/lib/back-history.js +44 -0
- package/dist/lib/canvas-math.d.ts +82 -0
- package/dist/lib/canvas-math.d.ts.map +1 -0
- package/dist/lib/canvas-math.js +226 -0
- package/dist/lib/controllable-state.d.ts +4 -0
- package/dist/lib/controllable-state.d.ts.map +1 -0
- package/dist/lib/controllable-state.js +11 -0
- package/dist/lib/cron.d.ts +55 -0
- package/dist/lib/cron.d.ts.map +1 -0
- package/dist/lib/cron.js +269 -0
- package/dist/lib/edge-swipe.d.ts +36 -0
- package/dist/lib/edge-swipe.d.ts.map +1 -0
- package/dist/lib/edge-swipe.js +73 -0
- package/dist/lib/file-upload.d.ts +187 -0
- package/dist/lib/file-upload.d.ts.map +1 -0
- package/dist/lib/file-upload.js +349 -0
- package/dist/lib/filter-query.d.ts +90 -0
- package/dist/lib/filter-query.d.ts.map +1 -0
- package/dist/lib/filter-query.js +459 -0
- package/dist/lib/filter.d.ts +120 -0
- package/dist/lib/filter.d.ts.map +1 -0
- package/dist/lib/filter.js +399 -0
- package/dist/lib/format-bytes.d.ts +3 -0
- package/dist/lib/format-bytes.d.ts.map +1 -0
- package/dist/lib/format-bytes.js +16 -0
- package/dist/lib/gpu-cron.d.ts +51 -0
- package/dist/lib/gpu-cron.d.ts.map +1 -0
- package/dist/lib/gpu-cron.js +81 -0
- package/dist/lib/gpu-query/featurize.d.ts +19 -0
- package/dist/lib/gpu-query/featurize.d.ts.map +1 -0
- package/dist/lib/gpu-query/featurize.js +88 -0
- package/dist/lib/gpu-query/index.d.ts +73 -0
- package/dist/lib/gpu-query/index.d.ts.map +1 -0
- package/dist/lib/gpu-query/index.js +117 -0
- package/dist/lib/gpu-query/kernel.wgsl.d.ts +30 -0
- package/dist/lib/gpu-query/kernel.wgsl.d.ts.map +1 -0
- package/dist/lib/gpu-query/model.d.ts +8 -0
- package/dist/lib/gpu-query/model.d.ts.map +1 -0
- package/dist/lib/gpu-query/model.js +91 -0
- package/dist/lib/gpu-query/schema.d.ts +40 -0
- package/dist/lib/gpu-query/schema.d.ts.map +1 -0
- package/dist/lib/gpu-query/schema.js +0 -0
- package/dist/lib/gpu-query/webgpu.d.ts +12 -0
- package/dist/lib/gpu-query/webgpu.d.ts.map +1 -0
- package/dist/lib/gpu-query/weights.d.ts +17 -0
- package/dist/lib/gpu-query/weights.d.ts.map +1 -0
- package/dist/lib/gpu-query/weights.js +40 -0
- package/dist/lib/gpu-query/weights.json.d.ts +3 -0
- package/dist/lib/gpu-query/weights2.js +25 -0
- package/dist/lib/gpu-time.d.ts +77 -0
- package/dist/lib/gpu-time.d.ts.map +1 -0
- package/dist/lib/gpu-time.js +260 -0
- package/dist/lib/morph-path.d.ts +22 -0
- package/dist/lib/morph-path.d.ts.map +1 -0
- package/dist/lib/morph-path.js +42 -0
- package/dist/lib/passkey.d.ts +120 -0
- package/dist/lib/passkey.d.ts.map +1 -0
- package/dist/lib/passkey.js +186 -0
- package/dist/lib/persistent-state.d.ts +9 -0
- package/dist/lib/persistent-state.d.ts.map +1 -0
- package/dist/lib/persistent-state.js +37 -0
- package/dist/lib/pglite-core.d.ts +219 -0
- package/dist/lib/pglite-core.d.ts.map +1 -0
- package/dist/lib/pglite-core.js +273 -0
- package/dist/lib/pglite-files.d.ts +7 -0
- package/dist/lib/pglite-files.d.ts.map +1 -0
- package/dist/lib/pglite-files.js +17 -0
- package/dist/lib/pglite-schema.d.ts +58 -0
- package/dist/lib/pglite-schema.d.ts.map +1 -0
- package/dist/lib/pglite-schema.js +105 -0
- package/dist/lib/pglite-storage.d.ts +33 -0
- package/dist/lib/pglite-storage.d.ts.map +1 -0
- package/dist/lib/pglite-storage.js +55 -0
- package/dist/lib/pglite-transfer.d.ts +53 -0
- package/dist/lib/pglite-transfer.d.ts.map +1 -0
- package/dist/lib/pglite-transfer.js +126 -0
- package/dist/lib/pglite.d.ts +106 -0
- package/dist/lib/pglite.d.ts.map +1 -0
- package/dist/lib/pglite.js +298 -0
- package/dist/lib/pull-to-refresh.d.ts +24 -0
- package/dist/lib/pull-to-refresh.d.ts.map +1 -0
- package/dist/lib/pull-to-refresh.js +74 -0
- package/dist/lib/scroll-hidden.d.ts +6 -0
- package/dist/lib/scroll-hidden.d.ts.map +1 -0
- package/dist/lib/scroll-hidden.js +21 -0
- package/dist/lib/sql-format.d.ts +62 -0
- package/dist/lib/sql-format.d.ts.map +1 -0
- package/dist/lib/sql-format.js +175 -0
- package/dist/lib/sql-lex.d.ts +25 -0
- package/dist/lib/sql-lex.d.ts.map +1 -0
- package/dist/lib/sql-lex.js +135 -0
- package/dist/lib/tab-lock.d.ts +28 -0
- package/dist/lib/tab-lock.d.ts.map +1 -0
- package/dist/lib/tab-lock.js +80 -0
- package/dist/lib/tailscale-connect.d.ts +56 -0
- package/dist/lib/tailscale-connect.d.ts.map +1 -0
- package/dist/lib/tailscale-connect.js +99 -0
- package/dist/lib/tailscale-fake.d.ts +33 -0
- package/dist/lib/tailscale-fake.d.ts.map +1 -0
- package/dist/lib/tailscale-fake.js +80 -0
- package/dist/lib/tailscale-policy.d.ts +71 -0
- package/dist/lib/tailscale-policy.d.ts.map +1 -0
- package/dist/lib/tailscale-policy.js +244 -0
- package/dist/lib/tailscale-react.d.ts +20 -0
- package/dist/lib/tailscale-react.d.ts.map +1 -0
- package/dist/lib/tailscale-react.js +37 -0
- package/dist/lib/tailscale-router/bridge.d.ts +60 -0
- package/dist/lib/tailscale-router/bridge.d.ts.map +1 -0
- package/dist/lib/tailscale-router/bridge.js +198 -0
- package/dist/lib/tailscale-router/react.d.ts +19 -0
- package/dist/lib/tailscale-router/react.d.ts.map +1 -0
- package/dist/lib/tailscale-router/react.js +52 -0
- package/dist/lib/tailscale.d.ts +204 -0
- package/dist/lib/tailscale.d.ts.map +1 -0
- package/dist/lib/tailscale.js +443 -0
- package/dist/lib/title-flight.d.ts +34 -0
- package/dist/lib/title-flight.d.ts.map +1 -0
- package/dist/lib/title-flight.js +123 -0
- package/dist/lib/vault-react.d.ts +49 -0
- package/dist/lib/vault-react.d.ts.map +1 -0
- package/dist/lib/vault-react.js +196 -0
- package/dist/lib/vault-storage.d.ts +30 -0
- package/dist/lib/vault-storage.d.ts.map +1 -0
- package/dist/lib/vault-storage.js +105 -0
- package/dist/lib/vault.d.ts +200 -0
- package/dist/lib/vault.d.ts.map +1 -0
- package/dist/lib/vault.js +641 -0
- package/dist/tailscale-sw.js +332 -0
- package/package.json +35 -4
- package/dist/components/icon-button.d.ts +0 -19
- package/dist/components/icon-button.d.ts.map +0 -1
- package/dist/components/icon-button.js +0 -31
- package/dist/components/measure-h.d.ts +0 -7
- package/dist/components/measure-h.d.ts.map +0 -1
- package/dist/components/measure-h.js +0 -20
package/dist/lib/cron.js
ADDED
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
//#region src/lib/cron.ts
|
|
2
|
+
var e = [
|
|
3
|
+
{
|
|
4
|
+
name: "minute",
|
|
5
|
+
label: "minute",
|
|
6
|
+
min: 0,
|
|
7
|
+
max: 59
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
name: "hour",
|
|
11
|
+
label: "hour",
|
|
12
|
+
min: 0,
|
|
13
|
+
max: 23
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
name: "dayOfMonth",
|
|
17
|
+
label: "day of month",
|
|
18
|
+
min: 1,
|
|
19
|
+
max: 31
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
name: "month",
|
|
23
|
+
label: "month",
|
|
24
|
+
min: 1,
|
|
25
|
+
max: 12
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
name: "dayOfWeek",
|
|
29
|
+
label: "day of week",
|
|
30
|
+
min: 0,
|
|
31
|
+
max: 7
|
|
32
|
+
}
|
|
33
|
+
], t = {
|
|
34
|
+
"@hourly": "0 * * * *",
|
|
35
|
+
"@daily": "0 0 * * *",
|
|
36
|
+
"@midnight": "0 0 * * *",
|
|
37
|
+
"@weekly": "0 0 * * 0",
|
|
38
|
+
"@monthly": "0 0 1 * *",
|
|
39
|
+
"@yearly": "0 0 1 1 *",
|
|
40
|
+
"@annually": "0 0 1 1 *"
|
|
41
|
+
}, n = [
|
|
42
|
+
"jan",
|
|
43
|
+
"feb",
|
|
44
|
+
"mar",
|
|
45
|
+
"apr",
|
|
46
|
+
"may",
|
|
47
|
+
"jun",
|
|
48
|
+
"jul",
|
|
49
|
+
"aug",
|
|
50
|
+
"sep",
|
|
51
|
+
"oct",
|
|
52
|
+
"nov",
|
|
53
|
+
"dec"
|
|
54
|
+
], r = [
|
|
55
|
+
"sun",
|
|
56
|
+
"mon",
|
|
57
|
+
"tue",
|
|
58
|
+
"wed",
|
|
59
|
+
"thu",
|
|
60
|
+
"fri",
|
|
61
|
+
"sat"
|
|
62
|
+
];
|
|
63
|
+
function i(e) {
|
|
64
|
+
let n = e.trim();
|
|
65
|
+
return n ? (t[n.toLowerCase()] ?? n).split(/\s+/) : [];
|
|
66
|
+
}
|
|
67
|
+
var a = (e) => ({
|
|
68
|
+
ok: !1,
|
|
69
|
+
error: e
|
|
70
|
+
});
|
|
71
|
+
function o(e, t) {
|
|
72
|
+
if (/^\d+$/.test(e)) return Number(e);
|
|
73
|
+
if (t === "month") {
|
|
74
|
+
let t = n.indexOf(e.toLowerCase());
|
|
75
|
+
return t < 0 ? null : t + 1;
|
|
76
|
+
}
|
|
77
|
+
if (t === "dayOfWeek") {
|
|
78
|
+
let t = r.indexOf(e.toLowerCase());
|
|
79
|
+
return t < 0 ? null : t;
|
|
80
|
+
}
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
function s(e, t) {
|
|
84
|
+
let { name: n, min: r, max: i } = t;
|
|
85
|
+
if (!e) return a("Empty");
|
|
86
|
+
let s = /* @__PURE__ */ new Set();
|
|
87
|
+
for (let t of e.split(",")) {
|
|
88
|
+
if (!t) return a("Empty item in a list (a stray comma)");
|
|
89
|
+
let [e, c, ...l] = t.split("/");
|
|
90
|
+
if (l.length) return a(`"${t}" has more than one step`);
|
|
91
|
+
let u = 1;
|
|
92
|
+
if (c !== void 0) {
|
|
93
|
+
if (!/^\d+$/.test(c)) return a(`The step in "${t}" must be a number`);
|
|
94
|
+
if (u = Number(c), u < 1) return a("A step must be at least 1");
|
|
95
|
+
}
|
|
96
|
+
let d, f;
|
|
97
|
+
if (e === "*") d = r, f = n === "dayOfWeek" ? 6 : i;
|
|
98
|
+
else if (e.includes("-")) {
|
|
99
|
+
let [t, s, ...c] = e.split("-"), l = o(t, n), u = o(s, n);
|
|
100
|
+
if (c.length || l === null || u === null) return a(`"${e}" is not a valid range`);
|
|
101
|
+
if (l < r || l > i) return a(`${l} is out of range (${r}–${i})`);
|
|
102
|
+
if (u < r || u > i) return a(`${u} is out of range (${r}–${i})`);
|
|
103
|
+
if (l > u) return a(`The range ${e} runs backwards`);
|
|
104
|
+
d = l, f = u;
|
|
105
|
+
} else {
|
|
106
|
+
if (e === "") return a(`"${t}" is missing a value before the slash`);
|
|
107
|
+
let s = o(e, n);
|
|
108
|
+
if (s === null) return a(`"${e}" is not a number${n === "month" ? " or month name" : n === "dayOfWeek" ? " or weekday name" : ""}`);
|
|
109
|
+
if (s < r || s > i) return a(`${s} is out of range (${r}–${i})`);
|
|
110
|
+
if (c !== void 0) return a(`"${t}": a step needs * or a range (use ${s}-${i}/${u})`);
|
|
111
|
+
d = f = s;
|
|
112
|
+
}
|
|
113
|
+
for (let e = d; e <= f; e += u) s.add(n === "dayOfWeek" && e === 7 ? 0 : e);
|
|
114
|
+
}
|
|
115
|
+
return {
|
|
116
|
+
ok: !0,
|
|
117
|
+
field: {
|
|
118
|
+
values: s,
|
|
119
|
+
star: e.startsWith("*")
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
function c(t) {
|
|
124
|
+
let n = i(t), r = {}, a = [], o = null;
|
|
125
|
+
if (e.forEach((e, t) => {
|
|
126
|
+
let i = n[t];
|
|
127
|
+
if (i === void 0) {
|
|
128
|
+
r[e.name] = null, a.push(null);
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
let o = s(i, e);
|
|
132
|
+
r[e.name] = o.ok ? null : o.error, a.push(o.ok ? o.field : null);
|
|
133
|
+
}), n.length < 5) {
|
|
134
|
+
let t = e.slice(n.length).map((e) => e.label);
|
|
135
|
+
o = n.length ? `Cron needs 5 fields; ${n.length} given. Missing: ${t.join(", ")}.` : "Enter 5 fields: minute, hour, day of month, month, day of week.";
|
|
136
|
+
} else n.length > 5 && (o = `Cron needs 5 fields; ${n.length} given. Seconds and years are not supported.`);
|
|
137
|
+
return {
|
|
138
|
+
parts: n,
|
|
139
|
+
parsed: a,
|
|
140
|
+
validation: {
|
|
141
|
+
valid: o === null && a.every(Boolean),
|
|
142
|
+
parts: n,
|
|
143
|
+
fields: r,
|
|
144
|
+
message: o
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
function l(e) {
|
|
149
|
+
return c(e).validation;
|
|
150
|
+
}
|
|
151
|
+
function u(t) {
|
|
152
|
+
let n = [];
|
|
153
|
+
t.message && n.push({
|
|
154
|
+
field: null,
|
|
155
|
+
message: t.message
|
|
156
|
+
});
|
|
157
|
+
for (let r of e) {
|
|
158
|
+
let e = t.fields[r.name];
|
|
159
|
+
e && n.push({
|
|
160
|
+
field: r.name,
|
|
161
|
+
message: `${d(r.label)}: ${e}`
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
return n;
|
|
165
|
+
}
|
|
166
|
+
var d = (e) => e.charAt(0).toUpperCase() + e.slice(1), f = 864e5, p = /* @__PURE__ */ new Map();
|
|
167
|
+
function m(e) {
|
|
168
|
+
let t = p.get(e);
|
|
169
|
+
return t || (t = new Intl.DateTimeFormat("en-US", {
|
|
170
|
+
timeZone: e,
|
|
171
|
+
hourCycle: "h23",
|
|
172
|
+
year: "numeric",
|
|
173
|
+
month: "numeric",
|
|
174
|
+
day: "numeric",
|
|
175
|
+
hour: "numeric",
|
|
176
|
+
minute: "numeric",
|
|
177
|
+
second: "numeric"
|
|
178
|
+
}), p.set(e, t)), t;
|
|
179
|
+
}
|
|
180
|
+
function h(e, t) {
|
|
181
|
+
let n = m(t).formatToParts(new Date(e)), r = (e) => Number(n.find((t) => t.type === e)?.value);
|
|
182
|
+
return Date.UTC(r("year"), r("month") - 1, r("day"), r("hour") % 24, r("minute"), r("second"));
|
|
183
|
+
}
|
|
184
|
+
function g(e, t) {
|
|
185
|
+
let n = Math.floor(e / 1e3) * 1e3;
|
|
186
|
+
return h(n, t) - n;
|
|
187
|
+
}
|
|
188
|
+
function _(e, t, n) {
|
|
189
|
+
if (t.length === 1) return [e - t[0]];
|
|
190
|
+
let r = [];
|
|
191
|
+
for (let i of t) {
|
|
192
|
+
let t = e - i;
|
|
193
|
+
g(t, n) === i && !r.includes(t) && r.push(t);
|
|
194
|
+
}
|
|
195
|
+
return r.sort((e, t) => e - t);
|
|
196
|
+
}
|
|
197
|
+
function v(e) {
|
|
198
|
+
try {
|
|
199
|
+
return m(e), !0;
|
|
200
|
+
} catch {
|
|
201
|
+
return !1;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
function y() {
|
|
205
|
+
try {
|
|
206
|
+
return new Intl.DateTimeFormat().resolvedOptions().timeZone || "UTC";
|
|
207
|
+
} catch {
|
|
208
|
+
return "UTC";
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
function b(e, t = {}) {
|
|
212
|
+
let { count: n = 5, timeZone: r = y(), horizonDays: i = 3e3 } = t, a = t.from === void 0 ? Date.now() : new Date(t.from).getTime();
|
|
213
|
+
if (!Number.isFinite(a)) throw RangeError("`from` is not a valid date");
|
|
214
|
+
let { parsed: o, parts: s, validation: l } = c(e);
|
|
215
|
+
if (!l.valid || n < 1) return [];
|
|
216
|
+
let [u, d, p, v, b] = o, x = s[0].startsWith("*") || s[1].startsWith("*"), S = [...u.values].sort((e, t) => e - t), C = [...d.values].sort((e, t) => e - t);
|
|
217
|
+
m(r);
|
|
218
|
+
let w = [], T = h(a, r), E = T - (T % f + f) % f;
|
|
219
|
+
for (let e = -1; e <= i && w.length < n; e++) {
|
|
220
|
+
let t = new Date(E + e * f), i = t.getUTCMonth() + 1;
|
|
221
|
+
if (!v.values.has(i)) continue;
|
|
222
|
+
let o = p.values.has(t.getUTCDate()), s = b.values.has(t.getUTCDay());
|
|
223
|
+
if (!(p.star || b.star ? o && s : o || s)) continue;
|
|
224
|
+
let c = t.getTime(), l = [.../* @__PURE__ */ new Set([
|
|
225
|
+
g(c - 504e5, r),
|
|
226
|
+
g(c + 432e5, r),
|
|
227
|
+
g(c + 1368e5, r)
|
|
228
|
+
])], u = [];
|
|
229
|
+
for (let e of C) for (let t of S) {
|
|
230
|
+
let n = c + e * 36e5 + t * 6e4, i = _(n, l, r);
|
|
231
|
+
i.length === 0 ? x || u.push(n - Math.min(...l)) : x ? u.push(...i) : u.push(i[0]);
|
|
232
|
+
}
|
|
233
|
+
u.sort((e, t) => e - t);
|
|
234
|
+
for (let e of u) if (e > a && w[w.length - 1] !== e && w.push(e), w.length >= n) break;
|
|
235
|
+
}
|
|
236
|
+
return w.map((e) => new Date(e));
|
|
237
|
+
}
|
|
238
|
+
var x = null;
|
|
239
|
+
function S() {
|
|
240
|
+
return x ??= import("cronstrue").then((e) => {
|
|
241
|
+
let t = e, n = [
|
|
242
|
+
t.default?.default,
|
|
243
|
+
t.default,
|
|
244
|
+
t
|
|
245
|
+
];
|
|
246
|
+
for (let e of n) {
|
|
247
|
+
let t = e?.toString;
|
|
248
|
+
if (typeof t == "function" && t !== Object.prototype.toString) return t.bind(e);
|
|
249
|
+
}
|
|
250
|
+
throw Error("cronstrue has no toString");
|
|
251
|
+
}).catch((e) => {
|
|
252
|
+
throw x = null, e;
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
async function C(e, { use24HourTime: t = !1 } = {}) {
|
|
256
|
+
let n = l(e);
|
|
257
|
+
if (!n.valid) return null;
|
|
258
|
+
let r = await S();
|
|
259
|
+
try {
|
|
260
|
+
return r(n.parts.join(" "), {
|
|
261
|
+
use24HourTimeFormat: t,
|
|
262
|
+
throwExceptionOnParseError: !0
|
|
263
|
+
});
|
|
264
|
+
} catch {
|
|
265
|
+
return null;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
//#endregion
|
|
269
|
+
export { e as CRON_FIELDS, u as cronProblems, C as describeCron, v as isValidTimeZone, y as localTimeZone, b as nextCronRuns, i as splitCron, l as validateCron };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { PointerEvent as ReactPointerEvent } from 'react';
|
|
2
|
+
export interface EdgeSwipeConfig<C> {
|
|
3
|
+
/** The element whose left edge starts the swipe and whose width is a full swipe. */
|
|
4
|
+
target: () => HTMLElement | null;
|
|
5
|
+
/** Width of the edge zone, px. */
|
|
6
|
+
edge: number;
|
|
7
|
+
/** Fraction of the width past which a release commits. */
|
|
8
|
+
commit: number;
|
|
9
|
+
/** Release speed (px/ms) past which it commits whatever the distance. */
|
|
10
|
+
flick: number;
|
|
11
|
+
/** A press landed in the edge zone: return what the swipe will move (`ctx`), or null to ignore the press. */
|
|
12
|
+
begin: (e: ReactPointerEvent, rect: DOMRect) => C | null;
|
|
13
|
+
/** The drag engaged; runs once, just before the first `move`. */
|
|
14
|
+
engage?: (ctx: C) => void;
|
|
15
|
+
/** The finger moved. `p` is the fraction of the width travelled (0–1), `dx` the distance in px. */
|
|
16
|
+
move: (ctx: C, p: number, dx: number) => void;
|
|
17
|
+
/** The finger lifted (or the pointer was cancelled) after the drag engaged. */
|
|
18
|
+
release: (ctx: C, r: {
|
|
19
|
+
p: number;
|
|
20
|
+
dx: number;
|
|
21
|
+
commit: boolean;
|
|
22
|
+
}) => void;
|
|
23
|
+
/** The press ended without the drag ever engaging (a tap, a vertical drag). */
|
|
24
|
+
abort?: (ctx: C) => void;
|
|
25
|
+
}
|
|
26
|
+
export declare function useEdgeSwipe<C>(config: EdgeSwipeConfig<C>): {
|
|
27
|
+
/** Spread onto the element: `<div {...swipe.bind} />`. The press is seen in the capture phase, because a button
|
|
28
|
+
* inside (react-aria's press handling) stops pointerdown from bubbling. */
|
|
29
|
+
bind: {
|
|
30
|
+
onPointerDownCapture: (e: ReactPointerEvent) => void;
|
|
31
|
+
onPointerMove: (e: ReactPointerEvent) => void;
|
|
32
|
+
onPointerUp: () => void;
|
|
33
|
+
onPointerCancel: () => void;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=edge-swipe.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edge-swipe.d.ts","sourceRoot":"","sources":["../../src/lib/edge-swipe.ts"],"names":[],"mappings":"AACA,OAAO,EAAU,KAAK,YAAY,IAAI,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAcvE,MAAM,WAAW,eAAe,CAAC,CAAC;IAChC,oFAAoF;IACpF,MAAM,EAAE,MAAM,WAAW,GAAG,IAAI,CAAC;IACjC,kCAAkC;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,0DAA0D;IAC1D,MAAM,EAAE,MAAM,CAAC;IACf,yEAAyE;IACzE,KAAK,EAAE,MAAM,CAAC;IACd,6GAA6G;IAC7G,KAAK,EAAE,CAAC,CAAC,EAAE,iBAAiB,EAAE,IAAI,EAAE,OAAO,KAAK,CAAC,GAAG,IAAI,CAAC;IACzD,iEAAiE;IACjE,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,IAAI,CAAC;IAC1B,mGAAmG;IACnG,IAAI,EAAE,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,+EAA+E;IAC/E,OAAO,EAAE,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,OAAO,CAAA;KAAE,KAAK,IAAI,CAAC;IACzE,+EAA+E;IAC/E,KAAK,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,IAAI,CAAC;CAC1B;AAUD,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,eAAe,CAAC,CAAC,CAAC;IAwDtD;gFAC4E;;kCApD7D,iBAAiB;2BAYjB,iBAAiB;;;;EA2CnC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useRef as e } from "react";
|
|
3
|
+
//#region src/lib/edge-swipe.ts
|
|
4
|
+
var t = 8, n = 1.2, r = 14;
|
|
5
|
+
function i(i) {
|
|
6
|
+
let a = e(i);
|
|
7
|
+
a.current = i;
|
|
8
|
+
let o = e(null), s = (e) => {
|
|
9
|
+
if (e.button) return;
|
|
10
|
+
let { target: t, edge: n, begin: r } = a.current, i = t();
|
|
11
|
+
if (!i) return;
|
|
12
|
+
let s = i.getBoundingClientRect();
|
|
13
|
+
if (e.clientX - s.left > n) return;
|
|
14
|
+
let c = r(e, s);
|
|
15
|
+
c != null && (o.current = {
|
|
16
|
+
ctx: c,
|
|
17
|
+
x0: e.clientX,
|
|
18
|
+
y0: e.clientY,
|
|
19
|
+
w: s.width,
|
|
20
|
+
last: e.clientX,
|
|
21
|
+
lt: performance.now(),
|
|
22
|
+
vel: 0,
|
|
23
|
+
dx: 0,
|
|
24
|
+
on: !1
|
|
25
|
+
});
|
|
26
|
+
}, c = (e) => {
|
|
27
|
+
let i = o.current;
|
|
28
|
+
if (!i) return;
|
|
29
|
+
let s = e.clientX - i.x0, c = e.clientY - i.y0;
|
|
30
|
+
if (!i.on) {
|
|
31
|
+
if (s > t && s > Math.abs(c) * n) {
|
|
32
|
+
i.on = !0;
|
|
33
|
+
try {
|
|
34
|
+
a.current.target()?.setPointerCapture(e.pointerId);
|
|
35
|
+
} catch {}
|
|
36
|
+
a.current.engage?.(i.ctx);
|
|
37
|
+
} else {
|
|
38
|
+
Math.abs(c) > r && (o.current = null);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
let l = Math.max(0, s);
|
|
43
|
+
i.dx = l, i.vel = (e.clientX - i.last) / Math.max(1, performance.now() - i.lt), i.last = e.clientX, i.lt = performance.now();
|
|
44
|
+
try {
|
|
45
|
+
a.current.move(i.ctx, l / i.w, l);
|
|
46
|
+
} catch (e) {
|
|
47
|
+
o.current = null, typeof reportError == "function" ? reportError(e) : console.error(e);
|
|
48
|
+
}
|
|
49
|
+
}, l = () => {
|
|
50
|
+
let e = o.current;
|
|
51
|
+
if (!e) return;
|
|
52
|
+
o.current = null;
|
|
53
|
+
let { commit: t, flick: n, abort: r, release: i } = a.current;
|
|
54
|
+
if (!e.on) {
|
|
55
|
+
r?.(e.ctx);
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
let s = e.dx / e.w;
|
|
59
|
+
i(e.ctx, {
|
|
60
|
+
p: s,
|
|
61
|
+
dx: e.dx,
|
|
62
|
+
commit: s > t || e.vel > n
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
return { bind: {
|
|
66
|
+
onPointerDownCapture: s,
|
|
67
|
+
onPointerMove: c,
|
|
68
|
+
onPointerUp: l,
|
|
69
|
+
onPointerCancel: l
|
|
70
|
+
} };
|
|
71
|
+
}
|
|
72
|
+
//#endregion
|
|
73
|
+
export { i as useEdgeSwipe };
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { DropItem } from 'react-aria-components';
|
|
2
|
+
export type FileStatus = 'queued' | 'uploading' | 'done' | 'error' | 'rejected';
|
|
3
|
+
export type RejectionCode = 'type' | 'too-large' | 'too-small' | 'too-many' | 'duplicate' | 'invalid';
|
|
4
|
+
export interface UploadFile {
|
|
5
|
+
id: string;
|
|
6
|
+
file: File;
|
|
7
|
+
/** The name, or the path inside a picked or dropped folder ("photos/2024/a.jpg"). */
|
|
8
|
+
path: string;
|
|
9
|
+
status: FileStatus;
|
|
10
|
+
/** 0–1. */
|
|
11
|
+
progress: number;
|
|
12
|
+
/** Why it failed (`error`) or was turned away (`rejected`). */
|
|
13
|
+
error?: string;
|
|
14
|
+
/** For `rejected` files, which rule said no. */
|
|
15
|
+
reason?: RejectionCode;
|
|
16
|
+
/** What `upload` resolved with. */
|
|
17
|
+
url?: string;
|
|
18
|
+
}
|
|
19
|
+
/** A file together with where it came from inside a folder. */
|
|
20
|
+
export interface FileEntry {
|
|
21
|
+
file: File;
|
|
22
|
+
path: string;
|
|
23
|
+
}
|
|
24
|
+
export interface UploadContext {
|
|
25
|
+
id: string;
|
|
26
|
+
path: string;
|
|
27
|
+
/** Aborted when the file is removed or the component unmounts. Pass it to `fetch` / honor it in your own code. */
|
|
28
|
+
signal: AbortSignal;
|
|
29
|
+
/** Report 0–1 as bytes go out. */
|
|
30
|
+
onProgress: (progress: number) => void;
|
|
31
|
+
}
|
|
32
|
+
export interface UploadResult {
|
|
33
|
+
url?: string;
|
|
34
|
+
}
|
|
35
|
+
export type UploadFn = (file: File, context: UploadContext) => Promise<UploadResult | void>;
|
|
36
|
+
export interface RejectionContext {
|
|
37
|
+
file: File;
|
|
38
|
+
path: string;
|
|
39
|
+
accept?: readonly string[];
|
|
40
|
+
maxSize?: number;
|
|
41
|
+
minSize?: number;
|
|
42
|
+
maxFiles?: number;
|
|
43
|
+
}
|
|
44
|
+
export type RejectionMessages = Partial<Record<RejectionCode, string | ((ctx: RejectionContext) => string)>>;
|
|
45
|
+
export interface FileRules {
|
|
46
|
+
/** MIME types (`application/pdf`), wildcards (`image/*`) and extensions (`.md`), as in `<input accept>`. */
|
|
47
|
+
accept?: readonly string[];
|
|
48
|
+
/** Bytes. */
|
|
49
|
+
maxSize?: number;
|
|
50
|
+
minSize?: number;
|
|
51
|
+
/** How many files the list may hold (rejected ones don't count). */
|
|
52
|
+
maxFiles?: number;
|
|
53
|
+
/** Let the same file (path, size, modified time) be added twice. Default false. */
|
|
54
|
+
allowDuplicates?: boolean;
|
|
55
|
+
/** Your own rule: return a message (or `false`) to reject, nothing to accept. */
|
|
56
|
+
validate?: (file: File, context: {
|
|
57
|
+
path: string;
|
|
58
|
+
files: readonly UploadFile[];
|
|
59
|
+
}) => string | false | null | undefined | void;
|
|
60
|
+
/** Override the reason shown for a rule. */
|
|
61
|
+
messages?: RejectionMessages;
|
|
62
|
+
}
|
|
63
|
+
/** Splits an `accept` string ("image/*, .pdf") into tokens; arrays pass through. */
|
|
64
|
+
export declare function parseAccept(accept: string | readonly string[] | undefined): string[];
|
|
65
|
+
/**
|
|
66
|
+
* Whether a file passes an accept list, the way `<input accept>` reads it: `.ext` matches the name's ending,
|
|
67
|
+
* `type/*` the MIME type's family, `type/sub` the exact type. No list, or a bare `*`, accepts everything.
|
|
68
|
+
* Browsers leave `type` blank for many files, so extensions are the dependable half.
|
|
69
|
+
*/
|
|
70
|
+
export declare function matchesAccept(file: {
|
|
71
|
+
name: string;
|
|
72
|
+
type?: string;
|
|
73
|
+
}, accept: string | readonly string[] | undefined): boolean;
|
|
74
|
+
/** A short description of an accept list: "Images, PDFs and .md files"; "Any file" with none. */
|
|
75
|
+
export declare function describeAccept(accept: string | readonly string[] | undefined): string;
|
|
76
|
+
/** The rules as a hint line: "Images and PDFs · up to 5 MB each · up to 5 files". Empty with no rules. */
|
|
77
|
+
export declare function describeRules(rules: Pick<FileRules, 'accept' | 'maxSize' | 'minSize' | 'maxFiles'>): string;
|
|
78
|
+
export type FileKind = 'image' | 'video' | 'audio' | 'pdf' | 'text' | 'archive' | 'other';
|
|
79
|
+
/** What a file is, from its MIME type with the name's extension as the fallback (browsers leave many types blank). */
|
|
80
|
+
export declare function fileKind(file: {
|
|
81
|
+
name: string;
|
|
82
|
+
type?: string;
|
|
83
|
+
}): FileKind;
|
|
84
|
+
/** A unique id for a list entry (not cryptographic; this is a React key, not a secret). */
|
|
85
|
+
export declare function newFileId(): string;
|
|
86
|
+
/** The message for a rule, honoring overrides. */
|
|
87
|
+
export declare function rejectionMessage(code: RejectionCode, ctx: RejectionContext, overrides?: RejectionMessages): string;
|
|
88
|
+
/** Normalizes what `add` accepts (a FileList, Files, or entries from a folder) to entries. */
|
|
89
|
+
export declare function toEntries(input: ArrayLike<File | FileEntry>): FileEntry[];
|
|
90
|
+
/**
|
|
91
|
+
* Checks files against the rules, in order: type, size, duplicates, your `validate`, then the count. Returns one
|
|
92
|
+
* entry per file: `queued` ones passed, `rejected` ones carry a `reason` and a message. `existing` is the
|
|
93
|
+
* current list (for duplicates and the count). Pure: nothing is added anywhere.
|
|
94
|
+
*/
|
|
95
|
+
export declare function validateFiles(entries: readonly FileEntry[], existing: readonly UploadFile[], rules?: FileRules): UploadFile[];
|
|
96
|
+
/** Entries for a native file list; a folder picked with `acceptDirectory` keeps its relative paths (minus dotfiles unless `skipHidden` is false). */
|
|
97
|
+
export declare function entriesFromFileList(list: FileList | readonly File[] | null | undefined, { skipHidden }?: {
|
|
98
|
+
skipHidden?: boolean | undefined;
|
|
99
|
+
}): FileEntry[];
|
|
100
|
+
export interface ReadDropOptions {
|
|
101
|
+
/** Stop after this many files (default 1000) and report `truncated`. */
|
|
102
|
+
limit?: number;
|
|
103
|
+
/** Skip dotfiles found inside a dropped folder (`.DS_Store`, `.git`). Files dropped by themselves are kept. Default true. */
|
|
104
|
+
skipHidden?: boolean;
|
|
105
|
+
/** Read dropped folders (default true). Off, folders are skipped and counted in `skippedFolders`. */
|
|
106
|
+
directories?: boolean;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* The files in react-aria's drop items. Folders are read recursively and flattened, each file keeping its path
|
|
110
|
+
* relative to the dropped folder ("photos/2024/a.jpg"); text and other non-file items are ignored. Entries come
|
|
111
|
+
* from `webkitGetAsEntry`, so it works wherever react-aria's drop target does (not on every touch browser).
|
|
112
|
+
*/
|
|
113
|
+
export declare function readDropItems(items: Iterable<DropItem>, { limit, skipHidden, directories }?: ReadDropOptions): Promise<{
|
|
114
|
+
entries: FileEntry[];
|
|
115
|
+
truncated: boolean;
|
|
116
|
+
skippedFolders: number;
|
|
117
|
+
}>;
|
|
118
|
+
export interface XhrUploadOptions {
|
|
119
|
+
/** Default `POST` (`PUT` for a presigned URL). */
|
|
120
|
+
method?: string;
|
|
121
|
+
/** Request headers. Leave `Content-Type` out for multipart: the browser adds the boundary. */
|
|
122
|
+
headers?: Record<string, string>;
|
|
123
|
+
/** The multipart field the file goes in. Default `file`. */
|
|
124
|
+
fieldName?: string;
|
|
125
|
+
/** More multipart fields, or a function of the file. */
|
|
126
|
+
extraFields?: Record<string, string> | ((file: File) => Record<string, string>);
|
|
127
|
+
/** `form-data` (default) sends multipart; `raw` sends the file itself as the body (S3-style presigned PUT). */
|
|
128
|
+
body?: 'form-data' | 'raw';
|
|
129
|
+
withCredentials?: boolean;
|
|
130
|
+
/** Milliseconds before giving up (default: none). */
|
|
131
|
+
timeout?: number;
|
|
132
|
+
/** Read the result from the response. Default: JSON `{ url }` / `{ location }`, else the `Location` header. */
|
|
133
|
+
parseResponse?: (xhr: XMLHttpRequest) => UploadResult | void;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* An `upload` function that sends the file with XMLHttpRequest, reporting real progress (`fetch` cannot). Rejects
|
|
137
|
+
* with a readable `Error` on a non-2xx status, a network error or a timeout, and with an `AbortError` when the
|
|
138
|
+
* signal fires. `url` may be a function of the file (to ask your server for a presigned URL first, make `upload`
|
|
139
|
+
* yourself and call `xhrUpload(presigned)(file, ctx)`).
|
|
140
|
+
*/
|
|
141
|
+
export declare function xhrUpload(url: string | ((file: File) => string), options?: XhrUploadOptions): UploadFn;
|
|
142
|
+
export interface UseFileUploadOptions extends FileRules {
|
|
143
|
+
/** Sends one file. Without it, files are validated and listed but never sent (you submit them yourself). */
|
|
144
|
+
upload?: UploadFn;
|
|
145
|
+
/** Start sending as soon as files are added. Default true; false waits for `uploadAll()` (or `retry`). */
|
|
146
|
+
autoUpload?: boolean;
|
|
147
|
+
/** How many uploads run at once. Default 3. */
|
|
148
|
+
concurrency?: number;
|
|
149
|
+
/** Controlled list. */
|
|
150
|
+
files?: UploadFile[];
|
|
151
|
+
defaultFiles?: UploadFile[];
|
|
152
|
+
onFilesChange?: (files: UploadFile[]) => void;
|
|
153
|
+
/** After `add`: the files that were queued and the ones turned away. */
|
|
154
|
+
onAdd?: (added: UploadFile[], rejected: UploadFile[]) => void;
|
|
155
|
+
onRemove?: (file: UploadFile) => void;
|
|
156
|
+
onUploaded?: (file: UploadFile) => void;
|
|
157
|
+
onUploadError?: (file: UploadFile, error: unknown) => void;
|
|
158
|
+
}
|
|
159
|
+
export interface FileUploadState {
|
|
160
|
+
files: UploadFile[];
|
|
161
|
+
/** Validates and lists files (and starts sending them when `autoUpload`). Returns what happened to each. */
|
|
162
|
+
add: (input: ArrayLike<File | FileEntry>) => {
|
|
163
|
+
added: UploadFile[];
|
|
164
|
+
rejected: UploadFile[];
|
|
165
|
+
};
|
|
166
|
+
/** Drops a file from the list; an upload in flight is aborted. */
|
|
167
|
+
remove: (id: string) => void;
|
|
168
|
+
/** Queues a failed upload again (even without `autoUpload`). */
|
|
169
|
+
retry: (id: string) => void;
|
|
170
|
+
/** Empties the list, aborting everything in flight. */
|
|
171
|
+
clear: () => void;
|
|
172
|
+
/** Starts every queued file (with `autoUpload` off), respecting the concurrency limit. */
|
|
173
|
+
uploadAll: () => void;
|
|
174
|
+
/** Whether anything is queued or sending. */
|
|
175
|
+
isBusy: boolean;
|
|
176
|
+
counts: Record<FileStatus, number>;
|
|
177
|
+
/** The rules in force (for hints). */
|
|
178
|
+
rules: Pick<FileRules, 'accept' | 'maxSize' | 'minSize' | 'maxFiles'>;
|
|
179
|
+
}
|
|
180
|
+
export declare function useFileUpload(options?: UseFileUploadOptions): FileUploadState;
|
|
181
|
+
/**
|
|
182
|
+
* An object URL for previewing a file (an image thumbnail), made when the component mounts and revoked when the
|
|
183
|
+
* file changes or the component unmounts — so removing a row frees its preview. `undefined` until it exists and
|
|
184
|
+
* wherever object URLs aren't available (server render, tests without `URL.createObjectURL`).
|
|
185
|
+
*/
|
|
186
|
+
export declare function useFilePreview(file: Blob | undefined, enabled?: boolean): string | undefined;
|
|
187
|
+
//# sourceMappingURL=file-upload.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-upload.d.ts","sourceRoot":"","sources":["../../src/lib/file-upload.ts"],"names":[],"mappings":"AAGA,OAAO,EAAuC,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAkB3F,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,WAAW,GAAG,MAAM,GAAG,OAAO,GAAG,UAAU,CAAC;AAChF,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,WAAW,GAAG,WAAW,GAAG,UAAU,GAAG,WAAW,GAAG,SAAS,CAAC;AAEtG,MAAM,WAAW,UAAU;I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