@get-bb/plugin-sdk 0.4.84 → 0.4.88

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.
@@ -551,6 +551,39 @@ function rejectStaleNavPanelKeys(kind, registration) {
551
551
  }
552
552
  }
553
553
  var sidebarFooterItemsByRegistrationSet = /* @__PURE__ */ new WeakMap();
554
+ function collectTitledComponent(kind, seen, registration) {
555
+ const id = requireSlotId(kind, registration?.id);
556
+ requireUniqueId(kind, seen, id);
557
+ const description = requireOptionalString(
558
+ kind,
559
+ "description",
560
+ registration.description
561
+ );
562
+ return {
563
+ id,
564
+ title: requireNonEmptyString(kind, "title", registration.title),
565
+ ...description !== void 0 ? { description } : {},
566
+ component: requireComponent(kind, registration.component)
567
+ };
568
+ }
569
+ function collectPanelAction(kind, seen, registration) {
570
+ const id = requireSlotId(kind, registration?.id);
571
+ requireUniqueId(kind, seen, id);
572
+ if (registration.run !== void 0 && typeof registration.run !== "function") {
573
+ throw new Error(`${kind}: "run" must be a function when set`);
574
+ }
575
+ if (registration.layout !== void 0 && registration.layout !== "padded" && registration.layout !== "flush") {
576
+ throw new Error(`${kind}: "layout" must be "padded" or "flush"`);
577
+ }
578
+ return {
579
+ id,
580
+ title: requireNonEmptyString(kind, "title", registration.title),
581
+ ...registration.icon !== void 0 ? { icon: requireNonEmptyString(kind, "icon", registration.icon) } : {},
582
+ component: requireComponent(kind, registration.component),
583
+ ...registration.layout !== void 0 ? { layout: registration.layout } : {},
584
+ ...registration.run !== void 0 ? { run: registration.run } : {}
585
+ };
586
+ }
554
587
  function collectPluginAppRegistrations(definition, onComposerCustomizationRejected = (reason) => console.warn(reason)) {
555
588
  const sidebarFooterItems = [];
556
589
  const collected = {
@@ -730,46 +763,22 @@ function collectPluginAppRegistrations(definition, onComposerCustomizationReject
730
763
  });
731
764
  },
732
765
  threadPanelAction(registration) {
733
- const kind = "slots.threadPanelAction";
734
- const id = requireSlotId(kind, registration?.id);
735
- requireUniqueId(kind, seenIds.threadPanelAction, id);
736
- if (registration.run !== void 0 && typeof registration.run !== "function") {
737
- throw new Error(`${kind}: "run" must be a function when set`);
738
- }
739
- if (registration.layout !== void 0 && registration.layout !== "padded" && registration.layout !== "flush") {
740
- throw new Error(`${kind}: "layout" must be "padded" or "flush"`);
741
- }
742
- collected.threadPanelActions.push({
743
- id,
744
- title: requireNonEmptyString(kind, "title", registration.title),
745
- ...registration.icon !== void 0 ? {
746
- icon: requireNonEmptyString(kind, "icon", registration.icon)
747
- } : {},
748
- component: requireComponent(kind, registration.component),
749
- ...registration.layout !== void 0 ? { layout: registration.layout } : {},
750
- ...registration.run !== void 0 ? { run: registration.run } : {}
751
- });
766
+ collected.threadPanelActions.push(
767
+ collectPanelAction(
768
+ "slots.threadPanelAction",
769
+ seenIds.threadPanelAction,
770
+ registration
771
+ )
772
+ );
752
773
  },
753
774
  experimental_newThreadPanelAction(registration) {
754
- const kind = "slots.experimental_newThreadPanelAction";
755
- const id = requireSlotId(kind, registration?.id);
756
- requireUniqueId(kind, seenIds.newThreadPanelAction, id);
757
- if (registration.run !== void 0 && typeof registration.run !== "function") {
758
- throw new Error(`${kind}: "run" must be a function when set`);
759
- }
760
- if (registration.layout !== void 0 && registration.layout !== "padded" && registration.layout !== "flush") {
761
- throw new Error(`${kind}: "layout" must be "padded" or "flush"`);
762
- }
763
- collected.newThreadPanelActions.push({
764
- id,
765
- title: requireNonEmptyString(kind, "title", registration.title),
766
- ...registration.icon !== void 0 ? {
767
- icon: requireNonEmptyString(kind, "icon", registration.icon)
768
- } : {},
769
- component: requireComponent(kind, registration.component),
770
- ...registration.layout !== void 0 ? { layout: registration.layout } : {},
771
- ...registration.run !== void 0 ? { run: registration.run } : {}
772
- });
775
+ collected.newThreadPanelActions.push(
776
+ collectPanelAction(
777
+ "slots.experimental_newThreadPanelAction",
778
+ seenIds.newThreadPanelAction,
779
+ registration
780
+ )
781
+ );
773
782
  },
774
783
  pendingInteraction(registration) {
775
784
  const kind = "slots.pendingInteraction";
@@ -797,36 +806,22 @@ function collectPluginAppRegistrations(definition, onComposerCustomizationReject
797
806
  sidebarFooterItems.push(adaptSidebarFooterAction(legacyRegistration));
798
807
  },
799
808
  experimental_sidebarNavigation(registration) {
800
- const kind = "slots.experimental_sidebarNavigation";
801
- const id = requireSlotId(kind, registration?.id);
802
- requireUniqueId(kind, seenIds.sidebarNavigation, id);
803
- const description = requireOptionalString(
804
- kind,
805
- "description",
806
- registration.description
809
+ collected.experimentalSidebarNavigations.push(
810
+ collectTitledComponent(
811
+ "slots.experimental_sidebarNavigation",
812
+ seenIds.sidebarNavigation,
813
+ registration
814
+ )
807
815
  );
808
- collected.experimentalSidebarNavigations.push({
809
- id,
810
- title: requireNonEmptyString(kind, "title", registration.title),
811
- ...description !== void 0 ? { description } : {},
812
- component: requireComponent(kind, registration.component)
813
- });
814
816
  },
815
817
  experimental_threadList(registration) {
816
- const kind = "slots.experimental_threadList";
817
- const id = requireSlotId(kind, registration?.id);
818
- requireUniqueId(kind, seenIds.threadList, id);
819
- const description = requireOptionalString(
820
- kind,
821
- "description",
822
- registration.description
818
+ collected.threadLists.push(
819
+ collectTitledComponent(
820
+ "slots.experimental_threadList",
821
+ seenIds.threadList,
822
+ registration
823
+ )
823
824
  );
824
- collected.threadLists.push({
825
- id,
826
- title: requireNonEmptyString(kind, "title", registration.title),
827
- ...description !== void 0 ? { description } : {},
828
- component: requireComponent(kind, registration.component)
829
- });
830
825
  },
831
826
  experimental_threadHeaderAction(registration) {
832
827
  const kind = "slots.experimental_threadHeaderAction";
@@ -864,36 +859,22 @@ function collectPluginAppRegistrations(definition, onComposerCustomizationReject
864
859
  });
865
860
  },
866
861
  experimental_sourceCodeRenderer(registration) {
867
- const kind = "slots.experimental_sourceCodeRenderer";
868
- const id = requireSlotId(kind, registration?.id);
869
- requireUniqueId(kind, seenIds.sourceCodeRenderer, id);
870
- const description = requireOptionalString(
871
- kind,
872
- "description",
873
- registration.description
862
+ collected.sourceCodeRenderers.push(
863
+ collectTitledComponent(
864
+ "slots.experimental_sourceCodeRenderer",
865
+ seenIds.sourceCodeRenderer,
866
+ registration
867
+ )
874
868
  );
875
- collected.sourceCodeRenderers.push({
876
- id,
877
- title: requireNonEmptyString(kind, "title", registration.title),
878
- ...description !== void 0 ? { description } : {},
879
- component: requireComponent(kind, registration.component)
880
- });
881
869
  },
882
870
  experimental_diffRenderer(registration) {
883
- const kind = "slots.experimental_diffRenderer";
884
- const id = requireSlotId(kind, registration?.id);
885
- requireUniqueId(kind, seenIds.diffRenderer, id);
886
- const description = requireOptionalString(
887
- kind,
888
- "description",
889
- registration.description
871
+ collected.diffRenderers.push(
872
+ collectTitledComponent(
873
+ "slots.experimental_diffRenderer",
874
+ seenIds.diffRenderer,
875
+ registration
876
+ )
890
877
  );
891
- collected.diffRenderers.push({
892
- id,
893
- title: requireNonEmptyString(kind, "title", registration.title),
894
- ...description !== void 0 ? { description } : {},
895
- component: requireComponent(kind, registration.component)
896
- });
897
878
  },
898
879
  messageDirective(registration) {
899
880
  const kind = "slots.messageDirective";