@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/vibe.css CHANGED
@@ -1 +1 @@
1
- .masonry-container[data-v-9de56a55]{overflow-anchor:none}.masonry-item[data-v-9de56a55]{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-9de56a55]{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-9de56a55],.masonry-container:not(.force-motion) .masonry-move[data-v-9de56a55]{transition-duration:1ms!important}}
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wyxos/vibe",
3
- "version": "1.6.23",
3
+ "version": "1.6.24",
4
4
  "description": "A high-performance, responsive masonry layout engine for Vue 3 with built-in infinite scrolling and virtualization.",
5
5
  "keywords": [
6
6
  "vue",
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.value = next == null
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, restore items from props if they exist
792
- // This allows parent components to pass items via v-model and vibe handles restoration
793
- if (props.items && props.items.length > 0) {
794
- // Extract page and next from items if available, otherwise use loadAtPage
795
- const firstItem = props.items[0] as any
796
- const lastItem = props.items[props.items.length - 1] as any
797
- const page = firstItem?.page ?? initialPage ?? 1
798
- const next = lastItem?.next ?? null
799
-
800
- // Restore items - this will set masonry.value and handle layout
801
- await restoreItems(props.items, page, next)
802
- } else {
803
- // No items to restore, just initialize pagination state
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) {