Skip to content

Commit e7939a8

Browse files
authored
Merge pull request #3 from codeeshop-oc/next
Update to Vue 3
2 parents eaa43df + 77ca184 commit e7939a8

18 files changed

+530
-670
lines changed

README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
> Vue Lightbox Advanced Photo Grid component for Vue.js
44
5-
[![npm](https://img.shields.io/badge/npm-1.0.0-blue)](https://www.npmjs.com/package/vue-lightbox-advanced)
6-
[![license](https://img.shields.io/badge/license-MIT-green)](https://github.com/codeeshop-oc/vue-lightbox-advanced/blob/vue2/LICENSE)
7-
[![bit](https://img.shields.io/badge/components-1-yellowgreen)](https://github.com/codeeshop-oc/vue-lightbox-advanced/blob/vue2/src/VueLightboxAdvanced.vue)
5+
[![npm](https://img.shields.io/badge/npm-2.0.0-blue)](https://www.npmjs.com/package/vue-lightbox-advanced)
6+
[![license](https://img.shields.io/badge/license-MIT-green)](https://github.com/codeeshop-oc/vue-lightbox-advanced/blob/main/LICENSE)
7+
[![bit](https://img.shields.io/badge/components-1-yellowgreen)](https://github.com/codeeshop-oc/vue-lightbox-advanced/blob/main/src/vue-lightbox-advanced.vue)
88
[![PRs welcome](https://img.shields.io/badge/PRs-welcome-ff69b4.svg)](https://github.com/codeeshop-oc/vue-lightbox-advanced/issues?&q=is%3Aissue+is%3Aopen)
99

1010
Vue Lightbox Advanced provides flexibility of displaying first x (1-5) images of your gallery in a grid view as you seen on Facebook timeline. Click on the thumbnail will return an event with the index or file url (src) as per passed props that can be used to show the image or can be used to redirect to that specific file url (src).
@@ -14,13 +14,13 @@ It provides the shuffling images according to given options in docs.
1414
1515
## Version Support
1616

17-
[Vue 3](https://github.com/codeeshop-oc/vue-lightbox-advanced/tree/main)
17+
Vue 3 - Current Branch
1818

19-
Vue 2 - Current branch
19+
[Vue 2](https://github.com/codeeshop-oc/vue-lightbox-advanced/tree/vue2)
2020

2121
## 🎨 Features
2222

23-
Find out all available features on [settings props](https://github.com/codeeshop-oc/vue-lightbox-advanced/blob/vue2/docs/API.md#props) and see how that works on [examples](https://codeeshop-oc.github.io/vue-lightbox-advanced/).
23+
Find out all available features on [settings props](https://github.com/codeeshop-oc/vue-lightbox-advanced/blob/main/docs/API.md#props) and see how that works on [examples](https://codeeshop-oc.github.io/vue-lightbox-advanced/).
2424

2525

2626
## 🚚 Installation
@@ -29,16 +29,16 @@ Find out all available features on [settings props](https://github.com/codeeshop
2929

3030
```bash
3131
# npm
32-
npm i vue-lightbox-advanced@1
32+
npm i vue-lightbox-advanced
3333
# yarn
34-
yarn add vue-lightbox-advanced@1
34+
yarn add vue-lightbox-advanced
3535
```
3636

3737
### cdn
3838

3939
```bash
4040
# latest
41-
https://unpkg.com/vue-lightbox-advanced@1
41+
https://unpkg.com/vue-lightbox-advanced
4242
```
4343

4444
<br/>
@@ -48,13 +48,13 @@ https://unpkg.com/vue-lightbox-advanced@1
4848
```html
4949
<template>
5050
<div style="height: 250px; width: 400px;">
51-
<VueLightboxAdvanced :items="images" />
51+
<vue-lightbox-advanced :items="images" />
5252
</div>
5353
</template>
5454

5555
<script>
5656
import VueLightboxAdvanced from 'vue-lightbox-advanced'
57-
import 'vue-lightbox-advanced/dist/VueLightboxAdvanced.css'
57+
import 'vue-lightbox-advanced/dist/vue-lightbox-advanced.css'
5858
5959
export default {
6060
name: 'MyComponent',
@@ -82,7 +82,7 @@ https://unpkg.com/vue-lightbox-advanced@1
8282

8383
## 🔖 License
8484

85-
This software is licensed under the [MIT](https://github.com/codeeshop-oc/vue-lightbox-advanced/blob/vue2/LICENSE).
85+
This software is licensed under the [MIT](https://github.com/codeeshop-oc/vue-lightbox-advanced/blob/main/LICENSE).
8686

8787
### Reference
8888

build/rollup.config.js

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@ import commonjs from '@rollup/plugin-commonjs';
77
import resolve from '@rollup/plugin-node-resolve';
88
import replace from '@rollup/plugin-replace';
99
import babel from '@rollup/plugin-babel';
10-
import scss from "rollup-plugin-scss";
11-
12-
10+
import PostCSS from 'rollup-plugin-postcss';
1311
import { terser } from 'rollup-plugin-terser';
1412
import minimist from 'minimist';
13+
import scss from "rollup-plugin-scss";
1514

1615
// Get browserslist config and remove ie from es build targets
1716
const esbrowserslist = fs.readFileSync('./.browserslistrc')
@@ -44,15 +43,20 @@ const baseConfig = {
4443
'process.env.NODE_ENV': JSON.stringify('production'),
4544
},
4645
vue: {
47-
css: false,
48-
template: {
49-
isProduction: true,
50-
},
5146
},
5247
postVue: [
5348
resolve({
5449
extensions: ['.js', '.jsx', '.ts', '.tsx', '.vue'],
5550
}),
51+
// Process only `<style module>` blocks.
52+
PostCSS({
53+
modules: {
54+
generateScopedName: '[local]___[hash:base64:5]',
55+
},
56+
include: /&module=.*\.css$/,
57+
}),
58+
// Process all `<style>` blocks except `<style module>`.
59+
PostCSS({ include: /(?<!&module=.*)\.css$/ }),
5660
commonjs(),
5761
],
5862
babel: {
@@ -86,7 +90,7 @@ const cssConfig = {
8690
input: 'src/styles.js',
8791
plugins: [
8892
scss({
89-
output: 'dist/VueLightboxAdvanced.css',
93+
output: 'dist/vue-lightbox-advanced.css',
9094
outputStyle: "compressed",
9195
})
9296
],
@@ -100,7 +104,7 @@ if (!argv.format || argv.format === 'es') {
100104
input: 'src/entry.esm.js',
101105
external,
102106
output: {
103-
file: 'dist/VueLightboxAdvanced.esm.js',
107+
file: 'dist/vue-lightbox-advanced.esm.js',
104108
format: 'esm',
105109
exports: 'named',
106110
},
@@ -132,7 +136,7 @@ if (!argv.format || argv.format === 'cjs') {
132136
external,
133137
output: {
134138
compact: true,
135-
file: 'dist/VueLightboxAdvanced.ssr.js',
139+
file: 'dist/vue-lightbox-advanced.ssr.js',
136140
format: 'cjs',
137141
name: 'VueLightboxAdvanced',
138142
exports: 'auto',
@@ -141,13 +145,7 @@ if (!argv.format || argv.format === 'cjs') {
141145
plugins: [
142146
replace(baseConfig.plugins.replace),
143147
...baseConfig.plugins.preVue,
144-
vue({
145-
...baseConfig.plugins.vue,
146-
template: {
147-
...baseConfig.plugins.vue.template,
148-
optimizeSSR: true,
149-
},
150-
}),
148+
vue(baseConfig.plugins.vue),
151149
...baseConfig.plugins.postVue,
152150
babel(baseConfig.plugins.babel),
153151
],
@@ -161,7 +159,7 @@ if (!argv.format || argv.format === 'iife') {
161159
external,
162160
output: {
163161
compact: true,
164-
file: 'dist/VueLightboxAdvanced.min.js',
162+
file: 'dist/vue-lightbox-advanced.min.js',
165163
format: 'iife',
166164
name: 'VueLightboxAdvanced',
167165
exports: 'auto',
@@ -184,4 +182,4 @@ if (!argv.format || argv.format === 'iife') {
184182
}
185183

186184
// Export config
187-
export default buildFormats;
185+
export default buildFormats;

dev/serve.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
import Vue from 'vue';
1+
import { createApp } from 'vue';
22
import Dev from './serve.vue';
33

4-
Vue.config.productionTip = false;
5-
6-
new Vue({
7-
render: (h) => h(Dev),
8-
}).$mount('#app');
4+
const app = createApp(Dev);
5+
app.mount('#app');

dev/serve.vue

Lines changed: 84 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,106 @@
11
<script>
2-
import Vue from 'vue';
3-
import VueLightboxAdvanced from '@/VueLightboxAdvanced.vue';
4-
import '@/VueLightboxAdvanced.css';
2+
import { defineComponent } from 'vue';
3+
import VueLightboxAdvanced from '@/vue-lightbox-advanced.vue';
4+
import '@/vue-lightbox-advanced.css';
55
6-
export default Vue.extend({
6+
export default defineComponent({
77
name: 'ServeDev',
88
data() {
99
return {
1010
images: [
11-
"https://i.wifegeek.com/200426/f9459c52.jpg",
12-
"https://i.wifegeek.com/200426/5ce1e1c7.jpg",
13-
"https://i.wifegeek.com/200426/5fa51df3.jpg",
14-
"https://i.wifegeek.com/200426/663181fe.jpg",
15-
"https://i.wifegeek.com/200426/2d110780.jpg",
16-
"https://i.wifegeek.com/200426/e73cd3fa.jpg",
17-
"https://i.wifegeek.com/200426/15160d6e.jpg",
18-
"https://i.wifegeek.com/200426/d0c881ae.jpg",
19-
"https://i.wifegeek.com/200426/a154fc3d.jpg",
20-
"https://i.wifegeek.com/200426/71d3aa60.jpg",
21-
"https://i.wifegeek.com/200426/d17ce9a0.jpg",
22-
"https://i.wifegeek.com/200426/7c4deca9.jpg",
23-
"https://i.wifegeek.com/200426/64672676.jpg",
24-
"https://i.wifegeek.com/200426/de6ab9c6.jpg",
25-
"https://i.wifegeek.com/200426/d8bcb6a7.jpg",
26-
"https://i.wifegeek.com/200426/4085d03b.jpg",
27-
"https://i.wifegeek.com/200426/177ef44c.jpg",
28-
"https://i.wifegeek.com/200426/d74d9040.jpg",
29-
"https://i.wifegeek.com/200426/81e24a47.jpg",
30-
"https://i.wifegeek.com/200426/43e2e8bb.jpg"
11+
"https://cdn.pixabay.com/photo/2015/09/17/14/24/woman-944261_960_720.jpg",
12+
"https://cdn.pixabay.com/photo/2015/10/30/20/13/boat-1014711_960_720.jpg",
13+
"https://cdn.pixabay.com/photo/2017/10/17/16/10/fantasy-2861107_960_720.jpg",
14+
"https://cdn.pixabay.com/photo/2016/05/11/16/32/bridge-1385938_960_720.jpg",
15+
"https://cdn.pixabay.com/photo/2018/09/19/23/03/sunset-3689760_960_720.jpg",
16+
"https://cdn.pixabay.com/photo/2020/09/15/09/10/church-5573087_960_720.jpg",
17+
"https://cdn.pixabay.com/photo/2017/05/04/12/43/zebra-2283914_960_720.jpg",
18+
"https://cdn.pixabay.com/photo/2018/01/25/14/12/nature-3106213_960_720.jpg",
19+
"https://cdn.pixabay.com/photo/2017/12/10/15/16/white-horse-3010129_960_720.jpg",
20+
"https://cdn.pixabay.com/photo/2017/06/07/10/47/elephant-2380009_960_720.jpg",
21+
"https://cdn.pixabay.com/photo/2017/05/09/03/46/alberta-2297204_960_720.jpg",
22+
"https://cdn.pixabay.com/photo/2017/01/18/17/14/girl-1990347_960_720.jpg",
23+
"https://cdn.pixabay.com/photo/2018/01/22/14/13/animal-3099035_960_720.jpg",
24+
"https://cdn.pixabay.com/photo/2015/10/30/20/13/boat-1014711_960_720.jpg",
25+
"https://cdn.pixabay.com/photo/2016/11/14/04/45/elephant-1822636_960_720.jpg",
26+
"https://cdn.pixabay.com/photo/2016/11/08/05/26/woman-1807533_960_720.jpg"
3127
]
3228
}
3329
},
3430
components: {
3531
VueLightboxAdvanced
3632
},
3733
methods: {
38-
eventEmitted(index) {
34+
onClicked(v) {
3935
console.log(`Event Emmited....`)
40-
console.log(`Return Value: ${index}`)
41-
}
36+
console.log(`Return Index: ${v}`)
37+
},
38+
onClickedSrc(v) {
39+
console.log(`Event Emmited....`)
40+
console.log(`Return Value: ${v}`)
41+
},
4242
}
4343
});
4444
</script>
4545

4646
<template>
47-
<div id="app">
48-
<div style="height: 250px; width: 400px;">
49-
<VueLightboxAdvanced :returnSrc="true" :items="images" @clicked:index="eventEmitted" />
47+
<div class="bgimg w3-display-container w3-animate-opacity w3-text-white">
48+
<div id="app">
49+
<h3>Default</h3>
50+
<div class="fixheight">
51+
<vue-lightbox-advanced :items="images" />
52+
</div>
53+
54+
<h3>With Shuffle ( RANDOM )</h3>
55+
<div class="fixheight">
56+
<vue-lightbox-advanced :shuffle=true shuffle-by="RANDOM" :items="images" />
57+
</div>
58+
59+
<h3>With 3 column</h3>
60+
<div class="fixheight">
61+
<vue-lightbox-advanced :cells="3" :items="images" :shuffle=true shuffle-by="DESC" />
62+
</div>
63+
64+
<h3>With Event</h3>
65+
<div class="fixheight">
66+
<vue-lightbox-advanced @clicked:index="onClicked" :items="images" />
67+
</div>
68+
69+
<h3>With SRC</h3>
70+
<div class="fixheight">
71+
<vue-lightbox-advanced :return-src="true" @clicked:index="onClickedSrc" :items="images" />
72+
</div>
5073
</div>
5174
</div>
5275
</template>
76+
77+
<style>
78+
body {
79+
font-family: 'Caveat';
80+
}
81+
.text-center {
82+
text-align: center;
83+
/*margin: auto;*/
84+
}
85+
.fixheight {
86+
width: 550px;
87+
}
88+
#app {
89+
margin: auto;
90+
}
91+
@media (min-width: 601px) {
92+
#app {
93+
display: table;
94+
}
95+
}
96+
@media (max-width: 800px) {
97+
.fixheight {
98+
width: 450px;
99+
}
100+
}
101+
@media (max-width: 600px) {
102+
.fixheight {
103+
width: 100%;
104+
}
105+
}
106+
</style>

0 commit comments

Comments
 (0)