@pinkaphant/create-kolmo 0.3.0 → 0.3.2

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/README.md CHANGED
@@ -2,15 +2,31 @@
2
2
 
3
3
  Scaffold a playable Kolmo game with React, TypeScript, Vite, and Rapier.
4
4
 
5
- ## Nautical towing game
5
+ ## Longline, the tugboat
6
6
 
7
7
  ```bash
8
- npx @pinkaphant/create-kolmo@latest my-longline-game --template longline
8
+ npm create @pinkaphant/kolmo@latest my-longline-game -- --template longline
9
9
  cd my-longline-game
10
10
  npm run dev
11
11
  ```
12
12
 
13
- Longline includes the complete deterministic sea simulation, boat controls, tow line, collectible crates, radar, camera modes, and HUD. **WASD** or the **arrow keys** steer the boat.
13
+ Longline is the water demo: sea, boat, tow line, crates, radar, HUD. **WASD** or the arrow keys steer the boat. It stays that game.
14
+
15
+ ## Lonedrive
16
+
17
+ ```bash
18
+ npm create @pinkaphant/kolmo@latest my-drive -- --template lonedrive
19
+ ```
20
+
21
+ A long seeded road and one car. Respectful spoof of The Long Drive. Not the tugboat.
22
+
23
+ ## Dust
24
+
25
+ ```bash
26
+ npm create @pinkaphant/kolmo@latest my-dust -- --template dust
27
+ ```
28
+
29
+ An island, a body, and a scrap car. Facepunch Rust in spirit. **WASD** walks. **E** or **F** boards.
14
30
 
15
31
  ## Road and vehicle sandbox
16
32
 
@@ -18,8 +18,8 @@ for (let i = 0; i < args.length; i++) {
18
18
  template = a.slice("--template=".length);
19
19
  } else if (a === "-h" || a === "--help") {
20
20
  console.log(
21
- "Usage: npm create @pinkaphant/kolmo@latest <project-dir> [--template road|longline] [--no-install]\n" +
22
- " or: npx @pinkaphant/create-kolmo@latest <project-dir> [--template road|longline] [--no-install]",
21
+ "Usage: npm create @pinkaphant/kolmo@latest <project-dir> [--template road|longline|lonedrive|dust] [--no-install]\n" +
22
+ " or: npx @pinkaphant/create-kolmo@latest <project-dir> [--template road|longline|lonedrive|dust] [--no-install]",
23
23
  );
24
24
  process.exit(0);
25
25
  } else if (!a.startsWith("-") && !targetArg) {
@@ -30,8 +30,15 @@ for (let i = 0; i < args.length; i++) {
30
30
  }
31
31
  }
32
32
 
33
- if (template !== "road" && template !== "longline") {
34
- console.error(`Error: Unknown template "${template}". Available templates: road, longline.`);
33
+ const TEMPLATE_DIR = {
34
+ road: "road",
35
+ longline: "longline",
36
+ lonedrive: "lonedrive",
37
+ dust: "dust",
38
+ };
39
+
40
+ if (!Object.hasOwn(TEMPLATE_DIR, template)) {
41
+ console.error(`Error: Unknown template "${template}". Available templates: ${Object.keys(TEMPLATE_DIR).join(", ")}.`);
35
42
  process.exit(1);
36
43
  }
37
44
 
@@ -48,221 +55,31 @@ if (fs.existsSync(root) && fs.readdirSync(root).length > 0) {
48
55
  process.exit(1);
49
56
  }
50
57
 
51
- function finishProject() {
52
- console.log(`\nScaffolded Kolmo ${template} project in ${root}`);
58
+ const templateRoot = path.resolve(import.meta.dirname, "../templates", TEMPLATE_DIR[template]);
59
+ fs.cpSync(templateRoot, root, { recursive: true });
53
60
 
54
- if (!skipInstall) {
55
- console.log("Installing dependencies with npm...");
56
- const res = spawnSync("npm", ["install"], { cwd: root, stdio: "inherit", shell: process.platform === "win32" });
57
- if (res.status !== 0) {
58
- console.error("\nnpm install exited with an error. Run `npm install` inside the project directory.");
59
- process.exit(res.status ?? 1);
60
- }
61
- }
62
-
63
- console.log(`\nReady! Next steps:\n cd ${dirName}\n npm run dev\n`);
64
- }
61
+ const templatePkgPath = path.join(root, "package.json");
62
+ const templatePkg = JSON.parse(fs.readFileSync(templatePkgPath, "utf8"));
63
+ templatePkg.name = pkgName;
64
+ fs.writeFileSync(templatePkgPath, JSON.stringify(templatePkg, null, 2) + "\n");
65
65
 
66
- if (template === "longline") {
67
- const templateRoot = path.resolve(import.meta.dirname, "../templates/longline");
68
- fs.cpSync(templateRoot, root, { recursive: true });
69
- const templatePkgPath = path.join(root, "package.json");
70
- const templatePkg = JSON.parse(fs.readFileSync(templatePkgPath, "utf8"));
71
- templatePkg.name = pkgName;
72
- fs.writeFileSync(templatePkgPath, JSON.stringify(templatePkg, null, 2) + "\n");
73
- fs.writeFileSync(path.join(root, ".gitignore"), "node_modules/\ndist/\n.DS_Store\n*.local\n");
74
- finishProject();
75
- process.exit(0);
66
+ const indexHtmlPath = path.join(root, "index.html");
67
+ if (fs.existsSync(indexHtmlPath)) {
68
+ const html = fs.readFileSync(indexHtmlPath, "utf8").replace(/<title>Kolmo Road<\/title>/, `<title>${pkgName}</title>`);
69
+ fs.writeFileSync(indexHtmlPath, html);
76
70
  }
77
71
 
78
- fs.mkdirSync(path.join(root, "src"), { recursive: true });
79
-
80
- const pkgJson = {
81
- name: pkgName,
82
- version: "0.1.0",
83
- private: true,
84
- type: "module",
85
- scripts: {
86
- dev: "vite",
87
- typecheck: "tsc --noEmit",
88
- build: "tsc --noEmit && vite build",
89
- preview: "vite preview",
90
- },
91
- dependencies: {
92
- "@dimforge/rapier3d-compat": "0.19.2",
93
- "@khr3/c12": "^0.4.0",
94
- "@khr3/core": "^0.2.16",
95
- "@khr3/roads": "^0.1.1",
96
- "@pinkaphant/ecctrl": "2.0.4-beta.6",
97
- "@pinkaphant/kolmo": "^0.10.0",
98
- "@react-three/fiber": "^9.6.1",
99
- "@react-three/rapier": "^2.2.0",
100
- koota: "^0.6.6",
101
- react: "^19.2.7",
102
- "react-dom": "^19.2.7",
103
- three: "^0.184.0",
104
- },
105
- devDependencies: {
106
- "@types/react": "^19.2.16",
107
- "@types/react-dom": "^19.2.3",
108
- "@types/three": "^0.184.0",
109
- "@vitejs/plugin-react": "^6.0.0",
110
- typescript: "^5.8.3",
111
- vite: "^8.0.0",
112
- },
113
- };
114
-
115
- fs.writeFileSync(path.join(root, "package.json"), JSON.stringify(pkgJson, null, 2) + "\n");
116
-
117
- fs.writeFileSync(
118
- path.join(root, ".gitignore"),
119
- "node_modules/\ndist/\n.DS_Store\n*.local\n",
120
- );
121
-
122
- fs.writeFileSync(
123
- path.join(root, "tsconfig.json"),
124
- JSON.stringify(
125
- {
126
- compilerOptions: {
127
- target: "ES2022",
128
- lib: ["ES2022", "DOM", "DOM.Iterable"],
129
- module: "ESNext",
130
- moduleResolution: "bundler",
131
- jsx: "react-jsx",
132
- strict: true,
133
- noUnusedLocals: true,
134
- noUnusedParameters: true,
135
- skipLibCheck: true,
136
- isolatedModules: true,
137
- },
138
- include: ["src", "vite.config.ts"],
139
- },
140
- null,
141
- 2,
142
- ) + "\n",
143
- );
72
+ fs.writeFileSync(path.join(root, ".gitignore"), "node_modules/\ndist/\n.DS_Store\n*.local\n");
144
73
 
145
- fs.writeFileSync(
146
- path.join(root, "vite.config.ts"),
147
- `import { defineConfig } from "vite";
148
- import react from "@vitejs/plugin-react";
149
- import { KOLMO_SINGLETON_DEDUPE } from "@pinkaphant/kolmo/vite";
74
+ console.log(`\nScaffolded Kolmo ${template} project in ${root}`);
150
75
 
151
- export default defineConfig({
152
- plugins: [react()],
153
- resolve: {
154
- dedupe: KOLMO_SINGLETON_DEDUPE,
155
- },
156
- });
157
- `,
158
- );
159
-
160
- fs.writeFileSync(
161
- path.join(root, "index.html"),
162
- `<!doctype html>
163
- <html lang="en">
164
- <head>
165
- <meta charset="UTF-8" />
166
- <meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
167
- <title>${pkgName}</title>
168
- <style>
169
- html, body, #root { margin: 0; width: 100%; height: 100%; overflow: hidden; background: #090d16; }
170
- </style>
171
- </head>
172
- <body>
173
- <div id="root"></div>
174
- <script type="module" src="/src/main.tsx"></script>
175
- </body>
176
- </html>
177
- `,
178
- );
179
-
180
- fs.writeFileSync(
181
- path.join(root, "src", "App.tsx"),
182
- `import { useMemo, useRef } from "react";
183
- import {
184
- Game,
185
- Terrain,
186
- Actor,
187
- Vehicle,
188
- Prop,
189
- Toolgun,
190
- Hud,
191
- type EcctrlHandle,
192
- } from "@pinkaphant/kolmo";
193
- import { growRoad, makeTerrain, sampleRapierHeightfield, frontage } from "@khr3/roads";
194
-
195
- const VAULT = "https://khr3.optimuspi.workers.dev/assets";
196
-
197
- export default function App() {
198
- const actorRef = useRef<EcctrlHandle>(null);
199
-
200
- const { heights, startPos, lotPos } = useMemo(() => {
201
- const road = growRoad(42, {
202
- length: 600,
203
- halfWidth: 4.5,
204
- controlSpacing: 35,
205
- maxTurn: 0.28,
206
- maxGrade: 0.06,
207
- hilliness: 18,
208
- start: [0, 0, -140],
209
- });
210
- const land = makeTerrain(42, road, {
211
- amplitude: 12,
212
- noise: { wavelength: 140, octaves: 4, gain: 0.5, lacunarity: 2 },
213
- maxSlope: 0.55,
214
- minShoulder: 6,
215
- verge: 2,
216
- });
217
- const heights = sampleRapierHeightfield(land, [-160, 0, -160], 320, 128);
218
- const s0 = road.at(25).pos;
219
- const lot = frontage(road, { spacing: 24, setback: 3 })[0];
220
- return {
221
- heights,
222
- startPos: [s0[0], s0[1] + 1.4, s0[2]] as [number, number, number],
223
- lotPos: lot
224
- ? ([lot.front[0], lot.groundY, lot.front[2]] as [number, number, number])
225
- : ([10, 0, 20] as [number, number, number]),
226
- };
227
- }, []);
228
-
229
- return (
230
- <>
231
- <Game skybox="day">
232
- <Terrain heights={heights} segments={128} size={[320, 320]} />
233
- <Vehicle id="r34" src={\`\${VAULT}/cars/nissan_skyline_r34.glb\`} position={startPos} />
234
- <Prop src={\`\${VAULT}/city/door_hinged_single_900x2100.glb\`} position={lotPos} fixed />
235
- <Actor ref={actorRef} position={[startPos[0] - 3.2, startPos[1] + 0.8, startPos[2]]} />
236
- <Toolgun
237
- src={\`\${VAULT}/weapons/kolmogorov_pistol.glb\`}
238
- actorRef={actorRef}
239
- defaultArmedAsset={{
240
- id: "supra",
241
- name: "Supra A80",
242
- src: \`\${VAULT}/cars/toyota_supra_a80.glb\`,
243
- kind: "vehicle",
244
- }}
245
- />
246
- </Game>
247
- <Hud />
248
- </>
249
- );
76
+ if (!skipInstall) {
77
+ console.log("Installing dependencies with npm...");
78
+ const res = spawnSync("npm", ["install"], { cwd: root, stdio: "inherit", shell: process.platform === "win32" });
79
+ if (res.status !== 0) {
80
+ console.error("\nnpm install exited with an error. Run `npm install` inside the project directory.");
81
+ process.exit(res.status ?? 1);
82
+ }
250
83
  }
251
- `,
252
- );
253
-
254
- fs.writeFileSync(
255
- path.join(root, "src", "main.tsx"),
256
- `import React from "react";
257
- import { createRoot } from "react-dom/client";
258
- import App from "./App.js";
259
-
260
- createRoot(document.getElementById("root")!).render(
261
- <React.StrictMode>
262
- <App />
263
- </React.StrictMode>,
264
- );
265
- `,
266
- );
267
84
 
268
- finishProject();
85
+ console.log(`\nReady! Next steps:\n cd ${dirName}\n npm run dev\n`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pinkaphant/create-kolmo",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "Scaffold a new @pinkaphant/kolmo + @khr3/core + @khr3/roads + @khr3/c12 3D physics game in one command",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -0,0 +1,11 @@
1
+ # Dust
2
+
3
+ A coastal island surrounded by a Gerstner sea, an outpost fuel depot, a salvage terminal, a scrap car, and a toolgun. Facepunch Rust in spirit.
4
+
5
+ - **WASD** / **Arrows**: Walk or drive
6
+ - **E** / **F**: Board or exit the scrap hatchback
7
+ - **T** / **Right-Click**: Spawn armed vehicle
8
+
9
+ ```bash
10
+ npm create @pinkaphant/kolmo@latest my-dust -- --template dust
11
+ ```
@@ -0,0 +1,15 @@
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, viewport-fit=cover" />
6
+ <title>Dust</title>
7
+ <style>
8
+ html, body, #root { margin: 0; width: 100%; height: 100%; overflow: hidden; background: #14110e; }
9
+ </style>
10
+ </head>
11
+ <body>
12
+ <div id="root"></div>
13
+ <script type="module" src="/src/main.tsx"></script>
14
+ </body>
15
+ </html>
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "dust",
3
+ "version": "0.1.0",
4
+ "private": true,
5
+ "description": "Dust: a coastal island, rolling Gerstner sea, outpost cache, and scrap car on @pinkaphant/kolmo.",
6
+ "type": "module",
7
+ "scripts": {
8
+ "dev": "vite",
9
+ "typecheck": "tsc --noEmit",
10
+ "build": "tsc --noEmit && vite build",
11
+ "preview": "vite preview"
12
+ },
13
+ "dependencies": {
14
+ "@dimforge/rapier3d-compat": "0.19.2",
15
+ "@khr3/core": "^0.2.19",
16
+ "@pinkaphant/ecctrl": "2.0.4-beta.9",
17
+ "@pinkaphant/kolmo": "^0.10.0",
18
+ "@react-three/drei": "^10.7.7",
19
+ "@react-three/fiber": "^9.6.1",
20
+ "@react-three/rapier": "^2.2.0",
21
+ "koota": "^0.6.6",
22
+ "react": "^19.2.7",
23
+ "react-dom": "^19.2.7",
24
+ "three": "0.184.0"
25
+ },
26
+ "overrides": {
27
+ "@dimforge/rapier3d-compat": "0.19.2",
28
+ "@pinkaphant/ecctrl": "2.0.4-beta.9",
29
+ "three": "0.184.0"
30
+ },
31
+ "devDependencies": {
32
+ "@types/react": "^19.2.16",
33
+ "@types/react-dom": "^19.2.3",
34
+ "@types/three": "0.184.0",
35
+ "@vitejs/plugin-react": "^6.1.1",
36
+ "typescript": "^7.0.2",
37
+ "vite": "^8.3.0"
38
+ }
39
+ }
@@ -0,0 +1,163 @@
1
+ import { useEffect, useMemo, useRef } from "react";
2
+ import * as THREE from "three";
3
+ import { useFrame } from "@react-three/fiber";
4
+ import {
5
+ ACTOR_GROUND_CLEARANCE,
6
+ Actor,
7
+ Game,
8
+ Hud,
9
+ Prop,
10
+ Terrain,
11
+ Toolgun,
12
+ Vehicle,
13
+ type EcctrlHandle,
14
+ } from "@pinkaphant/kolmo";
15
+ import { WaveField, createWaveSpectrum } from "@pinkaphant/kolmo/water";
16
+ import { usePhysicsClock } from "@pinkaphant/kolmo/water/react";
17
+ import { sampleRapierHeightfield } from "@khr3/core";
18
+
19
+ const VAULT = "https://khr3.optimuspi.workers.dev/assets";
20
+ const SEA_SIZE = 576;
21
+ const SEA_SEGMENTS = 96;
22
+ const SUN = new THREE.Vector3(40, 60, 24).normalize();
23
+
24
+ const SEA_VERT = /* glsl */ `
25
+ uniform float uTime;
26
+ uniform vec2 uOrigin;
27
+ uniform float uLevel;
28
+ uniform vec4 uDirKW[6];
29
+ uniform vec4 uAmp[6];
30
+ varying vec3 vWorld;
31
+
32
+ void main() {
33
+ vec2 rest = position.xz + uOrigin;
34
+ vec3 p = vec3(rest.x, uLevel, rest.y);
35
+ for (int i = 0; i < 6; i++) {
36
+ vec4 d = uDirKW[i];
37
+ vec4 w = uAmp[i];
38
+ float theta = d.z * (d.x * rest.x + d.y * rest.y) - d.w * uTime + w.z;
39
+ p.x += w.w * d.x * cos(theta);
40
+ p.z += w.w * d.y * cos(theta);
41
+ p.y += w.x * sin(theta);
42
+ }
43
+ vWorld = p;
44
+ gl_Position = projectionMatrix * viewMatrix * vec4(p, 1.0);
45
+ }
46
+ `;
47
+
48
+ const SEA_FRAG = /* glsl */ `
49
+ uniform vec3 uSun;
50
+ uniform float uLevel;
51
+ uniform float uCrest;
52
+ varying vec3 vWorld;
53
+
54
+ void main() {
55
+ vec3 n = normalize(cross(dFdx(vWorld), dFdy(vWorld)));
56
+ if (n.y < 0.0) n = -n;
57
+ float lift = clamp((vWorld.y - uLevel) / max(uCrest, 0.05) * 0.5 + 0.5, 0.0, 1.0);
58
+ float diffuse = max(dot(n, uSun), 0.0);
59
+ vec3 col = mix(vec3(0.03, 0.20, 0.31), vec3(0.09, 0.54, 0.61), clamp(lift * 0.65 + diffuse * 0.28, 0.0, 1.0));
60
+ float foam = smoothstep(0.82, 0.96, lift) * smoothstep(0.25, 0.55, diffuse) * 0.65;
61
+ col = mix(col, vec3(0.93, 0.97, 0.99), foam);
62
+ gl_FragColor = vec4(col, 0.92);
63
+ #include <colorspace_fragment>
64
+ }
65
+ `;
66
+
67
+ function islandHeight(x: number, z: number): number {
68
+ const r = Math.hypot(x, z);
69
+ const ridge = 14 - r * 0.14 + 1.6 * Math.sin(x * 0.045) * Math.cos(z * 0.04);
70
+ return Math.max(-5, ridge);
71
+ }
72
+
73
+ function IslandSea() {
74
+ const clock = usePhysicsClock();
75
+ const { geometry, material } = useMemo(() => {
76
+ const field = new WaveField({
77
+ level: 0,
78
+ waves: createWaveSpectrum({ seed: 11, count: 6, wavelength: 20, amplitude: 0.38, steepness: 0.75 }),
79
+ });
80
+ const u = field.toUniforms();
81
+ const geo = new THREE.PlaneGeometry(SEA_SIZE, SEA_SIZE, SEA_SEGMENTS, SEA_SEGMENTS);
82
+ geo.rotateX(-Math.PI / 2);
83
+ const mat = new THREE.ShaderMaterial({
84
+ vertexShader: SEA_VERT,
85
+ fragmentShader: SEA_FRAG,
86
+ transparent: true,
87
+ uniforms: {
88
+ uTime: { value: 0 },
89
+ uOrigin: { value: new THREE.Vector2(0, 0) },
90
+ uLevel: { value: u.level },
91
+ uDirKW: { value: u.dirKW },
92
+ uAmp: { value: u.ampSteepPhase },
93
+ uCrest: { value: field.maxCrest },
94
+ uSun: { value: SUN },
95
+ },
96
+ });
97
+ return { geometry: geo, material: mat };
98
+ }, []);
99
+
100
+ const mountsRef = useRef(0);
101
+ useEffect(() => {
102
+ mountsRef.current += 1;
103
+ return () => {
104
+ mountsRef.current -= 1;
105
+ queueMicrotask(() => {
106
+ if (mountsRef.current === 0) {
107
+ geometry.dispose();
108
+ material.dispose();
109
+ }
110
+ });
111
+ };
112
+ }, [geometry, material]);
113
+
114
+ useFrame((state) => {
115
+ const cell = SEA_SIZE / SEA_SEGMENTS;
116
+ const cam = state.camera.position;
117
+ (material.uniforms.uOrigin!.value as THREE.Vector2).set(
118
+ Math.round(cam.x / cell) * cell,
119
+ Math.round(cam.z / cell) * cell,
120
+ );
121
+ material.uniforms.uTime!.value = clock.time;
122
+ });
123
+
124
+ return <mesh geometry={geometry} material={material} frustumCulled={false} />;
125
+ }
126
+
127
+ export default function App() {
128
+ const actorRef = useRef<EcctrlHandle>(null);
129
+ const world = useMemo(() => {
130
+ const heights = sampleRapierHeightfield(islandHeight, -192, -192, 384, 384, 128);
131
+ const actor: [number, number, number] = [0, islandHeight(0, 9) + ACTOR_GROUND_CLEARANCE, 9];
132
+ const car: [number, number, number] = [9, islandHeight(9, -6), -6];
133
+ const outpost: [number, number, number] = [-12, islandHeight(-12, 6), 6];
134
+ const pump: [number, number, number] = [-12, islandHeight(-12, 0), 0];
135
+ const cache: [number, number, number] = [15, islandHeight(15, 18), 18];
136
+ return { heights, actor, car, outpost, pump, cache };
137
+ }, []);
138
+
139
+ return (
140
+ <>
141
+ <Game skybox="day">
142
+ <Terrain heights={world.heights} segments={128} size={[384, 384]} />
143
+ <IslandSea />
144
+ <Actor ref={actorRef} position={world.actor} />
145
+ <Vehicle id="scrap" label="Scrap Hatchback" src={`${VAULT}/cars/kolmogorov_hatchback.glb`} position={world.car} />
146
+ <Prop id="outpost" src={`${VAULT}/city/gas-canopy-roof.glb`} position={world.outpost} fixed />
147
+ <Prop id="pump" src={`${VAULT}/city/gas-pump-twin.glb`} position={world.pump} fixed />
148
+ <Prop id="cache" src={`${VAULT}/city/prop_arcade_cabinet.glb`} position={world.cache} fixed />
149
+ <Toolgun
150
+ src={`${VAULT}/weapons/kolmogorov_pistol.glb`}
151
+ actorRef={actorRef}
152
+ defaultArmedAsset={{
153
+ id: "s15",
154
+ name: "Silvia S15",
155
+ src: `${VAULT}/cars/nissan_silvia_s15.glb`,
156
+ kind: "vehicle",
157
+ }}
158
+ />
159
+ </Game>
160
+ <Hud />
161
+ </>
162
+ );
163
+ }
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ import { createRoot } from "react-dom/client";
3
+ import App from "./App.js";
4
+
5
+ createRoot(document.getElementById("root")!).render(
6
+ <React.StrictMode>
7
+ <App />
8
+ </React.StrictMode>,
9
+ );
@@ -0,0 +1,14 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "lib": ["ES2022", "DOM", "DOM.Iterable"],
5
+ "module": "ESNext",
6
+ "moduleResolution": "bundler",
7
+ "jsx": "react-jsx",
8
+ "strict": true,
9
+ "skipLibCheck": true,
10
+ "isolatedModules": true,
11
+ "noEmit": true
12
+ },
13
+ "include": ["src", "vite.config.ts"]
14
+ }
@@ -0,0 +1,8 @@
1
+ import react from "@vitejs/plugin-react";
2
+ import { defineConfig } from "vite";
3
+ import { KOLMO_SINGLETON_DEDUPE } from "@pinkaphant/kolmo/vite";
4
+
5
+ export default defineConfig({
6
+ plugins: [react()],
7
+ resolve: { dedupe: KOLMO_SINGLETON_DEDUPE },
8
+ });
@@ -0,0 +1,11 @@
1
+ # Lonedrive
2
+
3
+ An 8.1 km seeded desert highway streamed in seamless 288 m (96 × 3 m) heightfield sectors, roadside gas stops, and one beater car. Respectful spoof of The Long Drive (not Longline, the tugboat).
4
+
5
+ - **E** / **F**: Board or exit the car
6
+ - **WASD** / **Arrows**: Drive or walk
7
+ - **R**: Flip upright
8
+
9
+ ```bash
10
+ npm create @pinkaphant/kolmo@latest my-drive -- --template lonedrive
11
+ ```
@@ -0,0 +1,15 @@
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, viewport-fit=cover" />
6
+ <title>Lonedrive</title>
7
+ <style>
8
+ html, body, #root { margin: 0; width: 100%; height: 100%; overflow: hidden; background: #1a120c; }
9
+ </style>
10
+ </head>
11
+ <body>
12
+ <div id="root"></div>
13
+ <script type="module" src="/src/main.tsx"></script>
14
+ </body>
15
+ </html>
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "lonedrive",
3
+ "version": "0.1.0",
4
+ "private": true,
5
+ "description": "Lonedrive: an 8.1 km streamed desert highway on a 3 m grid, roadside gas stops, and one car on @pinkaphant/kolmo.",
6
+ "type": "module",
7
+ "scripts": {
8
+ "dev": "vite",
9
+ "typecheck": "tsc --noEmit",
10
+ "build": "tsc --noEmit && vite build",
11
+ "preview": "vite preview"
12
+ },
13
+ "dependencies": {
14
+ "@dimforge/rapier3d-compat": "0.19.2",
15
+ "@khr3/core": "^0.2.19",
16
+ "@khr3/roads": "^0.1.1",
17
+ "@pinkaphant/ecctrl": "2.0.4-beta.9",
18
+ "@pinkaphant/kolmo": "^0.10.0",
19
+ "@react-three/drei": "^10.7.7",
20
+ "@react-three/fiber": "^9.6.1",
21
+ "@react-three/rapier": "^2.2.0",
22
+ "koota": "^0.6.6",
23
+ "react": "^19.2.7",
24
+ "react-dom": "^19.2.7",
25
+ "three": "0.184.0"
26
+ },
27
+ "overrides": {
28
+ "@dimforge/rapier3d-compat": "0.19.2",
29
+ "@pinkaphant/ecctrl": "2.0.4-beta.9",
30
+ "three": "0.184.0"
31
+ },
32
+ "devDependencies": {
33
+ "@types/react": "^19.2.16",
34
+ "@types/react-dom": "^19.2.3",
35
+ "@types/three": "0.184.0",
36
+ "@vitejs/plugin-react": "^6.1.1",
37
+ "typescript": "^7.0.2",
38
+ "vite": "^8.3.0"
39
+ }
40
+ }
@@ -0,0 +1,127 @@
1
+ import { useMemo, useRef, useState } from "react";
2
+ import { useFrame } from "@react-three/fiber";
3
+ import {
4
+ ACTOR_GROUND_CLEARANCE,
5
+ Actor,
6
+ Game,
7
+ Hud,
8
+ Prop,
9
+ Terrain,
10
+ Vehicle,
11
+ type EcctrlHandle,
12
+ } from "@pinkaphant/kolmo";
13
+ import {
14
+ frontage,
15
+ growRoad,
16
+ makeTerrain,
17
+ sampleRapierHeightfield,
18
+ type Terrain as RoadTerrain,
19
+ } from "@khr3/roads";
20
+
21
+ const VAULT = "https://khr3.optimuspi.workers.dev/assets";
22
+ const CHUNK_SIZE = 288;
23
+ const CHUNK_SEGMENTS = 96;
24
+
25
+ function StreamedHighwayTerrain({ land, initialPos }: { land: RoadTerrain; initialPos: [number, number, number] }) {
26
+ const cacheRef = useRef<Map<string, Float32Array>>(new Map());
27
+ const [sector, setSector] = useState<[number, number]>(() => [
28
+ Math.floor(initialPos[0] / CHUNK_SIZE),
29
+ Math.floor(initialPos[2] / CHUNK_SIZE),
30
+ ]);
31
+ const sectorRef = useRef(sector);
32
+
33
+ useFrame((state) => {
34
+ const cx = Math.floor(state.camera.position.x / CHUNK_SIZE);
35
+ const cz = Math.floor(state.camera.position.z / CHUNK_SIZE);
36
+ if (cx !== sectorRef.current[0] || cz !== sectorRef.current[1]) {
37
+ sectorRef.current = [cx, cz];
38
+ setSector([cx, cz]);
39
+ }
40
+ });
41
+
42
+ const chunks = useMemo(() => {
43
+ const list: Array<{ key: string; heights: Float32Array; position: [number, number, number] }> = [];
44
+ for (let dz = -1; dz <= 1; dz++) {
45
+ for (let dx = -1; dx <= 1; dx++) {
46
+ const cx = sector[0] + dx;
47
+ const cz = sector[1] + dz;
48
+ const key = `${cx},${cz}`;
49
+ let heights = cacheRef.current.get(key);
50
+ if (!heights) {
51
+ heights = sampleRapierHeightfield(land, [cx * CHUNK_SIZE, 0, cz * CHUNK_SIZE], CHUNK_SIZE, CHUNK_SEGMENTS);
52
+ cacheRef.current.set(key, heights);
53
+ }
54
+ list.push({
55
+ key,
56
+ heights,
57
+ position: [(cx + 0.5) * CHUNK_SIZE, 0, (cz + 0.5) * CHUNK_SIZE],
58
+ });
59
+ }
60
+ }
61
+ return list;
62
+ }, [land, sector]);
63
+
64
+ return (
65
+ <>
66
+ {chunks.map((chunk) => (
67
+ <Terrain
68
+ key={chunk.key}
69
+ heights={chunk.heights}
70
+ segments={CHUNK_SEGMENTS}
71
+ size={[CHUNK_SIZE, CHUNK_SIZE]}
72
+ position={chunk.position}
73
+ />
74
+ ))}
75
+ </>
76
+ );
77
+ }
78
+
79
+ export default function App() {
80
+ const actorRef = useRef<EcctrlHandle>(null);
81
+ const world = useMemo(() => {
82
+ const road = growRoad(14, {
83
+ length: 8100,
84
+ halfWidth: 4.5,
85
+ controlSpacing: 78,
86
+ maxTurn: 0.16,
87
+ maxGrade: 0.05,
88
+ hilliness: 21,
89
+ start: [0, 3, 0],
90
+ });
91
+ const land = makeTerrain(14, road, {
92
+ amplitude: 15,
93
+ noise: { wavelength: 216, octaves: 4, gain: 0.5, lacunarity: 2 },
94
+ maxSlope: 0.45,
95
+ minShoulder: 9,
96
+ verge: 3,
97
+ });
98
+ const at = road.at(36).pos;
99
+ const stops = frontage(road, { spacing: 1080, setback: 9 }).slice(0, 6);
100
+ return {
101
+ land,
102
+ car: [at[0], at[1], at[2]] as [number, number, number],
103
+ stops: stops.map((lot, idx) => ({
104
+ key: `stop-${idx}`,
105
+ canopy: [lot.front[0], lot.groundY, lot.front[2]] as [number, number, number],
106
+ sign: [lot.front[0] + lot.facing[0] * 3, lot.groundY, lot.front[2] + lot.facing[2] * 3] as [number, number, number],
107
+ })),
108
+ };
109
+ }, []);
110
+
111
+ return (
112
+ <>
113
+ <Game skybox="dusk">
114
+ <StreamedHighwayTerrain land={world.land} initialPos={world.car} />
115
+ {world.stops.map((stop) => (
116
+ <Prop key={stop.key} id={stop.key} src={`${VAULT}/city/gas-canopy-roof.glb`} position={stop.canopy} fixed />
117
+ ))}
118
+ {world.stops.map((stop) => (
119
+ <Prop key={`${stop.key}-sign`} id={`${stop.key}-sign`} src={`${VAULT}/city/neon-petro-sign.glb`} position={stop.sign} fixed />
120
+ ))}
121
+ <Vehicle id="beater" label="Beater" src={`${VAULT}/cars/kolmogorov_hatchback.glb`} position={world.car} />
122
+ <Actor ref={actorRef} position={[world.car[0] + 3, world.car[1] + ACTOR_GROUND_CLEARANCE, world.car[2]]} />
123
+ </Game>
124
+ <Hud />
125
+ </>
126
+ );
127
+ }
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ import { createRoot } from "react-dom/client";
3
+ import App from "./App.js";
4
+
5
+ createRoot(document.getElementById("root")!).render(
6
+ <React.StrictMode>
7
+ <App />
8
+ </React.StrictMode>,
9
+ );
@@ -0,0 +1,14 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "lib": ["ES2022", "DOM", "DOM.Iterable"],
5
+ "module": "ESNext",
6
+ "moduleResolution": "bundler",
7
+ "jsx": "react-jsx",
8
+ "strict": true,
9
+ "skipLibCheck": true,
10
+ "isolatedModules": true,
11
+ "noEmit": true
12
+ },
13
+ "include": ["src", "vite.config.ts"]
14
+ }
@@ -0,0 +1,8 @@
1
+ import react from "@vitejs/plugin-react";
2
+ import { defineConfig } from "vite";
3
+ import { KOLMO_SINGLETON_DEDUPE } from "@pinkaphant/kolmo/vite";
4
+
5
+ export default defineConfig({
6
+ plugins: [react()],
7
+ resolve: { dedupe: KOLMO_SINGLETON_DEDUPE },
8
+ });
@@ -12,7 +12,7 @@
12
12
  },
13
13
  "dependencies": {
14
14
  "@dimforge/rapier3d-compat": "0.19.2",
15
- "@pinkaphant/ecctrl": "2.0.4-beta.6",
15
+ "@pinkaphant/ecctrl": "2.0.4-beta.9",
16
16
  "@pinkaphant/kolmo": "^0.10.0",
17
17
  "@react-three/fiber": "^9.6.1",
18
18
  "@react-three/rapier": "^2.2.0",
@@ -22,7 +22,7 @@
22
22
  },
23
23
  "overrides": {
24
24
  "@dimforge/rapier3d-compat": "0.19.2",
25
- "@pinkaphant/ecctrl": "2.0.4-beta.6",
25
+ "@pinkaphant/ecctrl": "2.0.4-beta.9",
26
26
  "three": "0.184.0"
27
27
  },
28
28
  "devDependencies": {
@@ -1,10 +1,10 @@
1
1
  import * as THREE from "three";
2
2
  import type { WaveField } from "@pinkaphant/kolmo/water";
3
3
 
4
- /** The colours of the scene: the sea fades into the horizon colour, and the sky is that colour at the horizon. */
4
+ /** Clear, saturated scene colours. The horizon stays crisp instead of dissolving into fog. */
5
5
  export const PALETTE = {
6
- deep: "#0a3a5c",
7
- shallow: "#2f9fb3",
6
+ deep: "#062f4d",
7
+ shallow: "#1597a6",
8
8
  horizon: "#b9dbea",
9
9
  zenith: "#4f93c9",
10
10
  foam: "#f2f8fb",
@@ -13,8 +13,8 @@ export const PALETTE = {
13
13
  /** Where the sun is: a unit vector toward it. */
14
14
  export const SUN = new THREE.Vector3(-0.45, 0.62, -0.64).normalize();
15
15
 
16
- /** The sea mesh: a square that follows the boat, with a vertex every `size / segments` metres. */
17
- export const OCEAN = { size: 220, segments: 300, fogNear: 55, fogFar: 105 } as const;
16
+ /** Broad, readable triangles: the rendering grid, not the physics grid. */
17
+ export const OCEAN = { size: 220, segments: 110 } as const;
18
18
 
19
19
  const vertex = /* glsl */ `
20
20
  uniform float uTime;
@@ -23,37 +23,19 @@ uniform float uLevel;
23
23
  uniform vec4 uDirKW[WAVE_COUNT];
24
24
  uniform vec4 uAmp[WAVE_COUNT];
25
25
  varying vec3 vWorld;
26
- varying vec3 vNormal;
27
26
 
28
- // The same Gerstner sum as WaveField.displace in @pinkaphant/kolmo/water, on the arrays of WaveField.toUniforms():
29
- // uDirKW is (Dx, Dz, k, omega) per wave and uAmp is (A, s, phase, q) per wave. The normal is the field's exact one.
27
+ // The exact same Gerstner displacement as WaveField.displace. Only the shading is faceted.
30
28
  void main() {
31
29
  vec2 rest = position.xz + uOrigin;
32
30
  vec3 p = vec3(rest.x, uLevel, rest.y);
33
- float a = 1.0;
34
- float b = 1.0;
35
- float c = 0.0;
36
- float gp = 0.0;
37
- float gq = 0.0;
38
31
  for (int i = 0; i < WAVE_COUNT; i++) {
39
32
  vec4 d = uDirKW[i];
40
33
  vec4 w = uAmp[i];
41
34
  float theta = d.z * (d.x * rest.x + d.y * rest.y) - d.w * uTime + w.z;
42
- float s = sin(theta);
43
- float co = cos(theta);
44
- p.x += w.w * d.x * co;
45
- p.z += w.w * d.y * co;
46
- p.y += w.x * s;
47
- float ss = w.y * s;
48
- a -= ss * d.x * d.x;
49
- b -= ss * d.y * d.y;
50
- c -= ss * d.x * d.y;
51
- float ak = w.x * d.z * co;
52
- gp += ak * d.x;
53
- gq += ak * d.y;
35
+ p.x += w.w * d.x * cos(theta);
36
+ p.z += w.w * d.y * cos(theta);
37
+ p.y += w.x * sin(theta);
54
38
  }
55
- float det = a * b - c * c;
56
- vNormal = normalize(vec3(gq * c - b * gp, det, c * gp - gq * a));
57
39
  vWorld = p;
58
40
  gl_Position = projectionMatrix * viewMatrix * vec4(p, 1.0);
59
41
  }
@@ -62,29 +44,24 @@ void main() {
62
44
  const fragment = /* glsl */ `
63
45
  uniform vec3 uDeep;
64
46
  uniform vec3 uShallow;
65
- uniform vec3 uHorizon;
66
47
  uniform vec3 uFoam;
67
48
  uniform vec3 uSun;
68
49
  uniform float uLevel;
69
50
  uniform float uCrest;
70
51
  uniform float uFoamAmount;
71
- uniform float uFogNear;
72
- uniform float uFogFar;
73
52
  varying vec3 vWorld;
74
- varying vec3 vNormal;
75
53
 
76
54
  void main() {
77
- vec3 n = normalize(vNormal);
78
- vec3 v = normalize(cameraPosition - vWorld);
79
- float fresnel = pow(1.0 - max(dot(n, v), 0.0), 4.0);
55
+ // One face normal per triangle. No interpolated normals, Fresnel, specular, or atmospheric smoothing.
56
+ vec3 n = normalize(cross(dFdx(vWorld), dFdy(vWorld)));
57
+ if (n.y < 0.0) n = -n;
80
58
  float lift = clamp((vWorld.y - uLevel) / max(uCrest, 0.05) * 0.5 + 0.5, 0.0, 1.0);
81
59
  float diffuse = max(dot(n, uSun), 0.0);
82
- vec3 col = mix(uDeep, uShallow, clamp(lift * 0.5 + diffuse * 0.45, 0.0, 1.0));
83
- col = mix(col, uHorizon, fresnel * 0.7);
84
- vec3 h = normalize(uSun + v);
85
- col += vec3(1.0, 0.95, 0.85) * pow(max(dot(n, h), 0.0), 140.0) * 0.7;
86
- col = mix(col, uFoam, smoothstep(0.78, 0.98, lift) * uFoamAmount);
87
- col = mix(col, uHorizon, smoothstep(uFogNear, uFogFar, distance(cameraPosition, vWorld)));
60
+ float heightBand = floor(lift * 4.0) / 3.0;
61
+ float lightBand = floor(diffuse * 3.0) / 2.0;
62
+ vec3 col = mix(uDeep, uShallow, clamp(heightBand * 0.65 + lightBand * 0.25, 0.0, 1.0));
63
+ float foam = step(0.88, lift) * step(0.35, diffuse) * uFoamAmount;
64
+ col = mix(col, uFoam, foam);
88
65
  gl_FragColor = vec4(col, 1.0);
89
66
  #include <colorspace_fragment>
90
67
  }
@@ -109,11 +86,8 @@ export function createOceanMaterial(field: WaveField, foam: number): THREE.Shade
109
86
  uFoamAmount: { value: foam },
110
87
  uDeep: { value: new THREE.Color(PALETTE.deep) },
111
88
  uShallow: { value: new THREE.Color(PALETTE.shallow) },
112
- uHorizon: { value: new THREE.Color(PALETTE.horizon) },
113
89
  uFoam: { value: new THREE.Color(PALETTE.foam) },
114
90
  uSun: { value: SUN },
115
- uFogNear: { value: OCEAN.fogNear },
116
- uFogFar: { value: OCEAN.fogFar },
117
91
  };
118
92
  return new THREE.ShaderMaterial({
119
93
  vertexShader: vertex,
@@ -0,0 +1,13 @@
1
+ # Kolmo Road Sandbox
2
+
3
+ Seeded road heightfield, Skyline R34, on-foot pilot controller, and Kolmogorov toolgun.
4
+
5
+ - **WASD** / **Arrows**: Move or drive
6
+ - **Shift**: Sprint / boost
7
+ - **E** / **F**: Board or exit vehicle
8
+ - **R**: Flip vehicle upright
9
+ - **T** / **Right-Click**: Spawn armed vehicle
10
+
11
+ ```bash
12
+ npm create @pinkaphant/kolmo@latest my-road-game
13
+ ```
@@ -0,0 +1,15 @@
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, viewport-fit=cover" />
6
+ <title>Kolmo Road</title>
7
+ <style>
8
+ html, body, #root { margin: 0; width: 100%; height: 100%; overflow: hidden; background: #090d16; }
9
+ </style>
10
+ </head>
11
+ <body>
12
+ <div id="root"></div>
13
+ <script type="module" src="/src/main.tsx"></script>
14
+ </body>
15
+ </html>
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "kolmo-road",
3
+ "version": "0.1.0",
4
+ "private": true,
5
+ "description": "Kolmo road and vehicle sandbox on @pinkaphant/kolmo, @khr3/core, @khr3/roads, and @khr3/c12.",
6
+ "type": "module",
7
+ "scripts": {
8
+ "dev": "vite",
9
+ "typecheck": "tsc --noEmit",
10
+ "build": "tsc --noEmit && vite build",
11
+ "preview": "vite preview"
12
+ },
13
+ "dependencies": {
14
+ "@dimforge/rapier3d-compat": "0.19.2",
15
+ "@khr3/c12": "^0.3.12",
16
+ "@khr3/core": "^0.2.19",
17
+ "@khr3/roads": "^0.1.1",
18
+ "@pinkaphant/ecctrl": "2.0.4-beta.9",
19
+ "@pinkaphant/kolmo": "^0.10.0",
20
+ "@react-three/drei": "^10.7.7",
21
+ "@react-three/fiber": "^9.6.1",
22
+ "@react-three/rapier": "^2.2.0",
23
+ "koota": "^0.6.6",
24
+ "react": "^19.2.7",
25
+ "react-dom": "^19.2.7",
26
+ "three": "0.184.0"
27
+ },
28
+ "overrides": {
29
+ "@dimforge/rapier3d-compat": "0.19.2",
30
+ "@pinkaphant/ecctrl": "2.0.4-beta.9",
31
+ "three": "0.184.0"
32
+ },
33
+ "devDependencies": {
34
+ "@types/react": "^19.2.16",
35
+ "@types/react-dom": "^19.2.3",
36
+ "@types/three": "0.184.0",
37
+ "@vitejs/plugin-react": "^6.1.1",
38
+ "typescript": "^7.0.2",
39
+ "vite": "^8.3.0"
40
+ }
41
+ }
@@ -0,0 +1,76 @@
1
+ import { useMemo, useRef } from "react";
2
+ import {
3
+ ACTOR_GROUND_CLEARANCE,
4
+ Actor,
5
+ Game,
6
+ Hud,
7
+ Prop,
8
+ Terrain,
9
+ Toolgun,
10
+ Vehicle,
11
+ type EcctrlHandle,
12
+ } from "@pinkaphant/kolmo";
13
+ import { frontage, growRoad, makeTerrain, sampleRapierHeightfield } from "@khr3/roads";
14
+
15
+ const VAULT = "https://khr3.optimuspi.workers.dev/assets";
16
+
17
+ export default function App() {
18
+ const actorRef = useRef<EcctrlHandle>(null);
19
+
20
+ const { heights, startPos, canopyPos, pumpPos } = useMemo(() => {
21
+ const road = growRoad(42, {
22
+ length: 600,
23
+ halfWidth: 4.5,
24
+ controlSpacing: 36,
25
+ maxTurn: 0.28,
26
+ maxGrade: 0.06,
27
+ hilliness: 18,
28
+ start: [0, 0, -150],
29
+ });
30
+ const land = makeTerrain(42, road, {
31
+ amplitude: 12,
32
+ noise: { wavelength: 144, octaves: 4, gain: 0.5, lacunarity: 2 },
33
+ maxSlope: 0.55,
34
+ minShoulder: 6,
35
+ verge: 3,
36
+ });
37
+ const heights = sampleRapierHeightfield(land, [-192, 0, -192], 384, 128);
38
+ const s0 = road.at(24).pos;
39
+ const lots = frontage(road, { spacing: 24, setback: 6 });
40
+ const lotA = lots[0];
41
+ const lotB = lots[1];
42
+ return {
43
+ heights,
44
+ startPos: [s0[0], s0[1], s0[2]] as [number, number, number],
45
+ canopyPos: lotA
46
+ ? ([lotA.front[0], lotA.groundY, lotA.front[2]] as [number, number, number])
47
+ : ([12, 0, -114] as [number, number, number]),
48
+ pumpPos: lotB
49
+ ? ([lotB.front[0], lotB.groundY, lotB.front[2]] as [number, number, number])
50
+ : ([12, 0, -90] as [number, number, number]),
51
+ };
52
+ }, []);
53
+
54
+ return (
55
+ <>
56
+ <Game skybox="day">
57
+ <Terrain heights={heights} segments={128} size={[384, 384]} />
58
+ <Vehicle id="r34" label="Skyline R34" src={`${VAULT}/cars/nissan_skyline_r34.glb`} position={startPos} />
59
+ <Prop id="canopy" src={`${VAULT}/city/gas-canopy-roof.glb`} position={canopyPos} fixed />
60
+ <Prop id="pump" src={`${VAULT}/city/gas-pump-twin.glb`} position={pumpPos} fixed />
61
+ <Actor ref={actorRef} position={[startPos[0] - 3, startPos[1] + ACTOR_GROUND_CLEARANCE, startPos[2]]} />
62
+ <Toolgun
63
+ src={`${VAULT}/weapons/kolmogorov_pistol.glb`}
64
+ actorRef={actorRef}
65
+ defaultArmedAsset={{
66
+ id: "supra",
67
+ name: "Supra A80",
68
+ src: `${VAULT}/cars/toyota_supra_a80.glb`,
69
+ kind: "vehicle",
70
+ }}
71
+ />
72
+ </Game>
73
+ <Hud />
74
+ </>
75
+ );
76
+ }
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ import { createRoot } from "react-dom/client";
3
+ import App from "./App.js";
4
+
5
+ createRoot(document.getElementById("root")!).render(
6
+ <React.StrictMode>
7
+ <App />
8
+ </React.StrictMode>,
9
+ );
@@ -0,0 +1,15 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "lib": ["ES2022", "DOM", "DOM.Iterable"],
5
+ "module": "ESNext",
6
+ "moduleResolution": "bundler",
7
+ "jsx": "react-jsx",
8
+ "strict": true,
9
+ "noUnusedLocals": true,
10
+ "noUnusedParameters": true,
11
+ "skipLibCheck": true,
12
+ "isolatedModules": true
13
+ },
14
+ "include": ["src", "vite.config.ts"]
15
+ }
@@ -0,0 +1,10 @@
1
+ import react from "@vitejs/plugin-react";
2
+ import { defineConfig } from "vite";
3
+ import { KOLMO_SINGLETON_DEDUPE } from "@pinkaphant/kolmo/vite";
4
+
5
+ export default defineConfig({
6
+ plugins: [react()],
7
+ resolve: {
8
+ dedupe: KOLMO_SINGLETON_DEDUPE,
9
+ },
10
+ });