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.
Files changed (185) hide show
  1. package/admin/components/ImageWell.d.ts +2 -2
  2. package/admin/components/ImageWell.js +51 -39
  3. package/admin/defineField.d.ts +2 -2
  4. package/admin/defineWidget.d.ts +1 -1
  5. package/admin/defineWidget.js +2 -2
  6. package/admin/index.js +1 -5
  7. package/admin/installFieldTypes.js +26 -26
  8. package/admin/runWidgets.js +28 -17
  9. package/admin/selectMedia.d.ts +2 -2
  10. package/admin/selectMedia.js +1 -1
  11. package/blocks/ContentBlocks.d.ts +6 -6
  12. package/blocks/ContentBlocks.js +66 -58
  13. package/blocks/ErrorBoundaryEditor.d.ts +1 -1
  14. package/blocks/ErrorBoundaryEditor.js +45 -16
  15. package/blocks/ErrorBoundaryFrontend.d.ts +1 -1
  16. package/blocks/ErrorBoundaryFrontend.js +45 -16
  17. package/blocks/InspectorControls.d.ts +1 -1
  18. package/blocks/InspectorControls.js +3 -3
  19. package/blocks/blockAttributes.d.ts +2 -2
  20. package/blocks/blockAttributes.js +44 -24
  21. package/blocks/index.js +1 -5
  22. package/blocks/inlineEditing.d.ts +6 -6
  23. package/blocks/inlineEditing.js +55 -36
  24. package/blocks/installGutenbergHooks.js +68 -48
  25. package/build/babel/plugin-name-defined-components.js +16 -15
  26. package/build/build-favicon.js +62 -11
  27. package/build/clean.js +52 -5
  28. package/build/create-codegen-worker.js +33 -78
  29. package/build/create-serverless-dev-worker.js +39 -61
  30. package/build/create-webpack-worker.js +33 -65
  31. package/build/file-tree.d.ts +2 -2
  32. package/build/file-tree.js +12 -12
  33. package/build/get-webpack-config.js +395 -341
  34. package/build/graphql-codegen/graphql-codegen-files.js +25 -31
  35. package/build/graphql-codegen/graphql-codegen-no-duplicates.js +4 -4
  36. package/build/graphql-codegen/graphql-codegen-queries.js +99 -102
  37. package/build/manifests/manifest-blocks.d.ts +1 -1
  38. package/build/manifests/manifest-blocks.js +29 -37
  39. package/build/manifests/manifest-fields.d.ts +1 -1
  40. package/build/manifests/manifest-fields.js +21 -23
  41. package/build/manifests/manifest-views.d.ts +1 -1
  42. package/build/manifests/manifest-views.js +25 -32
  43. package/build/manifests/manifest-widgets.d.ts +1 -1
  44. package/build/manifests/manifest-widgets.js +20 -22
  45. package/build/manifests/manifest.d.ts +2 -2
  46. package/build/manifests/manifest.js +94 -30
  47. package/build/reporter.d.ts +1 -1
  48. package/build/reporter.js +32 -29
  49. package/build/serverless/create-next-app.d.ts +1 -1
  50. package/build/serverless/create-next-app.js +467 -245
  51. package/build/state/codegen-state.d.ts +4 -4
  52. package/build/state/compiler-state.d.ts +5 -5
  53. package/build/state/serverless-state.d.ts +3 -3
  54. package/build/workers/codegen-worker-script.js +519 -393
  55. package/build/workers/serverless-worker-dev-script.js +4 -4
  56. package/build/workers/webpack-worker-script.js +156 -90
  57. package/cli/build.dev.d.ts +1 -1
  58. package/cli/build.dev.js +126 -79
  59. package/cli/build.prod.d.ts +1 -1
  60. package/cli/build.prod.js +98 -42
  61. package/cli/cli.js +28 -19
  62. package/cli/display/components/BundleDisplay.d.ts +1 -1
  63. package/cli/display/components/BundleDisplay.js +24 -13
  64. package/cli/display/components/CodegenDisplay.d.ts +1 -1
  65. package/cli/display/components/CodegenDisplay.js +25 -14
  66. package/cli/display/components/DevCLIDisplay.d.ts +2 -2
  67. package/cli/display/components/DevCLIDisplay.js +25 -14
  68. package/cli/display/components/Fullscreen.js +20 -9
  69. package/cli/display/components/ServerlessDisplay.d.ts +2 -2
  70. package/cli/display/components/ServerlessDisplay.js +26 -15
  71. package/cli/display/components/StatusIcon.d.ts +2 -2
  72. package/cli/display/components/StatusIcon.js +3 -3
  73. package/cli/preinstall.js +5 -4
  74. package/cli/setup.js +73 -25
  75. package/components/AdminBar.d.ts +1 -1
  76. package/components/AdminBar.js +3 -37
  77. package/components/BrowserRouter.d.ts +2 -2
  78. package/components/BrowserRouter.js +54 -41
  79. package/components/InlinePage.d.ts +2 -2
  80. package/components/InlinePage.js +29 -17
  81. package/components/NextRouter.d.ts +2 -2
  82. package/components/NextRouter.js +29 -20
  83. package/components/index.js +1 -5
  84. package/config/config-schema.d.ts +1 -1
  85. package/config/config-schema.js +1 -1
  86. package/config/create-schema-file.js +6 -6
  87. package/config/get-config.js +13 -10
  88. package/config/index.js +1 -5
  89. package/config/parse-config.js +1 -1
  90. package/config/print-zod-errors.js +3 -3
  91. package/dev-ui/components/BreakpointColumnHeader.d.ts +2 -2
  92. package/dev-ui/components/BreakpointColumnHeader.js +18 -7
  93. package/dev-ui/components/BreakpointIndicator.d.ts +1 -1
  94. package/dev-ui/components/BreakpointIndicator.js +32 -25
  95. package/dev-ui/components/DevUI.d.ts +1 -1
  96. package/dev-ui/components/DevUI.js +13 -13
  97. package/dev-ui/components/Launcher.d.ts +2 -2
  98. package/dev-ui/components/Launcher.js +25 -13
  99. package/dev-ui/components/PanelWrapper.d.ts +2 -2
  100. package/dev-ui/components/PanelWrapper.js +8 -8
  101. package/dev-ui/components/ResponsiveLerpControl.d.ts +2 -2
  102. package/dev-ui/components/ResponsiveLerpControl.js +38 -27
  103. package/dev-ui/components/ResponsiveScaleEditor.d.ts +4 -4
  104. package/dev-ui/components/ResponsiveScaleEditor.js +78 -64
  105. package/dev-ui/components/atoms/Button.js +1 -1
  106. package/dev-ui/components/atoms/Dropdown.d.ts +3 -3
  107. package/dev-ui/components/atoms/Dropdown.js +9 -8
  108. package/dev-ui/components/atoms/NumberField.d.ts +2 -2
  109. package/dev-ui/components/atoms/NumberField.js +42 -29
  110. package/dev-ui/components/atoms/Spacer.js +1 -1
  111. package/dev-ui/components/atoms/Text.js +1 -1
  112. package/dev-ui/components/atoms/ToggleButton.d.ts +2 -2
  113. package/dev-ui/components/atoms/ToggleButton.js +16 -5
  114. package/dev-ui/components/atoms/Tooltip.d.ts +2 -2
  115. package/dev-ui/components/atoms/Tooltip.js +20 -8
  116. package/dev-ui/components/panels/AppDataDebugger.d.ts +1 -1
  117. package/dev-ui/components/panels/AppDataDebugger.js +19 -8
  118. package/dev-ui/components/panels/ColorEditor.d.ts +1 -1
  119. package/dev-ui/components/panels/ColorEditor.js +42 -35
  120. package/dev-ui/components/panels/PageDataDebugger.d.ts +1 -1
  121. package/dev-ui/components/panels/PageDataDebugger.js +20 -8
  122. package/dev-ui/components/panels/QueryDebugger.d.ts +1 -1
  123. package/dev-ui/components/panels/QueryDebugger.js +24 -12
  124. package/dev-ui/components/panels/SpacingEditor.d.ts +1 -1
  125. package/dev-ui/components/panels/SpacingEditor.js +48 -34
  126. package/dev-ui/components/panels/TypographyEditor.d.ts +1 -1
  127. package/dev-ui/components/panels/TypographyEditor.js +46 -38
  128. package/dev-ui/hooks/useBreakpoint.d.ts +1 -1
  129. package/dev-ui/hooks/useBreakpoint.js +13 -13
  130. package/dev-ui/hooks/usePersistState.js +7 -6
  131. package/dev-ui/hooks/useStylesheet.js +6 -6
  132. package/dev-ui/icons.d.ts +15 -15
  133. package/dev-ui/icons.js +27 -16
  134. package/dev-ui/index.js +1 -5
  135. package/dev-ui/loader.d.ts +1 -1
  136. package/dev-ui/loader.js +9 -13
  137. package/dev-ui/panels.d.ts +2 -2
  138. package/dev-ui/panels.js +7 -7
  139. package/dev-ui/theme.js +3 -3
  140. package/dynamic/dynamic-component.js +1 -1
  141. package/dynamic/index.js +1 -5
  142. package/entry/Root.d.ts +2 -2
  143. package/entry/Root.js +26 -16
  144. package/entry/entry.admin.dev.js +4 -4
  145. package/entry/entry.admin.prod.js +4 -4
  146. package/entry/entry.monolith.dev.js +5 -5
  147. package/entry/entry.monolith.prod.js +5 -5
  148. package/gravityforms/gravity-forms.d.ts +2 -2
  149. package/gravityforms/index.js +1 -5
  150. package/gravityforms/useGravityForm.d.ts +2 -2
  151. package/gravityforms/useGravityForm.js +130 -126
  152. package/hooks/index.js +1 -5
  153. package/hooks/queryUtils.d.ts +14 -14
  154. package/hooks/queryUtils.js +192 -101
  155. package/hooks/useAppData.d.ts +2 -2
  156. package/hooks/useAppData.js +9 -9
  157. package/hooks/usePageLoad.js +4 -4
  158. package/hooks/useQueryDebug.d.ts +1 -1
  159. package/hooks/useQueryDebug.js +7 -7
  160. package/hooks/useRPC.d.ts +4 -4
  161. package/hooks/useRPC.js +3 -3
  162. package/package.json +11 -11
  163. package/routing/index.js +1 -5
  164. package/routing/remoteProps.d.ts +1 -1
  165. package/routing/remoteProps.js +72 -31
  166. package/routing/routing.d.ts +25 -15
  167. package/routing/routing.js +200 -112
  168. package/routing/updateEditLink.js +1 -1
  169. package/serverless/define-api.d.ts +1 -1
  170. package/serverless/define-rpc-router.js +4 -8
  171. package/serverless/index.js +2 -6
  172. package/style/createStitches.js +142 -164
  173. package/style/index.js +1 -5
  174. package/tsconfig.json +1 -1
  175. package/utils/Observable.d.ts +2 -2
  176. package/utils/Observable.js +15 -12
  177. package/utils/getRepoName.js +3 -3
  178. package/utils/promptIfRepoNameIncorrect.js +64 -18
  179. package/utils/refreshOverlayInterop.js +1 -1
  180. package/utils/reportErrorStack.d.ts +1 -1
  181. package/utils/reportErrorStack.js +1 -1
  182. package/utils/serverlessAppContext.js +1 -1
  183. package/utils/updateEnvFile.js +69 -19
  184. package/utils/useObservable.js +3 -3
  185. package/views/index.js +1 -5
@@ -1,67 +1,132 @@
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
+ };
2
58
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
59
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
60
  };
5
61
  Object.defineProperty(exports, "__esModule", { value: true });
6
62
  exports.createUseMutation = exports.createUseInfiniteQuery = exports.createUseQuery = void 0;
7
- const react_1 = require("react");
8
- const swr_1 = __importDefault(require("swr"));
63
+ var react_1 = require("react");
64
+ var swr_1 = __importDefault(require("swr"));
9
65
  /** Generic fetcher functions */
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
- };
66
+ var fetcherGET = function (name, params) { return __awaiter(void 0, void 0, void 0, function () {
67
+ var url, result, payload;
68
+ return __generator(this, function (_a) {
69
+ switch (_a.label) {
70
+ case 0:
71
+ url = process.serverless ? "/api/rest/query/".concat(name) : "/wp-json/ed/v1/query/".concat(name);
72
+ if (params)
73
+ url += "?params=" + encodeURIComponent(params);
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
+ }); };
18
84
  function createUseQuery(init) {
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
- });
85
+ var hook = function (vars, opts) {
86
+ var _a, _b;
87
+ var _c = (0, swr_1.default)([init.name, JSON.stringify(vars)], fetcherGET, {
88
+ revalidateIfStale: (_a = opts === null || opts === void 0 ? void 0 : opts.revalidateIfStale) !== null && _a !== void 0 ? _a : false,
89
+ revalidateOnFocus: (_b = opts === null || opts === void 0 ? void 0 : opts.revalidateOnFocus) !== null && _b !== void 0 ? _b : false,
90
+ }), payload = _c.data, isValidating = _c.isValidating, error = _c.error, mutate = _c.mutate;
24
91
  return {
25
92
  loading: isValidating && !payload,
26
- data: payload?.data,
27
- errors: error ? [error] : payload?.errors,
93
+ data: payload === null || payload === void 0 ? void 0 : payload.data,
94
+ errors: error ? [error] : payload === null || payload === void 0 ? void 0 : payload.errors,
28
95
  refresh: mutate,
29
96
  };
30
97
  };
31
- hook.fetch = (vars) => {
32
- return fetcherGET(init.name, JSON.stringify(vars)).then((payload) => payload.data);
98
+ hook.fetch = function (vars) {
99
+ return fetcherGET(init.name, JSON.stringify(vars)).then(function (payload) { return payload.data; });
33
100
  };
34
101
  return hook;
35
102
  }
36
103
  exports.createUseQuery = createUseQuery;
37
104
  function createUseInfiniteQuery(init) {
38
- const extract = (path, payload) => {
39
- let value = payload;
40
- for (const segment of path) {
105
+ var extract = function (path, payload) {
106
+ var value = payload;
107
+ for (var _i = 0, path_1 = path; _i < path_1.length; _i++) {
108
+ var segment = path_1[_i];
41
109
  value = value[segment];
42
110
  }
43
111
  return value;
44
112
  };
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)([
113
+ var hook = function (vars, opts) {
114
+ var _a = (0, react_1.useState)(), activeCursor = _a[0], setActiveCursor = _a[1];
115
+ var _b = (0, react_1.useState)(), errors = _b[0], setErrors = _b[1];
116
+ var _c = (0, react_1.useState)(undefined), nextCursor = _c[0], setNextCursor = _c[1];
117
+ var _d = (0, react_1.useState)(false), hasMore = _d[0], setHasMore = _d[1];
118
+ var _e = (0, react_1.useState)(true), isLoadingMore = _e[0], setIsLoadingMore = _e[1];
119
+ var _f = (0, react_1.useState)([]), items = _f[0], setItems = _f[1];
120
+ var _g = (0, react_1.useState)(vars), varPayload = _g[0], setVarPayload = _g[1];
121
+ var _h = (0, swr_1.default)([
54
122
  init.name,
55
- JSON.stringify({
56
- ...(varPayload || {}),
57
- cursor: activeCursor,
58
- }),
123
+ JSON.stringify(__assign(__assign({}, (varPayload || {})), { cursor: activeCursor })),
59
124
  ], fetcherGET, {
60
125
  revalidateIfStale: false,
61
126
  revalidateOnFocus: false,
62
127
  revalidateOnReconnect: false,
63
- });
64
- (0, react_1.useEffect)(() => {
128
+ }), payload = _h.data, isValidating = _h.isValidating, error = _h.error, mutate = _h.mutate;
129
+ (0, react_1.useEffect)(function () {
65
130
  setItems([]);
66
131
  setIsLoadingMore(true);
67
132
  setErrors(undefined);
@@ -69,7 +134,7 @@ function createUseInfiniteQuery(init) {
69
134
  setActiveCursor(undefined);
70
135
  setVarPayload(vars);
71
136
  }, [JSON.stringify(vars)]);
72
- (0, react_1.useEffect)(() => {
137
+ (0, react_1.useEffect)(function () {
73
138
  if (payload) {
74
139
  setIsLoadingMore(false);
75
140
  if (payload.errors) {
@@ -77,14 +142,14 @@ function createUseInfiniteQuery(init) {
77
142
  }
78
143
  else if (payload.data) {
79
144
  // Extract data
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);
145
+ var nodes_1 = extract(init.paths.nodesPath, payload.data);
146
+ var nextCursor_1 = extract(init.paths.endCursorPath, payload.data);
147
+ var hasMore_1 = extract(init.paths.hasNextPagePath, payload.data);
83
148
  setErrors(undefined);
84
- setNextCursor(nextCursor);
85
- setHasMore(hasMore);
149
+ setNextCursor(nextCursor_1);
150
+ setHasMore(hasMore_1);
86
151
  setIsLoadingMore(false);
87
- setItems(() => [...items, ...nodes]);
152
+ setItems(function () { return __spreadArray(__spreadArray([], items, true), nodes_1, true); });
88
153
  }
89
154
  }
90
155
  }, [payload]);
@@ -94,14 +159,14 @@ function createUseInfiniteQuery(init) {
94
159
  items: items,
95
160
  cursor: activeCursor,
96
161
  errors: error ? [error] : errors,
97
- refresh: () => {
162
+ refresh: function () {
98
163
  setErrors(undefined);
99
164
  setNextCursor(undefined);
100
165
  setActiveCursor(undefined);
101
166
  setIsLoadingMore(false);
102
167
  mutate();
103
168
  },
104
- loadMore() {
169
+ loadMore: function () {
105
170
  if (isLoadingMore || !hasMore)
106
171
  return;
107
172
  setIsLoadingMore(true);
@@ -114,66 +179,92 @@ function createUseInfiniteQuery(init) {
114
179
  }
115
180
  exports.createUseInfiniteQuery = createUseInfiniteQuery;
116
181
  function createUseMutation(init) {
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);
182
+ var _this = this;
183
+ var hook = function (opts) {
184
+ var _a = (0, react_1.useState)(false), submitting = _a[0], setSubmitting = _a[1];
185
+ var _b = (0, react_1.useState)(false), submitted = _b[0], setSubmitted = _b[1];
186
+ var _c = (0, react_1.useState)(undefined), data = _c[0], setData = _c[1];
187
+ var _d = (0, react_1.useState)(), errors = _d[0], setErrors = _d[1];
188
+ var submit = function (params) { return __awaiter(_this, void 0, void 0, function () {
189
+ var url, result, payload, error_1;
190
+ return __generator(this, function (_a) {
191
+ switch (_a.label) {
192
+ case 0:
193
+ setSubmitting(true);
194
+ setSubmitted(false);
195
+ url = process.serverless ? "/api/rest/mutation/".concat(init.name) : "/wp-json/ed/v1/mutation/".concat(init.name);
196
+ _a.label = 1;
197
+ case 1:
198
+ _a.trys.push([1, 4, , 5]);
199
+ return [4 /*yield*/, fetch(url, {
200
+ method: "POST",
201
+ headers: {
202
+ "Content-type": "application/json",
203
+ },
204
+ credentials: "include",
205
+ body: JSON.stringify(params),
206
+ })];
207
+ case 2:
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*/];
143
228
  }
144
- }
145
- catch (error) {
146
- setErrors([error]);
147
- return;
148
- }
149
- setSubmitting(false);
150
- };
229
+ });
230
+ }); };
151
231
  return {
152
- submitting,
153
- submitted,
154
- data,
155
- errors,
156
- submit,
232
+ submitting: submitting,
233
+ submitted: submitted,
234
+ data: data,
235
+ errors: errors,
236
+ submit: submit,
157
237
  };
158
238
  };
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),
239
+ hook.mutate = function (vars) { return __awaiter(_this, void 0, void 0, function () {
240
+ var url, result, payload;
241
+ return __generator(this, function (_a) {
242
+ switch (_a.label) {
243
+ case 0:
244
+ url = process.serverless ? "/api/rest/mutation/".concat(init.name) : "/wp-json/ed/v1/mutation/".concat(init.name);
245
+ return [4 /*yield*/, fetch(url, {
246
+ method: "POST",
247
+ headers: {
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
+ }
168
266
  });
169
- const payload = await result.json();
170
- if (payload.errors) {
171
- throw payload.errors;
172
- }
173
- else {
174
- return payload.data;
175
- }
176
- };
267
+ }); };
177
268
  return hook;
178
269
  }
179
270
  exports.createUseMutation = createUseMutation;
@@ -1,10 +1,10 @@
1
- type AppData = ViewProps["_app"];
1
+ declare 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
- type Selector<T> = (data: AppData) => T;
7
+ declare 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 };
@@ -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
- 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) => ({
7
+ var react_1 = require("react");
8
+ var zustand_1 = __importDefault(require("zustand"));
9
+ var serverlessAppContext_1 = require("../utils/serverlessAppContext");
10
+ var useAppDataStore = (0, zustand_1.default)(function (set) { return ({
11
11
  data: undefined,
12
- setAppData(data) {
13
- set({ data });
12
+ setAppData: function (data) {
13
+ set({ data: 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
- const value = (0, react_1.useContext)(serverlessAppContext_1.ServerlessAppDataContext);
20
+ var 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((store) => {
30
+ return useAppDataStore(function (store) {
31
31
  if (selector)
32
32
  return selector(store.data);
33
33
  return store.data;
@@ -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
- const zustand_1 = __importDefault(require("zustand"));
8
- exports.usePageLoad = (0, zustand_1.default)((set) => ({
7
+ var zustand_1 = __importDefault(require("zustand"));
8
+ exports.usePageLoad = (0, zustand_1.default)(function (set) { return ({
9
9
  loading: false,
10
- setIsLoading: (loading) => set({ loading: loading }),
11
- }));
10
+ setIsLoading: function (loading) { return set({ loading: loading }); },
11
+ }); });
@@ -1,4 +1,4 @@
1
- export type QueryDebugItem = {
1
+ export declare type QueryDebugItem = {
2
2
  file: string;
3
3
  errors: string[];
4
4
  duration: number;
@@ -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
- const zustand_1 = __importDefault(require("zustand"));
8
- const useQueryDebug = (0, zustand_1.default)((set) => ({
7
+ var zustand_1 = __importDefault(require("zustand"));
8
+ var useQueryDebug = (0, zustand_1.default)(function (set) { return ({
9
9
  value: undefined,
10
- set: (value) => {
11
- set({ value });
10
+ set: function (value) {
11
+ set({ value: value });
12
12
  },
13
- }));
13
+ }); });
14
14
  function setQueryDebug(value) {
15
- useQueryDebug.setState({ value });
15
+ useQueryDebug.setState({ value: value });
16
16
  }
17
17
  exports.setQueryDebug = setQueryDebug;
18
18
  function useQueryDebugData() {
19
- return useQueryDebug((store) => store.value);
19
+ return useQueryDebug(function (store) { return 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 type UseRPCMutationResult = ReturnType<typeof trpc.useMutation>;
8
- export type UseRPCQueryResult = ReturnType<typeof trpc.useQuery>;
9
- export type UseRPCInfiniteQueryResult = ReturnType<typeof trpc.useInfiniteQuery>;
7
+ export declare type UseRPCMutationResult = ReturnType<typeof trpc.useMutation>;
8
+ export declare type UseRPCQueryResult = ReturnType<typeof trpc.useQuery>;
9
+ export declare type UseRPCInfiniteQueryResult = ReturnType<typeof trpc.useInfiniteQuery>;
10
10
  export declare const RPCClientError: typeof TRPCClientError;
11
- export type RPCClientError = InstanceType<typeof TRPCClientError>;
11
+ export declare 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
- const react_1 = require("@trpc/react");
5
- const client_1 = require("@trpc/client");
6
- const trpc = (0, react_1.createReactQueryHooks)();
4
+ var react_1 = require("@trpc/react");
5
+ var client_1 = require("@trpc/client");
6
+ var 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.67-beta1",
3
+ "version": "0.3.0-beta1",
4
4
  "main": "./index.js",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -20,16 +20,17 @@
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.2.8",
24
- "@types/react-dom": "^18.0.11",
23
+ "@types/react": "18.0.34",
24
+ "@types/react-dom": "18.0.11",
25
25
  "@types/react-inspector": "^4.0.2",
26
26
  "@types/rimraf": "^3.0.2",
27
27
  "@types/url-parse": "^1.4.4",
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": "^2.0.2",
32
- "react-use": "^17.4.0"
31
+ "react-html-props": "^1.0.32",
32
+ "react-use": "^17.4.0",
33
+ "typescript": "4.5.5"
33
34
  },
34
35
  "dependencies": {
35
36
  "@babel/core": "^7.15.5",
@@ -42,15 +43,15 @@
42
43
  "@graphql-codegen/core": "^2.1.0",
43
44
  "@graphql-codegen/typescript": "^2.2.1",
44
45
  "@graphql-codegen/typescript-operations": "^2.1.3",
45
- "@graphql-tools/load": "^7.4.1",
46
+ "@graphql-tools/load": "^8.0.0",
46
47
  "@graphql-tools/url-loader": "^7.1.0",
47
48
  "@loadable/babel-plugin": "^5.13.2",
48
49
  "@loadable/component": "^5.15.2",
49
50
  "@loadable/webpack-plugin": "^5.15.2",
50
51
  "@pmmmwh/react-refresh-webpack-plugin": "^0.4.3",
51
52
  "@soda/friendly-errors-webpack-plugin": "^1.8.0",
52
- "@stitches/core": "^1.3.1-1",
53
- "@stitches/react": "^1.3.1-1",
53
+ "@stitches/core": "^1.2.8",
54
+ "@stitches/react": "^1.2.8",
54
55
  "@trpc/client": "^9.19.0",
55
56
  "@trpc/next": "^9.19.0",
56
57
  "@trpc/react": "^9.19.0",
@@ -74,7 +75,7 @@
74
75
  "glob-promise": "^4.2.0",
75
76
  "graphql": "^15.5.3",
76
77
  "immer": "^9.0.12",
77
- "ink": "3.2.0",
78
+ "ink": "^3.2.0",
78
79
  "inquirer": "^8.1.2",
79
80
  "mini-css-extract-plugin": "^2.2.2",
80
81
  "next-transpile-modules": "^9.0.0",
@@ -88,13 +89,12 @@
88
89
  "rimraf": "^3.0.2",
89
90
  "swr": "^1.0.1",
90
91
  "to-icon": "^1.1.4",
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",
95
95
  "webpack-dev-server": "3.11.3",
96
96
  "webpack-hot-middleware": "^2.25.0",
97
- "webpack-virtual-modules": "^0.4.3",
97
+ "webpack-virtual-modules": "0.5.0",
98
98
  "zod": "^3.11.6",
99
99
  "zod-to-json-schema": "^3.11.3",
100
100
  "zustand": "^3.5.10"
package/routing/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
- 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);
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,5 +1,5 @@
1
1
  import URLParse from "url-parse";
2
- export type ParsedRouteTags = Record<"title" | "meta" | "script" | "style" | "link", {
2
+ export declare type ParsedRouteTags = Record<"title" | "meta" | "script" | "style" | "link", {
3
3
  [key: string]: string;
4
4
  }[]>;
5
5
  export interface RouteData {