@tscircuit/core 0.0.910 → 0.0.913

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
@@ -181,7 +181,7 @@ interface SimpleRouteJson {
181
181
  traces?: SimplifiedPcbTrace[];
182
182
  }
183
183
 
184
- type RootCircuitEventName = "asyncEffect:start" | "asyncEffect:end" | "renderable:renderLifecycle:anyEvent" | `renderable:renderLifecycle:${RenderPhase}:start` | `renderable:renderLifecycle:${RenderPhase}:end` | `board:renderPhaseStarted` | "external:evalError" | "autorouting:start" | "autorouting:end" | "autorouting:error" | "autorouting:progress" | "renderComplete" | "debug:logOutput";
184
+ type RootCircuitEventName = "asyncEffect:start" | "asyncEffect:end" | "renderable:renderLifecycle:anyEvent" | `renderable:renderLifecycle:${RenderPhase}:start` | `renderable:renderLifecycle:${RenderPhase}:end` | `board:renderPhaseStarted` | "external:evalError" | "autorouting:start" | "autorouting:end" | "autorouting:error" | "autorouting:progress" | "packing:start" | "packing:end" | "packing:error" | "renderComplete" | "debug:logOutput";
185
185
  interface AutoroutingStartEvent {
186
186
  type: "autorouting:start";
187
187
  subcircuit_id: string;
@@ -210,6 +210,24 @@ interface AutoroutingProgressEvent {
210
210
  interface AutoroutingEndEvent {
211
211
  type: "autorouting:end";
212
212
  }
213
+ interface PackingStartEvent {
214
+ type: "packing:start";
215
+ subcircuit_id: string | null;
216
+ componentDisplayName: string;
217
+ }
218
+ interface PackingEndEvent {
219
+ type: "packing:end";
220
+ subcircuit_id: string | null;
221
+ componentDisplayName: string;
222
+ }
223
+ interface PackingErrorEvent {
224
+ type: "packing:error";
225
+ subcircuit_id: string | null;
226
+ componentDisplayName: string;
227
+ error?: {
228
+ message: string;
229
+ };
230
+ }
213
231
  interface DebugLogOutputEvent {
214
232
  type: "debug:logOutput";
215
233
  name: string;
@@ -2783,6 +2801,10 @@ declare class Board extends Group<typeof boardProps> implements BoardI, Subcircu
2783
2801
  doInitialPcbDesignRuleChecks(): void;
2784
2802
  updatePcbDesignRuleChecks(): void;
2785
2803
  _emitRenderLifecycleEvent(phase: RenderPhase, startOrEnd: "start" | "end"): void;
2804
+ _repositionOnPcb(position: {
2805
+ x: number;
2806
+ y: number;
2807
+ }): void;
2786
2808
  }
2787
2809
 
2788
2810
  declare class Panel extends Group<typeof panelProps> {
@@ -3329,8 +3351,6 @@ declare class Panel extends Group<typeof panelProps> {
3329
3351
  noSolderMask: zod.ZodOptional<zod.ZodBoolean>;
3330
3352
  panelizationMethod: zod.ZodOptional<zod.ZodEnum<["tab-routing", "none"]>>;
3331
3353
  boardGap: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
3332
- boardAreaWidth: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
3333
- boardAreaHeight: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
3334
3354
  layoutMode: zod.ZodOptional<zod.ZodEnum<["grid", "pack", "none"]>>;
3335
3355
  row: zod.ZodOptional<zod.ZodNumber>;
3336
3356
  col: zod.ZodOptional<zod.ZodNumber>;
@@ -3596,8 +3616,6 @@ declare class Panel extends Group<typeof panelProps> {
3596
3616
  noSolderMask?: boolean | undefined;
3597
3617
  panelizationMethod?: "none" | "tab-routing" | undefined;
3598
3618
  boardGap?: number | undefined;
3599
- boardAreaWidth?: number | undefined;
3600
- boardAreaHeight?: number | undefined;
3601
3619
  col?: number | undefined;
3602
3620
  cellWidth?: number | undefined;
3603
3621
  cellHeight?: number | undefined;
@@ -3863,8 +3881,6 @@ declare class Panel extends Group<typeof panelProps> {
3863
3881
  noSolderMask?: boolean | undefined;
3864
3882
  panelizationMethod?: "none" | "tab-routing" | undefined;
3865
3883
  boardGap?: string | number | undefined;
3866
- boardAreaWidth?: string | number | undefined;
3867
- boardAreaHeight?: string | number | undefined;
3868
3884
  col?: number | undefined;
3869
3885
  cellWidth?: string | number | undefined;
3870
3886
  cellHeight?: string | number | undefined;
@@ -18835,6 +18851,7 @@ declare class VoltageSource extends NormalComponent<typeof voltageSourceProps, "
18835
18851
  runRenderPhaseForChildren(phase: RenderPhase): void;
18836
18852
  doInitialPcbComponentRender(): void;
18837
18853
  initPorts(): void;
18854
+ _getSchematicSymbolDisplayValue(): string | undefined;
18838
18855
  doInitialSourceRender(): void;
18839
18856
  doInitialSimulationRender(): void;
18840
18857
  terminal1: Port;
@@ -43270,4 +43287,4 @@ declare module "react/jsx-runtime" {
43270
43287
  }
43271
43288
  }
43272
43289
 
43273
- export { AnalogSimulation, type AsyncEffect, type AutorouterCompleteEvent, type AutorouterErrorEvent, type AutorouterEvent, type AutorouterProgressEvent, type AutoroutingEndEvent, type AutoroutingErrorEvent, type AutoroutingProgressEvent, type AutoroutingStartEvent, Battery, Board, Breakout, BreakoutPoint, CadAssembly, CadModel, Capacitor, Chip, Circuit, type ComponentWithPins, Constraint, CopperPour, Crystal, Cutout, type DebugLogOutputEvent, Diode, FabricationNoteDimension, FabricationNotePath, FabricationNoteRect, FabricationNoteText, Footprint, Fuse, type GenericConnectionsAndSelectorsSel, type GenericLocalAutorouter, Group, Hole, type IRenderable, Inductor, Interconnect, Jumper, Keepout, Led, type LocalCacheEngine, Mosfet, Net, NetLabel, NormalComponent, type Obstacle, Panel, PcbNoteDimension, PcbNoteLine, PcbNotePath, PcbNoteRect, PcbNoteText, PcbTrace, PinHeader, type PinLabelSpec, Pinout, PlatedHole, Port, Potentiometer, PowerSource, PrimitiveComponent, Project, PushButton, type RenderPhase, type RenderPhaseFn, type RenderPhaseFunctions, type RenderPhaseStates, Renderable, Resistor, Resonator, RootCircuit, type RootCircuitEventName, SchematicArc, SchematicBox, SchematicCell, SchematicCircle, SchematicLine, SchematicRect, SchematicRow, SchematicTable, SchematicText, type Sel, SilkscreenCircle, SilkscreenLine, SilkscreenPath, SilkscreenRect, SilkscreenText, type SimpleRouteConnection, type SimpleRouteJson, type SimplifiedPcbTrace, SmtPad, SolderJumper, Subcircuit, Switch, SymbolComponent as Symbol, TestPoint, Trace, TraceHint, Transistor, Via, VoltageProbe, VoltageSource, applyEditEvents, applyEditEventsToManualEditsFile, applyPcbEditEventsToManualEditsFile, applySchematicEditEventsToManualEditsFile, createUseComponent, getPhaseTimingsFromRenderEvents, getSimpleRouteJsonFromCircuitJson, normalizePinLabels, orderedRenderPhases, resolveStaticFileImport, sel, useCapacitor, useChip, useDiode, useLed, useRenderedCircuit, useResistor };
43290
+ export { AnalogSimulation, type AsyncEffect, type AutorouterCompleteEvent, type AutorouterErrorEvent, type AutorouterEvent, type AutorouterProgressEvent, type AutoroutingEndEvent, type AutoroutingErrorEvent, type AutoroutingProgressEvent, type AutoroutingStartEvent, Battery, Board, Breakout, BreakoutPoint, CadAssembly, CadModel, Capacitor, Chip, Circuit, type ComponentWithPins, Constraint, CopperPour, Crystal, Cutout, type DebugLogOutputEvent, Diode, FabricationNoteDimension, FabricationNotePath, FabricationNoteRect, FabricationNoteText, Footprint, Fuse, type GenericConnectionsAndSelectorsSel, type GenericLocalAutorouter, Group, Hole, type IRenderable, Inductor, Interconnect, Jumper, Keepout, Led, type LocalCacheEngine, Mosfet, Net, NetLabel, NormalComponent, type Obstacle, type PackingEndEvent, type PackingErrorEvent, type PackingStartEvent, Panel, PcbNoteDimension, PcbNoteLine, PcbNotePath, PcbNoteRect, PcbNoteText, PcbTrace, PinHeader, type PinLabelSpec, Pinout, PlatedHole, Port, Potentiometer, PowerSource, PrimitiveComponent, Project, PushButton, type RenderPhase, type RenderPhaseFn, type RenderPhaseFunctions, type RenderPhaseStates, Renderable, Resistor, Resonator, RootCircuit, type RootCircuitEventName, SchematicArc, SchematicBox, SchematicCell, SchematicCircle, SchematicLine, SchematicRect, SchematicRow, SchematicTable, SchematicText, type Sel, SilkscreenCircle, SilkscreenLine, SilkscreenPath, SilkscreenRect, SilkscreenText, type SimpleRouteConnection, type SimpleRouteJson, type SimplifiedPcbTrace, SmtPad, SolderJumper, Subcircuit, Switch, SymbolComponent as Symbol, TestPoint, Trace, TraceHint, Transistor, Via, VoltageProbe, VoltageSource, applyEditEvents, applyEditEventsToManualEditsFile, applyPcbEditEventsToManualEditsFile, applySchematicEditEventsToManualEditsFile, createUseComponent, getPhaseTimingsFromRenderEvents, getSimpleRouteJsonFromCircuitJson, normalizePinLabels, orderedRenderPhases, resolveStaticFileImport, sel, useCapacitor, useChip, useDiode, useLed, useRenderedCircuit, useResistor };
package/dist/index.js CHANGED
@@ -12215,6 +12215,10 @@ var debug6 = Debug8("Group_doInitialPcbLayoutPack");
12215
12215
  var Group_doInitialPcbLayoutPack = (group) => {
12216
12216
  const { db } = group.root;
12217
12217
  const { _parsedProps: props } = group;
12218
+ group.root?.emit("packing:start", {
12219
+ subcircuit_id: group.subcircuit_id,
12220
+ componentDisplayName: group.getString()
12221
+ });
12218
12222
  const {
12219
12223
  packOrderStrategy,
12220
12224
  packPlacementStrategy,
@@ -12318,13 +12322,29 @@ var Group_doInitialPcbLayoutPack = (group) => {
12318
12322
  content: packInput
12319
12323
  });
12320
12324
  }
12321
- const packOutput = pack(packInput);
12325
+ let packOutput;
12326
+ try {
12327
+ packOutput = pack(packInput);
12328
+ } catch (error) {
12329
+ group.root?.emit("packing:error", {
12330
+ subcircuit_id: group.subcircuit_id,
12331
+ componentDisplayName: group.getString(),
12332
+ error: {
12333
+ message: error instanceof Error ? error.message : String(error)
12334
+ }
12335
+ });
12336
+ throw error;
12337
+ }
12322
12338
  if (debug6.enabled && global?.debugGraphics) {
12323
12339
  const graphics = getGraphicsFromPackOutput(packOutput);
12324
12340
  graphics.title = `packOutput-${group.name}`;
12325
12341
  global.debugGraphics?.push(graphics);
12326
12342
  }
12327
12343
  applyPackOutput(group, packOutput, clusterMap);
12344
+ group.root?.emit("packing:end", {
12345
+ subcircuit_id: group.subcircuit_id,
12346
+ componentDisplayName: group.getString()
12347
+ });
12328
12348
  };
12329
12349
 
12330
12350
  // lib/components/primitive-components/Group/Group_doInitialPcbLayoutFlex.ts
@@ -15604,11 +15624,13 @@ var Board = class extends Group6 {
15604
15624
  const maxX = Math.max(...xValues);
15605
15625
  const minY = Math.min(...yValues);
15606
15626
  const maxY = Math.max(...yValues);
15627
+ const outlineCenterX = (minX + maxX) / 2;
15628
+ const outlineCenterY = (minY + maxY) / 2;
15607
15629
  computedWidth = maxX - minX;
15608
15630
  computedHeight = maxY - minY;
15609
15631
  center = {
15610
- x: (minX + maxX) / 2 + (props.outlineOffsetX ?? 0),
15611
- y: (minY + maxY) / 2 + (props.outlineOffsetY ?? 0)
15632
+ x: outlineCenterX + (props.outlineOffsetX ?? 0),
15633
+ y: outlineCenterY + (props.outlineOffsetY ?? 0)
15612
15634
  };
15613
15635
  }
15614
15636
  let outline = props.outline;
@@ -15696,11 +15718,29 @@ var Board = class extends Group6 {
15696
15718
  });
15697
15719
  }
15698
15720
  }
15721
+ _repositionOnPcb(position) {
15722
+ super._repositionOnPcb(position);
15723
+ if (this.pcb_board_id) {
15724
+ const { db } = this.root;
15725
+ const pcb_board = db.pcb_board.get(this.pcb_board_id);
15726
+ if (pcb_board?.center && pcb_board.outline) {
15727
+ const deltaX = position.x - pcb_board.center.x;
15728
+ const deltaY = position.y - pcb_board.center.y;
15729
+ const newOutline = pcb_board.outline.map((p) => ({
15730
+ x: p.x + deltaX,
15731
+ y: p.y + deltaY
15732
+ }));
15733
+ db.pcb_board.update(this.pcb_board_id, {
15734
+ outline: newOutline
15735
+ });
15736
+ }
15737
+ }
15738
+ }
15699
15739
  };
15700
15740
 
15701
15741
  // lib/components/normal-components/Panel.ts
15702
15742
  import { panelProps } from "@tscircuit/props";
15703
- import { distance as distance9 } from "circuit-json";
15743
+ import { distance as distance10 } from "circuit-json";
15704
15744
 
15705
15745
  // lib/utils/panels/generate-panel-tabs-and-mouse-bites.ts
15706
15746
  import * as Flatten from "@flatten-js/core";
@@ -15873,6 +15913,86 @@ function generatePanelTabsAndMouseBites(boards, options) {
15873
15913
  };
15874
15914
  }
15875
15915
 
15916
+ // lib/utils/panels/pack-boards-into-grid.ts
15917
+ import { distance as distance9 } from "circuit-json";
15918
+ var packBoardsIntoGrid = ({
15919
+ boards,
15920
+ db,
15921
+ row,
15922
+ col,
15923
+ cellWidth,
15924
+ cellHeight,
15925
+ boardGap
15926
+ }) => {
15927
+ const boardsWithDims = boards.map((board) => {
15928
+ const pcbBoard = db.pcb_board.get(board.pcb_board_id);
15929
+ if (!pcbBoard || pcbBoard.width === void 0 || pcbBoard.height === void 0) {
15930
+ return null;
15931
+ }
15932
+ return { board, width: pcbBoard.width, height: pcbBoard.height };
15933
+ }).filter((b) => b !== null);
15934
+ if (boardsWithDims.length === 0) {
15935
+ return {
15936
+ positions: [],
15937
+ gridWidth: 0,
15938
+ gridHeight: 0
15939
+ };
15940
+ }
15941
+ const explicitRow = row;
15942
+ const explicitCol = col;
15943
+ const cols = explicitCol ?? (explicitRow ? Math.ceil(boardsWithDims.length / explicitRow) : Math.ceil(Math.sqrt(boardsWithDims.length)));
15944
+ const rows = explicitRow ?? Math.ceil(boardsWithDims.length / cols);
15945
+ const colWidths = Array(cols).fill(0);
15946
+ const rowHeights = Array(rows).fill(0);
15947
+ boardsWithDims.forEach((b, i) => {
15948
+ const col2 = i % cols;
15949
+ const row2 = Math.floor(i / cols);
15950
+ if (row2 < rowHeights.length && b.height > rowHeights[row2]) {
15951
+ rowHeights[row2] = b.height;
15952
+ }
15953
+ if (col2 < colWidths.length && b.width > colWidths[col2]) {
15954
+ colWidths[col2] = b.width;
15955
+ }
15956
+ });
15957
+ const minCellWidth = cellWidth ? distance9.parse(cellWidth) : 0;
15958
+ const minCellHeight = cellHeight ? distance9.parse(cellHeight) : 0;
15959
+ for (let i = 0; i < colWidths.length; i++) {
15960
+ colWidths[i] = Math.max(colWidths[i], minCellWidth);
15961
+ }
15962
+ for (let i = 0; i < rowHeights.length; i++) {
15963
+ rowHeights[i] = Math.max(rowHeights[i], minCellHeight);
15964
+ }
15965
+ const totalGridWidth = colWidths.reduce((a, b) => a + b, 0) + (cols > 1 ? (cols - 1) * boardGap : 0);
15966
+ const totalGridHeight = rowHeights.reduce((a, b) => a + b, 0) + (rows > 1 ? (rows - 1) * boardGap : 0);
15967
+ const startX = -totalGridWidth / 2;
15968
+ const startY = -totalGridHeight / 2;
15969
+ const rowYOffsets = [startY];
15970
+ for (let i = 1; i < rows; i++) {
15971
+ rowYOffsets.push(rowYOffsets[i - 1] + rowHeights[i - 1] + boardGap);
15972
+ }
15973
+ const colXOffsets = [startX];
15974
+ for (let i = 1; i < cols; i++) {
15975
+ colXOffsets.push(colXOffsets[i - 1] + colWidths[i - 1] + boardGap);
15976
+ }
15977
+ const positions = [];
15978
+ boardsWithDims.forEach((b, i) => {
15979
+ const col2 = i % cols;
15980
+ const row2 = Math.floor(i / cols);
15981
+ if (row2 >= rowYOffsets.length || col2 >= colXOffsets.length) return;
15982
+ const cellX = colXOffsets[col2];
15983
+ const cellY = rowYOffsets[row2];
15984
+ const cellWidth2 = colWidths[col2];
15985
+ const cellHeight2 = rowHeights[row2];
15986
+ const boardX = cellX + cellWidth2 / 2;
15987
+ const boardY = cellY + cellHeight2 / 2;
15988
+ positions.push({
15989
+ board: b.board,
15990
+ pos: { x: boardX, y: boardY }
15991
+ });
15992
+ });
15993
+ return { positions, gridWidth: totalGridWidth, gridHeight: totalGridHeight };
15994
+ };
15995
+
15876
15996
  // lib/components/normal-components/Panel.ts
15877
15997
  var Panel = class extends Group6 {
15878
15998
  pcb_panel_id = null;
@@ -15910,77 +16030,35 @@ var Panel = class extends Group6 {
15910
16030
  if (unpositionedBoards.length > 0 && !hasAnyPositionedBoards) {
15911
16031
  const tabWidth = this._parsedProps.tabWidth ?? DEFAULT_TAB_WIDTH;
15912
16032
  const boardGap = this._parsedProps.boardGap ?? tabWidth;
15913
- const gridCols = Math.ceil(Math.sqrt(unpositionedBoards.length));
15914
- const gridRows = Math.ceil(unpositionedBoards.length / gridCols);
15915
- const colWidths = Array(gridCols).fill(0);
15916
- const rowHeights = Array(gridRows).fill(0);
15917
- unpositionedBoards.forEach((board, i) => {
15918
- const col = i % gridCols;
15919
- const row = Math.floor(i / gridCols);
15920
- const pcbBoard = db.pcb_board.get(board.pcb_board_id);
15921
- if (!pcbBoard || pcbBoard.width === void 0 || pcbBoard.height === void 0)
15922
- return;
15923
- colWidths[col] = Math.max(colWidths[col], pcbBoard.width);
15924
- rowHeights[row] = Math.max(rowHeights[row], pcbBoard.height);
16033
+ const { positions, gridWidth, gridHeight } = packBoardsIntoGrid({
16034
+ boards: unpositionedBoards,
16035
+ db,
16036
+ row: this._parsedProps.row,
16037
+ col: this._parsedProps.col,
16038
+ cellWidth: this._parsedProps.cellWidth,
16039
+ cellHeight: this._parsedProps.cellHeight,
16040
+ boardGap
15925
16041
  });
15926
- const totalGridWidth = colWidths.reduce((a, b) => a + b, 0) + (gridCols > 1 ? (gridCols - 1) * boardGap : 0);
15927
- const totalGridHeight = rowHeights.reduce((a, b) => a + b, 0) + (gridRows > 1 ? (gridRows - 1) * boardGap : 0);
15928
- const startX = -totalGridWidth / 2;
15929
- const startY = -totalGridHeight / 2;
15930
- const rowYOffsets = [startY];
15931
- for (let i = 0; i < gridRows - 1; i++) {
15932
- rowYOffsets.push(rowYOffsets[i] + rowHeights[i] + boardGap);
15933
- }
15934
- const colXOffsets = [startX];
15935
- for (let i = 0; i < gridCols - 1; i++) {
15936
- colXOffsets.push(colXOffsets[i] + colWidths[i] + boardGap);
15937
- }
15938
16042
  const panelGlobalPos = this._getGlobalPcbPositionBeforeLayout();
15939
- unpositionedBoards.forEach((board, i) => {
15940
- const col = i % gridCols;
15941
- const row = Math.floor(i / gridCols);
15942
- const pcbBoard = db.pcb_board.get(board.pcb_board_id);
15943
- if (!pcbBoard || !pcbBoard.width || !pcbBoard.height) return;
15944
- const relativeX = colXOffsets[col] + colWidths[col] / 2;
15945
- const relativeY = rowYOffsets[row] + rowHeights[row] / 2;
15946
- const absoluteX = panelGlobalPos.x + relativeX;
15947
- const absoluteY = panelGlobalPos.y + relativeY;
16043
+ for (const { board, pos } of positions) {
16044
+ const absoluteX = panelGlobalPos.x + pos.x;
16045
+ const absoluteY = panelGlobalPos.y + pos.y;
15948
16046
  board._repositionOnPcb({ x: absoluteX, y: absoluteY });
15949
16047
  db.pcb_board.update(board.pcb_board_id, {
15950
16048
  center: { x: absoluteX, y: absoluteY }
15951
16049
  });
15952
- });
15953
- const allBoardPcbIds = childBoardInstances.map((b) => b.pcb_board_id).filter((id) => !!id);
15954
- const allBoardsInPanel = db.pcb_board.list().filter((b) => allBoardPcbIds.includes(b.pcb_board_id));
15955
- let minX = Infinity;
15956
- let minY = Infinity;
15957
- let maxX = -Infinity;
15958
- let maxY = -Infinity;
15959
- for (const board of allBoardsInPanel) {
15960
- if (board.width === void 0 || board.height === void 0 || !isFinite(board.width) || !isFinite(board.height))
15961
- continue;
15962
- const left = board.center.x - board.width / 2;
15963
- const right = board.center.x + board.width / 2;
15964
- const bottom = board.center.y - board.height / 2;
15965
- const top = board.center.y + board.height / 2;
15966
- minX = Math.min(minX, left);
15967
- maxX = Math.max(maxX, right);
15968
- minY = Math.min(minY, bottom);
15969
- maxY = Math.max(maxY, top);
15970
16050
  }
15971
16051
  const hasExplicitWidth = this._parsedProps.width !== void 0;
15972
16052
  const hasExplicitHeight = this._parsedProps.height !== void 0;
15973
16053
  if (hasExplicitWidth && hasExplicitHeight) {
15974
16054
  db.pcb_panel.update(this.pcb_panel_id, {
15975
- width: distance9.parse(this._parsedProps.width),
15976
- height: distance9.parse(this._parsedProps.height)
16055
+ width: distance10.parse(this._parsedProps.width),
16056
+ height: distance10.parse(this._parsedProps.height)
15977
16057
  });
15978
- } else if (isFinite(minX)) {
15979
- const boundsWidth = maxX - minX;
15980
- const boundsHeight = maxY - minY;
16058
+ } else if (gridWidth > 0 || gridHeight > 0) {
15981
16059
  db.pcb_panel.update(this.pcb_panel_id, {
15982
- width: hasExplicitWidth ? distance9.parse(this._parsedProps.width) : boundsWidth + 2 * DEFAULT_PANEL_MARGIN,
15983
- height: hasExplicitHeight ? distance9.parse(this._parsedProps.height) : boundsHeight + 2 * DEFAULT_PANEL_MARGIN
16060
+ width: hasExplicitWidth ? distance10.parse(this._parsedProps.width) : gridWidth + 2 * DEFAULT_PANEL_MARGIN,
16061
+ height: hasExplicitHeight ? distance10.parse(this._parsedProps.height) : gridHeight + 2 * DEFAULT_PANEL_MARGIN
15984
16062
  });
15985
16063
  }
15986
16064
  }
@@ -16023,8 +16101,8 @@ var Panel = class extends Group6 {
16023
16101
  const { db } = this.root;
16024
16102
  const props = this._parsedProps;
16025
16103
  const inserted = db.pcb_panel.insert({
16026
- width: props.width !== void 0 ? distance9.parse(props.width) : 0,
16027
- height: props.height !== void 0 ? distance9.parse(props.height) : 0,
16104
+ width: props.width !== void 0 ? distance10.parse(props.width) : 0,
16105
+ height: props.height !== void 0 ? distance10.parse(props.height) : 0,
16028
16106
  center: this._getGlobalPcbPositionBeforeLayout(),
16029
16107
  covered_with_solder_mask: !(props.noSolderMask ?? false)
16030
16108
  });
@@ -16037,8 +16115,8 @@ var Panel = class extends Group6 {
16037
16115
  const props = this._parsedProps;
16038
16116
  const currentPanel = db.pcb_panel.get(this.pcb_panel_id);
16039
16117
  db.pcb_panel.update(this.pcb_panel_id, {
16040
- width: props.width !== void 0 ? distance9.parse(props.width) : currentPanel?.width,
16041
- height: props.height !== void 0 ? distance9.parse(props.height) : currentPanel?.height,
16118
+ width: props.width !== void 0 ? distance10.parse(props.width) : currentPanel?.width,
16119
+ height: props.height !== void 0 ? distance10.parse(props.height) : currentPanel?.height,
16042
16120
  center: this._getGlobalPcbPositionBeforeLayout(),
16043
16121
  covered_with_solder_mask: !(props.noSolderMask ?? false)
16044
16122
  });
@@ -16501,6 +16579,7 @@ var PowerSource = class extends NormalComponent3 {
16501
16579
 
16502
16580
  // lib/components/normal-components/VoltageSource.ts
16503
16581
  import { voltageSourceProps } from "@tscircuit/props";
16582
+ import { formatSiUnit as formatSiUnit5 } from "format-si-unit";
16504
16583
  var VoltageSource = class extends NormalComponent3 {
16505
16584
  get config() {
16506
16585
  const isSquare = this.props.waveShape === "square";
@@ -16530,6 +16609,17 @@ var VoltageSource = class extends NormalComponent3 {
16530
16609
  }
16531
16610
  });
16532
16611
  }
16612
+ _getSchematicSymbolDisplayValue() {
16613
+ const { voltage, frequency: frequency2 } = this._parsedProps;
16614
+ const parts = [];
16615
+ if (voltage !== void 0) {
16616
+ parts.push(`${formatSiUnit5(voltage)}V`);
16617
+ }
16618
+ if (frequency2 !== void 0) {
16619
+ parts.push(`${formatSiUnit5(frequency2)}Hz`);
16620
+ }
16621
+ return parts.length > 0 ? parts.join(" ") : void 0;
16622
+ }
16533
16623
  doInitialSourceRender() {
16534
16624
  const { db } = this.root;
16535
16625
  const { _parsedProps: props } = this;
@@ -17956,7 +18046,7 @@ var PinHeader = class extends NormalComponent3 {
17956
18046
 
17957
18047
  // lib/components/normal-components/Resonator.ts
17958
18048
  import { resonatorProps } from "@tscircuit/props";
17959
- import { formatSiUnit as formatSiUnit5 } from "format-si-unit";
18049
+ import { formatSiUnit as formatSiUnit6 } from "format-si-unit";
17960
18050
  function getResonatorSymbolName(variant) {
17961
18051
  switch (variant) {
17962
18052
  case "two_ground_pins":
@@ -17994,9 +18084,9 @@ var Resonator = class extends NormalComponent3 {
17994
18084
  this.source_component_id = source_component.source_component_id;
17995
18085
  }
17996
18086
  _getSchematicSymbolDisplayValue() {
17997
- const freqDisplay = `${formatSiUnit5(this._parsedProps.frequency)}Hz`;
18087
+ const freqDisplay = `${formatSiUnit6(this._parsedProps.frequency)}Hz`;
17998
18088
  if (this._parsedProps.loadCapacitance) {
17999
- return `${freqDisplay} / ${formatSiUnit5(this._parsedProps.loadCapacitance)}F`;
18089
+ return `${freqDisplay} / ${formatSiUnit6(this._parsedProps.loadCapacitance)}F`;
18000
18090
  }
18001
18091
  return freqDisplay;
18002
18092
  }
@@ -18004,7 +18094,7 @@ var Resonator = class extends NormalComponent3 {
18004
18094
 
18005
18095
  // lib/components/normal-components/Potentiometer.ts
18006
18096
  import { potentiometerProps } from "@tscircuit/props";
18007
- import { formatSiUnit as formatSiUnit6 } from "format-si-unit";
18097
+ import { formatSiUnit as formatSiUnit7 } from "format-si-unit";
18008
18098
  function getPotentiometerSymbolName(variant) {
18009
18099
  switch (variant) {
18010
18100
  case "three_pin":
@@ -18025,7 +18115,7 @@ var Potentiometer = class extends NormalComponent3 {
18025
18115
  };
18026
18116
  }
18027
18117
  _getSchematicSymbolDisplayValue() {
18028
- return `${formatSiUnit6(this._parsedProps.maxResistance)}\u03A9`;
18118
+ return `${formatSiUnit7(this._parsedProps.maxResistance)}\u03A9`;
18029
18119
  }
18030
18120
  doInitialSourceRender() {
18031
18121
  const { db } = this.root;
@@ -18109,7 +18199,7 @@ var PushButton = class extends NormalComponent3 {
18109
18199
 
18110
18200
  // lib/components/normal-components/Crystal.ts
18111
18201
  import { crystalProps } from "@tscircuit/props";
18112
- import { formatSiUnit as formatSiUnit7 } from "format-si-unit";
18202
+ import { formatSiUnit as formatSiUnit8 } from "format-si-unit";
18113
18203
  var Crystal = class extends NormalComponent3 {
18114
18204
  // @ts-ignore
18115
18205
  get config() {
@@ -18136,9 +18226,9 @@ var Crystal = class extends NormalComponent3 {
18136
18226
  });
18137
18227
  }
18138
18228
  _getSchematicSymbolDisplayValue() {
18139
- const freqDisplay = `${formatSiUnit7(this._parsedProps.frequency)}Hz`;
18229
+ const freqDisplay = `${formatSiUnit8(this._parsedProps.frequency)}Hz`;
18140
18230
  if (this._parsedProps.loadCapacitance) {
18141
- return `${freqDisplay} / ${formatSiUnit7(
18231
+ return `${freqDisplay} / ${formatSiUnit8(
18142
18232
  this._parsedProps.loadCapacitance
18143
18233
  )}F`;
18144
18234
  }
@@ -19062,7 +19152,7 @@ import { identity as identity5 } from "transformation-matrix";
19062
19152
  var package_default = {
19063
19153
  name: "@tscircuit/core",
19064
19154
  type: "module",
19065
- version: "0.0.909",
19155
+ version: "0.0.912",
19066
19156
  types: "dist/index.d.ts",
19067
19157
  main: "dist/index.js",
19068
19158
  module: "dist/index.js",
@@ -19106,7 +19196,7 @@ var package_default = {
19106
19196
  "@tscircuit/math-utils": "^0.0.29",
19107
19197
  "@tscircuit/miniflex": "^0.0.4",
19108
19198
  "@tscircuit/ngspice-spice-engine": "^0.0.8",
19109
- "@tscircuit/props": "^0.0.424",
19199
+ "@tscircuit/props": "^0.0.425",
19110
19200
  "@tscircuit/schematic-autolayout": "^0.0.6",
19111
19201
  "@tscircuit/schematic-match-adapt": "^0.0.16",
19112
19202
  "@tscircuit/schematic-trace-solver": "^v0.0.45",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.910",
4
+ "version": "0.0.913",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -45,7 +45,7 @@
45
45
  "@tscircuit/math-utils": "^0.0.29",
46
46
  "@tscircuit/miniflex": "^0.0.4",
47
47
  "@tscircuit/ngspice-spice-engine": "^0.0.8",
48
- "@tscircuit/props": "^0.0.424",
48
+ "@tscircuit/props": "^0.0.425",
49
49
  "@tscircuit/schematic-autolayout": "^0.0.6",
50
50
  "@tscircuit/schematic-match-adapt": "^0.0.16",
51
51
  "@tscircuit/schematic-trace-solver": "^v0.0.45",