Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/npm_and_yarn/electron-32.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
jessfraz committed Sep 6, 2024
2 parents 2a4db1e + 55d1da2 commit d00aefb
Show file tree
Hide file tree
Showing 17 changed files with 156 additions and 37 deletions.
4 changes: 3 additions & 1 deletion .env.development
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ NODE_ENV=development
DEV=true
VITE_KC_API_WS_MODELING_URL=wss://api.dev.zoo.dev/ws/modeling/commands
VITE_KC_API_BASE_URL=https://api.dev.zoo.dev
BASE_URL=https://api.dev.zoo.dev
VITE_KC_SITE_BASE_URL=https://dev.zoo.dev
VITE_KC_SKIP_AUTH=false
VITE_KC_CONNECTION_TIMEOUT_MS=5000
VITE_KC_DEV_TOKEN="your token from dev.zoo.dev should go in .env.development.local"
# ONLY add your token in .env.development.local if you want to skip auth, otherwise this token takes precedence!
#VITE_KC_DEV_TOKEN="your token from dev.zoo.dev should go in .env.development.local"
41 changes: 40 additions & 1 deletion docs/kcl/loft.md

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion docs/kcl/std.json
Original file line number Diff line number Diff line change
Expand Up @@ -147713,7 +147713,8 @@
"deprecated": false,
"examples": [
"// Loft a square and a triangle.\nconst squareSketch = startSketchOn('XY')\n |> startProfileAt([-100, 200], %)\n |> line([200, 0], %)\n |> line([0, -200], %)\n |> line([-200, 0], %)\n |> lineTo([profileStartX(%), profileStartY(%)], %)\n |> close(%)\n\nconst triangleSketch = startSketchOn(offsetPlane('XY', 75))\n |> startProfileAt([0, 125], %)\n |> line([-15, -30], %)\n |> line([30, 0], %)\n |> lineTo([profileStartX(%), profileStartY(%)], %)\n |> close(%)\n\nloft([squareSketch, triangleSketch])",
"// Loft a square, a circle, and another circle.\nconst squareSketch = startSketchOn('XY')\n |> startProfileAt([-100, 200], %)\n |> line([200, 0], %)\n |> line([0, -200], %)\n |> line([-200, 0], %)\n |> lineTo([profileStartX(%), profileStartY(%)], %)\n |> close(%)\n\nconst circleSketch0 = startSketchOn(offsetPlane('XY', 75))\n |> circle([0, 100], 50, %)\n\nconst circleSketch1 = startSketchOn(offsetPlane('XY', 150))\n |> circle([0, 100], 20, %)\n\nloft([\n squareSketch,\n circleSketch0,\n circleSketch1\n])"
"// Loft a square, a circle, and another circle.\nconst squareSketch = startSketchOn('XY')\n |> startProfileAt([-100, 200], %)\n |> line([200, 0], %)\n |> line([0, -200], %)\n |> line([-200, 0], %)\n |> lineTo([profileStartX(%), profileStartY(%)], %)\n |> close(%)\n\nconst circleSketch0 = startSketchOn(offsetPlane('XY', 75))\n |> circle([0, 100], 50, %)\n\nconst circleSketch1 = startSketchOn(offsetPlane('XY', 150))\n |> circle([0, 100], 20, %)\n\nloft([\n squareSketch,\n circleSketch0,\n circleSketch1\n])",
"// Loft a square, a circle, and another circle with options.\nconst squareSketch = startSketchOn('XY')\n |> startProfileAt([-100, 200], %)\n |> line([200, 0], %)\n |> line([0, -200], %)\n |> line([-200, 0], %)\n |> lineTo([profileStartX(%), profileStartY(%)], %)\n |> close(%)\n\nconst circleSketch0 = startSketchOn(offsetPlane('XY', 75))\n |> circle([0, 100], 50, %)\n\nconst circleSketch1 = startSketchOn(offsetPlane('XY', 150))\n |> circle([0, 100], 20, %)\n\nloft([\n squareSketch,\n circleSketch0,\n circleSketch1\n], {\n // This can be set to override the automatically determined\n // topological base curve, which is usually the first section encountered.\n baseCurveIndex: 0,\n // Attempt to approximate rational curves (such as arcs) using a bezier.\n // This will remove banding around interpolations between arcs and non-arcs.\n // It may produce errors in other scenarios Over time, this field won't be necessary.\n bezApproximateRational: false,\n // Tolerance for the loft operation.\n tolerance: 0.000001,\n // Degree of the interpolation. Must be greater than zero.\n // For example, use 2 for quadratic, or 3 for cubic interpolation in\n // the V direction. This defaults to 2, if not specified.\n vDegree: 2\n})"
]
},
{
Expand Down
1 change: 0 additions & 1 deletion interface.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export interface IElectronAPI {
join: typeof path.join
sep: typeof path.sep
rename: (prev: string, next: string) => typeof fs.rename
setBaseUrl: (value: string) => void
packageJson: {
name: string
}
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@
"@iarna/toml": "^2.2.5",
"@lezer/generator": "^1.7.1",
"@playwright/test": "^1.46.1",
"@tauri-apps/cli": "^2.0.0-rc.9",
"@testing-library/jest-dom": "^5.14.1",
"@testing-library/react": "^15.0.2",
"@types/d3-force": "^3.0.10",
Expand Down
23 changes: 0 additions & 23 deletions src/lib/desktop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
parseProjectSettings,
} from 'lang/wasm'
import {
DEFAULT_HOST,
PROJECT_ENTRYPOINT,
PROJECT_FOLDER,
PROJECT_SETTINGS_FILE_NAME,
Expand Down Expand Up @@ -556,28 +555,6 @@ export const getUser = async (
token: string,
hostname: string
): Promise<Models['User_type']> => {
// Use the host passed in if it's set.
// Otherwise, use the default host.
const host = !hostname ? DEFAULT_HOST : hostname

// Change the baseURL to the one we want.
let baseurl = host
if (!(host.indexOf('http://') === 0) && !(host.indexOf('https://') === 0)) {
baseurl = `https://${host}`
if (host.indexOf('localhost') === 0) {
baseurl = `http://${host}`
}
}

// Use kittycad library to fetch the user info from /user/me
if (baseurl !== DEFAULT_HOST) {
// The TypeScript generated library uses environment variables for this
// because it was intended for NodeJS.
// Needs to stay like this because window.electron.kittycad needs it
// internally.
window.electron.setBaseUrl(baseurl)
}

try {
const user = await window.electron.kittycad('users.get_user_self', {
client: { token },
Expand Down
6 changes: 5 additions & 1 deletion src/lib/toolbar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,16 @@ export const toolbarConfig: Record<ToolbarModeName, ToolbarMode> = {
id: 'loft',
onClick: () => console.error('Loft not yet implemented'),
icon: 'loft',
status: 'unavailable',
status: 'kcl-only',
title: 'Loft',
hotkey: 'L',
description:
'Create a 3D body by blending between two or more sketches.',
links: [
{
label: 'KCL docs',
url: 'https://zoo.dev/docs/kcl/loft',
},
{
label: 'GitHub discussion',
url: 'https://github.com/KittyCAD/modeling-app/discussions/613',
Expand Down
3 changes: 0 additions & 3 deletions src/preload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,6 @@ contextBridge.exposeInMainWorld('electron', {
isWindows,
isLinux,
},
// IMPORTANT NOTE: kittycad.ts reads process.env.BASE_URL. But there is
// no way to set it across the bridge boundary. We need to make it a command.
setBaseUrl: (value: string) => (process.env.BASE_URL = value),
process: {
// Setter/getter has to be created because
// these are read-only over the boundary.
Expand Down
2 changes: 1 addition & 1 deletion src/wasm-lib/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/wasm-lib/kcl/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "kcl-lib"
description = "KittyCAD Language implementation and tools"
version = "0.2.13"
version = "0.2.14"
edition = "2021"
license = "MIT"
repository = "https://github.com/KittyCAD/modeling-app"
Expand Down
35 changes: 34 additions & 1 deletion src/wasm-lib/kcl/src/std/loft.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use crate::{
std::{extrude::do_post_extrude, fillet::default_tolerance, Args},
};

const DEFAULT_V_DEGREE: u32 = 1;
const DEFAULT_V_DEGREE: u32 = 2;

/// Data for a loft.
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
Expand Down Expand Up @@ -98,6 +98,39 @@ pub async fn loft(args: Args) -> Result<KclValue, KclError> {
///
/// loft([squareSketch, circleSketch0, circleSketch1])
/// ```
///
/// ```no_run
/// // Loft a square, a circle, and another circle with options.
/// const squareSketch = startSketchOn('XY')
/// |> startProfileAt([-100, 200], %)
/// |> line([200, 0], %)
/// |> line([0, -200], %)
/// |> line([-200, 0], %)
/// |> lineTo([profileStartX(%), profileStartY(%)], %)
/// |> close(%)
///
/// const circleSketch0 = startSketchOn(offsetPlane('XY', 75))
/// |> circle([0, 100], 50, %)
///
/// const circleSketch1 = startSketchOn(offsetPlane('XY', 150))
/// |> circle([0, 100], 20, %)
///
/// loft([squareSketch, circleSketch0, circleSketch1], {
/// // This can be set to override the automatically determined
/// // topological base curve, which is usually the first section encountered.
/// baseCurveIndex: 0,
/// // Attempt to approximate rational curves (such as arcs) using a bezier.
/// // This will remove banding around interpolations between arcs and non-arcs.
/// // It may produce errors in other scenarios Over time, this field won't be necessary.
/// bezApproximateRational: false,
/// // Tolerance for the loft operation.
/// tolerance: 0.000001,
/// // Degree of the interpolation. Must be greater than zero.
/// // For example, use 2 for quadratic, or 3 for cubic interpolation in
/// // the V direction. This defaults to 2, if not specified.
/// vDegree: 2,
/// })
/// ```
#[stdlib {
name = "loft",
}]
Expand Down
2 changes: 1 addition & 1 deletion src/wasm-lib/kcl/src/std/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ layout: manual
buf.push_str(&fn_docs);

// Write the file.
expectorate::assert_contents(&format!("../../../docs/kcl/{}.md", internal_fn.name()), &buf);
expectorate::assert_contents(format!("../../../docs/kcl/{}.md", internal_fn.name()), &buf);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/wasm-lib/kcl/src/token/tokeniser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ fn whitespace(i: &mut Located<&str>) -> PResult<Token> {

fn inner_word(i: &mut Located<&str>) -> PResult<()> {
one_of(('a'..='z', 'A'..='Z', '_')).parse_next(i)?;
repeat(0.., one_of(('a'..='z', 'A'..='Z', '0'..='9', '_'))).parse_next(i)?;
repeat::<_, _, (), _, _>(0.., one_of(('a'..='z', 'A'..='Z', '0'..='9', '_'))).parse_next(i)?;
Ok(())
}

Expand Down
Binary file modified src/wasm-lib/kcl/tests/outputs/serial_test_example_loft1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/wasm-lib/rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "1.80.1"
channel = "1.81.0"
components = ["clippy", "rustfmt"]
66 changes: 66 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2353,6 +2353,72 @@
resolved "https://registry.yarnpkg.com/@tanstack/virtual-core/-/virtual-core-3.8.4.tgz#0ff84b6a0e4b394335cf7ccf759c36b58cbd02eb"
integrity sha512-iO5Ujgw3O1yIxWDe9FgUPNkGjyT657b1WNX52u+Wv1DyBFEpdCdGkuVaky0M3hHFqNWjAmHWTn4wgj9rTr7ZQg==

"@tauri-apps/[email protected]":
version "2.0.0-rc.9"
resolved "https://registry.yarnpkg.com/@tauri-apps/cli-darwin-arm64/-/cli-darwin-arm64-2.0.0-rc.9.tgz#d6d9522b549a73ffb2c10ee273e6ac766dfa5914"
integrity sha512-RaCx1KpMX27iS1Cn7MYbVA0Gc5NsjU0Z1Qo42ibzF4OHInOkDcx3qjAaE+xD572Lb9ksBO725cIcYCdgqGu4Vw==

"@tauri-apps/[email protected]":
version "2.0.0-rc.9"
resolved "https://registry.yarnpkg.com/@tauri-apps/cli-darwin-x64/-/cli-darwin-x64-2.0.0-rc.9.tgz#7ae9abfbeff998f13608d9248bdadba73b1560c0"
integrity sha512-KKUs8kbHYZrcmY/AjKjxEEm7aHGWQsn3+BGsgamKl97k2K5R5Z0KLJUy6QVhUSISEIievjDPmBDIwgA6mlrCLQ==

"@tauri-apps/[email protected]":
version "2.0.0-rc.9"
resolved "https://registry.yarnpkg.com/@tauri-apps/cli-linux-arm-gnueabihf/-/cli-linux-arm-gnueabihf-2.0.0-rc.9.tgz#8330576565f9ac411011d491a26e94d9116eb5ad"
integrity sha512-OgVCt72g0AnIB3zuKJLEIOCNeviiNeLoQQsVs7ESaqxZ/gMXY35yGVhrFm83eAQ0G4BervHDog15bsY3Dxbc/g==

"@tauri-apps/[email protected]":
version "2.0.0-rc.9"
resolved "https://registry.yarnpkg.com/@tauri-apps/cli-linux-arm64-gnu/-/cli-linux-arm64-gnu-2.0.0-rc.9.tgz#9b4b79dd256c39fed495fd8b7ffdb798078c61ab"
integrity sha512-7kQcXXXpCYB0AWbTRaKAim3JVMKdrxVOiqnOW+7elkqDQxDqmLQho2ah1qHv7LzZ6Z83u5QejrRLeHrrdo3PEg==

"@tauri-apps/[email protected]":
version "2.0.0-rc.9"
resolved "https://registry.yarnpkg.com/@tauri-apps/cli-linux-arm64-musl/-/cli-linux-arm64-musl-2.0.0-rc.9.tgz#5afd06c1601ff823b7d82785236f63af379fd6d4"
integrity sha512-2hqANZrydqZpptUsfAHSL5DIaEfHN73UGEu+5keFCV1Irh+QPydr1CYrqhgFF982ev6Ars7nxALwpPhEODjYlg==

"@tauri-apps/[email protected]":
version "2.0.0-rc.9"
resolved "https://registry.yarnpkg.com/@tauri-apps/cli-linux-x64-gnu/-/cli-linux-x64-gnu-2.0.0-rc.9.tgz#39185adc857e3e8474008600b7f0a6e0e42abdbf"
integrity sha512-Zjna6eoVSlmZtzAXgH27sgJRnczNzMKRiGsMpY00PFxN9sbQwlsS3yMfB8GHsBeBoq+qJQsteRwhrn1mj6e3Rg==

"@tauri-apps/[email protected]":
version "2.0.0-rc.9"
resolved "https://registry.yarnpkg.com/@tauri-apps/cli-linux-x64-musl/-/cli-linux-x64-musl-2.0.0-rc.9.tgz#a8d703010892622cf38e87950f5d2920833fac88"
integrity sha512-8ODcbvwZw29sAWns36BeBYJ3iu3Mtv4J3WkcoVbanVCP8nu7ja3401VnWBjckRiI1iDJIm59m6ojVkGYQhAe9Q==

"@tauri-apps/[email protected]":
version "2.0.0-rc.9"
resolved "https://registry.yarnpkg.com/@tauri-apps/cli-win32-arm64-msvc/-/cli-win32-arm64-msvc-2.0.0-rc.9.tgz#8ddea7d990b701357fe3dfd8e8e1783898206d85"
integrity sha512-j6jJId8hlid/W4ezDRNK49DSjxb82W6d1qVqO7zksKdZLy8tVzFkZXwEeKhabzRQsO87KL34I+ciRlmInGis0Q==

"@tauri-apps/[email protected]":
version "2.0.0-rc.9"
resolved "https://registry.yarnpkg.com/@tauri-apps/cli-win32-ia32-msvc/-/cli-win32-ia32-msvc-2.0.0-rc.9.tgz#ffa340d2dbf0e87355fa92650fbd707adc12d84e"
integrity sha512-w9utY58kfzJS+iLCjyQyQbJS8YaCM8YCWkgK2ZkySmHAdnqdGeyJEWig1qrLH1TWd+O6K3TlCNv55ujeAtOE4w==

"@tauri-apps/[email protected]":
version "2.0.0-rc.9"
resolved "https://registry.yarnpkg.com/@tauri-apps/cli-win32-x64-msvc/-/cli-win32-x64-msvc-2.0.0-rc.9.tgz#93f0cdc8c6999227aeee86741b553c16cb7ac20f"
integrity sha512-+l2RcpTthzYkw3VsmcZkb099Jfl0d21a9VIFxdk+duKeYieRpb0MsIBP6fS7WlNAeqrinC0zi/zt+Nia6mPuyw==

"@tauri-apps/cli@^2.0.0-rc.9":
version "2.0.0-rc.9"
resolved "https://registry.yarnpkg.com/@tauri-apps/cli/-/cli-2.0.0-rc.9.tgz#b641ad224dd055aae4f101c14d0696d2e06862c0"
integrity sha512-cjj5HVKHUlxL87TN7ZZpnlMgcBS+ToIyfLB6jpaNDZ9Op0/qzccWGZpPbW2P/BnfF/qwHzVJNUPGANFyvBSUeg==
optionalDependencies:
"@tauri-apps/cli-darwin-arm64" "2.0.0-rc.9"
"@tauri-apps/cli-darwin-x64" "2.0.0-rc.9"
"@tauri-apps/cli-linux-arm-gnueabihf" "2.0.0-rc.9"
"@tauri-apps/cli-linux-arm64-gnu" "2.0.0-rc.9"
"@tauri-apps/cli-linux-arm64-musl" "2.0.0-rc.9"
"@tauri-apps/cli-linux-x64-gnu" "2.0.0-rc.9"
"@tauri-apps/cli-linux-x64-musl" "2.0.0-rc.9"
"@tauri-apps/cli-win32-arm64-msvc" "2.0.0-rc.9"
"@tauri-apps/cli-win32-ia32-msvc" "2.0.0-rc.9"
"@tauri-apps/cli-win32-x64-msvc" "2.0.0-rc.9"

"@testing-library/dom@^10.0.0":
version "10.4.0"
resolved "https://registry.yarnpkg.com/@testing-library/dom/-/dom-10.4.0.tgz#82a9d9462f11d240ecadbf406607c6ceeeff43a8"
Expand Down

0 comments on commit d00aefb

Please sign in to comment.