diff --git a/.gitignore b/.gitignore index 517ae192..c3824542 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,4 @@ vite.config.ts.timestamp-* build-* **/*.log +chromatic.log diff --git a/chromatic.log b/chromatic.log index 8680a61f..6d61e57e 100644 --- a/chromatic.log +++ b/chromatic.log @@ -7,108 +7,17 @@ Authenticating with Chromatic Authenticated with Chromatic → Using project token '****************1f8a' Retrieving git information +⚠ Using outdated package +You are using an outdated version of the Chromatic CLI (v7.5.4). +A new major version is available (v10.7.1). +Run yarn upgrade chromatic --latest to upgrade. Retrieved git information - → Commit 'aafc802' on branch 'split-canvas'; found 1 parent build + → Commit 'de29afc' on branch '#67-oriented-area'; found 2 parent builds Collecting Storybook metadata Collected Storybook metadata - → Storybook 7.5.1 for Svelte; using the @storybook/sveltekit builder (7.5.1); supported addons found: Links, Essentials, Interactions + → Storybook 7.6.10 for Svelte; using the @storybook/sveltekit builder (7.6.10); supported addons found: Links, Essentials, Interactions Initializing build Initialized build - → Build 4 initialized + → Build 614 initialized Building your Storybook - → Running command: pnpm run build-storybook --output-dir /var/folders/9_/f1r1122x0z30nmvsjdphgnh40000gn/T/chromatic--64957-8I3Yuc4zViqV -Storybook built in 14 seconds - → View build log at /Users/abeldebruijn/Documents/GitHub/turborepo-visuals/build-storybook.log -Publish your built Storybook - → Validating Storybook files -Publishing your built Storybook - → Retrieving target location - → Starting publish - → [ ] 0% - → [ ] 1% - → [= ] 4% - → [= ] 7% - → [== ] 12% - → [=== ] 13% - → [=== ] 15% - → [=== ] 16% - → [==== ] 21% - → [==== ] 22% - → [===== ] 23% - → [===== ] 24% - → [===== ] 27% - → [====== ] 28% - → [====== ] 32% - → [======= ] 37% - → [======== ] 40% - → [======== ] 41% - → [========= ] 46% - → [========== ] 48% - → [========== ] 49% - → [========== ] 50% - → [========== ] 52% - → [=========== ] 55% - → [=========== ] 56% - → [============ ] 58% - → [============ ] 60% - → [============ ] 62% - → [============= ] 63% - → [============= ] 64% - → [============= ] 66% - → [============== ] 68% - → [============== ] 71% - → [============== ] 72% - → [=============== ] 74% - → [=============== ] 77% - → [================ ] 79% - → [================ ] 80% - → [================ ] 82% - → [================= ] 83% - → [================= ] 84% - → [================= ] 85% - → [================= ] 86% - → [================= ] 87% - → [================== ] 88% - → [================== ] 89% - → [================== ] 90% - → [================== ] 91% - → [================== ] 92% - → [=================== ] 93% - → [=================== ] 95% - → [=================== ] 97% - → [====================] 98% - → [====================] 99% -Publish complete in 17 seconds - → View your Storybook at https://64bd84b22e54c77ce9fcbc6b-ikpysqvuwf.chromatic.com -Verifying your Storybook - → This may take a few minutes -Started build 4 - → View build details at https://www.chromatic.com/build?appId=64bd84b22e54c77ce9fcbc6b&number=4 -Running 22 tests - → This may take a few minutes -ℹ Speed up Continuous Integration -Your project is linked to GitHub so Chromatic will report results there. -This means you can pass the --exit-once-uploaded flag to skip waiting for build results. -Read more here: https://www.chromatic.com/docs/cli#chromatic-options - → [= ] 1/22 Slider › Default - → [== ] 2/22 Arc › With color - → [=== ] 3/22 Arc › With points defined - → [===== ] 5/22 Arc › With width defined - → [===== ] 6/22 Arc › With distance defined - → [====== ] 7/22 Canvas › Default - → [======= ] 8/22 Canvas › With title - → [========== ] 11/22 Draggable › With color - → [=========== ] 12/22 Angle › Default - → [============ ] 13/22 Angle › With Origin - → [============== ] 15/22 Angle › Force Round Angle - → [=============== ] 16/22 Axis › Default - → [================ ] 18/22 Canvas › Is Iframe - → [================= ] 19/22 Canvas › With Title - → [================== ] 20/22 Canvas › Multiple Slider - → [=================== ] 21/22 Canvas › Canvas With Formulas - → [====================] 22/22 Label › Default -✖ Found 22 visual changes: Review the changes at https://www.chromatic.com/build?appId=64bd84b22e54c77ce9fcbc6b&number=4 - -ℹ For CI/CD use cases, this command failed with exit code 1 -Pass --exit-zero-on-changes to succeed this command regardless of changes. -Pass --auto-accept-changes to succeed and automatically accept any changes. + → Running command: pnpm run build-storybook --output-dir /var/folders/9_/f1r1122x0z30nmvsjdphgnh40000gn/T/chromatic--87913-hCHeEZ2NWkkO diff --git a/package.json b/package.json index 0127bc47..d7b392cf 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "format": "prettier --plugin-search-dir . --write .", "storybook": "storybook dev -p 6006 --no-open", "build-storybook": "storybook build", - "chromatic": "npx chromatic --project-token=chpt_7ac438918371f8a" + "chromatic": "npx chromatic --only-changed --project-token=chpt_7ac438918371f8a" }, "dependencies": { "@mdi/js": "^7.2.96", diff --git a/src/lib/components/AbstractCanvas.svelte b/src/lib/components/AbstractCanvas.svelte index 39d174bc..77b5c47a 100644 --- a/src/lib/components/AbstractCanvas.svelte +++ b/src/lib/components/AbstractCanvas.svelte @@ -44,7 +44,7 @@ } $: { - const params = $page.url?.searchParams; + const params = $page?.url?.searchParams; title = params?.get('title') || title; } @@ -55,7 +55,7 @@ } onMount(() => { - const params = $page.url?.searchParams; + const params = $page?.url?.searchParams; if (controls) { controls = controls.fromURL(params?.get('controls') || '') || controls; diff --git a/src/lib/components/ShareWindow.svelte b/src/lib/components/ShareWindow.svelte index 6d9ba81d..73476723 100644 --- a/src/lib/components/ShareWindow.svelte +++ b/src/lib/components/ShareWindow.svelte @@ -21,8 +21,8 @@ let urlInput: HTMLTextAreaElement; $: state = controls?.controls && getState($cameraStore); - $: url = $page.url?.origin + $page.url?.pathname; - $: refUrl = $page.url?.pathname.replace('/applet/', ''); + $: url = $page?.url?.origin + $page.url?.pathname; + $: refUrl = $page?.url?.pathname.replace('/applet/', ''); $: lastUrl = refUrl?.split('/')?.slice(-1)[0]; // Last part of the url /** diff --git a/src/lib/d3-components/Angle.svelte b/src/lib/d3-components/Angle.svelte new file mode 100644 index 00000000..08c14b07 --- /dev/null +++ b/src/lib/d3-components/Angle.svelte @@ -0,0 +1,38 @@ + + + + + + +{#if hasHead} + + + +{/if} diff --git a/src/lib/d3-components/Arc.svelte b/src/lib/d3-components/Arc.svelte index 451a7bc2..a327735a 100644 --- a/src/lib/d3-components/Arc.svelte +++ b/src/lib/d3-components/Arc.svelte @@ -1,7 +1,7 @@ + +{#if hasHead} + + + +{/if} diff --git a/src/lib/d3-components/Canvas.svelte b/src/lib/d3-components/Canvas.svelte index 089ba5ff..8898d9bd 100644 --- a/src/lib/d3-components/Canvas.svelte +++ b/src/lib/d3-components/Canvas.svelte @@ -27,6 +27,7 @@ export let isIframe = false; export let width = '100%'; export let height = '100%'; + export let showAxisNumbers = true; type G = $$Generic[]>; export let controls: Controls | undefined = undefined; @@ -54,7 +55,7 @@ {#if $$slots.splitCanvas} - + {:else if $$slots.splitCanvas3d} diff --git a/src/lib/d3-components/D3Canvas.svelte b/src/lib/d3-components/D3Canvas.svelte index 57c254dc..3d5c9ef5 100644 --- a/src/lib/d3-components/D3Canvas.svelte +++ b/src/lib/d3-components/D3Canvas.svelte @@ -13,6 +13,7 @@ export let height: Canvas2DProps['height']; export let tickLength: Canvas2DProps['tickLength'] = 30; export let gridType: Canvas2DProps['gridType'] = GridType.Square; + export let showAxisNumbers = true; const id = 'canvas-' + Math.random().toString(36).substr(2, 9); @@ -51,8 +52,9 @@ (2 * vmax)) / 30})" > + - + diff --git a/src/lib/d3-components/Latex.svelte b/src/lib/d3-components/Latex.svelte index 774f6ccc..f652e5b7 100644 --- a/src/lib/d3-components/Latex.svelte +++ b/src/lib/d3-components/Latex.svelte @@ -10,8 +10,11 @@ export let textSize: number = 13; export let position: Vector2 = new Vector2(0, 0); export let offset: Vector2 = new Vector2(0, 0); + export let extend: number = 0; export let color: string = 'black'; + $: extendedOffset = position.clone().normalize().multiplyScalar(extend); + let latexWrapper: SVGGElement; onMount(() => { @@ -25,6 +28,7 @@ bind:this={latexWrapper} fill={color} style="color: {color}" - transform="translate({position.x + offset.x}, {position.y + offset.y}) scale({(0.02 / 16) * - textSize} ,{(-0.02 / 16) * textSize})" + transform="translate({position.x + offset.x + extendedOffset.x}, {position.y + + offset.y + + extendedOffset.y}) scale({(0.02 / 16) * textSize} ,{(-0.02 / 16) * textSize})" /> diff --git a/src/lib/d3-components/Parallelogram.svelte b/src/lib/d3-components/Parallelogram.svelte new file mode 100644 index 00000000..0c571d42 --- /dev/null +++ b/src/lib/d3-components/Parallelogram.svelte @@ -0,0 +1,17 @@ + + + + + diff --git a/src/lib/d3-components/index.ts b/src/lib/d3-components/index.ts index 9852366c..9942b7cf 100644 --- a/src/lib/d3-components/index.ts +++ b/src/lib/d3-components/index.ts @@ -7,6 +7,7 @@ export { default as Canvas2D } from './Canvas.svelte'; export { default as InfiniteLine2D } from './InfiniteLine.svelte'; export { default as Latex2D } from './Latex.svelte'; export { default as Line2D } from './Line.svelte'; +export { default as Parallelogram } from './Parallelogram.svelte'; export { default as Point2D } from './Point.svelte'; export { default as RightAngle } from './RightAngle.svelte'; export { default as Vector2D } from './Vector.svelte'; diff --git a/src/lib/d3-components/stories/Arc.stories.svelte b/src/lib/d3-components/stories/Arc.stories.svelte index 07148ae2..5080eedd 100644 --- a/src/lib/d3-components/stories/Arc.stories.svelte +++ b/src/lib/d3-components/stories/Arc.stories.svelte @@ -34,3 +34,14 @@ + + + diff --git a/src/lib/d3-components/stories/Draggable.stories.svelte b/src/lib/d3-components/stories/Draggable.stories.svelte index f0c60ea2..8ff07ca9 100644 --- a/src/lib/d3-components/stories/Draggable.stories.svelte +++ b/src/lib/d3-components/stories/Draggable.stories.svelte @@ -18,6 +18,10 @@ import { PrimeColor } from '$lib/utils/PrimeColors'; import docsForStory from '$lib/utils/docsForStory'; import { Vector2 } from 'three'; + import { Vector2D } from '..'; + + let p1 = new Vector2(1, 2); + let p2 = new Vector2(2, 1);