@@ -522,20 +522,6 @@ function getAlignmentAxis(placement: Placement): Axis {
522522 return getOppositeAxis ( getSideAxis ( placement ) ) ;
523523}
524524
525- /**
526- * Gets an array of alternative placements for fallback positioning.
527- * @param placement - The initial placement to expand
528- * @returns Array of alternative placements including opposite alignments
529- */
530- function getExpandedPlacements ( placement : Placement ) : Placement [ ] {
531- const oppositePlacement = getOppositePlacement ( placement ) ;
532- return [
533- getOppositeAlignmentPlacement ( placement ) ,
534- oppositePlacement ,
535- getOppositeAlignmentPlacement ( oppositePlacement ) ,
536- ] ;
537- }
538-
539525/**
540526 * Flips the alignment portion of a placement (start ↔ end).
541527 * @param placement - The placement string to flip alignment for
@@ -557,36 +543,25 @@ function getOppositePlacement<T extends string>(placement: T): T {
557543}
558544
559545/**
560- * Expands a partial padding object to include all sides with defaults .
561- * @param padding - The partial padding object
562- * @returns Complete padding object with all sides
546+ * Converts padding value to a complete side object .
547+ * @param padding - The padding value (number or partial side object)
548+ * @returns Complete side object with padding for all sides
563549 */
564- function expandPaddingObject ( padding : Partial < SideObject > ) : SideObject {
565- return {
550+ function getPaddingObject ( padding : Padding ) : SideObject {
551+ return typeof padding !== 'number' ? {
566552 top : 0 ,
567553 right : 0 ,
568554 bottom : 0 ,
569555 left : 0 ,
570556 ...padding ,
557+ } : {
558+ top : padding ,
559+ right : padding ,
560+ bottom : padding ,
561+ left : padding ,
571562 } ;
572563}
573564
574- /**
575- * Converts padding value to a complete side object.
576- * @param padding - The padding value (number or partial side object)
577- * @returns Complete side object with padding for all sides
578- */
579- function getPaddingObject ( padding : Padding ) : SideObject {
580- return typeof padding !== 'number' ?
581- expandPaddingObject ( padding )
582- : {
583- top : padding ,
584- right : padding ,
585- bottom : padding ,
586- left : padding ,
587- } ;
588- }
589-
590565/**
591566 * Converts a basic rect to a client rect object with all sides.
592567 * @param rect - The basic rect with x, y, width, height
@@ -961,8 +936,6 @@ function computeCoordsFromPlacement(
961936 * Computes the `x` and `y` coordinates that will place the floating element
962937 * next to a given reference element.
963938 *
964- * This is the core implementation without platform-specific caching.
965- * Internal use only - external code should use the exported computePosition.
966939 * @param reference - The reference element
967940 * @param floating - The floating element
968941 * @param config - Configuration options
@@ -1089,7 +1062,14 @@ function calculatePosition(
10891062 const placements = fallbackPlacements || (
10901063 isBasePlacement ?
10911064 [ getOppositePlacement ( initialPlacement ) ]
1092- : getExpandedPlacements ( initialPlacement )
1065+ : ( ( ) => {
1066+ const oppositePlacement = getOppositePlacement ( initialPlacement ) ;
1067+ return [
1068+ getOppositeAlignmentPlacement ( initialPlacement ) ,
1069+ oppositePlacement ,
1070+ getOppositeAlignmentPlacement ( oppositePlacement ) ,
1071+ ] ;
1072+ } ) ( )
10931073 ) ;
10941074 const allPlacements = [ initialPlacement , ...placements ] ;
10951075 const nextIndex = resetCount + 1 ;
0 commit comments