vitepress 0.22.2 → 1.0.0-draft.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 (134) hide show
  1. package/README.md +4 -4
  2. package/client.d.ts +2 -3
  3. package/dist/client/app/components/ClientOnly.js +1 -1
  4. package/dist/client/app/index.js +5 -7
  5. package/dist/client/app/router.js +11 -5
  6. package/dist/client/theme-default/Layout.vue +25 -183
  7. package/dist/client/theme-default/NotFound.vue +9 -8
  8. package/dist/client/theme-default/components/VPAlgoliaSearchBox.vue +127 -0
  9. package/dist/client/theme-default/components/VPBackdrop.vue +39 -0
  10. package/dist/client/theme-default/components/VPContent.vue +44 -0
  11. package/dist/client/theme-default/components/VPContentDoc.vue +173 -0
  12. package/dist/client/theme-default/components/VPContentDocFooter.vue +140 -0
  13. package/dist/client/theme-default/components/VPContentDocOutline.vue +108 -0
  14. package/dist/client/theme-default/components/VPFlyout.vue +149 -0
  15. package/dist/client/theme-default/components/VPLink.vue +37 -0
  16. package/dist/client/theme-default/components/VPLocalNav.vue +106 -0
  17. package/dist/client/theme-default/components/VPMenu.vue +79 -0
  18. package/dist/client/theme-default/components/VPMenuGroup.vue +35 -0
  19. package/dist/client/theme-default/components/VPMenuLink.vue +30 -0
  20. package/dist/client/theme-default/components/VPNav.vue +33 -0
  21. package/dist/client/theme-default/components/VPNavBar.vue +109 -0
  22. package/dist/client/theme-default/components/VPNavBarAppearance.vue +22 -0
  23. package/dist/client/theme-default/components/VPNavBarExtra.vue +107 -0
  24. package/dist/client/theme-default/components/VPNavBarHamburger.vue +79 -0
  25. package/dist/client/theme-default/components/VPNavBarMenu.vue +29 -0
  26. package/dist/client/theme-default/components/VPNavBarMenuGroup.vue +18 -0
  27. package/dist/client/theme-default/components/VPNavBarMenuLink.vue +56 -0
  28. package/dist/client/theme-default/components/VPNavBarSearch.vue +269 -0
  29. package/dist/client/theme-default/components/VPNavBarSocialLinks.vue +27 -0
  30. package/dist/client/theme-default/components/VPNavBarTitle.vue +44 -0
  31. package/dist/client/theme-default/components/VPNavBarTranslations.vue +74 -0
  32. package/dist/client/theme-default/components/VPNavScreen.vue +100 -0
  33. package/dist/client/theme-default/components/VPNavScreenAppearance.vue +30 -0
  34. package/dist/client/theme-default/components/VPNavScreenMenu.vue +24 -0
  35. package/dist/client/theme-default/components/VPNavScreenMenuGroup.vue +118 -0
  36. package/dist/client/theme-default/components/VPNavScreenMenuGroupLink.vue +33 -0
  37. package/dist/client/theme-default/components/VPNavScreenMenuGroupSection.vue +35 -0
  38. package/dist/client/theme-default/components/VPNavScreenMenuLink.vue +34 -0
  39. package/dist/client/theme-default/components/VPNavScreenSocialLinks.vue +14 -0
  40. package/dist/client/theme-default/components/VPNavScreenTranslations.vue +73 -0
  41. package/dist/client/theme-default/components/VPSidebar.vue +118 -0
  42. package/dist/client/theme-default/components/VPSidebarGroup.vue +44 -0
  43. package/dist/client/theme-default/components/VPSidebarLink.vue +57 -0
  44. package/dist/client/theme-default/components/VPSkipLink.vue +72 -0
  45. package/dist/client/theme-default/components/VPSocialLink.vue +63 -0
  46. package/dist/client/theme-default/components/VPSocialLinks.vue +27 -0
  47. package/dist/client/theme-default/components/VPSwitch.vue +66 -0
  48. package/dist/client/theme-default/components/VPSwitchAppearance.vue +74 -0
  49. package/dist/client/theme-default/components/icons/VPIconAlignJustify.vue +8 -0
  50. package/dist/client/theme-default/components/icons/VPIconAlignLeft.vue +8 -0
  51. package/dist/client/theme-default/components/icons/VPIconAlignRight.vue +8 -0
  52. package/dist/client/theme-default/components/icons/{ArrowLeft.vue → VPIconArrowLeft.vue} +0 -0
  53. package/dist/client/theme-default/components/icons/{ArrowRight.vue → VPIconArrowRight.vue} +0 -0
  54. package/dist/client/theme-default/components/icons/VPIconChevronDown.vue +5 -0
  55. package/dist/client/theme-default/components/icons/VPIconChevronLeft.vue +5 -0
  56. package/dist/client/theme-default/components/icons/VPIconChevronRight.vue +5 -0
  57. package/dist/client/theme-default/components/icons/VPIconChevronUp.vue +5 -0
  58. package/dist/client/theme-default/components/icons/VPIconDiscord.vue +5 -0
  59. package/dist/client/theme-default/components/icons/VPIconEdit.vue +6 -0
  60. package/dist/client/theme-default/components/icons/VPIconExternalLink.vue +13 -0
  61. package/dist/client/theme-default/components/icons/VPIconFacebook.vue +5 -0
  62. package/dist/client/theme-default/components/icons/VPIconGitHub.vue +5 -0
  63. package/dist/client/theme-default/components/icons/VPIconInstagram.vue +5 -0
  64. package/dist/client/theme-default/components/icons/VPIconLanguages.vue +9 -0
  65. package/dist/client/theme-default/components/icons/VPIconLinkedIn.vue +5 -0
  66. package/dist/client/theme-default/components/icons/VPIconMoon.vue +5 -0
  67. package/dist/client/theme-default/components/icons/VPIconMoreHorizontal.vue +7 -0
  68. package/dist/client/theme-default/components/icons/VPIconPlus.vue +5 -0
  69. package/dist/client/theme-default/components/icons/VPIconSlack.vue +5 -0
  70. package/dist/client/theme-default/components/icons/VPIconSun.vue +13 -0
  71. package/dist/client/theme-default/components/icons/VPIconTwitter.vue +5 -0
  72. package/dist/client/theme-default/components/icons/VPIconYouTube.vue +5 -0
  73. package/dist/client/theme-default/composables/edit-link.js +22 -0
  74. package/dist/client/theme-default/composables/flyout.js +40 -0
  75. package/dist/client/theme-default/composables/nav.js +27 -1
  76. package/dist/client/theme-default/composables/outline.js +130 -0
  77. package/dist/client/theme-default/composables/prev-next.js +18 -0
  78. package/dist/client/theme-default/composables/sidebar.js +57 -0
  79. package/dist/client/theme-default/fonts/inter-cyrillic-ext.woff2 +0 -0
  80. package/dist/client/theme-default/fonts/inter-cyrillic.woff2 +0 -0
  81. package/dist/client/theme-default/fonts/inter-greek-ext.woff2 +0 -0
  82. package/dist/client/theme-default/fonts/inter-greek.woff2 +0 -0
  83. package/dist/client/theme-default/fonts/inter-latin-ext.woff2 +0 -0
  84. package/dist/client/theme-default/fonts/inter-latin.woff2 +0 -0
  85. package/dist/client/theme-default/fonts/inter-vietnamese.woff2 +0 -0
  86. package/dist/client/theme-default/index.js +4 -4
  87. package/dist/client/theme-default/styles/base.css +200 -0
  88. package/dist/client/theme-default/styles/fonts.css +67 -0
  89. package/dist/client/theme-default/styles/utils.css +9 -0
  90. package/dist/client/theme-default/styles/vars.css +206 -66
  91. package/dist/client/theme-default/styles/vp-doc.css +419 -0
  92. package/dist/client/theme-default/support/sidebar.js +29 -0
  93. package/dist/client/theme-default/support/utils.js +43 -0
  94. package/dist/node/cli.js +1 -1
  95. package/dist/node/index.d.ts +106 -81
  96. package/dist/node/index.js +1 -1
  97. package/dist/node/{serve-cf4b2162.js → serve-428d4610.js} +27 -10
  98. package/package.json +31 -27
  99. package/types/default-theme.d.ts +105 -80
  100. package/dist/client/theme-default/components/AlgoliaSearchBox.vue +0 -195
  101. package/dist/client/theme-default/components/BuySellAds.vue +0 -152
  102. package/dist/client/theme-default/components/CarbonAds.vue +0 -99
  103. package/dist/client/theme-default/components/EditLink.vue +0 -38
  104. package/dist/client/theme-default/components/Home.vue +0 -31
  105. package/dist/client/theme-default/components/HomeFeatures.vue +0 -143
  106. package/dist/client/theme-default/components/HomeFooter.vue +0 -50
  107. package/dist/client/theme-default/components/HomeHero.vue +0 -161
  108. package/dist/client/theme-default/components/LastUpdated.vue +0 -60
  109. package/dist/client/theme-default/components/NavBar.vue +0 -60
  110. package/dist/client/theme-default/components/NavBarTitle.vue +0 -41
  111. package/dist/client/theme-default/components/NavDropdownLink.vue +0 -135
  112. package/dist/client/theme-default/components/NavDropdownLinkItem.vue +0 -76
  113. package/dist/client/theme-default/components/NavLink.vue +0 -61
  114. package/dist/client/theme-default/components/NavLinks.vue +0 -52
  115. package/dist/client/theme-default/components/NextAndPrevLinks.vue +0 -88
  116. package/dist/client/theme-default/components/Page.vue +0 -53
  117. package/dist/client/theme-default/components/PageFooter.vue +0 -44
  118. package/dist/client/theme-default/components/SideBar.vue +0 -60
  119. package/dist/client/theme-default/components/SideBarLink.js +0 -68
  120. package/dist/client/theme-default/components/SideBarLinks.vue +0 -12
  121. package/dist/client/theme-default/components/ToggleSideBarButton.vue +0 -46
  122. package/dist/client/theme-default/components/icons/OutboundLink.vue +0 -31
  123. package/dist/client/theme-default/composables/activeSidebarLink.js +0 -99
  124. package/dist/client/theme-default/composables/editLink.js +0 -49
  125. package/dist/client/theme-default/composables/navLink.js +0 -42
  126. package/dist/client/theme-default/composables/nextAndPrevLinks.js +0 -37
  127. package/dist/client/theme-default/composables/repo.js +0 -38
  128. package/dist/client/theme-default/composables/sideBar.js +0 -57
  129. package/dist/client/theme-default/styles/code.css +0 -299
  130. package/dist/client/theme-default/styles/custom-blocks.css +0 -76
  131. package/dist/client/theme-default/styles/layout.css +0 -236
  132. package/dist/client/theme-default/styles/sidebar-links.css +0 -107
  133. package/dist/client/theme-default/support/sideBar.js +0 -46
  134. package/dist/client/theme-default/utils.js +0 -63
@@ -0,0 +1,419 @@
1
+ /**
2
+ * Headings
3
+ * -------------------------------------------------------------------------- */
4
+
5
+ .vp-doc h1,
6
+ .vp-doc h2,
7
+ .vp-doc h3,
8
+ .vp-doc h4,
9
+ .vp-doc h5,
10
+ .vp-doc h6 {
11
+ position: relative;
12
+ font-weight: 600;
13
+ outline: none;
14
+ }
15
+
16
+ .vp-doc h1 {
17
+ letter-spacing: -0.02em;
18
+ line-height: 40px;
19
+ font-size: 28px;
20
+ }
21
+
22
+ .vp-doc h2 {
23
+ margin: 48px 0 0;
24
+ border-top: 1px solid var(--vp-c-divider-light);
25
+ padding-top: 24px;
26
+ letter-spacing: -0.02em;
27
+ line-height: 32px;
28
+ font-size: 24px;
29
+ }
30
+
31
+ .vp-doc h3 {
32
+ margin: 48px 0 0;
33
+ letter-spacing: -0.01em;
34
+ line-height: 28px;
35
+ font-size: 20px;
36
+ }
37
+
38
+ .vp-doc .header-anchor {
39
+ float: left;
40
+ margin-left: -0.87em;
41
+ padding-right: 0.23em;
42
+ font-weight: 500;
43
+ opacity: 0;
44
+ transition: color 0.25s, opacity 0.25s;
45
+ }
46
+
47
+ .vp-doc h1:hover .header-anchor,
48
+ .vp-doc h1 .header-anchor:focus,
49
+ .vp-doc h2:hover .header-anchor,
50
+ .vp-doc h2 .header-anchor:focus,
51
+ .vp-doc h3:hover .header-anchor,
52
+ .vp-doc h3 .header-anchor:focus,
53
+ .vp-doc h4:hover .header-anchor,
54
+ .vp-doc h4 .header-anchor:focus,
55
+ .vp-doc h5:hover .header-anchor,
56
+ .vp-doc h5 .header-anchor:focus,
57
+ .vp-doc h6:hover .header-anchor,
58
+ .vp-doc h6 .header-anchor:focus {
59
+ opacity: 1;
60
+ }
61
+
62
+ @media (min-width: 768px) {
63
+ .vp-doc h1 {
64
+ letter-spacing: -0.02em;
65
+ line-height: 40px;
66
+ font-size: 32px;
67
+ }
68
+ }
69
+
70
+ /**
71
+ * Paragraph and inline elements
72
+ * -------------------------------------------------------------------------- */
73
+
74
+ .vp-doc p,
75
+ .vp-doc summary {
76
+ margin: 16px 0;
77
+ }
78
+
79
+ .vp-doc p {
80
+ line-height: 28px;
81
+ }
82
+
83
+ .vp-doc blockquote {
84
+ margin: 16px 0;
85
+ border-left: 2px solid var(--vp-c-divider);
86
+ padding-left: 16px;
87
+ transition: border-color 0.5s;
88
+ }
89
+
90
+ .vp-doc blockquote > p {
91
+ margin: 0;
92
+ font-size: 16px;
93
+ color: var(--vp-c-text-2);
94
+ transition: color 0.5s;
95
+ }
96
+
97
+ .vp-doc a {
98
+ font-weight: 500;
99
+ color: var(--vp-c-brand);
100
+ text-decoration-style: dotted;
101
+ transition: color 0.25s;
102
+ }
103
+
104
+ .vp-doc a:hover {
105
+ color: var(--vp-c-brand-dark);
106
+ }
107
+
108
+ .vp-doc strong {
109
+ font-weight: 600;
110
+ }
111
+
112
+ /**
113
+ * Lists
114
+ * -------------------------------------------------------------------------- */
115
+
116
+ .vp-doc ul,
117
+ .vp-doc ol {
118
+ margin: 16px 0;
119
+ }
120
+
121
+ .vp-doc ul {
122
+ padding-left: 1.25rem;
123
+ list-style: disc;
124
+ }
125
+
126
+ /**
127
+ * Table
128
+ * -------------------------------------------------------------------------- */
129
+
130
+ .vp-doc table {
131
+ display: block;
132
+ border-collapse: collapse;
133
+ margin: 20px 0;
134
+ overflow-x: auto;
135
+ }
136
+
137
+ .vp-doc tr {
138
+ border-top: 1px solid var(--vp-c-divider);
139
+ transition: background-color 0.5s;
140
+ }
141
+
142
+ .vp-doc tr:nth-child(2n) {
143
+ background-color: var(--vp-c-bg-soft);
144
+ }
145
+
146
+ .dark .vp-doc tr:nth-child(2n) {
147
+ background-color: var(--vp-c-bg-mute);
148
+ }
149
+
150
+ .vp-doc th,
151
+ .vp-doc td {
152
+ border: 1px solid var(--vp-c-divider);
153
+ padding: 12px 16px;
154
+ }
155
+
156
+ .vp-doc th {
157
+ font-size: 16px;
158
+ font-weight: 600;
159
+ background-color: var(--vp-c-white-soft);
160
+ }
161
+
162
+ .dark .vp-doc th {
163
+ background-color: var(--vp-c-black);
164
+ }
165
+
166
+ /**
167
+ * Decorational elements
168
+ * -------------------------------------------------------------------------- */
169
+
170
+ .vp-doc hr {
171
+ margin: 16px 0;
172
+ border: none;
173
+ border-top: 1px solid var(--vp-c-divider-light);
174
+ }
175
+
176
+ /**
177
+ * Code
178
+ * -------------------------------------------------------------------------- */
179
+
180
+ /* inline code */
181
+ .vp-doc :not(pre, h1, h2, h3, h4, h5, h6) > code {
182
+ font-size: var(--vp-code-font-size);
183
+ }
184
+
185
+ .vp-doc :not(pre) > code {
186
+ border-radius: 4px;
187
+ padding: 4px 6px;
188
+ color: var(--vp-c-text-code);
189
+ background-color: var(--vp-c-bg-mute);
190
+ transition: color 0.5s, background-color 0.5s;
191
+ }
192
+
193
+ .vp-doc h1 > code,
194
+ .vp-doc h2 > code,
195
+ .vp-doc h3 > code {
196
+ font-size: 0.9em;
197
+ }
198
+
199
+ @media (min-width: 768px) {
200
+ .vp-doc :not(pre) > code {
201
+ white-space: nowrap;
202
+ }
203
+ }
204
+
205
+ .vp-doc a > code {
206
+ color: var(--vp-c-brand-dark);
207
+ }
208
+
209
+ .vp-doc div[class*='language-'] {
210
+ position: relative;
211
+ margin: 20px -24px;
212
+ background-color: var(--vp-code-block-bg);
213
+ overflow-x: auto;
214
+ transition: background-color 0.5s;
215
+ }
216
+
217
+ @media (min-width: 640px) {
218
+ .vp-doc div[class*='language-'] {
219
+ border-radius: 8px;
220
+ margin: 20px 0;
221
+ }
222
+ }
223
+
224
+ @media (max-width: 639px) {
225
+ .vp-doc li div[class*='language-'] {
226
+ border-radius: 8px 0 0 8px;
227
+ }
228
+ }
229
+
230
+ .vp-doc div[class*='language-'] + div[class*='language-'],
231
+ .vp-doc div[class$='-api'] + div[class*='language-'],
232
+ .vp-doc div[class*='language-'] + div[class$='-api'] > div[class*='language-'] {
233
+ margin-top: -12px;
234
+ }
235
+
236
+ .vp-doc [class*='language-'] pre,
237
+ .vp-doc [class*='language-'] code {
238
+ text-align: left;
239
+ white-space: pre;
240
+ word-spacing: normal;
241
+ word-break: normal;
242
+ word-wrap: normal;
243
+ -moz-tab-size: 4;
244
+ -o-tab-size: 4;
245
+ tab-size: 4;
246
+ -webkit-hyphens: none;
247
+ -moz-hyphens: none;
248
+ -ms-hyphens: none;
249
+ hyphens: none;
250
+ }
251
+
252
+ .vp-doc [class*='language-'] pre {
253
+ position: relative;
254
+ z-index: 1;
255
+ margin: 0;
256
+ padding: 16px 24px;
257
+ background: transparent;
258
+ overflow-x: auto;
259
+ }
260
+
261
+ .vp-doc [class*='language-'] code {
262
+ display: inline-block;
263
+ padding: 0;
264
+ line-height: var(--vp-code-line-height);
265
+ font-size: var(--vp-code-font-size);
266
+ color: var(--vp-code-block-color);
267
+ transition: color 0.5s;
268
+ }
269
+
270
+ .vp-doc .highlight-lines {
271
+ position: absolute;
272
+ top: 0;
273
+ bottom: 0;
274
+ left: 0;
275
+ padding: 13px 0 11px;
276
+ width: 100%;
277
+ font-family: var(--vp-font-family-mono);
278
+ line-height: var(--vp-code-line-height);
279
+ font-size: var(--vp-code-font-size);
280
+ user-select: none;
281
+ overflow: hidden;
282
+ }
283
+
284
+ .vp-doc .highlight-lines .highlighted {
285
+ background-color: rgba(0, 0, 0, 0.3);
286
+ transition: background-color 0.5s;
287
+ }
288
+
289
+ .dark .vp-doc .highlight-lines .highlighted {
290
+ background-color: rgba(255, 255, 255, 0.05);
291
+ }
292
+
293
+ .vp-doc div[class*='language-'].line-numbers-mode {
294
+ padding-left: 32px;
295
+ }
296
+
297
+ .vp-doc .line-numbers-wrapper {
298
+ position: absolute;
299
+ top: 0;
300
+ bottom: 0;
301
+ left: 0;
302
+ z-index: 3;
303
+ border-right: 1px solid var(--vp-c-divider-light);
304
+ padding: 13px 0 11px;
305
+ width: 32px;
306
+ text-align: center;
307
+ font-family: var(--vp-font-family-mono);
308
+ line-height: var(--vp-code-line-height);
309
+ font-size: var(--vp-code-font-size);
310
+ color: var(--vp-c-text-3);
311
+ transition: border-color 0.5s, color 0.5s;
312
+ }
313
+
314
+ .vp-doc [class*='language-']:before {
315
+ position: absolute;
316
+ top: 4px;
317
+ right: 10px;
318
+ z-index: 2;
319
+ font-size: 12px;
320
+ font-weight: 500;
321
+ color: var(--vp-c-text-dark-3);
322
+ transition: color 0.5s;
323
+ }
324
+
325
+ .vp-doc [class~='language-vue']:before { content: 'vue'; }
326
+ .vp-doc [class~='language-html']:before { content: 'html'; }
327
+ .vp-doc [class~='language-vue-html']:before { content: 'template'; }
328
+ .vp-doc [class~='language-css']:before { content: 'css'; }
329
+ .vp-doc [class~='language-js']:before { content: 'js'; }
330
+ .vp-doc [class~='language-jsx']:before { content: 'jsx'; }
331
+ .vp-doc [class~='language-ts']:before { content: 'ts'; }
332
+ .vp-doc [class~='language-tsx']:before { content: 'tsx'; }
333
+ .vp-doc [class~='language-json']:before { content: 'json'; }
334
+ .vp-doc [class~='language-sh']:before { content: 'sh'; }
335
+ .vp-doc [class~='language-bash']:before { content: 'sh'; }
336
+
337
+ /**
338
+ * Code: Highlight
339
+ *
340
+ * prism.js tomorrow night eighties theme.
341
+ * https://github.com/chriskempson/tomorrow-theme
342
+ *
343
+ * @author Rose Pritchard
344
+ * -------------------------------------------------------------------------- */
345
+
346
+ .token.comment,
347
+ .token.block-comment,
348
+ .token.prolog,
349
+ .token.doctype,
350
+ .token.cdata {
351
+ color: #999;
352
+ }
353
+
354
+ .token.punctuation {
355
+ color: #ccc;
356
+ }
357
+
358
+ .token.tag,
359
+ .token.attr-name,
360
+ .token.namespace,
361
+ .token.deleted {
362
+ color: #e2777a;
363
+ }
364
+
365
+ .token.function-name {
366
+ color: #6196cc;
367
+ }
368
+
369
+ .token.boolean,
370
+ .token.number,
371
+ .token.function {
372
+ color: #f08d49;
373
+ }
374
+
375
+ .token.property,
376
+ .token.class-name,
377
+ .token.constant,
378
+ .token.symbol {
379
+ color: #f8c555;
380
+ }
381
+
382
+ .token.selector,
383
+ .token.important,
384
+ .token.atrule,
385
+ .token.keyword,
386
+ .token.builtin {
387
+ color: #cc99cd;
388
+ }
389
+
390
+ .token.string,
391
+ .token.char,
392
+ .token.attr-value,
393
+ .token.regex,
394
+ .token.variable {
395
+ color: #7ec699;
396
+ }
397
+
398
+ .token.operator,
399
+ .token.entity,
400
+ .token.url {
401
+ color: #67cdcc;
402
+ }
403
+
404
+ .token.important,
405
+ .token.bold {
406
+ font-weight: bold;
407
+ }
408
+
409
+ .token.italic {
410
+ font-style: italic;
411
+ }
412
+
413
+ .token.entity {
414
+ cursor: help;
415
+ }
416
+
417
+ .token.inserted {
418
+ color: green;
419
+ }
@@ -0,0 +1,29 @@
1
+ import { ensureStartingSlash } from './utils';
2
+ /**
3
+ * Get the `Sidebar` from sidebar option. This method will ensure to get correct
4
+ * sidebar config from `MultiSideBarConfig` with various path combinations such
5
+ * as matching `guide/` and `/guide/`. If no matching config was found, it will
6
+ * return empty array.
7
+ */
8
+ export function getSidebar(sidebar, path) {
9
+ if (Array.isArray(sidebar)) {
10
+ return sidebar;
11
+ }
12
+ path = ensureStartingSlash(path);
13
+ for (const dir in sidebar) {
14
+ // make sure the multi sidebar key starts with slash too
15
+ if (path.startsWith(ensureStartingSlash(dir))) {
16
+ return sidebar[dir];
17
+ }
18
+ }
19
+ return [];
20
+ }
21
+ export function getFlatSideBarLinks(sidebar) {
22
+ const links = [];
23
+ for (const group of sidebar) {
24
+ for (const link of group.items) {
25
+ links.push(link);
26
+ }
27
+ }
28
+ return links;
29
+ }
@@ -0,0 +1,43 @@
1
+ import { ref } from 'vue';
2
+ import { withBase } from 'vitepress';
3
+ export const HASH_RE = /#.*$/;
4
+ export const EXT_RE = /(index)?\.(md|html)$/;
5
+ export const OUTBOUND_RE = /^[a-z]+:/i;
6
+ const inBrowser = typeof window !== 'undefined';
7
+ const hashRef = ref(inBrowser ? location.hash : '');
8
+ export function isExternal(path) {
9
+ return OUTBOUND_RE.test(path);
10
+ }
11
+ export function isActive(currentPath, matchPath, asRegex = false) {
12
+ if (matchPath === undefined) {
13
+ return false;
14
+ }
15
+ currentPath = normalize(`/${currentPath}`);
16
+ if (asRegex) {
17
+ return new RegExp(matchPath).test(currentPath);
18
+ }
19
+ if (normalize(matchPath) !== currentPath) {
20
+ return false;
21
+ }
22
+ const hashMatch = matchPath.match(HASH_RE);
23
+ if (hashMatch) {
24
+ return hashRef.value === hashMatch[0];
25
+ }
26
+ return true;
27
+ }
28
+ export function ensureStartingSlash(path) {
29
+ return /^\//.test(path) ? path : `/${path}`;
30
+ }
31
+ export function normalize(path) {
32
+ return decodeURI(path).replace(HASH_RE, '').replace(EXT_RE, '');
33
+ }
34
+ export function normalizeLink(url) {
35
+ if (isExternal(url)) {
36
+ return url;
37
+ }
38
+ const { pathname, search, hash } = new URL(url, 'http://example.com');
39
+ const normalizedPath = pathname.endsWith('/') || pathname.endsWith('.html')
40
+ ? url
41
+ : `${pathname.replace(/(\.md)?$/, '.html')}${search}${hash}`;
42
+ return withBase(normalizedPath);
43
+ }
package/dist/node/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var serve = require('./serve-cf4b2162.js');
3
+ var serve = require('./serve-428d4610.js');
4
4
  require('fs');
5
5
  require('path');
6
6
  require('url');