Skip to content

Commit

Permalink
Run pnpm format
Browse files Browse the repository at this point in the history
Signed-off-by: Dimitris Zervas <[email protected]>
  • Loading branch information
dzervas committed Jun 11, 2024
1 parent 8d1092f commit c0ca7a1
Show file tree
Hide file tree
Showing 5 changed files with 586 additions and 530 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ cargo test
Simple exaples using the rust code can be found in `packages/cadmium/examples`

Run simple rust example with:
```

```shell
cargo run --example project_simple_extrusion
```

Expand Down
4 changes: 2 additions & 2 deletions applications/web/src/components/AppBar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,10 @@

<div class="flex-grow flex flex-row-reverse gap-4 mr-4">
<div>
<a href="https://discord.com/invite/qJCsKJeyZv" target="_blank"><DiscordLogo class="h-6 w-6"/></a>
<a href="https://discord.com/invite/qJCsKJeyZv" target="_blank"><DiscordLogo class="h-6 w-6" /></a>
</div>
<div>
<a href="https://github.com/mattferraro/cadmium" target="_blank"><GithubLogo class="h-6 w-6"/></a>
<a href="https://github.com/mattferraro/cadmium" target="_blank"><GithubLogo class="h-6 w-6" /></a>
</div>
</div>
</div>
Expand Down
285 changes: 200 additions & 85 deletions packages/shared/cadmium-api.ts
Original file line number Diff line number Diff line change
@@ -1,119 +1,234 @@
import { Direction, IDType, MessageResult, Mode, Plane, PlaneDescription } from "cadmium";
import { sendWasmMessage } from "./projectUtils";
import {Direction, IDType, MessageResult, Mode, Plane, PlaneDescription} from "cadmium"
import {sendWasmMessage} from "./projectUtils"

interface ProjectRename { new_name: string };
interface ProjectRename {
new_name: string
}
export function projectRename(new_name: string): MessageResult {
const message: Message = { ProjectRename: { new_name } }
return sendWasmMessage(message)
const message: Message = {ProjectRename: {new_name}}
return sendWasmMessage(message)
}
interface WorkbenchRename {
workbench_id: IDType
new_name: string
}
interface WorkbenchRename { workbench_id: IDType, new_name: string };
export function workbenchRename(workbench_id: IDType, new_name: string): MessageResult {
const message: Message = { WorkbenchRename: { workbench_id, new_name } }
return sendWasmMessage(message)
const message: Message = {WorkbenchRename: {workbench_id, new_name}}
return sendWasmMessage(message)
}
interface WorkbenchPointAdd {
workbench_id: IDType
x: number
y: number
z: number
}
interface WorkbenchPointAdd { workbench_id: IDType, x: number, y: number, z: number };
export function workbenchPointAdd(workbench_id: IDType, x: number, y: number, z: number): MessageResult {
const message: Message = { WorkbenchPointAdd: { workbench_id, x, y, z } }
return sendWasmMessage(message)
const message: Message = {WorkbenchPointAdd: {workbench_id, x, y, z}}
return sendWasmMessage(message)
}
interface WorkbenchPlaneAdd {
workbench_id: IDType
plane: Plane
width: number
height: number
}
interface WorkbenchPlaneAdd { workbench_id: IDType, plane: Plane, width: number, height: number };
export function workbenchPlaneAdd(workbench_id: IDType, plane: Plane, width: number, height: number): MessageResult {
const message: Message = { WorkbenchPlaneAdd: { workbench_id, plane, width, height } }
return sendWasmMessage(message)
const message: Message = {WorkbenchPlaneAdd: {workbench_id, plane, width, height}}
return sendWasmMessage(message)
}
interface WorkbenchSketchAdd {
workbench_id: IDType
plane_description: PlaneDescription
}
interface WorkbenchSketchAdd { workbench_id: IDType, plane_description: PlaneDescription };
export function workbenchSketchAdd(workbench_id: IDType, plane_description: PlaneDescription): MessageResult {
const message: Message = { WorkbenchSketchAdd: { workbench_id, plane_description } }
return sendWasmMessage(message)
const message: Message = {WorkbenchSketchAdd: {workbench_id, plane_description}}
return sendWasmMessage(message)
}
interface WorkbenchSketchSetPlane {
workbench_id: IDType
sketch_id: IDType
plane_description: PlaneDescription
}
interface WorkbenchSketchSetPlane { workbench_id: IDType, sketch_id: IDType, plane_description: PlaneDescription };
export function WorkbenchSketchSetPlane(workbench_id: IDType, sketch_id: IDType, plane_description: PlaneDescription): MessageResult {
const message: Message = { WorkbenchSketchSetPlane: { workbench_id, sketch_id, plane_description } }
return sendWasmMessage(message)
const message: Message = {WorkbenchSketchSetPlane: {workbench_id, sketch_id, plane_description}}
return sendWasmMessage(message)
}
interface WorkbenchPointUpdate {
workbench_id: IDType
point_id: IDType
x: number
y: number
z: number
}
interface WorkbenchPointUpdate { workbench_id: IDType, point_id: IDType, x: number, y: number, z: number };
export function workbenchPointUpdate(workbench_id: IDType, point_id: IDType, x: number, y: number, z: number): MessageResult {
const message: Message = { WorkbenchPointUpdate: { workbench_id, point_id, x, y, z } }
return sendWasmMessage(message)
const message: Message = {WorkbenchPointUpdate: {workbench_id, point_id, x, y, z}}
return sendWasmMessage(message)
}
interface SketchAddPoint { workbench_id: IDType, sketch_id: IDType, x: number, y: number, z: number };
export function sketchAddPoint(workbench_id: IDType, sketch_id: IDType, x: number, y: number, z: number): MessageResult {
const message: Message = { SketchAddPoint: { workbench_id, sketch_id, x, y, z } }
return sendWasmMessage(message)
interface SketchAddPoint {
workbench_id: IDType
sketch_id: IDType
x: number
y: number
z: number
}
interface SketchAddArc { workbench_id: IDType, sketch_id: IDType, center: IDType, radius: number, clockwise: boolean, start_angle: number, end_angle: number };
export function sketchAddArc(workbench_id: IDType, sketch_id: IDType, center: IDType, radius: number, clockwise: boolean, start_angle: number, end_angle: number): MessageResult {
const message: Message = { SketchAddArc: { workbench_id, sketch_id, center, radius, clockwise, start_angle, end_angle } }
return sendWasmMessage(message)
export function sketchAddPoint(workbench_id: IDType, sketch_id: IDType, x: number, y: number, z: number): MessageResult {
const message: Message = {SketchAddPoint: {workbench_id, sketch_id, x, y, z}}
return sendWasmMessage(message)
}
interface SketchAddArc {
workbench_id: IDType
sketch_id: IDType
center: IDType
radius: number
clockwise: boolean
start_angle: number
end_angle: number
}
export function sketchAddArc(
workbench_id: IDType,
sketch_id: IDType,
center: IDType,
radius: number,
clockwise: boolean,
start_angle: number,
end_angle: number,
): MessageResult {
const message: Message = {SketchAddArc: {workbench_id, sketch_id, center, radius, clockwise, start_angle, end_angle}}
return sendWasmMessage(message)
}
interface SketchAddCircle {
workbench_id: IDType
sketch_id: IDType
center: IDType
radius: number
}
interface SketchAddCircle { workbench_id: IDType, sketch_id: IDType, center: IDType, radius: number };
export function sketchAddCircle(workbench_id: IDType, sketch_id: IDType, center: IDType, radius: number): MessageResult {
const message: Message = { SketchAddCircle: { workbench_id, sketch_id, center, radius } }
return sendWasmMessage(message)
const message: Message = {SketchAddCircle: {workbench_id, sketch_id, center, radius}}
return sendWasmMessage(message)
}
interface SketchAddLine {
workbench_id: IDType
sketch_id: IDType
start: IDType
end: IDType
}
interface SketchAddLine { workbench_id: IDType, sketch_id: IDType, start: IDType, end: IDType };
export function sketchAddLine(workbench_id: IDType, sketch_id: IDType, start: IDType, end: IDType): MessageResult {
const message: Message = { SketchAddLine: { workbench_id, sketch_id, start, end } }
return sendWasmMessage(message)
const message: Message = {SketchAddLine: {workbench_id, sketch_id, start, end}}
return sendWasmMessage(message)
}
interface SketchAddRectangle {
workbench_id: IDType
sketch_id: IDType
start: IDType
end: IDType
}
export function sketchAddRectangle(workbench_id: IDType, sketch_id: IDType, start: IDType, end: IDType): MessageResult {
const message: Message = {SketchAddRectangle: {workbench_id, sketch_id, start, end}}
return sendWasmMessage(message)
}
interface SketchAddRectangle { workbench_id: IDType, sketch_id: IDType, start: IDType, end: IDType };
export function sketchAddRectangle( workbench_id: IDType, sketch_id: IDType, start: IDType, end: IDType ): MessageResult {
const message: Message = { SketchAddRectangle: { workbench_id, sketch_id, start, end } }
return sendWasmMessage(message)
interface SketchDeleteCompound {
workbench_id: IDType
sketch_id: IDType
compound_id: IDType
}
interface SketchDeleteCompound { workbench_id: IDType, sketch_id: IDType, compound_id: IDType };
export function sketchDeleteCompound(workbench_id: IDType, sketch_id: IDType, compound_id: IDType): MessageResult {
const message: Message = { SketchDeleteCompound: { workbench_id, sketch_id, compound_id } }
return sendWasmMessage(message)
const message: Message = {SketchDeleteCompound: {workbench_id, sketch_id, compound_id}}
return sendWasmMessage(message)
}
interface SketchDeletePrimitive { workbench_id: IDType, sketch_id: IDType, primitive_id: IDType };
export function sketchDeletePrimitive(workbench_id: IDType, sketch_id: IDType, primitive_id: IDType): MessageResult {
const message: Message = { SketchDeletePrimitive: { workbench_id, sketch_id, primitive_id } }
return sendWasmMessage(message)
interface SketchDeletePrimitive {
workbench_id: IDType
sketch_id: IDType
primitive_id: IDType
}
interface FeatureExtrusionAdd { workbench_id: IDType, sketch_id: IDType, faces: IDType[], length: number, offset: number, direction: Direction, mode: Mode };
export function featureExtrusionAdd(workbench_id: IDType, sketch_id: IDType, faces: IDType[], length: number, offset: number, direction: Direction, mode: Mode): MessageResult {
const message: Message = { FeatureExtrusionAdd: { workbench_id, sketch_id, faces, length, offset, direction, mode } }
return sendWasmMessage(message)
export function sketchDeletePrimitive(workbench_id: IDType, sketch_id: IDType, primitive_id: IDType): MessageResult {
const message: Message = {SketchDeletePrimitive: {workbench_id, sketch_id, primitive_id}}
return sendWasmMessage(message)
}
interface FeatureExtrusionAdd {
workbench_id: IDType
sketch_id: IDType
faces: IDType[]
length: number
offset: number
direction: Direction
mode: Mode
}
export function featureExtrusionAdd(
workbench_id: IDType,
sketch_id: IDType,
faces: IDType[],
length: number,
offset: number,
direction: Direction,
mode: Mode,
): MessageResult {
const message: Message = {FeatureExtrusionAdd: {workbench_id, sketch_id, faces, length, offset, direction, mode}}
return sendWasmMessage(message)
}
interface FeatureExtrusionUpdateFaces {
workbench_id: IDType
extrusion_id: IDType
sketch_id: IDType
faces: IDType[]
}
interface FeatureExtrusionUpdateFaces { workbench_id: IDType, extrusion_id: IDType, sketch_id: IDType, faces: IDType[] };
export function featureExtrusionUpdateFaces(workbench_id: IDType, extrusion_id: IDType, sketch_id: IDType, faces: IDType[]): MessageResult {
const message: Message = { FeatureExtrusionUpdateFaces: { workbench_id, extrusion_id, sketch_id, faces } }
return sendWasmMessage(message)
const message: Message = {FeatureExtrusionUpdateFaces: {workbench_id, extrusion_id, sketch_id, faces}}
return sendWasmMessage(message)
}
interface FeatureExtrusionUpdateForm {
workbench_id: IDType
extrusion_id: IDType
length: number
offset: number
direction: Direction
mode: Mode
}
export function featureExtrusionUpdateForm(
workbench_id: IDType,
extrusion_id: IDType,
length: number,
offset: number,
direction: Direction,
mode: Mode,
): MessageResult {
const message: Message = {FeatureExtrusionUpdateForm: {workbench_id, extrusion_id, length, offset, direction, mode}}
return sendWasmMessage(message)
}
interface StepRename {
workbench_id: IDType
step_id: IDType
new_name: string
}
interface FeatureExtrusionUpdateForm { workbench_id: IDType, extrusion_id: IDType, length: number, offset: number, direction: Direction, mode: Mode};
export function featureExtrusionUpdateForm(workbench_id: IDType, extrusion_id: IDType, length: number, offset: number, direction: Direction, mode: Mode): MessageResult {
const message: Message = { FeatureExtrusionUpdateForm: { workbench_id, extrusion_id, length, offset, direction, mode } }
return sendWasmMessage(message)
}
interface StepRename { workbench_id: IDType, step_id: IDType, new_name: string };
export function stepRename(workbench_id: IDType, step_id: IDType, new_name: string): MessageResult {
const message: Message = { StepRename: { workbench_id, step_id, new_name } }
return sendWasmMessage(message)
const message: Message = {StepRename: {workbench_id, step_id, new_name}}
return sendWasmMessage(message)
}
interface StepDelete {
workbench_id: IDType
step_id: IDType
}
interface StepDelete { workbench_id: IDType, step_id: IDType };
export function stepDelete(workbench_id: IDType, step_id: IDType): MessageResult {
const message: Message = { StepDelete: { workbench_id, step_id } }
return sendWasmMessage(message)
const message: Message = {StepDelete: {workbench_id, step_id}}
return sendWasmMessage(message)
}

export type Message =
{ ProjectRename: ProjectRename } |
{ WorkbenchRename: WorkbenchRename } |
{ WorkbenchPointAdd: WorkbenchPointAdd } |
{ WorkbenchPlaneAdd: WorkbenchPlaneAdd } |
{ WorkbenchSketchAdd: WorkbenchSketchAdd } |
{ WorkbenchSketchSetPlane: WorkbenchSketchSetPlane } |
{ WorkbenchPointUpdate: WorkbenchPointUpdate } |
{ SketchAddPoint: SketchAddPoint } |
{ SketchAddArc: SketchAddArc } |
{ SketchAddCircle: SketchAddCircle } |
{ SketchAddLine: SketchAddLine } |
{ SketchAddRectangle: SketchAddRectangle } |
{ SketchDeleteCompound: SketchDeleteCompound } |
{ SketchDeletePrimitive: SketchDeletePrimitive } |
{ FeatureExtrusionAdd: FeatureExtrusionAdd } |
{ FeatureExtrusionUpdateFaces: FeatureExtrusionUpdateFaces } |
{ FeatureExtrusionUpdateForm: FeatureExtrusionUpdateForm } |
{ StepRename: StepRename } |
{ StepDelete: StepDelete }
| {ProjectRename: ProjectRename}
| {WorkbenchRename: WorkbenchRename}
| {WorkbenchPointAdd: WorkbenchPointAdd}
| {WorkbenchPlaneAdd: WorkbenchPlaneAdd}
| {WorkbenchSketchAdd: WorkbenchSketchAdd}
| {WorkbenchSketchSetPlane: WorkbenchSketchSetPlane}
| {WorkbenchPointUpdate: WorkbenchPointUpdate}
| {SketchAddPoint: SketchAddPoint}
| {SketchAddArc: SketchAddArc}
| {SketchAddCircle: SketchAddCircle}
| {SketchAddLine: SketchAddLine}
| {SketchAddRectangle: SketchAddRectangle}
| {SketchDeleteCompound: SketchDeleteCompound}
| {SketchDeletePrimitive: SketchDeletePrimitive}
| {FeatureExtrusionAdd: FeatureExtrusionAdd}
| {FeatureExtrusionUpdateFaces: FeatureExtrusionUpdateFaces}
| {FeatureExtrusionUpdateForm: FeatureExtrusionUpdateForm}
| {StepRename: StepRename}
| {StepDelete: StepDelete}
Loading

0 comments on commit c0ca7a1

Please sign in to comment.