@get-bb/plugin-sdk 0.5.8 → 0.5.15

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.
@@ -620,6 +620,7 @@ function collectPluginAppRegistrations(definition, onComposerCustomizationReject
620
620
  sidebarFooterActions: [],
621
621
  experimentalSidebarFooterItems: [],
622
622
  experimentalSidebarNavigations: [],
623
+ experimentalSidebarHeaders: [],
623
624
  threadLists: [],
624
625
  threadHeaderActions: [],
625
626
  browserToolbarActions: [],
@@ -648,6 +649,7 @@ function collectPluginAppRegistrations(definition, onComposerCustomizationReject
648
649
  pendingInteraction: /* @__PURE__ */ new Set(),
649
650
  sidebarFooterItem: /* @__PURE__ */ new Set(),
650
651
  sidebarNavigation: /* @__PURE__ */ new Set(),
652
+ sidebarHeader: /* @__PURE__ */ new Set(),
651
653
  threadList: /* @__PURE__ */ new Set(),
652
654
  threadHeaderAction: /* @__PURE__ */ new Set(),
653
655
  browserToolbarAction: /* @__PURE__ */ new Set(),
@@ -857,6 +859,15 @@ function collectPluginAppRegistrations(definition, onComposerCustomizationReject
857
859
  )
858
860
  );
859
861
  },
862
+ experimental_sidebarHeader(registration) {
863
+ collected.experimentalSidebarHeaders.push(
864
+ collectTitledComponent(
865
+ "slots.experimental_sidebarHeader",
866
+ seenIds.sidebarHeader,
867
+ registration
868
+ )
869
+ );
870
+ },
860
871
  experimental_threadList(registration) {
861
872
  collected.threadLists.push(
862
873
  collectTitledComponent(
@@ -1100,6 +1111,19 @@ function TestThreadTitle({ threadId }) {
1100
1111
  if (thread === void 0) return null;
1101
1112
  return /* @__PURE__ */ jsx("span", { "data-thread-title": threadId, children: thread.displayTitle });
1102
1113
  }
1114
+ function TestSidebarNavigationIcon({
1115
+ icon,
1116
+ className
1117
+ }) {
1118
+ return /* @__PURE__ */ jsx(
1119
+ "span",
1120
+ {
1121
+ "aria-hidden": "true",
1122
+ className,
1123
+ "data-sidebar-navigation-icon": icon.kind === "host" ? icon.name : `${icon.pluginId}/${icon.icon ?? ""}`
1124
+ }
1125
+ );
1126
+ }
1103
1127
  function SlotLifecycleGuard({
1104
1128
  children,
1105
1129
  onUnmount
@@ -1679,6 +1703,28 @@ var testPluginSdkApp = {
1679
1703
  return env.sidebarShortcuts.get(threadId) ?? null;
1680
1704
  },
1681
1705
  ThreadTitle: TestThreadTitle,
1706
+ experimental_useSidebarNavigation() {
1707
+ return useSlotEnv("experimental_useSidebarNavigation").sidebarNavigation;
1708
+ },
1709
+ experimental_useSidebarNavigationSplit(itemId, _options) {
1710
+ const env = useSlotEnv("experimental_useSidebarNavigationSplit");
1711
+ return useMemo(
1712
+ () => ({
1713
+ splitProps: {
1714
+ onPointerDown: () => {
1715
+ env.sidebarNavigationCalls.push({
1716
+ method: "beginSplitDrag",
1717
+ itemId
1718
+ });
1719
+ }
1720
+ },
1721
+ isAvailable: true,
1722
+ layout: null
1723
+ }),
1724
+ [env, itemId]
1725
+ );
1726
+ },
1727
+ experimental_SidebarNavigationIcon: TestSidebarNavigationIcon,
1682
1728
  useEnvironmentProviders() {
1683
1729
  return useSlotEnv("useEnvironmentProviders").environmentProviders;
1684
1730
  },
@@ -1965,6 +2011,43 @@ function renderSlot(registration, props, options = {}) {
1965
2011
  }
1966
2012
  };
1967
2013
  const sidebarActionCalls = [];
2014
+ const sidebarNavigationCalls = [];
2015
+ const sidebarNavigation = {
2016
+ items: options.sidebarNavigation?.items ?? [],
2017
+ activeItemId: options.sidebarNavigation?.activeItemId ?? null,
2018
+ isShortcutModifierHeld: options.sidebarNavigation?.isShortcutModifierHeld ?? false,
2019
+ actions: {
2020
+ activate(itemId, activationOptions) {
2021
+ sidebarNavigationCalls.push({
2022
+ method: "activate",
2023
+ itemId,
2024
+ openInSplit: activationOptions.openInSplit
2025
+ });
2026
+ },
2027
+ setVisible(itemId, isVisible) {
2028
+ sidebarNavigationCalls.push({
2029
+ method: "setVisible",
2030
+ itemId,
2031
+ isVisible
2032
+ });
2033
+ },
2034
+ setOrder(itemIds) {
2035
+ sidebarNavigationCalls.push({
2036
+ method: "setOrder",
2037
+ itemIds: [...itemIds]
2038
+ });
2039
+ },
2040
+ openCustomize() {
2041
+ sidebarNavigationCalls.push({ method: "openCustomize" });
2042
+ },
2043
+ openDetails(itemId) {
2044
+ sidebarNavigationCalls.push({ method: "openDetails", itemId });
2045
+ },
2046
+ async disablePlugin(itemId) {
2047
+ sidebarNavigationCalls.push({ method: "disablePlugin", itemId });
2048
+ }
2049
+ }
2050
+ };
1968
2051
  const sidebarPullRequests = new Map(
1969
2052
  Object.entries(options.sidebarPullRequests ?? {})
1970
2053
  );
@@ -2235,6 +2318,8 @@ ${block}
2235
2318
  sidebarRowStatuses,
2236
2319
  sidebarShortcuts,
2237
2320
  sidebarSplitLayout: options.sidebarSplitLayout ?? null,
2321
+ sidebarNavigation,
2322
+ sidebarNavigationCalls,
2238
2323
  environmentProviders,
2239
2324
  sdk,
2240
2325
  sdkCalls,
@@ -2306,6 +2391,7 @@ ${block}
2306
2391
  navigateCalls,
2307
2392
  experimental_fixedTabOpenCalls,
2308
2393
  sidebarActionCalls,
2394
+ sidebarNavigationCalls,
2309
2395
  sdkCalls,
2310
2396
  composer: composerLog,
2311
2397
  behavior: {
@@ -2319,6 +2405,7 @@ ${block}
2319
2405
  navigateCalls,
2320
2406
  experimental_fixedTabOpenCalls,
2321
2407
  sidebarActionCalls,
2408
+ sidebarNavigationCalls,
2322
2409
  sdkCalls,
2323
2410
  composer: composerLog
2324
2411
  },
@@ -3360,6 +3360,7 @@ function createFakePluginHostInternal(options, sharedState) {
3360
3360
  const machineProviders = /* @__PURE__ */ new Map();
3361
3361
  const serverAccessProviders = /* @__PURE__ */ new Map();
3362
3362
  const disposeHooks = [];
3363
+ const installHandlers = [];
3363
3364
  const serviceControllers = [];
3364
3365
  let nextInteractionId = 1;
3365
3366
  const pendingInteractions = /* @__PURE__ */ new Map();
@@ -3685,6 +3686,13 @@ function createFakePluginHostInternal(options, sharedState) {
3685
3686
  onDispose(hook) {
3686
3687
  assertLive();
3687
3688
  disposeHooks.push(hook);
3689
+ },
3690
+ onInstall(handler) {
3691
+ assertLive();
3692
+ if (typeof handler !== "function") {
3693
+ throw new Error("onInstall expects a function");
3694
+ }
3695
+ installHandlers.push(handler);
3688
3696
  }
3689
3697
  };
3690
3698
  async function disposeHost(cleanupStorage) {
@@ -4223,6 +4231,16 @@ function createFakePluginHostInternal(options, sharedState) {
4223
4231
  },
4224
4232
  async dispose() {
4225
4233
  await disposeHost(true);
4234
+ },
4235
+ async install() {
4236
+ assertLive();
4237
+ for (const handler of [...installHandlers]) {
4238
+ try {
4239
+ await handler();
4240
+ } catch (error) {
4241
+ emitLog("warn", `install handler failed: ${errorMessage(error)}`);
4242
+ }
4243
+ }
4226
4244
  }
4227
4245
  };
4228
4246
  fakeHostDisposers.set(harness, disposeHost);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@get-bb/plugin-sdk",
3
- "version": "0.5.8",
3
+ "version": "0.5.15",
4
4
  "homepage": "https://github.com/get-bb/bb#readme",
5
5
  "bugs": {
6
6
  "url": "https://github.com/get-bb/bb/issues"