@vuetify/nightly 3.8.0-master.2025-04-06 → 3.8.1-master.2025-04-07

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Vuetify v3.8.0-master.2025-04-06
2
+ * Vuetify v3.8.1-master.2025-04-07
3
3
  * Forged by John Leider
4
4
  * Released under the MIT License.
5
5
  */
@@ -2386,93 +2386,144 @@
2386
2386
  themes
2387
2387
  });
2388
2388
  }
2389
+ function createCssClass(lines, selector, content, scope) {
2390
+ lines.push(`${getScopedSelector(selector, scope)} {\n`, ...content.map(line => ` ${line};\n`), '}\n');
2391
+ }
2392
+ function genCssVariables(theme) {
2393
+ const lightOverlay = theme.dark ? 2 : 1;
2394
+ const darkOverlay = theme.dark ? 1 : 2;
2395
+ const variables = [];
2396
+ for (const [key, value] of Object.entries(theme.colors)) {
2397
+ const rgb = parseColor(value);
2398
+ variables.push(`--v-theme-${key}: ${rgb.r},${rgb.g},${rgb.b}`);
2399
+ if (!key.startsWith('on-')) {
2400
+ variables.push(`--v-theme-${key}-overlay-multiplier: ${getLuma(value) > 0.18 ? lightOverlay : darkOverlay}`);
2401
+ }
2402
+ }
2403
+ for (const [key, value] of Object.entries(theme.variables)) {
2404
+ const color = typeof value === 'string' && value.startsWith('#') ? parseColor(value) : undefined;
2405
+ const rgb = color ? `${color.r}, ${color.g}, ${color.b}` : undefined;
2406
+ variables.push(`--v-${key}: ${rgb ?? value}`);
2407
+ }
2408
+ return variables;
2409
+ }
2410
+ function genVariation(name, color, variations) {
2411
+ const object = {};
2412
+ if (variations) {
2413
+ for (const variation of ['lighten', 'darken']) {
2414
+ const fn = variation === 'lighten' ? lighten : darken;
2415
+ for (const amount of createRange(variations[variation], 1)) {
2416
+ object[`${name}-${variation}-${amount}`] = RGBtoHex(fn(parseColor(color), amount));
2417
+ }
2418
+ }
2419
+ }
2420
+ return object;
2421
+ }
2422
+ function genVariations(colors, variations) {
2423
+ if (!variations) return {};
2424
+ let variationColors = {};
2425
+ for (const name of variations.colors) {
2426
+ const color = colors[name];
2427
+ if (!color) continue;
2428
+ variationColors = {
2429
+ ...variationColors,
2430
+ ...genVariation(name, color, variations)
2431
+ };
2432
+ }
2433
+ return variationColors;
2434
+ }
2435
+ function genOnColors(colors) {
2436
+ const onColors = {};
2437
+ for (const color of Object.keys(colors)) {
2438
+ if (color.startsWith('on-') || colors[`on-${color}`]) continue;
2439
+ const onColor = `on-${color}`;
2440
+ const colorVal = parseColor(colors[color]);
2441
+ onColors[onColor] = getForeground(colorVal);
2442
+ }
2443
+ return onColors;
2444
+ }
2445
+ function getScopedSelector(selector, scope) {
2446
+ if (!scope) return selector;
2447
+ const scopeSelector = `:where(${scope})`;
2448
+ return selector === ':root' ? scopeSelector : `${scopeSelector} ${selector}`;
2449
+ }
2450
+ function upsertStyles(styleEl, styles) {
2451
+ if (!styleEl) return;
2452
+ styleEl.innerHTML = styles;
2453
+ }
2454
+ function getOrCreateStyleElement(id, cspNonce) {
2455
+ if (!IN_BROWSER) return null;
2456
+ let style = document.getElementById(id);
2457
+ if (!style) {
2458
+ style = document.createElement('style');
2459
+ style.id = id;
2460
+ style.type = 'text/css';
2461
+ if (cspNonce) style.setAttribute('nonce', cspNonce);
2462
+ document.head.appendChild(style);
2463
+ }
2464
+ return style;
2465
+ }
2389
2466
 
2390
2467
  // Composables
2391
2468
  function createTheme(options) {
2392
2469
  const parsedOptions = parseThemeOptions(options);
2393
- const name = vue.ref(parsedOptions.defaultTheme);
2470
+ const name = vue.shallowRef(parsedOptions.defaultTheme);
2394
2471
  const themes = vue.ref(parsedOptions.themes);
2395
2472
  const computedThemes = vue.computed(() => {
2396
2473
  const acc = {};
2397
2474
  for (const [name, original] of Object.entries(themes.value)) {
2398
- const theme = acc[name] = {
2475
+ const colors = {
2476
+ ...original.colors,
2477
+ ...genVariations(original.colors, parsedOptions.variations)
2478
+ };
2479
+ acc[name] = {
2399
2480
  ...original,
2400
2481
  colors: {
2401
- ...original.colors
2482
+ ...colors,
2483
+ ...genOnColors(colors)
2402
2484
  }
2403
2485
  };
2404
- if (parsedOptions.variations) {
2405
- for (const name of parsedOptions.variations.colors) {
2406
- const color = theme.colors[name];
2407
- if (!color) continue;
2408
- for (const variation of ['lighten', 'darken']) {
2409
- const fn = variation === 'lighten' ? lighten : darken;
2410
- for (const amount of createRange(parsedOptions.variations[variation], 1)) {
2411
- theme.colors[`${name}-${variation}-${amount}`] = RGBtoHex(fn(parseColor(color), amount));
2412
- }
2413
- }
2414
- }
2415
- }
2416
- for (const color of Object.keys(theme.colors)) {
2417
- if (/^on-[a-z]/.test(color) || theme.colors[`on-${color}`]) continue;
2418
- const onColor = `on-${color}`;
2419
- const colorVal = parseColor(theme.colors[color]);
2420
- theme.colors[onColor] = getForeground(colorVal);
2421
- }
2422
2486
  }
2423
2487
  return acc;
2424
2488
  });
2425
2489
  const current = vue.computed(() => computedThemes.value[name.value]);
2426
- function createCssClass(lines, selector, content) {
2427
- lines.push(`${getScopedSelector(selector)} {\n`, ...content.map(line => ` ${line};\n`), '}\n');
2428
- }
2429
- function getScopedSelector(selector) {
2430
- if (!parsedOptions.scope) {
2431
- return selector;
2432
- }
2433
- const scopeSelector = `:where(${parsedOptions.scope})`;
2434
- if (selector === ':root') {
2435
- return scopeSelector;
2436
- }
2437
- return `${scopeSelector} ${selector}`;
2438
- }
2439
2490
  const styles = vue.computed(() => {
2440
2491
  const lines = [];
2441
2492
  if (current.value?.dark) {
2442
- createCssClass(lines, ':root', ['color-scheme: dark']);
2493
+ createCssClass(lines, ':root', ['color-scheme: dark'], parsedOptions.scope);
2443
2494
  }
2444
- createCssClass(lines, ':root', genCssVariables(current.value));
2495
+ createCssClass(lines, ':root', genCssVariables(current.value), parsedOptions.scope);
2445
2496
  for (const [themeName, theme] of Object.entries(computedThemes.value)) {
2446
- createCssClass(lines, `.v-theme--${themeName}`, [`color-scheme: ${theme.dark ? 'dark' : 'normal'}`, ...genCssVariables(theme)]);
2497
+ createCssClass(lines, `.v-theme--${themeName}`, [`color-scheme: ${theme.dark ? 'dark' : 'normal'}`, ...genCssVariables(theme)], parsedOptions.scope);
2447
2498
  }
2448
2499
  const bgLines = [];
2449
2500
  const fgLines = [];
2450
2501
  const colors = new Set(Object.values(computedThemes.value).flatMap(theme => Object.keys(theme.colors)));
2451
2502
  for (const key of colors) {
2452
- if (/^on-[a-z]/.test(key)) {
2453
- createCssClass(fgLines, `.${key}`, [`color: rgb(var(--v-theme-${key})) !important`]);
2503
+ if (key.startsWith('on-')) {
2504
+ createCssClass(fgLines, `.${key}`, [`color: rgb(var(--v-theme-${key})) !important`], parsedOptions.scope);
2454
2505
  } else {
2455
- createCssClass(bgLines, `.bg-${key}`, [`--v-theme-overlay-multiplier: var(--v-theme-${key}-overlay-multiplier)`, `background-color: rgb(var(--v-theme-${key})) !important`, `color: rgb(var(--v-theme-on-${key})) !important`]);
2456
- createCssClass(fgLines, `.text-${key}`, [`color: rgb(var(--v-theme-${key})) !important`]);
2457
- createCssClass(fgLines, `.border-${key}`, [`--v-border-color: var(--v-theme-${key})`]);
2506
+ createCssClass(bgLines, `.bg-${key}`, [`--v-theme-overlay-multiplier: var(--v-theme-${key}-overlay-multiplier)`, `background-color: rgb(var(--v-theme-${key})) !important`, `color: rgb(var(--v-theme-on-${key})) !important`], parsedOptions.scope);
2507
+ createCssClass(fgLines, `.text-${key}`, [`color: rgb(var(--v-theme-${key})) !important`], parsedOptions.scope);
2508
+ createCssClass(fgLines, `.border-${key}`, [`--v-border-color: var(--v-theme-${key})`], parsedOptions.scope);
2458
2509
  }
2459
2510
  }
2460
2511
  lines.push(...bgLines, ...fgLines);
2461
2512
  return lines.map((str, i) => i === 0 ? str : ` ${str}`).join('');
2462
2513
  });
2463
- function getHead() {
2464
- return {
2465
- style: [{
2466
- textContent: styles.value,
2467
- id: parsedOptions.stylesheetId,
2468
- nonce: parsedOptions.cspNonce || false
2469
- }]
2470
- };
2471
- }
2472
2514
  function install(app) {
2473
2515
  if (parsedOptions.isDisabled) return;
2474
2516
  const head = app._context.provides.usehead;
2475
2517
  if (head) {
2518
+ function getHead() {
2519
+ return {
2520
+ style: [{
2521
+ textContent: styles.value,
2522
+ id: parsedOptions.stylesheetId,
2523
+ nonce: parsedOptions.cspNonce || false
2524
+ }]
2525
+ };
2526
+ }
2476
2527
  if (head.push) {
2477
2528
  const entry = head.push(getHead);
2478
2529
  if (IN_BROWSER) {
@@ -2489,7 +2540,6 @@
2489
2540
  }
2490
2541
  }
2491
2542
  } else {
2492
- let styleEl = IN_BROWSER ? document.getElementById(parsedOptions.stylesheetId) : null;
2493
2543
  if (IN_BROWSER) {
2494
2544
  vue.watch(styles, updateStyles, {
2495
2545
  immediate: true
@@ -2498,15 +2548,7 @@
2498
2548
  updateStyles();
2499
2549
  }
2500
2550
  function updateStyles() {
2501
- if (typeof document !== 'undefined' && !styleEl) {
2502
- const el = document.createElement('style');
2503
- el.type = 'text/css';
2504
- el.id = parsedOptions.stylesheetId;
2505
- if (parsedOptions.cspNonce) el.setAttribute('nonce', parsedOptions.cspNonce);
2506
- styleEl = el;
2507
- document.head.appendChild(styleEl);
2508
- }
2509
- if (styleEl) styleEl.innerHTML = styles.value;
2551
+ upsertStyles(getOrCreateStyleElement(parsedOptions.stylesheetId, parsedOptions.cspNonce), styles.value);
2510
2552
  }
2511
2553
  }
2512
2554
  }
@@ -2530,9 +2572,7 @@
2530
2572
  getCurrentInstance('provideTheme');
2531
2573
  const theme = vue.inject(ThemeSymbol, null);
2532
2574
  if (!theme) throw new Error('Could not find Vuetify theme injection');
2533
- const name = vue.computed(() => {
2534
- return props.theme ?? theme.name.value;
2535
- });
2575
+ const name = vue.computed(() => props.theme ?? theme.name.value);
2536
2576
  const current = vue.computed(() => theme.themes.value[name.value]);
2537
2577
  const themeClasses = vue.computed(() => theme.isDisabled ? undefined : `v-theme--${name.value}`);
2538
2578
  const newTheme = {
@@ -2550,24 +2590,6 @@
2550
2590
  if (!theme) throw new Error('Could not find Vuetify theme injection');
2551
2591
  return theme;
2552
2592
  }
2553
- function genCssVariables(theme) {
2554
- const lightOverlay = theme.dark ? 2 : 1;
2555
- const darkOverlay = theme.dark ? 1 : 2;
2556
- const variables = [];
2557
- for (const [key, value] of Object.entries(theme.colors)) {
2558
- const rgb = parseColor(value);
2559
- variables.push(`--v-theme-${key}: ${rgb.r},${rgb.g},${rgb.b}`);
2560
- if (!key.startsWith('on-')) {
2561
- variables.push(`--v-theme-${key}-overlay-multiplier: ${getLuma(value) > 0.18 ? lightOverlay : darkOverlay}`);
2562
- }
2563
- }
2564
- for (const [key, value] of Object.entries(theme.variables)) {
2565
- const color = typeof value === 'string' && value.startsWith('#') ? parseColor(value) : undefined;
2566
- const rgb = color ? `${color.r}, ${color.g}, ${color.b}` : undefined;
2567
- variables.push(`--v-${key}: ${rgb ?? value}`);
2568
- }
2569
- return variables;
2570
- }
2571
2593
 
2572
2594
  const makeVAppProps = propsFactory({
2573
2595
  ...makeComponentProps(),
@@ -31542,7 +31564,7 @@
31542
31564
  };
31543
31565
  });
31544
31566
  }
31545
- const version$1 = "3.8.0-master.2025-04-06";
31567
+ const version$1 = "3.8.1-master.2025-04-07";
31546
31568
  createVuetify$1.version = version$1;
31547
31569
 
31548
31570
  // Vue's inject() can only be used in setup
@@ -31827,7 +31849,7 @@
31827
31849
 
31828
31850
  /* eslint-disable local-rules/sort-imports */
31829
31851
 
31830
- const version = "3.8.0-master.2025-04-06";
31852
+ const version = "3.8.1-master.2025-04-07";
31831
31853
 
31832
31854
  /* eslint-disable local-rules/sort-imports */
31833
31855