@redocly/theme 0.70.0-next.8 → 0.70.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.
Files changed (101) hide show
  1. package/lib/components/LoadProgressBar/LoadProgressBar.d.ts +8 -0
  2. package/lib/components/LoadProgressBar/LoadProgressBar.js +122 -0
  3. package/lib/core/constants/index.d.ts +1 -0
  4. package/lib/core/constants/index.js +1 -0
  5. package/lib/core/constants/prompt.d.ts +9 -0
  6. package/lib/core/constants/prompt.js +33 -0
  7. package/lib/core/hooks/index.d.ts +3 -0
  8. package/lib/core/hooks/index.js +3 -0
  9. package/lib/core/hooks/prompt/use-prompt-actions.d.ts +7 -0
  10. package/lib/core/hooks/prompt/use-prompt-actions.js +19 -0
  11. package/lib/core/hooks/prompt/use-prompt-text-limit.d.ts +19 -0
  12. package/lib/core/hooks/prompt/use-prompt-text-limit.js +35 -0
  13. package/lib/core/hooks/use-page-actions.js +4 -8
  14. package/lib/core/hooks/use-pointer-border-highlight.d.ts +7 -0
  15. package/lib/core/hooks/use-pointer-border-highlight.js +29 -0
  16. package/lib/core/hooks/use-telemetry-fallback.d.ts +2 -0
  17. package/lib/core/hooks/use-telemetry-fallback.js +2 -0
  18. package/lib/core/styles/dark.js +14 -12
  19. package/lib/core/styles/global.js +16 -54
  20. package/lib/core/types/index.d.ts +1 -0
  21. package/lib/core/types/l10n.d.ts +1 -1
  22. package/lib/core/types/prompt.d.ts +9 -0
  23. package/lib/core/types/prompt.js +3 -0
  24. package/lib/core/utils/get-ai-prompt-link.d.ts +15 -0
  25. package/lib/core/utils/get-ai-prompt-link.js +29 -0
  26. package/lib/core/utils/index.d.ts +1 -0
  27. package/lib/core/utils/index.js +1 -0
  28. package/lib/core/utils/urls.js +1 -1
  29. package/lib/core/utils/with-load-progress.d.ts +3 -0
  30. package/lib/core/utils/with-load-progress.js +24 -19
  31. package/lib/ext/configure.d.ts +1 -1
  32. package/lib/ext/configure.js +0 -1
  33. package/lib/icons/LinkIcon/LinkIconSymbol.d.ts +12 -0
  34. package/lib/icons/LinkIcon/LinkIconSymbol.js +41 -0
  35. package/lib/index.d.ts +1 -0
  36. package/lib/index.js +1 -0
  37. package/lib/markdoc/components/Cards/Card.js +1 -1
  38. package/lib/markdoc/components/Prompt/Prompt.d.ts +15 -0
  39. package/lib/markdoc/components/Prompt/Prompt.js +163 -0
  40. package/lib/markdoc/components/Prompt/PromptActions.d.ts +13 -0
  41. package/lib/markdoc/components/Prompt/PromptActions.js +43 -0
  42. package/lib/markdoc/components/Prompt/PromptBody.d.ts +14 -0
  43. package/lib/markdoc/components/Prompt/PromptBody.js +99 -0
  44. package/lib/markdoc/components/Prompt/PromptCopyButton.d.ts +10 -0
  45. package/lib/markdoc/components/Prompt/PromptCopyButton.js +28 -0
  46. package/lib/markdoc/components/Prompt/PromptHeader.d.ts +9 -0
  47. package/lib/markdoc/components/Prompt/PromptHeader.js +57 -0
  48. package/lib/markdoc/components/Prompt/PromptShowHideButton.d.ts +7 -0
  49. package/lib/markdoc/components/Prompt/PromptShowHideButton.js +21 -0
  50. package/lib/markdoc/components/Prompt/PromptToggleLabel.d.ts +7 -0
  51. package/lib/markdoc/components/Prompt/PromptToggleLabel.js +28 -0
  52. package/lib/markdoc/components/Prompt/variables.d.ts +1 -0
  53. package/lib/markdoc/components/Prompt/variables.dark.d.ts +1 -0
  54. package/lib/markdoc/components/Prompt/variables.dark.js +8 -0
  55. package/lib/markdoc/components/Prompt/variables.js +44 -0
  56. package/lib/markdoc/components/default.d.ts +1 -0
  57. package/lib/markdoc/components/default.js +1 -0
  58. package/lib/markdoc/default.d.ts +2 -0
  59. package/lib/markdoc/default.js +2 -0
  60. package/lib/markdoc/tags/code-walkthrough.d.ts +1 -1
  61. package/lib/markdoc/tags/code-walkthrough.js +3 -5
  62. package/lib/markdoc/tags/prompt.d.ts +2 -0
  63. package/lib/markdoc/tags/prompt.js +56 -0
  64. package/package.json +2 -7
  65. package/src/components/LoadProgressBar/LoadProgressBar.tsx +113 -0
  66. package/src/core/constants/index.ts +1 -0
  67. package/src/core/constants/prompt.ts +34 -0
  68. package/src/core/hooks/__mocks__/index.ts +3 -0
  69. package/src/core/hooks/__mocks__/use-theme-hooks.ts +2 -0
  70. package/src/core/hooks/index.ts +3 -0
  71. package/src/core/hooks/prompt/use-prompt-actions.ts +28 -0
  72. package/src/core/hooks/prompt/use-prompt-text-limit.ts +59 -0
  73. package/src/core/hooks/use-page-actions.ts +4 -9
  74. package/src/core/hooks/use-pointer-border-highlight.ts +46 -0
  75. package/src/core/hooks/use-telemetry-fallback.ts +2 -0
  76. package/src/core/styles/dark.ts +2 -0
  77. package/src/core/styles/global.ts +2 -40
  78. package/src/core/types/index.ts +1 -0
  79. package/src/core/types/l10n.ts +11 -0
  80. package/src/core/types/prompt.ts +11 -0
  81. package/src/core/utils/get-ai-prompt-link.ts +30 -0
  82. package/src/core/utils/index.ts +1 -0
  83. package/src/core/utils/urls.ts +1 -1
  84. package/src/core/utils/with-load-progress.ts +23 -18
  85. package/src/ext/configure.ts +1 -1
  86. package/src/icons/LinkIcon/LinkIconSymbol.tsx +51 -0
  87. package/src/index.ts +1 -0
  88. package/src/markdoc/components/Cards/Card.tsx +1 -1
  89. package/src/markdoc/components/Prompt/Prompt.tsx +219 -0
  90. package/src/markdoc/components/Prompt/PromptActions.tsx +104 -0
  91. package/src/markdoc/components/Prompt/PromptBody.tsx +107 -0
  92. package/src/markdoc/components/Prompt/PromptCopyButton.tsx +73 -0
  93. package/src/markdoc/components/Prompt/PromptHeader.tsx +81 -0
  94. package/src/markdoc/components/Prompt/PromptShowHideButton.tsx +43 -0
  95. package/src/markdoc/components/Prompt/PromptToggleLabel.tsx +41 -0
  96. package/src/markdoc/components/Prompt/variables.dark.ts +5 -0
  97. package/src/markdoc/components/Prompt/variables.ts +41 -0
  98. package/src/markdoc/components/default.ts +1 -0
  99. package/src/markdoc/default.ts +2 -0
  100. package/src/markdoc/tags/code-walkthrough.ts +4 -12
  101. package/src/markdoc/tags/prompt.ts +58 -0
@@ -0,0 +1,8 @@
1
+ import type { JSX } from 'react';
2
+ export type LoadProgressBarProps = {
3
+ /** Also shows the bar while the host's own navigation is pending. */
4
+ pending?: boolean;
5
+ className?: string;
6
+ };
7
+ /** A top-of-page bar while a page load is pending. */
8
+ export declare function LoadProgressBar({ pending, className, }: LoadProgressBarProps): JSX.Element | null;
@@ -0,0 +1,122 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.LoadProgressBar = LoadProgressBar;
40
+ const react_1 = __importStar(require("react"));
41
+ const styled_components_1 = __importDefault(require("styled-components"));
42
+ const utils_1 = require("../../core/utils");
43
+ const START = 0.08;
44
+ const MAX_PENDING = 0.994;
45
+ const TRICKLE_MS = 100;
46
+ const SETTLE_MS = 200;
47
+ // [below, step]: large steps at first, smaller ones near the end.
48
+ const TRICKLE_STEPS = [
49
+ [0.2, 0.1],
50
+ [0.5, 0.04],
51
+ [0.8, 0.02],
52
+ [0.99, 0.005],
53
+ ];
54
+ function trickle(progress) {
55
+ var _a;
56
+ var _b;
57
+ const step = (_b = (_a = TRICKLE_STEPS.find(([below]) => progress < below)) === null || _a === void 0 ? void 0 : _a[1]) !== null && _b !== void 0 ? _b : 0;
58
+ return Math.min(progress + step, MAX_PENDING);
59
+ }
60
+ /** A top-of-page bar while a page load is pending. */
61
+ function LoadProgressBar({ pending = false, className, }) {
62
+ const loading = (0, react_1.useSyncExternalStore)(utils_1.subscribeToLoadProgress, utils_1.isLoadInProgress, () => false);
63
+ const active = pending || loading;
64
+ const [progress, setProgress] = (0, react_1.useState)(null);
65
+ const [fading, setFading] = (0, react_1.useState)(false);
66
+ const shown = (0, react_1.useRef)(false);
67
+ (0, react_1.useEffect)(() => {
68
+ if (active) {
69
+ shown.current = true;
70
+ setFading(false);
71
+ setProgress((current) => (current === null || current === 1 ? START : current));
72
+ const timer = setInterval(() => setProgress((current) => trickle(current !== null && current !== void 0 ? current : START)), TRICKLE_MS);
73
+ return () => clearInterval(timer);
74
+ }
75
+ if (!shown.current)
76
+ return undefined;
77
+ setProgress(1);
78
+ const fade = setTimeout(() => setFading(true), SETTLE_MS);
79
+ const hide = setTimeout(() => {
80
+ shown.current = false;
81
+ setProgress(null);
82
+ setFading(false);
83
+ }, SETTLE_MS * 2);
84
+ return () => {
85
+ clearTimeout(fade);
86
+ clearTimeout(hide);
87
+ };
88
+ }, [active]);
89
+ if (progress === null)
90
+ return null;
91
+ // The id and class names come from the replaced nprogress library: custom styles target them.
92
+ return (react_1.default.createElement(LoadProgressBarWrapper, { id: "nprogress", "data-component-name": "LoadProgressBar/LoadProgressBar", className: className, "aria-hidden": "true", $fading: fading },
93
+ react_1.default.createElement(Bar, { className: "bar", $progress: progress },
94
+ react_1.default.createElement(Peg, { className: "peg" }))));
95
+ }
96
+ const LoadProgressBarWrapper = styled_components_1.default.div `
97
+ pointer-events: none;
98
+ opacity: ${({ $fading }) => ($fading ? 0 : 1)};
99
+ transition: opacity ${SETTLE_MS}ms linear;
100
+ `;
101
+ // The offset changes on each tick: as a styled rule, each value would add a class.
102
+ const Bar = styled_components_1.default.div.attrs(({ $progress }) => ({
103
+ style: { transform: `translate3d(${($progress - 1) * 100}%, 0, 0)` },
104
+ })) `
105
+ position: fixed;
106
+ z-index: var(--z-index-popover);
107
+ top: 0;
108
+ left: 0;
109
+ width: 100%;
110
+ height: var(--load-progress-bar-height);
111
+ background: var(--load-progress-bar-color);
112
+ transition: transform ${SETTLE_MS}ms ease;
113
+ `;
114
+ const Peg = styled_components_1.default.div `
115
+ position: absolute;
116
+ right: 0;
117
+ width: 100px;
118
+ height: 100%;
119
+ box-shadow: var(--load-progress-bar-shadow);
120
+ transform: rotate(3deg) translate(0, -4px);
121
+ `;
122
+ //# sourceMappingURL=LoadProgressBar.js.map
@@ -11,3 +11,4 @@ export * from './feedback';
11
11
  export * from './heading';
12
12
  export * from './markdown';
13
13
  export * from './consent';
14
+ export * from './prompt';
@@ -27,4 +27,5 @@ __exportStar(require("./feedback"), exports);
27
27
  __exportStar(require("./heading"), exports);
28
28
  __exportStar(require("./markdown"), exports);
29
29
  __exportStar(require("./consent"), exports);
30
+ __exportStar(require("./prompt"), exports);
30
31
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,9 @@
1
+ import type { AiPromptActionOption, AiPromptTarget } from '../types/prompt';
2
+ export declare const PROMPT_TAG = "prompt";
3
+ export declare const AI_PROMPT_TARGETS: Readonly<{
4
+ readonly CURSOR: 'cursor';
5
+ readonly CLAUDE: 'claude';
6
+ readonly CHATGPT: 'chatgpt';
7
+ }>;
8
+ export declare const PROMPT_NARROW_BLOCK_MAX_WIDTH = "440px";
9
+ export declare const AI_PROMPT_ACTION_OPTIONS: Record<AiPromptTarget, AiPromptActionOption>;
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AI_PROMPT_ACTION_OPTIONS = exports.PROMPT_NARROW_BLOCK_MAX_WIDTH = exports.AI_PROMPT_TARGETS = exports.PROMPT_TAG = void 0;
4
+ exports.PROMPT_TAG = 'prompt';
5
+ exports.AI_PROMPT_TARGETS = Object.freeze({
6
+ CURSOR: 'cursor',
7
+ CLAUDE: 'claude',
8
+ CHATGPT: 'chatgpt',
9
+ });
10
+ /* Block width, not viewport width: a prompt in a narrow desktop column stacks like one on a
11
+ phone. The viewport `breakpoints` in core/utils/media-css.ts do not apply here. */
12
+ exports.PROMPT_NARROW_BLOCK_MAX_WIDTH = '440px';
13
+ exports.AI_PROMPT_ACTION_OPTIONS = {
14
+ cursor: {
15
+ titleTranslationKey: 'promptTag.openIn.cursor',
16
+ titleDefault: 'Open in Cursor',
17
+ descriptionTranslationKey: 'promptTag.openIn.cursorDescription',
18
+ descriptionDefault: 'Send this prompt to Cursor',
19
+ },
20
+ claude: {
21
+ titleTranslationKey: 'promptTag.openIn.claude',
22
+ titleDefault: 'Open in Claude',
23
+ descriptionTranslationKey: 'promptTag.openIn.claudeDescription',
24
+ descriptionDefault: 'Send this prompt to Claude',
25
+ },
26
+ chatgpt: {
27
+ titleTranslationKey: 'promptTag.openIn.chatgpt',
28
+ titleDefault: 'Open in ChatGPT',
29
+ descriptionTranslationKey: 'promptTag.openIn.chatgptDescription',
30
+ descriptionDefault: 'Send this prompt to ChatGPT',
31
+ },
32
+ };
33
+ //# sourceMappingURL=prompt.js.map
@@ -62,3 +62,6 @@ export * from './use-banner-telemetry';
62
62
  export * from './use-tooltip-fallback-placement';
63
63
  export * from './use-anchor-positioning';
64
64
  export * from './use-scroll-item-into-view';
65
+ export * from './use-pointer-border-highlight';
66
+ export * from './prompt/use-prompt-text-limit';
67
+ export * from './prompt/use-prompt-actions';
@@ -78,4 +78,7 @@ __exportStar(require("./use-banner-telemetry"), exports);
78
78
  __exportStar(require("./use-tooltip-fallback-placement"), exports);
79
79
  __exportStar(require("./use-anchor-positioning"), exports);
80
80
  __exportStar(require("./use-scroll-item-into-view"), exports);
81
+ __exportStar(require("./use-pointer-border-highlight"), exports);
82
+ __exportStar(require("./prompt/use-prompt-text-limit"), exports);
83
+ __exportStar(require("./prompt/use-prompt-actions"), exports);
81
84
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ import type { AiPromptTarget } from '../../types/prompt';
2
+ export type PromptActionHandlers = {
3
+ reportCopy: () => void;
4
+ /** Opens the prompt in the AI tool and reports it. */
5
+ openIn: (target: AiPromptTarget) => void;
6
+ };
7
+ export declare function usePromptActions(prompt: string): PromptActionHandlers;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.usePromptActions = usePromptActions;
4
+ const use_theme_hooks_1 = require("../use-theme-hooks");
5
+ const get_ai_prompt_link_1 = require("../../utils/get-ai-prompt-link");
6
+ const get_base_data_attributes_1 = require("../../utils/telemetry/get-base-data-attributes");
7
+ function usePromptActions(prompt) {
8
+ const { useTelemetry } = (0, use_theme_hooks_1.useThemeHooks)();
9
+ const telemetry = useTelemetry();
10
+ const tagData = (0, get_base_data_attributes_1.getBaseDataAttributes)('prompt', 'markdocTag');
11
+ return {
12
+ reportCopy: () => telemetry.sendPromptTagCopiedMessage([tagData]),
13
+ openIn: (target) => {
14
+ telemetry.sendPromptTagOpenedMessage([Object.assign(Object.assign({}, tagData), { target })]);
15
+ window.open((0, get_ai_prompt_link_1.getAiPromptLink)(target, prompt), '_blank', 'noopener,noreferrer');
16
+ },
17
+ };
18
+ }
19
+ //# sourceMappingURL=use-prompt-actions.js.map
@@ -0,0 +1,19 @@
1
+ import type { RefObject } from 'react';
2
+ export type PromptTextLimit = 'none' | 'oneLine' | 'maxLines';
3
+ export type UsePromptTextLimitParams = {
4
+ prompt: string;
5
+ singleLine: boolean;
6
+ isPromptVisible: boolean;
7
+ };
8
+ export type PromptTextLimitState = {
9
+ textRef: RefObject<HTMLDivElement | null>;
10
+ textLimit: PromptTextLimit;
11
+ isExpanded: boolean;
12
+ hasHiddenText: boolean;
13
+ toggleExpanded: () => void;
14
+ };
15
+ /**
16
+ * Tracks the line limit of the prompt text (one line or the maximum lines) and whether the
17
+ * reader expanded it. `hasHiddenText` is true only when the limit hides some text.
18
+ */
19
+ export declare function usePromptTextLimit({ prompt, singleLine, isPromptVisible, }: UsePromptTextLimitParams): PromptTextLimitState;
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.usePromptTextLimit = usePromptTextLimit;
4
+ const react_1 = require("react");
5
+ /**
6
+ * Tracks the line limit of the prompt text (one line or the maximum lines) and whether the
7
+ * reader expanded it. `hasHiddenText` is true only when the limit hides some text.
8
+ */
9
+ function usePromptTextLimit({ prompt, singleLine, isPromptVisible, }) {
10
+ const textRef = (0, react_1.useRef)(null);
11
+ const [isExpanded, setIsExpanded] = (0, react_1.useState)(false);
12
+ const [hasHiddenText, setHasHiddenText] = (0, react_1.useState)(false);
13
+ /* The text mounts late with hidePrompt and re-wraps on resize, so the observer is
14
+ attached each time the text (re)appears. */
15
+ (0, react_1.useLayoutEffect)(() => {
16
+ const text = textRef.current;
17
+ if (!text || isExpanded)
18
+ return;
19
+ const measure = () => setHasHiddenText(text.scrollHeight > text.clientHeight || text.scrollWidth > text.clientWidth);
20
+ measure();
21
+ if (typeof ResizeObserver === 'undefined')
22
+ return;
23
+ const observer = new ResizeObserver(measure);
24
+ observer.observe(text);
25
+ return () => observer.disconnect();
26
+ }, [prompt, singleLine, isExpanded, isPromptVisible]);
27
+ return {
28
+ textRef,
29
+ textLimit: isExpanded ? 'none' : singleLine ? 'oneLine' : 'maxLines',
30
+ isExpanded,
31
+ hasHiddenText,
32
+ toggleExpanded: () => setIsExpanded((expanded) => !expanded),
33
+ };
34
+ }
35
+ //# sourceMappingURL=use-prompt-text-limit.js.map
@@ -25,6 +25,7 @@ const dom_1 = require("../utils/dom");
25
25
  const mcp_1 = require("../utils/mcp");
26
26
  const urls_1 = require("../utils/urls");
27
27
  const get_base_data_attributes_1 = require("../utils/telemetry/get-base-data-attributes");
28
+ const get_ai_prompt_link_1 = require("../utils/get-ai-prompt-link");
28
29
  const DEFAULT_ENABLED_ACTIONS = [
29
30
  'copy',
30
31
  'view',
@@ -82,6 +83,7 @@ function usePageActions(pageSlug, mcpUrl, actions) {
82
83
  const mdPageUrl = isRoot
83
84
  ? (0, urls_1.combineUrls)(origin, pathname, 'index.html.md')
84
85
  : (0, urls_1.combineUrls)(origin, (0, urls_1.removeTrailingSlash)(pathname) + '.md');
86
+ const externalAiPrompt = `Read ${mdPageUrl} and answer questions based on the content.`;
85
87
  const actionHandlers = {
86
88
  'docs-mcp-cursor': createMCPHandler('cursor', false),
87
89
  'docs-mcp-vscode': createMCPHandler('vscode', false),
@@ -123,7 +125,7 @@ function usePageActions(pageSlug, mcpUrl, actions) {
123
125
  },
124
126
  }),
125
127
  chatgpt: () => {
126
- const link = getExternalAiPromptLink('https://chat.openai.com', mdPageUrl);
128
+ const link = (0, get_ai_prompt_link_1.getAiPromptLink)('chatgpt', externalAiPrompt);
127
129
  return {
128
130
  buttonText: translate('page.actions.chatGptButtonText', 'Open in ChatGPT'),
129
131
  title: translate('page.actions.chatGptTitle', 'Open in ChatGPT'),
@@ -139,7 +141,7 @@ function usePageActions(pageSlug, mcpUrl, actions) {
139
141
  };
140
142
  },
141
143
  claude: () => {
142
- const link = getExternalAiPromptLink('https://claude.ai/new', mdPageUrl);
144
+ const link = (0, get_ai_prompt_link_1.getAiPromptLink)('claude', externalAiPrompt);
143
145
  return {
144
146
  buttonText: translate('page.actions.claudeButtonText', 'Open in Claude'),
145
147
  title: translate('page.actions.claudeTitle', 'Open in Claude'),
@@ -174,12 +176,6 @@ function usePageActions(pageSlug, mcpUrl, actions) {
174
176
  ]);
175
177
  return result;
176
178
  }
177
- function getExternalAiPromptLink(baseUrl, mdPageUrl) {
178
- const externalAiPrompt = `Read ${mdPageUrl} and answer questions based on the content.`;
179
- const url = new URL(baseUrl);
180
- url.searchParams.set('q', externalAiPrompt);
181
- return url.toString();
182
- }
183
179
  function createMCPAction({ clientType, mcpConfig, translate, onClickCallback, }) {
184
180
  const url = (0, mcp_1.generateMCPDeepLink)(clientType, mcpConfig);
185
181
  const sharedProps = {
@@ -0,0 +1,7 @@
1
+ import type { PointerEvent, RefObject } from 'react';
2
+ export type PointerBorderHighlight<T extends HTMLElement> = {
3
+ ref: RefObject<T | null>;
4
+ onPointerMove: (event: PointerEvent<T>) => void;
5
+ onPointerLeave: () => void;
6
+ };
7
+ export declare function usePointerBorderHighlight<T extends HTMLElement>(distance?: number): PointerBorderHighlight<T>;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.usePointerBorderHighlight = usePointerBorderHighlight;
4
+ const react_1 = require("react");
5
+ const EDGE_PROXIMITY_DISTANCE = 80;
6
+ /* Writes `--pointer-x`, `--pointer-y` and `--pointer-edge-proximity` (1 at the border, 0 at
7
+ `distance` px inside) to the element's inline style, so the highlight moves without re-renders. */
8
+ function usePointerBorderHighlight(distance = EDGE_PROXIMITY_DISTANCE) {
9
+ const ref = (0, react_1.useRef)(null);
10
+ const onPointerMove = (0, react_1.useCallback)((event) => {
11
+ const element = ref.current;
12
+ if (!element)
13
+ return;
14
+ const rect = element.getBoundingClientRect();
15
+ const x = event.clientX - rect.left;
16
+ const y = event.clientY - rect.top;
17
+ const edgeDistance = Math.min(x, y, rect.width - x, rect.height - y);
18
+ const proximity = Math.min(1, Math.max(0, 1 - edgeDistance / distance));
19
+ element.style.setProperty('--pointer-x', `${x}px`);
20
+ element.style.setProperty('--pointer-y', `${y}px`);
21
+ element.style.setProperty('--pointer-edge-proximity', String(Math.round(proximity * 100) / 100));
22
+ }, [distance]);
23
+ const onPointerLeave = (0, react_1.useCallback)(() => {
24
+ var _a;
25
+ (_a = ref.current) === null || _a === void 0 ? void 0 : _a.style.setProperty('--pointer-edge-proximity', '0');
26
+ }, []);
27
+ return { ref, onPointerMove, onPointerLeave };
28
+ }
29
+ //# sourceMappingURL=use-pointer-border-highlight.js.map
@@ -36,6 +36,8 @@ export declare const useTelemetryFallback: () => {
36
36
  sendCodeSnippetReportedMessage: () => void;
37
37
  sendConnectMcpClickedMessage: () => void;
38
38
  sendMcpConnectionSnippetCopiedMessage: () => void;
39
+ sendPromptTagCopiedMessage: () => void;
40
+ sendPromptTagOpenedMessage: () => void;
39
41
  sendMobileMenuClosedMessage: () => void;
40
42
  sendMobileMenuOpenedMessage: () => void;
41
43
  sendPageViewedMessage: () => void;
@@ -41,6 +41,8 @@ const useTelemetryFallback = () => ({
41
41
  sendCodeSnippetReportedMessage: () => { },
42
42
  sendConnectMcpClickedMessage: () => { },
43
43
  sendMcpConnectionSnippetCopiedMessage: () => { },
44
+ sendPromptTagCopiedMessage: () => { },
45
+ sendPromptTagOpenedMessage: () => { },
44
46
  sendMobileMenuClosedMessage: () => { },
45
47
  sendMobileMenuOpenedMessage: () => { },
46
48
  sendPageViewedMessage: () => { },
@@ -12,12 +12,13 @@ const variables_dark_7 = require("../../components/Tag/variables.dark");
12
12
  const variables_dark_8 = require("../../components/StatusCode/variables.dark");
13
13
  const variables_dark_9 = require("../../components/Switch/variables.dark");
14
14
  const variables_dark_10 = require("../../markdoc/components/Cards/variables.dark");
15
- const variables_dark_11 = require("../../components/Catalog/variables.dark");
16
- const variables_dark_12 = require("../../components/PageActions/variables.dark");
17
- const variables_dark_13 = require("../../components/Tooltip/variables.dark");
18
- const variables_dark_14 = require("../../components/Banner/variables.dark");
19
- const variables_dark_15 = require("../../components/Admonition/variables.dark");
20
- const variables_dark_16 = require("../../components/CodeBlock/variables.dark");
15
+ const variables_dark_11 = require("../../markdoc/components/Prompt/variables.dark");
16
+ const variables_dark_12 = require("../../components/Catalog/variables.dark");
17
+ const variables_dark_13 = require("../../components/PageActions/variables.dark");
18
+ const variables_dark_14 = require("../../components/Tooltip/variables.dark");
19
+ const variables_dark_15 = require("../../components/Banner/variables.dark");
20
+ const variables_dark_16 = require("../../components/Admonition/variables.dark");
21
+ const variables_dark_17 = require("../../components/CodeBlock/variables.dark");
21
22
  const palette_dark_1 = require("./palette.dark");
22
23
  const replayDarkMode = (0, styled_components_1.css) `
23
24
  /**
@@ -353,15 +354,16 @@ exports.darkMode = (0, styled_components_1.css) `
353
354
  ${replayDarkMode}
354
355
  ${variables_dark_9.switcherDarkMode}
355
356
  ${variables_dark_10.cardsDarkMode}
356
- ${variables_dark_11.catalogDarkMode}
357
- ${variables_dark_12.pageActionsDarkMode}
358
- ${variables_dark_13.tooltipDarkMode}
359
- ${variables_dark_14.bannerDarkMode}
360
- ${variables_dark_15.admonitionDarkMode}
357
+ ${variables_dark_11.promptTagDarkMode}
358
+ ${variables_dark_12.catalogDarkMode}
359
+ ${variables_dark_13.pageActionsDarkMode}
360
+ ${variables_dark_14.tooltipDarkMode}
361
+ ${variables_dark_15.bannerDarkMode}
362
+ ${variables_dark_16.admonitionDarkMode}
361
363
  ${badgesDarkMode}
362
364
  ${numberedListDarkMode}
363
365
  ${palette_dark_1.activeBrandPaletteDark}
364
- ${variables_dark_16.codeBlockDarkMode}
366
+ ${variables_dark_17.codeBlockDarkMode}
365
367
  /**
366
368
  * @tokens Dark Theme Scrollbar Config
367
369
  * @presenter Color
@@ -45,13 +45,14 @@ const variables_40 = require("../../components/VersionPicker/variables");
45
45
  const variables_41 = require("../../components/DatePicker/variables");
46
46
  const variables_42 = require("../../components/Switch/variables");
47
47
  const variables_43 = require("../../markdoc/components/Cards/variables");
48
- const variables_44 = require("../../markdoc/components/CodeWalkthrough/variables");
49
- const variables_45 = require("../../components/SkipContent/variables");
50
- const variables_46 = require("../../components/PageActions/variables");
51
- const variables_47 = require("../../components/SvgViewer/variables");
52
- const variables_48 = require("../../components/Toast/variables");
53
- const variables_49 = require("../../components/PageNavigation/variables");
54
- const variables_50 = require("../../components/NavigationTabs/variables");
48
+ const variables_44 = require("../../markdoc/components/Prompt/variables");
49
+ const variables_45 = require("../../markdoc/components/CodeWalkthrough/variables");
50
+ const variables_46 = require("../../components/SkipContent/variables");
51
+ const variables_47 = require("../../components/PageActions/variables");
52
+ const variables_48 = require("../../components/SvgViewer/variables");
53
+ const variables_49 = require("../../components/Toast/variables");
54
+ const variables_50 = require("../../components/PageNavigation/variables");
55
+ const variables_51 = require("../../components/NavigationTabs/variables");
55
56
  const utils_1 = require("../../core/utils");
56
57
  const palette_1 = require("./palette");
57
58
  const dark_1 = require("./dark");
@@ -863,46 +864,6 @@ const loadProgressBar = (0, styled_components_1.css) `
863
864
  --load-progress-bar-height: 2px; // @presenter Height
864
865
 
865
866
  // @tokens End
866
-
867
- /* Make clicks pass-through */
868
- #nprogress {
869
- pointer-events: none;
870
- }
871
-
872
- #nprogress .bar {
873
- background: var(--load-progress-bar-color);
874
-
875
- position: fixed;
876
- z-index: var(--z-index-popover);
877
- top: 0;
878
- left: 0;
879
-
880
- width: 100%;
881
- height: var(--load-progress-bar-height);
882
- }
883
-
884
- #nprogress .peg {
885
- display: block;
886
- position: absolute;
887
- right: 0;
888
- width: 100px;
889
- height: 100%;
890
- box-shadow: var(--load-progress-bar-shadow);
891
- opacity: 1;
892
-
893
- -webkit-transform: rotate(3deg) translate(0px, -4px);
894
- -ms-transform: rotate(3deg) translate(0px, -4px);
895
- transform: rotate(3deg) translate(0px, -4px);
896
- }
897
-
898
- .nprogress-custom-parent {
899
- overflow: hidden;
900
- position: relative;
901
- }
902
-
903
- .nprogress-custom-parent #nprogress .bar {
904
- position: absolute;
905
- }
906
867
  `;
907
868
  const inputs = (0, styled_components_1.css) `
908
869
  /**
@@ -1322,10 +1283,11 @@ exports.tokens = (0, styled_components_1.css) `
1322
1283
  ${variables_21.aiAssistantButton}
1323
1284
  ${variables_21.connectMcpButton}
1324
1285
  ${variables_43.cards}
1286
+ ${variables_44.promptTag}
1325
1287
  ${variables_8.catalog}
1326
1288
  ${variables_11.catalogClassic}
1327
1289
  ${variables_25.code}
1328
- ${variables_44.codeWalkthrough}
1290
+ ${variables_45.codeWalkthrough}
1329
1291
  ${docsDropdown}
1330
1292
  ${variables_15.dropdown}
1331
1293
  ${error}
@@ -1353,7 +1315,7 @@ exports.tokens = (0, styled_components_1.css) `
1353
1315
  ${variables_26.productPicker}
1354
1316
  ${variables_12.responsePanelColors}
1355
1317
  ${variables_23.search}
1356
- ${variables_50.navigationTabs}
1318
+ ${variables_51.navigationTabs}
1357
1319
  ${variables_14.select}
1358
1320
  ${variables_4.sidebar}
1359
1321
  ${sizeAndSpace}
@@ -1379,11 +1341,11 @@ exports.tokens = (0, styled_components_1.css) `
1379
1341
  ${variables_2.scorecard}
1380
1342
  ${variables_41.datePicker}
1381
1343
  ${replay}
1382
- ${variables_45.skipContent}
1383
- ${variables_46.pageActions}
1384
- ${variables_47.svgViewer}
1385
- ${variables_48.toast}
1386
- ${variables_49.pageNavigation}
1344
+ ${variables_46.skipContent}
1345
+ ${variables_47.pageActions}
1346
+ ${variables_48.svgViewer}
1347
+ ${variables_49.toast}
1348
+ ${variables_50.pageNavigation}
1387
1349
 
1388
1350
  `;
1389
1351
  exports.styles = (0, styled_components_1.css) `
@@ -26,3 +26,4 @@ export type * from './toast';
26
26
  export type * from './link';
27
27
  export type * from './button-group';
28
28
  export type * from './dropdown';
29
+ export type * from './prompt';