From 272c87f799bac9737de996e08bb7abdf8c40fc87 Mon Sep 17 00:00:00 2001 From: rex Date: Mon, 1 Sep 2025 20:01:21 +0800 Subject: [PATCH] init --- .cursor/mcp.json | 8 +++ .cursor/rules/project/general.mdc | 5 ++ .cursor/rules/project/style.mdc | 5 ++ .gitignore | 2 + .npmrc | 1 + biome.json | 16 +++--- package.json | 8 +++ pnpm-lock.yaml | 67 ++++++++++++++++++++++--- src/main.tsx | 11 ++-- src/pages/.cursor/rules/pages_rules.mdc | 5 ++ src/pages/about/components/.gitkeep | 0 src/pages/about/index.tsx | 6 +-- src/pages/home/components/.gitkeep | 0 src/pages/home/index.tsx | 22 ++++++-- src/providers/RouterPorvider.tsx | 12 ++--- src/store/.cursor/rules/store_rules.mdc | 5 ++ src/store/global.tsx | 7 ++- src/styles/fonts.css | 0 src/{index.css => styles/global.css} | 0 vite.config.ts | 10 ++-- 20 files changed, 150 insertions(+), 40 deletions(-) create mode 100644 .cursor/mcp.json create mode 100644 .cursor/rules/project/general.mdc create mode 100644 .cursor/rules/project/style.mdc create mode 100644 .npmrc create mode 100644 src/pages/.cursor/rules/pages_rules.mdc create mode 100644 src/pages/about/components/.gitkeep create mode 100644 src/pages/home/components/.gitkeep create mode 100644 src/store/.cursor/rules/store_rules.mdc create mode 100644 src/styles/fonts.css rename src/{index.css => styles/global.css} (100%) diff --git a/.cursor/mcp.json b/.cursor/mcp.json new file mode 100644 index 0000000..03db0a1 --- /dev/null +++ b/.cursor/mcp.json @@ -0,0 +1,8 @@ +{ + "mcpServers": { + "assistant-ui": { + "command": "npx", + "args": ["-y", "@assistant-ui/mcp-docs-server"] + } + } +} diff --git a/.cursor/rules/project/general.mdc b/.cursor/rules/project/general.mdc new file mode 100644 index 0000000..b93c988 --- /dev/null +++ b/.cursor/rules/project/general.mdc @@ -0,0 +1,5 @@ +--- +description: +globs: +alwaysApply: false +--- diff --git a/.cursor/rules/project/style.mdc b/.cursor/rules/project/style.mdc new file mode 100644 index 0000000..b93c988 --- /dev/null +++ b/.cursor/rules/project/style.mdc @@ -0,0 +1,5 @@ +--- +description: +globs: +alwaysApply: false +--- diff --git a/.gitignore b/.gitignore index a547bf3..a63274b 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,5 @@ dist-ssr *.njsproj *.sln *.sw? + +*.zip \ No newline at end of file diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..7f082f2 --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +registry=https://registry.npmmirror.com \ No newline at end of file diff --git a/biome.json b/biome.json index 531d679..3358a1d 100644 --- a/biome.json +++ b/biome.json @@ -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": [ diff --git a/package.json b/package.json index cbbbd13..b4de61d 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3dc4861..0e620b6 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -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 diff --git a/src/main.tsx b/src/main.tsx index 8150d29..88d8d3c 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -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( , diff --git a/src/pages/.cursor/rules/pages_rules.mdc b/src/pages/.cursor/rules/pages_rules.mdc new file mode 100644 index 0000000..b93c988 --- /dev/null +++ b/src/pages/.cursor/rules/pages_rules.mdc @@ -0,0 +1,5 @@ +--- +description: +globs: +alwaysApply: false +--- diff --git a/src/pages/about/components/.gitkeep b/src/pages/about/components/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/src/pages/about/index.tsx b/src/pages/about/index.tsx index 163f89b..fb278f9 100644 --- a/src/pages/about/index.tsx +++ b/src/pages/about/index.tsx @@ -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
about page
; } diff --git a/src/pages/home/components/.gitkeep b/src/pages/home/components/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/src/pages/home/index.tsx b/src/pages/home/index.tsx index 98cadb6..8dc5e5c 100644 --- a/src/pages/home/index.tsx +++ b/src/pages/home/index.tsx @@ -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 ( <>
-
Hello World
+
Hello World2

Vite + React