Skip to content

Commit 360d8ec

Browse files
committed
Merge branch 'master' into kaelwd/resolve-directives
2 parents 50505df + 56ca995 commit 360d8ec

File tree

52 files changed

+765
-363
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+765
-363
lines changed

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@
1313
}
1414
},
1515
"npmClient": "pnpm",
16-
"version": "3.8.4"
16+
"version": "3.8.6"
1717
}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@
8989
"overrides": {
9090
"@testing-library/dom": "npm:@vuetify/[email protected]",
9191
"@types/node": "22.15.12",
92+
"@vue/babel-plugin-jsx": "npm:@vuetify/[email protected]",
9293
"tough-cookie": "5.1.2"
9394
},
9495
"peerDependencyRules": {

packages/api-generator/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
22
"name": "@vuetify/api-generator",
33
"type": "module",
4-
"version": "3.8.4",
4+
"version": "3.8.6",
55
"private": true,
66
"description": "",
77
"scripts": {
88
"build": "node --import tsx src/index.ts",
99
"lint": "eslint --ext .ts,.json src -f codeframe --max-warnings 0",
10-
"lint:fix": "node --run lint -- --fix"
10+
"lint:fix": "pnpm lint --fix"
1111
},
1212
"author": "",
1313
"license": "ISC",
Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import fs from 'node:fs'
22

3-
function processVariableFile (filePath: string) {
3+
function processVariableFile (filePath: string, tagUse: string | string[]) {
44
if (fs.existsSync(filePath)) {
55
const varFile = fs.readFileSync(filePath, 'utf8')
66
const vars = varFile.replace(/\/\/.+[\r\n]+/g, '').split(/;[\n]*/g)
7-
const varValues: Record<string, { default: string }> = {}
7+
const varValues: Record<string, { default: string, use?: string }> = {}
88
for (const [index, variable] of vars.entries()) {
99
const varArr = variable.split(':')
1010
if (varArr.length >= 2 && varArr[0].startsWith('$')) {
@@ -14,6 +14,7 @@ function processVariableFile (filePath: string) {
1414
: varArr.join(':')
1515
varValues[varName] = {
1616
default: varDefault.replace('!default', '').trim(),
17+
...(tagUse) && { use: tagUse === 'all' || tagUse?.includes(varName) ? 'vuetify' : 'vuetify/settings' },
1718
}
1819
}
1920
}
@@ -25,19 +26,13 @@ function processVariableFile (filePath: string) {
2526

2627
export const parseSassVariables = (componentName: string) => {
2728
const rootDir = './../vuetify/src/components'
28-
return processVariableFile(`${rootDir}/${componentName}/_variables.scss`)
29+
return processVariableFile(`${rootDir}/${componentName}/_variables.scss`, '')
2930
}
3031

31-
// export function parseGlobalSassVariables () {
32-
// return [
33-
// './../vuetify/src/styles/settings/_colors.scss',
34-
// './../vuetify/src/styles/settings/_dark.scss',
35-
// './../vuetify/src/styles/settings/_elevations.scss',
36-
// './../vuetify/src/styles/settings/_light.scss',
37-
// './../vuetify/src/styles/settings/_theme.scss',
38-
// './../vuetify/src/styles/settings/_variables.scss',
39-
// ].reduce((acc, path) => {
40-
// acc.push(...processVariableFile(path))
41-
// return acc
42-
// }, []).sort((a, b) => a.name.localeCompare(b.name))
43-
// }
32+
export function parseGlobalSassVariables () {
33+
return {
34+
...processVariableFile(`./../vuetify/src/styles/settings/_variables.scss`, ['$reset', '$color-pack', '$utilities']),
35+
...processVariableFile(`./../vuetify/src/styles/settings/_colors.scss`, 'all'),
36+
...processVariableFile(`./../vuetify/src/styles/settings/_elevations.scss`, []),
37+
}
38+
}

packages/api-generator/src/index.ts

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ import { kebabCase } from './helpers/text'
77
import type { ComponentData, DirectiveData } from './types'
88
import { generateComposableDataFromTypes, generateDirectiveDataFromTypes } from './types'
99
import Piscina from 'piscina'
10-
import { addDescriptions, addDirectiveDescriptions, addPropData, reportMissingDescriptions, stringifyProps } from './utils'
10+
import { addDescriptions, addDirectiveDescriptions, addPropData, reportMissingDescriptions, sortByKey, stringifyProps } from './utils'
1111
import * as os from 'os'
1212
import { mkdirp } from 'mkdirp'
1313
import { createVeturApi } from './vetur'
1414
import { rimraf } from 'rimraf'
1515
import { createWebTypesApi } from './web-types'
1616
import inspector from 'inspector'
1717
import yargs from 'yargs'
18-
import { parseSassVariables } from './helpers/sass'
18+
import { parseGlobalSassVariables, parseSassVariables } from './helpers/sass'
1919

2020
const yar = yargs(process.argv.slice(2))
2121
.option('components', {
@@ -40,6 +40,10 @@ const componentsInfo: Record<string, { from: string }> = {
4040
type Truthy<T> = Exclude<T, null | undefined | 0 | '' | false>;
4141
const BooleanFilter = <T>(x: T): x is Truthy<T> => Boolean(x)
4242

43+
function clamp (v: number, min: number, max: number) {
44+
return Math.max(min, Math.floor(Math.min(max, v)))
45+
}
46+
4347
const run = async () => {
4448
const argv = await yar.argv
4549

@@ -49,7 +53,9 @@ const run = async () => {
4953
const pool = new Piscina({
5054
filename: path.resolve('./src/worker.ts'),
5155
niceIncrement: 10,
52-
maxThreads: inspector.url() ? 1 : Math.max(1, Math.floor(Math.min(os.cpus().length / 2, os.freemem() / (1.1 * 1024 ** 3)))),
56+
maxThreads: inspector.url()
57+
? 1
58+
: clamp(os.freemem() / (1.1 * 1024 ** 3), 1, os.cpus().length / 2),
5359
})
5460

5561
const template = await fs.readFile('./templates/component.d.ts', 'utf-8')
@@ -76,7 +82,7 @@ const run = async () => {
7682
const componentProps = stringifyProps(componentInstance.props)
7783
const sources = addPropData(componentName, data, componentProps)
7884
await addDescriptions(componentName, data, locales, sources)
79-
const sass = parseSassVariables(componentName)
85+
const sass = sortByKey(parseSassVariables(componentName))
8086

8187
const component = {
8288
displayName: componentName,
@@ -91,6 +97,15 @@ const run = async () => {
9197
})
9298
)).filter(BooleanFilter)
9399

100+
// globalSass
101+
const globalSass = {
102+
fileName: 'globals',
103+
displayName: 'globals',
104+
pathName: 'globals',
105+
sass: sortByKey(parseGlobalSassVariables()),
106+
}
107+
await fs.writeFile(path.resolve(outPath, `globals.json`), JSON.stringify(globalSass, null, 2))
108+
94109
// Composables
95110
if (!argv.skipComposables) {
96111
const composables = await Promise.all((await generateComposableDataFromTypes()).map(async composable => {

packages/api-generator/src/utils.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,15 @@ export async function addDirectiveDescriptions (
229229
}
230230
}
231231

232+
export function sortByKey (data: Record<string, any>) {
233+
return Object.keys(data)
234+
.sort()
235+
.reduce((obj: Record<string, any>, key: string) => {
236+
obj[key] = data[key]
237+
return obj
238+
}, {})
239+
}
240+
232241
export function stripLinks (str: string): [string, Record<string, string>] {
233242
let out = str.slice()
234243
const obj: Record<string, string> = {}

packages/docs/auto-imports.d.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ declare global {
1919
const camelCase: typeof import('lodash-es')['camelCase']
2020
const camelize: typeof import('vue')['camelize']
2121
const cleanCache: typeof import('./src/utils/pwa')['cleanCache']
22+
const compressAndEncode: typeof import('./src/composables/bin')['compressAndEncode']
2223
const computed: typeof import('vue')['computed']
2324
const configureMarkdown: typeof import('./src/utils/markdown-it')['configureMarkdown']
2425
const copyElementContent: typeof import('./src/utils/helpers')['copyElementContent']
@@ -28,6 +29,7 @@ declare global {
2829
const createOne: typeof import('@vuetify/one')['createOne']
2930
const createPinia: typeof import('pinia')['createPinia']
3031
const customRef: typeof import('vue')['customRef']
32+
const decodeAndDecompress: typeof import('./src/composables/bin')['decodeAndDecompress']
3133
const defineAsyncComponent: typeof import('vue')['defineAsyncComponent']
3234
const defineComponent: typeof import('vue')['defineComponent']
3335
const defineStore: typeof import('pinia')['defineStore']
@@ -117,6 +119,7 @@ declare global {
117119
const useAppStore: typeof import('./src/stores/app')['useAppStore']
118120
const useAttrs: typeof import('vue')['useAttrs']
119121
const useAuthStore: typeof import('@vuetify/one')['useAuthStore']
122+
const useBin: typeof import('./src/composables/bin')['useBin']
120123
const useCommitsStore: typeof import('./src/stores/commits')['useCommitsStore']
121124
const useCosmic: typeof import('./src/composables/cosmic')['useCosmic']
122125
const useCssModule: typeof import('vue')['useCssModule']
@@ -206,6 +209,7 @@ declare module 'vue' {
206209
readonly camelCase: UnwrapRef<typeof import('lodash-es')['camelCase']>
207210
readonly camelize: UnwrapRef<typeof import('vue')['camelize']>
208211
readonly cleanCache: UnwrapRef<typeof import('./src/utils/pwa')['cleanCache']>
212+
readonly compressAndEncode: UnwrapRef<typeof import('./src/composables/bin')['compressAndEncode']>
209213
readonly computed: UnwrapRef<typeof import('vue')['computed']>
210214
readonly configureMarkdown: UnwrapRef<typeof import('./src/utils/markdown-it')['configureMarkdown']>
211215
readonly copyElementContent: UnwrapRef<typeof import('./src/utils/helpers')['copyElementContent']>
@@ -214,6 +218,7 @@ declare module 'vue' {
214218
readonly createOne: UnwrapRef<typeof import('@vuetify/one')['createOne']>
215219
readonly createPinia: UnwrapRef<typeof import('pinia')['createPinia']>
216220
readonly customRef: UnwrapRef<typeof import('vue')['customRef']>
221+
readonly decodeAndDecompress: UnwrapRef<typeof import('./src/composables/bin')['decodeAndDecompress']>
217222
readonly defineAsyncComponent: UnwrapRef<typeof import('vue')['defineAsyncComponent']>
218223
readonly defineComponent: UnwrapRef<typeof import('vue')['defineComponent']>
219224
readonly defineStore: UnwrapRef<typeof import('pinia')['defineStore']>
@@ -298,6 +303,7 @@ declare module 'vue' {
298303
readonly useAppStore: UnwrapRef<typeof import('./src/stores/app')['useAppStore']>
299304
readonly useAttrs: UnwrapRef<typeof import('vue')['useAttrs']>
300305
readonly useAuthStore: UnwrapRef<typeof import('@vuetify/one')['useAuthStore']>
306+
readonly useBin: UnwrapRef<typeof import('./src/composables/bin')['useBin']>
301307
readonly useCommitsStore: UnwrapRef<typeof import('./src/stores/commits')['useCommitsStore']>
302308
readonly useCosmic: UnwrapRef<typeof import('./src/composables/cosmic')['useCosmic']>
303309
readonly useCssModule: UnwrapRef<typeof import('vue')['useCssModule']>

packages/docs/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "A Vue.js project",
55
"private": true,
66
"author": "John Leider <[email protected]>",
7-
"version": "3.8.4",
7+
"version": "3.8.6",
88
"repository": {
99
"type": "git",
1010
"url": "git+https://github.com/vuetifyjs/vuetify.git",
@@ -15,8 +15,8 @@
1515
"build": "vite build",
1616
"preview": "vite preview",
1717
"preview-https": "HTTPS=true vite preview",
18-
"lint": "concurrently 'vue-tsc --noEmit --pretty' 'node --run lint:md' 'jest --no-cache' -n 'tsc,md,eslint' --kill-others-on-fail -gr",
19-
"lint:fix": "node --run fix:md && JEST_FIX=true jest --no-cache",
18+
"lint": "concurrently 'vue-tsc --noEmit --pretty' 'pnpm lint:md' 'jest --no-cache' -n 'tsc,md,eslint' --kill-others-on-fail -gr",
19+
"lint:fix": "pnpm fix:md && JEST_FIX=true jest --no-cache",
2020
"lint:md": "markdownlint --config .markdownlintrc src/pages/en",
2121
"fix:md": "markdownlint --config .markdownlintrc src/pages/en --fix"
2222
},
@@ -26,7 +26,7 @@
2626
"@vue/compiler-dom": "^3.5.13",
2727
"@vuelidate/core": "^2.0.3",
2828
"@vuelidate/validators": "^2.0.4",
29-
"@vuetify/one": "^2.2.0",
29+
"@vuetify/one": "^2.2.4",
3030
"algoliasearch": "^4.24.0",
3131
"fflate": "^0.8.2",
3232
"isomorphic-fetch": "^3.0.0",

packages/docs/src/App.vue

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,16 @@
2121
const path = computed(() => route.path.replace(`/${locale.value}/`, ''))
2222
2323
const meta = computed(() => {
24+
let title = route.meta.title
25+
26+
// API pages
27+
if (route.meta.title === 'API') {
28+
const name = route.params.name as string
29+
title = `${name.charAt(0).toUpperCase()}${camelize(name.slice(1))} API`
30+
}
31+
2432
return genAppMetaInfo({
25-
title: `${route.meta.title}${path.value === '' ? '' : ' — Vuetify'}`,
33+
title: `${title}${path.value === '' ? '' : ' — Vuetify'}`,
2634
description: frontmatter.value?.meta.description,
2735
keywords: frontmatter.value?.meta.keywords,
2836
assets: frontmatter.value?.assets,

packages/docs/src/components/api/View.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
const name = route.params.name as string
1616
if (name.endsWith('-directive')) return name.replace('-directive', '')
1717
else if (name.startsWith('use-')) return camelCase(name)
18+
else if (name === 'globals') return name
1819
else return `${name.charAt(0).toUpperCase()}${camelize(name.slice(1))}`
1920
})
2021
const component = shallowRef<any>({})

0 commit comments

Comments
 (0)