@openrails/contentkit-ui 0.103.2 → 0.104.0-rc.2

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.
Files changed (253) hide show
  1. package/README.md +111 -49
  2. package/dist/client/beacons.d.ts +3 -13
  3. package/dist/client/beacons.js +8 -46
  4. package/dist/client/beacons.js.map +1 -1
  5. package/dist/client/client.d.ts +3 -0
  6. package/dist/client/client.js +45 -43
  7. package/dist/client/client.js.map +1 -1
  8. package/dist/client/content/favorites.d.ts +2 -0
  9. package/dist/client/content/favorites.js.map +1 -1
  10. package/dist/client/content/types.d.ts +3 -0
  11. package/dist/client/content/types.js.map +1 -1
  12. package/dist/client/contents.d.ts +7 -1
  13. package/dist/client/contents.js +8 -0
  14. package/dist/client/contents.js.map +1 -1
  15. package/dist/client/discovery.d.ts +34 -5
  16. package/dist/client/discovery.js +23 -2
  17. package/dist/client/discovery.js.map +1 -1
  18. package/dist/client/engagement.d.ts +70 -0
  19. package/dist/client/engagement.js +191 -0
  20. package/dist/client/engagement.js.map +1 -0
  21. package/dist/client/generated/routes.d.ts +74 -35
  22. package/dist/client/generated/routes.js +119 -60
  23. package/dist/client/generated/routes.js.map +1 -1
  24. package/dist/client/generated/wire.d.ts +88 -85
  25. package/dist/client/generated/wire.js.map +1 -1
  26. package/dist/client/guest-reading-history.d.ts +40 -0
  27. package/dist/client/guest-reading-history.js +144 -0
  28. package/dist/client/guest-reading-history.js.map +1 -0
  29. package/dist/client/index.d.ts +5 -3
  30. package/dist/client/media/windows.d.ts +2 -0
  31. package/dist/client/media/windows.js +4 -1
  32. package/dist/client/media/windows.js.map +1 -1
  33. package/dist/client/stats.d.ts +4 -20
  34. package/dist/client/stats.js +0 -11
  35. package/dist/client/stats.js.map +1 -1
  36. package/dist/client/versions.d.ts +8 -6
  37. package/dist/client/versions.js +15 -10
  38. package/dist/client/versions.js.map +1 -1
  39. package/dist/client.js +24 -22
  40. package/dist/components/admin/bulk-drafts.d.ts +17 -0
  41. package/dist/components/admin/bulk-drafts.js +41 -0
  42. package/dist/components/admin/bulk-drafts.js.map +1 -0
  43. package/dist/components/admin/content-admin.d.ts +1 -1
  44. package/dist/components/admin/content-admin.js.map +1 -1
  45. package/dist/components/admin/content-manager.d.ts +11 -3
  46. package/dist/components/admin/content-manager.js +751 -394
  47. package/dist/components/admin/content-manager.js.map +1 -1
  48. package/dist/components/admin/group-manager.d.ts +8 -3
  49. package/dist/components/admin/group-manager.js +218 -146
  50. package/dist/components/admin/group-manager.js.map +1 -1
  51. package/dist/components/admin/page-notices.d.ts +16 -0
  52. package/dist/components/admin/page-notices.js +113 -0
  53. package/dist/components/admin/page-notices.js.map +1 -0
  54. package/dist/components/admin/page-picker.d.ts +38 -0
  55. package/dist/components/admin/page-picker.js +159 -0
  56. package/dist/components/admin/page-picker.js.map +1 -0
  57. package/dist/components/admin/quick-search.d.ts +14 -0
  58. package/dist/components/admin/quick-search.js +60 -0
  59. package/dist/components/admin/quick-search.js.map +1 -0
  60. package/dist/components/admin/reader-content-editor.js +382 -321
  61. package/dist/components/admin/reader-content-editor.js.map +1 -1
  62. package/dist/components/admin/reader-manifest.js +181 -179
  63. package/dist/components/admin/reader-manifest.js.map +1 -1
  64. package/dist/components/admin/shell.d.ts +10 -2
  65. package/dist/components/admin/shell.js +114 -42
  66. package/dist/components/admin/shell.js.map +1 -1
  67. package/dist/components/admin/stats-dashboard.d.ts +4 -9
  68. package/dist/components/admin/stats-dashboard.js +303 -207
  69. package/dist/components/admin/stats-dashboard.js.map +1 -1
  70. package/dist/components/admin/upload-queue.d.ts +14 -0
  71. package/dist/components/admin/upload-queue.js +115 -98
  72. package/dist/components/admin/upload-queue.js.map +1 -1
  73. package/dist/components/content/card.d.ts +31 -3
  74. package/dist/components/content/card.js +324 -158
  75. package/dist/components/content/card.js.map +1 -1
  76. package/dist/components/content/daily-releases.js +144 -190
  77. package/dist/components/content/daily-releases.js.map +1 -1
  78. package/dist/components/content/editor-save.js +27 -25
  79. package/dist/components/content/editor-save.js.map +1 -1
  80. package/dist/components/content/editors.js +274 -253
  81. package/dist/components/content/editors.js.map +1 -1
  82. package/dist/components/content/favorites.d.ts +6 -0
  83. package/dist/components/content/favorites.js +47 -0
  84. package/dist/components/content/favorites.js.map +1 -0
  85. package/dist/components/content/filter-dialog.js +19 -15
  86. package/dist/components/content/filter-dialog.js.map +1 -1
  87. package/dist/components/content/filters.d.ts +2 -0
  88. package/dist/components/content/filters.js +5 -1
  89. package/dist/components/content/filters.js.map +1 -1
  90. package/dist/components/content/grid.d.ts +44 -16
  91. package/dist/components/content/grid.js +308 -270
  92. package/dist/components/content/grid.js.map +1 -1
  93. package/dist/components/content/history.d.ts +6 -0
  94. package/dist/components/content/history.js +111 -0
  95. package/dist/components/content/history.js.map +1 -0
  96. package/dist/components/content/index.d.ts +6 -3
  97. package/dist/components/content/listing.d.ts +14 -3
  98. package/dist/components/content/listing.js +65 -56
  99. package/dist/components/content/listing.js.map +1 -1
  100. package/dist/components/content/offer-fields.js +6 -6
  101. package/dist/components/content/paged-grid.d.ts +10 -0
  102. package/dist/components/content/paged-grid.js +116 -0
  103. package/dist/components/content/paged-grid.js.map +1 -0
  104. package/dist/components/content/pagination.d.ts +19 -0
  105. package/dist/components/content/pagination.js +97 -0
  106. package/dist/components/content/pagination.js.map +1 -0
  107. package/dist/components/content/paywall.d.ts +9 -0
  108. package/dist/components/content/paywall.js +27 -3
  109. package/dist/components/content/paywall.js.map +1 -1
  110. package/dist/components/content/post-list.d.ts +37 -0
  111. package/dist/components/content/post-list.js +203 -0
  112. package/dist/components/content/post-list.js.map +1 -0
  113. package/dist/components/content/reader-settings.d.ts +2 -0
  114. package/dist/components/content/reader-settings.js +1 -1
  115. package/dist/components/content/reader-settings.js.map +1 -1
  116. package/dist/components/content/search.d.ts +11 -4
  117. package/dist/components/content/search.js +22 -11
  118. package/dist/components/content/search.js.map +1 -1
  119. package/dist/components/content/summary-tile.d.ts +14 -0
  120. package/dist/components/content/summary-tile.js +63 -0
  121. package/dist/components/content/summary-tile.js.map +1 -0
  122. package/dist/components/groups/banner.d.ts +6 -2
  123. package/dist/components/groups/banner.js +79 -61
  124. package/dist/components/groups/banner.js.map +1 -1
  125. package/dist/components/groups/directory.d.ts +12 -2
  126. package/dist/components/groups/directory.js +168 -105
  127. package/dist/components/groups/directory.js.map +1 -1
  128. package/dist/components/groups/editor.js +10 -10
  129. package/dist/components/groups/editor.js.map +1 -1
  130. package/dist/components/groups/entity-chips.d.ts +61 -0
  131. package/dist/components/groups/entity-chips.js +382 -0
  132. package/dist/components/groups/entity-chips.js.map +1 -0
  133. package/dist/components/groups/group-members.d.ts +29 -0
  134. package/dist/components/groups/group-members.js +474 -0
  135. package/dist/components/groups/group-members.js.map +1 -0
  136. package/dist/components/groups/header.js +53 -45
  137. package/dist/components/groups/header.js.map +1 -1
  138. package/dist/components/groups/index.d.ts +3 -1
  139. package/dist/components/groups/memberships.d.ts +3 -36
  140. package/dist/components/groups/memberships.js +105 -480
  141. package/dist/components/groups/memberships.js.map +1 -1
  142. package/dist/components/groups/scoped.d.ts +23 -0
  143. package/dist/components/groups/scoped.js +92 -0
  144. package/dist/components/groups/scoped.js.map +1 -0
  145. package/dist/components/media-folder-editor.d.ts +5 -0
  146. package/dist/components/media-folder-editor.js +419 -231
  147. package/dist/components/media-folder-editor.js.map +1 -1
  148. package/dist/components/sortable-list.d.ts +5 -1
  149. package/dist/components/sortable-list.js +97 -81
  150. package/dist/components/sortable-list.js.map +1 -1
  151. package/dist/components/video-mini-player.d.ts +4 -1
  152. package/dist/components/video-mini-player.js +77 -71
  153. package/dist/components/video-mini-player.js.map +1 -1
  154. package/dist/components/video-player.d.ts +4 -1
  155. package/dist/components/video-player.js +280 -276
  156. package/dist/components/video-player.js.map +1 -1
  157. package/dist/index.d.ts +2 -1
  158. package/dist/index.js +41 -34
  159. package/dist/locales/admin/de.js +80 -47
  160. package/dist/locales/admin/de.js.map +1 -1
  161. package/dist/locales/admin/en.d.ts +74 -41
  162. package/dist/locales/admin/en.js +80 -47
  163. package/dist/locales/admin/en.js.map +1 -1
  164. package/dist/locales/admin/es.js +80 -47
  165. package/dist/locales/admin/es.js.map +1 -1
  166. package/dist/locales/admin/ja.js +80 -47
  167. package/dist/locales/admin/ja.js.map +1 -1
  168. package/dist/locales/admin/ko.js +80 -47
  169. package/dist/locales/admin/ko.js.map +1 -1
  170. package/dist/locales/admin/zh.js +80 -47
  171. package/dist/locales/admin/zh.js.map +1 -1
  172. package/dist/locales/de.js +1 -0
  173. package/dist/locales/de.js.map +1 -1
  174. package/dist/locales/discovery/de.js +25 -2
  175. package/dist/locales/discovery/de.js.map +1 -1
  176. package/dist/locales/discovery/en.d.ts +24 -1
  177. package/dist/locales/discovery/en.js +25 -2
  178. package/dist/locales/discovery/en.js.map +1 -1
  179. package/dist/locales/discovery/es.js +25 -2
  180. package/dist/locales/discovery/es.js.map +1 -1
  181. package/dist/locales/discovery/ja.js +25 -2
  182. package/dist/locales/discovery/ja.js.map +1 -1
  183. package/dist/locales/discovery/ko.js +25 -2
  184. package/dist/locales/discovery/ko.js.map +1 -1
  185. package/dist/locales/discovery/zh.js +25 -2
  186. package/dist/locales/discovery/zh.js.map +1 -1
  187. package/dist/locales/en.d.ts +119 -44
  188. package/dist/locales/en.js +1 -0
  189. package/dist/locales/en.js.map +1 -1
  190. package/dist/locales/es.js +1 -0
  191. package/dist/locales/es.js.map +1 -1
  192. package/dist/locales/groups/de.js +22 -4
  193. package/dist/locales/groups/de.js.map +1 -1
  194. package/dist/locales/groups/en.d.ts +20 -2
  195. package/dist/locales/groups/en.js +22 -4
  196. package/dist/locales/groups/en.js.map +1 -1
  197. package/dist/locales/groups/es.js +22 -4
  198. package/dist/locales/groups/es.js.map +1 -1
  199. package/dist/locales/groups/ja.js +22 -4
  200. package/dist/locales/groups/ja.js.map +1 -1
  201. package/dist/locales/groups/ko.js +22 -4
  202. package/dist/locales/groups/ko.js.map +1 -1
  203. package/dist/locales/groups/zh.js +22 -4
  204. package/dist/locales/groups/zh.js.map +1 -1
  205. package/dist/locales/ja.js +1 -0
  206. package/dist/locales/ja.js.map +1 -1
  207. package/dist/locales/ko.js +1 -0
  208. package/dist/locales/ko.js.map +1 -1
  209. package/dist/locales/zh.js +1 -0
  210. package/dist/locales/zh.js.map +1 -1
  211. package/dist/react/discovery.d.ts +36 -17
  212. package/dist/react/discovery.js +305 -221
  213. package/dist/react/discovery.js.map +1 -1
  214. package/dist/react/groups.d.ts +19 -3
  215. package/dist/react/groups.js +49 -22
  216. package/dist/react/groups.js.map +1 -1
  217. package/dist/react/index.d.ts +7 -4
  218. package/dist/react/page-notices.d.ts +13 -0
  219. package/dist/react/page-notices.js +38 -0
  220. package/dist/react/page-notices.js.map +1 -0
  221. package/dist/react/post-reads.d.ts +23 -0
  222. package/dist/react/post-reads.js +90 -0
  223. package/dist/react/post-reads.js.map +1 -0
  224. package/dist/react/remembered-sort.d.ts +5 -0
  225. package/dist/react/remembered-sort.js +29 -0
  226. package/dist/react/remembered-sort.js.map +1 -0
  227. package/dist/react/resources.d.ts +3 -1
  228. package/dist/react/resources.js +6 -2
  229. package/dist/react/resources.js.map +1 -1
  230. package/dist/react/stats.d.ts +3 -7
  231. package/dist/react/stats.js +2 -6
  232. package/dist/react/stats.js.map +1 -1
  233. package/dist/react/use-engagement.d.ts +28 -0
  234. package/dist/react/use-engagement.js +226 -0
  235. package/dist/react/use-engagement.js.map +1 -0
  236. package/dist/react/use-resource.d.ts +4 -3
  237. package/dist/react/use-resource.js +2 -1
  238. package/dist/react/use-resource.js.map +1 -1
  239. package/dist/react.js +29 -26
  240. package/dist/styles.css +1 -1
  241. package/dist/ui/dialog.d.ts +2 -1
  242. package/dist/ui/dialog.js +23 -20
  243. package/dist/ui/dialog.js.map +1 -1
  244. package/dist/urls/index.d.ts +1 -1
  245. package/dist/urls.js +2 -2
  246. package/dist/urls.js.map +1 -1
  247. package/package.json +1 -1
  248. package/dist/components/admin/page-review.d.ts +0 -13
  249. package/dist/components/admin/page-review.js +0 -225
  250. package/dist/components/admin/page-review.js.map +0 -1
  251. package/dist/react/page-review.d.ts +0 -14
  252. package/dist/react/page-review.js +0 -37
  253. package/dist/react/page-review.js.map +0 -1
@@ -1,20 +1,26 @@
1
1
  import { useMessages as e } from "../../i18n/context.js";
2
2
  import { ContentKitUiRoot as t } from "../../scope.js";
3
3
  import { ContentKitContext as n } from "../../react/context.js";
4
- import { useKinds as r } from "../../react/groups.js";
5
- import { Button as i } from "../../ui/button.js";
6
- import { useNearViewport as a } from "../../react/viewport.js";
7
- import { Skeleton as o } from "../../ui/skeleton.js";
8
- import { contentError as s, useAction as c } from "../social/parts.js";
9
- import { useContents as l, useExposure as u, useHistory as d, useLockedCount as f, useRecommendations as p, useSearch as m, useSimilar as h } from "../../react/discovery.js";
10
- import { ContentCard as g } from "./card.js";
11
- import { useContext as _, useEffect as v, useMemo as y, useState as b } from "react";
12
- import { Fragment as x, jsx as S, jsxs as C } from "react/jsx-runtime";
13
- import { cn as w } from "cn";
4
+ import { useContentScope as r } from "../../react/use-resource.js";
5
+ import { useKinds as i } from "../../react/groups.js";
6
+ import { Button as a } from "../../ui/button.js";
7
+ import { useNearViewport as o } from "../../react/viewport.js";
8
+ import { Skeleton as s } from "../../ui/skeleton.js";
9
+ import { contentError as c } from "../social/parts.js";
10
+ import { useContents as l, useExposure as u, useHistory as d, useRecommendations as f, useSearch as p, useSimilar as m } from "../../react/discovery.js";
11
+ import { ContentFilterDialog as h } from "./filter-dialog.js";
12
+ import { useReleaseReveal as g } from "./release-reveal.js";
13
+ import { ContentSummaryTile as _ } from "./summary-tile.js";
14
+ import { ContentCard as v } from "./card.js";
15
+ import { PagedContentGrid as y, PagedSearchResults as b } from "./paged-grid.js";
16
+ import { ContentHistory as x } from "./history.js";
17
+ import { useCallback as S, useContext as C, useEffect as w, useLayoutEffect as ee, useMemo as T, useRef as te, useState as E } from "react";
18
+ import { jsx as D, jsxs as O } from "react/jsx-runtime";
19
+ import { cn as k } from "cn";
14
20
  //#region src/components/content/grid.tsx
15
- var T = "grid grid-cols-[repeat(auto-fill,minmax(min(100%,10rem),1fr))] gap-x-4 gap-y-6";
16
- function E(e) {
17
- if (!e) return { className: T };
21
+ var A = "grid grid-cols-[repeat(auto-fill,minmax(min(100%,10rem),1fr))] gap-x-4 gap-y-6";
22
+ function j(e) {
23
+ if (!e) return { className: A };
18
24
  let t = typeof e.minCardWidth == "string" ? e.minCardWidth.trim() || "160px" : `${Number.isFinite(e.minCardWidth) ? Math.max(1, e.minCardWidth) : 160}px`, n = e.mobileColumns !== void 0 && Number.isFinite(e.mobileColumns) ? Math.max(1, Math.floor(e.mobileColumns)) : 2, r = e.maxColumns !== void 0 && Number.isFinite(e.maxColumns) ? Math.max(1, Math.floor(e.maxColumns)) : void 0;
19
25
  return {
20
26
  className: "grid grid-cols-[repeat(var(--ckui-card-mobile-columns),minmax(0,1fr))] gap-x-4 gap-y-6 md:grid-cols-[repeat(auto-fill,minmax(min(100%,var(--ckui-card-min-width)),1fr))]",
@@ -24,311 +30,343 @@ function E(e) {
24
30
  }
25
31
  };
26
32
  }
27
- function D({ list: n, render: c, ...l }) {
28
- let d = e(), { t: f } = d, { kinds: p } = r({ client: l.client }), m = u(n.items, {
29
- surface: l.surface ?? "list",
30
- render: c,
31
- client: l.client
32
- }), [h, _] = a({
33
+ function M(e) {
34
+ let { client: t, viewer: i, language: a } = r(e.client), o = C(n), [s, c] = E({
35
+ client: t,
36
+ viewer: i,
37
+ language: a,
38
+ access: o?.accessRevision,
39
+ render: e.render,
40
+ key: 0
41
+ }), l = s;
42
+ return (s.client !== t || s.viewer !== i || s.language !== a || s.access !== o?.accessRevision || s.render !== e.render) && (l = {
43
+ client: t,
44
+ viewer: i,
45
+ language: a,
46
+ access: o?.accessRevision,
47
+ render: e.render,
48
+ key: s.key + 1
49
+ }, c(l)), /* @__PURE__ */ D(N, { ...e }, l.key);
50
+ }
51
+ function N({ list: n, render: r, filterKinds: l, filterLanguage: d, horizontal: f, ...p }) {
52
+ let m = e(), { t: y } = m, { kinds: b } = i({ client: p.client }), [x, C] = E(!1), [A, M] = E(!1), N = te(null), [P, F] = E(null), [I, L] = E(0), [R, z] = E(() => globalThis.matchMedia?.("(max-width: 767px)").matches ?? !1);
53
+ ee(() => {
54
+ if (!P) return;
55
+ let e = () => {
56
+ let e = getComputedStyle(P).gridTemplateColumns.trim();
57
+ L(e && e !== "none" ? e.split(/\s+/).length : 0), z(globalThis.matchMedia?.("(max-width: 767px)").matches ?? !1);
58
+ };
59
+ e();
60
+ let t = typeof ResizeObserver == "function" ? new ResizeObserver(e) : void 0;
61
+ return t?.observe(P), addEventListener("resize", e), () => {
62
+ t?.disconnect(), removeEventListener("resize", e);
63
+ };
64
+ }, [P]);
65
+ let B = n.summary?.locked_count ?? 0, V = p.showFilteredSummary === !1 ? 0 : n.summary?.filtered_count ?? 0, H = p.locked === "collapse" && !x && B > 0, U = H && B > 0 && I >= Math.max(0, p.lockedSummaryMinColumns ?? 0), W = T(() => {
66
+ let e = [], t = !1;
67
+ for (let [r, i] of n.items.entries()) {
68
+ if (ne(i) && (H || p.locked === "hide")) {
69
+ U && !t && (e.push({
70
+ key: "premium-summary",
71
+ premium: !0,
72
+ card: i
73
+ }), t = !0);
74
+ continue;
75
+ }
76
+ e.push({
77
+ key: i.id,
78
+ card: i,
79
+ position: r + 1
80
+ });
81
+ }
82
+ U && !t && e.push({
83
+ key: "premium-summary",
84
+ premium: !0
85
+ });
86
+ let r = R && p.mobileCardLimit !== void 0 ? p.mobileCardLimit : p.cardLimit;
87
+ return r !== void 0 && Number.isFinite(r) ? e.slice(0, Math.max(0, Math.floor(r))) : e;
88
+ }, [
89
+ n.items,
90
+ H,
91
+ p.locked,
92
+ U,
93
+ R,
94
+ p.mobileCardLimit,
95
+ p.cardLimit
96
+ ]), re = T(() => W.flatMap((e) => "premium" in e ? [] : [{
97
+ ...e.card,
98
+ position: e.position
99
+ }]), [W]), G = u(re, {
100
+ surface: p.surface ?? "list",
101
+ render: r,
102
+ client: p.client
103
+ }), [ie, K] = o({
33
104
  margin: "600px 0px",
34
105
  leaveMargin: "1200px 0px"
35
- }), { hasMore: y, loadingMore: b, loadMore: x, error: T } = n;
36
- v(() => {
37
- l.infinite && _ && y && !b && !T && x();
106
+ }), { hasMore: q, loadingMore: J, loadMore: Y, error: X } = n;
107
+ w(() => {
108
+ p.infinite && K && q && !J && !X && Y();
38
109
  }, [
39
- l.infinite,
40
- _,
41
- y,
42
- b,
43
- x,
44
- T
110
+ p.infinite,
111
+ K,
112
+ q,
113
+ J,
114
+ Y,
115
+ X
45
116
  ]);
46
- let D = l.tiers ?? p?.tiers, O = E(l.grid);
47
- return /* @__PURE__ */ C(t, {
48
- appearance: l.appearance,
49
- className: w("grid gap-4 text-sm", l.className),
117
+ let { grid: Z, prepare: ae } = g(W.map((e) => e.key).join("\0")), oe = S((e) => {
118
+ Z.current = e, F(e);
119
+ }, [Z]), Q = f ? { className: "relative flex snap-x gap-4 overflow-x-auto pb-2 [&>li]:w-36 [&>li]:shrink-0 [&>li]:snap-start sm:[&>li]:w-44" } : j(p.grid), $ = n.summary?.truncated ? "≥ " : "", se = $ + (p.summaryLabels?.premium?.(B) ?? m.plural("contents.lockedShow", B)), ce = $ + (p.summaryLabels?.filtered?.(V) ?? m.plural("releases.filteredMore", V)), le = W.length > 0 || V > 0 || H && B > 0;
120
+ return /* @__PURE__ */ O(t, {
121
+ appearance: p.appearance,
122
+ className: k("grid gap-4 text-sm", p.className),
50
123
  "data-ckui": "content-grid",
51
124
  "aria-busy": n.loading,
52
- children: [n.loading && !n.items.length ? /* @__PURE__ */ S("div", {
53
- className: O.className,
54
- style: O.style,
55
- children: Array.from({ length: 8 }, (e, t) => /* @__PURE__ */ S(o, {
56
- className: l.aspectRatio === void 0 ? l.shape === "landscape" ? "aspect-video w-full" : "aspect-[3/4] w-full" : "w-full",
57
- style: l.aspectRatio === void 0 ? void 0 : { aspectRatio: l.aspectRatio }
58
- }, t))
59
- }) : n.error && !n.items.length ? /* @__PURE__ */ C("div", {
60
- role: "alert",
61
- className: "grid justify-items-start gap-2",
62
- children: [/* @__PURE__ */ S("p", {
63
- className: "text-destructive",
64
- children: s(d, n.error)
65
- }), /* @__PURE__ */ S(i, {
66
- size: "sm",
67
- variant: "outline",
68
- onClick: n.reload,
69
- children: f("common.retry")
70
- })]
71
- }) : n.items.length ? /* @__PURE__ */ S("ol", {
72
- className: O.className,
73
- style: O.style,
74
- children: n.items.map((e, t) => /* @__PURE__ */ S("li", {
75
- ref: m.track(e.id, t + 1),
76
- children: l.renderCard ? l.renderCard(e, t + 1) : /* @__PURE__ */ S(g, {
77
- card: e,
78
- client: l.client,
79
- href: l.href,
80
- shape: l.shape,
81
- aspectRatio: l.aspectRatio,
82
- titlePosition: l.titlePosition,
83
- loadMedia: l.loadMedia,
84
- groupKinds: l.groupKinds,
85
- chips: l.chips,
86
- filterEntity: l.filterEntity,
87
- entityStyle: l.entityStyle,
88
- entityLayout: l.entityLayout,
89
- metadata: l.metadata,
90
- showCounts: l.showCounts,
91
- tiers: D,
92
- labels: l.labels,
93
- owner: l.owner,
94
- ownerHref: l.ownerHref,
95
- decorate: l.decorate,
96
- onOpen: () => m.click(e.id, t + 1)
97
- })
98
- }, e.id))
99
- }) : /* @__PURE__ */ S("div", {
100
- className: "text-muted-foreground",
101
- role: "status",
102
- children: l.empty ?? f("contents.empty")
103
- }), n.hasMore && /* @__PURE__ */ C("div", {
104
- ref: h,
105
- className: "grid justify-items-center gap-2",
106
- children: [n.error && n.items.length > 0 && /* @__PURE__ */ S("p", {
125
+ children: [
126
+ n.loading && !n.items.length ? /* @__PURE__ */ D("ol", {
127
+ "aria-hidden": !0,
128
+ className: Q.className,
129
+ style: Q.style,
130
+ children: Array.from({ length: 8 }, (e, t) => /* @__PURE__ */ D("li", { children: /* @__PURE__ */ D(s, {
131
+ className: p.aspectRatio === void 0 ? p.shape === "landscape" ? "aspect-video w-full" : "aspect-[3/4] w-full" : "w-full",
132
+ style: p.aspectRatio === void 0 ? void 0 : { aspectRatio: p.aspectRatio }
133
+ }) }, t))
134
+ }) : n.error && !n.items.length ? /* @__PURE__ */ O("div", {
107
135
  role: "alert",
108
- className: "text-destructive",
109
- children: s(d, n.error)
110
- }), /* @__PURE__ */ S(i, {
111
- variant: "outline",
112
- size: "sm",
113
- disabled: n.loadingMore,
114
- onClick: () => void n.loadMore(),
115
- children: n.loadingMore ? f("contents.loading") : n.error ? f("common.retry") : f("contents.loadMore")
116
- })]
117
- })]
136
+ className: "grid justify-items-start gap-2",
137
+ children: [/* @__PURE__ */ D("p", {
138
+ className: "text-destructive",
139
+ children: c(m, n.error)
140
+ }), /* @__PURE__ */ D(a, {
141
+ size: "sm",
142
+ variant: "outline",
143
+ onClick: n.reload,
144
+ children: y("common.retry")
145
+ })]
146
+ }) : le ? /* @__PURE__ */ O("ol", {
147
+ ref: oe,
148
+ tabIndex: -1,
149
+ className: Q.className,
150
+ style: Q.style,
151
+ children: [W.map((e) => "premium" in e ? /* @__PURE__ */ D(_, {
152
+ tileKey: e.key,
153
+ kind: "premium",
154
+ contentKind: l?.[0] ?? e.card?.kind,
155
+ preview: e.card,
156
+ open: !0,
157
+ cardProps: p,
158
+ label: se,
159
+ onClick: (e) => {
160
+ ae(e.detail === 0), C(!0);
161
+ }
162
+ }, e.key) : /* @__PURE__ */ D("li", {
163
+ "data-release-key": e.key,
164
+ ref: G.track(e.card.id, e.position),
165
+ children: p.renderCard ? p.renderCard(e.card, e.position) : /* @__PURE__ */ D(v, {
166
+ card: e.card,
167
+ client: p.client,
168
+ href: p.href,
169
+ shape: p.shape,
170
+ aspectRatio: p.aspectRatio,
171
+ titlePosition: p.titlePosition,
172
+ loadMedia: p.loadMedia,
173
+ groupKinds: p.groupKinds,
174
+ chips: p.chips,
175
+ chipOverflow: p.chipOverflow,
176
+ chipFit: p.chipFit,
177
+ filterEntity: p.filterEntity,
178
+ entityStyle: p.entityStyle,
179
+ entityLayout: p.entityLayout,
180
+ metadata: p.metadata,
181
+ showCounts: p.showCounts,
182
+ tiers: p.tiers ?? b?.tiers,
183
+ labels: p.labels,
184
+ owner: p.owner,
185
+ ownerHref: p.ownerHref,
186
+ decorate: p.decorate,
187
+ onOpen: () => G.click(e.card.id, e.position)
188
+ })
189
+ }, e.key)), V > 0 && /* @__PURE__ */ D(_, {
190
+ tileKey: "filtered-summary",
191
+ kind: "filtered",
192
+ contentKind: l?.[0] ?? n.items[0]?.kind,
193
+ open: !0,
194
+ cardProps: p,
195
+ label: ce,
196
+ onClick: (e) => {
197
+ N.current = e.currentTarget, M(!0);
198
+ }
199
+ })]
200
+ }) : /* @__PURE__ */ D("div", {
201
+ className: "text-muted-foreground",
202
+ role: "status",
203
+ children: p.empty ?? y("contents.empty")
204
+ }),
205
+ n.hasMore && /* @__PURE__ */ O("div", {
206
+ ref: ie,
207
+ className: "grid justify-items-center gap-2",
208
+ children: [n.error && n.items.length > 0 && /* @__PURE__ */ D("p", {
209
+ role: "alert",
210
+ className: "text-destructive",
211
+ children: c(m, n.error)
212
+ }), /* @__PURE__ */ D(a, {
213
+ variant: "outline",
214
+ size: "sm",
215
+ disabled: n.loadingMore,
216
+ onClick: () => void n.loadMore(),
217
+ children: n.loadingMore ? y("contents.loading") : n.error ? y("common.retry") : y("contents.loadMore")
218
+ })]
219
+ }),
220
+ /* @__PURE__ */ D(h, {
221
+ open: A,
222
+ onOpenChange: M,
223
+ returnFocus: () => N.current?.isConnected ? N.current : P,
224
+ client: p.client,
225
+ kinds: l,
226
+ language: d,
227
+ counts: n.summary?.filtered_entities,
228
+ countsLowerBound: n.summary?.truncated,
229
+ appearance: p.appearance
230
+ })
231
+ ]
118
232
  });
119
233
  }
120
- var O = [
234
+ function P(e, t) {
235
+ return e === "hide" ? "hide" : e === "collapse" ? "lock" : t;
236
+ }
237
+ var F = [
121
238
  "tier",
122
239
  "group",
123
240
  "ppv",
124
241
  "group_ppv"
125
- ];
126
- function k({ query: e, locked: t = "show", ...n }) {
127
- let r = y(() => ({
242
+ ], ne = (e) => !e.access.allowed && !e.access.unknown && F.includes(e.access.level);
243
+ function I(e) {
244
+ return e.pagination === "pages" ? /* @__PURE__ */ D(y, { ...e }) : /* @__PURE__ */ D(L, { ...e });
245
+ }
246
+ function L({ query: e, locked: t = "show", ...n }) {
247
+ let r = T(() => ({
128
248
  ...e,
249
+ summary: e.summary ?? !0,
129
250
  limit: e.limit ?? n.pageSize,
130
- ...t === "show" ? {} : { mode: "hide" }
251
+ mode: P(t, e.mode)
131
252
  }), [
132
253
  e,
133
254
  n.pageSize,
134
255
  t
135
256
  ]), i = l(r, { client: n.client });
136
- return /* @__PURE__ */ C(x, { children: [t === "collapse" && /* @__PURE__ */ S(A, {
137
- ...n,
138
- query: e
139
- }), /* @__PURE__ */ S(D, {
257
+ return /* @__PURE__ */ D(M, {
140
258
  ...n,
259
+ locked: t,
141
260
  list: i,
142
- render: JSON.stringify(r)
143
- })] });
261
+ render: JSON.stringify(r),
262
+ filterKinds: e.kind ? [e.kind] : void 0,
263
+ filterLanguage: e.display_language ?? e.language
264
+ });
144
265
  }
145
- function A({ query: n, ...r }) {
146
- let a = e(), [o, s] = b(!1), { count: c } = f(n, { client: r.client }), u = y(() => o ? {
147
- ...n,
148
- mode: "lock",
149
- access: n.access ?? O,
150
- limit: n.limit ?? r.pageSize
151
- } : null, [
152
- o,
153
- n,
154
- r.pageSize
155
- ]), d = l(u, { client: r.client }), p = y(() => d.items.filter((e) => !e.access.allowed), [d.items]);
156
- return c ? /* @__PURE__ */ C(t, {
157
- appearance: r.appearance,
158
- className: "grid gap-3 text-sm",
159
- "data-ckui": "locked-cards",
160
- children: [/* @__PURE__ */ S(i, {
161
- variant: "outline",
162
- size: "sm",
163
- className: "justify-self-start",
164
- "aria-expanded": o,
165
- onClick: () => s(!o),
166
- children: o ? a.t("contents.lockedHide") : a.plural("contents.lockedShow", c)
167
- }), o && /* @__PURE__ */ S(D, {
168
- ...r,
169
- list: {
170
- ...d,
171
- items: p
172
- },
173
- render: JSON.stringify(u)
174
- })]
175
- }) : null;
266
+ function R(e) {
267
+ return e.pagination === "pages" ? /* @__PURE__ */ D(b, { ...e }) : /* @__PURE__ */ D(z, { ...e });
176
268
  }
177
- function j({ query: t, ...n }) {
178
- let { t: r } = e(), i = y(() => ({
269
+ function z({ query: t, ...n }) {
270
+ let { t: r } = e(), i = T(() => ({
179
271
  ...t,
272
+ mode: P(n.locked, t.mode),
273
+ summary: t.summary ?? !0,
180
274
  limit: t.limit ?? n.pageSize
181
- }), [t, n.pageSize]), a = m(i, { client: n.client });
182
- return t.q.trim() ? /* @__PURE__ */ S(D, {
275
+ }), [
276
+ t,
277
+ n.pageSize,
278
+ n.locked
279
+ ]), a = p(i, { client: n.client });
280
+ return t.q.trim() ? /* @__PURE__ */ D(M, {
183
281
  surface: "search",
184
282
  empty: r("contents.noResults", { q: t.q.trim() }),
185
283
  ...n,
186
284
  list: a,
187
- render: JSON.stringify(i)
285
+ render: JSON.stringify(i),
286
+ filterKinds: t.kind ? [t.kind] : void 0,
287
+ filterLanguage: t.display_language ?? t.language
188
288
  }) : null;
189
289
  }
190
- function M({ query: t = {}, ...r }) {
191
- let { t: a } = e(), o = _(n), s = y(() => ({
192
- ...t,
193
- limit: t.limit ?? r.pageSize
194
- }), [t, r.pageSize]), l = d(s, { client: r.client }), u = c("history.forget");
195
- return o?.viewer === null ? /* @__PURE__ */ S("p", {
196
- className: "text-muted-foreground",
197
- children: a("contents.historySignedOut")
198
- }) : /* @__PURE__ */ C("div", {
199
- className: "grid gap-3",
200
- "data-ckui": "content-history",
201
- children: [l.items.length > 0 && /* @__PURE__ */ S(i, {
202
- size: "sm",
203
- variant: "outline",
204
- className: "justify-self-end",
205
- disabled: u.pending,
206
- onClick: () => void u.run(() => l.forget(t.kind ? { kind: t.kind } : {})),
207
- children: a("contents.clearHistory")
208
- }), /* @__PURE__ */ S(D, {
209
- surface: "history",
210
- empty: a("contents.historyEmpty"),
211
- ...r,
212
- list: l,
213
- render: JSON.stringify(s),
214
- renderCard: r.renderCard ?? ((e) => /* @__PURE__ */ S(g, {
215
- card: e,
216
- client: r.client,
217
- href: r.href,
218
- shape: r.shape,
219
- aspectRatio: r.aspectRatio,
220
- titlePosition: r.titlePosition,
221
- loadMedia: r.loadMedia,
222
- groupKinds: r.groupKinds,
223
- chips: r.chips,
224
- filterEntity: r.filterEntity,
225
- entityStyle: r.entityStyle,
226
- entityLayout: r.entityLayout,
227
- metadata: r.metadata,
228
- showCounts: r.showCounts,
229
- tiers: r.tiers,
230
- labels: r.labels,
231
- owner: r.owner,
232
- ownerHref: r.ownerHref,
233
- decorate: r.decorate,
234
- children: /* @__PURE__ */ S(i, {
235
- size: "xs",
236
- variant: "ghost",
237
- className: "justify-self-start",
238
- disabled: u.pending,
239
- onClick: () => void u.run(() => l.forget({ content_id: e.id })),
240
- children: a("contents.removeFromHistory")
241
- })
242
- }))
243
- })]
244
- });
245
- }
246
- function N({ title: e, similar: n, recommendations: i, history: a, group: s, list: c, query: f = {}, more: m, ..._ }) {
247
- let v = f.limit ?? _.pageSize ?? 12, b = y(() => ({
248
- ...f,
249
- limit: v
250
- }), [f, v]), x = y(() => c ? {
251
- ...c,
252
- limit: c.limit ?? v
253
- } : s ? {
254
- groups: [s],
290
+ function B({ title: e, similar: n, recommendations: r, history: i, group: a, list: o, query: s = {}, more: c, ...u }) {
291
+ let p = s.limit ?? u.pageSize ?? 12, h = T(() => ({
292
+ ...s,
293
+ mode: P(u.locked, s.mode),
294
+ summary: s.summary ?? !0,
295
+ limit: p
296
+ }), [
297
+ s,
298
+ p,
299
+ u.locked
300
+ ]), g = T(() => o ? {
301
+ ...o,
302
+ mode: P(u.locked, o.mode),
303
+ summary: o.summary ?? !0,
304
+ limit: o.limit ?? p
305
+ } : a ? {
306
+ groups: [a],
255
307
  sort: "position",
256
- limit: v
308
+ mode: P(u.locked),
309
+ summary: !0,
310
+ limit: p
257
311
  } : null, [
258
- c,
259
- s,
260
- v
261
- ]), T = h(i || a || x ? null : n, b, { client: _.client }), D = p(i ? b : null, { client: _.client }), O = d(a ? {
262
- ...a,
263
- limit: a.limit ?? v
264
- } : null, { client: _.client }), k = l(x, { client: _.client }), A = i ? D : a || x ? (() => {
265
- let e = a ? O : k;
312
+ o,
313
+ a,
314
+ p,
315
+ u.locked
316
+ ]), _ = m(r || i || g ? null : n, h, { client: u.client }), v = f(r ? h : null, { client: u.client }), y = d(i ? {
317
+ ...i,
318
+ mode: P(u.locked, i.mode),
319
+ summary: i.summary ?? !0,
320
+ limit: i.limit ?? p
321
+ } : null, { client: u.client }), b = l(g, { client: u.client }), x = r ? v : i || g ? (() => {
322
+ let e = i ? y : b;
266
323
  return {
267
324
  items: e.items,
325
+ summary: e.summary,
268
326
  loading: e.loading,
269
327
  error: e.error,
270
328
  unavailable: e.error?.code === "not_configured",
271
329
  reload: e.reload
272
330
  };
273
- })() : T, { kinds: j } = r({ client: _.client }), M = _.surface ?? (i ? "recommendations" : a ? "history" : s ? "featured" : x ? "list" : "similar"), N = u(A.items, {
274
- surface: M,
275
- render: JSON.stringify([
276
- n,
277
- i,
278
- a,
279
- s,
280
- x,
281
- b
282
- ]),
283
- client: _.client
284
- }), P = n || i || a || s || x, F = _.grid ? E(_.grid) : void 0;
285
- return !P || A.unavailable || !A.loading && !A.items.length ? null : /* @__PURE__ */ C(t, {
286
- appearance: _.appearance,
287
- className: w("grid gap-3 text-sm", _.className),
331
+ })() : _, S = u.surface ?? (r ? "recommendations" : i ? "history" : a ? "featured" : g ? "list" : "similar");
332
+ if (!(n || r || i || a || g) || x.unavailable || !x.loading && !x.items.length && !x.summary?.filtered_count && !x.summary?.locked_count) return null;
333
+ let C = {
334
+ ...x,
335
+ loadingMore: !1,
336
+ hasMore: !1,
337
+ loadMore: async () => {}
338
+ }, w = o?.kind ?? i?.kind ?? h.kind;
339
+ return /* @__PURE__ */ O(t, {
340
+ appearance: u.appearance,
341
+ className: k("grid gap-3 text-sm", u.className),
288
342
  "data-ckui": "content-rail",
289
- "data-surface": M,
290
- children: [/* @__PURE__ */ C("div", {
343
+ "data-surface": S,
344
+ children: [/* @__PURE__ */ O("div", {
291
345
  className: "flex items-baseline justify-between gap-2",
292
- children: [/* @__PURE__ */ S("h2", {
346
+ children: [/* @__PURE__ */ D("h2", {
293
347
  className: "text-base font-semibold",
294
348
  children: e
295
- }), m]
296
- }), /* @__PURE__ */ S("ol", {
297
- className: F?.className ?? "relative flex snap-x gap-4 overflow-x-auto pb-2",
298
- style: F?.style,
299
- children: (A.loading && !A.items.length ? Array.from({ length: 6 }, () => null) : A.items).map((e, t) => /* @__PURE__ */ S("li", {
300
- className: F ? void 0 : "w-36 shrink-0 snap-start sm:w-44",
301
- ref: e ? N.track(e.id, t + 1) : void 0,
302
- children: e ? _.renderCard ? _.renderCard(e, t + 1) : /* @__PURE__ */ S(g, {
303
- card: e,
304
- client: _.client,
305
- href: _.href,
306
- shape: _.shape,
307
- aspectRatio: _.aspectRatio,
308
- titlePosition: _.titlePosition,
309
- loadMedia: _.loadMedia,
310
- groupKinds: _.groupKinds,
311
- chips: _.chips,
312
- filterEntity: _.filterEntity,
313
- entityStyle: _.entityStyle,
314
- entityLayout: _.entityLayout,
315
- metadata: _.metadata,
316
- showCounts: _.showCounts,
317
- tiers: _.tiers ?? j?.tiers,
318
- labels: _.labels,
319
- owner: _.owner,
320
- ownerHref: _.ownerHref,
321
- decorate: _.decorate,
322
- onOpen: () => N.click(e.id, t + 1)
323
- }) : /* @__PURE__ */ S(o, {
324
- className: _.aspectRatio === void 0 ? _.shape === "landscape" ? "aspect-video w-full" : "aspect-[3/4] w-full" : "w-full",
325
- style: _.aspectRatio === void 0 ? void 0 : { aspectRatio: _.aspectRatio }
326
- })
327
- }, e?.id ?? t))
349
+ }), c]
350
+ }), /* @__PURE__ */ D(M, {
351
+ ...u,
352
+ className: void 0,
353
+ surface: S,
354
+ horizontal: !u.grid,
355
+ list: C,
356
+ render: JSON.stringify([
357
+ n,
358
+ r,
359
+ i,
360
+ a,
361
+ g,
362
+ h
363
+ ]),
364
+ filterKinds: w ? [w] : void 0,
365
+ filterLanguage: o?.display_language ?? i?.display_language ?? h.display_language ?? o?.language ?? i?.language ?? h.language
328
366
  })]
329
367
  });
330
368
  }
331
369
  //#endregion
332
- export { D as CardGrid, k as ContentGrid, M as ContentHistory, N as ContentRail, j as SearchResults, E as cardGridLayout };
370
+ export { M as CardGrid, I as ContentGrid, x as ContentHistory, B as ContentRail, R as SearchResults, j as cardGridLayout, P as cardListMode };
333
371
 
334
372
  //# sourceMappingURL=grid.js.map