@elementor/editor-notifications 1.0.0 → 1.1.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/CHANGELOG.md +19 -0
- package/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +2 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/index.ts +1 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 1.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 10cbbe9: update `@elementor/ui` version
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [10cbbe9]
|
|
12
|
+
- @elementor/editor@0.19.0
|
|
13
|
+
|
|
14
|
+
## 1.0.1
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- 42c42ee: Remove side-effects
|
|
19
|
+
- Updated dependencies [42c42ee]
|
|
20
|
+
- @elementor/editor@0.18.6
|
|
21
|
+
|
|
3
22
|
## 1.0.0
|
|
4
23
|
|
|
5
24
|
### Major Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { VariantType } from 'notistack';
|
|
2
2
|
import { ButtonProps } from '@elementor/ui';
|
|
3
3
|
|
|
4
|
+
declare function init(): void;
|
|
5
|
+
|
|
4
6
|
type NotificationData = {
|
|
5
7
|
type: VariantType;
|
|
6
8
|
message: string | React.ReactNode;
|
|
@@ -11,4 +13,4 @@ type NotificationData = {
|
|
|
11
13
|
declare function notify(notification: NotificationData): void;
|
|
12
14
|
declare function NotifyReact(notification: NotificationData): void;
|
|
13
15
|
|
|
14
|
-
export { type NotificationData, NotifyReact, notify };
|
|
16
|
+
export { type NotificationData, NotifyReact, init, notify };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { VariantType } from 'notistack';
|
|
2
2
|
import { ButtonProps } from '@elementor/ui';
|
|
3
3
|
|
|
4
|
+
declare function init(): void;
|
|
5
|
+
|
|
4
6
|
type NotificationData = {
|
|
5
7
|
type: VariantType;
|
|
6
8
|
message: string | React.ReactNode;
|
|
@@ -11,4 +13,4 @@ type NotificationData = {
|
|
|
11
13
|
declare function notify(notification: NotificationData): void;
|
|
12
14
|
declare function NotifyReact(notification: NotificationData): void;
|
|
13
15
|
|
|
14
|
-
export { type NotificationData, NotifyReact, notify };
|
|
16
|
+
export { type NotificationData, NotifyReact, init, notify };
|
package/dist/index.js
CHANGED
|
@@ -31,6 +31,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
33
|
NotifyReact: () => NotifyReact,
|
|
34
|
+
init: () => init,
|
|
34
35
|
notify: () => notify
|
|
35
36
|
});
|
|
36
37
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -128,12 +129,10 @@ function init() {
|
|
|
128
129
|
component: notifications_default
|
|
129
130
|
});
|
|
130
131
|
}
|
|
131
|
-
|
|
132
|
-
// src/index.ts
|
|
133
|
-
init();
|
|
134
132
|
// Annotate the CommonJS export names for ESM import in node:
|
|
135
133
|
0 && (module.exports = {
|
|
136
134
|
NotifyReact,
|
|
135
|
+
init,
|
|
137
136
|
notify
|
|
138
137
|
});
|
|
139
138
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/init.ts","../src/components/notifications.tsx","../src/slice.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/init.ts","../src/components/notifications.tsx","../src/slice.ts"],"sourcesContent":["export { init } from './init';\n\nexport { type NotificationData } from './types';\nexport { NotifyReact, notify } from './components/notifications';\n","import { injectIntoTop } from '@elementor/editor';\nimport { __registerSlice as registerSlice } from '@elementor/store';\n\nimport Wrapper from './components/notifications';\nimport { notificationsSlice } from './slice';\n\nexport function init() {\n\tregisterSlice( notificationsSlice );\n\tinjectIntoTop( {\n\t\tid: 'notifications',\n\t\tcomponent: Wrapper,\n\t} );\n}\n","import * as React from 'react';\nimport { closeSnackbar, type SnackbarKey, SnackbarProvider, useSnackbar, type VariantType } from 'notistack';\nimport { __getStore as getStore, __useDispatch as useDispatch, __useSelector as useSelector } from '@elementor/store';\nimport { Button, CloseButton } from '@elementor/ui';\n\nimport { clearAction, notifyAction } from '../slice';\nimport { type NotificationData, type Notifications } from '../types';\n\nconst Handler = () => {\n\tconst { enqueueSnackbar } = useSnackbar();\n\tconst notifications = useSelector( ( state: { notifications: Notifications } ) => state.notifications );\n\tconst dispatch = useDispatch();\n\n\tif ( ! notifications ) {\n\t\treturn null;\n\t}\n\n\tObject.values( notifications ).forEach( ( notification: NotificationData ) => {\n\t\tconst action = ( key: SnackbarKey ) => (\n\t\t\t<>\n\t\t\t\t{ notification.additionalActionProps?.map( ( additionalAction, index ) => (\n\t\t\t\t\t<Button key={ index } { ...additionalAction } />\n\t\t\t\t) ) }\n\n\t\t\t\t<CloseButton\n\t\t\t\t\taria-label=\"close\"\n\t\t\t\t\tcolor=\"inherit\"\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tcloseSnackbar( key );\n\t\t\t\t\t\tdispatch( clearAction( { id: key } ) );\n\t\t\t\t\t} }\n\t\t\t\t></CloseButton>\n\t\t\t</>\n\t\t);\n\n\t\tenqueueSnackbar( notification.message, {\n\t\t\tvariant: notification.type as VariantType,\n\t\t\tkey: notification.id,\n\t\t\tonClose: () => dispatch( clearAction( { id: notification.id } ) ),\n\t\t\tpreventDuplicate: true,\n\t\t\taction,\n\t\t} );\n\t} );\n\n\treturn null;\n};\n\nconst Wrapper = () => {\n\treturn (\n\t\t<SnackbarProvider\n\t\t\tmaxSnack={ 3 }\n\t\t\tautoHideDuration={ 8000 }\n\t\t\tanchorOrigin={ { horizontal: 'center', vertical: 'bottom' } }\n\t\t>\n\t\t\t<Handler />\n\t\t</SnackbarProvider>\n\t);\n};\n\n/*\n * This function can be used to trigger notifications from anywhere in the code.\n * even if you're running in a JS environment as opposed to a React environment.\n */\nexport function notify( notification: NotificationData ) {\n\tconst store = getStore();\n\n\tstore?.dispatch( notifyAction( notification ) );\n}\n\n/*\n * This function can be used to trigger notifications from within a React component.\n * This is the preferred way to trigger notifications.\n */\nexport function NotifyReact( notification: NotificationData ) {\n\tconst dispatch = useDispatch();\n\tdispatch( notifyAction( notification ) );\n}\n\nexport default Wrapper;\n","import { __createSlice as createSlice } from '@elementor/store';\n\nimport { type Notifications } from './types';\n\nexport const notificationsSlice = createSlice( {\n\tname: 'notifications',\n\tinitialState: {} as Notifications,\n\treducers: {\n\t\tnotifyAction: ( state, action ) => {\n\t\t\tconst newState = { ...state };\n\t\t\tif ( ! newState[ action.payload.id ] ) {\n\t\t\t\tnewState[ action.payload.id ] = action.payload;\n\t\t\t}\n\n\t\t\treturn newState;\n\t\t},\n\t\tclearAction: ( state, action ) => {\n\t\t\tconst newState = { ...state };\n\t\t\tif ( newState[ action.payload.id ] ) {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n\t\t\t\tdelete newState[ action.payload.id ];\n\t\t\t}\n\n\t\t\treturn newState;\n\t\t},\n\t},\n} );\n\nexport const { notifyAction, clearAction } = notificationsSlice.actions;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,oBAA8B;AAC9B,IAAAA,gBAAiD;;;ACDjD,YAAuB;AACvB,uBAAiG;AACjG,IAAAC,gBAAmG;AACnG,gBAAoC;;;ACHpC,mBAA6C;AAItC,IAAM,yBAAqB,aAAAC,eAAa;AAAA,EA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E,kBAAkB;AAAA,MAClB;AAAA,IACD,CAAE;AAAA,EACH,CAAE;AAEF,SAAO;AACR;AAEA,IAAM,UAAU,MAAM;AACrB,SACC;AAAA,IAAC;AAAA;AAAA,MACA,UAAW;AAAA,MACX,kBAAmB;AAAA,MACnB,cAAe,EAAE,YAAY,UAAU,UAAU,SAAS;AAAA;AAAA,IAE1D,oCAAC,aAAQ;AAAA,EACV;AAEF;AAMO,SAAS,OAAQ,cAAiC;AACxD,QAAM,YAAQ,cAAAC,YAAS;AAEvB,SAAO,SAAU,aAAc,YAAa,CAAE;AAC/C;AAMO,SAAS,YAAa,cAAiC;AAC7D,QAAM,eAAW,cAAAD,eAAY;AAC7B,WAAU,aAAc,YAAa,CAAE;AACxC;AAEA,IAAO,wBAAQ;;;ADxER,SAAS,OAAO;AACtB,oBAAAE,iBAAe,kBAAmB;AAClC,mCAAe;AAAA,IACd,IAAI;AAAA,IACJ,WAAW;AAAA,EACZ,CAAE;AACH;","names":["import_store","import_store","createSlice","useSelector","useDispatch","getStore","registerSlice"]}
|
package/dist/index.mjs
CHANGED
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/init.ts","../src/components/notifications.tsx","../src/slice.ts"
|
|
1
|
+
{"version":3,"sources":["../src/init.ts","../src/components/notifications.tsx","../src/slice.ts"],"sourcesContent":["import { injectIntoTop } from '@elementor/editor';\nimport { __registerSlice as registerSlice } from '@elementor/store';\n\nimport Wrapper from './components/notifications';\nimport { notificationsSlice } from './slice';\n\nexport function init() {\n\tregisterSlice( notificationsSlice );\n\tinjectIntoTop( {\n\t\tid: 'notifications',\n\t\tcomponent: Wrapper,\n\t} );\n}\n","import * as React from 'react';\nimport { closeSnackbar, type SnackbarKey, SnackbarProvider, useSnackbar, type VariantType } from 'notistack';\nimport { __getStore as getStore, __useDispatch as useDispatch, __useSelector as useSelector } from '@elementor/store';\nimport { Button, CloseButton } from '@elementor/ui';\n\nimport { clearAction, notifyAction } from '../slice';\nimport { type NotificationData, type Notifications } from '../types';\n\nconst Handler = () => {\n\tconst { enqueueSnackbar } = useSnackbar();\n\tconst notifications = useSelector( ( state: { notifications: Notifications } ) => state.notifications );\n\tconst dispatch = useDispatch();\n\n\tif ( ! notifications ) {\n\t\treturn null;\n\t}\n\n\tObject.values( notifications ).forEach( ( notification: NotificationData ) => {\n\t\tconst action = ( key: SnackbarKey ) => (\n\t\t\t<>\n\t\t\t\t{ notification.additionalActionProps?.map( ( additionalAction, index ) => (\n\t\t\t\t\t<Button key={ index } { ...additionalAction } />\n\t\t\t\t) ) }\n\n\t\t\t\t<CloseButton\n\t\t\t\t\taria-label=\"close\"\n\t\t\t\t\tcolor=\"inherit\"\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tcloseSnackbar( key );\n\t\t\t\t\t\tdispatch( clearAction( { id: key } ) );\n\t\t\t\t\t} }\n\t\t\t\t></CloseButton>\n\t\t\t</>\n\t\t);\n\n\t\tenqueueSnackbar( notification.message, {\n\t\t\tvariant: notification.type as VariantType,\n\t\t\tkey: notification.id,\n\t\t\tonClose: () => dispatch( clearAction( { id: notification.id } ) ),\n\t\t\tpreventDuplicate: true,\n\t\t\taction,\n\t\t} );\n\t} );\n\n\treturn null;\n};\n\nconst Wrapper = () => {\n\treturn (\n\t\t<SnackbarProvider\n\t\t\tmaxSnack={ 3 }\n\t\t\tautoHideDuration={ 8000 }\n\t\t\tanchorOrigin={ { horizontal: 'center', vertical: 'bottom' } }\n\t\t>\n\t\t\t<Handler />\n\t\t</SnackbarProvider>\n\t);\n};\n\n/*\n * This function can be used to trigger notifications from anywhere in the code.\n * even if you're running in a JS environment as opposed to a React environment.\n */\nexport function notify( notification: NotificationData ) {\n\tconst store = getStore();\n\n\tstore?.dispatch( notifyAction( notification ) );\n}\n\n/*\n * This function can be used to trigger notifications from within a React component.\n * This is the preferred way to trigger notifications.\n */\nexport function NotifyReact( notification: NotificationData ) {\n\tconst dispatch = useDispatch();\n\tdispatch( notifyAction( notification ) );\n}\n\nexport default Wrapper;\n","import { __createSlice as createSlice } from '@elementor/store';\n\nimport { type Notifications } from './types';\n\nexport const notificationsSlice = createSlice( {\n\tname: 'notifications',\n\tinitialState: {} as Notifications,\n\treducers: {\n\t\tnotifyAction: ( state, action ) => {\n\t\t\tconst newState = { ...state };\n\t\t\tif ( ! newState[ action.payload.id ] ) {\n\t\t\t\tnewState[ action.payload.id ] = action.payload;\n\t\t\t}\n\n\t\t\treturn newState;\n\t\t},\n\t\tclearAction: ( state, action ) => {\n\t\t\tconst newState = { ...state };\n\t\t\tif ( newState[ action.payload.id ] ) {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n\t\t\t\tdelete newState[ action.payload.id ];\n\t\t\t}\n\n\t\t\treturn newState;\n\t\t},\n\t},\n} );\n\nexport const { notifyAction, clearAction } = notificationsSlice.actions;\n"],"mappings":";AAAA,SAAS,qBAAqB;AAC9B,SAAS,mBAAmB,qBAAqB;;;ACDjD,YAAY,WAAW;AACvB,SAAS,eAAiC,kBAAkB,mBAAqC;AACjG,SAAS,cAAc,UAAU,iBAAiB,aAAa,iBAAiB,mBAAmB;AACnG,SAAS,QAAQ,mBAAmB;;;ACHpC,SAAS,iBAAiB,mBAAmB;AAItC,IAAM,qBAAqB,YAAa;AAAA,EAC9C,MAAM;AAAA,EACN,cAAc,CAAC;AAAA,EACf,UAAU;AAAA,IACT,cAAc,CAAE,OAAO,WAAY;AAClC,YAAM,WAAW,EAAE,GAAG,MAAM;AAC5B,UAAK,CAAE,SAAU,OAAO,QAAQ,EAAG,GAAI;AACtC,iBAAU,OAAO,QAAQ,EAAG,IAAI,OAAO;AAAA,MACxC;AAEA,aAAO;AAAA,IACR;AAAA,IACA,aAAa,CAAE,OAAO,WAAY;AACjC,YAAM,WAAW,EAAE,GAAG,MAAM;AAC5B,UAAK,SAAU,OAAO,QAAQ,EAAG,GAAI;AAEpC,eAAO,SAAU,OAAO,QAAQ,EAAG;AAAA,M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Aa,CAAE;AACxC;AAEA,IAAO,wBAAQ;;;ADxER,SAAS,OAAO;AACtB,gBAAe,kBAAmB;AAClC,gBAAe;AAAA,IACd,IAAI;AAAA,IACJ,WAAW;AAAA,EACZ,CAAE;AACH;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elementor/editor-notifications",
|
|
3
3
|
"description": "Notifications manager for the Elementor editor",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.1.0",
|
|
5
5
|
"private": false,
|
|
6
6
|
"author": "Elementor Team",
|
|
7
7
|
"homepage": "https://elementor.com/",
|
|
@@ -40,9 +40,9 @@
|
|
|
40
40
|
"dev": "tsup --config=../../tsup.dev.ts"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@elementor/editor": "0.
|
|
43
|
+
"@elementor/editor": "0.19.0",
|
|
44
44
|
"@elementor/store": "0.9.0",
|
|
45
|
-
"@elementor/ui": "1.
|
|
45
|
+
"@elementor/ui": "1.33.2",
|
|
46
46
|
"notistack": "^3.0.2"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|