@tscircuit/core 0.0.773 → 0.0.775
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 +75 -10
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4316,6 +4316,19 @@ var Footprint = class extends PrimitiveComponent2 {
|
|
|
4316
4316
|
import { cadmodelProps, point3 } from "@tscircuit/props";
|
|
4317
4317
|
import { z as z7 } from "zod";
|
|
4318
4318
|
import { decomposeTSR as decomposeTSR4 } from "transformation-matrix";
|
|
4319
|
+
|
|
4320
|
+
// lib/components/base-components/NormalComponent/utils/getFileExtension.ts
|
|
4321
|
+
var getFileExtension = (filename) => {
|
|
4322
|
+
if (!filename) return null;
|
|
4323
|
+
const withoutQuery = filename.split("?")[0];
|
|
4324
|
+
const sanitized = withoutQuery.split("#")[0];
|
|
4325
|
+
const lastSegment = sanitized.split("/").pop() ?? sanitized;
|
|
4326
|
+
if (!lastSegment.includes(".")) return null;
|
|
4327
|
+
const extension = lastSegment.split(".").pop();
|
|
4328
|
+
return extension?.toLowerCase() ?? null;
|
|
4329
|
+
};
|
|
4330
|
+
|
|
4331
|
+
// lib/components/primitive-components/CadModel.ts
|
|
4319
4332
|
var rotation = z7.union([z7.number(), z7.string()]);
|
|
4320
4333
|
var rotation3 = z7.object({ x: rotation, y: rotation, z: rotation });
|
|
4321
4334
|
var CadModel = class extends PrimitiveComponent2 {
|
|
@@ -4354,7 +4367,7 @@ var CadModel = class extends PrimitiveComponent2 {
|
|
|
4354
4367
|
...typeof props.positionOffset === "object" ? props.positionOffset : {}
|
|
4355
4368
|
});
|
|
4356
4369
|
const layer = parent.props.layer === "bottom" ? "bottom" : "top";
|
|
4357
|
-
const ext =
|
|
4370
|
+
const ext = getFileExtension(props.modelUrl);
|
|
4358
4371
|
const urlProps = {};
|
|
4359
4372
|
if (ext === "stl")
|
|
4360
4373
|
urlProps.model_stl_url = this._addCachebustToModelUrl(props.modelUrl);
|
|
@@ -6999,13 +7012,6 @@ import {
|
|
|
6999
7012
|
external_footprint_load_error
|
|
7000
7013
|
} from "circuit-json";
|
|
7001
7014
|
|
|
7002
|
-
// lib/components/base-components/NormalComponent/utils/getFileExtension.ts
|
|
7003
|
-
var getFileExtension = (filename) => {
|
|
7004
|
-
if (!filename) return null;
|
|
7005
|
-
const cleanFilename = filename.split("?")[0];
|
|
7006
|
-
return cleanFilename.split(".").pop();
|
|
7007
|
-
};
|
|
7008
|
-
|
|
7009
7015
|
// lib/utils/constructAssetUrl.ts
|
|
7010
7016
|
var constructAssetUrl = (targetUrl, baseUrl) => {
|
|
7011
7017
|
if (!baseUrl) {
|
|
@@ -9220,6 +9226,47 @@ import { convertCircuitJsonToBpc } from "circuit-json-to-bpc";
|
|
|
9220
9226
|
import { getGraphicsForBpcGraph, layoutSchematicGraphVariants } from "bpc-graph";
|
|
9221
9227
|
import Debug5 from "debug";
|
|
9222
9228
|
import { buildSubtree } from "@tscircuit/circuit-json-util";
|
|
9229
|
+
|
|
9230
|
+
// lib/components/primitive-components/Group/utils/updateSchematicPrimitivesForLayoutShift.ts
|
|
9231
|
+
function updateSchematicPrimitivesForLayoutShift({
|
|
9232
|
+
db,
|
|
9233
|
+
schematicComponentId,
|
|
9234
|
+
deltaX,
|
|
9235
|
+
deltaY
|
|
9236
|
+
}) {
|
|
9237
|
+
const rects = db.schematic_rect.list({
|
|
9238
|
+
schematic_component_id: schematicComponentId
|
|
9239
|
+
});
|
|
9240
|
+
for (const rect of rects) {
|
|
9241
|
+
rect.center.x += deltaX;
|
|
9242
|
+
rect.center.y += deltaY;
|
|
9243
|
+
}
|
|
9244
|
+
const lines = db.schematic_line.list({
|
|
9245
|
+
schematic_component_id: schematicComponentId
|
|
9246
|
+
});
|
|
9247
|
+
for (const line of lines) {
|
|
9248
|
+
line.x1 += deltaX;
|
|
9249
|
+
line.y1 += deltaY;
|
|
9250
|
+
line.x2 += deltaX;
|
|
9251
|
+
line.y2 += deltaY;
|
|
9252
|
+
}
|
|
9253
|
+
const circles = db.schematic_circle.list({
|
|
9254
|
+
schematic_component_id: schematicComponentId
|
|
9255
|
+
});
|
|
9256
|
+
for (const circle of circles) {
|
|
9257
|
+
circle.center.x += deltaX;
|
|
9258
|
+
circle.center.y += deltaY;
|
|
9259
|
+
}
|
|
9260
|
+
const arcs = db.schematic_arc.list({
|
|
9261
|
+
schematic_component_id: schematicComponentId
|
|
9262
|
+
});
|
|
9263
|
+
for (const arc of arcs) {
|
|
9264
|
+
arc.center.x += deltaX;
|
|
9265
|
+
arc.center.y += deltaY;
|
|
9266
|
+
}
|
|
9267
|
+
}
|
|
9268
|
+
|
|
9269
|
+
// lib/components/primitive-components/Group/Group_doInitialSchematicLayoutMatchAdapt.ts
|
|
9223
9270
|
var debug4 = Debug5("Group_doInitialSchematicLayoutMatchAdapt");
|
|
9224
9271
|
function Group_doInitialSchematicLayoutMatchAdapt(group) {
|
|
9225
9272
|
const { db } = group.root;
|
|
@@ -9307,6 +9354,12 @@ function Group_doInitialSchematicLayoutMatchAdapt(group) {
|
|
|
9307
9354
|
text.position.x += positionDelta.x;
|
|
9308
9355
|
text.position.y += positionDelta.y;
|
|
9309
9356
|
}
|
|
9357
|
+
updateSchematicPrimitivesForLayoutShift({
|
|
9358
|
+
db,
|
|
9359
|
+
schematicComponentId: schematic_component2.schematic_component_id,
|
|
9360
|
+
deltaX: positionDelta.x,
|
|
9361
|
+
deltaY: positionDelta.y
|
|
9362
|
+
});
|
|
9310
9363
|
schematic_component2.center = newCenter;
|
|
9311
9364
|
continue;
|
|
9312
9365
|
}
|
|
@@ -9783,7 +9836,7 @@ function Group_doInitialSchematicLayoutMatchPack(group) {
|
|
|
9783
9836
|
if (!treeNode) {
|
|
9784
9837
|
debug5(`Warning: No tree node found for chip: ${chipId}`);
|
|
9785
9838
|
debug5(
|
|
9786
|
-
|
|
9839
|
+
"Available tree nodes:",
|
|
9787
9840
|
tree.childNodes.map((child, idx) => ({
|
|
9788
9841
|
type: child.nodeType,
|
|
9789
9842
|
name: child.nodeType === "component" ? child.sourceComponent?.name : child.sourceGroup?.name,
|
|
@@ -9820,6 +9873,12 @@ function Group_doInitialSchematicLayoutMatchPack(group) {
|
|
|
9820
9873
|
text.position.x += positionDelta.x;
|
|
9821
9874
|
text.position.y += positionDelta.y;
|
|
9822
9875
|
}
|
|
9876
|
+
updateSchematicPrimitivesForLayoutShift({
|
|
9877
|
+
db,
|
|
9878
|
+
schematicComponentId: schematicComponent.schematic_component_id,
|
|
9879
|
+
deltaX: positionDelta.x,
|
|
9880
|
+
deltaY: positionDelta.y
|
|
9881
|
+
});
|
|
9823
9882
|
schematicComponent.center = newCenter;
|
|
9824
9883
|
if (placement.ccwRotationDegrees !== 0) {
|
|
9825
9884
|
debug5(
|
|
@@ -10114,6 +10173,12 @@ function Group_doInitialSchematicLayoutGrid(group) {
|
|
|
10114
10173
|
}
|
|
10115
10174
|
});
|
|
10116
10175
|
}
|
|
10176
|
+
updateSchematicPrimitivesForLayoutShift({
|
|
10177
|
+
db,
|
|
10178
|
+
schematicComponentId: child.schematic_component_id,
|
|
10179
|
+
deltaX,
|
|
10180
|
+
deltaY
|
|
10181
|
+
});
|
|
10117
10182
|
}
|
|
10118
10183
|
}
|
|
10119
10184
|
if (group.schematic_group_id) {
|
|
@@ -16125,7 +16190,7 @@ import { identity as identity6 } from "transformation-matrix";
|
|
|
16125
16190
|
var package_default = {
|
|
16126
16191
|
name: "@tscircuit/core",
|
|
16127
16192
|
type: "module",
|
|
16128
|
-
version: "0.0.
|
|
16193
|
+
version: "0.0.774",
|
|
16129
16194
|
types: "dist/index.d.ts",
|
|
16130
16195
|
main: "dist/index.js",
|
|
16131
16196
|
module: "dist/index.js",
|