eddev 0.2.67-beta1 → 0.3.0-beta2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (185) hide show
  1. package/admin/components/ImageWell.d.ts +2 -2
  2. package/admin/components/ImageWell.js +51 -39
  3. package/admin/defineField.d.ts +2 -2
  4. package/admin/defineWidget.d.ts +1 -1
  5. package/admin/defineWidget.js +2 -2
  6. package/admin/index.js +1 -5
  7. package/admin/installFieldTypes.js +26 -26
  8. package/admin/runWidgets.js +28 -17
  9. package/admin/selectMedia.d.ts +2 -2
  10. package/admin/selectMedia.js +1 -1
  11. package/blocks/ContentBlocks.d.ts +6 -6
  12. package/blocks/ContentBlocks.js +66 -58
  13. package/blocks/ErrorBoundaryEditor.d.ts +1 -1
  14. package/blocks/ErrorBoundaryEditor.js +45 -16
  15. package/blocks/ErrorBoundaryFrontend.d.ts +1 -1
  16. package/blocks/ErrorBoundaryFrontend.js +45 -16
  17. package/blocks/InspectorControls.d.ts +1 -1
  18. package/blocks/InspectorControls.js +3 -3
  19. package/blocks/blockAttributes.d.ts +2 -2
  20. package/blocks/blockAttributes.js +44 -24
  21. package/blocks/index.js +1 -5
  22. package/blocks/inlineEditing.d.ts +6 -6
  23. package/blocks/inlineEditing.js +55 -36
  24. package/blocks/installGutenbergHooks.js +68 -48
  25. package/build/babel/plugin-name-defined-components.js +16 -15
  26. package/build/build-favicon.js +62 -11
  27. package/build/clean.js +52 -5
  28. package/build/create-codegen-worker.js +33 -78
  29. package/build/create-serverless-dev-worker.js +39 -61
  30. package/build/create-webpack-worker.js +33 -65
  31. package/build/file-tree.d.ts +2 -2
  32. package/build/file-tree.js +12 -12
  33. package/build/get-webpack-config.js +395 -341
  34. package/build/graphql-codegen/graphql-codegen-files.js +25 -31
  35. package/build/graphql-codegen/graphql-codegen-no-duplicates.js +4 -4
  36. package/build/graphql-codegen/graphql-codegen-queries.js +99 -102
  37. package/build/manifests/manifest-blocks.d.ts +1 -1
  38. package/build/manifests/manifest-blocks.js +29 -37
  39. package/build/manifests/manifest-fields.d.ts +1 -1
  40. package/build/manifests/manifest-fields.js +21 -23
  41. package/build/manifests/manifest-views.d.ts +1 -1
  42. package/build/manifests/manifest-views.js +25 -32
  43. package/build/manifests/manifest-widgets.d.ts +1 -1
  44. package/build/manifests/manifest-widgets.js +20 -22
  45. package/build/manifests/manifest.d.ts +2 -2
  46. package/build/manifests/manifest.js +94 -30
  47. package/build/reporter.d.ts +1 -1
  48. package/build/reporter.js +32 -29
  49. package/build/serverless/create-next-app.d.ts +1 -1
  50. package/build/serverless/create-next-app.js +467 -245
  51. package/build/state/codegen-state.d.ts +4 -4
  52. package/build/state/compiler-state.d.ts +5 -5
  53. package/build/state/serverless-state.d.ts +3 -3
  54. package/build/workers/codegen-worker-script.js +519 -393
  55. package/build/workers/serverless-worker-dev-script.js +4 -4
  56. package/build/workers/webpack-worker-script.js +156 -90
  57. package/cli/build.dev.d.ts +1 -1
  58. package/cli/build.dev.js +126 -79
  59. package/cli/build.prod.d.ts +1 -1
  60. package/cli/build.prod.js +98 -42
  61. package/cli/cli.js +28 -19
  62. package/cli/display/components/BundleDisplay.d.ts +1 -1
  63. package/cli/display/components/BundleDisplay.js +24 -13
  64. package/cli/display/components/CodegenDisplay.d.ts +1 -1
  65. package/cli/display/components/CodegenDisplay.js +25 -14
  66. package/cli/display/components/DevCLIDisplay.d.ts +2 -2
  67. package/cli/display/components/DevCLIDisplay.js +25 -14
  68. package/cli/display/components/Fullscreen.js +20 -9
  69. package/cli/display/components/ServerlessDisplay.d.ts +2 -2
  70. package/cli/display/components/ServerlessDisplay.js +26 -15
  71. package/cli/display/components/StatusIcon.d.ts +2 -2
  72. package/cli/display/components/StatusIcon.js +3 -3
  73. package/cli/preinstall.js +5 -4
  74. package/cli/setup.js +73 -25
  75. package/components/AdminBar.d.ts +1 -1
  76. package/components/AdminBar.js +3 -37
  77. package/components/BrowserRouter.d.ts +2 -2
  78. package/components/BrowserRouter.js +54 -41
  79. package/components/InlinePage.d.ts +2 -2
  80. package/components/InlinePage.js +29 -17
  81. package/components/NextRouter.d.ts +2 -2
  82. package/components/NextRouter.js +29 -20
  83. package/components/index.js +1 -5
  84. package/config/config-schema.d.ts +1 -1
  85. package/config/config-schema.js +1 -1
  86. package/config/create-schema-file.js +6 -6
  87. package/config/get-config.js +13 -10
  88. package/config/index.js +1 -5
  89. package/config/parse-config.js +1 -1
  90. package/config/print-zod-errors.js +3 -3
  91. package/dev-ui/components/BreakpointColumnHeader.d.ts +2 -2
  92. package/dev-ui/components/BreakpointColumnHeader.js +18 -7
  93. package/dev-ui/components/BreakpointIndicator.d.ts +1 -1
  94. package/dev-ui/components/BreakpointIndicator.js +32 -25
  95. package/dev-ui/components/DevUI.d.ts +1 -1
  96. package/dev-ui/components/DevUI.js +13 -13
  97. package/dev-ui/components/Launcher.d.ts +2 -2
  98. package/dev-ui/components/Launcher.js +25 -13
  99. package/dev-ui/components/PanelWrapper.d.ts +2 -2
  100. package/dev-ui/components/PanelWrapper.js +8 -8
  101. package/dev-ui/components/ResponsiveLerpControl.d.ts +2 -2
  102. package/dev-ui/components/ResponsiveLerpControl.js +38 -27
  103. package/dev-ui/components/ResponsiveScaleEditor.d.ts +4 -4
  104. package/dev-ui/components/ResponsiveScaleEditor.js +78 -64
  105. package/dev-ui/components/atoms/Button.js +1 -1
  106. package/dev-ui/components/atoms/Dropdown.d.ts +3 -3
  107. package/dev-ui/components/atoms/Dropdown.js +9 -8
  108. package/dev-ui/components/atoms/NumberField.d.ts +2 -2
  109. package/dev-ui/components/atoms/NumberField.js +42 -29
  110. package/dev-ui/components/atoms/Spacer.js +1 -1
  111. package/dev-ui/components/atoms/Text.js +1 -1
  112. package/dev-ui/components/atoms/ToggleButton.d.ts +2 -2
  113. package/dev-ui/components/atoms/ToggleButton.js +16 -5
  114. package/dev-ui/components/atoms/Tooltip.d.ts +2 -2
  115. package/dev-ui/components/atoms/Tooltip.js +20 -8
  116. package/dev-ui/components/panels/AppDataDebugger.d.ts +1 -1
  117. package/dev-ui/components/panels/AppDataDebugger.js +19 -8
  118. package/dev-ui/components/panels/ColorEditor.d.ts +1 -1
  119. package/dev-ui/components/panels/ColorEditor.js +42 -35
  120. package/dev-ui/components/panels/PageDataDebugger.d.ts +1 -1
  121. package/dev-ui/components/panels/PageDataDebugger.js +20 -8
  122. package/dev-ui/components/panels/QueryDebugger.d.ts +1 -1
  123. package/dev-ui/components/panels/QueryDebugger.js +24 -12
  124. package/dev-ui/components/panels/SpacingEditor.d.ts +1 -1
  125. package/dev-ui/components/panels/SpacingEditor.js +48 -34
  126. package/dev-ui/components/panels/TypographyEditor.d.ts +1 -1
  127. package/dev-ui/components/panels/TypographyEditor.js +46 -38
  128. package/dev-ui/hooks/useBreakpoint.d.ts +1 -1
  129. package/dev-ui/hooks/useBreakpoint.js +13 -13
  130. package/dev-ui/hooks/usePersistState.js +7 -6
  131. package/dev-ui/hooks/useStylesheet.js +6 -6
  132. package/dev-ui/icons.d.ts +15 -15
  133. package/dev-ui/icons.js +27 -16
  134. package/dev-ui/index.js +1 -5
  135. package/dev-ui/loader.d.ts +1 -1
  136. package/dev-ui/loader.js +9 -13
  137. package/dev-ui/panels.d.ts +2 -2
  138. package/dev-ui/panels.js +7 -7
  139. package/dev-ui/theme.js +3 -3
  140. package/dynamic/dynamic-component.js +1 -1
  141. package/dynamic/index.js +1 -5
  142. package/entry/Root.d.ts +2 -2
  143. package/entry/Root.js +26 -16
  144. package/entry/entry.admin.dev.js +4 -4
  145. package/entry/entry.admin.prod.js +4 -4
  146. package/entry/entry.monolith.dev.js +5 -5
  147. package/entry/entry.monolith.prod.js +5 -5
  148. package/gravityforms/gravity-forms.d.ts +2 -2
  149. package/gravityforms/index.js +1 -5
  150. package/gravityforms/useGravityForm.d.ts +2 -2
  151. package/gravityforms/useGravityForm.js +130 -126
  152. package/hooks/index.js +1 -5
  153. package/hooks/queryUtils.d.ts +14 -14
  154. package/hooks/queryUtils.js +192 -101
  155. package/hooks/useAppData.d.ts +2 -2
  156. package/hooks/useAppData.js +9 -9
  157. package/hooks/usePageLoad.js +4 -4
  158. package/hooks/useQueryDebug.d.ts +1 -1
  159. package/hooks/useQueryDebug.js +7 -7
  160. package/hooks/useRPC.d.ts +4 -4
  161. package/hooks/useRPC.js +3 -3
  162. package/package.json +12 -12
  163. package/routing/index.js +1 -5
  164. package/routing/remoteProps.d.ts +1 -1
  165. package/routing/remoteProps.js +72 -31
  166. package/routing/routing.d.ts +25 -15
  167. package/routing/routing.js +200 -112
  168. package/routing/updateEditLink.js +1 -1
  169. package/serverless/define-api.d.ts +1 -1
  170. package/serverless/define-rpc-router.js +4 -8
  171. package/serverless/index.js +2 -6
  172. package/style/createStitches.js +142 -164
  173. package/style/index.js +1 -5
  174. package/tsconfig.json +1 -1
  175. package/utils/Observable.d.ts +2 -2
  176. package/utils/Observable.js +15 -12
  177. package/utils/getRepoName.js +3 -3
  178. package/utils/promptIfRepoNameIncorrect.js +64 -18
  179. package/utils/refreshOverlayInterop.js +1 -1
  180. package/utils/reportErrorStack.d.ts +1 -1
  181. package/utils/reportErrorStack.js +1 -1
  182. package/utils/serverlessAppContext.js +1 -1
  183. package/utils/updateEnvFile.js +69 -19
  184. package/utils/useObservable.js +3 -3
  185. package/views/index.js +1 -5
@@ -1,9 +1,9 @@
1
- type Props = {
1
+ declare type Props = {
2
2
  previewSize: string;
3
3
  aspects: string[];
4
4
  value: number | null | undefined;
5
5
  noBorder?: boolean;
6
6
  onChange: (value: number | null) => void;
7
7
  };
8
- export declare function ImageWell(props: Props): import("react/jsx-runtime").JSX.Element;
8
+ export declare function ImageWell(props: Props): JSX.Element;
9
9
  export {};
@@ -1,30 +1,41 @@
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
+ };
2
13
  Object.defineProperty(exports, "__esModule", { value: true });
3
14
  exports.ImageWell = void 0;
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");
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");
9
20
  function ImageWell(props) {
10
21
  // @ts-ignore
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)(() => {
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 () {
15
26
  if (props.value) {
16
- let cancelled = false;
27
+ var cancelled_1 = false;
17
28
  setImageIsLoading(true);
18
29
  fetch("/wp-json/ed/v1/media/" + Number(props.value))
19
- .then((response) => response.json())
20
- .then((image) => {
21
- if (cancelled)
30
+ .then(function (response) { return response.json(); })
31
+ .then(function (image) {
32
+ if (cancelled_1)
22
33
  return;
23
34
  setImageIsLoading(false);
24
35
  setSelectedImage(image);
25
36
  });
26
- return () => {
27
- cancelled = true;
37
+ return function () {
38
+ cancelled_1 = true;
28
39
  };
29
40
  }
30
41
  else {
@@ -32,16 +43,17 @@ function ImageWell(props) {
32
43
  setImageIsLoading(false);
33
44
  }
34
45
  }, [props.value]);
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: {
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: {
37
48
  width: size.width,
38
49
  height: size.height,
39
- }, children: props.aspects &&
40
- props.aspects.map((aspect) => {
41
- let x, y, width, height, originalAspect = 0, ownAspect = 0;
50
+ } }, { children: props.aspects &&
51
+ props.aspects.map(function (aspect) {
52
+ var _a;
53
+ var x, y, width, height, originalAspect = 0, ownAspect = 0;
42
54
  try {
43
55
  ;
44
- [x, y] = aspect.split(/\s*\/\s*/);
56
+ _a = aspect.split(/\s*\/\s*/), x = _a[0], y = _a[1];
45
57
  originalAspect = size.width / size.height;
46
58
  ownAspect = Number(x) / Number(y);
47
59
  }
@@ -51,13 +63,13 @@ function ImageWell(props) {
51
63
  width = ownAspect > originalAspect ? size.width : size.height * ownAspect;
52
64
  height = ownAspect > originalAspect ? size.width / ownAspect : size.height;
53
65
  return (0, jsx_runtime_1.jsx)(AspectDisplay, { style: { width: width + "px", height: height + "px" } }, aspect);
54
- }) })] })) : ((0, jsx_runtime_1.jsx)(NoSelection, { children: (0, jsx_runtime_1.jsx)(ChooseButton, { onClick: (e) => {
66
+ }) }), void 0)] }, void 0)) : ((0, jsx_runtime_1.jsx)(NoSelection, { children: (0, jsx_runtime_1.jsx)(ChooseButton, __assign({ onClick: function (e) {
55
67
  e.preventDefault();
56
68
  (0, selectMedia_1.selectMedia)({
57
69
  mode: "select",
58
70
  type: "image",
59
71
  title: "Select an image",
60
- select: (selected) => {
72
+ select: function (selected) {
61
73
  if (selected) {
62
74
  props.onChange(selected.id);
63
75
  }
@@ -70,10 +82,10 @@ function ImageWell(props) {
70
82
  // attachment: [props.value],
71
83
  // select: (selected: any) => console.log("Selected", selected),
72
84
  // })
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) => {
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) {
74
86
  e.preventDefault();
75
87
  props.onChange(null);
76
- }, children: (0, jsx_runtime_1.jsx)("span", { className: "dashicons dashicons-trash" }) }), (0, jsx_runtime_1.jsx)(ToolbarButton, { onClick: (e) => {
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) {
77
89
  e.preventDefault();
78
90
  (0, selectMedia_1.selectMedia)({
79
91
  mode: "edit",
@@ -81,13 +93,13 @@ function ImageWell(props) {
81
93
  attachment: Number(props.value),
82
94
  title: "Edit Image",
83
95
  });
84
- }, children: (0, jsx_runtime_1.jsx)("span", { className: "dashicons dashicons-edit" }) }), selectedImage && ((0, jsx_runtime_1.jsx)(ToolbarButton, { onClick: (e) => {
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) {
85
97
  e.preventDefault();
86
98
  window.open(selectedImage.url);
87
- }, children: (0, jsx_runtime_1.jsx)("span", { className: "dashicons dashicons-external" }) }))] })) : null })] }));
99
+ } }, { children: (0, jsx_runtime_1.jsx)("span", { className: "dashicons dashicons-external" }, void 0) }), void 0))] }, void 0)) : null }, void 0)] }), void 0));
88
100
  }
89
101
  exports.ImageWell = ImageWell;
90
- const Wrapper = (0, react_1.styled)("div", {
102
+ var Wrapper = (0, react_1.styled)("div", {
91
103
  position: "relative",
92
104
  display: "block",
93
105
  width: "100%",
@@ -101,7 +113,7 @@ const Wrapper = (0, react_1.styled)("div", {
101
113
  },
102
114
  },
103
115
  });
104
- const ImageContainer = (0, react_1.styled)("div", {
116
+ var ImageContainer = (0, react_1.styled)("div", {
105
117
  margin: "4px",
106
118
  display: "block",
107
119
  position: "relative",
@@ -110,7 +122,7 @@ const ImageContainer = (0, react_1.styled)("div", {
110
122
  display: "block",
111
123
  },
112
124
  });
113
- const spin = (0, react_1.keyframes)({
125
+ var spin = (0, react_1.keyframes)({
114
126
  from: {
115
127
  transform: "rotate(0deg)",
116
128
  },
@@ -118,22 +130,22 @@ const spin = (0, react_1.keyframes)({
118
130
  transform: "rotate(360deg)",
119
131
  },
120
132
  });
121
- const Spinner = (0, react_1.styled)("div", {
133
+ var Spinner = (0, react_1.styled)("div", {
122
134
  display: "block",
123
135
  width: "16px",
124
136
  height: "16px",
125
137
  borderRadius: "100px",
126
138
  border: "4px solid transparent",
127
139
  borderTopColor: "currentColor",
128
- animation: `${spin} 0.5s linear infinite`,
140
+ animation: "".concat(spin, " 0.5s linear infinite"),
129
141
  });
130
- const Loading = (0, react_1.styled)("div", {
142
+ var Loading = (0, react_1.styled)("div", {
131
143
  display: "flex",
132
144
  justifyContent: "center",
133
145
  alignItems: "center",
134
146
  padding: "10px",
135
147
  });
136
- const Toolbar = (0, react_1.styled)("div", {
148
+ var Toolbar = (0, react_1.styled)("div", {
137
149
  position: "absolute",
138
150
  top: "0",
139
151
  right: "6px",
@@ -143,7 +155,7 @@ const Toolbar = (0, react_1.styled)("div", {
143
155
  flexDirection: "column",
144
156
  justifyContent: "center",
145
157
  });
146
- const ToolbarButton = (0, react_1.styled)("button", {
158
+ var ToolbarButton = (0, react_1.styled)("button", {
147
159
  width: "24px",
148
160
  height: "24px",
149
161
  fontSize: "12px",
@@ -162,12 +174,12 @@ const ToolbarButton = (0, react_1.styled)("button", {
162
174
  ToolbarButton.defaultProps = {
163
175
  className: "dashicons",
164
176
  };
165
- const NoSelection = (0, react_1.styled)("div", {
177
+ var NoSelection = (0, react_1.styled)("div", {
166
178
  display: "flex",
167
179
  justifyContent: "center",
168
180
  padding: "10px 0px",
169
181
  });
170
- const ChooseButton = (0, react_1.styled)("button", {
182
+ var ChooseButton = (0, react_1.styled)("button", {
171
183
  appearance: "none",
172
184
  border: "0px",
173
185
  background: "#f6f6f6",
@@ -176,7 +188,7 @@ const ChooseButton = (0, react_1.styled)("button", {
176
188
  borderRadius: "100px",
177
189
  cursor: "pointer",
178
190
  });
179
- const AspectWrapper = (0, react_1.styled)("div", {
191
+ var AspectWrapper = (0, react_1.styled)("div", {
180
192
  position: "absolute",
181
193
  left: 0,
182
194
  top: 0,
@@ -188,7 +200,7 @@ const AspectWrapper = (0, react_1.styled)("div", {
188
200
  opacity: 1,
189
201
  },
190
202
  });
191
- const AspectDisplay = (0, react_1.styled)("div", {
203
+ var AspectDisplay = (0, react_1.styled)("div", {
192
204
  position: "absolute",
193
205
  border: "1px solid white",
194
206
  left: "50%",
@@ -1,12 +1,12 @@
1
1
  import { ReactElement } from "react";
2
- export type FieldProps<T> = {
2
+ export declare 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 type FieldTypeDefinition<T> = {
9
+ export declare 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
- type WidgetProps = {
2
+ declare 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,
7
- component,
6
+ name: name,
7
+ component: component,
8
8
  };
9
9
  }
10
10
  exports.defineWidget = defineWidget;
package/admin/index.js CHANGED
@@ -1,11 +1,7 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
9
5
  }) : (function(o, m, k, k2) {
10
6
  if (k2 === undefined) k2 = k;
11
7
  o[k2] = m[k];
@@ -1,11 +1,7 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
9
5
  }) : (function(o, m, k, k2) {
10
6
  if (k2 === undefined) k2 = k;
11
7
  o[k2] = m[k];
@@ -27,34 +23,38 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
27
23
  };
28
24
  Object.defineProperty(exports, "__esModule", { value: true });
29
25
  exports.installFieldTypes = void 0;
30
- const jsx_runtime_1 = require("react/jsx-runtime");
26
+ var jsx_runtime_1 = require("react/jsx-runtime");
31
27
  // @ts-ignore
32
- const fields_1 = __importDefault(require("@manifest/fields"));
33
- const ReactDOM = __importStar(require("react-dom"));
34
- const react_1 = require("react");
28
+ var fields_1 = __importDefault(require("@manifest/fields"));
29
+ var ReactDOM = __importStar(require("react-dom"));
30
+ var react_1 = require("react");
35
31
  function installFieldTypes() {
36
32
  // @ts-ignore
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) => {
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) {
42
38
  console.log("Field is", field);
43
- const { $el, cid, data } = field;
44
- const input = $el.find("input[type='hidden']");
45
- const container = document.createElement("div");
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");
46
42
  $el.append(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);
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);
48
44
  };
49
- acf.addAction("ready_field/type=" + name, init);
50
- acf.addAction("append_field/type=" + name, init);
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);
51
50
  }
52
51
  }
53
52
  exports.installFieldTypes = installFieldTypes;
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)(() => {
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 () {
58
58
  input.value = JSON.stringify(value);
59
59
  if (valueChanged) {
60
60
  try {
@@ -65,8 +65,8 @@ function FieldWrapper({ input, defaultValue, Component, settings }) {
65
65
  setValueChanged(false);
66
66
  }
67
67
  }, [value, valueChanged]);
68
- return ((0, jsx_runtime_1.jsx)(Component, { value: value, onChange: (value) => {
68
+ return ((0, jsx_runtime_1.jsx)(Component, { value: value, onChange: function (value) {
69
69
  setValue(value);
70
70
  setValueChanged(true);
71
- }, settings: settings }));
71
+ }, settings: settings }, void 0));
72
72
  }
@@ -1,40 +1,51 @@
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
+ };
2
13
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
14
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
15
  };
5
16
  Object.defineProperty(exports, "__esModule", { value: true });
6
17
  exports.runWidgets = void 0;
7
- const jsx_runtime_1 = require("react/jsx-runtime");
18
+ var jsx_runtime_1 = require("react/jsx-runtime");
8
19
  // @ts-ignore
9
- const widgets_1 = __importDefault(require("@manifest/widgets"));
10
- const client_1 = require("react-dom/client");
20
+ var widgets_1 = __importDefault(require("@manifest/widgets"));
21
+ var client_1 = require("react-dom/client");
11
22
  function runWidgets() {
12
- const elements = document.querySelectorAll("[data-widget]");
23
+ var elements = document.querySelectorAll("[data-widget]");
13
24
  console.log("Running widgets", elements, widgets_1.default);
14
- elements.forEach((el) => {
25
+ elements.forEach(function (el) {
15
26
  if (el instanceof HTMLElement) {
16
- const data = el.dataset;
17
- const name = data["widget"];
18
- const type = widgets_1.default.find((item) => item.name === name);
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; });
19
30
  if (type) {
20
- const props = {
31
+ var props_1 = {
21
32
  element: el,
22
33
  dataset: data,
23
34
  };
24
- const root = (0, client_1.createRoot)(el);
25
- const renderWithComponent = (Component) => {
26
- root.render((0, jsx_runtime_1.jsx)(Component, { ...props }));
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));
27
38
  };
28
- renderWithComponent(type.component);
39
+ renderWithComponent_1(type.component);
29
40
  // @ts-ignore
30
41
  if (import.meta.webpackHot) {
31
42
  // @ts-ignore
32
- import.meta.webpackHot.accept([require.resolve("@manifest/widgets")], () => {
43
+ import.meta.webpackHot.accept([require.resolve("@manifest/widgets")], function () {
33
44
  console.log("Widgets mani");
34
- const updateWidgets = require("@manifest/widgets").default;
35
- const type = updateWidgets.find((item) => item.name === name);
45
+ var updateWidgets = require("@manifest/widgets").default;
46
+ var type = updateWidgets.find(function (item) { return item.name === name_1; });
36
47
  if (type) {
37
- renderWithComponent(type.component);
48
+ renderWithComponent_1(type.component);
38
49
  }
39
50
  });
40
51
  }
@@ -1,4 +1,4 @@
1
- type Attachment = {
1
+ declare type Attachment = {
2
2
  id: number;
3
3
  filename: string;
4
4
  mime: string;
@@ -15,7 +15,7 @@ type Attachment = {
15
15
  };
16
16
  };
17
17
  };
18
- type MediaPopupArgs = {
18
+ declare 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
- const acf = window.acf;
6
+ var 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 type ContentBlock<T extends keyof BlockProps | string = any> = {
2
+ export declare 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 type ContentBlock<T extends keyof BlockProps | string = any> = {
9
9
  rule: string;
10
10
  inline: any;
11
11
  };
12
- type BlocksContext = {
12
+ declare type BlocksContext = {
13
13
  ancestors: ContentBlock[];
14
14
  parent?: ContentBlock;
15
15
  prev?: ContentBlock;
@@ -17,7 +17,7 @@ type BlocksContext = {
17
17
  current: ContentBlock;
18
18
  };
19
19
  export declare const BlocksContext: import("react").Context<BlocksContext | undefined>;
20
- export type ContentBlocksSettings = {
20
+ export declare type ContentBlocksSettings = {
21
21
  wrapBlock?: (child: ReactElement, ctx: BlocksContext) => ReactElement;
22
22
  spacer?: (ctx: {
23
23
  ancestors: ContentBlock[];
@@ -26,14 +26,14 @@ export type ContentBlocksSettings = {
26
26
  next: ContentBlock | null;
27
27
  }) => ReactElement | null;
28
28
  };
29
- type Props = {
29
+ declare type Props = {
30
30
  blocks: ContentBlock[];
31
31
  } & ContentBlocksSettings;
32
- export type GenericBlockProps = {
32
+ export declare 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): import("react/jsx-runtime").JSX.Element | null;
38
+ export declare function ContentBlocks(props: Props): JSX.Element | null;
39
39
  export {};