lib.presentation-runtime-core
Core presentation runtime for contract-driven UIs
@lssm-tech/lib.presentation-runtime-corebun add @lssm-tech/lib.presentation-runtime-coreManifest declarations describe the current workspace; they do not verify registry publication or runtime execution.
Package guide
Website: https://contractspec.io
Core presentation runtime for contract-driven UIs.
What It Provides
- Layer: lib.
- Consumers: presentation-runtime-react, presentation-runtime-react-native.
- Related ContractSpec packages include
@lssm-tech/lib.contracts-spec,@lssm-tech/tool.bun,@lssm-tech/tool.typescript. - Related ContractSpec packages include
@lssm-tech/lib.contracts-spec,@lssm-tech/tool.bun,@lssm-tech/tool.typescript.
Installation
npm install @lssm-tech/lib.presentation-runtime-core
or
bun add @lssm-tech/lib.presentation-runtime-core
Usage
Import the root entrypoint from @lssm-tech/lib.presentation-runtime-core, or choose a documented subpath when you only need one part of the package surface.
Adaptive Experiences
The ./adaptive-experience entrypoint maps ContractSpec adaptive experience primitives into presentation defaults that UI renderers can consume without importing product-specific code. It currently resolves DataView defaults such as collection view, density, data depth, and page size from ResolvedAdaptiveExperience.
Use this adapter at the boundary between product policy and rendering code. It should receive already-resolved preferences, behavior support, signals, constraints, and overrides; it should not store hidden user profiles or bypass permissions.
Bundler Helpers
Import Next configuration helpers from the existing configuration-only leaf. Root runtime forwards and the Metro CommonJS entry remain compatible.
import {
withPresentationTurbopackAliases,
withPresentationWebpackAliases,
} from '@lssm-tech/lib.presentation-runtime-core/next';Next.js Turbopack helper (default)
Use Turbopack as the default Next.js path:
import { withPresentationTurbopackAliases } from '@lssm-tech/lib.presentation-runtime-core/next';
const nextConfig = withPresentationTurbopackAliases({
turbopack: {
resolveAlias: {
fs: { browser: 'browserify-fs' },
},
},
});
export default nextConfig;Next.js Webpack helper (fallback)
Use Webpack only when you opt in with next dev --webpack or next build --webpack:
import { withPresentationWebpackAliases } from '@lssm-tech/lib.presentation-runtime-core/next';
const nextConfig = {
webpack: (config) => withPresentationWebpackAliases(config),
};
export default nextConfig;Expo / Metro helper
const { getDefaultConfig } = require('expo/metro-config');
const {
withPresentationMetroAliases,
} = require('@lssm-tech/lib.presentation-runtime-core');
const projectRoot = __dirname;
const config = getDefaultConfig(projectRoot);
module.exports = withPresentationMetroAliases(config);The helpers also keep shared UI imports platform-correct:
- Metro rewrites
@lssm-tech/lib.ui-kit-web/ui/*to@lssm-tech/lib.ui-kit/ui/*,@lssm-tech/lib.presentation-runtime-reactto@lssm-tech/lib.presentation-runtime-react-native, andlucide-reacttolucide-react-nativefor native platforms. - Metro also enables package exports and merges platform export conditions so
ios,android,react-native, andbrowserpackage conditions can resolve platform-specific build-tool outputs. - Next.js Turbopack/Webpack rewrites the native package names back to the web packages, including
lucide-react-nativetolucide-react.
Architecture
src/index.tsis the root public barrel that builds the package entrypoint.src/adaptive-experience.tsis part of the package's public or composition surface.src/metro.tsis part of the package's public or composition surface.src/next.tsis part of the package's public or composition surface.src/table.tsis part of the package's public or composition surface.src/visualization.echarts.tsis part of the package's public or composition surface.src/visualization.model.builders.tsis part of the package's public or composition surface.src/visualization.model.helpers.tsis part of the package's public or composition surface.
Public Entry Points
- Export
.publishes through./dist/index.js; CommonJSrequireresolves to the generated Metro helper at./dist/metro.cjs. - Export
./adaptive-experiencebuilds from./src/adaptive-experience.ts. - The existing
./nextleaf owns Next configuration helpers; the root entrypoint keeps its compatibility forwards. - Export
./metrobuilds from./src/metro.tsand publishes a generated CommonJSdist/metro.cjsrequire target for Metro config files. - Export
./nextbuilds from./src/next.ts. - Export
./presentation-aliasesbuilds from the configuration-only alias primitives in./src/presentation-aliases.ts. - Export
./tablebuilds from./src/table.ts. - Export
./visualizationbuilds from./src/visualization.ts. - Export
./visualization.echartsbuilds from./src/visualization.echarts.ts. - Export
./visualization.modelbuilds from./src/visualization.model.ts. - Export
./visualization.model.buildersbuilds from./src/visualization.model.builders.ts. - Export
./visualization.model.helpersbuilds from./src/visualization.model.helpers.ts. - Export
./visualization.typesbuilds from./src/visualization.types.ts. - Export
./visualization.utilsbuilds from./src/visualization.utils.ts. - Export
./marketingbuilds from./src/marketing/index.ts: marketing meta builders, the SEO transform and the presentation descriptor normalizer.
Marketing presentation descriptors
normalizeMarketingPresentationDescriptor turns a marketing page (and optional site bindings, evidence and global CTAs) into a serializable MarketingPresentationDescriptor. Its input is structural: MarketingPresentationPageInput and MarketingPresentationSiteInput name only the fields the normalizer reads, over a MarketingPresentation* vocabulary that mirrors the growth marketing site vocabulary. Growth MarketingPageContract and MarketingSiteContract values satisfy them as-is, so hosts pass growth contracts directly. This platform package has no runtime dependency on @lssm-tech/lib.growth-spec; a type-only parity test (src/marketing/descriptor-vocabulary.test.ts, growth-spec as a devDependency) fails typecheck if the two vocabularies drift.
Local Commands
bun run dev— contractspec-bun-build devbun run build— bun run prebuild && bun run build:bundle && bun run build:typesbun run lint— bun run lint:fixbun run lint:check— biome check .bun run lint:fix— biome check --write --unsafe --only=nursery/useSortedClasses . && biome check --write .bun run typecheck— tsgo --noEmit -p tsconfig.jsonbun run publish:pkg— bun publish --tolerate-republish --ignore-scripts --verbosebun run publish:pkg:canary— bun publish:pkg --tag canarybun run clean— rimraf dist .turbobun run build:bundle— contractspec-bun-build transpilebun run build:types— contractspec-bun-build typesbun run prebuild— contractspec-bun-build prebuild
Recent Updates
- Replace eslint+prettier by biomejs to optimize speed.
- Add data visualization capabilities.
- Add table capabilities.
- Add table overflow metadata to controller render models so web and native renderers can apply consistent cell overflow behavior.
- Add adaptive experience adapters for DataView presentation defaults.
Notes
- Core runtime interface is consumed by all presentation runtimes — changes here affect both web and mobile.
- Must remain platform-agnostic; no React or React Native imports allowed.
- API surface changes require coordinated updates in both downstream runtimes.
Whole canonical adaptive and presentation ownership
Preserve the complete existing adaptive policy, permissions, constraints, override and event families; schema-to-markdown and structured-data implementations; rich-code preferences; all rendering and marketing behavior, defaults and original test assertions. Bind each whole family to its genuine existing Core, Kernel, Growth, DesignCatalog or complete RuntimeCore host supplier. Historical imports remain exact canonical forwards.
This is a Source-only compatible ownership proposal. Fresh task-bound adoption, owning production, declarations, affected runtime tests and platform qualification remain required.
The complete SEO integration test and snapshot live in the Legacy app-config test directory because they exercise its original resolveAppConfig implementation. Pure presentation tests remain with this package; the Legacy test declares its canonical presentation dependency.
Relationships
Arrows point from a package to its direct dependency. Counts are derived from captured workspace manifests.
8 declarations
@types/turndown^5.0.6
echartscatalog:ui
turndown^7.2.4
@lssm-tech/lib.contracts-runtime-kernelworkspace:^
Read the package manual ↗@lssm-tech/lib.contracts-spec-coreworkspace:^
Read the package manual ↗@lssm-tech/lib.orchestration-specworkspace:^
Read the package manual ↗
Declared capabilities
Core presentation runtime for contract-driven UIs
Scripts
publish:pkgbun publish --tolerate-republish --ignore-scripts --verbosepublish:pkg:canarybun publish:pkg --tag canarybuildbun run build:bundle && bun run build:require && bun run build:typesbuild:bundlecontractspec-bun-build transpilebuild:requirebun build src/metro.ts --target node --format cjs --packages external --outfile dist/metro.cjsbuild:typescontractspec-bun-build typescleanrimraf dist .turbodevcontractspec-bun-build devlintbun run lint:fixlint:fixnode ../../../../scripts/biome.cjs check --write --unsafe --only=nursery/useSortedClasses . && node ../../../../scripts/biome.cjs check --write .lint:checknode ../../../../scripts/biome.cjs check .testbun test --pass-with-no-testsprebuildcontractspec-bun-build prebuildtypechecktsgo --noEmit -p tsconfig.json