@thangdevalone/meet-layout-grid-core 1.1.1 → 1.2.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 +247 -392
- package/dist/index.d.cts +18 -87
- package/dist/index.d.mts +18 -87
- package/dist/index.d.ts +18 -87
- package/dist/index.mjs +248 -391
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -14,11 +14,10 @@ interface Position {
|
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
16
|
* Layout modes for the grid
|
|
17
|
-
* - gallery:
|
|
17
|
+
* - gallery: Flexible grid that fills all available space. Supports pin mode with pinnedIndex.
|
|
18
18
|
* - spotlight: Single participant in focus, others hidden
|
|
19
|
-
* - sidebar: Main view with thumbnail strip on the side (use sidebarPosition for top/bottom/left/right)
|
|
20
19
|
*/
|
|
21
|
-
type LayoutMode = 'gallery' | 'spotlight'
|
|
20
|
+
type LayoutMode = 'gallery' | 'spotlight';
|
|
22
21
|
/**
|
|
23
22
|
* Options for creating a basic grid
|
|
24
23
|
*/
|
|
@@ -35,49 +34,31 @@ interface GridOptions {
|
|
|
35
34
|
/**
|
|
36
35
|
* Aspect ratio configuration for individual items
|
|
37
36
|
* - string: Custom ratio like "16:9", "9:16", "4:3", "1:1"
|
|
38
|
-
* - 'fill': Stretch to fill the entire cell (useful for whiteboard)
|
|
39
37
|
* - 'auto': Use actual content dimensions (requires callback)
|
|
40
38
|
*/
|
|
41
|
-
type ItemAspectRatio = string | '
|
|
42
|
-
/**
|
|
43
|
-
* Flex layout item info for variable-sized cells
|
|
44
|
-
*/
|
|
45
|
-
interface FlexItemInfo {
|
|
46
|
-
/** Item index */
|
|
47
|
-
index: number;
|
|
48
|
-
/** Width of this item's cell */
|
|
49
|
-
width: number;
|
|
50
|
-
/** Height of this item's cell */
|
|
51
|
-
height: number;
|
|
52
|
-
/** Left position */
|
|
53
|
-
left: number;
|
|
54
|
-
/** Top position */
|
|
55
|
-
top: number;
|
|
56
|
-
/** Row this item belongs to */
|
|
57
|
-
row: number;
|
|
58
|
-
/** Width weight factor (based on aspect ratio) */
|
|
59
|
-
widthFactor: number;
|
|
60
|
-
}
|
|
39
|
+
type ItemAspectRatio = string | 'auto';
|
|
61
40
|
/**
|
|
62
41
|
* Extended options for meet-style grid with layout modes
|
|
63
42
|
*/
|
|
64
43
|
interface MeetGridOptions extends GridOptions {
|
|
65
44
|
/** Layout mode for the grid */
|
|
66
45
|
layoutMode?: LayoutMode;
|
|
67
|
-
/** Index of pinned/focused item (main participant for spotlight/
|
|
46
|
+
/** Index of pinned/focused item (main participant for spotlight/pin modes) */
|
|
68
47
|
pinnedIndex?: number;
|
|
69
|
-
/**
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
48
|
+
/**
|
|
49
|
+
* Position of "others" thumbnails when a participant is pinned.
|
|
50
|
+
* In portrait containers, this is forced to 'bottom'.
|
|
51
|
+
* @default 'right'
|
|
52
|
+
*/
|
|
53
|
+
othersPosition?: 'left' | 'right' | 'top' | 'bottom';
|
|
73
54
|
/** Maximum items per page for pagination (0 = no pagination) */
|
|
74
55
|
maxItemsPerPage?: number;
|
|
75
56
|
/** Current page index (0-based) for pagination */
|
|
76
57
|
currentPage?: number;
|
|
77
58
|
/**
|
|
78
59
|
* Maximum visible items (0 = show all).
|
|
79
|
-
* - In gallery mode: limits total items displayed
|
|
80
|
-
* - In
|
|
60
|
+
* - In gallery mode without pin: limits total items displayed
|
|
61
|
+
* - In gallery mode with pin: limits "others" thumbnails (pinned item always visible)
|
|
81
62
|
* When set, shows a '+X' indicator on the last visible item.
|
|
82
63
|
* @default 0
|
|
83
64
|
*/
|
|
@@ -89,19 +70,11 @@ interface MeetGridOptions extends GridOptions {
|
|
|
89
70
|
* Allows different aspect ratios per participant:
|
|
90
71
|
* - Use "9:16" for mobile/portrait participants
|
|
91
72
|
* - Use "16:9" for desktop/landscape participants
|
|
92
|
-
* - Use "fill" for whiteboard (full cell, no ratio constraint)
|
|
93
73
|
* - Use undefined to inherit from global aspectRatio
|
|
94
74
|
* @example
|
|
95
|
-
* itemAspectRatios: ["16:9", "9:16",
|
|
75
|
+
* itemAspectRatios: ["16:9", "9:16", undefined]
|
|
96
76
|
*/
|
|
97
77
|
itemAspectRatios?: (ItemAspectRatio | undefined)[];
|
|
98
|
-
/**
|
|
99
|
-
* Enable flexible cell sizing based on item aspect ratios.
|
|
100
|
-
* When true, portrait items (9:16) get narrower cells, landscape items (16:9) get wider cells.
|
|
101
|
-
* Items are packed into rows intelligently.
|
|
102
|
-
* @default false
|
|
103
|
-
*/
|
|
104
|
-
flexLayout?: boolean;
|
|
105
78
|
}
|
|
106
79
|
/**
|
|
107
80
|
* Pagination info returned with grid result
|
|
@@ -176,16 +149,13 @@ interface MeetGridResult extends GridResult {
|
|
|
176
149
|
* Returns dimensions fitted within the cell while maintaining the item's aspect ratio.
|
|
177
150
|
*
|
|
178
151
|
* @param index - The item index
|
|
179
|
-
* @param itemRatio - The item's aspect ratio ("16:9", "9:16",
|
|
152
|
+
* @param itemRatio - The item's aspect ratio ("16:9", "9:16", or undefined for cell dimensions)
|
|
180
153
|
* @returns Content dimensions with offset for centering within the cell
|
|
181
154
|
*
|
|
182
155
|
* @example
|
|
183
156
|
* // For a mobile participant (9:16)
|
|
184
157
|
* const content = grid.getItemContentDimensions(0, "9:16")
|
|
185
158
|
*
|
|
186
|
-
* // For whiteboard (fill entire cell)
|
|
187
|
-
* const content = grid.getItemContentDimensions(1, "fill")
|
|
188
|
-
*
|
|
189
159
|
* // Apply in React:
|
|
190
160
|
* <div style={{
|
|
191
161
|
* width: content.width,
|
|
@@ -212,55 +182,16 @@ declare function parseAspectRatio(ratio: string): {
|
|
|
212
182
|
/**
|
|
213
183
|
* Calculate content dimensions that fit within a cell while maintaining aspect ratio
|
|
214
184
|
* @param cellDimensions - The cell dimensions to fit content into
|
|
215
|
-
* @param itemRatio - The content's aspect ratio ("16:9", "9:16",
|
|
185
|
+
* @param itemRatio - The content's aspect ratio ("16:9", "9:16", etc.)
|
|
216
186
|
* @param defaultRatio - The default aspect ratio to use if itemRatio is undefined
|
|
217
187
|
* @returns Content dimensions with offset for centering
|
|
218
188
|
*/
|
|
219
189
|
declare function calculateContentDimensions(cellDimensions: GridDimensions, itemRatio?: ItemAspectRatio, defaultRatio?: string): ContentDimensions;
|
|
220
|
-
/**
|
|
221
|
-
* Calculate flex layout with variable cell sizes.
|
|
222
|
-
* Each item maintains its aspect ratio.
|
|
223
|
-
* Items in the same row have the same height but different widths.
|
|
224
|
-
*/
|
|
225
|
-
declare function calculateFlexLayout(options: {
|
|
226
|
-
dimensions: GridDimensions;
|
|
227
|
-
count: number;
|
|
228
|
-
aspectRatio: string;
|
|
229
|
-
gap: number;
|
|
230
|
-
itemAspectRatios?: (ItemAspectRatio | undefined)[];
|
|
231
|
-
preferHorizontal?: boolean;
|
|
232
|
-
}): FlexItemInfo[];
|
|
233
|
-
/**
|
|
234
|
-
* Calculate flex strip layout for sidebar (single row/column of items with different aspects).
|
|
235
|
-
* Used for sidebar modes where "others" need flexible sizing.
|
|
236
|
-
*
|
|
237
|
-
* @param options - Strip layout options
|
|
238
|
-
* @returns Array of items with positions and dimensions relative to strip origin
|
|
239
|
-
*/
|
|
240
|
-
declare function calculateFlexStrip(options: {
|
|
241
|
-
/** Strip dimensions (width x height) */
|
|
242
|
-
dimensions: GridDimensions;
|
|
243
|
-
/** Number of items */
|
|
244
|
-
count: number;
|
|
245
|
-
/** Default aspect ratio */
|
|
246
|
-
aspectRatio: string;
|
|
247
|
-
/** Gap between items */
|
|
248
|
-
gap: number;
|
|
249
|
-
/** Per-item aspect ratios */
|
|
250
|
-
itemAspectRatios?: (ItemAspectRatio | undefined)[];
|
|
251
|
-
/** Direction of the strip */
|
|
252
|
-
direction: 'horizontal' | 'vertical';
|
|
253
|
-
/** Offset to add to all positions */
|
|
254
|
-
offset?: {
|
|
255
|
-
left: number;
|
|
256
|
-
top: number;
|
|
257
|
-
};
|
|
258
|
-
}): FlexItemInfo[];
|
|
259
190
|
/**
|
|
260
191
|
* Calculates grid item dimensions for items that can fit in a container.
|
|
261
192
|
* Adapted from: https://stackoverflow.com/a/28268965
|
|
262
193
|
*/
|
|
263
|
-
declare function getGridItemDimensions({ count, dimensions, aspectRatio, gap
|
|
194
|
+
declare function getGridItemDimensions({ count, dimensions, aspectRatio, gap }: GridOptions): {
|
|
264
195
|
width: number;
|
|
265
196
|
height: number;
|
|
266
197
|
rows: number;
|
|
@@ -333,5 +264,5 @@ declare function getSpringConfig(preset?: SpringPreset): {
|
|
|
333
264
|
type: "spring";
|
|
334
265
|
};
|
|
335
266
|
|
|
336
|
-
export { calculateContentDimensions,
|
|
337
|
-
export type { ContentDimensions,
|
|
267
|
+
export { calculateContentDimensions, createGrid, createGridItemPositioner, createMeetGrid, getAspectRatio, getGridItemDimensions, getSpringConfig, parseAspectRatio, springPresets };
|
|
268
|
+
export type { ContentDimensions, GridDimensions, GridOptions, GridResult, ItemAspectRatio, LayoutMode, MeetGridOptions, MeetGridResult, PaginationInfo, Position, SpringPreset };
|
package/dist/index.d.mts
CHANGED
|
@@ -14,11 +14,10 @@ interface Position {
|
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
16
|
* Layout modes for the grid
|
|
17
|
-
* - gallery:
|
|
17
|
+
* - gallery: Flexible grid that fills all available space. Supports pin mode with pinnedIndex.
|
|
18
18
|
* - spotlight: Single participant in focus, others hidden
|
|
19
|
-
* - sidebar: Main view with thumbnail strip on the side (use sidebarPosition for top/bottom/left/right)
|
|
20
19
|
*/
|
|
21
|
-
type LayoutMode = 'gallery' | 'spotlight'
|
|
20
|
+
type LayoutMode = 'gallery' | 'spotlight';
|
|
22
21
|
/**
|
|
23
22
|
* Options for creating a basic grid
|
|
24
23
|
*/
|
|
@@ -35,49 +34,31 @@ interface GridOptions {
|
|
|
35
34
|
/**
|
|
36
35
|
* Aspect ratio configuration for individual items
|
|
37
36
|
* - string: Custom ratio like "16:9", "9:16", "4:3", "1:1"
|
|
38
|
-
* - 'fill': Stretch to fill the entire cell (useful for whiteboard)
|
|
39
37
|
* - 'auto': Use actual content dimensions (requires callback)
|
|
40
38
|
*/
|
|
41
|
-
type ItemAspectRatio = string | '
|
|
42
|
-
/**
|
|
43
|
-
* Flex layout item info for variable-sized cells
|
|
44
|
-
*/
|
|
45
|
-
interface FlexItemInfo {
|
|
46
|
-
/** Item index */
|
|
47
|
-
index: number;
|
|
48
|
-
/** Width of this item's cell */
|
|
49
|
-
width: number;
|
|
50
|
-
/** Height of this item's cell */
|
|
51
|
-
height: number;
|
|
52
|
-
/** Left position */
|
|
53
|
-
left: number;
|
|
54
|
-
/** Top position */
|
|
55
|
-
top: number;
|
|
56
|
-
/** Row this item belongs to */
|
|
57
|
-
row: number;
|
|
58
|
-
/** Width weight factor (based on aspect ratio) */
|
|
59
|
-
widthFactor: number;
|
|
60
|
-
}
|
|
39
|
+
type ItemAspectRatio = string | 'auto';
|
|
61
40
|
/**
|
|
62
41
|
* Extended options for meet-style grid with layout modes
|
|
63
42
|
*/
|
|
64
43
|
interface MeetGridOptions extends GridOptions {
|
|
65
44
|
/** Layout mode for the grid */
|
|
66
45
|
layoutMode?: LayoutMode;
|
|
67
|
-
/** Index of pinned/focused item (main participant for spotlight/
|
|
46
|
+
/** Index of pinned/focused item (main participant for spotlight/pin modes) */
|
|
68
47
|
pinnedIndex?: number;
|
|
69
|
-
/**
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
48
|
+
/**
|
|
49
|
+
* Position of "others" thumbnails when a participant is pinned.
|
|
50
|
+
* In portrait containers, this is forced to 'bottom'.
|
|
51
|
+
* @default 'right'
|
|
52
|
+
*/
|
|
53
|
+
othersPosition?: 'left' | 'right' | 'top' | 'bottom';
|
|
73
54
|
/** Maximum items per page for pagination (0 = no pagination) */
|
|
74
55
|
maxItemsPerPage?: number;
|
|
75
56
|
/** Current page index (0-based) for pagination */
|
|
76
57
|
currentPage?: number;
|
|
77
58
|
/**
|
|
78
59
|
* Maximum visible items (0 = show all).
|
|
79
|
-
* - In gallery mode: limits total items displayed
|
|
80
|
-
* - In
|
|
60
|
+
* - In gallery mode without pin: limits total items displayed
|
|
61
|
+
* - In gallery mode with pin: limits "others" thumbnails (pinned item always visible)
|
|
81
62
|
* When set, shows a '+X' indicator on the last visible item.
|
|
82
63
|
* @default 0
|
|
83
64
|
*/
|
|
@@ -89,19 +70,11 @@ interface MeetGridOptions extends GridOptions {
|
|
|
89
70
|
* Allows different aspect ratios per participant:
|
|
90
71
|
* - Use "9:16" for mobile/portrait participants
|
|
91
72
|
* - Use "16:9" for desktop/landscape participants
|
|
92
|
-
* - Use "fill" for whiteboard (full cell, no ratio constraint)
|
|
93
73
|
* - Use undefined to inherit from global aspectRatio
|
|
94
74
|
* @example
|
|
95
|
-
* itemAspectRatios: ["16:9", "9:16",
|
|
75
|
+
* itemAspectRatios: ["16:9", "9:16", undefined]
|
|
96
76
|
*/
|
|
97
77
|
itemAspectRatios?: (ItemAspectRatio | undefined)[];
|
|
98
|
-
/**
|
|
99
|
-
* Enable flexible cell sizing based on item aspect ratios.
|
|
100
|
-
* When true, portrait items (9:16) get narrower cells, landscape items (16:9) get wider cells.
|
|
101
|
-
* Items are packed into rows intelligently.
|
|
102
|
-
* @default false
|
|
103
|
-
*/
|
|
104
|
-
flexLayout?: boolean;
|
|
105
78
|
}
|
|
106
79
|
/**
|
|
107
80
|
* Pagination info returned with grid result
|
|
@@ -176,16 +149,13 @@ interface MeetGridResult extends GridResult {
|
|
|
176
149
|
* Returns dimensions fitted within the cell while maintaining the item's aspect ratio.
|
|
177
150
|
*
|
|
178
151
|
* @param index - The item index
|
|
179
|
-
* @param itemRatio - The item's aspect ratio ("16:9", "9:16",
|
|
152
|
+
* @param itemRatio - The item's aspect ratio ("16:9", "9:16", or undefined for cell dimensions)
|
|
180
153
|
* @returns Content dimensions with offset for centering within the cell
|
|
181
154
|
*
|
|
182
155
|
* @example
|
|
183
156
|
* // For a mobile participant (9:16)
|
|
184
157
|
* const content = grid.getItemContentDimensions(0, "9:16")
|
|
185
158
|
*
|
|
186
|
-
* // For whiteboard (fill entire cell)
|
|
187
|
-
* const content = grid.getItemContentDimensions(1, "fill")
|
|
188
|
-
*
|
|
189
159
|
* // Apply in React:
|
|
190
160
|
* <div style={{
|
|
191
161
|
* width: content.width,
|
|
@@ -212,55 +182,16 @@ declare function parseAspectRatio(ratio: string): {
|
|
|
212
182
|
/**
|
|
213
183
|
* Calculate content dimensions that fit within a cell while maintaining aspect ratio
|
|
214
184
|
* @param cellDimensions - The cell dimensions to fit content into
|
|
215
|
-
* @param itemRatio - The content's aspect ratio ("16:9", "9:16",
|
|
185
|
+
* @param itemRatio - The content's aspect ratio ("16:9", "9:16", etc.)
|
|
216
186
|
* @param defaultRatio - The default aspect ratio to use if itemRatio is undefined
|
|
217
187
|
* @returns Content dimensions with offset for centering
|
|
218
188
|
*/
|
|
219
189
|
declare function calculateContentDimensions(cellDimensions: GridDimensions, itemRatio?: ItemAspectRatio, defaultRatio?: string): ContentDimensions;
|
|
220
|
-
/**
|
|
221
|
-
* Calculate flex layout with variable cell sizes.
|
|
222
|
-
* Each item maintains its aspect ratio.
|
|
223
|
-
* Items in the same row have the same height but different widths.
|
|
224
|
-
*/
|
|
225
|
-
declare function calculateFlexLayout(options: {
|
|
226
|
-
dimensions: GridDimensions;
|
|
227
|
-
count: number;
|
|
228
|
-
aspectRatio: string;
|
|
229
|
-
gap: number;
|
|
230
|
-
itemAspectRatios?: (ItemAspectRatio | undefined)[];
|
|
231
|
-
preferHorizontal?: boolean;
|
|
232
|
-
}): FlexItemInfo[];
|
|
233
|
-
/**
|
|
234
|
-
* Calculate flex strip layout for sidebar (single row/column of items with different aspects).
|
|
235
|
-
* Used for sidebar modes where "others" need flexible sizing.
|
|
236
|
-
*
|
|
237
|
-
* @param options - Strip layout options
|
|
238
|
-
* @returns Array of items with positions and dimensions relative to strip origin
|
|
239
|
-
*/
|
|
240
|
-
declare function calculateFlexStrip(options: {
|
|
241
|
-
/** Strip dimensions (width x height) */
|
|
242
|
-
dimensions: GridDimensions;
|
|
243
|
-
/** Number of items */
|
|
244
|
-
count: number;
|
|
245
|
-
/** Default aspect ratio */
|
|
246
|
-
aspectRatio: string;
|
|
247
|
-
/** Gap between items */
|
|
248
|
-
gap: number;
|
|
249
|
-
/** Per-item aspect ratios */
|
|
250
|
-
itemAspectRatios?: (ItemAspectRatio | undefined)[];
|
|
251
|
-
/** Direction of the strip */
|
|
252
|
-
direction: 'horizontal' | 'vertical';
|
|
253
|
-
/** Offset to add to all positions */
|
|
254
|
-
offset?: {
|
|
255
|
-
left: number;
|
|
256
|
-
top: number;
|
|
257
|
-
};
|
|
258
|
-
}): FlexItemInfo[];
|
|
259
190
|
/**
|
|
260
191
|
* Calculates grid item dimensions for items that can fit in a container.
|
|
261
192
|
* Adapted from: https://stackoverflow.com/a/28268965
|
|
262
193
|
*/
|
|
263
|
-
declare function getGridItemDimensions({ count, dimensions, aspectRatio, gap
|
|
194
|
+
declare function getGridItemDimensions({ count, dimensions, aspectRatio, gap }: GridOptions): {
|
|
264
195
|
width: number;
|
|
265
196
|
height: number;
|
|
266
197
|
rows: number;
|
|
@@ -333,5 +264,5 @@ declare function getSpringConfig(preset?: SpringPreset): {
|
|
|
333
264
|
type: "spring";
|
|
334
265
|
};
|
|
335
266
|
|
|
336
|
-
export { calculateContentDimensions,
|
|
337
|
-
export type { ContentDimensions,
|
|
267
|
+
export { calculateContentDimensions, createGrid, createGridItemPositioner, createMeetGrid, getAspectRatio, getGridItemDimensions, getSpringConfig, parseAspectRatio, springPresets };
|
|
268
|
+
export type { ContentDimensions, GridDimensions, GridOptions, GridResult, ItemAspectRatio, LayoutMode, MeetGridOptions, MeetGridResult, PaginationInfo, Position, SpringPreset };
|
package/dist/index.d.ts
CHANGED
|
@@ -14,11 +14,10 @@ interface Position {
|
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
16
|
* Layout modes for the grid
|
|
17
|
-
* - gallery:
|
|
17
|
+
* - gallery: Flexible grid that fills all available space. Supports pin mode with pinnedIndex.
|
|
18
18
|
* - spotlight: Single participant in focus, others hidden
|
|
19
|
-
* - sidebar: Main view with thumbnail strip on the side (use sidebarPosition for top/bottom/left/right)
|
|
20
19
|
*/
|
|
21
|
-
type LayoutMode = 'gallery' | 'spotlight'
|
|
20
|
+
type LayoutMode = 'gallery' | 'spotlight';
|
|
22
21
|
/**
|
|
23
22
|
* Options for creating a basic grid
|
|
24
23
|
*/
|
|
@@ -35,49 +34,31 @@ interface GridOptions {
|
|
|
35
34
|
/**
|
|
36
35
|
* Aspect ratio configuration for individual items
|
|
37
36
|
* - string: Custom ratio like "16:9", "9:16", "4:3", "1:1"
|
|
38
|
-
* - 'fill': Stretch to fill the entire cell (useful for whiteboard)
|
|
39
37
|
* - 'auto': Use actual content dimensions (requires callback)
|
|
40
38
|
*/
|
|
41
|
-
type ItemAspectRatio = string | '
|
|
42
|
-
/**
|
|
43
|
-
* Flex layout item info for variable-sized cells
|
|
44
|
-
*/
|
|
45
|
-
interface FlexItemInfo {
|
|
46
|
-
/** Item index */
|
|
47
|
-
index: number;
|
|
48
|
-
/** Width of this item's cell */
|
|
49
|
-
width: number;
|
|
50
|
-
/** Height of this item's cell */
|
|
51
|
-
height: number;
|
|
52
|
-
/** Left position */
|
|
53
|
-
left: number;
|
|
54
|
-
/** Top position */
|
|
55
|
-
top: number;
|
|
56
|
-
/** Row this item belongs to */
|
|
57
|
-
row: number;
|
|
58
|
-
/** Width weight factor (based on aspect ratio) */
|
|
59
|
-
widthFactor: number;
|
|
60
|
-
}
|
|
39
|
+
type ItemAspectRatio = string | 'auto';
|
|
61
40
|
/**
|
|
62
41
|
* Extended options for meet-style grid with layout modes
|
|
63
42
|
*/
|
|
64
43
|
interface MeetGridOptions extends GridOptions {
|
|
65
44
|
/** Layout mode for the grid */
|
|
66
45
|
layoutMode?: LayoutMode;
|
|
67
|
-
/** Index of pinned/focused item (main participant for spotlight/
|
|
46
|
+
/** Index of pinned/focused item (main participant for spotlight/pin modes) */
|
|
68
47
|
pinnedIndex?: number;
|
|
69
|
-
/**
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
48
|
+
/**
|
|
49
|
+
* Position of "others" thumbnails when a participant is pinned.
|
|
50
|
+
* In portrait containers, this is forced to 'bottom'.
|
|
51
|
+
* @default 'right'
|
|
52
|
+
*/
|
|
53
|
+
othersPosition?: 'left' | 'right' | 'top' | 'bottom';
|
|
73
54
|
/** Maximum items per page for pagination (0 = no pagination) */
|
|
74
55
|
maxItemsPerPage?: number;
|
|
75
56
|
/** Current page index (0-based) for pagination */
|
|
76
57
|
currentPage?: number;
|
|
77
58
|
/**
|
|
78
59
|
* Maximum visible items (0 = show all).
|
|
79
|
-
* - In gallery mode: limits total items displayed
|
|
80
|
-
* - In
|
|
60
|
+
* - In gallery mode without pin: limits total items displayed
|
|
61
|
+
* - In gallery mode with pin: limits "others" thumbnails (pinned item always visible)
|
|
81
62
|
* When set, shows a '+X' indicator on the last visible item.
|
|
82
63
|
* @default 0
|
|
83
64
|
*/
|
|
@@ -89,19 +70,11 @@ interface MeetGridOptions extends GridOptions {
|
|
|
89
70
|
* Allows different aspect ratios per participant:
|
|
90
71
|
* - Use "9:16" for mobile/portrait participants
|
|
91
72
|
* - Use "16:9" for desktop/landscape participants
|
|
92
|
-
* - Use "fill" for whiteboard (full cell, no ratio constraint)
|
|
93
73
|
* - Use undefined to inherit from global aspectRatio
|
|
94
74
|
* @example
|
|
95
|
-
* itemAspectRatios: ["16:9", "9:16",
|
|
75
|
+
* itemAspectRatios: ["16:9", "9:16", undefined]
|
|
96
76
|
*/
|
|
97
77
|
itemAspectRatios?: (ItemAspectRatio | undefined)[];
|
|
98
|
-
/**
|
|
99
|
-
* Enable flexible cell sizing based on item aspect ratios.
|
|
100
|
-
* When true, portrait items (9:16) get narrower cells, landscape items (16:9) get wider cells.
|
|
101
|
-
* Items are packed into rows intelligently.
|
|
102
|
-
* @default false
|
|
103
|
-
*/
|
|
104
|
-
flexLayout?: boolean;
|
|
105
78
|
}
|
|
106
79
|
/**
|
|
107
80
|
* Pagination info returned with grid result
|
|
@@ -176,16 +149,13 @@ interface MeetGridResult extends GridResult {
|
|
|
176
149
|
* Returns dimensions fitted within the cell while maintaining the item's aspect ratio.
|
|
177
150
|
*
|
|
178
151
|
* @param index - The item index
|
|
179
|
-
* @param itemRatio - The item's aspect ratio ("16:9", "9:16",
|
|
152
|
+
* @param itemRatio - The item's aspect ratio ("16:9", "9:16", or undefined for cell dimensions)
|
|
180
153
|
* @returns Content dimensions with offset for centering within the cell
|
|
181
154
|
*
|
|
182
155
|
* @example
|
|
183
156
|
* // For a mobile participant (9:16)
|
|
184
157
|
* const content = grid.getItemContentDimensions(0, "9:16")
|
|
185
158
|
*
|
|
186
|
-
* // For whiteboard (fill entire cell)
|
|
187
|
-
* const content = grid.getItemContentDimensions(1, "fill")
|
|
188
|
-
*
|
|
189
159
|
* // Apply in React:
|
|
190
160
|
* <div style={{
|
|
191
161
|
* width: content.width,
|
|
@@ -212,55 +182,16 @@ declare function parseAspectRatio(ratio: string): {
|
|
|
212
182
|
/**
|
|
213
183
|
* Calculate content dimensions that fit within a cell while maintaining aspect ratio
|
|
214
184
|
* @param cellDimensions - The cell dimensions to fit content into
|
|
215
|
-
* @param itemRatio - The content's aspect ratio ("16:9", "9:16",
|
|
185
|
+
* @param itemRatio - The content's aspect ratio ("16:9", "9:16", etc.)
|
|
216
186
|
* @param defaultRatio - The default aspect ratio to use if itemRatio is undefined
|
|
217
187
|
* @returns Content dimensions with offset for centering
|
|
218
188
|
*/
|
|
219
189
|
declare function calculateContentDimensions(cellDimensions: GridDimensions, itemRatio?: ItemAspectRatio, defaultRatio?: string): ContentDimensions;
|
|
220
|
-
/**
|
|
221
|
-
* Calculate flex layout with variable cell sizes.
|
|
222
|
-
* Each item maintains its aspect ratio.
|
|
223
|
-
* Items in the same row have the same height but different widths.
|
|
224
|
-
*/
|
|
225
|
-
declare function calculateFlexLayout(options: {
|
|
226
|
-
dimensions: GridDimensions;
|
|
227
|
-
count: number;
|
|
228
|
-
aspectRatio: string;
|
|
229
|
-
gap: number;
|
|
230
|
-
itemAspectRatios?: (ItemAspectRatio | undefined)[];
|
|
231
|
-
preferHorizontal?: boolean;
|
|
232
|
-
}): FlexItemInfo[];
|
|
233
|
-
/**
|
|
234
|
-
* Calculate flex strip layout for sidebar (single row/column of items with different aspects).
|
|
235
|
-
* Used for sidebar modes where "others" need flexible sizing.
|
|
236
|
-
*
|
|
237
|
-
* @param options - Strip layout options
|
|
238
|
-
* @returns Array of items with positions and dimensions relative to strip origin
|
|
239
|
-
*/
|
|
240
|
-
declare function calculateFlexStrip(options: {
|
|
241
|
-
/** Strip dimensions (width x height) */
|
|
242
|
-
dimensions: GridDimensions;
|
|
243
|
-
/** Number of items */
|
|
244
|
-
count: number;
|
|
245
|
-
/** Default aspect ratio */
|
|
246
|
-
aspectRatio: string;
|
|
247
|
-
/** Gap between items */
|
|
248
|
-
gap: number;
|
|
249
|
-
/** Per-item aspect ratios */
|
|
250
|
-
itemAspectRatios?: (ItemAspectRatio | undefined)[];
|
|
251
|
-
/** Direction of the strip */
|
|
252
|
-
direction: 'horizontal' | 'vertical';
|
|
253
|
-
/** Offset to add to all positions */
|
|
254
|
-
offset?: {
|
|
255
|
-
left: number;
|
|
256
|
-
top: number;
|
|
257
|
-
};
|
|
258
|
-
}): FlexItemInfo[];
|
|
259
190
|
/**
|
|
260
191
|
* Calculates grid item dimensions for items that can fit in a container.
|
|
261
192
|
* Adapted from: https://stackoverflow.com/a/28268965
|
|
262
193
|
*/
|
|
263
|
-
declare function getGridItemDimensions({ count, dimensions, aspectRatio, gap
|
|
194
|
+
declare function getGridItemDimensions({ count, dimensions, aspectRatio, gap }: GridOptions): {
|
|
264
195
|
width: number;
|
|
265
196
|
height: number;
|
|
266
197
|
rows: number;
|
|
@@ -333,5 +264,5 @@ declare function getSpringConfig(preset?: SpringPreset): {
|
|
|
333
264
|
type: "spring";
|
|
334
265
|
};
|
|
335
266
|
|
|
336
|
-
export { calculateContentDimensions,
|
|
337
|
-
export type { ContentDimensions,
|
|
267
|
+
export { calculateContentDimensions, createGrid, createGridItemPositioner, createMeetGrid, getAspectRatio, getGridItemDimensions, getSpringConfig, parseAspectRatio, springPresets };
|
|
268
|
+
export type { ContentDimensions, GridDimensions, GridOptions, GridResult, ItemAspectRatio, LayoutMode, MeetGridOptions, MeetGridResult, PaginationInfo, Position, SpringPreset };
|