@tscircuit/3d-viewer 0.0.446 → 0.0.448
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 +93 -28
- package/package.json +8 -6
package/dist/index.js
CHANGED
|
@@ -15474,7 +15474,8 @@ var source_port = z37.object({
|
|
|
15474
15474
|
source_component_id: z37.string().optional(),
|
|
15475
15475
|
source_group_id: z37.string().optional(),
|
|
15476
15476
|
subcircuit_id: z37.string().optional(),
|
|
15477
|
-
subcircuit_connectivity_map_key: z37.string().optional()
|
|
15477
|
+
subcircuit_connectivity_map_key: z37.string().optional(),
|
|
15478
|
+
must_be_connected: z37.boolean().optional()
|
|
15478
15479
|
});
|
|
15479
15480
|
expectTypesMatch(true);
|
|
15480
15481
|
var source_trace = z38.object({
|
|
@@ -16115,8 +16116,7 @@ var pcb_plated_hole_circle = z73.object({
|
|
|
16115
16116
|
pcb_component_id: z73.string().optional(),
|
|
16116
16117
|
pcb_port_id: z73.string().optional(),
|
|
16117
16118
|
pcb_plated_hole_id: getZodPrefixedIdWithDefault("pcb_plated_hole"),
|
|
16118
|
-
soldermask_margin: z73.number().optional()
|
|
16119
|
-
is_covered_with_solder_mask: z73.boolean().optional()
|
|
16119
|
+
soldermask_margin: z73.number().optional()
|
|
16120
16120
|
});
|
|
16121
16121
|
var pcb_plated_hole_oval = z73.object({
|
|
16122
16122
|
type: z73.literal("pcb_plated_hole"),
|
|
@@ -16601,7 +16601,8 @@ var pcb_via = z84.object({
|
|
|
16601
16601
|
layers: z84.array(layer_ref),
|
|
16602
16602
|
pcb_trace_id: z84.string().optional(),
|
|
16603
16603
|
net_is_assignable: z84.boolean().optional(),
|
|
16604
|
-
net_assigned: z84.boolean().optional()
|
|
16604
|
+
net_assigned: z84.boolean().optional(),
|
|
16605
|
+
is_tented: z84.boolean().optional()
|
|
16605
16606
|
}).describe("Defines a via on the PCB");
|
|
16606
16607
|
expectTypesMatch(true);
|
|
16607
16608
|
var pcb_board = z85.object({
|
|
@@ -17304,7 +17305,8 @@ var cad_component = z125.object({
|
|
|
17304
17305
|
model_step_url: z125.string().optional(),
|
|
17305
17306
|
model_wrl_url: z125.string().optional(),
|
|
17306
17307
|
model_unit_to_mm_scale_factor: z125.number().optional(),
|
|
17307
|
-
model_jscad: z125.any().optional()
|
|
17308
|
+
model_jscad: z125.any().optional(),
|
|
17309
|
+
show_as_translucent_model: z125.boolean().optional()
|
|
17308
17310
|
}).describe("Defines a component on the PCB");
|
|
17309
17311
|
expectTypesMatch(true);
|
|
17310
17312
|
var wave_shape = z126.enum(["sinewave", "square", "triangle", "sawtooth"]);
|
|
@@ -17404,18 +17406,48 @@ var simulation_voltage_probe = z130.object({
|
|
|
17404
17406
|
),
|
|
17405
17407
|
source_component_id: z130.string().optional(),
|
|
17406
17408
|
name: z130.string().optional(),
|
|
17407
|
-
|
|
17408
|
-
|
|
17409
|
+
signal_input_source_port_id: z130.string().optional(),
|
|
17410
|
+
signal_input_source_net_id: z130.string().optional(),
|
|
17411
|
+
reference_input_source_port_id: z130.string().optional(),
|
|
17412
|
+
reference_input_source_net_id: z130.string().optional(),
|
|
17409
17413
|
subcircuit_id: z130.string().optional(),
|
|
17410
17414
|
color: z130.string().optional()
|
|
17411
17415
|
}).describe(
|
|
17412
|
-
"Defines a voltage probe for simulation,
|
|
17413
|
-
).
|
|
17414
|
-
|
|
17415
|
-
{
|
|
17416
|
-
|
|
17416
|
+
"Defines a voltage probe for simulation. If a reference input is not provided, it measures against ground. If a reference input is provided, it measures the differential voltage between two points."
|
|
17417
|
+
).superRefine((data, ctx) => {
|
|
17418
|
+
const is_differential = data.reference_input_source_port_id || data.reference_input_source_net_id;
|
|
17419
|
+
if (is_differential) {
|
|
17420
|
+
const has_ports = !!data.signal_input_source_port_id || !!data.reference_input_source_port_id;
|
|
17421
|
+
const has_nets = !!data.signal_input_source_net_id || !!data.reference_input_source_net_id;
|
|
17422
|
+
if (has_ports && has_nets) {
|
|
17423
|
+
ctx.addIssue({
|
|
17424
|
+
code: z130.ZodIssueCode.custom,
|
|
17425
|
+
message: "Cannot mix port and net connections in a differential probe."
|
|
17426
|
+
});
|
|
17427
|
+
} else if (has_ports) {
|
|
17428
|
+
if (!data.signal_input_source_port_id || !data.reference_input_source_port_id) {
|
|
17429
|
+
ctx.addIssue({
|
|
17430
|
+
code: z130.ZodIssueCode.custom,
|
|
17431
|
+
message: "Differential port probe requires both signal_input_source_port_id and reference_input_source_port_id."
|
|
17432
|
+
});
|
|
17433
|
+
}
|
|
17434
|
+
} else if (has_nets) {
|
|
17435
|
+
if (!data.signal_input_source_net_id || !data.reference_input_source_net_id) {
|
|
17436
|
+
ctx.addIssue({
|
|
17437
|
+
code: z130.ZodIssueCode.custom,
|
|
17438
|
+
message: "Differential net probe requires both signal_input_source_net_id and reference_input_source_net_id."
|
|
17439
|
+
});
|
|
17440
|
+
}
|
|
17441
|
+
}
|
|
17442
|
+
} else {
|
|
17443
|
+
if (!!data.signal_input_source_port_id === !!data.signal_input_source_net_id) {
|
|
17444
|
+
ctx.addIssue({
|
|
17445
|
+
code: z130.ZodIssueCode.custom,
|
|
17446
|
+
message: "A voltage probe must have exactly one of signal_input_source_port_id or signal_input_source_net_id."
|
|
17447
|
+
});
|
|
17448
|
+
}
|
|
17417
17449
|
}
|
|
17418
|
-
);
|
|
17450
|
+
});
|
|
17419
17451
|
expectTypesMatch(true);
|
|
17420
17452
|
var simulation_unknown_experiment_error = z131.object({
|
|
17421
17453
|
type: z131.literal("simulation_unknown_experiment_error"),
|
|
@@ -28238,7 +28270,7 @@ var defaultVisibility = {
|
|
|
28238
28270
|
bottomMask: true,
|
|
28239
28271
|
throughHoleModels: true,
|
|
28240
28272
|
smtModels: true,
|
|
28241
|
-
|
|
28273
|
+
translucentModels: true,
|
|
28242
28274
|
modelsNotInPosFile: false,
|
|
28243
28275
|
modelsMarkedDNP: false,
|
|
28244
28276
|
modelBoundingBoxes: false,
|
|
@@ -28389,11 +28421,17 @@ var AnyCadComponent = ({
|
|
|
28389
28421
|
}
|
|
28390
28422
|
);
|
|
28391
28423
|
}
|
|
28392
|
-
if (
|
|
28393
|
-
|
|
28394
|
-
|
|
28395
|
-
|
|
28396
|
-
|
|
28424
|
+
if (cad_component2.show_as_translucent_model) {
|
|
28425
|
+
if (!visibility.translucentModels) {
|
|
28426
|
+
return null;
|
|
28427
|
+
}
|
|
28428
|
+
} else {
|
|
28429
|
+
if (isThroughHole && !visibility.throughHoleModels) {
|
|
28430
|
+
return null;
|
|
28431
|
+
}
|
|
28432
|
+
if (!isThroughHole && !visibility.smtModels) {
|
|
28433
|
+
return null;
|
|
28434
|
+
}
|
|
28397
28435
|
}
|
|
28398
28436
|
return /* @__PURE__ */ jsxs2(Fragment3, { children: [
|
|
28399
28437
|
modelComponent,
|
|
@@ -28426,7 +28464,7 @@ import * as THREE15 from "three";
|
|
|
28426
28464
|
// package.json
|
|
28427
28465
|
var package_default = {
|
|
28428
28466
|
name: "@tscircuit/3d-viewer",
|
|
28429
|
-
version: "0.0.
|
|
28467
|
+
version: "0.0.447",
|
|
28430
28468
|
main: "./dist/index.js",
|
|
28431
28469
|
module: "./dist/index.js",
|
|
28432
28470
|
type: "module",
|
|
@@ -28474,10 +28512,12 @@ var package_default = {
|
|
|
28474
28512
|
"@storybook/blocks": "9.0.0-alpha.17",
|
|
28475
28513
|
"@storybook/react-vite": "^9.1.5",
|
|
28476
28514
|
"@tscircuit/circuit-json-util": "^0.0.72",
|
|
28477
|
-
"@tscircuit/core": "^0.0.
|
|
28478
|
-
"@tscircuit/props": "^0.0.
|
|
28479
|
-
"@tscircuit/checks": "^0.0.
|
|
28480
|
-
"@tscircuit/math-utils": "^0.0.
|
|
28515
|
+
"@tscircuit/core": "^0.0.890",
|
|
28516
|
+
"@tscircuit/props": "^0.0.422",
|
|
28517
|
+
"@tscircuit/checks": "^0.0.87",
|
|
28518
|
+
"@tscircuit/math-utils": "^0.0.29",
|
|
28519
|
+
"@tscircuit/copper-pour-solver": "^0.0.14",
|
|
28520
|
+
"@tscircuit/solver-utils": "^0.0.4",
|
|
28481
28521
|
"@tscircuit/capacity-autorouter": "^0.0.131",
|
|
28482
28522
|
"calculate-packing": "^0.0.48",
|
|
28483
28523
|
"@types/jsdom": "^21.1.7",
|
|
@@ -28488,7 +28528,7 @@ var package_default = {
|
|
|
28488
28528
|
"@vitejs/plugin-react": "^4.3.4",
|
|
28489
28529
|
"bun-match-svg": "^0.0.9",
|
|
28490
28530
|
"bun-types": "1.2.1",
|
|
28491
|
-
"circuit-json": "0.0.
|
|
28531
|
+
"circuit-json": "0.0.325",
|
|
28492
28532
|
"circuit-to-svg": "^0.0.179",
|
|
28493
28533
|
debug: "^4.4.0",
|
|
28494
28534
|
"jscad-electronics": "^0.0.91",
|
|
@@ -28607,8 +28647,12 @@ var CameraControllerProvider = ({ children, defaultTarget, initialCameraPosition
|
|
|
28607
28647
|
defaultTarget.y,
|
|
28608
28648
|
defaultTarget.z
|
|
28609
28649
|
];
|
|
28610
|
-
const
|
|
28611
|
-
const
|
|
28650
|
+
const camera = mainCameraRef.current;
|
|
28651
|
+
const controls = controlsRef.current;
|
|
28652
|
+
let distance2 = baseDistance;
|
|
28653
|
+
if (camera && controls) {
|
|
28654
|
+
distance2 = camera.position.distanceTo(controls.target);
|
|
28655
|
+
}
|
|
28612
28656
|
switch (preset) {
|
|
28613
28657
|
case "Top Center Angled": {
|
|
28614
28658
|
const angledOffset = distance2 / Math.sqrt(2);
|
|
@@ -28687,7 +28731,7 @@ var CameraControllerProvider = ({ children, defaultTarget, initialCameraPosition
|
|
|
28687
28731
|
return null;
|
|
28688
28732
|
}
|
|
28689
28733
|
},
|
|
28690
|
-
[baseDistance, defaultTarget]
|
|
28734
|
+
[baseDistance, defaultTarget, mainCameraRef, controlsRef]
|
|
28691
28735
|
);
|
|
28692
28736
|
const handleControlsChange = useCallback4(
|
|
28693
28737
|
(controls) => {
|
|
@@ -39142,6 +39186,12 @@ function RemoveScrollSideCar(props) {
|
|
|
39142
39186
|
if ("touches" in event && moveDirection === "h" && target.type === "range") {
|
|
39143
39187
|
return false;
|
|
39144
39188
|
}
|
|
39189
|
+
var selection = window.getSelection();
|
|
39190
|
+
var anchorNode = selection && selection.anchorNode;
|
|
39191
|
+
var isTouchingSelection = anchorNode ? anchorNode === target || anchorNode.contains(target) : false;
|
|
39192
|
+
if (isTouchingSelection) {
|
|
39193
|
+
return false;
|
|
39194
|
+
}
|
|
39145
39195
|
var canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target);
|
|
39146
39196
|
if (!canBeScrolledInMainDirection) {
|
|
39147
39197
|
return true;
|
|
@@ -41275,6 +41325,21 @@ var CadViewerInner = (props) => {
|
|
|
41275
41325
|
description: "Toggle through-hole components"
|
|
41276
41326
|
}
|
|
41277
41327
|
);
|
|
41328
|
+
useRegisteredHotkey(
|
|
41329
|
+
"toggle_translucent_models",
|
|
41330
|
+
() => {
|
|
41331
|
+
const newVisibility = !visibility.translucentModels;
|
|
41332
|
+
setLayerVisibility("translucentModels", newVisibility);
|
|
41333
|
+
showToast(
|
|
41334
|
+
newVisibility ? "Translucent components visible" : "Translucent components hidden",
|
|
41335
|
+
1500
|
|
41336
|
+
);
|
|
41337
|
+
},
|
|
41338
|
+
{
|
|
41339
|
+
shortcut: "shift+v",
|
|
41340
|
+
description: "Toggle translucent components"
|
|
41341
|
+
}
|
|
41342
|
+
);
|
|
41278
41343
|
useEffect42(() => {
|
|
41279
41344
|
if (containerRef.current) {
|
|
41280
41345
|
registerHotkeyViewer(containerRef.current);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tscircuit/3d-viewer",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.448",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"module": "./dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -48,10 +48,12 @@
|
|
|
48
48
|
"@storybook/blocks": "9.0.0-alpha.17",
|
|
49
49
|
"@storybook/react-vite": "^9.1.5",
|
|
50
50
|
"@tscircuit/circuit-json-util": "^0.0.72",
|
|
51
|
-
"@tscircuit/core": "^0.0.
|
|
52
|
-
"@tscircuit/props": "^0.0.
|
|
53
|
-
"@tscircuit/checks": "^0.0.
|
|
54
|
-
"@tscircuit/math-utils": "^0.0.
|
|
51
|
+
"@tscircuit/core": "^0.0.890",
|
|
52
|
+
"@tscircuit/props": "^0.0.422",
|
|
53
|
+
"@tscircuit/checks": "^0.0.87",
|
|
54
|
+
"@tscircuit/math-utils": "^0.0.29",
|
|
55
|
+
"@tscircuit/copper-pour-solver": "^0.0.14",
|
|
56
|
+
"@tscircuit/solver-utils": "^0.0.4",
|
|
55
57
|
"@tscircuit/capacity-autorouter": "^0.0.131",
|
|
56
58
|
"calculate-packing": "^0.0.48",
|
|
57
59
|
"@types/jsdom": "^21.1.7",
|
|
@@ -62,7 +64,7 @@
|
|
|
62
64
|
"@vitejs/plugin-react": "^4.3.4",
|
|
63
65
|
"bun-match-svg": "^0.0.9",
|
|
64
66
|
"bun-types": "1.2.1",
|
|
65
|
-
"circuit-json": "0.0.
|
|
67
|
+
"circuit-json": "0.0.325",
|
|
66
68
|
"circuit-to-svg": "^0.0.179",
|
|
67
69
|
"debug": "^4.4.0",
|
|
68
70
|
"jscad-electronics": "^0.0.91",
|