Skip to content

Commit

Permalink
Merge pull request #46 from visualjerk/chore/upgrade-vue
Browse files Browse the repository at this point in the history
Chore/upgrade vue

Closes #43
  • Loading branch information
visualjerk authored Jan 22, 2022
2 parents ab3ddb8 + e658268 commit 0e0cb80
Show file tree
Hide file tree
Showing 41 changed files with 6,870 additions and 8,830 deletions.
4 changes: 2 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ module.exports = {
'plugin:vue/vue3-recommended',
'plugin:@typescript-eslint/recommended',
'prettier',
'prettier/@typescript-eslint',
'prettier/vue',
],
parser: 'vue-eslint-parser',
parserOptions: {
Expand All @@ -22,5 +20,7 @@ module.exports = {
rules: {
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'vue/multi-word-component-names': 'off',
},
ignorePatterns: ['lib', 'docs', 'coverage'],
}
2 changes: 1 addition & 1 deletion docs/src/components/LayoutHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
</a>

<ToggleDarkMode class="ml-2 sm:ml-8">
<template slot="default" slot-scope="{ dark }">
<template #default="{ dark }" >
<MoonIcon v-if="dark" size="1.5x" />
<SunIcon v-else size="1.5x" />
</template>
Expand Down
18 changes: 9 additions & 9 deletions docs/src/components/OnThisPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,15 @@ export default {
}
},
mounted() {
if (process.isClient) {
if (window.location.hash) {
this.activeAnchor = window.location.hash;
}
this.$nextTick(this.initObserver);
}
},
methods: {
observerCallback(entries, observer) {
// This early return fixes the jumping
Expand Down Expand Up @@ -106,15 +115,6 @@ export default {
this.observer.observe(elements[i]);
}
},
},
mounted() {
if (process.isClient) {
if (window.location.hash) {
this.activeAnchor = window.location.hash;
}
this.$nextTick(this.initObserver);
}
}
};
</script>
8 changes: 4 additions & 4 deletions docs/src/components/Search.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<template>
<div
class="relative"
@keydown.down="increment"
@keydown.up="decrement"
@keydown.enter="go"
class="relative"
>
<label class="relative block">
<span class="sr-only">Search Documentation</span>
Expand Down Expand Up @@ -34,15 +34,15 @@
</li>

<li
v-else
v-for="(result, index) in results"
v-else
:key="result.path + result.anchor"
@mouseenter="focusIndex = index"
@mousedown="go"
class="border-ui-sidebar"
:class="{
'border-b': index + 1 !== results.length
}"
@mouseenter="focusIndex = index"
@mousedown="go"
>
<g-link
:to="result.path + result.anchor"
Expand Down
2 changes: 1 addition & 1 deletion docs/src/components/Sidebar.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div
ref="sidebar"
v-if="showSidebar"
ref="sidebar"
class="px-4 pt-8 lg:pt-12"
>
<div
Expand Down
26 changes: 13 additions & 13 deletions docs/src/components/ToggleDarkMode.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<button @click="handleClick" aria-label="Toggle Darkmode" title="Toggle Darkmode">
<button aria-label="Toggle Darkmode" title="Toggle Darkmode" @click="handleClick">
<slot :dark="isDarkMode" />
</button>
</template>
Expand All @@ -14,6 +14,18 @@ export default {
}
},
mounted() {
if (this.hasInStorage()) {
this.toggleDarkMode(
this.getFromStorage()
);
} else if (process.isClient && window.matchMedia) {
this.toggleDarkMode(
this.detectPrefered()
);
}
},
methods: {
handleClick() {
const hasDarkMode = document.documentElement.hasAttribute(LIGHTS_OUT);
Expand Down Expand Up @@ -49,18 +61,6 @@ export default {
getFromStorage() {
return localStorage.getItem(LIGHTS_OUT) === 'true' ? true : false;
}
},
mounted() {
if (this.hasInStorage()) {
this.toggleDarkMode(
this.getFromStorage()
);
} else if (process.isClient && window.matchMedia) {
this.toggleDarkMode(
this.detectPrefered()
);
}
}
};
</script>
Expand Down
24 changes: 12 additions & 12 deletions docs/src/layouts/Default.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,6 @@ export default {
sidebarOpen: false,
}
},
watch: {
sidebarOpen: function (isOpen) {
document.body.classList.toggle('overflow-hidden', isOpen)
},
},
methods: {
setHeaderHeight() {
this.$nextTick(() => {
this.headerHeight = this.$refs.header.offsetHeight
})
},
},
computed: {
sidebarStyle() {
return {
Expand All @@ -88,9 +76,21 @@ export default {
return this.$page && this.headerHeight > 0
},
},
watch: {
sidebarOpen: function (isOpen) {
document.body.classList.toggle('overflow-hidden', isOpen)
},
},
mounted() {
this.setHeaderHeight()
},
methods: {
setHeaderHeight() {
this.$nextTick(() => {
this.headerHeight = this.$refs.header.offsetHeight
})
},
},
metaInfo() {
return {
meta: [
Expand Down
Loading

0 comments on commit 0e0cb80

Please sign in to comment.