@tscircuit/core 0.0.1044 → 0.0.1046
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 +46 -33
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -9424,10 +9424,14 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
|
|
|
9424
9424
|
source_component_id: this.source_component_id,
|
|
9425
9425
|
subcircuit_id: subcircuit.subcircuit_id ?? void 0,
|
|
9426
9426
|
do_not_place: props.doNotPlace ?? false,
|
|
9427
|
-
obstructs_within_bounds: props.obstructsWithinBounds ?? true
|
|
9427
|
+
obstructs_within_bounds: props.obstructsWithinBounds ?? true,
|
|
9428
|
+
metadata: props.kicadFootprintMetadata ? { kicad_footprint: props.kicadFootprintMetadata } : void 0
|
|
9428
9429
|
});
|
|
9429
9430
|
const footprint = props.footprint ?? this._getImpliedFootprintString();
|
|
9430
|
-
|
|
9431
|
+
const hasFootprintChild = this.children.some(
|
|
9432
|
+
(c) => c.componentName === "Footprint"
|
|
9433
|
+
);
|
|
9434
|
+
if (!footprint && !hasFootprintChild && !this.isGroup) {
|
|
9431
9435
|
const footprint_error = db.pcb_missing_footprint_error.insert({
|
|
9432
9436
|
message: `No footprint found for component: ${this.getString()}`,
|
|
9433
9437
|
source_component_id: `${this.source_component_id}`,
|
|
@@ -16207,16 +16211,19 @@ var extractPcbPrimitivesFromCircuitJson = ({
|
|
|
16207
16211
|
return components;
|
|
16208
16212
|
};
|
|
16209
16213
|
|
|
16210
|
-
// lib/components/primitive-components/Group/Subcircuit/inflators/
|
|
16211
|
-
var
|
|
16214
|
+
// lib/components/primitive-components/Group/Subcircuit/inflators/inflateFootprintComponent.ts
|
|
16215
|
+
var inflateFootprintComponent = (pcbElm, inflatorContext) => {
|
|
16212
16216
|
const { injectionDb, normalComponent } = inflatorContext;
|
|
16213
|
-
if (!normalComponent) return;
|
|
16214
|
-
const
|
|
16217
|
+
if (!normalComponent) return null;
|
|
16218
|
+
const primitives = extractPcbPrimitivesFromCircuitJson({
|
|
16215
16219
|
pcbComponent: pcbElm,
|
|
16216
16220
|
db: injectionDb,
|
|
16217
16221
|
componentName: normalComponent.name
|
|
16218
16222
|
});
|
|
16219
|
-
|
|
16223
|
+
if (primitives.length === 0) return null;
|
|
16224
|
+
const footprint = new Footprint({});
|
|
16225
|
+
footprint.addAll(primitives);
|
|
16226
|
+
return footprint;
|
|
16220
16227
|
};
|
|
16221
16228
|
|
|
16222
16229
|
// lib/components/primitive-components/Group/Subcircuit/inflators/inflateSourceCapacitor.ts
|
|
@@ -16239,10 +16246,13 @@ function inflateSourceCapacitor(sourceElm, inflatorContext) {
|
|
|
16239
16246
|
obstructsWithinBounds: pcbElm?.obstructs_within_bounds
|
|
16240
16247
|
});
|
|
16241
16248
|
if (pcbElm) {
|
|
16242
|
-
|
|
16249
|
+
const footprint = inflateFootprintComponent(pcbElm, {
|
|
16243
16250
|
...inflatorContext,
|
|
16244
16251
|
normalComponent: capacitor
|
|
16245
16252
|
});
|
|
16253
|
+
if (footprint) {
|
|
16254
|
+
capacitor.add(footprint);
|
|
16255
|
+
}
|
|
16246
16256
|
}
|
|
16247
16257
|
if (sourceElm.source_group_id && groupsMap?.has(sourceElm.source_group_id)) {
|
|
16248
16258
|
const group = groupsMap.get(sourceElm.source_group_id);
|
|
@@ -16348,7 +16358,8 @@ var Chip = class extends NormalComponent3 {
|
|
|
16348
16358
|
subcircuit_id: this.getSubcircuit().subcircuit_id ?? void 0,
|
|
16349
16359
|
do_not_place: props.doNotPlace ?? false,
|
|
16350
16360
|
obstructs_within_bounds: props.obstructsWithinBounds ?? true,
|
|
16351
|
-
is_allowed_to_be_off_board: props.allowOffBoard ?? false
|
|
16361
|
+
is_allowed_to_be_off_board: props.allowOffBoard ?? false,
|
|
16362
|
+
metadata: props.kicadFootprintMetadata ? { kicad_footprint: props.kicadFootprintMetadata } : void 0
|
|
16352
16363
|
});
|
|
16353
16364
|
this.pcb_component_id = pcb_component.pcb_component_id;
|
|
16354
16365
|
}
|
|
@@ -16416,21 +16427,6 @@ var Chip = class extends NormalComponent3 {
|
|
|
16416
16427
|
}
|
|
16417
16428
|
};
|
|
16418
16429
|
|
|
16419
|
-
// lib/components/primitive-components/Group/Subcircuit/inflators/inflateFootprintComponent.ts
|
|
16420
|
-
var inflateFootprintComponent = (pcbElm, inflatorContext) => {
|
|
16421
|
-
const { injectionDb, normalComponent } = inflatorContext;
|
|
16422
|
-
if (!normalComponent) return null;
|
|
16423
|
-
const primitives = extractPcbPrimitivesFromCircuitJson({
|
|
16424
|
-
pcbComponent: pcbElm,
|
|
16425
|
-
db: injectionDb,
|
|
16426
|
-
componentName: normalComponent.name
|
|
16427
|
-
});
|
|
16428
|
-
if (primitives.length === 0) return null;
|
|
16429
|
-
const footprint = new Footprint({});
|
|
16430
|
-
footprint.addAll(primitives);
|
|
16431
|
-
return footprint;
|
|
16432
|
-
};
|
|
16433
|
-
|
|
16434
16430
|
// lib/components/primitive-components/Group/Subcircuit/inflators/inflateSourceChip.ts
|
|
16435
16431
|
var mapInternallyConnectedSourcePortIdsToPinLabels = (sourcePortIds, inflatorContext) => {
|
|
16436
16432
|
if (!sourcePortIds || sourcePortIds.length === 0) return void 0;
|
|
@@ -16570,10 +16566,13 @@ function inflateSourceDiode(sourceElm, inflatorContext) {
|
|
|
16570
16566
|
obstructsWithinBounds: pcbElm?.obstructs_within_bounds
|
|
16571
16567
|
});
|
|
16572
16568
|
if (pcbElm) {
|
|
16573
|
-
|
|
16569
|
+
const footprint = inflateFootprintComponent(pcbElm, {
|
|
16574
16570
|
...inflatorContext,
|
|
16575
16571
|
normalComponent: diode
|
|
16576
16572
|
});
|
|
16573
|
+
if (footprint) {
|
|
16574
|
+
diode.add(footprint);
|
|
16575
|
+
}
|
|
16577
16576
|
}
|
|
16578
16577
|
if (sourceElm.source_group_id && groupsMap?.has(sourceElm.source_group_id)) {
|
|
16579
16578
|
const group = groupsMap.get(sourceElm.source_group_id);
|
|
@@ -16662,10 +16661,13 @@ function inflateSourceInductor(sourceElm, inflatorContext) {
|
|
|
16662
16661
|
obstructsWithinBounds: pcbElm?.obstructs_within_bounds
|
|
16663
16662
|
});
|
|
16664
16663
|
if (pcbElm) {
|
|
16665
|
-
|
|
16664
|
+
const footprint = inflateFootprintComponent(pcbElm, {
|
|
16666
16665
|
...inflatorContext,
|
|
16667
16666
|
normalComponent: inductor
|
|
16668
16667
|
});
|
|
16668
|
+
if (footprint) {
|
|
16669
|
+
inductor.add(footprint);
|
|
16670
|
+
}
|
|
16669
16671
|
}
|
|
16670
16672
|
if (sourceElm.source_group_id && groupsMap?.has(sourceElm.source_group_id)) {
|
|
16671
16673
|
const group = groupsMap.get(sourceElm.source_group_id);
|
|
@@ -16809,10 +16811,13 @@ function inflateSourceResistor(sourceElm, inflatorContext) {
|
|
|
16809
16811
|
obstructsWithinBounds: pcbElm?.obstructs_within_bounds
|
|
16810
16812
|
});
|
|
16811
16813
|
if (pcbElm) {
|
|
16812
|
-
|
|
16814
|
+
const footprint = inflateFootprintComponent(pcbElm, {
|
|
16813
16815
|
...inflatorContext,
|
|
16814
16816
|
normalComponent: resistor
|
|
16815
16817
|
});
|
|
16818
|
+
if (footprint) {
|
|
16819
|
+
resistor.add(footprint);
|
|
16820
|
+
}
|
|
16816
16821
|
}
|
|
16817
16822
|
if (sourceElm.source_group_id && groupsMap?.has(sourceElm.source_group_id)) {
|
|
16818
16823
|
const group = groupsMap.get(sourceElm.source_group_id);
|
|
@@ -16987,10 +16992,13 @@ function inflateSourceTransistor(sourceElm, inflatorContext) {
|
|
|
16987
16992
|
obstructsWithinBounds: pcbElm?.obstructs_within_bounds
|
|
16988
16993
|
});
|
|
16989
16994
|
if (pcbElm) {
|
|
16990
|
-
|
|
16995
|
+
const footprint = inflateFootprintComponent(pcbElm, {
|
|
16991
16996
|
...inflatorContext,
|
|
16992
16997
|
normalComponent: transistor
|
|
16993
16998
|
});
|
|
16999
|
+
if (footprint) {
|
|
17000
|
+
transistor.add(footprint);
|
|
17001
|
+
}
|
|
16994
17002
|
}
|
|
16995
17003
|
if (sourceElm.source_group_id && groupsMap?.has(sourceElm.source_group_id)) {
|
|
16996
17004
|
const group = groupsMap.get(sourceElm.source_group_id);
|
|
@@ -17547,7 +17555,7 @@ import { identity as identity4 } from "transformation-matrix";
|
|
|
17547
17555
|
var package_default = {
|
|
17548
17556
|
name: "@tscircuit/core",
|
|
17549
17557
|
type: "module",
|
|
17550
|
-
version: "0.0.
|
|
17558
|
+
version: "0.0.1045",
|
|
17551
17559
|
types: "dist/index.d.ts",
|
|
17552
17560
|
main: "dist/index.js",
|
|
17553
17561
|
module: "dist/index.js",
|
|
@@ -17605,7 +17613,7 @@ var package_default = {
|
|
|
17605
17613
|
"bun-match-svg": "0.0.12",
|
|
17606
17614
|
"calculate-elbow": "^0.0.12",
|
|
17607
17615
|
"chokidar-cli": "^3.0.0",
|
|
17608
|
-
"circuit-json": "^0.0.
|
|
17616
|
+
"circuit-json": "^0.0.383",
|
|
17609
17617
|
"circuit-json-to-bpc": "^0.0.13",
|
|
17610
17618
|
"circuit-json-to-connectivity-map": "^0.0.23",
|
|
17611
17619
|
"circuit-json-to-gltf": "^0.0.68",
|
|
@@ -19054,7 +19062,8 @@ var Jumper = class extends NormalComponent3 {
|
|
|
19054
19062
|
source_component_id: this.source_component_id,
|
|
19055
19063
|
subcircuit_id: this.getSubcircuit().subcircuit_id ?? void 0,
|
|
19056
19064
|
do_not_place: props.doNotPlace ?? false,
|
|
19057
|
-
obstructs_within_bounds: props.obstructsWithinBounds ?? true
|
|
19065
|
+
obstructs_within_bounds: props.obstructsWithinBounds ?? true,
|
|
19066
|
+
metadata: props.kicadFootprintMetadata ? { kicad_footprint: props.kicadFootprintMetadata } : void 0
|
|
19058
19067
|
});
|
|
19059
19068
|
this.pcb_component_id = pcb_component.pcb_component_id;
|
|
19060
19069
|
}
|
|
@@ -19277,7 +19286,8 @@ var SolderJumper = class extends NormalComponent3 {
|
|
|
19277
19286
|
source_component_id: this.source_component_id,
|
|
19278
19287
|
subcircuit_id: this.getSubcircuit().subcircuit_id ?? void 0,
|
|
19279
19288
|
do_not_place: props.doNotPlace ?? false,
|
|
19280
|
-
obstructs_within_bounds: props.obstructsWithinBounds ?? true
|
|
19289
|
+
obstructs_within_bounds: props.obstructsWithinBounds ?? true,
|
|
19290
|
+
metadata: props.kicadFootprintMetadata ? { kicad_footprint: props.kicadFootprintMetadata } : void 0
|
|
19281
19291
|
});
|
|
19282
19292
|
this.pcb_component_id = pcb_component.pcb_component_id;
|
|
19283
19293
|
}
|
|
@@ -23001,8 +23011,11 @@ var SymbolComponent = class extends PrimitiveComponent2 {
|
|
|
23001
23011
|
if (this.root?.schematicDisabled) return;
|
|
23002
23012
|
const { db } = this.root;
|
|
23003
23013
|
const { _parsedProps: props } = this;
|
|
23014
|
+
const parentNormal = this.getParentNormalComponent();
|
|
23015
|
+
const kicadSymbolMetadata = parentNormal?._parsedProps?.kicadSymbolMetadata;
|
|
23004
23016
|
const schematic_symbol = db.schematic_symbol.insert({
|
|
23005
|
-
name: props.name
|
|
23017
|
+
name: props.name,
|
|
23018
|
+
metadata: kicadSymbolMetadata ? { kicad_symbol: kicadSymbolMetadata } : void 0
|
|
23006
23019
|
});
|
|
23007
23020
|
this.schematic_symbol_id = schematic_symbol.schematic_symbol_id;
|
|
23008
23021
|
}
|
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.1046",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"bun-match-svg": "0.0.12",
|
|
60
60
|
"calculate-elbow": "^0.0.12",
|
|
61
61
|
"chokidar-cli": "^3.0.0",
|
|
62
|
-
"circuit-json": "^0.0.
|
|
62
|
+
"circuit-json": "^0.0.383",
|
|
63
63
|
"circuit-json-to-bpc": "^0.0.13",
|
|
64
64
|
"circuit-json-to-connectivity-map": "^0.0.23",
|
|
65
65
|
"circuit-json-to-gltf": "^0.0.68",
|