@tscircuit/core 0.0.711 → 0.0.712

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.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as circuit_json from 'circuit-json';
2
2
  import { PcbTraceError, PcbPlacementError, PcbManualEditConflictWarning, LayerRef, AnyCircuitElement, Size, AnySourceComponent, PcbTraceRoutePoint, PcbTrace as PcbTrace$1, PcbVia, SchematicPort, SchematicComponent, RouteHintPoint, CircuitJson } from 'circuit-json';
3
3
  import * as _tscircuit_props from '@tscircuit/props';
4
- import { PlatformConfig, subcircuitGroupProps, AutorouterConfig, traceProps, SupplierPartNumbers, SchematicPortArrangement, groupProps, boardProps, capacitorProps, chipProps, pinoutProps, diodeProps, fuseProps, jumperProps, solderjumperProps, ledProps, powerSourceProps, CommonComponentProps, resistorProps, constraintProps, fabricationNotePathProps, fabricationNoteTextProps, footprintProps, subcircuitProps, breakoutProps, breakoutPointProps, holeProps, pcbKeepoutProps, netLabelProps, platedHoleProps, silkscreenCircleProps, silkscreenPathProps, silkscreenRectProps, silkscreenTextProps, silkscreenLineProps, smtPadProps, traceHintProps, viaProps, cutoutProps, batteryProps, pinHeaderProps, resonatorProps, inductorProps, potentiometerProps, pushButtonProps, crystalProps, transistorProps, mosfetProps, switchProps, testpointProps, schematicTextProps, schematicBoxProps, schematicTableProps, schematicRowProps, schematicCellProps, CapacitorProps, ChipProps, DiodeProps, ResistorProps, ManualEditEvent, ManualEditsFile, ChipConnections, manual_edits_file } from '@tscircuit/props';
4
+ import { PlatformConfig, subcircuitGroupProps, AutorouterConfig, traceProps, SupplierPartNumbers, CadModelProp, SchematicPortArrangement, groupProps, boardProps, capacitorProps, chipProps, pinoutProps, diodeProps, fuseProps, jumperProps, solderjumperProps, ledProps, powerSourceProps, CommonComponentProps, resistorProps, constraintProps, fabricationNotePathProps, fabricationNoteTextProps, footprintProps, subcircuitProps, breakoutProps, breakoutPointProps, holeProps, pcbKeepoutProps, netLabelProps, platedHoleProps, silkscreenCircleProps, silkscreenPathProps, silkscreenRectProps, silkscreenTextProps, silkscreenLineProps, smtPadProps, traceHintProps, viaProps, cutoutProps, batteryProps, pinHeaderProps, resonatorProps, inductorProps, potentiometerProps, pushButtonProps, crystalProps, transistorProps, mosfetProps, switchProps, testpointProps, schematicTextProps, schematicBoxProps, schematicTableProps, schematicRowProps, schematicCellProps, CapacitorProps, ChipProps, DiodeProps, ResistorProps, ManualEditEvent, ManualEditsFile, ChipConnections, manual_edits_file } from '@tscircuit/props';
5
5
  import React, { ReactElement, DetailedHTMLProps, SVGProps } from 'react';
6
6
  export { createElement } from 'react';
7
7
  import * as zod from 'zod';
@@ -1034,6 +1034,7 @@ declare class NormalComponent<ZodProps extends z.ZodType = any, PortNames extend
1034
1034
  _isnormalcomponent: string;
1035
1035
  };
1036
1036
  _asyncSupplierPartNumbers?: SupplierPartNumbers;
1037
+ _asyncFootprintCadModel?: CadModelProp;
1037
1038
  pcb_missing_footprint_error_id?: string;
1038
1039
  _hasStartedFootprintUrlLoad: boolean;
1039
1040
  private _invalidPinLabelMessages;
@@ -13863,19 +13864,6 @@ declare const voltageSourceProps: z.ZodObject<{
13863
13864
  schRotation?: number | undefined;
13864
13865
  schRelative?: boolean | undefined;
13865
13866
  pcbRelative?: boolean | undefined;
13866
- pinAttributes?: Record<string, {
13867
- providesPower?: boolean | undefined;
13868
- requiresPower?: boolean | undefined;
13869
- providesGround?: boolean | undefined;
13870
- requiresGround?: boolean | undefined;
13871
- providesVoltage?: string | number | undefined;
13872
- requiresVoltage?: string | number | undefined;
13873
- doNotConnect?: boolean | undefined;
13874
- }> | undefined;
13875
- peakToPeakVoltage?: number | undefined;
13876
- waveShape?: "square" | "sinewave" | "triangle" | "sawtooth" | undefined;
13877
- dutyCycle?: number | undefined;
13878
- supplierPartNumbers?: Partial<Record<"jlcpcb" | "macrofab" | "pcbway" | "digikey" | "mouser" | "lcsc", string[]>> | undefined;
13879
13867
  cadModel?: string | {
13880
13868
  stlUrl: string;
13881
13869
  rotationOffset?: number | {
@@ -13997,6 +13985,19 @@ declare const voltageSourceProps: z.ZodObject<{
13997
13985
  z: number;
13998
13986
  } | undefined;
13999
13987
  } | null | undefined;
13988
+ pinAttributes?: Record<string, {
13989
+ providesPower?: boolean | undefined;
13990
+ requiresPower?: boolean | undefined;
13991
+ providesGround?: boolean | undefined;
13992
+ requiresGround?: boolean | undefined;
13993
+ providesVoltage?: string | number | undefined;
13994
+ requiresVoltage?: string | number | undefined;
13995
+ doNotConnect?: boolean | undefined;
13996
+ }> | undefined;
13997
+ peakToPeakVoltage?: number | undefined;
13998
+ waveShape?: "square" | "sinewave" | "triangle" | "sawtooth" | undefined;
13999
+ dutyCycle?: number | undefined;
14000
+ supplierPartNumbers?: Partial<Record<"jlcpcb" | "macrofab" | "pcbway" | "digikey" | "mouser" | "lcsc", string[]>> | undefined;
14000
14001
  symbolName?: string | undefined;
14001
14002
  doNotPlace?: boolean | undefined;
14002
14003
  }, {
@@ -14033,19 +14034,6 @@ declare const voltageSourceProps: z.ZodObject<{
14033
14034
  schRotation?: string | number | undefined;
14034
14035
  schRelative?: boolean | undefined;
14035
14036
  pcbRelative?: boolean | undefined;
14036
- pinAttributes?: Record<string, {
14037
- providesPower?: boolean | undefined;
14038
- requiresPower?: boolean | undefined;
14039
- providesGround?: boolean | undefined;
14040
- requiresGround?: boolean | undefined;
14041
- providesVoltage?: string | number | undefined;
14042
- requiresVoltage?: string | number | undefined;
14043
- doNotConnect?: boolean | undefined;
14044
- }> | undefined;
14045
- peakToPeakVoltage?: string | number | undefined;
14046
- waveShape?: "square" | "sinewave" | "triangle" | "sawtooth" | undefined;
14047
- dutyCycle?: number | undefined;
14048
- supplierPartNumbers?: Partial<Record<"jlcpcb" | "macrofab" | "pcbway" | "digikey" | "mouser" | "lcsc", string[]>> | undefined;
14049
14037
  cadModel?: string | {
14050
14038
  stlUrl: string;
14051
14039
  rotationOffset?: number | {
@@ -14167,6 +14155,19 @@ declare const voltageSourceProps: z.ZodObject<{
14167
14155
  z: string | number;
14168
14156
  } | undefined;
14169
14157
  } | null | undefined;
14158
+ pinAttributes?: Record<string, {
14159
+ providesPower?: boolean | undefined;
14160
+ requiresPower?: boolean | undefined;
14161
+ providesGround?: boolean | undefined;
14162
+ requiresGround?: boolean | undefined;
14163
+ providesVoltage?: string | number | undefined;
14164
+ requiresVoltage?: string | number | undefined;
14165
+ doNotConnect?: boolean | undefined;
14166
+ }> | undefined;
14167
+ peakToPeakVoltage?: string | number | undefined;
14168
+ waveShape?: "square" | "sinewave" | "triangle" | "sawtooth" | undefined;
14169
+ dutyCycle?: number | undefined;
14170
+ supplierPartNumbers?: Partial<Record<"jlcpcb" | "macrofab" | "pcbway" | "digikey" | "mouser" | "lcsc", string[]>> | undefined;
14170
14171
  symbolName?: string | undefined;
14171
14172
  doNotPlace?: boolean | undefined;
14172
14173
  }>;
@@ -14816,19 +14817,6 @@ declare class VoltageSource extends NormalComponent<typeof voltageSourceProps, "
14816
14817
  schRotation?: number | undefined;
14817
14818
  schRelative?: boolean | undefined;
14818
14819
  pcbRelative?: boolean | undefined;
14819
- pinAttributes?: Record<string, {
14820
- providesPower?: boolean | undefined;
14821
- requiresPower?: boolean | undefined;
14822
- providesGround?: boolean | undefined;
14823
- requiresGround?: boolean | undefined;
14824
- providesVoltage?: string | number | undefined;
14825
- requiresVoltage?: string | number | undefined;
14826
- doNotConnect?: boolean | undefined;
14827
- }> | undefined;
14828
- peakToPeakVoltage?: number | undefined;
14829
- waveShape?: "square" | "sinewave" | "triangle" | "sawtooth" | undefined;
14830
- dutyCycle?: number | undefined;
14831
- supplierPartNumbers?: Partial<Record<"jlcpcb" | "macrofab" | "pcbway" | "digikey" | "mouser" | "lcsc", string[]>> | undefined;
14832
14820
  cadModel?: string | {
14833
14821
  stlUrl: string;
14834
14822
  rotationOffset?: number | {
@@ -14950,6 +14938,19 @@ declare class VoltageSource extends NormalComponent<typeof voltageSourceProps, "
14950
14938
  z: number;
14951
14939
  } | undefined;
14952
14940
  } | null | undefined;
14941
+ pinAttributes?: Record<string, {
14942
+ providesPower?: boolean | undefined;
14943
+ requiresPower?: boolean | undefined;
14944
+ providesGround?: boolean | undefined;
14945
+ requiresGround?: boolean | undefined;
14946
+ providesVoltage?: string | number | undefined;
14947
+ requiresVoltage?: string | number | undefined;
14948
+ doNotConnect?: boolean | undefined;
14949
+ }> | undefined;
14950
+ peakToPeakVoltage?: number | undefined;
14951
+ waveShape?: "square" | "sinewave" | "triangle" | "sawtooth" | undefined;
14952
+ dutyCycle?: number | undefined;
14953
+ supplierPartNumbers?: Partial<Record<"jlcpcb" | "macrofab" | "pcbway" | "digikey" | "mouser" | "lcsc", string[]>> | undefined;
14953
14954
  symbolName?: string | undefined;
14954
14955
  doNotPlace?: boolean | undefined;
14955
14956
  }, {
@@ -14986,19 +14987,6 @@ declare class VoltageSource extends NormalComponent<typeof voltageSourceProps, "
14986
14987
  schRotation?: string | number | undefined;
14987
14988
  schRelative?: boolean | undefined;
14988
14989
  pcbRelative?: boolean | undefined;
14989
- pinAttributes?: Record<string, {
14990
- providesPower?: boolean | undefined;
14991
- requiresPower?: boolean | undefined;
14992
- providesGround?: boolean | undefined;
14993
- requiresGround?: boolean | undefined;
14994
- providesVoltage?: string | number | undefined;
14995
- requiresVoltage?: string | number | undefined;
14996
- doNotConnect?: boolean | undefined;
14997
- }> | undefined;
14998
- peakToPeakVoltage?: string | number | undefined;
14999
- waveShape?: "square" | "sinewave" | "triangle" | "sawtooth" | undefined;
15000
- dutyCycle?: number | undefined;
15001
- supplierPartNumbers?: Partial<Record<"jlcpcb" | "macrofab" | "pcbway" | "digikey" | "mouser" | "lcsc", string[]>> | undefined;
15002
14990
  cadModel?: string | {
15003
14991
  stlUrl: string;
15004
14992
  rotationOffset?: number | {
@@ -15120,6 +15108,19 @@ declare class VoltageSource extends NormalComponent<typeof voltageSourceProps, "
15120
15108
  z: string | number;
15121
15109
  } | undefined;
15122
15110
  } | null | undefined;
15111
+ pinAttributes?: Record<string, {
15112
+ providesPower?: boolean | undefined;
15113
+ requiresPower?: boolean | undefined;
15114
+ providesGround?: boolean | undefined;
15115
+ requiresGround?: boolean | undefined;
15116
+ providesVoltage?: string | number | undefined;
15117
+ requiresVoltage?: string | number | undefined;
15118
+ doNotConnect?: boolean | undefined;
15119
+ }> | undefined;
15120
+ peakToPeakVoltage?: string | number | undefined;
15121
+ waveShape?: "square" | "sinewave" | "triangle" | "sawtooth" | undefined;
15122
+ dutyCycle?: number | undefined;
15123
+ supplierPartNumbers?: Partial<Record<"jlcpcb" | "macrofab" | "pcbway" | "digikey" | "mouser" | "lcsc", string[]>> | undefined;
15123
15124
  symbolName?: string | undefined;
15124
15125
  doNotPlace?: boolean | undefined;
15125
15126
  }>;
package/dist/index.js CHANGED
@@ -127,7 +127,8 @@ var orderedRenderPhases = [
127
127
  "PartsEngineRender"
128
128
  ];
129
129
  var asyncPhaseDependencies = {
130
- PcbTraceRender: ["PcbFootprintStringRender"]
130
+ PcbTraceRender: ["PcbFootprintStringRender"],
131
+ CadModelRender: ["PcbFootprintStringRender"]
131
132
  };
132
133
  var globalRenderCounter = 0;
133
134
  var Renderable = class {
@@ -6628,7 +6629,12 @@ function NormalComponent_doInitialPcbFootprintStringRender(component, queueAsync
6628
6629
  if (!resolverFn) return;
6629
6630
  queueAsyncEffect("load-lib-footprint", async () => {
6630
6631
  const result = await resolverFn(libRef.footprintName);
6631
- const circuitJson = Array.isArray(result) ? result : Array.isArray(result?.footprintCircuitJson) ? result.footprintCircuitJson : null;
6632
+ let circuitJson = null;
6633
+ if (Array.isArray(result)) {
6634
+ circuitJson = result;
6635
+ } else if (Array.isArray(result.footprintCircuitJson)) {
6636
+ circuitJson = result.footprintCircuitJson;
6637
+ }
6632
6638
  if (!circuitJson) return;
6633
6639
  const fpComponents = createComponentsFromCircuitJson(
6634
6640
  {
@@ -6641,6 +6647,9 @@ function NormalComponent_doInitialPcbFootprintStringRender(component, queueAsync
6641
6647
  circuitJson
6642
6648
  );
6643
6649
  component.addAll(fpComponents);
6650
+ if (!Array.isArray(result) && result.cadModel) {
6651
+ component._asyncFootprintCadModel = result.cadModel;
6652
+ }
6644
6653
  for (const child of component.children) {
6645
6654
  if (child.componentName === "Port") {
6646
6655
  child._markDirty?.("PcbPortRender");
@@ -6681,6 +6690,7 @@ var NormalComponent2 = class extends PrimitiveComponent2 {
6681
6690
  _isnormalcomponent: "_isNormalComponent"
6682
6691
  };
6683
6692
  _asyncSupplierPartNumbers;
6693
+ _asyncFootprintCadModel;
6684
6694
  pcb_missing_footprint_error_id;
6685
6695
  _hasStartedFootprintUrlLoad = false;
6686
6696
  _invalidPinLabelMessages = [];
@@ -7416,7 +7426,8 @@ var NormalComponent2 = class extends PrimitiveComponent2 {
7416
7426
  doInitialCadModelRender() {
7417
7427
  const { db } = this.root;
7418
7428
  const { boardThickness = 0 } = this.root?._getBoard() ?? {};
7419
- const cadModel = this._parsedProps.cadModel;
7429
+ const cadModelProp = this._parsedProps.cadModel;
7430
+ const cadModel = cadModelProp === void 0 ? this._asyncFootprintCadModel : cadModelProp;
7420
7431
  const footprint = this.props.footprint ?? this._getImpliedFootprintString();
7421
7432
  if (!this.pcb_component_id) return;
7422
7433
  if (!cadModel && !footprint) return;
@@ -7455,10 +7466,15 @@ var NormalComponent2 = class extends PrimitiveComponent2 {
7455
7466
  source_component_id: this.source_component_id,
7456
7467
  model_stl_url: "stlUrl" in (cadModel ?? {}) ? this._addCachebustToModelUrl(cadModel.stlUrl) : void 0,
7457
7468
  model_obj_url: "objUrl" in (cadModel ?? {}) ? this._addCachebustToModelUrl(cadModel.objUrl) : void 0,
7469
+ model_mtl_url: "mtlUrl" in (cadModel ?? {}) ? this._addCachebustToModelUrl(cadModel.mtlUrl) : void 0,
7458
7470
  model_gltf_url: "gltfUrl" in (cadModel ?? {}) ? this._addCachebustToModelUrl(cadModel.gltfUrl) : void 0,
7471
+ model_glb_url: "glbUrl" in (cadModel ?? {}) ? this._addCachebustToModelUrl(cadModel.glbUrl) : void 0,
7472
+ model_step_url: "stepUrl" in (cadModel ?? {}) ? this._addCachebustToModelUrl(cadModel.stepUrl) : void 0,
7473
+ model_wrl_url: "wrlUrl" in (cadModel ?? {}) ? this._addCachebustToModelUrl(cadModel.wrlUrl) : void 0,
7459
7474
  model_jscad: "jscad" in (cadModel ?? {}) ? cadModel.jscad : void 0,
7460
7475
  footprinter_string: typeof footprint === "string" && !cadModel ? footprint : void 0
7461
7476
  });
7477
+ this.cad_component_id = cad_model.cad_component_id;
7462
7478
  }
7463
7479
  _addCachebustToModelUrl(url) {
7464
7480
  if (!url || !url.includes("modelcdn.tscircuit.com")) return url;
@@ -14642,7 +14658,7 @@ import { identity as identity6 } from "transformation-matrix";
14642
14658
  var package_default = {
14643
14659
  name: "@tscircuit/core",
14644
14660
  type: "module",
14645
- version: "0.0.710",
14661
+ version: "0.0.711",
14646
14662
  types: "dist/index.d.ts",
14647
14663
  main: "dist/index.js",
14648
14664
  module: "dist/index.js",
@@ -14695,7 +14711,7 @@ var package_default = {
14695
14711
  "bun-match-svg": "0.0.12",
14696
14712
  "calculate-elbow": "^0.0.12",
14697
14713
  "chokidar-cli": "^3.0.0",
14698
- "circuit-json": "^0.0.245",
14714
+ "circuit-json": "^0.0.246",
14699
14715
  "circuit-json-to-bpc": "^0.0.13",
14700
14716
  "circuit-json-to-connectivity-map": "^0.0.22",
14701
14717
  "circuit-json-to-simple-3d": "^0.0.6",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.711",
4
+ "version": "0.0.712",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -54,7 +54,7 @@
54
54
  "bun-match-svg": "0.0.12",
55
55
  "calculate-elbow": "^0.0.12",
56
56
  "chokidar-cli": "^3.0.0",
57
- "circuit-json": "^0.0.245",
57
+ "circuit-json": "^0.0.246",
58
58
  "circuit-json-to-bpc": "^0.0.13",
59
59
  "circuit-json-to-connectivity-map": "^0.0.22",
60
60
  "circuit-json-to-simple-3d": "^0.0.6",