vuepress-theme-uniapp-official 1.4.11

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.
Files changed (63) hide show
  1. package/README.md +22 -0
  2. package/components/AlgoliaSearchBox.vue +130 -0
  3. package/components/DcloudSearchPage/components/Result.vue +160 -0
  4. package/components/DcloudSearchPage/components/Results.vue +66 -0
  5. package/components/DcloudSearchPage/components/pagination.vue +155 -0
  6. package/components/DcloudSearchPage/index.styl +183 -0
  7. package/components/DcloudSearchPage/index.vue +500 -0
  8. package/components/DcloudSearchPage/styles/ask.styl +272 -0
  9. package/components/DcloudSearchPage/styles/ext.styl +68 -0
  10. package/components/DcloudSearchPage/utils/Base64.js +134 -0
  11. package/components/DcloudSearchPage/utils/mock.js +434 -0
  12. package/components/DcloudSearchPage/utils/postDcloudServer.js +141 -0
  13. package/components/DcloudSearchPage/utils/searchClient.js +101 -0
  14. package/components/DcloudSearchPage/utils/searchUtils.js +52 -0
  15. package/components/Footer.vue +142 -0
  16. package/components/MainNavbarLink.vue +57 -0
  17. package/components/NavLink.vue +95 -0
  18. package/components/NavLinks.vue +173 -0
  19. package/components/Navbar.vue +322 -0
  20. package/components/NavbarLogo.vue +24 -0
  21. package/components/OutboundLink.vue +45 -0
  22. package/components/SearchBox/dist/match-query.dev.js +61 -0
  23. package/components/SearchBox/index.vue +337 -0
  24. package/components/SearchBox/match-query.js +51 -0
  25. package/components/SearchBox/search.svg +1 -0
  26. package/components/SidebarGroup.vue +141 -0
  27. package/components/SidebarLink.vue +152 -0
  28. package/components/SidebarLinks.vue +106 -0
  29. package/components/SiderBarBottom.vue +134 -0
  30. package/components/Sticker.vue +64 -0
  31. package/components/Toc-top.vue +95 -0
  32. package/components/Toc.vue +165 -0
  33. package/config/copy.js +7 -0
  34. package/config/footer.js +195 -0
  35. package/config/i18n/index.js +2 -0
  36. package/config/navbar.js +163 -0
  37. package/config/redirectRouter.js +120 -0
  38. package/config/searchPage.js +48 -0
  39. package/config/siderbar/index.js +8 -0
  40. package/config/siderbar/uni-app.js +210 -0
  41. package/config/siderbar/uniCloud.js +55 -0
  42. package/config/toc.js +5 -0
  43. package/enhanceApp.js +142 -0
  44. package/global-components/CodeSimulator.vue +211 -0
  45. package/global-components/icons.js +647 -0
  46. package/global-components/iconsLayouts.vue +117 -0
  47. package/global-components/uniIcon.vue +85 -0
  48. package/global-components/uniicons.css +656 -0
  49. package/global-components/uniicons.ttf +0 -0
  50. package/index.js +152 -0
  51. package/layouts/404.vue +22 -0
  52. package/layouts/Layout.vue +238 -0
  53. package/layouts/SimpleLayout.vue +18 -0
  54. package/mixin/navInject.js +21 -0
  55. package/mixin/navProvider.js +65 -0
  56. package/mixin/toc.js +36 -0
  57. package/package.json +50 -0
  58. package/styles/custom-block.styl +336 -0
  59. package/styles/footer.styl +248 -0
  60. package/styles/index.styl +197 -0
  61. package/styles/navbar.styl +293 -0
  62. package/styles/palette.styl +9 -0
  63. package/util/index.js +317 -0
@@ -0,0 +1,52 @@
1
+ export function groupBy(values, predicate) {
2
+ return values.reduce((acc, item) => {
3
+ const key = predicate(item);
4
+
5
+ if (!acc.hasOwnProperty(key)) {
6
+ acc[key] = [];
7
+ }
8
+
9
+ // We limit each section to show 5 hits maximum.
10
+ // This acts as a frontend alternative to `distinct`.
11
+ if (acc[key].length < 5) {
12
+ acc[key].push(item);
13
+ }
14
+ return acc;
15
+ }, {});
16
+ }
17
+
18
+
19
+ const regexHighlightTags = /(<mark>|<\/mark>)/g;
20
+ const regexHasHighlightTags = RegExp(regexHighlightTags.source);
21
+
22
+ export function removeHighlightTags(hit) {
23
+ const internalDocSearchHit = hit
24
+
25
+ if (!internalDocSearchHit.__docsearch_parent && !hit._highlightResult) {
26
+ return hit.hierarchy.lvl0;
27
+ }
28
+
29
+ const { value } =
30
+ (internalDocSearchHit.__docsearch_parent
31
+ ? ((internalDocSearchHit.__docsearch_parent._highlightResult || {}).hierarchy || {}).lvl0
32
+ :((hit._highlightResult || {}).hierarchy || {}).lvl0) || {};
33
+
34
+ let removeHighLightValue = value && regexHasHighlightTags.test(value)
35
+ ? value.replace(regexHighlightTags, '')
36
+ : value;
37
+ // if (internalDocSearchHit.tag) removeHighLightValue = `${removeHighLightValue} ${internalDocSearchHit.tag}`
38
+ return removeHighLightValue
39
+ // return internalDocSearchHit.tag ? internalDocSearchHit.tag : removeHighLightValue
40
+ }
41
+
42
+ export function isEditingContent(event) {
43
+ const element = event.target;
44
+ const tagName = element.tagName;
45
+
46
+ return (
47
+ element.isContentEditable ||
48
+ tagName === 'INPUT' ||
49
+ tagName === 'SELECT' ||
50
+ tagName === 'TEXTAREA'
51
+ );
52
+ }
@@ -0,0 +1,142 @@
1
+ <template>
2
+ <div ref="container" id="footNavBox">
3
+ <div class="footNav">
4
+ <div id="footNavClassify">
5
+ <footNavItem :list="footNavList" />
6
+ </div>
7
+ <div id="aboutusBox">
8
+ <footNavItem :list="aboutusList" />
9
+ </div>
10
+ </div>
11
+ <div class="hbLogo"></div>
12
+ <div class="introduce">
13
+ <template v-for="col in about">
14
+ <div class="introduce-item" :key="col.title">
15
+ <span class="introduce-title">{{ col.title }}:</span>
16
+ <template v-for="(item, index) in col.content">
17
+ <a class="navItemDetail" :key="item.url" :href="item.url" target="_blank">
18
+ {{ item.subTitle }}
19
+ </a>
20
+ </template>
21
+ </div>
22
+ </template>
23
+ </div>
24
+ <div v-if="$lang === LOCALE_ZH_HANS">
25
+ <div class="companyBox">
26
+
27
+ <span class="companyInfo"><span class="companyInfo-dcloud">DCloud.io</span>&nbsp;数字天堂(北京)网络技术有限公司是</span>
28
+ <div style="display: inline; margin-left: 5px" class="companyInfo">
29
+ <!-- <a href="//www.w3.org/" target="_blank" class="w3c">W3C</a>
30
+ 成员及 -->
31
+ <a href="//www.html5plus.org/" target="_blank" class="html5">HTML5中国产业联盟</a>
32
+ 发起单位
33
+ </div>
34
+ </div>
35
+ <div class="beianBox">
36
+ <a
37
+ id="domain"
38
+ class="beian"
39
+ href="https://beian.miit.gov.cn/#/Integrated/index"
40
+ target="_blank"
41
+ >
42
+ {{ domain }}
43
+ </a>
44
+ <div class="domainImgBox">
45
+ <img class="domainImg" :src="domainImg" />
46
+ <a class="beian" :href="beian" target="_blank">京公网安备:11010802035340号&nbsp;</a>
47
+ </div>
48
+
49
+ <span class="anbaoInfo">&nbsp;&nbsp;国家信息安全等级保护三级,证书编号:11010813802-20001</span>
50
+ </div>
51
+ </div>
52
+ </div>
53
+ </template>
54
+
55
+ <script>
56
+ import footerConfig from '@theme-config/footer';
57
+ import { LOCALE_ZH_HANS } from '@theme-config/i18n';
58
+ const { footNavList, aboutusList, aboutus, concatus, domainImg, beian } = footerConfig;
59
+
60
+ export default {
61
+ components: {
62
+ footNavItem: {
63
+ functional: true,
64
+ props: {
65
+ list: {
66
+ type: Array,
67
+ default: () => [],
68
+ },
69
+ },
70
+ render: (h, { props }) => {
71
+ return props.list.map((footNavListItem, _index) =>
72
+ h('div', { staticClass: 'footNavItem', key: footNavListItem.title || _index }, [
73
+ h('div', { staticClass: 'navItemTitle' }, footNavListItem.title),
74
+ h('div', { staticClass: 'navLine' }),
75
+ h(
76
+ 'div',
77
+ { staticClass: 'navItemDetailBox' },
78
+ footNavListItem.content.map((item, index) =>
79
+ h(
80
+ 'a',
81
+ {
82
+ staticClass: 'navItemDetail',
83
+ key: item.url || index,
84
+ attrs: {
85
+ target: '_blank',
86
+ href: item.url,
87
+ },
88
+ },
89
+ item.subTitle
90
+ )
91
+ )
92
+ ),
93
+ ])
94
+ );
95
+ },
96
+ },
97
+ },
98
+ data: () => ({
99
+ footNavList: Object.freeze(footNavList),
100
+ aboutusList: Object.freeze(aboutusList),
101
+ about: Object.freeze([aboutus, concatus]),
102
+ domain: '',
103
+ domainImg,
104
+ beian,
105
+ LOCALE_ZH_HANS,
106
+ }),
107
+ mounted() {
108
+ if (location.hostname === 'uniapp.dcloud.io') {
109
+ this.domain = '蒙ICP备14002744号-1';
110
+ } else {
111
+ this.domain = '京ICP备12046007号-4';
112
+ }
113
+ this.fixBottom();
114
+ },
115
+ methods: {
116
+ fixBottom() {
117
+ this.$nextTick(() => {
118
+ this.$refs.container.style.bottom = `0px`;
119
+ const bottom =
120
+ document.documentElement.clientHeight -
121
+ this.$refs.container.getBoundingClientRect().bottom;
122
+ if (bottom > 0) {
123
+ // const preBottom = parseFloat(this.$refs.container.style.bottom);
124
+ this.$refs.container.style.position = 'relative';
125
+ this.$refs.container.style.bottom = `-${bottom}px`;
126
+ } else {
127
+ this.$refs.container.removeAttribute('style');
128
+ }
129
+ });
130
+ },
131
+ },
132
+ watch: {
133
+ $route() {
134
+ this.fixBottom();
135
+ },
136
+ },
137
+ };
138
+ </script>
139
+
140
+ <style lang="stylus" scoped>
141
+ @import '../styles/footer.styl'
142
+ </style>
@@ -0,0 +1,57 @@
1
+ <template>
2
+ <div
3
+ v-if="show"
4
+ class="main-navbar-link"
5
+ >
6
+ <DropdownLink
7
+ v-if="item.type === 'links'"
8
+ :item="item"
9
+ />
10
+ <NavLink
11
+ v-else
12
+ :item="item"
13
+ />
14
+ </div>
15
+ </template>
16
+
17
+ <script>
18
+ import DropdownLink from '@theme/components/DropdownLink.vue'
19
+ import NavLink from '@theme/components/NavLink.vue'
20
+
21
+ export default {
22
+ name: 'MainNavbarLink',
23
+
24
+ components: {
25
+ DropdownLink,
26
+ NavLink
27
+ },
28
+
29
+ props: {
30
+ item: {
31
+ type: Object,
32
+ default: () => ({})
33
+ }
34
+ },
35
+
36
+ computed: {
37
+ show() {
38
+ return this.item.type === 'link'
39
+ ? this.item.link
40
+ : this.item.type === 'links'
41
+ ? !!this.item.items.length
42
+ : false
43
+ }
44
+ }
45
+ }
46
+ </script>
47
+
48
+ <style lang="stylus" scope>
49
+ .main-navbar-link a
50
+ color inherit
51
+
52
+ @media (max-width: $MQMobile)
53
+ ul
54
+ list-style none
55
+ a
56
+ padding-top 0 !important
57
+ </style>
@@ -0,0 +1,95 @@
1
+ <template>
2
+ <RouterLink
3
+ v-if="isInternal"
4
+ class="nav-link"
5
+ :to="link"
6
+ :exact="exact"
7
+ @focusout.native="focusoutAction"
8
+ >
9
+ {{ item.text }}
10
+ </RouterLink>
11
+ <a
12
+ v-else
13
+ :href="link"
14
+ class="nav-link external"
15
+ :target="target"
16
+ :rel="rel"
17
+ @focusout="focusoutAction"
18
+ >
19
+ {{ item.text }}
20
+ <OutboundLink v-if="item.needOutbound !== false && isBlankTarget" :link="item.text === link ? '' : link" />
21
+ </a>
22
+ </template>
23
+
24
+ <script>
25
+ import { isExternal, isMailto, isTel, ensureExt } from '../util'
26
+ import OutboundLink from '@theme/components/OutboundLink.vue';
27
+
28
+ export default {
29
+ name: 'NavLink',
30
+
31
+ components: { OutboundLink },
32
+
33
+ inject: [ 'customNavBar' ],
34
+
35
+ props: {
36
+ item: {
37
+ required: true
38
+ }
39
+ },
40
+
41
+ computed: {
42
+ link () {
43
+ return ensureExt(this.item.link)
44
+ },
45
+
46
+ exact () {
47
+ if (this.$site.locales) {
48
+ return Object.keys(this.$site.locales).some(rootLink => rootLink === this.link)
49
+ }
50
+ return this.link === '/'
51
+ },
52
+
53
+ isNonHttpURI () {
54
+ return isMailto(this.link) || isTel(this.link)
55
+ },
56
+
57
+ isBlankTarget () {
58
+ return this.target === '_blank'
59
+ },
60
+
61
+ isInternal () {
62
+ return !isExternal(this.link) && !this.isBlankTarget
63
+ },
64
+
65
+ target () {
66
+ if (this.isNonHttpURI) {
67
+ return null
68
+ }
69
+ if (this.item.target) {
70
+ return this.item.target
71
+ }
72
+ return isExternal(this.link) ? '_blank' : ''
73
+ },
74
+
75
+ rel () {
76
+ if (this.isNonHttpURI) {
77
+ return null
78
+ }
79
+ if (this.item.rel === false) {
80
+ return null
81
+ }
82
+ if (this.item.rel) {
83
+ return this.item.rel
84
+ }
85
+ return this.isBlankTarget ? 'noopener noreferrer' : null
86
+ }
87
+ },
88
+
89
+ methods: {
90
+ focusoutAction () {
91
+ this.$emit('focusout')
92
+ }
93
+ }
94
+ }
95
+ </script>
@@ -0,0 +1,173 @@
1
+ <template>
2
+ <nav
3
+ v-if="(userLinks.length || repoLink) && showSubNavBar"
4
+ class="nav-links"
5
+ >
6
+ <!-- user links -->
7
+ <div
8
+ v-for="item in userLinks"
9
+ :key="item.link"
10
+ class="nav-item"
11
+ >
12
+ <DropdownLink
13
+ v-if="item.type === 'links'"
14
+ :item="item"
15
+ />
16
+ <NavLink
17
+ v-else
18
+ :item="item"
19
+ />
20
+ </div>
21
+
22
+ <!-- repo link -->
23
+ <!-- <a
24
+ v-if="repoLink"
25
+ :href="repoLink"
26
+ class="repo-link"
27
+ target="_blank"
28
+ rel="noopener noreferrer"
29
+ >
30
+ {{ repoLabel }}
31
+ <OutboundLink />
32
+ </a> -->
33
+ </nav>
34
+ </template>
35
+
36
+ <script>
37
+ import DropdownLink from '@theme/components/DropdownLink.vue'
38
+ import { resolveNavLinkItem } from '../util'
39
+ import NavLink from '@theme/components/NavLink.vue'
40
+ import navInject from '../mixin/navInject';
41
+
42
+ export default {
43
+ name: 'NavLinks',
44
+
45
+ mixins: [ navInject ],
46
+
47
+ components: {
48
+ NavLink,
49
+ DropdownLink
50
+ },
51
+
52
+ computed: {
53
+ userNav () {
54
+ return this.customNavBar[this.navConfig.userNavIndex].items || []
55
+ // return this.$themeLocaleConfig.nav || this.$site.themeConfig.nav || []
56
+ },
57
+
58
+ nav () {
59
+ const { locales } = this.$site
60
+ if (locales && Object.keys(locales).length > 1) {
61
+ const currentLink = this.$page.path
62
+ const routes = this.$router.options.routes
63
+ const themeLocales = this.$site.themeConfig.locales || {}
64
+ const languageDropdown = {
65
+ text: this.$themeLocaleConfig.selectText || 'Languages',
66
+ ariaLabel: this.$themeLocaleConfig.ariaLabel || 'Select language',
67
+ items: Object.keys(locales).map(path => {
68
+ const locale = locales[path]
69
+ const text = themeLocales[path] && themeLocales[path].label || locale.lang
70
+ let link
71
+ // Stay on the current page
72
+ if (locale.lang === this.$lang) {
73
+ link = currentLink
74
+ } else {
75
+ // Try to stay on the same page
76
+ link = currentLink.replace(this.$localeConfig.path, path)
77
+ // fallback to homepage
78
+ if (!routes.some(route => route.path === link)) {
79
+ link = path
80
+ }
81
+ }
82
+ return { text, link }
83
+ })
84
+ }
85
+ return [...this.userNav, languageDropdown]
86
+ }
87
+ return this.userNav
88
+ },
89
+
90
+ userLinks () {
91
+ return (this.nav || []).map(link => {
92
+ return Object.assign(resolveNavLinkItem(link), {
93
+ items: (link.items || []).map(resolveNavLinkItem)
94
+ })
95
+ })
96
+ },
97
+
98
+ repoLink () {
99
+ const { repo } = this.$site.themeConfig
100
+ if (repo) {
101
+ return /^https?:/.test(repo)
102
+ ? repo
103
+ : `https://github.com/${repo}`
104
+ }
105
+ return null
106
+ },
107
+
108
+ repoLabel () {
109
+ if (!this.repoLink) return
110
+ if (this.$site.themeConfig.repoLabel) {
111
+ return this.$site.themeConfig.repoLabel
112
+ }
113
+
114
+ const repoHost = this.repoLink.match(/^https?:\/\/[^/]+/)[0]
115
+ const platforms = ['GitHub', 'GitLab', 'Bitbucket']
116
+ for (let i = 0; i < platforms.length; i++) {
117
+ const platform = platforms[i]
118
+ if (new RegExp(platform, 'i').test(repoHost)) {
119
+ return platform
120
+ }
121
+ }
122
+
123
+ return 'Source'
124
+ }
125
+ }
126
+ }
127
+ </script>
128
+
129
+ <style lang="stylus">
130
+ .nav-links
131
+ display inline-block
132
+ a
133
+ line-height 1.4rem
134
+ color inherit
135
+ &:hover, &.router-link-active
136
+ color $accentColor
137
+ .nav-item
138
+ position relative
139
+ display inline-block
140
+ margin-left 0.8rem
141
+ line-height 2rem
142
+ &:first-child
143
+ margin-left 0
144
+ .repo-link
145
+ margin-left 1.5rem
146
+
147
+ @media (max-width: $MQMobile)
148
+ .nav-links
149
+ .nav-item, .repo-link
150
+ margin-left 0
151
+
152
+ @media (min-width: $MQMobile)
153
+ .nav-item > .nav-link:not(.external)
154
+ display block
155
+ height 40px
156
+ line-height 40px
157
+ min-width 24px
158
+ padding 0 1.6vw
159
+ background-color #fff
160
+ border-radius 4px
161
+ transition background .3s
162
+ font-size 14px
163
+
164
+ /* .nav-links a
165
+ &:hover, &.router-link-active
166
+ color $textColor*/
167
+ .nav-item > a:not(.external)
168
+ &:hover
169
+ background-color #f0f0f0
170
+ &.router-link-active
171
+ color #fff
172
+ background-color $accentColor
173
+ </style>