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.
Files changed (190) hide show
  1. package/admin/components/ImageWell.d.ts +2 -3
  2. package/admin/components/ImageWell.js +39 -51
  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 +5 -1
  7. package/admin/installFieldTypes.js +26 -26
  8. package/admin/runWidgets.js +17 -28
  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 +58 -66
  13. package/blocks/ErrorBoundaryEditor.d.ts +1 -1
  14. package/blocks/ErrorBoundaryEditor.js +16 -45
  15. package/blocks/ErrorBoundaryFrontend.d.ts +1 -1
  16. package/blocks/ErrorBoundaryFrontend.js +16 -45
  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 +24 -44
  21. package/blocks/index.js +5 -1
  22. package/blocks/inlineEditing.d.ts +7 -7
  23. package/blocks/inlineEditing.js +36 -55
  24. package/blocks/installGutenbergHooks.js +48 -68
  25. package/build/babel/plugin-name-defined-components.js +15 -16
  26. package/build/build-favicon.js +11 -62
  27. package/build/clean.js +5 -52
  28. package/build/create-codegen-worker.js +78 -33
  29. package/build/create-serverless-dev-worker.js +61 -39
  30. package/build/create-webpack-worker.js +65 -33
  31. package/build/file-tree.d.ts +2 -2
  32. package/build/file-tree.js +12 -12
  33. package/build/get-webpack-config.js +341 -395
  34. package/build/graphql-codegen/graphql-codegen-files.js +31 -25
  35. package/build/graphql-codegen/graphql-codegen-no-duplicates.js +4 -4
  36. package/build/graphql-codegen/graphql-codegen-queries.js +102 -99
  37. package/build/manifests/manifest-blocks.d.ts +1 -1
  38. package/build/manifests/manifest-blocks.js +37 -29
  39. package/build/manifests/manifest-fields.d.ts +1 -1
  40. package/build/manifests/manifest-fields.js +23 -21
  41. package/build/manifests/manifest-views.d.ts +1 -1
  42. package/build/manifests/manifest-views.js +32 -25
  43. package/build/manifests/manifest-widgets.d.ts +1 -1
  44. package/build/manifests/manifest-widgets.js +22 -20
  45. package/build/manifests/manifest.d.ts +2 -2
  46. package/build/manifests/manifest.js +30 -90
  47. package/build/reporter.d.ts +1 -1
  48. package/build/reporter.js +29 -32
  49. package/build/serverless/create-next-app.d.ts +1 -1
  50. package/build/serverless/create-next-app.js +245 -467
  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 +392 -507
  55. package/build/workers/serverless-worker-dev-script.js +4 -4
  56. package/build/workers/webpack-worker-script.js +89 -150
  57. package/cli/build.dev.d.ts +1 -1
  58. package/cli/build.dev.js +79 -126
  59. package/cli/build.prod.d.ts +1 -1
  60. package/cli/build.prod.js +42 -98
  61. package/cli/cli.js +16 -55
  62. package/cli/display/components/BundleDisplay.d.ts +1 -2
  63. package/cli/display/components/BundleDisplay.js +13 -24
  64. package/cli/display/components/CodegenDisplay.d.ts +1 -2
  65. package/cli/display/components/CodegenDisplay.js +14 -25
  66. package/cli/display/components/DevCLIDisplay.d.ts +2 -3
  67. package/cli/display/components/DevCLIDisplay.js +14 -25
  68. package/cli/display/components/Fullscreen.js +9 -20
  69. package/cli/display/components/ServerlessDisplay.d.ts +2 -3
  70. package/cli/display/components/ServerlessDisplay.js +15 -26
  71. package/cli/display/components/StatusIcon.d.ts +2 -3
  72. package/cli/display/components/StatusIcon.js +3 -3
  73. package/cli/preinstall.js +4 -5
  74. package/cli/setup.js +25 -73
  75. package/components/AdminBar.d.ts +1 -2
  76. package/components/AdminBar.js +37 -3
  77. package/components/BrowserRouter.d.ts +2 -2
  78. package/components/BrowserRouter.js +41 -54
  79. package/components/InlinePage.d.ts +2 -2
  80. package/components/InlinePage.js +17 -29
  81. package/components/NextRouter.d.ts +2 -2
  82. package/components/NextRouter.js +20 -29
  83. package/components/index.js +5 -1
  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 +10 -13
  88. package/config/index.js +5 -1
  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 -3
  92. package/dev-ui/components/BreakpointColumnHeader.js +7 -18
  93. package/dev-ui/components/BreakpointIndicator.d.ts +1 -2
  94. package/dev-ui/components/BreakpointIndicator.js +25 -32
  95. package/dev-ui/components/DevUI.d.ts +1 -2
  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 +13 -25
  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 -3
  102. package/dev-ui/components/ResponsiveLerpControl.js +27 -38
  103. package/dev-ui/components/ResponsiveScaleEditor.d.ts +4 -5
  104. package/dev-ui/components/ResponsiveScaleEditor.js +64 -78
  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 +8 -9
  108. package/dev-ui/components/atoms/NumberField.d.ts +2 -3
  109. package/dev-ui/components/atoms/NumberField.js +29 -42
  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 +5 -16
  114. package/dev-ui/components/atoms/Tooltip.d.ts +2 -2
  115. package/dev-ui/components/atoms/Tooltip.js +8 -20
  116. package/dev-ui/components/panels/AppDataDebugger.d.ts +1 -2
  117. package/dev-ui/components/panels/AppDataDebugger.js +8 -19
  118. package/dev-ui/components/panels/ColorEditor.d.ts +1 -2
  119. package/dev-ui/components/panels/ColorEditor.js +35 -42
  120. package/dev-ui/components/panels/PageDataDebugger.d.ts +1 -2
  121. package/dev-ui/components/panels/PageDataDebugger.js +8 -20
  122. package/dev-ui/components/panels/QueryDebugger.d.ts +1 -2
  123. package/dev-ui/components/panels/QueryDebugger.js +12 -24
  124. package/dev-ui/components/panels/SpacingEditor.d.ts +1 -2
  125. package/dev-ui/components/panels/SpacingEditor.js +34 -48
  126. package/dev-ui/components/panels/TypographyEditor.d.ts +1 -2
  127. package/dev-ui/components/panels/TypographyEditor.js +38 -46
  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 +6 -7
  131. package/dev-ui/hooks/useStylesheet.js +6 -6
  132. package/dev-ui/icons.d.ts +15 -16
  133. package/dev-ui/icons.js +16 -27
  134. package/dev-ui/index.js +5 -1
  135. package/dev-ui/loader.d.ts +1 -2
  136. package/dev-ui/loader.js +13 -9
  137. package/dev-ui/panels.d.ts +2 -2
  138. package/dev-ui/panels.js +7 -7
  139. package/dev-ui/theme.d.ts +96 -70
  140. package/dev-ui/theme.js +3 -3
  141. package/dynamic/dynamic-component.d.ts +1 -10
  142. package/dynamic/dynamic-component.js +1 -1
  143. package/dynamic/index.js +5 -1
  144. package/entry/Root.d.ts +2 -3
  145. package/entry/Root.js +16 -26
  146. package/entry/entry.admin.dev.js +4 -4
  147. package/entry/entry.admin.prod.js +4 -4
  148. package/entry/entry.monolith.dev.js +5 -5
  149. package/entry/entry.monolith.prod.js +5 -5
  150. package/gravityforms/gravity-forms.d.ts +2 -2
  151. package/gravityforms/index.js +5 -1
  152. package/gravityforms/useGravityForm.d.ts +2 -2
  153. package/gravityforms/useGravityForm.js +126 -130
  154. package/hooks/index.js +5 -1
  155. package/hooks/queryUtils.d.ts +14 -14
  156. package/hooks/queryUtils.js +101 -192
  157. package/hooks/useAppData.d.ts +2 -2
  158. package/hooks/useAppData.js +9 -9
  159. package/hooks/usePageLoad.js +4 -4
  160. package/hooks/useQueryDebug.d.ts +1 -1
  161. package/hooks/useQueryDebug.js +7 -7
  162. package/hooks/useRPC.d.ts +4 -4
  163. package/hooks/useRPC.js +3 -3
  164. package/package.json +7 -7
  165. package/routing/index.js +5 -1
  166. package/routing/remoteProps.d.ts +1 -1
  167. package/routing/remoteProps.js +31 -72
  168. package/routing/routing.d.ts +15 -15
  169. package/routing/routing.js +108 -170
  170. package/routing/updateEditLink.js +1 -1
  171. package/serverless/define-api.d.ts +1 -1
  172. package/serverless/define-rpc-router.js +8 -4
  173. package/serverless/index.js +6 -2
  174. package/serverless-template/_utils/fetch-wordpress-props.ts +0 -4
  175. package/serverless-template/_utils/fetch-wp.ts +0 -1
  176. package/style/createStitches.d.ts +375 -783
  177. package/style/createStitches.js +164 -142
  178. package/style/index.js +5 -1
  179. package/tsconfig.json +1 -1
  180. package/utils/Observable.d.ts +2 -2
  181. package/utils/Observable.js +12 -15
  182. package/utils/getRepoName.js +3 -3
  183. package/utils/promptIfRepoNameIncorrect.js +18 -64
  184. package/utils/refreshOverlayInterop.js +1 -1
  185. package/utils/reportErrorStack.d.ts +1 -1
  186. package/utils/reportErrorStack.js +1 -1
  187. package/utils/serverlessAppContext.js +1 -1
  188. package/utils/updateEnvFile.js +19 -69
  189. package/utils/useObservable.js +3 -3
  190. package/views/index.js +5 -1
@@ -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
- var react_1 = require("react");
64
- var swr_1 = __importDefault(require("swr"));
7
+ const react_1 = require("react");
8
+ const swr_1 = __importDefault(require("swr"));
65
9
  /** Generic fetcher functions */
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
- }); };
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
- 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;
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 === null || payload === void 0 ? void 0 : payload.data,
94
- errors: error ? [error] : payload === null || payload === void 0 ? void 0 : payload.errors,
26
+ data: payload?.data,
27
+ errors: error ? [error] : payload?.errors,
95
28
  refresh: mutate,
96
29
  };
97
30
  };
98
- hook.fetch = function (vars) {
99
- return fetcherGET(init.name, JSON.stringify(vars)).then(function (payload) { return payload.data; });
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
- 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];
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
- 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)([
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(__assign(__assign({}, (varPayload || {})), { cursor: activeCursor })),
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
- }), payload = _h.data, isValidating = _h.isValidating, error = _h.error, mutate = _h.mutate;
129
- (0, react_1.useEffect)(function () {
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)(function () {
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
- 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);
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(nextCursor_1);
150
- setHasMore(hasMore_1);
84
+ setNextCursor(nextCursor);
85
+ setHasMore(hasMore);
151
86
  setIsLoadingMore(false);
152
- setItems(function () { return __spreadArray(__spreadArray([], items, true), nodes_1, true); });
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: function () {
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: function () {
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
- 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*/];
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: submitting,
233
- submitted: submitted,
234
- data: data,
235
- errors: errors,
236
- submit: submit,
152
+ submitting,
153
+ submitted,
154
+ data,
155
+ errors,
156
+ submit,
237
157
  };
238
158
  };
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
- }
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;
@@ -1,10 +1,10 @@
1
- declare type AppData = ViewProps["_app"];
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
- declare type Selector<T> = (data: AppData) => T;
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 };
@@ -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
- 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 ({
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: function (data) {
13
- set({ data: 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
- var value = (0, react_1.useContext)(serverlessAppContext_1.ServerlessAppDataContext);
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(function (store) {
30
+ return useAppDataStore((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
- var zustand_1 = __importDefault(require("zustand"));
8
- exports.usePageLoad = (0, zustand_1.default)(function (set) { return ({
7
+ const zustand_1 = __importDefault(require("zustand"));
8
+ exports.usePageLoad = (0, zustand_1.default)((set) => ({
9
9
  loading: false,
10
- setIsLoading: function (loading) { return set({ loading: loading }); },
11
- }); });
10
+ setIsLoading: (loading) => set({ loading: loading }),
11
+ }));
@@ -1,4 +1,4 @@
1
- export declare type QueryDebugItem = {
1
+ export 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
- var zustand_1 = __importDefault(require("zustand"));
8
- var useQueryDebug = (0, zustand_1.default)(function (set) { return ({
7
+ const zustand_1 = __importDefault(require("zustand"));
8
+ const useQueryDebug = (0, zustand_1.default)((set) => ({
9
9
  value: undefined,
10
- set: function (value) {
11
- set({ value: value });
10
+ set: (value) => {
11
+ set({ value });
12
12
  },
13
- }); });
13
+ }));
14
14
  function setQueryDebug(value) {
15
- useQueryDebug.setState({ value: value });
15
+ useQueryDebug.setState({ value });
16
16
  }
17
17
  exports.setQueryDebug = setQueryDebug;
18
18
  function useQueryDebugData() {
19
- return useQueryDebug(function (store) { return store.value; });
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 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>;
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 declare type RPCClientError = InstanceType<typeof TRPCClientError>;
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
- var react_1 = require("@trpc/react");
5
- var client_1 = require("@trpc/client");
6
- var trpc = (0, react_1.createReactQueryHooks)();
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.65",
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.0.34",
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": "^1.0.32",
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.2.8",
53
- "@stitches/react": "^1.2.8",
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": "^3.2.0",
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": "4.5.5",
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.defineProperty(o, k2, { enumerable: true, get: function() { return m[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);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -1,5 +1,5 @@
1
1
  import URLParse from "url-parse";
2
- export declare type ParsedRouteTags = Record<"title" | "meta" | "script" | "style" | "link", {
2
+ export type ParsedRouteTags = Record<"title" | "meta" | "script" | "style" | "link", {
3
3
  [key: string]: string;
4
4
  }[]>;
5
5
  export interface RouteData {