@tscircuit/core 0.0.1000 → 0.0.1001

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 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",
@@ -20352,7 +20353,9 @@ var SchematicText = class extends PrimitiveComponent2 {
20352
20353
  const { db } = this.root;
20353
20354
  const { _parsedProps: props } = this;
20354
20355
  const globalPos = this._getGlobalSchematicPositionBeforeLayout();
20356
+ const schematic_symbol_id = this._getSymbolAncestor()?.schematic_symbol_id;
20355
20357
  const schematic_text = db.schematic_text.insert({
20358
+ schematic_symbol_id,
20356
20359
  anchor: props.anchor ?? "center",
20357
20360
  text: normalizeTextForCircuitJson(props.text),
20358
20361
  font_size: props.fontSize,
@@ -20399,8 +20402,10 @@ var SchematicLine = class extends PrimitiveComponent2 {
20399
20402
  const { _parsedProps: props } = this;
20400
20403
  const globalPos = this._getGlobalSchematicPositionBeforeLayout();
20401
20404
  const schematic_component_id = this.getPrimitiveContainer()?.parent?.schematic_component_id;
20405
+ const schematic_symbol_id = this._getSymbolAncestor()?.schematic_symbol_id;
20402
20406
  const schematic_line = db.schematic_line.insert({
20403
20407
  schematic_component_id,
20408
+ schematic_symbol_id,
20404
20409
  x1: props.x1 + globalPos.x,
20405
20410
  y1: props.y1 + globalPos.y,
20406
20411
  x2: props.x2 + globalPos.x,
@@ -20450,7 +20455,9 @@ var SchematicRect = class extends PrimitiveComponent2 {
20450
20455
  const { _parsedProps: props } = this;
20451
20456
  const globalPos = this._getGlobalSchematicPositionBeforeLayout();
20452
20457
  const schematic_component_id = this.getPrimitiveContainer()?.parent?.schematic_component_id;
20458
+ const schematic_symbol_id = this._getSymbolAncestor()?.schematic_symbol_id;
20453
20459
  const schematic_rect = db.schematic_rect.insert({
20460
+ schematic_symbol_id,
20454
20461
  center: {
20455
20462
  x: globalPos.x,
20456
20463
  y: globalPos.y
@@ -20516,8 +20523,10 @@ var SchematicArc = class extends PrimitiveComponent2 {
20516
20523
  const { _parsedProps: props } = this;
20517
20524
  const globalPos = this._getGlobalSchematicPositionBeforeLayout();
20518
20525
  const schematic_component_id = this.getPrimitiveContainer()?.parent?.schematic_component_id;
20526
+ const schematic_symbol_id = this._getSymbolAncestor()?.schematic_symbol_id;
20519
20527
  const schematic_arc = db.schematic_arc.insert({
20520
20528
  schematic_component_id,
20529
+ schematic_symbol_id,
20521
20530
  center: {
20522
20531
  x: props.center.x + globalPos.x,
20523
20532
  y: props.center.y + globalPos.y
@@ -20573,8 +20582,10 @@ var SchematicCircle = class extends PrimitiveComponent2 {
20573
20582
  const { _parsedProps: props } = this;
20574
20583
  const globalPos = this._getGlobalSchematicPositionBeforeLayout();
20575
20584
  const schematic_component_id = this.getPrimitiveContainer()?.parent?.schematic_component_id;
20585
+ const schematic_symbol_id = this._getSymbolAncestor()?.schematic_symbol_id;
20576
20586
  const schematic_circle = db.schematic_circle.insert({
20577
20587
  schematic_component_id,
20588
+ schematic_symbol_id,
20578
20589
  center: {
20579
20590
  x: props.center.x + globalPos.x,
20580
20591
  y: props.center.y + globalPos.y
@@ -20759,6 +20770,7 @@ var SchematicPath = class extends PrimitiveComponent2 {
20759
20770
  const { _parsedProps: props } = this;
20760
20771
  const globalPos = this._getGlobalSchematicPositionBeforeLayout();
20761
20772
  const schematic_component_id = this.getPrimitiveContainer()?.parent?.schematic_component_id;
20773
+ const schematic_symbol_id = this._getSymbolAncestor()?.schematic_symbol_id;
20762
20774
  const subcircuit_id = this.getSubcircuit().subcircuit_id ?? void 0;
20763
20775
  this.schematic_path_ids = [];
20764
20776
  if (props.svgPath) {
@@ -20766,6 +20778,7 @@ var SchematicPath = class extends PrimitiveComponent2 {
20766
20778
  for (const subpathPoints of subpaths) {
20767
20779
  const schematic_path = db.schematic_path.insert({
20768
20780
  schematic_component_id,
20781
+ schematic_symbol_id,
20769
20782
  points: subpathPoints.map((point6) => ({
20770
20783
  x: point6.x + globalPos.x,
20771
20784
  y: point6.y + globalPos.y
@@ -20781,6 +20794,7 @@ var SchematicPath = class extends PrimitiveComponent2 {
20781
20794
  } else if (props.points && props.points.length > 0) {
20782
20795
  const schematic_path = db.schematic_path.insert({
20783
20796
  schematic_component_id,
20797
+ schematic_symbol_id,
20784
20798
  points: props.points.map((point6) => ({
20785
20799
  x: point6.x + globalPos.x,
20786
20800
  y: point6.y + globalPos.y
@@ -21170,6 +21184,7 @@ import { symbolProps } from "@tscircuit/props";
21170
21184
  import { compose as compose7, translate as translate9, scale as scale2 } from "transformation-matrix";
21171
21185
  var SymbolComponent = class extends PrimitiveComponent2 {
21172
21186
  isPrimitiveContainer = true;
21187
+ schematic_symbol_id;
21173
21188
  userCoordinateToResizedSymbolTransformMat;
21174
21189
  schematicSymbolBoundsInUserCoordinates;
21175
21190
  get config() {
@@ -21182,6 +21197,20 @@ var SymbolComponent = class extends PrimitiveComponent2 {
21182
21197
  const { _parsedProps: props } = this;
21183
21198
  return props.width !== void 0 || props.height !== void 0;
21184
21199
  }
21200
+ /**
21201
+ * Create the schematic_symbol element in SymbolContainerRender phase.
21202
+ * This runs before SchematicPrimitiveRender, ensuring children can
21203
+ * reference the schematic_symbol_id when they render.
21204
+ */
21205
+ doInitialSymbolContainerRender() {
21206
+ if (this.root?.schematicDisabled) return;
21207
+ const { db } = this.root;
21208
+ const { _parsedProps: props } = this;
21209
+ const schematic_symbol = db.schematic_symbol.insert({
21210
+ name: props.name
21211
+ });
21212
+ this.schematic_symbol_id = schematic_symbol.schematic_symbol_id;
21213
+ }
21185
21214
  getSchematicSymbolBounds() {
21186
21215
  if (this.schematicSymbolBoundsInUserCoordinates) {
21187
21216
  return this.schematicSymbolBoundsInUserCoordinates;
@@ -21563,7 +21592,7 @@ import { identity as identity5 } from "transformation-matrix";
21563
21592
  var package_default = {
21564
21593
  name: "@tscircuit/core",
21565
21594
  type: "module",
21566
- version: "0.0.999",
21595
+ version: "0.0.1000",
21567
21596
  types: "dist/index.d.ts",
21568
21597
  main: "dist/index.js",
21569
21598
  module: "dist/index.js",
@@ -21619,7 +21648,7 @@ var package_default = {
21619
21648
  "bun-match-svg": "0.0.12",
21620
21649
  "calculate-elbow": "^0.0.12",
21621
21650
  "chokidar-cli": "^3.0.0",
21622
- "circuit-json": "^0.0.370",
21651
+ "circuit-json": "^0.0.371",
21623
21652
  "circuit-json-to-bpc": "^0.0.13",
21624
21653
  "circuit-json-to-connectivity-map": "^0.0.23",
21625
21654
  "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.1000",
4
+ "version": "0.0.1001",
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.370",
60
+ "circuit-json": "^0.0.371",
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",