@thangdevalone/meeting-grid-layout-core 1.4.1 → 1.5.0

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.cjs CHANGED
@@ -312,7 +312,7 @@ function createFlexiblePinGrid(options) {
312
312
  bestOthersW = W * 0.35;
313
313
  othersAreaWidth = bestOthersW;
314
314
  othersAreaHeight = areaH;
315
- mainWidth = W - othersAreaWidth - gap * 2;
315
+ mainWidth = W - othersAreaWidth - gap * 3;
316
316
  mainHeight = areaH;
317
317
  }
318
318
  const mainItemWidth = mainWidth;
@@ -773,6 +773,8 @@ function createMeetGrid(options) {
773
773
  }
774
774
  if (count === 2) {
775
775
  const { width: W, height: H } = options.dimensions;
776
+ const floatIdx = options.pipIndex !== void 0 && options.pipIndex >= 0 && options.pipIndex < 2 ? options.pipIndex : 1;
777
+ const mainIdx = floatIdx === 0 ? 1 : 0;
776
778
  const mainWidth = W;
777
779
  const mainHeight = H;
778
780
  let floatW;
@@ -787,16 +789,16 @@ function createMeetGrid(options) {
787
789
  floatH = options.floatHeight ?? (isMobileSize ? 175 : 240);
788
790
  }
789
791
  const pagination2 = createDefaultPagination(2);
790
- const getItemDimensions2 = (index) => index === 0 ? { width: mainWidth, height: mainHeight } : { width: floatW, height: floatH };
792
+ const getItemDimensions2 = (index) => index === mainIdx ? { width: mainWidth, height: mainHeight } : { width: floatW, height: floatH };
791
793
  return {
792
794
  width: mainWidth,
793
795
  height: mainHeight,
794
796
  rows: 1,
795
797
  cols: 1,
796
798
  layoutMode: "gallery",
797
- getPosition: (index) => index === 0 ? { top: 0, left: 0 } : { top: -9999, left: -9999 },
799
+ getPosition: (index) => index === mainIdx ? { top: 0, left: 0 } : { top: -9999, left: -9999 },
798
800
  getItemDimensions: getItemDimensions2,
799
- isMainItem: (index) => index === 0,
801
+ isMainItem: (index) => index === mainIdx,
800
802
  pagination: pagination2,
801
803
  isItemVisible: () => true,
802
804
  hiddenCount: 0,
@@ -806,7 +808,7 @@ function createMeetGrid(options) {
806
808
  options.itemAspectRatios,
807
809
  options.aspectRatio
808
810
  ),
809
- floatIndex: 1,
811
+ floatIndex: floatIdx,
810
812
  floatDimensions: { width: floatW, height: floatH }
811
813
  };
812
814
  }
package/dist/index.d.cts CHANGED
@@ -103,6 +103,12 @@ interface MeetGridOptions extends GridOptions {
103
103
  * ]
104
104
  */
105
105
  floatBreakpoints?: PipBreakpoint[];
106
+ /**
107
+ * Index of the participant to show as the floating PiP in 2-person mode.
108
+ * The other participant will fill the main area.
109
+ * @default 1 (second participant)
110
+ */
111
+ pipIndex?: number;
106
112
  }
107
113
  /**
108
114
  * Pagination info returned with grid result
package/dist/index.d.mts CHANGED
@@ -103,6 +103,12 @@ interface MeetGridOptions extends GridOptions {
103
103
  * ]
104
104
  */
105
105
  floatBreakpoints?: PipBreakpoint[];
106
+ /**
107
+ * Index of the participant to show as the floating PiP in 2-person mode.
108
+ * The other participant will fill the main area.
109
+ * @default 1 (second participant)
110
+ */
111
+ pipIndex?: number;
106
112
  }
107
113
  /**
108
114
  * Pagination info returned with grid result
package/dist/index.d.ts CHANGED
@@ -103,6 +103,12 @@ interface MeetGridOptions extends GridOptions {
103
103
  * ]
104
104
  */
105
105
  floatBreakpoints?: PipBreakpoint[];
106
+ /**
107
+ * Index of the participant to show as the floating PiP in 2-person mode.
108
+ * The other participant will fill the main area.
109
+ * @default 1 (second participant)
110
+ */
111
+ pipIndex?: number;
106
112
  }
107
113
  /**
108
114
  * Pagination info returned with grid result
package/dist/index.mjs CHANGED
@@ -310,7 +310,7 @@ function createFlexiblePinGrid(options) {
310
310
  bestOthersW = W * 0.35;
311
311
  othersAreaWidth = bestOthersW;
312
312
  othersAreaHeight = areaH;
313
- mainWidth = W - othersAreaWidth - gap * 2;
313
+ mainWidth = W - othersAreaWidth - gap * 3;
314
314
  mainHeight = areaH;
315
315
  }
316
316
  const mainItemWidth = mainWidth;
@@ -771,6 +771,8 @@ function createMeetGrid(options) {
771
771
  }
772
772
  if (count === 2) {
773
773
  const { width: W, height: H } = options.dimensions;
774
+ const floatIdx = options.pipIndex !== void 0 && options.pipIndex >= 0 && options.pipIndex < 2 ? options.pipIndex : 1;
775
+ const mainIdx = floatIdx === 0 ? 1 : 0;
774
776
  const mainWidth = W;
775
777
  const mainHeight = H;
776
778
  let floatW;
@@ -785,16 +787,16 @@ function createMeetGrid(options) {
785
787
  floatH = options.floatHeight ?? (isMobileSize ? 175 : 240);
786
788
  }
787
789
  const pagination2 = createDefaultPagination(2);
788
- const getItemDimensions2 = (index) => index === 0 ? { width: mainWidth, height: mainHeight } : { width: floatW, height: floatH };
790
+ const getItemDimensions2 = (index) => index === mainIdx ? { width: mainWidth, height: mainHeight } : { width: floatW, height: floatH };
789
791
  return {
790
792
  width: mainWidth,
791
793
  height: mainHeight,
792
794
  rows: 1,
793
795
  cols: 1,
794
796
  layoutMode: "gallery",
795
- getPosition: (index) => index === 0 ? { top: 0, left: 0 } : { top: -9999, left: -9999 },
797
+ getPosition: (index) => index === mainIdx ? { top: 0, left: 0 } : { top: -9999, left: -9999 },
796
798
  getItemDimensions: getItemDimensions2,
797
- isMainItem: (index) => index === 0,
799
+ isMainItem: (index) => index === mainIdx,
798
800
  pagination: pagination2,
799
801
  isItemVisible: () => true,
800
802
  hiddenCount: 0,
@@ -804,7 +806,7 @@ function createMeetGrid(options) {
804
806
  options.itemAspectRatios,
805
807
  options.aspectRatio
806
808
  ),
807
- floatIndex: 1,
809
+ floatIndex: floatIdx,
808
810
  floatDimensions: { width: floatW, height: floatH }
809
811
  };
810
812
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thangdevalone/meeting-grid-layout-core",
3
- "version": "1.4.1",
3
+ "version": "1.5.0",
4
4
  "description": "Core grid calculation logic for meeting-grid-layout",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",