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