diff --git a/.prettierignore b/.prettierignore
new file mode 100644
index 00000000..d4e33016
--- /dev/null
+++ b/.prettierignore
@@ -0,0 +1,3 @@
+LICENSE.md
+.vscode
+pkg/
diff --git a/.vscode/settings.json b/.vscode/settings.json
deleted file mode 100644
index 916544ae..00000000
--- a/.vscode/settings.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "[markdown]": {
- "editor.formatOnSave": false
- },
- "javascript.format.semicolons": "remove",
- "typescript.preferences.quoteStyle": "double",
- "javascript.preferences.quoteStyle": "double",
- "editor.tabSize": 2,
- "eslint.workingDirectories": [
- {
- "mode": "auto"
- }
- ]
-}
diff --git a/README.md b/README.md
index 29c85e66..4f296f01 100644
--- a/README.md
+++ b/README.md
@@ -19,7 +19,7 @@ Then this project may be for you!
**Demos:** We are currently racing toward our first demo release, [V0.0.1](https://github.com/orgs/CADmium-Co/projects/1?pane=info). This is a good first exercise for us to decide on build and release processes.
-After that we will do a few more demo (V0.0.*) releases, aggregating features until it feels pretty usable.
+After that we will do a few more demo (V0.0.\*) releases, aggregating features until it feels pretty usable.
**Alpha:** When it feels like we've reached an MVP that people might actually want to use, it's time to release an Alpha version (V0.1.0) and actively solicit feedback from users. We'll use that feedback to make more improvements, re-inventing things if necessary to achieve a great workflow.
@@ -109,17 +109,20 @@ We are actively seeking contributors! Please join the [Discord](https://discord.
Most especially, we need help in the following areas:
**Design:** The tool must look and feel good and we are not designers. We would love contributions in the form of:
+
- Advice, mockups, or tailwindcss examples of how to make different elements look and behave better
- In particular, help picking a color palette that works well and is unique
- Help figuring out how to implement dark mode
**Rust:** This is our first project in Rust. We need help from experienced Rustaceans to:
- - Figure out how to better lay out the rust code
- - Point out any glaring issues with how I'm using the language (We've thus far completely avoided Lifetimes, Traits, Rc, RefCell, etc and that may be hampering things)
+
+- Figure out how to better lay out the rust code
+- Point out any glaring issues with how I'm using the language (We've thus far completely avoided Lifetimes, Traits, Rc, RefCell, etc and that may be hampering things)
**Svelte:** This is our first project using Svelte. We'd love an experienced set of eyes to:
- - Look over the basic structure and tell us if we're making any big mistakes
- - Help us migrate to Svelte 5 when it comes out
+
+- Look over the basic structure and tell us if we're making any big mistakes
+- Help us migrate to Svelte 5 when it comes out
If you feel like you would be willing and able to help, please join [our discord](https://discord.gg/qJCsKJeyZv)!
diff --git a/applications/web/.eslintrc.cjs b/applications/web/.eslintrc.cjs
index 22d2144c..45ba4eff 100644
--- a/applications/web/.eslintrc.cjs
+++ b/applications/web/.eslintrc.cjs
@@ -1,14 +1,13 @@
+/** @type {import("eslint").Linter.Config} */
module.exports = {
- root: true,
- extends: ["eslint:recommended", "plugin:svelte/recommended", "prettier"],
- parserOptions: {
- sourceType: "module",
- ecmaVersion: 2020,
- extraFileExtensions: [".svelte"]
- },
- env: {
- browser: true,
- es2017: true,
- node: true
- }
+ root: true,
+ extends: ["@repo/config-eslint/index.js", "plugin:svelte/recommended"],
+ parserOptions: {
+ extraFileExtensions: [".svelte"],
+ },
+ env: {
+ browser: true,
+ es2017: true,
+ node: true,
+ },
}
diff --git a/applications/web/.prettierrc b/applications/web/.prettierrc
deleted file mode 100644
index 245347b8..00000000
--- a/applications/web/.prettierrc
+++ /dev/null
@@ -1,22 +0,0 @@
-{
- "useTabs": true,
- "singleQuote": false,
- "trailingComma": "none",
- "printWidth": 120,
- "plugins": ["prettier-plugin-svelte"],
- "semi": false,
- "overrides": [
- {
- "files": "*.svelte",
- "options": {
- "parser": "svelte"
- }
- },
- {
- "files": "*.js",
- "options": {
- "semi": false
- }
- }
- ]
-}
diff --git a/applications/web/package.json b/applications/web/package.json
index c3abc50f..12deb765 100644
--- a/applications/web/package.json
+++ b/applications/web/package.json
@@ -1,54 +1,55 @@
{
- "name": "cadmium-web",
- "version": "0.0.1",
- "private": true,
- "scripts": {
- "dev": "vite dev --host",
- "build": "vite build",
- "preview": "vite preview",
- "test": "pnpm test:integration && pnpm test:unit",
- "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"
- },
- "devDependencies": {
- "@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.38",
- "postcss-load-config": "^5.1.0",
- "prettier": "^3.2.5",
- "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.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.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.164.1",
- "troika-three-text": "^0.49.1"
- }
+ "name": "cadmium-web",
+ "version": "0.0.1",
+ "private": true,
+ "scripts": {
+ "dev": "vite dev",
+ "build": "vite build",
+ "preview": "vite preview",
+ "test": "pnpm test:integration && pnpm test:unit",
+ "lint": "prettier --check . && eslint \"src/**/*.ts\"",
+ "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"
+ },
+ "devDependencies": {
+ "@playwright/test": "^1.44.1",
+ "@repo/config-typescript": "workspace:*",
+ "@sveltejs/vite-plugin-svelte": "^3.1.0",
+ "@tsconfig/svelte": "^5.0.4",
+ "autoprefixer": "^10.4.19",
+ "eslint": "^9.3.0",
+ "eslint-config-prettier": "^9.1.0",
+ "eslint-plugin-svelte": "^2.39.0",
+ "phosphor-svelte": "^1.4.2",
+ "postcss": "^8.4.38",
+ "postcss-load-config": "^5.1.0",
+ "prettier": "^3.2.5",
+ "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.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.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.164.1",
+ "troika-three-text": "^0.49.1"
+ }
}
diff --git a/applications/web/playwright.config.js b/applications/web/playwright.config.js
index 4c8ab02c..ec7fbac4 100644
--- a/applications/web/playwright.config.js
+++ b/applications/web/playwright.config.js
@@ -1,11 +1,11 @@
/** @type {import('@playwright/test').PlaywrightTestConfig} */
const config = {
- webServer: {
- command: "npm run build && npm run preview",
- port: 4173
- },
- testDir: "tests",
- testMatch: /(.+\.)?(test|spec)\.[jt]s/
+ webServer: {
+ command: "npm run build && npm run preview",
+ port: 4173,
+ },
+ testDir: "tests",
+ testMatch: /(.+\.)?(test|spec)\.[jt]s/,
}
export default config
diff --git a/applications/web/postcss.config.cjs b/applications/web/postcss.config.cjs
index 9090d179..b1ac3ae7 100644
--- a/applications/web/postcss.config.cjs
+++ b/applications/web/postcss.config.cjs
@@ -2,12 +2,12 @@ const tailwindcss = require("tailwindcss")
const autoprefixer = require("autoprefixer")
const config = {
- plugins: [
- //Some plugins, like tailwindcss/nesting, need to run before Tailwind,
- tailwindcss(),
- //But others, like autoprefixer, need to run after,
- autoprefixer
- ]
+ plugins: [
+ //Some plugins, like tailwindcss/nesting, need to run before Tailwind,
+ tailwindcss(),
+ //But others, like autoprefixer, need to run after,
+ autoprefixer,
+ ],
}
module.exports = config
diff --git a/applications/web/src/App.svelte b/applications/web/src/App.svelte
index 94898763..2f01772c 100644
--- a/applications/web/src/App.svelte
+++ b/applications/web/src/App.svelte
@@ -1,50 +1,50 @@
diff --git a/applications/web/src/components/AppBar.svelte b/applications/web/src/components/AppBar.svelte
index 64bafbdb..12184d88 100644
--- a/applications/web/src/components/AppBar.svelte
+++ b/applications/web/src/components/AppBar.svelte
@@ -1,125 +1,120 @@
-
-
-
-
-
-
CADmium
- {#if renaming}
-
{
- 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}
-
-
{
- log("Renaming project")
- renaming = true
- newProjectName = project.name ?? ""
- }}
- >
- {project.name ?? ""}
-
- {/if}
-
-
{
- let asString = $wasmProject.to_json()
- fileDownload(asString, `${project.name}.cadmium`)
- }}
- >
-
-
+
+
+
+
+
+
CADmium
+ {#if renaming}
+
{
+ 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}
+
+
{
+ log("Renaming project")
+ renaming = true
+ newProjectName = project.name ?? ""
+ }}
+ >
+ {project.name ?? ""}
+
+ {/if}
+
+
{
+ let asString = $wasmProject.to_json()
+ fileDownload(asString, `${project.name}.cadmium`)
+ }}
+ >
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
{
- let asString = JSON.stringify($messageHistory)
- fileDownload(asString, `${project.name}.history.json`)
- }}
- >
-
-
+
+
{
+ let asString = JSON.stringify($messageHistory)
+ fileDownload(asString, `${project.name}.history.json`)
+ }}
+ >
+
+
-
-
-
-
-
{userName}
-
-
+
+
+
+
+
{userName}
+
+
diff --git a/applications/web/src/components/Arc.svelte b/applications/web/src/components/Arc.svelte
index b81efc9a..9f63c020 100644
--- a/applications/web/src/components/Arc.svelte
+++ b/applications/web/src/components/Arc.svelte
@@ -1,73 +1,72 @@
- {
- ref.computeLineDistances()
- }}
- />
- {
- ref.computeLineDistances()
- }}
- />
- {
- ref.computeLineDistances()
- }}
- on:pointerover={() => {
- if ($sketchTool === "select") {
- hovered = true
- $currentlyMousedOver = [...$currentlyMousedOver, { type, id }]
- }
- }}
- on:pointerout={() => {
- if ($sketchTool === "select") {
- hovered = false
- $currentlyMousedOver = $currentlyMousedOver.filter((item) => !(item.id === id && item.type === type))
- }
- }}
- />
+ {
+ ref.computeLineDistances()
+ }}
+ />
+ {
+ ref.computeLineDistances()
+ }}
+ />
+ {
+ ref.computeLineDistances()
+ }}
+ on:pointerover={() => {
+ if ($sketchTool === "select") {
+ hovered = true
+ $currentlyMousedOver = [...$currentlyMousedOver, {type, id}]
+ }
+ }}
+ on:pointerout={() => {
+ if ($sketchTool === "select") {
+ hovered = false
+ $currentlyMousedOver = $currentlyMousedOver.filter(item => !(item.id === id && item.type === type))
+ }
+ }}
+ />
diff --git a/applications/web/src/components/BottomBar.svelte b/applications/web/src/components/BottomBar.svelte
index a3818f07..eceae76a 100644
--- a/applications/web/src/components/BottomBar.svelte
+++ b/applications/web/src/components/BottomBar.svelte
@@ -1,54 +1,54 @@
- {#each workbenches as wb, i (wb.name)}
- {#if wb.renaming}
- {
- log("Renaming workbench index aborted")
- wb.renaming = false
- }}
- on:keydown={(e) => {
- if (e.key === "Enter") {
- log("Renaming workbench index:", i)
- renameWorkbench(new_workbench_name)
- wb.name = new_workbench_name
- workbenchIsStale.set(true)
- wb.renaming = false
- }
- }}
- />
- {:else}
- {
- if ($workbenchIndex !== i) {
- return
- }
+ {#each workbenches as wb, i (wb.name)}
+ {#if wb.renaming}
+ {
+ log("Renaming workbench index aborted")
+ wb.renaming = false
+ }}
+ on:keydown={e => {
+ if (e.key === "Enter") {
+ log("Renaming workbench index:", i)
+ renameWorkbench(new_workbench_name)
+ wb.name = new_workbench_name
+ workbenchIsStale.set(true)
+ wb.renaming = false
+ }
+ }}
+ />
+ {:else}
+ {
+ if ($workbenchIndex !== i) {
+ return
+ }
- log("Renaming workbench index:", i)
- wb.renaming = true
- new_workbench_name = wb.name
- }}
- on:click={() => {
- log("Setting new workbench index:", i)
- workbenchIndex.set(i)
- workbenchIsStale.set(true)
- }}>{wb.name}
- {/if}
- {/each}
+ log("Renaming workbench index:", i)
+ wb.renaming = true
+ new_workbench_name = wb.name
+ }}
+ on:click={() => {
+ log("Setting new workbench index:", i)
+ workbenchIndex.set(i)
+ workbenchIsStale.set(true)
+ }}>{wb.name}
+ {/if}
+ {/each}
diff --git a/applications/web/src/components/Circle.svelte b/applications/web/src/components/Circle.svelte
index 040965e7..57413622 100644
--- a/applications/web/src/components/Circle.svelte
+++ b/applications/web/src/components/Circle.svelte
@@ -1,68 +1,63 @@
- ref.computeLineDistances()}
- />
- {
- ref.computeLineDistances()
- }}
- />
- {
- ref.computeLineDistances()
- }}
- on:pointerover={() => {
- if ($sketchTool === "select") {
- hovered = true
- $currentlyMousedOver = [...$currentlyMousedOver, { type, id }]
- // log("$currentlyMousedOver", $currentlyMousedOver)
- }
- }}
- on:pointerout={() => {
- if ($sketchTool === "select") {
- hovered = false
- $currentlyMousedOver = $currentlyMousedOver.filter((item) => !(item.id === id && item.type === type))
- }
- }}
- />
+ ref.computeLineDistances()} />
+ {
+ ref.computeLineDistances()
+ }}
+ />
+ {
+ ref.computeLineDistances()
+ }}
+ on:pointerover={() => {
+ if ($sketchTool === "select") {
+ hovered = true
+ $currentlyMousedOver = [...$currentlyMousedOver, {type, id}]
+ // log("$currentlyMousedOver", $currentlyMousedOver)
+ }
+ }}
+ on:pointerout={() => {
+ if ($sketchTool === "select") {
+ hovered = false
+ $currentlyMousedOver = $currentlyMousedOver.filter(item => !(item.id === id && item.type === type))
+ }
+ }}
+ />
diff --git a/applications/web/src/components/CubeGizmo/CubeGizmo.svelte b/applications/web/src/components/CubeGizmo/CubeGizmo.svelte
index 2153ce9c..2e878789 100644
--- a/applications/web/src/components/CubeGizmo/CubeGizmo.svelte
+++ b/applications/web/src/components/CubeGizmo/CubeGizmo.svelte
@@ -1,764 +1,746 @@
-
-
-
- {
- if (Array.isArray(parent.material)) parent.material = [...parent.material, self]
- else parent.material = [self]
- }}
- />
- {
- if (Array.isArray(parent.material)) parent.material = [...parent.material, self]
- else parent.material = [self]
- }}
- />
- {
- if (Array.isArray(parent.material)) parent.material = [...parent.material, self]
- else parent.material = [self]
- }}
- />
- {
- if (Array.isArray(parent.material)) parent.material = [...parent.material, self]
- else parent.material = [self]
- }}
- />
- {
- if (Array.isArray(parent.material)) parent.material = [...parent.material, self]
- else parent.material = [self]
- }}
- />
- {
- if (Array.isArray(parent.material)) parent.material = [...parent.material, self]
- else parent.material = [self]
- }}
- />
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+ {
+ if (Array.isArray(parent.material)) parent.material = [...parent.material, self]
+ else parent.material = [self]
+ }}
+ />
+ {
+ if (Array.isArray(parent.material)) parent.material = [...parent.material, self]
+ else parent.material = [self]
+ }}
+ />
+ {
+ if (Array.isArray(parent.material)) parent.material = [...parent.material, self]
+ else parent.material = [self]
+ }}
+ />
+ {
+ if (Array.isArray(parent.material)) parent.material = [...parent.material, self]
+ else parent.material = [self]
+ }}
+ />
+ {
+ if (Array.isArray(parent.material)) parent.material = [...parent.material, self]
+ else parent.material = [self]
+ }}
+ />
+ {
+ if (Array.isArray(parent.material)) parent.material = [...parent.material, self]
+ else parent.material = [self]
+ }}
+ />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/applications/web/src/components/CubeGizmo/CubeGizmo.svelte.ts b/applications/web/src/components/CubeGizmo/CubeGizmo.svelte.ts
index c5445076..2484768f 100644
--- a/applications/web/src/components/CubeGizmo/CubeGizmo.svelte.ts
+++ b/applications/web/src/components/CubeGizmo/CubeGizmo.svelte.ts
@@ -1,8 +1,8 @@
-import { SvelteComponent } from "svelte"
-import type { CubeGizmoProps } from "./CubeGizmo"
+import {SvelteComponent} from "svelte"
+import type {CubeGizmoProps} from "./CubeGizmo"
declare const __propDef: {
- props: CubeGizmoProps
+ props: CubeGizmoProps
}
type CubeGizmoProps_ = typeof __propDef.props
-export { CubeGizmoProps_ as CubeGizmoProps }
+export type {CubeGizmoProps_ as CubeGizmoProps}
export default class CubeGizmo extends SvelteComponent {}
diff --git a/applications/web/src/components/CubeGizmo/CubeGizmo.ts b/applications/web/src/components/CubeGizmo/CubeGizmo.ts
index 99ccac5e..e5866c2d 100644
--- a/applications/web/src/components/CubeGizmo/CubeGizmo.ts
+++ b/applications/web/src/components/CubeGizmo/CubeGizmo.ts
@@ -1,25 +1,25 @@
-import type { Key, ThrelteUseTaskOptions } from "@threlte/core"
-import { SvelteComponent } from "svelte"
-import type { ColorRepresentation } from "three"
-import type { SetCameraFocus } from "shared/types"
+import type {Key, ThrelteUseTaskOptions} from "@threlte/core"
+import {SvelteComponent} from "svelte"
+import type {ColorRepresentation} from "three"
+import type {SetCameraFocus} from "shared/types"
-type TaskOptions = Pick & { key?: Key }
+type TaskOptions = Pick & {key?: Key}
export type CubeGizmoProps = {
- renderTask?: TaskOptions
- animationTask?: TaskOptions
- turnRate?: number
- center?: [number, number, number]
- verticalPlacement?: "top" | "bottom"
- horizontalPlacement?: "left" | "right"
- size?: number
- xColor?: ColorRepresentation
- yColor?: ColorRepresentation
- zColor?: ColorRepresentation
- toneMapped?: boolean
- paddingX?: number
- paddingY?: number
- setCameraFocus: SetCameraFocus
+ renderTask?: TaskOptions
+ animationTask?: TaskOptions
+ turnRate?: number
+ center?: [number, number, number]
+ verticalPlacement?: "top" | "bottom"
+ horizontalPlacement?: "left" | "right"
+ size?: number
+ xColor?: ColorRepresentation
+ yColor?: ColorRepresentation
+ zColor?: ColorRepresentation
+ toneMapped?: boolean
+ paddingX?: number
+ paddingY?: number
+ setCameraFocus: SetCameraFocus
}
export default class CubeGizmo extends SvelteComponent {}
diff --git a/applications/web/src/components/ExtrusionFeature.svelte b/applications/web/src/components/ExtrusionFeature.svelte
index af0fc6bf..24b5707f 100644
--- a/applications/web/src/components/ExtrusionFeature.svelte
+++ b/applications/web/src/components/ExtrusionFeature.svelte
@@ -1,170 +1,165 @@
{
- if ($featureIndex === index) {
- closeAndRefresh()
- } else {
- $featureIndex = index
- // $selectingFor = []
- }
- }}
+ class="flex items-center text-sm hover:bg-sky-200"
+ role="button"
+ tabindex="0"
+ on:dblclick={() => {
+ if ($featureIndex === index) {
+ closeAndRefresh()
+ } else {
+ $featureIndex = index
+ // $selectingFor = []
+ }
+ }}
>
- {#if $featureIndex < index}
-
-
{name}
- {:else}
-
-
{name}
- {/if}
+ {#if $featureIndex < index}
+
+
{name}
+ {:else}
+
+
{name}
+ {/if}
{#if $featureIndex === index}
-
+
{/if}
diff --git a/applications/web/src/components/Face.svelte b/applications/web/src/components/Face.svelte
index fe26378b..b23c5368 100644
--- a/applications/web/src/components/Face.svelte
+++ b/applications/web/src/components/Face.svelte
@@ -1,162 +1,161 @@
- {
- if ($selectingFor.includes(type)) {
- hovered = true
- $currentlyMousedOver = [...$currentlyMousedOver, { type, id }]
- }
- }}
- on:pointerleave={() => {
- if ($selectingFor.includes(type)) {
- hovered = false
- $currentlyMousedOver = $currentlyMousedOver.filter((item) => !(item.id === id && item.type === type))
- }
- }}
- on:click={() => {
- if ($selectingFor.includes(type)) {
- if ($currentlySelected.some((e) => e.id === id && e.type === type)) {
- // this face was already selected, so unselect it
- $currentlySelected = $currentlySelected.filter((item) => !(item.id === id && item.type === type))
- } else {
- // @ts-ignore todo make all numeric ids number type.
- $currentlySelected = [...$currentlySelected, { type, id }]
- }
- }
- }}
- />
-
+ {
+ if ($selectingFor.includes(type)) {
+ hovered = true
+ $currentlyMousedOver = [...$currentlyMousedOver, {type, id}]
+ }
+ }}
+ on:pointerleave={() => {
+ if ($selectingFor.includes(type)) {
+ hovered = false
+ $currentlyMousedOver = $currentlyMousedOver.filter(item => !(item.id === id && item.type === type))
+ }
+ }}
+ on:click={() => {
+ if ($selectingFor.includes(type)) {
+ if ($currentlySelected.some(e => e.id === id && e.type === type)) {
+ // this face was already selected, so unselect it
+ $currentlySelected = $currentlySelected.filter(item => !(item.id === id && item.type === type))
+ } else {
+ // @ts-ignore todo make all numeric ids number type.
+ $currentlySelected = [...$currentlySelected, {type, id}]
+ }
+ }
+ }}
+ />
+
diff --git a/applications/web/src/components/FeatureHistory.svelte b/applications/web/src/components/FeatureHistory.svelte
index 2c55a6f2..aece850c 100644
--- a/applications/web/src/components/FeatureHistory.svelte
+++ b/applications/web/src/components/FeatureHistory.svelte
@@ -1,98 +1,87 @@
-
-
History ({history.length})
- {#each history as feature, featureIdx (feature.data.type + ":" + feature.unique_id)}
-
- {#if isPoint(feature)}
-
- {:else if isPlane(feature)}
-
- {:else if isSketch(feature)}
-
- {:else if isExtrusion(feature)}
-
- {:else}
- TODO: {feature.name} {feature.data.type}
- {/if}
-
- {/each}
-
-
-
-
-
- Solids ({solids ? Object.keys(solids).length : 0})
-
- {#each Object.keys(solids) as name (name)}
-
- {/each}
-
+
+
History ({history.length})
+ {#each history as feature, featureIdx (feature.data.type + ":" + feature.unique_id)}
+
+ {#if isPoint(feature)}
+
+ {:else if isPlane(feature)}
+
+ {:else if isSketch(feature)}
+
+ {:else if isExtrusion(feature)}
+
+ {:else}
+ TODO: {feature.name} {feature.data.type}
+ {/if}
+
+ {/each}
+
+
+
+
+
+ Solids ({solids ? Object.keys(solids).length : 0})
+
+ {#each Object.keys(solids) as name (name)}
+
+ {/each}
+
diff --git a/applications/web/src/components/Line.svelte b/applications/web/src/components/Line.svelte
index 04faebb9..152e67fc 100644
--- a/applications/web/src/components/Line.svelte
+++ b/applications/web/src/components/Line.svelte
@@ -1,80 +1,79 @@
- {
- ref.computeLineDistances()
- }}
- />
- {
- ref.computeLineDistances()
- }}
- />
- {
- ref.computeLineDistances()
- }}
- on:pointerover={() => {
- if ($sketchTool === "select") {
- hovered = true
- $currentlyMousedOver = [...$currentlyMousedOver, { type, id: id }]
- }
- }}
- on:pointerout={() => {
- if ($sketchTool === "select") {
- hovered = false
- $currentlyMousedOver = $currentlyMousedOver.filter((item) => !(item.id === id && item.type === type))
- }
- }}
- />
+ {
+ ref.computeLineDistances()
+ }}
+ />
+ {
+ ref.computeLineDistances()
+ }}
+ />
+ {
+ ref.computeLineDistances()
+ }}
+ on:pointerover={() => {
+ if ($sketchTool === "select") {
+ hovered = true
+ $currentlyMousedOver = [...$currentlyMousedOver, {type, id: id}]
+ }
+ }}
+ on:pointerout={() => {
+ if ($sketchTool === "select") {
+ hovered = false
+ $currentlyMousedOver = $currentlyMousedOver.filter(item => !(item.id === id && item.type === type))
+ }
+ }}
+ />
diff --git a/applications/web/src/components/MainDisplay.svelte b/applications/web/src/components/MainDisplay.svelte
index 83899b1c..e4ce1c52 100644
--- a/applications/web/src/components/MainDisplay.svelte
+++ b/applications/web/src/components/MainDisplay.svelte
@@ -1,51 +1,51 @@
-
+
@@ -53,21 +53,19 @@
{
- if ($selectingFor.length > 0) {
- // If the user is selecting shapes, then click events on the 3D screen
- // should not steal focus away from form inputs
- e.preventDefault()
- }
- }}
+ class="bg-white {$sketchTool === 'line' || $sketchTool === 'circle' || $sketchTool === 'rectangle' ? 'cursor-crosshair' : ''}"
+ style="width:{viewportWidth}px; height:{height}px"
+ on:mousedown={e => {
+ if ($selectingFor.length > 0) {
+ // If the user is selecting shapes, then click events on the 3D screen
+ // should not steal focus away from form inputs
+ e.preventDefault()
+ }
+ }}
>
-
-
-
+
+
+
diff --git a/applications/web/src/components/NewCircleTool.svelte b/applications/web/src/components/NewCircleTool.svelte
index cd0574f6..8adc7fc4 100644
--- a/applications/web/src/components/NewCircleTool.svelte
+++ b/applications/web/src/components/NewCircleTool.svelte
@@ -1,150 +1,149 @@
diff --git a/applications/web/src/components/NewLineTool.svelte b/applications/web/src/components/NewLineTool.svelte
index c1324ae7..eaad6628 100644
--- a/applications/web/src/components/NewLineTool.svelte
+++ b/applications/web/src/components/NewLineTool.svelte
@@ -1,126 +1,125 @@
diff --git a/applications/web/src/components/NewRectangleTool.svelte b/applications/web/src/components/NewRectangleTool.svelte
index 2b26e448..cbfb75f8 100644
--- a/applications/web/src/components/NewRectangleTool.svelte
+++ b/applications/web/src/components/NewRectangleTool.svelte
@@ -1,167 +1,165 @@
diff --git a/applications/web/src/components/PassiveSketch.svelte b/applications/web/src/components/PassiveSketch.svelte
index 688ba91b..8b6ba8d0 100644
--- a/applications/web/src/components/PassiveSketch.svelte
+++ b/applications/web/src/components/PassiveSketch.svelte
@@ -1,342 +1,296 @@
{#if !hidden}
-
- {
- if (editing) {
- if ($sketchTool === "line") {
- newLineTool.click(e, { twoD: projectToPlane(e.point), threeD: e.point })
- } else if ($sketchTool === "circle") {
- newCircleTool.click(e, { twoD: projectToPlane(e.point), threeD: e.point })
- } else if ($sketchTool === "rectangle") {
- newRectangleTool.click(e, { twoD: projectToPlane(e.point), threeD: e.point })
- } else if ($sketchTool === "select") {
- selectTool.click(e, projectToPlane(e.point))
- }
- }
- }}
- on:pointermove={(e) => {
- if (editing) {
- if ($sketchTool === "line") {
- newLineTool.mouseMove(e, projectToPlane(e.point))
- } else if ($sketchTool === "circle") {
- newCircleTool.mouseMove(e, projectToPlane(e.point))
- } else if ($sketchTool === "rectangle") {
- newRectangleTool.mouseMove(e, projectToPlane(e.point))
- }
- }
- }}
- >
-
-
-
-
-
-
-
-
- {
- ref.computeLineDistances()
- }}
- />
-
-
-
-
-
-
-
- {#each circleTuples as circle (circle.id)}
-
- {/each}
-
- {#each arcTuples as arc (arc.id)}
-
- {/each}
-
- {#each lineTuples as line (line.id)}
-
- {/each}
-
- {#each $previewGeometry as geom (geom.uuid)}
- {#if isGeomType(geom, "line")}
-
- {:else if isGeomType(geom, "circle")}
-
- {:else if isGeomType(geom, "point")}
-
- {/if}
- {/each}
-
- {#each pointTuples as { id, twoD, threeD } (id)}
-
- {/each}
-
- {#each faceTuples as face (`${faceTuples.length}-${face.id}`)}
-
- {/each}
-
+
+ {
+ if (editing) {
+ if ($sketchTool === "line") {
+ newLineTool.click(e, {twoD: projectToPlane(e.point), threeD: e.point})
+ } else if ($sketchTool === "circle") {
+ newCircleTool.click(e, {twoD: projectToPlane(e.point), threeD: e.point})
+ } else if ($sketchTool === "rectangle") {
+ newRectangleTool.click(e, {twoD: projectToPlane(e.point), threeD: e.point})
+ } else if ($sketchTool === "select") {
+ selectTool.click(e, projectToPlane(e.point))
+ }
+ }
+ }}
+ on:pointermove={e => {
+ if (editing) {
+ if ($sketchTool === "line") {
+ newLineTool.mouseMove(e, projectToPlane(e.point))
+ } else if ($sketchTool === "circle") {
+ newCircleTool.mouseMove(e, projectToPlane(e.point))
+ } else if ($sketchTool === "rectangle") {
+ newRectangleTool.mouseMove(e, projectToPlane(e.point))
+ }
+ }
+ }}
+ >
+
+
+
+
+
+
+
+
+ {
+ ref.computeLineDistances()
+ }}
+ />
+
+
+
+
+
+
+
+ {#each circleTuples as circle (circle.id)}
+
+ {/each}
+
+ {#each arcTuples as arc (arc.id)}
+
+ {/each}
+
+ {#each lineTuples as line (line.id)}
+
+ {/each}
+
+ {#each $previewGeometry as geom (geom.uuid)}
+ {#if isGeomType(geom, "line")}
+
+ {:else if isGeomType(geom, "circle")}
+
+ {:else if isGeomType(geom, "point")}
+
+ {/if}
+ {/each}
+
+ {#each pointTuples as { id, twoD, threeD } (id)}
+
+ {/each}
+
+ {#each faceTuples as face (`${faceTuples.length}-${face.id}`)}
+
+ {/each}
+
{/if}
diff --git a/applications/web/src/components/Plane.svelte b/applications/web/src/components/Plane.svelte
index 79c732a6..c31f8ad5 100644
--- a/applications/web/src/components/Plane.svelte
+++ b/applications/web/src/components/Plane.svelte
@@ -1,170 +1,146 @@
- {
- if ($selectingFor.includes(type)) {
- e.stopPropagation()
- hovered = true
- $currentlyMousedOver = [...$currentlyMousedOver, { type, id: id }]
- }
- }}
- on:pointerleave={() => {
- if ($selectingFor.includes(type)) {
- hovered = false
- $currentlyMousedOver = $currentlyMousedOver.filter((item) => !(item.id === id && item.type === type))
- } else {
- hovered = false
- }
- }}
- on:click={(e) => {
- if ($selectingFor.includes(type)) {
- e.stopPropagation()
- if ($currentlySelected.some((e) => e.id === id && e.type === type)) {
- if ($currentlySelected.length - 1 < $selectionMin) {
- // we can't deselect if doing so puts us below the minimum
- // number of selected entities
- return
- }
-
- $currentlySelected = $currentlySelected.filter((item) => !(+item.id === +id && item.type === type))
- } else {
- // if selecting this entity puts us above the maximum
- // number of selected entities, boot the oldest one
- if ($currentlySelected.length + 1 > $selectionMax) $currentlySelected.shift()
-
- /** cadmium wants a string for id whereas for most ids it wants number, u64 iirc
+ {
+ if ($selectingFor.includes(type)) {
+ e.stopPropagation()
+ hovered = true
+ $currentlyMousedOver = [...$currentlyMousedOver, {type, id: id}]
+ }
+ }}
+ on:pointerleave={() => {
+ if ($selectingFor.includes(type)) {
+ hovered = false
+ $currentlyMousedOver = $currentlyMousedOver.filter(item => !(item.id === id && item.type === type))
+ } else {
+ hovered = false
+ }
+ }}
+ on:click={e => {
+ if ($selectingFor.includes(type)) {
+ e.stopPropagation()
+ if ($currentlySelected.some(e => e.id === id && e.type === type)) {
+ if ($currentlySelected.length - 1 < $selectionMin) {
+ // we can't deselect if doing so puts us below the minimum
+ // number of selected entities
+ return
+ }
+
+ $currentlySelected = $currentlySelected.filter(item => !(+item.id === +id && item.type === type))
+ } else {
+ // if selecting this entity puts us above the maximum
+ // number of selected entities, boot the oldest one
+ if ($currentlySelected.length + 1 > $selectionMax) $currentlySelected.shift()
+
+ /** cadmium wants a string for id whereas for most ids it wants number, u64 iirc
we should use number for all entity ids? seems cleaner to use one type. otherwise we could do:
interface Entity {
@@ -191,26 +167,26 @@
edit: stick with strings in the ui - the dom only has strings and some of our ids are not numeric strings
simply convert to number before sending to rust as required
*/
- // @ts-ignore
- $currentlySelected = [...$currentlySelected, { type, id: id.toString() }]
- }
- }
- }}
- >
-
-
-
- {
- ref.computeLineDistances()
- }}
- />
-
-
-
-
-
-
+ // @ts-ignore
+ $currentlySelected = [...$currentlySelected, {type, id: id.toString()}]
+ }
+ }
+ }}
+ >
+
+
+
+ {
+ ref.computeLineDistances()
+ }}
+ />
+
+
+
+
+
+
diff --git a/applications/web/src/components/PlaneFeature.svelte b/applications/web/src/components/PlaneFeature.svelte
index a9ff2897..9f943447 100644
--- a/applications/web/src/components/PlaneFeature.svelte
+++ b/applications/web/src/components/PlaneFeature.svelte
@@ -1,93 +1,91 @@
{
- if ($featureIndex === index) {
- closeAndRefresh()
- } else {
- $featureIndex = index
- }
- }}
+ class="flex items-center text-sm hover:bg-sky-200"
+ role="button"
+ tabindex="0"
+ on:dblclick={() => {
+ if ($featureIndex === index) {
+ closeAndRefresh()
+ } else {
+ $featureIndex = index
+ }
+ }}
>
- {#if $featureIndex < index}
-
-
{name}
- {:else}
-
-
{name}
- {/if}
+ {#if $featureIndex < index}
+
+
{name}
+ {:else}
+
+
{name}
+ {/if}
-
-
-
{
- setCameraFocus(plane.tertiary, plane.origin, plane.secondary)
- // move camera to focus on plane
- }}
- >
-
-
+
+
+
{
+ setCameraFocus(plane.tertiary, plane.origin, plane.secondary)
+ // move camera to focus on plane
+ }}
+ >
+
+
{#if $featureIndex === index}
-
{/if}
diff --git a/applications/web/src/components/Point2D.svelte b/applications/web/src/components/Point2D.svelte
index 0d0f54ab..d2b43da5 100644
--- a/applications/web/src/components/Point2D.svelte
+++ b/applications/web/src/components/Point2D.svelte
@@ -1,105 +1,89 @@
{#if !hidden}
- {#await pointTexture then pointImg}
- {#await outlineTexture then outlineImg}
- {
- if (isPreview) return
- if (validTools.includes($sketchTool)) {
- hovered = true
- $currentlyMousedOver = [...$currentlyMousedOver, { type, id }]
- }
- }}
- on:pointerout={() => {
- if (isPreview) return
- if (validTools.includes($sketchTool)) {
- hovered = false
- $currentlyMousedOver = $currentlyMousedOver.filter((item) => !(item.id === id && item.type === type))
- }
- }}
- >
- {
- ref.computeLineDistances()
- }}
- />
+ {#await pointTexture then pointImg}
+ {#await outlineTexture then outlineImg}
+ {
+ if (isPreview) return
+ if (validTools.includes($sketchTool)) {
+ hovered = true
+ $currentlyMousedOver = [...$currentlyMousedOver, {type, id}]
+ }
+ }}
+ on:pointerout={() => {
+ if (isPreview) return
+ if (validTools.includes($sketchTool)) {
+ hovered = false
+ $currentlyMousedOver = $currentlyMousedOver.filter(item => !(item.id === id && item.type === type))
+ }
+ }}
+ >
+ {
+ ref.computeLineDistances()
+ }}
+ />
- {
- ref.computeLineDistances()
- }}
- />
-
-
-
-
- {#if hovered || selected}
-
-
-
- {/if}
- {/await}
- {/await}
+ {
+ ref.computeLineDistances()
+ }}
+ />
+
+
+
+
+ {#if hovered || selected}
+
+
+
+ {/if}
+ {/await}
+ {/await}
{/if}
diff --git a/applications/web/src/components/Point3D.svelte b/applications/web/src/components/Point3D.svelte
index 1f4a25d3..81552a5f 100644
--- a/applications/web/src/components/Point3D.svelte
+++ b/applications/web/src/components/Point3D.svelte
@@ -1,105 +1,89 @@
{#if !hidden}
- {#await pointTexture then pointImg}
- {#await outlineTexture then outlineImg}
- {
- if (isPreview) return
- if (validTools.includes($sketchTool)) {
- hovered = true
- $currentlyMousedOver = [...$currentlyMousedOver, { type, id, x, y, z }]
- }
- }}
- on:pointerout={() => {
- if (isPreview) return
- if (validTools.includes($sketchTool)) {
- hovered = false
- $currentlyMousedOver = $currentlyMousedOver.filter((item) => !(item.id === id && item.type === type))
- }
- }}
- >
- {
- ref.computeLineDistances()
- }}
- />
+ {#await pointTexture then pointImg}
+ {#await outlineTexture then outlineImg}
+ {
+ if (isPreview) return
+ if (validTools.includes($sketchTool)) {
+ hovered = true
+ $currentlyMousedOver = [...$currentlyMousedOver, {type, id, x, y, z}]
+ }
+ }}
+ on:pointerout={() => {
+ if (isPreview) return
+ if (validTools.includes($sketchTool)) {
+ hovered = false
+ $currentlyMousedOver = $currentlyMousedOver.filter(item => !(item.id === id && item.type === type))
+ }
+ }}
+ >
+ {
+ ref.computeLineDistances()
+ }}
+ />
- {
- ref.computeLineDistances()
- }}
- />
-
-
-
-
- {#if hovered || selected}
-
-
-
- {/if}
- {/await}
- {/await}
+ {
+ ref.computeLineDistances()
+ }}
+ />
+
+
+
+
+ {#if hovered || selected}
+
+
+
+ {/if}
+ {/await}
+ {/await}
{/if}
diff --git a/applications/web/src/components/PointFeature.svelte b/applications/web/src/components/PointFeature.svelte
index b48ba439..ee24daac 100644
--- a/applications/web/src/components/PointFeature.svelte
+++ b/applications/web/src/components/PointFeature.svelte
@@ -1,71 +1,69 @@
{
- if ($featureIndex === index) {
- closeAndRefresh()
- } else {
- $featureIndex = index
- }
- }}
+ class="flex items-center text-sm hover:bg-sky-200"
+ role="button"
+ tabindex="0"
+ on:dblclick={() => {
+ if ($featureIndex === index) {
+ closeAndRefresh()
+ } else {
+ $featureIndex = index
+ }
+ }}
>
-
- {name}
+
+ {name}
{#if $featureIndex === index}
-
-
{
- closeAndRefresh()
- }}
- class="px-3 py-2 bg-gray-100 flex flex-col space-y-2"
- autocomplete="off"
- >
-
- Name
-
-
+
+
{
+ closeAndRefresh()
+ }}
+ class="px-3 py-2 bg-gray-100 flex flex-col space-y-2"
+ autocomplete="off"
+ >
+
+ Name
+
+
-
-
{
- renameStep(index, name)
- }}>Done
+
+ {
+ renameStep(index, name)
+ }}>Done
- Cancel
-
-
-
+ Cancel
+
+
+
{/if}
diff --git a/applications/web/src/components/Scene.svelte b/applications/web/src/components/Scene.svelte
index 8124262b..fa946529 100644
--- a/applications/web/src/components/Scene.svelte
+++ b/applications/web/src/components/Scene.svelte
@@ -1,135 +1,127 @@
- {}}
- mouseButtons={{ LEFT: 2, MIDDLE: 50, RIGHT: 1 }}
- />
+ {}} mouseButtons={{LEFT: 2, MIDDLE: 50, RIGHT: 1}} />
-
- {
- if ($hiddenSketches.includes(id)) {
- // cool, unhide
- hiddenSketches.update((sketches) => {
- return sketches.filter((sketch) => sketch !== id)
- })
- } else {
- // cool, hide
- hiddenSketches.update((sketches) => {
- return [...sketches, id]
- })
- }
- }}
- >
- {#if $hiddenSketches.includes(id)}
-
- {:else}
-
- {/if}
-
+ {#if $featureIndex < index}
+
+ {name}
+ {:else}
+
+ {name}
+ {/if}
+
+
+
+ {
+ if ($hiddenSketches.includes(id)) {
+ // cool, unhide
+ hiddenSketches.update(sketches => {
+ return sketches.filter(sketch => sketch !== id)
+ })
+ } else {
+ // cool, hide
+ hiddenSketches.update(sketches => {
+ return [...sketches, id]
+ })
+ }
+ }}
+ >
+ {#if $hiddenSketches.includes(id)}
+
+ {:else}
+
+ {/if}
+
{#if $featureIndex === index}
-
-
{
- // editing = false
- closeAndRefresh()
- }}
- class="px-3 py-2 bg-gray-100 flex flex-col space-y-2"
- autocomplete="off"
- >
-
- Name
-
-
-
-
- Surface
-
-
- {#if surface !== null}
-
- {surface.type}:{surface.id} {
- surface = null
- }}>
-
- {/if}
-
-
-
- {
- // This is a form button so remember that it triggers the form's on:submit
- renameStep(index, name)
- }}>Done
-
- Cancel
-
-
-
+
+
{
+ // editing = false
+ closeAndRefresh()
+ }}
+ class="px-3 py-2 bg-gray-100 flex flex-col space-y-2"
+ autocomplete="off"
+ >
+
+ Name
+
+
+
+
+ Surface
+
+
+ {#if surface !== null}
+
+ {surface.type}:{surface.id} {
+ surface = null
+ }}>
+
+ {/if}
+
+
+
+ {
+ // This is a form button so remember that it triggers the form's on:submit
+ renameStep(index, name)
+ }}>Done
+
+ Cancel
+
+
+
{/if}
diff --git a/applications/web/src/components/Solid.svelte b/applications/web/src/components/Solid.svelte
index 75ad367a..f68c7c03 100644
--- a/applications/web/src/components/Solid.svelte
+++ b/applications/web/src/components/Solid.svelte
@@ -1,72 +1,71 @@
-
-
+
+
- {#each truck_faces as truck_face, i (i)}
-
- {/each}
+ {#each truck_faces as truck_face, i (i)}
+
+ {/each}
diff --git a/applications/web/src/components/SolidItem.svelte b/applications/web/src/components/SolidItem.svelte
index 2c2b4c52..83a31e32 100644
--- a/applications/web/src/components/SolidItem.svelte
+++ b/applications/web/src/components/SolidItem.svelte
@@ -1,116 +1,112 @@
{
- log("solid", e)
- rightClickContextMenu(e)
- }}
+ class="flex items-center text-sm hover:bg-sky-200"
+ role="button"
+ tabindex="0"
+ on:contextmenu|preventDefault={e => {
+ log("solid", e)
+ rightClickContextMenu(e)
+ }}
>
-
- {name}
+
+ {name}
{#if contextMenuVisible}
-
-
-
-
-
- Download as OBJ
-
-
+
+
+
+
+
+ Download as OBJ
+
+
-
-
- Download as STEP
-
-
-
-
-
+
+
+ Download as STEP
+
+
+
+
+
{/if}
diff --git a/applications/web/src/components/ToolBar.svelte b/applications/web/src/components/ToolBar.svelte
index 89b6983a..3e121294 100644
--- a/applications/web/src/components/ToolBar.svelte
+++ b/applications/web/src/components/ToolBar.svelte
@@ -1,104 +1,88 @@
- {#if $sketchBeingEdited !== ""}
- {#each sketchActions as action}
-
- {action.text ? action.text : ""}
-
- {/each}
- {:else}
- {#each actions as action}
-
- {action.text ? action.text : ""}
-
- {/each}
- {/if}
+ {#if $sketchBeingEdited !== ""}
+ {#each sketchActions as action}
+
+ {action.text ? action.text : ""}
+
+ {/each}
+ {:else}
+ {#each actions as action}
+
+ {action.text ? action.text : ""}
+
+ {/each}
+ {/if}
- {#if debugging}
- Selecting For [
- {#each $selectingFor as sf}
-
- {sf},
-
- {/each}
- ] Currently Selected [
- {#each $currentlySelected as cs}
-
- {cs.type}
- {cs.id},
-
- {/each}
- ] Moused Over [
- {#each $currentlyMousedOver as cm}
-
- {cm.type}
- {cm.id},
-
- {/each}
- ] Hidden Sketches [
- {#each $hiddenSketches as hs}
-
- {hs},
-
- {/each}
- ]
- {/if}
+ {#if debugging}
+ Selecting For [
+ {#each $selectingFor as sf}
+
+ {sf},
+
+ {/each}
+ ] Currently Selected [
+ {#each $currentlySelected as cs}
+
+ {cs.type}
+ {cs.id},
+
+ {/each}
+ ] Moused Over [
+ {#each $currentlyMousedOver as cm}
+
+ {cm.type}
+ {cm.id},
+
+ {/each}
+ ] Hidden Sketches [
+ {#each $hiddenSketches as hs}
+
+ {hs},
+
+ {/each}
+ ]
+ {/if}
diff --git a/applications/web/src/main.ts b/applications/web/src/main.ts
index 05a27dd4..d1255ba4 100644
--- a/applications/web/src/main.ts
+++ b/applications/web/src/main.ts
@@ -1,8 +1,8 @@
import "@fontsource-variable/manrope"
import "./app.postcss"
import App from "./App.svelte"
-import { mount } from "svelte"
+import {mount} from "svelte"
-const app = mount(App, { target: document.getElementById("app") })
+const app = mount(App, {target: document.getElementById("app")})
export default app
diff --git a/applications/web/src/tests/unit/fixtures.js b/applications/web/src/tests/unit/fixtures.js
index 6b9cdf0d..9ad7a827 100644
--- a/applications/web/src/tests/unit/fixtures.js
+++ b/applications/web/src/tests/unit/fixtures.js
@@ -1,300 +1,300 @@
export const currentlySelected = [
- {
- type: "line",
- id: "9"
- },
- {
- type: "meshFace",
- id: "8"
- },
- {
- type: "point3D",
- id: "7"
- },
- {
- type: "point",
- id: "6"
- },
- {
- type: "plane",
- id: "5"
- },
- {
- type: "plane",
- id: "4"
- },
- {
- type: "face",
- id: "3"
- },
- {
- type: "arc",
- id: "2"
- },
- {
- type: "circle",
- id: "1"
- }
+ {
+ type: "line",
+ id: "9",
+ },
+ {
+ type: "meshFace",
+ id: "8",
+ },
+ {
+ type: "point3D",
+ id: "7",
+ },
+ {
+ type: "point",
+ id: "6",
+ },
+ {
+ type: "plane",
+ id: "5",
+ },
+ {
+ type: "plane",
+ id: "4",
+ },
+ {
+ type: "face",
+ id: "3",
+ },
+ {
+ type: "arc",
+ id: "2",
+ },
+ {
+ type: "circle",
+ id: "1",
+ },
]
export const project = {
- name: "First Project",
- assemblies: [],
- workbenches: [
- {
- name: "Workbench 1",
- history: [
- {
- name: "Origin",
- unique_id: "Point-0",
- suppressed: false,
- data: {
- type: "Point",
- point: {
- x: 0,
- y: 0,
- z: 0,
- hidden: false
- }
- }
- },
- {
- name: "Top",
- unique_id: "Plane-0",
- suppressed: false,
- data: {
- type: "Plane",
- plane: {
- origin: {
- x: 0,
- y: 0,
- z: 0,
- hidden: false
- },
- primary: {
- x: 1,
- y: 0,
- z: 0
- },
- secondary: {
- x: 0,
- y: 1,
- z: 0
- },
- tertiary: {
- x: 0,
- y: 0,
- z: 1
- }
- },
- width: 100,
- height: 100
- }
- },
- {
- name: "Front",
- unique_id: "Plane-1",
- suppressed: false,
- data: {
- type: "Plane",
- plane: {
- origin: {
- x: 0,
- y: 0,
- z: 0,
- hidden: false
- },
- primary: {
- x: 1,
- y: 0,
- z: 0
- },
- secondary: {
- x: 0,
- y: 0,
- z: 1
- },
- tertiary: {
- x: 0,
- y: -1,
- z: 0
- }
- },
- width: 100,
- height: 100
- }
- },
- {
- name: "Right",
- unique_id: "Plane-2",
- suppressed: false,
- data: {
- type: "Plane",
- plane: {
- origin: {
- x: 0,
- y: 0,
- z: 0,
- hidden: false
- },
- primary: {
- x: 0,
- y: 1,
- z: 0
- },
- secondary: {
- x: 0,
- y: 0,
- z: 1
- },
- tertiary: {
- x: 1,
- y: 0,
- z: 0
- }
- },
- width: 100,
- height: 100
- }
- },
- {
- name: "Sketch 1",
- unique_id: "Sketch-0",
- suppressed: false,
- data: {
- type: "Sketch",
- plane_description: {
- PlaneId: "Plane-0"
- },
- width: 1.25,
- height: 0.75,
- sketch: {
- points: {
- 1: {
- x: -52.95156757144787,
- y: 7.317926785688712,
- m: 1,
- dx: 0,
- dy: 0,
- fx: 0,
- fy: 0,
- fixed: false,
- hidden: false
- },
- 2: {
- x: 76.03513162109667,
- y: -45.27256950397148,
- m: 1,
- dx: 0,
- dy: 0,
- fx: 0,
- fy: 0,
- fixed: false,
- hidden: false
- },
- 3: {
- x: 76.03513162109667,
- y: 7.317926785688712,
- m: 1,
- dx: 0,
- dy: 0,
- fx: 0,
- fy: 0,
- fixed: false,
- hidden: false
- },
- 4: {
- x: -52.95156757144787,
- y: -45.27256950397148,
- m: 1,
- dx: 0,
- dy: 0,
- fx: 0,
- fy: 0,
- fixed: false,
- hidden: false
- },
- 5: {
- x: -9.20153199031077,
- y: -21.640848057170956,
- m: 1,
- dx: 0,
- dy: 0,
- fx: 0,
- fy: 0,
- fixed: false,
- hidden: false
- },
- 6: {
- x: 3.837447277628939,
- y: -26.044145549343227,
- m: 1,
- dx: 0,
- dy: 0,
- fx: 0,
- fy: 0,
- fixed: false,
- hidden: true
- }
- },
- highest_point_id: 6,
- line_segments: {
- 1: {
- start: 1,
- end: 4
- },
- 2: {
- start: 4,
- end: 2
- },
- 3: {
- start: 2,
- end: 3
- },
- 4: {
- start: 3,
- end: 1
- }
- },
- highest_line_segment_id: 4,
- circles: {
- 1: {
- center: 5,
- radius: 13.76241291178012,
- top: 6
- }
- },
- highest_circle_id: 1,
- arcs: {},
- highest_arc_id: 0,
- constraints: {},
- highest_constraint_id: 0
- }
- }
- },
- {
- name: "Extrusion 1",
- unique_id: "Extrusion-0",
- suppressed: false,
- data: {
- type: "Extrusion",
- extrusion: {
- sketch_id: "Sketch-0",
- face_ids: [1],
- length: 200,
- offset: 0,
- direction: "Normal",
- mode: "New"
- }
- }
- }
- ],
- step_counters: {
- Sketch: 1,
- Extrusion: 1,
- Point: 1,
- Plane: 3
- }
- }
- ]
+ name: "First Project",
+ assemblies: [],
+ workbenches: [
+ {
+ name: "Workbench 1",
+ history: [
+ {
+ name: "Origin",
+ unique_id: "Point-0",
+ suppressed: false,
+ data: {
+ type: "Point",
+ point: {
+ x: 0,
+ y: 0,
+ z: 0,
+ hidden: false,
+ },
+ },
+ },
+ {
+ name: "Top",
+ unique_id: "Plane-0",
+ suppressed: false,
+ data: {
+ type: "Plane",
+ plane: {
+ origin: {
+ x: 0,
+ y: 0,
+ z: 0,
+ hidden: false,
+ },
+ primary: {
+ x: 1,
+ y: 0,
+ z: 0,
+ },
+ secondary: {
+ x: 0,
+ y: 1,
+ z: 0,
+ },
+ tertiary: {
+ x: 0,
+ y: 0,
+ z: 1,
+ },
+ },
+ width: 100,
+ height: 100,
+ },
+ },
+ {
+ name: "Front",
+ unique_id: "Plane-1",
+ suppressed: false,
+ data: {
+ type: "Plane",
+ plane: {
+ origin: {
+ x: 0,
+ y: 0,
+ z: 0,
+ hidden: false,
+ },
+ primary: {
+ x: 1,
+ y: 0,
+ z: 0,
+ },
+ secondary: {
+ x: 0,
+ y: 0,
+ z: 1,
+ },
+ tertiary: {
+ x: 0,
+ y: -1,
+ z: 0,
+ },
+ },
+ width: 100,
+ height: 100,
+ },
+ },
+ {
+ name: "Right",
+ unique_id: "Plane-2",
+ suppressed: false,
+ data: {
+ type: "Plane",
+ plane: {
+ origin: {
+ x: 0,
+ y: 0,
+ z: 0,
+ hidden: false,
+ },
+ primary: {
+ x: 0,
+ y: 1,
+ z: 0,
+ },
+ secondary: {
+ x: 0,
+ y: 0,
+ z: 1,
+ },
+ tertiary: {
+ x: 1,
+ y: 0,
+ z: 0,
+ },
+ },
+ width: 100,
+ height: 100,
+ },
+ },
+ {
+ name: "Sketch 1",
+ unique_id: "Sketch-0",
+ suppressed: false,
+ data: {
+ type: "Sketch",
+ plane_description: {
+ PlaneId: "Plane-0",
+ },
+ width: 1.25,
+ height: 0.75,
+ sketch: {
+ points: {
+ 1: {
+ x: -52.95156757144787,
+ y: 7.317926785688712,
+ m: 1,
+ dx: 0,
+ dy: 0,
+ fx: 0,
+ fy: 0,
+ fixed: false,
+ hidden: false,
+ },
+ 2: {
+ x: 76.03513162109667,
+ y: -45.27256950397148,
+ m: 1,
+ dx: 0,
+ dy: 0,
+ fx: 0,
+ fy: 0,
+ fixed: false,
+ hidden: false,
+ },
+ 3: {
+ x: 76.03513162109667,
+ y: 7.317926785688712,
+ m: 1,
+ dx: 0,
+ dy: 0,
+ fx: 0,
+ fy: 0,
+ fixed: false,
+ hidden: false,
+ },
+ 4: {
+ x: -52.95156757144787,
+ y: -45.27256950397148,
+ m: 1,
+ dx: 0,
+ dy: 0,
+ fx: 0,
+ fy: 0,
+ fixed: false,
+ hidden: false,
+ },
+ 5: {
+ x: -9.20153199031077,
+ y: -21.640848057170956,
+ m: 1,
+ dx: 0,
+ dy: 0,
+ fx: 0,
+ fy: 0,
+ fixed: false,
+ hidden: false,
+ },
+ 6: {
+ x: 3.837447277628939,
+ y: -26.044145549343227,
+ m: 1,
+ dx: 0,
+ dy: 0,
+ fx: 0,
+ fy: 0,
+ fixed: false,
+ hidden: true,
+ },
+ },
+ highest_point_id: 6,
+ line_segments: {
+ 1: {
+ start: 1,
+ end: 4,
+ },
+ 2: {
+ start: 4,
+ end: 2,
+ },
+ 3: {
+ start: 2,
+ end: 3,
+ },
+ 4: {
+ start: 3,
+ end: 1,
+ },
+ },
+ highest_line_segment_id: 4,
+ circles: {
+ 1: {
+ center: 5,
+ radius: 13.76241291178012,
+ top: 6,
+ },
+ },
+ highest_circle_id: 1,
+ arcs: {},
+ highest_arc_id: 0,
+ constraints: {},
+ highest_constraint_id: 0,
+ },
+ },
+ },
+ {
+ name: "Extrusion 1",
+ unique_id: "Extrusion-0",
+ suppressed: false,
+ data: {
+ type: "Extrusion",
+ extrusion: {
+ sketch_id: "Sketch-0",
+ face_ids: [1],
+ length: 200,
+ offset: 0,
+ direction: "Normal",
+ mode: "New",
+ },
+ },
+ },
+ ],
+ step_counters: {
+ Sketch: 1,
+ Extrusion: 1,
+ Point: 1,
+ Plane: 3,
+ },
+ },
+ ],
}
diff --git a/applications/web/src/tests/unit/index.test.js b/applications/web/src/tests/unit/index.test.js
index 4eac6e6c..a35ea2d5 100644
--- a/applications/web/src/tests/unit/index.test.js
+++ b/applications/web/src/tests/unit/index.test.js
@@ -1,131 +1,131 @@
-import { describe, it, expect } from "vitest"
-import { isEntity, isEntityType, isProject } from "shared/typeGuards"
-import { currentlySelected, project } from "./fixtures"
+import {describe, it, expect} from "vitest"
+import {isEntity, isEntityType, isProject} from "shared/typeGuards"
+import {currentlySelected, project} from "./fixtures"
describe("isEntityType typechecks", () => {
- const types = ["circle", "arc", "face", "line", "plane", "point", "point3D", "meshFace"]
- const circleObject = {}
- const circleFunction = () => "circle"
+ const types = ["circle", "arc", "face", "line", "plane", "point", "point3D", "meshFace"]
+ const circleObject = {}
+ const circleFunction = () => "circle"
- it("typechecks all EntityType", () => {
- expect(types.every((entityType) => isEntityType(entityType))).toBe(true)
- })
- it("'circles' type fails", () => {
- expect([...types, "circles"].every((entityType) => isEntityType(entityType))).toBe(false)
- })
- it("'{}' fails", () => {
- expect(["circle", circleObject].every((entityType) => isEntityType(entityType))).toBe(false)
- })
- it("function returning string of correct type succeeds", () => {
- expect(["circle", circleFunction()].every((entityType) => isEntityType(entityType))).toBe(true)
- })
+ it("typechecks all EntityType", () => {
+ expect(types.every(entityType => isEntityType(entityType))).toBe(true)
+ })
+ it("'circles' type fails", () => {
+ expect([...types, "circles"].every(entityType => isEntityType(entityType))).toBe(false)
+ })
+ it("'{}' fails", () => {
+ expect(["circle", circleObject].every(entityType => isEntityType(entityType))).toBe(false)
+ })
+ it("function returning string of correct type succeeds", () => {
+ expect(["circle", circleFunction()].every(entityType => isEntityType(entityType))).toBe(true)
+ })
})
describe("currentlySelected is Entity[]", () => {
- it("every currentlySelected item isEntity", () => {
- expect(currentlySelected.every((entity) => isEntity(entity))).toBe(true)
- })
+ it("every currentlySelected item isEntity", () => {
+ expect(currentlySelected.every(entity => isEntity(entity))).toBe(true)
+ })
- it("fails on type:'circles'", () => {
- expect([...currentlySelected, { type: "circles", id: "1" }].every((entity) => isEntity(entity))).toBe(false)
- })
- it("fails with id:number", () => {
- expect(
- [
- { type: "point", id: 3 },
- { type: "circle", id: "1" }
- ].every((entity) => isEntity(entity))
- ).toBe(false)
- })
- it("fails with id:object", () => {
- expect(
- [
- { type: "point", id: { type: "circle", id: "1" } },
- { type: "circle", id: "1" }
- ].every((entity) => isEntity(entity))
- ).toBe(false)
- })
- it("fails when missing type", () => {
- expect(
- [
- { type: "point", id: "3" },
- { id: "1", typez: "point" }
- ].every((entity) => isEntity(entity))
- ).toBe(false)
- })
- it("fails when missing id", () => {
- expect(
- [
- { type: "point", notId: "99" },
- { type: "circle", id: "1" }
- ].every((entity) => isEntity(entity))
- ).toBe(false)
- })
- it("fails on extra properties", () => {
- expect(
- [
- { type: "point", id: "a string" },
- { type: "circle", id: "1", errantProperty: "string" }
- ].every((entity) => isEntity(entity))
- ).toBe(false)
- })
+ it("fails on type:'circles'", () => {
+ expect([...currentlySelected, {type: "circles", id: "1"}].every(entity => isEntity(entity))).toBe(false)
+ })
+ it("fails with id:number", () => {
+ expect(
+ [
+ {type: "point", id: 3},
+ {type: "circle", id: "1"},
+ ].every(entity => isEntity(entity)),
+ ).toBe(false)
+ })
+ it("fails with id:object", () => {
+ expect(
+ [
+ {type: "point", id: {type: "circle", id: "1"}},
+ {type: "circle", id: "1"},
+ ].every(entity => isEntity(entity)),
+ ).toBe(false)
+ })
+ it("fails when missing type", () => {
+ expect(
+ [
+ {type: "point", id: "3"},
+ {id: "1", typez: "point"},
+ ].every(entity => isEntity(entity)),
+ ).toBe(false)
+ })
+ it("fails when missing id", () => {
+ expect(
+ [
+ {type: "point", notId: "99"},
+ {type: "circle", id: "1"},
+ ].every(entity => isEntity(entity)),
+ ).toBe(false)
+ })
+ it("fails on extra properties", () => {
+ expect(
+ [
+ {type: "point", id: "a string"},
+ {type: "circle", id: "1", errantProperty: "string"},
+ ].every(entity => isEntity(entity)),
+ ).toBe(false)
+ })
})
describe("currentlySelected has malformed entities", () => {
- it("currentlySelected has no duplicates", () => {
- const set = new Set()
- currentlySelected.forEach((entity) => set.add(entity.id))
- expect(currentlySelected.length === set.size).toBe(true)
- })
- it("fails when currentlySelected has duplicates", () => {
- const set = new Set()
- const duplicates = [...currentlySelected, { type: "circle", id: "1" }]
- duplicates.forEach((entity) => set.add(entity.id))
- expect(duplicates.length === set.size).toBe(false)
- })
+ it("currentlySelected has no duplicates", () => {
+ const set = new Set()
+ currentlySelected.forEach(entity => set.add(entity.id))
+ expect(currentlySelected.length === set.size).toBe(true)
+ })
+ it("fails when currentlySelected has duplicates", () => {
+ const set = new Set()
+ const duplicates = [...currentlySelected, {type: "circle", id: "1"}]
+ duplicates.forEach(entity => set.add(entity.id))
+ expect(duplicates.length === set.size).toBe(false)
+ })
})
describe("currentlySelected has malformed entities", () => {
- it("currentlySelected has no duplicates", () => {
- const set = new Set()
- currentlySelected.forEach((entity) => set.add(entity.id))
- expect(currentlySelected.length === set.size).toBe(true)
- })
- it("fails when currentlySelected has duplicates", () => {
- const set = new Set()
- const duplicates = [...currentlySelected, { type: "circle", id: "1" }]
- duplicates.forEach((entity) => set.add(entity.id))
- expect(duplicates.length === set.size).toBe(false)
- })
+ it("currentlySelected has no duplicates", () => {
+ const set = new Set()
+ currentlySelected.forEach(entity => set.add(entity.id))
+ expect(currentlySelected.length === set.size).toBe(true)
+ })
+ it("fails when currentlySelected has duplicates", () => {
+ const set = new Set()
+ const duplicates = [...currentlySelected, {type: "circle", id: "1"}]
+ duplicates.forEach(entity => set.add(entity.id))
+ expect(duplicates.length === set.size).toBe(false)
+ })
})
describe("isProject typechecks", () => {
- it("project is correct shape", () => {
- expect(isProject(project)).toBe(true)
- })
- it("project is valid when workbenches: []", () => {
- expect(isProject({ ...project, workbenches: [] })).toBe(true)
- })
+ it("project is correct shape", () => {
+ expect(isProject(project)).toBe(true)
+ })
+ it("project is valid when workbenches: []", () => {
+ expect(isProject({...project, workbenches: []})).toBe(true)
+ })
- it("fails when assemblies: null", () => {
- expect(isProject({ ...project, assemblies: null })).toBe(false)
- })
- it("fails when name: null", () => {
- expect(isProject({ ...project, name: null })).toBe(false)
- })
- it("fails when name: number", () => {
- expect(isProject({ ...project, name: 123 })).toBe(false)
- })
- it("fails when name: object", () => {
- expect(isProject({ ...project, name: {} })).toBe(false)
- })
- it("fails when name: array", () => {
- expect(isProject({ ...project, name: [] })).toBe(false)
- })
- it("fails when workbenches: null", () => {
- expect(isProject({ ...project, workbenches: null })).toBe(false)
- })
- it("fails when workbenches: {}", () => {
- expect(isProject({ ...project, workbenches: {} })).toBe(false)
- })
+ it("fails when assemblies: null", () => {
+ expect(isProject({...project, assemblies: null})).toBe(false)
+ })
+ it("fails when name: null", () => {
+ expect(isProject({...project, name: null})).toBe(false)
+ })
+ it("fails when name: number", () => {
+ expect(isProject({...project, name: 123})).toBe(false)
+ })
+ it("fails when name: object", () => {
+ expect(isProject({...project, name: {}})).toBe(false)
+ })
+ it("fails when name: array", () => {
+ expect(isProject({...project, name: []})).toBe(false)
+ })
+ it("fails when workbenches: null", () => {
+ expect(isProject({...project, workbenches: null})).toBe(false)
+ })
+ it("fails when workbenches: {}", () => {
+ expect(isProject({...project, workbenches: {}})).toBe(false)
+ })
})
diff --git a/applications/web/src/utils.ts b/applications/web/src/utils.ts
index 91ca56b7..6e6752ae 100644
--- a/applications/web/src/utils.ts
+++ b/applications/web/src/utils.ts
@@ -2,25 +2,25 @@
// todo
export function isDevelopment() {
- return (globalThis as any).process.env.NODE_ENV === "development"
+ return (globalThis as any).process.env.NODE_ENV === "development"
}
export function isProduction() {
- return (globalThis as any).process.env.NODE_ENV !== "development"
+ return (globalThis as any).process.env.NODE_ENV !== "development"
}
export function setDevelopment(shouldSet: boolean): void {
- ;(globalThis as any).process = (globalThis as any).process ?? {}
- const env = (globalThis as any).process.env ?? {}
- if (shouldSet) (globalThis as any).process.env = { ...env, NODE_ENV: "development" }
- else (globalThis as any).process.env = { ...env, NODE_ENV: "production" }
+ ;(globalThis as any).process = (globalThis as any).process ?? {}
+ const env = (globalThis as any).process.env ?? {}
+ if (shouldSet) (globalThis as any).process.env = {...env, NODE_ENV: "development"}
+ else (globalThis as any).process.env = {...env, NODE_ENV: "production"}
}
// disable logging
if (isProduction()) {
- const methods = ["log", "debug", "warn", "info"]
- for (let i = 0; i < methods.length; i++) {
- // @ts-ignore
- console[methods[i]] = function () {}
- }
+ const methods = ["log", "debug", "warn", "info"]
+ for (let i = 0; i < methods.length; i++) {
+ // @ts-ignore
+ console[methods[i]] = function () {}
+ }
}
diff --git a/applications/web/svelte.config.js b/applications/web/svelte.config.js
index 70f7bdf0..a1ac0145 100644
--- a/applications/web/svelte.config.js
+++ b/applications/web/svelte.config.js
@@ -1,4 +1,4 @@
export default {
- // Consult https://svelte.dev/docs#compile-time-svelte-preprocess
- // for more information about preprocessors
+ // Consult https://svelte.dev/docs#compile-time-svelte-preprocess
+ // for more information about preprocessors
}
diff --git a/applications/web/tailwind.config.cjs b/applications/web/tailwind.config.cjs
index a675ffc3..a132702c 100644
--- a/applications/web/tailwind.config.cjs
+++ b/applications/web/tailwind.config.cjs
@@ -1,19 +1,19 @@
/** @type {import('tailwindcss').Config}*/
const config = {
- content: ["./src/**/*.{html,js,svelte,ts}"],
+ content: ["./src/**/*.{html,js,svelte,ts}"],
- theme: {
- extend: {
- gridTemplateColumns: {
- editor: "250px 1fr"
- },
- gridTemplateRows: {
- editor: "45px 45px 1fr 45px"
- }
- }
- },
+ theme: {
+ extend: {
+ gridTemplateColumns: {
+ editor: "250px 1fr",
+ },
+ gridTemplateRows: {
+ editor: "45px 45px 1fr 45px",
+ },
+ },
+ },
- plugins: []
+ plugins: [],
}
module.exports = config
diff --git a/applications/web/tests/e2e/test.ts b/applications/web/tests/e2e/test.ts
index 9195d663..10607458 100644
--- a/applications/web/tests/e2e/test.ts
+++ b/applications/web/tests/e2e/test.ts
@@ -1,17 +1,17 @@
-import { expect, test } from "@playwright/test"
+import {expect, test} from "@playwright/test"
-test("index page has expected title", async ({ page }) => {
- await page.goto("")
- // await expect(page.getByRole('heading', { name: 'Welcome to SvelteKit' })).toBeVisible()
- await expect(page).toHaveTitle("CADmium")
+test("index page has expected title", async ({page}) => {
+ await page.goto("")
+ // await expect(page.getByRole('heading', { name: 'Welcome to SvelteKit' })).toBeVisible()
+ await expect(page).toHaveTitle("CADmium")
})
-test("has history pane", async ({ page }) => {
- await page.goto("")
- await expect(page.getByText("History")).toBeVisible()
+test("has history pane", async ({page}) => {
+ await page.goto("")
+ await expect(page.getByText("History")).toBeVisible()
})
-test("has origin in history panel", async ({ page }) => {
- await page.goto("")
- await expect(page.getByText("origin")).toBeVisible()
+test("has origin in history panel", async ({page}) => {
+ await page.goto("")
+ await expect(page.getByText("origin")).toBeVisible()
})
diff --git a/applications/web/tsconfig.json b/applications/web/tsconfig.json
index a118a9ae..a6bb9030 100644
--- a/applications/web/tsconfig.json
+++ b/applications/web/tsconfig.json
@@ -1,8 +1,4 @@
{
- "extends": [
- // "@repo/config-typescript/base.json",
- "@tsconfig/svelte/tsconfig.json"
- ],
- "include": ["src"],
- "exclude": ["node_modules"]
+ "extends": ["@repo/config-typescript/vite.json", "@tsconfig/svelte/tsconfig.json"],
+ "include": ["src", "vite.config.ts"]
}
diff --git a/applications/web/vite.config.js b/applications/web/vite.config.js
deleted file mode 100644
index cf156faf..00000000
--- a/applications/web/vite.config.js
+++ /dev/null
@@ -1,27 +0,0 @@
-import { defineConfig } from "vitest/config"
-import { svelte } from "@sveltejs/vite-plugin-svelte"
-import wasm from "vite-plugin-wasm"
-import topLevelAwait from "vite-plugin-top-level-await"
-import { base } from "./src/base"
-
-export default defineConfig({
- base,
- plugins: [svelte(), wasm(), topLevelAwait()],
- build: {
- outDir: "dist",
- target: "esnext"
- },
- test: {
- include: ["src/**/*.{test,spec}.{js,ts}", "../../packages/shared/**/*.{test,spec}.{js,ts}"],
- watch: false
- },
- server: {
- strictPort: true,
- port: 5173,
- fs: {
- // Allow serving files from one level up to the project root
- // Alows vite dev server to access packages
- allow: ["../.."]
- }
- }
-})
diff --git a/applications/web/vite.config.ts b/applications/web/vite.config.ts
new file mode 100644
index 00000000..e7c4f11c
--- /dev/null
+++ b/applications/web/vite.config.ts
@@ -0,0 +1,27 @@
+import {defineConfig} from "vitest/config"
+import {svelte} from "@sveltejs/vite-plugin-svelte"
+import wasm from "vite-plugin-wasm"
+import topLevelAwait from "vite-plugin-top-level-await"
+import {base} from "./src/base"
+
+export default defineConfig({
+ base,
+ plugins: [svelte(), wasm(), topLevelAwait()],
+ build: {
+ outDir: "dist",
+ target: "esnext",
+ },
+ test: {
+ include: ["src/**/*.{test,spec}.{js,ts}", "../../packages/shared/**/*.{test,spec}.{js,ts}"],
+ watch: false,
+ },
+ server: {
+ strictPort: true,
+ port: 5173,
+ fs: {
+ // Allow serving files from one level up to the project root
+ // Alows vite dev server to access packages
+ allow: ["../.."],
+ },
+ },
+})
diff --git a/package.json b/package.json
index d71ee5ff..8c0651cd 100644
--- a/package.json
+++ b/package.json
@@ -7,7 +7,7 @@
"test": "turbo run test --no-daemon",
"clean": "turbo run clean --no-daemon",
"lint": "turbo run lint --no-daemon",
- "format": "turbo run format --no-daemon"
+ "format": "prettier --write \"**/*.{js,cjs,mjs,ts,tsx,json,svelte,md}\""
},
"devDependencies": {
"@playwright/test": "^1.42.1",
diff --git a/packages/cadmium/README.md b/packages/cadmium/README.md
index 32fb37c3..0a9bad99 100644
--- a/packages/cadmium/README.md
+++ b/packages/cadmium/README.md
@@ -2,4 +2,4 @@
```bash
npm run wasm
-```
\ No newline at end of file
+```
diff --git a/packages/config-prettier/index.js b/packages/config-prettier/index.js
index 351c6024..6a56b823 100644
--- a/packages/config-prettier/index.js
+++ b/packages/config-prettier/index.js
@@ -1,12 +1,12 @@
module.exports = {
+ semi: false,
singleQuote: false,
+ useTabs: false,
+ tabWidth: 2,
trailingComma: "all",
bracketSpacing: false,
arrowParens: "avoid",
- useTabs: false,
- tabWidth: 2,
printWidth: 160,
- semi: false,
plugins: ["prettier-plugin-svelte"],
overrides: [
{
diff --git a/packages/shared/.eslintrc.cjs b/packages/shared/.eslintrc.cjs
new file mode 100644
index 00000000..fc5ed8ef
--- /dev/null
+++ b/packages/shared/.eslintrc.cjs
@@ -0,0 +1,5 @@
+/** @type {import("eslint").Linter.Config} */
+module.exports = {
+ root: true,
+ extends: ["@repo/eslint-config/index.js"],
+}
diff --git a/packages/shared/.prettierrc.json b/packages/shared/.prettierrc.json
new file mode 100644
index 00000000..a0da4b42
--- /dev/null
+++ b/packages/shared/.prettierrc.json
@@ -0,0 +1 @@
+"@repo/config-prettier"
diff --git a/packages/shared/projectUtils.ts b/packages/shared/projectUtils.ts
index c1b4ecb3..bf0ab47d 100644
--- a/packages/shared/projectUtils.ts
+++ b/packages/shared/projectUtils.ts
@@ -1,46 +1,46 @@
import {
- workbenchIsStale,
- workbenchIndex,
- workbench,
- project,
- featureIndex,
- wasmProject,
- projectIsStale,
- realizationIsStale,
- wasmRealization,
- realization,
- messageHistory
+ workbenchIsStale,
+ workbenchIndex,
+ workbench,
+ project,
+ featureIndex,
+ wasmProject,
+ projectIsStale,
+ realizationIsStale,
+ wasmRealization,
+ realization,
+ messageHistory,
} from "./stores"
-import { get } from "svelte/store"
-import { Vector2, Vector3, type Vector2Like } from "three"
+import {get} from "svelte/store"
+import {Vector2, Vector3, type Vector2Like} from "three"
import type {
- Entity,
- ExtrusionHistoryStep,
- HistoryStep,
- MessageHistory,
- PlaneHistoryStep,
- PointHistoryStep,
- Point2D,
- SketchHistoryStep,
- WithTarget,
- WorkBench
+ Entity,
+ ExtrusionHistoryStep,
+ HistoryStep,
+ MessageHistory,
+ PlaneHistoryStep,
+ PointHistoryStep,
+ Point2D,
+ SketchHistoryStep,
+ WithTarget,
+ WorkBench,
} from "./types"
-import type { Realization as WasmRealization, Message } from "cadmium"
+import type {Realization as WasmRealization, Message} from "cadmium"
import {
- isDeleteArcs,
- isDeleteCircles,
- isDeleteLines,
- isNewCircleBetweenPoints,
- isNewExtrusion,
- isNewLineOnSketch,
- isNewPointOnSketch2,
- isNewRectangleBetweenPoints,
- isNewSketchOnPlane,
- isRenameProject,
- isRenameStep,
- isRenameWorkbench,
- isSetSketchPlane,
- isUpdateExtrusion
+ isDeleteArcs,
+ isDeleteCircles,
+ isDeleteLines,
+ isNewCircleBetweenPoints,
+ isNewExtrusion,
+ isNewLineOnSketch,
+ isNewPointOnSketch2,
+ isNewRectangleBetweenPoints,
+ isNewSketchOnPlane,
+ isRenameProject,
+ isRenameStep,
+ isRenameWorkbench,
+ isSetSketchPlane,
+ isUpdateExtrusion,
} from "./typeGuards"
// import { isDevelopment } from "../+layout"
@@ -50,590 +50,577 @@ const log = (function () { const context = "[projectUtils.ts]"; const color = "a
export const CIRCLE_TOLERANCE = 0.05
export function isPoint(feature: HistoryStep): feature is PointHistoryStep {
- return feature.data.type === "Point"
+ return feature.data.type === "Point"
}
export function isPlane(feature: HistoryStep): feature is PlaneHistoryStep {
- return feature.data.type === "Plane"
+ return feature.data.type === "Plane"
}
export function isExtrusion(feature: HistoryStep): feature is ExtrusionHistoryStep {
- return feature.data.type === "Extrusion"
+ return feature.data.type === "Extrusion"
}
export function isSketch(feature: HistoryStep): feature is SketchHistoryStep {
- return feature.data.type === "Sketch"
+ return feature.data.type === "Sketch"
}
export function arraysEqual(a: any[], b: any[]) {
- if (a.length !== b.length) return false
- for (let i = 0; i < a.length; i++) {
- if (a[i] !== b[i]) return false
- }
- return true
+ if (a.length !== b.length) return false
+ for (let i = 0; i < a.length; i++) {
+ if (a[i] !== b[i]) return false
+ }
+ return true
}
function sendWasmMessage(message: Message) {
- let wp = get(wasmProject)
- log("[sendWasmMessage] sending message:", message)
- let result = wp.send_message(message)
- log("[sendWasmMessage] reply:", result)
-
- messageHistory.update((history: MessageHistory[]) => {
- log("[sendWasmMessage] [messageHistory.update] update:", { message, result })
- return [...history, { message, result }]
- })
- return result
+ let wp = get(wasmProject)
+ log("[sendWasmMessage] sending message:", message)
+ let result = wp.send_message(message)
+ log("[sendWasmMessage] reply:", result)
+
+ messageHistory.update((history: MessageHistory[]) => {
+ log("[sendWasmMessage] [messageHistory.update] update:", {message, result})
+ return [...history, {message, result}]
+ })
+ return result
}
export function updateExtrusion(extrusionId: string, sketchId: string, length: number, faceIds: string[]) {
- const message: Message = {
- UpdateExtrusion: {
- workbench_id: get(workbenchIndex),
- sketch_id: sketchId,
- face_ids: faceIds.map((id) => +id), // on browser side ids are strings - coerce face ids to numbers here to suit rust
- length,
- offset: 0.0,
- extrusion_name: "Extra",
- direction: "Normal",
- extrusion_id: extrusionId
- }
- }
- const isValid = checkWasmMessage(message)
- const hasFaceIds = notEmpty(message.UpdateExtrusion.face_ids)
- if (isValid) {
- sendWasmMessage(message)
- workbenchIsStale.set(true)
- if (hasFaceIds) {
- log("[updateExtrusion]", "[checkWasmMessage]", "is valid,", "sending message...", message)
- // sendWasmMessage(message)
- } else
- log(
- "[updateExtrusion]",
- "[checkWasmMessage]",
- "is valid,",
- "but face_ids is empty,",
- "NOT sending message:",
- message
- )
- } else log("[updateExtrusion]", "[checkWasmMessage]", "is bogus,", "abort message send!", message)
-
- // sendWasmMessage(message)
-
- // should this be set stale when not sending the wasm message? todo
- // workbenchIsStale.set(true)
+ const message: Message = {
+ UpdateExtrusion: {
+ workbench_id: get(workbenchIndex),
+ sketch_id: sketchId,
+ face_ids: faceIds.map(id => +id), // on browser side ids are strings - coerce face ids to numbers here to suit rust
+ length,
+ offset: 0.0,
+ extrusion_name: "Extra",
+ direction: "Normal",
+ extrusion_id: extrusionId,
+ },
+ }
+ const isValid = checkWasmMessage(message)
+ const hasFaceIds = notEmpty(message.UpdateExtrusion.face_ids)
+ if (isValid) {
+ sendWasmMessage(message)
+ workbenchIsStale.set(true)
+ if (hasFaceIds) {
+ log("[updateExtrusion]", "[checkWasmMessage]", "is valid,", "sending message...", message)
+ // sendWasmMessage(message)
+ } else log("[updateExtrusion]", "[checkWasmMessage]", "is valid,", "but face_ids is empty,", "NOT sending message:", message)
+ } else log("[updateExtrusion]", "[checkWasmMessage]", "is bogus,", "abort message send!", message)
+
+ // sendWasmMessage(message)
+
+ // should this be set stale when not sending the wasm message? todo
+ // workbenchIsStale.set(true)
}
export function setSketchPlane(sketchId: string, planeId: string) {
- const message: Message = {
- SetSketchPlane: {
- workbench_id: get(workbenchIndex),
- sketch_id: sketchId,
- plane_id: planeId
- }
- }
- checkWasmMessage(message)
- sendWasmMessage(message)
- workbenchIsStale.set(true)
+ const message: Message = {
+ SetSketchPlane: {
+ workbench_id: get(workbenchIndex),
+ sketch_id: sketchId,
+ plane_id: planeId,
+ },
+ }
+ checkWasmMessage(message)
+ sendWasmMessage(message)
+ workbenchIsStale.set(true)
}
export function newSketchOnPlane() {
- const message: Message = {
- NewSketchOnPlane: {
- workbench_id: get(workbenchIndex),
- plane_id: "", // leave it floating at first
- sketch_name: "" // a sensible name will be generated by the rust code
- }
- }
- checkWasmMessage(message)
- sendWasmMessage(message)
- workbenchIsStale.set(true)
+ const message: Message = {
+ NewSketchOnPlane: {
+ workbench_id: get(workbenchIndex),
+ plane_id: "", // leave it floating at first
+ sketch_name: "", // a sensible name will be generated by the rust code
+ },
+ }
+ checkWasmMessage(message)
+ sendWasmMessage(message)
+ workbenchIsStale.set(true)
}
export function newExtrusion() {
- const bench: WorkBench = get(workbench)
- // log("[newExtrusion] workbench:", workbench)
- // log("[newExtrusion] bench:", bench)
-
- let sketchId = null
- for (let step of bench.history) {
- if (step.data.type === "Sketch") {
- sketchId = step.unique_id
- }
- }
- if (sketchId === null) {
- log("No sketch found in history")
- return
- }
-
- const message: Message = {
- NewExtrusion: {
- workbench_id: get(workbenchIndex),
- sketch_id: sketchId,
- face_ids: [],
- length: 25,
- offset: 0.0,
- extrusion_name: "",
- direction: "Normal"
- }
- }
-
- // we check for face_ids: [] to contain numbers but we send an empty array
- // todo: maybe change isNewExtrusion? although with the rust api it is possible to send an array of faceids so we ought to check them...
- // probably best to alter isNewExtrusion to allow an empty array or a number[]
- checkWasmMessage(message)
- sendWasmMessage(message)
- workbenchIsStale.set(true)
+ const bench: WorkBench = get(workbench)
+ // log("[newExtrusion] workbench:", workbench)
+ // log("[newExtrusion] bench:", bench)
+
+ let sketchId = null
+ for (let step of bench.history) {
+ if (step.data.type === "Sketch") {
+ sketchId = step.unique_id
+ }
+ }
+ if (sketchId === null) {
+ log("No sketch found in history")
+ return
+ }
+
+ const message: Message = {
+ NewExtrusion: {
+ workbench_id: get(workbenchIndex),
+ sketch_id: sketchId,
+ face_ids: [],
+ length: 25,
+ offset: 0.0,
+ extrusion_name: "",
+ direction: "Normal",
+ },
+ }
+
+ // we check for face_ids: [] to contain numbers but we send an empty array
+ // todo: maybe change isNewExtrusion? although with the rust api it is possible to send an array of faceids so we ought to check them...
+ // probably best to alter isNewExtrusion to allow an empty array or a number[]
+ checkWasmMessage(message)
+ sendWasmMessage(message)
+ workbenchIsStale.set(true)
}
export function deleteEntities(sketchIdx: string, selection: Entity[]) {
- const workbenchIdx = get(workbenchIndex)
-
- // log("[deleteEntities]", "sketchIdx:", sketchIdx, "selection:", selection, "workbenchIdx:", workbenchIdx, "sketchIdx:", sketchIdx, "selection:", selection)
- const lines = selection.filter((e) => e.type === "line")
- const arcs = selection.filter((e) => e.type === "arc")
- const circles = selection.filter((e) => e.type === "circle")
- // const points = selection.filter((e) => e.type === 'point')
-
- const lineIds = reduceToInts(
- lines.map((e) => e.id),
- (id: any) => console.error(`[deleteEntities] line id is not an int: ${id}`)
- )
- const arcIds = reduceToInts(
- arcs.map((e) => e.id),
- (id: any) => console.error(`[deleteEntities] arc id is not an int: ${id}`)
- )
- const circleIds = reduceToInts(
- circles.map((e) => e.id),
- (id: any) => console.error(`[deleteEntities] circle id is not an int: ${id}`)
- )
-
- if (notEmpty(lineIds)) deleteLines(workbenchIdx, sketchIdx, lineIds)
- if (notEmpty(arcIds)) deleteArcs(workbenchIdx, sketchIdx, arcIds)
- if (notEmpty(circleIds)) deleteCircles(workbenchIdx, sketchIdx, circleIds)
-
- // only refresh the workbench once, after all deletions are done
- workbenchIsStale.set(true)
+ const workbenchIdx = get(workbenchIndex)
+
+ // log("[deleteEntities]", "sketchIdx:", sketchIdx, "selection:", selection, "workbenchIdx:", workbenchIdx, "sketchIdx:", sketchIdx, "selection:", selection)
+ const lines = selection.filter(e => e.type === "line")
+ const arcs = selection.filter(e => e.type === "arc")
+ const circles = selection.filter(e => e.type === "circle")
+ // const points = selection.filter((e) => e.type === 'point')
+
+ const lineIds = reduceToInts(
+ lines.map(e => e.id),
+ (id: any) => console.error(`[deleteEntities] line id is not an int: ${id}`),
+ )
+ const arcIds = reduceToInts(
+ arcs.map(e => e.id),
+ (id: any) => console.error(`[deleteEntities] arc id is not an int: ${id}`),
+ )
+ const circleIds = reduceToInts(
+ circles.map(e => e.id),
+ (id: any) => console.error(`[deleteEntities] circle id is not an int: ${id}`),
+ )
+
+ if (notEmpty(lineIds)) deleteLines(workbenchIdx, sketchIdx, lineIds)
+ if (notEmpty(arcIds)) deleteArcs(workbenchIdx, sketchIdx, arcIds)
+ if (notEmpty(circleIds)) deleteCircles(workbenchIdx, sketchIdx, circleIds)
+
+ // only refresh the workbench once, after all deletions are done
+ workbenchIsStale.set(true)
}
function deleteLines(workbenchIdx: number, sketchIdx: string, lineIds: number[]) {
- const message: Message = {
- DeleteLines: {
- workbench_id: workbenchIdx,
- sketch_id: sketchIdx,
- line_ids: lineIds
- }
- }
- checkWasmMessage(message)
- sendWasmMessage(message)
+ const message: Message = {
+ DeleteLines: {
+ workbench_id: workbenchIdx,
+ sketch_id: sketchIdx,
+ line_ids: lineIds,
+ },
+ }
+ checkWasmMessage(message)
+ sendWasmMessage(message)
}
function deleteArcs(workbenchIdx: number, sketchIdx: string, arcIds: number[]) {
- const message: Message = {
- DeleteArcs: {
- workbench_id: workbenchIdx,
- sketch_id: sketchIdx,
- arc_ids: arcIds
- }
- }
- checkWasmMessage(message)
- sendWasmMessage(message)
+ const message: Message = {
+ DeleteArcs: {
+ workbench_id: workbenchIdx,
+ sketch_id: sketchIdx,
+ arc_ids: arcIds,
+ },
+ }
+ checkWasmMessage(message)
+ sendWasmMessage(message)
}
function deleteCircles(workbenchIdx: number, sketchIdx: string, circleIds: number[]) {
- const message: Message = {
- DeleteCircles: {
- workbench_id: workbenchIdx,
- sketch_id: sketchIdx,
- circle_ids: circleIds
- }
- }
- checkWasmMessage(message)
- sendWasmMessage(message)
+ const message: Message = {
+ DeleteCircles: {
+ workbench_id: workbenchIdx,
+ sketch_id: sketchIdx,
+ circle_ids: circleIds,
+ },
+ }
+ checkWasmMessage(message)
+ sendWasmMessage(message)
}
export function addRectangleBetweenPoints(sketchIdx: string, point1: number, point2: number) {
- log("[addRectangleBetweenPoints] sketchIdx, point1, point2", sketchIdx, point1, point2)
- const message: Message = {
- NewRectangleBetweenPoints: {
- workbench_id: get(workbenchIndex),
- sketch_id: sketchIdx,
- start_id: point1,
- end_id: point2
- }
- }
- checkWasmMessage(message)
- sendWasmMessage(message)
- workbenchIsStale.set(true)
+ log("[addRectangleBetweenPoints] sketchIdx, point1, point2", sketchIdx, point1, point2)
+ const message: Message = {
+ NewRectangleBetweenPoints: {
+ workbench_id: get(workbenchIndex),
+ sketch_id: sketchIdx,
+ start_id: point1,
+ end_id: point2,
+ },
+ }
+ checkWasmMessage(message)
+ sendWasmMessage(message)
+ workbenchIsStale.set(true)
}
export function addCircleBetweenPoints(sketchIdx: string, point1: string, point2: string) {
- log("[addCircleBetweenPoints]", "sketchIdx:", sketchIdx, "point1:", point1, "point2", point2)
-
- const p1Valid = isStringInt(point1, (id) =>
- console.error("[projectUtils.ts] [addCircleBetweenPoints]", "id is not an int:", id)
- )
- const p2Valid = isStringInt(point2, (id) =>
- console.error("[projectUtils.ts] [addCircleBetweenPoints]", "id is not an int:", id)
- )
-
- if (!p1Valid || !p2Valid) return
-
- const message: Message = {
- NewCircleBetweenPoints: {
- workbench_id: get(workbenchIndex),
- sketch_id: sketchIdx,
- center_id: parseInt(point1, 10),
- edge_id: parseInt(point2, 10)
- }
- }
- checkWasmMessage(message)
- sendWasmMessage(message)
- workbenchIsStale.set(true)
+ log("[addCircleBetweenPoints]", "sketchIdx:", sketchIdx, "point1:", point1, "point2", point2)
+
+ const p1Valid = isStringInt(point1, id => console.error("[projectUtils.ts] [addCircleBetweenPoints]", "id is not an int:", id))
+ const p2Valid = isStringInt(point2, id => console.error("[projectUtils.ts] [addCircleBetweenPoints]", "id is not an int:", id))
+
+ if (!p1Valid || !p2Valid) return
+
+ const message: Message = {
+ NewCircleBetweenPoints: {
+ workbench_id: get(workbenchIndex),
+ sketch_id: sketchIdx,
+ center_id: parseInt(point1, 10),
+ edge_id: parseInt(point2, 10),
+ },
+ }
+ checkWasmMessage(message)
+ sendWasmMessage(message)
+ workbenchIsStale.set(true)
}
export function addLineToSketch(sketchIdx: string, point1: number, point2: number) {
- const message: Message = {
- NewLineOnSketch: {
- workbench_id: get(workbenchIndex),
- sketch_id: sketchIdx,
- start_point_id: point1,
- end_point_id: point2
- }
- }
- checkWasmMessage(message)
- sendWasmMessage(message)
- workbenchIsStale.set(true)
+ const message: Message = {
+ NewLineOnSketch: {
+ workbench_id: get(workbenchIndex),
+ sketch_id: sketchIdx,
+ start_point_id: point1,
+ end_point_id: point2,
+ },
+ }
+ checkWasmMessage(message)
+ sendWasmMessage(message)
+ workbenchIsStale.set(true)
}
export function addPointToSketch(sketchIdx: string, point: Vector2Like, hidden: boolean) {
- log("[addPointToSketch] sketchIdx, point, hidden", sketchIdx, point, hidden)
- const message: Message = {
- NewPointOnSketch2: {
- workbench_id: get(workbenchIndex),
- sketch_id: sketchIdx,
- x: point.x,
- y: point.y,
- hidden: hidden
- }
- }
- checkWasmMessage(message)
- const reply = sendWasmMessage(message)
- // log("[addPointToSketch sendWasmMessage]", "message:", message, "reply:", reply)
-
- if (!reply.success)
- console.error("ERROR [projectUtils.ts addPointToSketch sendWasmMessage]", "message:", message, "reply:", reply)
-
- workbenchIsStale.set(true)
- return JSON.parse(reply.success).id
+ log("[addPointToSketch] sketchIdx, point, hidden", sketchIdx, point, hidden)
+ const message: Message = {
+ NewPointOnSketch2: {
+ workbench_id: get(workbenchIndex),
+ sketch_id: sketchIdx,
+ x: point.x,
+ y: point.y,
+ hidden: hidden,
+ },
+ }
+ checkWasmMessage(message)
+ const reply = sendWasmMessage(message)
+ // log("[addPointToSketch sendWasmMessage]", "message:", message, "reply:", reply)
+
+ if (!reply.success) console.error("ERROR [projectUtils.ts addPointToSketch sendWasmMessage]", "message:", message, "reply:", reply)
+
+ workbenchIsStale.set(true)
+ return JSON.parse(reply.success).id
}
export function renameStep(stepIdx: number, newName: string): void {
- log("[renameStep] stepIdx, newName", stepIdx, newName)
- const message: Message = {
- RenameStep: {
- workbench_id: get(workbenchIndex),
- step_id: stepIdx,
- new_name: newName
- }
- }
- checkWasmMessage(message)
- sendWasmMessage(message)
+ log("[renameStep] stepIdx, newName", stepIdx, newName)
+ const message: Message = {
+ RenameStep: {
+ workbench_id: get(workbenchIndex),
+ step_id: stepIdx,
+ new_name: newName,
+ },
+ }
+ checkWasmMessage(message)
+ sendWasmMessage(message)
}
export function renameWorkbench(newName: string): void {
- log("[renameWorkbench] newName", newName)
- const message: Message = {
- RenameWorkbench: {
- workbench_id: get(workbenchIndex),
- new_name: newName
- }
- }
- checkWasmMessage(message)
- sendWasmMessage(message)
+ log("[renameWorkbench] newName", newName)
+ const message: Message = {
+ RenameWorkbench: {
+ workbench_id: get(workbenchIndex),
+ new_name: newName,
+ },
+ }
+ checkWasmMessage(message)
+ sendWasmMessage(message)
}
export function renameProject(newName: string): void {
- log("[renameProject] newName", newName)
- const message: Message = {
- RenameProject: {
- new_name: newName
- }
- }
- checkWasmMessage(message)
- sendWasmMessage(message)
+ log("[renameProject] newName", newName)
+ const message: Message = {
+ RenameProject: {
+ new_name: newName,
+ },
+ }
+ checkWasmMessage(message)
+ sendWasmMessage(message)
}
// If the project ever becomes stale, refresh it. This should be pretty rare.
-projectIsStale.subscribe((value) => {
- if (value) {
- const wp = get(wasmProject)
- project.set(JSON.parse(wp.to_json()))
-
- workbenchIndex.set(0)
- workbenchIsStale.set(true)
- projectIsStale.set(false)
- // @ts-ignore
- log("[projectIsStale] Refreshing project", "value:", value, "wasmProject:", wp, "project:", project)
- }
+projectIsStale.subscribe(value => {
+ if (value) {
+ const wp = get(wasmProject)
+ project.set(JSON.parse(wp.to_json()))
+
+ workbenchIndex.set(0)
+ workbenchIsStale.set(true)
+ projectIsStale.set(false)
+ // @ts-ignore
+ log("[projectIsStale] Refreshing project", "value:", value, "wasmProject:", wp, "project:", project)
+ }
})
// If the workbench ever becomes stale, refresh it. This should be very common.
// Every time you edit any part of the feature history, for example
-workbenchIsStale.subscribe((value) => {
- if (value) {
- log("[workbenchIsStale] Workbench:", get(workbench))
- const workbenchIdx = get(workbenchIndex)
- const wasmProj = get(wasmProject)
- const workbenchJson = wasmProj.get_workbench(workbenchIdx)
- // TODO: reach inside of project and set its representation
- // of the workbench to the new one that we just got
- workbench.set(JSON.parse(workbenchJson))
- workbenchIsStale.set(false)
- // log("Workbench:", get(workbench))
- realizationIsStale.set(true)
- }
+workbenchIsStale.subscribe(value => {
+ if (value) {
+ log("[workbenchIsStale] Workbench:", get(workbench))
+ const workbenchIdx = get(workbenchIndex)
+ const wasmProj = get(wasmProject)
+ const workbenchJson = wasmProj.get_workbench(workbenchIdx)
+ // TODO: reach inside of project and set its representation
+ // of the workbench to the new one that we just got
+ workbench.set(JSON.parse(workbenchJson))
+ workbenchIsStale.set(false)
+ // log("Workbench:", get(workbench))
+ realizationIsStale.set(true)
+ }
})
// If the realization ever becomes stale, refresh it. This should be very common.
// Every time you edit any part of the feature history, for example
-realizationIsStale.subscribe((value) => {
- if (value) {
- // log("[realizationIsStale] Refreshing realization")
-
- const wasmProj = get(wasmProject)
- const workbenchIdx = get(workbenchIndex)
- const wasmReal: WasmRealization = wasmProj.get_realization(workbenchIdx, get(featureIndex) + 1)
- wasmRealization.set(wasmReal)
- realization.set(JSON.parse(wasmReal.to_json()))
- // log("[realizationIsStale] New realization:", get(realization))
- // log("[wasmProj]", wasmProj)
-
- realizationIsStale.set(false)
- }
+realizationIsStale.subscribe(value => {
+ if (value) {
+ // log("[realizationIsStale] Refreshing realization")
+
+ const wasmProj = get(wasmProject)
+ const workbenchIdx = get(workbenchIndex)
+ const wasmReal: WasmRealization = wasmProj.get_realization(workbenchIdx, get(featureIndex) + 1)
+ wasmRealization.set(wasmReal)
+ realization.set(JSON.parse(wasmReal.to_json()))
+ // log("[realizationIsStale] New realization:", get(realization))
+ // log("[wasmProj]", wasmProj)
+
+ realizationIsStale.set(false)
+ }
})
export function getObjectString(solidId: string): string {
- // log("[getObjectString] solidId:", solidId)
- const wasmReal = get(wasmRealization)
- const objString = wasmReal.solid_to_obj(solidId, 0.1)
- return objString
+ // log("[getObjectString] solidId:", solidId)
+ const wasmReal = get(wasmRealization)
+ const objString = wasmReal.solid_to_obj(solidId, 0.1)
+ return objString
}
export function readFile(e: WithTarget): void {
- const target = e.target as HTMLInputElement
- const file = target.files![0]
- const reader = new FileReader()
- reader.onload = function (e) {
- // log("[readFile] file contents", e.target?.result)
- }
- reader.readAsText(file)
+ const target = e.target as HTMLInputElement
+ const file = target.files![0]
+ const reader = new FileReader()
+ reader.onload = function (e) {
+ // log("[readFile] file contents", e.target?.result)
+ }
+ reader.readAsText(file)
}
export function arcToPoints(center: Vector2, start: Vector2, end: Vector2, clockwise: boolean = false): Vector2[] {
- // log("[arcToPoints] center, start, end, clockwise", center, start, end, clockwise)
- // see https://math.stackexchange.com/a/4132095/816177
- const tolerance = CIRCLE_TOLERANCE // in meters
- const radius = start.distanceTo(center)
- const k = tolerance / radius
- // more precise but slower to calculate:
- // const n = Math.ceil(Math.PI / Math.acos(1 - k))
- // faster to calculate, at most only overestimates by 1:
- let n = Math.ceil(Math.PI / Math.sqrt(2 * k))
- const segmentAngle = (2 * Math.PI) / n
- const segmentLength = radius * segmentAngle
- if (clockwise) n = -n
-
- const startAngle = Math.atan2(start.y - center.y, start.x - center.x)
-
- const lineVertices = []
- lineVertices.push(start.clone())
- for (let i = 1; i <= Math.abs(n); i++) {
- const theta = ((2 * Math.PI) / n) * i + startAngle
- const xComponent = radius * Math.cos(theta)
- const yComponent = radius * Math.sin(theta)
- const point = new Vector2(xComponent, yComponent).add(center)
- lineVertices.push(point)
-
- const distanceToEnd = point.distanceTo(end)
- if (distanceToEnd <= segmentLength) {
- lineVertices.push(end.clone())
- break
- }
- }
- return lineVertices
+ // log("[arcToPoints] center, start, end, clockwise", center, start, end, clockwise)
+ // see https://math.stackexchange.com/a/4132095/816177
+ const tolerance = CIRCLE_TOLERANCE // in meters
+ const radius = start.distanceTo(center)
+ const k = tolerance / radius
+ // more precise but slower to calculate:
+ // const n = Math.ceil(Math.PI / Math.acos(1 - k))
+ // faster to calculate, at most only overestimates by 1:
+ let n = Math.ceil(Math.PI / Math.sqrt(2 * k))
+ const segmentAngle = (2 * Math.PI) / n
+ const segmentLength = radius * segmentAngle
+ if (clockwise) n = -n
+
+ const startAngle = Math.atan2(start.y - center.y, start.x - center.x)
+
+ const lineVertices = []
+ lineVertices.push(start.clone())
+ for (let i = 1; i <= Math.abs(n); i++) {
+ const theta = ((2 * Math.PI) / n) * i + startAngle
+ const xComponent = radius * Math.cos(theta)
+ const yComponent = radius * Math.sin(theta)
+ const point = new Vector2(xComponent, yComponent).add(center)
+ lineVertices.push(point)
+
+ const distanceToEnd = point.distanceTo(end)
+ if (distanceToEnd <= segmentLength) {
+ lineVertices.push(end.clone())
+ break
+ }
+ }
+ return lineVertices
}
export function circleToPoints(centerPoint: Vector2Like, radius: number): Vector2[] {
- // this is 2D function
-
- // see https://math.stackexchange.com/a/4132095/816177
- const tolerance = CIRCLE_TOLERANCE // in meters
- const k = tolerance / radius
- // more precise but slower to calculate:
- // const n = Math.ceil(Math.PI / Math.acos(1 - k))
- // faster to calculate, at most only overestimates by 1:
- const n = Math.ceil(Math.PI / Math.sqrt(2 * k))
-
- const lineVertices = []
- for (let i = 0; i <= n; i++) {
- const theta = ((2 * Math.PI) / n) * i
- const xComponent = radius * Math.cos(theta)
- const yComponent = radius * Math.sin(theta)
- const point = new Vector2(xComponent, yComponent).add(centerPoint)
- lineVertices.push(point)
- }
- return lineVertices
+ // this is 2D function
+
+ // see https://math.stackexchange.com/a/4132095/816177
+ const tolerance = CIRCLE_TOLERANCE // in meters
+ const k = tolerance / radius
+ // more precise but slower to calculate:
+ // const n = Math.ceil(Math.PI / Math.acos(1 - k))
+ // faster to calculate, at most only overestimates by 1:
+ const n = Math.ceil(Math.PI / Math.sqrt(2 * k))
+
+ const lineVertices = []
+ for (let i = 0; i <= n; i++) {
+ const theta = ((2 * Math.PI) / n) * i
+ const xComponent = radius * Math.cos(theta)
+ const yComponent = radius * Math.sin(theta)
+ const point = new Vector2(xComponent, yComponent).add(centerPoint)
+ lineVertices.push(point)
+ }
+ return lineVertices
}
export function promoteTo3(points: Vector2[]): Vector3[] {
- const points3 = []
- for (const point of points) {
- points3.push(new Vector3(point.x, point.y, 0))
- }
- return points3
+ const points3 = []
+ for (const point of points) {
+ points3.push(new Vector3(point.x, point.y, 0))
+ }
+ return points3
}
export function flatten(points: Vector3[]): number[] {
- const pointsFlat = []
- for (const point of points) {
- pointsFlat.push(point.x, point.y, point.z)
- }
- return pointsFlat
+ const pointsFlat = []
+ for (const point of points) {
+ pointsFlat.push(point.x, point.y, point.z)
+ }
+ return pointsFlat
}
-function isStringInt(s: string, errorCallback: { (id: any): void; (arg0: string): void }): boolean {
- if (typeof s !== "string") console.error("[proectUtils.ts] [isStringInt]", s, "is not a string:", typeof s)
- const isInt = !Number.isNaN(parseInt(s, 10))
- if (!isInt) errorCallback(s)
- return isInt
+function isStringInt(s: string, errorCallback: {(id: any): void; (arg0: string): void}): boolean {
+ if (typeof s !== "string") console.error("[proectUtils.ts] [isStringInt]", s, "is not a string:", typeof s)
+ const isInt = !Number.isNaN(parseInt(s, 10))
+ if (!isInt) errorCallback(s)
+ return isInt
}
function reduceToInts(data: string[], errorCallback: (id: any) => void): number[] {
- function reducer(acc: number[], id: string): number[] {
- return isStringInt(id, errorCallback) ? [...acc, parseInt(id, 10)] : acc
- }
- return data.reduce(reducer, [])
+ function reducer(acc: number[], id: string): number[] {
+ return isStringInt(id, errorCallback) ? [...acc, parseInt(id, 10)] : acc
+ }
+ return data.reduce(reducer, [])
}
function notEmpty(array: unknown[]): boolean {
- return array && Array.isArray(array) && array.length > 0
+ return array && Array.isArray(array) && array.length > 0
}
function checkWasmMessage(message: Message, abort = true, logError = true): boolean {
- const key = Object.keys(message)[0]
- const command = message[key as keyof Message]
- if (!command) {
- console.error("[projectUtils.ts] [checkWasmMessage]", "messageType not found:", key, message)
- return false
- }
- log("[checkWasmMessage]", "checking...", key, message)
-
- switch (key) {
- case "UpdateExtrusion":
- if (!isUpdateExtrusion(command)) {
- logOrAbort()
- return false
- }
- return true
-
- case "SetSketchPlane":
- if (!isSetSketchPlane(command)) {
- logOrAbort()
- return false
- }
- return true
-
- case "NewSketchOnPlane":
- if (!isNewSketchOnPlane(command)) {
- logOrAbort()
- return false
- }
- return true
-
- case "NewExtrusion":
- if (!isNewExtrusion(command)) {
- logOrAbort()
- return false
- }
- return true
-
- case "DeleteLines":
- if (!isDeleteLines(command)) {
- logOrAbort()
- return false
- }
- return true
-
- case "DeleteArcs":
- if (!isDeleteArcs(command)) {
- logOrAbort()
- return false
- }
- return true
-
- case "DeleteCircles":
- if (!isDeleteCircles(command)) {
- logOrAbort()
- return false
- }
- return true
-
- case "NewRectangleBetweenPoints":
- if (!isNewRectangleBetweenPoints(command)) {
- logOrAbort()
- return false
- }
- return true
-
- case "NewCircleBetweenPoints":
- if (!isNewCircleBetweenPoints(command)) {
- logOrAbort()
- return false
- }
- return true
-
- case "NewLineOnSketch":
- if (!isNewLineOnSketch(command)) {
- logOrAbort()
- return false
- }
- return true
-
- case "NewPointOnSketch2":
- if (!isNewPointOnSketch2(command)) {
- logOrAbort()
- return false
- }
- return true
-
- case "RenameStep":
- if (!isRenameStep(command)) {
- logOrAbort()
- return false
- }
- return true
-
- case "RenameWorkbench":
- if (!isRenameWorkbench(command)) {
- logOrAbort()
- return false
- }
- return true
-
- case "RenameProject":
- if (!isRenameProject(command)) {
- logOrAbort()
- return false
- }
- return true
-
- default:
- console.error("[projectUtils.ts] [checkWasmMessage]", "messageType typeGuard not implemented:", key)
- return false
- }
-
- function logOrAbort() {
- const error = `[${key}] message failed typecheck:`
- if (logError) console.error("[projectUtils.ts]", error, message)
- // if (abort && isDevelopment()) throw new Error(`"[projectUtils.ts]" ${error}`)
- return false
- }
+ const key = Object.keys(message)[0]
+ const command = message[key as keyof Message]
+ if (!command) {
+ console.error("[projectUtils.ts] [checkWasmMessage]", "messageType not found:", key, message)
+ return false
+ }
+ log("[checkWasmMessage]", "checking...", key, message)
+
+ switch (key) {
+ case "UpdateExtrusion":
+ if (!isUpdateExtrusion(command)) {
+ logOrAbort()
+ return false
+ }
+ return true
+
+ case "SetSketchPlane":
+ if (!isSetSketchPlane(command)) {
+ logOrAbort()
+ return false
+ }
+ return true
+
+ case "NewSketchOnPlane":
+ if (!isNewSketchOnPlane(command)) {
+ logOrAbort()
+ return false
+ }
+ return true
+
+ case "NewExtrusion":
+ if (!isNewExtrusion(command)) {
+ logOrAbort()
+ return false
+ }
+ return true
+
+ case "DeleteLines":
+ if (!isDeleteLines(command)) {
+ logOrAbort()
+ return false
+ }
+ return true
+
+ case "DeleteArcs":
+ if (!isDeleteArcs(command)) {
+ logOrAbort()
+ return false
+ }
+ return true
+
+ case "DeleteCircles":
+ if (!isDeleteCircles(command)) {
+ logOrAbort()
+ return false
+ }
+ return true
+
+ case "NewRectangleBetweenPoints":
+ if (!isNewRectangleBetweenPoints(command)) {
+ logOrAbort()
+ return false
+ }
+ return true
+
+ case "NewCircleBetweenPoints":
+ if (!isNewCircleBetweenPoints(command)) {
+ logOrAbort()
+ return false
+ }
+ return true
+
+ case "NewLineOnSketch":
+ if (!isNewLineOnSketch(command)) {
+ logOrAbort()
+ return false
+ }
+ return true
+
+ case "NewPointOnSketch2":
+ if (!isNewPointOnSketch2(command)) {
+ logOrAbort()
+ return false
+ }
+ return true
+
+ case "RenameStep":
+ if (!isRenameStep(command)) {
+ logOrAbort()
+ return false
+ }
+ return true
+
+ case "RenameWorkbench":
+ if (!isRenameWorkbench(command)) {
+ logOrAbort()
+ return false
+ }
+ return true
+
+ case "RenameProject":
+ if (!isRenameProject(command)) {
+ logOrAbort()
+ return false
+ }
+ return true
+
+ default:
+ console.error("[projectUtils.ts] [checkWasmMessage]", "messageType typeGuard not implemented:", key)
+ return false
+ }
+
+ function logOrAbort() {
+ const error = `[${key}] message failed typecheck:`
+ if (logError) console.error("[projectUtils.ts]", error, message)
+ // if (abort && isDevelopment()) throw new Error(`"[projectUtils.ts]" ${error}`)
+ return false
+ }
}
diff --git a/packages/shared/stores.ts b/packages/shared/stores.ts
index 52f99906..086cfa0c 100644
--- a/packages/shared/stores.ts
+++ b/packages/shared/stores.ts
@@ -1,27 +1,7 @@
-import { Project as WasmProject, Realization as WasmRealization } from "cadmium"
-import { writable } from "svelte/store"
-import type {
- WorkBench,
- MessageHistory,
- Project,
- Realization,
- Entity,
- EntityType,
- SnapEntity,
- PointLikeById,
- PreviewGeometry
-} from "./types"
-import {
- isArcEntity,
- isCircleEntity,
- isEntity,
- isFaceEntity,
- isLineEntity,
- isMeshFaceEntity,
- isPlaneEntity,
- isPoint3DEntity,
- isPointEntity
-} from "./typeGuards"
+import {Project as WasmProject, Realization as WasmRealization} from "cadmium"
+import {writable} from "svelte/store"
+import type {WorkBench, MessageHistory, Project, Realization, Entity, EntityType, SnapEntity, PointLikeById, PreviewGeometry} from "./types"
+import {isArcEntity, isCircleEntity, isEntity, isFaceEntity, isLineEntity, isMeshFaceEntity, isPlaneEntity, isPoint3DEntity, isPointEntity} from "./typeGuards"
// import { isDevelopment } from "../+layout"
// prettier-ignore
@@ -59,85 +39,85 @@ export const previewGeometry = writable([])
export const messageHistory = writable([])
// if (isDevelopment()) {
- project.subscribe((store) => log("[project]", store))
- workbenchIndex.subscribe((store) => log("[workbenchIndex]", store))
- workbench.subscribe((store) => log("[workbench]", store))
- workbenchIsStale.subscribe((store) => log("[workbenchIsStale]", store))
- featureIndex.subscribe((store) => log("[featureIndex]", store))
- extrusionFeatures.subscribe((store) => log("[extrusionFeatures]", store))
- realization.subscribe((store) => log("[realization]", store))
- realizationIsStale.subscribe((store) => log("[realizationIsStale]", store))
- sketchBeingEdited.subscribe((store) => log("[sketchBeingEdited]", store))
- messageHistory.subscribe((store) => log("[messageHistory]", store))
+project.subscribe(store => log("[project]", store))
+workbenchIndex.subscribe(store => log("[workbenchIndex]", store))
+workbench.subscribe(store => log("[workbench]", store))
+workbenchIsStale.subscribe(store => log("[workbenchIsStale]", store))
+featureIndex.subscribe(store => log("[featureIndex]", store))
+extrusionFeatures.subscribe(store => log("[extrusionFeatures]", store))
+realization.subscribe(store => log("[realization]", store))
+realizationIsStale.subscribe(store => log("[realizationIsStale]", store))
+sketchBeingEdited.subscribe(store => log("[sketchBeingEdited]", store))
+messageHistory.subscribe(store => log("[messageHistory]", store))
- currentlySelected.subscribe((store) => {
- log("[currentlySelected]", store)
- const allValid = store.every((entity) => isEntity(entity))
- const error = "[stores.ts] [currentlySelected] has invalid entities"
- if (!allValid) {
- console.error(error, store)
- // throw new Error(error)
- }
+currentlySelected.subscribe(store => {
+ log("[currentlySelected]", store)
+ const allValid = store.every(entity => isEntity(entity))
+ const error = "[stores.ts] [currentlySelected] has invalid entities"
+ if (!allValid) {
+ console.error(error, store)
+ // throw new Error(error)
+ }
- const types = ["circle", "arc", "face", "line", "plane", "point", "point3D", "meshFace"] as EntityType[]
- types.forEach((type) => {
- const [isType, entity] = latestIsEntity(store, type)
- if (isType) log(`[currentlySelected] entity is ${type === "arc" ? "an" : "a"} ${type}:`, entity)
- })
- })
+ const types = ["circle", "arc", "face", "line", "plane", "point", "point3D", "meshFace"] as EntityType[]
+ types.forEach(type => {
+ const [isType, entity] = latestIsEntity(store, type)
+ if (isType) log(`[currentlySelected] entity is ${type === "arc" ? "an" : "a"} ${type}:`, entity)
+ })
+})
// }
function latestIsEntity(store: Entity[], type: EntityType) {
- if (store.length === 0) return [false, null]
- const entity = store[store.length - 1]
- switch (type) {
- case "circle":
- return [isCircleEntity(entity), entity]
- case "arc":
- return [isArcEntity(entity), entity]
- case "face":
- return [isFaceEntity(entity), entity]
- case "line":
- return [isLineEntity(entity), entity]
- case "plane":
- return [isPlaneEntity(entity), entity]
- case "point":
- return [isPointEntity(entity), entity]
- case "point3D":
- return [isPoint3DEntity(entity), entity]
- case "meshFace":
- return [isMeshFaceEntity(entity), entity]
- default:
- break
- }
- log("[latestIsEntity] has incorrect switch statement implemented")
- return [false, null]
+ if (store.length === 0) return [false, null]
+ const entity = store[store.length - 1]
+ switch (type) {
+ case "circle":
+ return [isCircleEntity(entity), entity]
+ case "arc":
+ return [isArcEntity(entity), entity]
+ case "face":
+ return [isFaceEntity(entity), entity]
+ case "line":
+ return [isLineEntity(entity), entity]
+ case "plane":
+ return [isPlaneEntity(entity), entity]
+ case "point":
+ return [isPointEntity(entity), entity]
+ case "point3D":
+ return [isPoint3DEntity(entity), entity]
+ case "meshFace":
+ return [isMeshFaceEntity(entity), entity]
+ default:
+ break
+ }
+ log("[latestIsEntity] has incorrect switch statement implemented")
+ return [false, null]
}
function emptyWorkBench(): WorkBench {
- return {
- name: "",
- history: [],
- step_counters: {
- Extrusion: 0,
- Plane: 0,
- Point: 0,
- Sketch: 0
- }
- }
+ return {
+ name: "",
+ history: [],
+ step_counters: {
+ Extrusion: 0,
+ Plane: 0,
+ Point: 0,
+ Sketch: 0,
+ },
+ }
}
function emptyProject(): Project {
- return {
- name: "",
- assemblies: [],
- workbenches: []
- }
+ return {
+ name: "",
+ assemblies: [],
+ workbenches: [],
+ }
}
function emptyRealization(): Realization {
- return {
- planes: {},
- points: {},
- sketches: {},
- solids: {}
- }
+ return {
+ planes: {},
+ points: {},
+ sketches: {},
+ solids: {},
+ }
}
diff --git a/packages/shared/typeGuards.ts b/packages/shared/typeGuards.ts
index 168d4a1d..4dbba072 100644
--- a/packages/shared/typeGuards.ts
+++ b/packages/shared/typeGuards.ts
@@ -1,1170 +1,1068 @@
import type {
- IDictionary,
- WithTarget,
- SetCameraFocus,
- EntityType,
- Entity,
- CircleEntity,
- ArcEntity,
- FaceEntity,
- LineEntity,
- PlaneEntity,
- PointEntity,
- Point3DEntity,
- MeshFaceEntity,
- Project,
- WorkBench,
- PreviewGeometry,
- Plane,
- Point,
- PointById,
- SketchPoint,
- PointById,
- Vector2Vector3PointById,
- PointLikeById,
- PointsById,
- PointsLikeById,
- SnapEntity,
- ProjectToPlane,
- Point3D,
- Point2D,
- LineTuple,
- CircleTuple,
- ArcTuple,
- FaceTuple,
- HistoryStep,
- HistoryStepType,
- PointHistoryStep,
- PlaneHistoryStep,
- ExtrusionHistoryStep,
- SketchHistoryStep,
- PointData,
- PlaneData,
- ExtrusionData,
- SketchRealized,
- Arc,
- SketchData,
- SegmentId,
- Circle,
- TruckNurbsPoint,
- TruckNurbsSurfaceControlPoint,
- TruckNurbsSurfaceControlPoints,
- TruckNurbsSurface,
- TruckPlane,
- TruckSurface,
- TruckFaceBoundary,
- TruckFace,
- TruckNurbsCurve,
- TruckEdgeEndpoints,
- TruckEdge,
- TruckLineVectors,
- TruckLine,
- TruckCurve,
- SketchTuple,
- Realization,
- PlaneRealized,
- TruckFaceEdgeIndex,
- TruckBoundary,
- TruckSolid,
- SolidRealized,
- ExtrusionSketchData,
- UpdateExtrusion,
- SetSketchPlane,
- NewSketchOnPlane,
- NewExtrusion,
- DeleteLines,
- DeleteArcs,
- DeleteCircles,
- NewRectangleBetweenPoints,
- NewCircleBetweenPoints,
- NewLineOnSketch,
- NewPointOnSketch2,
- RenameStep,
- Message,
- MessageHistory,
- RenameWorkbench,
- RenameProject
+ IDictionary,
+ WithTarget,
+ SetCameraFocus,
+ EntityType,
+ Entity,
+ CircleEntity,
+ ArcEntity,
+ FaceEntity,
+ LineEntity,
+ PlaneEntity,
+ PointEntity,
+ Point3DEntity,
+ MeshFaceEntity,
+ Project,
+ WorkBench,
+ PreviewGeometry,
+ Plane,
+ Point,
+ PointById,
+ SketchPoint,
+ PointById,
+ Vector2Vector3PointById,
+ PointLikeById,
+ PointsById,
+ PointsLikeById,
+ SnapEntity,
+ ProjectToPlane,
+ Point3D,
+ Point2D,
+ LineTuple,
+ CircleTuple,
+ ArcTuple,
+ FaceTuple,
+ HistoryStep,
+ HistoryStepType,
+ PointHistoryStep,
+ PlaneHistoryStep,
+ ExtrusionHistoryStep,
+ SketchHistoryStep,
+ PointData,
+ PlaneData,
+ ExtrusionData,
+ SketchRealized,
+ Arc,
+ SketchData,
+ SegmentId,
+ Circle,
+ TruckNurbsPoint,
+ TruckNurbsSurfaceControlPoint,
+ TruckNurbsSurfaceControlPoints,
+ TruckNurbsSurface,
+ TruckPlane,
+ TruckSurface,
+ TruckFaceBoundary,
+ TruckFace,
+ TruckNurbsCurve,
+ TruckEdgeEndpoints,
+ TruckEdge,
+ TruckLineVectors,
+ TruckLine,
+ TruckCurve,
+ SketchTuple,
+ Realization,
+ PlaneRealized,
+ TruckFaceEdgeIndex,
+ TruckBoundary,
+ TruckSolid,
+ SolidRealized,
+ ExtrusionSketchData,
+ UpdateExtrusion,
+ SetSketchPlane,
+ NewSketchOnPlane,
+ NewExtrusion,
+ DeleteLines,
+ DeleteArcs,
+ DeleteCircles,
+ NewRectangleBetweenPoints,
+ NewCircleBetweenPoints,
+ NewLineOnSketch,
+ NewPointOnSketch2,
+ RenameStep,
+ Message,
+ MessageHistory,
+ RenameWorkbench,
+ RenameProject,
} from "./types"
-import { Vector2 } from "three"
-import { Vector3 } from "three"
+import {Vector2} from "three"
+import {Vector3} from "three"
export function isIDictionary(obj: unknown): obj is IDictionary {
- const typedObj = obj as IDictionary
- return (
- ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- Object.entries(typedObj).every(([key, value]) => value === "TValue" && typeof key === "string")
- )
+ const typedObj = obj as IDictionary
+ return (
+ ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
+ Object.entries(typedObj).every(([key, value]) => value === "TValue" && typeof key === "string")
+ )
}
export function isWithTarget(obj: unknown): obj is WithTarget {
- const typedObj = obj as WithTarget
- return (
- typeof typedObj === "Event" && // new MouseEvent("mouse") instanceof MouseEvent -> true
- ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- typeof typedObj["currentTarget"] === "Target"
- )
+ const typedObj = obj as WithTarget
+ return (
+ typeof typedObj === "Event" && // new MouseEvent("mouse") instanceof MouseEvent -> true
+ ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
+ typeof typedObj["currentTarget"] === "Target"
+ )
}
export function isSetCameraFocus(obj: unknown): obj is SetCameraFocus {
- const typedObj = obj as SetCameraFocus
- return typeof typedObj === "function"
+ const typedObj = obj as SetCameraFocus
+ return typeof typedObj === "function"
}
export function isEntityType(obj: unknown): obj is EntityType {
- const typedObj = obj as EntityType
- return (
- typedObj === "circle" ||
- typedObj === "arc" ||
- typedObj === "face" ||
- typedObj === "line" ||
- typedObj === "plane" ||
- typedObj === "point" ||
- typedObj === "point3D" ||
- typedObj === "meshFace"
- )
+ const typedObj = obj as EntityType
+ return (
+ typedObj === "circle" ||
+ typedObj === "arc" ||
+ typedObj === "face" ||
+ typedObj === "line" ||
+ typedObj === "plane" ||
+ typedObj === "point" ||
+ typedObj === "point3D" ||
+ typedObj === "meshFace"
+ )
}
export function isEntity(obj: unknown): obj is Entity {
- const typedObj = obj as Entity
- return (
- ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- typeof typedObj["id"] === "string" &&
- (isEntityType(typedObj["type"]) as boolean) &&
- Object.keys(typedObj).length === 2
- )
+ const typedObj = obj as Entity
+ return (
+ ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
+ typeof typedObj["id"] === "string" &&
+ (isEntityType(typedObj["type"]) as boolean) &&
+ Object.keys(typedObj).length === 2
+ )
}
export function isCircleEntity(obj: unknown): obj is CircleEntity {
- const typedObj = obj as CircleEntity
- return (
- ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- typeof typedObj["id"] === "string" &&
- typedObj["type"] === "circle"
- )
+ const typedObj = obj as CircleEntity
+ return (
+ ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
+ typeof typedObj["id"] === "string" &&
+ typedObj["type"] === "circle"
+ )
}
export function isArcEntity(obj: unknown): obj is ArcEntity {
- const typedObj = obj as ArcEntity
- return (
- ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- typeof typedObj["id"] === "string" &&
- typedObj["type"] === "arc"
- )
+ const typedObj = obj as ArcEntity
+ return (
+ ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") && typeof typedObj["id"] === "string" && typedObj["type"] === "arc"
+ )
}
export function isFaceEntity(obj: unknown): obj is FaceEntity {
- const typedObj = obj as FaceEntity
- return (
- ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- typeof typedObj["id"] === "string" &&
- typedObj["type"] === "face"
- )
+ const typedObj = obj as FaceEntity
+ return (
+ ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") && typeof typedObj["id"] === "string" && typedObj["type"] === "face"
+ )
}
export function isLineEntity(obj: unknown): obj is LineEntity {
- const typedObj = obj as LineEntity
- return (
- ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- typeof typedObj["id"] === "string" &&
- typedObj["type"] === "line"
- )
+ const typedObj = obj as LineEntity
+ return (
+ ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") && typeof typedObj["id"] === "string" && typedObj["type"] === "line"
+ )
}
export function isPlaneEntity(obj: unknown): obj is PlaneEntity {
- const typedObj = obj as PlaneEntity
- return (
- ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- typeof typedObj["id"] === "string" &&
- typedObj["type"] === "plane"
- )
+ const typedObj = obj as PlaneEntity
+ return (
+ ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
+ typeof typedObj["id"] === "string" &&
+ typedObj["type"] === "plane"
+ )
}
export function isPointEntity(obj: unknown): obj is PointEntity {
- const typedObj = obj as PointEntity
- return (
- ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- typeof typedObj["id"] === "string" &&
- typedObj["type"] === "point"
- )
+ const typedObj = obj as PointEntity
+ return (
+ ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
+ typeof typedObj["id"] === "string" &&
+ typedObj["type"] === "point"
+ )
}
export function isPoint3DEntity(obj: unknown): obj is Point3DEntity {
- const typedObj = obj as Point3DEntity
- return (
- ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- typeof typedObj["id"] === "string" &&
- typedObj["type"] === "point3D"
- )
+ const typedObj = obj as Point3DEntity
+ return (
+ ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
+ typeof typedObj["id"] === "string" &&
+ typedObj["type"] === "point3D"
+ )
}
export function isMeshFaceEntity(obj: unknown): obj is MeshFaceEntity {
- const typedObj = obj as MeshFaceEntity
- return (
- ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- typeof typedObj["id"] === "string" &&
- typedObj["type"] === "meshFace"
- )
+ const typedObj = obj as MeshFaceEntity
+ return (
+ ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
+ typeof typedObj["id"] === "string" &&
+ typedObj["type"] === "meshFace"
+ )
}
export function isProject(obj: unknown): obj is Project {
- const typedObj = obj as Project
- return (
- ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- typeof typedObj["name"] === "string" &&
- Array.isArray(typedObj["assemblies"]) &&
- Array.isArray(typedObj["workbenches"]) &&
- typedObj["workbenches"].every((e: any) => isWorkBench(e) as boolean)
- )
+ const typedObj = obj as Project
+ return (
+ ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
+ typeof typedObj["name"] === "string" &&
+ Array.isArray(typedObj["assemblies"]) &&
+ Array.isArray(typedObj["workbenches"]) &&
+ typedObj["workbenches"].every((e: any) => isWorkBench(e) as boolean)
+ )
}
export function isWorkBench(obj: unknown): obj is WorkBench {
- const typedObj = obj as WorkBench
- return (
- ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- typeof typedObj["name"] === "string" &&
- Array.isArray(typedObj["history"]) &&
- typedObj["history"].every((e: any) => isHistoryStep(e) as boolean) &&
- ((typedObj["step_counters"] !== null && typeof typedObj["step_counters"] === "object") ||
- typeof typedObj["step_counters"] === "function") &&
- typeof typedObj["step_counters"]["Extrusion"] === "number" &&
- typeof typedObj["step_counters"]["Plane"] === "number" &&
- typeof typedObj["step_counters"]["Point"] === "number" &&
- typeof typedObj["step_counters"]["Sketch"] === "number"
- )
+ const typedObj = obj as WorkBench
+ return (
+ ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
+ typeof typedObj["name"] === "string" &&
+ Array.isArray(typedObj["history"]) &&
+ typedObj["history"].every((e: any) => isHistoryStep(e) as boolean) &&
+ ((typedObj["step_counters"] !== null && typeof typedObj["step_counters"] === "object") || typeof typedObj["step_counters"] === "function") &&
+ typeof typedObj["step_counters"]["Extrusion"] === "number" &&
+ typeof typedObj["step_counters"]["Plane"] === "number" &&
+ typeof typedObj["step_counters"]["Point"] === "number" &&
+ typeof typedObj["step_counters"]["Sketch"] === "number"
+ )
}
export function isPreviewGeometry(obj: unknown): obj is PreviewGeometry {
- const typedObj = obj as PreviewGeometry
- return (
- ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- (isEntityType(typedObj["type"]) as boolean) &&
- (typeof typedObj["start"] === "undefined" || (isPointLikeById(typedObj["start"]) as boolean)) &&
- (typeof typedObj["end"] === "undefined" || (isPointLikeById(typedObj["end"]) as boolean)) &&
- (typeof typedObj["center"] === "undefined" || (isPointLikeById(typedObj["center"]) as boolean)) &&
- (typeof typedObj["radius"] === "undefined" || typeof typedObj["radius"] === "number") &&
- (typeof typedObj["x"] === "undefined" || typeof typedObj["x"] === "number") &&
- (typeof typedObj["y"] === "undefined" || typeof typedObj["y"] === "number") &&
- typeof typedObj["uuid"] === "string"
- )
+ const typedObj = obj as PreviewGeometry
+ return (
+ ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
+ (isEntityType(typedObj["type"]) as boolean) &&
+ (typeof typedObj["start"] === "undefined" || (isPointLikeById(typedObj["start"]) as boolean)) &&
+ (typeof typedObj["end"] === "undefined" || (isPointLikeById(typedObj["end"]) as boolean)) &&
+ (typeof typedObj["center"] === "undefined" || (isPointLikeById(typedObj["center"]) as boolean)) &&
+ (typeof typedObj["radius"] === "undefined" || typeof typedObj["radius"] === "number") &&
+ (typeof typedObj["x"] === "undefined" || typeof typedObj["x"] === "number") &&
+ (typeof typedObj["y"] === "undefined" || typeof typedObj["y"] === "number") &&
+ typeof typedObj["uuid"] === "string"
+ )
}
export function isPlane(obj: unknown): obj is Plane {
- const typedObj = obj as Plane
- return (
- ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- (isPoint3D(typedObj["origin"]) as boolean) &&
- ((typedObj["primary"] !== null && typeof typedObj["primary"] === "object") ||
- typeof typedObj["primary"] === "function") &&
- typeof typedObj["primary"]["x"] === "number" &&
- typeof typedObj["primary"]["y"] === "number" &&
- typeof typedObj["primary"]["z"] === "number" &&
- ((typedObj["secondary"] !== null && typeof typedObj["secondary"] === "object") ||
- typeof typedObj["secondary"] === "function") &&
- typeof typedObj["secondary"]["x"] === "number" &&
- typeof typedObj["secondary"]["y"] === "number" &&
- typeof typedObj["secondary"]["z"] === "number" &&
- ((typedObj["tertiary"] !== null && typeof typedObj["tertiary"] === "object") ||
- typeof typedObj["tertiary"] === "function") &&
- typeof typedObj["tertiary"]["x"] === "number" &&
- typeof typedObj["tertiary"]["y"] === "number" &&
- typeof typedObj["tertiary"]["z"] === "number"
- )
+ const typedObj = obj as Plane
+ return (
+ ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
+ (isPoint3D(typedObj["origin"]) as boolean) &&
+ ((typedObj["primary"] !== null && typeof typedObj["primary"] === "object") || typeof typedObj["primary"] === "function") &&
+ typeof typedObj["primary"]["x"] === "number" &&
+ typeof typedObj["primary"]["y"] === "number" &&
+ typeof typedObj["primary"]["z"] === "number" &&
+ ((typedObj["secondary"] !== null && typeof typedObj["secondary"] === "object") || typeof typedObj["secondary"] === "function") &&
+ typeof typedObj["secondary"]["x"] === "number" &&
+ typeof typedObj["secondary"]["y"] === "number" &&
+ typeof typedObj["secondary"]["z"] === "number" &&
+ ((typedObj["tertiary"] !== null && typeof typedObj["tertiary"] === "object") || typeof typedObj["tertiary"] === "function") &&
+ typeof typedObj["tertiary"]["x"] === "number" &&
+ typeof typedObj["tertiary"]["y"] === "number" &&
+ typeof typedObj["tertiary"]["z"] === "number"
+ )
}
export function isPoint(obj: unknown): obj is Point {
- const typedObj = obj as Point
- return (
- ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- typedObj["twoD"] instanceof Vector2 &&
- typedObj["threeD"] instanceof Vector3
- )
+ const typedObj = obj as Point
+ return (
+ ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
+ typedObj["twoD"] instanceof Vector2 &&
+ typedObj["threeD"] instanceof Vector3
+ )
}
export function isPointById(obj: unknown): obj is PointById {
- const typedObj = obj as PointById
- return (
- ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- (isPoint2D(typedObj["twoD"]) as boolean) &&
- (isPoint3D(typedObj["threeD"]) as boolean) &&
- typeof typedObj["id"] === "string"
- )
+ const typedObj = obj as PointById
+ return (
+ ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
+ (isPoint2D(typedObj["twoD"]) as boolean) &&
+ (isPoint3D(typedObj["threeD"]) as boolean) &&
+ typeof typedObj["id"] === "string"
+ )
}
export function isSketchPoint(obj: unknown): obj is SketchPoint {
- const typedObj = obj as SketchPoint
- return (
- ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- (isPoint2D(typedObj["twoD"]) as boolean) &&
- (isPoint3D(typedObj["threeD"]) as boolean)
- )
+ const typedObj = obj as SketchPoint
+ return (
+ ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
+ (isPoint2D(typedObj["twoD"]) as boolean) &&
+ (isPoint3D(typedObj["threeD"]) as boolean)
+ )
}
export function isVector2Vector3PointById(obj: unknown): obj is Vector2Vector3PointById {
- const typedObj = obj as Vector2Vector3PointById
- return (
- ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- typedObj["twoD"] instanceof Vector2 &&
- typedObj["threeD"] instanceof Vector3 &&
- (typedObj["id"] === null || typeof typedObj["id"] === "string")
- )
+ const typedObj = obj as Vector2Vector3PointById
+ return (
+ ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
+ typedObj["twoD"] instanceof Vector2 &&
+ typedObj["threeD"] instanceof Vector3 &&
+ (typedObj["id"] === null || typeof typedObj["id"] === "string")
+ )
}
export function isPointLikeById(obj: unknown): obj is PointLikeById {
- const typedObj = obj as PointLikeById
- return (
- ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- (typeof typedObj["twoD"] === "undefined" ||
- (isPoint2D(typedObj["twoD"]) as boolean) ||
- typedObj["twoD"] instanceof Vector2 ||
- (((typedObj["twoD"] !== null && typeof typedObj["twoD"] === "object") ||
- typeof typedObj["twoD"] === "function") &&
- typeof typedObj["twoD"]["x"] === "number" &&
- typeof typedObj["twoD"]["y"] === "number")) &&
- (typeof typedObj["threeD"] === "undefined" ||
- (isPoint3D(typedObj["threeD"]) as boolean) ||
- (((typedObj["threeD"] !== null && typeof typedObj["threeD"] === "object") ||
- typeof typedObj["threeD"] === "function") &&
- typeof typedObj["threeD"]["x"] === "number" &&
- typeof typedObj["threeD"]["y"] === "number" &&
- typeof typedObj["threeD"]["z"] === "number") ||
- typedObj["threeD"] instanceof Vector3) &&
- (typeof typedObj["id"] === "undefined" ||
- typedObj["id"] === null ||
- // typeof typedObj["id"] === "number" ||
- typeof typedObj["id"] === "string") &&
- Object.entries(typedObj)
- .filter(([key]) => !["twoD", "threeD", "id"].includes(key))
- .every(([key, _value]) => typeof key === "string")
- )
+ const typedObj = obj as PointLikeById
+ return (
+ ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
+ (typeof typedObj["twoD"] === "undefined" ||
+ (isPoint2D(typedObj["twoD"]) as boolean) ||
+ typedObj["twoD"] instanceof Vector2 ||
+ (((typedObj["twoD"] !== null && typeof typedObj["twoD"] === "object") || typeof typedObj["twoD"] === "function") &&
+ typeof typedObj["twoD"]["x"] === "number" &&
+ typeof typedObj["twoD"]["y"] === "number")) &&
+ (typeof typedObj["threeD"] === "undefined" ||
+ (isPoint3D(typedObj["threeD"]) as boolean) ||
+ (((typedObj["threeD"] !== null && typeof typedObj["threeD"] === "object") || typeof typedObj["threeD"] === "function") &&
+ typeof typedObj["threeD"]["x"] === "number" &&
+ typeof typedObj["threeD"]["y"] === "number" &&
+ typeof typedObj["threeD"]["z"] === "number") ||
+ typedObj["threeD"] instanceof Vector3) &&
+ (typeof typedObj["id"] === "undefined" ||
+ typedObj["id"] === null ||
+ // typeof typedObj["id"] === "number" ||
+ typeof typedObj["id"] === "string") &&
+ Object.entries(typedObj)
+ .filter(([key]) => !["twoD", "threeD", "id"].includes(key))
+ .every(([key, _value]) => typeof key === "string")
+ )
}
export function isPointsById(obj: unknown): obj is PointsById {
- const typedObj = obj as PointsById
- return (
- ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- Object.entries(typedObj).every(([key, value]) => (isPointById(value) as boolean) && typeof key === "string")
- )
+ const typedObj = obj as PointsById
+ return (
+ ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
+ Object.entries(typedObj).every(([key, value]) => (isPointById(value) as boolean) && typeof key === "string")
+ )
}
export function isPointsLikeById(obj: unknown): obj is PointsLikeById {
- const typedObj = obj as PointsLikeById
- return (
- ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- Object.entries(typedObj).every(
- ([key, value]) => (isPointLikeById(value) as boolean) && typeof key === "string"
- )
- )
+ const typedObj = obj as PointsLikeById
+ return (
+ ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
+ Object.entries(typedObj).every(([key, value]) => (isPointLikeById(value) as boolean) && typeof key === "string")
+ )
}
export function isSnapEntity(obj: unknown): obj is SnapEntity {
- const typedObj = obj as SnapEntity
- return (
- ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- typeof typedObj["id"] === "string" &&
- (isEntityType(typedObj["type"]) as boolean) &&
- (typeof typedObj["x"] === "undefined" || typeof typedObj["x"] === "number") &&
- (typeof typedObj["y"] === "undefined" || typeof typedObj["y"] === "number") &&
- (typeof typedObj["z"] === "undefined" || typeof typedObj["z"] === "number")
- )
+ const typedObj = obj as SnapEntity
+ return (
+ ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
+ typeof typedObj["id"] === "string" &&
+ (isEntityType(typedObj["type"]) as boolean) &&
+ (typeof typedObj["x"] === "undefined" || typeof typedObj["x"] === "number") &&
+ (typeof typedObj["y"] === "undefined" || typeof typedObj["y"] === "number") &&
+ (typeof typedObj["z"] === "undefined" || typeof typedObj["z"] === "number")
+ )
}
export function isProjectToPlane(obj: unknown): obj is ProjectToPlane {
- const typedObj = obj as ProjectToPlane
- return typeof typedObj === "function"
+ const typedObj = obj as ProjectToPlane
+ return typeof typedObj === "function"
}
export function isPoint3D(obj: unknown): obj is Point3D {
- const typedObj = obj as Point3D
- return (
- ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- typeof typedObj["x"] === "number" &&
- typeof typedObj["y"] === "number" &&
- typeof typedObj["z"] === "number" &&
- typeof typedObj["hidden"] === "boolean"
- )
+ const typedObj = obj as Point3D
+ return (
+ ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
+ typeof typedObj["x"] === "number" &&
+ typeof typedObj["y"] === "number" &&
+ typeof typedObj["z"] === "number" &&
+ typeof typedObj["hidden"] === "boolean"
+ )
}
export function isPoint2D(obj: unknown): obj is Point2D {
- const typedObj = obj as Point2D
- return (
- ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- typeof typedObj["x"] === "number" &&
- typeof typedObj["y"] === "number" &&
- typeof typedObj["m"] === "number" &&
- typeof typedObj["dx"] === "number" &&
- typeof typedObj["dy"] === "number" &&
- typeof typedObj["fx"] === "number" &&
- typeof typedObj["fy"] === "number" &&
- typeof typedObj["fixed"] === "boolean" &&
- typeof typedObj["hidden"] === "boolean"
- )
+ const typedObj = obj as Point2D
+ return (
+ ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
+ typeof typedObj["x"] === "number" &&
+ typeof typedObj["y"] === "number" &&
+ typeof typedObj["m"] === "number" &&
+ typeof typedObj["dx"] === "number" &&
+ typeof typedObj["dy"] === "number" &&
+ typeof typedObj["fx"] === "number" &&
+ typeof typedObj["fy"] === "number" &&
+ typeof typedObj["fixed"] === "boolean" &&
+ typeof typedObj["hidden"] === "boolean"
+ )
}
export function isLineTuple(obj: unknown): obj is LineTuple {
- const typedObj = obj as LineTuple
- return (
- ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- typeof typedObj["id"] === "string" &&
- ((typedObj["start"] !== null && typeof typedObj["start"] === "object") ||
- typeof typedObj["start"] === "function") &&
- (isPoint2D(typedObj["start"]["twoD"]) as boolean) &&
- (isPoint3D(typedObj["start"]["threeD"]) as boolean) &&
- ((typedObj["end"] !== null && typeof typedObj["end"] === "object") || typeof typedObj["end"] === "function") &&
- (isPoint2D(typedObj["end"]["twoD"]) as boolean) &&
- (isPoint3D(typedObj["end"]["threeD"]) as boolean)
- )
+ const typedObj = obj as LineTuple
+ return (
+ ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
+ typeof typedObj["id"] === "string" &&
+ ((typedObj["start"] !== null && typeof typedObj["start"] === "object") || typeof typedObj["start"] === "function") &&
+ (isPoint2D(typedObj["start"]["twoD"]) as boolean) &&
+ (isPoint3D(typedObj["start"]["threeD"]) as boolean) &&
+ ((typedObj["end"] !== null && typeof typedObj["end"] === "object") || typeof typedObj["end"] === "function") &&
+ (isPoint2D(typedObj["end"]["twoD"]) as boolean) &&
+ (isPoint3D(typedObj["end"]["threeD"]) as boolean)
+ )
}
export function isCircleTuple(obj: unknown): obj is CircleTuple {
- const typedObj = obj as CircleTuple
- return (
- ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- typeof typedObj["id"] === "string" &&
- ((typedObj["center"] !== null && typeof typedObj["center"] === "object") ||
- typeof typedObj["center"] === "function") &&
- (isPoint2D(typedObj["center"]["twoD"]) as boolean) &&
- (isPoint3D(typedObj["center"]["threeD"]) as boolean) &&
- typeof typedObj["radius"] === "number"
- )
+ const typedObj = obj as CircleTuple
+ return (
+ ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
+ typeof typedObj["id"] === "string" &&
+ ((typedObj["center"] !== null && typeof typedObj["center"] === "object") || typeof typedObj["center"] === "function") &&
+ (isPoint2D(typedObj["center"]["twoD"]) as boolean) &&
+ (isPoint3D(typedObj["center"]["threeD"]) as boolean) &&
+ typeof typedObj["radius"] === "number"
+ )
}
export function isArcTuple(obj: unknown): obj is ArcTuple {
- const typedObj = obj as ArcTuple
- return (
- ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- typeof typedObj["id"] === "string" &&
- ((typedObj["center"] !== null && typeof typedObj["center"] === "object") ||
- typeof typedObj["center"] === "function") &&
- (isPoint2D(typedObj["center"]["twoD"]) as boolean) &&
- (isPoint3D(typedObj["center"]["threeD"]) as boolean) &&
- ((typedObj["start"] !== null && typeof typedObj["start"] === "object") ||
- typeof typedObj["start"] === "function") &&
- (isPoint2D(typedObj["start"]["twoD"]) as boolean) &&
- (isPoint3D(typedObj["start"]["threeD"]) as boolean) &&
- ((typedObj["end"] !== null && typeof typedObj["end"] === "object") || typeof typedObj["end"] === "function") &&
- (isPoint2D(typedObj["end"]["twoD"]) as boolean) &&
- (isPoint3D(typedObj["end"]["threeD"]) as boolean)
- )
+ const typedObj = obj as ArcTuple
+ return (
+ ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
+ typeof typedObj["id"] === "string" &&
+ ((typedObj["center"] !== null && typeof typedObj["center"] === "object") || typeof typedObj["center"] === "function") &&
+ (isPoint2D(typedObj["center"]["twoD"]) as boolean) &&
+ (isPoint3D(typedObj["center"]["threeD"]) as boolean) &&
+ ((typedObj["start"] !== null && typeof typedObj["start"] === "object") || typeof typedObj["start"] === "function") &&
+ (isPoint2D(typedObj["start"]["twoD"]) as boolean) &&
+ (isPoint3D(typedObj["start"]["threeD"]) as boolean) &&
+ ((typedObj["end"] !== null && typeof typedObj["end"] === "object") || typeof typedObj["end"] === "function") &&
+ (isPoint2D(typedObj["end"]["twoD"]) as boolean) &&
+ (isPoint3D(typedObj["end"]["threeD"]) as boolean)
+ )
}
export function isFaceTuple(obj: unknown): obj is FaceTuple {
- const typedObj = obj as FaceTuple
- return (
- ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- typeof typedObj["id"] === "string" &&
- typeof typedObj["face"] === "object"
- )
+ const typedObj = obj as FaceTuple
+ return (
+ ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
+ typeof typedObj["id"] === "string" &&
+ typeof typedObj["face"] === "object"
+ )
}
export function isHistoryStep(obj: unknown): obj is HistoryStep {
- const typedObj = obj as HistoryStep
- return (
- ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- typeof typedObj["name"] === "string" &&
- typeof typedObj["suppressed"] === "boolean" &&
- typeof typedObj["unique_id"] === "string" &&
- ((((typedObj["data"] !== null && typeof typedObj["data"] === "object") || typeof typedObj["data"] === "function") &&
- (isHistoryStepType(typedObj["data"]["type"]) as boolean) &&
- (isPoint3D(typedObj["data"]["point"]) as boolean)) ||
- (((typedObj["data"] !== null && typeof typedObj["data"] === "object") ||
- typeof typedObj["data"] === "function") &&
- (isHistoryStepType(typedObj["data"]["type"]) as boolean) &&
- (isPlane(typedObj["data"]["plane"]) as boolean) &&
- typeof typedObj["data"]["width"] === "number" &&
- typeof typedObj["data"]["height"] === "number") ||
- (((typedObj["data"] !== null && typeof typedObj["data"] === "object") ||
- typeof typedObj["data"] === "function") &&
- (isHistoryStepType(typedObj["data"]["type"]) as boolean) &&
- ((typedObj["data"]["extrusion"] !== null && typeof typedObj["data"]["extrusion"] === "object") ||
- typeof typedObj["data"]["extrusion"] === "function") &&
- typeof typedObj["data"]["extrusion"]["sketch_id"] === "string" &&
- Array.isArray(typedObj["data"]["extrusion"]["face_ids"]) &&
- typedObj["data"]["extrusion"]["face_ids"].every((e: any) => typeof e === "number") &&
- typeof typedObj["data"]["extrusion"]["length"] === "number" &&
- typeof typedObj["data"]["extrusion"]["offset"] === "number" &&
- typeof typedObj["data"]["extrusion"]["direction"] === "string" &&
- typeof typedObj["data"]["extrusion"]["mode"] === "string") ||
- (((typedObj["data"] !== null && typeof typedObj["data"] === "object") ||
- typeof typedObj["data"] === "function") &&
- (isHistoryStepType(typedObj["data"]["type"]) as boolean) &&
- ((typedObj["data"]["plane_description"] !== null &&
- typeof typedObj["data"]["plane_description"] === "object") ||
- typeof typedObj["data"]["plane_description"] === "function") &&
- typeof typedObj["data"]["plane_description"]["PlaneId"] === "string" &&
- typeof typedObj["data"]["width"] === "number" &&
- typeof typedObj["data"]["height"] === "number" &&
- ((typedObj["data"]["sketch"] !== null && typeof typedObj["data"]["sketch"] === "object") ||
- typeof typedObj["data"]["sketch"] === "function") &&
- ((typedObj["data"]["sketch"]["points"] !== null && typeof typedObj["data"]["sketch"]["points"] === "object") ||
- typeof typedObj["data"]["sketch"]["points"] === "function") &&
- Object.entries(typedObj["data"]["sketch"]["points"]).every(
- ([key, value]) => (isPoint2D(value) as boolean) && typeof key === "string"
- ) &&
- typeof typedObj["data"]["sketch"]["highest_point_id"] === "number" &&
- ((typedObj["data"]["sketch"]["line_segments"] !== null &&
- typeof typedObj["data"]["sketch"]["line_segments"] === "object") ||
- typeof typedObj["data"]["sketch"]["line_segments"] === "function") &&
- Object.entries(typedObj["data"]["sketch"]["line_segments"]).every(
- ([key, value]) => (isSegmentId(value) as boolean) && typeof key === "string"
- ) &&
- typeof typedObj["data"]["sketch"]["highest_line_segment_id"] === "number" &&
- ((typedObj["data"]["sketch"]["circles"] !== null &&
- typeof typedObj["data"]["sketch"]["circles"] === "object") ||
- typeof typedObj["data"]["sketch"]["circles"] === "function") &&
- Object.entries(typedObj["data"]["sketch"]["circles"]).every(
- ([key, value]) => (isCircle(value) as boolean) && typeof key === "string"
- ) &&
- typeof typedObj["data"]["sketch"]["highest_circle_id"] === "number" &&
- typeof typedObj["data"]["sketch"]["arcs"] === "object" &&
- typeof typedObj["data"]["sketch"]["highest_arc_id"] === "number" &&
- typeof typedObj["data"]["sketch"]["constraints"] === "object" &&
- typeof typedObj["data"]["sketch"]["highest_constraint_id"] === "number"))
- )
+ const typedObj = obj as HistoryStep
+ return (
+ ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
+ typeof typedObj["name"] === "string" &&
+ typeof typedObj["suppressed"] === "boolean" &&
+ typeof typedObj["unique_id"] === "string" &&
+ ((((typedObj["data"] !== null && typeof typedObj["data"] === "object") || typeof typedObj["data"] === "function") &&
+ (isHistoryStepType(typedObj["data"]["type"]) as boolean) &&
+ (isPoint3D(typedObj["data"]["point"]) as boolean)) ||
+ (((typedObj["data"] !== null && typeof typedObj["data"] === "object") || typeof typedObj["data"] === "function") &&
+ (isHistoryStepType(typedObj["data"]["type"]) as boolean) &&
+ (isPlane(typedObj["data"]["plane"]) as boolean) &&
+ typeof typedObj["data"]["width"] === "number" &&
+ typeof typedObj["data"]["height"] === "number") ||
+ (((typedObj["data"] !== null && typeof typedObj["data"] === "object") || typeof typedObj["data"] === "function") &&
+ (isHistoryStepType(typedObj["data"]["type"]) as boolean) &&
+ ((typedObj["data"]["extrusion"] !== null && typeof typedObj["data"]["extrusion"] === "object") ||
+ typeof typedObj["data"]["extrusion"] === "function") &&
+ typeof typedObj["data"]["extrusion"]["sketch_id"] === "string" &&
+ Array.isArray(typedObj["data"]["extrusion"]["face_ids"]) &&
+ typedObj["data"]["extrusion"]["face_ids"].every((e: any) => typeof e === "number") &&
+ typeof typedObj["data"]["extrusion"]["length"] === "number" &&
+ typeof typedObj["data"]["extrusion"]["offset"] === "number" &&
+ typeof typedObj["data"]["extrusion"]["direction"] === "string" &&
+ typeof typedObj["data"]["extrusion"]["mode"] === "string") ||
+ (((typedObj["data"] !== null && typeof typedObj["data"] === "object") || typeof typedObj["data"] === "function") &&
+ (isHistoryStepType(typedObj["data"]["type"]) as boolean) &&
+ ((typedObj["data"]["plane_description"] !== null && typeof typedObj["data"]["plane_description"] === "object") ||
+ typeof typedObj["data"]["plane_description"] === "function") &&
+ typeof typedObj["data"]["plane_description"]["PlaneId"] === "string" &&
+ typeof typedObj["data"]["width"] === "number" &&
+ typeof typedObj["data"]["height"] === "number" &&
+ ((typedObj["data"]["sketch"] !== null && typeof typedObj["data"]["sketch"] === "object") || typeof typedObj["data"]["sketch"] === "function") &&
+ ((typedObj["data"]["sketch"]["points"] !== null && typeof typedObj["data"]["sketch"]["points"] === "object") ||
+ typeof typedObj["data"]["sketch"]["points"] === "function") &&
+ Object.entries(typedObj["data"]["sketch"]["points"]).every(([key, value]) => (isPoint2D(value) as boolean) && typeof key === "string") &&
+ typeof typedObj["data"]["sketch"]["highest_point_id"] === "number" &&
+ ((typedObj["data"]["sketch"]["line_segments"] !== null && typeof typedObj["data"]["sketch"]["line_segments"] === "object") ||
+ typeof typedObj["data"]["sketch"]["line_segments"] === "function") &&
+ Object.entries(typedObj["data"]["sketch"]["line_segments"]).every(([key, value]) => (isSegmentId(value) as boolean) && typeof key === "string") &&
+ typeof typedObj["data"]["sketch"]["highest_line_segment_id"] === "number" &&
+ ((typedObj["data"]["sketch"]["circles"] !== null && typeof typedObj["data"]["sketch"]["circles"] === "object") ||
+ typeof typedObj["data"]["sketch"]["circles"] === "function") &&
+ Object.entries(typedObj["data"]["sketch"]["circles"]).every(([key, value]) => (isCircle(value) as boolean) && typeof key === "string") &&
+ typeof typedObj["data"]["sketch"]["highest_circle_id"] === "number" &&
+ typeof typedObj["data"]["sketch"]["arcs"] === "object" &&
+ typeof typedObj["data"]["sketch"]["highest_arc_id"] === "number" &&
+ typeof typedObj["data"]["sketch"]["constraints"] === "object" &&
+ typeof typedObj["data"]["sketch"]["highest_constraint_id"] === "number"))
+ )
}
export function isHistoryStepType(obj: unknown): obj is HistoryStepType {
- const typedObj = obj as HistoryStepType
- return typedObj === "Point" || typedObj === "Plane" || typedObj === "Extrusion" || typedObj === "Sketch"
+ const typedObj = obj as HistoryStepType
+ return typedObj === "Point" || typedObj === "Plane" || typedObj === "Extrusion" || typedObj === "Sketch"
}
export function isPointHistoryStep(obj: unknown): obj is PointHistoryStep {
- const typedObj = obj as PointHistoryStep
- return (isHistoryStep(typedObj) as boolean) && (isPointData(typedObj) as boolean)
+ const typedObj = obj as PointHistoryStep
+ return (isHistoryStep(typedObj) as boolean) && (isPointData(typedObj) as boolean)
}
export function isPlaneHistoryStep(obj: unknown): obj is PlaneHistoryStep {
- const typedObj = obj as PlaneHistoryStep
- return (isHistoryStep(typedObj) as boolean) && (isPlaneData(typedObj) as boolean)
+ const typedObj = obj as PlaneHistoryStep
+ return (isHistoryStep(typedObj) as boolean) && (isPlaneData(typedObj) as boolean)
}
export function isExtrusionHistoryStep(obj: unknown): obj is ExtrusionHistoryStep {
- const typedObj = obj as ExtrusionHistoryStep
- return (isHistoryStep(typedObj) as boolean) && (isExtrusionData(typedObj) as boolean)
+ const typedObj = obj as ExtrusionHistoryStep
+ return (isHistoryStep(typedObj) as boolean) && (isExtrusionData(typedObj) as boolean)
}
export function isSketchHistoryStep(obj: unknown): obj is SketchHistoryStep {
- const typedObj = obj as SketchHistoryStep
- return (isHistoryStep(typedObj) as boolean) && (isSketchData(typedObj) as boolean)
+ const typedObj = obj as SketchHistoryStep
+ return (isHistoryStep(typedObj) as boolean) && (isSketchData(typedObj) as boolean)
}
export function isPointData(obj: unknown): obj is PointData {
- const typedObj = obj as PointData
- return (
- ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- ((typedObj["data"] !== null && typeof typedObj["data"] === "object") || typeof typedObj["data"] === "function") &&
- (isHistoryStepType(typedObj["data"]["type"]) as boolean) &&
- (isPoint3D(typedObj["data"]["point"]) as boolean)
- )
+ const typedObj = obj as PointData
+ return (
+ ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
+ ((typedObj["data"] !== null && typeof typedObj["data"] === "object") || typeof typedObj["data"] === "function") &&
+ (isHistoryStepType(typedObj["data"]["type"]) as boolean) &&
+ (isPoint3D(typedObj["data"]["point"]) as boolean)
+ )
}
export function isPlaneData(obj: unknown): obj is PlaneData {
- const typedObj = obj as PlaneData
- return (
- ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- ((typedObj["data"] !== null && typeof typedObj["data"] === "object") || typeof typedObj["data"] === "function") &&
- (isHistoryStepType(typedObj["data"]["type"]) as boolean) &&
- (isPlane(typedObj["data"]["plane"]) as boolean) &&
- typeof typedObj["data"]["width"] === "number" &&
- typeof typedObj["data"]["height"] === "number"
- )
+ const typedObj = obj as PlaneData
+ return (
+ ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
+ ((typedObj["data"] !== null && typeof typedObj["data"] === "object") || typeof typedObj["data"] === "function") &&
+ (isHistoryStepType(typedObj["data"]["type"]) as boolean) &&
+ (isPlane(typedObj["data"]["plane"]) as boolean) &&
+ typeof typedObj["data"]["width"] === "number" &&
+ typeof typedObj["data"]["height"] === "number"
+ )
}
export function isExtrusionData(obj: unknown): obj is ExtrusionData {
- const typedObj = obj as ExtrusionData
- return (
- ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- ((typedObj["data"] !== null && typeof typedObj["data"] === "object") || typeof typedObj["data"] === "function") &&
- (isHistoryStepType(typedObj["data"]["type"]) as boolean) &&
- ((typedObj["data"]["extrusion"] !== null && typeof typedObj["data"]["extrusion"] === "object") ||
- typeof typedObj["data"]["extrusion"] === "function") &&
- typeof typedObj["data"]["extrusion"]["sketch_id"] === "string" &&
- Array.isArray(typedObj["data"]["extrusion"]["face_ids"]) &&
- typedObj["data"]["extrusion"]["face_ids"].every((e: any) => typeof e === "number") &&
- typeof typedObj["data"]["extrusion"]["length"] === "number" &&
- typeof typedObj["data"]["extrusion"]["offset"] === "number" &&
- typeof typedObj["data"]["extrusion"]["direction"] === "string" &&
- typeof typedObj["data"]["extrusion"]["mode"] === "string"
- )
+ const typedObj = obj as ExtrusionData
+ return (
+ ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
+ ((typedObj["data"] !== null && typeof typedObj["data"] === "object") || typeof typedObj["data"] === "function") &&
+ (isHistoryStepType(typedObj["data"]["type"]) as boolean) &&
+ ((typedObj["data"]["extrusion"] !== null && typeof typedObj["data"]["extrusion"] === "object") || typeof typedObj["data"]["extrusion"] === "function") &&
+ typeof typedObj["data"]["extrusion"]["sketch_id"] === "string" &&
+ Array.isArray(typedObj["data"]["extrusion"]["face_ids"]) &&
+ typedObj["data"]["extrusion"]["face_ids"].every((e: any) => typeof e === "number") &&
+ typeof typedObj["data"]["extrusion"]["length"] === "number" &&
+ typeof typedObj["data"]["extrusion"]["offset"] === "number" &&
+ typeof typedObj["data"]["extrusion"]["direction"] === "string" &&
+ typeof typedObj["data"]["extrusion"]["mode"] === "string"
+ )
}
export function isSketchRealized(obj: unknown): obj is SketchRealized {
- const typedObj = obj as SketchRealized
- return (
- ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- typeof typedObj["plane_id"] === "string" &&
- typeof typedObj["plane_name"] === "string" &&
- ((typedObj["points"] !== null && typeof typedObj["points"] === "object") ||
- typeof typedObj["points"] === "function") &&
- Object.entries(typedObj["points"]).every(
- ([key, value]) => (isPoint3D(value) as boolean) && typeof key === "string"
- ) &&
- ((typedObj["points_2d"] !== null && typeof typedObj["points_2d"] === "object") ||
- typeof typedObj["points_2d"] === "function") &&
- Object.entries(typedObj["points_2d"]).every(
- ([key, value]) => (isPoint2D(value) as boolean) && typeof key === "string"
- ) &&
- typeof typedObj["highest_point_id"] === "number" &&
- ((typedObj["line_segments"] !== null && typeof typedObj["line_segments"] === "object") ||
- typeof typedObj["line_segments"] === "function") &&
- Object.entries(typedObj["line_segments"]).every(
- ([key, value]) => (isSegmentId(value) as boolean) && typeof key === "string"
- ) &&
- typeof typedObj["highest_line_segment_id"] === "number" &&
- ((typedObj["circles"] !== null && typeof typedObj["circles"] === "object") ||
- typeof typedObj["circles"] === "function") &&
- Object.entries(typedObj["circles"]).every(
- ([key, value]) => (isCircle(value) as boolean) && typeof key === "string"
- ) &&
- typeof typedObj["highest_circle_id"] === "number" &&
- ((typedObj["arcs"] !== null && typeof typedObj["arcs"] === "object") || typeof typedObj["arcs"] === "function") &&
- Object.entries(typedObj["arcs"]).every(
- ([key, value]) => (isArc(value) as boolean) && typeof key === "string"
- ) &&
- typeof typedObj["highest_arc_id"] === "number" &&
- typeof typedObj["constraints"] === "object" &&
- typeof typedObj["highest_constraint_id"] === "number" &&
- Array.isArray(typedObj["faces"])
- )
+ const typedObj = obj as SketchRealized
+ return (
+ ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
+ typeof typedObj["plane_id"] === "string" &&
+ typeof typedObj["plane_name"] === "string" &&
+ ((typedObj["points"] !== null && typeof typedObj["points"] === "object") || typeof typedObj["points"] === "function") &&
+ Object.entries(typedObj["points"]).every(([key, value]) => (isPoint3D(value) as boolean) && typeof key === "string") &&
+ ((typedObj["points_2d"] !== null && typeof typedObj["points_2d"] === "object") || typeof typedObj["points_2d"] === "function") &&
+ Object.entries(typedObj["points_2d"]).every(([key, value]) => (isPoint2D(value) as boolean) && typeof key === "string") &&
+ typeof typedObj["highest_point_id"] === "number" &&
+ ((typedObj["line_segments"] !== null && typeof typedObj["line_segments"] === "object") || typeof typedObj["line_segments"] === "function") &&
+ Object.entries(typedObj["line_segments"]).every(([key, value]) => (isSegmentId(value) as boolean) && typeof key === "string") &&
+ typeof typedObj["highest_line_segment_id"] === "number" &&
+ ((typedObj["circles"] !== null && typeof typedObj["circles"] === "object") || typeof typedObj["circles"] === "function") &&
+ Object.entries(typedObj["circles"]).every(([key, value]) => (isCircle(value) as boolean) && typeof key === "string") &&
+ typeof typedObj["highest_circle_id"] === "number" &&
+ ((typedObj["arcs"] !== null && typeof typedObj["arcs"] === "object") || typeof typedObj["arcs"] === "function") &&
+ Object.entries(typedObj["arcs"]).every(([key, value]) => (isArc(value) as boolean) && typeof key === "string") &&
+ typeof typedObj["highest_arc_id"] === "number" &&
+ typeof typedObj["constraints"] === "object" &&
+ typeof typedObj["highest_constraint_id"] === "number" &&
+ Array.isArray(typedObj["faces"])
+ )
}
export function isArc(obj: unknown): obj is Arc {
- const typedObj = obj as Arc
- return (
- ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- typeof typedObj["center"] === "number" &&
- typeof typedObj["start"] === "number" &&
- typeof typedObj["end"] === "number" &&
- typeof typedObj["clockwise"] === "boolean"
- )
+ const typedObj = obj as Arc
+ return (
+ ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
+ typeof typedObj["center"] === "number" &&
+ typeof typedObj["start"] === "number" &&
+ typeof typedObj["end"] === "number" &&
+ typeof typedObj["clockwise"] === "boolean"
+ )
}
export function isSketchData(obj: unknown): obj is SketchData {
- const typedObj = obj as SketchData
- return (
- ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- ((typedObj["data"] !== null && typeof typedObj["data"] === "object") || typeof typedObj["data"] === "function") &&
- (isHistoryStepType(typedObj["data"]["type"]) as boolean) &&
- ((typedObj["data"]["plane_description"] !== null && typeof typedObj["data"]["plane_description"] === "object") ||
- typeof typedObj["data"]["plane_description"] === "function") &&
- typeof typedObj["data"]["plane_description"]["PlaneId"] === "string" &&
- typeof typedObj["data"]["width"] === "number" &&
- typeof typedObj["data"]["height"] === "number" &&
- ((typedObj["data"]["sketch"] !== null && typeof typedObj["data"]["sketch"] === "object") ||
- typeof typedObj["data"]["sketch"] === "function") &&
- ((typedObj["data"]["sketch"]["points"] !== null && typeof typedObj["data"]["sketch"]["points"] === "object") ||
- typeof typedObj["data"]["sketch"]["points"] === "function") &&
- Object.entries(typedObj["data"]["sketch"]["points"]).every(
- ([key, value]) => (isPoint2D(value) as boolean) && typeof key === "string"
- ) &&
- typeof typedObj["data"]["sketch"]["highest_point_id"] === "number" &&
- ((typedObj["data"]["sketch"]["line_segments"] !== null &&
- typeof typedObj["data"]["sketch"]["line_segments"] === "object") ||
- typeof typedObj["data"]["sketch"]["line_segments"] === "function") &&
- Object.entries(typedObj["data"]["sketch"]["line_segments"]).every(
- ([key, value]) => (isSegmentId(value) as boolean) && typeof key === "string"
- ) &&
- typeof typedObj["data"]["sketch"]["highest_line_segment_id"] === "number" &&
- ((typedObj["data"]["sketch"]["circles"] !== null && typeof typedObj["data"]["sketch"]["circles"] === "object") ||
- typeof typedObj["data"]["sketch"]["circles"] === "function") &&
- Object.entries(typedObj["data"]["sketch"]["circles"]).every(
- ([key, value]) => (isCircle(value) as boolean) && typeof key === "string"
- ) &&
- typeof typedObj["data"]["sketch"]["highest_circle_id"] === "number" &&
- typeof typedObj["data"]["sketch"]["arcs"] === "object" &&
- typeof typedObj["data"]["sketch"]["highest_arc_id"] === "number" &&
- typeof typedObj["data"]["sketch"]["constraints"] === "object" &&
- typeof typedObj["data"]["sketch"]["highest_constraint_id"] === "number"
- )
+ const typedObj = obj as SketchData
+ return (
+ ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
+ ((typedObj["data"] !== null && typeof typedObj["data"] === "object") || typeof typedObj["data"] === "function") &&
+ (isHistoryStepType(typedObj["data"]["type"]) as boolean) &&
+ ((typedObj["data"]["plane_description"] !== null && typeof typedObj["data"]["plane_description"] === "object") ||
+ typeof typedObj["data"]["plane_description"] === "function") &&
+ typeof typedObj["data"]["plane_description"]["PlaneId"] === "string" &&
+ typeof typedObj["data"]["width"] === "number" &&
+ typeof typedObj["data"]["height"] === "number" &&
+ ((typedObj["data"]["sketch"] !== null && typeof typedObj["data"]["sketch"] === "object") || typeof typedObj["data"]["sketch"] === "function") &&
+ ((typedObj["data"]["sketch"]["points"] !== null && typeof typedObj["data"]["sketch"]["points"] === "object") ||
+ typeof typedObj["data"]["sketch"]["points"] === "function") &&
+ Object.entries(typedObj["data"]["sketch"]["points"]).every(([key, value]) => (isPoint2D(value) as boolean) && typeof key === "string") &&
+ typeof typedObj["data"]["sketch"]["highest_point_id"] === "number" &&
+ ((typedObj["data"]["sketch"]["line_segments"] !== null && typeof typedObj["data"]["sketch"]["line_segments"] === "object") ||
+ typeof typedObj["data"]["sketch"]["line_segments"] === "function") &&
+ Object.entries(typedObj["data"]["sketch"]["line_segments"]).every(([key, value]) => (isSegmentId(value) as boolean) && typeof key === "string") &&
+ typeof typedObj["data"]["sketch"]["highest_line_segment_id"] === "number" &&
+ ((typedObj["data"]["sketch"]["circles"] !== null && typeof typedObj["data"]["sketch"]["circles"] === "object") ||
+ typeof typedObj["data"]["sketch"]["circles"] === "function") &&
+ Object.entries(typedObj["data"]["sketch"]["circles"]).every(([key, value]) => (isCircle(value) as boolean) && typeof key === "string") &&
+ typeof typedObj["data"]["sketch"]["highest_circle_id"] === "number" &&
+ typeof typedObj["data"]["sketch"]["arcs"] === "object" &&
+ typeof typedObj["data"]["sketch"]["highest_arc_id"] === "number" &&
+ typeof typedObj["data"]["sketch"]["constraints"] === "object" &&
+ typeof typedObj["data"]["sketch"]["highest_constraint_id"] === "number"
+ )
}
export function isSegmentId(obj: unknown): obj is SegmentId {
- const typedObj = obj as SegmentId
- return (
- ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- typeof typedObj["start"] === "number" &&
- typeof typedObj["end"] === "number"
- )
+ const typedObj = obj as SegmentId
+ return (
+ ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
+ typeof typedObj["start"] === "number" &&
+ typeof typedObj["end"] === "number"
+ )
}
export function isCircle(obj: unknown): obj is Circle {
- const typedObj = obj as Circle
- return (
- ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- typeof typedObj["center"] === "number" &&
- typeof typedObj["radius"] === "number" &&
- typeof typedObj["top"] === "number"
- )
+ const typedObj = obj as Circle
+ return (
+ ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
+ typeof typedObj["center"] === "number" &&
+ typeof typedObj["radius"] === "number" &&
+ typeof typedObj["top"] === "number"
+ )
}
export function isTruckNurbsPoint(obj: unknown): obj is TruckNurbsPoint {
- const typedObj = obj as TruckNurbsPoint
- return (
- ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- typeof typedObj["x"] === "number" &&
- typeof typedObj["y"] === "number" &&
- typeof typedObj["z"] === "number" &&
- typeof typedObj["w"] === "number"
- )
+ const typedObj = obj as TruckNurbsPoint
+ return (
+ ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
+ typeof typedObj["x"] === "number" &&
+ typeof typedObj["y"] === "number" &&
+ typeof typedObj["z"] === "number" &&
+ typeof typedObj["w"] === "number"
+ )
}
export function isTruckNurbsSurfaceControlPoint(obj: unknown): obj is TruckNurbsSurfaceControlPoint {
- const typedObj = obj as TruckNurbsSurfaceControlPoint
- return (
- Array.isArray(typedObj) &&
- (isTruckNurbsPoint(typedObj[0]) as boolean) &&
- (isTruckNurbsPoint(typedObj[1]) as boolean)
- )
+ const typedObj = obj as TruckNurbsSurfaceControlPoint
+ return Array.isArray(typedObj) && (isTruckNurbsPoint(typedObj[0]) as boolean) && (isTruckNurbsPoint(typedObj[1]) as boolean)
}
export function isTruckNurbsSurfaceControlPoints(obj: unknown): obj is TruckNurbsSurfaceControlPoints {
- const typedObj = obj as TruckNurbsSurfaceControlPoints
- return Array.isArray(typedObj) && typedObj.every((e: any) => isTruckNurbsSurfaceControlPoint(e) as boolean)
+ const typedObj = obj as TruckNurbsSurfaceControlPoints
+ return Array.isArray(typedObj) && typedObj.every((e: any) => isTruckNurbsSurfaceControlPoint(e) as boolean)
}
export function isTruckNurbsSurface(obj: unknown): obj is TruckNurbsSurface {
- const typedObj = obj as TruckNurbsSurface
- return (
- ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- ((typedObj["NURBSSurface"] !== null && typeof typedObj["NURBSSurface"] === "object") ||
- typeof typedObj["NURBSSurface"] === "function") &&
- Array.isArray(typedObj["NURBSSurface"]["knot_vecs"]) &&
- typedObj["NURBSSurface"]["knot_vecs"].every(
- (e: any) => Array.isArray(e) && e.every((e: any) => typeof e === "number")
- ) &&
- (isTruckNurbsSurfaceControlPoints(typedObj["NURBSSurface"]["control_points"]) as boolean)
- )
+ const typedObj = obj as TruckNurbsSurface
+ return (
+ ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
+ ((typedObj["NURBSSurface"] !== null && typeof typedObj["NURBSSurface"] === "object") || typeof typedObj["NURBSSurface"] === "function") &&
+ Array.isArray(typedObj["NURBSSurface"]["knot_vecs"]) &&
+ typedObj["NURBSSurface"]["knot_vecs"].every((e: any) => Array.isArray(e) && e.every((e: any) => typeof e === "number")) &&
+ (isTruckNurbsSurfaceControlPoints(typedObj["NURBSSurface"]["control_points"]) as boolean)
+ )
}
export function isTruckPlane(obj: unknown): obj is TruckPlane {
- const typedObj = obj as TruckPlane
- return (
- ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- ((typedObj["Plane"] !== null && typeof typedObj["Plane"] === "object") ||
- typeof typedObj["Plane"] === "function") &&
- ((typedObj["Plane"]["o"] !== null && typeof typedObj["Plane"]["o"] === "object") ||
- typeof typedObj["Plane"]["o"] === "function") &&
- typeof typedObj["Plane"]["o"]["x"] === "number" &&
- typeof typedObj["Plane"]["o"]["y"] === "number" &&
- typeof typedObj["Plane"]["o"]["z"] === "number" &&
- ((typedObj["Plane"]["p"] !== null && typeof typedObj["Plane"]["p"] === "object") ||
- typeof typedObj["Plane"]["p"] === "function") &&
- typeof typedObj["Plane"]["p"]["x"] === "number" &&
- typeof typedObj["Plane"]["p"]["y"] === "number" &&
- typeof typedObj["Plane"]["p"]["z"] === "number" &&
- ((typedObj["Plane"]["q"] !== null && typeof typedObj["Plane"]["q"] === "object") ||
- typeof typedObj["Plane"]["q"] === "function") &&
- typeof typedObj["Plane"]["q"]["x"] === "number" &&
- typeof typedObj["Plane"]["q"]["y"] === "number" &&
- typeof typedObj["Plane"]["q"]["z"] === "number"
- )
+ const typedObj = obj as TruckPlane
+ return (
+ ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
+ ((typedObj["Plane"] !== null && typeof typedObj["Plane"] === "object") || typeof typedObj["Plane"] === "function") &&
+ ((typedObj["Plane"]["o"] !== null && typeof typedObj["Plane"]["o"] === "object") || typeof typedObj["Plane"]["o"] === "function") &&
+ typeof typedObj["Plane"]["o"]["x"] === "number" &&
+ typeof typedObj["Plane"]["o"]["y"] === "number" &&
+ typeof typedObj["Plane"]["o"]["z"] === "number" &&
+ ((typedObj["Plane"]["p"] !== null && typeof typedObj["Plane"]["p"] === "object") || typeof typedObj["Plane"]["p"] === "function") &&
+ typeof typedObj["Plane"]["p"]["x"] === "number" &&
+ typeof typedObj["Plane"]["p"]["y"] === "number" &&
+ typeof typedObj["Plane"]["p"]["z"] === "number" &&
+ ((typedObj["Plane"]["q"] !== null && typeof typedObj["Plane"]["q"] === "object") || typeof typedObj["Plane"]["q"] === "function") &&
+ typeof typedObj["Plane"]["q"]["x"] === "number" &&
+ typeof typedObj["Plane"]["q"]["y"] === "number" &&
+ typeof typedObj["Plane"]["q"]["z"] === "number"
+ )
}
export function isTruckSurface(obj: unknown): obj is TruckSurface {
- const typedObj = obj as TruckSurface
- return (isTruckNurbsSurface(typedObj) as boolean) || (isTruckPlane(typedObj) as boolean)
+ const typedObj = obj as TruckSurface
+ return (isTruckNurbsSurface(typedObj) as boolean) || (isTruckPlane(typedObj) as boolean)
}
export function isTruckFaceBoundary(obj: unknown): obj is TruckFaceBoundary {
- const typedObj = obj as TruckFaceBoundary
- return Array.isArray(typedObj) && typedObj.every((e: any) => isTruckFaceEdgeIndex(e) as boolean)
+ const typedObj = obj as TruckFaceBoundary
+ return Array.isArray(typedObj) && typedObj.every((e: any) => isTruckFaceEdgeIndex(e) as boolean)
}
export function isTruckFace(obj: unknown): obj is TruckFace {
- const typedObj = obj as TruckFace
- return (
- ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- Array.isArray(typedObj["boundaries"]) &&
- typedObj["boundaries"].every((e: any) => isTruckFaceBoundary(e) as boolean) &&
- typeof typedObj["orientation"] === "boolean" &&
- (isTruckSurface(typedObj["surface"]) as boolean)
- )
+ const typedObj = obj as TruckFace
+ return (
+ ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
+ Array.isArray(typedObj["boundaries"]) &&
+ typedObj["boundaries"].every((e: any) => isTruckFaceBoundary(e) as boolean) &&
+ typeof typedObj["orientation"] === "boolean" &&
+ (isTruckSurface(typedObj["surface"]) as boolean)
+ )
}
export function isTruckNurbsCurve(obj: unknown): obj is TruckNurbsCurve {
- const typedObj = obj as TruckNurbsCurve
- return (
- ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- ((typedObj["NURBSCurve"] !== null && typeof typedObj["NURBSCurve"] === "object") ||
- typeof typedObj["NURBSCurve"] === "function") &&
- Array.isArray(typedObj["NURBSCurve"]["knot_vec"]) &&
- typedObj["NURBSCurve"]["knot_vec"].every((e: any) => typeof e === "number") &&
- Array.isArray(typedObj["NURBSCurve"]["control_points"]) &&
- typedObj["NURBSCurve"]["control_points"].every((e: any) => isTruckNurbsPoint(e) as boolean)
- )
+ const typedObj = obj as TruckNurbsCurve
+ return (
+ ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
+ ((typedObj["NURBSCurve"] !== null && typeof typedObj["NURBSCurve"] === "object") || typeof typedObj["NURBSCurve"] === "function") &&
+ Array.isArray(typedObj["NURBSCurve"]["knot_vec"]) &&
+ typedObj["NURBSCurve"]["knot_vec"].every((e: any) => typeof e === "number") &&
+ Array.isArray(typedObj["NURBSCurve"]["control_points"]) &&
+ typedObj["NURBSCurve"]["control_points"].every((e: any) => isTruckNurbsPoint(e) as boolean)
+ )
}
export function isTruckEdgeEndpoints(obj: unknown): obj is TruckEdgeEndpoints {
- const typedObj = obj as TruckEdgeEndpoints
- return Array.isArray(typedObj) && typeof typedObj[0] === "number" && typeof typedObj[1] === "number"
+ const typedObj = obj as TruckEdgeEndpoints
+ return Array.isArray(typedObj) && typeof typedObj[0] === "number" && typeof typedObj[1] === "number"
}
export function isTruckEdge(obj: unknown): obj is TruckEdge {
- const typedObj = obj as TruckEdge
- return (
- ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- (isTruckEdgeEndpoints(typedObj["vertices"]) as boolean) &&
- (isTruckCurve(typedObj["curve"]) as boolean)
- )
+ const typedObj = obj as TruckEdge
+ return (
+ ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
+ (isTruckEdgeEndpoints(typedObj["vertices"]) as boolean) &&
+ (isTruckCurve(typedObj["curve"]) as boolean)
+ )
}
export function isTruckLineVectors(obj: unknown): obj is TruckLineVectors {
- const typedObj = obj as TruckLineVectors
- return (
- Array.isArray(typedObj) &&
- ((typedObj[0] !== null && typeof typedObj[0] === "object") || typeof typedObj[0] === "function") &&
- typeof typedObj[0]["x"] === "number" &&
- typeof typedObj[0]["y"] === "number" &&
- typeof typedObj[0]["z"] === "number" &&
- ((typedObj[1] !== null && typeof typedObj[1] === "object") || typeof typedObj[1] === "function") &&
- typeof typedObj[1]["x"] === "number" &&
- typeof typedObj[1]["y"] === "number" &&
- typeof typedObj[1]["z"] === "number"
- )
+ const typedObj = obj as TruckLineVectors
+ return (
+ Array.isArray(typedObj) &&
+ ((typedObj[0] !== null && typeof typedObj[0] === "object") || typeof typedObj[0] === "function") &&
+ typeof typedObj[0]["x"] === "number" &&
+ typeof typedObj[0]["y"] === "number" &&
+ typeof typedObj[0]["z"] === "number" &&
+ ((typedObj[1] !== null && typeof typedObj[1] === "object") || typeof typedObj[1] === "function") &&
+ typeof typedObj[1]["x"] === "number" &&
+ typeof typedObj[1]["y"] === "number" &&
+ typeof typedObj[1]["z"] === "number"
+ )
}
export function isTruckLine(obj: unknown): obj is TruckLine {
- const typedObj = obj as TruckLine
- return (
- ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- (isTruckLineVectors(typedObj["Line"]) as boolean)
- )
+ const typedObj = obj as TruckLine
+ return ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") && (isTruckLineVectors(typedObj["Line"]) as boolean)
}
export function isTruckCurve(obj: unknown): obj is TruckCurve {
- const typedObj = obj as TruckCurve
- return (isTruckNurbsCurve(typedObj) as boolean) || (isTruckLine(typedObj) as boolean)
+ const typedObj = obj as TruckCurve
+ return (isTruckNurbsCurve(typedObj) as boolean) || (isTruckLine(typedObj) as boolean)
}
export function isSketchTuple(obj: unknown): obj is SketchTuple {
- const typedObj = obj as SketchTuple
- return (
- Array.isArray(typedObj) &&
- (isSketchRealized(typedObj[0]) as boolean) &&
- (isSketchRealized(typedObj[1]) as boolean) &&
- typeof typedObj[2] === "string"
- )
+ const typedObj = obj as SketchTuple
+ return Array.isArray(typedObj) && (isSketchRealized(typedObj[0]) as boolean) && (isSketchRealized(typedObj[1]) as boolean) && typeof typedObj[2] === "string"
}
export function isRealization(obj: unknown): obj is Realization {
- const typedObj = obj as Realization
- return (
- ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- ((typedObj["planes"] !== null && typeof typedObj["planes"] === "object") ||
- typeof typedObj["planes"] === "function") &&
- Object.entries(typedObj["planes"]).every(
- ([key, value]) => (isPlaneRealized(value) as boolean) && typeof key === "string"
- ) &&
- ((typedObj["points"] !== null && typeof typedObj["points"] === "object") ||
- typeof typedObj["points"] === "function") &&
- Object.entries(typedObj["points"]).every(
- ([key, value]) => (isPoint3D(value) as boolean) && typeof key === "string"
- ) &&
- ((typedObj["sketches"] !== null && typeof typedObj["sketches"] === "object") ||
- typeof typedObj["sketches"] === "function") &&
- Object.entries(typedObj["sketches"]).every(
- ([key, value]) => (isSketchTuple(value) as boolean) && typeof key === "string"
- ) &&
- ((typedObj["solids"] !== null && typeof typedObj["solids"] === "object") ||
- typeof typedObj["solids"] === "function") &&
- Object.entries(typedObj["solids"]).every(
- ([key, value]) => (isSolidRealized(value) as boolean) && typeof key === "string"
- )
- )
+ const typedObj = obj as Realization
+ return (
+ ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
+ ((typedObj["planes"] !== null && typeof typedObj["planes"] === "object") || typeof typedObj["planes"] === "function") &&
+ Object.entries(typedObj["planes"]).every(([key, value]) => (isPlaneRealized(value) as boolean) && typeof key === "string") &&
+ ((typedObj["points"] !== null && typeof typedObj["points"] === "object") || typeof typedObj["points"] === "function") &&
+ Object.entries(typedObj["points"]).every(([key, value]) => (isPoint3D(value) as boolean) && typeof key === "string") &&
+ ((typedObj["sketches"] !== null && typeof typedObj["sketches"] === "object") || typeof typedObj["sketches"] === "function") &&
+ Object.entries(typedObj["sketches"]).every(([key, value]) => (isSketchTuple(value) as boolean) && typeof key === "string") &&
+ ((typedObj["solids"] !== null && typeof typedObj["solids"] === "object") || typeof typedObj["solids"] === "function") &&
+ Object.entries(typedObj["solids"]).every(([key, value]) => (isSolidRealized(value) as boolean) && typeof key === "string")
+ )
}
export function isPlaneRealized(obj: unknown): obj is PlaneRealized {
- const typedObj = obj as PlaneRealized
- return (
- ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- typeof typedObj["name"] === "string" &&
- typeof typedObj["width"] === "number" &&
- typeof typedObj["height"] === "number" &&
- (isPlane(typedObj["plane"]) as boolean)
- )
+ const typedObj = obj as PlaneRealized
+ return (
+ ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
+ typeof typedObj["name"] === "string" &&
+ typeof typedObj["width"] === "number" &&
+ typeof typedObj["height"] === "number" &&
+ (isPlane(typedObj["plane"]) as boolean)
+ )
}
export function isTruckFaceEdgeIndex(obj: unknown): obj is TruckFaceEdgeIndex {
- const typedObj = obj as TruckFaceEdgeIndex
- return (
- ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- typeof typedObj["index"] === "number" &&
- typeof typedObj["orientation"] === "boolean"
- )
+ const typedObj = obj as TruckFaceEdgeIndex
+ return (
+ ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
+ typeof typedObj["index"] === "number" &&
+ typeof typedObj["orientation"] === "boolean"
+ )
}
export function isTruckBoundary(obj: unknown): obj is TruckBoundary {
- const typedObj = obj as TruckBoundary
- return (
- ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- Array.isArray(typedObj["vertices"]) &&
- typedObj["vertices"].every(
- (e: any) =>
- ((e !== null && typeof e === "object") || typeof e === "function") &&
- typeof e["x"] === "number" &&
- typeof e["y"] === "number" &&
- typeof e["z"] === "number"
- ) &&
- Array.isArray(typedObj["edges"]) &&
- typedObj["edges"].every((e: any) => isTruckEdge(e) as boolean) &&
- Array.isArray(typedObj["faces"]) &&
- typedObj["faces"].every((e: any) => isTruckFace(e) as boolean)
- )
+ const typedObj = obj as TruckBoundary
+ return (
+ ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
+ Array.isArray(typedObj["vertices"]) &&
+ typedObj["vertices"].every(
+ (e: any) =>
+ ((e !== null && typeof e === "object") || typeof e === "function") &&
+ typeof e["x"] === "number" &&
+ typeof e["y"] === "number" &&
+ typeof e["z"] === "number",
+ ) &&
+ Array.isArray(typedObj["edges"]) &&
+ typedObj["edges"].every((e: any) => isTruckEdge(e) as boolean) &&
+ Array.isArray(typedObj["faces"]) &&
+ typedObj["faces"].every((e: any) => isTruckFace(e) as boolean)
+ )
}
export function isTruckSolid(obj: unknown): obj is TruckSolid {
- const typedObj = obj as TruckSolid
- return (
- ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- Array.isArray(typedObj["boundaries"]) &&
- typedObj["boundaries"].every((e: any) => isTruckBoundary(e) as boolean)
- )
+ const typedObj = obj as TruckSolid
+ return (
+ ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
+ Array.isArray(typedObj["boundaries"]) &&
+ typedObj["boundaries"].every((e: any) => isTruckBoundary(e) as boolean)
+ )
}
export function isSolidRealized(obj: unknown): obj is SolidRealized {
- const typedObj = obj as SolidRealized
- return (
- ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- typeof typedObj["name"] === "string" &&
- typeof typedObj["crc32"] === "string" &&
- Array.isArray(typedObj["vertices"]) &&
- typedObj["vertices"].every(
- (e: any) =>
- ((e !== null && typeof e === "object") || typeof e === "function") &&
- typeof e["x"] === "number" &&
- typeof e["y"] === "number" &&
- typeof e["z"] === "number"
- ) &&
- Array.isArray(typedObj["normals"]) &&
- typedObj["normals"].every(
- (e: any) =>
- ((e !== null && typeof e === "object") || typeof e === "function") &&
- typeof e["x"] === "number" &&
- typeof e["y"] === "number" &&
- typeof e["z"] === "number"
- ) &&
- Array.isArray(typedObj["uvs"]) &&
- typedObj["uvs"].every(
- (e: any) =>
- ((e !== null && typeof e === "object") || typeof e === "function") &&
- typeof e["x"] === "number" &&
- typeof e["y"] === "number" &&
- typeof e["z"] === "number"
- ) &&
- Array.isArray(typedObj["indices"]) &&
- typedObj["indices"].every((e: any) => typeof e === "number") &&
- Array.isArray(typedObj["triangles"]) &&
- (isTruckSolid(typedObj["truck_solid"]) as boolean)
- )
+ const typedObj = obj as SolidRealized
+ return (
+ ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
+ typeof typedObj["name"] === "string" &&
+ typeof typedObj["crc32"] === "string" &&
+ Array.isArray(typedObj["vertices"]) &&
+ typedObj["vertices"].every(
+ (e: any) =>
+ ((e !== null && typeof e === "object") || typeof e === "function") &&
+ typeof e["x"] === "number" &&
+ typeof e["y"] === "number" &&
+ typeof e["z"] === "number",
+ ) &&
+ Array.isArray(typedObj["normals"]) &&
+ typedObj["normals"].every(
+ (e: any) =>
+ ((e !== null && typeof e === "object") || typeof e === "function") &&
+ typeof e["x"] === "number" &&
+ typeof e["y"] === "number" &&
+ typeof e["z"] === "number",
+ ) &&
+ Array.isArray(typedObj["uvs"]) &&
+ typedObj["uvs"].every(
+ (e: any) =>
+ ((e !== null && typeof e === "object") || typeof e === "function") &&
+ typeof e["x"] === "number" &&
+ typeof e["y"] === "number" &&
+ typeof e["z"] === "number",
+ ) &&
+ Array.isArray(typedObj["indices"]) &&
+ typedObj["indices"].every((e: any) => typeof e === "number") &&
+ Array.isArray(typedObj["triangles"]) &&
+ (isTruckSolid(typedObj["truck_solid"]) as boolean)
+ )
}
export function isExtrusionSketchData(obj: unknown): obj is ExtrusionSketchData {
- const typedObj = obj as ExtrusionSketchData
- return (
- ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- typeof typedObj["sketch_id"] === "string" &&
- Array.isArray(typedObj["face_ids"]) &&
- typedObj["face_ids"].every((e: any) => typeof e === "string") &&
- typeof typedObj["length"] === "string" &&
- typeof typedObj["offset"] === "number" &&
- typeof typedObj["direction"] === "string" &&
- typeof typedObj["mode"] === "string"
- )
+ const typedObj = obj as ExtrusionSketchData
+ return (
+ ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
+ typeof typedObj["sketch_id"] === "string" &&
+ Array.isArray(typedObj["face_ids"]) &&
+ typedObj["face_ids"].every((e: any) => typeof e === "string") &&
+ typeof typedObj["length"] === "string" &&
+ typeof typedObj["offset"] === "number" &&
+ typeof typedObj["direction"] === "string" &&
+ typeof typedObj["mode"] === "string"
+ )
}
export function isUpdateExtrusion(obj: unknown): obj is UpdateExtrusion {
- const typedObj = obj as UpdateExtrusion
- return (
- ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- typeof typedObj["workbench_id"] === "number" &&
- typeof typedObj["sketch_id"] === "string" &&
- Array.isArray(typedObj["face_ids"]) &&
- typedObj["face_ids"].every((e: any) => typeof e === "number") &&
- typeof typedObj["length"] === "number" &&
- typeof typedObj["offset"] === "number" &&
- typeof typedObj["extrusion_name"] === "string" &&
- typeof typedObj["direction"] === "string" &&
- typeof typedObj["extrusion_id"] === "string"
- )
+ const typedObj = obj as UpdateExtrusion
+ return (
+ ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
+ typeof typedObj["workbench_id"] === "number" &&
+ typeof typedObj["sketch_id"] === "string" &&
+ Array.isArray(typedObj["face_ids"]) &&
+ typedObj["face_ids"].every((e: any) => typeof e === "number") &&
+ typeof typedObj["length"] === "number" &&
+ typeof typedObj["offset"] === "number" &&
+ typeof typedObj["extrusion_name"] === "string" &&
+ typeof typedObj["direction"] === "string" &&
+ typeof typedObj["extrusion_id"] === "string"
+ )
}
export function isSetSketchPlane(obj: unknown): obj is SetSketchPlane {
- const typedObj = obj as SetSketchPlane
- return (
- ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- typeof typedObj["workbench_id"] === "number" &&
- typeof typedObj["sketch_id"] === "string" &&
- typeof typedObj["plane_id"] === "string"
- )
+ const typedObj = obj as SetSketchPlane
+ return (
+ ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
+ typeof typedObj["workbench_id"] === "number" &&
+ typeof typedObj["sketch_id"] === "string" &&
+ typeof typedObj["plane_id"] === "string"
+ )
}
export function isNewSketchOnPlane(obj: unknown): obj is NewSketchOnPlane {
- const typedObj = obj as NewSketchOnPlane
- return (
- ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- typeof typedObj["workbench_id"] === "number" &&
- typeof typedObj["plane_id"] === "string" &&
- typeof typedObj["sketch_name"] === "string"
- )
+ const typedObj = obj as NewSketchOnPlane
+ return (
+ ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
+ typeof typedObj["workbench_id"] === "number" &&
+ typeof typedObj["plane_id"] === "string" &&
+ typeof typedObj["sketch_name"] === "string"
+ )
}
export function isNewExtrusion(obj: unknown): obj is NewExtrusion {
- const typedObj = obj as NewExtrusion
- return (
- ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- typeof typedObj["workbench_id"] === "number" &&
- typeof typedObj["sketch_id"] === "string" &&
- Array.isArray(typedObj["face_ids"]) &&
- typedObj["face_ids"].every((e: any) => typeof e === "number") &&
- typeof typedObj["length"] === "number" &&
- typeof typedObj["offset"] === "number" &&
- typeof typedObj["extrusion_name"] === "string" &&
- typeof typedObj["direction"] === "string"
- )
+ const typedObj = obj as NewExtrusion
+ return (
+ ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
+ typeof typedObj["workbench_id"] === "number" &&
+ typeof typedObj["sketch_id"] === "string" &&
+ Array.isArray(typedObj["face_ids"]) &&
+ typedObj["face_ids"].every((e: any) => typeof e === "number") &&
+ typeof typedObj["length"] === "number" &&
+ typeof typedObj["offset"] === "number" &&
+ typeof typedObj["extrusion_name"] === "string" &&
+ typeof typedObj["direction"] === "string"
+ )
}
export function isDeleteLines(obj: unknown): obj is DeleteLines {
- const typedObj = obj as DeleteLines
- return (
- ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- typeof typedObj["workbench_id"] === "number" &&
- typeof typedObj["sketch_id"] === "string" &&
- Array.isArray(typedObj["line_ids"]) &&
- typedObj["line_ids"].every((e: any) => typeof e === "number")
- )
+ const typedObj = obj as DeleteLines
+ return (
+ ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
+ typeof typedObj["workbench_id"] === "number" &&
+ typeof typedObj["sketch_id"] === "string" &&
+ Array.isArray(typedObj["line_ids"]) &&
+ typedObj["line_ids"].every((e: any) => typeof e === "number")
+ )
}
export function isDeleteArcs(obj: unknown): obj is DeleteArcs {
- const typedObj = obj as DeleteArcs
- return (
- ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- typeof typedObj["workbench_id"] === "number" &&
- typeof typedObj["sketch_id"] === "string" &&
- Array.isArray(typedObj["arc_ids"]) &&
- typedObj["arc_ids"].every((e: any) => typeof e === "number")
- )
+ const typedObj = obj as DeleteArcs
+ return (
+ ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
+ typeof typedObj["workbench_id"] === "number" &&
+ typeof typedObj["sketch_id"] === "string" &&
+ Array.isArray(typedObj["arc_ids"]) &&
+ typedObj["arc_ids"].every((e: any) => typeof e === "number")
+ )
}
export function isDeleteCircles(obj: unknown): obj is DeleteCircles {
- const typedObj = obj as DeleteCircles
- return (
- ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- typeof typedObj["workbench_id"] === "number" &&
- typeof typedObj["sketch_id"] === "string" &&
- Array.isArray(typedObj["circle_ids"]) &&
- typedObj["circle_ids"].every((e: any) => typeof e === "number")
- )
+ const typedObj = obj as DeleteCircles
+ return (
+ ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
+ typeof typedObj["workbench_id"] === "number" &&
+ typeof typedObj["sketch_id"] === "string" &&
+ Array.isArray(typedObj["circle_ids"]) &&
+ typedObj["circle_ids"].every((e: any) => typeof e === "number")
+ )
}
export function isNewRectangleBetweenPoints(obj: unknown): obj is NewRectangleBetweenPoints {
- const typedObj = obj as NewRectangleBetweenPoints
- return (
- ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- typeof typedObj["workbench_id"] === "number" &&
- typeof typedObj["sketch_id"] === "string" &&
- typeof typedObj["start_id"] === "number" &&
- typeof typedObj["end_id"] === "number"
- )
+ const typedObj = obj as NewRectangleBetweenPoints
+ return (
+ ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
+ typeof typedObj["workbench_id"] === "number" &&
+ typeof typedObj["sketch_id"] === "string" &&
+ typeof typedObj["start_id"] === "number" &&
+ typeof typedObj["end_id"] === "number"
+ )
}
export function isNewCircleBetweenPoints(obj: unknown): obj is NewCircleBetweenPoints {
- const typedObj = obj as NewCircleBetweenPoints
- return (
- ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- typeof typedObj["workbench_id"] === "number" &&
- typeof typedObj["sketch_id"] === "string" &&
- typeof typedObj["center_id"] === "number" &&
- typeof typedObj["edge_id"] === "number"
- )
+ const typedObj = obj as NewCircleBetweenPoints
+ return (
+ ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
+ typeof typedObj["workbench_id"] === "number" &&
+ typeof typedObj["sketch_id"] === "string" &&
+ typeof typedObj["center_id"] === "number" &&
+ typeof typedObj["edge_id"] === "number"
+ )
}
export function isNewLineOnSketch(obj: unknown): obj is NewLineOnSketch {
- const typedObj = obj as NewLineOnSketch
- return (
- ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- typeof typedObj["workbench_id"] === "number" &&
- typeof typedObj["sketch_id"] === "string" &&
- typeof typedObj["start_point_id"] === "number" &&
- typeof typedObj["end_point_id"] === "number"
- )
+ const typedObj = obj as NewLineOnSketch
+ return (
+ ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
+ typeof typedObj["workbench_id"] === "number" &&
+ typeof typedObj["sketch_id"] === "string" &&
+ typeof typedObj["start_point_id"] === "number" &&
+ typeof typedObj["end_point_id"] === "number"
+ )
}
export function isNewPointOnSketch2(obj: unknown): obj is NewPointOnSketch2 {
- const typedObj = obj as NewPointOnSketch2
- return (
- ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- typeof typedObj["workbench_id"] === "number" &&
- typeof typedObj["sketch_id"] === "string" &&
- typeof typedObj["x"] === "number" &&
- typeof typedObj["y"] === "number" &&
- typeof typedObj["hidden"] === "boolean"
- )
+ const typedObj = obj as NewPointOnSketch2
+ return (
+ ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
+ typeof typedObj["workbench_id"] === "number" &&
+ typeof typedObj["sketch_id"] === "string" &&
+ typeof typedObj["x"] === "number" &&
+ typeof typedObj["y"] === "number" &&
+ typeof typedObj["hidden"] === "boolean"
+ )
}
export function isRenameStep(obj: unknown): obj is RenameStep {
- const typedObj = obj as RenameStep
- return (
- ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- typeof typedObj["workbench_id"] === "number" &&
- typeof typedObj["step_id"] === "number" &&
- typeof typedObj["new_name"] === "string"
- )
+ const typedObj = obj as RenameStep
+ return (
+ ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
+ typeof typedObj["workbench_id"] === "number" &&
+ typeof typedObj["step_id"] === "number" &&
+ typeof typedObj["new_name"] === "string"
+ )
}
export function isRenameWorkbench(obj: unknown): obj is RenameWorkbench {
- const typedObj = obj as RenameWorkbench
- return (
- ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- typeof typedObj["workbench_id"] === "number" &&
- typeof typedObj["new_name"] === "string"
- )
+ const typedObj = obj as RenameWorkbench
+ return (
+ ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
+ typeof typedObj["workbench_id"] === "number" &&
+ typeof typedObj["new_name"] === "string"
+ )
}
export function isRenameProject(obj: unknown): obj is RenameProject {
- const typedObj = obj as RenameProject
- return (
- ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- typeof typedObj["new_name"] === "string"
- )
+ const typedObj = obj as RenameProject
+ return ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") && typeof typedObj["new_name"] === "string"
}
export function isMessage(obj: unknown): obj is Message {
- const typedObj = obj as Message
- return (
- (((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- (isUpdateExtrusion(typedObj["UpdateExtrusion"]) as boolean)) ||
- (((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- (isSetSketchPlane(typedObj["SetSketchPlane"]) as boolean)) ||
- (((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- (isNewSketchOnPlane(typedObj["NewSketchOnPlane"]) as boolean)) ||
- (((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- (isNewExtrusion(typedObj["NewExtrusion"]) as boolean)) ||
- (((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- (isDeleteLines(typedObj["DeleteLines"]) as boolean)) ||
- (((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- (isDeleteArcs(typedObj["DeleteArcs"]) as boolean)) ||
- (((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- (isDeleteCircles(typedObj["DeleteCircles"]) as boolean)) ||
- (((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- (isNewRectangleBetweenPoints(typedObj["NewRectangleBetweenPoints"]) as boolean)) ||
- (((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- (isNewCircleBetweenPoints(typedObj["NewCircleBetweenPoints"]) as boolean)) ||
- (((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- (isNewLineOnSketch(typedObj["NewLineOnSketch"]) as boolean)) ||
- (((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- (isNewPointOnSketch2(typedObj["NewPointOnSketch2"]) as boolean)) ||
- (((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- (isRenameStep(typedObj["RenameStep"]) as boolean)) ||
- (((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- (isRenameWorkbench(typedObj["RenameWorkbench"]) as boolean)) ||
- (((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- (isRenameProject(typedObj["RenameProject"]) as boolean))
- )
+ const typedObj = obj as Message
+ return (
+ (((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") && (isUpdateExtrusion(typedObj["UpdateExtrusion"]) as boolean)) ||
+ (((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") && (isSetSketchPlane(typedObj["SetSketchPlane"]) as boolean)) ||
+ (((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
+ (isNewSketchOnPlane(typedObj["NewSketchOnPlane"]) as boolean)) ||
+ (((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") && (isNewExtrusion(typedObj["NewExtrusion"]) as boolean)) ||
+ (((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") && (isDeleteLines(typedObj["DeleteLines"]) as boolean)) ||
+ (((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") && (isDeleteArcs(typedObj["DeleteArcs"]) as boolean)) ||
+ (((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") && (isDeleteCircles(typedObj["DeleteCircles"]) as boolean)) ||
+ (((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
+ (isNewRectangleBetweenPoints(typedObj["NewRectangleBetweenPoints"]) as boolean)) ||
+ (((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
+ (isNewCircleBetweenPoints(typedObj["NewCircleBetweenPoints"]) as boolean)) ||
+ (((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") && (isNewLineOnSketch(typedObj["NewLineOnSketch"]) as boolean)) ||
+ (((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
+ (isNewPointOnSketch2(typedObj["NewPointOnSketch2"]) as boolean)) ||
+ (((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") && (isRenameStep(typedObj["RenameStep"]) as boolean)) ||
+ (((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") && (isRenameWorkbench(typedObj["RenameWorkbench"]) as boolean)) ||
+ (((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") && (isRenameProject(typedObj["RenameProject"]) as boolean))
+ )
}
export function isMessageHistory(obj: unknown): obj is MessageHistory {
- const typedObj = obj as MessageHistory
- return (
- ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") &&
- (isMessage(typedObj["message"]) as boolean)
- )
+ const typedObj = obj as MessageHistory
+ return ((typedObj !== null && typeof typedObj === "object") || typeof typedObj === "function") && (isMessage(typedObj["message"]) as boolean)
}
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index e9c29a46..2e9afe7e 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -63,6 +63,9 @@ importers:
'@playwright/test':
specifier: ^1.44.1
version: 1.44.1
+ '@repo/config-typescript':
+ specifier: workspace:*
+ version: link:../../packages/config-typescript
'@sveltejs/vite-plugin-svelte':
specifier: ^3.1.0
version: 3.1.0(svelte@5.0.0-next.141)(vite@5.2.11)
@@ -73,14 +76,14 @@ importers:
specifier: ^10.4.19
version: 10.4.19(postcss@8.4.38)
eslint:
- specifier: ^8.57.0
- version: 8.57.0
+ specifier: ^9.3.0
+ version: 9.3.0
eslint-config-prettier:
specifier: ^9.1.0
- version: 9.1.0(eslint@8.57.0)
+ version: 9.1.0(eslint@9.3.0)
eslint-plugin-svelte:
- specifier: ^2.35.1
- version: 2.39.0(eslint@8.57.0)(svelte@5.0.0-next.141)
+ specifier: ^2.39.0
+ version: 2.39.0(eslint@9.3.0)(svelte@5.0.0-next.141)
phosphor-svelte:
specifier: ^1.4.2
version: 1.4.2(svelte@5.0.0-next.141)
@@ -127,6 +130,26 @@ importers:
specifier: ^7.1.0
version: 7.1.0
+ packages/config-eslint:
+ dependencies:
+ '@typescript-eslint/eslint-plugin':
+ specifier: ^7.1.0
+ version: 7.10.0(@typescript-eslint/parser@7.10.0(eslint@9.3.0)(typescript@5.4.5))(eslint@9.3.0)(typescript@5.4.5)
+ '@typescript-eslint/parser':
+ specifier: ^7.1.0
+ version: 7.10.0(eslint@9.3.0)(typescript@5.4.5)
+ eslint-config-prettier:
+ specifier: ^9.1.0
+ version: 9.1.0(eslint@9.3.0)
+ devDependencies:
+ '@repo/config-prettier':
+ specifier: workspace:*
+ version: link:../config-prettier
+
+ packages/config-prettier: {}
+
+ packages/config-typescript: {}
+
packages/shared:
dependencies:
cadmium:
@@ -303,19 +326,19 @@ packages:
resolution: {integrity: sha512-Cu96Sd2By9mCNTx2iyKOmq10v22jUVQv0lQnlGNy16oE9589yE+QADPbrMGCkA51cKZSg3Pu/aTJVTGfL/qjUA==}
engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0}
- '@eslint/eslintrc@2.1.4':
- resolution: {integrity: sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==}
- engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
+ '@eslint/eslintrc@3.1.0':
+ resolution: {integrity: sha512-4Bfj15dVJdoy3RfZmmo86RK1Fwzn6SstsvK9JS+BaVKqC6QQQQyXekNaC+g+LKNgkQ+2VhGAzm6hO40AhMR3zQ==}
+ engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
- '@eslint/js@8.57.0':
- resolution: {integrity: sha512-Ys+3g2TaW7gADOJzPt83SJtCDhMjndcDMFVQ/Tj9iA1BfJzFKD9mAUXT3OenpuPHbI6P/myECxRJrofUsDx/5g==}
- engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
+ '@eslint/js@9.3.0':
+ resolution: {integrity: sha512-niBqk8iwv96+yuTwjM6bWg8ovzAPF9qkICsGtcoa5/dmqcEMfdwNAX7+/OHcJHc7wj7XqPxH98oAHytFYlw6Sw==}
+ engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
'@fontsource-variable/manrope@5.0.20':
resolution: {integrity: sha512-LKL0aM0DxYj8i/zUTb5Nru0mS3YoezPZaeWY7aIxEKVX1xVBLpPHlFq0NoK2iUXhL6HoD0XMYwc6KVa8I/ayKg==}
- '@humanwhocodes/config-array@0.11.14':
- resolution: {integrity: sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg==}
+ '@humanwhocodes/config-array@0.13.0':
+ resolution: {integrity: sha512-DZLEEqFWQFiyK6h5YIeynKx7JlvCYWL0cImfSRXZ9l4Sg2efkFGTuFf6vzXjK1cq6IYkU+Eg/JizXw+TD2vRNw==}
engines: {node: '>=10.10.0'}
'@humanwhocodes/module-importer@1.0.1':
@@ -325,6 +348,10 @@ packages:
'@humanwhocodes/object-schema@2.0.3':
resolution: {integrity: sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==}
+ '@humanwhocodes/retry@0.3.0':
+ resolution: {integrity: sha512-d2CGZR2o7fS6sWB7DG/3a95bGKQyHMACZ5aW8qGkkqQpUoZV6C0X7Pc7l4ZNMZkfNBf4VWNe9E1jRsf0G146Ew==}
+ engines: {node: '>=18.18'}
+
'@isaacs/cliui@8.0.2':
resolution: {integrity: sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==}
engines: {node: '>=12'}
@@ -601,8 +628,63 @@ packages:
'@types/webxr@0.5.16':
resolution: {integrity: sha512-0E0Cl84FECtzrB4qG19TNTqpunw0F1YF0QZZnFMF6pDw1kNKJtrlTKlVB34stGIsHbZsYQ7H0tNjPfZftkHHoA==}
- '@ungap/structured-clone@1.2.0':
- resolution: {integrity: sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==}
+ '@typescript-eslint/eslint-plugin@7.10.0':
+ resolution: {integrity: sha512-PzCr+a/KAef5ZawX7nbyNwBDtM1HdLIT53aSA2DDlxmxMngZ43O8SIePOeX8H5S+FHXeI6t97mTt/dDdzY4Fyw==}
+ engines: {node: ^18.18.0 || >=20.0.0}
+ peerDependencies:
+ '@typescript-eslint/parser': ^7.0.0
+ eslint: ^8.56.0
+ typescript: '*'
+ peerDependenciesMeta:
+ typescript:
+ optional: true
+
+ '@typescript-eslint/parser@7.10.0':
+ resolution: {integrity: sha512-2EjZMA0LUW5V5tGQiaa2Gys+nKdfrn2xiTIBLR4fxmPmVSvgPcKNW+AE/ln9k0A4zDUti0J/GZXMDupQoI+e1w==}
+ engines: {node: ^18.18.0 || >=20.0.0}
+ peerDependencies:
+ eslint: ^8.56.0
+ typescript: '*'
+ peerDependenciesMeta:
+ typescript:
+ optional: true
+
+ '@typescript-eslint/scope-manager@7.10.0':
+ resolution: {integrity: sha512-7L01/K8W/VGl7noe2mgH0K7BE29Sq6KAbVmxurj8GGaPDZXPr8EEQ2seOeAS+mEV9DnzxBQB6ax6qQQ5C6P4xg==}
+ engines: {node: ^18.18.0 || >=20.0.0}
+
+ '@typescript-eslint/type-utils@7.10.0':
+ resolution: {integrity: sha512-D7tS4WDkJWrVkuzgm90qYw9RdgBcrWmbbRkrLA4d7Pg3w0ttVGDsvYGV19SH8gPR5L7OtcN5J1hTtyenO9xE9g==}
+ engines: {node: ^18.18.0 || >=20.0.0}
+ peerDependencies:
+ eslint: ^8.56.0
+ typescript: '*'
+ peerDependenciesMeta:
+ typescript:
+ optional: true
+
+ '@typescript-eslint/types@7.10.0':
+ resolution: {integrity: sha512-7fNj+Ya35aNyhuqrA1E/VayQX9Elwr8NKZ4WueClR3KwJ7Xx9jcCdOrLW04h51de/+gNbyFMs+IDxh5xIwfbNg==}
+ engines: {node: ^18.18.0 || >=20.0.0}
+
+ '@typescript-eslint/typescript-estree@7.10.0':
+ resolution: {integrity: sha512-LXFnQJjL9XIcxeVfqmNj60YhatpRLt6UhdlFwAkjNc6jSUlK8zQOl1oktAP8PlWFzPQC1jny/8Bai3/HPuvN5g==}
+ engines: {node: ^18.18.0 || >=20.0.0}
+ peerDependencies:
+ typescript: '*'
+ peerDependenciesMeta:
+ typescript:
+ optional: true
+
+ '@typescript-eslint/utils@7.10.0':
+ resolution: {integrity: sha512-olzif1Fuo8R8m/qKkzJqT7qwy16CzPRWBvERS0uvyc+DHd8AKbO4Jb7kpAvVzMmZm8TrHnI7hvjN4I05zow+tg==}
+ engines: {node: ^18.18.0 || >=20.0.0}
+ peerDependencies:
+ eslint: ^8.56.0
+
+ '@typescript-eslint/visitor-keys@7.10.0':
+ resolution: {integrity: sha512-9ntIVgsi6gg6FIq9xjEO4VQJvwOqA3jaBFQJ/6TK5AvEup2+cECI6Fh7QiBxmfMHXU0V0J4RyPeOU1VDNzl9cg==}
+ engines: {node: ^18.18.0 || >=20.0.0}
'@vitest/expect@1.6.0':
resolution: {integrity: sha512-ixEvFVQjycy/oNgHjqsL6AZCDduC+tflRluaHIzKIsdbzkLn2U/iBnVeJwB6HsIjQBdfMR8Z0tRxKUsvFJEeWQ==}
@@ -692,6 +774,10 @@ packages:
resolution: {integrity: sha512-NbdMezxqf94cnNfWLL7V/im0Ub+Anbb0IoZhvzie8+4HJ4nMQuzHuy49FkGYCJK2yAloZ3meiB6AVMClbrI1vg==}
engines: {node: '>=8'}
+ array-union@2.1.0:
+ resolution: {integrity: sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==}
+ engines: {node: '>=8'}
+
assertion-error@1.1.0:
resolution: {integrity: sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==}
@@ -869,13 +955,13 @@ packages:
resolution: {integrity: sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q==}
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
+ dir-glob@3.0.1:
+ resolution: {integrity: sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==}
+ engines: {node: '>=8'}
+
dlv@1.1.3:
resolution: {integrity: sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA==}
- doctrine@3.0.0:
- resolution: {integrity: sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==}
- engines: {node: '>=6.0.0'}
-
earcut@2.2.4:
resolution: {integrity: sha512-/pjZsA1b4RPHbeWZQn66SWS8nZZWLQQ23oE3Eam7aroEFGEvwKAsJfZ9ytiEMycfzXWpca4FA9QIOehf7PocBQ==}
@@ -937,18 +1023,30 @@ packages:
resolution: {integrity: sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
+ eslint-scope@8.0.1:
+ resolution: {integrity: sha512-pL8XjgP4ZOmmwfFE8mEhSxA7ZY4C+LWyqjQ3o4yWkkmD0qcMT9kkW3zWHOczhWcjTSgqycYAgwSlXvZltv65og==}
+ engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
+
eslint-visitor-keys@3.4.3:
resolution: {integrity: sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
- eslint@8.57.0:
- resolution: {integrity: sha512-dZ6+mexnaTIbSBZWgou51U6OmzIhYM2VcNdtiTtI7qPNZm35Akpr0f6vtw3w1Kmn5PYo+tZVfh13WrhpS6oLqQ==}
- engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
+ eslint-visitor-keys@4.0.0:
+ resolution: {integrity: sha512-OtIRv/2GyiF6o/d8K7MYKKbXrOUBIK6SfkIRM4Z0dY3w+LiQ0vy3F57m0Z71bjbyeiWFiHJ8brqnmE6H6/jEuw==}
+ engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
+
+ eslint@9.3.0:
+ resolution: {integrity: sha512-5Iv4CsZW030lpUqHBapdPo3MJetAPtejVW8B84GIcIIv8+ohFaddXsrn1Gn8uD9ijDb+kcYKFUVmC8qG8B2ORQ==}
+ engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
hasBin: true
esm-env@1.0.0:
resolution: {integrity: sha512-Cf6VksWPsTuW01vU9Mk/3vRue91Zevka5SjyNf3nEpokFRuqt/KjUQoGAwq9qMmhpLTHmXzSIrFRw8zxWzmFBA==}
+ espree@10.0.1:
+ resolution: {integrity: sha512-MWkrWZbJsL2UwnjxTX3gG8FneachS/Mwg7tdGXce011sJd5b0JG54vat5KHnfSBODZ3Wvzd2WnjxyzsRoVv+ww==}
+ engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
+
espree@9.6.1:
resolution: {integrity: sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
@@ -998,9 +1096,9 @@ packages:
fflate@0.8.2:
resolution: {integrity: sha512-cPJU47OaAoCbg0pBvzsgpTPhmhqI5eJjh/JIu8tPj5q+T7iLvW/JAYUqmE7KOB4R1ZyEhzBaIQpQpardBF5z8A==}
- file-entry-cache@6.0.1:
- resolution: {integrity: sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==}
- engines: {node: ^10.12.0 || >=12.0.0}
+ file-entry-cache@8.0.0:
+ resolution: {integrity: sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==}
+ engines: {node: '>=16.0.0'}
fill-range@7.1.1:
resolution: {integrity: sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==}
@@ -1014,9 +1112,9 @@ packages:
resolution: {integrity: sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==}
engines: {node: '>=10'}
- flat-cache@3.2.0:
- resolution: {integrity: sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw==}
- engines: {node: ^10.12.0 || >=12.0.0}
+ flat-cache@4.0.1:
+ resolution: {integrity: sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==}
+ engines: {node: '>=16'}
flatted@3.3.1:
resolution: {integrity: sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==}
@@ -1068,9 +1166,13 @@ packages:
resolution: {integrity: sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==}
deprecated: Glob versions prior to v9 are no longer supported
- globals@13.24.0:
- resolution: {integrity: sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==}
- engines: {node: '>=8'}
+ globals@14.0.0:
+ resolution: {integrity: sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==}
+ engines: {node: '>=18'}
+
+ globby@11.1.0:
+ resolution: {integrity: sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==}
+ engines: {node: '>=10'}
graceful-fs@4.2.11:
resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==}
@@ -1397,6 +1499,10 @@ packages:
resolution: {integrity: sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==}
engines: {node: '>=16 || 14 >=14.18'}
+ path-type@4.0.0:
+ resolution: {integrity: sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==}
+ engines: {node: '>=8'}
+
pathe@1.1.2:
resolution: {integrity: sha512-whLdWMYL2TwI08hn8/ZqAbrVemu0LNaNNJZX73O6qaIdCTfXutsLhMkjdENX0qhsQ9uIimo4/aQOmXkoon2nDQ==}
@@ -1580,11 +1686,6 @@ packages:
deprecated: Rimraf versions prior to v4 are no longer supported
hasBin: true
- rimraf@3.0.2:
- resolution: {integrity: sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==}
- deprecated: Rimraf versions prior to v4 are no longer supported
- hasBin: true
-
rimraf@5.0.7:
resolution: {integrity: sha512-nV6YcJo5wbLW77m+8KjH8aB/7/rxQy9SZ0HY5shnwULfS+9nmTtVXAJET5NdZmCzA4fPI/Hm1wo/Po/4mopOdg==}
engines: {node: '>=14.18'}
@@ -1625,6 +1726,10 @@ packages:
resolution: {integrity: sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==}
engines: {node: '>=14'}
+ slash@3.0.0:
+ resolution: {integrity: sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==}
+ engines: {node: '>=8'}
+
sorcery@0.11.0:
resolution: {integrity: sha512-J69LQ22xrQB1cIFJhPfgtLuI6BpWRiWu1Y3vSsIwK/eAScqJxd/+CJlUuHQRdX2C9NGFamq+KqNywGgaThwfHw==}
hasBin: true
@@ -1846,6 +1951,12 @@ packages:
troika-worker-utils@0.49.0:
resolution: {integrity: sha512-1xZHoJrG0HFfCvT/iyN41DvI/nRykiBtHqFkGaGgJwq5iXfIZFBiPPEHFpPpgyKM3Oo5ITHXP5wM2TNQszYdVg==}
+ ts-api-utils@1.3.0:
+ resolution: {integrity: sha512-UQMIo7pb8WRomKR1/+MFVLTroIvDVtMX3K6OUir8ynLyzB8Jeriont2bTAtmNPa1ekAgN7YPDyf6V+ygrdU+eQ==}
+ engines: {node: '>=16'}
+ peerDependencies:
+ typescript: '>=4.2.0'
+
ts-auto-guard@4.2.0:
resolution: {integrity: sha512-4Lf8JLBuOU6aHbhQ9QnCOphoKCkD0tP+V5tF6HkdQS/YGxYzhGEOrp5ODiyPidXZPnrSZUGdMYMAYKD8tjp1Dw==}
hasBin: true
@@ -1904,10 +2015,6 @@ packages:
resolution: {integrity: sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==}
engines: {node: '>=4'}
- type-fest@0.20.2:
- resolution: {integrity: sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==}
- engines: {node: '>=10'}
-
typescript@5.4.5:
resolution: {integrity: sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==}
engines: {node: '>=14.17'}
@@ -2150,19 +2257,19 @@ snapshots:
'@esbuild/win32-x64@0.20.2':
optional: true
- '@eslint-community/eslint-utils@4.4.0(eslint@8.57.0)':
+ '@eslint-community/eslint-utils@4.4.0(eslint@9.3.0)':
dependencies:
- eslint: 8.57.0
+ eslint: 9.3.0
eslint-visitor-keys: 3.4.3
'@eslint-community/regexpp@4.10.0': {}
- '@eslint/eslintrc@2.1.4':
+ '@eslint/eslintrc@3.1.0':
dependencies:
ajv: 6.12.6
debug: 4.3.4
- espree: 9.6.1
- globals: 13.24.0
+ espree: 10.0.1
+ globals: 14.0.0
ignore: 5.3.1
import-fresh: 3.3.0
js-yaml: 4.1.0
@@ -2171,11 +2278,11 @@ snapshots:
transitivePeerDependencies:
- supports-color
- '@eslint/js@8.57.0': {}
+ '@eslint/js@9.3.0': {}
'@fontsource-variable/manrope@5.0.20': {}
- '@humanwhocodes/config-array@0.11.14':
+ '@humanwhocodes/config-array@0.13.0':
dependencies:
'@humanwhocodes/object-schema': 2.0.3
debug: 4.3.4
@@ -2187,6 +2294,8 @@ snapshots:
'@humanwhocodes/object-schema@2.0.3': {}
+ '@humanwhocodes/retry@0.3.0': {}
+
'@isaacs/cliui@8.0.2':
dependencies:
string-width: 5.1.2
@@ -2424,7 +2533,86 @@ snapshots:
'@types/webxr@0.5.16': {}
- '@ungap/structured-clone@1.2.0': {}
+ '@typescript-eslint/eslint-plugin@7.10.0(@typescript-eslint/parser@7.10.0(eslint@9.3.0)(typescript@5.4.5))(eslint@9.3.0)(typescript@5.4.5)':
+ dependencies:
+ '@eslint-community/regexpp': 4.10.0
+ '@typescript-eslint/parser': 7.10.0(eslint@9.3.0)(typescript@5.4.5)
+ '@typescript-eslint/scope-manager': 7.10.0
+ '@typescript-eslint/type-utils': 7.10.0(eslint@9.3.0)(typescript@5.4.5)
+ '@typescript-eslint/utils': 7.10.0(eslint@9.3.0)(typescript@5.4.5)
+ '@typescript-eslint/visitor-keys': 7.10.0
+ eslint: 9.3.0
+ graphemer: 1.4.0
+ ignore: 5.3.1
+ natural-compare: 1.4.0
+ ts-api-utils: 1.3.0(typescript@5.4.5)
+ optionalDependencies:
+ typescript: 5.4.5
+ transitivePeerDependencies:
+ - supports-color
+
+ '@typescript-eslint/parser@7.10.0(eslint@9.3.0)(typescript@5.4.5)':
+ dependencies:
+ '@typescript-eslint/scope-manager': 7.10.0
+ '@typescript-eslint/types': 7.10.0
+ '@typescript-eslint/typescript-estree': 7.10.0(typescript@5.4.5)
+ '@typescript-eslint/visitor-keys': 7.10.0
+ debug: 4.3.4
+ eslint: 9.3.0
+ optionalDependencies:
+ typescript: 5.4.5
+ transitivePeerDependencies:
+ - supports-color
+
+ '@typescript-eslint/scope-manager@7.10.0':
+ dependencies:
+ '@typescript-eslint/types': 7.10.0
+ '@typescript-eslint/visitor-keys': 7.10.0
+
+ '@typescript-eslint/type-utils@7.10.0(eslint@9.3.0)(typescript@5.4.5)':
+ dependencies:
+ '@typescript-eslint/typescript-estree': 7.10.0(typescript@5.4.5)
+ '@typescript-eslint/utils': 7.10.0(eslint@9.3.0)(typescript@5.4.5)
+ debug: 4.3.4
+ eslint: 9.3.0
+ ts-api-utils: 1.3.0(typescript@5.4.5)
+ optionalDependencies:
+ typescript: 5.4.5
+ transitivePeerDependencies:
+ - supports-color
+
+ '@typescript-eslint/types@7.10.0': {}
+
+ '@typescript-eslint/typescript-estree@7.10.0(typescript@5.4.5)':
+ dependencies:
+ '@typescript-eslint/types': 7.10.0
+ '@typescript-eslint/visitor-keys': 7.10.0
+ debug: 4.3.4
+ globby: 11.1.0
+ is-glob: 4.0.3
+ minimatch: 9.0.4
+ semver: 7.6.2
+ ts-api-utils: 1.3.0(typescript@5.4.5)
+ optionalDependencies:
+ typescript: 5.4.5
+ transitivePeerDependencies:
+ - supports-color
+
+ '@typescript-eslint/utils@7.10.0(eslint@9.3.0)(typescript@5.4.5)':
+ dependencies:
+ '@eslint-community/eslint-utils': 4.4.0(eslint@9.3.0)
+ '@typescript-eslint/scope-manager': 7.10.0
+ '@typescript-eslint/types': 7.10.0
+ '@typescript-eslint/typescript-estree': 7.10.0(typescript@5.4.5)
+ eslint: 9.3.0
+ transitivePeerDependencies:
+ - supports-color
+ - typescript
+
+ '@typescript-eslint/visitor-keys@7.10.0':
+ dependencies:
+ '@typescript-eslint/types': 7.10.0
+ eslint-visitor-keys: 3.4.3
'@vitest/expect@1.6.0':
dependencies:
@@ -2511,6 +2699,8 @@ snapshots:
array-back@4.0.2: {}
+ array-union@2.1.0: {}
+
assertion-error@1.1.0: {}
autoprefixer@10.4.19(postcss@8.4.38):
@@ -2689,11 +2879,11 @@ snapshots:
diff-sequences@29.6.3: {}
- dlv@1.1.3: {}
-
- doctrine@3.0.0:
+ dir-glob@3.0.1:
dependencies:
- esutils: 2.0.3
+ path-type: 4.0.0
+
+ dlv@1.1.3: {}
earcut@2.2.4: {}
@@ -2739,22 +2929,22 @@ snapshots:
escape-string-regexp@4.0.0: {}
- eslint-compat-utils@0.5.0(eslint@8.57.0):
+ eslint-compat-utils@0.5.0(eslint@9.3.0):
dependencies:
- eslint: 8.57.0
+ eslint: 9.3.0
semver: 7.6.2
- eslint-config-prettier@9.1.0(eslint@8.57.0):
+ eslint-config-prettier@9.1.0(eslint@9.3.0):
dependencies:
- eslint: 8.57.0
+ eslint: 9.3.0
- eslint-plugin-svelte@2.39.0(eslint@8.57.0)(svelte@5.0.0-next.141):
+ eslint-plugin-svelte@2.39.0(eslint@9.3.0)(svelte@5.0.0-next.141):
dependencies:
- '@eslint-community/eslint-utils': 4.4.0(eslint@8.57.0)
+ '@eslint-community/eslint-utils': 4.4.0(eslint@9.3.0)
'@jridgewell/sourcemap-codec': 1.4.15
debug: 4.3.4
- eslint: 8.57.0
- eslint-compat-utils: 0.5.0(eslint@8.57.0)
+ eslint: 9.3.0
+ eslint-compat-utils: 0.5.0(eslint@9.3.0)
esutils: 2.0.3
known-css-properties: 0.31.0
postcss: 8.4.38
@@ -2774,40 +2964,43 @@ snapshots:
esrecurse: 4.3.0
estraverse: 5.3.0
+ eslint-scope@8.0.1:
+ dependencies:
+ esrecurse: 4.3.0
+ estraverse: 5.3.0
+
eslint-visitor-keys@3.4.3: {}
- eslint@8.57.0:
+ eslint-visitor-keys@4.0.0: {}
+
+ eslint@9.3.0:
dependencies:
- '@eslint-community/eslint-utils': 4.4.0(eslint@8.57.0)
+ '@eslint-community/eslint-utils': 4.4.0(eslint@9.3.0)
'@eslint-community/regexpp': 4.10.0
- '@eslint/eslintrc': 2.1.4
- '@eslint/js': 8.57.0
- '@humanwhocodes/config-array': 0.11.14
+ '@eslint/eslintrc': 3.1.0
+ '@eslint/js': 9.3.0
+ '@humanwhocodes/config-array': 0.13.0
'@humanwhocodes/module-importer': 1.0.1
+ '@humanwhocodes/retry': 0.3.0
'@nodelib/fs.walk': 1.2.8
- '@ungap/structured-clone': 1.2.0
ajv: 6.12.6
chalk: 4.1.2
cross-spawn: 7.0.3
debug: 4.3.4
- doctrine: 3.0.0
escape-string-regexp: 4.0.0
- eslint-scope: 7.2.2
- eslint-visitor-keys: 3.4.3
- espree: 9.6.1
+ eslint-scope: 8.0.1
+ eslint-visitor-keys: 4.0.0
+ espree: 10.0.1
esquery: 1.5.0
esutils: 2.0.3
fast-deep-equal: 3.1.3
- file-entry-cache: 6.0.1
+ file-entry-cache: 8.0.0
find-up: 5.0.0
glob-parent: 6.0.2
- globals: 13.24.0
- graphemer: 1.4.0
ignore: 5.3.1
imurmurhash: 0.1.4
is-glob: 4.0.3
is-path-inside: 3.0.3
- js-yaml: 4.1.0
json-stable-stringify-without-jsonify: 1.0.1
levn: 0.4.1
lodash.merge: 4.6.2
@@ -2821,6 +3014,12 @@ snapshots:
esm-env@1.0.0: {}
+ espree@10.0.1:
+ dependencies:
+ acorn: 8.11.3
+ acorn-jsx: 5.3.2(acorn@8.11.3)
+ eslint-visitor-keys: 4.0.0
+
espree@9.6.1:
dependencies:
acorn: 8.11.3
@@ -2880,9 +3079,9 @@ snapshots:
fflate@0.8.2: {}
- file-entry-cache@6.0.1:
+ file-entry-cache@8.0.0:
dependencies:
- flat-cache: 3.2.0
+ flat-cache: 4.0.1
fill-range@7.1.1:
dependencies:
@@ -2897,11 +3096,10 @@ snapshots:
locate-path: 6.0.0
path-exists: 4.0.0
- flat-cache@3.2.0:
+ flat-cache@4.0.1:
dependencies:
flatted: 3.3.1
keyv: 4.5.4
- rimraf: 3.0.2
flatted@3.3.1: {}
@@ -2951,9 +3149,16 @@ snapshots:
once: 1.4.0
path-is-absolute: 1.0.1
- globals@13.24.0:
+ globals@14.0.0: {}
+
+ globby@11.1.0:
dependencies:
- type-fest: 0.20.2
+ array-union: 2.1.0
+ dir-glob: 3.0.1
+ fast-glob: 3.3.2
+ ignore: 5.3.1
+ merge2: 1.4.1
+ slash: 3.0.0
graceful-fs@4.2.11: {}
@@ -3224,6 +3429,8 @@ snapshots:
lru-cache: 10.2.2
minipass: 7.1.2
+ path-type@4.0.0: {}
+
pathe@1.1.2: {}
pathval@1.1.1: {}
@@ -3367,10 +3574,6 @@ snapshots:
dependencies:
glob: 7.2.3
- rimraf@3.0.2:
- dependencies:
- glob: 7.2.3
-
rimraf@5.0.7:
dependencies:
glob: 10.4.1
@@ -3424,6 +3627,8 @@ snapshots:
signal-exit@4.1.0: {}
+ slash@3.0.0: {}
+
sorcery@0.11.0:
dependencies:
'@jridgewell/sourcemap-codec': 1.4.15
@@ -3678,6 +3883,10 @@ snapshots:
troika-worker-utils@0.49.0: {}
+ ts-api-utils@1.3.0(typescript@5.4.5):
+ dependencies:
+ typescript: 5.4.5
+
ts-auto-guard@4.2.0:
dependencies:
command-line-args: 5.2.1
@@ -3734,8 +3943,6 @@ snapshots:
type-detect@4.0.8: {}
- type-fest@0.20.2: {}
-
typescript@5.4.5: {}
typical@4.0.0: {}