@contractspec/bundle.library 3.9.8 → 3.9.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +222 -214
- package/CHANGELOG.md +52 -0
- package/dist/components/docs/DocsIndexPage.js +2 -2
- package/dist/components/docs/docsManifest.js +1 -1
- package/dist/components/docs/getting-started/DataViewTutorialPage.js +81 -6
- package/dist/components/docs/getting-started/index.js +94 -19
- package/dist/components/docs/guides/GuideDataExchangeImportTemplatesPage.content.d.ts +6 -0
- package/dist/components/docs/guides/GuideDataExchangeImportTemplatesPage.content.js +176 -0
- package/dist/components/docs/guides/GuideDataExchangeImportTemplatesPage.d.ts +1 -0
- package/dist/components/docs/guides/GuideDataExchangeImportTemplatesPage.js +176 -0
- package/dist/components/docs/guides/GuidesIndexPage.js +2 -2
- package/dist/components/docs/guides/index.d.ts +1 -0
- package/dist/components/docs/guides/index.js +220 -46
- package/dist/components/docs/index.js +1003 -309
- package/dist/components/docs/libraries/LibrariesApplicationShellPage.content.d.ts +22 -5
- package/dist/components/docs/libraries/LibrariesApplicationShellPage.content.js +125 -37
- package/dist/components/docs/libraries/LibrariesApplicationShellPage.js +125 -37
- package/dist/components/docs/libraries/LibrariesDataViewsPage.js +120 -3
- package/dist/components/docs/libraries/LibrariesDesignSystemPage.js +101 -2
- package/dist/components/docs/libraries/LibrariesOverviewPage.js +1 -1
- package/dist/components/docs/libraries/LibrariesPersonalizationPage.js +58 -4
- package/dist/components/docs/libraries/LibrariesTranslationRuntimePage.content.d.ts +10 -0
- package/dist/components/docs/libraries/LibrariesTranslationRuntimePage.content.js +43 -0
- package/dist/components/docs/libraries/LibrariesTranslationRuntimePage.d.ts +1 -0
- package/dist/components/docs/libraries/LibrariesTranslationRuntimePage.js +43 -0
- package/dist/components/docs/libraries/index.d.ts +1 -0
- package/dist/components/docs/libraries/index.js +496 -97
- package/dist/components/docs/specs/SpecsDataViewsPage.js +49 -3
- package/dist/components/docs/specs/index.js +60 -14
- package/dist/index.js +1014 -320
- package/dist/node/components/docs/DocsIndexPage.js +2 -2
- package/dist/node/components/docs/docsManifest.js +1 -1
- package/dist/node/components/docs/getting-started/DataViewTutorialPage.js +81 -6
- package/dist/node/components/docs/getting-started/index.js +94 -19
- package/dist/node/components/docs/guides/GuideDataExchangeImportTemplatesPage.content.js +175 -0
- package/dist/node/components/docs/guides/GuideDataExchangeImportTemplatesPage.js +175 -0
- package/dist/node/components/docs/guides/GuidesIndexPage.js +2 -2
- package/dist/node/components/docs/guides/index.js +220 -46
- package/dist/node/components/docs/index.js +1003 -309
- package/dist/node/components/docs/libraries/LibrariesApplicationShellPage.content.js +125 -37
- package/dist/node/components/docs/libraries/LibrariesApplicationShellPage.js +125 -37
- package/dist/node/components/docs/libraries/LibrariesDataViewsPage.js +120 -3
- package/dist/node/components/docs/libraries/LibrariesDesignSystemPage.js +101 -2
- package/dist/node/components/docs/libraries/LibrariesOverviewPage.js +1 -1
- package/dist/node/components/docs/libraries/LibrariesPersonalizationPage.js +58 -4
- package/dist/node/components/docs/libraries/LibrariesTranslationRuntimePage.content.js +42 -0
- package/dist/node/components/docs/libraries/LibrariesTranslationRuntimePage.js +42 -0
- package/dist/node/components/docs/libraries/index.js +496 -97
- package/dist/node/components/docs/specs/SpecsDataViewsPage.js +49 -3
- package/dist/node/components/docs/specs/index.js +60 -14
- package/dist/node/index.js +1014 -320
- package/package.json +74 -26
- package/src/components/docs/docsManifest.test.ts +87 -0
- package/src/components/docs/docsManifest.ts +90 -3
- package/src/components/docs/generated/docs-index.notifications.json +7 -7
- package/src/components/docs/getting-started/DataViewTutorialPage.tsx +181 -50
- package/src/components/docs/guides/GuideDataExchangeImportTemplatesPage.content.ts +185 -0
- package/src/components/docs/guides/GuideDataExchangeImportTemplatesPage.tsx +186 -0
- package/src/components/docs/guides/GuidesIndexPage.tsx +49 -42
- package/src/components/docs/guides/index.ts +1 -0
- package/src/components/docs/libraries/LibrariesApplicationShellPage.content.ts +148 -35
- package/src/components/docs/libraries/LibrariesApplicationShellPage.tsx +38 -5
- package/src/components/docs/libraries/LibrariesDataViewsPage.tsx +267 -64
- package/src/components/docs/libraries/LibrariesDesignSystemPage.tsx +235 -0
- package/src/components/docs/libraries/LibrariesOverviewPage.tsx +8 -2
- package/src/components/docs/libraries/LibrariesPersonalizationPage.tsx +141 -31
- package/src/components/docs/libraries/LibrariesTranslationRuntimePage.content.ts +78 -0
- package/src/components/docs/libraries/LibrariesTranslationRuntimePage.tsx +137 -0
- package/src/components/docs/libraries/index.ts +1 -0
- package/src/components/docs/specs/SpecsDataViewsPage.tsx +239 -113
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var v=Object.defineProperty;var D=(K)=>K;function M(K,N){this[K]=D.bind(null,N)}var B=(K,N)=>{for(var Y in N)v(K,Y,{get:N[Y],enumerable:!0,configurable:!0,set:M.bind(N,Y)})};var _=(K,N)=>()=>(K&&(N=K(K=0)),N);import{CodeBlock as Z}from"@contractspec/lib.design-system";import{HStack as R,VStack as z}from"@contractspec/lib.design-system/layout";import{List as $,ListItem as J}from"@contractspec/lib.design-system/list";import{Code as F,H1 as W,H2 as O,H3 as Q,P as G,Text as w}from"@contractspec/lib.design-system/typography";import U from"@contractspec/lib.ui-link";import{ChevronRight as X}from"lucide-react";import{jsx as f,jsxs as q}from"react/jsx-runtime";var b=`import { defineDataView } from '@contractspec/lib.contracts-spec/data-views';
|
|
2
2
|
import { ListDataGridShowcaseRowsQuery } from '@contractspec/example.data-grid-showcase/contracts/data-grid-showcase.operation';
|
|
3
3
|
|
|
4
4
|
export const DataGridShowcaseDataView = defineDataView({
|
|
@@ -61,8 +61,41 @@ export const DataGridShowcaseDataView = defineDataView({
|
|
|
61
61
|
dataPath: 'lastActivityAt',
|
|
62
62
|
format: { type: 'datetime', dateStyle: 'medium', timeStyle: 'short' },
|
|
63
63
|
},
|
|
64
|
-
{
|
|
64
|
+
{
|
|
65
|
+
key: 'notes',
|
|
66
|
+
label: 'Notes',
|
|
67
|
+
dataPath: 'notes',
|
|
68
|
+
visibility: { minDataDepth: 'detailed' },
|
|
69
|
+
},
|
|
65
70
|
],
|
|
71
|
+
collection: {
|
|
72
|
+
viewModes: {
|
|
73
|
+
defaultMode: 'table',
|
|
74
|
+
allowedModes: ['list', 'grid', 'table'],
|
|
75
|
+
},
|
|
76
|
+
pagination: {
|
|
77
|
+
pageSize: 25,
|
|
78
|
+
pageSizeOptions: [10, 25, 50],
|
|
79
|
+
},
|
|
80
|
+
toolbar: {
|
|
81
|
+
search: true,
|
|
82
|
+
viewMode: true,
|
|
83
|
+
filters: true,
|
|
84
|
+
density: true,
|
|
85
|
+
dataDepth: true,
|
|
86
|
+
},
|
|
87
|
+
density: 'comfortable',
|
|
88
|
+
dataDepth: 'standard',
|
|
89
|
+
personalization: {
|
|
90
|
+
enabled: true,
|
|
91
|
+
persist: {
|
|
92
|
+
viewMode: true,
|
|
93
|
+
density: true,
|
|
94
|
+
dataDepth: true,
|
|
95
|
+
pageSize: true,
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
},
|
|
66
99
|
filters: [
|
|
67
100
|
{ key: 'status', label: 'Status', field: 'status', type: 'enum' },
|
|
68
101
|
{
|
|
@@ -81,4 +114,17 @@ export const DataGridShowcaseDataView = defineDataView({
|
|
|
81
114
|
},
|
|
82
115
|
],
|
|
83
116
|
},
|
|
84
|
-
});`;function
|
|
117
|
+
});`;function l(){return q(z,{className:"space-y-8",children:[q(z,{className:"space-y-4",children:[f(W,{className:"font-bold text-4xl",children:"DataViews"}),q(G,{className:"text-muted-foreground",children:["A ",f(w,{className:"font-semibold",children:"DataViewSpec"})," describes how data should be queried, filtered, sorted, and presented to users. Runtime adapters execute optimized database queries and serve list views, detail views, and search interfaces while respecting policy constraints."]})]}),q(z,{className:"space-y-4",children:[f(O,{className:"font-bold text-2xl",children:"Core concepts"}),q(z,{className:"space-y-3",children:[q(z,{children:[f(Q,{className:"font-semibold text-lg",children:"Data sources"}),f(G,{className:"text-muted-foreground",children:"A DataView connects to one or more data sources—databases, APIs, or other capabilities. You specify the source and the fields you want to expose."})]}),q(z,{children:[f(Q,{className:"font-semibold text-lg",children:"Filtering"}),f(G,{className:"text-muted-foreground",children:"Define filters that users can apply to narrow down results. Filters are typed as search, enum, number, percent, currency, date, time, datetime, duration, or boolean so renderers and query helpers can validate values before execution."})]}),q(z,{children:[f(Q,{className:"font-semibold text-lg",children:"Sorting"}),f(G,{className:"text-muted-foreground",children:"Specify which fields can be sorted and the default sort order. ContractSpec generates efficient database queries with proper indexes."})]}),q(z,{children:[f(Q,{className:"font-semibold text-lg",children:"Pagination"}),f(G,{className:"text-muted-foreground",children:"DataViews automatically support pagination to handle large datasets. You can configure page size limits and cursor-based or offset-based pagination."})]}),q(z,{children:[f(Q,{className:"font-semibold text-lg",children:"Collection modes and data depth"}),q(G,{className:"text-muted-foreground",children:["List, grid, and table views can share a single"," ",f(F,{children:"view.collection"})," contract. It declares allowed view modes, toolbar controls, page-size defaults, density, data depth, and persistence hints. Fields can use"," ",f(F,{children:"visibility.minDataDepth"})," so summary views stay light while detailed views expose richer context."]})]}),q(z,{children:[f(Q,{className:"font-semibold text-lg",children:"Personalization hints"}),q(G,{className:"text-muted-foreground",children:["The contract layer stays neutral: it can opt into persistence with"," ",f(F,{children:"view.collection.personalization"}),", but it does not import the personalization runtime. Host apps resolve preferences and behavior insights into renderer props."]})]})]})]}),q(z,{className:"space-y-4",children:[f(O,{className:"font-bold text-2xl",children:"Example DataViewSpec"}),q(G,{className:"text-muted-foreground",children:["Here is the canonical table contract used by the live"," ",f(U,{href:"/docs/examples/data-grid-showcase",className:"text-[color:var(--rust)] underline underline-offset-4",children:f(w,{children:"Data Grid Showcase"})}),":"]}),f(Z,{language:"typescript",code:b}),f(G,{className:"text-muted-foreground text-sm",children:"This one contract drives the DataView lane, while the same rows and controller also feed the raw web primitive, native-first primitive, and composed design-system demos."})]}),q(z,{className:"space-y-4",children:[f(O,{className:"font-bold text-2xl",children:"Policy integration"}),q(G,{className:"text-muted-foreground",children:["DataViews automatically enforce"," ",f(U,{href:"/docs/specs/policy",className:"text-violet-400 hover:text-violet-300",children:f(w,{children:"PolicySpecs"})}),". If a user doesn't have permission to see certain fields, those fields are automatically filtered out or redacted. If a user can only see their own data, the query is automatically scoped."]}),f(G,{className:"text-muted-foreground",children:"This means you define the data view once, and it works correctly for all users based on their permissions—no need to write separate queries for different roles."})]}),q(z,{className:"space-y-4",children:[f(O,{className:"font-bold text-2xl",children:"Personalized Rendering Pattern"}),q(G,{className:"text-muted-foreground",children:["To personalize a DataView, keep the spec declarative and resolve user-specific defaults at the app boundary. Use"," ",f(F,{children:"resolveDataViewPreferences"})," from"," ",f(F,{children:"@contractspec/lib.personalization/data-view-preferences"}),"to compute ",f(F,{children:"viewMode"}),", ",f(F,{children:"density"}),","," ",f(F,{children:"dataDepth"}),", and ",f(F,{children:"pageSize"}),". Pass those values to ",f(F,{children:"DataViewRenderer"})," as controlled or default props, then record UI changes with ",f(F,{children:"trackDataViewInteraction"}),"."]}),f(Z,{language:"tsx",code:`const resolved = resolveDataViewPreferences({
|
|
118
|
+
spec: DataGridShowcaseDataView,
|
|
119
|
+
preferences: profile.canonical,
|
|
120
|
+
insights,
|
|
121
|
+
record: savedPreference,
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
<DataViewRenderer
|
|
125
|
+
spec={DataGridShowcaseDataView}
|
|
126
|
+
items={rows}
|
|
127
|
+
defaultViewMode={resolved.viewMode}
|
|
128
|
+
defaultDensity={resolved.density}
|
|
129
|
+
defaultDataDepth={resolved.dataDepth}
|
|
130
|
+
/>;`})]}),q(z,{className:"space-y-4",children:[f(O,{className:"font-bold text-2xl",children:"Served outputs"}),f(G,{className:"text-muted-foreground",children:"From a DataViewSpec, ContractSpec serves:"}),q($,{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[f(J,{children:q(w,{children:[f(w,{className:"font-semibold",children:"Database queries"})," – Optimized SQL or NoSQL queries executed at runtime"]})}),f(J,{children:q(w,{children:[f(w,{className:"font-semibold",children:"API endpoints"})," – RESTful or GraphQL endpoints for fetching data"]})}),f(J,{children:q(w,{children:[f(w,{className:"font-semibold",children:"UI components"})," – List views, tables, cards, and detail views"]})}),f(J,{children:q(w,{children:[f(w,{className:"font-semibold",children:"Personalized defaults"})," – Plain renderer props for preferred mode, density, data depth, and page size"]})}),f(J,{children:q(w,{children:[f(w,{className:"font-semibold",children:"Search interfaces"})," – Full-text search with autocomplete"]})}),f(J,{children:q(w,{children:[f(w,{className:"font-semibold",children:"Export functions"})," – CSV, JSON, or Excel exports"]})})]})]}),q(z,{className:"space-y-4",children:[f(O,{className:"font-bold text-2xl",children:"Best practices"}),q($,{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[f(J,{children:f(w,{children:"Only expose fields that users actually need—this improves performance and security."})}),f(J,{children:f(w,{children:"Use appropriate indexes for sortable and filterable fields."})}),f(J,{children:f(w,{children:"Set reasonable pagination limits to prevent performance issues."})}),f(J,{children:q(w,{children:["Use ",f(F,{children:"allowedModes"})," to constrain mode switching to layouts that the fields and row actions can support."]})}),f(J,{children:q(w,{children:["Store preferences only for dimensions enabled by"," ",f(F,{children:"view.collection.personalization.persist"}),"."]})}),f(J,{children:f(w,{children:"Test DataViews with realistic data volumes to ensure they perform well."})})]})]}),q(R,{className:"items-center gap-4 pt-4",children:[f(U,{href:"/docs/specs/capabilities",className:"btn-ghost",children:f(w,{children:"Previous: Capabilities"})}),q(U,{href:"/docs/specs/workflows",className:"btn-primary",children:[f(w,{children:"Next: Workflows"})," ",f(X,{size:16})]})]})]})}export{l as SpecsDataViewsPage};
|