docus 2.1.0 → 3.0.0-beta.3
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 +6 -4
- package/app/router.options.ts +18 -0
- package/assets/css/fonts.css +84 -0
- package/assets/css/main.css +11 -0
- package/assets/css/tailwind.css +282 -0
- package/components/app/Container.vue +25 -0
- package/components/app/Footer.vue +40 -0
- package/components/app/Navbar.vue +26 -0
- package/components/app/NavbarLogo.vue +33 -0
- package/components/app/Page.vue +7 -0
- package/components/app/PoweredByDocus.vue +11 -0
- package/components/content/Alert.vue +124 -0
- package/components/content/BlockHero.vue +54 -0
- package/components/content/ButtonLink.vue +45 -0
- package/components/content/Card.vue +46 -0
- package/components/content/CardGrid.vue +23 -0
- package/components/content/CodeBlock.vue +47 -0
- package/components/content/CodeGroup.vue +135 -0
- package/components/content/CopyButton.vue +49 -0
- package/{dist/runtime/app/components/prose/ProseOl.vue → components/content/List.vue} +2 -2
- package/components/content/NeedContribution.vue +23 -0
- package/components/content/ReadMore.vue +25 -0
- package/components/content/Sandbox.vue +102 -0
- package/components/content/TabsHeader.vue +44 -0
- package/components/content/Terminal.vue +64 -0
- package/components/content/VideoPlayer.vue +115 -0
- package/components/docs/DocsAside.vue +21 -0
- package/components/docs/DocsAsideTree.vue +102 -0
- package/components/docs/DocsHero.vue +39 -0
- package/components/docs/DocsPage.vue +22 -0
- package/components/docs/DocsPageContent.vue +31 -0
- package/components/docs/DocsToc.vue +74 -0
- package/components/globals/Icon.vue +24 -0
- package/{dist/runtime/app/components/prose/ProseHr.vue → components/globals/Logo.vue} +1 -1
- package/components/globals/NuxtImg.vue +45 -0
- package/components/globals/SocialIcons.vue +45 -0
- package/components/globals/ThemeSelect.vue +35 -0
- package/components/icons/IconAlgolia.vue +8 -0
- package/components/icons/IconArrowLeft.vue +10 -0
- package/components/icons/IconArrowRight.vue +10 -0
- package/components/icons/IconBadgeCheck.vue +14 -0
- package/components/icons/IconCheck.vue +10 -0
- package/components/icons/IconCheckCircle.vue +10 -0
- package/components/icons/IconChevronRight.vue +12 -0
- package/components/icons/IconClipboardCheck.vue +14 -0
- package/components/icons/IconClipboardCopy.vue +14 -0
- package/components/icons/IconCodeSandbox.vue +8 -0
- package/components/icons/IconCopy.vue +17 -0
- package/components/icons/IconDots.vue +10 -0
- package/components/icons/IconEdit.vue +18 -0
- package/components/icons/IconExclamationCircle.vue +12 -0
- package/components/icons/IconExclamationTriangle.vue +10 -0
- package/components/icons/IconExternalLink.vue +12 -0
- package/components/icons/IconGit.vue +7 -0
- package/components/icons/IconGitHub.vue +10 -0
- package/components/icons/IconHeart.vue +9 -0
- package/components/icons/IconInformationCircle.vue +10 -0
- package/components/icons/IconLighthouse.vue +83 -0
- package/components/icons/IconLine.vue +10 -0
- package/components/icons/IconMarkdown.vue +13 -0
- package/components/icons/IconMenu.vue +12 -0
- package/components/icons/IconMenuAlt.vue +10 -0
- package/components/icons/IconMinus.vue +10 -0
- package/components/icons/IconMoon.vue +10 -0
- package/components/icons/IconNuxt.vue +14 -0
- package/components/icons/IconNuxtContent.vue +20 -0
- package/components/icons/IconNuxtLabs.vue +21 -0
- package/components/icons/IconPlus.vue +10 -0
- package/components/icons/IconPuzzle.vue +8 -0
- package/components/icons/IconSSG.vue +7 -0
- package/components/icons/IconSearch.vue +12 -0
- package/components/icons/IconSun.vue +10 -0
- package/components/icons/IconTocBack.vue +21 -0
- package/components/icons/IconTocCurrent.vue +21 -0
- package/components/icons/IconTocNext.vue +8 -0
- package/components/icons/IconTranslate.vue +14 -0
- package/components/icons/IconTwitter.vue +8 -0
- package/components/icons/IconVite.vue +30 -0
- package/components/icons/IconVue.vue +6 -0
- package/components/icons/IconVueTelescope.vue +11 -0
- package/components/icons/IconWindi.vue +17 -0
- package/components/icons/IconX.vue +12 -0
- package/components/icons/IconXCircle.vue +10 -0
- package/components/icons/IconZap.vue +8 -0
- package/components/prose/ProseA.vue +66 -0
- package/components/prose/ProseBlockquote.vue +21 -0
- package/components/prose/ProseCode.vue +68 -0
- package/components/prose/ProseCodeInline.vue +38 -0
- package/components/prose/ProseEm.vue +11 -0
- package/components/prose/ProseH1.vue +22 -0
- package/components/prose/ProseH2.vue +22 -0
- package/components/prose/ProseH3.vue +24 -0
- package/components/prose/ProseH4.vue +24 -0
- package/components/prose/ProseHr.vue +13 -0
- package/components/prose/ProseImg.vue +30 -0
- package/components/prose/ProseLi.vue +31 -0
- package/components/prose/ProseOl.vue +16 -0
- package/components/prose/ProseP.vue +14 -0
- package/components/prose/ProseStrong.vue +14 -0
- package/components/prose/ProseTable.vue +13 -0
- package/{dist/runtime/app/components → components}/prose/ProseTbody.vue +0 -0
- package/components/prose/ProseTd.vue +11 -0
- package/components/prose/ProseTh.vue +11 -0
- package/components/prose/ProseThead.vue +11 -0
- package/components/prose/ProseTr.vue +11 -0
- package/components/prose/ProseUl.vue +15 -0
- package/composables/useContent.ts +156 -0
- package/composables/useMenu.ts +22 -0
- package/composables/useScrollToHeading.ts +35 -0
- package/composables/useScrollspy.ts +46 -0
- package/composables/useTheme.ts +12 -0
- package/layouts/default.vue +29 -0
- package/layouts/page.vue +11 -0
- package/nuxt.config.ts +151 -0
- package/package.json +46 -83
- package/pages/[...slug].vue +26 -0
- package/public/android-chrome-192x192.png +0 -0
- package/public/android-chrome-512x512.png +0 -0
- package/public/apple-touch-icon.png +0 -0
- package/public/favicon-16x16.png +0 -0
- package/public/favicon-32x32.png +0 -0
- package/public/favicon.ico +0 -0
- package/public/site.webmanifest +1 -0
- package/LICENSE +0 -21
- package/dist/index.cjs +0 -549
- package/dist/index.d.ts +0 -25
- package/dist/index.mjs +0 -523
- package/dist/runtime/app/components/DocusContent.vue +0 -215
- package/dist/runtime/app/components/DocusContent.vue.d.ts +0 -25
- package/dist/runtime/app/components/Error.vue +0 -19
- package/dist/runtime/app/components/Error.vue.d.ts +0 -9
- package/dist/runtime/app/components/Markdown.vue +0 -56
- package/dist/runtime/app/components/Markdown.vue.d.ts +0 -25
- package/dist/runtime/app/components/Page.vue +0 -29
- package/dist/runtime/app/components/Page.vue.d.ts +0 -2
- package/dist/runtime/app/components/Props.vue +0 -130
- package/dist/runtime/app/components/Props.vue.d.ts +0 -80
- package/dist/runtime/app/components/prose/ProseA.vue +0 -41
- package/dist/runtime/app/components/prose/ProseA.vue.d.ts +0 -23
- package/dist/runtime/app/components/prose/ProseBlockquote.vue +0 -5
- package/dist/runtime/app/components/prose/ProseCode.vue +0 -5
- package/dist/runtime/app/components/prose/ProseCodeInline.vue +0 -5
- package/dist/runtime/app/components/prose/ProseEm.vue +0 -5
- package/dist/runtime/app/components/prose/ProseH1.vue +0 -3
- package/dist/runtime/app/components/prose/ProseH2.vue +0 -3
- package/dist/runtime/app/components/prose/ProseH3.vue +0 -3
- package/dist/runtime/app/components/prose/ProseH4.vue +0 -3
- package/dist/runtime/app/components/prose/ProseH5.vue +0 -3
- package/dist/runtime/app/components/prose/ProseH6.vue +0 -3
- package/dist/runtime/app/components/prose/ProseImg.vue +0 -32
- package/dist/runtime/app/components/prose/ProseImg.vue.d.ts +0 -21
- package/dist/runtime/app/components/prose/ProseLi.vue +0 -3
- package/dist/runtime/app/components/prose/ProseParagraph.vue +0 -3
- package/dist/runtime/app/components/prose/ProseStrong.vue +0 -5
- package/dist/runtime/app/components/prose/ProseTable.vue +0 -5
- package/dist/runtime/app/components/prose/ProseTd.vue +0 -5
- package/dist/runtime/app/components/prose/ProseTh.vue +0 -5
- package/dist/runtime/app/components/prose/ProseThead.vue +0 -5
- package/dist/runtime/app/components/prose/ProseTr.vue +0 -5
- package/dist/runtime/app/components/prose/ProseUl.vue +0 -5
- package/dist/runtime/app/composables/helpers.d.ts +0 -4
- package/dist/runtime/app/composables/helpers.js +0 -66
- package/dist/runtime/app/composables/helpers.mjs +0 -40
- package/dist/runtime/app/composables/index.d.ts +0 -90
- package/dist/runtime/app/composables/index.js +0 -108
- package/dist/runtime/app/composables/index.mjs +0 -63
- package/dist/runtime/app/composables/navigation.d.ts +0 -37
- package/dist/runtime/app/composables/navigation.js +0 -227
- package/dist/runtime/app/composables/navigation.mjs +0 -148
- package/dist/runtime/app/composables/store.d.ts +0 -7
- package/dist/runtime/app/composables/store.js +0 -52
- package/dist/runtime/app/composables/store.mjs +0 -35
- package/dist/runtime/app/composables/style.d.ts +0 -11
- package/dist/runtime/app/composables/style.js +0 -117
- package/dist/runtime/app/composables/style.mjs +0 -71
- package/dist/runtime/app/composables/theme-colors.d.ts +0 -30
- package/dist/runtime/app/composables/theme-colors.js +0 -80
- package/dist/runtime/app/composables/theme-colors.mjs +0 -48
- package/dist/runtime/app/composables/websocket.d.ts +0 -3
- package/dist/runtime/app/composables/websocket.js +0 -79
- package/dist/runtime/app/composables/websocket.mjs +0 -63
- package/dist/runtime/app/layouts/default.vue +0 -5
- package/dist/runtime/app/layouts/error.vue +0 -33
- package/dist/runtime/app/layouts/error.vue.d.ts +0 -21
- package/dist/runtime/app/pages/_.vue +0 -222
- package/dist/runtime/app/pages/_.vue.d.ts +0 -2
- package/dist/runtime/context.d.ts +0 -1
- package/dist/runtime/context.js +0 -17
- package/dist/runtime/context.mjs +0 -5
- package/dist/runtime/database/Query.d.ts +0 -18
- package/dist/runtime/database/Query.js +0 -68
- package/dist/runtime/database/Query.mjs +0 -49
- package/dist/runtime/database/index.d.ts +0 -4
- package/dist/runtime/database/index.js +0 -45
- package/dist/runtime/database/index.mjs +0 -25
- package/dist/runtime/database/providers/local/Query.d.ts +0 -14
- package/dist/runtime/database/providers/local/Query.js +0 -85
- package/dist/runtime/database/providers/local/Query.mjs +0 -60
- package/dist/runtime/database/providers/local/index.d.ts +0 -3
- package/dist/runtime/database/providers/local/index.js +0 -63
- package/dist/runtime/database/providers/local/index.mjs +0 -39
- package/dist/runtime/database/providers/local/operations.d.ts +0 -2
- package/dist/runtime/database/providers/local/operations.js +0 -83
- package/dist/runtime/database/providers/local/operations.mjs +0 -53
- package/dist/runtime/database/providers/local/utils.d.ts +0 -8
- package/dist/runtime/database/providers/local/utils.js +0 -28
- package/dist/runtime/database/providers/local/utils.mjs +0 -17
- package/dist/runtime/index.d.ts +0 -3
- package/dist/runtime/index.js +0 -44
- package/dist/runtime/index.mjs +0 -3
- package/dist/runtime/navigation.d.ts +0 -4
- package/dist/runtime/navigation.js +0 -176
- package/dist/runtime/navigation.mjs +0 -137
- package/dist/runtime/server/api/get.d.ts +0 -10
- package/dist/runtime/server/api/get.js +0 -24
- package/dist/runtime/server/api/get.mjs +0 -13
- package/dist/runtime/server/api/list.d.ts +0 -9
- package/dist/runtime/server/api/list.js +0 -34
- package/dist/runtime/server/api/list.mjs +0 -18
- package/dist/runtime/server/api/navigation.d.ts +0 -7
- package/dist/runtime/server/api/navigation.js +0 -20
- package/dist/runtime/server/api/navigation.mjs +0 -10
- package/dist/runtime/server/api/preview.d.ts +0 -3
- package/dist/runtime/server/api/preview.js +0 -54
- package/dist/runtime/server/api/preview.mjs +0 -31
- package/dist/runtime/server/api/reload.d.ts +0 -6
- package/dist/runtime/server/api/reload.js +0 -27
- package/dist/runtime/server/api/reload.mjs +0 -11
- package/dist/runtime/server/api/search.d.ts +0 -6
- package/dist/runtime/server/api/search.js +0 -27
- package/dist/runtime/server/api/search.mjs +0 -13
- package/dist/runtime/server/content.d.ts +0 -46
- package/dist/runtime/server/content.js +0 -175
- package/dist/runtime/server/content.mjs +0 -114
- package/dist/runtime/server/socket.d.ts +0 -9
- package/dist/runtime/server/socket.js +0 -33
- package/dist/runtime/server/socket.mjs +0 -20
- package/dist/runtime/server/utils/cache.d.ts +0 -19
- package/dist/runtime/server/utils/cache.js +0 -110
- package/dist/runtime/server/utils/cache.mjs +0 -75
- package/dist/runtime/server/utils/index.d.ts +0 -4
- package/dist/runtime/server/utils/index.js +0 -18
- package/dist/runtime/server/utils/index.mjs +0 -8
- package/dist/runtime/transformers/index.d.ts +0 -1
- package/dist/runtime/transformers/index.js +0 -26
- package/dist/runtime/transformers/index.mjs +0 -11
- package/dist/runtime/transformers/json.d.ts +0 -3
- package/dist/runtime/transformers/json.js +0 -15
- package/dist/runtime/transformers/json.mjs +0 -5
- package/dist/runtime/transformers/markdown/index.d.ts +0 -8
- package/dist/runtime/transformers/markdown/index.js +0 -25
- package/dist/runtime/transformers/markdown/index.mjs +0 -16
- package/dist/runtime/transformers/utils/index.d.ts +0 -1
- package/dist/runtime/transformers/utils/index.js +0 -18
- package/dist/runtime/transformers/utils/index.mjs +0 -1
- package/dist/runtime/transformers/utils/path.d.ts +0 -26
- package/dist/runtime/transformers/utils/path.js +0 -88
- package/dist/runtime/transformers/utils/path.mjs +0 -56
- package/dist/runtime/utils/index.d.ts +0 -1
- package/dist/runtime/utils/index.js +0 -18
- package/dist/runtime/utils/index.mjs +0 -1
- package/dist/runtime/utils/log.d.ts +0 -1
- package/dist/runtime/utils/log.js +0 -14
- package/dist/runtime/utils/log.mjs +0 -2
- package/dist/runtime/utils/object.d.ts +0 -9
- package/dist/runtime/utils/object.js +0 -22
- package/dist/runtime/utils/object.mjs +0 -4
- package/dist/templates/content.mjs +0 -50
- package/dist/templates/docus.mjs +0 -13
- package/dist/templates/hot.mjs +0 -16
- package/dist/templates/i18n.mjs +0 -23
- package/dist/templates/options.mjs +0 -46
- package/shims.d.ts +0 -24
- package/types.d.ts +0 -397
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports._variants = void 0;
|
|
7
|
-
exports.getColors = getColors;
|
|
8
|
-
exports.hexValue = hexValue;
|
|
9
|
-
exports.parseColor = parseColor;
|
|
10
|
-
exports.shade = shade;
|
|
11
|
-
exports.tint = tint;
|
|
12
|
-
exports.withTint = exports.withShade = void 0;
|
|
13
|
-
|
|
14
|
-
function parseColor(color = "") {
|
|
15
|
-
if (typeof color !== "string") {
|
|
16
|
-
throw new TypeError("Color should be string!");
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const hexMatch = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(color);
|
|
20
|
-
|
|
21
|
-
if (hexMatch) {
|
|
22
|
-
return hexMatch.splice(1).map(c => parseInt(c, 16));
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const hexMatchShort = /^#?([a-f\d])([a-f\d])([a-f\d])$/i.exec(color);
|
|
26
|
-
|
|
27
|
-
if (hexMatchShort) {
|
|
28
|
-
return hexMatchShort.splice(1).map(c => parseInt(c + c, 16));
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
if (color.includes(",")) {
|
|
32
|
-
return color.split(",").map(p => parseInt(p));
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
throw new Error("Invalid color format! Use #ABC or #AABBCC or r,g,b");
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function hexValue(components) {
|
|
39
|
-
return "#" + components.map(c => `0${c.toString(16).toUpperCase()}`.slice(-2)).join("");
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function tint(components, intensity) {
|
|
43
|
-
return components.map(c => Math.round(c + (255 - c) * intensity));
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
function shade(components, intensity) {
|
|
47
|
-
return components.map(c => Math.round(c * intensity));
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
const withTint = intensity => hex => tint(hex, intensity);
|
|
51
|
-
|
|
52
|
-
exports.withTint = withTint;
|
|
53
|
-
|
|
54
|
-
const withShade = intensity => hex => shade(hex, intensity);
|
|
55
|
-
|
|
56
|
-
exports.withShade = withShade;
|
|
57
|
-
const _variants = {
|
|
58
|
-
50: withTint(0.95),
|
|
59
|
-
100: withTint(0.9),
|
|
60
|
-
200: withTint(0.75),
|
|
61
|
-
300: withTint(0.6),
|
|
62
|
-
400: withTint(0.3),
|
|
63
|
-
500: c => c,
|
|
64
|
-
600: withShade(0.9),
|
|
65
|
-
700: withShade(0.6),
|
|
66
|
-
800: withShade(0.45),
|
|
67
|
-
900: withShade(0.3)
|
|
68
|
-
};
|
|
69
|
-
exports._variants = _variants;
|
|
70
|
-
|
|
71
|
-
function getColors(color, variants = _variants) {
|
|
72
|
-
const colors = {};
|
|
73
|
-
const components = parseColor(color);
|
|
74
|
-
|
|
75
|
-
for (const [name, fn] of Object.entries(variants)) {
|
|
76
|
-
colors[name] = hexValue(fn(components));
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
return colors;
|
|
80
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
export function parseColor(color = "") {
|
|
2
|
-
if (typeof color !== "string") {
|
|
3
|
-
throw new TypeError("Color should be string!");
|
|
4
|
-
}
|
|
5
|
-
const hexMatch = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(color);
|
|
6
|
-
if (hexMatch) {
|
|
7
|
-
return hexMatch.splice(1).map((c) => parseInt(c, 16));
|
|
8
|
-
}
|
|
9
|
-
const hexMatchShort = /^#?([a-f\d])([a-f\d])([a-f\d])$/i.exec(color);
|
|
10
|
-
if (hexMatchShort) {
|
|
11
|
-
return hexMatchShort.splice(1).map((c) => parseInt(c + c, 16));
|
|
12
|
-
}
|
|
13
|
-
if (color.includes(",")) {
|
|
14
|
-
return color.split(",").map((p) => parseInt(p));
|
|
15
|
-
}
|
|
16
|
-
throw new Error("Invalid color format! Use #ABC or #AABBCC or r,g,b");
|
|
17
|
-
}
|
|
18
|
-
export function hexValue(components) {
|
|
19
|
-
return "#" + components.map((c) => `0${c.toString(16).toUpperCase()}`.slice(-2)).join("");
|
|
20
|
-
}
|
|
21
|
-
export function tint(components, intensity) {
|
|
22
|
-
return components.map((c) => Math.round(c + (255 - c) * intensity));
|
|
23
|
-
}
|
|
24
|
-
export function shade(components, intensity) {
|
|
25
|
-
return components.map((c) => Math.round(c * intensity));
|
|
26
|
-
}
|
|
27
|
-
export const withTint = (intensity) => (hex) => tint(hex, intensity);
|
|
28
|
-
export const withShade = (intensity) => (hex) => shade(hex, intensity);
|
|
29
|
-
export const _variants = {
|
|
30
|
-
50: withTint(0.95),
|
|
31
|
-
100: withTint(0.9),
|
|
32
|
-
200: withTint(0.75),
|
|
33
|
-
300: withTint(0.6),
|
|
34
|
-
400: withTint(0.3),
|
|
35
|
-
500: (c) => c,
|
|
36
|
-
600: withShade(0.9),
|
|
37
|
-
700: withShade(0.6),
|
|
38
|
-
800: withShade(0.45),
|
|
39
|
-
900: withShade(0.3)
|
|
40
|
-
};
|
|
41
|
-
export function getColors(color, variants = _variants) {
|
|
42
|
-
const colors = {};
|
|
43
|
-
const components = parseColor(color);
|
|
44
|
-
for (const [name, fn] of Object.entries(variants)) {
|
|
45
|
-
colors[name] = hexValue(fn(components));
|
|
46
|
-
}
|
|
47
|
-
return colors;
|
|
48
|
-
}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.useWebSocket = useWebSocket;
|
|
7
|
-
const logger = {
|
|
8
|
-
log: (...args) => console.log("[Docus]", ...args),
|
|
9
|
-
warn: (...args) => console.warn("[Docus]", ...args)
|
|
10
|
-
};
|
|
11
|
-
let $nuxt;
|
|
12
|
-
let ws = null;
|
|
13
|
-
|
|
14
|
-
function useWebSocket(base) {
|
|
15
|
-
if (!window.WebSocket) {
|
|
16
|
-
logger.warn("Could not activate hot reload, your browser does not support WebSocket.");
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
window.onNuxtReady(_nuxt => {
|
|
21
|
-
$nuxt = _nuxt;
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
const onMessage = async message => {
|
|
25
|
-
try {
|
|
26
|
-
const data = JSON.parse(message.data);
|
|
27
|
-
if (!data) return;
|
|
28
|
-
$nuxt.$emit("content:update", data);
|
|
29
|
-
|
|
30
|
-
if ($nuxt.$store && $nuxt.$store._actions.nuxtServerInit) {
|
|
31
|
-
await $nuxt.$store.dispatch("nuxtServerInit", $nuxt.$options.context);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
$nuxt.refresh();
|
|
35
|
-
} catch (err) {}
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
const onOpen = () => logger.log("WS connected!");
|
|
39
|
-
|
|
40
|
-
const onError = e => {
|
|
41
|
-
switch (e.code) {
|
|
42
|
-
case "ECONNREFUSED":
|
|
43
|
-
connect(true);
|
|
44
|
-
break;
|
|
45
|
-
|
|
46
|
-
default:
|
|
47
|
-
logger.warn("WS Error:", e);
|
|
48
|
-
break;
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
const onClose = e => {
|
|
53
|
-
if (e.code === 1e3 || e.code === 1005) {
|
|
54
|
-
logger.log("WS closed!");
|
|
55
|
-
} else {
|
|
56
|
-
connect(true);
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
const connect = (retry = false) => {
|
|
61
|
-
if (retry) {
|
|
62
|
-
logger.log("WS reconnecting..");
|
|
63
|
-
setTimeout(connect, 1e3);
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
const wsURL = `${base}/ws`;
|
|
68
|
-
logger.log(`WS connect to ${wsURL}`);
|
|
69
|
-
ws = new WebSocket(wsURL);
|
|
70
|
-
ws.onopen = onOpen;
|
|
71
|
-
ws.onmessage = onMessage;
|
|
72
|
-
ws.onerror = onError;
|
|
73
|
-
ws.onclose = onClose;
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
return {
|
|
77
|
-
connect
|
|
78
|
-
};
|
|
79
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
const logger = {
|
|
2
|
-
log: (...args) => console.log("[Docus]", ...args),
|
|
3
|
-
warn: (...args) => console.warn("[Docus]", ...args)
|
|
4
|
-
};
|
|
5
|
-
let $nuxt;
|
|
6
|
-
let ws = null;
|
|
7
|
-
export function useWebSocket(base) {
|
|
8
|
-
if (!window.WebSocket) {
|
|
9
|
-
logger.warn("Could not activate hot reload, your browser does not support WebSocket.");
|
|
10
|
-
return;
|
|
11
|
-
}
|
|
12
|
-
window.onNuxtReady((_nuxt) => {
|
|
13
|
-
$nuxt = _nuxt;
|
|
14
|
-
});
|
|
15
|
-
const onMessage = async (message) => {
|
|
16
|
-
try {
|
|
17
|
-
const data = JSON.parse(message.data);
|
|
18
|
-
if (!data)
|
|
19
|
-
return;
|
|
20
|
-
$nuxt.$emit("content:update", data);
|
|
21
|
-
if ($nuxt.$store && $nuxt.$store._actions.nuxtServerInit) {
|
|
22
|
-
await $nuxt.$store.dispatch("nuxtServerInit", $nuxt.$options.context);
|
|
23
|
-
}
|
|
24
|
-
$nuxt.refresh();
|
|
25
|
-
} catch (err) {
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
const onOpen = () => logger.log("WS connected!");
|
|
29
|
-
const onError = (e) => {
|
|
30
|
-
switch (e.code) {
|
|
31
|
-
case "ECONNREFUSED":
|
|
32
|
-
connect(true);
|
|
33
|
-
break;
|
|
34
|
-
default:
|
|
35
|
-
logger.warn("WS Error:", e);
|
|
36
|
-
break;
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
const onClose = (e) => {
|
|
40
|
-
if (e.code === 1e3 || e.code === 1005) {
|
|
41
|
-
logger.log("WS closed!");
|
|
42
|
-
} else {
|
|
43
|
-
connect(true);
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
const connect = (retry = false) => {
|
|
47
|
-
if (retry) {
|
|
48
|
-
logger.log("WS reconnecting..");
|
|
49
|
-
setTimeout(connect, 1e3);
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
const wsURL = `${base}/ws`;
|
|
53
|
-
logger.log(`WS connect to ${wsURL}`);
|
|
54
|
-
ws = new WebSocket(wsURL);
|
|
55
|
-
ws.onopen = onOpen;
|
|
56
|
-
ws.onmessage = onMessage;
|
|
57
|
-
ws.onerror = onError;
|
|
58
|
-
ws.onclose = onClose;
|
|
59
|
-
};
|
|
60
|
-
return {
|
|
61
|
-
connect
|
|
62
|
-
};
|
|
63
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<Component :is="template" :error="error" />
|
|
3
|
-
</template>
|
|
4
|
-
|
|
5
|
-
<script>
|
|
6
|
-
"use strict";
|
|
7
|
-
|
|
8
|
-
Object.defineProperty(exports, "__esModule", {
|
|
9
|
-
value: true
|
|
10
|
-
});
|
|
11
|
-
module.exports = void 0;
|
|
12
|
-
var _default = {
|
|
13
|
-
props: {
|
|
14
|
-
error: {
|
|
15
|
-
type: Object,
|
|
16
|
-
required: true
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
|
|
20
|
-
data() {
|
|
21
|
-
return {
|
|
22
|
-
template: 'Error'
|
|
23
|
-
};
|
|
24
|
-
},
|
|
25
|
-
|
|
26
|
-
head() {
|
|
27
|
-
return {
|
|
28
|
-
title: this.error.message
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
};
|
|
33
|
-
module.exports = _default;</script>
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
declare namespace _default {
|
|
2
|
-
namespace props {
|
|
3
|
-
namespace error {
|
|
4
|
-
const type: ObjectConstructor;
|
|
5
|
-
const required: boolean;
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
function data(): {
|
|
9
|
-
template: string;
|
|
10
|
-
};
|
|
11
|
-
function data(): {
|
|
12
|
-
template: string;
|
|
13
|
-
};
|
|
14
|
-
function head(): {
|
|
15
|
-
title: any;
|
|
16
|
-
};
|
|
17
|
-
function head(): {
|
|
18
|
-
title: any;
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
export default _default;
|
|
@@ -1,222 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
"use strict";
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
module.exports = void 0;
|
|
8
|
-
|
|
9
|
-
var _vue = _interopRequireDefault(require("vue"));
|
|
10
|
-
|
|
11
|
-
var _ufo = require("ufo");
|
|
12
|
-
|
|
13
|
-
var _app = require("#app");
|
|
14
|
-
|
|
15
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
-
|
|
17
|
-
var _default = (0, _app.defineComponent)({
|
|
18
|
-
name: "PageSlug",
|
|
19
|
-
|
|
20
|
-
middleware({
|
|
21
|
-
app,
|
|
22
|
-
params,
|
|
23
|
-
redirect
|
|
24
|
-
}) {
|
|
25
|
-
if (params.pathMatch === "index") redirect(app.localePath("/"));
|
|
26
|
-
},
|
|
27
|
-
|
|
28
|
-
async asyncData(context) {
|
|
29
|
-
const {
|
|
30
|
-
app: {
|
|
31
|
-
i18n,
|
|
32
|
-
localePath
|
|
33
|
-
},
|
|
34
|
-
route,
|
|
35
|
-
params,
|
|
36
|
-
error,
|
|
37
|
-
redirect,
|
|
38
|
-
$docus
|
|
39
|
-
} = context;
|
|
40
|
-
const language = i18n.locale;
|
|
41
|
-
const {
|
|
42
|
-
config,
|
|
43
|
-
theme,
|
|
44
|
-
navigation,
|
|
45
|
-
layout,
|
|
46
|
-
page: currentPage
|
|
47
|
-
} = $docus;
|
|
48
|
-
const themeLayout = theme.value?.layout || {};
|
|
49
|
-
let templateOptions = { ...themeLayout,
|
|
50
|
-
...layout.value
|
|
51
|
-
};
|
|
52
|
-
const to = (0, _ufo.withoutTrailingSlash)(`/${params.pathMatch || ""}`) || "/";
|
|
53
|
-
const draft = false;
|
|
54
|
-
const [match] = await $docus.content.search({
|
|
55
|
-
deep: true
|
|
56
|
-
}).where({
|
|
57
|
-
language,
|
|
58
|
-
to,
|
|
59
|
-
draft,
|
|
60
|
-
page: {
|
|
61
|
-
$ne: false
|
|
62
|
-
}
|
|
63
|
-
}).fetch();
|
|
64
|
-
if (!match) return error({
|
|
65
|
-
statusCode: 404,
|
|
66
|
-
message: "404 - Page not found"
|
|
67
|
-
});
|
|
68
|
-
const page = await $docus.content.get(match.id);
|
|
69
|
-
page.template = navigation.getPageTemplate(page);
|
|
70
|
-
|
|
71
|
-
let component = _vue.default.component(page.template);
|
|
72
|
-
|
|
73
|
-
if (component) {
|
|
74
|
-
try {
|
|
75
|
-
if (typeof component === "function" && !component.options) {
|
|
76
|
-
component = await component();
|
|
77
|
-
if (!component.options) component = _vue.default.extend(component);
|
|
78
|
-
}
|
|
79
|
-
} catch (e) {
|
|
80
|
-
console.error(e);
|
|
81
|
-
component = new component({
|
|
82
|
-
props: {
|
|
83
|
-
page
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
const componentTemplateOptions = component.options.templateOptions || component.extendOptions.templateOptions || component.sealedOptions.templateOptions || {};
|
|
89
|
-
if (templateOptions) templateOptions = { ...templateOptions,
|
|
90
|
-
...componentTemplateOptions
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
if (match.layout) templateOptions = { ...templateOptions,
|
|
95
|
-
...match.layout
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
if (process.server) {
|
|
99
|
-
layout.value = templateOptions;
|
|
100
|
-
currentPage.value = page;
|
|
101
|
-
navigation.currentPath = `/${route.params.pathMatch}`;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
if (page.navigation && page.navigation.redirect) redirect(localePath(page.navigation.redirect));
|
|
105
|
-
return {
|
|
106
|
-
page,
|
|
107
|
-
templateOptions,
|
|
108
|
-
preview: config.value.preview
|
|
109
|
-
};
|
|
110
|
-
},
|
|
111
|
-
|
|
112
|
-
head() {
|
|
113
|
-
const head = {
|
|
114
|
-
title: this.page.title,
|
|
115
|
-
meta: [],
|
|
116
|
-
...(this.page.head || {})
|
|
117
|
-
};
|
|
118
|
-
this.mergeMeta(head.meta, this.pageMeta);
|
|
119
|
-
return head;
|
|
120
|
-
},
|
|
121
|
-
|
|
122
|
-
computed: {
|
|
123
|
-
currentPath() {
|
|
124
|
-
return this.$docus.navigation.currentPath.value;
|
|
125
|
-
},
|
|
126
|
-
|
|
127
|
-
pageMeta() {
|
|
128
|
-
const config = this.$docus.config.value;
|
|
129
|
-
return [{
|
|
130
|
-
hid: "og:title",
|
|
131
|
-
property: "og:title",
|
|
132
|
-
content: this.page.title
|
|
133
|
-
}, {
|
|
134
|
-
hid: "twitter:title",
|
|
135
|
-
name: "twitter:title",
|
|
136
|
-
content: this.page.title
|
|
137
|
-
}, {
|
|
138
|
-
hid: "apple-mobile-web-app-title",
|
|
139
|
-
name: "apple-mobile-web-app-title",
|
|
140
|
-
content: config.title || ""
|
|
141
|
-
}, ...(this.page.description ? [{
|
|
142
|
-
hid: "description",
|
|
143
|
-
name: "description",
|
|
144
|
-
content: this.page.description
|
|
145
|
-
}, {
|
|
146
|
-
hid: "og:description",
|
|
147
|
-
property: "og:description",
|
|
148
|
-
content: this.page.description
|
|
149
|
-
}, {
|
|
150
|
-
hid: "twitter:description",
|
|
151
|
-
name: "twitter:description",
|
|
152
|
-
content: this.page.description
|
|
153
|
-
}] : [])];
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
},
|
|
157
|
-
watch: {
|
|
158
|
-
currentPath: {
|
|
159
|
-
handler() {
|
|
160
|
-
this.$docus.navigation.updateCurrentNav();
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
}
|
|
164
|
-
},
|
|
165
|
-
|
|
166
|
-
created() {
|
|
167
|
-
if (process.client) {
|
|
168
|
-
const {
|
|
169
|
-
layout,
|
|
170
|
-
page,
|
|
171
|
-
navigation
|
|
172
|
-
} = this.$docus;
|
|
173
|
-
layout.value = this.templateOptions;
|
|
174
|
-
page.value = this.page;
|
|
175
|
-
navigation.currentPath.value = `/${this.$route.params.pathMatch}`;
|
|
176
|
-
}
|
|
177
|
-
},
|
|
178
|
-
|
|
179
|
-
mounted() {
|
|
180
|
-
window.$nuxt.$on("docus:content:preview", this.updatePage);
|
|
181
|
-
if (this.page?.version) localStorage.setItem(`page-${this.page.slug}-version`, this.page.version);
|
|
182
|
-
},
|
|
183
|
-
|
|
184
|
-
unmounted() {
|
|
185
|
-
window.$nuxt.$off("docus:content:preview", this.updatePage);
|
|
186
|
-
},
|
|
187
|
-
|
|
188
|
-
methods: {
|
|
189
|
-
async updatePage({
|
|
190
|
-
key
|
|
191
|
-
}) {
|
|
192
|
-
if (key === this.page?.key) {
|
|
193
|
-
const $content = this.$docus.content;
|
|
194
|
-
const updatedPage = await $content.get(this.page.key);
|
|
195
|
-
Object.assign(this.page, updatedPage);
|
|
196
|
-
}
|
|
197
|
-
},
|
|
198
|
-
|
|
199
|
-
mergeMeta(to, from) {
|
|
200
|
-
from.forEach(newMeta => {
|
|
201
|
-
const key = newMeta.hid || newMeta.name || newMeta.property;
|
|
202
|
-
const index = to.findIndex(meta => meta.hid === key || meta.name === key || meta.property === key);
|
|
203
|
-
|
|
204
|
-
if (index < 0) {
|
|
205
|
-
to.push(newMeta);
|
|
206
|
-
}
|
|
207
|
-
});
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
},
|
|
211
|
-
|
|
212
|
-
render(h) {
|
|
213
|
-
return h(this.page.template, {
|
|
214
|
-
props: {
|
|
215
|
-
page: this.page
|
|
216
|
-
}
|
|
217
|
-
});
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
});
|
|
221
|
-
|
|
222
|
-
module.exports = _default;</script>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const useDocusContext: () => DocusConfig;
|
package/dist/runtime/context.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.useDocusContext = void 0;
|
|
7
|
-
|
|
8
|
-
var _unctx = require("unctx");
|
|
9
|
-
|
|
10
|
-
var _options = _interopRequireDefault(require("#build/docus/options.mjs"));
|
|
11
|
-
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
14
|
-
const ctx = (0, _unctx.getContext)("docus_context");
|
|
15
|
-
ctx.set(_options.default, true);
|
|
16
|
-
const useDocusContext = ctx.use;
|
|
17
|
-
exports.useDocusContext = useDocusContext;
|
package/dist/runtime/context.mjs
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { QueryBuilder, QueryBuilderParams } from 'types';
|
|
2
|
-
/**
|
|
3
|
-
* Abstract query builder class, to be implemented by any provider.
|
|
4
|
-
*/
|
|
5
|
-
export declare abstract class BaseQueryBuilder<T> implements QueryBuilder<T> {
|
|
6
|
-
protected params: QueryBuilderParams;
|
|
7
|
-
only(keys: string | string[]): this;
|
|
8
|
-
without(keys: string | string[]): this;
|
|
9
|
-
sortBy(field: string, direction: 'asc' | 'desc'): this;
|
|
10
|
-
where(query: any): this;
|
|
11
|
-
surround(slugOrTo: string, options: {
|
|
12
|
-
before: number;
|
|
13
|
-
after: number;
|
|
14
|
-
}): this;
|
|
15
|
-
limit(count: number | string): this;
|
|
16
|
-
skip(count: number | string): this;
|
|
17
|
-
abstract fetch(params?: any): Promise<T | T[]>;
|
|
18
|
-
}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.BaseQueryBuilder = void 0;
|
|
7
|
-
|
|
8
|
-
class BaseQueryBuilder {
|
|
9
|
-
constructor() {
|
|
10
|
-
this.params = {
|
|
11
|
-
skip: 0,
|
|
12
|
-
limit: 0,
|
|
13
|
-
only: [],
|
|
14
|
-
without: [],
|
|
15
|
-
sortBy: [],
|
|
16
|
-
where: {}
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
only(keys) {
|
|
21
|
-
this.params.only = Array.isArray(keys) ? keys : [keys];
|
|
22
|
-
return this;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
without(keys) {
|
|
26
|
-
this.params.without = Array.isArray(keys) ? keys : [keys];
|
|
27
|
-
return this;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
sortBy(field, direction) {
|
|
31
|
-
this.params.sortBy.push([field, direction]);
|
|
32
|
-
return this;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
where(query) {
|
|
36
|
-
this.params.where = query;
|
|
37
|
-
return this;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
surround(slugOrTo, options) {
|
|
41
|
-
this.params.surround = {
|
|
42
|
-
slugOrTo,
|
|
43
|
-
options
|
|
44
|
-
};
|
|
45
|
-
return this;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
limit(count) {
|
|
49
|
-
if (typeof count === "string") {
|
|
50
|
-
count = parseInt(count);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
this.params.limit = count;
|
|
54
|
-
return this;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
skip(count) {
|
|
58
|
-
if (typeof count === "string") {
|
|
59
|
-
count = parseInt(count);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
this.params.skip = count;
|
|
63
|
-
return this;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
exports.BaseQueryBuilder = BaseQueryBuilder;
|