@contractspec/bundle.library 3.8.12 → 3.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.
Files changed (202) hide show
  1. package/.turbo/turbo-build.log +290 -282
  2. package/CHANGELOG.md +46 -0
  3. package/dist/application/index.js +11 -11
  4. package/dist/application/mcp/cliMcp.js +6 -6
  5. package/dist/application/mcp/cliMcp.onboarding.d.ts +4 -0
  6. package/dist/application/mcp/cliMcp.onboarding.js +2 -0
  7. package/dist/application/mcp/cliMcp.test.d.ts +1 -0
  8. package/dist/application/mcp/contractsMcp.js +2 -2
  9. package/dist/application/mcp/contractsMcp.test.d.ts +1 -0
  10. package/dist/application/mcp/contractsMcpAdoptionTools.d.ts +3 -0
  11. package/dist/application/mcp/contractsMcpAdoptionTools.js +2 -0
  12. package/dist/application/mcp/contractsMcpResources.js +1 -1
  13. package/dist/application/mcp/contractsMcpTools.js +1 -1
  14. package/dist/application/mcp/contractsMcpTypes.d.ts +16 -0
  15. package/dist/application/mcp/index.js +11 -11
  16. package/dist/components/docs/DocsIndexPage.js +1 -1
  17. package/dist/components/docs/docsManifest.js +1 -1
  18. package/dist/components/docs/examples/DocsExamplesPage.js +1 -17
  19. package/dist/components/docs/examples/ExampleShowcasePage.d.ts +1 -1
  20. package/dist/components/docs/examples/ExampleShowcasePage.js +2 -17
  21. package/dist/components/docs/examples/exampleShowcaseData.d.ts +2 -2
  22. package/dist/components/docs/examples/exampleShowcaseData.js +2 -17
  23. package/dist/components/docs/examples/exampleShowcaseData.test.d.ts +1 -0
  24. package/dist/components/docs/examples/index.js +2 -17
  25. package/dist/components/docs/getting-started/CLIPage.js +5 -4
  26. package/dist/components/docs/getting-started/DataViewTutorialPage.js +44 -67
  27. package/dist/components/docs/getting-started/StartHerePage.js +4 -2
  28. package/dist/components/docs/getting-started/index.js +56 -76
  29. package/dist/components/docs/guides/GuideConnectInRepoPage.js +29 -4
  30. package/dist/components/docs/guides/GuideHostBuilderWorkbenchPage.js +21 -6
  31. package/dist/components/docs/guides/GuideReleaseCapsulesPage.d.ts +1 -0
  32. package/dist/components/docs/guides/GuideReleaseCapsulesPage.js +16 -0
  33. package/dist/components/docs/guides/GuidesIndexPage.js +1 -1
  34. package/dist/components/docs/guides/index.d.ts +1 -0
  35. package/dist/components/docs/guides/index.js +93 -39
  36. package/dist/components/docs/index.js +572 -421
  37. package/dist/components/docs/libraries/LibrariesContractsPage.js +43 -18
  38. package/dist/components/docs/libraries/LibrariesDesignSystemPage.js +43 -31
  39. package/dist/components/docs/libraries/LibrariesOverviewPage.js +1 -1
  40. package/dist/components/docs/libraries/LibrariesUIKitPage.js +42 -16
  41. package/dist/components/docs/libraries/LibrariesUIKitWebPage.d.ts +1 -0
  42. package/dist/components/docs/libraries/LibrariesUIKitWebPage.js +47 -0
  43. package/dist/components/docs/libraries/index.d.ts +1 -0
  44. package/dist/components/docs/libraries/index.js +221 -113
  45. package/dist/components/docs/specs/SpecsBuilderControlPlanePage.js +18 -3
  46. package/dist/components/docs/specs/SpecsConnectPage.js +4 -2
  47. package/dist/components/docs/specs/SpecsDataViewsPage.js +39 -32
  48. package/dist/components/docs/specs/index.js +65 -41
  49. package/dist/index.js +583 -432
  50. package/dist/node/application/index.js +11 -11
  51. package/dist/node/application/mcp/cliMcp.js +6 -6
  52. package/dist/node/application/mcp/cliMcp.onboarding.js +1 -0
  53. package/dist/node/application/mcp/contractsMcp.js +2 -2
  54. package/dist/node/application/mcp/contractsMcpAdoptionTools.js +1 -0
  55. package/dist/node/application/mcp/contractsMcpResources.js +1 -1
  56. package/dist/node/application/mcp/contractsMcpTools.js +1 -1
  57. package/dist/node/application/mcp/index.js +11 -11
  58. package/dist/node/components/docs/DocsIndexPage.js +1 -1
  59. package/dist/node/components/docs/docsManifest.js +1 -1
  60. package/dist/node/components/docs/examples/DocsExamplesPage.js +1 -17
  61. package/dist/node/components/docs/examples/ExampleShowcasePage.js +2 -17
  62. package/dist/node/components/docs/examples/exampleShowcaseData.js +2 -17
  63. package/dist/node/components/docs/examples/index.js +2 -17
  64. package/dist/node/components/docs/getting-started/CLIPage.js +5 -4
  65. package/dist/node/components/docs/getting-started/DataViewTutorialPage.js +44 -67
  66. package/dist/node/components/docs/getting-started/StartHerePage.js +4 -2
  67. package/dist/node/components/docs/getting-started/index.js +56 -76
  68. package/dist/node/components/docs/guides/GuideConnectInRepoPage.js +29 -4
  69. package/dist/node/components/docs/guides/GuideHostBuilderWorkbenchPage.js +21 -6
  70. package/dist/node/components/docs/guides/GuideReleaseCapsulesPage.js +15 -0
  71. package/dist/node/components/docs/guides/GuidesIndexPage.js +1 -1
  72. package/dist/node/components/docs/guides/index.js +93 -39
  73. package/dist/node/components/docs/index.js +572 -421
  74. package/dist/node/components/docs/libraries/LibrariesContractsPage.js +43 -18
  75. package/dist/node/components/docs/libraries/LibrariesDesignSystemPage.js +43 -31
  76. package/dist/node/components/docs/libraries/LibrariesOverviewPage.js +1 -1
  77. package/dist/node/components/docs/libraries/LibrariesUIKitPage.js +42 -16
  78. package/dist/node/components/docs/libraries/LibrariesUIKitWebPage.js +46 -0
  79. package/dist/node/components/docs/libraries/index.js +221 -113
  80. package/dist/node/components/docs/specs/SpecsBuilderControlPlanePage.js +18 -3
  81. package/dist/node/components/docs/specs/SpecsConnectPage.js +4 -2
  82. package/dist/node/components/docs/specs/SpecsDataViewsPage.js +39 -32
  83. package/dist/node/components/docs/specs/index.js +65 -41
  84. package/dist/node/index.js +583 -432
  85. package/package.json +65 -16
  86. package/src/application/mcp/cliMcp.onboarding.ts +297 -0
  87. package/src/application/mcp/cliMcp.test.ts +99 -0
  88. package/src/application/mcp/cliMcp.ts +30 -3
  89. package/src/application/mcp/contractsMcp.test.ts +65 -0
  90. package/src/application/mcp/contractsMcpAdoptionTools.ts +131 -0
  91. package/src/application/mcp/contractsMcpResources.ts +49 -0
  92. package/src/application/mcp/contractsMcpTools.ts +2 -0
  93. package/src/application/mcp/contractsMcpTypes.ts +16 -0
  94. package/src/components/docs/docsManifest.ts +12 -0
  95. package/src/components/docs/examples/DocsExamplesPage.tsx +6 -14
  96. package/src/components/docs/examples/ExampleShowcasePage.tsx +22 -18
  97. package/src/components/docs/examples/exampleShowcaseData.test.ts +22 -0
  98. package/src/components/docs/examples/exampleShowcaseData.ts +75 -50
  99. package/src/components/docs/generated/docs-index._common.json +2008 -1691
  100. package/src/components/docs/generated/docs-index.agent-console.json +377 -377
  101. package/src/components/docs/generated/docs-index.ai-chat-assistant.json +17 -17
  102. package/src/components/docs/generated/docs-index.ai-chat.json +105 -105
  103. package/src/components/docs/generated/docs-index.ai-support-bot.json +9 -9
  104. package/src/components/docs/generated/docs-index.analytics-dashboard.json +169 -169
  105. package/src/components/docs/generated/docs-index.app-config.json +137 -137
  106. package/src/components/docs/generated/docs-index.artisan-knowledge-product.json +17 -17
  107. package/src/components/docs/generated/docs-index.artisan-payments-stripe.json +33 -33
  108. package/src/components/docs/generated/docs-index.audit-trail.json +49 -49
  109. package/src/components/docs/generated/docs-index.calendar-google.json +9 -9
  110. package/src/components/docs/generated/docs-index.content-generation.json +9 -9
  111. package/src/components/docs/generated/docs-index.control-plane.json +17 -17
  112. package/src/components/docs/generated/docs-index.crm-pipeline.json +161 -161
  113. package/src/components/docs/generated/docs-index.data-grid-showcase.json +25 -17
  114. package/src/components/docs/generated/docs-index.defineExample.json +9 -9
  115. package/src/components/docs/generated/docs-index.email-gmail.json +9 -9
  116. package/src/components/docs/generated/docs-index.feature-flags.json +217 -217
  117. package/src/components/docs/generated/docs-index.files.json +177 -177
  118. package/src/components/docs/generated/docs-index.generated.ts +20 -20
  119. package/src/components/docs/generated/docs-index.harness-lab.json +9 -9
  120. package/src/components/docs/generated/docs-index.health.json +97 -97
  121. package/src/components/docs/generated/docs-index.identity-rbac.json +313 -313
  122. package/src/components/docs/generated/docs-index.in-app-docs.json +9 -9
  123. package/src/components/docs/generated/docs-index.integration-hub.json +265 -265
  124. package/src/components/docs/generated/docs-index.integration-posthog.json +9 -9
  125. package/src/components/docs/generated/docs-index.integration-stripe.json +9 -9
  126. package/src/components/docs/generated/docs-index.integration-supabase.json +9 -9
  127. package/src/components/docs/generated/docs-index.jobs.json +137 -137
  128. package/src/components/docs/generated/docs-index.kb-update-pipeline.json +129 -129
  129. package/src/components/docs/generated/docs-index.knowledge-canon.json +9 -9
  130. package/src/components/docs/generated/docs-index.learning-journey-ambient-coach.json +9 -9
  131. package/src/components/docs/generated/docs-index.learning-journey-crm-onboarding.json +49 -49
  132. package/src/components/docs/generated/docs-index.learning-journey-duo-drills.json +9 -9
  133. package/src/components/docs/generated/docs-index.learning-journey-platform-tour.json +49 -49
  134. package/src/components/docs/generated/docs-index.learning-journey-quest-challenges.json +9 -9
  135. package/src/components/docs/generated/docs-index.learning-journey-registry.json +33 -33
  136. package/src/components/docs/generated/docs-index.learning-journey-studio-onboarding.json +49 -49
  137. package/src/components/docs/generated/docs-index.learning-journey-ui-coaching.json +9 -9
  138. package/src/components/docs/generated/docs-index.learning-journey-ui-gamified.json +9 -9
  139. package/src/components/docs/generated/docs-index.learning-journey-ui-onboarding.json +9 -9
  140. package/src/components/docs/generated/docs-index.learning-journey-ui-shared.json +9 -9
  141. package/src/components/docs/generated/docs-index.learning-journey.json +241 -217
  142. package/src/components/docs/generated/docs-index.learning-patterns.json +9 -9
  143. package/src/components/docs/generated/docs-index.lifecycle-cli.json +9 -9
  144. package/src/components/docs/generated/docs-index.lifecycle-dashboard.json +9 -9
  145. package/src/components/docs/generated/docs-index.locale-jurisdiction-gate.json +65 -57
  146. package/src/components/docs/generated/docs-index.manifest.json +432 -432
  147. package/src/components/docs/generated/docs-index.marketplace.json +337 -337
  148. package/src/components/docs/generated/docs-index.meeting-recorder-providers.json +9 -9
  149. package/src/components/docs/generated/docs-index.meeting-recorder.json +49 -49
  150. package/src/components/docs/generated/docs-index.messaging-agent-actions.json +17 -17
  151. package/src/components/docs/generated/docs-index.metrics.json +201 -201
  152. package/src/components/docs/generated/docs-index.minimal.json +17 -17
  153. package/src/components/docs/generated/docs-index.mobile-demo-tasks.json +33 -33
  154. package/src/components/docs/generated/docs-index.notifications.json +65 -65
  155. package/src/components/docs/generated/docs-index.openbanking-powens.json +9 -9
  156. package/src/components/docs/generated/docs-index.openbanking.json +65 -65
  157. package/src/components/docs/generated/docs-index.opencode-cli.json +17 -17
  158. package/src/components/docs/generated/docs-index.personalization.json +9 -9
  159. package/src/components/docs/generated/docs-index.platform-acp.json +137 -137
  160. package/src/components/docs/generated/docs-index.platform-agent.json +201 -185
  161. package/src/components/docs/generated/docs-index.platform-context.json +121 -105
  162. package/src/components/docs/generated/docs-index.platform-control-plane.json +321 -321
  163. package/src/components/docs/generated/docs-index.platform-database.json +89 -89
  164. package/src/components/docs/generated/docs-index.platform-docs.json +161 -153
  165. package/src/components/docs/generated/docs-index.platform-harness.json +177 -177
  166. package/src/components/docs/generated/docs-index.platform-integrations.json +329 -329
  167. package/src/components/docs/generated/docs-index.platform-knowledge.json +57 -57
  168. package/src/components/docs/generated/docs-index.platform-provider-ranking.json +217 -185
  169. package/src/components/docs/generated/docs-index.pocket-family-office.json +129 -129
  170. package/src/components/docs/generated/docs-index.policy-safe-knowledge-assistant.json +9 -9
  171. package/src/components/docs/generated/docs-index.product-intent.json +9 -9
  172. package/src/components/docs/generated/docs-index.project-management-sync.json +9 -9
  173. package/src/components/docs/generated/docs-index.saas-boilerplate.json +209 -209
  174. package/src/components/docs/generated/docs-index.service-business-os.json +193 -193
  175. package/src/components/docs/generated/docs-index.team-hub.json +185 -185
  176. package/src/components/docs/generated/docs-index.unknown.json +521 -521
  177. package/src/components/docs/generated/docs-index.versioned-knowledge-base.json +81 -81
  178. package/src/components/docs/generated/docs-index.video-api-showcase.json +33 -33
  179. package/src/components/docs/generated/docs-index.video-docs-terminal.json +9 -9
  180. package/src/components/docs/generated/docs-index.video-marketing-clip.json +9 -9
  181. package/src/components/docs/generated/docs-index.visualization-showcase.json +17 -17
  182. package/src/components/docs/generated/docs-index.voice-providers.json +9 -9
  183. package/src/components/docs/generated/docs-index.wealth-snapshot.json +153 -153
  184. package/src/components/docs/generated/docs-index.workflow-system.json +433 -433
  185. package/src/components/docs/generated/docs-index.workspace-cli.json +9 -9
  186. package/src/components/docs/getting-started/CLIPage.tsx +10 -2
  187. package/src/components/docs/getting-started/DataViewTutorialPage.tsx +63 -70
  188. package/src/components/docs/getting-started/StartHerePage.tsx +10 -9
  189. package/src/components/docs/guides/GuideConnectInRepoPage.tsx +52 -3
  190. package/src/components/docs/guides/GuideHostBuilderWorkbenchPage.tsx +55 -6
  191. package/src/components/docs/guides/GuideReleaseCapsulesPage.tsx +147 -0
  192. package/src/components/docs/guides/GuidesIndexPage.tsx +7 -0
  193. package/src/components/docs/guides/index.ts +1 -0
  194. package/src/components/docs/libraries/LibrariesContractsPage.tsx +72 -27
  195. package/src/components/docs/libraries/LibrariesDesignSystemPage.tsx +67 -61
  196. package/src/components/docs/libraries/LibrariesOverviewPage.tsx +7 -1
  197. package/src/components/docs/libraries/LibrariesUIKitPage.tsx +63 -25
  198. package/src/components/docs/libraries/LibrariesUIKitWebPage.tsx +115 -0
  199. package/src/components/docs/libraries/index.ts +1 -0
  200. package/src/components/docs/specs/SpecsBuilderControlPlanePage.tsx +58 -3
  201. package/src/components/docs/specs/SpecsConnectPage.tsx +30 -0
  202. package/src/components/docs/specs/SpecsDataViewsPage.tsx +63 -42
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{CodeBlock as de,InstallCommand as Ke}from"@contractspec/lib.design-system";import pe from"@contractspec/lib.ui-link";import{ChevronRight as Ze}from"lucide-react";import{jsx as c,jsxs as g}from"react/jsx-runtime";function Je(){return g("div",{className:"space-y-8",children:[g("div",{className:"space-y-4",children:[c("h1",{className:"font-bold text-4xl",children:"@contractspec/lib.accessibility"}),c("p",{className:"text-muted-foreground",children:"Stable exports of accessibility primitives for LSSM web apps, ensuring WCAG compliance and inclusive design."})]}),g("div",{className:"space-y-4",children:[c("h2",{className:"font-bold text-2xl",children:"Installation"}),c(Ke,{package:"@contractspec/lib.accessibility"})]}),g("div",{className:"space-y-4",children:[c("h2",{className:"font-bold text-2xl",children:"Exports"}),g("ul",{className:"space-y-2 text-muted-foreground",children:[g("li",{children:[c("code",{className:"rounded bg-background/50 px-2 py-1",children:"SkipLink"}),": A link to skip navigation, visible on focus"]}),g("li",{children:[c("code",{className:"rounded bg-background/50 px-2 py-1",children:"VisuallyHidden"}),": Hide content visually but keep it for screen readers"]}),g("li",{children:[c("code",{className:"rounded bg-background/50 px-2 py-1",children:"SRLiveRegionProvider"}),","," ",c("code",{className:"rounded bg-background/50 px-2 py-1",children:"useSRLiveRegion"}),": Manage live region announcements"]}),g("li",{children:[c("code",{className:"rounded bg-background/50 px-2 py-1",children:"RouteAnnouncer"}),": Announce page title/path changes on navigation"]}),g("li",{children:[c("code",{className:"rounded bg-background/50 px-2 py-1",children:"FocusOnRouteChange"}),": Reset focus to body or main content on navigation"]}),g("li",{children:[c("code",{className:"rounded bg-background/50 px-2 py-1",children:"useReducedMotion"}),": Detect if the user prefers reduced motion"]})]})]}),g("div",{className:"space-y-4",children:[c("h2",{className:"font-bold text-2xl",children:"Example: App Setup"}),c(de,{language:"tsx",code:`import {
2
+ import{CodeBlock as fe,InstallCommand as Ze}from"@contractspec/lib.design-system";import he from"@contractspec/lib.ui-link";import{ChevronRight as Xe}from"lucide-react";import{jsx as c,jsxs as g}from"react/jsx-runtime";function $e(){return g("div",{className:"space-y-8",children:[g("div",{className:"space-y-4",children:[c("h1",{className:"font-bold text-4xl",children:"@contractspec/lib.accessibility"}),c("p",{className:"text-muted-foreground",children:"Stable exports of accessibility primitives for LSSM web apps, ensuring WCAG compliance and inclusive design."})]}),g("div",{className:"space-y-4",children:[c("h2",{className:"font-bold text-2xl",children:"Installation"}),c(Ze,{package:"@contractspec/lib.accessibility"})]}),g("div",{className:"space-y-4",children:[c("h2",{className:"font-bold text-2xl",children:"Exports"}),g("ul",{className:"space-y-2 text-muted-foreground",children:[g("li",{children:[c("code",{className:"rounded bg-background/50 px-2 py-1",children:"SkipLink"}),": A link to skip navigation, visible on focus"]}),g("li",{children:[c("code",{className:"rounded bg-background/50 px-2 py-1",children:"VisuallyHidden"}),": Hide content visually but keep it for screen readers"]}),g("li",{children:[c("code",{className:"rounded bg-background/50 px-2 py-1",children:"SRLiveRegionProvider"}),","," ",c("code",{className:"rounded bg-background/50 px-2 py-1",children:"useSRLiveRegion"}),": Manage live region announcements"]}),g("li",{children:[c("code",{className:"rounded bg-background/50 px-2 py-1",children:"RouteAnnouncer"}),": Announce page title/path changes on navigation"]}),g("li",{children:[c("code",{className:"rounded bg-background/50 px-2 py-1",children:"FocusOnRouteChange"}),": Reset focus to body or main content on navigation"]}),g("li",{children:[c("code",{className:"rounded bg-background/50 px-2 py-1",children:"useReducedMotion"}),": Detect if the user prefers reduced motion"]})]})]}),g("div",{className:"space-y-4",children:[c("h2",{className:"font-bold text-2xl",children:"Example: App Setup"}),c(fe,{language:"tsx",code:`import {
3
3
  SRLiveRegionProvider,
4
4
  RouteAnnouncer,
5
5
  SkipLink
@@ -19,7 +19,7 @@ export function RootLayout({ children }) {
19
19
  </body>
20
20
  </html>
21
21
  );
22
- }`})]}),g("div",{className:"space-y-4",children:[c("h2",{className:"font-bold text-2xl",children:"Example: Live Announcements"}),c(de,{language:"tsx",code:`import { useSRLiveRegion } from '@contractspec/lib.accessibility';
22
+ }`})]}),g("div",{className:"space-y-4",children:[c("h2",{className:"font-bold text-2xl",children:"Example: Live Announcements"}),c(fe,{language:"tsx",code:`import { useSRLiveRegion } from '@contractspec/lib.accessibility';
23
23
 
24
24
  export function TodoList() {
25
25
  const { announce } = useSRLiveRegion();
@@ -30,7 +30,7 @@ export function TodoList() {
30
30
  };
31
31
 
32
32
  return <button onClick={addTodo}>Add Todo</button>;
33
- }`})]}),g("div",{className:"space-y-4",children:[c("h2",{className:"font-bold text-2xl",children:"WCAG Compliance"}),g("p",{className:"text-muted-foreground",children:["These components map directly to WCAG 2.1 Level AA requirements documented in ",c("code",{children:"docs/accessibility_wcag_compliance_specs.md"}),":"]}),g("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[c("li",{children:"2.4.1 Bypass Blocks (SkipLink)"}),c("li",{children:"4.1.3 Status Messages (LiveRegion)"}),c("li",{children:"2.4.3 Focus Order (FocusOnRouteChange)"}),c("li",{children:"2.3.3 Animation from Interactions (useReducedMotion)"})]})]}),g("div",{className:"flex items-center gap-4 pt-4",children:[c(pe,{href:"/docs/libraries/design-system",className:"btn-ghost",children:"Previous: Design System"}),g(pe,{href:"/docs/libraries",className:"btn-primary",children:["Back to Libraries ",c(Ze,{size:16})]})]})]})}import{CodeBlock as me,InstallCommand as Ye}from"@contractspec/lib.design-system";import ue from"@contractspec/lib.ui-link";import{ChevronRight as Xe}from"lucide-react";import{jsx as f,jsxs as z}from"react/jsx-runtime";function $e(){return z("div",{className:"space-y-8",children:[z("div",{className:"space-y-4",children:[f("h1",{className:"font-bold text-4xl",children:"@contractspec/lib.ai-agent"}),f("p",{className:"text-lg text-muted-foreground",children:"Define AI agents in TypeScript, run them with deterministic tool calling, capture working memory, and route low-confidence decisions to human reviewers."})]}),z("div",{className:"space-y-4",children:[f("h2",{className:"font-bold text-2xl",children:"Installation"}),f(Ye,{package:"@contractspec/lib.ai-agent"})]}),z("div",{className:"space-y-3",children:[f("h2",{className:"font-bold text-2xl",children:"Define & register"}),f(me,{language:"typescript",code:`import { defineAgent, AgentRegistry } from '@contractspec/lib.contracts-spec/agent';
33
+ }`})]}),g("div",{className:"space-y-4",children:[c("h2",{className:"font-bold text-2xl",children:"WCAG Compliance"}),g("p",{className:"text-muted-foreground",children:["These components map directly to WCAG 2.1 Level AA requirements documented in ",c("code",{children:"docs/accessibility_wcag_compliance_specs.md"}),":"]}),g("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[c("li",{children:"2.4.1 Bypass Blocks (SkipLink)"}),c("li",{children:"4.1.3 Status Messages (LiveRegion)"}),c("li",{children:"2.4.3 Focus Order (FocusOnRouteChange)"}),c("li",{children:"2.3.3 Animation from Interactions (useReducedMotion)"})]})]}),g("div",{className:"flex items-center gap-4 pt-4",children:[c(he,{href:"/docs/libraries/design-system",className:"btn-ghost",children:"Previous: Design System"}),g(he,{href:"/docs/libraries",className:"btn-primary",children:["Back to Libraries ",c(Xe,{size:16})]})]})]})}import{CodeBlock as be,InstallCommand as Ye}from"@contractspec/lib.design-system";import ve from"@contractspec/lib.ui-link";import{ChevronRight as xe}from"lucide-react";import{jsx as f,jsxs as M}from"react/jsx-runtime";function je(){return M("div",{className:"space-y-8",children:[M("div",{className:"space-y-4",children:[f("h1",{className:"font-bold text-4xl",children:"@contractspec/lib.ai-agent"}),f("p",{className:"text-lg text-muted-foreground",children:"Define AI agents in TypeScript, run them with deterministic tool calling, capture working memory, and route low-confidence decisions to human reviewers."})]}),M("div",{className:"space-y-4",children:[f("h2",{className:"font-bold text-2xl",children:"Installation"}),f(Ye,{package:"@contractspec/lib.ai-agent"})]}),M("div",{className:"space-y-3",children:[f("h2",{className:"font-bold text-2xl",children:"Define & register"}),f(be,{language:"typescript",code:`import { defineAgent, AgentRegistry } from '@contractspec/lib.contracts-spec/agent';
34
34
 
35
35
  const SupportBot = defineAgent({
36
36
  meta: {
@@ -49,7 +49,7 @@ const SupportBot = defineAgent({
49
49
  },
50
50
  });
51
51
 
52
- const registry = new AgentRegistry().register(SupportBot);`})]}),z("div",{className:"space-y-3",children:[f("h2",{className:"font-bold text-2xl",children:"Run with approvals"}),f(me,{language:"typescript",code:`import { createUnifiedAgent, ApprovalWorkflow } from '@contractspec/lib.ai-agent';
52
+ const registry = new AgentRegistry().register(SupportBot);`})]}),M("div",{className:"space-y-3",children:[f("h2",{className:"font-bold text-2xl",children:"Run with approvals"}),f(be,{language:"typescript",code:`import { createUnifiedAgent, ApprovalWorkflow } from '@contractspec/lib.ai-agent';
53
53
 
54
54
  const approvals = new ApprovalWorkflow();
55
55
  const agent = createUnifiedAgent(SupportBot, {
@@ -59,7 +59,7 @@ const agent = createUnifiedAgent(SupportBot, {
59
59
 
60
60
  const result = await agent.run(ticket.body);
61
61
  // Route low-confidence or manual-review flows through approvals when needed.
62
- `})]}),z("div",{className:"space-y-3",children:[f("h2",{className:"font-bold text-2xl",children:"What's inside"}),z("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[z("li",{children:[f("code",{children:"createUnifiedAgent"}),", ",f("code",{children:"ContractSpecAgent"}),","," ",f("code",{children:"UnifiedAgent"})]}),f("li",{children:"MCP, operation-backed, memory, and subagent tool adapters"}),z("li",{children:[f("code",{children:"InMemoryAgentMemory"})," plus interfaces for custom stores"]}),z("li",{children:[f("code",{children:"ApprovalWorkflow"})," + ",f("code",{children:"ApprovalStore"})," for human-in-the-loop reviews"]})]})]}),z("div",{className:"flex items-center gap-4 pt-4",children:[f(ue,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),z(ue,{href:"/docs/libraries/support-bot",className:"btn-primary",children:["Next: Support Bot ",f(Xe,{size:16})]})]})]})}import{CodeBlock as oe,InstallCommand as xe}from"@contractspec/lib.design-system";import{jsx as G,jsxs as ee}from"react/jsx-runtime";function je(){return ee("div",{className:"space-y-8",children:[ee("div",{className:"space-y-4",children:[G("h1",{className:"font-bold text-4xl",children:"@contractspec/lib.analytics"}),G("p",{className:"text-lg text-muted-foreground",children:"Work directly with telemetry events to understand conversion, retention, churn, and growth opportunities."})]}),ee("div",{className:"space-y-4",children:[G("h2",{className:"font-bold text-2xl",children:"Installation"}),G(xe,{package:"@contractspec/lib.analytics"})]}),ee("div",{className:"space-y-3",children:[G("h2",{className:"font-bold text-2xl",children:"Funnels in memory"}),G(oe,{language:"typescript",code:`import { FunnelAnalyzer } from '@contractspec/lib.analytics/funnel';
62
+ `})]}),M("div",{className:"space-y-3",children:[f("h2",{className:"font-bold text-2xl",children:"What's inside"}),M("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[M("li",{children:[f("code",{children:"createUnifiedAgent"}),", ",f("code",{children:"ContractSpecAgent"}),","," ",f("code",{children:"UnifiedAgent"})]}),f("li",{children:"MCP, operation-backed, memory, and subagent tool adapters"}),M("li",{children:[f("code",{children:"InMemoryAgentMemory"})," plus interfaces for custom stores"]}),M("li",{children:[f("code",{children:"ApprovalWorkflow"})," + ",f("code",{children:"ApprovalStore"})," for human-in-the-loop reviews"]})]})]}),M("div",{className:"flex items-center gap-4 pt-4",children:[f(ve,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),M(ve,{href:"/docs/libraries/support-bot",className:"btn-primary",children:["Next: Support Bot ",f(xe,{size:16})]})]})]})}import{CodeBlock as re,InstallCommand as et}from"@contractspec/lib.design-system";import{jsx as F,jsxs as ae}from"react/jsx-runtime";function tt(){return ae("div",{className:"space-y-8",children:[ae("div",{className:"space-y-4",children:[F("h1",{className:"font-bold text-4xl",children:"@contractspec/lib.analytics"}),F("p",{className:"text-lg text-muted-foreground",children:"Work directly with telemetry events to understand conversion, retention, churn, and growth opportunities."})]}),ae("div",{className:"space-y-4",children:[F("h2",{className:"font-bold text-2xl",children:"Installation"}),F(et,{package:"@contractspec/lib.analytics"})]}),ae("div",{className:"space-y-3",children:[F("h2",{className:"font-bold text-2xl",children:"Funnels in memory"}),F(re,{language:"typescript",code:`import { FunnelAnalyzer } from '@contractspec/lib.analytics/funnel';
63
63
 
64
64
  const analyzer = new FunnelAnalyzer();
65
65
  const report = analyzer.analyze(events, {
@@ -69,16 +69,16 @@ const report = analyzer.analyze(events, {
69
69
  { id: 'submit', eventName: 'signup.submit' },
70
70
  { id: 'verified', eventName: 'account.verified' },
71
71
  ],
72
- });`})]}),ee("div",{className:"space-y-3",children:[G("h2",{className:"font-bold text-2xl",children:"Cohorts & churn"}),G(oe,{language:"typescript",code:`import { CohortTracker } from '@contractspec/lib.analytics/cohort';
72
+ });`})]}),ae("div",{className:"space-y-3",children:[F("h2",{className:"font-bold text-2xl",children:"Cohorts & churn"}),F(re,{language:"typescript",code:`import { CohortTracker } from '@contractspec/lib.analytics/cohort';
73
73
  import { ChurnPredictor } from '@contractspec/lib.analytics/churn';
74
74
 
75
75
  const cohorts = new CohortTracker().analyze(events, { bucket: 'week', periods: 8 });
76
- const churn = new ChurnPredictor().score(events);`})]}),ee("div",{className:"space-y-3",children:[G("h2",{className:"font-bold text-2xl",children:"Growth hypotheses"}),G(oe,{language:"typescript",code:`import { GrowthHypothesisGenerator } from '@contractspec/lib.analytics/growth';
76
+ const churn = new ChurnPredictor().score(events);`})]}),ae("div",{className:"space-y-3",children:[F("h2",{className:"font-bold text-2xl",children:"Growth hypotheses"}),F(re,{language:"typescript",code:`import { GrowthHypothesisGenerator } from '@contractspec/lib.analytics/growth';
77
77
 
78
78
  const ideas = new GrowthHypothesisGenerator().generate([
79
79
  { name: 'Activation rate', current: 0.42, previous: 0.55, target: 0.6 },
80
80
  { name: 'Expansion ARPU', current: 1.2, previous: 0.9 },
81
- ]);`})]})]})}import{CodeBlock as et,InstallCommand as tt}from"@contractspec/lib.design-system";import ge from"@contractspec/lib.ui-link";import{ChevronRight as at}from"lucide-react";import{jsx as A,jsxs as J}from"react/jsx-runtime";function ot(){return J("div",{className:"space-y-8",children:[J("div",{className:"space-y-4",children:[A("h1",{className:"font-bold text-4xl",children:"@contractspec/lib.content-gen"}),A("p",{className:"text-lg text-muted-foreground",children:"Feed a single ContentBrief and produce cohesive marketing assets without touching a CMS."})]}),J("div",{className:"space-y-4",children:[A("h2",{className:"font-bold text-2xl",children:"Installation"}),A(tt,{package:"@contractspec/lib.content-gen"})]}),J("div",{className:"space-y-3",children:[A("h2",{className:"font-bold text-2xl",children:"One brief, many assets"}),A(et,{language:"typescript",code:`import {
81
+ ]);`})]})]})}import{CodeBlock as at,InstallCommand as ot}from"@contractspec/lib.design-system";import ye from"@contractspec/lib.ui-link";import{ChevronRight as it}from"lucide-react";import{jsx as A,jsxs as $}from"react/jsx-runtime";function rt(){return $("div",{className:"space-y-8",children:[$("div",{className:"space-y-4",children:[A("h1",{className:"font-bold text-4xl",children:"@contractspec/lib.content-gen"}),A("p",{className:"text-lg text-muted-foreground",children:"Feed a single ContentBrief and produce cohesive marketing assets without touching a CMS."})]}),$("div",{className:"space-y-4",children:[A("h2",{className:"font-bold text-2xl",children:"Installation"}),A(ot,{package:"@contractspec/lib.content-gen"})]}),$("div",{className:"space-y-3",children:[A("h2",{className:"font-bold text-2xl",children:"One brief, many assets"}),A(at,{language:"typescript",code:`import {
82
82
  BlogGenerator,
83
83
  LandingPageGenerator,
84
84
  EmailCampaignGenerator,
@@ -98,29 +98,54 @@ const blog = await new BlogGenerator().generate(brief);
98
98
  const landing = await new LandingPageGenerator().generate(brief);
99
99
  const email = await new EmailCampaignGenerator().generate({ brief, variant: 'announcement' });
100
100
  const social = await new SocialPostGenerator().generate(brief);
101
- const seo = new SeoOptimizer().optimize(brief);`})]}),J("div",{className:"space-y-3",children:[A("h2",{className:"font-bold text-2xl",children:"When to use"}),J("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[A("li",{children:"Ship landing page refreshes whenever specs change."}),A("li",{children:"Automate release emails + nurture sequences per vertical."}),A("li",{children:"Create social snippets that stay on-message with the same brief."}),A("li",{children:"Generate SEO metadata + Schema.org markup alongside content."})]})]}),J("div",{className:"flex items-center gap-4 pt-4",children:[A(ge,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),J(ge,{href:"/docs/libraries/support-bot",className:"btn-primary",children:["Next: Support Bot ",A(at,{size:16})]})]})]})}import{CodeBlock as it,InstallCommand as rt}from"@contractspec/lib.design-system";import fe from"@contractspec/lib.ui-link";import{ChevronRight as nt}from"lucide-react";import{jsx as o,jsxs as i}from"react/jsx-runtime";function ct(){return i("div",{className:"space-y-8",children:[i("div",{className:"space-y-4",children:[o("h1",{className:"font-bold text-4xl",children:"@contractspec/lib.contracts-spec"}),o("p",{className:"text-lg text-muted-foreground",children:"The core library for defining what your application can do. Unified specifications for Operations, Events, Presentations, and Features."})]}),i("div",{className:"space-y-4",children:[o("h2",{className:"font-bold text-2xl",children:"Installation"}),o(rt,{package:["@contractspec/lib.contracts-spec","@contractspec/lib.schema"]})]}),i("div",{className:"space-y-4",children:[o("h2",{className:"font-bold text-2xl",children:"What lives where"}),i("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[i("li",{children:[o("strong",{children:"@contractspec/lib.contracts-spec"})," (root): The core contracts definitions (OperationSpec, PresentationSpec, Registry)."]}),i("li",{children:[o("strong",{children:"@contractspec/lib.contracts-runtime-client-react"}),": Browser-safe helpers (React renderers, client SDK). Import this for web/React Native."]}),i("li",{children:[o("strong",{children:"@contractspec/lib.contracts-runtime-server-rest"}),": HTTP/MCP adapters, registries, integrations (Node-only)."]}),i("li",{children:[o("strong",{children:"@contractspec/lib.schema"}),": Schema dictionary (SchemaModel, FieldType) for I/O definitions."]})]})]}),i("div",{className:"space-y-4",children:[o("h2",{className:"font-bold text-2xl",children:"Quick Example"}),o(it,{language:"typescript",code:`import { defineCommand } from '@contractspec/lib.contracts-spec';
102
- import { SchemaModel, ScalarTypeEnum } from '@contractspec/lib.schema';
101
+ const seo = new SeoOptimizer().optimize(brief);`})]}),$("div",{className:"space-y-3",children:[A("h2",{className:"font-bold text-2xl",children:"When to use"}),$("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[A("li",{children:"Ship landing page refreshes whenever specs change."}),A("li",{children:"Automate release emails + nurture sequences per vertical."}),A("li",{children:"Create social snippets that stay on-message with the same brief."}),A("li",{children:"Generate SEO metadata + Schema.org markup alongside content."})]})]}),$("div",{className:"flex items-center gap-4 pt-4",children:[A(ye,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),$(ye,{href:"/docs/libraries/support-bot",className:"btn-primary",children:["Next: Support Bot ",A(it,{size:16})]})]})]})}import{CodeBlock as nt,InstallCommand as ct}from"@contractspec/lib.design-system";import ne from"@contractspec/lib.ui-link";import{ChevronRight as lt}from"lucide-react";import{jsx as a,jsxs as o}from"react/jsx-runtime";var st=`import { defineDataView } from '@contractspec/lib.contracts-spec/data-views';
102
+ import { ListDataGridShowcaseRowsQuery } from '@contractspec/example.data-grid-showcase/contracts/data-grid-showcase.operation';
103
103
 
104
- const CreateUserInput = new SchemaModel({
105
- name: 'CreateUserInput',
106
- fields: {
107
- email: { type: ScalarTypeEnum.Email(), isOptional: false },
108
- name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
109
- },
110
- });
111
-
112
- export const CreateUser = defineCommand({
104
+ export const DataGridShowcaseDataView = defineDataView({
113
105
  meta: {
114
- key: 'users.createUser',
106
+ key: 'examples.data-grid-showcase.table',
115
107
  version: '1.0.0',
116
- description: 'Create a new user account',
108
+ entity: 'account',
109
+ title: 'Data Grid Showcase Table',
110
+ description:
111
+ 'Declarative DataViewSpec for the ContractSpec table showcase.',
112
+ domain: 'examples',
113
+ owners: ['@platform.core'],
114
+ tags: ['examples', 'table', 'data-grid'],
115
+ stability: 'experimental',
117
116
  },
118
- io: {
119
- input: CreateUserInput,
120
- output: /* ... */,
117
+ source: {
118
+ primary: {
119
+ key: ListDataGridShowcaseRowsQuery.meta.key,
120
+ version: ListDataGridShowcaseRowsQuery.meta.version,
121
+ },
122
+ },
123
+ view: {
124
+ kind: 'table',
125
+ executionMode: 'client',
126
+ selection: 'multiple',
127
+ columnVisibility: true,
128
+ columnResizing: true,
129
+ columnPinning: true,
130
+ rowExpansion: {
131
+ fields: ['notes', 'renewalDate', 'lastActivityAt'],
132
+ },
133
+ initialState: {
134
+ pageSize: 4,
135
+ hiddenColumns: ['notes'],
136
+ pinnedColumns: {
137
+ left: ['account'],
138
+ },
139
+ sorting: [{ field: 'arr', desc: true }],
140
+ },
141
+ fields: [
142
+ { key: 'account', label: 'Account', dataPath: 'account', sortable: true },
143
+ { key: 'owner', label: 'Owner', dataPath: 'owner', sortable: true },
144
+ { key: 'status', label: 'Status', dataPath: 'status', sortable: true },
145
+ { key: 'notes', label: 'Notes', dataPath: 'notes' },
146
+ ],
121
147
  },
122
- policy: { auth: 'admin' },
123
- });`})]}),i("div",{className:"space-y-4",children:[o("h2",{className:"font-bold text-2xl",children:"Core Concepts"}),i("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[i("li",{children:[o("strong",{children:"OperationSpec"}),": Immutable description of an operation (Command or Query). Defines I/O, policy, and metadata."]}),i("li",{children:[o("strong",{children:"OperationSpecRegistry"}),": Registry of specs + handlers. Use ",o("code",{className:"font-mono text-xs",children:"installOp"})," ","to attach a handler."]}),i("li",{children:[o("strong",{children:"CapabilitySpec"}),": Canonical capability declaration (requires/provides)."]}),i("li",{children:[o("strong",{children:"PolicySpec"}),": Declarative policy rules (ABAC/ReBAC, rate limits)."]}),i("li",{children:[o("strong",{children:"TelemetrySpec"}),": Analytics definitions and privacy levels."]}),i("li",{children:[o("strong",{children:"PresentationSpec (V2)"}),": Describes how data is rendered (Web Components, Markdown, Data)."]})]})]}),i("div",{className:"space-y-4",children:[o("h2",{className:"font-bold text-2xl",children:"Lifecycle"}),i("ol",{className:"list-inside list-decimal space-y-2 text-muted-foreground",children:[i("li",{children:[o("strong",{children:"Define"})," the spec (I/O via SchemaModel or Zod)."]}),i("li",{children:[o("strong",{children:"Register"})," it:"," ",o("code",{className:"font-mono text-xs",children:"installOp(registry, spec, handler)"}),"."]}),i("li",{children:[o("strong",{children:"Expose"})," it via an adapter (REST, GraphQL, MCP)."]}),i("li",{children:[o("strong",{children:"Validate"})," at runtime automatically."]})]})]}),i("div",{className:"space-y-4",children:[o("h2",{className:"font-bold text-2xl",children:"Adapters"}),i("ul",{className:"space-y-2 text-muted-foreground",children:[i("li",{children:[o("code",{className:"rounded bg-background/50 px-2 py-1",children:"server/rest-next-app"}),": Next.js App Router adapter"]}),i("li",{children:[o("code",{className:"rounded bg-background/50 px-2 py-1",children:"server/provider-mcp"}),": Model Context Protocol (MCP) for AI agents"]}),i("li",{children:[o("code",{className:"rounded bg-background/50 px-2 py-1",children:"server/graphql-pothos"}),": GraphQL schema generator"]})]})]}),i("div",{className:"flex items-center gap-4 pt-4",children:[i(fe,{href:"/docs/libraries/schema",className:"btn-primary",children:["Next: Schema ",o(nt,{size:16})]}),o(fe,{href:"/docs/specs/capabilities",className:"btn-ghost",children:"Core Concepts"})]})]})}import{CodeBlock as he,InstallCommand as lt}from"@contractspec/lib.design-system";import be from"@contractspec/lib.ui-link";import{ChevronRight as st}from"lucide-react";import{jsx as M,jsxs as F}from"react/jsx-runtime";function dt(){return F("div",{className:"space-y-8",children:[F("div",{className:"space-y-4",children:[M("h1",{className:"font-bold text-4xl",children:"Cost Tracking Library"}),F("p",{className:"text-lg text-muted-foreground",children:[M("code",{children:"@contractspec/lib.cost-tracking"})," transforms raw telemetry into dollars: DB/API/compute costs per operation, budget alerts per tenant, and actionable optimization tips."]})]}),F("div",{className:"space-y-4",children:[M("h2",{className:"font-bold text-2xl",children:"Installation"}),M(lt,{package:"@contractspec/lib.cost-tracking"})]}),F("div",{className:"space-y-4",children:[M("h2",{className:"font-bold text-2xl",children:"Record Samples"}),M(he,{language:"typescript",code:`const tracker = new CostTracker();
148
+ });`;function dt(){return o("div",{className:"space-y-8",children:[o("div",{className:"space-y-4",children:[a("h1",{className:"font-bold text-4xl",children:"@contractspec/lib.contracts-spec"}),a("p",{className:"text-lg text-muted-foreground",children:"The core library for defining what your application can do. Unified specifications for Operations, Events, Presentations, and Features."})]}),o("div",{className:"space-y-4",children:[a("h2",{className:"font-bold text-2xl",children:"Installation"}),a(ct,{package:["@contractspec/lib.contracts-spec","@contractspec/lib.schema"]})]}),o("div",{className:"space-y-4",children:[a("h2",{className:"font-bold text-2xl",children:"What lives where"}),o("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[o("li",{children:[a("strong",{children:"@contractspec/lib.contracts-spec"})," (root): The core contracts definitions (OperationSpec, PresentationSpec, Registry)."]}),o("li",{children:[a("strong",{children:"@contractspec/lib.contracts-runtime-client-react"}),": Browser-safe helpers (React renderers, client SDK). Import this for web/React Native."]}),o("li",{children:[a("strong",{children:"@contractspec/lib.contracts-runtime-server-rest"}),": HTTP/MCP adapters, registries, integrations (Node-only)."]}),o("li",{children:[a("strong",{children:"@contractspec/lib.schema"}),": Schema dictionary (SchemaModel, FieldType) for I/O definitions."]})]})]}),o("div",{className:"space-y-4",children:[a("h2",{className:"font-bold text-2xl",children:"Data table contract example"}),o("p",{className:"text-muted-foreground",children:["The canonical account-grid example starts here in"," ",a("code",{children:"@contractspec/lib.contracts-spec"}),". The contract declares table execution mode, selection, pinning, resizing, row expansion, and initial state before any renderer is chosen."]}),a(nt,{language:"typescript",code:st}),o("p",{className:"text-muted-foreground text-sm",children:["See the live version in"," ",a(ne,{href:"/docs/examples/data-grid-showcase",className:"text-[color:var(--rust)] underline underline-offset-4",children:"/docs/examples/data-grid-showcase"}),"."]})]}),o("div",{className:"space-y-4",children:[a("h2",{className:"font-bold text-2xl",children:"Core Concepts"}),o("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[o("li",{children:[a("strong",{children:"OperationSpec"}),": Immutable description of an operation (Command or Query). Defines I/O, policy, and metadata."]}),o("li",{children:[a("strong",{children:"OperationSpecRegistry"}),": Registry of specs + handlers. Use ",a("code",{className:"font-mono text-xs",children:"installOp"})," ","to attach a handler."]}),o("li",{children:[a("strong",{children:"CapabilitySpec"}),": Canonical capability declaration (requires/provides)."]}),o("li",{children:[a("strong",{children:"PolicySpec"}),": Declarative policy rules (ABAC/ReBAC, rate limits)."]}),o("li",{children:[a("strong",{children:"TelemetrySpec"}),": Analytics definitions and privacy levels."]}),o("li",{children:[a("strong",{children:"PresentationSpec (V2)"}),": Describes how data is rendered (Web Components, Markdown, Data)."]}),o("li",{children:[a("strong",{children:"DataViewSpec"}),": Declarative list, table, grid, and detail contracts that the table showcase uses as its canonical account-grid example."]})]})]}),o("div",{className:"space-y-4",children:[a("h2",{className:"font-bold text-2xl",children:"Lifecycle"}),o("ol",{className:"list-inside list-decimal space-y-2 text-muted-foreground",children:[o("li",{children:[a("strong",{children:"Define"})," the spec (I/O via SchemaModel or Zod)."]}),o("li",{children:[a("strong",{children:"Register"})," it:"," ",a("code",{className:"font-mono text-xs",children:"installOp(registry, spec, handler)"}),"."]}),o("li",{children:[a("strong",{children:"Expose"})," it via an adapter (REST, GraphQL, MCP)."]}),o("li",{children:[a("strong",{children:"Validate"})," at runtime automatically."]})]})]}),o("div",{className:"space-y-4",children:[a("h2",{className:"font-bold text-2xl",children:"Adapters"}),o("ul",{className:"space-y-2 text-muted-foreground",children:[o("li",{children:[a("code",{className:"rounded bg-background/50 px-2 py-1",children:"server/rest-next-app"}),": Next.js App Router adapter"]}),o("li",{children:[a("code",{className:"rounded bg-background/50 px-2 py-1",children:"server/provider-mcp"}),": Model Context Protocol (MCP) for AI agents"]}),o("li",{children:[a("code",{className:"rounded bg-background/50 px-2 py-1",children:"server/graphql-pothos"}),": GraphQL schema generator"]})]})]}),o("div",{className:"flex items-center gap-4 pt-4",children:[o(ne,{href:"/docs/libraries/schema",className:"btn-primary",children:["Next: Schema ",a(lt,{size:16})]}),a(ne,{href:"/docs/specs/capabilities",className:"btn-ghost",children:"Core Concepts"})]})]})}import{CodeBlock as Ne,InstallCommand as pt}from"@contractspec/lib.design-system";import we from"@contractspec/lib.ui-link";import{ChevronRight as mt}from"lucide-react";import{jsx as z,jsxs as _}from"react/jsx-runtime";function ut(){return _("div",{className:"space-y-8",children:[_("div",{className:"space-y-4",children:[z("h1",{className:"font-bold text-4xl",children:"Cost Tracking Library"}),_("p",{className:"text-lg text-muted-foreground",children:[z("code",{children:"@contractspec/lib.cost-tracking"})," transforms raw telemetry into dollars: DB/API/compute costs per operation, budget alerts per tenant, and actionable optimization tips."]})]}),_("div",{className:"space-y-4",children:[z("h2",{className:"font-bold text-2xl",children:"Installation"}),z(pt,{package:"@contractspec/lib.cost-tracking"})]}),_("div",{className:"space-y-4",children:[z("h2",{className:"font-bold text-2xl",children:"Record Samples"}),z(Ne,{language:"typescript",code:`const tracker = new CostTracker();
124
149
  tracker.recordSample({
125
150
  operation: 'orders.list',
126
151
  tenantId: 'acme',
@@ -128,12 +153,12 @@ tracker.recordSample({
128
153
  dbWrites: 4,
129
154
  computeMs: 180,
130
155
  externalCalls: [{ provider: 'stripe', cost: 0.02 }],
131
- });`})]}),F("div",{className:"space-y-4",children:[M("h2",{className:"font-bold text-2xl",children:"Budget Alerts"}),M(he,{language:"typescript",code:`const budgets = new BudgetAlertManager({
156
+ });`})]}),_("div",{className:"space-y-4",children:[z("h2",{className:"font-bold text-2xl",children:"Budget Alerts"}),z(Ne,{language:"typescript",code:`const budgets = new BudgetAlertManager({
132
157
  budgets: [{ tenantId: 'acme', monthlyLimit: 150 }],
133
158
  onAlert: ({ tenantId, total }) => notifyFinance(tenantId, total),
134
159
  });
135
160
 
136
- tracker.getTotals({ tenantId: 'acme' }).forEach((summary) => budgets.track(summary));`})]}),F("div",{className:"space-y-4",children:[M("h2",{className:"font-bold text-2xl",children:"Optimization Suggestions"}),F("p",{className:"text-muted-foreground text-sm",children:["Feed summaries into ",M("code",{children:"OptimizationRecommender"})," to surface N+1 queries, compute-heavy steps, or expensive external calls. Store the generated suggestions in the new Prisma model to power Ops playbooks."]})]}),F("div",{className:"flex items-center gap-4 pt-4",children:[M(be,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),F(be,{href:"/docs/libraries/slo",className:"btn-primary",children:["Next: SLO ",M(st,{size:16})]})]})]})}import{CodeBlock as pt}from"@contractspec/lib.design-system";import ve from"@contractspec/lib.ui-link";import{ChevronRight as mt}from"lucide-react";import{jsx as h,jsxs as b}from"react/jsx-runtime";function ut(){return b("div",{className:"space-y-8",children:[b("div",{className:"space-y-4",children:[h("h1",{className:"font-bold text-4xl",children:"Data & Backend"}),h("p",{className:"text-muted-foreground",children:"A collection of robust, platform-agnostic libraries for building the backend infrastructure of your LSSM applications."})]}),b("div",{className:"space-y-4",children:[h("h2",{className:"font-bold text-2xl",children:"Libraries"}),b("div",{className:"space-y-6",children:[b("div",{className:"card-subtle p-6",children:[h("h3",{className:"font-bold text-lg",children:"@contractspec/app.cli-database"}),b("p",{className:"mt-2 text-muted-foreground text-sm",children:[h("strong",{children:"Prisma Wrapper & CLI"}),". Provides a unified way to manage database schemas, migrations, and clients. Includes seeders and factory patterns for testing."]})]}),b("div",{className:"card-subtle p-6",children:[h("h3",{className:"font-bold text-lg",children:"@contractspec/lib.bus"}),b("p",{className:"mt-2 text-muted-foreground text-sm",children:[h("strong",{children:"Type-Safe Event Bus"}),". Decouple your architecture with typed events. Supports in-memory dispatch for monoliths and can be extended for distributed message queues (Redis, SQS)."]})]}),b("div",{className:"card-subtle p-6",children:[h("h3",{className:"font-bold text-lg",children:"@contractspec/lib.logger"}),b("p",{className:"mt-2 text-muted-foreground text-sm",children:[h("strong",{children:"High-Performance Logging"}),". Optimized for Bun and structured JSON output. Includes plugins for ElysiaJS to log HTTP requests automatically."]})]}),b("div",{className:"card-subtle p-6",children:[h("h3",{className:"font-bold text-lg",children:"@contractspec/lib.error"}),b("p",{className:"mt-2 text-muted-foreground text-sm",children:[h("strong",{children:"Standardized Errors"}),". Use `AppError` with standard codes (NOT_FOUND, UNAUTHORIZED) to ensure consistent HTTP responses and error handling across services."]})]}),b("div",{className:"card-subtle p-6",children:[h("h3",{className:"font-bold text-lg",children:"@contractspec/lib.exporter"}),b("p",{className:"mt-2 text-muted-foreground text-sm",children:[h("strong",{children:"Data Export"}),". Generate CSV and XML files from your data. Platform-agnostic and streaming-friendly."]})]})]})]}),b("div",{className:"space-y-4",children:[h("h2",{className:"font-bold text-2xl",children:"Example: Unified Backend Flow"}),h(pt,{language:"typescript",code:`import { logger } from '@contractspec/lib.logger';
161
+ tracker.getTotals({ tenantId: 'acme' }).forEach((summary) => budgets.track(summary));`})]}),_("div",{className:"space-y-4",children:[z("h2",{className:"font-bold text-2xl",children:"Optimization Suggestions"}),_("p",{className:"text-muted-foreground text-sm",children:["Feed summaries into ",z("code",{children:"OptimizationRecommender"})," to surface N+1 queries, compute-heavy steps, or expensive external calls. Store the generated suggestions in the new Prisma model to power Ops playbooks."]})]}),_("div",{className:"flex items-center gap-4 pt-4",children:[z(we,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),_(we,{href:"/docs/libraries/slo",className:"btn-primary",children:["Next: SLO ",z(mt,{size:16})]})]})]})}import{CodeBlock as gt}from"@contractspec/lib.design-system";import ke from"@contractspec/lib.ui-link";import{ChevronRight as ft}from"lucide-react";import{jsx as h,jsxs as b}from"react/jsx-runtime";function ht(){return b("div",{className:"space-y-8",children:[b("div",{className:"space-y-4",children:[h("h1",{className:"font-bold text-4xl",children:"Data & Backend"}),h("p",{className:"text-muted-foreground",children:"A collection of robust, platform-agnostic libraries for building the backend infrastructure of your LSSM applications."})]}),b("div",{className:"space-y-4",children:[h("h2",{className:"font-bold text-2xl",children:"Libraries"}),b("div",{className:"space-y-6",children:[b("div",{className:"card-subtle p-6",children:[h("h3",{className:"font-bold text-lg",children:"@contractspec/app.cli-database"}),b("p",{className:"mt-2 text-muted-foreground text-sm",children:[h("strong",{children:"Prisma Wrapper & CLI"}),". Provides a unified way to manage database schemas, migrations, and clients. Includes seeders and factory patterns for testing."]})]}),b("div",{className:"card-subtle p-6",children:[h("h3",{className:"font-bold text-lg",children:"@contractspec/lib.bus"}),b("p",{className:"mt-2 text-muted-foreground text-sm",children:[h("strong",{children:"Type-Safe Event Bus"}),". Decouple your architecture with typed events. Supports in-memory dispatch for monoliths and can be extended for distributed message queues (Redis, SQS)."]})]}),b("div",{className:"card-subtle p-6",children:[h("h3",{className:"font-bold text-lg",children:"@contractspec/lib.logger"}),b("p",{className:"mt-2 text-muted-foreground text-sm",children:[h("strong",{children:"High-Performance Logging"}),". Optimized for Bun and structured JSON output. Includes plugins for ElysiaJS to log HTTP requests automatically."]})]}),b("div",{className:"card-subtle p-6",children:[h("h3",{className:"font-bold text-lg",children:"@contractspec/lib.error"}),b("p",{className:"mt-2 text-muted-foreground text-sm",children:[h("strong",{children:"Standardized Errors"}),". Use `AppError` with standard codes (NOT_FOUND, UNAUTHORIZED) to ensure consistent HTTP responses and error handling across services."]})]}),b("div",{className:"card-subtle p-6",children:[h("h3",{className:"font-bold text-lg",children:"@contractspec/lib.exporter"}),b("p",{className:"mt-2 text-muted-foreground text-sm",children:[h("strong",{children:"Data Export"}),". Generate CSV and XML files from your data. Platform-agnostic and streaming-friendly."]})]})]})]}),b("div",{className:"space-y-4",children:[h("h2",{className:"font-bold text-2xl",children:"Example: Unified Backend Flow"}),h(gt,{language:"typescript",code:`import { logger } from '@contractspec/lib.logger';
137
162
  import { AppError } from '@contractspec/lib.error';
138
163
  import { db } from '@contractspec/app.cli-database';
139
164
  import { EventBus } from '@contractspec/lib.bus';
@@ -151,7 +176,7 @@ export async function createUser(email: string) {
151
176
  await EventBus.publish('user.created', { userId: user.id });
152
177
 
153
178
  return user;
154
- }`})]}),b("div",{className:"flex items-center gap-4 pt-4",children:[b(ve,{href:"/docs/libraries/runtime",className:"btn-primary",children:["Next: Runtime ",h(mt,{size:16})]}),h(ve,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"})]})]})}import{CodeBlock as ye,InstallCommand as gt}from"@contractspec/lib.design-system";import Ne from"@contractspec/lib.ui-link";import{ChevronRight as ft}from"lucide-react";import{jsx as l,jsxs as v}from"react/jsx-runtime";function ht(){return v("div",{className:"space-y-8",children:[v("div",{className:"space-y-4",children:[l("h1",{className:"font-bold text-4xl",children:"DataViews Runtime Library"}),v("p",{className:"text-lg text-muted-foreground",children:["The ",l("code",{children:"@contractspec/lib.contracts-spec/data-views"})," and"," ",l("code",{children:"@contractspec/lib.design-system"})," libraries provide the runtime logic and UI components to render DataViews in your application."]})]}),v("div",{className:"space-y-4",children:[l("h2",{className:"font-bold text-2xl",children:"Installation"}),l(gt,{package:["@contractspec/lib.contracts-spec","@contractspec/lib.design-system"]})]}),v("div",{className:"space-y-4",children:[l("h2",{className:"font-bold text-2xl",children:"DataViewRenderer"}),l("p",{className:"text-muted-foreground",children:"The primary component for rendering any DataView. It automatically selects the correct layout (List, Table, Grid, Detail) based on the spec."}),l(ye,{language:"tsx",code:`import { DataViewRenderer } from '@contractspec/lib.design-system';
179
+ }`})]}),b("div",{className:"flex items-center gap-4 pt-4",children:[b(ke,{href:"/docs/libraries/runtime",className:"btn-primary",children:["Next: Runtime ",h(ft,{size:16})]}),h(ke,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"})]})]})}import{CodeBlock as Se,InstallCommand as bt}from"@contractspec/lib.design-system";import Ce from"@contractspec/lib.ui-link";import{ChevronRight as vt}from"lucide-react";import{jsx as l,jsxs as v}from"react/jsx-runtime";function yt(){return v("div",{className:"space-y-8",children:[v("div",{className:"space-y-4",children:[l("h1",{className:"font-bold text-4xl",children:"DataViews Runtime Library"}),v("p",{className:"text-lg text-muted-foreground",children:["The ",l("code",{children:"@contractspec/lib.contracts-spec/data-views"})," and"," ",l("code",{children:"@contractspec/lib.design-system"})," libraries provide the runtime logic and UI components to render DataViews in your application."]})]}),v("div",{className:"space-y-4",children:[l("h2",{className:"font-bold text-2xl",children:"Installation"}),l(bt,{package:["@contractspec/lib.contracts-spec","@contractspec/lib.design-system"]})]}),v("div",{className:"space-y-4",children:[l("h2",{className:"font-bold text-2xl",children:"DataViewRenderer"}),l("p",{className:"text-muted-foreground",children:"The primary component for rendering any DataView. It automatically selects the correct layout (List, Table, Grid, Detail) based on the spec."}),l(Se,{language:"tsx",code:`import { DataViewRenderer } from '@contractspec/lib.design-system';
155
180
  import { MyUserList } from './specs/users.data-view';
156
181
 
157
182
  export function UserPage() {
@@ -163,7 +188,7 @@ export function UserPage() {
163
188
  onPageChange={(page) => fetchPage(page)}
164
189
  />
165
190
  );
166
- }`}),l("h3",{className:"font-semibold text-xl",children:"Props"}),v("ul",{className:"list-disc space-y-2 pl-6 text-muted-foreground",children:[v("li",{children:[l("code",{children:"spec"}),": The DataViewSpec definition."]}),v("li",{children:[l("code",{children:"items"}),": Array of data items to render."]}),v("li",{children:[l("code",{children:"filters"}),": Current filter state object."]}),v("li",{children:[l("code",{children:"onFilterChange"}),": Callback when filters change."]}),v("li",{children:[l("code",{children:"pagination"}),": Object with ",l("code",{children:"page"}),","," ",l("code",{children:"pageSize"}),", ",l("code",{children:"total"}),"."]}),v("li",{children:[l("code",{children:"onPageChange"}),": Callback when page changes."]})]})]}),v("div",{className:"space-y-4",children:[l("h2",{className:"font-bold text-2xl",children:"Query Generation"}),v("p",{className:"text-muted-foreground",children:["The ",l("code",{children:"DataViewQueryGenerator"})," utility helps translate DataView parameters (filters, sorting, pagination) into query arguments for your backend."]}),l(ye,{language:"typescript",code:`import { DataViewQueryGenerator } from '@contractspec/lib.contracts-spec/data-views/query-generator';
191
+ }`}),l("h3",{className:"font-semibold text-xl",children:"Props"}),v("ul",{className:"list-disc space-y-2 pl-6 text-muted-foreground",children:[v("li",{children:[l("code",{children:"spec"}),": The DataViewSpec definition."]}),v("li",{children:[l("code",{children:"items"}),": Array of data items to render."]}),v("li",{children:[l("code",{children:"filters"}),": Current filter state object."]}),v("li",{children:[l("code",{children:"onFilterChange"}),": Callback when filters change."]}),v("li",{children:[l("code",{children:"pagination"}),": Object with ",l("code",{children:"page"}),","," ",l("code",{children:"pageSize"}),", ",l("code",{children:"total"}),"."]}),v("li",{children:[l("code",{children:"onPageChange"}),": Callback when page changes."]})]})]}),v("div",{className:"space-y-4",children:[l("h2",{className:"font-bold text-2xl",children:"Query Generation"}),v("p",{className:"text-muted-foreground",children:["The ",l("code",{children:"DataViewQueryGenerator"})," utility helps translate DataView parameters (filters, sorting, pagination) into query arguments for your backend."]}),l(Se,{language:"typescript",code:`import { DataViewQueryGenerator } from '@contractspec/lib.contracts-spec/data-views/query-generator';
167
192
 
168
193
  const generator = new DataViewQueryGenerator(MyUserList);
169
194
  const query = generator.generate({
@@ -171,43 +196,55 @@ const query = generator.generate({
171
196
  filters: { role: 'admin' }
172
197
  });
173
198
 
174
- // query.input contains { skip: 0, take: 20, role: 'admin' }`})]}),v("div",{className:"flex items-center gap-4 pt-4",children:[l(Ne,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),v(Ne,{href:"/docs/libraries/data-backend",className:"btn-primary",children:["Next: Data & Backend ",l(ft,{size:16})]})]})]})}import{CodeBlock as ie,InstallCommand as bt}from"@contractspec/lib.design-system";import ke from"@contractspec/lib.ui-link";import{ChevronRight as vt}from"lucide-react";import{jsx as t,jsxs as n}from"react/jsx-runtime";function yt(){return n("div",{className:"space-y-8",children:[n("div",{className:"space-y-4",children:[t("h1",{className:"font-bold text-4xl",children:"@contractspec/lib.design-system"}),n("p",{className:"text-muted-foreground",children:["High-level design system components, patterns, and layouts for LSSM applications. Built on top of ",t("code",{children:"@contractspec/lib.ui-kit"}),"."]})]}),n("div",{className:"space-y-4",children:[t("h2",{className:"font-bold text-2xl",children:"Installation"}),t(bt,{package:"@contractspec/lib.design-system"})]}),n("div",{className:"space-y-4",children:[t("h2",{className:"font-bold text-2xl",children:"What It Provides"}),n("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[n("li",{children:[t("strong",{children:"Composite Components"}),": Molecules and Organisms that solve common UI problems"]}),n("li",{children:[t("strong",{children:"Layouts"}),": Ready-to-use page structures for dashboards, marketing sites, and lists"]}),n("li",{children:[t("strong",{children:"Data Views"}),": Standardized renderers for lists, tables, and detail views"]}),n("li",{children:[t("strong",{children:"Forms"}),": Zod-integrated form layouts and components"]}),n("li",{children:[t("strong",{children:"Code Display"}),": Syntax-highlighted code blocks with package manager tabs"]}),n("li",{children:[t("strong",{children:"Platform Utilities"}),": Hooks for responsive and adaptive design"]}),n("li",{children:[t("strong",{children:"Legal Templates"}),": Compliant templates for Terms, Privacy, and GDPR"]})]})]}),n("div",{className:"space-y-4",children:[t("h2",{className:"font-bold text-2xl",children:"Example: App Layout"}),t(ie,{language:"tsx",code:`import { AppLayout } from '@contractspec/lib.design-system';
175
- import { AppSidebar } from '@contractspec/lib.design-system';
176
-
177
- export function Layout({ children }) {
178
- return (
179
- <AppLayout sidebar={<AppSidebar />}>
180
- {children}
181
- </AppLayout>
182
- );
183
- }`})]}),n("div",{className:"space-y-4",children:[t("h2",{className:"font-bold text-2xl",children:"Example: Zod Form"}),t(ie,{language:"tsx",code:`import { ZodForm } from '@contractspec/lib.design-system';
184
- import * as z from "zod";
185
-
186
- const schema = z.object({
187
- name: z.string().min(1),
188
- email: z.string().email(),
189
- });
199
+ // query.input contains { skip: 0, take: 20, role: 'admin' }`})]}),v("div",{className:"flex items-center gap-4 pt-4",children:[l(Ce,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),v(Ce,{href:"/docs/libraries/data-backend",className:"btn-primary",children:["Next: Data & Backend ",l(vt,{size:16})]})]})]})}import{CodeBlock as Nt,InstallCommand as wt}from"@contractspec/lib.design-system";import ce from"@contractspec/lib.ui-link";import{ChevronRight as kt}from"lucide-react";import{jsx as t,jsxs as n}from"react/jsx-runtime";var St=`import { Button, DataTable } from '@contractspec/lib.design-system';
200
+ import { useContractTable } from '@contractspec/lib.presentation-runtime-react';
201
+
202
+ import { SHOWCASE_ROWS } from '@contractspec/example.data-grid-showcase/ui/data-grid-showcase.data';
203
+ import { useShowcaseColumns } from '@contractspec/example.data-grid-showcase/ui/data-grid-showcase.columns';
204
+ import {
205
+ ExpandedRowContent,
206
+ ShowcaseToolbar,
207
+ } from '@contractspec/example.data-grid-showcase/ui/data-grid-showcase.parts';
208
+
209
+ export function AccountHealthTable() {
210
+ const columns = useShowcaseColumns();
211
+
212
+ const controller = useContractTable({
213
+ data: SHOWCASE_ROWS,
214
+ columns,
215
+ selectionMode: 'multiple',
216
+ initialState: {
217
+ sorting: [{ id: 'arr', desc: true }],
218
+ pagination: { pageIndex: 0, pageSize: 4 },
219
+ columnVisibility: { notes: false },
220
+ columnPinning: { left: ['account'], right: [] },
221
+ },
222
+ renderExpandedContent: (row) => <ExpandedRowContent row={row} />,
223
+ getCanExpand: () => true,
224
+ });
190
225
 
191
- export function SignupForm() {
192
226
  return (
193
- <ZodForm
194
- schema={schema}
195
- onSubmit={(data) => console.log(data)}
196
- submitLabel="Submit"
227
+ <DataTable
228
+ controller={controller}
229
+ title="Account health"
230
+ description="Composed table surface for the canonical account grid."
231
+ headerActions={<Button variant="outline">Reset</Button>}
232
+ toolbar={
233
+ <ShowcaseToolbar
234
+ controller={controller}
235
+ label="Client mode"
236
+ primaryColumnId="account"
237
+ toggleColumnId="notes"
238
+ pinColumnId="owner"
239
+ sortColumnIds={['arr', 'renewalDate']}
240
+ />
241
+ }
242
+ loading={false}
243
+ emptyState={<div>No rows available.</div>}
244
+ footer={\`Page \${controller.pageIndex + 1} of \${controller.pageCount}\`}
197
245
  />
198
246
  );
199
- }`})]}),n("div",{className:"space-y-4",children:[t("h2",{className:"font-bold text-2xl",children:"Example: Code Block with Package Manager Tabs"}),t(ie,{language:"tsx",code:`import { CodeBlock, InstallCommand } from '@contractspec/lib.design-system';
200
-
201
- // For installation commands with package manager tabs
202
- <InstallCommand package="my-package" />
203
- <InstallCommand package={["react", "react-dom"]} dev />
204
-
205
- // For code examples with syntax highlighting
206
- <CodeBlock
207
- language="typescript"
208
- code={\`const hello = "world";\`}
209
- filename="example.ts"
210
- />`})]}),n("div",{className:"space-y-4",children:[t("h2",{className:"font-bold text-2xl",children:"Key Exports"}),n("div",{className:"grid gap-4 md:grid-cols-2",children:[n("div",{className:"card-subtle p-4",children:[t("h3",{className:"mb-2 font-semibold",children:"Organisms"}),n("ul",{className:"space-y-1 text-muted-foreground text-sm",children:[t("li",{children:"AppLayout, AppHeader, AppSidebar"}),t("li",{children:"MarketingLayout, HeroSection"}),t("li",{children:"ListCardPage, ListTablePage"})]})]}),n("div",{className:"card-subtle p-4",children:[t("h3",{className:"mb-2 font-semibold",children:"Data & Forms"}),n("ul",{className:"space-y-1 text-muted-foreground text-sm",children:[t("li",{children:"DataViewRenderer"}),t("li",{children:"ZodForm"}),t("li",{children:"FormLayout, FormDialog"})]})]}),n("div",{className:"card-subtle p-4",children:[t("h3",{className:"mb-2 font-semibold",children:"Code Display"}),n("ul",{className:"space-y-1 text-muted-foreground text-sm",children:[t("li",{children:"CodeBlock (syntax highlighting)"}),t("li",{children:"CommandTabs (package manager tabs)"}),t("li",{children:"InstallCommand (convenience wrapper)"}),t("li",{children:"CopyButton"})]})]}),n("div",{className:"card-subtle p-4",children:[t("h3",{className:"mb-2 font-semibold",children:"Providers"}),t("ul",{className:"space-y-1 text-muted-foreground text-sm",children:t("li",{children:"PackageManagerProvider"})})]})]})]}),n("div",{className:"flex items-center gap-4 pt-4",children:[t(ke,{href:"/docs/libraries/ui-kit",className:"btn-ghost",children:"Previous: UI Kit"}),n(ke,{href:"/docs/libraries/accessibility",className:"btn-primary",children:["Next: Accessibility ",t(vt,{size:16})]})]})]})}import{CodeBlock as re,InstallCommand as Nt}from"@contractspec/lib.design-system";import we from"@contractspec/lib.ui-link";import{ChevronRight as kt}from"lucide-react";import{jsx as k,jsxs as V}from"react/jsx-runtime";function wt(){return V("div",{className:"space-y-8",children:[V("div",{className:"space-y-4",children:[k("h1",{className:"font-bold text-4xl",children:"@contractspec/lib.evolution"}),k("p",{className:"text-lg text-muted-foreground",children:"Analyze production telemetry, surface anomalies, and turn them into AI-reviewed spec proposals that can be approved, rolled out, or reverted."})]}),V("div",{className:"space-y-4",children:[k("h2",{className:"font-bold text-2xl",children:"Installation"}),k(Nt,{package:"@contractspec/lib.evolution"})]}),V("div",{className:"space-y-3",children:[k("h2",{className:"font-bold text-2xl",children:"From telemetry to intent"}),k(re,{language:"typescript",code:`import { SpecAnalyzer } from '@contractspec/lib.evolution/analyzer';
247
+ }`;function Ct(){return n("div",{className:"space-y-8",children:[n("div",{className:"space-y-4",children:[t("h1",{className:"font-bold text-4xl",children:"@contractspec/lib.design-system"}),n("p",{className:"text-muted-foreground",children:["High-level design system components, patterns, and layouts for LSSM applications. Built on top of ",t("code",{children:"@contractspec/lib.ui-kit"}),"."]})]}),n("div",{className:"space-y-4",children:[t("h2",{className:"font-bold text-2xl",children:"Installation"}),t(wt,{package:"@contractspec/lib.design-system"})]}),n("div",{className:"space-y-4",children:[t("h2",{className:"font-bold text-2xl",children:"What It Provides"}),n("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[n("li",{children:[t("strong",{children:"Composite Components"}),": Molecules and Organisms that solve common UI problems"]}),n("li",{children:[t("strong",{children:"Layouts"}),": Ready-to-use page structures for dashboards, marketing sites, and lists"]}),n("li",{children:[t("strong",{children:"Data Views"}),": Standardized renderers for lists, tables, and detail views"]}),n("li",{children:[t("strong",{children:"Forms"}),": Zod-integrated form layouts and components"]}),n("li",{children:[t("strong",{children:"Code Display"}),": Syntax-highlighted code blocks with package manager tabs"]}),n("li",{children:[t("strong",{children:"Platform Utilities"}),": Hooks for responsive and adaptive design"]}),n("li",{children:[t("strong",{children:"Legal Templates"}),": Compliant templates for Terms, Privacy, and GDPR"]})]})]}),n("div",{className:"space-y-4",children:[t("h2",{className:"font-bold text-2xl",children:"Data table example"}),n("p",{className:"text-muted-foreground",children:["This is the composed lane from the canonical"," ",t(ce,{href:"/docs/examples/data-grid-showcase",className:"text-[color:var(--rust)] underline underline-offset-4",children:"Data Grid Showcase"}),". The design-system wrapper owns title, description, header actions, and the opinionated card shell on top of the raw web primitive."]}),t(Nt,{language:"tsx",code:St})]}),n("div",{className:"space-y-4",children:[t("h2",{className:"font-bold text-2xl",children:"Key Exports"}),n("div",{className:"grid gap-4 md:grid-cols-2",children:[n("div",{className:"card-subtle p-4",children:[t("h3",{className:"mb-2 font-semibold",children:"Organisms"}),n("ul",{className:"space-y-1 text-muted-foreground text-sm",children:[t("li",{children:"AppLayout, AppHeader, AppSidebar"}),t("li",{children:"MarketingLayout, HeroSection"}),t("li",{children:"ListCardPage, ListTablePage"})]})]}),n("div",{className:"card-subtle p-4",children:[t("h3",{className:"mb-2 font-semibold",children:"Data & Forms"}),n("ul",{className:"space-y-1 text-muted-foreground text-sm",children:[t("li",{children:"DataTable"}),t("li",{children:"DataViewTable"}),t("li",{children:"DataViewRenderer"}),t("li",{children:"ZodForm"}),t("li",{children:"FormLayout, FormDialog"})]})]}),n("div",{className:"card-subtle p-4",children:[t("h3",{className:"mb-2 font-semibold",children:"Code Display"}),n("ul",{className:"space-y-1 text-muted-foreground text-sm",children:[t("li",{children:"CodeBlock (syntax highlighting)"}),t("li",{children:"CommandTabs (package manager tabs)"}),t("li",{children:"InstallCommand (convenience wrapper)"}),t("li",{children:"CopyButton"})]})]}),n("div",{className:"card-subtle p-4",children:[t("h3",{className:"mb-2 font-semibold",children:"Providers"}),t("ul",{className:"space-y-1 text-muted-foreground text-sm",children:t("li",{children:"PackageManagerProvider"})})]})]})]}),n("div",{className:"flex items-center gap-4 pt-4",children:[t(ce,{href:"/docs/libraries/ui-kit-web",className:"btn-ghost",children:"Previous: UI Kit Web"}),n(ce,{href:"/docs/libraries/accessibility",className:"btn-primary",children:["Next: Accessibility ",t(kt,{size:16})]})]})]})}import{CodeBlock as le,InstallCommand as Lt}from"@contractspec/lib.design-system";import Le from"@contractspec/lib.ui-link";import{ChevronRight as Rt}from"lucide-react";import{jsx as w,jsxs as Q}from"react/jsx-runtime";function It(){return Q("div",{className:"space-y-8",children:[Q("div",{className:"space-y-4",children:[w("h1",{className:"font-bold text-4xl",children:"@contractspec/lib.evolution"}),w("p",{className:"text-lg text-muted-foreground",children:"Analyze production telemetry, surface anomalies, and turn them into AI-reviewed spec proposals that can be approved, rolled out, or reverted."})]}),Q("div",{className:"space-y-4",children:[w("h2",{className:"font-bold text-2xl",children:"Installation"}),w(Lt,{package:"@contractspec/lib.evolution"})]}),Q("div",{className:"space-y-3",children:[w("h2",{className:"font-bold text-2xl",children:"From telemetry to intent"}),w(le,{language:"typescript",code:`import { SpecAnalyzer } from '@contractspec/lib.evolution/analyzer';
211
248
  import { EvolutionPipeline } from '@contractspec/lib.observability';
212
249
 
213
250
  const analyzer = new SpecAnalyzer();
@@ -222,7 +259,7 @@ pipeline.ingest({
222
259
  success: false,
223
260
  timestamp: new Date(),
224
261
  errorCode: 'VALIDATION_FAILED',
225
- });`})]}),V("div",{className:"space-y-3",children:[k("h2",{className:"font-bold text-2xl",children:"Generate & approve suggestions"}),k(re,{language:"typescript",code:`import {
262
+ });`})]}),Q("div",{className:"space-y-3",children:[w("h2",{className:"font-bold text-2xl",children:"Generate & approve suggestions"}),w(le,{language:"typescript",code:`import {
226
263
  SpecGenerator,
227
264
  SpecSuggestionOrchestrator,
228
265
  InMemorySpecSuggestionRepository,
@@ -236,7 +273,7 @@ const suggestion = generator.generateFromIntent(intentPattern, {
236
273
  summary: 'Add PO number requirement for acme.corp',
237
274
  });
238
275
 
239
- await orchestrator.submit(suggestion, sessionState);`})]}),V("div",{className:"space-y-3",children:[k("h2",{className:"font-bold text-2xl",children:"Write approved specs back to git"}),k(re,{language:"typescript",code:`import { FileSystemSuggestionWriter } from '@contractspec/lib.evolution/approval';
276
+ await orchestrator.submit(suggestion, sessionState);`})]}),Q("div",{className:"space-y-3",children:[w("h2",{className:"font-bold text-2xl",children:"Write approved specs back to git"}),w(le,{language:"typescript",code:`import { FileSystemSuggestionWriter } from '@contractspec/lib.evolution/approval';
240
277
 
241
278
  const writer = new FileSystemSuggestionWriter({
242
279
  outputDir:
@@ -247,7 +284,7 @@ await writer.write({
247
284
  ...suggestion,
248
285
  status: 'approved',
249
286
  approvals: { reviewer: 'ops@contractspec', decidedAt: new Date() },
250
- });`})]}),k("div",{className:"grid gap-4 md:grid-cols-2",children:[{title:"Approvals by default",description:"Every suggestion flows through @contractspec/lib.ai-agent's ApprovalWorkflow. Tune auto-approval thresholds per environment."},{title:"Pluggable storage",description:"Use the Prisma repository in production, in-memory for tests, or stream serialized suggestions into your own queue."}].map((E)=>V("div",{className:"card-subtle space-y-2 p-4",children:[k("h3",{className:"font-semibold text-lg",children:E.title}),k("p",{className:"text-muted-foreground text-sm",children:E.description})]},E.title))}),V("div",{className:"flex items-center gap-4 pt-4",children:[k(we,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),V(we,{href:"/docs/libraries/observability",className:"btn-primary",children:["Next: Observability ",k(kt,{size:16})]})]})]})}import{CodeBlock as Ct,InstallCommand as St}from"@contractspec/lib.design-system";import Ce from"@contractspec/lib.ui-link";import{ChevronRight as Lt}from"lucide-react";import{jsx as u,jsxs as y}from"react/jsx-runtime";function Rt(){return y("div",{className:"space-y-8",children:[y("div",{className:"space-y-4",children:[u("h1",{className:"font-bold text-4xl",children:"GraphQL Libraries"}),u("p",{className:"text-muted-foreground",children:"This suite of libraries enables seamless GraphQL integration, transforming your ContractSpecs into a type-safe Pothos schema, connecting with Prisma, and enabling Apollo Federation."})]}),y("div",{className:"space-y-4",children:[u("h2",{className:"font-bold text-2xl",children:"Libraries"}),y("div",{className:"grid gap-4 md:grid-cols-1",children:[y("div",{className:"card-subtle p-6",children:[u("h3",{className:"font-bold text-lg",children:"@contractspec/lib.graphql-core"}),u("p",{className:"mt-2 text-muted-foreground text-sm",children:"The foundation. Provides a configured Pothos builder, common scalars (JSON, DateTime), and utilities for mapping ContractSpec I/O to Pothos types."})]}),y("div",{className:"card-subtle p-6",children:[u("h3",{className:"font-bold text-lg",children:"@contractspec/lib.graphql-prisma"}),u("p",{className:"mt-2 text-muted-foreground text-sm",children:"Connects Pothos to Prisma. Automatically generates GraphQL types from your Prisma schema and optimizes queries to prevent N+1 issues."})]}),y("div",{className:"card-subtle p-6",children:[u("h3",{className:"font-bold text-lg",children:"@contractspec/lib.graphql-federation"}),u("p",{className:"mt-2 text-muted-foreground text-sm",children:"Adds Apollo Federation V2 support. Allows your subgraph to define keys and entities, making it ready for a supergraph."})]})]})]}),y("div",{className:"space-y-4",children:[u("h2",{className:"font-bold text-2xl",children:"Installation"}),u(St,{package:["@contractspec/lib.graphql-core","@contractspec/lib.graphql-prisma","@contractspec/lib.graphql-federation"]})]}),y("div",{className:"space-y-4",children:[u("h2",{className:"font-bold text-2xl",children:"Usage: Building a Schema"}),u("p",{className:"text-muted-foreground",children:"Here's how to assemble a federated GraphQL schema from your specs:"}),u(Ct,{language:"typescript",code:`import { builder } from '@contractspec/lib.graphql-core';
287
+ });`})]}),w("div",{className:"grid gap-4 md:grid-cols-2",children:[{title:"Approvals by default",description:"Every suggestion flows through @contractspec/lib.ai-agent's ApprovalWorkflow. Tune auto-approval thresholds per environment."},{title:"Pluggable storage",description:"Use the Prisma repository in production, in-memory for tests, or stream serialized suggestions into your own queue."}].map((E)=>Q("div",{className:"card-subtle space-y-2 p-4",children:[w("h3",{className:"font-semibold text-lg",children:E.title}),w("p",{className:"text-muted-foreground text-sm",children:E.description})]},E.title))}),Q("div",{className:"flex items-center gap-4 pt-4",children:[w(Le,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),Q(Le,{href:"/docs/libraries/observability",className:"btn-primary",children:["Next: Observability ",w(Rt,{size:16})]})]})]})}import{CodeBlock as Tt,InstallCommand as At}from"@contractspec/lib.design-system";import Re from"@contractspec/lib.ui-link";import{ChevronRight as Pt}from"lucide-react";import{jsx as u,jsxs as y}from"react/jsx-runtime";function Bt(){return y("div",{className:"space-y-8",children:[y("div",{className:"space-y-4",children:[u("h1",{className:"font-bold text-4xl",children:"GraphQL Libraries"}),u("p",{className:"text-muted-foreground",children:"This suite of libraries enables seamless GraphQL integration, transforming your ContractSpecs into a type-safe Pothos schema, connecting with Prisma, and enabling Apollo Federation."})]}),y("div",{className:"space-y-4",children:[u("h2",{className:"font-bold text-2xl",children:"Libraries"}),y("div",{className:"grid gap-4 md:grid-cols-1",children:[y("div",{className:"card-subtle p-6",children:[u("h3",{className:"font-bold text-lg",children:"@contractspec/lib.graphql-core"}),u("p",{className:"mt-2 text-muted-foreground text-sm",children:"The foundation. Provides a configured Pothos builder, common scalars (JSON, DateTime), and utilities for mapping ContractSpec I/O to Pothos types."})]}),y("div",{className:"card-subtle p-6",children:[u("h3",{className:"font-bold text-lg",children:"@contractspec/lib.graphql-prisma"}),u("p",{className:"mt-2 text-muted-foreground text-sm",children:"Connects Pothos to Prisma. Automatically generates GraphQL types from your Prisma schema and optimizes queries to prevent N+1 issues."})]}),y("div",{className:"card-subtle p-6",children:[u("h3",{className:"font-bold text-lg",children:"@contractspec/lib.graphql-federation"}),u("p",{className:"mt-2 text-muted-foreground text-sm",children:"Adds Apollo Federation V2 support. Allows your subgraph to define keys and entities, making it ready for a supergraph."})]})]})]}),y("div",{className:"space-y-4",children:[u("h2",{className:"font-bold text-2xl",children:"Installation"}),u(At,{package:["@contractspec/lib.graphql-core","@contractspec/lib.graphql-prisma","@contractspec/lib.graphql-federation"]})]}),y("div",{className:"space-y-4",children:[u("h2",{className:"font-bold text-2xl",children:"Usage: Building a Schema"}),u("p",{className:"text-muted-foreground",children:"Here's how to assemble a federated GraphQL schema from your specs:"}),u(Tt,{language:"typescript",code:`import { builder } from '@contractspec/lib.graphql-core';
251
288
  import { registerContractsOnBuilder } from '@contractspec/lib.contracts-runtime-server-graphql/graphql-pothos';
252
289
  import { OperationSpecRegistry } from '@contractspec/lib.contracts-spec';
253
290
  import { MySpecs } from './specs';
@@ -261,7 +298,7 @@ registerContractsOnBuilder(builder, registry);
261
298
 
262
299
  // 3. Build and print schema
263
300
  const schema = builder.toSchema();
264
- console.log(printSchema(schema));`})]}),y("div",{className:"space-y-4",children:[u("h2",{className:"font-bold text-2xl",children:"Features"}),y("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[y("li",{children:[u("strong",{children:"Code-First"}),": Define schema in TypeScript (Pothos), get SDL as artifact."]}),y("li",{children:[u("strong",{children:"Spec Integration"}),": `registerContractsOnBuilder` automatically converts Command/Query specs into Mutations/Queries."]}),y("li",{children:[u("strong",{children:"Federation Ready"}),": Just add `provider: 'federation'` to your config."]})]})]}),y("div",{className:"flex items-center gap-4 pt-4",children:[y(Ce,{href:"/docs/libraries/data-backend",className:"btn-primary",children:["Next: Data & Backend ",u(Lt,{size:16})]}),u(Ce,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"})]})]})}import{CodeBlock as Se,InstallCommand as It}from"@contractspec/lib.design-system";import Le from"@contractspec/lib.ui-link";import{ChevronRight as Tt}from"lucide-react";import{jsx as U,jsxs as x}from"react/jsx-runtime";function At(){return x("div",{className:"space-y-8",children:[x("div",{className:"space-y-4",children:[U("h1",{className:"font-bold text-4xl",children:"@contractspec/lib.growth"}),U("p",{className:"text-lg text-muted-foreground",children:"Launch experiments without third-party SDKs. Register variants, assign users deterministically, track exposures, and compute significance."})]}),x("div",{className:"space-y-4",children:[U("h2",{className:"font-bold text-2xl",children:"Installation"}),U(It,{package:"@contractspec/lib.growth"})]}),x("div",{className:"space-y-3",children:[U("h2",{className:"font-bold text-2xl",children:"Register + assign"}),U(Se,{language:"typescript",code:`import { ExperimentRegistry, ExperimentRunner } from '@contractspec/lib.growth/experiments';
301
+ console.log(printSchema(schema));`})]}),y("div",{className:"space-y-4",children:[u("h2",{className:"font-bold text-2xl",children:"Features"}),y("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[y("li",{children:[u("strong",{children:"Code-First"}),": Define schema in TypeScript (Pothos), get SDL as artifact."]}),y("li",{children:[u("strong",{children:"Spec Integration"}),": `registerContractsOnBuilder` automatically converts Command/Query specs into Mutations/Queries."]}),y("li",{children:[u("strong",{children:"Federation Ready"}),": Just add `provider: 'federation'` to your config."]})]})]}),y("div",{className:"flex items-center gap-4 pt-4",children:[y(Re,{href:"/docs/libraries/data-backend",className:"btn-primary",children:["Next: Data & Backend ",u(Pt,{size:16})]}),u(Re,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"})]})]})}import{CodeBlock as Ie,InstallCommand as Ot}from"@contractspec/lib.design-system";import Te from"@contractspec/lib.ui-link";import{ChevronRight as Dt}from"lucide-react";import{jsx as U,jsxs as ee}from"react/jsx-runtime";function Et(){return ee("div",{className:"space-y-8",children:[ee("div",{className:"space-y-4",children:[U("h1",{className:"font-bold text-4xl",children:"@contractspec/lib.growth"}),U("p",{className:"text-lg text-muted-foreground",children:"Launch experiments without third-party SDKs. Register variants, assign users deterministically, track exposures, and compute significance."})]}),ee("div",{className:"space-y-4",children:[U("h2",{className:"font-bold text-2xl",children:"Installation"}),U(Ot,{package:"@contractspec/lib.growth"})]}),ee("div",{className:"space-y-3",children:[U("h2",{className:"font-bold text-2xl",children:"Register + assign"}),U(Ie,{language:"typescript",code:`import { ExperimentRegistry, ExperimentRunner } from '@contractspec/lib.growth/experiments';
265
302
 
266
303
  const registry = new ExperimentRegistry().register({
267
304
  key: 'pricing.cta',
@@ -275,7 +312,7 @@ const registry = new ExperimentRegistry().register({
275
312
  });
276
313
 
277
314
  const runner = new ExperimentRunner();
278
- const assignment = runner.assign(registry.get('pricing.cta')!, 'user_123');`})]}),x("div",{className:"space-y-3",children:[U("h2",{className:"font-bold text-2xl",children:"Track + analyze"}),U(Se,{language:"typescript",code:`import { ExperimentTracker } from '@contractspec/lib.growth/tracker';
315
+ const assignment = runner.assign(registry.get('pricing.cta')!, 'user_123');`})]}),ee("div",{className:"space-y-3",children:[U("h2",{className:"font-bold text-2xl",children:"Track + analyze"}),U(Ie,{language:"typescript",code:`import { ExperimentTracker } from '@contractspec/lib.growth/tracker';
279
316
  import { StatsEngine } from '@contractspec/lib.growth/stats';
280
317
 
281
318
  const tracker = new ExperimentTracker(new InMemoryTrackerStore());
@@ -291,11 +328,11 @@ await tracker.recordSample({
291
328
  const stats = new StatsEngine().summarize(
292
329
  await tracker.getSamples(assignment.experimentKey, 'demo_booked'),
293
330
  'demo_booked'
294
- );`})]}),x("div",{className:"flex items-center gap-4 pt-4",children:[U(Le,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),x(Le,{href:"/docs/libraries/analytics",className:"btn-primary",children:["Next: Analytics ",U(Tt,{size:16})]})]})]})}import{CodeBlock as Re,InstallCommand as Bt}from"@contractspec/lib.design-system";import Ie from"@contractspec/lib.ui-link";import{ChevronRight as Pt}from"lucide-react";import{jsx as D,jsxs as Q}from"react/jsx-runtime";function Ot(){return Q("div",{className:"space-y-8",children:[Q("div",{className:"space-y-4",children:[D("h1",{className:"font-bold text-4xl",children:"Multi-Tenancy Library"}),Q("p",{className:"text-lg text-muted-foreground",children:["The ",D("code",{children:"@contractspec/lib.multi-tenancy"})," library provides the core building blocks for secure SaaS applications."]})]}),Q("div",{className:"space-y-4",children:[D("h2",{className:"font-bold text-2xl",children:"Installation"}),D(Bt,{package:"@contractspec/lib.multi-tenancy"})]}),Q("div",{className:"space-y-4",children:[D("h2",{className:"font-bold text-2xl",children:"Prisma RLS Middleware"}),Q("p",{className:"text-muted-foreground",children:["Automatically injects ",D("code",{children:"tenantId"})," into all queries."]}),D(Re,{language:"typescript",code:`import { createRlsMiddleware } from '@contractspec/lib.multi-tenancy/rls';
331
+ );`})]}),ee("div",{className:"flex items-center gap-4 pt-4",children:[U(Te,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),ee(Te,{href:"/docs/libraries/analytics",className:"btn-primary",children:["Next: Analytics ",U(Dt,{size:16})]})]})]})}import{CodeBlock as Ae,InstallCommand as Mt}from"@contractspec/lib.design-system";import Pe from"@contractspec/lib.ui-link";import{ChevronRight as zt}from"lucide-react";import{jsx as W,jsxs as K}from"react/jsx-runtime";function Wt(){return K("div",{className:"space-y-8",children:[K("div",{className:"space-y-4",children:[W("h1",{className:"font-bold text-4xl",children:"Multi-Tenancy Library"}),K("p",{className:"text-lg text-muted-foreground",children:["The ",W("code",{children:"@contractspec/lib.multi-tenancy"})," library provides the core building blocks for secure SaaS applications."]})]}),K("div",{className:"space-y-4",children:[W("h2",{className:"font-bold text-2xl",children:"Installation"}),W(Mt,{package:"@contractspec/lib.multi-tenancy"})]}),K("div",{className:"space-y-4",children:[W("h2",{className:"font-bold text-2xl",children:"Prisma RLS Middleware"}),K("p",{className:"text-muted-foreground",children:["Automatically injects ",W("code",{children:"tenantId"})," into all queries."]}),W(Ae,{language:"typescript",code:`import { createRlsMiddleware } from '@contractspec/lib.multi-tenancy/rls';
295
332
  import { prisma } from './db';
296
333
  import { getTenantId } from './context';
297
334
 
298
- prisma.$use(createRlsMiddleware(() => getTenantId()));`})]}),Q("div",{className:"space-y-4",children:[D("h2",{className:"font-bold text-2xl",children:"Provisioning Service"}),D("p",{className:"text-muted-foreground",children:"Automates the creation of new tenants, including database setup and default user creation."}),D(Re,{language:"typescript",code:`import { TenantProvisioningService } from '@contractspec/lib.multi-tenancy/provisioning';
335
+ prisma.$use(createRlsMiddleware(() => getTenantId()));`})]}),K("div",{className:"space-y-4",children:[W("h2",{className:"font-bold text-2xl",children:"Provisioning Service"}),W("p",{className:"text-muted-foreground",children:"Automates the creation of new tenants, including database setup and default user creation."}),W(Ae,{language:"typescript",code:`import { TenantProvisioningService } from '@contractspec/lib.multi-tenancy/provisioning';
299
336
 
300
337
  const service = new TenantProvisioningService({ db: prisma });
301
338
  await service.provision({
@@ -303,20 +340,20 @@ await service.provision({
303
340
  name: 'Acme Corp',
304
341
  slug: 'acme',
305
342
  ownerEmail: 'admin@acme.com'
306
- });`})]}),Q("div",{className:"flex items-center gap-4 pt-4",children:[D(Ie,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),Q(Ie,{href:"/docs/libraries/progressive-delivery",className:"btn-primary",children:["Next: Progressive Delivery ",D(Pt,{size:16})]})]})]})}import{CodeBlock as ae,InstallCommand as Et}from"@contractspec/lib.design-system";import Te from"@contractspec/lib.ui-link";import{ChevronRight as zt}from"lucide-react";import{jsx as N,jsxs as q}from"react/jsx-runtime";function Mt(){return q("div",{className:"space-y-8",children:[q("div",{className:"space-y-4",children:[N("h1",{className:"font-bold text-4xl",children:"Observability Library"}),q("p",{className:"text-lg text-muted-foreground",children:["The ",N("code",{children:"@contractspec/lib.observability"})," library provides a thin wrapper around OpenTelemetry to simplify instrumentation."]})]}),q("div",{className:"space-y-4",children:[N("h2",{className:"font-bold text-2xl",children:"Installation"}),N(Et,{package:"@contractspec/lib.observability"})]}),q("div",{className:"space-y-4",children:[N("h2",{className:"font-bold text-2xl",children:"Tracing"}),N(ae,{language:"typescript",code:`import { traceAsync, traceSync } from '@contractspec/lib.observability/tracing';
343
+ });`})]}),K("div",{className:"flex items-center gap-4 pt-4",children:[W(Pe,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),K(Pe,{href:"/docs/libraries/progressive-delivery",className:"btn-primary",children:["Next: Progressive Delivery ",W(zt,{size:16})]})]})]})}import{CodeBlock as ie,InstallCommand as Gt}from"@contractspec/lib.design-system";import Be from"@contractspec/lib.ui-link";import{ChevronRight as Ft}from"lucide-react";import{jsx as N,jsxs as V}from"react/jsx-runtime";function _t(){return V("div",{className:"space-y-8",children:[V("div",{className:"space-y-4",children:[N("h1",{className:"font-bold text-4xl",children:"Observability Library"}),V("p",{className:"text-lg text-muted-foreground",children:["The ",N("code",{children:"@contractspec/lib.observability"})," library provides a thin wrapper around OpenTelemetry to simplify instrumentation."]})]}),V("div",{className:"space-y-4",children:[N("h2",{className:"font-bold text-2xl",children:"Installation"}),N(Gt,{package:"@contractspec/lib.observability"})]}),V("div",{className:"space-y-4",children:[N("h2",{className:"font-bold text-2xl",children:"Tracing"}),N(ie,{language:"typescript",code:`import { traceAsync, traceSync } from '@contractspec/lib.observability/tracing';
307
344
 
308
345
  await traceAsync('process_order', async (span) => {
309
346
  span.setAttribute('order_id', order.id);
310
347
  await db.save(order);
311
- });`})]}),q("div",{className:"space-y-4",children:[N("h2",{className:"font-bold text-2xl",children:"Metrics"}),N(ae,{language:"typescript",code:`import { createCounter, createHistogram } from '@contractspec/lib.observability/metrics';
348
+ });`})]}),V("div",{className:"space-y-4",children:[N("h2",{className:"font-bold text-2xl",children:"Metrics"}),N(ie,{language:"typescript",code:`import { createCounter, createHistogram } from '@contractspec/lib.observability/metrics';
312
349
 
313
350
  const ordersCounter = createCounter('orders_total');
314
351
  const latencyHistogram = createHistogram('request_duration_seconds');
315
352
 
316
353
  ordersCounter.add(1, { status: 'success' });
317
- latencyHistogram.record(0.123);`})]}),q("div",{className:"space-y-4",children:[N("h2",{className:"font-bold text-2xl",children:"Middleware"}),N("p",{className:"text-muted-foreground",children:"Automatically instrument your HTTP handlers:"}),N(ae,{language:"typescript",code:`import { createTracingMiddleware } from '@contractspec/lib.observability/tracing/middleware';
354
+ latencyHistogram.record(0.123);`})]}),V("div",{className:"space-y-4",children:[N("h2",{className:"font-bold text-2xl",children:"Middleware"}),N("p",{className:"text-muted-foreground",children:"Automatically instrument your HTTP handlers:"}),N(ie,{language:"typescript",code:`import { createTracingMiddleware } from '@contractspec/lib.observability/tracing/middleware';
318
355
 
319
- app.use(createTracingMiddleware());`})]}),q("div",{className:"space-y-4",children:[N("h2",{className:"font-bold text-2xl",children:"Anomaly Detection"}),N("p",{className:"text-muted-foreground text-sm",children:"Includes baseline calculation and anomaly detection helpers for auto-rollback without writing custom math."}),N(ae,{language:"typescript",code:`import { AnomalyDetector, RootCauseAnalyzer, AlertManager } from '@contractspec/lib.observability';
356
+ app.use(createTracingMiddleware());`})]}),V("div",{className:"space-y-4",children:[N("h2",{className:"font-bold text-2xl",children:"Anomaly Detection"}),N("p",{className:"text-muted-foreground text-sm",children:"Includes baseline calculation and anomaly detection helpers for auto-rollback without writing custom math."}),N(ie,{language:"typescript",code:`import { AnomalyDetector, RootCauseAnalyzer, AlertManager } from '@contractspec/lib.observability';
320
357
 
321
358
  const detector = new AnomalyDetector({ errorRateDelta: 0.4 });
322
359
  const analyzer = new RootCauseAnalyzer();
@@ -326,7 +363,7 @@ const signals = detector.evaluate(point);
326
363
  signals.forEach((signal) => {
327
364
  const analysis = analyzer.analyze(signal, recentDeployments);
328
365
  alertManager.notify(signal, analysis);
329
- });`})]}),q("div",{className:"flex items-center gap-4 pt-4",children:[N(Te,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),q(Te,{href:"/docs/libraries/slo",className:"btn-primary",children:["Next: SLO ",N(zt,{size:16})]})]})]})}import{CodeBlock as ne,InstallCommand as Dt}from"@contractspec/lib.design-system";import Ae from"@contractspec/lib.ui-link";import{ChevronRight as Wt}from"lucide-react";import{jsx as I,jsxs as Y}from"react/jsx-runtime";function Gt(){return Y("div",{className:"space-y-8",children:[Y("div",{className:"space-y-4",children:[I("h1",{className:"font-bold text-4xl",children:"Overlay Engine"}),I("p",{className:"text-lg text-muted-foreground",children:"`@contractspec/lib.overlay-engine` keeps OverlaySpecs typed, signed, and auditable across tenants, roles, users, and devices."})]}),Y("div",{className:"space-y-4",children:[I("h2",{className:"font-bold text-2xl",children:"Installation"}),I(Dt,{package:"@contractspec/lib.overlay-engine"})]}),Y("div",{className:"space-y-4",children:[I("h2",{className:"font-bold text-2xl",children:"Define + Sign"}),I(ne,{language:"typescript",code:`import { defineOverlay } from '@contractspec/lib.overlay-engine/spec';
366
+ });`})]}),V("div",{className:"flex items-center gap-4 pt-4",children:[N(Be,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),V(Be,{href:"/docs/libraries/slo",className:"btn-primary",children:["Next: SLO ",N(Ft,{size:16})]})]})]})}import{CodeBlock as se,InstallCommand as Ut}from"@contractspec/lib.design-system";import Oe from"@contractspec/lib.ui-link";import{ChevronRight as Vt}from"lucide-react";import{jsx as I,jsxs as Y}from"react/jsx-runtime";function Ht(){return Y("div",{className:"space-y-8",children:[Y("div",{className:"space-y-4",children:[I("h1",{className:"font-bold text-4xl",children:"Overlay Engine"}),I("p",{className:"text-lg text-muted-foreground",children:"`@contractspec/lib.overlay-engine` keeps OverlaySpecs typed, signed, and auditable across tenants, roles, users, and devices."})]}),Y("div",{className:"space-y-4",children:[I("h2",{className:"font-bold text-2xl",children:"Installation"}),I(Ut,{package:"@contractspec/lib.overlay-engine"})]}),Y("div",{className:"space-y-4",children:[I("h2",{className:"font-bold text-2xl",children:"Define + Sign"}),I(se,{language:"typescript",code:`import { defineOverlay } from '@contractspec/lib.overlay-engine/spec';
330
367
  import { signOverlay } from '@contractspec/lib.overlay-engine/signer';
331
368
 
332
369
  const overlay = defineOverlay({
@@ -336,7 +373,7 @@ const overlay = defineOverlay({
336
373
  modifications: [{ type: 'hideField', field: 'internalNotes' }],
337
374
  });
338
375
 
339
- const signed = await signOverlay(overlay, privateKeyPem);`})]}),Y("div",{className:"space-y-4",children:[I("h2",{className:"font-bold text-2xl",children:"Runtime"}),I("p",{className:"text-muted-foreground",children:"`OverlayRegistry` stores signed overlays with specificity scoring. `OverlayEngine` merges modifications and emits audit events."}),I(ne,{language:"typescript",code:`const registry = new OverlayRegistry();
376
+ const signed = await signOverlay(overlay, privateKeyPem);`})]}),Y("div",{className:"space-y-4",children:[I("h2",{className:"font-bold text-2xl",children:"Runtime"}),I("p",{className:"text-muted-foreground",children:"`OverlayRegistry` stores signed overlays with specificity scoring. `OverlayEngine` merges modifications and emits audit events."}),I(se,{language:"typescript",code:`const registry = new OverlayRegistry();
340
377
  registry.register(signed);
341
378
 
342
379
  const engine = new OverlayEngine({
@@ -348,13 +385,13 @@ const result = engine.apply({
348
385
  target: { fields },
349
386
  capability: 'billing.createOrder',
350
387
  tenantId: 'acme',
351
- });`})]}),Y("div",{className:"space-y-4",children:[I("h2",{className:"font-bold text-2xl",children:"React Hooks"}),I("p",{className:"text-muted-foreground",children:"Render overlays in React/React Native via `useOverlay`."}),I(ne,{language:"typescript",code:`import { useOverlay } from '@contractspec/lib.overlay-engine/react';
388
+ });`})]}),Y("div",{className:"space-y-4",children:[I("h2",{className:"font-bold text-2xl",children:"React Hooks"}),I("p",{className:"text-muted-foreground",children:"Render overlays in React/React Native via `useOverlay`."}),I(se,{language:"typescript",code:`import { useOverlay } from '@contractspec/lib.overlay-engine/react';
352
389
 
353
390
  const { target } = useOverlay(engine, {
354
391
  target: { fields },
355
392
  capability: 'billing.createOrder',
356
393
  tenantId: 'acme',
357
- });`})]}),Y("div",{className:"flex items-center gap-4 pt-4",children:[I(Ae,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),Y(Ae,{href:"/docs/libraries/workflow-composer",className:"btn-primary",children:["Next: Workflow Composer ",I(Wt,{size:16})]})]})]})}import Ft from"@contractspec/lib.ui-link";import{ChevronRight as Ut}from"lucide-react";import{jsx as B,jsxs as X}from"react/jsx-runtime";var qt=[{title:"Contract and schema foundation",body:"Use these packages to define explicit contracts, schemas, and generated artifacts without inventing a new platform-specific language.",items:[{title:"@contractspec/lib.contracts-spec",description:"Define operations, events, policies, and generated surfaces in TypeScript.",href:"/docs/libraries/contracts"},{title:"@contractspec/lib.schema",description:"Share type-safe schema definitions across validation, clients, and runtime adapters.",href:"/docs/libraries/schema"}]},{title:"Runtime and surface libraries",body:"These packages execute the contract model across UI, data, observability, workflows, and generated runtime behavior.",items:[{title:"@contractspec/lib.runtime",description:"Run typed capability surfaces, execute policies, and connect runtime adapters.",href:"/docs/libraries/runtime"},{title:"@contractspec/lib.ui-kit",description:"Render shared surfaces across web and React Native without forking the contract layer.",href:"/docs/libraries/ui-kit"},{title:"@contractspec/lib.design-system",description:"Build higher-level product surfaces and documented marketing/docs primitives on top of the UI kit.",href:"/docs/libraries/design-system"},{title:"@contractspec/lib.data-views",description:"Generate and render list/detail style surfaces that stay aligned with data contracts.",href:"/docs/libraries/data-views"}]},{title:"Operator and system packages",body:"These packages matter once the system is live and you need governance, resilience, and observability.",items:[{title:"@contractspec/lib.observability",description:"Trace, log, and measure contract execution using the same system boundaries.",href:"/docs/libraries/observability"},{title:"@contractspec/lib.resilience",description:"Add circuit breakers, retries, and failure controls without hiding the integration model.",href:"/docs/libraries/resilience"},{title:"@contractspec/lib.multi-tenancy",description:"Keep tenant-specific config, policy, and surface resolution explicit.",href:"/docs/libraries/multi-tenancy"},{title:"@contractspec/lib.workflow-composer",description:"Compose and extend workflows without smearing orchestration concerns across apps.",href:"/docs/libraries/workflow-composer"}]}];function _t(){return X("div",{className:"space-y-10",children:[X("div",{className:"space-y-3",children:[B("p",{className:"editorial-kicker",children:"Build"}),B("h1",{className:"font-serif text-4xl tracking-[-0.04em] md:text-5xl",children:"The OSS foundation is a library system, not a closed platform."}),B("p",{className:"max-w-3xl text-lg text-muted-foreground leading-8",children:"ContractSpec is assembled from libraries that remain useful on their own and stronger together. Start with the contract and schema foundation, then add runtime, UI, integration, and operator packages as your system grows."})]}),X("div",{className:"editorial-proof-strip",children:[X("div",{className:"editorial-stat",children:[B("span",{className:"editorial-label",children:"Layering rule"}),B("span",{className:"editorial-stat-value",children:"libs \u2192 bundles \u2192 apps"})]}),B("p",{className:"max-w-2xl text-muted-foreground text-sm leading-7",children:"Keep reusable behavior in libraries, compose it into bundle-level surfaces, and reserve app packages for concrete delivery shells."})]}),B("div",{className:"space-y-6",children:qt.map((E)=>X("section",{className:"editorial-panel space-y-5",children:[X("div",{className:"space-y-2",children:[B("h2",{className:"font-serif text-3xl tracking-[-0.03em]",children:E.title}),B("p",{className:"text-muted-foreground text-sm leading-7",children:E.body})]}),B("div",{className:"grid gap-4 md:grid-cols-2",children:E.items.map((te)=>X(Ft,{href:te.href,className:"rounded-[24px] border border-border/75 bg-background/70 p-5 transition-colors hover:border-[color:rgb(162_79_42_/_0.45)]",children:[B("h3",{className:"font-semibold text-lg",children:te.title}),B("p",{className:"mt-2 text-muted-foreground text-sm leading-7",children:te.description}),X("div",{className:"mt-3 flex items-center gap-2 text-[color:var(--rust)] text-sm",children:["Learn more ",B(Ut,{size:14})]})]},te.title))})]},E.title))})]})}import{CodeBlock as ce,InstallCommand as Ht}from"@contractspec/lib.design-system";import Be from"@contractspec/lib.ui-link";import{ChevronRight as Vt}from"lucide-react";import{jsx as w,jsxs as $}from"react/jsx-runtime";function Qt(){return $("div",{className:"space-y-8",children:[$("div",{className:"space-y-4",children:[w("h1",{className:"font-bold text-4xl",children:"@contractspec/lib.personalization"}),w("p",{className:"text-lg text-muted-foreground",children:"Track field/feature/workflow usage, analyze drop-offs, and convert insights into OverlaySpecs or workflow tweaks."})]}),$("div",{className:"space-y-4",children:[w("h2",{className:"font-bold text-2xl",children:"Installation"}),w(Ht,{package:"@contractspec/lib.personalization"})]}),$("div",{className:"space-y-4",children:[w("h2",{className:"font-bold text-2xl",children:"Tracker"}),w("p",{className:"text-muted-foreground",children:"Buffer events per tenant/user and emit OpenTelemetry counters automatically."}),w(ce,{language:"typescript",code:`import { createBehaviorTracker } from '@contractspec/lib.personalization';
394
+ });`})]}),Y("div",{className:"flex items-center gap-4 pt-4",children:[I(Oe,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),Y(Oe,{href:"/docs/libraries/workflow-composer",className:"btn-primary",children:["Next: Workflow Composer ",I(Vt,{size:16})]})]})]})}import qt from"@contractspec/lib.ui-link";import{ChevronRight as Qt}from"lucide-react";import{jsx as P,jsxs as x}from"react/jsx-runtime";var Kt=[{title:"Contract and schema foundation",body:"Use these packages to define explicit contracts, schemas, and generated artifacts without inventing a new platform-specific language.",items:[{title:"@contractspec/lib.contracts-spec",description:"Define operations, events, policies, and generated surfaces in TypeScript.",href:"/docs/libraries/contracts"},{title:"@contractspec/lib.schema",description:"Share type-safe schema definitions across validation, clients, and runtime adapters.",href:"/docs/libraries/schema"}]},{title:"Runtime and surface libraries",body:"These packages execute the contract model across UI, data, observability, workflows, and generated runtime behavior.",items:[{title:"@contractspec/lib.runtime",description:"Run typed capability surfaces, execute policies, and connect runtime adapters.",href:"/docs/libraries/runtime"},{title:"@contractspec/lib.ui-kit",description:"Render shared surfaces across web and React Native without forking the contract layer.",href:"/docs/libraries/ui-kit"},{title:"@contractspec/lib.ui-kit-web",description:"Use the raw web primitive layer directly when you want the browser table, accessibility, and interaction model without the design-system shell.",href:"/docs/libraries/ui-kit-web"},{title:"@contractspec/lib.design-system",description:"Build higher-level product surfaces and documented marketing/docs primitives on top of the web and native UI packages.",href:"/docs/libraries/design-system"},{title:"@contractspec/lib.data-views",description:"Generate and render list/detail style surfaces that stay aligned with data contracts.",href:"/docs/libraries/data-views"}]},{title:"Operator and system packages",body:"These packages matter once the system is live and you need governance, resilience, and observability.",items:[{title:"@contractspec/lib.observability",description:"Trace, log, and measure contract execution using the same system boundaries.",href:"/docs/libraries/observability"},{title:"@contractspec/lib.resilience",description:"Add circuit breakers, retries, and failure controls without hiding the integration model.",href:"/docs/libraries/resilience"},{title:"@contractspec/lib.multi-tenancy",description:"Keep tenant-specific config, policy, and surface resolution explicit.",href:"/docs/libraries/multi-tenancy"},{title:"@contractspec/lib.workflow-composer",description:"Compose and extend workflows without smearing orchestration concerns across apps.",href:"/docs/libraries/workflow-composer"}]}];function Jt(){return x("div",{className:"space-y-10",children:[x("div",{className:"space-y-3",children:[P("p",{className:"editorial-kicker",children:"Build"}),P("h1",{className:"font-serif text-4xl tracking-[-0.04em] md:text-5xl",children:"The OSS foundation is a library system, not a closed platform."}),P("p",{className:"max-w-3xl text-lg text-muted-foreground leading-8",children:"ContractSpec is assembled from libraries that remain useful on their own and stronger together. Start with the contract and schema foundation, then add runtime, UI, integration, and operator packages as your system grows."})]}),x("div",{className:"editorial-proof-strip",children:[x("div",{className:"editorial-stat",children:[P("span",{className:"editorial-label",children:"Layering rule"}),P("span",{className:"editorial-stat-value",children:"libs \u2192 bundles \u2192 apps"})]}),P("p",{className:"max-w-2xl text-muted-foreground text-sm leading-7",children:"Keep reusable behavior in libraries, compose it into bundle-level surfaces, and reserve app packages for concrete delivery shells."})]}),P("div",{className:"space-y-6",children:Kt.map((E)=>x("section",{className:"editorial-panel space-y-5",children:[x("div",{className:"space-y-2",children:[P("h2",{className:"font-serif text-3xl tracking-[-0.03em]",children:E.title}),P("p",{className:"text-muted-foreground text-sm leading-7",children:E.body})]}),P("div",{className:"grid gap-4 md:grid-cols-2",children:E.items.map((oe)=>x(qt,{href:oe.href,className:"rounded-[24px] border border-border/75 bg-background/70 p-5 transition-colors hover:border-[color:rgb(162_79_42_/_0.45)]",children:[P("h3",{className:"font-semibold text-lg",children:oe.title}),P("p",{className:"mt-2 text-muted-foreground text-sm leading-7",children:oe.description}),x("div",{className:"mt-3 flex items-center gap-2 text-[color:var(--rust)] text-sm",children:["Learn more ",P(Qt,{size:14})]})]},oe.title))})]},E.title))})]})}import{CodeBlock as de,InstallCommand as Zt}from"@contractspec/lib.design-system";import De from"@contractspec/lib.ui-link";import{ChevronRight as Xt}from"lucide-react";import{jsx as k,jsxs as j}from"react/jsx-runtime";function $t(){return j("div",{className:"space-y-8",children:[j("div",{className:"space-y-4",children:[k("h1",{className:"font-bold text-4xl",children:"@contractspec/lib.personalization"}),k("p",{className:"text-lg text-muted-foreground",children:"Track field/feature/workflow usage, analyze drop-offs, and convert insights into OverlaySpecs or workflow tweaks."})]}),j("div",{className:"space-y-4",children:[k("h2",{className:"font-bold text-2xl",children:"Installation"}),k(Zt,{package:"@contractspec/lib.personalization"})]}),j("div",{className:"space-y-4",children:[k("h2",{className:"font-bold text-2xl",children:"Tracker"}),k("p",{className:"text-muted-foreground",children:"Buffer events per tenant/user and emit OpenTelemetry counters automatically."}),k(de,{language:"typescript",code:`import { createBehaviorTracker } from '@contractspec/lib.personalization';
358
395
 
359
396
  const tracker = createBehaviorTracker({
360
397
  store,
@@ -362,17 +399,17 @@ const tracker = createBehaviorTracker({
362
399
  });
363
400
 
364
401
  tracker.trackFieldAccess({ operation: 'billing.createOrder', field: 'items' });
365
- tracker.trackWorkflowStep({ workflow: 'invoice', step: 'review', status: 'entered' });`})]}),$("div",{className:"space-y-4",children:[w("h2",{className:"font-bold text-2xl",children:"Analyzer"}),w("p",{className:"text-muted-foreground",children:"Summarize events and highlight unused UI, frequent fields, and workflow bottlenecks."}),w(ce,{language:"typescript",code:`import { BehaviorAnalyzer } from '@contractspec/lib.personalization/analyzer';
402
+ tracker.trackWorkflowStep({ workflow: 'invoice', step: 'review', status: 'entered' });`})]}),j("div",{className:"space-y-4",children:[k("h2",{className:"font-bold text-2xl",children:"Analyzer"}),k("p",{className:"text-muted-foreground",children:"Summarize events and highlight unused UI, frequent fields, and workflow bottlenecks."}),k(de,{language:"typescript",code:`import { BehaviorAnalyzer } from '@contractspec/lib.personalization/analyzer';
366
403
 
367
404
  const analyzer = new BehaviorAnalyzer(store);
368
405
  const insights = await analyzer.analyze({ tenantId: 'acme', userId: 'ops-42' });
369
- // { unusedFields: ['internalNotes'], workflowBottlenecks: [...] }`})]}),$("div",{className:"space-y-4",children:[w("h2",{className:"font-bold text-2xl",children:"Adapter"}),w("p",{className:"text-muted-foreground",children:"Convert insights into overlays or workflow extension hints."}),w(ce,{language:"typescript",code:`import { insightsToOverlaySuggestion } from '@contractspec/lib.personalization/adapter';
406
+ // { unusedFields: ['internalNotes'], workflowBottlenecks: [...] }`})]}),j("div",{className:"space-y-4",children:[k("h2",{className:"font-bold text-2xl",children:"Adapter"}),k("p",{className:"text-muted-foreground",children:"Convert insights into overlays or workflow extension hints."}),k(de,{language:"typescript",code:`import { insightsToOverlaySuggestion } from '@contractspec/lib.personalization/adapter';
370
407
 
371
408
  const overlay = insightsToOverlaySuggestion(insights, {
372
409
  overlayId: 'acme-order-form',
373
410
  tenantId: 'acme',
374
411
  capability: 'billing.createOrder',
375
- });`})]}),$("div",{className:"flex items-center gap-4 pt-4",children:[w(Be,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),$(Be,{href:"/docs/libraries/overlay-engine",className:"btn-primary",children:["Next: Overlay Engine ",w(Vt,{size:16})]})]})]})}import{CodeBlock as Pe,InstallCommand as Kt}from"@contractspec/lib.design-system";import Oe from"@contractspec/lib.ui-link";import{ChevronRight as Zt}from"lucide-react";import{jsx as C,jsxs as W}from"react/jsx-runtime";function Jt(){return W("div",{className:"space-y-8",children:[W("div",{className:"space-y-4",children:[C("h1",{className:"font-bold text-4xl",children:"Progressive Delivery Library"}),W("p",{className:"text-lg text-muted-foreground",children:["The ",C("code",{children:"@contractspec/lib.progressive-delivery"})," package helps you ship new specs with confidence: canary + blue-green strategies, metric guardrails, and rollback hooks in one place."]})]}),W("div",{className:"space-y-4",children:[C("h2",{className:"font-bold text-2xl",children:"Installation"}),C(Kt,{package:"@contractspec/lib.progressive-delivery"})]}),W("div",{className:"space-y-4",children:[C("h2",{className:"font-bold text-2xl",children:"Define a Strategy"}),C(Pe,{language:"typescript",code:`import { DeploymentCoordinator, createDefaultCanaryController, TrafficShifter, RollbackManager } from '@contractspec/lib.progressive-delivery';
412
+ });`})]}),j("div",{className:"flex items-center gap-4 pt-4",children:[k(De,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),j(De,{href:"/docs/libraries/overlay-engine",className:"btn-primary",children:["Next: Overlay Engine ",k(Xt,{size:16})]})]})]})}import{CodeBlock as Ee,InstallCommand as Yt}from"@contractspec/lib.design-system";import Me from"@contractspec/lib.ui-link";import{ChevronRight as xt}from"lucide-react";import{jsx as S,jsxs as G}from"react/jsx-runtime";function jt(){return G("div",{className:"space-y-8",children:[G("div",{className:"space-y-4",children:[S("h1",{className:"font-bold text-4xl",children:"Progressive Delivery Library"}),G("p",{className:"text-lg text-muted-foreground",children:["The ",S("code",{children:"@contractspec/lib.progressive-delivery"})," package helps you ship new specs with confidence: canary + blue-green strategies, metric guardrails, and rollback hooks in one place."]})]}),G("div",{className:"space-y-4",children:[S("h2",{className:"font-bold text-2xl",children:"Installation"}),S(Yt,{package:"@contractspec/lib.progressive-delivery"})]}),G("div",{className:"space-y-4",children:[S("h2",{className:"font-bold text-2xl",children:"Define a Strategy"}),S(Ee,{language:"typescript",code:`import { DeploymentCoordinator, createDefaultCanaryController, TrafficShifter, RollbackManager } from '@contractspec/lib.progressive-delivery';
376
413
 
377
414
  const strategy = {
378
415
  target: { name: 'billing.createInvoice', version: 7 },
@@ -382,7 +419,7 @@ const strategy = {
382
419
  latencyP99: 500,
383
420
  latencyP95: 250,
384
421
  },
385
- };`})]}),W("div",{className:"space-y-4",children:[C("h2",{className:"font-bold text-2xl",children:"Run the Coordinator"}),C(Pe,{language:"typescript",code:`const eventBus = new DeploymentEventBus();
422
+ };`})]}),G("div",{className:"space-y-4",children:[S("h2",{className:"font-bold text-2xl",children:"Run the Coordinator"}),S(Ee,{language:"typescript",code:`const eventBus = new DeploymentEventBus();
386
423
  const controller = createDefaultCanaryController(strategy, fetchMetrics, eventBus);
387
424
  const coordinator = new DeploymentCoordinator({
388
425
  strategy,
@@ -393,7 +430,7 @@ const coordinator = new DeploymentCoordinator({
393
430
  eventBus,
394
431
  });
395
432
 
396
- const result = await coordinator.run();`}),W("p",{className:"text-muted-foreground text-sm",children:["The coordinator emits ",C("code",{children:"stage_started"}),","," ",C("code",{children:"stage_failed"}),", and ",C("code",{children:"rolled_back"})," events, making it easy to power dashboards or alerting workflows."]})]}),W("div",{className:"space-y-4",children:[C("h2",{className:"font-bold text-2xl",children:"Blue-Green Swap"}),W("p",{className:"text-muted-foreground text-sm",children:["Switch to ",C("code",{children:"mode: 'blue-green'"})," to warm up the new stack in parallel and cut over once smoke tests pass. The same guardrails apply before the final swap."]})]}),W("div",{className:"flex items-center gap-4 pt-4",children:[C(Oe,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),W(Oe,{href:"/docs/libraries/resilience",className:"btn-primary",children:["Next: Resilience ",C(Zt,{size:16})]})]})]})}import{CodeBlock as le,InstallCommand as Yt}from"@contractspec/lib.design-system";import Ee from"@contractspec/lib.ui-link";import{ChevronRight as Xt}from"lucide-react";import{jsx as S,jsxs as K}from"react/jsx-runtime";function $t(){return K("div",{className:"space-y-8",children:[K("div",{className:"space-y-4",children:[S("h1",{className:"font-bold text-4xl",children:"Resilience Library"}),K("p",{className:"text-lg text-muted-foreground",children:["The ",S("code",{children:"@contractspec/lib.resilience"})," library provides primitives to handle failures gracefully."]})]}),K("div",{className:"space-y-4",children:[S("h2",{className:"font-bold text-2xl",children:"Installation"}),S(Yt,{package:"@contractspec/lib.resilience"})]}),K("div",{className:"space-y-4",children:[S("h2",{className:"font-bold text-2xl",children:"Circuit Breaker"}),S("p",{className:"text-muted-foreground",children:"Prevent cascading failures by stopping calls to a failing dependency."}),S(le,{language:"typescript",code:`import { CircuitBreaker } from '@contractspec/lib.resilience/circuit-breaker';
433
+ const result = await coordinator.run();`}),G("p",{className:"text-muted-foreground text-sm",children:["The coordinator emits ",S("code",{children:"stage_started"}),","," ",S("code",{children:"stage_failed"}),", and ",S("code",{children:"rolled_back"})," events, making it easy to power dashboards or alerting workflows."]})]}),G("div",{className:"space-y-4",children:[S("h2",{className:"font-bold text-2xl",children:"Blue-Green Swap"}),G("p",{className:"text-muted-foreground text-sm",children:["Switch to ",S("code",{children:"mode: 'blue-green'"})," to warm up the new stack in parallel and cut over once smoke tests pass. The same guardrails apply before the final swap."]})]}),G("div",{className:"flex items-center gap-4 pt-4",children:[S(Me,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),G(Me,{href:"/docs/libraries/resilience",className:"btn-primary",children:["Next: Resilience ",S(xt,{size:16})]})]})]})}import{CodeBlock as pe,InstallCommand as ea}from"@contractspec/lib.design-system";import ze from"@contractspec/lib.ui-link";import{ChevronRight as ta}from"lucide-react";import{jsx as C,jsxs as J}from"react/jsx-runtime";function aa(){return J("div",{className:"space-y-8",children:[J("div",{className:"space-y-4",children:[C("h1",{className:"font-bold text-4xl",children:"Resilience Library"}),J("p",{className:"text-lg text-muted-foreground",children:["The ",C("code",{children:"@contractspec/lib.resilience"})," library provides primitives to handle failures gracefully."]})]}),J("div",{className:"space-y-4",children:[C("h2",{className:"font-bold text-2xl",children:"Installation"}),C(ea,{package:"@contractspec/lib.resilience"})]}),J("div",{className:"space-y-4",children:[C("h2",{className:"font-bold text-2xl",children:"Circuit Breaker"}),C("p",{className:"text-muted-foreground",children:"Prevent cascading failures by stopping calls to a failing dependency."}),C(pe,{language:"typescript",code:`import { CircuitBreaker } from '@contractspec/lib.resilience/circuit-breaker';
397
434
 
398
435
  const breaker = new CircuitBreaker({
399
436
  failureThreshold: 5,
@@ -402,19 +439,19 @@ const breaker = new CircuitBreaker({
402
439
 
403
440
  const result = await breaker.execute(async () => {
404
441
  return await fetch('https://api.stripe.com/v1/charges');
405
- });`})]}),K("div",{className:"space-y-4",children:[S("h2",{className:"font-bold text-2xl",children:"Retry"}),S("p",{className:"text-muted-foreground",children:"Automatically retry transient failures with exponential backoff."}),S(le,{language:"typescript",code:`import { retry } from '@contractspec/lib.resilience/retry';
442
+ });`})]}),J("div",{className:"space-y-4",children:[C("h2",{className:"font-bold text-2xl",children:"Retry"}),C("p",{className:"text-muted-foreground",children:"Automatically retry transient failures with exponential backoff."}),C(pe,{language:"typescript",code:`import { retry } from '@contractspec/lib.resilience/retry';
406
443
 
407
444
  const result = await retry(
408
445
  async () => fetchUser(id),
409
446
  3, // retries
410
447
  1000, // initial delay
411
448
  true // backoff
412
- );`})]}),K("div",{className:"space-y-4",children:[S("h2",{className:"font-bold text-2xl",children:"Timeout & Fallback"}),S("p",{className:"text-muted-foreground",children:"Set hard limits on execution time and provide default values on failure."}),S(le,{language:"typescript",code:`import { timeout, fallback } from '@contractspec/lib.resilience';
449
+ );`})]}),J("div",{className:"space-y-4",children:[C("h2",{className:"font-bold text-2xl",children:"Timeout & Fallback"}),C("p",{className:"text-muted-foreground",children:"Set hard limits on execution time and provide default values on failure."}),C(pe,{language:"typescript",code:`import { timeout, fallback } from '@contractspec/lib.resilience';
413
450
 
414
451
  const result = await fallback(
415
452
  () => timeout(slowOperation, 5000),
416
453
  defaultValue
417
- );`})]}),K("div",{className:"flex items-center gap-4 pt-4",children:[S(Ee,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),K(Ee,{href:"/docs/libraries/testing",className:"btn-primary",children:["Next: Testing ",S(Xt,{size:16})]})]})]})}import{CodeBlock as xt,InstallCommand as jt}from"@contractspec/lib.design-system";import ze from"@contractspec/lib.ui-link";import{ChevronRight as ea}from"lucide-react";import{jsx as d,jsxs as p}from"react/jsx-runtime";function ta(){return p("div",{className:"space-y-8",children:[p("div",{className:"space-y-4",children:[d("h1",{className:"font-bold text-4xl",children:"Runtime Libraries"}),d("p",{className:"text-muted-foreground",children:"The presentation runtime libraries provide the engine for rendering ContractSpec-defined UIs. They handle state management, validation, step navigation, and component rendering for Workflows and DataViews."})]}),p("div",{className:"space-y-4",children:[d("h2",{className:"font-bold text-2xl",children:"Installation"}),d(jt,{package:"@contractspec/lib.presentation-runtime-react"})]}),p("div",{className:"space-y-4",children:[d("h2",{className:"font-bold text-2xl",children:"Libraries"}),p("div",{className:"space-y-6",children:[p("div",{className:"card-subtle p-6",children:[d("h3",{className:"font-bold text-lg",children:"@contractspec/lib.presentation-runtime-core"}),p("p",{className:"mt-2 text-muted-foreground text-sm",children:[d("strong",{children:"Framework-Agnostic Core"}),". Contains the state machines, validation logic, and navigation rules for workflows. Can be used to build renderers for any platform (Vue, Svelte, CLI)."]})]}),p("div",{className:"card-subtle p-6",children:[d("h3",{className:"font-bold text-lg",children:"@contractspec/lib.presentation-runtime-react"}),p("p",{className:"mt-2 text-muted-foreground text-sm",children:[d("strong",{children:"React Bindings"}),". Hooks (`useWorkflow`) and components (`WorkflowStepper`, `WorkflowStepRenderer`) for React Web applications. Integrates with `ui-kit-web`."]})]}),p("div",{className:"card-subtle p-6",children:[d("h3",{className:"font-bold text-lg",children:"@contractspec/lib.presentation-runtime-react-native"}),p("p",{className:"mt-2 text-muted-foreground text-sm",children:[d("strong",{children:"React Native Bindings"}),". Optimized for mobile experiences. Handles native navigation integration and uses universal components from `ui-kit`."]})]})]})]}),p("div",{className:"space-y-4",children:[d("h2",{className:"font-bold text-2xl",children:"Example: React Workflow"}),d(xt,{language:"tsx",code:`import { useWorkflow, WorkflowStepRenderer } from '@contractspec/lib.presentation-runtime-react';
454
+ );`})]}),J("div",{className:"flex items-center gap-4 pt-4",children:[C(ze,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),J(ze,{href:"/docs/libraries/testing",className:"btn-primary",children:["Next: Testing ",C(ta,{size:16})]})]})]})}import{CodeBlock as oa,InstallCommand as ia}from"@contractspec/lib.design-system";import We from"@contractspec/lib.ui-link";import{ChevronRight as ra}from"lucide-react";import{jsx as d,jsxs as m}from"react/jsx-runtime";function na(){return m("div",{className:"space-y-8",children:[m("div",{className:"space-y-4",children:[d("h1",{className:"font-bold text-4xl",children:"Runtime Libraries"}),d("p",{className:"text-muted-foreground",children:"The presentation runtime libraries provide the engine for rendering ContractSpec-defined UIs. They handle state management, validation, step navigation, and component rendering for Workflows and DataViews."})]}),m("div",{className:"space-y-4",children:[d("h2",{className:"font-bold text-2xl",children:"Installation"}),d(ia,{package:"@contractspec/lib.presentation-runtime-react"})]}),m("div",{className:"space-y-4",children:[d("h2",{className:"font-bold text-2xl",children:"Libraries"}),m("div",{className:"space-y-6",children:[m("div",{className:"card-subtle p-6",children:[d("h3",{className:"font-bold text-lg",children:"@contractspec/lib.presentation-runtime-core"}),m("p",{className:"mt-2 text-muted-foreground text-sm",children:[d("strong",{children:"Framework-Agnostic Core"}),". Contains the state machines, validation logic, and navigation rules for workflows. Can be used to build renderers for any platform (Vue, Svelte, CLI)."]})]}),m("div",{className:"card-subtle p-6",children:[d("h3",{className:"font-bold text-lg",children:"@contractspec/lib.presentation-runtime-react"}),m("p",{className:"mt-2 text-muted-foreground text-sm",children:[d("strong",{children:"React Bindings"}),". Hooks (`useWorkflow`) and components (`WorkflowStepper`, `WorkflowStepRenderer`) for React Web applications. Integrates with `ui-kit-web`."]})]}),m("div",{className:"card-subtle p-6",children:[d("h3",{className:"font-bold text-lg",children:"@contractspec/lib.presentation-runtime-react-native"}),m("p",{className:"mt-2 text-muted-foreground text-sm",children:[d("strong",{children:"React Native Bindings"}),". Optimized for mobile experiences. Handles native navigation integration and uses universal components from `ui-kit`."]})]})]})]}),m("div",{className:"space-y-4",children:[d("h2",{className:"font-bold text-2xl",children:"Example: React Workflow"}),d(oa,{language:"tsx",code:`import { useWorkflow, WorkflowStepRenderer } from '@contractspec/lib.presentation-runtime-react';
418
455
  import { OnboardingFlow } from './specs/onboarding';
419
456
 
420
457
  export function OnboardingPage() {
@@ -454,7 +491,7 @@ export function OnboardingPage() {
454
491
  </div>
455
492
  </div>
456
493
  );
457
- }`})]}),p("div",{className:"space-y-4",children:[d("h2",{className:"font-bold text-2xl",children:"Architecture"}),d("p",{className:"text-muted-foreground",children:'The runtime follows a "render-loop" pattern:'}),p("ol",{className:"list-inside list-decimal space-y-2 text-muted-foreground",children:[p("li",{children:[d("strong",{children:"Spec"}),": Defines the flow, fields, and validation rules."]}),p("li",{children:[d("strong",{children:"Core"}),": Tracks current step, data state, and validation errors."]}),p("li",{children:[d("strong",{children:"Renderer"}),": Maps spec fields to UI components (Input, Select, etc.)."]}),p("li",{children:[d("strong",{children:"User"}),": Interacts with components, updating core state."]}),p("li",{children:[d("strong",{children:"Policy"}),": (Optional) Re-evaluates visibility on every change."]})]})]}),p("div",{className:"flex items-center gap-4 pt-4",children:[d(ze,{href:"/docs/libraries/data-backend",className:"btn-ghost",children:"Previous: Data & Backend"}),p(ze,{href:"/docs/libraries",className:"btn-primary",children:["Back to Libraries ",d(ea,{size:16})]})]})]})}import{CodeBlock as Me,InstallCommand as aa}from"@contractspec/lib.design-system";import De from"@contractspec/lib.ui-link";import{ChevronRight as oa}from"lucide-react";import{jsx as e,jsxs as s}from"react/jsx-runtime";function ia(){return s("div",{className:"space-y-8",children:[s("div",{className:"space-y-4",children:[e("h1",{className:"font-bold text-4xl",children:"@contractspec/lib.schema"}),e("p",{className:"text-muted-foreground",children:"A small schema dictionary to describe operation I/O once and export to Zod (runtime validation), Pothos (GraphQL type refs), and JSON Schema."})]}),s("div",{className:"space-y-4",children:[e("h2",{className:"font-bold text-2xl",children:"Installation"}),e(aa,{package:"@contractspec/lib.schema"})]}),s("div",{className:"space-y-4",children:[e("h2",{className:"font-bold text-2xl",children:"Core Exports"}),s("ul",{className:"space-y-2 text-muted-foreground",children:[s("li",{children:[e("code",{className:"rounded bg-background/50 px-2 py-1",children:"SchemaModel"}),": Compose fields into typed object models"]}),s("li",{children:[e("code",{className:"rounded bg-background/50 px-2 py-1",children:"ScalarTypeEnum"}),": Common scalar types (NonEmptyString, Email, DateTime, etc.)"]}),s("li",{children:[e("code",{className:"rounded bg-background/50 px-2 py-1",children:"defineEnum"}),": Create type-safe enums"]}),s("li",{children:[e("code",{className:"rounded bg-background/50 px-2 py-1",children:"FieldType"}),": Wrap scalars with Zod/GraphQL/JSON Schema"]})]})]}),s("div",{className:"space-y-4",children:[e("h2",{className:"font-bold text-2xl",children:"Example: Basic Schema"}),e(Me,{language:"typescript",code:`import { SchemaModel, ScalarTypeEnum } from '@contractspec/lib.schema';
494
+ }`})]}),m("div",{className:"space-y-4",children:[d("h2",{className:"font-bold text-2xl",children:"Architecture"}),d("p",{className:"text-muted-foreground",children:'The runtime follows a "render-loop" pattern:'}),m("ol",{className:"list-inside list-decimal space-y-2 text-muted-foreground",children:[m("li",{children:[d("strong",{children:"Spec"}),": Defines the flow, fields, and validation rules."]}),m("li",{children:[d("strong",{children:"Core"}),": Tracks current step, data state, and validation errors."]}),m("li",{children:[d("strong",{children:"Renderer"}),": Maps spec fields to UI components (Input, Select, etc.)."]}),m("li",{children:[d("strong",{children:"User"}),": Interacts with components, updating core state."]}),m("li",{children:[d("strong",{children:"Policy"}),": (Optional) Re-evaluates visibility on every change."]})]})]}),m("div",{className:"flex items-center gap-4 pt-4",children:[d(We,{href:"/docs/libraries/data-backend",className:"btn-ghost",children:"Previous: Data & Backend"}),m(We,{href:"/docs/libraries",className:"btn-primary",children:["Back to Libraries ",d(ra,{size:16})]})]})]})}import{CodeBlock as Ge,InstallCommand as ca}from"@contractspec/lib.design-system";import Fe from"@contractspec/lib.ui-link";import{ChevronRight as la}from"lucide-react";import{jsx as e,jsxs as s}from"react/jsx-runtime";function sa(){return s("div",{className:"space-y-8",children:[s("div",{className:"space-y-4",children:[e("h1",{className:"font-bold text-4xl",children:"@contractspec/lib.schema"}),e("p",{className:"text-muted-foreground",children:"A small schema dictionary to describe operation I/O once and export to Zod (runtime validation), Pothos (GraphQL type refs), and JSON Schema."})]}),s("div",{className:"space-y-4",children:[e("h2",{className:"font-bold text-2xl",children:"Installation"}),e(ca,{package:"@contractspec/lib.schema"})]}),s("div",{className:"space-y-4",children:[e("h2",{className:"font-bold text-2xl",children:"Core Exports"}),s("ul",{className:"space-y-2 text-muted-foreground",children:[s("li",{children:[e("code",{className:"rounded bg-background/50 px-2 py-1",children:"SchemaModel"}),": Compose fields into typed object models"]}),s("li",{children:[e("code",{className:"rounded bg-background/50 px-2 py-1",children:"ScalarTypeEnum"}),": Common scalar types (NonEmptyString, Email, DateTime, etc.)"]}),s("li",{children:[e("code",{className:"rounded bg-background/50 px-2 py-1",children:"defineEnum"}),": Create type-safe enums"]}),s("li",{children:[e("code",{className:"rounded bg-background/50 px-2 py-1",children:"FieldType"}),": Wrap scalars with Zod/GraphQL/JSON Schema"]})]})]}),s("div",{className:"space-y-4",children:[e("h2",{className:"font-bold text-2xl",children:"Example: Basic Schema"}),e(Ge,{language:"typescript",code:`import { SchemaModel, ScalarTypeEnum } from '@contractspec/lib.schema';
458
495
 
459
496
  export const CreateSpotInput = new SchemaModel({
460
497
  name: 'CreateSpotInput',
@@ -472,7 +509,7 @@ const zodSchema = CreateSpotInput.getZod();
472
509
  const pothosName = CreateSpotInput.getPothosInput();
473
510
 
474
511
  // Get JSON Schema
475
- const jsonSchema = CreateSpotInput.getJsonSchema();`})]}),s("div",{className:"space-y-4",children:[e("h2",{className:"font-bold text-2xl",children:"Example: Enums"}),e(Me,{language:"typescript",code:`import { defineEnum, SchemaModel } from '@contractspec/lib.schema';
512
+ const jsonSchema = CreateSpotInput.getJsonSchema();`})]}),s("div",{className:"space-y-4",children:[e("h2",{className:"font-bold text-2xl",children:"Example: Enums"}),e(Ge,{language:"typescript",code:`import { defineEnum, SchemaModel } from '@contractspec/lib.schema';
476
513
 
477
514
  const Weekday = defineEnum('Weekday', [
478
515
  'MO', 'TU', 'WE', 'TH', 'FR', 'SA', 'SU',
@@ -487,19 +524,19 @@ const RecurrenceRule = new SchemaModel({
487
524
  },
488
525
  byWeekday: { type: Weekday, isOptional: true, isArray: true },
489
526
  },
490
- });`})]}),s("div",{className:"space-y-4",children:[e("h2",{className:"font-bold text-2xl",children:"Available Scalars"}),s("div",{className:"grid gap-4 md:grid-cols-2",children:[s("div",{className:"card-subtle p-4",children:[e("h3",{className:"mb-2 font-semibold",children:"Strings"}),s("ul",{className:"space-y-1 text-muted-foreground text-sm",children:[e("li",{children:e("code",{children:"NonEmptyString()"})}),e("li",{children:e("code",{children:"Email()"})}),e("li",{children:e("code",{children:"PhoneNumber()"})}),e("li",{children:e("code",{children:"CountryCode()"})}),e("li",{children:e("code",{children:"Locale()"})}),e("li",{children:e("code",{children:"TimeZone()"})})]})]}),s("div",{className:"card-subtle p-4",children:[e("h3",{className:"mb-2 font-semibold",children:"Numbers"}),s("ul",{className:"space-y-1 text-muted-foreground text-sm",children:[e("li",{children:e("code",{children:"PositiveNumber()"})}),e("li",{children:e("code",{children:"Latitude()"})}),e("li",{children:e("code",{children:"Longitude()"})})]})]}),s("div",{className:"card-subtle p-4",children:[e("h3",{className:"mb-2 font-semibold",children:"Dates & Times"}),s("ul",{className:"space-y-1 text-muted-foreground text-sm",children:[e("li",{children:e("code",{children:"Date()"})}),e("li",{children:e("code",{children:"DateTime()"})})]})]}),s("div",{className:"card-subtle p-4",children:[e("h3",{className:"mb-2 font-semibold",children:"Generic"}),s("ul",{className:"space-y-1 text-muted-foreground text-sm",children:[e("li",{children:e("code",{children:"String()"})}),e("li",{children:e("code",{children:"JSON()"})})]})]})]})]}),s("div",{className:"flex items-center gap-4 pt-4",children:[e(De,{href:"/docs/libraries/contracts",className:"btn-ghost",children:"Previous: Contracts"}),s(De,{href:"/docs/libraries/ui-kit",className:"btn-primary",children:["Next: UI Kit ",e(oa,{size:16})]})]})]})}import{CodeBlock as We,InstallCommand as ra}from"@contractspec/lib.design-system";import Ge from"@contractspec/lib.ui-link";import{ChevronRight as na}from"lucide-react";import{jsx as P,jsxs as _}from"react/jsx-runtime";function ca(){return _("div",{className:"space-y-8",children:[_("div",{className:"space-y-4",children:[P("h1",{className:"font-bold text-4xl",children:"SLO Library"}),_("p",{className:"text-lg text-muted-foreground",children:[P("code",{children:"@contractspec/lib.slo"})," keeps service level objectives front and center\u2014declarative definitions, rolling snapshots, burn-rate math, and automated incidents."]})]}),_("div",{className:"space-y-4",children:[P("h2",{className:"font-bold text-2xl",children:"Installation"}),P(ra,{package:"@contractspec/lib.slo"})]}),_("div",{className:"space-y-4",children:[P("h2",{className:"font-bold text-2xl",children:"Define Targets"}),P(We,{language:"typescript",code:`const definition: SLODefinition = {
527
+ });`})]}),s("div",{className:"space-y-4",children:[e("h2",{className:"font-bold text-2xl",children:"Available Scalars"}),s("div",{className:"grid gap-4 md:grid-cols-2",children:[s("div",{className:"card-subtle p-4",children:[e("h3",{className:"mb-2 font-semibold",children:"Strings"}),s("ul",{className:"space-y-1 text-muted-foreground text-sm",children:[e("li",{children:e("code",{children:"NonEmptyString()"})}),e("li",{children:e("code",{children:"Email()"})}),e("li",{children:e("code",{children:"PhoneNumber()"})}),e("li",{children:e("code",{children:"CountryCode()"})}),e("li",{children:e("code",{children:"Locale()"})}),e("li",{children:e("code",{children:"TimeZone()"})})]})]}),s("div",{className:"card-subtle p-4",children:[e("h3",{className:"mb-2 font-semibold",children:"Numbers"}),s("ul",{className:"space-y-1 text-muted-foreground text-sm",children:[e("li",{children:e("code",{children:"PositiveNumber()"})}),e("li",{children:e("code",{children:"Latitude()"})}),e("li",{children:e("code",{children:"Longitude()"})})]})]}),s("div",{className:"card-subtle p-4",children:[e("h3",{className:"mb-2 font-semibold",children:"Dates & Times"}),s("ul",{className:"space-y-1 text-muted-foreground text-sm",children:[e("li",{children:e("code",{children:"Date()"})}),e("li",{children:e("code",{children:"DateTime()"})})]})]}),s("div",{className:"card-subtle p-4",children:[e("h3",{className:"mb-2 font-semibold",children:"Generic"}),s("ul",{className:"space-y-1 text-muted-foreground text-sm",children:[e("li",{children:e("code",{children:"String()"})}),e("li",{children:e("code",{children:"JSON()"})})]})]})]})]}),s("div",{className:"flex items-center gap-4 pt-4",children:[e(Fe,{href:"/docs/libraries/contracts",className:"btn-ghost",children:"Previous: Contracts"}),s(Fe,{href:"/docs/libraries/ui-kit",className:"btn-primary",children:["Next: UI Kit ",e(la,{size:16})]})]})]})}import{CodeBlock as _e,InstallCommand as da}from"@contractspec/lib.design-system";import Ue from"@contractspec/lib.ui-link";import{ChevronRight as pa}from"lucide-react";import{jsx as B,jsxs as H}from"react/jsx-runtime";function ma(){return H("div",{className:"space-y-8",children:[H("div",{className:"space-y-4",children:[B("h1",{className:"font-bold text-4xl",children:"SLO Library"}),H("p",{className:"text-lg text-muted-foreground",children:[B("code",{children:"@contractspec/lib.slo"})," keeps service level objectives front and center\u2014declarative definitions, rolling snapshots, burn-rate math, and automated incidents."]})]}),H("div",{className:"space-y-4",children:[B("h2",{className:"font-bold text-2xl",children:"Installation"}),B(da,{package:"@contractspec/lib.slo"})]}),H("div",{className:"space-y-4",children:[B("h2",{className:"font-bold text-2xl",children:"Define Targets"}),B(_e,{language:"typescript",code:`const definition: SLODefinition = {
491
528
  id: 'billing.createInvoice.availability',
492
529
  targetAvailability: 0.999,
493
530
  latencyP99TargetMs: 500,
494
531
  rollingWindowMs: 7 * 24 * 60 * 60 * 1000,
495
532
  alerts: { fastBurnThreshold: 14, slowBurnThreshold: 6 },
496
- };`})]}),_("div",{className:"space-y-4",children:[P("h2",{className:"font-bold text-2xl",children:"Monitor Burn Rate"}),P(We,{language:"typescript",code:`const monitor = new SLOMonitor({ definition, incidentManager });
533
+ };`})]}),H("div",{className:"space-y-4",children:[B("h2",{className:"font-bold text-2xl",children:"Monitor Burn Rate"}),B(_e,{language:"typescript",code:`const monitor = new SLOMonitor({ definition, incidentManager });
497
534
  const { snapshot, burnRate } = monitor.recordWindow({
498
535
  good: 12500,
499
536
  bad: 3,
500
537
  latencyP99: 420,
501
538
  latencyP95: 210,
502
- });`}),_("p",{className:"text-muted-foreground text-sm",children:["When burn rate exceeds the configured thresholds the monitor calls your",P("code",{children:"IncidentManager"}),", providing the snapshot that triggered the alert."]})]}),_("div",{className:"space-y-4",children:[P("h2",{className:"font-bold text-2xl",children:"History & Reporting"}),P("p",{className:"text-muted-foreground text-sm",children:"`SLOTracker.getHistory()` returns the latest snapshots so dashboards can show trends without hitting a warehouse. Prisma models persist everything for long-term audits."})]}),_("div",{className:"flex items-center gap-4 pt-4",children:[P(Ge,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),_(Ge,{href:"/docs/libraries/cost-tracking",className:"btn-primary",children:["Next: Cost Tracking ",P(na,{size:16})]})]})]})}import{CodeBlock as Fe,InstallCommand as la}from"@contractspec/lib.design-system";import Ue from"@contractspec/lib.ui-link";import{ChevronRight as sa}from"lucide-react";import{jsx as L,jsxs as O}from"react/jsx-runtime";function da(){return O("div",{className:"space-y-8",children:[O("div",{className:"space-y-4",children:[L("h1",{className:"font-bold text-4xl",children:"@contractspec/lib.support-bot"}),L("p",{className:"text-lg text-muted-foreground",children:"Build AI-first support flows using drop-in classifiers, knowledge-grounded resolvers, and tone-aware responders\u2014all wired into the agent runner."})]}),O("div",{className:"space-y-4",children:[L("h2",{className:"font-bold text-2xl",children:"Installation"}),L(la,{package:"@contractspec/lib.support-bot"})]}),O("div",{className:"space-y-3",children:[L("h2",{className:"font-bold text-2xl",children:"Wire the primitives"}),L(Fe,{language:"typescript",code:`import { TicketClassifier, TicketResolver, AutoResponder } from '@contractspec/lib.support-bot';
539
+ });`}),H("p",{className:"text-muted-foreground text-sm",children:["When burn rate exceeds the configured thresholds the monitor calls your",B("code",{children:"IncidentManager"}),", providing the snapshot that triggered the alert."]})]}),H("div",{className:"space-y-4",children:[B("h2",{className:"font-bold text-2xl",children:"History & Reporting"}),B("p",{className:"text-muted-foreground text-sm",children:"`SLOTracker.getHistory()` returns the latest snapshots so dashboards can show trends without hitting a warehouse. Prisma models persist everything for long-term audits."})]}),H("div",{className:"flex items-center gap-4 pt-4",children:[B(Ue,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),H(Ue,{href:"/docs/libraries/cost-tracking",className:"btn-primary",children:["Next: Cost Tracking ",B(pa,{size:16})]})]})]})}import{CodeBlock as Ve,InstallCommand as ua}from"@contractspec/lib.design-system";import He from"@contractspec/lib.ui-link";import{ChevronRight as ga}from"lucide-react";import{jsx as L,jsxs as O}from"react/jsx-runtime";function fa(){return O("div",{className:"space-y-8",children:[O("div",{className:"space-y-4",children:[L("h1",{className:"font-bold text-4xl",children:"@contractspec/lib.support-bot"}),L("p",{className:"text-lg text-muted-foreground",children:"Build AI-first support flows using drop-in classifiers, knowledge-grounded resolvers, and tone-aware responders\u2014all wired into the agent runner."})]}),O("div",{className:"space-y-4",children:[L("h2",{className:"font-bold text-2xl",children:"Installation"}),L(ua,{package:"@contractspec/lib.support-bot"})]}),O("div",{className:"space-y-3",children:[L("h2",{className:"font-bold text-2xl",children:"Wire the primitives"}),L(Ve,{language:"typescript",code:`import { TicketClassifier, TicketResolver, AutoResponder } from '@contractspec/lib.support-bot';
503
540
 
504
541
  const classifier = new TicketClassifier();
505
542
  const resolver = new TicketResolver({ knowledge });
@@ -507,10 +544,10 @@ const responder = new AutoResponder();
507
544
 
508
545
  const classification = await classifier.classify(ticket);
509
546
  const resolution = await resolver.resolve(ticket);
510
- const draft = await responder.draft(ticket, resolution, classification);`})]}),O("div",{className:"space-y-3",children:[L("h2",{className:"font-bold text-2xl",children:"Expose as agent tools"}),L(Fe,{language:"typescript",code:`import { createSupportTools } from '@contractspec/lib.support-bot/bot';
547
+ const draft = await responder.draft(ticket, resolution, classification);`})]}),O("div",{className:"space-y-3",children:[L("h2",{className:"font-bold text-2xl",children:"Expose as agent tools"}),L(Ve,{language:"typescript",code:`import { createSupportTools } from '@contractspec/lib.support-bot/bot';
511
548
 
512
549
  const tools = createSupportTools({ resolver, classifier, responder });
513
- // Pass these tools into your host runtime or agent adapter.`})]}),O("div",{className:"space-y-3",children:[L("h2",{className:"font-bold text-2xl",children:"Included modules"}),O("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[O("li",{children:[L("strong",{children:"TicketClassifier"}),": heuristics + optional LLM validation for category/priority."]}),O("li",{children:[L("strong",{children:"TicketResolver"}),": RAG resolver that can plug into any knowledge retriever."]}),O("li",{children:[L("strong",{children:"AutoResponder"}),": generates drafts, citations, and tone-aware copy."]}),O("li",{children:[L("strong",{children:"SupportFeedbackLoop"}),": track auto-resolution rates and sentiment trends."]})]})]}),O("div",{className:"flex items-center gap-4 pt-4",children:[L(Ue,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),O(Ue,{href:"/docs/libraries/growth",className:"btn-primary",children:["Next: Growth ",L(sa,{size:16})]})]})]})}import{CodeBlock as se,InstallCommand as pa}from"@contractspec/lib.design-system";import qe from"@contractspec/lib.ui-link";import{ChevronRight as ma}from"lucide-react";import{jsx as R,jsxs as Z}from"react/jsx-runtime";function ua(){return Z("div",{className:"space-y-8",children:[Z("div",{className:"space-y-4",children:[R("h1",{className:"font-bold text-4xl",children:"@contractspec/lib.testing"}),R("p",{className:"text-lg text-muted-foreground",children:"Golden tests ensure new rollouts behave exactly like the traffic that inspired them. Record requests in production, replay them locally, and ship with confidence."})]}),Z("div",{className:"space-y-4",children:[R("h2",{className:"font-bold text-2xl",children:"Installation"}),R(pa,{package:"@contractspec/lib.testing"})]}),Z("div",{className:"space-y-3",children:[R("h2",{className:"font-bold text-2xl",children:"Record traffic"}),R(se,{language:"typescript",code:`import {
550
+ // Pass these tools into your host runtime or agent adapter.`})]}),O("div",{className:"space-y-3",children:[L("h2",{className:"font-bold text-2xl",children:"Included modules"}),O("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[O("li",{children:[L("strong",{children:"TicketClassifier"}),": heuristics + optional LLM validation for category/priority."]}),O("li",{children:[L("strong",{children:"TicketResolver"}),": RAG resolver that can plug into any knowledge retriever."]}),O("li",{children:[L("strong",{children:"AutoResponder"}),": generates drafts, citations, and tone-aware copy."]}),O("li",{children:[L("strong",{children:"SupportFeedbackLoop"}),": track auto-resolution rates and sentiment trends."]})]})]}),O("div",{className:"flex items-center gap-4 pt-4",children:[L(He,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),O(He,{href:"/docs/libraries/growth",className:"btn-primary",children:["Next: Growth ",L(ga,{size:16})]})]})]})}import{CodeBlock as me,InstallCommand as ha}from"@contractspec/lib.design-system";import qe from"@contractspec/lib.ui-link";import{ChevronRight as ba}from"lucide-react";import{jsx as R,jsxs as Z}from"react/jsx-runtime";function va(){return Z("div",{className:"space-y-8",children:[Z("div",{className:"space-y-4",children:[R("h1",{className:"font-bold text-4xl",children:"@contractspec/lib.testing"}),R("p",{className:"text-lg text-muted-foreground",children:"Golden tests ensure new rollouts behave exactly like the traffic that inspired them. Record requests in production, replay them locally, and ship with confidence."})]}),Z("div",{className:"space-y-4",children:[R("h2",{className:"font-bold text-2xl",children:"Installation"}),R(ha,{package:"@contractspec/lib.testing"})]}),Z("div",{className:"space-y-3",children:[R("h2",{className:"font-bold text-2xl",children:"Record traffic"}),R(me,{language:"typescript",code:`import {
514
551
  TrafficRecorder,
515
552
  InMemoryTrafficStore,
516
553
  } from '@contractspec/lib.testing/recorder';
@@ -530,7 +567,7 @@ await recorder.record({
530
567
  output,
531
568
  success: true,
532
569
  tenantId: ctx.organizationId ?? undefined,
533
- });`})]}),Z("div",{className:"space-y-3",children:[R("h2",{className:"font-bold text-2xl",children:"Generate suites"}),R(se,{language:"typescript",code:`import { GoldenTestGenerator } from '@contractspec/lib.testing';
570
+ });`})]}),Z("div",{className:"space-y-3",children:[R("h2",{className:"font-bold text-2xl",children:"Generate suites"}),R(me,{language:"typescript",code:`import { GoldenTestGenerator } from '@contractspec/lib.testing';
534
571
 
535
572
  const generator = new GoldenTestGenerator();
536
573
  const code = generator.generate(snapshots, {
@@ -538,25 +575,96 @@ const code = generator.generate(snapshots, {
538
575
  runnerImport: './tests/run-operation',
539
576
  runnerFunction: 'runOrdersCommand',
540
577
  framework: 'vitest',
541
- });`})]}),Z("div",{className:"space-y-3",children:[R("h2",{className:"font-bold text-2xl",children:"CLI workflow"}),R(se,{language:"bash",code:"contractspec test generate \\\n --operation orders.create \\\n --output tests/orders.create.golden.test.ts \\\n --runner-import ./tests/run-operation \\\n --runner-fn runOrdersCommand \\\n --from-production \\\n --days 7 \\\n --sample-rate 0.05"})]}),R("div",{className:"grid gap-4 md:grid-cols-2",children:[{title:"Framework agnostic",description:"Vitest by default, Jest via `generateJestSuite`, or call `runGoldenTests` manually inside CI."},{title:"Sanitize & sample",description:"Scrub payloads before persistence and control sample rates per operation to stay within compliance limits."}].map((E)=>Z("div",{className:"card-subtle space-y-2 p-4",children:[R("h3",{className:"font-semibold text-lg",children:E.title}),R("p",{className:"text-muted-foreground text-sm",children:E.description})]},E.title))}),Z("div",{className:"flex items-center gap-4 pt-4",children:[R(qe,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),Z(qe,{href:"/docs/libraries/resilience",className:"btn-primary",children:["Next: Resilience ",R(ma,{size:16})]})]})]})}import{CodeBlock as ga,InstallCommand as fa}from"@contractspec/lib.design-system";import _e from"@contractspec/lib.ui-link";import{ChevronRight as ha}from"lucide-react";import{jsx as a,jsxs as m}from"react/jsx-runtime";function ba(){return m("div",{className:"space-y-8",children:[m("div",{className:"space-y-4",children:[a("h1",{className:"font-bold text-4xl",children:"@contractspec/lib.ui-kit"}),m("p",{className:"text-muted-foreground",children:["Universal UI components for React Native and Web, built on top of",a("code",{children:"nativewind"})," and ",a("code",{children:"@rn-primitives"}),"."]})]}),m("div",{className:"space-y-4",children:[a("h2",{className:"font-bold text-2xl",children:"Installation"}),a(fa,{package:"@contractspec/lib.ui-kit"})]}),m("div",{className:"space-y-4",children:[a("h2",{className:"font-bold text-2xl",children:"Key Features"}),m("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[m("li",{children:[a("strong",{children:"Universal"}),": Components render natively on iOS/Android and as standard HTML on web"]}),m("li",{children:[a("strong",{children:"Styled with NativeWind"}),": Uses Tailwind CSS classes for styling"]}),m("li",{children:[a("strong",{children:"Accessible"}),": Leverages ",a("code",{children:"@rn-primitives"})," ","(Radix UI for Native)"]}),m("li",{children:[a("strong",{children:"Atomic Design"}),": Exports atoms, molecules, and organisms"]})]})]}),m("div",{className:"space-y-4",children:[a("h2",{className:"font-bold text-2xl",children:"Example Usage"}),a(ga,{language:"tsx",code:`import { Button } from '@contractspec/lib.ui-kit/ui/button';
542
- import { Text } from '@contractspec/lib.ui-kit/ui/text';
543
- import { Card, CardHeader, CardTitle, CardContent } from '@contractspec/lib.ui-kit/ui/card';
578
+ });`})]}),Z("div",{className:"space-y-3",children:[R("h2",{className:"font-bold text-2xl",children:"CLI workflow"}),R(me,{language:"bash",code:"contractspec test generate \\\n --operation orders.create \\\n --output tests/orders.create.golden.test.ts \\\n --runner-import ./tests/run-operation \\\n --runner-fn runOrdersCommand \\\n --from-production \\\n --days 7 \\\n --sample-rate 0.05"})]}),R("div",{className:"grid gap-4 md:grid-cols-2",children:[{title:"Framework agnostic",description:"Vitest by default, Jest via `generateJestSuite`, or call `runGoldenTests` manually inside CI."},{title:"Sanitize & sample",description:"Scrub payloads before persistence and control sample rates per operation to stay within compliance limits."}].map((E)=>Z("div",{className:"card-subtle space-y-2 p-4",children:[R("h3",{className:"font-semibold text-lg",children:E.title}),R("p",{className:"text-muted-foreground text-sm",children:E.description})]},E.title))}),Z("div",{className:"flex items-center gap-4 pt-4",children:[R(qe,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),Z(qe,{href:"/docs/libraries/resilience",className:"btn-primary",children:["Next: Resilience ",R(ba,{size:16})]})]})]})}import{CodeBlock as ya,InstallCommand as Na}from"@contractspec/lib.design-system";import ue from"@contractspec/lib.ui-link";import{ChevronRight as wa}from"lucide-react";import{jsx as i,jsxs as p}from"react/jsx-runtime";var ka=`import { DataTable } from '@contractspec/lib.ui-kit/ui/data-table';
579
+ import { useContractTable } from '@contractspec/lib.presentation-runtime-react';
580
+
581
+ import { SHOWCASE_ROWS } from '@contractspec/example.data-grid-showcase/ui/data-grid-showcase.data';
582
+ import { useShowcaseColumns } from '@contractspec/example.data-grid-showcase/ui/data-grid-showcase.columns';
583
+ import {
584
+ ExpandedRowContent,
585
+ ShowcaseToolbar,
586
+ } from '@contractspec/example.data-grid-showcase/ui/data-grid-showcase.parts';
587
+
588
+ export function NativeAccountGrid() {
589
+ const columns = useShowcaseColumns();
590
+
591
+ const controller = useContractTable({
592
+ data: SHOWCASE_ROWS,
593
+ columns,
594
+ selectionMode: 'single',
595
+ initialState: {
596
+ sorting: [{ id: 'arr', desc: true }],
597
+ pagination: { pageIndex: 0, pageSize: 4 },
598
+ columnVisibility: { notes: false },
599
+ columnPinning: { left: ['account'], right: [] },
600
+ },
601
+ renderExpandedContent: (row) => <ExpandedRowContent row={row} />,
602
+ getCanExpand: () => true,
603
+ });
544
604
 
545
- export function MyComponent() {
546
605
  return (
547
- <Card className="w-full max-w-md">
548
- <CardHeader>
549
- <CardTitle>Welcome</CardTitle>
550
- </CardHeader>
551
- <CardContent className="gap-4">
552
- <Text>This works on Web and Native.</Text>
553
- <Button onPress={() => console.log('Clicked!')}>
554
- Click me
555
- </Button>
556
- </CardContent>
557
- </Card>
606
+ <DataTable
607
+ controller={controller}
608
+ toolbar={
609
+ <ShowcaseToolbar
610
+ controller={controller}
611
+ label="Native primitive"
612
+ primaryColumnId="account"
613
+ toggleColumnId="notes"
614
+ pinColumnId="owner"
615
+ sortColumnIds={['arr', 'renewalDate']}
616
+ />
617
+ }
618
+ loading={false}
619
+ footer={\`Rows \${controller.rows.length}\`}
620
+ />
621
+ );
622
+ }`;function Sa(){return p("div",{className:"space-y-8",children:[p("div",{className:"space-y-4",children:[i("h1",{className:"font-bold text-4xl",children:"@contractspec/lib.ui-kit"}),p("p",{className:"text-muted-foreground",children:["Universal UI components for React Native and Web, built on top of",i("code",{children:"nativewind"})," and ",i("code",{children:"@rn-primitives"}),"."]})]}),p("div",{className:"space-y-4",children:[i("h2",{className:"font-bold text-2xl",children:"Installation"}),i(Na,{package:"@contractspec/lib.ui-kit"})]}),p("div",{className:"space-y-4",children:[i("h2",{className:"font-bold text-2xl",children:"Key Features"}),p("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[p("li",{children:[i("strong",{children:"Universal"}),": Components render natively on iOS/Android and as standard HTML on web"]}),p("li",{children:[i("strong",{children:"Styled with NativeWind"}),": Uses Tailwind CSS classes for styling"]}),p("li",{children:[i("strong",{children:"Accessible"}),": Leverages ",i("code",{children:"@rn-primitives"})," ","(Radix UI for Native)"]}),p("li",{children:[i("strong",{children:"Atomic Design"}),": Exports atoms, molecules, and organisms"]})]})]}),p("div",{className:"space-y-4",children:[i("h2",{className:"font-bold text-2xl",children:"Data table example"}),p("p",{className:"text-muted-foreground",children:["The canonical"," ",i(ue,{href:"/docs/examples/data-grid-showcase",className:"text-[color:var(--rust)] underline underline-offset-4",children:"Data Grid Showcase"})," ","uses ",i("code",{children:"@contractspec/lib.ui-kit/ui/data-table"})," as the native-first primitive lane. It shares the same controller model as the web renderer while keeping the React Native / Expo surface explicit."]}),i(ya,{language:"tsx",code:ka})]}),p("div",{className:"space-y-4",children:[i("h2",{className:"font-bold text-2xl",children:"Core Components"}),p("div",{className:"grid gap-4 md:grid-cols-3",children:[p("div",{className:"card-subtle p-4",children:[i("h3",{className:"mb-2 font-semibold",children:"Form Controls"}),p("ul",{className:"space-y-1 text-muted-foreground text-sm",children:[i("li",{children:"Button"}),i("li",{children:"Input"}),i("li",{children:"Checkbox"}),i("li",{children:"Switch"}),i("li",{children:"Select"})]})]}),p("div",{className:"card-subtle p-4",children:[i("h3",{className:"mb-2 font-semibold",children:"Layout"}),p("ul",{className:"space-y-1 text-muted-foreground text-sm",children:[i("li",{children:"Card"}),i("li",{children:"Stack"}),i("li",{children:"Separator"}),i("li",{children:"Sheet"})]})]}),p("div",{className:"card-subtle p-4",children:[i("h3",{className:"mb-2 font-semibold",children:"Feedback"}),p("ul",{className:"space-y-1 text-muted-foreground text-sm",children:[i("li",{children:"Alert"}),i("li",{children:"Skeleton"}),i("li",{children:"Progress"}),i("li",{children:"Tooltip"})]})]})]})]}),p("div",{className:"flex items-center gap-4 pt-4",children:[i(ue,{href:"/docs/libraries/schema",className:"btn-ghost",children:"Previous: Schema"}),p(ue,{href:"/docs/libraries/ui-kit-web",className:"btn-primary",children:["Next: UI Kit Web ",i(wa,{size:16})]})]})]})}import{CodeBlock as Ca,InstallCommand as La}from"@contractspec/lib.design-system";import ge from"@contractspec/lib.ui-link";import{ChevronRight as Ra}from"lucide-react";import{jsx as D,jsxs as X}from"react/jsx-runtime";var Ia=`import { DataTable } from '@contractspec/lib.ui-kit-web/ui/data-table';
623
+ import { useContractTable } from '@contractspec/lib.presentation-runtime-react';
624
+
625
+ import { SHOWCASE_ROWS } from '@contractspec/example.data-grid-showcase/ui/data-grid-showcase.data';
626
+ import { useShowcaseColumns } from '@contractspec/example.data-grid-showcase/ui/data-grid-showcase.columns';
627
+ import {
628
+ ExpandedRowContent,
629
+ ShowcaseToolbar,
630
+ } from '@contractspec/example.data-grid-showcase/ui/data-grid-showcase.parts';
631
+
632
+ export function WebAccountGrid() {
633
+ const columns = useShowcaseColumns();
634
+
635
+ const controller = useContractTable({
636
+ data: SHOWCASE_ROWS,
637
+ columns,
638
+ selectionMode: 'single',
639
+ initialState: {
640
+ sorting: [{ id: 'lastActivityAt', desc: true }],
641
+ pagination: { pageIndex: 0, pageSize: 4 },
642
+ columnVisibility: { notes: false },
643
+ columnPinning: { left: ['account'], right: [] },
644
+ },
645
+ renderExpandedContent: (row) => <ExpandedRowContent row={row} />,
646
+ getCanExpand: () => true,
647
+ });
648
+
649
+ return (
650
+ <DataTable
651
+ controller={controller}
652
+ toolbar={
653
+ <ShowcaseToolbar
654
+ controller={controller}
655
+ label="Web primitive"
656
+ primaryColumnId="account"
657
+ toggleColumnId="notes"
658
+ pinColumnId="owner"
659
+ sortColumnIds={['arr', 'renewalDate']}
660
+ />
661
+ }
662
+ loading={false}
663
+ emptyState={<div>No rows available.</div>}
664
+ footer={\`Rows \${controller.totalItems}\`}
665
+ />
558
666
  );
559
- }`})]}),m("div",{className:"space-y-4",children:[a("h2",{className:"font-bold text-2xl",children:"Core Components"}),m("div",{className:"grid gap-4 md:grid-cols-3",children:[m("div",{className:"card-subtle p-4",children:[a("h3",{className:"mb-2 font-semibold",children:"Form Controls"}),m("ul",{className:"space-y-1 text-muted-foreground text-sm",children:[a("li",{children:"Button"}),a("li",{children:"Input"}),a("li",{children:"Checkbox"}),a("li",{children:"Switch"}),a("li",{children:"Select"})]})]}),m("div",{className:"card-subtle p-4",children:[a("h3",{className:"mb-2 font-semibold",children:"Layout"}),m("ul",{className:"space-y-1 text-muted-foreground text-sm",children:[a("li",{children:"Card"}),a("li",{children:"Stack"}),a("li",{children:"Separator"}),a("li",{children:"Sheet"})]})]}),m("div",{className:"card-subtle p-4",children:[a("h3",{className:"mb-2 font-semibold",children:"Feedback"}),m("ul",{className:"space-y-1 text-muted-foreground text-sm",children:[a("li",{children:"Alert"}),a("li",{children:"Skeleton"}),a("li",{children:"Progress"}),a("li",{children:"Tooltip"})]})]})]})]}),m("div",{className:"flex items-center gap-4 pt-4",children:[a(_e,{href:"/docs/libraries/schema",className:"btn-ghost",children:"Previous: Schema"}),m(_e,{href:"/docs/libraries/design-system",className:"btn-primary",children:["Next: Design System ",a(ha,{size:16})]})]})]})}import{CodeBlock as He,InstallCommand as va}from"@contractspec/lib.design-system";import Ve from"@contractspec/lib.ui-link";import{ChevronRight as ya}from"lucide-react";import{jsx as H,jsxs as j}from"react/jsx-runtime";function Na(){return j("div",{className:"space-y-8",children:[j("div",{className:"space-y-4",children:[H("h1",{className:"font-bold text-4xl",children:"Workflow Composer"}),H("p",{className:"text-lg text-muted-foreground",children:"`@contractspec/lib.workflow-composer` injects tenant-/role-/device-specific steps into base WorkflowSpecs and keeps transitions valid."})]}),j("div",{className:"space-y-4",children:[H("h2",{className:"font-bold text-2xl",children:"Installation"}),H(va,{package:"@contractspec/lib.workflow-composer"})]}),j("div",{className:"space-y-4",children:[H("h2",{className:"font-bold text-2xl",children:"Register extensions"}),H(He,{language:"typescript",code:`const composer = new WorkflowComposer();
667
+ }`;function Ta(){return X("div",{className:"space-y-8",children:[X("div",{className:"space-y-4",children:[D("h1",{className:"font-bold text-4xl",children:"@contractspec/lib.ui-kit-web"}),D("p",{className:"text-muted-foreground",children:"Web-first React and Next primitives for ContractSpec. The canonical data-table example uses this package to render the raw browser table layer directly, without the design-system shell on top."})]}),X("div",{className:"space-y-4",children:[D("h2",{className:"font-bold text-2xl",children:"Installation"}),D(La,{package:"@contractspec/lib.ui-kit-web"})]}),X("div",{className:"space-y-4",children:[D("h2",{className:"font-bold text-2xl",children:"Data table example"}),X("p",{className:"text-muted-foreground",children:["This is the raw browser lane from the canonical"," ",D(ge,{href:"/docs/examples/data-grid-showcase",className:"text-[color:var(--rust)] underline underline-offset-4",children:"Data Grid Showcase"}),". It demonstrates the primitive renderer with sorting, pagination, single selection, column visibility, column resizing, left/right pinning, row expansion, loading, and empty-state slots."]}),D(Ca,{language:"tsx",filename:"web-account-grid.tsx",code:Ia})]}),X("div",{className:"space-y-4",children:[D("h2",{className:"font-bold text-2xl",children:"What this layer owns"}),X("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[D("li",{children:"The raw table renderer and browser interaction model."}),D("li",{children:"Pagination, column visibility menus, pin menus, resize handles, and empty/loading states."}),D("li",{children:"Accessibility helpers and other web-specific primitives that stay outside the native-first package."})]})]}),X("div",{className:"flex items-center gap-4 pt-4",children:[D(ge,{href:"/docs/libraries/ui-kit",className:"btn-ghost",children:"Previous: UI Kit"}),X(ge,{href:"/docs/libraries/design-system",className:"btn-primary",children:["Next: Design System ",D(Ra,{size:16})]})]})]})}import{CodeBlock as Qe,InstallCommand as Aa}from"@contractspec/lib.design-system";import Ke from"@contractspec/lib.ui-link";import{ChevronRight as Pa}from"lucide-react";import{jsx as q,jsxs as te}from"react/jsx-runtime";function Ba(){return te("div",{className:"space-y-8",children:[te("div",{className:"space-y-4",children:[q("h1",{className:"font-bold text-4xl",children:"Workflow Composer"}),q("p",{className:"text-lg text-muted-foreground",children:"`@contractspec/lib.workflow-composer` injects tenant-/role-/device-specific steps into base WorkflowSpecs and keeps transitions valid."})]}),te("div",{className:"space-y-4",children:[q("h2",{className:"font-bold text-2xl",children:"Installation"}),q(Aa,{package:"@contractspec/lib.workflow-composer"})]}),te("div",{className:"space-y-4",children:[q("h2",{className:"font-bold text-2xl",children:"Register extensions"}),q(Qe,{language:"typescript",code:`const composer = new WorkflowComposer();
560
668
 
561
669
  composer.register({
562
670
  workflow: 'billing.invoiceApproval',
@@ -573,12 +681,12 @@ composer.register({
573
681
  },
574
682
  ],
575
683
  hiddenSteps: ['internal-audit'],
576
- });`})]}),j("div",{className:"space-y-4",children:[H("h2",{className:"font-bold text-2xl",children:"Compose at runtime"}),H(He,{language:"typescript",code:`const tenantWorkflow = composer.compose({
684
+ });`})]}),te("div",{className:"space-y-4",children:[q("h2",{className:"font-bold text-2xl",children:"Compose at runtime"}),q(Qe,{language:"typescript",code:`const tenantWorkflow = composer.compose({
577
685
  base: BaseInvoiceWorkflow,
578
686
  tenantId: 'acme',
579
687
  });
580
688
 
581
- workflowRunner.execute(tenantWorkflow, ctx);`})]}),j("div",{className:"flex items-center gap-4 pt-4",children:[H(Ve,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),j(Ve,{href:"/docs/libraries/workflows",className:"btn-primary",children:["Next: Workflow Runtime ",H(ya,{size:16})]})]})]})}import{CodeBlock as ka,InstallCommand as wa}from"@contractspec/lib.design-system";import Qe from"@contractspec/lib.ui-link";import{ChevronRight as Ca}from"lucide-react";import{jsx as r,jsxs as T}from"react/jsx-runtime";function Sa(){return T("div",{className:"space-y-8",children:[T("div",{className:"space-y-4",children:[r("h1",{className:"font-bold text-4xl",children:"Workflow Runtime Library"}),T("p",{className:"text-lg text-muted-foreground",children:["The ",r("code",{children:"@contractspec/lib.contracts-spec/workflow"})," library provides the core ",r("code",{children:"WorkflowRunner"})," for executing stateful, durable workflows."]})]}),T("div",{className:"space-y-4",children:[r("h2",{className:"font-bold text-2xl",children:"Installation"}),r(wa,{package:"@contractspec/lib.contracts-spec"})]}),T("div",{className:"space-y-4",children:[r("h2",{className:"font-bold text-2xl",children:"WorkflowRunner"}),r("p",{className:"text-muted-foreground",children:"The runner manages execution state, step transitions, retries, and compensation."}),r(ka,{language:"typescript",code:`import { WorkflowRunner } from '@contractspec/lib.contracts-spec/workflow/runner';
689
+ workflowRunner.execute(tenantWorkflow, ctx);`})]}),te("div",{className:"flex items-center gap-4 pt-4",children:[q(Ke,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),te(Ke,{href:"/docs/libraries/workflows",className:"btn-primary",children:["Next: Workflow Runtime ",q(Pa,{size:16})]})]})]})}import{CodeBlock as Oa,InstallCommand as Da}from"@contractspec/lib.design-system";import Je from"@contractspec/lib.ui-link";import{ChevronRight as Ea}from"lucide-react";import{jsx as r,jsxs as T}from"react/jsx-runtime";function Ma(){return T("div",{className:"space-y-8",children:[T("div",{className:"space-y-4",children:[r("h1",{className:"font-bold text-4xl",children:"Workflow Runtime Library"}),T("p",{className:"text-lg text-muted-foreground",children:["The ",r("code",{children:"@contractspec/lib.contracts-spec/workflow"})," library provides the core ",r("code",{children:"WorkflowRunner"})," for executing stateful, durable workflows."]})]}),T("div",{className:"space-y-4",children:[r("h2",{className:"font-bold text-2xl",children:"Installation"}),r(Da,{package:"@contractspec/lib.contracts-spec"})]}),T("div",{className:"space-y-4",children:[r("h2",{className:"font-bold text-2xl",children:"WorkflowRunner"}),r("p",{className:"text-muted-foreground",children:"The runner manages execution state, step transitions, retries, and compensation."}),r(Oa,{language:"typescript",code:`import { WorkflowRunner } from '@contractspec/lib.contracts-spec/workflow/runner';
582
690
  import { InMemoryStateStore } from '@contractspec/lib.contracts-spec/workflow/adapters/memory-store';
583
691
  import { WorkflowRegistry } from '@contractspec/lib.contracts-spec/workflow/spec';
584
692
 
@@ -598,4 +706,4 @@ const runner = new WorkflowRunner({
598
706
  const workflowId = await runner.start('my.workflow', 1, { userId: '123' });
599
707
 
600
708
  // Execute next step (usually called by a worker or queue consumer)
601
- await runner.executeStep(workflowId);`})]}),T("div",{className:"space-y-4",children:[r("h2",{className:"font-bold text-2xl",children:"State Persistence"}),T("p",{className:"text-muted-foreground",children:["The runner relies on a ",r("code",{children:"StateStore"})," to persist workflow execution history. ContractSpec ships with:"]}),T("ul",{className:"list-disc space-y-2 pl-6 text-muted-foreground",children:[T("li",{children:[r("code",{children:"InMemoryStateStore"})," - for testing and development."]}),T("li",{children:[r("code",{children:"PrismaStateStore"})," - for production using Prisma ORM."]})]})]}),T("div",{className:"space-y-4",children:[r("h2",{className:"font-bold text-2xl",children:"Events"}),r("p",{className:"text-muted-foreground",children:"The runner emits events that you can subscribe to for monitoring:"}),T("ul",{className:"list-disc space-y-2 pl-6 text-muted-foreground",children:[r("li",{children:r("code",{children:"workflow.started"})}),r("li",{children:r("code",{children:"workflow.step_completed"})}),r("li",{children:r("code",{children:"workflow.step_failed"})}),r("li",{children:r("code",{children:"workflow.step_retrying"})}),r("li",{children:r("code",{children:"workflow.completed"})}),r("li",{children:r("code",{children:"workflow.cancelled"})}),r("li",{children:r("code",{children:"workflow.compensation_step_completed"})})]})]}),T("div",{className:"flex items-center gap-4 pt-4",children:[r(Qe,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),T(Qe,{href:"/docs/libraries/data-views",className:"btn-primary",children:["Next: Data Views ",r(Ca,{size:16})]})]})]})}export{Sa as LibrariesWorkflowsPage,Na as LibrariesWorkflowComposerPage,ba as LibrariesUIKitPage,ua as LibrariesTestingPage,da as LibrariesSupportBotPage,ia as LibrariesSchemaPage,ca as LibrariesSLOPage,ta as LibrariesRuntimePage,$t as LibrariesResiliencePage,Jt as LibrariesProgressiveDeliveryPage,Qt as LibrariesPersonalizationPage,_t as LibrariesOverviewPage,Gt as LibrariesOverlayEnginePage,Mt as LibrariesObservabilityPage,Ot as LibrariesMultiTenancyPage,At as LibrariesGrowthPage,Rt as LibrariesGraphQLPage,wt as LibrariesEvolutionPage,yt as LibrariesDesignSystemPage,ht as LibrariesDataViewsPage,ut as LibrariesDataBackendPage,dt as LibrariesCostTrackingPage,ct as LibrariesContractsPage,ot as LibrariesContentGenPage,je as LibrariesAnalyticsPage,$e as LibrariesAiAgentPage,Je as LibrariesAccessibilityPage};
709
+ await runner.executeStep(workflowId);`})]}),T("div",{className:"space-y-4",children:[r("h2",{className:"font-bold text-2xl",children:"State Persistence"}),T("p",{className:"text-muted-foreground",children:["The runner relies on a ",r("code",{children:"StateStore"})," to persist workflow execution history. ContractSpec ships with:"]}),T("ul",{className:"list-disc space-y-2 pl-6 text-muted-foreground",children:[T("li",{children:[r("code",{children:"InMemoryStateStore"})," - for testing and development."]}),T("li",{children:[r("code",{children:"PrismaStateStore"})," - for production using Prisma ORM."]})]})]}),T("div",{className:"space-y-4",children:[r("h2",{className:"font-bold text-2xl",children:"Events"}),r("p",{className:"text-muted-foreground",children:"The runner emits events that you can subscribe to for monitoring:"}),T("ul",{className:"list-disc space-y-2 pl-6 text-muted-foreground",children:[r("li",{children:r("code",{children:"workflow.started"})}),r("li",{children:r("code",{children:"workflow.step_completed"})}),r("li",{children:r("code",{children:"workflow.step_failed"})}),r("li",{children:r("code",{children:"workflow.step_retrying"})}),r("li",{children:r("code",{children:"workflow.completed"})}),r("li",{children:r("code",{children:"workflow.cancelled"})}),r("li",{children:r("code",{children:"workflow.compensation_step_completed"})})]})]}),T("div",{className:"flex items-center gap-4 pt-4",children:[r(Je,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),T(Je,{href:"/docs/libraries/data-views",className:"btn-primary",children:["Next: Data Views ",r(Ea,{size:16})]})]})]})}export{Ma as LibrariesWorkflowsPage,Ba as LibrariesWorkflowComposerPage,Ta as LibrariesUIKitWebPage,Sa as LibrariesUIKitPage,va as LibrariesTestingPage,fa as LibrariesSupportBotPage,sa as LibrariesSchemaPage,ma as LibrariesSLOPage,na as LibrariesRuntimePage,aa as LibrariesResiliencePage,jt as LibrariesProgressiveDeliveryPage,$t as LibrariesPersonalizationPage,Jt as LibrariesOverviewPage,Ht as LibrariesOverlayEnginePage,_t as LibrariesObservabilityPage,Wt as LibrariesMultiTenancyPage,Et as LibrariesGrowthPage,Bt as LibrariesGraphQLPage,It as LibrariesEvolutionPage,Ct as LibrariesDesignSystemPage,yt as LibrariesDataViewsPage,ht as LibrariesDataBackendPage,ut as LibrariesCostTrackingPage,dt as LibrariesContractsPage,rt as LibrariesContentGenPage,tt as LibrariesAnalyticsPage,je as LibrariesAiAgentPage,$e as LibrariesAccessibilityPage};