@tscircuit/core 0.0.937 → 0.0.938
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 +21 -0
- package/dist/index.js +80 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -24622,6 +24622,10 @@ declare class SilkscreenCircle extends PrimitiveComponent<typeof silkscreenCircl
|
|
|
24622
24622
|
width: number;
|
|
24623
24623
|
height: number;
|
|
24624
24624
|
};
|
|
24625
|
+
_repositionOnPcb({ deltaX, deltaY }: {
|
|
24626
|
+
deltaX: number;
|
|
24627
|
+
deltaY: number;
|
|
24628
|
+
}): void;
|
|
24625
24629
|
}
|
|
24626
24630
|
|
|
24627
24631
|
declare class SilkscreenPath extends PrimitiveComponent<typeof silkscreenPathProps> {
|
|
@@ -24794,6 +24798,10 @@ declare class SilkscreenPath extends PrimitiveComponent<typeof silkscreenPathPro
|
|
|
24794
24798
|
x: number;
|
|
24795
24799
|
y: number;
|
|
24796
24800
|
}): void;
|
|
24801
|
+
_repositionOnPcb({ deltaX, deltaY }: {
|
|
24802
|
+
deltaX: number;
|
|
24803
|
+
deltaY: number;
|
|
24804
|
+
}): void;
|
|
24797
24805
|
getPcbSize(): {
|
|
24798
24806
|
width: number;
|
|
24799
24807
|
height: number;
|
|
@@ -24956,9 +24964,14 @@ declare class SilkscreenRect extends PrimitiveComponent<typeof silkscreenRectPro
|
|
|
24956
24964
|
width: number;
|
|
24957
24965
|
height: number;
|
|
24958
24966
|
};
|
|
24967
|
+
_repositionOnPcb({ deltaX, deltaY }: {
|
|
24968
|
+
deltaX: number;
|
|
24969
|
+
deltaY: number;
|
|
24970
|
+
}): void;
|
|
24959
24971
|
}
|
|
24960
24972
|
|
|
24961
24973
|
declare class SilkscreenText extends PrimitiveComponent<typeof silkscreenTextProps> {
|
|
24974
|
+
pcb_silkscreen_text_ids: string[];
|
|
24962
24975
|
isPcbPrimitive: boolean;
|
|
24963
24976
|
get config(): {
|
|
24964
24977
|
componentName: string;
|
|
@@ -25140,6 +25153,10 @@ declare class SilkscreenText extends PrimitiveComponent<typeof silkscreenTextPro
|
|
|
25140
25153
|
width: number;
|
|
25141
25154
|
height: number;
|
|
25142
25155
|
};
|
|
25156
|
+
_repositionOnPcb({ deltaX, deltaY }: {
|
|
25157
|
+
deltaX: number;
|
|
25158
|
+
deltaY: number;
|
|
25159
|
+
}): void;
|
|
25143
25160
|
}
|
|
25144
25161
|
|
|
25145
25162
|
declare class SilkscreenLine extends PrimitiveComponent<typeof silkscreenLineProps> {
|
|
@@ -25287,6 +25304,10 @@ declare class SilkscreenLine extends PrimitiveComponent<typeof silkscreenLinePro
|
|
|
25287
25304
|
width: number;
|
|
25288
25305
|
height: number;
|
|
25289
25306
|
};
|
|
25307
|
+
_repositionOnPcb({ deltaX, deltaY }: {
|
|
25308
|
+
deltaX: number;
|
|
25309
|
+
deltaY: number;
|
|
25310
|
+
}): void;
|
|
25290
25311
|
}
|
|
25291
25312
|
|
|
25292
25313
|
declare class SmtPad extends PrimitiveComponent<typeof smtPadProps> {
|
package/dist/index.js
CHANGED
|
@@ -2562,6 +2562,21 @@ var SilkscreenPath = class extends PrimitiveComponent2 {
|
|
|
2562
2562
|
route: newRoute
|
|
2563
2563
|
});
|
|
2564
2564
|
}
|
|
2565
|
+
_repositionOnPcb({ deltaX, deltaY }) {
|
|
2566
|
+
if (this.root?.pcbDisabled) return;
|
|
2567
|
+
const { db } = this.root;
|
|
2568
|
+
if (!this.pcb_silkscreen_path_id) return;
|
|
2569
|
+
const path = db.pcb_silkscreen_path.get(this.pcb_silkscreen_path_id);
|
|
2570
|
+
if (path) {
|
|
2571
|
+
db.pcb_silkscreen_path.update(this.pcb_silkscreen_path_id, {
|
|
2572
|
+
route: path.route.map((p) => ({
|
|
2573
|
+
...p,
|
|
2574
|
+
x: p.x + deltaX,
|
|
2575
|
+
y: p.y + deltaY
|
|
2576
|
+
}))
|
|
2577
|
+
});
|
|
2578
|
+
}
|
|
2579
|
+
}
|
|
2565
2580
|
getPcbSize() {
|
|
2566
2581
|
const { _parsedProps: props } = this;
|
|
2567
2582
|
if (!props.route || props.route.length === 0) {
|
|
@@ -3148,6 +3163,7 @@ function normalizeTextForCircuitJson(text) {
|
|
|
3148
3163
|
|
|
3149
3164
|
// lib/components/primitive-components/SilkscreenText.ts
|
|
3150
3165
|
var SilkscreenText = class extends PrimitiveComponent2 {
|
|
3166
|
+
pcb_silkscreen_text_ids = [];
|
|
3151
3167
|
isPcbPrimitive = true;
|
|
3152
3168
|
get config() {
|
|
3153
3169
|
return {
|
|
@@ -3179,7 +3195,7 @@ var SilkscreenText = class extends PrimitiveComponent2 {
|
|
|
3179
3195
|
const targetLayers = uniqueLayers.size > 0 ? Array.from(uniqueLayers) : ["top"];
|
|
3180
3196
|
const fontSize = props.fontSize ?? this.getInheritedProperty("pcbStyle")?.silkscreenFontSize ?? 1;
|
|
3181
3197
|
for (const layer of targetLayers) {
|
|
3182
|
-
db.pcb_silkscreen_text.insert({
|
|
3198
|
+
const pcb_silkscreen_text = db.pcb_silkscreen_text.insert({
|
|
3183
3199
|
anchor_alignment: props.anchorAlignment,
|
|
3184
3200
|
anchor_position: {
|
|
3185
3201
|
x: position.x,
|
|
@@ -3194,6 +3210,9 @@ var SilkscreenText = class extends PrimitiveComponent2 {
|
|
|
3194
3210
|
subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
|
|
3195
3211
|
pcb_group_id: this.getGroup()?.pcb_group_id ?? void 0
|
|
3196
3212
|
});
|
|
3213
|
+
this.pcb_silkscreen_text_ids.push(
|
|
3214
|
+
pcb_silkscreen_text.pcb_silkscreen_text_id
|
|
3215
|
+
);
|
|
3197
3216
|
}
|
|
3198
3217
|
}
|
|
3199
3218
|
getPcbSize() {
|
|
@@ -3204,6 +3223,21 @@ var SilkscreenText = class extends PrimitiveComponent2 {
|
|
|
3204
3223
|
const textHeight = fontSize;
|
|
3205
3224
|
return { width: textWidth * fontSize, height: textHeight * fontSize };
|
|
3206
3225
|
}
|
|
3226
|
+
_repositionOnPcb({ deltaX, deltaY }) {
|
|
3227
|
+
if (this.root?.pcbDisabled) return;
|
|
3228
|
+
const { db } = this.root;
|
|
3229
|
+
for (const id of this.pcb_silkscreen_text_ids) {
|
|
3230
|
+
const text = db.pcb_silkscreen_text.get(id);
|
|
3231
|
+
if (text) {
|
|
3232
|
+
db.pcb_silkscreen_text.update(id, {
|
|
3233
|
+
anchor_position: {
|
|
3234
|
+
x: text.anchor_position.x + deltaX,
|
|
3235
|
+
y: text.anchor_position.y + deltaY
|
|
3236
|
+
}
|
|
3237
|
+
});
|
|
3238
|
+
}
|
|
3239
|
+
}
|
|
3240
|
+
}
|
|
3207
3241
|
};
|
|
3208
3242
|
|
|
3209
3243
|
// lib/components/primitive-components/Cutout.ts
|
|
@@ -15969,6 +16003,8 @@ var Board = class extends Group6 {
|
|
|
15969
16003
|
y: childOldCenter.y + deltaY
|
|
15970
16004
|
});
|
|
15971
16005
|
}
|
|
16006
|
+
} else if (child.isPcbPrimitive && "_repositionOnPcb" in child && typeof child._repositionOnPcb === "function") {
|
|
16007
|
+
child._repositionOnPcb({ deltaX, deltaY });
|
|
15972
16008
|
}
|
|
15973
16009
|
}
|
|
15974
16010
|
if (this.pcb_board_id) {
|
|
@@ -17917,6 +17953,20 @@ var SilkscreenCircle = class extends PrimitiveComponent2 {
|
|
|
17917
17953
|
const diameter = props.radius * 2;
|
|
17918
17954
|
return { width: diameter, height: diameter };
|
|
17919
17955
|
}
|
|
17956
|
+
_repositionOnPcb({ deltaX, deltaY }) {
|
|
17957
|
+
if (this.root?.pcbDisabled) return;
|
|
17958
|
+
const { db } = this.root;
|
|
17959
|
+
if (!this.pcb_silkscreen_circle_id) return;
|
|
17960
|
+
const circle = db.pcb_silkscreen_circle.get(this.pcb_silkscreen_circle_id);
|
|
17961
|
+
if (circle) {
|
|
17962
|
+
db.pcb_silkscreen_circle.update(this.pcb_silkscreen_circle_id, {
|
|
17963
|
+
center: {
|
|
17964
|
+
x: circle.center.x + deltaX,
|
|
17965
|
+
y: circle.center.y + deltaY
|
|
17966
|
+
}
|
|
17967
|
+
});
|
|
17968
|
+
}
|
|
17969
|
+
}
|
|
17920
17970
|
};
|
|
17921
17971
|
|
|
17922
17972
|
// lib/components/primitive-components/SilkscreenRect.ts
|
|
@@ -17965,6 +18015,20 @@ var SilkscreenRect = class extends PrimitiveComponent2 {
|
|
|
17965
18015
|
const { _parsedProps: props } = this;
|
|
17966
18016
|
return { width: props.width, height: props.height };
|
|
17967
18017
|
}
|
|
18018
|
+
_repositionOnPcb({ deltaX, deltaY }) {
|
|
18019
|
+
if (this.root?.pcbDisabled) return;
|
|
18020
|
+
const { db } = this.root;
|
|
18021
|
+
if (!this.pcb_silkscreen_rect_id) return;
|
|
18022
|
+
const rect = db.pcb_silkscreen_rect.get(this.pcb_silkscreen_rect_id);
|
|
18023
|
+
if (rect) {
|
|
18024
|
+
db.pcb_silkscreen_rect.update(this.pcb_silkscreen_rect_id, {
|
|
18025
|
+
center: {
|
|
18026
|
+
x: rect.center.x + deltaX,
|
|
18027
|
+
y: rect.center.y + deltaY
|
|
18028
|
+
}
|
|
18029
|
+
});
|
|
18030
|
+
}
|
|
18031
|
+
}
|
|
17968
18032
|
};
|
|
17969
18033
|
|
|
17970
18034
|
// lib/components/primitive-components/SilkscreenLine.ts
|
|
@@ -18010,6 +18074,20 @@ var SilkscreenLine = class extends PrimitiveComponent2 {
|
|
|
18010
18074
|
const height = Math.abs(props.y2 - props.y1);
|
|
18011
18075
|
return { width, height };
|
|
18012
18076
|
}
|
|
18077
|
+
_repositionOnPcb({ deltaX, deltaY }) {
|
|
18078
|
+
if (this.root?.pcbDisabled) return;
|
|
18079
|
+
const { db } = this.root;
|
|
18080
|
+
if (!this.pcb_silkscreen_line_id) return;
|
|
18081
|
+
const line = db.pcb_silkscreen_line.get(this.pcb_silkscreen_line_id);
|
|
18082
|
+
if (line) {
|
|
18083
|
+
db.pcb_silkscreen_line.update(this.pcb_silkscreen_line_id, {
|
|
18084
|
+
x1: line.x1 + deltaX,
|
|
18085
|
+
y1: line.y1 + deltaY,
|
|
18086
|
+
x2: line.x2 + deltaX,
|
|
18087
|
+
y2: line.y2 + deltaY
|
|
18088
|
+
});
|
|
18089
|
+
}
|
|
18090
|
+
}
|
|
18013
18091
|
};
|
|
18014
18092
|
|
|
18015
18093
|
// lib/components/primitive-components/Fiducial.ts
|
|
@@ -19690,7 +19768,7 @@ import { identity as identity5 } from "transformation-matrix";
|
|
|
19690
19768
|
var package_default = {
|
|
19691
19769
|
name: "@tscircuit/core",
|
|
19692
19770
|
type: "module",
|
|
19693
|
-
version: "0.0.
|
|
19771
|
+
version: "0.0.937",
|
|
19694
19772
|
types: "dist/index.d.ts",
|
|
19695
19773
|
main: "dist/index.js",
|
|
19696
19774
|
module: "dist/index.js",
|