vuetify-masonry 0.0.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/LICENSE +21 -0
- package/README.md +47 -0
- package/dist/vuetify-masonry.mjs +90 -0
- package/dist/vuetify-masonry.umd.js +1 -0
- package/package.json +27 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Hakan Sener
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# vuetify-masonry
|
|
2
|
+
|
|
3
|
+
A small Vue 3 component providing a simple masonry grid compatible with Vuetify 3's layout primitives.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
As a published package:
|
|
8
|
+
|
|
9
|
+
npm install vuetify-masonry
|
|
10
|
+
|
|
11
|
+
Peer dependencies: `vue` and `vuetify` (install those in your app).
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
Global install:
|
|
16
|
+
|
|
17
|
+
import { createApp } from 'vue'
|
|
18
|
+
import App from './App.vue'
|
|
19
|
+
import { createVuetify } from 'vuetify'
|
|
20
|
+
import VuetifyMasonry from 'vuetify-masonry'
|
|
21
|
+
|
|
22
|
+
const app = createApp(App)
|
|
23
|
+
app.use(createVuetify())
|
|
24
|
+
app.use(VuetifyMasonry)
|
|
25
|
+
app.mount('#app')
|
|
26
|
+
|
|
27
|
+
Or local import:
|
|
28
|
+
|
|
29
|
+
import { MasonryGrid } from 'vuetify-masonry'
|
|
30
|
+
|
|
31
|
+
export default { components: { MasonryGrid } }
|
|
32
|
+
|
|
33
|
+
### Slot API
|
|
34
|
+
|
|
35
|
+
Use the `item` named slot and read `item`, `index`, `columnIndex` from slot props.
|
|
36
|
+
|
|
37
|
+
## Build
|
|
38
|
+
|
|
39
|
+
Install dev dependencies and build:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
cd vuetify-masonry
|
|
43
|
+
npm install
|
|
44
|
+
npm run build
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
The build outputs `dist` suitable for publishing to npm.
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { defineComponent as B, computed as x, resolveComponent as m, createBlock as v, openBlock as t, withCtx as i, createVNode as M, createElementBlock as p, Fragment as _, renderList as g, normalizeClass as E, renderSlot as N } from "vue";
|
|
2
|
+
import { useDisplay as z } from "vuetify";
|
|
3
|
+
const y = /* @__PURE__ */ B({
|
|
4
|
+
__name: "VMasonry",
|
|
5
|
+
props: {
|
|
6
|
+
col: {},
|
|
7
|
+
items: { default: () => [] },
|
|
8
|
+
xs: {},
|
|
9
|
+
sm: {},
|
|
10
|
+
md: {},
|
|
11
|
+
lg: {},
|
|
12
|
+
xl: {},
|
|
13
|
+
xxl: {}
|
|
14
|
+
},
|
|
15
|
+
setup(s) {
|
|
16
|
+
const e = s, {
|
|
17
|
+
xs: A,
|
|
18
|
+
smAndUp: h,
|
|
19
|
+
mdAndUp: U,
|
|
20
|
+
lgAndUp: k,
|
|
21
|
+
xlAndUp: C,
|
|
22
|
+
xxl: b
|
|
23
|
+
} = z(), c = x(() => {
|
|
24
|
+
const l = (o) => {
|
|
25
|
+
if (o !== void 0)
|
|
26
|
+
return typeof o == "string" ? Number(o) : o;
|
|
27
|
+
}, n = (...o) => {
|
|
28
|
+
for (const u of o) {
|
|
29
|
+
const r = l(u);
|
|
30
|
+
if (r !== void 0) return r;
|
|
31
|
+
}
|
|
32
|
+
return 1;
|
|
33
|
+
};
|
|
34
|
+
return b.value ? n(
|
|
35
|
+
e.xxl,
|
|
36
|
+
e.xl,
|
|
37
|
+
e.lg,
|
|
38
|
+
e.md,
|
|
39
|
+
e.sm,
|
|
40
|
+
e.xs,
|
|
41
|
+
e.col
|
|
42
|
+
) : C.value ? n(e.xl, e.lg, e.md, e.sm, e.xs, e.col) : k.value ? n(e.lg, e.md, e.sm, e.xs, e.col) : U.value ? n(e.md, e.sm, e.xs, e.col) : h.value ? n(e.sm, e.xs, e.col) : A.value ? n(e.xs, e.col) : n(e.col);
|
|
43
|
+
}), V = x(() => {
|
|
44
|
+
const l = Array.from({ length: c.value }, () => []);
|
|
45
|
+
return e.items.forEach((n, o) => {
|
|
46
|
+
l[o % c.value].push(n);
|
|
47
|
+
}), l;
|
|
48
|
+
});
|
|
49
|
+
return (l, n) => {
|
|
50
|
+
const o = m("v-col"), u = m("v-row"), r = m("v-container");
|
|
51
|
+
return t(), v(r, { class: "pt-6" }, {
|
|
52
|
+
default: i(() => [
|
|
53
|
+
M(u, null, {
|
|
54
|
+
default: i(() => [
|
|
55
|
+
(t(!0), p(_, null, g(V.value, (d, f) => (t(), v(o, {
|
|
56
|
+
key: f,
|
|
57
|
+
cols: 12 / c.value
|
|
58
|
+
}, {
|
|
59
|
+
default: i(() => [
|
|
60
|
+
(t(!0), p(_, null, g(d, (w, a) => (t(), p("div", {
|
|
61
|
+
key: a,
|
|
62
|
+
class: E({ "mb-6": a !== d.length - 1 })
|
|
63
|
+
}, [
|
|
64
|
+
N(l.$slots, "item", {
|
|
65
|
+
item: w,
|
|
66
|
+
index: a,
|
|
67
|
+
columnIndex: f
|
|
68
|
+
})
|
|
69
|
+
], 2))), 128))
|
|
70
|
+
]),
|
|
71
|
+
_: 2
|
|
72
|
+
}, 1032, ["cols"]))), 128))
|
|
73
|
+
]),
|
|
74
|
+
_: 3
|
|
75
|
+
})
|
|
76
|
+
]),
|
|
77
|
+
_: 3
|
|
78
|
+
});
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
}), L = {
|
|
82
|
+
...y,
|
|
83
|
+
install(s) {
|
|
84
|
+
s.component("VMasonry", y);
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
export {
|
|
88
|
+
y as VMasonry,
|
|
89
|
+
L as default
|
|
90
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(l,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("vuetify")):typeof define=="function"&&define.amd?define(["exports","vue","vuetify"],e):(l=typeof globalThis<"u"?globalThis:l||self,e(l.VuetifyMasonry={},l.Vue,l.Vuetify))})(this,(function(l,e,p){"use strict";const c=e.defineComponent({__name:"VMasonry",props:{col:{},items:{default:()=>[]},xs:{},sm:{},md:{},lg:{},xl:{},xxl:{}},setup(i){const n=i,{xs:_,smAndUp:y,mdAndUp:k,lgAndUp:h,xlAndUp:g,xxl:B}=p.useDisplay(),a=e.computed(()=>{const r=t=>{if(t!==void 0)return typeof t=="string"?Number(t):t},o=(...t)=>{for(const m of t){const s=r(m);if(s!==void 0)return s}return 1};return B.value?o(n.xxl,n.xl,n.lg,n.md,n.sm,n.xs,n.col):g.value?o(n.xl,n.lg,n.md,n.sm,n.xs,n.col):h.value?o(n.lg,n.md,n.sm,n.xs,n.col):k.value?o(n.md,n.sm,n.xs,n.col):y.value?o(n.sm,n.xs,n.col):_.value?o(n.xs,n.col):o(n.col)}),C=e.computed(()=>{const r=Array.from({length:a.value},()=>[]);return n.items.forEach((o,t)=>{r[t%a.value].push(o)}),r});return(r,o)=>{const t=e.resolveComponent("v-col"),m=e.resolveComponent("v-row"),s=e.resolveComponent("v-container");return e.openBlock(),e.createBlock(s,{class:"pt-6"},{default:e.withCtx(()=>[e.createVNode(m,null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(C.value,(d,f)=>(e.openBlock(),e.createBlock(t,{key:f,cols:12/a.value},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d,(A,u)=>(e.openBlock(),e.createElementBlock("div",{key:u,class:e.normalizeClass({"mb-6":u!==d.length-1})},[e.renderSlot(r.$slots,"item",{item:A,index:u,columnIndex:f})],2))),128))]),_:2},1032,["cols"]))),128))]),_:3})]),_:3})}}}),x={...c,install(i){i.component("VMasonry",c)}};l.VMasonry=c,l.default=x,Object.defineProperties(l,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|
package/package.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "vuetify-masonry",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "A simple Vuetify-compatible masonry grid Vue 3 component",
|
|
5
|
+
"main": "dist/vuetify-masonry.umd.js",
|
|
6
|
+
"module": "dist/vuetify-masonry.es.js",
|
|
7
|
+
"types": "dist/types/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
11
|
+
"scripts": {
|
|
12
|
+
"dev": "vite",
|
|
13
|
+
"build": "vite build",
|
|
14
|
+
"lint": "eslint . --ext .ts,.vue"
|
|
15
|
+
},
|
|
16
|
+
"peerDependencies": {
|
|
17
|
+
"vue": "^3.2.0",
|
|
18
|
+
"vuetify": "^3.0.0"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@vitejs/plugin-vue": "^6.0.3",
|
|
22
|
+
"typescript": "^5.0.0",
|
|
23
|
+
"vite": "^7.3.0",
|
|
24
|
+
"vue": "^3.2.0",
|
|
25
|
+
"vuetify": "^3.0.0"
|
|
26
|
+
}
|
|
27
|
+
}
|