@wyxos/vibe 1.6.23 → 1.6.24
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/lib/index.js +552 -532
- package/lib/vibe.css +1 -1
- package/package.json +1 -1
- package/src/Masonry.vue +59 -18
package/lib/vibe.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.masonry-container[data-v-
|
|
1
|
+
.masonry-container[data-v-c6a3147d]{overflow-anchor:none}.masonry-item[data-v-c6a3147d]{will-change:transform,opacity;contain:layout paint;transition:transform var(--masonry-duration, .45s) var(--masonry-ease, cubic-bezier(.22, .61, .36, 1)),opacity var(--masonry-leave-duration, .16s) ease-out var(--masonry-opacity-delay, 0ms);backface-visibility:hidden}.masonry-move[data-v-c6a3147d]{transition:transform var(--masonry-duration, .45s) var(--masonry-ease, cubic-bezier(.22, .61, .36, 1))}@media (prefers-reduced-motion: reduce){.masonry-container:not(.force-motion) .masonry-item[data-v-c6a3147d],.masonry-container:not(.force-motion) .masonry-move[data-v-c6a3147d]{transition-duration:1ms!important}}
|
package/package.json
CHANGED
package/src/Masonry.vue
CHANGED
|
@@ -45,6 +45,15 @@ const props = defineProps({
|
|
|
45
45
|
type: Boolean,
|
|
46
46
|
default: false
|
|
47
47
|
},
|
|
48
|
+
// Initial pagination state when skipInitialLoad is true and items are provided
|
|
49
|
+
initialPage: {
|
|
50
|
+
type: [Number, String],
|
|
51
|
+
default: null
|
|
52
|
+
},
|
|
53
|
+
initialNextPage: {
|
|
54
|
+
type: [Number, String],
|
|
55
|
+
default: null
|
|
56
|
+
},
|
|
48
57
|
pageSize: {
|
|
49
58
|
type: Number,
|
|
50
59
|
default: 40
|
|
@@ -455,6 +464,9 @@ function reset() {
|
|
|
455
464
|
|
|
456
465
|
// Reset virtualization state
|
|
457
466
|
resetVirtualization()
|
|
467
|
+
|
|
468
|
+
// Reset auto-initialization flag so watcher can work again if needed
|
|
469
|
+
hasInitializedWithItems = false
|
|
458
470
|
}
|
|
459
471
|
|
|
460
472
|
function destroy() {
|
|
@@ -566,7 +578,9 @@ async function restoreItems(items: any[], page: any, next: any) {
|
|
|
566
578
|
if (next !== null && next !== undefined) {
|
|
567
579
|
paginationHistory.value.push(next)
|
|
568
580
|
}
|
|
569
|
-
hasReachedEnd
|
|
581
|
+
// Only set hasReachedEnd to true if next is explicitly null (end of list)
|
|
582
|
+
// undefined means "unknown" - don't assume end of list
|
|
583
|
+
hasReachedEnd.value = next === null
|
|
570
584
|
loadError.value = null
|
|
571
585
|
|
|
572
586
|
// Diagnostics: check incoming items
|
|
@@ -639,6 +653,36 @@ watch(container, (el) => {
|
|
|
639
653
|
}
|
|
640
654
|
}, { immediate: true })
|
|
641
655
|
|
|
656
|
+
// Watch for items when skipInitialLoad is true to auto-initialize pagination state
|
|
657
|
+
// This handles cases where items are provided after mount or updated externally
|
|
658
|
+
let hasInitializedWithItems = false
|
|
659
|
+
watch(
|
|
660
|
+
() => [props.items, props.skipInitialLoad, props.initialPage, props.initialNextPage] as const,
|
|
661
|
+
([items, skipInitialLoad, initialPage, initialNextPage]) => {
|
|
662
|
+
// Only auto-initialize if:
|
|
663
|
+
// 1. skipInitialLoad is true
|
|
664
|
+
// 2. Items exist
|
|
665
|
+
// 3. We haven't already initialized with items (to avoid re-initializing on every update)
|
|
666
|
+
if (
|
|
667
|
+
skipInitialLoad &&
|
|
668
|
+
items &&
|
|
669
|
+
items.length > 0 &&
|
|
670
|
+
!hasInitializedWithItems
|
|
671
|
+
) {
|
|
672
|
+
hasInitializedWithItems = true
|
|
673
|
+
const page = initialPage !== null && initialPage !== undefined
|
|
674
|
+
? initialPage
|
|
675
|
+
: (props.loadAtPage as any)
|
|
676
|
+
const next = initialNextPage !== undefined
|
|
677
|
+
? initialNextPage
|
|
678
|
+
: undefined // undefined means "unknown", null means "end of list"
|
|
679
|
+
|
|
680
|
+
restoreItems(items as any[], page, next)
|
|
681
|
+
}
|
|
682
|
+
},
|
|
683
|
+
{ immediate: false }
|
|
684
|
+
)
|
|
685
|
+
|
|
642
686
|
// Watch for swipe mode changes to refresh layout and setup/teardown handlers
|
|
643
687
|
watch(useSwipeMode, (newValue, oldValue) => {
|
|
644
688
|
// Skip if this is the initial watch call and values are the same
|
|
@@ -787,23 +831,20 @@ onMounted(async () => {
|
|
|
787
831
|
|
|
788
832
|
if (!props.skipInitialLoad) {
|
|
789
833
|
await loadPage(paginationHistory.value[0] as any)
|
|
790
|
-
} else {
|
|
791
|
-
// When skipInitialLoad is true
|
|
792
|
-
//
|
|
793
|
-
if
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
currentPage.value = initialPage
|
|
805
|
-
paginationHistory.value = [initialPage]
|
|
806
|
-
}
|
|
834
|
+
} else if (props.items && props.items.length > 0) {
|
|
835
|
+
// When skipInitialLoad is true and items are provided, initialize pagination state
|
|
836
|
+
// Use initialPage/initialNextPage props if provided, otherwise use loadAtPage
|
|
837
|
+
// Only set next to null if initialNextPage is explicitly null (not undefined)
|
|
838
|
+
const page = props.initialPage !== null && props.initialPage !== undefined
|
|
839
|
+
? props.initialPage
|
|
840
|
+
: (props.loadAtPage as any)
|
|
841
|
+
const next = props.initialNextPage !== undefined
|
|
842
|
+
? props.initialNextPage
|
|
843
|
+
: undefined // undefined means "unknown", null means "end of list"
|
|
844
|
+
|
|
845
|
+
await restoreItems(props.items as any[], page, next)
|
|
846
|
+
// Mark as initialized to prevent watcher from running again
|
|
847
|
+
hasInitializedWithItems = true
|
|
807
848
|
}
|
|
808
849
|
|
|
809
850
|
if (!useSwipeMode.value) {
|