@alauda/doom 1.2.0 → 1.2.2

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.
@@ -1 +1 @@
1
- export declare const SvgDown: () => import("react/jsx-runtime").JSX.Element;
1
+ export declare const Down: () => import("react/jsx-runtime").JSX.Element;
@@ -1,2 +1,2 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- export const SvgDown = () => (_jsx("svg", { width: "1em", height: "1em", viewBox: "0 0 32 32", children: _jsx("path", { fill: "currentColor", d: "M16 22L6 12l1.4-1.4l8.6 8.6l8.6-8.6L26 12z" }) }));
2
+ export const Down = () => (_jsx("svg", { width: "1em", height: "1em", viewBox: "0 0 32 32", children: _jsx("path", { fill: "currentColor", d: "M16 22L6 12l1.4-1.4l8.6 8.6l8.6-8.6L26 12z" }) }));
@@ -1,52 +1,66 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { Tag } from '@rspress/core/theme';
3
- import { isExternalUrl, withoutBase, } from '@rspress/shared';
4
- import { useCallback, useState } from 'react';
5
- import { SvgDown } from './Down.js';
3
+ import { isExternalUrl, matchNavbar, } from '@rspress/shared';
4
+ import { useRef, useState } from 'react';
5
+ import { Down } from './Down.js';
6
6
  import { NavMenuSingleItem, } from './NavMenuSingleItem.js';
7
7
  import { SvgWrapper } from './SvgWrapper.js';
8
8
  function ActiveGroupItem({ item }) {
9
- return (_jsxs("div", { className: "rounded-2xl my-1 flex", style: {
9
+ return (_jsxs("div", { className: "rp-rounded-2xl rp-my-1 rp-flex", style: {
10
10
  padding: '0.4rem 1.5rem 0.4rem 0.75rem',
11
- }, children: [item.tag && _jsx(Tag, { tag: item.tag }), _jsx("span", { className: "text-brand", children: item.text })] }, item.link));
11
+ }, children: [item.tag && _jsx(Tag, { tag: item.tag }), _jsx("span", { className: "rp-text-brand", children: item.text })] }, item.link));
12
12
  }
13
13
  function NormalGroupItem({ item }) {
14
- return (_jsx("div", { className: "font-medium my-1", children: _jsx("a", { href: item.link, target: isExternalUrl(item.link) ? '_blank' : undefined, rel: "noopener noreferrer", children: _jsx("div", { className: "rounded-2xl hover:bg-mute", style: {
14
+ return (_jsx("div", { className: "rp-font-medium rp-my-1", children: _jsx("a", { href: item.link, target: isExternalUrl(item.link) ? '_blank' : undefined, rel: "noopener noreferrer", children: _jsx("div", { className: "rp-rounded-2xl hover:rp-bg-mute", style: {
15
15
  padding: '0.4rem 1.5rem 0.4rem 0.75rem',
16
- }, children: _jsxs("div", { className: "flex", children: [item.tag && _jsx(Tag, { tag: item.tag }), _jsx("span", { children: item.text })] }) }) }) }, item.link));
16
+ }, children: _jsxs("div", { className: "rp-flex", children: [item.tag && _jsx(Tag, { tag: item.tag }), _jsx("span", { children: item.text })] }) }) }) }, item.link));
17
17
  }
18
18
  export function NavMenuGroup(item) {
19
- const { activeValue, items: groupItems, base = '', pathname = '' } = item;
19
+ const { activeValue, items: groupItems, base = '', link = '', pathname = '', } = item;
20
20
  const [isOpen, setIsOpen] = useState(false);
21
- const onOpen = useCallback(() => {
21
+ const closeTimerRef = useRef(null);
22
+ const clearCloseTimer = () => {
23
+ if (closeTimerRef.current) {
24
+ clearTimeout(closeTimerRef.current);
25
+ closeTimerRef.current = null;
26
+ }
27
+ };
28
+ /**
29
+ * Handle mouse leave event for the dropdown menu
30
+ * Closes the menu after a 150ms delay to allow diagonal mouse movement
31
+ * to the dropdown content area
32
+ */
33
+ const handleMouseLeave = () => {
34
+ closeTimerRef.current = window.setTimeout(() => {
35
+ setIsOpen(false);
36
+ }, 150);
37
+ };
38
+ const handleMouseEnter = () => {
39
+ clearCloseTimer();
22
40
  setIsOpen(true);
23
- }, []);
24
- const onClose = useCallback(() => {
25
- setIsOpen(false);
26
- }, []);
41
+ };
27
42
  const renderLinkItem = (item) => {
28
- const isLinkActive = new RegExp(item.activeMatch || item.link).test(withoutBase(pathname, base));
43
+ const isLinkActive = matchNavbar(item, pathname, base);
29
44
  if (activeValue === item.text || (!activeValue && isLinkActive)) {
30
45
  return _jsx(ActiveGroupItem, { item: item }, item.link);
31
46
  }
32
47
  return _jsx(NormalGroupItem, { item: item }, item.link);
33
48
  };
34
49
  const renderGroup = (item) => {
35
- return (_jsxs("div", { children: ['link' in item ? (renderLinkItem(item)) : (_jsx("p", { className: "font-bold text-gray-400 my-1 not:first:border", children: item.text })), item.items.map(renderLinkItem)] }));
50
+ return (_jsxs("div", { children: ['link' in item ? (renderLinkItem(item)) : (_jsx("p", { className: "rp-font-bold rp-text-gray-400 rp-my-1 not:first:rp-border", children: item.text })), item.items.map(renderLinkItem)] }));
36
51
  };
37
- const hasMultiItems = groupItems.length > 1;
38
- const Content = hasMultiItems || item.link ? 'button' : 'span';
39
- const content = (_jsx(Content, { onMouseEnter: hasMultiItems ? onOpen : undefined, className: `${Content === 'button' ? 'rspress-nav-menu-group-button ' : ''}flex-center items-center font-medium text-sm text-text-1${hasMultiItems ? ' hover:text-text-2 transition-colors duration-200' : ''}`, children: item.link ? (_jsx(NavMenuSingleItem, { ...item, rightIcon: _jsx(SvgWrapper, { icon: SvgDown }) })) : (_jsxs(_Fragment, { children: [_jsxs("span", { className: "text-sm font-medium flex", style: hasMultiItems ? { marginRight: '2px' } : undefined, children: [_jsx(Tag, { tag: item.tag }), item.text] }), hasMultiItems && _jsx(SvgWrapper, { icon: SvgDown })] })) }));
40
- return hasMultiItems ? (_jsxs("div", { className: "relative flex-center h-14", onMouseLeave: onClose, children: [content, _jsx("div", { className: "rspress-nav-menu-group-content absolute mx-0.8 transition-opacity duration-300", style: {
52
+ return (_jsxs("div", { className: "rp-relative rp-flex rp-items-center rp-justify-center rp-h-14", onMouseLeave: handleMouseLeave, children: [_jsx("div", { onMouseEnter: handleMouseEnter, className: "rspress-nav-menu-group-button rp-flex rp-justify-center rp-items-center rp-font-medium rp-text-sm rp-text-text-1 hover:rp-text-text-2 rp-transition-colors rp-duration-200 rp-cursor-pointer", children: link ? (_jsx(NavMenuSingleItem, { ...item, rightIcon: _jsx(SvgWrapper, { icon: Down }) })) : (_jsxs(_Fragment, { children: [_jsxs("span", { className: "rp-text-sm rp-font-medium rp-flex", style: {
53
+ marginRight: '2px',
54
+ }, children: [_jsx(Tag, { tag: item.tag }), item.text] }), _jsx(SvgWrapper, { icon: Down })] })) }), _jsx("div", { className: "rspress-nav-menu-group-content rp-absolute rp-mx-0.8 rp-transition-opacity rp-duration-300", style: {
41
55
  opacity: isOpen ? 1 : 0,
42
56
  visibility: isOpen ? 'visible' : 'hidden',
43
57
  right: 0,
44
58
  top: '52px',
45
- }, children: _jsx("div", { className: "p-3 pr-2 w-full h-full max-h-100vh whitespace-nowrap", style: {
59
+ }, onMouseEnter: clearCloseTimer, children: _jsx("div", { className: "rp-p-3 rp-pr-2 rp-w-full rp-h-full rp-max-h-100vh rp-whitespace-nowrap", style: {
46
60
  boxShadow: 'var(--rp-shadow-3)',
47
61
  zIndex: 100,
48
62
  border: '1px solid var(--rp-c-divider-light)',
49
63
  borderRadius: 'var(--rp-radius-large)',
50
64
  background: 'var(--rp-c-bg)',
51
- }, children: groupItems.map((item) => (_jsx("div", { children: 'items' in item ? renderGroup(item) : renderLinkItem(item) }, item.text))) }) })] })) : (content);
65
+ }, children: groupItems.map((item) => (_jsx("div", { children: 'items' in item ? renderGroup(item) : renderLinkItem(item) }, item.text))) }) })] }));
52
66
  }
@@ -7,5 +7,5 @@ export function NavMenuSingleItem({ activeMatch, base, compact, download, link,
7
7
  const isActive = useMemo(() => !!base &&
8
8
  !!pathname &&
9
9
  new RegExp(activeMatch || link).test(withoutBase(pathname, base)), [activeMatch, base, link, pathname]);
10
- return (_jsx("a", { href: link, download: download, target: isExternalUrl(link) ? '_blank' : undefined, rel: "noopener noreferrer", children: _jsxs("div", { className: `rspress-nav-menu-item ${styles.singleItem} ${isActive ? styles.activeItem : ''} text-sm font-medium ${compact ? 'mx-0.5' : 'mx-1.5'} px-3 py-2 flex items-center`, children: [_jsx(Tag, { tag: tag }), text, rightIcon] }) }, link));
10
+ return (_jsx("a", { href: link, download: download, target: isExternalUrl(link) ? '_blank' : undefined, rel: "noopener noreferrer", children: _jsxs("div", { className: `rspress-nav-menu-item ${styles.singleItem} ${isActive ? `${styles.activeItem} rspress-nav-menu-item-active` : ''} rp-text-sm rp-font-medium ${compact ? 'rp-mx-0.5' : 'rp-mx-1.5'} rp-px-3 rp-py-2 rp-flex rp-items-center`, children: [_jsx(Tag, { tag: tag }), text, rightIcon] }) }, link));
11
11
  }
@@ -17,7 +17,7 @@ export declare const X: {
17
17
  blockquote: (props: import("react").ComponentProps<"blockquote">) => import("react/jsx-runtime").JSX.Element;
18
18
  strong: (props: import("react").ComponentProps<"strong">) => import("react/jsx-runtime").JSX.Element;
19
19
  a: (props: import("react").ComponentProps<"a">) => import("react/jsx-runtime").JSX.Element;
20
- code: typeof import("@rspress/theme-default").Code;
21
- pre: typeof import("@rspress/theme-default").PreWithCodeButtonGroup;
20
+ code: (props: import("react").HTMLProps<HTMLElement>) => import("react/jsx-runtime").JSX.Element;
21
+ pre: ({ containerElementClassName, children, className, title, codeButtonGroupProps, ...otherProps }: import("@rspress/theme-default").PreWithCodeButtonGroupProps) => import("react/jsx-runtime").JSX.Element | null;
22
22
  img: (props: import("react").ComponentProps<"img">) => import("react/jsx-runtime").JSX.Element;
23
23
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alauda/doom",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "type": "module",
5
5
  "description": "Doctor Doom making docs.",
6
6
  "repository": "git+https://github.com/alauda/doom.git",
@@ -35,17 +35,17 @@
35
35
  ],
36
36
  "dependencies": {
37
37
  "@cspell/eslint-plugin": "^8.19.4 || ^9.0.2",
38
- "@eslint-react/eslint-plugin": "^1.51.2",
38
+ "@eslint-react/eslint-plugin": "^1.51.3",
39
39
  "@inquirer/prompts": "^7.5.3",
40
40
  "@openapi-contrib/openapi-schema-to-json-schema": "^5.1.0",
41
- "@playwright/browser-chromium": "^1.52.0",
41
+ "@playwright/browser-chromium": "^1.53.0",
42
42
  "@rsbuild/plugin-react": "^1.3.2",
43
43
  "@rsbuild/plugin-sass": "^1.3.2",
44
44
  "@rsbuild/plugin-svgr": "^1.2.0",
45
45
  "@rsbuild/plugin-yaml": "^1.0.2",
46
- "@rspress/core": "2.0.0-beta.11",
47
- "@rspress/plugin-algolia": "2.0.0-beta.11",
48
- "@rspress/plugin-llms": "^2.0.0-beta.11",
46
+ "@rspress/core": "2.0.0-beta.13",
47
+ "@rspress/plugin-algolia": "2.0.0-beta.13",
48
+ "@rspress/plugin-llms": "2.0.0-beta.13",
49
49
  "@shikijs/transformers": "^3.6.0",
50
50
  "@total-typescript/ts-reset": "^0.6.1",
51
51
  "chokidar": "^4.0.3",
@@ -60,13 +60,13 @@
60
60
  "mdast-util-mdx": "^3.0.0",
61
61
  "mdast-util-mdx-jsx": "^3.2.0",
62
62
  "mermaid": "^11.6.0",
63
- "openai": "^5.1.1",
63
+ "openai": "^5.3.0",
64
64
  "openapi-types": "^12.1.3",
65
65
  "p-ratelimit": "^1.0.1",
66
66
  "pdf-lib": "^1.17.1",
67
67
  "pdf-merger-js": "^5.1.2",
68
68
  "picomatch": "^4.0.2",
69
- "playwright": "^1.52.0",
69
+ "playwright": "^1.53.0",
70
70
  "react-markdown": "^10.1.0",
71
71
  "remark-directive": "^4.0.0",
72
72
  "remark-frontmatter": "^5.0.0",
@@ -79,7 +79,7 @@
79
79
  "tinyglobby": "^0.2.14",
80
80
  "type-fest": "^4.41.0",
81
81
  "typescript": "^5.8.3",
82
- "typescript-eslint": "^8.33.1",
82
+ "typescript-eslint": "^8.34.0",
83
83
  "x-fetch": "^0.2.6",
84
84
  "yaml": "^2.8.0",
85
85
  "yoctocolors": "^2.1.1"