dumi-theme-lobehub 1.8.6 → 1.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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: HeroProps['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: FeaturesProps['items'];
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?: {
package/dist/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
- export { defineThemeConfig } from './config';
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
+ };
@@ -1,6 +1,5 @@
1
- import { useLocation } from "../../../example/.dumi/tmp/exports";
2
1
  import { ThemeProvider } from '@lobehub/ui';
3
- import { useLocale, useNavData, useOutlet, useRouteMeta, useSidebarData, useSiteData, useTabMeta } from 'dumi';
2
+ import { useLocale, useLocation, useNavData, useOutlet, useRouteMeta, useSidebarData, useSiteData, useTabMeta } from 'dumi';
4
3
  import isEqual from 'fast-deep-equal';
5
4
  import { memo, useMemo } from 'react';
6
5
  import Analytics from "../../components/Analytics";
@@ -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, 3),
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,
@@ -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, IThemeConfig } from 'dumi/dist/client/theme-api/types';
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: IThemeConfig & SiteThemeConfig;
11
+ themeConfig: SiteThemeConfig;
12
12
  };
13
13
  export interface SiteStore {
14
14
  locale: ILocale;
@@ -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.8.6",
3
+ "version": "1.9.1",
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",
package/dist/config.d.ts DELETED
@@ -1,2 +0,0 @@
1
- import { SiteThemeConfig } from './types';
2
- export declare const defineThemeConfig: (config: SiteThemeConfig) => SiteThemeConfig;
package/dist/config.js DELETED
@@ -1,3 +0,0 @@
1
- export var defineThemeConfig = function defineThemeConfig(config) {
2
- return config;
3
- };