slim-select 2.0.0 → 2.0.2

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.
Files changed (62) hide show
  1. package/.github/ISSUE_TEMPLATE/issue-report.md +3 -3
  2. package/README.md +17 -20
  3. package/dist/{helper.d.ts → helpers.d.ts} +0 -0
  4. package/dist/index.d.ts +0 -6
  5. package/dist/slimselect.cjs.js +1551 -2
  6. package/dist/slimselect.css +1 -1
  7. package/dist/slimselect.css.map +1 -1
  8. package/dist/slimselect.es.js +1549 -2
  9. package/dist/slimselect.global.js +1554 -2
  10. package/dist/slimselect.js +1557 -2
  11. package/dist/slimselect.min.js +1 -0
  12. package/dist/slimselect.umd.js +1557 -2
  13. package/dist/slimselect.umd.min.js +1 -0
  14. package/docs/404.html +18 -12
  15. package/docs/assets/home.js +1 -1
  16. package/docs/assets/index.css +1 -1
  17. package/docs/assets/index.js +7 -7
  18. package/docs/assets/index5.js +11 -0
  19. package/docs/assets/install.js +7 -7
  20. package/docs/index.html +20 -2
  21. package/index.html +20 -2
  22. package/package.json +8 -5
  23. package/public/404.html +18 -12
  24. package/src/docs/app.vue +23 -3
  25. package/src/docs/assets/scss/_variables.scss +1 -1
  26. package/src/docs/pages/frameworks/index.vue +18 -0
  27. package/src/docs/pages/frameworks/vue.vue +39 -0
  28. package/src/docs/pages/home.vue +46 -12
  29. package/src/docs/pages/install.vue +29 -4
  30. package/src/docs/router.ts +5 -0
  31. package/src/slim-select/{helper.ts → helpers.ts} +0 -0
  32. package/src/slim-select/index.ts +1 -11
  33. package/src/slim-select/render.ts +1 -1
  34. package/src/slim-select/rollup.config.mjs +112 -29
  35. package/src/slim-select/select.ts +1 -1
  36. package/src/slim-select/settings.ts +1 -1
  37. package/src/slim-select/slimselect.scss +7 -0
  38. package/src/slim-select/store.ts +1 -1
  39. package/src/vue/slimselect.vue +30 -48
  40. package/dist/slimselect.cjs.js.map +0 -1
  41. package/dist/slimselect.es.js.map +0 -1
  42. package/dist/slimselect.global.js.map +0 -1
  43. package/dist/slimselect.js.map +0 -1
  44. package/dist/slimselect.umd.js.map +0 -1
  45. package/docs/images/check-mark.svg +0 -6
  46. package/docs/images/chrome.svg +0 -22
  47. package/docs/images/firefox.svg +0 -58
  48. package/docs/images/github.png +0 -0
  49. package/docs/images/ie.svg +0 -11
  50. package/docs/images/npm.png +0 -0
  51. package/docs/images/opera.svg +0 -15
  52. package/docs/images/safari.svg +0 -22
  53. package/public/images/check-mark.svg +0 -6
  54. package/public/images/chrome.svg +0 -22
  55. package/public/images/firefox.svg +0 -58
  56. package/public/images/github.png +0 -0
  57. package/public/images/ie.svg +0 -11
  58. package/public/images/npm.png +0 -0
  59. package/public/images/opera.svg +0 -15
  60. package/public/images/safari.svg +0 -22
  61. package/public/index.html +0 -28
  62. package/src/slim-select/webpack.config.js +0 -73
@@ -0,0 +1,11 @@
1
+ import{d as n,S as f,_ as o,o as c,c as i,l as h,g as m,a as e,h as u,w as $,f as p}from"./index.js";const S=n({name:"SlimSelect",props:{settings:{type:Object}},data(){return{slim:null}},mounted(){let t={select:this.$refs.slim};this.settings&&(t.settings=this.settings),this.slim=new f(t)},beforeUnmount(){this.slim&&this.slim.destroy()}}),v={ref:"slim"};function g(t,r,a,l,_,d){return c(),i("select",v,[h(t.$slots,"default")],512)}const V=o(S,[["render",g]]),x=n({name:"Vue",components:{SlimSelect:V}}),w={id:"error",class:"content"},O=e("h2",{class:"header"},"Vue",-1),k={class:"row"},B=e("option",{value:"1"},"Option 1",-1),C=e("option",{value:"2"},"Option 2",-1),E=e("option",{value:"3"},"Option 3",-1),N=e("pre",null,[p(" "),e("code",{class:"language-javascript"},`
2
+ var select = new SlimSelect({
3
+ select: '#selectElement',
4
+ events: {
5
+ error: function(err) {
6
+ console.error(err)
7
+ }
8
+ }
9
+ })
10
+ `),p(`
11
+ `)],-1);function b(t,r,a,l,_,d){const s=m("SlimSelect");return c(),i("div",w,[O,e("div",k,[u(s,null,{default:$(()=>[B,C,E]),_:1})]),N])}const j=o(x,[["render",b]]),y=n({name:"Events",components:{Vue:j}}),T={id:"frameworks",class:"contents"};function U(t,r,a,l,_,d){const s=m("Vue");return c(),i("div",T,[u(s)])}const z=o(y,[["render",U]]);export{z as default};
@@ -1,6 +1,6 @@
1
- import{e as N,d as $,_ as O,o as V,c as I,a as n,f as L,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=B(e),c=e.type||p;else return navigator.msSaveBlob?navigator.msSaveBlob(B(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 B(t){var r=t.split(/[:;,]/),h=r[1],E=r[2]=="base64"?atob:decodeURIComponent,C=E(r.pop()),T=C.length,v=0,D=new Uint8Array(T);for(v;v<T;++v)D[v]=C.charCodeAt(v);return new i([D],{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
1
+ import{e as M,d as $,_ as I,o as O,c as V,a as o,f as B,t as E,b as L}from"./index.js";var R={exports:{}};(function(d,w){(function(y,v){d.exports=v()})(M,function(){return function y(v,j,k){var n=window,m="application/octet-stream",r=k||m,e=v,c=!j&&!k&&e,t=document.createElement("a"),_=function(s){return String(s)},i=n.Blob||n.MozBlob||n.WebKitBlob||_,p=j||"download",l,S;if(i=i.call?i.bind(n):Blob,String(this)==="true"&&(e=[e,r],r=e[0],e=e[1]),c&&c.length<2048&&(p=c.split("/").pop().split("?")[0],t.href=c,t.href.indexOf(c)!==-1)){var u=new XMLHttpRequest;return u.open("GET",c,!0),u.responseType="blob",u.onload=function(s){y(s.target.response,p,m)},setTimeout(function(){u.send()},0),u}if(/^data:([\w+-]+\/[\w+.-]+)?[,;]/.test(e))if(e.length>1024*1024*1.999&&i!==_)e=x(e),r=e.type||m;else return navigator.msSaveBlob?navigator.msSaveBlob(x(e),p):f(e);else if(/([\x80-\xff])/.test(e)){var b=0,C=new Uint8Array(e.length),N=C.length;for(b;b<N;++b)C[b]=e.charCodeAt(b);e=new i([C],{type:r})}l=e instanceof i?e:new i([e],{type:r});function x(s){var a=s.split(/[:;,]/),h=a[1],A=a[2]=="base64"?atob:decodeURIComponent,D=A(a.pop()),U=D.length,g=0,T=new Uint8Array(U);for(g;g<U;++g)T[g]=D.charCodeAt(g);return new i([T],{type:h})}function f(s,a){if("download"in t)return t.href=s,t.setAttribute("download",p),t.className="download-js-link",t.innerHTML="downloading...",t.style.display="none",document.body.appendChild(t),setTimeout(function(){t.click(),document.body.removeChild(t),a===!0&&setTimeout(function(){n.URL.revokeObjectURL(t.href)},250)},66),!0;if(/(Version)\/(\d+)\.(\d+)(?:\.(\d+))?.*Safari\//.test(navigator.userAgent))return/^data:/.test(s)&&(s="data:"+s.replace(/^data:([\w\/\-\+]+)/,m)),window.open(s)||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="1.27.1",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.min.js",P="dist/slimselect.esm.js",Q="dist/slimselect.min.js",Y="dist/index.d.ts",Z="dist/index.d.ts",ee="dist/slimselect.min.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">
3
+ Use Save As... to download, then click back to return to this page.`)&&(location.href=s),!0;var h=document.createElement("iframe");document.body.appendChild(h),!a&&/^data:/.test(s)&&(s="data:"+s.replace(/^data:([\w\/\-\+]+)/,m)),h.src=s,setTimeout(function(){document.body.removeChild(h)},333)}if(navigator.msSaveBlob)return navigator.msSaveBlob(l,p);if(n.URL)f(n.URL.createObjectURL(l),!0);else{if(typeof l=="string"||l.constructor===_)try{return f("data:"+r+";base64,"+n.btoa(l))}catch{return f("data:"+r+","+encodeURIComponent(l))}S=new FileReader,S.onload=function(s){f(this.result)},S.readAsDataURL(l)}return!0}})})(R);const H=R.exports,G="slim-select",J="Slim advanced select dropdown",q="2.0.1",z="Brian Voelker <brian@webiswhatido.com> (http://webiswhatido.com)",F="https://slimselectjs.com",K="MIT",W={url:"https://github.com/brianvoe/slim-select/issues"},X="dist/slimselect.cjs.js",P="dist/slimselect.umd.js",Q="dist/slimselect.es.js",Y="dist/slimselect.umd.min.js",Z="dist/index.d.ts",ee="dist/index.d.ts",se="dist/slimselect.css",te="src/slim-select/slimselect.scss",ne={type:"git",url:"git+https://github.com/brianvoe/slim-select.git"},oe=["select","vanilla","dropdown","search","multiselect"],ie={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"},le={"@jest/globals":"^29.3.1","@rollup/plugin-babel":"^6.0.2","@rollup/plugin-commonjs":"^23.0.2","@rollup/plugin-node-resolve":"^15.0.1","@rollup/plugin-terser":"^0.1.0","@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",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"},re={name:G,description:J,version:q,author:z,homepage:F,license:K,bugs:W,main:X,browser:P,module:Q,unpkg:Y,types:Z,typings:ee,style:se,sass:te,repository:ne,keywords:oe,scripts:ie,devDependencies:le},ce=$({name:"Install",data:()=>({version:re.version}),methods:{downloadLink(){H(`https://cdnjs.cloudflare.com/ajax/libs/slim-select/${this.version}/slimselect.min.js`)}}}),ae={id:"install",class:"contents"},de=L(`<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: &#39;#selectElement&#39;
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),be={class:"install-code"},fe={class:"language-html"},he={id:"download",class:"content"},ve=n("h2",null,"Download",-1),ge=n("p",null,"Download the latest minified version of slim select",-1);function ye(d,y,w,g,j,_){return V(),I("div",ae,[re,n("div",de,[pe,me,ue,n("pre",be,[L(" "),n("code",fe,`
13
+ </pre></div>`,1),me={id:"cdn",class:"content"},pe=L('<h2>Cdn</h2><p> Cdn has a url link you can grab. Cdn exists on both <a target="_blank" href="https://cdnjs.com">cdnjs.com</a> and <a target="_blank" href="https://unpkg.com">unpkg.com</a></p><p> See full list of available options.<br><strong>cdnjs</strong> - <a target="_blank" href="https://cdnjs.com/libraries/slim-select">cdnjs.com/libraries/slim-select</a><br><strong>unpkg</strong> - <a target="_blank" href="https://unpkg.com/browse/slim-select/dist/">https://unpkg.com/browse/slim-select/dist/</a></p><ul><li>slimselct.js - UMD unminified</li><li>slimselct.min.js - UMD minified</li><li>slimselect.cjs.js - CommonJS (for Node) and ES module (for bundlers) build</li><li>slimselect.umd.js - UMD build for browsers</li><li>slimselect.es.js - ES module build for modern browsers</li><li>slimselect.global.js - IIFE build for modern browsers</li></ul><div class="alert info">New releases may be delayed until the next time its indexed</div>',5),ue={class:"install-code"},be={class:"language-html"},fe={id:"download",class:"content"},he=o("h2",null,"Download",-1),ge=o("p",null,"Download the latest minified umd version of slim select",-1),ve=o("p",null,[B(" See full list of available downloadable options. "),o("a",{target:"_blank",href:"https://cdnjs.com/libraries/slim-select"},"cdnjs.com/libraries/slim-select")],-1);function we(d,w,y,v,j,k){return O(),V("div",ae,[de,o("div",me,[pe,o("pre",ue,[B(" "),o("code",be,`
14
14
  <html>
15
15
  <head>
16
- <script src="https://cdnjs.cloudflare.com/ajax/libs/slim-select/`+R(d.version)+`/slimselect.min.js"><\/script>
17
- <link href="https://cdnjs.cloudflare.com/ajax/libs/slim-select/`+R(d.version)+`/slimselect.min.css" rel="stylesheet"></link>
16
+ <script src="unpkg.com/slim-select@`+E(d.version)+`/dist/slimselect.min.js"><\/script>
17
+ <link href="unpkg.com/slim-select@`+E(d.version)+`/dist/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),L(`
34
- `)])]),n("div",he,[ve,ge,n("div",{class:"btn",onClick:y[0]||(y[0]=o=>d.downloadLink())},"Click Here To Download")])])}const je=O(ce,[["render",ye]]);export{je as default};
33
+ `,1),B(`
34
+ `)])]),o("div",fe,[he,ge,ve,o("div",{class:"btn",onClick:w[0]||(w[0]=n=>d.downloadLink())},"Click Here To Download")])])}const je=I(ce,[["render",we]]);export{je as default};
package/docs/index.html CHANGED
@@ -5,14 +5,32 @@
5
5
  <link rel="icon" href="/favicon.ico" />
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
7
  <title>Slim Select</title>
8
+ <meta name="description" content="Advanced select dropdown" />
9
+ <meta property="og:type" content="article" />
10
+ <meta property="og:title" content="Slim Select" />
11
+ <meta property="og:description" content="Advanced select dropdown" />
8
12
  <script type="module" crossorigin src="/assets/index.js"></script>
9
13
  <link rel="stylesheet" href="/assets/index.css">
10
14
  </head>
11
15
  <body>
12
16
  <noscript>
13
- <strong>We're sorry but this site doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
17
+ <strong
18
+ >We're sorry but this site doesn't work properly without JavaScript enabled. Please enable it to
19
+ continue.</strong
20
+ >
14
21
  </noscript>
15
22
  <div id="app"></div>
16
23
 
24
+ <!-- Google tag (gtag.js) -->
25
+ <script async src="https://www.googletagmanager.com/gtag/js?id=G-14PMXQVXTC"></script>
26
+ <script>
27
+ window.dataLayer = window.dataLayer || []
28
+ function gtag() {
29
+ dataLayer.push(arguments)
30
+ }
31
+ gtag('js', new Date())
32
+
33
+ gtag('config', 'G-14PMXQVXTC')
34
+ </script>
17
35
  </body>
18
- </html>
36
+ </html>
package/index.html CHANGED
@@ -5,12 +5,30 @@
5
5
  <link rel="icon" href="/favicon.ico" />
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
7
  <title>Slim Select</title>
8
+ <meta name="description" content="Advanced select dropdown" />
9
+ <meta property="og:type" content="article" />
10
+ <meta property="og:title" content="Slim Select" />
11
+ <meta property="og:description" content="Advanced select dropdown" />
8
12
  </head>
9
13
  <body>
10
14
  <noscript>
11
- <strong>We're sorry but this site doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
15
+ <strong
16
+ >We're sorry but this site doesn't work properly without JavaScript enabled. Please enable it to
17
+ continue.</strong
18
+ >
12
19
  </noscript>
13
20
  <div id="app"></div>
14
21
  <script type="module" src="/src/docs/main.ts"></script>
22
+ <!-- Google tag (gtag.js) -->
23
+ <script async src="https://www.googletagmanager.com/gtag/js?id=G-14PMXQVXTC"></script>
24
+ <script>
25
+ window.dataLayer = window.dataLayer || []
26
+ function gtag() {
27
+ dataLayer.push(arguments)
28
+ }
29
+ gtag('js', new Date())
30
+
31
+ gtag('config', 'G-14PMXQVXTC')
32
+ </script>
15
33
  </body>
16
- </html>
34
+ </html>
package/package.json CHANGED
@@ -1,16 +1,17 @@
1
1
  {
2
2
  "name": "slim-select",
3
3
  "description": "Slim advanced select dropdown",
4
- "version": "2.0.0",
4
+ "version": "2.0.2",
5
5
  "author": "Brian Voelker <brian@webiswhatido.com> (http://webiswhatido.com)",
6
6
  "homepage": "https://slimselectjs.com",
7
7
  "license": "MIT",
8
8
  "bugs": {
9
9
  "url": "https://github.com/brianvoe/slim-select/issues"
10
10
  },
11
- "main": "dist/slimselect.js",
11
+ "main": "dist/slimselect.cjs.js",
12
+ "browser": "dist/slimselect.umd.js",
12
13
  "module": "dist/slimselect.es.js",
13
- "unpkg": "dist/slimselect.js",
14
+ "unpkg": "dist/slimselect.umd.min.js",
14
15
  "types": "dist/index.d.ts",
15
16
  "typings": "dist/index.d.ts",
16
17
  "style": "dist/slimselect.css",
@@ -27,7 +28,6 @@
27
28
  "multiselect"
28
29
  ],
29
30
  "scripts": {
30
- "jestinit": "ts-jest config:init",
31
31
  "dev": "vite --port=1111",
32
32
  "format": "prettier --write --cache --parser typescript \"src/**/*.ts\"",
33
33
  "build": "npm run build:clean && npm run build:docs && npm run build:library",
@@ -40,6 +40,10 @@
40
40
  },
41
41
  "devDependencies": {
42
42
  "@jest/globals": "^29.3.1",
43
+ "@rollup/plugin-babel": "^6.0.2",
44
+ "@rollup/plugin-commonjs": "^23.0.2",
45
+ "@rollup/plugin-node-resolve": "^15.0.1",
46
+ "@rollup/plugin-terser": "^0.1.0",
43
47
  "@rollup/plugin-typescript": "^9.0.2",
44
48
  "@types/downloadjs": "^1.4.3",
45
49
  "@vitejs/plugin-vue": "^3.2.0",
@@ -51,7 +55,6 @@
51
55
  "prismjs": "^1.29.0",
52
56
  "rimraf": "^3.0.2",
53
57
  "rollup": "^2.79.1",
54
- "rollup-plugin-terser": "^7.0.2",
55
58
  "sass": "^1.56.1",
56
59
  "ts-jest": "^29.0.3",
57
60
  "tslib": "^2.4.1",
package/public/404.html CHANGED
@@ -1,8 +1,8 @@
1
1
  <!DOCTYPE html>
2
2
  <html>
3
3
  <head>
4
- <meta charset="utf-8">
5
- <title>Single Page Apps for GitHub Pages</title>
4
+ <meta charset="utf-8" />
5
+ <title>Slim Select</title>
6
6
  <script type="text/javascript">
7
7
  // Single Page Apps for GitHub Pages
8
8
  // https://github.com/rafrex/spa-github-pages
@@ -20,17 +20,23 @@
20
20
  // https://username.github.io/repo-name/one/two?a=b&c=d#qwe becomes
21
21
  // https://username.github.io/repo-name/?p=/one/two&q=a=b~and~c=d#qwe
22
22
  // Otherwise, leave pathPrefix as false.
23
- var pathPrefix = false;
24
- var l = window.location;
23
+ var pathPrefix = false
24
+ var l = window.location
25
25
  l.replace(
26
- l.protocol + '//' + l.hostname + (l.port ? ':' + l.port : '') +
27
- l.pathname.split('/').slice(0, 2 * pathPrefix).join('/') + '/?p=/' +
28
- l.pathname.slice(1).split('/').slice(pathPrefix).join('/').replace(/&/g, '~and~') +
29
- (l.search ? '&q=' + l.search.slice(1).replace(/&/g, '~and~') : '') +
30
- l.hash
31
- );
26
+ l.protocol +
27
+ '//' +
28
+ l.hostname +
29
+ (l.port ? ':' + l.port : '') +
30
+ l.pathname
31
+ .split('/')
32
+ .slice(0, 2 * pathPrefix)
33
+ .join('/') +
34
+ '/?p=/' +
35
+ l.pathname.slice(1).split('/').slice(pathPrefix).join('/').replace(/&/g, '~and~') +
36
+ (l.search ? '&q=' + l.search.slice(1).replace(/&/g, '~and~') : '') +
37
+ l.hash,
38
+ )
32
39
  </script>
33
40
  </head>
34
- <body>
35
- </body>
41
+ <body></body>
36
42
  </html>
package/src/docs/app.vue CHANGED
@@ -1,7 +1,9 @@
1
1
  <script lang="ts">
2
2
  import { defineComponent } from 'vue'
3
3
 
4
- import SlimSelect, { debounce, Settings } from '../slim-select'
4
+ import SlimSelect from '../slim-select'
5
+ import Settings from '../slim-select/settings'
6
+ import { debounce } from '../slim-select/helpers'
5
7
 
6
8
  export default defineComponent({
7
9
  name: 'App',
@@ -75,6 +77,10 @@ export default defineComponent({
75
77
  { text: 'enableDisable', value: 'methods#enableDisable', class: 'mar-l-l' },
76
78
  { text: 'search', value: 'methods#search', class: 'mar-l-l' },
77
79
  { text: 'destroy', value: 'methods#destroy', class: 'mar-l-l' },
80
+
81
+ // Frameworks
82
+ // { text: 'Frameworks', value: 'frameworks', class: 'label' },
83
+ // { text: 'vue', value: 'frameworks#vue', class: 'mar-l-l' },
78
84
  ],
79
85
  }
80
86
  },
@@ -88,6 +94,18 @@ export default defineComponent({
88
94
  })
89
95
 
90
96
  this.$router.afterEach(() => {
97
+ if (this.$route.query.p) {
98
+ // Delay router push to allow for
99
+ // other things to happen first
100
+ setTimeout(() => {
101
+ if (this.$route.query.p) {
102
+ this.$router.push({ path: this.$route.query.p.toString(), hash: this.$route.hash })
103
+ }
104
+ }, 200)
105
+
106
+ return
107
+ }
108
+
91
109
  // After route change get the hash and scroll to element in main
92
110
  setTimeout(() => {
93
111
  const hash = this.$route.hash
@@ -113,7 +131,7 @@ export default defineComponent({
113
131
  })
114
132
  }
115
133
  }
116
- }, 100)
134
+ }, 200)
117
135
  })
118
136
 
119
137
  this.setDemensions()
@@ -121,6 +139,8 @@ export default defineComponent({
121
139
  },
122
140
  unmounted() {
123
141
  window.removeEventListener('resize', this.navDebounce)
142
+
143
+ this.nav?.destroy()
124
144
  },
125
145
  watch: {
126
146
  width() {
@@ -172,7 +192,7 @@ export default defineComponent({
172
192
  <header>
173
193
  <div class="top">
174
194
  <div class="text">
175
- <h1 class="logo">Slim Select</h1>
195
+ <h1 class="logo">Slim Select <small>2.0</small></h1>
176
196
  </div>
177
197
  <div class="socials">
178
198
  <a href="https://github.com/brianvoe/slim-select" target="_blank">
@@ -10,7 +10,7 @@
10
10
  --color-alert-info-border: #b6d4fe;
11
11
 
12
12
  // Sizes
13
- --width-max: 1200px;
13
+ --width-max: 1000px;
14
14
  --height-header: 90px;
15
15
  --width-nav: 200px;
16
16
  --height-nav: 30px;
@@ -0,0 +1,18 @@
1
+ <script lang="ts">
2
+ import { defineComponent } from 'vue'
3
+
4
+ import Vue from './vue.vue'
5
+
6
+ export default defineComponent({
7
+ name: 'Events',
8
+ components: {
9
+ Vue,
10
+ },
11
+ })
12
+ </script>
13
+
14
+ <template>
15
+ <div id="frameworks" class="contents">
16
+ <Vue />
17
+ </div>
18
+ </template>
@@ -0,0 +1,39 @@
1
+ <script lang="ts">
2
+ import { defineComponent } from 'vue'
3
+
4
+ import SlimSelect from '../../../vue/slimselect.vue'
5
+
6
+ export default defineComponent({
7
+ name: 'Vue',
8
+ components: {
9
+ SlimSelect,
10
+ },
11
+ })
12
+ </script>
13
+
14
+ <template>
15
+ <div id="error" class="content">
16
+ <h2 class="header">Vue</h2>
17
+
18
+ <div class="row">
19
+ <SlimSelect>
20
+ <option value="1">Option 1</option>
21
+ <option value="2">Option 2</option>
22
+ <option value="3">Option 3</option>
23
+ </SlimSelect>
24
+ </div>
25
+
26
+ <pre>
27
+ <code class="language-javascript">
28
+ var select = new SlimSelect({
29
+ select: '#selectElement',
30
+ events: {
31
+ error: function(err) {
32
+ console.error(err)
33
+ }
34
+ }
35
+ })
36
+ </code>
37
+ </pre>
38
+ </div>
39
+ </template>
@@ -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
- const single = new SlimSelect({
15
+ this.single = new SlimSelect({
10
16
  select: this.$refs.slimSingle as HTMLSelectElement,
11
17
  })
12
- const multiple = new SlimSelect({
18
+ this.multiple = new SlimSelect({
13
19
  select: this.$refs.slimMulti as HTMLSelectElement,
14
20
  })
15
21
 
16
22
  setTimeout(() => {
17
- single.open()
23
+ if (this.single) {
24
+ this.single.open()
25
+ }
18
26
  setTimeout(() => {
19
- single.setSelected('best')
27
+ if (this.single) {
28
+ this.single.setSelected('best')
29
+ }
20
30
  }, 500)
21
31
  setTimeout(() => {
22
- single.setSelected('select')
32
+ if (this.single) {
33
+ this.single.setSelected('select')
34
+ }
23
35
  }, 1000)
24
36
  setTimeout(() => {
25
- single.setSelected('ever')
37
+ if (this.single) {
38
+ this.single.setSelected('ever')
39
+ }
26
40
  }, 1500)
27
41
  setTimeout(() => {
28
- single.close()
42
+ if (this.single) {
43
+ this.single.close()
44
+ }
29
45
  }, 2000)
30
46
 
31
- multiple.open()
47
+ if (this.multiple) {
48
+ this.multiple.open()
49
+ }
32
50
  setTimeout(() => {
33
- multiple.setSelected(['best'])
51
+ if (this.multiple) {
52
+ this.multiple.setSelected(['best'])
53
+ }
34
54
  }, 500)
35
55
  setTimeout(() => {
36
- multiple.setSelected(['best', 'select'])
56
+ if (this.multiple) {
57
+ this.multiple.setSelected(['best', 'select'])
58
+ }
37
59
  }, 1000)
38
60
  setTimeout(() => {
39
- multiple.setSelected(['best', 'select', 'ever'])
61
+ if (this.multiple) {
62
+ this.multiple.setSelected(['best', 'select', 'ever'])
63
+ }
40
64
  }, 1500)
41
65
  setTimeout(() => {
42
- multiple.close()
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
 
@@ -43,15 +43,36 @@ export default defineComponent({
43
43
 
44
44
  <div id="cdn" class="content">
45
45
  <h2>Cdn</h2>
46
- <p>Cdn has a url link you can grab.</p>
46
+ <p>
47
+ Cdn has a url link you can grab. Cdn exists on both
48
+ <a target="_blank" href="https://cdnjs.com">cdnjs.com</a> and
49
+ <a target="_blank" href="https://unpkg.com">unpkg.com</a>
50
+ </p>
51
+ <p>
52
+ See full list of available options.<br />
53
+ <strong>cdnjs</strong> -
54
+ <a target="_blank" href="https://cdnjs.com/libraries/slim-select">cdnjs.com/libraries/slim-select</a><br />
55
+ <strong>unpkg</strong> -
56
+ <a target="_blank" href="https://unpkg.com/browse/slim-select/dist/"
57
+ >https://unpkg.com/browse/slim-select/dist/</a
58
+ >
59
+ </p>
60
+ <ul>
61
+ <li>slimselct.js - UMD unminified</li>
62
+ <li>slimselct.min.js - UMD minified</li>
63
+ <li>slimselect.cjs.js - CommonJS (for Node) and ES module (for bundlers) build</li>
64
+ <li>slimselect.umd.js - UMD build for browsers</li>
65
+ <li>slimselect.es.js - ES module build for modern browsers</li>
66
+ <li>slimselect.global.js - IIFE build for modern browsers</li>
67
+ </ul>
47
68
  <div class="alert info">New releases may be delayed until the next time its indexed</div>
48
69
 
49
70
  <pre class="install-code">
50
71
  <code class="language-html">
51
72
  &lt;html&gt;
52
73
  &lt;head&gt;
53
- &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/slim-select/{{version}}/slimselect.min.js"&gt;&lt;/script&gt;
54
- &lt;link href="https://cdnjs.cloudflare.com/ajax/libs/slim-select/{{version}}/slimselect.min.css" rel="stylesheet"&gt;&lt;/link&gt;
74
+ &lt;script src="unpkg.com/slim-select@{{version}}/dist/slimselect.min.js"&gt;&lt;/script&gt;
75
+ &lt;link href="unpkg.com/slim-select@{{version}}/dist/slimselect.css" rel="stylesheet"&gt;&lt;/link&gt;
55
76
 
56
77
  &lt;script&gt;
57
78
  new SlimSelect({
@@ -73,7 +94,11 @@ export default defineComponent({
73
94
 
74
95
  <div id="download" class="content">
75
96
  <h2>Download</h2>
76
- <p>Download the latest minified version of slim select</p>
97
+ <p>Download the latest minified umd version of slim select</p>
98
+ <p>
99
+ See full list of available downloadable options.
100
+ <a target="_blank" href="https://cdnjs.com/libraries/slim-select">cdnjs.com/libraries/slim-select</a>
101
+ </p>
77
102
  <div class="btn" @click="downloadLink()">Click Here To Download</div>
78
103
  </div>
79
104
  </div>
@@ -39,6 +39,11 @@ const router = createRouter({
39
39
  name: 'Methods',
40
40
  component: () => import('./pages/methods/index.vue'),
41
41
  },
42
+ {
43
+ path: '/frameworks',
44
+ name: 'Frameworks',
45
+ component: () => import('./pages/frameworks/index.vue'),
46
+ },
42
47
  ],
43
48
  })
44
49
 
File without changes
@@ -1,19 +1,9 @@
1
- import { debounce, hasClassInTree } from './helper'
1
+ import { debounce, hasClassInTree } from './helpers'
2
2
  import Render from './render'
3
3
  import Select from './select'
4
4
  import Settings, { SettingsPartial } from './settings'
5
5
  import Store, { DataArray, DataArrayPartial, Option, OptionOptional } from './store'
6
6
 
7
- // Export everything except the "export default"
8
- export * from './helper'
9
- export * from './settings'
10
- export * from './select'
11
- export * from './store'
12
- export * from './render'
13
-
14
- // Export all "export defaults"
15
- export { Settings, Select, Store, Render }
16
-
17
7
  export interface Config {
18
8
  select: string | Element
19
9
  data?: DataArrayPartial
@@ -1,4 +1,4 @@
1
- import { debounce } from './helper'
1
+ import { debounce } from './helpers'
2
2
  import Settings from './settings'
3
3
  import Store, { DataArray, Optgroup, Option, OptionOptional } from './store'
4
4