@vuepress/theme-default 2.0.0-rc.40 → 2.0.0-rc.41

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,6 @@
1
1
  import { useStorage } from '@vueuse/core';
2
2
  import { computed, defineComponent, h, onBeforeUpdate, onMounted, ref, watch, } from 'vue';
3
+ import { useDarkMode } from '../../composables/useDarkMode.js';
3
4
  import '../../styles/code-group.scss';
4
5
  export const CodeGroup = defineComponent({
5
6
  name: 'CodeGroup',
@@ -14,6 +15,24 @@ export const CodeGroup = defineComponent({
14
15
  tabRefs.value = [];
15
16
  });
16
17
  }
18
+ const isDark = useDarkMode();
19
+ const groupRef = ref();
20
+ // shiki highlighter color & background
21
+ onMounted(() => {
22
+ if (!groupRef.value)
23
+ return;
24
+ const codeBlock = groupRef.value.querySelector('div[class*="language-"]');
25
+ if (codeBlock && codeBlock.dataset.highlighter === 'shiki') {
26
+ const lightColor = codeBlock.style.getPropertyValue('--shiki-light');
27
+ const darkColor = codeBlock.style.getPropertyValue('--shiki-dark');
28
+ const lightBg = codeBlock.style.getPropertyValue('--shiki-light-bg');
29
+ const darkBg = codeBlock.style.getPropertyValue('--shiki-dark-bg');
30
+ watch(isDark, (val) => {
31
+ groupRef.value.style.setProperty('--c-code-group-tab-bg', val ? darkBg : lightBg);
32
+ groupRef.value.style.setProperty('--c-code-group-tab-title', val ? darkColor : lightColor);
33
+ }, { immediate: true });
34
+ }
35
+ });
17
36
  // index of current active item
18
37
  const activeIndex = ref(-1);
19
38
  const codeGroupStorage = useStorage('vuepress-code-group', {});
@@ -95,7 +114,7 @@ export const CodeGroup = defineComponent({
95
114
  vnode.props.active = i === activeIndex.value;
96
115
  });
97
116
  }
98
- return h('div', { class: 'code-group' }, [
117
+ return h('div', { class: 'code-group', ref: groupRef }, [
99
118
  h('div', { class: 'code-group-nav', role: 'tablist' }, items.map((vnode, i) => {
100
119
  const isActive = i === activeIndex.value;
101
120
  return h('button', {
@@ -16,6 +16,8 @@
16
16
 
17
17
  background-color: var(--c-code-group-tab-bg);
18
18
 
19
+ transition: background-color var(--t-color);
20
+
19
21
  @media (max-width: $MQMobileNarrow) {
20
22
  margin-right: -1.5rem;
21
23
  margin-left: -1.5rem;
@@ -63,8 +63,8 @@
63
63
  --c-badge-danger-text: var(--c-bg);
64
64
 
65
65
  // code group colors
66
- --c-code-group-tab-title: rgb(255 255 255 / 90%);
67
- --c-code-group-tab-bg: var(--code-bg-color);
66
+ --c-code-group-tab-title: var(--code-c-text, rgb(255 255 255 / 90%));
67
+ --c-code-group-tab-bg: var(--code-bg-color, var(--code-c-bg));
68
68
  --c-code-group-tab-outline: var(var(--c-code-group-tab-title));
69
69
  --c-code-group-tab-active-border: var(--c-brand);
70
70
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vuepress/theme-default",
3
- "version": "2.0.0-rc.40",
3
+ "version": "2.0.0-rc.41",
4
4
  "description": "Default theme of VuePress",
5
5
  "keywords": [
6
6
  "vuepress-theme",
@@ -37,26 +37,26 @@
37
37
  "templates"
38
38
  ],
39
39
  "dependencies": {
40
- "@vuepress/helper": "2.0.0-rc.40",
41
- "@vuepress/plugin-active-header-links": "2.0.0-rc.40",
42
- "@vuepress/plugin-back-to-top": "2.0.0-rc.40",
43
- "@vuepress/plugin-copy-code": "2.0.0-rc.40",
40
+ "@vuepress/helper": "2.0.0-rc.41",
41
+ "@vuepress/plugin-active-header-links": "2.0.0-rc.41",
42
+ "@vuepress/plugin-back-to-top": "2.0.0-rc.41",
43
+ "@vuepress/plugin-copy-code": "2.0.0-rc.41",
44
44
  "@vuepress/plugin-git": "2.0.0-rc.38",
45
- "@vuepress/plugin-links-check": "2.0.0-rc.40",
46
- "@vuepress/plugin-markdown-container": "2.0.0-rc.37",
47
- "@vuepress/plugin-medium-zoom": "2.0.0-rc.40",
48
- "@vuepress/plugin-nprogress": "2.0.0-rc.40",
45
+ "@vuepress/plugin-links-check": "2.0.0-rc.41",
46
+ "@vuepress/plugin-markdown-container": "2.0.0-rc.41",
47
+ "@vuepress/plugin-medium-zoom": "2.0.0-rc.41",
48
+ "@vuepress/plugin-nprogress": "2.0.0-rc.41",
49
49
  "@vuepress/plugin-palette": "2.0.0-rc.37",
50
- "@vuepress/plugin-prismjs": "2.0.0-rc.40",
51
- "@vuepress/plugin-seo": "2.0.0-rc.40",
52
- "@vuepress/plugin-sitemap": "2.0.0-rc.40",
53
- "@vuepress/plugin-theme-data": "2.0.0-rc.40",
54
- "@vueuse/core": "^10.11.0",
50
+ "@vuepress/plugin-prismjs": "2.0.0-rc.41",
51
+ "@vuepress/plugin-seo": "2.0.0-rc.41",
52
+ "@vuepress/plugin-sitemap": "2.0.0-rc.41",
53
+ "@vuepress/plugin-theme-data": "2.0.0-rc.41",
54
+ "@vueuse/core": "^10.11.1",
55
55
  "sass": "^1.77.8",
56
- "vue": "^3.4.34"
56
+ "vue": "^3.4.37"
57
57
  },
58
58
  "peerDependencies": {
59
- "sass-loader": "^15.0.0",
59
+ "sass-loader": "^16.0.0",
60
60
  "vuepress": "2.0.0-rc.14"
61
61
  },
62
62
  "peerDependenciesMeta": {
@@ -67,5 +67,5 @@
67
67
  "publishConfig": {
68
68
  "access": "public"
69
69
  },
70
- "gitHead": "942849e4983555f1a7cf03a96579110a505492cb"
70
+ "gitHead": "7382aceb24df0b09f36ddd603dd4a00597343651"
71
71
  }