@tscircuit/core 0.0.1944 → 0.0.1945
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 +62 -6
- package/dist/index.js +190 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as circuit_json from 'circuit-json';
|
|
2
2
|
import { PcbGroup, PcbTraceError, PcbPlacementError, PcbManualEditConflictWarning, PcbViaClearanceError, PcbVia as PcbVia$1, LayerRef, AnyCircuitElement, Size, PcbTrace as PcbTrace$1, PcbTraceRoutePoint, AnySourceComponent, PcbComponent, SchematicPort, SchematicComponent, SimulationVoltageSource, SimulationCurrentSource, PcbSilkscreenGraphic, SourceBus, RouteHintPoint, PcbBoard, SchematicSheet as SchematicSheet$1, SchematicGraphic as SchematicGraphic$1, SimulationExperiment, SimulationParameterSweep, CircuitJson } from 'circuit-json';
|
|
3
3
|
import * as _tscircuit_props from '@tscircuit/props';
|
|
4
|
-
import { PlatformConfig, traceProps, netProps, AutoroutingPhaseProps, AutorouterProp, subcircuitGroupProps, AutorouterConfig, PcbSx, portProps, PinAttributeMap, SupplierPartNumbers, CadModelProp, SchematicPortArrangement, groupProps, platedHoleProps, BoardOutlinePoint, boardProps, subcircuitProps, subpanelProps, capacitorProps, antennaProps, chipProps, pinoutProps, diodeProps, fuseProps, jumperProps, interconnectProps, solderjumperProps, ledProps, powerSourceProps, voltageSourceProps, currentSourceProps, ammeterProps, resistorProps, constraintProps, drcCheckProps, autoroutingPhaseProps, fabricationNoteRectProps, fabricationNotePathProps, fabricationNoteTextProps, fabricationNoteDimensionProps, pcbNoteLineProps, pcbNoteRectProps, pcbNoteTextProps, pcbNotePathProps, pcbNoteDimensionProps, footprintProps, breakoutProps, breakoutPointProps, holeProps, pcbKeepoutProps, netLabelProps, cadmodelProps, cadassemblyProps, courtyardCircleProps, courtyardOutlineProps, courtyardRectProps, silkscreenCircleProps, silkscreenPathProps, silkscreenRectProps, silkscreenTextProps, silkscreenLineProps, silkscreenGraphicProps, smtPadProps, fiducialProps, busProps, differentialPairProps, traceHintProps, viaProps, copperPourProps, copperTextProps, cutoutProps, assemblyDeviceProps, enclosureCutoutApertureProps, enclosureFdmBoxProps, batteryProps, pinHeaderProps, resonatorProps, inductorProps, potentiometerProps, pushButtonProps, crystalProps, CrystalPinLabels, transistorProps, mosfetProps, opampProps, OpAmpPinLabels, switchProps, SwitchProps, testpointProps, schematicTextProps, schematicLineProps, schematicRectProps, schematicArcProps, schematicCircleProps, schematicPathProps, schematicBoxProps, schematicSymbolProps, schematicSectionProps, schematicSheetProps, schematicGraphicProps, schematicTableProps, schematicRowProps, schematicCellProps, symbolProps, analogSimulationProps, analogTransientSimulationProps, analogDcOperatingPointSimulationProps, analogDcSweepSimulationProps, analogAcSweepSimulationProps, analogSweepParameterProps, voltageProbeProps, spicemodelProps, AnalogTransientSimulationProps, AnalogDcSweepSimulationProps, AnalogAcSweepSimulationProps, AnalogSweepParameterProps, AssemblyDevicePropsInput, EnclosureCutoutApertureProps, EnclosureFdmBoxProps, CapacitorProps, ChipProps, DiodeProps, ResistorProps, ManualEditEvent, ManualEditsFile, ChipConnections, manual_edits_file } from '@tscircuit/props';
|
|
4
|
+
import { PlatformConfig, traceProps, netProps, AutoroutingPhaseProps, AutorouterProp, subcircuitGroupProps, AutorouterConfig, PcbSx, portProps, PinAttributeMap, SupplierPartNumbers, CadModelProp, SchematicPortArrangement, groupProps, platedHoleProps, BoardOutlinePoint, boardProps, subcircuitProps, subpanelProps, capacitorProps, antennaProps, chipProps, pinoutProps, diodeProps, fuseProps, jumperProps, interconnectProps, solderjumperProps, ledProps, powerSourceProps, voltageSourceProps, currentSourceProps, ammeterProps, resistorProps, constraintProps, drcCheckProps, autoroutingPhaseProps, fabricationNoteRectProps, fabricationNotePathProps, fabricationNoteTextProps, fabricationNoteDimensionProps, pcbNoteLineProps, pcbNoteRectProps, pcbNoteTextProps, pcbNotePathProps, pcbNoteDimensionProps, footprintProps, breakoutProps, breakoutPointProps, holeProps, pcbKeepoutProps, netLabelProps, cadmodelProps, cadassemblyProps, courtyardCircleProps, courtyardOutlineProps, courtyardRectProps, silkscreenCircleProps, silkscreenPathProps, silkscreenRectProps, silkscreenTextProps, silkscreenLineProps, silkscreenGraphicProps, smtPadProps, fiducialProps, busProps, differentialPairProps, traceHintProps, viaProps, copperPourProps, copperTextProps, cutoutProps, assemblyDeviceProps, assemblyScreenProps, enclosureCutoutApertureProps, enclosureFdmBoxProps, batteryProps, pinHeaderProps, resonatorProps, inductorProps, potentiometerProps, pushButtonProps, crystalProps, CrystalPinLabels, transistorProps, mosfetProps, opampProps, OpAmpPinLabels, switchProps, SwitchProps, testpointProps, schematicTextProps, schematicLineProps, schematicRectProps, schematicArcProps, schematicCircleProps, schematicPathProps, schematicBoxProps, schematicSymbolProps, schematicSectionProps, schematicSheetProps, schematicGraphicProps, schematicTableProps, schematicRowProps, schematicCellProps, symbolProps, analogSimulationProps, analogTransientSimulationProps, analogDcOperatingPointSimulationProps, analogDcSweepSimulationProps, analogAcSweepSimulationProps, analogSweepParameterProps, voltageProbeProps, spicemodelProps, AnalogTransientSimulationProps, AnalogDcSweepSimulationProps, AnalogAcSweepSimulationProps, AnalogSweepParameterProps, AssemblyDevicePropsInput, AssemblyScreenPropsInput, EnclosureCutoutApertureProps, EnclosureFdmBoxProps, CapacitorProps, ChipProps, DiodeProps, ResistorProps, ManualEditEvent, ManualEditsFile, ChipConnections, manual_edits_file } from '@tscircuit/props';
|
|
5
5
|
export { FanoutTracePath, fanoutTracePath, kicadFootprintStrings } from '@tscircuit/props';
|
|
6
6
|
import * as react from 'react';
|
|
7
7
|
import react__default, { ReactElement, ReactNode } from 'react';
|
|
@@ -2474,6 +2474,17 @@ declare class NormalComponent<ZodProps extends z.ZodType = any, PortNames extend
|
|
|
2474
2474
|
protected _getPcbComponentLayer(): LayerRef;
|
|
2475
2475
|
_getFootprintOriginalLayer(): LayerRef | undefined;
|
|
2476
2476
|
protected _getPcbComponentInsertionDirection(componentLayer: LayerRef, rotationDegrees?: number): PcbComponent["insertion_direction"] | undefined;
|
|
2477
|
+
/**
|
|
2478
|
+
* The connector insertion axis as a continuous unit direction in Circuit
|
|
2479
|
+
* JSON's board-world XYZ frame (+Z above the board). This is a direction, not
|
|
2480
|
+
* a position, so it has no units or translation. It receives the same
|
|
2481
|
+
* rotation and layer flip as the footprint's pads.
|
|
2482
|
+
*/
|
|
2483
|
+
_getPcbComponentInsertionAxisDirection(componentLayer: LayerRef, rotationDegrees?: number): {
|
|
2484
|
+
x: number;
|
|
2485
|
+
y: number;
|
|
2486
|
+
z: number;
|
|
2487
|
+
} | undefined;
|
|
2477
2488
|
/**
|
|
2478
2489
|
* The enclosure aperture's outward axis as a continuous unit direction in
|
|
2479
2490
|
* board XYZ (+Z above the board). It is a direction, not a point, and receives
|
|
@@ -109934,10 +109945,10 @@ declare class Cutout extends PrimitiveComponent<typeof cutoutProps> {
|
|
|
109934
109945
|
}
|
|
109935
109946
|
|
|
109936
109947
|
/**
|
|
109937
|
-
* An assembly
|
|
109938
|
-
*
|
|
109939
|
-
* subcircuit. Components that would otherwise assume "my parent is a
|
|
109940
|
-
* subcircuit" use this to opt out.
|
|
109948
|
+
* An assembly-device element is a product-level `<assembly.device>` wrapper or
|
|
109949
|
+
* a semantic subtype such as `<assembly.screen>`. It is not an electrical group
|
|
109950
|
+
* or subcircuit. Components that would otherwise assume "my parent is a
|
|
109951
|
+
* subcircuit" use this marker to opt out.
|
|
109941
109952
|
*/
|
|
109942
109953
|
interface AssemblyDeviceContainer {
|
|
109943
109954
|
isAssemblyDeviceContainer: true;
|
|
@@ -109960,6 +109971,48 @@ declare class AssemblyDevice extends PrimitiveComponent<typeof assemblyDevicePro
|
|
|
109960
109971
|
_computePcbGlobalTransformBeforeLayout(): Matrix;
|
|
109961
109972
|
}
|
|
109962
109973
|
|
|
109974
|
+
declare class AssemblyScreen extends PrimitiveComponent<typeof assemblyScreenProps> implements AssemblyDeviceContainer {
|
|
109975
|
+
isAssemblyDeviceContainer: true;
|
|
109976
|
+
get config(): {
|
|
109977
|
+
componentName: string;
|
|
109978
|
+
zodProps: zod.ZodEffects<zod.ZodObject<{
|
|
109979
|
+
name: zod.ZodEffects<zod.ZodString, string, string>;
|
|
109980
|
+
connectsTo: zod.ZodEffects<zod.ZodString, string, string>;
|
|
109981
|
+
width: zod.ZodOptional<zod.ZodEffects<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>, number, string | number>>;
|
|
109982
|
+
height: zod.ZodOptional<zod.ZodEffects<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>, number, string | number>>;
|
|
109983
|
+
cadModel: zod.ZodOptional<zod.ZodEffects<zod.ZodString, string, string>>;
|
|
109984
|
+
}, "strip", zod.ZodTypeAny, {
|
|
109985
|
+
name: string;
|
|
109986
|
+
connectsTo: string;
|
|
109987
|
+
width?: number | undefined;
|
|
109988
|
+
height?: number | undefined;
|
|
109989
|
+
cadModel?: string | undefined;
|
|
109990
|
+
}, {
|
|
109991
|
+
name: string;
|
|
109992
|
+
connectsTo: string;
|
|
109993
|
+
width?: string | number | undefined;
|
|
109994
|
+
height?: string | number | undefined;
|
|
109995
|
+
cadModel?: string | undefined;
|
|
109996
|
+
}>, {
|
|
109997
|
+
name: string;
|
|
109998
|
+
connectsTo: string;
|
|
109999
|
+
width?: number | undefined;
|
|
110000
|
+
height?: number | undefined;
|
|
110001
|
+
cadModel?: string | undefined;
|
|
110002
|
+
}, {
|
|
110003
|
+
name: string;
|
|
110004
|
+
connectsTo: string;
|
|
110005
|
+
width?: string | number | undefined;
|
|
110006
|
+
height?: string | number | undefined;
|
|
110007
|
+
cadModel?: string | undefined;
|
|
110008
|
+
}>;
|
|
110009
|
+
};
|
|
110010
|
+
doInitialAssignNameToUnnamedComponents(): void;
|
|
110011
|
+
doInitialSourceRender(): void;
|
|
110012
|
+
doInitialPcbComponentRender(): void;
|
|
110013
|
+
doInitialCadModelRender(): void;
|
|
110014
|
+
}
|
|
110015
|
+
|
|
109963
110016
|
interface GetFdmEnclosureSolverInputParams {
|
|
109964
110017
|
board: Board;
|
|
109965
110018
|
pcbBoard: PcbBoard;
|
|
@@ -192031,8 +192084,11 @@ declare const analog: {
|
|
|
192031
192084
|
interface AssemblyDeviceJsxProps extends AssemblyDevicePropsInput {
|
|
192032
192085
|
children?: ReactNode;
|
|
192033
192086
|
}
|
|
192087
|
+
interface AssemblyScreenJsxProps extends AssemblyScreenPropsInput {
|
|
192088
|
+
}
|
|
192034
192089
|
declare const assembly: {
|
|
192035
192090
|
readonly device: react.FunctionComponent<AssemblyDeviceJsxProps>;
|
|
192091
|
+
readonly screen: react.FunctionComponent<AssemblyScreenJsxProps>;
|
|
192036
192092
|
};
|
|
192037
192093
|
|
|
192038
192094
|
declare const enclosure: {
|
|
@@ -193792,4 +193848,4 @@ declare module "react/jsx-runtime" {
|
|
|
193792
193848
|
}
|
|
193793
193849
|
}
|
|
193794
193850
|
|
|
193795
|
-
export { Ammeter, AnalogAcSweepSimulation, AnalogAnalysisSimulation, AnalogDcOperatingPointSimulation, AnalogDcSweepSimulation, AnalogSimulation, AnalogSweepParameter, AnalogTransientSimulation, Antenna, AssemblyDevice, type AssemblyDeviceJsxProps, type AsyncEffect, type AutorouterCompleteEvent, type AutorouterErrorEvent, type AutorouterEvent, type AutorouterProgressEvent, type AutoroutingCacheDisabledReason, type AutoroutingCacheStatus, type AutoroutingEndEvent, type AutoroutingErrorEvent, type AutoroutingExecutionMetadata, AutoroutingPhase, type AutoroutingProgressEvent, type AutoroutingStartEvent, Battery, Board, Breakout, BreakoutPoint, Bus, CadAssembly, CadModel, Capacitor, Chip, Circuit, type CircuitJsonMetadata, type ComponentWithPins, Connector, Constraint, CopperPour, CopperText, CourtyardCircle, CourtyardOutline, CourtyardRect, Crystal, CurrentSource, Cutout, type DebugLogOutputEvent, DifferentialPair, Diode, DrcCheck, EnclosureCutoutAperture, EnclosureFdmBox, FabricationNoteDimension, FabricationNotePath, FabricationNoteRect, FabricationNoteText, Breakout as Fanout, BreakoutPoint as FanoutPoint, Fiducial, Footprint, Fuse, type GenericConnectionsAndSelectorsSel, type GenericLocalAutorouter, Group, Hole, type IIsolatedCircuit, type IRenderable, type IRootCircuit, Inductor, Interconnect, IsolatedCircuit, Jumper, Keepout, Led, type LocalCacheEngine, Mosfet, MountedBoard, Net, NetLabel, NormalComponent, type Obstacle, OpAmp, type PackingEndEvent, type PackingErrorEvent, type PackingStartEvent, Panel, type PcbGroupId, PcbNoteDimension, PcbNoteLine, PcbNotePath, PcbNoteRect, PcbNoteText, PcbTrace, PcbVia, PinHeader, type PinLabelSpec, Pinout, PlatedHole, Port, Potentiometer, PowerSource, PrimitiveComponent, Project, PushButton, type RenderPhase, type RenderPhaseFn, type RenderPhaseFunctions, type RenderPhaseStates, Renderable, Resistor, Resonator, RootCircuit, type RootCircuitEventName, SOLVERS, SchematicArc, SchematicBox, SchematicCell, SchematicCircle, SchematicGraphic, SchematicLine, SchematicPath, SchematicRect, SchematicRow, SchematicSection, SchematicSheet, SchematicSymbol, SchematicTable, SchematicText, type Sel, SilkscreenCircle, SilkscreenGraphic, SilkscreenLine, SilkscreenPath, SilkscreenRect, SilkscreenText, type SimpleRouteBounds, type SimpleRouteBus, type SimpleRouteBusTermination, type SimpleRouteConnection, type SimpleRouteDifferentialPair, type SimpleRouteJson, type SimpleRoutePoint, type SimplifiedPcbTrace, type SingleLayerConnectionPoint, SmtPad, SolderJumper, type SolverEndedEvent, type SolverName, type SolverStartedEvent, SpiceModel, type SrjConnectionName, Subcircuit, Subpanel, Switch, SymbolComponent as Symbol, TestPoint, Trace, TraceHint, Transistor, Via, VoltageProbe, VoltageSource, analog, applyEditEvents, applyEditEventsToManualEditsFile, applyPcbEditEventsToManualEditsFile, applySchematicEditEventsToManualEditsFile, assembly, createUseComponent, enclosure, getPhaseTimingsFromRenderEvents, getSimpleRouteJsonFromCircuitJson, normalizePinLabels, orderedRenderPhases, renderPhaseIndexMap, resolveStaticFileImport, sel, unrouteCircuitJson, useCapacitor, useChip, useDiode, useLed, useRenderedCircuit, useResistor };
|
|
193851
|
+
export { Ammeter, AnalogAcSweepSimulation, AnalogAnalysisSimulation, AnalogDcOperatingPointSimulation, AnalogDcSweepSimulation, AnalogSimulation, AnalogSweepParameter, AnalogTransientSimulation, Antenna, AssemblyDevice, type AssemblyDeviceJsxProps, AssemblyScreen, type AssemblyScreenJsxProps, type AsyncEffect, type AutorouterCompleteEvent, type AutorouterErrorEvent, type AutorouterEvent, type AutorouterProgressEvent, type AutoroutingCacheDisabledReason, type AutoroutingCacheStatus, type AutoroutingEndEvent, type AutoroutingErrorEvent, type AutoroutingExecutionMetadata, AutoroutingPhase, type AutoroutingProgressEvent, type AutoroutingStartEvent, Battery, Board, Breakout, BreakoutPoint, Bus, CadAssembly, CadModel, Capacitor, Chip, Circuit, type CircuitJsonMetadata, type ComponentWithPins, Connector, Constraint, CopperPour, CopperText, CourtyardCircle, CourtyardOutline, CourtyardRect, Crystal, CurrentSource, Cutout, type DebugLogOutputEvent, DifferentialPair, Diode, DrcCheck, EnclosureCutoutAperture, EnclosureFdmBox, FabricationNoteDimension, FabricationNotePath, FabricationNoteRect, FabricationNoteText, Breakout as Fanout, BreakoutPoint as FanoutPoint, Fiducial, Footprint, Fuse, type GenericConnectionsAndSelectorsSel, type GenericLocalAutorouter, Group, Hole, type IIsolatedCircuit, type IRenderable, type IRootCircuit, Inductor, Interconnect, IsolatedCircuit, Jumper, Keepout, Led, type LocalCacheEngine, Mosfet, MountedBoard, Net, NetLabel, NormalComponent, type Obstacle, OpAmp, type PackingEndEvent, type PackingErrorEvent, type PackingStartEvent, Panel, type PcbGroupId, PcbNoteDimension, PcbNoteLine, PcbNotePath, PcbNoteRect, PcbNoteText, PcbTrace, PcbVia, PinHeader, type PinLabelSpec, Pinout, PlatedHole, Port, Potentiometer, PowerSource, PrimitiveComponent, Project, PushButton, type RenderPhase, type RenderPhaseFn, type RenderPhaseFunctions, type RenderPhaseStates, Renderable, Resistor, Resonator, RootCircuit, type RootCircuitEventName, SOLVERS, SchematicArc, SchematicBox, SchematicCell, SchematicCircle, SchematicGraphic, SchematicLine, SchematicPath, SchematicRect, SchematicRow, SchematicSection, SchematicSheet, SchematicSymbol, SchematicTable, SchematicText, type Sel, SilkscreenCircle, SilkscreenGraphic, SilkscreenLine, SilkscreenPath, SilkscreenRect, SilkscreenText, type SimpleRouteBounds, type SimpleRouteBus, type SimpleRouteBusTermination, type SimpleRouteConnection, type SimpleRouteDifferentialPair, type SimpleRouteJson, type SimpleRoutePoint, type SimplifiedPcbTrace, type SingleLayerConnectionPoint, SmtPad, SolderJumper, type SolverEndedEvent, type SolverName, type SolverStartedEvent, SpiceModel, type SrjConnectionName, Subcircuit, Subpanel, Switch, SymbolComponent as Symbol, TestPoint, Trace, TraceHint, Transistor, Via, VoltageProbe, VoltageSource, analog, applyEditEvents, applyEditEventsToManualEditsFile, applyPcbEditEventsToManualEditsFile, applySchematicEditEventsToManualEditsFile, assembly, createUseComponent, enclosure, getPhaseTimingsFromRenderEvents, getSimpleRouteJsonFromCircuitJson, normalizePinLabels, orderedRenderPhases, renderPhaseIndexMap, resolveStaticFileImport, sel, unrouteCircuitJson, useCapacitor, useChip, useDiode, useLed, useRenderedCircuit, useResistor };
|
package/dist/index.js
CHANGED
|
@@ -17,6 +17,7 @@ __export(components_exports, {
|
|
|
17
17
|
AnalogTransientSimulation: () => AnalogTransientSimulation,
|
|
18
18
|
Antenna: () => Antenna,
|
|
19
19
|
AssemblyDevice: () => AssemblyDevice,
|
|
20
|
+
AssemblyScreen: () => AssemblyScreen,
|
|
20
21
|
AutoroutingPhase: () => AutoroutingPhase,
|
|
21
22
|
Battery: () => Battery,
|
|
22
23
|
Board: () => Board,
|
|
@@ -15849,6 +15850,24 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
|
|
|
15849
15850
|
})
|
|
15850
15851
|
});
|
|
15851
15852
|
}
|
|
15853
|
+
/**
|
|
15854
|
+
* The connector insertion axis as a continuous unit direction in Circuit
|
|
15855
|
+
* JSON's board-world XYZ frame (+Z above the board). This is a direction, not
|
|
15856
|
+
* a position, so it has no units or translation. It receives the same
|
|
15857
|
+
* rotation and layer flip as the footprint's pads.
|
|
15858
|
+
*/
|
|
15859
|
+
_getPcbComponentInsertionAxisDirection(componentLayer, rotationDegrees = this.getGlobalTransformRotation()) {
|
|
15860
|
+
const footprintMetadata = this._getFootprintMetadataForPcbComponent();
|
|
15861
|
+
if (!footprintMetadata?.insertionDirection) return void 0;
|
|
15862
|
+
return transformFootprintInsertionDirectionVector({
|
|
15863
|
+
insertionDirection: footprintMetadata.insertionDirection,
|
|
15864
|
+
rotationDegrees,
|
|
15865
|
+
isFlipped: isFootprintFlipped({
|
|
15866
|
+
componentLayer,
|
|
15867
|
+
originalLayer: footprintMetadata.originalLayer
|
|
15868
|
+
})
|
|
15869
|
+
});
|
|
15870
|
+
}
|
|
15852
15871
|
/**
|
|
15853
15872
|
* The enclosure aperture's outward axis as a continuous unit direction in
|
|
15854
15873
|
* board XYZ (+Z above the board). It is a direction, not a point, and receives
|
|
@@ -63442,7 +63461,7 @@ function Group_getRoutingPhasePlans(group) {
|
|
|
63442
63461
|
var package_default = {
|
|
63443
63462
|
name: "@tscircuit/core",
|
|
63444
63463
|
type: "module",
|
|
63445
|
-
version: "0.0.
|
|
63464
|
+
version: "0.0.1944",
|
|
63446
63465
|
types: "dist/index.d.ts",
|
|
63447
63466
|
main: "dist/index.js",
|
|
63448
63467
|
module: "dist/index.js",
|
|
@@ -75379,6 +75398,172 @@ var AssemblyDevice = class extends PrimitiveComponent2 {
|
|
|
75379
75398
|
// changing the authoring element or its assembly-container semantics.
|
|
75380
75399
|
};
|
|
75381
75400
|
|
|
75401
|
+
// lib/components/primitive-components/AssemblyScreen.ts
|
|
75402
|
+
import { assemblyScreenProps } from "@tscircuit/props";
|
|
75403
|
+
|
|
75404
|
+
// lib/components/primitive-components/AssemblyScreen_doInitialCadModelRender.ts
|
|
75405
|
+
import { normalizeDegrees as normalizeDegrees8 } from "@tscircuit/math-utils";
|
|
75406
|
+
|
|
75407
|
+
// lib/components/primitive-components/get-assembly-screen-target.ts
|
|
75408
|
+
import { selectAll as selectAll2 } from "css-select";
|
|
75409
|
+
var getAssemblyScreenTarget = (component, connectsTo) => {
|
|
75410
|
+
const rootComponent = component.root?.firstChild;
|
|
75411
|
+
if (!rootComponent) {
|
|
75412
|
+
throw new Error(
|
|
75413
|
+
`Could not resolve assembly.screen "${component.name}" because the circuit has no root component`
|
|
75414
|
+
);
|
|
75415
|
+
}
|
|
75416
|
+
let selectionScope = rootComponent;
|
|
75417
|
+
let ancestor = component.parent;
|
|
75418
|
+
while (ancestor) {
|
|
75419
|
+
if (ancestor.componentName === "AssemblyDevice") {
|
|
75420
|
+
selectionScope = ancestor;
|
|
75421
|
+
break;
|
|
75422
|
+
}
|
|
75423
|
+
ancestor = ancestor.parent;
|
|
75424
|
+
}
|
|
75425
|
+
const matches = selectAll2(
|
|
75426
|
+
preprocessSelector(connectsTo, component),
|
|
75427
|
+
selectionScope,
|
|
75428
|
+
{ adapter: cssSelectPrimitiveComponentAdapter }
|
|
75429
|
+
);
|
|
75430
|
+
if (matches.length !== 1) {
|
|
75431
|
+
throw new Error(
|
|
75432
|
+
`assembly.screen "${component.name}" connectsTo selector "${connectsTo}" matched ${matches.length} components; expected exactly one`
|
|
75433
|
+
);
|
|
75434
|
+
}
|
|
75435
|
+
const target = matches[0];
|
|
75436
|
+
if (!target.pcb_component_id) {
|
|
75437
|
+
throw new Error(
|
|
75438
|
+
`assembly.screen "${component.name}" connectsTo selector "${connectsTo}" matched ${target.getString()}, but it has no PCB component`
|
|
75439
|
+
);
|
|
75440
|
+
}
|
|
75441
|
+
return target;
|
|
75442
|
+
};
|
|
75443
|
+
|
|
75444
|
+
// lib/components/primitive-components/AssemblyScreen_doInitialCadModelRender.ts
|
|
75445
|
+
var formatMillimetersForModelprinter = (millimeters) => Number(millimeters.toFixed(6)).toString();
|
|
75446
|
+
var getDefaultFlexScreenModel = (component) => {
|
|
75447
|
+
const { width, height } = component._parsedProps;
|
|
75448
|
+
if (width === void 0 || height === void 0) {
|
|
75449
|
+
throw new Error(
|
|
75450
|
+
`assembly.screen "${component.name}" requires both width and height when cadModel is omitted`
|
|
75451
|
+
);
|
|
75452
|
+
}
|
|
75453
|
+
return `flexscreen_w${formatMillimetersForModelprinter(width)}mm_h${formatMillimetersForModelprinter(height)}mm`;
|
|
75454
|
+
};
|
|
75455
|
+
var AssemblyScreen_doInitialCadModelRender = (component) => {
|
|
75456
|
+
const root = component.root;
|
|
75457
|
+
if (!root || root.pcbDisabled || !component.source_component_id || !component.pcb_component_id) {
|
|
75458
|
+
return;
|
|
75459
|
+
}
|
|
75460
|
+
const { db } = root;
|
|
75461
|
+
const props = component._parsedProps;
|
|
75462
|
+
const target = getAssemblyScreenTarget(component, props.connectsTo);
|
|
75463
|
+
const targetPcbComponent = db.pcb_component.get(target.pcb_component_id);
|
|
75464
|
+
if (!targetPcbComponent) {
|
|
75465
|
+
throw new Error(
|
|
75466
|
+
`assembly.screen "${component.name}" could not read the PCB component selected by "${props.connectsTo}"`
|
|
75467
|
+
);
|
|
75468
|
+
}
|
|
75469
|
+
const board = target._getBoard();
|
|
75470
|
+
if (!board) {
|
|
75471
|
+
throw new Error(
|
|
75472
|
+
`assembly.screen "${component.name}" target "${props.connectsTo}" is not on a board`
|
|
75473
|
+
);
|
|
75474
|
+
}
|
|
75475
|
+
const pcbBoard = board.pcb_board_id ? db.pcb_board.get(board.pcb_board_id) : null;
|
|
75476
|
+
const boardThickness = pcbBoard?.thickness ?? board.boardThickness;
|
|
75477
|
+
const layer = targetPcbComponent.layer === "bottom" ? "bottom" : "top";
|
|
75478
|
+
const isBottomLayer = layer === "bottom";
|
|
75479
|
+
const targetRotation = targetPcbComponent.rotation ?? 0;
|
|
75480
|
+
const insertionAxis = target instanceof NormalComponent3 ? target._getPcbComponentInsertionAxisDirection(layer, targetRotation) : void 0;
|
|
75481
|
+
const insertionAxisLength = insertionAxis ? Math.hypot(insertionAxis.x, insertionAxis.y) : 0;
|
|
75482
|
+
const cableInsertionCenter = targetPcbComponent.cable_insertion_center ?? targetPcbComponent.center;
|
|
75483
|
+
const inferredCableAxis = {
|
|
75484
|
+
x: cableInsertionCenter.x - targetPcbComponent.center.x,
|
|
75485
|
+
y: cableInsertionCenter.y - targetPcbComponent.center.y
|
|
75486
|
+
};
|
|
75487
|
+
const inferredCableAxisLength = Math.hypot(
|
|
75488
|
+
inferredCableAxis.x,
|
|
75489
|
+
inferredCableAxis.y
|
|
75490
|
+
);
|
|
75491
|
+
const screenBoardRotation = normalizeDegrees8(
|
|
75492
|
+
insertionAxis && insertionAxisLength > 1e-9 ? Math.atan2(-insertionAxis.x, insertionAxis.y) * 180 / Math.PI : inferredCableAxisLength > 1e-9 ? Math.atan2(-inferredCableAxis.x, inferredCableAxis.y) * 180 / Math.PI : targetRotation
|
|
75493
|
+
);
|
|
75494
|
+
db.pcb_component.update(component.pcb_component_id, {
|
|
75495
|
+
center: cableInsertionCenter,
|
|
75496
|
+
layer,
|
|
75497
|
+
rotation: screenBoardRotation,
|
|
75498
|
+
subcircuit_id: targetPcbComponent.subcircuit_id
|
|
75499
|
+
});
|
|
75500
|
+
const cadComponent = db.cad_component.insert({
|
|
75501
|
+
position: {
|
|
75502
|
+
x: cableInsertionCenter.x,
|
|
75503
|
+
y: cableInsertionCenter.y,
|
|
75504
|
+
z: isBottomLayer ? -boardThickness / 2 : boardThickness / 2
|
|
75505
|
+
},
|
|
75506
|
+
rotation: {
|
|
75507
|
+
x: 0,
|
|
75508
|
+
y: isBottomLayer ? 180 : 0,
|
|
75509
|
+
z: normalizeDegrees8(
|
|
75510
|
+
isBottomLayer ? -screenBoardRotation : screenBoardRotation
|
|
75511
|
+
)
|
|
75512
|
+
},
|
|
75513
|
+
pcb_component_id: component.pcb_component_id,
|
|
75514
|
+
source_component_id: component.source_component_id,
|
|
75515
|
+
subcircuit_id: targetPcbComponent.subcircuit_id,
|
|
75516
|
+
footprinter_string: props.cadModel ?? getDefaultFlexScreenModel(component),
|
|
75517
|
+
model_unit_to_mm_scale_factor: 1,
|
|
75518
|
+
model_object_fit: "contain_within_bounds",
|
|
75519
|
+
model_origin_position: { x: 0, y: 0, z: 0 },
|
|
75520
|
+
anchor_alignment: "center",
|
|
75521
|
+
show_as_translucent_model: false
|
|
75522
|
+
});
|
|
75523
|
+
component.cad_component_id = cadComponent.cad_component_id;
|
|
75524
|
+
};
|
|
75525
|
+
|
|
75526
|
+
// lib/components/primitive-components/AssemblyScreen.ts
|
|
75527
|
+
var AssemblyScreen = class extends PrimitiveComponent2 {
|
|
75528
|
+
isAssemblyDeviceContainer = true;
|
|
75529
|
+
get config() {
|
|
75530
|
+
return {
|
|
75531
|
+
componentName: "AssemblyScreen",
|
|
75532
|
+
zodProps: assemblyScreenProps
|
|
75533
|
+
};
|
|
75534
|
+
}
|
|
75535
|
+
doInitialAssignNameToUnnamedComponents() {
|
|
75536
|
+
if (this._parsedProps.name) return;
|
|
75537
|
+
throw new Error("assembly.screen requires a non-empty name");
|
|
75538
|
+
}
|
|
75539
|
+
doInitialSourceRender() {
|
|
75540
|
+
const sourceComponent = this.root.db.source_component.insert({
|
|
75541
|
+
ftype: "simple_chip",
|
|
75542
|
+
name: this.name
|
|
75543
|
+
});
|
|
75544
|
+
this.source_component_id = sourceComponent.source_component_id;
|
|
75545
|
+
}
|
|
75546
|
+
doInitialPcbComponentRender() {
|
|
75547
|
+
const root = this.root;
|
|
75548
|
+
if (!root || root.pcbDisabled || !this.source_component_id) return;
|
|
75549
|
+
const pcbComponent = root.db.pcb_component.insert({
|
|
75550
|
+
center: { x: 0, y: 0 },
|
|
75551
|
+
width: 0,
|
|
75552
|
+
height: 0,
|
|
75553
|
+
layer: "top",
|
|
75554
|
+
rotation: 0,
|
|
75555
|
+
source_component_id: this.source_component_id,
|
|
75556
|
+
obstructs_within_bounds: false,
|
|
75557
|
+
do_not_place: true,
|
|
75558
|
+
is_allowed_to_be_off_board: true
|
|
75559
|
+
});
|
|
75560
|
+
this.pcb_component_id = pcbComponent.pcb_component_id;
|
|
75561
|
+
}
|
|
75562
|
+
doInitialCadModelRender() {
|
|
75563
|
+
AssemblyScreen_doInitialCadModelRender(this);
|
|
75564
|
+
}
|
|
75565
|
+
};
|
|
75566
|
+
|
|
75382
75567
|
// lib/components/primitive-components/EnclosureCutoutAperture/EnclosureCutoutAperture.ts
|
|
75383
75568
|
import { enclosureCutoutApertureProps } from "@tscircuit/props";
|
|
75384
75569
|
|
|
@@ -77798,7 +77983,8 @@ var analog = {
|
|
|
77798
77983
|
|
|
77799
77984
|
// lib/namespaced-elements/assembly.ts
|
|
77800
77985
|
var assembly = {
|
|
77801
|
-
device: createNamespacedElement("assembly.device")
|
|
77986
|
+
device: createNamespacedElement("assembly.device"),
|
|
77987
|
+
screen: createNamespacedElement("assembly.screen")
|
|
77802
77988
|
};
|
|
77803
77989
|
|
|
77804
77990
|
// lib/namespaced-elements/enclosure.ts
|
|
@@ -78038,6 +78224,7 @@ import { kicadFootprintStrings } from "@tscircuit/props";
|
|
|
78038
78224
|
extendCatalogue(components_exports);
|
|
78039
78225
|
extendCatalogue({
|
|
78040
78226
|
"assembly.device": AssemblyDevice,
|
|
78227
|
+
"assembly.screen": AssemblyScreen,
|
|
78041
78228
|
Bug: Chip,
|
|
78042
78229
|
"enclosure.cutoutaperture": EnclosureCutoutAperture,
|
|
78043
78230
|
"enclosure.fdm.box": EnclosureFdmBox,
|
|
@@ -78058,6 +78245,7 @@ export {
|
|
|
78058
78245
|
AnalogTransientSimulation,
|
|
78059
78246
|
Antenna,
|
|
78060
78247
|
AssemblyDevice,
|
|
78248
|
+
AssemblyScreen,
|
|
78061
78249
|
AutoroutingPhase,
|
|
78062
78250
|
Battery,
|
|
78063
78251
|
Board,
|