Skip to content

Commit

Permalink
chore: vue update type defs
Browse files Browse the repository at this point in the history
  • Loading branch information
cschroeter committed Apr 28, 2024
1 parent 7ccf3be commit a4bf0f1
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 31 deletions.
4 changes: 2 additions & 2 deletions frameworks/vue/src/components/accordion/accordion.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ export interface RootProps {
*/
collapsible?: boolean
/**
* The initial value of the accordion items that are expanded.
* Use this when you do not need to control the state of the items.
* The initial value of the accordion that are expanded.
* Use this when you do not need to control the state of the accordion.
*/
defaultValue?: string[]
/**
Expand Down
1 change: 0 additions & 1 deletion frameworks/vue/src/components/carousel/carousel.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ export interface RootProps {
* The alignment of the slides in the carousel.
*/
align?: 'start' | 'center' | 'end'

/**
* The unique identifier of the machine.
*/
Expand Down
12 changes: 1 addition & 11 deletions frameworks/vue/src/components/color-picker/color-picker.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,7 @@ export interface RootProps {
*/
closeOnSelect?: boolean
/**
* The direction of the color picker
*/
dir?: 'ltr' | 'rtl'
/**
* The initial open state of the color picker when it is first rendered.
* Use when you do not need to control its open state.
* The initial open state of the color picker.
*/
defaultOpen?: boolean
/**
Expand All @@ -27,7 +22,6 @@ export interface RootProps {
* The color format to use
*/
format?: colorPicker.ColorFormat

/**
* The unique identifier of the machine.
*/
Expand Down Expand Up @@ -111,8 +105,4 @@ export type RootEmits = {
* The callback fired when the model value changes.
*/
'update:modelValue': [value: string]
/**
* Event handler called when the open state of the color picker changes.
*/
'update:open': [open: boolean]
}
4 changes: 0 additions & 4 deletions frameworks/vue/src/components/dialog/dialog.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ export interface RootProps {
* Element to receive focus when the dialog is closed
*/
finalFocusEl?: HTMLElement | (() => HTMLElement)
/**
* A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron.
*/
getRootNode?: () => Node | ShadowRoot | Document
/**
* The unique identifier of the machine.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export interface RootProps {
* The default camera to use when capturing media
*/
capture?: 'user' | 'environment'

/**
* Whether to accept directories, only works in webkit browsers
*/
Expand All @@ -22,7 +21,6 @@ export interface RootProps {
* Whether the file input is disabled
*/
disabled?: boolean

/**
* The unique identifier of the machine.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ export interface RootProps {
* Total number of data items
*/
count: number

/**
* The unique identifier of the machine.
*/
Expand Down
2 changes: 0 additions & 2 deletions frameworks/vue/src/components/switch/switch.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ export interface RootProps {
* Whether the switch is checked.
*/
checked?: boolean

/**
* Whether the switch is disabled.
*/
Expand All @@ -14,7 +13,6 @@ export interface RootProps {
* The id of the form that the switch belongs to
*/
form?: string

/**
* The unique identifier of the machine.
*/
Expand Down
4 changes: 0 additions & 4 deletions frameworks/vue/src/components/tooltip/tooltip.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,4 @@ export type RootEmits = {
* Function called when the tooltip is opened.
*/
openChange: [details: tooltip.OpenChangeDetails]
/**
* Function called when the tooltip is updated.
*/
'update:open': [open: boolean]
}
2 changes: 0 additions & 2 deletions frameworks/vue/src/components/tree-view/tree-view.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ export interface RootProps {
* The initial focused index of the tree view.
*/
defaultFocusedId?: string

/**
* The id of the expanded nodes
*/
Expand All @@ -14,7 +13,6 @@ export interface RootProps {
* The id of the focused node
*/
focusedValue?: string

/**
* The unique identifier of the machine.
*/
Expand Down
22 changes: 20 additions & 2 deletions scripts/src/generate-vue-props.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { parse } from 'node:path'
import { globby } from 'globby'
import { type OptionalKind, Project, type PropertySignatureStructure } from 'ts-morph'
import { chain } from 'voca'

const extractTypes = (component: string) => {
console.log('Generating props for', component)
const camelCaseComponent = chain(component).camelCase().value()

const project = new Project()
Expand Down Expand Up @@ -105,9 +108,24 @@ const extractTypes = (component: string) => {

const main = async () => {
const component = process.argv.slice(2)[0]
console.log('Generating props for', component)

extractTypes(component)
if (component) {
console.log('Generating props for', component)
extractTypes(component)
return
}

console.log('Generating props for all components')
const components = await globby(['../frameworks/vue/src/components/*'], {
onlyDirectories: true,
deep: 1,
})
Promise.all(
components
.map((component) => parse(component).base)
.filter((x) => !['format', 'toast'].includes(x))
.map(extractTypes),
)
}

main().catch((err) => {
Expand Down

0 comments on commit a4bf0f1

Please sign in to comment.