@tscircuit/core 0.0.1301 → 0.0.1303
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 -4
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -5795,6 +5795,9 @@ var underscorifyPortArrangement = (portArrangement) => {
|
|
|
5795
5795
|
return void 0;
|
|
5796
5796
|
};
|
|
5797
5797
|
|
|
5798
|
+
// lib/utils/createComponentsFromCircuitJson.ts
|
|
5799
|
+
import { getUnitVectorFromDirection as getUnitVectorFromDirection2 } from "@tscircuit/math-utils";
|
|
5800
|
+
|
|
5798
5801
|
// lib/components/primitive-components/CourtyardCircle.ts
|
|
5799
5802
|
import { courtyardCircleProps } from "@tscircuit/props";
|
|
5800
5803
|
var CourtyardCircle = class extends PrimitiveComponent2 {
|
|
@@ -7867,7 +7870,9 @@ var SchematicLine = class extends PrimitiveComponent2 {
|
|
|
7867
7870
|
y2: props.y2 + globalPos.y,
|
|
7868
7871
|
stroke_width: props.strokeWidth ?? SCHEMATIC_COMPONENT_OUTLINE_STROKE_WIDTH,
|
|
7869
7872
|
color: props.color ?? SCHEMATIC_COMPONENT_OUTLINE_COLOR,
|
|
7870
|
-
is_dashed:
|
|
7873
|
+
is_dashed: props.isDashed || props.dashLength !== void 0 || props.dashGap !== void 0,
|
|
7874
|
+
dash_length: props.dashLength,
|
|
7875
|
+
dash_gap: props.dashGap,
|
|
7871
7876
|
subcircuit_id: this.getSubcircuit().subcircuit_id ?? void 0
|
|
7872
7877
|
});
|
|
7873
7878
|
this.schematic_line_id = schematic_line.schematic_line_id;
|
|
@@ -8055,9 +8060,12 @@ var SchematicPath = class extends PrimitiveComponent2 {
|
|
|
8055
8060
|
y: point6.y + globalPos.y
|
|
8056
8061
|
})),
|
|
8057
8062
|
is_filled: props.isFilled,
|
|
8063
|
+
is_dashed: props.dashLength !== void 0 || props.dashGap !== void 0,
|
|
8058
8064
|
fill_color: props.fillColor,
|
|
8059
8065
|
stroke_color: props.strokeColor,
|
|
8060
8066
|
stroke_width: props.strokeWidth,
|
|
8067
|
+
dash_length: props.dashLength,
|
|
8068
|
+
dash_gap: props.dashGap,
|
|
8061
8069
|
subcircuit_id
|
|
8062
8070
|
});
|
|
8063
8071
|
this.schematic_path_ids.push(schematic_path.schematic_path_id);
|
|
@@ -8071,9 +8079,12 @@ var SchematicPath = class extends PrimitiveComponent2 {
|
|
|
8071
8079
|
y: point6.y + globalPos.y
|
|
8072
8080
|
})),
|
|
8073
8081
|
is_filled: props.isFilled,
|
|
8082
|
+
is_dashed: props.dashLength !== void 0 || props.dashGap !== void 0,
|
|
8074
8083
|
fill_color: props.fillColor,
|
|
8075
8084
|
stroke_color: props.strokeColor,
|
|
8076
8085
|
stroke_width: props.strokeWidth,
|
|
8086
|
+
dash_length: props.dashLength,
|
|
8087
|
+
dash_gap: props.dashGap,
|
|
8077
8088
|
subcircuit_id
|
|
8078
8089
|
});
|
|
8079
8090
|
this.schematic_path_ids.push(schematic_path.schematic_path_id);
|
|
@@ -9320,6 +9331,18 @@ var calculateCcwRotation = (componentRotationStr, elementCcwRotation) => {
|
|
|
9320
9331
|
return normalizedRotation;
|
|
9321
9332
|
};
|
|
9322
9333
|
var optional = (value) => value ?? void 0;
|
|
9334
|
+
var getFacingDirectionFromSide = (side) => {
|
|
9335
|
+
switch (side) {
|
|
9336
|
+
case "left":
|
|
9337
|
+
case "right":
|
|
9338
|
+
return side;
|
|
9339
|
+
case "top":
|
|
9340
|
+
return "up";
|
|
9341
|
+
case "bottom":
|
|
9342
|
+
return "down";
|
|
9343
|
+
}
|
|
9344
|
+
return null;
|
|
9345
|
+
};
|
|
9323
9346
|
var createComponentsFromCircuitJson = ({
|
|
9324
9347
|
componentName,
|
|
9325
9348
|
componentRotation,
|
|
@@ -9329,6 +9352,7 @@ var createComponentsFromCircuitJson = ({
|
|
|
9329
9352
|
}, circuitJson) => {
|
|
9330
9353
|
const components = [];
|
|
9331
9354
|
const schematicSymbolsByImportedId = /* @__PURE__ */ new Map();
|
|
9355
|
+
const schematicComponentsByImportedId = /* @__PURE__ */ new Map();
|
|
9332
9356
|
for (const elm of circuitJson) {
|
|
9333
9357
|
if (elm.type !== "schematic_symbol") continue;
|
|
9334
9358
|
const schematicSymbol = new SymbolComponent({
|
|
@@ -9337,6 +9361,10 @@ var createComponentsFromCircuitJson = ({
|
|
|
9337
9361
|
schematicSymbolsByImportedId.set(elm.schematic_symbol_id, schematicSymbol);
|
|
9338
9362
|
components.push(schematicSymbol);
|
|
9339
9363
|
}
|
|
9364
|
+
for (const elm of circuitJson) {
|
|
9365
|
+
if (elm.type !== "schematic_component") continue;
|
|
9366
|
+
schematicComponentsByImportedId.set(elm.schematic_component_id, elm);
|
|
9367
|
+
}
|
|
9340
9368
|
const addSchematicPrimitive = (elm, primitive) => {
|
|
9341
9369
|
const schematicSymbolId = elm.schematic_symbol_id;
|
|
9342
9370
|
const parentSymbol = typeof schematicSymbolId === "string" ? schematicSymbolsByImportedId.get(schematicSymbolId) : void 0;
|
|
@@ -9878,6 +9906,33 @@ var createComponentsFromCircuitJson = ({
|
|
|
9878
9906
|
fillColor: elm.fill_color
|
|
9879
9907
|
})
|
|
9880
9908
|
);
|
|
9909
|
+
} else if (elm.type === "schematic_port") {
|
|
9910
|
+
const schematicComponentId = elm.schematic_component_id;
|
|
9911
|
+
if (typeof schematicComponentId !== "string") continue;
|
|
9912
|
+
const schematicComponent = schematicComponentsByImportedId.get(schematicComponentId);
|
|
9913
|
+
const schematicSymbolId = schematicComponent?.schematic_symbol_id;
|
|
9914
|
+
const parentSymbol = typeof schematicSymbolId === "string" ? schematicSymbolsByImportedId.get(schematicSymbolId) : void 0;
|
|
9915
|
+
if (parentSymbol && schematicComponent?.is_box_with_pins === true && elm.center && elm.side_of_component) {
|
|
9916
|
+
const distance19 = elm.distance_from_component_edge;
|
|
9917
|
+
const facingDirection = getFacingDirectionFromSide(
|
|
9918
|
+
elm.side_of_component
|
|
9919
|
+
);
|
|
9920
|
+
if (!facingDirection) continue;
|
|
9921
|
+
const directionVector = getUnitVectorFromDirection2(facingDirection);
|
|
9922
|
+
const portCenter = {
|
|
9923
|
+
x: elm.center.x + directionVector.x * distance19,
|
|
9924
|
+
y: elm.center.y + directionVector.y * distance19
|
|
9925
|
+
};
|
|
9926
|
+
parentSymbol.add(
|
|
9927
|
+
new SchematicLine({
|
|
9928
|
+
x1: elm.center.x,
|
|
9929
|
+
y1: elm.center.y,
|
|
9930
|
+
x2: portCenter.x,
|
|
9931
|
+
y2: portCenter.y,
|
|
9932
|
+
isDashed: false
|
|
9933
|
+
})
|
|
9934
|
+
);
|
|
9935
|
+
}
|
|
9881
9936
|
}
|
|
9882
9937
|
}
|
|
9883
9938
|
return components;
|
|
@@ -23373,7 +23428,7 @@ import { identity as identity5 } from "transformation-matrix";
|
|
|
23373
23428
|
var package_default = {
|
|
23374
23429
|
name: "@tscircuit/core",
|
|
23375
23430
|
type: "module",
|
|
23376
|
-
version: "0.0.
|
|
23431
|
+
version: "0.0.1302",
|
|
23377
23432
|
types: "dist/index.d.ts",
|
|
23378
23433
|
main: "dist/index.js",
|
|
23379
23434
|
module: "dist/index.js",
|
|
@@ -23435,13 +23490,13 @@ var package_default = {
|
|
|
23435
23490
|
"bun-match-svg": "0.0.12",
|
|
23436
23491
|
"calculate-elbow": "^0.0.12",
|
|
23437
23492
|
"chokidar-cli": "^3.0.0",
|
|
23438
|
-
"circuit-json": "^0.0.
|
|
23493
|
+
"circuit-json": "^0.0.433",
|
|
23439
23494
|
"circuit-json-to-bpc": "^0.0.13",
|
|
23440
23495
|
"circuit-json-to-connectivity-map": "^0.0.23",
|
|
23441
23496
|
"circuit-json-to-gltf": "^0.0.102",
|
|
23442
23497
|
"circuit-json-to-simple-3d": "^0.0.9",
|
|
23443
23498
|
"circuit-json-to-spice": "^0.0.36",
|
|
23444
|
-
"circuit-to-svg": "^0.0.
|
|
23499
|
+
"circuit-to-svg": "^0.0.353",
|
|
23445
23500
|
concurrently: "^9.1.2",
|
|
23446
23501
|
"connectivity-map": "^1.0.0",
|
|
23447
23502
|
debug: "^4.3.6",
|
|
@@ -28281,6 +28336,7 @@ function insertInnerSymbolInSchematicBox(connector, symbol) {
|
|
|
28281
28336
|
schematic_component_id: connector.schematic_component_id,
|
|
28282
28337
|
points,
|
|
28283
28338
|
is_filled: primitive.fill ?? false,
|
|
28339
|
+
is_dashed: false,
|
|
28284
28340
|
fill_color: primitive.fill ? SCHEMATIC_COMPONENT_OUTLINE_COLOR : void 0,
|
|
28285
28341
|
stroke_width: 0.02,
|
|
28286
28342
|
subcircuit_id
|
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.1303",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -63,13 +63,13 @@
|
|
|
63
63
|
"bun-match-svg": "0.0.12",
|
|
64
64
|
"calculate-elbow": "^0.0.12",
|
|
65
65
|
"chokidar-cli": "^3.0.0",
|
|
66
|
-
"circuit-json": "^0.0.
|
|
66
|
+
"circuit-json": "^0.0.433",
|
|
67
67
|
"circuit-json-to-bpc": "^0.0.13",
|
|
68
68
|
"circuit-json-to-connectivity-map": "^0.0.23",
|
|
69
69
|
"circuit-json-to-gltf": "^0.0.102",
|
|
70
70
|
"circuit-json-to-simple-3d": "^0.0.9",
|
|
71
71
|
"circuit-json-to-spice": "^0.0.36",
|
|
72
|
-
"circuit-to-svg": "^0.0.
|
|
72
|
+
"circuit-to-svg": "^0.0.353",
|
|
73
73
|
"concurrently": "^9.1.2",
|
|
74
74
|
"connectivity-map": "^1.0.0",
|
|
75
75
|
"debug": "^4.3.6",
|