@ichicraft/widgets-widget-base 1.11.5 → 1.12.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,20 @@ 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.12.0 - 2025-02-11
13
+
14
+ - Added `ColorOption` interface.
15
+ - Added `WidgetDesignContext` interface.
16
+ - Added `design` property of type `WidgetDesignContext` to `WidgetContext` interface, to support UI settings within widgets.
17
+ - Deprecated `elementBorderRadius` property which is renamed to `borderRadius` and moved under `design` property in `WidgetContext` interface.
18
+
19
+ ## 1.11.6 - 2025-01-30
20
+
21
+ - Added `spServiceScope` property to `WidgetContext` interface.
22
+ - Added `loadComponentById` function to `WidgetContext` interface.
23
+ - Deprecated `definition` property which is replaced by `variant` property in `WidgetContext` interface.
24
+ - Deprecated `instance.publishNotification` function in `WidgetContext` interface because feature is no longer available.
25
+
12
26
  ## 1.11.5 - 2025-01-21
13
27
 
14
28
  - Added `defaultColor` property to `WidgetBuddyContext` interface.
@@ -8,7 +8,7 @@ export interface WidgetContext {
8
8
  /**
9
9
  * Metadata and functions in the context of a widget instance. A widget instance
10
10
  * is a single and specific widget that a user has on their board. It has its own
11
- * unique ID and possibly configuration data if the widget is configurable by the user
11
+ * unique ID and possibly configuration data if the widget is configurable by the user.
12
12
  */
13
13
  instance: WidgetInstanceContext;
14
14
  /**
@@ -17,16 +17,26 @@ export interface WidgetContext {
17
17
  */
18
18
  buddy?: WidgetBuddyContext;
19
19
  /**
20
- * Metadata and functions in the context of a widget's variant (fka definition). A widget variant is
21
- * a widget that's been installed by an administrator from within the board administration.
20
+ * Metadata and functions in the context of a widget's variant (fka 'definition'). A widget variant is
21
+ * a widget that's been installed and possibly configured by an administrator from within the admin center.
22
+ * @deprecated Use `variant` instead
22
23
  */
23
- definition: WidgetVariantContext;
24
+ definition?: WidgetVariantContext;
25
+ /**
26
+ * Metadata and functions in the context of a widget's variant (fka 'definition'). A widget variant is
27
+ * a widget that's been installed and possibly configured by an administrator from within the admin center.
28
+ */
29
+ variant: WidgetVariantContext;
24
30
  /**
25
31
  * Metadata and functions in the context of a widget's manifest. A widget manifest contains
26
32
  * all information of the originally installed widget. Multiple `variants` of the same widget `manifest`
27
33
  * can exist in a widget board configuration.
28
34
  */
29
35
  manifest: WidgetManifestContext;
36
+ /**
37
+ * Metadata in the context of the user's current theme, e.g. color settings and the preferred border radius for UI elements.
38
+ */
39
+ design: WidgetDesignContext;
30
40
  /**
31
41
  * Tells whether the widget board is running in a Teams context
32
42
  */
@@ -64,7 +74,8 @@ export interface WidgetContext {
64
74
  */
65
75
  tenantId: string;
66
76
  /**
67
- * ID of current Ichicraft Boards installation. Could either be a Site Collection ID (SP Shell) or a fixed ID (Teams Shell)
77
+ * ID of current Ichicraft Boards installation. Could either be a Site Collection ID (SP Shell)
78
+ * or a fixed ID (Teams Shell)
68
79
  */
69
80
  boardsInstanceId: string;
70
81
  /**
@@ -151,11 +162,13 @@ export interface WidgetContext {
151
162
  isCurrent?: boolean;
152
163
  }[];
153
164
  /**
154
- * Preferred border radius of UI elements as configured in Widget Board configuration
165
+ * Preferred border radius of UI elements as configured in Widget Board configuration.
166
+ * @deprecated This property has been moved under `design`.
155
167
  */
156
168
  elementBorderRadius: number;
157
169
  /**
158
- * Interacts with the SharePoint REST api, such as fetching/updating sites, lists and users.
170
+ * A multi purpose SharePoint interface that can be used to interact with SharePoint.
171
+ * It's based on the PnPjs library.
159
172
  */
160
173
  sp: SPFI;
161
174
  /**
@@ -166,6 +179,10 @@ export interface WidgetContext {
166
179
  * Provides a set of switches for enabling/disabling various features of the SPHttpClient.
167
180
  */
168
181
  spHttpClientConfiguration: SPHttpClientConfiguration;
182
+ /**
183
+ * SharePoint Service Scope, taken from SPFx WebPart Context. Type is removed to avoid dependency on SPFx.
184
+ */
185
+ spServiceScope?: unknown;
169
186
  /**
170
187
  * MS Graph Client Factory class as provided by the WebPartContext object.
171
188
  */
@@ -214,6 +231,10 @@ export interface WidgetContext {
214
231
  * Functionality offered by the widget board to load a script using SPComponentLoader.
215
232
  */
216
233
  loadScript?: <TModule>(url: string, options?: any) => Promise<TModule>;
234
+ /**
235
+ * Functionality offered by the widget board to load a publicly available SharePoint component using SPComponentLoader.
236
+ */
237
+ loadComponentById?: <TComponent>(id: string, version?: string) => Promise<TComponent>;
217
238
  /**
218
239
  * Functionality offered by the widget board to open a File Picker panel to select files.
219
240
  * @param onFilePicked Function that's called when a file was picked. Returns the url of the picked file.
@@ -273,10 +294,7 @@ export interface WidgetInstanceContext {
273
294
  */
274
295
  getDeepLinkData?: () => string;
275
296
  /**
276
- * Call this function from within a widget instance to publish a notification to the
277
- * notitication box on top of the widget board. It should provide information for this specific
278
- * widget instance. Notitifcation content is limited to one single line and a widget instance
279
- * can only have one active notification at a time
297
+ * @deprecated This feature is no longer available. It will be removed in a future release.
280
298
  */
281
299
  publishNotification?: (content: string, expirationDateTime: Date) => void;
282
300
  /**
@@ -406,6 +424,21 @@ export interface WidgetManifestContext {
406
424
  */
407
425
  id: string;
408
426
  }
427
+ export interface WidgetDesignContext {
428
+ /** Available options in the ColorPicker.*/
429
+ colorOptions: ColorOption[];
430
+ /** Preferred border radius of UI elements.*/
431
+ borderRadius: number;
432
+ /** The height of a single row in the board grid. Use this to determine how many columns high a widget is. */
433
+ rowHeight: number;
434
+ /** Design settings related to icon badges. */
435
+ badge: {
436
+ /** Background color of an icon badge. */
437
+ color: string;
438
+ /** Inner text color of an icon badge. */
439
+ textColor: string;
440
+ };
441
+ }
409
442
  export interface ValidationResult {
410
443
  isValid: boolean;
411
444
  errors: string[];
@@ -875,3 +908,8 @@ export interface BadgeProperties {
875
908
  count?: number;
876
909
  color?: string;
877
910
  }
911
+ export interface ColorOption {
912
+ id: string;
913
+ title: string;
914
+ color: string;
915
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ichicraft/widgets-widget-base",
3
- "version": "1.11.5",
3
+ "version": "1.12.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",