schematic-symbols 0.0.5 → 0.0.7

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.
@@ -0,0 +1,26 @@
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@v3
16
+
17
+ - name: Setup bun
18
+ uses: oven-sh/setup-bun@v1
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
@@ -0,0 +1,26 @@
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@v3
16
+
17
+ - name: Setup bun
18
+ uses: oven-sh/setup-bun@v1
19
+ with:
20
+ bun-version: latest
21
+
22
+ - name: Install dependencies
23
+ run: bun i
24
+
25
+ - name: Run format check
26
+ run: bunx tsc --noEmit
@@ -0,0 +1,49 @@
1
+ name: Format PR
2
+
3
+ on:
4
+ pull_request:
5
+ types: [opened, synchronize, reopened, ready_for_review]
6
+
7
+ jobs:
8
+ format:
9
+ name: Format code
10
+ runs-on: ubuntu-latest
11
+ if: github.event.pull_request.draft == false
12
+
13
+ steps:
14
+ - name: Checkout code
15
+ uses: actions/checkout@v3
16
+ with:
17
+ token: ${{ secrets.TSCIRCUIT_BOT_GITHUB_TOKEN }}
18
+
19
+ - name: Setup Node.js
20
+ uses: actions/setup-node@v3
21
+ with:
22
+ node-version: '20'
23
+
24
+ - name: Get @biomejs/biome version
25
+ id: get-biome-version
26
+ run: echo "BIOME_VERSION=$(node -p "require('./package.json').devDependencies['@biomejs/biome']")" >> $GITHUB_OUTPUT
27
+
28
+ - name: Install @biomejs/biome
29
+ run: npm install @biomejs/biome@${{ steps.get-biome-version.outputs.BIOME_VERSION }}
30
+
31
+ - name: Run formatter
32
+ run: npx @biomejs/biome format . --write
33
+
34
+ - name: Restore lock files
35
+ run: |
36
+ git checkout -- *lock.json || true
37
+ git checkout -- *.lock || true
38
+ git checkout -- *.lockb || true
39
+ git checkout -- package.json || true
40
+
41
+ - name: Commit changes
42
+ uses: stefanzweifel/git-auto-commit-action@v4
43
+ with:
44
+ commit_message: "formatbot: Automatically format code"
45
+ branch: ${{ github.head_ref }}
46
+ commit_user_name: tscircuitbot
47
+ commit_user_email: tscircuitbot@users.noreply.github.com
48
+ commit_author: tscircuitbot <tscircuitbot@users.noreply.github.com>
49
+ file_pattern: "*.ts *.tsx"
@@ -87,4 +87,4 @@
87
87
  "centerX": 2.220446049250313e-16,
88
88
  "centerY": 0
89
89
  }
90
- }
90
+ }
@@ -73,4 +73,4 @@
73
73
  "centerX": 0,
74
74
  "centerY": -1.7763568394002505e-15
75
75
  }
76
- }
76
+ }
@@ -80,4 +80,4 @@
80
80
  "centerX": -2.220446049250313e-16,
81
81
  "centerY": 8.881784197001252e-16
82
82
  }
83
- }
83
+ }
@@ -88,4 +88,4 @@
88
88
  "centerX": 2.220446049250313e-16,
89
89
  "centerY": -1.7763568394002505e-15
90
90
  }
91
- }
91
+ }
@@ -163,4 +163,4 @@
163
163
  "centerX": -2.220446049250313e-16,
164
164
  "centerY": 3.552713678800501e-15
165
165
  }
166
- }
166
+ }
@@ -73,4 +73,4 @@
73
73
  "centerX": 0,
74
74
  "centerY": 0
75
75
  }
76
- }
76
+ }
@@ -28,4 +28,4 @@
28
28
  "centerX": 0,
29
29
  "centerY": 0
30
30
  }
31
- }
31
+ }
@@ -81,4 +81,4 @@
81
81
  "centerX": -8.881784197001252e-16,
82
82
  "centerY": 0
83
83
  }
84
- }
84
+ }
@@ -202,4 +202,4 @@
202
202
  "centerX": 0,
203
203
  "centerY": -1.7763568394002505e-15
204
204
  }
205
- }
205
+ }
@@ -264,4 +264,4 @@
264
264
  "centerX": 4.440892098500626e-16,
265
265
  "centerY": 0
266
266
  }
267
- }
267
+ }
@@ -134,4 +134,4 @@
134
134
  "centerX": 1.1102230246251565e-16,
135
135
  "centerY": 0
136
136
  }
137
- }
137
+ }
@@ -157,4 +157,4 @@
157
157
  "centerX": -1.1102230246251565e-16,
158
158
  "centerY": 0
159
159
  }
160
- }
160
+ }
@@ -32,4 +32,4 @@
32
32
  "centerX": 0,
33
33
  "centerY": 0
34
34
  }
35
- }
35
+ }
@@ -126,4 +126,4 @@
126
126
  "centerX": 0,
127
127
  "centerY": 8.881784197001252e-16
128
128
  }
129
- }
129
+ }
package/bun.lockb CHANGED
Binary file
@@ -4,6 +4,6 @@ export function pathToSvgD(points: Point[], closed: boolean = false): string {
4
4
  const pathCommands = points
5
5
  .map((point, index) => `${index === 0 ? "M" : "L"}${point.x},${point.y}`)
6
6
  .join(" ")
7
-
7
+
8
8
  return closed ? `${pathCommands} Z` : pathCommands
9
9
  }
package/drawing/types.ts CHANGED
@@ -11,7 +11,7 @@ export interface Port {
11
11
 
12
12
  export interface PathPrimitive {
13
13
  type: "path"
14
- fill: boolean
14
+ fill?: boolean
15
15
  points: Point[]
16
16
  color: string
17
17
  closed?: boolean
package/package.json CHANGED
@@ -1,15 +1,18 @@
1
1
  {
2
2
  "name": "schematic-symbols",
3
3
  "main": "./dist/index.cjs",
4
- "version": "0.0.5",
4
+ "types": "./index.ts",
5
+ "version": "0.0.7",
5
6
  "type": "module",
6
7
  "scripts": {
7
8
  "start": "bun run build && bun --hot run dev-server.ts",
8
9
  "build": "rm symbols/index.ts && bunx make-vfs ./symbols --content-format import-default --outfile ./symbols/index.ts && tsup ./index.ts --dts --sourcemap",
9
10
  "generate": "bun run scripts/generate-symbols-from-asset-svgs.ts",
11
+ "format:check": "bunx biome format",
10
12
  "vercel-build": "bun run ./scripts/build.ts"
11
13
  },
12
14
  "devDependencies": {
15
+ "@biomejs/biome": "^1.8.3",
13
16
  "@types/bun": "latest",
14
17
  "@types/svg-path-parser": "^1.1.6",
15
18
  "make-vfs": "1.0.10",
@@ -1,3 +1,4 @@
1
+ // @ts-ignore
1
2
  import symbolsSvg from "../assets/symbols.svg" with { type: "text" }
2
3
  import { parse, type INode } from "svgson"
3
4
  import fs from "node:fs"
@@ -61,7 +61,7 @@ export function applyGroupTransformsToChildren(group: INode) {
61
61
 
62
62
  return child
63
63
  })
64
- .filter((c: INode | null): INode => c as INode)
64
+ .filter((c: INode | null): INode => c as INode) as INode[]
65
65
 
66
66
  // Remove the transform from the group since it's now applied to children
67
67
  delete group.attributes.transform
@@ -114,5 +114,6 @@ export function transformPath(pathData: string, matrix: Matrix): string {
114
114
 
115
115
  export function convertRectToPath(child: INode): INode {
116
116
  const { x, y, width, height } = child.attributes as any
117
- return null
117
+ // TODO
118
+ return null as any
118
119
  }
@@ -30,6 +30,7 @@ export function serializeSvgPathCommands(pathData: Command[]): string {
30
30
  case "s":
31
31
  case "Q":
32
32
  case "q":
33
+ // @ts-ignore
33
34
  result += `${command.x1},${command.y1} ${command.x},${command.y}`
34
35
  break
35
36
  case "A":
@@ -1,4 +1,4 @@
1
1
  import { rotateSymbol } from "drawing/rotateSymbol"
2
2
  import fuse_horz from "./fuse_horz"
3
3
 
4
- export default rotateSymbol(fuse_horz)
4
+ export default rotateSymbol(fuse_horz)
@@ -1,4 +1,4 @@
1
1
  import { rotateSymbol } from "drawing/rotateSymbol"
2
2
  import led_horz from "./led_horz"
3
3
 
4
- export default rotateSymbol(led_horz)
4
+ export default rotateSymbol(led_horz)