@tscircuit/core 0.0.1151 → 0.0.1153

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
@@ -93121,6 +93121,7 @@ declare class Connector<PinLabels extends string = never> extends Chip<PinLabels
93121
93121
  doInitialFetchPartFootprint(): void;
93122
93122
  doInitialPartsEngineRender(): void;
93123
93123
  updatePartsEngineRender(): void;
93124
+ doInitialSchematicComponentRender(): void;
93124
93125
  doInitialPcbComponentSizeCalculation(): void;
93125
93126
  }
93126
93127
 
package/dist/index.js CHANGED
@@ -5648,7 +5648,7 @@ var CourtyardRect = class extends PrimitiveComponent2 {
5648
5648
  const { db } = this.root;
5649
5649
  const { _parsedProps: props } = this;
5650
5650
  const position = this._getGlobalPcbPositionBeforeLayout();
5651
- const { maybeFlipLayer } = this._getPcbPrimitiveFlippedHelpers();
5651
+ const { maybeFlipLayer, isFlipped } = this._getPcbPrimitiveFlippedHelpers();
5652
5652
  const layer = maybeFlipLayer(props.layer ?? "top");
5653
5653
  if (layer !== "top" && layer !== "bottom") {
5654
5654
  throw new Error(
@@ -5660,7 +5660,11 @@ var CourtyardRect = class extends PrimitiveComponent2 {
5660
5660
  const decomposedTransform = decomposeTSR(
5661
5661
  this._computePcbGlobalTransformBeforeLayout()
5662
5662
  );
5663
- const ccw_rotation = decomposedTransform.rotation.angle * 180 / Math.PI;
5663
+ const ccwRotationDegrees = decomposedTransform.rotation.angle * 180 / Math.PI;
5664
+ let ccw_rotation = (ccwRotationDegrees % 360 + 360) % 360;
5665
+ if (isFlipped) {
5666
+ ccw_rotation = (180 - ccw_rotation + 360) % 360;
5667
+ }
5664
5668
  const pcb_courtyard_rect = db.pcb_courtyard_rect.insert({
5665
5669
  pcb_component_id,
5666
5670
  layer,
@@ -19149,7 +19153,7 @@ import { identity as identity5 } from "transformation-matrix";
19149
19153
  var package_default = {
19150
19154
  name: "@tscircuit/core",
19151
19155
  type: "module",
19152
- version: "0.0.1150",
19156
+ version: "0.0.1152",
19153
19157
  types: "dist/index.d.ts",
19154
19158
  main: "dist/index.js",
19155
19159
  module: "dist/index.js",
@@ -19214,7 +19218,7 @@ var package_default = {
19214
19218
  "circuit-json-to-gltf": "^0.0.91",
19215
19219
  "circuit-json-to-simple-3d": "^0.0.9",
19216
19220
  "circuit-json-to-spice": "^0.0.34",
19217
- "circuit-to-svg": "^0.0.342",
19221
+ "circuit-to-svg": "^0.0.343",
19218
19222
  concurrently: "^9.1.2",
19219
19223
  "connectivity-map": "^1.0.0",
19220
19224
  debug: "^4.3.6",
@@ -23028,6 +23032,88 @@ var rewriteToStandardUsbCPortHints = (circuitJson) => {
23028
23032
  });
23029
23033
  };
23030
23034
 
23035
+ // lib/components/normal-components/Connector.ts
23036
+ import { symbols as symbols4 } from "schematic-symbols";
23037
+
23038
+ // lib/components/normal-components/Connector_insertInnerSymbolInSchematicBox.ts
23039
+ function insertInnerSymbolInSchematicBox(connector, symbol) {
23040
+ if (!connector.schematic_component_id || !connector.root) return;
23041
+ const { db } = connector.root;
23042
+ const schematicComponent = db.schematic_component.get(
23043
+ connector.schematic_component_id
23044
+ );
23045
+ if (!schematicComponent) return;
23046
+ if (schematicComponent.symbol_name) return;
23047
+ const innerScaleFactor = 0.5;
23048
+ const targetWidth = schematicComponent.size.width * innerScaleFactor;
23049
+ const targetHeight = schematicComponent.size.height * innerScaleFactor;
23050
+ const scaleFactor = Math.min(
23051
+ targetWidth / symbol.size.width,
23052
+ targetHeight / symbol.size.height
23053
+ );
23054
+ if (!Number.isFinite(scaleFactor) || scaleFactor <= 0) return;
23055
+ const subcircuit_id = connector.getSubcircuit()?.subcircuit_id ?? void 0;
23056
+ const center = schematicComponent.center;
23057
+ const symbolCenter = symbol.center;
23058
+ const transformPoint = (point6) => ({
23059
+ x: center.x + (point6.x - symbolCenter.x) * scaleFactor,
23060
+ y: center.y + (point6.y - symbolCenter.y) * scaleFactor
23061
+ });
23062
+ for (const primitive of symbol.primitives) {
23063
+ if (primitive.type === "path") {
23064
+ const points = primitive.points.map(transformPoint);
23065
+ if (primitive.closed && points.length > 1) {
23066
+ const first = points[0];
23067
+ const last = points[points.length - 1];
23068
+ if (first.x !== last.x || first.y !== last.y) {
23069
+ points.push(first);
23070
+ }
23071
+ }
23072
+ db.schematic_path.insert({
23073
+ schematic_component_id: connector.schematic_component_id,
23074
+ points,
23075
+ is_filled: primitive.fill ?? false,
23076
+ fill_color: primitive.fill ? SCHEMATIC_COMPONENT_OUTLINE_COLOR : void 0,
23077
+ stroke_width: 0.02,
23078
+ subcircuit_id
23079
+ });
23080
+ } else if (primitive.type === "circle") {
23081
+ db.schematic_circle.insert({
23082
+ schematic_component_id: connector.schematic_component_id,
23083
+ center: transformPoint({ x: primitive.x, y: primitive.y }),
23084
+ radius: primitive.radius * scaleFactor,
23085
+ stroke_width: 0.02,
23086
+ color: SCHEMATIC_COMPONENT_OUTLINE_COLOR,
23087
+ is_filled: primitive.fill,
23088
+ fill_color: primitive.fill ? SCHEMATIC_COMPONENT_OUTLINE_COLOR : void 0,
23089
+ is_dashed: false,
23090
+ subcircuit_id
23091
+ });
23092
+ } else if (primitive.type === "box") {
23093
+ const topLeft = transformPoint({ x: primitive.x, y: primitive.y });
23094
+ const bottomRight = transformPoint({
23095
+ x: primitive.x + primitive.width,
23096
+ y: primitive.y + primitive.height
23097
+ });
23098
+ db.schematic_rect.insert({
23099
+ schematic_component_id: connector.schematic_component_id,
23100
+ center: {
23101
+ x: (topLeft.x + bottomRight.x) / 2,
23102
+ y: (topLeft.y + bottomRight.y) / 2
23103
+ },
23104
+ width: Math.abs(bottomRight.x - topLeft.x),
23105
+ height: Math.abs(bottomRight.y - topLeft.y),
23106
+ stroke_width: 0.02,
23107
+ color: SCHEMATIC_COMPONENT_OUTLINE_COLOR,
23108
+ is_filled: false,
23109
+ is_dashed: false,
23110
+ rotation: 0,
23111
+ subcircuit_id
23112
+ });
23113
+ }
23114
+ }
23115
+ }
23116
+
23031
23117
  // lib/components/normal-components/Connector.ts
23032
23118
  var Connector = class extends Chip {
23033
23119
  _getConnectorProps() {
@@ -23184,6 +23270,15 @@ var Connector = class extends Chip {
23184
23270
  if (this._isUsingStandardPartsEngineCircuitJsonFlow()) return;
23185
23271
  super.updatePartsEngineRender();
23186
23272
  }
23273
+ doInitialSchematicComponentRender() {
23274
+ super.doInitialSchematicComponentRender();
23275
+ if (!this.root?.schematicDisabled && this.schematic_component_id && this._getConnectorProps().standard === "usb_c") {
23276
+ const usbcSymbol = symbols4.usbc;
23277
+ if (usbcSymbol) {
23278
+ insertInnerSymbolInSchematicBox(this, usbcSymbol);
23279
+ }
23280
+ }
23281
+ }
23187
23282
  doInitialPcbComponentSizeCalculation() {
23188
23283
  super.doInitialPcbComponentSizeCalculation();
23189
23284
  if (this.root?.pcbDisabled) return;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.1151",
4
+ "version": "0.0.1153",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -66,7 +66,7 @@
66
66
  "circuit-json-to-gltf": "^0.0.91",
67
67
  "circuit-json-to-simple-3d": "^0.0.9",
68
68
  "circuit-json-to-spice": "^0.0.34",
69
- "circuit-to-svg": "^0.0.342",
69
+ "circuit-to-svg": "^0.0.343",
70
70
  "concurrently": "^9.1.2",
71
71
  "connectivity-map": "^1.0.0",
72
72
  "debug": "^4.3.6",