@alauda/doom 0.15.5 → 0.15.7

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/assets/logo.svg CHANGED
@@ -1 +1 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="176" height="176" fill="none" fill-rule="evenodd" xmlns:v="https://vecta.io/nano"><path fill="#d8d8d8" opacity="0" d="M-8-12h200v200H-8z"/><g fill-rule="nonzero"><path d="M87.833 21.333c26.676 0 49.476 19.026 54.897 45.198l-5.879-2.798c-.977-.489-2.074-.733-3.173-.733a7.12 7.12 0 0 0-3.173.733L99.635 78.498c-2.014.976-3.477 2.746-3.966 4.941l-7.627 33.128c-.549 2.197 0 4.454 1.403 6.222l21.355 26.542c.609.768 1.345 1.386 2.162 1.84H40.539c-20.62-.063-37.871-15.908-39.99-36.729s11.578-39.912 31.75-44.252c3.967-28.039 27.63-48.857 55.534-48.857z" fill="#4da2f8"/><path d="M84.293 95.674l2.909 2.62 2.957 2.747 1.197 1.135-3.313 14.392c-.549 2.197 0 4.454 1.403 6.222l21.355 26.542c.609.768 1.345 1.386 2.162 1.84H40.539c-20.62-.063-37.871-15.908-39.99-36.729s11.578-39.912 31.75-44.252C45.8 68.435 63.132 76.93 84.293 95.674z" fill="#b3d7fc"/><path d="M175.166 115.81l-6.933-30.118c-.444-1.996-1.775-3.604-3.605-4.492l-28.065-13.367a6.47 6.47 0 0 0-2.884-.666 6.47 6.47 0 0 0-2.884.666l-28.065 13.423c-1.831.887-3.161 2.496-3.605 4.492l-6.933 30.117c-.499 1.997 0 4.049 1.275 5.657l19.413 24.129a6.54 6.54 0 0 0 5.158 2.495l31.28-.054c1.997 0 3.883-.943 5.158-2.496l19.415-24.127c1.275-1.608 1.719-3.661 1.275-5.657h0z" fill="#007af5"/><path d="M161.577 116.865c-.166 0-.278 0-.444-.057-.056-.054-.11-.054-.166-.054-.11 0-.222-.056-.332-.056-.388-.11-.666-.222-.999-.388-.166-.056-.332-.166-.499-.222h-.056c-1.055-.387-1.996-.721-2.884-.831h-.11c-.334 0-.5.166-.722.277-.054 0-.054.056-.11.056l-.666-.112a21.5 21.5 0 0 1-2.328 4.992c-1.887 2.996-4.382 5.436-7.322 7.156l.277.665c0 .056-.054.056-.054.11-.056.278-.166.502-.056.888.278.831.832 1.664 1.441 2.608v.054c.112.166.222.278.334.443.222.278.443.556.61.888.054.056.11.166.166.278 0 .056.054.056.054.11.222.444.222.943.11 1.387s-.443.777-.831.999a1.48 1.48 0 0 1-.665.166c-.666 0-1.331-.388-1.665-1.055 0 0-.054-.054-.054-.11-.056-.11-.112-.166-.166-.278-.168-.332-.222-.665-.334-.997l-.166-.5v-.054c-.388-1.055-.721-1.997-1.165-2.774-.222-.332-.443-.444-.721-.499-.056-.056-.056-.056-.11-.056l-.334-.609a24.66 24.66 0 0 1-2.884.831c-1.552.388-3.217.555-4.824.555a21.67 21.67 0 0 1-7.766-1.443l-.388.722c-.054.054-.054.054-.11.054-.222.112-.499.168-.721.5-.5.777-.778 1.663-1.165 2.773l-.166.5c-.112.332-.166.61-.334.997-.068.085-.123.178-.166.278 0 0-.054.056-.054.11-.332.61-.999 1.055-1.665 1.055-.221 0-.443-.056-.665-.166-.832-.388-1.165-1.443-.721-2.386 0 0 .054-.054.054-.11.056-.112.112-.222.166-.277.223-.334.388-.612.61-.888.112-.166.222-.278.332-.444v-.054c.612-.944 1.11-1.775 1.443-2.606.11-.39 0-.666-.112-.888 0-.054-.054-.054-.054-.112l.332-.721a22.46 22.46 0 0 1-2.386-1.608c-3.397-2.683-5.925-6.311-7.264-10.428l-.777.112c-.056 0-.056-.056-.112-.056-.166-.112-.388-.276-.721-.276h-.11c-.888.11-1.831.443-2.884.831h-.056c-.166.056-.332.166-.499.222-.334.166-.612.276-.999.388-.112 0-.222.054-.332.054 0 .056-.056.056-.112.056-.166.056-.277.056-.444.056-.885 0-1.608-.499-1.774-1.275-.166-.888.443-1.831 1.441-2.053.056-.054.112-.054.166-.054.112 0 .222-.056.334-.056.388-.054.721-.112 1.053-.112.168-.054.388-.054.555-.054h.056c1.165-.112 2.164-.222 2.995-.5a1.29 1.29 0 0 0 .61-.609c0-.056.056-.056.056-.112l.721-.221c-.721-5.104.332-10.262 3.106-14.644.054-.166.166-.278.277-.444l-.555-.499v-.112c0-.277 0-.555-.276-.831-.666-.61-1.499-1.109-2.496-1.719-.168-.112-.334-.222-.5-.278-.332-.166-.61-.332-.943-.555-.11-.056-.166-.165-.277-.222-.056 0-.056-.054-.112-.054-.777-.666-.943-1.775-.387-2.496.277-.388.775-.61 1.275-.61a1.94 1.94 0 0 1 1.219.444c0 .054.054.054.112.11.11.11.221.166.276.222.278.277.5.499.722.777.165.11.277.277.387.388.777.831 1.497 1.553 2.219 2.052.146.104.32.162.499.166.112 0 .222-.054.332-.054h.112l.555.387a21.38 21.38 0 0 1 10.983-6.211c.997-.222 1.996-.332 2.995-.444l.054-.721.112-.11c.166-.168.387-.334.444-.722.11-.887-.056-1.886-.168-2.995v-.056c-.054-.222-.054-.388-.11-.555-.11-.332-.166-.666-.166-1.053v-.444c-.013-.475.167-.935.499-1.275.332-.334.777-.555 1.221-.555.943 0 1.719.831 1.719 1.83v.499l-.166 1.055c-.056.168-.112.388-.112.555v.056c-.11 1.109-.222 2.106-.166 2.995.056.388.278.555.444.721l.11.112.056.721a22.15 22.15 0 0 1 11.592 4.604c.777.665 1.553 1.331 2.274 2.108l.666-.444h.11c.112.056.222.056.334.056.179-.004.353-.062.499-.166.721-.5 1.441-1.166 2.219-1.997.165-.11.277-.277.387-.388a9.38 9.38 0 0 1 .722-.777c.11-.054.166-.165.276-.222l.112-.11c.388-.278.775-.444 1.219-.444.5 0 .999.223 1.275.61.556.721.388 1.831-.388 2.496 0 .056-.054.056-.11.11-.11.112-.222.168-.276.222-.334.222-.61.388-.944.555-.166.112-.332.168-.499.278-.999.61-1.83 1.109-2.496 1.719-.222.278-.277.555-.277.832v.11l-.556.5c1.45 2.223 2.502 4.681 3.108 7.264.609 2.608.719 5.27.387 7.82l.721.222c0 .056.056.056.056.112.112.222.222.443.61.61.888.277 1.83.387 2.995.497h.056c.222.057.388.057.555.057.332 0 .666.054 1.055.11.11 0 .221.056.332.056 0 .054.056.054.11.054h.056c.999.278 1.609 1.165 1.609 1.831-.222.721-.944 1.277-1.775 1.277h0z" fill="#fff"/><path d="M136.563 101.5c.468.59 1.304.733 1.942.332l7.264-5.158h.001a16.84 16.84 0 0 0-9.984-4.826l.499 9.041c.056.222.112.443.278.61h0zm-11.036 6.434c.499-.61.443-1.553-.168-2.052l-6.6-5.88c-1.997 3.273-2.828 7.1-2.496 10.872l8.597-2.496a1.1 1.1 0 0 0 .666-.444h0zm3.937-5.825c.832 0 1.441-.665 1.497-1.441l.499-8.875-1.774.334h-.001a16.92 16.92 0 0 0-8.265 4.548l7.378 5.269c.168.112.444.166.666.166h0zm1.718 8.931l2.44 1.165 2.44-1.165.555-2.608-1.664-2.106h-2.718l-1.664 2.106zm9.097 2.608c-.634.316-.959 1.035-.777 1.719l3.493 8.373c2.108-1.387 3.937-3.161 5.324-5.379h.001c.721-1.053 1.277-2.162 1.609-3.383l-8.875-1.497c-.277 0-.555.056-.777.166zm10.259-8.376a17.77 17.77 0 0 0-2.106-5.27l-6.711 6.047a1.32 1.32 0 0 0-.334.61c-.173.777.289 1.555 1.055 1.774l8.485 2.442a17.43 17.43 0 0 0-.387-5.602h-.001 0zm-24.457 8.264l-8.819 1.496v.001a17.48 17.48 0 0 0 6.932 8.707l3.384-8.153c.112-.278.112-.555.054-.887-.166-.721-.831-1.222-1.552-1.165h0zm8.096 3.772c-.61-.332-1.33-.112-1.774.388l-4.383 7.931c1.777.555 3.661.888 5.602.888 1.333 0 2.608-.166 3.883-.444l1.608-.444-4.27-7.709a2.33 2.33 0 0 0-.666-.61h0z" fill="#007af5"/></g></svg>
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><title>alauda_Blue</title><g id="de0a135b-885c-4036-939d-50f62fab32b6" data-name="Brand Logo"><path d="M31,16V31H24.41V15.93A8.34,8.34,0,0,0,8.13,13.34L5.65,14.56l2.08,1.73C8,20.39,9.41,27.26,21.44,31H15.92A15,15,0,1,1,31,16Z" fill="#3baee4"/><path d="M14.23,16.63a1.74,1.74,0,1,1-1.73-1.74A1.72,1.72,0,0,1,14.23,16.63Z" fill="#3baee4"/></g></svg>
@@ -113,6 +113,9 @@ const getCommonConfig = ({ config, root, configFilePath, base, version, download
113
113
  }),
114
114
  ],
115
115
  builderConfig: {
116
+ dev: {
117
+ lazyCompilation: true,
118
+ },
116
119
  plugins: [pluginYaml()],
117
120
  server: {
118
121
  open,
@@ -52,9 +52,6 @@ export const rehypePluginShiki = ({ highlighter, theme }) => (tree) => {
52
52
  parent?.children.splice(index, 1, {
53
53
  type: 'element',
54
54
  tagName: 'pre',
55
- properties: {
56
- className: 'code',
57
- },
58
55
  children: fragmentAst.children,
59
56
  });
60
57
  }
@@ -1,6 +1,7 @@
1
1
  import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
2
  import { NoSSR, useLang } from '@rspress/core/runtime';
3
- import { addTrailingSlash, isExternalUrl, removeLeadingSlash, } from '@rspress/shared';
3
+ import { addTrailingSlash, isExternalUrl, normalizeHref, parseUrl, removeLeadingSlash, } from '@rspress/shared';
4
+ import { DEFAULT_PAGE_EXTENSIONS } from '@rspress/shared/constants';
4
5
  import { clsx } from 'clsx';
5
6
  import virtual from 'doom-@global-virtual';
6
7
  import { useMemo } from 'react';
@@ -17,13 +18,21 @@ const ExternalSiteLink_ = ({ name, href = '', className, ...props }) => {
17
18
  if (isExternalUrl(href)) {
18
19
  return _jsxs(Directive, { type: "danger", children: ["Invalid href `", href, "` found"] });
19
20
  }
21
+ let { url, hash } = parseUrl(href);
22
+ const extname = url.split('.').pop();
23
+ if (extname) {
24
+ if (DEFAULT_PAGE_EXTENSIONS.includes(`.${extname}`)) {
25
+ url = url.replace(new RegExp(`\\.${extname}$`), '');
26
+ }
27
+ }
28
+ url = removeLeadingSlash(normalizeHref(url));
20
29
  return (_jsx("a", { href: (isPrint ? 'https://docs.alauda.io' : '') +
21
30
  (virtual.prefix || '') +
22
31
  (virtual.version
23
32
  ? addTrailingSlash(site.base + site.version)
24
33
  : site.base) +
25
34
  (lang ? addTrailingSlash(lang) : '') +
26
- removeLeadingSlash(href), target: "_blank", rel: "noopener noreferrer", className: clsx(classes.link, 'cursor-pointer', className), ...props }));
35
+ (hash ? `${url}#${hash}` : url), target: "_blank", rel: "noopener noreferrer", className: clsx(classes.link, 'cursor-pointer', className), ...props }));
27
36
  };
28
37
  export const ExternalSiteLink = (props) => (_jsx(NoSSR, { children: _jsx(ExternalSiteLink_, { ...props }) }));
29
38
  export default ExternalSiteLink;
@@ -7,7 +7,7 @@ import BananaSlug from 'github-slugger';
7
7
  import { OpenAPIV3 } from 'openapi-types';
8
8
  import { Fragment, useMemo, useState } from 'react';
9
9
  import { omitRoutePathRefs, resolveRef } from '../utils.js';
10
- import { OpenAPIRef } from './OpenAPIRef.js';
10
+ import { OpenAPIProperties, OpenAPIProperty, OpenAPIRef } from './OpenAPIRef.js';
11
11
  import { HeadingTitle } from './_HeadingTitle.js';
12
12
  import { Markdown } from './_Markdown.js';
13
13
  import { RefLink } from './_RefLink.js';
@@ -35,12 +35,26 @@ export const OpenAPIResponses = ({ responses, openapi, }) => {
35
35
  const responseObj = '$ref' in response
36
36
  ? resolveRef(openapi, response.$ref)
37
37
  : response;
38
- const schema = responseObj.content?.['application/json'].schema;
39
- let refNode;
40
- if (schema && '$ref' in schema) {
41
- refNode = (_jsxs(_Fragment, { children: ["(", _jsx(RefLink, { "$ref": schema.$ref }), ")"] }));
38
+ const responseContent = responseObj.content;
39
+ const schema = (responseContent?.['application/json'] ?? responseContent?.['*/*'])?.schema;
40
+ const type = schema && ('$ref' in schema ? schema : schema.type);
41
+ let typeNode;
42
+ let extraNode;
43
+ if (typeof type === 'string') {
44
+ typeNode = _jsx("code", { children: type });
45
+ if (type === 'object' &&
46
+ 'properties' in schema &&
47
+ schema.properties) {
48
+ extraNode = (_jsxs("div", { className: "my-4", children: ["Properties:", _jsx(OpenAPIProperties, { properties: schema.properties, openapi: openapi })] }));
49
+ }
50
+ else if (type === 'array' && 'items' in schema && schema.items) {
51
+ extraNode = (_jsxs("div", { className: "my-4", children: ["Items:", _jsx(OpenAPIProperty, { property: schema.items, openapi: openapi })] }));
52
+ }
53
+ }
54
+ else if (type && '$ref' in type) {
55
+ typeNode = _jsx(RefLink, { "$ref": type.$ref });
42
56
  }
43
- return (_jsxs(X.li, { children: [_jsx("code", { children: code }), refNode, ": ", responseObj.description] }, code));
57
+ return (_jsxs(X.li, { children: [_jsx("code", { children: code }), typeNode, ": ", responseObj.description, extraNode] }, code));
44
58
  }) }));
45
59
  };
46
60
  const getRefsForPath = (openapi, path, knownRefs) => {
@@ -10,6 +10,11 @@ export interface OpenAPIRefProps {
10
10
  openapiPath?: string;
11
11
  collectRefs?: boolean;
12
12
  }
13
+ export declare const OpenAPIProperty: ({ name, property, openapi, }: {
14
+ name?: string;
15
+ property: OpenAPIV3_1.ReferenceObject | OpenAPIV3_1.SchemaObject;
16
+ openapi: OpenAPIV3_1.Document;
17
+ }) => import("react/jsx-runtime").JSX.Element;
13
18
  export declare const OpenAPIProperties: ({ properties, openapi, }: {
14
19
  properties: Record<string, OpenAPIV3_1.ReferenceObject | OpenAPIV3_1.SchemaObject>;
15
20
  openapi: OpenAPIV3_1.Document;
@@ -7,41 +7,40 @@ import { modelName, omitRoutePathRefs, resolveRef } from '../utils.js';
7
7
  import { HeadingTitle } from './_HeadingTitle.js';
8
8
  import { Markdown } from './_Markdown.js';
9
9
  import { RefLink } from './_RefLink.js';
10
+ export const OpenAPIProperty = ({ name, property, openapi, }) => {
11
+ const propObj = '$ref' in property ? resolveRef(openapi, property.$ref) : property;
12
+ const type = propObj.type;
13
+ let typeNode;
14
+ if (type === 'array') {
15
+ const { items } = propObj;
16
+ const itemsObj = '$ref' in items ? resolveRef(openapi, items.$ref) : items;
17
+ const itemsType = itemsObj.type;
18
+ typeNode = (_jsxs("code", { children: ["[]", '$ref' in items ? _jsx(RefLink, { "$ref": items.$ref }) : itemsType] }));
19
+ }
20
+ else if (type === 'object') {
21
+ if (typeof propObj.additionalProperties === 'object') {
22
+ const props = propObj.additionalProperties;
23
+ const propsObj = '$ref' in props ? resolveRef(openapi, props.$ref) : props;
24
+ const propsType = propsObj.type;
25
+ typeNode = (_jsxs("code", { children: ["map[string]", typeof propsType === 'string'
26
+ ? propsType
27
+ : '$ref' in props && _jsx(RefLink, { "$ref": props.$ref })] }));
28
+ }
29
+ else {
30
+ typeNode = _jsx("code", { children: type });
31
+ }
32
+ }
33
+ else if (typeof type === 'string') {
34
+ typeNode = _jsx("code", { children: type });
35
+ }
36
+ else if ('$ref' in property) {
37
+ typeNode = _jsx(RefLink, { "$ref": property.$ref });
38
+ }
39
+ return (_jsxs(_Fragment, { children: [name && (_jsxs(_Fragment, { children: [_jsx("code", { children: name }), ":", ' '] })), typeNode, _jsx(Markdown, { children: propObj.description })] }));
40
+ };
10
41
  export const OpenAPIProperties = ({ properties, openapi, }) => {
11
42
  const [X] = useState(getCustomMDXComponent);
12
- return (_jsx(X.ul, { children: Object.entries(properties).map(([name, prop], index) => {
13
- const propObj = '$ref' in prop ? resolveRef(openapi, prop.$ref) : prop;
14
- const type = propObj.type;
15
- let typeNode;
16
- if (type === 'array') {
17
- const { items } = propObj;
18
- const itemsObj = '$ref' in items ? resolveRef(openapi, items.$ref) : items;
19
- const itemsType = itemsObj.type;
20
- typeNode = (_jsxs("code", { children: ["[]", typeof itemsType === 'string'
21
- ? itemsType
22
- : '$ref' in items && _jsx(RefLink, { "$ref": items.$ref })] }));
23
- }
24
- else if (type === 'object') {
25
- if (typeof propObj.additionalProperties === 'object') {
26
- const props = propObj.additionalProperties;
27
- const propsObj = '$ref' in props ? resolveRef(openapi, props.$ref) : props;
28
- const propsType = propsObj.type;
29
- typeNode = (_jsxs("code", { children: ["map[string]", typeof propsType === 'string'
30
- ? propsType
31
- : '$ref' in props && _jsx(RefLink, { "$ref": props.$ref })] }));
32
- }
33
- else {
34
- typeNode = _jsx("code", { children: type });
35
- }
36
- }
37
- else if (typeof type === 'string') {
38
- typeNode = _jsx("code", { children: type });
39
- }
40
- else if ('$ref' in prop) {
41
- typeNode = _jsx(RefLink, { "$ref": prop.$ref });
42
- }
43
- return (_jsxs(X.li, { children: [_jsx("code", { children: name }), ": ", typeNode, _jsx(Markdown, { children: propObj.description })] }, index));
44
- }) }));
43
+ return (_jsx(X.ul, { children: Object.entries(properties).map(([name, property], index) => (_jsx(X.li, { children: _jsx(OpenAPIProperty, { name: name, property: property, openapi: openapi }) }, index))) }));
45
44
  };
46
45
  const getRefsForSchema = (openapi, schema, knownRefs) => {
47
46
  const refSchema = openapi.components?.schemas[schema];
@@ -1 +1,4 @@
1
- export { Tabs, Tabs as default } from '@rspress/core/theme';
1
+ import { Tabs as Tabs_ } from '@rspress/core/theme';
2
+ import { type ForwardRefExoticComponent, type RefAttributes } from 'react';
3
+ export declare const Tabs: ForwardRefExoticComponent<Parameters<typeof Tabs_>[0] & RefAttributes<HTMLDivElement>>;
4
+ export default Tabs;
@@ -1 +1,7 @@
1
- export { Tabs, Tabs as default } from '@rspress/core/theme';
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Tabs as Tabs_ } from '@rspress/core/theme';
3
+ import { forwardRef, } from 'react';
4
+ export const Tabs = forwardRef(({ children, ...props }, ref) => {
5
+ return (_jsx("div", { className: "doom-tabs", children: _jsx(Tabs_, { ...props, ref: ref, children: children }) }));
6
+ });
7
+ export default Tabs;
@@ -1,7 +1,10 @@
1
1
  import virtual from 'doom-@api-virtual';
2
2
  import { last, upperFirst } from 'es-toolkit';
3
3
  import { get } from 'es-toolkit/compat';
4
- export const modelName = (ref) => upperFirst(last(ref.split('.')));
4
+ export const modelName = (ref) => {
5
+ const lastPart = last(ref.split('.'));
6
+ return upperFirst(lastPart.startsWith('#') ? lastPart.slice(1) : lastPart);
7
+ };
5
8
  export const resolveRef = (openapi, ref) => {
6
9
  if (!ref.startsWith('#/')) {
7
10
  ref = `#/components/schemas/${ref}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alauda/doom",
3
- "version": "0.15.5",
3
+ "version": "0.15.7",
4
4
  "type": "module",
5
5
  "description": "Doctor Doom making docs.",
6
6
  "repository": {
@@ -1,3 +1,5 @@
1
+ @use "sass:color";
2
+
1
3
  @import url(./shiki.css);
2
4
 
3
5
  th,
@@ -90,6 +92,22 @@ td {
90
92
  }
91
93
  }
92
94
 
95
+ .doom-tabs {
96
+ div.language-mdx {
97
+ margin: 24px 0;
98
+ }
99
+
100
+ .language-mdx {
101
+ // https://github.com/web-infra-dev/rspress/blob/bbe6476c8394f9c95a98fd791f0614481f89d878/packages/theme-default/src/styles/code.css#L6
102
+ --rp-code-block-bg: #{color.adjust($color: #f6f8fa, $lightness: -5%)};
103
+ }
104
+ }
105
+
106
+ .dark .doom-tabs .language-mdx {
107
+ // https://github.com/web-infra-dev/rspress/blob/bbe6476c8394f9c95a98fd791f0614481f89d878/packages/theme-default/src/styles/code.css#L17
108
+ --rp-code-block-bg: #{color.adjust($color: #242424, $lightness: 5%)};
109
+ }
110
+
93
111
  @mixin print {
94
112
  .rspress {
95
113
  &-nav,
@@ -9,6 +9,17 @@
9
9
  &:active {
10
10
  opacity: 0.7;
11
11
  }
12
+
13
+ &[target='_blank']:after {
14
+ content: '↗';
15
+ margin-left: 0.2em;
16
+ margin-right: 0.1em;
17
+ font-size: 0.7em;
18
+ font-weight: 700;
19
+ transition: transform 0.2s;
20
+ display: inline-block;
21
+ transform: translate(0, -0.3em);
22
+ }
12
23
  }
13
24
 
14
25
  .link,