|
1 | | -import type { AcceptableValue as _AcceptableValue } from 'reka-ui' |
2 | | -import type { ClassValue } from 'tailwind-variants' |
3 | 1 | import type { VNode } from 'vue' |
4 | | - |
5 | | -export interface TightMap<O = any> { |
6 | | - [key: string]: TightMap | O |
7 | | -} |
8 | | - |
9 | | -export type DeepPartial<T, O = any> = { |
10 | | - [P in keyof T]?: T[P] extends Array<string> |
11 | | - ? string |
12 | | - : T[P] extends object |
13 | | - ? DeepPartial<T[P], O> |
14 | | - : T[P]; |
15 | | -} & { |
16 | | - [key: string]: O | TightMap<O> |
17 | | -} |
| 2 | +import type { AcceptableValue as _AcceptableValue } from 'reka-ui' |
18 | 3 |
|
19 | 4 | export type DynamicSlotsKeys<Name extends string | undefined, Suffix extends string | undefined = undefined> = ( |
20 | 5 | Name extends string |
@@ -56,13 +41,13 @@ export type MergeTypes<T extends object> = { |
56 | 41 | export type GetItemKeys<I> = keyof Extract<NestedItem<I>, object> |
57 | 42 |
|
58 | 43 | export type GetItemValue<I, VK extends GetItemKeys<I> | undefined, T extends NestedItem<I> = NestedItem<I>> = |
59 | | -T extends object |
60 | | - ? VK extends undefined |
61 | | - ? T |
62 | | - : VK extends keyof T |
63 | | - ? T[VK] |
64 | | - : never |
65 | | - : T |
| 44 | + T extends object |
| 45 | + ? VK extends undefined |
| 46 | + ? T |
| 47 | + : VK extends keyof T |
| 48 | + ? T[VK] |
| 49 | + : never |
| 50 | + : T |
66 | 51 |
|
67 | 52 | export type GetModelValue< |
68 | 53 | T, |
@@ -92,48 +77,4 @@ export type EmitsToProps<T> = { |
92 | 77 | : never |
93 | 78 | } |
94 | 79 |
|
95 | | -/** |
96 | | - * Utility type to flatten intersection types for better IDE hover information. |
97 | | - * @template T The type to flatten. |
98 | | - */ |
99 | | -type Id<T> = {} & { [P in keyof T]: T[P] } |
100 | | - |
101 | | -type ComponentVariants<T extends { variants?: Record<string, Record<string, any>> }> = { |
102 | | - [K in keyof T['variants']]: keyof T['variants'][K] |
103 | | -} |
104 | | - |
105 | | -type ComponentSlots<T extends { slots?: Record<string, any> }> = Id<{ |
106 | | - [K in keyof T['slots']]?: ClassValue |
107 | | -}> |
108 | | - |
109 | | -type GetComponentAppConfig<A, U extends string, K extends string> = |
110 | | - A extends Record<U, Record<K, any>> ? A[U][K] : {} |
111 | | - |
112 | | -type ComponentAppConfig< |
113 | | - T, |
114 | | - A extends Record<string, any>, |
115 | | - K extends string, |
116 | | - U extends string = 'ui' | 'uiPro' | 'uiPro.prose' |
117 | | -> = A & ( |
118 | | - U extends 'uiPro.prose' |
119 | | - ? { uiPro?: { prose?: { [k in K]?: Partial<T> } } } |
120 | | - : { [key in Exclude<U, 'uiPro.prose'>]?: { [k in K]?: Partial<T> } } |
121 | | -) |
122 | | - |
123 | | -/** |
124 | | - * Defines the configuration shape expected for a component. |
125 | | - * @template T The component's theme imported from `#build/ui/*`. |
126 | | - * @template A The base AppConfig type from `@nuxt/schema`. |
127 | | - * @template K The key identifying the component (e.g., 'badge'). |
128 | | - * @template U The top-level key in AppConfig ('ui' or 'uiPro'). |
129 | | - */ |
130 | | -export type ComponentConfig< |
131 | | - T extends Record<string, any>, |
132 | | - A extends Record<string, any>, |
133 | | - K extends string, |
134 | | - U extends 'ui' | 'uiPro' | 'uiPro.prose' = 'ui' |
135 | | -> = { |
136 | | - AppConfig: ComponentAppConfig<T, A, K, U> |
137 | | - variants: ComponentVariants<T & GetComponentAppConfig<A, U, K>> |
138 | | - slots: ComponentSlots<T> |
139 | | -} |
| 80 | +export * from './tv' |
0 commit comments