@thangdevalone/meet-layout-grid-core 1.0.0 → 1.0.4
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/LICENSE +44 -0
- package/README.md +95 -95
- package/dist/index.cjs +316 -74
- package/dist/index.d.cts +31 -2
- package/dist/index.d.mts +31 -2
- package/dist/index.d.ts +197 -168
- package/dist/index.mjs +316 -74
- package/package.json +50 -49
package/LICENSE
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
MIT License with Attribution Requirement
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024-2026 ThangDevAlone
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
1. The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
2. ATTRIBUTION REQUIREMENT: Any project using this Software must include
|
|
16
|
+
visible attribution to the original author in one of the following ways:
|
|
17
|
+
|
|
18
|
+
a) In the project's README or documentation file, include:
|
|
19
|
+
"This project uses meet-layout-grid by @thangdevalone
|
|
20
|
+
(https://github.com/thangdevalone/meet-layout-grid)"
|
|
21
|
+
|
|
22
|
+
b) In an "About" or "Credits" section of the application, include:
|
|
23
|
+
"Powered by meet-layout-grid - https://github.com/thangdevalone/meet-layout-grid"
|
|
24
|
+
|
|
25
|
+
c) In the project's package.json or equivalent dependency manifest, ensure
|
|
26
|
+
the package is listed with its original name and author information intact.
|
|
27
|
+
|
|
28
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
29
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
30
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
31
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
32
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
33
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
34
|
+
SOFTWARE.
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
TL;DR - Bạn được phép:
|
|
39
|
+
✅ Sử dụng miễn phí cho dự án cá nhân và thương mại
|
|
40
|
+
✅ Chỉnh sửa và phân phối lại
|
|
41
|
+
✅ Sử dụng trong các dự án closed-source
|
|
42
|
+
|
|
43
|
+
Yêu cầu duy nhất:
|
|
44
|
+
📝 Ghi nguồn/credit cho tác giả gốc trong README hoặc phần About của dự án
|
package/README.md
CHANGED
|
@@ -1,95 +1,95 @@
|
|
|
1
|
-
# @meet-layout-grid
|
|
2
|
-
|
|
3
|
-
Core grid calculation logic for meet-layout-grid library. Zero dependencies, framework-agnostic.
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install @meet-layout-grid
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Usage
|
|
12
|
-
|
|
13
|
-
```typescript
|
|
14
|
-
import { createMeetGrid, createGrid } from '@meet-layout-grid
|
|
15
|
-
|
|
16
|
-
// Basic grid
|
|
17
|
-
const grid = createGrid({
|
|
18
|
-
dimensions: { width: 800, height: 600 },
|
|
19
|
-
count: 6,
|
|
20
|
-
aspectRatio: '16:9',
|
|
21
|
-
gap: 8,
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
console.log(`Item size: ${grid.width}x${grid.height}`)
|
|
25
|
-
console.log(`Grid: ${grid.cols} cols, ${grid.rows} rows`)
|
|
26
|
-
|
|
27
|
-
// Position each item
|
|
28
|
-
for (let i = 0; i < 6; i++) {
|
|
29
|
-
const { top, left } = grid.getPosition(i)
|
|
30
|
-
console.log(`Item ${i}: top=${top}, left=${left}`)
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// Meet-style grid with layout modes
|
|
34
|
-
const meetGrid = createMeetGrid({
|
|
35
|
-
dimensions: { width: 800, height: 600 },
|
|
36
|
-
count: 6,
|
|
37
|
-
aspectRatio: '16:9',
|
|
38
|
-
gap: 8,
|
|
39
|
-
layoutMode: 'speaker', // 'gallery' | 'speaker' | 'spotlight' | 'sidebar'
|
|
40
|
-
speakerIndex: 0,
|
|
41
|
-
})
|
|
42
|
-
|
|
43
|
-
// Items may have different sizes in speaker mode
|
|
44
|
-
for (let i = 0; i < 6; i++) {
|
|
45
|
-
const { width, height } = meetGrid.getItemDimensions(i)
|
|
46
|
-
const isMain = meetGrid.isMainItem(i)
|
|
47
|
-
console.log(`Item ${i}: ${width}x${height}, main: ${isMain}`)
|
|
48
|
-
}
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
## API
|
|
52
|
-
|
|
53
|
-
### `createGrid(options)`
|
|
54
|
-
|
|
55
|
-
Creates a basic responsive grid.
|
|
56
|
-
|
|
57
|
-
**Options:**
|
|
58
|
-
- `dimensions: { width, height }` - Container dimensions
|
|
59
|
-
- `count: number` - Number of items
|
|
60
|
-
- `aspectRatio: string` - Aspect ratio (e.g., "16:9")
|
|
61
|
-
- `gap: number` - Gap between items in pixels
|
|
62
|
-
|
|
63
|
-
**Returns:**
|
|
64
|
-
- `width: number` - Item width
|
|
65
|
-
- `height: number` - Item height
|
|
66
|
-
- `rows: number` - Number of rows
|
|
67
|
-
- `cols: number` - Number of columns
|
|
68
|
-
- `getPosition(index): { top, left }` - Position getter
|
|
69
|
-
|
|
70
|
-
### `createMeetGrid(options)`
|
|
71
|
-
|
|
72
|
-
Creates a meet-style grid with layout modes.
|
|
73
|
-
|
|
74
|
-
**Additional Options:**
|
|
75
|
-
- `layoutMode: 'gallery' | 'speaker' | 'spotlight' | 'sidebar'`
|
|
76
|
-
- `pinnedIndex?: number` - Index of pinned item
|
|
77
|
-
- `speakerIndex?: number` - Index of active speaker
|
|
78
|
-
- `sidebarPosition?: 'left' | 'right' | 'bottom'`
|
|
79
|
-
- `sidebarRatio?: number` - Sidebar width ratio (0-1)
|
|
80
|
-
|
|
81
|
-
**Additional Returns:**
|
|
82
|
-
- `layoutMode: LayoutMode` - Current layout mode
|
|
83
|
-
- `getItemDimensions(index): { width, height }` - Per-item dimensions
|
|
84
|
-
- `isMainItem(index): boolean` - Check if item is featured
|
|
85
|
-
|
|
86
|
-
## Layout Modes
|
|
87
|
-
|
|
88
|
-
- **Gallery** - Equal-sized tiles in a responsive grid
|
|
89
|
-
- **Speaker** - Active speaker takes larger space (65% height)
|
|
90
|
-
- **Spotlight** - Single participant in focus, others hidden
|
|
91
|
-
- **Sidebar** - Main view with thumbnail strip
|
|
92
|
-
|
|
93
|
-
## License
|
|
94
|
-
|
|
95
|
-
MIT
|
|
1
|
+
# @thangdevalone/meet-layout-grid-core
|
|
2
|
+
|
|
3
|
+
Core grid calculation logic for meet-layout-grid library. Zero dependencies, framework-agnostic.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @thangdevalone/meet-layout-grid-core
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { createMeetGrid, createGrid } from '@thangdevalone/meet-layout-grid-core'
|
|
15
|
+
|
|
16
|
+
// Basic grid
|
|
17
|
+
const grid = createGrid({
|
|
18
|
+
dimensions: { width: 800, height: 600 },
|
|
19
|
+
count: 6,
|
|
20
|
+
aspectRatio: '16:9',
|
|
21
|
+
gap: 8,
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
console.log(`Item size: ${grid.width}x${grid.height}`)
|
|
25
|
+
console.log(`Grid: ${grid.cols} cols, ${grid.rows} rows`)
|
|
26
|
+
|
|
27
|
+
// Position each item
|
|
28
|
+
for (let i = 0; i < 6; i++) {
|
|
29
|
+
const { top, left } = grid.getPosition(i)
|
|
30
|
+
console.log(`Item ${i}: top=${top}, left=${left}`)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Meet-style grid with layout modes
|
|
34
|
+
const meetGrid = createMeetGrid({
|
|
35
|
+
dimensions: { width: 800, height: 600 },
|
|
36
|
+
count: 6,
|
|
37
|
+
aspectRatio: '16:9',
|
|
38
|
+
gap: 8,
|
|
39
|
+
layoutMode: 'speaker', // 'gallery' | 'speaker' | 'spotlight' | 'sidebar'
|
|
40
|
+
speakerIndex: 0,
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
// Items may have different sizes in speaker mode
|
|
44
|
+
for (let i = 0; i < 6; i++) {
|
|
45
|
+
const { width, height } = meetGrid.getItemDimensions(i)
|
|
46
|
+
const isMain = meetGrid.isMainItem(i)
|
|
47
|
+
console.log(`Item ${i}: ${width}x${height}, main: ${isMain}`)
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## API
|
|
52
|
+
|
|
53
|
+
### `createGrid(options)`
|
|
54
|
+
|
|
55
|
+
Creates a basic responsive grid.
|
|
56
|
+
|
|
57
|
+
**Options:**
|
|
58
|
+
- `dimensions: { width, height }` - Container dimensions
|
|
59
|
+
- `count: number` - Number of items
|
|
60
|
+
- `aspectRatio: string` - Aspect ratio (e.g., "16:9")
|
|
61
|
+
- `gap: number` - Gap between items in pixels
|
|
62
|
+
|
|
63
|
+
**Returns:**
|
|
64
|
+
- `width: number` - Item width
|
|
65
|
+
- `height: number` - Item height
|
|
66
|
+
- `rows: number` - Number of rows
|
|
67
|
+
- `cols: number` - Number of columns
|
|
68
|
+
- `getPosition(index): { top, left }` - Position getter
|
|
69
|
+
|
|
70
|
+
### `createMeetGrid(options)`
|
|
71
|
+
|
|
72
|
+
Creates a meet-style grid with layout modes.
|
|
73
|
+
|
|
74
|
+
**Additional Options:**
|
|
75
|
+
- `layoutMode: 'gallery' | 'speaker' | 'spotlight' | 'sidebar'`
|
|
76
|
+
- `pinnedIndex?: number` - Index of pinned item
|
|
77
|
+
- `speakerIndex?: number` - Index of active speaker
|
|
78
|
+
- `sidebarPosition?: 'left' | 'right' | 'bottom'`
|
|
79
|
+
- `sidebarRatio?: number` - Sidebar width ratio (0-1)
|
|
80
|
+
|
|
81
|
+
**Additional Returns:**
|
|
82
|
+
- `layoutMode: LayoutMode` - Current layout mode
|
|
83
|
+
- `getItemDimensions(index): { width, height }` - Per-item dimensions
|
|
84
|
+
- `isMainItem(index): boolean` - Check if item is featured
|
|
85
|
+
|
|
86
|
+
## Layout Modes
|
|
87
|
+
|
|
88
|
+
- **Gallery** - Equal-sized tiles in a responsive grid
|
|
89
|
+
- **Speaker** - Active speaker takes larger space (65% height)
|
|
90
|
+
- **Spotlight** - Single participant in focus, others hidden
|
|
91
|
+
- **Sidebar** - Main view with thumbnail strip
|
|
92
|
+
|
|
93
|
+
## License
|
|
94
|
+
|
|
95
|
+
MIT
|