schematic-symbols 0.0.25 → 0.0.26
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.
- package/README.md +13 -4
- package/dist/index.d.ts +7 -1
- package/dist/index.js +481 -81
- package/dist/index.js.map +1 -1
- package/drawing/getSvg.ts +5 -1
- package/drawing/types.ts +3 -0
- package/package.json +9 -5
- package/symbols/photodiode_horz.ts +32 -0
- package/symbols/photodiode_vert.ts +13 -0
- package/symbols/volt_meter_horz.ts +31 -0
- package/symbols/volt_meter_vert.ts +4 -0
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "schematic-symbols",
|
3
3
|
"main": "./dist/index.js",
|
4
|
-
"version": "0.0.
|
4
|
+
"version": "0.0.26",
|
5
5
|
"type": "module",
|
6
6
|
"files": [
|
7
7
|
"dist",
|
@@ -11,17 +11,22 @@
|
|
11
11
|
],
|
12
12
|
"scripts": {
|
13
13
|
"start": "bun run build && bun --hot run dev-server.ts",
|
14
|
+
"dev": "bun run start",
|
14
15
|
"build": "bunx make-vfs ./symbols --content-format import-default --outfile ./generated/symbols-index.ts && tsup-node ./index.ts --format esm --dts --sourcemap && bun run scripts/generate-base-symbol-names.ts",
|
15
|
-
"generate": "bun run scripts/generate-
|
16
|
+
"generate": "bun run scripts/generate-symbol-from-asset-svg.ts && bun run format",
|
17
|
+
"generate:all": "bun run scripts/generate-symbols-from-asset-svgs.ts && bun run format",
|
16
18
|
"format:check": "bunx biome format",
|
17
19
|
"format": "bunx biome format . --write",
|
18
20
|
"vercel-build": "bun run ./scripts/build.ts"
|
19
21
|
},
|
20
22
|
"devDependencies": {
|
21
|
-
"@biomejs/biome": "^1.
|
23
|
+
"@biomejs/biome": "^1.9.2",
|
22
24
|
"@types/bun": "latest",
|
25
|
+
"@types/prompts": "^2.4.9",
|
23
26
|
"@types/svg-path-parser": "^1.1.6",
|
27
|
+
"kleur": "^4.1.5",
|
24
28
|
"make-vfs": "1.0.15",
|
29
|
+
"prompts": "^2.4.2",
|
25
30
|
"svg-path-parser": "^1.1.0",
|
26
31
|
"svgson": "^5.3.1",
|
27
32
|
"transformation-matrix": "^2.16.1",
|
@@ -29,6 +34,5 @@
|
|
29
34
|
},
|
30
35
|
"peerDependencies": {
|
31
36
|
"typescript": "^5.5.4"
|
32
|
-
}
|
33
|
-
"dependencies": {}
|
37
|
+
}
|
34
38
|
}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
import { defineSymbol } from "drawing/defineSymbol"
|
2
|
+
import svgJson from "assets/generated/photodiode.json"
|
3
|
+
import { TextPrimitive } from "drawing/types"
|
4
|
+
|
5
|
+
const { paths, texts, bounds, refblocks, circles } = svgJson
|
6
|
+
|
7
|
+
export default defineSymbol({
|
8
|
+
primitives: [
|
9
|
+
...Object.values(paths),
|
10
|
+
...Object.values(circles),
|
11
|
+
{
|
12
|
+
type: "text",
|
13
|
+
text: "{REF}",
|
14
|
+
x: -0.15,
|
15
|
+
y: -0.20318344999999938,
|
16
|
+
anchor: "middle_right",
|
17
|
+
} as TextPrimitive,
|
18
|
+
{
|
19
|
+
type: "text",
|
20
|
+
text: "{VAL}",
|
21
|
+
x: -0.00984920000000078,
|
22
|
+
y: 0.5,
|
23
|
+
anchor: "middle_top",
|
24
|
+
} as TextPrimitive,
|
25
|
+
] as any,
|
26
|
+
ports: [
|
27
|
+
{ ...refblocks.left1, labels: ["1"] }, // TODO add more "standard" labels
|
28
|
+
{ ...refblocks.right1, labels: ["2"] }, // TODO add more "standard" labels
|
29
|
+
],
|
30
|
+
size: { width: bounds.width, height: bounds.height },
|
31
|
+
center: { x: bounds.centerX, y: bounds.centerY },
|
32
|
+
})
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { rotateSymbol } from "drawing/rotateSymbol"
|
2
|
+
import photodiode_horz from "./photodiode_horz"
|
3
|
+
|
4
|
+
const rotatedSymbol = rotateSymbol(photodiode_horz)
|
5
|
+
|
6
|
+
const texts = rotatedSymbol.primitives.filter((p) => p.type === "text")
|
7
|
+
|
8
|
+
const ref = texts.find((t) => t.text === "{REF}")!
|
9
|
+
|
10
|
+
ref.y = 0
|
11
|
+
ref.anchor = "middle_left"
|
12
|
+
|
13
|
+
export default rotatedSymbol
|
@@ -0,0 +1,31 @@
|
|
1
|
+
import { defineSymbol } from "drawing/defineSymbol"
|
2
|
+
import svgJson from "assets/generated/volt_meter.json"
|
3
|
+
|
4
|
+
const { paths, texts, bounds, circles, refblocks } = svgJson
|
5
|
+
|
6
|
+
export default defineSymbol({
|
7
|
+
primitives: [
|
8
|
+
...Object.values(paths),
|
9
|
+
...Object.values(circles),
|
10
|
+
{
|
11
|
+
type: "text",
|
12
|
+
text: "{REF}",
|
13
|
+
x: 0,
|
14
|
+
y: -0.3594553499999995,
|
15
|
+
anchor: "middle_bottom",
|
16
|
+
},
|
17
|
+
{
|
18
|
+
type: "text",
|
19
|
+
text: "{VAL}",
|
20
|
+
x: 0,
|
21
|
+
y: 0.35,
|
22
|
+
anchor: "middle_top",
|
23
|
+
},
|
24
|
+
] as any,
|
25
|
+
ports: [
|
26
|
+
{ ...refblocks.left1, labels: ["1"] }, // TODO add more "standard" labels
|
27
|
+
{ ...refblocks.right1, labels: ["2"] }, // TODO add more "standard" labels
|
28
|
+
],
|
29
|
+
size: { width: bounds.width, height: bounds.height },
|
30
|
+
center: { x: bounds.centerX, y: bounds.centerY },
|
31
|
+
})
|