eddev 0.2.67-beta1 → 0.3.0-beta1
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/admin/components/ImageWell.d.ts +2 -2
- package/admin/components/ImageWell.js +51 -39
- package/admin/defineField.d.ts +2 -2
- package/admin/defineWidget.d.ts +1 -1
- package/admin/defineWidget.js +2 -2
- package/admin/index.js +1 -5
- package/admin/installFieldTypes.js +26 -26
- package/admin/runWidgets.js +28 -17
- package/admin/selectMedia.d.ts +2 -2
- package/admin/selectMedia.js +1 -1
- package/blocks/ContentBlocks.d.ts +6 -6
- package/blocks/ContentBlocks.js +66 -58
- package/blocks/ErrorBoundaryEditor.d.ts +1 -1
- package/blocks/ErrorBoundaryEditor.js +45 -16
- package/blocks/ErrorBoundaryFrontend.d.ts +1 -1
- package/blocks/ErrorBoundaryFrontend.js +45 -16
- package/blocks/InspectorControls.d.ts +1 -1
- package/blocks/InspectorControls.js +3 -3
- package/blocks/blockAttributes.d.ts +2 -2
- package/blocks/blockAttributes.js +44 -24
- package/blocks/index.js +1 -5
- package/blocks/inlineEditing.d.ts +6 -6
- package/blocks/inlineEditing.js +55 -36
- package/blocks/installGutenbergHooks.js +68 -48
- package/build/babel/plugin-name-defined-components.js +16 -15
- package/build/build-favicon.js +62 -11
- package/build/clean.js +52 -5
- package/build/create-codegen-worker.js +33 -78
- package/build/create-serverless-dev-worker.js +39 -61
- package/build/create-webpack-worker.js +33 -65
- package/build/file-tree.d.ts +2 -2
- package/build/file-tree.js +12 -12
- package/build/get-webpack-config.js +395 -341
- package/build/graphql-codegen/graphql-codegen-files.js +25 -31
- package/build/graphql-codegen/graphql-codegen-no-duplicates.js +4 -4
- package/build/graphql-codegen/graphql-codegen-queries.js +99 -102
- package/build/manifests/manifest-blocks.d.ts +1 -1
- package/build/manifests/manifest-blocks.js +29 -37
- package/build/manifests/manifest-fields.d.ts +1 -1
- package/build/manifests/manifest-fields.js +21 -23
- package/build/manifests/manifest-views.d.ts +1 -1
- package/build/manifests/manifest-views.js +25 -32
- package/build/manifests/manifest-widgets.d.ts +1 -1
- package/build/manifests/manifest-widgets.js +20 -22
- package/build/manifests/manifest.d.ts +2 -2
- package/build/manifests/manifest.js +94 -30
- package/build/reporter.d.ts +1 -1
- package/build/reporter.js +32 -29
- package/build/serverless/create-next-app.d.ts +1 -1
- package/build/serverless/create-next-app.js +467 -245
- package/build/state/codegen-state.d.ts +4 -4
- package/build/state/compiler-state.d.ts +5 -5
- package/build/state/serverless-state.d.ts +3 -3
- package/build/workers/codegen-worker-script.js +519 -393
- package/build/workers/serverless-worker-dev-script.js +4 -4
- package/build/workers/webpack-worker-script.js +156 -90
- package/cli/build.dev.d.ts +1 -1
- package/cli/build.dev.js +126 -79
- package/cli/build.prod.d.ts +1 -1
- package/cli/build.prod.js +98 -42
- package/cli/cli.js +28 -19
- package/cli/display/components/BundleDisplay.d.ts +1 -1
- package/cli/display/components/BundleDisplay.js +24 -13
- package/cli/display/components/CodegenDisplay.d.ts +1 -1
- package/cli/display/components/CodegenDisplay.js +25 -14
- package/cli/display/components/DevCLIDisplay.d.ts +2 -2
- package/cli/display/components/DevCLIDisplay.js +25 -14
- package/cli/display/components/Fullscreen.js +20 -9
- package/cli/display/components/ServerlessDisplay.d.ts +2 -2
- package/cli/display/components/ServerlessDisplay.js +26 -15
- package/cli/display/components/StatusIcon.d.ts +2 -2
- package/cli/display/components/StatusIcon.js +3 -3
- package/cli/preinstall.js +5 -4
- package/cli/setup.js +73 -25
- package/components/AdminBar.d.ts +1 -1
- package/components/AdminBar.js +3 -37
- package/components/BrowserRouter.d.ts +2 -2
- package/components/BrowserRouter.js +54 -41
- package/components/InlinePage.d.ts +2 -2
- package/components/InlinePage.js +29 -17
- package/components/NextRouter.d.ts +2 -2
- package/components/NextRouter.js +29 -20
- package/components/index.js +1 -5
- package/config/config-schema.d.ts +1 -1
- package/config/config-schema.js +1 -1
- package/config/create-schema-file.js +6 -6
- package/config/get-config.js +13 -10
- package/config/index.js +1 -5
- package/config/parse-config.js +1 -1
- package/config/print-zod-errors.js +3 -3
- package/dev-ui/components/BreakpointColumnHeader.d.ts +2 -2
- package/dev-ui/components/BreakpointColumnHeader.js +18 -7
- package/dev-ui/components/BreakpointIndicator.d.ts +1 -1
- package/dev-ui/components/BreakpointIndicator.js +32 -25
- package/dev-ui/components/DevUI.d.ts +1 -1
- package/dev-ui/components/DevUI.js +13 -13
- package/dev-ui/components/Launcher.d.ts +2 -2
- package/dev-ui/components/Launcher.js +25 -13
- package/dev-ui/components/PanelWrapper.d.ts +2 -2
- package/dev-ui/components/PanelWrapper.js +8 -8
- package/dev-ui/components/ResponsiveLerpControl.d.ts +2 -2
- package/dev-ui/components/ResponsiveLerpControl.js +38 -27
- package/dev-ui/components/ResponsiveScaleEditor.d.ts +4 -4
- package/dev-ui/components/ResponsiveScaleEditor.js +78 -64
- package/dev-ui/components/atoms/Button.js +1 -1
- package/dev-ui/components/atoms/Dropdown.d.ts +3 -3
- package/dev-ui/components/atoms/Dropdown.js +9 -8
- package/dev-ui/components/atoms/NumberField.d.ts +2 -2
- package/dev-ui/components/atoms/NumberField.js +42 -29
- package/dev-ui/components/atoms/Spacer.js +1 -1
- package/dev-ui/components/atoms/Text.js +1 -1
- package/dev-ui/components/atoms/ToggleButton.d.ts +2 -2
- package/dev-ui/components/atoms/ToggleButton.js +16 -5
- package/dev-ui/components/atoms/Tooltip.d.ts +2 -2
- package/dev-ui/components/atoms/Tooltip.js +20 -8
- package/dev-ui/components/panels/AppDataDebugger.d.ts +1 -1
- package/dev-ui/components/panels/AppDataDebugger.js +19 -8
- package/dev-ui/components/panels/ColorEditor.d.ts +1 -1
- package/dev-ui/components/panels/ColorEditor.js +42 -35
- package/dev-ui/components/panels/PageDataDebugger.d.ts +1 -1
- package/dev-ui/components/panels/PageDataDebugger.js +20 -8
- package/dev-ui/components/panels/QueryDebugger.d.ts +1 -1
- package/dev-ui/components/panels/QueryDebugger.js +24 -12
- package/dev-ui/components/panels/SpacingEditor.d.ts +1 -1
- package/dev-ui/components/panels/SpacingEditor.js +48 -34
- package/dev-ui/components/panels/TypographyEditor.d.ts +1 -1
- package/dev-ui/components/panels/TypographyEditor.js +46 -38
- package/dev-ui/hooks/useBreakpoint.d.ts +1 -1
- package/dev-ui/hooks/useBreakpoint.js +13 -13
- package/dev-ui/hooks/usePersistState.js +7 -6
- package/dev-ui/hooks/useStylesheet.js +6 -6
- package/dev-ui/icons.d.ts +15 -15
- package/dev-ui/icons.js +27 -16
- package/dev-ui/index.js +1 -5
- package/dev-ui/loader.d.ts +1 -1
- package/dev-ui/loader.js +9 -13
- package/dev-ui/panels.d.ts +2 -2
- package/dev-ui/panels.js +7 -7
- package/dev-ui/theme.js +3 -3
- package/dynamic/dynamic-component.js +1 -1
- package/dynamic/index.js +1 -5
- package/entry/Root.d.ts +2 -2
- package/entry/Root.js +26 -16
- package/entry/entry.admin.dev.js +4 -4
- package/entry/entry.admin.prod.js +4 -4
- package/entry/entry.monolith.dev.js +5 -5
- package/entry/entry.monolith.prod.js +5 -5
- package/gravityforms/gravity-forms.d.ts +2 -2
- package/gravityforms/index.js +1 -5
- package/gravityforms/useGravityForm.d.ts +2 -2
- package/gravityforms/useGravityForm.js +130 -126
- package/hooks/index.js +1 -5
- package/hooks/queryUtils.d.ts +14 -14
- package/hooks/queryUtils.js +192 -101
- package/hooks/useAppData.d.ts +2 -2
- package/hooks/useAppData.js +9 -9
- package/hooks/usePageLoad.js +4 -4
- package/hooks/useQueryDebug.d.ts +1 -1
- package/hooks/useQueryDebug.js +7 -7
- package/hooks/useRPC.d.ts +4 -4
- package/hooks/useRPC.js +3 -3
- package/package.json +11 -11
- package/routing/index.js +1 -5
- package/routing/remoteProps.d.ts +1 -1
- package/routing/remoteProps.js +72 -31
- package/routing/routing.d.ts +25 -15
- package/routing/routing.js +200 -112
- package/routing/updateEditLink.js +1 -1
- package/serverless/define-api.d.ts +1 -1
- package/serverless/define-rpc-router.js +4 -8
- package/serverless/index.js +2 -6
- package/style/createStitches.js +142 -164
- package/style/index.js +1 -5
- package/tsconfig.json +1 -1
- package/utils/Observable.d.ts +2 -2
- package/utils/Observable.js +15 -12
- package/utils/getRepoName.js +3 -3
- package/utils/promptIfRepoNameIncorrect.js +64 -18
- package/utils/refreshOverlayInterop.js +1 -1
- package/utils/reportErrorStack.d.ts +1 -1
- package/utils/reportErrorStack.js +1 -1
- package/utils/serverlessAppContext.js +1 -1
- package/utils/updateEnvFile.js +69 -19
- package/utils/useObservable.js +3 -3
- package/views/index.js +1 -5
package/blocks/ContentBlocks.js
CHANGED
|
@@ -1,28 +1,48 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
14
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
15
|
+
if (ar || !(i in from)) {
|
|
16
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
17
|
+
ar[i] = from[i];
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
21
|
+
};
|
|
2
22
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
23
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
24
|
};
|
|
5
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
26
|
exports.ContentBlocks = exports.BlocksContext = void 0;
|
|
7
|
-
|
|
27
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
28
|
// @ts-ignore
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
29
|
+
var blocks_1 = __importDefault(require("@manifest/blocks"));
|
|
30
|
+
var blockAttributes_1 = require("./blockAttributes");
|
|
31
|
+
var react_1 = require("react");
|
|
32
|
+
var ErrorBoundaryFrontend_1 = require("./ErrorBoundaryFrontend");
|
|
13
33
|
exports.BlocksContext = (0, react_1.createContext)(undefined);
|
|
14
34
|
function wrapPromise(promise) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
35
|
+
var status = "pending";
|
|
36
|
+
var result;
|
|
37
|
+
var suspender = promise.then(function (r) {
|
|
18
38
|
status = "success";
|
|
19
39
|
result = r;
|
|
20
|
-
}, (e)
|
|
40
|
+
}, function (e) {
|
|
21
41
|
status = "error";
|
|
22
42
|
result = e;
|
|
23
43
|
});
|
|
24
44
|
return {
|
|
25
|
-
read() {
|
|
45
|
+
read: function () {
|
|
26
46
|
//console.log(status);
|
|
27
47
|
if (status === "pending") {
|
|
28
48
|
throw suspender;
|
|
@@ -36,9 +56,9 @@ function wrapPromise(promise) {
|
|
|
36
56
|
},
|
|
37
57
|
};
|
|
38
58
|
}
|
|
39
|
-
|
|
59
|
+
var blockManifestResource = null;
|
|
40
60
|
function ContentBlocks(props) {
|
|
41
|
-
|
|
61
|
+
var blockTypes = blocks_1.default;
|
|
42
62
|
if (blocks_1.default.then && process.serverless && !blocks_1.default.default) {
|
|
43
63
|
if (!blockManifestResource)
|
|
44
64
|
blockManifestResource = wrapPromise(blocks_1.default);
|
|
@@ -49,37 +69,33 @@ function ContentBlocks(props) {
|
|
|
49
69
|
}
|
|
50
70
|
if (!Array.isArray(props.blocks))
|
|
51
71
|
return null;
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
if (
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
return [ctx, block, blockNode];
|
|
80
|
-
}), [props.blocks]);
|
|
81
|
-
const layout = (0, react_1.useMemo)(() => {
|
|
82
|
-
return blocks.filter(Boolean).map(([ctx, block, blockNode], index) => {
|
|
72
|
+
var parentContext = (0, react_1.useContext)(exports.BlocksContext);
|
|
73
|
+
var blocks = (0, react_1.useMemo)(function () {
|
|
74
|
+
return props.blocks.map(function (block, index) {
|
|
75
|
+
// Create a context object for the current block
|
|
76
|
+
var ctx = __assign(__assign({}, parentContext), { ancestors: __spreadArray(__spreadArray([], ((parentContext === null || parentContext === void 0 ? void 0 : parentContext.ancestors) || []), true), [parentContext === null || parentContext === void 0 ? void 0 : parentContext.current], false).filter(Boolean), parent: parentContext === null || parentContext === void 0 ? void 0 : parentContext.current, current: block, prev: props.blocks[index - 1], next: props.blocks[index + 1] });
|
|
77
|
+
// Figure out the
|
|
78
|
+
var blockNode;
|
|
79
|
+
if (block.blockName in blockTypes) {
|
|
80
|
+
var Component = blockTypes[block.blockName];
|
|
81
|
+
if (!Component)
|
|
82
|
+
return (0, jsx_runtime_1.jsx)(react_1.Fragment, {}, void 0);
|
|
83
|
+
blockNode = ((0, jsx_runtime_1.jsx)(blockAttributes_1.InlineEditingContextProvider, __assign({ block: [block.blockName, block.props], values: block.inline, innerBlocks: block.innerBlocks }, { children: (0, jsx_runtime_1.jsx)(Component, __assign({}, block.props, { innerHTML: block.innerHTML,
|
|
84
|
+
// innerBlocks={block.innerBlocks}
|
|
85
|
+
children: Array.isArray(block.innerBlocks) && block.innerBlocks.length ? ((0, jsx_runtime_1.jsx)(ContentBlocks, { blocks: block.innerBlocks }, void 0)) : null }), void 0) }), void 0));
|
|
86
|
+
}
|
|
87
|
+
else if (block.innerHTML) {
|
|
88
|
+
blockNode = (0, jsx_runtime_1.jsx)("div", { dangerouslySetInnerHTML: { __html: block.innerHTML } }, void 0);
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
blockNode = null;
|
|
92
|
+
}
|
|
93
|
+
return [ctx, block, blockNode];
|
|
94
|
+
});
|
|
95
|
+
}, [props.blocks]);
|
|
96
|
+
var layout = (0, react_1.useMemo)(function () {
|
|
97
|
+
return blocks.filter(Boolean).map(function (_a, index) {
|
|
98
|
+
var ctx = _a[0], block = _a[1], blockNode = _a[2];
|
|
83
99
|
// Exit early if the block is null
|
|
84
100
|
if (blockNode === null)
|
|
85
101
|
return (0, jsx_runtime_1.jsx)(react_1.Fragment, {}, index);
|
|
@@ -88,30 +104,22 @@ function ContentBlocks(props) {
|
|
|
88
104
|
blockNode = props.wrapBlock(blockNode, ctx);
|
|
89
105
|
}
|
|
90
106
|
// Wrap the block in a context provider
|
|
91
|
-
blockNode = (0, jsx_runtime_1.jsx)(exports.BlocksContext.Provider, { value: ctx, children: blockNode });
|
|
107
|
+
blockNode = (0, jsx_runtime_1.jsx)(exports.BlocksContext.Provider, __assign({ value: ctx }, { children: blockNode }), void 0);
|
|
92
108
|
// Custom spacer function?
|
|
93
|
-
|
|
94
|
-
|
|
109
|
+
var spaceBefore = null;
|
|
110
|
+
var spaceAfter = null;
|
|
95
111
|
if (props.spacer) {
|
|
96
112
|
// Before block
|
|
97
|
-
spaceBefore = props.spacer({
|
|
98
|
-
...ctx,
|
|
99
|
-
prev: ctx.prev || null,
|
|
100
|
-
next: ctx.current || null,
|
|
101
|
-
});
|
|
113
|
+
spaceBefore = props.spacer(__assign(__assign({}, ctx), { prev: ctx.prev || null, next: ctx.current || null }));
|
|
102
114
|
// After block (last block only)
|
|
103
115
|
if (index === props.blocks.length - 1) {
|
|
104
|
-
spaceAfter = props.spacer({
|
|
105
|
-
...ctx,
|
|
106
|
-
prev: block,
|
|
107
|
-
next: null,
|
|
108
|
-
});
|
|
116
|
+
spaceAfter = props.spacer(__assign(__assign({}, ctx), { prev: block, next: null }));
|
|
109
117
|
}
|
|
110
118
|
}
|
|
111
119
|
// Attempt to wrap the block
|
|
112
|
-
return ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [spaceBefore, (0, jsx_runtime_1.jsx)(ErrorBoundaryFrontend_1.ErrorBoundaryFrontend, { children: blockNode }), spaceAfter] }, index));
|
|
120
|
+
return ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [spaceBefore, (0, jsx_runtime_1.jsx)(ErrorBoundaryFrontend_1.ErrorBoundaryFrontend, { children: blockNode }, void 0), spaceAfter] }, index));
|
|
113
121
|
});
|
|
114
122
|
}, [blocks, props.wrapBlock, props.spacer]);
|
|
115
|
-
return (0, jsx_runtime_1.jsx)(react_1.Fragment, { children: layout });
|
|
123
|
+
return (0, jsx_runtime_1.jsx)(react_1.Fragment, { children: layout }, void 0);
|
|
116
124
|
}
|
|
117
125
|
exports.ContentBlocks = ContentBlocks;
|
|
@@ -10,6 +10,6 @@ export declare class ErrorBoundaryEditor extends Component<Props, State> {
|
|
|
10
10
|
state: State;
|
|
11
11
|
static getDerivedStateFromError(err: Error): State;
|
|
12
12
|
componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
|
|
13
|
-
render(): string | number | boolean |
|
|
13
|
+
render(): string | number | boolean | JSX.Element | React.ReactFragment | null | undefined;
|
|
14
14
|
}
|
|
15
15
|
export {};
|
|
@@ -1,35 +1,64 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __assign = (this && this.__assign) || function () {
|
|
18
|
+
__assign = Object.assign || function(t) {
|
|
19
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
20
|
+
s = arguments[i];
|
|
21
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
22
|
+
t[p] = s[p];
|
|
23
|
+
}
|
|
24
|
+
return t;
|
|
25
|
+
};
|
|
26
|
+
return __assign.apply(this, arguments);
|
|
27
|
+
};
|
|
2
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
29
|
exports.ErrorBoundaryEditor = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
30
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
31
|
+
var react_1 = require("react");
|
|
32
|
+
var ErrorBoundaryEditor = /** @class */ (function (_super) {
|
|
33
|
+
__extends(ErrorBoundaryEditor, _super);
|
|
34
|
+
function ErrorBoundaryEditor() {
|
|
35
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
36
|
+
_this.state = {
|
|
10
37
|
hasError: false,
|
|
11
38
|
};
|
|
39
|
+
return _this;
|
|
12
40
|
}
|
|
13
|
-
|
|
41
|
+
ErrorBoundaryEditor.getDerivedStateFromError = function (err) {
|
|
14
42
|
// Update state so the next render will show the fallback UI.
|
|
15
43
|
return { hasError: true, error: err };
|
|
16
|
-
}
|
|
17
|
-
componentDidCatch(error, errorInfo) {
|
|
44
|
+
};
|
|
45
|
+
ErrorBoundaryEditor.prototype.componentDidCatch = function (error, errorInfo) {
|
|
18
46
|
console.error("Uncaught error:", error, errorInfo);
|
|
19
|
-
}
|
|
20
|
-
render() {
|
|
47
|
+
};
|
|
48
|
+
ErrorBoundaryEditor.prototype.render = function () {
|
|
21
49
|
if (this.state.hasError) {
|
|
22
|
-
|
|
23
|
-
return ((0, jsx_runtime_1.jsx)("pre", { style: {
|
|
50
|
+
var err = this.state.error;
|
|
51
|
+
return ((0, jsx_runtime_1.jsx)("pre", __assign({ style: {
|
|
24
52
|
fontSize: "12px",
|
|
25
53
|
color: "red",
|
|
26
54
|
border: "1px solid red",
|
|
27
55
|
borderRadius: "4px",
|
|
28
56
|
padding: "4px",
|
|
29
57
|
overflowX: "auto",
|
|
30
|
-
}, children: err.stack }));
|
|
58
|
+
} }, { children: err.stack }), void 0));
|
|
31
59
|
}
|
|
32
60
|
return this.props.children;
|
|
33
|
-
}
|
|
34
|
-
|
|
61
|
+
};
|
|
62
|
+
return ErrorBoundaryEditor;
|
|
63
|
+
}(react_1.Component));
|
|
35
64
|
exports.ErrorBoundaryEditor = ErrorBoundaryEditor;
|
|
@@ -10,6 +10,6 @@ export declare class ErrorBoundaryFrontend extends Component<Props, State> {
|
|
|
10
10
|
state: State;
|
|
11
11
|
static getDerivedStateFromError(err: Error): State;
|
|
12
12
|
componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
|
|
13
|
-
render(): string | number | boolean |
|
|
13
|
+
render(): string | number | boolean | JSX.Element | React.ReactFragment | null | undefined;
|
|
14
14
|
}
|
|
15
15
|
export {};
|
|
@@ -1,40 +1,69 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __assign = (this && this.__assign) || function () {
|
|
18
|
+
__assign = Object.assign || function(t) {
|
|
19
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
20
|
+
s = arguments[i];
|
|
21
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
22
|
+
t[p] = s[p];
|
|
23
|
+
}
|
|
24
|
+
return t;
|
|
25
|
+
};
|
|
26
|
+
return __assign.apply(this, arguments);
|
|
27
|
+
};
|
|
2
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
29
|
exports.ErrorBoundaryFrontend = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
30
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
31
|
+
var react_1 = require("react");
|
|
32
|
+
var ErrorBoundaryFrontend = /** @class */ (function (_super) {
|
|
33
|
+
__extends(ErrorBoundaryFrontend, _super);
|
|
34
|
+
function ErrorBoundaryFrontend() {
|
|
35
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
36
|
+
_this.state = {
|
|
10
37
|
hasError: false,
|
|
11
38
|
};
|
|
39
|
+
return _this;
|
|
12
40
|
}
|
|
13
|
-
|
|
41
|
+
ErrorBoundaryFrontend.getDerivedStateFromError = function (err) {
|
|
14
42
|
// Update state so the next render will show the fallback UI.
|
|
15
43
|
return { hasError: true, error: err };
|
|
16
|
-
}
|
|
17
|
-
componentDidCatch(error, errorInfo) {
|
|
44
|
+
};
|
|
45
|
+
ErrorBoundaryFrontend.prototype.componentDidCatch = function (error, errorInfo) {
|
|
18
46
|
console.error("Uncaught error:", error, errorInfo);
|
|
19
|
-
}
|
|
20
|
-
render() {
|
|
47
|
+
};
|
|
48
|
+
ErrorBoundaryFrontend.prototype.render = function () {
|
|
21
49
|
if (this.state.hasError) {
|
|
22
|
-
|
|
50
|
+
var err = this.state.error;
|
|
23
51
|
if (process.dev) {
|
|
24
|
-
return ((0, jsx_runtime_1.jsx)("pre", { style: {
|
|
52
|
+
return ((0, jsx_runtime_1.jsx)("pre", __assign({ style: {
|
|
25
53
|
fontSize: "12px",
|
|
26
54
|
color: "red",
|
|
27
55
|
border: "1px solid red",
|
|
28
56
|
borderRadius: "4px",
|
|
29
57
|
padding: "4px",
|
|
30
58
|
overflowX: "auto",
|
|
31
|
-
}, children: err.stack }));
|
|
59
|
+
} }, { children: err.stack }), void 0));
|
|
32
60
|
}
|
|
33
61
|
else {
|
|
34
62
|
return null;
|
|
35
63
|
}
|
|
36
64
|
}
|
|
37
65
|
return this.props.children;
|
|
38
|
-
}
|
|
39
|
-
|
|
66
|
+
};
|
|
67
|
+
return ErrorBoundaryFrontend;
|
|
68
|
+
}(react_1.Component));
|
|
40
69
|
exports.ErrorBoundaryFrontend = ErrorBoundaryFrontend;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { PropsWithChildren } from "react";
|
|
2
|
-
export declare function InspectorControls(props: PropsWithChildren<{}>):
|
|
2
|
+
export declare function InspectorControls(props: PropsWithChildren<{}>): JSX.Element | null;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.InspectorControls = void 0;
|
|
4
|
-
|
|
4
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
// @ts-ignore
|
|
6
|
-
|
|
6
|
+
var block_editor_1 = require("@wordpress/block-editor");
|
|
7
7
|
function InspectorControls(props) {
|
|
8
8
|
if (process.admin) {
|
|
9
|
-
return (0, jsx_runtime_1.jsx)(block_editor_1.InspectorControls, { children: props.children });
|
|
9
|
+
return (0, jsx_runtime_1.jsx)(block_editor_1.InspectorControls, { children: props.children }, void 0);
|
|
10
10
|
}
|
|
11
11
|
return null;
|
|
12
12
|
}
|
|
@@ -3,14 +3,14 @@ import { PropsWithChildren } from "react";
|
|
|
3
3
|
interface Attributes {
|
|
4
4
|
[key: string]: any;
|
|
5
5
|
}
|
|
6
|
-
type ProviderProps = PropsWithChildren<{
|
|
6
|
+
declare type ProviderProps = PropsWithChildren<{
|
|
7
7
|
values: Attributes;
|
|
8
8
|
innerBlocks: ContentBlock[];
|
|
9
9
|
block: [string, Attributes];
|
|
10
10
|
onChange?: (attrs: Attributes) => void;
|
|
11
11
|
insertBlocksAfter?: (block: any) => void;
|
|
12
12
|
}>;
|
|
13
|
-
export declare function InlineEditingContextProvider(props: ProviderProps):
|
|
13
|
+
export declare function InlineEditingContextProvider(props: ProviderProps): JSX.Element;
|
|
14
14
|
export declare function useInlineEditableValue<T>(key: string, defaultValue?: T): [T, (value: T) => void];
|
|
15
15
|
export declare function useBlockAppender(): ((block: any) => void) | undefined;
|
|
16
16
|
export declare function useInnerBlocks(): ContentBlock[];
|
|
@@ -1,52 +1,72 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
14
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
15
|
+
if (ar || !(i in from)) {
|
|
16
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
17
|
+
ar[i] = from[i];
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
21
|
+
};
|
|
2
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
23
|
exports.useBlockParents = exports.useInnerBlocks = exports.useBlockAppender = exports.useInlineEditableValue = exports.InlineEditingContextProvider = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
24
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
25
|
+
var react_1 = require("react");
|
|
26
|
+
var InlineEditingContext = (0, react_1.createContext)(undefined);
|
|
7
27
|
function InlineEditingContextProvider(props) {
|
|
8
|
-
|
|
9
|
-
return ((0, jsx_runtime_1.jsx)(InlineEditingContext.Provider, { value: {
|
|
28
|
+
var parentContext = (0, react_1.useContext)(InlineEditingContext);
|
|
29
|
+
return ((0, jsx_runtime_1.jsx)(InlineEditingContext.Provider, __assign({ value: {
|
|
10
30
|
values: props.values,
|
|
11
31
|
innerBlocks: props.innerBlocks,
|
|
12
|
-
parents: [
|
|
13
|
-
getValue(key) {
|
|
14
|
-
|
|
32
|
+
parents: __spreadArray(__spreadArray([], ((parentContext === null || parentContext === void 0 ? void 0 : parentContext.parents) || []), true), [props.block], false).filter(Boolean),
|
|
33
|
+
getValue: function (key) {
|
|
34
|
+
var _a;
|
|
35
|
+
return (_a = props.values) === null || _a === void 0 ? void 0 : _a[key];
|
|
15
36
|
},
|
|
16
|
-
setValue(key, value) {
|
|
37
|
+
setValue: function (key, value) {
|
|
38
|
+
var _a;
|
|
17
39
|
if (props.onChange) {
|
|
18
|
-
props.onChange({
|
|
19
|
-
...(props.values || {}),
|
|
20
|
-
[key]: value,
|
|
21
|
-
});
|
|
40
|
+
props.onChange(__assign(__assign({}, (props.values || {})), (_a = {}, _a[key] = value, _a)));
|
|
22
41
|
}
|
|
23
42
|
},
|
|
24
43
|
insertBlocksAfter: props.insertBlocksAfter,
|
|
25
|
-
}, children: props.children }));
|
|
44
|
+
} }, { children: props.children }), void 0));
|
|
26
45
|
}
|
|
27
46
|
exports.InlineEditingContextProvider = InlineEditingContextProvider;
|
|
28
47
|
function useInlineEditableValue(key, defaultValue) {
|
|
29
|
-
|
|
48
|
+
var _a;
|
|
49
|
+
var attrs = (0, react_1.useContext)(InlineEditingContext);
|
|
30
50
|
return [
|
|
31
|
-
attrs
|
|
32
|
-
(value)
|
|
33
|
-
attrs
|
|
51
|
+
(_a = attrs === null || attrs === void 0 ? void 0 : attrs.getValue(key)) !== null && _a !== void 0 ? _a : defaultValue,
|
|
52
|
+
function (value) {
|
|
53
|
+
attrs === null || attrs === void 0 ? void 0 : attrs.setValue(key, value);
|
|
34
54
|
},
|
|
35
55
|
];
|
|
36
56
|
}
|
|
37
57
|
exports.useInlineEditableValue = useInlineEditableValue;
|
|
38
58
|
function useBlockAppender() {
|
|
39
|
-
|
|
40
|
-
return ctx
|
|
59
|
+
var ctx = (0, react_1.useContext)(InlineEditingContext);
|
|
60
|
+
return ctx === null || ctx === void 0 ? void 0 : ctx.insertBlocksAfter;
|
|
41
61
|
}
|
|
42
62
|
exports.useBlockAppender = useBlockAppender;
|
|
43
63
|
function useInnerBlocks() {
|
|
44
|
-
|
|
45
|
-
return ctx
|
|
64
|
+
var ctx = (0, react_1.useContext)(InlineEditingContext);
|
|
65
|
+
return (ctx === null || ctx === void 0 ? void 0 : ctx.innerBlocks) || [];
|
|
46
66
|
}
|
|
47
67
|
exports.useInnerBlocks = useInnerBlocks;
|
|
48
68
|
function useBlockParents() {
|
|
49
|
-
|
|
50
|
-
return ctx
|
|
69
|
+
var ctx = (0, react_1.useContext)(InlineEditingContext);
|
|
70
|
+
return (ctx === null || ctx === void 0 ? void 0 : ctx.parents) || [];
|
|
51
71
|
}
|
|
52
72
|
exports.useBlockParents = useBlockParents;
|
package/blocks/index.js
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
9
5
|
}) : (function(o, m, k, k2) {
|
|
10
6
|
if (k2 === undefined) k2 = k;
|
|
11
7
|
o[k2] = m[k];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ElementType, FunctionComponent, ComponentPropsWithoutRef } from "react";
|
|
2
2
|
import { ContentBlocksSettings } from ".";
|
|
3
|
-
type PropTypes<T extends ElementType> = {
|
|
3
|
+
declare type PropTypes<T extends ElementType> = {
|
|
4
4
|
/** The 'key' of this editable text value */
|
|
5
5
|
id: string;
|
|
6
6
|
/** Specify a tag name or React component */
|
|
@@ -14,17 +14,17 @@ type PropTypes<T extends ElementType> = {
|
|
|
14
14
|
/** Append a new block when the user hits 'Enter' */
|
|
15
15
|
appendOnEnter?: boolean;
|
|
16
16
|
} & ComponentPropsWithoutRef<T>;
|
|
17
|
-
export declare function EditableText<T extends ElementType>({ id, as, appendOnEnter, ...props }: PropTypes<T>):
|
|
18
|
-
type AppenderConfig = {
|
|
17
|
+
export declare function EditableText<T extends ElementType>({ id, as, appendOnEnter, ...props }: PropTypes<T>): JSX.Element | null;
|
|
18
|
+
declare type AppenderConfig = {
|
|
19
19
|
type: "default" | "button" | FunctionComponent<any>;
|
|
20
20
|
block?: boolean;
|
|
21
21
|
};
|
|
22
|
-
type InnerBlocksProps = {
|
|
22
|
+
declare type InnerBlocksProps = {
|
|
23
23
|
allowedBlocks?: string[];
|
|
24
24
|
orientation?: "horizontal" | "vertical";
|
|
25
25
|
templateLock?: any;
|
|
26
26
|
template?: any;
|
|
27
27
|
appender?: AppenderConfig;
|
|
28
28
|
} & ContentBlocksSettings;
|
|
29
|
-
export declare function InnerBlocks(props: InnerBlocksProps):
|
|
29
|
+
export declare function InnerBlocks(props: InnerBlocksProps): JSX.Element;
|
|
30
30
|
export {};
|