@tscircuit/core 0.0.2018 → 0.0.2020

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 (3) hide show
  1. package/dist/index.d.ts +2880 -2285
  2. package/dist/index.js +31 -13
  3. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -64561,7 +64561,7 @@ function Group_getRoutingPhasePlans(group) {
64561
64561
  var package_default = {
64562
64562
  name: "@tscircuit/core",
64563
64563
  type: "module",
64564
- version: "0.0.2017",
64564
+ version: "0.0.2019",
64565
64565
  types: "dist/index.d.ts",
64566
64566
  main: "dist/index.js",
64567
64567
  module: "dist/index.js",
@@ -64597,7 +64597,7 @@ var package_default = {
64597
64597
  "@tscircuit/bga-fanout-solver": "github:tscircuit/bga-fanout-solver#247c835cb8d69b65e53891dcf869731079415b39",
64598
64598
  "@tscircuit/bus-lanes-solver": "github:tscircuit/bus-lanes-solver#0bc8d071241b18a3e7465a878881abe4998f6384",
64599
64599
  "@tscircuit/capacity-autorouter": "^0.0.941",
64600
- "@tscircuit/checks": "^0.0.228",
64600
+ "@tscircuit/checks": "^0.0.230",
64601
64601
  "@tscircuit/circuit-json-util": "^0.0.116",
64602
64602
  "@tscircuit/common": "^0.0.20",
64603
64603
  "@tscircuit/copper-pour-solver": "^0.0.62",
@@ -64616,7 +64616,7 @@ var package_default = {
64616
64616
  "@tscircuit/math-utils": "^0.0.36",
64617
64617
  "@tscircuit/miniflex": "^0.0.4",
64618
64618
  "@tscircuit/ngspice-spice-engine": "^0.0.20",
64619
- "@tscircuit/props": "^0.0.670",
64619
+ "@tscircuit/props": "^0.0.672",
64620
64620
  "@tscircuit/schematic-match-adapt": "^0.0.18",
64621
64621
  "@tscircuit/schematic-trace-solver": "^0.0.212",
64622
64622
  "@tscircuit/solver-utils": "^0.0.16",
@@ -64695,7 +64695,7 @@ var package_default = {
64695
64695
  },
64696
64696
  overrides: {
64697
64697
  "@tscircuit/circuit-json-util": "^0.0.116",
64698
- "@tscircuit/props": "^0.0.670",
64698
+ "@tscircuit/props": "^0.0.672",
64699
64699
  "circuit-json": "^0.0.507"
64700
64700
  }
64701
64701
  };
@@ -76550,6 +76550,22 @@ var CopperPour = class extends PrimitiveComponent2 {
76550
76550
  // lib/components/primitive-components/AssemblyDevice.ts
76551
76551
  import { assemblyDeviceProps } from "@tscircuit/props";
76552
76552
  import { identity as identity10 } from "transformation-matrix";
76553
+
76554
+ // lib/components/primitive-components/resolve-assembly-model.ts
76555
+ var resolveAssemblyModel = (props) => {
76556
+ if (props.model !== void 0) {
76557
+ if (/^https?:\/\//i.test(props.model))
76558
+ return resolveAssemblyModelUrl(props.model);
76559
+ return {
76560
+ glbUrl: `https://modelcdn.tscircuit.com/jscad_models/${encodeURIComponent(props.model)}.glb`
76561
+ };
76562
+ }
76563
+ if (props.modelUrl !== void 0)
76564
+ return resolveAssemblyModelUrl(props.modelUrl);
76565
+ return void 0;
76566
+ };
76567
+
76568
+ // lib/components/primitive-components/AssemblyDevice.ts
76553
76569
  var AssemblyDevice = class extends PrimitiveComponent2 {
76554
76570
  isAssemblyDeviceContainer = true;
76555
76571
  get config() {
@@ -76567,20 +76583,22 @@ var AssemblyDevice = class extends PrimitiveComponent2 {
76567
76583
  return identity10();
76568
76584
  }
76569
76585
  doInitialSourceRender() {
76570
- if (this._parsedProps.modelUrl === void 0 || !this.root) return;
76586
+ if (this._parsedProps.modelUrl === void 0 && this._parsedProps.model === void 0 || !this.root)
76587
+ return;
76571
76588
  this.source_component_id = this.root.db.source_component.insert({
76572
76589
  ftype: "simple_chip",
76573
76590
  name: this.name
76574
76591
  }).source_component_id;
76575
76592
  }
76576
76593
  doInitialCadModelRender() {
76577
- if (!this.root || this.root.pcbDisabled || !this.source_component_id || this._parsedProps.modelUrl === void 0)
76594
+ const model = resolveAssemblyModel(this._parsedProps);
76595
+ if (!this.root || this.root.pcbDisabled || !this.source_component_id || !model)
76578
76596
  return;
76579
- this.cad_component_id = renderAssemblyCadModel(
76580
- this,
76581
- resolveAssemblyModelUrl(this._parsedProps.modelUrl),
76582
- { position: { x: 0, y: 0, z: 0 }, pcbRotation: 0, layer: "top" }
76583
- );
76597
+ this.cad_component_id = renderAssemblyCadModel(this, model, {
76598
+ position: { x: 0, y: 0, z: 0 },
76599
+ pcbRotation: 0,
76600
+ layer: "top"
76601
+ });
76584
76602
  }
76585
76603
  };
76586
76604
 
@@ -76604,7 +76622,7 @@ var AssemblyScreen_doInitialCadModelRender = (component) => {
76604
76622
  const placement = resolveAssemblyPlacement(component);
76605
76623
  component.cad_component_id = renderAssemblyCadModel(
76606
76624
  component,
76607
- component._parsedProps.modelUrl !== void 0 ? resolveAssemblyModelUrl(component._parsedProps.modelUrl) : component._parsedProps.cadModel ?? getDefaultFlexScreenModel(component),
76625
+ resolveAssemblyModel(component._parsedProps) ?? component._parsedProps.cadModel ?? getDefaultFlexScreenModel(component),
76608
76626
  placement
76609
76627
  );
76610
76628
  };
@@ -76663,7 +76681,7 @@ var AssemblySubassembly = class extends PrimitiveComponent2 {
76663
76681
  doInitialCadModelRender() {
76664
76682
  if (!this.root || this.root.pcbDisabled || !this.source_component_id) return;
76665
76683
  const placement = resolveAssemblyPlacement(this);
76666
- const model = this._parsedProps.modelUrl !== void 0 ? resolveAssemblyModelUrl(this._parsedProps.modelUrl) : this._parsedProps.cadModel;
76684
+ const model = resolveAssemblyModel(this._parsedProps) ?? this._parsedProps.cadModel;
76667
76685
  if (model && !(typeof model === "object" && "type" in model)) {
76668
76686
  this.cad_component_id = renderAssemblyCadModel(this, model, placement);
76669
76687
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.2018",
4
+ "version": "0.0.2020",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -37,7 +37,7 @@
37
37
  "@tscircuit/bga-fanout-solver": "github:tscircuit/bga-fanout-solver#247c835cb8d69b65e53891dcf869731079415b39",
38
38
  "@tscircuit/bus-lanes-solver": "github:tscircuit/bus-lanes-solver#0bc8d071241b18a3e7465a878881abe4998f6384",
39
39
  "@tscircuit/capacity-autorouter": "^0.0.941",
40
- "@tscircuit/checks": "^0.0.228",
40
+ "@tscircuit/checks": "^0.0.230",
41
41
  "@tscircuit/circuit-json-util": "^0.0.116",
42
42
  "@tscircuit/common": "^0.0.20",
43
43
  "@tscircuit/copper-pour-solver": "^0.0.62",
@@ -56,7 +56,7 @@
56
56
  "@tscircuit/math-utils": "^0.0.36",
57
57
  "@tscircuit/miniflex": "^0.0.4",
58
58
  "@tscircuit/ngspice-spice-engine": "^0.0.20",
59
- "@tscircuit/props": "^0.0.670",
59
+ "@tscircuit/props": "^0.0.672",
60
60
  "@tscircuit/schematic-match-adapt": "^0.0.18",
61
61
  "@tscircuit/schematic-trace-solver": "^0.0.212",
62
62
  "@tscircuit/solver-utils": "^0.0.16",
@@ -135,7 +135,7 @@
135
135
  },
136
136
  "overrides": {
137
137
  "@tscircuit/circuit-json-util": "^0.0.116",
138
- "@tscircuit/props": "^0.0.670",
138
+ "@tscircuit/props": "^0.0.672",
139
139
  "circuit-json": "^0.0.507"
140
140
  }
141
141
  }