@wyxos/vibe 1.2.9 → 1.2.11

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wyxos/vibe",
3
- "version": "1.2.9",
3
+ "version": "1.2.11",
4
4
  "main": "index.js",
5
5
  "module": "index.js",
6
6
  "type": "module",
package/src/App.vue CHANGED
@@ -35,7 +35,7 @@ const getPage = async (page) => {
35
35
  <p>Loading: <span class="bg-blue-500 text-white p-2 rounded">{{ masonry.isLoading }}</span></p>
36
36
  </div>
37
37
  </header>
38
- <masonry v-model:items="items" :get-next-page="getPage" ref="masonry">
38
+ <masonry class="bg-blue-500 " v-model:items="items" :get-next-page="getPage" ref="masonry">
39
39
  <template #item="{item, onRemove}">
40
40
  <img :src="item.src" class="w-full"/>
41
41
  <button class="absolute bottom-0 right-0 bg-red-500 text-white p-2 rounded cursor-pointer" @click="onRemove(item)">
package/src/Masonry.vue CHANGED
@@ -88,7 +88,9 @@ async function onScroll() {
88
88
 
89
89
  const whitespaceVisible = columnHeights.value.some(height => height + 300 < visibleBottom - 1)
90
90
 
91
- if (whitespaceVisible && !isLoading.value) {
91
+ const reachedContainerBottom = scrollTop + clientHeight >= containerHeight.value - 1
92
+
93
+ if ((whitespaceVisible || reachedContainerBottom) && !isLoading.value) {
92
94
  isLoading.value = true
93
95
 
94
96
  if (paginationHistory.value.length > 3) {
@@ -256,13 +258,13 @@ onUnmounted(() => {
256
258
  </script>
257
259
 
258
260
  <template>
259
- <div class="overflow-auto bg-blue-500 w-full flex-1" ref="container">
261
+ <div class="overflow-auto w-full flex-1" ref="container">
260
262
  <div class="relative" :style="{height: `${containerHeight}px`}">
261
263
  <transition-group :css="false" @enter="onEnter" @before-enter="onBeforeEnter"
262
264
  @leave="onLeave"
263
265
  @before-leave="onBeforeLeave">
264
266
  <div v-for="item in masonry" :key="`${item.page}-${item.id}`"
265
- class="bg-slate-200 absolute transition-[top,left,opacity] duration-500 ease-in-out"
267
+ class="absolute transition-[top,left,opacity] duration-500 ease-in-out"
266
268
  v-bind="itemAttributes(item)">
267
269
  <slot name="item" v-bind="{item, onRemove}">
268
270
  <img :src="item.src" class="w-full"/>
@@ -56,12 +56,12 @@ export default function calculateLayout(items, container, columnCount, options =
56
56
 
57
57
  const col = index % columnCount;
58
58
  const originalWidth = item.width;
59
- const originalHeight = item.height;
59
+ const originalHeight = item.height + footer + header;
60
60
 
61
61
  newItem.columnWidth = columnWidth;
62
62
  newItem.left = col * (columnWidth + gutterX);
63
63
  newItem.columnHeight = Math.round((columnWidth * originalHeight) / originalWidth);
64
- newItem.top = columnHeights[col] + header + footer;
64
+ newItem.top = columnHeights[col];
65
65
 
66
66
  columnHeights[col] += newItem.columnHeight + gutterY;
67
67