eddev 0.2.66 → 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 (188) 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/style/createStitches.d.ts +375 -783
  175. package/style/createStitches.js +164 -142
  176. package/style/index.js +5 -1
  177. package/tsconfig.json +1 -1
  178. package/utils/Observable.d.ts +2 -2
  179. package/utils/Observable.js +12 -15
  180. package/utils/getRepoName.js +3 -3
  181. package/utils/promptIfRepoNameIncorrect.js +18 -64
  182. package/utils/refreshOverlayInterop.js +1 -1
  183. package/utils/reportErrorStack.d.ts +1 -1
  184. package/utils/reportErrorStack.js +1 -1
  185. package/utils/serverlessAppContext.js +1 -1
  186. package/utils/updateEnvFile.js +19 -69
  187. package/utils/useObservable.js +3 -3
  188. package/views/index.js +5 -1
@@ -1,75 +1,22 @@
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
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
50
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
51
4
  };
52
5
  Object.defineProperty(exports, "__esModule", { value: true });
53
6
  exports.RouteItemContext = exports.Switch = exports.Link = exports.isInternalPageLink = exports.RouterRoot = exports.createRouteItem = exports.Route = exports.useRouter = exports.useRoute = void 0;
54
- var jsx_runtime_1 = require("react/jsx-runtime");
55
- var react_1 = require("react");
56
- var react_merge_refs_1 = __importDefault(require("react-merge-refs"));
57
- var url_parse_1 = __importDefault(require("url-parse"));
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const react_1 = require("react");
9
+ const react_merge_refs_1 = __importDefault(require("react-merge-refs"));
10
+ const url_parse_1 = __importDefault(require("url-parse"));
58
11
  // const logger = (...args: any[]) => console.log(...args)
59
- var logger = function () {
60
- var args = [];
61
- for (var _i = 0; _i < arguments.length; _i++) {
62
- args[_i] = arguments[_i];
63
- }
64
- };
12
+ const logger = (...args) => { };
65
13
  function createRouteContext(opts) {
66
- var _a, _b;
67
- var subscribers = [];
68
- var notify = function (item, status) {
69
- subscribers.forEach(function (handler) { return handler(item, status); });
14
+ const subscribers = [];
15
+ const notify = (item, status) => {
16
+ subscribers.forEach((handler) => handler(item, status));
70
17
  };
71
- var parentIsSwitch = opts.parent && opts.parent.isSwitch;
72
- var ctx = {
18
+ const parentIsSwitch = opts.parent && opts.parent.isSwitch;
19
+ const ctx = {
73
20
  item: opts.initial,
74
21
  config: opts.config || {},
75
22
  parent: opts.parent,
@@ -79,19 +26,19 @@ function createRouteContext(opts) {
79
26
  isSwitch: !!opts.isSwitch,
80
27
  onNavigate: opts.onNavigate,
81
28
  onPreload: opts.onPreload,
82
- propagateChange: function (item, matches) {
29
+ propagateChange(item, matches) {
83
30
  ctx.item = item;
84
31
  ctx.currentMatch = matches;
85
32
  ctx.status = matches ? "active" : "inactive";
86
- ctx.children.forEach(function (child) {
33
+ ctx.children.forEach((child) => {
87
34
  child.propagateChange(item, child.match(item));
88
35
  });
89
36
  notify(item, ctx.status);
90
37
  },
91
- propagateCandidate: function (next, prev) {
38
+ propagateCandidate(next, prev) {
92
39
  // if (ctx.status === "leaving") return Promise.resolve();
93
- var promises = [Promise.resolve()];
94
- var matches = ctx.match(next);
40
+ let promises = [Promise.resolve()];
41
+ const matches = ctx.match(next);
95
42
  logger(ctx.config.debugName, "was", ctx.status, matches);
96
43
  if (ctx.status === "active" && (!matches || matches !== ctx.currentMatch)) {
97
44
  logger(ctx.config.debugName, "is leaving because ", matches, "!=", ctx.currentMatch);
@@ -102,24 +49,24 @@ function createRouteContext(opts) {
102
49
  promises.push(this.propagateLeaving(prev, next, false));
103
50
  }
104
51
  else {
105
- ctx.children.forEach(function (child) {
52
+ ctx.children.forEach((child) => {
106
53
  promises.push(child.propagateCandidate(next, prev));
107
54
  });
108
55
  }
109
56
  notify(prev, ctx.status);
110
57
  return Promise.all(promises);
111
58
  },
112
- propagateLeaving: function (current, next, parentIsLeaving) {
59
+ propagateLeaving(current, next, parentIsLeaving) {
113
60
  ctx.status = parentIsLeaving ? "parent-leaving" : "leaving";
114
61
  logger(ctx.status);
115
- var promises = [Promise.resolve()];
62
+ const promises = [Promise.resolve()];
116
63
  if (ctx.config.beforeLeave) {
117
- var result = ctx.config.beforeLeave(current, next, parentIsLeaving);
64
+ const result = ctx.config.beforeLeave(current, next, parentIsLeaving);
118
65
  if (result)
119
66
  promises.push(result);
120
67
  }
121
- ctx.children.forEach(function (child) {
122
- var result = child.propagateLeaving(current, next, true);
68
+ ctx.children.forEach((child) => {
69
+ const result = child.propagateLeaving(current, next, true);
123
70
  if (result) {
124
71
  promises.push(result);
125
72
  }
@@ -127,55 +74,52 @@ function createRouteContext(opts) {
127
74
  notify(current, ctx.status);
128
75
  return Promise.all(promises);
129
76
  },
130
- subscribe: function (handler) {
77
+ subscribe(handler) {
131
78
  subscribers.push(handler);
132
79
  handler(ctx.item, ctx.status);
133
- return function () {
134
- var i = subscribers.indexOf(handler);
80
+ return () => {
81
+ const i = subscribers.indexOf(handler);
135
82
  if (i !== -1) {
136
83
  subscribers.splice(i, 1);
137
84
  }
138
85
  };
139
86
  },
140
- getFirstMatch: function (item) {
87
+ getFirstMatch(item) {
141
88
  logger("Checking items", this.children, item);
142
- for (var _i = 0, _a = this.children; _i < _a.length; _i++) {
143
- var child = _a[_i];
89
+ for (const child of this.children) {
144
90
  if (child.matchSelf(item)) {
145
91
  logger("Matched", child.config.debugName);
146
92
  return child;
147
93
  }
148
94
  }
149
95
  },
150
- match: function (item) {
96
+ match(item) {
151
97
  if (parentIsSwitch) {
152
- var parent_1 = ctx.parent;
153
- return parent_1.getFirstMatch(item) === ctx && this.matchSelf(item);
98
+ const parent = ctx.parent;
99
+ return parent.getFirstMatch(item) === ctx && this.matchSelf(item);
154
100
  }
155
101
  return this.matchSelf(item);
156
102
  },
157
- matchSelf: function (item) {
158
- var _a, _b;
159
- if ((_a = ctx === null || ctx === void 0 ? void 0 : ctx.config) === null || _a === void 0 ? void 0 : _a.match) {
160
- return (_b = ctx === null || ctx === void 0 ? void 0 : ctx.config) === null || _b === void 0 ? void 0 : _b.match(item);
103
+ matchSelf(item) {
104
+ if (ctx?.config?.match) {
105
+ return ctx?.config?.match(item);
161
106
  }
162
107
  else {
163
108
  return true;
164
109
  }
165
110
  },
166
- update: function () { },
167
- dispose: (_a = opts.dispose) !== null && _a !== void 0 ? _a : (function () { }),
168
- fork: function (config, opts) {
169
- if (opts === void 0) { opts = {}; }
170
- var child = createRouteContext({
111
+ update: () => { },
112
+ dispose: opts.dispose ?? (() => { }),
113
+ fork(config, opts = {}) {
114
+ const child = createRouteContext({
171
115
  initial: ctx.item,
172
- config: config,
116
+ config,
173
117
  parent: ctx,
174
118
  isSwitch: opts.isSwitch,
175
119
  onNavigate: ctx.onNavigate,
176
120
  onPreload: ctx.onPreload,
177
- dispose: function () {
178
- var i = ctx.children.indexOf(child);
121
+ dispose: () => {
122
+ const i = ctx.children.indexOf(child);
179
123
  if (i !== -1)
180
124
  ctx.children.splice(i, 1);
181
125
  },
@@ -189,7 +133,7 @@ function createRouteContext(opts) {
189
133
  logger("Initting", ctx.config.debugName, opts.initial);
190
134
  if (parentIsSwitch) {
191
135
  logger("Parent is switch");
192
- if (!((_b = opts.parent) === null || _b === void 0 ? void 0 : _b.getFirstMatch(opts.initial))) {
136
+ if (!opts.parent?.getFirstMatch(opts.initial)) {
193
137
  logger("FFFF", ctx.config.match, ctx.match(opts.initial));
194
138
  ctx.currentMatch = ctx.matchSelf(opts.initial);
195
139
  ctx.status = ctx.currentMatch ? "active" : "inactive";
@@ -199,7 +143,7 @@ function createRouteContext(opts) {
199
143
  ctx.currentMatch = ctx.matchSelf(opts.initial);
200
144
  ctx.status = ctx.currentMatch ? "active" : "inactive";
201
145
  }
202
- subscribers.push(function (item, status) {
146
+ subscribers.push((item, status) => {
203
147
  if (ctx.config.onChange) {
204
148
  ctx.config.onChange(item, status);
205
149
  }
@@ -207,26 +151,24 @@ function createRouteContext(opts) {
207
151
  // notify(ctx.item, ctx.status);
208
152
  return ctx;
209
153
  }
210
- var RouterContext = (0, react_1.createContext)(undefined);
154
+ const RouterContext = (0, react_1.createContext)(undefined);
211
155
  function useForkedRouter(conf, opts) {
212
- var parent = (0, react_1.useContext)(RouterContext);
213
- var ctx = (0, react_1.useMemo)(function () {
156
+ const parent = (0, react_1.useContext)(RouterContext);
157
+ const ctx = (0, react_1.useMemo)(() => {
214
158
  return parent.fork(conf, opts);
215
159
  }, [parent]);
216
160
  Object.assign(ctx.config, conf);
217
- (0, react_1.useEffect)(function () {
218
- return function () { return ctx.dispose(); };
161
+ (0, react_1.useEffect)(() => {
162
+ return () => ctx.dispose();
219
163
  }, [ctx]);
220
164
  return ctx;
221
165
  }
222
166
  function useRoute() {
223
- var router = (0, react_1.useContext)(RouterContext);
224
- var _a = (0, react_1.useState)(router.item), route = _a[0], setRoute = _a[1];
225
- (0, react_1.useEffect)(function () {
226
- return router.subscribe(function (item, status) {
227
- setRoute(item);
228
- });
229
- }, [router]);
167
+ const router = (0, react_1.useContext)(RouterContext);
168
+ const [route, setRoute] = (0, react_1.useState)(router.item);
169
+ (0, react_1.useEffect)(() => router.subscribe((item, status) => {
170
+ setRoute(item);
171
+ }), [router]);
230
172
  return route;
231
173
  }
232
174
  exports.useRoute = useRoute;
@@ -235,62 +177,59 @@ function useRouter() {
235
177
  }
236
178
  exports.useRouter = useRouter;
237
179
  function Route(props) {
238
- var ctx = useForkedRouter({
180
+ const ctx = useForkedRouter({
239
181
  match: props.match,
240
182
  beforeLeave: props.beforeLeave,
241
183
  debugName: props.debugName,
242
184
  onChange: props.onChange,
243
185
  });
244
186
  logger("Intial route for", props.debugName, ctx.status, ctx.currentMatch);
245
- var _a = (0, react_1.useState)(ctx.status), status = _a[0], setStatus = _a[1];
246
- (0, react_1.useEffect)(function () {
247
- return ctx.subscribe(function (item, status) {
187
+ const [status, setStatus] = (0, react_1.useState)(ctx.status);
188
+ (0, react_1.useEffect)(() => {
189
+ return ctx.subscribe((item, status) => {
248
190
  setStatus(status);
249
191
  });
250
192
  }, [ctx]);
251
193
  if (status === "inactive")
252
194
  return null;
253
- return (0, jsx_runtime_1.jsx)(RouterContext.Provider, __assign({ value: ctx }, { children: props.children }), void 0);
195
+ return (0, jsx_runtime_1.jsx)(RouterContext.Provider, { value: ctx, children: props.children });
254
196
  }
255
197
  exports.Route = Route;
256
198
  function createRouteItem(url, data) {
257
- var parsed = (0, url_parse_1.default)(url, true);
258
- return __assign(__assign({}, parsed), { data: data });
199
+ const parsed = (0, url_parse_1.default)(url, true);
200
+ return {
201
+ ...parsed,
202
+ data,
203
+ };
259
204
  }
260
205
  exports.createRouteItem = createRouteItem;
261
206
  function RouterRoot(props) {
262
- var _this = this;
263
- var onNavigateRef = (0, react_1.useRef)(props.onNavigateRequest);
264
- var onPreNavigateRef = (0, react_1.useRef)(props.onPreload);
265
- var ctx = (0, react_1.useMemo)(function () {
266
- return createRouteContext({
267
- initial: createRouteItem(props.url, props.data),
268
- config: {
269
- debugName: "ROOT",
270
- },
271
- onNavigate: function (path) { return __awaiter(_this, void 0, void 0, function () {
272
- return __generator(this, function (_a) {
273
- // User has clicked a link
274
- if (onNavigateRef.current) {
275
- onNavigateRef.current(path);
276
- }
277
- return [2 /*return*/];
278
- });
279
- }); },
280
- onPreload: function (path) {
281
- if (onPreNavigateRef.current) {
282
- onPreNavigateRef.current(path);
283
- }
284
- },
285
- });
286
- }, []);
207
+ const onNavigateRef = (0, react_1.useRef)(props.onNavigateRequest);
208
+ const onPreNavigateRef = (0, react_1.useRef)(props.onPreload);
209
+ const ctx = (0, react_1.useMemo)(() => createRouteContext({
210
+ initial: createRouteItem(props.url, props.data),
211
+ config: {
212
+ debugName: "ROOT",
213
+ },
214
+ onNavigate: async (path) => {
215
+ // User has clicked a link
216
+ if (onNavigateRef.current) {
217
+ onNavigateRef.current(path);
218
+ }
219
+ },
220
+ onPreload: (path) => {
221
+ if (onPreNavigateRef.current) {
222
+ onPreNavigateRef.current(path);
223
+ }
224
+ },
225
+ }), []);
287
226
  onNavigateRef.current = props.onNavigateRequest;
288
227
  onPreNavigateRef.current = props.onPreload;
289
- (0, react_1.useEffect)(function () {
290
- var cancelled = false;
291
- var item = createRouteItem(props.url, props.data);
228
+ (0, react_1.useEffect)(() => {
229
+ let cancelled = false;
230
+ const item = createRouteItem(props.url, props.data);
292
231
  if (item.href !== ctx.item.href || item.data !== ctx.item.data) {
293
- ctx.propagateCandidate(item, ctx.item).then(function () {
232
+ ctx.propagateCandidate(item, ctx.item).then(() => {
294
233
  if (!cancelled) {
295
234
  ctx.propagateChange(item, true);
296
235
  if (props.onNavigated) {
@@ -298,7 +237,7 @@ function RouterRoot(props) {
298
237
  }
299
238
  }
300
239
  });
301
- return function () {
240
+ return () => {
302
241
  cancelled = true;
303
242
  };
304
243
  }
@@ -312,11 +251,11 @@ function RouterRoot(props) {
312
251
  // }
313
252
  // })
314
253
  // }, [props.onNavigated])
315
- return (0, jsx_runtime_1.jsx)(RouterContext.Provider, __assign({ value: ctx }, { children: props.children }), void 0);
254
+ return (0, jsx_runtime_1.jsx)(RouterContext.Provider, { value: ctx, children: props.children });
316
255
  }
317
256
  exports.RouterRoot = RouterRoot;
318
- var isInternalPageLink = function (href) {
319
- var url = (0, url_parse_1.default)(href, true);
257
+ const isInternalPageLink = (href) => {
258
+ const url = (0, url_parse_1.default)(href, true);
320
259
  if (url && url.origin === document.location.origin && !url.pathname.match(/\./)) {
321
260
  return true;
322
261
  }
@@ -325,25 +264,25 @@ var isInternalPageLink = function (href) {
325
264
  }
326
265
  };
327
266
  exports.isInternalPageLink = isInternalPageLink;
328
- exports.Link = (0, react_1.forwardRef)(function (props, ref) {
267
+ exports.Link = (0, react_1.forwardRef)((props, ref) => {
329
268
  // @ts-ignore
330
269
  if (process.serverless) {
331
- var NextLink = require("next/link").default;
332
- return ((0, jsx_runtime_1.jsx)(NextLink, __assign({ href: props.href, passHref: true, prefetch: false }, { children: (0, jsx_runtime_1.jsx)("a", __assign({ ref: ref }, props, { href: undefined }), void 0) }), void 0));
270
+ const { default: NextLink } = require("next/link");
271
+ return ((0, jsx_runtime_1.jsx)(NextLink, { href: props.href, passHref: true, prefetch: false, children: (0, jsx_runtime_1.jsx)("a", { ref: ref, ...props, href: undefined }) }));
333
272
  }
334
- var localRef = (0, react_1.useRef)();
335
- var router = (0, react_1.useContext)(RouterContext);
336
- (0, react_1.useEffect)(function () {
273
+ const localRef = (0, react_1.useRef)();
274
+ const router = (0, react_1.useContext)(RouterContext);
275
+ (0, react_1.useEffect)(() => {
337
276
  if (props.preload && localRef.current && (0, exports.isInternalPageLink)(localRef.current.href)) {
338
- router === null || router === void 0 ? void 0 : router.onPreload(localRef.current.href);
277
+ router?.onPreload(localRef.current.href);
339
278
  }
340
279
  }, [props.preload]);
341
- return ((0, jsx_runtime_1.jsx)("a", __assign({ ref: (0, react_merge_refs_1.default)([localRef, ref]) }, props, { onMouseEnter: function (e) {
280
+ return ((0, jsx_runtime_1.jsx)("a", { ref: (0, react_merge_refs_1.default)([localRef, ref]), ...props, onMouseEnter: (e) => {
342
281
  if (props.onMouseEnter) {
343
282
  props.onMouseEnter(e);
344
283
  }
345
- router === null || router === void 0 ? void 0 : router.onPreload(e.currentTarget.href);
346
- }, onClick: function (e) {
284
+ router?.onPreload(e.currentTarget.href);
285
+ }, onClick: (e) => {
347
286
  if (process.admin) {
348
287
  e.preventDefault();
349
288
  return;
@@ -352,35 +291,34 @@ exports.Link = (0, react_1.forwardRef)(function (props, ref) {
352
291
  props.onClick(e);
353
292
  }
354
293
  if (!e.isDefaultPrevented() && router && !e.ctrlKey && !e.metaKey) {
355
- var href = e.currentTarget.href;
294
+ const href = e.currentTarget.href;
356
295
  if ((0, exports.isInternalPageLink)(href)) {
357
296
  router.onNavigate(e.currentTarget.href);
358
297
  e.preventDefault();
359
298
  }
360
299
  }
361
- } }), void 0));
300
+ } }));
362
301
  });
363
- function Switch(_a) {
364
- var children = _a.children;
365
- var ctx = useForkedRouter({
302
+ function Switch({ children }) {
303
+ const ctx = useForkedRouter({
366
304
  debugName: "SWITCH",
367
- match: function () {
305
+ match: () => {
368
306
  return true;
369
307
  },
370
- beforeLeave: function () {
308
+ beforeLeave: () => {
371
309
  return undefined;
372
310
  },
373
311
  }, { isSwitch: true });
374
- return (0, jsx_runtime_1.jsx)(RouterContext.Provider, __assign({ value: ctx }, { children: children }), void 0);
312
+ return (0, jsx_runtime_1.jsx)(RouterContext.Provider, { value: ctx, children: children });
375
313
  }
376
314
  exports.Switch = Switch;
377
315
  function RouteItemContext(props) {
378
- var ctx = useForkedRouter({
379
- match: function () { return true; },
316
+ const ctx = useForkedRouter({
317
+ match: () => true,
380
318
  beforeLeave: undefined,
381
319
  debugName: undefined,
382
320
  onChange: undefined,
383
321
  });
384
- return (0, jsx_runtime_1.jsx)(RouterContext.Provider, __assign({ value: ctx }, { children: props.children }), void 0);
322
+ return (0, jsx_runtime_1.jsx)(RouterContext.Provider, { value: ctx, children: props.children });
385
323
  }
386
324
  exports.RouteItemContext = RouteItemContext;
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.updateEditLink = void 0;
4
4
  function updateEditLink(link) {
5
5
  if (link) {
6
- var editLink = document.querySelector("#wp-admin-bar-edit a");
6
+ const editLink = document.querySelector("#wp-admin-bar-edit a");
7
7
  if (editLink) {
8
8
  editLink.setAttribute("href", link);
9
9
  }
@@ -1,2 +1,2 @@
1
1
  import { NextApiHandler } from "next/types";
2
- export declare function defineAPI(handler: NextApiHandler): NextApiHandler<any>;
2
+ export declare function defineAPI(handler: NextApiHandler): NextApiHandler;
@@ -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];
@@ -20,10 +24,10 @@ var __importStar = (this && this.__importStar) || function (mod) {
20
24
  };
21
25
  Object.defineProperty(exports, "__esModule", { value: true });
22
26
  exports.defineRPCContextCreator = exports.defineRPC = void 0;
23
- var trpc = __importStar(require("@trpc/server"));
24
- var z = __importStar(require("zod"));
27
+ const trpc = __importStar(require("@trpc/server"));
28
+ const z = __importStar(require("zod"));
25
29
  // @ts-ignore
26
- var createRouter = function () { return trpc.router(); };
30
+ const createRouter = () => trpc.router();
27
31
  // @ts-ignore
28
32
  function defineRPC(creator) {
29
33
  return creator(trpc.router(), z);
@@ -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];
@@ -11,7 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
11
15
  };
12
16
  Object.defineProperty(exports, "__esModule", { value: true });
13
17
  exports.RPCError = void 0;
14
- var server_1 = require("@trpc/server");
18
+ const server_1 = require("@trpc/server");
15
19
  __exportStar(require("./define-api"), exports);
16
20
  __exportStar(require("./define-rpc-router"), exports);
17
21
  __exportStar(require("./error-codes"), exports);