@schemd/core 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/README.md +28 -694
- package/dist/index.d.ts +4 -4
- package/dist/index.js +4 -4
- package/dist/layout.d.ts +14 -4
- package/dist/layout.js +510 -138
- package/dist/limits.d.ts +3 -0
- package/dist/limits.js +2 -0
- package/dist/math-label.d.ts +20 -3
- package/dist/math-label.js +149 -56
- package/dist/parser.js +248 -27
- package/dist/renderer.js +147 -27
- package/dist/types.d.ts +58 -3
- package/dist/types.js +33 -1
- package/package.json +33 -3
package/dist/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
export { parseSchematic, parseSchematicColor, parseSchematicFence } from './parser.js';
|
|
11
11
|
export { renderSchematic } from './renderer.js';
|
|
12
12
|
export { schematicMarkedExtension } from './marked-extension.js';
|
|
13
|
-
export { mathLabelGlyphLength, mathLabelText, parseMathLabel, renderMathLabelTspans, type MathLabelSegment, type MathLabelSegmentKind } from './math-label.js';
|
|
14
|
-
export { MAX_SCHEMATIC_COMPONENTS, MAX_SCHEMATIC_CONNECTIONS, MAX_SCHEMATIC_SOURCE_CHARACTERS, MAX_SCHEMATIC_SVG_OUTPUT_BYTES, SCHEMATIC_LIMITS } from './limits.js';
|
|
15
|
-
export { classicalGateHeight, componentObstacleRectangle, componentRectangle, componentTextAnchors, distributedCoordinate, enumerateComponentPorts, positionIcPin, PORT_HOTSPOT_RADIUS, resolvePortPoint, routeConnections, routeConnection, SCHEMATIC_BRIDGE_RADIUS, SCHEMATIC_OBSTACLE_CLEARANCE, validateDocumentGeometry, type RoutedConnection, type ComponentTextAnchors, type ComponentPort, type IcPinSide, type SchematicRectangle } from './layout.js';
|
|
16
|
-
export { ANALOG_KINDS, COMPONENT_KINDS, CLASSICAL_GATE_KINDS, DIODE_TYPES, GROUND_STYLES, PASSIVE_KINDS, QUANTUM_GATE_KINDS, SCHEMATIC_SIGNAL_MARKERS, SEMANTIC_COLORS, TRANSISTOR_TYPES, SCHEMD_OUTPUT_MODES, SchematicSyntaxError, type AnalogKind, type CompileSchematicOptions, type ClassicalGateComponent, type ClassicalGateKind, type ComponentKind, type DiodeComponent, type DiodeType, type GroundComponent, type GroundStyle, type IcComponent, type IntegratedCircuitComponent, type IntegratedCircuitPins, type PassiveComponent, type PassiveKind, type PortComponent, type SemanticColor, type SchematicBounds, type SchematicComponent, type SchematicConnection, type SchematicColor, type SchematicDocument, type SchematicEndpoint, type SchematicFence, type SchematicSignalMarker, type SchematicMarkedOptions, type SchematicPoint, type SchemdOutputMode, type TransistorComponent, type TransistorType, type QuantumGateComponent, type QuantumGateKind } from './types.js';
|
|
13
|
+
export { mathLabelGlyphLength, mathLabelTextWidth, mathLabelText, parseMathLabel, renderMathLabelTspans, type MathLabelSegment, type MathLabelSegmentKind } from './math-label.js';
|
|
14
|
+
export { MAX_SCHEMATIC_COMPONENTS, MAX_SCHEMATIC_CONNECTIONS, MAX_SCHEMATIC_WIRE_CROSSINGS, MAX_SCHEMATIC_SOURCE_CHARACTERS, MAX_SCHEMATIC_SVG_OUTPUT_BYTES, SCHEMATIC_LIMITS } from './limits.js';
|
|
15
|
+
export { classicalGateHeight, componentObstacleRectangle, componentRectangle, componentTextAnchors, distributedCoordinate, enumerateComponentPorts, positionIcPin, PORT_HOTSPOT_RADIUS, resolvePortPoint, resolvePortGeometry, routeConnections, routeConnection, SCHEMATIC_BRIDGE_RADIUS, SCHEMATIC_OBSTACLE_CLEARANCE, validateDocumentGeometry, type RoutedConnection, type ComponentTextAnchors, type ComponentPort, type IcPinSide, type SchematicRectangle } from './layout.js';
|
|
16
|
+
export { ANALOG_KINDS, COMPONENT_KINDS, CLASSICAL_GATE_KINDS, DIODE_TYPES, GROUND_STYLES, PASSIVE_KINDS, QUANTUM_GATE_KINDS, SCHEMATIC_SIGNAL_MARKERS, SEMANTIC_COLORS, TRANSISTOR_TYPES, UML_COMPONENT_KINDS, UML_RELATION_KINDS, SCHEMD_OUTPUT_MODES, SchematicSyntaxError, type AnalogKind, type CompileSchematicOptions, type ClassicalGateComponent, type ClassicalGateKind, type ComponentKind, type DiodeComponent, type DiodeType, type GroundComponent, type GroundStyle, type IcComponent, type IntegratedCircuitComponent, type IntegratedCircuitPins, type PassiveComponent, type PassiveKind, type PortComponent, type SemanticColor, type SchematicBounds, type SchematicComponent, type SchematicConnection, type SchematicColor, type SchematicDocument, type SchematicEndpoint, type SchematicFence, type SchematicSignalMarker, type SchematicMarkedOptions, type SchematicPoint, type SchemdOutputMode, type TransistorComponent, type TransistorType, type QuantumGateComponent, type QuantumGateKind, type SchematicRelationKind, type UmlActorComponent, type UmlClassComponent, type UmlComponent, type UmlComponentKind, type UmlPseudostateComponent, type UmlRelationKind, type UmlSizedComponent, type UmlStateComponent } from './types.js';
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { parseSchematic, parseSchematicColor, parseSchematicFence } from './parser.js';
|
|
2
2
|
export { renderSchematic } from './renderer.js';
|
|
3
3
|
export { schematicMarkedExtension } from './marked-extension.js';
|
|
4
|
-
export { mathLabelGlyphLength, mathLabelText, parseMathLabel, renderMathLabelTspans } from './math-label.js';
|
|
5
|
-
export { MAX_SCHEMATIC_COMPONENTS, MAX_SCHEMATIC_CONNECTIONS, MAX_SCHEMATIC_SOURCE_CHARACTERS, MAX_SCHEMATIC_SVG_OUTPUT_BYTES, SCHEMATIC_LIMITS } from './limits.js';
|
|
6
|
-
export { classicalGateHeight, componentObstacleRectangle, componentRectangle, componentTextAnchors, distributedCoordinate, enumerateComponentPorts, positionIcPin, PORT_HOTSPOT_RADIUS, resolvePortPoint, routeConnections, routeConnection, SCHEMATIC_BRIDGE_RADIUS, SCHEMATIC_OBSTACLE_CLEARANCE, validateDocumentGeometry } from './layout.js';
|
|
7
|
-
export { ANALOG_KINDS, COMPONENT_KINDS, CLASSICAL_GATE_KINDS, DIODE_TYPES, GROUND_STYLES, PASSIVE_KINDS, QUANTUM_GATE_KINDS, SCHEMATIC_SIGNAL_MARKERS, SEMANTIC_COLORS, TRANSISTOR_TYPES, SCHEMD_OUTPUT_MODES, SchematicSyntaxError } from './types.js';
|
|
4
|
+
export { mathLabelGlyphLength, mathLabelTextWidth, mathLabelText, parseMathLabel, renderMathLabelTspans } from './math-label.js';
|
|
5
|
+
export { MAX_SCHEMATIC_COMPONENTS, MAX_SCHEMATIC_CONNECTIONS, MAX_SCHEMATIC_WIRE_CROSSINGS, MAX_SCHEMATIC_SOURCE_CHARACTERS, MAX_SCHEMATIC_SVG_OUTPUT_BYTES, SCHEMATIC_LIMITS } from './limits.js';
|
|
6
|
+
export { classicalGateHeight, componentObstacleRectangle, componentRectangle, componentTextAnchors, distributedCoordinate, enumerateComponentPorts, positionIcPin, PORT_HOTSPOT_RADIUS, resolvePortPoint, resolvePortGeometry, routeConnections, routeConnection, SCHEMATIC_BRIDGE_RADIUS, SCHEMATIC_OBSTACLE_CLEARANCE, validateDocumentGeometry } from './layout.js';
|
|
7
|
+
export { ANALOG_KINDS, COMPONENT_KINDS, CLASSICAL_GATE_KINDS, DIODE_TYPES, GROUND_STYLES, PASSIVE_KINDS, QUANTUM_GATE_KINDS, SCHEMATIC_SIGNAL_MARKERS, SEMANTIC_COLORS, TRANSISTOR_TYPES, UML_COMPONENT_KINDS, UML_RELATION_KINDS, SCHEMD_OUTPUT_MODES, SchematicSyntaxError } from './types.js';
|
package/dist/layout.d.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @packageDocumentation
|
|
10
10
|
*/
|
|
11
|
-
import { type ClassicalGateComponent, type IntegratedCircuitComponent, type SchematicComponent, type SchematicConnection, type SchematicDocument, type SchematicFence, type SchematicPoint } from './types.js';
|
|
11
|
+
import { type ClassicalGateComponent, type IntegratedCircuitComponent, type SchematicBounds, type SchematicComponent, type SchematicConnection, type SchematicDocument, type SchematicFence, type SchematicPoint } from './types.js';
|
|
12
12
|
/** Axis-aligned rectangle expressed in absolute schematic coordinates. */
|
|
13
13
|
export interface SchematicRectangle {
|
|
14
14
|
/** Inclusive left extent. */
|
|
@@ -22,6 +22,8 @@ export interface SchematicRectangle {
|
|
|
22
22
|
}
|
|
23
23
|
/** Render-ready connection path and the points used for bounds validation. */
|
|
24
24
|
export interface RoutedConnection {
|
|
25
|
+
/** Original routing strategy; crossing passes must never infer it from control points. */
|
|
26
|
+
readonly curve: SchematicConnection['curve'];
|
|
25
27
|
/** Compact SVG path-data string. */
|
|
26
28
|
d: string;
|
|
27
29
|
/** At least two absolute points spanning endpoints, controls, corners, and bridge extrema. */
|
|
@@ -44,6 +46,8 @@ export interface ComponentPort {
|
|
|
44
46
|
readonly id: string;
|
|
45
47
|
/** Absolute center of the physical terminal. */
|
|
46
48
|
readonly point: SchematicPoint;
|
|
49
|
+
/** Unit outward normal used to leave the owning component without crossing its body. */
|
|
50
|
+
readonly normal: SchematicPoint;
|
|
47
51
|
}
|
|
48
52
|
/** One edge of a polymorphic integrated-circuit body. */
|
|
49
53
|
export type IcPinSide = 'left' | 'right' | 'top' | 'bottom';
|
|
@@ -88,6 +92,11 @@ export declare function positionIcPin(component: IntegratedCircuitComponent, sid
|
|
|
88
92
|
* @throws {Error} When called with an endpoint the semantic parser did not validate.
|
|
89
93
|
*/
|
|
90
94
|
export declare function resolvePortPoint(component: SchematicComponent, port: string): SchematicPoint;
|
|
95
|
+
/** Resolve a port coordinate together with the direction a route must initially travel. */
|
|
96
|
+
export declare function resolvePortGeometry(component: SchematicComponent, port: string): {
|
|
97
|
+
readonly point: SchematicPoint;
|
|
98
|
+
readonly normal: SchematicPoint;
|
|
99
|
+
};
|
|
91
100
|
/**
|
|
92
101
|
* Enumerate each physical terminal exactly once. Alias spellings deliberately resolve through
|
|
93
102
|
* `resolvePortPoint` but do not create duplicate interactive targets.
|
|
@@ -110,9 +119,10 @@ export declare function componentObstacleRectangle(component: SchematicComponent
|
|
|
110
119
|
*
|
|
111
120
|
* @param connection - Validated directed connection.
|
|
112
121
|
* @param components - Complete component map used for endpoint and obstacle lookup.
|
|
122
|
+
* @param bounds - Optional intrinsic routing bounds.
|
|
113
123
|
* @returns SVG path data plus control/corner points for later bounds checks.
|
|
114
124
|
*/
|
|
115
|
-
export declare function routeConnection(connection: SchematicConnection, components: ReadonlyMap<string, SchematicComponent
|
|
125
|
+
export declare function routeConnection(connection: SchematicConnection, components: ReadonlyMap<string, SchematicComponent>, bounds?: SchematicBounds): RoutedConnection;
|
|
116
126
|
/**
|
|
117
127
|
* Route connections in source order and bridge only the later trace at a true crossing.
|
|
118
128
|
*
|
|
@@ -123,7 +133,7 @@ export declare function routeConnection(connection: SchematicConnection, compone
|
|
|
123
133
|
* @param components - Complete component map.
|
|
124
134
|
* @returns Routes in the same order, with crossings applied to later orthogonal traces.
|
|
125
135
|
*/
|
|
126
|
-
export declare function routeConnections(connections: readonly SchematicConnection[], components: ReadonlyMap<string, SchematicComponent
|
|
136
|
+
export declare function routeConnections(connections: readonly SchematicConnection[], components: ReadonlyMap<string, SchematicComponent>, bounds?: SchematicBounds): readonly RoutedConnection[];
|
|
127
137
|
/**
|
|
128
138
|
* Calculate external designator and label fitting metrics.
|
|
129
139
|
*
|
|
@@ -148,4 +158,4 @@ export declare function componentRectangle(component: SchematicComponent): Schem
|
|
|
148
158
|
* @param fence - Intrinsic canvas contract.
|
|
149
159
|
* @throws {SchematicSyntaxError} At the originating component or connection line.
|
|
150
160
|
*/
|
|
151
|
-
export declare function validateDocumentGeometry(document: SchematicDocument, fence: SchematicFence): void;
|
|
161
|
+
export declare function validateDocumentGeometry(document: SchematicDocument, fence: SchematicFence, routedConnections?: readonly RoutedConnection[]): void;
|