@vuepress/theme-default
Advanced tools
Comparing version 2.0.0-rc.40 to 2.0.0-rc.41
import { useStorage } from '@vueuse/core'; | ||
import { computed, defineComponent, h, onBeforeUpdate, onMounted, ref, watch, } from 'vue'; | ||
import { useDarkMode } from '../../composables/useDarkMode.js'; | ||
import '../../styles/code-group.scss'; | ||
@@ -17,2 +18,20 @@ export const CodeGroup = defineComponent({ | ||
} | ||
const isDark = useDarkMode(); | ||
const groupRef = ref(); | ||
// shiki highlighter color & background | ||
onMounted(() => { | ||
if (!groupRef.value) | ||
return; | ||
const codeBlock = groupRef.value.querySelector('div[class*="language-"]'); | ||
if (codeBlock && codeBlock.dataset.highlighter === 'shiki') { | ||
const lightColor = codeBlock.style.getPropertyValue('--shiki-light'); | ||
const darkColor = codeBlock.style.getPropertyValue('--shiki-dark'); | ||
const lightBg = codeBlock.style.getPropertyValue('--shiki-light-bg'); | ||
const darkBg = codeBlock.style.getPropertyValue('--shiki-dark-bg'); | ||
watch(isDark, (val) => { | ||
groupRef.value.style.setProperty('--c-code-group-tab-bg', val ? darkBg : lightBg); | ||
groupRef.value.style.setProperty('--c-code-group-tab-title', val ? darkColor : lightColor); | ||
}, { immediate: true }); | ||
} | ||
}); | ||
// index of current active item | ||
@@ -99,3 +118,3 @@ const activeIndex = ref(-1); | ||
} | ||
return h('div', { class: 'code-group' }, [ | ||
return h('div', { class: 'code-group', ref: groupRef }, [ | ||
h('div', { class: 'code-group-nav', role: 'tablist' }, items.map((vnode, i) => { | ||
@@ -102,0 +121,0 @@ const isActive = i === activeIndex.value; |
{ | ||
"name": "@vuepress/theme-default", | ||
"version": "2.0.0-rc.40", | ||
"version": "2.0.0-rc.41", | ||
"description": "Default theme of VuePress", | ||
@@ -40,22 +40,22 @@ "keywords": [ | ||
"dependencies": { | ||
"@vuepress/helper": "2.0.0-rc.40", | ||
"@vuepress/plugin-active-header-links": "2.0.0-rc.40", | ||
"@vuepress/plugin-back-to-top": "2.0.0-rc.40", | ||
"@vuepress/plugin-copy-code": "2.0.0-rc.40", | ||
"@vuepress/helper": "2.0.0-rc.41", | ||
"@vuepress/plugin-active-header-links": "2.0.0-rc.41", | ||
"@vuepress/plugin-back-to-top": "2.0.0-rc.41", | ||
"@vuepress/plugin-copy-code": "2.0.0-rc.41", | ||
"@vuepress/plugin-git": "2.0.0-rc.38", | ||
"@vuepress/plugin-links-check": "2.0.0-rc.40", | ||
"@vuepress/plugin-markdown-container": "2.0.0-rc.37", | ||
"@vuepress/plugin-medium-zoom": "2.0.0-rc.40", | ||
"@vuepress/plugin-nprogress": "2.0.0-rc.40", | ||
"@vuepress/plugin-links-check": "2.0.0-rc.41", | ||
"@vuepress/plugin-markdown-container": "2.0.0-rc.41", | ||
"@vuepress/plugin-medium-zoom": "2.0.0-rc.41", | ||
"@vuepress/plugin-nprogress": "2.0.0-rc.41", | ||
"@vuepress/plugin-palette": "2.0.0-rc.37", | ||
"@vuepress/plugin-prismjs": "2.0.0-rc.40", | ||
"@vuepress/plugin-seo": "2.0.0-rc.40", | ||
"@vuepress/plugin-sitemap": "2.0.0-rc.40", | ||
"@vuepress/plugin-theme-data": "2.0.0-rc.40", | ||
"@vueuse/core": "^10.11.0", | ||
"@vuepress/plugin-prismjs": "2.0.0-rc.41", | ||
"@vuepress/plugin-seo": "2.0.0-rc.41", | ||
"@vuepress/plugin-sitemap": "2.0.0-rc.41", | ||
"@vuepress/plugin-theme-data": "2.0.0-rc.41", | ||
"@vueuse/core": "^10.11.1", | ||
"sass": "^1.77.8", | ||
"vue": "^3.4.34" | ||
"vue": "^3.4.37" | ||
}, | ||
"peerDependencies": { | ||
"sass-loader": "^15.0.0", | ||
"sass-loader": "^16.0.0", | ||
"vuepress": "2.0.0-rc.14" | ||
@@ -71,3 +71,3 @@ }, | ||
}, | ||
"gitHead": "942849e4983555f1a7cf03a96579110a505492cb" | ||
"gitHead": "7382aceb24df0b09f36ddd603dd4a00597343651" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
135427
1771
+ Added@vuepress/helper@2.0.0-rc.41(transitive)
+ Added@vuepress/highlighter-helper@2.0.0-rc.41(transitive)
+ Added@vuepress/plugin-active-header-links@2.0.0-rc.41(transitive)
+ Added@vuepress/plugin-back-to-top@2.0.0-rc.41(transitive)
+ Added@vuepress/plugin-copy-code@2.0.0-rc.41(transitive)
+ Added@vuepress/plugin-links-check@2.0.0-rc.41(transitive)
+ Added@vuepress/plugin-markdown-container@2.0.0-rc.41(transitive)
+ Added@vuepress/plugin-medium-zoom@2.0.0-rc.41(transitive)
+ Added@vuepress/plugin-nprogress@2.0.0-rc.41(transitive)
+ Added@vuepress/plugin-prismjs@2.0.0-rc.41(transitive)
+ Added@vuepress/plugin-seo@2.0.0-rc.41(transitive)
+ Added@vuepress/plugin-sitemap@2.0.0-rc.41(transitive)
+ Added@vuepress/plugin-theme-data@2.0.0-rc.41(transitive)
+ Addedcheerio@1.0.0(transitive)
+ Addedencoding-sniffer@0.2.0(transitive)
+ Addedhtmlparser2@9.1.0(transitive)
+ Addediconv-lite@0.6.3(transitive)
+ Addedparse5-parser-stream@7.1.2(transitive)
+ Addedsafer-buffer@2.1.2(transitive)
+ Addedsass-loader@16.0.1(transitive)
+ Addedundici@6.19.8(transitive)
+ Addedwhatwg-encoding@3.1.1(transitive)
+ Addedwhatwg-mimetype@4.0.0(transitive)
- Removed@vuepress/helper@2.0.0-rc.40(transitive)
- Removed@vuepress/highlighter-helper@2.0.0-rc.40(transitive)
- Removed@vuepress/plugin-active-header-links@2.0.0-rc.40(transitive)
- Removed@vuepress/plugin-back-to-top@2.0.0-rc.40(transitive)
- Removed@vuepress/plugin-copy-code@2.0.0-rc.40(transitive)
- Removed@vuepress/plugin-links-check@2.0.0-rc.40(transitive)
- Removed@vuepress/plugin-markdown-container@2.0.0-rc.37(transitive)
- Removed@vuepress/plugin-medium-zoom@2.0.0-rc.40(transitive)
- Removed@vuepress/plugin-nprogress@2.0.0-rc.40(transitive)
- Removed@vuepress/plugin-prismjs@2.0.0-rc.40(transitive)
- Removed@vuepress/plugin-seo@2.0.0-rc.40(transitive)
- Removed@vuepress/plugin-sitemap@2.0.0-rc.40(transitive)
- Removed@vuepress/plugin-theme-data@2.0.0-rc.40(transitive)
- Removedcheerio@1.0.0-rc.12(transitive)
- Removedhtmlparser2@8.0.2(transitive)
- Removedsass-loader@15.0.0(transitive)
Updated@vuepress/helper@2.0.0-rc.41
Updated@vueuse/core@^10.11.1
Updatedvue@^3.4.37