@get-bb/plugin-sdk 0.4.84 → 0.4.87

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.
@@ -375,6 +375,39 @@ var sidebarFooterItemsByRegistrationSet = /* @__PURE__ */ new WeakMap();
375
375
  function getCollectedSidebarFooterItems(registrations) {
376
376
  return sidebarFooterItemsByRegistrationSet.get(registrations) ?? null;
377
377
  }
378
+ function collectTitledComponent(kind, seen, registration) {
379
+ const id = requireSlotId(kind, registration?.id);
380
+ requireUniqueId(kind, seen, id);
381
+ const description = requireOptionalString(
382
+ kind,
383
+ "description",
384
+ registration.description
385
+ );
386
+ return {
387
+ id,
388
+ title: requireNonEmptyString(kind, "title", registration.title),
389
+ ...description !== void 0 ? { description } : {},
390
+ component: requireComponent(kind, registration.component)
391
+ };
392
+ }
393
+ function collectPanelAction(kind, seen, registration) {
394
+ const id = requireSlotId(kind, registration?.id);
395
+ requireUniqueId(kind, seen, id);
396
+ if (registration.run !== void 0 && typeof registration.run !== "function") {
397
+ throw new Error(`${kind}: "run" must be a function when set`);
398
+ }
399
+ if (registration.layout !== void 0 && registration.layout !== "padded" && registration.layout !== "flush") {
400
+ throw new Error(`${kind}: "layout" must be "padded" or "flush"`);
401
+ }
402
+ return {
403
+ id,
404
+ title: requireNonEmptyString(kind, "title", registration.title),
405
+ ...registration.icon !== void 0 ? { icon: requireNonEmptyString(kind, "icon", registration.icon) } : {},
406
+ component: requireComponent(kind, registration.component),
407
+ ...registration.layout !== void 0 ? { layout: registration.layout } : {},
408
+ ...registration.run !== void 0 ? { run: registration.run } : {}
409
+ };
410
+ }
378
411
  function collectPluginAppRegistrations(definition, onComposerCustomizationRejected = (reason) => console.warn(reason)) {
379
412
  const sidebarFooterItems = [];
380
413
  const collected = {
@@ -554,46 +587,22 @@ function collectPluginAppRegistrations(definition, onComposerCustomizationReject
554
587
  });
555
588
  },
556
589
  threadPanelAction(registration) {
557
- const kind = "slots.threadPanelAction";
558
- const id = requireSlotId(kind, registration?.id);
559
- requireUniqueId(kind, seenIds.threadPanelAction, id);
560
- if (registration.run !== void 0 && typeof registration.run !== "function") {
561
- throw new Error(`${kind}: "run" must be a function when set`);
562
- }
563
- if (registration.layout !== void 0 && registration.layout !== "padded" && registration.layout !== "flush") {
564
- throw new Error(`${kind}: "layout" must be "padded" or "flush"`);
565
- }
566
- collected.threadPanelActions.push({
567
- id,
568
- title: requireNonEmptyString(kind, "title", registration.title),
569
- ...registration.icon !== void 0 ? {
570
- icon: requireNonEmptyString(kind, "icon", registration.icon)
571
- } : {},
572
- component: requireComponent(kind, registration.component),
573
- ...registration.layout !== void 0 ? { layout: registration.layout } : {},
574
- ...registration.run !== void 0 ? { run: registration.run } : {}
575
- });
590
+ collected.threadPanelActions.push(
591
+ collectPanelAction(
592
+ "slots.threadPanelAction",
593
+ seenIds.threadPanelAction,
594
+ registration
595
+ )
596
+ );
576
597
  },
577
598
  experimental_newThreadPanelAction(registration) {
578
- const kind = "slots.experimental_newThreadPanelAction";
579
- const id = requireSlotId(kind, registration?.id);
580
- requireUniqueId(kind, seenIds.newThreadPanelAction, id);
581
- if (registration.run !== void 0 && typeof registration.run !== "function") {
582
- throw new Error(`${kind}: "run" must be a function when set`);
583
- }
584
- if (registration.layout !== void 0 && registration.layout !== "padded" && registration.layout !== "flush") {
585
- throw new Error(`${kind}: "layout" must be "padded" or "flush"`);
586
- }
587
- collected.newThreadPanelActions.push({
588
- id,
589
- title: requireNonEmptyString(kind, "title", registration.title),
590
- ...registration.icon !== void 0 ? {
591
- icon: requireNonEmptyString(kind, "icon", registration.icon)
592
- } : {},
593
- component: requireComponent(kind, registration.component),
594
- ...registration.layout !== void 0 ? { layout: registration.layout } : {},
595
- ...registration.run !== void 0 ? { run: registration.run } : {}
596
- });
599
+ collected.newThreadPanelActions.push(
600
+ collectPanelAction(
601
+ "slots.experimental_newThreadPanelAction",
602
+ seenIds.newThreadPanelAction,
603
+ registration
604
+ )
605
+ );
597
606
  },
598
607
  pendingInteraction(registration) {
599
608
  const kind = "slots.pendingInteraction";
@@ -621,36 +630,22 @@ function collectPluginAppRegistrations(definition, onComposerCustomizationReject
621
630
  sidebarFooterItems.push(adaptSidebarFooterAction(legacyRegistration));
622
631
  },
623
632
  experimental_sidebarNavigation(registration) {
624
- const kind = "slots.experimental_sidebarNavigation";
625
- const id = requireSlotId(kind, registration?.id);
626
- requireUniqueId(kind, seenIds.sidebarNavigation, id);
627
- const description = requireOptionalString(
628
- kind,
629
- "description",
630
- registration.description
633
+ collected.experimentalSidebarNavigations.push(
634
+ collectTitledComponent(
635
+ "slots.experimental_sidebarNavigation",
636
+ seenIds.sidebarNavigation,
637
+ registration
638
+ )
631
639
  );
632
- collected.experimentalSidebarNavigations.push({
633
- id,
634
- title: requireNonEmptyString(kind, "title", registration.title),
635
- ...description !== void 0 ? { description } : {},
636
- component: requireComponent(kind, registration.component)
637
- });
638
640
  },
639
641
  experimental_threadList(registration) {
640
- const kind = "slots.experimental_threadList";
641
- const id = requireSlotId(kind, registration?.id);
642
- requireUniqueId(kind, seenIds.threadList, id);
643
- const description = requireOptionalString(
644
- kind,
645
- "description",
646
- registration.description
642
+ collected.threadLists.push(
643
+ collectTitledComponent(
644
+ "slots.experimental_threadList",
645
+ seenIds.threadList,
646
+ registration
647
+ )
647
648
  );
648
- collected.threadLists.push({
649
- id,
650
- title: requireNonEmptyString(kind, "title", registration.title),
651
- ...description !== void 0 ? { description } : {},
652
- component: requireComponent(kind, registration.component)
653
- });
654
649
  },
655
650
  experimental_threadHeaderAction(registration) {
656
651
  const kind = "slots.experimental_threadHeaderAction";
@@ -688,36 +683,22 @@ function collectPluginAppRegistrations(definition, onComposerCustomizationReject
688
683
  });
689
684
  },
690
685
  experimental_sourceCodeRenderer(registration) {
691
- const kind = "slots.experimental_sourceCodeRenderer";
692
- const id = requireSlotId(kind, registration?.id);
693
- requireUniqueId(kind, seenIds.sourceCodeRenderer, id);
694
- const description = requireOptionalString(
695
- kind,
696
- "description",
697
- registration.description
686
+ collected.sourceCodeRenderers.push(
687
+ collectTitledComponent(
688
+ "slots.experimental_sourceCodeRenderer",
689
+ seenIds.sourceCodeRenderer,
690
+ registration
691
+ )
698
692
  );
699
- collected.sourceCodeRenderers.push({
700
- id,
701
- title: requireNonEmptyString(kind, "title", registration.title),
702
- ...description !== void 0 ? { description } : {},
703
- component: requireComponent(kind, registration.component)
704
- });
705
693
  },
706
694
  experimental_diffRenderer(registration) {
707
- const kind = "slots.experimental_diffRenderer";
708
- const id = requireSlotId(kind, registration?.id);
709
- requireUniqueId(kind, seenIds.diffRenderer, id);
710
- const description = requireOptionalString(
711
- kind,
712
- "description",
713
- registration.description
695
+ collected.diffRenderers.push(
696
+ collectTitledComponent(
697
+ "slots.experimental_diffRenderer",
698
+ seenIds.diffRenderer,
699
+ registration
700
+ )
714
701
  );
715
- collected.diffRenderers.push({
716
- id,
717
- title: requireNonEmptyString(kind, "title", registration.title),
718
- ...description !== void 0 ? { description } : {},
719
- component: requireComponent(kind, registration.component)
720
- });
721
702
  },
722
703
  messageDirective(registration) {
723
704
  const kind = "slots.messageDirective";