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