circuitscript 0.1.0 → 0.1.2
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 +13 -8
- package/dist/cjs/antlr/CircuitScriptLexer.js +80 -80
- package/dist/cjs/antlr/CircuitScriptParser.js +599 -657
- package/dist/cjs/builtinMethods.js +27 -8
- package/dist/cjs/draw_symbols.js +314 -190
- package/dist/cjs/execute.js +113 -115
- package/dist/cjs/export.js +2 -4
- package/dist/cjs/geometry.js +52 -19
- package/dist/cjs/globals.js +12 -8
- package/dist/cjs/helpers.js +16 -3
- package/dist/cjs/layout.js +129 -125
- package/dist/cjs/logger.js +8 -1
- package/dist/cjs/objects/ClassComponent.js +22 -22
- package/dist/cjs/objects/ExecutionScope.js +10 -4
- package/dist/cjs/objects/Frame.js +2 -1
- package/dist/cjs/objects/ParamDefinition.js +120 -4
- package/dist/cjs/objects/PinDefinition.js +1 -4
- package/dist/cjs/render.js +40 -110
- package/dist/cjs/sizing.js +33 -7
- package/dist/cjs/utils.js +68 -2
- package/dist/cjs/visitor.js +214 -254
- package/dist/esm/BaseVisitor.mjs +15 -10
- package/dist/esm/antlr/CircuitScriptLexer.mjs +80 -80
- package/dist/esm/antlr/CircuitScriptParser.mjs +599 -657
- package/dist/esm/builtinMethods.mjs +24 -8
- package/dist/esm/draw_symbols.mjs +316 -193
- package/dist/esm/execute.mjs +115 -117
- package/dist/esm/export.mjs +2 -4
- package/dist/esm/geometry.mjs +52 -19
- package/dist/esm/globals.mjs +12 -8
- package/dist/esm/helpers.mjs +17 -4
- package/dist/esm/layout.mjs +131 -127
- package/dist/esm/logger.mjs +8 -1
- package/dist/esm/objects/ClassComponent.mjs +21 -26
- package/dist/esm/objects/ExecutionScope.mjs +10 -4
- package/dist/esm/objects/Frame.mjs +2 -1
- package/dist/esm/objects/ParamDefinition.mjs +119 -3
- package/dist/esm/objects/PinDefinition.mjs +0 -2
- package/dist/esm/render.mjs +42 -112
- package/dist/esm/sizing.mjs +34 -8
- package/dist/esm/utils.mjs +64 -1
- package/dist/esm/visitor.mjs +216 -256
- package/dist/types/BaseVisitor.d.ts +1 -1
- package/dist/types/antlr/CircuitScriptParser.d.ts +2 -3
- package/dist/types/draw_symbols.d.ts +71 -45
- package/dist/types/execute.d.ts +15 -10
- package/dist/types/geometry.d.ts +31 -19
- package/dist/types/globals.d.ts +14 -10
- package/dist/types/helpers.d.ts +2 -1
- package/dist/types/layout.d.ts +21 -21
- package/dist/types/logger.d.ts +1 -1
- package/dist/types/objects/ClassComponent.d.ts +19 -16
- package/dist/types/objects/ExecutionScope.d.ts +2 -1
- package/dist/types/objects/Frame.d.ts +2 -2
- package/dist/types/objects/ParamDefinition.d.ts +31 -2
- package/dist/types/objects/PinDefinition.d.ts +0 -2
- package/dist/types/render.d.ts +2 -1
- package/dist/types/utils.d.ts +6 -1
- package/dist/types/visitor.d.ts +4 -5
- package/libs/lib.cst +15 -3
- package/package.json +7 -3
|
@@ -17,7 +17,6 @@ export declare class BaseVisitor extends CircuitScriptVisitor<ComplexType | Refe
|
|
|
17
17
|
printStream: string[];
|
|
18
18
|
printToConsole: boolean;
|
|
19
19
|
acceptedDirections: Direction[];
|
|
20
|
-
acceptedFlip: string[];
|
|
21
20
|
protected resultData: Map<ParserRuleContext, any>;
|
|
22
21
|
protected paramData: Map<ParserRuleContext, any>;
|
|
23
22
|
pinTypesList: string[];
|
|
@@ -54,6 +53,7 @@ export declare class BaseVisitor extends CircuitScriptVisitor<ComplexType | Refe
|
|
|
54
53
|
visitArrayExpr: (ctx: ArrayExprContext) => void;
|
|
55
54
|
protected setResult(ctx: ParserRuleContext, value: any): void;
|
|
56
55
|
protected getResult(ctx: ParserRuleContext): any;
|
|
56
|
+
protected visitResult(ctx: ParserRuleContext): any;
|
|
57
57
|
protected handleImportFile(name: string, throwErrors?: boolean, ctx?: ParserRuleContext | null): {
|
|
58
58
|
hasError: boolean;
|
|
59
59
|
hasParseError: boolean;
|
|
@@ -339,6 +339,7 @@ export declare class Component_select_exprContext extends antlr.ParserRuleContex
|
|
|
339
339
|
constructor(parent: antlr.ParserRuleContext | null, invokingState: number);
|
|
340
340
|
data_expr_with_assignment(): Data_expr_with_assignmentContext | null;
|
|
341
341
|
pin_select_expr(): Pin_select_exprContext | null;
|
|
342
|
+
Point(): antlr.TerminalNode | null;
|
|
342
343
|
get ruleIndex(): number;
|
|
343
344
|
accept<Result>(visitor: CircuitScriptVisitor<Result>): Result | null;
|
|
344
345
|
}
|
|
@@ -352,15 +353,13 @@ export declare class Pin_select_expr2Context extends antlr.ParserRuleContext {
|
|
|
352
353
|
export declare class At_component_exprContext extends antlr.ParserRuleContext {
|
|
353
354
|
constructor(parent: antlr.ParserRuleContext | null, invokingState: number);
|
|
354
355
|
At(): antlr.TerminalNode;
|
|
355
|
-
component_select_expr(): Component_select_exprContext
|
|
356
|
-
Point(): antlr.TerminalNode | null;
|
|
356
|
+
component_select_expr(): Component_select_exprContext;
|
|
357
357
|
get ruleIndex(): number;
|
|
358
358
|
accept<Result>(visitor: CircuitScriptVisitor<Result>): Result | null;
|
|
359
359
|
}
|
|
360
360
|
export declare class To_component_exprContext extends antlr.ParserRuleContext {
|
|
361
361
|
constructor(parent: antlr.ParserRuleContext | null, invokingState: number);
|
|
362
362
|
To(): antlr.TerminalNode;
|
|
363
|
-
Point(): antlr.TerminalNode | null;
|
|
364
363
|
component_select_expr(): Component_select_exprContext[];
|
|
365
364
|
component_select_expr(i: number): Component_select_exprContext | null;
|
|
366
365
|
get ruleIndex(): number;
|
|
@@ -3,6 +3,7 @@ import { Feature, GeometryProp, HorizontalAlign, LabelStyle, Textbox, VerticalAl
|
|
|
3
3
|
import { Logger } from "./logger.js";
|
|
4
4
|
import { PinTypes } from "./objects/PinTypes.js";
|
|
5
5
|
import { ParserRuleContext } from "antlr4ng";
|
|
6
|
+
import { NumericValue } from "./objects/ParamDefinition.js";
|
|
6
7
|
export declare abstract class SymbolGraphic {
|
|
7
8
|
drawPortsName: boolean;
|
|
8
9
|
displayBounds: boolean;
|
|
@@ -10,8 +11,8 @@ export declare abstract class SymbolGraphic {
|
|
|
10
11
|
_angle: number;
|
|
11
12
|
_flipX: number;
|
|
12
13
|
_flipY: number;
|
|
13
|
-
width:
|
|
14
|
-
height:
|
|
14
|
+
width: NumericValue;
|
|
15
|
+
height: NumericValue;
|
|
15
16
|
labelTexts: Map<string, string>;
|
|
16
17
|
constructor();
|
|
17
18
|
get angle(): number;
|
|
@@ -21,7 +22,12 @@ export declare abstract class SymbolGraphic {
|
|
|
21
22
|
get flipY(): number;
|
|
22
23
|
set flipY(value: number);
|
|
23
24
|
refreshDrawing(calculateSize?: boolean): void;
|
|
24
|
-
calculateSize():
|
|
25
|
+
calculateSize(): {
|
|
26
|
+
bodyWidth: NumericValue;
|
|
27
|
+
bodyHeight: NumericValue;
|
|
28
|
+
width: NumericValue;
|
|
29
|
+
height: NumericValue;
|
|
30
|
+
};
|
|
25
31
|
abstract generateDrawing(): void;
|
|
26
32
|
size(): {
|
|
27
33
|
width: number;
|
|
@@ -32,9 +38,9 @@ export declare abstract class SymbolGraphic {
|
|
|
32
38
|
place?: boolean;
|
|
33
39
|
}): void;
|
|
34
40
|
pinPosition(id: number): {
|
|
35
|
-
x:
|
|
36
|
-
y:
|
|
37
|
-
angle:
|
|
41
|
+
x: NumericValue;
|
|
42
|
+
y: NumericValue;
|
|
43
|
+
angle: NumericValue;
|
|
38
44
|
};
|
|
39
45
|
protected drawBounds(group: G): void;
|
|
40
46
|
protected drawBody(group: G): void;
|
|
@@ -43,13 +49,9 @@ export declare abstract class SymbolGraphic {
|
|
|
43
49
|
flipTextAnchor(value: HorizontalAlign): HorizontalAlign;
|
|
44
50
|
flipDominantBaseline(value: VerticalAlign): VerticalAlign;
|
|
45
51
|
}
|
|
46
|
-
export declare function SymbolFactory(name: string): SymbolGraphic;
|
|
47
|
-
export declare class SymbolPointHidden extends SymbolGraphic {
|
|
48
|
-
generateDrawing(): void;
|
|
49
|
-
}
|
|
50
52
|
export declare class SymbolText extends SymbolGraphic {
|
|
51
53
|
text: string;
|
|
52
|
-
fontSize:
|
|
54
|
+
fontSize: NumericValue;
|
|
53
55
|
fontWeight: string;
|
|
54
56
|
constructor(text: string);
|
|
55
57
|
generateDrawing(): void;
|
|
@@ -86,62 +88,85 @@ export declare enum PlaceHolderCommands {
|
|
|
86
88
|
}
|
|
87
89
|
export declare class SymbolCustom extends SymbolGraphic {
|
|
88
90
|
pinDefinition: SymbolPinDefintion[];
|
|
89
|
-
bodyWidth:
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
91
|
+
bodyWidth: NumericValue;
|
|
92
|
+
bodyHeight: NumericValue;
|
|
93
|
+
pinLength: NumericValue;
|
|
94
|
+
width: NumericValue;
|
|
95
|
+
height: NumericValue;
|
|
96
|
+
pinSpacing: NumericValue;
|
|
97
|
+
pinTextPadding: NumericValue;
|
|
95
98
|
pins: SymbolPinLayout[];
|
|
96
99
|
_cacheLeftPins: SymbolPinDefintion[];
|
|
97
100
|
_cacheRightPins: SymbolPinDefintion[];
|
|
98
|
-
|
|
101
|
+
_cacheTopPins: SymbolPinDefintion[];
|
|
102
|
+
_cacheBottomPins: SymbolPinDefintion[];
|
|
103
|
+
pinMaxPositions: {
|
|
104
|
+
[key: string]: number;
|
|
105
|
+
};
|
|
106
|
+
constructor(pinDefinition: SymbolPinDefintion[], pinMaxPositions: {
|
|
107
|
+
[key: string]: number;
|
|
108
|
+
});
|
|
99
109
|
generateDrawing(): void;
|
|
100
|
-
|
|
101
|
-
|
|
110
|
+
private getPins;
|
|
111
|
+
generateDrawingPins(drawing: SymbolDrawing, bodyWidthMM: NumericValue, bodyHeightMM: NumericValue, pins: {
|
|
112
|
+
left: SymbolPinDefintion[];
|
|
113
|
+
right: SymbolPinDefintion[];
|
|
114
|
+
top: SymbolPinDefintion[];
|
|
115
|
+
bottom: SymbolPinDefintion[];
|
|
116
|
+
}, defaultLineColor: string): void;
|
|
117
|
+
calculateSize(): {
|
|
118
|
+
bodyWidth: NumericValue;
|
|
119
|
+
bodyHeight: NumericValue;
|
|
120
|
+
width: NumericValue;
|
|
121
|
+
height: NumericValue;
|
|
122
|
+
};
|
|
102
123
|
}
|
|
103
124
|
export declare class SymbolCustomModule extends SymbolCustom {
|
|
104
|
-
pinLength:
|
|
105
|
-
portWidth:
|
|
106
|
-
portHeight:
|
|
107
|
-
generateDrawingPins(drawing: SymbolDrawing, bodyWidthMM:
|
|
125
|
+
pinLength: NumericValue;
|
|
126
|
+
portWidth: NumericValue;
|
|
127
|
+
portHeight: NumericValue;
|
|
128
|
+
generateDrawingPins(drawing: SymbolDrawing, bodyWidthMM: NumericValue, bodyHeightMM: NumericValue, pins: {
|
|
129
|
+
left: SymbolPinDefintion[];
|
|
130
|
+
right: SymbolPinDefintion[];
|
|
131
|
+
top: SymbolPinDefintion[];
|
|
132
|
+
bottom: SymbolPinDefintion[];
|
|
133
|
+
}, defaultLineColor: string): void;
|
|
108
134
|
}
|
|
109
135
|
export declare class SymbolDrawing {
|
|
110
136
|
items: (Feature | GeometryProp)[];
|
|
111
|
-
pins: [
|
|
137
|
+
pins: [NumericValue, Feature, angle: NumericValue, lineColor: string][];
|
|
112
138
|
angle: number;
|
|
113
139
|
flipX: number;
|
|
114
140
|
flipY: number;
|
|
115
|
-
mainOrigin: [
|
|
141
|
+
mainOrigin: [x: NumericValue, y: NumericValue];
|
|
116
142
|
logger: Logger;
|
|
117
143
|
variables: Map<string, any>;
|
|
118
144
|
clear(): void;
|
|
119
145
|
log(...params: any[]): void;
|
|
120
|
-
addLine(startX:
|
|
121
|
-
addPin(pinId:
|
|
122
|
-
addPinMM(pinId:
|
|
123
|
-
addVLine(startX:
|
|
124
|
-
addHLine(startX:
|
|
125
|
-
addRect(centerX:
|
|
126
|
-
addRectMM(centerX:
|
|
127
|
-
addTriangle(startX:
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
addModulePort(x: number, y: number, width: number, height: number, portType?: PinTypes, scaleX?: number): SymbolDrawing;
|
|
146
|
+
addLine(startX: NumericValue, startY: NumericValue, endX: NumericValue, endY: NumericValue): SymbolDrawing;
|
|
147
|
+
addPin(pinId: NumericValue, startX: NumericValue, startY: NumericValue, endX: NumericValue, endY: NumericValue, lineColor: string): SymbolDrawing;
|
|
148
|
+
addPinMM(pinId: NumericValue, startXMM: NumericValue, startYMM: NumericValue, endXMM: NumericValue, endYMM: NumericValue, lineColor: string): SymbolDrawing;
|
|
149
|
+
addVLine(startX: NumericValue, startY: NumericValue, value: NumericValue): SymbolDrawing;
|
|
150
|
+
addHLine(startX: NumericValue, startY: NumericValue, value: NumericValue): SymbolDrawing;
|
|
151
|
+
addRect(centerX: NumericValue, centerY: NumericValue, width: NumericValue, height: NumericValue): SymbolDrawing;
|
|
152
|
+
addRectMM(centerX: NumericValue, centerY: NumericValue, width: NumericValue, height: NumericValue): SymbolDrawing;
|
|
153
|
+
addTriangle(startX: NumericValue, startY: NumericValue, endX: NumericValue, endY: NumericValue, width: NumericValue): SymbolDrawing;
|
|
154
|
+
addLabel(x: NumericValue, y: NumericValue, textValue: string, style: LabelStyle): SymbolDrawing;
|
|
155
|
+
addLabelMils(x: NumericValue, y: NumericValue, textValue: string, style: LabelStyle): SymbolDrawing;
|
|
156
|
+
addTextbox(x: NumericValue, y: NumericValue, textValue: string, style: LabelStyle): SymbolDrawing;
|
|
157
|
+
addModulePort(x: NumericValue, y: NumericValue, width: NumericValue, height: NumericValue, portType?: PinTypes, scaleX?: number, angle?: number): SymbolDrawing;
|
|
133
158
|
addPath(...pathParts: any): SymbolDrawing;
|
|
134
|
-
addSetLineWidth(value:
|
|
159
|
+
addSetLineWidth(value: NumericValue): SymbolDrawing;
|
|
135
160
|
addSetLineColor(value: string): SymbolDrawing;
|
|
136
161
|
addSetTextColor(value: string): SymbolDrawing;
|
|
137
162
|
addSetFillColor(value: string): SymbolDrawing;
|
|
138
|
-
addArc(x:
|
|
163
|
+
addArc(x: NumericValue, y: NumericValue, radius: NumericValue, startAngle: NumericValue, endAngle: NumericValue): SymbolDrawing;
|
|
139
164
|
addSetUnits(value: string): SymbolDrawing;
|
|
140
165
|
getPaths(): {
|
|
141
166
|
path: string;
|
|
142
167
|
fillColor: string;
|
|
143
168
|
lineColor: string;
|
|
144
|
-
lineWidth:
|
|
169
|
+
lineWidth: NumericValue;
|
|
145
170
|
}[];
|
|
146
171
|
getPinsPath(): {
|
|
147
172
|
path: string;
|
|
@@ -156,9 +181,9 @@ export declare class SymbolDrawing {
|
|
|
156
181
|
end: SimplePoint;
|
|
157
182
|
};
|
|
158
183
|
getPinPosition(pinId: number): {
|
|
159
|
-
start: [
|
|
160
|
-
end: [
|
|
161
|
-
angle:
|
|
184
|
+
start: [x: NumericValue, y: NumericValue];
|
|
185
|
+
end: [x: NumericValue, y: NumericValue];
|
|
186
|
+
angle: NumericValue;
|
|
162
187
|
};
|
|
163
188
|
}
|
|
164
189
|
export type GraphicExprCommand = [
|
|
@@ -176,6 +201,7 @@ export declare class SymbolDrawingCommands extends SymbolDrawing {
|
|
|
176
201
|
runCommands(): void;
|
|
177
202
|
getCommands(): GraphicExprCommand[];
|
|
178
203
|
clone(): SymbolDrawingCommands;
|
|
204
|
+
eq(other: SymbolDrawingCommands): boolean;
|
|
179
205
|
}
|
|
180
206
|
type SimplePoint = [x: number, y: number];
|
|
181
207
|
type SymbolPinLayout = {
|
package/dist/types/execute.d.ts
CHANGED
|
@@ -2,12 +2,13 @@ import { BlockTypes, FrameType } from './globals.js';
|
|
|
2
2
|
import { ClassComponent } from './objects/ClassComponent.js';
|
|
3
3
|
import { ExecutionScope } from './objects/ExecutionScope.js';
|
|
4
4
|
import { Net } from './objects/Net.js';
|
|
5
|
-
import { ParamDefinition } from './objects/ParamDefinition.js';
|
|
5
|
+
import { NumericValue, ParamDefinition } from './objects/ParamDefinition.js';
|
|
6
6
|
import { PinDefinition } from './objects/PinDefinition.js';
|
|
7
7
|
import { CFunction, CFunctionResult, CallableParameter, ComponentPin, DeclaredReference } from './objects/types.js';
|
|
8
8
|
import { Logger } from './logger.js';
|
|
9
9
|
import { UnitDimension } from './helpers.js';
|
|
10
10
|
import { ParserRuleContext } from 'antlr4ng';
|
|
11
|
+
import { SymbolDrawingCommands } from './draw_symbols.js';
|
|
11
12
|
export declare class ExecutionContext {
|
|
12
13
|
name: string;
|
|
13
14
|
namespace: string;
|
|
@@ -29,20 +30,21 @@ export declare class ExecutionContext {
|
|
|
29
30
|
constructor(name: string, namespace: string, netNamespace: string, executionLevel: number | undefined, indentLevel: number | undefined, silent: boolean | undefined, logger: Logger, parent: ExecutionContext);
|
|
30
31
|
log(...params: any[]): void;
|
|
31
32
|
private setupRoot;
|
|
32
|
-
getUniqueInstanceName(
|
|
33
|
-
getUniqueNetName
|
|
33
|
+
getUniqueInstanceName(): string;
|
|
34
|
+
private getUniqueNetName;
|
|
34
35
|
getCurrentPoint(): ComponentPin;
|
|
35
36
|
private linkComponentPinNet;
|
|
36
37
|
private mergeNets;
|
|
37
38
|
createComponent(instanceName: string, pins: PinDefinition[], params: ParamDefinition[], props: {
|
|
38
39
|
arrange?: Map<string, number[]>;
|
|
39
|
-
display?:
|
|
40
|
+
display?: SymbolDrawingCommands;
|
|
40
41
|
type?: string;
|
|
41
42
|
width?: number;
|
|
43
|
+
height?: number;
|
|
42
44
|
copy: boolean;
|
|
43
|
-
angle?:
|
|
45
|
+
angle?: NumericValue;
|
|
44
46
|
followWireOrientation: boolean;
|
|
45
|
-
}): ClassComponent;
|
|
47
|
+
}, isModule?: boolean): ClassComponent;
|
|
46
48
|
printPoint(extra?: string): void;
|
|
47
49
|
addComponentExisting(component: ClassComponent, pin: number): ComponentPin;
|
|
48
50
|
toComponent(component: ClassComponent, pinId: number | null, options?: {
|
|
@@ -70,15 +72,18 @@ export declare class ExecutionContext {
|
|
|
70
72
|
mergeScope(childScope: ExecutionScope, namespace: string): void;
|
|
71
73
|
addWire(segments: [string, (number | UnitDimension)?][]): void;
|
|
72
74
|
addPoint(pointId: string, userDefined?: boolean): ComponentPin;
|
|
75
|
+
private getPointSymbol;
|
|
73
76
|
setProperty(nameWithProp: string, value: any): void;
|
|
74
|
-
setCurrentComponentStyle(styles: {
|
|
75
|
-
[key: string]: number | string;
|
|
76
|
-
}): void;
|
|
77
77
|
applyComponentAngleFromWire(component: ClassComponent, pin: number, opposite?: boolean): void;
|
|
78
78
|
enterFrame(frameType: FrameType): number;
|
|
79
79
|
exitFrame(frameId: number): void;
|
|
80
80
|
}
|
|
81
|
-
export declare function getPortSide(pins: Map<number, PinDefinition>, arrangeProps: null | Map<string, number[]>):
|
|
81
|
+
export declare function getPortSide(pins: Map<number, PinDefinition>, arrangeProps: null | Map<string, number[]>): {
|
|
82
|
+
pins: PortSideItem[];
|
|
83
|
+
maxPositions: {
|
|
84
|
+
[key: string]: number;
|
|
85
|
+
};
|
|
86
|
+
};
|
|
82
87
|
type PortSideItem = {
|
|
83
88
|
pinId: number;
|
|
84
89
|
side: string;
|
package/dist/types/geometry.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import Flatten from '@flatten-js/core';
|
|
2
2
|
import { Box } from '@svgdotjs/svg.js';
|
|
3
|
+
import { NumericValue } from './objects/ParamDefinition.js';
|
|
3
4
|
import { PinTypes } from './objects/PinTypes.js';
|
|
4
5
|
export type Segment = Flatten.Segment;
|
|
5
6
|
export type Polygon = Flatten.Polygon;
|
|
@@ -9,9 +10,9 @@ export type Arc = Flatten.Arc;
|
|
|
9
10
|
export type Feature = Segment | Polygon | Textbox | Arc | Multiline;
|
|
10
11
|
export type LabelStyle = {
|
|
11
12
|
font?: string;
|
|
12
|
-
fontSize?:
|
|
13
|
+
fontSize?: NumericValue;
|
|
13
14
|
fontWeight?: string;
|
|
14
|
-
angle?:
|
|
15
|
+
angle?: NumericValue;
|
|
15
16
|
anchor?: HorizontalAlign.Left | HorizontalAlign.Middle | HorizontalAlign.Right;
|
|
16
17
|
vanchor?: VerticalAlign.Top | VerticalAlign.Middle | VerticalAlign.Bottom;
|
|
17
18
|
textColor?: string;
|
|
@@ -20,7 +21,7 @@ export type LabelStyle = {
|
|
|
20
21
|
export declare class Textbox extends Flatten.Polygon {
|
|
21
22
|
id: string;
|
|
22
23
|
text: string;
|
|
23
|
-
anchorPoint: [
|
|
24
|
+
anchorPoint: [NumericValue, NumericValue];
|
|
24
25
|
boundingBox: {
|
|
25
26
|
width: number;
|
|
26
27
|
height: number;
|
|
@@ -31,12 +32,12 @@ export declare class Textbox extends Flatten.Polygon {
|
|
|
31
32
|
textMeasurementBounds: Box;
|
|
32
33
|
label: boolean;
|
|
33
34
|
get box(): Flatten.Box;
|
|
34
|
-
constructor(id: string, text: string, anchorPoint: [
|
|
35
|
-
static fromPoint(id: string, x:
|
|
35
|
+
constructor(id: string, text: string, anchorPoint: [NumericValue, NumericValue], polygon: Flatten.Polygon, style: LabelStyle, bounds: Box, label: boolean);
|
|
36
|
+
static fromPoint(id: string, x: NumericValue, y: NumericValue, text: string, style: LabelStyle, label: boolean): Textbox;
|
|
36
37
|
rotate(angle: number, origin: Flatten.Point): Textbox;
|
|
37
38
|
transform(matrix: Flatten.Matrix): Textbox;
|
|
38
39
|
private transformAnchorPoint;
|
|
39
|
-
getLabelPosition(): [
|
|
40
|
+
getLabelPosition(): [x: NumericValue, y: NumericValue];
|
|
40
41
|
}
|
|
41
42
|
export declare class GeometryProp {
|
|
42
43
|
name: string;
|
|
@@ -44,18 +45,18 @@ export declare class GeometryProp {
|
|
|
44
45
|
constructor(name: any, value: any);
|
|
45
46
|
}
|
|
46
47
|
export declare class Geometry {
|
|
47
|
-
static point(x:
|
|
48
|
-
static line(x1:
|
|
49
|
-
static label(id: string, x:
|
|
50
|
-
static textbox(id: string | null, x:
|
|
51
|
-
static segment(start: [
|
|
52
|
-
static polygon(coords: [
|
|
53
|
-
static multiline(coords: [
|
|
54
|
-
static arc(center: [x:
|
|
55
|
-
static getCoords(item: Feature): [
|
|
56
|
-
static rotateDegs(feature: Feature, angleDegrees: number, center: [
|
|
48
|
+
static point(x: NumericValue, y: NumericValue): Flatten.Point;
|
|
49
|
+
static line(x1: NumericValue, y1: NumericValue, x2: NumericValue, y2: NumericValue): Flatten.Line;
|
|
50
|
+
static label(id: string, x: NumericValue, y: NumericValue, text: string, style: LabelStyle): Textbox;
|
|
51
|
+
static textbox(id: string | null, x: NumericValue, y: NumericValue, text: string, style: LabelStyle): Textbox;
|
|
52
|
+
static segment(start: [NumericValue, NumericValue], end: [NumericValue, NumericValue]): Segment;
|
|
53
|
+
static polygon(coords: [NumericValue, NumericValue][]): Polygon;
|
|
54
|
+
static multiline(coords: [NumericValue, NumericValue][]): Multiline;
|
|
55
|
+
static arc(center: [x: NumericValue, y: NumericValue], radius: NumericValue, startAngle: NumericValue, endAngle: NumericValue, sweepDirection: boolean): Arc;
|
|
56
|
+
static getCoords(item: Feature): [x: NumericValue, y: NumericValue][];
|
|
57
|
+
static rotateDegs(feature: Feature, angleDegrees: number, center: [x: NumericValue, y: NumericValue]): Feature;
|
|
57
58
|
static flip(feature: Feature, flipX: number, flipY: number): Feature;
|
|
58
|
-
static groupRotate(features: Feature[], angle: number, center: [
|
|
59
|
+
static groupRotate(features: Feature[], angle: number, center: [x: NumericValue, y: NumericValue]): Feature[];
|
|
59
60
|
static groupFlip(features: Feature[], flipX: number, flipY: number): Feature[];
|
|
60
61
|
static groupBounds(features: Feature[]): {
|
|
61
62
|
start: [number, number];
|
|
@@ -72,8 +73,8 @@ export declare class Geometry {
|
|
|
72
73
|
static angle(dx: number, dy: number): number;
|
|
73
74
|
static getQuadrant(dx: number, dy: number): number;
|
|
74
75
|
static mergeWires(wirePoints: {
|
|
75
|
-
x:
|
|
76
|
-
y:
|
|
76
|
+
x: NumericValue;
|
|
77
|
+
y: NumericValue;
|
|
77
78
|
}[][]): {
|
|
78
79
|
intersectPoints: WirePointCount[];
|
|
79
80
|
segments: [x: number, y: number][][];
|
|
@@ -90,4 +91,15 @@ export declare enum VerticalAlign {
|
|
|
90
91
|
Middle = "middle",
|
|
91
92
|
Bottom = "bottom"
|
|
92
93
|
}
|
|
94
|
+
export declare enum HorizontalAlignProp {
|
|
95
|
+
Start = "start",
|
|
96
|
+
Middle = "middle",
|
|
97
|
+
End = "end"
|
|
98
|
+
}
|
|
99
|
+
export declare enum VerticalAlignProp {
|
|
100
|
+
Hanging = "hanging",
|
|
101
|
+
Middle = "middle",
|
|
102
|
+
Central = "central",
|
|
103
|
+
TextTop = "text-top"
|
|
104
|
+
}
|
|
93
105
|
export {};
|
package/dist/types/globals.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
export declare enum GlobalNames {
|
|
2
2
|
__root = "__root",
|
|
3
|
-
gnd = "gnd",
|
|
4
|
-
DefaultResistor = "res",
|
|
5
|
-
DefaultCapacitor = "cap",
|
|
6
|
-
DefaultInductor = "ind",
|
|
7
3
|
symbol = "symbol"
|
|
8
4
|
}
|
|
9
5
|
export declare const NoNetText = "NO_NET";
|
|
10
6
|
export declare enum ParamKeys {
|
|
11
7
|
priority = "priority",
|
|
12
|
-
net_name = "net_name"
|
|
8
|
+
net_name = "net_name",
|
|
9
|
+
flip = "flip",
|
|
10
|
+
flipX = "flipX",
|
|
11
|
+
flipY = "flipY",
|
|
12
|
+
angle = "angle"
|
|
13
13
|
}
|
|
14
14
|
export declare enum LayoutDirection {
|
|
15
15
|
RIGHT = "RIGHT",
|
|
@@ -17,7 +17,9 @@ export declare enum LayoutDirection {
|
|
|
17
17
|
}
|
|
18
18
|
export declare enum SymbolPinSide {
|
|
19
19
|
Left = "left",
|
|
20
|
-
Right = "right"
|
|
20
|
+
Right = "right",
|
|
21
|
+
Top = "top",
|
|
22
|
+
Bottom = "bottom"
|
|
21
23
|
}
|
|
22
24
|
export declare enum LengthUnit {
|
|
23
25
|
mm = "mm",
|
|
@@ -64,11 +66,10 @@ export declare const ColorScheme: {
|
|
|
64
66
|
PinNameColor: string;
|
|
65
67
|
};
|
|
66
68
|
export declare enum ComponentTypes {
|
|
67
|
-
gnd = "gnd",
|
|
68
69
|
net = "net",
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
graphic = "graphic",
|
|
71
|
+
port = "port",
|
|
72
|
+
module = "module"
|
|
72
73
|
}
|
|
73
74
|
export declare enum ReferenceTypes {
|
|
74
75
|
function = "function",
|
|
@@ -92,4 +93,7 @@ export declare const GlobalDocumentName = "document";
|
|
|
92
93
|
export declare const RenderFlags: {
|
|
93
94
|
ShowElementFrames: boolean;
|
|
94
95
|
ShowOrigin: boolean;
|
|
96
|
+
ShowGridOrigin: boolean;
|
|
97
|
+
ShowLabelBoxBounds: boolean;
|
|
98
|
+
ShowLabelOrigin: boolean;
|
|
95
99
|
};
|
package/dist/types/helpers.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { CircuitScriptParser } from "./antlr/CircuitScriptParser.js";
|
|
|
4
4
|
import { CircuitScriptLexer } from "./antlr/CircuitScriptLexer.js";
|
|
5
5
|
import { IParsedToken, SemanticTokensVisitor } from "./SemanticTokenVisitor.js";
|
|
6
6
|
import { LengthUnit } from "./globals.js";
|
|
7
|
+
import { NumericValue } from "./objects/ParamDefinition.js";
|
|
7
8
|
export declare enum JSModuleType {
|
|
8
9
|
CommonJs = "cjs",
|
|
9
10
|
ESM = "mjs"
|
|
@@ -47,7 +48,7 @@ export declare class UnitDimension {
|
|
|
47
48
|
static mils(value: number): UnitDimension;
|
|
48
49
|
static px(value: number): UnitDimension;
|
|
49
50
|
}
|
|
50
|
-
export declare function milsToMM(value: number):
|
|
51
|
+
export declare function milsToMM(value: NumericValue | number): NumericValue;
|
|
51
52
|
export declare function pxToMM(value: number): number;
|
|
52
53
|
export declare const PaperGridReferences: {
|
|
53
54
|
[key: string]: [rows: number, columns: number];
|
package/dist/types/layout.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { Net } from './objects/Net.js';
|
|
|
8
8
|
import { Logger } from './logger.js';
|
|
9
9
|
import { Frame, FramePlotDirection } from './objects/Frame.js';
|
|
10
10
|
import { BoundBox } from './utils.js';
|
|
11
|
+
import { NumericValue } from './objects/ParamDefinition.js';
|
|
11
12
|
export declare class LayoutEngine {
|
|
12
13
|
logger: Logger;
|
|
13
14
|
placeSubgraphVersion: number;
|
|
@@ -48,7 +49,7 @@ export declare class LayoutEngine {
|
|
|
48
49
|
mergeOriginNodes(node1: RenderItem, pin1: number, node2: RenderItem, pin2: number, originNode1: string, originNode2: string, originNodes: RenderItem[], originNodeGroups: Map<string, RenderItem[]>): void;
|
|
49
50
|
placeSubgraph(graph: Graph, firstNodeId: string, subgraphEdges: Edge[]): void;
|
|
50
51
|
translateNodeBy(offsetX: number, offsetY: number, item: RenderItem): void;
|
|
51
|
-
placeNodeAtPosition(fromX:
|
|
52
|
+
placeNodeAtPosition(fromX: NumericValue, fromY: NumericValue, item: RenderItem, pin: number, depth?: number): void;
|
|
52
53
|
placeFloatingItems(graph: Graph, item: RenderItem, depth?: number): void;
|
|
53
54
|
printWarnings(): void;
|
|
54
55
|
}
|
|
@@ -63,8 +64,8 @@ type RenderItem = RenderComponent | RenderWire | RenderText;
|
|
|
63
64
|
export declare function applyComponentParamsToSymbol(component: ClassComponent, symbol: SymbolGraphic): void;
|
|
64
65
|
export declare function getBounds(components: (RenderComponent | RenderText)[], wires: RenderWire[], junctions: RenderJunction[], frames: RenderFrame[]): BoundBox;
|
|
65
66
|
export declare class RenderObject {
|
|
66
|
-
x:
|
|
67
|
-
y:
|
|
67
|
+
x: NumericValue;
|
|
68
|
+
y: NumericValue;
|
|
68
69
|
isFloating: boolean;
|
|
69
70
|
floatingRelativeTo: [selfPin: number, nodeId: string, pin: number][];
|
|
70
71
|
}
|
|
@@ -76,16 +77,16 @@ export declare class RenderWire extends RenderObject {
|
|
|
76
77
|
y: number;
|
|
77
78
|
}[];
|
|
78
79
|
netName: string;
|
|
79
|
-
constructor(x:
|
|
80
|
+
constructor(x: NumericValue, y: NumericValue, segments: WireSegment[]);
|
|
80
81
|
refreshPoints(): void;
|
|
81
|
-
getAutoPoints(value: [x:
|
|
82
|
+
getAutoPoints(value: [x: NumericValue, y: NumericValue], direction: WireAutoDirection): [dx: number, dy: number][];
|
|
82
83
|
getWireEnd(): {
|
|
83
84
|
x: number;
|
|
84
85
|
y: number;
|
|
85
86
|
};
|
|
86
87
|
isEndAutoLength(): boolean;
|
|
87
88
|
getEndAuto(): [instance: ClassComponent, pin: number];
|
|
88
|
-
setEndAuto(untilX:
|
|
89
|
+
setEndAuto(untilX: NumericValue, untilY: NumericValue): void;
|
|
89
90
|
toString(): string;
|
|
90
91
|
}
|
|
91
92
|
export type MergedWire = {
|
|
@@ -105,10 +106,10 @@ export declare class RenderComponent extends RenderObject {
|
|
|
105
106
|
}
|
|
106
107
|
export declare class RenderText extends RenderObject {
|
|
107
108
|
symbol: SymbolText;
|
|
108
|
-
_fontSize:
|
|
109
|
+
_fontSize: NumericValue;
|
|
109
110
|
_fontWeight: string;
|
|
110
|
-
get fontSize():
|
|
111
|
-
set fontSize(value:
|
|
111
|
+
get fontSize(): NumericValue;
|
|
112
|
+
set fontSize(value: NumericValue);
|
|
112
113
|
get fontWeight(): string;
|
|
113
114
|
set fontWeight(value: string);
|
|
114
115
|
constructor(text: string);
|
|
@@ -119,13 +120,12 @@ export declare class RenderFrame extends RenderObject {
|
|
|
119
120
|
innerItems: (RenderComponent | RenderFrame | RenderText)[];
|
|
120
121
|
translateX: number;
|
|
121
122
|
translateY: number;
|
|
122
|
-
padding:
|
|
123
|
-
gap:
|
|
123
|
+
padding: NumericValue;
|
|
124
|
+
gap: NumericValue;
|
|
125
|
+
borderWidth: NumericValue;
|
|
124
126
|
direction: FramePlotDirection;
|
|
125
|
-
borderWidth: number;
|
|
126
127
|
width: number | null;
|
|
127
128
|
height: number | null;
|
|
128
|
-
size: string | null;
|
|
129
129
|
subgraphId: string;
|
|
130
130
|
type: RenderFrameType;
|
|
131
131
|
containsTitle: boolean;
|
|
@@ -137,9 +137,9 @@ export declare enum RenderFrameType {
|
|
|
137
137
|
Elements = 2
|
|
138
138
|
}
|
|
139
139
|
export declare class RenderJunction {
|
|
140
|
-
x:
|
|
141
|
-
y:
|
|
142
|
-
constructor(x:
|
|
140
|
+
x: NumericValue;
|
|
141
|
+
y: NumericValue;
|
|
142
|
+
constructor(x: NumericValue, y: NumericValue);
|
|
143
143
|
}
|
|
144
144
|
export type SheetFrame = {
|
|
145
145
|
frame: RenderFrame;
|
|
@@ -151,13 +151,13 @@ export type SheetFrame = {
|
|
|
151
151
|
mergedWires: MergedWire[];
|
|
152
152
|
};
|
|
153
153
|
export declare function CalculatePinPositions(component: ClassComponent): Map<number, {
|
|
154
|
-
x:
|
|
155
|
-
y:
|
|
156
|
-
angle:
|
|
154
|
+
x: NumericValue;
|
|
155
|
+
y: NumericValue;
|
|
156
|
+
angle: NumericValue;
|
|
157
157
|
}>;
|
|
158
158
|
export declare function ExtractDrawingRects(drawing: SymbolDrawingCommands): {
|
|
159
|
-
width:
|
|
160
|
-
height:
|
|
159
|
+
width: NumericValue;
|
|
160
|
+
height: NumericValue;
|
|
161
161
|
}[];
|
|
162
162
|
type SubGraphInfo = {
|
|
163
163
|
firstNodeId: string;
|