@tscircuit/core 0.0.661 → 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
  */
@@ -13775,7 +13827,7 @@ import { identity as identity5 } from "transformation-matrix";
13775
13827
  var package_default = {
13776
13828
  name: "@tscircuit/core",
13777
13829
  type: "module",
13778
- version: "0.0.660",
13830
+ version: "0.0.661",
13779
13831
  types: "dist/index.d.ts",
13780
13832
  main: "dist/index.js",
13781
13833
  module: "dist/index.js",
@@ -13828,7 +13880,7 @@ var package_default = {
13828
13880
  "bun-match-svg": "0.0.12",
13829
13881
  "calculate-elbow": "^0.0.9",
13830
13882
  "chokidar-cli": "^3.0.0",
13831
- "circuit-json": "^0.0.233",
13883
+ "circuit-json": "^0.0.235",
13832
13884
  "circuit-json-to-bpc": "^0.0.13",
13833
13885
  "circuit-json-to-connectivity-map": "^0.0.22",
13834
13886
  "circuit-json-to-simple-3d": "^0.0.6",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.661",
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",