@tscircuit/curvy-trace-solver 0.0.3 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/index.js +2 -1
  2. package/package.json +4 -1
  3. package/.github/workflows/bun-formatcheck.yml +0 -26
  4. package/.github/workflows/bun-pver-release.yml +0 -92
  5. package/.github/workflows/bun-test.yml +0 -40
  6. package/.github/workflows/bun-typecheck.yml +0 -26
  7. package/biome.json +0 -96
  8. package/bunfig.toml +0 -5
  9. package/cosmos.config.json +0 -5
  10. package/cosmos.decorator.tsx +0 -21
  11. package/fixtures/basics/basics01-input.json +0 -15
  12. package/fixtures/basics/basics01.fixture.tsx +0 -11
  13. package/fixtures/problem-generator.fixture.tsx +0 -50
  14. package/index.html +0 -12
  15. package/lib/CurvyTraceSolver.ts +0 -775
  16. package/lib/geometry/getObstacleOuterSegments.ts +0 -25
  17. package/lib/geometry/index.ts +0 -8
  18. package/lib/index.ts +0 -2
  19. package/lib/problem-generator/countChordCrossings.ts +0 -119
  20. package/lib/problem-generator/createRng.ts +0 -13
  21. package/lib/problem-generator/generateRandomProblem.ts +0 -225
  22. package/lib/problem-generator/index.ts +0 -1
  23. package/lib/problem-generator/randomBoundaryPoint.ts +0 -30
  24. package/lib/problem-generator/wouldCrossAny.ts +0 -16
  25. package/lib/sampleTraceIntoSegments.ts +0 -62
  26. package/lib/scoreOutputCost.ts +0 -116
  27. package/lib/types.ts +0 -35
  28. package/lib/visualization-utils/index.ts +0 -14
  29. package/lib/visualization-utils/visualizeCurvyTraceProblem.ts +0 -66
  30. package/scripts/benchmarks/run-benchmark.ts +0 -85
  31. package/tests/__snapshots__/svg.snap.svg +0 -3
  32. package/tests/basics/__snapshots__/basics01.snap.svg +0 -44
  33. package/tests/basics/basics01.test.ts +0 -12
  34. package/tests/fixtures/preload.ts +0 -1
  35. package/tests/svg.test.ts +0 -12
  36. package/tsconfig.json +0 -35
package/dist/index.js CHANGED
@@ -871,7 +871,8 @@ var visualizeCurvyTraceProblem = (problem, outputTraces = []) => {
871
871
  width: obstacle.maxX - obstacle.minX,
872
872
  height: obstacle.maxY - obstacle.minY,
873
873
  fill: "rgba(128, 128, 128, 0.3)",
874
- stroke: "rgba(128, 128, 128, 0.8)"
874
+ stroke: "rgba(128, 128, 128, 0.8)",
875
+ label: `netId: ${obstacle.networkId}`
875
876
  });
876
877
  }
877
878
  for (const trace of outputTraces) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/curvy-trace-solver",
3
3
  "main": "dist/index.js",
4
- "version": "0.0.3",
4
+ "version": "0.0.5",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "start": "cosmos",
@@ -10,6 +10,9 @@
10
10
  "build": "tsup ./lib/index.ts --format esm --dts",
11
11
  "build:site": "cosmos-export"
12
12
  },
13
+ "files": [
14
+ "dist"
15
+ ],
13
16
  "devDependencies": {
14
17
  "@biomejs/biome": "^2.3.11",
15
18
  "@tscircuit/hypergraph": "^0.0.11",
@@ -1,26 +0,0 @@
1
- # Created using @tscircuit/plop (npm install -g @tscircuit/plop)
2
- name: Format Check
3
-
4
- on:
5
- push:
6
- branches: [main]
7
- pull_request:
8
- branches: [main]
9
-
10
- jobs:
11
- format-check:
12
- runs-on: ubuntu-latest
13
-
14
- steps:
15
- - uses: actions/checkout@v4
16
-
17
- - name: Setup bun
18
- uses: oven-sh/setup-bun@v2
19
- with:
20
- bun-version: latest
21
-
22
- - name: Install dependencies
23
- run: bun install
24
-
25
- - name: Run format check
26
- run: bun run format:check
@@ -1,92 +0,0 @@
1
- # Created using @tscircuit/plop (npm install -g @tscircuit/plop)
2
- name: Publish to npm
3
- on:
4
- push:
5
- branches:
6
- - main
7
- - '!version-bumps/**'
8
- workflow_dispatch:
9
-
10
- env:
11
- UPSTREAM_REPOS: "" # comma-separated list, e.g. "eval,tscircuit,docs"
12
- UPSTREAM_PACKAGES_TO_UPDATE: "" # comma-separated list, e.g. "@tscircuit/core,@tscircuit/protos"
13
-
14
- jobs:
15
- publish:
16
- runs-on: ubuntu-latest
17
- steps:
18
- - uses: actions/checkout@v4
19
- - name: Setup bun
20
- uses: oven-sh/setup-bun@v2
21
- with:
22
- bun-version: latest
23
- - uses: actions/setup-node@v4
24
- with:
25
- node-version: 20
26
- registry-url: https://registry.npmjs.org/
27
- - run: npm install -g pver
28
- - run: bun install --frozen-lockfile
29
- - run: bun run build
30
- - run: pver release --no-push-main
31
- env:
32
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
33
- GITHUB_TOKEN: ${{ secrets.TSCIRCUIT_BOT_GITHUB_TOKEN }}
34
-
35
- - name: Get package version
36
- id: package-version
37
- run: |
38
- VERSION=$(node -p "require('./package.json').version")
39
- echo "version=$VERSION" >> "$GITHUB_OUTPUT"
40
-
41
-
42
- - name: Create Pull Request
43
- id: create-pr
44
- uses: peter-evans/create-pull-request@v6
45
- with:
46
- commit-message: "chore: bump version"
47
- title: "chore: bump version to v${{ steps.package-version.outputs.version }}"
48
- body: "Automated package update"
49
- branch: version-bumps/v${{ steps.package-version.outputs.version }}
50
- base: main
51
- token: ${{ secrets.TSCIRCUIT_BOT_GITHUB_TOKEN }}
52
- committer: tscircuitbot <githubbot@tscircuit.com>
53
- author: tscircuitbot <githubbot@tscircuit.com>
54
-
55
- - name: Enable auto-merge
56
- if: steps.create-pr.outputs.pull-request-number != ''
57
- run: |
58
- gh pr merge ${{ steps.create-pr.outputs.pull-request-number }} --auto --squash --delete-branch
59
- env:
60
- GH_TOKEN: ${{ secrets.TSCIRCUIT_BOT_GITHUB_TOKEN }}
61
-
62
- - name: Trigger upstream repo updates
63
- if: env.UPSTREAM_REPOS && env.UPSTREAM_PACKAGES_TO_UPDATE
64
- run: |
65
- IFS=',' read -ra REPOS <<< "${{ env.UPSTREAM_REPOS }}"
66
- for repo in "${REPOS[@]}"; do
67
- if [[ -n "$repo" ]]; then
68
- echo "Triggering update for repo: $repo"
69
- curl -X POST \
70
- -H "Accept: application/vnd.github.v3+json" \
71
- -H "Authorization: token ${{ secrets.TSCIRCUIT_BOT_GITHUB_TOKEN }}" \
72
- -H "Content-Type: application/json" \
73
- "https://api.github.com/repos/tscircuit/$repo/actions/workflows/update-package.yml/dispatches" \
74
- -d "{\"ref\":\"main\",\"inputs\":{\"package_names\":\"${{ env.UPSTREAM_PACKAGES_TO_UPDATE }}\"}}"
75
- fi
76
- done
77
- - name: Notify release-tracker of version update
78
- # Continue-on-error just in case the tracker is down
79
- continue-on-error: true
80
- run: |
81
- VERSION=$(node -p "require('./package.json').version")
82
- PACKAGE_JSON=$(cat package.json)
83
- curl -X POST https://release-tracker.tscircuit.com/release_events/create \
84
- -H "Content-Type: application/json" \
85
- -d "{
86
- \"event\": {
87
- \"event_type\": \"versions_updated\",
88
- \"repo\": \"tscircuit/circuit-json-to-kicad\",
89
- \"version\": \"$VERSION\",
90
- \"package_json\": $PACKAGE_JSON
91
- }
92
- }"
@@ -1,40 +0,0 @@
1
- # Created using @tscircuit/plop (npm install -g @tscircuit/plop)
2
- name: Bun Test
3
-
4
- on:
5
- pull_request:
6
- push:
7
- branches:
8
- - main
9
- - '!version-bumps/**'
10
-
11
- jobs:
12
- test:
13
- runs-on: ubuntu-latest
14
- timeout-minutes: 5
15
-
16
- # Skip test for PRs that not chore: bump version
17
- if: "${{ github.event_name != 'pull_request' || github.event.pull_request.title != 'chore: bump version' }}"
18
-
19
- steps:
20
- - name: Checkout code
21
- uses: actions/checkout@v4
22
-
23
- - name: Setup bun
24
- uses: oven-sh/setup-bun@v2
25
- with:
26
- bun-version: latest
27
-
28
- - name: Install dependencies
29
- run: bun install
30
-
31
- - name: Run tests
32
- run: bun test
33
-
34
- - name: Upload snapshot artifacts
35
- if: always()
36
- uses: actions/upload-artifact@v4
37
- with:
38
- name: test-snapshots
39
- path: tests/**/__snapshots__/*.diff.png
40
- if-no-files-found: ignore
@@ -1,26 +0,0 @@
1
- # Created using @tscircuit/plop (npm install -g @tscircuit/plop)
2
- name: Type Check
3
-
4
- on:
5
- push:
6
- branches: [main]
7
- pull_request:
8
- branches: [main]
9
-
10
- jobs:
11
- type-check:
12
- runs-on: ubuntu-latest
13
-
14
- steps:
15
- - uses: actions/checkout@v4
16
-
17
- - name: Setup bun
18
- uses: oven-sh/setup-bun@v2
19
- with:
20
- bun-version: latest
21
-
22
- - name: Install dependencies
23
- run: bun i
24
-
25
- - name: Run type check
26
- run: bunx tsc --noEmit
package/biome.json DELETED
@@ -1,96 +0,0 @@
1
- {
2
- "$schema": "https://biomejs.dev/schemas/2.0.0/schema.json",
3
- "assist": { "actions": { "source": { "organizeImports": "on" } } },
4
- "formatter": {
5
- "enabled": true,
6
- "indentStyle": "space"
7
- },
8
- "files": {
9
- "includes": ["**", "!**/cosmos-export", "!**/dist", "!**/package.json"]
10
- },
11
- "javascript": {
12
- "formatter": {
13
- "jsxQuoteStyle": "double",
14
- "quoteProperties": "asNeeded",
15
- "trailingCommas": "all",
16
- "semicolons": "asNeeded",
17
- "arrowParentheses": "always",
18
- "bracketSpacing": true,
19
- "bracketSameLine": false
20
- }
21
- },
22
- "linter": {
23
- "enabled": true,
24
- "rules": {
25
- "recommended": true,
26
- "suspicious": {
27
- "noExplicitAny": "off"
28
- },
29
- "complexity": {
30
- "noForEach": "error",
31
- "useLiteralKeys": "off"
32
- },
33
- "correctness": {
34
- "useExhaustiveDependencies": "off"
35
- },
36
- "a11y": {
37
- "noAccessKey": "off",
38
- "noAriaHiddenOnFocusable": "off",
39
- "noAriaUnsupportedElements": "off",
40
- "noAutofocus": "off",
41
- "noDistractingElements": "off",
42
- "noHeaderScope": "off",
43
- "noInteractiveElementToNoninteractiveRole": "off",
44
- "noLabelWithoutControl": "off",
45
- "noNoninteractiveElementToInteractiveRole": "off",
46
- "noNoninteractiveTabindex": "off",
47
- "noPositiveTabindex": "off",
48
- "noRedundantAlt": "off",
49
- "noRedundantRoles": "off",
50
- "noStaticElementInteractions": "off",
51
- "noSvgWithoutTitle": "off",
52
- "useAltText": "off",
53
- "useAnchorContent": "off",
54
- "useAriaActivedescendantWithTabindex": "off",
55
- "useAriaPropsForRole": "off",
56
- "useAriaPropsSupportedByRole": "off",
57
- "useButtonType": "off",
58
- "useFocusableInteractive": "off",
59
- "useHeadingContent": "off",
60
- "useHtmlLang": "off",
61
- "useIframeTitle": "off",
62
- "useKeyWithClickEvents": "off",
63
- "useKeyWithMouseEvents": "off",
64
- "useMediaCaption": "off",
65
- "useSemanticElements": "off",
66
- "useValidAnchor": "off",
67
- "useValidAriaProps": "off",
68
- "useValidAriaRole": "off",
69
- "useValidAriaValues": "off",
70
- "useValidAutocomplete": "off",
71
- "useValidLang": "off"
72
- },
73
- "style": {
74
- "useSingleVarDeclarator": "error",
75
- "noParameterAssign": "off",
76
- "noUselessElse": "off",
77
- "noNonNullAssertion": "off",
78
- "useNumberNamespace": "off",
79
- "noUnusedTemplateLiteral": "off",
80
- "useFilenamingConvention": {
81
- "level": "error",
82
- "options": {
83
- "strictCase": true,
84
- "requireAscii": true,
85
- "filenameCases": ["kebab-case", "export"]
86
- }
87
- },
88
- "useAsConstAssertion": "error",
89
- "useDefaultParameterLast": "error",
90
- "useEnumInitializers": "error",
91
- "useSelfClosingElements": "error",
92
- "noInferrableTypes": "error"
93
- }
94
- }
95
- }
96
- }
package/bunfig.toml DELETED
@@ -1,5 +0,0 @@
1
- [test]
2
- preload = ["./tests/fixtures/preload.ts"]
3
-
4
- [install.lockfile]
5
- save = false
@@ -1,5 +0,0 @@
1
- {
2
- "$schema": "http://json.schemastore.org/cosmos-config",
3
- "plugins": ["react-cosmos-plugin-vite"],
4
- "decoratorFile": "cosmos.decorator.tsx"
5
- }
@@ -1,21 +0,0 @@
1
- import React, { useEffect } from "react"
2
-
3
- export const TailwindDecorator = ({
4
- children,
5
- }: {
6
- children: React.ReactNode
7
- }) => {
8
- useEffect(() => {
9
- const script = document.createElement("script")
10
- script.src = "https://cdn.tailwindcss.com"
11
- document.head.appendChild(script)
12
-
13
- return () => {
14
- document.head.removeChild(script)
15
- }
16
- }, [])
17
-
18
- return <>{children}</>
19
- }
20
-
21
- export default TailwindDecorator
@@ -1,15 +0,0 @@
1
- {
2
- "bounds": { "minX": 0, "minY": 0, "maxX": 100, "maxY": 100 },
3
- "waypointPairs": [
4
- {
5
- "start": { "x": 0, "y": 10 },
6
- "end": { "x": 100, "y": 80 }
7
- },
8
- {
9
- "start": { "x": 0, "y": 20 },
10
- "end": { "x": 100, "y": 90 }
11
- }
12
- ],
13
- "obstacles": [],
14
- "preferredSpacing": 25
15
- }
@@ -1,11 +0,0 @@
1
- import { GenericSolverDebugger } from "@tscircuit/solver-utils/react"
2
- import type { CurvyTraceProblem } from "../../lib/types"
3
- import { CurvyTraceSolver } from "../../lib/CurvyTraceSolver"
4
- import problem from "./basics01-input.json"
5
- export default () => {
6
- return (
7
- <GenericSolverDebugger
8
- createSolver={() => new CurvyTraceSolver(problem as CurvyTraceProblem)}
9
- />
10
- )
11
- }
@@ -1,50 +0,0 @@
1
- import { useState, useMemo } from "react"
2
- import { GenericSolverDebugger } from "@tscircuit/solver-utils/react"
3
- import { generateRandomProblem } from "../lib/problem-generator"
4
- import { CurvyTraceSolver } from "../lib/CurvyTraceSolver"
5
- import type { CurvyTraceProblem } from "../lib/types"
6
-
7
- export default () => {
8
- const [randomSeed, setRandomSeed] = useState(1)
9
- const [numWaypointPairs, setNumWaypointPairs] = useState(5)
10
-
11
- const problem = useMemo(() => {
12
- return generateRandomProblem({
13
- randomSeed,
14
- numWaypointPairs,
15
- numObstacles: 3,
16
- minSpacing: 5,
17
- })
18
- }, [randomSeed, numWaypointPairs])
19
-
20
- return (
21
- <div style={{ padding: 16 }}>
22
- <div style={{ marginBottom: 16, display: "flex", gap: 16 }}>
23
- <label>
24
- Random Seed:{" "}
25
- <input
26
- type="number"
27
- value={randomSeed}
28
- onChange={(e) => setRandomSeed(Number(e.target.value))}
29
- style={{ width: 80 }}
30
- />
31
- </label>
32
- <label>
33
- Waypoint Pairs:{" "}
34
- <input
35
- type="number"
36
- value={numWaypointPairs}
37
- onChange={(e) => setNumWaypointPairs(Number(e.target.value))}
38
- style={{ width: 80 }}
39
- min={1}
40
- max={20}
41
- />
42
- </label>
43
- </div>
44
- <GenericSolverDebugger
45
- key={`${randomSeed}-${numWaypointPairs}`}
46
- createSolver={() => new CurvyTraceSolver(problem as CurvyTraceProblem)}
47
- />
48
- </div>
49
- )
50
- }
package/index.html DELETED
@@ -1,12 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <title>React Cosmos Vite Renderer</title>
7
- </head>
8
- <body>
9
- <div id="root"></div>
10
- <script type="module" src="/src/main.tsx"></script>
11
- </body>
12
- </html>