@seip/bluebird-js 0.1.5 → 0.1.7
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/.vscode/extensions.json +7 -7
- package/.vscode/settings.json +10 -10
- package/AGENTS.md +620 -495
- package/README.md +607 -528
- package/app/routes/web.js +47 -47
- package/app/views/components/Header.jsx +42 -42
- package/app/views/components/LiveCounter.jsx +22 -21
- package/app/views/layouts/main/view.jsx +201 -201
- package/app/views/{dashboard.jsx → pages/dashboard.jsx} +278 -300
- package/app/views/{index.jsx → pages/index.jsx} +123 -123
- package/app/views/{login.jsx → pages/login.jsx} +141 -141
- package/core/actions.d.ts +1 -1
- package/core/actions.js +355 -329
- package/core/ai.d.ts +151 -0
- package/core/ai.js +1051 -0
- package/core/app.js +11 -1
- package/core/cli/backup.js +167 -0
- package/core/cli/init.js +14 -5
- package/core/cli/view.js +161 -161
- package/core/database.js +460 -0
- package/core/index.d.ts +1470 -1385
- package/core/jsx.d.ts +38 -38
- package/core/jsx.js +1597 -1432
- package/core/render.js +736 -728
- package/core/view-loader.js +613 -529
- package/package.json +1 -1
- package/public/js/bluebird-client.js +3264 -3160
- /package/app/views/{about.jsx → pages/about.jsx} +0 -0
package/app/routes/web.js
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
import Router from "@seip/bluebird-js/core/router.js";
|
|
2
|
-
import Render from "@seip/bluebird-js/core/render.js";
|
|
3
|
-
import Auth from "@seip/bluebird-js/core/auth.js";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Web Router for custom actions and static HTML files.
|
|
7
|
-
* Page GET routes (`/`, `/about`, `/login`, `/dashboard`) are automatically
|
|
8
|
-
* generated from `app/views/*.jsx` via declarative exports (`route`, `cache`, `middlewares`, `layout`, `seo`).
|
|
9
|
-
*/
|
|
10
|
-
const routerWeb = new Router("/", { seo: true });
|
|
11
|
-
|
|
12
|
-
routerWeb.get("/terms", (req, res) => Render.html(res, "legal/terms.html", { ttl: 86400 }));
|
|
13
|
-
|
|
14
|
-
routerWeb.post("/login", async (req, res) => {
|
|
15
|
-
const email = req.body?.email || "alex@example.com";
|
|
16
|
-
const rawPrefix = email.split("@")[0] || "alex";
|
|
17
|
-
const name = req.body?.name || (rawPrefix.charAt(0).toUpperCase() + rawPrefix.slice(1));
|
|
18
|
-
|
|
19
|
-
const user = {
|
|
20
|
-
id: 1,
|
|
21
|
-
name,
|
|
22
|
-
email,
|
|
23
|
-
role: "admin",
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
await Auth.login(res, user);
|
|
27
|
-
return res.redirect("/dashboard");
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
routerWeb.get("/logout", async (req, res) => {
|
|
31
|
-
if (
|
|
32
|
-
req.headers["x-bluebird-prefetch"] ||
|
|
33
|
-
req.headers.purpose === "prefetch" ||
|
|
34
|
-
req.headers["sec-purpose"] === "prefetch"
|
|
35
|
-
) {
|
|
36
|
-
return res.status(204).end();
|
|
37
|
-
}
|
|
38
|
-
await Auth.logout(res);
|
|
39
|
-
return res.redirect("/login");
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
routerWeb.post("/logout", async (req, res) => {
|
|
43
|
-
await Auth.logout(res);
|
|
44
|
-
return res.redirect("/login");
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
export default routerWeb;
|
|
1
|
+
import Router from "@seip/bluebird-js/core/router.js";
|
|
2
|
+
import Render from "@seip/bluebird-js/core/render.js";
|
|
3
|
+
import Auth from "@seip/bluebird-js/core/auth.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Web Router for custom actions and static HTML files.
|
|
7
|
+
* Page GET routes (`/`, `/about`, `/login`, `/dashboard`) are automatically
|
|
8
|
+
* generated from `app/views/*.jsx` via declarative exports (`route`, `cache`, `middlewares`, `layout`, `seo`).
|
|
9
|
+
*/
|
|
10
|
+
const routerWeb = new Router("/", { seo: true });
|
|
11
|
+
|
|
12
|
+
routerWeb.get("/terms", (req, res) => Render.html(res, "legal/terms.html", { ttl: 86400 }));
|
|
13
|
+
|
|
14
|
+
routerWeb.post("/login", async (req, res) => {
|
|
15
|
+
const email = req.body?.email || "alex@example.com";
|
|
16
|
+
const rawPrefix = email.split("@")[0] || "alex";
|
|
17
|
+
const name = req.body?.name || (rawPrefix.charAt(0).toUpperCase() + rawPrefix.slice(1));
|
|
18
|
+
|
|
19
|
+
const user = {
|
|
20
|
+
id: 1,
|
|
21
|
+
name,
|
|
22
|
+
email,
|
|
23
|
+
role: "admin",
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
await Auth.login(res, user);
|
|
27
|
+
return res.redirect("/dashboard");
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
routerWeb.get("/logout", async (req, res) => {
|
|
31
|
+
if (
|
|
32
|
+
req.headers["x-bluebird-prefetch"] ||
|
|
33
|
+
req.headers.purpose === "prefetch" ||
|
|
34
|
+
req.headers["sec-purpose"] === "prefetch"
|
|
35
|
+
) {
|
|
36
|
+
return res.status(204).end();
|
|
37
|
+
}
|
|
38
|
+
await Auth.logout(res);
|
|
39
|
+
return res.redirect("/login");
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
routerWeb.post("/logout", async (req, res) => {
|
|
43
|
+
await Auth.logout(res);
|
|
44
|
+
return res.redirect("/login");
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
export default routerWeb;
|
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Reusable Header component for dashboard and application views in React JSX.
|
|
3
|
-
*
|
|
4
|
-
* @param {Object} [props={}]
|
|
5
|
-
* @param {string} [props.title]
|
|
6
|
-
* @param {string} [props.subtitle]
|
|
7
|
-
* @param {number} [props.count]
|
|
8
|
-
* @param {Object} [props.user]
|
|
9
|
-
* @param {Object} [props.props]
|
|
10
|
-
*/
|
|
11
|
-
export default function Header(props = {}) {
|
|
12
|
-
const actualProps = props.props || props;
|
|
13
|
-
const title = actualProps.title || "Dashboard Overview";
|
|
14
|
-
const subtitle =
|
|
15
|
-
actualProps.subtitle || "Welcome to your high-performance Bluebird.js control center.";
|
|
16
|
-
const count = actualProps.count !== undefined ? actualProps.count : 0;
|
|
17
|
-
const userName = actualProps.user?.name || "Member";
|
|
18
|
-
|
|
19
|
-
return (
|
|
20
|
-
<header className="flex flex-col md:flex-row md:items-center justify-between gap-4 pb-6 mb-8 border-b border-slate-800">
|
|
21
|
-
<div>
|
|
22
|
-
<div className="flex items-center gap-3">
|
|
23
|
-
<h1 className="text-2xl md:text-3xl font-bold tracking-tight text-slate-100">{title}</h1>
|
|
24
|
-
<span className="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-sky-500/10 text-sky-400 border border-sky-500/20">
|
|
25
|
-
Active: <span id="header-counter-badge" className="ml-1 font-semibold">{count}</span>
|
|
26
|
-
</span>
|
|
27
|
-
</div>
|
|
28
|
-
<p className="text-sm text-slate-400 mt-1">{subtitle}</p>
|
|
29
|
-
</div>
|
|
30
|
-
<div className="flex items-center gap-3">
|
|
31
|
-
<div className="text-right hidden sm:block">
|
|
32
|
-
<div className="text-xs text-slate-400">Logged in as</div>
|
|
33
|
-
<div className="text-sm font-semibold text-slate-200">{userName}</div>
|
|
34
|
-
</div>
|
|
35
|
-
<div className="w-10 h-10 rounded-full bg-gradient-to-br from-sky-400 to-indigo-600 flex items-center justify-center text-slate-950 font-bold text-sm shadow-md">
|
|
36
|
-
{userName.slice(0, 1).toUpperCase()}
|
|
37
|
-
</div>
|
|
38
|
-
</div>
|
|
39
|
-
</header>
|
|
40
|
-
);
|
|
41
|
-
}
|
|
42
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Reusable Header component for dashboard and application views in React JSX.
|
|
3
|
+
*
|
|
4
|
+
* @param {Object} [props={}]
|
|
5
|
+
* @param {string} [props.title]
|
|
6
|
+
* @param {string} [props.subtitle]
|
|
7
|
+
* @param {number} [props.count]
|
|
8
|
+
* @param {Object} [props.user]
|
|
9
|
+
* @param {Object} [props.props]
|
|
10
|
+
*/
|
|
11
|
+
export default function Header(props = {}) {
|
|
12
|
+
const actualProps = props.props || props;
|
|
13
|
+
const title = actualProps.title || "Dashboard Overview";
|
|
14
|
+
const subtitle =
|
|
15
|
+
actualProps.subtitle || "Welcome to your high-performance Bluebird.js control center.";
|
|
16
|
+
const count = actualProps.count !== undefined ? actualProps.count : 0;
|
|
17
|
+
const userName = actualProps.user?.name || "Member";
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<header className="flex flex-col md:flex-row md:items-center justify-between gap-4 pb-6 mb-8 border-b border-slate-800">
|
|
21
|
+
<div>
|
|
22
|
+
<div className="flex items-center gap-3">
|
|
23
|
+
<h1 className="text-2xl md:text-3xl font-bold tracking-tight text-slate-100">{title}</h1>
|
|
24
|
+
<span className="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-sky-500/10 text-sky-400 border border-sky-500/20">
|
|
25
|
+
Active: <span id="header-counter-badge" className="ml-1 font-semibold">{count}</span>
|
|
26
|
+
</span>
|
|
27
|
+
</div>
|
|
28
|
+
<p className="text-sm text-slate-400 mt-1">{subtitle}</p>
|
|
29
|
+
</div>
|
|
30
|
+
<div className="flex items-center gap-3">
|
|
31
|
+
<div className="text-right hidden sm:block">
|
|
32
|
+
<div className="text-xs text-slate-400">Logged in as</div>
|
|
33
|
+
<div className="text-sm font-semibold text-slate-200">{userName}</div>
|
|
34
|
+
</div>
|
|
35
|
+
<div className="w-10 h-10 rounded-full bg-gradient-to-br from-sky-400 to-indigo-600 flex items-center justify-center text-slate-950 font-bold text-sm shadow-md">
|
|
36
|
+
{userName.slice(0, 1).toUpperCase()}
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
</header>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { useState, useEffect, useAction } from "@seip/bluebird-js/core/jsx.js";
|
|
2
|
-
import { html } from "@seip/bluebird-js/core/html.js";
|
|
1
|
+
import { useState, useEffect, useAction, client } from "@seip/bluebird-js/core/jsx.js";
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
|
-
* Reusable reactive Client Counter component
|
|
6
|
-
* Powered by Bluebird's zero-build client runtime with hooks (useState, useEffect, useAction
|
|
4
|
+
* Reusable reactive Client Counter component with pure JSX/TSX support.
|
|
5
|
+
* Powered by Bluebird's zero-build client runtime with hooks (useState, useEffect, useAction) and real JSX.
|
|
7
6
|
*
|
|
8
7
|
* @param {Object} props
|
|
9
8
|
* @param {number} [props.initial=7]
|
|
10
9
|
* @param {string} [props.label="Client Component Counter"]
|
|
11
10
|
* @returns {any}
|
|
12
11
|
*/
|
|
13
|
-
|
|
12
|
+
|
|
13
|
+
export function LiveCounter({ initial = 7, label = "Client Component Counter" }) {
|
|
14
14
|
const [count, setCount] = useState(Number(initial) || 0);
|
|
15
15
|
const [sync, isPending] = useAction("syncCount", {
|
|
16
16
|
onSuccess(res) {
|
|
@@ -29,38 +29,39 @@ export default function LiveCounter({ initial = 7, label = "Client Component Cou
|
|
|
29
29
|
if (badge) badge.textContent = String(count);
|
|
30
30
|
}, [count]);
|
|
31
31
|
|
|
32
|
-
return
|
|
33
|
-
<div
|
|
34
|
-
<div
|
|
35
|
-
<span
|
|
36
|
-
<span
|
|
37
|
-
<strong data-counter-val
|
|
32
|
+
return (
|
|
33
|
+
<div className="h-14 rounded-xl border border-slate-800 bg-slate-950/90 px-4 flex items-center justify-between">
|
|
34
|
+
<div className="flex items-center gap-2.5">
|
|
35
|
+
<span className={`w-2 h-2 rounded-full ${isPending ? "bg-amber-400" : "bg-emerald-400"} animate-pulse`} />
|
|
36
|
+
<span className="text-xs font-medium text-slate-300">{label}:</span>
|
|
37
|
+
<strong data-counter-val className="font-mono text-base text-sky-400">{count}</strong>
|
|
38
38
|
</div>
|
|
39
|
-
<div
|
|
39
|
+
<div className="flex items-center gap-2">
|
|
40
40
|
<button
|
|
41
41
|
type="button"
|
|
42
|
-
onClick
|
|
43
|
-
|
|
42
|
+
onClick={() => setCount(Math.max(0, count - 1))}
|
|
43
|
+
className="px-2.5 py-1 rounded-lg border border-slate-700 bg-slate-800 hover:bg-slate-700 text-xs font-semibold text-slate-200 transition-colors"
|
|
44
44
|
>
|
|
45
45
|
−
|
|
46
46
|
</button>
|
|
47
47
|
<button
|
|
48
48
|
type="button"
|
|
49
|
-
onClick
|
|
50
|
-
|
|
49
|
+
onClick={() => setCount(count + 1)}
|
|
50
|
+
className="px-2.5 py-1 rounded-lg bg-sky-500 hover:bg-sky-400 text-xs font-bold text-slate-950 transition-colors"
|
|
51
51
|
>
|
|
52
52
|
+
|
|
53
53
|
</button>
|
|
54
54
|
<button
|
|
55
55
|
type="button"
|
|
56
|
-
onClick
|
|
57
|
-
disabled
|
|
58
|
-
|
|
56
|
+
onClick={() => sync({ count })}
|
|
57
|
+
disabled={isPending}
|
|
58
|
+
className="px-2.5 py-1 rounded-lg border border-emerald-500/30 bg-emerald-500/15 hover:bg-emerald-500/25 text-xs font-semibold text-emerald-300 transition-colors disabled:opacity-50"
|
|
59
59
|
>
|
|
60
|
-
|
|
60
|
+
{isPending ? "Syncing..." : "Sync Action"}
|
|
61
61
|
</button>
|
|
62
62
|
</div>
|
|
63
63
|
</div>
|
|
64
|
-
|
|
64
|
+
);
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
+
export default client(LiveCounter, { minHeight: 56 });
|