@tscircuit/internal-dynamic-import 0.0.9 → 0.0.11

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.
Files changed (2) hide show
  1. package/dist/index.d.ts +34 -11
  2. package/package.json +3 -3
package/dist/index.d.ts CHANGED
@@ -26,9 +26,9 @@ declare const CAMERA_PRESETS: {
26
26
  readonly front: (cam: CameraOptions) => CameraOptions;
27
27
  readonly "top-center-angled": (cam: CameraOptions) => CameraOptions;
28
28
  };
29
- type CameraPreset = keyof typeof CAMERA_PRESETS;
30
- declare const CAMERA_PRESET_NAMES: CameraPreset[];
31
- declare function applyCameraPreset(preset: CameraPreset, cam: CameraOptions): CameraOptions;
29
+ type CameraPreset$1 = keyof typeof CAMERA_PRESETS;
30
+ declare const CAMERA_PRESET_NAMES: CameraPreset$1[];
31
+ declare function applyCameraPreset(preset: CameraPreset$1, cam: CameraOptions): CameraOptions;
32
32
 
33
33
  type ConvertCircuitJsonTo3dGltfResult = Awaited<ReturnType<typeof circuit_json_to_gltf["convertCircuitJsonToGltf"]>>;
34
34
  type CircuitJson3dBaseOptions = {
@@ -41,7 +41,7 @@ type CircuitJson3dBaseOptions = {
41
41
  };
42
42
  type RenderCircuitJsonTo3dPngOptions = CircuitJson3dBaseOptions & {
43
43
  camera?: CameraOptions;
44
- cameraPreset?: CameraPreset;
44
+ cameraPreset?: CameraPreset$1;
45
45
  width?: number;
46
46
  height?: number;
47
47
  backgroundColor?: string | readonly [number, number, number] | null;
@@ -55,7 +55,6 @@ declare const renderCircuitJsonTo3dPng: (circuitJson: AnyCircuitElement[], optio
55
55
 
56
56
  declare const CircuitJsonTo3dPngModule_CAMERA_PRESET_NAMES: typeof CAMERA_PRESET_NAMES;
57
57
  type CircuitJsonTo3dPngModule_CameraOptions = CameraOptions;
58
- type CircuitJsonTo3dPngModule_CameraPreset = CameraPreset;
59
58
  type CircuitJsonTo3dPngModule_CircuitJson3dBaseOptions = CircuitJson3dBaseOptions;
60
59
  type CircuitJsonTo3dPngModule_ConvertCircuitJsonTo3dGltfResult = ConvertCircuitJsonTo3dGltfResult;
61
60
  type CircuitJsonTo3dPngModule_RenderCircuitJsonTo3dPngOptions = RenderCircuitJsonTo3dPngOptions;
@@ -65,7 +64,7 @@ declare const CircuitJsonTo3dPngModule_convertCircuitJsonTo3dGltf: typeof conver
65
64
  declare const CircuitJsonTo3dPngModule_getDefaultCameraForCircuitJson: typeof getDefaultCameraForCircuitJson;
66
65
  declare const CircuitJsonTo3dPngModule_renderCircuitJsonTo3dPng: typeof renderCircuitJsonTo3dPng;
67
66
  declare namespace CircuitJsonTo3dPngModule {
68
- export { CircuitJsonTo3dPngModule_CAMERA_PRESET_NAMES as CAMERA_PRESET_NAMES, type CircuitJsonTo3dPngModule_CameraOptions as CameraOptions, type CircuitJsonTo3dPngModule_CameraPreset as CameraPreset, type CircuitJsonTo3dPngModule_CircuitJson3dBaseOptions as CircuitJson3dBaseOptions, type CircuitJsonTo3dPngModule_ConvertCircuitJsonTo3dGltfResult as ConvertCircuitJsonTo3dGltfResult, type CircuitJsonTo3dPngModule_RenderCircuitJsonTo3dPngOptions as RenderCircuitJsonTo3dPngOptions, CircuitJsonTo3dPngModule_applyCameraPreset as applyCameraPreset, CircuitJsonTo3dPngModule_convertCircuitJsonTo3dGlb as convertCircuitJsonTo3dGlb, CircuitJsonTo3dPngModule_convertCircuitJsonTo3dGltf as convertCircuitJsonTo3dGltf, CircuitJsonTo3dPngModule_getDefaultCameraForCircuitJson as getDefaultCameraForCircuitJson, CircuitJsonTo3dPngModule_renderCircuitJsonTo3dPng as renderCircuitJsonTo3dPng };
67
+ export { CircuitJsonTo3dPngModule_CAMERA_PRESET_NAMES as CAMERA_PRESET_NAMES, type CircuitJsonTo3dPngModule_CameraOptions as CameraOptions, type CameraPreset$1 as CameraPreset, type CircuitJsonTo3dPngModule_CircuitJson3dBaseOptions as CircuitJson3dBaseOptions, type CircuitJsonTo3dPngModule_ConvertCircuitJsonTo3dGltfResult as ConvertCircuitJsonTo3dGltfResult, type CircuitJsonTo3dPngModule_RenderCircuitJsonTo3dPngOptions as RenderCircuitJsonTo3dPngOptions, CircuitJsonTo3dPngModule_applyCameraPreset as applyCameraPreset, CircuitJsonTo3dPngModule_convertCircuitJsonTo3dGlb as convertCircuitJsonTo3dGlb, CircuitJsonTo3dPngModule_convertCircuitJsonTo3dGltf as convertCircuitJsonTo3dGltf, CircuitJsonTo3dPngModule_getDefaultCameraForCircuitJson as getDefaultCameraForCircuitJson, CircuitJsonTo3dPngModule_renderCircuitJsonTo3dPng as renderCircuitJsonTo3dPng };
69
68
  }
70
69
 
71
70
  type SupplierPartNumberColumn = "JLCPCB Part #";
@@ -1030,7 +1029,32 @@ declare function loadSTL({ url, transform, projectBaseUrl, authHeaders, }: {
1030
1029
  }): Promise<STLMesh>;
1031
1030
  declare function clearSTLCache(): void;
1032
1031
 
1032
+ declare const CAMERA_PRESET_DIRECTIONS: {
1033
+ readonly isometric: readonly [-0.7, 1.2, -0.8];
1034
+ readonly top_down: readonly [0, 1, 0.001];
1035
+ readonly bottom_up: readonly [0, -1, 0.001];
1036
+ readonly left_side: readonly [-1, 0, 0];
1037
+ readonly right_side: readonly [1, 0, 0];
1038
+ readonly front: readonly [0, 0, 1];
1039
+ readonly back: readonly [0, 0, -1];
1040
+ };
1041
+ type CameraPreset = keyof typeof CAMERA_PRESET_DIRECTIONS;
1033
1042
  interface CameraFitOptions {
1043
+ /**
1044
+ * Named preset view. Useful for stable top/bottom/side snapshots.
1045
+ *
1046
+ * `top_down`/`bottom_up` use a tiny hidden tilt because the downstream
1047
+ * renderer currently assumes a fixed up-vector and collapses on a perfectly
1048
+ * vertical view.
1049
+ */
1050
+ preset?: CameraPreset;
1051
+ /**
1052
+ * Approximate an orthographic view using a very narrow perspective FOV.
1053
+ *
1054
+ * This is a compatibility hack for renderers that only expose perspective
1055
+ * cameras. It is not a true orthographic projection.
1056
+ */
1057
+ ortho?: boolean;
1034
1058
  /**
1035
1059
  * Target-to-camera direction vector used for solved camera position.
1036
1060
  */
@@ -1053,10 +1077,7 @@ interface CameraFitOptions {
1053
1077
  */
1054
1078
  sensorHeight?: number;
1055
1079
  }
1056
- /**
1057
- * Calculate optimal camera position for PCB viewing based on circuit dimensions
1058
- */
1059
- declare function getBestCameraPosition(circuitJson: CircuitJson): {
1080
+ declare function getBestCameraPosition(circuitJson: CircuitJson, opts?: CameraFitOptions): {
1060
1081
  camPos: readonly [number, number, number];
1061
1082
  lookAt: readonly [number, number, number];
1062
1083
  fov: number;
@@ -1099,9 +1120,11 @@ type CircuitJsonToGltfModule_BRepShape = BRepShape;
1099
1120
  type CircuitJsonToGltfModule_BoardRenderOptions = BoardRenderOptions;
1100
1121
  type CircuitJsonToGltfModule_BoundingBox = BoundingBox;
1101
1122
  type CircuitJsonToGltfModule_Box3D = Box3D;
1123
+ declare const CircuitJsonToGltfModule_CAMERA_PRESET_DIRECTIONS: typeof CAMERA_PRESET_DIRECTIONS;
1102
1124
  declare const CircuitJsonToGltfModule_COORDINATE_TRANSFORMS: typeof COORDINATE_TRANSFORMS;
1103
1125
  type CircuitJsonToGltfModule_Camera3D = Camera3D;
1104
1126
  type CircuitJsonToGltfModule_CameraFitOptions = CameraFitOptions;
1127
+ type CircuitJsonToGltfModule_CameraPreset = CameraPreset;
1105
1128
  type CircuitJsonToGltfModule_CircuitTo3DOptions = CircuitTo3DOptions;
1106
1129
  type CircuitJsonToGltfModule_Color = Color;
1107
1130
  type CircuitJsonToGltfModule_ConversionOptions = ConversionOptions;
@@ -1132,7 +1155,7 @@ declare const CircuitJsonToGltfModule_renderBoardLayer: typeof renderBoardLayer;
1132
1155
  declare const CircuitJsonToGltfModule_renderBoardTextures: typeof renderBoardTextures;
1133
1156
  declare const CircuitJsonToGltfModule_transformTriangles: typeof transformTriangles;
1134
1157
  declare namespace CircuitJsonToGltfModule {
1135
- export { type CircuitJsonToGltfModule_BRepShape as BRepShape, type CircuitJsonToGltfModule_BoardRenderOptions as BoardRenderOptions, type CircuitJsonToGltfModule_BoundingBox as BoundingBox, type CircuitJsonToGltfModule_Box3D as Box3D, CircuitJsonToGltfModule_COORDINATE_TRANSFORMS as COORDINATE_TRANSFORMS, type CircuitJsonToGltfModule_Camera3D as Camera3D, type CircuitJsonToGltfModule_CameraFitOptions as CameraFitOptions, type CircuitJsonToGltfModule_CircuitTo3DOptions as CircuitTo3DOptions, type CircuitJsonToGltfModule_Color as Color, type CircuitJsonToGltfModule_ConversionOptions as ConversionOptions, type CircuitJsonToGltfModule_CoordinateTransformConfig as CoordinateTransformConfig, type CircuitJsonToGltfModule_GLTFExportOptions as GLTFExportOptions, type CircuitJsonToGltfModule_LayerRef as LayerRef, type CircuitJsonToGltfModule_Light3D as Light3D, type CircuitJsonToGltfModule_OBJMaterial as OBJMaterial, type CircuitJsonToGltfModule_OBJMesh as OBJMesh, type CircuitJsonToGltfModule_Point as Point, type CircuitJsonToGltfModule_Point3 as Point3, type CircuitJsonToGltfModule_STLMesh as STLMesh, type CircuitJsonToGltfModule_Scene3D as Scene3D, type CircuitJsonToGltfModule_Size3 as Size3, type CircuitJsonToGltfModule_Triangle as Triangle, CircuitJsonToGltfModule_applyCoordinateTransform as applyCoordinateTransform, CircuitJsonToGltfModule_clearGLBCache as clearGLBCache, CircuitJsonToGltfModule_clearOBJCache as clearOBJCache, CircuitJsonToGltfModule_clearSTLCache as clearSTLCache, CircuitJsonToGltfModule_convertCircuitJsonTo3D as convertCircuitJsonTo3D, CircuitJsonToGltfModule_convertCircuitJsonToGltf as convertCircuitJsonToGltf, CircuitJsonToGltfModule_convertSceneToGLTF as convertSceneToGLTF, CircuitJsonToGltfModule_getBestCameraPosition as getBestCameraPosition, CircuitJsonToGltfModule_loadGLB as loadGLB, CircuitJsonToGltfModule_loadOBJ as loadOBJ, CircuitJsonToGltfModule_loadSTL as loadSTL, CircuitJsonToGltfModule_renderBoardLayer as renderBoardLayer, CircuitJsonToGltfModule_renderBoardTextures as renderBoardTextures, CircuitJsonToGltfModule_transformTriangles as transformTriangles };
1158
+ export { type CircuitJsonToGltfModule_BRepShape as BRepShape, type CircuitJsonToGltfModule_BoardRenderOptions as BoardRenderOptions, type CircuitJsonToGltfModule_BoundingBox as BoundingBox, type CircuitJsonToGltfModule_Box3D as Box3D, CircuitJsonToGltfModule_CAMERA_PRESET_DIRECTIONS as CAMERA_PRESET_DIRECTIONS, CircuitJsonToGltfModule_COORDINATE_TRANSFORMS as COORDINATE_TRANSFORMS, type CircuitJsonToGltfModule_Camera3D as Camera3D, type CircuitJsonToGltfModule_CameraFitOptions as CameraFitOptions, type CircuitJsonToGltfModule_CameraPreset as CameraPreset, type CircuitJsonToGltfModule_CircuitTo3DOptions as CircuitTo3DOptions, type CircuitJsonToGltfModule_Color as Color, type CircuitJsonToGltfModule_ConversionOptions as ConversionOptions, type CircuitJsonToGltfModule_CoordinateTransformConfig as CoordinateTransformConfig, type CircuitJsonToGltfModule_GLTFExportOptions as GLTFExportOptions, type CircuitJsonToGltfModule_LayerRef as LayerRef, type CircuitJsonToGltfModule_Light3D as Light3D, type CircuitJsonToGltfModule_OBJMaterial as OBJMaterial, type CircuitJsonToGltfModule_OBJMesh as OBJMesh, type CircuitJsonToGltfModule_Point as Point, type CircuitJsonToGltfModule_Point3 as Point3, type CircuitJsonToGltfModule_STLMesh as STLMesh, type CircuitJsonToGltfModule_Scene3D as Scene3D, type CircuitJsonToGltfModule_Size3 as Size3, type CircuitJsonToGltfModule_Triangle as Triangle, CircuitJsonToGltfModule_applyCoordinateTransform as applyCoordinateTransform, CircuitJsonToGltfModule_clearGLBCache as clearGLBCache, CircuitJsonToGltfModule_clearOBJCache as clearOBJCache, CircuitJsonToGltfModule_clearSTLCache as clearSTLCache, CircuitJsonToGltfModule_convertCircuitJsonTo3D as convertCircuitJsonTo3D, CircuitJsonToGltfModule_convertCircuitJsonToGltf as convertCircuitJsonToGltf, CircuitJsonToGltfModule_convertSceneToGLTF as convertSceneToGLTF, CircuitJsonToGltfModule_getBestCameraPosition as getBestCameraPosition, CircuitJsonToGltfModule_loadGLB as loadGLB, CircuitJsonToGltfModule_loadOBJ as loadOBJ, CircuitJsonToGltfModule_loadSTL as loadSTL, CircuitJsonToGltfModule_renderBoardLayer as renderBoardLayer, CircuitJsonToGltfModule_renderBoardTextures as renderBoardTextures, CircuitJsonToGltfModule_transformTriangles as transformTriangles };
1136
1159
  }
1137
1160
 
1138
1161
  type PaperSize = "A0" | "A1" | "A2" | "A3" | "A4" | "A5";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/internal-dynamic-import",
3
- "version": "0.0.9",
3
+ "version": "0.0.11",
4
4
  "description": "Type-safe dynamic imports for selected tscircuit packages via jscdn and fallback to jsDelivr",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -33,7 +33,7 @@
33
33
  "circuit-json-to-bpc": "0.0.13",
34
34
  "circuit-json-to-connectivity-map": "0.0.23",
35
35
  "circuit-json-to-gerber": "0.0.51",
36
- "circuit-json-to-gltf": "0.0.88",
36
+ "circuit-json-to-gltf": "0.0.106",
37
37
  "circuit-json-to-kicad": "0.0.137",
38
38
  "circuit-json-to-lbrn": "0.0.69",
39
39
  "circuit-json-to-pnp-csv": "0.0.7",
@@ -41,7 +41,7 @@
41
41
  "circuit-json-to-simple-3d": "0.0.9",
42
42
  "circuit-json-to-spice": "0.0.34",
43
43
  "circuit-json-to-step": "0.0.19",
44
- "circuit-json-to-tscircuit": "0.0.14",
44
+ "circuit-json-to-tscircuit": "0.0.42",
45
45
  "circuit-to-canvas": "0.0.94",
46
46
  "circuit-to-svg": "0.0.339",
47
47
  "kicad-to-circuit-json": "0.0.98",