@ichicraft/widgets-widget-base 1.16.4 → 1.16.5

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/README.md CHANGED
@@ -9,6 +9,11 @@ All notable changes to this project will be documented here.
9
9
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
10
10
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
11
11
 
12
+ ## 1.16.5 - 2026-06-01
13
+
14
+ - Added `BuddyRenderOptions` interface, passed by the host to `BaseWidget.renderBuddy` to describe the slot the widget is about to render into.
15
+ - Added optional `options` parameter to `BaseWidget.renderBuddy`, of type `BuddyRenderOptions`. Contains an `allowRichRendering` boolean that signals whether the slot has room for richer rendering than the standard buddy icon button — letting the widget decide synchronously between custom and default rendering.
16
+
12
17
  ## 1.16.4 - 2026-05-27
13
18
 
14
19
  - Added `header` property to `WidgetDesignContext` interface, exposing the header's `textColor`, `iconColor`, `activeTextColor` and `activeIconColor` from the user's theme.
@@ -1,13 +1,18 @@
1
- import { ExportData, ValidationResult, WidgetContext } from './types';
1
+ import { BuddyRenderOptions, ExportData, ValidationResult, WidgetContext } from './types';
2
2
  export default abstract class BaseWidget {
3
3
  protected readonly context: WidgetContext;
4
4
  constructor(context: WidgetContext);
5
5
  abstract init(): Promise<void>;
6
6
  abstract render(domElement: HTMLDivElement): void;
7
7
  /** Render function for the widget buddy component.
8
+ * @param domElement The DOM element to render into.
9
+ * @param options Slot information from the host (e.g. whether the slot has
10
+ * room for richer rendering than the standard buddy button). The
11
+ * argument is optional for backwards compatibility — older hosts may
12
+ * call `renderBuddy` without it.
8
13
  * @returns Whether or not the buddy is using custom rendering.
9
14
  */
10
- renderBuddy?(domElement: HTMLDivElement): boolean;
15
+ renderBuddy?(domElement: HTMLDivElement, options?: BuddyRenderOptions): boolean;
11
16
  verifyPersistedUserConfiguration?(config: string): Promise<boolean>;
12
17
  renderUserConfigurationForm?(domElement: HTMLDivElement): void;
13
18
  validateUserConfigurationForm?(): ValidationResult;
@@ -409,6 +409,20 @@ export interface WidgetBuddyContext {
409
409
  */
410
410
  registerOnBuddyClick: (onClick: () => void) => void;
411
411
  }
412
+ /**
413
+ * Options passed by the host to `BaseWidget.renderBuddy` describing the slot
414
+ * the widget is about to render into. Lets the widget decide synchronously
415
+ * how rich its buddy rendering can afford to be.
416
+ */
417
+ export interface BuddyRenderOptions {
418
+ /**
419
+ * Whether the buddy slot has enough room for a richer rendering than the
420
+ * standard buddy icon button. When `false`, the widget should either fall
421
+ * back on the host's default buddy button (by returning `false` from
422
+ * `renderBuddy`) or render a minimal icon that fits the standard slot.
423
+ */
424
+ allowRichRendering: boolean;
425
+ }
412
426
  /**
413
427
  * Widget variant context providing metadata and functionality offered by the widget board. A widget variant is
414
428
  * a widget that's been installed by an administrator from within the board administration.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ichicraft/widgets-widget-base",
3
- "version": "1.16.4",
3
+ "version": "1.16.5",
4
4
  "description": "Part of the Widget Development Kit for building widgets for Bloom Intranet",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",