@tscircuit/core 0.0.1964 → 0.0.1966

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
@@ -98194,7 +98194,7 @@ declare const baseBreakoutPointProps: zod.ZodObject<Omit<{
98194
98194
  pcbOffsetX?: number | undefined;
98195
98195
  pcbOffsetY?: number | undefined;
98196
98196
  pcbPositionAnchor?: string | undefined;
98197
- pcbPositionMode?: "relative_to_group_anchor" | "auto" | "relative_to_board_anchor" | "relative_to_component_anchor" | undefined;
98197
+ pcbPositionMode?: "auto" | "relative_to_group_anchor" | "relative_to_board_anchor" | "relative_to_component_anchor" | undefined;
98198
98198
  shouldBeOnEdgeOfBoard?: boolean | undefined;
98199
98199
  pcbMarginTop?: number | undefined;
98200
98200
  pcbMarginRight?: number | undefined;
@@ -98225,7 +98225,7 @@ declare const baseBreakoutPointProps: zod.ZodObject<Omit<{
98225
98225
  pcbOffsetX?: string | number | undefined;
98226
98226
  pcbOffsetY?: string | number | undefined;
98227
98227
  pcbPositionAnchor?: string | undefined;
98228
- pcbPositionMode?: "relative_to_group_anchor" | "auto" | "relative_to_board_anchor" | "relative_to_component_anchor" | undefined;
98228
+ pcbPositionMode?: "auto" | "relative_to_group_anchor" | "relative_to_board_anchor" | "relative_to_component_anchor" | undefined;
98229
98229
  shouldBeOnEdgeOfBoard?: boolean | undefined;
98230
98230
  pcbMarginTop?: string | number | undefined;
98231
98231
  pcbMarginRight?: string | number | undefined;
@@ -108349,7 +108349,7 @@ declare const pcbViaProps: z.ZodObject<{
108349
108349
  pcbOffsetY?: number | undefined;
108350
108350
  pcbRotation?: number | undefined;
108351
108351
  pcbPositionAnchor?: string | undefined;
108352
- pcbPositionMode?: "relative_to_group_anchor" | "auto" | "relative_to_board_anchor" | "relative_to_component_anchor" | undefined;
108352
+ pcbPositionMode?: "auto" | "relative_to_group_anchor" | "relative_to_board_anchor" | "relative_to_component_anchor" | undefined;
108353
108353
  shouldBeOnEdgeOfBoard?: boolean | undefined;
108354
108354
  pcbMarginTop?: number | undefined;
108355
108355
  pcbMarginRight?: number | undefined;
@@ -108418,7 +108418,7 @@ declare const pcbViaProps: z.ZodObject<{
108418
108418
  pcbOffsetY?: string | number | undefined;
108419
108419
  pcbRotation?: string | number | undefined;
108420
108420
  pcbPositionAnchor?: string | undefined;
108421
- pcbPositionMode?: "relative_to_group_anchor" | "auto" | "relative_to_board_anchor" | "relative_to_component_anchor" | undefined;
108421
+ pcbPositionMode?: "auto" | "relative_to_group_anchor" | "relative_to_board_anchor" | "relative_to_component_anchor" | undefined;
108422
108422
  shouldBeOnEdgeOfBoard?: boolean | undefined;
108423
108423
  pcbMarginTop?: string | number | undefined;
108424
108424
  pcbMarginRight?: string | number | undefined;
@@ -108609,7 +108609,7 @@ declare class PcbVia extends PrimitiveComponent<typeof pcbViaProps> {
108609
108609
  pcbOffsetY?: number | undefined;
108610
108610
  pcbRotation?: number | undefined;
108611
108611
  pcbPositionAnchor?: string | undefined;
108612
- pcbPositionMode?: "relative_to_group_anchor" | "auto" | "relative_to_board_anchor" | "relative_to_component_anchor" | undefined;
108612
+ pcbPositionMode?: "auto" | "relative_to_group_anchor" | "relative_to_board_anchor" | "relative_to_component_anchor" | undefined;
108613
108613
  shouldBeOnEdgeOfBoard?: boolean | undefined;
108614
108614
  pcbMarginTop?: number | undefined;
108615
108615
  pcbMarginRight?: number | undefined;
@@ -108678,7 +108678,7 @@ declare class PcbVia extends PrimitiveComponent<typeof pcbViaProps> {
108678
108678
  pcbOffsetY?: string | number | undefined;
108679
108679
  pcbRotation?: string | number | undefined;
108680
108680
  pcbPositionAnchor?: string | undefined;
108681
- pcbPositionMode?: "relative_to_group_anchor" | "auto" | "relative_to_board_anchor" | "relative_to_component_anchor" | undefined;
108681
+ pcbPositionMode?: "auto" | "relative_to_group_anchor" | "relative_to_board_anchor" | "relative_to_component_anchor" | undefined;
108682
108682
  shouldBeOnEdgeOfBoard?: boolean | undefined;
108683
108683
  pcbMarginTop?: string | number | undefined;
108684
108684
  pcbMarginRight?: string | number | undefined;
package/dist/index.js CHANGED
@@ -389,6 +389,35 @@ var mergeRoutes = (routes) => {
389
389
  // lib/components/primitive-components/Net.ts
390
390
  import { netProps } from "@tscircuit/props";
391
391
 
392
+ // lib/components/base-components/PrimitiveComponent/get-construction-props-schema.ts
393
+ var constructionSchemas = /* @__PURE__ */ new WeakMap();
394
+ var getConstructionPropsSchema = (schema) => {
395
+ let constructionSchema = constructionSchemas.get(schema);
396
+ if (!constructionSchema) {
397
+ constructionSchema = "partial" in schema ? schema.partial({ name: true }) : schema;
398
+ constructionSchemas.set(schema, constructionSchema);
399
+ }
400
+ return constructionSchema;
401
+ };
402
+
403
+ // lib/components/base-components/PrimitiveComponent/select-net-by-literal-selector.ts
404
+ var netsBySelectorByNets = /* @__PURE__ */ new WeakMap();
405
+ var selectNetByLiteralSelector = (nets, selector) => {
406
+ let netsBySelector = netsBySelectorByNets.get(nets);
407
+ if (!netsBySelector) {
408
+ netsBySelector = /* @__PURE__ */ new Map();
409
+ for (const net of nets) {
410
+ for (const alias of net.getNameAndAliases().join(" ").split(/\s+/)) {
411
+ const netSelector = `net.${alias}`;
412
+ if (!netsBySelector.has(netSelector))
413
+ netsBySelector.set(netSelector, net);
414
+ }
415
+ }
416
+ netsBySelectorByNets.set(nets, netsBySelector);
417
+ }
418
+ return netsBySelector.get(selector) ?? null;
419
+ };
420
+
392
421
  // lib/components/base-components/PrimitiveComponent/PrimitiveComponent.ts
393
422
  import { selectAll, selectOne } from "css-select";
394
423
  import "debug";
@@ -1557,9 +1586,7 @@ var PrimitiveComponent2 = class extends Renderable {
1557
1586
  this.childrenPendingRemoval = [];
1558
1587
  this.props = props ?? {};
1559
1588
  this.externallyAddedAliases = [];
1560
- const zodProps = "partial" in this.config.zodProps ? this.config.zodProps.partial({
1561
- name: true
1562
- }) : this.config.zodProps;
1589
+ const zodProps = getConstructionPropsSchema(this.config.zodProps);
1563
1590
  const parsePropsResult = zodProps.safeParse(props ?? {});
1564
1591
  if (parsePropsResult.success) {
1565
1592
  this._parsedProps = parsePropsResult.data;
@@ -2354,6 +2381,14 @@ var PrimitiveComponent2 = class extends Renderable {
2354
2381
  }
2355
2382
  _cachedSelectOneQueries = /* @__PURE__ */ new Map();
2356
2383
  selectOne(selectorRaw, options) {
2384
+ if (/^net\.[A-Za-z_][A-Za-z0-9_]*$/.test(selectorRaw)) {
2385
+ if (options?.port || options?.type && options.type !== "net")
2386
+ return null;
2387
+ return selectNetByLiteralSelector(
2388
+ this.selectAll("net"),
2389
+ selectorRaw
2390
+ );
2391
+ }
2357
2392
  if (this._cachedSelectOneQueries.has(selectorRaw)) {
2358
2393
  return this._cachedSelectOneQueries.get(selectorRaw);
2359
2394
  }
@@ -2718,24 +2753,6 @@ var Net = class extends PrimitiveComponent2 {
2718
2753
  };
2719
2754
 
2720
2755
  // lib/utils/components/createNetsFromProps.ts
2721
- var netSelectorsByNets = /* @__PURE__ */ new WeakMap();
2722
- var hasNet = (subcircuit, selector) => {
2723
- if (!/^net\.[A-Za-z_][A-Za-z0-9_]*$/.test(selector)) {
2724
- return Boolean(subcircuit.selectOne(selector));
2725
- }
2726
- const nets = subcircuit.selectAll("net");
2727
- let netSelectors = netSelectorsByNets.get(nets);
2728
- if (!netSelectors) {
2729
- netSelectors = /* @__PURE__ */ new Set();
2730
- for (const net of nets) {
2731
- for (const alias of net.getNameAndAliases().join(" ").split(/\s+/)) {
2732
- netSelectors.add(`net.${alias}`);
2733
- }
2734
- }
2735
- netSelectorsByNets.set(nets, netSelectors);
2736
- }
2737
- return netSelectors.has(selector);
2738
- };
2739
2756
  var createNetsFromProps = (component, props) => {
2740
2757
  for (const prop of props) {
2741
2758
  if (typeof prop === "string" && prop.startsWith("net.")) {
@@ -2756,7 +2773,7 @@ var createNetsFromProps = (component, props) => {
2756
2773
  );
2757
2774
  }
2758
2775
  const subcircuit = component.getSubcircuit();
2759
- if (!hasNet(subcircuit, prop)) {
2776
+ if (!subcircuit.selectOne(prop)) {
2760
2777
  const net = new Net({
2761
2778
  name: prop.split("net.")[1]
2762
2779
  });
@@ -63766,7 +63783,7 @@ function Group_getRoutingPhasePlans(group) {
63766
63783
  var package_default = {
63767
63784
  name: "@tscircuit/core",
63768
63785
  type: "module",
63769
- version: "0.0.1963",
63786
+ version: "0.0.1965",
63770
63787
  types: "dist/index.d.ts",
63771
63788
  main: "dist/index.js",
63772
63789
  module: "dist/index.js",
@@ -69436,6 +69453,7 @@ var findFloatingCopper = (circuitJson, generatedStitchingViaIds = /* @__PURE__ *
69436
69453
  var Board_doInitialPcbCopperPourCleanup = (board) => {
69437
69454
  if (!board.root || board.root.pcbDisabled) return;
69438
69455
  const { db } = board.root;
69456
+ if (db.pcb_copper_pour.list().length === 0) return;
69439
69457
  const circuitJson = db.subtree({ subcircuit_id: board.subcircuit_id }).toArray();
69440
69458
  if (db.pcb_autorouting_error.list().length > 0) return;
69441
69459
  if (!circuitJson.some((element) => element.type === "pcb_copper_pour")) return;
@@ -70079,6 +70097,10 @@ var Board = class extends Group5 {
70079
70097
  const pcbDisabled = this.root?.pcbDisabled;
70080
70098
  const schematicDisabled = this.root?.schematicDisabled;
70081
70099
  const drcChecksDisabled = this.root?.platform?.drcChecksDisabled ?? this.getInheritedProperty("drcChecksDisabled");
70100
+ if (drcChecksDisabled) {
70101
+ this._drcChecksComplete = true;
70102
+ return;
70103
+ }
70082
70104
  const netlistDrcChecksDisabled = this.root?.platform?.netlistDrcChecksDisabled ?? this.getInheritedProperty("netlistDrcChecksDisabled");
70083
70105
  const pinSpecificationDrcChecksDisabled = this.getInheritedProperty(
70084
70106
  "pinSpecificationDrcChecksDisabled"
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.1964",
4
+ "version": "0.0.1966",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",