@sugarat/theme 0.2.9 → 0.2.10

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.
package/README.md CHANGED
@@ -18,7 +18,7 @@ npm create @sugarat/theme@latest
18
18
  yarn create @sugarat/theme
19
19
 
20
20
  # With Bun
21
- bunx @sugarat/create-theme --bun
21
+ bun create @sugarat/theme
22
22
  ```
23
23
 
24
24
  ![](https://img.cdn.sugarat.top/mdImg/MTY4OTQyMDE1NTcxMA==689420155710)
package/node.js CHANGED
@@ -36,7 +36,7 @@ __export(node_exports, {
36
36
  });
37
37
  module.exports = __toCommonJS(node_exports);
38
38
 
39
- // ../../node_modules/.pnpm/vitepress-plugin-tabs@0.2.0_vitepress@1.0.0-rc.31_vue@3.3.4/node_modules/vitepress-plugin-tabs/dist/index.js
39
+ // ../../node_modules/.pnpm/vitepress-plugin-tabs@0.2.0_vitepress@1.0.0-rc.32_vue@3.3.4/node_modules/vitepress-plugin-tabs/dist/index.js
40
40
  var tabsMarker = "=tabs";
41
41
  var tabsMarkerLen = tabsMarker.length;
42
42
  var ruleBlockTabs = (state, startLine, endLine, silent) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sugarat/theme",
3
- "version": "0.2.9",
3
+ "version": "0.2.10",
4
4
  "description": "简约风的 Vitepress 博客主题,sugarat vitepress blog theme",
5
5
  "author": "sugar",
6
6
  "license": "MIT",
@@ -54,7 +54,7 @@
54
54
  "pagefind": "1.0.3",
55
55
  "sass": "^1.56.1",
56
56
  "typescript": "^4.8.2",
57
- "vitepress": "1.0.0-rc.31",
57
+ "vitepress": "1.0.0-rc.32",
58
58
  "vue": "^3.3.4"
59
59
  },
60
60
  "scripts": {
@@ -5,9 +5,9 @@ import { useBlogConfig } from '../composables/config/blog'
5
5
 
6
6
  const { alert: alertProps } = useBlogConfig()
7
7
  const show = ref(false)
8
-
8
+ const storageKey = 'theme-blog-alert'
9
+ const closeFlag = `${storageKey}-close`
9
10
  onMounted(() => {
10
- const storageKey = 'theme-blog-alert'
11
11
  // 取旧值
12
12
  const oldValue = localStorage.getItem(storageKey)
13
13
  const newValue = JSON.stringify(alertProps)
@@ -21,13 +21,28 @@ onMounted(() => {
21
21
  show.value = false
22
22
  }, alertProps?.duration)
23
23
  }
24
+ return
24
25
  }
25
26
 
26
27
  if (oldValue !== newValue && alertProps?.duration === -1) {
27
28
  // 当做新值处理
28
29
  show.value = true
30
+ localStorage.removeItem(closeFlag)
31
+ return
32
+ }
33
+
34
+ // 新旧相等,判断是否点击过close,没点击关闭依然展示
35
+ if (oldValue === newValue && alertProps?.duration === -1 && !localStorage.getItem(closeFlag)) {
36
+ show.value = true
29
37
  }
30
38
  })
39
+
40
+ function handleClose() {
41
+ show.value = false
42
+ if (alertProps?.duration === -1) {
43
+ localStorage.setItem(closeFlag, `${+new Date()}`)
44
+ }
45
+ }
31
46
  </script>
32
47
 
33
48
  <template>
@@ -40,6 +55,7 @@ onMounted(() => {
40
55
  :closable="alertProps?.closable"
41
56
  :close-text="alertProps?.closeText"
42
57
  :description="alertProps?.description"
58
+ @close="handleClose"
43
59
  >
44
60
  <div v-if="alertProps?.html" v-html="alertProps?.html" />
45
61
  </ElAlert>
@@ -17,13 +17,14 @@ const bodyContent = computed(() => {
17
17
  const footerContent = computed(() => {
18
18
  return popoverProps?.footer || []
19
19
  })
20
+ const storageKey = 'theme-blog-popover'
21
+ const closeFlag = `${storageKey}-close`
20
22
 
21
23
  onMounted(() => {
22
24
  if (!popoverProps?.title) {
23
25
  return
24
26
  }
25
27
 
26
- const storageKey = 'theme-blog-popover'
27
28
  // 取旧值
28
29
  const oldValue = localStorage.getItem(storageKey)
29
30
  const newValue = JSON.stringify(popoverProps)
@@ -37,14 +38,29 @@ onMounted(() => {
37
38
  show.value = false
38
39
  }, popoverProps?.duration)
39
40
  }
41
+ return
40
42
  }
41
43
 
42
44
  if (oldValue !== newValue && popoverProps?.duration === -1) {
43
45
  // 当做新值处理
44
46
  show.value = true
47
+ localStorage.removeItem(closeFlag)
48
+ return
49
+ }
50
+
51
+ // 新旧相等,判断是否点击过close,没点击关闭依然展示
52
+ if (oldValue === newValue && popoverProps?.duration === -1 && !localStorage.getItem(closeFlag)) {
53
+ show.value = true
45
54
  }
46
55
  })
47
56
 
57
+ function handleClose() {
58
+ show.value = false
59
+ if (popoverProps?.duration === -1) {
60
+ localStorage.setItem(closeFlag, `${+new Date()}`)
61
+ }
62
+ }
63
+
48
64
  function PopoverValue(props: { key: number; item: BlogPopover.Value },
49
65
  { slots }: any) {
50
66
  const { key, item } = props
@@ -105,7 +121,7 @@ function PopoverValue(props: { key: number; item: BlogPopover.Value },
105
121
  </ElIcon>
106
122
  <span class="title">{{ popoverProps?.title }}</span>
107
123
  </div>
108
- <ElIcon class="close-icon" size="20px" @click="show = false">
124
+ <ElIcon class="close-icon" size="20px" @click="handleClose">
109
125
  <CircleCloseFilled />
110
126
  </ElIcon>
111
127
  </div>