@clidey/dory 1.0.8 → 1.9.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.
- package/README.md +12 -1
- package/bin/chat-server.ts +270 -0
- package/bin/dist/analytics-server.d.ts +11 -0
- package/bin/dist/analytics-server.d.ts.map +1 -0
- package/bin/dist/analytics-server.js +121 -0
- package/bin/dist/analytics-server.js.map +1 -0
- package/bin/dist/automation.d.ts +35 -0
- package/bin/dist/automation.d.ts.map +1 -0
- package/bin/dist/automation.js +259 -0
- package/bin/dist/automation.js.map +1 -0
- package/bin/dist/chat-server.d.ts +8 -0
- package/bin/dist/chat-server.d.ts.map +1 -0
- package/bin/dist/chat-server.js +322 -0
- package/bin/dist/chat-server.js.map +1 -0
- package/bin/dist/check.d.ts +16 -0
- package/bin/dist/check.d.ts.map +1 -0
- package/bin/dist/check.js +247 -0
- package/bin/dist/check.js.map +1 -0
- package/bin/dist/dory.js +252 -402
- package/bin/dist/dory.js.map +1 -1
- package/bin/dist/i18n-init.d.ts +6 -0
- package/bin/dist/i18n-init.d.ts.map +1 -0
- package/bin/dist/i18n-init.js +56 -0
- package/bin/dist/i18n-init.js.map +1 -0
- package/bin/dist/mcp-http.d.ts +8 -0
- package/bin/dist/mcp-http.d.ts.map +1 -0
- package/bin/dist/mcp-http.js +72 -0
- package/bin/dist/mcp-http.js.map +1 -0
- package/bin/dist/mcp.d.ts +2 -0
- package/bin/dist/mcp.d.ts.map +1 -0
- package/bin/dist/mcp.js +81 -0
- package/bin/dist/mcp.js.map +1 -0
- package/bin/dist/preview-entry.d.ts +2 -0
- package/bin/dist/preview-entry.d.ts.map +1 -0
- package/bin/dist/preview-entry.js +6 -0
- package/bin/dist/preview-entry.js.map +1 -0
- package/bin/dist/preview-server.d.ts +5 -0
- package/bin/dist/preview-server.d.ts.map +1 -0
- package/bin/dist/preview-server.js +159 -0
- package/bin/dist/preview-server.js.map +1 -0
- package/bin/dist/project-config.d.ts +22 -0
- package/bin/dist/project-config.d.ts.map +1 -0
- package/bin/dist/project-config.js +44 -0
- package/bin/dist/project-config.js.map +1 -0
- package/dist/index.html +57 -0
- package/dist/runtime/dory-runtime.css +2 -0
- package/dist/runtime/dory-runtime.html +14 -0
- package/dist/runtime/dory-runtime.js +5490 -0
- package/docs/api-playground-demo.mdx +119 -0
- package/docs/api-reference/asyncapi.json +324 -0
- package/docs/api-reference/openapi.json +366 -0
- package/docs/api-reference/operations/create.mdx +5 -0
- package/docs/api-reference/operations/delete.mdx +5 -0
- package/docs/api-reference/operations/get.mdx +5 -0
- package/docs/api-reference/operations/update.mdx +5 -0
- package/docs/api-reference/websocket-operations/receive-chat-message.mdx +5 -0
- package/docs/api-reference/websocket-operations/receive-notifications.mdx +5 -0
- package/docs/api-reference/websocket-operations/receive-presence-update.mdx +5 -0
- package/docs/api-reference/websocket-operations/send-chat-message.mdx +5 -0
- package/docs/api-reference/websocket-operations/send-presence-update.mdx +5 -0
- package/docs/assets/dory.jpeg +0 -0
- package/docs/components/accordion.mdx +145 -0
- package/docs/components/callouts.mdx +134 -0
- package/docs/components/cards.mdx +153 -0
- package/docs/components/code-blocks.mdx +281 -0
- package/docs/components/expandable.mdx +189 -0
- package/docs/components/icons.mdx +71 -0
- package/docs/components/images.mdx +82 -0
- package/docs/components/latex.mdx +148 -0
- package/docs/components/layout.mdx +175 -0
- package/docs/components/lists.mdx +134 -0
- package/docs/components/mermaid.mdx +149 -0
- package/docs/components/overview.mdx +81 -0
- package/docs/components/source.mdx +130 -0
- package/docs/components/steps.mdx +122 -0
- package/docs/components/tables.mdx +114 -0
- package/docs/components/tags.mdx +179 -0
- package/docs/components/typography.mdx +185 -0
- package/docs/configuration/analytics.mdx +45 -0
- package/docs/configuration/chat.mdx +59 -0
- package/docs/configuration/dory-json.mdx +278 -0
- package/docs/configuration/embed.mdx +73 -0
- package/docs/configuration/fonts.mdx +86 -0
- package/docs/configuration/internationalization.mdx +61 -0
- package/docs/configuration/navigation.mdx +217 -0
- package/docs/configuration/theming.mdx +166 -0
- package/docs/dory.json +129 -0
- package/docs/embed-example.html +176 -0
- package/docs/favicon.svg +18 -0
- package/docs/features.mdx +440 -0
- package/docs/getting-started/automation.mdx +76 -0
- package/docs/getting-started/configuration.mdx +95 -0
- package/docs/getting-started/installation.mdx +88 -0
- package/docs/getting-started/quick-start.mdx +53 -0
- package/docs/getting-started/whodb-ee-apps.mdx +122 -0
- package/docs/introduction.mdx +50 -0
- package/docs/logo/logo.svg +18 -0
- package/docs/playgrounds/api-playground.mdx +122 -0
- package/docs/playgrounds/websocket-playground.mdx +98 -0
- package/docs/social-card.png +0 -0
- package/docs/social-card.svg +17 -0
- package/docs/websocket-playground-demo.mdx +135 -0
- package/package.json +23 -17
- package/scripts/verify-runtime-parity.mjs +146 -0
- package/src/app.css +19 -1
- package/src/assets/fonts/HankenGrotesk.ttf +0 -0
- package/src/assets/fonts/OFL.txt +94 -0
- package/src/components/chat-assistant.tsx +229 -0
- package/src/components/dropdown.tsx +3 -3
- package/src/components/error-boundary.tsx +2 -2
- package/src/components/hooks.tsx +20 -1
- package/src/components/navigation.tsx +82 -51
- package/src/components/notification.tsx +2 -3
- package/src/components/routes.tsx +17 -19
- package/src/components/search-index.test.ts +15 -0
- package/src/components/search-index.ts +49 -48
- package/src/components/search.tsx +208 -104
- package/src/components/store.ts +27 -9
- package/src/config/mdx-common.ts +11 -0
- package/src/config/mdx.ts +10 -11
- package/src/embed/loader.ts +0 -3
- package/src/embed/types.ts +0 -2
- package/src/embed/widget-iframe.ts +19 -21
- package/src/embedded-runtime/config.ts +138 -0
- package/src/embedded-runtime/index.tsx +680 -0
- package/src/embedded-runtime/runtime.html +14 -0
- package/src/entry-server.tsx +46 -124
- package/src/main.tsx +16 -4
- package/src/mdx/accordion.tsx +3 -3
- package/src/mdx/api-playground.tsx +18 -16
- package/src/mdx/async-api.tsx +2 -2
- package/src/mdx/card.tsx +3 -2
- package/src/mdx/code.tsx +11 -9
- package/src/mdx/fence.tsx +6 -5
- package/src/mdx/icon-grid.tsx +4 -1
- package/src/mdx/icon-names.test.ts +15 -0
- package/src/mdx/icon-names.ts +60 -0
- package/src/mdx/icon-source-variants.ts +102 -0
- package/src/mdx/icon.tsx +12 -73
- package/src/mdx/latex.tsx +3 -2
- package/src/mdx/mdx.tsx +1 -1
- package/src/mdx/mermaid.tsx +12 -6
- package/src/mdx/open-api.tsx +130 -74
- package/src/mdx/preprocess.test.ts +16 -0
- package/src/mdx/preprocess.ts +61 -0
- package/src/mdx/processor.ts +4 -96
- package/src/mdx/source.tsx +5 -4
- package/src/mdx/specimen.tsx +38 -6
- package/src/mdx/tabs.tsx +29 -21
- package/src/mdx/text.tsx +9 -9
- package/src/mdx/try-it-panel.tsx +284 -0
- package/src/mdx/type-scale.tsx +4 -4
- package/src/mdx/websocket-playground.tsx +21 -14
- package/src/plugins/analytics-injector.ts +8 -0
- package/src/plugins/chat-dev-server.ts +32 -0
- package/src/plugins/docs-assets.test.ts +25 -0
- package/src/plugins/docs-assets.ts +6 -2
- package/src/plugins/frontmatter-dev-server.ts +2 -2
- package/src/plugins/frontmatter-generator.ts +1 -1
- package/src/plugins/html-files-middleware.test.ts +21 -1
- package/src/plugins/html-files-middleware.ts +26 -6
- package/src/plugins/html-metadata-injector.ts +24 -4
- package/src/plugins/llm-txt-dev-server.ts +2 -2
- package/src/plugins/llm-txt-generator.ts +21 -4
- package/src/plugins/prerender.ts +47 -20
- package/src/plugins/robots-generator.ts +1 -1
- package/src/plugins/sanitize.ts +1 -1
- package/src/plugins/shared.ts +6 -18
- package/src/plugins/sitemap-generator.ts +1 -1
- package/src/plugins/social-preview.test.ts +71 -0
- package/src/plugins/social-preview.ts +87 -0
- package/src/plugins/unified-mdx-plugin.ts +1 -1
- package/src/theme.scss +630 -207
- package/src/types/config.ts +53 -1
- package/src/ui/breadcrumb.tsx +17 -0
- package/src/ui/docs-header-view.tsx +32 -0
- package/src/ui/docs-navigation-view.tsx +69 -0
- package/src/ui/docs-page-frame.tsx +50 -0
- package/src/ui/dory-mark.tsx +9 -0
- package/src/ui/header.tsx +33 -90
- package/src/ui/layout.tsx +99 -153
- package/src/ui/mobile-navigation.tsx +10 -8
- package/src/ui/page-actions.tsx +67 -0
- package/src/ui/page-feedback.tsx +50 -0
- package/src/ui/page-footer.tsx +23 -0
- package/src/ui/prev-next-link.tsx +15 -69
- package/src/ui/prev-next-view.tsx +27 -0
- package/src/ui/table-of-content-view.tsx +167 -0
- package/src/ui/table-of-content.tsx +25 -183
- package/src/utils/analytics.test.ts +36 -0
- package/src/utils/analytics.ts +35 -0
- package/src/utils/colors.ts +7 -0
- package/src/utils/content-scope.test.ts +26 -0
- package/src/utils/content-scope.ts +39 -0
- package/src/utils/search-content.ts +12 -0
- package/src/utils/theme.ts +1 -7
- package/vite.config.ssr.ts +3 -3
- package/vite.config.ts +21 -15
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 'Quick Start'
|
|
3
|
+
description: 'Create, check, and build your first Dory documentation site.'
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Quick Start
|
|
7
|
+
|
|
8
|
+
## 1. Create a documentation project
|
|
9
|
+
|
|
10
|
+
Install the CLI, create a folder, and initialize your site:
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
pnpm add -g @clidey/dory
|
|
14
|
+
mkdir my-docs
|
|
15
|
+
cd my-docs
|
|
16
|
+
dory init
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
`dory init` creates `dory.json`, `docs/introduction.mdx`, and a starter logo. Keep your pages in `docs/` and add their page keys to `dory.json` navigation.
|
|
20
|
+
|
|
21
|
+
## 2. Write with a live preview
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
dory dev
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Open the local URL shown in your terminal. Changes to your MDX files reload while you write.
|
|
28
|
+
|
|
29
|
+
## 3. Check the whole site
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
dory check
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
The check reports missing navigation pages, broken local links and anchors, missing assets, and invalid frontmatter. Run it in CI before publishing.
|
|
36
|
+
|
|
37
|
+
## 4. Build and preview
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
dory build
|
|
41
|
+
dory preview
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
The static site is written to `dist/`. The build accepts a top-level `docs/` folder and does not modify the installed Dory package. `dory preview` also serves the optional [documentation chat](/configuration/chat) when you configure a model on the server.
|
|
45
|
+
|
|
46
|
+
## Next steps
|
|
47
|
+
|
|
48
|
+
<CardGroup cols={2}>
|
|
49
|
+
<Card title="Configuration" href="/getting-started/configuration" icon="settings" description="Customize navigation, branding, and metadata." />
|
|
50
|
+
<Card title="Components" href="/components/overview" icon="layout-dashboard" description="Add richer examples to your pages." />
|
|
51
|
+
<Card title="Languages and versions" href="/configuration/internationalization" icon="globe" description="Organize translated and versioned content." />
|
|
52
|
+
<Card title="Documentation chat" href="/configuration/chat" icon="message-square" description="Add an optional cited assistant." />
|
|
53
|
+
</CardGroup>
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 'WhoDB EE apps'
|
|
3
|
+
description: 'Write MDX documentation in a WhoDB EE app and show it inside the app host.'
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Document WhoDB EE apps
|
|
7
|
+
|
|
8
|
+
WhoDB EE can keep documentation with the app it describes. Add MDX files under the app's `docs/` directory. App editors can write and preview them in the **Docs** tab. When the app is published, WhoDB publishes the MDX files with the app version and shows them in the app host's **Help** panel. There is no separate Dory site or deployment to manage.
|
|
9
|
+
|
|
10
|
+
The Dory renderer is bundled with WhoDB as JavaScript and CSS. It runs inside a sandboxed frame, separate from the WhoDB host and the app runner. The host gives it a list of allowed pages; Dory requests an MDX file when the reader opens that page. WhoDB checks each request against the reader's authorized app documentation. The app runner does not receive documentation source or WhoDB credentials.
|
|
11
|
+
|
|
12
|
+
## Add pages
|
|
13
|
+
|
|
14
|
+
Start with `docs/index.mdx`. Give each page a title in frontmatter and use ordinary MDX for its body:
|
|
15
|
+
|
|
16
|
+
```mdx docs/index.mdx
|
|
17
|
+
---
|
|
18
|
+
title: Inventory app
|
|
19
|
+
description: How to use the inventory workspace.
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
# Inventory app
|
|
23
|
+
|
|
24
|
+
Use this workspace to review stock levels and update reorder plans.
|
|
25
|
+
|
|
26
|
+
[View reports](/reports)
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Add `docs/reports.mdx` for the `/reports` link. Subfolders work too, such as `docs/admin/permissions.mdx`. Pages are discovered from the files; an app does not need a `dory.json`. Keep linked routes within the app's documentation pages.
|
|
30
|
+
|
|
31
|
+
The embedded viewer renders Markdown, Dory's layout and callout components, Mermaid diagrams, and KaTeX math. API and WebSocket playgrounds, remote `Source` content, and `Specimen` demos are unavailable in the app sandbox. HTTPS image URLs work; storing binary image files alongside the app's MDX is not yet supported.
|
|
32
|
+
|
|
33
|
+
The embedded **Ask Dory** panel searches only the app documentation pages already authorized for the reader's selected language. It returns an excerpt and links to the matching source pages. This local mode makes no model request and does not produce a generated AI answer. Dory's standalone documentation chat uses a separate server-side model endpoint; the embedded viewer cannot call that endpoint from its sandbox.
|
|
34
|
+
|
|
35
|
+
In WhoDB EE, open the app editor and select **Docs**. Create a page, edit its MDX, preview it, and save the draft. Publishing the app makes the saved pages available to readers with access to that app. Draft edits do not change the published docs until the next app publish.
|
|
36
|
+
|
|
37
|
+
## Customize the docs site
|
|
38
|
+
|
|
39
|
+
The Docs tab can preview the app's site name, logo, colors, fonts, and navigation alongside its MDX. These settings live in the app's `app.json` under `documentation.site`, so the app and its docs can be published together. The site settings are optional; an app with only MDX pages still has a usable docs layout.
|
|
40
|
+
|
|
41
|
+
```json app.json
|
|
42
|
+
{
|
|
43
|
+
"documentation": {
|
|
44
|
+
"site": {
|
|
45
|
+
"name": "Inventory docs",
|
|
46
|
+
"version": "1.0",
|
|
47
|
+
"logo": {
|
|
48
|
+
"light": "https://example.com/inventory-logo-light.svg",
|
|
49
|
+
"dark": "https://example.com/inventory-logo-dark.svg"
|
|
50
|
+
},
|
|
51
|
+
"colors": { "primary": "#528ff4" },
|
|
52
|
+
"fonts": { "family": "Hanken Grotesk", "heading": { "family": "Bricolage Grotesque" } },
|
|
53
|
+
"navigation": {
|
|
54
|
+
"tabs": [{
|
|
55
|
+
"tab": "Guides",
|
|
56
|
+
"groups": [{ "group": "Getting started", "pages": ["index", "reports"] }]
|
|
57
|
+
}]
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Navigation page names are relative to `docs/` and omit `.mdx`. The viewer includes only pages that exist in the selected language. You can also set `title`, `colors.light` and `colors.dark`, `theme.mode` (`light`, `dark`, or `system`), `theme.radius`, and mono font family. Logos must use HTTPS URLs or image data URLs; local binary assets are not yet bundled with the app documentation. The embedded renderer uses the site's font family if it is already available in the browser; it does not fetch a custom font stylesheet from the config.
|
|
65
|
+
|
|
66
|
+
The Docs tab saves edits as a draft. Readers see the published version of `documentation.site` and its MDX files after the next app publish.
|
|
67
|
+
|
|
68
|
+
## Keep docs beside a local app
|
|
69
|
+
|
|
70
|
+
The WhoDB CLI includes `docs/*.mdx` when it reads an app folder. This lets you review documentation changes alongside app code and publish them together:
|
|
71
|
+
|
|
72
|
+
```text
|
|
73
|
+
inventory-app/
|
|
74
|
+
├── app.json
|
|
75
|
+
├── docs/
|
|
76
|
+
│ ├── index.mdx
|
|
77
|
+
│ └── reports.mdx
|
|
78
|
+
└── pages/
|
|
79
|
+
└── main/
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
whodb apps publish ./inventory-app --draft --org <org> --project <project>
|
|
84
|
+
whodb apps publish ./inventory-app --message "Inventory docs" --org <org> --project <project>
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
The first command syncs the editable draft. The second creates a published app version, including its MDX files. See the WhoDB CLI app workflow for app creation, verification, and publication options.
|
|
88
|
+
|
|
89
|
+
## Open the right page from an app screen
|
|
90
|
+
|
|
91
|
+
The Help panel starts at `docs/index.mdx`. To select a page based on the current app screen, add a route map to `app.json`:
|
|
92
|
+
|
|
93
|
+
```json app.json
|
|
94
|
+
{
|
|
95
|
+
"documentation": {
|
|
96
|
+
"pages": {
|
|
97
|
+
"main": "/",
|
|
98
|
+
"reports": "/reports"
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
The map keys are app page names. The values select MDX pages under `docs/`; `/reports` selects `docs/reports.mdx`. Missing or invalid mappings fall back to the index or first available page. Readers can also share the app's URL with `?docs=reports` to open a specific docs page in its Help panel.
|
|
105
|
+
|
|
106
|
+
Documentation access follows the app's permissions. App editors can preview draft MDX; app viewers see the published snapshot. WhoDB loads docs through a separate authorized read path, so app code cannot read them through the app runtime.
|
|
107
|
+
|
|
108
|
+
## Translate app documentation
|
|
109
|
+
|
|
110
|
+
Keep the default language at `docs/index.mdx` and put authored translations under a language directory with the same page keys. For example, add `docs/fr/index.mdx` and `docs/fr/reports.mdx` for French. The Docs editor has a language selector so authors can edit and preview each set of pages. WhoDB's `fr_FR` interface language selects `docs/fr/`; English (US) uses the root `docs/` pages. English (UK) uses `docs/en-gb/`, and Chinese variants use `docs/zh-cn/` or `docs/zh-tw/`.
|
|
111
|
+
|
|
112
|
+
Each translated MDX file owns its title and body. WhoDB does not translate page content automatically. If an app has no pages for the reader's language, Help shows the default-language pages as English. If a language has some translated pages, its navigation shows only those authored pages; a missing matching page opens the first available page in that language. The iframe sets its HTML language and text direction from the chosen docs language, including right-to-left languages.
|
|
113
|
+
|
|
114
|
+
To translate navigation labels too, add `documentation.site.i18n.locales` entries with a language `code` and a `navigation` object in the same tab/group/page shape as the default navigation. Page names stay the same across languages; translated MDX titles and the locale's tab and group labels are shown to readers.
|
|
115
|
+
|
|
116
|
+
A link with `?docs=reports` follows the reader's selected language. To share a specific translation, use an explicit path such as `?docs=fr/reports`. The MCP `whodb_app_docs` tool can read a translated page with `page: "docs/fr/reports.mdx"` or that explicit page link. Its default URL lookup reads default-language content when no language is specified.
|
|
117
|
+
|
|
118
|
+
## Use the docs from an agent
|
|
119
|
+
|
|
120
|
+
An agent with authorized WhoDB access can use the WhoDB MCP server's read-only `whodb_app_docs` tool. Give it a published app link as `url` to list the available MDX pages. A link with `?docs=reports` reads that page directly. The tool also accepts organization, project, and app IDs plus an optional `page` such as `docs/reports.mdx`. It serves published content and applies WhoDB app permissions.
|
|
121
|
+
|
|
122
|
+
MCP clients need a one-time connection to the same WhoDB instance's `/mcp` endpoint. A private app link by itself cannot install a tool in Claude or Codex; after connection, the agent can use that one app link to discover and read its documentation without a separate Dory deployment.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 'Introduction'
|
|
3
|
+
description: 'Dory is a static documentation site generator for modern teams. Build beautiful docs from MDX files with zero configuration.'
|
|
4
|
+
lead: 'Dory turns a folder of MDX files and one dory.json into a fast, static documentation site. No framework setup, no boilerplate.'
|
|
5
|
+
meta:
|
|
6
|
+
Stack: Preact + Vite
|
|
7
|
+
License: MIT
|
|
8
|
+
Updated: 2026-10-21
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Introduction
|
|
12
|
+
|
|
13
|
+
## What is Dory?
|
|
14
|
+
|
|
15
|
+
Dory is a **static site generator built for technical documentation**. It turns MDX files and a single `dory.json` config into a fast, beautiful documentation site — with zero boilerplate.
|
|
16
|
+
|
|
17
|
+
<CardGroup cols={2}>
|
|
18
|
+
<Card title="Simple" icon="sparkles" description="Drop in .mdx files, configure one dory.json. No framework knowledge needed." />
|
|
19
|
+
<Card title="Fast" icon="zap" description="Instant hot reload in dev. Quick static builds optimized for production." />
|
|
20
|
+
<Card title="Portable" icon="globe" description="No SSR, no vendor lock-in. Deploy anywhere that serves static files." />
|
|
21
|
+
<Card title="Rich Components" icon="layout-dashboard" description="24 built-in MDX components: code blocks, diagrams, API playgrounds, and more." />
|
|
22
|
+
</CardGroup>
|
|
23
|
+
|
|
24
|
+
## Key Features
|
|
25
|
+
|
|
26
|
+
<Steps>
|
|
27
|
+
<Step title="Write MDX files">
|
|
28
|
+
Create `.mdx` files in your docs directory. Use standard Markdown with any of Dory's 24 built-in components for rich content.
|
|
29
|
+
</Step>
|
|
30
|
+
<Step title="Configure dory.json">
|
|
31
|
+
Set your site name, colors, fonts, logo, and navigation structure in a single `dory.json` file.
|
|
32
|
+
</Step>
|
|
33
|
+
<Step title="Run the CLI">
|
|
34
|
+
Use `dory build` to generate a static site or `dory preview` to serve a built site on port 3000.
|
|
35
|
+
</Step>
|
|
36
|
+
<Step title="Deploy anywhere">
|
|
37
|
+
The output is plain HTML, CSS, and JS — deploy to Netlify, Vercel, S3, GitHub Pages, or any static host.
|
|
38
|
+
</Step>
|
|
39
|
+
</Steps>
|
|
40
|
+
|
|
41
|
+
## Navigation
|
|
42
|
+
|
|
43
|
+
Use the sidebar to explore Dory's documentation:
|
|
44
|
+
|
|
45
|
+
<CardGroup cols={2}>
|
|
46
|
+
<Card title="Installation" href="/getting-started/installation" icon="package" description="Install Dory and set up your first project in minutes." />
|
|
47
|
+
<Card title="Quick Start" href="/getting-started/quick-start" icon="rocket" description="Go from zero to a live documentation site in 5 minutes." />
|
|
48
|
+
<Card title="Components" href="/components/overview" icon="layers" description="Browse all 24 built-in MDX components with live demos." />
|
|
49
|
+
<Card title="Configuration" href="/configuration/dory-json" icon="settings" description="Full reference for the dory.json configuration file." />
|
|
50
|
+
</CardGroup>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<svg width="22" height="24" viewBox="0 0 22 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M21.9941 4.99951C19.9947 3.00079 19.9947 3.00079 16.9956 0.00271368V4.99951H21.9941Z" fill="#92BFFA"/>
|
|
3
|
+
<path d="M7.49782 3.91843C7.49782 4.5155 7.98183 4.99951 8.5789 4.99951H16.9951V0.00271606H8.5789C7.98183 0.00271606 7.49782 0.486733 7.49782 1.0838V3.91843Z" fill="url(#paint0_linear_66_680)"/>
|
|
4
|
+
<path d="M21.9932 5.01123C22.0049 8.20987 21.9983 17.7036 21.9951 21.9995C21.9943 23.1041 21.0977 23.9995 19.9932 23.9995H2C0.895431 23.9995 3.87055e-07 23.1041 0 21.9995V8.59131C0 7.99426 0.48401 7.51028 1.08105 7.51025H3.91797C4.51481 7.51052 4.99902 7.99441 4.99902 8.59131V19.5024H16.9951V5.01123H21.9932Z" fill="url(#paint1_linear_66_680)"/>
|
|
5
|
+
<ellipse cx="12.3217" cy="14.276" rx="1.2973" ry="1.29647" fill="#1967D2"/>
|
|
6
|
+
<path d="M5 0.00634813C5.55157 0.00730227 5.99805 0.454718 5.99805 1.00635V4.01221C5.99805 4.64068 6.29707 5.23179 6.80273 5.60498L7.46777 6.09619C7.81171 6.35003 8.22878 6.48682 8.65625 6.48682H14.4951C15.0472 6.48682 15.4949 6.93475 15.4951 7.48682V16.98C15.4951 17.5322 15.0474 17.98 14.4951 17.98H7.49805C6.94583 17.9799 6.49808 17.5322 6.49805 16.98V8.67139C6.49806 8.23724 6.35689 7.81407 6.0957 7.46729L5.58691 6.79248C5.21558 6.29954 4.63759 6.00515 4.02051 5.99561H1C0.447722 5.9956 0 5.54789 0 4.99561V1.00049C0.000165845 0.447951 0.448441 -4.60729e-05 1.00098 0.00048876L5 0.00634813Z" fill="#FFC236"/>
|
|
7
|
+
<ellipse cx="12.9961" cy="15.505" rx="1" ry="0.999359" fill="#3630C4"/>
|
|
8
|
+
<defs>
|
|
9
|
+
<linearGradient id="paint0_linear_66_680" x1="10.9999" y1="0.00271606" x2="10.9999" y2="23.9995" gradientUnits="userSpaceOnUse">
|
|
10
|
+
<stop stop-color="#528FF4"/>
|
|
11
|
+
<stop offset="1" stop-color="#92BFFA"/>
|
|
12
|
+
</linearGradient>
|
|
13
|
+
<linearGradient id="paint1_linear_66_680" x1="10.9999" y1="0.00271606" x2="10.9999" y2="23.9995" gradientUnits="userSpaceOnUse">
|
|
14
|
+
<stop stop-color="#528FF4"/>
|
|
15
|
+
<stop offset="1" stop-color="#92BFFA"/>
|
|
16
|
+
</linearGradient>
|
|
17
|
+
</defs>
|
|
18
|
+
</svg>
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 'API Playground'
|
|
3
|
+
description: 'Interactive HTTP API testing built directly into your documentation. Test endpoints with real requests.'
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# API Playground
|
|
7
|
+
|
|
8
|
+
The `<APIPlayground>` component embeds a fully interactive HTTP client inside your documentation. Readers can test API endpoints with real requests without leaving the page.
|
|
9
|
+
|
|
10
|
+
## Live Demo
|
|
11
|
+
|
|
12
|
+
Try it now — this makes a real HTTP request to a public API:
|
|
13
|
+
|
|
14
|
+
<APIPlayground
|
|
15
|
+
method="GET"
|
|
16
|
+
url="https://jsonplaceholder.typicode.com/users"
|
|
17
|
+
title="List Users"
|
|
18
|
+
description="Fetches a list of all users from the JSONPlaceholder test API."
|
|
19
|
+
parameters={[
|
|
20
|
+
{ name: "_limit", type: "number", required: false, description: "Limit the number of results.", defaultValue: "10" }
|
|
21
|
+
]}
|
|
22
|
+
/>
|
|
23
|
+
|
|
24
|
+
## POST Request with Body
|
|
25
|
+
|
|
26
|
+
<APIPlayground
|
|
27
|
+
method="POST"
|
|
28
|
+
url="https://jsonplaceholder.typicode.com/posts"
|
|
29
|
+
title="Create Post"
|
|
30
|
+
description="Creates a new post. JSONPlaceholder simulates the creation and returns the new object."
|
|
31
|
+
headers={{ "Content-Type": "application/json" }}
|
|
32
|
+
body={{ "title": "My Post", "body": "Post content here.", "userId": 1 }}
|
|
33
|
+
/>
|
|
34
|
+
|
|
35
|
+
## Authenticated Endpoint
|
|
36
|
+
|
|
37
|
+
<APIPlayground
|
|
38
|
+
method="GET"
|
|
39
|
+
url="https://jsonplaceholder.typicode.com/users/1"
|
|
40
|
+
title="Get User (with Auth)"
|
|
41
|
+
description="Demonstrates Bearer token authentication. The token is sent in the Authorization header."
|
|
42
|
+
authType="bearer"
|
|
43
|
+
servers={[
|
|
44
|
+
{ url: "https://jsonplaceholder.typicode.com", description: "Production" },
|
|
45
|
+
{ url: "https://staging.jsonplaceholder.typicode.com", description: "Staging" }
|
|
46
|
+
]}
|
|
47
|
+
/>
|
|
48
|
+
|
|
49
|
+
## Usage in MDX
|
|
50
|
+
|
|
51
|
+
```mdx
|
|
52
|
+
<APIPlayground
|
|
53
|
+
method="GET"
|
|
54
|
+
url="https://api.example.com/users"
|
|
55
|
+
title="List Users"
|
|
56
|
+
description="Returns a paginated list of users."
|
|
57
|
+
parameters={[
|
|
58
|
+
{
|
|
59
|
+
name: "page",
|
|
60
|
+
type: "number",
|
|
61
|
+
required: false,
|
|
62
|
+
description: "Page number (1-indexed).",
|
|
63
|
+
defaultValue: "1"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
name: "limit",
|
|
67
|
+
type: "number",
|
|
68
|
+
required: false,
|
|
69
|
+
description: "Items per page.",
|
|
70
|
+
defaultValue: "20"
|
|
71
|
+
}
|
|
72
|
+
]}
|
|
73
|
+
headers={{
|
|
74
|
+
"Accept": "application/json"
|
|
75
|
+
}}
|
|
76
|
+
authType="bearer"
|
|
77
|
+
/>
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Features
|
|
81
|
+
|
|
82
|
+
<CardGroup cols={2}>
|
|
83
|
+
<Card title="Query Parameters" icon="sliders" description="Add, edit, and remove URL query parameters with a visual editor." />
|
|
84
|
+
<Card title="Request Headers" icon="list" description="Set custom headers including Content-Type, Accept, and custom headers." />
|
|
85
|
+
<Card title="Request Body" icon="file-json" description="Edit JSON request body with syntax highlighting." />
|
|
86
|
+
<Card title="Authentication" icon="lock" description="Supports Bearer token, API key, Basic auth, and no auth." />
|
|
87
|
+
<Card title="Multiple Servers" icon="server" description="Switch between server environments (production, staging, etc.)." />
|
|
88
|
+
<Card title="Response Display" icon="eye" description="Shows status code, response time, response headers, and formatted body." />
|
|
89
|
+
</CardGroup>
|
|
90
|
+
|
|
91
|
+
## Authentication Types
|
|
92
|
+
|
|
93
|
+
| `authType` | Description | Fields |
|
|
94
|
+
| --- | --- | --- |
|
|
95
|
+
| `none` | No authentication | — |
|
|
96
|
+
| `bearer` | Bearer token | Token field |
|
|
97
|
+
| `apiKey` | API key in header | Key name + value |
|
|
98
|
+
| `basic` | HTTP Basic auth | Username + password |
|
|
99
|
+
|
|
100
|
+
## Props Reference
|
|
101
|
+
|
|
102
|
+
| Prop | Type | Required | Description |
|
|
103
|
+
| --- | --- | --- | --- |
|
|
104
|
+
| `method` | `'GET' \| 'POST' \| 'PUT' \| 'DELETE'` | Yes | HTTP method. |
|
|
105
|
+
| `url` | `string` | Yes | Endpoint URL. |
|
|
106
|
+
| `title` | `string` | No | Display title. |
|
|
107
|
+
| `description` | `string` | No | Description shown above the playground. |
|
|
108
|
+
| `parameters` | `Parameter[]` | No | Pre-populated query parameters. |
|
|
109
|
+
| `headers` | `Record<string, string>` | No | Pre-populated request headers. |
|
|
110
|
+
| `body` | `object` | No | Pre-populated JSON request body. |
|
|
111
|
+
| `authType` | `'bearer' \| 'apiKey' \| 'basic' \| 'none'` | No | Authentication method. |
|
|
112
|
+
| `servers` | `Array<{ url, description }>` | No | Server environment options. |
|
|
113
|
+
|
|
114
|
+
### Parameter Object
|
|
115
|
+
|
|
116
|
+
| Field | Type | Description |
|
|
117
|
+
| --- | --- | --- |
|
|
118
|
+
| `name` | `string` | Parameter name. |
|
|
119
|
+
| `type` | `string` | Type hint (e.g. `"string"`, `"number"`). |
|
|
120
|
+
| `required` | `boolean` | Whether the parameter is required. |
|
|
121
|
+
| `description` | `string` | Parameter description. |
|
|
122
|
+
| `defaultValue` | `string` | Pre-populated value. |
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 'WebSocket Playground'
|
|
3
|
+
description: 'Interactive WebSocket connection tester with real-time message history built into your documentation.'
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# WebSocket Playground
|
|
7
|
+
|
|
8
|
+
The `<WebSocketPlayground>` component embeds a fully interactive WebSocket client inside your documentation. Readers can open connections, send messages, and observe responses in real time.
|
|
9
|
+
|
|
10
|
+
## Live Demo
|
|
11
|
+
|
|
12
|
+
Connect to a public WebSocket echo server — it sends back whatever you send:
|
|
13
|
+
|
|
14
|
+
<WebSocketPlayground
|
|
15
|
+
url="wss://echo.websocket.org"
|
|
16
|
+
title="Echo Server"
|
|
17
|
+
description="Connect to a public WebSocket echo server. Any message you send will be echoed back immediately."
|
|
18
|
+
servers={[
|
|
19
|
+
{ url: "wss://echo.websocket.org", description: "Public echo server" }
|
|
20
|
+
]}
|
|
21
|
+
/>
|
|
22
|
+
|
|
23
|
+
## With Subprotocols
|
|
24
|
+
|
|
25
|
+
<WebSocketPlayground
|
|
26
|
+
url="wss://echo.websocket.org"
|
|
27
|
+
title="Echo with Subprotocols"
|
|
28
|
+
description="Demonstrates subprotocol negotiation. The echo server accepts any subprotocol."
|
|
29
|
+
subprotocols={["chat", "json-protocol"]}
|
|
30
|
+
servers={[
|
|
31
|
+
{ url: "wss://echo.websocket.org", description: "Echo server" }
|
|
32
|
+
]}
|
|
33
|
+
/>
|
|
34
|
+
|
|
35
|
+
## Usage in MDX
|
|
36
|
+
|
|
37
|
+
```mdx
|
|
38
|
+
<WebSocketPlayground
|
|
39
|
+
url="wss://api.example.com/ws"
|
|
40
|
+
title="Real-time Events"
|
|
41
|
+
description="Subscribe to live events from the API."
|
|
42
|
+
subprotocols={["events-v1"]}
|
|
43
|
+
headers={{
|
|
44
|
+
"X-Client-Version": "2.0"
|
|
45
|
+
}}
|
|
46
|
+
authType="bearer"
|
|
47
|
+
servers={[
|
|
48
|
+
{ url: "wss://api.example.com/ws", description: "Production" },
|
|
49
|
+
{ url: "wss://staging.api.example.com/ws", description: "Staging" }
|
|
50
|
+
]}
|
|
51
|
+
/>
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Features
|
|
55
|
+
|
|
56
|
+
<CardGroup cols={2}>
|
|
57
|
+
<Card title="Live Connection" icon="activity" description="Real WebSocket connection with connect/disconnect controls and live status indicator." />
|
|
58
|
+
<Card title="Message History" icon="message-square" description="Timestamped message log with color-coded sent, received, error, and system messages." />
|
|
59
|
+
<Card title="Subprotocols" icon="layers" description="Configure and negotiate WebSocket subprotocols." />
|
|
60
|
+
<Card title="Authentication" icon="lock" description="Supports Bearer token, API key, Basic auth, and custom headers." />
|
|
61
|
+
<Card title="Multiple Servers" icon="server" description="Switch between server environments (production, staging, local)." />
|
|
62
|
+
<Card title="Custom Headers" icon="list" description="Add custom headers to the WebSocket handshake request." />
|
|
63
|
+
</CardGroup>
|
|
64
|
+
|
|
65
|
+
## Message Types
|
|
66
|
+
|
|
67
|
+
Messages in the log are color-coded:
|
|
68
|
+
|
|
69
|
+
| Type | Color | Description |
|
|
70
|
+
| --- | --- | --- |
|
|
71
|
+
| SEND | Orange | Messages you send to the server |
|
|
72
|
+
| RECV | Blue | Messages received from the server |
|
|
73
|
+
| ERR | Red | Connection errors and protocol errors |
|
|
74
|
+
| SYS | Muted | Connect, disconnect, and status events |
|
|
75
|
+
|
|
76
|
+
## Testing JSON APIs
|
|
77
|
+
|
|
78
|
+
For WebSocket APIs that use JSON messages, send structured messages like:
|
|
79
|
+
|
|
80
|
+
```json
|
|
81
|
+
{ "type": "subscribe", "channel": "updates" }
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
```json
|
|
85
|
+
{ "type": "message", "content": "Hello!", "room": "general" }
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Props Reference
|
|
89
|
+
|
|
90
|
+
| Prop | Type | Required | Description |
|
|
91
|
+
| --- | --- | --- | --- |
|
|
92
|
+
| `url` | `string` | Yes | WebSocket URL (`ws://` or `wss://`). |
|
|
93
|
+
| `title` | `string` | No | Display title. |
|
|
94
|
+
| `description` | `string` | No | Description shown above the playground. |
|
|
95
|
+
| `subprotocols` | `string[]` | No | Pre-configured WebSocket subprotocols. |
|
|
96
|
+
| `headers` | `Record<string, string>` | No | Pre-populated handshake headers. |
|
|
97
|
+
| `authType` | `'bearer' \| 'apiKey' \| 'basic' \| 'none'` | No | Authentication method. |
|
|
98
|
+
| `servers` | `Array<{ url, description, protocol? }>` | No | Server environment options. |
|
|
Binary file
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="1200" height="630" viewBox="0 0 1200 630">
|
|
2
|
+
<rect width="1200" height="630" fill="#15243e"/>
|
|
3
|
+
<rect x="0" y="0" width="1200" height="8" fill="#5c8cf4"/>
|
|
4
|
+
<circle cx="1160" cy="390" r="310" fill="#1c2e4d"/>
|
|
5
|
+
<circle cx="1160" cy="390" r="240" fill="none" stroke="#344767"/>
|
|
6
|
+
<circle cx="1160" cy="390" r="160" fill="none" stroke="#344767"/>
|
|
7
|
+
<image href="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjIiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyMiAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTIxLjk5NDEgNC45OTk1MUMxOS45OTQ3IDMuMDAwNzkgMTkuOTk0NyAzLjAwMDc5IDE2Ljk5NTYgMC4wMDI3MTM2OFY0Ljk5OTUxSDIxLjk5NDFaIiBmaWxsPSIjOTJCRkZBIi8+CjxwYXRoIGQ9Ik03LjQ5NzgyIDMuOTE4NDNDNy40OTc4MiA0LjUxNTUgNy45ODE4MyA0Ljk5OTUxIDguNTc4OSA0Ljk5OTUxSDE2Ljk5NTFWMC4wMDI3MTYwNkg4LjU3ODlDNy45ODE4MyAwLjAwMjcxNjA2IDcuNDk3ODIgMC40ODY3MzMgNy40OTc4MiAxLjA4MzhWMy45MTg0M1oiIGZpbGw9InVybCgjcGFpbnQwX2xpbmVhcl82Nl82ODApIi8+CjxwYXRoIGQ9Ik0yMS45OTMyIDUuMDExMjNDMjIuMDA0OSA4LjIwOTg3IDIxLjk5ODMgMTcuNzAzNiAyMS45OTUxIDIxLjk5OTVDMjEuOTk0MyAyMy4xMDQxIDIxLjA5NzcgMjMuOTk5NSAxOS45OTMyIDIzLjk5OTVIMkMwLjg5NTQzMSAyMy45OTk1IDMuODcwNTVlLTA3IDIzLjEwNDEgMCAyMS45OTk1VjguNTkxMzFDMCA3Ljk5NDI2IDAuNDg0MDEgNy41MTAyOCAxLjA4MTA1IDcuNTEwMjVIMy45MTc5N0M0LjUxNDgxIDcuNTEwNTIgNC45OTkwMiA3Ljk5NDQxIDQuOTk5MDIgOC41OTEzMVYxOS41MDI0SDE2Ljk5NTFWNS4wMTEyM0gyMS45OTMyWiIgZmlsbD0idXJsKCNwYWludDFfbGluZWFyXzY2XzY4MCkiLz4KPGVsbGlwc2UgY3g9IjEyLjMyMTciIGN5PSIxNC4yNzYiIHJ4PSIxLjI5NzMiIHJ5PSIxLjI5NjQ3IiBmaWxsPSIjMTk2N0QyIi8+CjxwYXRoIGQ9Ik01IDAuMDA2MzQ4MTNDNS41NTE1NyAwLjAwNzMwMjI3IDUuOTk4MDUgMC40NTQ3MTggNS45OTgwNSAxLjAwNjM1VjQuMDEyMjFDNS45OTgwNSA0LjY0MDY4IDYuMjk3MDcgNS4yMzE3OSA2LjgwMjczIDUuNjA0OThMNy40Njc3NyA2LjA5NjE5QzcuODExNzEgNi4zNTAwMyA4LjIyODc4IDYuNDg2ODIgOC42NTYyNSA2LjQ4NjgySDE0LjQ5NTFDMTUuMDQ3MiA2LjQ4NjgyIDE1LjQ5NDkgNi45MzQ3NSAxNS40OTUxIDcuNDg2ODJWMTYuOThDMTUuNDk1MSAxNy41MzIyIDE1LjA0NzQgMTcuOTggMTQuNDk1MSAxNy45OEg3LjQ5ODA1QzYuOTQ1ODMgMTcuOTc5OSA2LjQ5ODA4IDE3LjUzMjIgNi40OTgwNSAxNi45OFY4LjY3MTM5QzYuNDk4MDYgOC4yMzcyNCA2LjM1Njg5IDcuODE0MDcgNi4wOTU3IDcuNDY3MjlMNS41ODY5MSA2Ljc5MjQ4QzUuMjE1NTggNi4yOTk1NCA0LjYzNzU5IDYuMDA1MTUgNC4wMjA1MSA1Ljk5NTYxSDFDMC40NDc3MjIgNS45OTU2IDAgNS41NDc4OSAwIDQuOTk1NjFWMS4wMDA0OUMwLjAwMDE2NTg0NSAwLjQ0Nzk1MSAwLjQ0ODQ0MSAtNC42MDcyOWUtMDUgMS4wMDA5OCAwLjAwMDQ4ODc2TDUgMC4wMDYzNDgxM1oiIGZpbGw9IiNGRkMyMzYiLz4KPGVsbGlwc2UgY3g9IjEyLjk5NjEiIGN5PSIxNS41MDUiIHJ4PSIxIiByeT0iMC45OTkzNTkiIGZpbGw9IiMzNjMwQzQiLz4KPGRlZnM+CjxsaW5lYXJHcmFkaWVudCBpZD0icGFpbnQwX2xpbmVhcl82Nl82ODAiIHgxPSIxMC45OTk5IiB5MT0iMC4wMDI3MTYwNiIgeDI9IjEwLjk5OTkiIHkyPSIyMy45OTk1IiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+CjxzdG9wIHN0b3AtY29sb3I9IiM1MjhGRjQiLz4KPHN0b3Agb2Zmc2V0PSIxIiBzdG9wLWNvbG9yPSIjOTJCRkZBIi8+CjwvbGluZWFyR3JhZGllbnQ+CjxsaW5lYXJHcmFkaWVudCBpZD0icGFpbnQxX2xpbmVhcl82Nl82ODAiIHgxPSIxMC45OTk5IiB5MT0iMC4wMDI3MTYwNiIgeDI9IjEwLjk5OTkiIHkyPSIyMy45OTk1IiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+CjxzdG9wIHN0b3AtY29sb3I9IiM1MjhGRjQiLz4KPHN0b3Agb2Zmc2V0PSIxIiBzdG9wLWNvbG9yPSIjOTJCRkZBIi8+CjwvbGluZWFyR3JhZGllbnQ+CjwvZGVmcz4KPC9zdmc+Cg==" x="72" y="64" width="44" height="48"/>
|
|
8
|
+
<text x="134" y="100" fill="#f8f5ed" font-family="Bricolage Grotesque,Arial,sans-serif" font-size="38" font-weight="700">Dory</text>
|
|
9
|
+
<rect x="242" y="73" width="76" height="27" rx="5" fill="none" stroke="#536078"/>
|
|
10
|
+
<text x="255" y="92" fill="#aebace" font-family="Arial,sans-serif" font-size="12" letter-spacing="3">DOCS</text>
|
|
11
|
+
<text x="72" y="260" fill="#f8f5ed" font-family="Bricolage Grotesque,Arial,sans-serif" font-size="76" font-weight="700" letter-spacing="-2">Documentation,</text>
|
|
12
|
+
<text x="72" y="350" fill="#f8f5ed" font-family="Bricolage Grotesque,Arial,sans-serif" font-size="76" font-weight="700" letter-spacing="-2">beautifully simple.</text>
|
|
13
|
+
<text x="76" y="420" fill="#b2bdd0" font-family="Hanken Grotesk,Arial,sans-serif" font-size="26">Build beautiful documentation from MDX.</text>
|
|
14
|
+
<path d="M76 512H1124" stroke="#344767"/>
|
|
15
|
+
<text x="76" y="559" fill="#aebace" font-family="Hanken Grotesk,Arial,sans-serif" font-size="21">Open source. Built for teams.</text>
|
|
16
|
+
<text x="1124" y="559" text-anchor="end" fill="#8caffb" font-family="Hanken Grotesk,Arial,sans-serif" font-size="21">dory.clidey.com</text>
|
|
17
|
+
</svg>
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 'WebSocket Playground Demo'
|
|
3
|
+
description: 'Interactive WebSocket playground for testing real-time connections'
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# WebSocket Playground Demo
|
|
7
|
+
|
|
8
|
+
This page demonstrates the WebSocket playground component with various configuration options and real-time connection testing capabilities.
|
|
9
|
+
|
|
10
|
+
## Basic WebSocket Connection
|
|
11
|
+
|
|
12
|
+
<WebSocketPlayground
|
|
13
|
+
url="/ws/chat"
|
|
14
|
+
title="Basic Chat WebSocket"
|
|
15
|
+
description="Connect to a WebSocket server and send/receive messages in real-time"
|
|
16
|
+
servers={[
|
|
17
|
+
{
|
|
18
|
+
url: "wss://echo.websocket.org",
|
|
19
|
+
description: "WebSocket Echo Server"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
url: "wss://ws.postman-echo.com/raw",
|
|
23
|
+
description: "Postman Echo WebSocket"
|
|
24
|
+
}
|
|
25
|
+
]}
|
|
26
|
+
/>
|
|
27
|
+
|
|
28
|
+
## WebSocket with Subprotocols
|
|
29
|
+
|
|
30
|
+
<WebSocketPlayground
|
|
31
|
+
url="/ws/protocol"
|
|
32
|
+
title="WebSocket with Subprotocols"
|
|
33
|
+
description="WebSocket connection with custom subprotocols for specialized communication"
|
|
34
|
+
subprotocols={["chat", "v1.0"]}
|
|
35
|
+
servers={[
|
|
36
|
+
{
|
|
37
|
+
url: "wss://echo.websocket.org",
|
|
38
|
+
description: "Echo Server with Subprotocols"
|
|
39
|
+
}
|
|
40
|
+
]}
|
|
41
|
+
/>
|
|
42
|
+
|
|
43
|
+
## WebSocket with Authentication
|
|
44
|
+
|
|
45
|
+
<WebSocketPlayground
|
|
46
|
+
url="/ws/secure"
|
|
47
|
+
title="Authenticated WebSocket"
|
|
48
|
+
description="WebSocket connection with authentication headers"
|
|
49
|
+
authType="bearer"
|
|
50
|
+
headers={{
|
|
51
|
+
"User-Agent": "Dory WebSocket Client",
|
|
52
|
+
"X-Client-Version": "1.0.0"
|
|
53
|
+
}}
|
|
54
|
+
servers={[
|
|
55
|
+
{
|
|
56
|
+
url: "wss://echo.websocket.org",
|
|
57
|
+
description: "Secure Echo Server"
|
|
58
|
+
}
|
|
59
|
+
]}
|
|
60
|
+
/>
|
|
61
|
+
|
|
62
|
+
## Real-time Chat Example
|
|
63
|
+
|
|
64
|
+
<WebSocketPlayground
|
|
65
|
+
url="/chat"
|
|
66
|
+
title="Real-time Chat"
|
|
67
|
+
description="Connect to a chat server and participate in real-time conversations"
|
|
68
|
+
subprotocols={["chat.v1", "json"]}
|
|
69
|
+
headers={{
|
|
70
|
+
"X-Client-Type": "web",
|
|
71
|
+
"X-Protocol-Version": "1.0"
|
|
72
|
+
}}
|
|
73
|
+
servers={[
|
|
74
|
+
{
|
|
75
|
+
url: "wss://echo.websocket.org",
|
|
76
|
+
description: "Chat Echo Server"
|
|
77
|
+
}
|
|
78
|
+
]}
|
|
79
|
+
/>
|
|
80
|
+
|
|
81
|
+
## Testing Instructions
|
|
82
|
+
|
|
83
|
+
1. **Connect**: Click the "Connect" button to establish a WebSocket connection
|
|
84
|
+
2. **Send Messages**: Type messages in the input field and click "Send" or press Enter
|
|
85
|
+
3. **View Messages**: All sent and received messages appear in the message history with timestamps
|
|
86
|
+
4. **Configuration**: Use the tabs to configure headers, subprotocols, and authentication
|
|
87
|
+
5. **Server Selection**: Choose different servers from the dropdown to test various endpoints
|
|
88
|
+
|
|
89
|
+
## Features
|
|
90
|
+
|
|
91
|
+
- **Real-time Connection**: Live WebSocket connection with status indicators
|
|
92
|
+
- **Message History**: View all sent/received messages with timestamps
|
|
93
|
+
- **Custom Headers**: Add authentication and custom headers
|
|
94
|
+
- **Subprotocols**: Configure WebSocket subprotocols
|
|
95
|
+
- **Multiple Servers**: Easy switching between different WebSocket endpoints
|
|
96
|
+
- **Error Handling**: Clear error messages for connection issues
|
|
97
|
+
- **Binary Support**: Handles both text and binary messages
|
|
98
|
+
|
|
99
|
+
## Message Types
|
|
100
|
+
|
|
101
|
+
The playground supports different message types:
|
|
102
|
+
- **Sent**: Messages you send (blue background)
|
|
103
|
+
- **Received**: Messages from the server (green background)
|
|
104
|
+
- **Error**: Connection or sending errors (red background)
|
|
105
|
+
- **System**: Connection status updates (gray background)
|
|
106
|
+
|
|
107
|
+
## Example Messages
|
|
108
|
+
|
|
109
|
+
Try sending these JSON messages to test structured data:
|
|
110
|
+
|
|
111
|
+
```json
|
|
112
|
+
{
|
|
113
|
+
"type": "chat",
|
|
114
|
+
"message": "Hello, WebSocket!",
|
|
115
|
+
"userId": "user123",
|
|
116
|
+
"timestamp": "2024-01-15T10:30:00Z"
|
|
117
|
+
}
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
```json
|
|
121
|
+
{
|
|
122
|
+
"type": "presence",
|
|
123
|
+
"status": "online",
|
|
124
|
+
"userId": "user123"
|
|
125
|
+
}
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
```json
|
|
129
|
+
{
|
|
130
|
+
"type": "notification",
|
|
131
|
+
"title": "Test Notification",
|
|
132
|
+
"message": "This is a test notification",
|
|
133
|
+
"level": "info"
|
|
134
|
+
}
|
|
135
|
+
```
|