@ethisyscore/plugin-ui 1.53.0 → 1.54.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/index.cjs +28 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +28 -4
- package/dist/index.js.map +1 -1
- package/dist/platform-react/index.cjs +79 -5
- package/dist/platform-react/index.cjs.map +1 -1
- package/dist/platform-react/index.d.cts +60 -4
- package/dist/platform-react/index.d.ts +60 -4
- package/dist/platform-react/index.js +78 -6
- package/dist/platform-react/index.js.map +1 -1
- package/dist/{useHostSidebarActions-CyNYWKiv.d.cts → useHostSidebarActions-Bt2U-EuA.d.cts} +31 -3
- package/dist/{useHostSidebarActions-CyNYWKiv.d.ts → useHostSidebarActions-Bt2U-EuA.d.ts} +31 -3
- package/package.json +1 -1
|
@@ -5,9 +5,9 @@ import { QueryClient, UseQueryResult, UseQueryOptions, QueryKey } from '@tanstac
|
|
|
5
5
|
import { PlatformReactPageProps } from '@ethisyscore/components-react';
|
|
6
6
|
import * as _tanstack_query_core from '@tanstack/query-core';
|
|
7
7
|
import { McpTransport, UploadDocumentResult } from '@ethisyscore/extension-runtime/plugin';
|
|
8
|
-
import { k as HostSidebarInput } from '../useHostSidebarActions-
|
|
9
|
-
export { H as HOST_CHROME_CONTRACT_VERSION, a as HostChromeDiagnostic, b as HostSidebarAction, c as HostSidebarActionDescriptor, d as HostSidebarActionSlot, e as HostSidebarActionVariant, f as HostSidebarActionsApi, g as HostSidebarActionsCapabilities, h as HostSidebarActionsContext, i as HostSidebarActionsPageProps, j as HostSidebarContribution, l as HostSidebarNavItem, S as SIDEBAR_MODE, m as isHostChromeCompatible, r as reportHostChromeDiagnostic, s as setHostChromeDiagnosticSink, u as useHostSidebarActions } from '../useHostSidebarActions-
|
|
10
|
-
import { g as PluginDetailContext } from '../pageHeaderTypes-PWZpiwp6.cjs';
|
|
8
|
+
import { k as HostSidebarInput, n as HostSidebarHookInput } from '../useHostSidebarActions-Bt2U-EuA.cjs';
|
|
9
|
+
export { H as HOST_CHROME_CONTRACT_VERSION, a as HostChromeDiagnostic, b as HostSidebarAction, c as HostSidebarActionDescriptor, d as HostSidebarActionSlot, e as HostSidebarActionVariant, f as HostSidebarActionsApi, g as HostSidebarActionsCapabilities, h as HostSidebarActionsContext, i as HostSidebarActionsPageProps, j as HostSidebarContribution, o as HostSidebarDerivedInput, l as HostSidebarNavItem, S as SIDEBAR_MODE, m as isHostChromeCompatible, r as reportHostChromeDiagnostic, s as setHostChromeDiagnosticSink, u as useHostSidebarActions } from '../useHostSidebarActions-Bt2U-EuA.cjs';
|
|
10
|
+
import { g as PluginDetailContext, H as HeaderMenuItem } from '../pageHeaderTypes-PWZpiwp6.cjs';
|
|
11
11
|
|
|
12
12
|
/** A view component resolved from the template manifest. Props are open. */
|
|
13
13
|
type ViewComponent = ComponentType<Record<string, unknown>>;
|
|
@@ -1050,6 +1050,16 @@ declare function resolveSurfaceBase(input: {
|
|
|
1050
1050
|
base: string;
|
|
1051
1051
|
groupRoot: string;
|
|
1052
1052
|
} | null;
|
|
1053
|
+
/**
|
|
1054
|
+
* Mirror of the HOST mount's `deriveEntityToken` (PlatformReactSurfaceMount): the
|
|
1055
|
+
* route sub-path relative to the PAGE-surface `basePath` — which is the page
|
|
1056
|
+
* route's STATIC leading segments, so a fully-static page (list routes) yields
|
|
1057
|
+
* `"/"` because there the pathname IS the basePath. The host silently drops a
|
|
1058
|
+
* publish whose `entityToken` doesn't match its own derivation, so this must stay
|
|
1059
|
+
* bit-identical to the host helper. No basePath (legacy host) falls back to the
|
|
1060
|
+
* full pathname, exactly like the host does.
|
|
1061
|
+
*/
|
|
1062
|
+
declare function deriveHostEntityToken(pathname: string, basePath: string | undefined): string;
|
|
1053
1063
|
/** Join base + sub (leading slash stripped) + optional ?query/#hash suffix. */
|
|
1054
1064
|
declare function buildSurfaceUrl(base: string, sub?: string, suffix?: string): string;
|
|
1055
1065
|
/**
|
|
@@ -1114,4 +1124,50 @@ interface ToHostSidebarInputOptions {
|
|
|
1114
1124
|
*/
|
|
1115
1125
|
declare function toHostSidebarInput(context: PluginDetailContext | null | undefined, opts: ToHostSidebarInputOptions): HostSidebarInput;
|
|
1116
1126
|
|
|
1117
|
-
|
|
1127
|
+
/**
|
|
1128
|
+
* Options for {@link menuConfigToHostSidebarInput}.
|
|
1129
|
+
*/
|
|
1130
|
+
interface MenuConfigHostSidebarOptions {
|
|
1131
|
+
/** The CURRENT pathname (full host path, e.g. `/extensions/projects/roles`). */
|
|
1132
|
+
pathname: string;
|
|
1133
|
+
/**
|
|
1134
|
+
* Dispatch bridge for `actionId` actions — pass the plugin's
|
|
1135
|
+
* `useTriggerSidebarAction()` (from `@ethisyscore/plugin-ui/components/layout`)
|
|
1136
|
+
* so a sidebar click reaches the same `useSidebarActions` handler the header
|
|
1137
|
+
* uses. (A parameter rather than an internal hook call: the sidebar-action
|
|
1138
|
+
* context must come from the SAME `components/layout` module instance the
|
|
1139
|
+
* plugin's provider uses — the cross-entry singleton pitfall.)
|
|
1140
|
+
*/
|
|
1141
|
+
onDispatch: (actionId: string) => void;
|
|
1142
|
+
/**
|
|
1143
|
+
* The plugin's mount base (e.g. `/extensions/projects`), stripped from action
|
|
1144
|
+
* hrefs to make them slug-relative for the host confiner. Defaults to the
|
|
1145
|
+
* `/extensions/<slug>` prefix of `pathname`.
|
|
1146
|
+
*/
|
|
1147
|
+
mountBase?: string;
|
|
1148
|
+
}
|
|
1149
|
+
/**
|
|
1150
|
+
* Map the ACTIVE menu item's `actions` to a `useHostSidebarActions` input — the
|
|
1151
|
+
* runtime analogue of the monolith shell surfacing the active `menuConfig` item's
|
|
1152
|
+
* actions as the sidebar "Quick actions" section. Detail routes are covered by
|
|
1153
|
+
* `toHostSidebarInput` over a `*DetailContext`; THIS covers the menu-item (list)
|
|
1154
|
+
* routes, which otherwise contribute nothing and render an empty Quick Actions
|
|
1155
|
+
* panel (static manifest `NavigationActionItem`s can only navigate — they cannot
|
|
1156
|
+
* cover dialog/`actionId` CTAs at all).
|
|
1157
|
+
*
|
|
1158
|
+
* Typical bridge shape:
|
|
1159
|
+
* ```ts
|
|
1160
|
+
* const input = detailCtx
|
|
1161
|
+
* ? toHostSidebarInput(detailCtx, { basePath, entityToken, onDispatch })
|
|
1162
|
+
* : menuConfigToHostSidebarInput(menuConfig, { pathname, onDispatch });
|
|
1163
|
+
* useHostSidebarActions(input);
|
|
1164
|
+
* ```
|
|
1165
|
+
*
|
|
1166
|
+
* The result carries NO `entityToken` — `useHostSidebarActions` derives the
|
|
1167
|
+
* host-mirrored token from the surface base, which is correct by construction.
|
|
1168
|
+
* Routes without a matching menu item (or with no mappable actions) yield
|
|
1169
|
+
* `{mode:"none"}`, preserving the static-manifest fallback.
|
|
1170
|
+
*/
|
|
1171
|
+
declare function menuConfigToHostSidebarInput(config: HeaderMenuItem[], opts: MenuConfigHostSidebarOptions): HostSidebarHookInput;
|
|
1172
|
+
|
|
1173
|
+
export { type AuthenticatedQueryResult, BaseMcpService, DEFAULT_MAX_UPLOAD_BYTES, type DefinePlatformReactPluginOverlayOptions, type DefinePlatformReactPluginPageOptions, EHX_PLUGIN_ROOT_CLASS, HostSidebarHookInput, HostSidebarInput, type InsetLease, type ManagedLifecycle, type MenuConfigHostSidebarOptions, MissingViewFallback, OVERLAY_HOST_CONTRACT_VERSION, type OverlayHostApi, type OverlayHostCapabilities, OverlayHostContext, type PlatformReactOverlayProps, type PluginOverlayDefinerConfig, type PluginPageDefinerConfig, PluginStyleScope, type ReactRouterShimOptions, SurfaceBaseContext, type SurfaceBaseValue, TemplateContext, type TemplateManifest, type ToHostSidebarInputOptions, type ToolInvoker, type UseMcpUploadOptions, type UseMcpUploadResult, type UseMcpUploadTarget, type ViewComponent, buildSurfaceUrl, createPluginOverlayDefiner, createPluginPageDefiner, createReactRouterShim, createUseView, definePlatformReactPluginOverlay, definePlatformReactPluginPage, deriveHostEntityToken, injectPluginStyles, isComponent, menuConfigToHostSidebarInput, normaliseSlug, notViaMcp, resolveSurfaceBase, surfacePathFor, toHostSidebarInput, useAuthenticatedQueries, useAuthenticatedQuery, useManagedLifecycle, useMcpUpload, useOverlayHost, usePluginRealtime, useSurfaceUrl, useToolInvoker, useToolInvokerMap, useView };
|
|
@@ -5,9 +5,9 @@ import { QueryClient, UseQueryResult, UseQueryOptions, QueryKey } from '@tanstac
|
|
|
5
5
|
import { PlatformReactPageProps } from '@ethisyscore/components-react';
|
|
6
6
|
import * as _tanstack_query_core from '@tanstack/query-core';
|
|
7
7
|
import { McpTransport, UploadDocumentResult } from '@ethisyscore/extension-runtime/plugin';
|
|
8
|
-
import { k as HostSidebarInput } from '../useHostSidebarActions-
|
|
9
|
-
export { H as HOST_CHROME_CONTRACT_VERSION, a as HostChromeDiagnostic, b as HostSidebarAction, c as HostSidebarActionDescriptor, d as HostSidebarActionSlot, e as HostSidebarActionVariant, f as HostSidebarActionsApi, g as HostSidebarActionsCapabilities, h as HostSidebarActionsContext, i as HostSidebarActionsPageProps, j as HostSidebarContribution, l as HostSidebarNavItem, S as SIDEBAR_MODE, m as isHostChromeCompatible, r as reportHostChromeDiagnostic, s as setHostChromeDiagnosticSink, u as useHostSidebarActions } from '../useHostSidebarActions-
|
|
10
|
-
import { g as PluginDetailContext } from '../pageHeaderTypes-PWZpiwp6.js';
|
|
8
|
+
import { k as HostSidebarInput, n as HostSidebarHookInput } from '../useHostSidebarActions-Bt2U-EuA.js';
|
|
9
|
+
export { H as HOST_CHROME_CONTRACT_VERSION, a as HostChromeDiagnostic, b as HostSidebarAction, c as HostSidebarActionDescriptor, d as HostSidebarActionSlot, e as HostSidebarActionVariant, f as HostSidebarActionsApi, g as HostSidebarActionsCapabilities, h as HostSidebarActionsContext, i as HostSidebarActionsPageProps, j as HostSidebarContribution, o as HostSidebarDerivedInput, l as HostSidebarNavItem, S as SIDEBAR_MODE, m as isHostChromeCompatible, r as reportHostChromeDiagnostic, s as setHostChromeDiagnosticSink, u as useHostSidebarActions } from '../useHostSidebarActions-Bt2U-EuA.js';
|
|
10
|
+
import { g as PluginDetailContext, H as HeaderMenuItem } from '../pageHeaderTypes-PWZpiwp6.js';
|
|
11
11
|
|
|
12
12
|
/** A view component resolved from the template manifest. Props are open. */
|
|
13
13
|
type ViewComponent = ComponentType<Record<string, unknown>>;
|
|
@@ -1050,6 +1050,16 @@ declare function resolveSurfaceBase(input: {
|
|
|
1050
1050
|
base: string;
|
|
1051
1051
|
groupRoot: string;
|
|
1052
1052
|
} | null;
|
|
1053
|
+
/**
|
|
1054
|
+
* Mirror of the HOST mount's `deriveEntityToken` (PlatformReactSurfaceMount): the
|
|
1055
|
+
* route sub-path relative to the PAGE-surface `basePath` — which is the page
|
|
1056
|
+
* route's STATIC leading segments, so a fully-static page (list routes) yields
|
|
1057
|
+
* `"/"` because there the pathname IS the basePath. The host silently drops a
|
|
1058
|
+
* publish whose `entityToken` doesn't match its own derivation, so this must stay
|
|
1059
|
+
* bit-identical to the host helper. No basePath (legacy host) falls back to the
|
|
1060
|
+
* full pathname, exactly like the host does.
|
|
1061
|
+
*/
|
|
1062
|
+
declare function deriveHostEntityToken(pathname: string, basePath: string | undefined): string;
|
|
1053
1063
|
/** Join base + sub (leading slash stripped) + optional ?query/#hash suffix. */
|
|
1054
1064
|
declare function buildSurfaceUrl(base: string, sub?: string, suffix?: string): string;
|
|
1055
1065
|
/**
|
|
@@ -1114,4 +1124,50 @@ interface ToHostSidebarInputOptions {
|
|
|
1114
1124
|
*/
|
|
1115
1125
|
declare function toHostSidebarInput(context: PluginDetailContext | null | undefined, opts: ToHostSidebarInputOptions): HostSidebarInput;
|
|
1116
1126
|
|
|
1117
|
-
|
|
1127
|
+
/**
|
|
1128
|
+
* Options for {@link menuConfigToHostSidebarInput}.
|
|
1129
|
+
*/
|
|
1130
|
+
interface MenuConfigHostSidebarOptions {
|
|
1131
|
+
/** The CURRENT pathname (full host path, e.g. `/extensions/projects/roles`). */
|
|
1132
|
+
pathname: string;
|
|
1133
|
+
/**
|
|
1134
|
+
* Dispatch bridge for `actionId` actions — pass the plugin's
|
|
1135
|
+
* `useTriggerSidebarAction()` (from `@ethisyscore/plugin-ui/components/layout`)
|
|
1136
|
+
* so a sidebar click reaches the same `useSidebarActions` handler the header
|
|
1137
|
+
* uses. (A parameter rather than an internal hook call: the sidebar-action
|
|
1138
|
+
* context must come from the SAME `components/layout` module instance the
|
|
1139
|
+
* plugin's provider uses — the cross-entry singleton pitfall.)
|
|
1140
|
+
*/
|
|
1141
|
+
onDispatch: (actionId: string) => void;
|
|
1142
|
+
/**
|
|
1143
|
+
* The plugin's mount base (e.g. `/extensions/projects`), stripped from action
|
|
1144
|
+
* hrefs to make them slug-relative for the host confiner. Defaults to the
|
|
1145
|
+
* `/extensions/<slug>` prefix of `pathname`.
|
|
1146
|
+
*/
|
|
1147
|
+
mountBase?: string;
|
|
1148
|
+
}
|
|
1149
|
+
/**
|
|
1150
|
+
* Map the ACTIVE menu item's `actions` to a `useHostSidebarActions` input — the
|
|
1151
|
+
* runtime analogue of the monolith shell surfacing the active `menuConfig` item's
|
|
1152
|
+
* actions as the sidebar "Quick actions" section. Detail routes are covered by
|
|
1153
|
+
* `toHostSidebarInput` over a `*DetailContext`; THIS covers the menu-item (list)
|
|
1154
|
+
* routes, which otherwise contribute nothing and render an empty Quick Actions
|
|
1155
|
+
* panel (static manifest `NavigationActionItem`s can only navigate — they cannot
|
|
1156
|
+
* cover dialog/`actionId` CTAs at all).
|
|
1157
|
+
*
|
|
1158
|
+
* Typical bridge shape:
|
|
1159
|
+
* ```ts
|
|
1160
|
+
* const input = detailCtx
|
|
1161
|
+
* ? toHostSidebarInput(detailCtx, { basePath, entityToken, onDispatch })
|
|
1162
|
+
* : menuConfigToHostSidebarInput(menuConfig, { pathname, onDispatch });
|
|
1163
|
+
* useHostSidebarActions(input);
|
|
1164
|
+
* ```
|
|
1165
|
+
*
|
|
1166
|
+
* The result carries NO `entityToken` — `useHostSidebarActions` derives the
|
|
1167
|
+
* host-mirrored token from the surface base, which is correct by construction.
|
|
1168
|
+
* Routes without a matching menu item (or with no mappable actions) yield
|
|
1169
|
+
* `{mode:"none"}`, preserving the static-manifest fallback.
|
|
1170
|
+
*/
|
|
1171
|
+
declare function menuConfigToHostSidebarInput(config: HeaderMenuItem[], opts: MenuConfigHostSidebarOptions): HostSidebarHookInput;
|
|
1172
|
+
|
|
1173
|
+
export { type AuthenticatedQueryResult, BaseMcpService, DEFAULT_MAX_UPLOAD_BYTES, type DefinePlatformReactPluginOverlayOptions, type DefinePlatformReactPluginPageOptions, EHX_PLUGIN_ROOT_CLASS, HostSidebarHookInput, HostSidebarInput, type InsetLease, type ManagedLifecycle, type MenuConfigHostSidebarOptions, MissingViewFallback, OVERLAY_HOST_CONTRACT_VERSION, type OverlayHostApi, type OverlayHostCapabilities, OverlayHostContext, type PlatformReactOverlayProps, type PluginOverlayDefinerConfig, type PluginPageDefinerConfig, PluginStyleScope, type ReactRouterShimOptions, SurfaceBaseContext, type SurfaceBaseValue, TemplateContext, type TemplateManifest, type ToHostSidebarInputOptions, type ToolInvoker, type UseMcpUploadOptions, type UseMcpUploadResult, type UseMcpUploadTarget, type ViewComponent, buildSurfaceUrl, createPluginOverlayDefiner, createPluginPageDefiner, createReactRouterShim, createUseView, definePlatformReactPluginOverlay, definePlatformReactPluginPage, deriveHostEntityToken, injectPluginStyles, isComponent, menuConfigToHostSidebarInput, normaliseSlug, notViaMcp, resolveSurfaceBase, surfacePathFor, toHostSidebarInput, useAuthenticatedQueries, useAuthenticatedQuery, useManagedLifecycle, useMcpUpload, useOverlayHost, usePluginRealtime, useSurfaceUrl, useToolInvoker, useToolInvokerMap, useView };
|
|
@@ -41,6 +41,19 @@ function resolveSurfaceBase(input) {
|
|
|
41
41
|
}
|
|
42
42
|
return null;
|
|
43
43
|
}
|
|
44
|
+
function deriveHostEntityToken(pathname, basePath) {
|
|
45
|
+
if (!basePath) {
|
|
46
|
+
return pathname;
|
|
47
|
+
}
|
|
48
|
+
const base = stripTrailingSlash(basePath);
|
|
49
|
+
if (pathname === base) {
|
|
50
|
+
return "/";
|
|
51
|
+
}
|
|
52
|
+
if (pathname.startsWith(`${base}/`)) {
|
|
53
|
+
return pathname.slice(base.length);
|
|
54
|
+
}
|
|
55
|
+
return pathname;
|
|
56
|
+
}
|
|
44
57
|
function buildSurfaceUrl(base, sub = "", suffix = "") {
|
|
45
58
|
const b = stripTrailingSlash(base);
|
|
46
59
|
const s = sub.replace(/^\/+/, "");
|
|
@@ -649,9 +662,17 @@ function reportNoHost(pageId) {
|
|
|
649
662
|
}
|
|
650
663
|
function useHostSidebarActions(input) {
|
|
651
664
|
const api = useContext(HostSidebarActionsContext);
|
|
652
|
-
const
|
|
665
|
+
const surfaceBase = useContext(SurfaceBaseContext);
|
|
666
|
+
const pageId = surfaceBase?.pageId;
|
|
653
667
|
const compatible = api && isHostChromeCompatible(api.capabilities?.contractVersion) ? api : null;
|
|
654
|
-
const
|
|
668
|
+
const resolved = input.mode === SIDEBAR_MODE.none ? input : typeof input.entityToken === "string" ? input : "entityToken" in input ? { mode: SIDEBAR_MODE.none } : {
|
|
669
|
+
...input,
|
|
670
|
+
entityToken: deriveHostEntityToken(
|
|
671
|
+
typeof window !== "undefined" ? window.location.pathname : "",
|
|
672
|
+
surfaceBase?.basePath
|
|
673
|
+
)
|
|
674
|
+
};
|
|
675
|
+
const actions = resolved.mode === SIDEBAR_MODE.none ? [] : resolved.actions;
|
|
655
676
|
const handlers = useRef(/* @__PURE__ */ new Map());
|
|
656
677
|
handlers.current = new Map(collectDispatchHandlers(actions));
|
|
657
678
|
useEffect(() => {
|
|
@@ -667,10 +688,10 @@ function useHostSidebarActions(input) {
|
|
|
667
688
|
unsub();
|
|
668
689
|
};
|
|
669
690
|
}, [compatible, pageId]);
|
|
670
|
-
const key = contributionKey(
|
|
691
|
+
const key = contributionKey(resolved);
|
|
671
692
|
useEffect(() => {
|
|
672
693
|
if (!compatible) return;
|
|
673
|
-
compatible.publish(toContribution(
|
|
694
|
+
compatible.publish(toContribution(resolved));
|
|
674
695
|
}, [compatible, key]);
|
|
675
696
|
}
|
|
676
697
|
|
|
@@ -701,7 +722,7 @@ function slugRelative(href, basePath) {
|
|
|
701
722
|
return href.startsWith(prefix) ? href.slice(prefix.length) : href;
|
|
702
723
|
}
|
|
703
724
|
function isConfinable(slugRelativeHref) {
|
|
704
|
-
return slugRelativeHref.length > 0 && !slugRelativeHref.startsWith("/") && !/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(slugRelativeHref) && !slugRelativeHref.includes("#");
|
|
725
|
+
return slugRelativeHref.length > 0 && !slugRelativeHref.startsWith("/") && !/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(slugRelativeHref) && !slugRelativeHref.includes("#") && !slugRelativeHref.split("?")[0].split("/").some((seg) => seg === "." || seg === "..");
|
|
705
726
|
}
|
|
706
727
|
function toHostActions(actions, opts) {
|
|
707
728
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -748,6 +769,57 @@ function toHostAction(item, opts, seen) {
|
|
|
748
769
|
return null;
|
|
749
770
|
}
|
|
750
771
|
|
|
751
|
-
|
|
772
|
+
// src/platform-react/menuConfigHostSidebar.ts
|
|
773
|
+
function normalise(pathname) {
|
|
774
|
+
return pathname.length > 1 && pathname.endsWith("/") ? pathname.slice(0, -1) : pathname;
|
|
775
|
+
}
|
|
776
|
+
function findByHref(items, pathname) {
|
|
777
|
+
for (const item of items) {
|
|
778
|
+
if (item.href != null && normalise(item.href) === pathname) {
|
|
779
|
+
return item;
|
|
780
|
+
}
|
|
781
|
+
if (item.children) {
|
|
782
|
+
const nested = findByHref(item.children, pathname);
|
|
783
|
+
if (nested) {
|
|
784
|
+
return nested;
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
return null;
|
|
789
|
+
}
|
|
790
|
+
function toItem(a) {
|
|
791
|
+
return {
|
|
792
|
+
id: a.id,
|
|
793
|
+
label: a.label,
|
|
794
|
+
icon: a.icon,
|
|
795
|
+
href: a.href,
|
|
796
|
+
actionId: a.actionId,
|
|
797
|
+
onClick: a.onClick,
|
|
798
|
+
variant: a.variant === "danger" ? "danger" : void 0,
|
|
799
|
+
slot: a.slot,
|
|
800
|
+
disabled: a.disabled,
|
|
801
|
+
children: a.children?.map(toItem)
|
|
802
|
+
};
|
|
803
|
+
}
|
|
804
|
+
function menuConfigToHostSidebarInput(config, opts) {
|
|
805
|
+
const item = findByHref(config, normalise(opts.pathname));
|
|
806
|
+
if (!item?.actions?.length) {
|
|
807
|
+
return { mode: "none" };
|
|
808
|
+
}
|
|
809
|
+
const mountBase = opts.mountBase ?? /^\/extensions\/[^/]+/.exec(opts.pathname)?.[0];
|
|
810
|
+
if (!mountBase) {
|
|
811
|
+
return { mode: "none" };
|
|
812
|
+
}
|
|
813
|
+
const actions = toHostActions(item.actions.map(toItem), {
|
|
814
|
+
basePath: mountBase,
|
|
815
|
+
onDispatch: opts.onDispatch
|
|
816
|
+
});
|
|
817
|
+
if (actions.length === 0) {
|
|
818
|
+
return { mode: "none" };
|
|
819
|
+
}
|
|
820
|
+
return { mode: "actions", actions };
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
export { BaseMcpService, DEFAULT_MAX_UPLOAD_BYTES, EHX_PLUGIN_ROOT_CLASS, HOST_CHROME_CONTRACT_VERSION, HostSidebarActionsContext, MissingViewFallback, OVERLAY_HOST_CONTRACT_VERSION, OverlayHostContext, PluginStyleScope, SIDEBAR_MODE, SurfaceBaseContext, TemplateContext, buildSurfaceUrl, createPluginOverlayDefiner, createPluginPageDefiner, createReactRouterShim, createUseView, definePlatformReactPluginOverlay, definePlatformReactPluginPage, deriveHostEntityToken, injectPluginStyles, isComponent, isHostChromeCompatible, menuConfigToHostSidebarInput, normaliseSlug, notViaMcp, reportHostChromeDiagnostic, resolveSurfaceBase, setHostChromeDiagnosticSink, surfacePathFor, toHostSidebarInput, useAuthenticatedQueries, useAuthenticatedQuery, useHostSidebarActions, useManagedLifecycle, useMcpUpload, useOverlayHost, usePluginRealtime, useSurfaceUrl, useToolInvoker, useToolInvokerMap, useView };
|
|
752
824
|
//# sourceMappingURL=index.js.map
|
|
753
825
|
//# sourceMappingURL=index.js.map
|