@ichicraft/widgets-widget-base 1.16.3 → 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 +10 -0
- package/lib/BaseWidget.d.ts +7 -2
- package/lib/types/index.d.ts +26 -0
- package/package.json +1 -1
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.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
|
+
|
|
17
|
+
## 1.16.4 - 2026-05-27
|
|
18
|
+
|
|
19
|
+
- Added `header` property to `WidgetDesignContext` interface, exposing the header's `textColor`, `iconColor`, `activeTextColor` and `activeIconColor` from the user's theme.
|
|
20
|
+
- Deprecated `defaultColor` property on `WidgetBuddyContext` interface in favor of `design.header.iconColor` (and `design.header.activeIconColor` for the hover/active state).
|
|
21
|
+
|
|
12
22
|
## 1.16.3 - 2026-05-08
|
|
13
23
|
|
|
14
24
|
- Added `whatsNewUrl` property to `WidgetManifestConfig` to allow quick access to updates that the widget has received.
|
package/lib/BaseWidget.d.ts
CHANGED
|
@@ -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;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -396,6 +396,7 @@ export interface WidgetInstanceContext {
|
|
|
396
396
|
export interface WidgetBuddyContext {
|
|
397
397
|
/**
|
|
398
398
|
* The default color of the buddy icon, as configured in the user's theme.
|
|
399
|
+
* @deprecated Use `design.header.iconColor` (or `design.header.activeIconColor` for the hover/active state) instead.
|
|
399
400
|
*/
|
|
400
401
|
defaultColor: string;
|
|
401
402
|
/**
|
|
@@ -408,6 +409,20 @@ export interface WidgetBuddyContext {
|
|
|
408
409
|
*/
|
|
409
410
|
registerOnBuddyClick: (onClick: () => void) => void;
|
|
410
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
|
+
}
|
|
411
426
|
/**
|
|
412
427
|
* Widget variant context providing metadata and functionality offered by the widget board. A widget variant is
|
|
413
428
|
* a widget that's been installed by an administrator from within the board administration.
|
|
@@ -473,6 +488,17 @@ export interface WidgetDesignContext {
|
|
|
473
488
|
/** Inner text color of an icon badge. */
|
|
474
489
|
textColor: string;
|
|
475
490
|
};
|
|
491
|
+
/** Design settings related to the board header (welcome message, buddy bar and icons). */
|
|
492
|
+
header: {
|
|
493
|
+
/** Text color used in the header. */
|
|
494
|
+
textColor: string;
|
|
495
|
+
/** Icon color used in the header. */
|
|
496
|
+
iconColor: string;
|
|
497
|
+
/** Text color used in the header when an element is in the active or hover state. */
|
|
498
|
+
activeTextColor: string;
|
|
499
|
+
/** Icon color used in the header when an element is in the active or hover state. */
|
|
500
|
+
activeIconColor: string;
|
|
501
|
+
};
|
|
476
502
|
}
|
|
477
503
|
export interface ValidationResult {
|
|
478
504
|
isValid: boolean;
|
package/package.json
CHANGED