@jant/core 0.2.16 → 0.2.18

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 (120) hide show
  1. package/dist/app.d.ts +5 -1
  2. package/dist/app.d.ts.map +1 -1
  3. package/dist/app.js +332 -119
  4. package/dist/i18n/context.d.ts +2 -2
  5. package/dist/i18n/context.js +1 -1
  6. package/dist/i18n/i18n.d.ts +1 -1
  7. package/dist/i18n/i18n.js +1 -1
  8. package/dist/i18n/index.d.ts +1 -1
  9. package/dist/i18n/index.js +1 -1
  10. package/dist/i18n/locales/en.d.ts.map +1 -1
  11. package/dist/i18n/locales/en.js +1 -1
  12. package/dist/i18n/locales/zh-Hans.d.ts.map +1 -1
  13. package/dist/i18n/locales/zh-Hans.js +1 -1
  14. package/dist/i18n/locales/zh-Hant.d.ts.map +1 -1
  15. package/dist/i18n/locales/zh-Hant.js +1 -1
  16. package/dist/index.d.ts +1 -1
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/lib/config.d.ts +83 -0
  19. package/dist/lib/config.d.ts.map +1 -0
  20. package/dist/lib/config.js +104 -0
  21. package/dist/lib/constants.d.ts +2 -1
  22. package/dist/lib/constants.d.ts.map +1 -1
  23. package/dist/lib/constants.js +5 -2
  24. package/dist/lib/sse.d.ts +15 -0
  25. package/dist/lib/sse.d.ts.map +1 -1
  26. package/dist/lib/sse.js +13 -0
  27. package/dist/lib/theme.d.ts +44 -0
  28. package/dist/lib/theme.d.ts.map +1 -0
  29. package/dist/lib/theme.js +65 -0
  30. package/dist/routes/dash/appearance.d.ts +13 -0
  31. package/dist/routes/dash/appearance.d.ts.map +1 -0
  32. package/dist/routes/dash/appearance.js +164 -0
  33. package/dist/routes/dash/collections.d.ts.map +1 -1
  34. package/dist/routes/dash/collections.js +5 -4
  35. package/dist/routes/dash/index.d.ts.map +1 -1
  36. package/dist/routes/dash/index.js +2 -1
  37. package/dist/routes/dash/media.d.ts.map +1 -1
  38. package/dist/routes/dash/media.js +3 -2
  39. package/dist/routes/dash/pages.d.ts.map +1 -1
  40. package/dist/routes/dash/pages.js +5 -4
  41. package/dist/routes/dash/posts.d.ts.map +1 -1
  42. package/dist/routes/dash/posts.js +5 -4
  43. package/dist/routes/dash/redirects.d.ts.map +1 -1
  44. package/dist/routes/dash/redirects.js +3 -2
  45. package/dist/routes/dash/settings.d.ts.map +1 -1
  46. package/dist/routes/dash/settings.js +39 -38
  47. package/dist/routes/pages/archive.d.ts.map +1 -1
  48. package/dist/routes/pages/archive.js +2 -1
  49. package/dist/routes/pages/collection.d.ts.map +1 -1
  50. package/dist/routes/pages/collection.js +2 -1
  51. package/dist/routes/pages/home.d.ts.map +1 -1
  52. package/dist/routes/pages/home.js +2 -1
  53. package/dist/routes/pages/page.d.ts.map +1 -1
  54. package/dist/routes/pages/page.js +2 -1
  55. package/dist/routes/pages/post.d.ts.map +1 -1
  56. package/dist/routes/pages/post.js +2 -1
  57. package/dist/routes/pages/search.d.ts.map +1 -1
  58. package/dist/routes/pages/search.js +2 -1
  59. package/dist/services/settings.d.ts +1 -0
  60. package/dist/services/settings.d.ts.map +1 -1
  61. package/dist/services/settings.js +3 -0
  62. package/dist/theme/color-themes.d.ts +30 -0
  63. package/dist/theme/color-themes.d.ts.map +1 -0
  64. package/dist/theme/color-themes.js +268 -0
  65. package/dist/theme/layouts/BaseLayout.d.ts +5 -0
  66. package/dist/theme/layouts/BaseLayout.d.ts.map +1 -1
  67. package/dist/theme/layouts/BaseLayout.js +70 -3
  68. package/dist/theme/layouts/DashLayout.d.ts +2 -0
  69. package/dist/theme/layouts/DashLayout.d.ts.map +1 -1
  70. package/dist/theme/layouts/DashLayout.js +10 -1
  71. package/dist/theme/layouts/index.d.ts +1 -1
  72. package/dist/theme/layouts/index.d.ts.map +1 -1
  73. package/dist/types.d.ts +64 -32
  74. package/dist/types.d.ts.map +1 -1
  75. package/dist/types.js +52 -0
  76. package/package.json +1 -1
  77. package/src/app.tsx +286 -59
  78. package/src/db/migrations/{0000_solid_moon_knight.sql → 0000_square_wallflower.sql} +3 -3
  79. package/src/db/migrations/meta/0000_snapshot.json +9 -9
  80. package/src/db/migrations/meta/_journal.json +2 -30
  81. package/src/i18n/context.tsx +2 -2
  82. package/src/i18n/i18n.ts +1 -1
  83. package/src/i18n/index.ts +1 -1
  84. package/src/i18n/locales/en.po +328 -252
  85. package/src/i18n/locales/en.ts +1 -1
  86. package/src/i18n/locales/zh-Hans.po +315 -278
  87. package/src/i18n/locales/zh-Hans.ts +1 -1
  88. package/src/i18n/locales/zh-Hant.po +315 -278
  89. package/src/i18n/locales/zh-Hant.ts +1 -1
  90. package/src/index.ts +0 -2
  91. package/src/lib/config.ts +120 -0
  92. package/src/lib/constants.ts +3 -0
  93. package/src/lib/sse.ts +38 -0
  94. package/src/lib/theme.ts +86 -0
  95. package/src/preset.css +9 -0
  96. package/src/routes/dash/appearance.tsx +180 -0
  97. package/src/routes/dash/collections.tsx +5 -4
  98. package/src/routes/dash/index.tsx +2 -1
  99. package/src/routes/dash/media.tsx +3 -2
  100. package/src/routes/dash/pages.tsx +5 -4
  101. package/src/routes/dash/posts.tsx +5 -4
  102. package/src/routes/dash/redirects.tsx +3 -2
  103. package/src/routes/dash/settings.tsx +51 -49
  104. package/src/routes/pages/archive.tsx +2 -1
  105. package/src/routes/pages/collection.tsx +2 -1
  106. package/src/routes/pages/home.tsx +2 -1
  107. package/src/routes/pages/page.tsx +2 -1
  108. package/src/routes/pages/post.tsx +2 -1
  109. package/src/routes/pages/search.tsx +2 -1
  110. package/src/services/settings.ts +5 -0
  111. package/src/styles/components.css +93 -0
  112. package/src/theme/color-themes.ts +321 -0
  113. package/src/theme/layouts/BaseLayout.tsx +61 -1
  114. package/src/theme/layouts/DashLayout.tsx +13 -2
  115. package/src/theme/layouts/index.ts +5 -1
  116. package/src/types.ts +74 -34
  117. package/src/db/migrations/0001_add_search_fts.sql +0 -40
  118. package/src/db/migrations/0002_collection_path.sql +0 -2
  119. package/src/db/migrations/0003_collection_path_nullable.sql +0 -21
  120. package/src/db/migrations/0004_media_uuid.sql +0 -35
@@ -1,4 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "hono/jsx/jsx-runtime";
2
+ import { getSiteName } from "../../lib/config.js";
2
3
  /**
3
4
  * Custom Page Route
4
5
  *
@@ -58,7 +59,7 @@ pageRoutes.get("/:path", async (c)=>{
58
59
  if (page.visibility === "draft") {
59
60
  return c.notFound();
60
61
  }
61
- const siteName = await c.var.services.settings.get("SITE_NAME") ?? "Jant";
62
+ const siteName = await getSiteName(c);
62
63
  return c.html(/*#__PURE__*/ _jsx(BaseLayout, {
63
64
  title: `${page.title} - ${siteName}`,
64
65
  description: page.content?.slice(0, 160),
@@ -1 +1 @@
1
- {"version":3,"file":"post.d.ts","sourceRoot":"","sources":["../../../src/routes/pages/post.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,OAAO,KAAK,EAAE,QAAQ,EAAQ,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAKjD,KAAK,GAAG,GAAG;IAAE,QAAQ,EAAE,QAAQ,CAAC;IAAC,SAAS,EAAE,YAAY,CAAA;CAAE,CAAC;AAE3D,eAAO,MAAM,UAAU,kDAAkB,CAAC"}
1
+ {"version":3,"file":"post.d.ts","sourceRoot":"","sources":["../../../src/routes/pages/post.tsx"],"names":[],"mappings":"AACA;;GAEG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,OAAO,KAAK,EAAE,QAAQ,EAAQ,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAKjD,KAAK,GAAG,GAAG;IAAE,QAAQ,EAAE,QAAQ,CAAC;IAAC,SAAS,EAAE,YAAY,CAAA;CAAE,CAAC;AAE3D,eAAO,MAAM,UAAU,kDAAkB,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "hono/jsx/jsx-runtime";
2
+ import { getSiteName } from "../../lib/config.js";
2
3
  /**
3
4
  * Single Post Page Route
4
5
  */ import { Hono } from "hono";
@@ -77,7 +78,7 @@ postRoutes.get("/:id", async (c)=>{
77
78
  if (post.visibility === "draft") {
78
79
  return c.notFound();
79
80
  }
80
- const siteName = await c.var.services.settings.get("SITE_NAME") ?? "Jant";
81
+ const siteName = await getSiteName(c);
81
82
  const title = post.title || siteName;
82
83
  return c.html(/*#__PURE__*/ _jsx(BaseLayout, {
83
84
  title: title,
@@ -1 +1 @@
1
- {"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../../src/routes/pages/search.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAOjD,KAAK,GAAG,GAAG;IAAE,QAAQ,EAAE,QAAQ,CAAC;IAAC,SAAS,EAAE,YAAY,CAAA;CAAE,CAAC;AAI3D,eAAO,MAAM,YAAY,kDAAkB,CAAC"}
1
+ {"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../../src/routes/pages/search.tsx"],"names":[],"mappings":"AACA;;GAEG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAOjD,KAAK,GAAG,GAAG;IAAE,QAAQ,EAAE,QAAQ,CAAC;IAAC,SAAS,EAAE,YAAY,CAAA;CAAE,CAAC;AAI3D,eAAO,MAAM,YAAY,kDAAkB,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "hono/jsx/jsx-runtime";
2
+ import { getSiteName } from "../../lib/config.js";
2
3
  /**
3
4
  * Search Page Route
4
5
  */ import { Hono } from "hono";
@@ -140,7 +141,7 @@ searchRoutes.get("/", async (c)=>{
140
141
  const query = c.req.query("q") || "";
141
142
  const pageParam = c.req.query("page");
142
143
  const page = pageParam ? Math.max(1, parseInt(pageParam, 10) || 1) : 1;
143
- const siteName = await c.var.services.settings.get("SITE_NAME") ?? "Jant";
144
+ const siteName = await getSiteName(c);
144
145
  // Only search if there's a query
145
146
  let results = [];
146
147
  let error = null;
@@ -10,6 +10,7 @@ export interface SettingsService {
10
10
  getAll(): Promise<Record<string, string>>;
11
11
  set(key: SettingsKey, value: string): Promise<void>;
12
12
  setMany(entries: Partial<Record<SettingsKey, string>>): Promise<void>;
13
+ remove(key: SettingsKey): Promise<void>;
13
14
  isOnboardingComplete(): Promise<boolean>;
14
15
  completeOnboarding(): Promise<void>;
15
16
  }
@@ -1 +1 @@
1
- {"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../src/services/settings.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAG/C,OAAO,EAGL,KAAK,WAAW,EACjB,MAAM,qBAAqB,CAAC;AAE7B,MAAM,WAAW,eAAe;IAC9B,GAAG,CAAC,GAAG,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAC9C,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC1C,GAAG,CAAC,GAAG,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACpD,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACtE,oBAAoB,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IACzC,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACrC;AAED,wBAAgB,qBAAqB,CAAC,EAAE,EAAE,QAAQ,GAAG,eAAe,CA6DnE"}
1
+ {"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../src/services/settings.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAG/C,OAAO,EAGL,KAAK,WAAW,EACjB,MAAM,qBAAqB,CAAC;AAE7B,MAAM,WAAW,eAAe;IAC9B,GAAG,CAAC,GAAG,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAC9C,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC1C,GAAG,CAAC,GAAG,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACpD,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACtE,MAAM,CAAC,GAAG,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxC,oBAAoB,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IACzC,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACrC;AAED,wBAAgB,qBAAqB,CAAC,EAAE,EAAE,QAAQ,GAAG,eAAe,CAiEnE"}
@@ -34,6 +34,9 @@ export function createSettingsService(db) {
34
34
  }
35
35
  });
36
36
  },
37
+ async remove (key) {
38
+ await db.delete(settings).where(eq(settings.key, key));
39
+ },
37
40
  async setMany (entries) {
38
41
  const timestamp = now();
39
42
  const keys = Object.keys(entries);
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Built-in Color Themes
3
+ *
4
+ * Each theme defines CSS variable overrides for light and dark modes,
5
+ * plus preview colors for the theme picker UI.
6
+ */
7
+ /**
8
+ * A color theme definition with light and dark mode CSS variable overrides.
9
+ */
10
+ export interface ColorTheme {
11
+ /** Stored in DB settings, e.g. "beach" */
12
+ id: string;
13
+ /** Display name, e.g. "Beach" */
14
+ name: string;
15
+ /** CSS variable overrides for :root (light mode) */
16
+ light: Record<string, string>;
17
+ /** CSS variable overrides for .dark (dark mode) */
18
+ dark: Record<string, string>;
19
+ /** Preview colors (hex) for theme picker cards */
20
+ preview: {
21
+ lightBg: string;
22
+ lightText: string;
23
+ lightLink: string;
24
+ darkBg: string;
25
+ darkText: string;
26
+ darkLink: string;
27
+ };
28
+ }
29
+ export declare const BUILTIN_COLOR_THEMES: ColorTheme[];
30
+ //# sourceMappingURL=color-themes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"color-themes.d.ts","sourceRoot":"","sources":["../../src/theme/color-themes.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,0CAA0C;IAC1C,EAAE,EAAE,MAAM,CAAC;IACX,iCAAiC;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,oDAAoD;IACpD,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,mDAAmD;IACnD,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,kDAAkD;IAClD,OAAO,EAAE;QACP,OAAO,EAAE,MAAM,CAAC;QAChB,SAAS,EAAE,MAAM,CAAC;QAClB,SAAS,EAAE,MAAM,CAAC;QAClB,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;CACH;AA2FD,eAAO,MAAM,oBAAoB,EAAE,UAAU,EAyM5C,CAAC"}
@@ -0,0 +1,268 @@
1
+ /**
2
+ * Built-in Color Themes
3
+ *
4
+ * Each theme defines CSS variable overrides for light and dark modes,
5
+ * plus preview colors for the theme picker UI.
6
+ */ /**
7
+ * A color theme definition with light and dark mode CSS variable overrides.
8
+ */ /**
9
+ * Create a comprehensive color theme from key colors.
10
+ * Derives card, popover, muted, secondary, accent, and sidebar variables.
11
+ */ function defineTheme(opts) {
12
+ const { light, dark } = opts;
13
+ return {
14
+ id: opts.id,
15
+ name: opts.name,
16
+ preview: opts.preview,
17
+ light: {
18
+ "--background": light.bg,
19
+ "--foreground": light.fg,
20
+ "--card": light.bg,
21
+ "--card-foreground": light.fg,
22
+ "--popover": light.bg,
23
+ "--popover-foreground": light.fg,
24
+ "--primary": light.primary,
25
+ "--primary-foreground": light.primaryFg,
26
+ "--secondary": light.muted,
27
+ "--secondary-foreground": light.fg,
28
+ "--muted": light.muted,
29
+ "--muted-foreground": light.mutedFg,
30
+ "--accent": light.muted,
31
+ "--accent-foreground": light.fg,
32
+ "--border": light.border,
33
+ "--input": light.border,
34
+ "--ring": light.primary,
35
+ "--sidebar": light.bg,
36
+ "--sidebar-foreground": light.fg,
37
+ "--sidebar-primary": light.primary,
38
+ "--sidebar-primary-foreground": light.primaryFg,
39
+ "--sidebar-accent": light.muted,
40
+ "--sidebar-accent-foreground": light.fg,
41
+ "--sidebar-border": light.border,
42
+ "--sidebar-ring": light.primary
43
+ },
44
+ dark: {
45
+ "--background": dark.bg,
46
+ "--foreground": dark.fg,
47
+ "--card": dark.bg,
48
+ "--card-foreground": dark.fg,
49
+ "--popover": dark.bg,
50
+ "--popover-foreground": dark.fg,
51
+ "--primary": dark.primary,
52
+ "--primary-foreground": dark.primaryFg,
53
+ "--secondary": dark.muted,
54
+ "--secondary-foreground": dark.fg,
55
+ "--muted": dark.muted,
56
+ "--muted-foreground": dark.mutedFg,
57
+ "--accent": dark.muted,
58
+ "--accent-foreground": dark.fg,
59
+ "--border": dark.border,
60
+ "--input": dark.border,
61
+ "--ring": dark.primary,
62
+ "--sidebar": dark.bg,
63
+ "--sidebar-foreground": dark.fg,
64
+ "--sidebar-primary": dark.primary,
65
+ "--sidebar-primary-foreground": dark.primaryFg,
66
+ "--sidebar-accent": dark.muted,
67
+ "--sidebar-accent-foreground": dark.fg,
68
+ "--sidebar-border": dark.border,
69
+ "--sidebar-ring": dark.primary
70
+ }
71
+ };
72
+ }
73
+ export const BUILTIN_COLOR_THEMES = [
74
+ {
75
+ id: "default",
76
+ name: "Default",
77
+ light: {},
78
+ dark: {},
79
+ preview: {
80
+ lightBg: "#ffffff",
81
+ lightText: "#1e1e1e",
82
+ lightLink: "#1e1e1e",
83
+ darkBg: "#262626",
84
+ darkText: "#fafafa",
85
+ darkLink: "#eaeaea"
86
+ }
87
+ },
88
+ defineTheme({
89
+ id: "beach",
90
+ name: "Beach",
91
+ preview: {
92
+ lightBg: "#f9f3ea",
93
+ lightText: "#3d3527",
94
+ lightLink: "#2d6a59",
95
+ darkBg: "#2d4553",
96
+ darkText: "#e2d6c4",
97
+ darkLink: "#7cc5a2"
98
+ },
99
+ light: {
100
+ bg: "oklch(0.97 0.01 85)",
101
+ fg: "oklch(0.28 0.02 65)",
102
+ primary: "oklch(0.46 0.1 170)",
103
+ primaryFg: "oklch(0.98 0.005 85)",
104
+ muted: "oklch(0.93 0.015 85)",
105
+ mutedFg: "oklch(0.52 0.015 65)",
106
+ border: "oklch(0.88 0.018 85)"
107
+ },
108
+ dark: {
109
+ bg: "oklch(0.27 0.03 210)",
110
+ fg: "oklch(0.88 0.015 80)",
111
+ primary: "oklch(0.72 0.1 165)",
112
+ primaryFg: "oklch(0.22 0.03 210)",
113
+ muted: "oklch(0.33 0.025 210)",
114
+ mutedFg: "oklch(0.65 0.015 80)",
115
+ border: "oklch(0.38 0.02 210)"
116
+ }
117
+ }),
118
+ defineTheme({
119
+ id: "gameboy",
120
+ name: "Gameboy",
121
+ preview: {
122
+ lightBg: "#d3d7c0",
123
+ lightText: "#2b3326",
124
+ lightLink: "#466740",
125
+ darkBg: "#1b1f18",
126
+ darkText: "#a6b09a",
127
+ darkLink: "#6d9660"
128
+ },
129
+ light: {
130
+ bg: "oklch(0.87 0.03 130)",
131
+ fg: "oklch(0.25 0.04 140)",
132
+ primary: "oklch(0.4 0.08 145)",
133
+ primaryFg: "oklch(0.92 0.02 130)",
134
+ muted: "oklch(0.83 0.035 130)",
135
+ mutedFg: "oklch(0.48 0.03 140)",
136
+ border: "oklch(0.79 0.035 130)"
137
+ },
138
+ dark: {
139
+ bg: "oklch(0.18 0.02 140)",
140
+ fg: "oklch(0.78 0.025 130)",
141
+ primary: "oklch(0.6 0.08 145)",
142
+ primaryFg: "oklch(0.15 0.02 140)",
143
+ muted: "oklch(0.24 0.02 140)",
144
+ mutedFg: "oklch(0.58 0.02 130)",
145
+ border: "oklch(0.3 0.02 140)"
146
+ }
147
+ }),
148
+ defineTheme({
149
+ id: "grayscale",
150
+ name: "Grayscale",
151
+ preview: {
152
+ lightBg: "#efefef",
153
+ lightText: "#3a3a3a",
154
+ lightLink: "#555555",
155
+ darkBg: "#1e1e1e",
156
+ darkText: "#c8c8c8",
157
+ darkLink: "#999999"
158
+ },
159
+ light: {
160
+ bg: "oklch(0.96 0 0)",
161
+ fg: "oklch(0.3 0 0)",
162
+ primary: "oklch(0.4 0 0)",
163
+ primaryFg: "oklch(0.96 0 0)",
164
+ muted: "oklch(0.92 0 0)",
165
+ mutedFg: "oklch(0.55 0 0)",
166
+ border: "oklch(0.87 0 0)"
167
+ },
168
+ dark: {
169
+ bg: "oklch(0.18 0 0)",
170
+ fg: "oklch(0.82 0 0)",
171
+ primary: "oklch(0.7 0 0)",
172
+ primaryFg: "oklch(0.18 0 0)",
173
+ muted: "oklch(0.24 0 0)",
174
+ mutedFg: "oklch(0.6 0 0)",
175
+ border: "oklch(0.3 0 0)"
176
+ }
177
+ }),
178
+ defineTheme({
179
+ id: "halloween",
180
+ name: "Halloween",
181
+ preview: {
182
+ lightBg: "#f9f2e3",
183
+ lightText: "#352200",
184
+ lightLink: "#cc5500",
185
+ darkBg: "#1e1000",
186
+ darkText: "#dfc390",
187
+ darkLink: "#ff8c00"
188
+ },
189
+ light: {
190
+ bg: "oklch(0.97 0.015 75)",
191
+ fg: "oklch(0.25 0.04 55)",
192
+ primary: "oklch(0.6 0.2 50)",
193
+ primaryFg: "oklch(0.98 0.01 75)",
194
+ muted: "oklch(0.93 0.02 75)",
195
+ mutedFg: "oklch(0.5 0.025 55)",
196
+ border: "oklch(0.88 0.025 75)"
197
+ },
198
+ dark: {
199
+ bg: "oklch(0.16 0.03 50)",
200
+ fg: "oklch(0.85 0.025 75)",
201
+ primary: "oklch(0.72 0.19 55)",
202
+ primaryFg: "oklch(0.14 0.03 50)",
203
+ muted: "oklch(0.22 0.025 50)",
204
+ mutedFg: "oklch(0.62 0.02 75)",
205
+ border: "oklch(0.28 0.025 50)"
206
+ }
207
+ }),
208
+ defineTheme({
209
+ id: "notepad",
210
+ name: "Notepad",
211
+ preview: {
212
+ lightBg: "#fdfce8",
213
+ lightText: "#333333",
214
+ lightLink: "#2060b8",
215
+ darkBg: "#2a291a",
216
+ darkText: "#d2d2b8",
217
+ darkLink: "#6695cc"
218
+ },
219
+ light: {
220
+ bg: "oklch(0.985 0.018 95)",
221
+ fg: "oklch(0.27 0 0)",
222
+ primary: "oklch(0.5 0.17 260)",
223
+ primaryFg: "oklch(0.985 0.01 95)",
224
+ muted: "oklch(0.94 0.022 95)",
225
+ mutedFg: "oklch(0.52 0 0)",
226
+ border: "oklch(0.88 0.025 95)"
227
+ },
228
+ dark: {
229
+ bg: "oklch(0.2 0.02 90)",
230
+ fg: "oklch(0.87 0.015 95)",
231
+ primary: "oklch(0.65 0.14 260)",
232
+ primaryFg: "oklch(0.98 0.01 95)",
233
+ muted: "oklch(0.26 0.018 90)",
234
+ mutedFg: "oklch(0.62 0.012 95)",
235
+ border: "oklch(0.32 0.018 90)"
236
+ }
237
+ }),
238
+ defineTheme({
239
+ id: "sonnet",
240
+ name: "Sonnet",
241
+ preview: {
242
+ lightBg: "#f7eef5",
243
+ lightText: "#2e1e2c",
244
+ lightLink: "#9845c8",
245
+ darkBg: "#1d1428",
246
+ darkText: "#d4c2d0",
247
+ darkLink: "#c080fc"
248
+ },
249
+ light: {
250
+ bg: "oklch(0.97 0.012 325)",
251
+ fg: "oklch(0.25 0.02 310)",
252
+ primary: "oklch(0.55 0.2 300)",
253
+ primaryFg: "oklch(0.98 0.008 325)",
254
+ muted: "oklch(0.93 0.016 325)",
255
+ mutedFg: "oklch(0.52 0.015 310)",
256
+ border: "oklch(0.88 0.016 325)"
257
+ },
258
+ dark: {
259
+ bg: "oklch(0.18 0.025 300)",
260
+ fg: "oklch(0.87 0.012 325)",
261
+ primary: "oklch(0.72 0.18 300)",
262
+ primaryFg: "oklch(0.98 0.008 325)",
263
+ muted: "oklch(0.24 0.022 300)",
264
+ mutedFg: "oklch(0.62 0.012 325)",
265
+ border: "oklch(0.3 0.022 300)"
266
+ }
267
+ })
268
+ ];
@@ -8,11 +8,16 @@
8
8
  */
9
9
  import type { FC, PropsWithChildren } from "hono/jsx";
10
10
  import type { Context } from "hono";
11
+ export interface ToastProps {
12
+ message: string;
13
+ type?: "success" | "error";
14
+ }
11
15
  export interface BaseLayoutProps {
12
16
  title: string;
13
17
  description?: string;
14
18
  lang?: string;
15
19
  c?: Context;
20
+ toast?: ToastProps;
16
21
  }
17
22
  export declare const BaseLayout: FC<PropsWithChildren<BaseLayoutProps>>;
18
23
  //# sourceMappingURL=BaseLayout.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"BaseLayout.d.ts","sourceRoot":"","sources":["../../../src/theme/layouts/BaseLayout.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AACtD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAIpC,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,CAAC,CAAC,EAAE,OAAO,CAAC;CACb;AAED,eAAO,MAAM,UAAU,EAAE,EAAE,CAAC,iBAAiB,CAAC,eAAe,CAAC,CA2B7D,CAAC"}
1
+ {"version":3,"file":"BaseLayout.d.ts","sourceRoot":"","sources":["../../../src/theme/layouts/BaseLayout.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AACtD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAIpC,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC;CAC5B;AAED,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,CAAC,CAAC,EAAE,OAAO,CAAC;IACZ,KAAK,CAAC,EAAE,UAAU,CAAC;CACpB;AAED,eAAO,MAAM,UAAU,EAAE,EAAE,CAAC,iBAAiB,CAAC,eAAe,CAAC,CAiF7D,CAAC"}
@@ -8,7 +8,7 @@
8
8
  */ import { jsx as _jsx, jsxs as _jsxs } 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, children })=>{
11
+ export const BaseLayout = ({ title, description, lang, c, toast, 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
14
  // Automatically wrap with I18nProvider if Context is provided
@@ -16,6 +16,8 @@ export const BaseLayout = ({ title, description, lang, c, children })=>{
16
16
  c: c,
17
17
  children: children
18
18
  }) : children;
19
+ // Read theme style from Hono context if available
20
+ const themeStyle = c ? c.get("themeStyle") : undefined;
19
21
  return /*#__PURE__*/ _jsxs("html", {
20
22
  lang: resolvedLang,
21
23
  children: [
@@ -40,14 +42,79 @@ export const BaseLayout = ({ title, description, lang, c, children })=>{
40
42
  href: "/src/style.css",
41
43
  rel: "stylesheet"
42
44
  }),
45
+ themeStyle && /*#__PURE__*/ _jsx("style", {
46
+ children: themeStyle
47
+ }),
43
48
  /*#__PURE__*/ _jsx(Script, {
44
49
  src: "/src/client.ts"
45
50
  })
46
51
  ]
47
52
  }),
48
- /*#__PURE__*/ _jsx("body", {
53
+ /*#__PURE__*/ _jsxs("body", {
49
54
  class: "bg-background text-foreground antialiased",
50
- children: content
55
+ children: [
56
+ content,
57
+ /*#__PURE__*/ _jsx("div", {
58
+ id: "toast-container",
59
+ class: "toast-container",
60
+ children: toast && /*#__PURE__*/ _jsxs("div", {
61
+ class: `toast ${toast.type === "error" ? "toast-error" : "toast-success"}`,
62
+ "data-init": "history.replaceState({}, '', location.pathname); setTimeout(() => { el.classList.add('toast-out'); el.addEventListener('animationend', () => el.remove()) }, 3000)",
63
+ children: [
64
+ toast.type === "error" ? /*#__PURE__*/ _jsxs("svg", {
65
+ xmlns: "http://www.w3.org/2000/svg",
66
+ fill: "none",
67
+ viewBox: "0 0 24 24",
68
+ "stroke-width": "2",
69
+ stroke: "currentColor",
70
+ children: [
71
+ /*#__PURE__*/ _jsx("circle", {
72
+ cx: "12",
73
+ cy: "12",
74
+ r: "10"
75
+ }),
76
+ /*#__PURE__*/ _jsx("path", {
77
+ d: "m15 9-6 6M9 9l6 6"
78
+ })
79
+ ]
80
+ }) : /*#__PURE__*/ _jsxs("svg", {
81
+ xmlns: "http://www.w3.org/2000/svg",
82
+ fill: "none",
83
+ viewBox: "0 0 24 24",
84
+ "stroke-width": "2",
85
+ stroke: "currentColor",
86
+ children: [
87
+ /*#__PURE__*/ _jsx("circle", {
88
+ cx: "12",
89
+ cy: "12",
90
+ r: "10"
91
+ }),
92
+ /*#__PURE__*/ _jsx("path", {
93
+ d: "m9 12 2 2 4-4"
94
+ })
95
+ ]
96
+ }),
97
+ /*#__PURE__*/ _jsx("span", {
98
+ children: toast.message
99
+ }),
100
+ /*#__PURE__*/ _jsx("button", {
101
+ class: "toast-close",
102
+ "data-on:click": "el.closest('.toast').classList.add('toast-out'); el.closest('.toast').addEventListener('animationend', () => el.closest('.toast').remove())",
103
+ children: /*#__PURE__*/ _jsx("svg", {
104
+ xmlns: "http://www.w3.org/2000/svg",
105
+ fill: "none",
106
+ viewBox: "0 0 24 24",
107
+ "stroke-width": "2",
108
+ stroke: "currentColor",
109
+ children: /*#__PURE__*/ _jsx("path", {
110
+ d: "M18 6 6 18M6 6l12 12"
111
+ })
112
+ })
113
+ })
114
+ ]
115
+ })
116
+ })
117
+ ]
51
118
  })
52
119
  ]
53
120
  });
@@ -5,11 +5,13 @@
5
5
  */
6
6
  import type { FC, PropsWithChildren } from "hono/jsx";
7
7
  import type { Context } from "hono";
8
+ import { type ToastProps } from "./BaseLayout.js";
8
9
  export interface DashLayoutProps {
9
10
  c: Context;
10
11
  title: string;
11
12
  siteName: string;
12
13
  currentPath?: string;
14
+ toast?: ToastProps;
13
15
  }
14
16
  export declare const DashLayout: FC<PropsWithChildren<DashLayoutProps>>;
15
17
  //# sourceMappingURL=DashLayout.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DashLayout.d.ts","sourceRoot":"","sources":["../../../src/theme/layouts/DashLayout.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AACtD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAIpC,MAAM,WAAW,eAAe;IAC9B,CAAC,EAAE,OAAO,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAkID,eAAO,MAAM,UAAU,EAAE,EAAE,CAAC,iBAAiB,CAAC,eAAe,CAAC,CAc7D,CAAC"}
1
+ {"version":3,"file":"DashLayout.d.ts","sourceRoot":"","sources":["../../../src/theme/layouts/DashLayout.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AACtD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAEpC,OAAO,EAAc,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE9D,MAAM,WAAW,eAAe;IAC9B,CAAC,EAAE,OAAO,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,UAAU,CAAC;CACpB;AA2ID,eAAO,MAAM,UAAU,EAAE,EAAE,CAAC,iBAAiB,CAAC,eAAe,CAAC,CAe7D,CAAC"}
@@ -113,6 +113,14 @@ function DashLayoutContent({ siteName, currentPath, children }) {
113
113
  id: "Tz0i8g",
114
114
  message: "Settings"
115
115
  })
116
+ }),
117
+ /*#__PURE__*/ _jsx("a", {
118
+ href: "/dash/appearance",
119
+ class: navClass("/dash/appearance", /^\/dash\/appearance/),
120
+ children: $__i18n._({
121
+ id: "aAIQg2",
122
+ message: "Appearance"
123
+ })
116
124
  })
117
125
  ]
118
126
  })
@@ -126,10 +134,11 @@ function DashLayoutContent({ siteName, currentPath, children }) {
126
134
  ]
127
135
  });
128
136
  }
129
- export const DashLayout = ({ c, title, siteName, currentPath, children })=>{
137
+ export const DashLayout = ({ c, title, siteName, currentPath, toast, children })=>{
130
138
  return /*#__PURE__*/ _jsx(BaseLayout, {
131
139
  title: `${title} - ${siteName}`,
132
140
  c: c,
141
+ toast: toast,
133
142
  children: /*#__PURE__*/ _jsx(DashLayoutContent, {
134
143
  siteName: siteName,
135
144
  currentPath: currentPath,
@@ -1,3 +1,3 @@
1
- export { BaseLayout, type BaseLayoutProps } from "./BaseLayout.js";
1
+ export { BaseLayout, type BaseLayoutProps, type ToastProps, } from "./BaseLayout.js";
2
2
  export { DashLayout, type DashLayoutProps } from "./DashLayout.js";
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/theme/layouts/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/theme/layouts/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,KAAK,eAAe,EACpB,KAAK,UAAU,GAChB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC"}