@tscircuit/core 0.0.261 → 0.0.263
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 +1 -0
- package/dist/index.js +45 -24
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as _tscircuit_props from '@tscircuit/props';
|
|
2
2
|
import { subcircuitGroupProps, traceProps, SupplierPartNumbers, SchematicPortArrangement, groupProps, boardProps, capacitorProps, chipProps, diodeProps, jumperProps, ledProps, powerSourceProps, resistorProps, constraintProps, fabricationNotePathProps, fabricationNoteTextProps, footprintProps, subcircuitProps, holeProps, pcbKeepoutProps, netAliasProps, platedHoleProps, silkscreenCircleProps, silkscreenPathProps, silkscreenRectProps, silkscreenTextProps, silkscreenLineProps, smtPadProps, traceHintProps, viaProps, batteryProps, pinHeaderProps, resonatorProps, inductorProps, potentiometerProps, pushButtonProps, crystalProps, transistorProps, mosfetProps, CapacitorProps, ChipProps, ResistorProps, ManualEditEvent, manual_edits_file } from '@tscircuit/props';
|
|
3
3
|
import React, { ReactElement } from 'react';
|
|
4
|
+
export { createElement } from 'react';
|
|
4
5
|
import * as zod from 'zod';
|
|
5
6
|
import { z, ZodType } from 'zod';
|
|
6
7
|
import { symbols, SchSymbol, BaseSymbolName } from 'schematic-symbols';
|
package/dist/index.js
CHANGED
|
@@ -4246,26 +4246,45 @@ var createSchematicTraceCrossingSegments = ({
|
|
|
4246
4246
|
};
|
|
4247
4247
|
|
|
4248
4248
|
// lib/components/primitive-components/Trace/create-schematic-trace-junctions.ts
|
|
4249
|
-
var isOrthogonal = (edge1, edge2) => {
|
|
4250
|
-
const isVertical1 = edge1.from.x === edge1.to.x;
|
|
4251
|
-
const isVertical2 = edge2.from.x === edge2.to.x;
|
|
4252
|
-
return isVertical1 !== isVertical2;
|
|
4253
|
-
};
|
|
4254
4249
|
var getIntersectionPoint = (edge1, edge2) => {
|
|
4255
|
-
if (
|
|
4256
|
-
|
|
4257
|
-
|
|
4258
|
-
|
|
4259
|
-
|
|
4260
|
-
|
|
4261
|
-
|
|
4262
|
-
|
|
4263
|
-
|
|
4264
|
-
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
|
|
4250
|
+
if (edge1.from.x === edge1.to.x && edge2.from.x === edge2.to.x) {
|
|
4251
|
+
return null;
|
|
4252
|
+
}
|
|
4253
|
+
if (edge1.from.x === edge1.to.x) {
|
|
4254
|
+
const x2 = edge1.from.x;
|
|
4255
|
+
const m22 = (edge2.to.y - edge2.from.y) / (edge2.to.x - edge2.from.x);
|
|
4256
|
+
const b22 = edge2.from.y - m22 * edge2.from.x;
|
|
4257
|
+
const y2 = m22 * x2 + b22;
|
|
4258
|
+
if (x2 >= Math.min(edge2.from.x, edge2.to.x) && x2 <= Math.max(edge2.from.x, edge2.to.x) && y2 >= Math.min(edge2.from.y, edge2.to.y) && y2 <= Math.max(edge2.from.y, edge2.to.y)) {
|
|
4259
|
+
return { x: x2, y: y2 };
|
|
4260
|
+
}
|
|
4261
|
+
return null;
|
|
4262
|
+
}
|
|
4263
|
+
if (edge2.from.x === edge2.to.x) {
|
|
4264
|
+
const x2 = edge2.from.x;
|
|
4265
|
+
const m12 = (edge1.to.y - edge1.from.y) / (edge1.to.x - edge1.from.x);
|
|
4266
|
+
const b12 = edge1.from.y - m12 * edge1.from.x;
|
|
4267
|
+
const y2 = m12 * x2 + b12;
|
|
4268
|
+
if (x2 >= Math.min(edge1.from.x, edge1.to.x) && x2 <= Math.max(edge1.from.x, edge1.to.x) && y2 >= Math.min(edge1.from.y, edge1.to.y) && y2 <= Math.max(edge1.from.y, edge1.to.y)) {
|
|
4269
|
+
return { x: x2, y: y2 };
|
|
4270
|
+
}
|
|
4271
|
+
return null;
|
|
4272
|
+
}
|
|
4273
|
+
const m1 = (edge1.to.y - edge1.from.y) / (edge1.to.x - edge1.from.x);
|
|
4274
|
+
const b1 = edge1.from.y - m1 * edge1.from.x;
|
|
4275
|
+
const m2 = (edge2.to.y - edge2.from.y) / (edge2.to.x - edge2.from.x);
|
|
4276
|
+
const b2 = edge2.from.y - m2 * edge2.from.x;
|
|
4277
|
+
if (m1 === m2) {
|
|
4278
|
+
return null;
|
|
4279
|
+
}
|
|
4280
|
+
const x = (b2 - b1) / (m1 - m2);
|
|
4281
|
+
const y = m1 * x + b1;
|
|
4282
|
+
const isWithinEdge1 = x >= Math.min(edge1.from.x, edge1.to.x) && x <= Math.max(edge1.from.x, edge1.to.x) && y >= Math.min(edge1.from.y, edge1.to.y) && y <= Math.max(edge1.from.y, edge1.to.y);
|
|
4283
|
+
const isWithinEdge2 = x >= Math.min(edge2.from.x, edge2.to.x) && x <= Math.max(edge2.from.x, edge2.to.x) && y >= Math.min(edge2.from.y, edge2.to.y) && y <= Math.max(edge2.from.y, edge2.to.y);
|
|
4284
|
+
if (isWithinEdge1 && isWithinEdge2) {
|
|
4285
|
+
return { x, y };
|
|
4286
|
+
}
|
|
4287
|
+
return null;
|
|
4269
4288
|
};
|
|
4270
4289
|
var createSchematicTraceJunctions = ({
|
|
4271
4290
|
edges: myEdges,
|
|
@@ -4282,14 +4301,12 @@ var createSchematicTraceJunctions = ({
|
|
|
4282
4301
|
for (const otherEdge of otherEdges) {
|
|
4283
4302
|
const intersection = getIntersectionPoint(myEdge, otherEdge);
|
|
4284
4303
|
if (intersection) {
|
|
4285
|
-
|
|
4304
|
+
const pointKey = `${intersection.x},${intersection.y}`;
|
|
4305
|
+
return [{ x: intersection.x, y: intersection.y }];
|
|
4286
4306
|
}
|
|
4287
4307
|
}
|
|
4288
4308
|
}
|
|
4289
|
-
return
|
|
4290
|
-
const [x, y] = key.split(",").map(Number);
|
|
4291
|
-
return { x, y };
|
|
4292
|
-
});
|
|
4309
|
+
return [];
|
|
4293
4310
|
};
|
|
4294
4311
|
|
|
4295
4312
|
// lib/components/primitive-components/Trace/push-edges-of-schematic-trace-to-prevent-overlap.ts
|
|
@@ -6533,6 +6550,9 @@ var applyEditEventsToManualEditsFile = ({
|
|
|
6533
6550
|
return updatedManualEditsFile;
|
|
6534
6551
|
};
|
|
6535
6552
|
|
|
6553
|
+
// lib/index.ts
|
|
6554
|
+
import { createElement } from "react";
|
|
6555
|
+
|
|
6536
6556
|
// lib/register-catalogue.ts
|
|
6537
6557
|
extendCatalogue(components_exports);
|
|
6538
6558
|
extendCatalogue({
|
|
@@ -6584,6 +6604,7 @@ export {
|
|
|
6584
6604
|
Transistor,
|
|
6585
6605
|
Via,
|
|
6586
6606
|
applyEditEventsToManualEditsFile,
|
|
6607
|
+
createElement,
|
|
6587
6608
|
createUseComponent,
|
|
6588
6609
|
orderedRenderPhases,
|
|
6589
6610
|
useCapacitor,
|