@openrails/contentkit-ui 0.98.6 → 0.99.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -0
- package/dist/client/content/comments.d.ts +4 -2
- package/dist/client/content/comments.js +10 -6
- package/dist/client/content/comments.js.map +1 -1
- package/dist/client/generated/routes.d.ts +28 -2
- package/dist/client/generated/routes.js +39 -2
- package/dist/client/generated/routes.js.map +1 -1
- package/dist/client/generated/wire.d.ts +85 -0
- package/dist/client/generated/wire.js.map +1 -1
- package/dist/client/media/client.d.ts +4 -0
- package/dist/client/media/client.js +8 -4
- package/dist/client/media/client.js.map +1 -1
- package/dist/client/media/queue.js +42 -26
- package/dist/client/media/queue.js.map +1 -1
- package/dist/client/media/rules.d.ts +6 -0
- package/dist/client/media/rules.js +64 -10
- package/dist/client/media/rules.js.map +1 -1
- package/dist/client/versions.d.ts +6 -2
- package/dist/client/versions.js +26 -0
- package/dist/client/versions.js.map +1 -1
- package/dist/components/admin/page-review.d.ts +13 -0
- package/dist/components/admin/page-review.js +216 -0
- package/dist/components/admin/page-review.js.map +1 -0
- package/dist/components/content/card.js +98 -103
- package/dist/components/content/card.js.map +1 -1
- package/dist/components/content/daily-releases.d.ts +8 -1
- package/dist/components/content/daily-releases.js +291 -133
- package/dist/components/content/daily-releases.js.map +1 -1
- package/dist/components/content/editors.js +216 -210
- package/dist/components/content/editors.js.map +1 -1
- package/dist/components/content/filter-dialog.d.ts +11 -0
- package/dist/components/content/filter-dialog.js +29 -0
- package/dist/components/content/filter-dialog.js.map +1 -0
- package/dist/components/content/filters.d.ts +10 -0
- package/dist/components/content/filters.js +5 -2
- package/dist/components/content/filters.js.map +1 -1
- package/dist/components/content/grid.js +19 -14
- package/dist/components/content/grid.js.map +1 -1
- package/dist/components/content/index.d.ts +2 -1
- package/dist/components/content/release-reveal.d.ts +5 -0
- package/dist/components/content/release-reveal.js +62 -0
- package/dist/components/content/release-reveal.js.map +1 -0
- package/dist/components/social/comments.d.ts +1 -1
- package/dist/components/social/comments.js +15 -15
- package/dist/components/social/comments.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +24 -22
- package/dist/locales/admin/de.js +23 -0
- package/dist/locales/admin/de.js.map +1 -1
- package/dist/locales/admin/en.d.ts +23 -0
- package/dist/locales/admin/en.js +23 -0
- package/dist/locales/admin/en.js.map +1 -1
- package/dist/locales/admin/es.js +23 -0
- package/dist/locales/admin/es.js.map +1 -1
- package/dist/locales/admin/ja.js +23 -0
- package/dist/locales/admin/ja.js.map +1 -1
- package/dist/locales/admin/ko.js +23 -0
- package/dist/locales/admin/ko.js.map +1 -1
- package/dist/locales/admin/zh.js +23 -0
- package/dist/locales/admin/zh.js.map +1 -1
- package/dist/locales/discovery/de.js +11 -0
- package/dist/locales/discovery/de.js.map +1 -1
- package/dist/locales/discovery/en.d.ts +11 -0
- package/dist/locales/discovery/en.js +11 -0
- package/dist/locales/discovery/en.js.map +1 -1
- package/dist/locales/discovery/es.js +11 -0
- package/dist/locales/discovery/es.js.map +1 -1
- package/dist/locales/discovery/ja.js +11 -0
- package/dist/locales/discovery/ja.js.map +1 -1
- package/dist/locales/discovery/ko.js +11 -0
- package/dist/locales/discovery/ko.js.map +1 -1
- package/dist/locales/discovery/zh.js +11 -0
- package/dist/locales/discovery/zh.js.map +1 -1
- package/dist/locales/en.d.ts +34 -0
- package/dist/locales/social/en.js +2 -2
- package/dist/locales/social/en.js.map +1 -1
- package/dist/react/comments.d.ts +2 -1
- package/dist/react/comments.js +10 -8
- package/dist/react/comments.js.map +1 -1
- package/dist/react/folder.js +39 -39
- package/dist/react/folder.js.map +1 -1
- package/dist/react/index.d.ts +1 -0
- package/dist/react/page-review.d.ts +14 -0
- package/dist/react/page-review.js +36 -0
- package/dist/react/page-review.js.map +1 -0
- package/dist/react/public.d.ts +3 -1
- package/dist/react/public.js +76 -72
- package/dist/react/public.js.map +1 -1
- package/dist/react/resources.d.ts +5 -13
- package/dist/react/resources.js +58 -49
- package/dist/react/resources.js.map +1 -1
- package/dist/react/use-resource.d.ts +1 -1
- package/dist/react/use-resource.js +23 -13
- package/dist/react/use-resource.js.map +1 -1
- package/dist/react/versions.js +70 -42
- package/dist/react/versions.js.map +1 -1
- package/dist/react.js +8 -7
- package/dist/styles.css +1 -1
- package/package.json +1 -1
|
@@ -19,16 +19,17 @@ import { OfferFields as D } from "./offer-fields.js";
|
|
|
19
19
|
import { AttributeFields as O, formOf as k } from "../groups/fields.js";
|
|
20
20
|
import { MembershipEditor as A } from "../groups/memberships.js";
|
|
21
21
|
import { ReaderManifestEditor as j } from "../admin/reader-manifest.js";
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
22
|
+
import { PageReview as M } from "../admin/page-review.js";
|
|
23
|
+
import { VideoMediaEditor as N, videoPaths as P } from "../admin/media-item-panel.js";
|
|
24
|
+
import { useEffect as F, useId as I, useMemo as L, useRef as R, useState as z } from "react";
|
|
25
|
+
import { Fragment as B, jsx as V, jsxs as H } from "react/jsx-runtime";
|
|
26
|
+
import { cn as U } from "cn";
|
|
26
27
|
//#region src/components/content/editors.tsx
|
|
27
|
-
var
|
|
28
|
+
var W = "__none__", ee = [
|
|
28
29
|
"listed",
|
|
29
30
|
"members",
|
|
30
31
|
"unlisted"
|
|
31
|
-
],
|
|
32
|
+
], te = [
|
|
32
33
|
"open",
|
|
33
34
|
"closed",
|
|
34
35
|
"hidden"
|
|
@@ -38,35 +39,35 @@ var B = "__none__", V = [
|
|
|
38
39
|
"ppv",
|
|
39
40
|
"group",
|
|
40
41
|
"group_ppv"
|
|
41
|
-
],
|
|
42
|
-
function
|
|
43
|
-
return /* @__PURE__ */
|
|
42
|
+
], G = (e) => e === "group" || e === "group_ppv";
|
|
43
|
+
function K({ title: e, ckui: t, children: n }) {
|
|
44
|
+
return /* @__PURE__ */ H("section", {
|
|
44
45
|
className: "grid gap-3 border-t border-border pt-4",
|
|
45
46
|
"data-ckui": t,
|
|
46
|
-
children: [/* @__PURE__ */
|
|
47
|
+
children: [/* @__PURE__ */ V("h3", {
|
|
47
48
|
className: "font-medium",
|
|
48
49
|
children: e
|
|
49
50
|
}), n]
|
|
50
51
|
});
|
|
51
52
|
}
|
|
52
|
-
function
|
|
53
|
+
function q({ show: e }) {
|
|
53
54
|
let { t: n } = t();
|
|
54
|
-
return e ? /* @__PURE__ */
|
|
55
|
+
return e ? /* @__PURE__ */ V("span", {
|
|
55
56
|
role: "status",
|
|
56
57
|
className: "text-muted-foreground",
|
|
57
58
|
children: n("contentEditor.saved")
|
|
58
59
|
}) : null;
|
|
59
60
|
}
|
|
60
|
-
function
|
|
61
|
+
function J(e, t) {
|
|
61
62
|
let { kinds: n } = r({ client: t });
|
|
62
63
|
return {
|
|
63
64
|
model: n,
|
|
64
65
|
spec: n?.kinds[e]
|
|
65
66
|
};
|
|
66
67
|
}
|
|
67
|
-
function
|
|
68
|
-
let { t: i } = t(), a = n(r.client), { spec: s } =
|
|
69
|
-
|
|
68
|
+
function Y({ content: e, ...r }) {
|
|
69
|
+
let { t: i } = t(), a = n(r.client), { spec: s } = J(e.kind, r.client), c = L(() => s?.attributes ?? {}, [s]), [l, u] = z(e.listing), [_, b] = z(e.comments), [x, C] = z({});
|
|
70
|
+
F(() => {
|
|
70
71
|
u(e.listing), b(e.comments), C(k(c, e.attributes));
|
|
71
72
|
}, [
|
|
72
73
|
e.revision,
|
|
@@ -75,11 +76,11 @@ function q({ content: e, ...r }) {
|
|
|
75
76
|
e.attributes,
|
|
76
77
|
c
|
|
77
78
|
]);
|
|
78
|
-
let [w, T] =
|
|
79
|
-
return /* @__PURE__ */
|
|
79
|
+
let [w, T] = z(null), [E, D] = z(!1), A = y("content.save", r.onError);
|
|
80
|
+
return /* @__PURE__ */ V(K, {
|
|
80
81
|
title: i("contentEditor.details"),
|
|
81
82
|
ckui: "content-details",
|
|
82
|
-
children: /* @__PURE__ */
|
|
83
|
+
children: /* @__PURE__ */ H("form", {
|
|
83
84
|
className: "grid gap-3",
|
|
84
85
|
onSubmit: (t) => {
|
|
85
86
|
t.preventDefault(), T(null), D(!1);
|
|
@@ -97,37 +98,37 @@ function q({ content: e, ...r }) {
|
|
|
97
98
|
})).then((e) => e && D(!0));
|
|
98
99
|
},
|
|
99
100
|
children: [
|
|
100
|
-
/* @__PURE__ */
|
|
101
|
+
/* @__PURE__ */ H("div", {
|
|
101
102
|
className: "grid gap-1.5 sm:max-w-xs",
|
|
102
|
-
children: [/* @__PURE__ */
|
|
103
|
+
children: [/* @__PURE__ */ V(d, { children: i("contentEditor.listing") }), /* @__PURE__ */ H(f, {
|
|
103
104
|
value: l,
|
|
104
105
|
onValueChange: (e) => u(e),
|
|
105
|
-
children: [/* @__PURE__ */
|
|
106
|
+
children: [/* @__PURE__ */ V(h, {
|
|
106
107
|
size: "sm",
|
|
107
108
|
"aria-label": i("contentEditor.listing"),
|
|
108
|
-
children: /* @__PURE__ */
|
|
109
|
-
}), /* @__PURE__ */
|
|
109
|
+
children: /* @__PURE__ */ V(g, { children: (e) => i(`contentEditor.listing_${e}`) })
|
|
110
|
+
}), /* @__PURE__ */ V(p, { children: ee.map((e) => /* @__PURE__ */ V(m, {
|
|
110
111
|
value: e,
|
|
111
112
|
children: i(`contentEditor.listing_${e}`)
|
|
112
113
|
}, e)) })]
|
|
113
114
|
})]
|
|
114
115
|
}),
|
|
115
|
-
/* @__PURE__ */
|
|
116
|
+
/* @__PURE__ */ H("div", {
|
|
116
117
|
className: "grid gap-1.5 sm:max-w-xs",
|
|
117
|
-
children: [/* @__PURE__ */
|
|
118
|
+
children: [/* @__PURE__ */ V(d, { children: i("contentEditor.comments") }), /* @__PURE__ */ H(f, {
|
|
118
119
|
value: _,
|
|
119
120
|
onValueChange: (e) => b(e),
|
|
120
|
-
children: [/* @__PURE__ */
|
|
121
|
+
children: [/* @__PURE__ */ V(h, {
|
|
121
122
|
size: "sm",
|
|
122
123
|
"aria-label": i("contentEditor.comments"),
|
|
123
|
-
children: /* @__PURE__ */
|
|
124
|
-
}), /* @__PURE__ */
|
|
124
|
+
children: /* @__PURE__ */ V(g, { children: (e) => i(`contentEditor.comments_${e}`) })
|
|
125
|
+
}), /* @__PURE__ */ V(p, { children: te.map((e) => /* @__PURE__ */ V(m, {
|
|
125
126
|
value: e,
|
|
126
127
|
children: i(`contentEditor.comments_${e}`)
|
|
127
128
|
}, e)) })]
|
|
128
129
|
})]
|
|
129
130
|
}),
|
|
130
|
-
/* @__PURE__ */
|
|
131
|
+
/* @__PURE__ */ V(O, {
|
|
131
132
|
declared: c,
|
|
132
133
|
form: x,
|
|
133
134
|
onChange: (e, t) => C((n) => ({
|
|
@@ -136,88 +137,88 @@ function q({ content: e, ...r }) {
|
|
|
136
137
|
})),
|
|
137
138
|
labels: r.labels
|
|
138
139
|
}),
|
|
139
|
-
w && /* @__PURE__ */
|
|
140
|
-
/* @__PURE__ */
|
|
141
|
-
/* @__PURE__ */
|
|
140
|
+
w && /* @__PURE__ */ V(v, { children: w }),
|
|
141
|
+
/* @__PURE__ */ V(v, { error: A.error }),
|
|
142
|
+
/* @__PURE__ */ H("div", {
|
|
142
143
|
className: "flex items-center gap-3",
|
|
143
|
-
children: [/* @__PURE__ */
|
|
144
|
+
children: [/* @__PURE__ */ V(o, {
|
|
144
145
|
type: "submit",
|
|
145
146
|
size: "sm",
|
|
146
147
|
disabled: A.pending,
|
|
147
148
|
children: A.pending ? i("common.saving") : i("common.save")
|
|
148
|
-
}), /* @__PURE__ */
|
|
149
|
+
}), /* @__PURE__ */ V(q, { show: E })]
|
|
149
150
|
})
|
|
150
151
|
]
|
|
151
152
|
})
|
|
152
153
|
});
|
|
153
154
|
}
|
|
154
|
-
function
|
|
155
|
-
let { t: c } = t(), l =
|
|
155
|
+
function X({ value: e, onChange: n, model: r, kind: i, owner: a, labels: o, client: s }) {
|
|
156
|
+
let { t: c } = t(), l = I(), _ = r?.tiers ?? [], v = r?.kinds[i], y = Object.entries(r?.entity_kinds ?? {}).filter(([, e]) => e.sellable || e.auth_scope).map(([e]) => e), [S, D] = z(), O = S ?? y[0] ?? "", k = E(e.group_id ? [e.group_id] : [], { client: s }), A = e.group_id ? k.get(e.group_id) : void 0, j = (t) => n({
|
|
156
157
|
...e,
|
|
157
158
|
...t
|
|
158
159
|
}), M = v?.presentation === "reader", N = !!v?.segments;
|
|
159
|
-
return /* @__PURE__ */
|
|
160
|
+
return /* @__PURE__ */ H("div", {
|
|
160
161
|
className: "grid gap-3",
|
|
161
162
|
"data-ckui": "rule-fields",
|
|
162
163
|
children: [
|
|
163
|
-
/* @__PURE__ */
|
|
164
|
+
/* @__PURE__ */ H("div", {
|
|
164
165
|
className: "grid gap-1.5 sm:max-w-xs",
|
|
165
|
-
children: [/* @__PURE__ */
|
|
166
|
+
children: [/* @__PURE__ */ V(d, { children: c("contentEditor.access") }), /* @__PURE__ */ H(f, {
|
|
166
167
|
value: e.level,
|
|
167
168
|
onValueChange: (t) => {
|
|
168
169
|
let r = t;
|
|
169
170
|
n({
|
|
170
171
|
level: r,
|
|
171
|
-
group_id:
|
|
172
|
+
group_id: G(r) ? e.group_id || a : void 0,
|
|
172
173
|
preview: e.preview,
|
|
173
174
|
free_after: e.free_after
|
|
174
175
|
});
|
|
175
176
|
},
|
|
176
|
-
children: [/* @__PURE__ */
|
|
177
|
+
children: [/* @__PURE__ */ V(h, {
|
|
177
178
|
size: "sm",
|
|
178
179
|
"aria-label": c("contentEditor.access"),
|
|
179
|
-
children: /* @__PURE__ */
|
|
180
|
-
}), /* @__PURE__ */
|
|
180
|
+
children: /* @__PURE__ */ V(g, { children: (e) => c(`contentEditor.level_${e}`) })
|
|
181
|
+
}), /* @__PURE__ */ V(p, { children: ne.filter((e) => (e !== "tier" || _.length) && (!e.startsWith("group") || y.length)).map((e) => /* @__PURE__ */ V(m, {
|
|
181
182
|
value: e,
|
|
182
183
|
children: c(`contentEditor.level_${e}`)
|
|
183
184
|
}, e)) })]
|
|
184
185
|
})]
|
|
185
186
|
}),
|
|
186
|
-
e.level === "tier" && /* @__PURE__ */
|
|
187
|
+
e.level === "tier" && /* @__PURE__ */ H("fieldset", {
|
|
187
188
|
className: "flex flex-wrap gap-3",
|
|
188
|
-
children: [/* @__PURE__ */
|
|
189
|
+
children: [/* @__PURE__ */ V("legend", {
|
|
189
190
|
className: "sr-only",
|
|
190
191
|
children: c("contentEditor.tiers")
|
|
191
|
-
}), _.map((t) => /* @__PURE__ */
|
|
192
|
+
}), _.map((t) => /* @__PURE__ */ H("label", {
|
|
192
193
|
className: "flex items-center gap-2",
|
|
193
|
-
children: [/* @__PURE__ */
|
|
194
|
+
children: [/* @__PURE__ */ V(b, {
|
|
194
195
|
checked: e.tiers?.includes(t) ?? !1,
|
|
195
196
|
onCheckedChange: (n) => j({ tiers: n ? [...e.tiers ?? [], t] : (e.tiers ?? []).filter((e) => e !== t) }),
|
|
196
197
|
"aria-label": T(o, t)
|
|
197
198
|
}), T(o, t)]
|
|
198
199
|
}, t))]
|
|
199
200
|
}),
|
|
200
|
-
|
|
201
|
+
G(e.level) && /* @__PURE__ */ H("div", {
|
|
201
202
|
className: "flex flex-wrap items-end gap-2",
|
|
202
203
|
children: [
|
|
203
|
-
A || e.group_id ? /* @__PURE__ */
|
|
204
|
+
A || e.group_id ? /* @__PURE__ */ V("span", {
|
|
204
205
|
className: "rounded-md border border-border px-2 py-0.5",
|
|
205
206
|
"data-ckui": "rule-group",
|
|
206
207
|
children: A ? A.name || A.slug : e.group_id
|
|
207
208
|
}) : null,
|
|
208
|
-
y.length > 1 && /* @__PURE__ */
|
|
209
|
+
y.length > 1 && /* @__PURE__ */ H(f, {
|
|
209
210
|
value: O,
|
|
210
211
|
onValueChange: (e) => D(String(e)),
|
|
211
|
-
children: [/* @__PURE__ */
|
|
212
|
+
children: [/* @__PURE__ */ V(h, {
|
|
212
213
|
size: "sm",
|
|
213
214
|
"aria-label": c("groupEditor.edgeKind"),
|
|
214
|
-
children: /* @__PURE__ */
|
|
215
|
-
}), /* @__PURE__ */
|
|
215
|
+
children: /* @__PURE__ */ V(g, { children: (e) => T(o, e) })
|
|
216
|
+
}), /* @__PURE__ */ V(p, { children: y.map((e) => /* @__PURE__ */ V(m, {
|
|
216
217
|
value: e,
|
|
217
218
|
children: T(o, e)
|
|
218
219
|
}, e)) })]
|
|
219
220
|
}),
|
|
220
|
-
O && /* @__PURE__ */
|
|
221
|
+
O && /* @__PURE__ */ V(w, {
|
|
221
222
|
kind: O,
|
|
222
223
|
label: c("contentEditor.group"),
|
|
223
224
|
client: s,
|
|
@@ -225,15 +226,15 @@ function J({ value: e, onChange: n, model: r, kind: i, owner: a, labels: o, clie
|
|
|
225
226
|
}, O)
|
|
226
227
|
]
|
|
227
228
|
}),
|
|
228
|
-
e.level !== "public" && /* @__PURE__ */
|
|
229
|
+
e.level !== "public" && /* @__PURE__ */ H("div", {
|
|
229
230
|
className: "grid gap-3 sm:grid-cols-3",
|
|
230
231
|
children: [
|
|
231
|
-
M && /* @__PURE__ */
|
|
232
|
+
M && /* @__PURE__ */ H("div", {
|
|
232
233
|
className: "grid gap-1.5",
|
|
233
|
-
children: [/* @__PURE__ */
|
|
234
|
+
children: [/* @__PURE__ */ V(d, {
|
|
234
235
|
htmlFor: `${l}-pages`,
|
|
235
236
|
children: c("contentEditor.previewPages")
|
|
236
|
-
}), /* @__PURE__ */
|
|
237
|
+
}), /* @__PURE__ */ V(u, {
|
|
237
238
|
id: `${l}-pages`,
|
|
238
239
|
className: "h-8",
|
|
239
240
|
type: "number",
|
|
@@ -245,12 +246,12 @@ function J({ value: e, onChange: n, model: r, kind: i, owner: a, labels: o, clie
|
|
|
245
246
|
} })
|
|
246
247
|
})]
|
|
247
248
|
}),
|
|
248
|
-
N && /* @__PURE__ */
|
|
249
|
+
N && /* @__PURE__ */ H("div", {
|
|
249
250
|
className: "grid gap-1.5",
|
|
250
|
-
children: [/* @__PURE__ */
|
|
251
|
+
children: [/* @__PURE__ */ V(d, {
|
|
251
252
|
htmlFor: `${l}-segments`,
|
|
252
253
|
children: c("contentEditor.previewSegments")
|
|
253
|
-
}), /* @__PURE__ */
|
|
254
|
+
}), /* @__PURE__ */ V(u, {
|
|
254
255
|
id: `${l}-segments`,
|
|
255
256
|
className: "h-8",
|
|
256
257
|
type: "number",
|
|
@@ -262,12 +263,12 @@ function J({ value: e, onChange: n, model: r, kind: i, owner: a, labels: o, clie
|
|
|
262
263
|
} })
|
|
263
264
|
})]
|
|
264
265
|
}),
|
|
265
|
-
/* @__PURE__ */
|
|
266
|
+
/* @__PURE__ */ H("div", {
|
|
266
267
|
className: "grid gap-1.5",
|
|
267
|
-
children: [/* @__PURE__ */
|
|
268
|
+
children: [/* @__PURE__ */ V(d, {
|
|
268
269
|
htmlFor: `${l}-free`,
|
|
269
270
|
children: c("contentEditor.freeAfter")
|
|
270
|
-
}), /* @__PURE__ */
|
|
271
|
+
}), /* @__PURE__ */ V(u, {
|
|
271
272
|
id: `${l}-free`,
|
|
272
273
|
className: "h-8",
|
|
273
274
|
type: "datetime-local",
|
|
@@ -280,8 +281,8 @@ function J({ value: e, onChange: n, model: r, kind: i, owner: a, labels: o, clie
|
|
|
280
281
|
]
|
|
281
282
|
});
|
|
282
283
|
}
|
|
283
|
-
var
|
|
284
|
-
function
|
|
284
|
+
var Z = (e) => !G(e.level) || !!e.group_id;
|
|
285
|
+
function re(e) {
|
|
285
286
|
let t = e.preview && (e.preview.pages || e.preview.segments) ? {
|
|
286
287
|
pages: e.preview.pages || void 0,
|
|
287
288
|
segments: e.preview.segments || void 0
|
|
@@ -294,24 +295,24 @@ function X(e) {
|
|
|
294
295
|
free_after: e.level === "public" ? void 0 : e.free_after
|
|
295
296
|
};
|
|
296
297
|
}
|
|
297
|
-
function
|
|
298
|
-
let { t: i } = t(), a = n(r.client), { model: s } =
|
|
299
|
-
|
|
300
|
-
let [u, d] =
|
|
301
|
-
return /* @__PURE__ */
|
|
298
|
+
function ie({ content: e, ...r }) {
|
|
299
|
+
let { t: i } = t(), a = n(r.client), { model: s } = J(e.kind, r.client), [c, l] = z(e.access);
|
|
300
|
+
F(() => l(e.access), [e.revision, e.access]);
|
|
301
|
+
let [u, d] = z(!1), f = y("content.save", r.onError), p = y("offer.save", r.onError);
|
|
302
|
+
return /* @__PURE__ */ H(K, {
|
|
302
303
|
title: i("contentEditor.accessTitle"),
|
|
303
304
|
ckui: "access-editor",
|
|
304
305
|
children: [
|
|
305
|
-
/* @__PURE__ */
|
|
306
|
+
/* @__PURE__ */ H("form", {
|
|
306
307
|
className: "grid gap-3",
|
|
307
308
|
onSubmit: (t) => {
|
|
308
309
|
t.preventDefault(), d(!1), f.run(() => a.contents.update(e.id, {
|
|
309
|
-
access:
|
|
310
|
+
access: re(c),
|
|
310
311
|
revision: e.revision
|
|
311
312
|
})).then((e) => e && d(!0));
|
|
312
313
|
},
|
|
313
314
|
children: [
|
|
314
|
-
/* @__PURE__ */
|
|
315
|
+
/* @__PURE__ */ V(X, {
|
|
315
316
|
value: c,
|
|
316
317
|
onChange: l,
|
|
317
318
|
model: s,
|
|
@@ -320,44 +321,44 @@ function re({ content: e, ...r }) {
|
|
|
320
321
|
labels: r.labels,
|
|
321
322
|
client: a
|
|
322
323
|
}),
|
|
323
|
-
/* @__PURE__ */
|
|
324
|
-
/* @__PURE__ */
|
|
324
|
+
/* @__PURE__ */ V(v, { error: f.error }),
|
|
325
|
+
/* @__PURE__ */ H("div", {
|
|
325
326
|
className: "flex items-center gap-3",
|
|
326
|
-
children: [/* @__PURE__ */
|
|
327
|
+
children: [/* @__PURE__ */ V(o, {
|
|
327
328
|
type: "submit",
|
|
328
329
|
size: "sm",
|
|
329
|
-
disabled: f.pending || !
|
|
330
|
+
disabled: f.pending || !Z(c),
|
|
330
331
|
children: f.pending ? i("common.saving") : i("common.save")
|
|
331
|
-
}), /* @__PURE__ */
|
|
332
|
+
}), /* @__PURE__ */ V(q, { show: u })]
|
|
332
333
|
})
|
|
333
334
|
]
|
|
334
335
|
}),
|
|
335
|
-
/* @__PURE__ */
|
|
336
|
+
/* @__PURE__ */ V(D, {
|
|
336
337
|
offer: e.offer,
|
|
337
338
|
pending: p.pending,
|
|
338
339
|
onSell: (t) => void p.run(() => a.offers.sell({ content: e.id }, t)),
|
|
339
340
|
onWithdraw: () => void p.run(() => a.offers.withdraw({ content: e.id }))
|
|
340
341
|
}),
|
|
341
|
-
/* @__PURE__ */
|
|
342
|
+
/* @__PURE__ */ V(v, { error: p.error })
|
|
342
343
|
]
|
|
343
344
|
});
|
|
344
345
|
}
|
|
345
|
-
function
|
|
346
|
+
function Q(e, t, n) {
|
|
346
347
|
return e.label || [...e.languages.map(t), ...e.traits.map((e) => T(n, e))].join(" · ");
|
|
347
348
|
}
|
|
348
|
-
function
|
|
349
|
-
let { t: c } = t(), u = n(a.client), d = e(), { model: f, spec: p } =
|
|
349
|
+
function ae({ content: r, media: i = !0, ...a }) {
|
|
350
|
+
let { t: c } = t(), u = n(a.client), d = e(), { model: f, spec: p } = J(r.kind, a.client), m = y("content.save", a.onError), h = y("content.save", a.onError), [g, _] = z(null), b = L(() => [...r.versions].sort((e, t) => e.position - t.position), [r.versions]);
|
|
350
351
|
if (!p) return null;
|
|
351
352
|
if (p.versions.hidden) {
|
|
352
353
|
let e = b[0];
|
|
353
|
-
return !e || !i && !p.segments ? null : /* @__PURE__ */
|
|
354
|
+
return !e || !i && !p.segments ? null : /* @__PURE__ */ H(K, {
|
|
354
355
|
title: c("contentEditor.media"),
|
|
355
356
|
ckui: "version-media",
|
|
356
|
-
children: [p.segments && /* @__PURE__ */
|
|
357
|
+
children: [p.segments && /* @__PURE__ */ V($, {
|
|
357
358
|
content: r,
|
|
358
359
|
version: e,
|
|
359
360
|
...a
|
|
360
|
-
}), i && /* @__PURE__ */
|
|
361
|
+
}), i && /* @__PURE__ */ V(ue, {
|
|
361
362
|
content: r,
|
|
362
363
|
version: e,
|
|
363
364
|
model: f,
|
|
@@ -366,45 +367,45 @@ function ie({ content: r, media: i = !0, ...a }) {
|
|
|
366
367
|
});
|
|
367
368
|
}
|
|
368
369
|
let x = f?.languages ?? [];
|
|
369
|
-
return /* @__PURE__ */
|
|
370
|
+
return /* @__PURE__ */ H(K, {
|
|
370
371
|
title: c("contentEditor.versions"),
|
|
371
372
|
ckui: "versions-editor",
|
|
372
373
|
children: [
|
|
373
|
-
/* @__PURE__ */
|
|
374
|
+
/* @__PURE__ */ V(s, {
|
|
374
375
|
items: b,
|
|
375
376
|
id: (e) => e.id,
|
|
376
|
-
name: (e) =>
|
|
377
|
+
name: (e) => Q(e, d, a.labels),
|
|
377
378
|
label: c("contentEditor.versions"),
|
|
378
379
|
disabled: m.pending || b.length < 2,
|
|
379
380
|
onMove: (e, t) => {
|
|
380
381
|
let n = b.map((e) => e.id), [i] = n.splice(e, 1);
|
|
381
382
|
n.splice(t, 0, i), m.run(() => u.contents.orderVersions(r.id, n));
|
|
382
383
|
},
|
|
383
|
-
children: (e, t) => /* @__PURE__ */
|
|
384
|
+
children: (e, t) => /* @__PURE__ */ H("div", {
|
|
384
385
|
className: "grid gap-2 rounded-md border border-border p-2",
|
|
385
386
|
"data-ckui": "version-row",
|
|
386
387
|
"data-version": e.id,
|
|
387
|
-
children: [/* @__PURE__ */
|
|
388
|
+
children: [/* @__PURE__ */ H("div", {
|
|
388
389
|
className: "flex flex-wrap items-center gap-2",
|
|
389
390
|
children: [
|
|
390
391
|
b.length > 1 && t,
|
|
391
|
-
/* @__PURE__ */
|
|
392
|
+
/* @__PURE__ */ V("span", {
|
|
392
393
|
className: "min-w-0 flex-1 font-medium break-words",
|
|
393
|
-
children:
|
|
394
|
+
children: Q(e, d, a.labels)
|
|
394
395
|
}),
|
|
395
|
-
/* @__PURE__ */
|
|
396
|
+
/* @__PURE__ */ V(l, {
|
|
396
397
|
variant: e.live ? "default" : "outline",
|
|
397
398
|
children: c(e.live ? "contentEditor.live" : e.state === "draft" ? "contentManager.draft" : "contentManager.scheduled")
|
|
398
399
|
}),
|
|
399
|
-
e.access && /* @__PURE__ */
|
|
400
|
+
e.access && /* @__PURE__ */ V(l, {
|
|
400
401
|
variant: "secondary",
|
|
401
402
|
children: c(`contentEditor.level_${e.access.level}`)
|
|
402
403
|
}),
|
|
403
|
-
e.pages ? /* @__PURE__ */
|
|
404
|
+
e.pages ? /* @__PURE__ */ V("span", {
|
|
404
405
|
className: "text-xs text-muted-foreground",
|
|
405
406
|
children: c("contentEditor.pageCount", { count: e.pages })
|
|
406
407
|
}) : null,
|
|
407
|
-
/* @__PURE__ */
|
|
408
|
+
/* @__PURE__ */ V(o, {
|
|
408
409
|
type: "button",
|
|
409
410
|
size: "xs",
|
|
410
411
|
variant: "ghost",
|
|
@@ -413,7 +414,7 @@ function ie({ content: r, media: i = !0, ...a }) {
|
|
|
413
414
|
children: c(g === e.id ? "contentEditor.close" : "contentEditor.edit")
|
|
414
415
|
})
|
|
415
416
|
]
|
|
416
|
-
}), g === e.id && /* @__PURE__ */
|
|
417
|
+
}), g === e.id && /* @__PURE__ */ V(ce, {
|
|
417
418
|
content: r,
|
|
418
419
|
version: e,
|
|
419
420
|
model: f,
|
|
@@ -422,57 +423,57 @@ function ie({ content: r, media: i = !0, ...a }) {
|
|
|
422
423
|
})]
|
|
423
424
|
})
|
|
424
425
|
}),
|
|
425
|
-
/* @__PURE__ */
|
|
426
|
-
/* @__PURE__ */
|
|
426
|
+
/* @__PURE__ */ V(v, { error: m.error }),
|
|
427
|
+
/* @__PURE__ */ V(se, {
|
|
427
428
|
languages: x,
|
|
428
429
|
many: p?.versions.languages === "many",
|
|
429
430
|
pending: h.pending,
|
|
430
431
|
onAdd: (e) => void h.run(() => u.contents.addVersion(r.id, e)).then((e) => e && _(e.id))
|
|
431
432
|
}),
|
|
432
|
-
/* @__PURE__ */
|
|
433
|
+
/* @__PURE__ */ V(v, { error: h.error })
|
|
433
434
|
]
|
|
434
435
|
});
|
|
435
436
|
}
|
|
436
|
-
function
|
|
437
|
+
function oe({ languages: n, value: r, many: i, onChange: a }) {
|
|
437
438
|
let { t: o } = t(), s = e();
|
|
438
|
-
return i ? /* @__PURE__ */
|
|
439
|
+
return i ? /* @__PURE__ */ H("fieldset", {
|
|
439
440
|
className: "flex flex-wrap gap-3",
|
|
440
|
-
children: [/* @__PURE__ */
|
|
441
|
+
children: [/* @__PURE__ */ V("legend", {
|
|
441
442
|
className: "sr-only",
|
|
442
443
|
children: o("contentEditor.versionLanguages")
|
|
443
|
-
}), n.map((e) => /* @__PURE__ */
|
|
444
|
+
}), n.map((e) => /* @__PURE__ */ H("label", {
|
|
444
445
|
className: "flex items-center gap-1.5",
|
|
445
|
-
children: [/* @__PURE__ */
|
|
446
|
+
children: [/* @__PURE__ */ V(b, {
|
|
446
447
|
size: "sm",
|
|
447
448
|
checked: r.includes(e),
|
|
448
449
|
onCheckedChange: (t) => a(t ? [...r, e] : r.filter((t) => t !== e)),
|
|
449
450
|
"aria-label": s(e)
|
|
450
451
|
}), s(e)]
|
|
451
452
|
}, e))]
|
|
452
|
-
}) : /* @__PURE__ */
|
|
453
|
-
value: r[0] ??
|
|
454
|
-
onValueChange: (e) => a(e ===
|
|
455
|
-
children: [/* @__PURE__ */
|
|
453
|
+
}) : /* @__PURE__ */ H(f, {
|
|
454
|
+
value: r[0] ?? W,
|
|
455
|
+
onValueChange: (e) => a(e === W ? [] : [String(e)]),
|
|
456
|
+
children: [/* @__PURE__ */ V(h, {
|
|
456
457
|
size: "sm",
|
|
457
458
|
"aria-label": o("contentEditor.versionLanguage"),
|
|
458
|
-
children: /* @__PURE__ */
|
|
459
|
-
}), /* @__PURE__ */
|
|
459
|
+
children: /* @__PURE__ */ V(g, { children: (e) => e === W ? o("contentEditor.chooseLanguage") : s(e) })
|
|
460
|
+
}), /* @__PURE__ */ V(p, { children: n.map((e) => /* @__PURE__ */ V(m, {
|
|
460
461
|
value: e,
|
|
461
462
|
children: s(e)
|
|
462
463
|
}, e)) })]
|
|
463
464
|
});
|
|
464
465
|
}
|
|
465
|
-
function
|
|
466
|
-
let { t: a } = t(), [s, c] =
|
|
467
|
-
return /* @__PURE__ */
|
|
466
|
+
function se({ languages: e, many: n, pending: r, onAdd: i }) {
|
|
467
|
+
let { t: a } = t(), [s, c] = z([]);
|
|
468
|
+
return /* @__PURE__ */ H("div", {
|
|
468
469
|
className: "flex flex-wrap items-center gap-2",
|
|
469
470
|
"data-ckui": "add-version",
|
|
470
|
-
children: [/* @__PURE__ */
|
|
471
|
+
children: [/* @__PURE__ */ V(oe, {
|
|
471
472
|
languages: e,
|
|
472
473
|
value: s,
|
|
473
474
|
many: n,
|
|
474
475
|
onChange: c
|
|
475
|
-
}), /* @__PURE__ */
|
|
476
|
+
}), /* @__PURE__ */ V(o, {
|
|
476
477
|
type: "button",
|
|
477
478
|
size: "sm",
|
|
478
479
|
variant: "outline",
|
|
@@ -484,38 +485,38 @@ function ae({ languages: e, many: n, pending: r, onAdd: i }) {
|
|
|
484
485
|
})]
|
|
485
486
|
});
|
|
486
487
|
}
|
|
487
|
-
function
|
|
488
|
-
let { t: c } = t(), l =
|
|
489
|
-
return /* @__PURE__ */
|
|
488
|
+
function ce({ content: e, version: r, model: i, media: a, ...s }) {
|
|
489
|
+
let { t: c } = t(), l = I(), f = n(s.client), p = i?.kinds[e.kind], [m, h] = z(r.languages), [g, _] = z(r.traits), [S, w] = z(r.label ?? ""), [E, O] = z(r.state === "draft"), [k, A] = z(C(r.publish_at)), [M, N] = z(!!r.access), [P, F] = z(r.access ?? e.access), [L, R] = z(!1), B = y("content.save", s.onError), U = y("content.save", s.onError), W = y("offer.save", s.onError);
|
|
490
|
+
return /* @__PURE__ */ H("div", {
|
|
490
491
|
className: "grid gap-4 pt-2",
|
|
491
492
|
children: [
|
|
492
|
-
/* @__PURE__ */
|
|
493
|
+
/* @__PURE__ */ H("form", {
|
|
493
494
|
className: "grid gap-3",
|
|
494
495
|
onSubmit: (t) => {
|
|
495
|
-
t.preventDefault(),
|
|
496
|
+
t.preventDefault(), R(!1), B.run(() => f.contents.updateVersion(e.id, r.id, {
|
|
496
497
|
languages: m,
|
|
497
498
|
traits: g,
|
|
498
499
|
label: S.trim(),
|
|
499
500
|
state: E ? "draft" : "published",
|
|
500
501
|
publish_at: x(k),
|
|
501
|
-
...M ? { access:
|
|
502
|
-
})).then((e) => e &&
|
|
502
|
+
...M ? { access: re(P) } : { clear_access: !!r.access }
|
|
503
|
+
})).then((e) => e && R(!0));
|
|
503
504
|
},
|
|
504
505
|
children: [
|
|
505
|
-
/* @__PURE__ */
|
|
506
|
+
/* @__PURE__ */ V(oe, {
|
|
506
507
|
languages: i?.languages ?? [],
|
|
507
508
|
value: m,
|
|
508
509
|
many: p?.versions.languages === "many",
|
|
509
510
|
onChange: h
|
|
510
511
|
}),
|
|
511
|
-
!!p?.versions.traits?.length && /* @__PURE__ */
|
|
512
|
+
!!p?.versions.traits?.length && /* @__PURE__ */ H("fieldset", {
|
|
512
513
|
className: "flex flex-wrap gap-3",
|
|
513
|
-
children: [/* @__PURE__ */
|
|
514
|
+
children: [/* @__PURE__ */ V("legend", {
|
|
514
515
|
className: "sr-only",
|
|
515
516
|
children: c("contentEditor.traits")
|
|
516
|
-
}), p.versions.traits.map((e) => /* @__PURE__ */
|
|
517
|
+
}), p.versions.traits.map((e) => /* @__PURE__ */ H("label", {
|
|
517
518
|
className: "flex items-center gap-1.5",
|
|
518
|
-
children: [/* @__PURE__ */
|
|
519
|
+
children: [/* @__PURE__ */ V(b, {
|
|
519
520
|
size: "sm",
|
|
520
521
|
checked: g.includes(e),
|
|
521
522
|
onCheckedChange: (t) => _(t ? [...g, e] : g.filter((t) => t !== e)),
|
|
@@ -523,25 +524,25 @@ function oe({ content: e, version: r, model: i, media: a, ...s }) {
|
|
|
523
524
|
}), T(s.labels, e)]
|
|
524
525
|
}, e))]
|
|
525
526
|
}),
|
|
526
|
-
/* @__PURE__ */
|
|
527
|
+
/* @__PURE__ */ H("div", {
|
|
527
528
|
className: "grid gap-3 sm:grid-cols-2",
|
|
528
|
-
children: [/* @__PURE__ */
|
|
529
|
+
children: [/* @__PURE__ */ H("div", {
|
|
529
530
|
className: "grid gap-1.5",
|
|
530
|
-
children: [/* @__PURE__ */
|
|
531
|
+
children: [/* @__PURE__ */ V(d, {
|
|
531
532
|
htmlFor: `${l}-label`,
|
|
532
533
|
children: c("contentEditor.versionLabel")
|
|
533
|
-
}), /* @__PURE__ */
|
|
534
|
+
}), /* @__PURE__ */ V(u, {
|
|
534
535
|
id: `${l}-label`,
|
|
535
536
|
className: "h-8",
|
|
536
537
|
value: S,
|
|
537
538
|
onChange: (e) => w(e.target.value)
|
|
538
539
|
})]
|
|
539
|
-
}), /* @__PURE__ */
|
|
540
|
+
}), /* @__PURE__ */ H("div", {
|
|
540
541
|
className: "grid gap-1.5",
|
|
541
|
-
children: [/* @__PURE__ */
|
|
542
|
+
children: [/* @__PURE__ */ V(d, {
|
|
542
543
|
htmlFor: `${l}-at`,
|
|
543
544
|
children: c("contentEditor.versionPublishAt")
|
|
544
|
-
}), /* @__PURE__ */
|
|
545
|
+
}), /* @__PURE__ */ V(u, {
|
|
545
546
|
id: `${l}-at`,
|
|
546
547
|
className: "h-8",
|
|
547
548
|
type: "datetime-local",
|
|
@@ -550,23 +551,23 @@ function oe({ content: e, version: r, model: i, media: a, ...s }) {
|
|
|
550
551
|
})]
|
|
551
552
|
})]
|
|
552
553
|
}),
|
|
553
|
-
/* @__PURE__ */
|
|
554
|
+
/* @__PURE__ */ H("label", {
|
|
554
555
|
className: "flex items-center gap-2",
|
|
555
|
-
children: [/* @__PURE__ */
|
|
556
|
+
children: [/* @__PURE__ */ V(b, {
|
|
556
557
|
size: "sm",
|
|
557
558
|
checked: E,
|
|
558
559
|
onCheckedChange: O
|
|
559
560
|
}), c("contentEditor.versionDraft")]
|
|
560
561
|
}),
|
|
561
|
-
/* @__PURE__ */
|
|
562
|
+
/* @__PURE__ */ H("label", {
|
|
562
563
|
className: "flex items-center gap-2",
|
|
563
|
-
children: [/* @__PURE__ */
|
|
564
|
+
children: [/* @__PURE__ */ V(b, {
|
|
564
565
|
size: "sm",
|
|
565
566
|
checked: M,
|
|
566
567
|
onCheckedChange: N
|
|
567
568
|
}), c("contentEditor.ownAccess")]
|
|
568
569
|
}),
|
|
569
|
-
M && /* @__PURE__ */
|
|
570
|
+
M && /* @__PURE__ */ V(X, {
|
|
570
571
|
value: P,
|
|
571
572
|
onChange: F,
|
|
572
573
|
model: i,
|
|
@@ -575,61 +576,61 @@ function oe({ content: e, version: r, model: i, media: a, ...s }) {
|
|
|
575
576
|
labels: s.labels,
|
|
576
577
|
client: f
|
|
577
578
|
}),
|
|
578
|
-
/* @__PURE__ */
|
|
579
|
-
/* @__PURE__ */
|
|
579
|
+
/* @__PURE__ */ V(v, { error: B.error }),
|
|
580
|
+
/* @__PURE__ */ H("div", {
|
|
580
581
|
className: "flex flex-wrap items-center gap-3",
|
|
581
582
|
children: [
|
|
582
|
-
/* @__PURE__ */
|
|
583
|
+
/* @__PURE__ */ V(o, {
|
|
583
584
|
type: "submit",
|
|
584
585
|
size: "sm",
|
|
585
|
-
disabled: B.pending || !m.length || M && !
|
|
586
|
+
disabled: B.pending || !m.length || M && !Z(P),
|
|
586
587
|
children: B.pending ? c("common.saving") : c("common.save")
|
|
587
588
|
}),
|
|
588
|
-
/* @__PURE__ */
|
|
589
|
-
/* @__PURE__ */
|
|
589
|
+
/* @__PURE__ */ V(q, { show: L }),
|
|
590
|
+
/* @__PURE__ */ V(o, {
|
|
590
591
|
type: "button",
|
|
591
592
|
size: "sm",
|
|
592
593
|
variant: "destructive",
|
|
593
594
|
className: "ms-auto",
|
|
594
|
-
disabled:
|
|
595
|
-
onClick: () => void
|
|
595
|
+
disabled: U.pending,
|
|
596
|
+
onClick: () => void U.run(() => f.contents.removeVersion(e.id, r.id)),
|
|
596
597
|
children: c("contentEditor.deleteVersion")
|
|
597
598
|
})
|
|
598
599
|
]
|
|
599
600
|
}),
|
|
600
|
-
/* @__PURE__ */
|
|
601
|
+
/* @__PURE__ */ V(v, { error: U.error })
|
|
601
602
|
]
|
|
602
603
|
}),
|
|
603
|
-
/* @__PURE__ */
|
|
604
|
+
/* @__PURE__ */ V(D, {
|
|
604
605
|
offer: r.offer,
|
|
605
|
-
pending:
|
|
606
|
-
onSell: (t) => void
|
|
606
|
+
pending: W.pending,
|
|
607
|
+
onSell: (t) => void W.run(() => f.offers.sell({
|
|
607
608
|
content: e.id,
|
|
608
609
|
version: r.id
|
|
609
610
|
}, t)),
|
|
610
|
-
onWithdraw: () => void
|
|
611
|
+
onWithdraw: () => void W.run(() => f.offers.withdraw({
|
|
611
612
|
content: e.id,
|
|
612
613
|
version: r.id
|
|
613
614
|
}))
|
|
614
615
|
}),
|
|
615
|
-
/* @__PURE__ */
|
|
616
|
-
p?.segments && /* @__PURE__ */
|
|
616
|
+
/* @__PURE__ */ V(v, { error: W.error }),
|
|
617
|
+
p?.segments && /* @__PURE__ */ V($, {
|
|
617
618
|
content: e,
|
|
618
619
|
version: r,
|
|
619
620
|
...s
|
|
620
621
|
}),
|
|
621
|
-
a && /* @__PURE__ */
|
|
622
|
+
a && /* @__PURE__ */ V(le, {
|
|
622
623
|
content: e,
|
|
623
624
|
version: r,
|
|
624
625
|
...s
|
|
625
626
|
}),
|
|
626
|
-
a && /* @__PURE__ */
|
|
627
|
+
a && /* @__PURE__ */ V(ue, {
|
|
627
628
|
content: e,
|
|
628
629
|
version: r,
|
|
629
630
|
model: i,
|
|
630
631
|
...s
|
|
631
632
|
}),
|
|
632
|
-
a && p?.presentation === "reader" && /* @__PURE__ */
|
|
633
|
+
a && p?.presentation === "reader" && /* @__PURE__ */ V(j, {
|
|
633
634
|
content: e.id,
|
|
634
635
|
version: r.id,
|
|
635
636
|
client: s.client,
|
|
@@ -638,9 +639,9 @@ function oe({ content: e, version: r, model: i, media: a, ...s }) {
|
|
|
638
639
|
]
|
|
639
640
|
});
|
|
640
641
|
}
|
|
641
|
-
function
|
|
642
|
-
let { t: s } = t(), c = n(i.client), { presets: l } = a({ client: c }), u = y("content.save", i.onError), d =
|
|
643
|
-
if (
|
|
642
|
+
function le({ content: e, version: r, ...i }) {
|
|
643
|
+
let { t: s } = t(), c = n(i.client), { presets: l } = a({ client: c }), u = y("content.save", i.onError), d = R(null), [f, p] = z(null);
|
|
644
|
+
if (F(() => () => void (f && URL.revokeObjectURL(f)), [f]), !l.some((t) => t.kind === e.kind && t.name === "cover")) return null;
|
|
644
645
|
let m = f ?? r.cover?.url, h = (t) => void u.run(async () => {
|
|
645
646
|
if (!t) return p(null), c.contents.setCover(e.id, r.id, null);
|
|
646
647
|
let n = {
|
|
@@ -650,26 +651,26 @@ function se({ content: e, version: r, ...i }) {
|
|
|
650
651
|
}, i = await c.media.uploadNamed(n, t, { path: await c.media.presetPath(e.kind, "cover", t) }), a = await c.contents.setCover(e.id, r.id, i.name);
|
|
651
652
|
return typeof URL.createObjectURL == "function" && p(URL.createObjectURL(t)), a;
|
|
652
653
|
});
|
|
653
|
-
return /* @__PURE__ */
|
|
654
|
+
return /* @__PURE__ */ H("div", {
|
|
654
655
|
className: "grid gap-1.5",
|
|
655
656
|
"data-ckui": "version-cover",
|
|
656
657
|
children: [
|
|
657
|
-
/* @__PURE__ */
|
|
658
|
+
/* @__PURE__ */ V("span", {
|
|
658
659
|
className: "text-sm font-medium",
|
|
659
660
|
children: s("contentManager.cover")
|
|
660
661
|
}),
|
|
661
|
-
/* @__PURE__ */
|
|
662
|
+
/* @__PURE__ */ H("div", {
|
|
662
663
|
className: "flex flex-wrap items-center gap-3",
|
|
663
664
|
children: [
|
|
664
|
-
m ? /* @__PURE__ */
|
|
665
|
+
m ? /* @__PURE__ */ V("img", {
|
|
665
666
|
src: m,
|
|
666
667
|
alt: "",
|
|
667
668
|
className: "h-20 w-36 rounded-md border border-border object-cover"
|
|
668
|
-
}) : /* @__PURE__ */
|
|
669
|
+
}) : /* @__PURE__ */ V("span", {
|
|
669
670
|
className: "text-muted-foreground",
|
|
670
671
|
children: s("contentManager.noCover")
|
|
671
672
|
}),
|
|
672
|
-
/* @__PURE__ */
|
|
673
|
+
/* @__PURE__ */ V(o, {
|
|
673
674
|
type: "button",
|
|
674
675
|
size: "sm",
|
|
675
676
|
variant: "outline",
|
|
@@ -677,7 +678,7 @@ function se({ content: e, version: r, ...i }) {
|
|
|
677
678
|
onClick: () => d.current?.click(),
|
|
678
679
|
children: s(m ? "pollEditor.replaceImage" : "contentManager.addCover")
|
|
679
680
|
}),
|
|
680
|
-
r.cover?.image && /* @__PURE__ */
|
|
681
|
+
r.cover?.image && /* @__PURE__ */ V(o, {
|
|
681
682
|
type: "button",
|
|
682
683
|
size: "sm",
|
|
683
684
|
variant: "ghost",
|
|
@@ -685,7 +686,7 @@ function se({ content: e, version: r, ...i }) {
|
|
|
685
686
|
onClick: () => h(null),
|
|
686
687
|
children: s("pollEditor.removeImage")
|
|
687
688
|
}),
|
|
688
|
-
/* @__PURE__ */
|
|
689
|
+
/* @__PURE__ */ V("input", {
|
|
689
690
|
ref: d,
|
|
690
691
|
type: "file",
|
|
691
692
|
accept: "image/*",
|
|
@@ -698,12 +699,12 @@ function se({ content: e, version: r, ...i }) {
|
|
|
698
699
|
})
|
|
699
700
|
]
|
|
700
701
|
}),
|
|
701
|
-
/* @__PURE__ */
|
|
702
|
+
/* @__PURE__ */ V(v, { error: u.error })
|
|
702
703
|
]
|
|
703
704
|
});
|
|
704
705
|
}
|
|
705
|
-
function
|
|
706
|
-
let { t: s } = t(), l = e(), u =
|
|
706
|
+
function ue({ content: n, version: r, model: a, ...o }) {
|
|
707
|
+
let { t: s } = t(), l = e(), u = L(() => ({
|
|
707
708
|
kind: n.kind,
|
|
708
709
|
id: n.id,
|
|
709
710
|
version: r.id
|
|
@@ -714,22 +715,27 @@ function ce({ content: n, version: r, model: a, ...o }) {
|
|
|
714
715
|
]), d = i(u, {
|
|
715
716
|
editor: !0,
|
|
716
717
|
client: o.client
|
|
717
|
-
}), f =
|
|
718
|
+
}), f = L(() => (a?.languages ?? []).map((e) => ({
|
|
718
719
|
value: e,
|
|
719
720
|
label: l(e)
|
|
720
721
|
})), [a, l]);
|
|
721
|
-
return !d.read && d.loading ? /* @__PURE__ */
|
|
722
|
+
return !d.read && d.loading ? /* @__PURE__ */ V(_, { className: "h-24 w-full" }) : d.read?.uploads && P(d.read.uploads).source ? /* @__PURE__ */ V(N, {
|
|
722
723
|
item: u,
|
|
723
724
|
languages: f,
|
|
724
725
|
client: o.client,
|
|
725
726
|
onError: o.onError
|
|
726
|
-
}) : /* @__PURE__ */
|
|
727
|
+
}) : /* @__PURE__ */ H(B, { children: [/* @__PURE__ */ V(c, {
|
|
727
728
|
item: u,
|
|
728
729
|
commit: r.live ? "manual" : "auto",
|
|
729
730
|
label: s("contentEditor.media"),
|
|
730
731
|
client: o.client,
|
|
731
732
|
onError: o.onError
|
|
732
|
-
})
|
|
733
|
+
}), a?.kinds[n.kind]?.presentation === "reader" && /* @__PURE__ */ V(M, {
|
|
734
|
+
content: n.id,
|
|
735
|
+
version: r.id,
|
|
736
|
+
client: o.client,
|
|
737
|
+
onError: o.onError
|
|
738
|
+
})] });
|
|
733
739
|
}
|
|
734
740
|
function $({ content: e, version: r, ...i }) {
|
|
735
741
|
let { t: a } = t(), s = n(i.client), c = () => r.segments.map((e) => ({
|
|
@@ -737,42 +743,42 @@ function $({ content: e, version: r, ...i }) {
|
|
|
737
743
|
start: String(e.start),
|
|
738
744
|
end: String(e.end),
|
|
739
745
|
release: C(e.release_at)
|
|
740
|
-
})), [l, d] =
|
|
741
|
-
|
|
742
|
-
let [f, p] =
|
|
746
|
+
})), [l, d] = z(c);
|
|
747
|
+
F(() => d(c()), [JSON.stringify(r.segments)]);
|
|
748
|
+
let [f, p] = z(!1), m = y("content.save", i.onError), h = (e, t) => {
|
|
743
749
|
p(!1), d((n) => n.map((n, r) => r === e ? {
|
|
744
750
|
...n,
|
|
745
751
|
...t
|
|
746
752
|
} : n));
|
|
747
753
|
}, g = l.every((e) => /^\d+$/.test(e.start) && /^\d+$/.test(e.end) && Number(e.end) > Number(e.start));
|
|
748
|
-
return /* @__PURE__ */
|
|
754
|
+
return /* @__PURE__ */ H("div", {
|
|
749
755
|
className: "grid gap-2",
|
|
750
756
|
"data-ckui": "segments-editor",
|
|
751
757
|
children: [
|
|
752
|
-
/* @__PURE__ */
|
|
758
|
+
/* @__PURE__ */ V("h4", {
|
|
753
759
|
className: "text-sm font-medium",
|
|
754
760
|
children: a("contentEditor.segments")
|
|
755
761
|
}),
|
|
756
|
-
l.length === 0 && /* @__PURE__ */
|
|
762
|
+
l.length === 0 && /* @__PURE__ */ V("p", {
|
|
757
763
|
className: "text-muted-foreground",
|
|
758
764
|
children: a("contentEditor.noSegments")
|
|
759
765
|
}),
|
|
760
|
-
l.map((e, t) => /* @__PURE__ */
|
|
766
|
+
l.map((e, t) => /* @__PURE__ */ H("div", {
|
|
761
767
|
className: "flex flex-wrap items-center gap-2",
|
|
762
768
|
"data-ckui": "segment-row",
|
|
763
769
|
children: [
|
|
764
|
-
/* @__PURE__ */
|
|
770
|
+
/* @__PURE__ */ V("span", {
|
|
765
771
|
className: "w-6 text-xs text-muted-foreground tabular-nums",
|
|
766
772
|
children: t + 1
|
|
767
773
|
}),
|
|
768
|
-
/* @__PURE__ */
|
|
774
|
+
/* @__PURE__ */ V(u, {
|
|
769
775
|
className: "h-8 w-40",
|
|
770
776
|
"aria-label": a("contentEditor.segmentTitle", { n: t + 1 }),
|
|
771
777
|
placeholder: a("contentEditor.segmentTitlePlaceholder"),
|
|
772
778
|
value: e.title,
|
|
773
779
|
onChange: (e) => h(t, { title: e.target.value })
|
|
774
780
|
}),
|
|
775
|
-
/* @__PURE__ */
|
|
781
|
+
/* @__PURE__ */ V(u, {
|
|
776
782
|
className: "h-8 w-20",
|
|
777
783
|
type: "number",
|
|
778
784
|
min: 0,
|
|
@@ -780,11 +786,11 @@ function $({ content: e, version: r, ...i }) {
|
|
|
780
786
|
value: e.start,
|
|
781
787
|
onChange: (e) => h(t, { start: e.target.value })
|
|
782
788
|
}),
|
|
783
|
-
/* @__PURE__ */
|
|
789
|
+
/* @__PURE__ */ V("span", {
|
|
784
790
|
"aria-hidden": !0,
|
|
785
791
|
children: "–"
|
|
786
792
|
}),
|
|
787
|
-
/* @__PURE__ */
|
|
793
|
+
/* @__PURE__ */ V(u, {
|
|
788
794
|
className: "h-8 w-20",
|
|
789
795
|
type: "number",
|
|
790
796
|
min: 1,
|
|
@@ -792,14 +798,14 @@ function $({ content: e, version: r, ...i }) {
|
|
|
792
798
|
value: e.end,
|
|
793
799
|
onChange: (e) => h(t, { end: e.target.value })
|
|
794
800
|
}),
|
|
795
|
-
/* @__PURE__ */
|
|
801
|
+
/* @__PURE__ */ V(u, {
|
|
796
802
|
className: "h-8 w-48",
|
|
797
803
|
type: "datetime-local",
|
|
798
804
|
"aria-label": a("contentEditor.segmentRelease", { n: t + 1 }),
|
|
799
805
|
value: e.release,
|
|
800
806
|
onChange: (e) => h(t, { release: e.target.value })
|
|
801
807
|
}),
|
|
802
|
-
/* @__PURE__ */
|
|
808
|
+
/* @__PURE__ */ V(o, {
|
|
803
809
|
type: "button",
|
|
804
810
|
size: "xs",
|
|
805
811
|
variant: "ghost",
|
|
@@ -808,10 +814,10 @@ function $({ content: e, version: r, ...i }) {
|
|
|
808
814
|
})
|
|
809
815
|
]
|
|
810
816
|
}, t)),
|
|
811
|
-
/* @__PURE__ */
|
|
817
|
+
/* @__PURE__ */ H("div", {
|
|
812
818
|
className: "flex flex-wrap items-center gap-2",
|
|
813
819
|
children: [
|
|
814
|
-
/* @__PURE__ */
|
|
820
|
+
/* @__PURE__ */ V(o, {
|
|
815
821
|
type: "button",
|
|
816
822
|
size: "sm",
|
|
817
823
|
variant: "outline",
|
|
@@ -826,7 +832,7 @@ function $({ content: e, version: r, ...i }) {
|
|
|
826
832
|
},
|
|
827
833
|
children: a("contentEditor.addSegment")
|
|
828
834
|
}),
|
|
829
|
-
/* @__PURE__ */
|
|
835
|
+
/* @__PURE__ */ V(o, {
|
|
830
836
|
type: "button",
|
|
831
837
|
size: "sm",
|
|
832
838
|
disabled: m.pending || !g,
|
|
@@ -844,42 +850,42 @@ function $({ content: e, version: r, ...i }) {
|
|
|
844
850
|
},
|
|
845
851
|
children: a("contentEditor.saveSegments")
|
|
846
852
|
}),
|
|
847
|
-
/* @__PURE__ */
|
|
853
|
+
/* @__PURE__ */ V(q, { show: f })
|
|
848
854
|
]
|
|
849
855
|
}),
|
|
850
|
-
/* @__PURE__ */
|
|
856
|
+
/* @__PURE__ */ V(v, { error: m.error })
|
|
851
857
|
]
|
|
852
858
|
});
|
|
853
859
|
}
|
|
854
|
-
function
|
|
855
|
-
let r = e(), i =
|
|
860
|
+
function de({ content: t, ...n }) {
|
|
861
|
+
let r = e(), i = L(() => t.versions.map((e) => ({
|
|
856
862
|
id: e.id,
|
|
857
|
-
label:
|
|
863
|
+
label: Q(e, r, n.labels)
|
|
858
864
|
})), [
|
|
859
865
|
t.versions,
|
|
860
866
|
r,
|
|
861
867
|
n.labels
|
|
862
|
-
]), { spec: a } =
|
|
863
|
-
return /* @__PURE__ */
|
|
864
|
-
className:
|
|
868
|
+
]), { spec: a } = J(t.kind, n.client);
|
|
869
|
+
return /* @__PURE__ */ H("div", {
|
|
870
|
+
className: U("grid gap-6", n.className),
|
|
865
871
|
"data-ckui": "content-sections",
|
|
866
872
|
children: [
|
|
867
|
-
/* @__PURE__ */
|
|
873
|
+
/* @__PURE__ */ V(Y, {
|
|
868
874
|
content: t,
|
|
869
875
|
...n
|
|
870
876
|
}),
|
|
871
|
-
/* @__PURE__ */
|
|
877
|
+
/* @__PURE__ */ V(ie, {
|
|
872
878
|
content: t,
|
|
873
879
|
...n
|
|
874
880
|
}),
|
|
875
|
-
/* @__PURE__ */
|
|
881
|
+
/* @__PURE__ */ V(ae, {
|
|
876
882
|
content: t,
|
|
877
883
|
...n
|
|
878
884
|
}),
|
|
879
|
-
!!a?.entities?.length && /* @__PURE__ */
|
|
885
|
+
!!a?.entities?.length && /* @__PURE__ */ V("section", {
|
|
880
886
|
className: "grid gap-3 border-t border-border pt-4",
|
|
881
887
|
"data-ckui": "content-groups",
|
|
882
|
-
children: /* @__PURE__ */
|
|
888
|
+
children: /* @__PURE__ */ V(A, {
|
|
883
889
|
management: n.management,
|
|
884
890
|
content: t.id,
|
|
885
891
|
contentKind: t.kind,
|
|
@@ -893,6 +899,6 @@ function le({ content: t, ...n }) {
|
|
|
893
899
|
});
|
|
894
900
|
}
|
|
895
901
|
//#endregion
|
|
896
|
-
export {
|
|
902
|
+
export { ie as AccessEditor, Y as ContentDetailsEditor, de as ContentSections, $ as SegmentsEditor, le as VersionCover, ae as VersionsEditor, Q as versionLabel };
|
|
897
903
|
|
|
898
904
|
//# sourceMappingURL=editors.js.map
|