dumi-theme-lobehub 1.8.4 → 1.8.5
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/dist/builtins/Previewer/index.js +9 -3
- package/dist/components/Analytics/Clarity.d.ts +5 -0
- package/dist/components/Analytics/Clarity.js +12 -0
- package/dist/components/Analytics/GoogleAnalytics.d.ts +5 -0
- package/dist/components/Analytics/GoogleAnalytics.js +20 -0
- package/dist/components/Analytics/Plausible.d.ts +6 -0
- package/dist/components/Analytics/Plausible.js +12 -0
- package/dist/components/Analytics/index.d.ts +2 -0
- package/dist/components/Analytics/index.js +21 -0
- package/dist/components/StoreUpdater/index.js +4 -0
- package/dist/layouts/DemoLayout/GlobalStyle.d.ts +3 -0
- package/dist/layouts/DemoLayout/GlobalStyle.js +8 -0
- package/dist/layouts/DemoLayout/index.js +39 -9
- package/dist/layouts/DocLayout/DocumentLayout.js +4 -4
- package/dist/layouts/DocLayout/GlobalStyle.js +1 -1
- package/dist/layouts/DocLayout/Head/Favicons.js +56 -0
- package/dist/layouts/DocLayout/Head/Og.d.ts +3 -0
- package/dist/layouts/DocLayout/Head/Og.js +74 -0
- package/dist/layouts/DocLayout/index.js +4 -2
- package/dist/pages/Changelog/index.js +3 -8
- package/dist/pages/Docs/index.js +3 -3
- package/dist/slots/ApiHeader/index.js +2 -2
- package/dist/slots/Content/index.js +2 -2
- package/dist/slots/ContentFooter/index.js +2 -2
- package/dist/slots/Features/index.js +2 -2
- package/dist/slots/Footer/index.js +2 -2
- package/dist/slots/Header/Burger.js +2 -2
- package/dist/slots/Header/DiscordButton.js +2 -2
- package/dist/slots/Header/GithubButton.js +77 -4
- package/dist/slots/Header/index.js +1 -1
- package/dist/slots/Hero/index.js +14 -4
- package/dist/slots/Logo/index.js +2 -2
- package/dist/slots/Navbar/index.js +2 -2
- package/dist/slots/Toc/index.js +2 -2
- package/dist/store/index.d.ts +0 -15
- package/dist/store/index.js +1 -18
- package/dist/store/initialState.d.ts +1 -0
- package/dist/store/initialState.js +20 -3
- package/dist/store/selectors/apiHeader.d.ts +4 -3
- package/dist/store/selectors/apiHeader.js +8 -5
- package/dist/store/selectors/hero.d.ts +7 -22
- package/dist/store/selectors/hero.js +29 -28
- package/dist/store/selectors/index.d.ts +3 -23
- package/dist/store/selectors/index.js +3 -71
- package/dist/store/selectors/site.d.ts +60 -0
- package/dist/store/selectors/site.js +111 -0
- package/dist/store/useSiteStore.d.ts +2 -5
- package/dist/types/config.d.ts +36 -2
- package/package.json +1 -1
- package/dist/components/Favicons/index.js +0 -43
- package/dist/store/selectors/siteBasicInfo.d.ts +0 -11
- package/dist/store/selectors/siteBasicInfo.js +0 -27
- package/dist/store/selectors/token.d.ts +0 -2
- package/dist/store/selectors/token.js +0 -5
- /package/dist/{components/Favicons/index.d.ts → layouts/DocLayout/Head/Favicons.d.ts} +0 -0
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
import { merge } from 'lodash-es';
|
|
8
|
+
import { initialThemeConfig } from "../initialState";
|
|
9
|
+
var themeConfig = function themeConfig(s) {
|
|
10
|
+
return merge(s.siteData.themeConfig, initialThemeConfig);
|
|
11
|
+
};
|
|
12
|
+
var siteTitle = function siteTitle(s) {
|
|
13
|
+
return themeConfig(s).title;
|
|
14
|
+
};
|
|
15
|
+
var siteDesc = function siteDesc(s) {
|
|
16
|
+
return themeConfig(s).description;
|
|
17
|
+
};
|
|
18
|
+
var github = function github(s) {
|
|
19
|
+
var _themeConfig$socialLi;
|
|
20
|
+
return ((_themeConfig$socialLi = themeConfig(s).socialLinks) === null || _themeConfig$socialLi === void 0 ? void 0 : _themeConfig$socialLi.github) || '';
|
|
21
|
+
};
|
|
22
|
+
var discord = function discord(s) {
|
|
23
|
+
var _themeConfig$socialLi2;
|
|
24
|
+
return ((_themeConfig$socialLi2 = themeConfig(s).socialLinks) === null || _themeConfig$socialLi2 === void 0 ? void 0 : _themeConfig$socialLi2.discord) || '';
|
|
25
|
+
};
|
|
26
|
+
var giscus = function giscus(s) {
|
|
27
|
+
return themeConfig(s).giscus;
|
|
28
|
+
};
|
|
29
|
+
var analytics = function analytics(s) {
|
|
30
|
+
return themeConfig(s).analytics;
|
|
31
|
+
};
|
|
32
|
+
var metadata = function metadata(s) {
|
|
33
|
+
return themeConfig(s).metadata;
|
|
34
|
+
};
|
|
35
|
+
var logo = function logo(s) {
|
|
36
|
+
var logo = themeConfig(s).logo;
|
|
37
|
+
if (!logo) return logo || '';
|
|
38
|
+
if (logo.startsWith('http')) return logo;
|
|
39
|
+
return logo;
|
|
40
|
+
};
|
|
41
|
+
var token = function token(s) {
|
|
42
|
+
var fm = s.routeMeta.frontmatter;
|
|
43
|
+
return merge({}, fm.token, s.siteData.themeConfig.siteToken);
|
|
44
|
+
};
|
|
45
|
+
var activePath = function activePath(s) {
|
|
46
|
+
if (s.location.pathname === '/') return '/';
|
|
47
|
+
var item = s.navData.filter(function (index) {
|
|
48
|
+
return index.link !== '/';
|
|
49
|
+
}).find(function (index) {
|
|
50
|
+
return s.location.pathname.startsWith(String(index.activePath || index.link));
|
|
51
|
+
});
|
|
52
|
+
return (item === null || item === void 0 ? void 0 : item.activePath) || (item === null || item === void 0 ? void 0 : item.link) || '';
|
|
53
|
+
};
|
|
54
|
+
var tocAnchorItem = function tocAnchorItem(s) {
|
|
55
|
+
var _s$tabMeta, _s$tabMeta2;
|
|
56
|
+
var _s$routeMeta = s.routeMeta,
|
|
57
|
+
toc = _s$routeMeta.toc,
|
|
58
|
+
frontmatter = _s$routeMeta.frontmatter;
|
|
59
|
+
if ((_s$tabMeta = s.tabMeta) !== null && _s$tabMeta !== void 0 && _s$tabMeta.toc) toc = s.tabMeta.toc;
|
|
60
|
+
if ((_s$tabMeta2 = s.tabMeta) !== null && _s$tabMeta2 !== void 0 && _s$tabMeta2.frontmatter) frontmatter = s.tabMeta.frontmatter;
|
|
61
|
+
var shouldKeepWith = function shouldKeepWith(depth) {
|
|
62
|
+
if (!frontmatter.tocDepth) return true;
|
|
63
|
+
if (typeof frontmatter.tocDepth === 'number' && frontmatter.tocDepth > depth - 1) return true;
|
|
64
|
+
};
|
|
65
|
+
return toc.reduce(function (result, item) {
|
|
66
|
+
if (item.depth === 2 && shouldKeepWith(2)) {
|
|
67
|
+
result.push(_objectSpread({}, item));
|
|
68
|
+
} else if (item.depth === 3 && shouldKeepWith(3)) {
|
|
69
|
+
var parent = result.at(-1);
|
|
70
|
+
if (parent) {
|
|
71
|
+
parent.children = parent.children || [];
|
|
72
|
+
parent.children.push(_objectSpread({}, item));
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return result;
|
|
76
|
+
}, []);
|
|
77
|
+
};
|
|
78
|
+
var flattenSidebar = function flattenSidebar(s) {
|
|
79
|
+
var _s$sidebar;
|
|
80
|
+
return ((_s$sidebar = s.sidebar) === null || _s$sidebar === void 0 ? void 0 : _s$sidebar.map(function (index) {
|
|
81
|
+
return index.children;
|
|
82
|
+
}).flat()) || [];
|
|
83
|
+
};
|
|
84
|
+
var contentBottom = function contentBottom(s) {
|
|
85
|
+
var dataFlatten = flattenSidebar(s);
|
|
86
|
+
var path = s.location.pathname;
|
|
87
|
+
var currentIndex = dataFlatten.findIndex(function (item) {
|
|
88
|
+
return item.link === path;
|
|
89
|
+
});
|
|
90
|
+
return {
|
|
91
|
+
currentIndex: currentIndex,
|
|
92
|
+
next: dataFlatten[currentIndex + 1],
|
|
93
|
+
prev: dataFlatten[currentIndex - 1]
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
export var siteSelectors = {
|
|
97
|
+
activePath: activePath,
|
|
98
|
+
analytics: analytics,
|
|
99
|
+
contentBottom: contentBottom,
|
|
100
|
+
discord: discord,
|
|
101
|
+
flattenSidebar: flattenSidebar,
|
|
102
|
+
giscus: giscus,
|
|
103
|
+
github: github,
|
|
104
|
+
logo: logo,
|
|
105
|
+
metadata: metadata,
|
|
106
|
+
siteDesc: siteDesc,
|
|
107
|
+
siteTitle: siteTitle,
|
|
108
|
+
themeConfig: themeConfig,
|
|
109
|
+
tocAnchorItem: tocAnchorItem,
|
|
110
|
+
token: token
|
|
111
|
+
};
|
|
@@ -3,15 +3,12 @@ import type { ISiteContext } from 'dumi/dist/client/theme-api/context';
|
|
|
3
3
|
import { ILocale, INavItem, IRouteMeta, ISidebarGroup, IThemeConfig } from 'dumi/dist/client/theme-api/types';
|
|
4
4
|
import type { Location } from 'history';
|
|
5
5
|
import { StoreApi } from 'zustand';
|
|
6
|
+
import { SiteThemeConfig } from "../types";
|
|
6
7
|
export type NavData = (INavItem & {
|
|
7
8
|
children?: INavItem[] | undefined;
|
|
8
9
|
})[];
|
|
9
10
|
export type ISiteData = ISiteContext & {
|
|
10
|
-
themeConfig: IThemeConfig &
|
|
11
|
-
socialLinks?: {
|
|
12
|
-
discord?: string;
|
|
13
|
-
};
|
|
14
|
-
};
|
|
11
|
+
themeConfig: IThemeConfig & SiteThemeConfig;
|
|
15
12
|
};
|
|
16
13
|
export interface SiteStore {
|
|
17
14
|
locale: ILocale;
|
package/dist/types/config.d.ts
CHANGED
|
@@ -16,11 +16,23 @@ export interface FooterConfig {
|
|
|
16
16
|
resources?: FooterColumn;
|
|
17
17
|
}
|
|
18
18
|
export interface SiteThemeConfig {
|
|
19
|
-
actions
|
|
19
|
+
actions?: HeroProps['actions'];
|
|
20
|
+
analytics?: {
|
|
21
|
+
clarity?: {
|
|
22
|
+
projectId: string;
|
|
23
|
+
};
|
|
24
|
+
googleAnalytics?: {
|
|
25
|
+
measurementId: string;
|
|
26
|
+
};
|
|
27
|
+
plausible?: {
|
|
28
|
+
domain: string;
|
|
29
|
+
scriptBaseUrl: string;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
20
32
|
apiHeader?: ApiHeaderConfig | false;
|
|
21
33
|
description?: string;
|
|
22
34
|
docStyle?: 'block' | 'pure';
|
|
23
|
-
features
|
|
35
|
+
features?: FeaturesProps['items'];
|
|
24
36
|
footer?: string | false;
|
|
25
37
|
footerConfig?: FooterConfig;
|
|
26
38
|
giscus?: {
|
|
@@ -33,6 +45,28 @@ export interface SiteThemeConfig {
|
|
|
33
45
|
hideHomeNav?: boolean;
|
|
34
46
|
logo?: string;
|
|
35
47
|
logoType?: LogoProps['type'];
|
|
48
|
+
metadata?: {
|
|
49
|
+
description?: string;
|
|
50
|
+
icons?: {
|
|
51
|
+
apple?: string;
|
|
52
|
+
icon?: string;
|
|
53
|
+
shortcut?: string;
|
|
54
|
+
};
|
|
55
|
+
manifest?: string;
|
|
56
|
+
openGraph?: {
|
|
57
|
+
description?: string;
|
|
58
|
+
image?: string;
|
|
59
|
+
siteName?: string;
|
|
60
|
+
title?: string;
|
|
61
|
+
};
|
|
62
|
+
title?: string;
|
|
63
|
+
twitter?: {
|
|
64
|
+
description?: string;
|
|
65
|
+
image?: string;
|
|
66
|
+
site?: string;
|
|
67
|
+
title?: string;
|
|
68
|
+
};
|
|
69
|
+
};
|
|
36
70
|
name?: string;
|
|
37
71
|
siteToken?: SiteConfigToken;
|
|
38
72
|
socialLinks?: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dumi-theme-lobehub",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.5",
|
|
4
4
|
"description": "dumi-theme-lobehub is a documentation site theme package designed for dumi2. It provides a more beautiful and user-friendly development and reading experience based on @lobehub/ui",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"lobehub",
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { Helmet } from 'dumi';
|
|
2
|
-
import { memo } from 'react';
|
|
3
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
|
-
var Favicons = /*#__PURE__*/memo(function () {
|
|
6
|
-
return /*#__PURE__*/_jsxs(Helmet, {
|
|
7
|
-
children: [/*#__PURE__*/_jsx("link", {
|
|
8
|
-
href: "https://registry.npmmirror.com/@lobehub/assets-favicons/latest/files/assets/apple-touch-icon.png",
|
|
9
|
-
rel: "apple-touch-icon",
|
|
10
|
-
sizes: "180x180"
|
|
11
|
-
}), /*#__PURE__*/_jsx("link", {
|
|
12
|
-
href: "https://registry.npmmirror.com/@lobehub/assets-favicons/latest/files/assets/favicon-32x32.png",
|
|
13
|
-
rel: "icon",
|
|
14
|
-
sizes: "32x32",
|
|
15
|
-
type: "image/png"
|
|
16
|
-
}), /*#__PURE__*/_jsx("link", {
|
|
17
|
-
href: "https://registry.npmmirror.com/@lobehub/assets-favicons/latest/files/assets/favicon-16x16.png",
|
|
18
|
-
rel: "icon",
|
|
19
|
-
sizes: "16x16",
|
|
20
|
-
type: "image/png"
|
|
21
|
-
}), /*#__PURE__*/_jsx("link", {
|
|
22
|
-
href: "https://registry.npmmirror.com/@lobehub/assets-favicons/latest/files/assets/site.webmanifest",
|
|
23
|
-
rel: "manifest"
|
|
24
|
-
}), /*#__PURE__*/_jsx("link", {
|
|
25
|
-
color: "#000000",
|
|
26
|
-
href: "https://registry.npmmirror.com/@lobehub/assets-favicons/latest/files/assets/safari-pinned-tab.svg",
|
|
27
|
-
rel: "mask-icon"
|
|
28
|
-
}), /*#__PURE__*/_jsx("meta", {
|
|
29
|
-
content: "LobeHub",
|
|
30
|
-
name: "apple-mobile-web-app-title"
|
|
31
|
-
}), /*#__PURE__*/_jsx("meta", {
|
|
32
|
-
content: "LobeHub",
|
|
33
|
-
name: "application-name"
|
|
34
|
-
}), /*#__PURE__*/_jsx("meta", {
|
|
35
|
-
content: "#000000",
|
|
36
|
-
name: "msapplication-TileColor"
|
|
37
|
-
}), /*#__PURE__*/_jsx("meta", {
|
|
38
|
-
content: "#000000",
|
|
39
|
-
name: "theme-color"
|
|
40
|
-
})]
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
export default Favicons;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { SiteStore } from '../useSiteStore';
|
|
2
|
-
export declare const themeConfig: (s: SiteStore) => import("dumi/dist/client/theme-api/types").IThemeConfig & {
|
|
3
|
-
socialLinks?: {
|
|
4
|
-
discord?: string | undefined;
|
|
5
|
-
} | undefined;
|
|
6
|
-
};
|
|
7
|
-
export declare const siteTitleSel: (s: SiteStore) => any;
|
|
8
|
-
export declare const githubSel: (s: SiteStore) => string;
|
|
9
|
-
export declare const discordSel: (s: SiteStore) => string;
|
|
10
|
-
export declare const giscusSel: (s: SiteStore) => any;
|
|
11
|
-
export declare const logoSel: (s: SiteStore) => string;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
export var themeConfig = function themeConfig(s) {
|
|
2
|
-
return s.siteData.themeConfig;
|
|
3
|
-
};
|
|
4
|
-
export var siteTitleSel = function siteTitleSel(s) {
|
|
5
|
-
return s.siteData.themeConfig.title;
|
|
6
|
-
};
|
|
7
|
-
export var githubSel = function githubSel(s) {
|
|
8
|
-
var _s$siteData$themeConf;
|
|
9
|
-
return ((_s$siteData$themeConf = s.siteData.themeConfig.socialLinks) === null || _s$siteData$themeConf === void 0 ? void 0 : _s$siteData$themeConf.github) || '';
|
|
10
|
-
};
|
|
11
|
-
export var discordSel = function discordSel(s) {
|
|
12
|
-
var _s$siteData$themeConf2;
|
|
13
|
-
return ((_s$siteData$themeConf2 = s.siteData.themeConfig.socialLinks) === null || _s$siteData$themeConf2 === void 0 ? void 0 : _s$siteData$themeConf2.discord) || '';
|
|
14
|
-
};
|
|
15
|
-
export var giscusSel = function giscusSel(s) {
|
|
16
|
-
return s.siteData.themeConfig.giscus;
|
|
17
|
-
};
|
|
18
|
-
export var logoSel = function logoSel(s) {
|
|
19
|
-
var logo = s.siteData.themeConfig.logo;
|
|
20
|
-
if (!logo) return logo || '';
|
|
21
|
-
|
|
22
|
-
// 如果是 url 地址,则什么也不处理
|
|
23
|
-
if (logo.startsWith('http')) return logo;
|
|
24
|
-
|
|
25
|
-
// TODO: 如果是相对路径,则拼接上 base
|
|
26
|
-
return logo;
|
|
27
|
-
};
|
|
File without changes
|