jscad-electronics 0.0.151 → 0.0.153

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/README.md CHANGED
@@ -71,6 +71,41 @@ Most components accept parameters for customization. For example:
71
71
 
72
72
  Refer to the individual component files for available customization options.
73
73
 
74
+ ### Flexible screens
75
+
76
+ `FlexScreen` combines a parameterized display with an FPC cable. Screen size
77
+ can be supplied directly or derived from a diagonal and aspect ratio, and the
78
+ built-in mounting presets place the display above, below, or at a right angle
79
+ to the board plane.
80
+
81
+ ```tsx
82
+ import { FlexScreen } from "jscad-electronics"
83
+
84
+ <FlexScreen
85
+ diagonal={50}
86
+ aspectRatio="16:9"
87
+ orientation="foldedToFaceBelowBoard"
88
+ flexCableLength={38}
89
+ flexCableWidth={10}
90
+ conductorCount={10}
91
+ distanceBelowBoard={9}
92
+ foldDistanceFromConnector={8}
93
+ foldOutset={5}
94
+ />
95
+ ```
96
+
97
+ Use `sitsFlat` when the display and cable continue in the same direction.
98
+ `foldedToFaceAboveBoard` and `foldedToFaceBelowBoard` create true 180-degree
99
+ folds, while `foldedToRightAngleAboveBoard` and
100
+ `foldedToRightAngleBelowBoard` create 90-degree bends. The downward 180-degree
101
+ fold starts on top of the board and turns over its edge.
102
+
103
+ For 180-degree folds, `distanceAboveBoard` or `distanceBelowBoard` sets the
104
+ final screen backplane independently of `foldDistanceFromConnector` and
105
+ `foldOutset`, which control where the loop begins and how far it projects past
106
+ the board edge. Every orientation is also available as a boolean shortcut, for
107
+ example `<FlexScreen sitsFlat />` or `<FlexScreen foldsBelowBoard />`.
108
+
74
109
  ## Integration with tscircuit
75
110
 
76
111
  jscad-electronics is designed to work seamlessly with tscircuit. You can use these 3D models in your tscircuit projects to create accurate 3D representations of your PCB designs just by
package/dist/index.d.ts CHANGED
@@ -590,6 +590,111 @@ interface ScreenProps {
590
590
  declare const Screen: ({ width, height, thickness, bezelInset, bezelDepth, screenColor, bezelColor, screenWidth, screenHeight, offset, }: ScreenProps) => react_jsx_runtime.JSX.Element;
591
591
  declare const Display: ({ width, height, thickness, bezelInset, bezelDepth, screenColor, bezelColor, screenWidth, screenHeight, offset, }: ScreenProps) => react_jsx_runtime.JSX.Element;
592
592
 
593
+ type Rotation3 = [number | string, number | string, number | string];
594
+ type FlexScreenOrientation = "sitsFlat" | "sitsFlatBelowBoard" | "foldedToFaceAboveBoard" | "foldedToFaceBelowBoard" | "foldedToRightAngleAboveBoard" | "foldedToRightAngleBelowBoard";
595
+ type FlexScreenAspectRatio = number | `${number}:${number}` | readonly [number, number];
596
+ interface FlexScreenProps {
597
+ /** Explicit screen width. If height is omitted, it is derived from the ratio. */
598
+ width?: number;
599
+ /** Explicit screen height. If width is omitted, it is derived from the ratio. */
600
+ height?: number;
601
+ /** Screen diagonal. Used with the ratio unless one other dimension is supplied. */
602
+ diagonal?: number;
603
+ /** Width-to-height ratio. Accepts 1.777, "16:9", or [16, 9]. */
604
+ aspectRatio?: FlexScreenAspectRatio;
605
+ /** Alias for aspectRatio. aspectRatio takes precedence when both are supplied. */
606
+ ratio?: FlexScreenAspectRatio;
607
+ /** Diagonal used when width, height, and diagonal are all omitted. */
608
+ defaultDiagonal?: number;
609
+ orientation?: FlexScreenOrientation;
610
+ /** Boolean orientation shortcuts for footprint/configuration builders. */
611
+ sitsFlat?: boolean;
612
+ sitsFlatBelowBoard?: boolean;
613
+ foldedToFaceAboveBoard?: boolean;
614
+ foldedToFaceBelowBoard?: boolean;
615
+ /** Concise aliases for the 180-degree face-above/face-below folds. */
616
+ foldsAboveBoard?: boolean;
617
+ foldsBelowBoard?: boolean;
618
+ foldedToRightAngleAboveBoard?: boolean;
619
+ foldedToRightAngleBelowBoard?: boolean;
620
+ screenThickness?: number;
621
+ bezelInset?: number;
622
+ bezelDepth?: number;
623
+ activeAreaWidth?: number;
624
+ activeAreaHeight?: number;
625
+ screenColor?: string;
626
+ bezelColor?: string;
627
+ showScreen?: boolean;
628
+ /** Centerline length of the modeled cable route. */
629
+ flexCableLength?: number;
630
+ flexCableWidth?: number;
631
+ flexCableThickness?: number;
632
+ flexCableColor?: string;
633
+ conductorCount?: number;
634
+ conductorPitch?: number;
635
+ conductorWidth?: number;
636
+ conductorThickness?: number;
637
+ conductorColor?: string;
638
+ cableEdgeMargin?: number;
639
+ exposedContactLength?: number;
640
+ showConductors?: boolean;
641
+ showFlexCable?: boolean;
642
+ showStiffeners?: boolean;
643
+ stiffenerLength?: number;
644
+ stiffenerThickness?: number;
645
+ stiffenerColor?: string;
646
+ /** Radius of the 90-degree cable bend in right-angle presets. */
647
+ bendRadius?: number;
648
+ /** Number of straight segments used to approximate a 90-degree bend. */
649
+ bendSegments?: number;
650
+ /** Straight cable length after the bend before the screen attachment. */
651
+ rightAngleVerticalLead?: number;
652
+ /** Screen backplane distance above the board for a 180-degree upward fold. */
653
+ distanceAboveBoard?: number;
654
+ /** Screen backplane distance below the board for a 180-degree downward fold. */
655
+ distanceBelowBoard?: number;
656
+ /** Straight distance from the connector to the start of a 180-degree fold. */
657
+ foldDistanceFromConnector?: number;
658
+ /** Maximum distance the 180-degree loop extends beyond the fold start. */
659
+ foldOutset?: number;
660
+ /** Number of straight segments used to approximate a 180-degree fold. */
661
+ foldSegments?: number;
662
+ screenGap?: number;
663
+ /** Board reference used to place above/below presets. The board is not rendered. */
664
+ boardTopZ?: number;
665
+ boardThickness?: number;
666
+ boardClearance?: number;
667
+ cableStartX?: number;
668
+ cableStartY?: number;
669
+ /** Overrides the preset-derived cable centerline Z at the connector end. */
670
+ cableStartZ?: number;
671
+ cableLateralOffset?: number;
672
+ /** Added after the orientation preset computes the screen attachment pose. */
673
+ screenOffset?: {
674
+ x?: number;
675
+ y?: number;
676
+ z?: number;
677
+ };
678
+ /** Replaces the orientation preset's screen rotation. */
679
+ screenRotation?: Rotation3;
680
+ /** Rotates the complete assembly around its cable origin. */
681
+ rotation?: Rotation3;
682
+ /** Translates the complete assembly after rotation. */
683
+ offset?: {
684
+ x?: number;
685
+ y?: number;
686
+ z?: number;
687
+ };
688
+ }
689
+ interface ResolvedFlexScreenSize {
690
+ width: number;
691
+ height: number;
692
+ diagonal: number;
693
+ aspectRatio: number;
694
+ }
695
+ declare const resolveFlexScreenSize: ({ width, height, diagonal, aspectRatio, ratio, defaultDiagonal, }: Pick<FlexScreenProps, "width" | "height" | "diagonal" | "aspectRatio" | "ratio" | "defaultDiagonal">) => ResolvedFlexScreenSize;
696
+ declare const FlexScreen: (props: FlexScreenProps) => react_jsx_runtime.JSX.Element;
697
+
593
698
  interface JSTZH1_5mmProps {
594
699
  numPins?: number;
595
700
  showPins?: boolean;
@@ -886,4 +991,4 @@ interface GullWingBodyProps {
886
991
  */
887
992
  declare const GullWingBody: ({ bodyWidth, bodyLength, bodyHeight, pads, leadThickness, leadHeightRatio, }: GullWingBodyProps) => react_jsx_runtime.JSX.Element;
888
993
 
889
- export { A01005, A0201, A0402, A0603, A0805, A1206, A1210, A2010, A2512, AxialCapacitor, BGA, ChipBody, type ChipBodyProps, Crystal, type CrystalProps, DFN, DPAK, type DPAKProps, Display, ElectrolyticCapacitor, type ElectrolyticCapacitorProps, ExtrudedPads, FPC, type FPCProps, FemaleHeader, FemaleHeaderRow, FootprintPad, FootprintPlatedHole, Footprinter3d, GullWingBody, type GullWingBodyProps, HC49, type HC49Props, JSTPH2_0mm, JSTZH1_5mm, LQFP, Led2835, type Led2835Props, Led5050, type Led5050Props, MELF, type MELFProps, MINIMELF, type MINIMELFProps, MS012, MS013, MSOP, MicroMELF, type MicroMELFProps, MountedPcbModule, PinHeader, PinRow, Potentiometer, type PotentiometerLead, type PotentiometerProps, QFN, QFP, RJ45, type RJ45Props, SMA, SMB, SMC, SMF, SOD123, SOD123F, SOD123FL, type SOD123Props, SOD123W, type SOD123WProps, SOD128, SOD323, SOD323F, SOD323FL, SOD523, SOD723, SOD882, SOD923, SOT223, type SOT223Props, SOT233P, SOT23W, SOT323, SOT363, SOT457, SOT563, SOT723, SOT886, SOT963, Screen, type ScreenProps, SmdChipLead, type SmdChipLeadProps, type SmdLeadPad, SmdPinHeader, type SmdPinHeaderProps, SmdPushButton, type SmdPushButtonProps, StampBoard, TO220, type TO220Lead, type TO220Props, TO92, type TO92Lead, type TO92Props, TQFP, Tssop, VSSOP };
994
+ export { A01005, A0201, A0402, A0603, A0805, A1206, A1210, A2010, A2512, AxialCapacitor, BGA, ChipBody, type ChipBodyProps, Crystal, type CrystalProps, DFN, DPAK, type DPAKProps, Display, ElectrolyticCapacitor, type ElectrolyticCapacitorProps, ExtrudedPads, FPC, type FPCProps, FemaleHeader, FemaleHeaderRow, FlexScreen, type FlexScreenAspectRatio, type FlexScreenOrientation, type FlexScreenProps, FootprintPad, FootprintPlatedHole, Footprinter3d, GullWingBody, type GullWingBodyProps, HC49, type HC49Props, JSTPH2_0mm, JSTZH1_5mm, LQFP, Led2835, type Led2835Props, Led5050, type Led5050Props, MELF, type MELFProps, MINIMELF, type MINIMELFProps, MS012, MS013, MSOP, MicroMELF, type MicroMELFProps, MountedPcbModule, PinHeader, PinRow, Potentiometer, type PotentiometerLead, type PotentiometerProps, QFN, QFP, RJ45, type RJ45Props, type ResolvedFlexScreenSize, SMA, SMB, SMC, SMF, SOD123, SOD123F, SOD123FL, type SOD123Props, SOD123W, type SOD123WProps, SOD128, SOD323, SOD323F, SOD323FL, SOD523, SOD723, SOD882, SOD923, SOT223, type SOT223Props, SOT233P, SOT23W, SOT323, SOT363, SOT457, SOT563, SOT723, SOT886, SOT963, Screen, type ScreenProps, SmdChipLead, type SmdChipLeadProps, type SmdLeadPad, SmdPinHeader, type SmdPinHeaderProps, SmdPushButton, type SmdPushButtonProps, StampBoard, TO220, type TO220Lead, type TO220Props, TO92, type TO92Lead, type TO92Props, TQFP, Tssop, VSSOP, resolveFlexScreenSize };