@openmrs/esm-extensions 10.0.1-pre.5649 → 10.0.1-pre.5664

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.
@@ -1,3 +1,3 @@
1
- [0] Successfully compiled: 10 files with swc (187.86ms)
1
+ [0] Successfully compiled: 9 files with swc (126.86ms)
2
2
  [0] swc --strip-leading-paths src -d dist exited with code 0
3
3
  [1] tsc --project tsconfig.build.json exited with code 0
package/dist/index.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  export * from './extensions';
2
2
  export * from './left-nav';
3
3
  export * from './modals';
4
- export * from './workspaces';
5
4
  export * from './workspaces2';
6
5
  export * from './render';
7
6
  export * from './store';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
package/dist/index.js CHANGED
@@ -1,7 +1,6 @@
1
1
  export * from "./extensions.js";
2
2
  export * from "./left-nav.js";
3
3
  export * from "./modals.js";
4
- export * from "./workspaces.js";
5
4
  export * from "./workspaces2.js";
6
5
  export * from "./render.js";
7
6
  export * from "./store.js";
package/dist/public.d.ts CHANGED
@@ -2,6 +2,5 @@ export { getExtensionNameFromId, registerExtension, attach, detach, detachAll, g
2
2
  export { type LeftNavStore, setLeftNav, unsetLeftNav, type SetLeftNavParams } from './left-nav';
3
3
  export { type CancelLoading, renderExtension } from './render';
4
4
  export { type ExtensionMeta, type ExtensionRegistration, type ExtensionStore, type AssignedExtension, type ConnectedExtension, type ExtensionSlotCustomState, type ExtensionSlotState, getExtensionStore, } from './store';
5
- export { type WorkspaceRegistration } from './workspaces';
6
5
  export { type ExtensionData, type ComponentConfig } from './types';
7
6
  //# sourceMappingURL=public.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../src/public.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,iBAAiB,EACjB,MAAM,EACN,MAAM,EACN,SAAS,EACT,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,KAAK,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,KAAK,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAChG,OAAO,EAAE,KAAK,aAAa,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC/D,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,qBAAqB,EAC1B,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,wBAAwB,EAC7B,KAAK,kBAAkB,EACvB,iBAAiB,GAClB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,eAAe,EAAE,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../src/public.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,iBAAiB,EACjB,MAAM,EACN,MAAM,EACN,SAAS,EACT,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,KAAK,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,KAAK,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAChG,OAAO,EAAE,KAAK,aAAa,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC/D,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,qBAAqB,EAC1B,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,wBAAwB,EAC7B,KAAK,kBAAkB,EACvB,iBAAiB,GAClB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,eAAe,EAAE,MAAM,SAAS,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmrs/esm-extensions",
3
- "version": "10.0.1-pre.5649",
3
+ "version": "10.0.1-pre.5664",
4
4
  "license": "MPL-2.0",
5
5
  "description": "Coordinates extensions and extension points in the OpenMRS Frontend",
6
6
  "type": "module",
@@ -57,21 +57,21 @@
57
57
  "lodash-es": "^4.17.21"
58
58
  },
59
59
  "peerDependencies": {
60
- "@openmrs/esm-api": "^10.0.1-pre.5649",
61
- "@openmrs/esm-config": "^10.0.1-pre.5649",
62
- "@openmrs/esm-expression-evaluator": "^10.0.1-pre.5649",
63
- "@openmrs/esm-feature-flags": "^10.0.1-pre.5649",
64
- "@openmrs/esm-state": "^10.0.1-pre.5649",
65
- "@openmrs/esm-utils": "^10.0.1-pre.5649",
60
+ "@openmrs/esm-api": "^10.0.1-pre.5664",
61
+ "@openmrs/esm-config": "^10.0.1-pre.5664",
62
+ "@openmrs/esm-expression-evaluator": "^10.0.1-pre.5664",
63
+ "@openmrs/esm-feature-flags": "^10.0.1-pre.5664",
64
+ "@openmrs/esm-state": "^10.0.1-pre.5664",
65
+ "@openmrs/esm-utils": "^10.0.1-pre.5664",
66
66
  "single-spa": "6.x"
67
67
  },
68
68
  "devDependencies": {
69
- "@openmrs/esm-api": "10.0.1-pre.5649",
70
- "@openmrs/esm-config": "10.0.1-pre.5649",
71
- "@openmrs/esm-expression-evaluator": "10.0.1-pre.5649",
72
- "@openmrs/esm-feature-flags": "10.0.1-pre.5649",
73
- "@openmrs/esm-state": "10.0.1-pre.5649",
74
- "@openmrs/esm-utils": "10.0.1-pre.5649",
69
+ "@openmrs/esm-api": "10.0.1-pre.5664",
70
+ "@openmrs/esm-config": "10.0.1-pre.5664",
71
+ "@openmrs/esm-expression-evaluator": "10.0.1-pre.5664",
72
+ "@openmrs/esm-feature-flags": "10.0.1-pre.5664",
73
+ "@openmrs/esm-state": "10.0.1-pre.5664",
74
+ "@openmrs/esm-utils": "10.0.1-pre.5664",
75
75
  "@swc/cli": "0.8.1",
76
76
  "@swc/core": "1.15.21",
77
77
  "@vitest/coverage-v8": "^4.1.2",
package/src/index.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  export * from './extensions';
2
2
  export * from './left-nav';
3
3
  export * from './modals';
4
- export * from './workspaces';
5
4
  export * from './workspaces2';
6
5
  export * from './render';
7
6
  export * from './store';
package/src/public.ts CHANGED
@@ -19,5 +19,4 @@ export {
19
19
  type ExtensionSlotState,
20
20
  getExtensionStore,
21
21
  } from './store';
22
- export { type WorkspaceRegistration } from './workspaces';
23
22
  export { type ExtensionData, type ComponentConfig } from './types';
@@ -1,61 +0,0 @@
1
- import { type ReactNode } from 'react';
2
- import { type LifeCycles } from 'single-spa';
3
- import { type WorkspaceGroupDefinition, type WorkspaceWindowState } from '@openmrs/esm-globals';
4
- /** See [[WorkspaceDefinition]] for more information about these properties */
5
- export interface WorkspaceRegistration {
6
- name: string;
7
- title: string;
8
- titleNode?: ReactNode;
9
- type: string;
10
- canHide: boolean;
11
- canMaximize: boolean;
12
- width: 'narrow' | 'wider' | 'extra-wide';
13
- preferredWindowSize: WorkspaceWindowState;
14
- load(): Promise<LifeCycles>;
15
- moduleName: string;
16
- groups: Array<string>;
17
- }
18
- export type WorkspaceGroupRegistration = WorkspaceGroupDefinition & {
19
- members: Array<string>;
20
- };
21
- /** See [[WorkspaceDefinition]] for more information about these properties */
22
- export interface RegisterWorkspaceOptions {
23
- name: string;
24
- title: string;
25
- type?: string;
26
- canHide?: boolean;
27
- canMaximize?: boolean;
28
- width?: 'narrow' | 'wider' | 'extra-wide';
29
- preferredWindowSize?: WorkspaceWindowState;
30
- component: string;
31
- moduleName: string;
32
- groups?: Array<string>;
33
- load(): Promise<LifeCycles>;
34
- }
35
- /**
36
- * Tells the workspace system about a workspace. This is used by the app shell
37
- * to register workspaces defined in the `routes.json` file.
38
- * @internal
39
- */
40
- export declare function registerWorkspace(workspace: RegisterWorkspaceOptions): void;
41
- /**
42
- * Tells the workspace system about a workspace group. This is used by the app shell
43
- * to register workspace groups defined in the `routes.json` file.
44
- * @internal
45
- */
46
- export declare function registerWorkspaceGroup(workspaceGroup: WorkspaceGroupRegistration): void;
47
- /**
48
- * This exists for compatibility with the old way of registering
49
- * workspaces (as extensions).
50
- *
51
- * @param name of the workspace
52
- */
53
- export declare function getWorkspaceRegistration(name: string): WorkspaceRegistration;
54
- /**
55
- * This provides the workspace group registration and is also compatible with the
56
- * old way of registering workspace groups (as extensions), but isn't recommended.
57
- *
58
- * @param name of the workspace
59
- */
60
- export declare function getWorkspaceGroupRegistration(name: string): WorkspaceGroupRegistration;
61
- //# sourceMappingURL=workspaces.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"workspaces.d.ts","sourceRoot":"","sources":["../src/workspaces.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,KAAK,wBAAwB,EAAE,KAAK,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAKhG,8EAA8E;AAC9E,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,OAAO,CAAC;IACrB,KAAK,EAAE,QAAQ,GAAG,OAAO,GAAG,YAAY,CAAC;IACzC,mBAAmB,EAAE,oBAAoB,CAAC;IAC1C,IAAI,IAAI,OAAO,CAAC,UAAU,CAAC,CAAC;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CACvB;AAED,MAAM,MAAM,0BAA0B,GAAG,wBAAwB,GAAG;IAClE,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CACxB,CAAC;AAkBF,8EAA8E;AAC9E,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,KAAK,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,YAAY,CAAC;IAC1C,mBAAmB,CAAC,EAAE,oBAAoB,CAAC;IAC3C,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACvB,IAAI,IAAI,OAAO,CAAC,UAAU,CAAC,CAAC;CAC7B;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,wBAAwB,QAgBpE;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,cAAc,EAAE,0BAA0B,QA4BhF;AAGD;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,qBAAqB,CA6B5E;AAED;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,MAAM,GAAG,0BAA0B,CAOtF"}
@@ -1,122 +0,0 @@
1
- import { getExtensionRegistration } from "./index.js";
2
- import { createGlobalStore } from "@openmrs/esm-state";
3
- import { translateFrom } from "@openmrs/esm-translations";
4
- const workspaceRegistrationStore = createGlobalStore('workspaceRegistrations', {
5
- workspaces: {}
6
- });
7
- const workspaceGroupStore = createGlobalStore('workspaceGroups', {
8
- workspaceGroups: {}
9
- });
10
- /**
11
- * Tells the workspace system about a workspace. This is used by the app shell
12
- * to register workspaces defined in the `routes.json` file.
13
- * @internal
14
- */ export function registerWorkspace(workspace) {
15
- workspaceRegistrationStore.setState((state)=>({
16
- workspaces: {
17
- ...state.workspaces,
18
- [workspace.name]: {
19
- ...workspace,
20
- load: workspace.load,
21
- preferredWindowSize: workspace.preferredWindowSize ?? 'normal',
22
- type: workspace.type ?? 'form',
23
- canHide: workspace.canHide ?? false,
24
- canMaximize: workspace.canMaximize ?? false,
25
- width: workspace.width ?? 'narrow',
26
- groups: workspace.groups ?? []
27
- }
28
- }
29
- }));
30
- }
31
- /**
32
- * Tells the workspace system about a workspace group. This is used by the app shell
33
- * to register workspace groups defined in the `routes.json` file.
34
- * @internal
35
- */ export function registerWorkspaceGroup(workspaceGroup) {
36
- workspaceGroupStore.setState((state)=>{
37
- const group = state.workspaceGroups[workspaceGroup.name];
38
- if (group) {
39
- // This condition occurs when a workspace with a `groups` property is registered before
40
- // the corresponding workspace group. In such cases, the workspace group is registered
41
- // by the `attachWorkspaceToGroup` function.
42
- return {
43
- workspaceGroups: {
44
- ...state.workspaceGroups,
45
- [workspaceGroup.name]: {
46
- ...group,
47
- members: Array.from(new Set([
48
- ...group.members,
49
- ...workspaceGroup.members
50
- ]))
51
- }
52
- }
53
- };
54
- } else {
55
- return {
56
- workspaceGroups: {
57
- ...state.workspaceGroups,
58
- [workspaceGroup.name]: {
59
- name: workspaceGroup.name,
60
- members: workspaceGroup.members
61
- }
62
- }
63
- };
64
- }
65
- });
66
- }
67
- const workspaceExtensionWarningsIssued = new Set();
68
- /**
69
- * This exists for compatibility with the old way of registering
70
- * workspaces (as extensions).
71
- *
72
- * @param name of the workspace
73
- */ export function getWorkspaceRegistration(name) {
74
- const registeredWorkspaces = workspaceRegistrationStore.getState().workspaces;
75
- if (registeredWorkspaces[name]) {
76
- return registeredWorkspaces[name];
77
- } else {
78
- const workspaceExtension = getExtensionRegistration(name);
79
- if (workspaceExtension) {
80
- if (!workspaceExtensionWarningsIssued.has(name)) {
81
- console.warn(`The workspace '${name}' is registered as an extension. This is deprecated. Please register it in the "workspaces" section of the routes.json file.`);
82
- workspaceExtensionWarningsIssued.add(name);
83
- }
84
- return {
85
- name: workspaceExtension.name,
86
- title: getTitleFromExtension(workspaceExtension),
87
- moduleName: workspaceExtension.moduleName,
88
- preferredWindowSize: workspaceExtension.meta?.screenSize ?? 'normal',
89
- load: workspaceExtension.load,
90
- type: workspaceExtension.meta?.type ?? 'form',
91
- canHide: workspaceExtension.meta?.canHide ?? false,
92
- canMaximize: workspaceExtension.meta?.canMaximize ?? false,
93
- width: workspaceExtension.meta?.width ?? 'narrow',
94
- groups: workspaceExtension.meta?.groups ?? []
95
- };
96
- } else {
97
- throw new Error(`No workspace named '${name}' has been registered.`);
98
- }
99
- }
100
- }
101
- /**
102
- * This provides the workspace group registration and is also compatible with the
103
- * old way of registering workspace groups (as extensions), but isn't recommended.
104
- *
105
- * @param name of the workspace
106
- */ export function getWorkspaceGroupRegistration(name) {
107
- const registeredWorkspaces = workspaceGroupStore.getState().workspaceGroups;
108
- if (registeredWorkspaces[name]) {
109
- return registeredWorkspaces[name];
110
- } else {
111
- throw new Error(`No workspace group named '${name}' has been registered.`);
112
- }
113
- }
114
- function getTitleFromExtension(ext) {
115
- const title = ext?.meta?.title;
116
- if (typeof title === 'string') {
117
- return title;
118
- } else if (title && typeof title === 'object') {
119
- return translateFrom(ext.moduleName, title.key, title.default);
120
- }
121
- return ext.name;
122
- }
package/src/workspaces.ts DELETED
@@ -1,177 +0,0 @@
1
- import { type ReactNode } from 'react';
2
- import { type LifeCycles } from 'single-spa';
3
- import { type WorkspaceGroupDefinition, type WorkspaceWindowState } from '@openmrs/esm-globals';
4
- import { type ExtensionRegistration, getExtensionRegistration } from '.';
5
- import { createGlobalStore } from '@openmrs/esm-state';
6
- import { translateFrom } from '@openmrs/esm-translations';
7
-
8
- /** See [[WorkspaceDefinition]] for more information about these properties */
9
- export interface WorkspaceRegistration {
10
- name: string;
11
- title: string;
12
- titleNode?: ReactNode;
13
- type: string;
14
- canHide: boolean;
15
- canMaximize: boolean;
16
- width: 'narrow' | 'wider' | 'extra-wide';
17
- preferredWindowSize: WorkspaceWindowState;
18
- load(): Promise<LifeCycles>;
19
- moduleName: string;
20
- groups: Array<string>;
21
- }
22
-
23
- export type WorkspaceGroupRegistration = WorkspaceGroupDefinition & {
24
- members: Array<string>;
25
- };
26
-
27
- interface WorkspaceRegistrationStore {
28
- workspaces: Record<string, WorkspaceRegistration>;
29
- }
30
-
31
- const workspaceRegistrationStore = createGlobalStore<WorkspaceRegistrationStore>('workspaceRegistrations', {
32
- workspaces: {},
33
- });
34
-
35
- interface WorkspaceGroupRegistrationStore {
36
- workspaceGroups: Record<string, { name: string; members: Array<string> }>;
37
- }
38
-
39
- const workspaceGroupStore = createGlobalStore<WorkspaceGroupRegistrationStore>('workspaceGroups', {
40
- workspaceGroups: {},
41
- });
42
-
43
- /** See [[WorkspaceDefinition]] for more information about these properties */
44
- export interface RegisterWorkspaceOptions {
45
- name: string;
46
- title: string;
47
- type?: string;
48
- canHide?: boolean;
49
- canMaximize?: boolean;
50
- width?: 'narrow' | 'wider' | 'extra-wide';
51
- preferredWindowSize?: WorkspaceWindowState;
52
- component: string;
53
- moduleName: string;
54
- groups?: Array<string>;
55
- load(): Promise<LifeCycles>;
56
- }
57
-
58
- /**
59
- * Tells the workspace system about a workspace. This is used by the app shell
60
- * to register workspaces defined in the `routes.json` file.
61
- * @internal
62
- */
63
- export function registerWorkspace(workspace: RegisterWorkspaceOptions) {
64
- workspaceRegistrationStore.setState((state) => ({
65
- workspaces: {
66
- ...state.workspaces,
67
- [workspace.name]: {
68
- ...workspace,
69
- load: workspace.load,
70
- preferredWindowSize: workspace.preferredWindowSize ?? 'normal',
71
- type: workspace.type ?? 'form',
72
- canHide: workspace.canHide ?? false,
73
- canMaximize: workspace.canMaximize ?? false,
74
- width: workspace.width ?? 'narrow',
75
- groups: workspace.groups ?? [],
76
- },
77
- },
78
- }));
79
- }
80
-
81
- /**
82
- * Tells the workspace system about a workspace group. This is used by the app shell
83
- * to register workspace groups defined in the `routes.json` file.
84
- * @internal
85
- */
86
- export function registerWorkspaceGroup(workspaceGroup: WorkspaceGroupRegistration) {
87
- workspaceGroupStore.setState((state) => {
88
- const group = state.workspaceGroups[workspaceGroup.name];
89
- if (group) {
90
- // This condition occurs when a workspace with a `groups` property is registered before
91
- // the corresponding workspace group. In such cases, the workspace group is registered
92
- // by the `attachWorkspaceToGroup` function.
93
- return {
94
- workspaceGroups: {
95
- ...state.workspaceGroups,
96
- [workspaceGroup.name]: {
97
- ...group,
98
- members: Array.from(new Set([...group.members, ...workspaceGroup.members])),
99
- },
100
- },
101
- };
102
- } else {
103
- return {
104
- workspaceGroups: {
105
- ...state.workspaceGroups,
106
- [workspaceGroup.name]: {
107
- name: workspaceGroup.name,
108
- members: workspaceGroup.members,
109
- },
110
- },
111
- };
112
- }
113
- });
114
- }
115
-
116
- const workspaceExtensionWarningsIssued = new Set();
117
- /**
118
- * This exists for compatibility with the old way of registering
119
- * workspaces (as extensions).
120
- *
121
- * @param name of the workspace
122
- */
123
- export function getWorkspaceRegistration(name: string): WorkspaceRegistration {
124
- const registeredWorkspaces = workspaceRegistrationStore.getState().workspaces;
125
- if (registeredWorkspaces[name]) {
126
- return registeredWorkspaces[name];
127
- } else {
128
- const workspaceExtension = getExtensionRegistration(name);
129
- if (workspaceExtension) {
130
- if (!workspaceExtensionWarningsIssued.has(name)) {
131
- console.warn(
132
- `The workspace '${name}' is registered as an extension. This is deprecated. Please register it in the "workspaces" section of the routes.json file.`,
133
- );
134
- workspaceExtensionWarningsIssued.add(name);
135
- }
136
- return {
137
- name: workspaceExtension.name,
138
- title: getTitleFromExtension(workspaceExtension),
139
- moduleName: workspaceExtension.moduleName,
140
- preferredWindowSize: workspaceExtension.meta?.screenSize ?? 'normal',
141
- load: workspaceExtension.load,
142
- type: workspaceExtension.meta?.type ?? 'form',
143
- canHide: workspaceExtension.meta?.canHide ?? false,
144
- canMaximize: workspaceExtension.meta?.canMaximize ?? false,
145
- width: workspaceExtension.meta?.width ?? 'narrow',
146
- groups: workspaceExtension.meta?.groups ?? [],
147
- };
148
- } else {
149
- throw new Error(`No workspace named '${name}' has been registered.`);
150
- }
151
- }
152
- }
153
-
154
- /**
155
- * This provides the workspace group registration and is also compatible with the
156
- * old way of registering workspace groups (as extensions), but isn't recommended.
157
- *
158
- * @param name of the workspace
159
- */
160
- export function getWorkspaceGroupRegistration(name: string): WorkspaceGroupRegistration {
161
- const registeredWorkspaces = workspaceGroupStore.getState().workspaceGroups;
162
- if (registeredWorkspaces[name]) {
163
- return registeredWorkspaces[name];
164
- } else {
165
- throw new Error(`No workspace group named '${name}' has been registered.`);
166
- }
167
- }
168
-
169
- function getTitleFromExtension(ext: ExtensionRegistration) {
170
- const title = ext?.meta?.title;
171
- if (typeof title === 'string') {
172
- return title;
173
- } else if (title && typeof title === 'object') {
174
- return translateFrom(ext.moduleName, title.key, title.default);
175
- }
176
- return ext.name;
177
- }