This commit is contained in:
Adam 2023-04-15 01:21:33 -04:00
commit df22477000
14 changed files with 3427 additions and 0 deletions

24
lightning/.gitignore vendored Normal file
View file

@ -0,0 +1,24 @@
dist
.solid
.output
.vercel
.netlify
netlify
# dependencies
/node_modules
# IDEs and editors
/.idea
.project
.classpath
*.launch
.settings/
# Temp
gitignore
# System Files
.DS_Store
Thumbs.db

18
lightning/README.md Normal file
View file

@ -0,0 +1,18 @@
# Lightning
:electric_plug: Ride the lightning :metal:
`npm install` (or `pnpm install` or `yarn`)
```bash
npm run dev
# or start the server and open the app in a new browser tab
npm run dev -- --open
```
## Building
Solid apps are built with _adapters_, which optimise your project for deployment to different environments.
By default, `npm run build` will generate a Node app that you can run with `npm start`. To use a different adapter, add it to the `devDependencies` in `package.json` and specify in your `vite.config.js`.

30
lightning/package.json Normal file
View file

@ -0,0 +1,30 @@
{
"name": "lightning",
"scripts": {
"dev": "solid-start dev",
"build": "solid-start build",
"start": "solid-start start"
},
"type": "module",
"devDependencies": {
"@types/node": "^18.11.18",
"esbuild": "^0.14.54",
"postcss": "^8.4.21",
"solid-start-node": "^0.2.19",
"typescript": "^4.9.4",
"vite": "^4.1.4"
},
"dependencies": {
"@solidjs/meta": "^0.28.2",
"@solidjs/router": "^0.8.2",
"mapbox-gl": "npm:empty-npm-package@1.0.0",
"maplibre-gl": "^2.4.0",
"solid-js": "^1.7.2",
"solid-map-gl": "^1.7.2",
"solid-start": "^0.2.26",
"undici": "^5.15.1"
},
"engines": {
"node": ">=16.8"
}
}

3163
lightning/pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 B

View file

@ -0,0 +1,45 @@
import { Component, createSignal } from 'solid-js';
import MapGL, { Viewport, Control, Light, Camera } from 'solid-map-gl';
import * as maplibre from 'maplibre-gl';
import 'maplibre-gl/dist/maplibre-gl.css';
export default function BadassMap() {
const [viewport, setViewport] = createSignal({
center: [-71.05625, 42.36],
zoom: 15.5,
bearing: 160,
pitch: 60,
maxPitch: 85,
antialias: true,
} as Viewport);
return (
<MapGL
mapLib={maplibre}
options={{
style: 'https://api.maptiler.com/maps/024da34e-fa66-4cb3-8f5f-0466b51e972e/style.json?key=Ukl2QNcQUCPAwuelQOvM'
}}
viewport={viewport()}
onViewportChange={(evt: Viewport) => setViewport(evt)}
>
<button onClick={() => console.log('sup')}>sup</button>
<Control type="fullscreen" position="top-right" />
<Control type="navigation" position="top-right" />
<Control type="geolocate" position="top-right" />
<Control type="scale" position="bottom-left" />
<Light style={{
anchor: 'viewport',
color: 'white',
intensity: 0.9,
}} />
<Camera
rotateViewport='true'
reverse='true'
/>
</MapGL>
);
};

View file

@ -0,0 +1,3 @@
import { mount, StartClient } from "solid-start/entry-client";
mount(() => <StartClient />, document);

View file

@ -0,0 +1,9 @@
import {
createHandler,
renderAsync,
StartServer,
} from "solid-start/entry-server";
export default createHandler(
renderAsync((event) => <StartServer event={event} />)
);

40
lightning/src/root.css Normal file
View file

@ -0,0 +1,40 @@
body {
font-family: Gordita, Roboto, Oxygen, Ubuntu, Cantarell,
'Open Sans', 'Helvetica Neue', sans-serif;
}
a {
margin-right: 1rem;
}
main {
text-align: center;
padding: 1em;
margin: 0 auto;
}
h1 {
color: #335d92;
text-transform: uppercase;
font-size: 4rem;
font-weight: 100;
line-height: 1.1;
margin: 4rem auto;
max-width: 14rem;
}
p {
max-width: 14rem;
margin: 2rem auto;
line-height: 1.35;
}
@media (min-width: 480px) {
h1 {
max-width: none;
}
p {
max-width: none;
}
}

39
lightning/src/root.tsx Normal file
View file

@ -0,0 +1,39 @@
// @refresh reload
import { Suspense } from "solid-js";
import {
A,
Body,
ErrorBoundary,
FileRoutes,
Head,
Html,
Meta,
Routes,
Scripts,
Title,
} from "solid-start";
import "./root.css";
export default function Root() {
return (
<Html lang="en">
<Head>
<Title>SolidStart - Bare</Title>
<Meta charset="utf-8" />
<Meta name="viewport" content="width=device-width, initial-scale=1" />
</Head>
<Body>
<Suspense>
<ErrorBoundary>
<A href="/">Index</A>
<A href="/about">About</A>
<Routes>
<FileRoutes />
</Routes>
</ErrorBoundary>
</Suspense>
<Scripts />
</Body>
</Html>
);
}

View file

@ -0,0 +1,19 @@
import { Title } from "solid-start";
import { HttpStatusCode } from "solid-start/server";
export default function NotFound() {
return (
<main>
<Title>Not Found</Title>
<HttpStatusCode code={404} />
<h1>Page Not Found</h1>
<p>
Visit{" "}
<a href="https://start.solidjs.com" target="_blank">
start.solidjs.com
</a>{" "}
to learn how to build SolidStart apps.
</p>
</main>
);
}

View file

@ -0,0 +1,14 @@
import { Title } from "solid-start";
import BadassMap from "~/components/BadassMap";
export default function Home() {
return (
<main>
<Title>Lightning</Title>
<h1>RIDE THE LIGHTNING</h1>
<BadassMap />
<p>Click and drag to watch me explode!
</p>
</main>
);
}

17
lightning/tsconfig.json Normal file
View file

@ -0,0 +1,17 @@
{
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "node",
"jsxImportSource": "solid-js",
"jsx": "preserve",
"strict": true,
"types": ["solid-start/env"],
"baseUrl": "./",
"paths": {
"~/*": ["./src/*"]
}
}
}

6
lightning/vite.config.ts Normal file
View file

@ -0,0 +1,6 @@
import solid from "solid-start/vite";
import { defineConfig } from "vite";
export default defineConfig({
plugins: [solid()],
});