@gorse/shards-vue 1.0.8 → 2.0.0
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 +8 -5
- package/build/optimize.js +27 -15
- package/build/rollup.config.js +28 -38
- package/dist/shards-vue.common.js +3639 -6083
- package/dist/shards-vue.common.js.map +1 -1
- package/dist/shards-vue.common.min.js +27 -1
- package/dist/shards-vue.common.min.map +1 -1
- package/dist/shards-vue.esm.js +3637 -6081
- package/dist/shards-vue.esm.js.map +1 -1
- package/dist/shards-vue.esm.min.js +27 -1
- package/dist/shards-vue.esm.min.map +1 -1
- package/dist/shards-vue.umd.js +3641 -6086
- package/dist/shards-vue.umd.js.map +1 -1
- package/dist/shards-vue.umd.min.js +27 -1
- package/dist/shards-vue.umd.min.map +1 -1
- package/package.json +24 -25
- package/sandbox/Sandbox.vue +1 -17
- package/sandbox/index.html +12 -0
- package/sandbox/main.js +7 -0
- package/sandbox/vite.config.js +6 -0
- package/src/components/alert/Alert.vue +20 -11
- package/src/components/button/Button.vue +1 -0
- package/src/components/button/ButtonClose.vue +1 -0
- package/src/components/collapse/Collapse.vue +17 -9
- package/src/components/datepicker/Datepicker.vue +335 -36
- package/src/components/datepicker/README.md +1 -1
- package/src/components/dropdown/Dropdown.vue +9 -10
- package/src/components/form-checkbox/FormCheckbox.vue +52 -39
- package/src/components/form-input/FormInput.vue +13 -4
- package/src/components/form-radio/FormRadio.vue +15 -9
- package/src/components/form-select/FormSelect.vue +11 -2
- package/src/components/form-textarea/FormTextarea.vue +50 -22
- package/src/components/input-group/README.md +24 -12
- package/src/components/link/Link.vue +4 -8
- package/src/components/modal/Modal.vue +6 -4
- package/src/components/modal/README.md +2 -2
- package/src/components/navbar/NavbarToggle.vue +1 -1
- package/src/components/navbar/README.md +5 -3
- package/src/components/popover/Popover.vue +3 -2
- package/src/components/popover/README.md +3 -3
- package/src/components/slider/Slider.vue +13 -4
- package/src/components/tabs/Tab.vue +19 -2
- package/src/components/tabs/Tabs.vue +42 -6
- package/src/components/tabs/_TabButton.vue +1 -0
- package/src/components/tooltip/Tooltip.vue +3 -1
- package/src/directives/click-away.js +39 -0
- package/src/directives/toggle/toggle.js +12 -7
- package/src/directives/tooltip/tooltip.js +6 -11
- package/src/index.js +8 -6
- package/src/markdown/getting-started/README.md +6 -4
- package/src/mixins/checkbox-radio.mixin.js +5 -6
- package/src/mixins/root-listener.mixin.js +12 -6
- package/src/mixins/tooltip-popover.mixin.js +1 -1
- package/src/utils/events.js +66 -0
- package/src/utils/index.js +20 -18
- package/src/utils/target.js +23 -9
package/README.md
CHANGED
|
@@ -56,14 +56,15 @@ npm i @gorse/shards-vue
|
|
|
56
56
|
If you are using a module bundler such as [Webpack](https://webpack.js.org/) or [Rollup](https://rollupjs.org/), you can include the entire Shards Vue library inside your project.
|
|
57
57
|
|
|
58
58
|
```javascript
|
|
59
|
-
import
|
|
59
|
+
import { createApp } from 'vue'
|
|
60
60
|
import ShardsVue from '@gorse/shards-vue'
|
|
61
|
+
import App from './App.vue'
|
|
61
62
|
|
|
62
63
|
// Import base styles (Bootstrap and Shards)
|
|
63
64
|
import 'bootstrap/dist/css/bootstrap.css'
|
|
64
65
|
import '@gorse/shards-ui/dist/css/shards.css'
|
|
65
66
|
|
|
66
|
-
|
|
67
|
+
createApp(App).use(ShardsVue).mount('#app')
|
|
67
68
|
```
|
|
68
69
|
|
|
69
70
|
<br />
|
|
@@ -73,14 +74,16 @@ Vue.use(ShardsVue);
|
|
|
73
74
|
If you'd like to register only certain components as Vue plugins, make sure to import just the component you'd like to use.
|
|
74
75
|
|
|
75
76
|
```javascript
|
|
76
|
-
import
|
|
77
|
+
import { createApp } from 'vue'
|
|
78
|
+
import App from './App.vue'
|
|
77
79
|
|
|
78
80
|
// Import base styles (Bootstrap and Shards)
|
|
79
81
|
import 'bootstrap/dist/css/bootstrap.css'
|
|
80
82
|
import '@gorse/shards-ui/dist/css/shards.css'
|
|
81
83
|
|
|
82
84
|
import { Button } from '@gorse/shards-vue/src/components'
|
|
83
|
-
|
|
85
|
+
|
|
86
|
+
createApp(App).use(Button).mount('#app')
|
|
84
87
|
|
|
85
88
|
```
|
|
86
89
|
|
|
@@ -129,7 +132,7 @@ You can also run `pnpm bundlesize` at any time to check the compiled file sizes.
|
|
|
129
132
|
|
|
130
133
|
* [Shards UI Kit](https://designrevision.com/downloads/shards/)
|
|
131
134
|
* [noUiSlider by Léon Gersen (WTFPL License)](https://refreshless.com/nouislider/download/)
|
|
132
|
-
* [
|
|
135
|
+
* [Vue Datepicker](https://vue3datepicker.com/)
|
|
133
136
|
|
|
134
137
|
<br />
|
|
135
138
|
|
package/build/optimize.js
CHANGED
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const path = require('path')
|
|
4
4
|
const fs = require('fs')
|
|
5
|
-
const
|
|
6
|
-
const UglifyJS = require('uglify-js')
|
|
7
|
-
const UglifyES = require('uglify-es')
|
|
5
|
+
const { minify } = require('terser')
|
|
8
6
|
const PATHS = require('./paths')
|
|
9
7
|
|
|
10
8
|
function stripTrailingWhitespace(content) {
|
|
@@ -14,20 +12,16 @@ function stripTrailingWhitespace(content) {
|
|
|
14
12
|
.replace(/[ \t]+$/gm, '')
|
|
15
13
|
}
|
|
16
14
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
async function optimize() {
|
|
16
|
+
const files = fs.readdirSync(PATHS.DIST)
|
|
17
|
+
.filter(file => file.endsWith('.js') && file.indexOf('.min.js') === -1)
|
|
18
|
+
.map(file => path.resolve(PATHS.DIST, file))
|
|
21
19
|
|
|
22
|
-
|
|
20
|
+
for (const file of files) {
|
|
23
21
|
if (path.basename(file).indexOf('.min.js') !== -1) {
|
|
24
|
-
|
|
22
|
+
continue
|
|
25
23
|
}
|
|
26
24
|
|
|
27
|
-
const Uglifier = path.basename(file).indexOf('.esm.js') !== -1
|
|
28
|
-
? UglifyES
|
|
29
|
-
: UglifyJS
|
|
30
|
-
|
|
31
25
|
// Define minified file path
|
|
32
26
|
let minFilePath = path.basename(file).replace('.js', '.min.js')
|
|
33
27
|
minFilePath = path.resolve(PATHS.DIST + '/' + minFilePath)
|
|
@@ -40,10 +34,28 @@ glob(path.resolve(PATHS.DIST + '/*.js'), {}, function(err, files) {
|
|
|
40
34
|
let _c = fs.readFileSync(file, 'utf8')
|
|
41
35
|
_c = stripTrailingWhitespace(_c)
|
|
42
36
|
fs.writeFileSync(file, _c)
|
|
43
|
-
|
|
37
|
+
const sourceMapPath = `${file}.map`
|
|
38
|
+
const sourceMapContent = fs.existsSync(sourceMapPath)
|
|
39
|
+
? fs.readFileSync(sourceMapPath, 'utf8')
|
|
40
|
+
: null
|
|
41
|
+
|
|
42
|
+
_c = await minify(_c, {
|
|
43
|
+
compress: true,
|
|
44
|
+
mangle: true,
|
|
45
|
+
sourceMap: {
|
|
46
|
+
content: sourceMapContent,
|
|
47
|
+
filename: path.basename(minFilePath),
|
|
48
|
+
url: path.basename(minMapPath)
|
|
49
|
+
}
|
|
50
|
+
})
|
|
44
51
|
|
|
45
52
|
// Write minified file and sourcemap
|
|
46
53
|
fs.writeFileSync(minFilePath, _c.code)
|
|
47
54
|
fs.writeFileSync(minMapPath, _c.map)
|
|
48
|
-
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
optimize().catch(err => {
|
|
59
|
+
console.error(err)
|
|
60
|
+
process.exit(1)
|
|
49
61
|
})
|
package/build/rollup.config.js
CHANGED
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
3
|
+
const path = require('path')
|
|
4
|
+
const vuePlugin = require('rollup-plugin-vue')
|
|
5
|
+
const { nodeResolve } = require('@rollup/plugin-node-resolve')
|
|
6
|
+
const commonjs = require('@rollup/plugin-commonjs')
|
|
7
|
+
const postcss = require('rollup-plugin-postcss')
|
|
8
|
+
const {
|
|
9
|
+
name: packageName,
|
|
10
|
+
dependencies = {},
|
|
11
|
+
peerDependencies = {},
|
|
12
|
+
version
|
|
13
|
+
} = require('../package.json')
|
|
12
14
|
|
|
13
15
|
const PATHS = require('./paths')
|
|
14
16
|
|
|
15
17
|
const [major, minor] = process.versions.node.split('.').map(parseFloat)
|
|
16
18
|
if (major < 7 || (major === 7 && minor <= 5)) {
|
|
17
|
-
|
|
19
|
+
console.error('Node 7.6+ is required.')
|
|
18
20
|
process.exit()
|
|
19
21
|
}
|
|
20
22
|
|
|
@@ -39,43 +41,32 @@ const banner = `/*
|
|
|
39
41
|
*/`
|
|
40
42
|
|
|
41
43
|
const globals = {
|
|
44
|
+
vue: 'Vue',
|
|
42
45
|
bootstrap: 'bootstrap',
|
|
43
46
|
nouislider: 'noUiSlider',
|
|
44
47
|
'@gorse/shards-ui': 'Shards',
|
|
45
|
-
'vue-
|
|
46
|
-
'vuejs-datepicker': 'VueDatepicker'
|
|
48
|
+
'@vuepic/vue-datepicker': 'VueDatePicker'
|
|
47
49
|
}
|
|
48
50
|
|
|
49
51
|
module.exports = {
|
|
50
52
|
input: PATHS.INPUT,
|
|
51
|
-
external: Object.keys(dependencies).filter(dep => {
|
|
53
|
+
external: Object.keys({ ...dependencies, ...peerDependencies }).filter(dep => {
|
|
52
54
|
return ['popper.js', 'lodash.xor'].indexOf(dep) === -1
|
|
53
55
|
}),
|
|
54
56
|
plugins: [
|
|
55
57
|
vuePlugin({
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
preprocessOptions: {
|
|
59
|
-
scss: {
|
|
60
|
-
silenceDeprecations: ['legacy-js-api']
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
},
|
|
64
|
-
cssModules: {
|
|
58
|
+
preprocessStyles: true,
|
|
59
|
+
cssModulesOptions: {
|
|
65
60
|
generateScopedName: '[name]__[local]'
|
|
66
|
-
},
|
|
67
|
-
css(style) {
|
|
68
|
-
fs.writeFileSync(
|
|
69
|
-
path.resolve(PATHS.DIST, `${bundleName}.css`),
|
|
70
|
-
new cleanCSS().minify(style).styles
|
|
71
|
-
)
|
|
72
61
|
}
|
|
73
62
|
}),
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
})
|
|
63
|
+
postcss({
|
|
64
|
+
sourceMap: true,
|
|
65
|
+
minimize: false,
|
|
66
|
+
inject: true
|
|
67
|
+
}),
|
|
68
|
+
nodeResolve(),
|
|
69
|
+
commonjs()
|
|
79
70
|
],
|
|
80
71
|
output: [
|
|
81
72
|
{
|
|
@@ -83,22 +74,21 @@ module.exports = {
|
|
|
83
74
|
format: 'cjs',
|
|
84
75
|
name: camelize(bundleName),
|
|
85
76
|
file: path.resolve(PATHS.DIST, bundleName + '.common.js'),
|
|
86
|
-
sourcemap: true
|
|
77
|
+
sourcemap: true,
|
|
78
|
+
exports: 'named'
|
|
87
79
|
},
|
|
88
80
|
{
|
|
89
81
|
banner,
|
|
90
82
|
format: 'umd',
|
|
91
83
|
name: camelize(bundleName),
|
|
92
|
-
modulename: camelize(bundleName),
|
|
93
84
|
globals,
|
|
94
85
|
file: path.resolve(PATHS.DIST, bundleName + '.umd.js'),
|
|
95
|
-
sourcemap: true
|
|
86
|
+
sourcemap: true,
|
|
87
|
+
exports: 'named'
|
|
96
88
|
},
|
|
97
89
|
{
|
|
98
90
|
banner,
|
|
99
91
|
format: 'es',
|
|
100
|
-
name: camelize(bundleName),
|
|
101
|
-
modulename: camelize(bundleName),
|
|
102
92
|
file: path.resolve(PATHS.DIST, bundleName + '.esm.js'),
|
|
103
93
|
sourcemap: true
|
|
104
94
|
}
|