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