@offorte/show-doc 0.0.4 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { LitElement } from "lit";
1
+ import { LitElement, type PropertyValues } from "lit";
2
2
  /**
3
3
  * Provides the page and document canvas for a ShowDoc artifact.
4
4
  *
@@ -6,7 +6,16 @@ import { LitElement } from "lit";
6
6
  * @slot - The complete visible document.
7
7
  */
8
8
  export declare class ShwDoc extends LitElement {
9
+ #private;
10
+ static properties: {
11
+ nav: {
12
+ type: StringConstructor;
13
+ };
14
+ };
9
15
  static styles: import("lit").CSSResult[];
16
+ /** Section menu mode. `auto` shows it for four or more main sections. `off` hides it. */
17
+ nav: "auto" | "off";
18
+ protected willUpdate(changed: PropertyValues<this>): void;
10
19
  protected render(): import("lit").TemplateResult<1>;
11
20
  }
12
21
  declare global {
@@ -10,10 +10,16 @@ export declare class ShwMermaid extends LitElement {
10
10
  label: {
11
11
  type: StringConstructor;
12
12
  };
13
+ page: {
14
+ type: BooleanConstructor;
15
+ reflect: boolean;
16
+ };
13
17
  };
14
18
  static styles: import("lit").CSSResult[];
15
19
  /** Accessible name for the rendered diagram. */
16
20
  label: string;
21
+ /** Fills the browser window with this one diagram. Use it without `shw-doc`. */
22
+ page: boolean;
17
23
  connectedCallback(): void;
18
24
  disconnectedCallback(): void;
19
25
  protected render(): import("lit").TemplateResult<1>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@offorte/show-doc",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "description": "Agent skill and web components for polished, human-readable HTML documents.",
5
5
  "keywords": [
6
6
  "documentation",
@@ -73,7 +73,7 @@
73
73
  "fallow:check": "fallow --format compact --fail-on-issues --summary",
74
74
  "verify:source": "pnpm format:check && pnpm lint && pnpm typecheck",
75
75
  "verify:build": "pnpm test:browser && pnpm manifest:check && pnpm check:build && pnpm check:package && pnpm fallow:check",
76
- "agent:verify": "pnpm verify:source && pnpm build && pnpm verify:build",
76
+ "agent:check": "pnpm verify:source && pnpm build && pnpm verify:build",
77
77
  "prepack": "pnpm build && pnpm manifest:check && pnpm check:build && pnpm check:package"
78
78
  },
79
79
  "dependencies": {
@@ -86,8 +86,12 @@
86
86
  "@tailwindcss/vite": "4.3.3",
87
87
  "@types/node": "26.3.0",
88
88
  "@types/prismjs": "1.26.6",
89
+ "@types/react": "19.3.0",
90
+ "@types/react-dom": "19.3.0",
89
91
  "@web/test-runner": "1.0.0",
90
92
  "@web/test-runner-playwright": "1.0.0",
93
+ "@xyflow/react": "12.12.0",
94
+ "elkjs": "0.12.1",
91
95
  "fallow": "3.18.0",
92
96
  "mermaid": "11.17.2",
93
97
  "micromark": "4.0.2",
@@ -97,6 +101,8 @@
97
101
  "oxlint": "1.80.0",
98
102
  "playwright": "1.62.1",
99
103
  "prismjs": "1.30.0",
104
+ "react": "19.3.1",
105
+ "react-dom": "19.3.1",
100
106
  "tailwindcss": "4.3.3",
101
107
  "typescript": "7.0.2",
102
108
  "vite": "8.2.2"
@@ -1,13 +1,13 @@
1
1
  ---
2
2
  name: show-doc
3
- description: Create compact, readable standalone HTML documents with Offorte ShowDoc components and Markdown when a human-facing artifact needs more visual structure than normal prose.
3
+ description: Create compact, readable standalone HTML documents with Offorte ShowDoc components and Markdown when a human-facing artifact needs more visual structure than normal prose, or one full-page Mermaid diagram when the user asks for a Mermaid diagram.
4
4
  metadata:
5
- version: "0.0.4" # x-release-please-version
5
+ version: "0.0.6" # x-release-please-version
6
6
  ---
7
7
 
8
8
  # ShowDoc
9
9
 
10
- Use ShowDoc when the user asks for a ShowDoc or HTML document. Otherwise, use it for reports, plans,
10
+ Use ShowDoc when the user asks for a ShowDoc, an HTML document, or a Mermaid diagram. Otherwise, use it for reports, plans,
11
11
  reviews, decisions, and explanations that need a durable file or more visual structure than normal
12
12
  chat Markdown. Do not use it for dashboards, forms, or application-like tools.
13
13
 
@@ -74,12 +74,12 @@ available. Return the exact file path.
74
74
 
75
75
  | Element | Compact API | Use |
76
76
  | ----------------- | ----------------------------------------------------------------------- | ------------------------------------------------ |
77
- | `shw-doc` | - | The one page canvas. |
77
+ | `shw-doc` | `nav?` | The one page canvas. |
78
78
  | `shw-header` | `heading`, `eyebrow?` | The one title and short Markdown lead. |
79
79
  | `shw-summary` | `heading?` | The answer before the evidence. |
80
80
  | `shw-section` | `heading?`, `intro?`, `level?` | A topic with an automatic divider. |
81
81
  | `shw-markdown` | - | Normal prose, lists, links, tasks, and headings. |
82
- | `shw-mermaid` | `label?` | A diagram from Mermaid source. |
82
+ | `shw-mermaid` | `label?`, `page?` | A diagram from Mermaid source. |
83
83
  | `shw-grid` | `columns?` | Two to four sibling blocks to compare. |
84
84
  | `shw-card` | `heading?`, `label?`, `tone?` | One grouped idea, choice, or status. |
85
85
  | `shw-badge` | `tone?` | A short standalone state or category. |
@@ -95,6 +95,10 @@ Defaults reduce source. A summary heading is `Summary`. A section level is `2`.
95
95
  `2`. A collapsible summary is `Details`, and its content mode is `markdown`. Default tone is
96
96
  `neutral`, except callouts use `info`.
97
97
 
98
+ A document with four or more direct `shw-section` children that have a `heading` and no `level="3"`
99
+ gets a floating section menu automatically. Do not add a table of contents to these documents. Use
100
+ `nav="off"` only when the menu would distract, such as on a page made for embedding.
101
+
98
102
  Tones are `info`, `success`, `warning`, `danger`, and `neutral`. Use them only when the meaning helps
99
103
  the reader.
100
104
 
@@ -218,4 +222,53 @@ Raw HTML inside Markdown is disabled. Write `&lt;` for a literal `<`, including
218
222
  Write Mermaid diagram text directly inside `shw-mermaid`. Set `label` to its short accessible name.
219
223
  The Mermaid bundle supports the full Mermaid package and makes no extra runtime request.
220
224
 
225
+ ## Mermaid diagrams
226
+
227
+ ShowDoc draws flowcharts, state diagrams, and sequence diagrams itself. Mermaid draws every other
228
+ diagram type, and any diagram with `click` links, icons, images, or half arrows.
229
+
230
+ The page is HTML, so write `&lt;` for each `<` in the source. For example, write
231
+ `state check &lt;&lt;choice&gt;&gt;`. Write a second line in a label as `\n`, not `<br/>`. The second
232
+ line appears as small code text.
233
+
234
+ - A `subgraph` in a flowchart becomes a lane, a column with an uppercase title. Name each lane after
235
+ what its parts do. A nested subgraph, a line from a node to itself, or a line to a subgraph gives a
236
+ normal group layout instead of lanes.
237
+ - `:::new`, `:::changed`, and `:::removed` add a status pill. Use them only when the diagram compares
238
+ two states.
239
+ - `:::icon-code`, `window`, `box`, `play`, `queue`, `service`, `db`, `file`, `user`, `cloud`, or
240
+ `decision` (each with the `icon-` prefix) adds an icon. `[( )]` adds the database icon. In a lane,
241
+ every card has an icon.
242
+ - A frontmatter title appears in a chip above the diagram. Text after `|` appears as grey code:
243
+ `title: Container view | architecture-overview · hero`.
244
+
245
+ ## Only a diagram
246
+
247
+ When the user asks only for a Mermaid diagram, do not build a document. Write this page with one
248
+ `shw-mermaid` that has the `page` attribute and no `shw-doc`.
249
+
250
+ <!-- prettier-ignore -->
251
+ ```html
252
+ <!doctype html>
253
+ <html lang="en">
254
+ <head>
255
+ <meta charset="UTF-8" />
256
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
257
+ <script
258
+ type="module"
259
+ src="https://cdn.jsdelivr.net/npm/@offorte/show-doc@latest/dist/showdoc-mermaid.js"
260
+ ></script>
261
+ <title>Save flow</title>
262
+ </head>
263
+ <body>
264
+ <shw-mermaid page label="Saving a draft">
265
+ flowchart LR
266
+ A[Save draft] --> B{Save succeeds?}
267
+ B -->|Yes| C[Clear draft]
268
+ B -->|No| D[Keep draft]
269
+ </shw-mermaid>
270
+ </body>
271
+ </html>
272
+ ```
273
+
221
274
  Do not run a generic HTML formatter over the result. It can remove meaningful Markdown line breaks.