@silexlabs/grapesjs-notifications 0.0.2 → 0.0.4

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
@@ -19,7 +19,7 @@ Features
19
19
  * [x] Notification events
20
20
  * [x] Notification commands
21
21
  * [x] editor.NotificationManager API
22
- * [ ] Group notifications
22
+ * [x] Group notifications
23
23
 
24
24
  ### HTML
25
25
  ```html
@@ -78,13 +78,38 @@ API:
78
78
 
79
79
  | Option | Description | Type | Default |
80
80
  |-|-|-|-
81
- | `style` | Custom style for the notification | `object` | `{}` |
82
81
  | `timeout` | Default timeout for the notification in ms | `number` | No timeout |
83
82
  | `container` | Container for the notifications | `HTMLElement` | `document.body` |
84
83
  | `storeKey` | Store notifications in local storage under this key | `string` | No storage |
85
84
  | `icons` | Icons for the notification types | `object` | `{error: '\u2716', warning: '\u26A0', success: '\u2714', info: '\u2139'}` |
86
85
  | `i18n` | Internationalization | `object` | Check the values in locale/en.js |
87
86
  | `maxNotifications` | Maximum number of notifications to display | `number` | `5` |
87
+ | `reverse` | Reverse the order of the notifications | `boolean` | `false` |
88
+
89
+ ## Styling
90
+
91
+ Note that you are free to style the container since you provide it in the options. You also can change the icons from the options.
92
+
93
+ The notifications are styled using the following CSS classes:
94
+
95
+ * `.gjs-notification` - The notification container
96
+ * `.gjs-notification__group` - The notification group container
97
+ * `.gjs-notification__item` - The notification item
98
+ * `.gjs-notification__error` - The error notification
99
+ * `.gjs-notification__warning` - The warning notification
100
+ * `.gjs-notification__success` - The success notification
101
+ * `.gjs-notification__info` - The info notification
102
+ * `.gjs-notification__message` - The notification message
103
+ * `.gjs-notification__close` - The close button for the notification
104
+
105
+ ```css
106
+ .gjs-notification {
107
+ padding: 10px;
108
+ margin: 10px;
109
+ border-radius: 5px;
110
+ box-shadow: 0 0 5px rgba(0,0,0,.3);
111
+ }
112
+ ```
88
113
 
89
114
  ## Download
90
115
 
package/dist/index.d.ts CHANGED
@@ -4,6 +4,7 @@ import { StyleInfo } from 'lit/directives/style-map';
4
4
 
5
5
  export interface NotificationOptions {
6
6
  message: string;
7
+ group?: string;
7
8
  timeout?: number;
8
9
  component?: string | Component;
9
10
  type: "info" | "warning" | "error" | "success";
@@ -20,6 +21,7 @@ declare class Notification {
20
21
  protected editor: NotificationEditor;
21
22
  protected model: NotificationModel;
22
23
  component: Component | null;
24
+ group: string | null;
23
25
  timeoutRef: NodeJS.Timeout | undefined;
24
26
  message: string;
25
27
  type: "info" | "warning" | "error" | "success";
@@ -36,6 +38,7 @@ export interface NotificationManagerOptions {
36
38
  style: Readonly<StyleInfo>;
37
39
  container: HTMLElement;
38
40
  maxNotifications?: number;
41
+ reverse?: boolean;
39
42
  timeout?: number;
40
43
  storeKey?: string;
41
44
  icons?: {
package/locale/en.js CHANGED
@@ -6,7 +6,9 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = void 0;
7
7
  var _default = exports.default = {
8
8
  '@silexlabs/grapesjs-notifications': {
9
- 'Close': 'Dismiss',
10
- 'Select': 'Select component {componentName}'
9
+ 'Close': '\u2716 Dismiss',
10
+ 'CloseAll': '\u2716 Dismiss all',
11
+ 'Select': '\u2713 Select component {componentName}',
12
+ 'Show': '\u2193 Show'
11
13
  }
12
14
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@silexlabs/grapesjs-notifications",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "description": "This GrapesJs plugin is designed to enhance the user experience within the editor by providing a robust notification system. This plugin captures and displays various types of notifications including errors, warnings, and activities, thereby facilitating a more interactive and responsive interface.",
5
5
  "main": "dist/index.js",
6
6
  "repository": {