vuepress-theme-uniapp-official 1.4.16 → 1.4.18

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
@@ -1,8 +1,8 @@
1
1
  ### uni-app official website theme for vuepress
2
2
 
3
- # vuepress-theme-uni-app-test
3
+ # vuepress-theme-uniapp-official
4
4
 
5
- [![NPM version](https://badgen.net/npm/v/vuepress-theme-uni-app-test)](https://www.npmjs.com/package/vuepress-theme-uni-app-test) [![NPM downloads](https://badgen.net/npm/dm/vuepress-theme-uni-app-test)](https://npmjs.com/package/vuepress-theme-uni-app-test)
5
+ [![NPM version](https://badgen.net/npm/v/vuepress-theme-uniapp-official)](https://www.npmjs.com/package/vuepress-theme-uniapp-official) [![NPM downloads](https://badgen.net/npm/dm/vuepress-theme-uniapp-official)](https://npmjs.com/package/vuepress-theme-uniapp-official)
6
6
 
7
7
  ## Sites
8
8
 
@@ -12,8 +12,8 @@
12
12
  ## Install
13
13
 
14
14
  ```bash
15
- yarn add vuepress-theme-uni-app-test -D
16
- # OR npm install vuepress-theme-uni-app-test -D
15
+ yarn add vuepress-theme-uniapp-official -D
16
+ # OR npm install vuepress-theme-uniapp-official -D
17
17
  ```
18
18
 
19
19
 
@@ -1,5 +1,4 @@
1
1
  <script setup>
2
- import { ref, defineProps } from 'vue'
3
2
  import Popover from './Popover.vue'
4
3
 
5
4
  const props = defineProps({
@@ -15,10 +14,58 @@ const resolveTableCelContent = (content) => {
15
14
  }
16
15
  return content
17
16
  }
17
+
18
+ const SUPPORTED = 'SUPPORTED'
19
+ const NOT_SUPPORTED = 'NOT_SUPPORTED'
20
+ const PARTIALLY_SUPPORTED = 'PARTIALLY_SUPPORTED'
21
+
22
+ let status = PARTIALLY_SUPPORTED
23
+
24
+ // 不会同时出现都是 - 的情况
25
+ if (typeof TABLE_OPTIONS.rows === 'object') {
26
+ let hasDefaultTag = false
27
+ let hasNotSupportedTag = false
28
+ let hasSupportedTag = false
29
+ TABLE_OPTIONS.rows[0].forEach(cel => {
30
+ if (cel === '-') {
31
+ hasDefaultTag = true
32
+ } else if (cel === 'x') {
33
+ hasNotSupportedTag = true
34
+ } else {
35
+ hasSupportedTag = true
36
+ }
37
+ })
38
+
39
+ if (!hasDefaultTag && !hasNotSupportedTag && hasSupportedTag) {
40
+ status = SUPPORTED
41
+ } else if (!hasDefaultTag && hasNotSupportedTag && !hasSupportedTag) {
42
+ status = NOT_SUPPORTED
43
+ } else {
44
+ status = PARTIALLY_SUPPORTED
45
+ }
46
+ }
18
47
  </script>
19
48
 
20
49
  <template>
21
50
  <Popover>
51
+ <template #icon>
52
+ <svg v-if="status === SUPPORTED" t="1716284589535" class="icon" viewBox="0 0 1024 1024" version="1.1"
53
+ xmlns="http://www.w3.org/2000/svg" p-id="6703"fill="#0B6316">
54
+ <path d="M384 691.2L204.8 512l-59.744 59.744L384 810.656l512-512-59.744-59.712L384 691.2z" p-id="6704"></path>
55
+ </svg>
56
+ <svg v-if="status === PARTIALLY_SUPPORTED" t="1716284768743" class="icon" viewBox="0 0 1024 1024" version="1.1"
57
+ xmlns="http://www.w3.org/2000/svg" p-id="7063"fill="#4D5702">
58
+ <path
59
+ d="M941.82716 685.195062L733.234568 476.602469l111.249383-111.249383 3.792592-3.792592 93.550617-93.550617c15.17037-15.17037 15.17037-41.718519 0-56.888889l-1.264197-1.264198c-15.17037-15.17037-41.718519-15.17037-56.888889 0L675.081481 418.449383 466.488889 209.85679c-15.17037-15.17037-41.718519-15.17037-56.888889 0l-1.264198 1.264198c-7.585185 7.585185-11.377778 17.698765-12.641975 27.812345s3.792593 20.22716 11.377778 29.076544l208.592593 208.592592-207.328396 208.592593c-1.264198 1.264198-3.792593 3.792593-5.05679 6.320987L366.617284 728.177778 140.325926 499.358025c-16.434568-16.434568-41.718519-16.434568-58.153086 0-16.434568 16.434568-16.434568 41.718519 0 58.153086l255.367901 255.367901c7.585185 7.585185 18.962963 11.377778 29.076543 11.377778 10.11358 0 21.491358-3.792593 29.076543-11.377778l278.123457-278.123456 208.592593 208.592592c15.17037 15.17037 41.718519 15.17037 56.888888 0l1.264198-1.264197c16.434568-16.434568 16.434568-41.718519 1.264197-56.888889z"
60
+ p-id="7064"></path>
61
+ </svg>
62
+ <svg v-if="status === NOT_SUPPORTED" t="1716284801363" class="icon" viewBox="0 0 1024 1024" version="1.1"
63
+ xmlns="http://www.w3.org/2000/svg" p-id="7267"fill="#86261A">
64
+ <path
65
+ d="M810.688 273.472l-60.16-60.16L512 451.84 273.472 213.312l-60.16 60.16L451.84 512l-238.528 238.464 60.16 60.16L512 572.16l238.528 238.464 60.16-60.16L572.16 512l238.528-238.528z"
66
+ p-id="7268"></path>
67
+ </svg>
68
+ </template>
22
69
  <table>
23
70
  <thead>
24
71
  <tr>
@@ -1,5 +1,5 @@
1
1
  <script setup>
2
- import { ref } from 'vue'
2
+ import { ref, useSlots } from 'vue'
3
3
  import { getNavbarHeight } from '../helper'
4
4
 
5
5
  const props = defineProps({
@@ -7,6 +7,7 @@ const props = defineProps({
7
7
  })
8
8
 
9
9
  const infoHover = ref(false)
10
+ const slots = useSlots()
10
11
  let iconMouseOptions = {}
11
12
 
12
13
  const iconMouseEnter = (e) => {
@@ -78,17 +79,18 @@ const vPopover = {
78
79
 
79
80
  <template>
80
81
  <div class="popover-container">
81
- <i class="info" :class="{ 'info-hover': infoHover }" @mouseenter="iconMouseEnter" @mouseleave="iconMouseLeave">
82
- <svg t="1715917545486" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"
83
- p-id="10306">
82
+ <span class="info" :class="{ 'info-hover': infoHover }" @mouseenter="iconMouseEnter" @mouseleave="iconMouseLeave">
83
+ <slot name="icon"></slot>
84
+ <svg v-if="!slots.icon" t="1715917545486" class="icon" viewBox="0 0 1024 1024" version="1.1"
85
+ xmlns="http://www.w3.org/2000/svg" p-id="10306" fill="#2c3e50">
84
86
  <path
85
87
  d="M512 958.016C266.08 958.016 65.984 757.952 65.984 512 65.984 266.08 266.08 65.984 512 65.984c245.952 0 446.016 200.064 446.016 446.016 0 245.952-200.064 446.016-446.016 446.016z m0-828.032c-210.656 0-382.016 171.36-382.016 382.016 0 210.624 171.36 382.016 382.016 382.016 210.624 0 382.016-171.36 382.016-382.016S722.624 129.984 512 129.984z"
86
- p-id="10307" fill="#2c3e50"></path>
88
+ p-id="10307"></path>
87
89
  <path
88
90
  d="M464 304a1.5 1.5 0 1 0 96 0 1.5 1.5 0 1 0-96 0zM512 768c-17.664 0-32-14.304-32-32V448c0-17.664 14.336-32 32-32s32 14.336 32 32v288c0 17.696-14.336 32-32 32z"
89
- p-id="10308" fill="#2c3e50"></path>
91
+ p-id="10308"></path>
90
92
  </svg>
91
- </i>
93
+ </span>
92
94
  <transition name="fade-in">
93
95
  <div class="popover-content-container" v-show="infoHover" v-popover>
94
96
  <slot></slot>
@@ -0,0 +1,15 @@
1
+ export function once(fn, ctx = null) {
2
+ let res
3
+ return (...args) => {
4
+ if (fn) {
5
+ res = fn.apply(ctx, args)
6
+ fn = null
7
+ }
8
+ return res
9
+ }
10
+ }
11
+
12
+ export const getNavbarHeight = () => {
13
+ const { height, top } = document.querySelector('.navbar').getBoundingClientRect()
14
+ return height + top
15
+ }
package/index.js CHANGED
@@ -130,7 +130,7 @@ module.exports = (themeConfig, ctx, pluginAPI) => {
130
130
  */
131
131
  const hashNotFound = errMsg === 'Hash is not found' && matchUrl.startsWith('#')
132
132
  const replaceHtmlExtToMd = errMsg === "Should use .md instead of .html"
133
- const fileNotFound = errMsg === "File is not found"
133
+ const fileNotFound = errMsg === "File is not found" && !matchUrl.startsWith('<!--')
134
134
  const hashShouldSlugify = errMsg === "Hash should slugify"
135
135
  return hashNotFound || replaceHtmlExtToMd || fileNotFound || hashShouldSlugify
136
136
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vuepress-theme-uniapp-official",
3
- "version": "1.4.16",
3
+ "version": "1.4.18",
4
4
  "description": "uni-app official website theme for vuepress",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -24,6 +24,7 @@
24
24
  "mixin",
25
25
  "styles",
26
26
  "util",
27
+ "helper",
27
28
  "enhanceApp.js",
28
29
  "index.js"
29
30
  ],
@@ -31,7 +32,7 @@
31
32
  "publish:patch": "npm version patch && npm publish",
32
33
  "publish:minor": "npm version minor && npm publish",
33
34
  "publish:major": "npm version major && npm publish",
34
- "postpublish": "cnpm sync vuepress-theme-uni-app"
35
+ "postpublish": "cnpm sync vuepress-theme-uniapp-official"
35
36
  },
36
37
  "dependencies": {
37
38
  "@docsearch/css": "^3.6.0",