@studio-west/component-sw 0.11.9 → 0.11.10
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 +5 -5
- package/package.json +1 -1
- package/types/components.d.ts +39 -0
- package/types/index.d.ts +13 -25
package/README.md
CHANGED
|
@@ -58,7 +58,7 @@ The `Component SW` library provides a set of ready-to-use UI components on Vue 3
|
|
|
58
58
|
npm install @studio-west/component-sw
|
|
59
59
|
```
|
|
60
60
|
|
|
61
|
-
### Глобальное подключение / global add to main.js:
|
|
61
|
+
### Глобальное подключение / global add to main.js(:
|
|
62
62
|
```js
|
|
63
63
|
import { Library } from '@studio-west/component-sw';
|
|
64
64
|
import '@studio-west/component-sw/dist/component-sw.css';
|
|
@@ -720,10 +720,10 @@ model - состояние чекбокса (checked ) булевое знач
|
|
|
720
720
|
]
|
|
721
721
|
</script>
|
|
722
722
|
<sw-table :data="table">
|
|
723
|
-
<sw-table-
|
|
724
|
-
<sw-table-
|
|
725
|
-
<sw-table-
|
|
726
|
-
</sw-table-
|
|
723
|
+
<sw-table-Column label="Label" prop="title">
|
|
724
|
+
<sw-table-Column label="City" prop="city"/>
|
|
725
|
+
<sw-table-Column label="District" prop="district"/>
|
|
726
|
+
</sw-table-Column>
|
|
727
727
|
</sw-table>
|
|
728
728
|
```
|
|
729
729
|
---
|
package/package.json
CHANGED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// Dynamic component declarations
|
|
2
|
+
import type { DefineComponent } from 'vue'
|
|
3
|
+
|
|
4
|
+
// This creates a dynamic mapping of all Vue components in the components directory
|
|
5
|
+
type ComponentFiles = typeof import('../src/components/*.vue')
|
|
6
|
+
|
|
7
|
+
// Extract component names and create both naming conventions
|
|
8
|
+
type ComponentName<T extends string> = T extends `./src/components/${infer Name}.vue`
|
|
9
|
+
? Name
|
|
10
|
+
: never
|
|
11
|
+
|
|
12
|
+
// Convert kebab-case to PascalCase
|
|
13
|
+
type PascalCase<T extends string> = T extends `${infer First}-${infer Rest}`
|
|
14
|
+
? `${Capitalize<First>}${PascalCase<Rest>}`
|
|
15
|
+
: Capitalize<T>
|
|
16
|
+
|
|
17
|
+
// Create both naming convention mappings
|
|
18
|
+
type KebabCaseComponents = {
|
|
19
|
+
[K in keyof ComponentFiles as `sw-${ComponentName<K>}`]: DefineComponent<any>
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
type PascalCaseComponents = {
|
|
23
|
+
[K in keyof ComponentFiles as `Sw${PascalCase<ComponentName<K>>}`]: DefineComponent<any>
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Augment Vue's GlobalComponents interface to support both conventions
|
|
27
|
+
declare module 'vue' {
|
|
28
|
+
interface GlobalComponents extends KebabCaseComponents, PascalCaseComponents {}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Also augment our own module for direct imports
|
|
32
|
+
declare module '@studio-west/component-sw' {
|
|
33
|
+
export const components: Record<string, DefineComponent>
|
|
34
|
+
export const Alert: (options?: any) => void
|
|
35
|
+
export const Library: any
|
|
36
|
+
|
|
37
|
+
// Re-export all components individually
|
|
38
|
+
export type * from '../src/components/*.vue'
|
|
39
|
+
}
|
package/types/index.d.ts
CHANGED
|
@@ -69,32 +69,20 @@ export type SwInput = DefineComponent<SwInputProps>
|
|
|
69
69
|
export type SwSwitch = DefineComponent<SwSwitchProps>
|
|
70
70
|
export type SwSelect = DefineComponent<SwSelectProps>
|
|
71
71
|
|
|
72
|
-
// Global
|
|
72
|
+
// Dynamic Global Components interface
|
|
73
|
+
type ComponentNames = keyof typeof import('../src/components/*.vue')
|
|
74
|
+
type PascalCase<T extends string> = T extends `${infer First}-${infer Rest}`
|
|
75
|
+
? `${Capitalize<First>}${PascalCase<Rest>}`
|
|
76
|
+
: Capitalize<T>
|
|
77
|
+
|
|
78
|
+
type AvailableComponents = {
|
|
79
|
+
[K in ComponentNames as `Sw${PascalCase<K>}`]: DefineComponent<any>
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Global component registration - dynamically typed
|
|
73
83
|
declare module 'vue' {
|
|
74
|
-
export interface GlobalComponents {
|
|
75
|
-
SwButton: typeof import('../src/components/SwButton.vue')['default']
|
|
76
|
-
SwInput: typeof import('../src/components/SwInput.vue')['default']
|
|
77
|
-
SwSwitch: typeof import('../src/components/SwSwitch.vue')['default']
|
|
78
|
-
SwSelect: typeof import('../src/components/SwSelect.vue')['default']
|
|
79
|
-
SwAlert: typeof import('../src/components/SwAlert.vue')['default']
|
|
80
|
-
SwButtonGroup: typeof import('../src/components/SwButtonGroup.vue')['default']
|
|
81
|
-
SwCollapse: typeof import('../src/components/SwCollapse.vue')['default']
|
|
82
|
-
SwDropdown: typeof import('../src/components/SwDropdown.vue')['default']
|
|
83
|
-
SwDropdownItem: typeof import('../src/components/SwDropdownItem.vue')['default']
|
|
84
|
-
SwDropdownNew: typeof import('../src/components/SwDropdownNew.vue')['default']
|
|
85
|
-
SwFormItem: typeof import('../src/components/SwFormItem.vue')['default']
|
|
86
|
-
SwGide: typeof import('../src/components/SwGide.vue')['default']
|
|
87
|
-
SwIcon: typeof import('../src/components/SwIcon.vue')['default']
|
|
88
|
-
SwMessage: typeof import('../src/components/SwMessage.vue')['default']
|
|
89
|
-
SwSection: typeof import('../src/components/SwSection.vue')['default']
|
|
90
|
-
SwSkeleton: typeof import('../src/components/SwSkeleton.vue')['default']
|
|
91
|
-
SwSkeletonItem: typeof import('../src/components/SwSkeletonItem.vue')['default']
|
|
92
|
-
SwSlider: typeof import('../src/components/SwSlider.vue')['default']
|
|
93
|
-
SwTable: typeof import('../src/components/SwTable.vue')['default']
|
|
94
|
-
SwTableColumn: typeof import('../src/components/SwTableColumn.vue')['default']
|
|
95
|
-
SwTabs: typeof import('../src/components/SwTabs.vue')['default']
|
|
96
|
-
SwTabsPane: typeof import('../src/components/SwTabsPane.vue')['default']
|
|
97
|
-
}
|
|
84
|
+
export interface GlobalComponents extends AvailableComponents {}
|
|
98
85
|
}
|
|
99
86
|
|
|
87
|
+
// Named exports to match src/index.js
|
|
100
88
|
export { Library, components, Alert }
|