@jant/core 0.2.13 → 0.2.15

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.
package/dist/app.js CHANGED
@@ -253,17 +253,17 @@ import { sse } from "./lib/sse.js";
253
253
  const { siteName, name, email, password } = body;
254
254
  if (!siteName || !name || !email || !password) {
255
255
  return sse(c, async (stream)=>{
256
- await stream.patchElements('<div id="setup-message"><p class="text-destructive text-sm mb-4">All fields are required</p></div>');
256
+ await stream.patchElements('<div id="setup-message"><div class="alert-destructive mb-4"><h2>All fields are required</h2></div></div>');
257
257
  });
258
258
  }
259
259
  if (password.length < 8) {
260
260
  return sse(c, async (stream)=>{
261
- await stream.patchElements('<div id="setup-message"><p class="text-destructive text-sm mb-4">Password must be at least 8 characters</p></div>');
261
+ await stream.patchElements('<div id="setup-message"><div class="alert-destructive mb-4"><h2>Password must be at least 8 characters</h2></div></div>');
262
262
  });
263
263
  }
264
264
  if (!c.var.auth) {
265
265
  return sse(c, async (stream)=>{
266
- await stream.patchElements('<div id="setup-message"><p class="text-destructive text-sm mb-4">AUTH_SECRET not configured</p></div>');
266
+ await stream.patchElements('<div id="setup-message"><div class="alert-destructive mb-4"><h2>AUTH_SECRET not configured</h2></div></div>');
267
267
  });
268
268
  }
269
269
  try {
@@ -276,7 +276,7 @@ import { sse } from "./lib/sse.js";
276
276
  });
277
277
  if (!signUpResponse || "error" in signUpResponse) {
278
278
  return sse(c, async (stream)=>{
279
- await stream.patchElements('<div id="setup-message"><p class="text-destructive text-sm mb-4">Failed to create account</p></div>');
279
+ await stream.patchElements('<div id="setup-message"><div class="alert-destructive mb-4"><h2>Failed to create account</h2></div></div>');
280
280
  });
281
281
  }
282
282
  await c.var.services.settings.setMany({
@@ -291,7 +291,7 @@ import { sse } from "./lib/sse.js";
291
291
  // eslint-disable-next-line no-console -- Error logging is intentional
292
292
  console.error("Setup error:", err);
293
293
  return sse(c, async (stream)=>{
294
- await stream.patchElements('<div id="setup-message"><p class="text-destructive text-sm mb-4">Failed to create account</p></div>');
294
+ await stream.patchElements('<div id="setup-message"><div class="alert-destructive mb-4"><h2>Failed to create account</h2></div></div>');
295
295
  });
296
296
  }
297
297
  });
@@ -398,7 +398,7 @@ import { sse } from "./lib/sse.js";
398
398
  app.post("/signin", async (c)=>{
399
399
  if (!c.var.auth) {
400
400
  return sse(c, async (stream)=>{
401
- await stream.patchElements('<div id="signin-message"><p class="text-destructive text-sm mb-4">Auth not configured</p></div>');
401
+ await stream.patchElements('<div id="signin-message"><div class="alert-destructive mb-4"><h2>Auth not configured</h2></div></div>');
402
402
  });
403
403
  }
404
404
  const body = await c.req.json();
@@ -417,7 +417,7 @@ import { sse } from "./lib/sse.js";
417
417
  const response = await c.var.auth.handler(signInRequest);
418
418
  if (!response.ok) {
419
419
  return sse(c, async (stream)=>{
420
- await stream.patchElements('<div id="signin-message"><p class="text-destructive text-sm mb-4">Invalid email or password</p></div>');
420
+ await stream.patchElements('<div id="signin-message"><div class="alert-destructive mb-4"><h2>Invalid email or password</h2></div></div>');
421
421
  });
422
422
  }
423
423
  // Forward Set-Cookie headers from auth response
@@ -435,7 +435,7 @@ import { sse } from "./lib/sse.js";
435
435
  // eslint-disable-next-line no-console -- Error logging is intentional
436
436
  console.error("Signin error:", err);
437
437
  return sse(c, async (stream)=>{
438
- await stream.patchElements('<div id="signin-message"><p class="text-destructive text-sm mb-4">Invalid email or password</p></div>');
438
+ await stream.patchElements('<div id="signin-message"><div class="alert-destructive mb-4"><h2>Invalid email or password</h2></div></div>');
439
439
  });
440
440
  }
441
441
  });
@@ -24,11 +24,13 @@ function SettingsContent({ siteName, siteDescription, siteLanguage, saved }) {
24
24
  }),
25
25
  saved && /*#__PURE__*/ _jsx("div", {
26
26
  id: "settings-saved-toast",
27
- class: "mb-4 max-w-lg rounded-md border border-green-200 bg-green-50 p-3 text-sm text-green-800 transition-opacity duration-300 dark:border-green-800 dark:bg-green-950 dark:text-green-200",
27
+ class: "alert mb-4 max-w-lg transition-opacity duration-300",
28
28
  "data-init": `console.log('[toast] init fired at', Date.now()); history.replaceState({}, '', '/dash/settings'); setTimeout(() => { console.log('[toast] hiding at', Date.now()); const el = document.getElementById('settings-saved-toast'); if (el) { el.style.opacity = '0'; setTimeout(() => el.remove(), 300) } }, 3000)`,
29
- children: $__i18n._({
30
- id: "T0bsor",
31
- message: "Settings saved successfully."
29
+ children: /*#__PURE__*/ _jsx("h2", {
30
+ children: $__i18n._({
31
+ id: "T0bsor",
32
+ message: "Settings saved successfully."
33
+ })
32
34
  })
33
35
  }),
34
36
  /*#__PURE__*/ _jsxs("div", {
@@ -273,7 +275,7 @@ settingsRoutes.post("/", async (c)=>{
273
275
  await stream.redirect("/dash/settings?saved");
274
276
  } else {
275
277
  // No language change - show inline success message
276
- await stream.patchElements('<div id="settings-message"><div class="rounded-md border border-green-200 bg-green-50 p-3 text-sm text-green-800 dark:border-green-800 dark:bg-green-950 dark:text-green-200 mb-4 transition-opacity duration-300" data-init="setTimeout(() => { el.style.opacity = \'0\'; setTimeout(() => el.remove(), 300) }, 3000)">Settings saved successfully.</div></div>');
278
+ await stream.patchElements('<div id="settings-message"><div class="alert mb-4 transition-opacity duration-300" data-init="setTimeout(() => { el.style.opacity = \'0\'; setTimeout(() => el.remove(), 300) }, 3000)"><h2>Settings saved successfully.</h2></div></div>');
277
279
  }
278
280
  });
279
281
  });
@@ -282,7 +284,7 @@ settingsRoutes.post("/password", async (c)=>{
282
284
  const body = await c.req.json();
283
285
  if (body.newPassword !== body.confirmPassword) {
284
286
  return sse(c, async (stream)=>{
285
- await stream.patchElements('<div id="password-message"><div class="rounded-md border border-red-200 bg-red-50 p-3 text-sm text-red-800 dark:border-red-800 dark:bg-red-950 dark:text-red-200 mb-4">Passwords do not match.</div></div>');
287
+ await stream.patchElements('<div id="password-message"><div class="alert-destructive mb-4"><h2>Passwords do not match.</h2></div></div>');
286
288
  });
287
289
  }
288
290
  try {
@@ -296,11 +298,11 @@ settingsRoutes.post("/password", async (c)=>{
296
298
  });
297
299
  } catch {
298
300
  return sse(c, async (stream)=>{
299
- await stream.patchElements('<div id="password-message"><div class="rounded-md border border-red-200 bg-red-50 p-3 text-sm text-red-800 dark:border-red-800 dark:bg-red-950 dark:text-red-200 mb-4">Current password is incorrect.</div></div>');
301
+ await stream.patchElements('<div id="password-message"><div class="alert-destructive mb-4"><h2>Current password is incorrect.</h2></div></div>');
300
302
  });
301
303
  }
302
304
  return sse(c, async (stream)=>{
303
- await stream.patchElements('<div id="password-message"><div class="rounded-md border border-green-200 bg-green-50 p-3 text-sm text-green-800 dark:border-green-800 dark:bg-green-950 dark:text-green-200 mb-4">Password changed successfully.</div></div>');
305
+ await stream.patchElements('<div id="password-message"><div class="alert mb-4"><h2>Password changed successfully.</h2></div></div>');
304
306
  await stream.patchSignals({
305
307
  currentPassword: "",
306
308
  newPassword: "",
@@ -52,8 +52,10 @@ function SearchContent({ query, results, error, hasMore, page }) {
52
52
  })
53
53
  }),
54
54
  error && /*#__PURE__*/ _jsx("div", {
55
- class: "p-4 rounded-lg bg-destructive/10 text-destructive mb-6",
56
- children: error
55
+ class: "alert-destructive mb-6",
56
+ children: /*#__PURE__*/ _jsx("h2", {
57
+ children: error
58
+ })
57
59
  }),
58
60
  query && !error && /*#__PURE__*/ _jsxs("div", {
59
61
  children: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jant/core",
3
- "version": "0.2.13",
3
+ "version": "0.2.15",
4
4
  "description": "A modern, open-source microblogging platform built on Cloudflare Workers",
5
5
  "type": "module",
6
6
  "bin": {
@@ -33,16 +33,17 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "@lingui/core": "^5.9.0",
36
+ "basecoat-css": "^0.3.10",
36
37
  "better-auth": "^1.4.18",
37
38
  "drizzle-orm": "^0.45.1",
38
39
  "hono": "^4.11.7",
39
40
  "marked": "^17.0.1",
40
41
  "sqids": "^0.3.0",
41
42
  "uuidv7": "^1.1.0",
43
+ "vite-ssr-components": "^0.5.2",
42
44
  "zod": "^4.3.6"
43
45
  },
44
46
  "peerDependencies": {
45
- "basecoat-css": "^0.3.0",
46
47
  "tailwindcss": "^4.0.0"
47
48
  },
48
49
  "devDependencies": {
@@ -53,7 +54,6 @@
53
54
  "@swc/cli": "^0.6.0",
54
55
  "@swc/core": "^1.15.11",
55
56
  "@types/node": "^25.1.0",
56
- "basecoat-css": "^0.3.10",
57
57
  "drizzle-kit": "^0.31.8",
58
58
  "glob": "^13.0.0",
59
59
  "tailwindcss": "^4.1.18",
package/src/app.tsx CHANGED
@@ -270,7 +270,7 @@ export function createApp(config: JantConfig = {}): App {
270
270
  if (!siteName || !name || !email || !password) {
271
271
  return sse(c, async (stream) => {
272
272
  await stream.patchElements(
273
- '<div id="setup-message"><p class="text-destructive text-sm mb-4">All fields are required</p></div>',
273
+ '<div id="setup-message"><div class="alert-destructive mb-4"><h2>All fields are required</h2></div></div>',
274
274
  );
275
275
  });
276
276
  }
@@ -278,7 +278,7 @@ export function createApp(config: JantConfig = {}): App {
278
278
  if (password.length < 8) {
279
279
  return sse(c, async (stream) => {
280
280
  await stream.patchElements(
281
- '<div id="setup-message"><p class="text-destructive text-sm mb-4">Password must be at least 8 characters</p></div>',
281
+ '<div id="setup-message"><div class="alert-destructive mb-4"><h2>Password must be at least 8 characters</h2></div></div>',
282
282
  );
283
283
  });
284
284
  }
@@ -286,7 +286,7 @@ export function createApp(config: JantConfig = {}): App {
286
286
  if (!c.var.auth) {
287
287
  return sse(c, async (stream) => {
288
288
  await stream.patchElements(
289
- '<div id="setup-message"><p class="text-destructive text-sm mb-4">AUTH_SECRET not configured</p></div>',
289
+ '<div id="setup-message"><div class="alert-destructive mb-4"><h2>AUTH_SECRET not configured</h2></div></div>',
290
290
  );
291
291
  });
292
292
  }
@@ -299,7 +299,7 @@ export function createApp(config: JantConfig = {}): App {
299
299
  if (!signUpResponse || "error" in signUpResponse) {
300
300
  return sse(c, async (stream) => {
301
301
  await stream.patchElements(
302
- '<div id="setup-message"><p class="text-destructive text-sm mb-4">Failed to create account</p></div>',
302
+ '<div id="setup-message"><div class="alert-destructive mb-4"><h2>Failed to create account</h2></div></div>',
303
303
  );
304
304
  });
305
305
  }
@@ -318,7 +318,7 @@ export function createApp(config: JantConfig = {}): App {
318
318
  console.error("Setup error:", err);
319
319
  return sse(c, async (stream) => {
320
320
  await stream.patchElements(
321
- '<div id="setup-message"><p class="text-destructive text-sm mb-4">Failed to create account</p></div>',
321
+ '<div id="setup-message"><div class="alert-destructive mb-4"><h2>Failed to create account</h2></div></div>',
322
322
  );
323
323
  });
324
324
  }
@@ -414,7 +414,7 @@ export function createApp(config: JantConfig = {}): App {
414
414
  if (!c.var.auth) {
415
415
  return sse(c, async (stream) => {
416
416
  await stream.patchElements(
417
- '<div id="signin-message"><p class="text-destructive text-sm mb-4">Auth not configured</p></div>',
417
+ '<div id="signin-message"><div class="alert-destructive mb-4"><h2>Auth not configured</h2></div></div>',
418
418
  );
419
419
  });
420
420
  }
@@ -437,7 +437,7 @@ export function createApp(config: JantConfig = {}): App {
437
437
  if (!response.ok) {
438
438
  return sse(c, async (stream) => {
439
439
  await stream.patchElements(
440
- '<div id="signin-message"><p class="text-destructive text-sm mb-4">Invalid email or password</p></div>',
440
+ '<div id="signin-message"><div class="alert-destructive mb-4"><h2>Invalid email or password</h2></div></div>',
441
441
  );
442
442
  });
443
443
  }
@@ -461,7 +461,7 @@ export function createApp(config: JantConfig = {}): App {
461
461
  console.error("Signin error:", err);
462
462
  return sse(c, async (stream) => {
463
463
  await stream.patchElements(
464
- '<div id="signin-message"><p class="text-destructive text-sm mb-4">Invalid email or password</p></div>',
464
+ '<div id="signin-message"><div class="alert-destructive mb-4"><h2>Invalid email or password</h2></div></div>',
465
465
  );
466
466
  });
467
467
  }
@@ -41,13 +41,15 @@ function SettingsContent({
41
41
  {saved && (
42
42
  <div
43
43
  id="settings-saved-toast"
44
- class="mb-4 max-w-lg rounded-md border border-green-200 bg-green-50 p-3 text-sm text-green-800 transition-opacity duration-300 dark:border-green-800 dark:bg-green-950 dark:text-green-200"
44
+ class="alert mb-4 max-w-lg transition-opacity duration-300"
45
45
  data-init={`console.log('[toast] init fired at', Date.now()); history.replaceState({}, '', '/dash/settings'); setTimeout(() => { console.log('[toast] hiding at', Date.now()); const el = document.getElementById('settings-saved-toast'); if (el) { el.style.opacity = '0'; setTimeout(() => el.remove(), 300) } }, 3000)`}
46
46
  >
47
- {t({
48
- message: "Settings saved successfully.",
49
- comment: "@context: Toast message after saving settings",
50
- })}
47
+ <h2>
48
+ {t({
49
+ message: "Settings saved successfully.",
50
+ comment: "@context: Toast message after saving settings",
51
+ })}
52
+ </h2>
51
53
  </div>
52
54
  )}
53
55
 
@@ -254,7 +256,7 @@ settingsRoutes.post("/", async (c) => {
254
256
  } else {
255
257
  // No language change - show inline success message
256
258
  await stream.patchElements(
257
- '<div id="settings-message"><div class="rounded-md border border-green-200 bg-green-50 p-3 text-sm text-green-800 dark:border-green-800 dark:bg-green-950 dark:text-green-200 mb-4 transition-opacity duration-300" data-init="setTimeout(() => { el.style.opacity = \'0\'; setTimeout(() => el.remove(), 300) }, 3000)">Settings saved successfully.</div></div>',
259
+ '<div id="settings-message"><div class="alert mb-4 transition-opacity duration-300" data-init="setTimeout(() => { el.style.opacity = \'0\'; setTimeout(() => el.remove(), 300) }, 3000)"><h2>Settings saved successfully.</h2></div></div>',
258
260
  );
259
261
  }
260
262
  });
@@ -271,7 +273,7 @@ settingsRoutes.post("/password", async (c) => {
271
273
  if (body.newPassword !== body.confirmPassword) {
272
274
  return sse(c, async (stream) => {
273
275
  await stream.patchElements(
274
- '<div id="password-message"><div class="rounded-md border border-red-200 bg-red-50 p-3 text-sm text-red-800 dark:border-red-800 dark:bg-red-950 dark:text-red-200 mb-4">Passwords do not match.</div></div>',
276
+ '<div id="password-message"><div class="alert-destructive mb-4"><h2>Passwords do not match.</h2></div></div>',
275
277
  );
276
278
  });
277
279
  }
@@ -288,14 +290,14 @@ settingsRoutes.post("/password", async (c) => {
288
290
  } catch {
289
291
  return sse(c, async (stream) => {
290
292
  await stream.patchElements(
291
- '<div id="password-message"><div class="rounded-md border border-red-200 bg-red-50 p-3 text-sm text-red-800 dark:border-red-800 dark:bg-red-950 dark:text-red-200 mb-4">Current password is incorrect.</div></div>',
293
+ '<div id="password-message"><div class="alert-destructive mb-4"><h2>Current password is incorrect.</h2></div></div>',
292
294
  );
293
295
  });
294
296
  }
295
297
 
296
298
  return sse(c, async (stream) => {
297
299
  await stream.patchElements(
298
- '<div id="password-message"><div class="rounded-md border border-green-200 bg-green-50 p-3 text-sm text-green-800 dark:border-green-800 dark:bg-green-950 dark:text-green-200 mb-4">Password changed successfully.</div></div>',
300
+ '<div id="password-message"><div class="alert mb-4"><h2>Password changed successfully.</h2></div></div>',
299
301
  );
300
302
  await stream.patchSignals({
301
303
  currentPassword: "",
@@ -66,8 +66,8 @@ function SearchContent({
66
66
 
67
67
  {/* Error */}
68
68
  {error && (
69
- <div class="p-4 rounded-lg bg-destructive/10 text-destructive mb-6">
70
- {error}
69
+ <div class="alert-destructive mb-6">
70
+ <h2>{error}</h2>
71
71
  </div>
72
72
  )}
73
73