@clidey/dory 1.9.0 → 1.10.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 (46) hide show
  1. package/README.md +57 -173
  2. package/bin/dist/dependency-overlay.d.ts +7 -0
  3. package/bin/dist/dependency-overlay.d.ts.map +1 -0
  4. package/bin/dist/dependency-overlay.js +137 -0
  5. package/bin/dist/dependency-overlay.js.map +1 -0
  6. package/bin/dist/dory.js +4 -2
  7. package/bin/dist/dory.js.map +1 -1
  8. package/bin/dist/preview-server.d.ts.map +1 -1
  9. package/bin/dist/preview-server.js +4 -17
  10. package/bin/dist/preview-server.js.map +1 -1
  11. package/bin/dist/preview-static.d.ts +7 -0
  12. package/bin/dist/preview-static.d.ts.map +1 -0
  13. package/bin/dist/preview-static.js +70 -0
  14. package/bin/dist/preview-static.js.map +1 -0
  15. package/dist/index.html +19 -19
  16. package/dist/runtime/dory-runtime.css +1 -1
  17. package/dist/runtime/dory-runtime.js +305 -305
  18. package/docs/components/layout.mdx +3 -0
  19. package/docs/components/lists.mdx +2 -2
  20. package/docs/components/overview.mdx +1 -1
  21. package/docs/components/typography.mdx +4 -4
  22. package/docs/configuration/navigation.mdx +3 -3
  23. package/docs/contributing.mdx +47 -0
  24. package/docs/dory.json +13 -6
  25. package/docs/getting-started/automation.mdx +2 -2
  26. package/docs/getting-started/custom-components.mdx +60 -0
  27. package/docs/social-card.png +0 -0
  28. package/docs/social-card.svg +1 -1
  29. package/package.json +1 -1
  30. package/scripts/verify-component-examples.mjs +126 -0
  31. package/scripts/verify-runtime-parity.mjs +5 -4
  32. package/src/app.css +3 -0
  33. package/src/main.tsx +1 -1
  34. package/src/mdx/latex.test.ts +38 -0
  35. package/src/mdx/latex.tsx +42 -65
  36. package/src/mdx/preprocess.ts +2 -2
  37. package/src/mdx/processor.test.ts +135 -37
  38. package/src/mdx/processor.ts +56 -2
  39. package/src/mdx/specimen.tsx +32 -50
  40. package/src/mdx/tabs.tsx +15 -12
  41. package/src/mdx/text.tsx +2 -2
  42. package/src/mdx/type-scale.tsx +3 -3
  43. package/src/plugins/sanitize.ts +5 -4
  44. package/vite.config.ssr.ts +1 -1
  45. package/vite.config.ts +1 -1
  46. package/docs/getting-started/whodb-ee-apps.mdx +0 -122
@@ -17,7 +17,7 @@ export default defineConfig({
17
17
  mdx(getMdxConfig(false)),
18
18
  ],
19
19
  resolve: {
20
- dedupe: ['preact', 'preact/compat', 'preact/hooks', 'preact/jsx-runtime', 'preact/compat/jsx-runtime'],
20
+ dedupe: ['recharts', 'preact', 'preact/compat', 'preact/hooks', 'preact/jsx-runtime', 'preact/compat/jsx-runtime'],
21
21
  alias: {
22
22
  react: 'preact/compat',
23
23
  'react-dom': 'preact/compat',
package/vite.config.ts CHANGED
@@ -41,7 +41,7 @@ export default defineConfig(({ command }) => ({
41
41
  prerender(),
42
42
  ],
43
43
  resolve: {
44
- dedupe: ['preact', 'preact/compat', 'preact/hooks', 'preact/jsx-runtime', 'preact/compat/jsx-runtime'],
44
+ dedupe: ['recharts', 'preact', 'preact/compat', 'preact/hooks', 'preact/jsx-runtime', 'preact/compat/jsx-runtime'],
45
45
  alias: {
46
46
  react: 'preact/compat',
47
47
  'react-dom': 'preact/compat',
@@ -1,122 +0,0 @@
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.