@wyxos/vibe 1.2.10 → 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 +1 -1
- package/src/App.vue +1 -1
- package/src/Masonry.vue +2 -2
- package/src/calculateLayout.js +2 -2
package/package.json
CHANGED
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
|
@@ -258,13 +258,13 @@ onUnmounted(() => {
|
|
|
258
258
|
</script>
|
|
259
259
|
|
|
260
260
|
<template>
|
|
261
|
-
<div class="overflow-auto
|
|
261
|
+
<div class="overflow-auto w-full flex-1" ref="container">
|
|
262
262
|
<div class="relative" :style="{height: `${containerHeight}px`}">
|
|
263
263
|
<transition-group :css="false" @enter="onEnter" @before-enter="onBeforeEnter"
|
|
264
264
|
@leave="onLeave"
|
|
265
265
|
@before-leave="onBeforeLeave">
|
|
266
266
|
<div v-for="item in masonry" :key="`${item.page}-${item.id}`"
|
|
267
|
-
class="
|
|
267
|
+
class="absolute transition-[top,left,opacity] duration-500 ease-in-out"
|
|
268
268
|
v-bind="itemAttributes(item)">
|
|
269
269
|
<slot name="item" v-bind="{item, onRemove}">
|
|
270
270
|
<img :src="item.src" class="w-full"/>
|
package/src/calculateLayout.js
CHANGED
|
@@ -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]
|
|
64
|
+
newItem.top = columnHeights[col];
|
|
65
65
|
|
|
66
66
|
columnHeights[col] += newItem.columnHeight + gutterY;
|
|
67
67
|
|