slim-select 3.0.2 → 3.0.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.
- package/README.md +1 -1
- package/dist/index.d.ts +5 -7
- package/dist/react/index.d.ts +5 -7
- package/dist/react/index.js +10 -8
- package/dist/react/index.umd.js +3 -3
- package/dist/slimselect.cjs.js +1 -1
- package/dist/slimselect.cjs.js.map +1 -1
- package/dist/slimselect.es.js +3 -4
- package/dist/slimselect.es.js.map +1 -1
- package/dist/slimselect.iife.js +1 -1
- package/dist/slimselect.iife.js.map +1 -1
- package/dist/slimselect.js +1 -1
- package/dist/slimselect.js.map +1 -1
- package/dist/vue/index.d.ts +5 -7
- package/dist/vue/index.js +31 -29
- package/dist/vue/index.umd.js +1 -1
- package/index.html +45 -5
- package/package.json +9 -8
- package/sitemap.js +89 -0
- package/src/slim-select/index.ts +1 -1
- package/src/slim-select/render.ts +7 -0
- package/src/slim-select/select.test.ts +1 -2
- package/src/slim-select/select.ts +1 -1
- package/src/slim-select/store.ts +2 -4
- package/src/slim-select/vue/vue.test.ts +2 -2
- package/tsconfig.json +1 -1
- package/vite.config.react.mts +1 -1
- package/vite.config.vue.mts +1 -1
package/sitemap.js
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import fs from 'fs'
|
|
4
|
+
import path from 'path'
|
|
5
|
+
import { fileURLToPath } from 'url'
|
|
6
|
+
|
|
7
|
+
const __filename = fileURLToPath(import.meta.url)
|
|
8
|
+
const __dirname = path.dirname(__filename)
|
|
9
|
+
|
|
10
|
+
// Define all routes and their metadata
|
|
11
|
+
const routes = [
|
|
12
|
+
{
|
|
13
|
+
loc: 'https://slimselectjs.com/',
|
|
14
|
+
lastmod: new Date().toISOString().split('T')[0],
|
|
15
|
+
changefreq: 'weekly',
|
|
16
|
+
priority: '1.0'
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
loc: 'https://slimselectjs.com/install',
|
|
20
|
+
lastmod: new Date().toISOString().split('T')[0],
|
|
21
|
+
changefreq: 'monthly',
|
|
22
|
+
priority: '0.9'
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
loc: 'https://slimselectjs.com/selects',
|
|
26
|
+
lastmod: new Date().toISOString().split('T')[0],
|
|
27
|
+
changefreq: 'monthly',
|
|
28
|
+
priority: '0.9'
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
loc: 'https://slimselectjs.com/data',
|
|
32
|
+
lastmod: new Date().toISOString().split('T')[0],
|
|
33
|
+
changefreq: 'monthly',
|
|
34
|
+
priority: '0.8'
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
loc: 'https://slimselectjs.com/settings',
|
|
38
|
+
lastmod: new Date().toISOString().split('T')[0],
|
|
39
|
+
changefreq: 'monthly',
|
|
40
|
+
priority: '0.8'
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
loc: 'https://slimselectjs.com/events',
|
|
44
|
+
lastmod: new Date().toISOString().split('T')[0],
|
|
45
|
+
changefreq: 'monthly',
|
|
46
|
+
priority: '0.7'
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
loc: 'https://slimselectjs.com/methods',
|
|
50
|
+
lastmod: new Date().toISOString().split('T')[0],
|
|
51
|
+
changefreq: 'monthly',
|
|
52
|
+
priority: '0.7'
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
loc: 'https://slimselectjs.com/frameworks/react',
|
|
56
|
+
lastmod: new Date().toISOString().split('T')[0],
|
|
57
|
+
changefreq: 'monthly',
|
|
58
|
+
priority: '0.8'
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
loc: 'https://slimselectjs.com/frameworks/vue',
|
|
62
|
+
lastmod: new Date().toISOString().split('T')[0],
|
|
63
|
+
changefreq: 'monthly',
|
|
64
|
+
priority: '0.8'
|
|
65
|
+
}
|
|
66
|
+
]
|
|
67
|
+
|
|
68
|
+
function generateSitemap() {
|
|
69
|
+
const sitemapContent = `<?xml version="1.0" encoding="UTF-8"?>
|
|
70
|
+
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
71
|
+
${routes
|
|
72
|
+
.map(
|
|
73
|
+
(route) => ` <url>
|
|
74
|
+
<loc>${route.loc}</loc>
|
|
75
|
+
<lastmod>${route.lastmod}</lastmod>
|
|
76
|
+
<changefreq>${route.changefreq}</changefreq>
|
|
77
|
+
<priority>${route.priority}</priority>
|
|
78
|
+
</url>`
|
|
79
|
+
)
|
|
80
|
+
.join('\n')}
|
|
81
|
+
</urlset>`
|
|
82
|
+
|
|
83
|
+
const sitemapPath = path.join(__dirname, 'public', 'sitemap.xml')
|
|
84
|
+
fs.writeFileSync(sitemapPath, sitemapContent, 'utf8')
|
|
85
|
+
console.log('✅ Sitemap generated successfully at:', sitemapPath)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// Run the generator
|
|
89
|
+
generateSitemap()
|
package/src/slim-select/index.ts
CHANGED
|
@@ -6,7 +6,7 @@ import Settings from './settings'
|
|
|
6
6
|
import Store, { Option, Optgroup } from './store'
|
|
7
7
|
|
|
8
8
|
// Export classes
|
|
9
|
-
export {
|
|
9
|
+
export { Settings, Option, Optgroup }
|
|
10
10
|
|
|
11
11
|
export interface Config {
|
|
12
12
|
select: string | Element
|
|
@@ -50,6 +50,7 @@ export default class Render {
|
|
|
50
50
|
public settings: Settings
|
|
51
51
|
public store: Store
|
|
52
52
|
public callbacks: Callbacks
|
|
53
|
+
|
|
53
54
|
// Used to compute the range selection
|
|
54
55
|
private lastSelectedOption: Option | null
|
|
55
56
|
|
|
@@ -143,6 +144,12 @@ export default class Render {
|
|
|
143
144
|
|
|
144
145
|
// Clear active descendant when closed
|
|
145
146
|
this.main.main.removeAttribute('aria-activedescendant')
|
|
147
|
+
|
|
148
|
+
// Remove direction class from main and content after animation is complete
|
|
149
|
+
setTimeout(() => {
|
|
150
|
+
this.main.main.classList.remove(this.classes.dirAbove, this.classes.dirBelow)
|
|
151
|
+
this.content.main.classList.remove(this.classes.dirAbove, this.classes.dirBelow)
|
|
152
|
+
}, 100)
|
|
146
153
|
}
|
|
147
154
|
|
|
148
155
|
public updateClassStyles(): void {
|
|
@@ -37,8 +37,7 @@ describe('select module', () => {
|
|
|
37
37
|
const select = new Select(selectElement)
|
|
38
38
|
|
|
39
39
|
expect(select).toBeInstanceOf(Select)
|
|
40
|
-
expect(select.
|
|
41
|
-
expect((<any>select).observer).toBeInstanceOf(MutationObserver)
|
|
40
|
+
expect(select.select).toBeInstanceOf(HTMLSelectElement)
|
|
42
41
|
})
|
|
43
42
|
})
|
|
44
43
|
|
|
@@ -11,7 +11,7 @@ export default class Select {
|
|
|
11
11
|
public onOptionsChange?: (data: (Option | Optgroup)[]) => void
|
|
12
12
|
|
|
13
13
|
// Change observers
|
|
14
|
-
|
|
14
|
+
private listen: boolean = false
|
|
15
15
|
private observer: MutationObserver | null = null
|
|
16
16
|
|
|
17
17
|
constructor(select: HTMLSelectElement) {
|
package/src/slim-select/store.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { generateID } from './helpers'
|
|
2
2
|
|
|
3
|
-
type selectType = 'single' | 'multiple'
|
|
4
|
-
|
|
5
3
|
export class Option {
|
|
6
4
|
id: string
|
|
7
5
|
value: string
|
|
@@ -60,13 +58,13 @@ export class Optgroup {
|
|
|
60
58
|
}
|
|
61
59
|
|
|
62
60
|
export default class Store {
|
|
63
|
-
private selectType:
|
|
61
|
+
private selectType: 'single' | 'multiple' = 'single'
|
|
64
62
|
|
|
65
63
|
// Main data set, never null
|
|
66
64
|
private data: (Option | Optgroup)[] = []
|
|
67
65
|
private selectedOrder: string[] = []
|
|
68
66
|
|
|
69
|
-
constructor(type:
|
|
67
|
+
constructor(type: 'single' | 'multiple', data: (Partial<Option> | Partial<Optgroup>)[]) {
|
|
70
68
|
this.selectType = type
|
|
71
69
|
this.setData(data)
|
|
72
70
|
}
|
|
@@ -6,8 +6,8 @@ import SlimSelectVue from './vue.vue'
|
|
|
6
6
|
|
|
7
7
|
describe('SlimSelect Vue Component', () => {
|
|
8
8
|
let wrapper: VueWrapper<any>
|
|
9
|
-
let consoleInfoSpy:
|
|
10
|
-
let consoleWarnSpy:
|
|
9
|
+
let consoleInfoSpy: any
|
|
10
|
+
let consoleWarnSpy: any
|
|
11
11
|
|
|
12
12
|
beforeEach(() => {
|
|
13
13
|
// Mock console methods
|
package/tsconfig.json
CHANGED
package/vite.config.react.mts
CHANGED
package/vite.config.vue.mts
CHANGED