@jant/core 0.3.25 → 0.3.27

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 (133) hide show
  1. package/dist/app.js +70 -563
  2. package/dist/auth.js +3 -0
  3. package/dist/client.js +1 -0
  4. package/dist/i18n/locales/en.js +1 -1
  5. package/dist/i18n/locales/zh-Hans.js +1 -1
  6. package/dist/i18n/locales/zh-Hant.js +1 -1
  7. package/dist/lib/avatar-upload.js +134 -0
  8. package/dist/lib/config.js +39 -0
  9. package/dist/lib/constants.js +10 -10
  10. package/dist/lib/favicon.js +102 -0
  11. package/dist/lib/image.js +13 -17
  12. package/dist/lib/media-helpers.js +2 -2
  13. package/dist/lib/navigation.js +23 -3
  14. package/dist/lib/render.js +10 -1
  15. package/dist/lib/schemas.js +31 -0
  16. package/dist/lib/timezones.js +388 -0
  17. package/dist/lib/view.js +1 -1
  18. package/dist/routes/api/posts.js +1 -1
  19. package/dist/routes/api/upload.js +3 -3
  20. package/dist/routes/auth/reset.js +221 -0
  21. package/dist/routes/auth/setup.js +194 -0
  22. package/dist/routes/auth/signin.js +176 -0
  23. package/dist/routes/dash/collections.js +23 -415
  24. package/dist/routes/dash/media.js +12 -392
  25. package/dist/routes/dash/pages.js +7 -330
  26. package/dist/routes/dash/redirects.js +18 -12
  27. package/dist/routes/dash/settings.js +198 -577
  28. package/dist/routes/feed/rss.js +2 -1
  29. package/dist/routes/feed/sitemap.js +4 -2
  30. package/dist/routes/pages/featured.js +5 -1
  31. package/dist/routes/pages/home.js +26 -1
  32. package/dist/routes/pages/latest.js +45 -0
  33. package/dist/services/post.js +30 -50
  34. package/dist/types/bindings.js +3 -0
  35. package/dist/types/config.js +147 -0
  36. package/dist/types/constants.js +27 -0
  37. package/dist/types/entities.js +3 -0
  38. package/dist/types/operations.js +3 -0
  39. package/dist/types/props.js +3 -0
  40. package/dist/types/views.js +5 -0
  41. package/dist/types.js +8 -111
  42. package/dist/ui/color-themes.js +33 -33
  43. package/dist/ui/compose/ComposeDialog.js +36 -21
  44. package/dist/ui/dash/PageForm.js +21 -15
  45. package/dist/ui/dash/PostForm.js +22 -16
  46. package/dist/ui/dash/collections/CollectionForm.js +152 -0
  47. package/dist/ui/dash/collections/CollectionsListContent.js +68 -0
  48. package/dist/ui/dash/collections/ViewCollectionContent.js +96 -0
  49. package/dist/ui/dash/media/MediaListContent.js +166 -0
  50. package/dist/ui/dash/media/ViewMediaContent.js +212 -0
  51. package/dist/ui/dash/pages/LinkFormContent.js +130 -0
  52. package/dist/ui/dash/pages/UnifiedPagesContent.js +193 -0
  53. package/dist/ui/dash/settings/AccountContent.js +209 -0
  54. package/dist/ui/dash/settings/AppearanceContent.js +259 -0
  55. package/dist/ui/dash/settings/GeneralContent.js +536 -0
  56. package/dist/ui/dash/settings/SettingsNav.js +41 -0
  57. package/dist/ui/font-themes.js +36 -0
  58. package/dist/ui/layouts/BaseLayout.js +24 -2
  59. package/dist/ui/layouts/SiteLayout.js +47 -19
  60. package/package.json +1 -1
  61. package/src/app.tsx +95 -553
  62. package/src/auth.ts +4 -1
  63. package/src/client.ts +1 -0
  64. package/src/i18n/locales/en.po +240 -175
  65. package/src/i18n/locales/en.ts +1 -1
  66. package/src/i18n/locales/zh-Hans.po +240 -175
  67. package/src/i18n/locales/zh-Hans.ts +1 -1
  68. package/src/i18n/locales/zh-Hant.po +240 -175
  69. package/src/i18n/locales/zh-Hant.ts +1 -1
  70. package/src/lib/__tests__/config.test.ts +192 -0
  71. package/src/lib/__tests__/favicon.test.ts +151 -0
  72. package/src/lib/__tests__/image.test.ts +2 -6
  73. package/src/lib/__tests__/timezones.test.ts +61 -0
  74. package/src/lib/__tests__/view.test.ts +2 -2
  75. package/src/lib/avatar-upload.ts +165 -0
  76. package/src/lib/config.ts +47 -0
  77. package/src/lib/constants.ts +19 -11
  78. package/src/lib/favicon.ts +115 -0
  79. package/src/lib/image.ts +13 -21
  80. package/src/lib/media-helpers.ts +2 -2
  81. package/src/lib/navigation.ts +33 -2
  82. package/src/lib/render.tsx +15 -1
  83. package/src/lib/schemas.ts +39 -0
  84. package/src/lib/timezones.ts +325 -0
  85. package/src/lib/view.ts +1 -1
  86. package/src/routes/api/posts.ts +1 -1
  87. package/src/routes/api/upload.ts +2 -3
  88. package/src/routes/auth/reset.tsx +239 -0
  89. package/src/routes/auth/setup.tsx +189 -0
  90. package/src/routes/auth/signin.tsx +163 -0
  91. package/src/routes/dash/__tests__/settings-avatar.test.ts +89 -0
  92. package/src/routes/dash/collections.tsx +17 -366
  93. package/src/routes/dash/media.tsx +12 -414
  94. package/src/routes/dash/pages.tsx +8 -348
  95. package/src/routes/dash/redirects.tsx +20 -14
  96. package/src/routes/dash/settings.tsx +243 -534
  97. package/src/routes/feed/__tests__/rss.test.ts +141 -0
  98. package/src/routes/feed/rss.ts +3 -1
  99. package/src/routes/feed/sitemap.ts +4 -2
  100. package/src/routes/pages/featured.tsx +7 -1
  101. package/src/routes/pages/home.tsx +25 -2
  102. package/src/routes/pages/latest.tsx +59 -0
  103. package/src/services/post.ts +34 -66
  104. package/src/styles/components.css +0 -65
  105. package/src/styles/tokens.css +1 -1
  106. package/src/styles/ui.css +24 -40
  107. package/src/types/bindings.ts +30 -0
  108. package/src/types/config.ts +183 -0
  109. package/src/types/constants.ts +26 -0
  110. package/src/types/entities.ts +109 -0
  111. package/src/types/operations.ts +88 -0
  112. package/src/types/props.ts +115 -0
  113. package/src/types/views.ts +172 -0
  114. package/src/types.ts +8 -644
  115. package/src/ui/__tests__/font-themes.test.ts +34 -0
  116. package/src/ui/color-themes.ts +34 -34
  117. package/src/ui/compose/ComposeDialog.tsx +40 -21
  118. package/src/ui/dash/PageForm.tsx +25 -19
  119. package/src/ui/dash/PostForm.tsx +26 -20
  120. package/src/ui/dash/collections/CollectionForm.tsx +153 -0
  121. package/src/ui/dash/collections/CollectionsListContent.tsx +85 -0
  122. package/src/ui/dash/collections/ViewCollectionContent.tsx +92 -0
  123. package/src/ui/dash/media/MediaListContent.tsx +201 -0
  124. package/src/ui/dash/media/ViewMediaContent.tsx +208 -0
  125. package/src/ui/dash/pages/LinkFormContent.tsx +119 -0
  126. package/src/ui/dash/pages/UnifiedPagesContent.tsx +203 -0
  127. package/src/ui/dash/settings/AccountContent.tsx +176 -0
  128. package/src/ui/dash/settings/AppearanceContent.tsx +254 -0
  129. package/src/ui/dash/settings/GeneralContent.tsx +533 -0
  130. package/src/ui/dash/settings/SettingsNav.tsx +56 -0
  131. package/src/ui/font-themes.ts +54 -0
  132. package/src/ui/layouts/BaseLayout.tsx +17 -0
  133. package/src/ui/layouts/SiteLayout.tsx +45 -31
@@ -5,12 +5,16 @@
5
5
  * If Context is provided, automatically wraps children with I18nProvider.
6
6
  *
7
7
  * Uses vite-ssr-components for automatic dev/prod asset path resolution.
8
- */ import { jsx as _jsx, jsxs as _jsxs } from "hono/jsx/jsx-runtime";
8
+ */ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "hono/jsx/jsx-runtime";
9
9
  import { Script, Link, ViteClient } from "vite-ssr-components/hono";
10
10
  import { I18nProvider } from "../../i18n/index.js";
11
- export const BaseLayout = ({ title, description, lang, c, toast, children })=>{
11
+ export const BaseLayout = ({ title, description, lang, c, toast, faviconUrl, noindex, children })=>{
12
12
  // Read lang from Hono context if available, otherwise use prop or default
13
13
  const resolvedLang = lang ?? (c ? c.get("lang") : "en");
14
+ // Read faviconUrl from context when not provided as prop (fixes dashboard favicon)
15
+ const resolvedFaviconUrl = faviconUrl ?? (c ? c.get("faviconUrl") : undefined);
16
+ // Read noindex from context when not provided as prop
17
+ const resolvedNoindex = noindex ?? (c ? c.get("noindex") : undefined);
14
18
  // Automatically wrap with I18nProvider if Context is provided
15
19
  const content = c ? /*#__PURE__*/ _jsx(I18nProvider, {
16
20
  c: c,
@@ -41,6 +45,24 @@ export const BaseLayout = ({ title, description, lang, c, toast, children })=>{
41
45
  name: "description",
42
46
  content: description
43
47
  }),
48
+ resolvedNoindex && /*#__PURE__*/ _jsx("meta", {
49
+ name: "robots",
50
+ content: "noindex, nofollow"
51
+ }),
52
+ resolvedFaviconUrl && /*#__PURE__*/ _jsxs(_Fragment, {
53
+ children: [
54
+ /*#__PURE__*/ _jsx("link", {
55
+ rel: "icon",
56
+ href: "/favicon.ico",
57
+ sizes: "16x16 32x32"
58
+ }),
59
+ /*#__PURE__*/ _jsx("link", {
60
+ rel: "apple-touch-icon",
61
+ href: "/apple-touch-icon.png",
62
+ sizes: "180x180"
63
+ })
64
+ ]
65
+ }),
44
66
  /*#__PURE__*/ _jsx(ViteClient, {}),
45
67
  /*#__PURE__*/ _jsx(Link, {
46
68
  href: "/src/style.css",
@@ -18,29 +18,37 @@ function HeaderLink({ link }) {
18
18
  children: link.label
19
19
  });
20
20
  }
21
- export const SiteLayout = ({ siteName, siteDescription, links, currentPath, isAuthenticated, collections, children })=>{
21
+ export const SiteLayout = ({ siteName, siteDescription, links, currentPath, isAuthenticated, collections, homeDefaultView, siteAvatarUrl, showHeaderAvatar, siteFooterHtml, children })=>{
22
22
  const { i18n: $__i18n, _: $__ } = $_useLingui();
23
- const browseLinks = [
24
- {
25
- href: "/",
26
- label: $__i18n._({
27
- id: "wL3cK8",
28
- message: "Latest"
29
- })
30
- },
31
- {
32
- href: "/featured",
33
- label: $__i18n._({
34
- id: "FkMol5",
35
- message: "Featured"
36
- })
37
- }
23
+ const latestHref = homeDefaultView === "featured" ? "/latest" : "/";
24
+ const featuredHref = homeDefaultView === "featured" ? "/" : "/featured";
25
+ const latestLink = {
26
+ href: latestHref,
27
+ label: $__i18n._({
28
+ id: "wL3cK8",
29
+ message: "Latest"
30
+ })
31
+ };
32
+ const featuredLink = {
33
+ href: featuredHref,
34
+ label: $__i18n._({
35
+ id: "FkMol5",
36
+ message: "Featured"
37
+ })
38
+ };
39
+ // Default view tab comes first
40
+ const browseLinks = homeDefaultView === "featured" ? [
41
+ featuredLink,
42
+ latestLink
43
+ ] : [
44
+ latestLink,
45
+ featuredLink
38
46
  ];
39
47
  const searchLabel = $__i18n._({
40
48
  id: "A1taO8",
41
49
  message: "Search"
42
50
  });
43
- const isHomePage = currentPath === "/" || currentPath === "/featured";
51
+ const isHomePage = currentPath === "/" || currentPath === "/featured" || currentPath === "/latest";
44
52
  return /*#__PURE__*/ _jsxs("div", {
45
53
  class: "site-page",
46
54
  children: [
@@ -52,10 +60,17 @@ export const SiteLayout = ({ siteName, siteDescription, links, currentPath, isAu
52
60
  /*#__PURE__*/ _jsxs("div", {
53
61
  class: "site-header-top site-header-top-bordered",
54
62
  children: [
55
- /*#__PURE__*/ _jsx("a", {
63
+ /*#__PURE__*/ _jsxs("a", {
56
64
  href: "/",
57
65
  class: "site-logo",
58
- children: siteName
66
+ children: [
67
+ showHeaderAvatar && siteAvatarUrl && /*#__PURE__*/ _jsx("img", {
68
+ src: siteAvatarUrl,
69
+ class: "site-logo-avatar",
70
+ alt: ""
71
+ }),
72
+ siteName
73
+ ]
59
74
  }),
60
75
  /*#__PURE__*/ _jsxs("div", {
61
76
  class: "site-header-right",
@@ -133,6 +148,19 @@ export const SiteLayout = ({ siteName, siteDescription, links, currentPath, isAu
133
148
  })
134
149
  })
135
150
  }),
151
+ siteFooterHtml && /*#__PURE__*/ _jsx("footer", {
152
+ class: "site-footer",
153
+ "data-footer": true,
154
+ children: /*#__PURE__*/ _jsx("div", {
155
+ class: "site-container",
156
+ children: /*#__PURE__*/ _jsx("div", {
157
+ class: "prose",
158
+ dangerouslySetInnerHTML: {
159
+ __html: siteFooterHtml
160
+ }
161
+ })
162
+ })
163
+ }),
136
164
  isAuthenticated && /*#__PURE__*/ _jsx(ComposeDialog, {
137
165
  collections: collections
138
166
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jant/core",
3
- "version": "0.3.25",
3
+ "version": "0.3.27",
4
4
  "description": "A modern, open-source microblogging platform built on Cloudflare Workers",
5
5
  "type": "module",
6
6
  "exports": {