dumi-theme-lobehub 1.8.5 → 1.9.0
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 +36 -2
- package/dist/builtins/Container/index.js +9 -15
- package/dist/index.d.ts +3 -1
- package/dist/index.js +5 -2
- package/dist/layouts/DocLayout/Head/Og.js +5 -4
- package/dist/slots/Content/style.js +1 -1
- package/dist/store/initialState.d.ts +2 -1
- package/dist/store/initialState.js +2 -0
- package/dist/store/selectors/site.d.ts +2 -1
- package/dist/store/selectors/site.js +4 -0
- package/dist/store/useSiteStore.d.ts +2 -2
- package/dist/types/config.d.ts +2 -1
- package/package.json +1 -1
- package/dist/builtins/Container/style.d.ts +0 -5
- package/dist/builtins/Container/style.js +0 -27
- package/dist/config.d.ts +0 -2
- package/dist/config.js +0 -3
package/README.md
CHANGED
|
@@ -83,11 +83,23 @@ Usage After installation, start the site with `dumi`, and the theme will be auto
|
|
|
83
83
|
|
|
84
84
|
```ts
|
|
85
85
|
interface SiteThemeConfig {
|
|
86
|
-
actions
|
|
86
|
+
actions?: HeroProps['actions'];
|
|
87
|
+
analytics?: {
|
|
88
|
+
clarity?: {
|
|
89
|
+
projectId: string;
|
|
90
|
+
};
|
|
91
|
+
googleAnalytics?: {
|
|
92
|
+
measurementId: string;
|
|
93
|
+
};
|
|
94
|
+
plausible?: {
|
|
95
|
+
domain: string;
|
|
96
|
+
scriptBaseUrl: string;
|
|
97
|
+
};
|
|
98
|
+
};
|
|
87
99
|
apiHeader?: ApiHeaderConfig | false;
|
|
88
100
|
description?: string;
|
|
89
101
|
docStyle?: 'block' | 'pure';
|
|
90
|
-
features
|
|
102
|
+
features?: FeaturesProps['items'];
|
|
91
103
|
footer?: string | false;
|
|
92
104
|
footerConfig?: FooterConfig;
|
|
93
105
|
giscus?: {
|
|
@@ -100,6 +112,28 @@ interface SiteThemeConfig {
|
|
|
100
112
|
hideHomeNav?: boolean;
|
|
101
113
|
logo?: string;
|
|
102
114
|
logoType?: LogoProps['type'];
|
|
115
|
+
metadata?: {
|
|
116
|
+
description?: string;
|
|
117
|
+
icons?: {
|
|
118
|
+
apple?: string;
|
|
119
|
+
icon?: string;
|
|
120
|
+
shortcut?: string;
|
|
121
|
+
};
|
|
122
|
+
manifest?: string;
|
|
123
|
+
openGraph?: {
|
|
124
|
+
description?: string;
|
|
125
|
+
image?: string;
|
|
126
|
+
siteName?: string;
|
|
127
|
+
title?: string;
|
|
128
|
+
};
|
|
129
|
+
title?: string;
|
|
130
|
+
twitter?: {
|
|
131
|
+
description?: string;
|
|
132
|
+
image?: string;
|
|
133
|
+
site?: string;
|
|
134
|
+
title?: string;
|
|
135
|
+
};
|
|
136
|
+
};
|
|
103
137
|
name?: string;
|
|
104
138
|
siteToken?: SiteConfigToken;
|
|
105
139
|
socialLinks?: {
|
|
@@ -1,26 +1,20 @@
|
|
|
1
|
-
import { Alert } from '
|
|
2
|
-
import { useStyles } from "./style";
|
|
1
|
+
import { Alert, Typography } from '@lobehub/ui';
|
|
3
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
3
|
var Container = function Container(_ref) {
|
|
5
4
|
var type = _ref.type,
|
|
6
5
|
title = _ref.title,
|
|
7
6
|
children = _ref.children;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
className: styles.container,
|
|
13
|
-
"data-type": type,
|
|
7
|
+
return /*#__PURE__*/_jsx(Typography, {
|
|
8
|
+
fontSize: 14,
|
|
9
|
+
headerMultiple: 0.25,
|
|
10
|
+
marginMultiple: 0,
|
|
14
11
|
children: /*#__PURE__*/_jsx(Alert, {
|
|
15
|
-
|
|
16
|
-
description: /*#__PURE__*/_jsx("div", {
|
|
17
|
-
className: cx(styles.desc,
|
|
18
|
-
// 为了让 markdown 的样式生效,需要在这里添加一个额外的 class
|
|
19
|
-
'markdown'),
|
|
20
|
-
children: children
|
|
21
|
-
}),
|
|
12
|
+
description: children,
|
|
22
13
|
message: title || type.toUpperCase(),
|
|
23
14
|
showIcon: true,
|
|
15
|
+
style: {
|
|
16
|
+
marginBlock: '1em'
|
|
17
|
+
},
|
|
24
18
|
type: type
|
|
25
19
|
})
|
|
26
20
|
});
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { SiteThemeConfig } from "./types";
|
|
2
2
|
export { siteSelectors, type SiteStore, useSiteStore } from './store';
|
|
3
3
|
export * from './types';
|
|
4
|
+
export { styles } from "./store/initialState";
|
|
5
|
+
export declare const defineThemeConfig: (config: SiteThemeConfig) => SiteThemeConfig;
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
export { defineThemeConfig } from "./config";
|
|
2
1
|
export { siteSelectors, useSiteStore } from "./store";
|
|
3
|
-
export * from "./types";
|
|
2
|
+
export * from "./types";
|
|
3
|
+
export { styles } from "./store/initialState";
|
|
4
|
+
export var defineThemeConfig = function defineThemeConfig(config) {
|
|
5
|
+
return config;
|
|
6
|
+
};
|
|
@@ -13,12 +13,13 @@ import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
13
13
|
var Og = /*#__PURE__*/memo(function () {
|
|
14
14
|
var _metadata$openGraph, _metadata$openGraph2, _metadata$openGraph3, _metadata$openGraph4, _metadata$openGraph5, _metadata$twitter, _metadata$twitter2, _metadata$twitter3, _metadata$openGraph6, _metadata$twitter4, _metadata$openGraph7, _metadata$twitter5, _metadata$openGraph8;
|
|
15
15
|
var _useSiteStore = useSiteStore(function (s) {
|
|
16
|
-
return [siteSelectors.siteTitle(s), siteSelectors.siteDesc(s), siteSelectors.logo(s)];
|
|
16
|
+
return [siteSelectors.siteTitle(s), siteSelectors.siteDesc(s), siteSelectors.logo(s), siteSelectors.hostname(s)];
|
|
17
17
|
}),
|
|
18
|
-
_useSiteStore2 = _slicedToArray(_useSiteStore,
|
|
18
|
+
_useSiteStore2 = _slicedToArray(_useSiteStore, 4),
|
|
19
19
|
title = _useSiteStore2[0],
|
|
20
20
|
desc = _useSiteStore2[1],
|
|
21
|
-
logo = _useSiteStore2[2]
|
|
21
|
+
logo = _useSiteStore2[2],
|
|
22
|
+
hostname = _useSiteStore2[3];
|
|
22
23
|
var metadata = useSiteStore(siteSelectors.metadata, isEqual);
|
|
23
24
|
return /*#__PURE__*/_jsxs(Helmet, {
|
|
24
25
|
children: [/*#__PURE__*/_jsx("title", {
|
|
@@ -33,7 +34,7 @@ var Og = /*#__PURE__*/memo(function () {
|
|
|
33
34
|
content: (metadata === null || metadata === void 0 || (_metadata$openGraph2 = metadata.openGraph) === null || _metadata$openGraph2 === void 0 ? void 0 : _metadata$openGraph2.description) || desc,
|
|
34
35
|
property: "og:description"
|
|
35
36
|
}), /*#__PURE__*/_jsx("meta", {
|
|
36
|
-
content: location.origin,
|
|
37
|
+
content: hostname || location.origin,
|
|
37
38
|
property: "og:url"
|
|
38
39
|
}), /*#__PURE__*/_jsx("meta", {
|
|
39
40
|
content: metadata === null || metadata === void 0 || (_metadata$openGraph3 = metadata.openGraph) === null || _metadata$openGraph3 === void 0 ? void 0 : _metadata$openGraph3.siteName,
|
|
@@ -7,6 +7,6 @@ export var useStyles = createStyles(function (_ref, isPure) {
|
|
|
7
7
|
responsive = _ref.responsive,
|
|
8
8
|
css = _ref.css;
|
|
9
9
|
return {
|
|
10
|
-
content: cx(!isPure && css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n padding: 24px 48px;\n background-color: ", ";\n border-radius: 10px;\n\n ", " {\n padding: 8px 16px;\n border-radius: 0;\n }\n "])), token.colorBgContainer, responsive.mobile), css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n flex: 1;\n box-sizing: border-box;\n width: 100%;\n min-height: 400px;\n\n &:has([data-page-tabs='true']) {\n padding-top: 8px;\n }\n "]))))
|
|
10
|
+
content: cx(!isPure && css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n padding: 24px 48px;\n background-color: ", ";\n border-radius: 10px;\n\n ", " {\n padding: 8px 16px;\n border-radius: 0;\n }\n "])), token.colorBgContainer, responsive.mobile), css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n flex: 1;\n box-sizing: border-box;\n width: 100%;\n min-height: 400px;\n\n &:has([data-page-tabs='true']) {\n padding-top: 8px;\n }\n\n .dumi-default-table-content {\n overflow: visible !important;\n font-size: 14px;\n }\n\n .dumi-default-badge {\n &:not([type]) {\n color: ", ";\n background: ", ";\n border: 1px solid ", ";\n }\n\n &[type='warning'] {\n color: ", ";\n background: ", ";\n border: 1px solid ", ";\n }\n\n &[type='error'] {\n color: ", ";\n background: ", ";\n border: 1px solid ", ";\n }\n\n &[type='success'] {\n color: ", ";\n background: ", ";\n border: 1px solid ", ";\n }\n }\n "])), token.colorInfoText, token.colorInfoBg, token.colorInfoBorder, token.colorWarningText, token.colorWarningBg, token.colorWarningBorder, token.colorErrorText, token.colorErrorBg, token.colorErrorBorder, token.colorSuccessText, token.colorSuccessBg, token.colorSuccessBorder))
|
|
11
11
|
};
|
|
12
12
|
});
|
|
@@ -30,5 +30,6 @@ export interface SiteStore {
|
|
|
30
30
|
siteData: ISiteData;
|
|
31
31
|
tabMeta?: NonNullable<IRouteMeta['tabs']>[0]['meta'];
|
|
32
32
|
}
|
|
33
|
-
export declare const initialThemeConfig: SiteThemeConfig
|
|
33
|
+
export declare const initialThemeConfig: Partial<SiteThemeConfig>;
|
|
34
|
+
export declare const styles: string[];
|
|
34
35
|
export declare const initialState: SiteStore;
|
|
@@ -15,6 +15,7 @@ export var initialThemeConfig = {
|
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
};
|
|
18
|
+
export var styles = ["html, body { background: transparent; }\n\n @media (prefers-color-scheme: dark) {\n html, body { background: #000; }\n }"];
|
|
18
19
|
export var initialState = {
|
|
19
20
|
locale: {
|
|
20
21
|
id: 'en-US',
|
|
@@ -46,6 +47,7 @@ export var initialState = {
|
|
|
46
47
|
pkg: {},
|
|
47
48
|
// @ts-ignore
|
|
48
49
|
setLoading: undefined,
|
|
50
|
+
styles: styles,
|
|
49
51
|
// @ts-ignore
|
|
50
52
|
themeConfig: initialThemeConfig
|
|
51
53
|
}
|
|
@@ -29,6 +29,7 @@ export declare const siteSelectors: {
|
|
|
29
29
|
repoId: string;
|
|
30
30
|
} | undefined;
|
|
31
31
|
github: (s: SiteStore) => string;
|
|
32
|
+
hostname: (s: SiteStore) => string | undefined;
|
|
32
33
|
logo: (s: SiteStore) => string;
|
|
33
34
|
metadata: (s: SiteStore) => {
|
|
34
35
|
description?: string | undefined;
|
|
@@ -54,7 +55,7 @@ export declare const siteSelectors: {
|
|
|
54
55
|
} | undefined;
|
|
55
56
|
siteDesc: (s: SiteStore) => string | undefined;
|
|
56
57
|
siteTitle: (s: SiteStore) => string | undefined;
|
|
57
|
-
themeConfig: (s: SiteStore) => import("dumi/dist/client/theme-api/types").IThemeConfig & import("../../types").SiteThemeConfig
|
|
58
|
+
themeConfig: (s: SiteStore) => import("dumi/dist/client/theme-api/types").IThemeConfig & import("../../types").SiteThemeConfig & Partial<import("../../types").SiteThemeConfig>;
|
|
58
59
|
tocAnchorItem: (s: SiteStore) => AnchorItem[];
|
|
59
60
|
token: (s: SiteStore) => any;
|
|
60
61
|
};
|
|
@@ -93,6 +93,9 @@ var contentBottom = function contentBottom(s) {
|
|
|
93
93
|
prev: dataFlatten[currentIndex - 1]
|
|
94
94
|
};
|
|
95
95
|
};
|
|
96
|
+
var hostname = function hostname(s) {
|
|
97
|
+
return s.siteData.hostname;
|
|
98
|
+
};
|
|
96
99
|
export var siteSelectors = {
|
|
97
100
|
activePath: activePath,
|
|
98
101
|
analytics: analytics,
|
|
@@ -101,6 +104,7 @@ export var siteSelectors = {
|
|
|
101
104
|
flattenSidebar: flattenSidebar,
|
|
102
105
|
giscus: giscus,
|
|
103
106
|
github: github,
|
|
107
|
+
hostname: hostname,
|
|
104
108
|
logo: logo,
|
|
105
109
|
metadata: metadata,
|
|
106
110
|
siteDesc: siteDesc,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { ISiteContext } from 'dumi/dist/client/theme-api/context';
|
|
3
|
-
import { ILocale, INavItem, IRouteMeta, ISidebarGroup
|
|
3
|
+
import { ILocale, INavItem, IRouteMeta, ISidebarGroup } from 'dumi/dist/client/theme-api/types';
|
|
4
4
|
import type { Location } from 'history';
|
|
5
5
|
import { StoreApi } from 'zustand';
|
|
6
6
|
import { SiteThemeConfig } from "../types";
|
|
@@ -8,7 +8,7 @@ export type NavData = (INavItem & {
|
|
|
8
8
|
children?: INavItem[] | undefined;
|
|
9
9
|
})[];
|
|
10
10
|
export type ISiteData = ISiteContext & {
|
|
11
|
-
themeConfig:
|
|
11
|
+
themeConfig: SiteThemeConfig;
|
|
12
12
|
};
|
|
13
13
|
export interface SiteStore {
|
|
14
14
|
locale: ILocale;
|
package/dist/types/config.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { FeaturesProps, FooterProps, HeroProps, LogoProps } from '@lobehub/ui';
|
|
2
|
+
import { IThemeConfig } from 'dumi/dist/client/theme-api/types';
|
|
2
3
|
import { FooterColumn } from 'rc-footer/es/column';
|
|
3
4
|
import type { SiteCustomToken } from "../styles/customToken";
|
|
4
5
|
import type { HeroConfig } from './hero';
|
|
@@ -15,7 +16,7 @@ export interface FooterConfig {
|
|
|
15
16
|
moreProducts?: FooterColumn;
|
|
16
17
|
resources?: FooterColumn;
|
|
17
18
|
}
|
|
18
|
-
export interface SiteThemeConfig {
|
|
19
|
+
export interface SiteThemeConfig extends IThemeConfig {
|
|
19
20
|
actions?: HeroProps['actions'];
|
|
20
21
|
analytics?: {
|
|
21
22
|
clarity?: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dumi-theme-lobehub",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.0",
|
|
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,27 +0,0 @@
|
|
|
1
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
2
|
-
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
3
|
-
import { createStyles } from 'antd-style';
|
|
4
|
-
var toCamelCase = function toCamelCase(string_) {
|
|
5
|
-
return string_.replace(/( |^)[a-z]/g, function (L) {
|
|
6
|
-
return L.toUpperCase();
|
|
7
|
-
});
|
|
8
|
-
};
|
|
9
|
-
export var useStyles = createStyles(function (_ref) {
|
|
10
|
-
var token = _ref.token,
|
|
11
|
-
prefixCls = _ref.prefixCls,
|
|
12
|
-
css = _ref.css;
|
|
13
|
-
// 把首字母大写
|
|
14
|
-
|
|
15
|
-
var overwriteAlert = function overwriteAlert(type) {
|
|
16
|
-
var tokens = {
|
|
17
|
-
background: token["color".concat(toCamelCase(type), "Bg")],
|
|
18
|
-
text: token["color".concat(toCamelCase(type), "Text")]
|
|
19
|
-
};
|
|
20
|
-
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .", "-alert-", " {\n background: ", ";\n\n .", "-alert-message {\n font-weight: bold;\n color: ", ";\n }\n\n .", "-alert-description {\n .markdown {\n color: ", ";\n }\n }\n }\n "])), prefixCls, type, tokens.background, prefixCls, tokens.text, prefixCls, tokens.text);
|
|
21
|
-
};
|
|
22
|
-
return {
|
|
23
|
-
alert: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n border: none;\n\n .", "-alert-message {\n font-weight: bold;\n }\n "])), prefixCls),
|
|
24
|
-
container: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n margin: 8px 0;\n\n ", "\n\n ", "\n\n ", "\n\n ", "\n "])), overwriteAlert('info'), overwriteAlert('warning'), overwriteAlert('success'), overwriteAlert('error')),
|
|
25
|
-
desc: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n p {\n margin: 0;\n }\n "])))
|
|
26
|
-
};
|
|
27
|
-
});
|
package/dist/config.d.ts
DELETED
package/dist/config.js
DELETED