module.design-studio
Tenant-safe design pack selection, drafting, certification, and reusable studio surfaces.
@lssm-tech/module.design-studiobun add @lssm-tech/module.design-studioManifest declarations describe the current workspace; they do not verify registry publication or runtime execution.
Package guide
Reusable, spec-first design selection and publishing workflows for ContractSpec applications.
The core package provides a canonical async DesignAuthoringStorePort service created with createDesignStudioService({ store, clock, ids, certifier }) and an InMemoryDesignAuthoringStore reference adapter. The original synchronous service remains available through createInMemoryDesignStudioService for compatibility. Both paths preserve strict tenant scoping, private user-owned drafts, optimistic revisions, safe patches, permission-gated certification, immutable publications, unpublication receipts, and deterministic fallback metadata. Catalog discovery supports industry and style filters through a contract adapter.
@lssm-tech/module.design-studio/tenant-authoring is the managed tenant authoring profile used behind authenticated HTTP routes: TenantDesignAuthoringService({ storeFor, now?, id? }) merges built-in packs with the tenant's published designs, enforces the tenant selection policy (fixed, allowed, custom-design switch), keeps private-draft selections in sync, and runs create/clone/replace/restore/delete with revision CAS, validation and preview, certification receipts and publish/unpublish. It differs from AsyncDesignStudioService deliberately: patches replace rather than append, drafts start only from built-in packs, publication requires the exact certified receipt and keeps the per-draft ref tenant.<tenant>.design.<draft>@<revision>.0.0, and every reset request is audited. Errors are DesignStudioError codes with stable host-facing messages. InMemoryDesignAuthoringDatabase gives one tenant-guarded InMemoryDesignAuthoringStore per tenant; the reference store lists drafts newest first and, like the SQL adapter, fences updates by owner and returns false for a stale delete.
Presentation exports provide matching web and React Native faceted gallery, picker, structured section controls, editor, diagnostics, responsive preview, history/diff, and publish controls built from design-system primitives. Consumers own persistence adapters, routing, and application-specific previews. The reference API application supplies the production PostgreSQL adapter and authenticated route composition; the reference web and Expo applications mount the paired Studio surfaces against the real authenticated lifecycle.
@lssm-tech/module.design-studio/presentation/design-studio-session is the platform-neutral client session shared by those web and Expo hosts: useDesignStudioSession({ client, onRefresh }) drives select -> draft -> patch -> validate -> certify -> publish/unpublish -> restore over an injected DesignStudioClient transport port and calls onRefresh after every persisted change (the saved patch refreshes before validation, so an invalid draft is still reflected); selecting a pack clears the draft and publication. assertDesignValidation joins patch and certification issues into one error. Hosts keep the transport adapter and the refresh binding.
Commands
bun run testbun run typecheckbun run lint:checkbun run build
Relationships
Arrows point from a package to its direct dependency. Counts are derived from captured workspace manifests.
5 declarations
@lssm-tech/lib.contracts-spec-coreworkspace:^
Read the package manual ↗@lssm-tech/lib.crypto-utilsworkspace:^
Read the package manual ↗@lssm-tech/lib.design-catalogworkspace:^
Read the package manual ↗@lssm-tech/lib.design-systemworkspace:^
Read the package manual ↗reactcatalog:
Declared capabilities
Tenant-safe design pack selection, drafting, certification, and reusable studio surfaces.
Scripts
publish:pkgbun publish --tolerate-republish --ignore-scripts --verbosepublish:pkg:canarybun publish:pkg --tag canarybuildcontractspec-bun-build buildbuild:bundlecontractspec-bun-build transpilebuild: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 testprebuildcontractspec-bun-build prebuildtypechecktsgo --noEmit