eddev 0.2.0-beta.7 → 0.2.1
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.
- package/build/build-favicon.d.ts +1 -0
- package/build/build-favicon.js +71 -0
- package/build/create-serverless-dev-worker.d.ts +3 -0
- package/build/create-serverless-dev-worker.js +99 -0
- package/build/get-webpack-config.js +26 -11
- package/build/manifests/manifest-views.js +1 -1
- package/build/reporter.js +0 -109
- package/build/serverless/create-next-app.d.ts +2 -0
- package/build/serverless/create-next-app.js +314 -68
- package/build/state/serverless-state.d.ts +26 -0
- package/build/state/serverless-state.js +2 -0
- package/build/workers/codegen-worker-script.js +33 -0
- package/build/workers/serverless-worker-dev-script.d.ts +1 -0
- package/build/workers/serverless-worker-dev-script.js +21 -0
- package/cli/build.dev.js +38 -7
- package/cli/build.prod.js +13 -1
- package/cli/cli.js +32 -17
- package/cli/display/components/DevCLIDisplay.d.ts +3 -0
- package/cli/display/components/DevCLIDisplay.js +20 -1
- package/cli/display/components/ServerlessDisplay.d.ts +9 -0
- package/cli/display/components/ServerlessDisplay.js +68 -0
- package/cli/preinstall.d.ts +1 -0
- package/cli/preinstall.js +14 -0
- package/components/NextRouter.js +3 -2
- package/config/config-schema.d.ts +55 -0
- package/config/config-schema.js +19 -0
- package/config/create-schema-file.d.ts +1 -0
- package/config/create-schema-file.js +20 -0
- package/config/get-config.d.ts +39 -0
- package/config/get-config.js +32 -0
- package/config/index.d.ts +2 -0
- package/config/index.js +14 -0
- package/config/parse-config.d.ts +25 -0
- package/config/parse-config.js +8 -0
- package/config/print-zod-errors.d.ts +2 -0
- package/config/print-zod-errors.js +14 -0
- package/dev-ui/components/BreakpointColumnHeader.d.ts +11 -0
- package/dev-ui/components/BreakpointColumnHeader.js +47 -0
- package/dev-ui/components/BreakpointIndicator.d.ts +2 -0
- package/dev-ui/components/BreakpointIndicator.js +138 -0
- package/dev-ui/components/DevUI.d.ts +2 -0
- package/dev-ui/components/DevUI.js +28 -0
- package/dev-ui/components/Launcher.d.ts +98 -0
- package/dev-ui/components/Launcher.js +94 -0
- package/dev-ui/components/PanelWrapper.d.ts +8 -0
- package/dev-ui/components/PanelWrapper.js +37 -0
- package/dev-ui/components/ResponsiveLerpControl.d.ts +8 -0
- package/dev-ui/components/ResponsiveLerpControl.js +177 -0
- package/dev-ui/components/ResponsiveScaleEditor.d.ts +26 -0
- package/dev-ui/components/ResponsiveScaleEditor.js +233 -0
- package/dev-ui/components/atoms/Button.d.ts +47 -0
- package/dev-ui/components/atoms/Button.js +67 -0
- package/dev-ui/components/atoms/Dropdown.d.ts +13 -0
- package/dev-ui/components/atoms/Dropdown.js +50 -0
- package/dev-ui/components/atoms/NumberField.d.ts +12 -0
- package/dev-ui/components/atoms/NumberField.js +111 -0
- package/dev-ui/components/atoms/Spacer.d.ts +42 -0
- package/dev-ui/components/atoms/Spacer.js +8 -0
- package/dev-ui/components/atoms/Text.d.ts +45 -0
- package/dev-ui/components/atoms/Text.js +39 -0
- package/dev-ui/components/atoms/ToggleButton.d.ts +8 -0
- package/dev-ui/components/atoms/ToggleButton.js +41 -0
- package/dev-ui/components/atoms/Tooltip.d.ts +9 -0
- package/dev-ui/components/atoms/Tooltip.js +66 -0
- package/dev-ui/components/panels/PageDataDebugger.d.ts +2 -0
- package/dev-ui/components/panels/PageDataDebugger.js +30 -0
- package/dev-ui/components/panels/SpacingEditor.d.ts +2 -0
- package/dev-ui/components/panels/SpacingEditor.js +88 -0
- package/dev-ui/components/panels/TypographyEditor.d.ts +2 -0
- package/dev-ui/components/panels/TypographyEditor.js +88 -0
- package/dev-ui/hooks/useBreakpoint.d.ts +11 -0
- package/dev-ui/hooks/useBreakpoint.js +59 -0
- package/dev-ui/hooks/usePersistState.d.ts +1 -0
- package/dev-ui/hooks/usePersistState.js +36 -0
- package/dev-ui/hooks/useStylesheet.d.ts +4 -0
- package/dev-ui/hooks/useStylesheet.js +31 -0
- package/dev-ui/icons.d.ts +15 -0
- package/dev-ui/icons.js +29 -0
- package/dev-ui/index.d.ts +1 -0
- package/dev-ui/index.js +13 -0
- package/dev-ui/loader.d.ts +2 -0
- package/dev-ui/loader.js +42 -0
- package/dev-ui/panels.d.ts +11 -0
- package/dev-ui/panels.js +33 -0
- package/dev-ui/theme.d.ts +151 -0
- package/dev-ui/theme.js +50 -0
- package/entry/Root.d.ts +3 -1
- package/entry/Root.js +18 -6
- package/hooks/index.d.ts +1 -0
- package/hooks/index.js +1 -0
- package/hooks/useAppData.js +0 -1
- package/hooks/useRPC.d.ts +32 -0
- package/hooks/useRPC.js +18 -0
- package/package.json +19 -8
- package/routing/routing.js +1 -1
- package/serverless/define-api.d.ts +2 -0
- package/serverless/define-api.js +66 -0
- package/serverless/define-rpc-router.d.ts +6 -0
- package/serverless/define-rpc-router.js +35 -0
- package/serverless/error-codes.d.ts +2 -0
- package/serverless/error-codes.js +14 -0
- package/serverless/index.d.ts +5 -0
- package/serverless/index.js +18 -0
- package/serverless/rpc-provider.d.ts +1 -0
- package/serverless/rpc-provider.js +5 -0
- package/serverless-template/_utils/PageMeta.tsx +44 -0
- package/serverless-template/_utils/ed-config.ts +5 -0
- package/serverless-template/_utils/fetch-wordpress-props.ts +40 -7
- package/serverless-template/_utils/fetch-wp.ts +16 -0
- package/serverless-template/global.d.ts +7 -1
- package/serverless-template/next.config.js +73 -53
- package/serverless-template/package.json +5 -3
- package/serverless-template/pages/404.tsx +12 -0
- package/serverless-template/pages/[...slug].tsx +7 -2
- package/serverless-template/pages/_app.tsx +32 -12
- package/serverless-template/pages/_document.tsx +19 -0
- package/serverless-template/pages/api/rest/{[...method].ts → [method].ts} +4 -2
- package/serverless-template/pages/api/trpc/[...trpc].ts +26 -0
- package/serverless-template/pages/index.tsx +2 -2
- package/style/createStitches.d.ts +71 -1
- package/style/createStitches.js +151 -45
- package/utils/getRepoName.d.ts +2 -2
- package/utils/getRepoName.js +14 -52
- package/utils/updateEnvFile.d.ts +1 -0
- package/utils/updateEnvFile.js +76 -0
- package/cli/prepare-next.d.ts +0 -0
- package/cli/prepare-next.js +0 -1
- package/entry/entry.serverless.dev.d.ts +0 -0
- package/entry/entry.serverless.dev.js +0 -2
- package/fields/ImageWell.d.ts +0 -8
- package/fields/ImageWell.js +0 -64
- package/serverless-template/package-lock.json +0 -641
- package/serverless-template/pages/api/hello.ts +0 -10
package/style/createStitches.js
CHANGED
|
@@ -11,7 +11,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.createStitches = void 0;
|
|
14
|
+
exports.createStitches = exports.parseResponsiveTokens = exports.getResponsiveObjectStyles = exports.parseResponsiveObject = exports.parseBreakpoints = void 0;
|
|
15
15
|
var react_1 = require("@stitches/react");
|
|
16
16
|
var typeKeyMap = {
|
|
17
17
|
fontSize: "fontSizes",
|
|
@@ -20,12 +20,14 @@ var typeKeyMap = {
|
|
|
20
20
|
letterSpacing: "letterSpacings",
|
|
21
21
|
fontWeight: "fontWeights",
|
|
22
22
|
};
|
|
23
|
-
function parseBreakpoints(medias) {
|
|
23
|
+
function parseBreakpoints(names, medias) {
|
|
24
24
|
var breakpoints = [];
|
|
25
25
|
// Add an initial breakpoint
|
|
26
26
|
breakpoints.push({ key: "initial", min: "0px", max: null });
|
|
27
27
|
// Parse each breakpoint
|
|
28
28
|
for (var key in medias) {
|
|
29
|
+
if (!names.includes(key))
|
|
30
|
+
continue;
|
|
29
31
|
var media = medias[key];
|
|
30
32
|
var minMatch = media.match(/min-width: ([0-9]+[a-z]+)/);
|
|
31
33
|
var maxMatch = media.match(/max-width: ([0-9]+[a-z]+)/);
|
|
@@ -51,6 +53,7 @@ function parseBreakpoints(medias) {
|
|
|
51
53
|
}
|
|
52
54
|
return breakpoints;
|
|
53
55
|
}
|
|
56
|
+
exports.parseBreakpoints = parseBreakpoints;
|
|
54
57
|
var unitless = function (value) { return parseFloat(value); };
|
|
55
58
|
function parseTypography(theme, breakpoints, typography) {
|
|
56
59
|
var globals = {};
|
|
@@ -143,55 +146,157 @@ function parseGrid(theme, media, grid) {
|
|
|
143
146
|
"--grid-margin": breakpoint.margin,
|
|
144
147
|
"--grid-col-width": "calc((var(--grid-inner-width) - (".concat(grid.columns - 1, " * var(--grid-gutter))) / ").concat(grid.columns, ")"),
|
|
145
148
|
};
|
|
146
|
-
// for (let i = 1; i < grid.columns; i++) {
|
|
147
|
-
// globalGrid[bpName][
|
|
148
|
-
// `--grid-${i}-cols`
|
|
149
|
-
// ] = `calc(var(--grid-col-width) * ${i} + var(--grid-gutter) * ${i - 1})`
|
|
150
|
-
// }
|
|
151
149
|
}
|
|
152
150
|
return { gridVariants: {}, globalGrid: globalGrid };
|
|
153
151
|
}
|
|
154
|
-
function
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
return
|
|
152
|
+
function parseResponsiveValue(val) {
|
|
153
|
+
if (Array.isArray(val)) {
|
|
154
|
+
return __assign(__assign({}, parseResponsiveValue(val[0])), { lerpStart: true });
|
|
155
|
+
}
|
|
156
|
+
else if (typeof val === "string") {
|
|
157
|
+
if (val.match(/^x[0-9\.]+$/)) {
|
|
158
|
+
return {
|
|
159
|
+
lerpStart: false,
|
|
160
|
+
type: "multiplier",
|
|
161
|
+
value: parseFloat(val.replace(/^x/, "")),
|
|
162
|
+
};
|
|
161
163
|
}
|
|
162
|
-
else if (
|
|
163
|
-
return
|
|
164
|
+
else if (val.match(/^[0-9\.]+%$/)) {
|
|
165
|
+
return {
|
|
166
|
+
lerpStart: false,
|
|
167
|
+
type: "percent",
|
|
168
|
+
value: parseFloat(val.replace(/^x/, "")),
|
|
169
|
+
};
|
|
164
170
|
}
|
|
165
|
-
else {
|
|
166
|
-
return
|
|
171
|
+
else if (val.match(/^[0-9\.]+px$/)) {
|
|
172
|
+
return {
|
|
173
|
+
lerpStart: false,
|
|
174
|
+
type: "px",
|
|
175
|
+
value: parseFloat(val.replace(/px$/, "")),
|
|
176
|
+
};
|
|
167
177
|
}
|
|
178
|
+
}
|
|
179
|
+
else if (typeof val === "number") {
|
|
180
|
+
return {
|
|
181
|
+
lerpStart: false,
|
|
182
|
+
type: "number",
|
|
183
|
+
value: val,
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
else if (val === undefined || val === null) {
|
|
187
|
+
return {
|
|
188
|
+
lerpStart: false,
|
|
189
|
+
type: "undefined",
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
return {
|
|
193
|
+
lerpStart: false,
|
|
194
|
+
type: "unknown",
|
|
195
|
+
value: val,
|
|
168
196
|
};
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
var
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
197
|
+
}
|
|
198
|
+
function parseResponsiveObject(breakpoints, object) {
|
|
199
|
+
// Breakpoint hash
|
|
200
|
+
var breakpointHash = {};
|
|
201
|
+
for (var _i = 0, breakpoints_1 = breakpoints; _i < breakpoints_1.length; _i++) {
|
|
202
|
+
var bp = breakpoints_1[_i];
|
|
203
|
+
breakpointHash[bp.key] = {
|
|
204
|
+
min: bp.min ? parseFloat(bp.min) : null,
|
|
205
|
+
max: bp.max ? parseFloat(bp.max) : null,
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
var result = [];
|
|
209
|
+
var lerpStart = "initial";
|
|
210
|
+
var lastDefined = "initial";
|
|
211
|
+
var concreteValues = {};
|
|
212
|
+
for (var _a = 0, breakpoints_2 = breakpoints; _a < breakpoints_2.length; _a++) {
|
|
213
|
+
var bp = breakpoints_2[_a];
|
|
214
|
+
var value = parseResponsiveValue(object["@" + bp.key]);
|
|
215
|
+
var defined = value.type !== "undefined";
|
|
216
|
+
var base = !defined || value.type === "multiplier" ? lastDefined : bp.key;
|
|
217
|
+
lerpStart = value.lerpStart ? bp.key : lerpStart && !defined ? lerpStart : null;
|
|
218
|
+
if (value.type === "px" || value.type === "number") {
|
|
219
|
+
concreteValues[bp.key] = value.value;
|
|
220
|
+
}
|
|
221
|
+
else if (value.type === "multiplier") {
|
|
222
|
+
concreteValues[bp.key] = value.value * concreteValues[base];
|
|
223
|
+
}
|
|
224
|
+
else if (value.type === "percent") {
|
|
225
|
+
concreteValues[bp.key] = value.value;
|
|
226
|
+
}
|
|
227
|
+
result.push(__assign(__assign({}, value), { defined: defined, breakpoint: bp.key, lastBreakpoint: lastDefined, baseBreakpoint: base, lerping: lerpStart
|
|
228
|
+
? {
|
|
229
|
+
fromBP: lerpStart,
|
|
230
|
+
toBP: null,
|
|
231
|
+
minMedia: 0,
|
|
232
|
+
maxMedia: 0,
|
|
233
|
+
minValue: 0,
|
|
234
|
+
maxValue: 0,
|
|
235
|
+
}
|
|
236
|
+
: undefined, concreteValue: concreteValues[bp.key] }));
|
|
237
|
+
if (defined) {
|
|
238
|
+
lastDefined = bp.key;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
var nextBreakpoints = [];
|
|
242
|
+
var lastBreakpoint = null;
|
|
243
|
+
for (var i = breakpoints.length - 1; i >= 0; i--) {
|
|
244
|
+
var bp = breakpoints[i];
|
|
245
|
+
nextBreakpoints[i] = lastBreakpoint;
|
|
246
|
+
if (result[i].defined) {
|
|
247
|
+
lastBreakpoint = bp.key;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
result.forEach(function (item, i) {
|
|
251
|
+
if (item.lerping) {
|
|
252
|
+
item.lerping.toBP = nextBreakpoints[i];
|
|
253
|
+
}
|
|
192
254
|
});
|
|
193
|
-
|
|
255
|
+
result.forEach(function (item, i) {
|
|
256
|
+
var lerp = item.lerping;
|
|
257
|
+
if (lerp) {
|
|
258
|
+
var fromBP = lerp.fromBP ? breakpointHash[lerp.fromBP] : null;
|
|
259
|
+
var toBP = lerp.toBP ? breakpointHash[lerp.toBP] : null;
|
|
260
|
+
if (!fromBP || fromBP.min === null) {
|
|
261
|
+
throw new Error("Cannot create responsive style for first breakpoint");
|
|
262
|
+
}
|
|
263
|
+
if (!toBP || toBP.min === null) {
|
|
264
|
+
throw new Error("Cannot create responsive style for last breakpoint");
|
|
265
|
+
}
|
|
266
|
+
lerp.minMedia = fromBP.min;
|
|
267
|
+
lerp.maxMedia = toBP.min;
|
|
268
|
+
lerp.minValue = item.concreteValue;
|
|
269
|
+
lerp.maxValue = result.find(function (o) { return o.breakpoint === lerp.toBP; }).concreteValue;
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
return result;
|
|
273
|
+
}
|
|
274
|
+
exports.parseResponsiveObject = parseResponsiveObject;
|
|
275
|
+
function getResponsiveObjectStyles(breakpoints, object, varName, unit) {
|
|
276
|
+
var _a, _b;
|
|
277
|
+
var _c;
|
|
278
|
+
if (unit === void 0) { unit = "px"; }
|
|
279
|
+
// Prescale object
|
|
280
|
+
object = __assign({}, object);
|
|
281
|
+
var parsed = parseResponsiveObject(breakpoints, object);
|
|
282
|
+
var globals = {};
|
|
283
|
+
for (var _i = 0, parsed_1 = parsed; _i < parsed_1.length; _i++) {
|
|
284
|
+
var atom = parsed_1[_i];
|
|
285
|
+
if (atom.lerpStart && atom.lerping) {
|
|
286
|
+
var lerp = atom.lerping;
|
|
287
|
+
globals["@" + atom.breakpoint] = (_a = {},
|
|
288
|
+
_a[varName] = "calc(".concat(lerp.minValue).concat(unit, " + (100vw - ").concat(lerp.minMedia).concat(unit, ") / (").concat(lerp.maxMedia, " - ").concat(lerp.minMedia, ") * (").concat(lerp.maxValue, " - ").concat(lerp.minValue, "))"),
|
|
289
|
+
_a);
|
|
290
|
+
}
|
|
291
|
+
else if (atom.concreteValue) {
|
|
292
|
+
globals["@" + atom.breakpoint] = (_b = {},
|
|
293
|
+
_b[varName] = atom.concreteValue + unit,
|
|
294
|
+
_b);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
return [globals, (_c = globals["@initial"]) === null || _c === void 0 ? void 0 : _c[varName]];
|
|
194
298
|
}
|
|
299
|
+
exports.getResponsiveObjectStyles = getResponsiveObjectStyles;
|
|
195
300
|
// parseResponsiveTokens({'@initial': blah, '@desktop': blah}, breakpoints, )
|
|
196
301
|
function parseResponsiveTokens(theme, breakpoints) {
|
|
197
302
|
var globalResponsive = {
|
|
@@ -204,7 +309,7 @@ function parseResponsiveTokens(theme, breakpoints) {
|
|
|
204
309
|
for (var key in theme[scale]) {
|
|
205
310
|
var val = theme[scale][key];
|
|
206
311
|
if (val && typeof val === "object") {
|
|
207
|
-
var _a =
|
|
312
|
+
var _a = getResponsiveObjectStyles(breakpoints, val, "--" + scale + "-" + key), tokenGlobals = _a[0], initial = _a[1];
|
|
208
313
|
for (var bp in tokenGlobals) {
|
|
209
314
|
globalResponsive[bp] = __assign(__assign({}, globalResponsive[bp]), tokenGlobals[bp]);
|
|
210
315
|
}
|
|
@@ -217,8 +322,9 @@ function parseResponsiveTokens(theme, breakpoints) {
|
|
|
217
322
|
}
|
|
218
323
|
return { initialResponsive: initialResponsive, globalResponsive: globalResponsive };
|
|
219
324
|
}
|
|
325
|
+
exports.parseResponsiveTokens = parseResponsiveTokens;
|
|
220
326
|
function createStitches(config) {
|
|
221
|
-
var breakpoints = parseBreakpoints(config.media);
|
|
327
|
+
var breakpoints = parseBreakpoints(config.breakpoints, config.media);
|
|
222
328
|
var _a = parseTypography(config.theme, breakpoints, config.typography), typeVariants = _a.typeVariants, globalTypography = _a.globalTypography;
|
|
223
329
|
var _b = parseGrid(config.theme, config.media, config.grid), gridVariants = _b.gridVariants, globalGrid = _b.globalGrid;
|
|
224
330
|
var _c = parseResponsiveTokens(config.responsive, breakpoints), initialResponsive = _c.initialResponsive, globalResponsive = _c.globalResponsive;
|
|
@@ -309,6 +415,6 @@ function createStitches(config) {
|
|
|
309
415
|
});
|
|
310
416
|
stitches.globalCss(responsiveGlobals)();
|
|
311
417
|
var responsiveTokens = {};
|
|
312
|
-
return __assign(__assign({}, stitches), { typeVariants: typeVariants, gridVariants: gridVariants, responsiveTokens: responsiveTokens });
|
|
418
|
+
return __assign(__assign({}, stitches), { originalConfig: config, breakpoints: breakpoints, typeVariants: typeVariants, gridVariants: gridVariants, responsiveTokens: responsiveTokens, responsiveGlobals: responsiveGlobals });
|
|
313
419
|
}
|
|
314
420
|
exports.createStitches = createStitches;
|
package/utils/getRepoName.d.ts
CHANGED
package/utils/getRepoName.js
CHANGED
|
@@ -1,62 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
18
|
-
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;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
4
|
};
|
|
41
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
6
|
exports.getRepoName = void 0;
|
|
43
|
-
var
|
|
7
|
+
var git_repo_name_1 = __importDefault(require("git-repo-name"));
|
|
44
8
|
var path_1 = __importDefault(require("path"));
|
|
45
9
|
function getRepoName(dir) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
});
|
|
60
|
-
});
|
|
10
|
+
if (process.env.VERCEL) {
|
|
11
|
+
return {
|
|
12
|
+
repoName: process.env.VERCEL_GIT_REPO_SLUG,
|
|
13
|
+
themeName: process.env.VERCEL_GIT_REPO_SLUG,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
var info = git_repo_name_1.default.sync(dir);
|
|
18
|
+
return {
|
|
19
|
+
repoName: info || "",
|
|
20
|
+
themeName: path_1.default.basename(dir),
|
|
21
|
+
};
|
|
22
|
+
}
|
|
61
23
|
}
|
|
62
24
|
exports.getRepoName = getRepoName;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function updateEnvFile(data: Record<string, string | number>, directory?: string): Promise<void>;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
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;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.updateEnvFile = void 0;
|
|
40
|
+
var fs_1 = require("fs");
|
|
41
|
+
var promises_1 = require("fs/promises");
|
|
42
|
+
var path_1 = require("path");
|
|
43
|
+
function updateEnvFile(data, directory) {
|
|
44
|
+
if (directory === void 0) { directory = process.cwd(); }
|
|
45
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
46
|
+
var path, contents, lines, key;
|
|
47
|
+
return __generator(this, function (_a) {
|
|
48
|
+
switch (_a.label) {
|
|
49
|
+
case 0:
|
|
50
|
+
path = (0, path_1.join)(directory, ".env");
|
|
51
|
+
if (!(0, fs_1.existsSync)(path)) return [3 /*break*/, 3];
|
|
52
|
+
return [4 /*yield*/, (0, promises_1.readFile)(path, "utf8")];
|
|
53
|
+
case 1:
|
|
54
|
+
contents = (_a.sent()).toString();
|
|
55
|
+
lines = contents.split(/\n/g);
|
|
56
|
+
lines = lines.filter(function (line) {
|
|
57
|
+
for (var key in data) {
|
|
58
|
+
if (line.startsWith("".concat(key, "="))) {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return true;
|
|
63
|
+
});
|
|
64
|
+
for (key in data) {
|
|
65
|
+
lines.push("".concat(key, "=").concat(data[key]));
|
|
66
|
+
}
|
|
67
|
+
return [4 /*yield*/, (0, promises_1.writeFile)(path, lines.join("\n"))];
|
|
68
|
+
case 2:
|
|
69
|
+
_a.sent();
|
|
70
|
+
_a.label = 3;
|
|
71
|
+
case 3: return [2 /*return*/];
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
exports.updateEnvFile = updateEnvFile;
|
package/cli/prepare-next.d.ts
DELETED
|
File without changes
|
package/cli/prepare-next.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
File without changes
|
package/fields/ImageWell.d.ts
DELETED
package/fields/ImageWell.js
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ImageWell = void 0;
|
|
4
|
-
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
var react_1 = require("@stitches/react");
|
|
6
|
-
var react_2 = require("react");
|
|
7
|
-
function ImageWell(props) {
|
|
8
|
-
var _a = (0, react_2.useState)(null), selectedImage = _a[0], setSelectedImage = _a[1];
|
|
9
|
-
var _b = (0, react_2.useState)(false), imageIsLoading = _b[0], setImageIsLoading = _b[1];
|
|
10
|
-
(0, react_2.useEffect)(function () {
|
|
11
|
-
if (props.value) {
|
|
12
|
-
var cancelled = false;
|
|
13
|
-
setImageIsLoading(true);
|
|
14
|
-
fetch("/wp-json/ed/v1/media/" + Number(props.value))
|
|
15
|
-
.then(function (response) { return response.json(); })
|
|
16
|
-
.then(function (image) {
|
|
17
|
-
setImageIsLoading(false);
|
|
18
|
-
setSelectedImage(image);
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
}, [props.value]);
|
|
22
|
-
return ((0, jsx_runtime_1.jsxs)(Wrapper, { children: [imageIsLoading ? ((0, jsx_runtime_1.jsx)(Loading, { children: (0, jsx_runtime_1.jsx)(Spinner, {}, void 0) }, void 0)) : selectedImage ? ((0, jsx_runtime_1.jsx)(ImageContainer, { children: (0, jsx_runtime_1.jsx)("img", { src: selectedImage.sizes[props.previewSize] || selectedImage.sizes["thumbnail"] }, void 0) }, void 0)) : null, (0, jsx_runtime_1.jsx)(Toolbar, { children: selectedImage || imageIsLoading ? ((0, jsx_runtime_1.jsxs)(react_2.Fragment, { children: [(0, jsx_runtime_1.jsx)(Button, { children: "Remove" }, void 0), (0, jsx_runtime_1.jsx)(Button, { children: "Edit" }, void 0), (0, jsx_runtime_1.jsx)(Button, { children: "View" }, void 0)] }, void 0)) : null }, void 0)] }, void 0));
|
|
23
|
-
}
|
|
24
|
-
exports.ImageWell = ImageWell;
|
|
25
|
-
var Wrapper = (0, react_1.styled)("div", {
|
|
26
|
-
position: "relative",
|
|
27
|
-
display: "block",
|
|
28
|
-
width: "100%",
|
|
29
|
-
border: "1px solid #aaaaaa",
|
|
30
|
-
});
|
|
31
|
-
var ImageContainer = (0, react_1.styled)("div", {
|
|
32
|
-
padding: "4px",
|
|
33
|
-
img: {
|
|
34
|
-
maxWidth: "100%",
|
|
35
|
-
},
|
|
36
|
-
});
|
|
37
|
-
var spin = (0, react_1.keyframes)({
|
|
38
|
-
from: {
|
|
39
|
-
transform: "rotate(0deg)",
|
|
40
|
-
},
|
|
41
|
-
to: {
|
|
42
|
-
transform: "rotate(360deg)",
|
|
43
|
-
},
|
|
44
|
-
});
|
|
45
|
-
var Spinner = (0, react_1.styled)("div", {
|
|
46
|
-
display: "block",
|
|
47
|
-
width: "32px",
|
|
48
|
-
height: "32px",
|
|
49
|
-
border: "4px solid transparent",
|
|
50
|
-
borderTop: "currentColor",
|
|
51
|
-
animation: "".concat(spin, " 1s linear infinite"),
|
|
52
|
-
});
|
|
53
|
-
var Loading = (0, react_1.styled)("div", {
|
|
54
|
-
display: "flex",
|
|
55
|
-
justifyContent: "center",
|
|
56
|
-
alignItems: "center",
|
|
57
|
-
padding: "8px",
|
|
58
|
-
});
|
|
59
|
-
var Toolbar = (0, react_1.styled)("div", {
|
|
60
|
-
position: "absolute",
|
|
61
|
-
top: 0,
|
|
62
|
-
right: 0,
|
|
63
|
-
padding: "4px",
|
|
64
|
-
});
|