circuit-json 0.0.531 → 0.0.533
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/README.md +495 -289
- package/dist/index.d.mts +1146 -3
- package/dist/index.mjs +179 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -2
package/dist/index.mjs
CHANGED
|
@@ -5787,8 +5787,177 @@ var simulation_pcb_return_current_marker = z238.discriminatedUnion("target_type"
|
|
|
5787
5787
|
expectTypesMatch(true);
|
|
5788
5788
|
|
|
5789
5789
|
// src/any_circuit_element.ts
|
|
5790
|
+
import { z as z244 } from "zod";
|
|
5791
|
+
|
|
5792
|
+
// src/drawing/drawing_page.ts
|
|
5793
|
+
import { z as z240 } from "zod";
|
|
5794
|
+
|
|
5795
|
+
// src/drawing/drawing_page_size.ts
|
|
5790
5796
|
import { z as z239 } from "zod";
|
|
5791
|
-
var
|
|
5797
|
+
var drawingPageSizes = {
|
|
5798
|
+
iso_a0: [1189, 841],
|
|
5799
|
+
iso_a1: [841, 594],
|
|
5800
|
+
iso_a2: [594, 420],
|
|
5801
|
+
iso_a3: [420, 297],
|
|
5802
|
+
iso_a4: [297, 210],
|
|
5803
|
+
ansi_a: [279.4, 215.9],
|
|
5804
|
+
ansi_b: [431.8, 279.4],
|
|
5805
|
+
ansi_c: [558.8, 431.8],
|
|
5806
|
+
ansi_d: [863.6, 558.8],
|
|
5807
|
+
ansi_e: [1117.6, 863.6]
|
|
5808
|
+
};
|
|
5809
|
+
var drawing_page_size = z239.enum([
|
|
5810
|
+
"iso_a0",
|
|
5811
|
+
"iso_a1",
|
|
5812
|
+
"iso_a2",
|
|
5813
|
+
"iso_a3",
|
|
5814
|
+
"iso_a4",
|
|
5815
|
+
"ansi_a",
|
|
5816
|
+
"ansi_b",
|
|
5817
|
+
"ansi_c",
|
|
5818
|
+
"ansi_d",
|
|
5819
|
+
"ansi_e"
|
|
5820
|
+
]);
|
|
5821
|
+
function getDrawingPageDimensions(size2, orientation = "landscape") {
|
|
5822
|
+
const [width, height] = drawingPageSizes[size2];
|
|
5823
|
+
return orientation === "portrait" ? { width: height, height: width } : { width, height };
|
|
5824
|
+
}
|
|
5825
|
+
|
|
5826
|
+
// src/drawing/drawing_page.ts
|
|
5827
|
+
var drawing_page = z240.object({
|
|
5828
|
+
type: z240.literal("drawing_page"),
|
|
5829
|
+
drawing_page_id: z240.string().min(1),
|
|
5830
|
+
name: z240.string().optional(),
|
|
5831
|
+
display_name: z240.string().optional(),
|
|
5832
|
+
page_size: drawing_page_size.optional(),
|
|
5833
|
+
orientation: z240.enum(["landscape", "portrait"]).optional(),
|
|
5834
|
+
width: z240.number().finite().positive(),
|
|
5835
|
+
height: z240.number().finite().positive()
|
|
5836
|
+
}).superRefine((page, ctx) => {
|
|
5837
|
+
if (!page.page_size) {
|
|
5838
|
+
if (page.orientation)
|
|
5839
|
+
ctx.addIssue({
|
|
5840
|
+
code: "custom",
|
|
5841
|
+
path: ["orientation"],
|
|
5842
|
+
message: "Orientation requires page_size; custom pages use explicit dimensions"
|
|
5843
|
+
});
|
|
5844
|
+
return;
|
|
5845
|
+
}
|
|
5846
|
+
const expected = getDrawingPageDimensions(page.page_size, page.orientation);
|
|
5847
|
+
if (Math.abs(page.width - expected.width) > 1e-6 || Math.abs(page.height - expected.height) > 1e-6)
|
|
5848
|
+
ctx.addIssue({
|
|
5849
|
+
code: "custom",
|
|
5850
|
+
path: ["page_size"],
|
|
5851
|
+
message: "Dimensions must match the named sheet size and orientation"
|
|
5852
|
+
});
|
|
5853
|
+
}).describe(
|
|
5854
|
+
"A paper-space drawing page containing configured part views. Dimensions are mm."
|
|
5855
|
+
);
|
|
5856
|
+
expectTypesMatch(true);
|
|
5857
|
+
|
|
5858
|
+
// src/drawing/drawing_part_view.ts
|
|
5859
|
+
import { z as z241 } from "zod";
|
|
5860
|
+
var drawing_part_view_direction = z241.enum([
|
|
5861
|
+
"x_positive",
|
|
5862
|
+
"x_negative",
|
|
5863
|
+
"y_positive",
|
|
5864
|
+
"y_negative",
|
|
5865
|
+
"z_positive",
|
|
5866
|
+
"z_negative",
|
|
5867
|
+
"isometric"
|
|
5868
|
+
]);
|
|
5869
|
+
var drawing_section_plane = z241.object({
|
|
5870
|
+
axis: z241.enum(["x", "y", "z"]),
|
|
5871
|
+
offset: z241.number().finite(),
|
|
5872
|
+
keep_side: z241.enum(["less", "greater"]),
|
|
5873
|
+
hatch_spacing: z241.number().finite().positive().optional()
|
|
5874
|
+
});
|
|
5875
|
+
var drawing_part_view = z241.object({
|
|
5876
|
+
type: z241.literal("drawing_part_view"),
|
|
5877
|
+
drawing_part_view_id: z241.string().min(1),
|
|
5878
|
+
drawing_page_id: z241.string().min(1),
|
|
5879
|
+
source_group_id: z241.string().min(1).optional(),
|
|
5880
|
+
source_component_ids: z241.array(z241.string().min(1)).optional(),
|
|
5881
|
+
name: z241.string().optional(),
|
|
5882
|
+
display_name: z241.string().optional(),
|
|
5883
|
+
direction: drawing_part_view_direction,
|
|
5884
|
+
center: z241.object({ x: z241.number().finite(), y: z241.number().finite() }),
|
|
5885
|
+
width: z241.number().finite().positive(),
|
|
5886
|
+
height: z241.number().finite().positive(),
|
|
5887
|
+
scale: z241.number().finite().positive().optional(),
|
|
5888
|
+
show_hidden_edges: z241.boolean().optional(),
|
|
5889
|
+
section: drawing_section_plane.optional()
|
|
5890
|
+
}).describe(
|
|
5891
|
+
"A configured orthographic view of selected assembly geometry. Paper coordinates are mm, origin at sheet center, +X right/+Y up. Directions and section planes use CAD world coordinates in mm with +Z up."
|
|
5892
|
+
);
|
|
5893
|
+
expectTypesMatch(
|
|
5894
|
+
true
|
|
5895
|
+
);
|
|
5896
|
+
expectTypesMatch(true);
|
|
5897
|
+
|
|
5898
|
+
// src/drawing/drawing_page_title_block.ts
|
|
5899
|
+
import { z as z242 } from "zod";
|
|
5900
|
+
var drawing_page_title_block = z242.object({
|
|
5901
|
+
type: z242.literal("drawing_page_title_block"),
|
|
5902
|
+
drawing_page_title_block_id: z242.string().min(1),
|
|
5903
|
+
drawing_page_id: z242.string().min(1),
|
|
5904
|
+
title: z242.string().min(1),
|
|
5905
|
+
legal_owner: z242.string().optional(),
|
|
5906
|
+
identification_number: z242.string().optional(),
|
|
5907
|
+
revision_index: z242.string().optional(),
|
|
5908
|
+
date_of_issue: z242.string().optional(),
|
|
5909
|
+
creator: z242.string().optional(),
|
|
5910
|
+
approval_person: z242.string().optional(),
|
|
5911
|
+
sheet_number: z242.number().int().positive().optional(),
|
|
5912
|
+
number_of_sheets: z242.number().int().positive().optional()
|
|
5913
|
+
}).refine(
|
|
5914
|
+
(block) => block.sheet_number == null || block.number_of_sheets == null || block.sheet_number <= block.number_of_sheets,
|
|
5915
|
+
{
|
|
5916
|
+
message: "sheet_number must not exceed number_of_sheets",
|
|
5917
|
+
path: ["sheet_number"]
|
|
5918
|
+
}
|
|
5919
|
+
);
|
|
5920
|
+
expectTypesMatch(true);
|
|
5921
|
+
|
|
5922
|
+
// src/drawing/drawing_dimension_line.ts
|
|
5923
|
+
import { z as z243 } from "zod";
|
|
5924
|
+
var paper_point = z243.object({
|
|
5925
|
+
x: z243.number().finite(),
|
|
5926
|
+
y: z243.number().finite()
|
|
5927
|
+
});
|
|
5928
|
+
var drawing_dimension_line = z243.object({
|
|
5929
|
+
type: z243.literal("drawing_dimension_line"),
|
|
5930
|
+
drawing_dimension_line_id: z243.string().trim().min(1),
|
|
5931
|
+
drawing_part_view_id: z243.string().trim().min(1),
|
|
5932
|
+
start: paper_point,
|
|
5933
|
+
end: paper_point,
|
|
5934
|
+
text: z243.string().refine(
|
|
5935
|
+
(text) => text.trim().length > 0,
|
|
5936
|
+
"Dimension text must not be blank"
|
|
5937
|
+
),
|
|
5938
|
+
edge_ref_start: paper_point.optional(),
|
|
5939
|
+
edge_ref_end: paper_point.optional(),
|
|
5940
|
+
edge_ref_name: z243.string().refine(
|
|
5941
|
+
(name) => name.trim().length > 0,
|
|
5942
|
+
"Edge reference name must not be blank"
|
|
5943
|
+
).optional(),
|
|
5944
|
+
name: z243.string().trim().min(1).optional()
|
|
5945
|
+
}).refine(
|
|
5946
|
+
(line) => line.start.x !== line.end.x || line.start.y !== line.end.y,
|
|
5947
|
+
{ message: "Dimension line endpoints must be distinct", path: ["end"] }
|
|
5948
|
+
).describe(
|
|
5949
|
+
"A resolved dimension annotation associated with a drawing part view. start/end and optional edge_ref_start/edge_ref_end use page-centered paper mm, +X right/+Y up. Core resolves model measurement and formats the required text before emitting this record; renderers draw the supplied line, text and optional witness attachments without resolving native geometry or deriving values from paper length. Each witness attachment is independently optional. edge_ref_name is optional exact nonblank model-feature metadata, never a geometry definition or a rendering dependency."
|
|
5950
|
+
);
|
|
5951
|
+
expectTypesMatch(
|
|
5952
|
+
true
|
|
5953
|
+
);
|
|
5954
|
+
|
|
5955
|
+
// src/any_circuit_element.ts
|
|
5956
|
+
var any_circuit_element = z244.union([
|
|
5957
|
+
drawing_page,
|
|
5958
|
+
drawing_page_title_block,
|
|
5959
|
+
drawing_part_view,
|
|
5960
|
+
drawing_dimension_line,
|
|
5792
5961
|
source_runtime_error,
|
|
5793
5962
|
source_datasheet,
|
|
5794
5963
|
source_trace,
|
|
@@ -6005,10 +6174,19 @@ export {
|
|
|
6005
6174
|
circuit_json_footprint_load_error,
|
|
6006
6175
|
current,
|
|
6007
6176
|
distance,
|
|
6177
|
+
drawingPageSizes,
|
|
6178
|
+
drawing_dimension_line,
|
|
6179
|
+
drawing_page,
|
|
6180
|
+
drawing_page_size,
|
|
6181
|
+
drawing_page_title_block,
|
|
6182
|
+
drawing_part_view,
|
|
6183
|
+
drawing_part_view_direction,
|
|
6184
|
+
drawing_section_plane,
|
|
6008
6185
|
duration_ms,
|
|
6009
6186
|
experiment_type,
|
|
6010
6187
|
external_footprint_load_error,
|
|
6011
6188
|
frequency,
|
|
6189
|
+
getDrawingPageDimensions,
|
|
6012
6190
|
getRotationBetweenPcbPin1Locations,
|
|
6013
6191
|
getSimulationReturnCurrentGridJsonSchema,
|
|
6014
6192
|
getZodPrefixedIdWithDefault,
|