@seip/bluebird-js 0.1.7 → 0.2.0

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 (148) hide show
  1. package/AGENTS.md +726 -620
  2. package/README.md +615 -607
  3. package/app/models/user.js +19 -0
  4. package/app/resources/html/home.html +137 -0
  5. package/app/resources/html/layouts/main.html +54 -0
  6. package/app/resources/html/notFound.html +14 -0
  7. package/app/resources/html/terms.html +46 -0
  8. package/app/resources/index.html +27 -0
  9. package/app/resources/layouts/AppLayout.jsx +89 -0
  10. package/app/resources/main.jsx +18 -0
  11. package/app/resources/pages/Dashboard.jsx +98 -0
  12. package/app/resources/pages/Home.jsx +140 -0
  13. package/app/resources/pages/Login.jsx +35 -0
  14. package/app/resources/pages/NotFound.jsx +16 -0
  15. package/app/resources/pages/Register.jsx +55 -0
  16. package/app/resources/routes.jsx +54 -0
  17. package/app/resources/spa.js +67 -0
  18. package/app/resources/styles.css +9 -0
  19. package/app/routes/api.js +85 -50
  20. package/app/routes/auth.js +209 -0
  21. package/app/routes/web.js +59 -47
  22. package/core/ai.js +30 -10
  23. package/core/app.d.ts +2 -18
  24. package/core/app.js +987 -801
  25. package/core/auth.d.ts +2 -13
  26. package/core/auth.js +444 -326
  27. package/core/cli/build.js +37 -0
  28. package/core/cli/dev.js +155 -0
  29. package/core/cli/doctor.js +37 -2
  30. package/core/cli/export.js +191 -0
  31. package/core/cli/init.js +91 -322
  32. package/core/cli/nginx.js +1 -1
  33. package/core/cli/templates.js +139 -0
  34. package/core/cli/view.js +98 -161
  35. package/core/config.js +44 -2
  36. package/core/csrf.js +156 -24
  37. package/core/database.js +1184 -1131
  38. package/core/debug.js +1 -1
  39. package/core/html.js +8 -1
  40. package/core/index.d.ts +126 -310
  41. package/core/paths.js +55 -0
  42. package/core/ratelimit.js +10 -1
  43. package/core/react/client/api.js +237 -0
  44. package/core/react/client/auth.js +236 -0
  45. package/core/react/client/components.js +1321 -0
  46. package/core/react/client/i18n.js +338 -0
  47. package/core/react/client/index.d.ts +249 -0
  48. package/core/react/client/index.js +49 -0
  49. package/core/react/client/router.js +26 -0
  50. package/core/react/client/theme.css +512 -0
  51. package/core/render-cache.js +250 -212
  52. package/core/render.d.ts +25 -21
  53. package/core/render.js +738 -736
  54. package/core/router.d.ts +2 -3
  55. package/core/router.js +171 -171
  56. package/core/seo.js +10 -0
  57. package/core/spa.js +599 -0
  58. package/core/view-loader.js +155 -613
  59. package/core/vite-plugin.d.ts +18 -0
  60. package/core/vite-plugin.js +162 -0
  61. package/core/vite.js +250 -145
  62. package/index.js +22 -18
  63. package/jsconfig.json +5 -3
  64. package/package.json +114 -92
  65. package/production.md +8 -3
  66. package/public/js/bluebird.js +1160 -0
  67. package/templates/_auth/app/database.js +19 -0
  68. package/templates/_auth/app/models/user.js +22 -0
  69. package/templates/_auth/app/routes/auth-router.js +304 -0
  70. package/templates/_base/app/resources/html/layouts/main.html +55 -0
  71. package/templates/_base/app/resources/html/notFound.html +14 -0
  72. package/templates/_base/app/resources/index.html +27 -0
  73. package/templates/_base/app/resources/styles.css +9 -0
  74. package/templates/api/app/models/note.js +18 -0
  75. package/templates/api/app/routes/api.js +82 -0
  76. package/templates/api/app/routes/auth.js +11 -0
  77. package/templates/api/index.js +19 -0
  78. package/templates/api/template.json +13 -0
  79. package/templates/auth/app/mail.js +11 -0
  80. package/templates/auth/app/models/password_reset.js +18 -0
  81. package/templates/auth/app/resources/html/home.html +21 -0
  82. package/templates/auth/app/resources/html/partials/nav.html +2 -0
  83. package/templates/auth/app/resources/layouts/AppLayout.jsx +60 -0
  84. package/templates/auth/app/resources/main.jsx +18 -0
  85. package/templates/auth/app/resources/pages/Dashboard.jsx +51 -0
  86. package/templates/auth/app/resources/pages/ForgotPassword.jsx +34 -0
  87. package/templates/auth/app/resources/pages/Login.jsx +36 -0
  88. package/templates/auth/app/resources/pages/NotFound.jsx +16 -0
  89. package/templates/auth/app/resources/pages/Profile.jsx +99 -0
  90. package/templates/auth/app/resources/pages/Register.jsx +50 -0
  91. package/templates/auth/app/resources/pages/ResetPassword.jsx +50 -0
  92. package/templates/auth/app/resources/routes.jsx +54 -0
  93. package/templates/auth/app/resources/spa.js +29 -0
  94. package/templates/auth/app/routes/api.js +17 -0
  95. package/templates/auth/app/routes/auth.js +13 -0
  96. package/templates/auth/app/routes/web.js +21 -0
  97. package/templates/auth/index.js +19 -0
  98. package/templates/auth/template.json +15 -0
  99. package/templates/blank/app/models/.gitkeep +0 -0
  100. package/templates/blank/app/resources/html/home.html +27 -0
  101. package/templates/blank/app/resources/html/partials/nav.html +1 -0
  102. package/templates/blank/app/resources/main.jsx +16 -0
  103. package/templates/blank/app/resources/pages/Home.jsx +42 -0
  104. package/templates/blank/app/resources/pages/NotFound.jsx +27 -0
  105. package/templates/blank/app/resources/routes.jsx +15 -0
  106. package/templates/blank/app/resources/spa.js +24 -0
  107. package/templates/blank/app/routes/api.js +11 -0
  108. package/templates/blank/app/routes/web.js +21 -0
  109. package/templates/blank/index.js +13 -0
  110. package/templates/blank/template.json +12 -0
  111. package/templates/blog/app/lib/blog.js +149 -0
  112. package/templates/blog/app/models/post.js +22 -0
  113. package/templates/blog/app/resources/html/home.html +28 -0
  114. package/templates/blog/app/resources/html/not-found.html +5 -0
  115. package/templates/blog/app/resources/html/partials/nav.html +2 -0
  116. package/templates/blog/app/resources/html/partials/post-card.html +9 -0
  117. package/templates/blog/app/resources/html/post.html +8 -0
  118. package/templates/blog/app/resources/layouts/AdminLayout.jsx +54 -0
  119. package/templates/blog/app/resources/main.jsx +18 -0
  120. package/templates/blog/app/resources/pages/Login.jsx +31 -0
  121. package/templates/blog/app/resources/pages/NotFound.jsx +16 -0
  122. package/templates/blog/app/resources/pages/PostEditor.jsx +51 -0
  123. package/templates/blog/app/resources/pages/Posts.jsx +83 -0
  124. package/templates/blog/app/resources/pages/Register.jsx +43 -0
  125. package/templates/blog/app/resources/routes.jsx +51 -0
  126. package/templates/blog/app/resources/spa.js +25 -0
  127. package/templates/blog/app/resources/styles.css +40 -0
  128. package/templates/blog/app/routes/api.js +77 -0
  129. package/templates/blog/app/routes/auth.js +10 -0
  130. package/templates/blog/app/routes/web.js +114 -0
  131. package/templates/blog/index.js +21 -0
  132. package/templates/blog/template.json +14 -0
  133. package/vite.config.js +11 -0
  134. package/app/views/components/Header.jsx +0 -42
  135. package/app/views/components/LiveCounter.jsx +0 -67
  136. package/app/views/layouts/main/view.jsx +0 -201
  137. package/app/views/legal/terms.html +0 -29
  138. package/app/views/pages/about.jsx +0 -98
  139. package/app/views/pages/dashboard.jsx +0 -278
  140. package/app/views/pages/index.jsx +0 -123
  141. package/app/views/pages/login.jsx +0 -141
  142. package/core/actions.d.ts +0 -4
  143. package/core/actions.js +0 -355
  144. package/core/jsx.d.ts +0 -38
  145. package/core/jsx.js +0 -1597
  146. package/core/vite.d.ts +0 -3
  147. package/public/js/bluebird-client.js +0 -3265
  148. package/public/js/tailwind.js +0 -8
@@ -0,0 +1,19 @@
1
+ import Model from "@seip/bluebird-js/core/model.js";
2
+
3
+ /**
4
+ * Default User model supporting password hashing, hidden fields, soft deletes, and role authorization.
5
+ */
6
+ export default class User extends Model {
7
+ static table = "users";
8
+ static primaryKey = "id";
9
+ static timestamps = true;
10
+ static softDelete = true;
11
+
12
+ static schema = {
13
+ id: { type: "int", primary: true, auto: true },
14
+ name: { type: "string", length: 150, required: true },
15
+ email: { type: "string", length: 150, unique: true, required: true, email: true },
16
+ password: { type: "string", length: 255, required: true, min: 6, hidden: true, hash: true },
17
+ role: { type: "string", length: 30, default: "user" },
18
+ };
19
+ }
@@ -0,0 +1,137 @@
1
+ <section class="py-6 md:py-12">
2
+ <span class="badge">
3
+ <span class="badge-dot bg-success" aria-hidden="true"></span>
4
+ Bluebird.js Hybrid Architecture
5
+ </span>
6
+
7
+ <h1 class="mt-4 max-w-3xl text-3xl font-semibold tracking-tight text-foreground sm:text-4xl md:text-5xl md:leading-[1.1]">
8
+ HTML SSR where SEO lives,
9
+ <span class="text-muted-foreground">React SPA where apps live.</span>
10
+ </h1>
11
+
12
+ <p class="mt-4 max-w-2xl text-base leading-relaxed text-muted-foreground md:text-lg">
13
+ Render landing pages and storefronts with fast <code>\{{ }}</code> HTML templates, then mount client-side
14
+ React Router applications with zero hydration friction.
15
+ </p>
16
+
17
+ <div class="mt-6 flex flex-wrap gap-2">
18
+ {{{ highlightsHtml }}}
19
+ </div>
20
+
21
+ <div class="mt-8 flex flex-wrap items-center gap-2.5">
22
+ <a href="/app" class="btn btn-primary">
23
+ Launch React SPA (/app)
24
+ </a>
25
+ <button
26
+ type="button"
27
+ data-modal-open="ssr-preview-dialog"
28
+ class="btn btn-outline"
29
+ >
30
+ Native Dialog
31
+ </button>
32
+ <div class="flex flex-wrap items-center gap-2 border-l border-border/80 pl-2.5">
33
+ <button
34
+ type="button"
35
+ data-toast="Saved successfully"
36
+ data-toast-description="Triggered directly from HTML via public/js/bluebird.js."
37
+ data-toast-type="success"
38
+ class="btn btn-secondary btn-sm"
39
+ >
40
+ Success Toast
41
+ </button>
42
+ <button
43
+ type="button"
44
+ data-toast="Heads up!"
45
+ data-toast-description="Neutral frosted glass with a small semantic type badge."
46
+ data-toast-type="info"
47
+ class="btn btn-secondary btn-sm"
48
+ >
49
+ Info Toast
50
+ </button>
51
+ <button
52
+ type="button"
53
+ data-toast="Rate limit notice"
54
+ data-toast-description="Supports hover/focus pause and top-layer popover stacking."
55
+ data-toast-type="warning"
56
+ class="btn btn-ghost btn-sm"
57
+ >
58
+ Warning
59
+ </button>
60
+ <button
61
+ type="button"
62
+ data-toast="Validation issue"
63
+ data-toast-description="Actionable error message with crisp readable contrast."
64
+ data-toast-type="error"
65
+ class="btn btn-ghost btn-sm"
66
+ >
67
+ Error
68
+ </button>
69
+ </div>
70
+ </div>
71
+ </section>
72
+
73
+ <dialog id="ssr-preview-dialog" data-modal="ssr-preview-dialog" closedby="any" aria-labelledby="ssr-dialog-title" class="m-auto w-full max-w-md rounded-2xl border border-border/85 bg-popover/95 p-6 text-popover-foreground shadow-2xl backdrop-blur-xl">
74
+ <div class="flex items-start justify-between gap-4">
75
+ <div>
76
+ <span class="badge-tone badge-tone-info">
77
+ <span class="badge-dot bg-info" aria-hidden="true"></span>
78
+ Top Layer
79
+ </span>
80
+ <h2 id="ssr-dialog-title" class="mt-2.5 text-lg font-semibold tracking-tight">Native HTML &lt;dialog&gt;</h2>
81
+ <p class="mt-1 text-sm text-muted-foreground">
82
+ Built with <code>showModal()</code>, <code>closedby="any"</code> light-dismiss, CSS backdrop scroll lock, and top-layer transitions.
83
+ </p>
84
+ </div>
85
+ <button
86
+ type="button"
87
+ data-modal-close
88
+ aria-label="Close dialog"
89
+ class="btn btn-ghost btn-icon btn-sm shrink-0 text-muted-foreground"
90
+ >
91
+ <svg class="size-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M18 6 6 18M6 6l12 12"/></svg>
92
+ </button>
93
+ </div>
94
+ <div class="mt-6 flex justify-end gap-2">
95
+ <button type="button" data-modal-close class="btn btn-outline btn-sm">Dismiss</button>
96
+ <a href="/app" class="btn btn-primary btn-sm">Explore React SPA</a>
97
+ </div>
98
+ </dialog>
99
+
100
+ <section class="mt-4">
101
+ <div data-carousel data-autoplay="5000" data-loop="true" role="region" aria-roledescription="carousel" aria-label="Architecture showcase" class="card overflow-hidden p-0">
102
+ <div data-carousel-track>
103
+ {{#each slides}}
104
+ <div data-carousel-slide class="p-6 md:p-8">
105
+ <span class="badge">
106
+ {{ badge }}
107
+ </span>
108
+ <h2 class="mt-3 text-xl font-semibold tracking-tight text-foreground md:text-2xl">{{ title }}</h2>
109
+ <p class="mt-2 max-w-2xl text-sm leading-relaxed text-muted-foreground">{{ description }}</p>
110
+ </div>
111
+ {{/each}}
112
+ </div>
113
+
114
+ <div class="flex items-center justify-between border-t border-border/80 bg-muted/25 px-5 py-2.5">
115
+ <div data-carousel-dots class="flex items-center gap-0.5"></div>
116
+ <div class="flex items-center gap-1.5">
117
+ <button type="button" data-carousel-prev aria-label="Previous slide" class="btn btn-outline btn-sm">
118
+ Prev
119
+ </button>
120
+ <button type="button" data-carousel-next aria-label="Next slide" class="btn btn-outline btn-sm">
121
+ Next
122
+ </button>
123
+ </div>
124
+ </div>
125
+ </div>
126
+ </section>
127
+
128
+ {{#if features}}
129
+ <section class="mt-8 grid gap-4 sm:grid-cols-3">
130
+ {{#each features}}
131
+ <div class="card p-6 transition-[border-color,box-shadow] duration-200 hover:border-ring/50">
132
+ <h3 class="text-base font-semibold tracking-tight text-foreground">{{ name }}</h3>
133
+ <p class="mt-1.5 text-sm leading-relaxed text-muted-foreground">{{ detail }}</p>
134
+ </div>
135
+ {{/each}}
136
+ </section>
137
+ {{/if}}
@@ -0,0 +1,54 @@
1
+ <!DOCTYPE html>
2
+ <html lang="{{ lang }}">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <meta name="color-scheme" content="light dark">
7
+ <script>
8
+ (function(){try{var k="bb-theme",t=localStorage.getItem(k),m=document.querySelector('meta[name="color-scheme"]'),d=document.documentElement,r=t==="light"||t==="dark"?t:(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light");d.classList.toggle("dark",r==="dark");d.setAttribute("data-theme",r);if(m)m.content=t==="light"||t==="dark"?t:"light dark";}catch(e){}})();
9
+ </script>
10
+ <title>{{ title }}</title>
11
+ {{#if description}}
12
+ <meta name="description" content="{{ description }}">
13
+ {{/if}}
14
+ <link rel="icon" href="/images/favicon.ico">
15
+ {{ vite "app/resources/styles.css" }}
16
+ <script src="/js/bluebird.js" defer></script>
17
+ </head>
18
+ <body class="min-h-screen flex flex-col bg-app text-foreground antialiased">
19
+ <header class="sticky top-0 z-30 border-b border-border/75 glass">
20
+ <nav aria-label="Primary" class="mx-auto flex max-w-6xl items-center justify-between gap-4 px-4 py-3 md:px-6">
21
+ <a href="/" class="flex items-center gap-2.5 text-sm font-semibold tracking-tight text-foreground">
22
+ <span class="inline-flex size-8 items-center justify-center rounded-lg border border-border bg-card shadow-2xs" aria-hidden="true">
23
+ <svg class="size-4 text-foreground" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M16 7h.01M3.4 18H12a8 8 0 0 0 8-8V7a4 4 0 0 0-7.28-2.3L2 20"/><path d="m20 7 2 .5-2 .5M10 18v3M14 17.75V21M7 18a6 6 0 0 0 3.84-10.61"/></svg>
24
+ </span>
25
+ <span class="brand text-base">Blue Bird</span>
26
+ <span class="badge hidden sm:inline-flex">HTML SSR</span>
27
+ </a>
28
+ <div class="flex items-center gap-1.5">
29
+ <a href="/" class="nav-link">Home</a>
30
+ <a href="/terms" class="nav-link">Terms</a>
31
+ <a href="/app" class="btn btn-primary btn-sm ml-1">Open React App</a>
32
+ <button
33
+ type="button"
34
+ data-theme-toggle
35
+ aria-label="Toggle theme"
36
+ title="Toggle theme"
37
+ class="btn btn-ghost btn-icon btn-sm text-muted-foreground hover:text-foreground"
38
+ >
39
+ <svg class="hidden dark:block" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="4"/><path d="M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41"/></svg>
40
+ <svg class="dark:hidden" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401"/></svg>
41
+ </button>
42
+ </div>
43
+ </nav>
44
+ </header>
45
+
46
+ <main class="mx-auto w-full max-w-6xl flex-1 px-4 py-10 md:px-6">
47
+ {{{ body }}}
48
+ </main>
49
+
50
+ <footer class="border-t border-border/75 py-6 text-center text-xs text-muted-foreground">
51
+ Bluebird.js &middot; Express + HTML \{{ }} SSR + React Router SPA + Tailwind CSS v4
52
+ </footer>
53
+ </body>
54
+ </html>
@@ -0,0 +1,14 @@
1
+ <section class="mx-auto flex max-w-md flex-col items-center py-20 text-center">
2
+ <span class="badge">
3
+ <span class="badge-dot bg-warning" aria-hidden="true"></span>
4
+ 404
5
+ </span>
6
+ <h1 class="mt-4 text-3xl font-semibold tracking-tight text-foreground">Page not found</h1>
7
+ <p class="mt-3 text-muted-foreground">
8
+ The page <code class="rounded-md bg-muted px-1.5 py-0.5 text-sm text-foreground">{{ path }}</code> does not exist or was moved.
9
+ </p>
10
+ <div class="mt-8 flex flex-wrap justify-center gap-2.5">
11
+ <a href="/" class="btn btn-primary">Back to home</a>
12
+ <a href="/app" class="btn btn-outline">Open the app</a>
13
+ </div>
14
+ </section>
@@ -0,0 +1,46 @@
1
+ <!DOCTYPE html>
2
+ <html lang="{{ lang }}">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <meta name="color-scheme" content="light dark">
7
+ <script>
8
+ (function(){try{var k="bb-theme",t=localStorage.getItem(k),m=document.querySelector('meta[name="color-scheme"]'),d=document.documentElement,r=t==="light"||t==="dark"?t:(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light");d.classList.toggle("dark",r==="dark");d.setAttribute("data-theme",r);if(m)m.content=t==="light"||t==="dark"?t:"light dark";}catch(e){}})();
9
+ </script>
10
+ <title>Terms of Service — Blue Bird</title>
11
+ <link rel="icon" href="/images/favicon.ico">
12
+ {{ vite "app/resources/styles.css" }}
13
+ <script src="/js/bluebird.js" defer></script>
14
+ </head>
15
+ <body class="min-h-screen flex flex-col bg-app text-foreground antialiased">
16
+ <header class="sticky top-0 z-30 border-b border-border/75 glass">
17
+ <nav aria-label="Primary" class="mx-auto flex max-w-4xl items-center justify-between gap-4 px-4 py-3 md:px-6">
18
+ <a href="/" class="nav-link">&larr; Back to Home</a>
19
+ <button
20
+ type="button"
21
+ data-theme-toggle
22
+ aria-label="Toggle theme"
23
+ title="Toggle theme"
24
+ class="btn btn-outline btn-sm"
25
+ >
26
+ <span data-theme-label>Dark</span>
27
+ </button>
28
+ </nav>
29
+ </header>
30
+
31
+ <main class="mx-auto w-full max-w-4xl flex-1 px-4 py-10 md:px-6">
32
+ <article class="glass-card p-6 md:p-8">
33
+ <header class="mb-6 border-b border-border/80 pb-4">
34
+ <span class="badge">Static HTML SSR</span>
35
+ <h1 class="mt-3 text-3xl font-semibold tracking-tight text-foreground">Terms of Service</h1>
36
+ <p class="mt-1 text-sm text-muted-foreground">Served directly as HTML via <code>Render.html()</code>.</p>
37
+ </header>
38
+ <div class="space-y-4 text-sm leading-relaxed text-muted-foreground md:text-base">
39
+ <p class="text-foreground">
40
+ This document demonstrates zero-overhead static HTML delivery with Tailwind CSS v4, frosted surfaces, and synchronized dark/light theme support.
41
+ </p>
42
+ </div>
43
+ </article>
44
+ </main>
45
+ </body>
46
+ </html>
@@ -0,0 +1,27 @@
1
+ <!DOCTYPE html>
2
+ <html lang="{{ lang }}"{{{ htmlAttrs }}}>
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <meta name="color-scheme" content="light dark">
7
+ <script>
8
+ (function () {
9
+ try {
10
+ var k = "bb-theme";
11
+ var t = localStorage.getItem(k);
12
+ var m = document.querySelector('meta[name="color-scheme"]');
13
+ var d = document.documentElement;
14
+ var r = t === "light" || t === "dark" ? t : (window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light");
15
+ d.classList.toggle("dark", r === "dark");
16
+ d.setAttribute("data-theme", r);
17
+ if (m) m.content = t === "light" || t === "dark" ? t : "light dark";
18
+ } catch (e) {}
19
+ })();
20
+ </script>
21
+ {{{ head }}}
22
+ </head>
23
+ <body{{{ bodyAttrs }}}>
24
+ <div id="root" class="{{ rootClass }}">{{{ skeleton }}}</div>
25
+ {{{ scripts }}}
26
+ </body>
27
+ </html>
@@ -0,0 +1,89 @@
1
+ import { Outlet } from "react-router";
2
+ import { Button, Link, ProgressBar, ThemeToggle, isExported, toast, useAuth } from "@seip/bluebird-js/react";
3
+
4
+ /**
5
+ * Geometric monochrome brand mark shared between SSR and SPA headers.
6
+ */
7
+ function BrandMark() {
8
+ return (
9
+ <span className="inline-flex size-8 items-center justify-center rounded-lg border border-border bg-card shadow-2xs" aria-hidden="true">
10
+ <svg className="size-4 text-foreground" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
11
+ <path d="M16 7h.01M3.4 18H12a8 8 0 0 0 8-8V7a4 4 0 0 0-7.28-2.3L2 20" />
12
+ <path d="m20 7 2 .5-2 .5M10 18v3M14 17.75V21M7 18a6 6 0 0 0 3.84-10.61" />
13
+ </svg>
14
+ </span>
15
+ );
16
+ }
17
+
18
+ /**
19
+ * Main layout shell for the React SPA mounted under `/app`.
20
+ */
21
+ export default function AppLayout() {
22
+ const { user, logout, registerEnabled } = useAuth();
23
+
24
+ const handleLogout = async () => {
25
+ await logout();
26
+ toast.info("Signed out", "Your session has been closed.");
27
+ };
28
+
29
+ return (
30
+ <div className="min-h-screen flex flex-col">
31
+ <ProgressBar />
32
+ <header className="sticky top-0 z-30 border-b border-border/75 glass">
33
+ <nav aria-label="Primary" className="mx-auto flex max-w-6xl items-center justify-between gap-4 px-4 py-3 md:px-6">
34
+ <div className="flex items-center gap-3">
35
+ <Link to="/" exact className="flex items-center gap-2.5 text-sm font-semibold tracking-tight text-foreground">
36
+ <BrandMark />
37
+ <span className="brand text-base">Blue Bird</span>
38
+ <span className="badge hidden sm:inline-flex">React SPA</span>
39
+ </Link>
40
+ {isExported() ? null : (
41
+ <a
42
+ href="/"
43
+ className="hidden rounded-lg px-2 py-1 text-xs font-medium text-muted-foreground transition-colors hover:bg-accent/70 hover:text-foreground sm:inline-flex"
44
+ >
45
+ &larr; HTML Landing
46
+ </a>
47
+ )}
48
+ </div>
49
+
50
+ <div className="flex items-center gap-1.5 overflow-x-auto">
51
+ <Link to="/" exact className="nav-link">
52
+ Explore
53
+ </Link>
54
+ {user ? (
55
+ <>
56
+ <Link to="/dashboard" className="nav-link">
57
+ Dashboard
58
+ </Link>
59
+ <Button size="sm" variant="outline" onClick={handleLogout} className="ml-1">
60
+ Logout ({user.name})
61
+ </Button>
62
+ </>
63
+ ) : (
64
+ <>
65
+ <Link to="/login" className="nav-link">
66
+ Sign In
67
+ </Link>
68
+ {registerEnabled ? (
69
+ <Link to="/register" className="btn btn-primary btn-sm ml-1">
70
+ Sign Up
71
+ </Link>
72
+ ) : null}
73
+ </>
74
+ )}
75
+ <ThemeToggle className="ml-1" />
76
+ </div>
77
+ </nav>
78
+ </header>
79
+
80
+ <main className="mx-auto w-full max-w-6xl flex-1 px-4 py-10 md:px-6">
81
+ <Outlet />
82
+ </main>
83
+
84
+ <footer className="border-t border-border/75 py-6 text-center text-xs text-muted-foreground">
85
+ Bluebird.js &middot; Pure Client React Router SPA + Tailwind CSS v4
86
+ </footer>
87
+ </div>
88
+ );
89
+ }
@@ -0,0 +1,18 @@
1
+ import { StrictMode } from "react";
2
+ import { createRoot } from "react-dom/client";
3
+ import { RouterProvider } from "react-router/dom";
4
+ import { AuthProvider, Toaster } from "@seip/bluebird-js/react";
5
+ import "./styles.css";
6
+ import { router } from "./routes.jsx";
7
+
8
+ const rootEl = document.getElementById("root");
9
+ if (rootEl) {
10
+ createRoot(rootEl).render(
11
+ <StrictMode>
12
+ <AuthProvider>
13
+ <RouterProvider router={router} />
14
+ <Toaster />
15
+ </AuthProvider>
16
+ </StrictMode>
17
+ );
18
+ }
@@ -0,0 +1,98 @@
1
+ import { useCallback, useEffect, useState } from "react";
2
+ import { Badge, Button, Card, Form, Input, Skeleton, SubmitButton, api, toast, useAuth } from "@seip/bluebird-js/react";
3
+
4
+ /**
5
+ * Authenticated dashboard view consuming `/api/tasks`.
6
+ */
7
+ export default function Dashboard() {
8
+ const { user, hasRole } = useAuth();
9
+ const [tasks, setTasks] = useState([]);
10
+ const [loading, setLoading] = useState(true);
11
+
12
+ const loadTasks = useCallback(async () => {
13
+ setLoading(true);
14
+ try {
15
+ const list = await api.get("/api/tasks");
16
+ setTasks(Array.isArray(list) ? list : []);
17
+ } catch (err) {
18
+ toast.error("Failed to load tasks", err.message);
19
+ } finally {
20
+ setLoading(false);
21
+ }
22
+ }, []);
23
+
24
+ useEffect(() => {
25
+ loadTasks();
26
+ }, [loadTasks]);
27
+
28
+ const handleDelete = async (id) => {
29
+ try {
30
+ await api.delete(`/api/tasks/${id}`);
31
+ toast.success("Task removed");
32
+ loadTasks();
33
+ } catch (err) {
34
+ toast.error("Failed to delete", err.message);
35
+ }
36
+ };
37
+
38
+ return (
39
+ <div className="space-y-6">
40
+ <div className="flex flex-wrap items-center justify-between gap-4 border-b border-border/75 pb-5">
41
+ <div>
42
+ <h1 className="text-3xl font-semibold tracking-tight text-foreground">
43
+ Welcome, {user?.name}
44
+ </h1>
45
+ <p className="mt-1 text-sm text-muted-foreground">{user?.email}</p>
46
+ </div>
47
+ <div className="flex items-center gap-2">
48
+ <Badge tone={hasRole("admin") ? "success" : "info"} soft>
49
+ Role: {user?.role || "user"}
50
+ </Badge>
51
+ <Badge tone="default">{tasks.length} tasks</Badge>
52
+ </div>
53
+ </div>
54
+
55
+ <div className="grid gap-6 lg:grid-cols-3">
56
+ <Card title="Tasks" description="Fetched from /api/tasks with CSRF-protected mutations." className="lg:col-span-2">
57
+ {loading ? (
58
+ <div className="space-y-3">
59
+ <Skeleton className="h-11 w-full" />
60
+ <Skeleton className="h-11 w-full" />
61
+ <Skeleton className="h-11 w-full" />
62
+ </div>
63
+ ) : tasks.length === 0 ? (
64
+ <div className="rounded-xl border border-dashed border-border p-8 text-center">
65
+ <p className="text-sm text-muted-foreground">No tasks yet. Add one using the form.</p>
66
+ </div>
67
+ ) : (
68
+ <ul className="divide-y divide-border/80">
69
+ {tasks.map((task) => (
70
+ <li key={task.id} className="flex items-center justify-between gap-3 py-3">
71
+ <span className="text-sm font-medium text-foreground">{task.title}</span>
72
+ <Button size="sm" variant="ghost" onClick={() => handleDelete(task.id)}>
73
+ Delete
74
+ </Button>
75
+ </li>
76
+ ))}
77
+ </ul>
78
+ )}
79
+ </Card>
80
+
81
+ <Card variant="glass" title="New task" description="Create a task via POST /api/tasks.">
82
+ <Form
83
+ url="/api/tasks"
84
+ resetOnSuccess
85
+ successMessage="Task created"
86
+ onSuccess={() => loadTasks()}
87
+ className="space-y-4"
88
+ >
89
+ <Input name="title" label="Title" placeholder="Ship release" required />
90
+ <SubmitButton className="w-full" loadingText="Saving...">
91
+ Add Task
92
+ </SubmitButton>
93
+ </Form>
94
+ </Card>
95
+ </div>
96
+ </div>
97
+ );
98
+ }
@@ -0,0 +1,140 @@
1
+ import { useState } from "react";
2
+ import { Badge, Button, Card, Carousel, Drawer, Link, Modal, toast, useAuth } from "@seip/bluebird-js/react";
3
+
4
+ const SLIDES = [
5
+ {
6
+ badge: "Client Router",
7
+ title: "React Router Data Router",
8
+ description: "Instant client transitions with createRouter(), lazy code-splitting, and zero SSR complexity.",
9
+ },
10
+ {
11
+ badge: "SEO Meta Tree",
12
+ title: "Per-URL Head & JSON-LD from Server",
13
+ description: "routerWeb.spa('/app', { meta }) injects title, description, canonical, keywords, and JSON-LD on first paint.",
14
+ },
15
+ {
16
+ badge: "Portable Build",
17
+ title: "Ready for Web, Electron & Capacitor",
18
+ description: "npx bluebird-js export produces a 100% static HTML/JS/CSS build that talks to /api/* with bearer tokens.",
19
+ },
20
+ ];
21
+
22
+ /**
23
+ * React SPA home view showcasing the shadcn-neutral UI kit, native Modal/Drawer overlays, Carousel, Toasts, and Auth integration.
24
+ */
25
+ export default function Home() {
26
+ const { user, registerEnabled } = useAuth();
27
+ const [modalOpen, setModalOpen] = useState(false);
28
+ const [drawerOpen, setDrawerOpen] = useState(false);
29
+
30
+ return (
31
+ <div className="space-y-8">
32
+ <section className="py-4 md:py-6">
33
+ <Badge tone="info" soft>React Client SPA</Badge>
34
+ <h1 className="mt-4 max-w-3xl text-3xl font-semibold tracking-tight text-foreground sm:text-4xl md:text-5xl md:leading-[1.1]">
35
+ Interactive React workspace inside{" "}
36
+ <span className="text-muted-foreground">/app</span>
37
+ </h1>
38
+ <p className="mt-4 max-w-2xl text-base leading-relaxed text-muted-foreground md:text-lg">
39
+ Built with React 19, React Router, Vite HMR, and Tailwind CSS v4 with synchronized dark and light themes.
40
+ </p>
41
+
42
+ <div className="mt-7 flex flex-wrap items-center gap-2.5">
43
+ {user ? (
44
+ <Link to="/dashboard" className="btn btn-primary">
45
+ Open Dashboard
46
+ </Link>
47
+ ) : (
48
+ <>
49
+ <Link to="/login" className="btn btn-primary">
50
+ Sign In
51
+ </Link>
52
+ {registerEnabled ? (
53
+ <Link to="/register" className="btn btn-outline">
54
+ Create Account
55
+ </Link>
56
+ ) : null}
57
+ </>
58
+ )}
59
+ <Button variant="outline" onClick={() => setModalOpen(true)}>
60
+ Native Modal
61
+ </Button>
62
+ <Button variant="outline" onClick={() => setDrawerOpen(true)}>
63
+ Slide Drawer
64
+ </Button>
65
+ <div className="flex flex-wrap items-center gap-2 border-l border-border/80 pl-2.5">
66
+ <Button
67
+ size="sm"
68
+ variant="secondary"
69
+ onClick={() => toast.success("Changes saved", "Rendered via @seip/bluebird-js/react top-layer <Toaster />.")}
70
+ >
71
+ Success
72
+ </Button>
73
+ <Button
74
+ size="sm"
75
+ variant="secondary"
76
+ onClick={() => toast.info("Theme synced", "Dark and light schemes share state with the HTML landing page.")}
77
+ >
78
+ Info
79
+ </Button>
80
+ <Button
81
+ size="sm"
82
+ variant="ghost"
83
+ onClick={() => toast.warning("Session expiring", "Hover or focus a toast to pause dismissal automatically.")}
84
+ >
85
+ Warning
86
+ </Button>
87
+ <Button
88
+ size="sm"
89
+ variant="ghost"
90
+ onClick={() => toast.error("Request failed", "Neutral frosted card keeps error text sharp in both themes.")}
91
+ >
92
+ Error
93
+ </Button>
94
+ </div>
95
+ </div>
96
+ </section>
97
+
98
+ <Carousel slides={SLIDES} autoPlayMs={5000} label="SPA Architecture Highlights" />
99
+
100
+ <div className="grid gap-4 sm:grid-cols-3">
101
+ <Card title="api() Helper" description="Automatically attaches _csrf cookie headers and parses API validation errors." />
102
+ <Card title="AuthProvider & Roles" description="Synchronizes session state with /api/auth/me and protects routes with RequireAuth." />
103
+ <Card title="Native Top-Layer UI" description="Dialogs, drawers, and toasts leverage native top-layer APIs with reduced-motion respect." />
104
+ </div>
105
+
106
+ <Modal
107
+ open={modalOpen}
108
+ onClose={() => setModalOpen(false)}
109
+ title="Native Top-Layer Dialog"
110
+ description="Powered by <dialog> showModal(), closedby='any' light dismiss, and CSS backdrop scroll containment."
111
+ footer={
112
+ <Button variant="outline" size="sm" onClick={() => setModalOpen(false)}>
113
+ Close
114
+ </Button>
115
+ }
116
+ >
117
+ <p className="text-sm leading-relaxed text-muted-foreground">
118
+ Keyboard focus returns to the invoking button automatically on dismissal, without manual body scroll locks or layout shifts.
119
+ </p>
120
+ </Modal>
121
+
122
+ <Drawer open={drawerOpen} onClose={() => setDrawerOpen(false)} title="Workspace Inspector" side="right">
123
+ <div className="space-y-4 text-sm text-muted-foreground">
124
+ <p>
125
+ Slide-over panels share the same frosted glass surface and native top-layer behavior as modal dialogs.
126
+ </p>
127
+ <div className="flex flex-col gap-2">
128
+ <Button
129
+ size="sm"
130
+ variant="secondary"
131
+ onClick={() => toast.info("Notification from Drawer", "Top-layer popover stacks cleanly above active dialogs.")}
132
+ >
133
+ Trigger Notification
134
+ </Button>
135
+ </div>
136
+ </div>
137
+ </Drawer>
138
+ </div>
139
+ );
140
+ }