lib.personalized-presentation
Schema bridge, React provider and hook that resolve lib.personalization preferences and role variant overrides into cockpit-kit variant literals
@lssm-tech/lib.personalized-presentationbun add @lssm-tech/lib.personalized-presentationManifest declarations describe the current workspace; they do not verify registry publication or runtime execution.
Package guide
Schema bridge, React provider/hooks, and contract-driven Layer 7 Personalized Presentation, DataView & Form Progressive Disclosure engine resolving @lssm-tech/lib.personalization preferences, RoleMorph overrides, subject-scoped saved filters, and accessibility overrides across react, markdown, and application/json targets.
Capabilities
- Cockpit Variant Bridge (Phase 3):
density,expansion,mapPreferencesToVariants,resolvePersonalizedVariants,PersonalizedSurfaceProvider, andusePersonalizedVariants. - DataView Personalization (Layer 7):
resolvePersonalizedDataViewandusePersonalizedDataViewresolve adaptive field ordering (anchoringprimaryField), summary vs detail field/section progressive disclosure, and validated saved filters (resolveSavedViewFilters,applyDataViewFilters). - Form Progressive Disclosure (Layer 7):
resolvePersonalizedFormandusePersonalizedFormadapt field order,sectionsvsstepsflow, and responsive columns while guaranteeing required,requiredWhen, completion-profile,readOnly, and unlisted fields are never dropped. - Multi-Target Parity (
react | markdown | application/json):projectPersonalizedDataViewTargetandprojectPersonalizedFormTargetemit consistent projections with recursivepolicy.piiredaction and target validation againstPresentationSpec.targets. - Presentation-Only Authority Stamp: Every output carries
{ authority: 'presentation-only', canGrantAuthority: false }. Locked contract filters (filterScope.locked) and cross-subject saved-view isolation (viewerScope) cannot be bypassed.
Installation
"@lssm-tech/lib.personalized-presentation": "workspace:*"Usage
Provider & Cockpit Variants
import {
PersonalizedSurfaceProvider,
usePersonalizedVariants,
type PersonalizedRoleVariants,
} from "@lssm-tech/lib.personalized-presentation";
const roleVariants: PersonalizedRoleVariants = {
operator: { components: { NavRail: { expansion: "collapsed" } } },
executive: {
surface: { expansion: "collapsed" },
components: { MetricPanel: { density: "comfortable" } },
},
};
function CockpitRoot({ children }: { children: React.ReactNode }) {
return (
<PersonalizedSurfaceProvider
role="operator"
prefs={userPrefs}
roleVariants={roleVariants}
viewerScope={{ tenantId: "org-1", subjectId: "user-1" }}
accessibility={{ readableDensity: false }}
>
{children}
</PersonalizedSurfaceProvider>
);
}Contract-Driven DataView, Form & Multi-Target Projection
import {
projectPersonalizedDataViewTarget,
resolvePersonalizedDataView,
resolvePersonalizedForm,
} from "@lssm-tech/lib.personalized-presentation";
const resolvedView = resolvePersonalizedDataView({
spec: dataViewSpec,
prefs: userPrefs,
role: "analyst",
viewerScope: { tenantId: "org-1", subjectId: "user-1" },
userFieldOrder: ["status", "score"],
savedView: {
id: "view-1",
dataViewKey: dataViewSpec.meta.key,
scope: { tenantId: "org-1", subjectId: "user-1" },
filters: { status: { kind: "single", value: "open" } },
},
});
const markdown = projectPersonalizedDataViewTarget({
target: "markdown",
spec: dataViewSpec,
resolved: resolvedView,
items: records,
presentation: presentationSpec,
});
const resolvedForm = resolvePersonalizedForm({
spec: formSpec,
prefs: userPrefs,
accessibility: { singleColumn: true },
});Precedence Order
- Segment defaults (
segmentDataDepth,segmentFieldOrder,segmentFilters) - Tenant reviewed config (
tenantDataDepth,tenantFieldOrder,tenantFilters) - User preference & RoleMorph (
prefs,roleVariants,userFieldOrder, subject-scopedsavedView) - Accessibility overrides (
accessibility.readableDensity,accessibility.singleColumn) — always wins over aesthetic compression whilefilterScope.lockedandpolicy.piiremain immutable.
Wired vs Stub-Protected Dimensions
| Dimension | Input type | Output type |
|---|---|---|
| density | PreferenceDimensions["density"] | Density |
| expansion | PreferenceDimensions["dataDepth"] | Expansion |
Unwired dimensions (verbosity, trigger, panelMode, enrichedKinds, perKindOptOut) remain stub-protected in ./schema/_stubs/* and throw if called at runtime.
Relationships
Arrows point from a package to its direct dependency. Counts are derived from captured workspace manifests.
2 declarations
@lssm-tech/lib.cockpit-kitworkspace:^
Read the package manual ↗@lssm-tech/lib.contracts-spec-coreworkspace:^
Read the package manual ↗
Declared capabilities
Schema bridge, React provider and hook that resolve lib.personalization preferences and role variant overrides into cockpit-kit variant literals
Scripts
publish:pkgbun publish --tolerate-republish --ignore-scripts --verbosepublish:pkg:canarybun publish:pkg --tag canarybuildbun run prebuild && bun run build:bundle && bun run build:typesbuild:bundlecontractspec-bun-build transpile --no-bundlebuild:typescontractspec-bun-build typesdevcontractspec-bun-build devcleanrimraf dist .turbolintbun 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