circuitscript 0.1.5 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/dist/cjs/BaseVisitor.js +127 -73
  2. package/dist/cjs/SemanticTokenVisitor.js +19 -13
  3. package/dist/cjs/antlr/CircuitScriptParser.js +711 -671
  4. package/dist/cjs/builtinMethods.js +29 -25
  5. package/dist/cjs/environment.js +118 -0
  6. package/dist/cjs/execute.js +53 -12
  7. package/dist/cjs/geometry.js +1 -0
  8. package/dist/cjs/globals.js +11 -6
  9. package/dist/cjs/helpers.js +135 -127
  10. package/dist/cjs/index.js +5 -0
  11. package/dist/cjs/layout.js +37 -12
  12. package/dist/cjs/main.js +31 -19
  13. package/dist/cjs/objects/ExecutionScope.js +33 -0
  14. package/dist/cjs/objects/ParamDefinition.js +15 -15
  15. package/dist/cjs/parser.js +27 -21
  16. package/dist/cjs/regenerate-tests.js +9 -6
  17. package/dist/cjs/render.js +3 -1
  18. package/dist/cjs/sizing.js +5 -58
  19. package/dist/cjs/utils.js +85 -30
  20. package/dist/cjs/validate/SymbolTable.js +96 -0
  21. package/dist/cjs/validate/SymbolValidatorResolveVisitor.js +14 -0
  22. package/dist/cjs/validate/SymbolValidatorVisitor.js +170 -0
  23. package/dist/cjs/validate.js +52 -44
  24. package/dist/cjs/visitor.js +140 -24
  25. package/dist/esm/{BaseVisitor.mjs → BaseVisitor.js} +98 -45
  26. package/dist/esm/{SemanticTokenVisitor.mjs → SemanticTokenVisitor.js} +17 -11
  27. package/dist/esm/antlr/{CircuitScriptParser.mjs → CircuitScriptParser.js} +711 -671
  28. package/dist/esm/{builtinMethods.mjs → builtinMethods.js} +20 -16
  29. package/dist/esm/{draw_symbols.mjs → draw_symbols.js} +7 -7
  30. package/dist/esm/environment.js +110 -0
  31. package/dist/esm/{execute.mjs → execute.js} +66 -25
  32. package/dist/esm/{export.mjs → export.js} +2 -2
  33. package/dist/esm/{geometry.mjs → geometry.js} +6 -5
  34. package/dist/esm/{globals.mjs → globals.js} +6 -1
  35. package/dist/esm/helpers.js +377 -0
  36. package/dist/esm/index.js +20 -0
  37. package/dist/esm/{layout.mjs → layout.js} +42 -20
  38. package/dist/esm/{lexer.mjs → lexer.js} +2 -2
  39. package/dist/esm/{main.mjs → main.js} +33 -21
  40. package/dist/esm/objects/{ClassComponent.mjs → ClassComponent.js} +5 -4
  41. package/dist/esm/objects/{ExecutionScope.mjs → ExecutionScope.js} +33 -0
  42. package/dist/esm/objects/{Frame.mjs → Frame.js} +1 -1
  43. package/dist/esm/objects/{ParamDefinition.mjs → ParamDefinition.js} +1 -1
  44. package/dist/esm/objects/{PinDefinition.mjs → PinDefinition.js} +1 -1
  45. package/dist/esm/parser.js +71 -0
  46. package/dist/esm/{regenerate-tests.mjs → regenerate-tests.js} +10 -7
  47. package/dist/esm/{render.mjs → render.js} +11 -9
  48. package/dist/esm/{sizing.mjs → sizing.js} +6 -34
  49. package/dist/esm/{utils.mjs → utils.js} +61 -17
  50. package/dist/esm/validate/SymbolTable.js +90 -0
  51. package/dist/esm/validate/SymbolValidatorResolveVisitor.js +10 -0
  52. package/dist/esm/validate/SymbolValidatorVisitor.js +163 -0
  53. package/dist/esm/validate.js +86 -0
  54. package/dist/esm/{visitor.mjs → visitor.js} +151 -35
  55. package/dist/fonts/Arial.ttf +0 -0
  56. package/dist/fonts/Inter-Bold.ttf +0 -0
  57. package/dist/fonts/Inter-Regular.ttf +0 -0
  58. package/dist/fonts/OpenSans-Regular.ttf +0 -0
  59. package/dist/fonts/Roboto-Regular.ttf +0 -0
  60. package/dist/libs/lib.cst +423 -0
  61. package/dist/types/BaseVisitor.d.ts +34 -21
  62. package/dist/types/SemanticTokenVisitor.d.ts +6 -5
  63. package/dist/types/antlr/CircuitScriptParser.d.ts +4 -2
  64. package/dist/types/builtinMethods.d.ts +3 -2
  65. package/dist/types/environment.d.ts +31 -0
  66. package/dist/types/globals.d.ts +4 -1
  67. package/dist/types/helpers.d.ts +12 -14
  68. package/dist/types/index.d.ts +5 -0
  69. package/dist/types/objects/ClassComponent.d.ts +1 -0
  70. package/dist/types/objects/ExecutionScope.d.ts +11 -0
  71. package/dist/types/objects/types.d.ts +6 -1
  72. package/dist/types/parser.d.ts +7 -11
  73. package/dist/types/sizing.d.ts +0 -3
  74. package/dist/types/utils.d.ts +30 -6
  75. package/dist/types/validate/SymbolTable.d.ts +40 -0
  76. package/dist/types/validate/SymbolValidatorResolveVisitor.d.ts +7 -0
  77. package/dist/types/validate/SymbolValidatorVisitor.d.ts +32 -0
  78. package/dist/types/validate.d.ts +1 -1
  79. package/package.json +14 -13
  80. package/dist/cjs/SymbolValidatorVisitor.js +0 -233
  81. package/dist/esm/SymbolValidatorVisitor.mjs +0 -222
  82. package/dist/esm/helpers.mjs +0 -364
  83. package/dist/esm/index.mjs +0 -15
  84. package/dist/esm/parser.mjs +0 -64
  85. package/dist/esm/validate.mjs +0 -74
  86. package/dist/types/SymbolValidatorVisitor.d.ts +0 -61
  87. package/dist/types/layout.d.ts +0 -148
  88. /package/dist/esm/antlr/{CircuitScriptLexer.mjs → CircuitScriptLexer.js} +0 -0
  89. /package/dist/esm/antlr/{CircuitScriptVisitor.mjs → CircuitScriptVisitor.js} +0 -0
  90. /package/dist/esm/{fonts.mjs → fonts.js} +0 -0
  91. /package/dist/esm/{logger.mjs → logger.js} +0 -0
  92. /package/dist/esm/objects/{Net.mjs → Net.js} +0 -0
  93. /package/dist/esm/objects/{PinTypes.mjs → PinTypes.js} +0 -0
  94. /package/dist/esm/objects/{Wire.mjs → Wire.js} +0 -0
  95. /package/dist/esm/objects/{types.mjs → types.js} +0 -0
  96. /package/dist/esm/{server.mjs → server.js} +0 -0
@@ -3,10 +3,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.linkBuiltInMethods = void 0;
6
+ exports.linkBuiltInMethods = exports.buildInMethodNamesList = void 0;
7
7
  const big_js_1 = __importDefault(require("big.js"));
8
- const ParamDefinition_1 = require("./objects/ParamDefinition");
9
- const utils_1 = require("./utils");
8
+ const ParamDefinition_js_1 = require("./objects/ParamDefinition.js");
9
+ const utils_js_1 = require("./utils.js");
10
+ const builtInMethods = [
11
+ ['enumerate', enumerate],
12
+ ['toMils', toMils],
13
+ ['range', range],
14
+ ['len', objectLength],
15
+ ['arrayPush', arrayPush],
16
+ ['arrayGet', arrayGet],
17
+ ['print', null],
18
+ ];
19
+ exports.buildInMethodNamesList = builtInMethods.map(item => item[0]);
10
20
  function linkBuiltInMethods(context, visitor) {
11
21
  context.createFunction('print', (params) => {
12
22
  const args = getPositionParams(params);
@@ -18,26 +28,20 @@ function linkBuiltInMethods(context, visitor) {
18
28
  visitor.printStream.push(printedValue);
19
29
  return [visitor, printedValue];
20
30
  });
21
- const builtIns = [
22
- ['enumerate', enumerate],
23
- ['toMils', toMils],
24
- ['range', range],
25
- ['len', objectLength],
26
- ['arrayPush', arrayPush],
27
- ['arrayGet', arrayGet],
28
- ];
29
- builtIns.forEach(([functionName, functionImpl]) => {
30
- context.createFunction(functionName, params => {
31
- const args = getPositionParams(params);
32
- const functionReturn = functionImpl(...args);
33
- return [visitor, functionReturn];
34
- });
31
+ builtInMethods.forEach(([functionName, functionImpl]) => {
32
+ if (functionImpl !== null) {
33
+ context.createFunction(functionName, params => {
34
+ const args = getPositionParams(params);
35
+ const functionReturn = functionImpl(...args);
36
+ return [visitor, functionReturn];
37
+ });
38
+ }
35
39
  });
36
40
  }
37
41
  exports.linkBuiltInMethods = linkBuiltInMethods;
38
42
  function range(...args) {
39
- let startValue = (0, ParamDefinition_1.numeric)(0);
40
- let endValue = (0, ParamDefinition_1.numeric)(0);
43
+ let startValue = (0, ParamDefinition_js_1.numeric)(0);
44
+ let endValue = (0, ParamDefinition_js_1.numeric)(0);
41
45
  if (args.length === 1) {
42
46
  endValue = args[0];
43
47
  }
@@ -64,7 +68,7 @@ function enumerate(array) {
64
68
  }
65
69
  function toMils(value) {
66
70
  let bigValue;
67
- if (value instanceof ParamDefinition_1.NumericValue) {
71
+ if (value instanceof ParamDefinition_js_1.NumericValue) {
68
72
  bigValue = value.toBigNumber();
69
73
  }
70
74
  else {
@@ -74,15 +78,15 @@ function toMils(value) {
74
78
  bigValue = new big_js_1.default(value);
75
79
  }
76
80
  bigValue = bigValue.div(new big_js_1.default(25.4 / 1000));
77
- return (0, utils_1.resolveToNumericValue)(bigValue);
81
+ return (0, utils_js_1.resolveToNumericValue)(bigValue);
78
82
  }
79
83
  function objectLength(obj) {
80
84
  if (Array.isArray(obj)) {
81
- return (0, ParamDefinition_1.numeric)(obj.length);
85
+ return (0, ParamDefinition_js_1.numeric)(obj.length);
82
86
  }
83
87
  else {
84
88
  if (obj.length) {
85
- return (0, ParamDefinition_1.numeric)(obj.length);
89
+ return (0, ParamDefinition_js_1.numeric)(obj.length);
86
90
  }
87
91
  else {
88
92
  throw "Could not get length of object: " + obj;
@@ -101,7 +105,7 @@ function arrayGet(arrayObject, index) {
101
105
  throw "Invalid array object to get";
102
106
  }
103
107
  let useValue;
104
- if (index instanceof ParamDefinition_1.NumericValue) {
108
+ if (index instanceof ParamDefinition_js_1.NumericValue) {
105
109
  useValue = index.toNumber();
106
110
  }
107
111
  else {
@@ -123,7 +127,7 @@ function toString(obj) {
123
127
  const inner = obj.map(item => toString(item)).join(", ");
124
128
  return "[" + inner + "]";
125
129
  }
126
- else if (obj instanceof ParamDefinition_1.NumericValue) {
130
+ else if (obj instanceof ParamDefinition_js_1.NumericValue) {
127
131
  return obj.toBigNumber().toString();
128
132
  }
129
133
  else {
@@ -0,0 +1,118 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.NodeScriptEnvironment = void 0;
7
+ const svg_js_1 = require("@svgdotjs/svg.js");
8
+ const fs_1 = __importDefault(require("fs"));
9
+ const path_1 = __importDefault(require("path"));
10
+ const globals_js_1 = require("./globals.js");
11
+ const utils_js_1 = require("./utils.js");
12
+ class NodeScriptEnvironment {
13
+ constructor() {
14
+ this.useModuleDirectoryPath = null;
15
+ this.useDefaultLibsPath = null;
16
+ this.globalCreateSVGWindow = null;
17
+ this.supportedFonts = {
18
+ 'Arial': 'Arial.ttf',
19
+ };
20
+ }
21
+ static setInstance(instance) {
22
+ NodeScriptEnvironment._instance = instance;
23
+ }
24
+ static getInstance() {
25
+ return NodeScriptEnvironment._instance;
26
+ }
27
+ setModuleDirectory(path) {
28
+ this.useModuleDirectoryPath = path;
29
+ }
30
+ setDefaultLibsPath(path) {
31
+ this.useDefaultLibsPath = path;
32
+ }
33
+ getPackageVersion() {
34
+ return globals_js_1.TOOL_VERSION;
35
+ }
36
+ getModuleDirectory() {
37
+ if (this.useModuleDirectoryPath !== null) {
38
+ return this.useModuleDirectoryPath;
39
+ }
40
+ if (typeof __dirname !== 'undefined') {
41
+ return __dirname;
42
+ }
43
+ const stackLine = new Error().stack?.split('\n')[1];
44
+ if (stackLine) {
45
+ const fileMatch = stackLine.match(/\((.+)\:[\d]+\:[\d]+\)/);
46
+ if (fileMatch) {
47
+ const filePath = fileMatch[1].replace('file://', '');
48
+ return path_1.default.dirname(filePath);
49
+ }
50
+ }
51
+ throw new utils_js_1.RuntimeExecutionError("Failed to get current module directory");
52
+ }
53
+ getRelativeToModule(filePath) {
54
+ return path_1.default.join(this.getModuleDirectory(), filePath);
55
+ }
56
+ getRelativeToDefaultLibs(filePath) {
57
+ return path_1.default.join(this.getDefaultLibsPath(), filePath);
58
+ }
59
+ getToolsPath() {
60
+ return path_1.default.normalize(this.getModuleDirectory() + '/../');
61
+ }
62
+ getFontsPath() {
63
+ return path_1.default.normalize(this.getToolsPath() + "fonts");
64
+ }
65
+ getDefaultLibsPath() {
66
+ if (this.useDefaultLibsPath !== null) {
67
+ return this.useDefaultLibsPath;
68
+ }
69
+ return path_1.default.normalize(this.getToolsPath() + "libs");
70
+ }
71
+ async prepareSVGEnvironmentInternal(fontsPath) {
72
+ try {
73
+ const dynamicImport = new Function('specifier', 'return import(specifier)');
74
+ const { config, createSVGWindow } = await dynamicImport('svgdom');
75
+ this.globalCreateSVGWindow = createSVGWindow;
76
+ if (fontsPath !== null) {
77
+ await config.setFontDir(fontsPath)
78
+ .setFontFamilyMappings(this.supportedFonts)
79
+ .preloadFonts();
80
+ }
81
+ }
82
+ catch (error) {
83
+ throw new Error(`Failed to load svgdom ESM module: ${error}`);
84
+ }
85
+ }
86
+ createSVGWindow() {
87
+ if (this.globalCreateSVGWindow === null) {
88
+ throw new Error("SVG environment is not set up yet. Call prepareSVGEnvironment() first.");
89
+ }
90
+ return this.globalCreateSVGWindow();
91
+ }
92
+ getCanvasWindow() {
93
+ if (this.textMeasurementCanvas === undefined) {
94
+ const window = this.createSVGWindow();
95
+ const { document } = window;
96
+ (0, svg_js_1.registerWindow)(window, document);
97
+ this.textMeasurementCanvas = (0, svg_js_1.SVG)(document.documentElement);
98
+ }
99
+ return this.textMeasurementCanvas;
100
+ }
101
+ prepareSVGEnvironment() {
102
+ return this.prepareSVGEnvironmentInternal(this.getFontsPath());
103
+ }
104
+ async readFile(path, options) {
105
+ return fs_1.default.promises.readFile(path, options);
106
+ }
107
+ async exists(path) {
108
+ try {
109
+ fs_1.default.promises.access(path, fs_1.default.constants.F_OK);
110
+ return true;
111
+ }
112
+ catch (err) {
113
+ return false;
114
+ }
115
+ }
116
+ }
117
+ exports.NodeScriptEnvironment = NodeScriptEnvironment;
118
+ NodeScriptEnvironment._instance = null;
@@ -206,7 +206,7 @@ class ExecutionContext {
206
206
  this.log('to component');
207
207
  const { addSequence = false } = options ?? {};
208
208
  if (!(component instanceof ClassComponent_js_1.ClassComponent)) {
209
- throw "Not a valid component!";
209
+ throw new utils_js_1.RuntimeExecutionError("Not a valid component!");
210
210
  }
211
211
  if (pinId === null) {
212
212
  pinId = component.getDefaultPin();
@@ -217,7 +217,7 @@ class ExecutionContext {
217
217
  }
218
218
  else {
219
219
  console.trace();
220
- throw ('Invalid pin number ' +
220
+ throw new utils_js_1.RuntimeExecutionError('Invalid pin number ' +
221
221
  pinId +
222
222
  ' in ' +
223
223
  component.instanceName);
@@ -342,6 +342,7 @@ class ExecutionContext {
342
342
  const stackRef = this.scope.blockStack.get(this.scope.indentLevel);
343
343
  stackRef['block_index'] = blockIndex;
344
344
  const { type: blockType } = stackRef;
345
+ const blockTypeName = (0, utils_js_1.getBlockTypeString)(blockType);
345
346
  stackRef['inner_blocks'].set(blockIndex, {
346
347
  last_net: null,
347
348
  ignore_last_net: false,
@@ -354,7 +355,7 @@ class ExecutionContext {
354
355
  const { entered_at: [component, pin,] } = stackRef;
355
356
  this.atComponent(component, pin, { addSequence: true });
356
357
  }
357
- this.log(`enter inner block of type (${blockType}) >>>`);
358
+ this.log(`enter inner block of type (${blockTypeName}) >>>`);
358
359
  this.scope.indentLevel += 1;
359
360
  }
360
361
  exitBlock(blockIndex) {
@@ -655,24 +656,64 @@ class ExecutionContext {
655
656
  }
656
657
  const useName = userDefined ? 'point.' + pointId : pointId;
657
658
  const componentPoint = ClassComponent_js_1.ClassComponent.simple(useName, 1);
658
- componentPoint.displayProp = this.getPointSymbol();
659
+ componentPoint.displayProp = this.getPointSymbol(useName);
659
660
  componentPoint.typeProp = globals_js_1.ComponentTypes.net;
661
+ let usePointLinkComponent = null;
662
+ if (this.scope.currentComponent._pointLinkComponent) {
663
+ usePointLinkComponent = this.scope.currentComponent._pointLinkComponent;
664
+ }
665
+ else {
666
+ usePointLinkComponent = this.scope.currentComponent;
667
+ }
668
+ componentPoint._pointLinkComponent = usePointLinkComponent;
660
669
  this.scope.instances.set(pointId, componentPoint);
661
670
  this.toComponent(componentPoint, 1, { addSequence: true });
662
671
  return this.getCurrentPoint();
663
672
  }
664
- getPointSymbol() {
665
- return new draw_symbols_js_1.SymbolDrawingCommands(() => {
666
- return [
667
- [draw_symbols_js_1.PlaceHolderCommands.pin,
668
- [(0, ParamDefinition_js_1.numeric)(1), (0, ParamDefinition_js_1.numeric)(0), (0, ParamDefinition_js_1.numeric)(0),
669
- (0, ParamDefinition_js_1.numeric)(0), (0, ParamDefinition_js_1.numeric)(0)],
673
+ getPointSymbol(name = "") {
674
+ const commands = [
675
+ [draw_symbols_js_1.PlaceHolderCommands.pin,
676
+ [(0, ParamDefinition_js_1.numeric)(1), (0, ParamDefinition_js_1.numeric)(0), (0, ParamDefinition_js_1.numeric)(0),
677
+ (0, ParamDefinition_js_1.numeric)(0), (0, ParamDefinition_js_1.numeric)(0)],
678
+ new Map([
679
+ ["display_pin_id", false]
680
+ ]),
681
+ null
682
+ ]
683
+ ];
684
+ if (false) {
685
+ commands.push(...[
686
+ [draw_symbols_js_1.PlaceHolderCommands.lineColor,
687
+ ["red"],
688
+ new Map(), null
689
+ ],
690
+ [draw_symbols_js_1.PlaceHolderCommands.hline,
691
+ [(0, ParamDefinition_js_1.numeric)(-25), (0, ParamDefinition_js_1.numeric)(0), (0, ParamDefinition_js_1.numeric)(50)],
692
+ new Map(),
693
+ null
694
+ ],
695
+ [draw_symbols_js_1.PlaceHolderCommands.vline,
696
+ [(0, ParamDefinition_js_1.numeric)(0), (0, ParamDefinition_js_1.numeric)(-25), (0, ParamDefinition_js_1.numeric)(50)],
697
+ new Map(),
698
+ null
699
+ ],
700
+ [draw_symbols_js_1.PlaceHolderCommands.hline,
701
+ [(0, ParamDefinition_js_1.numeric)(0), (0, ParamDefinition_js_1.numeric)(0),
702
+ (0, ParamDefinition_js_1.numeric)(10)],
703
+ new Map([]), null
704
+ ],
705
+ [draw_symbols_js_1.PlaceHolderCommands.text,
706
+ [],
670
707
  new Map([
671
- ["display_pin_id", false]
708
+ ["content", name],
709
+ ["fontSize", (0, ParamDefinition_js_1.numeric)(10)],
672
710
  ]),
673
711
  null
674
712
  ]
675
- ];
713
+ ]);
714
+ }
715
+ return new draw_symbols_js_1.SymbolDrawingCommands(() => {
716
+ return commands;
676
717
  });
677
718
  }
678
719
  setProperty(nameWithProp, value) {
@@ -383,6 +383,7 @@ class Geometry {
383
383
  replaceSegments(existingSegments, j, splitCurrentSegments);
384
384
  replaceSegments(newSegments, k, splitNewSegments);
385
385
  j = Math.max(0, j - 1);
386
+ break;
386
387
  }
387
388
  }
388
389
  }
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RenderFlags = exports.GlobalDocumentName = exports.ModuleContainsKeyword = exports.FrameType = exports.BlockTypes = exports.ReferenceTypes = exports.ComponentTypes = exports.ColorScheme = exports.PortPaddingVertical = exports.PortPaddingHorizontal = exports.PortArrowSize = exports.junctionSize = exports.defaultFontSize = exports.defaultFontBold = exports.defaultFont = exports.displayUnits = exports.defaultFrameTitleTextSize = exports.CustomSymbolParamTextSize = exports.CustomSymbolRefDesSize = exports.CustomSymbolPinIdSize = exports.CustomSymbolPinTextSize = exports.defaultPageSpacingMM = exports.defaultPageMarginMM = exports.defaultPinIdTextSize = exports.defaultPinNameTextSize = exports.defaultWireLineWidth = exports.defaultSymbolLineWidth = exports.fontDisplayScale = exports.defaultZoomScale = exports.defaultGridSizeUnits = exports.portHeight = exports.portWidth = exports.PxToMM = exports.MMToPt = exports.MMToPx = exports.MilsToMM = exports.WireAutoDirection = exports.LengthUnit = exports.SymbolPinSide = exports.LayoutDirection = exports.ParamKeys = exports.NoNetText = exports.GlobalNames = exports.DoubleDelimiter1 = exports.Delimiter1 = void 0;
4
- const ParamDefinition_1 = require("./objects/ParamDefinition");
3
+ exports.SymbolValidatorContext = exports.RenderFlags = exports.GlobalDocumentName = exports.ModuleContainsKeyword = exports.FrameType = exports.BlockTypes = exports.ReferenceTypes = exports.ComponentTypes = exports.ColorScheme = exports.PortPaddingVertical = exports.PortPaddingHorizontal = exports.PortArrowSize = exports.junctionSize = exports.defaultFontSize = exports.defaultFontBold = exports.defaultFont = exports.displayUnits = exports.defaultFrameTitleTextSize = exports.CustomSymbolParamTextSize = exports.CustomSymbolRefDesSize = exports.CustomSymbolPinIdSize = exports.CustomSymbolPinTextSize = exports.defaultPageSpacingMM = exports.defaultPageMarginMM = exports.defaultPinIdTextSize = exports.defaultPinNameTextSize = exports.defaultWireLineWidth = exports.defaultSymbolLineWidth = exports.fontDisplayScale = exports.defaultZoomScale = exports.defaultGridSizeUnits = exports.portHeight = exports.portWidth = exports.PxToMM = exports.MMToPt = exports.MMToPx = exports.MilsToMM = exports.WireAutoDirection = exports.LengthUnit = exports.ValidPinSides = exports.SymbolPinSide = exports.LayoutDirection = exports.ParamKeys = exports.NoNetText = exports.GlobalNames = exports.DoubleDelimiter1 = exports.Delimiter1 = exports.TOOL_VERSION = void 0;
4
+ const ParamDefinition_js_1 = require("./objects/ParamDefinition.js");
5
+ exports.TOOL_VERSION = '0.1.5';
5
6
  exports.Delimiter1 = '-';
6
7
  exports.DoubleDelimiter1 = `${exports.Delimiter1}${exports.Delimiter1}`;
7
8
  var GlobalNames;
@@ -31,6 +32,9 @@ var SymbolPinSide;
31
32
  SymbolPinSide["Top"] = "top";
32
33
  SymbolPinSide["Bottom"] = "bottom";
33
34
  })(SymbolPinSide || (exports.SymbolPinSide = SymbolPinSide = {}));
35
+ exports.ValidPinSides = [
36
+ SymbolPinSide.Left, SymbolPinSide.Right, SymbolPinSide.Top, SymbolPinSide.Bottom
37
+ ];
34
38
  var LengthUnit;
35
39
  (function (LengthUnit) {
36
40
  LengthUnit["mm"] = "mm";
@@ -48,11 +52,11 @@ exports.MMToPt = 2.8346456693;
48
52
  exports.PxToMM = 0.2645833;
49
53
  exports.portWidth = 20;
50
54
  exports.portHeight = 2;
51
- exports.defaultGridSizeUnits = (0, ParamDefinition_1.numeric)(exports.MilsToMM).mul(100).toNumber();
55
+ exports.defaultGridSizeUnits = (0, ParamDefinition_js_1.numeric)(exports.MilsToMM).mul(100).toNumber();
52
56
  exports.defaultZoomScale = 2.5;
53
57
  exports.fontDisplayScale = 0.032;
54
- exports.defaultSymbolLineWidth = (0, ParamDefinition_1.numeric)(exports.MilsToMM).mul(6).toNumber();
55
- exports.defaultWireLineWidth = (0, ParamDefinition_1.numeric)(exports.MilsToMM).mul(6).toNumber();
58
+ exports.defaultSymbolLineWidth = (0, ParamDefinition_js_1.numeric)(exports.MilsToMM).mul(6).toNumber();
59
+ exports.defaultWireLineWidth = (0, ParamDefinition_js_1.numeric)(exports.MilsToMM).mul(6).toNumber();
56
60
  exports.defaultPinNameTextSize = 40;
57
61
  exports.defaultPinIdTextSize = 30;
58
62
  exports.defaultPageMarginMM = 10;
@@ -66,7 +70,7 @@ exports.displayUnits = LengthUnit.mils;
66
70
  exports.defaultFont = 'Arial';
67
71
  exports.defaultFontBold = 'Arial';
68
72
  exports.defaultFontSize = 10;
69
- exports.junctionSize = (0, ParamDefinition_1.numeric)(exports.MilsToMM).mul(20);
73
+ exports.junctionSize = (0, ParamDefinition_js_1.numeric)(exports.MilsToMM).mul(20);
70
74
  exports.PortArrowSize = exports.MilsToMM * 50;
71
75
  exports.PortPaddingHorizontal = exports.MilsToMM * 10;
72
76
  exports.PortPaddingVertical = exports.MilsToMM * 10;
@@ -113,3 +117,4 @@ exports.RenderFlags = {
113
117
  ShowLabelBoxBounds: false,
114
118
  ShowLabelOrigin: false,
115
119
  };
120
+ exports.SymbolValidatorContext = '_sym';