@wordpress/plugins 7.32.0 → 7.32.1-next.47f435fc9.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/build/api/index.js +62 -165
- package/build/api/index.js.map +7 -1
- package/build/components/index.js +40 -23
- package/build/components/index.js.map +7 -1
- package/build/components/plugin-area/index.js +80 -93
- package/build/components/plugin-area/index.js.map +7 -1
- package/build/components/plugin-context/index.js +58 -53
- package/build/components/plugin-context/index.js.map +7 -1
- package/build/components/plugin-error-boundary/index.js +30 -23
- package/build/components/plugin-error-boundary/index.js.map +7 -1
- package/build/index.js +23 -26
- package/build/index.js.map +7 -1
- package/build/types.js +16 -5
- package/build/types.js.map +7 -1
- package/build-module/api/index.js +40 -161
- package/build-module/api/index.js.map +7 -1
- package/build-module/components/index.js +8 -3
- package/build-module/components/index.js.map +7 -1
- package/build-module/components/plugin-area/index.js +49 -84
- package/build-module/components/plugin-area/index.js.map +7 -1
- package/build-module/components/plugin-context/index.js +23 -43
- package/build-module/components/plugin-context/index.js.map +7 -1
- package/build-module/components/plugin-error-boundary/index.js +8 -18
- package/build-module/components/plugin-error-boundary/index.js.map +7 -1
- package/build-module/index.js +3 -3
- package/build-module/index.js.map +7 -1
- package/build-module/types.js +1 -2
- package/build-module/types.js.map +7 -1
- package/package.json +17 -10
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1,64 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
*/
|
|
16
|
-
import { PluginContextProvider } from '../plugin-context';
|
|
17
|
-
import { PluginErrorBoundary } from '../plugin-error-boundary';
|
|
18
|
-
import { getPlugins } from '../../api';
|
|
19
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
20
|
-
const getPluginContext = memoize((icon, name) => ({
|
|
21
|
-
icon,
|
|
22
|
-
name
|
|
23
|
-
}));
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* A component that renders all plugin fills in a hidden div.
|
|
27
|
-
*
|
|
28
|
-
* @param props
|
|
29
|
-
* @param props.scope
|
|
30
|
-
* @param props.onError
|
|
31
|
-
* @example
|
|
32
|
-
* ```js
|
|
33
|
-
* // Using ES5 syntax
|
|
34
|
-
* var el = React.createElement;
|
|
35
|
-
* var PluginArea = wp.plugins.PluginArea;
|
|
36
|
-
*
|
|
37
|
-
* function Layout() {
|
|
38
|
-
* return el(
|
|
39
|
-
* 'div',
|
|
40
|
-
* { scope: 'my-page' },
|
|
41
|
-
* 'Content of the page',
|
|
42
|
-
* PluginArea
|
|
43
|
-
* );
|
|
44
|
-
* }
|
|
45
|
-
* ```
|
|
46
|
-
*
|
|
47
|
-
* @example
|
|
48
|
-
* ```js
|
|
49
|
-
* // Using ESNext syntax
|
|
50
|
-
* import { PluginArea } from '@wordpress/plugins';
|
|
51
|
-
*
|
|
52
|
-
* const Layout = () => (
|
|
53
|
-
* <div>
|
|
54
|
-
* Content of the page
|
|
55
|
-
* <PluginArea scope="my-page" />
|
|
56
|
-
* </div>
|
|
57
|
-
* );
|
|
58
|
-
* ```
|
|
59
|
-
*
|
|
60
|
-
* @return {Component} The component to be rendered.
|
|
61
|
-
*/
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import memoize from "memize";
|
|
3
|
+
import { useMemo, useSyncExternalStore } from "@wordpress/element";
|
|
4
|
+
import { addAction, removeAction } from "@wordpress/hooks";
|
|
5
|
+
import isShallowEqual from "@wordpress/is-shallow-equal";
|
|
6
|
+
import { PluginContextProvider } from "../plugin-context";
|
|
7
|
+
import { PluginErrorBoundary } from "../plugin-error-boundary";
|
|
8
|
+
import { getPlugins } from "../../api";
|
|
9
|
+
const getPluginContext = memoize(
|
|
10
|
+
(icon, name) => ({
|
|
11
|
+
icon,
|
|
12
|
+
name
|
|
13
|
+
})
|
|
14
|
+
);
|
|
62
15
|
function PluginArea({
|
|
63
16
|
scope,
|
|
64
17
|
onError
|
|
@@ -67,11 +20,25 @@ function PluginArea({
|
|
|
67
20
|
let lastValue = [];
|
|
68
21
|
return {
|
|
69
22
|
subscribe(listener) {
|
|
70
|
-
addAction(
|
|
71
|
-
|
|
23
|
+
addAction(
|
|
24
|
+
"plugins.pluginRegistered",
|
|
25
|
+
"core/plugins/plugin-area/plugins-registered",
|
|
26
|
+
listener
|
|
27
|
+
);
|
|
28
|
+
addAction(
|
|
29
|
+
"plugins.pluginUnregistered",
|
|
30
|
+
"core/plugins/plugin-area/plugins-unregistered",
|
|
31
|
+
listener
|
|
32
|
+
);
|
|
72
33
|
return () => {
|
|
73
|
-
removeAction(
|
|
74
|
-
|
|
34
|
+
removeAction(
|
|
35
|
+
"plugins.pluginRegistered",
|
|
36
|
+
"core/plugins/plugin-area/plugins-registered"
|
|
37
|
+
);
|
|
38
|
+
removeAction(
|
|
39
|
+
"plugins.pluginUnregistered",
|
|
40
|
+
"core/plugins/plugin-area/plugins-unregistered"
|
|
41
|
+
);
|
|
75
42
|
};
|
|
76
43
|
},
|
|
77
44
|
getValue() {
|
|
@@ -83,24 +50,22 @@ function PluginArea({
|
|
|
83
50
|
}
|
|
84
51
|
};
|
|
85
52
|
}, [scope]);
|
|
86
|
-
const plugins = useSyncExternalStore(
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
render: Plugin
|
|
95
|
-
}) => /*#__PURE__*/_jsx(PluginContextProvider, {
|
|
53
|
+
const plugins = useSyncExternalStore(
|
|
54
|
+
store.subscribe,
|
|
55
|
+
store.getValue,
|
|
56
|
+
store.getValue
|
|
57
|
+
);
|
|
58
|
+
return /* @__PURE__ */ jsx("div", { style: { display: "none" }, children: plugins.map(({ icon, name, render: Plugin }) => /* @__PURE__ */ jsx(
|
|
59
|
+
PluginContextProvider,
|
|
60
|
+
{
|
|
96
61
|
value: getPluginContext(icon, name),
|
|
97
|
-
children:
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
})
|
|
102
|
-
}, name))
|
|
103
|
-
});
|
|
62
|
+
children: /* @__PURE__ */ jsx(PluginErrorBoundary, { name, onError, children: /* @__PURE__ */ jsx(Plugin, {}) })
|
|
63
|
+
},
|
|
64
|
+
name
|
|
65
|
+
)) });
|
|
104
66
|
}
|
|
105
|
-
|
|
106
|
-
|
|
67
|
+
var plugin_area_default = PluginArea;
|
|
68
|
+
export {
|
|
69
|
+
plugin_area_default as default
|
|
70
|
+
};
|
|
71
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/plugin-area/index.tsx"],
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport memoize from 'memize';\n\n/**\n * WordPress dependencies\n */\nimport { useMemo, useSyncExternalStore } from '@wordpress/element';\nimport { addAction, removeAction } from '@wordpress/hooks';\nimport isShallowEqual from '@wordpress/is-shallow-equal';\n\n/**\n * Internal dependencies\n */\nimport { PluginContextProvider } from '../plugin-context';\nimport { PluginErrorBoundary } from '../plugin-error-boundary';\nimport { getPlugins } from '../../api';\nimport type { PluginContext } from '../plugin-context';\nimport type { WPPlugin } from '../../api';\n\nconst getPluginContext = memoize(\n\t( icon: PluginContext[ 'icon' ], name: PluginContext[ 'name' ] ) => ( {\n\t\ticon,\n\t\tname,\n\t} )\n);\n\n/**\n * A component that renders all plugin fills in a hidden div.\n *\n * @param props\n * @param props.scope\n * @param props.onError\n * @example\n * ```js\n * // Using ES5 syntax\n * var el = React.createElement;\n * var PluginArea = wp.plugins.PluginArea;\n *\n * function Layout() {\n * \treturn el(\n * \t\t'div',\n * \t\t{ scope: 'my-page' },\n * \t\t'Content of the page',\n * \t\tPluginArea\n * \t);\n * }\n * ```\n *\n * @example\n * ```js\n * // Using ESNext syntax\n * import { PluginArea } from '@wordpress/plugins';\n *\n * const Layout = () => (\n * \t<div>\n * \t\tContent of the page\n * \t\t<PluginArea scope=\"my-page\" />\n * \t</div>\n * );\n * ```\n *\n * @return {Component} The component to be rendered.\n */\nfunction PluginArea( {\n\tscope,\n\tonError,\n}: {\n\tscope?: string;\n\tonError?: ( name: WPPlugin[ 'name' ], error: Error ) => void;\n} ) {\n\tconst store = useMemo( () => {\n\t\tlet lastValue: WPPlugin[] = [];\n\n\t\treturn {\n\t\t\tsubscribe(\n\t\t\t\tlistener: (\n\t\t\t\t\tplugin: Omit< WPPlugin, 'name' >,\n\t\t\t\t\tname: WPPlugin[ 'name' ]\n\t\t\t\t) => void\n\t\t\t) {\n\t\t\t\taddAction(\n\t\t\t\t\t'plugins.pluginRegistered',\n\t\t\t\t\t'core/plugins/plugin-area/plugins-registered',\n\t\t\t\t\tlistener\n\t\t\t\t);\n\t\t\t\taddAction(\n\t\t\t\t\t'plugins.pluginUnregistered',\n\t\t\t\t\t'core/plugins/plugin-area/plugins-unregistered',\n\t\t\t\t\tlistener\n\t\t\t\t);\n\t\t\t\treturn () => {\n\t\t\t\t\tremoveAction(\n\t\t\t\t\t\t'plugins.pluginRegistered',\n\t\t\t\t\t\t'core/plugins/plugin-area/plugins-registered'\n\t\t\t\t\t);\n\t\t\t\t\tremoveAction(\n\t\t\t\t\t\t'plugins.pluginUnregistered',\n\t\t\t\t\t\t'core/plugins/plugin-area/plugins-unregistered'\n\t\t\t\t\t);\n\t\t\t\t};\n\t\t\t},\n\t\t\tgetValue() {\n\t\t\t\tconst nextValue = getPlugins( scope );\n\n\t\t\t\tif ( ! isShallowEqual( lastValue, nextValue ) ) {\n\t\t\t\t\tlastValue = nextValue;\n\t\t\t\t}\n\n\t\t\t\treturn lastValue;\n\t\t\t},\n\t\t};\n\t}, [ scope ] );\n\n\tconst plugins = useSyncExternalStore(\n\t\tstore.subscribe,\n\t\tstore.getValue,\n\t\tstore.getValue\n\t);\n\n\treturn (\n\t\t<div style={ { display: 'none' } }>\n\t\t\t{ plugins.map( ( { icon, name, render: Plugin } ) => (\n\t\t\t\t<PluginContextProvider\n\t\t\t\t\tkey={ name }\n\t\t\t\t\tvalue={ getPluginContext( icon, name ) }\n\t\t\t\t>\n\t\t\t\t\t<PluginErrorBoundary name={ name } onError={ onError }>\n\t\t\t\t\t\t<Plugin />\n\t\t\t\t\t</PluginErrorBoundary>\n\t\t\t\t</PluginContextProvider>\n\t\t\t) ) }\n\t\t</div>\n\t);\n}\n\nexport default PluginArea;\n"],
|
|
5
|
+
"mappings": "AAiIM;AA9HN,OAAO,aAAa;AAKpB,SAAS,SAAS,4BAA4B;AAC9C,SAAS,WAAW,oBAAoB;AACxC,OAAO,oBAAoB;AAK3B,SAAS,6BAA6B;AACtC,SAAS,2BAA2B;AACpC,SAAS,kBAAkB;AAI3B,MAAM,mBAAmB;AAAA,EACxB,CAAE,MAA+B,UAAqC;AAAA,IACrE;AAAA,IACA;AAAA,EACD;AACD;AAuCA,SAAS,WAAY;AAAA,EACpB;AAAA,EACA;AACD,GAGI;AACH,QAAM,QAAQ,QAAS,MAAM;AAC5B,QAAI,YAAwB,CAAC;AAE7B,WAAO;AAAA,MACN,UACC,UAIC;AACD;AAAA,UACC;AAAA,UACA;AAAA,UACA;AAAA,QACD;AACA;AAAA,UACC;AAAA,UACA;AAAA,UACA;AAAA,QACD;AACA,eAAO,MAAM;AACZ;AAAA,YACC;AAAA,YACA;AAAA,UACD;AACA;AAAA,YACC;AAAA,YACA;AAAA,UACD;AAAA,QACD;AAAA,MACD;AAAA,MACA,WAAW;AACV,cAAM,YAAY,WAAY,KAAM;AAEpC,YAAK,CAAE,eAAgB,WAAW,SAAU,GAAI;AAC/C,sBAAY;AAAA,QACb;AAEA,eAAO;AAAA,MACR;AAAA,IACD;AAAA,EACD,GAAG,CAAE,KAAM,CAAE;AAEb,QAAM,UAAU;AAAA,IACf,MAAM;AAAA,IACN,MAAM;AAAA,IACN,MAAM;AAAA,EACP;AAEA,SACC,oBAAC,SAAI,OAAQ,EAAE,SAAS,OAAO,GAC5B,kBAAQ,IAAK,CAAE,EAAE,MAAM,MAAM,QAAQ,OAAO,MAC7C;AAAA,IAAC;AAAA;AAAA,MAEA,OAAQ,iBAAkB,MAAM,IAAK;AAAA,MAErC,8BAAC,uBAAoB,MAAc,SAClC,8BAAC,UAAO,GACT;AAAA;AAAA,IALM;AAAA,EAMP,CACC,GACH;AAEF;AAEA,IAAO,sBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,52 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import { createHigherOrderComponent } from '@wordpress/compose';
|
|
6
|
-
import deprecated from '@wordpress/deprecated';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Internal dependencies
|
|
10
|
-
*/
|
|
11
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useContext } from "@wordpress/element";
|
|
3
|
+
import { createHigherOrderComponent } from "@wordpress/compose";
|
|
4
|
+
import deprecated from "@wordpress/deprecated";
|
|
12
5
|
const Context = createContext({
|
|
13
6
|
name: null,
|
|
14
7
|
icon: null
|
|
15
8
|
});
|
|
16
|
-
Context.displayName =
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* A hook that returns the plugin context.
|
|
21
|
-
*
|
|
22
|
-
* @return {PluginContext} Plugin context
|
|
23
|
-
*/
|
|
24
|
-
export function usePluginContext() {
|
|
9
|
+
Context.displayName = "PluginContext";
|
|
10
|
+
const PluginContextProvider = Context.Provider;
|
|
11
|
+
function usePluginContext() {
|
|
25
12
|
return useContext(Context);
|
|
26
13
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
*
|
|
32
|
-
* @deprecated 6.8.0 Use `usePluginContext` hook instead.
|
|
33
|
-
*
|
|
34
|
-
* @param mapContextToProps Function called on every context change,
|
|
35
|
-
* expected to return object of props to
|
|
36
|
-
* merge with the component's own props.
|
|
37
|
-
*
|
|
38
|
-
* @return {Component} Enhanced component with injected context as props.
|
|
39
|
-
*/
|
|
40
|
-
export const withPluginContext = mapContextToProps => createHigherOrderComponent(OriginalComponent => {
|
|
41
|
-
deprecated('wp.plugins.withPluginContext', {
|
|
42
|
-
since: '6.8.0',
|
|
43
|
-
alternative: 'wp.plugins.usePluginContext'
|
|
14
|
+
const withPluginContext = (mapContextToProps) => createHigherOrderComponent((OriginalComponent) => {
|
|
15
|
+
deprecated("wp.plugins.withPluginContext", {
|
|
16
|
+
since: "6.8.0",
|
|
17
|
+
alternative: "wp.plugins.usePluginContext"
|
|
44
18
|
});
|
|
45
|
-
return props =>
|
|
46
|
-
|
|
19
|
+
return (props) => /* @__PURE__ */ jsx(Context.Consumer, { children: (context) => /* @__PURE__ */ jsx(
|
|
20
|
+
OriginalComponent,
|
|
21
|
+
{
|
|
47
22
|
...props,
|
|
48
23
|
...mapContextToProps(context, props)
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
},
|
|
52
|
-
|
|
24
|
+
}
|
|
25
|
+
) });
|
|
26
|
+
}, "withPluginContext");
|
|
27
|
+
export {
|
|
28
|
+
PluginContextProvider,
|
|
29
|
+
usePluginContext,
|
|
30
|
+
withPluginContext
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/plugin-context/index.tsx"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { createContext, useContext } from '@wordpress/element';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport type { WPPlugin } from '../../api';\n\nexport interface PluginContext {\n\tname: null | WPPlugin[ 'name' ];\n\ticon: null | WPPlugin[ 'icon' ];\n}\n\nconst Context = createContext< PluginContext >( {\n\tname: null,\n\ticon: null,\n} );\nContext.displayName = 'PluginContext';\n\nexport const PluginContextProvider = Context.Provider;\n\n/**\n * A hook that returns the plugin context.\n *\n * @return {PluginContext} Plugin context\n */\nexport function usePluginContext() {\n\treturn useContext( Context );\n}\n\n/**\n * A Higher Order Component used to inject Plugin context to the\n * wrapped component.\n *\n * @deprecated 6.8.0 Use `usePluginContext` hook instead.\n *\n * @param mapContextToProps Function called on every context change,\n * expected to return object of props to\n * merge with the component's own props.\n *\n * @return {Component} Enhanced component with injected context as props.\n */\nexport const withPluginContext = (\n\tmapContextToProps: < T >(\n\t\tcontext: PluginContext,\n\t\tprops: T\n\t) => T & PluginContext\n) =>\n\tcreateHigherOrderComponent( ( OriginalComponent ) => {\n\t\tdeprecated( 'wp.plugins.withPluginContext', {\n\t\t\tsince: '6.8.0',\n\t\t\talternative: 'wp.plugins.usePluginContext',\n\t\t} );\n\t\treturn ( props ) => (\n\t\t\t<Context.Consumer>\n\t\t\t\t{ ( context ) => (\n\t\t\t\t\t<OriginalComponent\n\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t\t{ ...mapContextToProps( context, props ) }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</Context.Consumer>\n\t\t);\n\t}, 'withPluginContext' );\n"],
|
|
5
|
+
"mappings": "AA4DK;AAzDL,SAAS,eAAe,kBAAkB;AAC1C,SAAS,kCAAkC;AAC3C,OAAO,gBAAgB;AAYvB,MAAM,UAAU,cAAgC;AAAA,EAC/C,MAAM;AAAA,EACN,MAAM;AACP,CAAE;AACF,QAAQ,cAAc;AAEf,MAAM,wBAAwB,QAAQ;AAOtC,SAAS,mBAAmB;AAClC,SAAO,WAAY,OAAQ;AAC5B;AAcO,MAAM,oBAAoB,CAChC,sBAKA,2BAA4B,CAAE,sBAAuB;AACpD,aAAY,gCAAgC;AAAA,IAC3C,OAAO;AAAA,IACP,aAAa;AAAA,EACd,CAAE;AACF,SAAO,CAAE,UACR,oBAAC,QAAQ,UAAR,EACE,WAAE,YACH;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACH,GAAG,kBAAmB,SAAS,KAAM;AAAA;AAAA,EACxC,GAEF;AAEF,GAAG,mBAAoB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,13 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*/
|
|
4
|
-
import { Component } from '@wordpress/element';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Internal dependencies
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
export class PluginErrorBoundary extends Component {
|
|
1
|
+
import { Component } from "@wordpress/element";
|
|
2
|
+
class PluginErrorBoundary extends Component {
|
|
11
3
|
constructor(props) {
|
|
12
4
|
super(props);
|
|
13
5
|
this.state = {
|
|
@@ -15,15 +7,10 @@ export class PluginErrorBoundary extends Component {
|
|
|
15
7
|
};
|
|
16
8
|
}
|
|
17
9
|
static getDerivedStateFromError() {
|
|
18
|
-
return {
|
|
19
|
-
hasError: true
|
|
20
|
-
};
|
|
10
|
+
return { hasError: true };
|
|
21
11
|
}
|
|
22
12
|
componentDidCatch(error) {
|
|
23
|
-
const {
|
|
24
|
-
name,
|
|
25
|
-
onError
|
|
26
|
-
} = this.props;
|
|
13
|
+
const { name, onError } = this.props;
|
|
27
14
|
if (onError) {
|
|
28
15
|
onError(name, error);
|
|
29
16
|
}
|
|
@@ -35,4 +22,7 @@ export class PluginErrorBoundary extends Component {
|
|
|
35
22
|
return null;
|
|
36
23
|
}
|
|
37
24
|
}
|
|
38
|
-
|
|
25
|
+
export {
|
|
26
|
+
PluginErrorBoundary
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/plugin-error-boundary/index.tsx"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type {\n\tPluginErrorBoundaryProps as Props,\n\tPluginErrorBoundaryState as State,\n} from '../../types';\n\nexport class PluginErrorBoundary extends Component< Props, State > {\n\tconstructor( props: Props ) {\n\t\tsuper( props );\n\t\tthis.state = {\n\t\t\thasError: false,\n\t\t};\n\t}\n\n\tstatic getDerivedStateFromError(): State {\n\t\treturn { hasError: true };\n\t}\n\n\tcomponentDidCatch( error: Error ): void {\n\t\tconst { name, onError } = this.props;\n\t\tif ( onError ) {\n\t\t\tonError( name, error );\n\t\t}\n\t}\n\n\trender(): React.ReactNode {\n\t\tif ( ! this.state.hasError ) {\n\t\t\treturn this.props.children;\n\t\t}\n\n\t\treturn null;\n\t}\n}\n"],
|
|
5
|
+
"mappings": "AAGA,SAAS,iBAAiB;AAUnB,MAAM,4BAA4B,UAA0B;AAAA,EAClE,YAAa,OAAe;AAC3B,UAAO,KAAM;AACb,SAAK,QAAQ;AAAA,MACZ,UAAU;AAAA,IACX;AAAA,EACD;AAAA,EAEA,OAAO,2BAAkC;AACxC,WAAO,EAAE,UAAU,KAAK;AAAA,EACzB;AAAA,EAEA,kBAAmB,OAAqB;AACvC,UAAM,EAAE,MAAM,QAAQ,IAAI,KAAK;AAC/B,QAAK,SAAU;AACd,cAAS,MAAM,KAAM;AAAA,IACtB;AAAA,EACD;AAAA,EAEA,SAA0B;AACzB,QAAK,CAAE,KAAK,MAAM,UAAW;AAC5B,aAAO,KAAK,MAAM;AAAA,IACnB;AAEA,WAAO;AAAA,EACR;AACD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/build-module/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
export * from "./components";
|
|
2
|
+
export * from "./api";
|
|
3
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/index.ts"],
|
|
4
|
+
"sourcesContent": ["export * from './components';\nexport * from './api';\n"],
|
|
5
|
+
"mappings": "AAAA,cAAc;AACd,cAAc;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/build-module/types.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
//# sourceMappingURL=types.js.map
|
|
1
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": [],
|
|
4
|
+
"sourcesContent": [],
|
|
5
|
+
"mappings": "",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/plugins",
|
|
3
|
-
"version": "7.32.0",
|
|
3
|
+
"version": "7.32.1-next.47f435fc9.0",
|
|
4
4
|
"description": "Plugins module for WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -24,18 +24,25 @@
|
|
|
24
24
|
},
|
|
25
25
|
"main": "build/index.js",
|
|
26
26
|
"module": "build-module/index.js",
|
|
27
|
+
"exports": {
|
|
28
|
+
".": {
|
|
29
|
+
"types": "./build-types/index.d.ts",
|
|
30
|
+
"import": "./build-module/index.js",
|
|
31
|
+
"require": "./build/index.js"
|
|
32
|
+
},
|
|
33
|
+
"./package.json": "./package.json"
|
|
34
|
+
},
|
|
27
35
|
"react-native": "src/index",
|
|
28
36
|
"wpScript": true,
|
|
29
37
|
"types": "build-types",
|
|
30
38
|
"dependencies": {
|
|
31
|
-
"@
|
|
32
|
-
"@wordpress/
|
|
33
|
-
"@wordpress/
|
|
34
|
-
"@wordpress/
|
|
35
|
-
"@wordpress/
|
|
36
|
-
"@wordpress/
|
|
37
|
-
"@wordpress/
|
|
38
|
-
"@wordpress/is-shallow-equal": "^5.32.0",
|
|
39
|
+
"@wordpress/components": "^30.6.1-next.47f435fc9.0",
|
|
40
|
+
"@wordpress/compose": "^7.32.1-next.47f435fc9.0",
|
|
41
|
+
"@wordpress/deprecated": "^4.32.1-next.47f435fc9.0",
|
|
42
|
+
"@wordpress/element": "^6.32.1-next.47f435fc9.0",
|
|
43
|
+
"@wordpress/hooks": "^4.32.1-next.47f435fc9.0",
|
|
44
|
+
"@wordpress/icons": "^11.0.1-next.47f435fc9.0",
|
|
45
|
+
"@wordpress/is-shallow-equal": "^5.32.1-next.47f435fc9.0",
|
|
39
46
|
"memize": "^2.0.1"
|
|
40
47
|
},
|
|
41
48
|
"peerDependencies": {
|
|
@@ -45,5 +52,5 @@
|
|
|
45
52
|
"publishConfig": {
|
|
46
53
|
"access": "public"
|
|
47
54
|
},
|
|
48
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "9720f22c138771d2ed1a0522725c3cdf1c242953"
|
|
49
56
|
}
|