@contractspec/example.in-app-docs 1.3.1 → 1.5.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/.turbo/turbo-build.log +35 -29
- package/.turbo/turbo-prebuild.log +1 -0
- package/CHANGELOG.md +30 -0
- package/dist/browser/docs/in-app-docs.docblock.js +50 -0
- package/dist/browser/docs/index.js +47 -0
- package/dist/browser/example.js +38 -0
- package/dist/browser/index.js +136 -0
- package/dist/browser/ui/InAppDocsViewer.js +100 -0
- package/dist/browser/ui/index.js +100 -0
- package/dist/docs/in-app-docs.docblock.d.ts +2 -7
- package/dist/docs/in-app-docs.docblock.d.ts.map +1 -1
- package/dist/docs/in-app-docs.docblock.js +33 -47
- package/dist/docs/index.d.ts +2 -1
- package/dist/docs/index.d.ts.map +1 -0
- package/dist/docs/index.js +48 -1
- package/dist/example.d.ts +2 -7
- package/dist/example.d.ts.map +1 -1
- package/dist/example.js +36 -50
- package/dist/index.d.ts +4 -5
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +136 -5
- package/dist/node/docs/in-app-docs.docblock.js +50 -0
- package/dist/node/docs/index.js +47 -0
- package/dist/node/example.js +38 -0
- package/dist/node/index.js +136 -0
- package/dist/node/ui/InAppDocsViewer.js +100 -0
- package/dist/node/ui/index.js +100 -0
- package/dist/ui/InAppDocsViewer.d.ts +2 -6
- package/dist/ui/InAppDocsViewer.d.ts.map +1 -1
- package/dist/ui/InAppDocsViewer.js +97 -63
- package/dist/ui/index.d.ts +2 -2
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +100 -2
- package/package.json +78 -26
- package/src/ui/InAppDocsViewer.tsx +1 -1
- package/tsdown.config.js +1 -2
- package/.turbo/turbo-build$colon$bundle.log +0 -28
- package/dist/docs/in-app-docs.docblock.js.map +0 -1
- package/dist/example.js.map +0 -1
- package/dist/ui/InAppDocsViewer.js.map +0 -1
- package/tsconfig.tsbuildinfo +0 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,29 +1,35 @@
|
|
|
1
|
-
$ bun
|
|
2
|
-
$
|
|
3
|
-
$
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
1
|
+
$ contractspec-bun-build prebuild
|
|
2
|
+
$ bun run prebuild && bun run build:bundle && bun run build:types
|
|
3
|
+
$ contractspec-bun-build prebuild
|
|
4
|
+
$ contractspec-bun-build transpile
|
|
5
|
+
[contractspec-bun-build] transpile target=bun root=src entries=6
|
|
6
|
+
Bundled 6 modules in 14ms
|
|
7
|
+
|
|
8
|
+
docs/in-app-docs.docblock.js 2.72 KB (entry point)
|
|
9
|
+
./index.js 5.97 KB (entry point)
|
|
10
|
+
docs/index.js 2.70 KB (entry point)
|
|
11
|
+
./example.js 1.11 KB (entry point)
|
|
12
|
+
ui/index.js 4.87 KB (entry point)
|
|
13
|
+
ui/InAppDocsViewer.js 4.86 KB (entry point)
|
|
14
|
+
|
|
15
|
+
[contractspec-bun-build] transpile target=node root=src entries=6
|
|
16
|
+
Bundled 6 modules in 11ms
|
|
17
|
+
|
|
18
|
+
docs/in-app-docs.docblock.js 2.66 KB (entry point)
|
|
19
|
+
./index.js 5.90 KB (entry point)
|
|
20
|
+
docs/index.js 2.64 KB (entry point)
|
|
21
|
+
./example.js 1.1 KB (entry point)
|
|
22
|
+
ui/index.js 4.81 KB (entry point)
|
|
23
|
+
ui/InAppDocsViewer.js 4.80 KB (entry point)
|
|
24
|
+
|
|
25
|
+
[contractspec-bun-build] transpile target=browser root=src entries=6
|
|
26
|
+
Bundled 6 modules in 34ms
|
|
27
|
+
|
|
28
|
+
docs/in-app-docs.docblock.js 2.66 KB (entry point)
|
|
29
|
+
./index.js 5.90 KB (entry point)
|
|
30
|
+
docs/index.js 2.64 KB (entry point)
|
|
31
|
+
./example.js 1.1 KB (entry point)
|
|
32
|
+
ui/index.js 4.81 KB (entry point)
|
|
33
|
+
ui/InAppDocsViewer.js 4.80 KB (entry point)
|
|
34
|
+
|
|
35
|
+
$ contractspec-bun-build types
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
$ contractspec-bun-build prebuild
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
# @contractspec/example.in-app-docs
|
|
2
2
|
|
|
3
|
+
## 1.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- d1f0fd0: chore: Migrate non-app package builds from tsdown to shared Bun tooling, add `@contractspec/tool.bun`, and standardize `prebuild`/`build`/`typecheck` with platform-aware exports and `tsc` declaration emission into `dist`.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [d1f0fd0]
|
|
12
|
+
- Updated dependencies [4355a9e]
|
|
13
|
+
- @contractspec/lib.example-shared-ui@1.12.0
|
|
14
|
+
- @contractspec/lib.contracts@1.58.0
|
|
15
|
+
|
|
16
|
+
## 1.4.0
|
|
17
|
+
|
|
18
|
+
### Minor Changes
|
|
19
|
+
|
|
20
|
+
- 11a5a05: feat: improve product intent
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- Updated dependencies [8ecf3c1]
|
|
25
|
+
- Updated dependencies [47c48c2]
|
|
26
|
+
- Updated dependencies [a119963]
|
|
27
|
+
- Updated dependencies [4651e06]
|
|
28
|
+
- Updated dependencies [ad9d10a]
|
|
29
|
+
- Updated dependencies [11a5a05]
|
|
30
|
+
- @contractspec/lib.contracts@1.57.0
|
|
31
|
+
- @contractspec/lib.example-shared-ui@1.11.0
|
|
32
|
+
|
|
3
33
|
## 1.3.1
|
|
4
34
|
|
|
5
35
|
### Patch Changes
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// src/docs/in-app-docs.docblock.ts
|
|
2
|
+
import { registerDocBlocks } from "@contractspec/lib.contracts/docs";
|
|
3
|
+
var inAppDocs = [
|
|
4
|
+
{
|
|
5
|
+
id: "docs.examples.in-app-docs",
|
|
6
|
+
title: "In‑App Docs — Overview",
|
|
7
|
+
summary: "Overview of the in‑app documentation example demonstrating how DocBlock can serve end‑user guides.",
|
|
8
|
+
kind: "goal",
|
|
9
|
+
visibility: "public",
|
|
10
|
+
route: "/docs/examples/in-app-docs",
|
|
11
|
+
tags: ["documentation", "overview", "guide"],
|
|
12
|
+
body: `## Purpose
|
|
13
|
+
The in‑app documentation example shows how you can use ContractSpec's DocBlock system to build user‑facing guides directly inside an application's UI.
|
|
14
|
+
|
|
15
|
+
Instead of relying solely on developer documentation, you can define **public** DocBlocks that describe your product's features in clear, non‑technical language. When embedded in your app, these blocks present a self‑contained help centre for users.
|
|
16
|
+
|
|
17
|
+
## What you'll learn
|
|
18
|
+
* How to define DocBlock objects with public visibility and user‑friendly routes.
|
|
19
|
+
* How to structure an overview page for your in‑app guide using Markdown.
|
|
20
|
+
* How to register your DocBlocks so they show up in the sandbox and in your application.
|
|
21
|
+
|
|
22
|
+
Use this example as a template for documenting your own frontend workflows.`
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
id: "docs.examples.in-app-docs.usage",
|
|
26
|
+
title: "In‑App Docs — Using the Application",
|
|
27
|
+
summary: "Step‑by‑step guide for end users to navigate and use the example application.",
|
|
28
|
+
kind: "usage",
|
|
29
|
+
visibility: "public",
|
|
30
|
+
route: "/docs/examples/in-app-docs/usage",
|
|
31
|
+
tags: ["documentation", "usage", "guide"],
|
|
32
|
+
body: `## Getting Started
|
|
33
|
+
1. **Sign in**. Launch the app and enter your credentials. New users can click **Create Account** to register.
|
|
34
|
+
2. **Explore the dashboard**. Use the sidebar or navigation bar to access sections like Dashboard, Profile, and Settings.
|
|
35
|
+
3. **Add items**. On the Dashboard, click **Add Item** or a plus icon to create a new record. Fill in the form fields and press **Save**.
|
|
36
|
+
|
|
37
|
+
## Tips
|
|
38
|
+
* Look for information icons (ℹ️) throughout the UI. Hover or click these icons to display contextual help powered by DocBlock.
|
|
39
|
+
* Use keyboard shortcuts—such as **Ctrl+S** to save or **Ctrl+K** to open the command palette—for quicker navigation.
|
|
40
|
+
* Need to find something quickly? Use the search bar or filters at the top of lists.
|
|
41
|
+
|
|
42
|
+
## Next Steps
|
|
43
|
+
Continue exploring the different screens. Try editing or deleting items, adjusting your profile settings, or experimenting with filters.
|
|
44
|
+
This guide is available via the help menu inside the app, so you can reference it without leaving your workflow.`
|
|
45
|
+
}
|
|
46
|
+
];
|
|
47
|
+
registerDocBlocks(inAppDocs);
|
|
48
|
+
export {
|
|
49
|
+
inAppDocs
|
|
50
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// src/docs/in-app-docs.docblock.ts
|
|
2
|
+
import { registerDocBlocks } from "@contractspec/lib.contracts/docs";
|
|
3
|
+
var inAppDocs = [
|
|
4
|
+
{
|
|
5
|
+
id: "docs.examples.in-app-docs",
|
|
6
|
+
title: "In‑App Docs — Overview",
|
|
7
|
+
summary: "Overview of the in‑app documentation example demonstrating how DocBlock can serve end‑user guides.",
|
|
8
|
+
kind: "goal",
|
|
9
|
+
visibility: "public",
|
|
10
|
+
route: "/docs/examples/in-app-docs",
|
|
11
|
+
tags: ["documentation", "overview", "guide"],
|
|
12
|
+
body: `## Purpose
|
|
13
|
+
The in‑app documentation example shows how you can use ContractSpec's DocBlock system to build user‑facing guides directly inside an application's UI.
|
|
14
|
+
|
|
15
|
+
Instead of relying solely on developer documentation, you can define **public** DocBlocks that describe your product's features in clear, non‑technical language. When embedded in your app, these blocks present a self‑contained help centre for users.
|
|
16
|
+
|
|
17
|
+
## What you'll learn
|
|
18
|
+
* How to define DocBlock objects with public visibility and user‑friendly routes.
|
|
19
|
+
* How to structure an overview page for your in‑app guide using Markdown.
|
|
20
|
+
* How to register your DocBlocks so they show up in the sandbox and in your application.
|
|
21
|
+
|
|
22
|
+
Use this example as a template for documenting your own frontend workflows.`
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
id: "docs.examples.in-app-docs.usage",
|
|
26
|
+
title: "In‑App Docs — Using the Application",
|
|
27
|
+
summary: "Step‑by‑step guide for end users to navigate and use the example application.",
|
|
28
|
+
kind: "usage",
|
|
29
|
+
visibility: "public",
|
|
30
|
+
route: "/docs/examples/in-app-docs/usage",
|
|
31
|
+
tags: ["documentation", "usage", "guide"],
|
|
32
|
+
body: `## Getting Started
|
|
33
|
+
1. **Sign in**. Launch the app and enter your credentials. New users can click **Create Account** to register.
|
|
34
|
+
2. **Explore the dashboard**. Use the sidebar or navigation bar to access sections like Dashboard, Profile, and Settings.
|
|
35
|
+
3. **Add items**. On the Dashboard, click **Add Item** or a plus icon to create a new record. Fill in the form fields and press **Save**.
|
|
36
|
+
|
|
37
|
+
## Tips
|
|
38
|
+
* Look for information icons (ℹ️) throughout the UI. Hover or click these icons to display contextual help powered by DocBlock.
|
|
39
|
+
* Use keyboard shortcuts—such as **Ctrl+S** to save or **Ctrl+K** to open the command palette—for quicker navigation.
|
|
40
|
+
* Need to find something quickly? Use the search bar or filters at the top of lists.
|
|
41
|
+
|
|
42
|
+
## Next Steps
|
|
43
|
+
Continue exploring the different screens. Try editing or deleting items, adjusting your profile settings, or experimenting with filters.
|
|
44
|
+
This guide is available via the help menu inside the app, so you can reference it without leaving your workflow.`
|
|
45
|
+
}
|
|
46
|
+
];
|
|
47
|
+
registerDocBlocks(inAppDocs);
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// src/example.ts
|
|
2
|
+
import { defineExample } from "@contractspec/lib.contracts";
|
|
3
|
+
var example = defineExample({
|
|
4
|
+
meta: {
|
|
5
|
+
key: "in-app-docs",
|
|
6
|
+
version: "1.0.0",
|
|
7
|
+
title: "In‑App Documentation Example",
|
|
8
|
+
description: "Demonstrates using DocBlock to create user‑facing guides that live inside your application's frontend. It shows how to structure a public, non‑technical user guide using ContractSpec.",
|
|
9
|
+
kind: "ui",
|
|
10
|
+
visibility: "public",
|
|
11
|
+
stability: "experimental",
|
|
12
|
+
owners: ["@docs-team"],
|
|
13
|
+
tags: ["documentation", "guide", "ui"]
|
|
14
|
+
},
|
|
15
|
+
docs: {
|
|
16
|
+
rootDocId: "docs.examples.in-app-docs",
|
|
17
|
+
usageDocId: "docs.examples.in-app-docs.usage",
|
|
18
|
+
goalDocId: "docs.examples.in-app-docs"
|
|
19
|
+
},
|
|
20
|
+
entrypoints: {
|
|
21
|
+
packageName: "@contractspec/example.in-app-docs",
|
|
22
|
+
docs: "./docs",
|
|
23
|
+
ui: "./ui"
|
|
24
|
+
},
|
|
25
|
+
surfaces: {
|
|
26
|
+
templates: false,
|
|
27
|
+
sandbox: {
|
|
28
|
+
enabled: true,
|
|
29
|
+
modes: ["markdown"]
|
|
30
|
+
},
|
|
31
|
+
studio: { enabled: false, installable: false },
|
|
32
|
+
mcp: { enabled: false }
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
var example_default = example;
|
|
36
|
+
export {
|
|
37
|
+
example_default as default
|
|
38
|
+
};
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
// src/docs/in-app-docs.docblock.ts
|
|
2
|
+
import { registerDocBlocks } from "@contractspec/lib.contracts/docs";
|
|
3
|
+
var inAppDocs = [
|
|
4
|
+
{
|
|
5
|
+
id: "docs.examples.in-app-docs",
|
|
6
|
+
title: "In‑App Docs — Overview",
|
|
7
|
+
summary: "Overview of the in‑app documentation example demonstrating how DocBlock can serve end‑user guides.",
|
|
8
|
+
kind: "goal",
|
|
9
|
+
visibility: "public",
|
|
10
|
+
route: "/docs/examples/in-app-docs",
|
|
11
|
+
tags: ["documentation", "overview", "guide"],
|
|
12
|
+
body: `## Purpose
|
|
13
|
+
The in‑app documentation example shows how you can use ContractSpec's DocBlock system to build user‑facing guides directly inside an application's UI.
|
|
14
|
+
|
|
15
|
+
Instead of relying solely on developer documentation, you can define **public** DocBlocks that describe your product's features in clear, non‑technical language. When embedded in your app, these blocks present a self‑contained help centre for users.
|
|
16
|
+
|
|
17
|
+
## What you'll learn
|
|
18
|
+
* How to define DocBlock objects with public visibility and user‑friendly routes.
|
|
19
|
+
* How to structure an overview page for your in‑app guide using Markdown.
|
|
20
|
+
* How to register your DocBlocks so they show up in the sandbox and in your application.
|
|
21
|
+
|
|
22
|
+
Use this example as a template for documenting your own frontend workflows.`
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
id: "docs.examples.in-app-docs.usage",
|
|
26
|
+
title: "In‑App Docs — Using the Application",
|
|
27
|
+
summary: "Step‑by‑step guide for end users to navigate and use the example application.",
|
|
28
|
+
kind: "usage",
|
|
29
|
+
visibility: "public",
|
|
30
|
+
route: "/docs/examples/in-app-docs/usage",
|
|
31
|
+
tags: ["documentation", "usage", "guide"],
|
|
32
|
+
body: `## Getting Started
|
|
33
|
+
1. **Sign in**. Launch the app and enter your credentials. New users can click **Create Account** to register.
|
|
34
|
+
2. **Explore the dashboard**. Use the sidebar or navigation bar to access sections like Dashboard, Profile, and Settings.
|
|
35
|
+
3. **Add items**. On the Dashboard, click **Add Item** or a plus icon to create a new record. Fill in the form fields and press **Save**.
|
|
36
|
+
|
|
37
|
+
## Tips
|
|
38
|
+
* Look for information icons (ℹ️) throughout the UI. Hover or click these icons to display contextual help powered by DocBlock.
|
|
39
|
+
* Use keyboard shortcuts—such as **Ctrl+S** to save or **Ctrl+K** to open the command palette—for quicker navigation.
|
|
40
|
+
* Need to find something quickly? Use the search bar or filters at the top of lists.
|
|
41
|
+
|
|
42
|
+
## Next Steps
|
|
43
|
+
Continue exploring the different screens. Try editing or deleting items, adjusting your profile settings, or experimenting with filters.
|
|
44
|
+
This guide is available via the help menu inside the app, so you can reference it without leaving your workflow.`
|
|
45
|
+
}
|
|
46
|
+
];
|
|
47
|
+
registerDocBlocks(inAppDocs);
|
|
48
|
+
// src/example.ts
|
|
49
|
+
import { defineExample } from "@contractspec/lib.contracts";
|
|
50
|
+
var example = defineExample({
|
|
51
|
+
meta: {
|
|
52
|
+
key: "in-app-docs",
|
|
53
|
+
version: "1.0.0",
|
|
54
|
+
title: "In‑App Documentation Example",
|
|
55
|
+
description: "Demonstrates using DocBlock to create user‑facing guides that live inside your application's frontend. It shows how to structure a public, non‑technical user guide using ContractSpec.",
|
|
56
|
+
kind: "ui",
|
|
57
|
+
visibility: "public",
|
|
58
|
+
stability: "experimental",
|
|
59
|
+
owners: ["@docs-team"],
|
|
60
|
+
tags: ["documentation", "guide", "ui"]
|
|
61
|
+
},
|
|
62
|
+
docs: {
|
|
63
|
+
rootDocId: "docs.examples.in-app-docs",
|
|
64
|
+
usageDocId: "docs.examples.in-app-docs.usage",
|
|
65
|
+
goalDocId: "docs.examples.in-app-docs"
|
|
66
|
+
},
|
|
67
|
+
entrypoints: {
|
|
68
|
+
packageName: "@contractspec/example.in-app-docs",
|
|
69
|
+
docs: "./docs",
|
|
70
|
+
ui: "./ui"
|
|
71
|
+
},
|
|
72
|
+
surfaces: {
|
|
73
|
+
templates: false,
|
|
74
|
+
sandbox: {
|
|
75
|
+
enabled: true,
|
|
76
|
+
modes: ["markdown"]
|
|
77
|
+
},
|
|
78
|
+
studio: { enabled: false, installable: false },
|
|
79
|
+
mcp: { enabled: false }
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
var example_default = example;
|
|
83
|
+
|
|
84
|
+
// src/ui/InAppDocsViewer.tsx
|
|
85
|
+
import { useState } from "react";
|
|
86
|
+
import { MarkdownRenderer } from "@contractspec/lib.example-shared-ui";
|
|
87
|
+
import { jsxDEV, Fragment } from "react/jsx-dev-runtime";
|
|
88
|
+
"use client";
|
|
89
|
+
var InAppDocsViewer = () => {
|
|
90
|
+
const [activeId, setActiveId] = useState(inAppDocs[0]?.id ?? "");
|
|
91
|
+
const activeDoc = inAppDocs.find((doc) => doc.id === activeId);
|
|
92
|
+
return /* @__PURE__ */ jsxDEV("div", {
|
|
93
|
+
style: { display: "flex", height: "100%", gap: "1rem" },
|
|
94
|
+
children: [
|
|
95
|
+
/* @__PURE__ */ jsxDEV("nav", {
|
|
96
|
+
style: { width: "220px", borderRight: "1px solid #eee" },
|
|
97
|
+
children: /* @__PURE__ */ jsxDEV("ul", {
|
|
98
|
+
style: { listStyle: "none", padding: 0, margin: 0 },
|
|
99
|
+
children: inAppDocs.map((doc) => /* @__PURE__ */ jsxDEV("li", {
|
|
100
|
+
style: { marginBottom: "0.5rem" },
|
|
101
|
+
children: /* @__PURE__ */ jsxDEV("button", {
|
|
102
|
+
onClick: () => setActiveId(doc.id),
|
|
103
|
+
style: {
|
|
104
|
+
background: doc.id === activeId ? "#f0f0f0" : "transparent",
|
|
105
|
+
border: "none",
|
|
106
|
+
padding: "0.5rem 0.75rem",
|
|
107
|
+
cursor: "pointer",
|
|
108
|
+
textAlign: "left",
|
|
109
|
+
width: "100%"
|
|
110
|
+
},
|
|
111
|
+
children: doc.title
|
|
112
|
+
}, undefined, false, undefined, this)
|
|
113
|
+
}, doc.id, false, undefined, this))
|
|
114
|
+
}, undefined, false, undefined, this)
|
|
115
|
+
}, undefined, false, undefined, this),
|
|
116
|
+
/* @__PURE__ */ jsxDEV("main", {
|
|
117
|
+
style: { flexGrow: 1, padding: "1rem", overflowY: "auto" },
|
|
118
|
+
children: activeDoc && /* @__PURE__ */ jsxDEV(Fragment, {
|
|
119
|
+
children: [
|
|
120
|
+
/* @__PURE__ */ jsxDEV("h1", {
|
|
121
|
+
children: activeDoc.title
|
|
122
|
+
}, undefined, false, undefined, this),
|
|
123
|
+
/* @__PURE__ */ jsxDEV(MarkdownRenderer, {
|
|
124
|
+
content: activeDoc.body
|
|
125
|
+
}, undefined, false, undefined, this)
|
|
126
|
+
]
|
|
127
|
+
}, undefined, true, undefined, this)
|
|
128
|
+
}, undefined, false, undefined, this)
|
|
129
|
+
]
|
|
130
|
+
}, undefined, true, undefined, this);
|
|
131
|
+
};
|
|
132
|
+
var InAppDocsViewer_default = InAppDocsViewer;
|
|
133
|
+
export {
|
|
134
|
+
example_default as example,
|
|
135
|
+
InAppDocsViewer_default as InAppDocsViewer
|
|
136
|
+
};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
// src/docs/in-app-docs.docblock.ts
|
|
2
|
+
import { registerDocBlocks } from "@contractspec/lib.contracts/docs";
|
|
3
|
+
var inAppDocs = [
|
|
4
|
+
{
|
|
5
|
+
id: "docs.examples.in-app-docs",
|
|
6
|
+
title: "In‑App Docs — Overview",
|
|
7
|
+
summary: "Overview of the in‑app documentation example demonstrating how DocBlock can serve end‑user guides.",
|
|
8
|
+
kind: "goal",
|
|
9
|
+
visibility: "public",
|
|
10
|
+
route: "/docs/examples/in-app-docs",
|
|
11
|
+
tags: ["documentation", "overview", "guide"],
|
|
12
|
+
body: `## Purpose
|
|
13
|
+
The in‑app documentation example shows how you can use ContractSpec's DocBlock system to build user‑facing guides directly inside an application's UI.
|
|
14
|
+
|
|
15
|
+
Instead of relying solely on developer documentation, you can define **public** DocBlocks that describe your product's features in clear, non‑technical language. When embedded in your app, these blocks present a self‑contained help centre for users.
|
|
16
|
+
|
|
17
|
+
## What you'll learn
|
|
18
|
+
* How to define DocBlock objects with public visibility and user‑friendly routes.
|
|
19
|
+
* How to structure an overview page for your in‑app guide using Markdown.
|
|
20
|
+
* How to register your DocBlocks so they show up in the sandbox and in your application.
|
|
21
|
+
|
|
22
|
+
Use this example as a template for documenting your own frontend workflows.`
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
id: "docs.examples.in-app-docs.usage",
|
|
26
|
+
title: "In‑App Docs — Using the Application",
|
|
27
|
+
summary: "Step‑by‑step guide for end users to navigate and use the example application.",
|
|
28
|
+
kind: "usage",
|
|
29
|
+
visibility: "public",
|
|
30
|
+
route: "/docs/examples/in-app-docs/usage",
|
|
31
|
+
tags: ["documentation", "usage", "guide"],
|
|
32
|
+
body: `## Getting Started
|
|
33
|
+
1. **Sign in**. Launch the app and enter your credentials. New users can click **Create Account** to register.
|
|
34
|
+
2. **Explore the dashboard**. Use the sidebar or navigation bar to access sections like Dashboard, Profile, and Settings.
|
|
35
|
+
3. **Add items**. On the Dashboard, click **Add Item** or a plus icon to create a new record. Fill in the form fields and press **Save**.
|
|
36
|
+
|
|
37
|
+
## Tips
|
|
38
|
+
* Look for information icons (ℹ️) throughout the UI. Hover or click these icons to display contextual help powered by DocBlock.
|
|
39
|
+
* Use keyboard shortcuts—such as **Ctrl+S** to save or **Ctrl+K** to open the command palette—for quicker navigation.
|
|
40
|
+
* Need to find something quickly? Use the search bar or filters at the top of lists.
|
|
41
|
+
|
|
42
|
+
## Next Steps
|
|
43
|
+
Continue exploring the different screens. Try editing or deleting items, adjusting your profile settings, or experimenting with filters.
|
|
44
|
+
This guide is available via the help menu inside the app, so you can reference it without leaving your workflow.`
|
|
45
|
+
}
|
|
46
|
+
];
|
|
47
|
+
registerDocBlocks(inAppDocs);
|
|
48
|
+
|
|
49
|
+
// src/ui/InAppDocsViewer.tsx
|
|
50
|
+
import { useState } from "react";
|
|
51
|
+
import { MarkdownRenderer } from "@contractspec/lib.example-shared-ui";
|
|
52
|
+
import { jsxDEV, Fragment } from "react/jsx-dev-runtime";
|
|
53
|
+
"use client";
|
|
54
|
+
var InAppDocsViewer = () => {
|
|
55
|
+
const [activeId, setActiveId] = useState(inAppDocs[0]?.id ?? "");
|
|
56
|
+
const activeDoc = inAppDocs.find((doc) => doc.id === activeId);
|
|
57
|
+
return /* @__PURE__ */ jsxDEV("div", {
|
|
58
|
+
style: { display: "flex", height: "100%", gap: "1rem" },
|
|
59
|
+
children: [
|
|
60
|
+
/* @__PURE__ */ jsxDEV("nav", {
|
|
61
|
+
style: { width: "220px", borderRight: "1px solid #eee" },
|
|
62
|
+
children: /* @__PURE__ */ jsxDEV("ul", {
|
|
63
|
+
style: { listStyle: "none", padding: 0, margin: 0 },
|
|
64
|
+
children: inAppDocs.map((doc) => /* @__PURE__ */ jsxDEV("li", {
|
|
65
|
+
style: { marginBottom: "0.5rem" },
|
|
66
|
+
children: /* @__PURE__ */ jsxDEV("button", {
|
|
67
|
+
onClick: () => setActiveId(doc.id),
|
|
68
|
+
style: {
|
|
69
|
+
background: doc.id === activeId ? "#f0f0f0" : "transparent",
|
|
70
|
+
border: "none",
|
|
71
|
+
padding: "0.5rem 0.75rem",
|
|
72
|
+
cursor: "pointer",
|
|
73
|
+
textAlign: "left",
|
|
74
|
+
width: "100%"
|
|
75
|
+
},
|
|
76
|
+
children: doc.title
|
|
77
|
+
}, undefined, false, undefined, this)
|
|
78
|
+
}, doc.id, false, undefined, this))
|
|
79
|
+
}, undefined, false, undefined, this)
|
|
80
|
+
}, undefined, false, undefined, this),
|
|
81
|
+
/* @__PURE__ */ jsxDEV("main", {
|
|
82
|
+
style: { flexGrow: 1, padding: "1rem", overflowY: "auto" },
|
|
83
|
+
children: activeDoc && /* @__PURE__ */ jsxDEV(Fragment, {
|
|
84
|
+
children: [
|
|
85
|
+
/* @__PURE__ */ jsxDEV("h1", {
|
|
86
|
+
children: activeDoc.title
|
|
87
|
+
}, undefined, false, undefined, this),
|
|
88
|
+
/* @__PURE__ */ jsxDEV(MarkdownRenderer, {
|
|
89
|
+
content: activeDoc.body
|
|
90
|
+
}, undefined, false, undefined, this)
|
|
91
|
+
]
|
|
92
|
+
}, undefined, true, undefined, this)
|
|
93
|
+
}, undefined, false, undefined, this)
|
|
94
|
+
]
|
|
95
|
+
}, undefined, true, undefined, this);
|
|
96
|
+
};
|
|
97
|
+
var InAppDocsViewer_default = InAppDocsViewer;
|
|
98
|
+
export {
|
|
99
|
+
InAppDocsViewer_default as default
|
|
100
|
+
};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
// src/docs/in-app-docs.docblock.ts
|
|
2
|
+
import { registerDocBlocks } from "@contractspec/lib.contracts/docs";
|
|
3
|
+
var inAppDocs = [
|
|
4
|
+
{
|
|
5
|
+
id: "docs.examples.in-app-docs",
|
|
6
|
+
title: "In‑App Docs — Overview",
|
|
7
|
+
summary: "Overview of the in‑app documentation example demonstrating how DocBlock can serve end‑user guides.",
|
|
8
|
+
kind: "goal",
|
|
9
|
+
visibility: "public",
|
|
10
|
+
route: "/docs/examples/in-app-docs",
|
|
11
|
+
tags: ["documentation", "overview", "guide"],
|
|
12
|
+
body: `## Purpose
|
|
13
|
+
The in‑app documentation example shows how you can use ContractSpec's DocBlock system to build user‑facing guides directly inside an application's UI.
|
|
14
|
+
|
|
15
|
+
Instead of relying solely on developer documentation, you can define **public** DocBlocks that describe your product's features in clear, non‑technical language. When embedded in your app, these blocks present a self‑contained help centre for users.
|
|
16
|
+
|
|
17
|
+
## What you'll learn
|
|
18
|
+
* How to define DocBlock objects with public visibility and user‑friendly routes.
|
|
19
|
+
* How to structure an overview page for your in‑app guide using Markdown.
|
|
20
|
+
* How to register your DocBlocks so they show up in the sandbox and in your application.
|
|
21
|
+
|
|
22
|
+
Use this example as a template for documenting your own frontend workflows.`
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
id: "docs.examples.in-app-docs.usage",
|
|
26
|
+
title: "In‑App Docs — Using the Application",
|
|
27
|
+
summary: "Step‑by‑step guide for end users to navigate and use the example application.",
|
|
28
|
+
kind: "usage",
|
|
29
|
+
visibility: "public",
|
|
30
|
+
route: "/docs/examples/in-app-docs/usage",
|
|
31
|
+
tags: ["documentation", "usage", "guide"],
|
|
32
|
+
body: `## Getting Started
|
|
33
|
+
1. **Sign in**. Launch the app and enter your credentials. New users can click **Create Account** to register.
|
|
34
|
+
2. **Explore the dashboard**. Use the sidebar or navigation bar to access sections like Dashboard, Profile, and Settings.
|
|
35
|
+
3. **Add items**. On the Dashboard, click **Add Item** or a plus icon to create a new record. Fill in the form fields and press **Save**.
|
|
36
|
+
|
|
37
|
+
## Tips
|
|
38
|
+
* Look for information icons (ℹ️) throughout the UI. Hover or click these icons to display contextual help powered by DocBlock.
|
|
39
|
+
* Use keyboard shortcuts—such as **Ctrl+S** to save or **Ctrl+K** to open the command palette—for quicker navigation.
|
|
40
|
+
* Need to find something quickly? Use the search bar or filters at the top of lists.
|
|
41
|
+
|
|
42
|
+
## Next Steps
|
|
43
|
+
Continue exploring the different screens. Try editing or deleting items, adjusting your profile settings, or experimenting with filters.
|
|
44
|
+
This guide is available via the help menu inside the app, so you can reference it without leaving your workflow.`
|
|
45
|
+
}
|
|
46
|
+
];
|
|
47
|
+
registerDocBlocks(inAppDocs);
|
|
48
|
+
|
|
49
|
+
// src/ui/InAppDocsViewer.tsx
|
|
50
|
+
import { useState } from "react";
|
|
51
|
+
import { MarkdownRenderer } from "@contractspec/lib.example-shared-ui";
|
|
52
|
+
import { jsxDEV, Fragment } from "react/jsx-dev-runtime";
|
|
53
|
+
"use client";
|
|
54
|
+
var InAppDocsViewer = () => {
|
|
55
|
+
const [activeId, setActiveId] = useState(inAppDocs[0]?.id ?? "");
|
|
56
|
+
const activeDoc = inAppDocs.find((doc) => doc.id === activeId);
|
|
57
|
+
return /* @__PURE__ */ jsxDEV("div", {
|
|
58
|
+
style: { display: "flex", height: "100%", gap: "1rem" },
|
|
59
|
+
children: [
|
|
60
|
+
/* @__PURE__ */ jsxDEV("nav", {
|
|
61
|
+
style: { width: "220px", borderRight: "1px solid #eee" },
|
|
62
|
+
children: /* @__PURE__ */ jsxDEV("ul", {
|
|
63
|
+
style: { listStyle: "none", padding: 0, margin: 0 },
|
|
64
|
+
children: inAppDocs.map((doc) => /* @__PURE__ */ jsxDEV("li", {
|
|
65
|
+
style: { marginBottom: "0.5rem" },
|
|
66
|
+
children: /* @__PURE__ */ jsxDEV("button", {
|
|
67
|
+
onClick: () => setActiveId(doc.id),
|
|
68
|
+
style: {
|
|
69
|
+
background: doc.id === activeId ? "#f0f0f0" : "transparent",
|
|
70
|
+
border: "none",
|
|
71
|
+
padding: "0.5rem 0.75rem",
|
|
72
|
+
cursor: "pointer",
|
|
73
|
+
textAlign: "left",
|
|
74
|
+
width: "100%"
|
|
75
|
+
},
|
|
76
|
+
children: doc.title
|
|
77
|
+
}, undefined, false, undefined, this)
|
|
78
|
+
}, doc.id, false, undefined, this))
|
|
79
|
+
}, undefined, false, undefined, this)
|
|
80
|
+
}, undefined, false, undefined, this),
|
|
81
|
+
/* @__PURE__ */ jsxDEV("main", {
|
|
82
|
+
style: { flexGrow: 1, padding: "1rem", overflowY: "auto" },
|
|
83
|
+
children: activeDoc && /* @__PURE__ */ jsxDEV(Fragment, {
|
|
84
|
+
children: [
|
|
85
|
+
/* @__PURE__ */ jsxDEV("h1", {
|
|
86
|
+
children: activeDoc.title
|
|
87
|
+
}, undefined, false, undefined, this),
|
|
88
|
+
/* @__PURE__ */ jsxDEV(MarkdownRenderer, {
|
|
89
|
+
content: activeDoc.body
|
|
90
|
+
}, undefined, false, undefined, this)
|
|
91
|
+
]
|
|
92
|
+
}, undefined, true, undefined, this)
|
|
93
|
+
}, undefined, false, undefined, this)
|
|
94
|
+
]
|
|
95
|
+
}, undefined, true, undefined, this);
|
|
96
|
+
};
|
|
97
|
+
var InAppDocsViewer_default = InAppDocsViewer;
|
|
98
|
+
export {
|
|
99
|
+
InAppDocsViewer_default as InAppDocsViewer
|
|
100
|
+
};
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import { DocBlock } from
|
|
2
|
-
|
|
3
|
-
//#region src/docs/in-app-docs.docblock.d.ts
|
|
4
|
-
|
|
1
|
+
import type { DocBlock } from '@contractspec/lib.contracts/docs';
|
|
5
2
|
/**
|
|
6
3
|
* DocBlocks for the in-app documentation example.
|
|
7
4
|
*
|
|
@@ -10,7 +7,5 @@ import { DocBlock } from "@contractspec/lib.contracts/docs";
|
|
|
10
7
|
* and will be rendered in the ContractSpec sandbox or within your app if you
|
|
11
8
|
* integrate the documentation.
|
|
12
9
|
*/
|
|
13
|
-
declare const inAppDocs: DocBlock[];
|
|
14
|
-
//#endregion
|
|
15
|
-
export { inAppDocs };
|
|
10
|
+
export declare const inAppDocs: DocBlock[];
|
|
16
11
|
//# sourceMappingURL=in-app-docs.docblock.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"in-app-docs.docblock.d.ts","
|
|
1
|
+
{"version":3,"file":"in-app-docs.docblock.d.ts","sourceRoot":"","sources":["../../src/docs/in-app-docs.docblock.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAGjE;;;;;;;GAOG;AAEH,eAAO,MAAM,SAAS,EAAE,QAAQ,EA6C/B,CAAC"}
|