vuetify-masonry 0.4.0 → 0.4.1

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 CHANGED
@@ -7,48 +7,45 @@
7
7
  [![Vuetify 3](https://img.shields.io/badge/Vuetify-3-1867C0?logo=vuetify)](https://vuetifyjs.com/)
8
8
  [![semantic-release: conventionalcommits](https://img.shields.io/badge/semantic--release-conventionalcommits-e10079?logo=semantic-release)](https://github.com/semantic-release/semantic-release)
9
9
 
10
- Lightweight Vue 3 component that provides a responsive masonry-style grid built on Vuetify 3 layout primitives (`VRow`, `VCol`). Use it to render lists of variable-height items in evenly balanced columns.
10
+ Lightweight Vue 3 component for responsive masonry-style grids built on Vuetify 3 primitives.
11
11
 
12
- ## Installation
12
+ ## ✨ Features
13
13
 
14
- Install the package and ensure peer dependencies are present:
14
+ - 📱 **Fully responsive** - Automatic column adjustment across all breakpoints
15
+ - ⚡ **Lightweight** - Built on Vuetify's native layout components
16
+ - 🎯 **Flexible** - Customizable column count per breakpoint
17
+ - 🔧 **TypeScript** - Full type support included
18
+ - 🎨 **Slot-based** - Complete control over item rendering
15
19
 
16
- ```bash
17
- npm install vuetify-masonry
18
- ```
20
+ ## 🚀 Demo
19
21
 
20
- Peer dependencies: Vue 3 and Vuetify 3 (see `package.json`).
22
+ [![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/edit/vuetify-masonry-demo?file=src%2FApp.vue)
21
23
 
22
- ## Usage
24
+ ## 📦 Installation
23
25
 
24
- Import the component locally when you need it:
25
-
26
- ```js
27
- import { VMasonry } from 'vuetify-masonry'
26
+ ```bash
27
+ npm install vuetify-masonry
28
28
  ```
29
29
 
30
- ## Props
31
-
32
- - `items` (Array<T>, default `[]`): the list of items to render into the masonry columns.
33
- - `col` (1 | 2 | 3 | 4 | 6 | 12 or string): default number of columns fallback.
34
- - `xs`, `sm`, `md`, `lg`, `xl`, `xxl` (same as `col`): responsive column count overrides for each breakpoint.
35
-
36
- The component uses Vuetify's `useDisplay` breakpoints to pick the appropriate column count.
30
+ **Peer dependencies:** Vue 3 and Vuetify 3
37
31
 
38
- ## Slot API
32
+ ## 📖 Usage
39
33
 
40
- Provide a slot to render each item. The slot receives these props:
34
+ Import `VMasonry` and simply use it in template.
41
35
 
42
- - `item`: the item value from the `items` array
43
- - `index`: the index of the item within its column
44
- - `columnIndex`: the index of the column the item was placed into
36
+ ```js
37
+ <script setup>
38
+ import { VMasonry } from 'vuetify-masonry'
45
39
 
46
- Example:
40
+ const cards = [
41
+ { title: 'Card 1', description: 'Short' },
42
+ { title: 'Card 2', description: 'Longer content to show varying heights' }
43
+ ]
44
+ </script>
47
45
 
48
- ```vue
49
46
  <template>
50
- <v-masonry :items="cards" col="3">
51
- <template v-slot="{ item }">
47
+ <v-masonry :items="cards" col="2" sm="3">
48
+ <template #default="{ item }">
52
49
  <v-card>
53
50
  <v-card-title>{{ item.title }}</v-card-title>
54
51
  <v-card-text>{{ item.description }}</v-card-text>
@@ -56,34 +53,34 @@ Example:
56
53
  </template>
57
54
  </v-masonry>
58
55
  </template>
59
-
60
- <script setup>
61
- const cards = [
62
- { title: 'One', description: 'Short' },
63
- {
64
- title: 'Two',
65
- description: 'Longer content to demonstrate varying heights',
66
- },
67
- // ...
68
- ]
69
- </script>
70
56
  ```
71
57
 
72
- ## Notes
58
+ ## ⚙️ API
73
59
 
74
- - The component implementation lives in `src/components/VMasonry.vue` and relies on Vuetify's `VRow` and `VCol` for layout.
75
- - Column distribution places items round-robin into columns: `columns[index % nbColumns]`.
76
- - This package targets Vue 3 + Vuetify 3 (see `peerDependencies` in `package.json`).
60
+ ### Props
77
61
 
78
- ## Development
62
+ - **items** (`Array<T>`): List of items to render
63
+ - **col, xs, sm, md, lg, xl, xxl** (`1 | 2 | 3 | 4 | 6 | 12`): Column count per breakpoint (mobile-first)
79
64
 
80
- Run the dev server or build for publishing:
65
+ ### Slot
81
66
 
82
- ```bash
83
- npm install
84
- npm run dev # start example / dev server
85
- npm run build # produce files in dist/
86
- ```
67
+ **Default slot** - Renders each item in the masonry grid
68
+
69
+ Slot props:
70
+
71
+ - `item` - The item value from the `items` array
72
+ - `index` - The index of the item within its column
73
+ - `columnIndex` - The index of the column where the item is placed
74
+
75
+ ## 🏗️ How It Works
76
+
77
+ The component distributes items across columns using a round-robin algorithm (`columns[index % nbColumns]`), ensuring balanced column heights. It leverages Vuetify's `VRow` and `VCol` components for responsive grid behavior.
78
+
79
+ ## 🌟 Showcase
80
+
81
+ [![Benim Pencerem Ebru](https://img.shields.io/badge/🌐-benimpenceremebru.com-blue)](https://benimpenceremebru.com/)
82
+
83
+ _Using vuetify-masonry in your project? [Open a PR](https://github.com/senerh/vuetify-masonry/edit/main/README.md) to add it here!_
87
84
 
88
85
  ## License
89
86
 
@@ -63,12 +63,12 @@ const y = /* @__PURE__ */ B({
63
63
  index: m,
64
64
  columnIndex: n
65
65
  }, () => [
66
- r[0] || (r[0] = g(" Please provide a ", -1)),
66
+ r[0] || (r[0] = g(" Please ", -1)),
67
67
  r[1] || (r[1] = N("a", {
68
- href: "https://github.com/senerh/vuetify-masonry?tab=readme-ov-file#slot-api",
68
+ href: "https://github.com/senerh/vuetify-masonry?tab=readme-ov-file#-usage",
69
69
  target: "_blank",
70
70
  rel: "noopener"
71
- }, "slot", -1)),
71
+ }, "provide a slot", -1)),
72
72
  r[2] || (r[2] = g(". ", -1))
73
73
  ])
74
74
  ], 2))), 128))
@@ -1 +1 @@
1
- (function(r,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("vuetify"),require("vuetify/components")):typeof define=="function"&&define.amd?define(["exports","vue","vuetify","vuetify/components"],e):(r=typeof globalThis<"u"?globalThis:r||self,e(r.VuetifyMasonry={},r.Vue,r.Vuetify,r.Vuetify))})(this,(function(r,e,m,d){"use strict";const u=e.defineComponent({__name:"VMasonry",props:{col:{},items:{default:()=>[]},xs:{},sm:{},md:{},lg:{},xl:{},xxl:{}},setup(c){const t=c,{xs:x,smAndUp:y,mdAndUp:k,lgAndUp:V,xlAndUp:g,xxl:B}=m.useDisplay(),f=e.computed(()=>{const l=o=>{if(o!==void 0)return typeof o=="string"?Number(o):o},n=(...o)=>{for(const s of o){const i=l(s);if(i!==void 0)return i}return 1};return B.value?n(t.xxl,t.xl,t.lg,t.md,t.sm,t.xs,t.col):g.value?n(t.xl,t.lg,t.md,t.sm,t.xs,t.col):V.value?n(t.lg,t.md,t.sm,t.xs,t.col):k.value?n(t.md,t.sm,t.xs,t.col):y.value?n(t.sm,t.xs,t.col):x.value?n(t.xs,t.col):n(t.col)}),h=e.computed(()=>{const l=Array.from({length:f.value},()=>[]);return t.items.forEach((n,o)=>{l[o%f.value].push(n)}),l});return(l,n)=>(e.openBlock(),e.createBlock(e.unref(d.VRow),null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h.value,(o,s)=>(e.openBlock(),e.createBlock(e.unref(d.VCol),{key:s,cols:12/f.value},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o,(i,a)=>(e.openBlock(),e.createElementBlock("div",{key:a,class:e.normalizeClass({"mb-6":a!==o.length-1})},[e.renderSlot(l.$slots,"default",{item:i,index:a,columnIndex:s},()=>[n[0]||(n[0]=e.createTextVNode(" Please provide a ",-1)),n[1]||(n[1]=e.createElementVNode("a",{href:"https://github.com/senerh/vuetify-masonry?tab=readme-ov-file#slot-api",target:"_blank",rel:"noopener"},"slot",-1)),n[2]||(n[2]=e.createTextVNode(". ",-1))])],2))),128))]),_:2},1032,["cols"]))),128))]),_:3}))}}),p={...u,install(c){c.component("VMasonry",u)}};r.VMasonry=u,r.default=p,Object.defineProperties(r,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
1
+ (function(r,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("vuetify"),require("vuetify/components")):typeof define=="function"&&define.amd?define(["exports","vue","vuetify","vuetify/components"],e):(r=typeof globalThis<"u"?globalThis:r||self,e(r.VuetifyMasonry={},r.Vue,r.Vuetify,r.Vuetify))})(this,(function(r,e,m,d){"use strict";const u=e.defineComponent({__name:"VMasonry",props:{col:{},items:{default:()=>[]},xs:{},sm:{},md:{},lg:{},xl:{},xxl:{}},setup(c){const t=c,{xs:x,smAndUp:y,mdAndUp:k,lgAndUp:g,xlAndUp:V,xxl:B}=m.useDisplay(),f=e.computed(()=>{const l=o=>{if(o!==void 0)return typeof o=="string"?Number(o):o},n=(...o)=>{for(const s of o){const i=l(s);if(i!==void 0)return i}return 1};return B.value?n(t.xxl,t.xl,t.lg,t.md,t.sm,t.xs,t.col):V.value?n(t.xl,t.lg,t.md,t.sm,t.xs,t.col):g.value?n(t.lg,t.md,t.sm,t.xs,t.col):k.value?n(t.md,t.sm,t.xs,t.col):y.value?n(t.sm,t.xs,t.col):x.value?n(t.xs,t.col):n(t.col)}),h=e.computed(()=>{const l=Array.from({length:f.value},()=>[]);return t.items.forEach((n,o)=>{l[o%f.value].push(n)}),l});return(l,n)=>(e.openBlock(),e.createBlock(e.unref(d.VRow),null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h.value,(o,s)=>(e.openBlock(),e.createBlock(e.unref(d.VCol),{key:s,cols:12/f.value},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o,(i,a)=>(e.openBlock(),e.createElementBlock("div",{key:a,class:e.normalizeClass({"mb-6":a!==o.length-1})},[e.renderSlot(l.$slots,"default",{item:i,index:a,columnIndex:s},()=>[n[0]||(n[0]=e.createTextVNode(" Please ",-1)),n[1]||(n[1]=e.createElementVNode("a",{href:"https://github.com/senerh/vuetify-masonry?tab=readme-ov-file#-usage",target:"_blank",rel:"noopener"},"provide a slot",-1)),n[2]||(n[2]=e.createTextVNode(". ",-1))])],2))),128))]),_:2},1032,["cols"]))),128))]),_:3}))}}),p={...u,install(c){c.component("VMasonry",u)}};r.VMasonry=u,r.default=p,Object.defineProperties(r,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vuetify-masonry",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "A simple Vuetify-compatible masonry grid Vue 3 component",
5
5
  "main": "dist/vuetify-masonry.umd.js",
6
6
  "module": "dist/vuetify-masonry.mjs",