@jant/core 0.2.13 → 0.2.14
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 +8 -8
- package/dist/routes/dash/settings.js +10 -8
- package/dist/routes/pages/search.js +4 -2
- package/package.json +1 -1
- package/src/app.tsx +8 -8
- package/src/routes/dash/settings.tsx +11 -9
- package/src/routes/pages/search.tsx +2 -2
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"><
|
|
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"><
|
|
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"><
|
|
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"><
|
|
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"><
|
|
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"><
|
|
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"><
|
|
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"><
|
|
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
|
|
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:
|
|
30
|
-
|
|
31
|
-
|
|
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="
|
|
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="
|
|
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="
|
|
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="
|
|
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: "
|
|
56
|
-
children:
|
|
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
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"><
|
|
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"><
|
|
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"><
|
|
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"><
|
|
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"><
|
|
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"><
|
|
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"><
|
|
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"><
|
|
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
|
|
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
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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="
|
|
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="
|
|
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="
|
|
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="
|
|
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: "",
|