@tscircuit/pcb-viewer 1.11.228 → 1.11.229
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 +179 -3
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -7812,6 +7812,180 @@ var convertElementToPrimitives = (element, allElements) => {
|
|
|
7812
7812
|
return [];
|
|
7813
7813
|
}
|
|
7814
7814
|
}
|
|
7815
|
+
case "pcb_note_line": {
|
|
7816
|
+
const noteLineElement = element;
|
|
7817
|
+
return [
|
|
7818
|
+
{
|
|
7819
|
+
_pcb_drawing_object_id: getNewPcbDrawingObjectId("pcb_note_line"),
|
|
7820
|
+
pcb_drawing_type: "line",
|
|
7821
|
+
x1: noteLineElement.x1,
|
|
7822
|
+
y1: noteLineElement.y1,
|
|
7823
|
+
x2: noteLineElement.x2,
|
|
7824
|
+
y2: noteLineElement.y2,
|
|
7825
|
+
width: noteLineElement.stroke_width ?? 0.1,
|
|
7826
|
+
squareCap: false,
|
|
7827
|
+
layer: "notes",
|
|
7828
|
+
_element: element,
|
|
7829
|
+
_parent_pcb_component,
|
|
7830
|
+
_parent_source_component
|
|
7831
|
+
}
|
|
7832
|
+
];
|
|
7833
|
+
}
|
|
7834
|
+
case "pcb_note_rect": {
|
|
7835
|
+
const noteRectElement = element;
|
|
7836
|
+
return [
|
|
7837
|
+
{
|
|
7838
|
+
_pcb_drawing_object_id: getNewPcbDrawingObjectId("pcb_note_rect"),
|
|
7839
|
+
pcb_drawing_type: "rect",
|
|
7840
|
+
x: noteRectElement.center.x,
|
|
7841
|
+
y: noteRectElement.center.y,
|
|
7842
|
+
w: noteRectElement.width,
|
|
7843
|
+
h: noteRectElement.height,
|
|
7844
|
+
layer: "notes",
|
|
7845
|
+
stroke_width: noteRectElement.stroke_width,
|
|
7846
|
+
is_filled: noteRectElement.is_filled,
|
|
7847
|
+
has_stroke: noteRectElement.has_stroke,
|
|
7848
|
+
is_stroke_dashed: noteRectElement.is_stroke_dashed,
|
|
7849
|
+
_element: element,
|
|
7850
|
+
_parent_pcb_component,
|
|
7851
|
+
_parent_source_component
|
|
7852
|
+
}
|
|
7853
|
+
];
|
|
7854
|
+
}
|
|
7855
|
+
case "pcb_note_path": {
|
|
7856
|
+
const notePathElement = element;
|
|
7857
|
+
const { route, stroke_width } = notePathElement;
|
|
7858
|
+
return route.slice(0, -1).map((point, index) => {
|
|
7859
|
+
const nextPoint = route[index + 1];
|
|
7860
|
+
return {
|
|
7861
|
+
_pcb_drawing_object_id: getNewPcbDrawingObjectId("pcb_note_path"),
|
|
7862
|
+
pcb_drawing_type: "line",
|
|
7863
|
+
x1: point.x,
|
|
7864
|
+
y1: point.y,
|
|
7865
|
+
x2: nextPoint.x,
|
|
7866
|
+
y2: nextPoint.y,
|
|
7867
|
+
width: stroke_width ?? 0.1,
|
|
7868
|
+
squareCap: false,
|
|
7869
|
+
layer: "notes",
|
|
7870
|
+
_element: element,
|
|
7871
|
+
_parent_pcb_component,
|
|
7872
|
+
_parent_source_component
|
|
7873
|
+
};
|
|
7874
|
+
}).filter(Boolean);
|
|
7875
|
+
}
|
|
7876
|
+
case "pcb_note_text": {
|
|
7877
|
+
const noteTextElement = element;
|
|
7878
|
+
return [
|
|
7879
|
+
{
|
|
7880
|
+
_pcb_drawing_object_id: getNewPcbDrawingObjectId("pcb_note_text"),
|
|
7881
|
+
pcb_drawing_type: "text",
|
|
7882
|
+
x: noteTextElement.anchor_position.x,
|
|
7883
|
+
y: noteTextElement.anchor_position.y,
|
|
7884
|
+
layer: "notes",
|
|
7885
|
+
align: noteTextElement.anchor_alignment ?? "center",
|
|
7886
|
+
text: noteTextElement.text,
|
|
7887
|
+
size: noteTextElement.font_size,
|
|
7888
|
+
_element: element,
|
|
7889
|
+
_parent_pcb_component,
|
|
7890
|
+
_parent_source_component
|
|
7891
|
+
}
|
|
7892
|
+
];
|
|
7893
|
+
}
|
|
7894
|
+
case "pcb_note_dimension": {
|
|
7895
|
+
const dimensionElement = element;
|
|
7896
|
+
const { from, to, text, font_size, arrow_size } = dimensionElement;
|
|
7897
|
+
const primitives = [];
|
|
7898
|
+
primitives.push({
|
|
7899
|
+
_pcb_drawing_object_id: getNewPcbDrawingObjectId("pcb_note_dimension"),
|
|
7900
|
+
pcb_drawing_type: "line",
|
|
7901
|
+
x1: from.x,
|
|
7902
|
+
y1: from.y,
|
|
7903
|
+
x2: to.x,
|
|
7904
|
+
y2: to.y,
|
|
7905
|
+
width: 0.05,
|
|
7906
|
+
squareCap: false,
|
|
7907
|
+
layer: "notes",
|
|
7908
|
+
_element: element,
|
|
7909
|
+
_parent_pcb_component,
|
|
7910
|
+
_parent_source_component
|
|
7911
|
+
});
|
|
7912
|
+
const dx = to.x - from.x;
|
|
7913
|
+
const dy = to.y - from.y;
|
|
7914
|
+
const length = Math.sqrt(dx * dx + dy * dy);
|
|
7915
|
+
const unitX = dx / length;
|
|
7916
|
+
const unitY = dy / length;
|
|
7917
|
+
const arrowAngle = Math.PI / 6;
|
|
7918
|
+
const arrow1X1 = from.x + arrow_size * (unitX * Math.cos(arrowAngle) - unitY * Math.sin(arrowAngle));
|
|
7919
|
+
const arrow1Y1 = from.y + arrow_size * (unitX * Math.sin(arrowAngle) + unitY * Math.cos(arrowAngle));
|
|
7920
|
+
const arrow1X2 = from.x + arrow_size * (unitX * Math.cos(-arrowAngle) - unitY * Math.sin(-arrowAngle));
|
|
7921
|
+
const arrow1Y2 = from.y + arrow_size * (unitX * Math.sin(-arrowAngle) + unitY * Math.cos(-arrowAngle));
|
|
7922
|
+
primitives.push({
|
|
7923
|
+
_pcb_drawing_object_id: getNewPcbDrawingObjectId("pcb_note_dimension"),
|
|
7924
|
+
pcb_drawing_type: "line",
|
|
7925
|
+
x1: from.x,
|
|
7926
|
+
y1: from.y,
|
|
7927
|
+
x2: arrow1X1,
|
|
7928
|
+
y2: arrow1Y1,
|
|
7929
|
+
width: 0.05,
|
|
7930
|
+
squareCap: false,
|
|
7931
|
+
layer: "notes",
|
|
7932
|
+
_element: element
|
|
7933
|
+
});
|
|
7934
|
+
primitives.push({
|
|
7935
|
+
_pcb_drawing_object_id: getNewPcbDrawingObjectId("pcb_note_dimension"),
|
|
7936
|
+
pcb_drawing_type: "line",
|
|
7937
|
+
x1: from.x,
|
|
7938
|
+
y1: from.y,
|
|
7939
|
+
x2: arrow1X2,
|
|
7940
|
+
y2: arrow1Y2,
|
|
7941
|
+
width: 0.05,
|
|
7942
|
+
squareCap: false,
|
|
7943
|
+
layer: "notes",
|
|
7944
|
+
_element: element
|
|
7945
|
+
});
|
|
7946
|
+
const arrow2X1 = to.x - arrow_size * (unitX * Math.cos(arrowAngle) - unitY * Math.sin(arrowAngle));
|
|
7947
|
+
const arrow2Y1 = to.y - arrow_size * (unitX * Math.sin(arrowAngle) + unitY * Math.cos(arrowAngle));
|
|
7948
|
+
const arrow2X2 = to.x - arrow_size * (unitX * Math.cos(-arrowAngle) - unitY * Math.sin(-arrowAngle));
|
|
7949
|
+
const arrow2Y2 = to.y - arrow_size * (unitX * Math.sin(-arrowAngle) + unitY * Math.cos(-arrowAngle));
|
|
7950
|
+
primitives.push({
|
|
7951
|
+
_pcb_drawing_object_id: getNewPcbDrawingObjectId("pcb_note_dimension"),
|
|
7952
|
+
pcb_drawing_type: "line",
|
|
7953
|
+
x1: to.x,
|
|
7954
|
+
y1: to.y,
|
|
7955
|
+
x2: arrow2X1,
|
|
7956
|
+
y2: arrow2Y1,
|
|
7957
|
+
width: 0.05,
|
|
7958
|
+
squareCap: false,
|
|
7959
|
+
layer: "notes",
|
|
7960
|
+
_element: element
|
|
7961
|
+
});
|
|
7962
|
+
primitives.push({
|
|
7963
|
+
_pcb_drawing_object_id: getNewPcbDrawingObjectId("pcb_note_dimension"),
|
|
7964
|
+
pcb_drawing_type: "line",
|
|
7965
|
+
x1: to.x,
|
|
7966
|
+
y1: to.y,
|
|
7967
|
+
x2: arrow2X2,
|
|
7968
|
+
y2: arrow2Y2,
|
|
7969
|
+
width: 0.05,
|
|
7970
|
+
squareCap: false,
|
|
7971
|
+
layer: "notes",
|
|
7972
|
+
_element: element
|
|
7973
|
+
});
|
|
7974
|
+
if (text) {
|
|
7975
|
+
primitives.push({
|
|
7976
|
+
_pcb_drawing_object_id: getNewPcbDrawingObjectId("pcb_note_dimension"),
|
|
7977
|
+
pcb_drawing_type: "text",
|
|
7978
|
+
x: (from.x + to.x) / 2,
|
|
7979
|
+
y: (from.y + to.y) / 2,
|
|
7980
|
+
layer: "notes",
|
|
7981
|
+
align: "center",
|
|
7982
|
+
text,
|
|
7983
|
+
size: font_size,
|
|
7984
|
+
_element: element
|
|
7985
|
+
});
|
|
7986
|
+
}
|
|
7987
|
+
return primitives;
|
|
7988
|
+
}
|
|
7815
7989
|
}
|
|
7816
7990
|
return [];
|
|
7817
7991
|
};
|
|
@@ -8110,6 +8284,7 @@ var LAYER_NAME_TO_COLOR = {
|
|
|
8110
8284
|
bottom_silkscreen: colors_default.board.b_silks,
|
|
8111
8285
|
top_fabrication: colors_default.board.f_fab,
|
|
8112
8286
|
bottom_fabrication: colors_default.board.b_fab,
|
|
8287
|
+
notes: colors_default.board.user_2,
|
|
8113
8288
|
...colors_default.board
|
|
8114
8289
|
};
|
|
8115
8290
|
var DEFAULT_DRAW_ORDER = [
|
|
@@ -8931,6 +9106,7 @@ var orderedLayers = [
|
|
|
8931
9106
|
"inner5",
|
|
8932
9107
|
"inner6",
|
|
8933
9108
|
"drill",
|
|
9109
|
+
"notes",
|
|
8934
9110
|
"other"
|
|
8935
9111
|
];
|
|
8936
9112
|
var CanvasPrimitiveRenderer = ({
|
|
@@ -11557,7 +11733,7 @@ import { css as css3 } from "@emotion/css";
|
|
|
11557
11733
|
// package.json
|
|
11558
11734
|
var package_default = {
|
|
11559
11735
|
name: "@tscircuit/pcb-viewer",
|
|
11560
|
-
version: "1.11.
|
|
11736
|
+
version: "1.11.228",
|
|
11561
11737
|
main: "dist/index.js",
|
|
11562
11738
|
type: "module",
|
|
11563
11739
|
repository: "tscircuit/pcb-viewer",
|
|
@@ -11594,7 +11770,7 @@ var package_default = {
|
|
|
11594
11770
|
"react-cosmos-plugin-vite": "7.0.0-beta.0",
|
|
11595
11771
|
"react-dom": "19.1.0",
|
|
11596
11772
|
"react-use": "^17.4.0",
|
|
11597
|
-
tscircuit: "^0.0.
|
|
11773
|
+
tscircuit: "^0.0.758",
|
|
11598
11774
|
tsup: "^8.0.2",
|
|
11599
11775
|
"type-fest": "^3.0.0",
|
|
11600
11776
|
typescript: "^5.4.4",
|
|
@@ -11608,7 +11784,7 @@ var package_default = {
|
|
|
11608
11784
|
dependencies: {
|
|
11609
11785
|
"@emotion/css": "^11.11.2",
|
|
11610
11786
|
"@vitejs/plugin-react": "^5.0.2",
|
|
11611
|
-
"circuit-json": "^0.0.
|
|
11787
|
+
"circuit-json": "^0.0.279",
|
|
11612
11788
|
"circuit-to-svg": "^0.0.191",
|
|
11613
11789
|
color: "^4.2.3",
|
|
11614
11790
|
"react-supergrid": "^1.0.10",
|