circuitscript 0.1.5 → 0.1.8
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/dist/cjs/BaseVisitor.js +127 -73
- package/dist/cjs/SemanticTokenVisitor.js +19 -13
- package/dist/cjs/antlr/CircuitScriptParser.js +711 -671
- package/dist/cjs/builtinMethods.js +29 -25
- package/dist/cjs/environment.js +118 -0
- package/dist/cjs/execute.js +53 -12
- package/dist/cjs/export.js +0 -5
- package/dist/cjs/geometry.js +1 -0
- package/dist/cjs/globals.js +11 -6
- package/dist/cjs/helpers.js +152 -127
- package/dist/cjs/index.js +5 -0
- package/dist/cjs/layout.js +86 -44
- package/dist/cjs/main.js +31 -19
- package/dist/cjs/objects/ExecutionScope.js +33 -0
- package/dist/cjs/objects/ParamDefinition.js +15 -15
- package/dist/cjs/parser.js +27 -21
- package/dist/cjs/regenerate-tests.js +14 -10
- package/dist/cjs/render.js +3 -1
- package/dist/cjs/sizing.js +5 -58
- package/dist/cjs/utils.js +85 -30
- package/dist/cjs/validate/SymbolTable.js +96 -0
- package/dist/cjs/validate/SymbolValidatorResolveVisitor.js +14 -0
- package/dist/cjs/validate/SymbolValidatorVisitor.js +170 -0
- package/dist/cjs/validate.js +71 -44
- package/dist/cjs/visitor.js +140 -24
- package/dist/esm/{BaseVisitor.mjs → BaseVisitor.js} +98 -45
- package/dist/esm/{SemanticTokenVisitor.mjs → SemanticTokenVisitor.js} +17 -11
- package/dist/esm/antlr/{CircuitScriptParser.mjs → CircuitScriptParser.js} +711 -671
- package/dist/esm/{builtinMethods.mjs → builtinMethods.js} +20 -16
- package/dist/esm/{draw_symbols.mjs → draw_symbols.js} +7 -7
- package/dist/esm/environment.js +110 -0
- package/dist/esm/{execute.mjs → execute.js} +66 -25
- package/dist/esm/{export.mjs → export.js} +2 -7
- package/dist/esm/{geometry.mjs → geometry.js} +6 -5
- package/dist/esm/{globals.mjs → globals.js} +6 -1
- package/dist/esm/helpers.js +394 -0
- package/dist/esm/index.js +20 -0
- package/dist/esm/{layout.mjs → layout.js} +72 -53
- package/dist/esm/{lexer.mjs → lexer.js} +2 -2
- package/dist/esm/{main.mjs → main.js} +33 -21
- package/dist/esm/objects/{ClassComponent.mjs → ClassComponent.js} +5 -4
- package/dist/esm/objects/{ExecutionScope.mjs → ExecutionScope.js} +33 -0
- package/dist/esm/objects/{Frame.mjs → Frame.js} +1 -1
- package/dist/esm/objects/{ParamDefinition.mjs → ParamDefinition.js} +1 -1
- package/dist/esm/objects/{PinDefinition.mjs → PinDefinition.js} +1 -1
- package/dist/esm/parser.js +71 -0
- package/dist/esm/{regenerate-tests.mjs → regenerate-tests.js} +15 -11
- package/dist/esm/{render.mjs → render.js} +11 -9
- package/dist/esm/{sizing.mjs → sizing.js} +6 -34
- package/dist/esm/{utils.mjs → utils.js} +61 -17
- package/dist/esm/validate/SymbolTable.js +90 -0
- package/dist/esm/validate/SymbolValidatorResolveVisitor.js +10 -0
- package/dist/esm/validate/SymbolValidatorVisitor.js +163 -0
- package/dist/esm/validate.js +105 -0
- package/dist/esm/{visitor.mjs → visitor.js} +151 -35
- package/dist/fonts/Arial.ttf +0 -0
- package/dist/fonts/Inter-Bold.ttf +0 -0
- package/dist/fonts/Inter-Regular.ttf +0 -0
- package/dist/fonts/OpenSans-Regular.ttf +0 -0
- package/dist/fonts/Roboto-Regular.ttf +0 -0
- package/dist/libs/lib.cst +423 -0
- package/dist/types/BaseVisitor.d.ts +34 -21
- package/dist/types/SemanticTokenVisitor.d.ts +6 -5
- package/dist/types/antlr/CircuitScriptParser.d.ts +4 -2
- package/dist/types/builtinMethods.d.ts +3 -2
- package/dist/types/environment.d.ts +31 -0
- package/dist/types/globals.d.ts +4 -1
- package/dist/types/helpers.d.ts +12 -14
- package/dist/types/index.d.ts +5 -0
- package/dist/types/layout.d.ts +2 -2
- package/dist/types/objects/ClassComponent.d.ts +1 -0
- package/dist/types/objects/ExecutionScope.d.ts +11 -0
- package/dist/types/objects/types.d.ts +6 -1
- package/dist/types/parser.d.ts +7 -11
- package/dist/types/sizing.d.ts +0 -3
- package/dist/types/utils.d.ts +30 -6
- package/dist/types/validate/SymbolTable.d.ts +40 -0
- package/dist/types/validate/SymbolValidatorResolveVisitor.d.ts +7 -0
- package/dist/types/validate/SymbolValidatorVisitor.d.ts +32 -0
- package/dist/types/validate.d.ts +1 -1
- package/package.json +15 -14
- package/dist/cjs/SymbolValidatorVisitor.js +0 -233
- package/dist/esm/SymbolValidatorVisitor.mjs +0 -222
- package/dist/esm/helpers.mjs +0 -364
- package/dist/esm/index.mjs +0 -15
- package/dist/esm/parser.mjs +0 -64
- package/dist/esm/validate.mjs +0 -74
- package/dist/types/SymbolValidatorVisitor.d.ts +0 -61
- /package/dist/esm/antlr/{CircuitScriptLexer.mjs → CircuitScriptLexer.js} +0 -0
- /package/dist/esm/antlr/{CircuitScriptVisitor.mjs → CircuitScriptVisitor.js} +0 -0
- /package/dist/esm/{fonts.mjs → fonts.js} +0 -0
- /package/dist/esm/{logger.mjs → logger.js} +0 -0
- /package/dist/esm/objects/{Net.mjs → Net.js} +0 -0
- /package/dist/esm/objects/{PinTypes.mjs → PinTypes.js} +0 -0
- /package/dist/esm/objects/{Wire.mjs → Wire.js} +0 -0
- /package/dist/esm/objects/{types.mjs → types.js} +0 -0
- /package/dist/esm/{server.mjs → server.js} +0 -0
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import Big from "big.js";
|
|
2
|
-
import { numeric, NumericValue } from "./objects/ParamDefinition";
|
|
3
|
-
import { resolveToNumericValue } from "./utils";
|
|
2
|
+
import { numeric, NumericValue } from "./objects/ParamDefinition.js";
|
|
3
|
+
import { resolveToNumericValue } from "./utils.js";
|
|
4
|
+
const builtInMethods = [
|
|
5
|
+
['enumerate', enumerate],
|
|
6
|
+
['toMils', toMils],
|
|
7
|
+
['range', range],
|
|
8
|
+
['len', objectLength],
|
|
9
|
+
['arrayPush', arrayPush],
|
|
10
|
+
['arrayGet', arrayGet],
|
|
11
|
+
['print', null],
|
|
12
|
+
];
|
|
13
|
+
export const buildInMethodNamesList = builtInMethods.map(item => item[0]);
|
|
4
14
|
export function linkBuiltInMethods(context, visitor) {
|
|
5
15
|
context.createFunction('print', (params) => {
|
|
6
16
|
const args = getPositionParams(params);
|
|
@@ -12,20 +22,14 @@ export function linkBuiltInMethods(context, visitor) {
|
|
|
12
22
|
visitor.printStream.push(printedValue);
|
|
13
23
|
return [visitor, printedValue];
|
|
14
24
|
});
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
builtIns.forEach(([functionName, functionImpl]) => {
|
|
24
|
-
context.createFunction(functionName, params => {
|
|
25
|
-
const args = getPositionParams(params);
|
|
26
|
-
const functionReturn = functionImpl(...args);
|
|
27
|
-
return [visitor, functionReturn];
|
|
28
|
-
});
|
|
25
|
+
builtInMethods.forEach(([functionName, functionImpl]) => {
|
|
26
|
+
if (functionImpl !== null) {
|
|
27
|
+
context.createFunction(functionName, params => {
|
|
28
|
+
const args = getPositionParams(params);
|
|
29
|
+
const functionReturn = functionImpl(...args);
|
|
30
|
+
return [visitor, functionReturn];
|
|
31
|
+
});
|
|
32
|
+
}
|
|
29
33
|
});
|
|
30
34
|
}
|
|
31
35
|
function range(...args) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { milsToMM } from "./helpers.
|
|
2
|
-
import { ColorScheme, CustomSymbolParamTextSize, CustomSymbolPinIdSize, CustomSymbolPinTextSize, CustomSymbolRefDesSize, PortArrowSize, PortPaddingHorizontal, PortPaddingVertical, ReferenceTypes, RenderFlags, SymbolPinSide, defaultFont, defaultPinIdTextSize, defaultPinNameTextSize, defaultSymbolLineWidth, fontDisplayScale } from "./globals.
|
|
3
|
-
import { Geometry, GeometryProp, HorizontalAlign, HorizontalAlignProp, Textbox, VerticalAlign, VerticalAlignProp } from "./geometry.
|
|
4
|
-
import { PinTypes } from "./objects/PinTypes.
|
|
5
|
-
import { roundValue, throwWithContext } from "./utils.
|
|
6
|
-
import { DeclaredReference, UndeclaredReference } from "./objects/types.
|
|
7
|
-
import { numeric, NumericValue } from "./objects/ParamDefinition.
|
|
1
|
+
import { milsToMM } from "./helpers.js";
|
|
2
|
+
import { ColorScheme, CustomSymbolParamTextSize, CustomSymbolPinIdSize, CustomSymbolPinTextSize, CustomSymbolRefDesSize, PortArrowSize, PortPaddingHorizontal, PortPaddingVertical, ReferenceTypes, RenderFlags, SymbolPinSide, defaultFont, defaultPinIdTextSize, defaultPinNameTextSize, defaultSymbolLineWidth, fontDisplayScale } from "./globals.js";
|
|
3
|
+
import { Geometry, GeometryProp, HorizontalAlign, HorizontalAlignProp, Textbox, VerticalAlign, VerticalAlignProp } from "./geometry.js";
|
|
4
|
+
import { PinTypes } from "./objects/PinTypes.js";
|
|
5
|
+
import { roundValue, throwWithContext } from "./utils.js";
|
|
6
|
+
import { DeclaredReference, UndeclaredReference } from "./objects/types.js";
|
|
7
|
+
import { numeric, NumericValue } from "./objects/ParamDefinition.js";
|
|
8
8
|
export class SymbolGraphic {
|
|
9
9
|
drawPortsName = true;
|
|
10
10
|
displayBounds = false;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { registerWindow, SVG } from "@svgdotjs/svg.js";
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
import path from "path";
|
|
4
|
+
import { TOOL_VERSION } from "./globals.js";
|
|
5
|
+
import { RuntimeExecutionError } from "./utils.js";
|
|
6
|
+
export class NodeScriptEnvironment {
|
|
7
|
+
static _instance = null;
|
|
8
|
+
static setInstance(instance) {
|
|
9
|
+
NodeScriptEnvironment._instance = instance;
|
|
10
|
+
}
|
|
11
|
+
static getInstance() {
|
|
12
|
+
return NodeScriptEnvironment._instance;
|
|
13
|
+
}
|
|
14
|
+
useModuleDirectoryPath = null;
|
|
15
|
+
useDefaultLibsPath = null;
|
|
16
|
+
globalCreateSVGWindow = null;
|
|
17
|
+
supportedFonts = {
|
|
18
|
+
'Arial': 'Arial.ttf',
|
|
19
|
+
};
|
|
20
|
+
setModuleDirectory(path) {
|
|
21
|
+
this.useModuleDirectoryPath = path;
|
|
22
|
+
}
|
|
23
|
+
setDefaultLibsPath(path) {
|
|
24
|
+
this.useDefaultLibsPath = path;
|
|
25
|
+
}
|
|
26
|
+
getPackageVersion() {
|
|
27
|
+
return TOOL_VERSION;
|
|
28
|
+
}
|
|
29
|
+
getModuleDirectory() {
|
|
30
|
+
if (this.useModuleDirectoryPath !== null) {
|
|
31
|
+
return this.useModuleDirectoryPath;
|
|
32
|
+
}
|
|
33
|
+
if (typeof __dirname !== 'undefined') {
|
|
34
|
+
return __dirname;
|
|
35
|
+
}
|
|
36
|
+
const stackLine = new Error().stack?.split('\n')[1];
|
|
37
|
+
if (stackLine) {
|
|
38
|
+
const fileMatch = stackLine.match(/\((.+)\:[\d]+\:[\d]+\)/);
|
|
39
|
+
if (fileMatch) {
|
|
40
|
+
const filePath = fileMatch[1].replace('file://', '');
|
|
41
|
+
return path.dirname(filePath);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
throw new RuntimeExecutionError("Failed to get current module directory");
|
|
45
|
+
}
|
|
46
|
+
getRelativeToModule(filePath) {
|
|
47
|
+
return path.join(this.getModuleDirectory(), filePath);
|
|
48
|
+
}
|
|
49
|
+
getRelativeToDefaultLibs(filePath) {
|
|
50
|
+
return path.join(this.getDefaultLibsPath(), filePath);
|
|
51
|
+
}
|
|
52
|
+
getToolsPath() {
|
|
53
|
+
return path.normalize(this.getModuleDirectory() + '/../');
|
|
54
|
+
}
|
|
55
|
+
getFontsPath() {
|
|
56
|
+
return path.normalize(this.getToolsPath() + "fonts");
|
|
57
|
+
}
|
|
58
|
+
getDefaultLibsPath() {
|
|
59
|
+
if (this.useDefaultLibsPath !== null) {
|
|
60
|
+
return this.useDefaultLibsPath;
|
|
61
|
+
}
|
|
62
|
+
return path.normalize(this.getToolsPath() + "libs");
|
|
63
|
+
}
|
|
64
|
+
async prepareSVGEnvironmentInternal(fontsPath) {
|
|
65
|
+
try {
|
|
66
|
+
const dynamicImport = new Function('specifier', 'return import(specifier)');
|
|
67
|
+
const { config, createSVGWindow } = await dynamicImport('svgdom');
|
|
68
|
+
this.globalCreateSVGWindow = createSVGWindow;
|
|
69
|
+
if (fontsPath !== null) {
|
|
70
|
+
await config.setFontDir(fontsPath)
|
|
71
|
+
.setFontFamilyMappings(this.supportedFonts)
|
|
72
|
+
.preloadFonts();
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
throw new Error(`Failed to load svgdom ESM module: ${error}`);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
createSVGWindow() {
|
|
80
|
+
if (this.globalCreateSVGWindow === null) {
|
|
81
|
+
throw new Error("SVG environment is not set up yet. Call prepareSVGEnvironment() first.");
|
|
82
|
+
}
|
|
83
|
+
return this.globalCreateSVGWindow();
|
|
84
|
+
}
|
|
85
|
+
textMeasurementCanvas;
|
|
86
|
+
getCanvasWindow() {
|
|
87
|
+
if (this.textMeasurementCanvas === undefined) {
|
|
88
|
+
const window = this.createSVGWindow();
|
|
89
|
+
const { document } = window;
|
|
90
|
+
registerWindow(window, document);
|
|
91
|
+
this.textMeasurementCanvas = SVG(document.documentElement);
|
|
92
|
+
}
|
|
93
|
+
return this.textMeasurementCanvas;
|
|
94
|
+
}
|
|
95
|
+
prepareSVGEnvironment() {
|
|
96
|
+
return this.prepareSVGEnvironmentInternal(this.getFontsPath());
|
|
97
|
+
}
|
|
98
|
+
async readFile(path, options) {
|
|
99
|
+
return fs.promises.readFile(path, options);
|
|
100
|
+
}
|
|
101
|
+
async exists(path) {
|
|
102
|
+
try {
|
|
103
|
+
fs.promises.access(path, fs.constants.F_OK);
|
|
104
|
+
return true;
|
|
105
|
+
}
|
|
106
|
+
catch (err) {
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { BlockTypes, ComponentTypes, Delimiter1, GlobalNames, NoNetText, ParamKeys, ReferenceTypes, SymbolPinSide } from './globals.
|
|
2
|
-
import { ClassComponent, ModuleComponent } from './objects/ClassComponent.
|
|
3
|
-
import { ActiveObject, ExecutionScope, FrameAction, SequenceAction } from './objects/ExecutionScope.
|
|
4
|
-
import { Net } from './objects/Net.
|
|
5
|
-
import { numeric } from './objects/ParamDefinition.
|
|
6
|
-
import { PortSide } from './objects/PinDefinition.
|
|
7
|
-
import { DeclaredReference, Direction } from './objects/types.
|
|
8
|
-
import { Wire } from './objects/Wire.
|
|
9
|
-
import { Frame } from './objects/Frame.
|
|
10
|
-
import { CalculatePinPositions } from './layout.
|
|
11
|
-
import { UnitDimension } from './helpers.
|
|
12
|
-
import { PlaceHolderCommands, SymbolDrawingCommands } from './draw_symbols.
|
|
13
|
-
import { getBlockTypeString } from './utils.
|
|
1
|
+
import { BlockTypes, ComponentTypes, Delimiter1, GlobalNames, NoNetText, ParamKeys, ReferenceTypes, SymbolPinSide } from './globals.js';
|
|
2
|
+
import { ClassComponent, ModuleComponent } from './objects/ClassComponent.js';
|
|
3
|
+
import { ActiveObject, ExecutionScope, FrameAction, SequenceAction } from './objects/ExecutionScope.js';
|
|
4
|
+
import { Net } from './objects/Net.js';
|
|
5
|
+
import { numeric } from './objects/ParamDefinition.js';
|
|
6
|
+
import { PortSide } from './objects/PinDefinition.js';
|
|
7
|
+
import { DeclaredReference, Direction } from './objects/types.js';
|
|
8
|
+
import { Wire } from './objects/Wire.js';
|
|
9
|
+
import { Frame } from './objects/Frame.js';
|
|
10
|
+
import { CalculatePinPositions } from './layout.js';
|
|
11
|
+
import { UnitDimension } from './helpers.js';
|
|
12
|
+
import { PlaceHolderCommands, SymbolDrawingCommands } from './draw_symbols.js';
|
|
13
|
+
import { getBlockTypeString, RuntimeExecutionError } from './utils.js';
|
|
14
14
|
export class ExecutionContext {
|
|
15
15
|
name;
|
|
16
16
|
namespace;
|
|
@@ -211,7 +211,7 @@ export class ExecutionContext {
|
|
|
211
211
|
this.log('to component');
|
|
212
212
|
const { addSequence = false } = options ?? {};
|
|
213
213
|
if (!(component instanceof ClassComponent)) {
|
|
214
|
-
throw "Not a valid component!";
|
|
214
|
+
throw new RuntimeExecutionError("Not a valid component!");
|
|
215
215
|
}
|
|
216
216
|
if (pinId === null) {
|
|
217
217
|
pinId = component.getDefaultPin();
|
|
@@ -222,7 +222,7 @@ export class ExecutionContext {
|
|
|
222
222
|
}
|
|
223
223
|
else {
|
|
224
224
|
console.trace();
|
|
225
|
-
throw ('Invalid pin number ' +
|
|
225
|
+
throw new RuntimeExecutionError('Invalid pin number ' +
|
|
226
226
|
pinId +
|
|
227
227
|
' in ' +
|
|
228
228
|
component.instanceName);
|
|
@@ -347,6 +347,7 @@ export class ExecutionContext {
|
|
|
347
347
|
const stackRef = this.scope.blockStack.get(this.scope.indentLevel);
|
|
348
348
|
stackRef['block_index'] = blockIndex;
|
|
349
349
|
const { type: blockType } = stackRef;
|
|
350
|
+
const blockTypeName = getBlockTypeString(blockType);
|
|
350
351
|
stackRef['inner_blocks'].set(blockIndex, {
|
|
351
352
|
last_net: null,
|
|
352
353
|
ignore_last_net: false,
|
|
@@ -359,7 +360,7 @@ export class ExecutionContext {
|
|
|
359
360
|
const { entered_at: [component, pin,] } = stackRef;
|
|
360
361
|
this.atComponent(component, pin, { addSequence: true });
|
|
361
362
|
}
|
|
362
|
-
this.log(`enter inner block of type (${
|
|
363
|
+
this.log(`enter inner block of type (${blockTypeName}) >>>`);
|
|
363
364
|
this.scope.indentLevel += 1;
|
|
364
365
|
}
|
|
365
366
|
exitBlock(blockIndex) {
|
|
@@ -660,24 +661,64 @@ export class ExecutionContext {
|
|
|
660
661
|
}
|
|
661
662
|
const useName = userDefined ? 'point.' + pointId : pointId;
|
|
662
663
|
const componentPoint = ClassComponent.simple(useName, 1);
|
|
663
|
-
componentPoint.displayProp = this.getPointSymbol();
|
|
664
|
+
componentPoint.displayProp = this.getPointSymbol(useName);
|
|
664
665
|
componentPoint.typeProp = ComponentTypes.net;
|
|
666
|
+
let usePointLinkComponent = null;
|
|
667
|
+
if (this.scope.currentComponent._pointLinkComponent) {
|
|
668
|
+
usePointLinkComponent = this.scope.currentComponent._pointLinkComponent;
|
|
669
|
+
}
|
|
670
|
+
else {
|
|
671
|
+
usePointLinkComponent = this.scope.currentComponent;
|
|
672
|
+
}
|
|
673
|
+
componentPoint._pointLinkComponent = usePointLinkComponent;
|
|
665
674
|
this.scope.instances.set(pointId, componentPoint);
|
|
666
675
|
this.toComponent(componentPoint, 1, { addSequence: true });
|
|
667
676
|
return this.getCurrentPoint();
|
|
668
677
|
}
|
|
669
|
-
getPointSymbol() {
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
[
|
|
673
|
-
|
|
674
|
-
|
|
678
|
+
getPointSymbol(name = "") {
|
|
679
|
+
const commands = [
|
|
680
|
+
[PlaceHolderCommands.pin,
|
|
681
|
+
[numeric(1), numeric(0), numeric(0),
|
|
682
|
+
numeric(0), numeric(0)],
|
|
683
|
+
new Map([
|
|
684
|
+
["display_pin_id", false]
|
|
685
|
+
]),
|
|
686
|
+
null
|
|
687
|
+
]
|
|
688
|
+
];
|
|
689
|
+
if (false) {
|
|
690
|
+
commands.push(...[
|
|
691
|
+
[PlaceHolderCommands.lineColor,
|
|
692
|
+
["red"],
|
|
693
|
+
new Map(), null
|
|
694
|
+
],
|
|
695
|
+
[PlaceHolderCommands.hline,
|
|
696
|
+
[numeric(-25), numeric(0), numeric(50)],
|
|
697
|
+
new Map(),
|
|
698
|
+
null
|
|
699
|
+
],
|
|
700
|
+
[PlaceHolderCommands.vline,
|
|
701
|
+
[numeric(0), numeric(-25), numeric(50)],
|
|
702
|
+
new Map(),
|
|
703
|
+
null
|
|
704
|
+
],
|
|
705
|
+
[PlaceHolderCommands.hline,
|
|
706
|
+
[numeric(0), numeric(0),
|
|
707
|
+
numeric(10)],
|
|
708
|
+
new Map([]), null
|
|
709
|
+
],
|
|
710
|
+
[PlaceHolderCommands.text,
|
|
711
|
+
[],
|
|
675
712
|
new Map([
|
|
676
|
-
["
|
|
713
|
+
["content", name],
|
|
714
|
+
["fontSize", numeric(10)],
|
|
677
715
|
]),
|
|
678
716
|
null
|
|
679
717
|
]
|
|
680
|
-
];
|
|
718
|
+
]);
|
|
719
|
+
}
|
|
720
|
+
return new SymbolDrawingCommands(() => {
|
|
721
|
+
return commands;
|
|
681
722
|
});
|
|
682
723
|
}
|
|
683
724
|
setProperty(nameWithProp, value) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { NumericValue } from "./objects/ParamDefinition.
|
|
1
|
+
import { NoNetText } from "./globals.js";
|
|
2
|
+
import { NumericValue } from "./objects/ParamDefinition.js";
|
|
3
3
|
export function generateKiCADNetList(netlist) {
|
|
4
4
|
const componentsList = [];
|
|
5
5
|
const nets = {};
|
|
@@ -47,11 +47,6 @@ export function generateKiCADNetList(netlist) {
|
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
else {
|
|
50
|
-
if (instance.typeProp !== ComponentTypes.net &&
|
|
51
|
-
instance.typeProp !== ComponentTypes.graphic &&
|
|
52
|
-
instance.typeProp !== null) {
|
|
53
|
-
console.log('Skipping', instance.instanceName);
|
|
54
|
-
}
|
|
55
50
|
}
|
|
56
51
|
});
|
|
57
52
|
const netItems = [];
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import Flatten from '@flatten-js/core';
|
|
2
|
-
import { measureTextSize2 } from './sizing.
|
|
3
|
-
import { defaultFont, fontDisplayScale, PortArrowSize, PortPaddingHorizontal, PortPaddingVertical } from './globals.
|
|
4
|
-
import { numeric, NumericValue } from './objects/ParamDefinition.
|
|
5
|
-
import { AllPinTypes, PinTypes } from './objects/PinTypes.
|
|
6
|
-
import { roundValue } from './utils.
|
|
2
|
+
import { measureTextSize2 } from './sizing.js';
|
|
3
|
+
import { defaultFont, fontDisplayScale, PortArrowSize, PortPaddingHorizontal, PortPaddingVertical } from './globals.js';
|
|
4
|
+
import { numeric, NumericValue } from './objects/ParamDefinition.js';
|
|
5
|
+
import { AllPinTypes, PinTypes } from './objects/PinTypes.js';
|
|
6
|
+
import { roundValue } from './utils.js';
|
|
7
7
|
export class Textbox extends Flatten.Polygon {
|
|
8
8
|
id;
|
|
9
9
|
text;
|
|
@@ -384,6 +384,7 @@ export class Geometry {
|
|
|
384
384
|
replaceSegments(existingSegments, j, splitCurrentSegments);
|
|
385
385
|
replaceSegments(newSegments, k, splitNewSegments);
|
|
386
386
|
j = Math.max(0, j - 1);
|
|
387
|
+
break;
|
|
387
388
|
}
|
|
388
389
|
}
|
|
389
390
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { numeric } from "./objects/ParamDefinition";
|
|
1
|
+
import { numeric } from "./objects/ParamDefinition.js";
|
|
2
|
+
export const TOOL_VERSION = '0.1.5';
|
|
2
3
|
export const Delimiter1 = '-';
|
|
3
4
|
export const DoubleDelimiter1 = `${Delimiter1}${Delimiter1}`;
|
|
4
5
|
export var GlobalNames;
|
|
@@ -28,6 +29,9 @@ export var SymbolPinSide;
|
|
|
28
29
|
SymbolPinSide["Top"] = "top";
|
|
29
30
|
SymbolPinSide["Bottom"] = "bottom";
|
|
30
31
|
})(SymbolPinSide || (SymbolPinSide = {}));
|
|
32
|
+
export const ValidPinSides = [
|
|
33
|
+
SymbolPinSide.Left, SymbolPinSide.Right, SymbolPinSide.Top, SymbolPinSide.Bottom
|
|
34
|
+
];
|
|
31
35
|
export var LengthUnit;
|
|
32
36
|
(function (LengthUnit) {
|
|
33
37
|
LengthUnit["mm"] = "mm";
|
|
@@ -110,3 +114,4 @@ export const RenderFlags = {
|
|
|
110
114
|
ShowLabelBoxBounds: false,
|
|
111
115
|
ShowLabelOrigin: false,
|
|
112
116
|
};
|
|
117
|
+
export const SymbolValidatorContext = '_sym';
|