@tscircuit/core 0.0.1151 → 0.0.1152
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 +1 -0
- package/dist/index.js +93 -2
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -93121,6 +93121,7 @@ declare class Connector<PinLabels extends string = never> extends Chip<PinLabels
|
|
|
93121
93121
|
doInitialFetchPartFootprint(): void;
|
|
93122
93122
|
doInitialPartsEngineRender(): void;
|
|
93123
93123
|
updatePartsEngineRender(): void;
|
|
93124
|
+
doInitialSchematicComponentRender(): void;
|
|
93124
93125
|
doInitialPcbComponentSizeCalculation(): void;
|
|
93125
93126
|
}
|
|
93126
93127
|
|
package/dist/index.js
CHANGED
|
@@ -19149,7 +19149,7 @@ import { identity as identity5 } from "transformation-matrix";
|
|
|
19149
19149
|
var package_default = {
|
|
19150
19150
|
name: "@tscircuit/core",
|
|
19151
19151
|
type: "module",
|
|
19152
|
-
version: "0.0.
|
|
19152
|
+
version: "0.0.1151",
|
|
19153
19153
|
types: "dist/index.d.ts",
|
|
19154
19154
|
main: "dist/index.js",
|
|
19155
19155
|
module: "dist/index.js",
|
|
@@ -19214,7 +19214,7 @@ var package_default = {
|
|
|
19214
19214
|
"circuit-json-to-gltf": "^0.0.91",
|
|
19215
19215
|
"circuit-json-to-simple-3d": "^0.0.9",
|
|
19216
19216
|
"circuit-json-to-spice": "^0.0.34",
|
|
19217
|
-
"circuit-to-svg": "^0.0.
|
|
19217
|
+
"circuit-to-svg": "^0.0.343",
|
|
19218
19218
|
concurrently: "^9.1.2",
|
|
19219
19219
|
"connectivity-map": "^1.0.0",
|
|
19220
19220
|
debug: "^4.3.6",
|
|
@@ -23028,6 +23028,88 @@ var rewriteToStandardUsbCPortHints = (circuitJson) => {
|
|
|
23028
23028
|
});
|
|
23029
23029
|
};
|
|
23030
23030
|
|
|
23031
|
+
// lib/components/normal-components/Connector.ts
|
|
23032
|
+
import { symbols as symbols4 } from "schematic-symbols";
|
|
23033
|
+
|
|
23034
|
+
// lib/components/normal-components/Connector_insertInnerSymbolInSchematicBox.ts
|
|
23035
|
+
function insertInnerSymbolInSchematicBox(connector, symbol) {
|
|
23036
|
+
if (!connector.schematic_component_id || !connector.root) return;
|
|
23037
|
+
const { db } = connector.root;
|
|
23038
|
+
const schematicComponent = db.schematic_component.get(
|
|
23039
|
+
connector.schematic_component_id
|
|
23040
|
+
);
|
|
23041
|
+
if (!schematicComponent) return;
|
|
23042
|
+
if (schematicComponent.symbol_name) return;
|
|
23043
|
+
const innerScaleFactor = 0.5;
|
|
23044
|
+
const targetWidth = schematicComponent.size.width * innerScaleFactor;
|
|
23045
|
+
const targetHeight = schematicComponent.size.height * innerScaleFactor;
|
|
23046
|
+
const scaleFactor = Math.min(
|
|
23047
|
+
targetWidth / symbol.size.width,
|
|
23048
|
+
targetHeight / symbol.size.height
|
|
23049
|
+
);
|
|
23050
|
+
if (!Number.isFinite(scaleFactor) || scaleFactor <= 0) return;
|
|
23051
|
+
const subcircuit_id = connector.getSubcircuit()?.subcircuit_id ?? void 0;
|
|
23052
|
+
const center = schematicComponent.center;
|
|
23053
|
+
const symbolCenter = symbol.center;
|
|
23054
|
+
const transformPoint = (point6) => ({
|
|
23055
|
+
x: center.x + (point6.x - symbolCenter.x) * scaleFactor,
|
|
23056
|
+
y: center.y + (point6.y - symbolCenter.y) * scaleFactor
|
|
23057
|
+
});
|
|
23058
|
+
for (const primitive of symbol.primitives) {
|
|
23059
|
+
if (primitive.type === "path") {
|
|
23060
|
+
const points = primitive.points.map(transformPoint);
|
|
23061
|
+
if (primitive.closed && points.length > 1) {
|
|
23062
|
+
const first = points[0];
|
|
23063
|
+
const last = points[points.length - 1];
|
|
23064
|
+
if (first.x !== last.x || first.y !== last.y) {
|
|
23065
|
+
points.push(first);
|
|
23066
|
+
}
|
|
23067
|
+
}
|
|
23068
|
+
db.schematic_path.insert({
|
|
23069
|
+
schematic_component_id: connector.schematic_component_id,
|
|
23070
|
+
points,
|
|
23071
|
+
is_filled: primitive.fill ?? false,
|
|
23072
|
+
fill_color: primitive.fill ? SCHEMATIC_COMPONENT_OUTLINE_COLOR : void 0,
|
|
23073
|
+
stroke_width: 0.02,
|
|
23074
|
+
subcircuit_id
|
|
23075
|
+
});
|
|
23076
|
+
} else if (primitive.type === "circle") {
|
|
23077
|
+
db.schematic_circle.insert({
|
|
23078
|
+
schematic_component_id: connector.schematic_component_id,
|
|
23079
|
+
center: transformPoint({ x: primitive.x, y: primitive.y }),
|
|
23080
|
+
radius: primitive.radius * scaleFactor,
|
|
23081
|
+
stroke_width: 0.02,
|
|
23082
|
+
color: SCHEMATIC_COMPONENT_OUTLINE_COLOR,
|
|
23083
|
+
is_filled: primitive.fill,
|
|
23084
|
+
fill_color: primitive.fill ? SCHEMATIC_COMPONENT_OUTLINE_COLOR : void 0,
|
|
23085
|
+
is_dashed: false,
|
|
23086
|
+
subcircuit_id
|
|
23087
|
+
});
|
|
23088
|
+
} else if (primitive.type === "box") {
|
|
23089
|
+
const topLeft = transformPoint({ x: primitive.x, y: primitive.y });
|
|
23090
|
+
const bottomRight = transformPoint({
|
|
23091
|
+
x: primitive.x + primitive.width,
|
|
23092
|
+
y: primitive.y + primitive.height
|
|
23093
|
+
});
|
|
23094
|
+
db.schematic_rect.insert({
|
|
23095
|
+
schematic_component_id: connector.schematic_component_id,
|
|
23096
|
+
center: {
|
|
23097
|
+
x: (topLeft.x + bottomRight.x) / 2,
|
|
23098
|
+
y: (topLeft.y + bottomRight.y) / 2
|
|
23099
|
+
},
|
|
23100
|
+
width: Math.abs(bottomRight.x - topLeft.x),
|
|
23101
|
+
height: Math.abs(bottomRight.y - topLeft.y),
|
|
23102
|
+
stroke_width: 0.02,
|
|
23103
|
+
color: SCHEMATIC_COMPONENT_OUTLINE_COLOR,
|
|
23104
|
+
is_filled: false,
|
|
23105
|
+
is_dashed: false,
|
|
23106
|
+
rotation: 0,
|
|
23107
|
+
subcircuit_id
|
|
23108
|
+
});
|
|
23109
|
+
}
|
|
23110
|
+
}
|
|
23111
|
+
}
|
|
23112
|
+
|
|
23031
23113
|
// lib/components/normal-components/Connector.ts
|
|
23032
23114
|
var Connector = class extends Chip {
|
|
23033
23115
|
_getConnectorProps() {
|
|
@@ -23184,6 +23266,15 @@ var Connector = class extends Chip {
|
|
|
23184
23266
|
if (this._isUsingStandardPartsEngineCircuitJsonFlow()) return;
|
|
23185
23267
|
super.updatePartsEngineRender();
|
|
23186
23268
|
}
|
|
23269
|
+
doInitialSchematicComponentRender() {
|
|
23270
|
+
super.doInitialSchematicComponentRender();
|
|
23271
|
+
if (!this.root?.schematicDisabled && this.schematic_component_id && this._getConnectorProps().standard === "usb_c") {
|
|
23272
|
+
const usbcSymbol = symbols4.usbc;
|
|
23273
|
+
if (usbcSymbol) {
|
|
23274
|
+
insertInnerSymbolInSchematicBox(this, usbcSymbol);
|
|
23275
|
+
}
|
|
23276
|
+
}
|
|
23277
|
+
}
|
|
23187
23278
|
doInitialPcbComponentSizeCalculation() {
|
|
23188
23279
|
super.doInitialPcbComponentSizeCalculation();
|
|
23189
23280
|
if (this.root?.pcbDisabled) return;
|
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.1152",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"circuit-json-to-gltf": "^0.0.91",
|
|
67
67
|
"circuit-json-to-simple-3d": "^0.0.9",
|
|
68
68
|
"circuit-json-to-spice": "^0.0.34",
|
|
69
|
-
"circuit-to-svg": "^0.0.
|
|
69
|
+
"circuit-to-svg": "^0.0.343",
|
|
70
70
|
"concurrently": "^9.1.2",
|
|
71
71
|
"connectivity-map": "^1.0.0",
|
|
72
72
|
"debug": "^4.3.6",
|