Skip to content

Commit

Permalink
web: remove sveltekit & convert to svelte 5
Browse files Browse the repository at this point in the history
  • Loading branch information
av8ta committed May 27, 2024
1 parent 238d3e2 commit 25df286
Show file tree
Hide file tree
Showing 74 changed files with 694 additions and 1,256 deletions.
3 changes: 1 addition & 2 deletions applications/web/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
node_modules
/build
/dist
/.svelte-kit
/package
/test-results
.env
*.env.*
vite.config.js.timestamp-*
Expand Down
1 change: 0 additions & 1 deletion applications/web/.prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"trailingComma": "none",
"printWidth": 120,
"plugins": ["prettier-plugin-svelte"],
"pluginSearchDirs": ["."],
"semi": false,
"overrides": [
{
Expand Down
38 changes: 0 additions & 38 deletions applications/web/README_svelte.md

This file was deleted.

13 changes: 13 additions & 0 deletions applications/web/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!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>CADmium</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
53 changes: 24 additions & 29 deletions applications/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,55 +5,50 @@
"scripts": {
"dev": "vite dev",
"build": "vite build",
"serve": "pnpm build && serve -p 5174 dist",
"clean": "rm -rf .turbo .svelte-kit dist node_modules",
"preview": "vite preview",
"test": "pnpm test:integration && pnpm test:unit",
"lint": "prettier --plugin-search-dir . --check . && eslint .",
"format": "prettier --plugin-search-dir . --write .",
"svelte-check": "svelte-check",
"lint": "prettier --check . && eslint .",
"format": "prettier . --write .",
"check": "svelte-check --tsconfig ./tsconfig.json",
"test:integration": "playwright test",
"test:unit": "vitest",
"types:guard": "ts-auto-guard --export-all src/types.d.ts",
"postinstall": "svelte-kit sync"
"types:guard": "ts-auto-guard --export-all src/types.d.ts"
},
"devDependencies": {
"@playwright/test": "^1.42.1",
"@sveltejs/adapter-static": "^3.0.1",
"@sveltejs/kit": "^2.5.3",
"@sveltejs/vite-plugin-svelte": "^3.0.2",
"autoprefixer": "^10.4.18",
"@playwright/test": "^1.44.1",
"@sveltejs/vite-plugin-svelte": "^3.1.0",
"@tsconfig/svelte": "^5.0.4",
"autoprefixer": "^10.4.19",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-svelte": "^2.35.1",
"phosphor-svelte": "^1.4.2",
"postcss": "^8.4.35",
"postcss-load-config": "^5.0.3",
"postcss": "^8.4.38",
"postcss-load-config": "^5.1.0",
"prettier": "^3.2.5",
"prettier-plugin-svelte": "^3.2.2",
"serve": "^14.2.1",
"svelte": "^4.2.12",
"svelte-check": "^3.6.6",
"tailwindcss": "^3.4.1",
"prettier-plugin-svelte": "^3.2.3",
"svelte": "5.0.0-next.141",
"svelte-check": "^3.7.1",
"tailwindcss": "^3.4.3",
"ts-auto-guard": "^4.2.0",
"vite": "^5.1.5",
"vitest": "^1.3.1"
"vite": "^5.2.11",
"vitest": "^1.6.0",
"vite-plugin-top-level-await": "^1.4.1",
"vite-plugin-wasm": "^3.3.0"
},
"type": "module",
"dependencies": {
"@fontsource-variable/manrope": "^5.0.19",
"@threlte/core": "^7.2.1",
"@threlte/extras": "^8.10.1",
"@types/three": "^0.162.0",
"@fontsource-variable/manrope": "^5.0.20",
"@threlte/core": "8.0.0-next.4",
"@threlte/extras": "9.0.0-next.5",
"@types/three": "^0.164.1",
"cadmium": "workspace:*",
"camera-controls": "^2.8.3",
"gsap": "^3.12.5",
"js-file-download": "^0.4.12",
"nurbs": "^1.1.1",
"shared": "workspace:*",
"three": "^0.162.0",
"troika-three-text": "^0.49.0",
"vite-plugin-top-level-await": "^1.4.1",
"vite-plugin-wasm": "^3.3.0"
"three": "^0.164.1",
"troika-three-text": "^0.49.1"
}
}
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<script lang="ts">
import { browser } from "$app/environment"
// import { browser } from "$app/environment"
import { onMount } from "svelte"
import { default as init, Project as WasmProject } from "cadmium"
import AppBar from "./AppBar.svelte"
import BottomBar from "./BottomBar.svelte"
import MainDisplay from "./MainDisplay.svelte"
import ToolBar from "./ToolBar.svelte"
import AppBar from "./components/AppBar.svelte"
import BottomBar from "./components/BottomBar.svelte"
import MainDisplay from "./components/MainDisplay.svelte"
import ToolBar from "./components/ToolBar.svelte"
import { workbenchIsStale, wasmProject, project, projectIsStale, featureIndex } from "shared/stores"
// prettier-ignore
Expand All @@ -14,15 +14,15 @@
const userName = "mattferraro.dev"
let newFileContent: string | null = null
if (browser) {
onMount(() => {
init().then(() => {
wasmProject.set(new WasmProject("First Project"))
// log('made a new project')
projectIsStale.set(true)
})
// if (browser) {
onMount(() => {
init().then(() => {
wasmProject.set(new WasmProject("First Project"))
// log('made a new project')
projectIsStale.set(true)
})
}
})
// }
// $: $wasmProject, log("[$wasmProject]", $wasmProject)
// $: $project, log("[$project]", $project)
Expand Down
15 changes: 0 additions & 15 deletions applications/web/src/app.html

This file was deleted.

1 change: 1 addition & 0 deletions applications/web/src/base.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const base = "/CADmium"
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import Bug from "phosphor-svelte/lib/Bug"
import type { WithTarget } from "shared/types"
import { isProject } from "shared/typeGuards"
import { base } from "$app/paths"
import { base } from "../base"
import { renameProject } from "shared/projectUtils"
// prettier-ignore
Expand Down Expand Up @@ -50,34 +50,36 @@
</div>
<div class="select-none">CADmium</div>
{#if renaming}
<input
class="bg-gray-300 text-gray-700 py-2 px-4 font-medium"
type="text"
bind:value={newProjectName}
on:blur={() => {
log("Renaming project aborted")
renaming = false
newProjectName = project.name ?? ""
}}
on:keydown={(e) => {
if (e.key === "Enter") {
log("Renaming project")
renameProject(newProjectName)
project.name = newProjectName
<input
class="bg-gray-300 text-gray-700 py-2 px-4 font-medium"
type="text"
bind:value={newProjectName}
on:blur={() => {
log("Renaming project aborted")
renaming = false
}
}}
/>
newProjectName = project.name ?? ""
}}
on:keydown={(e) => {
if (e.key === "Enter") {
log("Renaming project")
renameProject(newProjectName)
project.name = newProjectName
renaming = false
}
}}
/>
{:else}
<!-- svelte-ignore a11y-no-static-element-interactions -->
<div
class="font-medium"
on:dblclick={() => {
log("Renaming project")
renaming = true
newProjectName = project.name ?? ""
}}
>{project.name ?? ""}</div>
<!-- svelte-ignore a11y-no-static-element-interactions -->
<div
class="font-medium"
on:dblclick={() => {
log("Renaming project")
renaming = true
newProjectName = project.name ?? ""
}}
>
{project.name ?? ""}
</div>
{/if}
<!-- svelte-ignore a11y-no-static-element-interactions -->
<div
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import { selectingFor, workbenchIsStale, featureIndex, currentlySelected, hiddenSketches } from "shared/stores"
import X from "phosphor-svelte/lib/X"
import type { ExtrusionData } from "shared/types"
import { base } from "$app/paths"
import { base } from "../base"
// prettier-ignore
const log = (function () { const context = "[ExtrusionFeature.svelte]"; const color="gray"; return Function.prototype.bind.call(console.log, console, `%c${context}`, `font-weight:bold;color:${color};`)})()
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
// there WAS an anchor point, so we should create a rectangle!
// if the anchor point doesn't exist, then we should create a point
if (anchorPoint.id === null || anchorPoint.id === undefined) anchorPoint.id = addPointToSketch(sketchIndex, anchorPoint.twoD!, false)
if (anchorPoint.id === null || anchorPoint.id === undefined)
anchorPoint.id = addPointToSketch(sketchIndex, anchorPoint.twoD!, false)
// if (point?.id && anchorPoint.id) {
// // if the point exists, then we should create a circle between the two existing points
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import { workbenchIsStale, featureIndex } from "shared/stores"
import MagnifyingGlass from "phosphor-svelte/lib/MagnifyingGlass"
import type { Plane, SetCameraFocus } from "shared/types"
import { base } from "$app/paths"
import { base } from "../base"
// prettier-ignore
const log = (function () { const context = "[PlaneFeature.svelte]"; const color="gray"; return Function.prototype.bind.call(console.log, console, `%c${context}`, `font-weight:bold;color:${color};`)})()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { flatten, promoteTo3 } from "shared/projectUtils"
import { T } from "@threlte/core"
import type { EntityType } from "shared/types"
import { base } from "$app/paths"
import { base } from "../base"
export let x, y, hidden: boolean, id: string
export let isPreview = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { flatten, promoteTo3 } from "shared/projectUtils"
import { T } from "@threlte/core"
import type { EntityType } from "shared/types"
import { base } from "$app/paths"
import { base } from "../base"
export let x: number, y: number, z: number, hidden: boolean, id: string
export let isPreview = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { quintOut } from "svelte/easing"
import { renameStep } from "shared/projectUtils"
import { workbenchIsStale, featureIndex } from "shared/stores"
import { base } from "$app/paths"
import { base } from "../base"
// prettier-ignore
const log = (function () { const context = "[PointFeature.svelte]"; const color="gray"; return Function.prototype.bind.call(console.log, console, `%c${context}`, `font-weight:bold;color:${color};`)})()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import Solid from "./Solid.svelte"
import Sketch from "./Sketch.svelte"
import CubeGizmo from "./CubeGizmo/CubeGizmo.svelte"
import { base } from "$app/paths"
import { base } from "../base"
// prettier-ignore
const log = (function () { const context = "[Scene.svelte]"; const color="gray"; return Function.prototype.bind.call(console.log, console, `%c${context}`, `font-weight:bold;color:${color};`)})()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import Eye from "phosphor-svelte/lib/Eye"
import X from "phosphor-svelte/lib/X"
import type { Entity } from "shared/types"
import { base } from "$app/paths"
import { base } from "../base"
// prettier-ignore
const log = (function () { const context = "[SketchFeature.svelte]"; const color="gray"; return Function.prototype.bind.call(console.log, console, `%c${context}`, `font-weight:bold;color:${color};`)})()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import FileArrowDown from "phosphor-svelte/lib/FileArrowDown"
import { getObjectString } from "shared/projectUtils"
import type { WithTarget } from "shared/types"
import { base } from "$app/paths"
import { base } from "../base"
// prettier-ignore
const log = (function () { const context = "[SolidItem.svelte]"; const color="gray"; return Function.prototype.bind.call(console.log, console, `%c${context}`, `font-weight:bold;color:${color};`)})()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
hiddenSketches
} from "shared/stores"
import { newExtrusion, newSketchOnPlane } from "shared/projectUtils"
import { base } from "$app/paths"
import { base } from "../base"
// prettier-ignore
const log = (function () { const context = "[ToolBar.svelte]"; const color="gray"; return Function.prototype.bind.call(console.log, console, `%c${context}`, `font-weight:bold;color:${color};`)})()
Expand Down
8 changes: 8 additions & 0 deletions applications/web/src/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import "@fontsource-variable/manrope"
import "./app.postcss"
import App from "./App.svelte"
import { mount } from "svelte"

const app = mount(App, { target: document.getElementById("app") })

export default app
6 changes: 0 additions & 6 deletions applications/web/src/routes/+layout.svelte

This file was deleted.

Loading

0 comments on commit 25df286

Please sign in to comment.