circuitscript 0.0.21 → 0.0.24
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/antlr/CircuitScriptLexer.js +288 -0
- package/dist/cjs/antlr/CircuitScriptParser.js +4905 -0
- package/dist/cjs/antlr/CircuitScriptVisitor.js +6 -0
- package/{src/draw_symbols.ts → dist/cjs/draw_symbols.js} +303 -614
- package/dist/cjs/execute.js +780 -0
- package/{src/export.ts → dist/cjs/export.js} +34 -56
- package/dist/cjs/fonts.js +4 -0
- package/dist/cjs/geometry.js +430 -0
- package/dist/cjs/globals.js +60 -0
- package/dist/cjs/helpers.js +99 -0
- package/dist/cjs/index.js +29 -0
- package/{src/layout.ts → dist/cjs/layout.js} +413 -1002
- package/dist/cjs/lexer.js +114 -0
- package/dist/cjs/logger.js +17 -0
- package/dist/cjs/main.js +87 -0
- package/dist/cjs/objects/ClassComponent.js +142 -0
- package/dist/cjs/objects/ExecutionScope.js +134 -0
- package/dist/cjs/objects/Frame.js +22 -0
- package/{src/objects/Net.ts → dist/cjs/objects/Net.js} +9 -24
- package/dist/cjs/objects/ParamDefinition.js +42 -0
- package/dist/cjs/objects/PinDefinition.js +31 -0
- package/dist/cjs/objects/PinTypes.js +11 -0
- package/dist/cjs/objects/Wire.js +9 -0
- package/dist/cjs/objects/types.js +9 -0
- package/dist/cjs/parser.js +299 -0
- package/dist/cjs/regenerate-tests.js +23 -0
- package/dist/cjs/render.js +155 -0
- package/{src/server.ts → dist/cjs/server.js} +15 -21
- package/dist/cjs/sizing.js +105 -0
- package/{src/utils.ts → dist/cjs/utils.js} +25 -35
- package/{src/visitor.ts → dist/cjs/visitor.js} +392 -948
- package/{build/src/antlr/CircuitScriptLexer.js → dist/esm/antlr/CircuitScriptLexer.mjs} +90 -91
- package/{build/src/antlr/CircuitScriptParser.js → dist/esm/antlr/CircuitScriptParser.mjs} +138 -136
- package/{build/src/draw_symbols.js → dist/esm/draw_symbols.mjs} +11 -11
- package/{build/src/execute.js → dist/esm/execute.mjs} +9 -8
- package/{build/src/export.js → dist/esm/export.mjs} +2 -2
- package/{build/src/geometry.js → dist/esm/geometry.mjs} +3 -7
- package/{build/src/helpers.js → dist/esm/helpers.mjs} +27 -7
- package/dist/esm/index.mjs +13 -0
- package/{build/src/layout.js → dist/esm/layout.mjs} +11 -11
- package/{build/src/lexer.js → dist/esm/lexer.mjs} +2 -2
- package/{build/src/main.js → dist/esm/main.mjs} +5 -5
- package/{build/src/objects/ClassComponent.js → dist/esm/objects/ClassComponent.mjs} +3 -3
- package/{build/src/objects/PinDefinition.js → dist/esm/objects/PinDefinition.mjs} +1 -1
- package/dist/esm/parser.mjs +269 -0
- package/{build/src/regenerate-tests.js → dist/esm/regenerate-tests.mjs} +1 -1
- package/{build/src/render.js → dist/esm/render.mjs} +7 -24
- package/{build/src/sizing.js → dist/esm/sizing.mjs} +22 -8
- package/{build/src/visitor.js → dist/esm/visitor.mjs} +10 -29
- package/dist/types/antlr/CircuitScriptLexer.d.ts +71 -0
- package/dist/types/antlr/CircuitScriptParser.d.ts +675 -0
- package/dist/types/antlr/CircuitScriptVisitor.d.ts +115 -0
- package/dist/types/draw_symbols.d.ts +162 -0
- package/dist/types/execute.d.ts +85 -0
- package/dist/types/export.d.ts +2 -0
- package/dist/types/fonts.d.ts +1 -0
- package/dist/types/geometry.d.ts +84 -0
- package/dist/types/globals.d.ts +50 -0
- package/dist/types/helpers.d.ts +9 -0
- package/dist/types/index.d.ts +13 -0
- package/dist/types/layout.d.ts +147 -0
- package/dist/types/lexer.d.ts +19 -0
- package/dist/types/logger.d.ts +6 -0
- package/dist/types/main.d.ts +2 -0
- package/dist/types/objects/ClassComponent.d.ts +40 -0
- package/dist/types/objects/ExecutionScope.d.ts +64 -0
- package/dist/types/objects/Frame.d.ts +15 -0
- package/dist/types/objects/Net.d.ts +10 -0
- package/dist/types/objects/ParamDefinition.d.ts +20 -0
- package/dist/types/objects/PinDefinition.d.ts +24 -0
- package/dist/types/objects/PinTypes.d.ts +7 -0
- package/dist/types/objects/Wire.d.ts +11 -0
- package/dist/types/objects/types.d.ts +49 -0
- package/dist/types/parser.d.ts +38 -0
- package/dist/types/regenerate-tests.d.ts +1 -0
- package/dist/types/render.d.ts +10 -0
- package/dist/types/server.d.ts +1 -0
- package/dist/types/sizing.d.ts +15 -0
- package/dist/types/utils.d.ts +19 -0
- package/dist/types/visitor.d.ts +135 -0
- package/package.json +30 -12
- package/.editorconfig +0 -15
- package/.eslintignore +0 -1
- package/.eslintrc.json +0 -27
- package/.gitlab-ci.yml +0 -81
- package/.prettierignore +0 -8
- package/.prettierrc +0 -16
- package/__tests__/expectedResults.ts +0 -657
- package/__tests__/helpers.ts +0 -82
- package/__tests__/parseScripts.ts +0 -593
- package/__tests__/renderData/script1.cst +0 -58
- package/__tests__/renderData/script1.cst.svg +0 -1
- package/__tests__/renderData/script2.cst +0 -16
- package/__tests__/renderData/script2.cst.svg +0 -1
- package/__tests__/renderData/script3.cst +0 -30
- package/__tests__/renderData/script3.cst.svg +0 -1
- package/__tests__/renderData/script4.cst +0 -54
- package/__tests__/renderData/script4.cst.svg +0 -1
- package/__tests__/renderData/script5.cst +0 -23
- package/__tests__/renderData/script5.cst.svg +0 -1
- package/__tests__/renderData/script6.cst +0 -28
- package/__tests__/renderData/script6.cst.svg +0 -1
- package/__tests__/renderData/script7.cst +0 -26
- package/__tests__/renderData/script7.cst.svg +0 -1
- package/__tests__/renderData/script8.cst +0 -37
- package/__tests__/renderData/script8.cst.svg +0 -1
- package/__tests__/testCLI.ts +0 -68
- package/__tests__/testMathOps.ts +0 -36
- package/__tests__/testMergeWires.ts +0 -141
- package/__tests__/testParse.ts +0 -263
- package/__tests__/testRender.ts +0 -38
- package/build/src/parser.js +0 -69
- package/documentation.md +0 -238
- package/examples/example_arduino_uno.cst +0 -1146
- package/examples/example_garden_pump.cst +0 -567
- package/examples/lib.cst +0 -185
- package/fonts/Inter-Bold.ttf +0 -0
- package/fonts/Inter-Regular.ttf +0 -0
- package/fonts/OpenSans-Regular.ttf +0 -0
- package/fonts/Roboto-Regular.ttf +0 -0
- package/jest.config.js +0 -23
- package/libs/lib.cst +0 -185
- package/refresh.html +0 -42
- package/server.cjs +0 -50
- package/src/antlr/CircuitScript.g4 +0 -209
- package/src/antlr/CircuitScriptLexer.ts +0 -317
- package/src/antlr/CircuitScriptParser.ts +0 -4979
- package/src/antlr/CircuitScriptVisitor.ts +0 -420
- package/src/execute.ts +0 -1227
- package/src/fonts.ts +0 -1
- package/src/geometry.ts +0 -638
- package/src/globals.ts +0 -67
- package/src/helpers.ts +0 -114
- package/src/lexer.ts +0 -151
- package/src/logger.ts +0 -17
- package/src/main.ts +0 -105
- package/src/objects/ClassComponent.ts +0 -223
- package/src/objects/ExecutionScope.ts +0 -201
- package/src/objects/Frame.ts +0 -20
- package/src/objects/ParamDefinition.ts +0 -49
- package/src/objects/PinDefinition.ts +0 -49
- package/src/objects/PinTypes.ts +0 -7
- package/src/objects/Wire.ts +0 -19
- package/src/objects/types.ts +0 -66
- package/src/parser.ts +0 -106
- package/src/regenerate-tests.ts +0 -25
- package/src/render.ts +0 -260
- package/src/sizing.ts +0 -96
- package/tsconfig.json +0 -26
- package/tsconfig.release.json +0 -8
- /package/{build/src/antlr/CircuitScriptVisitor.js → dist/esm/antlr/CircuitScriptVisitor.mjs} +0 -0
- /package/{build/src/fonts.js → dist/esm/fonts.mjs} +0 -0
- /package/{build/src/globals.js → dist/esm/globals.mjs} +0 -0
- /package/{build/src/logger.js → dist/esm/logger.mjs} +0 -0
- /package/{build/src/objects/ExecutionScope.js → dist/esm/objects/ExecutionScope.mjs} +0 -0
- /package/{build/src/objects/Frame.js → dist/esm/objects/Frame.mjs} +0 -0
- /package/{build/src/objects/Net.js → dist/esm/objects/Net.mjs} +0 -0
- /package/{build/src/objects/ParamDefinition.js → dist/esm/objects/ParamDefinition.mjs} +0 -0
- /package/{build/src/objects/PinTypes.js → dist/esm/objects/PinTypes.mjs} +0 -0
- /package/{build/src/objects/Wire.js → dist/esm/objects/Wire.mjs} +0 -0
- /package/{build/src/objects/types.js → dist/esm/objects/types.mjs} +0 -0
- /package/{build/src/server.js → dist/esm/server.mjs} +0 -0
- /package/{build/src/utils.js → dist/esm/utils.mjs} +0 -0
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { ParseTreeVisitor } from 'antlr4';
|
|
2
|
+
import { ScriptContext } from "./CircuitScriptParser";
|
|
3
|
+
import { ExpressionContext } from "./CircuitScriptParser";
|
|
4
|
+
import { Path_blocksContext } from "./CircuitScriptParser";
|
|
5
|
+
import { Path_block_innerContext } from "./CircuitScriptParser";
|
|
6
|
+
import { Property_set_expr2Context } from "./CircuitScriptParser";
|
|
7
|
+
import { Assignment_expr2Context } from "./CircuitScriptParser";
|
|
8
|
+
import { Data_expr_with_assignmentContext } from "./CircuitScriptParser";
|
|
9
|
+
import { Add_component_exprContext } from "./CircuitScriptParser";
|
|
10
|
+
import { Component_select_exprContext } from "./CircuitScriptParser";
|
|
11
|
+
import { Pin_select_exprContext } from "./CircuitScriptParser";
|
|
12
|
+
import { Pin_select_expr2Context } from "./CircuitScriptParser";
|
|
13
|
+
import { At_component_exprContext } from "./CircuitScriptParser";
|
|
14
|
+
import { To_component_exprContext } from "./CircuitScriptParser";
|
|
15
|
+
import { At_to_multiple_exprContext } from "./CircuitScriptParser";
|
|
16
|
+
import { At_to_multiple_line_exprContext } from "./CircuitScriptParser";
|
|
17
|
+
import { At_to_multiple_line_expr_to_pinContext } from "./CircuitScriptParser";
|
|
18
|
+
import { At_blockContext } from "./CircuitScriptParser";
|
|
19
|
+
import { At_block_expressionsContext } from "./CircuitScriptParser";
|
|
20
|
+
import { At_block_pin_exprContext } from "./CircuitScriptParser";
|
|
21
|
+
import { At_block_pin_expression_simpleContext } from "./CircuitScriptParser";
|
|
22
|
+
import { At_block_pin_expression_complexContext } from "./CircuitScriptParser";
|
|
23
|
+
import { Break_keywordContext } from "./CircuitScriptParser";
|
|
24
|
+
import { Assignment_exprContext } from "./CircuitScriptParser";
|
|
25
|
+
import { Keyword_assignment_exprContext } from "./CircuitScriptParser";
|
|
26
|
+
import { ParametersContext } from "./CircuitScriptParser";
|
|
27
|
+
import { Property_set_exprContext } from "./CircuitScriptParser";
|
|
28
|
+
import { Double_dot_property_set_exprContext } from "./CircuitScriptParser";
|
|
29
|
+
import { AdditionExprContext } from "./CircuitScriptParser";
|
|
30
|
+
import { MultiplyExprContext } from "./CircuitScriptParser";
|
|
31
|
+
import { DataExprContext } from "./CircuitScriptParser";
|
|
32
|
+
import { UnaryOperatorExprContext } from "./CircuitScriptParser";
|
|
33
|
+
import { ValueAtomExprContext } from "./CircuitScriptParser";
|
|
34
|
+
import { BinaryOperatorExprContext } from "./CircuitScriptParser";
|
|
35
|
+
import { RoundedBracketsExprContext } from "./CircuitScriptParser";
|
|
36
|
+
import { Binary_operatorContext } from "./CircuitScriptParser";
|
|
37
|
+
import { Unary_operatorContext } from "./CircuitScriptParser";
|
|
38
|
+
import { Value_exprContext } from "./CircuitScriptParser";
|
|
39
|
+
import { Function_def_exprContext } from "./CircuitScriptParser";
|
|
40
|
+
import { Function_exprContext } from "./CircuitScriptParser";
|
|
41
|
+
import { Function_args_exprContext } from "./CircuitScriptParser";
|
|
42
|
+
import { Atom_exprContext } from "./CircuitScriptParser";
|
|
43
|
+
import { Trailer_exprContext } from "./CircuitScriptParser";
|
|
44
|
+
import { Net_namespace_exprContext } from "./CircuitScriptParser";
|
|
45
|
+
import { Function_return_exprContext } from "./CircuitScriptParser";
|
|
46
|
+
import { Create_component_exprContext } from "./CircuitScriptParser";
|
|
47
|
+
import { Create_graphic_exprContext } from "./CircuitScriptParser";
|
|
48
|
+
import { Sub_exprContext } from "./CircuitScriptParser";
|
|
49
|
+
import { Property_exprContext } from "./CircuitScriptParser";
|
|
50
|
+
import { Property_key_exprContext } from "./CircuitScriptParser";
|
|
51
|
+
import { Nested_propertiesContext } from "./CircuitScriptParser";
|
|
52
|
+
import { Single_line_propertyContext } from "./CircuitScriptParser";
|
|
53
|
+
import { Blank_exprContext } from "./CircuitScriptParser";
|
|
54
|
+
import { Wire_exprContext } from "./CircuitScriptParser";
|
|
55
|
+
import { Point_exprContext } from "./CircuitScriptParser";
|
|
56
|
+
import { Import_exprContext } from "./CircuitScriptParser";
|
|
57
|
+
import { Frame_exprContext } from "./CircuitScriptParser";
|
|
58
|
+
export default class CircuitScriptVisitor<Result> extends ParseTreeVisitor<Result> {
|
|
59
|
+
visitScript?: (ctx: ScriptContext) => Result;
|
|
60
|
+
visitExpression?: (ctx: ExpressionContext) => Result;
|
|
61
|
+
visitPath_blocks?: (ctx: Path_blocksContext) => Result;
|
|
62
|
+
visitPath_block_inner?: (ctx: Path_block_innerContext) => Result;
|
|
63
|
+
visitProperty_set_expr2?: (ctx: Property_set_expr2Context) => Result;
|
|
64
|
+
visitAssignment_expr2?: (ctx: Assignment_expr2Context) => Result;
|
|
65
|
+
visitData_expr_with_assignment?: (ctx: Data_expr_with_assignmentContext) => Result;
|
|
66
|
+
visitAdd_component_expr?: (ctx: Add_component_exprContext) => Result;
|
|
67
|
+
visitComponent_select_expr?: (ctx: Component_select_exprContext) => Result;
|
|
68
|
+
visitPin_select_expr?: (ctx: Pin_select_exprContext) => Result;
|
|
69
|
+
visitPin_select_expr2?: (ctx: Pin_select_expr2Context) => Result;
|
|
70
|
+
visitAt_component_expr?: (ctx: At_component_exprContext) => Result;
|
|
71
|
+
visitTo_component_expr?: (ctx: To_component_exprContext) => Result;
|
|
72
|
+
visitAt_to_multiple_expr?: (ctx: At_to_multiple_exprContext) => Result;
|
|
73
|
+
visitAt_to_multiple_line_expr?: (ctx: At_to_multiple_line_exprContext) => Result;
|
|
74
|
+
visitAt_to_multiple_line_expr_to_pin?: (ctx: At_to_multiple_line_expr_to_pinContext) => Result;
|
|
75
|
+
visitAt_block?: (ctx: At_blockContext) => Result;
|
|
76
|
+
visitAt_block_expressions?: (ctx: At_block_expressionsContext) => Result;
|
|
77
|
+
visitAt_block_pin_expr?: (ctx: At_block_pin_exprContext) => Result;
|
|
78
|
+
visitAt_block_pin_expression_simple?: (ctx: At_block_pin_expression_simpleContext) => Result;
|
|
79
|
+
visitAt_block_pin_expression_complex?: (ctx: At_block_pin_expression_complexContext) => Result;
|
|
80
|
+
visitBreak_keyword?: (ctx: Break_keywordContext) => Result;
|
|
81
|
+
visitAssignment_expr?: (ctx: Assignment_exprContext) => Result;
|
|
82
|
+
visitKeyword_assignment_expr?: (ctx: Keyword_assignment_exprContext) => Result;
|
|
83
|
+
visitParameters?: (ctx: ParametersContext) => Result;
|
|
84
|
+
visitProperty_set_expr?: (ctx: Property_set_exprContext) => Result;
|
|
85
|
+
visitDouble_dot_property_set_expr?: (ctx: Double_dot_property_set_exprContext) => Result;
|
|
86
|
+
visitAdditionExpr?: (ctx: AdditionExprContext) => Result;
|
|
87
|
+
visitMultiplyExpr?: (ctx: MultiplyExprContext) => Result;
|
|
88
|
+
visitDataExpr?: (ctx: DataExprContext) => Result;
|
|
89
|
+
visitUnaryOperatorExpr?: (ctx: UnaryOperatorExprContext) => Result;
|
|
90
|
+
visitValueAtomExpr?: (ctx: ValueAtomExprContext) => Result;
|
|
91
|
+
visitBinaryOperatorExpr?: (ctx: BinaryOperatorExprContext) => Result;
|
|
92
|
+
visitRoundedBracketsExpr?: (ctx: RoundedBracketsExprContext) => Result;
|
|
93
|
+
visitBinary_operator?: (ctx: Binary_operatorContext) => Result;
|
|
94
|
+
visitUnary_operator?: (ctx: Unary_operatorContext) => Result;
|
|
95
|
+
visitValue_expr?: (ctx: Value_exprContext) => Result;
|
|
96
|
+
visitFunction_def_expr?: (ctx: Function_def_exprContext) => Result;
|
|
97
|
+
visitFunction_expr?: (ctx: Function_exprContext) => Result;
|
|
98
|
+
visitFunction_args_expr?: (ctx: Function_args_exprContext) => Result;
|
|
99
|
+
visitAtom_expr?: (ctx: Atom_exprContext) => Result;
|
|
100
|
+
visitTrailer_expr?: (ctx: Trailer_exprContext) => Result;
|
|
101
|
+
visitNet_namespace_expr?: (ctx: Net_namespace_exprContext) => Result;
|
|
102
|
+
visitFunction_return_expr?: (ctx: Function_return_exprContext) => Result;
|
|
103
|
+
visitCreate_component_expr?: (ctx: Create_component_exprContext) => Result;
|
|
104
|
+
visitCreate_graphic_expr?: (ctx: Create_graphic_exprContext) => Result;
|
|
105
|
+
visitSub_expr?: (ctx: Sub_exprContext) => Result;
|
|
106
|
+
visitProperty_expr?: (ctx: Property_exprContext) => Result;
|
|
107
|
+
visitProperty_key_expr?: (ctx: Property_key_exprContext) => Result;
|
|
108
|
+
visitNested_properties?: (ctx: Nested_propertiesContext) => Result;
|
|
109
|
+
visitSingle_line_property?: (ctx: Single_line_propertyContext) => Result;
|
|
110
|
+
visitBlank_expr?: (ctx: Blank_exprContext) => Result;
|
|
111
|
+
visitWire_expr?: (ctx: Wire_exprContext) => Result;
|
|
112
|
+
visitPoint_expr?: (ctx: Point_exprContext) => Result;
|
|
113
|
+
visitImport_expr?: (ctx: Import_exprContext) => Result;
|
|
114
|
+
visitFrame_expr?: (ctx: Frame_exprContext) => Result;
|
|
115
|
+
}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { G } from "@svgdotjs/svg.js";
|
|
2
|
+
import { Feature, GeometryProp, HorizontalAlign, Label, LabelStyle, VerticalAlign } from "./geometry.js";
|
|
3
|
+
import { Logger } from "./logger.js";
|
|
4
|
+
export declare abstract class SymbolGraphic {
|
|
5
|
+
drawPortsName: boolean;
|
|
6
|
+
displayBounds: boolean;
|
|
7
|
+
drawing: SymbolDrawing;
|
|
8
|
+
_angle: number;
|
|
9
|
+
width: number;
|
|
10
|
+
height: number;
|
|
11
|
+
labelTexts: Map<string, string>;
|
|
12
|
+
get angle(): number;
|
|
13
|
+
set angle(value: number);
|
|
14
|
+
refreshDrawing(calculateSize?: boolean): void;
|
|
15
|
+
calculateSize(): void;
|
|
16
|
+
abstract generateDrawing(): void;
|
|
17
|
+
size(): {
|
|
18
|
+
width: number;
|
|
19
|
+
height: number;
|
|
20
|
+
};
|
|
21
|
+
draw(group: G, extra?: unknown): void;
|
|
22
|
+
drawPlaceRemove(group: G, extra?: {
|
|
23
|
+
place?: boolean;
|
|
24
|
+
}): void;
|
|
25
|
+
pinPosition(id: number): {
|
|
26
|
+
x: number;
|
|
27
|
+
y: number;
|
|
28
|
+
angle: number;
|
|
29
|
+
};
|
|
30
|
+
protected drawBounds(group: G): void;
|
|
31
|
+
protected drawBody(group: G): void;
|
|
32
|
+
protected drawPins(group: G): void;
|
|
33
|
+
protected drawLabels(group: G): void;
|
|
34
|
+
flipTextAnchor(value: HorizontalAlign): HorizontalAlign;
|
|
35
|
+
flipDominantBaseline(value: VerticalAlign): VerticalAlign;
|
|
36
|
+
setLabelValue(labelId: string, labelValue: string): void;
|
|
37
|
+
getLabelValue(labelId: string): string;
|
|
38
|
+
}
|
|
39
|
+
export declare function SymbolFactory(name: string): SymbolGraphic;
|
|
40
|
+
export declare class SymbolPointHidden extends SymbolGraphic {
|
|
41
|
+
generateDrawing(): void;
|
|
42
|
+
}
|
|
43
|
+
export declare class SymbolText extends SymbolGraphic {
|
|
44
|
+
text: string;
|
|
45
|
+
fontSize: number;
|
|
46
|
+
fontWeight: string;
|
|
47
|
+
constructor(text: string);
|
|
48
|
+
generateDrawing(): void;
|
|
49
|
+
}
|
|
50
|
+
export declare class SymbolPlaceholder extends SymbolGraphic {
|
|
51
|
+
generateDrawing(): void;
|
|
52
|
+
drawPinParams(drawing: SymbolDrawingCommands, commandName: string, keywordParams: Map<string, any>, positionParams: any[]): void;
|
|
53
|
+
constructor(drawing: SymbolDrawing);
|
|
54
|
+
}
|
|
55
|
+
export declare enum PlaceHolderCommands {
|
|
56
|
+
arc = "arc",
|
|
57
|
+
circle = "circle",
|
|
58
|
+
rect = "rect",
|
|
59
|
+
triangle = "triangle",
|
|
60
|
+
pin = "pin",
|
|
61
|
+
hpin = "hpin",
|
|
62
|
+
vpin = "vpin",
|
|
63
|
+
hline = "hline",
|
|
64
|
+
vline = "vline",
|
|
65
|
+
line = "line",
|
|
66
|
+
label = "label",
|
|
67
|
+
path = "path",
|
|
68
|
+
lineWidth = "lineWidth",
|
|
69
|
+
fill = "fill",
|
|
70
|
+
lineColor = "lineColor"
|
|
71
|
+
}
|
|
72
|
+
export declare class SymbolCustom extends SymbolGraphic {
|
|
73
|
+
pinDefinition: SymbolPinDefintion[];
|
|
74
|
+
bodyWidth: number;
|
|
75
|
+
pinLength: number;
|
|
76
|
+
width: number;
|
|
77
|
+
height: number;
|
|
78
|
+
pinSpacing: number;
|
|
79
|
+
pinTextPadding: number;
|
|
80
|
+
pins: SymbolPinLayout[];
|
|
81
|
+
_cacheLeftPins: SymbolPinDefintion[];
|
|
82
|
+
_cacheRightPins: SymbolPinDefintion[];
|
|
83
|
+
constructor(pinDefinition: SymbolPinDefintion[]);
|
|
84
|
+
generateDrawing(): void;
|
|
85
|
+
calculateSize(): void;
|
|
86
|
+
}
|
|
87
|
+
export declare class SymbolDrawing {
|
|
88
|
+
items: (Feature | GeometryProp)[];
|
|
89
|
+
pins: [number, Feature, number][];
|
|
90
|
+
angle: number;
|
|
91
|
+
mainOrigin: [number, number];
|
|
92
|
+
logger: Logger;
|
|
93
|
+
clear(): void;
|
|
94
|
+
log(...params: any[]): void;
|
|
95
|
+
addLine(startX: number, startY: number, endX: number, endY: number): SymbolDrawing;
|
|
96
|
+
addPin(pinId: number, startX: number, startY: number, endX: number, endY: number): SymbolDrawing;
|
|
97
|
+
addVLine(startX: number, startY: number, value: number): SymbolDrawing;
|
|
98
|
+
addHLine(startX: number, startY: number, value: number): SymbolDrawing;
|
|
99
|
+
addRect(centerX: number, centerY: number, width: number, height: number): SymbolDrawing;
|
|
100
|
+
addTriangle(startX: number, startY: number, endX: number, endY: number, width: number): SymbolDrawing;
|
|
101
|
+
addRect2(x: number, y: number, x2: number, y2: number): SymbolDrawing;
|
|
102
|
+
addLabel(x: number, y: number, textValue: string, style: LabelStyle): SymbolDrawing;
|
|
103
|
+
addLabelId(id: string, x: number, y: number, textValue: string, style: LabelStyle): SymbolDrawing;
|
|
104
|
+
addPath(...pathParts: any): SymbolDrawing;
|
|
105
|
+
addSetLineWidth(value: number): SymbolDrawing;
|
|
106
|
+
addSetLineColor(value: string): SymbolDrawing;
|
|
107
|
+
addSetFillColor(value: string): SymbolDrawing;
|
|
108
|
+
addArc(x: number, y: number, radius: number, startAngle: number, endAngle: number): SymbolDrawing;
|
|
109
|
+
getPaths(): {
|
|
110
|
+
path: string;
|
|
111
|
+
fillColor: string;
|
|
112
|
+
lineColor: string;
|
|
113
|
+
lineWidth: number;
|
|
114
|
+
}[];
|
|
115
|
+
getPinsPath(): string;
|
|
116
|
+
getLabels(): Label[];
|
|
117
|
+
private featuresToPath;
|
|
118
|
+
getBoundingBox(excludeLabels?: boolean): {
|
|
119
|
+
width: number;
|
|
120
|
+
height: number;
|
|
121
|
+
start: SimplePoint;
|
|
122
|
+
end: SimplePoint;
|
|
123
|
+
};
|
|
124
|
+
getPinPosition(pinId: number): {
|
|
125
|
+
start: [number, number];
|
|
126
|
+
end: [number, number];
|
|
127
|
+
angle: number;
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
export type SubExpressionCommand = [
|
|
131
|
+
commandName: string,
|
|
132
|
+
positionParams: any[],
|
|
133
|
+
keywordParams: Map<string, any>
|
|
134
|
+
];
|
|
135
|
+
export declare class SymbolDrawingCommands extends SymbolDrawing {
|
|
136
|
+
id: string;
|
|
137
|
+
private commands;
|
|
138
|
+
constructor(commands: SubExpressionCommand[]);
|
|
139
|
+
getCommands(): SubExpressionCommand[];
|
|
140
|
+
clone(): SymbolDrawingCommands;
|
|
141
|
+
}
|
|
142
|
+
type SimplePoint = [x: number, y: number];
|
|
143
|
+
type SymbolPinLayout = {
|
|
144
|
+
pinId: number;
|
|
145
|
+
angle: number;
|
|
146
|
+
text: string;
|
|
147
|
+
start: {
|
|
148
|
+
x: number;
|
|
149
|
+
y: number;
|
|
150
|
+
};
|
|
151
|
+
end: {
|
|
152
|
+
x: number;
|
|
153
|
+
y: number;
|
|
154
|
+
};
|
|
155
|
+
};
|
|
156
|
+
export type SymbolPinDefintion = {
|
|
157
|
+
side: string;
|
|
158
|
+
pinId: number;
|
|
159
|
+
text: string;
|
|
160
|
+
position: number;
|
|
161
|
+
};
|
|
162
|
+
export {};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { BlockTypes } from './globals.js';
|
|
2
|
+
import { ClassComponent } from './objects/ClassComponent.js';
|
|
3
|
+
import { ExecutionScope } from './objects/ExecutionScope.js';
|
|
4
|
+
import { Net } from './objects/Net.js';
|
|
5
|
+
import { ParamDefinition } from './objects/ParamDefinition.js';
|
|
6
|
+
import { PinDefinition } from './objects/PinDefinition.js';
|
|
7
|
+
import { CFunction, CFunctionResult, CallableParameter, ComponentPin, ReferenceType } from './objects/types.js';
|
|
8
|
+
import { Logger } from './logger.js';
|
|
9
|
+
export declare class ExecutionContext {
|
|
10
|
+
name: string;
|
|
11
|
+
namespace: string;
|
|
12
|
+
netNamespace: string;
|
|
13
|
+
executionLevel: number;
|
|
14
|
+
scope: ExecutionScope;
|
|
15
|
+
tmpPointId: number;
|
|
16
|
+
resolveNet: (name: string, netNamespace: string) => ({
|
|
17
|
+
found: boolean;
|
|
18
|
+
net?: Net;
|
|
19
|
+
});
|
|
20
|
+
stopFurtherExpressions: boolean;
|
|
21
|
+
returnValue: null;
|
|
22
|
+
silent: boolean;
|
|
23
|
+
logger: Logger;
|
|
24
|
+
__functionCache: {};
|
|
25
|
+
constructor(name: string, namespace: string, netNamespace: string, executionLevel: number | undefined, indentLevel: number | undefined, silent: boolean | undefined, logger: Logger);
|
|
26
|
+
print(...params: any[]): void;
|
|
27
|
+
private setupRoot;
|
|
28
|
+
instanceExists(instanceName: string): boolean;
|
|
29
|
+
getComponent(instanceName: string): ClassComponent;
|
|
30
|
+
getUniqueInstanceName(className: string): string;
|
|
31
|
+
getUniqueNetName(): string;
|
|
32
|
+
getCurrentPoint(): ComponentPin;
|
|
33
|
+
private linkComponentPinNet;
|
|
34
|
+
private mergeNets;
|
|
35
|
+
createComponent(instanceName: string, pins: PinDefinition[], params: ParamDefinition[], props: {
|
|
36
|
+
arrange?: Map<string, number[]>;
|
|
37
|
+
display?: string;
|
|
38
|
+
type?: string;
|
|
39
|
+
width?: number;
|
|
40
|
+
}): ClassComponent;
|
|
41
|
+
printPoint(extra?: string): void;
|
|
42
|
+
addComponentExisting(component: ClassComponent, pin: number): ComponentPin;
|
|
43
|
+
toComponent(component: ClassComponent, pinId: number | null, options?: {
|
|
44
|
+
addSequence?: boolean;
|
|
45
|
+
cloneNetComponent?: boolean;
|
|
46
|
+
}): ComponentPin;
|
|
47
|
+
atComponent(component: ClassComponent, pinId: number | null, options?: {
|
|
48
|
+
addSequence?: boolean;
|
|
49
|
+
cloneNetComponent?: boolean;
|
|
50
|
+
}): ComponentPin;
|
|
51
|
+
private isNetOnlyComponent;
|
|
52
|
+
private cloneComponent;
|
|
53
|
+
enterBlocks(blockType: BlockTypes): void;
|
|
54
|
+
exitBlocks(): void;
|
|
55
|
+
enterBlock(blockIndex: number): void;
|
|
56
|
+
exitBlock(blockIndex: number): void;
|
|
57
|
+
atPointBlock(): void;
|
|
58
|
+
toPointBlock(): void;
|
|
59
|
+
getPointBlockLocation(): [component: ClassComponent, pin: number, wireId: number];
|
|
60
|
+
breakBranch(): void;
|
|
61
|
+
createFunction(functionName: string, __runFunc: CFunction): void;
|
|
62
|
+
hasFunction(functionName: string): boolean;
|
|
63
|
+
getFunction(functionName: string): CFunction;
|
|
64
|
+
resolveVariable(executionStack: ExecutionContext[], idName: string): ReferenceType;
|
|
65
|
+
callFunction(functionName: string, functionParams: CallableParameter[], executionStack: ExecutionContext[], netNamespace: string): CFunctionResult;
|
|
66
|
+
mergeScope(childScope: ExecutionScope, namespace: string): void;
|
|
67
|
+
addWire(segments: [string, number?][]): void;
|
|
68
|
+
addPoint(pointId: string, userDefined?: boolean): ComponentPin;
|
|
69
|
+
setProperty(nameWithProp: string, value: any): void;
|
|
70
|
+
setCurrentComponentStyle(styles: {
|
|
71
|
+
[key: string]: number | string;
|
|
72
|
+
}): void;
|
|
73
|
+
enterFrame(): number;
|
|
74
|
+
exitFrame(frameId: number): void;
|
|
75
|
+
}
|
|
76
|
+
export declare function isNetComponent(component: ClassComponent): boolean;
|
|
77
|
+
export declare function isLabelComponent(component: ClassComponent): boolean;
|
|
78
|
+
export declare function getPortSide(pins: Map<number, PinDefinition>, arrangeProps: null | Map<string, number[]>): PortSideItem[];
|
|
79
|
+
type PortSideItem = {
|
|
80
|
+
pinId: number;
|
|
81
|
+
side: string;
|
|
82
|
+
order: number;
|
|
83
|
+
position: number;
|
|
84
|
+
};
|
|
85
|
+
export {};
|