@wordpress/notices 3.30.0 → 4.0.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 +8 -0
- package/build/store/actions.js +1 -1
- package/build/store/actions.js.map +1 -1
- package/build/store/index.js +0 -2
- package/build/store/index.js.map +1 -1
- package/build-module/store/actions.js +1 -1
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/index.js +0 -2
- package/build-module/store/index.js.map +1 -1
- package/build-types/index.d.ts +2 -0
- package/build-types/index.d.ts.map +1 -0
- package/build-types/store/actions.d.ts +272 -0
- package/build-types/store/actions.d.ts.map +1 -0
- package/build-types/store/constants.d.ts +15 -0
- package/build-types/store/constants.d.ts.map +1 -0
- package/build-types/store/controls.d.ts +5 -0
- package/build-types/store/controls.d.ts.map +1 -0
- package/build-types/store/index.d.ts +9 -0
- package/build-types/store/index.d.ts.map +1 -0
- package/build-types/store/reducer.d.ts +12 -0
- package/build-types/store/reducer.d.ts.map +1 -0
- package/build-types/store/selectors.d.ts +107 -0
- package/build-types/store/selectors.d.ts.map +1 -0
- package/build-types/store/utils/on-sub-key.d.ts +3 -0
- package/build-types/store/utils/on-sub-key.d.ts.map +1 -0
- package/package.json +5 -4
- package/src/store/actions.js +1 -1
- package/src/store/index.js +0 -2
- package/tsconfig.json +11 -0
- package/tsconfig.tsbuildinfo +1 -0
package/CHANGELOG.md
CHANGED
@@ -2,6 +2,14 @@
|
|
2
2
|
|
3
3
|
## Unreleased
|
4
4
|
|
5
|
+
## 4.0.0 (2023-04-26)
|
6
|
+
|
7
|
+
### Breaking Change
|
8
|
+
|
9
|
+
- Publish Typescript build types to npm. ([#49650](https://github.com/WordPress/gutenberg/pull/49650))
|
10
|
+
|
11
|
+
## 3.31.0 (2023-04-12)
|
12
|
+
|
5
13
|
## 3.30.0 (2023-03-29)
|
6
14
|
|
7
15
|
## 3.29.0 (2023-03-15)
|
package/build/store/actions.js
CHANGED
@@ -30,7 +30,7 @@ let uniqueId = 0;
|
|
30
30
|
/**
|
31
31
|
* Returns an action object used in signalling that a notice is to be created.
|
32
32
|
*
|
33
|
-
* @param {string}
|
33
|
+
* @param {string|undefined} status Notice status ("info" if undefined is passed).
|
34
34
|
* @param {string} content Notice message.
|
35
35
|
* @param {Object} [options] Notice options.
|
36
36
|
* @param {string} [options.context='global'] Context under which to
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["@wordpress/notices/src/store/actions.js"],"names":["uniqueId","createNotice","status","DEFAULT_STATUS","content","options","speak","isDismissible","context","DEFAULT_CONTEXT","id","actions","type","__unstableHTML","icon","explicitDismiss","onDismiss","String","notice","spokenMessage","createSuccessNotice","createInfoNotice","createErrorNotice","createWarningNotice","removeNotice"],"mappings":";;;;;;;;;;;;AAGA;;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,IAAIA,QAAQ,GAAG,CAAf;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACO,SAASC,YAAT,GAAwE;AAAA,MAAjDC,MAAiD,uEAAxCC,yBAAwC;AAAA,MAAxBC,OAAwB;AAAA,MAAfC,OAAe,uEAAL,EAAK;AAC9E,QAAM;AACLC,IAAAA,KAAK,GAAG,IADH;AAELC,IAAAA,aAAa,GAAG,IAFX;AAGLC,IAAAA,OAAO,GAAGC,0BAHL;AAILC,IAAAA,EAAE,GAAI,GAAGF,OAAS,GAAG,EAAER,QAAU,EAJ5B;AAKLW,IAAAA,OAAO,GAAG,EALL;AAMLC,IAAAA,IAAI,GAAG,SANF;AAOLC,IAAAA,cAPK;AAQLC,IAAAA,IAAI,GAAG,IARF;AASLC,IAAAA,eAAe,GAAG,KATb;AAULC,IAAAA;AAVK,MAWFX,OAXJ,CAD8E,CAc9E;AACA;AACA;;AACAD,EAAAA,OAAO,GAAGa,MAAM,CAAEb,OAAF,CAAhB;AAEA,SAAO;AACNQ,IAAAA,IAAI,EAAE,eADA;AAENJ,IAAAA,OAFM;AAGNU,IAAAA,MAAM,EAAE;AACPR,MAAAA,EADO;AAEPR,MAAAA,MAFO;AAGPE,MAAAA,OAHO;AAIPe,MAAAA,aAAa,EAAEb,KAAK,GAAGF,OAAH,GAAa,IAJ1B;AAKPS,MAAAA,cALO;AAMPN,MAAAA,aANO;AAOPI,MAAAA,OAPO;AAQPC,MAAAA,IARO;AASPE,MAAAA,IATO;AAUPC,MAAAA,eAVO;AAWPC,MAAAA;AAXO;AAHF,GAAP;AAiBA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASI,mBAAT,CAA8BhB,OAA9B,EAAuCC,OAAvC,EAAiD;AACvD,SAAOJ,YAAY,CAAE,SAAF,EAAaG,OAAb,EAAsBC,OAAtB,CAAnB;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASgB,gBAAT,CAA2BjB,OAA3B,EAAoCC,OAApC,EAA8C;AACpD,SAAOJ,YAAY,CAAE,MAAF,EAAUG,OAAV,EAAmBC,OAAnB,CAAnB;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASiB,iBAAT,CAA4BlB,OAA5B,EAAqCC,OAArC,EAA+C;AACrD,SAAOJ,YAAY,CAAE,OAAF,EAAWG,OAAX,EAAoBC,OAApB,CAAnB;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASkB,mBAAT,CAA8BnB,OAA9B,EAAuCC,OAAvC,EAAiD;AACvD,SAAOJ,YAAY,CAAE,SAAF,EAAaG,OAAb,EAAsBC,OAAtB,CAAnB;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASmB,YAAT,CAAuBd,EAAvB,EAAuD;AAAA,MAA5BF,OAA4B,uEAAlBC,0BAAkB;AAC7D,SAAO;AACNG,IAAAA,IAAI,EAAE,eADA;AAENF,IAAAA,EAFM;AAGNF,IAAAA;AAHM,GAAP;AAKA","sourcesContent":["/**\n * Internal dependencies\n */\nimport { DEFAULT_CONTEXT, DEFAULT_STATUS } from './constants';\n\n/**\n * @typedef {Object} WPNoticeAction Object describing a user action option associated with a notice.\n *\n * @property {string} label Message to use as action label.\n * @property {?string} url Optional URL of resource if action incurs\n * browser navigation.\n * @property {?Function} onClick Optional function to invoke when action is\n * triggered by user.\n *\n */\n\nlet uniqueId = 0;\n\n/**\n * Returns an action object used in signalling that a notice is to be created.\n *\n * @param {string} [status='info'] Notice status.\n * @param {string} content Notice message.\n * @param {Object} [options] Notice options.\n * @param {string} [options.context='global'] Context under which to\n * group notice.\n * @param {string} [options.id] Identifier for notice.\n * Automatically assigned\n * if not specified.\n * @param {boolean} [options.isDismissible=true] Whether the notice can\n * be dismissed by user.\n * @param {string} [options.type='default'] Type of notice, one of\n * `default`, or `snackbar`.\n * @param {boolean} [options.speak=true] Whether the notice\n * content should be\n * announced to screen\n * readers.\n * @param {Array<WPNoticeAction>} [options.actions] User actions to be\n * presented with notice.\n * @param {string} [options.icon] An icon displayed with the notice.\n * Only used when type is set to `snackbar`.\n * @param {boolean} [options.explicitDismiss] Whether the notice includes\n * an explicit dismiss button and\n * can't be dismissed by clicking\n * the body of the notice. Only applies\n * when type is set to `snackbar`.\n * @param {Function} [options.onDismiss] Called when the notice is dismissed.\n *\n * @example\n * ```js\n * import { __ } from '@wordpress/i18n';\n * import { useDispatch } from '@wordpress/data';\n * import { store as noticesStore } from '@wordpress/notices';\n * import { Button } from '@wordpress/components';\n *\n * const ExampleComponent = () => {\n * const { createNotice } = useDispatch( noticesStore );\n * return (\n * <Button\n * onClick={ () => createNotice( 'success', __( 'Notice message' ) ) }\n * >\n * { __( 'Generate a success notice!' ) }\n * </Button>\n * );\n * };\n * ```\n *\n * @return {Object} Action object.\n */\nexport function createNotice( status = DEFAULT_STATUS, content, options = {} ) {\n\tconst {\n\t\tspeak = true,\n\t\tisDismissible = true,\n\t\tcontext = DEFAULT_CONTEXT,\n\t\tid = `${ context }${ ++uniqueId }`,\n\t\tactions = [],\n\t\ttype = 'default',\n\t\t__unstableHTML,\n\t\ticon = null,\n\t\texplicitDismiss = false,\n\t\tonDismiss,\n\t} = options;\n\n\t// The supported value shape of content is currently limited to plain text\n\t// strings. To avoid setting expectation that e.g. a WPElement could be\n\t// supported, cast to a string.\n\tcontent = String( content );\n\n\treturn {\n\t\ttype: 'CREATE_NOTICE',\n\t\tcontext,\n\t\tnotice: {\n\t\t\tid,\n\t\t\tstatus,\n\t\t\tcontent,\n\t\t\tspokenMessage: speak ? content : null,\n\t\t\t__unstableHTML,\n\t\t\tisDismissible,\n\t\t\tactions,\n\t\t\ttype,\n\t\t\ticon,\n\t\t\texplicitDismiss,\n\t\t\tonDismiss,\n\t\t},\n\t};\n}\n\n/**\n * Returns an action object used in signalling that a success notice is to be\n * created. Refer to `createNotice` for options documentation.\n *\n * @see createNotice\n *\n * @param {string} content Notice message.\n * @param {Object} [options] Optional notice options.\n *\n * @example\n * ```js\n * import { __ } from '@wordpress/i18n';\n * import { useDispatch } from '@wordpress/data';\n * import { store as noticesStore } from '@wordpress/notices';\n * import { Button } from '@wordpress/components';\n *\n * const ExampleComponent = () => {\n * const { createSuccessNotice } = useDispatch( noticesStore );\n * return (\n * <Button\n * onClick={ () =>\n * createSuccessNotice( __( 'Success!' ), {\n * type: 'snackbar',\n * icon: '🔥',\n * } )\n * }\n * >\n * { __( 'Generate a snackbar success notice!' ) }\n * </Button>\n * );\n * };\n * ```\n *\n * @return {Object} Action object.\n */\nexport function createSuccessNotice( content, options ) {\n\treturn createNotice( 'success', content, options );\n}\n\n/**\n * Returns an action object used in signalling that an info notice is to be\n * created. Refer to `createNotice` for options documentation.\n *\n * @see createNotice\n *\n * @param {string} content Notice message.\n * @param {Object} [options] Optional notice options.\n *\n * @example\n * ```js\n * import { __ } from '@wordpress/i18n';\n * import { useDispatch } from '@wordpress/data';\n * import { store as noticesStore } from '@wordpress/notices';\n * import { Button } from '@wordpress/components';\n *\n * const ExampleComponent = () => {\n * const { createInfoNotice } = useDispatch( noticesStore );\n * return (\n * <Button\n * onClick={ () =>\n * createInfoNotice( __( 'Something happened!' ), {\n * isDismissible: false,\n * } )\n * }\n * >\n * { __( 'Generate a notice that cannot be dismissed.' ) }\n * </Button>\n * );\n * };\n *```\n *\n * @return {Object} Action object.\n */\nexport function createInfoNotice( content, options ) {\n\treturn createNotice( 'info', content, options );\n}\n\n/**\n * Returns an action object used in signalling that an error notice is to be\n * created. Refer to `createNotice` for options documentation.\n *\n * @see createNotice\n *\n * @param {string} content Notice message.\n * @param {Object} [options] Optional notice options.\n *\n * @example\n * ```js\n * import { __ } from '@wordpress/i18n';\n * import { useDispatch } from '@wordpress/data';\n * import { store as noticesStore } from '@wordpress/notices';\n * import { Button } from '@wordpress/components';\n *\n * const ExampleComponent = () => {\n * const { createErrorNotice } = useDispatch( noticesStore );\n * return (\n * <Button\n * onClick={ () =>\n * createErrorNotice( __( 'An error occurred!' ), {\n * type: 'snackbar',\n * explicitDismiss: true,\n * } )\n * }\n * >\n * { __(\n * 'Generate an snackbar error notice with explicit dismiss button.'\n * ) }\n * </Button>\n * );\n * };\n * ```\n *\n * @return {Object} Action object.\n */\nexport function createErrorNotice( content, options ) {\n\treturn createNotice( 'error', content, options );\n}\n\n/**\n * Returns an action object used in signalling that a warning notice is to be\n * created. Refer to `createNotice` for options documentation.\n *\n * @see createNotice\n *\n * @param {string} content Notice message.\n * @param {Object} [options] Optional notice options.\n *\n * @example\n * ```js\n * import { __ } from '@wordpress/i18n';\n * import { useDispatch } from '@wordpress/data';\n * import { store as noticesStore } from '@wordpress/notices';\n * import { Button } from '@wordpress/components';\n *\n * const ExampleComponent = () => {\n * const { createWarningNotice, createInfoNotice } = useDispatch( noticesStore );\n * return (\n * <Button\n * onClick={ () =>\n * createWarningNotice( __( 'Warning!' ), {\n * onDismiss: () => {\n * createInfoNotice(\n * __( 'The warning has been dismissed!' )\n * );\n * },\n * } )\n * }\n * >\n * { __( 'Generates a warning notice with onDismiss callback' ) }\n * </Button>\n * );\n * };\n * ```\n *\n * @return {Object} Action object.\n */\nexport function createWarningNotice( content, options ) {\n\treturn createNotice( 'warning', content, options );\n}\n\n/**\n * Returns an action object used in signalling that a notice is to be removed.\n *\n * @param {string} id Notice unique identifier.\n * @param {string} [context='global'] Optional context (grouping) in which the notice is\n * intended to appear. Defaults to default context.\n *\n * @example\n * ```js\n * import { __ } from '@wordpress/i18n';\n * import { useDispatch } from '@wordpress/data';\n * import { store as noticesStore } from '@wordpress/notices';\n * import { Button } from '@wordpress/components';\n *\n * const ExampleComponent = () => {\n * const notices = useSelect( ( select ) => select( noticesStore ).getNotices() );\n * const { createWarningNotice, removeNotice } = useDispatch( noticesStore );\n *\n * return (\n * <>\n * <Button\n * onClick={ () =>\n * createWarningNotice( __( 'Warning!' ), {\n * isDismissible: false,\n * } )\n * }\n * >\n * { __( 'Generate a notice' ) }\n * </Button>\n * { notices.length > 0 && (\n * <Button onClick={ () => removeNotice( notices[ 0 ].id ) }>\n * { __( 'Remove the notice' ) }\n * </Button>\n * ) }\n * </>\n * );\n *};\n * ```\n *\n * @return {Object} Action object.\n */\nexport function removeNotice( id, context = DEFAULT_CONTEXT ) {\n\treturn {\n\t\ttype: 'REMOVE_NOTICE',\n\t\tid,\n\t\tcontext,\n\t};\n}\n"]}
|
1
|
+
{"version":3,"sources":["@wordpress/notices/src/store/actions.js"],"names":["uniqueId","createNotice","status","DEFAULT_STATUS","content","options","speak","isDismissible","context","DEFAULT_CONTEXT","id","actions","type","__unstableHTML","icon","explicitDismiss","onDismiss","String","notice","spokenMessage","createSuccessNotice","createInfoNotice","createErrorNotice","createWarningNotice","removeNotice"],"mappings":";;;;;;;;;;;;AAGA;;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,IAAIA,QAAQ,GAAG,CAAf;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACO,SAASC,YAAT,GAAwE;AAAA,MAAjDC,MAAiD,uEAAxCC,yBAAwC;AAAA,MAAxBC,OAAwB;AAAA,MAAfC,OAAe,uEAAL,EAAK;AAC9E,QAAM;AACLC,IAAAA,KAAK,GAAG,IADH;AAELC,IAAAA,aAAa,GAAG,IAFX;AAGLC,IAAAA,OAAO,GAAGC,0BAHL;AAILC,IAAAA,EAAE,GAAI,GAAGF,OAAS,GAAG,EAAER,QAAU,EAJ5B;AAKLW,IAAAA,OAAO,GAAG,EALL;AAMLC,IAAAA,IAAI,GAAG,SANF;AAOLC,IAAAA,cAPK;AAQLC,IAAAA,IAAI,GAAG,IARF;AASLC,IAAAA,eAAe,GAAG,KATb;AAULC,IAAAA;AAVK,MAWFX,OAXJ,CAD8E,CAc9E;AACA;AACA;;AACAD,EAAAA,OAAO,GAAGa,MAAM,CAAEb,OAAF,CAAhB;AAEA,SAAO;AACNQ,IAAAA,IAAI,EAAE,eADA;AAENJ,IAAAA,OAFM;AAGNU,IAAAA,MAAM,EAAE;AACPR,MAAAA,EADO;AAEPR,MAAAA,MAFO;AAGPE,MAAAA,OAHO;AAIPe,MAAAA,aAAa,EAAEb,KAAK,GAAGF,OAAH,GAAa,IAJ1B;AAKPS,MAAAA,cALO;AAMPN,MAAAA,aANO;AAOPI,MAAAA,OAPO;AAQPC,MAAAA,IARO;AASPE,MAAAA,IATO;AAUPC,MAAAA,eAVO;AAWPC,MAAAA;AAXO;AAHF,GAAP;AAiBA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASI,mBAAT,CAA8BhB,OAA9B,EAAuCC,OAAvC,EAAiD;AACvD,SAAOJ,YAAY,CAAE,SAAF,EAAaG,OAAb,EAAsBC,OAAtB,CAAnB;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASgB,gBAAT,CAA2BjB,OAA3B,EAAoCC,OAApC,EAA8C;AACpD,SAAOJ,YAAY,CAAE,MAAF,EAAUG,OAAV,EAAmBC,OAAnB,CAAnB;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASiB,iBAAT,CAA4BlB,OAA5B,EAAqCC,OAArC,EAA+C;AACrD,SAAOJ,YAAY,CAAE,OAAF,EAAWG,OAAX,EAAoBC,OAApB,CAAnB;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASkB,mBAAT,CAA8BnB,OAA9B,EAAuCC,OAAvC,EAAiD;AACvD,SAAOJ,YAAY,CAAE,SAAF,EAAaG,OAAb,EAAsBC,OAAtB,CAAnB;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASmB,YAAT,CAAuBd,EAAvB,EAAuD;AAAA,MAA5BF,OAA4B,uEAAlBC,0BAAkB;AAC7D,SAAO;AACNG,IAAAA,IAAI,EAAE,eADA;AAENF,IAAAA,EAFM;AAGNF,IAAAA;AAHM,GAAP;AAKA","sourcesContent":["/**\n * Internal dependencies\n */\nimport { DEFAULT_CONTEXT, DEFAULT_STATUS } from './constants';\n\n/**\n * @typedef {Object} WPNoticeAction Object describing a user action option associated with a notice.\n *\n * @property {string} label Message to use as action label.\n * @property {?string} url Optional URL of resource if action incurs\n * browser navigation.\n * @property {?Function} onClick Optional function to invoke when action is\n * triggered by user.\n *\n */\n\nlet uniqueId = 0;\n\n/**\n * Returns an action object used in signalling that a notice is to be created.\n *\n * @param {string|undefined} status Notice status (\"info\" if undefined is passed).\n * @param {string} content Notice message.\n * @param {Object} [options] Notice options.\n * @param {string} [options.context='global'] Context under which to\n * group notice.\n * @param {string} [options.id] Identifier for notice.\n * Automatically assigned\n * if not specified.\n * @param {boolean} [options.isDismissible=true] Whether the notice can\n * be dismissed by user.\n * @param {string} [options.type='default'] Type of notice, one of\n * `default`, or `snackbar`.\n * @param {boolean} [options.speak=true] Whether the notice\n * content should be\n * announced to screen\n * readers.\n * @param {Array<WPNoticeAction>} [options.actions] User actions to be\n * presented with notice.\n * @param {string} [options.icon] An icon displayed with the notice.\n * Only used when type is set to `snackbar`.\n * @param {boolean} [options.explicitDismiss] Whether the notice includes\n * an explicit dismiss button and\n * can't be dismissed by clicking\n * the body of the notice. Only applies\n * when type is set to `snackbar`.\n * @param {Function} [options.onDismiss] Called when the notice is dismissed.\n *\n * @example\n * ```js\n * import { __ } from '@wordpress/i18n';\n * import { useDispatch } from '@wordpress/data';\n * import { store as noticesStore } from '@wordpress/notices';\n * import { Button } from '@wordpress/components';\n *\n * const ExampleComponent = () => {\n * const { createNotice } = useDispatch( noticesStore );\n * return (\n * <Button\n * onClick={ () => createNotice( 'success', __( 'Notice message' ) ) }\n * >\n * { __( 'Generate a success notice!' ) }\n * </Button>\n * );\n * };\n * ```\n *\n * @return {Object} Action object.\n */\nexport function createNotice( status = DEFAULT_STATUS, content, options = {} ) {\n\tconst {\n\t\tspeak = true,\n\t\tisDismissible = true,\n\t\tcontext = DEFAULT_CONTEXT,\n\t\tid = `${ context }${ ++uniqueId }`,\n\t\tactions = [],\n\t\ttype = 'default',\n\t\t__unstableHTML,\n\t\ticon = null,\n\t\texplicitDismiss = false,\n\t\tonDismiss,\n\t} = options;\n\n\t// The supported value shape of content is currently limited to plain text\n\t// strings. To avoid setting expectation that e.g. a WPElement could be\n\t// supported, cast to a string.\n\tcontent = String( content );\n\n\treturn {\n\t\ttype: 'CREATE_NOTICE',\n\t\tcontext,\n\t\tnotice: {\n\t\t\tid,\n\t\t\tstatus,\n\t\t\tcontent,\n\t\t\tspokenMessage: speak ? content : null,\n\t\t\t__unstableHTML,\n\t\t\tisDismissible,\n\t\t\tactions,\n\t\t\ttype,\n\t\t\ticon,\n\t\t\texplicitDismiss,\n\t\t\tonDismiss,\n\t\t},\n\t};\n}\n\n/**\n * Returns an action object used in signalling that a success notice is to be\n * created. Refer to `createNotice` for options documentation.\n *\n * @see createNotice\n *\n * @param {string} content Notice message.\n * @param {Object} [options] Optional notice options.\n *\n * @example\n * ```js\n * import { __ } from '@wordpress/i18n';\n * import { useDispatch } from '@wordpress/data';\n * import { store as noticesStore } from '@wordpress/notices';\n * import { Button } from '@wordpress/components';\n *\n * const ExampleComponent = () => {\n * const { createSuccessNotice } = useDispatch( noticesStore );\n * return (\n * <Button\n * onClick={ () =>\n * createSuccessNotice( __( 'Success!' ), {\n * type: 'snackbar',\n * icon: '🔥',\n * } )\n * }\n * >\n * { __( 'Generate a snackbar success notice!' ) }\n * </Button>\n * );\n * };\n * ```\n *\n * @return {Object} Action object.\n */\nexport function createSuccessNotice( content, options ) {\n\treturn createNotice( 'success', content, options );\n}\n\n/**\n * Returns an action object used in signalling that an info notice is to be\n * created. Refer to `createNotice` for options documentation.\n *\n * @see createNotice\n *\n * @param {string} content Notice message.\n * @param {Object} [options] Optional notice options.\n *\n * @example\n * ```js\n * import { __ } from '@wordpress/i18n';\n * import { useDispatch } from '@wordpress/data';\n * import { store as noticesStore } from '@wordpress/notices';\n * import { Button } from '@wordpress/components';\n *\n * const ExampleComponent = () => {\n * const { createInfoNotice } = useDispatch( noticesStore );\n * return (\n * <Button\n * onClick={ () =>\n * createInfoNotice( __( 'Something happened!' ), {\n * isDismissible: false,\n * } )\n * }\n * >\n * { __( 'Generate a notice that cannot be dismissed.' ) }\n * </Button>\n * );\n * };\n *```\n *\n * @return {Object} Action object.\n */\nexport function createInfoNotice( content, options ) {\n\treturn createNotice( 'info', content, options );\n}\n\n/**\n * Returns an action object used in signalling that an error notice is to be\n * created. Refer to `createNotice` for options documentation.\n *\n * @see createNotice\n *\n * @param {string} content Notice message.\n * @param {Object} [options] Optional notice options.\n *\n * @example\n * ```js\n * import { __ } from '@wordpress/i18n';\n * import { useDispatch } from '@wordpress/data';\n * import { store as noticesStore } from '@wordpress/notices';\n * import { Button } from '@wordpress/components';\n *\n * const ExampleComponent = () => {\n * const { createErrorNotice } = useDispatch( noticesStore );\n * return (\n * <Button\n * onClick={ () =>\n * createErrorNotice( __( 'An error occurred!' ), {\n * type: 'snackbar',\n * explicitDismiss: true,\n * } )\n * }\n * >\n * { __(\n * 'Generate an snackbar error notice with explicit dismiss button.'\n * ) }\n * </Button>\n * );\n * };\n * ```\n *\n * @return {Object} Action object.\n */\nexport function createErrorNotice( content, options ) {\n\treturn createNotice( 'error', content, options );\n}\n\n/**\n * Returns an action object used in signalling that a warning notice is to be\n * created. Refer to `createNotice` for options documentation.\n *\n * @see createNotice\n *\n * @param {string} content Notice message.\n * @param {Object} [options] Optional notice options.\n *\n * @example\n * ```js\n * import { __ } from '@wordpress/i18n';\n * import { useDispatch } from '@wordpress/data';\n * import { store as noticesStore } from '@wordpress/notices';\n * import { Button } from '@wordpress/components';\n *\n * const ExampleComponent = () => {\n * const { createWarningNotice, createInfoNotice } = useDispatch( noticesStore );\n * return (\n * <Button\n * onClick={ () =>\n * createWarningNotice( __( 'Warning!' ), {\n * onDismiss: () => {\n * createInfoNotice(\n * __( 'The warning has been dismissed!' )\n * );\n * },\n * } )\n * }\n * >\n * { __( 'Generates a warning notice with onDismiss callback' ) }\n * </Button>\n * );\n * };\n * ```\n *\n * @return {Object} Action object.\n */\nexport function createWarningNotice( content, options ) {\n\treturn createNotice( 'warning', content, options );\n}\n\n/**\n * Returns an action object used in signalling that a notice is to be removed.\n *\n * @param {string} id Notice unique identifier.\n * @param {string} [context='global'] Optional context (grouping) in which the notice is\n * intended to appear. Defaults to default context.\n *\n * @example\n * ```js\n * import { __ } from '@wordpress/i18n';\n * import { useDispatch } from '@wordpress/data';\n * import { store as noticesStore } from '@wordpress/notices';\n * import { Button } from '@wordpress/components';\n *\n * const ExampleComponent = () => {\n * const notices = useSelect( ( select ) => select( noticesStore ).getNotices() );\n * const { createWarningNotice, removeNotice } = useDispatch( noticesStore );\n *\n * return (\n * <>\n * <Button\n * onClick={ () =>\n * createWarningNotice( __( 'Warning!' ), {\n * isDismissible: false,\n * } )\n * }\n * >\n * { __( 'Generate a notice' ) }\n * </Button>\n * { notices.length > 0 && (\n * <Button onClick={ () => removeNotice( notices[ 0 ].id ) }>\n * { __( 'Remove the notice' ) }\n * </Button>\n * ) }\n * </>\n * );\n *};\n * ```\n *\n * @return {Object} Action object.\n */\nexport function removeNotice( id, context = DEFAULT_CONTEXT ) {\n\treturn {\n\t\ttype: 'REMOVE_NOTICE',\n\t\tid,\n\t\tcontext,\n\t};\n}\n"]}
|
package/build/store/index.js
CHANGED
@@ -31,8 +31,6 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
31
31
|
* Store definition for the notices namespace.
|
32
32
|
*
|
33
33
|
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore
|
34
|
-
*
|
35
|
-
* @type {Object}
|
36
34
|
*/
|
37
35
|
const store = (0, _data.createReduxStore)('core/notices', {
|
38
36
|
reducer: _reducer.default,
|
package/build/store/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["@wordpress/notices/src/store/index.js"],"names":["store","reducer","actions","selectors"],"mappings":";;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;;;;;AAVA;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;
|
1
|
+
{"version":3,"sources":["@wordpress/notices/src/store/index.js"],"names":["store","reducer","actions","selectors"],"mappings":";;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;;;;;AAVA;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACO,MAAMA,KAAK,GAAG,4BAAkB,cAAlB,EAAkC;AACtDC,EAAAA,OAAO,EAAPA,gBADsD;AAEtDC,EAAAA,OAFsD;AAGtDC,EAAAA;AAHsD,CAAlC,CAAd;;AAMP,oBAAUH,KAAV","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createReduxStore, register } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport reducer from './reducer';\nimport * as actions from './actions';\nimport * as selectors from './selectors';\n\n/**\n * Store definition for the notices namespace.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore\n */\nexport const store = createReduxStore( 'core/notices', {\n\treducer,\n\tactions,\n\tselectors,\n} );\n\nregister( store );\n"]}
|
@@ -17,7 +17,7 @@ let uniqueId = 0;
|
|
17
17
|
/**
|
18
18
|
* Returns an action object used in signalling that a notice is to be created.
|
19
19
|
*
|
20
|
-
* @param {string}
|
20
|
+
* @param {string|undefined} status Notice status ("info" if undefined is passed).
|
21
21
|
* @param {string} content Notice message.
|
22
22
|
* @param {Object} [options] Notice options.
|
23
23
|
* @param {string} [options.context='global'] Context under which to
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["@wordpress/notices/src/store/actions.js"],"names":["DEFAULT_CONTEXT","DEFAULT_STATUS","uniqueId","createNotice","status","content","options","speak","isDismissible","context","id","actions","type","__unstableHTML","icon","explicitDismiss","onDismiss","String","notice","spokenMessage","createSuccessNotice","createInfoNotice","createErrorNotice","createWarningNotice","removeNotice"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAT,EAA0BC,cAA1B,QAAgD,aAAhD;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,IAAIC,QAAQ,GAAG,CAAf;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,YAAT,GAAwE;AAAA,MAAjDC,MAAiD,uEAAxCH,cAAwC;AAAA,MAAxBI,OAAwB;AAAA,MAAfC,OAAe,uEAAL,EAAK;AAC9E,QAAM;AACLC,IAAAA,KAAK,GAAG,IADH;AAELC,IAAAA,aAAa,GAAG,IAFX;AAGLC,IAAAA,OAAO,GAAGT,eAHL;AAILU,IAAAA,EAAE,GAAI,GAAGD,OAAS,GAAG,EAAEP,QAAU,EAJ5B;AAKLS,IAAAA,OAAO,GAAG,EALL;AAMLC,IAAAA,IAAI,GAAG,SANF;AAOLC,IAAAA,cAPK;AAQLC,IAAAA,IAAI,GAAG,IARF;AASLC,IAAAA,eAAe,GAAG,KATb;AAULC,IAAAA;AAVK,MAWFV,OAXJ,CAD8E,CAc9E;AACA;AACA;;AACAD,EAAAA,OAAO,GAAGY,MAAM,CAAEZ,OAAF,CAAhB;AAEA,SAAO;AACNO,IAAAA,IAAI,EAAE,eADA;AAENH,IAAAA,OAFM;AAGNS,IAAAA,MAAM,EAAE;AACPR,MAAAA,EADO;AAEPN,MAAAA,MAFO;AAGPC,MAAAA,OAHO;AAIPc,MAAAA,aAAa,EAAEZ,KAAK,GAAGF,OAAH,GAAa,IAJ1B;AAKPQ,MAAAA,cALO;AAMPL,MAAAA,aANO;AAOPG,MAAAA,OAPO;AAQPC,MAAAA,IARO;AASPE,MAAAA,IATO;AAUPC,MAAAA,eAVO;AAWPC,MAAAA;AAXO;AAHF,GAAP;AAiBA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASI,mBAAT,CAA8Bf,OAA9B,EAAuCC,OAAvC,EAAiD;AACvD,SAAOH,YAAY,CAAE,SAAF,EAAaE,OAAb,EAAsBC,OAAtB,CAAnB;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASe,gBAAT,CAA2BhB,OAA3B,EAAoCC,OAApC,EAA8C;AACpD,SAAOH,YAAY,CAAE,MAAF,EAAUE,OAAV,EAAmBC,OAAnB,CAAnB;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASgB,iBAAT,CAA4BjB,OAA5B,EAAqCC,OAArC,EAA+C;AACrD,SAAOH,YAAY,CAAE,OAAF,EAAWE,OAAX,EAAoBC,OAApB,CAAnB;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASiB,mBAAT,CAA8BlB,OAA9B,EAAuCC,OAAvC,EAAiD;AACvD,SAAOH,YAAY,CAAE,SAAF,EAAaE,OAAb,EAAsBC,OAAtB,CAAnB;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASkB,YAAT,CAAuBd,EAAvB,EAAuD;AAAA,MAA5BD,OAA4B,uEAAlBT,eAAkB;AAC7D,SAAO;AACNY,IAAAA,IAAI,EAAE,eADA;AAENF,IAAAA,EAFM;AAGND,IAAAA;AAHM,GAAP;AAKA","sourcesContent":["/**\n * Internal dependencies\n */\nimport { DEFAULT_CONTEXT, DEFAULT_STATUS } from './constants';\n\n/**\n * @typedef {Object} WPNoticeAction Object describing a user action option associated with a notice.\n *\n * @property {string} label Message to use as action label.\n * @property {?string} url Optional URL of resource if action incurs\n * browser navigation.\n * @property {?Function} onClick Optional function to invoke when action is\n * triggered by user.\n *\n */\n\nlet uniqueId = 0;\n\n/**\n * Returns an action object used in signalling that a notice is to be created.\n *\n * @param {string} [status='info'] Notice status.\n * @param {string} content Notice message.\n * @param {Object} [options] Notice options.\n * @param {string} [options.context='global'] Context under which to\n * group notice.\n * @param {string} [options.id] Identifier for notice.\n * Automatically assigned\n * if not specified.\n * @param {boolean} [options.isDismissible=true] Whether the notice can\n * be dismissed by user.\n * @param {string} [options.type='default'] Type of notice, one of\n * `default`, or `snackbar`.\n * @param {boolean} [options.speak=true] Whether the notice\n * content should be\n * announced to screen\n * readers.\n * @param {Array<WPNoticeAction>} [options.actions] User actions to be\n * presented with notice.\n * @param {string} [options.icon] An icon displayed with the notice.\n * Only used when type is set to `snackbar`.\n * @param {boolean} [options.explicitDismiss] Whether the notice includes\n * an explicit dismiss button and\n * can't be dismissed by clicking\n * the body of the notice. Only applies\n * when type is set to `snackbar`.\n * @param {Function} [options.onDismiss] Called when the notice is dismissed.\n *\n * @example\n * ```js\n * import { __ } from '@wordpress/i18n';\n * import { useDispatch } from '@wordpress/data';\n * import { store as noticesStore } from '@wordpress/notices';\n * import { Button } from '@wordpress/components';\n *\n * const ExampleComponent = () => {\n * const { createNotice } = useDispatch( noticesStore );\n * return (\n * <Button\n * onClick={ () => createNotice( 'success', __( 'Notice message' ) ) }\n * >\n * { __( 'Generate a success notice!' ) }\n * </Button>\n * );\n * };\n * ```\n *\n * @return {Object} Action object.\n */\nexport function createNotice( status = DEFAULT_STATUS, content, options = {} ) {\n\tconst {\n\t\tspeak = true,\n\t\tisDismissible = true,\n\t\tcontext = DEFAULT_CONTEXT,\n\t\tid = `${ context }${ ++uniqueId }`,\n\t\tactions = [],\n\t\ttype = 'default',\n\t\t__unstableHTML,\n\t\ticon = null,\n\t\texplicitDismiss = false,\n\t\tonDismiss,\n\t} = options;\n\n\t// The supported value shape of content is currently limited to plain text\n\t// strings. To avoid setting expectation that e.g. a WPElement could be\n\t// supported, cast to a string.\n\tcontent = String( content );\n\n\treturn {\n\t\ttype: 'CREATE_NOTICE',\n\t\tcontext,\n\t\tnotice: {\n\t\t\tid,\n\t\t\tstatus,\n\t\t\tcontent,\n\t\t\tspokenMessage: speak ? content : null,\n\t\t\t__unstableHTML,\n\t\t\tisDismissible,\n\t\t\tactions,\n\t\t\ttype,\n\t\t\ticon,\n\t\t\texplicitDismiss,\n\t\t\tonDismiss,\n\t\t},\n\t};\n}\n\n/**\n * Returns an action object used in signalling that a success notice is to be\n * created. Refer to `createNotice` for options documentation.\n *\n * @see createNotice\n *\n * @param {string} content Notice message.\n * @param {Object} [options] Optional notice options.\n *\n * @example\n * ```js\n * import { __ } from '@wordpress/i18n';\n * import { useDispatch } from '@wordpress/data';\n * import { store as noticesStore } from '@wordpress/notices';\n * import { Button } from '@wordpress/components';\n *\n * const ExampleComponent = () => {\n * const { createSuccessNotice } = useDispatch( noticesStore );\n * return (\n * <Button\n * onClick={ () =>\n * createSuccessNotice( __( 'Success!' ), {\n * type: 'snackbar',\n * icon: '🔥',\n * } )\n * }\n * >\n * { __( 'Generate a snackbar success notice!' ) }\n * </Button>\n * );\n * };\n * ```\n *\n * @return {Object} Action object.\n */\nexport function createSuccessNotice( content, options ) {\n\treturn createNotice( 'success', content, options );\n}\n\n/**\n * Returns an action object used in signalling that an info notice is to be\n * created. Refer to `createNotice` for options documentation.\n *\n * @see createNotice\n *\n * @param {string} content Notice message.\n * @param {Object} [options] Optional notice options.\n *\n * @example\n * ```js\n * import { __ } from '@wordpress/i18n';\n * import { useDispatch } from '@wordpress/data';\n * import { store as noticesStore } from '@wordpress/notices';\n * import { Button } from '@wordpress/components';\n *\n * const ExampleComponent = () => {\n * const { createInfoNotice } = useDispatch( noticesStore );\n * return (\n * <Button\n * onClick={ () =>\n * createInfoNotice( __( 'Something happened!' ), {\n * isDismissible: false,\n * } )\n * }\n * >\n * { __( 'Generate a notice that cannot be dismissed.' ) }\n * </Button>\n * );\n * };\n *```\n *\n * @return {Object} Action object.\n */\nexport function createInfoNotice( content, options ) {\n\treturn createNotice( 'info', content, options );\n}\n\n/**\n * Returns an action object used in signalling that an error notice is to be\n * created. Refer to `createNotice` for options documentation.\n *\n * @see createNotice\n *\n * @param {string} content Notice message.\n * @param {Object} [options] Optional notice options.\n *\n * @example\n * ```js\n * import { __ } from '@wordpress/i18n';\n * import { useDispatch } from '@wordpress/data';\n * import { store as noticesStore } from '@wordpress/notices';\n * import { Button } from '@wordpress/components';\n *\n * const ExampleComponent = () => {\n * const { createErrorNotice } = useDispatch( noticesStore );\n * return (\n * <Button\n * onClick={ () =>\n * createErrorNotice( __( 'An error occurred!' ), {\n * type: 'snackbar',\n * explicitDismiss: true,\n * } )\n * }\n * >\n * { __(\n * 'Generate an snackbar error notice with explicit dismiss button.'\n * ) }\n * </Button>\n * );\n * };\n * ```\n *\n * @return {Object} Action object.\n */\nexport function createErrorNotice( content, options ) {\n\treturn createNotice( 'error', content, options );\n}\n\n/**\n * Returns an action object used in signalling that a warning notice is to be\n * created. Refer to `createNotice` for options documentation.\n *\n * @see createNotice\n *\n * @param {string} content Notice message.\n * @param {Object} [options] Optional notice options.\n *\n * @example\n * ```js\n * import { __ } from '@wordpress/i18n';\n * import { useDispatch } from '@wordpress/data';\n * import { store as noticesStore } from '@wordpress/notices';\n * import { Button } from '@wordpress/components';\n *\n * const ExampleComponent = () => {\n * const { createWarningNotice, createInfoNotice } = useDispatch( noticesStore );\n * return (\n * <Button\n * onClick={ () =>\n * createWarningNotice( __( 'Warning!' ), {\n * onDismiss: () => {\n * createInfoNotice(\n * __( 'The warning has been dismissed!' )\n * );\n * },\n * } )\n * }\n * >\n * { __( 'Generates a warning notice with onDismiss callback' ) }\n * </Button>\n * );\n * };\n * ```\n *\n * @return {Object} Action object.\n */\nexport function createWarningNotice( content, options ) {\n\treturn createNotice( 'warning', content, options );\n}\n\n/**\n * Returns an action object used in signalling that a notice is to be removed.\n *\n * @param {string} id Notice unique identifier.\n * @param {string} [context='global'] Optional context (grouping) in which the notice is\n * intended to appear. Defaults to default context.\n *\n * @example\n * ```js\n * import { __ } from '@wordpress/i18n';\n * import { useDispatch } from '@wordpress/data';\n * import { store as noticesStore } from '@wordpress/notices';\n * import { Button } from '@wordpress/components';\n *\n * const ExampleComponent = () => {\n * const notices = useSelect( ( select ) => select( noticesStore ).getNotices() );\n * const { createWarningNotice, removeNotice } = useDispatch( noticesStore );\n *\n * return (\n * <>\n * <Button\n * onClick={ () =>\n * createWarningNotice( __( 'Warning!' ), {\n * isDismissible: false,\n * } )\n * }\n * >\n * { __( 'Generate a notice' ) }\n * </Button>\n * { notices.length > 0 && (\n * <Button onClick={ () => removeNotice( notices[ 0 ].id ) }>\n * { __( 'Remove the notice' ) }\n * </Button>\n * ) }\n * </>\n * );\n *};\n * ```\n *\n * @return {Object} Action object.\n */\nexport function removeNotice( id, context = DEFAULT_CONTEXT ) {\n\treturn {\n\t\ttype: 'REMOVE_NOTICE',\n\t\tid,\n\t\tcontext,\n\t};\n}\n"]}
|
1
|
+
{"version":3,"sources":["@wordpress/notices/src/store/actions.js"],"names":["DEFAULT_CONTEXT","DEFAULT_STATUS","uniqueId","createNotice","status","content","options","speak","isDismissible","context","id","actions","type","__unstableHTML","icon","explicitDismiss","onDismiss","String","notice","spokenMessage","createSuccessNotice","createInfoNotice","createErrorNotice","createWarningNotice","removeNotice"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAT,EAA0BC,cAA1B,QAAgD,aAAhD;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,IAAIC,QAAQ,GAAG,CAAf;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,YAAT,GAAwE;AAAA,MAAjDC,MAAiD,uEAAxCH,cAAwC;AAAA,MAAxBI,OAAwB;AAAA,MAAfC,OAAe,uEAAL,EAAK;AAC9E,QAAM;AACLC,IAAAA,KAAK,GAAG,IADH;AAELC,IAAAA,aAAa,GAAG,IAFX;AAGLC,IAAAA,OAAO,GAAGT,eAHL;AAILU,IAAAA,EAAE,GAAI,GAAGD,OAAS,GAAG,EAAEP,QAAU,EAJ5B;AAKLS,IAAAA,OAAO,GAAG,EALL;AAMLC,IAAAA,IAAI,GAAG,SANF;AAOLC,IAAAA,cAPK;AAQLC,IAAAA,IAAI,GAAG,IARF;AASLC,IAAAA,eAAe,GAAG,KATb;AAULC,IAAAA;AAVK,MAWFV,OAXJ,CAD8E,CAc9E;AACA;AACA;;AACAD,EAAAA,OAAO,GAAGY,MAAM,CAAEZ,OAAF,CAAhB;AAEA,SAAO;AACNO,IAAAA,IAAI,EAAE,eADA;AAENH,IAAAA,OAFM;AAGNS,IAAAA,MAAM,EAAE;AACPR,MAAAA,EADO;AAEPN,MAAAA,MAFO;AAGPC,MAAAA,OAHO;AAIPc,MAAAA,aAAa,EAAEZ,KAAK,GAAGF,OAAH,GAAa,IAJ1B;AAKPQ,MAAAA,cALO;AAMPL,MAAAA,aANO;AAOPG,MAAAA,OAPO;AAQPC,MAAAA,IARO;AASPE,MAAAA,IATO;AAUPC,MAAAA,eAVO;AAWPC,MAAAA;AAXO;AAHF,GAAP;AAiBA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASI,mBAAT,CAA8Bf,OAA9B,EAAuCC,OAAvC,EAAiD;AACvD,SAAOH,YAAY,CAAE,SAAF,EAAaE,OAAb,EAAsBC,OAAtB,CAAnB;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASe,gBAAT,CAA2BhB,OAA3B,EAAoCC,OAApC,EAA8C;AACpD,SAAOH,YAAY,CAAE,MAAF,EAAUE,OAAV,EAAmBC,OAAnB,CAAnB;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASgB,iBAAT,CAA4BjB,OAA5B,EAAqCC,OAArC,EAA+C;AACrD,SAAOH,YAAY,CAAE,OAAF,EAAWE,OAAX,EAAoBC,OAApB,CAAnB;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASiB,mBAAT,CAA8BlB,OAA9B,EAAuCC,OAAvC,EAAiD;AACvD,SAAOH,YAAY,CAAE,SAAF,EAAaE,OAAb,EAAsBC,OAAtB,CAAnB;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASkB,YAAT,CAAuBd,EAAvB,EAAuD;AAAA,MAA5BD,OAA4B,uEAAlBT,eAAkB;AAC7D,SAAO;AACNY,IAAAA,IAAI,EAAE,eADA;AAENF,IAAAA,EAFM;AAGND,IAAAA;AAHM,GAAP;AAKA","sourcesContent":["/**\n * Internal dependencies\n */\nimport { DEFAULT_CONTEXT, DEFAULT_STATUS } from './constants';\n\n/**\n * @typedef {Object} WPNoticeAction Object describing a user action option associated with a notice.\n *\n * @property {string} label Message to use as action label.\n * @property {?string} url Optional URL of resource if action incurs\n * browser navigation.\n * @property {?Function} onClick Optional function to invoke when action is\n * triggered by user.\n *\n */\n\nlet uniqueId = 0;\n\n/**\n * Returns an action object used in signalling that a notice is to be created.\n *\n * @param {string|undefined} status Notice status (\"info\" if undefined is passed).\n * @param {string} content Notice message.\n * @param {Object} [options] Notice options.\n * @param {string} [options.context='global'] Context under which to\n * group notice.\n * @param {string} [options.id] Identifier for notice.\n * Automatically assigned\n * if not specified.\n * @param {boolean} [options.isDismissible=true] Whether the notice can\n * be dismissed by user.\n * @param {string} [options.type='default'] Type of notice, one of\n * `default`, or `snackbar`.\n * @param {boolean} [options.speak=true] Whether the notice\n * content should be\n * announced to screen\n * readers.\n * @param {Array<WPNoticeAction>} [options.actions] User actions to be\n * presented with notice.\n * @param {string} [options.icon] An icon displayed with the notice.\n * Only used when type is set to `snackbar`.\n * @param {boolean} [options.explicitDismiss] Whether the notice includes\n * an explicit dismiss button and\n * can't be dismissed by clicking\n * the body of the notice. Only applies\n * when type is set to `snackbar`.\n * @param {Function} [options.onDismiss] Called when the notice is dismissed.\n *\n * @example\n * ```js\n * import { __ } from '@wordpress/i18n';\n * import { useDispatch } from '@wordpress/data';\n * import { store as noticesStore } from '@wordpress/notices';\n * import { Button } from '@wordpress/components';\n *\n * const ExampleComponent = () => {\n * const { createNotice } = useDispatch( noticesStore );\n * return (\n * <Button\n * onClick={ () => createNotice( 'success', __( 'Notice message' ) ) }\n * >\n * { __( 'Generate a success notice!' ) }\n * </Button>\n * );\n * };\n * ```\n *\n * @return {Object} Action object.\n */\nexport function createNotice( status = DEFAULT_STATUS, content, options = {} ) {\n\tconst {\n\t\tspeak = true,\n\t\tisDismissible = true,\n\t\tcontext = DEFAULT_CONTEXT,\n\t\tid = `${ context }${ ++uniqueId }`,\n\t\tactions = [],\n\t\ttype = 'default',\n\t\t__unstableHTML,\n\t\ticon = null,\n\t\texplicitDismiss = false,\n\t\tonDismiss,\n\t} = options;\n\n\t// The supported value shape of content is currently limited to plain text\n\t// strings. To avoid setting expectation that e.g. a WPElement could be\n\t// supported, cast to a string.\n\tcontent = String( content );\n\n\treturn {\n\t\ttype: 'CREATE_NOTICE',\n\t\tcontext,\n\t\tnotice: {\n\t\t\tid,\n\t\t\tstatus,\n\t\t\tcontent,\n\t\t\tspokenMessage: speak ? content : null,\n\t\t\t__unstableHTML,\n\t\t\tisDismissible,\n\t\t\tactions,\n\t\t\ttype,\n\t\t\ticon,\n\t\t\texplicitDismiss,\n\t\t\tonDismiss,\n\t\t},\n\t};\n}\n\n/**\n * Returns an action object used in signalling that a success notice is to be\n * created. Refer to `createNotice` for options documentation.\n *\n * @see createNotice\n *\n * @param {string} content Notice message.\n * @param {Object} [options] Optional notice options.\n *\n * @example\n * ```js\n * import { __ } from '@wordpress/i18n';\n * import { useDispatch } from '@wordpress/data';\n * import { store as noticesStore } from '@wordpress/notices';\n * import { Button } from '@wordpress/components';\n *\n * const ExampleComponent = () => {\n * const { createSuccessNotice } = useDispatch( noticesStore );\n * return (\n * <Button\n * onClick={ () =>\n * createSuccessNotice( __( 'Success!' ), {\n * type: 'snackbar',\n * icon: '🔥',\n * } )\n * }\n * >\n * { __( 'Generate a snackbar success notice!' ) }\n * </Button>\n * );\n * };\n * ```\n *\n * @return {Object} Action object.\n */\nexport function createSuccessNotice( content, options ) {\n\treturn createNotice( 'success', content, options );\n}\n\n/**\n * Returns an action object used in signalling that an info notice is to be\n * created. Refer to `createNotice` for options documentation.\n *\n * @see createNotice\n *\n * @param {string} content Notice message.\n * @param {Object} [options] Optional notice options.\n *\n * @example\n * ```js\n * import { __ } from '@wordpress/i18n';\n * import { useDispatch } from '@wordpress/data';\n * import { store as noticesStore } from '@wordpress/notices';\n * import { Button } from '@wordpress/components';\n *\n * const ExampleComponent = () => {\n * const { createInfoNotice } = useDispatch( noticesStore );\n * return (\n * <Button\n * onClick={ () =>\n * createInfoNotice( __( 'Something happened!' ), {\n * isDismissible: false,\n * } )\n * }\n * >\n * { __( 'Generate a notice that cannot be dismissed.' ) }\n * </Button>\n * );\n * };\n *```\n *\n * @return {Object} Action object.\n */\nexport function createInfoNotice( content, options ) {\n\treturn createNotice( 'info', content, options );\n}\n\n/**\n * Returns an action object used in signalling that an error notice is to be\n * created. Refer to `createNotice` for options documentation.\n *\n * @see createNotice\n *\n * @param {string} content Notice message.\n * @param {Object} [options] Optional notice options.\n *\n * @example\n * ```js\n * import { __ } from '@wordpress/i18n';\n * import { useDispatch } from '@wordpress/data';\n * import { store as noticesStore } from '@wordpress/notices';\n * import { Button } from '@wordpress/components';\n *\n * const ExampleComponent = () => {\n * const { createErrorNotice } = useDispatch( noticesStore );\n * return (\n * <Button\n * onClick={ () =>\n * createErrorNotice( __( 'An error occurred!' ), {\n * type: 'snackbar',\n * explicitDismiss: true,\n * } )\n * }\n * >\n * { __(\n * 'Generate an snackbar error notice with explicit dismiss button.'\n * ) }\n * </Button>\n * );\n * };\n * ```\n *\n * @return {Object} Action object.\n */\nexport function createErrorNotice( content, options ) {\n\treturn createNotice( 'error', content, options );\n}\n\n/**\n * Returns an action object used in signalling that a warning notice is to be\n * created. Refer to `createNotice` for options documentation.\n *\n * @see createNotice\n *\n * @param {string} content Notice message.\n * @param {Object} [options] Optional notice options.\n *\n * @example\n * ```js\n * import { __ } from '@wordpress/i18n';\n * import { useDispatch } from '@wordpress/data';\n * import { store as noticesStore } from '@wordpress/notices';\n * import { Button } from '@wordpress/components';\n *\n * const ExampleComponent = () => {\n * const { createWarningNotice, createInfoNotice } = useDispatch( noticesStore );\n * return (\n * <Button\n * onClick={ () =>\n * createWarningNotice( __( 'Warning!' ), {\n * onDismiss: () => {\n * createInfoNotice(\n * __( 'The warning has been dismissed!' )\n * );\n * },\n * } )\n * }\n * >\n * { __( 'Generates a warning notice with onDismiss callback' ) }\n * </Button>\n * );\n * };\n * ```\n *\n * @return {Object} Action object.\n */\nexport function createWarningNotice( content, options ) {\n\treturn createNotice( 'warning', content, options );\n}\n\n/**\n * Returns an action object used in signalling that a notice is to be removed.\n *\n * @param {string} id Notice unique identifier.\n * @param {string} [context='global'] Optional context (grouping) in which the notice is\n * intended to appear. Defaults to default context.\n *\n * @example\n * ```js\n * import { __ } from '@wordpress/i18n';\n * import { useDispatch } from '@wordpress/data';\n * import { store as noticesStore } from '@wordpress/notices';\n * import { Button } from '@wordpress/components';\n *\n * const ExampleComponent = () => {\n * const notices = useSelect( ( select ) => select( noticesStore ).getNotices() );\n * const { createWarningNotice, removeNotice } = useDispatch( noticesStore );\n *\n * return (\n * <>\n * <Button\n * onClick={ () =>\n * createWarningNotice( __( 'Warning!' ), {\n * isDismissible: false,\n * } )\n * }\n * >\n * { __( 'Generate a notice' ) }\n * </Button>\n * { notices.length > 0 && (\n * <Button onClick={ () => removeNotice( notices[ 0 ].id ) }>\n * { __( 'Remove the notice' ) }\n * </Button>\n * ) }\n * </>\n * );\n *};\n * ```\n *\n * @return {Object} Action object.\n */\nexport function removeNotice( id, context = DEFAULT_CONTEXT ) {\n\treturn {\n\t\ttype: 'REMOVE_NOTICE',\n\t\tid,\n\t\tcontext,\n\t};\n}\n"]}
|
@@ -13,8 +13,6 @@ import * as selectors from './selectors';
|
|
13
13
|
* Store definition for the notices namespace.
|
14
14
|
*
|
15
15
|
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore
|
16
|
-
*
|
17
|
-
* @type {Object}
|
18
16
|
*/
|
19
17
|
|
20
18
|
export const store = createReduxStore('core/notices', {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["@wordpress/notices/src/store/index.js"],"names":["createReduxStore","register","reducer","actions","selectors","store"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,gBAAT,EAA2BC,QAA3B,QAA2C,iBAA3C;AAEA;AACA;AACA;;AACA,OAAOC,OAAP,MAAoB,WAApB;AACA,OAAO,KAAKC,OAAZ,MAAyB,WAAzB;AACA,OAAO,KAAKC,SAAZ,MAA2B,aAA3B;AAEA;AACA;AACA;AACA;AACA
|
1
|
+
{"version":3,"sources":["@wordpress/notices/src/store/index.js"],"names":["createReduxStore","register","reducer","actions","selectors","store"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,gBAAT,EAA2BC,QAA3B,QAA2C,iBAA3C;AAEA;AACA;AACA;;AACA,OAAOC,OAAP,MAAoB,WAApB;AACA,OAAO,KAAKC,OAAZ,MAAyB,WAAzB;AACA,OAAO,KAAKC,SAAZ,MAA2B,aAA3B;AAEA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,KAAK,GAAGL,gBAAgB,CAAE,cAAF,EAAkB;AACtDE,EAAAA,OADsD;AAEtDC,EAAAA,OAFsD;AAGtDC,EAAAA;AAHsD,CAAlB,CAA9B;AAMPH,QAAQ,CAAEI,KAAF,CAAR","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createReduxStore, register } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport reducer from './reducer';\nimport * as actions from './actions';\nimport * as selectors from './selectors';\n\n/**\n * Store definition for the notices namespace.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore\n */\nexport const store = createReduxStore( 'core/notices', {\n\treducer,\n\tactions,\n\tselectors,\n} );\n\nregister( store );\n"]}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":""}
|
@@ -0,0 +1,272 @@
|
|
1
|
+
/**
|
2
|
+
* Returns an action object used in signalling that a notice is to be created.
|
3
|
+
*
|
4
|
+
* @param {string|undefined} status Notice status ("info" if undefined is passed).
|
5
|
+
* @param {string} content Notice message.
|
6
|
+
* @param {Object} [options] Notice options.
|
7
|
+
* @param {string} [options.context='global'] Context under which to
|
8
|
+
* group notice.
|
9
|
+
* @param {string} [options.id] Identifier for notice.
|
10
|
+
* Automatically assigned
|
11
|
+
* if not specified.
|
12
|
+
* @param {boolean} [options.isDismissible=true] Whether the notice can
|
13
|
+
* be dismissed by user.
|
14
|
+
* @param {string} [options.type='default'] Type of notice, one of
|
15
|
+
* `default`, or `snackbar`.
|
16
|
+
* @param {boolean} [options.speak=true] Whether the notice
|
17
|
+
* content should be
|
18
|
+
* announced to screen
|
19
|
+
* readers.
|
20
|
+
* @param {Array<WPNoticeAction>} [options.actions] User actions to be
|
21
|
+
* presented with notice.
|
22
|
+
* @param {string} [options.icon] An icon displayed with the notice.
|
23
|
+
* Only used when type is set to `snackbar`.
|
24
|
+
* @param {boolean} [options.explicitDismiss] Whether the notice includes
|
25
|
+
* an explicit dismiss button and
|
26
|
+
* can't be dismissed by clicking
|
27
|
+
* the body of the notice. Only applies
|
28
|
+
* when type is set to `snackbar`.
|
29
|
+
* @param {Function} [options.onDismiss] Called when the notice is dismissed.
|
30
|
+
*
|
31
|
+
* @example
|
32
|
+
* ```js
|
33
|
+
* import { __ } from '@wordpress/i18n';
|
34
|
+
* import { useDispatch } from '@wordpress/data';
|
35
|
+
* import { store as noticesStore } from '@wordpress/notices';
|
36
|
+
* import { Button } from '@wordpress/components';
|
37
|
+
*
|
38
|
+
* const ExampleComponent = () => {
|
39
|
+
* const { createNotice } = useDispatch( noticesStore );
|
40
|
+
* return (
|
41
|
+
* <Button
|
42
|
+
* onClick={ () => createNotice( 'success', __( 'Notice message' ) ) }
|
43
|
+
* >
|
44
|
+
* { __( 'Generate a success notice!' ) }
|
45
|
+
* </Button>
|
46
|
+
* );
|
47
|
+
* };
|
48
|
+
* ```
|
49
|
+
*
|
50
|
+
* @return {Object} Action object.
|
51
|
+
*/
|
52
|
+
export function createNotice(status: string | undefined, content: string, options?: {
|
53
|
+
context?: string | undefined;
|
54
|
+
id?: string | undefined;
|
55
|
+
isDismissible?: boolean | undefined;
|
56
|
+
type?: string | undefined;
|
57
|
+
speak?: boolean | undefined;
|
58
|
+
actions?: WPNoticeAction[] | undefined;
|
59
|
+
icon?: string | undefined;
|
60
|
+
explicitDismiss?: boolean | undefined;
|
61
|
+
onDismiss?: Function | undefined;
|
62
|
+
} | undefined): Object;
|
63
|
+
/**
|
64
|
+
* Returns an action object used in signalling that a success notice is to be
|
65
|
+
* created. Refer to `createNotice` for options documentation.
|
66
|
+
*
|
67
|
+
* @see createNotice
|
68
|
+
*
|
69
|
+
* @param {string} content Notice message.
|
70
|
+
* @param {Object} [options] Optional notice options.
|
71
|
+
*
|
72
|
+
* @example
|
73
|
+
* ```js
|
74
|
+
* import { __ } from '@wordpress/i18n';
|
75
|
+
* import { useDispatch } from '@wordpress/data';
|
76
|
+
* import { store as noticesStore } from '@wordpress/notices';
|
77
|
+
* import { Button } from '@wordpress/components';
|
78
|
+
*
|
79
|
+
* const ExampleComponent = () => {
|
80
|
+
* const { createSuccessNotice } = useDispatch( noticesStore );
|
81
|
+
* return (
|
82
|
+
* <Button
|
83
|
+
* onClick={ () =>
|
84
|
+
* createSuccessNotice( __( 'Success!' ), {
|
85
|
+
* type: 'snackbar',
|
86
|
+
* icon: '🔥',
|
87
|
+
* } )
|
88
|
+
* }
|
89
|
+
* >
|
90
|
+
* { __( 'Generate a snackbar success notice!' ) }
|
91
|
+
* </Button>
|
92
|
+
* );
|
93
|
+
* };
|
94
|
+
* ```
|
95
|
+
*
|
96
|
+
* @return {Object} Action object.
|
97
|
+
*/
|
98
|
+
export function createSuccessNotice(content: string, options?: Object | undefined): Object;
|
99
|
+
/**
|
100
|
+
* Returns an action object used in signalling that an info notice is to be
|
101
|
+
* created. Refer to `createNotice` for options documentation.
|
102
|
+
*
|
103
|
+
* @see createNotice
|
104
|
+
*
|
105
|
+
* @param {string} content Notice message.
|
106
|
+
* @param {Object} [options] Optional notice options.
|
107
|
+
*
|
108
|
+
* @example
|
109
|
+
* ```js
|
110
|
+
* import { __ } from '@wordpress/i18n';
|
111
|
+
* import { useDispatch } from '@wordpress/data';
|
112
|
+
* import { store as noticesStore } from '@wordpress/notices';
|
113
|
+
* import { Button } from '@wordpress/components';
|
114
|
+
*
|
115
|
+
* const ExampleComponent = () => {
|
116
|
+
* const { createInfoNotice } = useDispatch( noticesStore );
|
117
|
+
* return (
|
118
|
+
* <Button
|
119
|
+
* onClick={ () =>
|
120
|
+
* createInfoNotice( __( 'Something happened!' ), {
|
121
|
+
* isDismissible: false,
|
122
|
+
* } )
|
123
|
+
* }
|
124
|
+
* >
|
125
|
+
* { __( 'Generate a notice that cannot be dismissed.' ) }
|
126
|
+
* </Button>
|
127
|
+
* );
|
128
|
+
* };
|
129
|
+
*```
|
130
|
+
*
|
131
|
+
* @return {Object} Action object.
|
132
|
+
*/
|
133
|
+
export function createInfoNotice(content: string, options?: Object | undefined): Object;
|
134
|
+
/**
|
135
|
+
* Returns an action object used in signalling that an error notice is to be
|
136
|
+
* created. Refer to `createNotice` for options documentation.
|
137
|
+
*
|
138
|
+
* @see createNotice
|
139
|
+
*
|
140
|
+
* @param {string} content Notice message.
|
141
|
+
* @param {Object} [options] Optional notice options.
|
142
|
+
*
|
143
|
+
* @example
|
144
|
+
* ```js
|
145
|
+
* import { __ } from '@wordpress/i18n';
|
146
|
+
* import { useDispatch } from '@wordpress/data';
|
147
|
+
* import { store as noticesStore } from '@wordpress/notices';
|
148
|
+
* import { Button } from '@wordpress/components';
|
149
|
+
*
|
150
|
+
* const ExampleComponent = () => {
|
151
|
+
* const { createErrorNotice } = useDispatch( noticesStore );
|
152
|
+
* return (
|
153
|
+
* <Button
|
154
|
+
* onClick={ () =>
|
155
|
+
* createErrorNotice( __( 'An error occurred!' ), {
|
156
|
+
* type: 'snackbar',
|
157
|
+
* explicitDismiss: true,
|
158
|
+
* } )
|
159
|
+
* }
|
160
|
+
* >
|
161
|
+
* { __(
|
162
|
+
* 'Generate an snackbar error notice with explicit dismiss button.'
|
163
|
+
* ) }
|
164
|
+
* </Button>
|
165
|
+
* );
|
166
|
+
* };
|
167
|
+
* ```
|
168
|
+
*
|
169
|
+
* @return {Object} Action object.
|
170
|
+
*/
|
171
|
+
export function createErrorNotice(content: string, options?: Object | undefined): Object;
|
172
|
+
/**
|
173
|
+
* Returns an action object used in signalling that a warning notice is to be
|
174
|
+
* created. Refer to `createNotice` for options documentation.
|
175
|
+
*
|
176
|
+
* @see createNotice
|
177
|
+
*
|
178
|
+
* @param {string} content Notice message.
|
179
|
+
* @param {Object} [options] Optional notice options.
|
180
|
+
*
|
181
|
+
* @example
|
182
|
+
* ```js
|
183
|
+
* import { __ } from '@wordpress/i18n';
|
184
|
+
* import { useDispatch } from '@wordpress/data';
|
185
|
+
* import { store as noticesStore } from '@wordpress/notices';
|
186
|
+
* import { Button } from '@wordpress/components';
|
187
|
+
*
|
188
|
+
* const ExampleComponent = () => {
|
189
|
+
* const { createWarningNotice, createInfoNotice } = useDispatch( noticesStore );
|
190
|
+
* return (
|
191
|
+
* <Button
|
192
|
+
* onClick={ () =>
|
193
|
+
* createWarningNotice( __( 'Warning!' ), {
|
194
|
+
* onDismiss: () => {
|
195
|
+
* createInfoNotice(
|
196
|
+
* __( 'The warning has been dismissed!' )
|
197
|
+
* );
|
198
|
+
* },
|
199
|
+
* } )
|
200
|
+
* }
|
201
|
+
* >
|
202
|
+
* { __( 'Generates a warning notice with onDismiss callback' ) }
|
203
|
+
* </Button>
|
204
|
+
* );
|
205
|
+
* };
|
206
|
+
* ```
|
207
|
+
*
|
208
|
+
* @return {Object} Action object.
|
209
|
+
*/
|
210
|
+
export function createWarningNotice(content: string, options?: Object | undefined): Object;
|
211
|
+
/**
|
212
|
+
* Returns an action object used in signalling that a notice is to be removed.
|
213
|
+
*
|
214
|
+
* @param {string} id Notice unique identifier.
|
215
|
+
* @param {string} [context='global'] Optional context (grouping) in which the notice is
|
216
|
+
* intended to appear. Defaults to default context.
|
217
|
+
*
|
218
|
+
* @example
|
219
|
+
* ```js
|
220
|
+
* import { __ } from '@wordpress/i18n';
|
221
|
+
* import { useDispatch } from '@wordpress/data';
|
222
|
+
* import { store as noticesStore } from '@wordpress/notices';
|
223
|
+
* import { Button } from '@wordpress/components';
|
224
|
+
*
|
225
|
+
* const ExampleComponent = () => {
|
226
|
+
* const notices = useSelect( ( select ) => select( noticesStore ).getNotices() );
|
227
|
+
* const { createWarningNotice, removeNotice } = useDispatch( noticesStore );
|
228
|
+
*
|
229
|
+
* return (
|
230
|
+
* <>
|
231
|
+
* <Button
|
232
|
+
* onClick={ () =>
|
233
|
+
* createWarningNotice( __( 'Warning!' ), {
|
234
|
+
* isDismissible: false,
|
235
|
+
* } )
|
236
|
+
* }
|
237
|
+
* >
|
238
|
+
* { __( 'Generate a notice' ) }
|
239
|
+
* </Button>
|
240
|
+
* { notices.length > 0 && (
|
241
|
+
* <Button onClick={ () => removeNotice( notices[ 0 ].id ) }>
|
242
|
+
* { __( 'Remove the notice' ) }
|
243
|
+
* </Button>
|
244
|
+
* ) }
|
245
|
+
* </>
|
246
|
+
* );
|
247
|
+
*};
|
248
|
+
* ```
|
249
|
+
*
|
250
|
+
* @return {Object} Action object.
|
251
|
+
*/
|
252
|
+
export function removeNotice(id: string, context?: string | undefined): Object;
|
253
|
+
/**
|
254
|
+
* Object describing a user action option associated with a notice.
|
255
|
+
*/
|
256
|
+
export type WPNoticeAction = {
|
257
|
+
/**
|
258
|
+
* Message to use as action label.
|
259
|
+
*/
|
260
|
+
label: string;
|
261
|
+
/**
|
262
|
+
* Optional URL of resource if action incurs
|
263
|
+
* browser navigation.
|
264
|
+
*/
|
265
|
+
url: string | null;
|
266
|
+
/**
|
267
|
+
* Optional function to invoke when action is
|
268
|
+
* triggered by user.
|
269
|
+
*/
|
270
|
+
onClick: Function | null;
|
271
|
+
};
|
272
|
+
//# sourceMappingURL=actions.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../src/store/actions.js"],"names":[],"mappings":"AAkBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AACH,qCAhDW,MAAM,GAAC,SAAS,WAChB,MAAM;;;;;;;;;;gBA6CL,MAAM,CAsCjB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,6CA7BW,MAAM,iCA2BL,MAAM,CAIjB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,0CA5BW,MAAM,iCA0BL,MAAM,CAIjB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,2CA/BW,MAAM,iCA6BL,MAAM,CAIjB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,6CAhCW,MAAM,iCA8BL,MAAM,CAIjB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,iCAtCW,MAAM,iCAoCL,MAAM,CAQjB;;;;;;;;WAlTa,MAAM;;;;;SACL,MAAM"}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
/**
|
2
|
+
* Default context to use for notice grouping when not otherwise specified. Its
|
3
|
+
* specific value doesn't hold much meaning, but it must be reasonably unique
|
4
|
+
* and, more importantly, referenced consistently in the store implementation.
|
5
|
+
*
|
6
|
+
* @type {string}
|
7
|
+
*/
|
8
|
+
export const DEFAULT_CONTEXT: string;
|
9
|
+
/**
|
10
|
+
* Default notice status.
|
11
|
+
*
|
12
|
+
* @type {string}
|
13
|
+
*/
|
14
|
+
export const DEFAULT_STATUS: string;
|
15
|
+
//# sourceMappingURL=constants.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/store/constants.js"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,8BAFU,MAAM,CAEwB;AAExC;;;;GAIG;AACH,6BAFU,MAAM,CAEqB"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"controls.d.ts","sourceRoot":"","sources":["../../src/store/controls.js"],"names":[],"mappings":";IAMC,kCAEC"}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
/**
|
2
|
+
* Store definition for the notices namespace.
|
3
|
+
*
|
4
|
+
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore
|
5
|
+
*/
|
6
|
+
export const store: import("@wordpress/data/build-types/types").StoreDescriptor<import("@wordpress/data/build-types/types").ReduxStoreConfig<any, typeof actions, typeof selectors>>;
|
7
|
+
import * as actions from "./actions";
|
8
|
+
import * as selectors from "./selectors";
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/store/index.js"],"names":[],"mappings":"AAYA;;;;GAIG;AACH,qLAII"}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
export default notices;
|
2
|
+
/**
|
3
|
+
* Reducer returning the next notices state. The notices state is an object
|
4
|
+
* where each key is a context, its value an array of notice objects.
|
5
|
+
*
|
6
|
+
* @param {Object} state Current state.
|
7
|
+
* @param {Object} action Dispatched action.
|
8
|
+
*
|
9
|
+
* @return {Object} Updated state.
|
10
|
+
*/
|
11
|
+
declare const notices: any;
|
12
|
+
//# sourceMappingURL=reducer.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"reducer.d.ts","sourceRoot":"","sources":["../../src/store/reducer.js"],"names":[],"mappings":";AAKA;;;;;;;;GAQG;AACH,2BAcI"}
|
@@ -0,0 +1,107 @@
|
|
1
|
+
/**
|
2
|
+
* @typedef {Object} WPNotice Notice object.
|
3
|
+
*
|
4
|
+
* @property {string} id Unique identifier of notice.
|
5
|
+
* @property {string} status Status of notice, one of `success`,
|
6
|
+
* `info`, `error`, or `warning`. Defaults
|
7
|
+
* to `info`.
|
8
|
+
* @property {string} content Notice message.
|
9
|
+
* @property {string} spokenMessage Audibly announced message text used by
|
10
|
+
* assistive technologies.
|
11
|
+
* @property {string} __unstableHTML Notice message as raw HTML. Intended to
|
12
|
+
* serve primarily for compatibility of
|
13
|
+
* server-rendered notices, and SHOULD NOT
|
14
|
+
* be used for notices. It is subject to
|
15
|
+
* removal without notice.
|
16
|
+
* @property {boolean} isDismissible Whether the notice can be dismissed by
|
17
|
+
* user. Defaults to `true`.
|
18
|
+
* @property {string} type Type of notice, one of `default`,
|
19
|
+
* or `snackbar`. Defaults to `default`.
|
20
|
+
* @property {boolean} speak Whether the notice content should be
|
21
|
+
* announced to screen readers. Defaults to
|
22
|
+
* `true`.
|
23
|
+
* @property {WPNoticeAction[]} actions User actions to present with notice.
|
24
|
+
*
|
25
|
+
*/
|
26
|
+
/**
|
27
|
+
* Returns all notices as an array, optionally for a given context. Defaults to
|
28
|
+
* the global context.
|
29
|
+
*
|
30
|
+
* @param {Object} state Notices state.
|
31
|
+
* @param {?string} context Optional grouping context.
|
32
|
+
*
|
33
|
+
* @example
|
34
|
+
*
|
35
|
+
*```js
|
36
|
+
* import { useSelect } from '@wordpress/data';
|
37
|
+
* import { store as noticesStore } from '@wordpress/notices';
|
38
|
+
*
|
39
|
+
* const ExampleComponent = () => {
|
40
|
+
* const notices = useSelect( ( select ) => select( noticesStore ).getNotices() );
|
41
|
+
* return (
|
42
|
+
* <ul>
|
43
|
+
* { notices.map( ( notice ) => (
|
44
|
+
* <li key={ notice.ID }>{ notice.content }</li>
|
45
|
+
* ) ) }
|
46
|
+
* </ul>
|
47
|
+
* )
|
48
|
+
* };
|
49
|
+
*```
|
50
|
+
*
|
51
|
+
* @return {WPNotice[]} Array of notices.
|
52
|
+
*/
|
53
|
+
export function getNotices(state: Object, context?: string | null): WPNotice[];
|
54
|
+
/**
|
55
|
+
* Notice object.
|
56
|
+
*/
|
57
|
+
export type WPNotice = {
|
58
|
+
/**
|
59
|
+
* Unique identifier of notice.
|
60
|
+
*/
|
61
|
+
id: string;
|
62
|
+
/**
|
63
|
+
* Status of notice, one of `success`,
|
64
|
+
* `info`, `error`, or `warning`. Defaults
|
65
|
+
* to `info`.
|
66
|
+
*/
|
67
|
+
status: string;
|
68
|
+
/**
|
69
|
+
* Notice message.
|
70
|
+
*/
|
71
|
+
content: string;
|
72
|
+
/**
|
73
|
+
* Audibly announced message text used by
|
74
|
+
* assistive technologies.
|
75
|
+
*/
|
76
|
+
spokenMessage: string;
|
77
|
+
/**
|
78
|
+
* Notice message as raw HTML. Intended to
|
79
|
+
* serve primarily for compatibility of
|
80
|
+
* server-rendered notices, and SHOULD NOT
|
81
|
+
* be used for notices. It is subject to
|
82
|
+
* removal without notice.
|
83
|
+
*/
|
84
|
+
__unstableHTML: string;
|
85
|
+
/**
|
86
|
+
* Whether the notice can be dismissed by
|
87
|
+
* user. Defaults to `true`.
|
88
|
+
*/
|
89
|
+
isDismissible: boolean;
|
90
|
+
/**
|
91
|
+
* Type of notice, one of `default`,
|
92
|
+
* or `snackbar`. Defaults to `default`.
|
93
|
+
*/
|
94
|
+
type: string;
|
95
|
+
/**
|
96
|
+
* Whether the notice content should be
|
97
|
+
* announced to screen readers. Defaults to
|
98
|
+
* `true`.
|
99
|
+
*/
|
100
|
+
speak: boolean;
|
101
|
+
/**
|
102
|
+
* User actions to present with notice.
|
103
|
+
*/
|
104
|
+
actions: WPNoticeAction[];
|
105
|
+
};
|
106
|
+
export type WPNoticeAction = import('./actions').WPNoticeAction;
|
107
|
+
//# sourceMappingURL=selectors.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"selectors.d.ts","sourceRoot":"","sources":["../../src/store/selectors.js"],"names":[],"mappings":"AAkBA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,kCAvBW,MAAM,YACL,MAAM,UAoBN,QAAQ,EAAE,CAIrB;;;;;;;;QApDa,MAAM;;;;;;YACN,MAAM;;;;aAGN,MAAM;;;;;mBACN,MAAM;;;;;;;;oBAEN,MAAM;;;;;mBAKN,OAAO;;;;;UAEP,MAAM;;;;;;WAEN,OAAO;;;;aAGP,cAAc,EAAE;;6BAnChB,OAAO,WAAW,EAAE,cAAc"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"on-sub-key.d.ts","sourceRoot":"","sources":["../../../src/store/utils/on-sub-key.js"],"names":[],"mappings":"AAQO,yCAJI,MAAM,YA0Bf"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@wordpress/notices",
|
3
|
-
"version": "
|
3
|
+
"version": "4.0.0",
|
4
4
|
"description": "State management for notices.",
|
5
5
|
"author": "The WordPress Contributors",
|
6
6
|
"license": "GPL-2.0-or-later",
|
@@ -24,13 +24,14 @@
|
|
24
24
|
"main": "build/index.js",
|
25
25
|
"module": "build-module/index.js",
|
26
26
|
"react-native": "src/index",
|
27
|
+
"types": "build-types",
|
27
28
|
"dependencies": {
|
28
29
|
"@babel/runtime": "^7.16.0",
|
29
|
-
"@wordpress/a11y": "^3.
|
30
|
-
"@wordpress/data": "^9.
|
30
|
+
"@wordpress/a11y": "^3.32.0",
|
31
|
+
"@wordpress/data": "^9.2.0"
|
31
32
|
},
|
32
33
|
"publishConfig": {
|
33
34
|
"access": "public"
|
34
35
|
},
|
35
|
-
"gitHead": "
|
36
|
+
"gitHead": "6df0c62d43b8901414ccd22ffbe56eaa99d012a6"
|
36
37
|
}
|
package/src/store/actions.js
CHANGED
@@ -19,7 +19,7 @@ let uniqueId = 0;
|
|
19
19
|
/**
|
20
20
|
* Returns an action object used in signalling that a notice is to be created.
|
21
21
|
*
|
22
|
-
* @param {string}
|
22
|
+
* @param {string|undefined} status Notice status ("info" if undefined is passed).
|
23
23
|
* @param {string} content Notice message.
|
24
24
|
* @param {Object} [options] Notice options.
|
25
25
|
* @param {string} [options.context='global'] Context under which to
|
package/src/store/index.js
CHANGED
@@ -14,8 +14,6 @@ import * as selectors from './selectors';
|
|
14
14
|
* Store definition for the notices namespace.
|
15
15
|
*
|
16
16
|
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore
|
17
|
-
*
|
18
|
-
* @type {Object}
|
19
17
|
*/
|
20
18
|
export const store = createReduxStore( 'core/notices', {
|
21
19
|
reducer,
|
package/tsconfig.json
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
{
|
2
|
+
"extends": "../../tsconfig.base.json",
|
3
|
+
"compilerOptions": {
|
4
|
+
"rootDir": "src",
|
5
|
+
"declarationDir": "build-types",
|
6
|
+
"types": [ "gutenberg-env" ],
|
7
|
+
"checkJs": false
|
8
|
+
},
|
9
|
+
"references": [ { "path": "../a11y" }, { "path": "../data" } ],
|
10
|
+
"include": [ "src/**/*" ]
|
11
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"program":{"fileNames":["../../node_modules/typescript/lib/lib.es5.d.ts","../../node_modules/typescript/lib/lib.es2015.d.ts","../../node_modules/typescript/lib/lib.es2016.d.ts","../../node_modules/typescript/lib/lib.es2017.d.ts","../../node_modules/typescript/lib/lib.es2018.d.ts","../../node_modules/typescript/lib/lib.es2019.d.ts","../../node_modules/typescript/lib/lib.es2020.d.ts","../../node_modules/typescript/lib/lib.es2021.d.ts","../../node_modules/typescript/lib/lib.es2022.d.ts","../../node_modules/typescript/lib/lib.esnext.d.ts","../../node_modules/typescript/lib/lib.dom.d.ts","../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../node_modules/typescript/lib/lib.es2019.intl.d.ts","../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../node_modules/typescript/lib/lib.es2020.date.d.ts","../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../node_modules/typescript/lib/lib.es2020.number.d.ts","../../node_modules/typescript/lib/lib.es2021.promise.d.ts","../../node_modules/typescript/lib/lib.es2021.string.d.ts","../../node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../node_modules/typescript/lib/lib.es2021.intl.d.ts","../../node_modules/typescript/lib/lib.es2022.array.d.ts","../../node_modules/typescript/lib/lib.es2022.error.d.ts","../../node_modules/typescript/lib/lib.es2022.intl.d.ts","../../node_modules/typescript/lib/lib.es2022.object.d.ts","../../node_modules/typescript/lib/lib.es2022.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2022.string.d.ts","../../node_modules/typescript/lib/lib.esnext.intl.d.ts","../element/node_modules/@types/react/global.d.ts","../../node_modules/csstype/index.d.ts","../../node_modules/@types/prop-types/index.d.ts","../../node_modules/@types/scheduler/tracing.d.ts","../element/node_modules/@types/react/index.d.ts","../element/build-types/react.d.ts","../element/build-types/create-interpolate-element.d.ts","../../node_modules/@types/react/index.d.ts","../../node_modules/@types/react-dom/index.d.ts","../../node_modules/@types/react-dom/client.d.ts","../element/build-types/react-platform.d.ts","../element/build-types/utils.d.ts","../element/build-types/platform.d.ts","../element/build-types/serialize.d.ts","../element/build-types/raw-html.d.ts","../element/build-types/index.d.ts","../data/build-types/components/with-select/index.d.ts","../data/build-types/components/with-dispatch/index.d.ts","../data/build-types/components/with-registry/index.d.ts","../../node_modules/redux/index.d.ts","../data/build-types/types.d.ts","../data/build-types/components/use-dispatch/use-dispatch.d.ts","../data/build-types/components/use-dispatch/use-dispatch-with-map.d.ts","../data/build-types/components/use-dispatch/index.d.ts","../data/build-types/components/async-mode-provider/use-async-mode.d.ts","../data/build-types/components/async-mode-provider/context.d.ts","../data/build-types/components/async-mode-provider/index.d.ts","../data/build-types/registry.d.ts","../data/build-types/controls.d.ts","../data/build-types/redux-store/index.d.ts","../data/build-types/plugins/persistence/index.d.ts","../data/build-types/plugins/index.d.ts","../data/build-types/components/registry-provider/use-registry.d.ts","../data/build-types/components/registry-provider/context.d.ts","../data/build-types/components/registry-provider/index.d.ts","../data/build-types/components/use-select/index.d.ts","../data/build-types/factory.d.ts","../data/build-types/index.d.ts","./src/store/utils/on-sub-key.js","./src/store/reducer.js","./src/store/constants.js","./src/store/actions.js","./src/store/selectors.js","./src/store/index.js","./src/index.js","../a11y/build-types/index.d.ts","./src/store/controls.js","../../typings/gutenberg-env/index.d.ts","../../node_modules/@types/react/global.d.ts"],"fileInfos":[{"version":"8730f4bf322026ff5229336391a18bcaa1f94d4f82416c8b2f3954e2ccaae2ba","affectsGlobalScope":true},"dc47c4fa66b9b9890cf076304de2a9c5201e94b740cffdf09f87296d877d71f6","7a387c58583dfca701b6c85e0adaf43fb17d590fb16d5b2dc0a2fbd89f35c467","8a12173c586e95f4433e0c6dc446bc88346be73ffe9ca6eec7aa63c8f3dca7f9","5f4e733ced4e129482ae2186aae29fde948ab7182844c3a5a51dd346182c7b06","4b421cbfb3a38a27c279dec1e9112c3d1da296f77a1a85ddadf7e7a425d45d18","1fc5ab7a764205c68fa10d381b08417795fc73111d6dd16b5b1ed36badb743d9","746d62152361558ea6d6115cf0da4dd10ede041d14882ede3568bce5dc4b4f1f","d11a03592451da2d1065e09e61f4e2a9bf68f780f4f6623c18b57816a9679d17","aea179452def8a6152f98f63b191b84e7cbd69b0e248c91e61fb2e52328abe8c",{"version":"3aafcb693fe5b5c3bd277bd4c3a617b53db474fe498fc5df067c5603b1eebde7","affectsGlobalScope":true},{"version":"adb996790133eb33b33aadb9c09f15c2c575e71fb57a62de8bf74dbf59ec7dfb","affectsGlobalScope":true},{"version":"8cc8c5a3bac513368b0157f3d8b31cfdcfe78b56d3724f30f80ed9715e404af8","affectsGlobalScope":true},{"version":"cdccba9a388c2ee3fd6ad4018c640a471a6c060e96f1232062223063b0a5ac6a","affectsGlobalScope":true},{"version":"c5c05907c02476e4bde6b7e76a79ffcd948aedd14b6a8f56e4674221b0417398","affectsGlobalScope":true},{"version":"5f406584aef28a331c36523df688ca3650288d14f39c5d2e555c95f0d2ff8f6f","affectsGlobalScope":true},{"version":"22f230e544b35349cfb3bd9110b6ef37b41c6d6c43c3314a31bd0d9652fcec72","affectsGlobalScope":true},{"version":"7ea0b55f6b315cf9ac2ad622b0a7813315bb6e97bf4bb3fbf8f8affbca7dc695","affectsGlobalScope":true},{"version":"3013574108c36fd3aaca79764002b3717da09725a36a6fc02eac386593110f93","affectsGlobalScope":true},{"version":"eb26de841c52236d8222f87e9e6a235332e0788af8c87a71e9e210314300410a","affectsGlobalScope":true},{"version":"3be5a1453daa63e031d266bf342f3943603873d890ab8b9ada95e22389389006","affectsGlobalScope":true},{"version":"17bb1fc99591b00515502d264fa55dc8370c45c5298f4a5c2083557dccba5a2a","affectsGlobalScope":true},{"version":"7ce9f0bde3307ca1f944119f6365f2d776d281a393b576a18a2f2893a2d75c98","affectsGlobalScope":true},{"version":"6a6b173e739a6a99629a8594bfb294cc7329bfb7b227f12e1f7c11bc163b8577","affectsGlobalScope":true},{"version":"81cac4cbc92c0c839c70f8ffb94eb61e2d32dc1c3cf6d95844ca099463cf37ea","affectsGlobalScope":true},{"version":"b0124885ef82641903d232172577f2ceb5d3e60aed4da1153bab4221e1f6dd4e","affectsGlobalScope":true},{"version":"0eb85d6c590b0d577919a79e0084fa1744c1beba6fd0d4e951432fa1ede5510a","affectsGlobalScope":true},{"version":"da233fc1c8a377ba9e0bed690a73c290d843c2c3d23a7bd7ec5cd3d7d73ba1e0","affectsGlobalScope":true},{"version":"d154ea5bb7f7f9001ed9153e876b2d5b8f5c2bb9ec02b3ae0d239ec769f1f2ae","affectsGlobalScope":true},{"version":"bb2d3fb05a1d2ffbca947cc7cbc95d23e1d053d6595391bd325deb265a18d36c","affectsGlobalScope":true},{"version":"c80df75850fea5caa2afe43b9949338ce4e2de086f91713e9af1a06f973872b8","affectsGlobalScope":true},{"version":"9d57b2b5d15838ed094aa9ff1299eecef40b190722eb619bac4616657a05f951","affectsGlobalScope":true},{"version":"6c51b5dd26a2c31dbf37f00cfc32b2aa6a92e19c995aefb5b97a3a64f1ac99de","affectsGlobalScope":true},{"version":"6e7997ef61de3132e4d4b2250e75343f487903ddf5370e7ce33cf1b9db9a63ed","affectsGlobalScope":true},{"version":"2ad234885a4240522efccd77de6c7d99eecf9b4de0914adb9a35c0c22433f993","affectsGlobalScope":true},{"version":"5e5e095c4470c8bab227dbbc61374878ecead104c74ab9960d3adcccfee23205","affectsGlobalScope":true},{"version":"09aa50414b80c023553090e2f53827f007a301bc34b0495bfb2c3c08ab9ad1eb","affectsGlobalScope":true},{"version":"d7f680a43f8cd12a6b6122c07c54ba40952b0c8aa140dcfcf32eb9e6cb028596","affectsGlobalScope":true},{"version":"3787b83e297de7c315d55d4a7c546ae28e5f6c0a361b7a1dcec1f1f50a54ef11","affectsGlobalScope":true},{"version":"e7e8e1d368290e9295ef18ca23f405cf40d5456fa9f20db6373a61ca45f75f40","affectsGlobalScope":true},{"version":"faf0221ae0465363c842ce6aa8a0cbda5d9296940a8e26c86e04cc4081eea21e","affectsGlobalScope":true},{"version":"06393d13ea207a1bfe08ec8d7be562549c5e2da8983f2ee074e00002629d1871","affectsGlobalScope":true},{"version":"2768ef564cfc0689a1b76106c421a2909bdff0acbe87da010785adab80efdd5c","affectsGlobalScope":true},{"version":"b248e32ca52e8f5571390a4142558ae4f203ae2f94d5bac38a3084d529ef4e58","affectsGlobalScope":true},{"version":"6c55633c733c8378db65ac3da7a767c3cf2cf3057f0565a9124a16a3a2019e87","affectsGlobalScope":true},{"version":"fb4416144c1bf0323ccbc9afb0ab289c07312214e8820ad17d709498c865a3fe","affectsGlobalScope":true},{"version":"5b0ca94ec819d68d33da516306c15297acec88efeb0ae9e2b39f71dbd9685ef7","affectsGlobalScope":true},{"version":"34c839eaaa6d78c8674ae2c37af2236dee6831b13db7b4ef4df3ec889a04d4f2","affectsGlobalScope":true},{"version":"34478567f8a80171f88f2f30808beb7da15eac0538ae91282dd33dce928d98ed","affectsGlobalScope":true},{"version":"ab7d58e6161a550ff92e5aff755dc37fe896245348332cd5f1e1203479fe0ed1","affectsGlobalScope":true},{"version":"6bda95ea27a59a276e46043b7065b55bd4b316c25e70e29b572958fa77565d43","affectsGlobalScope":true},{"version":"aedb8de1abb2ff1095c153854a6df7deae4a5709c37297f9d6e9948b6806fa66","affectsGlobalScope":true},{"version":"a4da0551fd39b90ca7ce5f68fb55d4dc0c1396d589b612e1902f68ee090aaada","affectsGlobalScope":true},{"version":"11ffe3c281f375fff9ffdde8bbec7669b4dd671905509079f866f2354a788064","affectsGlobalScope":true},{"version":"52d1bb7ab7a3306fd0375c8bff560feed26ed676a5b0457fa8027b563aecb9a4","affectsGlobalScope":true},{"version":"bbdf156fea2fabed31a569445835aeedcc33643d404fcbaa54541f06c109df3f","affectsGlobalScope":true},"381899b8d1d4c1be716f18cb5242ba39f66f4b1e31d45af62a32a99f8edcb39d","f7b46d22a307739c145e5fddf537818038fdfffd580d79ed717f4d4d37249380","f5a8b384f182b3851cec3596ccc96cb7464f8d3469f48c74bf2befb782a19de5",{"version":"5917af4ff931b050dba49a1dedd9c00f15f7b3dc4345ad8491bfacd2ec68ed32","affectsGlobalScope":true},"6fb72c65c5af8c4ed7d41afecd1ebb463d1e074291ae5e8a187d0922fd40f59b","ab6f9c23c44e0b20c2be80af46ffc9d0e6681efa05ee1704bb4c9fcef8e61497",{"version":"5917af4ff931b050dba49a1dedd9c00f15f7b3dc4345ad8491bfacd2ec68ed32","affectsGlobalScope":true},"e4dd91dd4789a109aab51d8a0569a282369fcda9ba6f2b2297bc61bacfb1a042","83e27bbd7304ea67f9afa1535f1d4fdb15866089f0d893c784cbb5b1c6fb3386","c4b39848e2fb237507a7acae0b83a34271c9d72714faae6a6b9075527205111b","d2d9e98a2b167079474768593e1e7125fc3db055add8fbdb5977e3d05a8a3696","6462da67490105ba7d98cf312c2faf8794c425781128b161ea8394d66502eec8","62359da52b6c8d00c50c2e50738fac82e902f916fdf458d8159e7edb1c60c3a8","1e0ac21bc775686383ea8c8e48bd98b385e6195b25c85525a7affd08a2cd38b9","0449615e1ed03c7d54fc435a63b7ef0cb4e5cea5ac40c9a63280a46f7eeae0ff","f647358d9c48f01ca886cf4e022a31cbc9f84a5706cd85df656b0b8e3ec118eb","3e04bd7b52acb9c393909520bc6bf74989ed3cb8cee63c9ae88e20467a8f02d9","a958d081d81c1194d1878b28f081d0144d95f4e36c6b375e357cb982e8b40705",{"version":"8f19251323456195ec9236df857bac3b8f97b73b540ef06ead2ceccc3884954f","affectsGlobalScope":true},"161ae38e8fa5c0a1a8002eceba810f99734edd08493c15bdd0c0e3034ea13606","e3e12de1cc9a3f289b1ea267336edf625260cdaa50a3dbb33b61fc58e5a792c7","d23aeb9ad9955d3b6df7a972355dd465aaa0f7b8c223834f9499585b75f2ab04","cf000108177216c2ffd9962c785dfe0eb36306b14817894115be2d8f470552d6","61937532d01a86bc9f9847e016305cec9b5a716db5a630a0c37049a477d18f60","c792ecb733fc79337b7b497d3298dc31217f0f2b944ade255037dea871915353","61e8a34952f23c48deff3e85e982b1b3a600d15fb4d3b7c07a9096505ad2c35c","4fe57f4d9ea10f6069813ca18818838ce21258f42e79f898b4fb7860ce0c58ca","1e525db7ea2d7369211b74756f1034e4219134c3c99c0e147998caf43b10e017","e11c156803f0c4423e71cafc494033b48f1493b411acd77e50a769d551dafb7e","d2c8976d6e6874ce159fc31c8511fffde72dcdf230394750ea4ef3c02a32e52e","fb6fa5434ecf7670f3dba36bced663afe875282d1231fb3ae95eeedae85ce4cf","e4cb6f9e4d40f538e26c72cc81ebd8ebae3317f940f39696e30d1381f36e5a0a","30289252a73fce7ff4b88369c829ed1f8533ccc028c55b264fc96fb576ffdd6a","3f473bb1c974b627227610013561332ea2f8e6eed0e86e87eaef96b6146d28c8","ce5bdb993fed19ff6f8a7a9ae3dd2fbe650c45c6552e7fe33e24bc4c51363b81","c8bd10b6cdcb527ce859b9c5b4b6168f270cec11cb051cc77eb4dead206b5e0f","24539d95c2bac8f3cf5a4375089230403743faea1460c8c58dd1a5ccaeca3d32",{"version":"f2826236122014bd16973ab7849482d448c80093b8fc52c157df9c3866cbe289","signature":"ce7ffbddb9bb9f620d1f13ba84c9ef672e982556ad05dbd574b39b13cbf12af8"},{"version":"713d3e0d8fec9080177dec59b1474b765d9fa9666cc9d8f5e2e832797eaed9c3","signature":"8cd75268d6d413038d764da8d35fa3828a2d782df84982a95ff951231bef59de"},{"version":"be5f60dac6d1a7bf083d585a766b3622bdc2776baa7f3951d13db56fccdd981e","signature":"6dd6e32523e3027be07af56705521d59d933661f2b52f3235c5bb969f1943562"},{"version":"e5955c0c121ad753433d0c307d03b80929bdab3bb023ee1e1fe6531a044fa280","signature":"8fa1ec71200cb60d1c4f3d5e474502f3cd0d2c2a93686dac7e634f8d93fb5526"},{"version":"d4639f0c84a68794e342c1b8bf3c82fbb40368ff6fa184b4a4e13a2186188d79","signature":"13261509c8b90cf17d981050f4d0735625eb3be8f74ad0d3f0fafcf3d9d04be0"},{"version":"be794c27e7da2f411ec46fbb65ec156a7d1f86fe705ab78636e087451a0e0216","signature":"03ec60de068e21597a2b1c7c2b270c9c48da82c4c6b17cba4afffeb5f5830902"},{"version":"9740d100bf2f102a458086b57767ef6a16895ac3587e902666abed1f012fe300","signature":"81a18789776f52e86306fe133335102bd04f9f0cc52d9e52f9c4fa53394f43a4"},"628892c81712740099899916d35460c1e8552c7246db3b3b0cafb309735555de",{"version":"07252f048ee1ed29f5202040d7e2afc939a27e0d0d4292e01ea2b49f4682f146","signature":"5b290b95cdcc0133deaed18862ee0c7d7508df2d7b4e2175f97fc82b69b924f2"},{"version":"084d8b571b1e8b984824263889aabc2c37d29b49f7cbab3e4ebd05e4c02891eb","affectsGlobalScope":true}],"options":{"allowSyntheticDefaultImports":true,"composite":true,"declaration":true,"declarationDir":"./build-types","declarationMap":true,"emitDeclarationOnly":true,"esModuleInterop":false,"importsNotUsedAsValues":2,"jsx":1,"module":99,"noFallthroughCasesInSwitch":true,"noImplicitReturns":true,"noUnusedLocals":true,"noUnusedParameters":true,"rootDir":"./src","strict":true,"target":99},"fileIdsList":[[60],[57,58,59,104],[80,81],[60,83],[88,89],[77,78],[76],[71],[72,73,74,76,79,82,83,84,85,87,90,91,92],[86],[83],[75],[61],[61,62,66,67,68,69,70],[64,65],[60,61],[56,57,58,59],[99],[96],[101],[93,95,97,98],[94],[96,97],[97]],"referencedMap":[[65,1],[64,1],[63,2],[81,1],[82,3],[89,4],[90,5],[79,6],[77,7],[91,7],[73,8],[74,1],[72,8],[84,7],[93,9],[87,10],[86,11],[85,7],[83,7],[76,12],[62,13],[71,14],[70,1],[66,15],[61,1],[69,16],[60,17],[100,18],[97,19],[102,20],[99,21],[95,22],[98,23]],"exportedModulesMap":[[65,1],[64,1],[63,2],[81,1],[82,3],[89,4],[90,5],[79,6],[77,7],[91,7],[73,8],[74,1],[72,8],[84,7],[93,9],[87,10],[86,11],[85,7],[83,7],[76,12],[62,13],[71,14],[70,1],[66,15],[61,1],[69,16],[60,17],[99,7],[98,24]],"semanticDiagnosticsPerFile":[58,65,64,63,59,57,75,11,13,12,2,14,15,16,17,18,19,20,21,3,4,25,22,23,24,26,27,28,5,29,30,31,32,6,36,33,34,35,37,7,38,43,44,39,40,41,42,8,48,45,46,47,49,9,50,51,52,53,54,1,10,55,101,81,82,80,89,90,88,79,78,77,91,73,74,72,84,92,93,87,86,85,83,76,62,71,68,70,66,61,69,67,56,60,100,97,96,102,99,95,98,94,103],"latestChangedDtsFile":"./build-types/store/controls.d.ts"},"version":"4.9.5"}
|