@ichicraft/widgets-widget-base 1.10.7 → 1.11.0

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,16 @@ 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.11.0 - 2024-10-17
13
+
14
+ - Added `renderBuddy` function to the `BaseWidget` class, to support rendering widgets as a buddy.
15
+ - Added `buddy` property of type `WidgetBuddyContext` to the `WidgetContext` interface, to support utility functions specifically for a widget buddy.
16
+ - Added `setBadgeProperties` function to the `WidgetBuddyContext` interface, to allow rendering a badge on top of the buddy.
17
+
18
+ ## 1.10.8 - 2024-10-15
19
+
20
+ - Added `buddybar` to the `BoardType` type, to support widgets that run in the scope of the upcoming buddy bar feature
21
+
12
22
  ## 1.10.7 - 2024-08-20
13
23
 
14
24
  - Replaced `onInit` function with a new asynchronous `init` function in the `BaseWidget` class, to allow waiting until initialization is complete.
@@ -4,6 +4,10 @@ export default abstract class BaseWidget {
4
4
  constructor(context: WidgetContext);
5
5
  abstract init(): Promise<void>;
6
6
  abstract render(domElement: HTMLDivElement): void;
7
+ /** Render function for the widget buddy component.
8
+ * @returns Whether or not the buddy is using custom rendering.
9
+ */
10
+ renderBuddy?(domElement: HTMLDivElement): boolean;
7
11
  verifyPersistedUserConfiguration?(config: string): Promise<boolean>;
8
12
  renderUserConfigurationForm?(domElement: HTMLDivElement): void;
9
13
  validateUserConfigurationForm?(): ValidationResult;
@@ -11,6 +11,12 @@ export interface WidgetContext {
11
11
  * unique ID and possibly configuration data if the widget is configurable by the user
12
12
  */
13
13
  instance: WidgetInstanceContext;
14
+ /**
15
+ * Metadata and functions in the context of a widget boddy. A widget buddy
16
+ * is a single and specific widget that a user has on his/her board. It has its own
17
+ * unique ID and possibly configuration data if the widget is configurable by the user
18
+ */
19
+ buddy: WidgetBuddyContext;
14
20
  /**
15
21
  * Metadata and functions in the context of a widget's variant (fka definition). A widget variant is
16
22
  * a widget that's been installed by an administrator from within the board administration.
@@ -349,6 +355,12 @@ export interface WidgetInstanceContext {
349
355
  [key: string]: string;
350
356
  }) => void;
351
357
  }
358
+ export interface WidgetBuddyContext {
359
+ /**
360
+ * Allows setting the badge properties of the buddy, e.g. its visibility, count or color.
361
+ */
362
+ setBadgeProperties?: (props: Partial<BadgeProperties>) => void;
363
+ }
352
364
  /**
353
365
  * Widget variant context providing metadata and functionality offered by the widget board. A widget variant is
354
366
  * a widget that's been installed by an administrator from within the board administration.
@@ -840,8 +852,13 @@ export interface FilePickerFileProps {
840
852
  */
841
853
  siteId: string;
842
854
  }
843
- export type BoardType = 'shared' | 'personal';
855
+ export type BoardType = 'shared' | 'personal' | 'buddybar';
844
856
  export type UserRole = 'administrator' | 'board-owner' | 'widget-administrator';
845
857
  export interface ExportData {
846
858
  data: object[];
847
859
  }
860
+ export interface BadgeProperties {
861
+ isVisible?: boolean;
862
+ count?: number;
863
+ color?: string;
864
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ichicraft/widgets-widget-base",
3
- "version": "1.10.7",
3
+ "version": "1.11.0",
4
4
  "description": "Part of the Widget Development Kit for building widgets for Ichicraft Boards",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",