@ethisyscore/plugin-ui 1.99.0 → 1.100.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/{useHostSidebarActions-Bt2U-EuA.d.ts → activeNavHref-BkBjanre.d.cts} +95 -14
- package/dist/{useHostSidebarActions-Bt2U-EuA.d.cts → activeNavHref-cA3_ywRa.d.ts} +95 -14
- package/dist/components/layout/index.cjs.map +1 -1
- package/dist/components/layout/index.js.map +1 -1
- package/dist/index.cjs +94 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +93 -9
- package/dist/index.js.map +1 -1
- package/dist/platform-react/index.cjs +94 -8
- package/dist/platform-react/index.cjs.map +1 -1
- package/dist/platform-react/index.d.cts +2 -2
- package/dist/platform-react/index.d.ts +2 -2
- package/dist/platform-react/index.js +93 -9
- package/dist/platform-react/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -7,8 +7,8 @@ import { T as ToolInvoker } from '../mcpService-4h3sKDpW.cjs';
|
|
|
7
7
|
export { B as BaseMcpService, n as notViaMcp, u as useToolInvoker, a as useToolInvokerMap } from '../mcpService-4h3sKDpW.cjs';
|
|
8
8
|
import * as _tanstack_query_core from '@tanstack/query-core';
|
|
9
9
|
import { McpTransport, UploadDocumentResult } from '@ethisyscore/extension-runtime/plugin';
|
|
10
|
-
import {
|
|
11
|
-
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,
|
|
10
|
+
import { l as HostSidebarInput, p as HostSidebarHookInput } from '../activeNavHref-BkBjanre.cjs';
|
|
11
|
+
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 HostSidebarActiveNav, k as HostSidebarContribution, q as HostSidebarDerivedInput, m as HostSidebarNavItem, R as ResolveActiveNavHrefOptions, S as SIDEBAR_MODE, n as isHostChromeCompatible, r as reportHostChromeDiagnostic, o as resolveActiveNavHref, s as setHostChromeDiagnosticSink, u as useHostSidebarActions, w as withActiveNavHref } from '../activeNavHref-BkBjanre.cjs';
|
|
12
12
|
import { g as PluginDetailContext, H as HeaderMenuItem } from '../pageHeaderTypes-PWZpiwp6.cjs';
|
|
13
13
|
|
|
14
14
|
/** A view component resolved from the template manifest. Props are open. */
|
|
@@ -7,8 +7,8 @@ import { T as ToolInvoker } from '../mcpService-4h3sKDpW.js';
|
|
|
7
7
|
export { B as BaseMcpService, n as notViaMcp, u as useToolInvoker, a as useToolInvokerMap } from '../mcpService-4h3sKDpW.js';
|
|
8
8
|
import * as _tanstack_query_core from '@tanstack/query-core';
|
|
9
9
|
import { McpTransport, UploadDocumentResult } from '@ethisyscore/extension-runtime/plugin';
|
|
10
|
-
import {
|
|
11
|
-
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,
|
|
10
|
+
import { l as HostSidebarInput, p as HostSidebarHookInput } from '../activeNavHref-cA3_ywRa.js';
|
|
11
|
+
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 HostSidebarActiveNav, k as HostSidebarContribution, q as HostSidebarDerivedInput, m as HostSidebarNavItem, R as ResolveActiveNavHrefOptions, S as SIDEBAR_MODE, n as isHostChromeCompatible, r as reportHostChromeDiagnostic, o as resolveActiveNavHref, s as setHostChromeDiagnosticSink, u as useHostSidebarActions, w as withActiveNavHref } from '../activeNavHref-cA3_ywRa.js';
|
|
12
12
|
import { g as PluginDetailContext, H as HeaderMenuItem } from '../pageHeaderTypes-PWZpiwp6.js';
|
|
13
13
|
|
|
14
14
|
/** A view component resolved from the template manifest. Props are open. */
|
|
@@ -90,7 +90,7 @@ function surfacePathFor(opts) {
|
|
|
90
90
|
}
|
|
91
91
|
var CONTEXT_KEY = /* @__PURE__ */ Symbol.for("ethisyscore.plugin-ui.hostSidebarActionsContext");
|
|
92
92
|
var SINK_KEY = /* @__PURE__ */ Symbol.for("ethisyscore.plugin-ui.hostChromeDiagnosticSink");
|
|
93
|
-
var HOST_CHROME_CONTRACT_VERSION = "2.
|
|
93
|
+
var HOST_CHROME_CONTRACT_VERSION = "2.2.0";
|
|
94
94
|
var _g = globalThis;
|
|
95
95
|
var HostSidebarActionsContext = _g[CONTEXT_KEY] ?? (_g[CONTEXT_KEY] = createContext(null));
|
|
96
96
|
var _gs = globalThis;
|
|
@@ -843,14 +843,16 @@ function collectDispatchHandlers(actions) {
|
|
|
843
843
|
);
|
|
844
844
|
}
|
|
845
845
|
function toContribution(input) {
|
|
846
|
+
const activeNav = input.activeNavHref ? { activeNavHref: input.activeNavHref } : {};
|
|
846
847
|
if (input.mode === SIDEBAR_MODE.none) {
|
|
847
|
-
return { mode: SIDEBAR_MODE.none };
|
|
848
|
+
return { mode: SIDEBAR_MODE.none, ...activeNav };
|
|
848
849
|
}
|
|
849
850
|
if (input.mode === SIDEBAR_MODE.actions) {
|
|
850
851
|
return {
|
|
851
852
|
mode: SIDEBAR_MODE.actions,
|
|
852
853
|
entityToken: input.entityToken,
|
|
853
|
-
actions: input.actions.map(toDescriptor)
|
|
854
|
+
actions: input.actions.map(toDescriptor),
|
|
855
|
+
...activeNav
|
|
854
856
|
};
|
|
855
857
|
}
|
|
856
858
|
return {
|
|
@@ -861,12 +863,14 @@ function toContribution(input) {
|
|
|
861
863
|
navItems: input.navItems,
|
|
862
864
|
backHref: input.backHref,
|
|
863
865
|
backLabel: input.backLabel,
|
|
864
|
-
actions: input.actions.map(toDescriptor)
|
|
866
|
+
actions: input.actions.map(toDescriptor),
|
|
867
|
+
...activeNav
|
|
865
868
|
};
|
|
866
869
|
}
|
|
867
870
|
function contributionKey(input) {
|
|
871
|
+
const activeNav = input.activeNavHref ?? "";
|
|
868
872
|
if (input.mode === SIDEBAR_MODE.none) {
|
|
869
|
-
return JSON.stringify([SIDEBAR_MODE.none]);
|
|
873
|
+
return JSON.stringify([SIDEBAR_MODE.none, activeNav]);
|
|
870
874
|
}
|
|
871
875
|
const actionTuple = (a) => [
|
|
872
876
|
a.id,
|
|
@@ -884,7 +888,7 @@ function contributionKey(input) {
|
|
|
884
888
|
];
|
|
885
889
|
const actionTuples = input.actions.map(actionTuple);
|
|
886
890
|
if (input.mode === SIDEBAR_MODE.actions) {
|
|
887
|
-
return JSON.stringify([SIDEBAR_MODE.actions, input.entityToken, actionTuples]);
|
|
891
|
+
return JSON.stringify([SIDEBAR_MODE.actions, input.entityToken, actionTuples, activeNav]);
|
|
888
892
|
}
|
|
889
893
|
const navTuples = input.navItems.map((n) => [n.id, n.label, n.icon ?? "", n.href]);
|
|
890
894
|
return JSON.stringify([
|
|
@@ -895,7 +899,8 @@ function contributionKey(input) {
|
|
|
895
899
|
input.backHref,
|
|
896
900
|
input.backLabel,
|
|
897
901
|
navTuples,
|
|
898
|
-
actionTuples
|
|
902
|
+
actionTuples,
|
|
903
|
+
activeNav
|
|
899
904
|
]);
|
|
900
905
|
}
|
|
901
906
|
var devWarnedPages = /* @__PURE__ */ new Set();
|
|
@@ -914,7 +919,13 @@ function useHostSidebarActions(input) {
|
|
|
914
919
|
const surfaceBase = useContext(SurfaceBaseContext);
|
|
915
920
|
const pageId = surfaceBase?.pageId;
|
|
916
921
|
const compatible = api && isHostChromeCompatible(api.capabilities?.contractVersion) ? api : null;
|
|
917
|
-
const resolved = input.mode === SIDEBAR_MODE.none ? input : typeof input.entityToken === "string" ? input : "entityToken" in input ?
|
|
922
|
+
const resolved = input.mode === SIDEBAR_MODE.none ? input : typeof input.entityToken === "string" ? input : "entityToken" in input ? (
|
|
923
|
+
// An unresolved entity token suppresses the CONTRIBUTION, not the page's identity:
|
|
924
|
+
// the sidebar entry the page belongs to is known before its entity has loaded, so the
|
|
925
|
+
// declaration (when there is one) is carried through rather than dropped, and the
|
|
926
|
+
// section stays lit while the detail data is in flight.
|
|
927
|
+
{ mode: SIDEBAR_MODE.none, ...input.activeNavHref ? { activeNavHref: input.activeNavHref } : {} }
|
|
928
|
+
) : {
|
|
918
929
|
...input,
|
|
919
930
|
entityToken: deriveHostEntityToken(
|
|
920
931
|
typeof window !== "undefined" ? window.location.pathname : "",
|
|
@@ -1069,6 +1080,79 @@ function menuConfigToHostSidebarInput(config, opts) {
|
|
|
1069
1080
|
return { mode: "actions", actions };
|
|
1070
1081
|
}
|
|
1071
1082
|
|
|
1072
|
-
|
|
1083
|
+
// src/components/layout/breadcrumbs.ts
|
|
1084
|
+
function stripTrailingSlash2(value) {
|
|
1085
|
+
return value.length > 1 && value.endsWith("/") ? value.slice(0, -1) : value;
|
|
1086
|
+
}
|
|
1087
|
+
function sortBySpecificity(routeMeta) {
|
|
1088
|
+
return [...routeMeta].sort((a, b) => {
|
|
1089
|
+
const aDepth = a.pattern.split("/").length;
|
|
1090
|
+
const bDepth = b.pattern.split("/").length;
|
|
1091
|
+
if (bDepth !== aDepth) {
|
|
1092
|
+
return bDepth - aDepth;
|
|
1093
|
+
}
|
|
1094
|
+
const aDynamic = (a.pattern.match(/:/g) ?? []).length;
|
|
1095
|
+
const bDynamic = (b.pattern.match(/:/g) ?? []).length;
|
|
1096
|
+
return aDynamic - bDynamic;
|
|
1097
|
+
});
|
|
1098
|
+
}
|
|
1099
|
+
function matchRoute(pathname, sorted) {
|
|
1100
|
+
const pathSegments = stripTrailingSlash2(pathname).split("/");
|
|
1101
|
+
for (const entry of sorted) {
|
|
1102
|
+
const patternSegments = entry.pattern.split("/");
|
|
1103
|
+
if (patternSegments.length !== pathSegments.length) {
|
|
1104
|
+
continue;
|
|
1105
|
+
}
|
|
1106
|
+
const params = {};
|
|
1107
|
+
let matched = true;
|
|
1108
|
+
for (let i = 0; i < patternSegments.length; i++) {
|
|
1109
|
+
const pSeg = patternSegments[i];
|
|
1110
|
+
const vSeg = pathSegments[i];
|
|
1111
|
+
if (pSeg.startsWith(":")) {
|
|
1112
|
+
params[pSeg.slice(1)] = vSeg;
|
|
1113
|
+
} else if (pSeg !== vSeg) {
|
|
1114
|
+
matched = false;
|
|
1115
|
+
break;
|
|
1116
|
+
}
|
|
1117
|
+
}
|
|
1118
|
+
if (matched) {
|
|
1119
|
+
return { entry, params };
|
|
1120
|
+
}
|
|
1121
|
+
}
|
|
1122
|
+
return null;
|
|
1123
|
+
}
|
|
1124
|
+
|
|
1125
|
+
// src/platform-react/activeNavHref.ts
|
|
1126
|
+
function isConcrete(pattern) {
|
|
1127
|
+
return !pattern.split("/").some((seg) => seg.startsWith(":"));
|
|
1128
|
+
}
|
|
1129
|
+
function resolveActiveNavHref(pathname, routeMeta, opts = {}) {
|
|
1130
|
+
const base = opts.basePath ?? /^\/extensions\/[^/]+/.exec(pathname)?.[0];
|
|
1131
|
+
if (!base) return void 0;
|
|
1132
|
+
const mountBase = base.endsWith("/") ? base.slice(0, -1) : base;
|
|
1133
|
+
const match = matchRoute(pathname, sortBySpecificity(routeMeta));
|
|
1134
|
+
if (match == null) return void 0;
|
|
1135
|
+
const seen = /* @__PURE__ */ new Set([match.entry.pattern]);
|
|
1136
|
+
let node = match.entry;
|
|
1137
|
+
while (node != null) {
|
|
1138
|
+
if (isConcrete(node.pattern)) {
|
|
1139
|
+
const owner = node.pattern.replace(/\/$/, "");
|
|
1140
|
+
if (owner === mountBase) return void 0;
|
|
1141
|
+
const prefix = `${mountBase}/`;
|
|
1142
|
+
return owner.startsWith(prefix) ? owner.slice(prefix.length) : void 0;
|
|
1143
|
+
}
|
|
1144
|
+
const parentPattern = node.parent;
|
|
1145
|
+
if (parentPattern == null || seen.has(parentPattern)) return void 0;
|
|
1146
|
+
seen.add(parentPattern);
|
|
1147
|
+
node = routeMeta.find((e) => e.pattern === parentPattern);
|
|
1148
|
+
}
|
|
1149
|
+
return void 0;
|
|
1150
|
+
}
|
|
1151
|
+
function withActiveNavHref(input, activeNavHref) {
|
|
1152
|
+
if (!activeNavHref) return input;
|
|
1153
|
+
return { ...input, activeNavHref };
|
|
1154
|
+
}
|
|
1155
|
+
|
|
1156
|
+
export { BaseMcpService, DEFAULT_MAX_UPLOAD_BYTES, EHX_PLUGIN_PORTAL_ATTR, EHX_PLUGIN_PORTAL_CLASS, EHX_PLUGIN_ROOT_CLASS, HOST_CHROME_CONTRACT_VERSION, HostSidebarActionsContext, LIST_CURRENCIES_TOOL, MissingViewFallback, ORGANISATION_SETTINGS_URI, OVERLAY_HOST_CONTRACT_VERSION, OverlayHostContext, PluginPortalScope, PluginStyleScope, REPORTING_CURRENCY_TOOL2 as REPORTING_CURRENCY_TOOL, SIDEBAR_MODE, SurfaceBaseContext, TemplateContext, TypedMcpService, buildSurfaceUrl, createPluginOverlayDefiner, createPluginPageDefiner, createReactRouterShim, createUseView, definePlatformReactPluginOverlay, definePlatformReactPluginPage, deriveHostEntityToken, injectPluginStyles, isComponent, isHostChromeCompatible, mcpTool, menuConfigToHostSidebarInput, normaliseSlug, notViaMcp, reportHostChromeDiagnostic, resolveActiveNavHref, resolveSurfaceBase, setHostChromeDiagnosticSink, surfacePathFor, toHostSidebarInput, useAuthenticatedQueries, useAuthenticatedQuery, useCurrency, useHostSidebarActions, useManagedLifecycle, useMcpUpload, useOrgFormatSync, useOverlayHost, usePluginRealtime, useReportingCurrencySync, useSurfaceUrl, useToolInvoker, useToolInvokerMap, useTypedToolInvokerMap, useView, withActiveNavHref };
|
|
1073
1157
|
//# sourceMappingURL=index.js.map
|
|
1074
1158
|
//# sourceMappingURL=index.js.map
|