@schemd/core 0.2.1 → 0.3.1

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/types.d.ts CHANGED
@@ -11,16 +11,20 @@
11
11
  export declare const PASSIVE_KINDS: readonly ["resistor", "capacitor", "inductor"];
12
12
  /** A supported passive two-terminal component keyword. */
13
13
  export type PassiveKind = (typeof PASSIVE_KINDS)[number];
14
+ /** Compact variant registry shared by the three passive families. */
15
+ export declare const PASSIVE_TYPES: readonly ["fixed", "variable", "rheostat", "potentiometer", "thermistor", "ldr", "polarized", "coupled", "transformer"];
16
+ /** A validated passive construction variant. */
17
+ export type PassiveType = (typeof PASSIVE_TYPES)[number];
14
18
  /** Discrete analog and boundary component keywords accepted by the DSL. */
15
19
  export declare const ANALOG_KINDS: readonly ["diode", "transistor", "port", "ground"];
16
20
  /** A supported discrete analog or boundary component keyword. */
17
21
  export type AnalogKind = (typeof ANALOG_KINDS)[number];
18
22
  /** Valid diode construction variants. */
19
- export declare const DIODE_TYPES: readonly ["standard", "schottky", "zener", "led"];
23
+ export declare const DIODE_TYPES: readonly ["standard", "schottky", "zener", "led", "photodiode", "varactor", "scr", "triac"];
20
24
  /** A diode construction variant selected by the `type` attribute. */
21
25
  export type DiodeType = (typeof DIODE_TYPES)[number];
22
26
  /** Valid bipolar and field-effect transistor variants. */
23
- export declare const TRANSISTOR_TYPES: readonly ["npn", "pnp", "nmos", "pmos"];
27
+ export declare const TRANSISTOR_TYPES: readonly ["npn", "pnp", "nmos", "pmos", "njfet", "pjfet", "nigbt", "pigbt"];
24
28
  /** A transistor variant selected by the `type` attribute. */
25
29
  export type TransistorType = (typeof TRANSISTOR_TYPES)[number];
26
30
  /** Valid electrical ground symbol styles. */
@@ -28,19 +32,57 @@ export declare const GROUND_STYLES: readonly ["chassis", "earth", "signal"];
28
32
  /** A ground symbol style selected by the `style` attribute. */
29
33
  export type GroundStyle = (typeof GROUND_STYLES)[number];
30
34
  /** Classical logic gate keywords supported by the vector renderer. */
31
- export declare const CLASSICAL_GATE_KINDS: readonly ["nand", "nor", "xor", "and", "or", "not"];
35
+ export declare const ELECTRICAL_COMPONENT_KINDS: readonly ["source", "junction", "testpoint", "connector", "power", "switch", "protection", "amplifier", "resonator", "meter", "load"];
36
+ export type ElectricalComponentKind = (typeof ELECTRICAL_COMPONENT_KINDS)[number];
37
+ export declare const SOURCE_TYPES: readonly ["voltage-dc", "voltage-ac", "voltage-pulse", "current-dc", "current-ac", "battery", "vcvs", "vccs", "ccvs", "cccs"];
38
+ export type SourceType = (typeof SOURCE_TYPES)[number];
39
+ export declare const POWER_TYPES: readonly ["vcc", "vdd", "vss", "positive", "negative"];
40
+ export type PowerType = (typeof POWER_TYPES)[number];
41
+ export declare const SWITCH_TYPES: readonly ["spst", "spdt", "pushbutton", "relay"];
42
+ export type SwitchType = (typeof SWITCH_TYPES)[number];
43
+ export declare const PROTECTION_TYPES: readonly ["fuse", "breaker"];
44
+ export type ProtectionType = (typeof PROTECTION_TYPES)[number];
45
+ export declare const AMPLIFIER_TYPES: readonly ["opamp", "comparator", "instrumentation"];
46
+ export type AmplifierType = (typeof AMPLIFIER_TYPES)[number];
47
+ export declare const RESONATOR_TYPES: readonly ["crystal", "ceramic"];
48
+ export type ResonatorType = (typeof RESONATOR_TYPES)[number];
49
+ export declare const METER_TYPES: readonly ["voltmeter", "ammeter"];
50
+ export type MeterType = (typeof METER_TYPES)[number];
51
+ export declare const LOAD_TYPES: readonly ["lamp", "motor", "speaker", "buzzer"];
52
+ export type LoadType = (typeof LOAD_TYPES)[number];
53
+ /** Classical logic gates with IEEE- and IEC-style vector contours. */
54
+ export declare const CLASSICAL_GATE_KINDS: readonly ["nand", "nor", "xor", "xnor", "and", "or", "not"];
32
55
  /** A supported classical logic gate keyword. */
33
56
  export type ClassicalGateKind = (typeof CLASSICAL_GATE_KINDS)[number];
34
57
  /** Native and polymorphic quantum operator keywords. */
35
- export declare const QUANTUM_GATE_KINDS: readonly ["hadamard", "cnot", "qgate"];
58
+ export declare const DIGITAL_COMPONENT_KINDS: readonly ["buffer", "logic", "clock", "flipflop", "mux", "encoder", "decoder", "register", "counter", "adder", "comparator", "bus"];
59
+ export type DigitalComponentKind = (typeof DIGITAL_COMPONENT_KINDS)[number];
60
+ export declare const BUFFER_TYPES: readonly ["plain", "tristate", "tristate-inverter", "schmitt", "schmitt-inverter"];
61
+ export type BufferType = (typeof BUFFER_TYPES)[number];
62
+ export declare const LOGIC_STATES: readonly ["high", "low", "unknown", "high-z"];
63
+ export type LogicState = (typeof LOGIC_STATES)[number];
64
+ export declare const FLIPFLOP_TYPES: readonly ["sr-latch", "d-latch", "d", "jk", "t"];
65
+ export type FlipFlopType = (typeof FLIPFLOP_TYPES)[number];
66
+ export declare const MUX_TYPES: readonly ["mux", "demux"];
67
+ export type MuxType = (typeof MUX_TYPES)[number];
68
+ export declare const ADDER_TYPES: readonly ["half", "full"];
69
+ export type AdderType = (typeof ADDER_TYPES)[number];
70
+ export declare const BUS_TYPES: readonly ["tap", "splitter", "joiner"];
71
+ export type BusType = (typeof BUS_TYPES)[number];
72
+ /** Native, named, and polymorphic quantum operator keywords. */
73
+ export declare const NAMED_QUANTUM_GATE_KINDS: readonly ["xgate", "ygate", "zgate", "sgate", "sdg", "tgate", "tdg", "sx", "phase", "rx", "ry", "rz", "ugate"];
74
+ export type NamedQuantumGateKind = (typeof NAMED_QUANTUM_GATE_KINDS)[number];
75
+ export declare const QUANTUM_SPECIAL_KINDS: readonly ["measure", "reset", "prepare", "swap", "control", "cz", "cphase", "toffoli", "controlled", "barrier", "delay", "classical-bit", "classical-register"];
76
+ export type QuantumSpecialKind = (typeof QUANTUM_SPECIAL_KINDS)[number];
77
+ export declare const QUANTUM_GATE_KINDS: readonly ["hadamard", "cnot", "qgate", "xgate", "ygate", "zgate", "sgate", "sdg", "tgate", "tdg", "sx", "phase", "rx", "ry", "rz", "ugate"];
36
78
  /** A supported native or polymorphic quantum gate keyword. */
37
79
  export type QuantumGateKind = (typeof QUANTUM_GATE_KINDS)[number];
38
80
  /** First-class UML node keywords spanning structural and behavioral diagrams. */
39
- export declare const UML_COMPONENT_KINDS: readonly ["class", "actor", "usecase", "state", "lifeline", "note", "package", "initial", "final"];
81
+ export declare const UML_COMPONENT_KINDS: readonly ["class", "interface", "provided-interface", "required-interface", "enumeration", "datatype", "object", "component", "component-port", "artifact", "node", "device", "execution", "system", "actor", "usecase", "state", "lifeline", "action", "decision", "merge", "fork", "join", "activity-final", "flow-final", "object-node", "send-signal", "receive-signal", "partition", "activation", "destruction", "fragment", "interaction", "gate", "found", "lost", "choice", "state-junction", "history", "entry", "exit", "terminate", "region", "note", "package", "initial", "final"];
40
82
  /** A supported UML node keyword. */
41
83
  export type UmlComponentKind = (typeof UML_COMPONENT_KINDS)[number];
42
84
  /** Complete, collision-free component keyword registry. */
43
- export declare const COMPONENT_KINDS: readonly ["resistor", "capacitor", "inductor", "diode", "transistor", "port", "ground", "nand", "nor", "xor", "and", "or", "not", "hadamard", "cnot", "qgate", "class", "actor", "usecase", "state", "lifeline", "note", "package", "initial", "final", "ic"];
85
+ export declare const COMPONENT_KINDS: readonly ["resistor", "capacitor", "inductor", "diode", "transistor", "port", "ground", "source", "junction", "testpoint", "connector", "power", "switch", "protection", "amplifier", "resonator", "meter", "load", "nand", "nor", "xor", "xnor", "and", "or", "not", "buffer", "logic", "clock", "flipflop", "mux", "encoder", "decoder", "register", "counter", "adder", "comparator", "bus", "hadamard", "cnot", "qgate", "xgate", "ygate", "zgate", "sgate", "sdg", "tgate", "tdg", "sx", "phase", "rx", "ry", "rz", "ugate", "measure", "reset", "prepare", "swap", "control", "cz", "cphase", "toffoli", "controlled", "barrier", "delay", "classical-bit", "classical-register", "class", "interface", "provided-interface", "required-interface", "enumeration", "datatype", "object", "component", "component-port", "artifact", "node", "device", "execution", "system", "actor", "usecase", "state", "lifeline", "action", "decision", "merge", "fork", "join", "activity-final", "flow-final", "object-node", "send-signal", "receive-signal", "partition", "activation", "destruction", "fragment", "interaction", "gate", "found", "lost", "choice", "state-junction", "history", "entry", "exit", "terminate", "region", "note", "package", "initial", "final", "ic"];
44
86
  /** Any component keyword that can begin a declaration. */
45
87
  export type ComponentKind = (typeof COMPONENT_KINDS)[number];
46
88
  /** Built-in semantic color tokens that hosts can theme through CSS. */
@@ -85,6 +127,12 @@ export interface SchematicPoint {
85
127
  /** Vertical coordinate. */
86
128
  y: number;
87
129
  }
130
+ /** Author-facing quarter-turn orientations for direction-sensitive components. */
131
+ export declare const SCHEMATIC_ORIENTATIONS: readonly ["right", "down", "left", "up"];
132
+ /** A direction-sensitive component's canonical quarter-turn orientation. */
133
+ export type SchematicOrientation = (typeof SCHEMATIC_ORIENTATIONS)[number];
134
+ /** Compact clockwise quarter-turn count used by exact layout arithmetic. */
135
+ export type SchematicQuarterTurn = 0 | 1 | 2 | 3;
88
136
  /** Shared immutable source metadata for every parsed component. */
89
137
  interface ComponentBase extends SchematicPoint {
90
138
  /** Document-unique component identifier used by connection endpoints. */
@@ -96,39 +144,56 @@ interface ComponentBase extends SchematicPoint {
96
144
  /** One-based source line used for deterministic diagnostics. */
97
145
  line: number;
98
146
  }
147
+ /** Shared metadata for symbols whose canonical geometry supports quarter turns. */
148
+ export interface DirectionalComponentBase extends ComponentBase {
149
+ /** Explicit orientation; absence preserves the legacy canonical direction. */
150
+ orientation?: SchematicOrientation;
151
+ }
99
152
  /** Parsed resistor, capacitor, or inductor component. */
100
- export interface PassiveComponent extends ComponentBase {
153
+ export interface PassiveComponent extends DirectionalComponentBase {
101
154
  /** Specific two-terminal passive kind. */
102
155
  kind: PassiveKind;
156
+ /** Non-default construction variant; absence means fixed. */
157
+ passiveType?: PassiveType;
103
158
  }
104
159
  /** Parsed diode with its selected physical symbol variant. */
105
- export interface DiodeComponent extends ComponentBase {
160
+ export interface DiodeComponent extends DirectionalComponentBase {
106
161
  /** Discriminant for diode components. */
107
162
  kind: 'diode';
108
163
  /** Standard, Schottky, Zener, or LED vector treatment. */
109
164
  diodeType: DiodeType;
110
165
  }
111
166
  /** Parsed bipolar or field-effect transistor. */
112
- export interface TransistorComponent extends ComponentBase {
167
+ export interface TransistorComponent extends DirectionalComponentBase {
113
168
  /** Discriminant for transistor components. */
114
169
  kind: 'transistor';
115
170
  /** Electrical device family and polarity. */
116
171
  transistorType: TransistorType;
117
172
  }
118
173
  /** Parsed system-boundary input/output terminal. */
119
- export interface PortComponent extends ComponentBase {
174
+ export interface PortComponent extends DirectionalComponentBase {
120
175
  /** Discriminant for boundary ports. */
121
176
  kind: 'port';
177
+ /** Optional bus width; absence is a scalar port. */
178
+ width?: number;
122
179
  }
123
180
  /** Parsed zero-volt reference symbol. */
124
- export interface GroundComponent extends ComponentBase {
181
+ export interface GroundComponent extends DirectionalComponentBase {
125
182
  /** Discriminant for ground references. */
126
183
  kind: 'ground';
127
184
  /** Chassis, earth, or signal-ground visual form. */
128
185
  groundStyle: GroundStyle;
129
186
  }
187
+ /** Variant value accepted by one of the compact electrical symbol families. */
188
+ export type ElectricalVariant = SourceType | PowerType | SwitchType | ProtectionType | AmplifierType | ResonatorType | MeterType | LoadType;
189
+ /** Parsed source, switch, functional block, load, or electrical node. */
190
+ export interface ElectricalComponent extends DirectionalComponentBase {
191
+ kind: ElectricalComponentKind;
192
+ /** Family-specific validated variant; absent only for junction/testpoint/connector. */
193
+ variant?: ElectricalVariant;
194
+ }
130
195
  /** Parsed IEEE- or IEC-style classical logic gate. */
131
- export interface ClassicalGateComponent extends ComponentBase {
196
+ export interface ClassicalGateComponent extends DirectionalComponentBase {
132
197
  /** Logic operation represented by the gate. */
133
198
  kind: ClassicalGateKind;
134
199
  /** Validated number of addressable input pins, from 1 through 32. */
@@ -138,8 +203,23 @@ export interface ClassicalGateComponent extends ComponentBase {
138
203
  /** Symbol convention used when generating the gate contour. */
139
204
  standard: 'ieee' | 'iec';
140
205
  }
206
+ /** Compact digital block normalized from storage, selection, arithmetic, and bus keywords. */
207
+ export interface DigitalComponent extends DirectionalComponentBase {
208
+ kind: DigitalComponentKind;
209
+ /** Family-specific variant such as tristate, D flip-flop, or splitter. */
210
+ variant?: BufferType | LogicState | FlipFlopType | MuxType | AdderType | BusType;
211
+ /** Validated logical input count. */
212
+ inputs: number;
213
+ /** Validated logical output count. */
214
+ outputs: number;
215
+ /** Scalar width or bus width represented by relevant terminals. */
216
+ width: number;
217
+ /** Deterministic body dimensions used by ports, obstacles, and SVG generation. */
218
+ bodyWidth: number;
219
+ bodyHeight: number;
220
+ }
141
221
  /** Parsed native or user-labelled quantum operator. */
142
- export interface QuantumGateComponent extends ComponentBase {
222
+ export interface QuantumGateComponent extends DirectionalComponentBase {
143
223
  /** Quantum operator family. */
144
224
  kind: QuantumGateKind;
145
225
  /** Optional operator parameter rendered through the micro-math pipeline. */
@@ -149,6 +229,22 @@ export interface QuantumGateComponent extends ComponentBase {
149
229
  /** Optional phase expression. */
150
230
  phase?: string;
151
231
  }
232
+ /** Non-unitary, multi-wire, control, timing, or classical quantum-circuit primitive. */
233
+ export interface QuantumSpecialComponent extends DirectionalComponentBase {
234
+ kind: QuantumSpecialKind;
235
+ /** Positive or negative standalone/embedded control marker. */
236
+ controlType?: 'positive' | 'negative' | 'classical';
237
+ /** Operator rendered at the target of a generalized controlled gate. */
238
+ operator?: string;
239
+ /** Number of control tracks. */
240
+ controls: number;
241
+ /** Number of target tracks. */
242
+ targets: number;
243
+ /** Total parallel tracks accepted by barriers, delays, and registers. */
244
+ wires: number;
245
+ /** Classical register width, or one for scalar quantum/classical nodes. */
246
+ width: number;
247
+ }
152
248
  /** Pin names registered on each side of a polymorphic integrated circuit. */
153
249
  export interface IntegratedCircuitPins {
154
250
  /** Pins distributed from top to bottom on the left edge. */
@@ -161,7 +257,7 @@ export interface IntegratedCircuitPins {
161
257
  bottom: readonly string[];
162
258
  }
163
259
  /** Parsed custom multi-terminal integrated-circuit block. */
164
- export interface IcComponent extends ComponentBase {
260
+ export interface IcComponent extends DirectionalComponentBase {
165
261
  /** Discriminant for custom integrated circuits and architecture blocks. */
166
262
  kind: 'ic';
167
263
  /** Addressable, side-aware pin registry. */
@@ -176,7 +272,7 @@ export type IntegratedCircuitComponent = IcComponent;
176
272
  /** Parsed UML class with independently sized attribute and operation compartments. */
177
273
  export interface UmlClassComponent extends ComponentBase {
178
274
  /** UML class node discriminant. */
179
- kind: 'class';
275
+ kind: 'class' | 'interface' | 'enumeration' | 'datatype' | 'object';
180
276
  /** Optional stereotype displayed above the class name. */
181
277
  stereotype?: string;
182
278
  /** Attribute declarations in source order. */
@@ -198,7 +294,7 @@ export interface UmlStateComponent extends ComponentBase {
198
294
  }
199
295
  /** Parsed UML ellipse, note, package, or sequence lifeline. */
200
296
  export interface UmlSizedComponent extends ComponentBase {
201
- kind: 'usecase' | 'lifeline' | 'note' | 'package';
297
+ kind: 'usecase' | 'lifeline' | 'note' | 'package' | 'component' | 'artifact' | 'node' | 'device' | 'execution' | 'system' | 'action' | 'object-node' | 'partition' | 'activation' | 'fragment' | 'interaction' | 'region';
202
298
  bodyWidth: number;
203
299
  bodyHeight: number;
204
300
  }
@@ -208,18 +304,23 @@ export interface UmlActorComponent extends ComponentBase {
208
304
  }
209
305
  /** Parsed UML initial or final pseudostate. */
210
306
  export interface UmlPseudostateComponent extends ComponentBase {
211
- kind: 'initial' | 'final';
307
+ kind: 'initial' | 'final' | 'provided-interface' | 'required-interface' | 'component-port' | 'decision' | 'merge' | 'fork' | 'join' | 'activity-final' | 'flow-final' | 'send-signal' | 'receive-signal' | 'destruction' | 'gate' | 'found' | 'lost' | 'choice' | 'state-junction' | 'history' | 'entry' | 'exit' | 'terminate';
308
+ /** History depth; present only on history pseudostates. */
309
+ variant?: 'shallow' | 'deep';
212
310
  }
213
311
  /** Every UML component accepted by the compiler. */
214
312
  export type UmlComponent = UmlClassComponent | UmlStateComponent | UmlSizedComponent | UmlActorComponent | UmlPseudostateComponent;
215
313
  /** Discriminated union of every component node accepted by the renderer. */
216
- export type SchematicComponent = PassiveComponent | DiodeComponent | TransistorComponent | PortComponent | GroundComponent | ClassicalGateComponent | QuantumGateComponent | IcComponent | UmlComponent;
314
+ export type SchematicComponent = PassiveComponent | DiodeComponent | TransistorComponent | PortComponent | GroundComponent | ElectricalComponent | ClassicalGateComponent | DigitalComponent | QuantumGateComponent | QuantumSpecialComponent | IcComponent | UmlComponent;
217
315
  /** UML relationship semantics used to derive line style and endpoint markers. */
218
- export declare const UML_RELATION_KINDS: readonly ["association", "dependency", "generalization", "realization", "aggregation", "composition", "message", "transition", "include", "extend"];
316
+ export declare const UML_RELATION_KINDS: readonly ["association", "dependency", "generalization", "realization", "aggregation", "composition", "message", "synchronous", "asynchronous", "return", "control-flow", "object-flow", "assembly", "delegation", "transition", "include", "extend"];
219
317
  /** A supported UML relationship. */
220
318
  export type UmlRelationKind = (typeof UML_RELATION_KINDS)[number];
221
319
  /** Electrical signal or a first-class UML relationship. */
222
320
  export type SchematicRelationKind = 'signal' | UmlRelationKind;
321
+ /** Physical/semantic channel carried by a signal connection. */
322
+ export declare const SCHEMATIC_SIGNAL_KINDS: readonly ["electrical", "digital", "quantum", "classical"];
323
+ export type SchematicSignalKind = (typeof SCHEMATIC_SIGNAL_KINDS)[number];
223
324
  /** Address of one component terminal in a connection declaration. */
224
325
  export interface SchematicEndpoint {
225
326
  /** Document-local component identifier. */
@@ -243,6 +344,10 @@ export interface SchematicConnection {
243
344
  markerEnd: SchematicSignalMarker;
244
345
  /** Electrical or UML relationship semantics. */
245
346
  relation?: SchematicRelationKind;
347
+ /** Non-default signal domain; absence preserves legacy electrical behavior. */
348
+ signalKind?: SchematicSignalKind;
349
+ /** Validated bus/register width; absence denotes a scalar connection. */
350
+ width?: number;
246
351
  /** Optional text centered beside the routed connector. */
247
352
  label?: string;
248
353
  /** Whether the trace uses the UML dependency dash pattern. */
package/dist/types.js CHANGED
@@ -1,16 +1,167 @@
1
1
  export const PASSIVE_KINDS = ['resistor', 'capacitor', 'inductor'];
2
+ export const PASSIVE_TYPES = [
3
+ 'fixed',
4
+ 'variable',
5
+ 'rheostat',
6
+ 'potentiometer',
7
+ 'thermistor',
8
+ 'ldr',
9
+ 'polarized',
10
+ 'coupled',
11
+ 'transformer'
12
+ ];
2
13
  export const ANALOG_KINDS = ['diode', 'transistor', 'port', 'ground'];
3
- export const DIODE_TYPES = ['standard', 'schottky', 'zener', 'led'];
4
- export const TRANSISTOR_TYPES = ['npn', 'pnp', 'nmos', 'pmos'];
14
+ export const DIODE_TYPES = [
15
+ 'standard',
16
+ 'schottky',
17
+ 'zener',
18
+ 'led',
19
+ 'photodiode',
20
+ 'varactor',
21
+ 'scr',
22
+ 'triac'
23
+ ];
24
+ export const TRANSISTOR_TYPES = ['npn', 'pnp', 'nmos', 'pmos', 'njfet', 'pjfet', 'nigbt', 'pigbt'];
5
25
  export const GROUND_STYLES = ['chassis', 'earth', 'signal'];
6
- export const CLASSICAL_GATE_KINDS = ['nand', 'nor', 'xor', 'and', 'or', 'not'];
7
- export const QUANTUM_GATE_KINDS = ['hadamard', 'cnot', 'qgate'];
26
+ export const ELECTRICAL_COMPONENT_KINDS = [
27
+ 'source',
28
+ 'junction',
29
+ 'testpoint',
30
+ 'connector',
31
+ 'power',
32
+ 'switch',
33
+ 'protection',
34
+ 'amplifier',
35
+ 'resonator',
36
+ 'meter',
37
+ 'load'
38
+ ];
39
+ export const SOURCE_TYPES = [
40
+ 'voltage-dc',
41
+ 'voltage-ac',
42
+ 'voltage-pulse',
43
+ 'current-dc',
44
+ 'current-ac',
45
+ 'battery',
46
+ 'vcvs',
47
+ 'vccs',
48
+ 'ccvs',
49
+ 'cccs'
50
+ ];
51
+ export const POWER_TYPES = ['vcc', 'vdd', 'vss', 'positive', 'negative'];
52
+ export const SWITCH_TYPES = ['spst', 'spdt', 'pushbutton', 'relay'];
53
+ export const PROTECTION_TYPES = ['fuse', 'breaker'];
54
+ export const AMPLIFIER_TYPES = ['opamp', 'comparator', 'instrumentation'];
55
+ export const RESONATOR_TYPES = ['crystal', 'ceramic'];
56
+ export const METER_TYPES = ['voltmeter', 'ammeter'];
57
+ export const LOAD_TYPES = ['lamp', 'motor', 'speaker', 'buzzer'];
58
+ export const CLASSICAL_GATE_KINDS = ['nand', 'nor', 'xor', 'xnor', 'and', 'or', 'not'];
59
+ export const DIGITAL_COMPONENT_KINDS = [
60
+ 'buffer',
61
+ 'logic',
62
+ 'clock',
63
+ 'flipflop',
64
+ 'mux',
65
+ 'encoder',
66
+ 'decoder',
67
+ 'register',
68
+ 'counter',
69
+ 'adder',
70
+ 'comparator',
71
+ 'bus'
72
+ ];
73
+ export const BUFFER_TYPES = [
74
+ 'plain',
75
+ 'tristate',
76
+ 'tristate-inverter',
77
+ 'schmitt',
78
+ 'schmitt-inverter'
79
+ ];
80
+ export const LOGIC_STATES = ['high', 'low', 'unknown', 'high-z'];
81
+ export const FLIPFLOP_TYPES = ['sr-latch', 'd-latch', 'd', 'jk', 't'];
82
+ export const MUX_TYPES = ['mux', 'demux'];
83
+ export const ADDER_TYPES = ['half', 'full'];
84
+ export const BUS_TYPES = ['tap', 'splitter', 'joiner'];
85
+ export const NAMED_QUANTUM_GATE_KINDS = [
86
+ 'xgate',
87
+ 'ygate',
88
+ 'zgate',
89
+ 'sgate',
90
+ 'sdg',
91
+ 'tgate',
92
+ 'tdg',
93
+ 'sx',
94
+ 'phase',
95
+ 'rx',
96
+ 'ry',
97
+ 'rz',
98
+ 'ugate'
99
+ ];
100
+ export const QUANTUM_SPECIAL_KINDS = [
101
+ 'measure',
102
+ 'reset',
103
+ 'prepare',
104
+ 'swap',
105
+ 'control',
106
+ 'cz',
107
+ 'cphase',
108
+ 'toffoli',
109
+ 'controlled',
110
+ 'barrier',
111
+ 'delay',
112
+ 'classical-bit',
113
+ 'classical-register'
114
+ ];
115
+ export const QUANTUM_GATE_KINDS = [
116
+ 'hadamard',
117
+ 'cnot',
118
+ 'qgate',
119
+ ...NAMED_QUANTUM_GATE_KINDS
120
+ ];
8
121
  export const UML_COMPONENT_KINDS = [
9
122
  'class',
123
+ 'interface',
124
+ 'provided-interface',
125
+ 'required-interface',
126
+ 'enumeration',
127
+ 'datatype',
128
+ 'object',
129
+ 'component',
130
+ 'component-port',
131
+ 'artifact',
132
+ 'node',
133
+ 'device',
134
+ 'execution',
135
+ 'system',
10
136
  'actor',
11
137
  'usecase',
12
138
  'state',
13
139
  'lifeline',
140
+ 'action',
141
+ 'decision',
142
+ 'merge',
143
+ 'fork',
144
+ 'join',
145
+ 'activity-final',
146
+ 'flow-final',
147
+ 'object-node',
148
+ 'send-signal',
149
+ 'receive-signal',
150
+ 'partition',
151
+ 'activation',
152
+ 'destruction',
153
+ 'fragment',
154
+ 'interaction',
155
+ 'gate',
156
+ 'found',
157
+ 'lost',
158
+ 'choice',
159
+ 'state-junction',
160
+ 'history',
161
+ 'entry',
162
+ 'exit',
163
+ 'terminate',
164
+ 'region',
14
165
  'note',
15
166
  'package',
16
167
  'initial',
@@ -19,12 +170,16 @@ export const UML_COMPONENT_KINDS = [
19
170
  export const COMPONENT_KINDS = [
20
171
  ...PASSIVE_KINDS,
21
172
  ...ANALOG_KINDS,
173
+ ...ELECTRICAL_COMPONENT_KINDS,
22
174
  ...CLASSICAL_GATE_KINDS,
175
+ ...DIGITAL_COMPONENT_KINDS,
23
176
  ...QUANTUM_GATE_KINDS,
177
+ ...QUANTUM_SPECIAL_KINDS,
24
178
  ...UML_COMPONENT_KINDS,
25
179
  'ic'
26
180
  ];
27
181
  export const SEMANTIC_COLORS = ['amber', 'blue', 'cyan', 'purple', 'slate', 'emerald'];
182
+ export const SCHEMATIC_ORIENTATIONS = ['right', 'down', 'left', 'up'];
28
183
  export const UML_RELATION_KINDS = [
29
184
  'association',
30
185
  'dependency',
@@ -33,10 +188,18 @@ export const UML_RELATION_KINDS = [
33
188
  'aggregation',
34
189
  'composition',
35
190
  'message',
191
+ 'synchronous',
192
+ 'asynchronous',
193
+ 'return',
194
+ 'control-flow',
195
+ 'object-flow',
196
+ 'assembly',
197
+ 'delegation',
36
198
  'transition',
37
199
  'include',
38
200
  'extend'
39
201
  ];
202
+ export const SCHEMATIC_SIGNAL_KINDS = ['electrical', 'digital', 'quantum', 'classical'];
40
203
  export const SCHEMD_OUTPUT_MODES = ['default', 'embedded-css', 'full'];
41
204
  export const SCHEMD_SEMANTIC_HOOKS = ['nodes', 'ports', 'wires'];
42
205
  export const SCHEMATIC_SIGNAL_MARKERS = [
package/package.json CHANGED
@@ -1,80 +1,85 @@
1
1
  {
2
- "name": "@schemd/core",
3
- "version": "0.2.1",
4
- "description": "Zero-dependency text-to-SVG compiler for schematics and UML.",
5
- "homepage": "https://johnowolabiidogun.dev/tools/schemd",
6
- "bugs": {
7
- "url": "https://github.com/Sirneij/schemd/issues"
8
- },
9
- "repository": {
10
- "type": "git",
11
- "url": "git+https://github.com/Sirneij/schemd.git"
12
- },
13
- "type": "module",
14
- "sideEffects": false,
15
- "browser": false,
16
- "main": "./dist/index.js",
17
- "types": "./dist/index.d.ts",
18
- "files": [
19
- "dist",
20
- "README.md",
21
- "assets/brand/schemd-logo.svg",
22
- "assets/brand/schemd-mark.svg"
23
- ],
24
- "exports": {
25
- ".": {
26
- "types": "./dist/index.d.ts",
27
- "import": "./dist/index.js"
28
- },
29
- "./parser": {
30
- "types": "./dist/parser.d.ts",
31
- "import": "./dist/parser.js"
32
- },
33
- "./renderer": {
34
- "types": "./dist/renderer.d.ts",
35
- "import": "./dist/renderer.js"
36
- },
37
- "./compiler": {
38
- "types": "./dist/compiler.d.ts",
39
- "import": "./dist/compiler.js"
40
- },
41
- "./layout": {
42
- "types": "./dist/layout.d.ts",
43
- "import": "./dist/layout.js"
44
- },
45
- "./math-label": {
46
- "types": "./dist/math-label.d.ts",
47
- "import": "./dist/math-label.js"
48
- },
49
- "./types": {
50
- "types": "./dist/types.d.ts",
51
- "import": "./dist/types.js"
52
- }
53
- },
54
- "scripts": {
55
- "build": "node -e \"require('node:fs').rmSync('dist',{ recursive: true, force: true })\" && tsc -p tsconfig.build.json && tsc -p tsconfig.types.json",
56
- "check": "tsc -p tsconfig.json --noEmit",
57
- "prepack": "npm run build",
58
- "size": "node scripts/check-bundle-size.mjs",
59
- "test": "vitest run",
60
- "test:coverage": "vitest run --coverage"
61
- },
62
- "devDependencies": {
63
- "@vitest/coverage-v8": "^4.1.10",
64
- "typescript": "^6.0.3",
65
- "vite": "^8.1.4",
66
- "vitest": "^4.1.10"
67
- },
68
- "engines": {
69
- "node": ">=24"
70
- },
71
- "keywords": [
72
- "schemd",
73
- "schematic",
74
- "svg",
75
- "compiler",
76
- "engineering",
77
- "uml"
78
- ],
79
- "license": "MIT"
2
+ "name": "@schemd/core",
3
+ "version": "0.3.1",
4
+ "description": "Zero-dependency text-to-SVG compiler for schematics and UML.",
5
+ "homepage": "https://schemd.johnowolabiidogun.dev",
6
+ "bugs": {
7
+ "url": "https://github.com/schemd/core/issues"
8
+ },
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/schemd/core.git"
12
+ },
13
+ "author": {
14
+ "name": "John Owolabi Idogun",
15
+ "url": "https://www.johnowolabiidogun.dev"
16
+ },
17
+ "packageManager": "bun@1.3.14",
18
+ "type": "module",
19
+ "sideEffects": false,
20
+ "browser": false,
21
+ "main": "./dist/index.js",
22
+ "types": "./dist/index.d.ts",
23
+ "files": [
24
+ "dist",
25
+ "README.md",
26
+ "CHANGELOG.md"
27
+ ],
28
+ "exports": {
29
+ ".": {
30
+ "types": "./dist/index.d.ts",
31
+ "import": "./dist/index.js"
32
+ },
33
+ "./parser": {
34
+ "types": "./dist/parser.d.ts",
35
+ "import": "./dist/parser.js"
36
+ },
37
+ "./renderer": {
38
+ "types": "./dist/renderer.d.ts",
39
+ "import": "./dist/renderer.js"
40
+ },
41
+ "./compiler": {
42
+ "types": "./dist/compiler.d.ts",
43
+ "import": "./dist/compiler.js"
44
+ },
45
+ "./layout": {
46
+ "types": "./dist/layout.d.ts",
47
+ "import": "./dist/layout.js"
48
+ },
49
+ "./math-label": {
50
+ "types": "./dist/math-label.d.ts",
51
+ "import": "./dist/math-label.js"
52
+ },
53
+ "./types": {
54
+ "types": "./dist/types.d.ts",
55
+ "import": "./dist/types.js"
56
+ }
57
+ },
58
+ "scripts": {
59
+ "build": "node -e \"require('node:fs').rmSync('dist',{ recursive: true, force: true })\" && tsc -p tsconfig.build.json && tsc -p tsconfig.types.json",
60
+ "benchmark": "bun run build && node scripts/benchmark.mjs",
61
+ "check": "tsc -p tsconfig.json --noEmit",
62
+ "prepack": "bun run build",
63
+ "size": "node scripts/check-bundle-size.mjs",
64
+ "test": "vitest run",
65
+ "test:coverage": "vitest run --coverage"
66
+ },
67
+ "devDependencies": {
68
+ "@vitest/coverage-v8": "^4.1.10",
69
+ "typescript": "^6.0.3",
70
+ "vite": "^8.1.4",
71
+ "vitest": "^4.1.10"
72
+ },
73
+ "engines": {
74
+ "node": ">=24"
75
+ },
76
+ "keywords": [
77
+ "schemd",
78
+ "schematic",
79
+ "svg",
80
+ "compiler",
81
+ "engineering",
82
+ "uml"
83
+ ],
84
+ "license": "MIT"
80
85
  }