@openrails/contentkit-ui 0.98.0 → 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 +182 -158
- 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/index.js +1 -1
- package/dist/provider.d.ts +1 -1
- package/dist/provider.js.map +1 -1
- package/dist/styles.css +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,263 +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
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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",
|
|
56
64
|
"data-ckui": "card-groups",
|
|
57
|
-
|
|
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",
|
|
58
70
|
"data-kind": e,
|
|
59
|
-
children:
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
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"),
|
|
69
82
|
"data-ckui": "card-title",
|
|
70
|
-
children: [/* @__PURE__ */
|
|
83
|
+
children: [/* @__PURE__ */ _("span", {
|
|
71
84
|
className: "line-clamp-2",
|
|
72
|
-
children:
|
|
73
|
-
}),
|
|
85
|
+
children: X
|
|
86
|
+
}), H && /* @__PURE__ */ v("span", {
|
|
74
87
|
className: "sr-only",
|
|
75
88
|
children: [
|
|
76
89
|
" (",
|
|
77
|
-
|
|
90
|
+
H,
|
|
78
91
|
")"
|
|
79
92
|
]
|
|
80
93
|
})]
|
|
81
|
-
}), [
|
|
82
|
-
return /* @__PURE__ */
|
|
83
|
-
ref:
|
|
84
|
-
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),
|
|
85
98
|
"data-ckui": "content-card",
|
|
86
|
-
"data-id":
|
|
87
|
-
"data-locked":
|
|
88
|
-
lang:
|
|
89
|
-
children: [/* @__PURE__ */
|
|
99
|
+
"data-id": i.id,
|
|
100
|
+
"data-locked": H ? "" : void 0,
|
|
101
|
+
lang: i.language || void 0,
|
|
102
|
+
children: [/* @__PURE__ */ v("div", {
|
|
90
103
|
className: "relative overflow-hidden rounded-lg",
|
|
91
104
|
"data-ckui": "card-cover",
|
|
92
105
|
children: [
|
|
93
|
-
/* @__PURE__ */
|
|
94
|
-
href:
|
|
95
|
-
onClick:
|
|
106
|
+
/* @__PURE__ */ v("a", {
|
|
107
|
+
href: B,
|
|
108
|
+
onClick: V,
|
|
96
109
|
className: "relative block overflow-hidden rounded-lg bg-muted",
|
|
97
110
|
tabIndex: -1,
|
|
98
111
|
"aria-hidden": !0,
|
|
99
112
|
children: [
|
|
100
|
-
/* @__PURE__ */
|
|
113
|
+
/* @__PURE__ */ _("div", {
|
|
101
114
|
"data-ckui": "card-cover-frame",
|
|
102
|
-
className:
|
|
103
|
-
style:
|
|
104
|
-
children:
|
|
105
|
-
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,
|
|
106
119
|
alt: "",
|
|
107
120
|
fit: "cover",
|
|
108
121
|
skeleton: !0,
|
|
109
122
|
loading: "lazy",
|
|
110
123
|
className: "size-full transition-transform group-hover/card:scale-[1.02]",
|
|
111
|
-
fallback: /* @__PURE__ */
|
|
124
|
+
fallback: /* @__PURE__ */ _("span", {
|
|
112
125
|
className: "grid size-full place-items-center text-2xl font-semibold text-muted-foreground",
|
|
113
|
-
children:
|
|
126
|
+
children: X.charAt(0).toUpperCase()
|
|
114
127
|
})
|
|
115
|
-
}) : /* @__PURE__ */
|
|
128
|
+
}) : /* @__PURE__ */ _("span", {
|
|
116
129
|
className: "block size-full bg-muted",
|
|
117
130
|
"aria-hidden": !0
|
|
118
131
|
})
|
|
119
132
|
}),
|
|
120
|
-
|
|
133
|
+
j && U.hls && /* @__PURE__ */ _(o, {
|
|
121
134
|
item: {
|
|
122
|
-
kind:
|
|
123
|
-
id:
|
|
124
|
-
version:
|
|
135
|
+
kind: i.kind,
|
|
136
|
+
id: i.id,
|
|
137
|
+
version: U.id
|
|
125
138
|
},
|
|
126
|
-
dir:
|
|
127
|
-
duration:
|
|
128
|
-
target:
|
|
139
|
+
dir: U.hls,
|
|
140
|
+
duration: U.duration_ms ? U.duration_ms / 1e3 : void 0,
|
|
141
|
+
target: fe
|
|
129
142
|
}),
|
|
130
|
-
|
|
143
|
+
H && /* @__PURE__ */ v("span", {
|
|
131
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",
|
|
132
145
|
"data-ckui": "card-lock",
|
|
133
|
-
children: [/* @__PURE__ */
|
|
134
|
-
icon:
|
|
146
|
+
children: [/* @__PURE__ */ _(C, {
|
|
147
|
+
icon: x,
|
|
135
148
|
strokeWidth: 2,
|
|
136
149
|
className: "size-3.5",
|
|
137
150
|
"aria-hidden": !0
|
|
138
|
-
}),
|
|
151
|
+
}), H]
|
|
139
152
|
}),
|
|
140
|
-
|
|
141
|
-
className:
|
|
153
|
+
W > 0 && /* @__PURE__ */ _("span", {
|
|
154
|
+
className: y("absolute inset-x-0 bottom-0 h-1 bg-background/60", O === "cover" && "z-20"),
|
|
142
155
|
"data-ckui": "card-progress",
|
|
143
|
-
children: /* @__PURE__ */
|
|
156
|
+
children: /* @__PURE__ */ _("span", {
|
|
144
157
|
className: "block h-full bg-primary",
|
|
145
|
-
style: { width: `${Math.round(
|
|
158
|
+
style: { width: `${Math.round(W * 100)}%` }
|
|
146
159
|
})
|
|
147
160
|
})
|
|
148
161
|
]
|
|
149
162
|
}),
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
card:
|
|
153
|
-
decorate:
|
|
154
|
-
aboveTitle:
|
|
163
|
+
O === "cover" && de,
|
|
164
|
+
j && /* @__PURE__ */ _(w, {
|
|
165
|
+
card: i,
|
|
166
|
+
decorate: oe,
|
|
167
|
+
aboveTitle: O === "cover"
|
|
155
168
|
})
|
|
156
169
|
]
|
|
157
|
-
}), /* @__PURE__ */
|
|
170
|
+
}), /* @__PURE__ */ v("div", {
|
|
158
171
|
className: "grid gap-1",
|
|
159
172
|
children: [
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
group:
|
|
164
|
-
href:
|
|
165
|
-
loadMedia:
|
|
173
|
+
O === "below" && de,
|
|
174
|
+
P === "text" && $,
|
|
175
|
+
ie && i.owner && /* @__PURE__ */ _(k, {
|
|
176
|
+
group: i.owner,
|
|
177
|
+
href: ae,
|
|
178
|
+
loadMedia: j
|
|
179
|
+
}),
|
|
180
|
+
J.length > 0 && /* @__PURE__ */ _("div", {
|
|
181
|
+
className: "flex flex-wrap gap-1",
|
|
182
|
+
"data-ckui": "card-traits",
|
|
183
|
+
children: J.map((e) => /* @__PURE__ */ _(s, {
|
|
184
|
+
variant: "outline",
|
|
185
|
+
className: "h-auto rounded-md text-sm text-muted-foreground",
|
|
186
|
+
"data-ckui": "card-trait",
|
|
187
|
+
"data-trait": e,
|
|
188
|
+
children: f(I, e)
|
|
189
|
+
}, e))
|
|
166
190
|
}),
|
|
167
|
-
|
|
191
|
+
Y.length > 0 && /* @__PURE__ */ _("p", {
|
|
168
192
|
className: "text-xs text-muted-foreground",
|
|
169
|
-
children:
|
|
193
|
+
children: Y.join(" · ")
|
|
170
194
|
}),
|
|
171
|
-
|
|
195
|
+
i.viewer?.completed && /* @__PURE__ */ _(s, {
|
|
172
196
|
variant: "secondary",
|
|
173
197
|
className: "justify-self-start",
|
|
174
|
-
children:
|
|
198
|
+
children: z("contents.completed")
|
|
175
199
|
}),
|
|
176
|
-
!
|
|
200
|
+
!i.access.allowed && i.access.free_after && /* @__PURE__ */ _("p", {
|
|
177
201
|
className: "text-xs text-muted-foreground",
|
|
178
|
-
children:
|
|
202
|
+
children: z("contents.freeFrom", { date: l(L, i.access.free_after, !1) })
|
|
179
203
|
}),
|
|
180
|
-
|
|
181
|
-
|
|
204
|
+
P === "chips" && $,
|
|
205
|
+
ne && (i.counts.favorites !== void 0 || i.counts.likes !== void 0) && /* @__PURE__ */ v("p", {
|
|
182
206
|
className: "flex items-center gap-3 text-xs text-muted-foreground tabular-nums",
|
|
183
207
|
"data-ckui": "card-counts",
|
|
184
|
-
children: [
|
|
208
|
+
children: [i.counts.favorites !== void 0 && /* @__PURE__ */ v("span", {
|
|
185
209
|
className: "inline-flex items-center gap-1",
|
|
186
|
-
title:
|
|
210
|
+
title: z("contents.favorites"),
|
|
187
211
|
children: [
|
|
188
|
-
/* @__PURE__ */
|
|
189
|
-
icon:
|
|
212
|
+
/* @__PURE__ */ _(C, {
|
|
213
|
+
icon: b,
|
|
190
214
|
strokeWidth: 2,
|
|
191
|
-
className:
|
|
215
|
+
className: y("size-3.5", i.viewer?.favorited && "fill-current text-primary"),
|
|
192
216
|
"aria-hidden": !0
|
|
193
217
|
}),
|
|
194
|
-
/* @__PURE__ */
|
|
218
|
+
/* @__PURE__ */ _("span", {
|
|
195
219
|
className: "sr-only",
|
|
196
|
-
children:
|
|
220
|
+
children: z("contents.favorites")
|
|
197
221
|
}),
|
|
198
|
-
|
|
222
|
+
T(i.counts.favorites, L.language)
|
|
199
223
|
]
|
|
200
|
-
}),
|
|
224
|
+
}), i.counts.likes !== void 0 && /* @__PURE__ */ v("span", {
|
|
201
225
|
className: "inline-flex items-center gap-1",
|
|
202
|
-
title:
|
|
226
|
+
title: z("contents.likes"),
|
|
203
227
|
children: [
|
|
204
|
-
/* @__PURE__ */
|
|
205
|
-
icon:
|
|
228
|
+
/* @__PURE__ */ _(C, {
|
|
229
|
+
icon: S,
|
|
206
230
|
strokeWidth: 2,
|
|
207
231
|
className: "size-3.5",
|
|
208
232
|
"aria-hidden": !0
|
|
209
233
|
}),
|
|
210
|
-
/* @__PURE__ */
|
|
234
|
+
/* @__PURE__ */ _("span", {
|
|
211
235
|
className: "sr-only",
|
|
212
|
-
children:
|
|
236
|
+
children: z("contents.likes")
|
|
213
237
|
}),
|
|
214
|
-
|
|
238
|
+
T(i.counts.likes, L.language)
|
|
215
239
|
]
|
|
216
240
|
})]
|
|
217
241
|
}),
|
|
218
|
-
|
|
242
|
+
se
|
|
219
243
|
]
|
|
220
244
|
})]
|
|
221
245
|
});
|
|
222
246
|
}
|
|
223
|
-
function
|
|
224
|
-
return /* @__PURE__ */
|
|
225
|
-
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),
|
|
226
250
|
"data-ckui": "card-owner",
|
|
227
251
|
"data-id": e.id,
|
|
228
|
-
children: /* @__PURE__ */
|
|
252
|
+
children: /* @__PURE__ */ v(d, {
|
|
229
253
|
group: e,
|
|
230
254
|
href: t,
|
|
231
255
|
className: "inline-flex min-w-0 items-center gap-1.5 hover:text-foreground",
|
|
232
|
-
children: [r ? /* @__PURE__ */
|
|
256
|
+
children: [r ? /* @__PURE__ */ _(u, {
|
|
233
257
|
group: e,
|
|
234
258
|
className: "size-5 shrink-0 text-[0.625rem]"
|
|
235
|
-
}) : /* @__PURE__ */
|
|
259
|
+
}) : /* @__PURE__ */ _("span", {
|
|
236
260
|
className: "size-5 shrink-0 rounded-full bg-muted",
|
|
237
261
|
"aria-hidden": !0
|
|
238
|
-
}), /* @__PURE__ */
|
|
262
|
+
}), /* @__PURE__ */ _("span", {
|
|
239
263
|
className: "truncate",
|
|
240
264
|
children: e.name || e.slug
|
|
241
265
|
})]
|
|
242
266
|
})
|
|
243
267
|
});
|
|
244
268
|
}
|
|
245
|
-
function
|
|
246
|
-
let r =
|
|
247
|
-
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", {
|
|
248
272
|
href: e,
|
|
249
273
|
onClick: r,
|
|
250
|
-
className:
|
|
274
|
+
className: y(i, "hover:text-foreground", n === "text" ? "hover:underline" : "hover:bg-muted"),
|
|
251
275
|
children: t
|
|
252
|
-
}) : /* @__PURE__ */
|
|
276
|
+
}) : /* @__PURE__ */ _("span", {
|
|
253
277
|
className: i,
|
|
254
278
|
children: t
|
|
255
279
|
});
|
|
256
280
|
}
|
|
257
|
-
function
|
|
258
|
-
let
|
|
259
|
-
return /* @__PURE__ */
|
|
260
|
-
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),
|
|
261
285
|
"data-ckui": "post-card",
|
|
262
286
|
"data-id": t.id,
|
|
263
287
|
"data-locked": j ? "" : void 0,
|
|
264
288
|
lang: t.language || void 0,
|
|
265
289
|
children: [
|
|
266
|
-
|
|
290
|
+
s ?? (l && t.owner && /* @__PURE__ */ _(k, {
|
|
267
291
|
group: t.owner,
|
|
268
292
|
href: u,
|
|
269
293
|
loadMedia: d,
|
|
270
294
|
className: "text-sm"
|
|
271
295
|
})),
|
|
272
|
-
/* @__PURE__ */
|
|
273
|
-
href:
|
|
296
|
+
/* @__PURE__ */ v("a", {
|
|
297
|
+
href: O,
|
|
274
298
|
onClick: A,
|
|
275
299
|
className: "grid gap-2",
|
|
276
|
-
children: [/* @__PURE__ */
|
|
300
|
+
children: [/* @__PURE__ */ _("span", {
|
|
277
301
|
className: "font-medium break-words hover:underline",
|
|
278
302
|
"data-ckui": "card-title",
|
|
279
303
|
children: M
|
|
280
|
-
}), t.cover.length > 0 && /* @__PURE__ */
|
|
304
|
+
}), t.cover.length > 0 && /* @__PURE__ */ v("span", {
|
|
281
305
|
className: "relative block aspect-video overflow-hidden rounded-md bg-muted",
|
|
282
306
|
children: [
|
|
283
|
-
d && /* @__PURE__ */
|
|
307
|
+
d && /* @__PURE__ */ _(e, {
|
|
284
308
|
outputs: t.cover,
|
|
285
309
|
alt: "",
|
|
286
310
|
fit: "cover",
|
|
287
311
|
skeleton: !0,
|
|
288
312
|
loading: "lazy",
|
|
289
|
-
className:
|
|
313
|
+
className: y("size-full", j && "blur-md")
|
|
290
314
|
}),
|
|
291
|
-
d && /* @__PURE__ */
|
|
315
|
+
d && /* @__PURE__ */ _(w, {
|
|
292
316
|
card: t,
|
|
293
|
-
decorate:
|
|
317
|
+
decorate: p
|
|
294
318
|
}),
|
|
295
|
-
j && /* @__PURE__ */
|
|
319
|
+
j && /* @__PURE__ */ _("span", {
|
|
296
320
|
className: "absolute inset-0 grid place-items-center",
|
|
297
|
-
children: /* @__PURE__ */
|
|
321
|
+
children: /* @__PURE__ */ v("span", {
|
|
298
322
|
className: "inline-flex items-center gap-1 rounded-md bg-background/85 px-2 py-1 text-xs font-medium shadow-sm",
|
|
299
323
|
"data-ckui": "card-lock",
|
|
300
|
-
children: [/* @__PURE__ */
|
|
301
|
-
icon:
|
|
324
|
+
children: [/* @__PURE__ */ _(C, {
|
|
325
|
+
icon: x,
|
|
302
326
|
strokeWidth: 2,
|
|
303
327
|
className: "size-3.5",
|
|
304
328
|
"aria-hidden": !0
|
|
@@ -308,38 +332,38 @@ function k({ card: t, href: r, onOpen: i, tiers: a, labels: s, byline: c, owner:
|
|
|
308
332
|
]
|
|
309
333
|
})]
|
|
310
334
|
}),
|
|
311
|
-
/* @__PURE__ */
|
|
335
|
+
/* @__PURE__ */ v("p", {
|
|
312
336
|
className: "flex flex-wrap items-center gap-3 text-xs text-muted-foreground",
|
|
313
337
|
children: [
|
|
314
|
-
t.published_at && /* @__PURE__ */
|
|
315
|
-
!t.cover.length && j && /* @__PURE__ */
|
|
338
|
+
t.published_at && /* @__PURE__ */ _(c, { at: t.published_at }),
|
|
339
|
+
!t.cover.length && j && /* @__PURE__ */ _("span", {
|
|
316
340
|
"data-ckui": "card-lock",
|
|
317
341
|
children: j
|
|
318
342
|
}),
|
|
319
|
-
|
|
343
|
+
f && t.counts.favorites !== void 0 && /* @__PURE__ */ v("span", {
|
|
320
344
|
className: "inline-flex items-center gap-1 tabular-nums",
|
|
321
345
|
"data-ckui": "card-counts",
|
|
322
346
|
children: [
|
|
323
|
-
/* @__PURE__ */
|
|
324
|
-
icon:
|
|
347
|
+
/* @__PURE__ */ _(C, {
|
|
348
|
+
icon: b,
|
|
325
349
|
strokeWidth: 2,
|
|
326
|
-
className:
|
|
350
|
+
className: y("size-3.5", t.viewer?.favorited && "fill-current text-primary"),
|
|
327
351
|
"aria-hidden": !0
|
|
328
352
|
}),
|
|
329
|
-
/* @__PURE__ */
|
|
353
|
+
/* @__PURE__ */ _("span", {
|
|
330
354
|
className: "sr-only",
|
|
331
|
-
children:
|
|
355
|
+
children: S.t("contents.favorites")
|
|
332
356
|
}),
|
|
333
|
-
|
|
357
|
+
T(t.counts.favorites, S.language)
|
|
334
358
|
]
|
|
335
359
|
})
|
|
336
360
|
]
|
|
337
361
|
}),
|
|
338
|
-
|
|
362
|
+
h
|
|
339
363
|
]
|
|
340
364
|
});
|
|
341
365
|
}
|
|
342
366
|
//#endregion
|
|
343
|
-
export {
|
|
367
|
+
export { O as ContentCard, k as OwnerChip, j as PostCard, E as lockLabel };
|
|
344
368
|
|
|
345
369
|
//# sourceMappingURL=card.js.map
|