docus 2.1.0 → 3.0.0-beta.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.
- package/README.md +6 -4
- package/package.json +39 -83
- package/theme/app/router.options.ts +18 -0
- package/theme/assets/css/fonts.css +84 -0
- package/theme/assets/css/main.css +104 -0
- package/theme/components/app/Container.vue +25 -0
- package/theme/components/app/Footer.vue +40 -0
- package/theme/components/app/MobileNav.vue +85 -0
- package/theme/components/app/Navbar.vue +37 -0
- package/theme/components/app/NavbarLogo.vue +33 -0
- package/theme/components/app/Page.vue +7 -0
- package/theme/components/app/PoweredByDocus.vue +11 -0
- package/theme/components/content/Alert.vue +124 -0
- package/theme/components/content/BlockHero.vue +54 -0
- package/theme/components/content/ButtonLink.vue +45 -0
- package/theme/components/content/Card.vue +46 -0
- package/theme/components/content/CardGrid.vue +23 -0
- package/theme/components/content/CodeBlock.vue +47 -0
- package/theme/components/content/CodeGroup.vue +135 -0
- package/theme/components/content/CopyButton.vue +49 -0
- package/{dist/runtime/app/components/prose/ProseOl.vue → theme/components/content/List.vue} +2 -2
- package/theme/components/content/NeedContribution.vue +23 -0
- package/theme/components/content/ReadMore.vue +25 -0
- package/theme/components/content/Sandbox.vue +102 -0
- package/theme/components/content/TabsHeader.vue +44 -0
- package/theme/components/content/Terminal.vue +64 -0
- package/theme/components/content/VideoPlayer.vue +115 -0
- package/theme/components/dev/Debug.vue +65 -0
- package/theme/components/docs/DocsAside.vue +21 -0
- package/theme/components/docs/DocsAsideTree.vue +104 -0
- package/theme/components/docs/DocsHero.vue +39 -0
- package/theme/components/docs/DocsPage.vue +21 -0
- package/theme/components/docs/DocsPageContent.vue +32 -0
- package/theme/components/docs/DocsToc.vue +77 -0
- package/theme/components/globals/Icon.vue +24 -0
- package/{dist/runtime/app/components/prose/ProseHr.vue → theme/components/globals/Logo.vue} +1 -1
- package/theme/components/globals/NuxtImg.vue +45 -0
- package/theme/components/globals/SocialIcons.vue +45 -0
- package/theme/components/globals/ThemeSelect.vue +35 -0
- package/theme/components/icons/IconAlgolia.vue +8 -0
- package/theme/components/icons/IconArrowLeft.vue +10 -0
- package/theme/components/icons/IconArrowRight.vue +10 -0
- package/theme/components/icons/IconBadgeCheck.vue +14 -0
- package/theme/components/icons/IconCheck.vue +10 -0
- package/theme/components/icons/IconCheckCircle.vue +10 -0
- package/theme/components/icons/IconChevronRight.vue +12 -0
- package/theme/components/icons/IconClipboardCheck.vue +14 -0
- package/theme/components/icons/IconClipboardCopy.vue +14 -0
- package/theme/components/icons/IconCodeSandbox.vue +8 -0
- package/theme/components/icons/IconCopy.vue +17 -0
- package/theme/components/icons/IconDots.vue +10 -0
- package/theme/components/icons/IconEdit.vue +18 -0
- package/theme/components/icons/IconExclamationCircle.vue +12 -0
- package/theme/components/icons/IconExclamationTriangle.vue +10 -0
- package/theme/components/icons/IconExternalLink.vue +12 -0
- package/theme/components/icons/IconGit.vue +7 -0
- package/theme/components/icons/IconGitHub.vue +10 -0
- package/theme/components/icons/IconHeart.vue +9 -0
- package/theme/components/icons/IconInformationCircle.vue +10 -0
- package/theme/components/icons/IconLighthouse.vue +83 -0
- package/theme/components/icons/IconLine.vue +10 -0
- package/theme/components/icons/IconMarkdown.vue +13 -0
- package/theme/components/icons/IconMenu.vue +12 -0
- package/theme/components/icons/IconMenuAlt.vue +10 -0
- package/theme/components/icons/IconMinus.vue +10 -0
- package/theme/components/icons/IconMoon.vue +10 -0
- package/theme/components/icons/IconNuxt.vue +14 -0
- package/theme/components/icons/IconNuxtContent.vue +20 -0
- package/theme/components/icons/IconNuxtLabs.vue +21 -0
- package/theme/components/icons/IconPlus.vue +10 -0
- package/theme/components/icons/IconPuzzle.vue +8 -0
- package/theme/components/icons/IconSSG.vue +7 -0
- package/theme/components/icons/IconSearch.vue +12 -0
- package/theme/components/icons/IconSun.vue +10 -0
- package/theme/components/icons/IconTailwind.vue +3 -0
- package/theme/components/icons/IconTocBack.vue +21 -0
- package/theme/components/icons/IconTocCurrent.vue +21 -0
- package/theme/components/icons/IconTocNext.vue +8 -0
- package/theme/components/icons/IconTranslate.vue +14 -0
- package/theme/components/icons/IconTwitter.vue +8 -0
- package/theme/components/icons/IconVite.vue +30 -0
- package/theme/components/icons/IconVue.vue +6 -0
- package/theme/components/icons/IconVueTelescope.vue +11 -0
- package/theme/components/icons/IconWindi.vue +17 -0
- package/theme/components/icons/IconX.vue +12 -0
- package/theme/components/icons/IconXCircle.vue +10 -0
- package/theme/components/icons/IconZap.vue +8 -0
- package/theme/components/prose/ProseA.vue +66 -0
- package/theme/components/prose/ProseBlockquote.vue +21 -0
- package/theme/components/prose/ProseCode.vue +67 -0
- package/theme/components/prose/ProseCodeInline.vue +38 -0
- package/theme/components/prose/ProseEm.vue +11 -0
- package/theme/components/prose/ProseH1.vue +22 -0
- package/theme/components/prose/ProseH2.vue +22 -0
- package/theme/components/prose/ProseH3.vue +24 -0
- package/theme/components/prose/ProseH4.vue +24 -0
- package/theme/components/prose/ProseHr.vue +13 -0
- package/theme/components/prose/ProseImg.vue +30 -0
- package/theme/components/prose/ProseLi.vue +31 -0
- package/theme/components/prose/ProseOl.vue +16 -0
- package/theme/components/prose/ProseP.vue +14 -0
- package/theme/components/prose/ProseStrong.vue +14 -0
- package/theme/components/prose/ProseTable.vue +13 -0
- package/{dist/runtime/app → theme}/components/prose/ProseTbody.vue +0 -0
- package/theme/components/prose/ProseTd.vue +11 -0
- package/theme/components/prose/ProseTh.vue +11 -0
- package/theme/components/prose/ProseThead.vue +11 -0
- package/theme/components/prose/ProseTr.vue +11 -0
- package/theme/components/prose/ProseUl.vue +15 -0
- package/theme/composables/useDocus.ts +43 -0
- package/theme/composables/useMenu.ts +7 -0
- package/theme/composables/useScrollToHeading.ts +35 -0
- package/theme/composables/useScrollspy.ts +46 -0
- package/theme/composables/useUserAgent.ts +7 -0
- package/theme/composables/utils.ts +4 -0
- package/theme/layouts/default.vue +29 -0
- package/theme/layouts/page.vue +19 -0
- package/theme/middleware/components.ts +26 -0
- package/theme/middleware/navigation.global.ts +12 -0
- package/theme/middleware/page.ts +8 -0
- package/theme/middleware/theme.global.ts +12 -0
- package/theme/nuxt.config.ts +171 -0
- package/theme/pages/[...slug].vue +64 -0
- package/theme/plugins/menu.ts +67 -0
- package/theme/plugins/user-agent.ts +27 -0
- package/theme/utils/components.ts +25 -0
- package/theme/utils/navigation.ts +49 -0
- package/theme/utils/plugin.ts +21 -0
- package/theme/utils/queries.ts +68 -0
- package/theme/utils/state.ts +33 -0
- package/theme/utils/theme.ts +66 -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,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
module.exports = transformJSON;
|
|
7
|
-
|
|
8
|
-
function transformJSON(_id, input) {
|
|
9
|
-
if (typeof input === "string") return {
|
|
10
|
-
body: JSON.parse(input)
|
|
11
|
-
};
|
|
12
|
-
return {
|
|
13
|
-
body: input
|
|
14
|
-
};
|
|
15
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
module.exports = transformMarkdown;
|
|
7
|
-
|
|
8
|
-
var _mdc = require("@docus/mdc");
|
|
9
|
-
|
|
10
|
-
var _context = require("../../context");
|
|
11
|
-
|
|
12
|
-
var _utils = require("../utils");
|
|
13
|
-
|
|
14
|
-
async function transformMarkdown(id, input) {
|
|
15
|
-
const context = (0, _context.useDocusContext)();
|
|
16
|
-
const result = await (0, _mdc.parse)(input, context.transformers.markdown);
|
|
17
|
-
const pathMeta = (0, _utils.getPathMeta)(id, {
|
|
18
|
-
locales: context.locales.codes,
|
|
19
|
-
defaultLocale: context.locales.defaultLocale
|
|
20
|
-
});
|
|
21
|
-
result.meta = { ...pathMeta,
|
|
22
|
-
...result.meta
|
|
23
|
-
};
|
|
24
|
-
return result;
|
|
25
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { parse } from "@docus/mdc";
|
|
2
|
-
import { useDocusContext } from "../../context.mjs";
|
|
3
|
-
import { getPathMeta } from "../utils/index.mjs";
|
|
4
|
-
export default async function transformMarkdown(id, input) {
|
|
5
|
-
const context = useDocusContext();
|
|
6
|
-
const result = await parse(input, context.transformers.markdown);
|
|
7
|
-
const pathMeta = getPathMeta(id, {
|
|
8
|
-
locales: context.locales.codes,
|
|
9
|
-
defaultLocale: context.locales.defaultLocale
|
|
10
|
-
});
|
|
11
|
-
result.meta = {
|
|
12
|
-
...pathMeta,
|
|
13
|
-
...result.meta
|
|
14
|
-
};
|
|
15
|
-
return result;
|
|
16
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './path';
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
var _path = require("./path");
|
|
8
|
-
|
|
9
|
-
Object.keys(_path).forEach(function (key) {
|
|
10
|
-
if (key === "default" || key === "__esModule") return;
|
|
11
|
-
if (key in exports && exports[key] === _path[key]) return;
|
|
12
|
-
Object.defineProperty(exports, key, {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return _path[key];
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./path.mjs";
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
export declare function generatePosition(path: string): string;
|
|
2
|
-
/**
|
|
3
|
-
* Clean up special keywords from path part
|
|
4
|
-
*/
|
|
5
|
-
export declare function generateSlug(name: string): string;
|
|
6
|
-
export declare function generateTitleFromSlug(slug: string): string;
|
|
7
|
-
export declare function generateTo(path: string): string;
|
|
8
|
-
export declare function isDraft(path: string): boolean;
|
|
9
|
-
/**
|
|
10
|
-
* Files or directories that starts with underscore `_` will mark as hidden
|
|
11
|
-
* @param path content path
|
|
12
|
-
* @returns true if the is part in the path that starts with `_`
|
|
13
|
-
*/
|
|
14
|
-
export declare function isHidden(path: string): boolean;
|
|
15
|
-
export declare function getPathMeta(id: string, { locales, defaultLocale }?: {
|
|
16
|
-
locales?: string[];
|
|
17
|
-
defaultLocale?: string;
|
|
18
|
-
}): {
|
|
19
|
-
slug: string;
|
|
20
|
-
title: string;
|
|
21
|
-
position: string;
|
|
22
|
-
to: string;
|
|
23
|
-
draft: boolean;
|
|
24
|
-
page: boolean;
|
|
25
|
-
language: string;
|
|
26
|
-
};
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.generatePosition = generatePosition;
|
|
7
|
-
exports.generateSlug = generateSlug;
|
|
8
|
-
exports.generateTitleFromSlug = generateTitleFromSlug;
|
|
9
|
-
exports.generateTo = generateTo;
|
|
10
|
-
exports.getPathMeta = getPathMeta;
|
|
11
|
-
exports.isDraft = isDraft;
|
|
12
|
-
exports.isHidden = isHidden;
|
|
13
|
-
|
|
14
|
-
var _scule = require("scule");
|
|
15
|
-
|
|
16
|
-
var _ufo = require("ufo");
|
|
17
|
-
|
|
18
|
-
const SEMVER_REGEX = /^(\d+)(\.\d+)*(\.x)?$/;
|
|
19
|
-
|
|
20
|
-
function generatePosition(path) {
|
|
21
|
-
const position = path.split(/[/:]/).filter(Boolean).map(part => {
|
|
22
|
-
const match = part.match(/^(\d+)\./);
|
|
23
|
-
|
|
24
|
-
if (match) {
|
|
25
|
-
return padLeft(match[1], 4);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
return "9999";
|
|
29
|
-
}).join("");
|
|
30
|
-
return padRight(position, 12);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
function generateSlug(name) {
|
|
34
|
-
if (SEMVER_REGEX.test(name)) {
|
|
35
|
-
return name;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
return name.replace(/^_/, "").replace(/(\d+\.)?(.*)/, "$2").replace(/^index/, "").replace(/\.draft/, "");
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function generateTitleFromSlug(slug) {
|
|
42
|
-
return slug.split(/[\s-]/g).map(_scule.pascalCase).join(" ");
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
function generateTo(path) {
|
|
46
|
-
return (0, _ufo.withLeadingSlash)((0, _ufo.withoutTrailingSlash)(path.split("/").map(generateSlug).join("/")));
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function isDraft(path) {
|
|
50
|
-
return !!path.match(/\.draft(\/|\.|$)/);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
function isHidden(path) {
|
|
54
|
-
return path.split("/").some(part => part.match(/^_.*/));
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function padLeft(value, length) {
|
|
58
|
-
return ("0".repeat(length) + value).substr(String(value).length);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
function padRight(value, length) {
|
|
62
|
-
return (value + "0".repeat(length)).substr(0, length);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
function getPathMeta(id, {
|
|
66
|
-
locales = ["en"],
|
|
67
|
-
defaultLocale = "en"
|
|
68
|
-
} = {}) {
|
|
69
|
-
const regexp = new RegExp(`^/?(${locales.join("|")})`, "gi");
|
|
70
|
-
const paths = id.split(".").slice(0, -1).join(".").split(/:/g).slice(1);
|
|
71
|
-
let path = paths.join("/");
|
|
72
|
-
const [language] = path.match(regexp) || [];
|
|
73
|
-
|
|
74
|
-
if (language) {
|
|
75
|
-
path = path.replace(regexp, "");
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
const slug = generateSlug(paths[paths.length - 1]);
|
|
79
|
-
return {
|
|
80
|
-
slug,
|
|
81
|
-
title: generateTitleFromSlug(slug),
|
|
82
|
-
position: generatePosition(path),
|
|
83
|
-
to: generateTo(path),
|
|
84
|
-
draft: isDraft(path),
|
|
85
|
-
page: !isHidden(path),
|
|
86
|
-
language: language || defaultLocale
|
|
87
|
-
};
|
|
88
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { pascalCase } from "scule";
|
|
2
|
-
import { withoutTrailingSlash, withLeadingSlash } from "ufo";
|
|
3
|
-
const SEMVER_REGEX = /^(\d+)(\.\d+)*(\.x)?$/;
|
|
4
|
-
export function generatePosition(path) {
|
|
5
|
-
const position = path.split(/[/:]/).filter(Boolean).map((part) => {
|
|
6
|
-
const match = part.match(/^(\d+)\./);
|
|
7
|
-
if (match) {
|
|
8
|
-
return padLeft(match[1], 4);
|
|
9
|
-
}
|
|
10
|
-
return "9999";
|
|
11
|
-
}).join("");
|
|
12
|
-
return padRight(position, 12);
|
|
13
|
-
}
|
|
14
|
-
export function generateSlug(name) {
|
|
15
|
-
if (SEMVER_REGEX.test(name)) {
|
|
16
|
-
return name;
|
|
17
|
-
}
|
|
18
|
-
return name.replace(/^_/, "").replace(/(\d+\.)?(.*)/, "$2").replace(/^index/, "").replace(/\.draft/, "");
|
|
19
|
-
}
|
|
20
|
-
export function generateTitleFromSlug(slug) {
|
|
21
|
-
return slug.split(/[\s-]/g).map(pascalCase).join(" ");
|
|
22
|
-
}
|
|
23
|
-
export function generateTo(path) {
|
|
24
|
-
return withLeadingSlash(withoutTrailingSlash(path.split("/").map(generateSlug).join("/")));
|
|
25
|
-
}
|
|
26
|
-
export function isDraft(path) {
|
|
27
|
-
return !!path.match(/\.draft(\/|\.|$)/);
|
|
28
|
-
}
|
|
29
|
-
export function isHidden(path) {
|
|
30
|
-
return path.split("/").some((part) => part.match(/^_.*/));
|
|
31
|
-
}
|
|
32
|
-
function padLeft(value, length) {
|
|
33
|
-
return ("0".repeat(length) + value).substr(String(value).length);
|
|
34
|
-
}
|
|
35
|
-
function padRight(value, length) {
|
|
36
|
-
return (value + "0".repeat(length)).substr(0, length);
|
|
37
|
-
}
|
|
38
|
-
export function getPathMeta(id, { locales = ["en"], defaultLocale = "en" } = {}) {
|
|
39
|
-
const regexp = new RegExp(`^/?(${locales.join("|")})`, "gi");
|
|
40
|
-
const paths = id.split(".").slice(0, -1).join(".").split(/:/g).slice(1);
|
|
41
|
-
let path = paths.join("/");
|
|
42
|
-
const [language] = path.match(regexp) || [];
|
|
43
|
-
if (language) {
|
|
44
|
-
path = path.replace(regexp, "");
|
|
45
|
-
}
|
|
46
|
-
const slug = generateSlug(paths[paths.length - 1]);
|
|
47
|
-
return {
|
|
48
|
-
slug,
|
|
49
|
-
title: generateTitleFromSlug(slug),
|
|
50
|
-
position: generatePosition(path),
|
|
51
|
-
to: generateTo(path),
|
|
52
|
-
draft: isDraft(path),
|
|
53
|
-
page: !isHidden(path),
|
|
54
|
-
language: language || defaultLocale
|
|
55
|
-
};
|
|
56
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './log';
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
var _log = require("./log");
|
|
8
|
-
|
|
9
|
-
Object.keys(_log).forEach(function (key) {
|
|
10
|
-
if (key === "default" || key === "__esModule") return;
|
|
11
|
-
if (key in exports && exports[key] === _log[key]) return;
|
|
12
|
-
Object.defineProperty(exports, key, {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return _log[key];
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./log.mjs";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const logger: import("consola").Consola;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.logger = void 0;
|
|
7
|
-
|
|
8
|
-
var _consola = _interopRequireDefault(require("consola"));
|
|
9
|
-
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
|
|
12
|
-
const logger = _consola.default.withScope("@docus");
|
|
13
|
-
|
|
14
|
-
exports.logger = logger;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns a new object with the specified keys
|
|
3
|
-
**/
|
|
4
|
-
export declare const pick: (keys: string[]) => (obj: any) => any;
|
|
5
|
-
/**
|
|
6
|
-
* Returns a new object with all the keys of the original object execept the ones specified.
|
|
7
|
-
**/
|
|
8
|
-
export declare const omit: (keys: string[]) => (obj: any) => any;
|
|
9
|
-
export declare const apply: (fn: (d: any) => any) => (data: any) => any;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.pick = exports.omit = exports.apply = void 0;
|
|
7
|
-
|
|
8
|
-
const _pick = (obj, condition) => Object.keys(obj).filter(condition).reduce((newObj, key) => Object.assign(newObj, {
|
|
9
|
-
[key]: obj[key]
|
|
10
|
-
}), {});
|
|
11
|
-
|
|
12
|
-
const pick = keys => obj => keys && keys.length ? _pick(obj, key => keys.includes(key)) : obj;
|
|
13
|
-
|
|
14
|
-
exports.pick = pick;
|
|
15
|
-
|
|
16
|
-
const omit = keys => obj => keys && keys.length ? _pick(obj, key => !keys.includes(key)) : obj;
|
|
17
|
-
|
|
18
|
-
exports.omit = omit;
|
|
19
|
-
|
|
20
|
-
const apply = fn => data => Array.isArray(data) ? data.map(item => fn(item)) : fn(data);
|
|
21
|
-
|
|
22
|
-
exports.apply = apply;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
const _pick = (obj, condition) => Object.keys(obj).filter(condition).reduce((newObj, key) => Object.assign(newObj, { [key]: obj[key] }), {});
|
|
2
|
-
export const pick = (keys) => (obj) => keys && keys.length ? _pick(obj, (key) => keys.includes(key)) : obj;
|
|
3
|
-
export const omit = (keys) => (obj) => keys && keys.length ? _pick(obj, (key) => !keys.includes(key)) : obj;
|
|
4
|
-
export const apply = (fn) => (data) => Array.isArray(data) ? data.map((item) => fn(item)) : fn(data);
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { withoutTrailingSlash, joinURL } from "ufo";
|
|
2
|
-
import Query from "#docus/database/Query";
|
|
3
|
-
const createQuery = (options) => (path, opts) => {
|
|
4
|
-
const to = typeof path === "string" ? path : "";
|
|
5
|
-
const params = (typeof path === "object" ? path : opts) || {};
|
|
6
|
-
return new Query(to, { ...params, ...options });
|
|
7
|
-
};
|
|
8
|
-
export function getContent(ctx, previewKey = "") {
|
|
9
|
-
let { $docus } = ctx.$config ? ctx.$config : ctx.nuxtState;
|
|
10
|
-
if (!$docus) {
|
|
11
|
-
$docus = {
|
|
12
|
-
apiBase: "_docus",
|
|
13
|
-
wsUrl: "ws://localhost:4000"
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
const query = previewKey ? "?preview=" + previewKey : "";
|
|
17
|
-
const fetch = (key, opts = void 0) => globalThis.$fetch(joinURL("/api", $docus.apiBase, key) + query, opts);
|
|
18
|
-
const get = (key) => fetch(joinURL("get", key));
|
|
19
|
-
const search = createQuery({
|
|
20
|
-
base: withoutTrailingSlash(joinURL("/api", $docus.apiBase, "search") + query)
|
|
21
|
-
});
|
|
22
|
-
if (previewKey) {
|
|
23
|
-
return {
|
|
24
|
-
fetch,
|
|
25
|
-
get,
|
|
26
|
-
search,
|
|
27
|
-
setItem: async (key, content) => {
|
|
28
|
-
await fetch("preview", { method: "POST", body: { key, content } });
|
|
29
|
-
if (typeof window !== "undefined") {
|
|
30
|
-
window.$nuxt.$emit("docus:content:preview", { key, event: "change" });
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
removeItem: async (key) => {
|
|
34
|
-
await fetch(joinURL("preview", key), { method: "DELETE" });
|
|
35
|
-
if (typeof window !== "undefined") {
|
|
36
|
-
window.$nuxt.$emit("docus:content:preview", { key, event: "remove" });
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
return {
|
|
42
|
-
fetch,
|
|
43
|
-
get,
|
|
44
|
-
search,
|
|
45
|
-
preview: (previewKey2 = "memory") => getContent(ctx, previewKey2)
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
export default async function(ctx, inject) {
|
|
49
|
-
inject("content", getContent(ctx));
|
|
50
|
-
}
|
package/dist/templates/docus.mjs
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { defineNuxtPlugin } from "#app";
|
|
2
|
-
import { createDocus } from "#docus";
|
|
3
|
-
import docusConfig from "#docus/cache/docus.config.json";
|
|
4
|
-
import themeConfig from "#docus/cache/theme.config.json";
|
|
5
|
-
export default defineNuxtPlugin(async (nuxt) => {
|
|
6
|
-
const { $docus, init } = createDocus(nuxt, { docusConfig, themeConfig });
|
|
7
|
-
nuxt.provide("docus", $docus);
|
|
8
|
-
nuxt.provide("navigation", $docus.navigation);
|
|
9
|
-
if (process.client) {
|
|
10
|
-
window.$docus = $docus;
|
|
11
|
-
}
|
|
12
|
-
await init();
|
|
13
|
-
});
|
package/dist/templates/hot.mjs
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { joinURL } from "ufo";
|
|
2
|
-
import { useWebSocket } from "#docus/composables/websocket";
|
|
3
|
-
export default async function(ctx) {
|
|
4
|
-
let { $docus } = ctx.$config ? ctx.$config : ctx.nuxtState;
|
|
5
|
-
if (!$docus) {
|
|
6
|
-
$docus = {
|
|
7
|
-
apiBase: "_docus",
|
|
8
|
-
wsUrl: "ws://localhost:4000"
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
if (process.client) {
|
|
12
|
-
const protocol = location.protocol === "https:" ? "wss" : "ws";
|
|
13
|
-
const baseUrl = joinURL($docus.wsUrl || `${protocol}://${location.hostname}:${location.port}`, $docus.apiBase);
|
|
14
|
-
useWebSocket(baseUrl)?.connect();
|
|
15
|
-
}
|
|
16
|
-
}
|
package/dist/templates/i18n.mjs
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { defineNuxtPlugin } from "#app";
|
|
2
|
-
export default defineNuxtPlugin((nuxt) => {
|
|
3
|
-
nuxt.provide("contentLocalePath", (path) => {
|
|
4
|
-
const app = nuxt.vue2App;
|
|
5
|
-
const { localeCodes, defaultLocale } = nuxt.nuxt2Context.i18n;
|
|
6
|
-
let localePath = localeCodes.some((code) => path.startsWith(`/${code}`)) ? path : app.localePath(path);
|
|
7
|
-
if (localePath.startsWith(`/${defaultLocale}`)) {
|
|
8
|
-
localePath = localePath.replace(`/${defaultLocale}`, "");
|
|
9
|
-
}
|
|
10
|
-
if (path.endsWith("/") && !localePath.endsWith("/")) {
|
|
11
|
-
localePath += "/";
|
|
12
|
-
}
|
|
13
|
-
if (!path.endsWith("/") && localePath.endsWith("/")) {
|
|
14
|
-
localePath = localePath.replace(/\/*$/, "");
|
|
15
|
-
}
|
|
16
|
-
return localePath;
|
|
17
|
-
});
|
|
18
|
-
if (process.client) {
|
|
19
|
-
nuxt.nuxt2Context.i18n.onLanguageSwitched = () => {
|
|
20
|
-
window.$docus.navigation.fetchNavigation(nuxt.nuxt2Context.i18n.locale);
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
});
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
<%
|
|
3
|
-
const remarkPlugins = options.transformers.markdown.remarkPlugins
|
|
4
|
-
const rehypePlugins = options.transformers.markdown.rehypePlugins
|
|
5
|
-
const components = options.transformers.markdown.components
|
|
6
|
-
|
|
7
|
-
const serializeImportName = id => '_' + id.replace(/[^a-zA-Z0-9_$]/g, '_')
|
|
8
|
-
%>
|
|
9
|
-
<% components.forEach(item => { %>
|
|
10
|
-
import <%= serializeImportName(item.name) %> from '<%= item.path %>'
|
|
11
|
-
<% }) %>
|
|
12
|
-
<% remarkPlugins.forEach(item => { %>
|
|
13
|
-
import <%= serializeImportName(item[0] || item.name || item) %> from '<%= item[0] || item.name || item %>'
|
|
14
|
-
<% }) %>
|
|
15
|
-
<% rehypePlugins.forEach(item => { %>
|
|
16
|
-
import <%= serializeImportName(item[0] || item.name || item) %> from '<%= item[0] || item.name || item %>'
|
|
17
|
-
<% }) %>
|
|
18
|
-
|
|
19
|
-
const _context = <%= JSON.stringify(options) %>
|
|
20
|
-
|
|
21
|
-
_context.transformers.markdown.components = [
|
|
22
|
-
<% components.forEach(item => { %>{
|
|
23
|
-
name: '<%= item.name %>',
|
|
24
|
-
instance: <%= serializeImportName(item.name) %>,
|
|
25
|
-
options: <%= JSON.stringify(item.options || {}) %>
|
|
26
|
-
}, <% }) %>
|
|
27
|
-
]
|
|
28
|
-
|
|
29
|
-
_context.transformers.markdown.remarkPlugins = [
|
|
30
|
-
<% remarkPlugins.forEach(item => { %>{
|
|
31
|
-
name: '<%= item[0] || item.name || item %>',
|
|
32
|
-
instance: <%= serializeImportName(item[0] || item.name || item) %>,
|
|
33
|
-
options: <%= JSON.stringify(item[1] || item.options || {}) %>
|
|
34
|
-
}, <% }) %>
|
|
35
|
-
]
|
|
36
|
-
|
|
37
|
-
_context.transformers.markdown.rehypePlugins = [
|
|
38
|
-
<% rehypePlugins.forEach(item => { %>{
|
|
39
|
-
name: '<%= item[0] || item.name || item %>',
|
|
40
|
-
instance: <%= serializeImportName(item[0] || item.name || item) %>,
|
|
41
|
-
options: <%= JSON.stringify(item[1] || item.options || {}) %>
|
|
42
|
-
}, <% }) %>
|
|
43
|
-
]
|
|
44
|
-
|
|
45
|
-
export const context = _context
|
|
46
|
-
export default _context
|
package/shims.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { DocusContent } from 'types'
|
|
2
|
-
|
|
3
|
-
declare global {
|
|
4
|
-
declare namespace NodeJS {
|
|
5
|
-
interface Process {
|
|
6
|
-
dev: boolean
|
|
7
|
-
client: boolean
|
|
8
|
-
server: boolean
|
|
9
|
-
options: any
|
|
10
|
-
previewUrl: string
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
interface Window {
|
|
15
|
-
onNuxtReady: any
|
|
16
|
-
$docus: DocusRuntimeInstance
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
declare module '@nuxt/types' {
|
|
21
|
-
interface Context {
|
|
22
|
-
$content: DocusContent<any>
|
|
23
|
-
}
|
|
24
|
-
}
|