@tscircuit/core 0.0.1098 → 0.0.1100
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.js +60 -11
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -840,6 +840,42 @@ function parseExpression(tokens, vars) {
|
|
|
840
840
|
return result;
|
|
841
841
|
}
|
|
842
842
|
|
|
843
|
+
// lib/utils/getSubcircuitPcbCalcVariables.ts
|
|
844
|
+
function setSubcircuitPcbComponentCalcVariables(params) {
|
|
845
|
+
const { vars, componentName, position, size } = params;
|
|
846
|
+
vars[`${componentName}.x`] = position.x;
|
|
847
|
+
vars[`${componentName}.y`] = position.y;
|
|
848
|
+
vars[`${componentName}.width`] = size.width;
|
|
849
|
+
vars[`${componentName}.height`] = size.height;
|
|
850
|
+
vars[`${componentName}.minX`] = position.x - size.width / 2;
|
|
851
|
+
vars[`${componentName}.maxX`] = position.x + size.width / 2;
|
|
852
|
+
vars[`${componentName}.minY`] = position.y - size.height / 2;
|
|
853
|
+
vars[`${componentName}.maxY`] = position.y + size.height / 2;
|
|
854
|
+
}
|
|
855
|
+
function getSubcircuitPcbCalcVariables(db) {
|
|
856
|
+
const vars = {};
|
|
857
|
+
for (const sourceComponent of db.source_component.list()) {
|
|
858
|
+
if (!sourceComponent.name) continue;
|
|
859
|
+
const pcbComponent = db.pcb_component.getWhere({
|
|
860
|
+
source_component_id: sourceComponent.source_component_id
|
|
861
|
+
});
|
|
862
|
+
if (!pcbComponent) continue;
|
|
863
|
+
setSubcircuitPcbComponentCalcVariables({
|
|
864
|
+
vars,
|
|
865
|
+
componentName: sourceComponent.name,
|
|
866
|
+
position: {
|
|
867
|
+
x: pcbComponent.center.x,
|
|
868
|
+
y: pcbComponent.center.y
|
|
869
|
+
},
|
|
870
|
+
size: {
|
|
871
|
+
width: pcbComponent.width ?? 0,
|
|
872
|
+
height: pcbComponent.height ?? 0
|
|
873
|
+
}
|
|
874
|
+
});
|
|
875
|
+
}
|
|
876
|
+
return vars;
|
|
877
|
+
}
|
|
878
|
+
|
|
843
879
|
// lib/utils/pcbSx/convert-pcb-style-to-pcb-sx.ts
|
|
844
880
|
function convertPcbStyleToPcbSx(pcbStyle) {
|
|
845
881
|
if (!pcbStyle) return void 0;
|
|
@@ -1221,7 +1257,8 @@ var PrimitiveComponent2 = class extends Renderable {
|
|
|
1221
1257
|
);
|
|
1222
1258
|
}
|
|
1223
1259
|
const allowBoardVariables = options.allowBoardVariables ?? this._shouldAllowBoardVariablesByDefault();
|
|
1224
|
-
const
|
|
1260
|
+
const isNormalComponent = this._isNormalComponent === true;
|
|
1261
|
+
const allowComponentVariables = options.allowComponentVariables ?? (!isNormalComponent && !this._isInsideFootprint());
|
|
1225
1262
|
const includesBoardVariable = rawValue.includes("board.");
|
|
1226
1263
|
const knownVariables = {};
|
|
1227
1264
|
if (allowBoardVariables) {
|
|
@@ -1240,6 +1277,10 @@ var PrimitiveComponent2 = class extends Renderable {
|
|
|
1240
1277
|
Object.assign(knownVariables, boardVariables);
|
|
1241
1278
|
}
|
|
1242
1279
|
if (allowComponentVariables) {
|
|
1280
|
+
const db = this.root?.db;
|
|
1281
|
+
if (db) {
|
|
1282
|
+
Object.assign(knownVariables, getSubcircuitPcbCalcVariables(db));
|
|
1283
|
+
}
|
|
1243
1284
|
Object.assign(knownVariables, options.componentVariables ?? {});
|
|
1244
1285
|
}
|
|
1245
1286
|
try {
|
|
@@ -11155,6 +11196,7 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
|
|
|
11155
11196
|
// lib/components/normal-components/Board.ts
|
|
11156
11197
|
import {
|
|
11157
11198
|
runAllNetlistChecks,
|
|
11199
|
+
runAllPinSpecificationChecks,
|
|
11158
11200
|
runAllPlacementChecks,
|
|
11159
11201
|
runAllRoutingChecks
|
|
11160
11202
|
} from "@tscircuit/checks";
|
|
@@ -13108,14 +13150,12 @@ function updateVarsForNamedComponent(component, vars) {
|
|
|
13108
13150
|
const height = pcbComponent.height ?? 0;
|
|
13109
13151
|
const x = pcbComponent.center.x;
|
|
13110
13152
|
const y = pcbComponent.center.y;
|
|
13111
|
-
|
|
13112
|
-
|
|
13113
|
-
|
|
13114
|
-
|
|
13115
|
-
|
|
13116
|
-
|
|
13117
|
-
vars[`${component.name}.minY`] = y - height / 2;
|
|
13118
|
-
vars[`${component.name}.maxY`] = y + height / 2;
|
|
13153
|
+
setSubcircuitPcbComponentCalcVariables({
|
|
13154
|
+
vars,
|
|
13155
|
+
componentName: component.name,
|
|
13156
|
+
position: { x, y },
|
|
13157
|
+
size: { width, height }
|
|
13158
|
+
});
|
|
13119
13159
|
const padElementsByReference = collectPadElementsByReference(component);
|
|
13120
13160
|
for (const [referencePath, elements] of padElementsByReference.entries()) {
|
|
13121
13161
|
const bounds = getBoundsOfPcbElements(elements);
|
|
@@ -18210,7 +18250,7 @@ import { identity as identity5 } from "transformation-matrix";
|
|
|
18210
18250
|
var package_default = {
|
|
18211
18251
|
name: "@tscircuit/core",
|
|
18212
18252
|
type: "module",
|
|
18213
|
-
version: "0.0.
|
|
18253
|
+
version: "0.0.1099",
|
|
18214
18254
|
types: "dist/index.d.ts",
|
|
18215
18255
|
main: "dist/index.js",
|
|
18216
18256
|
module: "dist/index.js",
|
|
@@ -18243,7 +18283,7 @@ var package_default = {
|
|
|
18243
18283
|
"@resvg/resvg-js": "^2.6.2",
|
|
18244
18284
|
"@tscircuit/alphabet": "0.0.18",
|
|
18245
18285
|
"@tscircuit/capacity-autorouter": "^0.0.320",
|
|
18246
|
-
"@tscircuit/checks": "0.0.
|
|
18286
|
+
"@tscircuit/checks": "0.0.107",
|
|
18247
18287
|
"@tscircuit/circuit-json-util": "^0.0.82",
|
|
18248
18288
|
"@tscircuit/common": "^0.0.20",
|
|
18249
18289
|
"@tscircuit/copper-pour-solver": "^0.0.20",
|
|
@@ -19132,9 +19172,13 @@ var Board = class extends Group6 {
|
|
|
19132
19172
|
const pcbDisabled = this.root?.pcbDisabled;
|
|
19133
19173
|
const drcChecksDisabled = this.root?.platform?.drcChecksDisabled ?? this.getInheritedProperty("drcChecksDisabled");
|
|
19134
19174
|
const netlistDrcChecksDisabled = this.root?.platform?.netlistDrcChecksDisabled ?? this.getInheritedProperty("netlistDrcChecksDisabled");
|
|
19175
|
+
const pinSpecificationDrcChecksDisabled = this.getInheritedProperty(
|
|
19176
|
+
"pinSpecificationDrcChecksDisabled"
|
|
19177
|
+
);
|
|
19135
19178
|
const placementDrcChecksDisabled = this.root?.platform?.placementDrcChecksDisabled ?? this.getInheritedProperty("placementDrcChecksDisabled");
|
|
19136
19179
|
const routingDrcChecksDisabled = this.root?.platform?.routingDrcChecksDisabled ?? this.getInheritedProperty("routingDrcChecksDisabled");
|
|
19137
19180
|
const shouldRunNetlistChecks = !drcChecksDisabled && !netlistDrcChecksDisabled;
|
|
19181
|
+
const shouldRunPinSpecificationChecks = !drcChecksDisabled && !pinSpecificationDrcChecksDisabled;
|
|
19138
19182
|
const shouldRunPlacementChecks = !drcChecksDisabled && !pcbDisabled && !placementDrcChecksDisabled;
|
|
19139
19183
|
const shouldRunRoutingChecks = !drcChecksDisabled && !pcbDisabled && !routingDisabled && !routingDrcChecksDisabled;
|
|
19140
19184
|
if (shouldRunRoutingChecks && this._hasIncompleteAsyncEffectsInSubtreeForPhase("PcbTraceRender"))
|
|
@@ -19160,6 +19204,11 @@ var Board = class extends Group6 {
|
|
|
19160
19204
|
runAllNetlistChecks(circuitJson)
|
|
19161
19205
|
);
|
|
19162
19206
|
}
|
|
19207
|
+
if (shouldRunPinSpecificationChecks) {
|
|
19208
|
+
checksToRun.push(
|
|
19209
|
+
runAllPinSpecificationChecks(circuitJson)
|
|
19210
|
+
);
|
|
19211
|
+
}
|
|
19163
19212
|
const checkResults = await Promise.all(checksToRun);
|
|
19164
19213
|
db.insertAll(checkResults.flat());
|
|
19165
19214
|
};
|
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.1100",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@resvg/resvg-js": "^2.6.2",
|
|
35
35
|
"@tscircuit/alphabet": "0.0.18",
|
|
36
36
|
"@tscircuit/capacity-autorouter": "^0.0.320",
|
|
37
|
-
"@tscircuit/checks": "0.0.
|
|
37
|
+
"@tscircuit/checks": "0.0.107",
|
|
38
38
|
"@tscircuit/circuit-json-util": "^0.0.82",
|
|
39
39
|
"@tscircuit/common": "^0.0.20",
|
|
40
40
|
"@tscircuit/copper-pour-solver": "^0.0.20",
|