vuetify-masonry 0.2.2 → 0.2.4
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.
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export type NbMasonryColumns = 1 | 2 | 3 | 4 | 6 | 12;
|
|
2
|
+
export type ColProp = NbMasonryColumns | `${NbMasonryColumns}`;
|
|
3
|
+
declare const _default: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
4
|
+
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, never> & {
|
|
5
|
+
col?: ColProp;
|
|
6
|
+
items?: T[];
|
|
7
|
+
xs?: ColProp;
|
|
8
|
+
sm?: ColProp;
|
|
9
|
+
md?: ColProp;
|
|
10
|
+
lg?: ColProp;
|
|
11
|
+
xl?: ColProp;
|
|
12
|
+
xxl?: ColProp;
|
|
13
|
+
} & Partial<{}>> & import('vue').PublicProps;
|
|
14
|
+
expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
|
|
15
|
+
attrs: any;
|
|
16
|
+
slots: {
|
|
17
|
+
item?(_: {
|
|
18
|
+
item: T;
|
|
19
|
+
index: number;
|
|
20
|
+
columnIndex: number;
|
|
21
|
+
}): any;
|
|
22
|
+
};
|
|
23
|
+
emit: {};
|
|
24
|
+
}>) => import('vue').VNode & {
|
|
25
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
26
|
+
};
|
|
27
|
+
export default _default;
|
|
28
|
+
type __VLS_PrettifyLocal<T> = {
|
|
29
|
+
[K in keyof T]: T[K];
|
|
30
|
+
} & {};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { defineComponent as b, computed as f, createBlock as p, openBlock as n, unref as c, withCtx as i, createVNode as h, createElementBlock as d, Fragment as x, renderList as v, normalizeClass as B, renderSlot as M, createTextVNode as N } from "vue";
|
|
2
|
+
import { useDisplay as w } from "vuetify";
|
|
3
|
+
import { VContainer as E, VRow as z, VCol as D } from "vuetify/components";
|
|
4
|
+
const g = /* @__PURE__ */ b({
|
|
5
|
+
__name: "VMasonry",
|
|
6
|
+
props: {
|
|
7
|
+
col: {},
|
|
8
|
+
items: { default: () => [] },
|
|
9
|
+
xs: {},
|
|
10
|
+
sm: {},
|
|
11
|
+
md: {},
|
|
12
|
+
lg: {},
|
|
13
|
+
xl: {},
|
|
14
|
+
xxl: {}
|
|
15
|
+
},
|
|
16
|
+
setup(u) {
|
|
17
|
+
const e = u, {
|
|
18
|
+
xs: y,
|
|
19
|
+
smAndUp: V,
|
|
20
|
+
mdAndUp: A,
|
|
21
|
+
lgAndUp: C,
|
|
22
|
+
xlAndUp: U,
|
|
23
|
+
xxl: _
|
|
24
|
+
} = w(), a = f(() => {
|
|
25
|
+
const t = (l) => {
|
|
26
|
+
if (l !== void 0)
|
|
27
|
+
return typeof l == "string" ? Number(l) : l;
|
|
28
|
+
}, r = (...l) => {
|
|
29
|
+
for (const o of l) {
|
|
30
|
+
const s = t(o);
|
|
31
|
+
if (s !== void 0) return s;
|
|
32
|
+
}
|
|
33
|
+
return 1;
|
|
34
|
+
};
|
|
35
|
+
return _.value ? r(
|
|
36
|
+
e.xxl,
|
|
37
|
+
e.xl,
|
|
38
|
+
e.lg,
|
|
39
|
+
e.md,
|
|
40
|
+
e.sm,
|
|
41
|
+
e.xs,
|
|
42
|
+
e.col
|
|
43
|
+
) : U.value ? r(e.xl, e.lg, e.md, e.sm, e.xs, e.col) : C.value ? r(e.lg, e.md, e.sm, e.xs, e.col) : A.value ? r(e.md, e.sm, e.xs, e.col) : V.value ? r(e.sm, e.xs, e.col) : y.value ? r(e.xs, e.col) : r(e.col);
|
|
44
|
+
}), k = f(() => {
|
|
45
|
+
const t = Array.from({ length: a.value }, () => []);
|
|
46
|
+
return e.items.forEach((r, l) => {
|
|
47
|
+
t[l % a.value].push(r);
|
|
48
|
+
}), t;
|
|
49
|
+
});
|
|
50
|
+
return (t, r) => (n(), p(c(E), { class: "pt-6" }, {
|
|
51
|
+
default: i(() => [
|
|
52
|
+
h(c(z), null, {
|
|
53
|
+
default: i(() => [
|
|
54
|
+
(n(!0), d(x, null, v(k.value, (l, o) => (n(), p(c(D), {
|
|
55
|
+
key: o,
|
|
56
|
+
cols: 12 / a.value
|
|
57
|
+
}, {
|
|
58
|
+
default: i(() => [
|
|
59
|
+
(n(!0), d(x, null, v(l, (s, m) => (n(), d("div", {
|
|
60
|
+
key: m,
|
|
61
|
+
class: B({ "mb-6": m !== l.length - 1 })
|
|
62
|
+
}, [
|
|
63
|
+
M(t.$slots, "item", {
|
|
64
|
+
item: s,
|
|
65
|
+
index: m,
|
|
66
|
+
columnIndex: o
|
|
67
|
+
}, () => [
|
|
68
|
+
r[0] || (r[0] = N(' Please define a slot named "item" to render items ', -1))
|
|
69
|
+
])
|
|
70
|
+
], 2))), 128))
|
|
71
|
+
]),
|
|
72
|
+
_: 2
|
|
73
|
+
}, 1032, ["cols"]))), 128))
|
|
74
|
+
]),
|
|
75
|
+
_: 3
|
|
76
|
+
})
|
|
77
|
+
]),
|
|
78
|
+
_: 3
|
|
79
|
+
}));
|
|
80
|
+
}
|
|
81
|
+
}), R = {
|
|
82
|
+
...g,
|
|
83
|
+
install(u) {
|
|
84
|
+
u.component("VMasonry", g);
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
export {
|
|
88
|
+
g as VMasonry,
|
|
89
|
+
R as default
|
|
90
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(o,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):(o=typeof globalThis<"u"?globalThis:o||self,e(o.VuetifyMasonry={},o.Vue,o.Vuetify,o.Vuetify))})(this,(function(o,e,m,c){"use strict";const u=e.defineComponent({__name:"VMasonry",props:{col:{},items:{default:()=>[]},xs:{},sm:{},md:{},lg:{},xl:{},xxl:{}},setup(d){const t=d,{xs:x,smAndUp:y,mdAndUp:k,lgAndUp:V,xlAndUp:B,xxl:g}=m.useDisplay(),f=e.computed(()=>{const l=r=>{if(r!==void 0)return typeof r=="string"?Number(r):r},n=(...r)=>{for(const s of r){const i=l(s);if(i!==void 0)return i}return 1};return g.value?n(t.xxl,t.xl,t.lg,t.md,t.sm,t.xs,t.col):B.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,r)=>{l[r%f.value].push(n)}),l});return(l,n)=>(e.openBlock(),e.createBlock(e.unref(c.VContainer),{class:"pt-6"},{default:e.withCtx(()=>[e.createVNode(e.unref(c.VRow),null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h.value,(r,s)=>(e.openBlock(),e.createBlock(e.unref(c.VCol),{key:s,cols:12/f.value},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r,(i,a)=>(e.openBlock(),e.createElementBlock("div",{key:a,class:e.normalizeClass({"mb-6":a!==r.length-1})},[e.renderSlot(l.$slots,"item",{item:i,index:a,columnIndex:s},()=>[n[0]||(n[0]=e.createTextVNode(' Please define a slot named "item" to render items ',-1))])],2))),128))]),_:2},1032,["cols"]))),128))]),_:3})]),_:3}))}}),p={...u,install(d){d.component("VMasonry",u)}};o.VMasonry=u,o.default=p,Object.defineProperties(o,{__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.2.
|
|
3
|
+
"version": "0.2.4",
|
|
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",
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
},
|
|
23
23
|
"scripts": {
|
|
24
24
|
"dev": "vite",
|
|
25
|
+
"prepublishOnly": "npm run build",
|
|
25
26
|
"build": "vite build",
|
|
26
27
|
"lint": "eslint . --ext .ts,.vue",
|
|
27
28
|
"release": "semantic-release"
|