@iota-uz/sdk 0.39.0 → 0.40.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.
- package/dist/client-host/identity.d.ts +4 -4
- package/dist/client-host/identity.js +2 -2
- package/dist/client-host/index.d.ts +4 -0
- package/dist/client-host/index.d.ts.map +1 -1
- package/dist/client-host/index.js +4 -0
- package/dist/client-host/portal-host.d.ts +7 -1
- package/dist/client-host/portal-host.d.ts.map +1 -1
- package/dist/client-host/portal-host.js +21 -5
- package/dist/client-host/shell-context.d.ts +18 -0
- package/dist/client-host/shell-context.d.ts.map +1 -0
- package/dist/client-host/shell-context.js +55 -0
- package/dist/client-host/shell-host.d.ts +72 -0
- package/dist/client-host/shell-host.d.ts.map +1 -0
- package/dist/client-host/shell-host.js +106 -0
- package/dist/client-host/shell-registry.d.ts +68 -0
- package/dist/client-host/shell-registry.d.ts.map +1 -0
- package/dist/client-host/shell-registry.js +253 -0
- package/dist/client-host/solid-index.d.ts +4 -0
- package/dist/client-host/solid-index.d.ts.map +1 -1
- package/dist/client-host/solid-index.js +4 -0
- package/dist/lens/{CascadePanel-BJpML10m.js → CascadePanel-odKNeG0I.js} +1 -1
- package/dist/lens/{ChartDataEquivalent-BtXPuxNY.js → ChartDataEquivalent-DS6Aj-mH.js} +1 -1
- package/dist/lens/{ChartPanel-Ctf7vUCR.js → ChartPanel-jBHgzXvE.js} +4 -4
- package/dist/lens/{CoveragePanel-BBTEjfCH.js → CoveragePanel-DJBkno95.js} +1 -1
- package/dist/lens/{GaugePanel-CyC5SY8m.js → GaugePanel-C7OP3lSD.js} +1 -1
- package/dist/lens/{MapPanel-DxvdyFzM.js → MapPanel-DKH9XQ3v.js} +3 -3
- package/dist/lens/{MetricFlowPanel-B-ot336K.js → MetricFlowPanel-DoG-Z7eY.js} +2 -2
- package/dist/lens/{MetricHierarchyPanel-RcReavhX.js → MetricHierarchyPanel-CQRnPzmg.js} +2 -2
- package/dist/lens/{MetricRelationshipPanel-CCKHpOOC.js → MetricRelationshipPanel-7jpgouaq.js} +2 -2
- package/dist/lens/{PrintReport-BAOywUOk.js → PrintReport-R3wm1wHI.js} +5 -5
- package/dist/lens/{TablePanel-CRELyGWO.js → TablePanel-CxseNMoa.js} +1 -1
- package/dist/lens/{adapter-CKjcZiIv.js → adapter-CY6pdOaG.js} +7 -7
- package/dist/lens/{dashboardEdit-CHKE1ypt.js → dashboardEdit-DaBLm9LN.js} +1 -1
- package/dist/lens/icons.d.ts +2 -0
- package/dist/lens/icons.d.ts.map +1 -1
- package/dist/lens/{index-B9zaeVRz.js → index-CK47GOOR.js} +1 -1
- package/dist/lens/{index-DyBlaBzi.js → index-DGHwvvd1.js} +5375 -5146
- package/dist/lens/index.d.ts +1 -1
- package/dist/lens/index.d.ts.map +1 -1
- package/dist/lens/index.js +1 -1
- package/dist/lens/{install-C4rACDqI.js → install-C99l3DlG.js} +1 -1
- package/dist/lens/{install-DJyIOO9y.js → install-CEMUnr4B.js} +1 -1
- package/dist/lens/{install-CaIWiRbq.js → install-Dfe-R2a1.js} +1 -1
- package/dist/lens/{install-BNzRciSi.js → install-LwZr5b3c.js} +1 -1
- package/dist/lens/{keys-C4WBdt2s.js → keys-DRnLTb3T.js} +2 -2
- package/dist/lens/{metricViews-szvMgdRL.js → metricViews-Uga35rVO.js} +1 -1
- package/dist/lens/{prefetch-Duj95bsF.js → prefetch-DvGDW65r.js} +2 -2
- package/dist/lens/{prefetchPanels-Yk06pVYx.js → prefetchPanels-BngJI8s2.js} +1 -1
- package/dist/lens/{print-B416G_YI.js → print-BKdOYqt0.js} +1 -1
- package/dist/lens/reports/ReportDialog.d.ts +15 -1
- package/dist/lens/reports/ReportDialog.d.ts.map +1 -1
- package/dist/lens/reports/ReportPicker.d.ts +6 -1
- package/dist/lens/reports/ReportPicker.d.ts.map +1 -1
- package/dist/lens/reports/picker.d.ts +20 -0
- package/dist/lens/reports/picker.d.ts.map +1 -1
- package/dist/lens/runtime/drawer.d.ts.map +1 -1
- package/dist/lens/{scales-DnzMqagT.js → scales-CtjgzrH0.js} +1 -1
- package/dist/lens/style.css +1 -1
- package/dist/sdk-identity.cjs +3 -3
- package/dist/sdk-identity.js +3 -3
- package/dist/sdk-identity.json +2 -2
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export declare const SDK_RELEASE_VERSION = "0.
|
|
2
|
-
export declare const SDK_SOURCE_COMMIT = "
|
|
1
|
+
export declare const SDK_RELEASE_VERSION = "0.40.0";
|
|
2
|
+
export declare const SDK_SOURCE_COMMIT = "5237f0cc252f8d34c01fe8149b57b19759704bea";
|
|
3
3
|
export declare const SDK_PROTOCOL_VERSION = "1.0.0";
|
|
4
4
|
export declare const SDK_IDENTITY: Readonly<{
|
|
5
|
-
releaseVersion: "0.
|
|
6
|
-
sourceCommit: "
|
|
5
|
+
releaseVersion: "0.40.0";
|
|
6
|
+
sourceCommit: "5237f0cc252f8d34c01fe8149b57b19759704bea";
|
|
7
7
|
protocolVersion: "1.0.0";
|
|
8
8
|
}>;
|
|
9
9
|
export interface SDKRuntimeIdentity {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CLIENT_HOST_PROTOCOL_VERSION } from './protocol';
|
|
2
|
-
export const SDK_RELEASE_VERSION = '0.
|
|
3
|
-
export const SDK_SOURCE_COMMIT = '
|
|
2
|
+
export const SDK_RELEASE_VERSION = '0.40.0';
|
|
3
|
+
export const SDK_SOURCE_COMMIT = '5237f0cc252f8d34c01fe8149b57b19759704bea';
|
|
4
4
|
export const SDK_PROTOCOL_VERSION = CLIENT_HOST_PROTOCOL_VERSION;
|
|
5
5
|
export const SDK_IDENTITY = Object.freeze({
|
|
6
6
|
releaseVersion: SDK_RELEASE_VERSION,
|
|
@@ -14,4 +14,8 @@ export * from './solid-streaming';
|
|
|
14
14
|
export * from './solid';
|
|
15
15
|
export * from './streaming';
|
|
16
16
|
export * from './transport';
|
|
17
|
+
export * from './shell-registry';
|
|
18
|
+
export * from './shell-context';
|
|
19
|
+
export * from './shell-host';
|
|
20
|
+
export { PortalRegistry, documentPortalRegistry } from './portal-host';
|
|
17
21
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA;AAC/B,cAAc,aAAa,CAAA;AAC3B,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,aAAa,CAAA;AAC3B,cAAc,mBAAmB,CAAA;AACjC,cAAc,SAAS,CAAA;AACvB,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA;AAC/B,cAAc,aAAa,CAAA;AAC3B,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,aAAa,CAAA;AAC3B,cAAc,mBAAmB,CAAA;AACjC,cAAc,SAAS,CAAA;AACvB,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,kBAAkB,CAAA;AAChC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,cAAc,CAAA;AAC5B,OAAO,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA"}
|
|
@@ -14,3 +14,7 @@ export * from './solid-streaming';
|
|
|
14
14
|
export * from './solid';
|
|
15
15
|
export * from './streaming';
|
|
16
16
|
export * from './transport';
|
|
17
|
+
export * from './shell-registry';
|
|
18
|
+
export * from './shell-context';
|
|
19
|
+
export * from './shell-host';
|
|
20
|
+
export { PortalRegistry, documentPortalRegistry } from './portal-host';
|
|
@@ -12,11 +12,17 @@ export declare class PortalRegistry {
|
|
|
12
12
|
private readonly roots;
|
|
13
13
|
private readonly overlays;
|
|
14
14
|
private locked;
|
|
15
|
-
constructor(owner: HTMLElement, background?: HTMLElement | undefined);
|
|
15
|
+
constructor(owner: HTMLElement, background?: (HTMLElement | (() => HTMLElement | undefined)) | undefined);
|
|
16
16
|
get ownerDocument(): Document;
|
|
17
17
|
root(surface: PortalSurface): HTMLElement;
|
|
18
18
|
mount(entry: OverlayEntry): () => void;
|
|
19
19
|
destroy(): void;
|
|
20
20
|
private sync;
|
|
21
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* The document-level portal host for overlays rendered outside a Solid client
|
|
24
|
+
* route. Roots live under the body; the standard shell or the client route
|
|
25
|
+
* background becomes inert while a blocking overlay is open.
|
|
26
|
+
*/
|
|
27
|
+
export declare function documentPortalRegistry(owner: Document): PortalRegistry;
|
|
22
28
|
//# sourceMappingURL=portal-host.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"portal-host.d.ts","sourceRoot":"","sources":["../src/portal-host.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS,CAAA;AACpE,eAAO,MAAM,iBAAiB,6FAA8F,CAAA;AAC5H,MAAM,MAAM,cAAc,GAAG,OAAO,iBAAiB,CAAC,MAAM,CAAC,CAAA;AAI7D,MAAM,WAAW,YAAY;IAAG,EAAE,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,aAAa,CAAC;IAAC,OAAO,EAAE,W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K,EAAE,QAAQ,GAAG,cAAc,CAOtE"}
|
|
@@ -103,16 +103,32 @@ export class PortalRegistry {
|
|
|
103
103
|
sync() {
|
|
104
104
|
const blocking = this.overlays.some(({ surface }) => isBlocking(surface));
|
|
105
105
|
if (blocking && !this.locked) {
|
|
106
|
-
this.
|
|
106
|
+
const background = typeof this.background === 'function' ? this.background() : this.background;
|
|
107
|
+
this.locked = background ?? true;
|
|
107
108
|
acquireDocumentLock(this.owner.ownerDocument);
|
|
108
|
-
if (
|
|
109
|
-
acquireBackgroundLock(
|
|
109
|
+
if (background)
|
|
110
|
+
acquireBackgroundLock(background);
|
|
110
111
|
}
|
|
111
112
|
else if (!blocking && this.locked) {
|
|
113
|
+
const background = this.locked;
|
|
112
114
|
this.locked = false;
|
|
113
115
|
releaseDocumentLock(this.owner.ownerDocument);
|
|
114
|
-
if (
|
|
115
|
-
releaseBackgroundLock(
|
|
116
|
+
if (background !== true)
|
|
117
|
+
releaseBackgroundLock(background);
|
|
116
118
|
}
|
|
117
119
|
}
|
|
118
120
|
}
|
|
121
|
+
const documentRegistries = new WeakMap();
|
|
122
|
+
/**
|
|
123
|
+
* The document-level portal host for overlays rendered outside a Solid client
|
|
124
|
+
* route. Roots live under the body; the standard shell or the client route
|
|
125
|
+
* background becomes inert while a blocking overlay is open.
|
|
126
|
+
*/
|
|
127
|
+
export function documentPortalRegistry(owner) {
|
|
128
|
+
let registry = documentRegistries.get(owner);
|
|
129
|
+
if (!registry) {
|
|
130
|
+
registry = new PortalRegistry(owner.body, () => owner.querySelector('[data-iota-shell-standard], [data-client-route-background]') ?? undefined);
|
|
131
|
+
documentRegistries.set(owner, registry);
|
|
132
|
+
}
|
|
133
|
+
return registry;
|
|
134
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ShellUser } from './shell-host';
|
|
2
|
+
import { ShellRegistry, type ShellNavigationItem } from './shell-registry';
|
|
3
|
+
export declare const SHELL_CONTEXT_VERSION = "1.0.0";
|
|
4
|
+
export declare const SHELL_CONTEXT_ELEMENT_ID = "iota-shell-context";
|
|
5
|
+
export interface ShellContext {
|
|
6
|
+
version: string;
|
|
7
|
+
navigation: ShellNavigationItem[];
|
|
8
|
+
user: ShellUser | null;
|
|
9
|
+
}
|
|
10
|
+
/** Returns null when the page carries no shell context (for example a login page). */
|
|
11
|
+
export declare function readShellContext(document: Document, elementID?: string): ShellContext | null;
|
|
12
|
+
/**
|
|
13
|
+
* One registry per document, seeded from the server-rendered context. Templ
|
|
14
|
+
* pages and Solid routes on the same document share it, which is the common
|
|
15
|
+
* boundary for navigation and region contributions.
|
|
16
|
+
*/
|
|
17
|
+
export declare function documentShellRegistry(document: Document): ShellRegistry;
|
|
18
|
+
//# sourceMappingURL=shell-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shell-context.d.ts","sourceRoot":"","sources":["../src/shell-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,EAAE,aAAa,EAAE,KAAK,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AAE1E,eAAO,MAAM,qBAAqB,UAAU,CAAA;AAC5C,eAAO,MAAM,wBAAwB,uBAAuB,CAAA;AAa5D,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAA;IACf,UAAU,EAAE,mBAAmB,EAAE,CAAA;IACjC,IAAI,EAAE,SAAS,GAAG,IAAI,CAAA;CACvB;AA0BD,sFAAsF;AACtF,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,SAA2B,GAAG,YAAY,GAAG,IAAI,CAY9G;AAID;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,QAAQ,GAAG,aAAa,CAOvE"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { ShellRegistry } from './shell-registry';
|
|
2
|
+
export const SHELL_CONTEXT_VERSION = '1.0.0';
|
|
3
|
+
export const SHELL_CONTEXT_ELEMENT_ID = 'iota-shell-context';
|
|
4
|
+
function major(version) { return version.split('.', 1)[0] ?? ''; }
|
|
5
|
+
function parseItem(raw, index) {
|
|
6
|
+
const item = raw;
|
|
7
|
+
if (!item || typeof item.key !== 'string' || typeof item.title !== 'string') {
|
|
8
|
+
throw new Error(`shell context navigation[${index}] requires string key and title`);
|
|
9
|
+
}
|
|
10
|
+
for (const field of ['href', 'parent', 'workspace']) {
|
|
11
|
+
if (item[field] !== undefined && typeof item[field] !== 'string') {
|
|
12
|
+
throw new Error(`shell context navigation[${index}].${field} must be a string`);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return {
|
|
16
|
+
key: item.key,
|
|
17
|
+
title: item.title,
|
|
18
|
+
...(item.href ? { href: item.href } : {}),
|
|
19
|
+
...(item.parent ? { parent: item.parent } : {}),
|
|
20
|
+
...(item.workspace ? { workspace: item.workspace } : {}),
|
|
21
|
+
...(typeof item.pinned === 'boolean' ? { pinned: item.pinned } : {}),
|
|
22
|
+
...(typeof item.beta === 'boolean' ? { beta: item.beta } : {}),
|
|
23
|
+
...(typeof item.order === 'number' ? { order: item.order } : {}),
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/** Returns null when the page carries no shell context (for example a login page). */
|
|
27
|
+
export function readShellContext(document, elementID = SHELL_CONTEXT_ELEMENT_ID) {
|
|
28
|
+
const element = document.getElementById(elementID);
|
|
29
|
+
if (!element?.textContent)
|
|
30
|
+
return null;
|
|
31
|
+
const payload = JSON.parse(element.textContent);
|
|
32
|
+
if (typeof payload.version !== 'string' || major(payload.version) !== major(SHELL_CONTEXT_VERSION)) {
|
|
33
|
+
throw new Error(`shell context ${String(payload.version)} is incompatible with ${SHELL_CONTEXT_VERSION}`);
|
|
34
|
+
}
|
|
35
|
+
if (!Array.isArray(payload.navigation))
|
|
36
|
+
throw new Error('shell context navigation must be an array');
|
|
37
|
+
const user = payload.user && typeof payload.user.name === 'string' && typeof payload.user.email === 'string'
|
|
38
|
+
? { name: payload.user.name, email: payload.user.email }
|
|
39
|
+
: null;
|
|
40
|
+
return { version: payload.version, navigation: payload.navigation.map(parseItem), user };
|
|
41
|
+
}
|
|
42
|
+
const registries = new WeakMap();
|
|
43
|
+
/**
|
|
44
|
+
* One registry per document, seeded from the server-rendered context. Templ
|
|
45
|
+
* pages and Solid routes on the same document share it, which is the common
|
|
46
|
+
* boundary for navigation and region contributions.
|
|
47
|
+
*/
|
|
48
|
+
export function documentShellRegistry(document) {
|
|
49
|
+
let registry = registries.get(document);
|
|
50
|
+
if (!registry) {
|
|
51
|
+
registry = new ShellRegistry(readShellContext(document)?.navigation ?? []);
|
|
52
|
+
registries.set(document, registry);
|
|
53
|
+
}
|
|
54
|
+
return registry;
|
|
55
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { ShellRegistry } from './shell-registry';
|
|
2
|
+
import type { ThemeService } from './services';
|
|
3
|
+
export declare const SHELL_STANDARD_ATTRIBUTE = "data-iota-shell-standard";
|
|
4
|
+
export declare const SHELL_OUTLET_ATTRIBUTE = "data-iota-shell-outlet";
|
|
5
|
+
export declare const SHELL_STANDARD_QUERY = "iota-shell";
|
|
6
|
+
export interface ShellUser {
|
|
7
|
+
name: string;
|
|
8
|
+
email: string;
|
|
9
|
+
}
|
|
10
|
+
export interface ShellRendererContext {
|
|
11
|
+
/** Mount point owned by the renderer. */
|
|
12
|
+
root: HTMLElement;
|
|
13
|
+
/**
|
|
14
|
+
* The page content element, moved here from the standard shell with its
|
|
15
|
+
* identity intact so HTMX swaps, scripts and modals keep working. The
|
|
16
|
+
* renderer places it inside its layout; it is returned on deactivation.
|
|
17
|
+
*/
|
|
18
|
+
outlet: HTMLElement;
|
|
19
|
+
navigation: ShellRegistry;
|
|
20
|
+
theme: ThemeService;
|
|
21
|
+
locale: {
|
|
22
|
+
language: string;
|
|
23
|
+
};
|
|
24
|
+
user: ShellUser | null;
|
|
25
|
+
actions: {
|
|
26
|
+
logout(): void;
|
|
27
|
+
};
|
|
28
|
+
/** Fires when the server reports changed notifications (the `notificationsChanged` page event). */
|
|
29
|
+
notifications: {
|
|
30
|
+
subscribe(listener: () => void): () => void;
|
|
31
|
+
};
|
|
32
|
+
/** Reports an asynchronous renderer failure and returns to the standard shell. */
|
|
33
|
+
fail(cause: unknown): void;
|
|
34
|
+
}
|
|
35
|
+
export interface ShellRenderer {
|
|
36
|
+
id: string;
|
|
37
|
+
mount(context: ShellRendererContext): void | (() => void);
|
|
38
|
+
}
|
|
39
|
+
export type ShellHostDiagnosticCode = 'renderer-conflict' | 'renderer-failed' | 'standard-shell-missing' | 'renderer-disabled';
|
|
40
|
+
export interface ShellHostDiagnostic {
|
|
41
|
+
code: ShellHostDiagnosticCode;
|
|
42
|
+
renderer: string;
|
|
43
|
+
message: string;
|
|
44
|
+
}
|
|
45
|
+
export interface ShellHostOptions {
|
|
46
|
+
registry: ShellRegistry;
|
|
47
|
+
theme: ThemeService;
|
|
48
|
+
user?: ShellUser | null;
|
|
49
|
+
logout?: () => void;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* ShellHost owns the single app-wide shell renderer. Activating one hides the
|
|
53
|
+
* standard shell, hands it the existing page outlet and exposes the shared
|
|
54
|
+
* navigation registry; any failure puts everything back.
|
|
55
|
+
*/
|
|
56
|
+
export declare class ShellHost {
|
|
57
|
+
private readonly owner;
|
|
58
|
+
private readonly options;
|
|
59
|
+
private current;
|
|
60
|
+
private readonly problems;
|
|
61
|
+
constructor(owner: Document, options: ShellHostOptions);
|
|
62
|
+
activeRenderer(): string | null;
|
|
63
|
+
diagnostics(): ShellHostDiagnostic[];
|
|
64
|
+
/** True when an administrator forced the standard shell with `?iota-shell=standard`. */
|
|
65
|
+
standardForced(): boolean;
|
|
66
|
+
activate(renderer: ShellRenderer): boolean;
|
|
67
|
+
deactivate(): void;
|
|
68
|
+
private fall;
|
|
69
|
+
private restore;
|
|
70
|
+
private report;
|
|
71
|
+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,CAAA;AAE9H,MAAM,WAAW,mBAAmB;IAAG,IAAI,EAAE,uBAAuB,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE;AAEzG,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,aAAa,CAAA;IACvB,KAAK,EAAE,YAAY,CAAA;IACnB,IAAI,CAAC,EAAE,SAAS,GAAG,IAAI,CAAA;IACvB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAA;CACpB;AAYD;;;;GAIG;AACH,qBAAa,SAAS;IAIR,OAAO,CAAC,QAAQ,CAAC,KAAK;IAAY,OAAO,CAAC,QAAQ,CAAC,OAAO;IAHtE,OAAO,CAAC,OAAO,CAAwB;IACvC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA4B;gBAExB,KAAK,EAAE,QAAQ,EAAmB,OAAO,EAAE,gBAAgB;IAExF,cAAc,IAAI,MAAM,GAAG,IAAI;IAE/B,WAAW,IAAI,mBAAmB,EAAE;IAEpC,wFAAwF;IACxF,cAAc,IAAI,OAAO;IAIzB,QAAQ,CAAC,QAAQ,EAAE,aAAa,GAAG,OAAO;IAmD1C,UAAU,IAAI,IAAI;IAIlB,OAAO,CAAC,IAAI;IAKZ,OAAO,CAAC,OAAO;IAYf,OAAO,CAAC,MAAM;CAIf"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
export const SHELL_STANDARD_ATTRIBUTE = 'data-iota-shell-standard';
|
|
2
|
+
export const SHELL_OUTLET_ATTRIBUTE = 'data-iota-shell-outlet';
|
|
3
|
+
export const SHELL_STANDARD_QUERY = 'iota-shell';
|
|
4
|
+
/**
|
|
5
|
+
* ShellHost owns the single app-wide shell renderer. Activating one hides the
|
|
6
|
+
* standard shell, hands it the existing page outlet and exposes the shared
|
|
7
|
+
* navigation registry; any failure puts everything back.
|
|
8
|
+
*/
|
|
9
|
+
export class ShellHost {
|
|
10
|
+
owner;
|
|
11
|
+
options;
|
|
12
|
+
current;
|
|
13
|
+
problems = [];
|
|
14
|
+
constructor(owner, options) {
|
|
15
|
+
this.owner = owner;
|
|
16
|
+
this.options = options;
|
|
17
|
+
}
|
|
18
|
+
activeRenderer() { return this.current?.renderer.id ?? null; }
|
|
19
|
+
diagnostics() { return [...this.problems]; }
|
|
20
|
+
/** True when an administrator forced the standard shell with `?iota-shell=standard`. */
|
|
21
|
+
standardForced() {
|
|
22
|
+
return this.owner.defaultView?.location.search.includes(`${SHELL_STANDARD_QUERY}=standard`) ?? false;
|
|
23
|
+
}
|
|
24
|
+
activate(renderer) {
|
|
25
|
+
if (this.standardForced()) {
|
|
26
|
+
this.report('renderer-disabled', renderer.id, `Renderer ${renderer.id} not activated; the standard shell was requested`);
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
if (this.current) {
|
|
30
|
+
this.report('renderer-conflict', renderer.id, `Renderer ${renderer.id} not activated; ${this.current.renderer.id} is already active`);
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
const standard = this.owner.querySelector(`[${SHELL_STANDARD_ATTRIBUTE}]`);
|
|
34
|
+
const outlet = this.owner.querySelector(`[${SHELL_OUTLET_ATTRIBUTE}]`);
|
|
35
|
+
if (!standard || !outlet || !outlet.parentNode) {
|
|
36
|
+
this.report('standard-shell-missing', renderer.id, 'The page has no standard shell with a content outlet');
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
const root = this.owner.createElement('div');
|
|
40
|
+
root.dataset.iotaShellRenderer = renderer.id;
|
|
41
|
+
const activation = { renderer, root, outlet, parent: outlet.parentNode, next: outlet.nextSibling, standard, cleanup: undefined };
|
|
42
|
+
this.current = activation;
|
|
43
|
+
standard.after(root);
|
|
44
|
+
standard.hidden = true;
|
|
45
|
+
standard.inert = true;
|
|
46
|
+
root.append(outlet);
|
|
47
|
+
try {
|
|
48
|
+
activation.cleanup = renderer.mount({
|
|
49
|
+
root,
|
|
50
|
+
outlet,
|
|
51
|
+
navigation: this.options.registry,
|
|
52
|
+
theme: this.options.theme,
|
|
53
|
+
locale: { language: this.owner.documentElement.lang || 'en' },
|
|
54
|
+
user: this.options.user ?? null,
|
|
55
|
+
actions: { logout: () => this.options.logout?.() },
|
|
56
|
+
notifications: {
|
|
57
|
+
subscribe: (listener) => {
|
|
58
|
+
this.owner.body.addEventListener('notificationsChanged', listener);
|
|
59
|
+
return () => this.owner.body.removeEventListener('notificationsChanged', listener);
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
fail: (cause) => { if (this.current === activation)
|
|
63
|
+
this.fall(activation, cause); },
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
catch (cause) {
|
|
67
|
+
this.fall(activation, cause);
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
if (this.current !== activation) {
|
|
71
|
+
try {
|
|
72
|
+
activation.cleanup?.();
|
|
73
|
+
}
|
|
74
|
+
catch { /* renderer failed during mount and was already rolled back */ }
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
79
|
+
deactivate() {
|
|
80
|
+
if (this.current)
|
|
81
|
+
this.restore(this.current);
|
|
82
|
+
}
|
|
83
|
+
fall(activation, cause) {
|
|
84
|
+
this.report('renderer-failed', activation.renderer.id, `Renderer ${activation.renderer.id} failed: ${cause instanceof Error ? cause.message : String(cause)}`);
|
|
85
|
+
this.restore(activation);
|
|
86
|
+
}
|
|
87
|
+
restore(activation) {
|
|
88
|
+
if (this.current !== activation)
|
|
89
|
+
return;
|
|
90
|
+
this.current = undefined;
|
|
91
|
+
try {
|
|
92
|
+
activation.cleanup?.();
|
|
93
|
+
}
|
|
94
|
+
catch (cause) {
|
|
95
|
+
this.report('renderer-failed', activation.renderer.id, `Renderer ${activation.renderer.id} cleanup failed: ${cause instanceof Error ? cause.message : String(cause)}`);
|
|
96
|
+
}
|
|
97
|
+
activation.parent.insertBefore(activation.outlet, activation.next && activation.next.parentNode === activation.parent ? activation.next : null);
|
|
98
|
+
activation.root.remove();
|
|
99
|
+
activation.standard.hidden = false;
|
|
100
|
+
activation.standard.inert = false;
|
|
101
|
+
}
|
|
102
|
+
report(code, renderer, message) {
|
|
103
|
+
this.problems.push({ code, renderer, message });
|
|
104
|
+
this.owner.defaultView?.console.warn(message);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
export type ShellRegion = 'header' | 'footer';
|
|
2
|
+
export interface ShellNavigationItem {
|
|
3
|
+
key: string;
|
|
4
|
+
title: string;
|
|
5
|
+
href?: string;
|
|
6
|
+
icon?: string;
|
|
7
|
+
parent?: string;
|
|
8
|
+
workspace?: string;
|
|
9
|
+
pinned?: boolean;
|
|
10
|
+
beta?: boolean;
|
|
11
|
+
order?: number;
|
|
12
|
+
permissions?: readonly string[];
|
|
13
|
+
}
|
|
14
|
+
export interface ShellNavigationPatch {
|
|
15
|
+
title?: string;
|
|
16
|
+
hidden?: boolean;
|
|
17
|
+
parent?: string | null;
|
|
18
|
+
workspace?: string;
|
|
19
|
+
order?: number;
|
|
20
|
+
}
|
|
21
|
+
export interface ShellNavigationNode extends Omit<ShellNavigationItem, 'parent'> {
|
|
22
|
+
children: ShellNavigationNode[];
|
|
23
|
+
}
|
|
24
|
+
export interface ShellContribution {
|
|
25
|
+
key: string;
|
|
26
|
+
region: ShellRegion;
|
|
27
|
+
order?: number;
|
|
28
|
+
mount(container: HTMLElement): void | (() => void);
|
|
29
|
+
}
|
|
30
|
+
export type ShellDiagnosticCode = 'duplicate-navigation-key' | 'duplicate-contribution-key' | 'unknown-navigation-target' | 'unknown-navigation-parent' | 'navigation-cycle' | 'navigation-patch-conflict';
|
|
31
|
+
export interface ShellDiagnostic {
|
|
32
|
+
code: ShellDiagnosticCode;
|
|
33
|
+
owner: string;
|
|
34
|
+
key: string;
|
|
35
|
+
message: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* ShellRegistry is the renderer-neutral navigation and region contribution
|
|
39
|
+
* model of the authenticated shell. Contributions are addressed by owner so a
|
|
40
|
+
* failing extension is removed in one call, and conflicts surface as
|
|
41
|
+
* diagnostics instead of silently overriding another owner.
|
|
42
|
+
*/
|
|
43
|
+
export declare class ShellRegistry {
|
|
44
|
+
static readonly BASE_OWNER = "sdk";
|
|
45
|
+
private seq;
|
|
46
|
+
private readonly items;
|
|
47
|
+
private readonly patches;
|
|
48
|
+
private readonly contributionList;
|
|
49
|
+
private readonly listeners;
|
|
50
|
+
constructor(base?: readonly ShellNavigationItem[]);
|
|
51
|
+
addNavigation(owner: string, items: readonly ShellNavigationItem[]): () => void;
|
|
52
|
+
patchNavigation(owner: string, key: string, patch: ShellNavigationPatch): () => void;
|
|
53
|
+
contribute(owner: string, contribution: ShellContribution): () => void;
|
|
54
|
+
disposeOwner(owner: string): void;
|
|
55
|
+
subscribe(listener: () => void): () => void;
|
|
56
|
+
navigation(): ShellNavigationNode[];
|
|
57
|
+
diagnostics(): ShellDiagnostic[];
|
|
58
|
+
contributions(region: ShellRegion): ShellContribution[];
|
|
59
|
+
/** Mounts the region's contributions and keeps them in sync until disposed. */
|
|
60
|
+
mountRegion(region: ShellRegion, element: HTMLElement): () => void;
|
|
61
|
+
private cleanup;
|
|
62
|
+
private activeContributions;
|
|
63
|
+
private contributionDiagnostics;
|
|
64
|
+
private resolve;
|
|
65
|
+
private remove;
|
|
66
|
+
private changed;
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=shell-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shell-registry.d.ts","sourceRoot":"","sources":["../src/shell-registry.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,QAAQ,CAAA;AAE7C,MAAM,WAAW,mBAAmB;IAClC,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAA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