This commit is contained in:
rex
2025-09-01 20:01:21 +08:00
parent 8dd468a5e3
commit 272c87f799
20 changed files with 150 additions and 40 deletions

8
.cursor/mcp.json Normal file
View File

@@ -0,0 +1,8 @@
{
"mcpServers": {
"assistant-ui": {
"command": "npx",
"args": ["-y", "@assistant-ui/mcp-docs-server"]
}
}
}

View File

@@ -0,0 +1,5 @@
---
description:
globs:
alwaysApply: false
---

View File

@@ -0,0 +1,5 @@
---
description:
globs:
alwaysApply: false
---

2
.gitignore vendored
View File

@@ -22,3 +22,5 @@ dist-ssr
*.njsproj
*.sln
*.sw?
*.zip

1
.npmrc Normal file
View File

@@ -0,0 +1 @@
registry=https://registry.npmmirror.com

View File

@@ -24,13 +24,13 @@
},
"javascript": {
"formatter": {
"quoteStyle": "double"
"quoteStyle": "single"
}
},
"overrides": [
{
"includes": [
"**/*.{ts,tsx}"
"**/*.{ts,tsx,js,jsx}"
],
"linter": {
"rules": {
@@ -98,7 +98,7 @@
},
{
"includes": [
"**/*.{ts,tsx}"
"**/*.{ts,tsx,js,jsx}"
],
"javascript": {
"globals": []
@@ -106,7 +106,7 @@
},
{
"includes": [
"**/*.{ts,tsx}"
"**/*.{ts,tsx,js,jsx}"
],
"linter": {
"rules": {
@@ -144,7 +144,7 @@
},
{
"includes": [
"**/*.{ts,tsx}"
"**/*.{ts,tsx,js,jsx}"
],
"linter": {
"rules": {
@@ -172,7 +172,7 @@
},
{
"includes": [
"**/*.{ts,tsx}"
"**/*.{ts,tsx,js,jsx}"
],
"linter": {
"rules": {
@@ -185,7 +185,7 @@
},
{
"includes": [
"**/*.{ts,tsx}"
"**/*.{ts,tsx,js,jsx}"
],
"linter": {
"rules": {}
@@ -193,7 +193,7 @@
},
{
"includes": [
"**/*.{ts,tsx}"
"**/*.{ts,tsx,js,jsx}"
],
"javascript": {
"globals": [

View File

@@ -3,6 +3,11 @@
"private": true,
"version": "0.0.0",
"type": "module",
"engines": {
"node": ">=22.0.0",
"pnpm": ">=10.0.0"
},
"packageManager": "pnpm@10.0.0",
"scripts": {
"dev": "vite",
"build": "tsc -b && vite build",
@@ -11,6 +16,7 @@
},
"dependencies": {
"@tailwindcss/vite": "^4.1.12",
"postmate": "^1.5.2",
"react": "^19.1.1",
"react-dom": "^19.1.1",
"react-router": "^7.8.2",
@@ -18,6 +24,8 @@
"zustand": "^5.0.8"
},
"devDependencies": {
"@types/node": "^22.13.9",
"@types/postmate": "^1.5.4",
"@types/react": "^19.1.10",
"@types/react-dom": "^19.1.7",
"@vitejs/plugin-react": "^5.0.0",

67
pnpm-lock.yaml generated
View File

@@ -10,7 +10,10 @@ importers:
dependencies:
'@tailwindcss/vite':
specifier: ^4.1.12
version: 4.1.12(vite@7.1.3(jiti@2.5.1)(lightningcss@1.30.1))
version: 4.1.12(vite@7.1.3(@types/node@22.18.0)(jiti@2.5.1)(lightningcss@1.30.1))
postmate:
specifier: ^1.5.2
version: 1.5.2
react:
specifier: ^19.1.1
version: 19.1.1
@@ -27,6 +30,12 @@ importers:
specifier: ^5.0.8
version: 5.0.8(@types/react@19.1.12)(react@19.1.1)
devDependencies:
'@types/node':
specifier: ^22.13.9
version: 22.18.0
'@types/postmate':
specifier: ^1.5.4
version: 1.5.4
'@types/react':
specifier: ^19.1.10
version: 19.1.12
@@ -35,7 +44,7 @@ importers:
version: 19.1.8(@types/react@19.1.12)
'@vitejs/plugin-react':
specifier: ^5.0.0
version: 5.0.2(vite@7.1.3(jiti@2.5.1)(lightningcss@1.30.1))
version: 5.0.2(vite@7.1.3(@types/node@22.18.0)(jiti@2.5.1)(lightningcss@1.30.1))
globals:
specifier: ^16.3.0
version: 16.3.0
@@ -44,7 +53,7 @@ importers:
version: 5.8.3
vite:
specifier: ^7.1.2
version: 7.1.3(jiti@2.5.1)(lightningcss@1.30.1)
version: 7.1.3(@types/node@22.18.0)(jiti@2.5.1)(lightningcss@1.30.1)
packages:
@@ -348,56 +357,67 @@ packages:
resolution: {integrity: sha512-OVSQgEZDVLnTbMq5NBs6xkmz3AADByCWI4RdKSFNlDsYXdFtlxS59J+w+LippJe8KcmeSSM3ba+GlsM9+WwC1w==}
cpu: [arm]
os: [linux]
libc: [glibc]
'@rollup/rollup-linux-arm-musleabihf@4.49.0':
resolution: {integrity: sha512-ZnfSFA7fDUHNa4P3VwAcfaBLakCbYaxCk0jUnS3dTou9P95kwoOLAMlT3WmEJDBCSrOEFFV0Y1HXiwfLYJuLlA==}
cpu: [arm]
os: [linux]
libc: [musl]
'@rollup/rollup-linux-arm64-gnu@4.49.0':
resolution: {integrity: sha512-Z81u+gfrobVK2iV7GqZCBfEB1y6+I61AH466lNK+xy1jfqFLiQ9Qv716WUM5fxFrYxwC7ziVdZRU9qvGHkYIJg==}
cpu: [arm64]
os: [linux]
libc: [glibc]
'@rollup/rollup-linux-arm64-musl@4.49.0':
resolution: {integrity: sha512-zoAwS0KCXSnTp9NH/h9aamBAIve0DXeYpll85shf9NJ0URjSTzzS+Z9evmolN+ICfD3v8skKUPyk2PO0uGdFqg==}
cpu: [arm64]
os: [linux]
libc: [musl]
'@rollup/rollup-linux-loongarch64-gnu@4.49.0':
resolution: {integrity: sha512-2QyUyQQ1ZtwZGiq0nvODL+vLJBtciItC3/5cYN8ncDQcv5avrt2MbKt1XU/vFAJlLta5KujqyHdYtdag4YEjYQ==}
cpu: [loong64]
os: [linux]
libc: [glibc]
'@rollup/rollup-linux-ppc64-gnu@4.49.0':
resolution: {integrity: sha512-k9aEmOWt+mrMuD3skjVJSSxHckJp+SiFzFG+v8JLXbc/xi9hv2icSkR3U7uQzqy+/QbbYY7iNB9eDTwrELo14g==}
cpu: [ppc64]
os: [linux]
libc: [glibc]
'@rollup/rollup-linux-riscv64-gnu@4.49.0':
resolution: {integrity: sha512-rDKRFFIWJ/zJn6uk2IdYLc09Z7zkE5IFIOWqpuU0o6ZpHcdniAyWkwSUWE/Z25N/wNDmFHHMzin84qW7Wzkjsw==}
cpu: [riscv64]
os: [linux]
libc: [glibc]
'@rollup/rollup-linux-riscv64-musl@4.49.0':
resolution: {integrity: sha512-FkkhIY/hYFVnOzz1WeV3S9Bd1h0hda/gRqvZCMpHWDHdiIHn6pqsY3b5eSbvGccWHMQ1uUzgZTKS4oGpykf8Tw==}
cpu: [riscv64]
os: [linux]
libc: [musl]
'@rollup/rollup-linux-s390x-gnu@4.49.0':
resolution: {integrity: sha512-gRf5c+A7QiOG3UwLyOOtyJMD31JJhMjBvpfhAitPAoqZFcOeK3Kc1Veg1z/trmt+2P6F/biT02fU19GGTS529A==}
cpu: [s390x]
os: [linux]
libc: [glibc]
'@rollup/rollup-linux-x64-gnu@4.49.0':
resolution: {integrity: sha512-BR7+blScdLW1h/2hB/2oXM+dhTmpW3rQt1DeSiCP9mc2NMMkqVgjIN3DDsNpKmezffGC9R8XKVOLmBkRUcK/sA==}
cpu: [x64]
os: [linux]
libc: [glibc]
'@rollup/rollup-linux-x64-musl@4.49.0':
resolution: {integrity: sha512-hDMOAe+6nX3V5ei1I7Au3wcr9h3ktKzDvF2ne5ovX8RZiAHEtX1A5SNNk4zt1Qt77CmnbqT+upb/umzoPMWiPg==}
cpu: [x64]
os: [linux]
libc: [musl]
'@rollup/rollup-win32-arm64-msvc@4.49.0':
resolution: {integrity: sha512-wkNRzfiIGaElC9kXUT+HLx17z7D0jl+9tGYRKwd8r7cUqTL7GYAvgUY++U2hK6Ar7z5Z6IRRoWC8kQxpmM7TDA==}
@@ -452,24 +472,28 @@ packages:
engines: {node: '>= 10'}
cpu: [arm64]
os: [linux]
libc: [glibc]
'@tailwindcss/oxide-linux-arm64-musl@4.1.12':
resolution: {integrity: sha512-V8pAM3s8gsrXcCv6kCHSuwyb/gPsd863iT+v1PGXC4fSL/OJqsKhfK//v8P+w9ThKIoqNbEnsZqNy+WDnwQqCA==}
engines: {node: '>= 10'}
cpu: [arm64]
os: [linux]
libc: [musl]
'@tailwindcss/oxide-linux-x64-gnu@4.1.12':
resolution: {integrity: sha512-xYfqYLjvm2UQ3TZggTGrwxjYaLB62b1Wiysw/YE3Yqbh86sOMoTn0feF98PonP7LtjsWOWcXEbGqDL7zv0uW8Q==}
engines: {node: '>= 10'}
cpu: [x64]
os: [linux]
libc: [glibc]
'@tailwindcss/oxide-linux-x64-musl@4.1.12':
resolution: {integrity: sha512-ha0pHPamN+fWZY7GCzz5rKunlv9L5R8kdh+YNvP5awe3LtuXb5nRi/H27GeL2U+TdhDOptU7T6Is7mdwh5Ar3A==}
engines: {node: '>= 10'}
cpu: [x64]
os: [linux]
libc: [musl]
'@tailwindcss/oxide-wasm32-wasi@4.1.12':
resolution: {integrity: sha512-4tSyu3dW+ktzdEpuk6g49KdEangu3eCYoqPhWNsZgUhyegEda3M9rG0/j1GV/JjVVsj+lG7jWAyrTlLzd/WEBg==}
@@ -519,6 +543,12 @@ packages:
'@types/estree@1.0.8':
resolution: {integrity: sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==}
'@types/node@22.18.0':
resolution: {integrity: sha512-m5ObIqwsUp6BZzyiy4RdZpzWGub9bqLJMvZDD0QMXhxjqMHMENlj+SqF5QxoUwaQNFe+8kz8XM8ZQhqkQPTgMQ==}
'@types/postmate@1.5.4':
resolution: {integrity: sha512-eZBPKSmEF+0s7dL6htpj3PJdVw9rbdsUXpydGpyQ+PhRPyuTJF1XsHm2thahXIKaHQnqzG2GUaY6m9xNK0sOeA==}
'@types/react-dom@19.1.8':
resolution: {integrity: sha512-xG7xaBMJCpcK0RpN8jDbAACQo54ycO6h4dSSmgv8+fu6ZIAdANkx/WsawASUjVXYfy+J9AbUpRMNNEsXCDfDBQ==}
peerDependencies:
@@ -655,24 +685,28 @@ packages:
engines: {node: '>= 12.0.0'}
cpu: [arm64]
os: [linux]
libc: [glibc]
lightningcss-linux-arm64-musl@1.30.1:
resolution: {integrity: sha512-jmUQVx4331m6LIX+0wUhBbmMX7TCfjF5FoOH6SD1CttzuYlGNVpA7QnrmLxrsub43ClTINfGSYyHe2HWeLl5CQ==}
engines: {node: '>= 12.0.0'}
cpu: [arm64]
os: [linux]
libc: [musl]
lightningcss-linux-x64-gnu@1.30.1:
resolution: {integrity: sha512-piWx3z4wN8J8z3+O5kO74+yr6ze/dKmPnI7vLqfSqI8bccaTGY5xiSGVIJBDd5K5BHlvVLpUB3S2YCfelyJ1bw==}
engines: {node: '>= 12.0.0'}
cpu: [x64]
os: [linux]
libc: [glibc]
lightningcss-linux-x64-musl@1.30.1:
resolution: {integrity: sha512-rRomAK7eIkL+tHY0YPxbc5Dra2gXlI63HL+v1Pdi1a3sC+tJTcFrHX+E86sulgAXeI7rSzDYhPSeHHjqFhqfeQ==}
engines: {node: '>= 12.0.0'}
cpu: [x64]
os: [linux]
libc: [musl]
lightningcss-win32-arm64-msvc@1.30.1:
resolution: {integrity: sha512-mSL4rqPi4iXq5YVqzSsJgMVFENoa4nGTT/GjO2c0Yl9OuQfPsIfncvLrEW6RbbB24WtZ3xP/2CCmI3tNkNV4oA==}
@@ -731,6 +765,9 @@ packages:
resolution: {integrity: sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==}
engines: {node: ^10 || ^12 || >=14}
postmate@1.5.2:
resolution: {integrity: sha512-EHLlEmrUA/hALls49oBrtE7BzDXXjB9EiO4MZpsoO3R/jRuBmD+2WKQuYAbeuVEpTzrPpUTT79z2cz4qaFgPRg==}
react-dom@19.1.1:
resolution: {integrity: sha512-Dlq/5LAZgF0Gaz6yiqZCf6VCcZs1ghAJyrsu84Q/GT0gV+mCxbfmKNoGRKBYMJ8IEdGPqu49YWXD02GCknEDkw==}
peerDependencies:
@@ -793,6 +830,9 @@ packages:
engines: {node: '>=14.17'}
hasBin: true
undici-types@6.21.0:
resolution: {integrity: sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==}
update-browserslist-db@1.1.3:
resolution: {integrity: sha512-UxhIZQ+QInVdunkDAaiazvvT/+fXL5Osr0JZlJulepYu6Jd7qJtDZjlur0emRlT71EN3ScPoE7gvsuIKKNavKw==}
hasBin: true
@@ -1210,12 +1250,12 @@ snapshots:
'@tailwindcss/oxide-win32-arm64-msvc': 4.1.12
'@tailwindcss/oxide-win32-x64-msvc': 4.1.12
'@tailwindcss/vite@4.1.12(vite@7.1.3(jiti@2.5.1)(lightningcss@1.30.1))':
'@tailwindcss/vite@4.1.12(vite@7.1.3(@types/node@22.18.0)(jiti@2.5.1)(lightningcss@1.30.1))':
dependencies:
'@tailwindcss/node': 4.1.12
'@tailwindcss/oxide': 4.1.12
tailwindcss: 4.1.12
vite: 7.1.3(jiti@2.5.1)(lightningcss@1.30.1)
vite: 7.1.3(@types/node@22.18.0)(jiti@2.5.1)(lightningcss@1.30.1)
'@types/babel__core@7.20.5':
dependencies:
@@ -1240,6 +1280,12 @@ snapshots:
'@types/estree@1.0.8': {}
'@types/node@22.18.0':
dependencies:
undici-types: 6.21.0
'@types/postmate@1.5.4': {}
'@types/react-dom@19.1.8(@types/react@19.1.12)':
dependencies:
'@types/react': 19.1.12
@@ -1248,7 +1294,7 @@ snapshots:
dependencies:
csstype: 3.1.3
'@vitejs/plugin-react@5.0.2(vite@7.1.3(jiti@2.5.1)(lightningcss@1.30.1))':
'@vitejs/plugin-react@5.0.2(vite@7.1.3(@types/node@22.18.0)(jiti@2.5.1)(lightningcss@1.30.1))':
dependencies:
'@babel/core': 7.28.3
'@babel/plugin-transform-react-jsx-self': 7.27.1(@babel/core@7.28.3)
@@ -1256,7 +1302,7 @@ snapshots:
'@rolldown/pluginutils': 1.0.0-beta.34
'@types/babel__core': 7.20.5
react-refresh: 0.17.0
vite: 7.1.3(jiti@2.5.1)(lightningcss@1.30.1)
vite: 7.1.3(@types/node@22.18.0)(jiti@2.5.1)(lightningcss@1.30.1)
transitivePeerDependencies:
- supports-color
@@ -1419,6 +1465,8 @@ snapshots:
picocolors: 1.1.1
source-map-js: 1.2.1
postmate@1.5.2: {}
react-dom@19.1.1(react@19.1.1):
dependencies:
react: 19.1.1
@@ -1490,13 +1538,15 @@ snapshots:
typescript@5.8.3: {}
undici-types@6.21.0: {}
update-browserslist-db@1.1.3(browserslist@4.25.3):
dependencies:
browserslist: 4.25.3
escalade: 3.2.0
picocolors: 1.1.1
vite@7.1.3(jiti@2.5.1)(lightningcss@1.30.1):
vite@7.1.3(@types/node@22.18.0)(jiti@2.5.1)(lightningcss@1.30.1):
dependencies:
esbuild: 0.25.9
fdir: 6.5.0(picomatch@4.0.3)
@@ -1505,6 +1555,7 @@ snapshots:
rollup: 4.49.0
tinyglobby: 0.2.14
optionalDependencies:
'@types/node': 22.18.0
fsevents: 2.3.3
jiti: 2.5.1
lightningcss: 1.30.1

View File

@@ -1,9 +1,10 @@
import { StrictMode } from "react";
import { createRoot } from "react-dom/client";
import "./index.css";
import { ReactRouterProvider } from "./providers/RouterPorvider.tsx";
import { StrictMode } from 'react';
import { createRoot } from 'react-dom/client';
import '@/styles/fonts.css';
import '@/styles/global.css';
import { ReactRouterProvider } from './providers/RouterPorvider.tsx';
createRoot(document.getElementById("root")!).render(
createRoot(document.getElementById('root')!).render(
<StrictMode>
<ReactRouterProvider />
</StrictMode>,

View File

@@ -0,0 +1,5 @@
---
description:
globs:
alwaysApply: false
---

View File

View File

@@ -1,8 +1,8 @@
import "./index.css";
import { useGlobalStore } from "@/store/global";
import './index.css';
// import { useGlobalStore } from "@/store/global";
function About() {
const { count, increment } = useGlobalStore((state) => state);
// const { count, increment } = useGlobalStore((state) => state);
return <div>about page</div>;
}

View File

View File

@@ -1,13 +1,29 @@
import "./index.css";
import { useGlobalStore } from "@/store/global";
import Postmate from 'postmate';
import { useEffect } from 'react';
import { useGlobalStore } from '@/store/global';
import './index.css';
function Home() {
const { count, increment } = useGlobalStore((state) => state);
console.log('count', count);
useEffect(() => {
const handshake = new Postmate.Model({
// Expose your model to the Parent. Property values may be functions, promises, or regular values
height: () => (document as any).height || (document.body as any).offsetHeight,
});
// When parent <-> child handshake is complete, events may be emitted to the parent
handshake.then((parent) => {
parent.emit('some-event', 'Hello, World!');
});
}, []);
return (
<>
<div>
<div className="text-3xl font-bold underline">Hello World</div>
<div className="text-3xl font-bold underline">Hello World2</div>
</div>
<h1>Vite + React</h1>
<button type="button" onClick={increment}>

View File

@@ -1,15 +1,15 @@
import { createBrowserRouter } from "react-router";
import { RouterProvider } from "react-router/dom";
import Home from "@/pages/home";
import About from "@/pages/about";
import { createBrowserRouter } from 'react-router';
import { RouterProvider } from 'react-router/dom';
import About from '@/pages/about';
import Home from '@/pages/home';
const router = createBrowserRouter([
{
path: "/",
path: '/',
element: <Home />,
},
{
path: "/about",
path: '/about',
element: <About />,
},
]);

View File

@@ -0,0 +1,5 @@
---
description:
globs:
alwaysApply: false
---

View File

@@ -1,4 +1,4 @@
import { create } from "zustand";
import { create } from 'zustand';
type GlobalState = {
count: number;
@@ -7,5 +7,8 @@ type GlobalState = {
export const useGlobalStore = create<GlobalState>((set) => ({
count: 0,
increment: () => set((state) => ({ count: state.count + 1 })),
increment: () => {
console.log('increment');
set((state) => ({ count: state.count + 1 }));
},
}));

0
src/styles/fonts.css Normal file
View File

View File

@@ -1,14 +1,14 @@
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import tailwindcss from "@tailwindcss/vite";
import path from "path";
import tailwindcss from '@tailwindcss/vite';
import react from '@vitejs/plugin-react';
import path from 'path';
import { defineConfig } from 'vite';
// https://vite.dev/config/
export default defineConfig({
plugins: [react(), tailwindcss()],
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
'@': path.resolve(__dirname, './src'),
},
},
});