@vuepress/theme-default 2.0.0-beta.9 → 2.0.0-rc.1

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 (118) hide show
  1. package/LICENSE +1 -1
  2. package/lib/client/components/AutoLink.vue +113 -0
  3. package/lib/client/components/DropdownTransition.vue +15 -24
  4. package/lib/client/components/Home.vue +12 -130
  5. package/lib/client/components/HomeContent.vue +5 -0
  6. package/lib/client/components/HomeFeatures.vue +22 -0
  7. package/lib/client/components/HomeFooter.vue +17 -0
  8. package/lib/client/components/HomeHero.vue +97 -0
  9. package/lib/client/components/Navbar.vue +60 -95
  10. package/lib/client/components/NavbarBrand.vue +55 -0
  11. package/lib/client/components/NavbarDropdown.vue +126 -0
  12. package/lib/client/components/{NavbarLinks.vue → NavbarItems.vue} +81 -61
  13. package/lib/client/components/Page.vue +16 -15
  14. package/lib/client/components/PageMeta.vue +51 -66
  15. package/lib/client/components/PageNav.vue +61 -64
  16. package/lib/client/components/Sidebar.vue +12 -32
  17. package/lib/client/components/SidebarItem.vue +87 -0
  18. package/lib/client/components/SidebarItems.vue +57 -0
  19. package/lib/client/components/ToggleColorModeButton.vue +57 -0
  20. package/lib/client/components/ToggleSidebarButton.vue +21 -24
  21. package/lib/client/components/global/Badge.vue +24 -26
  22. package/lib/client/components/global/CodeGroup.d.ts +5 -4
  23. package/lib/client/components/global/CodeGroup.js +85 -17
  24. package/lib/client/components/global/CodeGroupItem.vue +22 -20
  25. package/lib/client/components/global/index.d.ts +4 -0
  26. package/lib/client/components/global/index.js +4 -0
  27. package/lib/client/composables/index.d.ts +5 -5
  28. package/lib/client/composables/index.js +5 -5
  29. package/lib/client/composables/useDarkMode.d.ts +12 -0
  30. package/lib/client/composables/useDarkMode.js +57 -0
  31. package/lib/client/composables/useScrollPromise.js +1 -1
  32. package/lib/client/composables/useSidebarItems.d.ts +14 -8
  33. package/lib/client/composables/useSidebarItems.js +49 -48
  34. package/lib/client/composables/useThemeData.d.ts +2 -2
  35. package/lib/client/composables/useThemeData.js +1 -1
  36. package/lib/client/composables/useUpdateDeviceStatus.d.ts +7 -0
  37. package/lib/client/composables/useUpdateDeviceStatus.js +25 -0
  38. package/lib/client/config.d.ts +4 -0
  39. package/lib/client/config.js +44 -0
  40. package/lib/client/index.d.ts +3 -4
  41. package/lib/client/index.js +3 -2
  42. package/lib/client/layouts/Layout.vue +133 -136
  43. package/lib/client/layouts/NotFound.vue +27 -0
  44. package/lib/client/shim.d.ts +5 -0
  45. package/lib/client/styles/{_wrapper.scss → _mixins.scss} +7 -2
  46. package/lib/client/styles/_variables.module.scss +5 -0
  47. package/lib/client/styles/_variables.scss +0 -34
  48. package/lib/client/styles/arrow.scss +4 -6
  49. package/lib/client/styles/badge.scss +14 -11
  50. package/lib/client/styles/code-group.scss +10 -10
  51. package/lib/client/styles/code.scss +33 -46
  52. package/lib/client/styles/custom-container.scss +82 -18
  53. package/lib/client/styles/home.scss +32 -24
  54. package/lib/client/styles/index.scss +4 -4
  55. package/lib/client/styles/layout.scss +82 -73
  56. package/lib/client/styles/{dropdown.scss → navbar-dropdown.scss} +36 -50
  57. package/lib/client/styles/navbar.scss +106 -50
  58. package/lib/client/styles/normalize.scss +199 -0
  59. package/lib/client/styles/page.scss +24 -8
  60. package/lib/client/styles/sidebar.scss +69 -87
  61. package/lib/client/styles/transitions.scss +13 -4
  62. package/lib/client/styles/vars-dark.scss +68 -0
  63. package/lib/client/styles/vars.scss +155 -0
  64. package/lib/client/utils/getNavLink.d.ts +15 -0
  65. package/lib/client/utils/getNavLink.js +18 -0
  66. package/lib/client/utils/getResolveRouteWithRedirect.d.ts +5 -0
  67. package/lib/client/{composables/useResolveRouteWithRedirect.js → utils/getResolveRouteWithRedirect.js} +4 -6
  68. package/lib/client/utils/index.d.ts +5 -2
  69. package/lib/client/utils/index.js +5 -2
  70. package/lib/client/utils/isActiveSidebarItem.d.ts +3 -0
  71. package/lib/client/utils/isActiveSidebarItem.js +20 -0
  72. package/lib/client/utils/resolveEditLink.d.ts +2 -2
  73. package/lib/client/utils/resolveEditLink.js +15 -9
  74. package/lib/client/utils/resolveRepoType.d.ts +1 -1
  75. package/lib/client/utils/resolveRepoType.js +4 -2
  76. package/lib/node/defaultTheme.d.ts +4 -4
  77. package/lib/node/defaultTheme.js +111 -48
  78. package/lib/node/index.d.ts +4 -4
  79. package/lib/node/index.js +5 -17
  80. package/lib/node/utils/assignDefaultLocaleOptions.d.ts +4 -2
  81. package/lib/node/utils/assignDefaultLocaleOptions.js +13 -13
  82. package/lib/node/utils/index.d.ts +2 -5
  83. package/lib/node/utils/index.js +2 -17
  84. package/lib/node/utils/resolveContainerPluginOptions.d.ts +2 -20
  85. package/lib/node/utils/resolveContainerPluginOptions.js +4 -66
  86. package/lib/shared/index.d.ts +3 -3
  87. package/lib/shared/index.js +3 -15
  88. package/lib/shared/nav.d.ts +16 -18
  89. package/lib/shared/nav.js +1 -2
  90. package/lib/shared/options.d.ts +51 -6
  91. package/lib/shared/options.js +1 -2
  92. package/lib/shared/page.d.ts +15 -6
  93. package/lib/shared/page.js +1 -2
  94. package/package.json +43 -25
  95. package/templates/build.html +34 -0
  96. package/CHANGELOG.md +0 -419
  97. package/lib/client/clientAppEnhance.d.ts +0 -3
  98. package/lib/client/clientAppEnhance.js +0 -28
  99. package/lib/client/clientAppSetup.d.ts +0 -2
  100. package/lib/client/clientAppSetup.js +0 -11
  101. package/lib/client/components/DropdownLink.vue +0 -141
  102. package/lib/client/components/NavLink.vue +0 -115
  103. package/lib/client/components/SidebarChild.d.ts +0 -6
  104. package/lib/client/components/SidebarChild.js +0 -91
  105. package/lib/client/components/global/OutboundLink.vue +0 -30
  106. package/lib/client/composables/useNavLink.d.ts +0 -9
  107. package/lib/client/composables/useNavLink.js +0 -15
  108. package/lib/client/composables/useResolveRouteWithRedirect.d.ts +0 -5
  109. package/lib/client/layouts/404.vue +0 -38
  110. package/lib/client/styles/_normalize.scss +0 -148
  111. package/lib/client/styles/plugins.scss +0 -18
  112. package/lib/client/styles/sr-only.scss +0 -12
  113. package/lib/node/utils/resolveActiveHeaderLinksPluginOptions.d.ts +0 -6
  114. package/lib/node/utils/resolveActiveHeaderLinksPluginOptions.js +0 -16
  115. package/lib/node/utils/resolveGitPluginOptions.d.ts +0 -6
  116. package/lib/node/utils/resolveGitPluginOptions.js +0 -22
  117. package/lib/node/utils/resolveMediumZoomPluginOptions.d.ts +0 -6
  118. package/lib/node/utils/resolveMediumZoomPluginOptions.js +0 -17
@@ -1,3 +1,4 @@
1
+ @import '_mixins';
1
2
  @import '_variables';
2
3
 
3
4
  .sidebar {
@@ -11,16 +12,17 @@
11
12
  display: inline-block;
12
13
  }
13
14
 
14
- .navbar-links {
15
+ .navbar-items {
15
16
  display: none;
16
- border-bottom: 1px solid $borderColor;
17
+ border-bottom: 1px solid var(--c-border);
18
+ transition: border-color var(--t-color);
17
19
  padding: 0.5rem 0 0.75rem 0;
18
20
 
19
21
  a {
20
22
  font-weight: 600;
21
23
  }
22
24
 
23
- .navbar-links-item {
25
+ .navbar-item {
24
26
  display: block;
25
27
  line-height: 1.25rem;
26
28
  font-size: 1.1em;
@@ -28,125 +30,105 @@
28
30
  }
29
31
  }
30
32
 
31
- & > .sidebar-links {
33
+ .sidebar-items {
32
34
  padding: 1.5rem 0;
33
-
34
- & > li > a.sidebar-link {
35
- font-size: 1.1em;
36
- line-height: 1.7;
37
- font-weight: bold;
38
- }
39
-
40
- & > li:not(:first-child) {
41
- margin-top: 0.75rem;
42
- }
43
35
  }
44
36
  }
45
37
 
46
38
  @media (max-width: $MQMobile) {
47
39
  .sidebar {
48
- .navbar-links {
40
+ .navbar-items {
49
41
  display: block;
50
42
 
51
- .dropdown-wrapper
52
- .nav-dropdown
53
- .dropdown-item
43
+ .navbar-dropdown-wrapper
44
+ .navbar-dropdown
45
+ .navbar-dropdown-item
54
46
  a.router-link-active::after {
55
47
  top: calc(1rem - 2px);
56
48
  }
57
49
  }
58
50
 
59
- & > .sidebar-links {
51
+ .sidebar-items {
60
52
  padding: 1rem 0;
61
53
  }
62
54
  }
63
55
  }
64
56
 
65
- /**
66
- * sidebar child
67
- */
68
- .sidebar-group {
69
- .sidebar-links > &:not(:first-child) {
70
- margin-top: 0.75rem;
71
- }
72
- .sidebar-group {
73
- & > .sidebar-heading {
74
- opacity: 0.5;
75
- font-size: 0.95em;
76
- line-height: 1.4;
77
- font-weight: normal;
78
- padding-left: 2rem;
79
- }
80
- }
81
- }
82
-
83
- .sidebar-heading {
84
- color: $textColor;
85
- transition: color 0.15s ease;
57
+ .sidebar-item {
86
58
  cursor: default;
87
- font-size: 1.1em;
88
- font-weight: bold;
89
- padding: 0.35rem 1.5rem 0.35rem 1.25rem;
90
- width: 100%;
91
- box-sizing: border-box;
92
- margin: 0;
93
59
  border-left: 0.25rem solid transparent;
60
+ color: var(--c-text);
94
61
 
95
- &.open,
96
- &:hover {
97
- color: inherit;
62
+ &:focus-visible {
63
+ outline-width: 1px;
64
+ outline-offset: -1px;
98
65
  }
99
66
 
100
- .arrow {
101
- position: relative;
102
- top: -0.12em;
103
- left: 0.5em;
67
+ &.active:not(p.sidebar-heading) {
68
+ font-weight: 600;
69
+ color: var(--c-text-accent);
70
+ border-left-color: var(--c-text-accent);
104
71
  }
105
- }
106
72
 
107
- .sidebar .sidebar-sub-headers {
108
- padding-left: 1rem;
109
- font-size: 0.95em;
110
- }
73
+ &.sidebar-heading {
74
+ transition: color 0.15s ease;
75
+ font-size: 1.1em;
76
+ font-weight: bold;
77
+ padding: 0.35rem 1.5rem 0.35rem 1.25rem;
78
+ width: 100%;
79
+ box-sizing: border-box;
80
+ margin: 0;
111
81
 
112
- .sidebar-link {
113
- font-size: 1em;
114
- font-weight: 400;
115
- display: inline-block;
116
- color: $textColor;
117
- border-left: 0.25rem solid transparent;
118
- margin: 0;
119
- padding: 0.35rem 1rem 0.35rem 1.25rem;
120
- line-height: 1.4;
121
- width: 100%;
122
- box-sizing: border-box;
123
-
124
- .sidebar-group & {
125
- padding-left: 2rem;
82
+ + .sidebar-item-children {
83
+ @include dropdown_wrapper;
84
+ margin-bottom: 0.75rem;
85
+ }
126
86
  }
127
87
 
128
- .sidebar-sub-headers & {
129
- padding-top: 0.25rem;
130
- padding-bottom: 0.25rem;
131
- border-left: none;
88
+ &.collapsible {
89
+ cursor: pointer;
132
90
 
133
- &.active {
134
- font-weight: 500;
91
+ .arrow {
92
+ position: relative;
93
+ top: -0.12em;
94
+ left: 0.5em;
135
95
  }
136
96
  }
137
- }
138
97
 
139
- a.sidebar-heading,
140
- a.sidebar-link {
141
- cursor: pointer;
98
+ &:not(.sidebar-heading) {
99
+ font-size: 1em;
100
+ font-weight: 400;
101
+ display: inline-block;
102
+ margin: 0;
103
+ padding: 0.35rem 1rem 0.35rem 2rem;
104
+ line-height: 1.4;
105
+ width: 100%;
106
+ box-sizing: border-box;
142
107
 
143
- &.active {
144
- font-weight: 600;
145
- color: $accentColor;
146
- border-left-color: $accentColor;
108
+ & + .sidebar-item-children {
109
+ padding-left: 1rem;
110
+ font-size: 0.95em;
111
+ }
112
+
113
+ .sidebar-item-children .sidebar-item-children & {
114
+ padding: 0.25rem 1rem 0.25rem 1.75rem;
115
+
116
+ &.active {
117
+ font-weight: 500;
118
+ border-left-color: transparent;
119
+ }
120
+ }
121
+
122
+ a.sidebar-heading + .sidebar-item-children &.active {
123
+ border-left-color: transparent;
124
+ }
147
125
  }
126
+ }
127
+
128
+ a.sidebar-item {
129
+ cursor: pointer;
148
130
 
149
131
  &:hover {
150
- color: $accentColor;
132
+ color: var(--c-text-accent);
151
133
  }
152
134
  }
@@ -1,11 +1,20 @@
1
- .fade-slide-y-enter-active {
2
- transition: all 0.3s ease;
1
+ /**
2
+ * dropdown
3
+ */
4
+ .dropdown-enter-from,
5
+ .dropdown-leave-to {
6
+ height: 0 !important;
3
7
  }
4
8
 
9
+ /**
10
+ * fade-slide-y
11
+ */
12
+ .fade-slide-y-enter-active {
13
+ transition: all 0.2s ease;
14
+ }
5
15
  .fade-slide-y-leave-active {
6
- transition: all 0.3s cubic-bezier(1, 0.5, 0.8, 1);
16
+ transition: all 0.2s cubic-bezier(1, 0.5, 0.8, 1);
7
17
  }
8
-
9
18
  .fade-slide-y-enter-from,
10
19
  .fade-slide-y-leave-to {
11
20
  transform: translateY(10px);
@@ -0,0 +1,68 @@
1
+ html.dark {
2
+ // brand colors
3
+ --c-brand: #3aa675;
4
+ --c-brand-light: #349469;
5
+
6
+ // background colors
7
+ --c-bg: #22272e;
8
+ --c-bg-light: #2b313a;
9
+ --c-bg-lighter: #262c34;
10
+ --c-bg-dark: #343b44;
11
+ --c-bg-darker: #37404c;
12
+
13
+ // text colors
14
+ --c-text: #adbac7;
15
+ --c-text-light: #96a7b7;
16
+ --c-text-lighter: #8b9eb0;
17
+ --c-text-lightest: #8094a8;
18
+
19
+ // border colors
20
+ --c-border: #3e4c5a;
21
+ --c-border-dark: #34404c;
22
+
23
+ // custom container colors
24
+ --c-tip: #318a62;
25
+ --c-warning: #e0ad15;
26
+ --c-warning-bg: #2d2f2d;
27
+ --c-warning-bg-light: #423e2a;
28
+ --c-warning-bg-lighter: #44442f;
29
+ --c-warning-border-dark: #957c35;
30
+ --c-warning-details-bg: #39392d;
31
+ --c-warning-title: #fdca31;
32
+ --c-warning-text: #d8d96d;
33
+ --c-warning-text-accent: #ffbf00;
34
+ --c-warning-text-light: #ddb84b;
35
+ --c-warning-text-quote: #ccab49;
36
+ --c-danger: #fc1e38;
37
+ --c-danger-bg: #39232c;
38
+ --c-danger-bg-light: #4b2b35;
39
+ --c-danger-bg-lighter: #553040;
40
+ --c-danger-border-dark: #a25151;
41
+ --c-danger-details-bg: #482936;
42
+ --c-danger-title: #fc2d3b;
43
+ --c-danger-text: #ea9ca0;
44
+ --c-danger-text-accent: #fd3636;
45
+ --c-danger-text-light: #d9777c;
46
+ --c-danger-text-quote: #d56b6b;
47
+ --c-details-bg: #323843;
48
+
49
+ // badge component colors
50
+ --c-badge-warning: var(--c-warning);
51
+ --c-badge-warning-text: #3c2e05;
52
+ --c-badge-danger: var(--c-danger);
53
+ --c-badge-danger-text: #401416;
54
+
55
+ // code blocks vars
56
+ --code-hl-bg-color: #363b46;
57
+ }
58
+
59
+ // plugin-docsearch
60
+ html.dark .DocSearch {
61
+ --docsearch-logo-color: var(--c-text);
62
+ --docsearch-modal-shadow: inset 1px 1px 0 0 #2c2e40, 0 3px 8px 0 #000309;
63
+ --docsearch-key-shadow: inset 0 -2px 0 0 #282d55, inset 0 0 1px 1px #51577d,
64
+ 0 2px 2px 0 rgba(3, 4, 9, 0.3);
65
+ --docsearch-key-gradient: linear-gradient(-225deg, #444950, #1c1e21);
66
+ --docsearch-footer-shadow: inset 0 1px 0 0 rgba(73, 76, 106, 0.5),
67
+ 0 -4px 8px 0 rgba(0, 0, 0, 0.2);
68
+ }
@@ -0,0 +1,155 @@
1
+ :root {
2
+ // brand colors
3
+ --c-brand: #3eaf7c;
4
+ --c-brand-light: #4abf8a;
5
+
6
+ // background colors
7
+ --c-bg: #ffffff;
8
+ --c-bg-light: #f3f4f5;
9
+ --c-bg-lighter: #eeeeee;
10
+ --c-bg-dark: #ebebec;
11
+ --c-bg-darker: #e6e6e6;
12
+ --c-bg-navbar: var(--c-bg);
13
+ --c-bg-sidebar: var(--c-bg);
14
+ --c-bg-arrow: #cccccc;
15
+
16
+ // text colors
17
+ --c-text: #2c3e50;
18
+ --c-text-accent: var(--c-brand);
19
+ --c-text-light: #3a5169;
20
+ --c-text-lighter: #4e6e8e;
21
+ --c-text-lightest: #6a8bad;
22
+ --c-text-quote: #999999;
23
+
24
+ // border colors
25
+ --c-border: #eaecef;
26
+ --c-border-dark: #dfe2e5;
27
+
28
+ // custom container colors
29
+ --c-tip: #42b983;
30
+ --c-tip-bg: var(--c-bg-light);
31
+ --c-tip-title: var(--c-text);
32
+ --c-tip-text: var(--c-text);
33
+ --c-tip-text-accent: var(--c-text-accent);
34
+ --c-warning: #ffc310;
35
+ --c-warning-bg: #fffae3;
36
+ --c-warning-bg-light: #fff3ba;
37
+ --c-warning-bg-lighter: #fff0b0;
38
+ --c-warning-border-dark: #f7dc91;
39
+ --c-warning-details-bg: #fff5ca;
40
+ --c-warning-title: #f1b300;
41
+ --c-warning-text: #746000;
42
+ --c-warning-text-accent: #edb100;
43
+ --c-warning-text-light: #c1971c;
44
+ --c-warning-text-quote: #ccab49;
45
+ --c-danger: #f11e37;
46
+ --c-danger-bg: #ffe0e0;
47
+ --c-danger-bg-light: #ffcfde;
48
+ --c-danger-bg-lighter: #ffc9c9;
49
+ --c-danger-border-dark: #f1abab;
50
+ --c-danger-details-bg: #ffd4d4;
51
+ --c-danger-title: #ed1e2c;
52
+ --c-danger-text: #660000;
53
+ --c-danger-text-accent: #bd1a1a;
54
+ --c-danger-text-light: #b5474d;
55
+ --c-danger-text-quote: #c15b5b;
56
+ --c-details-bg: #eeeeee;
57
+
58
+ // badge component colors
59
+ --c-badge-tip: var(--c-tip);
60
+ --c-badge-warning: #ecc808;
61
+ --c-badge-warning-text: var(--c-bg);
62
+ --c-badge-danger: #dc2626;
63
+ --c-badge-danger-text: var(--c-bg);
64
+
65
+ // code group colors
66
+ --c-code-group-tab-title: rgba(255, 255, 255, 0.9);
67
+ --c-code-group-tab-bg: var(--code-bg-color);
68
+ --c-code-group-tab-outline: var(var(--c-code-group-tab-title));
69
+ --c-code-group-tab-active-border: var(--c-brand);
70
+
71
+ // transition vars
72
+ --t-color: 0.3s ease;
73
+ --t-transform: 0.3s ease;
74
+
75
+ // code blocks vars
76
+ --code-bg-color: #282c34;
77
+ --code-hl-bg-color: rgba(0, 0, 0, 0.66);
78
+ --code-ln-color: #9e9e9e;
79
+ --code-ln-wrapper-width: 3.5rem;
80
+
81
+ // font vars
82
+ --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,
83
+ Ubuntu, Cantarell, 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
84
+ --font-family-code: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
85
+
86
+ // layout vars
87
+ --navbar-height: 3.6rem;
88
+ --navbar-padding-v: 0.7rem;
89
+ --navbar-padding-h: 1.5rem;
90
+ --sidebar-width: 20rem;
91
+ --sidebar-width-mobile: calc(var(--sidebar-width) * 0.82);
92
+ --content-width: 740px;
93
+ --homepage-width: 960px;
94
+ }
95
+
96
+ // plugin-back-to-top
97
+ .back-to-top {
98
+ --back-to-top-color: var(--c-brand);
99
+ --back-to-top-color-hover: var(--c-brand-light);
100
+ }
101
+
102
+ // plugin-docsearch
103
+ .DocSearch {
104
+ --docsearch-primary-color: var(--c-brand);
105
+ --docsearch-text-color: var(--c-text);
106
+ --docsearch-highlight-color: var(--c-brand);
107
+ --docsearch-muted-color: var(--c-text-quote);
108
+ --docsearch-container-background: rgba(9, 10, 17, 0.8);
109
+ --docsearch-modal-background: var(--c-bg-light);
110
+ --docsearch-searchbox-background: var(--c-bg-lighter);
111
+ --docsearch-searchbox-focus-background: var(--c-bg);
112
+ --docsearch-searchbox-shadow: inset 0 0 0 2px var(--c-brand);
113
+ --docsearch-hit-color: var(--c-text-light);
114
+ --docsearch-hit-active-color: var(--c-bg);
115
+ --docsearch-hit-background: var(--c-bg);
116
+ --docsearch-hit-shadow: 0 1px 3px 0 var(--c-border-dark);
117
+ --docsearch-footer-background: var(--c-bg);
118
+ }
119
+
120
+ // plugin-external-link-icon
121
+ .external-link-icon {
122
+ --external-link-icon-color: var(--c-text-quote);
123
+ }
124
+
125
+ // plugin-medium-zoom
126
+ .medium-zoom-overlay {
127
+ --medium-zoom-bg-color: var(--c-bg);
128
+ }
129
+
130
+ // plugin-nprogress
131
+ #nprogress {
132
+ --nprogress-color: var(--c-brand);
133
+ }
134
+
135
+ // plugin-pwa-popup
136
+ .pwa-popup {
137
+ --pwa-popup-text-color: var(--c-text);
138
+ --pwa-popup-bg-color: var(--c-bg);
139
+ --pwa-popup-border-color: var(--c-brand);
140
+ --pwa-popup-shadow: 0 4px 16px var(--c-brand);
141
+ --pwa-popup-btn-text-color: var(--c-bg);
142
+ --pwa-popup-btn-bg-color: var(--c-brand);
143
+ --pwa-popup-btn-hover-bg-color: var(--c-brand-light);
144
+ }
145
+
146
+ // plugin-search
147
+ .search-box {
148
+ --search-bg-color: var(--c-bg);
149
+ --search-accent-color: var(--c-brand);
150
+ --search-text-color: var(--c-text);
151
+ --search-border-color: var(--c-border);
152
+
153
+ --search-item-text-color: var(--c-text-lighter);
154
+ --search-item-focus-bg-color: var(--c-bg-light);
155
+ }
@@ -0,0 +1,15 @@
1
+ import type { Router } from 'vue-router';
2
+ import type { NavLink } from '../../shared/index.js';
3
+ declare module 'vue-router' {
4
+ interface RouteMeta {
5
+ title?: string;
6
+ }
7
+ }
8
+ /**
9
+ * Resolve NavLink props from string
10
+ *
11
+ * @example
12
+ * - Input: '/README.md'
13
+ * - Output: { text: 'Home', link: '/' }
14
+ */
15
+ export declare const getNavLink: (router: Router, item: string) => NavLink;
@@ -0,0 +1,18 @@
1
+ import { getResolveRouteWithRedirect } from './getResolveRouteWithRedirect.js';
2
+ /**
3
+ * Resolve NavLink props from string
4
+ *
5
+ * @example
6
+ * - Input: '/README.md'
7
+ * - Output: { text: 'Home', link: '/' }
8
+ */
9
+ export const getNavLink = (router, item) => {
10
+ // the route path of vue-router is url-encoded, and we expect users are using
11
+ // non-url-encoded string in theme config, so we need to url-encode it first to
12
+ // resolve the route correctly
13
+ const resolved = getResolveRouteWithRedirect(router, encodeURI(item));
14
+ return {
15
+ text: resolved.meta.title || item,
16
+ link: resolved.name === '404' ? item : resolved.fullPath,
17
+ };
18
+ };
@@ -0,0 +1,5 @@
1
+ import type { Router } from 'vue-router';
2
+ /**
3
+ * Resolve a route with redirection
4
+ */
5
+ export declare const getResolveRouteWithRedirect: (router: Router, to: import("vue-router").RouteLocationRaw, currentLocation?: import("vue-router").RouteLocationNormalizedLoaded | undefined) => ReturnType<Router['resolve']>;
@@ -1,13 +1,11 @@
1
- import { useRouter } from 'vue-router';
2
- import { isFunction, isString } from '@vuepress/shared';
1
+ import { isFunction, isString } from 'vuepress/shared';
3
2
  /**
4
3
  * Resolve a route with redirection
5
4
  */
6
- export const useResolveRouteWithRedirect = (...args) => {
7
- const router = useRouter();
5
+ export const getResolveRouteWithRedirect = (router, ...args) => {
8
6
  const route = router.resolve(...args);
9
7
  const lastMatched = route.matched[route.matched.length - 1];
10
- if (!(lastMatched === null || lastMatched === void 0 ? void 0 : lastMatched.redirect)) {
8
+ if (!lastMatched?.redirect) {
11
9
  return route;
12
10
  }
13
11
  const { redirect } = lastMatched;
@@ -15,7 +13,7 @@ export const useResolveRouteWithRedirect = (...args) => {
15
13
  const resolvedRedirectObj = isString(resolvedRedirect)
16
14
  ? { path: resolvedRedirect }
17
15
  : resolvedRedirect;
18
- return useResolveRouteWithRedirect({
16
+ return getResolveRouteWithRedirect(router, {
19
17
  hash: route.hash,
20
18
  query: route.query,
21
19
  params: route.params,
@@ -1,2 +1,5 @@
1
- export * from './resolveEditLink';
2
- export * from './resolveRepoType';
1
+ export * from './getNavLink.js';
2
+ export * from './getResolveRouteWithRedirect.js';
3
+ export * from './isActiveSidebarItem.js';
4
+ export * from './resolveEditLink.js';
5
+ export * from './resolveRepoType.js';
@@ -1,2 +1,5 @@
1
- export * from './resolveEditLink';
2
- export * from './resolveRepoType';
1
+ export * from './getNavLink.js';
2
+ export * from './getResolveRouteWithRedirect.js';
3
+ export * from './isActiveSidebarItem.js';
4
+ export * from './resolveEditLink.js';
5
+ export * from './resolveRepoType.js';
@@ -0,0 +1,3 @@
1
+ import type { RouteLocationNormalizedLoaded } from 'vue-router';
2
+ import type { ResolvedSidebarItem } from '../../shared/index.js';
3
+ export declare const isActiveSidebarItem: (item: ResolvedSidebarItem, route: RouteLocationNormalizedLoaded) => boolean;
@@ -0,0 +1,20 @@
1
+ const normalizePath = (path) => decodeURI(path)
2
+ .replace(/#.*$/, '')
3
+ .replace(/(index)?\.(md|html)$/, '');
4
+ const isActiveLink = (link, route) => {
5
+ if (route.hash === link) {
6
+ return true;
7
+ }
8
+ const currentPath = normalizePath(route.path);
9
+ const targetPath = normalizePath(link);
10
+ return currentPath === targetPath;
11
+ };
12
+ export const isActiveSidebarItem = (item, route) => {
13
+ if (item.link && isActiveLink(item.link, route)) {
14
+ return true;
15
+ }
16
+ if (item.children) {
17
+ return item.children.some((child) => isActiveSidebarItem(child, route));
18
+ }
19
+ return false;
20
+ };
@@ -1,9 +1,9 @@
1
- import type { RepoType } from './resolveRepoType';
1
+ import type { RepoType } from './resolveRepoType.js';
2
2
  export declare const editLinkPatterns: Record<Exclude<RepoType, null>, string>;
3
3
  export declare const resolveEditLink: ({ docsRepo, docsBranch, docsDir, filePathRelative, editLinkPattern, }: {
4
4
  docsRepo: string;
5
5
  docsBranch: string;
6
6
  docsDir: string;
7
- filePathRelative: string;
7
+ filePathRelative: string | null;
8
8
  editLinkPattern?: string | undefined;
9
9
  }) => string | null;
@@ -1,23 +1,29 @@
1
- import { removeLeadingSlash, removeEndingSlash } from '@vuepress/shared';
2
- import { resolveRepoType } from './resolveRepoType';
1
+ import { isLinkHttp, removeEndingSlash, removeLeadingSlash, } from 'vuepress/shared';
2
+ import { resolveRepoType } from './resolveRepoType.js';
3
3
  export const editLinkPatterns = {
4
4
  GitHub: ':repo/edit/:branch/:path',
5
5
  GitLab: ':repo/-/edit/:branch/:path',
6
+ Gitee: ':repo/edit/:branch/:path',
6
7
  Bitbucket: ':repo/src/:branch/:path?mode=edit&spa=0&at=:branch&fileviewer=file-view-default',
7
8
  };
8
- export const resolveEditLink = ({ docsRepo, docsBranch, docsDir, filePathRelative, editLinkPattern, }) => {
9
- const repoType = resolveRepoType(docsRepo);
10
- let pattern;
9
+ const resolveEditLinkPatterns = ({ docsRepo, editLinkPattern, }) => {
11
10
  if (editLinkPattern) {
12
- pattern = editLinkPattern;
11
+ return editLinkPattern;
13
12
  }
14
- else if (repoType !== null) {
15
- pattern = editLinkPatterns[repoType];
13
+ const repoType = resolveRepoType(docsRepo);
14
+ if (repoType !== null) {
15
+ return editLinkPatterns[repoType];
16
16
  }
17
+ return null;
18
+ };
19
+ export const resolveEditLink = ({ docsRepo, docsBranch, docsDir, filePathRelative, editLinkPattern, }) => {
20
+ if (!filePathRelative)
21
+ return null;
22
+ const pattern = resolveEditLinkPatterns({ docsRepo, editLinkPattern });
17
23
  if (!pattern)
18
24
  return null;
19
25
  return pattern
20
- .replace(/:repo/, repoType === 'GitHub' ? `https://github.com/${docsRepo}` : docsRepo)
26
+ .replace(/:repo/, isLinkHttp(docsRepo) ? docsRepo : `https://github.com/${docsRepo}`)
21
27
  .replace(/:branch/, docsBranch)
22
28
  .replace(/:path/, removeLeadingSlash(`${removeEndingSlash(docsDir)}/${filePathRelative}`));
23
29
  };
@@ -1,2 +1,2 @@
1
- export declare type RepoType = 'GitHub' | 'GitLab' | 'Bitbucket' | null;
1
+ export type RepoType = 'GitHub' | 'GitLab' | 'Gitee' | 'Bitbucket' | null;
2
2
  export declare const resolveRepoType: (repo: string) => RepoType;
@@ -1,10 +1,12 @@
1
- import { isLinkHttp } from '@vuepress/shared';
1
+ import { isLinkHttp } from 'vuepress/shared';
2
2
  export const resolveRepoType = (repo) => {
3
- if (!isLinkHttp(repo))
3
+ if (!isLinkHttp(repo) || /github\.com/.test(repo))
4
4
  return 'GitHub';
5
5
  if (/bitbucket\.org/.test(repo))
6
6
  return 'Bitbucket';
7
7
  if (/gitlab\.com/.test(repo))
8
8
  return 'GitLab';
9
+ if (/gitee\.com/.test(repo))
10
+ return 'Gitee';
9
11
  return null;
10
12
  };
@@ -1,10 +1,10 @@
1
- import type { Theme, ThemeConfig } from '@vuepress/core';
2
- import type { DefaultThemeLocaleOptions, DefaultThemePluginsOptions } from '../shared';
3
- export interface DefaultThemeOptions extends ThemeConfig, DefaultThemeLocaleOptions {
1
+ import type { Theme } from 'vuepress/core';
2
+ import type { DefaultThemeLocaleOptions, DefaultThemePluginsOptions } from '../shared/index.js';
3
+ export interface DefaultThemeOptions extends DefaultThemeLocaleOptions {
4
4
  /**
5
5
  * To avoid confusion with the root `plugins` option,
6
6
  * we use `themePlugins`
7
7
  */
8
8
  themePlugins?: DefaultThemePluginsOptions;
9
9
  }
10
- export declare const defaultTheme: Theme<DefaultThemeOptions>;
10
+ export declare const defaultTheme: ({ themePlugins, ...localeOptions }?: DefaultThemeOptions) => Theme;