1
+ import { utilityTypes } from './utilityTypes.js'
2
+
1
3
import fs from 'fs'
2
4
3
5
const format = template => template . trim ( ) . replace ( new RegExp ( '^[ \\t]{12}' , 'gm' ) , '' )
@@ -10,7 +12,7 @@ const buildTypes = type => {
10
12
${ components . map ( component => {
11
13
return `import type { ${ component } Props } from './components/${ component } /${ component . toLowerCase ( ) } '`
12
14
} ) . join ( '\n' ) }
13
-
15
+
14
16
declare module 'webcoreui/${ type } ' {
15
17
${ components . map ( component => {
16
18
return `export function ${ component } (_props: ${ component } Props): any`
@@ -97,77 +99,7 @@ const buildTypes = type => {
97
99
}
98
100
99
101
if ( type === 'utils' ) {
100
- return format ( `
101
- type PopoverPosition = 'top'
102
- | 'top-start'
103
- | 'top-end'
104
- | 'left'
105
- | 'left-start'
106
- | 'left-end'
107
- | 'right'
108
- | 'right-start'
109
- | 'right-end'
110
- | 'bottom'
111
- | 'bottom-start'
112
- | 'bottom-end'
113
-
114
- type Popover = {
115
- trigger: string
116
- popover: string
117
- position?: PopoverPosition
118
- offset?: number
119
- closeOnBlur?: boolean
120
- }
121
-
122
- type Toast = {
123
- element: string
124
- timeout?: number
125
- title?: string
126
- content?: string
127
- theme?: 'info' | 'success' | 'warning' | 'alert' | null
128
- position?: 'bottom-left'
129
- | 'top-left'
130
- | 'top-right'
131
- | 'bottom-full'
132
- | 'top-full'
133
- }
134
-
135
- declare module 'webcoreui' {
136
- export const classNames = (classes: any[]) => string
137
-
138
- export const setCookie = (name: string, value: string, days: number) => {}
139
- export const getCookie = (name: string) => string | null
140
- export const removeCookie = (name: string) => {}
141
-
142
- export const debounce = (fn: any, waitFor: number) => any
143
-
144
- export const dispatch = (event: string, detail: any) => {}
145
- export const listen = (event: string, callback: (e: any) => any) => {
146
- remove()
147
- }
148
-
149
- export const clamp = (num: number, min: number, max: number) => number
150
- export const lerp = (start: number, end: number, value: number) => number
151
- export const invlerp = (start: number, end: number, value: number) => number
152
- export const interpolate = (
153
- value: number,
154
- input: [start: number, end: number],
155
- output: [start: number, end: number],
156
- ) => number
157
-
158
- export const modal = (selector: string) => {}
159
- export const closeModal = (selector: string) => {}
160
-
161
- export const popover = (config: Popover) => {
162
- remove()
163
- }
164
- export const closePopover = (selector: string) => {}
165
-
166
- export const setDefaultTimeout = (time: number) => number
167
- export const toast = (config: Toast | string) => {}
168
- export const hideToast = (element: string) => {}
169
- }
170
- ` )
102
+ return utilityTypes
171
103
}
172
104
}
173
105
0 commit comments