@apify/docs-theme 1.0.224 → 1.0.226

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apify/docs-theme",
3
- "version": "1.0.224",
3
+ "version": "1.0.226",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "files": [
@@ -7,10 +7,13 @@ import {
7
7
  CheckIcon,
8
8
  ChevronDownIcon,
9
9
  CopyIcon,
10
+ CursorIcon,
10
11
  ExternalLinkIcon,
11
12
  LoaderIcon,
12
13
  MarkdownIcon,
14
+ McpIcon,
13
15
  PerplexityIcon,
16
+ VscodeIcon,
14
17
  } from '@apify/ui-icons';
15
18
  import { Menu, Text, theme } from '@apify/ui-library';
16
19
 
@@ -31,6 +34,29 @@ const DROPDOWN_OPTIONS = [
31
34
  Icon: MarkdownIcon,
32
35
  value: 'viewAsMarkdown',
33
36
  },
37
+ {
38
+ label: 'Copy MCP server',
39
+ description: 'Copy MCP Server URL to clipboard',
40
+ showExternalIcon: false,
41
+ Icon: McpIcon,
42
+ value: 'copyMcpServer',
43
+ },
44
+ {
45
+ label: 'Connect to Cursor',
46
+ description: 'Install MCP Server on Cursor',
47
+ showExternalIcon: true,
48
+ // TODO: Replace with CursorIcon - we don't have one yet
49
+ Icon: CursorIcon,
50
+ value: 'connectCursor',
51
+ },
52
+ {
53
+ label: 'Connect to VS Code',
54
+ description: 'Install MCP server on VS Code',
55
+ showExternalIcon: true,
56
+ // TODO: Replace with VS Code Icon - we don't have one yet
57
+ Icon: VscodeIcon,
58
+ value: 'connectVsCode',
59
+ },
34
60
  {
35
61
  label: 'Open in ChatGPT',
36
62
  description: 'Ask questions about this page',
@@ -54,6 +80,16 @@ const DROPDOWN_OPTIONS = [
54
80
  },
55
81
  ];
56
82
 
83
+ const MCP_SERVER_URL = 'https://mcp.apify.com/?tools=docs';
84
+
85
+ const MCP_CONFIG_JSON = `{
86
+ "mcpServers": {
87
+ "apify": {
88
+ "url": "${MCP_SERVER_URL}"
89
+ }
90
+ }
91
+ }`;
92
+
57
93
  const getPrompt = (currentUrl) => `Read from ${currentUrl} so I can ask questions about it.`;
58
94
  const getMarkdownUrl = (currentUrl) => {
59
95
  const url = new URL(currentUrl);
@@ -161,6 +197,87 @@ const onCopyAsMarkdownClick = async ({ setCopyingStatus }) => {
161
197
  }
162
198
  };
163
199
 
200
+ const onCopyMcpServerClick = async () => {
201
+ if (window.analytics) {
202
+ window.analytics.track('Clicked', {
203
+ app: 'docs',
204
+ button_text: 'Copy MCP server',
205
+ element: 'llm-buttons.copyMcpServer',
206
+ });
207
+ }
208
+
209
+ try {
210
+ await navigator.clipboard.writeText(MCP_CONFIG_JSON);
211
+ } catch (error) {
212
+ console.error('Failed to copy MCP configuration:', error);
213
+ }
214
+ };
215
+
216
+ const openApifyMcpConfigurator = (integration) => {
217
+ try {
218
+ window.open(`https://mcp.apify.com/?integration=${integration}`, '_blank');
219
+ } catch (error) {
220
+ console.error('Error opening fallback URL:', error);
221
+ }
222
+ };
223
+
224
+ const openMcpIntegration = async (integration) => {
225
+ // Try to open the app directly using URL scheme
226
+ let appUrl;
227
+ if (integration === 'cursor') {
228
+ // Cursor deeplink format:
229
+ // cursor://anysphere.cursor-deeplink/mcp/install?name=$NAME&config=$BASE64_JSON
230
+ const cursorConfig = {
231
+ url: MCP_SERVER_URL,
232
+ };
233
+ const encodedConfig = btoa(JSON.stringify(cursorConfig));
234
+ appUrl = `cursor://anysphere.cursor-deeplink/mcp/install?name=apify&config=${encodeURIComponent(encodedConfig)}`;
235
+ } else if (integration === 'vscode') {
236
+ // VS Code deeplink format: vscode:mcp/install?<url-encoded-json>
237
+ const mcpConfig = {
238
+ name: 'Apify',
239
+ type: 'http',
240
+ url: MCP_SERVER_URL,
241
+ };
242
+ const encodedConfig = encodeURIComponent(JSON.stringify(mcpConfig));
243
+ appUrl = `vscode:mcp/install?${encodedConfig}`;
244
+ }
245
+
246
+ if (appUrl) {
247
+ const openedWindow = window.open(appUrl, '_blank');
248
+
249
+ if (openedWindow) {
250
+ return;
251
+ }
252
+ }
253
+ // Fallback to web configurator if appUrl doesn't exist or window.open failed
254
+ openApifyMcpConfigurator(integration);
255
+ };
256
+
257
+ const onConnectCursorClick = () => {
258
+ if (window.analytics) {
259
+ window.analytics.track('Clicked', {
260
+ app: 'docs',
261
+ button_text: 'Connect to Cursor',
262
+ element: 'llm-buttons.connectCursor',
263
+ });
264
+ }
265
+
266
+ openMcpIntegration('cursor');
267
+ };
268
+
269
+ const onConnectVsCodeClick = () => {
270
+ if (window.analytics) {
271
+ window.analytics.track('Clicked', {
272
+ app: 'docs',
273
+ button_text: 'Connect to VS Code',
274
+ element: 'llm-buttons.connectVsCode',
275
+ });
276
+ }
277
+
278
+ openMcpIntegration('vscode');
279
+ };
280
+
164
281
  const onViewAsMarkdownClick = () => {
165
282
  if (window.analytics) {
166
283
  window.analytics.track('Clicked', {
@@ -257,6 +374,15 @@ export default function LLMButtons({ isApiReferencePage = false }) {
257
374
  case 'viewAsMarkdown':
258
375
  onViewAsMarkdownClick();
259
376
  break;
377
+ case 'copyMcpServer':
378
+ onCopyMcpServerClick();
379
+ break;
380
+ case 'connectCursor':
381
+ onConnectCursorClick();
382
+ break;
383
+ case 'connectVsCode':
384
+ onConnectVsCodeClick();
385
+ break;
260
386
  case 'openInChatGPT':
261
387
  onOpenInChatGPTClick();
262
388
  break;
@@ -277,9 +403,9 @@ export default function LLMButtons({ isApiReferencePage = false }) {
277
403
  [styles.llmMenuApiReferencePage]: isApiReferencePage,
278
404
  })}
279
405
  onMenuOpen={(isOpen) => chevronIconRef.current?.classList.toggle(
280
- styles.chevronIconOpen,
281
- isOpen,
282
- )
406
+ styles.chevronIconOpen,
407
+ isOpen,
408
+ )
283
409
  }
284
410
  components={{
285
411
  MenuBase: (props) => (
@@ -126,12 +126,15 @@ html[data-theme='dark'] {
126
126
 
127
127
  :root {
128
128
  /* use default system font based on https://devhints.io/css-system-font-stack */
129
- --ifm-font-family-base: -apple-system, BlinkMacSystemFont, 'Segoe UI',
130
- 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans',
131
- 'Helvetica Neue', sans-serif;
132
- --ifm-heading-font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI',
133
- 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans',
134
- 'Helvetica Neue', sans-serif;
129
+ --ifm-font-family-base:
130
+ -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
131
+ 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
132
+ sans-serif;
133
+ --ifm-heading-font-family: 'Lota Grotesque', sans-serif;
134
+ --tsd-spacing-vertical: 1.2rem !important;
135
+ --tsd-spacing-horizontal: 1.6rem !important;
136
+ --ifm-list-item-margin: 0.4rem !important;
137
+ --ifm-list-left-padding: 3.2rem !important;
135
138
  --ifm-font-weight-semibold: 600;
136
139
  --ifm-font-color-base: #242736;
137
140
 
@@ -286,6 +289,34 @@ html[data-theme='dark'] {
286
289
  --button-gradient: linear-gradient(180deg, rgba(255, 255, 255, 0.3) 0%, rgba(255, 255, 255, 0) 100%);
287
290
  }
288
291
 
292
+ @font-face {
293
+ font-family: 'Lota Grotesque';
294
+ src:
295
+ url('/font/lota.woff2') format('woff2'),
296
+ url('/font/lota.woff') format('woff');
297
+ font-weight: 600;
298
+ }
299
+
300
+ .apiItemContainer h2 {
301
+ font-size: 2.4rem;
302
+ }
303
+
304
+ .apiItemContainer h3 {
305
+ font-size: 2rem;
306
+ }
307
+
308
+ .apiItemContainer h4 {
309
+ font-size: 1.6rem;
310
+ }
311
+
312
+ .apiItemContainer h5 {
313
+ font-size: 1.4rem;
314
+ }
315
+
316
+ .tsd-comment {
317
+ margin-bottom: var(--tsd-spacing-vertical);
318
+ }
319
+
289
320
  .markdown h1,
290
321
  .markdown h2,
291
322
  .markdown h3,
@@ -621,7 +652,7 @@ article .card h2 {
621
652
  }
622
653
 
623
654
  .tsd-panel-header .tsd-flag-group {
624
- margin-right: .5rem;
655
+ margin-right: .8rem;
625
656
  margin-left: .5rem;
626
657
  }
627
658