@tscircuit/core 0.0.660 → 0.0.662

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
@@ -12,7 +12,7 @@ import { CircuitJsonUtilObjects } from '@tscircuit/circuit-json-util';
12
12
  import { ConnectivityMap } from 'circuit-json-to-connectivity-map';
13
13
  import { GraphicsObject } from 'graphics-debug';
14
14
 
15
- declare const orderedRenderPhases: readonly ["ReactSubtreesRender", "PcbFootprintStringRender", "InitializePortsFromChildren", "CreateNetsFromProps", "AssignFallbackProps", "CreateTracesFromProps", "CreateTracesFromNetLabels", "CreateTraceHintsFromProps", "SourceGroupRender", "AssignNameToUnnamedComponents", "SourceRender", "SourceParentAttachment", "PortMatching", "OptimizeSelectorCache", "SourceTraceRender", "SourceAddConnectivityMapKey", "SimulationRender", "SchematicComponentRender", "SchematicPortRender", "SchematicPrimitiveRender", "SchematicLayout", "SchematicTraceRender", "SchematicReplaceNetLabelsWithSymbols", "PcbComponentRender", "PcbPrimitiveRender", "PcbFootprintLayout", "PcbPortRender", "PcbPortAttachment", "PcbComponentSizeCalculation", "PcbLayout", "PcbBoardAutoSize", "PcbTraceHintRender", "PcbManualTraceRender", "PcbTraceRender", "PcbRouteNetIslands", "PcbDesignRuleChecks", "CadModelRender", "PartsEngineRender"];
15
+ declare const orderedRenderPhases: readonly ["ReactSubtreesRender", "PcbFootprintStringRender", "InitializePortsFromChildren", "CreateNetsFromProps", "AssignFallbackProps", "CreateTracesFromProps", "CreateTracesFromNetLabels", "CreateTraceHintsFromProps", "SourceGroupRender", "AssignNameToUnnamedComponents", "SourceRender", "SourceParentAttachment", "PortMatching", "OptimizeSelectorCache", "SourceTraceRender", "SourceAddConnectivityMapKey", "SourceDesignRuleChecks", "SimulationRender", "SchematicComponentRender", "SchematicPortRender", "SchematicPrimitiveRender", "SchematicLayout", "SchematicTraceRender", "SchematicReplaceNetLabelsWithSymbols", "PcbComponentRender", "PcbPrimitiveRender", "PcbFootprintLayout", "PcbPortRender", "PcbPortAttachment", "PcbComponentSizeCalculation", "PcbLayout", "PcbBoardAutoSize", "PcbTraceHintRender", "PcbManualTraceRender", "PcbTraceRender", "PcbRouteNetIslands", "PcbDesignRuleChecks", "CadModelRender", "PartsEngineRender"];
16
16
  type RenderPhase = (typeof orderedRenderPhases)[number];
17
17
  type RenderPhaseFn<K extends RenderPhase = RenderPhase> = `doInitial${K}` | `update${K}` | `remove${K}`;
18
18
  type RenderPhaseStates = Record<RenderPhase, {
@@ -1104,6 +1104,7 @@ declare class NormalComponent<ZodProps extends z.ZodType = any, PortNames extend
1104
1104
  doInitialAssignFallbackProps(): void;
1105
1105
  doInitialCreateTracesFromProps(): void;
1106
1106
  _createTracesFromConnectionsProp(): void;
1107
+ doInitialSourceDesignRuleChecks(): void;
1107
1108
  /**
1108
1109
  * Get the minimum flex container size for this component on PCB
1109
1110
  */
package/dist/index.js CHANGED
@@ -99,6 +99,7 @@ var orderedRenderPhases = [
99
99
  "OptimizeSelectorCache",
100
100
  "SourceTraceRender",
101
101
  "SourceAddConnectivityMapKey",
102
+ "SourceDesignRuleChecks",
102
103
  "SimulationRender",
103
104
  "SchematicComponentRender",
104
105
  "SchematicPortRender",
@@ -6229,6 +6230,54 @@ var NormalComponent__repositionOnPcb = (component, position) => {
6229
6230
  );
6230
6231
  };
6231
6232
 
6233
+ // lib/components/base-components/NormalComponent/NormalComponent_doInitialSourceDesignRuleChecks.ts
6234
+ var NormalComponent_doInitialSourceDesignRuleChecks = (component) => {
6235
+ const { db } = component.root;
6236
+ if (!component.source_component_id) return;
6237
+ const ports = component.selectAll("port");
6238
+ const traces = db.source_trace.list();
6239
+ const connected = /* @__PURE__ */ new Set();
6240
+ for (const trace of traces) {
6241
+ for (const id of trace.connected_source_port_ids) {
6242
+ connected.add(id);
6243
+ }
6244
+ }
6245
+ const internalGroups = component._getInternallyConnectedPins();
6246
+ for (const group of internalGroups) {
6247
+ if (group.some((p) => p.source_port_id && connected.has(p.source_port_id))) {
6248
+ for (const p of group) {
6249
+ if (p.source_port_id) connected.add(p.source_port_id);
6250
+ }
6251
+ }
6252
+ }
6253
+ for (const port of ports) {
6254
+ if (!port.source_port_id) continue;
6255
+ if (!shouldCheckPortForMissingTrace(component, port)) continue;
6256
+ if (connected.has(port.source_port_id)) continue;
6257
+ db.source_pin_missing_trace_warning.insert({
6258
+ message: `Port ${port.getNameAndAliases()[0]} on ${component.props.name} is missing a trace`,
6259
+ source_component_id: component.source_component_id,
6260
+ source_port_id: port.source_port_id,
6261
+ subcircuit_id: component.getSubcircuit().subcircuit_id ?? void 0,
6262
+ warning_type: "source_pin_missing_trace_warning"
6263
+ });
6264
+ }
6265
+ };
6266
+ var shouldCheckPortForMissingTrace = (component, port) => {
6267
+ if (component.config.componentName === "Chip") {
6268
+ const pinAttributes = component.props.pinAttributes;
6269
+ if (!pinAttributes) return false;
6270
+ for (const alias of port.getNameAndAliases()) {
6271
+ const attrs = pinAttributes[alias];
6272
+ if (attrs?.requiresPower || attrs?.requiresGround || attrs?.requiresVoltage !== void 0) {
6273
+ return true;
6274
+ }
6275
+ }
6276
+ return false;
6277
+ }
6278
+ return true;
6279
+ };
6280
+
6232
6281
  // lib/components/base-components/NormalComponent/NormalComponent.ts
6233
6282
  var debug3 = Debug4("tscircuit:core");
6234
6283
  var rotation3 = z8.object({
@@ -7101,6 +7150,9 @@ var NormalComponent = class extends PrimitiveComponent2 {
7101
7150
  }
7102
7151
  }
7103
7152
  }
7153
+ doInitialSourceDesignRuleChecks() {
7154
+ NormalComponent_doInitialSourceDesignRuleChecks(this);
7155
+ }
7104
7156
  /**
7105
7157
  * Get the minimum flex container size for this component on PCB
7106
7158
  */
@@ -9282,7 +9334,8 @@ var Group_doInitialPcbLayoutPack = (group) => {
9282
9334
  const packInput = {
9283
9335
  ...convertPackOutputToPackInput(
9284
9336
  convertCircuitJsonToPackOutput(db.toArray(), {
9285
- source_group_id: group.source_group_id
9337
+ source_group_id: group.source_group_id,
9338
+ shouldAddInnerObstacles: true
9286
9339
  })
9287
9340
  ),
9288
9341
  // @ts-expect-error we're missing some pack order strategies
@@ -9290,6 +9343,13 @@ var Group_doInitialPcbLayoutPack = (group) => {
9290
9343
  placementStrategy: packPlacementStrategy ?? "minimum_sum_squared_distance_to_network",
9291
9344
  minGap: gapMm
9292
9345
  };
9346
+ if (debug6.enabled) {
9347
+ global.debugOutputs?.add(
9348
+ `packInput-circuitjson-${group.name}`,
9349
+ JSON.stringify(db.toArray())
9350
+ );
9351
+ global.debugOutputs?.add(`packInput-${group.name}`, packInput);
9352
+ }
9293
9353
  const packOutput = pack(packInput);
9294
9354
  if (debug6.enabled) {
9295
9355
  const graphics = getGraphicsFromPackOutput(packOutput);
@@ -13767,7 +13827,7 @@ import { identity as identity5 } from "transformation-matrix";
13767
13827
  var package_default = {
13768
13828
  name: "@tscircuit/core",
13769
13829
  type: "module",
13770
- version: "0.0.659",
13830
+ version: "0.0.661",
13771
13831
  types: "dist/index.d.ts",
13772
13832
  main: "dist/index.js",
13773
13833
  module: "dist/index.js",
@@ -13820,7 +13880,7 @@ var package_default = {
13820
13880
  "bun-match-svg": "0.0.12",
13821
13881
  "calculate-elbow": "^0.0.9",
13822
13882
  "chokidar-cli": "^3.0.0",
13823
- "circuit-json": "^0.0.233",
13883
+ "circuit-json": "^0.0.235",
13824
13884
  "circuit-json-to-bpc": "^0.0.13",
13825
13885
  "circuit-json-to-connectivity-map": "^0.0.22",
13826
13886
  "circuit-json-to-simple-3d": "^0.0.6",
@@ -13861,7 +13921,7 @@ var package_default = {
13861
13921
  dependencies: {
13862
13922
  "@flatten-js/core": "^1.6.2",
13863
13923
  "@lume/kiwi": "^0.4.3",
13864
- "calculate-packing": "0.0.28",
13924
+ "calculate-packing": "0.0.29",
13865
13925
  "css-select": "5.1.0",
13866
13926
  "format-si-unit": "^0.0.3",
13867
13927
  nanoid: "^5.0.7",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.660",
4
+ "version": "0.0.662",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -54,7 +54,7 @@
54
54
  "bun-match-svg": "0.0.12",
55
55
  "calculate-elbow": "^0.0.9",
56
56
  "chokidar-cli": "^3.0.0",
57
- "circuit-json": "^0.0.233",
57
+ "circuit-json": "^0.0.235",
58
58
  "circuit-json-to-bpc": "^0.0.13",
59
59
  "circuit-json-to-connectivity-map": "^0.0.22",
60
60
  "circuit-json-to-simple-3d": "^0.0.6",
@@ -95,7 +95,7 @@
95
95
  "dependencies": {
96
96
  "@flatten-js/core": "^1.6.2",
97
97
  "@lume/kiwi": "^0.4.3",
98
- "calculate-packing": "0.0.28",
98
+ "calculate-packing": "0.0.29",
99
99
  "css-select": "5.1.0",
100
100
  "format-si-unit": "^0.0.3",
101
101
  "nanoid": "^5.0.7",