slim-select 2.0.0 → 2.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/.github/ISSUE_TEMPLATE/issue-report.md +3 -3
- package/README.md +17 -20
- package/dist/settings.d.ts +1 -1
- package/dist/slimselect.js +1 -1
- package/dist/slimselect.js.map +1 -1
- package/dist/store.d.ts +5 -5
- package/docs/assets/home.js +1 -1
- package/docs/assets/index.js +7 -7
- package/docs/assets/install.js +7 -7
- package/package.json +1 -1
- package/src/docs/app.vue +15 -1
- package/src/docs/pages/home.vue +47 -13
- package/src/docs/pages/install.vue +6 -2
- package/src/slim-select/rollup.config.mjs +2 -1
- package/src/slim-select/webpack.config.js +0 -73
package/docs/assets/install.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{e as N,d as $,_ as O,o as V,c as I,a as n,f as
|
|
1
|
+
import{e as N,d as $,_ as O,o as V,c as I,a as n,f as B,t as R,b as M}from"./index.js";var U={exports:{}};(function(d,y){(function(w,g){d.exports=g()})(N,function(){return function w(g,j,_){var o=window,p="application/octet-stream",c=_||p,e=g,a=!j&&!_&&e,s=document.createElement("a"),k=function(t){return String(t)},i=o.Blob||o.MozBlob||o.WebKitBlob||k,m=j||"download",l,S;if(i=i.call?i.bind(o):Blob,String(this)==="true"&&(e=[e,c],c=e[0],e=e[1]),a&&a.length<2048&&(m=a.split("/").pop().split("?")[0],s.href=a,s.href.indexOf(a)!==-1)){var u=new XMLHttpRequest;return u.open("GET",a,!0),u.responseType="blob",u.onload=function(t){w(t.target.response,m,p)},setTimeout(function(){u.send()},0),u}if(/^data:([\w+-]+\/[\w+.-]+)?[,;]/.test(e))if(e.length>1024*1024*1.999&&i!==k)e=C(e),c=e.type||p;else return navigator.msSaveBlob?navigator.msSaveBlob(C(e),m):f(e);else if(/([\x80-\xff])/.test(e)){var b=0,x=new Uint8Array(e.length),A=x.length;for(b;b<A;++b)x[b]=e.charCodeAt(b);e=new i([x],{type:c})}l=e instanceof i?e:new i([e],{type:c});function C(t){var r=t.split(/[:;,]/),h=r[1],E=r[2]=="base64"?atob:decodeURIComponent,T=E(r.pop()),D=T.length,v=0,L=new Uint8Array(D);for(v;v<D;++v)L[v]=T.charCodeAt(v);return new i([L],{type:h})}function f(t,r){if("download"in s)return s.href=t,s.setAttribute("download",m),s.className="download-js-link",s.innerHTML="downloading...",s.style.display="none",document.body.appendChild(s),setTimeout(function(){s.click(),document.body.removeChild(s),r===!0&&setTimeout(function(){o.URL.revokeObjectURL(s.href)},250)},66),!0;if(/(Version)\/(\d+)\.(\d+)(?:\.(\d+))?.*Safari\//.test(navigator.userAgent))return/^data:/.test(t)&&(t="data:"+t.replace(/^data:([\w\/\-\+]+)/,p)),window.open(t)||confirm(`Displaying New Document
|
|
2
2
|
|
|
3
|
-
Use Save As... to download, then click back to return to this page.`)&&(location.href=t),!0;var h=document.createElement("iframe");document.body.appendChild(h),!r&&/^data:/.test(t)&&(t="data:"+t.replace(/^data:([\w\/\-\+]+)/,p)),h.src=t,setTimeout(function(){document.body.removeChild(h)},333)}if(navigator.msSaveBlob)return navigator.msSaveBlob(l,m);if(o.URL)f(o.URL.createObjectURL(l),!0);else{if(typeof l=="string"||l.constructor===k)try{return f("data:"+c+";base64,"+o.btoa(l))}catch{return f("data:"+c+","+encodeURIComponent(l))}S=new FileReader,S.onload=function(t){f(this.result)},S.readAsDataURL(l)}return!0}})})(U);const H=U.exports,G="slim-select",q="Slim advanced select dropdown",z="
|
|
3
|
+
Use Save As... to download, then click back to return to this page.`)&&(location.href=t),!0;var h=document.createElement("iframe");document.body.appendChild(h),!r&&/^data:/.test(t)&&(t="data:"+t.replace(/^data:([\w\/\-\+]+)/,p)),h.src=t,setTimeout(function(){document.body.removeChild(h)},333)}if(navigator.msSaveBlob)return navigator.msSaveBlob(l,m);if(o.URL)f(o.URL.createObjectURL(l),!0);else{if(typeof l=="string"||l.constructor===k)try{return f("data:"+c+";base64,"+o.btoa(l))}catch{return f("data:"+c+","+encodeURIComponent(l))}S=new FileReader,S.onload=function(t){f(this.result)},S.readAsDataURL(l)}return!0}})})(U);const H=U.exports,G="slim-select",q="Slim advanced select dropdown",z="2.0.0",J="Brian Voelker <brian@webiswhatido.com> (http://webiswhatido.com)",K="https://slimselectjs.com",W="MIT",X={url:"https://github.com/brianvoe/slim-select/issues"},F="dist/slimselect.js",P="dist/slimselect.es.js",Q="dist/slimselect.js",Y="dist/index.d.ts",Z="dist/index.d.ts",ee="dist/slimselect.css",te="src/slim-select/slimselect.scss",se={type:"git",url:"git+https://github.com/brianvoe/slim-select.git"},ne=["select","vanilla","dropdown","search","multiselect"],oe={jestinit:"ts-jest config:init",dev:"vite --port=1111",format:'prettier --write --cache --parser typescript "src/**/*.ts"',build:"npm run build:clean && npm run build:docs && npm run build:library","build:clean":"rimraf ./dist/*","build:docs":"vite build","build:library":"npm run build:library:js && npm run build:library:css","build:library:js":"cd src/slim-select && rollup --config ./rollup.config.mjs && cd ../../","build:library:css":"cd src/slim-select && sass ./slimselect.scss ../../dist/slimselect.css --style=compressed && cd ../../",test:"jest"},ie={"@jest/globals":"^29.3.1","@rollup/plugin-typescript":"^9.0.2","@types/downloadjs":"^1.4.3","@vitejs/plugin-vue":"^3.2.0",clipboard:"^2.0.11",downloadjs:"^1.4.7",jest:"^29.3.1","jest-environment-jsdom":"^29.3.1",prettier:"^2.7.1",prismjs:"^1.29.0",rimraf:"^3.0.2",rollup:"^2.79.1","rollup-plugin-terser":"^7.0.2",sass:"^1.56.1","ts-jest":"^29.0.3",tslib:"^2.4.1",typescript:"^4.9.3",vite:"^3.2.4",vue:"^3.2.45","vue-router":"^4.1.6","vue-tsc":"^1.0.9",vuex:"^4.0.2"},le={name:G,description:q,version:z,author:J,homepage:K,license:W,bugs:X,main:F,module:P,unpkg:Q,types:Y,typings:Z,style:ee,sass:te,repository:se,keywords:ne,scripts:oe,devDependencies:ie},ce=$({name:"Install",data:()=>({version:le.version}),methods:{downloadLink(){H(`https://cdnjs.cloudflare.com/ajax/libs/slim-select/${this.version}/slimselect.min.js`)}}}),ae={id:"install",class:"contents"},re=M(`<div id="npm" class="content"><h2>Npm</h2><p>Most common usage is npm</p><pre class="install-code"> <code class="language-bash">
|
|
4
4
|
npm install slim-select
|
|
5
5
|
</code>
|
|
6
6
|
</pre><pre class="example-code"> <code class="language-javascript">
|
|
@@ -10,11 +10,11 @@ Use Save As... to download, then click back to return to this page.`)&&(location
|
|
|
10
10
|
select: '#selectElement'
|
|
11
11
|
})
|
|
12
12
|
</code>
|
|
13
|
-
</pre></div>`,1),de={id:"cdn",class:"content"},pe=n("h2",null,"Cdn",-1),me=n("p",null,"Cdn has a url link you can grab.",-1),ue=n("div",{class:"alert info"},"New releases may be delayed until the next time its indexed",-1),
|
|
13
|
+
</pre></div>`,1),de={id:"cdn",class:"content"},pe=n("h2",null,"Cdn",-1),me=n("p",null,"Cdn has a url link you can grab.",-1),ue=n("p",null,[B(" See full list of available options. "),n("a",{target:"_blank",href:"https://cdnjs.com/libraries/slim-select"},"cdnjs.com/libraries/slim-select")],-1),be=n("div",{class:"alert info"},"New releases may be delayed until the next time its indexed",-1),fe={class:"install-code"},he={class:"language-html"},ve={id:"download",class:"content"},ge=n("h2",null,"Download",-1),ye=n("p",null,"Download the latest minified version of slim select",-1);function we(d,y,w,g,j,_){return V(),I("div",ae,[re,n("div",de,[pe,me,ue,be,n("pre",fe,[B(" "),n("code",he,`
|
|
14
14
|
<html>
|
|
15
15
|
<head>
|
|
16
|
-
<script src="https://cdnjs.cloudflare.com/ajax/libs/slim-select/`+R(d.version)+`/slimselect.
|
|
17
|
-
<link href="https://cdnjs.cloudflare.com/ajax/libs/slim-select/`+R(d.version)+`/slimselect.
|
|
16
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/slim-select/`+R(d.version)+`/slimselect.js"><\/script>
|
|
17
|
+
<link href="https://cdnjs.cloudflare.com/ajax/libs/slim-select/`+R(d.version)+`/slimselect.css" rel="stylesheet"></link>
|
|
18
18
|
|
|
19
19
|
<script>
|
|
20
20
|
new SlimSelect({
|
|
@@ -30,5 +30,5 @@ Use Save As... to download, then click back to return to this page.`)&&(location
|
|
|
30
30
|
</select>
|
|
31
31
|
</body>
|
|
32
32
|
</html>
|
|
33
|
-
`,1),
|
|
34
|
-
`)])]),n("div",
|
|
33
|
+
`,1),B(`
|
|
34
|
+
`)])]),n("div",ve,[ge,ye,n("div",{class:"btn",onClick:y[0]||(y[0]=o=>d.downloadLink())},"Click Here To Download")])])}const _e=O(ce,[["render",we]]);export{_e as default};
|
package/package.json
CHANGED
package/src/docs/app.vue
CHANGED
|
@@ -88,6 +88,18 @@ export default defineComponent({
|
|
|
88
88
|
})
|
|
89
89
|
|
|
90
90
|
this.$router.afterEach(() => {
|
|
91
|
+
if (this.$route.query.p) {
|
|
92
|
+
// Delay router push to allow for
|
|
93
|
+
// other things to happen first
|
|
94
|
+
setTimeout(() => {
|
|
95
|
+
if (this.$route.query.p) {
|
|
96
|
+
this.$router.push({ path: this.$route.query.p.toString(), hash: this.$route.hash })
|
|
97
|
+
}
|
|
98
|
+
}, 200)
|
|
99
|
+
|
|
100
|
+
return
|
|
101
|
+
}
|
|
102
|
+
|
|
91
103
|
// After route change get the hash and scroll to element in main
|
|
92
104
|
setTimeout(() => {
|
|
93
105
|
const hash = this.$route.hash
|
|
@@ -113,7 +125,7 @@ export default defineComponent({
|
|
|
113
125
|
})
|
|
114
126
|
}
|
|
115
127
|
}
|
|
116
|
-
},
|
|
128
|
+
}, 200)
|
|
117
129
|
})
|
|
118
130
|
|
|
119
131
|
this.setDemensions()
|
|
@@ -121,6 +133,8 @@ export default defineComponent({
|
|
|
121
133
|
},
|
|
122
134
|
unmounted() {
|
|
123
135
|
window.removeEventListener('resize', this.navDebounce)
|
|
136
|
+
|
|
137
|
+
this.nav?.destroy()
|
|
124
138
|
},
|
|
125
139
|
watch: {
|
|
126
140
|
width() {
|
package/src/docs/pages/home.vue
CHANGED
|
@@ -5,44 +5,78 @@ import SlimSelect from '../../slim-select'
|
|
|
5
5
|
|
|
6
6
|
export default defineComponent({
|
|
7
7
|
name: 'Home',
|
|
8
|
+
data() {
|
|
9
|
+
return {
|
|
10
|
+
single: null as SlimSelect | null,
|
|
11
|
+
multiple: null as SlimSelect | null,
|
|
12
|
+
}
|
|
13
|
+
},
|
|
8
14
|
mounted() {
|
|
9
|
-
|
|
15
|
+
this.single = new SlimSelect({
|
|
10
16
|
select: this.$refs.slimSingle as HTMLSelectElement,
|
|
11
17
|
})
|
|
12
|
-
|
|
18
|
+
this.multiple = new SlimSelect({
|
|
13
19
|
select: this.$refs.slimMulti as HTMLSelectElement,
|
|
14
20
|
})
|
|
15
21
|
|
|
16
22
|
setTimeout(() => {
|
|
17
|
-
single
|
|
23
|
+
if (this.single) {
|
|
24
|
+
this.single.open()
|
|
25
|
+
}
|
|
18
26
|
setTimeout(() => {
|
|
19
|
-
single
|
|
27
|
+
if (this.single) {
|
|
28
|
+
this.single.setSelected('best')
|
|
29
|
+
}
|
|
20
30
|
}, 500)
|
|
21
31
|
setTimeout(() => {
|
|
22
|
-
single
|
|
32
|
+
if (this.single) {
|
|
33
|
+
this.single.setSelected('select')
|
|
34
|
+
}
|
|
23
35
|
}, 1000)
|
|
24
36
|
setTimeout(() => {
|
|
25
|
-
single
|
|
37
|
+
if (this.single) {
|
|
38
|
+
this.single.setSelected('ever')
|
|
39
|
+
}
|
|
26
40
|
}, 1500)
|
|
27
41
|
setTimeout(() => {
|
|
28
|
-
single
|
|
42
|
+
if (this.single) {
|
|
43
|
+
this.single.close()
|
|
44
|
+
}
|
|
29
45
|
}, 2000)
|
|
30
46
|
|
|
31
|
-
multiple
|
|
47
|
+
if (this.multiple) {
|
|
48
|
+
this.multiple.open()
|
|
49
|
+
}
|
|
32
50
|
setTimeout(() => {
|
|
33
|
-
multiple
|
|
51
|
+
if (this.multiple) {
|
|
52
|
+
this.multiple.setSelected(['best'])
|
|
53
|
+
}
|
|
34
54
|
}, 500)
|
|
35
55
|
setTimeout(() => {
|
|
36
|
-
multiple
|
|
56
|
+
if (this.multiple) {
|
|
57
|
+
this.multiple.setSelected(['best', 'select'])
|
|
58
|
+
}
|
|
37
59
|
}, 1000)
|
|
38
60
|
setTimeout(() => {
|
|
39
|
-
multiple
|
|
61
|
+
if (this.multiple) {
|
|
62
|
+
this.multiple.setSelected(['best', 'select', 'ever'])
|
|
63
|
+
}
|
|
40
64
|
}, 1500)
|
|
41
65
|
setTimeout(() => {
|
|
42
|
-
multiple
|
|
66
|
+
if (this.multiple) {
|
|
67
|
+
this.multiple.close()
|
|
68
|
+
}
|
|
43
69
|
}, 2000)
|
|
44
70
|
}, 500)
|
|
45
71
|
},
|
|
72
|
+
unmounted() {
|
|
73
|
+
if (this.single) {
|
|
74
|
+
this.single.destroy()
|
|
75
|
+
}
|
|
76
|
+
if (this.multiple) {
|
|
77
|
+
this.multiple.destroy()
|
|
78
|
+
}
|
|
79
|
+
},
|
|
46
80
|
})
|
|
47
81
|
</script>
|
|
48
82
|
|
|
@@ -108,7 +142,7 @@ export default defineComponent({
|
|
|
108
142
|
<div id="home" class="content">
|
|
109
143
|
<div class="samples row">
|
|
110
144
|
<div class="single">
|
|
111
|
-
<h2>Single Select</h2>
|
|
145
|
+
<h2>Single Select 2</h2>
|
|
112
146
|
<select ref="slimSingle">
|
|
113
147
|
<option data-placeholder="true"></option>
|
|
114
148
|
<option value="best">Best</option>
|
|
@@ -44,14 +44,18 @@ export default defineComponent({
|
|
|
44
44
|
<div id="cdn" class="content">
|
|
45
45
|
<h2>Cdn</h2>
|
|
46
46
|
<p>Cdn has a url link you can grab.</p>
|
|
47
|
+
<p>
|
|
48
|
+
See full list of available options.
|
|
49
|
+
<a target="_blank" href="https://cdnjs.com/libraries/slim-select">cdnjs.com/libraries/slim-select</a>
|
|
50
|
+
</p>
|
|
47
51
|
<div class="alert info">New releases may be delayed until the next time its indexed</div>
|
|
48
52
|
|
|
49
53
|
<pre class="install-code">
|
|
50
54
|
<code class="language-html">
|
|
51
55
|
<html>
|
|
52
56
|
<head>
|
|
53
|
-
<script src="https://cdnjs.cloudflare.com/ajax/libs/slim-select/{{version}}/slimselect.
|
|
54
|
-
<link href="https://cdnjs.cloudflare.com/ajax/libs/slim-select/{{version}}/slimselect.
|
|
57
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/slim-select/{{version}}/slimselect.js"></script>
|
|
58
|
+
<link href="https://cdnjs.cloudflare.com/ajax/libs/slim-select/{{version}}/slimselect.css" rel="stylesheet"></link>
|
|
55
59
|
|
|
56
60
|
<script>
|
|
57
61
|
new SlimSelect({
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
const path = require('path')
|
|
2
|
-
const MiniCssExtractPlugin = require("mini-css-extract-plugin")
|
|
3
|
-
const OptimizeCSSAssetsPlugin = require("optimize-css-assets-webpack-plugin")
|
|
4
|
-
const UglifyJsPlugin = require("uglifyjs-webpack-plugin")
|
|
5
|
-
|
|
6
|
-
module.exports = {
|
|
7
|
-
mode: 'production',
|
|
8
|
-
entry: {
|
|
9
|
-
'slimselect': './index.ts',
|
|
10
|
-
'slimselect.min': './index.ts',
|
|
11
|
-
'slimselectcss': './slimselect.scss',
|
|
12
|
-
'slimselectcss.min': './slimselect.scss'
|
|
13
|
-
},
|
|
14
|
-
module: {
|
|
15
|
-
rules: [
|
|
16
|
-
{
|
|
17
|
-
test: /\.ts?$/,
|
|
18
|
-
loader: 'ts-loader',
|
|
19
|
-
exclude: /node_modules/
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
test: /\.(sass|scss)$/,
|
|
23
|
-
use: [
|
|
24
|
-
MiniCssExtractPlugin.loader,
|
|
25
|
-
"css-loader",
|
|
26
|
-
"sass-loader" // compiles Sass to CSS, using Node Sass by default
|
|
27
|
-
]
|
|
28
|
-
}
|
|
29
|
-
]
|
|
30
|
-
},
|
|
31
|
-
plugins: [
|
|
32
|
-
new MiniCssExtractPlugin({
|
|
33
|
-
filename: '[name].css'
|
|
34
|
-
})
|
|
35
|
-
],
|
|
36
|
-
resolve: {
|
|
37
|
-
extensions: ['.ts', '.js']
|
|
38
|
-
},
|
|
39
|
-
optimization: {
|
|
40
|
-
splitChunks: {
|
|
41
|
-
minSize: 30000000, // Make slimselect minSize so large that it wont chunk
|
|
42
|
-
maxSize: 0
|
|
43
|
-
},
|
|
44
|
-
minimizer: [
|
|
45
|
-
new UglifyJsPlugin({
|
|
46
|
-
cache: true,
|
|
47
|
-
parallel: true,
|
|
48
|
-
sourceMap: false,
|
|
49
|
-
include: /\.min\.js$/
|
|
50
|
-
}),
|
|
51
|
-
new OptimizeCSSAssetsPlugin({
|
|
52
|
-
assetNameRegExp: /\.min\.css$/g, // Lets only run optimize on files with min in it
|
|
53
|
-
})
|
|
54
|
-
],
|
|
55
|
-
splitChunks: {
|
|
56
|
-
cacheGroups: {
|
|
57
|
-
styles: {
|
|
58
|
-
name: 'styles',
|
|
59
|
-
test: /\.css$/,
|
|
60
|
-
chunks: 'all',
|
|
61
|
-
enforce: true
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
},
|
|
66
|
-
output: {
|
|
67
|
-
path: path.resolve(__dirname, '../../dist'),
|
|
68
|
-
filename: '[name].js',
|
|
69
|
-
library: 'SlimSelect',
|
|
70
|
-
libraryTarget: 'umd',
|
|
71
|
-
libraryExport: 'default'
|
|
72
|
-
}
|
|
73
|
-
}
|