@thangdevalone/meeting-grid-layout-vue 1.5.8 → 1.5.9
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 +2 -0
- package/dist/index.cjs +25 -14
- package/dist/index.d.cts +14 -10
- package/dist/index.d.mts +14 -10
- package/dist/index.d.ts +14 -10
- package/dist/index.mjs +26 -15
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -57,6 +57,8 @@ Wraps the grid and provides layout via `provide`/`inject`.
|
|
|
57
57
|
| `float-breakpoints` | `PipBreakpoint[]` | - | Responsive breakpoints for auto-float PiP (see [Responsive PiP](#responsive-pip)) |
|
|
58
58
|
| `pip-index` | `number` | `1` | Which participant (0 or 1) is the floating PiP in 2-person mode |
|
|
59
59
|
| `pin-only` | `boolean` | `false` | Mobile/tablet pin-only mode: page 0 = pinned full-screen, page 1+ = others gallery (≤1024px) |
|
|
60
|
+
| `disable-float` | `boolean` | `false` | Disable Floating PiP in 2-person mode; shows standard gallery grid instead |
|
|
61
|
+
| `disable-animation` | `boolean` | `false` | Disable all spring/transition animations globally; items snap instantly |
|
|
60
62
|
| `tag` | `string` | `'div'` | Root HTML element tag |
|
|
61
63
|
|
|
62
64
|
### `<GridItem>`
|
package/dist/index.cjs
CHANGED
|
@@ -215,9 +215,9 @@ const GridContainer = vue.defineComponent({
|
|
|
215
215
|
const grid = useMeetGrid(gridOptions);
|
|
216
216
|
vue.provide(GridContextKey, {
|
|
217
217
|
grid,
|
|
218
|
-
springPreset: props
|
|
218
|
+
springPreset: vue.toRef(props, "springPreset"),
|
|
219
219
|
dimensions,
|
|
220
|
-
disableAnimation: props
|
|
220
|
+
disableAnimation: vue.toRef(props, "disableAnimation")
|
|
221
221
|
});
|
|
222
222
|
return () => vue.h(
|
|
223
223
|
props.tag,
|
|
@@ -265,7 +265,7 @@ const GridItem = vue.defineComponent({
|
|
|
265
265
|
return () => null;
|
|
266
266
|
}
|
|
267
267
|
const { grid, springPreset, dimensions: containerDimensions, disableAnimation: containerDisableAnimation } = context;
|
|
268
|
-
const noAnimation = vue.computed(() => containerDisableAnimation || props.disableAnimation);
|
|
268
|
+
const noAnimation = vue.computed(() => containerDisableAnimation.value || props.disableAnimation);
|
|
269
269
|
const position = vue.computed(() => grid.value.getPosition(props.index));
|
|
270
270
|
const dimensions = vue.computed(() => grid.value.getItemDimensions(props.index));
|
|
271
271
|
const contentDimensions = vue.computed(
|
|
@@ -359,7 +359,7 @@ const GridItem = vue.defineComponent({
|
|
|
359
359
|
return props.index === lastVisibleOthersIndex;
|
|
360
360
|
});
|
|
361
361
|
const hiddenCount = vue.computed(() => grid.value.hiddenCount);
|
|
362
|
-
const springConfig = meetingGridLayoutCore.getSpringConfig(springPreset);
|
|
362
|
+
const springConfig = vue.computed(() => meetingGridLayoutCore.getSpringConfig(springPreset.value));
|
|
363
363
|
const gridX = motionV.useMotionValue(0);
|
|
364
364
|
const gridY = motionV.useMotionValue(0);
|
|
365
365
|
const gridAnimReady = vue.ref(false);
|
|
@@ -368,7 +368,10 @@ const GridItem = vue.defineComponent({
|
|
|
368
368
|
() => position.value.top,
|
|
369
369
|
() => position.value.left,
|
|
370
370
|
isFloat,
|
|
371
|
-
isHidden
|
|
371
|
+
isHidden,
|
|
372
|
+
() => springConfig.value.stiffness,
|
|
373
|
+
() => springConfig.value.damping,
|
|
374
|
+
() => springConfig.value.mass
|
|
372
375
|
],
|
|
373
376
|
([, , floating, hidden]) => {
|
|
374
377
|
if (floating || hidden) {
|
|
@@ -386,8 +389,9 @@ const GridItem = vue.defineComponent({
|
|
|
386
389
|
} else {
|
|
387
390
|
const cfg = {
|
|
388
391
|
type: "spring",
|
|
389
|
-
stiffness: springConfig.stiffness,
|
|
390
|
-
damping: springConfig.damping
|
|
392
|
+
stiffness: springConfig.value.stiffness,
|
|
393
|
+
damping: springConfig.value.damping,
|
|
394
|
+
mass: springConfig.value.mass
|
|
391
395
|
};
|
|
392
396
|
motionV.animate(gridX, pos.left, cfg);
|
|
393
397
|
motionV.animate(gridY, pos.top, cfg);
|
|
@@ -482,18 +486,25 @@ const GridItem = vue.defineComponent({
|
|
|
482
486
|
slots.default?.(slotProps.value)
|
|
483
487
|
);
|
|
484
488
|
}
|
|
489
|
+
const transition = noAnimation.value ? { duration: 0 } : {
|
|
490
|
+
type: "spring",
|
|
491
|
+
stiffness: springConfig.value.stiffness,
|
|
492
|
+
damping: springConfig.value.damping,
|
|
493
|
+
mass: springConfig.value.mass
|
|
494
|
+
};
|
|
485
495
|
return vue.h(
|
|
486
496
|
motionV.motion.div,
|
|
487
497
|
{
|
|
488
498
|
key: `grid-${props.index}`,
|
|
499
|
+
initial: { width: itemWidth, height: itemHeight },
|
|
500
|
+
animate: { width: itemWidth, height: itemHeight },
|
|
501
|
+
transition,
|
|
489
502
|
style: {
|
|
490
503
|
position: "absolute",
|
|
491
504
|
top: 0,
|
|
492
505
|
left: 0,
|
|
493
506
|
x: gridX,
|
|
494
|
-
y: gridY
|
|
495
|
-
width: `${itemWidth}px`,
|
|
496
|
-
height: `${itemHeight}px`
|
|
507
|
+
y: gridY
|
|
497
508
|
},
|
|
498
509
|
"data-grid-index": props.index,
|
|
499
510
|
"data-grid-main": isMain.value
|
|
@@ -670,7 +681,7 @@ const FloatingGridItem = vue.defineComponent({
|
|
|
670
681
|
if (isInitialized.value && w > 0 && h2 > 0 && newAnchor !== currentAnchor.value) {
|
|
671
682
|
currentAnchor.value = newAnchor;
|
|
672
683
|
const pos = getCornerPosition(newAnchor);
|
|
673
|
-
if (containerDisableAnimation) {
|
|
684
|
+
if (containerDisableAnimation.value) {
|
|
674
685
|
x.set(pos.x);
|
|
675
686
|
y.set(pos.y);
|
|
676
687
|
} else {
|
|
@@ -718,7 +729,7 @@ const FloatingGridItem = vue.defineComponent({
|
|
|
718
729
|
currentAnchor.value = nearestCorner;
|
|
719
730
|
emit("anchorChange", nearestCorner);
|
|
720
731
|
const snapPos = getCornerPosition(nearestCorner);
|
|
721
|
-
if (containerDisableAnimation) {
|
|
732
|
+
if (containerDisableAnimation.value) {
|
|
722
733
|
x.set(snapPos.x);
|
|
723
734
|
y.set(snapPos.y);
|
|
724
735
|
} else {
|
|
@@ -749,8 +760,8 @@ const FloatingGridItem = vue.defineComponent({
|
|
|
749
760
|
x,
|
|
750
761
|
y
|
|
751
762
|
},
|
|
752
|
-
whileDrag: containerDisableAnimation ? { cursor: "grabbing" } : { cursor: "grabbing", scale: 1.05, boxShadow: "0 8px 32px rgba(0,0,0,0.4)" },
|
|
753
|
-
transition: containerDisableAnimation ? { duration: 0 } : { type: "spring", stiffness: 400, damping: 30 },
|
|
763
|
+
whileDrag: containerDisableAnimation.value ? { cursor: "grabbing" } : { cursor: "grabbing", scale: 1.05, boxShadow: "0 8px 32px rgba(0,0,0,0.4)" },
|
|
764
|
+
transition: containerDisableAnimation.value ? { duration: 0 } : { type: "spring", stiffness: 400, damping: 30 },
|
|
754
765
|
onDragEnd: handleDragEnd
|
|
755
766
|
},
|
|
756
767
|
slots.default?.()
|
package/dist/index.d.cts
CHANGED
|
@@ -20,20 +20,24 @@ declare function useMeetGrid(options: Ref<MeetGridOptions> | ComputedRef<MeetGri
|
|
|
20
20
|
* Composable to get animation configuration for Motion
|
|
21
21
|
*/
|
|
22
22
|
declare function useGridAnimation(preset?: SpringPreset): ComputedRef<{
|
|
23
|
-
stiffness:
|
|
24
|
-
damping:
|
|
23
|
+
stiffness: 800;
|
|
24
|
+
damping: 35;
|
|
25
|
+
mass: 0.5;
|
|
25
26
|
type: "spring";
|
|
26
27
|
} | {
|
|
27
|
-
stiffness:
|
|
28
|
-
damping:
|
|
28
|
+
stiffness: 200;
|
|
29
|
+
damping: 26;
|
|
30
|
+
mass: 1;
|
|
29
31
|
type: "spring";
|
|
30
32
|
} | {
|
|
31
|
-
stiffness:
|
|
32
|
-
damping:
|
|
33
|
+
stiffness: 60;
|
|
34
|
+
damping: 14;
|
|
35
|
+
mass: 1.8;
|
|
33
36
|
type: "spring";
|
|
34
37
|
} | {
|
|
35
|
-
stiffness:
|
|
36
|
-
damping:
|
|
38
|
+
stiffness: 500;
|
|
39
|
+
damping: 8;
|
|
40
|
+
mass: 0.6;
|
|
37
41
|
type: "spring";
|
|
38
42
|
}>;
|
|
39
43
|
/**
|
|
@@ -48,9 +52,9 @@ declare function useGridItemPosition(grid: ComputedRef<MeetGridResult>, index: R
|
|
|
48
52
|
|
|
49
53
|
interface GridContextValue {
|
|
50
54
|
grid: ComputedRef<MeetGridResult>;
|
|
51
|
-
springPreset: SpringPreset
|
|
55
|
+
springPreset: Ref<SpringPreset>;
|
|
52
56
|
dimensions: Ref<GridDimensions>;
|
|
53
|
-
disableAnimation: boolean
|
|
57
|
+
disableAnimation: Ref<boolean>;
|
|
54
58
|
}
|
|
55
59
|
declare const GridContextKey: InjectionKey<GridContextValue>;
|
|
56
60
|
declare const GridContainer: vue.DefineComponent<vue.ExtractPropTypes<{
|
package/dist/index.d.mts
CHANGED
|
@@ -20,20 +20,24 @@ declare function useMeetGrid(options: Ref<MeetGridOptions> | ComputedRef<MeetGri
|
|
|
20
20
|
* Composable to get animation configuration for Motion
|
|
21
21
|
*/
|
|
22
22
|
declare function useGridAnimation(preset?: SpringPreset): ComputedRef<{
|
|
23
|
-
stiffness:
|
|
24
|
-
damping:
|
|
23
|
+
stiffness: 800;
|
|
24
|
+
damping: 35;
|
|
25
|
+
mass: 0.5;
|
|
25
26
|
type: "spring";
|
|
26
27
|
} | {
|
|
27
|
-
stiffness:
|
|
28
|
-
damping:
|
|
28
|
+
stiffness: 200;
|
|
29
|
+
damping: 26;
|
|
30
|
+
mass: 1;
|
|
29
31
|
type: "spring";
|
|
30
32
|
} | {
|
|
31
|
-
stiffness:
|
|
32
|
-
damping:
|
|
33
|
+
stiffness: 60;
|
|
34
|
+
damping: 14;
|
|
35
|
+
mass: 1.8;
|
|
33
36
|
type: "spring";
|
|
34
37
|
} | {
|
|
35
|
-
stiffness:
|
|
36
|
-
damping:
|
|
38
|
+
stiffness: 500;
|
|
39
|
+
damping: 8;
|
|
40
|
+
mass: 0.6;
|
|
37
41
|
type: "spring";
|
|
38
42
|
}>;
|
|
39
43
|
/**
|
|
@@ -48,9 +52,9 @@ declare function useGridItemPosition(grid: ComputedRef<MeetGridResult>, index: R
|
|
|
48
52
|
|
|
49
53
|
interface GridContextValue {
|
|
50
54
|
grid: ComputedRef<MeetGridResult>;
|
|
51
|
-
springPreset: SpringPreset
|
|
55
|
+
springPreset: Ref<SpringPreset>;
|
|
52
56
|
dimensions: Ref<GridDimensions>;
|
|
53
|
-
disableAnimation: boolean
|
|
57
|
+
disableAnimation: Ref<boolean>;
|
|
54
58
|
}
|
|
55
59
|
declare const GridContextKey: InjectionKey<GridContextValue>;
|
|
56
60
|
declare const GridContainer: vue.DefineComponent<vue.ExtractPropTypes<{
|
package/dist/index.d.ts
CHANGED
|
@@ -20,20 +20,24 @@ declare function useMeetGrid(options: Ref<MeetGridOptions> | ComputedRef<MeetGri
|
|
|
20
20
|
* Composable to get animation configuration for Motion
|
|
21
21
|
*/
|
|
22
22
|
declare function useGridAnimation(preset?: SpringPreset): ComputedRef<{
|
|
23
|
-
stiffness:
|
|
24
|
-
damping:
|
|
23
|
+
stiffness: 800;
|
|
24
|
+
damping: 35;
|
|
25
|
+
mass: 0.5;
|
|
25
26
|
type: "spring";
|
|
26
27
|
} | {
|
|
27
|
-
stiffness:
|
|
28
|
-
damping:
|
|
28
|
+
stiffness: 200;
|
|
29
|
+
damping: 26;
|
|
30
|
+
mass: 1;
|
|
29
31
|
type: "spring";
|
|
30
32
|
} | {
|
|
31
|
-
stiffness:
|
|
32
|
-
damping:
|
|
33
|
+
stiffness: 60;
|
|
34
|
+
damping: 14;
|
|
35
|
+
mass: 1.8;
|
|
33
36
|
type: "spring";
|
|
34
37
|
} | {
|
|
35
|
-
stiffness:
|
|
36
|
-
damping:
|
|
38
|
+
stiffness: 500;
|
|
39
|
+
damping: 8;
|
|
40
|
+
mass: 0.6;
|
|
37
41
|
type: "spring";
|
|
38
42
|
}>;
|
|
39
43
|
/**
|
|
@@ -48,9 +52,9 @@ declare function useGridItemPosition(grid: ComputedRef<MeetGridResult>, index: R
|
|
|
48
52
|
|
|
49
53
|
interface GridContextValue {
|
|
50
54
|
grid: ComputedRef<MeetGridResult>;
|
|
51
|
-
springPreset: SpringPreset
|
|
55
|
+
springPreset: Ref<SpringPreset>;
|
|
52
56
|
dimensions: Ref<GridDimensions>;
|
|
53
|
-
disableAnimation: boolean
|
|
57
|
+
disableAnimation: Ref<boolean>;
|
|
54
58
|
}
|
|
55
59
|
declare const GridContextKey: InjectionKey<GridContextValue>;
|
|
56
60
|
declare const GridContainer: vue.DefineComponent<vue.ExtractPropTypes<{
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createMeetGrid, getSpringConfig, resolveFloatSize } from '@thangdevalone/meeting-grid-layout-core';
|
|
2
2
|
export { createGrid, createGridItemPositioner, createMeetGrid, getAspectRatio, getGridItemDimensions, getSpringConfig, springPresets } from '@thangdevalone/meeting-grid-layout-core';
|
|
3
3
|
import { useResizeObserver } from '@vueuse/core';
|
|
4
|
-
import { ref, onMounted, computed, defineComponent, provide, h, inject, watch } from 'vue';
|
|
4
|
+
import { ref, onMounted, computed, defineComponent, provide, toRef, h, inject, watch } from 'vue';
|
|
5
5
|
import { useMotionValue, animate, motion } from 'motion-v';
|
|
6
6
|
|
|
7
7
|
function useGridDimensions(elementRef) {
|
|
@@ -214,9 +214,9 @@ const GridContainer = defineComponent({
|
|
|
214
214
|
const grid = useMeetGrid(gridOptions);
|
|
215
215
|
provide(GridContextKey, {
|
|
216
216
|
grid,
|
|
217
|
-
springPreset: props
|
|
217
|
+
springPreset: toRef(props, "springPreset"),
|
|
218
218
|
dimensions,
|
|
219
|
-
disableAnimation: props
|
|
219
|
+
disableAnimation: toRef(props, "disableAnimation")
|
|
220
220
|
});
|
|
221
221
|
return () => h(
|
|
222
222
|
props.tag,
|
|
@@ -264,7 +264,7 @@ const GridItem = defineComponent({
|
|
|
264
264
|
return () => null;
|
|
265
265
|
}
|
|
266
266
|
const { grid, springPreset, dimensions: containerDimensions, disableAnimation: containerDisableAnimation } = context;
|
|
267
|
-
const noAnimation = computed(() => containerDisableAnimation || props.disableAnimation);
|
|
267
|
+
const noAnimation = computed(() => containerDisableAnimation.value || props.disableAnimation);
|
|
268
268
|
const position = computed(() => grid.value.getPosition(props.index));
|
|
269
269
|
const dimensions = computed(() => grid.value.getItemDimensions(props.index));
|
|
270
270
|
const contentDimensions = computed(
|
|
@@ -358,7 +358,7 @@ const GridItem = defineComponent({
|
|
|
358
358
|
return props.index === lastVisibleOthersIndex;
|
|
359
359
|
});
|
|
360
360
|
const hiddenCount = computed(() => grid.value.hiddenCount);
|
|
361
|
-
const springConfig = getSpringConfig(springPreset);
|
|
361
|
+
const springConfig = computed(() => getSpringConfig(springPreset.value));
|
|
362
362
|
const gridX = useMotionValue(0);
|
|
363
363
|
const gridY = useMotionValue(0);
|
|
364
364
|
const gridAnimReady = ref(false);
|
|
@@ -367,7 +367,10 @@ const GridItem = defineComponent({
|
|
|
367
367
|
() => position.value.top,
|
|
368
368
|
() => position.value.left,
|
|
369
369
|
isFloat,
|
|
370
|
-
isHidden
|
|
370
|
+
isHidden,
|
|
371
|
+
() => springConfig.value.stiffness,
|
|
372
|
+
() => springConfig.value.damping,
|
|
373
|
+
() => springConfig.value.mass
|
|
371
374
|
],
|
|
372
375
|
([, , floating, hidden]) => {
|
|
373
376
|
if (floating || hidden) {
|
|
@@ -385,8 +388,9 @@ const GridItem = defineComponent({
|
|
|
385
388
|
} else {
|
|
386
389
|
const cfg = {
|
|
387
390
|
type: "spring",
|
|
388
|
-
stiffness: springConfig.stiffness,
|
|
389
|
-
damping: springConfig.damping
|
|
391
|
+
stiffness: springConfig.value.stiffness,
|
|
392
|
+
damping: springConfig.value.damping,
|
|
393
|
+
mass: springConfig.value.mass
|
|
390
394
|
};
|
|
391
395
|
animate(gridX, pos.left, cfg);
|
|
392
396
|
animate(gridY, pos.top, cfg);
|
|
@@ -481,18 +485,25 @@ const GridItem = defineComponent({
|
|
|
481
485
|
slots.default?.(slotProps.value)
|
|
482
486
|
);
|
|
483
487
|
}
|
|
488
|
+
const transition = noAnimation.value ? { duration: 0 } : {
|
|
489
|
+
type: "spring",
|
|
490
|
+
stiffness: springConfig.value.stiffness,
|
|
491
|
+
damping: springConfig.value.damping,
|
|
492
|
+
mass: springConfig.value.mass
|
|
493
|
+
};
|
|
484
494
|
return h(
|
|
485
495
|
motion.div,
|
|
486
496
|
{
|
|
487
497
|
key: `grid-${props.index}`,
|
|
498
|
+
initial: { width: itemWidth, height: itemHeight },
|
|
499
|
+
animate: { width: itemWidth, height: itemHeight },
|
|
500
|
+
transition,
|
|
488
501
|
style: {
|
|
489
502
|
position: "absolute",
|
|
490
503
|
top: 0,
|
|
491
504
|
left: 0,
|
|
492
505
|
x: gridX,
|
|
493
|
-
y: gridY
|
|
494
|
-
width: `${itemWidth}px`,
|
|
495
|
-
height: `${itemHeight}px`
|
|
506
|
+
y: gridY
|
|
496
507
|
},
|
|
497
508
|
"data-grid-index": props.index,
|
|
498
509
|
"data-grid-main": isMain.value
|
|
@@ -669,7 +680,7 @@ const FloatingGridItem = defineComponent({
|
|
|
669
680
|
if (isInitialized.value && w > 0 && h2 > 0 && newAnchor !== currentAnchor.value) {
|
|
670
681
|
currentAnchor.value = newAnchor;
|
|
671
682
|
const pos = getCornerPosition(newAnchor);
|
|
672
|
-
if (containerDisableAnimation) {
|
|
683
|
+
if (containerDisableAnimation.value) {
|
|
673
684
|
x.set(pos.x);
|
|
674
685
|
y.set(pos.y);
|
|
675
686
|
} else {
|
|
@@ -717,7 +728,7 @@ const FloatingGridItem = defineComponent({
|
|
|
717
728
|
currentAnchor.value = nearestCorner;
|
|
718
729
|
emit("anchorChange", nearestCorner);
|
|
719
730
|
const snapPos = getCornerPosition(nearestCorner);
|
|
720
|
-
if (containerDisableAnimation) {
|
|
731
|
+
if (containerDisableAnimation.value) {
|
|
721
732
|
x.set(snapPos.x);
|
|
722
733
|
y.set(snapPos.y);
|
|
723
734
|
} else {
|
|
@@ -748,8 +759,8 @@ const FloatingGridItem = defineComponent({
|
|
|
748
759
|
x,
|
|
749
760
|
y
|
|
750
761
|
},
|
|
751
|
-
whileDrag: containerDisableAnimation ? { cursor: "grabbing" } : { cursor: "grabbing", scale: 1.05, boxShadow: "0 8px 32px rgba(0,0,0,0.4)" },
|
|
752
|
-
transition: containerDisableAnimation ? { duration: 0 } : { type: "spring", stiffness: 400, damping: 30 },
|
|
762
|
+
whileDrag: containerDisableAnimation.value ? { cursor: "grabbing" } : { cursor: "grabbing", scale: 1.05, boxShadow: "0 8px 32px rgba(0,0,0,0.4)" },
|
|
763
|
+
transition: containerDisableAnimation.value ? { duration: 0 } : { type: "spring", stiffness: 400, damping: 30 },
|
|
753
764
|
onDragEnd: handleDragEnd
|
|
754
765
|
},
|
|
755
766
|
slots.default?.()
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thangdevalone/meeting-grid-layout-vue",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.9",
|
|
4
4
|
"description": "Vue 3 integration for meeting-grid-layout with Motion animations",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@vueuse/core": "^10.7.0",
|
|
45
45
|
"motion-v": "^1.0.0",
|
|
46
|
-
"@thangdevalone/meeting-grid-layout-core": "1.5.
|
|
46
|
+
"@thangdevalone/meeting-grid-layout-core": "1.5.9"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"vue": "^3.4.0",
|