create-fluxstack 1.21.1 → 1.22.1
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/app/client/src/App.tsx +9 -11
- package/app/client/src/components/AppLayout.tsx +291 -290
- package/app/client/src/components/BackButton.tsx +17 -16
- package/app/client/src/components/ColorWheel.tsx +1 -0
- package/app/client/src/components/DemoPage.tsx +136 -135
- package/app/client/src/components/ErrorBoundary.tsx +2 -1
- package/app/client/src/components/LiveErrorBoundary.tsx +2 -1
- package/app/client/src/components/ThemePicker.tsx +1 -0
- package/app/client/src/framework/ClientOnly.tsx +14 -0
- package/app/client/src/framework/LivePage.tsx +55 -0
- package/app/client/src/framework/RscHomePage.tsx +125 -0
- package/app/client/src/framework/RscLink.tsx +31 -0
- package/app/client/src/framework/RscNav.tsx +42 -0
- package/app/client/src/framework/RscRoot.tsx +54 -0
- package/app/client/src/framework/csrf.ts +22 -0
- package/app/client/src/framework/entry.browser.tsx +51 -0
- package/app/client/src/framework/entry.rsc.tsx +41 -0
- package/app/client/src/framework/entry.ssr.tsx +12 -0
- package/app/client/src/framework/navigation.ts +29 -0
- package/app/client/src/framework/params.tsx +22 -0
- package/app/client/src/framework/routes.ts +143 -0
- package/app/client/src/framework/vite-rsc.d.ts +21 -0
- package/app/client/src/hooks/useThemeClock.ts +16 -1
- package/app/client/src/live/AuthDemo.tsx +271 -270
- package/app/client/src/live/CounterDemo.tsx +152 -151
- package/app/client/src/live/FormDemo.tsx +141 -140
- package/app/client/src/live/PingPongDemo.tsx +181 -180
- package/app/client/src/live/RoomChatDemo.tsx +398 -397
- package/app/client/src/live/SharedCounterDemo.tsx +2 -1
- package/app/client/src/pages/ApiTestPage.tsx +1 -0
- package/app/client/src/pages/auth.tsx +13 -0
- package/app/client/src/pages/blog/[slug].tsx +23 -0
- package/app/client/src/pages/counter.tsx +15 -0
- package/app/client/src/pages/form.tsx +13 -0
- package/app/client/src/pages/index.tsx +9 -0
- package/app/client/src/pages/ping-pong.tsx +13 -0
- package/app/client/src/pages/room-chat.tsx +13 -0
- package/app/client/src/pages/shared-counter.tsx +13 -0
- package/app/client/src/pages/sobre.tsx +19 -0
- package/app/server/index.ts +5 -1
- package/app/server/live/rooms/index.ts +14 -0
- package/config/system/plugins.config.ts +12 -2
- package/core/cli/commands/dev.ts +9 -1
- package/core/plugins/built-in/rsc/index.ts +156 -0
- package/core/plugins/built-in/ssr/bun-asset-loader.ts +46 -0
- package/core/plugins/built-in/ssr/index.ts +143 -0
- package/core/plugins/built-in/ssr/registry.ts +38 -0
- package/core/plugins/built-in/vite/index.ts +7 -0
- package/core/server/live/websocket-plugin.ts +29 -10
- package/core/utils/version.ts +6 -6
- package/create-fluxstack.ts +64 -5
- package/package.json +112 -108
- package/playwright.config.ts +6 -2
- package/vite.config.ts +22 -0
- package/app/client/.live-stubs/LiveUpload.js +0 -15
package/app/client/src/App.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useState, useEffect, useRef } from 'react'
|
|
2
|
-
import { Routes, Route } from 'react-router'
|
|
2
|
+
import { Routes, Route, useLocation } from 'react-router'
|
|
3
3
|
import { api } from './lib/eden-api'
|
|
4
4
|
import { LiveComponentsProvider, useLiveComponents } from '@/core/client'
|
|
5
5
|
import { executeHook } from './lib/plugin-hooks'
|
|
@@ -16,12 +16,15 @@ import { HomePage } from './pages/HomePage'
|
|
|
16
16
|
import { ApiTestPage } from './pages/ApiTestPage'
|
|
17
17
|
|
|
18
18
|
function NotFoundPage() {
|
|
19
|
+
// SSR-safe: useLocation funciona no server (StaticRouter) e no client,
|
|
20
|
+
// diferente de window.location que quebra durante renderToString.
|
|
21
|
+
const { pathname } = useLocation()
|
|
19
22
|
return (
|
|
20
23
|
<div className="flex flex-col items-center justify-center min-h-[60vh] text-center px-4">
|
|
21
24
|
<h1 className="text-6xl font-black text-white mb-4">404</h1>
|
|
22
25
|
<p className="text-xl text-gray-400 mb-6">Pagina nao encontrada</p>
|
|
23
26
|
<p className="text-sm text-gray-500 mb-8">
|
|
24
|
-
O caminho <code className="text-theme">{
|
|
27
|
+
O caminho <code className="text-theme">{pathname}</code> nao existe.
|
|
25
28
|
</p>
|
|
26
29
|
<a
|
|
27
30
|
href="/"
|
|
@@ -197,19 +200,14 @@ function AppContent() {
|
|
|
197
200
|
}
|
|
198
201
|
|
|
199
202
|
function App() {
|
|
200
|
-
//
|
|
201
|
-
//
|
|
202
|
-
//
|
|
203
|
-
|
|
204
|
-
? 'ws://localhost:3000/api/live/ws'
|
|
205
|
-
: undefined
|
|
206
|
-
|
|
203
|
+
// Sem `url`: o WebSocket usa auto-detect (mesma origem da página). Acesse o
|
|
204
|
+
// app pela porta do Elysia (3000) — ele serve frontend (proxy Vite) + API +
|
|
205
|
+
// WS na mesma origem, então o WS resolve para ws(s)://<host>/api/live/ws.
|
|
206
|
+
// (Acessar o Vite cru na 5173 não tem WS Live — entre sempre pela 3000.)
|
|
207
207
|
return (
|
|
208
208
|
<LiveComponentsProvider
|
|
209
|
-
//url={wsUrl}
|
|
210
209
|
autoConnect={true}
|
|
211
210
|
reconnectInterval={1000}
|
|
212
|
-
maxReconnectAttempts={5}
|
|
213
211
|
heartbeatInterval={30000}
|
|
214
212
|
debug={false}
|
|
215
213
|
>
|