@sigx/cli 0.1.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.
- package/LICENSE +21 -0
- package/README.md +78 -0
- package/dist/cli.js +230 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/create.d.ts +1 -0
- package/dist/commands/create.js +411 -0
- package/dist/commands/create.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/plugin.d.ts +26 -0
- package/dist/plugin.js +11 -0
- package/dist/plugin.js.map +1 -0
- package/dist/templates/basic/index.html +32 -0
- package/dist/templates/basic/package.json +19 -0
- package/dist/templates/basic/src/App.tsx +35 -0
- package/dist/templates/basic/tsconfig.json +13 -0
- package/dist/templates/basic/vite.config.ts +15 -0
- package/dist/templates/basic-daisyui/index.html +14 -0
- package/dist/templates/basic-daisyui/package.json +23 -0
- package/dist/templates/basic-daisyui/src/App.tsx +165 -0
- package/dist/templates/basic-daisyui/src/style.css +5 -0
- package/dist/templates/basic-daisyui/tsconfig.json +13 -0
- package/dist/templates/basic-daisyui/vite.config.ts +17 -0
- package/dist/templates/basic-tailwind/index.html +13 -0
- package/dist/templates/basic-tailwind/package.json +21 -0
- package/dist/templates/basic-tailwind/src/App.tsx +37 -0
- package/dist/templates/basic-tailwind/src/style.css +1 -0
- package/dist/templates/basic-tailwind/tsconfig.json +13 -0
- package/dist/templates/basic-tailwind/vite.config.ts +17 -0
- package/dist/templates/lynx/README.md +57 -0
- package/dist/templates/lynx/assets/adaptive-foreground.png +0 -0
- package/dist/templates/lynx/assets/icon.png +0 -0
- package/dist/templates/lynx/assets/splash.png +0 -0
- package/dist/templates/lynx/lynx.config.ts +17 -0
- package/dist/templates/lynx/package.json +28 -0
- package/dist/templates/lynx/sigx.lynx.config.ts +46 -0
- package/dist/templates/lynx/src/App.tsx +103 -0
- package/dist/templates/lynx/src/main.thread.tsx +2 -0
- package/dist/templates/lynx/src/main.tsx +8 -0
- package/dist/templates/lynx/tsconfig.json +19 -0
- package/dist/templates/lynx-tailwind/README.md +61 -0
- package/dist/templates/lynx-tailwind/assets/adaptive-foreground.png +0 -0
- package/dist/templates/lynx-tailwind/assets/icon.png +0 -0
- package/dist/templates/lynx-tailwind/assets/splash.png +0 -0
- package/dist/templates/lynx-tailwind/lynx.config.ts +20 -0
- package/dist/templates/lynx-tailwind/package.json +32 -0
- package/dist/templates/lynx-tailwind/postcss.config.js +5 -0
- package/dist/templates/lynx-tailwind/sigx.lynx.config.ts +44 -0
- package/dist/templates/lynx-tailwind/src/App.tsx +52 -0
- package/dist/templates/lynx-tailwind/src/main.thread.tsx +2 -0
- package/dist/templates/lynx-tailwind/src/main.tsx +9 -0
- package/dist/templates/lynx-tailwind/src/styles.css +3 -0
- package/dist/templates/lynx-tailwind/tailwind.config.ts +9 -0
- package/dist/templates/lynx-tailwind/tsconfig.json +19 -0
- package/dist/templates/ssg/index.html +25 -0
- package/dist/templates/ssg/package.json +22 -0
- package/dist/templates/ssg/src/layouts/default.tsx +27 -0
- package/dist/templates/ssg/src/pages/about.mdx +15 -0
- package/dist/templates/ssg/src/pages/index.mdx +37 -0
- package/dist/templates/ssg/ssg.config.ts +20 -0
- package/dist/templates/ssg/tsconfig.json +14 -0
- package/dist/templates/ssg/vite.config.ts +16 -0
- package/dist/templates/ssg-daisyui/index.html +13 -0
- package/dist/templates/ssg-daisyui/package.json +26 -0
- package/dist/templates/ssg-daisyui/src/layouts/default.tsx +39 -0
- package/dist/templates/ssg-daisyui/src/pages/about.mdx +17 -0
- package/dist/templates/ssg-daisyui/src/pages/index.mdx +34 -0
- package/dist/templates/ssg-daisyui/src/style.css +5 -0
- package/dist/templates/ssg-daisyui/ssg.config.ts +20 -0
- package/dist/templates/ssg-daisyui/tsconfig.json +14 -0
- package/dist/templates/ssg-daisyui/vite.config.ts +18 -0
- package/dist/templates/ssg-tailwind/index.html +12 -0
- package/dist/templates/ssg-tailwind/package.json +24 -0
- package/dist/templates/ssg-tailwind/src/layouts/default.tsx +29 -0
- package/dist/templates/ssg-tailwind/src/pages/about.mdx +16 -0
- package/dist/templates/ssg-tailwind/src/pages/index.mdx +37 -0
- package/dist/templates/ssg-tailwind/src/style.css +1 -0
- package/dist/templates/ssg-tailwind/ssg.config.ts +20 -0
- package/dist/templates/ssg-tailwind/tsconfig.json +14 -0
- package/dist/templates/ssg-tailwind/vite.config.ts +18 -0
- package/dist/templates/ssr/index.html +12 -0
- package/dist/templates/ssr/package.json +24 -0
- package/dist/templates/ssr/src/App.tsx +32 -0
- package/dist/templates/ssr/src/entry-client.tsx +25 -0
- package/dist/templates/ssr/src/entry-server.tsx +24 -0
- package/dist/templates/ssr/src/pages/About.tsx +20 -0
- package/dist/templates/ssr/src/pages/Home.tsx +31 -0
- package/dist/templates/ssr/src/router.ts +27 -0
- package/dist/templates/ssr/tsconfig.json +13 -0
- package/dist/templates/ssr/vite.config.ts +18 -0
- package/dist/templates/ssr-daisyui/index.html +14 -0
- package/dist/templates/ssr-daisyui/package.json +28 -0
- package/dist/templates/ssr-daisyui/src/App.tsx +55 -0
- package/dist/templates/ssr-daisyui/src/entry-client.tsx +25 -0
- package/dist/templates/ssr-daisyui/src/entry-server.tsx +24 -0
- package/dist/templates/ssr-daisyui/src/pages/About.tsx +104 -0
- package/dist/templates/ssr-daisyui/src/pages/Home.tsx +133 -0
- package/dist/templates/ssr-daisyui/src/router.ts +27 -0
- package/dist/templates/ssr-daisyui/src/style.css +5 -0
- package/dist/templates/ssr-daisyui/tsconfig.json +13 -0
- package/dist/templates/ssr-daisyui/vite.config.ts +20 -0
- package/dist/templates/ssr-tailwind/index.html +13 -0
- package/dist/templates/ssr-tailwind/package.json +26 -0
- package/dist/templates/ssr-tailwind/src/App.tsx +32 -0
- package/dist/templates/ssr-tailwind/src/entry-client.tsx +25 -0
- package/dist/templates/ssr-tailwind/src/entry-server.tsx +24 -0
- package/dist/templates/ssr-tailwind/src/pages/About.tsx +21 -0
- package/dist/templates/ssr-tailwind/src/pages/Home.tsx +31 -0
- package/dist/templates/ssr-tailwind/src/router.ts +27 -0
- package/dist/templates/ssr-tailwind/src/style.css +1 -0
- package/dist/templates/ssr-tailwind/tsconfig.json +13 -0
- package/dist/templates/ssr-tailwind/vite.config.ts +20 -0
- package/package.json +65 -0
- package/templates/basic/index.html +32 -0
- package/templates/basic/package.json +19 -0
- package/templates/basic/src/App.tsx +35 -0
- package/templates/basic/tsconfig.json +13 -0
- package/templates/basic/vite.config.ts +15 -0
- package/templates/basic-daisyui/index.html +14 -0
- package/templates/basic-daisyui/package.json +23 -0
- package/templates/basic-daisyui/src/App.tsx +165 -0
- package/templates/basic-daisyui/src/style.css +5 -0
- package/templates/basic-daisyui/tsconfig.json +13 -0
- package/templates/basic-daisyui/vite.config.ts +17 -0
- package/templates/basic-tailwind/index.html +13 -0
- package/templates/basic-tailwind/package.json +21 -0
- package/templates/basic-tailwind/src/App.tsx +37 -0
- package/templates/basic-tailwind/src/style.css +1 -0
- package/templates/basic-tailwind/tsconfig.json +13 -0
- package/templates/basic-tailwind/vite.config.ts +17 -0
- package/templates/lynx/README.md +57 -0
- package/templates/lynx/assets/adaptive-foreground.png +0 -0
- package/templates/lynx/assets/icon.png +0 -0
- package/templates/lynx/assets/splash.png +0 -0
- package/templates/lynx/lynx.config.ts +17 -0
- package/templates/lynx/package.json +28 -0
- package/templates/lynx/sigx.lynx.config.ts +46 -0
- package/templates/lynx/src/App.tsx +103 -0
- package/templates/lynx/src/main.thread.tsx +2 -0
- package/templates/lynx/src/main.tsx +8 -0
- package/templates/lynx/tsconfig.json +19 -0
- package/templates/lynx-tailwind/README.md +61 -0
- package/templates/lynx-tailwind/assets/adaptive-foreground.png +0 -0
- package/templates/lynx-tailwind/assets/icon.png +0 -0
- package/templates/lynx-tailwind/assets/splash.png +0 -0
- package/templates/lynx-tailwind/lynx.config.ts +20 -0
- package/templates/lynx-tailwind/package.json +32 -0
- package/templates/lynx-tailwind/postcss.config.js +5 -0
- package/templates/lynx-tailwind/sigx.lynx.config.ts +44 -0
- package/templates/lynx-tailwind/src/App.tsx +52 -0
- package/templates/lynx-tailwind/src/main.thread.tsx +2 -0
- package/templates/lynx-tailwind/src/main.tsx +9 -0
- package/templates/lynx-tailwind/src/styles.css +3 -0
- package/templates/lynx-tailwind/tailwind.config.ts +9 -0
- package/templates/lynx-tailwind/tsconfig.json +19 -0
- package/templates/ssg/index.html +25 -0
- package/templates/ssg/package.json +22 -0
- package/templates/ssg/src/layouts/default.tsx +27 -0
- package/templates/ssg/src/pages/about.mdx +15 -0
- package/templates/ssg/src/pages/index.mdx +37 -0
- package/templates/ssg/ssg.config.ts +20 -0
- package/templates/ssg/tsconfig.json +14 -0
- package/templates/ssg/vite.config.ts +16 -0
- package/templates/ssg-daisyui/index.html +13 -0
- package/templates/ssg-daisyui/package.json +26 -0
- package/templates/ssg-daisyui/src/layouts/default.tsx +39 -0
- package/templates/ssg-daisyui/src/pages/about.mdx +17 -0
- package/templates/ssg-daisyui/src/pages/index.mdx +34 -0
- package/templates/ssg-daisyui/src/style.css +5 -0
- package/templates/ssg-daisyui/ssg.config.ts +20 -0
- package/templates/ssg-daisyui/tsconfig.json +14 -0
- package/templates/ssg-daisyui/vite.config.ts +18 -0
- package/templates/ssg-tailwind/index.html +12 -0
- package/templates/ssg-tailwind/package.json +24 -0
- package/templates/ssg-tailwind/src/layouts/default.tsx +29 -0
- package/templates/ssg-tailwind/src/pages/about.mdx +16 -0
- package/templates/ssg-tailwind/src/pages/index.mdx +37 -0
- package/templates/ssg-tailwind/src/style.css +1 -0
- package/templates/ssg-tailwind/ssg.config.ts +20 -0
- package/templates/ssg-tailwind/tsconfig.json +14 -0
- package/templates/ssg-tailwind/vite.config.ts +18 -0
- package/templates/ssr/index.html +12 -0
- package/templates/ssr/package.json +24 -0
- package/templates/ssr/src/App.tsx +32 -0
- package/templates/ssr/src/entry-client.tsx +25 -0
- package/templates/ssr/src/entry-server.tsx +24 -0
- package/templates/ssr/src/pages/About.tsx +20 -0
- package/templates/ssr/src/pages/Home.tsx +31 -0
- package/templates/ssr/src/router.ts +27 -0
- package/templates/ssr/tsconfig.json +13 -0
- package/templates/ssr/vite.config.ts +18 -0
- package/templates/ssr-daisyui/index.html +14 -0
- package/templates/ssr-daisyui/package.json +28 -0
- package/templates/ssr-daisyui/src/App.tsx +55 -0
- package/templates/ssr-daisyui/src/entry-client.tsx +25 -0
- package/templates/ssr-daisyui/src/entry-server.tsx +24 -0
- package/templates/ssr-daisyui/src/pages/About.tsx +104 -0
- package/templates/ssr-daisyui/src/pages/Home.tsx +133 -0
- package/templates/ssr-daisyui/src/router.ts +27 -0
- package/templates/ssr-daisyui/src/style.css +5 -0
- package/templates/ssr-daisyui/tsconfig.json +13 -0
- package/templates/ssr-daisyui/vite.config.ts +20 -0
- package/templates/ssr-tailwind/index.html +13 -0
- package/templates/ssr-tailwind/package.json +26 -0
- package/templates/ssr-tailwind/src/App.tsx +32 -0
- package/templates/ssr-tailwind/src/entry-client.tsx +25 -0
- package/templates/ssr-tailwind/src/entry-server.tsx +24 -0
- package/templates/ssr-tailwind/src/pages/About.tsx +21 -0
- package/templates/ssr-tailwind/src/pages/Home.tsx +31 -0
- package/templates/ssr-tailwind/src/router.ts +27 -0
- package/templates/ssr-tailwind/src/style.css +1 -0
- package/templates/ssr-tailwind/tsconfig.json +13 -0
- package/templates/ssr-tailwind/vite.config.ts +20 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { component } from 'sigx';
|
|
2
|
+
import type { LayoutProps, LayoutSlots } from '@sigx/ssg';
|
|
3
|
+
import { Link } from '@sigx/router';
|
|
4
|
+
|
|
5
|
+
export default component<LayoutProps, unknown, LayoutSlots>(({ slots }) => {
|
|
6
|
+
return () => (
|
|
7
|
+
<div class="min-h-screen flex flex-col bg-gray-50">
|
|
8
|
+
<header class="bg-gray-800 text-white">
|
|
9
|
+
<div class="max-w-4xl mx-auto px-6 py-4 flex justify-between items-center">
|
|
10
|
+
<h1 class="text-xl font-bold">🚀 {{projectName}}</h1>
|
|
11
|
+
<nav class="flex gap-6">
|
|
12
|
+
<Link to="/" class="text-white hover:text-gray-300 no-underline">Home</Link>
|
|
13
|
+
<Link to="/about" class="text-white hover:text-gray-300 no-underline">About</Link>
|
|
14
|
+
</nav>
|
|
15
|
+
</div>
|
|
16
|
+
</header>
|
|
17
|
+
|
|
18
|
+
<main class="flex-1 max-w-4xl mx-auto w-full px-6 py-12">
|
|
19
|
+
<article class="prose prose-lg max-w-none">
|
|
20
|
+
{slots.default()}
|
|
21
|
+
</article>
|
|
22
|
+
</main>
|
|
23
|
+
|
|
24
|
+
<footer class="bg-gray-800 text-gray-400 text-center py-4 text-sm">
|
|
25
|
+
Built with SignalX SSG
|
|
26
|
+
</footer>
|
|
27
|
+
</div>
|
|
28
|
+
);
|
|
29
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: About
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# About
|
|
6
|
+
|
|
7
|
+
This is a SignalX static site generated with **@sigx/ssg**.
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- 📄 File-based routing
|
|
12
|
+
- ✍️ MDX support (Markdown + JSX)
|
|
13
|
+
- 🎨 Syntax highlighting with Shiki
|
|
14
|
+
- ⚡ Island architecture with selective hydration
|
|
15
|
+
- 🌊 Tailwind CSS styling
|
|
16
|
+
- 🏗️ Static site generation for optimal performance
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Home
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
import { component } from 'sigx';
|
|
6
|
+
|
|
7
|
+
export const Counter = component(({ signal }) => {
|
|
8
|
+
const state = signal({ count: 0 });
|
|
9
|
+
|
|
10
|
+
return () => (
|
|
11
|
+
<div class="bg-white p-8 rounded-xl shadow-lg text-center mt-8">
|
|
12
|
+
<p class="text-6xl font-bold mb-6">{state.count}</p>
|
|
13
|
+
<div class="flex gap-4 justify-center">
|
|
14
|
+
<button
|
|
15
|
+
onClick={() => state.count++}
|
|
16
|
+
class="px-6 py-3 text-lg font-medium bg-blue-500 text-white rounded-lg hover:bg-blue-600 transition-colors cursor-pointer"
|
|
17
|
+
>
|
|
18
|
+
Increment
|
|
19
|
+
</button>
|
|
20
|
+
<button
|
|
21
|
+
onClick={() => state.count--}
|
|
22
|
+
class="px-6 py-3 text-lg font-medium bg-red-500 text-white rounded-lg hover:bg-red-600 transition-colors cursor-pointer"
|
|
23
|
+
>
|
|
24
|
+
Decrement
|
|
25
|
+
</button>
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
28
|
+
);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
# Welcome to {{projectName}}
|
|
32
|
+
|
|
33
|
+
This is a **SignalX SSG** site with file-based routing and MDX support.
|
|
34
|
+
|
|
35
|
+
Edit `src/pages/index.mdx` to get started.
|
|
36
|
+
|
|
37
|
+
<Counter client:load />
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import "tailwindcss";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { defineSSGConfig } from '@sigx/ssg';
|
|
2
|
+
|
|
3
|
+
export default defineSSGConfig({
|
|
4
|
+
pages: 'src/pages',
|
|
5
|
+
layouts: 'src/layouts',
|
|
6
|
+
outDir: 'dist',
|
|
7
|
+
|
|
8
|
+
site: {
|
|
9
|
+
title: '{{projectName}}',
|
|
10
|
+
description: 'A SignalX static site',
|
|
11
|
+
url: 'https://example.com',
|
|
12
|
+
},
|
|
13
|
+
|
|
14
|
+
markdown: {
|
|
15
|
+
shiki: {
|
|
16
|
+
light: 'github-light',
|
|
17
|
+
dark: 'github-dark',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ESNext",
|
|
4
|
+
"jsx": "react-jsx",
|
|
5
|
+
"jsxImportSource": "sigx",
|
|
6
|
+
"module": "ESNext",
|
|
7
|
+
"moduleResolution": "bundler",
|
|
8
|
+
"strict": true,
|
|
9
|
+
"noEmit": true,
|
|
10
|
+
"skipLibCheck": true,
|
|
11
|
+
"types": ["vite/client", "@sigx/ssg/virtual"]
|
|
12
|
+
},
|
|
13
|
+
"include": ["src/**/*.ts", "src/**/*.tsx"]
|
|
14
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { defineConfig } from 'vite';
|
|
2
|
+
import { sigxPlugin } from '@sigx/vite';
|
|
3
|
+
import { ssgPlugin } from '@sigx/ssg/vite';
|
|
4
|
+
import tailwindcss from '@tailwindcss/vite';
|
|
5
|
+
|
|
6
|
+
export default defineConfig({
|
|
7
|
+
plugins: [
|
|
8
|
+
tailwindcss(),
|
|
9
|
+
sigxPlugin(),
|
|
10
|
+
ssgPlugin()
|
|
11
|
+
],
|
|
12
|
+
oxc: {
|
|
13
|
+
jsx: {
|
|
14
|
+
runtime: 'automatic',
|
|
15
|
+
importSource: 'sigx'
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>{{projectName}}</title>
|
|
7
|
+
</head>
|
|
8
|
+
<body>
|
|
9
|
+
<div id="app"><!--app-html--></div>
|
|
10
|
+
<script type="module" src="/src/entry-client.tsx"></script>
|
|
11
|
+
</body>
|
|
12
|
+
</html>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{projectName}}",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "node server.js",
|
|
8
|
+
"build": "vite build && vite build --ssr src/entry-server.tsx --outDir dist/server",
|
|
9
|
+
"start": "cross-env NODE_ENV=production node server.js",
|
|
10
|
+
"preview": "cross-env NODE_ENV=production node server.js"
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"sigx": "^0.4.1",
|
|
14
|
+
"@sigx/server-renderer": "^0.4.1",
|
|
15
|
+
"@sigx/router": "^0.3.2",
|
|
16
|
+
"express": "^4.18.2"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"@sigx/vite": "^0.4.1",
|
|
20
|
+
"cross-env": "^7.0.3",
|
|
21
|
+
"vite": "^8.0.3",
|
|
22
|
+
"typescript": "^5.9.3"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { component } from 'sigx';
|
|
2
|
+
import { RouterView, Link, useRoute } from '@sigx/router';
|
|
3
|
+
|
|
4
|
+
export const App = component(() => {
|
|
5
|
+
const route = useRoute();
|
|
6
|
+
|
|
7
|
+
return () => (
|
|
8
|
+
<div style="font-family: system-ui, sans-serif; max-width: 800px; margin: 0 auto; padding: 2rem;">
|
|
9
|
+
<header style="background: #2c3e50; color: white; padding: 1rem; margin-bottom: 2rem; border-radius: 8px; display: flex; justify-content: space-between; align-items: center;">
|
|
10
|
+
<h1 style="margin: 0; font-size: 1.5rem;">🚀 {{projectName}}</h1>
|
|
11
|
+
<nav style="display: flex; gap: 1rem;">
|
|
12
|
+
<Link
|
|
13
|
+
to="/"
|
|
14
|
+
style={`color: white; text-decoration: none; padding: 0.5rem 1rem; border-radius: 4px; background: ${route.path === '/' ? '#3498db' : 'transparent'}`}
|
|
15
|
+
>
|
|
16
|
+
Home
|
|
17
|
+
</Link>
|
|
18
|
+
<Link
|
|
19
|
+
to="/about"
|
|
20
|
+
style={`color: white; text-decoration: none; padding: 0.5rem 1rem; border-radius: 4px; background: ${route.path === '/about' ? '#3498db' : 'transparent'}`}
|
|
21
|
+
>
|
|
22
|
+
About
|
|
23
|
+
</Link>
|
|
24
|
+
</nav>
|
|
25
|
+
</header>
|
|
26
|
+
|
|
27
|
+
<main style="background: #fff; padding: 2rem; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.05);">
|
|
28
|
+
<RouterView />
|
|
29
|
+
</main>
|
|
30
|
+
</div>
|
|
31
|
+
);
|
|
32
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { defineApp } from 'sigx';
|
|
2
|
+
import { ssrClientPlugin } from '@sigx/server-renderer/client';
|
|
3
|
+
import { App } from './App';
|
|
4
|
+
import { createClientRouter } from './router';
|
|
5
|
+
|
|
6
|
+
const router = createClientRouter();
|
|
7
|
+
|
|
8
|
+
function startHydration() {
|
|
9
|
+
defineApp(<App />)
|
|
10
|
+
.use(router)
|
|
11
|
+
.use(ssrClientPlugin)
|
|
12
|
+
.hydrate('#app');
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
if (window.__SIGX_STREAMING_COMPLETE__) {
|
|
16
|
+
startHydration();
|
|
17
|
+
} else {
|
|
18
|
+
window.addEventListener('sigx:ready', startHydration, { once: true });
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
declare global {
|
|
22
|
+
interface Window {
|
|
23
|
+
__SIGX_STREAMING_COMPLETE__?: boolean;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { defineApp } from 'sigx';
|
|
2
|
+
import { renderToString, renderToStreamWithCallbacks } from '@sigx/server-renderer/server';
|
|
3
|
+
import { App } from './App';
|
|
4
|
+
import { createServerRouter } from './router';
|
|
5
|
+
|
|
6
|
+
function createApp(url: string) {
|
|
7
|
+
const router = createServerRouter(url);
|
|
8
|
+
return defineApp(<App />).use(router);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export async function render(url: string) {
|
|
12
|
+
const app = createApp(url);
|
|
13
|
+
return await renderToString(app);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export async function renderStreamWithCallback(url: string, callbacks: {
|
|
17
|
+
onShellReady: (html: string) => void;
|
|
18
|
+
onAsyncChunk: (chunk: string) => void;
|
|
19
|
+
onComplete: () => void;
|
|
20
|
+
onError: (error: Error) => void;
|
|
21
|
+
}) {
|
|
22
|
+
const app = createApp(url);
|
|
23
|
+
return await renderToStreamWithCallbacks(app, callbacks);
|
|
24
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { component } from 'sigx';
|
|
2
|
+
|
|
3
|
+
export const About = component(() => {
|
|
4
|
+
return () => (
|
|
5
|
+
<div>
|
|
6
|
+
<h2 style="color: #2c3e50; margin-bottom: 16px;">About</h2>
|
|
7
|
+
<p style="color: #666; margin-bottom: 16px;">
|
|
8
|
+
This is a SignalX SSR application with streaming server-side rendering,
|
|
9
|
+
client-side hydration, and file-based routing.
|
|
10
|
+
</p>
|
|
11
|
+
<ul style="color: #666; line-height: 2;">
|
|
12
|
+
<li>⚡ Streaming SSR with Express</li>
|
|
13
|
+
<li>🔄 Client-side hydration</li>
|
|
14
|
+
<li>🧭 Router with <code>@sigx/router</code></li>
|
|
15
|
+
<li>📡 API routes ready (<code>/api/hello</code>)</li>
|
|
16
|
+
<li>🏗️ Production build support</li>
|
|
17
|
+
</ul>
|
|
18
|
+
</div>
|
|
19
|
+
);
|
|
20
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { component } from 'sigx';
|
|
2
|
+
|
|
3
|
+
export const Home = component(({ signal }) => {
|
|
4
|
+
const state = signal({ count: 0 });
|
|
5
|
+
|
|
6
|
+
return () => (
|
|
7
|
+
<div>
|
|
8
|
+
<h2 style="color: #2c3e50; margin-bottom: 16px;">Home</h2>
|
|
9
|
+
<p style="color: #666; margin-bottom: 24px;">
|
|
10
|
+
Welcome to your SignalX SSR app! Edit <code>src/pages/Home.tsx</code> to get started.
|
|
11
|
+
</p>
|
|
12
|
+
<div style="background: #f8f9fa; padding: 24px; border-radius: 8px; text-align: center;">
|
|
13
|
+
<p style="font-size: 48px; margin-bottom: 16px;">{state.count}</p>
|
|
14
|
+
<div style="display: flex; gap: 8px; justify-content: center;">
|
|
15
|
+
<button
|
|
16
|
+
onClick={() => state.count++}
|
|
17
|
+
style="padding: 10px 20px; font-size: 14px; background: #3498db; color: white; border: none; border-radius: 6px; cursor: pointer;"
|
|
18
|
+
>
|
|
19
|
+
Increment
|
|
20
|
+
</button>
|
|
21
|
+
<button
|
|
22
|
+
onClick={() => state.count--}
|
|
23
|
+
style="padding: 10px 20px; font-size: 14px; background: #e74c3c; color: white; border: none; border-radius: 6px; cursor: pointer;"
|
|
24
|
+
>
|
|
25
|
+
Decrement
|
|
26
|
+
</button>
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
);
|
|
31
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createRouter,
|
|
3
|
+
createWebHistory,
|
|
4
|
+
createMemoryHistory,
|
|
5
|
+
type RouteRecordRaw
|
|
6
|
+
} from '@sigx/router';
|
|
7
|
+
import { Home } from './pages/Home';
|
|
8
|
+
import { About } from './pages/About';
|
|
9
|
+
|
|
10
|
+
export const routes: RouteRecordRaw[] = [
|
|
11
|
+
{ path: '/', name: 'home', component: Home },
|
|
12
|
+
{ path: '/about', name: 'about', component: About }
|
|
13
|
+
];
|
|
14
|
+
|
|
15
|
+
export function createClientRouter() {
|
|
16
|
+
return createRouter({
|
|
17
|
+
history: createWebHistory(),
|
|
18
|
+
routes
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function createServerRouter(url: string) {
|
|
23
|
+
return createRouter({
|
|
24
|
+
history: createMemoryHistory({ initialLocation: url }),
|
|
25
|
+
routes
|
|
26
|
+
});
|
|
27
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ESNext",
|
|
4
|
+
"jsx": "react-jsx",
|
|
5
|
+
"jsxImportSource": "sigx",
|
|
6
|
+
"module": "ESNext",
|
|
7
|
+
"moduleResolution": "bundler",
|
|
8
|
+
"strict": true,
|
|
9
|
+
"noEmit": true,
|
|
10
|
+
"skipLibCheck": true
|
|
11
|
+
},
|
|
12
|
+
"include": ["src/**/*.ts", "src/**/*.tsx"]
|
|
13
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { defineConfig } from 'vite';
|
|
2
|
+
import { sigxPlugin } from '@sigx/vite';
|
|
3
|
+
|
|
4
|
+
export default defineConfig({
|
|
5
|
+
plugins: [
|
|
6
|
+
sigxPlugin()
|
|
7
|
+
],
|
|
8
|
+
build: {
|
|
9
|
+
outDir: 'dist/client'
|
|
10
|
+
},
|
|
11
|
+
// Vite 8 uses oxc instead of esbuild for JSX transforms
|
|
12
|
+
oxc: {
|
|
13
|
+
jsx: {
|
|
14
|
+
runtime: 'automatic',
|
|
15
|
+
importSource: 'sigx'
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en" data-theme="light">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>{{projectName}}</title>
|
|
7
|
+
<link rel="stylesheet" href="/src/style.css" />
|
|
8
|
+
<script>(function(){try{var t=localStorage.getItem('daisy-theme');if(!t&&window.matchMedia('(prefers-color-scheme:dark)').matches)t='dark';if(t)document.documentElement.setAttribute('data-theme',t);}catch(e){}})()</script>
|
|
9
|
+
</head>
|
|
10
|
+
<body class="bg-base-200 min-h-screen">
|
|
11
|
+
<div id="app"><!--app-html--></div>
|
|
12
|
+
<script type="module" src="/src/entry-client.tsx"></script>
|
|
13
|
+
</body>
|
|
14
|
+
</html>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{projectName}}",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "node server.js",
|
|
8
|
+
"build": "vite build && vite build --ssr src/entry-server.tsx --outDir dist/server",
|
|
9
|
+
"start": "cross-env NODE_ENV=production node server.js",
|
|
10
|
+
"preview": "cross-env NODE_ENV=production node server.js"
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"sigx": "^0.4.1",
|
|
14
|
+
"@sigx/daisyui": "^0.3.2",
|
|
15
|
+
"@sigx/server-renderer": "^0.4.1",
|
|
16
|
+
"@sigx/router": "^0.3.2",
|
|
17
|
+
"express": "^4.18.2"
|
|
18
|
+
},
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"@sigx/vite": "^0.4.1",
|
|
21
|
+
"cross-env": "^7.0.3",
|
|
22
|
+
"vite": "^8.0.3",
|
|
23
|
+
"typescript": "^5.9.3",
|
|
24
|
+
"tailwindcss": "^4.1.0",
|
|
25
|
+
"@tailwindcss/vite": "^4.2.2",
|
|
26
|
+
"daisyui": "^5.0.0"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { component } from 'sigx';
|
|
2
|
+
import { RouterView, Link, useRoute } from '@sigx/router';
|
|
3
|
+
import { ThemeProvider, ThemeSelector, Footer } from '@sigx/daisyui';
|
|
4
|
+
|
|
5
|
+
const themes = ['light', 'dark', 'cupcake', 'synthwave', 'cyberpunk', 'dracula', 'nord', 'autumn'] as const;
|
|
6
|
+
|
|
7
|
+
export const App = component(() => {
|
|
8
|
+
const route = useRoute();
|
|
9
|
+
|
|
10
|
+
return () => (
|
|
11
|
+
<ThemeProvider defaultTheme="light" darkMode>
|
|
12
|
+
<div class="min-h-screen flex flex-col bg-base-200">
|
|
13
|
+
{/* Navbar */}
|
|
14
|
+
<header class="navbar bg-base-100 shadow-sm sticky top-0 z-50">
|
|
15
|
+
<div class="navbar-start">
|
|
16
|
+
<Link to="/" class="btn btn-ghost text-xl font-bold gap-2">
|
|
17
|
+
🚀 {{projectName}}
|
|
18
|
+
</Link>
|
|
19
|
+
</div>
|
|
20
|
+
<div class="navbar-center hidden sm:flex">
|
|
21
|
+
<nav class="flex gap-1">
|
|
22
|
+
<Link
|
|
23
|
+
to="/"
|
|
24
|
+
class={`btn btn-sm ${route.path === '/' ? 'btn-primary' : 'btn-ghost'}`}
|
|
25
|
+
>
|
|
26
|
+
Home
|
|
27
|
+
</Link>
|
|
28
|
+
<Link
|
|
29
|
+
to="/about"
|
|
30
|
+
class={`btn btn-sm ${route.path === '/about' ? 'btn-primary' : 'btn-ghost'}`}
|
|
31
|
+
>
|
|
32
|
+
About
|
|
33
|
+
</Link>
|
|
34
|
+
</nav>
|
|
35
|
+
</div>
|
|
36
|
+
<div class="navbar-end">
|
|
37
|
+
<ThemeSelector themes={[...themes]} />
|
|
38
|
+
</div>
|
|
39
|
+
</header>
|
|
40
|
+
|
|
41
|
+
{/* Main content */}
|
|
42
|
+
<main class="flex-1">
|
|
43
|
+
<RouterView />
|
|
44
|
+
</main>
|
|
45
|
+
|
|
46
|
+
{/* Footer */}
|
|
47
|
+
<Footer center class="bg-base-100 text-base-content border-t border-base-300">
|
|
48
|
+
<aside>
|
|
49
|
+
<p>Built with 💜 using <strong>SignalX</strong> & <strong>DaisyUI</strong></p>
|
|
50
|
+
</aside>
|
|
51
|
+
</Footer>
|
|
52
|
+
</div>
|
|
53
|
+
</ThemeProvider>
|
|
54
|
+
);
|
|
55
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { defineApp } from 'sigx';
|
|
2
|
+
import { ssrClientPlugin } from '@sigx/server-renderer/client';
|
|
3
|
+
import { App } from './App';
|
|
4
|
+
import { createClientRouter } from './router';
|
|
5
|
+
|
|
6
|
+
const router = createClientRouter();
|
|
7
|
+
|
|
8
|
+
function startHydration() {
|
|
9
|
+
defineApp(<App />)
|
|
10
|
+
.use(router)
|
|
11
|
+
.use(ssrClientPlugin)
|
|
12
|
+
.hydrate('#app');
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
if (window.__SIGX_STREAMING_COMPLETE__) {
|
|
16
|
+
startHydration();
|
|
17
|
+
} else {
|
|
18
|
+
window.addEventListener('sigx:ready', startHydration, { once: true });
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
declare global {
|
|
22
|
+
interface Window {
|
|
23
|
+
__SIGX_STREAMING_COMPLETE__?: boolean;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { defineApp } from 'sigx';
|
|
2
|
+
import { renderToString, renderToStreamWithCallbacks } from '@sigx/server-renderer/server';
|
|
3
|
+
import { App } from './App';
|
|
4
|
+
import { createServerRouter } from './router';
|
|
5
|
+
|
|
6
|
+
function createApp(url: string) {
|
|
7
|
+
const router = createServerRouter(url);
|
|
8
|
+
return defineApp(<App />).use(router);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export async function render(url: string) {
|
|
12
|
+
const app = createApp(url);
|
|
13
|
+
return await renderToString(app);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export async function renderStreamWithCallback(url: string, callbacks: {
|
|
17
|
+
onShellReady: (html: string) => void;
|
|
18
|
+
onAsyncChunk: (chunk: string) => void;
|
|
19
|
+
onComplete: () => void;
|
|
20
|
+
onError: (error: Error) => void;
|
|
21
|
+
}) {
|
|
22
|
+
const app = createApp(url);
|
|
23
|
+
return await renderToStreamWithCallbacks(app, callbacks);
|
|
24
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { component } from 'sigx';
|
|
2
|
+
import { Card, Steps, Badge, Divider, Button } from '@sigx/daisyui';
|
|
3
|
+
|
|
4
|
+
export const About = component(({ signal }) => {
|
|
5
|
+
const state = signal({ currentStep: 'signals' });
|
|
6
|
+
|
|
7
|
+
const steps = [
|
|
8
|
+
{ id: 'signals', label: 'Signals', color: 'primary' as const },
|
|
9
|
+
{ id: 'effects', label: 'Effects', color: 'secondary' as const },
|
|
10
|
+
{ id: 'components', label: 'Components', color: 'accent' as const },
|
|
11
|
+
{ id: 'ssr', label: 'SSR', color: 'success' as const },
|
|
12
|
+
];
|
|
13
|
+
|
|
14
|
+
const stepDetails: Record<string, { title: string; desc: string }> = {
|
|
15
|
+
signals: {
|
|
16
|
+
title: '📡 Signals — Reactive Primitives',
|
|
17
|
+
desc: 'Signals are the foundation of SignalX. They hold reactive state and automatically notify subscribers when values change. No proxies, no cloning — just direct, fine-grained reactivity.',
|
|
18
|
+
},
|
|
19
|
+
effects: {
|
|
20
|
+
title: '⚡ Effects — Automatic Reactions',
|
|
21
|
+
desc: 'Effects run whenever their signal dependencies change. Use them for side effects like timers, API calls, or DOM updates. Cleanup functions are called automatically.',
|
|
22
|
+
},
|
|
23
|
+
components: {
|
|
24
|
+
title: '🧩 Components — Composable UI',
|
|
25
|
+
desc: 'SignalX components use a render function that only runs once. The returned JSX template is live — signal references inside it update surgically without re-running the function.',
|
|
26
|
+
},
|
|
27
|
+
ssr: {
|
|
28
|
+
title: '🌊 SSR — Streaming Server Rendering',
|
|
29
|
+
desc: 'Stream HTML to the browser as it\'s generated. SignalX hydrates seamlessly on the client, preserving server-rendered content and adding full interactivity.',
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const current = () => stepDetails[state.currentStep] || stepDetails.signals;
|
|
34
|
+
|
|
35
|
+
return () => (
|
|
36
|
+
<div>
|
|
37
|
+
{/* Header */}
|
|
38
|
+
<section class="py-16 px-6 bg-base-100">
|
|
39
|
+
<div class="max-w-3xl mx-auto text-center">
|
|
40
|
+
<h1 class="text-4xl font-bold mb-4">About SignalX</h1>
|
|
41
|
+
<p class="text-lg text-base-content/70">
|
|
42
|
+
A modern reactive framework for building fast, type-safe web applications
|
|
43
|
+
with fine-grained reactivity and streaming SSR.
|
|
44
|
+
</p>
|
|
45
|
+
</div>
|
|
46
|
+
</section>
|
|
47
|
+
|
|
48
|
+
<Divider />
|
|
49
|
+
|
|
50
|
+
{/* How It Works — Interactive Steps */}
|
|
51
|
+
<section class="py-16 px-6">
|
|
52
|
+
<div class="max-w-3xl mx-auto">
|
|
53
|
+
<h2 class="text-3xl font-bold text-center mb-10">How It Works</h2>
|
|
54
|
+
|
|
55
|
+
<Steps
|
|
56
|
+
items={steps}
|
|
57
|
+
model={() => state.currentStep}
|
|
58
|
+
class="mb-10"
|
|
59
|
+
/>
|
|
60
|
+
|
|
61
|
+
<Card bordered shadow="lg" class="transition-all duration-300">
|
|
62
|
+
<Card.Body>
|
|
63
|
+
<Card.Title>{current().title}</Card.Title>
|
|
64
|
+
<p class="text-base-content/70 leading-relaxed">{current().desc}</p>
|
|
65
|
+
</Card.Body>
|
|
66
|
+
</Card>
|
|
67
|
+
</div>
|
|
68
|
+
</section>
|
|
69
|
+
|
|
70
|
+
<Divider />
|
|
71
|
+
|
|
72
|
+
{/* Tech Stack */}
|
|
73
|
+
<section class="py-16 px-6 bg-base-100">
|
|
74
|
+
<div class="max-w-3xl mx-auto">
|
|
75
|
+
<h2 class="text-3xl font-bold text-center mb-10">Built With</h2>
|
|
76
|
+
<div class="flex flex-wrap justify-center gap-3">
|
|
77
|
+
<Badge variant="primary" size="lg">SignalX</Badge>
|
|
78
|
+
<Badge variant="secondary" size="lg">TypeScript</Badge>
|
|
79
|
+
<Badge variant="accent" size="lg">Vite</Badge>
|
|
80
|
+
<Badge variant="info" size="lg">DaisyUI</Badge>
|
|
81
|
+
<Badge variant="success" size="lg">Tailwind CSS</Badge>
|
|
82
|
+
<Badge variant="warning" size="lg">SSR Streaming</Badge>
|
|
83
|
+
</div>
|
|
84
|
+
</div>
|
|
85
|
+
</section>
|
|
86
|
+
|
|
87
|
+
<Divider />
|
|
88
|
+
|
|
89
|
+
{/* CTA */}
|
|
90
|
+
<section class="py-16 px-6">
|
|
91
|
+
<div class="max-w-xl mx-auto text-center">
|
|
92
|
+
<h2 class="text-2xl font-bold mb-4">Ready to build?</h2>
|
|
93
|
+
<p class="text-base-content/60 mb-6">
|
|
94
|
+
Start building your next project with SignalX.
|
|
95
|
+
</p>
|
|
96
|
+
<div class="flex gap-3 justify-center">
|
|
97
|
+
<Button variant="primary">Read the Docs</Button>
|
|
98
|
+
<Button variant="ghost" outline>View on GitHub</Button>
|
|
99
|
+
</div>
|
|
100
|
+
</div>
|
|
101
|
+
</section>
|
|
102
|
+
</div>
|
|
103
|
+
);
|
|
104
|
+
});
|