@elevasis/sdk 1.21.0 → 1.22.1
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/dist/cli.cjs +1239 -173
- package/dist/index.d.ts +1752 -464
- package/dist/index.js +3477 -143
- package/dist/node/index.d.ts +1 -0
- package/dist/node/index.js +19 -1
- package/dist/test-utils/index.d.ts +1188 -127
- package/dist/test-utils/index.js +3359 -152
- package/dist/worker/index.js +3148 -80
- package/package.json +2 -2
- package/reference/claude-config/hooks/post-edit-validate.mjs +98 -98
- package/reference/claude-config/hooks/scaffold-registry-reminder.mjs +188 -188
- package/reference/claude-config/hooks/tool-failure-recovery.mjs +73 -73
- package/reference/claude-config/registries/graph-skills.json +4 -4
- package/reference/claude-config/registries/knowledge-flags.json +0 -2
- package/reference/claude-config/rules/active-change-index.md +80 -80
- package/reference/claude-config/rules/agent-start-here.md +277 -277
- package/reference/claude-config/rules/deployment.md +57 -57
- package/reference/claude-config/rules/error-handling.md +56 -56
- package/reference/claude-config/rules/execution.md +40 -40
- package/reference/claude-config/rules/frontend.md +4 -4
- package/reference/claude-config/rules/observability.md +31 -31
- package/reference/claude-config/rules/operations.md +29 -17
- package/reference/claude-config/rules/organization-model.md +113 -81
- package/reference/claude-config/rules/organization-os.md +115 -113
- package/reference/claude-config/rules/package-taxonomy.md +33 -33
- package/reference/claude-config/rules/platform.md +42 -42
- package/reference/claude-config/rules/shared-types.md +49 -46
- package/reference/claude-config/rules/task-tracking.md +47 -47
- package/reference/claude-config/rules/ui.md +200 -200
- package/reference/claude-config/rules/vibe.md +235 -235
- package/reference/claude-config/scripts/statusline-command.js +18 -18
- package/reference/claude-config/settings.json +34 -34
- package/reference/claude-config/skills/deploy/{SKILL.md → skill.md} +156 -156
- package/reference/claude-config/skills/dsp/SKILL.md +66 -66
- package/reference/claude-config/skills/elevasis/SKILL.md +235 -235
- package/reference/claude-config/skills/explore/SKILL.md +6 -6
- package/reference/claude-config/skills/git-sync/SKILL.md +126 -126
- package/reference/claude-config/skills/knowledge/SKILL.md +314 -299
- package/reference/claude-config/skills/knowledge/operations/codify-level-a.md +100 -100
- package/reference/claude-config/skills/knowledge/operations/codify-level-b.md +159 -159
- package/reference/claude-config/skills/knowledge/operations/customers.md +109 -109
- package/reference/claude-config/skills/knowledge/operations/features.md +76 -76
- package/reference/claude-config/skills/knowledge/operations/goals.md +118 -118
- package/reference/claude-config/skills/knowledge/operations/identity.md +93 -93
- package/reference/claude-config/skills/knowledge/operations/labels.md +94 -94
- package/reference/claude-config/skills/knowledge/operations/offerings.md +109 -109
- package/reference/claude-config/skills/knowledge/operations/roles.md +99 -99
- package/reference/claude-config/skills/knowledge/operations/techStack.md +30 -30
- package/reference/claude-config/skills/project/SKILL.md +1088 -1088
- package/reference/claude-config/skills/run-ui/SKILL.md +73 -73
- package/reference/claude-config/skills/save/SKILL.md +3 -3
- package/reference/claude-config/skills/setup/SKILL.md +275 -275
- package/reference/claude-config/skills/status/SKILL.md +59 -59
- package/reference/claude-config/skills/submit-request/SKILL.md +180 -180
- package/reference/claude-config/skills/sync/SKILL.md +47 -47
- package/reference/claude-config/skills/tutorial/SKILL.md +259 -259
- package/reference/claude-config/skills/tutorial/progress-template.md +74 -74
- package/reference/claude-config/skills/tutorial/technical.md +1303 -1303
- package/reference/claude-config/skills/tutorial/vibe-coder.md +890 -890
- package/reference/claude-config/sync-notes/2026-04-22-git-sync-and-sync-notes.md +27 -27
- package/reference/claude-config/sync-notes/2026-04-22-lead-gen-deliverability-removal.md +30 -30
- package/reference/claude-config/sync-notes/2026-04-24-test-utils-and-template-tests.md +73 -73
- package/reference/claude-config/sync-notes/2026-04-24-ui-consolidation-and-sdk-cli-train.md +86 -86
- package/reference/claude-config/sync-notes/2026-04-25-auth-role-system-and-settings-roles.md +55 -55
- package/reference/claude-config/sync-notes/2026-04-27-crm-hitl-action-layer-cutover.md +97 -97
- package/reference/claude-config/sync-notes/2026-04-27-lead-gen-substrate-train.md +112 -112
- package/reference/claude-config/sync-notes/2026-04-29-crm-state-and-lead-gen-processing-status.md +93 -93
- package/reference/claude-config/sync-notes/2026-05-02-crm-ownership-next-action.md +58 -58
- package/reference/claude-config/sync-notes/2026-05-02-template-hardcode-workos-config.md +56 -56
- package/reference/claude-config/sync-notes/2026-05-04-elevasis-workspace.md +71 -71
- package/reference/claude-config/sync-notes/2026-05-04-knowledge-bundle.md +83 -83
- package/reference/claude-config/sync-notes/2026-05-04-template-skills-run-ui-and-tutorial.md +59 -59
- package/reference/claude-config/sync-notes/2026-05-05-list-builder.md +42 -42
- package/reference/claude-config/sync-notes/2026-05-06-crm-spine.md +60 -60
- package/reference/claude-config/sync-notes/2026-05-06-sdk-changes-release-train.md +37 -37
- package/reference/claude-config/sync-notes/2026-05-07-sdk-changes-release-train.md +34 -34
- package/reference/claude-config/sync-notes/2026-05-08-resource-governance-scaffold-guidance.md +38 -38
- package/reference/claude-config/sync-notes/2026-05-09-clients-domain.md +32 -32
- package/reference/claude-config/sync-notes/2026-05-09-command-system.md +33 -33
- package/reference/claude-config/sync-notes/2026-05-09-resource-governance-and-misc.md +69 -69
- package/reference/claude-config/sync-notes/2026-05-12-sdk-ready-release-train.md +30 -30
- package/reference/claude-config/sync-notes/2026-05-14-organization-model-ontology-refactor.md +45 -0
- package/reference/claude-config/sync-notes/README.md +43 -43
- package/reference/cli.mdx +808 -808
- package/reference/concepts.mdx +146 -146
- package/reference/deployment/api.mdx +297 -297
- package/reference/deployment/command-center.mdx +209 -209
- package/reference/deployment/index.mdx +195 -195
- package/reference/deployment/provided-features.mdx +107 -107
- package/reference/deployment/ui-execution.mdx +250 -250
- package/reference/examples/organization-model.ts +171 -84
- package/reference/framework/agent.mdx +156 -156
- package/reference/framework/index.mdx +195 -195
- package/reference/framework/interaction-guidance.mdx +182 -182
- package/reference/framework/memory.mdx +326 -326
- package/reference/framework/project-structure.mdx +282 -282
- package/reference/framework/tutorial-system.mdx +135 -135
- package/reference/getting-started.mdx +142 -142
- package/reference/index.mdx +106 -106
- package/reference/packages/core/src/README.md +14 -14
- package/reference/packages/core/src/business/README.md +2 -2
- package/reference/packages/core/src/knowledge/README.md +32 -32
- package/reference/packages/core/src/organization-model/README.md +149 -149
- package/reference/packages/core/src/test-utils/README.md +37 -37
- package/reference/packages/ui/src/api/README.md +18 -18
- package/reference/packages/ui/src/app/README.md +24 -24
- package/reference/packages/ui/src/auth/README.md +18 -18
- package/reference/packages/ui/src/components/README.md +24 -24
- package/reference/packages/ui/src/execution/README.md +16 -16
- package/reference/packages/ui/src/features/README.md +28 -28
- package/reference/packages/ui/src/graph/README.md +16 -16
- package/reference/packages/ui/src/hooks/README.md +23 -23
- package/reference/packages/ui/src/initialization/README.md +19 -19
- package/reference/packages/ui/src/knowledge/README.md +31 -31
- package/reference/packages/ui/src/organization/README.md +18 -18
- package/reference/packages/ui/src/profile/README.md +19 -19
- package/reference/packages/ui/src/provider/README.md +32 -32
- package/reference/packages/ui/src/router/README.md +18 -18
- package/reference/packages/ui/src/sse/README.md +13 -13
- package/reference/packages/ui/src/test-utils/README.md +7 -7
- package/reference/packages/ui/src/theme/README.md +23 -23
- package/reference/packages/ui/src/theme/presets/README.md +19 -19
- package/reference/packages/ui/src/types/README.md +16 -16
- package/reference/packages/ui/src/utils/README.md +18 -18
- package/reference/packages/ui/src/zustand/README.md +18 -18
- package/reference/platform-tools/adapters-integration.mdx +301 -301
- package/reference/platform-tools/adapters-platform.mdx +553 -553
- package/reference/platform-tools/index.mdx +217 -217
- package/reference/platform-tools/type-safety.mdx +82 -82
- package/reference/resources/index.mdx +349 -349
- package/reference/resources/patterns.mdx +449 -449
- package/reference/resources/types.mdx +116 -116
- package/reference/roadmap.mdx +165 -165
- package/reference/runtime.mdx +173 -173
- package/reference/scaffold/core/organization-graph.mdx +110 -90
- package/reference/scaffold/core/organization-model.mdx +225 -213
- package/reference/scaffold/index.mdx +67 -67
- package/reference/scaffold/operations/propagation-pipeline.md +77 -77
- package/reference/scaffold/operations/scaffold-maintenance.md +12 -12
- package/reference/scaffold/operations/workflow-recipes.md +138 -138
- package/reference/scaffold/recipes/add-a-feature.md +307 -85
- package/reference/scaffold/recipes/add-a-resource.md +137 -103
- package/reference/scaffold/recipes/customize-knowledge-browser.md +5 -5
- package/reference/scaffold/recipes/customize-organization-model.md +275 -138
- package/reference/scaffold/recipes/extend-a-base-entity.md +8 -8
- package/reference/scaffold/recipes/extend-crm.md +3 -3
- package/reference/scaffold/recipes/extend-lead-gen.md +394 -394
- package/reference/scaffold/recipes/gate-by-feature-or-admin.md +118 -118
- package/reference/scaffold/recipes/index.md +46 -46
- package/reference/scaffold/recipes/query-the-knowledge-graph.md +197 -170
- package/reference/scaffold/reference/contracts.md +2136 -2093
- package/reference/scaffold/reference/glossary.md +76 -76
- package/reference/scaffold/ui/composition-extensibility.mdx +233 -233
- package/reference/scaffold/ui/customization.md +243 -243
- package/reference/scaffold/ui/feature-flags-and-gating.md +46 -46
- package/reference/scaffold/ui/feature-shell.mdx +72 -72
- package/reference/scaffold/ui/recipes.md +221 -214
- package/reference/spine/spine-primer.md +96 -96
- package/reference/templates/index.mdx +47 -47
- package/reference/troubleshooting.mdx +223 -223
|
@@ -1,79 +1,79 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Glossary
|
|
3
|
-
description: Terminology disambiguation for Organization OS concepts used in the template scaffold, core package, and published packages.
|
|
4
|
-
---
|
|
1
|
+
---
|
|
2
|
+
title: Glossary
|
|
3
|
+
description: Terminology disambiguation for Organization OS concepts used in the template scaffold, core package, and published packages.
|
|
4
|
+
---
|
|
5
5
|
<!-- @generated by packages/sdk/scripts/copy-reference-docs.mjs -- DO NOT EDIT -->
|
|
6
6
|
<!-- Regenerate: pnpm scaffold:sync -->
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
# Glossary
|
|
10
|
-
|
|
11
|
-
## Terms
|
|
12
|
-
|
|
13
|
-
**AdminGuard** -- route-level admin wrapper from `@elevasis/ui/features/auth`. Must nest inside `ProtectedRoute`.
|
|
14
|
-
|
|
15
|
-
**Contract** -- the publishable boundary a consumer depends on: Zod schemas, TypeScript types, provider props, resource definitions, or workflow I/O schemas.
|
|
16
|
-
|
|
17
|
-
**DeploymentSpec** -- runtime/deploy assembly for one organization: workflows, agents, triggers, integrations, relationships, external resources, and human checkpoints. It assembles executable behavior around Organization Model resource descriptors; it is not the source of resource identity.
|
|
18
|
-
|
|
19
|
-
**Feature** -- legacy or UI-package wording for a platform capability area. In the current Organization Model, use **System** for semantic ownership and **navigation surface** for shell placement. Keep "feature" only when referring to existing UI package folders, exported manifest names, or legacy compatibility recipes.
|
|
20
|
-
|
|
21
|
-
**SystemGuard** -- route-level System gate from `@elevasis/ui/features/auth`.
|
|
22
|
-
|
|
23
|
-
**SystemModule** -- manifest contract a shell module provides to `ElevasisSystemsProvider`. Key fields are `key`, optional `systemId`, optional `routePrefixes`, optional `capabilityIds`, optional `icon`, optional `sidebar`, optional `sidebarWidth
|
|
24
|
-
|
|
25
|
-
**systemId** -- the `SystemModule` field that points to an `OrganizationModel.systems` entry. Navigation-only app modules may omit it and use route prefixes/surface metadata instead.
|
|
26
|
-
|
|
27
|
-
**Foundations** -- local adapter layer in external projects that exports `canonicalOrganizationModel`, `organizationModel`, and workflow I/O schemas.
|
|
28
|
-
|
|
29
|
-
**Graph node ID** -- kind-prefixed cross-collection identifier such as `system:sales.crm`, `integration:instantly`, or `resource:lead-import`.
|
|
30
|
-
|
|
31
|
-
**Manifest** -- a runtime declaration for a feature or resource collection.
|
|
32
|
-
|
|
33
|
-
**MembershipFeatureConfig** -- legacy per-member feature override config. Current System visibility
|
|
34
|
-
|
|
35
|
-
**OrganizationModel** -- top-level semantic contract for an organization. Current primary fields include `version`, `domainMetadata`, `branding`, `navigation`, `
|
|
36
|
-
|
|
37
|
-
**OrganizationModelSystemEntry** -- System node in `OrganizationModel.systems`.
|
|
38
|
-
|
|
39
|
-
**Provider / ElevasisSystemsProvider** -- runtime that registers System modules, resolves System access against the org model, projects sidebar navigation, and exposes shell helpers through `useElevasisSystems()`.
|
|
40
|
-
|
|
41
|
-
**Resource** -- governance-only descriptor in `OrganizationModel.resources` for a workflow, agent, integration, or script. Runtime code derives `resourceId` and kind from the descriptor, then attaches executable behavior in operations.
|
|
42
|
-
|
|
43
|
-
**Resource descriptor** -- OM entry with canonical `id`, required `systemPath`, governance `status`,
|
|
44
|
-
|
|
45
|
-
**System** -- tenant-defined bounded context in `OrganizationModel.systems
|
|
46
|
-
|
|
47
|
-
**ResourceCategory** -- resource metadata category: `production`, `diagnostic`, `internal`, or `testing`.
|
|
48
|
-
|
|
49
|
-
**ResourceLink** -- graph binding on resource metadata: `{ nodeId, kind }`.
|
|
50
|
-
|
|
51
|
-
**Settings asymmetry** -- Settings is a navigation/app surface whose individual pages are normally governed by admin checks rather than user-facing System toggles.
|
|
52
|
-
|
|
53
|
-
**Shell model** -- provider output used by sidebars and breadcrumbs. Includes `systems`, `childrenOf`, `ancestorsOf`, `parentOf`, `topLevel`, `findByPath`, `requiresAdminFor`, and `devOnlyFor`.
|
|
54
|
-
|
|
55
|
-
**Subshell / Sidebar** -- System- or route-prefix-scoped UI region rendered when the current route matches a module whose manifest supplies a sidebar.
|
|
56
|
-
|
|
57
|
-
**Topology** --
|
|
58
|
-
|
|
59
|
-
## Package Boundary
|
|
60
|
-
|
|
61
|
-
**`@elevasis/core`**
|
|
62
|
-
|
|
63
|
-
- `OrganizationModel`, `OrganizationModelSystemEntry`
|
|
64
|
-
- `SystemEntry`, `ResourceEntry`
|
|
65
|
-
- `resolveOrganizationModel`, `defineOrganizationModel`, `DEFAULT_ORGANIZATION_MODEL`
|
|
66
|
-
- `MembershipFeatureConfig`
|
|
67
|
-
- `DeploymentSpec`, `ResourceLink`, `ResourceCategory`
|
|
68
|
-
|
|
69
|
-
**`@elevasis/ui`**
|
|
70
|
-
|
|
71
|
-
- `SystemModule`
|
|
72
|
-
- `SystemGuard`, `AdminGuard`, `ProtectedRoute`
|
|
73
|
-
- `ElevasisSystemsProvider`, `ElevasisCoreProvider`, `useElevasisSystems`
|
|
74
|
-
|
|
75
|
-
**External project source**
|
|
76
|
-
|
|
77
|
-
- `canonicalOrganizationModel`
|
|
78
|
-
- `organizationModel`
|
|
79
|
-
- workflow I/O schemas
|
|
8
|
+
|
|
9
|
+
# Glossary
|
|
10
|
+
|
|
11
|
+
## Terms
|
|
12
|
+
|
|
13
|
+
**AdminGuard** -- route-level admin wrapper from `@elevasis/ui/features/auth`. Must nest inside `ProtectedRoute`.
|
|
14
|
+
|
|
15
|
+
**Contract** -- the publishable boundary a consumer depends on: Zod schemas, TypeScript types, provider props, resource definitions, or workflow I/O schemas.
|
|
16
|
+
|
|
17
|
+
**DeploymentSpec** -- runtime/deploy assembly for one organization: workflows, agents, triggers, integrations, relationships, external resources, and human checkpoints. It assembles executable behavior around Organization Model resource descriptors; it is not the source of resource identity.
|
|
18
|
+
|
|
19
|
+
**Feature** -- legacy or UI-package wording for a platform capability area. In the current Organization Model, use **System** for semantic ownership and **navigation surface** for shell placement. Keep "feature" only when referring to existing UI package folders, exported manifest names, or legacy compatibility recipes.
|
|
20
|
+
|
|
21
|
+
**SystemGuard** -- route-level System gate from `@elevasis/ui/features/auth`.
|
|
22
|
+
|
|
23
|
+
**SystemModule** -- manifest contract a shell module provides to `ElevasisSystemsProvider`. Key fields are `key`, optional `systemId`, optional `routePrefixes`, optional `capabilityIds`, optional `icon`, optional `sidebar`, and optional `sidebarWidth`. Graph bridge metadata is compatibility-only; new semantic bindings belong in the Organization Model System, ontology, navigation, and Resource descriptors.
|
|
24
|
+
|
|
25
|
+
**systemId** -- the `SystemModule` field that points to an `OrganizationModel.systems` entry. Navigation-only app modules may omit it and use route prefixes/surface metadata instead.
|
|
26
|
+
|
|
27
|
+
**Foundations** -- local adapter layer in external projects that exports `canonicalOrganizationModel`, `organizationModel`, and workflow I/O schemas.
|
|
28
|
+
|
|
29
|
+
**Graph node ID** -- kind-prefixed cross-collection identifier such as `system:sales.crm`, `integration:instantly`, or `resource:lead-import`.
|
|
30
|
+
|
|
31
|
+
**Manifest** -- a runtime declaration for a feature or resource collection.
|
|
32
|
+
|
|
33
|
+
**MembershipFeatureConfig** -- legacy per-member feature override config. Current System visibility should be authored through Organization Model System lifecycle/access metadata and resolved through provider compatibility layers for older consumers.
|
|
34
|
+
|
|
35
|
+
**OrganizationModel** -- top-level semantic contract for an organization. Current primary fields include `version`, `domainMetadata`, `branding`, `navigation`, `ontology`, `systems`, `resources`, `topology`, `identity`, `customers`, `offerings`, `roles`, `goals`, `policies`, `statuses`, and `knowledge`. Legacy domain keys such as `sales`, `prospecting`, `projects`, `actions`, and `entities` remain compatibility inputs while projects migrate to System-owned ontology/config/resource contracts.
|
|
36
|
+
|
|
37
|
+
**OrganizationModelSystemEntry** -- System node in `OrganizationModel.systems`. Primary authoring fields include `id`, `label`, `description`, `parentSystemId`, `systems`, `lifecycle`, `ui`, `requiresAdmin`, `devOnly`, `responsibleRoleId`, `governedByKnowledge`, `drivesGoals`, `actions`, `policies`, `ontology`, `config`, and `order`. `subsystems` and `content` are retained compatibility inputs for older projects and should not be used for new recursive Systems, schemas, catalogs, or config.
|
|
38
|
+
|
|
39
|
+
**Provider / ElevasisSystemsProvider** -- runtime that registers System modules, resolves System access against the org model, projects sidebar navigation, and exposes shell helpers through `useElevasisSystems()`.
|
|
40
|
+
|
|
41
|
+
**Resource** -- governance-only descriptor in `OrganizationModel.resources` for a workflow, agent, integration, or script. Runtime code derives `resourceId` and kind from the descriptor, then attaches executable behavior in operations.
|
|
42
|
+
|
|
43
|
+
**Resource descriptor** -- OM entry with canonical `id`, required `systemPath`, descriptor `title` / `description`, governance `status`, optional role ownership, `codeRefs`, and nested `ontology` bindings for `actions`, optional `primaryAction`, read/write objects, used catalogs, and emitted events. Top-level `emits` remains a compatibility mirror for older descriptors.
|
|
44
|
+
|
|
45
|
+
**System** -- tenant-defined bounded context in `OrganizationModel.systems` that groups operational resources and carries governance metadata such as responsible role, governing knowledge, driven goals, kind, lifecycle, System-local ontology, and System-local config.
|
|
46
|
+
|
|
47
|
+
**ResourceCategory** -- resource metadata category: `production`, `diagnostic`, `internal`, or `testing`.
|
|
48
|
+
|
|
49
|
+
**ResourceLink** -- graph binding on resource metadata: `{ nodeId, kind }`.
|
|
50
|
+
|
|
51
|
+
**Settings asymmetry** -- Settings is a navigation/app surface whose individual pages are normally governed by admin checks rather than user-facing System toggles.
|
|
52
|
+
|
|
53
|
+
**Shell model** -- provider output used by sidebars and breadcrumbs. Includes `systems`, `childrenOf`, `ancestorsOf`, `parentOf`, `topLevel`, `findByPath`, `requiresAdminFor`, and `devOnlyFor`.
|
|
54
|
+
|
|
55
|
+
**Subshell / Sidebar** -- System- or route-prefix-scoped UI region rendered when the current route matches a module whose manifest supplies a sidebar.
|
|
56
|
+
|
|
57
|
+
**Topology** -- durable OM operational wiring declared in `OrganizationModel.topology.relationships`. Initial relationship kinds are `triggers`, `uses`, and `approval`; relationships use typed refs such as `{ kind: 'resource', id: 'lead-import' }`.
|
|
58
|
+
|
|
59
|
+
## Package Boundary
|
|
60
|
+
|
|
61
|
+
**`@elevasis/core`**
|
|
62
|
+
|
|
63
|
+
- `OrganizationModel`, `OrganizationModelSystemEntry`
|
|
64
|
+
- `SystemEntry`, `ResourceEntry`
|
|
65
|
+
- `resolveOrganizationModel`, `defineOrganizationModel`, `DEFAULT_ORGANIZATION_MODEL`
|
|
66
|
+
- `MembershipFeatureConfig`
|
|
67
|
+
- `DeploymentSpec`, `ResourceLink`, `ResourceCategory`
|
|
68
|
+
|
|
69
|
+
**`@elevasis/ui`**
|
|
70
|
+
|
|
71
|
+
- `SystemModule`
|
|
72
|
+
- `SystemGuard`, `AdminGuard`, `ProtectedRoute`
|
|
73
|
+
- `ElevasisSystemsProvider`, `ElevasisCoreProvider`, `useElevasisSystems`
|
|
74
|
+
|
|
75
|
+
**External project source**
|
|
76
|
+
|
|
77
|
+
- `canonicalOrganizationModel`
|
|
78
|
+
- `organizationModel`
|
|
79
|
+
- workflow I/O schemas
|
|
@@ -1,236 +1,236 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Composition & Extensibility
|
|
3
|
-
description: Organization OS Toolkit layer guidance for customizing shared shell systems without forking, including exported nav arrays, optional sidebar props, composable layout primitives, and the manifest.sidebar override pattern.
|
|
4
|
-
---
|
|
1
|
+
---
|
|
2
|
+
title: Composition & Extensibility
|
|
3
|
+
description: Organization OS Toolkit layer guidance for customizing shared shell systems without forking, including exported nav arrays, optional sidebar props, composable layout primitives, and the manifest.sidebar override pattern.
|
|
4
|
+
---
|
|
5
5
|
<!-- @generated by packages/sdk/scripts/copy-reference-docs.mjs -- DO NOT EDIT -->
|
|
6
6
|
<!-- Regenerate: pnpm scaffold:sync -->
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
## Overview
|
|
10
|
-
|
|
11
|
-
Within Organization OS, this doc covers the **Toolkit** layer: the primitives consumers use to customize shared shell systems by composition instead of fork. Consumers extend nav items, inject panels, or wrap pages by combining published primitives and assigning a custom component to `manifest.sidebar`. Copying source is physically possible but unsupported -- a fork owns upstream drift forever.
|
|
12
|
-
|
|
13
|
-
The core pattern: set `sidebar` on your manifest to a component that composes the system's published pieces. If the published pieces can't express what you need, the missing export is a bug. File an issue instead of forking.
|
|
14
|
-
|
|
15
|
-
Shipped in `@elevasis/ui >= 2.8.1`.
|
|
16
|
-
|
|
17
|
-
## The Override Pattern
|
|
18
|
-
|
|
19
|
-
Every `SystemModule.sidebar` is a `ComponentType`. Consumers customize by:
|
|
20
|
-
|
|
21
|
-
1. Importing the system's published sidebar wrapper and middle component.
|
|
22
|
-
2. Wrapping or replacing the middle with custom content.
|
|
23
|
-
3. Spreading the stock manifest and setting `sidebar` to their component.
|
|
24
|
-
4. Passing the customized manifest to `ElevasisSystemsProvider`.
|
|
25
|
-
|
|
26
|
-
No new manifest fields. No discriminated unions. No runtime machinery.
|
|
27
|
-
|
|
28
|
-
## Decision Tree
|
|
29
|
-
|
|
30
|
-
- **Adding or changing nav items?** -> Extend the exported item array and pass to `<*SidebarMiddle items={...}>`.
|
|
31
|
-
- **Structural changes (injecting panels, wrapping sections)?** -> Compose `SidebarTop`, `SidebarMiddle`, and exported panels directly in your own component.
|
|
32
|
-
- **Wrapping pages?** -> Import the system's page component and wrap with custom chrome in a route file.
|
|
33
|
-
- **None of these fits?** -> Missing export is the bug. File an issue.
|
|
34
|
-
|
|
35
|
-
## Exported Primitives
|
|
36
|
-
|
|
37
|
-
### Nav item arrays
|
|
38
|
-
|
|
39
|
-
Re-exported from each system sidebar barrel:
|
|
40
|
-
|
|
41
|
-
- `CRM_ITEMS` from `@elevasis/ui/features/crm`
|
|
42
|
-
- `LEAD_GEN_ITEMS` from `@elevasis/ui/features/lead-gen`
|
|
43
|
-
- `DELIVERY_PROJECT_ITEMS`, `DELIVERY_WORK_ITEMS`, `DELIVERY_COMMUNICATION_ITEMS` from `@elevasis/ui/features/delivery`
|
|
44
|
-
|
|
45
|
-
Shape is the shared `NavItem` type exported from `@elevasis/ui/layout`.
|
|
46
|
-
|
|
47
|
-
### Sidebar wrappers
|
|
48
|
-
|
|
49
|
-
Thin Top+Middle composers. Each accepts optional `children?: ReactNode` that replaces the default middle:
|
|
50
|
-
|
|
51
|
-
- `CrmSidebar`, `LeadGenSidebar`, `ProjectsSidebar`
|
|
52
|
-
|
|
53
|
-
### Middle components with optional item props
|
|
54
|
-
|
|
55
|
-
- `CrmSidebarMiddle` -- `items?: NavItem[]` (defaults to `CRM_ITEMS`)
|
|
56
|
-
- `LeadGenSidebarMiddle` -- `items?: NavItem[]` (defaults to `LEAD_GEN_ITEMS`)
|
|
57
|
-
- `ProjectsSidebarMiddle` -- `projectItems?`, `workItems?`, `communicationItems?` (each defaults to its respective exported array)
|
|
58
|
-
|
|
59
|
-
Delivery's three sections are preserved intentionally -- a real UX pattern consumers may want to extend with additional sections.
|
|
60
|
-
|
|
61
|
-
### Composable layout primitives
|
|
62
|
-
|
|
63
|
-
From `@elevasis/ui/layout`:
|
|
64
|
-
|
|
65
|
-
- `SubshellNavItem` -- individual nav link
|
|
66
|
-
- `SubshellNavList` -- router-context-aware list renderer (accepts `items: NavItem[]`, derives active state via `useRouterContext()`)
|
|
67
|
-
- `SubshellSidebarSection` -- section header with icon, label, optional top border
|
|
68
|
-
- `NavItem` -- shared item shape type
|
|
69
|
-
- `SubshellContainer` -- full-width, full-height flex wrapper that composes sidebar and content side by side
|
|
70
|
-
- `SubshellRightSideContainer` -- content area column (`flex: 1`, `minWidth: 0`) that prevents sidebar from squeezing content
|
|
71
|
-
- `SubshellContentContainer` -- scrollable content area with standard `md` padding and automatic topbar offset applied via `paddingTop`
|
|
72
|
-
- `SubshellLoader` -- loading placeholder centered in the subshell viewport; reads the active loader from `AppearanceContext`
|
|
73
|
-
|
|
74
|
-
`SystemShell` wires these together at `width={250}` as the default sidebar width. Consumers composing their own shell layout can pass a different `width` prop to `SubshellSidebar`.
|
|
75
|
-
|
|
76
|
-
### SubshellSidebar behavior
|
|
77
|
-
|
|
78
|
-
`SubshellSidebar` is more than a thin wrapper. Key behaviors verified in source:
|
|
79
|
-
|
|
80
|
-
- **Collapsible** -- controlled by `collapsible` prop (defaults to `true`) and `defaultOpen` prop (defaults to `true`). When collapsed, the sidebar animates to zero width and a small toggle button remains visible at the bottom-right edge.
|
|
81
|
-
- **Glass morphism** -- applies `color-mix(in srgb, var(--glass-background) 80%, transparent)` as background and `var(--glass-blur)` as `backdropFilter`, consistent with the theme token system.
|
|
82
|
-
- **Animated transitions** -- width and opacity animate on collapse/expand using `sidebarTransitionDuration` from the layout constants.
|
|
83
|
-
- **Width** -- no built-in default; the caller supplies `width`. `SystemShell` passes `250` and this is the canonical default for stock system sidebars.
|
|
84
|
-
|
|
85
|
-
From `@elevasis/ui/router/context`:
|
|
86
|
-
|
|
87
|
-
- `useRouterContext` -- access route state for custom active-state logic
|
|
88
|
-
|
|
89
|
-
### RouterAdapter interface
|
|
90
|
-
|
|
91
|
-
`RouterAdapter` is the interface that bridges any router implementation to the shared layout primitives. Defined in `packages/ui/src/router/context.ts`:
|
|
92
|
-
|
|
93
|
-
- `currentPath: string` -- current pathname, used by `SubshellNavList` to derive active state
|
|
94
|
-
- `currentSearch?: string` -- current search string (optional)
|
|
95
|
-
- `navigate: (to: string) => void` -- imperative navigation
|
|
96
|
-
- `Link: ElementType<LinkProps>` -- router-aware anchor component; `LinkProps` extends `AnchorHTMLAttributes\<HTMLAnchorElement>` with a required `to: string` field
|
|
97
|
-
|
|
98
|
-
Consumers calling `useRouterContext()` get back a `RouterAdapter`. Any component that needs to read `currentPath` or call `navigate` can use the hook directly rather than prop-drilling from a parent.
|
|
99
|
-
|
|
100
|
-
### TanStackRouterBridge
|
|
101
|
-
|
|
102
|
-
`TanStackRouterBridge` is the concrete `RouterAdapter` implementation for TanStack Router. Exported from `packages/ui/src/router/providers/TanStackRouterBridge.tsx` and available via `@elevasis/ui/router`.
|
|
103
|
-
|
|
104
|
-
It wraps `RouterProvider` and supplies the adapter by reading `useLocation` and `useRouter` from `@tanstack/react-router`. The adapter value is stabilized with `useMemo` to prevent unnecessary re-renders in downstream consumers. Place it inside TanStack's `RouterProvider`:
|
|
105
|
-
|
|
106
|
-
```tsx
|
|
107
|
-
<TanStackRouterBridge>
|
|
108
|
-
<ElevasisSystemsProvider ...>
|
|
109
|
-
<SystemShell>...</SystemShell>
|
|
110
|
-
</ElevasisSystemsProvider>
|
|
111
|
-
</TanStackRouterBridge>
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
Consumers using a different router can implement `RouterAdapter` directly and pass it to `RouterProvider` instead of using this bridge.
|
|
115
|
-
|
|
116
|
-
### System panels (CRM)
|
|
117
|
-
|
|
118
|
-
- `MyTasksPanel`, `QuickCreateActions` -- exported from `@elevasis/ui/features/crm`, included by default in `CrmSidebarMiddle`; consumers composing their own middle can re-include them explicitly.
|
|
119
|
-
|
|
120
|
-
### System pages
|
|
121
|
-
|
|
122
|
-
Every page each system renders is exported from its system barrel, so consumers can wrap with custom chrome without forking:
|
|
123
|
-
|
|
124
|
-
- CRM: `DealsListPage`, `DealDetailPage`
|
|
125
|
-
- Lead-gen: `LeadGenOverviewPage`, `LeadGenListsPage`, `LeadGenListDetailPage`, `LeadGenCompaniesPage`, `LeadGenContactsPage`
|
|
126
|
-
- Delivery: `AllTasksPage`, `UpcomingMilestonesPage`, `ProjectsListPage`, `ProjectDetailPage`
|
|
127
|
-
- Operations, monitoring, settings -- full page inventories exported from their system barrels
|
|
128
|
-
|
|
129
|
-
## Consumer Patterns
|
|
130
|
-
|
|
131
|
-
### 1. Extend nav items (shortest path)
|
|
132
|
-
|
|
133
|
-
```tsx
|
|
134
|
-
import { CrmSidebar, CrmSidebarMiddle, CRM_ITEMS } from '@elevasis/ui/features/crm'
|
|
135
|
-
import { IconFileText } from '@tabler/icons-react'
|
|
136
|
-
|
|
137
|
-
const customItems = [
|
|
138
|
-
...CRM_ITEMS,
|
|
139
|
-
{ label: 'Reports', to: '/crm/reports', icon: IconFileText, exact: false },
|
|
140
|
-
]
|
|
141
|
-
|
|
142
|
-
const MyCrmSidebar = () => (
|
|
143
|
-
<CrmSidebar>
|
|
144
|
-
<CrmSidebarMiddle items={customItems} />
|
|
145
|
-
</CrmSidebar>
|
|
146
|
-
)
|
|
147
|
-
|
|
148
|
-
const customCrmManifest = { ...crmManifest, sidebar: MyCrmSidebar }
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
### 2. Inject a new delivery section (compose from primitives)
|
|
152
|
-
|
|
153
|
-
```tsx
|
|
154
|
-
import {
|
|
155
|
-
ProjectsSidebar,
|
|
156
|
-
DELIVERY_PROJECT_ITEMS,
|
|
157
|
-
DELIVERY_WORK_ITEMS,
|
|
158
|
-
DELIVERY_COMMUNICATION_ITEMS,
|
|
159
|
-
} from '@elevasis/ui/features/delivery'
|
|
160
|
-
import { SubshellSidebarSection, SubshellNavList } from '@elevasis/ui/layout'
|
|
161
|
-
import { Stack } from '@mantine/core'
|
|
162
|
-
import { IconChartBar, IconListCheck, IconMessageCircle } from '@tabler/icons-react'
|
|
163
|
-
|
|
164
|
-
const ANALYTICS_ITEMS = [
|
|
165
|
-
{ label: 'Dashboard', to: '/projects/analytics', icon: IconChartBar, exact: true },
|
|
166
|
-
]
|
|
167
|
-
|
|
168
|
-
const MyDeliveryMiddle = () => (
|
|
169
|
-
<Stack gap={0} style={{ flex: 1, overflowY: 'auto' }}>
|
|
170
|
-
<Stack gap={0} p="sm"><SubshellNavList items={DELIVERY_PROJECT_ITEMS} /></Stack>
|
|
171
|
-
<SubshellSidebarSection icon={IconListCheck} label="Work" withTopBorder />
|
|
172
|
-
<Stack gap={0} p="sm"><SubshellNavList items={DELIVERY_WORK_ITEMS} /></Stack>
|
|
173
|
-
<SubshellSidebarSection icon={IconMessageCircle} label="Communication" withTopBorder />
|
|
174
|
-
<Stack gap={0} p="sm"><SubshellNavList items={DELIVERY_COMMUNICATION_ITEMS} /></Stack>
|
|
175
|
-
<SubshellSidebarSection icon={IconChartBar} label="Analytics" withTopBorder />
|
|
176
|
-
<Stack gap={0} p="sm"><SubshellNavList items={ANALYTICS_ITEMS} /></Stack>
|
|
177
|
-
</Stack>
|
|
178
|
-
)
|
|
179
|
-
|
|
180
|
-
const MyDeliverySidebar = () => (
|
|
181
|
-
<ProjectsSidebar>
|
|
182
|
-
<MyDeliveryMiddle />
|
|
183
|
-
</ProjectsSidebar>
|
|
184
|
-
)
|
|
185
|
-
```
|
|
186
|
-
|
|
187
|
-
### 3. Wrap a page with custom chrome
|
|
188
|
-
|
|
189
|
-
```tsx
|
|
190
|
-
// in a route file
|
|
191
|
-
import { DealsListPage } from '@elevasis/ui/features/crm'
|
|
192
|
-
|
|
193
|
-
export default function CustomDealsRoute() {
|
|
194
|
-
return (
|
|
195
|
-
<MyChromeWrapper>
|
|
196
|
-
<DealsListPage />
|
|
197
|
-
</MyChromeWrapper>
|
|
198
|
-
)
|
|
199
|
-
}
|
|
200
|
-
```
|
|
201
|
-
|
|
202
|
-
## Operations & Unmodified Systems
|
|
203
|
-
|
|
204
|
-
- **Operations** -- uses `sidebar?: ComponentType` with route-aware dispatch; the items-prop pattern does not apply.
|
|
205
|
-
- **Monitoring, Settings** -- no subshell sidebar. No customization surface needed.
|
|
206
|
-
- **SEO** -- has sidebar components (`SEOSidebar`, `SEOSidebarTop`, `SEOSidebarMiddle`) but no page inventory in `@elevasis/ui`.
|
|
207
|
-
|
|
208
|
-
## Publish-Surface Discipline
|
|
209
|
-
|
|
210
|
-
All primitives above flow through published subpaths (`@elevasis/ui/features/<system>`, `@elevasis/ui/layout`, `@elevasis/ui/router/context`). Any new primitive must sync four files per `.claude/rules/ui-package.md`: `package.json` `exports`, `publishConfig.exports`, `rollup.dts.config.mjs`, and `tsup.config.ts`.
|
|
211
|
-
|
|
212
|
-
The published barrel (`packages/ui/src/provider/published.ts`) remains headless -- no Mantine-dependent visual pieces leak into the external contract.
|
|
213
|
-
|
|
214
|
-
## Knowledge Browser Customization
|
|
215
|
-
|
|
216
|
-
The Knowledge Browser follows the same pattern described in this document. The three tiers map directly:
|
|
217
|
-
|
|
218
|
-
- **Tier 1** -- import `knowledgeManifest` from `@elevasis/ui/features/knowledge` and pass it to `ElevasisSystemsProvider`. No further code required.
|
|
219
|
-
- **Tier 2** -- spread the manifest, override `sidebar` to a component that composes `KnowledgeSidebar` + `KnowledgeSidebarMiddle items={customItems}`. Same shape as the CRM example above.
|
|
220
|
-
- **Tier 3** -- skip the manifest, own the route, call `bySystem` / `byKind` / `byOwner` from `@elevasis/core/knowledge` directly.
|
|
221
|
-
|
|
222
|
-
One additional wiring step is required for Knowledge Browser that does not apply to CRM or Lead Gen: add `knowledgePlugin()` from `@elevasis/ui/vite-plugin-knowledge` to `vite.config.ts`. The plugin runs build-time MDX codegen so rendered body components are available at runtime.
|
|
223
|
-
|
|
224
|
-
See [recipes/customize-knowledge-browser.md](../recipes/customize-knowledge-browser.md) for the full walkthrough including code examples, the CSS import requirement, and the full exports reference.
|
|
225
|
-
|
|
226
|
-
Phase 1.5 adds two further extension surfaces documented in the same recipe file under the "Phase 1.5" section:
|
|
227
|
-
|
|
228
|
-
- **Extending the SegmentedControl** -- supply a `segments` prop to `KnowledgeSidebarMiddle` to add custom mount-axis tabs beyond the default five (By Feature, By Kind, By Owner, Governs, Governed By).
|
|
229
|
-
- **Replacing `DescribeNodeView`** -- override the `/knowledge/:nodeId` route component to swap the entire main-pane dispatcher, or use `createDescribeNodeDispatcher` from `@elevasis/ui/knowledge` to override only specific node-kind views while keeping the platform defaults for the rest.
|
|
230
|
-
|
|
231
|
-
## What Not to Do
|
|
232
|
-
|
|
233
|
-
- **Don't fork sidebar files into your app tree.** You own upstream drift forever.
|
|
234
|
-
- **Don't redefine `NavItem` locally.** Import it from `@elevasis/ui/layout` so future shape changes stay coherent.
|
|
235
|
-
- **Don't monkey-patch `SYSTEM_MANIFESTS`.** It's a published convenience constant; consumers build their own manifest array and pass it to the provider.
|
|
236
|
-
- **Don't add discriminated-union sidebar configuration to manifests.** The single pattern (assign a component to `manifest.sidebar`) is intentional.
|
|
8
|
+
|
|
9
|
+
## Overview
|
|
10
|
+
|
|
11
|
+
Within Organization OS, this doc covers the **Toolkit** layer: the primitives consumers use to customize shared shell systems by composition instead of fork. Consumers extend nav items, inject panels, or wrap pages by combining published primitives and assigning a custom component to `manifest.sidebar`. Copying source is physically possible but unsupported -- a fork owns upstream drift forever.
|
|
12
|
+
|
|
13
|
+
The core pattern: set `sidebar` on your manifest to a component that composes the system's published pieces. If the published pieces can't express what you need, the missing export is a bug. File an issue instead of forking.
|
|
14
|
+
|
|
15
|
+
Shipped in `@elevasis/ui >= 2.8.1`.
|
|
16
|
+
|
|
17
|
+
## The Override Pattern
|
|
18
|
+
|
|
19
|
+
Every `SystemModule.sidebar` is a `ComponentType`. Consumers customize by:
|
|
20
|
+
|
|
21
|
+
1. Importing the system's published sidebar wrapper and middle component.
|
|
22
|
+
2. Wrapping or replacing the middle with custom content.
|
|
23
|
+
3. Spreading the stock manifest and setting `sidebar` to their component.
|
|
24
|
+
4. Passing the customized manifest to `ElevasisSystemsProvider`.
|
|
25
|
+
|
|
26
|
+
No new manifest fields. No discriminated unions. No runtime machinery.
|
|
27
|
+
|
|
28
|
+
## Decision Tree
|
|
29
|
+
|
|
30
|
+
- **Adding or changing nav items?** -> Extend the exported item array and pass to `<*SidebarMiddle items={...}>`.
|
|
31
|
+
- **Structural changes (injecting panels, wrapping sections)?** -> Compose `SidebarTop`, `SidebarMiddle`, and exported panels directly in your own component.
|
|
32
|
+
- **Wrapping pages?** -> Import the system's page component and wrap with custom chrome in a route file.
|
|
33
|
+
- **None of these fits?** -> Missing export is the bug. File an issue.
|
|
34
|
+
|
|
35
|
+
## Exported Primitives
|
|
36
|
+
|
|
37
|
+
### Nav item arrays
|
|
38
|
+
|
|
39
|
+
Re-exported from each system sidebar barrel:
|
|
40
|
+
|
|
41
|
+
- `CRM_ITEMS` from `@elevasis/ui/features/crm`
|
|
42
|
+
- `LEAD_GEN_ITEMS` from `@elevasis/ui/features/lead-gen`
|
|
43
|
+
- `DELIVERY_PROJECT_ITEMS`, `DELIVERY_WORK_ITEMS`, `DELIVERY_COMMUNICATION_ITEMS` from `@elevasis/ui/features/delivery`
|
|
44
|
+
|
|
45
|
+
Shape is the shared `NavItem` type exported from `@elevasis/ui/layout`.
|
|
46
|
+
|
|
47
|
+
### Sidebar wrappers
|
|
48
|
+
|
|
49
|
+
Thin Top+Middle composers. Each accepts optional `children?: ReactNode` that replaces the default middle:
|
|
50
|
+
|
|
51
|
+
- `CrmSidebar`, `LeadGenSidebar`, `ProjectsSidebar`
|
|
52
|
+
|
|
53
|
+
### Middle components with optional item props
|
|
54
|
+
|
|
55
|
+
- `CrmSidebarMiddle` -- `items?: NavItem[]` (defaults to `CRM_ITEMS`)
|
|
56
|
+
- `LeadGenSidebarMiddle` -- `items?: NavItem[]` (defaults to `LEAD_GEN_ITEMS`)
|
|
57
|
+
- `ProjectsSidebarMiddle` -- `projectItems?`, `workItems?`, `communicationItems?` (each defaults to its respective exported array)
|
|
58
|
+
|
|
59
|
+
Delivery's three sections are preserved intentionally -- a real UX pattern consumers may want to extend with additional sections.
|
|
60
|
+
|
|
61
|
+
### Composable layout primitives
|
|
62
|
+
|
|
63
|
+
From `@elevasis/ui/layout`:
|
|
64
|
+
|
|
65
|
+
- `SubshellNavItem` -- individual nav link
|
|
66
|
+
- `SubshellNavList` -- router-context-aware list renderer (accepts `items: NavItem[]`, derives active state via `useRouterContext()`)
|
|
67
|
+
- `SubshellSidebarSection` -- section header with icon, label, optional top border
|
|
68
|
+
- `NavItem` -- shared item shape type
|
|
69
|
+
- `SubshellContainer` -- full-width, full-height flex wrapper that composes sidebar and content side by side
|
|
70
|
+
- `SubshellRightSideContainer` -- content area column (`flex: 1`, `minWidth: 0`) that prevents sidebar from squeezing content
|
|
71
|
+
- `SubshellContentContainer` -- scrollable content area with standard `md` padding and automatic topbar offset applied via `paddingTop`
|
|
72
|
+
- `SubshellLoader` -- loading placeholder centered in the subshell viewport; reads the active loader from `AppearanceContext`
|
|
73
|
+
|
|
74
|
+
`SystemShell` wires these together at `width={250}` as the default sidebar width. Consumers composing their own shell layout can pass a different `width` prop to `SubshellSidebar`.
|
|
75
|
+
|
|
76
|
+
### SubshellSidebar behavior
|
|
77
|
+
|
|
78
|
+
`SubshellSidebar` is more than a thin wrapper. Key behaviors verified in source:
|
|
79
|
+
|
|
80
|
+
- **Collapsible** -- controlled by `collapsible` prop (defaults to `true`) and `defaultOpen` prop (defaults to `true`). When collapsed, the sidebar animates to zero width and a small toggle button remains visible at the bottom-right edge.
|
|
81
|
+
- **Glass morphism** -- applies `color-mix(in srgb, var(--glass-background) 80%, transparent)` as background and `var(--glass-blur)` as `backdropFilter`, consistent with the theme token system.
|
|
82
|
+
- **Animated transitions** -- width and opacity animate on collapse/expand using `sidebarTransitionDuration` from the layout constants.
|
|
83
|
+
- **Width** -- no built-in default; the caller supplies `width`. `SystemShell` passes `250` and this is the canonical default for stock system sidebars.
|
|
84
|
+
|
|
85
|
+
From `@elevasis/ui/router/context`:
|
|
86
|
+
|
|
87
|
+
- `useRouterContext` -- access route state for custom active-state logic
|
|
88
|
+
|
|
89
|
+
### RouterAdapter interface
|
|
90
|
+
|
|
91
|
+
`RouterAdapter` is the interface that bridges any router implementation to the shared layout primitives. Defined in `packages/ui/src/router/context.ts`:
|
|
92
|
+
|
|
93
|
+
- `currentPath: string` -- current pathname, used by `SubshellNavList` to derive active state
|
|
94
|
+
- `currentSearch?: string` -- current search string (optional)
|
|
95
|
+
- `navigate: (to: string) => void` -- imperative navigation
|
|
96
|
+
- `Link: ElementType<LinkProps>` -- router-aware anchor component; `LinkProps` extends `AnchorHTMLAttributes\<HTMLAnchorElement>` with a required `to: string` field
|
|
97
|
+
|
|
98
|
+
Consumers calling `useRouterContext()` get back a `RouterAdapter`. Any component that needs to read `currentPath` or call `navigate` can use the hook directly rather than prop-drilling from a parent.
|
|
99
|
+
|
|
100
|
+
### TanStackRouterBridge
|
|
101
|
+
|
|
102
|
+
`TanStackRouterBridge` is the concrete `RouterAdapter` implementation for TanStack Router. Exported from `packages/ui/src/router/providers/TanStackRouterBridge.tsx` and available via `@elevasis/ui/router`.
|
|
103
|
+
|
|
104
|
+
It wraps `RouterProvider` and supplies the adapter by reading `useLocation` and `useRouter` from `@tanstack/react-router`. The adapter value is stabilized with `useMemo` to prevent unnecessary re-renders in downstream consumers. Place it inside TanStack's `RouterProvider`:
|
|
105
|
+
|
|
106
|
+
```tsx
|
|
107
|
+
<TanStackRouterBridge>
|
|
108
|
+
<ElevasisSystemsProvider ...>
|
|
109
|
+
<SystemShell>...</SystemShell>
|
|
110
|
+
</ElevasisSystemsProvider>
|
|
111
|
+
</TanStackRouterBridge>
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Consumers using a different router can implement `RouterAdapter` directly and pass it to `RouterProvider` instead of using this bridge.
|
|
115
|
+
|
|
116
|
+
### System panels (CRM)
|
|
117
|
+
|
|
118
|
+
- `MyTasksPanel`, `QuickCreateActions` -- exported from `@elevasis/ui/features/crm`, included by default in `CrmSidebarMiddle`; consumers composing their own middle can re-include them explicitly.
|
|
119
|
+
|
|
120
|
+
### System pages
|
|
121
|
+
|
|
122
|
+
Every page each system renders is exported from its system barrel, so consumers can wrap with custom chrome without forking:
|
|
123
|
+
|
|
124
|
+
- CRM: `DealsListPage`, `DealDetailPage`
|
|
125
|
+
- Lead-gen: `LeadGenOverviewPage`, `LeadGenListsPage`, `LeadGenListDetailPage`, `LeadGenCompaniesPage`, `LeadGenContactsPage`
|
|
126
|
+
- Delivery: `AllTasksPage`, `UpcomingMilestonesPage`, `ProjectsListPage`, `ProjectDetailPage`
|
|
127
|
+
- Operations, monitoring, settings -- full page inventories exported from their system barrels
|
|
128
|
+
|
|
129
|
+
## Consumer Patterns
|
|
130
|
+
|
|
131
|
+
### 1. Extend nav items (shortest path)
|
|
132
|
+
|
|
133
|
+
```tsx
|
|
134
|
+
import { CrmSidebar, CrmSidebarMiddle, CRM_ITEMS } from '@elevasis/ui/features/crm'
|
|
135
|
+
import { IconFileText } from '@tabler/icons-react'
|
|
136
|
+
|
|
137
|
+
const customItems = [
|
|
138
|
+
...CRM_ITEMS,
|
|
139
|
+
{ label: 'Reports', to: '/crm/reports', icon: IconFileText, exact: false },
|
|
140
|
+
]
|
|
141
|
+
|
|
142
|
+
const MyCrmSidebar = () => (
|
|
143
|
+
<CrmSidebar>
|
|
144
|
+
<CrmSidebarMiddle items={customItems} />
|
|
145
|
+
</CrmSidebar>
|
|
146
|
+
)
|
|
147
|
+
|
|
148
|
+
const customCrmManifest = { ...crmManifest, sidebar: MyCrmSidebar }
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### 2. Inject a new delivery section (compose from primitives)
|
|
152
|
+
|
|
153
|
+
```tsx
|
|
154
|
+
import {
|
|
155
|
+
ProjectsSidebar,
|
|
156
|
+
DELIVERY_PROJECT_ITEMS,
|
|
157
|
+
DELIVERY_WORK_ITEMS,
|
|
158
|
+
DELIVERY_COMMUNICATION_ITEMS,
|
|
159
|
+
} from '@elevasis/ui/features/delivery'
|
|
160
|
+
import { SubshellSidebarSection, SubshellNavList } from '@elevasis/ui/layout'
|
|
161
|
+
import { Stack } from '@mantine/core'
|
|
162
|
+
import { IconChartBar, IconListCheck, IconMessageCircle } from '@tabler/icons-react'
|
|
163
|
+
|
|
164
|
+
const ANALYTICS_ITEMS = [
|
|
165
|
+
{ label: 'Dashboard', to: '/projects/analytics', icon: IconChartBar, exact: true },
|
|
166
|
+
]
|
|
167
|
+
|
|
168
|
+
const MyDeliveryMiddle = () => (
|
|
169
|
+
<Stack gap={0} style={{ flex: 1, overflowY: 'auto' }}>
|
|
170
|
+
<Stack gap={0} p="sm"><SubshellNavList items={DELIVERY_PROJECT_ITEMS} /></Stack>
|
|
171
|
+
<SubshellSidebarSection icon={IconListCheck} label="Work" withTopBorder />
|
|
172
|
+
<Stack gap={0} p="sm"><SubshellNavList items={DELIVERY_WORK_ITEMS} /></Stack>
|
|
173
|
+
<SubshellSidebarSection icon={IconMessageCircle} label="Communication" withTopBorder />
|
|
174
|
+
<Stack gap={0} p="sm"><SubshellNavList items={DELIVERY_COMMUNICATION_ITEMS} /></Stack>
|
|
175
|
+
<SubshellSidebarSection icon={IconChartBar} label="Analytics" withTopBorder />
|
|
176
|
+
<Stack gap={0} p="sm"><SubshellNavList items={ANALYTICS_ITEMS} /></Stack>
|
|
177
|
+
</Stack>
|
|
178
|
+
)
|
|
179
|
+
|
|
180
|
+
const MyDeliverySidebar = () => (
|
|
181
|
+
<ProjectsSidebar>
|
|
182
|
+
<MyDeliveryMiddle />
|
|
183
|
+
</ProjectsSidebar>
|
|
184
|
+
)
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### 3. Wrap a page with custom chrome
|
|
188
|
+
|
|
189
|
+
```tsx
|
|
190
|
+
// in a route file
|
|
191
|
+
import { DealsListPage } from '@elevasis/ui/features/crm'
|
|
192
|
+
|
|
193
|
+
export default function CustomDealsRoute() {
|
|
194
|
+
return (
|
|
195
|
+
<MyChromeWrapper>
|
|
196
|
+
<DealsListPage />
|
|
197
|
+
</MyChromeWrapper>
|
|
198
|
+
)
|
|
199
|
+
}
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
## Operations & Unmodified Systems
|
|
203
|
+
|
|
204
|
+
- **Operations** -- uses `sidebar?: ComponentType` with route-aware dispatch; the items-prop pattern does not apply.
|
|
205
|
+
- **Monitoring, Settings** -- no subshell sidebar. No customization surface needed.
|
|
206
|
+
- **SEO** -- has sidebar components (`SEOSidebar`, `SEOSidebarTop`, `SEOSidebarMiddle`) but no page inventory in `@elevasis/ui`.
|
|
207
|
+
|
|
208
|
+
## Publish-Surface Discipline
|
|
209
|
+
|
|
210
|
+
All primitives above flow through published subpaths (`@elevasis/ui/features/<system>`, `@elevasis/ui/layout`, `@elevasis/ui/router/context`). Any new primitive must sync four files per `.claude/rules/ui-package.md`: `package.json` `exports`, `publishConfig.exports`, `rollup.dts.config.mjs`, and `tsup.config.ts`.
|
|
211
|
+
|
|
212
|
+
The published barrel (`packages/ui/src/provider/published.ts`) remains headless -- no Mantine-dependent visual pieces leak into the external contract.
|
|
213
|
+
|
|
214
|
+
## Knowledge Browser Customization
|
|
215
|
+
|
|
216
|
+
The Knowledge Browser follows the same pattern described in this document. The three tiers map directly:
|
|
217
|
+
|
|
218
|
+
- **Tier 1** -- import `knowledgeManifest` from `@elevasis/ui/features/knowledge` and pass it to `ElevasisSystemsProvider`. No further code required.
|
|
219
|
+
- **Tier 2** -- spread the manifest, override `sidebar` to a component that composes `KnowledgeSidebar` + `KnowledgeSidebarMiddle items={customItems}`. Same shape as the CRM example above.
|
|
220
|
+
- **Tier 3** -- skip the manifest, own the route, call `bySystem` / `byKind` / `byOwner` from `@elevasis/core/knowledge` directly.
|
|
221
|
+
|
|
222
|
+
One additional wiring step is required for Knowledge Browser that does not apply to CRM or Lead Gen: add `knowledgePlugin()` from `@elevasis/ui/vite-plugin-knowledge` to `vite.config.ts`. The plugin runs build-time MDX codegen so rendered body components are available at runtime.
|
|
223
|
+
|
|
224
|
+
See [recipes/customize-knowledge-browser.md](../recipes/customize-knowledge-browser.md) for the full walkthrough including code examples, the CSS import requirement, and the full exports reference.
|
|
225
|
+
|
|
226
|
+
Phase 1.5 adds two further extension surfaces documented in the same recipe file under the "Phase 1.5" section:
|
|
227
|
+
|
|
228
|
+
- **Extending the SegmentedControl** -- supply a `segments` prop to `KnowledgeSidebarMiddle` to add custom mount-axis tabs beyond the default five (By Feature, By Kind, By Owner, Governs, Governed By).
|
|
229
|
+
- **Replacing `DescribeNodeView`** -- override the `/knowledge/:nodeId` route component to swap the entire main-pane dispatcher, or use `createDescribeNodeDispatcher` from `@elevasis/ui/knowledge` to override only specific node-kind views while keeping the platform defaults for the rest.
|
|
230
|
+
|
|
231
|
+
## What Not to Do
|
|
232
|
+
|
|
233
|
+
- **Don't fork sidebar files into your app tree.** You own upstream drift forever.
|
|
234
|
+
- **Don't redefine `NavItem` locally.** Import it from `@elevasis/ui/layout` so future shape changes stay coherent.
|
|
235
|
+
- **Don't monkey-patch `SYSTEM_MANIFESTS`.** It's a published convenience constant; consumers build their own manifest array and pass it to the provider.
|
|
236
|
+
- **Don't add discriminated-union sidebar configuration to manifests.** The single pattern (assign a component to `manifest.sidebar`) is intentional.
|