parent
8c63295043
commit
e76a19931c
@ -1,24 +0,0 @@ |
||||
# Logs |
||||
logs |
||||
*.log |
||||
npm-debug.log* |
||||
yarn-debug.log* |
||||
yarn-error.log* |
||||
pnpm-debug.log* |
||||
lerna-debug.log* |
||||
|
||||
node_modules |
||||
dist |
||||
dist-ssr |
||||
*.local |
||||
|
||||
# Editor directories and files |
||||
.vscode/* |
||||
!.vscode/extensions.json |
||||
.idea |
||||
.DS_Store |
||||
*.suo |
||||
*.ntvs* |
||||
*.njsproj |
||||
*.sln |
||||
*.sw? |
@ -1,69 +0,0 @@ |
||||
# React + TypeScript + Vite |
||||
|
||||
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules. |
||||
|
||||
Currently, two official plugins are available: |
||||
|
||||
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) for Fast Refresh |
||||
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh |
||||
|
||||
## Expanding the ESLint configuration |
||||
|
||||
If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules: |
||||
|
||||
```js |
||||
export default tseslint.config([ |
||||
globalIgnores(['dist']), |
||||
{ |
||||
files: ['**/*.{ts,tsx}'], |
||||
extends: [ |
||||
// Other configs... |
||||
|
||||
// Remove tseslint.configs.recommended and replace with this |
||||
...tseslint.configs.recommendedTypeChecked, |
||||
// Alternatively, use this for stricter rules |
||||
...tseslint.configs.strictTypeChecked, |
||||
// Optionally, add this for stylistic rules |
||||
...tseslint.configs.stylisticTypeChecked, |
||||
|
||||
// Other configs... |
||||
], |
||||
languageOptions: { |
||||
parserOptions: { |
||||
project: ['./tsconfig.node.json', './tsconfig.app.json'], |
||||
tsconfigRootDir: import.meta.dirname, |
||||
}, |
||||
// other options... |
||||
}, |
||||
}, |
||||
]) |
||||
``` |
||||
|
||||
You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules: |
||||
|
||||
```js |
||||
// eslint.config.js |
||||
import reactX from 'eslint-plugin-react-x' |
||||
import reactDom from 'eslint-plugin-react-dom' |
||||
|
||||
export default tseslint.config([ |
||||
globalIgnores(['dist']), |
||||
{ |
||||
files: ['**/*.{ts,tsx}'], |
||||
extends: [ |
||||
// Other configs... |
||||
// Enable lint rules for React |
||||
reactX.configs['recommended-typescript'], |
||||
// Enable lint rules for React DOM |
||||
reactDom.configs.recommended, |
||||
], |
||||
languageOptions: { |
||||
parserOptions: { |
||||
project: ['./tsconfig.node.json', './tsconfig.app.json'], |
||||
tsconfigRootDir: import.meta.dirname, |
||||
}, |
||||
// other options... |
||||
}, |
||||
}, |
||||
]) |
||||
``` |
@ -1,23 +0,0 @@ |
||||
import js from '@eslint/js' |
||||
import globals from 'globals' |
||||
import reactHooks from 'eslint-plugin-react-hooks' |
||||
import reactRefresh from 'eslint-plugin-react-refresh' |
||||
import tseslint from 'typescript-eslint' |
||||
import { globalIgnores } from 'eslint/config' |
||||
|
||||
export default tseslint.config([ |
||||
globalIgnores(['dist']), |
||||
{ |
||||
files: ['**/*.{ts,tsx}'], |
||||
extends: [ |
||||
js.configs.recommended, |
||||
tseslint.configs.recommended, |
||||
reactHooks.configs['recommended-latest'], |
||||
reactRefresh.configs.vite, |
||||
], |
||||
languageOptions: { |
||||
ecmaVersion: 2020, |
||||
globals: globals.browser, |
||||
}, |
||||
}, |
||||
]) |
@ -1,13 +0,0 @@ |
||||
<!doctype html> |
||||
<html lang="en"> |
||||
<head> |
||||
<meta charset="UTF-8" /> |
||||
<link rel="icon" type="image/svg+xml" href="/vite.svg" /> |
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
||||
<title>Vite + React + TS</title> |
||||
</head> |
||||
<body> |
||||
<div id="root"></div> |
||||
<script type="module" src="/src/main.tsx"></script> |
||||
</body> |
||||
</html> |
@ -1,29 +0,0 @@ |
||||
{ |
||||
"name": "temptest", |
||||
"private": true, |
||||
"version": "0.0.0", |
||||
"type": "module", |
||||
"scripts": { |
||||
"dev": "vite", |
||||
"build": "tsc -b && vite build", |
||||
"lint": "eslint .", |
||||
"preview": "vite preview" |
||||
}, |
||||
"dependencies": { |
||||
"react": "^19.1.1", |
||||
"react-dom": "^19.1.1" |
||||
}, |
||||
"devDependencies": { |
||||
"@eslint/js": "^9.33.0", |
||||
"@types/react": "^19.1.10", |
||||
"@types/react-dom": "^19.1.7", |
||||
"@vitejs/plugin-react": "^5.0.0", |
||||
"eslint": "^9.33.0", |
||||
"eslint-plugin-react-hooks": "^5.2.0", |
||||
"eslint-plugin-react-refresh": "^0.4.20", |
||||
"globals": "^16.3.0", |
||||
"typescript": "~5.8.3", |
||||
"typescript-eslint": "^8.39.1", |
||||
"vite": "^7.1.2" |
||||
} |
||||
} |
Before Width: | Height: | Size: 1.5 KiB |
@ -1,42 +0,0 @@ |
||||
#root { |
||||
max-width: 1280px; |
||||
margin: 0 auto; |
||||
padding: 2rem; |
||||
text-align: center; |
||||
} |
||||
|
||||
.logo { |
||||
height: 6em; |
||||
padding: 1.5em; |
||||
will-change: filter; |
||||
transition: filter 300ms; |
||||
} |
||||
.logo:hover { |
||||
filter: drop-shadow(0 0 2em #646cffaa); |
||||
} |
||||
.logo.react:hover { |
||||
filter: drop-shadow(0 0 2em #61dafbaa); |
||||
} |
||||
|
||||
@keyframes logo-spin { |
||||
from { |
||||
transform: rotate(0deg); |
||||
} |
||||
to { |
||||
transform: rotate(360deg); |
||||
} |
||||
} |
||||
|
||||
@media (prefers-reduced-motion: no-preference) { |
||||
a:nth-of-type(2) .logo { |
||||
animation: logo-spin infinite 20s linear; |
||||
} |
||||
} |
||||
|
||||
.card { |
||||
padding: 2em; |
||||
} |
||||
|
||||
.read-the-docs { |
||||
color: #888; |
||||
} |
@ -1,112 +0,0 @@ |
||||
import { useState, type FunctionComponent } from "react"; |
||||
import { useResource, useChangeSubject, useSubject } from "../../../solid-react"; |
||||
import { SolidProfileShapeShapeType } from "../../test/.ldo/solidProfile.shapeTypes.js"; |
||||
import { set } from "@ldo/ldo"; |
||||
|
||||
const FormTest: FunctionComponent = () => { |
||||
const randomResource = useResource("http://example.com/resource.ttl"); |
||||
const submittedData = useSubject(SolidProfileShapeShapeType, "Example0"); |
||||
|
||||
const [count, setCount] = useState(1); |
||||
|
||||
const [data, setData, commitData] = useChangeSubject( |
||||
SolidProfileShapeShapeType, |
||||
"Example0", |
||||
); |
||||
|
||||
return ( |
||||
<div> |
||||
<h1>Form</h1> |
||||
<button onClick={() => setCount(count + 1)}>Rerender {count}</button> |
||||
<form |
||||
onSubmit={async (e) => { |
||||
e.preventDefault(); |
||||
const result = await commitData(); |
||||
}} |
||||
> |
||||
{/* Primary name field */} |
||||
<input |
||||
aria-label="Name" |
||||
value={data?.fn ?? ""} |
||||
onChange={(e) => { |
||||
setData(randomResource, (profile) => { |
||||
profile.fn = e.target.value; |
||||
}) |
||||
}} |
||||
/> |
||||
|
||||
{/* Friends */} |
||||
{data?.knows?.map((person) => ( |
||||
<div key={person["@id"]} data-testid={`friend-${person["@id"]}`}> |
||||
<p>{person["@id"]}</p> |
||||
<input |
||||
aria-label={`Friend name for ${person["@id"]}`} |
||||
value={person?.fn ?? ""} |
||||
onChange={(e) => |
||||
setData(randomResource, (p) => { |
||||
p.fn = e.target.value; |
||||
}, person) |
||||
} |
||||
/> |
||||
<button |
||||
type="button" |
||||
onClick={() => { |
||||
setData(randomResource, (cData) => { |
||||
cData.knows?.delete(person); |
||||
}); |
||||
}} |
||||
> |
||||
Remove Friend |
||||
</button> |
||||
</div> |
||||
))} |
||||
|
||||
<button |
||||
type="button" |
||||
onClick={() => { |
||||
// Auto-generate deterministic IDs: Example1, Example2, ...
|
||||
const friendId = `Example${count}`; |
||||
setCount(count + 1); |
||||
setData(randomResource, (cData) => { |
||||
cData.knows?.add({ |
||||
"@id": friendId, |
||||
type: set({ "@id": "Person" }), |
||||
inbox: { "@id": "someInbox" }, |
||||
}); |
||||
}); |
||||
}} |
||||
> |
||||
Add Friend |
||||
</button> |
||||
|
||||
<input type="submit" value="Submit" /> |
||||
</form> |
||||
|
||||
<hr /> |
||||
|
||||
{/* Committed view */} |
||||
<h1>Submitted Data</h1> |
||||
<section aria-label="Submitted Data"> |
||||
<p data-testid="submitted-name">Name: {submittedData?.fn ?? ""}</p> |
||||
<ul data-testid="submitted-list"> |
||||
{submittedData?.knows?.map((person) => ( |
||||
<li key={person["@id"]}> |
||||
Id: {person["@id"]} Name: {person.fn} |
||||
</li> |
||||
))} |
||||
</ul> |
||||
</section> |
||||
</div> |
||||
); |
||||
}; |
||||
|
||||
function App() { |
||||
|
||||
return ( |
||||
<div> |
||||
<FormTest /> |
||||
</div> |
||||
) |
||||
} |
||||
|
||||
export default App |
Before Width: | Height: | Size: 4.0 KiB |
@ -1,72 +0,0 @@ |
||||
:root { |
||||
font-family: system-ui, Avenir, Helvetica, Arial, sans-serif; |
||||
line-height: 1.5; |
||||
font-weight: 400; |
||||
|
||||
color-scheme: light dark; |
||||
color: rgba(255, 255, 255, 0.87); |
||||
background-color: #242424; |
||||
|
||||
font-synthesis: none; |
||||
text-rendering: optimizeLegibility; |
||||
-webkit-font-smoothing: antialiased; |
||||
-moz-osx-font-smoothing: grayscale; |
||||
} |
||||
|
||||
a { |
||||
font-weight: 500; |
||||
color: #646cff; |
||||
text-decoration: inherit; |
||||
} |
||||
|
||||
a:hover { |
||||
color: #535bf2; |
||||
} |
||||
|
||||
body { |
||||
margin: 0; |
||||
display: flex; |
||||
min-width: 320px; |
||||
min-height: 100vh; |
||||
} |
||||
|
||||
h1 { |
||||
font-size: 3.2em; |
||||
line-height: 1.1; |
||||
} |
||||
|
||||
button { |
||||
border-radius: 8px; |
||||
border: 1px solid transparent; |
||||
padding: 0.6em 1.2em; |
||||
font-size: 1em; |
||||
font-weight: 500; |
||||
font-family: inherit; |
||||
background-color: #1a1a1a; |
||||
cursor: pointer; |
||||
transition: border-color 0.25s; |
||||
} |
||||
|
||||
button:hover { |
||||
border-color: #646cff; |
||||
} |
||||
|
||||
button:focus, |
||||
button:focus-visible { |
||||
outline: 4px auto -webkit-focus-ring-color; |
||||
} |
||||
|
||||
@media (prefers-color-scheme: light) { |
||||
:root { |
||||
color: #213547; |
||||
background-color: #ffffff; |
||||
} |
||||
|
||||
a:hover { |
||||
color: #747bff; |
||||
} |
||||
|
||||
button { |
||||
background-color: #f9f9f9; |
||||
} |
||||
} |
@ -1,7 +0,0 @@ |
||||
import { createRoot } from 'react-dom/client' |
||||
import './index.css' |
||||
import App from './App.tsx' |
||||
|
||||
createRoot(document.getElementById('root')!).render( |
||||
<App /> |
||||
) |
@ -1 +0,0 @@ |
||||
/// <reference types="vite/client" />
|
@ -1,27 +0,0 @@ |
||||
{ |
||||
"compilerOptions": { |
||||
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo", |
||||
"target": "ES2022", |
||||
"useDefineForClassFields": true, |
||||
"lib": ["ES2022", "DOM", "DOM.Iterable"], |
||||
"module": "ESNext", |
||||
"skipLibCheck": true, |
||||
|
||||
/* Bundler mode */ |
||||
"moduleResolution": "bundler", |
||||
"allowImportingTsExtensions": true, |
||||
"verbatimModuleSyntax": true, |
||||
"moduleDetection": "force", |
||||
"noEmit": true, |
||||
"jsx": "react-jsx", |
||||
|
||||
/* Linting */ |
||||
"strict": true, |
||||
"noUnusedLocals": true, |
||||
"noUnusedParameters": true, |
||||
"erasableSyntaxOnly": true, |
||||
"noFallthroughCasesInSwitch": true, |
||||
"noUncheckedSideEffectImports": true |
||||
}, |
||||
"include": ["src"] |
||||
} |
@ -1,7 +0,0 @@ |
||||
{ |
||||
"files": [], |
||||
"references": [ |
||||
{ "path": "./tsconfig.app.json" }, |
||||
{ "path": "./tsconfig.node.json" } |
||||
] |
||||
} |
@ -1,25 +0,0 @@ |
||||
{ |
||||
"compilerOptions": { |
||||
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo", |
||||
"target": "ES2023", |
||||
"lib": ["ES2023"], |
||||
"module": "ESNext", |
||||
"skipLibCheck": true, |
||||
|
||||
/* Bundler mode */ |
||||
"moduleResolution": "bundler", |
||||
"allowImportingTsExtensions": true, |
||||
"verbatimModuleSyntax": true, |
||||
"moduleDetection": "force", |
||||
"noEmit": true, |
||||
|
||||
/* Linting */ |
||||
"strict": true, |
||||
"noUnusedLocals": true, |
||||
"noUnusedParameters": true, |
||||
"erasableSyntaxOnly": true, |
||||
"noFallthroughCasesInSwitch": true, |
||||
"noUncheckedSideEffectImports": true |
||||
}, |
||||
"include": ["vite.config.ts"] |
||||
} |
@ -1,7 +0,0 @@ |
||||
import { defineConfig } from 'vite' |
||||
import react from '@vitejs/plugin-react' |
||||
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig({ |
||||
plugins: [react()], |
||||
}) |
Loading…
Reference in new issue