@vuepress/theme-default 2.0.0-rc.21 → 2.0.0-rc.22

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.
@@ -32,6 +32,16 @@ const linksWrapperStyle = computed(() => {
32
32
  }
33
33
  })
34
34
 
35
+ const getCssValue = (el: HTMLElement | null, property: string): number => {
36
+ // NOTE: Known bug, will return 'auto' if style value is 'auto'
37
+ const val = el?.ownerDocument?.defaultView?.getComputedStyle(el, null)?.[
38
+ property
39
+ ]
40
+ const num = Number.parseInt(val, 10)
41
+
42
+ return Number.isNaN(num) ? 0 : num
43
+ }
44
+
35
45
  useUpdateDeviceStatus(
36
46
  DeviceType.MOBILE,
37
47
  (mobileDesktopBreakpoint: number): void => {
@@ -49,15 +59,6 @@ useUpdateDeviceStatus(
49
59
  }
50
60
  },
51
61
  )
52
-
53
- function getCssValue(el: HTMLElement | null, property: string): number {
54
- // NOTE: Known bug, will return 'auto' if style value is 'auto'
55
- const val = el?.ownerDocument?.defaultView?.getComputedStyle(el, null)?.[
56
- property
57
- ]
58
- const num = Number.parseInt(val, 10)
59
- return Number.isNaN(num) ? 0 : num
60
- }
61
62
  </script>
62
63
 
63
64
  <template>
@@ -1,3 +1,4 @@
1
+ import { useEventListener } from '@vueuse/core';
1
2
  import { onMounted } from 'vue';
2
3
  import cssVars from '../styles/_variables.module.scss?module';
3
4
  export var DeviceType;
@@ -17,9 +18,9 @@ export const useUpdateDeviceStatus = (deviceType, callback) => {
17
18
  throw new Error('device width must be a integer');
18
19
  return;
19
20
  }
21
+ useEventListener('orientationchange', () => callback(width), false);
22
+ useEventListener('resize', () => callback(width), false);
20
23
  onMounted(() => {
21
24
  callback(width);
22
- window.addEventListener('resize', () => callback(width), false);
23
- window.addEventListener('orientationchange', () => callback(width), false);
24
25
  });
25
26
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vuepress/theme-default",
3
- "version": "2.0.0-rc.21",
3
+ "version": "2.0.0-rc.22",
4
4
  "description": "Default theme of VuePress",
5
5
  "keywords": [
6
6
  "vuepress-theme",
@@ -42,20 +42,20 @@
42
42
  "copy": "cpx \"src/**/*.{d.ts,vue,scss}\" lib"
43
43
  },
44
44
  "dependencies": {
45
- "@vuepress/helper": "~2.0.0-rc.21",
45
+ "@vuepress/helper": "~2.0.0-rc.22",
46
46
  "@vuepress/plugin-active-header-links": "~2.0.0-rc.21",
47
- "@vuepress/plugin-back-to-top": "~2.0.0-rc.21",
47
+ "@vuepress/plugin-back-to-top": "~2.0.0-rc.22",
48
48
  "@vuepress/plugin-container": "~2.0.0-rc.21",
49
- "@vuepress/plugin-copy-code": "~2.0.0-rc.21",
49
+ "@vuepress/plugin-copy-code": "~2.0.0-rc.22",
50
50
  "@vuepress/plugin-external-link-icon": "~2.0.0-rc.21",
51
- "@vuepress/plugin-git": "~2.0.0-rc.21",
52
- "@vuepress/plugin-links-check": "~2.0.0-rc.21",
53
- "@vuepress/plugin-medium-zoom": "~2.0.0-rc.21",
51
+ "@vuepress/plugin-git": "~2.0.0-rc.22",
52
+ "@vuepress/plugin-links-check": "~2.0.0-rc.22",
53
+ "@vuepress/plugin-medium-zoom": "~2.0.0-rc.22",
54
54
  "@vuepress/plugin-nprogress": "~2.0.0-rc.21",
55
55
  "@vuepress/plugin-palette": "~2.0.0-rc.21",
56
56
  "@vuepress/plugin-prismjs": "~2.0.0-rc.21",
57
- "@vuepress/plugin-seo": "~2.0.0-rc.21",
58
- "@vuepress/plugin-sitemap": "~2.0.0-rc.21",
57
+ "@vuepress/plugin-seo": "~2.0.0-rc.22",
58
+ "@vuepress/plugin-sitemap": "~2.0.0-rc.22",
59
59
  "@vuepress/plugin-theme-data": "~2.0.0-rc.21",
60
60
  "@vueuse/core": "^10.9.0",
61
61
  "sass": "^1.72.0",
@@ -73,5 +73,5 @@
73
73
  "publishConfig": {
74
74
  "access": "public"
75
75
  },
76
- "gitHead": "014780ab182c15249ac9d27cee31d080f9ac01cd"
76
+ "gitHead": "088ab15335527cc0c644d7ec83e7588be675477e"
77
77
  }