@opencxh/domain 1.296.1 → 1.297.0

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.
@@ -0,0 +1,66 @@
1
+ import { IconDefinition } from './common';
2
+ import { AppManifest } from './manifest';
3
+ import { NavEntry, OrgWorkspaceConfig, UserWorkspacePrefs, WorkspaceDefinition, WorkspaceIndex } from './navigation';
4
+ /** i18n key (shell or app namespace) or text an organization typed. */
5
+ export type NavLabel = {
6
+ key: string;
7
+ } | {
8
+ text: string;
9
+ };
10
+ /** A label to text: typed text as is, a bare key from the shell namespace, `app:key` as given. */
11
+ export declare function navLabelText(label: NavLabel | undefined, t: (key: string) => string): string;
12
+ export interface NavItem {
13
+ app: string;
14
+ entry: NavEntry;
15
+ }
16
+ export interface NavSection {
17
+ key: string;
18
+ /** Absent = no heading. */
19
+ label?: NavLabel;
20
+ items: NavItem[];
21
+ }
22
+ export interface NavWorkspace {
23
+ /** Workspace key; `"apps"` for an app's own, together with `app`. */
24
+ key: string;
25
+ app?: string;
26
+ group: "workspaces" | "apps";
27
+ label: NavLabel;
28
+ /** A Lucide name for a workspace; an app's own icon definition for its own workspace. */
29
+ icon: string | IconDefinition;
30
+ sections: NavSection[];
31
+ }
32
+ /** A shared workspace as the organization and the user can change it, shown to them or not. */
33
+ export interface NavWorkspaceChoice extends NavWorkspace {
34
+ /** `own`: the organization made it; `default`: from domain, `customized` when it has config. */
35
+ kind: "default" | "own";
36
+ customized: boolean;
37
+ /** In this user's switcher. */
38
+ visible: boolean;
39
+ /** In it without the user's own on/off (organization default and audience). */
40
+ visibleByDefault: boolean;
41
+ }
42
+ export interface NavModel {
43
+ /** What the switcher lists, in order: shared workspaces, then the apps' own. */
44
+ workspaces: NavWorkspace[];
45
+ /**
46
+ * Every shared workspace that exists, in switcher order, visible or not, sections before
47
+ * permissions: the organization's editor and the user's "customize" list.
48
+ */
49
+ all: NavWorkspaceChoice[];
50
+ index: WorkspaceIndex;
51
+ /** The column of `/apps/<app>` for every app with entries, listed in the switcher or not. */
52
+ ownColumn: (app: string) => NavWorkspace | undefined;
53
+ /** A default or organization key, visible to this user or not: a URL segment to correct. */
54
+ isWorkspaceKey: (key: string) => boolean;
55
+ }
56
+ export interface NavModelInput {
57
+ /** Installed and allowed apps. */
58
+ manifests: readonly AppManifest[];
59
+ defaults: readonly WorkspaceDefinition[];
60
+ org: readonly OrgWorkspaceConfig[];
61
+ prefs: UserWorkspacePrefs;
62
+ teamIds: readonly string[];
63
+ can: (permission: string) => boolean;
64
+ }
65
+ /** Manifests + organization config + user prefs + permissions → the switcher and every column. */
66
+ export declare function buildNavModel(input: NavModelInput): NavModel;
@@ -0,0 +1 @@
1
+ export {};
@@ -150,6 +150,11 @@ export interface OrgWorkspaceConfig {
150
150
  /** Default entries the organization took out of a default workspace. */
151
151
  excluded?: NavEntryRef[];
152
152
  }
153
+ /**
154
+ * The URL key of an organization's own workspace, from its name at creation: never a default key, a
155
+ * reserved segment or one already `taken`. It never changes after, so a rename keeps every link.
156
+ */
157
+ export declare function ownWorkspaceKey(label: string, taken: readonly string[]): string;
153
158
  /** What one user changes: which workspaces they see. Never the contents. */
154
159
  export interface UserWorkspacePrefs {
155
160
  /** Turned on although hidden by default. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencxh/domain",
3
- "version": "1.296.1",
3
+ "version": "1.297.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",