aboutsummaryrefslogtreecommitdiff
path: root/node_modules/vuepress/lib/default-theme/SWUpdatePopup.vue
diff options
context:
space:
mode:
authorruki <waruqi@gmail.com>2018-11-08 00:43:05 +0800
committerruki <waruqi@gmail.com>2018-11-07 22:18:30 +0800
commit89e95b3f143682ed9a006991bacf45c9dcba4818 (patch)
tree4f44cf41b828577d583890bdd5a1c31e8491a6ba /node_modules/vuepress/lib/default-theme/SWUpdatePopup.vue
parentaa7f0199255277949790b41c56e8ec97dd4f0da4 (diff)
downloadxmake-docs-vuepress.tar.gz
xmake-docs-vuepress.zip
remove node_modulesvuepress
Diffstat (limited to 'node_modules/vuepress/lib/default-theme/SWUpdatePopup.vue')
-rw-r--r--node_modules/vuepress/lib/default-theme/SWUpdatePopup.vue85
1 files changed, 0 insertions, 85 deletions
diff --git a/node_modules/vuepress/lib/default-theme/SWUpdatePopup.vue b/node_modules/vuepress/lib/default-theme/SWUpdatePopup.vue
deleted file mode 100644
index b224db31..00000000
--- a/node_modules/vuepress/lib/default-theme/SWUpdatePopup.vue
+++ /dev/null
@@ -1,85 +0,0 @@
-<template>
- <transition name="sw-update-popup">
- <div
- v-if="enabled"
- class="sw-update-popup"
- >
- {{message}}<br>
- <button @click="reload">{{buttonText}}</button>
- </div>
- </transition>
-</template>
-
-<script>
-export default {
- props: {
- updateEvent: {
- type: Object,
- default: null
- }
- },
-
- computed: {
- popupConfig () {
- for (const config of [this.$themeLocaleConfig, this.$site.themeConfig]) {
- const sw = config.serviceWorker
- if (sw && sw.updatePopup) {
- return typeof sw.updatePopup === 'object' ? sw.updatePopup : {}
- }
- }
- return null
- },
-
- enabled () {
- return Boolean(this.popupConfig && this.updateEvent)
- },
-
- message () {
- const c = this.popupConfig
- return (c && c.message) || 'New content is available.'
- },
-
- buttonText () {
- const c = this.popupConfig
- return (c && c.buttonText) || 'Refresh'
- }
- },
-
- methods: {
- reload () {
- if (this.updateEvent) {
- this.updateEvent.skipWaiting().then(() => {
- location.reload(true)
- })
- this.updateEvent = null
- }
- }
- }
-}
-</script>
-
-<style lang="stylus">
-@import './styles/config.styl'
-
-.sw-update-popup
- position fixed
- right 1em
- bottom 1em
- padding 1em
- border 1px solid $accentColor
- border-radius 3px
- background #fff
- box-shadow 0 4px 16px rgba(0, 0, 0, 0.5)
- text-align center
-
- button
- margin-top 0.5em
- padding 0.25em 2em
-
-.sw-update-popup-enter-active, .sw-update-popup-leave-active
- transition opacity 0.3s, transform 0.3s
-
-.sw-update-popup-enter, .sw-update-popup-leave-to
- opacity 0
- transform translate(0, 50%) scale(0.5)
-</style>