@tscircuit/core 0.0.374 → 0.0.376
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 +6 -3
- package/dist/index.js +229 -74
- package/package.json +2 -1
package/dist/index.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ import * as _tscircuit_layout from '@tscircuit/layout';
|
|
|
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", "InitializePortsFromChildren", "CreateNetsFromProps", "CreateTracesFromProps", "CreateTraceHintsFromProps", "SourceRender", "SourceParentAttachment", "PortMatching", "SourceTraceRender", "SourceAddConnectivityMapKey", "SchematicComponentRender", "SchematicPortRender", "SchematicLayout", "SchematicTraceRender", "PcbComponentRender", "PcbPrimitiveRender", "PcbFootprintLayout", "PcbPortRender", "PcbPortAttachment", "PcbLayout", "PcbComponentSizeCalculation", "PcbBoardAutoSize", "PcbTraceRender", "PcbTraceHintRender", "PcbRouteNetIslands", "PcbDesignRuleChecks", "CadModelRender", "PartsEngineRender"];
|
|
15
|
+
declare const orderedRenderPhases: readonly ["ReactSubtreesRender", "InitializePortsFromChildren", "CreateNetsFromProps", "CreateTracesFromProps", "CreateTraceHintsFromProps", "SourceRender", "SourceParentAttachment", "PortMatching", "OptimizeSelectorCache", "SourceTraceRender", "SourceAddConnectivityMapKey", "SchematicComponentRender", "SchematicPortRender", "SchematicLayout", "SchematicTraceRender", "PcbComponentRender", "PcbPrimitiveRender", "PcbFootprintLayout", "PcbPortRender", "PcbPortAttachment", "PcbLayout", "PcbComponentSizeCalculation", "PcbBoardAutoSize", "PcbTraceRender", "PcbTraceHintRender", "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, {
|
|
@@ -427,8 +427,11 @@ declare abstract class PrimitiveComponent<ZodProps extends ZodType = any> extend
|
|
|
427
427
|
doesSelectorMatch(selector: string): boolean;
|
|
428
428
|
getSubcircuit(): ISubcircuit;
|
|
429
429
|
getGroup(): IGroup | null;
|
|
430
|
-
|
|
431
|
-
|
|
430
|
+
doInitialOptimizeSelectorCache(): void;
|
|
431
|
+
_cachedSelectAllQueries: Map<string, PrimitiveComponent[]>;
|
|
432
|
+
selectAll(selectorRaw: string): PrimitiveComponent[];
|
|
433
|
+
_cachedSelectOneQueries: Map<string, PrimitiveComponent | null>;
|
|
434
|
+
selectOne<T = PrimitiveComponent>(selectorRaw: string, options?: {
|
|
432
435
|
type?: string;
|
|
433
436
|
port?: boolean;
|
|
434
437
|
pcbPrimitive?: boolean;
|
package/dist/index.js
CHANGED
|
@@ -32,7 +32,7 @@ __export(components_exports, {
|
|
|
32
32
|
Port: () => Port,
|
|
33
33
|
Potentiometer: () => Potentiometer,
|
|
34
34
|
PowerSource: () => PowerSource,
|
|
35
|
-
PrimitiveComponent: () =>
|
|
35
|
+
PrimitiveComponent: () => PrimitiveComponent2,
|
|
36
36
|
PushButton: () => PushButton,
|
|
37
37
|
Renderable: () => Renderable,
|
|
38
38
|
Resistor: () => Resistor,
|
|
@@ -74,6 +74,7 @@ var orderedRenderPhases = [
|
|
|
74
74
|
"SourceRender",
|
|
75
75
|
"SourceParentAttachment",
|
|
76
76
|
"PortMatching",
|
|
77
|
+
"OptimizeSelectorCache",
|
|
77
78
|
"SourceTraceRender",
|
|
78
79
|
"SourceAddConnectivityMapKey",
|
|
79
80
|
"SchematicComponentRender",
|
|
@@ -531,8 +532,8 @@ var underscorifyPortArrangement = (portArrangement) => {
|
|
|
531
532
|
return void 0;
|
|
532
533
|
};
|
|
533
534
|
|
|
534
|
-
// lib/components/base-components/PrimitiveComponent.ts
|
|
535
|
-
import
|
|
535
|
+
// lib/components/base-components/PrimitiveComponent/PrimitiveComponent.ts
|
|
536
|
+
import "debug";
|
|
536
537
|
|
|
537
538
|
// lib/errors/InvalidProps.ts
|
|
538
539
|
var InvalidProps = class extends Error {
|
|
@@ -590,7 +591,7 @@ function isMatchingSelector(component, selector) {
|
|
|
590
591
|
});
|
|
591
592
|
}
|
|
592
593
|
|
|
593
|
-
// lib/components/base-components/PrimitiveComponent.ts
|
|
594
|
+
// lib/components/base-components/PrimitiveComponent/PrimitiveComponent.ts
|
|
594
595
|
import { symbols } from "schematic-symbols";
|
|
595
596
|
import {
|
|
596
597
|
applyToPoint,
|
|
@@ -601,8 +602,123 @@ import {
|
|
|
601
602
|
translate
|
|
602
603
|
} from "transformation-matrix";
|
|
603
604
|
import { z as z2 } from "zod";
|
|
604
|
-
|
|
605
|
-
|
|
605
|
+
import { selectOne, selectAll } from "css-select";
|
|
606
|
+
|
|
607
|
+
// lib/components/base-components/PrimitiveComponent/cssSelectPrimitiveComponentAdapter.ts
|
|
608
|
+
var cssSelectPrimitiveComponentAdapter = {
|
|
609
|
+
// Is the node an element?
|
|
610
|
+
isTag: (node) => true,
|
|
611
|
+
// Get the parent of the node
|
|
612
|
+
getParent: (node) => node.parent,
|
|
613
|
+
// Get the children of the node
|
|
614
|
+
getChildren: (node) => node.children,
|
|
615
|
+
// Get the name of the tag
|
|
616
|
+
getName: (node) => node.lowercaseComponentName,
|
|
617
|
+
// Get the attribute value
|
|
618
|
+
getAttributeValue: (node, name) => {
|
|
619
|
+
if (name === "class" && "getNameAndAliases" in node) {
|
|
620
|
+
return node.getNameAndAliases().join(" ");
|
|
621
|
+
}
|
|
622
|
+
if (name === "name" && node._parsedProps?.name) {
|
|
623
|
+
return node._parsedProps.name;
|
|
624
|
+
}
|
|
625
|
+
if (node._parsedProps && name in node._parsedProps) {
|
|
626
|
+
const value = node._parsedProps[name];
|
|
627
|
+
return typeof value === "string" ? value : value !== null && value !== void 0 ? String(value) : null;
|
|
628
|
+
}
|
|
629
|
+
return null;
|
|
630
|
+
},
|
|
631
|
+
// Check if a node has an attribute
|
|
632
|
+
hasAttrib: (node, name) => {
|
|
633
|
+
if (name === "class") {
|
|
634
|
+
return !!node._parsedProps?.name;
|
|
635
|
+
}
|
|
636
|
+
return node._parsedProps && name in node._parsedProps;
|
|
637
|
+
},
|
|
638
|
+
// Get the siblings of the node
|
|
639
|
+
getSiblings: (node) => {
|
|
640
|
+
if (!node.parent) return [];
|
|
641
|
+
return node.parent.children;
|
|
642
|
+
},
|
|
643
|
+
// Get the previous sibling
|
|
644
|
+
prevElementSibling: (node) => {
|
|
645
|
+
if (!node.parent) return null;
|
|
646
|
+
const siblings = node.parent.children;
|
|
647
|
+
const idx = siblings.indexOf(node);
|
|
648
|
+
return idx > 0 ? siblings[idx - 1] : null;
|
|
649
|
+
},
|
|
650
|
+
// Get the text content
|
|
651
|
+
getText: () => "",
|
|
652
|
+
// Remove the node
|
|
653
|
+
removeSubsets: (nodes) => {
|
|
654
|
+
return nodes.filter(
|
|
655
|
+
(node, i) => !nodes.some(
|
|
656
|
+
(other, j) => i !== j && other !== node && other.getDescendants().includes(node)
|
|
657
|
+
)
|
|
658
|
+
);
|
|
659
|
+
},
|
|
660
|
+
// Determine if element a is a subset of element b
|
|
661
|
+
existsOne: (test, nodes) => {
|
|
662
|
+
return nodes.some(test);
|
|
663
|
+
},
|
|
664
|
+
// Find all elements matching a selector
|
|
665
|
+
findAll: (test, nodes) => {
|
|
666
|
+
const result = [];
|
|
667
|
+
const recurse = (node) => {
|
|
668
|
+
if (test(node)) {
|
|
669
|
+
result.push(node);
|
|
670
|
+
}
|
|
671
|
+
for (const child of node.children) {
|
|
672
|
+
recurse(child);
|
|
673
|
+
}
|
|
674
|
+
};
|
|
675
|
+
for (const node of nodes) {
|
|
676
|
+
recurse(node);
|
|
677
|
+
}
|
|
678
|
+
return result;
|
|
679
|
+
},
|
|
680
|
+
// Find one element matching a selector
|
|
681
|
+
findOne: (test, nodes) => {
|
|
682
|
+
for (const node of nodes) {
|
|
683
|
+
if (test(node)) return node;
|
|
684
|
+
const children = node.children;
|
|
685
|
+
if (children.length > 0) {
|
|
686
|
+
const result = cssSelectPrimitiveComponentAdapter.findOne(
|
|
687
|
+
test,
|
|
688
|
+
children
|
|
689
|
+
);
|
|
690
|
+
if (result) return result;
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
return null;
|
|
694
|
+
},
|
|
695
|
+
equals: (a, b) => {
|
|
696
|
+
return a._renderId === b._renderId;
|
|
697
|
+
},
|
|
698
|
+
isHovered: (elem) => false,
|
|
699
|
+
isVisited: (elem) => false,
|
|
700
|
+
isActive: (elem) => false
|
|
701
|
+
};
|
|
702
|
+
var cssSelectPrimitiveComponentAdapterWithoutSubcircuits = {
|
|
703
|
+
...cssSelectPrimitiveComponentAdapter,
|
|
704
|
+
getChildren: (node) => node.children.filter((c) => !c.isSubcircuit)
|
|
705
|
+
};
|
|
706
|
+
var cssSelectPrimitiveComponentAdapterOnlySubcircuits = {
|
|
707
|
+
...cssSelectPrimitiveComponentAdapter,
|
|
708
|
+
getChildren: (node) => node.children.filter((c) => c.isSubcircuit)
|
|
709
|
+
};
|
|
710
|
+
|
|
711
|
+
// lib/components/base-components/PrimitiveComponent/preprocessSelector.ts
|
|
712
|
+
var preprocessSelector = (selector) => {
|
|
713
|
+
return selector.replace(/ pin/g, " port").replace(/ subcircuit\./g, " group[isSubcircuit=true]").replace(/([^ ])\>([^ ])/g, "$1 > $2").trim();
|
|
714
|
+
};
|
|
715
|
+
|
|
716
|
+
// lib/components/base-components/PrimitiveComponent/PrimitiveComponent.ts
|
|
717
|
+
var cssSelectOptionsInsideSubcircuit = {
|
|
718
|
+
adapter: cssSelectPrimitiveComponentAdapterWithoutSubcircuits,
|
|
719
|
+
cacheResults: true
|
|
720
|
+
};
|
|
721
|
+
var PrimitiveComponent2 = class extends Renderable {
|
|
606
722
|
parent = null;
|
|
607
723
|
children;
|
|
608
724
|
childrenPendingRemoval;
|
|
@@ -1007,57 +1123,95 @@ var PrimitiveComponent = class extends Renderable {
|
|
|
1007
1123
|
if (this.isGroup) return this;
|
|
1008
1124
|
return this.parent?.getGroup?.() ?? null;
|
|
1009
1125
|
}
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
const
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
return component.getSelectableDescendants();
|
|
1038
|
-
});
|
|
1039
|
-
currentSearch = newSearch;
|
|
1040
|
-
currentResults = newResults;
|
|
1041
|
-
onlyDirectChildren = false;
|
|
1126
|
+
doInitialOptimizeSelectorCache() {
|
|
1127
|
+
if (!this.isSubcircuit) return;
|
|
1128
|
+
const ports = this.selectAll("port");
|
|
1129
|
+
for (const port of ports) {
|
|
1130
|
+
const parentAliases = port.parent?.getNameAndAliases();
|
|
1131
|
+
const portAliases = port.getNameAndAliases();
|
|
1132
|
+
if (!parentAliases) continue;
|
|
1133
|
+
for (const parentAlias of parentAliases) {
|
|
1134
|
+
for (const portAlias of portAliases) {
|
|
1135
|
+
const selectors = [
|
|
1136
|
+
`.${parentAlias} > .${portAlias}`,
|
|
1137
|
+
`.${parentAlias} .${portAlias}`
|
|
1138
|
+
];
|
|
1139
|
+
for (const selector of selectors) {
|
|
1140
|
+
const ar = this._cachedSelectAllQueries.get(selector);
|
|
1141
|
+
if (ar) {
|
|
1142
|
+
ar.push(port);
|
|
1143
|
+
} else {
|
|
1144
|
+
this._cachedSelectAllQueries.set(selector, [port]);
|
|
1145
|
+
}
|
|
1146
|
+
}
|
|
1147
|
+
}
|
|
1148
|
+
}
|
|
1149
|
+
}
|
|
1150
|
+
for (const [selector, ports2] of this._cachedSelectAllQueries.entries()) {
|
|
1151
|
+
if (ports2.length === 1) {
|
|
1152
|
+
this._cachedSelectOneQueries.set(selector, ports2[0]);
|
|
1042
1153
|
}
|
|
1043
1154
|
}
|
|
1044
|
-
return currentResults;
|
|
1045
1155
|
}
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
if (
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
) ?? null;
|
|
1156
|
+
_cachedSelectAllQueries = /* @__PURE__ */ new Map();
|
|
1157
|
+
selectAll(selectorRaw) {
|
|
1158
|
+
if (this._cachedSelectAllQueries.has(selectorRaw)) {
|
|
1159
|
+
return this._cachedSelectAllQueries.get(
|
|
1160
|
+
selectorRaw
|
|
1161
|
+
);
|
|
1053
1162
|
}
|
|
1054
|
-
|
|
1055
|
-
|
|
1163
|
+
const selector = preprocessSelector(selectorRaw);
|
|
1164
|
+
const result = selectAll(selector, this, cssSelectOptionsInsideSubcircuit);
|
|
1165
|
+
if (result.length > 0) {
|
|
1166
|
+
this._cachedSelectAllQueries.set(selectorRaw, result);
|
|
1167
|
+
return result;
|
|
1056
1168
|
}
|
|
1057
|
-
|
|
1058
|
-
|
|
1169
|
+
const [firstpart, ...rest] = selector.split(" ");
|
|
1170
|
+
const subcircuit = selectOne(firstpart, this, {
|
|
1171
|
+
adapter: cssSelectPrimitiveComponentAdapterOnlySubcircuits
|
|
1172
|
+
});
|
|
1173
|
+
if (!subcircuit) return [];
|
|
1174
|
+
const result2 = subcircuit.selectAll(rest.join(" "));
|
|
1175
|
+
this._cachedSelectAllQueries.set(selectorRaw, result2);
|
|
1176
|
+
return result2;
|
|
1177
|
+
}
|
|
1178
|
+
_cachedSelectOneQueries = /* @__PURE__ */ new Map();
|
|
1179
|
+
selectOne(selectorRaw, options) {
|
|
1180
|
+
if (this._cachedSelectOneQueries.has(selectorRaw)) {
|
|
1181
|
+
return this._cachedSelectOneQueries.get(selectorRaw);
|
|
1182
|
+
}
|
|
1183
|
+
const selector = preprocessSelector(selectorRaw);
|
|
1184
|
+
if (options?.port) {
|
|
1185
|
+
options.type = "port";
|
|
1186
|
+
}
|
|
1187
|
+
let result = null;
|
|
1188
|
+
if (options?.type) {
|
|
1189
|
+
const allMatching = selectAll(
|
|
1190
|
+
selector,
|
|
1191
|
+
this,
|
|
1192
|
+
cssSelectOptionsInsideSubcircuit
|
|
1193
|
+
);
|
|
1194
|
+
result = allMatching.find(
|
|
1195
|
+
(n) => n.lowercaseComponentName === options.type
|
|
1196
|
+
);
|
|
1197
|
+
}
|
|
1198
|
+
result ??= selectOne(
|
|
1199
|
+
selector,
|
|
1200
|
+
this,
|
|
1201
|
+
cssSelectOptionsInsideSubcircuit
|
|
1202
|
+
);
|
|
1203
|
+
if (result) {
|
|
1204
|
+
this._cachedSelectOneQueries.set(selectorRaw, result);
|
|
1205
|
+
return result;
|
|
1059
1206
|
}
|
|
1060
|
-
|
|
1207
|
+
const [firstpart, ...rest] = selector.split(" ");
|
|
1208
|
+
const subcircuit = selectOne(firstpart, this, {
|
|
1209
|
+
adapter: cssSelectPrimitiveComponentAdapterOnlySubcircuits
|
|
1210
|
+
});
|
|
1211
|
+
if (!subcircuit) return null;
|
|
1212
|
+
result = subcircuit.selectOne(rest.join(" "), options);
|
|
1213
|
+
this._cachedSelectOneQueries.set(selectorRaw, result);
|
|
1214
|
+
return result;
|
|
1061
1215
|
}
|
|
1062
1216
|
getAvailablePcbLayers() {
|
|
1063
1217
|
if (this.isPcbPrimitive) {
|
|
@@ -1173,7 +1327,7 @@ import { autoroute } from "@tscircuit/infgrid-ijump-astar";
|
|
|
1173
1327
|
var netProps = z3.object({
|
|
1174
1328
|
name: z3.string()
|
|
1175
1329
|
});
|
|
1176
|
-
var Net = class extends
|
|
1330
|
+
var Net = class extends PrimitiveComponent2 {
|
|
1177
1331
|
source_net_id;
|
|
1178
1332
|
get config() {
|
|
1179
1333
|
return {
|
|
@@ -1362,7 +1516,7 @@ var createNetsFromProps = (component, props) => {
|
|
|
1362
1516
|
// lib/components/primitive-components/SmtPad.ts
|
|
1363
1517
|
import { smtPadProps } from "@tscircuit/props";
|
|
1364
1518
|
import { decomposeTSR } from "transformation-matrix";
|
|
1365
|
-
var SmtPad = class extends
|
|
1519
|
+
var SmtPad = class extends PrimitiveComponent2 {
|
|
1366
1520
|
pcb_smtpad_id = null;
|
|
1367
1521
|
matchedPort = null;
|
|
1368
1522
|
isPcbPrimitive = true;
|
|
@@ -1567,7 +1721,7 @@ var SmtPad = class extends PrimitiveComponent {
|
|
|
1567
1721
|
// lib/components/primitive-components/SilkscreenPath.ts
|
|
1568
1722
|
import { silkscreenPathProps } from "@tscircuit/props";
|
|
1569
1723
|
import { applyToPoint as applyToPoint2 } from "transformation-matrix";
|
|
1570
|
-
var SilkscreenPath = class extends
|
|
1724
|
+
var SilkscreenPath = class extends PrimitiveComponent2 {
|
|
1571
1725
|
pcb_silkscreen_path_id = null;
|
|
1572
1726
|
isPcbPrimitive = true;
|
|
1573
1727
|
get config() {
|
|
@@ -1630,7 +1784,7 @@ var SilkscreenPath = class extends PrimitiveComponent {
|
|
|
1630
1784
|
|
|
1631
1785
|
// lib/components/primitive-components/PlatedHole.ts
|
|
1632
1786
|
import { platedHoleProps } from "@tscircuit/props";
|
|
1633
|
-
var PlatedHole = class extends
|
|
1787
|
+
var PlatedHole = class extends PrimitiveComponent2 {
|
|
1634
1788
|
pcb_plated_hole_id = null;
|
|
1635
1789
|
matchedPort = null;
|
|
1636
1790
|
isPcbPrimitive = true;
|
|
@@ -1749,7 +1903,7 @@ var PlatedHole = class extends PrimitiveComponent {
|
|
|
1749
1903
|
// lib/components/primitive-components/Keepout.ts
|
|
1750
1904
|
import { pcbKeepoutProps } from "@tscircuit/props";
|
|
1751
1905
|
import { decomposeTSR as decomposeTSR2 } from "transformation-matrix";
|
|
1752
|
-
var Keepout = class extends
|
|
1906
|
+
var Keepout = class extends PrimitiveComponent2 {
|
|
1753
1907
|
pcb_keepout_id = null;
|
|
1754
1908
|
isPcbPrimitive = true;
|
|
1755
1909
|
get config() {
|
|
@@ -1804,7 +1958,7 @@ var Keepout = class extends PrimitiveComponent {
|
|
|
1804
1958
|
|
|
1805
1959
|
// lib/components/primitive-components/Hole.ts
|
|
1806
1960
|
import { holeProps } from "@tscircuit/props";
|
|
1807
|
-
var Hole = class extends
|
|
1961
|
+
var Hole = class extends PrimitiveComponent2 {
|
|
1808
1962
|
pcb_hole_id = null;
|
|
1809
1963
|
isPcbPrimitive = true;
|
|
1810
1964
|
get config() {
|
|
@@ -1861,7 +2015,7 @@ var Hole = class extends PrimitiveComponent {
|
|
|
1861
2015
|
|
|
1862
2016
|
// lib/components/primitive-components/SilkscreenText.ts
|
|
1863
2017
|
import { silkscreenTextProps } from "@tscircuit/props";
|
|
1864
|
-
var SilkscreenText = class extends
|
|
2018
|
+
var SilkscreenText = class extends PrimitiveComponent2 {
|
|
1865
2019
|
isPcbPrimitive = true;
|
|
1866
2020
|
get config() {
|
|
1867
2021
|
return {
|
|
@@ -2105,7 +2259,7 @@ var portProps = z4.object({
|
|
|
2105
2259
|
pinNumber: z4.number().optional(),
|
|
2106
2260
|
aliases: z4.array(z4.string()).optional()
|
|
2107
2261
|
});
|
|
2108
|
-
var Port = class extends
|
|
2262
|
+
var Port = class extends PrimitiveComponent2 {
|
|
2109
2263
|
source_port_id = null;
|
|
2110
2264
|
pcb_port_id = null;
|
|
2111
2265
|
schematic_port_id = null;
|
|
@@ -2756,7 +2910,7 @@ import { footprintProps } from "@tscircuit/props";
|
|
|
2756
2910
|
import * as kiwi from "@lume/kiwi";
|
|
2757
2911
|
import Debug3 from "debug";
|
|
2758
2912
|
var debug2 = Debug3("tscircuit:core:footprint");
|
|
2759
|
-
var Footprint = class extends
|
|
2913
|
+
var Footprint = class extends PrimitiveComponent2 {
|
|
2760
2914
|
get config() {
|
|
2761
2915
|
return {
|
|
2762
2916
|
componentName: "Footprint",
|
|
@@ -3708,7 +3862,7 @@ var portToObjective = (port) => {
|
|
|
3708
3862
|
};
|
|
3709
3863
|
};
|
|
3710
3864
|
var SHOULD_USE_SINGLE_LAYER_ROUTING = false;
|
|
3711
|
-
var Trace2 = class extends
|
|
3865
|
+
var Trace2 = class extends PrimitiveComponent2 {
|
|
3712
3866
|
source_trace_id = null;
|
|
3713
3867
|
pcb_trace_id = null;
|
|
3714
3868
|
schematic_trace_id = null;
|
|
@@ -3759,7 +3913,7 @@ var Trace2 = class extends PrimitiveComponent {
|
|
|
3759
3913
|
}));
|
|
3760
3914
|
for (const { selector, port } of portsWithSelectors) {
|
|
3761
3915
|
if (!port) {
|
|
3762
|
-
const parentSelector = selector.replace(
|
|
3916
|
+
const parentSelector = selector.replace(/(\> )?[^ ]+$/, "");
|
|
3763
3917
|
const targetComponent = this.getSubcircuit().selectOne(parentSelector);
|
|
3764
3918
|
if (!targetComponent) {
|
|
3765
3919
|
this.renderError(`Could not find port for selector "${selector}"`);
|
|
@@ -4457,7 +4611,7 @@ var rotation3 = z6.object({
|
|
|
4457
4611
|
y: rotation,
|
|
4458
4612
|
z: rotation
|
|
4459
4613
|
});
|
|
4460
|
-
var NormalComponent = class extends
|
|
4614
|
+
var NormalComponent = class extends PrimitiveComponent2 {
|
|
4461
4615
|
reactSubtrees = [];
|
|
4462
4616
|
_impliedFootprint;
|
|
4463
4617
|
isPrimitiveContainer = true;
|
|
@@ -5346,7 +5500,7 @@ import "zod";
|
|
|
5346
5500
|
// lib/components/primitive-components/TraceHint.ts
|
|
5347
5501
|
import { traceHintProps } from "@tscircuit/props";
|
|
5348
5502
|
import { applyToPoint as applyToPoint4 } from "transformation-matrix";
|
|
5349
|
-
var TraceHint = class extends
|
|
5503
|
+
var TraceHint = class extends PrimitiveComponent2 {
|
|
5350
5504
|
matchedPort = null;
|
|
5351
5505
|
get config() {
|
|
5352
5506
|
return {
|
|
@@ -6756,7 +6910,7 @@ var edgeSpecifiers = [
|
|
|
6756
6910
|
"bottomedge",
|
|
6757
6911
|
"center"
|
|
6758
6912
|
];
|
|
6759
|
-
var Constraint2 = class extends
|
|
6913
|
+
var Constraint2 = class extends PrimitiveComponent2 {
|
|
6760
6914
|
get config() {
|
|
6761
6915
|
return {
|
|
6762
6916
|
componentName: "Constraint",
|
|
@@ -6812,7 +6966,7 @@ var Constraint2 = class extends PrimitiveComponent {
|
|
|
6812
6966
|
// lib/components/primitive-components/FabricationNotePath.ts
|
|
6813
6967
|
import { fabricationNotePathProps } from "@tscircuit/props";
|
|
6814
6968
|
import { applyToPoint as applyToPoint5 } from "transformation-matrix";
|
|
6815
|
-
var FabricationNotePath = class extends
|
|
6969
|
+
var FabricationNotePath = class extends PrimitiveComponent2 {
|
|
6816
6970
|
fabrication_note_path_id = null;
|
|
6817
6971
|
get config() {
|
|
6818
6972
|
return {
|
|
@@ -6856,7 +7010,7 @@ var FabricationNotePath = class extends PrimitiveComponent {
|
|
|
6856
7010
|
|
|
6857
7011
|
// lib/components/primitive-components/FabricationNoteText.ts
|
|
6858
7012
|
import { fabricationNoteTextProps } from "@tscircuit/props";
|
|
6859
|
-
var FabricationNoteText = class extends
|
|
7013
|
+
var FabricationNoteText = class extends PrimitiveComponent2 {
|
|
6860
7014
|
get config() {
|
|
6861
7015
|
return {
|
|
6862
7016
|
componentName: "FabricationNoteText",
|
|
@@ -6900,7 +7054,7 @@ var Subcircuit = class extends Group {
|
|
|
6900
7054
|
|
|
6901
7055
|
// lib/components/primitive-components/NetAlias.ts
|
|
6902
7056
|
import { netAliasProps } from "@tscircuit/props";
|
|
6903
|
-
var NetAlias = class extends
|
|
7057
|
+
var NetAlias = class extends PrimitiveComponent2 {
|
|
6904
7058
|
source_net_alias_id;
|
|
6905
7059
|
get config() {
|
|
6906
7060
|
return {
|
|
@@ -6927,7 +7081,7 @@ var NetAlias = class extends PrimitiveComponent {
|
|
|
6927
7081
|
|
|
6928
7082
|
// lib/components/primitive-components/SilkscreenCircle.ts
|
|
6929
7083
|
import { silkscreenCircleProps } from "@tscircuit/props";
|
|
6930
|
-
var SilkscreenCircle = class extends
|
|
7084
|
+
var SilkscreenCircle = class extends PrimitiveComponent2 {
|
|
6931
7085
|
pcb_silkscreen_circle_id = null;
|
|
6932
7086
|
isPcbPrimitive = true;
|
|
6933
7087
|
get config() {
|
|
@@ -6972,7 +7126,7 @@ var SilkscreenCircle = class extends PrimitiveComponent {
|
|
|
6972
7126
|
|
|
6973
7127
|
// lib/components/primitive-components/SilkscreenRect.ts
|
|
6974
7128
|
import { silkscreenRectProps } from "@tscircuit/props";
|
|
6975
|
-
var SilkscreenRect = class extends
|
|
7129
|
+
var SilkscreenRect = class extends PrimitiveComponent2 {
|
|
6976
7130
|
pcb_silkscreen_rect_id = null;
|
|
6977
7131
|
isPcbPrimitive = true;
|
|
6978
7132
|
get config() {
|
|
@@ -7016,7 +7170,7 @@ var SilkscreenRect = class extends PrimitiveComponent {
|
|
|
7016
7170
|
|
|
7017
7171
|
// lib/components/primitive-components/SilkscreenLine.ts
|
|
7018
7172
|
import { silkscreenLineProps } from "@tscircuit/props";
|
|
7019
|
-
var SilkscreenLine = class extends
|
|
7173
|
+
var SilkscreenLine = class extends PrimitiveComponent2 {
|
|
7020
7174
|
pcb_silkscreen_line_id = null;
|
|
7021
7175
|
isPcbPrimitive = true;
|
|
7022
7176
|
get config() {
|
|
@@ -7060,7 +7214,7 @@ var SilkscreenLine = class extends PrimitiveComponent {
|
|
|
7060
7214
|
|
|
7061
7215
|
// lib/components/primitive-components/Via.ts
|
|
7062
7216
|
import { viaProps } from "@tscircuit/props";
|
|
7063
|
-
var Via = class extends
|
|
7217
|
+
var Via = class extends PrimitiveComponent2 {
|
|
7064
7218
|
pcb_via_id = null;
|
|
7065
7219
|
matchedPort = null;
|
|
7066
7220
|
isPcbPrimitive = true;
|
|
@@ -7514,7 +7668,7 @@ import { identity as identity4 } from "transformation-matrix";
|
|
|
7514
7668
|
var package_default = {
|
|
7515
7669
|
name: "@tscircuit/core",
|
|
7516
7670
|
type: "module",
|
|
7517
|
-
version: "0.0.
|
|
7671
|
+
version: "0.0.375",
|
|
7518
7672
|
types: "dist/index.d.ts",
|
|
7519
7673
|
main: "dist/index.js",
|
|
7520
7674
|
module: "dist/index.js",
|
|
@@ -7549,6 +7703,7 @@ var package_default = {
|
|
|
7549
7703
|
"chokidar-cli": "^3.0.0",
|
|
7550
7704
|
"circuit-to-svg": "^0.0.113",
|
|
7551
7705
|
concurrently: "^9.1.2",
|
|
7706
|
+
"css-select": "^5.1.0",
|
|
7552
7707
|
debug: "^4.3.6",
|
|
7553
7708
|
"graphics-debug": "^0.0.4",
|
|
7554
7709
|
howfat: "^0.3.8",
|
|
@@ -7968,7 +8123,7 @@ export {
|
|
|
7968
8123
|
Port,
|
|
7969
8124
|
Potentiometer,
|
|
7970
8125
|
PowerSource,
|
|
7971
|
-
PrimitiveComponent,
|
|
8126
|
+
PrimitiveComponent2 as PrimitiveComponent,
|
|
7972
8127
|
Project,
|
|
7973
8128
|
PushButton,
|
|
7974
8129
|
Renderable,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tscircuit/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.376",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
"chokidar-cli": "^3.0.0",
|
|
37
37
|
"circuit-to-svg": "^0.0.113",
|
|
38
38
|
"concurrently": "^9.1.2",
|
|
39
|
+
"css-select": "^5.1.0",
|
|
39
40
|
"debug": "^4.3.6",
|
|
40
41
|
"graphics-debug": "^0.0.4",
|
|
41
42
|
"howfat": "^0.3.8",
|