@alauda/doom 1.20.3 → 1.20.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/lib/cli/export.js CHANGED
@@ -123,7 +123,7 @@ export const exportCommand = new Command('export')
123
123
  children = generateOutlinesFromSidebar(item.items);
124
124
  }
125
125
  if ('link' in item && item.link) {
126
- const page = pageMap.get(`${item.link}.html`);
126
+ const page = pageMap.get(`${config.base}${removeLeadingSlash(item.link)}.html`);
127
127
  if (page != null) {
128
128
  result.push({
129
129
  title: page.title || item.text,
@@ -52,13 +52,13 @@ const fetchSiteOverrides = async (version, acpSite) => {
52
52
  }))
53
53
  .catch(() => ({ terms: namedTerms }))
54
54
  .then(({ terms, ...siteOverrides }) => {
55
- normalizedSiteOverrides = normalizeOverrides(siteOverrides);
55
+ const overrides = normalizeOverrides(siteOverrides);
56
56
  const normalizedTerms = normalizeOverrides(terms);
57
- return {
58
- en: { ...normalizedSiteOverrides.en, terms: normalizedTerms.en },
59
- zh: { ...normalizedSiteOverrides.zh, terms: normalizedTerms.zh },
60
- ru: { ...normalizedSiteOverrides.ru, terms: normalizedTerms.ru },
61
- };
57
+ return (normalizedSiteOverrides = {
58
+ en: { ...overrides.en, terms: normalizedTerms.en },
59
+ zh: { ...overrides.zh, terms: normalizedTerms.zh },
60
+ ru: { ...overrides.ru, terms: normalizedTerms.ru },
61
+ });
62
62
  }));
63
63
  };
64
64
  export const useSiteOverrides = () => {
@@ -1,3 +1,3 @@
1
1
  import type { Language } from '../../shared/index.js';
2
2
  export declare const useLang: () => Language;
3
- export declare const useTranslation: () => (key: "function" | "name" | "description" | "delete" | "toc" | "create" | "update" | "password" | "close" | "collapse_all" | "expand_all" | "crd_no_schema" | "action" | "view" | "chinese" | "english" | "chinese_bad_cases" | "english_bad_cases" | "download_pdf" | "view_docs_as_pdf" | "ai_assistant" | "exclamation" | "semicolon" | "period" | "colon" | "user_login" | "user_login_tip1" | "user_login_tip2" | "customer_portal_global" | "customer_portal_china" | "account_id" | "username" | "captcha" | "login" | "current_field" | "field_required" | "ERR_INTERNET_DISCONNECTED" | "AccountDisabledError" | "CaptchaError" | "LoginError" | "NetworkError" | "TenantError" | "TenantNotFoundError" | "logout" | "hi_there" | "ai_assistant_tip" | "ai_assistant_placeholder" | "max_chars_exceeded_tip" | "thinking" | "thinking_process" | "referenced_doc_links" | "view_more_related_docs" | "view_less_related_docs" | "new_chat") => string;
3
+ export declare const useTranslation: () => (key: "function" | "name" | "description" | "delete" | "toc" | "create" | "update" | "password" | "close" | "collapse_all" | "expand_all" | "crd_no_schema" | "action" | "view" | "chinese" | "english" | "chinese_bad_cases" | "english_bad_cases" | "download_pdf" | "view_docs_as_pdf" | "ai_assistant" | "exclamation" | "semicolon" | "period" | "colon" | "user_login" | "user_login_tip1" | "user_login_tip2" | "customer_portal_global" | "customer_portal_china" | "account_id" | "username" | "captcha" | "login" | "current_field" | "field_required" | "ERR_INTERNET_DISCONNECTED" | "AccountDisabledError" | "CaptchaError" | "LoginError" | "NetworkError" | "TenantError" | "TenantNotFoundError" | "logout" | "hi_there" | "ai_assistant_tip" | "ai_assistant_placeholder" | "max_chars_exceeded_tip" | "thinking" | "thinking_process" | "referenced_doc_links" | "view_more_related_docs" | "view_less_related_docs" | "new_chat" | "show_more" | "show_less") => string;
@@ -53,6 +53,8 @@ declare const en: {
53
53
  view_more_related_docs: string;
54
54
  view_less_related_docs: string;
55
55
  new_chat: string;
56
+ show_more: string;
57
+ show_less: string;
56
58
  };
57
59
  export type Translation = typeof en;
58
60
  export declare const TRANSLATIONS: {
@@ -111,6 +113,8 @@ export declare const TRANSLATIONS: {
111
113
  view_more_related_docs: string;
112
114
  view_less_related_docs: string;
113
115
  new_chat: string;
116
+ show_more: string;
117
+ show_less: string;
114
118
  };
115
119
  zh: {
116
120
  collapse_all: string;
@@ -167,6 +171,8 @@ export declare const TRANSLATIONS: {
167
171
  view_more_related_docs: string;
168
172
  view_less_related_docs: string;
169
173
  new_chat: string;
174
+ show_more: string;
175
+ show_less: string;
170
176
  };
171
177
  ru: {
172
178
  collapse_all: string;
@@ -223,6 +229,8 @@ export declare const TRANSLATIONS: {
223
229
  view_more_related_docs: string;
224
230
  view_less_related_docs: string;
225
231
  new_chat: string;
232
+ show_more: string;
233
+ show_less: string;
226
234
  };
227
235
  };
228
236
  export {};
@@ -53,6 +53,8 @@ const en = {
53
53
  view_more_related_docs: 'View more related docs',
54
54
  view_less_related_docs: 'View less related docs',
55
55
  new_chat: 'New Chat',
56
+ show_more: 'Show more',
57
+ show_less: 'Show less',
56
58
  };
57
59
  const zh = {
58
60
  collapse_all: '全部收起',
@@ -109,6 +111,8 @@ const zh = {
109
111
  view_more_related_docs: '查看更多相关文档',
110
112
  view_less_related_docs: '查看更少相关文档',
111
113
  new_chat: '新会话',
114
+ show_more: '显示更多',
115
+ show_less: '显示更少',
112
116
  };
113
117
  const ru = {
114
118
  collapse_all: 'Свернуть всё',
@@ -165,5 +169,7 @@ const ru = {
165
169
  view_more_related_docs: 'Посмотреть больше связанных документов',
166
170
  view_less_related_docs: 'Посмотреть меньше связанных документов',
167
171
  new_chat: 'Новый чат',
172
+ show_more: 'Показать больше',
173
+ show_less: 'Показать меньше',
168
174
  };
169
175
  export const TRANSLATIONS = { en, zh, ru };
@@ -2,27 +2,45 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { IconDown, SvgWrapper } from '@rspress/core/theme';
3
3
  import { clsx } from 'clsx';
4
4
  import { useCallback, useEffect, useRef, useState } from 'react';
5
+ import { useIsPrint, useTranslation } from '../runtime/index.js';
5
6
  import classes from '@alauda/doom/styles/auto-expandable.module.scss';
6
7
  export const AutoExpandable = ({ threshold = 240, children, }) => {
8
+ const t = useTranslation();
7
9
  const ref = useRef(null);
10
+ const isPrint = useIsPrint();
8
11
  const [expandable, setExpandable] = useState(false);
9
12
  const [expanded, setExpanded] = useState(false);
10
13
  useEffect(() => {
11
- if (!ref.current) {
14
+ const containerEl = ref.current;
15
+ if (!containerEl || isPrint) {
12
16
  return;
13
17
  }
14
- if (ref.current.scrollHeight > threshold) {
15
- // eslint-disable-next-line react-hooks/set-state-in-effect, @eslint-react/hooks-extra/no-direct-set-state-in-use-effect
16
- setExpandable(true);
18
+ let observer;
19
+ const calculate = () => {
20
+ if (containerEl.scrollHeight > threshold) {
21
+ // eslint-disable-next-line @eslint-react/hooks-extra/no-direct-set-state-in-use-effect
22
+ setExpandable(true);
23
+ }
24
+ observer?.disconnect();
25
+ };
26
+ calculate();
27
+ const tabItem = containerEl.closest('.rp-tabs__content__item--hidden');
28
+ if (tabItem) {
29
+ observer = new MutationObserver(calculate);
30
+ observer.observe(tabItem, { attributeFilter: ['class'] });
31
+ return () => {
32
+ observer?.disconnect();
33
+ };
17
34
  }
18
- }, [threshold]);
35
+ }, [threshold, isPrint]);
19
36
  const onExpandChange = useCallback(() => {
20
37
  setExpanded((expanded) => !expanded);
21
38
  }, []);
22
- return (_jsxs("div", { ref: ref, className: classes.container, children: [_jsx("div", { className: clsx({
39
+ return (_jsxs("div", { ref: ref, className: `${classes.container} auto-expandable`, children: [_jsx("div", { className: clsx({
40
+ expandable,
23
41
  [classes.expandable]: expandable,
24
42
  [classes.expanded]: expanded,
25
- }), children: children }), expandable && (_jsx("div", { className: classes.actionContainer, children: _jsxs("button", { className: classes.action, type: "button", onClick: onExpandChange, "aria-expanded": expanded, children: ["Show ", expanded ? 'less' : 'more', _jsx(SvgWrapper, { className: clsx(classes.arrow, {
43
+ }), children: children }), expandable && (_jsx("div", { className: classes.actionContainer, children: _jsxs("button", { className: classes.action, type: "button", onClick: onExpandChange, "aria-expanded": expanded, children: [t(`show_${expanded ? 'less' : 'more'}`), _jsx(SvgWrapper, { className: clsx(classes.arrow, {
26
44
  [classes.expanded]: expanded,
27
45
  }), icon: IconDown })] }) }))] }));
28
46
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alauda/doom",
3
- "version": "1.20.3",
3
+ "version": "1.20.5",
4
4
  "type": "module",
5
5
  "description": "Doctor Doom making docs.",
6
6
  "repository": {
@@ -40,7 +40,7 @@
40
40
  "rspress-plugins"
41
41
  ],
42
42
  "dependencies": {
43
- "@alauda/doom-export": "^0.4.0",
43
+ "@alauda/doom-export": "^0.4.1",
44
44
  "@cspell/eslint-plugin": "^9.7.0",
45
45
  "@eslint-react/eslint-plugin": "^2.13.0",
46
46
  "@inquirer/prompts": "^8.3.0",
@@ -49,11 +49,11 @@
49
49
  "@rsbuild/plugin-sass": "^1.5.0",
50
50
  "@rsbuild/plugin-svgr": "^1.3.0",
51
51
  "@rsbuild/plugin-yaml": "^1.0.4",
52
- "@rspress/core": "2.0.2",
53
- "@rspress/plugin-algolia": "2.0.2",
54
- "@rspress/plugin-sitemap": "2.0.2",
55
- "@rspress/shared": "2.0.2",
56
- "@shikijs/transformers": "^3.22.0",
52
+ "@rspress/core": "2.0.4",
53
+ "@rspress/plugin-algolia": "2.0.4",
54
+ "@rspress/plugin-sitemap": "2.0.4",
55
+ "@rspress/shared": "2.0.4",
56
+ "@shikijs/transformers": "^4.0.1",
57
57
  "@total-typescript/ts-reset": "^0.6.1",
58
58
  "@types/react": "^19.2.14",
59
59
  "ab64": "^0.1.6",
@@ -61,10 +61,10 @@
61
61
  "clsx": "^2.1.1",
62
62
  "commander": "^14.0.3",
63
63
  "ejs": "^4.0.1",
64
- "es-toolkit": "^1.44.0",
64
+ "es-toolkit": "^1.45.0",
65
65
  "eslint": "^9.39.3",
66
- "eslint-plugin-mdx": "^3.6.2",
67
- "globals": "^17.3.0",
66
+ "eslint-plugin-mdx": "^3.7.0",
67
+ "globals": "^17.4.0",
68
68
  "html-tag-names": "^2.1.0",
69
69
  "jsencrypt": "^3.5.4",
70
70
  "masonry-layout": "^4.2.2",
@@ -74,7 +74,7 @@
74
74
  "mdast-util-to-markdown": "^2.1.2",
75
75
  "mdast-util-to-string": "^4.0.0",
76
76
  "mermaid": "^11.12.3",
77
- "openai": "^6.24.0",
77
+ "openai": "^6.25.0",
78
78
  "openapi-types": "^12.1.3",
79
79
  "p-ratelimit": "^1.0.1",
80
80
  "picomatch": "^4.0.3",
@@ -95,8 +95,8 @@
95
95
  "remark-mdx": "^3.1.1",
96
96
  "remark-message-control": "^8.0.0",
97
97
  "remark-stringify": "^11.0.0",
98
- "shiki": "^3.22.0",
99
- "simple-git": "^3.32.2",
98
+ "shiki": "^4.0.1",
99
+ "simple-git": "^3.32.3",
100
100
  "string-width": "^8.2.0",
101
101
  "swagger2openapi": "^7.0.8",
102
102
  "tinyglobby": "^0.2.15",
@@ -1,7 +1,10 @@
1
1
  .container {
2
+ margin: 1rem 0;
3
+
2
4
  &:has(.expandable :global .rp-codeblock) {
3
5
  border: var(--rp-code-block-border);
4
6
  border-radius: var(--rp-radius);
7
+ overflow: hidden;
5
8
  }
6
9
 
7
10
  .expandable {
@@ -94,17 +94,6 @@ td {
94
94
  }
95
95
  }
96
96
 
97
- .doom-tabs {
98
- div.language-mdx {
99
- margin: 24px 0;
100
- }
101
-
102
- .language-mdx {
103
- // https://github.com/web-infra-dev/rspress/blob/bbe6476c8394f9c95a98fd791f0614481f89d878/packages/theme-default/src/styles/code.css#L6
104
- --rp-code-block-bg: #{color.adjust($color: #f6f8fa, $lightness: -5%)};
105
- }
106
- }
107
-
108
97
  .doom-auto-toc {
109
98
  @media (min-width: 1280px) {
110
99
  display: none;
@@ -125,12 +114,25 @@ td {
125
114
  }
126
115
  }
127
116
 
128
- .dark .doom-tabs .language-mdx {
129
- // https://github.com/web-infra-dev/rspress/blob/bbe6476c8394f9c95a98fd791f0614481f89d878/packages/theme-default/src/styles/code.css#L17
130
- --rp-code-block-bg: #{color.adjust($color: #242424, $lightness: 5%)};
117
+ .auto-expandable:has(> div > .rp-codeblock) {
118
+ background-color: var(--rp-code-block-bg);
119
+ }
120
+
121
+ .dark .rp-tabs .auto-expandable:has(> div > .rp-codeblock) {
122
+ // https://github.com/web-infra-dev/rspress/blob/66fe9f837f4cecab859b57f6f10efc6d4d413f1b/packages/core/src/theme/styles/vars/base-vars.css#L26
123
+ --rp-code-block-bg: #{color.adjust($color: #121212, $lightness: 5%)};
124
+ }
125
+
126
+ .rp-tabs .auto-expandable:has(> div > .rp-codeblock) {
127
+ // https://github.com/web-infra-dev/rspress/blob/66fe9f837f4cecab859b57f6f10efc6d4d413f1b/packages/core/src/theme/styles/vars/base-vars.css#L3
128
+ --rp-code-block-bg: #{color.adjust($color: #fff, $lightness: -5%)};
131
129
  }
132
130
 
133
131
  .rp {
132
+ &-hover-group__item--active a[target='_blank']:after {
133
+ display: none;
134
+ }
135
+
134
136
  &-sidebar-item {
135
137
  word-break: break-word;
136
138
  }
@@ -171,6 +173,23 @@ td {
171
173
  content: counters(section, '.') '. ';
172
174
  }
173
175
  }
176
+
177
+ &-tabs {
178
+ &__content {
179
+ &__item {
180
+ padding: 0 1rem;
181
+
182
+ > :first-child,
183
+ > :last-child {
184
+ margin: 1rem 0;
185
+ }
186
+ }
187
+ }
188
+ }
189
+
190
+ &-table-scroll-container:has(> table) {
191
+ margin: 1rem 0;
192
+ }
174
193
  }
175
194
 
176
195
  @mixin print {
@@ -178,12 +197,17 @@ td {
178
197
  &-nav,
179
198
  &-doc-layout__menu,
180
199
  &-doc-footer,
200
+ &-doc-layout__outline,
181
201
  &-doc-layout__sidebar {
182
202
  display: none;
183
203
  }
184
204
 
185
- &-doc-layout__doc-container {
186
- padding: 0;
205
+ &-doc-layout__doc {
206
+ max-width: unset;
207
+
208
+ &-container {
209
+ padding: 0;
210
+ }
187
211
  }
188
212
 
189
213
  &-toc-item--active .rp-toc-item__text {