Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/vuetify/build/rollup.types.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ function createTypesConfig (input, output, renderChunk, filter) {
const options = {
input: file,
output: [{ file: outputFile, format: 'es', sourcemap: false }],
// prevent inlining types from internal-types on ESM build
external: output.startsWith('dist/') ? undefined : ['./internal-types.js'],
plugins: [
dts(),
{
Expand Down
2 changes: 2 additions & 0 deletions packages/vuetify/build/transform-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ import fs from 'node:fs/promises'
import { codeTransform } from './types-code-transform.js'
import path from 'upath'

/** @type {string[]} */
const files = fg.sync('lib/**/*.d.ts')

const importRegexp = /(?<a1>(?:import|export)(?:[^;])*?from ['"])(?<a2>(?:\.\.?|@)(?:\/[^;'"]*)?)(?<a3>['"];)|(?<b1>import\(['"])(?<b2>(?:\.\.?|@)(?:\/[^;'"]*)?)(?<b3>['"]\))/gm

for (const name of files) {
const code = await fs.readFile(name, 'utf-8')

/** @type {string} */
let newCode = codeTransform(code)

for (const match of code.matchAll(importRegexp)) {
Expand Down
3 changes: 3 additions & 0 deletions packages/vuetify/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@
"./locale": "./lib/locale/index.js",
"./locale/adapters/*": "./lib/locale/adapters/*.js",
"./iconsets/*": "./lib/iconsets/*.js",
"./internal-types": {
"types": "./lib/internal-types.d.ts"
},
"./labs/components": "./lib/labs/components.js",
"./labs/*": "./lib/labs/*/index.js",
"./util/colors": "./lib/util/colors.js",
Expand Down
10 changes: 5 additions & 5 deletions packages/vuetify/src/composables/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import type { VueHeadClient } from '@unhead/vue/client'
import type { HeadClient } from '@vueuse/head'
import type { App, DeepReadonly, InjectionKey, Ref } from 'vue'

type DeepPartial<T> = T extends object ? { [P in keyof T]?: DeepPartial<T[P]> } : T
export type DeepPartial<T> = T extends object ? { [P in keyof T]?: DeepPartial<T[P]> } : T

export type ThemeOptions = false | {
cspNonce?: string
Expand All @@ -46,7 +46,7 @@ export type ThemeOptions = false | {
}
export type ThemeDefinition = DeepPartial<InternalThemeDefinition>

interface InternalThemeOptions {
export interface InternalThemeOptions {
cspNonce?: string
isDisabled: boolean
defaultTheme: 'light' | 'dark' | 'system' | string & {}
Expand All @@ -60,13 +60,13 @@ interface InternalThemeOptions {
utilities: boolean
}

interface VariationsOptions {
export interface VariationsOptions {
colors: string[]
lighten: number
darken: number
}

interface InternalThemeDefinition {
export interface InternalThemeDefinition {
dark: boolean
colors: Colors
variables: Record<string, string | number>
Expand All @@ -76,7 +76,7 @@ export interface Colors extends BaseColors, OnColors {
[key: string]: string
}

interface BaseColors {
export interface BaseColors {
background: string
surface: string
primary: string
Expand Down
18 changes: 11 additions & 7 deletions packages/vuetify/src/framework.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,17 @@ import { defineComponent, IN_BROWSER, mergeDeep } from '@/util'

// Types
import type { App, ComponentPublicInstance, InjectionKey } from 'vue'
import type { DateOptions } from '@/composables/date'
import type { DefaultsOptions } from '@/composables/defaults'
import type { DisplayOptions, SSROptions } from '@/composables/display'
import type { GoToOptions } from '@/composables/goto'
import type { IconOptions } from '@/composables/icons'
import type { LocaleOptions, RtlOptions } from '@/composables/locale'
import type { ThemeOptions } from '@/composables/theme'
import type {
DateOptions,
DefaultsOptions,
DisplayOptions,
GoToOptions,
IconOptions,
LocaleOptions,
RtlOptions,
SSROptions,
ThemeOptions,
} from './internal-types'

// Exports
export * from './composables'
Expand Down
8 changes: 8 additions & 0 deletions packages/vuetify/src/internal-types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Types
export type * from '@/composables/date'
export type * from '@/composables/defaults'
export type * from '@/composables/display'
export type * from '@/composables/goto'
export type * from '@/composables/icons'
export type * from '@/composables/locale'
export type * from '@/composables/theme'