var c=Object.defineProperty;var n=(a)=>a;function l(a,o){this[a]=n.bind(null,o)}var g=(a,o)=>{for(var i in o)c(a,i,{get:o[i],enumerable:!0,configurable:!0,set:l.bind(o,i)})};var u=(a,o)=>()=>(a&&(o=a(a=0)),o);import{CodeBlock as s,InstallCommand as d}from"@contractspec/lib.design-system";import r from"@contractspec/lib.ui-link";import{ChevronRight as p}from"lucide-react";import{jsx as e,jsxs as t}from"react/jsx-runtime";var m=`import { defineDataView } from '@contractspec/lib.contracts-spec/data-views';
import { ListDataGridShowcaseRowsQuery } from '@contractspec/example.data-grid-showcase/contracts/data-grid-showcase.operation';

export const DataGridShowcaseDataView = defineDataView({
  meta: {
    key: 'examples.data-grid-showcase.table',
    version: '1.0.0',
    entity: 'account',
    title: 'Data Grid Showcase Table',
    description:
      'Declarative DataViewSpec for the ContractSpec table showcase.',
    domain: 'examples',
    owners: ['@platform.core'],
    tags: ['examples', 'table', 'data-grid'],
    stability: 'experimental',
  },
  source: {
    primary: {
      key: ListDataGridShowcaseRowsQuery.meta.key,
      version: ListDataGridShowcaseRowsQuery.meta.version,
    },
  },
  view: {
    kind: 'table',
    executionMode: 'client',
    selection: 'multiple',
    columnVisibility: true,
    columnResizing: true,
    columnPinning: true,
    rowExpansion: {
      fields: ['notes', 'renewalDate', 'lastActivityAt'],
    },
    initialState: {
      pageSize: 4,
      hiddenColumns: ['notes'],
      pinnedColumns: {
        left: ['account'],
      },
      sorting: [{ field: 'arr', desc: true }],
    },
    fields: [
      { key: 'account', label: 'Account', dataPath: 'account', sortable: true },
      { key: 'owner', label: 'Owner', dataPath: 'owner', sortable: true },
      { key: 'status', label: 'Status', dataPath: 'status', sortable: true },
      { key: 'notes', label: 'Notes', dataPath: 'notes' },
    ],
  },
});`;function v(){return t("div",{className:"space-y-8",children:[t("div",{className:"space-y-4",children:[e("h1",{className:"font-bold text-4xl",children:"@contractspec/lib.contracts-spec"}),e("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."})]}),t("div",{className:"space-y-4",children:[e("h2",{className:"font-bold text-2xl",children:"Installation"}),e(d,{package:["@contractspec/lib.contracts-spec","@contractspec/lib.schema"]})]}),t("div",{className:"space-y-4",children:[e("h2",{className:"font-bold text-2xl",children:"What lives where"}),t("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[t("li",{children:[e("strong",{children:"@contractspec/lib.contracts-spec"})," (root): The core contracts definitions (OperationSpec, PresentationSpec, Registry)."]}),t("li",{children:[e("strong",{children:"@contractspec/lib.contracts-runtime-client-react"}),": Browser-safe helpers (React renderers, client SDK). Import this for web/React Native."]}),t("li",{children:[e("strong",{children:"@contractspec/lib.contracts-runtime-server-rest"}),": HTTP/MCP adapters, registries, integrations (Node-only)."]}),t("li",{children:[e("strong",{children:"@contractspec/lib.schema"}),": Schema dictionary (SchemaModel, FieldType) for I/O definitions."]})]})]}),t("div",{className:"space-y-4",children:[e("h2",{className:"font-bold text-2xl",children:"Data table contract example"}),t("p",{className:"text-muted-foreground",children:["The canonical account-grid example starts here in"," ",e("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."]}),e(s,{language:"typescript",code:m}),t("p",{className:"text-muted-foreground text-sm",children:["See the live version in"," ",e(r,{href:"/docs/examples/data-grid-showcase",className:"text-[color:var(--rust)] underline underline-offset-4",children:"/docs/examples/data-grid-showcase"}),"."]})]}),t("div",{className:"space-y-4",children:[e("h2",{className:"font-bold text-2xl",children:"Core Concepts"}),t("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[t("li",{children:[e("strong",{children:"OperationSpec"}),": Immutable description of an operation (Command or Query). Defines I/O, policy, and metadata."]}),t("li",{children:[e("strong",{children:"OperationSpecRegistry"}),": Registry of specs + handlers. Use ",e("code",{className:"font-mono text-xs",children:"installOp"})," ","to attach a handler."]}),t("li",{children:[e("strong",{children:"CapabilitySpec"}),": Canonical capability declaration (requires/provides)."]}),t("li",{children:[e("strong",{children:"PolicySpec"}),": Declarative policy rules (ABAC/ReBAC, rate limits)."]}),t("li",{children:[e("strong",{children:"TelemetrySpec"}),": Analytics definitions and privacy levels."]}),t("li",{children:[e("strong",{children:"PresentationSpec (V2)"}),": Describes how data is rendered (Web Components, Markdown, Data)."]}),t("li",{children:[e("strong",{children:"DataViewSpec"}),": Declarative list, table, grid, and detail contracts that the table showcase uses as its canonical account-grid example."]})]})]}),t("div",{className:"space-y-4",children:[e("h2",{className:"font-bold text-2xl",children:"Lifecycle"}),t("ol",{className:"list-inside list-decimal space-y-2 text-muted-foreground",children:[t("li",{children:[e("strong",{children:"Define"})," the spec (I/O via SchemaModel or Zod)."]}),t("li",{children:[e("strong",{children:"Register"})," it:"," ",e("code",{className:"font-mono text-xs",children:"installOp(registry, spec, handler)"}),"."]}),t("li",{children:[e("strong",{children:"Expose"})," it via an adapter (REST, GraphQL, MCP)."]}),t("li",{children:[e("strong",{children:"Validate"})," at runtime automatically."]})]})]}),t("div",{className:"space-y-4",children:[e("h2",{className:"font-bold text-2xl",children:"Adapters"}),t("ul",{className:"space-y-2 text-muted-foreground",children:[t("li",{children:[e("code",{className:"rounded bg-background/50 px-2 py-1",children:"server/rest-next-app"}),": Next.js App Router adapter"]}),t("li",{children:[e("code",{className:"rounded bg-background/50 px-2 py-1",children:"server/provider-mcp"}),": Model Context Protocol (MCP) for AI agents"]}),t("li",{children:[e("code",{className:"rounded bg-background/50 px-2 py-1",children:"server/graphql-pothos"}),": GraphQL schema generator"]})]})]}),t("div",{className:"flex items-center gap-4 pt-4",children:[t(r,{href:"/docs/libraries/schema",className:"btn-primary",children:["Next: Schema ",e(p,{size:16})]}),e(r,{href:"/docs/specs/capabilities",className:"btn-ghost",children:"Core Concepts"})]})]})}export{v as LibrariesContractsPage};
