@get-bb/plugin-sdk 0.4.14 → 0.4.16

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.
@@ -17,6 +17,15 @@ function requireProviderId(kind, value) {
17
17
  }
18
18
  return value;
19
19
  }
20
+ var PLUGIN_TIMELINE_RENDERER_KIND_PATTERN = /^(tool|[a-z0-9-]+\/[a-z0-9-]+)$/u;
21
+ function requireTimelineRendererKind(kind, value) {
22
+ if (typeof value !== "string" || !PLUGIN_TIMELINE_RENDERER_KIND_PATTERN.test(value)) {
23
+ throw new Error(
24
+ `${kind}: "kind" must be "tool" or "<pluginId>/<name>" (lowercase letters, digits, "-"), got ${JSON.stringify(value)}`
25
+ );
26
+ }
27
+ return value;
28
+ }
20
29
  function requireMessageDirectiveId(kind, value) {
21
30
  if (typeof value !== "string" || !PLUGIN_MESSAGE_DIRECTIVE_ID_PATTERN.test(value)) {
22
31
  throw new Error(
@@ -204,6 +213,35 @@ function collectComposerCustomization(registration, seenIds, onRejected) {
204
213
  }
205
214
 
206
215
  // src/internal/plugin-app-collector.ts
216
+ var NAV_PANEL_REGISTRATION_KEYS = new Set(
217
+ Object.keys({
218
+ id: true,
219
+ title: true,
220
+ icon: true,
221
+ path: true,
222
+ component: true,
223
+ fixedTabs: true,
224
+ experimental_sidebarAccessory: true,
225
+ headerContent: true
226
+ })
227
+ );
228
+ var RENAMED_NAV_PANEL_KEYS = /* @__PURE__ */ new Map([
229
+ ["experimental_fixedTabs", "fixedTabs"]
230
+ ]);
231
+ function rejectStaleNavPanelKeys(kind, registration) {
232
+ for (const key of Object.keys(registration)) {
233
+ if (NAV_PANEL_REGISTRATION_KEYS.has(key)) continue;
234
+ const renamedTo = RENAMED_NAV_PANEL_KEYS.get(key);
235
+ if (renamedTo !== void 0) {
236
+ throw new Error(
237
+ `${kind}: "${key}" was renamed to "${renamedTo}" in SDK 0.4.16`
238
+ );
239
+ }
240
+ if (key.startsWith("experimental_")) {
241
+ throw new Error(`${kind}: unknown field "${key}"`);
242
+ }
243
+ }
244
+ }
207
245
  function collectPluginAppRegistrations(definition, onComposerCustomizationRejected = (reason) => console.warn(reason)) {
208
246
  const collected = {
209
247
  homepageSections: [],
@@ -223,6 +261,7 @@ function collectPluginAppRegistrations(definition, onComposerCustomizationReject
223
261
  messageActions: [],
224
262
  commandPaletteActions: [],
225
263
  providerIcons: [],
264
+ timelineRenderers: [],
226
265
  contentScripts: []
227
266
  };
228
267
  const seenIds = {
@@ -243,6 +282,7 @@ function collectPluginAppRegistrations(definition, onComposerCustomizationReject
243
282
  messageAction: /* @__PURE__ */ new Set(),
244
283
  commandPaletteAction: /* @__PURE__ */ new Set(),
245
284
  providerIcon: /* @__PURE__ */ new Set(),
285
+ timelineRenderer: /* @__PURE__ */ new Set(),
246
286
  contentScript: /* @__PURE__ */ new Set()
247
287
  };
248
288
  definition.setup({
@@ -278,6 +318,7 @@ function collectPluginAppRegistrations(definition, onComposerCustomizationReject
278
318
  const kind = "slots.navPanel";
279
319
  const id = requireSlotId(kind, registration?.id);
280
320
  requireUniqueId(kind, seenIds.navPanel, id);
321
+ rejectStaleNavPanelKeys(kind, registration);
281
322
  const panelId = id;
282
323
  const path = requireNonEmptyString(kind, "path", registration.path);
283
324
  if (!PLUGIN_SLOT_ID_PATTERN.test(path)) {
@@ -295,16 +336,14 @@ function collectPluginAppRegistrations(definition, onComposerCustomizationReject
295
336
  `${kind}: "experimental_sidebarAccessory" must be a React component function when set`
296
337
  );
297
338
  }
298
- const experimentalFixedTabs = (() => {
299
- if (registration.experimental_fixedTabs === void 0) return [];
300
- if (!Array.isArray(registration.experimental_fixedTabs)) {
301
- throw new Error(
302
- `${kind}: "experimental_fixedTabs" must be an array when set`
303
- );
339
+ const fixedTabs = (() => {
340
+ if (registration.fixedTabs === void 0) return [];
341
+ if (!Array.isArray(registration.fixedTabs)) {
342
+ throw new Error(`${kind}: "fixedTabs" must be an array when set`);
304
343
  }
305
344
  const seenFixedTabIds = /* @__PURE__ */ new Set();
306
- return registration.experimental_fixedTabs.map((value, index) => {
307
- const fixedTabKind = `${kind}.experimental_fixedTabs[${index}]`;
345
+ return registration.fixedTabs.map((value, index) => {
346
+ const fixedTabKind = `${kind}.fixedTabs[${index}]`;
308
347
  const fixedTab = value;
309
348
  const id2 = requireSlotId(fixedTabKind, fixedTab?.id);
310
349
  requireUniqueId(fixedTabKind, seenFixedTabIds, id2);
@@ -338,11 +377,7 @@ function collectPluginAppRegistrations(definition, onComposerCustomizationReject
338
377
  "title",
339
378
  fixedTab?.title
340
379
  ),
341
- icon: requireNonEmptyString(
342
- fixedTabKind,
343
- "icon",
344
- fixedTab?.icon
345
- ),
380
+ icon: requireNonEmptyString(fixedTabKind, "icon", fixedTab?.icon),
346
381
  component: requireComponent(fixedTabKind, fixedTab?.component),
347
382
  ...layout === void 0 ? {} : { layout },
348
383
  ...experimentalTarget === void 0 ? {} : {
@@ -357,7 +392,7 @@ function collectPluginAppRegistrations(definition, onComposerCustomizationReject
357
392
  icon: requireNonEmptyString(kind, "icon", registration.icon),
358
393
  path,
359
394
  component: requireComponent(kind, registration.component),
360
- ...experimentalFixedTabs.length > 0 ? { experimental_fixedTabs: experimentalFixedTabs } : {},
395
+ ...fixedTabs.length > 0 ? { fixedTabs } : {},
361
396
  ...registration.experimental_sidebarAccessory !== void 0 ? {
362
397
  experimental_sidebarAccessory: registration.experimental_sidebarAccessory
363
398
  } : {},
@@ -562,6 +597,15 @@ function collectPluginAppRegistrations(definition, onComposerCustomizationReject
562
597
  providerId,
563
598
  icon: requireComponent(kind, registration.icon)
564
599
  });
600
+ },
601
+ experimental_timelineRenderer(registration) {
602
+ const kind = "slots.experimental_timelineRenderer";
603
+ const itemKind = requireTimelineRendererKind(kind, registration?.kind);
604
+ requireUniqueId(kind, seenIds.timelineRenderer, itemKind);
605
+ collected.timelineRenderers.push({
606
+ kind: itemKind,
607
+ component: requireComponent(kind, registration.component)
608
+ });
565
609
  }
566
610
  },
567
611
  composer: {