@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,251 +1,347 @@
1
1
  import { useMessages as e } from "../../i18n/context.js";
2
- import { Select as t, SelectContent as n, SelectItem as r, SelectTrigger as i, SelectValue as a } from "../../ui/select.js";
3
- import { AdminRoot as o, LoadFailed as s, NoAccess as c, Rows as l } from "./shell.js";
4
- import { useFlowClient as u } from "../../react/admin.js";
5
- import { useActivity as d, useTopContents as f } from "../../react/stats.js";
2
+ import { formatDuration as t } from "../../client/gallery.js";
3
+ import { Select as n, SelectContent as r, SelectItem as i, SelectTrigger as a, SelectValue as o } from "../../ui/select.js";
4
+ import { AdminRoot as s, LoadFailed as c, NoAccess as l, Rows as u } from "./shell.js";
5
+ import { useFlowClient as d } from "../../react/admin.js";
6
+ import { useActivity as f } from "../../react/stats.js";
6
7
  import { useState as p } from "react";
7
8
  import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
9
+ import { cn as _ } from "cn";
8
10
  //#region src/components/admin/stats-dashboard.tsx
9
- var _ = (e) => e.map((e) => typeof e == "string" ? {
11
+ var v = (e) => e.map((e) => typeof e == "string" ? {
10
12
  value: e,
11
13
  label: e
12
- } : e), v = [
13
- 7,
14
+ } : e), y = [
15
+ 10,
14
16
  30,
15
17
  90
16
- ], y = ["views", "comments"], b = [
17
- "7d",
18
- "30d",
19
- "90d",
20
- "365d",
21
- "all"
22
- ], x = (e) => e?.code === "forbidden" || e?.code === "unauthorized";
23
- function S({ client: e, baseUrl: t, auth: n, guard: r, appearance: i, className: a, language: s, messages: c, ...l }) {
24
- let d = u({
18
+ ], b = (e) => e?.code === "forbidden" || e?.code === "unauthorized", x = [
19
+ {
20
+ key: "anon",
21
+ fill: "bg-[#2a78d6] dark:bg-[#3987e5]"
22
+ },
23
+ {
24
+ key: "free",
25
+ fill: "bg-[#eb6834] dark:bg-[#d95926]"
26
+ },
27
+ {
28
+ key: "premium",
29
+ fill: "bg-[#1baf7a] dark:bg-[#199e70]"
30
+ }
31
+ ];
32
+ function S({ client: e, baseUrl: t, auth: n, guard: r, appearance: i, className: a, language: o, messages: c, ...l }) {
33
+ let u = d({
25
34
  client: e,
26
35
  baseUrl: t,
27
36
  auth: n
28
37
  });
29
- return /* @__PURE__ */ h(o, {
38
+ return /* @__PURE__ */ h(s, {
30
39
  flow: "stats-dashboard",
31
40
  appearance: i,
32
41
  className: a,
33
- language: s,
42
+ language: o,
34
43
  messages: c,
35
44
  guard: r,
36
45
  children: /* @__PURE__ */ h(C, {
37
46
  ...l,
38
- client: d
47
+ client: u
39
48
  })
40
49
  });
41
50
  }
42
- function C({ kinds: t, contentHref: n, limit: r = 10, client: i }) {
43
- let { t: a } = e(), o = _(t), [u, S] = p(o[0]?.value ?? ""), [C, T] = p(7), [E, D] = p("views"), [O, k] = p("30d"), A = d(u ? {
44
- kind: u,
45
- days: C
46
- } : null, { client: i }), j = f(u ? {
47
- kind: u,
48
- metric: E,
49
- period: O,
50
- limit: r
51
- } : null, { client: i });
52
- if (x(A.error) || x(j.error)) return /* @__PURE__ */ h(c, { children: a("stats.noAccess") });
53
- let M = A.data?.days ?? [], N = Math.max(1, ...M.map((e) => e.views)), P = M.reduce((e, t) => e + t.views, 0);
54
- return /* @__PURE__ */ g(m, { children: [
55
- /* @__PURE__ */ g("div", {
51
+ function C({ kinds: t, client: n }) {
52
+ let { t: r } = e(), i = v(t), [a, o] = p(i[0]?.value ?? ""), [s, d] = p(y[0]), _ = f(a ? {
53
+ kind: a,
54
+ days: s
55
+ } : null, { client: n });
56
+ if (b(_.error)) return /* @__PURE__ */ h(l, { children: r("stats.noAccess") });
57
+ let x = [..._.data?.days ?? []].reverse();
58
+ return /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ g("div", {
59
+ className: "flex flex-wrap items-center justify-between gap-2",
60
+ children: [/* @__PURE__ */ h("h2", {
61
+ className: "text-base font-semibold",
62
+ children: r("stats.title")
63
+ }), i.length > 1 && /* @__PURE__ */ h(D, {
64
+ label: r("stats.kind"),
65
+ value: a,
66
+ onChange: o,
67
+ options: i
68
+ })]
69
+ }), /* @__PURE__ */ g("section", {
70
+ className: "grid gap-3",
71
+ "data-ckui": "stats-activity",
72
+ children: [/* @__PURE__ */ g("div", {
56
73
  className: "flex flex-wrap items-center justify-between gap-2",
57
- children: [/* @__PURE__ */ h("h2", {
58
- className: "text-base font-semibold",
59
- children: a("stats.title")
60
- }), o.length > 1 && /* @__PURE__ */ h(w, {
61
- label: a("stats.kind"),
62
- value: u,
63
- onChange: S,
64
- options: o
65
- })]
66
- }),
67
- /* @__PURE__ */ g("section", {
68
- className: "grid gap-3",
69
- "data-ckui": "stats-activity",
70
74
  children: [/* @__PURE__ */ g("div", {
71
- className: "flex flex-wrap items-center justify-between gap-2",
75
+ className: "grid gap-0.5",
72
76
  children: [/* @__PURE__ */ h("h3", {
73
77
  className: "font-medium",
74
- children: a("stats.activity")
75
- }), /* @__PURE__ */ h(w, {
76
- label: a("stats.days"),
77
- value: String(C),
78
- onChange: (e) => T(Number(e)),
79
- options: v.map((e) => ({
80
- value: String(e),
81
- label: a("stats.lastDays", { count: e })
82
- }))
78
+ children: r("stats.activity")
79
+ }), /* @__PURE__ */ h("p", {
80
+ className: "text-xs text-muted-foreground",
81
+ children: r("stats.visitorsNote")
83
82
  })]
84
- }), A.unavailable ? /* @__PURE__ */ h("p", {
85
- className: "text-muted-foreground",
86
- role: "status",
87
- children: a("stats.unavailable")
88
- }) : A.error ? /* @__PURE__ */ h(s, {
89
- error: A.error,
90
- message: a("stats.loadFailed"),
91
- retry: A.reload
92
- }) : A.loading && !A.data ? /* @__PURE__ */ h(l, { count: 2 }) : M.length ? /* @__PURE__ */ g("table", {
93
- className: "w-full text-left tabular-nums",
94
- "aria-busy": A.loading,
83
+ }), /* @__PURE__ */ h(D, {
84
+ label: r("stats.days"),
85
+ value: String(s),
86
+ onChange: (e) => d(Number(e)),
87
+ options: y.map((e) => ({
88
+ value: String(e),
89
+ label: r("stats.lastDays", { count: e })
90
+ }))
91
+ })]
92
+ }), _.unavailable ? /* @__PURE__ */ h("p", {
93
+ className: "text-muted-foreground",
94
+ role: "status",
95
+ children: r("stats.unavailable")
96
+ }) : _.error ? /* @__PURE__ */ h(c, {
97
+ error: _.error,
98
+ message: r("stats.loadFailed"),
99
+ retry: _.reload
100
+ }) : _.loading && !_.data ? /* @__PURE__ */ h(u, { count: 3 }) : /* @__PURE__ */ g("div", {
101
+ className: "grid gap-4",
102
+ "aria-busy": _.loading,
103
+ children: [
104
+ /* @__PURE__ */ h(w, { day: x.at(-1) }),
105
+ /* @__PURE__ */ h(T, { rows: x }),
106
+ /* @__PURE__ */ h(E, { rows: x })
107
+ ]
108
+ })]
109
+ })] });
110
+ }
111
+ function w({ day: n }) {
112
+ let { t: r } = e(), i = [{
113
+ label: r("stats.visitors"),
114
+ value: n?.readers ?? 0,
115
+ fill: void 0
116
+ }, ...x.map((e) => ({
117
+ label: r(`stats.${e.key}`),
118
+ value: n?.[e.key] ?? 0,
119
+ fill: e.fill
120
+ }))];
121
+ return /* @__PURE__ */ g("div", {
122
+ className: "grid gap-2",
123
+ "data-ckui": "stats-today",
124
+ children: [/* @__PURE__ */ g("p", {
125
+ className: "text-xs font-medium text-muted-foreground",
126
+ children: [r("stats.today"), n && n.active_ms > 0 && /* @__PURE__ */ g("span", {
127
+ className: "font-normal",
95
128
  children: [
96
- /* @__PURE__ */ h("thead", {
97
- className: "text-xs text-muted-foreground",
98
- children: /* @__PURE__ */ g("tr", { children: [
99
- /* @__PURE__ */ h("th", {
100
- className: "py-1 font-medium",
101
- children: a("stats.date")
102
- }),
103
- /* @__PURE__ */ h("th", {
104
- className: "py-1 font-medium",
105
- children: a("stats.views")
106
- }),
107
- /* @__PURE__ */ h("th", {
108
- className: "py-1 text-end font-medium",
109
- children: a("stats.viewers")
110
- }),
111
- /* @__PURE__ */ h("th", {
112
- className: "py-1 text-end font-medium",
113
- children: a("stats.users")
114
- })
115
- ] })
129
+ " · ",
130
+ r("stats.activeTime"),
131
+ " ",
132
+ t(Math.floor(n.active_ms / 1e3))
133
+ ]
134
+ })]
135
+ }), /* @__PURE__ */ h("dl", {
136
+ className: "grid grid-cols-2 gap-2 sm:grid-cols-4",
137
+ children: i.map((e) => /* @__PURE__ */ g("div", {
138
+ className: "grid gap-0.5 rounded-lg border border-border p-3",
139
+ children: [/* @__PURE__ */ g("dt", {
140
+ className: "flex items-center gap-1.5 text-xs text-muted-foreground",
141
+ children: [e.fill && /* @__PURE__ */ h("span", {
142
+ "aria-hidden": !0,
143
+ className: _("size-2.5 rounded-sm", e.fill)
144
+ }), e.label]
145
+ }), /* @__PURE__ */ h("dd", {
146
+ className: "text-xl font-semibold tabular-nums",
147
+ children: e.value
148
+ })]
149
+ }, e.label))
150
+ })]
151
+ });
152
+ }
153
+ function T({ rows: t }) {
154
+ let n = e(), { t: r } = n, [i, a] = p(null), o = Math.max(0, ...t.map((e) => e.readers)), s = o || 1, c = Math.ceil(t.length / 10), l = new Intl.DateTimeFormat(n.language, {
155
+ month: "short",
156
+ day: "numeric",
157
+ timeZone: "UTC"
158
+ }), u = new Intl.DateTimeFormat(n.language, {
159
+ dateStyle: "medium",
160
+ timeZone: "UTC"
161
+ }), d = (e) => /* @__PURE__ */ new Date(`${e}T00:00:00Z`), f = i === null ? void 0 : t[i];
162
+ return /* @__PURE__ */ g("figure", {
163
+ className: "grid gap-2",
164
+ "data-ckui": "stats-chart",
165
+ children: [
166
+ /* @__PURE__ */ g("figcaption", {
167
+ className: "flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-muted-foreground",
168
+ children: [x.map((e) => /* @__PURE__ */ g("span", {
169
+ className: "flex items-center gap-1.5",
170
+ children: [/* @__PURE__ */ h("span", {
171
+ "aria-hidden": !0,
172
+ className: _("size-2.5 rounded-sm", e.fill)
173
+ }), r(`stats.${e.key}`)]
174
+ }, e.key)), /* @__PURE__ */ h("span", {
175
+ className: "ms-auto tabular-nums",
176
+ children: r("stats.peak", { count: o })
177
+ })]
178
+ }),
179
+ /* @__PURE__ */ g("div", {
180
+ className: "relative",
181
+ children: [
182
+ /* @__PURE__ */ h("div", {
183
+ className: "pointer-events-none absolute inset-x-0 top-0 border-t border-dashed border-border",
184
+ "aria-hidden": !0
116
185
  }),
117
- /* @__PURE__ */ h("tbody", { children: M.map((e) => /* @__PURE__ */ g("tr", {
118
- className: "border-t border-border",
119
- "data-ckui": "stats-day",
120
- children: [
121
- /* @__PURE__ */ h("td", {
122
- className: "py-1.5 pe-3 whitespace-nowrap",
123
- children: e.date
124
- }),
125
- /* @__PURE__ */ h("td", {
126
- className: "w-1/2 py-1.5 pe-3",
127
- children: /* @__PURE__ */ g("span", {
128
- className: "flex items-center gap-2",
129
- children: [/* @__PURE__ */ h("span", {
130
- "aria-hidden": !0,
131
- className: "h-2 rounded-full bg-primary",
132
- style: { width: `${Math.max(2, e.views / N * 100)}%` }
133
- }), e.views]
186
+ /* @__PURE__ */ h("div", {
187
+ className: "pointer-events-none absolute inset-x-0 top-1/2 border-t border-dashed border-border/60",
188
+ "aria-hidden": !0
189
+ }),
190
+ /* @__PURE__ */ h("ol", {
191
+ className: "relative flex h-48 items-end gap-1 border-b border-border",
192
+ onMouseLeave: () => a(null),
193
+ children: t.map((e, t) => /* @__PURE__ */ h("li", {
194
+ tabIndex: 0,
195
+ "data-ckui": "stats-day",
196
+ "aria-label": `${u.format(d(e.date))}: ${r("stats.visitors")} ${e.readers}, ${r("stats.anon")} ${e.anon}, ${r("stats.free")} ${e.free}, ${r("stats.premium")} ${e.premium}`,
197
+ className: "flex h-full min-w-0 flex-1 cursor-default flex-col justify-end rounded-sm outline-none hover:bg-muted/40 focus-visible:bg-muted/40 focus-visible:ring-1 focus-visible:ring-ring",
198
+ onMouseEnter: () => a(t),
199
+ onFocus: () => a(t),
200
+ onBlur: () => a(null),
201
+ children: /* @__PURE__ */ h("span", {
202
+ className: "mx-auto flex w-full max-w-10 flex-col-reverse gap-[2px]",
203
+ style: { height: `${e.readers / s * 100}%` },
204
+ children: x.map((t, n) => {
205
+ let r = e[t.key];
206
+ if (!r) return null;
207
+ let i = x.slice(n + 1).every((t) => !e[t.key]);
208
+ return /* @__PURE__ */ h("span", {
209
+ className: _("min-h-[2px] w-full", t.fill, i && "rounded-t-[4px]"),
210
+ style: {
211
+ flexGrow: r,
212
+ flexBasis: 0
213
+ }
214
+ }, t.key);
134
215
  })
135
- }),
136
- /* @__PURE__ */ h("td", {
137
- className: "py-1.5 text-end",
138
- children: e.viewers
139
- }),
140
- /* @__PURE__ */ h("td", {
141
- className: "py-1.5 text-end",
142
- children: e.users
143
216
  })
144
- ]
145
- }, e.date)) }),
146
- /* @__PURE__ */ h("tfoot", { children: /* @__PURE__ */ g("tr", {
147
- className: "border-t border-border font-medium",
217
+ }, e.date))
218
+ }),
219
+ f && i !== null && /* @__PURE__ */ g("div", {
220
+ role: "tooltip",
221
+ className: "pointer-events-none absolute -top-2 z-10 grid min-w-36 -translate-y-full gap-1 rounded-md border border-border bg-popover p-2 text-xs text-popover-foreground shadow-md",
222
+ style: { left: `clamp(0%, ${(i + .5) / t.length * 100}% - 4.5rem, calc(100% - 9rem))` },
148
223
  children: [
149
- /* @__PURE__ */ h("td", {
150
- className: "py-1.5",
151
- children: a("stats.total")
224
+ /* @__PURE__ */ h("p", {
225
+ className: "font-medium",
226
+ children: u.format(d(f.date))
152
227
  }),
153
- /* @__PURE__ */ h("td", {
154
- className: "py-1.5",
155
- "data-ckui": "stats-total",
156
- children: P
228
+ /* @__PURE__ */ g("p", {
229
+ className: "flex justify-between gap-3 tabular-nums",
230
+ children: [/* @__PURE__ */ h("span", { children: r("stats.visitors") }), /* @__PURE__ */ h("span", {
231
+ className: "font-semibold",
232
+ children: f.readers
233
+ })]
157
234
  }),
158
- /* @__PURE__ */ h("td", {}),
159
- /* @__PURE__ */ h("td", {})
235
+ [...x].reverse().map((e) => /* @__PURE__ */ g("p", {
236
+ className: "flex items-center justify-between gap-3 tabular-nums text-muted-foreground",
237
+ children: [/* @__PURE__ */ g("span", {
238
+ className: "flex items-center gap-1.5",
239
+ children: [/* @__PURE__ */ h("span", {
240
+ "aria-hidden": !0,
241
+ className: _("size-2 rounded-sm", e.fill)
242
+ }), r(`stats.${e.key}`)]
243
+ }), /* @__PURE__ */ h("span", {
244
+ className: "text-popover-foreground",
245
+ children: f[e.key]
246
+ })]
247
+ }, e.key))
160
248
  ]
161
- }) })
249
+ })
162
250
  ]
163
- }) : /* @__PURE__ */ h("p", {
251
+ }),
252
+ /* @__PURE__ */ h("ol", {
253
+ "aria-hidden": !0,
254
+ className: "flex gap-1 text-[11px] text-muted-foreground tabular-nums",
255
+ children: t.map((e, n) => /* @__PURE__ */ h("li", {
256
+ className: "min-w-0 flex-1 overflow-visible text-center whitespace-nowrap",
257
+ children: (t.length - 1 - n) % c == 0 ? l.format(d(e.date)) : ""
258
+ }, e.date))
259
+ }),
260
+ o === 0 && /* @__PURE__ */ h("p", {
164
261
  className: "text-muted-foreground",
165
- children: a("stats.noActivity")
166
- })]
167
- }),
168
- /* @__PURE__ */ g("section", {
169
- className: "grid gap-3",
170
- "data-ckui": "stats-top",
171
- children: [/* @__PURE__ */ g("div", {
172
- className: "flex flex-wrap items-center justify-between gap-2",
173
- children: [/* @__PURE__ */ h("h3", {
174
- className: "font-medium",
175
- children: a("stats.top")
176
- }), /* @__PURE__ */ g("div", {
177
- className: "flex flex-wrap gap-2",
178
- children: [/* @__PURE__ */ h(w, {
179
- label: a("stats.metric"),
180
- value: E,
181
- onChange: (e) => D(e),
182
- options: y.map((e) => ({
183
- value: e,
184
- label: a(`stats.metric_${e}`)
185
- }))
186
- }), /* @__PURE__ */ h(w, {
187
- label: a("stats.period"),
188
- value: O,
189
- onChange: (e) => k(e),
190
- options: b.map((e) => ({
191
- value: e,
192
- label: a(`stats.period_${e}`)
193
- }))
194
- })]
195
- })]
196
- }), j.unavailable ? /* @__PURE__ */ h("p", {
197
- className: "text-muted-foreground",
198
- role: "status",
199
- children: a("stats.unavailable")
200
- }) : j.error ? /* @__PURE__ */ h(s, {
201
- error: j.error,
202
- message: a("stats.loadFailed"),
203
- retry: j.reload
204
- }) : j.loading && !j.data ? /* @__PURE__ */ h(l, { count: 3 }) : j.data?.contents.length ? /* @__PURE__ */ h("ol", {
205
- className: "grid divide-y divide-border rounded-lg border border-border",
206
- "aria-busy": j.loading,
207
- children: j.data.contents.map((e, t) => {
208
- let r = n ? n(e) : e.path;
209
- return /* @__PURE__ */ g("li", {
210
- className: "flex items-center gap-3 p-2.5",
211
- "data-ckui": "stats-ranked",
212
- children: [
213
- /* @__PURE__ */ h("span", {
214
- className: "w-6 text-end text-muted-foreground tabular-nums",
215
- children: t + 1
216
- }),
217
- r ? /* @__PURE__ */ h("a", {
218
- className: "min-w-0 flex-1 break-words hover:underline",
219
- href: r,
220
- children: e.title
221
- }) : /* @__PURE__ */ h("span", {
222
- className: "min-w-0 flex-1 break-words",
223
- children: e.title
224
- }),
225
- /* @__PURE__ */ h("span", {
226
- className: "tabular-nums",
227
- "data-ckui": "stats-value",
228
- children: e.value
229
- })
230
- ]
231
- }, e.id);
232
- })
233
- }) : /* @__PURE__ */ h("p", {
234
- className: "text-muted-foreground",
235
- children: a("stats.noTop")
236
- })]
237
- })
238
- ] });
262
+ children: r("stats.noActivity")
263
+ })
264
+ ]
265
+ });
266
+ }
267
+ function E({ rows: n }) {
268
+ let { t: r } = e();
269
+ return /* @__PURE__ */ g("details", {
270
+ className: "text-sm",
271
+ children: [/* @__PURE__ */ h("summary", {
272
+ className: "cursor-pointer text-xs text-muted-foreground",
273
+ children: r("stats.showTable")
274
+ }), /* @__PURE__ */ g("table", {
275
+ className: "mt-2 w-full text-left tabular-nums",
276
+ children: [/* @__PURE__ */ h("thead", {
277
+ className: "text-xs text-muted-foreground",
278
+ children: /* @__PURE__ */ g("tr", { children: [
279
+ /* @__PURE__ */ h("th", {
280
+ className: "py-1 font-medium",
281
+ children: r("stats.date")
282
+ }),
283
+ /* @__PURE__ */ h("th", {
284
+ className: "py-1 text-end font-medium",
285
+ children: r("stats.visitors")
286
+ }),
287
+ /* @__PURE__ */ h("th", {
288
+ className: "py-1 text-end font-medium",
289
+ children: r("stats.anon")
290
+ }),
291
+ /* @__PURE__ */ h("th", {
292
+ className: "py-1 text-end font-medium",
293
+ children: r("stats.free")
294
+ }),
295
+ /* @__PURE__ */ h("th", {
296
+ className: "py-1 text-end font-medium",
297
+ children: r("stats.premium")
298
+ }),
299
+ /* @__PURE__ */ h("th", {
300
+ className: "py-1 text-end font-medium",
301
+ children: r("stats.activeTime")
302
+ })
303
+ ] })
304
+ }), /* @__PURE__ */ h("tbody", { children: [...n].reverse().map((e) => /* @__PURE__ */ g("tr", {
305
+ className: "border-t border-border",
306
+ children: [
307
+ /* @__PURE__ */ h("td", {
308
+ className: "py-1.5 pe-3 whitespace-nowrap",
309
+ children: e.date
310
+ }),
311
+ /* @__PURE__ */ h("td", {
312
+ className: "py-1.5 text-end",
313
+ children: e.readers
314
+ }),
315
+ /* @__PURE__ */ h("td", {
316
+ className: "py-1.5 text-end",
317
+ children: e.anon
318
+ }),
319
+ /* @__PURE__ */ h("td", {
320
+ className: "py-1.5 text-end",
321
+ children: e.free
322
+ }),
323
+ /* @__PURE__ */ h("td", {
324
+ className: "py-1.5 text-end",
325
+ children: e.premium
326
+ }),
327
+ /* @__PURE__ */ h("td", {
328
+ className: "py-1.5 text-end",
329
+ children: t(Math.floor(e.active_ms / 1e3))
330
+ })
331
+ ]
332
+ }, e.date)) })]
333
+ })]
334
+ });
239
335
  }
240
- function w({ label: e, value: o, onChange: s, options: c }) {
241
- return /* @__PURE__ */ g(t, {
242
- value: o,
336
+ function D({ label: e, value: t, onChange: s, options: c }) {
337
+ return /* @__PURE__ */ g(n, {
338
+ value: t,
243
339
  onValueChange: (e) => s(String(e)),
244
- children: [/* @__PURE__ */ h(i, {
340
+ children: [/* @__PURE__ */ h(a, {
245
341
  size: "sm",
246
342
  "aria-label": e,
247
- children: /* @__PURE__ */ h(a, { children: (e) => c.find((t) => t.value === e)?.label ?? e })
248
- }), /* @__PURE__ */ h(n, { children: c.map((e) => /* @__PURE__ */ h(r, {
343
+ children: /* @__PURE__ */ h(o, { children: (e) => c.find((t) => t.value === e)?.label ?? e })
344
+ }), /* @__PURE__ */ h(r, { children: c.map((e) => /* @__PURE__ */ h(i, {
249
345
  value: e.value,
250
346
  children: e.label
251
347
  }, e.value)) })]