@tscircuit/core 0.0.1000 → 0.0.1002
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/index.d.ts +14 -2
- package/dist/index.js +33 -3
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -168,9 +168,9 @@ interface IRootCircuit {
|
|
|
168
168
|
_hasIncompleteAsyncEffectsForPhase(phase: RenderPhase): boolean;
|
|
169
169
|
}
|
|
170
170
|
|
|
171
|
-
declare const orderedRenderPhases: readonly ["ReactSubtreesRender", "InflateSubcircuitCircuitJson", "SourceNameDuplicateComponentRemoval", "PcbFootprintStringRender", "InitializePortsFromChildren", "CreateNetsFromProps", "AssignFallbackProps", "CreateTracesFromProps", "CreateTracesFromNetLabels", "CreateTraceHintsFromProps", "SourceGroupRender", "AssignNameToUnnamedComponents", "SourceRender", "SourceParentAttachment", "PortMatching", "OptimizeSelectorCache", "SourceTraceRender", "SourceAddConnectivityMapKey", "SourceDesignRuleChecks", "SimulationRender", "SchematicComponentRender", "SchematicPortRender", "SchematicPrimitiveRender", "SchematicSymbolResize", "SchematicComponentSizeCalculation", "SchematicLayout", "SchematicTraceRender", "SchematicReplaceNetLabelsWithSymbols", "PanelBoardLayout", "PcbComponentRender", "PcbPrimitiveRender", "PcbFootprintLayout", "PcbPortRender", "PcbPortAttachment", "PcbComponentSizeCalculation", "PcbComponentAnchorAlignment", "PcbLayout", "PcbBoardAutoSize", "PanelLayout", "PcbTraceHintRender", "PcbManualTraceRender", "PcbTraceRender", "PcbRouteNetIslands", "PcbCopperPourRender", "PcbDesignRuleChecks", "SilkscreenOverlapAdjustment", "CadModelRender", "PartsEngineRender", "SimulationSpiceEngineRender"];
|
|
171
|
+
declare const orderedRenderPhases: readonly ["ReactSubtreesRender", "InflateSubcircuitCircuitJson", "SourceNameDuplicateComponentRemoval", "PcbFootprintStringRender", "InitializePortsFromChildren", "CreateNetsFromProps", "AssignFallbackProps", "CreateTracesFromProps", "CreateTracesFromNetLabels", "CreateTraceHintsFromProps", "SourceGroupRender", "AssignNameToUnnamedComponents", "SourceRender", "SourceParentAttachment", "PortMatching", "OptimizeSelectorCache", "SourceTraceRender", "SourceAddConnectivityMapKey", "SourceDesignRuleChecks", "SimulationRender", "SchematicComponentRender", "SchematicPortRender", "SymbolContainerRender", "SchematicPrimitiveRender", "SchematicSymbolResize", "SchematicComponentSizeCalculation", "SchematicLayout", "SchematicTraceRender", "SchematicReplaceNetLabelsWithSymbols", "PanelBoardLayout", "PcbComponentRender", "PcbPrimitiveRender", "PcbFootprintLayout", "PcbPortRender", "PcbPortAttachment", "PcbComponentSizeCalculation", "PcbComponentAnchorAlignment", "PcbLayout", "PcbBoardAutoSize", "PanelLayout", "PcbTraceHintRender", "PcbManualTraceRender", "PcbTraceRender", "PcbRouteNetIslands", "PcbCopperPourRender", "PcbDesignRuleChecks", "SilkscreenOverlapAdjustment", "CadModelRender", "PartsEngineRender", "SimulationSpiceEngineRender"];
|
|
172
172
|
type RenderPhase = (typeof orderedRenderPhases)[number];
|
|
173
|
-
declare const renderPhaseIndexMap: Map<"ReactSubtreesRender" | "InflateSubcircuitCircuitJson" | "SourceNameDuplicateComponentRemoval" | "PcbFootprintStringRender" | "InitializePortsFromChildren" | "CreateNetsFromProps" | "AssignFallbackProps" | "CreateTracesFromProps" | "CreateTracesFromNetLabels" | "CreateTraceHintsFromProps" | "SourceGroupRender" | "AssignNameToUnnamedComponents" | "SourceRender" | "SourceParentAttachment" | "PortMatching" | "OptimizeSelectorCache" | "SourceTraceRender" | "SourceAddConnectivityMapKey" | "SourceDesignRuleChecks" | "SimulationRender" | "SchematicComponentRender" | "SchematicPortRender" | "SchematicPrimitiveRender" | "SchematicSymbolResize" | "SchematicComponentSizeCalculation" | "SchematicLayout" | "SchematicTraceRender" | "SchematicReplaceNetLabelsWithSymbols" | "PanelBoardLayout" | "PcbComponentRender" | "PcbPrimitiveRender" | "PcbFootprintLayout" | "PcbPortRender" | "PcbPortAttachment" | "PcbComponentSizeCalculation" | "PcbComponentAnchorAlignment" | "PcbLayout" | "PcbBoardAutoSize" | "PanelLayout" | "PcbTraceHintRender" | "PcbManualTraceRender" | "PcbTraceRender" | "PcbRouteNetIslands" | "PcbCopperPourRender" | "PcbDesignRuleChecks" | "SilkscreenOverlapAdjustment" | "CadModelRender" | "PartsEngineRender" | "SimulationSpiceEngineRender", number>;
|
|
173
|
+
declare const renderPhaseIndexMap: Map<"ReactSubtreesRender" | "InflateSubcircuitCircuitJson" | "SourceNameDuplicateComponentRemoval" | "PcbFootprintStringRender" | "InitializePortsFromChildren" | "CreateNetsFromProps" | "AssignFallbackProps" | "CreateTracesFromProps" | "CreateTracesFromNetLabels" | "CreateTraceHintsFromProps" | "SourceGroupRender" | "AssignNameToUnnamedComponents" | "SourceRender" | "SourceParentAttachment" | "PortMatching" | "OptimizeSelectorCache" | "SourceTraceRender" | "SourceAddConnectivityMapKey" | "SourceDesignRuleChecks" | "SimulationRender" | "SchematicComponentRender" | "SchematicPortRender" | "SymbolContainerRender" | "SchematicPrimitiveRender" | "SchematicSymbolResize" | "SchematicComponentSizeCalculation" | "SchematicLayout" | "SchematicTraceRender" | "SchematicReplaceNetLabelsWithSymbols" | "PanelBoardLayout" | "PcbComponentRender" | "PcbPrimitiveRender" | "PcbFootprintLayout" | "PcbPortRender" | "PcbPortAttachment" | "PcbComponentSizeCalculation" | "PcbComponentAnchorAlignment" | "PcbLayout" | "PcbBoardAutoSize" | "PanelLayout" | "PcbTraceHintRender" | "PcbManualTraceRender" | "PcbTraceRender" | "PcbRouteNetIslands" | "PcbCopperPourRender" | "PcbDesignRuleChecks" | "SilkscreenOverlapAdjustment" | "CadModelRender" | "PartsEngineRender" | "SimulationSpiceEngineRender", number>;
|
|
174
174
|
type RenderPhaseFn<K extends RenderPhase = RenderPhase> = `doInitial${K}` | `update${K}` | `remove${K}`;
|
|
175
175
|
type RenderPhaseStates = Record<RenderPhase, {
|
|
176
176
|
initialized: boolean;
|
|
@@ -380,6 +380,11 @@ interface SchematicSymbolBounds {
|
|
|
380
380
|
maxY: number;
|
|
381
381
|
}
|
|
382
382
|
interface ISymbol {
|
|
383
|
+
/**
|
|
384
|
+
* The circuit-json schematic_symbol_id for this symbol.
|
|
385
|
+
* Created during SchematicPrimitiveRender phase.
|
|
386
|
+
*/
|
|
387
|
+
schematic_symbol_id?: string;
|
|
383
388
|
/**
|
|
384
389
|
* The transformation matrix to convert from user coordinates (as specified
|
|
385
390
|
* in the symbol's children) to the final resized symbol coordinates.
|
|
@@ -125126,6 +125131,7 @@ declare class SchematicCell extends PrimitiveComponent<typeof schematicCellProps
|
|
|
125126
125131
|
|
|
125127
125132
|
declare class SymbolComponent extends PrimitiveComponent<typeof symbolProps> implements ISymbol {
|
|
125128
125133
|
isPrimitiveContainer: boolean;
|
|
125134
|
+
schematic_symbol_id?: string;
|
|
125129
125135
|
userCoordinateToResizedSymbolTransformMat?: Matrix;
|
|
125130
125136
|
schematicSymbolBoundsInUserCoordinates?: SchematicSymbolBounds;
|
|
125131
125137
|
get config(): {
|
|
@@ -125148,6 +125154,12 @@ declare class SymbolComponent extends PrimitiveComponent<typeof symbolProps> imp
|
|
|
125148
125154
|
}>;
|
|
125149
125155
|
};
|
|
125150
125156
|
hasExplicitSize(): boolean;
|
|
125157
|
+
/**
|
|
125158
|
+
* Create the schematic_symbol element in SymbolContainerRender phase.
|
|
125159
|
+
* This runs before SchematicPrimitiveRender, ensuring children can
|
|
125160
|
+
* reference the schematic_symbol_id when they render.
|
|
125161
|
+
*/
|
|
125162
|
+
doInitialSymbolContainerRender(): void;
|
|
125151
125163
|
getSchematicSymbolBounds(): SchematicSymbolBounds | null;
|
|
125152
125164
|
getUserCoordinateToResizedSymbolTransform(): Matrix | null;
|
|
125153
125165
|
private _computeSchematicSymbolBounds;
|
package/dist/index.js
CHANGED
|
@@ -135,6 +135,7 @@ var orderedRenderPhases = [
|
|
|
135
135
|
"SimulationRender",
|
|
136
136
|
"SchematicComponentRender",
|
|
137
137
|
"SchematicPortRender",
|
|
138
|
+
"SymbolContainerRender",
|
|
138
139
|
"SchematicPrimitiveRender",
|
|
139
140
|
"SchematicSymbolResize",
|
|
140
141
|
"SchematicComponentSizeCalculation",
|
|
@@ -19945,7 +19946,8 @@ var Potentiometer = class extends NormalComponent3 {
|
|
|
19945
19946
|
max_resistance: props.maxResistance,
|
|
19946
19947
|
pin_variant: pinVariant,
|
|
19947
19948
|
are_pins_interchangeable: pinVariant === "two_pin",
|
|
19948
|
-
display_name: props.displayName
|
|
19949
|
+
display_name: props.displayName,
|
|
19950
|
+
display_max_resistance: this._getSchematicSymbolDisplayValue()
|
|
19949
19951
|
});
|
|
19950
19952
|
this.source_component_id = source_component.source_component_id;
|
|
19951
19953
|
}
|
|
@@ -20352,7 +20354,9 @@ var SchematicText = class extends PrimitiveComponent2 {
|
|
|
20352
20354
|
const { db } = this.root;
|
|
20353
20355
|
const { _parsedProps: props } = this;
|
|
20354
20356
|
const globalPos = this._getGlobalSchematicPositionBeforeLayout();
|
|
20357
|
+
const schematic_symbol_id = this._getSymbolAncestor()?.schematic_symbol_id;
|
|
20355
20358
|
const schematic_text = db.schematic_text.insert({
|
|
20359
|
+
schematic_symbol_id,
|
|
20356
20360
|
anchor: props.anchor ?? "center",
|
|
20357
20361
|
text: normalizeTextForCircuitJson(props.text),
|
|
20358
20362
|
font_size: props.fontSize,
|
|
@@ -20399,8 +20403,10 @@ var SchematicLine = class extends PrimitiveComponent2 {
|
|
|
20399
20403
|
const { _parsedProps: props } = this;
|
|
20400
20404
|
const globalPos = this._getGlobalSchematicPositionBeforeLayout();
|
|
20401
20405
|
const schematic_component_id = this.getPrimitiveContainer()?.parent?.schematic_component_id;
|
|
20406
|
+
const schematic_symbol_id = this._getSymbolAncestor()?.schematic_symbol_id;
|
|
20402
20407
|
const schematic_line = db.schematic_line.insert({
|
|
20403
20408
|
schematic_component_id,
|
|
20409
|
+
schematic_symbol_id,
|
|
20404
20410
|
x1: props.x1 + globalPos.x,
|
|
20405
20411
|
y1: props.y1 + globalPos.y,
|
|
20406
20412
|
x2: props.x2 + globalPos.x,
|
|
@@ -20450,7 +20456,9 @@ var SchematicRect = class extends PrimitiveComponent2 {
|
|
|
20450
20456
|
const { _parsedProps: props } = this;
|
|
20451
20457
|
const globalPos = this._getGlobalSchematicPositionBeforeLayout();
|
|
20452
20458
|
const schematic_component_id = this.getPrimitiveContainer()?.parent?.schematic_component_id;
|
|
20459
|
+
const schematic_symbol_id = this._getSymbolAncestor()?.schematic_symbol_id;
|
|
20453
20460
|
const schematic_rect = db.schematic_rect.insert({
|
|
20461
|
+
schematic_symbol_id,
|
|
20454
20462
|
center: {
|
|
20455
20463
|
x: globalPos.x,
|
|
20456
20464
|
y: globalPos.y
|
|
@@ -20516,8 +20524,10 @@ var SchematicArc = class extends PrimitiveComponent2 {
|
|
|
20516
20524
|
const { _parsedProps: props } = this;
|
|
20517
20525
|
const globalPos = this._getGlobalSchematicPositionBeforeLayout();
|
|
20518
20526
|
const schematic_component_id = this.getPrimitiveContainer()?.parent?.schematic_component_id;
|
|
20527
|
+
const schematic_symbol_id = this._getSymbolAncestor()?.schematic_symbol_id;
|
|
20519
20528
|
const schematic_arc = db.schematic_arc.insert({
|
|
20520
20529
|
schematic_component_id,
|
|
20530
|
+
schematic_symbol_id,
|
|
20521
20531
|
center: {
|
|
20522
20532
|
x: props.center.x + globalPos.x,
|
|
20523
20533
|
y: props.center.y + globalPos.y
|
|
@@ -20573,8 +20583,10 @@ var SchematicCircle = class extends PrimitiveComponent2 {
|
|
|
20573
20583
|
const { _parsedProps: props } = this;
|
|
20574
20584
|
const globalPos = this._getGlobalSchematicPositionBeforeLayout();
|
|
20575
20585
|
const schematic_component_id = this.getPrimitiveContainer()?.parent?.schematic_component_id;
|
|
20586
|
+
const schematic_symbol_id = this._getSymbolAncestor()?.schematic_symbol_id;
|
|
20576
20587
|
const schematic_circle = db.schematic_circle.insert({
|
|
20577
20588
|
schematic_component_id,
|
|
20589
|
+
schematic_symbol_id,
|
|
20578
20590
|
center: {
|
|
20579
20591
|
x: props.center.x + globalPos.x,
|
|
20580
20592
|
y: props.center.y + globalPos.y
|
|
@@ -20759,6 +20771,7 @@ var SchematicPath = class extends PrimitiveComponent2 {
|
|
|
20759
20771
|
const { _parsedProps: props } = this;
|
|
20760
20772
|
const globalPos = this._getGlobalSchematicPositionBeforeLayout();
|
|
20761
20773
|
const schematic_component_id = this.getPrimitiveContainer()?.parent?.schematic_component_id;
|
|
20774
|
+
const schematic_symbol_id = this._getSymbolAncestor()?.schematic_symbol_id;
|
|
20762
20775
|
const subcircuit_id = this.getSubcircuit().subcircuit_id ?? void 0;
|
|
20763
20776
|
this.schematic_path_ids = [];
|
|
20764
20777
|
if (props.svgPath) {
|
|
@@ -20766,6 +20779,7 @@ var SchematicPath = class extends PrimitiveComponent2 {
|
|
|
20766
20779
|
for (const subpathPoints of subpaths) {
|
|
20767
20780
|
const schematic_path = db.schematic_path.insert({
|
|
20768
20781
|
schematic_component_id,
|
|
20782
|
+
schematic_symbol_id,
|
|
20769
20783
|
points: subpathPoints.map((point6) => ({
|
|
20770
20784
|
x: point6.x + globalPos.x,
|
|
20771
20785
|
y: point6.y + globalPos.y
|
|
@@ -20781,6 +20795,7 @@ var SchematicPath = class extends PrimitiveComponent2 {
|
|
|
20781
20795
|
} else if (props.points && props.points.length > 0) {
|
|
20782
20796
|
const schematic_path = db.schematic_path.insert({
|
|
20783
20797
|
schematic_component_id,
|
|
20798
|
+
schematic_symbol_id,
|
|
20784
20799
|
points: props.points.map((point6) => ({
|
|
20785
20800
|
x: point6.x + globalPos.x,
|
|
20786
20801
|
y: point6.y + globalPos.y
|
|
@@ -21170,6 +21185,7 @@ import { symbolProps } from "@tscircuit/props";
|
|
|
21170
21185
|
import { compose as compose7, translate as translate9, scale as scale2 } from "transformation-matrix";
|
|
21171
21186
|
var SymbolComponent = class extends PrimitiveComponent2 {
|
|
21172
21187
|
isPrimitiveContainer = true;
|
|
21188
|
+
schematic_symbol_id;
|
|
21173
21189
|
userCoordinateToResizedSymbolTransformMat;
|
|
21174
21190
|
schematicSymbolBoundsInUserCoordinates;
|
|
21175
21191
|
get config() {
|
|
@@ -21182,6 +21198,20 @@ var SymbolComponent = class extends PrimitiveComponent2 {
|
|
|
21182
21198
|
const { _parsedProps: props } = this;
|
|
21183
21199
|
return props.width !== void 0 || props.height !== void 0;
|
|
21184
21200
|
}
|
|
21201
|
+
/**
|
|
21202
|
+
* Create the schematic_symbol element in SymbolContainerRender phase.
|
|
21203
|
+
* This runs before SchematicPrimitiveRender, ensuring children can
|
|
21204
|
+
* reference the schematic_symbol_id when they render.
|
|
21205
|
+
*/
|
|
21206
|
+
doInitialSymbolContainerRender() {
|
|
21207
|
+
if (this.root?.schematicDisabled) return;
|
|
21208
|
+
const { db } = this.root;
|
|
21209
|
+
const { _parsedProps: props } = this;
|
|
21210
|
+
const schematic_symbol = db.schematic_symbol.insert({
|
|
21211
|
+
name: props.name
|
|
21212
|
+
});
|
|
21213
|
+
this.schematic_symbol_id = schematic_symbol.schematic_symbol_id;
|
|
21214
|
+
}
|
|
21185
21215
|
getSchematicSymbolBounds() {
|
|
21186
21216
|
if (this.schematicSymbolBoundsInUserCoordinates) {
|
|
21187
21217
|
return this.schematicSymbolBoundsInUserCoordinates;
|
|
@@ -21563,7 +21593,7 @@ import { identity as identity5 } from "transformation-matrix";
|
|
|
21563
21593
|
var package_default = {
|
|
21564
21594
|
name: "@tscircuit/core",
|
|
21565
21595
|
type: "module",
|
|
21566
|
-
version: "0.0.
|
|
21596
|
+
version: "0.0.1001",
|
|
21567
21597
|
types: "dist/index.d.ts",
|
|
21568
21598
|
main: "dist/index.js",
|
|
21569
21599
|
module: "dist/index.js",
|
|
@@ -21619,7 +21649,7 @@ var package_default = {
|
|
|
21619
21649
|
"bun-match-svg": "0.0.12",
|
|
21620
21650
|
"calculate-elbow": "^0.0.12",
|
|
21621
21651
|
"chokidar-cli": "^3.0.0",
|
|
21622
|
-
"circuit-json": "^0.0.
|
|
21652
|
+
"circuit-json": "^0.0.372",
|
|
21623
21653
|
"circuit-json-to-bpc": "^0.0.13",
|
|
21624
21654
|
"circuit-json-to-connectivity-map": "^0.0.23",
|
|
21625
21655
|
"circuit-json-to-gltf": "^0.0.62",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tscircuit/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.1002",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"bun-match-svg": "0.0.12",
|
|
58
58
|
"calculate-elbow": "^0.0.12",
|
|
59
59
|
"chokidar-cli": "^3.0.0",
|
|
60
|
-
"circuit-json": "^0.0.
|
|
60
|
+
"circuit-json": "^0.0.372",
|
|
61
61
|
"circuit-json-to-bpc": "^0.0.13",
|
|
62
62
|
"circuit-json-to-connectivity-map": "^0.0.23",
|
|
63
63
|
"circuit-json-to-gltf": "^0.0.62",
|