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/hooks/queryUtils.js
CHANGED
|
@@ -1,132 +1,67 @@
|
|
|
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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
-
function step(op) {
|
|
27
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
-
while (_) try {
|
|
29
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
-
switch (op[0]) {
|
|
32
|
-
case 0: case 1: t = op; break;
|
|
33
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
-
default:
|
|
37
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
-
if (t[2]) _.ops.pop();
|
|
42
|
-
_.trys.pop(); continue;
|
|
43
|
-
}
|
|
44
|
-
op = body.call(thisArg, _);
|
|
45
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
50
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
51
|
-
if (ar || !(i in from)) {
|
|
52
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
53
|
-
ar[i] = from[i];
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
57
|
-
};
|
|
58
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
59
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
60
4
|
};
|
|
61
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
62
6
|
exports.createUseMutation = exports.createUseInfiniteQuery = exports.createUseQuery = void 0;
|
|
63
|
-
|
|
64
|
-
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const swr_1 = __importDefault(require("swr"));
|
|
65
9
|
/** Generic fetcher functions */
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
return [4 /*yield*/, fetch(url, {})];
|
|
75
|
-
case 1:
|
|
76
|
-
result = _a.sent();
|
|
77
|
-
return [4 /*yield*/, result.json()];
|
|
78
|
-
case 2:
|
|
79
|
-
payload = _a.sent();
|
|
80
|
-
return [2 /*return*/, payload];
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
}); };
|
|
10
|
+
const fetcherGET = async (name, params) => {
|
|
11
|
+
let url = process.serverless ? `/api/rest/query/${name}` : `/wp-json/ed/v1/query/${name}`;
|
|
12
|
+
if (params)
|
|
13
|
+
url += "?params=" + encodeURIComponent(params);
|
|
14
|
+
const result = await fetch(url, {});
|
|
15
|
+
const payload = await result.json();
|
|
16
|
+
return payload;
|
|
17
|
+
};
|
|
84
18
|
function createUseQuery(init) {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}), payload = _c.data, isValidating = _c.isValidating, error = _c.error, mutate = _c.mutate;
|
|
19
|
+
const hook = (vars, opts) => {
|
|
20
|
+
const { data: payload, isValidating, error, mutate, } = (0, swr_1.default)([init.name, JSON.stringify(vars)], fetcherGET, {
|
|
21
|
+
revalidateIfStale: opts?.revalidateIfStale ?? false,
|
|
22
|
+
revalidateOnFocus: opts?.revalidateOnFocus ?? false,
|
|
23
|
+
});
|
|
91
24
|
return {
|
|
92
25
|
loading: isValidating && !payload,
|
|
93
|
-
data: payload
|
|
94
|
-
errors: error ? [error] : payload
|
|
26
|
+
data: payload?.data,
|
|
27
|
+
errors: error ? [error] : payload?.errors,
|
|
95
28
|
refresh: mutate,
|
|
96
29
|
};
|
|
97
30
|
};
|
|
98
|
-
hook.fetch =
|
|
99
|
-
return fetcherGET(init.name, JSON.stringify(vars)).then(
|
|
31
|
+
hook.fetch = (vars) => {
|
|
32
|
+
return fetcherGET(init.name, JSON.stringify(vars)).then((payload) => payload.data);
|
|
100
33
|
};
|
|
101
34
|
return hook;
|
|
102
35
|
}
|
|
103
36
|
exports.createUseQuery = createUseQuery;
|
|
104
37
|
function createUseInfiniteQuery(init) {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
for (
|
|
108
|
-
var segment = path_1[_i];
|
|
38
|
+
const extract = (path, payload) => {
|
|
39
|
+
let value = payload;
|
|
40
|
+
for (const segment of path) {
|
|
109
41
|
value = value[segment];
|
|
110
42
|
}
|
|
111
43
|
return value;
|
|
112
44
|
};
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
45
|
+
const hook = (vars, opts) => {
|
|
46
|
+
const [activeCursor, setActiveCursor] = (0, react_1.useState)();
|
|
47
|
+
const [errors, setErrors] = (0, react_1.useState)();
|
|
48
|
+
const [nextCursor, setNextCursor] = (0, react_1.useState)(undefined);
|
|
49
|
+
const [hasMore, setHasMore] = (0, react_1.useState)(false);
|
|
50
|
+
const [isLoadingMore, setIsLoadingMore] = (0, react_1.useState)(true);
|
|
51
|
+
const [items, setItems] = (0, react_1.useState)([]);
|
|
52
|
+
const [varPayload, setVarPayload] = (0, react_1.useState)(vars);
|
|
53
|
+
const { data: payload, isValidating, error, mutate, } = (0, swr_1.default)([
|
|
122
54
|
init.name,
|
|
123
|
-
JSON.stringify(
|
|
55
|
+
JSON.stringify({
|
|
56
|
+
...(varPayload || {}),
|
|
57
|
+
cursor: activeCursor,
|
|
58
|
+
}),
|
|
124
59
|
], fetcherGET, {
|
|
125
60
|
revalidateIfStale: false,
|
|
126
61
|
revalidateOnFocus: false,
|
|
127
62
|
revalidateOnReconnect: false,
|
|
128
|
-
})
|
|
129
|
-
(0, react_1.useEffect)(
|
|
63
|
+
});
|
|
64
|
+
(0, react_1.useEffect)(() => {
|
|
130
65
|
setItems([]);
|
|
131
66
|
setIsLoadingMore(true);
|
|
132
67
|
setErrors(undefined);
|
|
@@ -134,7 +69,7 @@ function createUseInfiniteQuery(init) {
|
|
|
134
69
|
setActiveCursor(undefined);
|
|
135
70
|
setVarPayload(vars);
|
|
136
71
|
}, [JSON.stringify(vars)]);
|
|
137
|
-
(0, react_1.useEffect)(
|
|
72
|
+
(0, react_1.useEffect)(() => {
|
|
138
73
|
if (payload) {
|
|
139
74
|
setIsLoadingMore(false);
|
|
140
75
|
if (payload.errors) {
|
|
@@ -142,14 +77,14 @@ function createUseInfiniteQuery(init) {
|
|
|
142
77
|
}
|
|
143
78
|
else if (payload.data) {
|
|
144
79
|
// Extract data
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
80
|
+
const nodes = extract(init.paths.nodesPath, payload.data);
|
|
81
|
+
const nextCursor = extract(init.paths.endCursorPath, payload.data);
|
|
82
|
+
const hasMore = extract(init.paths.hasNextPagePath, payload.data);
|
|
148
83
|
setErrors(undefined);
|
|
149
|
-
setNextCursor(
|
|
150
|
-
setHasMore(
|
|
84
|
+
setNextCursor(nextCursor);
|
|
85
|
+
setHasMore(hasMore);
|
|
151
86
|
setIsLoadingMore(false);
|
|
152
|
-
setItems(
|
|
87
|
+
setItems(() => [...items, ...nodes]);
|
|
153
88
|
}
|
|
154
89
|
}
|
|
155
90
|
}, [payload]);
|
|
@@ -159,14 +94,14 @@ function createUseInfiniteQuery(init) {
|
|
|
159
94
|
items: items,
|
|
160
95
|
cursor: activeCursor,
|
|
161
96
|
errors: error ? [error] : errors,
|
|
162
|
-
refresh:
|
|
97
|
+
refresh: () => {
|
|
163
98
|
setErrors(undefined);
|
|
164
99
|
setNextCursor(undefined);
|
|
165
100
|
setActiveCursor(undefined);
|
|
166
101
|
setIsLoadingMore(false);
|
|
167
102
|
mutate();
|
|
168
103
|
},
|
|
169
|
-
loadMore
|
|
104
|
+
loadMore() {
|
|
170
105
|
if (isLoadingMore || !hasMore)
|
|
171
106
|
return;
|
|
172
107
|
setIsLoadingMore(true);
|
|
@@ -179,92 +114,66 @@ function createUseInfiniteQuery(init) {
|
|
|
179
114
|
}
|
|
180
115
|
exports.createUseInfiniteQuery = createUseInfiniteQuery;
|
|
181
116
|
function createUseMutation(init) {
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
result = _a.sent();
|
|
209
|
-
return [4 /*yield*/, result.json()];
|
|
210
|
-
case 3:
|
|
211
|
-
payload = _a.sent();
|
|
212
|
-
if (payload.errors) {
|
|
213
|
-
setErrors(payload.errors);
|
|
214
|
-
}
|
|
215
|
-
else {
|
|
216
|
-
setData(payload.data);
|
|
217
|
-
setSubmitted(true);
|
|
218
|
-
setErrors(undefined);
|
|
219
|
-
}
|
|
220
|
-
return [3 /*break*/, 5];
|
|
221
|
-
case 4:
|
|
222
|
-
error_1 = _a.sent();
|
|
223
|
-
setErrors([error_1]);
|
|
224
|
-
return [2 /*return*/];
|
|
225
|
-
case 5:
|
|
226
|
-
setSubmitting(false);
|
|
227
|
-
return [2 /*return*/];
|
|
117
|
+
const hook = (opts) => {
|
|
118
|
+
const [submitting, setSubmitting] = (0, react_1.useState)(false);
|
|
119
|
+
const [submitted, setSubmitted] = (0, react_1.useState)(false);
|
|
120
|
+
const [data, setData] = (0, react_1.useState)(undefined);
|
|
121
|
+
const [errors, setErrors] = (0, react_1.useState)();
|
|
122
|
+
const submit = async (params) => {
|
|
123
|
+
setSubmitting(true);
|
|
124
|
+
setSubmitted(false);
|
|
125
|
+
let url = process.serverless ? `/api/rest/mutation/${init.name}` : `/wp-json/ed/v1/mutation/${init.name}`;
|
|
126
|
+
try {
|
|
127
|
+
const result = await fetch(url, {
|
|
128
|
+
method: "POST",
|
|
129
|
+
headers: {
|
|
130
|
+
"Content-type": "application/json",
|
|
131
|
+
},
|
|
132
|
+
credentials: "include",
|
|
133
|
+
body: JSON.stringify(params),
|
|
134
|
+
});
|
|
135
|
+
const payload = await result.json();
|
|
136
|
+
if (payload.errors) {
|
|
137
|
+
setErrors(payload.errors);
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
setData(payload.data);
|
|
141
|
+
setSubmitted(true);
|
|
142
|
+
setErrors(undefined);
|
|
228
143
|
}
|
|
229
|
-
}
|
|
230
|
-
|
|
144
|
+
}
|
|
145
|
+
catch (error) {
|
|
146
|
+
setErrors([error]);
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
setSubmitting(false);
|
|
150
|
+
};
|
|
231
151
|
return {
|
|
232
|
-
submitting
|
|
233
|
-
submitted
|
|
234
|
-
data
|
|
235
|
-
errors
|
|
236
|
-
submit
|
|
152
|
+
submitting,
|
|
153
|
+
submitted,
|
|
154
|
+
data,
|
|
155
|
+
errors,
|
|
156
|
+
submit,
|
|
237
157
|
};
|
|
238
158
|
};
|
|
239
|
-
hook.mutate =
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
"Content-type": "application/json",
|
|
249
|
-
},
|
|
250
|
-
credentials: "include",
|
|
251
|
-
body: JSON.stringify(vars),
|
|
252
|
-
})];
|
|
253
|
-
case 1:
|
|
254
|
-
result = _a.sent();
|
|
255
|
-
return [4 /*yield*/, result.json()];
|
|
256
|
-
case 2:
|
|
257
|
-
payload = _a.sent();
|
|
258
|
-
if (payload.errors) {
|
|
259
|
-
throw payload.errors;
|
|
260
|
-
}
|
|
261
|
-
else {
|
|
262
|
-
return [2 /*return*/, payload.data];
|
|
263
|
-
}
|
|
264
|
-
return [2 /*return*/];
|
|
265
|
-
}
|
|
159
|
+
hook.mutate = async (vars) => {
|
|
160
|
+
let url = process.serverless ? `/api/rest/mutation/${init.name}` : `/wp-json/ed/v1/mutation/${init.name}`;
|
|
161
|
+
const result = await fetch(url, {
|
|
162
|
+
method: "POST",
|
|
163
|
+
headers: {
|
|
164
|
+
"Content-type": "application/json",
|
|
165
|
+
},
|
|
166
|
+
credentials: "include",
|
|
167
|
+
body: JSON.stringify(vars),
|
|
266
168
|
});
|
|
267
|
-
|
|
169
|
+
const payload = await result.json();
|
|
170
|
+
if (payload.errors) {
|
|
171
|
+
throw payload.errors;
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
return payload.data;
|
|
175
|
+
}
|
|
176
|
+
};
|
|
268
177
|
return hook;
|
|
269
178
|
}
|
|
270
179
|
exports.createUseMutation = createUseMutation;
|
package/hooks/useAppData.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
type AppData = ViewProps["_app"];
|
|
2
2
|
interface AppDataStore {
|
|
3
3
|
data: AppData;
|
|
4
4
|
setAppData(data: AppData): void;
|
|
5
5
|
}
|
|
6
6
|
declare const useAppDataStore: import("zustand").UseBoundStore<AppDataStore, import("zustand").StoreApi<AppDataStore>>;
|
|
7
|
-
|
|
7
|
+
type Selector<T> = (data: AppData) => T;
|
|
8
8
|
declare function useAppData(): AppData;
|
|
9
9
|
declare function useAppData<T>(selector: Selector<T>): T;
|
|
10
10
|
export { useAppData, useAppDataStore };
|
package/hooks/useAppData.js
CHANGED
|
@@ -4,20 +4,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.useAppDataStore = exports.useAppData = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const zustand_1 = __importDefault(require("zustand"));
|
|
9
|
+
const serverlessAppContext_1 = require("../utils/serverlessAppContext");
|
|
10
|
+
const useAppDataStore = (0, zustand_1.default)((set) => ({
|
|
11
11
|
data: undefined,
|
|
12
|
-
setAppData
|
|
13
|
-
set({ data
|
|
12
|
+
setAppData(data) {
|
|
13
|
+
set({ data });
|
|
14
14
|
},
|
|
15
|
-
})
|
|
15
|
+
}));
|
|
16
16
|
exports.useAppDataStore = useAppDataStore;
|
|
17
17
|
function useAppData(selector) {
|
|
18
18
|
// @ts-ignore
|
|
19
19
|
if (process.serverless) {
|
|
20
|
-
|
|
20
|
+
const value = (0, react_1.useContext)(serverlessAppContext_1.ServerlessAppDataContext);
|
|
21
21
|
if (selector)
|
|
22
22
|
return selector(value);
|
|
23
23
|
return value;
|
|
@@ -27,7 +27,7 @@ function useAppData(selector) {
|
|
|
27
27
|
return selector ? selector(__ED_APP_DATA.data) : __ED_APP_DATA.data;
|
|
28
28
|
}
|
|
29
29
|
else {
|
|
30
|
-
return useAppDataStore(
|
|
30
|
+
return useAppDataStore((store) => {
|
|
31
31
|
if (selector)
|
|
32
32
|
return selector(store.data);
|
|
33
33
|
return store.data;
|
package/hooks/usePageLoad.js
CHANGED
|
@@ -4,8 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.usePageLoad = void 0;
|
|
7
|
-
|
|
8
|
-
exports.usePageLoad = (0, zustand_1.default)(
|
|
7
|
+
const zustand_1 = __importDefault(require("zustand"));
|
|
8
|
+
exports.usePageLoad = (0, zustand_1.default)((set) => ({
|
|
9
9
|
loading: false,
|
|
10
|
-
setIsLoading:
|
|
11
|
-
})
|
|
10
|
+
setIsLoading: (loading) => set({ loading: loading }),
|
|
11
|
+
}));
|
package/hooks/useQueryDebug.d.ts
CHANGED
package/hooks/useQueryDebug.js
CHANGED
|
@@ -4,18 +4,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.useQueryDebugData = exports.setQueryDebug = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
const zustand_1 = __importDefault(require("zustand"));
|
|
8
|
+
const useQueryDebug = (0, zustand_1.default)((set) => ({
|
|
9
9
|
value: undefined,
|
|
10
|
-
set:
|
|
11
|
-
set({ value
|
|
10
|
+
set: (value) => {
|
|
11
|
+
set({ value });
|
|
12
12
|
},
|
|
13
|
-
})
|
|
13
|
+
}));
|
|
14
14
|
function setQueryDebug(value) {
|
|
15
|
-
useQueryDebug.setState({ value
|
|
15
|
+
useQueryDebug.setState({ value });
|
|
16
16
|
}
|
|
17
17
|
exports.setQueryDebug = setQueryDebug;
|
|
18
18
|
function useQueryDebugData() {
|
|
19
|
-
return useQueryDebug(
|
|
19
|
+
return useQueryDebug((store) => store.value);
|
|
20
20
|
}
|
|
21
21
|
exports.useQueryDebugData = useQueryDebugData;
|
package/hooks/useRPC.d.ts
CHANGED
|
@@ -4,9 +4,9 @@ export declare const useRPCQuery: RPCUseQuery;
|
|
|
4
4
|
export declare const useRPCMutation: RPCUseMutation;
|
|
5
5
|
export declare const useRPCInfiniteQuery: RPCUseInfiniteQuery;
|
|
6
6
|
export declare const rpcClient: RPCClient;
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export
|
|
7
|
+
export type UseRPCMutationResult = ReturnType<typeof trpc.useMutation>;
|
|
8
|
+
export type UseRPCQueryResult = ReturnType<typeof trpc.useQuery>;
|
|
9
|
+
export type UseRPCInfiniteQueryResult = ReturnType<typeof trpc.useInfiniteQuery>;
|
|
10
10
|
export declare const RPCClientError: typeof TRPCClientError;
|
|
11
|
-
export
|
|
11
|
+
export type RPCClientError = InstanceType<typeof TRPCClientError>;
|
|
12
12
|
export {};
|
package/hooks/useRPC.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RPCClientError = exports.rpcClient = exports.useRPCInfiniteQuery = exports.useRPCMutation = exports.useRPCQuery = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
const react_1 = require("@trpc/react");
|
|
5
|
+
const client_1 = require("@trpc/client");
|
|
6
|
+
const trpc = (0, react_1.createReactQueryHooks)();
|
|
7
7
|
// @ts-ignore
|
|
8
8
|
exports.useRPCQuery = trpc.useQuery;
|
|
9
9
|
// @ts-ignore
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eddev",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.67-beta1",
|
|
4
4
|
"main": "./index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"@types/inquirer": "^8.1.1",
|
|
21
21
|
"@types/loadable__component": "^5.13.4",
|
|
22
22
|
"@types/node": "^16.7.10",
|
|
23
|
-
"@types/react": "^18.
|
|
23
|
+
"@types/react": "^18.2.8",
|
|
24
24
|
"@types/react-dom": "^18.0.11",
|
|
25
25
|
"@types/react-inspector": "^4.0.2",
|
|
26
26
|
"@types/rimraf": "^3.0.2",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"@types/webpack-dev-server": "^3.11.2",
|
|
29
29
|
"csstype": "^3.0.9",
|
|
30
30
|
"next": "^12.1.6",
|
|
31
|
-
"react-html-props": "^
|
|
31
|
+
"react-html-props": "^2.0.2",
|
|
32
32
|
"react-use": "^17.4.0"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
"@loadable/webpack-plugin": "^5.15.2",
|
|
50
50
|
"@pmmmwh/react-refresh-webpack-plugin": "^0.4.3",
|
|
51
51
|
"@soda/friendly-errors-webpack-plugin": "^1.8.0",
|
|
52
|
-
"@stitches/core": "^1.
|
|
53
|
-
"@stitches/react": "^1.
|
|
52
|
+
"@stitches/core": "^1.3.1-1",
|
|
53
|
+
"@stitches/react": "^1.3.1-1",
|
|
54
54
|
"@trpc/client": "^9.19.0",
|
|
55
55
|
"@trpc/next": "^9.19.0",
|
|
56
56
|
"@trpc/react": "^9.19.0",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"glob-promise": "^4.2.0",
|
|
75
75
|
"graphql": "^15.5.3",
|
|
76
76
|
"immer": "^9.0.12",
|
|
77
|
-
"ink": "
|
|
77
|
+
"ink": "3.2.0",
|
|
78
78
|
"inquirer": "^8.1.2",
|
|
79
79
|
"mini-css-extract-plugin": "^2.2.2",
|
|
80
80
|
"next-transpile-modules": "^9.0.0",
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
"rimraf": "^3.0.2",
|
|
89
89
|
"swr": "^1.0.1",
|
|
90
90
|
"to-icon": "^1.1.4",
|
|
91
|
-
"typescript": "
|
|
91
|
+
"typescript": "^5.1.3",
|
|
92
92
|
"url-parse": "^1.5.3",
|
|
93
93
|
"webpack": "5.74.0",
|
|
94
94
|
"webpack-bundle-analyzer": "^4.5.0",
|
package/routing/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];
|
package/routing/remoteProps.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import URLParse from "url-parse";
|
|
2
|
-
export
|
|
2
|
+
export type ParsedRouteTags = Record<"title" | "meta" | "script" | "style" | "link", {
|
|
3
3
|
[key: string]: string;
|
|
4
4
|
}[]>;
|
|
5
5
|
export interface RouteData {
|