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/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()
@@ -6,7 +6,7 @@ import Settings from './settings'
6
6
  import Store, { Option, Optgroup } from './store'
7
7
 
8
8
  // Export classes
9
- export { Select, Settings, Render, Store, Option, Optgroup }
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.listen).toBe(true)
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
- public listen: boolean = false
14
+ private listen: boolean = false
15
15
  private observer: MutationObserver | null = null
16
16
 
17
17
  constructor(select: HTMLSelectElement) {
@@ -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: selectType = 'single'
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: selectType, data: (Partial<Option> | Partial<Optgroup>)[]) {
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: ReturnType<typeof vi.spyOn>
10
- let consoleWarnSpy: ReturnType<typeof vi.spyOn>
9
+ let consoleInfoSpy: any
10
+ let consoleWarnSpy: any
11
11
 
12
12
  beforeEach(() => {
13
13
  // Mock console methods
package/tsconfig.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "target": "esnext",
8
8
  "useDefineForClassFields": true,
9
9
  "module": "esnext",
10
- "moduleResolution": "node",
10
+ "moduleResolution": "bundler",
11
11
  "jsx": "react-jsx",
12
12
  "strict": true,
13
13
  "allowJs": false,
@@ -34,7 +34,7 @@ export default defineConfig({
34
34
  react(),
35
35
  dts({
36
36
  rollupTypes: true,
37
- include: ['src/slim-select/react/**/*'],
37
+ include: ['src/slim-select/react/index.tsx'],
38
38
  exclude: ['src/slim-select/**/*.test.ts', 'src/docs/**/*']
39
39
  })
40
40
  ]
@@ -33,7 +33,7 @@ export default defineConfig({
33
33
  vue(),
34
34
  dts({
35
35
  rollupTypes: true,
36
- include: ['src/slim-select/vue/**/*'],
36
+ include: ['src/slim-select/vue/index.ts'],
37
37
  exclude: ['src/slim-select/**/*.test.ts', 'src/docs/**/*']
38
38
  })
39
39
  ]