@tscircuit/core 0.0.646 → 0.0.648
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 +164 -161
- package/dist/index.js +375 -308
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
2
|
var __export = (target, all) => {
|
|
4
3
|
for (var name in all)
|
|
5
4
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
6
5
|
};
|
|
7
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
8
6
|
|
|
9
7
|
// lib/components/index.ts
|
|
10
8
|
var components_exports = {};
|
|
@@ -125,18 +123,18 @@ var orderedRenderPhases = [
|
|
|
125
123
|
];
|
|
126
124
|
var globalRenderCounter = 0;
|
|
127
125
|
var Renderable = class {
|
|
126
|
+
renderPhaseStates;
|
|
127
|
+
shouldBeRemoved = false;
|
|
128
|
+
children;
|
|
129
|
+
/** PCB-only SMTPads, PlatedHoles, Holes, Silkscreen elements etc. */
|
|
130
|
+
isPcbPrimitive = false;
|
|
131
|
+
/** Schematic-only, lines, boxes, indicators etc. */
|
|
132
|
+
isSchematicPrimitive = false;
|
|
133
|
+
_renderId;
|
|
134
|
+
_currentRenderPhase = null;
|
|
135
|
+
_asyncEffects = [];
|
|
136
|
+
parent = null;
|
|
128
137
|
constructor(props) {
|
|
129
|
-
__publicField(this, "renderPhaseStates");
|
|
130
|
-
__publicField(this, "shouldBeRemoved", false);
|
|
131
|
-
__publicField(this, "children");
|
|
132
|
-
/** PCB-only SMTPads, PlatedHoles, Holes, Silkscreen elements etc. */
|
|
133
|
-
__publicField(this, "isPcbPrimitive", false);
|
|
134
|
-
/** Schematic-only, lines, boxes, indicators etc. */
|
|
135
|
-
__publicField(this, "isSchematicPrimitive", false);
|
|
136
|
-
__publicField(this, "_renderId");
|
|
137
|
-
__publicField(this, "_currentRenderPhase", null);
|
|
138
|
-
__publicField(this, "_asyncEffects", []);
|
|
139
|
-
__publicField(this, "parent", null);
|
|
140
138
|
this._renderId = `${globalRenderCounter++}`;
|
|
141
139
|
this.children = [];
|
|
142
140
|
this.renderPhaseStates = {};
|
|
@@ -540,58 +538,17 @@ var cssSelectOptionsInsideSubcircuit = {
|
|
|
540
538
|
cacheResults: true
|
|
541
539
|
};
|
|
542
540
|
var PrimitiveComponent2 = class extends Renderable {
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
__publicField(this, "children");
|
|
547
|
-
__publicField(this, "childrenPendingRemoval");
|
|
548
|
-
__publicField(this, "props");
|
|
549
|
-
__publicField(this, "_parsedProps");
|
|
550
|
-
__publicField(this, "externallyAddedAliases");
|
|
551
|
-
/**
|
|
552
|
-
* A primitive container is a component that contains one or more ports and
|
|
553
|
-
* primitive components that are designed to interact.
|
|
554
|
-
*
|
|
555
|
-
* For example a resistor contains ports and smtpads that interact, so the
|
|
556
|
-
* resistor is a primitive container. Inside a primitive container, the ports
|
|
557
|
-
* and pads are likely to reference each other and look for eachother during
|
|
558
|
-
* the port matching phase.
|
|
559
|
-
*
|
|
560
|
-
*/
|
|
561
|
-
__publicField(this, "isPrimitiveContainer", false);
|
|
562
|
-
__publicField(this, "canHaveTextChildren", false);
|
|
563
|
-
__publicField(this, "source_group_id", null);
|
|
564
|
-
__publicField(this, "source_component_id", null);
|
|
565
|
-
__publicField(this, "schematic_component_id", null);
|
|
566
|
-
__publicField(this, "pcb_component_id", null);
|
|
567
|
-
__publicField(this, "cad_component_id", null);
|
|
568
|
-
__publicField(this, "fallbackUnassignedName");
|
|
569
|
-
__publicField(this, "_cachedSelectAllQueries", /* @__PURE__ */ new Map());
|
|
570
|
-
__publicField(this, "_cachedSelectOneQueries", /* @__PURE__ */ new Map());
|
|
571
|
-
this.children = [];
|
|
572
|
-
this.childrenPendingRemoval = [];
|
|
573
|
-
this.props = props ?? {};
|
|
574
|
-
this.externallyAddedAliases = [];
|
|
575
|
-
const zodProps = "partial" in this.config.zodProps ? this.config.zodProps.partial({
|
|
576
|
-
name: true
|
|
577
|
-
}) : this.config.zodProps;
|
|
578
|
-
const parsePropsResult = zodProps.safeParse(props ?? {});
|
|
579
|
-
if (parsePropsResult.success) {
|
|
580
|
-
this._parsedProps = parsePropsResult.data;
|
|
581
|
-
} else {
|
|
582
|
-
throw new InvalidProps(
|
|
583
|
-
this.lowercaseComponentName,
|
|
584
|
-
this.props,
|
|
585
|
-
parsePropsResult.error.format()
|
|
586
|
-
);
|
|
587
|
-
}
|
|
588
|
-
}
|
|
541
|
+
parent = null;
|
|
542
|
+
children;
|
|
543
|
+
childrenPendingRemoval;
|
|
589
544
|
get config() {
|
|
590
545
|
return {
|
|
591
546
|
componentName: "",
|
|
592
547
|
zodProps: z.object({}).passthrough()
|
|
593
548
|
};
|
|
594
549
|
}
|
|
550
|
+
props;
|
|
551
|
+
_parsedProps;
|
|
595
552
|
get componentName() {
|
|
596
553
|
return this.config.componentName;
|
|
597
554
|
}
|
|
@@ -611,6 +568,7 @@ var PrimitiveComponent2 = class extends Renderable {
|
|
|
611
568
|
get lowercaseComponentName() {
|
|
612
569
|
return this.componentName.toLowerCase();
|
|
613
570
|
}
|
|
571
|
+
externallyAddedAliases;
|
|
614
572
|
/**
|
|
615
573
|
* An subcircuit is self-contained. All the selectors inside
|
|
616
574
|
* a subcircuit are relative to the subcircuit group. You can have multiple
|
|
@@ -626,6 +584,44 @@ var PrimitiveComponent2 = class extends Renderable {
|
|
|
626
584
|
get name() {
|
|
627
585
|
return this._parsedProps.name ?? this.fallbackUnassignedName;
|
|
628
586
|
}
|
|
587
|
+
/**
|
|
588
|
+
* A primitive container is a component that contains one or more ports and
|
|
589
|
+
* primitive components that are designed to interact.
|
|
590
|
+
*
|
|
591
|
+
* For example a resistor contains ports and smtpads that interact, so the
|
|
592
|
+
* resistor is a primitive container. Inside a primitive container, the ports
|
|
593
|
+
* and pads are likely to reference each other and look for eachother during
|
|
594
|
+
* the port matching phase.
|
|
595
|
+
*
|
|
596
|
+
*/
|
|
597
|
+
isPrimitiveContainer = false;
|
|
598
|
+
canHaveTextChildren = false;
|
|
599
|
+
source_group_id = null;
|
|
600
|
+
source_component_id = null;
|
|
601
|
+
schematic_component_id = null;
|
|
602
|
+
pcb_component_id = null;
|
|
603
|
+
cad_component_id = null;
|
|
604
|
+
fallbackUnassignedName;
|
|
605
|
+
constructor(props) {
|
|
606
|
+
super(props);
|
|
607
|
+
this.children = [];
|
|
608
|
+
this.childrenPendingRemoval = [];
|
|
609
|
+
this.props = props ?? {};
|
|
610
|
+
this.externallyAddedAliases = [];
|
|
611
|
+
const zodProps = "partial" in this.config.zodProps ? this.config.zodProps.partial({
|
|
612
|
+
name: true
|
|
613
|
+
}) : this.config.zodProps;
|
|
614
|
+
const parsePropsResult = zodProps.safeParse(props ?? {});
|
|
615
|
+
if (parsePropsResult.success) {
|
|
616
|
+
this._parsedProps = parsePropsResult.data;
|
|
617
|
+
} else {
|
|
618
|
+
throw new InvalidProps(
|
|
619
|
+
this.lowercaseComponentName,
|
|
620
|
+
this.props,
|
|
621
|
+
parsePropsResult.error.format()
|
|
622
|
+
);
|
|
623
|
+
}
|
|
624
|
+
}
|
|
629
625
|
setProps(props) {
|
|
630
626
|
const newProps = this.config.zodProps.parse({
|
|
631
627
|
...this.props,
|
|
@@ -1033,6 +1029,7 @@ var PrimitiveComponent2 = class extends Renderable {
|
|
|
1033
1029
|
}
|
|
1034
1030
|
}
|
|
1035
1031
|
}
|
|
1032
|
+
_cachedSelectAllQueries = /* @__PURE__ */ new Map();
|
|
1036
1033
|
selectAll(selectorRaw) {
|
|
1037
1034
|
if (this._cachedSelectAllQueries.has(selectorRaw)) {
|
|
1038
1035
|
return this._cachedSelectAllQueries.get(
|
|
@@ -1054,6 +1051,7 @@ var PrimitiveComponent2 = class extends Renderable {
|
|
|
1054
1051
|
this._cachedSelectAllQueries.set(selectorRaw, result2);
|
|
1055
1052
|
return result2;
|
|
1056
1053
|
}
|
|
1054
|
+
_cachedSelectOneQueries = /* @__PURE__ */ new Map();
|
|
1057
1055
|
selectOne(selectorRaw, options) {
|
|
1058
1056
|
if (this._cachedSelectOneQueries.has(selectorRaw)) {
|
|
1059
1057
|
return this._cachedSelectOneQueries.get(selectorRaw);
|
|
@@ -1073,11 +1071,11 @@ var PrimitiveComponent2 = class extends Renderable {
|
|
|
1073
1071
|
(n) => n.lowercaseComponentName === options.type
|
|
1074
1072
|
);
|
|
1075
1073
|
}
|
|
1076
|
-
result
|
|
1074
|
+
result ??= selectOne(
|
|
1077
1075
|
selector,
|
|
1078
1076
|
this,
|
|
1079
1077
|
cssSelectOptionsInsideSubcircuit
|
|
1080
|
-
)
|
|
1078
|
+
);
|
|
1081
1079
|
if (result) {
|
|
1082
1080
|
this._cachedSelectOneQueries.set(selectorRaw, result);
|
|
1083
1081
|
return result;
|
|
@@ -1503,10 +1501,7 @@ var netProps = z4.object({
|
|
|
1503
1501
|
)
|
|
1504
1502
|
});
|
|
1505
1503
|
var Net = class extends PrimitiveComponent2 {
|
|
1506
|
-
|
|
1507
|
-
super(...arguments);
|
|
1508
|
-
__publicField(this, "source_net_id");
|
|
1509
|
-
}
|
|
1504
|
+
source_net_id;
|
|
1510
1505
|
get config() {
|
|
1511
1506
|
return {
|
|
1512
1507
|
componentName: "Net",
|
|
@@ -1711,12 +1706,9 @@ var createNetsFromProps = (component, props) => {
|
|
|
1711
1706
|
import { smtPadProps } from "@tscircuit/props";
|
|
1712
1707
|
import { decomposeTSR } from "transformation-matrix";
|
|
1713
1708
|
var SmtPad = class extends PrimitiveComponent2 {
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
__publicField(this, "matchedPort", null);
|
|
1718
|
-
__publicField(this, "isPcbPrimitive", true);
|
|
1719
|
-
}
|
|
1709
|
+
pcb_smtpad_id = null;
|
|
1710
|
+
matchedPort = null;
|
|
1711
|
+
isPcbPrimitive = true;
|
|
1720
1712
|
get config() {
|
|
1721
1713
|
return {
|
|
1722
1714
|
componentName: "SmtPad",
|
|
@@ -1974,11 +1966,8 @@ var SmtPad = class extends PrimitiveComponent2 {
|
|
|
1974
1966
|
import { silkscreenPathProps } from "@tscircuit/props";
|
|
1975
1967
|
import { applyToPoint as applyToPoint2 } from "transformation-matrix";
|
|
1976
1968
|
var SilkscreenPath = class extends PrimitiveComponent2 {
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
__publicField(this, "pcb_silkscreen_path_id", null);
|
|
1980
|
-
__publicField(this, "isPcbPrimitive", true);
|
|
1981
|
-
}
|
|
1969
|
+
pcb_silkscreen_path_id = null;
|
|
1970
|
+
isPcbPrimitive = true;
|
|
1982
1971
|
get config() {
|
|
1983
1972
|
return {
|
|
1984
1973
|
componentName: "SilkscreenPath",
|
|
@@ -2073,11 +2062,8 @@ var pcbTraceProps = z5.object({
|
|
|
2073
2062
|
source_trace_id: z5.string().optional()
|
|
2074
2063
|
});
|
|
2075
2064
|
var PcbTrace = class extends PrimitiveComponent2 {
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
__publicField(this, "pcb_trace_id", null);
|
|
2079
|
-
__publicField(this, "isPcbPrimitive", true);
|
|
2080
|
-
}
|
|
2065
|
+
pcb_trace_id = null;
|
|
2066
|
+
isPcbPrimitive = true;
|
|
2081
2067
|
get config() {
|
|
2082
2068
|
return {
|
|
2083
2069
|
componentName: "PcbTrace",
|
|
@@ -2144,12 +2130,9 @@ var PcbTrace = class extends PrimitiveComponent2 {
|
|
|
2144
2130
|
// lib/components/primitive-components/PlatedHole.ts
|
|
2145
2131
|
import { platedHoleProps } from "@tscircuit/props";
|
|
2146
2132
|
var PlatedHole = class extends PrimitiveComponent2 {
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
__publicField(this, "matchedPort", null);
|
|
2151
|
-
__publicField(this, "isPcbPrimitive", true);
|
|
2152
|
-
}
|
|
2133
|
+
pcb_plated_hole_id = null;
|
|
2134
|
+
matchedPort = null;
|
|
2135
|
+
isPcbPrimitive = true;
|
|
2153
2136
|
get config() {
|
|
2154
2137
|
return {
|
|
2155
2138
|
componentName: "PlatedHole",
|
|
@@ -2372,11 +2355,8 @@ var PlatedHole = class extends PrimitiveComponent2 {
|
|
|
2372
2355
|
import { pcbKeepoutProps } from "@tscircuit/props";
|
|
2373
2356
|
import { decomposeTSR as decomposeTSR2 } from "transformation-matrix";
|
|
2374
2357
|
var Keepout = class extends PrimitiveComponent2 {
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
__publicField(this, "pcb_keepout_id", null);
|
|
2378
|
-
__publicField(this, "isPcbPrimitive", true);
|
|
2379
|
-
}
|
|
2358
|
+
pcb_keepout_id = null;
|
|
2359
|
+
isPcbPrimitive = true;
|
|
2380
2360
|
get config() {
|
|
2381
2361
|
return {
|
|
2382
2362
|
componentName: "Keepout",
|
|
@@ -2430,11 +2410,8 @@ var Keepout = class extends PrimitiveComponent2 {
|
|
|
2430
2410
|
// lib/components/primitive-components/Hole.ts
|
|
2431
2411
|
import { holeProps } from "@tscircuit/props";
|
|
2432
2412
|
var Hole = class extends PrimitiveComponent2 {
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
__publicField(this, "pcb_hole_id", null);
|
|
2436
|
-
__publicField(this, "isPcbPrimitive", true);
|
|
2437
|
-
}
|
|
2413
|
+
pcb_hole_id = null;
|
|
2414
|
+
isPcbPrimitive = true;
|
|
2438
2415
|
get config() {
|
|
2439
2416
|
return {
|
|
2440
2417
|
componentName: "Hole",
|
|
@@ -2490,10 +2467,7 @@ var Hole = class extends PrimitiveComponent2 {
|
|
|
2490
2467
|
// lib/components/primitive-components/SilkscreenText.ts
|
|
2491
2468
|
import { silkscreenTextProps } from "@tscircuit/props";
|
|
2492
2469
|
var SilkscreenText = class extends PrimitiveComponent2 {
|
|
2493
|
-
|
|
2494
|
-
super(...arguments);
|
|
2495
|
-
__publicField(this, "isPcbPrimitive", true);
|
|
2496
|
-
}
|
|
2470
|
+
isPcbPrimitive = true;
|
|
2497
2471
|
get config() {
|
|
2498
2472
|
return {
|
|
2499
2473
|
componentName: "SilkscreenText",
|
|
@@ -2543,11 +2517,8 @@ var SilkscreenText = class extends PrimitiveComponent2 {
|
|
|
2543
2517
|
import { applyToPoint as applyToPoint4 } from "transformation-matrix";
|
|
2544
2518
|
import { cutoutProps } from "@tscircuit/props";
|
|
2545
2519
|
var Cutout = class extends PrimitiveComponent2 {
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
__publicField(this, "pcb_cutout_id", null);
|
|
2549
|
-
__publicField(this, "isPcbPrimitive", true);
|
|
2550
|
-
}
|
|
2520
|
+
pcb_cutout_id = null;
|
|
2521
|
+
isPcbPrimitive = true;
|
|
2551
2522
|
get config() {
|
|
2552
2523
|
return {
|
|
2553
2524
|
componentName: "Cutout",
|
|
@@ -3010,6 +2981,19 @@ var portProps = z6.object({
|
|
|
3010
2981
|
aliases: z6.array(z6.string()).optional()
|
|
3011
2982
|
});
|
|
3012
2983
|
var Port = class extends PrimitiveComponent2 {
|
|
2984
|
+
source_port_id = null;
|
|
2985
|
+
pcb_port_id = null;
|
|
2986
|
+
schematic_port_id = null;
|
|
2987
|
+
schematicSymbolPortDef = null;
|
|
2988
|
+
matchedComponents;
|
|
2989
|
+
facingDirection = null;
|
|
2990
|
+
originDescription = null;
|
|
2991
|
+
get config() {
|
|
2992
|
+
return {
|
|
2993
|
+
componentName: "Port",
|
|
2994
|
+
zodProps: portProps
|
|
2995
|
+
};
|
|
2996
|
+
}
|
|
3013
2997
|
constructor(props, opts = {}) {
|
|
3014
2998
|
if (!props.name && props.pinNumber !== void 0)
|
|
3015
2999
|
props.name = `pin${props.pinNumber}`;
|
|
@@ -3017,24 +3001,11 @@ var Port = class extends PrimitiveComponent2 {
|
|
|
3017
3001
|
throw new Error("Port must have a name or a pinNumber");
|
|
3018
3002
|
}
|
|
3019
3003
|
super(props);
|
|
3020
|
-
__publicField(this, "source_port_id", null);
|
|
3021
|
-
__publicField(this, "pcb_port_id", null);
|
|
3022
|
-
__publicField(this, "schematic_port_id", null);
|
|
3023
|
-
__publicField(this, "schematicSymbolPortDef", null);
|
|
3024
|
-
__publicField(this, "matchedComponents");
|
|
3025
|
-
__publicField(this, "facingDirection", null);
|
|
3026
|
-
__publicField(this, "originDescription", null);
|
|
3027
3004
|
if (opts.originDescription) {
|
|
3028
3005
|
this.originDescription = opts.originDescription;
|
|
3029
3006
|
}
|
|
3030
3007
|
this.matchedComponents = [];
|
|
3031
3008
|
}
|
|
3032
|
-
get config() {
|
|
3033
|
-
return {
|
|
3034
|
-
componentName: "Port",
|
|
3035
|
-
zodProps: portProps
|
|
3036
|
-
};
|
|
3037
|
-
}
|
|
3038
3009
|
_getGlobalPcbPositionBeforeLayout() {
|
|
3039
3010
|
const matchedPcbElm = this.matchedComponents.find((c) => c.isPcbPrimitive);
|
|
3040
3011
|
const parentComponent = this.parent;
|
|
@@ -3904,8 +3875,8 @@ import "circuit-json-to-connectivity-map";
|
|
|
3904
3875
|
|
|
3905
3876
|
// lib/utils/autorouting/DirectLineRouter.ts
|
|
3906
3877
|
var DirectLineRouter = class {
|
|
3878
|
+
input;
|
|
3907
3879
|
constructor({ input }) {
|
|
3908
|
-
__publicField(this, "input");
|
|
3909
3880
|
this.input = input;
|
|
3910
3881
|
}
|
|
3911
3882
|
solveAndMapToTraces() {
|
|
@@ -5071,7 +5042,7 @@ var convertFacingDirectionToElbowDirection = (facingDirection) => {
|
|
|
5071
5042
|
};
|
|
5072
5043
|
|
|
5073
5044
|
// lib/errors/AutorouterError.ts
|
|
5074
|
-
import packageJson from "@tscircuit/capacity-autorouter/package.json";
|
|
5045
|
+
import packageJson from "@tscircuit/capacity-autorouter/package.json" with { type: "json" };
|
|
5075
5046
|
var autorouterVersion = packageJson.version ?? "unknown";
|
|
5076
5047
|
var AutorouterError = class extends Error {
|
|
5077
5048
|
constructor(message) {
|
|
@@ -5973,15 +5944,15 @@ function Trace__findConnectedPorts(trace) {
|
|
|
5973
5944
|
|
|
5974
5945
|
// lib/components/primitive-components/Trace/Trace.ts
|
|
5975
5946
|
var Trace3 = class extends PrimitiveComponent2 {
|
|
5947
|
+
source_trace_id = null;
|
|
5948
|
+
pcb_trace_id = null;
|
|
5949
|
+
schematic_trace_id = null;
|
|
5950
|
+
_portsRoutedOnPcb;
|
|
5951
|
+
subcircuit_connectivity_map_key = null;
|
|
5952
|
+
_traceConnectionHash = null;
|
|
5953
|
+
_couldNotFindPort;
|
|
5976
5954
|
constructor(props) {
|
|
5977
5955
|
super(props);
|
|
5978
|
-
__publicField(this, "source_trace_id", null);
|
|
5979
|
-
__publicField(this, "pcb_trace_id", null);
|
|
5980
|
-
__publicField(this, "schematic_trace_id", null);
|
|
5981
|
-
__publicField(this, "_portsRoutedOnPcb");
|
|
5982
|
-
__publicField(this, "subcircuit_connectivity_map_key", null);
|
|
5983
|
-
__publicField(this, "_traceConnectionHash", null);
|
|
5984
|
-
__publicField(this, "_couldNotFindPort");
|
|
5985
5956
|
this._portsRoutedOnPcb = [];
|
|
5986
5957
|
}
|
|
5987
5958
|
get config() {
|
|
@@ -6201,17 +6172,12 @@ var rotation3 = z8.object({
|
|
|
6201
6172
|
z: rotation
|
|
6202
6173
|
});
|
|
6203
6174
|
var NormalComponent = class extends PrimitiveComponent2 {
|
|
6204
|
-
|
|
6205
|
-
|
|
6206
|
-
|
|
6207
|
-
|
|
6208
|
-
|
|
6209
|
-
|
|
6210
|
-
__publicField(this, "pcb_missing_footprint_error_id");
|
|
6211
|
-
__publicField(this, "_hasStartedFootprintUrlLoad", false);
|
|
6212
|
-
this._addChildrenFromStringFootprint();
|
|
6213
|
-
this.initPorts();
|
|
6214
|
-
}
|
|
6175
|
+
reactSubtrees = [];
|
|
6176
|
+
_impliedFootprint;
|
|
6177
|
+
isPrimitiveContainer = true;
|
|
6178
|
+
_asyncSupplierPartNumbers;
|
|
6179
|
+
pcb_missing_footprint_error_id;
|
|
6180
|
+
_hasStartedFootprintUrlLoad = false;
|
|
6215
6181
|
/**
|
|
6216
6182
|
* Override this property for component defaults
|
|
6217
6183
|
*/
|
|
@@ -6226,6 +6192,11 @@ var NormalComponent = class extends PrimitiveComponent2 {
|
|
|
6226
6192
|
)
|
|
6227
6193
|
);
|
|
6228
6194
|
}
|
|
6195
|
+
constructor(props) {
|
|
6196
|
+
super(props);
|
|
6197
|
+
this._addChildrenFromStringFootprint();
|
|
6198
|
+
this.initPorts();
|
|
6199
|
+
}
|
|
6229
6200
|
/**
|
|
6230
6201
|
* Override this method for better control over the auto-discovery of ports.
|
|
6231
6202
|
*
|
|
@@ -6416,7 +6387,7 @@ var NormalComponent = class extends PrimitiveComponent2 {
|
|
|
6416
6387
|
_addChildrenFromStringFootprint() {
|
|
6417
6388
|
const { pcbRotation, pinLabels, pcbPinLabels } = this.props;
|
|
6418
6389
|
let { footprint } = this.props;
|
|
6419
|
-
footprint
|
|
6390
|
+
footprint ??= this._getImpliedFootprintString?.();
|
|
6420
6391
|
if (!footprint) return;
|
|
6421
6392
|
if (typeof footprint === "string") {
|
|
6422
6393
|
if (this._isFootprintUrl(footprint)) return;
|
|
@@ -6672,7 +6643,7 @@ var NormalComponent = class extends PrimitiveComponent2 {
|
|
|
6672
6643
|
}
|
|
6673
6644
|
doInitialPcbFootprintStringRender() {
|
|
6674
6645
|
let { footprint } = this.props;
|
|
6675
|
-
footprint
|
|
6646
|
+
footprint ??= this._getImpliedFootprintString?.();
|
|
6676
6647
|
if (!footprint) return;
|
|
6677
6648
|
const { pcbRotation, pinLabels, pcbPinLabels } = this.props;
|
|
6678
6649
|
if (typeof footprint === "string" && this._isFootprintUrl(footprint)) {
|
|
@@ -7073,18 +7044,18 @@ import {
|
|
|
7073
7044
|
// lib/utils/autorouting/CapacityMeshAutorouter.ts
|
|
7074
7045
|
import { CapacityMeshSolver } from "@tscircuit/capacity-autorouter";
|
|
7075
7046
|
var CapacityMeshAutorouter = class {
|
|
7047
|
+
input;
|
|
7048
|
+
isRouting = false;
|
|
7049
|
+
solver;
|
|
7050
|
+
eventHandlers = {
|
|
7051
|
+
complete: [],
|
|
7052
|
+
error: [],
|
|
7053
|
+
progress: []
|
|
7054
|
+
};
|
|
7055
|
+
cycleCount = 0;
|
|
7056
|
+
stepDelay;
|
|
7057
|
+
timeoutId;
|
|
7076
7058
|
constructor(input, options = {}) {
|
|
7077
|
-
__publicField(this, "input");
|
|
7078
|
-
__publicField(this, "isRouting", false);
|
|
7079
|
-
__publicField(this, "solver");
|
|
7080
|
-
__publicField(this, "eventHandlers", {
|
|
7081
|
-
complete: [],
|
|
7082
|
-
error: [],
|
|
7083
|
-
progress: []
|
|
7084
|
-
});
|
|
7085
|
-
__publicField(this, "cycleCount", 0);
|
|
7086
|
-
__publicField(this, "stepDelay");
|
|
7087
|
-
__publicField(this, "timeoutId");
|
|
7088
7059
|
this.input = input;
|
|
7089
7060
|
const { capacityDepth, targetMinCapacity, stepDelay = 0 } = options;
|
|
7090
7061
|
this.solver = new CapacityMeshSolver(input, {
|
|
@@ -7227,10 +7198,7 @@ import "zod";
|
|
|
7227
7198
|
import { traceHintProps } from "@tscircuit/props";
|
|
7228
7199
|
import { applyToPoint as applyToPoint6 } from "transformation-matrix";
|
|
7229
7200
|
var TraceHint = class extends PrimitiveComponent2 {
|
|
7230
|
-
|
|
7231
|
-
super(...arguments);
|
|
7232
|
-
__publicField(this, "matchedPort", null);
|
|
7233
|
-
}
|
|
7201
|
+
matchedPort = null;
|
|
7234
7202
|
get config() {
|
|
7235
7203
|
return {
|
|
7236
7204
|
componentName: "TraceHint",
|
|
@@ -7744,7 +7712,7 @@ var getSimpleRouteJsonFromCircuitJson = ({
|
|
|
7744
7712
|
if (!conn) continue;
|
|
7745
7713
|
if (![...tracePortIds].every((pid) => pointIdToConn.get(pid) === conn))
|
|
7746
7714
|
continue;
|
|
7747
|
-
conn.externallyConnectedPointIds
|
|
7715
|
+
conn.externallyConnectedPointIds ??= [];
|
|
7748
7716
|
conn.externallyConnectedPointIds.push([...tracePortIds]);
|
|
7749
7717
|
}
|
|
7750
7718
|
return {
|
|
@@ -10095,6 +10063,13 @@ function applyNetLabelPlacements(args) {
|
|
|
10095
10063
|
continue;
|
|
10096
10064
|
}
|
|
10097
10065
|
const text = sourceNet.name;
|
|
10066
|
+
const hasExistingLabelForNet = db.schematic_net_label.list().some((nl) => {
|
|
10067
|
+
if (sourceNet?.source_net_id && nl.source_net_id) {
|
|
10068
|
+
return nl.source_net_id === sourceNet.source_net_id;
|
|
10069
|
+
}
|
|
10070
|
+
return nl.text === text;
|
|
10071
|
+
});
|
|
10072
|
+
if (hasExistingLabelForNet) continue;
|
|
10098
10073
|
const center = placement.center ?? computeSchematicNetLabelCenter({
|
|
10099
10074
|
anchor_position,
|
|
10100
10075
|
anchor_side,
|
|
@@ -10166,6 +10141,13 @@ var insertNetLabelsForPortsMissingTrace = ({
|
|
|
10166
10141
|
if (!sourceNet) {
|
|
10167
10142
|
continue;
|
|
10168
10143
|
}
|
|
10144
|
+
const hasLabelForNet = db.schematic_net_label.list().some((nl) => {
|
|
10145
|
+
if (sourceNet.source_net_id && nl.source_net_id) {
|
|
10146
|
+
return nl.source_net_id === sourceNet.source_net_id;
|
|
10147
|
+
}
|
|
10148
|
+
return nl.text === (sourceNet.name || key);
|
|
10149
|
+
});
|
|
10150
|
+
if (hasLabelForNet) continue;
|
|
10169
10151
|
const existingAtPort = db.schematic_net_label.list().some((nl) => {
|
|
10170
10152
|
const samePos = Math.abs(nl.anchor_position.x - sp.center.x) < 1e-6 && Math.abs(nl.anchor_position.y - sp.center.y) < 1e-6;
|
|
10171
10153
|
if (!samePos) return false;
|
|
@@ -10247,15 +10229,11 @@ var Group_doInitialSchematicTraceRender = (group) => {
|
|
|
10247
10229
|
|
|
10248
10230
|
// lib/components/primitive-components/Group/Group.ts
|
|
10249
10231
|
var Group6 = class extends NormalComponent {
|
|
10250
|
-
|
|
10251
|
-
|
|
10252
|
-
|
|
10253
|
-
|
|
10254
|
-
|
|
10255
|
-
__publicField(this, "_hasStartedAsyncAutorouting", false);
|
|
10256
|
-
__publicField(this, "_asyncAutoroutingResult", null);
|
|
10257
|
-
__publicField(this, "unnamedElementCounter", {});
|
|
10258
|
-
}
|
|
10232
|
+
pcb_group_id = null;
|
|
10233
|
+
schematic_group_id = null;
|
|
10234
|
+
subcircuit_id = null;
|
|
10235
|
+
_hasStartedAsyncAutorouting = false;
|
|
10236
|
+
_asyncAutoroutingResult = null;
|
|
10259
10237
|
get config() {
|
|
10260
10238
|
return {
|
|
10261
10239
|
zodProps: groupProps,
|
|
@@ -10352,9 +10330,9 @@ var Group6 = class extends NormalComponent {
|
|
|
10352
10330
|
});
|
|
10353
10331
|
}
|
|
10354
10332
|
}
|
|
10333
|
+
unnamedElementCounter = {};
|
|
10355
10334
|
getNextAvailableName(elm) {
|
|
10356
|
-
|
|
10357
|
-
(_a = this.unnamedElementCounter)[_b = elm.lowercaseComponentName] ?? (_a[_b] = 1);
|
|
10335
|
+
this.unnamedElementCounter[elm.lowercaseComponentName] ??= 1;
|
|
10358
10336
|
return `unnamed_${elm.lowercaseComponentName}${this.unnamedElementCounter[elm.lowercaseComponentName]++}`;
|
|
10359
10337
|
}
|
|
10360
10338
|
_resolvePcbPadding() {
|
|
@@ -10986,12 +10964,9 @@ import {
|
|
|
10986
10964
|
checkEachPcbTraceNonOverlapping
|
|
10987
10965
|
} from "@tscircuit/checks";
|
|
10988
10966
|
var Board = class extends Group6 {
|
|
10989
|
-
|
|
10990
|
-
|
|
10991
|
-
|
|
10992
|
-
__publicField(this, "_drcChecksComplete", false);
|
|
10993
|
-
__publicField(this, "_connectedSchematicPortPairs", /* @__PURE__ */ new Set());
|
|
10994
|
-
}
|
|
10967
|
+
pcb_board_id = null;
|
|
10968
|
+
_drcChecksComplete = false;
|
|
10969
|
+
_connectedSchematicPortPairs = /* @__PURE__ */ new Set();
|
|
10995
10970
|
get isSubcircuit() {
|
|
10996
10971
|
return true;
|
|
10997
10972
|
}
|
|
@@ -11271,16 +11246,72 @@ var Capacitor = class extends NormalComponent {
|
|
|
11271
11246
|
};
|
|
11272
11247
|
|
|
11273
11248
|
// lib/components/normal-components/Chip.ts
|
|
11249
|
+
import { chipProps as chipProps2 } from "@tscircuit/props";
|
|
11250
|
+
|
|
11251
|
+
// lib/utils/filterPinLabels.ts
|
|
11274
11252
|
import { chipProps } from "@tscircuit/props";
|
|
11253
|
+
function filterPinLabels(pinLabels) {
|
|
11254
|
+
if (!pinLabels)
|
|
11255
|
+
return {
|
|
11256
|
+
validPinLabels: pinLabels,
|
|
11257
|
+
invalidPinLabelsMessages: []
|
|
11258
|
+
};
|
|
11259
|
+
const validPinLabels = {};
|
|
11260
|
+
const invalidPinLabelsMessages = [];
|
|
11261
|
+
for (const [pin, labelOrLabels] of Object.entries(pinLabels)) {
|
|
11262
|
+
const labels = Array.isArray(labelOrLabels) ? labelOrLabels.slice() : [labelOrLabels];
|
|
11263
|
+
const validLabels = [];
|
|
11264
|
+
for (const label of labels) {
|
|
11265
|
+
if (isValidPinLabel(pin, label)) {
|
|
11266
|
+
validLabels.push(label);
|
|
11267
|
+
} else {
|
|
11268
|
+
invalidPinLabelsMessages.push(
|
|
11269
|
+
`Invalid pin label: ${pin} = '${label}' - excluding from component. Please use a valid pin label.`
|
|
11270
|
+
);
|
|
11271
|
+
}
|
|
11272
|
+
}
|
|
11273
|
+
if (validLabels.length > 0) {
|
|
11274
|
+
validPinLabels[pin] = Array.isArray(labelOrLabels) ? validLabels : validLabels[0];
|
|
11275
|
+
}
|
|
11276
|
+
}
|
|
11277
|
+
return {
|
|
11278
|
+
validPinLabels: Object.keys(validPinLabels).length > 0 ? validPinLabels : void 0,
|
|
11279
|
+
invalidPinLabelsMessages
|
|
11280
|
+
};
|
|
11281
|
+
}
|
|
11282
|
+
function isValidPinLabel(pin, label) {
|
|
11283
|
+
try {
|
|
11284
|
+
const testProps = {
|
|
11285
|
+
name: "test",
|
|
11286
|
+
footprint: "test",
|
|
11287
|
+
pinLabels: { [pin]: label }
|
|
11288
|
+
};
|
|
11289
|
+
const result = chipProps.safeParse(testProps);
|
|
11290
|
+
return result.success;
|
|
11291
|
+
} catch (error) {
|
|
11292
|
+
return false;
|
|
11293
|
+
}
|
|
11294
|
+
}
|
|
11295
|
+
|
|
11296
|
+
// lib/components/normal-components/Chip.ts
|
|
11275
11297
|
var Chip = class extends NormalComponent {
|
|
11276
|
-
|
|
11277
|
-
|
|
11278
|
-
|
|
11298
|
+
schematicBoxDimensions = null;
|
|
11299
|
+
_invalidPinLabelMessages = [];
|
|
11300
|
+
constructor(props) {
|
|
11301
|
+
const filteredProps = { ...props };
|
|
11302
|
+
let invalidPinLabelsMessages = [];
|
|
11303
|
+
if (filteredProps.pinLabels) {
|
|
11304
|
+
const { validPinLabels, invalidPinLabelsMessages: messages } = filterPinLabels(filteredProps.pinLabels);
|
|
11305
|
+
filteredProps.pinLabels = validPinLabels;
|
|
11306
|
+
invalidPinLabelsMessages = messages;
|
|
11307
|
+
}
|
|
11308
|
+
super(filteredProps);
|
|
11309
|
+
this._invalidPinLabelMessages = invalidPinLabelsMessages;
|
|
11279
11310
|
}
|
|
11280
11311
|
get config() {
|
|
11281
11312
|
return {
|
|
11282
11313
|
componentName: "Chip",
|
|
11283
|
-
zodProps:
|
|
11314
|
+
zodProps: chipProps2,
|
|
11284
11315
|
shouldRenderAsSchematicBox: true
|
|
11285
11316
|
};
|
|
11286
11317
|
}
|
|
@@ -11322,6 +11353,24 @@ var Chip = class extends NormalComponent {
|
|
|
11322
11353
|
doInitialSchematicComponentRender() {
|
|
11323
11354
|
const { _parsedProps: props } = this;
|
|
11324
11355
|
if (props?.noSchematicRepresentation === true) return;
|
|
11356
|
+
if (this._invalidPinLabelMessages?.length && this.root?.db) {
|
|
11357
|
+
for (const message of this._invalidPinLabelMessages) {
|
|
11358
|
+
let property_name = "pinLabels";
|
|
11359
|
+
const match = message.match(
|
|
11360
|
+
/^Invalid pin label:\s*([^=]+)=\s*'([^']+)'/
|
|
11361
|
+
);
|
|
11362
|
+
if (match) {
|
|
11363
|
+
const label = match[2];
|
|
11364
|
+
property_name = `pinLabels['${label}']`;
|
|
11365
|
+
}
|
|
11366
|
+
this.root.db.source_property_ignored_warning.insert({
|
|
11367
|
+
source_component_id: this.source_component_id,
|
|
11368
|
+
property_name,
|
|
11369
|
+
message,
|
|
11370
|
+
error_type: "source_property_ignored_warning"
|
|
11371
|
+
});
|
|
11372
|
+
}
|
|
11373
|
+
}
|
|
11325
11374
|
super.doInitialSchematicComponentRender();
|
|
11326
11375
|
}
|
|
11327
11376
|
doInitialSourceRender() {
|
|
@@ -11419,13 +11468,6 @@ var Chip = class extends NormalComponent {
|
|
|
11419
11468
|
// lib/components/normal-components/Diode.ts
|
|
11420
11469
|
import { diodeProps } from "@tscircuit/props";
|
|
11421
11470
|
var Diode = class extends NormalComponent {
|
|
11422
|
-
constructor() {
|
|
11423
|
-
super(...arguments);
|
|
11424
|
-
__publicField(this, "pos", this.portMap.pin1);
|
|
11425
|
-
__publicField(this, "anode", this.portMap.pin1);
|
|
11426
|
-
__publicField(this, "neg", this.portMap.pin2);
|
|
11427
|
-
__publicField(this, "cathode", this.portMap.pin2);
|
|
11428
|
-
}
|
|
11429
11471
|
// @ts-ignore
|
|
11430
11472
|
get config() {
|
|
11431
11473
|
const symbolMap = {
|
|
@@ -11463,6 +11505,10 @@ var Diode = class extends NormalComponent {
|
|
|
11463
11505
|
});
|
|
11464
11506
|
this.source_component_id = source_component.source_component_id;
|
|
11465
11507
|
}
|
|
11508
|
+
pos = this.portMap.pin1;
|
|
11509
|
+
anode = this.portMap.pin1;
|
|
11510
|
+
neg = this.portMap.pin2;
|
|
11511
|
+
cathode = this.portMap.pin2;
|
|
11466
11512
|
};
|
|
11467
11513
|
|
|
11468
11514
|
// lib/components/normal-components/Fuse.ts
|
|
@@ -11504,10 +11550,7 @@ var Fuse = class extends NormalComponent {
|
|
|
11504
11550
|
// lib/components/normal-components/Jumper.ts
|
|
11505
11551
|
import { jumperProps } from "@tscircuit/props";
|
|
11506
11552
|
var Jumper = class extends NormalComponent {
|
|
11507
|
-
|
|
11508
|
-
super(...arguments);
|
|
11509
|
-
__publicField(this, "schematicDimensions", null);
|
|
11510
|
-
}
|
|
11553
|
+
schematicDimensions = null;
|
|
11511
11554
|
get config() {
|
|
11512
11555
|
return {
|
|
11513
11556
|
schematicSymbolName: void 0,
|
|
@@ -11606,10 +11649,7 @@ var Jumper = class extends NormalComponent {
|
|
|
11606
11649
|
// lib/components/normal-components/SolderJumper.ts
|
|
11607
11650
|
import { solderjumperProps } from "@tscircuit/props";
|
|
11608
11651
|
var SolderJumper = class extends NormalComponent {
|
|
11609
|
-
|
|
11610
|
-
super(...arguments);
|
|
11611
|
-
__publicField(this, "schematicDimensions", null);
|
|
11612
|
-
}
|
|
11652
|
+
schematicDimensions = null;
|
|
11613
11653
|
_getPinNumberFromBridgedPinName(pinName) {
|
|
11614
11654
|
const port = this.selectOne(`port.${pinName}`, {
|
|
11615
11655
|
type: "port"
|
|
@@ -11763,13 +11803,6 @@ var SolderJumper = class extends NormalComponent {
|
|
|
11763
11803
|
// lib/components/normal-components/Led.ts
|
|
11764
11804
|
import { ledProps } from "@tscircuit/props";
|
|
11765
11805
|
var Led = class extends NormalComponent {
|
|
11766
|
-
constructor() {
|
|
11767
|
-
super(...arguments);
|
|
11768
|
-
__publicField(this, "pos", this.portMap.pin1);
|
|
11769
|
-
__publicField(this, "anode", this.portMap.pin1);
|
|
11770
|
-
__publicField(this, "neg", this.portMap.pin2);
|
|
11771
|
-
__publicField(this, "cathode", this.portMap.pin2);
|
|
11772
|
-
}
|
|
11773
11806
|
get config() {
|
|
11774
11807
|
const symbolMap = {
|
|
11775
11808
|
laser: "laser_diode"
|
|
@@ -11809,18 +11842,15 @@ var Led = class extends NormalComponent {
|
|
|
11809
11842
|
});
|
|
11810
11843
|
this.source_component_id = source_component.source_component_id;
|
|
11811
11844
|
}
|
|
11845
|
+
pos = this.portMap.pin1;
|
|
11846
|
+
anode = this.portMap.pin1;
|
|
11847
|
+
neg = this.portMap.pin2;
|
|
11848
|
+
cathode = this.portMap.pin2;
|
|
11812
11849
|
};
|
|
11813
11850
|
|
|
11814
11851
|
// lib/components/normal-components/PowerSource.ts
|
|
11815
11852
|
import { powerSourceProps } from "@tscircuit/props";
|
|
11816
11853
|
var PowerSource = class extends NormalComponent {
|
|
11817
|
-
constructor() {
|
|
11818
|
-
super(...arguments);
|
|
11819
|
-
__publicField(this, "pos", this.portMap.pin1);
|
|
11820
|
-
__publicField(this, "positive", this.portMap.pin1);
|
|
11821
|
-
__publicField(this, "neg", this.portMap.pin2);
|
|
11822
|
-
__publicField(this, "negative", this.portMap.pin2);
|
|
11823
|
-
}
|
|
11824
11854
|
// @ts-ignore
|
|
11825
11855
|
get config() {
|
|
11826
11856
|
return {
|
|
@@ -11851,6 +11881,10 @@ var PowerSource = class extends NormalComponent {
|
|
|
11851
11881
|
});
|
|
11852
11882
|
this.source_component_id = source_component.source_component_id;
|
|
11853
11883
|
}
|
|
11884
|
+
pos = this.portMap.pin1;
|
|
11885
|
+
positive = this.portMap.pin1;
|
|
11886
|
+
neg = this.portMap.pin2;
|
|
11887
|
+
negative = this.portMap.pin2;
|
|
11854
11888
|
};
|
|
11855
11889
|
|
|
11856
11890
|
// lib/components/normal-components/VoltageSource.ts
|
|
@@ -11867,11 +11901,6 @@ var voltageSourceProps = commonComponentProps.extend({
|
|
|
11867
11901
|
phase: rotation2.optional()
|
|
11868
11902
|
});
|
|
11869
11903
|
var VoltageSource = class extends NormalComponent {
|
|
11870
|
-
constructor() {
|
|
11871
|
-
super(...arguments);
|
|
11872
|
-
__publicField(this, "terminal1", this.portMap.terminal1);
|
|
11873
|
-
__publicField(this, "terminal2", this.portMap.terminal2);
|
|
11874
|
-
}
|
|
11875
11904
|
get config() {
|
|
11876
11905
|
return {
|
|
11877
11906
|
componentName: "VoltageSource",
|
|
@@ -11932,6 +11961,8 @@ var VoltageSource = class extends NormalComponent {
|
|
|
11932
11961
|
phase: props.phase
|
|
11933
11962
|
});
|
|
11934
11963
|
}
|
|
11964
|
+
terminal1 = this.portMap.terminal1;
|
|
11965
|
+
terminal2 = this.portMap.terminal2;
|
|
11935
11966
|
};
|
|
11936
11967
|
|
|
11937
11968
|
// lib/components/normal-components/Resistor.ts
|
|
@@ -12081,10 +12112,7 @@ var Constraint2 = class extends PrimitiveComponent2 {
|
|
|
12081
12112
|
import { fabricationNotePathProps } from "@tscircuit/props";
|
|
12082
12113
|
import { applyToPoint as applyToPoint7 } from "transformation-matrix";
|
|
12083
12114
|
var FabricationNotePath = class extends PrimitiveComponent2 {
|
|
12084
|
-
|
|
12085
|
-
super(...arguments);
|
|
12086
|
-
__publicField(this, "fabrication_note_path_id", null);
|
|
12087
|
-
}
|
|
12115
|
+
fabrication_note_path_id = null;
|
|
12088
12116
|
get config() {
|
|
12089
12117
|
return {
|
|
12090
12118
|
componentName: "FabricationNotePath",
|
|
@@ -12205,13 +12233,10 @@ var Breakout = class extends Group6 {
|
|
|
12205
12233
|
// lib/components/primitive-components/BreakoutPoint.ts
|
|
12206
12234
|
import { breakoutPointProps } from "@tscircuit/props";
|
|
12207
12235
|
var BreakoutPoint = class extends PrimitiveComponent2 {
|
|
12208
|
-
|
|
12209
|
-
|
|
12210
|
-
|
|
12211
|
-
|
|
12212
|
-
__publicField(this, "matchedNet", null);
|
|
12213
|
-
__publicField(this, "isPcbPrimitive", true);
|
|
12214
|
-
}
|
|
12236
|
+
pcb_breakout_point_id = null;
|
|
12237
|
+
matchedPort = null;
|
|
12238
|
+
matchedNet = null;
|
|
12239
|
+
isPcbPrimitive = true;
|
|
12215
12240
|
get config() {
|
|
12216
12241
|
return {
|
|
12217
12242
|
componentName: "BreakoutPoint",
|
|
@@ -12290,11 +12315,9 @@ import {
|
|
|
12290
12315
|
identity as identity4,
|
|
12291
12316
|
translate as translate6
|
|
12292
12317
|
} from "transformation-matrix";
|
|
12318
|
+
import { calculateElbow as calculateElbow2 } from "calculate-elbow";
|
|
12293
12319
|
var NetLabel = class extends PrimitiveComponent2 {
|
|
12294
|
-
|
|
12295
|
-
super(...arguments);
|
|
12296
|
-
__publicField(this, "source_net_label_id");
|
|
12297
|
-
}
|
|
12320
|
+
source_net_label_id;
|
|
12298
12321
|
get config() {
|
|
12299
12322
|
return {
|
|
12300
12323
|
componentName: "NetLabel",
|
|
@@ -12405,16 +12428,87 @@ var NetLabel = class extends PrimitiveComponent2 {
|
|
|
12405
12428
|
);
|
|
12406
12429
|
}
|
|
12407
12430
|
}
|
|
12431
|
+
doInitialSchematicTraceRender() {
|
|
12432
|
+
if (!this.root?._featureMspSchematicTraceRouting) return;
|
|
12433
|
+
if (this.root?.schematicDisabled) return;
|
|
12434
|
+
const { db } = this.root;
|
|
12435
|
+
const connectsTo = this._resolveConnectsTo();
|
|
12436
|
+
if (!connectsTo || connectsTo.length === 0) return;
|
|
12437
|
+
const anchorPos = this._getGlobalSchematicPositionBeforeLayout();
|
|
12438
|
+
const anchorSide = this._getAnchorSide();
|
|
12439
|
+
const sideToAxisDir = {
|
|
12440
|
+
left: "x-",
|
|
12441
|
+
right: "x+",
|
|
12442
|
+
top: "y+",
|
|
12443
|
+
bottom: "y-"
|
|
12444
|
+
};
|
|
12445
|
+
const anchorFacing = sideToAxisDir[anchorSide];
|
|
12446
|
+
const net = this.getSubcircuit().selectOne(
|
|
12447
|
+
`net.${this._getNetName()}`
|
|
12448
|
+
);
|
|
12449
|
+
for (const connection of connectsTo) {
|
|
12450
|
+
const port = this.getSubcircuit().selectOne(connection, {
|
|
12451
|
+
type: "port"
|
|
12452
|
+
});
|
|
12453
|
+
if (!port || !port.schematic_port_id) continue;
|
|
12454
|
+
let existingTraceForThisConnection = false;
|
|
12455
|
+
if (net?.source_net_id) {
|
|
12456
|
+
const candidateSourceTrace = db.source_trace.list().find(
|
|
12457
|
+
(st) => st.connected_source_net_ids?.includes(net.source_net_id) && st.connected_source_port_ids?.includes(port.source_port_id ?? "")
|
|
12458
|
+
);
|
|
12459
|
+
if (candidateSourceTrace) {
|
|
12460
|
+
existingTraceForThisConnection = db.schematic_trace.list().some(
|
|
12461
|
+
(t) => t.source_trace_id === candidateSourceTrace.source_trace_id
|
|
12462
|
+
);
|
|
12463
|
+
}
|
|
12464
|
+
if (existingTraceForThisConnection) continue;
|
|
12465
|
+
}
|
|
12466
|
+
const portPos = port._getGlobalSchematicPositionAfterLayout();
|
|
12467
|
+
const portFacing = convertFacingDirectionToElbowDirection(
|
|
12468
|
+
port.facingDirection ?? "right"
|
|
12469
|
+
) ?? "x+";
|
|
12470
|
+
const path = calculateElbow2(
|
|
12471
|
+
{
|
|
12472
|
+
x: portPos.x,
|
|
12473
|
+
y: portPos.y,
|
|
12474
|
+
facingDirection: portFacing
|
|
12475
|
+
},
|
|
12476
|
+
{
|
|
12477
|
+
x: anchorPos.x,
|
|
12478
|
+
y: anchorPos.y,
|
|
12479
|
+
facingDirection: anchorFacing
|
|
12480
|
+
}
|
|
12481
|
+
);
|
|
12482
|
+
if (!Array.isArray(path) || path.length < 2) continue;
|
|
12483
|
+
const edges = [];
|
|
12484
|
+
for (let i = 0; i < path.length - 1; i++) {
|
|
12485
|
+
edges.push({
|
|
12486
|
+
from: { x: path[i].x, y: path[i].y },
|
|
12487
|
+
to: { x: path[i + 1].x, y: path[i + 1].y }
|
|
12488
|
+
});
|
|
12489
|
+
}
|
|
12490
|
+
let source_trace_id;
|
|
12491
|
+
if (net?.source_net_id && port.source_port_id) {
|
|
12492
|
+
const st = db.source_trace.list().find(
|
|
12493
|
+
(s) => s.connected_source_net_ids?.includes(net.source_net_id) && s.connected_source_port_ids?.includes(port.source_port_id)
|
|
12494
|
+
);
|
|
12495
|
+
source_trace_id = st?.source_trace_id;
|
|
12496
|
+
}
|
|
12497
|
+
db.schematic_trace.insert({
|
|
12498
|
+
source_trace_id,
|
|
12499
|
+
edges,
|
|
12500
|
+
junctions: []
|
|
12501
|
+
});
|
|
12502
|
+
db.schematic_port.update(port.schematic_port_id, { is_connected: true });
|
|
12503
|
+
}
|
|
12504
|
+
}
|
|
12408
12505
|
};
|
|
12409
12506
|
|
|
12410
12507
|
// lib/components/primitive-components/SilkscreenCircle.ts
|
|
12411
12508
|
import { silkscreenCircleProps } from "@tscircuit/props";
|
|
12412
12509
|
var SilkscreenCircle = class extends PrimitiveComponent2 {
|
|
12413
|
-
|
|
12414
|
-
|
|
12415
|
-
__publicField(this, "pcb_silkscreen_circle_id", null);
|
|
12416
|
-
__publicField(this, "isPcbPrimitive", true);
|
|
12417
|
-
}
|
|
12510
|
+
pcb_silkscreen_circle_id = null;
|
|
12511
|
+
isPcbPrimitive = true;
|
|
12418
12512
|
get config() {
|
|
12419
12513
|
return {
|
|
12420
12514
|
componentName: "SilkscreenCircle",
|
|
@@ -12459,11 +12553,8 @@ var SilkscreenCircle = class extends PrimitiveComponent2 {
|
|
|
12459
12553
|
// lib/components/primitive-components/SilkscreenRect.ts
|
|
12460
12554
|
import { silkscreenRectProps } from "@tscircuit/props";
|
|
12461
12555
|
var SilkscreenRect = class extends PrimitiveComponent2 {
|
|
12462
|
-
|
|
12463
|
-
|
|
12464
|
-
__publicField(this, "pcb_silkscreen_rect_id", null);
|
|
12465
|
-
__publicField(this, "isPcbPrimitive", true);
|
|
12466
|
-
}
|
|
12556
|
+
pcb_silkscreen_rect_id = null;
|
|
12557
|
+
isPcbPrimitive = true;
|
|
12467
12558
|
get config() {
|
|
12468
12559
|
return {
|
|
12469
12560
|
componentName: "SilkscreenRect",
|
|
@@ -12507,11 +12598,8 @@ var SilkscreenRect = class extends PrimitiveComponent2 {
|
|
|
12507
12598
|
// lib/components/primitive-components/SilkscreenLine.ts
|
|
12508
12599
|
import { silkscreenLineProps } from "@tscircuit/props";
|
|
12509
12600
|
var SilkscreenLine = class extends PrimitiveComponent2 {
|
|
12510
|
-
|
|
12511
|
-
|
|
12512
|
-
__publicField(this, "pcb_silkscreen_line_id", null);
|
|
12513
|
-
__publicField(this, "isPcbPrimitive", true);
|
|
12514
|
-
}
|
|
12601
|
+
pcb_silkscreen_line_id = null;
|
|
12602
|
+
isPcbPrimitive = true;
|
|
12515
12603
|
get config() {
|
|
12516
12604
|
return {
|
|
12517
12605
|
componentName: "SilkscreenLine",
|
|
@@ -12555,12 +12643,9 @@ var SilkscreenLine = class extends PrimitiveComponent2 {
|
|
|
12555
12643
|
// lib/components/primitive-components/Via.ts
|
|
12556
12644
|
import { viaProps } from "@tscircuit/props";
|
|
12557
12645
|
var Via = class extends PrimitiveComponent2 {
|
|
12558
|
-
|
|
12559
|
-
|
|
12560
|
-
|
|
12561
|
-
__publicField(this, "matchedPort", null);
|
|
12562
|
-
__publicField(this, "isPcbPrimitive", true);
|
|
12563
|
-
}
|
|
12646
|
+
pcb_via_id = null;
|
|
12647
|
+
matchedPort = null;
|
|
12648
|
+
isPcbPrimitive = true;
|
|
12564
12649
|
get config() {
|
|
12565
12650
|
return {
|
|
12566
12651
|
componentName: "Via",
|
|
@@ -12982,12 +13067,6 @@ var Crystal = class extends NormalComponent {
|
|
|
12982
13067
|
// lib/components/normal-components/Transistor.ts
|
|
12983
13068
|
import { transistorProps } from "@tscircuit/props";
|
|
12984
13069
|
var Transistor = class extends NormalComponent {
|
|
12985
|
-
constructor() {
|
|
12986
|
-
super(...arguments);
|
|
12987
|
-
__publicField(this, "emitter", this.portMap.pin1);
|
|
12988
|
-
__publicField(this, "collector", this.portMap.pin2);
|
|
12989
|
-
__publicField(this, "base", this.portMap.pin3);
|
|
12990
|
-
}
|
|
12991
13070
|
get config() {
|
|
12992
13071
|
const baseSymbolName = this.props.type === "npn" ? "npn_bipolar_transistor" : "pnp_bipolar_transistor";
|
|
12993
13072
|
return {
|
|
@@ -13013,6 +13092,9 @@ var Transistor = class extends NormalComponent {
|
|
|
13013
13092
|
additionalAliases: pinAliases
|
|
13014
13093
|
});
|
|
13015
13094
|
}
|
|
13095
|
+
emitter = this.portMap.pin1;
|
|
13096
|
+
collector = this.portMap.pin2;
|
|
13097
|
+
base = this.portMap.pin3;
|
|
13016
13098
|
doInitialCreateNetsFromProps() {
|
|
13017
13099
|
this._createNetsFromProps([...this._getNetsFromConnectionsProp()]);
|
|
13018
13100
|
}
|
|
@@ -13128,17 +13210,17 @@ var TestPoint = class extends NormalComponent {
|
|
|
13128
13210
|
if (!footprintVariant && holeDiameter) {
|
|
13129
13211
|
footprintVariant = "through_hole";
|
|
13130
13212
|
}
|
|
13131
|
-
footprintVariant
|
|
13132
|
-
padShape
|
|
13213
|
+
footprintVariant ??= "through_hole";
|
|
13214
|
+
padShape ??= "circle";
|
|
13133
13215
|
if (footprintVariant === "pad") {
|
|
13134
13216
|
if (padShape === "circle") {
|
|
13135
|
-
padDiameter
|
|
13217
|
+
padDiameter ??= TESTPOINT_DEFAULTS.SMT_CIRCLE_DIAMETER;
|
|
13136
13218
|
} else if (padShape === "rect") {
|
|
13137
|
-
width
|
|
13138
|
-
height
|
|
13219
|
+
width ??= TESTPOINT_DEFAULTS.SMT_RECT_SIZE;
|
|
13220
|
+
height ??= width;
|
|
13139
13221
|
}
|
|
13140
13222
|
} else if (footprintVariant === "through_hole") {
|
|
13141
|
-
holeDiameter
|
|
13223
|
+
holeDiameter ??= TESTPOINT_DEFAULTS.HOLE_DIAMETER;
|
|
13142
13224
|
}
|
|
13143
13225
|
return {
|
|
13144
13226
|
padShape,
|
|
@@ -13203,10 +13285,7 @@ var TestPoint = class extends NormalComponent {
|
|
|
13203
13285
|
// lib/components/primitive-components/SchematicText.ts
|
|
13204
13286
|
import { schematicTextProps } from "@tscircuit/props";
|
|
13205
13287
|
var SchematicText = class extends PrimitiveComponent2 {
|
|
13206
|
-
|
|
13207
|
-
super(...arguments);
|
|
13208
|
-
__publicField(this, "isSchematicPrimitive", true);
|
|
13209
|
-
}
|
|
13288
|
+
isSchematicPrimitive = true;
|
|
13210
13289
|
get config() {
|
|
13211
13290
|
return {
|
|
13212
13291
|
componentName: "SchematicText",
|
|
@@ -13310,10 +13389,7 @@ function getTitleAnchorAndPosition({
|
|
|
13310
13389
|
|
|
13311
13390
|
// lib/components/primitive-components/SchematicBox.ts
|
|
13312
13391
|
var SchematicBox = class extends PrimitiveComponent2 {
|
|
13313
|
-
|
|
13314
|
-
super(...arguments);
|
|
13315
|
-
__publicField(this, "isSchematicPrimitive", true);
|
|
13316
|
-
}
|
|
13392
|
+
isSchematicPrimitive = true;
|
|
13317
13393
|
get config() {
|
|
13318
13394
|
return {
|
|
13319
13395
|
componentName: "SchematicBox",
|
|
@@ -13434,11 +13510,8 @@ var SchematicBox = class extends PrimitiveComponent2 {
|
|
|
13434
13510
|
// lib/components/primitive-components/SchematicTable.ts
|
|
13435
13511
|
import { schematicTableProps } from "@tscircuit/props";
|
|
13436
13512
|
var SchematicTable = class extends PrimitiveComponent2 {
|
|
13437
|
-
|
|
13438
|
-
|
|
13439
|
-
__publicField(this, "isSchematicPrimitive", true);
|
|
13440
|
-
__publicField(this, "schematic_table_id", null);
|
|
13441
|
-
}
|
|
13513
|
+
isSchematicPrimitive = true;
|
|
13514
|
+
schematic_table_id = null;
|
|
13442
13515
|
get config() {
|
|
13443
13516
|
return {
|
|
13444
13517
|
componentName: "SchematicTable",
|
|
@@ -13566,10 +13639,7 @@ var SchematicTable = class extends PrimitiveComponent2 {
|
|
|
13566
13639
|
// lib/components/primitive-components/SchematicRow.ts
|
|
13567
13640
|
import { schematicRowProps } from "@tscircuit/props";
|
|
13568
13641
|
var SchematicRow = class extends PrimitiveComponent2 {
|
|
13569
|
-
|
|
13570
|
-
super(...arguments);
|
|
13571
|
-
__publicField(this, "isSchematicPrimitive", true);
|
|
13572
|
-
}
|
|
13642
|
+
isSchematicPrimitive = true;
|
|
13573
13643
|
get config() {
|
|
13574
13644
|
return {
|
|
13575
13645
|
componentName: "SchematicRow",
|
|
@@ -13581,11 +13651,8 @@ var SchematicRow = class extends PrimitiveComponent2 {
|
|
|
13581
13651
|
// lib/components/primitive-components/SchematicCell.ts
|
|
13582
13652
|
import { schematicCellProps } from "@tscircuit/props";
|
|
13583
13653
|
var SchematicCell = class extends PrimitiveComponent2 {
|
|
13584
|
-
|
|
13585
|
-
|
|
13586
|
-
__publicField(this, "isSchematicPrimitive", true);
|
|
13587
|
-
__publicField(this, "canHaveTextChildren", true);
|
|
13588
|
-
}
|
|
13654
|
+
isSchematicPrimitive = true;
|
|
13655
|
+
canHaveTextChildren = true;
|
|
13589
13656
|
get config() {
|
|
13590
13657
|
return {
|
|
13591
13658
|
componentName: "SchematicCell",
|
|
@@ -13603,7 +13670,7 @@ import { identity as identity5 } from "transformation-matrix";
|
|
|
13603
13670
|
var package_default = {
|
|
13604
13671
|
name: "@tscircuit/core",
|
|
13605
13672
|
type: "module",
|
|
13606
|
-
version: "0.0.
|
|
13673
|
+
version: "0.0.647",
|
|
13607
13674
|
types: "dist/index.d.ts",
|
|
13608
13675
|
main: "dist/index.js",
|
|
13609
13676
|
module: "dist/index.js",
|
|
@@ -13657,7 +13724,7 @@ var package_default = {
|
|
|
13657
13724
|
"bun-match-svg": "0.0.12",
|
|
13658
13725
|
"calculate-elbow": "^0.0.9",
|
|
13659
13726
|
"chokidar-cli": "^3.0.0",
|
|
13660
|
-
"circuit-json": "^0.0.
|
|
13727
|
+
"circuit-json": "^0.0.233",
|
|
13661
13728
|
"circuit-json-to-bpc": "^0.0.13",
|
|
13662
13729
|
"circuit-json-to-connectivity-map": "^0.0.22",
|
|
13663
13730
|
"circuit-json-to-simple-3d": "^0.0.6",
|
|
@@ -13712,34 +13779,33 @@ var package_default = {
|
|
|
13712
13779
|
|
|
13713
13780
|
// lib/RootCircuit.ts
|
|
13714
13781
|
var RootCircuit = class {
|
|
13782
|
+
firstChild = null;
|
|
13783
|
+
children;
|
|
13784
|
+
db;
|
|
13785
|
+
root = null;
|
|
13786
|
+
isRoot = true;
|
|
13787
|
+
schematicDisabled = false;
|
|
13788
|
+
pcbDisabled = false;
|
|
13789
|
+
pcbRoutingDisabled = false;
|
|
13790
|
+
_featureMspSchematicTraceRouting = false;
|
|
13791
|
+
/**
|
|
13792
|
+
* The RootCircuit name is usually set by the platform, it's not required but
|
|
13793
|
+
* if supplied can identify the circuit in certain effects, e.g. it is passed
|
|
13794
|
+
* as the display_name parameter for autorouting effects.
|
|
13795
|
+
*/
|
|
13796
|
+
name;
|
|
13797
|
+
platform;
|
|
13798
|
+
/**
|
|
13799
|
+
* Optional URL pointing to where this project is hosted or documented.
|
|
13800
|
+
* When provided it is stored in the source_project_metadata.project_url field
|
|
13801
|
+
* of the generated Circuit JSON.
|
|
13802
|
+
*/
|
|
13803
|
+
projectUrl;
|
|
13804
|
+
_hasRenderedAtleastOnce = false;
|
|
13715
13805
|
constructor({
|
|
13716
13806
|
platform,
|
|
13717
13807
|
projectUrl
|
|
13718
13808
|
} = {}) {
|
|
13719
|
-
__publicField(this, "firstChild", null);
|
|
13720
|
-
__publicField(this, "children");
|
|
13721
|
-
__publicField(this, "db");
|
|
13722
|
-
__publicField(this, "root", null);
|
|
13723
|
-
__publicField(this, "isRoot", true);
|
|
13724
|
-
__publicField(this, "schematicDisabled", false);
|
|
13725
|
-
__publicField(this, "pcbDisabled", false);
|
|
13726
|
-
__publicField(this, "pcbRoutingDisabled", false);
|
|
13727
|
-
__publicField(this, "_featureMspSchematicTraceRouting", false);
|
|
13728
|
-
/**
|
|
13729
|
-
* The RootCircuit name is usually set by the platform, it's not required but
|
|
13730
|
-
* if supplied can identify the circuit in certain effects, e.g. it is passed
|
|
13731
|
-
* as the display_name parameter for autorouting effects.
|
|
13732
|
-
*/
|
|
13733
|
-
__publicField(this, "name");
|
|
13734
|
-
__publicField(this, "platform");
|
|
13735
|
-
/**
|
|
13736
|
-
* Optional URL pointing to where this project is hosted or documented.
|
|
13737
|
-
* When provided it is stored in the source_project_metadata.project_url field
|
|
13738
|
-
* of the generated Circuit JSON.
|
|
13739
|
-
*/
|
|
13740
|
-
__publicField(this, "projectUrl");
|
|
13741
|
-
__publicField(this, "_hasRenderedAtleastOnce", false);
|
|
13742
|
-
__publicField(this, "_eventListeners", {});
|
|
13743
13809
|
this.children = [];
|
|
13744
13810
|
this.db = su5([]);
|
|
13745
13811
|
this.root = this;
|
|
@@ -13861,6 +13927,7 @@ var RootCircuit = class {
|
|
|
13861
13927
|
this._guessRootComponent();
|
|
13862
13928
|
return this.firstChild?.selectOne(selector, opts) ?? null;
|
|
13863
13929
|
}
|
|
13930
|
+
_eventListeners = {};
|
|
13864
13931
|
emit(event, ...args) {
|
|
13865
13932
|
if (!this._eventListeners[event]) return;
|
|
13866
13933
|
for (const listener of this._eventListeners[event]) {
|