@openrails/contentkit-ui 0.68.0 → 0.69.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 +55 -10
- package/dist/client/client.d.ts +4 -2
- package/dist/client/client.js +1 -0
- package/dist/client/client.js.map +1 -1
- package/dist/client/content/bans.js +7 -7
- package/dist/client/content/bans.js.map +1 -1
- package/dist/client/content/comments.js +16 -14
- package/dist/client/content/comments.js.map +1 -1
- package/dist/client/content/favorites.js +5 -5
- package/dist/client/content/favorites.js.map +1 -1
- package/dist/client/content/moderation.js +5 -5
- package/dist/client/content/moderation.js.map +1 -1
- package/dist/client/content/polls.js +34 -31
- package/dist/client/content/polls.js.map +1 -1
- package/dist/client/content/posts.js +21 -20
- package/dist/client/content/posts.js.map +1 -1
- package/dist/client/content/reactions.js +4 -4
- package/dist/client/content/reactions.js.map +1 -1
- package/dist/client/generated/error-codes.d.ts +1 -1
- package/dist/client/generated/error-codes.js +4 -0
- package/dist/client/generated/error-codes.js.map +1 -1
- package/dist/client/generated/routes.js.map +1 -1
- package/dist/client/http.d.ts +6 -2
- package/dist/client/http.js +11 -3
- package/dist/client/http.js.map +1 -1
- package/dist/client/media/client.js +24 -24
- package/dist/client/media/client.js.map +1 -1
- package/dist/client/media/rules.d.ts +2 -0
- package/dist/client/media/rules.js +6 -2
- package/dist/client/media/rules.js.map +1 -1
- package/dist/client/taxonomy.js +2 -2
- package/dist/client/taxonomy.js.map +1 -1
- package/dist/components/media-folder-editor.d.ts +17 -3
- package/dist/components/media-folder-editor.js +146 -99
- package/dist/components/media-folder-editor.js.map +1 -1
- package/dist/components/slot-upload.js +102 -100
- package/dist/components/slot-upload.js.map +1 -1
- package/dist/locales/de.js +1 -0
- package/dist/locales/de.js.map +1 -1
- package/dist/locales/en.d.ts +1 -0
- package/dist/locales/en.js +1 -0
- package/dist/locales/en.js.map +1 -1
- package/dist/locales/es.js +1 -0
- package/dist/locales/es.js.map +1 -1
- package/dist/locales/ja.js +1 -0
- package/dist/locales/ja.js.map +1 -1
- package/dist/locales/ko.js +1 -0
- package/dist/locales/ko.js.map +1 -1
- package/dist/locales/zh.js +1 -0
- package/dist/locales/zh.js.map +1 -1
- package/dist/react/canonical.d.ts +2 -2
- package/dist/react/canonical.js +2 -12
- package/dist/react/canonical.js.map +1 -1
- package/dist/react/comments.js +35 -27
- package/dist/react/comments.js.map +1 -1
- package/dist/react/context.d.ts +7 -0
- package/dist/react/context.js +20 -15
- package/dist/react/context.js.map +1 -1
- package/dist/react/engagement.js +2 -2
- package/dist/react/engagement.js.map +1 -1
- package/dist/react/folder.d.ts +29 -9
- package/dist/react/folder.js +170 -113
- package/dist/react/folder.js.map +1 -1
- package/dist/react/polls.js +3 -3
- package/dist/react/polls.js.map +1 -1
- package/dist/react/posts.js +2 -2
- package/dist/react/posts.js.map +1 -1
- package/dist/react/provider.d.ts +7 -3
- package/dist/react/provider.js +34 -20
- package/dist/react/provider.js.map +1 -1
- package/dist/react/public.js +11 -11
- package/dist/react/public.js.map +1 -1
- package/dist/react/read.js +93 -92
- package/dist/react/read.js.map +1 -1
- package/dist/react/resources.d.ts +6 -3
- package/dist/react/resources.js +40 -40
- package/dist/react/resources.js.map +1 -1
- package/dist/react/slot.d.ts +4 -2
- package/dist/react/slot.js +96 -92
- package/dist/react/slot.js.map +1 -1
- package/dist/react/store.d.ts +1 -1
- package/dist/react/store.js +21 -20
- package/dist/react/store.js.map +1 -1
- package/dist/react/upload.d.ts +3 -2
- package/dist/react/upload.js +20 -15
- package/dist/react/upload.js.map +1 -1
- package/dist/react/use-resource.d.ts +1 -0
- package/dist/react/use-resource.js +38 -30
- package/dist/react/use-resource.js.map +1 -1
- package/dist/react.js +15 -15
- package/package.json +7 -5
|
@@ -57,39 +57,66 @@ function ae(e, t) {
|
|
|
57
57
|
return n.join(" · ");
|
|
58
58
|
}
|
|
59
59
|
function q(e) {
|
|
60
|
-
|
|
60
|
+
if (e.folder) {
|
|
61
|
+
let { folder: t, ...n } = e;
|
|
62
|
+
return /* @__PURE__ */ A(J, {
|
|
63
|
+
folder: t,
|
|
64
|
+
...n
|
|
65
|
+
}, t.ref ? `${t.ref.kind}/${t.ref.id}` : "");
|
|
66
|
+
}
|
|
67
|
+
return /* @__PURE__ */ A(oe, { ...e }, `${e.item.kind}/${e.item.id}`);
|
|
68
|
+
}
|
|
69
|
+
function oe(e) {
|
|
70
|
+
let { item: t, ref: n, label: r, toolbar: i, rowActions: a, footer: o, aspects: s, confirmRemove: c, disabled: l, className: u, appearance: d, ...f } = e, p = C(t, f);
|
|
71
|
+
return /* @__PURE__ */ A(J, {
|
|
72
|
+
folder: p,
|
|
73
|
+
ref: n,
|
|
74
|
+
label: r,
|
|
75
|
+
toolbar: i,
|
|
76
|
+
rowActions: a,
|
|
77
|
+
footer: o,
|
|
78
|
+
aspects: s,
|
|
79
|
+
confirmRemove: c,
|
|
80
|
+
disabled: l,
|
|
81
|
+
className: u,
|
|
82
|
+
appearance: d
|
|
83
|
+
});
|
|
61
84
|
}
|
|
85
|
+
var se = {
|
|
86
|
+
kind: "",
|
|
87
|
+
id: ""
|
|
88
|
+
};
|
|
62
89
|
function J(e) {
|
|
63
|
-
let {
|
|
90
|
+
let { folder: t, ref: r, label: i, toolbar: s, rowActions: c, footer: l, aspects: m = ie, confirmRemove: h, disabled: g, className: _, appearance: v } = e, { t: y, error: x } = a(), { groups: S, queue: C, read: D, options: k } = t;
|
|
64
91
|
E(r, () => ({
|
|
65
|
-
discard:
|
|
66
|
-
commit:
|
|
67
|
-
folder:
|
|
68
|
-
}), [
|
|
69
|
-
let
|
|
92
|
+
discard: t.discard,
|
|
93
|
+
commit: t.commit,
|
|
94
|
+
folder: t
|
|
95
|
+
}), [t]);
|
|
96
|
+
let P = k.commit === "auto", I = S.flatMap((e) => e.rule ? [e.rule] : []), L = n(I), R = t.uploads.length + C.items.length + t.waiting.length === 0, z = !!g, [B, V] = O(/* @__PURE__ */ new Set());
|
|
70
97
|
T(() => {
|
|
71
|
-
let e = new Set(
|
|
72
|
-
|
|
73
|
-
}, [
|
|
74
|
-
let [
|
|
75
|
-
client:
|
|
76
|
-
onError:
|
|
77
|
-
onSaved: () =>
|
|
78
|
-
}),
|
|
98
|
+
let e = new Set(t.uploads.map((e) => e.path));
|
|
99
|
+
V((t) => [...t].every((t) => e.has(t)) ? t : new Set([...t].filter((t) => e.has(t))));
|
|
100
|
+
}, [t.uploads]);
|
|
101
|
+
let [H, G] = O(null), K = b(t.ref ?? se, H, {
|
|
102
|
+
client: k.client,
|
|
103
|
+
onError: k.onError,
|
|
104
|
+
onSaved: () => G(null)
|
|
105
|
+
}), q = H ? S.find((e) => e.files.some((e) => e.path === H))?.rule : void 0, [oe, J] = O(null), X = te(null), [Z, Q] = O(null), [ue, $] = O(!1), de = {
|
|
79
106
|
onDragOver: (e) => {
|
|
80
|
-
!
|
|
107
|
+
!z && e.dataTransfer.types.includes("Files") && (e.preventDefault(), $(!0));
|
|
81
108
|
},
|
|
82
109
|
onDragLeave: (e) => {
|
|
83
110
|
e.currentTarget.contains(e.relatedTarget) || $(!1);
|
|
84
111
|
},
|
|
85
112
|
onDrop: (e) => {
|
|
86
|
-
!
|
|
113
|
+
!z && e.dataTransfer.files.length && (e.preventDefault(), $(!1), t.add(e.dataTransfer.files));
|
|
87
114
|
}
|
|
88
|
-
},
|
|
89
|
-
let e = [...
|
|
90
|
-
(h === !1 || (h ? await h(e.length) : globalThis.confirm?.(
|
|
91
|
-
},
|
|
92
|
-
className: M(e ? "flex cursor-pointer flex-col items-center justify-center gap-2 rounded-lg border border-dashed border-border px-4 py-8 text-center text-sm text-muted-foreground transition-colors hover:border-primary hover:bg-primary/5" : "inline-flex h-8 cursor-pointer items-center gap-1.5 rounded-md border border-border bg-background px-2.5 text-sm font-medium transition-colors hover:bg-muted focus-within:ring-3 focus-within:ring-ring/50", e &&
|
|
115
|
+
}, fe = async () => {
|
|
116
|
+
let e = [...B];
|
|
117
|
+
(h === !1 || (h ? await h(e.length) : globalThis.confirm?.(y("folder.confirmRemove", { count: e.length })) ?? !0)) && await t.remove(e).then(() => V(/* @__PURE__ */ new Set()), () => {});
|
|
118
|
+
}, pe = C.items.filter((e) => e.status === "uploaded").length, me = (e) => /* @__PURE__ */ j("label", {
|
|
119
|
+
className: M(e ? "flex cursor-pointer flex-col items-center justify-center gap-2 rounded-lg border border-dashed border-border px-4 py-8 text-center text-sm text-muted-foreground transition-colors hover:border-primary hover:bg-primary/5" : "inline-flex h-8 cursor-pointer items-center gap-1.5 rounded-md border border-border bg-background px-2.5 text-sm font-medium transition-colors hover:bg-muted focus-within:ring-3 focus-within:ring-ring/50", e && ue && "border-primary bg-primary/5", z && "pointer-events-none opacity-50"),
|
|
93
120
|
"data-ckui": e ? "folder-drop" : "folder-add",
|
|
94
121
|
children: [
|
|
95
122
|
/* @__PURE__ */ A(U, {
|
|
@@ -99,21 +126,21 @@ function J(e) {
|
|
|
99
126
|
}),
|
|
100
127
|
e ? /* @__PURE__ */ A("strong", {
|
|
101
128
|
className: "font-medium text-foreground",
|
|
102
|
-
children:
|
|
103
|
-
}) :
|
|
104
|
-
e &&
|
|
129
|
+
children: y("folder.drop")
|
|
130
|
+
}) : y("folder.add"),
|
|
131
|
+
e && I.length > 0 && /* @__PURE__ */ A("span", {
|
|
105
132
|
className: "text-xs",
|
|
106
|
-
children: ae(
|
|
133
|
+
children: ae(y, I)
|
|
107
134
|
}),
|
|
108
135
|
/* @__PURE__ */ A("input", {
|
|
109
136
|
type: "file",
|
|
110
137
|
multiple: !0,
|
|
111
|
-
accept:
|
|
138
|
+
accept: L,
|
|
112
139
|
className: "sr-only",
|
|
113
|
-
disabled:
|
|
140
|
+
disabled: z,
|
|
114
141
|
"data-ckui": "file",
|
|
115
142
|
onChange: (e) => {
|
|
116
|
-
|
|
143
|
+
t.add([...e.target.files ?? []]), e.target.value = "";
|
|
117
144
|
}
|
|
118
145
|
})
|
|
119
146
|
]
|
|
@@ -122,22 +149,22 @@ function J(e) {
|
|
|
122
149
|
appearance: v,
|
|
123
150
|
className: M("grid gap-3", _),
|
|
124
151
|
"data-ckui": "media-folder",
|
|
125
|
-
"data-over":
|
|
126
|
-
...
|
|
152
|
+
"data-over": ue ? "" : void 0,
|
|
153
|
+
...de,
|
|
127
154
|
children: [
|
|
128
155
|
/* @__PURE__ */ j("div", {
|
|
129
156
|
className: "flex flex-wrap items-center justify-between gap-2",
|
|
130
157
|
"data-ckui": "folder-header",
|
|
131
158
|
children: [/* @__PURE__ */ A("h3", {
|
|
132
159
|
className: "text-sm font-semibold",
|
|
133
|
-
children: i ??
|
|
160
|
+
children: i ?? y("folder.label")
|
|
134
161
|
}), /* @__PURE__ */ j("div", {
|
|
135
162
|
className: "flex flex-wrap items-center gap-2",
|
|
136
|
-
children: [s, !
|
|
163
|
+
children: [s, !R && me(!1)]
|
|
137
164
|
})]
|
|
138
165
|
}),
|
|
139
|
-
|
|
140
|
-
|
|
166
|
+
R && (D.read || !t.ref) && me(!0),
|
|
167
|
+
R && !D.read && D.loading && /* @__PURE__ */ A("div", {
|
|
141
168
|
className: "flex justify-center py-6 text-muted-foreground",
|
|
142
169
|
"data-ckui": "folder-loading",
|
|
143
170
|
children: /* @__PURE__ */ A(U, {
|
|
@@ -146,7 +173,7 @@ function J(e) {
|
|
|
146
173
|
className: "size-5 motion-safe:animate-spin"
|
|
147
174
|
})
|
|
148
175
|
}),
|
|
149
|
-
|
|
176
|
+
t.refused.length > 0 && /* @__PURE__ */ j(u, {
|
|
150
177
|
variant: "destructive",
|
|
151
178
|
role: "alert",
|
|
152
179
|
"data-ckui": "folder-refused",
|
|
@@ -155,23 +182,23 @@ function J(e) {
|
|
|
155
182
|
strokeWidth: 2
|
|
156
183
|
}), /* @__PURE__ */ j(d, { children: [/* @__PURE__ */ A("ul", {
|
|
157
184
|
className: "grid gap-0.5",
|
|
158
|
-
children:
|
|
185
|
+
children: t.refused.map((e, t) => /* @__PURE__ */ j("li", { children: [
|
|
159
186
|
/* @__PURE__ */ A("span", {
|
|
160
187
|
className: "font-medium",
|
|
161
188
|
children: e.file.name
|
|
162
189
|
}),
|
|
163
190
|
": ",
|
|
164
|
-
|
|
191
|
+
x(e.error)
|
|
165
192
|
] }, t))
|
|
166
193
|
}), /* @__PURE__ */ A(p, {
|
|
167
194
|
variant: "outline",
|
|
168
195
|
size: "xs",
|
|
169
196
|
className: "mt-1 w-fit",
|
|
170
|
-
onClick:
|
|
171
|
-
children:
|
|
197
|
+
onClick: t.dismiss,
|
|
198
|
+
children: y("folder.dismiss")
|
|
172
199
|
})] })]
|
|
173
200
|
}),
|
|
174
|
-
|
|
201
|
+
C.blocked && /* @__PURE__ */ j(u, {
|
|
175
202
|
variant: "destructive",
|
|
176
203
|
role: "alert",
|
|
177
204
|
"data-ckui": "folder-paused",
|
|
@@ -180,126 +207,146 @@ function J(e) {
|
|
|
180
207
|
icon: N,
|
|
181
208
|
strokeWidth: 2
|
|
182
209
|
}),
|
|
183
|
-
/* @__PURE__ */ A(f, { children:
|
|
184
|
-
/* @__PURE__ */ j(d, { children: [
|
|
210
|
+
/* @__PURE__ */ A(f, { children: y("folder.paused") }),
|
|
211
|
+
/* @__PURE__ */ j(d, { children: [x(C.blocked), /* @__PURE__ */ A(p, {
|
|
185
212
|
variant: "outline",
|
|
186
213
|
size: "xs",
|
|
187
214
|
className: "mt-1 w-fit",
|
|
188
|
-
onClick: () =>
|
|
189
|
-
children:
|
|
215
|
+
onClick: () => C.start(),
|
|
216
|
+
children: y("folder.resume")
|
|
190
217
|
})] })
|
|
191
218
|
]
|
|
192
219
|
}),
|
|
193
|
-
|
|
220
|
+
t.error && /* @__PURE__ */ j(u, {
|
|
194
221
|
variant: "destructive",
|
|
195
222
|
role: "alert",
|
|
196
223
|
"data-ckui": "folder-error",
|
|
197
224
|
children: [/* @__PURE__ */ A(U, {
|
|
198
225
|
icon: N,
|
|
199
226
|
strokeWidth: 2
|
|
200
|
-
}), /* @__PURE__ */ A(d, { children:
|
|
227
|
+
}), /* @__PURE__ */ A(d, { children: x(t.error) })]
|
|
201
228
|
}),
|
|
202
|
-
|
|
229
|
+
B.size > 0 && /* @__PURE__ */ j("div", {
|
|
203
230
|
className: "flex flex-wrap items-center gap-2 rounded-md bg-muted px-3 py-1.5 text-sm",
|
|
204
231
|
"data-ckui": "folder-selection",
|
|
205
232
|
children: [
|
|
206
233
|
/* @__PURE__ */ A("span", {
|
|
207
234
|
className: "tabular-nums",
|
|
208
|
-
children:
|
|
235
|
+
children: y("folder.selected", { count: B.size })
|
|
209
236
|
}),
|
|
210
237
|
/* @__PURE__ */ j(p, {
|
|
211
238
|
variant: "destructive",
|
|
212
239
|
size: "xs",
|
|
213
|
-
disabled:
|
|
214
|
-
onClick: () => void
|
|
240
|
+
disabled: z || t.updating,
|
|
241
|
+
onClick: () => void fe(),
|
|
215
242
|
children: [/* @__PURE__ */ A(U, {
|
|
216
243
|
icon: F,
|
|
217
244
|
strokeWidth: 2
|
|
218
|
-
}),
|
|
245
|
+
}), y("folder.removeSelected")]
|
|
219
246
|
}),
|
|
220
247
|
/* @__PURE__ */ A(p, {
|
|
221
248
|
variant: "ghost",
|
|
222
249
|
size: "xs",
|
|
223
|
-
onClick: () =>
|
|
224
|
-
children:
|
|
250
|
+
onClick: () => V(/* @__PURE__ */ new Set()),
|
|
251
|
+
children: y("folder.clearSelection")
|
|
225
252
|
})
|
|
226
253
|
]
|
|
227
254
|
}),
|
|
228
|
-
|
|
255
|
+
S.map((e) => e.files.length ? /* @__PURE__ */ A(ce, {
|
|
229
256
|
group: e,
|
|
230
|
-
titled:
|
|
231
|
-
folder:
|
|
232
|
-
disabled:
|
|
233
|
-
selected:
|
|
234
|
-
onSelect: (e, t) =>
|
|
235
|
-
renaming:
|
|
236
|
-
onRename:
|
|
237
|
-
onCrop:
|
|
257
|
+
titled: S.length > 1,
|
|
258
|
+
folder: t,
|
|
259
|
+
disabled: z,
|
|
260
|
+
selected: B,
|
|
261
|
+
onSelect: (e, t) => V((n) => t ? /* @__PURE__ */ new Set([...n, e]) : new Set([...n].filter((t) => t !== e))),
|
|
262
|
+
renaming: oe,
|
|
263
|
+
onRename: J,
|
|
264
|
+
onCrop: G,
|
|
238
265
|
onReplace: (e) => {
|
|
239
266
|
Q(e), X.current?.click();
|
|
240
267
|
},
|
|
241
268
|
rowActions: c
|
|
242
269
|
}, e.path) : null),
|
|
243
|
-
|
|
244
|
-
|
|
270
|
+
t.waiting.length > 0 && /* @__PURE__ */ A("ul", {
|
|
271
|
+
className: "grid",
|
|
272
|
+
"aria-label": y("folder.label"),
|
|
273
|
+
children: t.waiting.map((e, t) => /* @__PURE__ */ j("li", {
|
|
274
|
+
className: "flex min-h-11 items-center gap-2 px-1",
|
|
275
|
+
"data-ckui": "queue-row",
|
|
276
|
+
"data-status": "waiting",
|
|
277
|
+
children: [/* @__PURE__ */ A(Y, { kind: W(e.type) }), /* @__PURE__ */ j("div", {
|
|
278
|
+
className: "grid min-w-0 flex-1 gap-1",
|
|
279
|
+
children: [/* @__PURE__ */ A("span", {
|
|
280
|
+
className: "truncate text-sm",
|
|
281
|
+
children: e.name
|
|
282
|
+
}), /* @__PURE__ */ A("span", {
|
|
283
|
+
className: "text-xs text-muted-foreground",
|
|
284
|
+
"data-ckui": "queue-status",
|
|
285
|
+
children: y("folder.queued")
|
|
286
|
+
})]
|
|
287
|
+
})]
|
|
288
|
+
}, t))
|
|
289
|
+
}),
|
|
290
|
+
C.items.length > 0 && /* @__PURE__ */ A(w, {
|
|
291
|
+
items: C.items,
|
|
245
292
|
id: (e) => e.id,
|
|
246
293
|
name: (e) => e.file.name,
|
|
247
|
-
disabled:
|
|
248
|
-
label:
|
|
249
|
-
onMove: (e, t) =>
|
|
294
|
+
disabled: P || z,
|
|
295
|
+
label: y("folder.label"),
|
|
296
|
+
onMove: (e, t) => C.move(C.items[e].id, t),
|
|
250
297
|
row: (e) => ({
|
|
251
298
|
className: "flex min-h-11 items-center gap-2 px-1",
|
|
252
299
|
"data-ckui": "queue-row",
|
|
253
300
|
"data-status": e.status
|
|
254
301
|
}),
|
|
255
|
-
children: (e,
|
|
302
|
+
children: (e, n) => /* @__PURE__ */ A(le, {
|
|
256
303
|
item: e,
|
|
257
|
-
handle:
|
|
258
|
-
auto:
|
|
259
|
-
folder:
|
|
304
|
+
handle: P ? null : n,
|
|
305
|
+
auto: P,
|
|
306
|
+
folder: t
|
|
260
307
|
})
|
|
261
308
|
}),
|
|
262
|
-
(!
|
|
309
|
+
(!P && pe > 0 || P && t.error && pe > 0) && /* @__PURE__ */ j(p, {
|
|
263
310
|
className: "w-fit",
|
|
264
|
-
disabled:
|
|
265
|
-
onClick: () => void
|
|
311
|
+
disabled: z || !C.ready || t.committing,
|
|
312
|
+
onClick: () => void t.commit().catch(() => {}),
|
|
266
313
|
"data-ckui": "folder-commit",
|
|
267
|
-
children: [
|
|
314
|
+
children: [t.committing && /* @__PURE__ */ A(U, {
|
|
268
315
|
icon: re,
|
|
269
316
|
strokeWidth: 2,
|
|
270
317
|
className: "motion-safe:animate-spin"
|
|
271
|
-
}),
|
|
318
|
+
}), P ? y("folder.commitAgain") : y("folder.commit", { count: C.items.filter((e) => e.status !== "committed").length })]
|
|
272
319
|
}),
|
|
273
320
|
l,
|
|
274
321
|
/* @__PURE__ */ A("input", {
|
|
275
322
|
ref: X,
|
|
276
323
|
type: "file",
|
|
277
|
-
accept:
|
|
324
|
+
accept: L,
|
|
278
325
|
className: "sr-only",
|
|
279
326
|
tabIndex: -1,
|
|
280
327
|
"aria-hidden": !0,
|
|
281
328
|
onChange: (e) => {
|
|
282
|
-
let
|
|
283
|
-
e.target.value = "",
|
|
329
|
+
let n = e.target.files?.[0];
|
|
330
|
+
e.target.value = "", n && Z && t.replace(Z, n).catch(() => {}), Q(null);
|
|
284
331
|
}
|
|
285
332
|
}),
|
|
286
333
|
/* @__PURE__ */ A(ee, {
|
|
287
|
-
open: !!
|
|
288
|
-
onOpenChange: (e) => !e &&
|
|
289
|
-
source: "source" in
|
|
290
|
-
aspect:
|
|
291
|
-
aspects:
|
|
292
|
-
initialEdit: "edit" in
|
|
293
|
-
minWidth:
|
|
294
|
-
title:
|
|
295
|
-
busy:
|
|
296
|
-
error:
|
|
297
|
-
onConfirm: (e) => void
|
|
334
|
+
open: !!H,
|
|
335
|
+
onOpenChange: (e) => !e && K.status !== "saving" && G(null),
|
|
336
|
+
source: "source" in K ? K.source ?? null : null,
|
|
337
|
+
aspect: q?.aspect ?? "",
|
|
338
|
+
aspects: q?.aspect ? void 0 : m,
|
|
339
|
+
initialEdit: "edit" in K ? K.edit : null,
|
|
340
|
+
minWidth: q?.min_width,
|
|
341
|
+
title: y("folder.crop"),
|
|
342
|
+
busy: K.status === "saving",
|
|
343
|
+
error: K.status === "error" ? x(K.error) : void 0,
|
|
344
|
+
onConfirm: (e) => void K.save(e)
|
|
298
345
|
})
|
|
299
346
|
]
|
|
300
347
|
});
|
|
301
348
|
}
|
|
302
|
-
function
|
|
349
|
+
function ce({ group: e, titled: t, folder: n, disabled: r, selected: i, onSelect: o, renaming: s, onRename: c, onCrop: l, onReplace: u, rowActions: d }) {
|
|
303
350
|
let { t: f } = a(), p = f(`folder.kinds.${K(e.rule)}`), m = e.rule?.max;
|
|
304
351
|
return /* @__PURE__ */ j("section", {
|
|
305
352
|
className: "grid gap-1",
|
|
@@ -324,7 +371,7 @@ function oe({ group: e, titled: t, folder: n, disabled: r, selected: i, onSelect
|
|
|
324
371
|
"data-ckui": "upload-row",
|
|
325
372
|
"data-path": e.path
|
|
326
373
|
}),
|
|
327
|
-
children: (t, a) => /* @__PURE__ */ A(
|
|
374
|
+
children: (t, a) => /* @__PURE__ */ A(X, {
|
|
328
375
|
file: t,
|
|
329
376
|
group: e,
|
|
330
377
|
handle: a,
|
|
@@ -361,7 +408,7 @@ function Y({ kind: e, url: t, busy: n }) {
|
|
|
361
408
|
})]
|
|
362
409
|
});
|
|
363
410
|
}
|
|
364
|
-
function
|
|
411
|
+
function X({ file: n, group: r, handle: i, folder: o, disabled: s, selected: u, onSelect: d, renaming: f, onRename: m, onCrop: h, onReplace: ee, actions: g }) {
|
|
365
412
|
let { t: _, error: v } = a(), y = W(n.type), b = x(r, n.path), C = l(n), w = D(() => S(o.read.read, n), [o.read.read, n]), T = s || o.updating, E = n.failed ? v(e(n.failed)) : void 0;
|
|
366
413
|
return /* @__PURE__ */ j(k, { children: [
|
|
367
414
|
i,
|
|
@@ -384,7 +431,7 @@ function se({ file: n, group: r, handle: i, folder: o, disabled: s, selected: u,
|
|
|
384
431
|
/* @__PURE__ */ j("div", {
|
|
385
432
|
className: "flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5",
|
|
386
433
|
children: [
|
|
387
|
-
f ? /* @__PURE__ */ A(
|
|
434
|
+
f ? /* @__PURE__ */ A(Z, {
|
|
388
435
|
name: t(b),
|
|
389
436
|
label: _("folder.renameLabel", { name: b }),
|
|
390
437
|
onDone: (e) => e === null ? m(null) : o.rename(n.path, e).then(() => m(null))
|
|
@@ -478,7 +525,7 @@ function se({ file: n, group: r, handle: i, folder: o, disabled: s, selected: u,
|
|
|
478
525
|
})
|
|
479
526
|
] });
|
|
480
527
|
}
|
|
481
|
-
function
|
|
528
|
+
function Z({ name: e, label: t, onDone: n }) {
|
|
482
529
|
let [r, i] = O(e), a = te(!1), o = (t) => {
|
|
483
530
|
a.current || (a.current = !0, Promise.resolve(n(t && t.trim() && t.trim() !== e ? t.trim() : null)).catch(() => a.current = !1));
|
|
484
531
|
};
|
|
@@ -495,7 +542,7 @@ function X({ name: e, label: t, onDone: n }) {
|
|
|
495
542
|
"data-ckui": "rename"
|
|
496
543
|
});
|
|
497
544
|
}
|
|
498
|
-
function
|
|
545
|
+
function Q(t, n, r, i) {
|
|
499
546
|
if (r.status === "failed") return n(r.error);
|
|
500
547
|
if (r.status === "uploading") return m(t, r.progress);
|
|
501
548
|
if (r.status === "uploaded") {
|
|
@@ -504,8 +551,8 @@ function Z(t, n, r, i) {
|
|
|
504
551
|
}
|
|
505
552
|
return r.status === "committed" ? t("folder.adding") : t("folder.queued");
|
|
506
553
|
}
|
|
507
|
-
function
|
|
508
|
-
let { t: i, error: o } = a(), { queue: c } = r, l = W(e.file.type), u =
|
|
554
|
+
function le({ item: e, handle: t, auto: n, folder: r }) {
|
|
555
|
+
let { t: i, error: o } = a(), { queue: c } = r, l = W(e.file.type), u = Q(i, o, e, n), d = e.status === "uploading" ? h(e.progress) : e.unattached && !e.processed && e.processing?.progress ? e.processing.progress.percent : null;
|
|
509
556
|
return /* @__PURE__ */ j(k, { children: [
|
|
510
557
|
t,
|
|
511
558
|
/* @__PURE__ */ A(Y, {
|