@tscircuit/core 0.0.2140 → 0.0.2142

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 +139 -27
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -17860,31 +17860,28 @@ var NormalComponent = class extends PrimitiveComponent2 {
17860
17860
  }
17861
17861
  this.addAll(portsToCreate);
17862
17862
  }
17863
- if (!this._getSchematicPortArrangement()) {
17864
- const hasReactSymbol = isValidElement(this.props.symbol);
17865
- const hasCircuitJsonSymbolProp = isCircuitJsonSymbol(this.props.symbol);
17866
- if (hasReactSymbol || hasCircuitJsonSymbolProp) {
17867
- } else {
17868
- const portsFromFootprint = this.getPortsFromFootprint({
17869
- ...opts,
17870
- allowImplicitPinNumbers: !pinLabelsFromProps,
17871
- collectInferredInternallyConnectedPins: true
17872
- });
17873
- const existingPorts = this._getAllPortsFromChildren();
17874
- for (const port of portsFromFootprint) {
17875
- if (!port._isPrimaryPort) {
17876
- portsToCreate.push(port);
17877
- continue;
17878
- }
17879
- const matchingPort = existingPorts.find((p2) => canMergePortDefinitions(p2, port)) ?? portsToCreate.find((p2) => canMergePortDefinitions(p2, port));
17880
- if (matchingPort) {
17881
- const mergedAliases = port.getNameAndAliases().filter(
17882
- (alias) => !matchingPort.getNameAndAliases().includes(alias)
17883
- );
17884
- matchingPort.externallyAddedAliases.push(...mergedAliases);
17885
- } else {
17886
- portsToCreate.push(port);
17887
- }
17863
+ const hasReactSymbol = isValidElement(this.props.symbol);
17864
+ const hasCircuitJsonSymbolProp = isCircuitJsonSymbol(this.props.symbol);
17865
+ if (!hasReactSymbol && !hasCircuitJsonSymbolProp) {
17866
+ const portsFromFootprint = this.getPortsFromFootprint({
17867
+ ...opts,
17868
+ allowImplicitPinNumbers: !pinLabelsFromProps,
17869
+ collectInferredInternallyConnectedPins: true
17870
+ });
17871
+ const existingPorts = this._getAllPortsFromChildren();
17872
+ for (const port of portsFromFootprint) {
17873
+ if (!port._isPrimaryPort) {
17874
+ portsToCreate.push(port);
17875
+ continue;
17876
+ }
17877
+ const matchingPort = existingPorts.find((p2) => canMergePortDefinitions(p2, port)) ?? portsToCreate.find((p2) => canMergePortDefinitions(p2, port));
17878
+ if (matchingPort) {
17879
+ const mergedAliases = port.getNameAndAliases().filter(
17880
+ (alias) => !matchingPort.getNameAndAliases().includes(alias)
17881
+ );
17882
+ matchingPort.externallyAddedAliases.push(...mergedAliases);
17883
+ } else if (!schPortArrangement) {
17884
+ portsToCreate.push(port);
17888
17885
  }
17889
17886
  }
17890
17887
  }
@@ -115779,10 +115776,125 @@ import {
115779
115776
 
115780
115777
  // lib/components/primitive-components/Group/Group_doInitialSchematicTraceRender/getSchematicTextBounds.ts
115781
115778
  import { getBoundsFromPoints as getBoundsFromPoints10 } from "@tscircuit/math-utils";
115779
+
115780
+ // lib/utils/schematic/getSchematicTextObstacleWidth.ts
115781
+ var ASCII_ADVANCES = [
115782
+ 28,
115783
+ 28,
115784
+ 35,
115785
+ 56,
115786
+ 56,
115787
+ 89,
115788
+ 67,
115789
+ 19,
115790
+ 33,
115791
+ 33,
115792
+ 39,
115793
+ 58,
115794
+ 28,
115795
+ 33,
115796
+ 28,
115797
+ 28,
115798
+ 56,
115799
+ 56,
115800
+ 56,
115801
+ 56,
115802
+ 56,
115803
+ 56,
115804
+ 56,
115805
+ 56,
115806
+ 56,
115807
+ 56,
115808
+ 28,
115809
+ 28,
115810
+ 58,
115811
+ 58,
115812
+ 58,
115813
+ 56,
115814
+ 102,
115815
+ 67,
115816
+ 67,
115817
+ 72,
115818
+ 72,
115819
+ 67,
115820
+ 61,
115821
+ 78,
115822
+ 72,
115823
+ 28,
115824
+ 50,
115825
+ 67,
115826
+ 56,
115827
+ 83,
115828
+ 72,
115829
+ 78,
115830
+ 67,
115831
+ 78,
115832
+ 72,
115833
+ 67,
115834
+ 61,
115835
+ 72,
115836
+ 67,
115837
+ 94,
115838
+ 67,
115839
+ 67,
115840
+ 61,
115841
+ 28,
115842
+ 28,
115843
+ 28,
115844
+ 47,
115845
+ 56,
115846
+ 33,
115847
+ 56,
115848
+ 56,
115849
+ 50,
115850
+ 56,
115851
+ 56,
115852
+ 28,
115853
+ 56,
115854
+ 56,
115855
+ 22,
115856
+ 22,
115857
+ 50,
115858
+ 22,
115859
+ 83,
115860
+ 56,
115861
+ 56,
115862
+ 56,
115863
+ 56,
115864
+ 33,
115865
+ 50,
115866
+ 28,
115867
+ 56,
115868
+ 50,
115869
+ 72,
115870
+ 50,
115871
+ 50,
115872
+ 50,
115873
+ 33,
115874
+ 26,
115875
+ 33,
115876
+ 58
115877
+ ];
115878
+ function getSchematicTextObstacleWidth({
115879
+ text,
115880
+ fontSize
115881
+ }) {
115882
+ let totalAdvance = 0;
115883
+ for (const character of text) {
115884
+ const advance = ASCII_ADVANCES[character.charCodeAt(0) - 32];
115885
+ if (advance === void 0) {
115886
+ return getSchematicTextWidth({ text, fontSize });
115887
+ }
115888
+ totalAdvance += advance;
115889
+ }
115890
+ return totalAdvance * (fontSize / 100);
115891
+ }
115892
+
115893
+ // lib/components/primitive-components/Group/Group_doInitialSchematicTraceRender/getSchematicTextBounds.ts
115782
115894
  var DEFAULT_SCHEMATIC_TEXT_FONT_SIZE = 0.18;
115783
115895
  function getSchematicTextBounds2(text) {
115784
115896
  const fontSize = text.font_size ?? DEFAULT_SCHEMATIC_TEXT_FONT_SIZE;
115785
- const width = getSchematicTextWidth({
115897
+ const width = getSchematicTextObstacleWidth({
115786
115898
  text: text.text ?? "",
115787
115899
  fontSize
115788
115900
  });
@@ -118433,7 +118545,7 @@ var RoutingPhasePreparationError = class extends Error {
118433
118545
  var package_default = {
118434
118546
  name: "@tscircuit/core",
118435
118547
  type: "module",
118436
- version: "0.0.2139",
118548
+ version: "0.0.2141",
118437
118549
  types: "dist/index.d.ts",
118438
118550
  main: "dist/index.js",
118439
118551
  module: "dist/index.js",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.2140",
4
+ "version": "0.0.2142",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",