@openrails/contentkit-ui 0.98.1 → 0.98.3
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 +6 -5
- package/dist/client/rendition.d.ts +1 -1
- package/dist/client/rendition.js +1 -1
- package/dist/client/rendition.js.map +1 -1
- package/dist/components/content/card.d.ts +8 -3
- package/dist/components/content/card.js +174 -160
- package/dist/components/content/card.js.map +1 -1
- package/dist/components/content/daily-releases.js +2 -0
- package/dist/components/content/daily-releases.js.map +1 -1
- package/dist/components/content/grid.d.ts +3 -1
- package/dist/components/content/grid.js +8 -2
- package/dist/components/content/grid.js.map +1 -1
- package/dist/components/rendition-img.d.ts +1 -1
- package/dist/components/rendition-img.js.map +1 -1
- package/dist/components/slot-image.d.ts +1 -1
- package/dist/components/slot-image.js.map +1 -1
- package/dist/components/video-poster.d.ts +1 -1
- package/dist/components/video-poster.js.map +1 -1
- package/dist/provider.d.ts +1 -1
- package/dist/provider.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,40 +1,42 @@
|
|
|
1
1
|
import { RenditionImg as e } from "../rendition-img.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
2
|
+
import { ratio as t } from "../../client/aspect.js";
|
|
3
|
+
import { useLanguageName as n, useMessages as r } from "../../i18n/context.js";
|
|
4
|
+
import { ContentKitContext as i } from "../../react/context.js";
|
|
5
|
+
import { usePresets as a } from "../../react/public.js";
|
|
6
|
+
import { HoverPreview as o } from "../hover-preview.js";
|
|
7
|
+
import { Badge as s } from "../../ui/badge.js";
|
|
8
|
+
import { RelativeTime as c, formatDate as l } from "../social/parts.js";
|
|
9
|
+
import { GroupAvatar as u, GroupLink as d, labelOf as f } from "../groups/parts.js";
|
|
10
|
+
import { priceLabel as p } from "./paywall.js";
|
|
11
|
+
import { useCallback as m, useContext as h, useState as g } from "react";
|
|
12
|
+
import { jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
13
|
+
import { cn as y } from "cn";
|
|
14
|
+
import { FavouriteIcon as b, LockIcon as x, ThumbsUpIcon as S } from "@hugeicons/core-free-icons";
|
|
15
|
+
import { HugeiconsIcon as C } from "@hugeicons/react";
|
|
14
16
|
//#region src/components/content/card.tsx
|
|
15
|
-
function
|
|
17
|
+
function w({ card: e, decorate: t, aboveTitle: n }) {
|
|
16
18
|
let r = t?.(e);
|
|
17
|
-
return r == null || r === !1 ? null : /* @__PURE__ */
|
|
18
|
-
className:
|
|
19
|
+
return r == null || r === !1 ? null : /* @__PURE__ */ _("span", {
|
|
20
|
+
className: y("pointer-events-none absolute inset-0", n && "z-20"),
|
|
19
21
|
"data-ckui": "card-decorations",
|
|
20
22
|
children: r
|
|
21
23
|
});
|
|
22
24
|
}
|
|
23
|
-
var
|
|
25
|
+
var T = (e, t) => new Intl.NumberFormat(t, {
|
|
24
26
|
notation: "compact",
|
|
25
27
|
maximumFractionDigits: 1
|
|
26
28
|
}).format(e);
|
|
27
|
-
function
|
|
29
|
+
function E(e, t, n = [], r) {
|
|
28
30
|
if (t.allowed) return null;
|
|
29
31
|
if (t.unknown) return e.t("contents.unknownAccess");
|
|
30
32
|
let i = t.offers?.[0];
|
|
31
|
-
if (i) return i.target.kind === "group" && Number(i.terms.amount) === 0 ? e.t("contents.joinFree") :
|
|
33
|
+
if (i) return i.target.kind === "group" && Number(i.terms.amount) === 0 ? e.t("contents.joinFree") : p(e, i.terms);
|
|
32
34
|
let a = t.sell?.find((e) => n.includes(e));
|
|
33
|
-
return a ?
|
|
35
|
+
return a ? f(r, a) : t.sell?.some((e) => e.includes(":group:")) ? e.t("contents.members") : t.sell?.length ? e.t("contents.forSale") : e.t("contents.locked");
|
|
34
36
|
}
|
|
35
|
-
function
|
|
36
|
-
let n =
|
|
37
|
-
return
|
|
37
|
+
function D(e, t) {
|
|
38
|
+
let n = h(i)?.navigate;
|
|
39
|
+
return m((r) => {
|
|
38
40
|
t?.(), !(!n || !e || r.defaultPrevented || r.button !== 0 || r.metaKey || r.ctrlKey || r.shiftKey || r.altKey) && (r.preventDefault(), n(e));
|
|
39
41
|
}, [
|
|
40
42
|
n,
|
|
@@ -42,273 +44,285 @@ function T(e, t) {
|
|
|
42
44
|
t
|
|
43
45
|
]);
|
|
44
46
|
}
|
|
45
|
-
function
|
|
46
|
-
let
|
|
47
|
+
function O({ card: i, client: c, href: u, onOpen: d, shape: p = "portrait", aspectRatio: h, titlePosition: O = "below", loadMedia: j = !0, groupKinds: M, chips: ee = 3, filterEntity: N, entityStyle: P = "chips", entityLayout: te = "inline", metadata: F, showCounts: ne = !0, tiers: re, labels: I, owner: ie = !0, ownerHref: ae, decorate: oe, children: se, className: ce }) {
|
|
48
|
+
let L = r(), { presets: le } = a({ client: c }), R = h ?? t(le.find((e) => e.kind === i.kind && e.name === "cover")?.aspect), { t: z } = L, ue = n(), B = u ? u(i) : i.path, V = D(B, m(() => d?.(i), [d, i])), H = E(L, i.access, re, I), U = i.version, W = i.viewer && i.viewer.progress_max > 0 ? Math.min(1, i.viewer.progress / i.viewer.progress_max) : 0, G = (M ?? Object.keys(i.entities)).map((e) => ({
|
|
47
49
|
kind: e,
|
|
48
|
-
|
|
49
|
-
}))),
|
|
50
|
-
...
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
].filter(Boolean),
|
|
54
|
-
|
|
50
|
+
entities: (i.entities[e] ?? []).filter((t) => !N || N(t, e)).slice(0, ee)
|
|
51
|
+
})).filter(({ entities: e }) => e.length > 0), K = U.duration_ms ? Math.round(U.duration_ms / 6e4) : 0, q = F?.traits, J = q === !1 ? [] : Array.isArray(q) ? U.traits.filter((e) => q.includes(e)) : U.traits, Y = [
|
|
52
|
+
...F?.languages === !1 ? [] : U.languages.map(ue),
|
|
53
|
+
F?.pages !== !1 && U.pages ? L.plural("contents.pages", U.pages) : null,
|
|
54
|
+
F?.duration !== !1 && K ? L.plural("contents.minutes", K) : null
|
|
55
|
+
].filter(Boolean), X = i.title || i.code, Z = y("flex flex-wrap", P === "text" ? "gap-x-2 gap-y-1" : "gap-1"), Q = (e, t) => t.map((t) => /* @__PURE__ */ _("li", {
|
|
56
|
+
"data-kind": e,
|
|
57
|
+
children: /* @__PURE__ */ _(A, {
|
|
58
|
+
url: t.path,
|
|
59
|
+
name: t.name || t.slug,
|
|
60
|
+
variant: P
|
|
61
|
+
})
|
|
62
|
+
}, `${e}:${t.id}`)), $ = G.length > 0 ? te === "rows" ? /* @__PURE__ */ _("div", {
|
|
63
|
+
className: "grid gap-1",
|
|
55
64
|
"data-ckui": "card-groups",
|
|
56
|
-
|
|
65
|
+
"data-layout": "rows",
|
|
66
|
+
children: G.map(({ kind: e, entities: t }) => /* @__PURE__ */ _("ul", {
|
|
67
|
+
className: Z,
|
|
68
|
+
"aria-label": f(I, e),
|
|
69
|
+
"data-ckui": "card-group-row",
|
|
57
70
|
"data-kind": e,
|
|
58
|
-
children:
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
71
|
+
children: Q(e, t)
|
|
72
|
+
}, e))
|
|
73
|
+
}) : /* @__PURE__ */ _("ul", {
|
|
74
|
+
className: Z,
|
|
75
|
+
"data-ckui": "card-groups",
|
|
76
|
+
"data-layout": "inline",
|
|
77
|
+
children: G.flatMap(({ kind: e, entities: t }) => Q(e, t))
|
|
78
|
+
}) : null, de = /* @__PURE__ */ v("a", {
|
|
79
|
+
href: B,
|
|
80
|
+
onClick: V,
|
|
81
|
+
className: y("text-lg leading-snug font-medium break-words focus-visible:underline sm:text-xl", O === "cover" ? "absolute inset-x-0 bottom-0 z-10 bg-linear-to-t from-black/90 via-black/60 to-transparent px-3 pt-10 pb-3 text-white hover:underline" : "hover:underline"),
|
|
68
82
|
"data-ckui": "card-title",
|
|
69
|
-
children: [/* @__PURE__ */
|
|
83
|
+
children: [/* @__PURE__ */ _("span", {
|
|
70
84
|
className: "line-clamp-2",
|
|
71
|
-
children:
|
|
72
|
-
}),
|
|
85
|
+
children: X
|
|
86
|
+
}), H && /* @__PURE__ */ v("span", {
|
|
73
87
|
className: "sr-only",
|
|
74
88
|
children: [
|
|
75
89
|
" (",
|
|
76
|
-
|
|
90
|
+
H,
|
|
77
91
|
")"
|
|
78
92
|
]
|
|
79
93
|
})]
|
|
80
|
-
}), [
|
|
81
|
-
return /* @__PURE__ */
|
|
82
|
-
ref:
|
|
83
|
-
className:
|
|
94
|
+
}), [fe, pe] = g(null);
|
|
95
|
+
return /* @__PURE__ */ v("article", {
|
|
96
|
+
ref: pe,
|
|
97
|
+
className: y("group/card grid content-start gap-2", ce),
|
|
84
98
|
"data-ckui": "content-card",
|
|
85
|
-
"data-id":
|
|
86
|
-
"data-locked":
|
|
87
|
-
lang:
|
|
88
|
-
children: [/* @__PURE__ */
|
|
99
|
+
"data-id": i.id,
|
|
100
|
+
"data-locked": H ? "" : void 0,
|
|
101
|
+
lang: i.language || void 0,
|
|
102
|
+
children: [/* @__PURE__ */ v("div", {
|
|
89
103
|
className: "relative overflow-hidden rounded-lg",
|
|
90
104
|
"data-ckui": "card-cover",
|
|
91
105
|
children: [
|
|
92
|
-
/* @__PURE__ */
|
|
93
|
-
href:
|
|
94
|
-
onClick:
|
|
106
|
+
/* @__PURE__ */ v("a", {
|
|
107
|
+
href: B,
|
|
108
|
+
onClick: V,
|
|
95
109
|
className: "relative block overflow-hidden rounded-lg bg-muted",
|
|
96
110
|
tabIndex: -1,
|
|
97
111
|
"aria-hidden": !0,
|
|
98
112
|
children: [
|
|
99
|
-
/* @__PURE__ */
|
|
113
|
+
/* @__PURE__ */ _("div", {
|
|
100
114
|
"data-ckui": "card-cover-frame",
|
|
101
|
-
className:
|
|
102
|
-
style:
|
|
103
|
-
children:
|
|
104
|
-
outputs:
|
|
115
|
+
className: R === void 0 ? p === "landscape" ? "aspect-video" : "aspect-[3/4]" : void 0,
|
|
116
|
+
style: R === void 0 ? void 0 : { aspectRatio: R },
|
|
117
|
+
children: j ? /* @__PURE__ */ _(e, {
|
|
118
|
+
outputs: i.cover,
|
|
105
119
|
alt: "",
|
|
106
120
|
fit: "cover",
|
|
107
121
|
skeleton: !0,
|
|
108
122
|
loading: "lazy",
|
|
109
123
|
className: "size-full transition-transform group-hover/card:scale-[1.02]",
|
|
110
|
-
fallback: /* @__PURE__ */
|
|
124
|
+
fallback: /* @__PURE__ */ _("span", {
|
|
111
125
|
className: "grid size-full place-items-center text-2xl font-semibold text-muted-foreground",
|
|
112
|
-
children:
|
|
126
|
+
children: X.charAt(0).toUpperCase()
|
|
113
127
|
})
|
|
114
|
-
}) : /* @__PURE__ */
|
|
128
|
+
}) : /* @__PURE__ */ _("span", {
|
|
115
129
|
className: "block size-full bg-muted",
|
|
116
130
|
"aria-hidden": !0
|
|
117
131
|
})
|
|
118
132
|
}),
|
|
119
|
-
|
|
133
|
+
j && U.hls && /* @__PURE__ */ _(o, {
|
|
120
134
|
item: {
|
|
121
|
-
kind:
|
|
122
|
-
id:
|
|
123
|
-
version:
|
|
135
|
+
kind: i.kind,
|
|
136
|
+
id: i.id,
|
|
137
|
+
version: U.id
|
|
124
138
|
},
|
|
125
|
-
dir:
|
|
126
|
-
duration:
|
|
127
|
-
target:
|
|
139
|
+
dir: U.hls,
|
|
140
|
+
duration: U.duration_ms ? U.duration_ms / 1e3 : void 0,
|
|
141
|
+
target: fe
|
|
128
142
|
}),
|
|
129
|
-
|
|
143
|
+
H && /* @__PURE__ */ v("span", {
|
|
130
144
|
className: "absolute top-2 left-2 inline-flex items-center gap-1 rounded-md bg-background/85 px-1.5 py-0.5 text-xs font-medium text-foreground shadow-sm",
|
|
131
145
|
"data-ckui": "card-lock",
|
|
132
|
-
children: [/* @__PURE__ */
|
|
133
|
-
icon:
|
|
146
|
+
children: [/* @__PURE__ */ _(C, {
|
|
147
|
+
icon: x,
|
|
134
148
|
strokeWidth: 2,
|
|
135
149
|
className: "size-3.5",
|
|
136
150
|
"aria-hidden": !0
|
|
137
|
-
}),
|
|
151
|
+
}), H]
|
|
138
152
|
}),
|
|
139
|
-
|
|
140
|
-
className:
|
|
153
|
+
W > 0 && /* @__PURE__ */ _("span", {
|
|
154
|
+
className: y("absolute inset-x-0 bottom-0 h-1 bg-background/60", O === "cover" && "z-20"),
|
|
141
155
|
"data-ckui": "card-progress",
|
|
142
|
-
children: /* @__PURE__ */
|
|
156
|
+
children: /* @__PURE__ */ _("span", {
|
|
143
157
|
className: "block h-full bg-primary",
|
|
144
|
-
style: { width: `${Math.round(
|
|
158
|
+
style: { width: `${Math.round(W * 100)}%` }
|
|
145
159
|
})
|
|
146
160
|
})
|
|
147
161
|
]
|
|
148
162
|
}),
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
card:
|
|
152
|
-
decorate:
|
|
153
|
-
aboveTitle:
|
|
163
|
+
O === "cover" && de,
|
|
164
|
+
j && /* @__PURE__ */ _(w, {
|
|
165
|
+
card: i,
|
|
166
|
+
decorate: oe,
|
|
167
|
+
aboveTitle: O === "cover"
|
|
154
168
|
})
|
|
155
169
|
]
|
|
156
|
-
}), /* @__PURE__ */
|
|
170
|
+
}), /* @__PURE__ */ v("div", {
|
|
157
171
|
className: "grid gap-1",
|
|
158
172
|
children: [
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
group:
|
|
163
|
-
href:
|
|
164
|
-
loadMedia:
|
|
173
|
+
O === "below" && de,
|
|
174
|
+
P === "text" && $,
|
|
175
|
+
ie && i.owner && /* @__PURE__ */ _(k, {
|
|
176
|
+
group: i.owner,
|
|
177
|
+
href: ae,
|
|
178
|
+
loadMedia: j
|
|
165
179
|
}),
|
|
166
|
-
|
|
180
|
+
J.length > 0 && /* @__PURE__ */ _("div", {
|
|
167
181
|
className: "flex flex-wrap gap-1",
|
|
168
182
|
"data-ckui": "card-traits",
|
|
169
|
-
children:
|
|
183
|
+
children: J.map((e) => /* @__PURE__ */ _(s, {
|
|
170
184
|
variant: "outline",
|
|
171
185
|
className: "h-auto rounded-md text-sm text-muted-foreground",
|
|
172
186
|
"data-ckui": "card-trait",
|
|
173
187
|
"data-trait": e,
|
|
174
|
-
children:
|
|
188
|
+
children: f(I, e)
|
|
175
189
|
}, e))
|
|
176
190
|
}),
|
|
177
|
-
|
|
191
|
+
Y.length > 0 && /* @__PURE__ */ _("p", {
|
|
178
192
|
className: "text-xs text-muted-foreground",
|
|
179
|
-
children:
|
|
193
|
+
children: Y.join(" · ")
|
|
180
194
|
}),
|
|
181
|
-
|
|
195
|
+
i.viewer?.completed && /* @__PURE__ */ _(s, {
|
|
182
196
|
variant: "secondary",
|
|
183
197
|
className: "justify-self-start",
|
|
184
|
-
children:
|
|
198
|
+
children: z("contents.completed")
|
|
185
199
|
}),
|
|
186
|
-
!
|
|
200
|
+
!i.access.allowed && i.access.free_after && /* @__PURE__ */ _("p", {
|
|
187
201
|
className: "text-xs text-muted-foreground",
|
|
188
|
-
children:
|
|
202
|
+
children: z("contents.freeFrom", { date: l(L, i.access.free_after, !1) })
|
|
189
203
|
}),
|
|
190
|
-
|
|
191
|
-
|
|
204
|
+
P === "chips" && $,
|
|
205
|
+
ne && (i.counts.favorites !== void 0 || i.counts.likes !== void 0) && /* @__PURE__ */ v("p", {
|
|
192
206
|
className: "flex items-center gap-3 text-xs text-muted-foreground tabular-nums",
|
|
193
207
|
"data-ckui": "card-counts",
|
|
194
|
-
children: [
|
|
208
|
+
children: [i.counts.favorites !== void 0 && /* @__PURE__ */ v("span", {
|
|
195
209
|
className: "inline-flex items-center gap-1",
|
|
196
|
-
title:
|
|
210
|
+
title: z("contents.favorites"),
|
|
197
211
|
children: [
|
|
198
|
-
/* @__PURE__ */
|
|
199
|
-
icon:
|
|
212
|
+
/* @__PURE__ */ _(C, {
|
|
213
|
+
icon: b,
|
|
200
214
|
strokeWidth: 2,
|
|
201
|
-
className:
|
|
215
|
+
className: y("size-3.5", i.viewer?.favorited && "fill-current text-primary"),
|
|
202
216
|
"aria-hidden": !0
|
|
203
217
|
}),
|
|
204
|
-
/* @__PURE__ */
|
|
218
|
+
/* @__PURE__ */ _("span", {
|
|
205
219
|
className: "sr-only",
|
|
206
|
-
children:
|
|
220
|
+
children: z("contents.favorites")
|
|
207
221
|
}),
|
|
208
|
-
|
|
222
|
+
T(i.counts.favorites, L.language)
|
|
209
223
|
]
|
|
210
|
-
}),
|
|
224
|
+
}), i.counts.likes !== void 0 && /* @__PURE__ */ v("span", {
|
|
211
225
|
className: "inline-flex items-center gap-1",
|
|
212
|
-
title:
|
|
226
|
+
title: z("contents.likes"),
|
|
213
227
|
children: [
|
|
214
|
-
/* @__PURE__ */
|
|
215
|
-
icon:
|
|
228
|
+
/* @__PURE__ */ _(C, {
|
|
229
|
+
icon: S,
|
|
216
230
|
strokeWidth: 2,
|
|
217
231
|
className: "size-3.5",
|
|
218
232
|
"aria-hidden": !0
|
|
219
233
|
}),
|
|
220
|
-
/* @__PURE__ */
|
|
234
|
+
/* @__PURE__ */ _("span", {
|
|
221
235
|
className: "sr-only",
|
|
222
|
-
children:
|
|
236
|
+
children: z("contents.likes")
|
|
223
237
|
}),
|
|
224
|
-
|
|
238
|
+
T(i.counts.likes, L.language)
|
|
225
239
|
]
|
|
226
240
|
})]
|
|
227
241
|
}),
|
|
228
|
-
|
|
242
|
+
se
|
|
229
243
|
]
|
|
230
244
|
})]
|
|
231
245
|
});
|
|
232
246
|
}
|
|
233
|
-
function
|
|
234
|
-
return /* @__PURE__ */
|
|
235
|
-
className:
|
|
247
|
+
function k({ group: e, href: t, className: n, loadMedia: r = !0 }) {
|
|
248
|
+
return /* @__PURE__ */ _("span", {
|
|
249
|
+
className: y("flex min-w-0 text-xs text-muted-foreground", n),
|
|
236
250
|
"data-ckui": "card-owner",
|
|
237
251
|
"data-id": e.id,
|
|
238
|
-
children: /* @__PURE__ */
|
|
252
|
+
children: /* @__PURE__ */ v(d, {
|
|
239
253
|
group: e,
|
|
240
254
|
href: t,
|
|
241
255
|
className: "inline-flex min-w-0 items-center gap-1.5 hover:text-foreground",
|
|
242
|
-
children: [r ? /* @__PURE__ */
|
|
256
|
+
children: [r ? /* @__PURE__ */ _(u, {
|
|
243
257
|
group: e,
|
|
244
258
|
className: "size-5 shrink-0 text-[0.625rem]"
|
|
245
|
-
}) : /* @__PURE__ */
|
|
259
|
+
}) : /* @__PURE__ */ _("span", {
|
|
246
260
|
className: "size-5 shrink-0 rounded-full bg-muted",
|
|
247
261
|
"aria-hidden": !0
|
|
248
|
-
}), /* @__PURE__ */
|
|
262
|
+
}), /* @__PURE__ */ _("span", {
|
|
249
263
|
className: "truncate",
|
|
250
264
|
children: e.name || e.slug
|
|
251
265
|
})]
|
|
252
266
|
})
|
|
253
267
|
});
|
|
254
268
|
}
|
|
255
|
-
function
|
|
256
|
-
let r =
|
|
257
|
-
return e ? /* @__PURE__ */
|
|
269
|
+
function A({ url: e, name: t, variant: n = "chips" }) {
|
|
270
|
+
let r = D(e), i = n === "text" ? "text-sm text-muted-foreground" : "inline-block rounded-md border border-border px-1.5 py-0.5 text-sm text-muted-foreground";
|
|
271
|
+
return e ? /* @__PURE__ */ _("a", {
|
|
258
272
|
href: e,
|
|
259
273
|
onClick: r,
|
|
260
|
-
className:
|
|
274
|
+
className: y(i, "hover:text-foreground", n === "text" ? "hover:underline" : "hover:bg-muted"),
|
|
261
275
|
children: t
|
|
262
|
-
}) : /* @__PURE__ */
|
|
276
|
+
}) : /* @__PURE__ */ _("span", {
|
|
263
277
|
className: i,
|
|
264
278
|
children: t
|
|
265
279
|
});
|
|
266
280
|
}
|
|
267
|
-
function
|
|
268
|
-
let
|
|
269
|
-
return /* @__PURE__ */
|
|
270
|
-
className:
|
|
281
|
+
function j({ card: t, href: n, onOpen: i, tiers: a, labels: o, byline: s, owner: l = !0, ownerHref: u, loadMedia: d = !0, showCounts: f = !0, decorate: p, children: h, className: g }) {
|
|
282
|
+
let S = r(), O = n ? n(t) : t.path, A = D(O, m(() => i?.(t), [i, t])), j = E(S, t.access, a, o), M = t.title || t.code;
|
|
283
|
+
return /* @__PURE__ */ v("article", {
|
|
284
|
+
className: y("grid gap-3 rounded-lg border border-border p-3", g),
|
|
271
285
|
"data-ckui": "post-card",
|
|
272
286
|
"data-id": t.id,
|
|
273
287
|
"data-locked": j ? "" : void 0,
|
|
274
288
|
lang: t.language || void 0,
|
|
275
289
|
children: [
|
|
276
|
-
|
|
290
|
+
s ?? (l && t.owner && /* @__PURE__ */ _(k, {
|
|
277
291
|
group: t.owner,
|
|
278
292
|
href: u,
|
|
279
293
|
loadMedia: d,
|
|
280
294
|
className: "text-sm"
|
|
281
295
|
})),
|
|
282
|
-
/* @__PURE__ */
|
|
283
|
-
href:
|
|
296
|
+
/* @__PURE__ */ v("a", {
|
|
297
|
+
href: O,
|
|
284
298
|
onClick: A,
|
|
285
299
|
className: "grid gap-2",
|
|
286
|
-
children: [/* @__PURE__ */
|
|
300
|
+
children: [/* @__PURE__ */ _("span", {
|
|
287
301
|
className: "font-medium break-words hover:underline",
|
|
288
302
|
"data-ckui": "card-title",
|
|
289
303
|
children: M
|
|
290
|
-
}), t.cover.length > 0 && /* @__PURE__ */
|
|
304
|
+
}), t.cover.length > 0 && /* @__PURE__ */ v("span", {
|
|
291
305
|
className: "relative block aspect-video overflow-hidden rounded-md bg-muted",
|
|
292
306
|
children: [
|
|
293
|
-
d && /* @__PURE__ */
|
|
307
|
+
d && /* @__PURE__ */ _(e, {
|
|
294
308
|
outputs: t.cover,
|
|
295
309
|
alt: "",
|
|
296
310
|
fit: "cover",
|
|
297
311
|
skeleton: !0,
|
|
298
312
|
loading: "lazy",
|
|
299
|
-
className:
|
|
313
|
+
className: y("size-full", j && "blur-md")
|
|
300
314
|
}),
|
|
301
|
-
d && /* @__PURE__ */
|
|
315
|
+
d && /* @__PURE__ */ _(w, {
|
|
302
316
|
card: t,
|
|
303
|
-
decorate:
|
|
317
|
+
decorate: p
|
|
304
318
|
}),
|
|
305
|
-
j && /* @__PURE__ */
|
|
319
|
+
j && /* @__PURE__ */ _("span", {
|
|
306
320
|
className: "absolute inset-0 grid place-items-center",
|
|
307
|
-
children: /* @__PURE__ */
|
|
321
|
+
children: /* @__PURE__ */ v("span", {
|
|
308
322
|
className: "inline-flex items-center gap-1 rounded-md bg-background/85 px-2 py-1 text-xs font-medium shadow-sm",
|
|
309
323
|
"data-ckui": "card-lock",
|
|
310
|
-
children: [/* @__PURE__ */
|
|
311
|
-
icon:
|
|
324
|
+
children: [/* @__PURE__ */ _(C, {
|
|
325
|
+
icon: x,
|
|
312
326
|
strokeWidth: 2,
|
|
313
327
|
className: "size-3.5",
|
|
314
328
|
"aria-hidden": !0
|
|
@@ -318,38 +332,38 @@ function k({ card: t, href: r, onOpen: i, tiers: a, labels: s, byline: c, owner:
|
|
|
318
332
|
]
|
|
319
333
|
})]
|
|
320
334
|
}),
|
|
321
|
-
/* @__PURE__ */
|
|
335
|
+
/* @__PURE__ */ v("p", {
|
|
322
336
|
className: "flex flex-wrap items-center gap-3 text-xs text-muted-foreground",
|
|
323
337
|
children: [
|
|
324
|
-
t.published_at && /* @__PURE__ */
|
|
325
|
-
!t.cover.length && j && /* @__PURE__ */
|
|
338
|
+
t.published_at && /* @__PURE__ */ _(c, { at: t.published_at }),
|
|
339
|
+
!t.cover.length && j && /* @__PURE__ */ _("span", {
|
|
326
340
|
"data-ckui": "card-lock",
|
|
327
341
|
children: j
|
|
328
342
|
}),
|
|
329
|
-
|
|
343
|
+
f && t.counts.favorites !== void 0 && /* @__PURE__ */ v("span", {
|
|
330
344
|
className: "inline-flex items-center gap-1 tabular-nums",
|
|
331
345
|
"data-ckui": "card-counts",
|
|
332
346
|
children: [
|
|
333
|
-
/* @__PURE__ */
|
|
334
|
-
icon:
|
|
347
|
+
/* @__PURE__ */ _(C, {
|
|
348
|
+
icon: b,
|
|
335
349
|
strokeWidth: 2,
|
|
336
|
-
className:
|
|
350
|
+
className: y("size-3.5", t.viewer?.favorited && "fill-current text-primary"),
|
|
337
351
|
"aria-hidden": !0
|
|
338
352
|
}),
|
|
339
|
-
/* @__PURE__ */
|
|
353
|
+
/* @__PURE__ */ _("span", {
|
|
340
354
|
className: "sr-only",
|
|
341
|
-
children:
|
|
355
|
+
children: S.t("contents.favorites")
|
|
342
356
|
}),
|
|
343
|
-
|
|
357
|
+
T(t.counts.favorites, S.language)
|
|
344
358
|
]
|
|
345
359
|
})
|
|
346
360
|
]
|
|
347
361
|
}),
|
|
348
|
-
|
|
362
|
+
h
|
|
349
363
|
]
|
|
350
364
|
});
|
|
351
365
|
}
|
|
352
366
|
//#endregion
|
|
353
|
-
export {
|
|
367
|
+
export { O as ContentCard, k as OwnerChip, j as PostCard, E as lockLabel };
|
|
354
368
|
|
|
355
369
|
//# sourceMappingURL=card.js.map
|