circuitscript 0.0.12 → 0.0.14
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/.gitlab-ci.yml +1 -0
- package/__tests__/renderData/script1.cst.svg +1 -1
- package/__tests__/renderData/script2.cst.svg +1 -1
- package/__tests__/renderData/script3.cst.svg +1 -1
- package/__tests__/renderData/script4.cst.svg +1 -1
- package/__tests__/renderData/script5.cst +23 -0
- package/__tests__/renderData/script5.cst.svg +1 -0
- package/__tests__/testCLI.ts +68 -0
- package/__tests__/testRender.ts +2 -1
- package/build/src/draw_symbols.js +5 -6
- package/build/src/globals.js +2 -1
- package/build/src/helpers.js +69 -0
- package/build/src/main.js +5 -74
- package/build/src/parser.js +0 -6
- package/build/src/regenerate-tests.js +1 -1
- package/build/src/sizing.js +4 -10
- package/examples/example_arduino_uno.cst +159 -138
- package/package.json +1 -1
- package/src/draw_symbols.ts +7 -9
- package/src/geometry.ts +2 -1
- package/src/globals.ts +3 -1
- package/src/helpers.ts +111 -0
- package/src/main.ts +6 -121
- package/src/parser.ts +6 -6
- package/src/regenerate-tests.ts +1 -1
- package/src/sizing.ts +5 -8
- /package/{server.js → server.cjs} +0 -0
package/.gitlab-ci.yml
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svgjs="http://svgjs.dev/svgjs" width="410" height="510.5" viewBox="-25 -25.5 410 510.5"><g transform="matrix(1,0,0,1,0,0)"><path d="M -20 -20.5 L -20 480 M 0 -20.5 L 0 480 M 20 -20.5 L 20 480 M 40 -20.5 L 40 480 M 60 -20.5 L 60 480 M 80 -20.5 L 80 480 M 100 -20.5 L 100 480 M 120 -20.5 L 120 480 M 140 -20.5 L 140 480 M 160 -20.5 L 160 480 M 180 -20.5 L 180 480 M 200 -20.5 L 200 480 M 220 -20.5 L 220 480 M 240 -20.5 L 240 480 M 260 -20.5 L 260 480 M 280 -20.5 L 280 480 M 300 -20.5 L 300 480 M 320 -20.5 L 320 480 M 340 -20.5 L 340 480 M 360 -20.5 L 360 480 M 380 -20.5 L 380 480" fill="none" stroke-dasharray="1,19" stroke-width="1" stroke="#aaaaaa"></path></g><g transform="matrix(1,0,0,1,20,30)"><g><path d="M -15 0 L 15 0" stroke-width="1" stroke="#333333" fill="none"></path><path d="M 0 10 L 0 0" stroke-width="2" stroke="#333333"></path><text fill="#333333" font-family="Inter" font-size="10" text-anchor="middle" dominant-baseline="text-top" transform="matrix(1,0,0,1,0,-5)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">5V</tspan></text></g></g><g transform="matrix(1,0,0,1,20.000000000000004,120)"><g><path d="M 9.999999999999998 -20 L 10.000000000000002 20 L -9.999999999999998 20 L -10.000000000000002 -20 Z" stroke-width="1" stroke="#333333" fill="#ffffff"></path><path d="M -2.4492935982947065e-15 -40 L -1.2246467991473533e-15 -20 M 2.4492935982947065e-15 40 L 1.2246467991473533e-15 20" stroke-width="2" stroke="#333333"></path><text fill="#333333" font-family="Inter" font-size="10" text-anchor="middle" dominant-baseline="middle" transform="matrix(6.123233995736766e-17,1,-1,6.123233995736766e-17,-1,6.123233995736766e-17)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">10k</tspan></text><text fill="#333333" font-family="Inter" font-size="10" text-anchor="start" dominant-baseline="text-top" transform="matrix(6.123233995736766e-17,1,-1,6.123233995736766e-17,14.999999999999998,-20)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">R1</tspan></text><path d="M -10.000000000000002 -40 L 10.000000000000002 40 M 10.000000000000002 -40 L -10.000000000000002 40" stroke-width="2" stroke="red"></path></g></g><g transform="matrix(1,0,0,1,20.000000000000004,190)"><g><path d="M -10 0 L 10 0 L 0 10 Z" stroke-width="1" stroke="#333333" fill="#ffffff"></path><path d="M 0 -10 L 0 0" stroke-width="2" stroke="#333333"></path><text fill="#333333" font-family="Inter" font-size="10" text-anchor="middle" dominant-baseline="text-top" transform="matrix(1,0,0,1,0,20)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">GND</tspan></text></g></g><g transform="matrix(1,0,0,1,60,120)"><g><path d="M 9.999999999999998 -20 L 10.000000000000002 20 L -9.999999999999998 20 L -10.000000000000002 -20 Z" stroke-width="1" stroke="#333333" fill="#ffffff"></path><path d="M -2.4492935982947065e-15 -40 L -1.2246467991473533e-15 -20 M 2.4492935982947065e-15 40 L 1.2246467991473533e-15 20" stroke-width="2" stroke="#333333"></path><text fill="#333333" font-family="Inter" font-size="10" text-anchor="middle" dominant-baseline="middle" transform="matrix(6.123233995736766e-17,1,-1,6.123233995736766e-17,-1,6.123233995736766e-17)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">20k</tspan></text><text fill="#333333" font-family="Inter" font-size="10" text-anchor="start" dominant-baseline="text-top" transform="matrix(6.123233995736766e-17,1,-1,6.123233995736766e-17,14.999999999999998,-20)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">R2</tspan></text></g></g><g transform="matrix(1,0,0,1,60,190)"><g><path d="M -10 0 L 10 0 L 0 10 Z" stroke-width="1" stroke="#333333" fill="#ffffff"></path><path d="M 0 -10 L 0 0" stroke-width="2" stroke="#333333"></path><text fill="#333333" font-family="Inter" font-size="10" text-anchor="middle" dominant-baseline="text-top" transform="matrix(1,0,0,1,0,20)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">GND</tspan></text></g></g><g transform="matrix(1,0,0,1,100,100)"><g><path d="M -10 -3 L 10 -3" stroke-width="1" stroke="#333333" fill="none"></path><path d="M -10 3 L 10 3" stroke-width="1" stroke="#333333" fill="none"></path><path d="M 0 -20 L 0 -3 M 0 20 L 0 3" stroke-width="2" stroke="#333333"></path><text fill="#333333" font-family="Inter" font-size="10" text-anchor="start" dominant-baseline="text-top" transform="matrix(1,0,0,1,12,0)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">C1</tspan></text><text fill="#333333" font-family="Inter" font-size="10" text-anchor="start" dominant-baseline="hanging" transform="matrix(1,0,0,1,12,5)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">100n</tspan></text></g></g><g transform="matrix(1,0,0,1,100,150)"><g><path d="M -10 0 L 10 0 L 0 10 Z" stroke-width="1" stroke="#333333" fill="#ffffff"></path><path d="M 0 -10 L 0 0" stroke-width="2" stroke="#333333"></path><text fill="#333333" font-family="Inter" font-size="10" text-anchor="middle" dominant-baseline="text-top" transform="matrix(1,0,0,1,0,20)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">GND</tspan></text></g></g><g transform="matrix(1,0,0,1,140,60)"><g><path d="M 0 0 L 0 0" stroke-width="2" stroke="#333333"></path></g></g><g transform="matrix(1,0,0,1,210,80)"><g><path d="M -50 -40 L 50 -40 L 50 40 L -50 40 Z" stroke-width="1" stroke="#333333" fill="#fffeaf"></path><path d="M -70 -20 L -50 -20 M -70 0 L -50 0 M -70 20 L -50 20 M 70 -20 L 50 -20 M 70 0 L 50 0 M 70 20 L 50 20" stroke-width="2" stroke="#333333"></path><text fill="#333333" font-family="Inter" font-size="10" text-anchor="start" dominant-baseline="middle" transform="matrix(1,0,0,1,-46,-20)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">1</tspan></text><text fill="#333333" font-family="Inter" font-size="8" text-anchor="end" dominant-baseline="text-top" transform="matrix(1,0,0,1,-52,-22)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">1</tspan></text><text fill="#333333" font-family="Inter" font-size="10" text-anchor="start" dominant-baseline="middle" transform="matrix(1,0,0,1,-46,0)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">2</tspan></text><text fill="#333333" font-family="Inter" font-size="8" text-anchor="end" dominant-baseline="text-top" transform="matrix(1,0,0,1,-52,-2)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">2</tspan></text><text fill="#333333" font-family="Inter" font-size="10" text-anchor="start" dominant-baseline="middle" transform="matrix(1,0,0,1,-46,20)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">3</tspan></text><text fill="#333333" font-family="Inter" font-size="8" text-anchor="end" dominant-baseline="text-top" transform="matrix(1,0,0,1,-52,18)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">3</tspan></text><text fill="#333333" font-family="Inter" font-size="10" text-anchor="end" dominant-baseline="middle" transform="matrix(1,0,0,1,46,-20)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">6</tspan></text><text fill="#333333" font-family="Inter" font-size="8" text-anchor="start" dominant-baseline="text-top" transform="matrix(1,0,0,1,52,-22)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">6</tspan></text><text fill="#333333" font-family="Inter" font-size="10" text-anchor="end" dominant-baseline="middle" transform="matrix(1,0,0,1,46,0)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">5</tspan></text><text fill="#333333" font-family="Inter" font-size="8" text-anchor="start" dominant-baseline="text-top" transform="matrix(1,0,0,1,52,-2)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">5</tspan></text><text fill="#333333" font-family="Inter" font-size="10" text-anchor="end" dominant-baseline="middle" transform="matrix(1,0,0,1,46,20)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">4</tspan></text><text fill="#333333" font-family="Inter" font-size="8" text-anchor="start" dominant-baseline="text-top" transform="matrix(1,0,0,1,52,18)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">4</tspan></text><text fill="#333333" font-family="Inter" font-size="10" text-anchor="start" dominant-baseline="text-top" transform="matrix(1,0,0,1,-50,-44)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">tmp</tspan></text></g></g><g transform="matrix(1,0,0,1,300,130)"><g><path d="M -10 0 L 10 0 L 0 10 Z" stroke-width="1" stroke="#333333" fill="#ffffff"></path><path d="M 0 -10 L 0 0" stroke-width="2" stroke="#333333"></path><text fill="#333333" font-family="Inter" font-size="10" text-anchor="middle" dominant-baseline="text-top" transform="matrix(1,0,0,1,0,20)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">GND</tspan></text></g></g><g transform="matrix(1,0,0,1,340,140)"><g><path d="M 9.999999999999998 -20 L 10.000000000000002 20 L -9.999999999999998 20 L -10.000000000000002 -20 Z" stroke-width="1" stroke="#333333" fill="#ffffff"></path><path d="M -2.4492935982947065e-15 -40 L -1.2246467991473533e-15 -20 M 2.4492935982947065e-15 40 L 1.2246467991473533e-15 20" stroke-width="2" stroke="#333333"></path><text fill="#333333" font-family="Inter" font-size="10" text-anchor="middle" dominant-baseline="middle" transform="matrix(6.123233995736766e-17,1,-1,6.123233995736766e-17,-1,6.123233995736766e-17)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">10k</tspan></text><text fill="#333333" font-family="Inter" font-size="10" text-anchor="start" dominant-baseline="text-top" transform="matrix(6.123233995736766e-17,1,-1,6.123233995736766e-17,14.999999999999998,-20)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">R3</tspan></text><path d="M -10.000000000000002 -40 L 10.000000000000002 40 M 10.000000000000002 -40 L -10.000000000000002 40" stroke-width="2" stroke="red"></path></g></g><g transform="matrix(1,0,0,1,340,210)"><g><path d="M -10 0 L 10 0 L 0 10 Z" stroke-width="1" stroke="#333333" fill="#ffffff"></path><path d="M 0 -10 L 0 0" stroke-width="2" stroke="#333333"></path><text fill="#333333" font-family="Inter" font-size="10" text-anchor="middle" dominant-baseline="text-top" transform="matrix(1,0,0,1,0,20)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">GND</tspan></text></g></g><g transform="matrix(1,0,0,1,180,290)"><g><path d="M -15 0 L 15 0" stroke-width="1" stroke="#333333" fill="none"></path><path d="M 0 10 L 0 0" stroke-width="2" stroke="#333333"></path><text fill="#333333" font-family="Inter" font-size="10" text-anchor="middle" dominant-baseline="text-top" transform="matrix(1,0,0,1,0,-5)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">3V</tspan></text></g></g><g transform="matrix(1,0,0,1,180,360)"><g><path d="M 9.999999999999998 -20 L 10.000000000000002 20 L -9.999999999999998 20 L -10.000000000000002 -20 Z" stroke-width="1" stroke="#333333" fill="#ffffff"></path><path d="M -2.4492935982947065e-15 -40 L -1.2246467991473533e-15 -20 M 2.4492935982947065e-15 40 L 1.2246467991473533e-15 20" stroke-width="2" stroke="#333333"></path><text fill="#333333" font-family="Inter" font-size="10" text-anchor="middle" dominant-baseline="middle" transform="matrix(6.123233995736766e-17,1,-1,6.123233995736766e-17,-1,6.123233995736766e-17)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">20k</tspan></text><text fill="#333333" font-family="Inter" font-size="10" text-anchor="start" dominant-baseline="text-top" transform="matrix(6.123233995736766e-17,1,-1,6.123233995736766e-17,14.999999999999998,-20)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">R4</tspan></text></g></g><g transform="matrix(1,0,0,1,180,430)"><g><path d="M -10 0 L 10 0 L 0 10 Z" stroke-width="1" stroke="#333333" fill="#ffffff"></path><path d="M 0 -10 L 0 0" stroke-width="2" stroke="#333333"></path><text fill="#333333" font-family="Inter" font-size="10" text-anchor="middle" dominant-baseline="text-top" transform="matrix(1,0,0,1,0,20)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">GND</tspan></text></g></g><g><line x1="20" y1="40" x2="20" y2="60" stroke-linecap="square" stroke-width="1" stroke="#008400" fill="none"></line><line x1="20" y1="60" x2="20" y2="80" stroke-linecap="square" stroke-width="1" stroke="#008400" fill="none"></line><line x1="20" y1="60" x2="60" y2="60" stroke-linecap="square" stroke-width="1" stroke="#008400" fill="none"></line><line x1="60" y1="60" x2="60" y2="80" stroke-linecap="square" stroke-width="1" stroke="#008400" fill="none"></line><line x1="60" y1="60" x2="100" y2="60" stroke-linecap="square" stroke-width="1" stroke="#008400" fill="none"></line><line x1="100" y1="60" x2="100" y2="80" stroke-linecap="square" stroke-width="1" stroke="#008400" fill="none"></line><line x1="100" y1="60" x2="140" y2="60" stroke-linecap="square" stroke-width="1" stroke="#008400" fill="none"></line><circle r="2.5" cx="2.5" cy="2.5" transform="matrix(1,0,0,1,17.5,57.5)" fill="#008400" stroke="none"></circle><circle r="2.5" cx="2.5" cy="2.5" transform="matrix(1,0,0,1,57.5,57.5)" fill="#008400" stroke="none"></circle><circle r="2.5" cx="2.5" cy="2.5" transform="matrix(1,0,0,1,97.5,57.5)" fill="#008400" stroke="none"></circle><line x1="20.000000000000004" y1="160" x2="20.000000000000004" y2="180" stroke-linecap="square" stroke-width="1" stroke="#008400" fill="none"></line><line x1="60" y1="160" x2="60" y2="180" stroke-linecap="square" stroke-width="1" stroke="#008400" fill="none"></line><line x1="100" y1="120" x2="100" y2="140" stroke-linecap="square" stroke-width="1" stroke="#008400" fill="none"></line><line x1="280" y1="100" x2="300" y2="100" stroke-linecap="square" stroke-width="1" stroke="#008400" fill="none"></line><line x1="300" y1="100" x2="300" y2="120" stroke-linecap="square" stroke-width="1" stroke="#008400" fill="none"></line><line x1="340" y1="180" x2="340" y2="200" stroke-linecap="square" stroke-width="1" stroke="#008400" fill="none"></line><line x1="180" y1="400" x2="180" y2="420" stroke-linecap="square" stroke-width="1" stroke="#008400" fill="none"></line><line x1="280" y1="80" x2="340" y2="80" stroke-linecap="square" stroke-width="1" stroke="#008400" fill="none"></line><line x1="340" y1="80" x2="340" y2="100" stroke-linecap="square" stroke-width="1" stroke="#008400" fill="none"></line><line x1="180" y1="300" x2="180" y2="320" stroke-linecap="square" stroke-width="1" stroke="#008400" fill="none"></line></g><g></g></svg>
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svgjs="http://svgjs.dev/svgjs" width="410" height="510.5" viewBox="-25 -25.5 410 510.5"><g transform="matrix(1,0,0,1,0,0)"><path d="M -20 -20.5 L -20 480 M 0 -20.5 L 0 480 M 20 -20.5 L 20 480 M 40 -20.5 L 40 480 M 60 -20.5 L 60 480 M 80 -20.5 L 80 480 M 100 -20.5 L 100 480 M 120 -20.5 L 120 480 M 140 -20.5 L 140 480 M 160 -20.5 L 160 480 M 180 -20.5 L 180 480 M 200 -20.5 L 200 480 M 220 -20.5 L 220 480 M 240 -20.5 L 240 480 M 260 -20.5 L 260 480 M 280 -20.5 L 280 480 M 300 -20.5 L 300 480 M 320 -20.5 L 320 480 M 340 -20.5 L 340 480 M 360 -20.5 L 360 480 M 380 -20.5 L 380 480" fill="none" stroke-dasharray="1,19" stroke-width="1" stroke="#aaaaaa"></path></g><g transform="matrix(1,0,0,1,20,30)"><g><path d="M -15 0 L 15 0" stroke-width="1" stroke="#333333" fill="none"></path><path d="M 0 10 L 0 0" stroke-width="2" stroke="#333333"></path><text fill="#333333" font-family="Open Sans-Regular, Arial" font-size="10" text-anchor="middle" dominant-baseline="text-top" font-weight="regular" transform="matrix(1,0,0,1,0,-5)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">5V</tspan></text></g></g><g transform="matrix(1,0,0,1,20.000000000000004,120)"><g><path d="M 9.999999999999998 -20 L 10.000000000000002 20 L -9.999999999999998 20 L -10.000000000000002 -20 Z" stroke-width="1" stroke="#333333" fill="#ffffff"></path><path d="M -2.4492935982947065e-15 -40 L -1.2246467991473533e-15 -20 M 2.4492935982947065e-15 40 L 1.2246467991473533e-15 20" stroke-width="2" stroke="#333333"></path><text fill="#333333" font-family="Open Sans-Regular, Arial" font-size="10" text-anchor="middle" dominant-baseline="middle" font-weight="regular" transform="matrix(6.123233995736766e-17,1,-1,6.123233995736766e-17,-1,6.123233995736766e-17)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">10k</tspan></text><text fill="#333333" font-family="Open Sans-Regular, Arial" font-size="10" text-anchor="start" dominant-baseline="text-top" font-weight="regular" transform="matrix(6.123233995736766e-17,1,-1,6.123233995736766e-17,14.999999999999998,-20)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">R1</tspan></text><path d="M -10.000000000000002 -40 L 10.000000000000002 40 M 10.000000000000002 -40 L -10.000000000000002 40" stroke-width="2" stroke="red"></path></g></g><g transform="matrix(1,0,0,1,20.000000000000004,190)"><g><path d="M -10 0 L 10 0 L 0 10 Z" stroke-width="1" stroke="#333333" fill="#ffffff"></path><path d="M 0 -10 L 0 0" stroke-width="2" stroke="#333333"></path><text fill="#333333" font-family="Open Sans-Regular, Arial" font-size="10" text-anchor="middle" dominant-baseline="text-top" font-weight="regular" transform="matrix(1,0,0,1,0,20)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">GND</tspan></text></g></g><g transform="matrix(1,0,0,1,60,120)"><g><path d="M 9.999999999999998 -20 L 10.000000000000002 20 L -9.999999999999998 20 L -10.000000000000002 -20 Z" stroke-width="1" stroke="#333333" fill="#ffffff"></path><path d="M -2.4492935982947065e-15 -40 L -1.2246467991473533e-15 -20 M 2.4492935982947065e-15 40 L 1.2246467991473533e-15 20" stroke-width="2" stroke="#333333"></path><text fill="#333333" font-family="Open Sans-Regular, Arial" font-size="10" text-anchor="middle" dominant-baseline="middle" font-weight="regular" transform="matrix(6.123233995736766e-17,1,-1,6.123233995736766e-17,-1,6.123233995736766e-17)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">20k</tspan></text><text fill="#333333" font-family="Open Sans-Regular, Arial" font-size="10" text-anchor="start" dominant-baseline="text-top" font-weight="regular" transform="matrix(6.123233995736766e-17,1,-1,6.123233995736766e-17,14.999999999999998,-20)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">R2</tspan></text></g></g><g transform="matrix(1,0,0,1,60,190)"><g><path d="M -10 0 L 10 0 L 0 10 Z" stroke-width="1" stroke="#333333" fill="#ffffff"></path><path d="M 0 -10 L 0 0" stroke-width="2" stroke="#333333"></path><text fill="#333333" font-family="Open Sans-Regular, Arial" font-size="10" text-anchor="middle" dominant-baseline="text-top" font-weight="regular" transform="matrix(1,0,0,1,0,20)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">GND</tspan></text></g></g><g transform="matrix(1,0,0,1,100,100)"><g><path d="M -10 -3 L 10 -3" stroke-width="1" stroke="#333333" fill="none"></path><path d="M -10 3 L 10 3" stroke-width="1" stroke="#333333" fill="none"></path><path d="M 0 -20 L 0 -3 M 0 20 L 0 3" stroke-width="2" stroke="#333333"></path><text fill="#333333" font-family="Open Sans-Regular, Arial" font-size="10" text-anchor="start" dominant-baseline="text-top" font-weight="regular" transform="matrix(1,0,0,1,12,0)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">C1</tspan></text><text fill="#333333" font-family="Open Sans-Regular, Arial" font-size="10" text-anchor="start" dominant-baseline="hanging" font-weight="regular" transform="matrix(1,0,0,1,12,5)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">100n</tspan></text></g></g><g transform="matrix(1,0,0,1,100,150)"><g><path d="M -10 0 L 10 0 L 0 10 Z" stroke-width="1" stroke="#333333" fill="#ffffff"></path><path d="M 0 -10 L 0 0" stroke-width="2" stroke="#333333"></path><text fill="#333333" font-family="Open Sans-Regular, Arial" font-size="10" text-anchor="middle" dominant-baseline="text-top" font-weight="regular" transform="matrix(1,0,0,1,0,20)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">GND</tspan></text></g></g><g transform="matrix(1,0,0,1,140,60)"><g><path d="M 0 0 L 0 0" stroke-width="2" stroke="#333333"></path></g></g><g transform="matrix(1,0,0,1,210,80)"><g><path d="M -50 -40 L 50 -40 L 50 40 L -50 40 Z" stroke-width="1" stroke="#333333" fill="#fffeaf"></path><path d="M -70 -20 L -50 -20 M -70 0 L -50 0 M -70 20 L -50 20 M 70 -20 L 50 -20 M 70 0 L 50 0 M 70 20 L 50 20" stroke-width="2" stroke="#333333"></path><text fill="#333333" font-family="Open Sans-Regular, Arial" font-size="10" text-anchor="start" dominant-baseline="middle" font-weight="regular" transform="matrix(1,0,0,1,-46,-20)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">1</tspan></text><text fill="#333333" font-family="Open Sans-Regular, Arial" font-size="8" text-anchor="end" dominant-baseline="text-top" font-weight="regular" transform="matrix(1,0,0,1,-52,-22)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">1</tspan></text><text fill="#333333" font-family="Open Sans-Regular, Arial" font-size="10" text-anchor="start" dominant-baseline="middle" font-weight="regular" transform="matrix(1,0,0,1,-46,0)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">2</tspan></text><text fill="#333333" font-family="Open Sans-Regular, Arial" font-size="8" text-anchor="end" dominant-baseline="text-top" font-weight="regular" transform="matrix(1,0,0,1,-52,-2)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">2</tspan></text><text fill="#333333" font-family="Open Sans-Regular, Arial" font-size="10" text-anchor="start" dominant-baseline="middle" font-weight="regular" transform="matrix(1,0,0,1,-46,20)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">3</tspan></text><text fill="#333333" font-family="Open Sans-Regular, Arial" font-size="8" text-anchor="end" dominant-baseline="text-top" font-weight="regular" transform="matrix(1,0,0,1,-52,18)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">3</tspan></text><text fill="#333333" font-family="Open Sans-Regular, Arial" font-size="10" text-anchor="end" dominant-baseline="middle" font-weight="regular" transform="matrix(1,0,0,1,46,-20)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">6</tspan></text><text fill="#333333" font-family="Open Sans-Regular, Arial" font-size="8" text-anchor="start" dominant-baseline="text-top" font-weight="regular" transform="matrix(1,0,0,1,52,-22)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">6</tspan></text><text fill="#333333" font-family="Open Sans-Regular, Arial" font-size="10" text-anchor="end" dominant-baseline="middle" font-weight="regular" transform="matrix(1,0,0,1,46,0)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">5</tspan></text><text fill="#333333" font-family="Open Sans-Regular, Arial" font-size="8" text-anchor="start" dominant-baseline="text-top" font-weight="regular" transform="matrix(1,0,0,1,52,-2)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">5</tspan></text><text fill="#333333" font-family="Open Sans-Regular, Arial" font-size="10" text-anchor="end" dominant-baseline="middle" font-weight="regular" transform="matrix(1,0,0,1,46,20)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">4</tspan></text><text fill="#333333" font-family="Open Sans-Regular, Arial" font-size="8" text-anchor="start" dominant-baseline="text-top" font-weight="regular" transform="matrix(1,0,0,1,52,18)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">4</tspan></text><text fill="#333333" font-family="Open Sans-Regular, Arial" font-size="10" text-anchor="start" dominant-baseline="text-top" font-weight="regular" transform="matrix(1,0,0,1,-50,-44)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">tmp</tspan></text></g></g><g transform="matrix(1,0,0,1,300,130)"><g><path d="M -10 0 L 10 0 L 0 10 Z" stroke-width="1" stroke="#333333" fill="#ffffff"></path><path d="M 0 -10 L 0 0" stroke-width="2" stroke="#333333"></path><text fill="#333333" font-family="Open Sans-Regular, Arial" font-size="10" text-anchor="middle" dominant-baseline="text-top" font-weight="regular" transform="matrix(1,0,0,1,0,20)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">GND</tspan></text></g></g><g transform="matrix(1,0,0,1,340,140)"><g><path d="M 9.999999999999998 -20 L 10.000000000000002 20 L -9.999999999999998 20 L -10.000000000000002 -20 Z" stroke-width="1" stroke="#333333" fill="#ffffff"></path><path d="M -2.4492935982947065e-15 -40 L -1.2246467991473533e-15 -20 M 2.4492935982947065e-15 40 L 1.2246467991473533e-15 20" stroke-width="2" stroke="#333333"></path><text fill="#333333" font-family="Open Sans-Regular, Arial" font-size="10" text-anchor="middle" dominant-baseline="middle" font-weight="regular" transform="matrix(6.123233995736766e-17,1,-1,6.123233995736766e-17,-1,6.123233995736766e-17)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">10k</tspan></text><text fill="#333333" font-family="Open Sans-Regular, Arial" font-size="10" text-anchor="start" dominant-baseline="text-top" font-weight="regular" transform="matrix(6.123233995736766e-17,1,-1,6.123233995736766e-17,14.999999999999998,-20)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">R3</tspan></text><path d="M -10.000000000000002 -40 L 10.000000000000002 40 M 10.000000000000002 -40 L -10.000000000000002 40" stroke-width="2" stroke="red"></path></g></g><g transform="matrix(1,0,0,1,340,210)"><g><path d="M -10 0 L 10 0 L 0 10 Z" stroke-width="1" stroke="#333333" fill="#ffffff"></path><path d="M 0 -10 L 0 0" stroke-width="2" stroke="#333333"></path><text fill="#333333" font-family="Open Sans-Regular, Arial" font-size="10" text-anchor="middle" dominant-baseline="text-top" font-weight="regular" transform="matrix(1,0,0,1,0,20)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">GND</tspan></text></g></g><g transform="matrix(1,0,0,1,180,290)"><g><path d="M -15 0 L 15 0" stroke-width="1" stroke="#333333" fill="none"></path><path d="M 0 10 L 0 0" stroke-width="2" stroke="#333333"></path><text fill="#333333" font-family="Open Sans-Regular, Arial" font-size="10" text-anchor="middle" dominant-baseline="text-top" font-weight="regular" transform="matrix(1,0,0,1,0,-5)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">3V</tspan></text></g></g><g transform="matrix(1,0,0,1,180,360)"><g><path d="M 9.999999999999998 -20 L 10.000000000000002 20 L -9.999999999999998 20 L -10.000000000000002 -20 Z" stroke-width="1" stroke="#333333" fill="#ffffff"></path><path d="M -2.4492935982947065e-15 -40 L -1.2246467991473533e-15 -20 M 2.4492935982947065e-15 40 L 1.2246467991473533e-15 20" stroke-width="2" stroke="#333333"></path><text fill="#333333" font-family="Open Sans-Regular, Arial" font-size="10" text-anchor="middle" dominant-baseline="middle" font-weight="regular" transform="matrix(6.123233995736766e-17,1,-1,6.123233995736766e-17,-1,6.123233995736766e-17)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">20k</tspan></text><text fill="#333333" font-family="Open Sans-Regular, Arial" font-size="10" text-anchor="start" dominant-baseline="text-top" font-weight="regular" transform="matrix(6.123233995736766e-17,1,-1,6.123233995736766e-17,14.999999999999998,-20)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">R4</tspan></text></g></g><g transform="matrix(1,0,0,1,180,430)"><g><path d="M -10 0 L 10 0 L 0 10 Z" stroke-width="1" stroke="#333333" fill="#ffffff"></path><path d="M 0 -10 L 0 0" stroke-width="2" stroke="#333333"></path><text fill="#333333" font-family="Open Sans-Regular, Arial" font-size="10" text-anchor="middle" dominant-baseline="text-top" font-weight="regular" transform="matrix(1,0,0,1,0,20)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">GND</tspan></text></g></g><g><line x1="20" y1="40" x2="20" y2="60" stroke-linecap="square" stroke-width="1" stroke="#008400" fill="none"></line><line x1="20" y1="60" x2="20" y2="80" stroke-linecap="square" stroke-width="1" stroke="#008400" fill="none"></line><line x1="20" y1="60" x2="60" y2="60" stroke-linecap="square" stroke-width="1" stroke="#008400" fill="none"></line><line x1="60" y1="60" x2="60" y2="80" stroke-linecap="square" stroke-width="1" stroke="#008400" fill="none"></line><line x1="60" y1="60" x2="100" y2="60" stroke-linecap="square" stroke-width="1" stroke="#008400" fill="none"></line><line x1="100" y1="60" x2="100" y2="80" stroke-linecap="square" stroke-width="1" stroke="#008400" fill="none"></line><line x1="100" y1="60" x2="140" y2="60" stroke-linecap="square" stroke-width="1" stroke="#008400" fill="none"></line><circle r="2.5" cx="2.5" cy="2.5" transform="matrix(1,0,0,1,17.5,57.5)" fill="#008400" stroke="none"></circle><circle r="2.5" cx="2.5" cy="2.5" transform="matrix(1,0,0,1,57.5,57.5)" fill="#008400" stroke="none"></circle><circle r="2.5" cx="2.5" cy="2.5" transform="matrix(1,0,0,1,97.5,57.5)" fill="#008400" stroke="none"></circle><line x1="20.000000000000004" y1="160" x2="20.000000000000004" y2="180" stroke-linecap="square" stroke-width="1" stroke="#008400" fill="none"></line><line x1="60" y1="160" x2="60" y2="180" stroke-linecap="square" stroke-width="1" stroke="#008400" fill="none"></line><line x1="100" y1="120" x2="100" y2="140" stroke-linecap="square" stroke-width="1" stroke="#008400" fill="none"></line><line x1="280" y1="100" x2="300" y2="100" stroke-linecap="square" stroke-width="1" stroke="#008400" fill="none"></line><line x1="300" y1="100" x2="300" y2="120" stroke-linecap="square" stroke-width="1" stroke="#008400" fill="none"></line><line x1="340" y1="180" x2="340" y2="200" stroke-linecap="square" stroke-width="1" stroke="#008400" fill="none"></line><line x1="180" y1="400" x2="180" y2="420" stroke-linecap="square" stroke-width="1" stroke="#008400" fill="none"></line><line x1="280" y1="80" x2="340" y2="80" stroke-linecap="square" stroke-width="1" stroke="#008400" fill="none"></line><line x1="340" y1="80" x2="340" y2="100" stroke-linecap="square" stroke-width="1" stroke="#008400" fill="none"></line><line x1="180" y1="300" x2="180" y2="320" stroke-linecap="square" stroke-width="1" stroke="#008400" fill="none"></line></g><g></g></svg>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svgjs="http://svgjs.dev/svgjs" width="290" height="150.5" viewBox="-25 -25.5 290 150.5"><g transform="matrix(1,0,0,1,0,0)"><path d="M -20 -20.5 L -20 120 M 0 -20.5 L 0 120 M 20 -20.5 L 20 120 M 40 -20.5 L 40 120 M 60 -20.5 L 60 120 M 80 -20.5 L 80 120 M 100 -20.5 L 100 120 M 120 -20.5 L 120 120 M 140 -20.5 L 140 120 M 160 -20.5 L 160 120 M 180 -20.5 L 180 120 M 200 -20.5 L 200 120 M 220 -20.5 L 220 120 M 240 -20.5 L 240 120 M 260 -20.5 L 260 120" fill="none" stroke-dasharray="1,19" stroke-width="1" stroke="#aaaaaa"></path></g><g transform="matrix(1,0,0,1,30,20)"><g><path d="M -9.18485099360515e-16 15 L 9.18485099360515e-16 -15" stroke-width="1" stroke="#333333" fill="none"></path><path d="M 10 6.123233995736766e-16 L 0 0" stroke-width="2" stroke="#333333"></path><text fill="#333333" font-family="
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svgjs="http://svgjs.dev/svgjs" width="290" height="150.5" viewBox="-25 -25.5 290 150.5"><g transform="matrix(1,0,0,1,0,0)"><path d="M -20 -20.5 L -20 120 M 0 -20.5 L 0 120 M 20 -20.5 L 20 120 M 40 -20.5 L 40 120 M 60 -20.5 L 60 120 M 80 -20.5 L 80 120 M 100 -20.5 L 100 120 M 120 -20.5 L 120 120 M 140 -20.5 L 140 120 M 160 -20.5 L 160 120 M 180 -20.5 L 180 120 M 200 -20.5 L 200 120 M 220 -20.5 L 220 120 M 240 -20.5 L 240 120 M 260 -20.5 L 260 120" fill="none" stroke-dasharray="1,19" stroke-width="1" stroke="#aaaaaa"></path></g><g transform="matrix(1,0,0,1,30,20)"><g><path d="M -9.18485099360515e-16 15 L 9.18485099360515e-16 -15" stroke-width="1" stroke="#333333" fill="none"></path><path d="M 10 6.123233995736766e-16 L 0 0" stroke-width="2" stroke="#333333"></path><text fill="#333333" font-family="Open Sans-Regular, Arial" font-size="10" text-anchor="middle" dominant-baseline="text-top" font-weight="regular" transform="matrix(6.123233995736766e-17,-1,1,6.123233995736766e-17,-5,-3.061616997868383e-16)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">5V</tspan></text></g></g><g transform="matrix(1,0,0,1,120,20)"><g><path d="M -20 -10 L 20 -10 L 20 10 L -20 10 Z" stroke-width="1" stroke="#333333" fill="#ffffff"></path><path d="M -40 0 L -20 0 M 40 0 L 20 0" stroke-width="2" stroke="#333333"></path><text fill="#333333" font-family="Open Sans-Regular, Arial" font-size="10" text-anchor="middle" dominant-baseline="middle" font-weight="regular" transform="matrix(1,0,0,1,0,1)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">10k</tspan></text><text fill="#333333" font-family="Open Sans-Regular, Arial" font-size="10" text-anchor="start" dominant-baseline="text-top" font-weight="regular" transform="matrix(1,0,0,1,-20,-15)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">R1</tspan></text></g></g><g transform="matrix(1,0,0,1,210,20)"><g><path d="M -6.123233995736766e-16 10 L 6.123233995736766e-16 -10 L 10 6.123233995736766e-16 Z" stroke-width="1" stroke="#333333" fill="#ffffff"></path><path d="M -10 -6.123233995736766e-16 L 0 0" stroke-width="2" stroke="#333333"></path><text fill="#333333" font-family="Open Sans-Regular, Arial" font-size="10" text-anchor="middle" dominant-baseline="text-top" font-weight="regular" transform="matrix(6.123233995736766e-17,-1,1,6.123233995736766e-17,20,1.2246467991473533e-15)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">GND</tspan></text></g></g><g transform="matrix(1,0,0,1,30,80)"><g><path d="M -9.18485099360515e-16 15 L 9.18485099360515e-16 -15" stroke-width="1" stroke="#333333" fill="none"></path><path d="M 10 6.123233995736766e-16 L 0 0" stroke-width="2" stroke="#333333"></path><text fill="#333333" font-family="Open Sans-Regular, Arial" font-size="10" text-anchor="middle" dominant-baseline="text-top" font-weight="regular" transform="matrix(6.123233995736766e-17,-1,1,6.123233995736766e-17,-5,-3.061616997868383e-16)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">5V</tspan></text></g></g><g transform="matrix(1,0,0,1,120,80)"><g><path d="M -20 -10 L 20 -10 L 20 10 L -20 10 Z" stroke-width="1" stroke="#333333" fill="#ffffff"></path><path d="M -40 0 L -20 0 M 40 0 L 20 0" stroke-width="2" stroke="#333333"></path><text fill="#333333" font-family="Open Sans-Regular, Arial" font-size="10" text-anchor="middle" dominant-baseline="middle" font-weight="regular" transform="matrix(1,0,0,1,0,1)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">10k</tspan></text><text fill="#333333" font-family="Open Sans-Regular, Arial" font-size="10" text-anchor="start" dominant-baseline="text-top" font-weight="regular" transform="matrix(1,0,0,1,-20,-15)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">R2</tspan></text></g></g><g transform="matrix(1,0,0,1,210,80)"><g><path d="M -6.123233995736766e-16 10 L 6.123233995736766e-16 -10 L 10 6.123233995736766e-16 Z" stroke-width="1" stroke="#333333" fill="#ffffff"></path><path d="M -10 -6.123233995736766e-16 L 0 0" stroke-width="2" stroke="#333333"></path><text fill="#333333" font-family="Open Sans-Regular, Arial" font-size="10" text-anchor="middle" dominant-baseline="text-top" font-weight="regular" transform="matrix(6.123233995736766e-17,-1,1,6.123233995736766e-17,20,1.2246467991473533e-15)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">GND</tspan></text></g></g><g><line x1="40" y1="20" x2="80" y2="20" stroke-linecap="square" stroke-width="1" stroke="#008400" fill="none"></line><line x1="40" y1="80" x2="80" y2="80" stroke-linecap="square" stroke-width="1" stroke="#008400" fill="none"></line><line x1="160" y1="20" x2="200" y2="20" stroke-linecap="square" stroke-width="1" stroke="#008400" fill="none"></line><line x1="160" y1="80" x2="200" y2="80" stroke-linecap="square" stroke-width="1" stroke="#008400" fill="none"></line></g><g></g></svg>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svgjs="http://svgjs.dev/svgjs" width="410" height="790.5" viewBox="-25 -25.5 410 790.5"><g transform="matrix(1,0,0,1,0,0)"><path d="M -20 -20.5 L -20 760 M 0 -20.5 L 0 760 M 20 -20.5 L 20 760 M 40 -20.5 L 40 760 M 60 -20.5 L 60 760 M 80 -20.5 L 80 760 M 100 -20.5 L 100 760 M 120 -20.5 L 120 760 M 140 -20.5 L 140 760 M 160 -20.5 L 160 760 M 180 -20.5 L 180 760 M 200 -20.5 L 200 760 M 220 -20.5 L 220 760 M 240 -20.5 L 240 760 M 260 -20.5 L 260 760 M 280 -20.5 L 280 760 M 300 -20.5 L 300 760 M 320 -20.5 L 320 760 M 340 -20.5 L 340 760 M 360 -20.5 L 360 760 M 380 -20.5 L 380 760" fill="none" stroke-dasharray="1,19" stroke-width="1" stroke="#aaaaaa"></path></g><g transform="matrix(1,0,0,1,140,170)"><g><path d="M -15 0 L 15 0" stroke-width="1" stroke="#333333" fill="none"></path><path d="M 0 10 L 0 0" stroke-width="2" stroke="#333333"></path><text fill="#333333" font-family="
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svgjs="http://svgjs.dev/svgjs" width="410" height="790.5" viewBox="-25 -25.5 410 790.5"><g transform="matrix(1,0,0,1,0,0)"><path d="M -20 -20.5 L -20 760 M 0 -20.5 L 0 760 M 20 -20.5 L 20 760 M 40 -20.5 L 40 760 M 60 -20.5 L 60 760 M 80 -20.5 L 80 760 M 100 -20.5 L 100 760 M 120 -20.5 L 120 760 M 140 -20.5 L 140 760 M 160 -20.5 L 160 760 M 180 -20.5 L 180 760 M 200 -20.5 L 200 760 M 220 -20.5 L 220 760 M 240 -20.5 L 240 760 M 260 -20.5 L 260 760 M 280 -20.5 L 280 760 M 300 -20.5 L 300 760 M 320 -20.5 L 320 760 M 340 -20.5 L 340 760 M 360 -20.5 L 360 760 M 380 -20.5 L 380 760" fill="none" stroke-dasharray="1,19" stroke-width="1" stroke="#aaaaaa"></path></g><g transform="matrix(1,0,0,1,140,170)"><g><path d="M -15 0 L 15 0" stroke-width="1" stroke="#333333" fill="none"></path><path d="M 0 10 L 0 0" stroke-width="2" stroke="#333333"></path><text fill="#333333" font-family="Open Sans-Regular, Arial" font-size="10" text-anchor="middle" dominant-baseline="text-top" font-weight="regular" transform="matrix(1,0,0,1,0,-5)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">3v3</tspan></text></g></g><g transform="matrix(1,0,0,1,140,240)"><g><path d="M 9.999999999999998 -20 L 10.000000000000002 20 L -9.999999999999998 20 L -10.000000000000002 -20 Z" stroke-width="1" stroke="#333333" fill="#ffffff"></path><path d="M -2.4492935982947065e-15 -40 L -1.2246467991473533e-15 -20 M 2.4492935982947065e-15 40 L 1.2246467991473533e-15 20" stroke-width="2" stroke="#333333"></path><text fill="#333333" font-family="Open Sans-Regular, Arial" font-size="10" text-anchor="middle" dominant-baseline="middle" font-weight="regular" transform="matrix(6.123233995736766e-17,1,-1,6.123233995736766e-17,-1,6.123233995736766e-17)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">20k</tspan></text><text fill="#333333" font-family="Open Sans-Regular, Arial" font-size="10" text-anchor="start" dominant-baseline="text-top" font-weight="regular" transform="matrix(6.123233995736766e-17,1,-1,6.123233995736766e-17,14.999999999999998,-20)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">R1</tspan></text></g></g><g transform="matrix(1,0,0,1,140,360)"><g><path d="M 9.999999999999998 -20 L 10.000000000000002 20 L -9.999999999999998 20 L -10.000000000000002 -20 Z" stroke-width="1" stroke="#333333" fill="#ffffff"></path><path d="M -2.4492935982947065e-15 -40 L -1.2246467991473533e-15 -20 M 2.4492935982947065e-15 40 L 1.2246467991473533e-15 20" stroke-width="2" stroke="#333333"></path><text fill="#333333" font-family="Open Sans-Regular, Arial" font-size="10" text-anchor="middle" dominant-baseline="middle" font-weight="regular" transform="matrix(6.123233995736766e-17,1,-1,6.123233995736766e-17,-1,6.123233995736766e-17)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">20k</tspan></text><text fill="#333333" font-family="Open Sans-Regular, Arial" font-size="10" text-anchor="start" dominant-baseline="text-top" font-weight="regular" transform="matrix(6.123233995736766e-17,1,-1,6.123233995736766e-17,14.999999999999998,-20)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">R2</tspan></text></g></g><g transform="matrix(1,0,0,1,140,430)"><g><path d="M -10 0 L 10 0 L 0 10 Z" stroke-width="1" stroke="#333333" fill="#ffffff"></path><path d="M 0 -10 L 0 0" stroke-width="2" stroke="#333333"></path><text fill="#333333" font-family="Open Sans-Regular, Arial" font-size="10" text-anchor="middle" dominant-baseline="text-top" font-weight="regular" transform="matrix(1,0,0,1,0,20)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">GND</tspan></text></g></g><g transform="matrix(1,0,0,1,210,300)"><g><path d="M 2.7554552980815444e-15 -15 L -2.7554552980815444e-15 15" stroke-width="1" stroke="#333333" fill="none"></path><path d="M -10 -1.8369701987210296e-15 L 0 0" stroke-width="2" stroke="#333333"></path><text fill="#333333" font-family="Open Sans-Regular, Arial" font-size="10" text-anchor="middle" dominant-baseline="text-top" font-weight="regular" transform="matrix(-1.8369701987210297e-16,1,-1,-1.8369701987210297e-16,5,9.184850993605148e-16)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">out</tspan></text></g></g><g transform="matrix(1,0,0,1,160,530)"><g><path d="M -15 0 L 15 0" stroke-width="1" stroke="#333333" fill="none"></path><path d="M 0 10 L 0 0" stroke-width="2" stroke="#333333"></path><text fill="#333333" font-family="Open Sans-Regular, Arial" font-size="10" text-anchor="middle" dominant-baseline="text-top" font-weight="regular" transform="matrix(1,0,0,1,0,-5)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">3v3</tspan></text></g></g><g transform="matrix(1,0,0,1,160,600)"><g><path d="M 9.999999999999998 -20 L 10.000000000000002 20 L -9.999999999999998 20 L -10.000000000000002 -20 Z" stroke-width="1" stroke="#333333" fill="#ffffff"></path><path d="M -2.4492935982947065e-15 -40 L -1.2246467991473533e-15 -20 M 2.4492935982947065e-15 40 L 1.2246467991473533e-15 20" stroke-width="2" stroke="#333333"></path><text fill="#333333" font-family="Open Sans-Regular, Arial" font-size="10" text-anchor="middle" dominant-baseline="middle" font-weight="regular" transform="matrix(6.123233995736766e-17,1,-1,6.123233995736766e-17,-1,6.123233995736766e-17)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">10k</tspan></text><text fill="#333333" font-family="Open Sans-Regular, Arial" font-size="10" text-anchor="start" dominant-baseline="text-top" font-weight="regular" transform="matrix(6.123233995736766e-17,1,-1,6.123233995736766e-17,14.999999999999998,-20)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">R3</tspan></text></g></g><g transform="matrix(1,0,0,1,200,630)"><g><path d="M -15 0 L 15 0" stroke-width="1" stroke="#333333" fill="none"></path><path d="M 0 10 L 0 0" stroke-width="2" stroke="#333333"></path><text fill="#333333" font-family="Open Sans-Regular, Arial" font-size="10" text-anchor="middle" dominant-baseline="text-top" font-weight="regular" transform="matrix(1,0,0,1,0,-5)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">out</tspan></text></g></g><g><line x1="140" y1="180" x2="140" y2="200" stroke-linecap="square" stroke-width="1" stroke="#008400" fill="none"></line><line x1="160" y1="540" x2="160" y2="560" stroke-linecap="square" stroke-width="1" stroke="#008400" fill="none"></line><line x1="140" y1="280" x2="140" y2="300" stroke-linecap="square" stroke-width="1" stroke="#008400" fill="none"></line><line x1="140" y1="300" x2="140" y2="320" stroke-linecap="square" stroke-width="1" stroke="#008400" fill="none"></line><line x1="140" y1="300" x2="200" y2="300" stroke-linecap="square" stroke-width="1" stroke="#008400" fill="none"></line><line x1="160" y1="640" x2="160" y2="660" stroke-linecap="square" stroke-width="1" stroke="#008400" fill="none"></line><line x1="160" y1="660" x2="200" y2="660" stroke-linecap="square" stroke-width="1" stroke="#008400" fill="none"></line><line x1="200" y1="660" x2="200" y2="640" stroke-linecap="square" stroke-width="1" stroke="#008400" fill="none"></line><circle r="2.5" cx="2.5" cy="2.5" transform="matrix(1,0,0,1,137.5,297.5)" fill="#008400" stroke="none"></circle><line x1="140" y1="400" x2="140" y2="420" stroke-linecap="square" stroke-width="1" stroke="#008400" fill="none"></line></g><g><rect width="360" height="740" fill="none" stroke-width="1" stroke="#111111" transform="matrix(1,0,0,1,0,0)"></rect><rect width="320" height="700" fill="none" stroke-width="1" stroke="#111111" transform="matrix(1,0,0,1,20,20)"></rect><rect width="280" height="660" fill="none" stroke-width="1" stroke="#111111" transform="matrix(1,0,0,1,40,40)"></rect><rect width="240" height="420" fill="none" stroke-width="1" stroke="#111111" transform="matrix(1,0,0,1,60,60)"></rect></g><g transform="matrix(1,0,0,1,180,100)"><g><path d="M0 0 " stroke-width="2" stroke="#333333"></path><text fill="#333333" font-family="Open Sans-Regular, Arial" font-size="16" text-anchor="middle" dominant-baseline="text-top" font-weight="bold" transform="matrix(1,0,0,1,0,0)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">Voltage divider circuit</tspan></text></g></g></svg>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svgjs="http://svgjs.dev/svgjs" width="170" height="170.5" viewBox="-25 -25.5 170 170.5"><g transform="matrix(1,0,0,1,0,0)"><path d="M -20 -20.5 L -20 140 M 0 -20.5 L 0 140 M 20 -20.5 L 20 140 M 40 -20.5 L 40 140 M 60 -20.5 L 60 140 M 80 -20.5 L 80 140 M 100 -20.5 L 100 140 M 120 -20.5 L 120 140 M 140 -20.5 L 140 140" fill="none" stroke-dasharray="1,19" stroke-width="1" stroke="#aaaaaa"></path></g><g transform="matrix(1,0,0,1,40,30)"><g><path d="M -15 0 L 15 0" stroke-width="1" stroke="#333333" fill="none"></path><path d="M 0 10 L 0 0" stroke-width="2" stroke="#333333"></path><text fill="#333333" font-family="
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svgjs="http://svgjs.dev/svgjs" width="170" height="170.5" viewBox="-25 -25.5 170 170.5"><g transform="matrix(1,0,0,1,0,0)"><path d="M -20 -20.5 L -20 140 M 0 -20.5 L 0 140 M 20 -20.5 L 20 140 M 40 -20.5 L 40 140 M 60 -20.5 L 60 140 M 80 -20.5 L 80 140 M 100 -20.5 L 100 140 M 120 -20.5 L 120 140 M 140 -20.5 L 140 140" fill="none" stroke-dasharray="1,19" stroke-width="1" stroke="#aaaaaa"></path></g><g transform="matrix(1,0,0,1,40,30)"><g><path d="M -15 0 L 15 0" stroke-width="1" stroke="#333333" fill="none"></path><path d="M 0 10 L 0 0" stroke-width="2" stroke="#333333"></path><text fill="#333333" font-family="Open Sans-Regular, Arial" font-size="10" text-anchor="middle" dominant-baseline="text-top" font-weight="regular" transform="matrix(1,0,0,1,0,-5)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">5v</tspan></text></g></g><g transform="matrix(1,0,0,1,60,60)"><g><path d="M -20 -10 L 20 -10 L 20 10 L -20 10 Z" stroke-width="1" stroke="#333333" fill="#ffffff"></path><path d="M 0 -20 L 20 -20" stroke-width="1" stroke="#333333" fill="none"></path><path d="M 0 20 L 0 40" stroke-width="1" stroke="#333333" fill="none"></path><path d="M 0 0 L 20 20" stroke-width="1" stroke="#333333" fill="none"></path><path d="M -20 0 L -40 0 M 20 0 L 40 0" stroke-width="2" stroke="#333333"></path><text fill="#333333" font-family="Open Sans-Regular, Arial" font-size="10" text-anchor="middle" dominant-baseline="middle" font-weight="regular" transform="matrix(1,0,0,1,0,0)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">10k</tspan></text><text fill="#333333" font-family="Open Sans-Regular, Arial" font-size="10" text-anchor="start" dominant-baseline="text-top" font-weight="regular" transform="matrix(1,0,0,1,-20,-15)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">R1</tspan></text></g></g><g transform="matrix(1,0,0,1,80,90)"><g><path d="M -10 0 L 10 0 L 0 10 Z" stroke-width="1" stroke="#333333" fill="#ffffff"></path><path d="M 0 -10 L 0 0" stroke-width="2" stroke="#333333"></path><text fill="#333333" font-family="Open Sans-Regular, Arial" font-size="10" text-anchor="middle" dominant-baseline="text-top" font-weight="regular" transform="matrix(1,0,0,1,0,20)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">GND</tspan></text></g></g><g><line x1="40" y1="40" x2="40" y2="60" stroke-linecap="square" stroke-width="1" stroke="#008400" fill="none"></line><line x1="80" y1="60" x2="80" y2="80" stroke-linecap="square" stroke-width="1" stroke="#008400" fill="none"></line></g><g></g></svg>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import lib
|
|
2
|
+
|
|
3
|
+
v5v = supply("5v")
|
|
4
|
+
gnd = dgnd()
|
|
5
|
+
|
|
6
|
+
at gnd
|
|
7
|
+
wire up 20 right 20
|
|
8
|
+
to D1 = led("GREEN") pin 2 right
|
|
9
|
+
at D1 pin 1
|
|
10
|
+
wire right 20 up 20
|
|
11
|
+
to v5v
|
|
12
|
+
|
|
13
|
+
at v5v
|
|
14
|
+
wire down 20 right 20
|
|
15
|
+
add led("RED")
|
|
16
|
+
wire right 20 down 20
|
|
17
|
+
to gnd
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
#wire down 20
|
|
21
|
+
#add led("GREEN")
|
|
22
|
+
#wire down 20
|
|
23
|
+
#to gnd
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svgjs="http://svgjs.dev/svgjs" width="190" height="310.5" viewBox="-25 -25.5 190 310.5"><g transform="matrix(1,0,0,1,0,0)"><path d="M -20 -20.5 L -20 280 M 0 -20.5 L 0 280 M 20 -20.5 L 20 280 M 40 -20.5 L 40 280 M 60 -20.5 L 60 280 M 80 -20.5 L 80 280 M 100 -20.5 L 100 280 M 120 -20.5 L 120 280 M 140 -20.5 L 140 280 M 160 -20.5 L 160 280" fill="none" stroke-dasharray="1,19" stroke-width="1" stroke="#aaaaaa"></path></g><g transform="matrix(1,0,0,1,20,90)"><g><path d="M -10 0 L 10 0 L 0 10 Z" stroke-width="1" stroke="#333333" fill="#ffffff"></path><path d="M 0 -10 L 0 0" stroke-width="2" stroke="#333333"></path><text fill="#333333" font-family="Open Sans-Regular, Arial" font-size="10" text-anchor="middle" dominant-baseline="text-top" font-weight="regular" transform="matrix(1,0,0,1,0,20)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">GND</tspan></text></g></g><g transform="matrix(1,0,0,1,70,60)"><g><path d="M -10.000000000000002 9.999999999999998 L -9.999999999999998 -10.000000000000002" stroke-width="1" stroke="#333333" fill="none"></path><path d="M 9.999999999999998 10.000000000000002 L 10.000000000000002 -9.999999999999998 L -10 -1.2246467991473533e-15 Z" stroke-width="1" stroke="#333333" fill="#ffffff"></path><path d="M 9.797174393178826e-16 -8 L -4.999999999999998 -18" stroke-width="1" stroke="#333333" fill="none"></path><path d="M -2.999999999999999 -8 L -7.999999999999998 -18" stroke-width="1" stroke="#333333" fill="none"></path><path d="M 30 3.67394039744206e-15 L 10 1.2246467991473533e-15 M -30 -3.67394039744206e-15 L -10 -1.2246467991473533e-15" stroke-width="2" stroke="#333333"></path><text fill="#333333" font-family="Open Sans-Regular, Arial" font-size="10" text-anchor="end" dominant-baseline="hanging" font-weight="regular" transform="matrix(1,0,0,1,-15,5)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">D1</tspan></text></g></g><g transform="matrix(1,0,0,1,120,30.000000000000007)"><g><path d="M -15 0 L 15 0" stroke-width="1" stroke="#333333" fill="none"></path><path d="M 0 10 L 0 0" stroke-width="2" stroke="#333333"></path><text fill="#333333" font-family="Open Sans-Regular, Arial" font-size="10" text-anchor="middle" dominant-baseline="text-top" font-weight="regular" transform="matrix(1,0,0,1,0,-5)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">5v</tspan></text></g></g><g transform="matrix(1,0,0,1,20,170)"><g><path d="M -15 0 L 15 0" stroke-width="1" stroke="#333333" fill="none"></path><path d="M 0 10 L 0 0" stroke-width="2" stroke="#333333"></path><text fill="#333333" font-family="Open Sans-Regular, Arial" font-size="10" text-anchor="middle" dominant-baseline="text-top" font-weight="regular" transform="matrix(1,0,0,1,0,-5)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">5v</tspan></text></g></g><g transform="matrix(1,0,0,1,70,200)"><g><path d="M 10 -10 L 10 10" stroke-width="1" stroke="#333333" fill="none"></path><path d="M -10 -10 L -10 10 L 10 0 Z" stroke-width="1" stroke="#333333" fill="#ffffff"></path><path d="M 0 8 L 5 18" stroke-width="1" stroke="#333333" fill="none"></path><path d="M 3 8 L 8 18" stroke-width="1" stroke="#333333" fill="none"></path><path d="M -30 0 L -10 0 M 30 0 L 10 0" stroke-width="2" stroke="#333333"></path><text fill="#333333" font-family="Open Sans-Regular, Arial" font-size="10" text-anchor="start" dominant-baseline="hanging" font-weight="regular" transform="matrix(1,0,0,1,15,5)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">D2</tspan></text></g></g><g transform="matrix(1,0,0,1,120,230)"><g><path d="M -10 0 L 10 0 L 0 10 Z" stroke-width="1" stroke="#333333" fill="#ffffff"></path><path d="M 0 -10 L 0 0" stroke-width="2" stroke="#333333"></path><text fill="#333333" font-family="Open Sans-Regular, Arial" font-size="10" text-anchor="middle" dominant-baseline="text-top" font-weight="regular" transform="matrix(1,0,0,1,0,20)" svgjs:data="{"leading":"1.3"}"><tspan dy="0" x="0" svgjs:data="{"newLined":true}">GND</tspan></text></g></g><g><line x1="20" y1="80" x2="20" y2="60" stroke-linecap="square" stroke-width="1" stroke="#008400" fill="none"></line><line x1="20" y1="60" x2="40" y2="60" stroke-linecap="square" stroke-width="1" stroke="#008400" fill="none"></line><line x1="100" y1="200" x2="120" y2="200" stroke-linecap="square" stroke-width="1" stroke="#008400" fill="none"></line><line x1="120" y1="200" x2="120" y2="220" stroke-linecap="square" stroke-width="1" stroke="#008400" fill="none"></line><line x1="100" y1="60.00000000000001" x2="120" y2="60.00000000000001" stroke-linecap="square" stroke-width="1" stroke="#008400" fill="none"></line><line x1="120" y1="60.00000000000001" x2="120" y2="40.00000000000001" stroke-linecap="square" stroke-width="1" stroke="#008400" fill="none"></line><line x1="20" y1="180" x2="20" y2="200" stroke-linecap="square" stroke-width="1" stroke="#008400" fill="none"></line><line x1="20" y1="200" x2="40" y2="200" stroke-linecap="square" stroke-width="1" stroke="#008400" fill="none"></line></g><g></g></svg>
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { execSync } from 'child_process';
|
|
2
|
+
import figlet from 'figlet';
|
|
3
|
+
import { existsSync, mkdirSync, readFileSync, unlinkSync } from 'fs';
|
|
4
|
+
|
|
5
|
+
describe('test cli program', () => {
|
|
6
|
+
|
|
7
|
+
const tmpFolder = '__tests__/tmp';
|
|
8
|
+
|
|
9
|
+
const baseCommand = 'node build/src/main.js';
|
|
10
|
+
|
|
11
|
+
test('start program and display help', () => {
|
|
12
|
+
const result = execSync(baseCommand).toString();
|
|
13
|
+
const circuitscriptText = figlet.textSync('circuitscript', {
|
|
14
|
+
font: 'Small Slant'
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
expect(result.includes(circuitscriptText)).toBe(true);
|
|
18
|
+
|
|
19
|
+
const options =
|
|
20
|
+
`Options:
|
|
21
|
+
-V, --version output the version number
|
|
22
|
+
-i, --input text <input text> Input text directly
|
|
23
|
+
-f, --input-file <path> Input file
|
|
24
|
+
-o, --output <path> Output path
|
|
25
|
+
-c, --current-directory <path> Set current directory
|
|
26
|
+
-k, --kicad-netlist <filename> Create KiCad netlist
|
|
27
|
+
-w, --watch Watch for file changes
|
|
28
|
+
-n, --dump-nets Dump out net information
|
|
29
|
+
-d, --dump-data Dump data during parsing
|
|
30
|
+
-s, --stats Show stats during generation
|
|
31
|
+
-h, --help display help for command`
|
|
32
|
+
|
|
33
|
+
expect(result.includes(options)).toBe(true);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
test('pass in file and output directly', () => {
|
|
37
|
+
const result = execSync(baseCommand + ' -f __tests__/renderData/script1.cst').toString();
|
|
38
|
+
const expected = readFileSync('__tests__/renderData/script1.cst.svg').toString();
|
|
39
|
+
expect(result.trim()).toBe(expected);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
test.each([false, true])('pass in file and output file (with stats: %s)', (withStatsFlag: boolean) => {
|
|
43
|
+
const outputPath = '__tests__/tmp/result1.svg';
|
|
44
|
+
if (existsSync(outputPath)) {
|
|
45
|
+
unlinkSync(outputPath);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (!existsSync(tmpFolder)) {
|
|
49
|
+
mkdirSync(tmpFolder);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const statsFlag = withStatsFlag ? ' -s ' : '';
|
|
53
|
+
|
|
54
|
+
const result = execSync(`${baseCommand} -f __tests__/renderData/script1.cst -o ${outputPath} ${statsFlag}`).toString();
|
|
55
|
+
|
|
56
|
+
const outputFile = readFileSync(outputPath).toString();
|
|
57
|
+
const expected = readFileSync('__tests__/renderData/script1.cst.svg').toString();
|
|
58
|
+
|
|
59
|
+
expect(outputFile.trim()).toBe(expected.trim());
|
|
60
|
+
|
|
61
|
+
expect(
|
|
62
|
+
result.includes('Lexing took:') &&
|
|
63
|
+
result.includes('Parsing took:') &&
|
|
64
|
+
result.includes('Layout took:') &&
|
|
65
|
+
result.includes('Render took:')
|
|
66
|
+
).toBe(withStatsFlag);
|
|
67
|
+
});
|
|
68
|
+
});
|
package/__tests__/testRender.ts
CHANGED
|
@@ -12,7 +12,8 @@ describe('Render tests', () => {
|
|
|
12
12
|
['variant and branch rendering', 'script1.cst'],
|
|
13
13
|
['simple function', 'script2.cst'],
|
|
14
14
|
['simple frame', 'script3.cst'],
|
|
15
|
-
['drawing functions for graphics', 'script4.cst']
|
|
15
|
+
['drawing functions for graphics', 'script4.cst'],
|
|
16
|
+
['drawing 180 deg flipped components', 'script5.cst']
|
|
16
17
|
|
|
17
18
|
])('render - %s (%s)', async (title, scriptPath) => {
|
|
18
19
|
|
|
@@ -102,7 +102,8 @@ export class SymbolGraphic {
|
|
|
102
102
|
let anchorStyle = 'start';
|
|
103
103
|
let dominantBaseline = 'auto';
|
|
104
104
|
let useAnchor = anchor;
|
|
105
|
-
|
|
105
|
+
const isRotation180 = Math.abs(this.angle) === 180;
|
|
106
|
+
if (isRotation180) {
|
|
106
107
|
useAnchor = this.flipTextAnchor(anchor);
|
|
107
108
|
}
|
|
108
109
|
switch (useAnchor) {
|
|
@@ -128,10 +129,7 @@ export class SymbolGraphic {
|
|
|
128
129
|
break;
|
|
129
130
|
}
|
|
130
131
|
const position = tmpLabel.getLabelPosition();
|
|
131
|
-
|
|
132
|
-
if (fontWeight === 'bold') {
|
|
133
|
-
useFont = 'Inter-Bold';
|
|
134
|
-
}
|
|
132
|
+
const useFont = defaultFont;
|
|
135
133
|
const text = group.text(tmpLabel.text)
|
|
136
134
|
.fill('#333')
|
|
137
135
|
.font({
|
|
@@ -139,8 +137,9 @@ export class SymbolGraphic {
|
|
|
139
137
|
size: fontSize,
|
|
140
138
|
anchor: anchorStyle,
|
|
141
139
|
'dominant-baseline': dominantBaseline,
|
|
140
|
+
weight: fontWeight,
|
|
142
141
|
});
|
|
143
|
-
if (
|
|
142
|
+
if (isRotation180) {
|
|
144
143
|
text.translate(-position[0], position[1]);
|
|
145
144
|
}
|
|
146
145
|
else {
|
package/build/src/globals.js
CHANGED
|
@@ -26,7 +26,8 @@ export var SymbolPinSide;
|
|
|
26
26
|
})(SymbolPinSide || (SymbolPinSide = {}));
|
|
27
27
|
export const portWidth = 20;
|
|
28
28
|
export const portHeight = 2;
|
|
29
|
-
export const defaultFont = '
|
|
29
|
+
export const defaultFont = 'Open Sans-Regular, Arial';
|
|
30
|
+
export const defaultFontBold = 'Open Sans-Bold, Arial-Bold, Arial';
|
|
30
31
|
export const defaultFontSize = 10;
|
|
31
32
|
export const bodyColor = '#FFFEAF';
|
|
32
33
|
export const junctionSize = 5;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { writeFileSync } from "fs";
|
|
2
|
+
import { generateKiCADNetList } from "./export.js";
|
|
3
|
+
import { LayoutEngine } from "./layout.js";
|
|
4
|
+
import { SequenceAction } from "./objects/ExecutionScope.js";
|
|
5
|
+
import { parseFileWithVisitor } from "./parser.js";
|
|
6
|
+
import { generateSVG2 } from "./render.js";
|
|
7
|
+
import { SimpleStopwatch } from "./utils.js";
|
|
8
|
+
import { MainVisitor } from "./visitor.js";
|
|
9
|
+
export function renderScript(scriptData, outputPath, options) {
|
|
10
|
+
const { currentDirectory = null, defaultLibsPath, dumpNets = false, dumpData = false, kicadNetlistPath = null, showStats = false } = options;
|
|
11
|
+
const visitor = new MainVisitor(true);
|
|
12
|
+
visitor.onImportFile = visitor.createImportFileHandler(currentDirectory, defaultLibsPath);
|
|
13
|
+
visitor.print('reading file');
|
|
14
|
+
visitor.print('done reading file');
|
|
15
|
+
const { tree, parser, hasParseError, hasError, parserTimeTaken, lexerTimeTaken } = parseFileWithVisitor(visitor, scriptData);
|
|
16
|
+
showStats && console.log('Lexing took:', lexerTimeTaken);
|
|
17
|
+
showStats && console.log('Parsing took:', parserTimeTaken);
|
|
18
|
+
dumpNets && console.log(visitor.dumpNets());
|
|
19
|
+
dumpData && writeFileSync('dump/tree.lisp', tree.toStringTree(null, parser));
|
|
20
|
+
dumpData && writeFileSync('dump/raw-parser.txt', visitor.logger.dump());
|
|
21
|
+
if (hasError || hasParseError) {
|
|
22
|
+
console.log('Error while parsing');
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
visitor.annotateComponents();
|
|
26
|
+
if (kicadNetlistPath) {
|
|
27
|
+
const kicadNetList = generateKiCADNetList(visitor.getNetList());
|
|
28
|
+
writeFileSync(kicadNetlistPath, kicadNetList);
|
|
29
|
+
console.log('Generated KiCad netlist file');
|
|
30
|
+
}
|
|
31
|
+
const { sequence, nets } = visitor.getGraph();
|
|
32
|
+
const tmpSequence = sequence.map(item => {
|
|
33
|
+
const tmp = [...item];
|
|
34
|
+
const action = tmp[0];
|
|
35
|
+
if (action === SequenceAction.Wire) {
|
|
36
|
+
tmp[2] = tmp[2].map(item2 => {
|
|
37
|
+
return [item2.direction, item2.value].join(",");
|
|
38
|
+
}).join(" ");
|
|
39
|
+
}
|
|
40
|
+
else if (action === SequenceAction.Frame) {
|
|
41
|
+
tmp[1] = item[1].frameId;
|
|
42
|
+
}
|
|
43
|
+
else if (action !== SequenceAction.WireJump) {
|
|
44
|
+
tmp[1] = item[1].instanceName;
|
|
45
|
+
}
|
|
46
|
+
return tmp.join(" | ");
|
|
47
|
+
});
|
|
48
|
+
dumpData && writeFileSync('dump/raw-sequence.txt', tmpSequence.join('\n'));
|
|
49
|
+
let svgOutput = null;
|
|
50
|
+
try {
|
|
51
|
+
const layoutEngine = new LayoutEngine();
|
|
52
|
+
const layoutTimer = new SimpleStopwatch();
|
|
53
|
+
const graph = layoutEngine.runLayout(sequence, nets);
|
|
54
|
+
layoutEngine.printWarnings();
|
|
55
|
+
showStats && console.log('Layout took:', layoutTimer.lap());
|
|
56
|
+
dumpData && writeFileSync('dump/raw-layout.txt', layoutEngine.logger.dump());
|
|
57
|
+
const generateSvgTimer = new SimpleStopwatch();
|
|
58
|
+
svgOutput = generateSVG2(graph);
|
|
59
|
+
showStats && console.log('Render took:', generateSvgTimer.lap());
|
|
60
|
+
if (outputPath) {
|
|
61
|
+
writeFileSync(outputPath, svgOutput);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
catch (err) {
|
|
65
|
+
console.log('Failed to render:');
|
|
66
|
+
console.log(err);
|
|
67
|
+
}
|
|
68
|
+
return svgOutput;
|
|
69
|
+
}
|
package/build/src/main.js
CHANGED
|
@@ -3,18 +3,14 @@ import { program } from 'commander';
|
|
|
3
3
|
import figlet from 'figlet';
|
|
4
4
|
import path from 'path';
|
|
5
5
|
import { fileURLToPath } from 'url';
|
|
6
|
-
import { readFileSync, watch
|
|
7
|
-
import { MainVisitor } from './visitor.js';
|
|
6
|
+
import { readFileSync, watch } from 'fs';
|
|
8
7
|
import { prepareSizing } from './sizing.js';
|
|
9
|
-
import {
|
|
10
|
-
import { generateSVG2 } from './render.js';
|
|
11
|
-
import { SequenceAction } from './objects/ExecutionScope.js';
|
|
12
|
-
import { parseFileWithVisitor } from './parser.js';
|
|
13
|
-
import { generateKiCADNetList } from './export.js';
|
|
14
|
-
import { SimpleStopwatch } from './utils.js';
|
|
8
|
+
import { renderScript } from './helpers.js';
|
|
15
9
|
export default async function main() {
|
|
16
10
|
const toolSrcPath = fileURLToPath(import.meta.url);
|
|
17
11
|
const toolDirectory = path.dirname(toolSrcPath) + '/../../';
|
|
12
|
+
const fontsPath = toolDirectory + '/fonts';
|
|
13
|
+
const defaultLibsPath = toolDirectory + '/libs';
|
|
18
14
|
const packageJson = JSON.parse(readFileSync(toolDirectory + 'package.json').toString());
|
|
19
15
|
;
|
|
20
16
|
const { version } = packageJson;
|
|
@@ -44,8 +40,6 @@ export default async function main() {
|
|
|
44
40
|
const dumpData = options.dumpData;
|
|
45
41
|
const kicadNetlist = options.kicadNetlist;
|
|
46
42
|
let currentDirectory = options.currentDirectory ?? null;
|
|
47
|
-
const fontsPath = toolDirectory + '/fonts';
|
|
48
|
-
const defaultLibsPath = toolDirectory + '/libs';
|
|
49
43
|
if (watchFileChanges) {
|
|
50
44
|
console.log('watching for file changes...');
|
|
51
45
|
}
|
|
@@ -75,7 +69,7 @@ export default async function main() {
|
|
|
75
69
|
console.log(output);
|
|
76
70
|
}
|
|
77
71
|
if (watchFileChanges) {
|
|
78
|
-
watch(inputFilePath,
|
|
72
|
+
watch(inputFilePath, event => {
|
|
79
73
|
if (event === 'change') {
|
|
80
74
|
const scriptData = readFileSync(inputFilePath, { encoding: 'utf-8' });
|
|
81
75
|
renderScript(scriptData, outputPath, renderOptions);
|
|
@@ -84,67 +78,4 @@ export default async function main() {
|
|
|
84
78
|
});
|
|
85
79
|
}
|
|
86
80
|
}
|
|
87
|
-
export function renderScript(scriptData, outputPath, options) {
|
|
88
|
-
const { currentDirectory = null, defaultLibsPath, dumpNets = false, dumpData = false, kicadNetlistPath = null, showStats = false } = options;
|
|
89
|
-
const visitor = new MainVisitor(true);
|
|
90
|
-
visitor.onImportFile = visitor.createImportFileHandler(currentDirectory, defaultLibsPath);
|
|
91
|
-
visitor.print('reading file');
|
|
92
|
-
visitor.print('done reading file');
|
|
93
|
-
const { tree, parser, hasParseError, hasError, parserTimeTaken, lexerTimeTaken } = parseFileWithVisitor(visitor, scriptData);
|
|
94
|
-
showStats && console.log('Lexing took:', lexerTimeTaken);
|
|
95
|
-
showStats && console.log('Parsing took:', parserTimeTaken);
|
|
96
|
-
if (dumpNets) {
|
|
97
|
-
console.log(visitor.dumpNets());
|
|
98
|
-
}
|
|
99
|
-
dumpData && writeFileSync('dump/tree.lisp', tree.toStringTree(null, parser));
|
|
100
|
-
dumpData && writeFileSync('dump/raw-parser.txt', visitor.logger.dump());
|
|
101
|
-
if (hasError || hasParseError) {
|
|
102
|
-
console.log('Error while parsing');
|
|
103
|
-
return;
|
|
104
|
-
}
|
|
105
|
-
visitor.annotateComponents();
|
|
106
|
-
if (kicadNetlistPath) {
|
|
107
|
-
const kicadNetList = generateKiCADNetList(visitor.getNetList());
|
|
108
|
-
writeFileSync(kicadNetlistPath, kicadNetList);
|
|
109
|
-
console.log('Generated KiCad netlist file');
|
|
110
|
-
}
|
|
111
|
-
const { sequence, nets } = visitor.getGraph();
|
|
112
|
-
const tmpSequence = sequence.map(item => {
|
|
113
|
-
const tmp = [...item];
|
|
114
|
-
const action = tmp[0];
|
|
115
|
-
if (action === SequenceAction.Wire) {
|
|
116
|
-
tmp[2] = tmp[2].map(item2 => {
|
|
117
|
-
return [item2.direction, item2.value].join(",");
|
|
118
|
-
}).join(" ");
|
|
119
|
-
}
|
|
120
|
-
else if (action === SequenceAction.Frame) {
|
|
121
|
-
tmp[1] = item[1].frameId;
|
|
122
|
-
}
|
|
123
|
-
else if (action !== SequenceAction.WireJump) {
|
|
124
|
-
tmp[1] = item[1].instanceName;
|
|
125
|
-
}
|
|
126
|
-
return tmp.join(" | ");
|
|
127
|
-
});
|
|
128
|
-
dumpData && writeFileSync('dump/raw-sequence.txt', tmpSequence.join('\n'));
|
|
129
|
-
let svgOutput = null;
|
|
130
|
-
try {
|
|
131
|
-
const layoutEngine = new LayoutEngine();
|
|
132
|
-
const layoutTimer = new SimpleStopwatch();
|
|
133
|
-
const graph = layoutEngine.runLayout(sequence, nets);
|
|
134
|
-
layoutEngine.printWarnings();
|
|
135
|
-
showStats && console.log('Layout took:', layoutTimer.lap());
|
|
136
|
-
dumpData && writeFileSync('dump/raw-layout.txt', layoutEngine.logger.dump());
|
|
137
|
-
const generateSvgTimer = new SimpleStopwatch();
|
|
138
|
-
svgOutput = generateSVG2(graph);
|
|
139
|
-
showStats && console.log('Render took:', generateSvgTimer.lap());
|
|
140
|
-
if (outputPath) {
|
|
141
|
-
writeFileSync(outputPath, svgOutput);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
catch (err) {
|
|
145
|
-
console.log('Failed to render:');
|
|
146
|
-
console.log(err);
|
|
147
|
-
}
|
|
148
|
-
return svgOutput;
|
|
149
|
-
}
|
|
150
81
|
main();
|
package/build/src/parser.js
CHANGED
|
@@ -63,12 +63,6 @@ export class CircuitscriptParserErrorListener extends ErrorListener {
|
|
|
63
63
|
console.log("Syntax error at line", line, ':', column, ' - ', msg);
|
|
64
64
|
this.syntaxErrorCounter++;
|
|
65
65
|
}
|
|
66
|
-
reportAmbiguity(recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs) {
|
|
67
|
-
}
|
|
68
|
-
reportAttemptingFullContext(recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs) {
|
|
69
|
-
}
|
|
70
|
-
reportContextSensitivity(recognizer, dfa, startIndex, stopIndex, prediction, configs) {
|
|
71
|
-
}
|
|
72
66
|
hasParseErrors() {
|
|
73
67
|
return (this.syntaxErrorCounter > 0);
|
|
74
68
|
}
|