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
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
type Props = {
|
|
1
|
+
declare type Props = {
|
|
2
2
|
previewSize: string;
|
|
3
3
|
aspects: string[];
|
|
4
4
|
value: number | null | undefined;
|
|
5
5
|
noBorder?: boolean;
|
|
6
6
|
onChange: (value: number | null) => void;
|
|
7
7
|
};
|
|
8
|
-
export declare function ImageWell(props: Props):
|
|
8
|
+
export declare function ImageWell(props: Props): JSX.Element;
|
|
9
9
|
export {};
|
|
@@ -1,30 +1,41 @@
|
|
|
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
|
+
};
|
|
2
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
14
|
exports.ImageWell = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
15
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
|
+
var react_1 = require("@stitches/react");
|
|
17
|
+
var react_2 = require("react");
|
|
18
|
+
var selectMedia_1 = require("../selectMedia");
|
|
19
|
+
var react_use_1 = require("react-use");
|
|
9
20
|
function ImageWell(props) {
|
|
10
21
|
// @ts-ignore
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
(0, react_2.useEffect)(()
|
|
22
|
+
var acf = window.acf;
|
|
23
|
+
var _a = (0, react_2.useState)(null), selectedImage = _a[0], setSelectedImage = _a[1];
|
|
24
|
+
var _b = (0, react_2.useState)(false), imageIsLoading = _b[0], setImageIsLoading = _b[1];
|
|
25
|
+
(0, react_2.useEffect)(function () {
|
|
15
26
|
if (props.value) {
|
|
16
|
-
|
|
27
|
+
var cancelled_1 = false;
|
|
17
28
|
setImageIsLoading(true);
|
|
18
29
|
fetch("/wp-json/ed/v1/media/" + Number(props.value))
|
|
19
|
-
.then((response)
|
|
20
|
-
.then((image)
|
|
21
|
-
if (
|
|
30
|
+
.then(function (response) { return response.json(); })
|
|
31
|
+
.then(function (image) {
|
|
32
|
+
if (cancelled_1)
|
|
22
33
|
return;
|
|
23
34
|
setImageIsLoading(false);
|
|
24
35
|
setSelectedImage(image);
|
|
25
36
|
});
|
|
26
|
-
return ()
|
|
27
|
-
|
|
37
|
+
return function () {
|
|
38
|
+
cancelled_1 = true;
|
|
28
39
|
};
|
|
29
40
|
}
|
|
30
41
|
else {
|
|
@@ -32,16 +43,17 @@ function ImageWell(props) {
|
|
|
32
43
|
setImageIsLoading(false);
|
|
33
44
|
}
|
|
34
45
|
}, [props.value]);
|
|
35
|
-
|
|
36
|
-
return ((0, jsx_runtime_1.jsxs)(Wrapper, { noBorder: props.noBorder, children: [imageIsLoading ? ((0, jsx_runtime_1.jsx)(Loading, { children: (0, jsx_runtime_1.jsx)(Spinner, {}) })) : selectedImage ? ((0, jsx_runtime_1.jsxs)(ImageContainer, { children: [(0, jsx_runtime_1.jsx)("img", { ref: imgRef, src: selectedImage.sizes[props.previewSize] || selectedImage.sizes["thumbnail"] }), (0, jsx_runtime_1.jsx)(AspectWrapper, { css: {
|
|
46
|
+
var _c = (0, react_use_1.useMeasure)(), imgRef = _c[0], size = _c[1];
|
|
47
|
+
return ((0, jsx_runtime_1.jsxs)(Wrapper, __assign({ noBorder: props.noBorder }, { children: [imageIsLoading ? ((0, jsx_runtime_1.jsx)(Loading, { children: (0, jsx_runtime_1.jsx)(Spinner, {}, void 0) }, void 0)) : selectedImage ? ((0, jsx_runtime_1.jsxs)(ImageContainer, { children: [(0, jsx_runtime_1.jsx)("img", { ref: imgRef, src: selectedImage.sizes[props.previewSize] || selectedImage.sizes["thumbnail"] }, void 0), (0, jsx_runtime_1.jsx)(AspectWrapper, __assign({ css: {
|
|
37
48
|
width: size.width,
|
|
38
49
|
height: size.height,
|
|
39
|
-
}, children: props.aspects &&
|
|
40
|
-
props.aspects.map((aspect)
|
|
41
|
-
|
|
50
|
+
} }, { children: props.aspects &&
|
|
51
|
+
props.aspects.map(function (aspect) {
|
|
52
|
+
var _a;
|
|
53
|
+
var x, y, width, height, originalAspect = 0, ownAspect = 0;
|
|
42
54
|
try {
|
|
43
55
|
;
|
|
44
|
-
|
|
56
|
+
_a = aspect.split(/\s*\/\s*/), x = _a[0], y = _a[1];
|
|
45
57
|
originalAspect = size.width / size.height;
|
|
46
58
|
ownAspect = Number(x) / Number(y);
|
|
47
59
|
}
|
|
@@ -51,13 +63,13 @@ function ImageWell(props) {
|
|
|
51
63
|
width = ownAspect > originalAspect ? size.width : size.height * ownAspect;
|
|
52
64
|
height = ownAspect > originalAspect ? size.width / ownAspect : size.height;
|
|
53
65
|
return (0, jsx_runtime_1.jsx)(AspectDisplay, { style: { width: width + "px", height: height + "px" } }, aspect);
|
|
54
|
-
}) })] })) : ((0, jsx_runtime_1.jsx)(NoSelection, { children: (0, jsx_runtime_1.jsx)(ChooseButton, { onClick: (e)
|
|
66
|
+
}) }), void 0)] }, void 0)) : ((0, jsx_runtime_1.jsx)(NoSelection, { children: (0, jsx_runtime_1.jsx)(ChooseButton, __assign({ onClick: function (e) {
|
|
55
67
|
e.preventDefault();
|
|
56
68
|
(0, selectMedia_1.selectMedia)({
|
|
57
69
|
mode: "select",
|
|
58
70
|
type: "image",
|
|
59
71
|
title: "Select an image",
|
|
60
|
-
select: (selected)
|
|
72
|
+
select: function (selected) {
|
|
61
73
|
if (selected) {
|
|
62
74
|
props.onChange(selected.id);
|
|
63
75
|
}
|
|
@@ -70,10 +82,10 @@ function ImageWell(props) {
|
|
|
70
82
|
// attachment: [props.value],
|
|
71
83
|
// select: (selected: any) => console.log("Selected", selected),
|
|
72
84
|
// })
|
|
73
|
-
}, children: "Choose an image" }) })), (0, jsx_runtime_1.jsx)(Toolbar, { children: selectedImage || imageIsLoading ? ((0, jsx_runtime_1.jsxs)(react_2.Fragment, { children: [(0, jsx_runtime_1.jsx)(ToolbarButton, { onClick: (e)
|
|
85
|
+
} }, { children: "Choose an image" }), void 0) }, void 0)), (0, jsx_runtime_1.jsx)(Toolbar, { children: selectedImage || imageIsLoading ? ((0, jsx_runtime_1.jsxs)(react_2.Fragment, { children: [(0, jsx_runtime_1.jsx)(ToolbarButton, __assign({ onClick: function (e) {
|
|
74
86
|
e.preventDefault();
|
|
75
87
|
props.onChange(null);
|
|
76
|
-
}, children: (0, jsx_runtime_1.jsx)("span", { className: "dashicons dashicons-trash" }) }), (0, jsx_runtime_1.jsx)(ToolbarButton, { onClick: (e)
|
|
88
|
+
} }, { children: (0, jsx_runtime_1.jsx)("span", { className: "dashicons dashicons-trash" }, void 0) }), void 0), (0, jsx_runtime_1.jsx)(ToolbarButton, __assign({ onClick: function (e) {
|
|
77
89
|
e.preventDefault();
|
|
78
90
|
(0, selectMedia_1.selectMedia)({
|
|
79
91
|
mode: "edit",
|
|
@@ -81,13 +93,13 @@ function ImageWell(props) {
|
|
|
81
93
|
attachment: Number(props.value),
|
|
82
94
|
title: "Edit Image",
|
|
83
95
|
});
|
|
84
|
-
}, children: (0, jsx_runtime_1.jsx)("span", { className: "dashicons dashicons-edit" }) }), selectedImage && ((0, jsx_runtime_1.jsx)(ToolbarButton, { onClick: (e)
|
|
96
|
+
} }, { children: (0, jsx_runtime_1.jsx)("span", { className: "dashicons dashicons-edit" }, void 0) }), void 0), selectedImage && ((0, jsx_runtime_1.jsx)(ToolbarButton, __assign({ onClick: function (e) {
|
|
85
97
|
e.preventDefault();
|
|
86
98
|
window.open(selectedImage.url);
|
|
87
|
-
}, children: (0, jsx_runtime_1.jsx)("span", { className: "dashicons dashicons-external" }) }))] })) : null })] }));
|
|
99
|
+
} }, { children: (0, jsx_runtime_1.jsx)("span", { className: "dashicons dashicons-external" }, void 0) }), void 0))] }, void 0)) : null }, void 0)] }), void 0));
|
|
88
100
|
}
|
|
89
101
|
exports.ImageWell = ImageWell;
|
|
90
|
-
|
|
102
|
+
var Wrapper = (0, react_1.styled)("div", {
|
|
91
103
|
position: "relative",
|
|
92
104
|
display: "block",
|
|
93
105
|
width: "100%",
|
|
@@ -101,7 +113,7 @@ const Wrapper = (0, react_1.styled)("div", {
|
|
|
101
113
|
},
|
|
102
114
|
},
|
|
103
115
|
});
|
|
104
|
-
|
|
116
|
+
var ImageContainer = (0, react_1.styled)("div", {
|
|
105
117
|
margin: "4px",
|
|
106
118
|
display: "block",
|
|
107
119
|
position: "relative",
|
|
@@ -110,7 +122,7 @@ const ImageContainer = (0, react_1.styled)("div", {
|
|
|
110
122
|
display: "block",
|
|
111
123
|
},
|
|
112
124
|
});
|
|
113
|
-
|
|
125
|
+
var spin = (0, react_1.keyframes)({
|
|
114
126
|
from: {
|
|
115
127
|
transform: "rotate(0deg)",
|
|
116
128
|
},
|
|
@@ -118,22 +130,22 @@ const spin = (0, react_1.keyframes)({
|
|
|
118
130
|
transform: "rotate(360deg)",
|
|
119
131
|
},
|
|
120
132
|
});
|
|
121
|
-
|
|
133
|
+
var Spinner = (0, react_1.styled)("div", {
|
|
122
134
|
display: "block",
|
|
123
135
|
width: "16px",
|
|
124
136
|
height: "16px",
|
|
125
137
|
borderRadius: "100px",
|
|
126
138
|
border: "4px solid transparent",
|
|
127
139
|
borderTopColor: "currentColor",
|
|
128
|
-
animation:
|
|
140
|
+
animation: "".concat(spin, " 0.5s linear infinite"),
|
|
129
141
|
});
|
|
130
|
-
|
|
142
|
+
var Loading = (0, react_1.styled)("div", {
|
|
131
143
|
display: "flex",
|
|
132
144
|
justifyContent: "center",
|
|
133
145
|
alignItems: "center",
|
|
134
146
|
padding: "10px",
|
|
135
147
|
});
|
|
136
|
-
|
|
148
|
+
var Toolbar = (0, react_1.styled)("div", {
|
|
137
149
|
position: "absolute",
|
|
138
150
|
top: "0",
|
|
139
151
|
right: "6px",
|
|
@@ -143,7 +155,7 @@ const Toolbar = (0, react_1.styled)("div", {
|
|
|
143
155
|
flexDirection: "column",
|
|
144
156
|
justifyContent: "center",
|
|
145
157
|
});
|
|
146
|
-
|
|
158
|
+
var ToolbarButton = (0, react_1.styled)("button", {
|
|
147
159
|
width: "24px",
|
|
148
160
|
height: "24px",
|
|
149
161
|
fontSize: "12px",
|
|
@@ -162,12 +174,12 @@ const ToolbarButton = (0, react_1.styled)("button", {
|
|
|
162
174
|
ToolbarButton.defaultProps = {
|
|
163
175
|
className: "dashicons",
|
|
164
176
|
};
|
|
165
|
-
|
|
177
|
+
var NoSelection = (0, react_1.styled)("div", {
|
|
166
178
|
display: "flex",
|
|
167
179
|
justifyContent: "center",
|
|
168
180
|
padding: "10px 0px",
|
|
169
181
|
});
|
|
170
|
-
|
|
182
|
+
var ChooseButton = (0, react_1.styled)("button", {
|
|
171
183
|
appearance: "none",
|
|
172
184
|
border: "0px",
|
|
173
185
|
background: "#f6f6f6",
|
|
@@ -176,7 +188,7 @@ const ChooseButton = (0, react_1.styled)("button", {
|
|
|
176
188
|
borderRadius: "100px",
|
|
177
189
|
cursor: "pointer",
|
|
178
190
|
});
|
|
179
|
-
|
|
191
|
+
var AspectWrapper = (0, react_1.styled)("div", {
|
|
180
192
|
position: "absolute",
|
|
181
193
|
left: 0,
|
|
182
194
|
top: 0,
|
|
@@ -188,7 +200,7 @@ const AspectWrapper = (0, react_1.styled)("div", {
|
|
|
188
200
|
opacity: 1,
|
|
189
201
|
},
|
|
190
202
|
});
|
|
191
|
-
|
|
203
|
+
var AspectDisplay = (0, react_1.styled)("div", {
|
|
192
204
|
position: "absolute",
|
|
193
205
|
border: "1px solid white",
|
|
194
206
|
left: "50%",
|
package/admin/defineField.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { ReactElement } from "react";
|
|
2
|
-
export type FieldProps<T> = {
|
|
2
|
+
export declare type FieldProps<T> = {
|
|
3
3
|
value: T;
|
|
4
4
|
onChange: (value: T) => void;
|
|
5
5
|
settings: {
|
|
6
6
|
[key: string]: any;
|
|
7
7
|
};
|
|
8
8
|
};
|
|
9
|
-
export type FieldTypeDefinition<T> = {
|
|
9
|
+
export declare type FieldTypeDefinition<T> = {
|
|
10
10
|
render: (props: FieldProps<T>) => ReactElement;
|
|
11
11
|
defaultValue?: T;
|
|
12
12
|
validate?: (value: T) => boolean | string;
|
package/admin/defineWidget.d.ts
CHANGED
package/admin/defineWidget.js
CHANGED
package/admin/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,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];
|
|
@@ -27,34 +23,38 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
27
23
|
};
|
|
28
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
25
|
exports.installFieldTypes = void 0;
|
|
30
|
-
|
|
26
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
31
27
|
// @ts-ignore
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
28
|
+
var fields_1 = __importDefault(require("@manifest/fields"));
|
|
29
|
+
var ReactDOM = __importStar(require("react-dom"));
|
|
30
|
+
var react_1 = require("react");
|
|
35
31
|
function installFieldTypes() {
|
|
36
32
|
// @ts-ignore
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
33
|
+
var acf = window.acf;
|
|
34
|
+
var _loop_1 = function (name_1) {
|
|
35
|
+
var type = fields_1.default[name_1];
|
|
36
|
+
var Component = type.render;
|
|
37
|
+
var init = function (field) {
|
|
42
38
|
console.log("Field is", field);
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
39
|
+
var $el = field.$el, cid = field.cid, data = field.data;
|
|
40
|
+
var input = $el.find("input[type='hidden']");
|
|
41
|
+
var container = document.createElement("div");
|
|
46
42
|
$el.append(container);
|
|
47
|
-
ReactDOM.render((0, jsx_runtime_1.jsx)(FieldWrapper, { defaultValue: type.defaultValue, validate: type.validate, field: data, input: input[0], settings: input.data("settings"), Component: Component }), container);
|
|
43
|
+
ReactDOM.render((0, jsx_runtime_1.jsx)(FieldWrapper, { defaultValue: type.defaultValue, validate: type.validate, field: data, input: input[0], settings: input.data("settings"), Component: Component }, void 0), container);
|
|
48
44
|
};
|
|
49
|
-
acf.addAction("ready_field/type=" +
|
|
50
|
-
acf.addAction("append_field/type=" +
|
|
45
|
+
acf.addAction("ready_field/type=" + name_1, init);
|
|
46
|
+
acf.addAction("append_field/type=" + name_1, init);
|
|
47
|
+
};
|
|
48
|
+
for (var name_1 in fields_1.default) {
|
|
49
|
+
_loop_1(name_1);
|
|
51
50
|
}
|
|
52
51
|
}
|
|
53
52
|
exports.installFieldTypes = installFieldTypes;
|
|
54
|
-
function FieldWrapper(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
(0, react_1.
|
|
53
|
+
function FieldWrapper(_a) {
|
|
54
|
+
var input = _a.input, defaultValue = _a.defaultValue, Component = _a.Component, settings = _a.settings;
|
|
55
|
+
var _b = (0, react_1.useState)(function () { var _a; return (_a = (input.value ? JSON.parse(input.value) : null)) !== null && _a !== void 0 ? _a : defaultValue; }), value = _b[0], setValue = _b[1];
|
|
56
|
+
var _c = (0, react_1.useState)(false), valueChanged = _c[0], setValueChanged = _c[1];
|
|
57
|
+
(0, react_1.useEffect)(function () {
|
|
58
58
|
input.value = JSON.stringify(value);
|
|
59
59
|
if (valueChanged) {
|
|
60
60
|
try {
|
|
@@ -65,8 +65,8 @@ function FieldWrapper({ input, defaultValue, Component, settings }) {
|
|
|
65
65
|
setValueChanged(false);
|
|
66
66
|
}
|
|
67
67
|
}, [value, valueChanged]);
|
|
68
|
-
return ((0, jsx_runtime_1.jsx)(Component, { value: value, onChange: (value)
|
|
68
|
+
return ((0, jsx_runtime_1.jsx)(Component, { value: value, onChange: function (value) {
|
|
69
69
|
setValue(value);
|
|
70
70
|
setValueChanged(true);
|
|
71
|
-
}, settings: settings }));
|
|
71
|
+
}, settings: settings }, void 0));
|
|
72
72
|
}
|
package/admin/runWidgets.js
CHANGED
|
@@ -1,40 +1,51 @@
|
|
|
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
|
+
};
|
|
2
13
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
15
|
};
|
|
5
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
17
|
exports.runWidgets = void 0;
|
|
7
|
-
|
|
18
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
19
|
// @ts-ignore
|
|
9
|
-
|
|
10
|
-
|
|
20
|
+
var widgets_1 = __importDefault(require("@manifest/widgets"));
|
|
21
|
+
var client_1 = require("react-dom/client");
|
|
11
22
|
function runWidgets() {
|
|
12
|
-
|
|
23
|
+
var elements = document.querySelectorAll("[data-widget]");
|
|
13
24
|
console.log("Running widgets", elements, widgets_1.default);
|
|
14
|
-
elements.forEach((el)
|
|
25
|
+
elements.forEach(function (el) {
|
|
15
26
|
if (el instanceof HTMLElement) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
27
|
+
var data = el.dataset;
|
|
28
|
+
var name_1 = data["widget"];
|
|
29
|
+
var type = widgets_1.default.find(function (item) { return item.name === name_1; });
|
|
19
30
|
if (type) {
|
|
20
|
-
|
|
31
|
+
var props_1 = {
|
|
21
32
|
element: el,
|
|
22
33
|
dataset: data,
|
|
23
34
|
};
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
35
|
+
var root_1 = (0, client_1.createRoot)(el);
|
|
36
|
+
var renderWithComponent_1 = function (Component) {
|
|
37
|
+
root_1.render((0, jsx_runtime_1.jsx)(Component, __assign({}, props_1), void 0));
|
|
27
38
|
};
|
|
28
|
-
|
|
39
|
+
renderWithComponent_1(type.component);
|
|
29
40
|
// @ts-ignore
|
|
30
41
|
if (import.meta.webpackHot) {
|
|
31
42
|
// @ts-ignore
|
|
32
|
-
import.meta.webpackHot.accept([require.resolve("@manifest/widgets")], ()
|
|
43
|
+
import.meta.webpackHot.accept([require.resolve("@manifest/widgets")], function () {
|
|
33
44
|
console.log("Widgets mani");
|
|
34
|
-
|
|
35
|
-
|
|
45
|
+
var updateWidgets = require("@manifest/widgets").default;
|
|
46
|
+
var type = updateWidgets.find(function (item) { return item.name === name_1; });
|
|
36
47
|
if (type) {
|
|
37
|
-
|
|
48
|
+
renderWithComponent_1(type.component);
|
|
38
49
|
}
|
|
39
50
|
});
|
|
40
51
|
}
|
package/admin/selectMedia.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
type Attachment = {
|
|
1
|
+
declare type Attachment = {
|
|
2
2
|
id: number;
|
|
3
3
|
filename: string;
|
|
4
4
|
mime: string;
|
|
@@ -15,7 +15,7 @@ type Attachment = {
|
|
|
15
15
|
};
|
|
16
16
|
};
|
|
17
17
|
};
|
|
18
|
-
type MediaPopupArgs = {
|
|
18
|
+
declare type MediaPopupArgs = {
|
|
19
19
|
mode?: "select" | "edit";
|
|
20
20
|
type?: string;
|
|
21
21
|
title?: string;
|
package/admin/selectMedia.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReactElement } from "react";
|
|
2
|
-
export type ContentBlock<T extends keyof BlockProps | string = any> = {
|
|
2
|
+
export declare type ContentBlock<T extends keyof BlockProps | string = any> = {
|
|
3
3
|
attrs: any;
|
|
4
4
|
blockName: T;
|
|
5
5
|
props: BlockProps extends keyof BlockProps ? BlockProps[T] : any;
|
|
@@ -9,7 +9,7 @@ export type ContentBlock<T extends keyof BlockProps | string = any> = {
|
|
|
9
9
|
rule: string;
|
|
10
10
|
inline: any;
|
|
11
11
|
};
|
|
12
|
-
type BlocksContext = {
|
|
12
|
+
declare type BlocksContext = {
|
|
13
13
|
ancestors: ContentBlock[];
|
|
14
14
|
parent?: ContentBlock;
|
|
15
15
|
prev?: ContentBlock;
|
|
@@ -17,7 +17,7 @@ type BlocksContext = {
|
|
|
17
17
|
current: ContentBlock;
|
|
18
18
|
};
|
|
19
19
|
export declare const BlocksContext: import("react").Context<BlocksContext | undefined>;
|
|
20
|
-
export type ContentBlocksSettings = {
|
|
20
|
+
export declare type ContentBlocksSettings = {
|
|
21
21
|
wrapBlock?: (child: ReactElement, ctx: BlocksContext) => ReactElement;
|
|
22
22
|
spacer?: (ctx: {
|
|
23
23
|
ancestors: ContentBlock[];
|
|
@@ -26,14 +26,14 @@ export type ContentBlocksSettings = {
|
|
|
26
26
|
next: ContentBlock | null;
|
|
27
27
|
}) => ReactElement | null;
|
|
28
28
|
};
|
|
29
|
-
type Props = {
|
|
29
|
+
declare type Props = {
|
|
30
30
|
blocks: ContentBlock[];
|
|
31
31
|
} & ContentBlocksSettings;
|
|
32
|
-
export type GenericBlockProps = {
|
|
32
|
+
export declare type GenericBlockProps = {
|
|
33
33
|
innerHTML?: string;
|
|
34
34
|
innerContent?: string[];
|
|
35
35
|
innerBlocks?: ContentBlock[];
|
|
36
36
|
children: ReactElement | null;
|
|
37
37
|
};
|
|
38
|
-
export declare function ContentBlocks(props: Props):
|
|
38
|
+
export declare function ContentBlocks(props: Props): JSX.Element | null;
|
|
39
39
|
export {};
|