@contractspec/example.in-app-docs 0.0.0-canary-20260206014742

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.
@@ -0,0 +1,33 @@
1
+ $ tsdown
2
+ ℹ tsdown v0.20.3 powered by rolldown v1.0.0-rc.3
3
+ ℹ config file: /home/runner/work/contractspec/contractspec/packages/examples/in-app-docs/tsdown.config.js
4
+ ℹ entry: src/example.ts, src/index.ts, src/docs/in-app-docs.docblock.ts, src/docs/index.ts, src/ui/InAppDocsViewer.tsx, src/ui/index.ts
5
+ ℹ target: esnext
6
+ ℹ tsconfig: tsconfig.json
7
+ ℹ Build start
8
+ ℹ Cleaning 20 files
9
+ ℹ dist/docs/in-app-docs.docblock.js 3.01 kB │ gzip: 1.44 kB
10
+ ℹ dist/ui/InAppDocsViewer.js 1.86 kB │ gzip: 0.85 kB
11
+ ℹ dist/example.js 1.29 kB │ gzip: 0.66 kB
12
+ ℹ dist/index.js 0.18 kB │ gzip: 0.11 kB
13
+ ℹ dist/ui/index.js 0.08 kB │ gzip: 0.07 kB
14
+ ℹ dist/docs/index.js 0.04 kB │ gzip: 0.06 kB
15
+ ℹ dist/docs/in-app-docs.docblock.js.map 3.60 kB │ gzip: 1.66 kB
16
+ ℹ dist/ui/InAppDocsViewer.js.map 2.58 kB │ gzip: 1.19 kB
17
+ ℹ dist/example.js.map 2.51 kB │ gzip: 1.16 kB
18
+ ℹ dist/docs/in-app-docs.docblock.d.ts.map 0.16 kB │ gzip: 0.14 kB
19
+ ℹ dist/ui/InAppDocsViewer.d.ts.map 0.16 kB │ gzip: 0.14 kB
20
+ ℹ dist/example.d.ts.map 0.14 kB │ gzip: 0.14 kB
21
+ ℹ dist/docs/in-app-docs.docblock.d.ts 0.56 kB │ gzip: 0.35 kB
22
+ ℹ dist/example.d.ts 0.46 kB │ gzip: 0.28 kB
23
+ ℹ dist/ui/InAppDocsViewer.d.ts 0.38 kB │ gzip: 0.25 kB
24
+ ℹ dist/index.d.ts 0.18 kB │ gzip: 0.11 kB
25
+ ℹ dist/ui/index.d.ts 0.08 kB │ gzip: 0.07 kB
26
+ ℹ dist/docs/index.d.ts 0.04 kB │ gzip: 0.06 kB
27
+ ℹ 18 files, total: 17.29 kB
28
+ [PLUGIN_TIMINGS] Warning: Your build spent significant time in plugins. Here is a breakdown:
29
+ - tsdown:external (62%)
30
+ - rolldown-plugin-dts:generate (37%)
31
+ See https://rolldown.rs/options/checks#plugintimings for more details.
32
+
33
+ ✔ Build complete in 24995ms
@@ -0,0 +1,34 @@
1
+ $ bun build:types && bun build:bundle
2
+ $ tsc --noEmit
3
+ $ tsdown
4
+ ℹ tsdown v0.20.3 powered by rolldown v1.0.0-rc.3
5
+ ℹ config file: /home/runner/work/contractspec/contractspec/packages/examples/in-app-docs/tsdown.config.js
6
+ ℹ entry: src/example.ts, src/index.ts, src/docs/in-app-docs.docblock.ts, src/docs/index.ts, src/ui/InAppDocsViewer.tsx, src/ui/index.ts
7
+ ℹ target: esnext
8
+ ℹ tsconfig: tsconfig.json
9
+ ℹ Build start
10
+ ℹ dist/docs/in-app-docs.docblock.js 3.01 kB │ gzip: 1.44 kB
11
+ ℹ dist/ui/InAppDocsViewer.js 1.86 kB │ gzip: 0.85 kB
12
+ ℹ dist/example.js 1.29 kB │ gzip: 0.66 kB
13
+ ℹ dist/index.js 0.18 kB │ gzip: 0.11 kB
14
+ ℹ dist/ui/index.js 0.08 kB │ gzip: 0.07 kB
15
+ ℹ dist/docs/index.js 0.04 kB │ gzip: 0.06 kB
16
+ ℹ dist/docs/in-app-docs.docblock.js.map 3.60 kB │ gzip: 1.66 kB
17
+ ℹ dist/ui/InAppDocsViewer.js.map 2.58 kB │ gzip: 1.19 kB
18
+ ℹ dist/example.js.map 2.51 kB │ gzip: 1.16 kB
19
+ ℹ dist/docs/in-app-docs.docblock.d.ts.map 0.16 kB │ gzip: 0.14 kB
20
+ ℹ dist/ui/InAppDocsViewer.d.ts.map 0.16 kB │ gzip: 0.14 kB
21
+ ℹ dist/example.d.ts.map 0.14 kB │ gzip: 0.14 kB
22
+ ℹ dist/docs/in-app-docs.docblock.d.ts 0.56 kB │ gzip: 0.35 kB
23
+ ℹ dist/example.d.ts 0.46 kB │ gzip: 0.28 kB
24
+ ℹ dist/ui/InAppDocsViewer.d.ts 0.38 kB │ gzip: 0.25 kB
25
+ ℹ dist/index.d.ts 0.18 kB │ gzip: 0.11 kB
26
+ ℹ dist/ui/index.d.ts 0.08 kB │ gzip: 0.07 kB
27
+ ℹ dist/docs/index.d.ts 0.04 kB │ gzip: 0.06 kB
28
+ ℹ 18 files, total: 17.29 kB
29
+ [PLUGIN_TIMINGS] Warning: Your build spent significant time in plugins. Here is a breakdown:
30
+ - tsdown:external (62%)
31
+ - rolldown-plugin-dts:generate (37%)
32
+ See https://rolldown.rs/options/checks#plugintimings for more details.
33
+
34
+ ✔ Build complete in 24069ms
package/CHANGELOG.md ADDED
@@ -0,0 +1,60 @@
1
+ # @contractspec/example.in-app-docs
2
+
3
+ ## 0.0.0-canary-20260206014742
4
+
5
+ ### Minor Changes
6
+
7
+ - 11a5a05: feat: improve product intent
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [47c48c2]
12
+ - Updated dependencies [a119963]
13
+ - Updated dependencies [11a5a05]
14
+ - @contractspec/lib.contracts@0.0.0-canary-20260206014742
15
+ - @contractspec/lib.example-shared-ui@0.0.0-canary-20260206014742
16
+
17
+ ## 1.3.1
18
+
19
+ ### Patch Changes
20
+
21
+ - fix: improve publish config
22
+ - Updated dependencies
23
+ - @contractspec/lib.example-shared-ui@1.10.1
24
+ - @contractspec/lib.contracts@1.56.1
25
+
26
+ ## 1.3.0
27
+
28
+ ### Minor Changes
29
+
30
+ - fix: release
31
+
32
+ ### Patch Changes
33
+
34
+ - Updated dependencies
35
+ - @contractspec/lib.example-shared-ui@1.10.0
36
+ - @contractspec/lib.contracts@1.56.0
37
+
38
+ ## 1.2.0
39
+
40
+ ### Minor Changes
41
+
42
+ - fix: unpublished packages
43
+
44
+ ### Patch Changes
45
+
46
+ - Updated dependencies
47
+ - @contractspec/lib.example-shared-ui@1.9.0
48
+ - @contractspec/lib.contracts@1.55.0
49
+
50
+ ## 1.1.0
51
+
52
+ ### Minor Changes
53
+
54
+ - ec5e95c: chore: upgrade dependencies
55
+
56
+ ### Patch Changes
57
+
58
+ - Updated dependencies [ec5e95c]
59
+ - @contractspec/lib.example-shared-ui@1.8.0
60
+ - @contractspec/lib.contracts@1.54.0
@@ -0,0 +1,15 @@
1
+ import { DocBlock } from "@contractspec/lib.contracts/docs";
2
+
3
+ //#region src/docs/in-app-docs.docblock.d.ts
4
+ /**
5
+ * DocBlocks for the in-app documentation example.
6
+ *
7
+ * These blocks provide publicly visible guides aimed at non‑technical users.
8
+ * Each DocBlock is associated with a route under /docs/examples/in-app-docs
9
+ * and will be rendered in the ContractSpec sandbox or within your app if you
10
+ * integrate the documentation.
11
+ */
12
+ declare const inAppDocs: DocBlock[];
13
+ //#endregion
14
+ export { inAppDocs };
15
+ //# sourceMappingURL=in-app-docs.docblock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"in-app-docs.docblock.d.ts","names":[],"sources":["../../src/docs/in-app-docs.docblock.ts"],"mappings":";;;;;AAYA;;;;;;cAAa,SAAA,EAAW,QAAA"}
@@ -0,0 +1,65 @@
1
+ import { registerDocBlocks } from "@contractspec/lib.contracts/docs";
2
+
3
+ //#region src/docs/in-app-docs.docblock.ts
4
+ /**
5
+ * DocBlocks for the in-app documentation example.
6
+ *
7
+ * These blocks provide publicly visible guides aimed at non‑technical users.
8
+ * Each DocBlock is associated with a route under /docs/examples/in-app-docs
9
+ * and will be rendered in the ContractSpec sandbox or within your app if you
10
+ * integrate the documentation.
11
+ */
12
+ const inAppDocs = [{
13
+ id: "docs.examples.in-app-docs",
14
+ title: "In‑App Docs — Overview",
15
+ summary: "Overview of the in‑app documentation example demonstrating how DocBlock can serve end‑user guides.",
16
+ kind: "goal",
17
+ visibility: "public",
18
+ route: "/docs/examples/in-app-docs",
19
+ tags: [
20
+ "documentation",
21
+ "overview",
22
+ "guide"
23
+ ],
24
+ body: `## Purpose
25
+ 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.
26
+
27
+ 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.
28
+
29
+ ## What you'll learn
30
+ * How to define DocBlock objects with public visibility and user‑friendly routes.
31
+ * How to structure an overview page for your in‑app guide using Markdown.
32
+ * How to register your DocBlocks so they show up in the sandbox and in your application.
33
+
34
+ Use this example as a template for documenting your own frontend workflows.`
35
+ }, {
36
+ id: "docs.examples.in-app-docs.usage",
37
+ title: "In‑App Docs — Using the Application",
38
+ summary: "Step‑by‑step guide for end users to navigate and use the example application.",
39
+ kind: "usage",
40
+ visibility: "public",
41
+ route: "/docs/examples/in-app-docs/usage",
42
+ tags: [
43
+ "documentation",
44
+ "usage",
45
+ "guide"
46
+ ],
47
+ body: `## Getting Started
48
+ 1. **Sign in**. Launch the app and enter your credentials. New users can click **Create Account** to register.
49
+ 2. **Explore the dashboard**. Use the sidebar or navigation bar to access sections like Dashboard, Profile, and Settings.
50
+ 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**.
51
+
52
+ ## Tips
53
+ * Look for information icons (ℹ️) throughout the UI. Hover or click these icons to display contextual help powered by DocBlock.
54
+ * Use keyboard shortcuts—such as **Ctrl+S** to save or **Ctrl+K** to open the command palette—for quicker navigation.
55
+ * Need to find something quickly? Use the search bar or filters at the top of lists.
56
+
57
+ ## Next Steps
58
+ Continue exploring the different screens. Try editing or deleting items, adjusting your profile settings, or experimenting with filters.
59
+ This guide is available via the help menu inside the app, so you can reference it without leaving your workflow.`
60
+ }];
61
+ registerDocBlocks(inAppDocs);
62
+
63
+ //#endregion
64
+ export { inAppDocs };
65
+ //# sourceMappingURL=in-app-docs.docblock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"in-app-docs.docblock.js","names":[],"sources":["../../src/docs/in-app-docs.docblock.ts"],"sourcesContent":["import type { DocBlock } from '@contractspec/lib.contracts/docs';\nimport { registerDocBlocks } from '@contractspec/lib.contracts/docs';\n\n/**\n * DocBlocks for the in-app documentation example.\n *\n * These blocks provide publicly visible guides aimed at non‑technical users.\n * Each DocBlock is associated with a route under /docs/examples/in-app-docs\n * and will be rendered in the ContractSpec sandbox or within your app if you\n * integrate the documentation.\n */\n// Export the DocBlocks array so it can be reused by the UI layer.\nexport const inAppDocs: DocBlock[] = [\n {\n id: 'docs.examples.in-app-docs',\n title: 'In‑App Docs — Overview',\n summary:\n 'Overview of the in‑app documentation example demonstrating how DocBlock can serve end‑user guides.',\n kind: 'goal',\n visibility: 'public',\n route: '/docs/examples/in-app-docs',\n tags: ['documentation', 'overview', 'guide'],\n body: `## Purpose\nThe in‑app documentation example shows how you can use ContractSpec's DocBlock system to build user‑facing guides directly inside an application's UI.\n\nInstead 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.\n\n## What you'll learn\n* How to define DocBlock objects with public visibility and user‑friendly routes.\n* How to structure an overview page for your in‑app guide using Markdown.\n* How to register your DocBlocks so they show up in the sandbox and in your application.\n\nUse this example as a template for documenting your own frontend workflows.`,\n },\n {\n id: 'docs.examples.in-app-docs.usage',\n title: 'In‑App Docs — Using the Application',\n summary:\n 'Step‑by‑step guide for end users to navigate and use the example application.',\n kind: 'usage',\n visibility: 'public',\n route: '/docs/examples/in-app-docs/usage',\n tags: ['documentation', 'usage', 'guide'],\n body: `## Getting Started\n1. **Sign in**. Launch the app and enter your credentials. New users can click **Create Account** to register.\n2. **Explore the dashboard**. Use the sidebar or navigation bar to access sections like Dashboard, Profile, and Settings.\n3. **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**.\n\n## Tips\n* Look for information icons (ℹ️) throughout the UI. Hover or click these icons to display contextual help powered by DocBlock.\n* Use keyboard shortcuts—such as **Ctrl+S** to save or **Ctrl+K** to open the command palette—for quicker navigation.\n* Need to find something quickly? Use the search bar or filters at the top of lists.\n\n## Next Steps\nContinue exploring the different screens. Try editing or deleting items, adjusting your profile settings, or experimenting with filters.\nThis guide is available via the help menu inside the app, so you can reference it without leaving your workflow.`,\n },\n];\n\nregisterDocBlocks(inAppDocs);\n"],"mappings":";;;;;;;;;;;AAYA,MAAa,YAAwB,CACnC;CACE,IAAI;CACJ,OAAO;CACP,SACE;CACF,MAAM;CACN,YAAY;CACZ,OAAO;CACP,MAAM;EAAC;EAAiB;EAAY;EAAQ;CAC5C,MAAM;;;;;;;;;;;CAWP,EACD;CACE,IAAI;CACJ,OAAO;CACP,SACE;CACF,MAAM;CACN,YAAY;CACZ,OAAO;CACP,MAAM;EAAC;EAAiB;EAAS;EAAQ;CACzC,MAAM;;;;;;;;;;;;;CAaP,CACF;AAED,kBAAkB,UAAU"}
@@ -0,0 +1 @@
1
+ import "./in-app-docs.docblock.js";
@@ -0,0 +1 @@
1
+ import "./in-app-docs.docblock.js";
@@ -0,0 +1,13 @@
1
+ import * as _contractspec_lib_contracts0 from "@contractspec/lib.contracts";
2
+
3
+ //#region src/example.d.ts
4
+ /**
5
+ * Example specification for the in-app documentation example.
6
+ *
7
+ * This example demonstrates how to use DocBlock to build public documentation
8
+ * aimed at end users directly within the application UI.
9
+ */
10
+ declare const example: _contractspec_lib_contracts0.ExampleSpec;
11
+ //#endregion
12
+ export { example as default };
13
+ //# sourceMappingURL=example.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"example.d.ts","names":[],"sources":["../src/example.ts"],"mappings":";;;;;;AAQa;;;cAAP,OAAA,EA0CJ,4BAAA,CA1CW,WAAA"}
@@ -0,0 +1,52 @@
1
+ import { defineExample } from "@contractspec/lib.contracts";
2
+
3
+ //#region src/example.ts
4
+ /**
5
+ * Example specification for the in-app documentation example.
6
+ *
7
+ * This example demonstrates how to use DocBlock to build public documentation
8
+ * aimed at end users directly within the application UI.
9
+ */
10
+ const example = defineExample({
11
+ meta: {
12
+ key: "in-app-docs",
13
+ version: "1.0.0",
14
+ title: "In‑App Documentation Example",
15
+ 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.",
16
+ kind: "ui",
17
+ visibility: "public",
18
+ stability: "experimental",
19
+ owners: ["@docs-team"],
20
+ tags: [
21
+ "documentation",
22
+ "guide",
23
+ "ui"
24
+ ]
25
+ },
26
+ docs: {
27
+ rootDocId: "docs.examples.in-app-docs",
28
+ usageDocId: "docs.examples.in-app-docs.usage",
29
+ goalDocId: "docs.examples.in-app-docs"
30
+ },
31
+ entrypoints: {
32
+ packageName: "@contractspec/example.in-app-docs",
33
+ docs: "./docs",
34
+ ui: "./ui"
35
+ },
36
+ surfaces: {
37
+ templates: false,
38
+ sandbox: {
39
+ enabled: true,
40
+ modes: ["markdown"]
41
+ },
42
+ studio: {
43
+ enabled: false,
44
+ installable: false
45
+ },
46
+ mcp: { enabled: false }
47
+ }
48
+ });
49
+
50
+ //#endregion
51
+ export { example as default };
52
+ //# sourceMappingURL=example.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"example.js","names":[],"sources":["../src/example.ts"],"sourcesContent":["import { defineExample } from '@contractspec/lib.contracts';\n\n/**\n * Example specification for the in-app documentation example.\n *\n * This example demonstrates how to use DocBlock to build public documentation\n * aimed at end users directly within the application UI.\n */\nconst example = defineExample({\n meta: {\n key: 'in-app-docs',\n version: '1.0.0',\n title: 'In‑App Documentation Example',\n description:\n \"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.\",\n kind: 'ui',\n visibility: 'public',\n stability: 'experimental',\n owners: ['@docs-team'],\n tags: ['documentation', 'guide', 'ui'],\n },\n docs: {\n // Root documentation page; clicking on the example in the docs navigation\n // will display this page.\n rootDocId: 'docs.examples.in-app-docs',\n // Explicitly set usage documentation id for quickstart/guide sections.\n usageDocId: 'docs.examples.in-app-docs.usage',\n // Provide a goal document describing the purpose of this example.\n goalDocId: 'docs.examples.in-app-docs',\n },\n entrypoints: {\n // Package name used for the example's compiled output.\n packageName: '@contractspec/example.in-app-docs',\n // Documentation entrypoint folder; compiled docs will be published under this path.\n docs: './docs',\n // UI entrypoint exposes the in-app documentation viewer component.\n ui: './ui',\n },\n surfaces: {\n // This example is not a template for new projects.\n templates: false,\n // Enable sandbox with only the markdown mode so users can view the docblocks.\n sandbox: {\n enabled: true,\n modes: ['markdown'],\n },\n // Studio/MCP not required for this simple documentation example.\n studio: { enabled: false, installable: false },\n mcp: { enabled: false },\n },\n});\n\nexport default example;\n"],"mappings":";;;;;;;;;AAQA,MAAM,UAAU,cAAc;CAC5B,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aACE;EACF,MAAM;EACN,YAAY;EACZ,WAAW;EACX,QAAQ,CAAC,aAAa;EACtB,MAAM;GAAC;GAAiB;GAAS;GAAK;EACvC;CACD,MAAM;EAGJ,WAAW;EAEX,YAAY;EAEZ,WAAW;EACZ;CACD,aAAa;EAEX,aAAa;EAEb,MAAM;EAEN,IAAI;EACL;CACD,UAAU;EAER,WAAW;EAEX,SAAS;GACP,SAAS;GACT,OAAO,CAAC,WAAW;GACpB;EAED,QAAQ;GAAE,SAAS;GAAO,aAAa;GAAO;EAC9C,KAAK,EAAE,SAAS,OAAO;EACxB;CACF,CAAC"}
@@ -0,0 +1,5 @@
1
+ import "./docs/index.js";
2
+ import example from "./example.js";
3
+ import InAppDocsViewer from "./ui/InAppDocsViewer.js";
4
+ import "./ui/index.js";
5
+ export { InAppDocsViewer, example };
package/dist/index.js ADDED
@@ -0,0 +1,6 @@
1
+ import example from "./example.js";
2
+ import InAppDocsViewer from "./ui/InAppDocsViewer.js";
3
+ import "./ui/index.js";
4
+ import "./docs/index.js";
5
+
6
+ export { InAppDocsViewer, example };
@@ -0,0 +1,11 @@
1
+ import React from "react";
2
+
3
+ //#region src/ui/InAppDocsViewer.d.ts
4
+ /**
5
+ * InAppDocsViewer renders a simple navigation and content area for the example's DocBlocks.
6
+ * Users can click titles on the left to switch between documentation pages.
7
+ */
8
+ declare const InAppDocsViewer: React.FC;
9
+ //#endregion
10
+ export { InAppDocsViewer as default };
11
+ //# sourceMappingURL=InAppDocsViewer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InAppDocsViewer.d.ts","names":[],"sources":["../../src/ui/InAppDocsViewer.tsx"],"mappings":";;;;;AAEwC;;cASlC,eAAA,EAAiB,KAAA,CAAM,EAAA"}
@@ -0,0 +1,62 @@
1
+ 'use client';
2
+
3
+ import { inAppDocs } from "../docs/in-app-docs.docblock.js";
4
+ import React, { useState } from "react";
5
+ import { MarkdownRenderer } from "@contractspec/lib.example-shared-ui";
6
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
7
+
8
+ //#region src/ui/InAppDocsViewer.tsx
9
+ /**
10
+ * InAppDocsViewer renders a simple navigation and content area for the example's DocBlocks.
11
+ * Users can click titles on the left to switch between documentation pages.
12
+ */
13
+ const InAppDocsViewer = () => {
14
+ const [activeId, setActiveId] = useState(inAppDocs[0]?.id ?? "");
15
+ const activeDoc = inAppDocs.find((doc) => doc.id === activeId);
16
+ return /* @__PURE__ */ jsxs("div", {
17
+ style: {
18
+ display: "flex",
19
+ height: "100%",
20
+ gap: "1rem"
21
+ },
22
+ children: [/* @__PURE__ */ jsx("nav", {
23
+ style: {
24
+ width: "220px",
25
+ borderRight: "1px solid #eee"
26
+ },
27
+ children: /* @__PURE__ */ jsx("ul", {
28
+ style: {
29
+ listStyle: "none",
30
+ padding: 0,
31
+ margin: 0
32
+ },
33
+ children: inAppDocs.map((doc) => /* @__PURE__ */ jsx("li", {
34
+ style: { marginBottom: "0.5rem" },
35
+ children: /* @__PURE__ */ jsx("button", {
36
+ onClick: () => setActiveId(doc.id),
37
+ style: {
38
+ background: doc.id === activeId ? "#f0f0f0" : "transparent",
39
+ border: "none",
40
+ padding: "0.5rem 0.75rem",
41
+ cursor: "pointer",
42
+ textAlign: "left",
43
+ width: "100%"
44
+ },
45
+ children: doc.title
46
+ })
47
+ }, doc.id))
48
+ })
49
+ }), /* @__PURE__ */ jsx("main", {
50
+ style: {
51
+ flexGrow: 1,
52
+ padding: "1rem",
53
+ overflowY: "auto"
54
+ },
55
+ children: activeDoc && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("h1", { children: activeDoc.title }), /* @__PURE__ */ jsx(MarkdownRenderer, { content: activeDoc.body })] })
56
+ })]
57
+ });
58
+ };
59
+
60
+ //#endregion
61
+ export { InAppDocsViewer as default };
62
+ //# sourceMappingURL=InAppDocsViewer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InAppDocsViewer.js","names":[],"sources":["../../src/ui/InAppDocsViewer.tsx"],"sourcesContent":["'use client';\n\nimport React, { useState } from 'react';\n// import ReactMarkdown from 'react-markdown';\nimport { inAppDocs } from '../docs/in-app-docs.docblock';\nimport { MarkdownRenderer } from '@contractspec/lib.example-shared-ui';\n\n/**\n * InAppDocsViewer renders a simple navigation and content area for the example's DocBlocks.\n * Users can click titles on the left to switch between documentation pages.\n */\nconst InAppDocsViewer: React.FC = () => {\n const [activeId, setActiveId] = useState<string>(inAppDocs[0]?.id ?? '');\n\n const activeDoc = inAppDocs.find((doc) => doc.id === activeId);\n\n return (\n <div style={{ display: 'flex', height: '100%', gap: '1rem' }}>\n <nav style={{ width: '220px', borderRight: '1px solid #eee' }}>\n <ul style={{ listStyle: 'none', padding: 0, margin: 0 }}>\n {inAppDocs.map((doc) => (\n <li key={doc.id} style={{ marginBottom: '0.5rem' }}>\n <button\n onClick={() => setActiveId(doc.id)}\n style={{\n background: doc.id === activeId ? '#f0f0f0' : 'transparent',\n border: 'none',\n padding: '0.5rem 0.75rem',\n cursor: 'pointer',\n textAlign: 'left',\n width: '100%',\n }}\n >\n {doc.title}\n </button>\n </li>\n ))}\n </ul>\n </nav>\n <main style={{ flexGrow: 1, padding: '1rem', overflowY: 'auto' }}>\n {activeDoc && (\n <>\n <h1>{activeDoc.title}</h1>\n <MarkdownRenderer content={activeDoc.body} />\n </>\n )}\n </main>\n </div>\n );\n};\n\nexport default InAppDocsViewer;\n"],"mappings":";;;;;;;;;;;;AAWA,MAAM,wBAAkC;CACtC,MAAM,CAAC,UAAU,eAAe,SAAiB,UAAU,IAAI,MAAM,GAAG;CAExE,MAAM,YAAY,UAAU,MAAM,QAAQ,IAAI,OAAO,SAAS;AAE9D,QACE,qBAAC;EAAI,OAAO;GAAE,SAAS;GAAQ,QAAQ;GAAQ,KAAK;GAAQ;aAC1D,oBAAC;GAAI,OAAO;IAAE,OAAO;IAAS,aAAa;IAAkB;aAC3D,oBAAC;IAAG,OAAO;KAAE,WAAW;KAAQ,SAAS;KAAG,QAAQ;KAAG;cACpD,UAAU,KAAK,QACd,oBAAC;KAAgB,OAAO,EAAE,cAAc,UAAU;eAChD,oBAAC;MACC,eAAe,YAAY,IAAI,GAAG;MAClC,OAAO;OACL,YAAY,IAAI,OAAO,WAAW,YAAY;OAC9C,QAAQ;OACR,SAAS;OACT,QAAQ;OACR,WAAW;OACX,OAAO;OACR;gBAEA,IAAI;OACE;OAbF,IAAI,GAcR,CACL;KACC;IACD,EACN,oBAAC;GAAK,OAAO;IAAE,UAAU;IAAG,SAAS;IAAQ,WAAW;IAAQ;aAC7D,aACC,4CACE,oBAAC,kBAAI,UAAU,QAAW,EAC1B,oBAAC,oBAAiB,SAAS,UAAU,OAAQ,IAC5C;IAEA;GACH"}
@@ -0,0 +1,2 @@
1
+ import InAppDocsViewer from "./InAppDocsViewer.js";
2
+ export { InAppDocsViewer };
@@ -0,0 +1,3 @@
1
+ import InAppDocsViewer from "./InAppDocsViewer.js";
2
+
3
+ export { InAppDocsViewer };
package/package.json ADDED
@@ -0,0 +1,62 @@
1
+ {
2
+ "name": "@contractspec/example.in-app-docs",
3
+ "version": "0.0.0-canary-20260206014742",
4
+ "description": "Example showing how to use DocBlock for in-app documentation for non-technical users",
5
+ "type": "module",
6
+ "types": "./dist/index.d.ts",
7
+ "exports": {
8
+ ".": "./dist/index.js",
9
+ "./docs": "./dist/docs/index.js",
10
+ "./docs/in-app-docs.docblock": "./dist/docs/in-app-docs.docblock.js",
11
+ "./example": "./dist/example.js",
12
+ "./ui": "./dist/ui/index.js",
13
+ "./ui/InAppDocsViewer": "./dist/ui/InAppDocsViewer.js",
14
+ "./*": "./*"
15
+ },
16
+ "scripts": {
17
+ "publish:pkg": "bun publish --tolerate-republish --ignore-scripts --verbose",
18
+ "publish:pkg:canary": "bun publish:pkg --tag canary",
19
+ "build": "bun build:types && bun build:bundle",
20
+ "build:bundle": "tsdown",
21
+ "build:types": "tsc --noEmit",
22
+ "dev": "bun build:bundle --watch",
23
+ "clean": "rimraf dist .turbo",
24
+ "lint": "bun lint:fix",
25
+ "lint:fix": "eslint src --fix",
26
+ "lint:check": "eslint src",
27
+ "test": "bun test"
28
+ },
29
+ "dependencies": {
30
+ "@contractspec/lib.contracts": "0.0.0-canary-20260206014742",
31
+ "@contractspec/lib.example-shared-ui": "0.0.0-canary-20260206014742",
32
+ "react": "19.2.4",
33
+ "react-dom": "19.2.4"
34
+ },
35
+ "devDependencies": {
36
+ "@contractspec/tool.tsdown": "0.0.0-canary-20260206014742",
37
+ "@contractspec/tool.typescript": "0.0.0-canary-20260206014742",
38
+ "tsdown": "^0.20.3",
39
+ "typescript": "^5.9.3",
40
+ "@types/react": "^19.2.13",
41
+ "@types/react-dom": "^19.2.2"
42
+ },
43
+ "publishConfig": {
44
+ "exports": {
45
+ ".": "./dist/index.js",
46
+ "./docs": "./dist/docs/index.js",
47
+ "./docs/in-app-docs.docblock": "./dist/docs/in-app-docs.docblock.js",
48
+ "./example": "./dist/example.js",
49
+ "./ui": "./dist/ui/index.js",
50
+ "./*": "./*"
51
+ },
52
+ "registry": "https://registry.npmjs.org/",
53
+ "access": "public"
54
+ },
55
+ "license": "MIT",
56
+ "repository": {
57
+ "type": "git",
58
+ "url": "https://github.com/lssm-tech/contractspec.git",
59
+ "directory": "packages/examples/in-app-docs"
60
+ },
61
+ "homepage": "https://contractspec.io"
62
+ }
@@ -0,0 +1,60 @@
1
+ import type { DocBlock } from '@contractspec/lib.contracts/docs';
2
+ import { registerDocBlocks } from '@contractspec/lib.contracts/docs';
3
+
4
+ /**
5
+ * DocBlocks for the in-app documentation example.
6
+ *
7
+ * These blocks provide publicly visible guides aimed at non‑technical users.
8
+ * Each DocBlock is associated with a route under /docs/examples/in-app-docs
9
+ * and will be rendered in the ContractSpec sandbox or within your app if you
10
+ * integrate the documentation.
11
+ */
12
+ // Export the DocBlocks array so it can be reused by the UI layer.
13
+ export const inAppDocs: DocBlock[] = [
14
+ {
15
+ id: 'docs.examples.in-app-docs',
16
+ title: 'In‑App Docs — Overview',
17
+ summary:
18
+ 'Overview of the in‑app documentation example demonstrating how DocBlock can serve end‑user guides.',
19
+ kind: 'goal',
20
+ visibility: 'public',
21
+ route: '/docs/examples/in-app-docs',
22
+ tags: ['documentation', 'overview', 'guide'],
23
+ body: `## Purpose
24
+ 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.
25
+
26
+ 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.
27
+
28
+ ## What you'll learn
29
+ * How to define DocBlock objects with public visibility and user‑friendly routes.
30
+ * How to structure an overview page for your in‑app guide using Markdown.
31
+ * How to register your DocBlocks so they show up in the sandbox and in your application.
32
+
33
+ Use this example as a template for documenting your own frontend workflows.`,
34
+ },
35
+ {
36
+ id: 'docs.examples.in-app-docs.usage',
37
+ title: 'In‑App Docs — Using the Application',
38
+ summary:
39
+ 'Step‑by‑step guide for end users to navigate and use the example application.',
40
+ kind: 'usage',
41
+ visibility: 'public',
42
+ route: '/docs/examples/in-app-docs/usage',
43
+ tags: ['documentation', 'usage', 'guide'],
44
+ body: `## Getting Started
45
+ 1. **Sign in**. Launch the app and enter your credentials. New users can click **Create Account** to register.
46
+ 2. **Explore the dashboard**. Use the sidebar or navigation bar to access sections like Dashboard, Profile, and Settings.
47
+ 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**.
48
+
49
+ ## Tips
50
+ * Look for information icons (ℹ️) throughout the UI. Hover or click these icons to display contextual help powered by DocBlock.
51
+ * Use keyboard shortcuts—such as **Ctrl+S** to save or **Ctrl+K** to open the command palette—for quicker navigation.
52
+ * Need to find something quickly? Use the search bar or filters at the top of lists.
53
+
54
+ ## Next Steps
55
+ Continue exploring the different screens. Try editing or deleting items, adjusting your profile settings, or experimenting with filters.
56
+ This guide is available via the help menu inside the app, so you can reference it without leaving your workflow.`,
57
+ },
58
+ ];
59
+
60
+ registerDocBlocks(inAppDocs);
@@ -0,0 +1,2 @@
1
+ // Register all DocBlocks for the in-app documentation example.
2
+ import './in-app-docs.docblock';
package/src/example.ts ADDED
@@ -0,0 +1,53 @@
1
+ import { defineExample } from '@contractspec/lib.contracts';
2
+
3
+ /**
4
+ * Example specification for the in-app documentation example.
5
+ *
6
+ * This example demonstrates how to use DocBlock to build public documentation
7
+ * aimed at end users directly within the application UI.
8
+ */
9
+ const example = defineExample({
10
+ meta: {
11
+ key: 'in-app-docs',
12
+ version: '1.0.0',
13
+ title: 'In‑App Documentation Example',
14
+ description:
15
+ "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.",
16
+ kind: 'ui',
17
+ visibility: 'public',
18
+ stability: 'experimental',
19
+ owners: ['@docs-team'],
20
+ tags: ['documentation', 'guide', 'ui'],
21
+ },
22
+ docs: {
23
+ // Root documentation page; clicking on the example in the docs navigation
24
+ // will display this page.
25
+ rootDocId: 'docs.examples.in-app-docs',
26
+ // Explicitly set usage documentation id for quickstart/guide sections.
27
+ usageDocId: 'docs.examples.in-app-docs.usage',
28
+ // Provide a goal document describing the purpose of this example.
29
+ goalDocId: 'docs.examples.in-app-docs',
30
+ },
31
+ entrypoints: {
32
+ // Package name used for the example's compiled output.
33
+ packageName: '@contractspec/example.in-app-docs',
34
+ // Documentation entrypoint folder; compiled docs will be published under this path.
35
+ docs: './docs',
36
+ // UI entrypoint exposes the in-app documentation viewer component.
37
+ ui: './ui',
38
+ },
39
+ surfaces: {
40
+ // This example is not a template for new projects.
41
+ templates: false,
42
+ // Enable sandbox with only the markdown mode so users can view the docblocks.
43
+ sandbox: {
44
+ enabled: true,
45
+ modes: ['markdown'],
46
+ },
47
+ // Studio/MCP not required for this simple documentation example.
48
+ studio: { enabled: false, installable: false },
49
+ mcp: { enabled: false },
50
+ },
51
+ });
52
+
53
+ export default example;
package/src/index.ts ADDED
@@ -0,0 +1,11 @@
1
+ // In-App Documentation Example
2
+ // Exports the example metadata and registers documentation.
3
+
4
+ // Export example spec
5
+ export { default as example } from './example';
6
+
7
+ // Export UI components
8
+ export * from './ui';
9
+
10
+ // Import docs to register doc blocks on load
11
+ import './docs';