circuitscript 0.0.29 → 0.0.32

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 (64) hide show
  1. package/dist/cjs/BaseVisitor.js +6 -1
  2. package/dist/cjs/antlr/CircuitScriptLexer.js +204 -200
  3. package/dist/cjs/antlr/CircuitScriptParser.js +1066 -1173
  4. package/dist/cjs/draw_symbols.js +330 -87
  5. package/dist/cjs/execute.js +41 -14
  6. package/dist/cjs/geometry.js +79 -18
  7. package/dist/cjs/globals.js +37 -6
  8. package/dist/cjs/helpers.js +75 -5
  9. package/dist/cjs/layout.js +107 -43
  10. package/dist/cjs/main.js +10 -4
  11. package/dist/cjs/objects/ClassComponent.js +2 -0
  12. package/dist/cjs/objects/ExecutionScope.js +1 -1
  13. package/dist/cjs/objects/Frame.js +2 -0
  14. package/dist/cjs/objects/Net.js +3 -2
  15. package/dist/cjs/objects/PinTypes.js +7 -1
  16. package/dist/cjs/objects/types.js +11 -1
  17. package/dist/cjs/regenerate-tests.js +64 -3
  18. package/dist/cjs/render.js +29 -21
  19. package/dist/cjs/sizing.js +4 -6
  20. package/dist/cjs/utils.js +29 -5
  21. package/dist/cjs/visitor.js +176 -10
  22. package/dist/esm/BaseVisitor.mjs +6 -1
  23. package/dist/esm/antlr/CircuitScriptLexer.mjs +204 -200
  24. package/dist/esm/antlr/CircuitScriptParser.mjs +1061 -1171
  25. package/dist/esm/antlr/CircuitScriptVisitor.mjs +3 -0
  26. package/dist/esm/draw_symbols.mjs +324 -85
  27. package/dist/esm/execute.mjs +42 -15
  28. package/dist/esm/geometry.mjs +79 -17
  29. package/dist/esm/globals.mjs +36 -5
  30. package/dist/esm/helpers.mjs +74 -5
  31. package/dist/esm/layout.mjs +110 -46
  32. package/dist/esm/main.mjs +11 -5
  33. package/dist/esm/objects/ClassComponent.mjs +6 -0
  34. package/dist/esm/objects/ExecutionScope.mjs +1 -1
  35. package/dist/esm/objects/Frame.mjs +2 -0
  36. package/dist/esm/objects/Net.mjs +3 -2
  37. package/dist/esm/objects/PinTypes.mjs +6 -0
  38. package/dist/esm/objects/types.mjs +14 -0
  39. package/dist/esm/regenerate-tests.mjs +64 -3
  40. package/dist/esm/render.mjs +30 -22
  41. package/dist/esm/sizing.mjs +3 -4
  42. package/dist/esm/utils.mjs +26 -4
  43. package/dist/esm/visitor.mjs +179 -13
  44. package/dist/types/antlr/CircuitScriptLexer.d.ts +42 -41
  45. package/dist/types/antlr/CircuitScriptParser.d.ts +144 -133
  46. package/dist/types/antlr/CircuitScriptVisitor.d.ts +6 -0
  47. package/dist/types/draw_symbols.d.ts +15 -2
  48. package/dist/types/execute.d.ts +5 -4
  49. package/dist/types/geometry.d.ts +4 -3
  50. package/dist/types/globals.d.ts +32 -3
  51. package/dist/types/helpers.d.ts +12 -0
  52. package/dist/types/layout.d.ts +8 -2
  53. package/dist/types/objects/ClassComponent.d.ts +8 -0
  54. package/dist/types/objects/Frame.d.ts +3 -1
  55. package/dist/types/objects/PinTypes.d.ts +1 -0
  56. package/dist/types/objects/Wire.d.ts +4 -2
  57. package/dist/types/objects/types.d.ts +8 -0
  58. package/dist/types/render.d.ts +5 -1
  59. package/dist/types/sizing.d.ts +0 -4
  60. package/dist/types/utils.d.ts +3 -0
  61. package/dist/types/visitor.d.ts +8 -1
  62. package/fonts/Arial.ttf +0 -0
  63. package/libs/lib.cst +58 -41
  64. package/package.json +5 -1
@@ -14,105 +14,109 @@ export declare class CircuitScriptParser extends antlr.Parser {
14
14
  static readonly Create = 10;
15
15
  static readonly Component = 11;
16
16
  static readonly Graphic = 12;
17
- static readonly Wire = 13;
18
- static readonly Pin = 14;
19
- static readonly Add = 15;
20
- static readonly At = 16;
21
- static readonly To = 17;
22
- static readonly Point = 18;
23
- static readonly Join = 19;
24
- static readonly Parallel = 20;
25
- static readonly Return = 21;
26
- static readonly Define = 22;
27
- static readonly Import = 23;
28
- static readonly If = 24;
29
- static readonly Else = 25;
30
- static readonly Not = 26;
31
- static readonly Frame = 27;
32
- static readonly Equals = 28;
33
- static readonly NotEquals = 29;
34
- static readonly GreaterThan = 30;
35
- static readonly GreatOrEqualThan = 31;
36
- static readonly LessThan = 32;
37
- static readonly LessOrEqualThan = 33;
38
- static readonly LogicalAnd = 34;
39
- static readonly LogicalOr = 35;
40
- static readonly Addition = 36;
41
- static readonly Minus = 37;
42
- static readonly Divide = 38;
43
- static readonly Multiply = 39;
44
- static readonly OPEN_PAREN = 40;
45
- static readonly CLOSE_PAREN = 41;
46
- static readonly NOT_CONNECTED = 42;
47
- static readonly BOOLEAN_VALUE = 43;
48
- static readonly ID = 44;
49
- static readonly INTEGER_VALUE = 45;
50
- static readonly DECIMAL_VALUE = 46;
51
- static readonly NUMERIC_VALUE = 47;
52
- static readonly STRING_VALUE = 48;
53
- static readonly PERCENTAGE_VALUE = 49;
54
- static readonly ALPHA_NUMERIC = 50;
55
- static readonly WS = 51;
56
- static readonly NEWLINE = 52;
57
- static readonly COMMENT = 53;
58
- static readonly INDENT = 54;
59
- static readonly DEDENT = 55;
17
+ static readonly Module = 13;
18
+ static readonly Wire = 14;
19
+ static readonly Pin = 15;
20
+ static readonly Add = 16;
21
+ static readonly At = 17;
22
+ static readonly To = 18;
23
+ static readonly Point = 19;
24
+ static readonly Join = 20;
25
+ static readonly Parallel = 21;
26
+ static readonly Return = 22;
27
+ static readonly Define = 23;
28
+ static readonly Import = 24;
29
+ static readonly If = 25;
30
+ static readonly Else = 26;
31
+ static readonly Not = 27;
32
+ static readonly Frame = 28;
33
+ static readonly Equals = 29;
34
+ static readonly NotEquals = 30;
35
+ static readonly GreaterThan = 31;
36
+ static readonly GreatOrEqualThan = 32;
37
+ static readonly LessThan = 33;
38
+ static readonly LessOrEqualThan = 34;
39
+ static readonly LogicalAnd = 35;
40
+ static readonly LogicalOr = 36;
41
+ static readonly Addition = 37;
42
+ static readonly Minus = 38;
43
+ static readonly Divide = 39;
44
+ static readonly Multiply = 40;
45
+ static readonly OPEN_PAREN = 41;
46
+ static readonly CLOSE_PAREN = 42;
47
+ static readonly NOT_CONNECTED = 43;
48
+ static readonly BOOLEAN_VALUE = 44;
49
+ static readonly ID = 45;
50
+ static readonly INTEGER_VALUE = 46;
51
+ static readonly DECIMAL_VALUE = 47;
52
+ static readonly NUMERIC_VALUE = 48;
53
+ static readonly STRING_VALUE = 49;
54
+ static readonly PERCENTAGE_VALUE = 50;
55
+ static readonly ALPHA_NUMERIC = 51;
56
+ static readonly WS = 52;
57
+ static readonly NEWLINE = 53;
58
+ static readonly COMMENT = 54;
59
+ static readonly INDENT = 55;
60
+ static readonly DEDENT = 56;
60
61
  static readonly RULE_script = 0;
61
62
  static readonly RULE_expression = 1;
62
- static readonly RULE_path_blocks = 2;
63
- static readonly RULE_path_block_inner = 3;
64
- static readonly RULE_property_set_expr2 = 4;
65
- static readonly RULE_assignment_expr2 = 5;
66
- static readonly RULE_pin_select_expr = 6;
67
- static readonly RULE_component_modifier_expr = 7;
68
- static readonly RULE_data_expr_with_assignment = 8;
69
- static readonly RULE_add_component_expr = 9;
70
- static readonly RULE_component_select_expr = 10;
71
- static readonly RULE_pin_select_expr2 = 11;
72
- static readonly RULE_at_component_expr = 12;
73
- static readonly RULE_to_component_expr = 13;
74
- static readonly RULE_at_to_multiple_expr = 14;
75
- static readonly RULE_at_to_multiple_line_expr = 15;
76
- static readonly RULE_at_to_multiple_line_expr_to_pin = 16;
77
- static readonly RULE_at_block = 17;
78
- static readonly RULE_at_block_expressions = 18;
79
- static readonly RULE_at_block_pin_expr = 19;
80
- static readonly RULE_at_block_pin_expression_simple = 20;
81
- static readonly RULE_at_block_pin_expression_complex = 21;
82
- static readonly RULE_break_keyword = 22;
83
- static readonly RULE_assignment_expr = 23;
84
- static readonly RULE_keyword_assignment_expr = 24;
85
- static readonly RULE_parameters = 25;
86
- static readonly RULE_property_set_expr = 26;
87
- static readonly RULE_double_dot_property_set_expr = 27;
88
- static readonly RULE_data_expr = 28;
89
- static readonly RULE_binary_operator = 29;
90
- static readonly RULE_unary_operator = 30;
91
- static readonly RULE_value_expr = 31;
92
- static readonly RULE_function_def_expr = 32;
93
- static readonly RULE_function_expr = 33;
94
- static readonly RULE_function_args_expr = 34;
95
- static readonly RULE_atom_expr = 35;
96
- static readonly RULE_trailer_expr = 36;
97
- static readonly RULE_function_call_expr = 37;
98
- static readonly RULE_net_namespace_expr = 38;
99
- static readonly RULE_function_return_expr = 39;
100
- static readonly RULE_create_component_expr = 40;
101
- static readonly RULE_create_graphic_expr = 41;
102
- static readonly RULE_nested_properties_inner = 42;
103
- static readonly RULE_graphic_expr = 43;
104
- static readonly RULE_property_expr = 44;
105
- static readonly RULE_property_key_expr = 45;
106
- static readonly RULE_property_value_expr = 46;
107
- static readonly RULE_blank_expr = 47;
108
- static readonly RULE_wire_atom_expr = 48;
109
- static readonly RULE_wire_expr = 49;
110
- static readonly RULE_point_expr = 50;
111
- static readonly RULE_import_expr = 51;
112
- static readonly RULE_frame_expr = 52;
113
- static readonly RULE_if_expr = 53;
114
- static readonly RULE_if_inner_expr = 54;
115
- static readonly RULE_else_expr = 55;
63
+ static readonly RULE_expressions_block = 2;
64
+ static readonly RULE_path_blocks = 3;
65
+ static readonly RULE_path_block_inner = 4;
66
+ static readonly RULE_property_set_expr2 = 5;
67
+ static readonly RULE_assignment_expr2 = 6;
68
+ static readonly RULE_pin_select_expr = 7;
69
+ static readonly RULE_component_modifier_expr = 8;
70
+ static readonly RULE_data_expr_with_assignment = 9;
71
+ static readonly RULE_add_component_expr = 10;
72
+ static readonly RULE_component_select_expr = 11;
73
+ static readonly RULE_pin_select_expr2 = 12;
74
+ static readonly RULE_at_component_expr = 13;
75
+ static readonly RULE_to_component_expr = 14;
76
+ static readonly RULE_at_to_multiple_expr = 15;
77
+ static readonly RULE_at_to_multiple_line_expr = 16;
78
+ static readonly RULE_at_to_multiple_line_expr_to_pin = 17;
79
+ static readonly RULE_at_block = 18;
80
+ static readonly RULE_at_block_expressions = 19;
81
+ static readonly RULE_at_block_pin_expr = 20;
82
+ static readonly RULE_at_block_pin_expression_simple = 21;
83
+ static readonly RULE_at_block_pin_expression_complex = 22;
84
+ static readonly RULE_break_keyword = 23;
85
+ static readonly RULE_assignment_expr = 24;
86
+ static readonly RULE_keyword_assignment_expr = 25;
87
+ static readonly RULE_parameters = 26;
88
+ static readonly RULE_property_set_expr = 27;
89
+ static readonly RULE_double_dot_property_set_expr = 28;
90
+ static readonly RULE_data_expr = 29;
91
+ static readonly RULE_binary_operator = 30;
92
+ static readonly RULE_unary_operator = 31;
93
+ static readonly RULE_value_expr = 32;
94
+ static readonly RULE_function_def_expr = 33;
95
+ static readonly RULE_function_expr = 34;
96
+ static readonly RULE_function_args_expr = 35;
97
+ static readonly RULE_atom_expr = 36;
98
+ static readonly RULE_trailer_expr = 37;
99
+ static readonly RULE_function_call_expr = 38;
100
+ static readonly RULE_net_namespace_expr = 39;
101
+ static readonly RULE_function_return_expr = 40;
102
+ static readonly RULE_property_block_expr = 41;
103
+ static readonly RULE_create_component_expr = 42;
104
+ static readonly RULE_create_graphic_expr = 43;
105
+ static readonly RULE_create_module_expr = 44;
106
+ static readonly RULE_nested_properties_inner = 45;
107
+ static readonly RULE_graphic_expr = 46;
108
+ static readonly RULE_property_expr = 47;
109
+ static readonly RULE_property_key_expr = 48;
110
+ static readonly RULE_property_value_expr = 49;
111
+ static readonly RULE_blank_expr = 50;
112
+ static readonly RULE_wire_atom_expr = 51;
113
+ static readonly RULE_wire_expr = 52;
114
+ static readonly RULE_point_expr = 53;
115
+ static readonly RULE_import_expr = 54;
116
+ static readonly RULE_frame_expr = 55;
117
+ static readonly RULE_if_expr = 56;
118
+ static readonly RULE_if_inner_expr = 57;
119
+ static readonly RULE_else_expr = 58;
116
120
  static readonly literalNames: (string | null)[];
117
121
  static readonly symbolicNames: (string | null)[];
118
122
  static readonly ruleNames: string[];
@@ -125,6 +129,7 @@ export declare class CircuitScriptParser extends antlr.Parser {
125
129
  constructor(input: antlr.TokenStream);
126
130
  script(): ScriptContext;
127
131
  expression(): ExpressionContext;
132
+ expressions_block(): Expressions_blockContext;
128
133
  path_blocks(): Path_blocksContext;
129
134
  path_block_inner(): Path_block_innerContext;
130
135
  property_set_expr2(): Property_set_expr2Context;
@@ -164,8 +169,10 @@ export declare class CircuitScriptParser extends antlr.Parser {
164
169
  function_call_expr(): Function_call_exprContext;
165
170
  net_namespace_expr(): Net_namespace_exprContext;
166
171
  function_return_expr(): Function_return_exprContext;
172
+ property_block_expr(): Property_block_exprContext;
167
173
  create_component_expr(): Create_component_exprContext;
168
174
  create_graphic_expr(): Create_graphic_exprContext;
175
+ create_module_expr(): Create_module_exprContext;
169
176
  nested_properties_inner(): Nested_properties_innerContext;
170
177
  graphic_expr(): Graphic_exprContext;
171
178
  property_expr(): Property_exprContext;
@@ -222,6 +229,17 @@ export declare class ExpressionContext extends antlr.ParserRuleContext {
222
229
  get ruleIndex(): number;
223
230
  accept<Result>(visitor: CircuitScriptVisitor<Result>): Result | null;
224
231
  }
232
+ export declare class Expressions_blockContext extends antlr.ParserRuleContext {
233
+ constructor(parent: antlr.ParserRuleContext | null, invokingState: number);
234
+ NEWLINE(): antlr.TerminalNode[];
235
+ NEWLINE(i: number): antlr.TerminalNode | null;
236
+ INDENT(): antlr.TerminalNode;
237
+ DEDENT(): antlr.TerminalNode;
238
+ expression(): ExpressionContext[];
239
+ expression(i: number): ExpressionContext | null;
240
+ get ruleIndex(): number;
241
+ accept<Result>(visitor: CircuitScriptVisitor<Result>): Result | null;
242
+ }
225
243
  export declare class Path_blocksContext extends antlr.ParserRuleContext {
226
244
  constructor(parent: antlr.ParserRuleContext | null, invokingState: number);
227
245
  path_block_inner(): Path_block_innerContext[];
@@ -231,16 +249,11 @@ export declare class Path_blocksContext extends antlr.ParserRuleContext {
231
249
  }
232
250
  export declare class Path_block_innerContext extends antlr.ParserRuleContext {
233
251
  constructor(parent: antlr.ParserRuleContext | null, invokingState: number);
234
- NEWLINE(): antlr.TerminalNode[];
235
- NEWLINE(i: number): antlr.TerminalNode | null;
236
- INDENT(): antlr.TerminalNode;
237
- DEDENT(): antlr.TerminalNode;
252
+ expressions_block(): Expressions_blockContext;
238
253
  Branch(): antlr.TerminalNode | null;
239
254
  Join(): antlr.TerminalNode | null;
240
255
  Parallel(): antlr.TerminalNode | null;
241
256
  Point(): antlr.TerminalNode | null;
242
- expression(): ExpressionContext[];
243
- expression(i: number): ExpressionContext | null;
244
257
  get ruleIndex(): number;
245
258
  accept<Result>(visitor: CircuitScriptVisitor<Result>): Result | null;
246
259
  }
@@ -394,12 +407,7 @@ export declare class At_block_pin_expression_simpleContext extends antlr.ParserR
394
407
  }
395
408
  export declare class At_block_pin_expression_complexContext extends antlr.ParserRuleContext {
396
409
  constructor(parent: antlr.ParserRuleContext | null, invokingState: number);
397
- NEWLINE(): antlr.TerminalNode[];
398
- NEWLINE(i: number): antlr.TerminalNode | null;
399
- INDENT(): antlr.TerminalNode;
400
- DEDENT(): antlr.TerminalNode;
401
- expression(): ExpressionContext[];
402
- expression(i: number): ExpressionContext | null;
410
+ expressions_block(): Expressions_blockContext;
403
411
  get ruleIndex(): number;
404
412
  accept<Result>(visitor: CircuitScriptVisitor<Result>): Result | null;
405
413
  }
@@ -484,6 +492,7 @@ export declare class DataExprContext extends Data_exprContext {
484
492
  constructor(ctx: Data_exprContext);
485
493
  create_component_expr(): Create_component_exprContext | null;
486
494
  create_graphic_expr(): Create_graphic_exprContext | null;
495
+ create_module_expr(): Create_module_exprContext | null;
487
496
  accept<Result>(visitor: CircuitScriptVisitor<Result>): Result | null;
488
497
  }
489
498
  export declare class UnaryOperatorExprContext extends Data_exprContext {
@@ -615,6 +624,13 @@ export declare class Function_return_exprContext extends antlr.ParserRuleContext
615
624
  get ruleIndex(): number;
616
625
  accept<Result>(visitor: CircuitScriptVisitor<Result>): Result | null;
617
626
  }
627
+ export declare class Property_block_exprContext extends antlr.ParserRuleContext {
628
+ constructor(parent: antlr.ParserRuleContext | null, invokingState: number);
629
+ property_key_expr(): Property_key_exprContext;
630
+ expressions_block(): Expressions_blockContext;
631
+ get ruleIndex(): number;
632
+ accept<Result>(visitor: CircuitScriptVisitor<Result>): Result | null;
633
+ }
618
634
  export declare class Create_component_exprContext extends antlr.ParserRuleContext {
619
635
  constructor(parent: antlr.ParserRuleContext | null, invokingState: number);
620
636
  Create(): antlr.TerminalNode;
@@ -641,6 +657,21 @@ export declare class Create_graphic_exprContext extends antlr.ParserRuleContext
641
657
  get ruleIndex(): number;
642
658
  accept<Result>(visitor: CircuitScriptVisitor<Result>): Result | null;
643
659
  }
660
+ export declare class Create_module_exprContext extends antlr.ParserRuleContext {
661
+ constructor(parent: antlr.ParserRuleContext | null, invokingState: number);
662
+ Create(): antlr.TerminalNode;
663
+ Module(): antlr.TerminalNode;
664
+ NEWLINE(): antlr.TerminalNode[];
665
+ NEWLINE(i: number): antlr.TerminalNode | null;
666
+ INDENT(): antlr.TerminalNode;
667
+ DEDENT(): antlr.TerminalNode;
668
+ property_expr(): Property_exprContext[];
669
+ property_expr(i: number): Property_exprContext | null;
670
+ property_block_expr(): Property_block_exprContext[];
671
+ property_block_expr(i: number): Property_block_exprContext | null;
672
+ get ruleIndex(): number;
673
+ accept<Result>(visitor: CircuitScriptVisitor<Result>): Result | null;
674
+ }
644
675
  export declare class Nested_properties_innerContext extends antlr.ParserRuleContext {
645
676
  constructor(parent: antlr.ParserRuleContext | null, invokingState: number);
646
677
  NEWLINE(): antlr.TerminalNode[];
@@ -743,12 +774,7 @@ export declare class Import_exprContext extends antlr.ParserRuleContext {
743
774
  export declare class Frame_exprContext extends antlr.ParserRuleContext {
744
775
  constructor(parent: antlr.ParserRuleContext | null, invokingState: number);
745
776
  Frame(): antlr.TerminalNode;
746
- NEWLINE(): antlr.TerminalNode[];
747
- NEWLINE(i: number): antlr.TerminalNode | null;
748
- INDENT(): antlr.TerminalNode;
749
- DEDENT(): antlr.TerminalNode;
750
- expression(): ExpressionContext[];
751
- expression(i: number): ExpressionContext | null;
777
+ expressions_block(): Expressions_blockContext;
752
778
  get ruleIndex(): number;
753
779
  accept<Result>(visitor: CircuitScriptVisitor<Result>): Result | null;
754
780
  }
@@ -756,12 +782,7 @@ export declare class If_exprContext extends antlr.ParserRuleContext {
756
782
  constructor(parent: antlr.ParserRuleContext | null, invokingState: number);
757
783
  If(): antlr.TerminalNode;
758
784
  data_expr(): Data_exprContext;
759
- NEWLINE(): antlr.TerminalNode[];
760
- NEWLINE(i: number): antlr.TerminalNode | null;
761
- INDENT(): antlr.TerminalNode;
762
- DEDENT(): antlr.TerminalNode;
763
- expression(): ExpressionContext[];
764
- expression(i: number): ExpressionContext | null;
785
+ expressions_block(): Expressions_blockContext;
765
786
  if_inner_expr(): If_inner_exprContext[];
766
787
  if_inner_expr(i: number): If_inner_exprContext | null;
767
788
  else_expr(): Else_exprContext | null;
@@ -773,24 +794,14 @@ export declare class If_inner_exprContext extends antlr.ParserRuleContext {
773
794
  Else(): antlr.TerminalNode;
774
795
  If(): antlr.TerminalNode;
775
796
  data_expr(): Data_exprContext;
776
- NEWLINE(): antlr.TerminalNode[];
777
- NEWLINE(i: number): antlr.TerminalNode | null;
778
- INDENT(): antlr.TerminalNode;
779
- DEDENT(): antlr.TerminalNode;
780
- expression(): ExpressionContext[];
781
- expression(i: number): ExpressionContext | null;
797
+ expressions_block(): Expressions_blockContext;
782
798
  get ruleIndex(): number;
783
799
  accept<Result>(visitor: CircuitScriptVisitor<Result>): Result | null;
784
800
  }
785
801
  export declare class Else_exprContext extends antlr.ParserRuleContext {
786
802
  constructor(parent: antlr.ParserRuleContext | null, invokingState: number);
787
803
  Else(): antlr.TerminalNode;
788
- NEWLINE(): antlr.TerminalNode[];
789
- NEWLINE(i: number): antlr.TerminalNode | null;
790
- INDENT(): antlr.TerminalNode;
791
- DEDENT(): antlr.TerminalNode;
792
- expression(): ExpressionContext[];
793
- expression(i: number): ExpressionContext | null;
804
+ expressions_block(): Expressions_blockContext;
794
805
  get ruleIndex(): number;
795
806
  accept<Result>(visitor: CircuitScriptVisitor<Result>): Result | null;
796
807
  }
@@ -1,6 +1,7 @@
1
1
  import { AbstractParseTreeVisitor } from "antlr4ng";
2
2
  import { ScriptContext } from "./CircuitScriptParser.js";
3
3
  import { ExpressionContext } from "./CircuitScriptParser.js";
4
+ import { Expressions_blockContext } from "./CircuitScriptParser.js";
4
5
  import { Path_blocksContext } from "./CircuitScriptParser.js";
5
6
  import { Path_block_innerContext } from "./CircuitScriptParser.js";
6
7
  import { Property_set_expr2Context } from "./CircuitScriptParser.js";
@@ -47,8 +48,10 @@ import { Trailer_exprContext } from "./CircuitScriptParser.js";
47
48
  import { Function_call_exprContext } from "./CircuitScriptParser.js";
48
49
  import { Net_namespace_exprContext } from "./CircuitScriptParser.js";
49
50
  import { Function_return_exprContext } from "./CircuitScriptParser.js";
51
+ import { Property_block_exprContext } from "./CircuitScriptParser.js";
50
52
  import { Create_component_exprContext } from "./CircuitScriptParser.js";
51
53
  import { Create_graphic_exprContext } from "./CircuitScriptParser.js";
54
+ import { Create_module_exprContext } from "./CircuitScriptParser.js";
52
55
  import { Nested_properties_innerContext } from "./CircuitScriptParser.js";
53
56
  import { Graphic_exprContext } from "./CircuitScriptParser.js";
54
57
  import { Property_exprContext } from "./CircuitScriptParser.js";
@@ -68,6 +71,7 @@ import { Else_exprContext } from "./CircuitScriptParser.js";
68
71
  export declare class CircuitScriptVisitor<Result> extends AbstractParseTreeVisitor<Result> {
69
72
  visitScript?: (ctx: ScriptContext) => Result;
70
73
  visitExpression?: (ctx: ExpressionContext) => Result;
74
+ visitExpressions_block?: (ctx: Expressions_blockContext) => Result;
71
75
  visitPath_blocks?: (ctx: Path_blocksContext) => Result;
72
76
  visitPath_block_inner?: (ctx: Path_block_innerContext) => Result;
73
77
  visitProperty_set_expr2?: (ctx: Property_set_expr2Context) => Result;
@@ -114,8 +118,10 @@ export declare class CircuitScriptVisitor<Result> extends AbstractParseTreeVisit
114
118
  visitFunction_call_expr?: (ctx: Function_call_exprContext) => Result;
115
119
  visitNet_namespace_expr?: (ctx: Net_namespace_exprContext) => Result;
116
120
  visitFunction_return_expr?: (ctx: Function_return_exprContext) => Result;
121
+ visitProperty_block_expr?: (ctx: Property_block_exprContext) => Result;
117
122
  visitCreate_component_expr?: (ctx: Create_component_exprContext) => Result;
118
123
  visitCreate_graphic_expr?: (ctx: Create_graphic_exprContext) => Result;
124
+ visitCreate_module_expr?: (ctx: Create_module_exprContext) => Result;
119
125
  visitNested_properties_inner?: (ctx: Nested_properties_innerContext) => Result;
120
126
  visitGraphic_expr?: (ctx: Graphic_exprContext) => Result;
121
127
  visitProperty_expr?: (ctx: Property_exprContext) => Result;
@@ -1,6 +1,7 @@
1
1
  import { G } from "@svgdotjs/svg.js";
2
2
  import { Feature, GeometryProp, HorizontalAlign, LabelStyle, Textbox, VerticalAlign } from "./geometry.js";
3
3
  import { Logger } from "./logger.js";
4
+ import { PinTypes } from "./objects/PinTypes.js";
4
5
  export declare abstract class SymbolGraphic {
5
6
  drawPortsName: boolean;
6
7
  displayBounds: boolean;
@@ -37,7 +38,6 @@ export declare abstract class SymbolGraphic {
37
38
  protected drawBody(group: G): void;
38
39
  protected drawPins(group: G): void;
39
40
  protected drawLabels(group: G): void;
40
- roundValues(value: number): number;
41
41
  flipTextAnchor(value: HorizontalAlign): HorizontalAlign;
42
42
  flipDominantBaseline(value: VerticalAlign): VerticalAlign;
43
43
  setLabelValue(labelId: string, labelValue: string): void;
@@ -79,7 +79,8 @@ export declare enum PlaceHolderCommands {
79
79
  fill = "fill",
80
80
  lineColor = "lineColor",
81
81
  textColor = "textColor",
82
- text = "text"
82
+ text = "text",
83
+ units = "units"
83
84
  }
84
85
  export declare class SymbolCustom extends SymbolGraphic {
85
86
  pinDefinition: SymbolPinDefintion[];
@@ -94,8 +95,15 @@ export declare class SymbolCustom extends SymbolGraphic {
94
95
  _cacheRightPins: SymbolPinDefintion[];
95
96
  constructor(pinDefinition: SymbolPinDefintion[]);
96
97
  generateDrawing(): void;
98
+ generateDrawingPins(drawing: SymbolDrawing, bodyWidthMM: number, bodyHeightMM: number, leftPins: SymbolPinDefintion[], rightPins: SymbolPinDefintion[], defaultLineColor: string): void;
97
99
  calculateSize(): void;
98
100
  }
101
+ export declare class SymbolCustomModule extends SymbolCustom {
102
+ pinLength: number;
103
+ portWidth: number;
104
+ portHeight: number;
105
+ generateDrawingPins(drawing: SymbolDrawing, bodyWidthMM: number, bodyHeightMM: number, leftPins: SymbolPinDefintion[], rightPins: SymbolPinDefintion[], defaultLineColor: string): void;
106
+ }
99
107
  export declare class SymbolDrawing {
100
108
  items: (Feature | GeometryProp)[];
101
109
  pins: [number, Feature, number, lineColor: string][];
@@ -108,20 +116,24 @@ export declare class SymbolDrawing {
108
116
  log(...params: any[]): void;
109
117
  addLine(startX: number, startY: number, endX: number, endY: number): SymbolDrawing;
110
118
  addPin(pinId: number, startX: number, startY: number, endX: number, endY: number, lineColor: string): SymbolDrawing;
119
+ addPinMM(pinId: number, startXMM: number, startYMM: number, endXMM: number, endYMM: number, lineColor: string): SymbolDrawing;
111
120
  addVLine(startX: number, startY: number, value: number): SymbolDrawing;
112
121
  addHLine(startX: number, startY: number, value: number): SymbolDrawing;
113
122
  addRect(centerX: number, centerY: number, width: number, height: number): SymbolDrawing;
123
+ addRectMM(centerX: number, centerY: number, width: number, height: number): SymbolDrawing;
114
124
  addTriangle(startX: number, startY: number, endX: number, endY: number, width: number): SymbolDrawing;
115
125
  addRect2(x: number, y: number, x2: number, y2: number): SymbolDrawing;
116
126
  addLabel(x: number, y: number, textValue: string, style: LabelStyle): SymbolDrawing;
117
127
  addLabelId(id: string, x: number, y: number, textValue: string, style: LabelStyle): SymbolDrawing;
118
128
  addTextbox(x: number, y: number, textValue: string, style: LabelStyle): SymbolDrawing;
129
+ addModulePort(x: number, y: number, width: number, height: number, portType?: PinTypes, scaleX?: number): SymbolDrawing;
119
130
  addPath(...pathParts: any): SymbolDrawing;
120
131
  addSetLineWidth(value: number): SymbolDrawing;
121
132
  addSetLineColor(value: string): SymbolDrawing;
122
133
  addSetTextColor(value: string): SymbolDrawing;
123
134
  addSetFillColor(value: string): SymbolDrawing;
124
135
  addArc(x: number, y: number, radius: number, startAngle: number, endAngle: number): SymbolDrawing;
136
+ addSetUnits(value: string): SymbolDrawing;
125
137
  getPaths(): {
126
138
  path: string;
127
139
  fillColor: string;
@@ -177,5 +189,6 @@ export type SymbolPinDefintion = {
177
189
  pinId: number;
178
190
  text: string;
179
191
  position: number;
192
+ pinType: PinTypes;
180
193
  };
181
194
  export {};
@@ -4,8 +4,9 @@ import { ExecutionScope } from './objects/ExecutionScope.js';
4
4
  import { Net } from './objects/Net.js';
5
5
  import { ParamDefinition } from './objects/ParamDefinition.js';
6
6
  import { PinDefinition } from './objects/PinDefinition.js';
7
- import { CFunction, CFunctionResult, CallableParameter, ComponentPin, ReferenceType } from './objects/types.js';
7
+ import { CFunction, CFunctionResult, CallableParameter, ComponentPin, DeclaredReference } from './objects/types.js';
8
8
  import { Logger } from './logger.js';
9
+ import { UnitDimension } from './helpers.js';
9
10
  export declare class ExecutionContext {
10
11
  name: string;
11
12
  namespace: string;
@@ -61,16 +62,16 @@ export declare class ExecutionContext {
61
62
  createFunction(functionName: string, __runFunc: CFunction): void;
62
63
  hasFunction(functionName: string): boolean;
63
64
  getFunction(functionName: string): CFunction;
64
- resolveVariable(executionStack: ExecutionContext[], idName: string): ReferenceType;
65
+ resolveVariable(executionStack: ExecutionContext[], idName: string): DeclaredReference;
65
66
  callFunction(functionName: string, functionParams: CallableParameter[], executionStack: ExecutionContext[], netNamespace: string): CFunctionResult;
66
67
  mergeScope(childScope: ExecutionScope, namespace: string): void;
67
- addWire(segments: [string, number?][]): void;
68
+ addWire(segments: [string, (number | UnitDimension)?][]): void;
68
69
  addPoint(pointId: string, userDefined?: boolean): ComponentPin;
69
70
  setProperty(nameWithProp: string, value: any): void;
70
71
  setCurrentComponentStyle(styles: {
71
72
  [key: string]: number | string;
72
73
  }): void;
73
- applyComponentAngleFromWire(component: ClassComponent, pin: number): void;
74
+ applyComponentAngleFromWire(component: ClassComponent, pin: number, opposite?: boolean): void;
74
75
  enterFrame(): number;
75
76
  exitFrame(frameId: number): void;
76
77
  }
@@ -1,11 +1,12 @@
1
1
  import Flatten from '@flatten-js/core';
2
2
  import { Box } from '@svgdotjs/svg.js';
3
+ import { PinTypes } from './objects/PinTypes.js';
3
4
  export type Segment = Flatten.Segment;
4
5
  export type Polygon = Flatten.Polygon;
5
6
  export type Multiline = Flatten.Multiline;
6
7
  export type Line = Flatten.Line;
7
8
  export type Arc = Flatten.Arc;
8
- export type Feature = Segment | Polygon | Label | Textbox | Arc | Multiline;
9
+ export type Feature = Segment | Polygon | Textbox | Arc | Multiline;
9
10
  export type LabelStyle = {
10
11
  font?: string;
11
12
  fontSize?: number;
@@ -14,6 +15,7 @@ export type LabelStyle = {
14
15
  anchor?: HorizontalAlign.Left | HorizontalAlign.Middle | HorizontalAlign.Right;
15
16
  vanchor?: VerticalAlign.Top | VerticalAlign.Middle | VerticalAlign.Bottom;
16
17
  textColor?: string;
18
+ portType?: null | PinTypes;
17
19
  };
18
20
  export declare class Textbox extends Flatten.Polygon {
19
21
  id: string;
@@ -33,10 +35,9 @@ export declare class Textbox extends Flatten.Polygon {
33
35
  static fromPoint(id: string, x: number, y: number, text: string, style: LabelStyle, label: boolean): Textbox;
34
36
  rotate(angle: number, origin: Flatten.Point): Textbox;
35
37
  transform(matrix: Flatten.Matrix): Textbox;
38
+ private transformAnchorPoint;
36
39
  getLabelPosition(): [number, number];
37
40
  }
38
- export declare class Label extends Textbox {
39
- }
40
41
  export declare class GeometryProp {
41
42
  name: string;
42
43
  value: string | number;
@@ -19,12 +19,41 @@ export declare enum SymbolPinSide {
19
19
  Left = "left",
20
20
  Right = "right"
21
21
  }
22
+ export declare enum LengthUnit {
23
+ mm = "mm",
24
+ mils = "mils",
25
+ px = "px"
26
+ }
27
+ export declare enum WireAutoDirection {
28
+ Auto = "auto",
29
+ Auto_ = "auto_"
30
+ }
31
+ export declare const MilsToMM = 0.0254;
32
+ export declare const MMToPx = 3.779276;
33
+ export declare const MMToPt = 2.8346456693;
34
+ export declare const PxToMM = 0.2645833;
22
35
  export declare const portWidth = 20;
23
36
  export declare const portHeight = 2;
24
- export declare const defaultFont = "Open Sans-Regular, Arial";
25
- export declare const defaultFontBold = "Open Sans-Bold, Arial-Bold, Arial";
37
+ export declare const defaultGridSizeUnits: number;
38
+ export declare const defaultZoomScale = 2.5;
39
+ export declare const fontDisplayScale = 0.032;
40
+ export declare const defaultSymbolLineWidth: number;
41
+ export declare const defaultWireLineWidth: number;
42
+ export declare const defaultPinNameTextSize = 40;
43
+ export declare const defaultPinIdTextSize = 30;
44
+ export declare const CustomSymbolPinTextSize = 40;
45
+ export declare const CustomSymbolPinIdSize = 30;
46
+ export declare const CustomSymbolRefDesSize = 50;
47
+ export declare const CustomSymbolParamTextSize = 40;
48
+ export declare const defaultFrameTitleTextSize = 60;
49
+ export declare const displayUnits = LengthUnit.mils;
50
+ export declare const defaultFont = "Arial";
51
+ export declare const defaultFontBold = "Arial";
26
52
  export declare const defaultFontSize = 10;
27
- export declare const junctionSize = 5;
53
+ export declare const junctionSize: number;
54
+ export declare const PortArrowSize: number;
55
+ export declare const PortPaddingHorizontal: number;
56
+ export declare const PortPaddingVertical: number;
28
57
  export declare const ColorScheme: {
29
58
  BodyColor: string;
30
59
  JunctionColor: string;
@@ -3,6 +3,7 @@ import { CommonTokenStream, DefaultErrorStrategy, Parser } from "antlr4ng";
3
3
  import { CircuitScriptParser } from "./antlr/CircuitScriptParser.js";
4
4
  import { CircuitScriptLexer } from "./antlr/CircuitScriptLexer.js";
5
5
  import { IParsedToken, SemanticTokensVisitor } from "./SemanticTokenVisitor.js";
6
+ import { LengthUnit } from "./globals.js";
6
7
  export declare enum JSModuleType {
7
8
  CommonJs = "cjs",
8
9
  ESM = "mjs"
@@ -38,3 +39,14 @@ export declare function getCurrentPath(): {
38
39
  export declare function getFontsPath(): string;
39
40
  export declare function getDefaultLibsPath(): string;
40
41
  export declare function getPackageVersion(): string;
42
+ export declare class UnitDimension {
43
+ type: LengthUnit;
44
+ value: number;
45
+ constructor(value: number, type?: LengthUnit);
46
+ getMM(): number;
47
+ static mm(value: number): UnitDimension;
48
+ static mils(value: number): UnitDimension;
49
+ static px(value: number): UnitDimension;
50
+ }
51
+ export declare function milsToMM(value: number): number;
52
+ export declare function pxToMM(value: number): number;
@@ -2,6 +2,7 @@ import { Graph, Edge } from '@dagrejs/graphlib';
2
2
  import { SymbolGraphic, SymbolText } from "./draw_symbols.js";
3
3
  import { ClassComponent } from "./objects/ClassComponent.js";
4
4
  import { SequenceItem } from "./objects/ExecutionScope.js";
5
+ import { WireAutoDirection } from './globals.js';
5
6
  import { WireSegment } from './objects/Wire.js';
6
7
  import { Net } from './objects/Net.js';
7
8
  import { Logger } from './logger.js';
@@ -11,7 +12,10 @@ export declare class LayoutEngine {
11
12
  logger: Logger;
12
13
  placeSubgraphVersion: number;
13
14
  layoutWarnings: string[];
14
- constructor();
15
+ showBaseFrame: boolean;
16
+ constructor(options?: {
17
+ showBaseFrame: boolean;
18
+ });
15
19
  protected print(...params: any[]): void;
16
20
  protected printLevel(level: number, ...params: any[]): void;
17
21
  protected padLevel(value: number): string;
@@ -79,7 +83,7 @@ export declare class RenderWire extends RenderObject {
79
83
  netName: string;
80
84
  constructor(x: number, y: number, segments: WireSegment[]);
81
85
  refreshPoints(): void;
82
- getAutoPoints(value: [x: number, y: number], direction: 'auto' | 'auto_'): [dx: number, dy: number][];
86
+ getAutoPoints(value: [x: number, y: number], direction: WireAutoDirection): [dx: number, dy: number][];
83
87
  getWireEnd(): {
84
88
  x: number;
85
89
  y: number;
@@ -124,6 +128,8 @@ export declare class RenderFrame extends RenderObject {
124
128
  gap: number;
125
129
  direction: FramePlotDirection;
126
130
  borderWidth: number;
131
+ width: number | null;
132
+ height: number | null;
127
133
  subgraphId: string;
128
134
  type: RenderFrameType;
129
135
  containsTitle: boolean;