@tscircuit/core 0.0.1254 → 0.0.1256

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.js +35 -37
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -10783,6 +10783,38 @@ async function resolveStaticFileImport(path, platform) {
10783
10783
  return constructAssetUrl(normalizedPath, platform?.projectBaseUrl);
10784
10784
  }
10785
10785
 
10786
+ // lib/utils/connectors/extractCadModelFromCircuitJson.ts
10787
+ import { cadModelProp } from "@tscircuit/props";
10788
+ var extractCadModelFromCircuitJson = (circuitJson) => {
10789
+ const cadComponent = circuitJson.find(
10790
+ (elm) => elm.type === "cad_component"
10791
+ );
10792
+ if (!cadComponent) return void 0;
10793
+ const cadModelCandidate = {
10794
+ stlUrl: cadComponent.model_stl_url,
10795
+ objUrl: cadComponent.model_obj_url,
10796
+ gltfUrl: cadComponent.model_gltf_url,
10797
+ glbUrl: cadComponent.model_glb_url,
10798
+ stepUrl: cadComponent.model_step_url,
10799
+ wrlUrl: cadComponent.model_wrl_url,
10800
+ modelOriginPosition: cadComponent.model_origin_position ?? void 0,
10801
+ modelUnitToMmScale: cadComponent.model_unit_to_mm_scale_factor,
10802
+ modelBoardNormalDirection: cadComponent.model_board_normal_direction,
10803
+ size: cadComponent.size ?? void 0,
10804
+ rotationOffset: cadComponent.rotation ?? void 0,
10805
+ positionOffset: cadComponent.position ?? void 0,
10806
+ showAsTranslucentModel: cadComponent.show_as_translucent_model
10807
+ };
10808
+ if (!cadModelCandidate.stlUrl && !cadModelCandidate.objUrl && !cadModelCandidate.gltfUrl && !cadModelCandidate.glbUrl && !cadModelCandidate.stepUrl && !cadModelCandidate.wrlUrl && !cadComponent.model_jscad) {
10809
+ return void 0;
10810
+ }
10811
+ if (cadComponent.model_jscad && typeof cadComponent.model_jscad === "object") {
10812
+ cadModelCandidate.jscad = cadComponent.model_jscad;
10813
+ }
10814
+ const parsedCadModel = cadModelProp.safeParse(cadModelCandidate);
10815
+ return parsedCadModel.success ? parsedCadModel.data : void 0;
10816
+ };
10817
+
10786
10818
  // lib/components/base-components/NormalComponent/NormalComponent_doInitialPcbFootprintStringRender.ts
10787
10819
  function NormalComponent_doInitialPcbFootprintStringRender(component, queueAsyncEffect) {
10788
10820
  let { footprint } = component.props;
@@ -10910,9 +10942,7 @@ function NormalComponent_doInitialPcbFootprintStringRender(component, queueAsync
10910
10942
  const fpWrapper = new Footprint({ src: footprint });
10911
10943
  for (const c of fpComponents) fpWrapper.add(c);
10912
10944
  component.add(fpWrapper);
10913
- if (!Array.isArray(result) && result.cadModel) {
10914
- component._asyncFootprintCadModel = result.cadModel;
10915
- }
10945
+ component._asyncFootprintCadModel = !Array.isArray(result) && result.cadModel || extractCadModelFromCircuitJson(circuitJson);
10916
10946
  for (const child of component.children) {
10917
10947
  if (child.componentName === "Port") {
10918
10948
  child._markDirty?.("PcbPortRender");
@@ -21356,7 +21386,7 @@ import { identity as identity5 } from "transformation-matrix";
21356
21386
  var package_default = {
21357
21387
  name: "@tscircuit/core",
21358
21388
  type: "module",
21359
- version: "0.0.1253",
21389
+ version: "0.0.1255",
21360
21390
  types: "dist/index.d.ts",
21361
21391
  main: "dist/index.js",
21362
21392
  module: "dist/index.js",
@@ -21389,7 +21419,7 @@ var package_default = {
21389
21419
  "@resvg/resvg-js": "^2.6.2",
21390
21420
  "@tscircuit/alphabet": "0.0.25",
21391
21421
  "@tscircuit/capacity-autorouter": "^0.0.505",
21392
- "@tscircuit/checks": "0.0.129",
21422
+ "@tscircuit/checks": "0.0.130",
21393
21423
  "@tscircuit/circuit-json-util": "^0.0.94",
21394
21424
  "@tscircuit/common": "^0.0.20",
21395
21425
  "@tscircuit/copper-pour-solver": "^0.0.29",
@@ -25297,38 +25327,6 @@ var convertCircuitJsonToUsbCStandardCircuitJson = (partCircuitJson) => {
25297
25327
  });
25298
25328
  };
25299
25329
 
25300
- // lib/utils/connectors/extractCadModelFromCircuitJson.ts
25301
- import { cadModelProp } from "@tscircuit/props";
25302
- var extractCadModelFromCircuitJson = (circuitJson) => {
25303
- const cadComponent = circuitJson.find(
25304
- (elm) => elm.type === "cad_component"
25305
- );
25306
- if (!cadComponent) return void 0;
25307
- const cadModelCandidate = {
25308
- stlUrl: cadComponent.model_stl_url,
25309
- objUrl: cadComponent.model_obj_url,
25310
- gltfUrl: cadComponent.model_gltf_url,
25311
- glbUrl: cadComponent.model_glb_url,
25312
- stepUrl: cadComponent.model_step_url,
25313
- wrlUrl: cadComponent.model_wrl_url,
25314
- modelOriginPosition: cadComponent.model_origin_position ?? void 0,
25315
- modelUnitToMmScale: cadComponent.model_unit_to_mm_scale_factor,
25316
- modelBoardNormalDirection: cadComponent.model_board_normal_direction,
25317
- size: cadComponent.size ?? void 0,
25318
- rotationOffset: cadComponent.rotation ?? void 0,
25319
- positionOffset: cadComponent.position ?? void 0,
25320
- showAsTranslucentModel: cadComponent.show_as_translucent_model
25321
- };
25322
- if (!cadModelCandidate.stlUrl && !cadModelCandidate.objUrl && !cadModelCandidate.gltfUrl && !cadModelCandidate.glbUrl && !cadModelCandidate.stepUrl && !cadModelCandidate.wrlUrl && !cadComponent.model_jscad) {
25323
- return void 0;
25324
- }
25325
- if (cadComponent.model_jscad && typeof cadComponent.model_jscad === "object") {
25326
- cadModelCandidate.jscad = cadComponent.model_jscad;
25327
- }
25328
- const parsedCadModel = cadModelProp.safeParse(cadModelCandidate);
25329
- return parsedCadModel.success ? parsedCadModel.data : void 0;
25330
- };
25331
-
25332
25330
  // lib/components/normal-components/Connector.ts
25333
25331
  import { symbols as symbols4 } from "schematic-symbols";
25334
25332
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.1254",
4
+ "version": "0.0.1256",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -34,7 +34,7 @@
34
34
  "@resvg/resvg-js": "^2.6.2",
35
35
  "@tscircuit/alphabet": "0.0.25",
36
36
  "@tscircuit/capacity-autorouter": "^0.0.505",
37
- "@tscircuit/checks": "0.0.129",
37
+ "@tscircuit/checks": "0.0.130",
38
38
  "@tscircuit/circuit-json-util": "^0.0.94",
39
39
  "@tscircuit/common": "^0.0.20",
40
40
  "@tscircuit/copper-pour-solver": "^0.0.29",