@openrails/contentkit-ui 0.94.0 → 0.95.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/README.md +58 -1
  2. package/dist/client/discovery.d.ts +14 -1
  3. package/dist/client/discovery.js +27 -14
  4. package/dist/client/discovery.js.map +1 -1
  5. package/dist/client/generated/routes.d.ts +18 -5
  6. package/dist/client/generated/routes.js +39 -0
  7. package/dist/client/generated/routes.js.map +1 -1
  8. package/dist/client/generated/wire.d.ts +10 -0
  9. package/dist/client/generated/wire.js.map +1 -1
  10. package/dist/client/index.d.ts +1 -1
  11. package/dist/client.js +17 -17
  12. package/dist/components/content/card.d.ts +28 -6
  13. package/dist/components/content/card.js +158 -132
  14. package/dist/components/content/card.js.map +1 -1
  15. package/dist/components/content/daily-releases.d.ts +15 -0
  16. package/dist/components/content/daily-releases.js +173 -0
  17. package/dist/components/content/daily-releases.js.map +1 -0
  18. package/dist/components/content/grid.d.ts +14 -1
  19. package/dist/components/content/grid.js +75 -34
  20. package/dist/components/content/grid.js.map +1 -1
  21. package/dist/components/content/index.d.ts +4 -2
  22. package/dist/components/content/popular.d.ts +11 -0
  23. package/dist/components/content/popular.js +49 -0
  24. package/dist/components/content/popular.js.map +1 -0
  25. package/dist/index.js +22 -20
  26. package/dist/locales/discovery/de.js +4 -0
  27. package/dist/locales/discovery/de.js.map +1 -1
  28. package/dist/locales/discovery/en.d.ts +4 -0
  29. package/dist/locales/discovery/en.js +4 -0
  30. package/dist/locales/discovery/en.js.map +1 -1
  31. package/dist/locales/discovery/es.js +4 -0
  32. package/dist/locales/discovery/es.js.map +1 -1
  33. package/dist/locales/discovery/ja.js +4 -0
  34. package/dist/locales/discovery/ja.js.map +1 -1
  35. package/dist/locales/discovery/ko.js +4 -0
  36. package/dist/locales/discovery/ko.js.map +1 -1
  37. package/dist/locales/discovery/zh.js +4 -0
  38. package/dist/locales/discovery/zh.js.map +1 -1
  39. package/dist/locales/en.d.ts +4 -0
  40. package/dist/react/discovery.d.ts +12 -2
  41. package/dist/react/discovery.js +32 -23
  42. package/dist/react/discovery.js.map +1 -1
  43. package/dist/react/index.d.ts +1 -1
  44. package/dist/react/resources.js +11 -11
  45. package/dist/react/resources.js.map +1 -1
  46. package/dist/react.js +10 -10
  47. package/dist/styles.css +1 -1
  48. package/package.json +1 -1
@@ -0,0 +1,49 @@
1
+ import { useMessages as e } from "../../i18n/context.js";
2
+ import { ContentKitUiRoot as t } from "../../scope.js";
3
+ import { Select as n, SelectContent as r, SelectItem as i, SelectTrigger as a, SelectValue as o } from "../../ui/select.js";
4
+ import { popularQuery as s } from "../../client/discovery.js";
5
+ import { ContentGrid as c } from "./grid.js";
6
+ import { useMemo as l, useState as u } from "react";
7
+ import { jsx as d, jsxs as f } from "react/jsx-runtime";
8
+ import { cn as p } from "cn";
9
+ //#region src/components/content/popular.tsx
10
+ var m = [
11
+ "7d",
12
+ "90d",
13
+ "365d",
14
+ "all"
15
+ ];
16
+ function h({ query: h, period: g, onPeriodChange: _, locked: v, ...y }) {
17
+ let b = e(), [x, S] = u("7d"), C = g ?? x, w = l(() => s(C, h), [C, h]), T = (e) => e === "all" ? b.t("listing.period_all") : b.plural("listing.pastDays", Number(e.slice(0, -1)));
18
+ return /* @__PURE__ */ f(t, {
19
+ appearance: y.appearance,
20
+ className: p("grid gap-4 text-sm", y.className),
21
+ "data-ckui": "popular-grid",
22
+ children: [/* @__PURE__ */ f(n, {
23
+ value: C,
24
+ onValueChange: (e) => {
25
+ if (!e || !m.includes(e)) return;
26
+ let t = e;
27
+ g === void 0 && S(t), _?.(t);
28
+ },
29
+ children: [/* @__PURE__ */ d(a, {
30
+ className: "w-fit min-w-40",
31
+ "aria-label": b.t("listing.popularPeriod"),
32
+ children: /* @__PURE__ */ d(o, { children: T(C) })
33
+ }), /* @__PURE__ */ d(r, { children: m.map((e) => /* @__PURE__ */ d(i, {
34
+ value: e,
35
+ children: T(e)
36
+ }, e)) })]
37
+ }), /* @__PURE__ */ d(c, {
38
+ ...y,
39
+ surface: y.surface ?? "popular",
40
+ query: w,
41
+ locked: v,
42
+ infinite: !0
43
+ })]
44
+ });
45
+ }
46
+ //#endregion
47
+ export { h as PopularContentGrid };
48
+
49
+ //# sourceMappingURL=popular.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"popular.js","names":[],"sources":["../../../src/components/content/popular.tsx"],"sourcesContent":["import { cn } from \"cn\";\nimport { useMemo, useState } from \"react\";\nimport { popularQuery, type PopularPeriod, type PopularQuery } from \"../../client/discovery.js\";\nimport { useMessages } from \"../../i18n/context.js\";\nimport { ContentKitUiRoot } from \"../../scope.js\";\nimport { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from \"#ckui/ui/select\";\nimport { ContentGrid, type CardListProps, type LockedCards } from \"./grid.js\";\n\nexport interface PopularContentGridProps extends Omit<CardListProps, \"infinite\"> {\n query?: PopularQuery;\n /** Controlled period; otherwise the selector starts at 7d. */\n period?: PopularPeriod;\n onPeriodChange?: (period: PopularPeriod) => void;\n locked?: LockedCards;\n}\n\nconst PERIODS: readonly PopularPeriod[] = [\"7d\", \"90d\", \"365d\", \"all\"];\n\n/** A popularity listing with matched score/age windows and infinite paging. */\nexport function PopularContentGrid({ query, period, onPeriodChange, locked, ...p }: PopularContentGridProps) {\n const m = useMessages();\n const [ownPeriod, setOwnPeriod] = useState<PopularPeriod>(\"7d\");\n const current = period ?? ownPeriod;\n const list = useMemo(() => popularQuery(current, query), [current, query]);\n const label = (value: PopularPeriod) => value === \"all\" ? m.t(\"listing.period_all\") : m.plural(\"listing.pastDays\", Number(value.slice(0, -1)));\n return (\n <ContentKitUiRoot appearance={p.appearance} className={cn(\"grid gap-4 text-sm\", p.className)} data-ckui=\"popular-grid\">\n <Select value={current} onValueChange={(value) => {\n if (!value || !PERIODS.includes(value as PopularPeriod)) return;\n const next = value as PopularPeriod;\n if (period === undefined) setOwnPeriod(next);\n onPeriodChange?.(next);\n }}>\n <SelectTrigger className=\"w-fit min-w-40\" aria-label={m.t(\"listing.popularPeriod\")}><SelectValue>{label(current)}</SelectValue></SelectTrigger>\n <SelectContent>{PERIODS.map((value) => <SelectItem key={value} value={value}>{label(value)}</SelectItem>)}</SelectContent>\n </Select>\n <ContentGrid {...p} surface={p.surface ?? \"popular\"} query={list} locked={locked} infinite />\n </ContentKitUiRoot>\n );\n}\n"],"mappings":";;;;;;;;;AAgBA,IAAM,IAAoC;CAAC;CAAM;CAAO;CAAQ;AAAK;AAGrE,SAAgB,EAAmB,EAAE,UAAO,WAAQ,mBAAgB,WAAQ,GAAG,KAA8B;CAC3G,IAAM,IAAI,EAAY,GAChB,CAAC,GAAW,KAAgB,EAAwB,IAAI,GACxD,IAAU,KAAU,GACpB,IAAO,QAAc,EAAa,GAAS,CAAK,GAAG,CAAC,GAAS,CAAK,CAAC,GACnE,KAAS,MAAyB,MAAU,QAAQ,EAAE,EAAE,oBAAoB,IAAI,EAAE,OAAO,oBAAoB,OAAO,EAAM,MAAM,GAAG,EAAE,CAAC,CAAC;CAC7I,OACE,kBAAC,GAAD;EAAkB,YAAY,EAAE;EAAY,WAAW,EAAG,sBAAsB,EAAE,SAAS;EAAG,aAAU;EAAxG,UAAA,CACE,kBAAC,GAAD;GAAQ,OAAO;GAAS,gBAAgB,MAAU;IAChD,IAAI,CAAC,KAAS,CAAC,EAAQ,SAAS,CAAsB,GAAG;IACzD,IAAM,IAAO;IAEb,AADI,MAAW,KAAA,KAAW,EAAa,CAAI,GAC3C,IAAiB,CAAI;GACvB;GALA,UAAA,CAME,kBAAC,GAAD;IAAe,WAAU;IAAiB,cAAY,EAAE,EAAE,uBAAuB;IAAG,UAAA,kBAAC,GAAD,EAAA,UAAc,EAAM,CAAO,EAAe,CAAA;GAAgB,CAAA,GAC9I,kBAAC,GAAD,EAAA,UAAgB,EAAQ,KAAK,MAAU,kBAAC,GAAD;IAA+B;IAAQ,UAAA,EAAM,CAAK;GAAc,GAA/C,CAA+C,CAAC,EAAiB,CAAA,CACnH;EACR,CAAA,GAAA,kBAAC,GAAD;GAAa,GAAI;GAAG,SAAS,EAAE,WAAW;GAAW,OAAO;GAAc;GAAQ,UAAA;EAAU,CAAA,CAC5E;;AAEtB"}