eddev 0.2.65 → 0.2.67-beta1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/admin/components/ImageWell.d.ts +2 -3
- package/admin/components/ImageWell.js +39 -51
- package/admin/defineField.d.ts +2 -2
- package/admin/defineWidget.d.ts +1 -1
- package/admin/defineWidget.js +2 -2
- package/admin/index.js +5 -1
- package/admin/installFieldTypes.js +26 -26
- package/admin/runWidgets.js +17 -28
- package/admin/selectMedia.d.ts +2 -2
- package/admin/selectMedia.js +1 -1
- package/blocks/ContentBlocks.d.ts +6 -6
- package/blocks/ContentBlocks.js +58 -66
- package/blocks/ErrorBoundaryEditor.d.ts +1 -1
- package/blocks/ErrorBoundaryEditor.js +16 -45
- package/blocks/ErrorBoundaryFrontend.d.ts +1 -1
- package/blocks/ErrorBoundaryFrontend.js +16 -45
- package/blocks/InspectorControls.d.ts +1 -1
- package/blocks/InspectorControls.js +3 -3
- package/blocks/blockAttributes.d.ts +2 -2
- package/blocks/blockAttributes.js +24 -44
- package/blocks/index.js +5 -1
- package/blocks/inlineEditing.d.ts +7 -7
- package/blocks/inlineEditing.js +36 -55
- package/blocks/installGutenbergHooks.js +48 -68
- package/build/babel/plugin-name-defined-components.js +15 -16
- package/build/build-favicon.js +11 -62
- package/build/clean.js +5 -52
- package/build/create-codegen-worker.js +78 -33
- package/build/create-serverless-dev-worker.js +61 -39
- package/build/create-webpack-worker.js +65 -33
- package/build/file-tree.d.ts +2 -2
- package/build/file-tree.js +12 -12
- package/build/get-webpack-config.js +341 -395
- package/build/graphql-codegen/graphql-codegen-files.js +31 -25
- package/build/graphql-codegen/graphql-codegen-no-duplicates.js +4 -4
- package/build/graphql-codegen/graphql-codegen-queries.js +102 -99
- package/build/manifests/manifest-blocks.d.ts +1 -1
- package/build/manifests/manifest-blocks.js +37 -29
- package/build/manifests/manifest-fields.d.ts +1 -1
- package/build/manifests/manifest-fields.js +23 -21
- package/build/manifests/manifest-views.d.ts +1 -1
- package/build/manifests/manifest-views.js +32 -25
- package/build/manifests/manifest-widgets.d.ts +1 -1
- package/build/manifests/manifest-widgets.js +22 -20
- package/build/manifests/manifest.d.ts +2 -2
- package/build/manifests/manifest.js +30 -90
- package/build/reporter.d.ts +1 -1
- package/build/reporter.js +29 -32
- package/build/serverless/create-next-app.d.ts +1 -1
- package/build/serverless/create-next-app.js +245 -467
- package/build/state/codegen-state.d.ts +4 -4
- package/build/state/compiler-state.d.ts +5 -5
- package/build/state/serverless-state.d.ts +3 -3
- package/build/workers/codegen-worker-script.js +392 -507
- package/build/workers/serverless-worker-dev-script.js +4 -4
- package/build/workers/webpack-worker-script.js +89 -150
- package/cli/build.dev.d.ts +1 -1
- package/cli/build.dev.js +79 -126
- package/cli/build.prod.d.ts +1 -1
- package/cli/build.prod.js +42 -98
- package/cli/cli.js +16 -55
- package/cli/display/components/BundleDisplay.d.ts +1 -2
- package/cli/display/components/BundleDisplay.js +13 -24
- package/cli/display/components/CodegenDisplay.d.ts +1 -2
- package/cli/display/components/CodegenDisplay.js +14 -25
- package/cli/display/components/DevCLIDisplay.d.ts +2 -3
- package/cli/display/components/DevCLIDisplay.js +14 -25
- package/cli/display/components/Fullscreen.js +9 -20
- package/cli/display/components/ServerlessDisplay.d.ts +2 -3
- package/cli/display/components/ServerlessDisplay.js +15 -26
- package/cli/display/components/StatusIcon.d.ts +2 -3
- package/cli/display/components/StatusIcon.js +3 -3
- package/cli/preinstall.js +4 -5
- package/cli/setup.js +25 -73
- package/components/AdminBar.d.ts +1 -2
- package/components/AdminBar.js +37 -3
- package/components/BrowserRouter.d.ts +2 -2
- package/components/BrowserRouter.js +41 -54
- package/components/InlinePage.d.ts +2 -2
- package/components/InlinePage.js +17 -29
- package/components/NextRouter.d.ts +2 -2
- package/components/NextRouter.js +20 -29
- package/components/index.js +5 -1
- package/config/config-schema.d.ts +1 -1
- package/config/config-schema.js +1 -1
- package/config/create-schema-file.js +6 -6
- package/config/get-config.js +10 -13
- package/config/index.js +5 -1
- package/config/parse-config.js +1 -1
- package/config/print-zod-errors.js +3 -3
- package/dev-ui/components/BreakpointColumnHeader.d.ts +2 -3
- package/dev-ui/components/BreakpointColumnHeader.js +7 -18
- package/dev-ui/components/BreakpointIndicator.d.ts +1 -2
- package/dev-ui/components/BreakpointIndicator.js +25 -32
- package/dev-ui/components/DevUI.d.ts +1 -2
- package/dev-ui/components/DevUI.js +13 -13
- package/dev-ui/components/Launcher.d.ts +2 -2
- package/dev-ui/components/Launcher.js +13 -25
- package/dev-ui/components/PanelWrapper.d.ts +2 -2
- package/dev-ui/components/PanelWrapper.js +8 -8
- package/dev-ui/components/ResponsiveLerpControl.d.ts +2 -3
- package/dev-ui/components/ResponsiveLerpControl.js +27 -38
- package/dev-ui/components/ResponsiveScaleEditor.d.ts +4 -5
- package/dev-ui/components/ResponsiveScaleEditor.js +64 -78
- package/dev-ui/components/atoms/Button.js +1 -1
- package/dev-ui/components/atoms/Dropdown.d.ts +3 -3
- package/dev-ui/components/atoms/Dropdown.js +8 -9
- package/dev-ui/components/atoms/NumberField.d.ts +2 -3
- package/dev-ui/components/atoms/NumberField.js +29 -42
- package/dev-ui/components/atoms/Spacer.js +1 -1
- package/dev-ui/components/atoms/Text.js +1 -1
- package/dev-ui/components/atoms/ToggleButton.d.ts +2 -2
- package/dev-ui/components/atoms/ToggleButton.js +5 -16
- package/dev-ui/components/atoms/Tooltip.d.ts +2 -2
- package/dev-ui/components/atoms/Tooltip.js +8 -20
- package/dev-ui/components/panels/AppDataDebugger.d.ts +1 -2
- package/dev-ui/components/panels/AppDataDebugger.js +8 -19
- package/dev-ui/components/panels/ColorEditor.d.ts +1 -2
- package/dev-ui/components/panels/ColorEditor.js +35 -42
- package/dev-ui/components/panels/PageDataDebugger.d.ts +1 -2
- package/dev-ui/components/panels/PageDataDebugger.js +8 -20
- package/dev-ui/components/panels/QueryDebugger.d.ts +1 -2
- package/dev-ui/components/panels/QueryDebugger.js +12 -24
- package/dev-ui/components/panels/SpacingEditor.d.ts +1 -2
- package/dev-ui/components/panels/SpacingEditor.js +34 -48
- package/dev-ui/components/panels/TypographyEditor.d.ts +1 -2
- package/dev-ui/components/panels/TypographyEditor.js +38 -46
- package/dev-ui/hooks/useBreakpoint.d.ts +1 -1
- package/dev-ui/hooks/useBreakpoint.js +13 -13
- package/dev-ui/hooks/usePersistState.js +6 -7
- package/dev-ui/hooks/useStylesheet.js +6 -6
- package/dev-ui/icons.d.ts +15 -16
- package/dev-ui/icons.js +16 -27
- package/dev-ui/index.js +5 -1
- package/dev-ui/loader.d.ts +1 -2
- package/dev-ui/loader.js +13 -9
- package/dev-ui/panels.d.ts +2 -2
- package/dev-ui/panels.js +7 -7
- package/dev-ui/theme.d.ts +96 -70
- package/dev-ui/theme.js +3 -3
- package/dynamic/dynamic-component.d.ts +1 -10
- package/dynamic/dynamic-component.js +1 -1
- package/dynamic/index.js +5 -1
- package/entry/Root.d.ts +2 -3
- package/entry/Root.js +16 -26
- package/entry/entry.admin.dev.js +4 -4
- package/entry/entry.admin.prod.js +4 -4
- package/entry/entry.monolith.dev.js +5 -5
- package/entry/entry.monolith.prod.js +5 -5
- package/gravityforms/gravity-forms.d.ts +2 -2
- package/gravityforms/index.js +5 -1
- package/gravityforms/useGravityForm.d.ts +2 -2
- package/gravityforms/useGravityForm.js +126 -130
- package/hooks/index.js +5 -1
- package/hooks/queryUtils.d.ts +14 -14
- package/hooks/queryUtils.js +101 -192
- package/hooks/useAppData.d.ts +2 -2
- package/hooks/useAppData.js +9 -9
- package/hooks/usePageLoad.js +4 -4
- package/hooks/useQueryDebug.d.ts +1 -1
- package/hooks/useQueryDebug.js +7 -7
- package/hooks/useRPC.d.ts +4 -4
- package/hooks/useRPC.js +3 -3
- package/package.json +7 -7
- package/routing/index.js +5 -1
- package/routing/remoteProps.d.ts +1 -1
- package/routing/remoteProps.js +31 -72
- package/routing/routing.d.ts +15 -15
- package/routing/routing.js +108 -170
- package/routing/updateEditLink.js +1 -1
- package/serverless/define-api.d.ts +1 -1
- package/serverless/define-rpc-router.js +8 -4
- package/serverless/index.js +6 -2
- package/serverless-template/_utils/fetch-wordpress-props.ts +0 -4
- package/serverless-template/_utils/fetch-wp.ts +0 -1
- package/style/createStitches.d.ts +375 -783
- package/style/createStitches.js +164 -142
- package/style/index.js +5 -1
- package/tsconfig.json +1 -1
- package/utils/Observable.d.ts +2 -2
- package/utils/Observable.js +12 -15
- package/utils/getRepoName.js +3 -3
- package/utils/promptIfRepoNameIncorrect.js +18 -64
- package/utils/refreshOverlayInterop.js +1 -1
- package/utils/reportErrorStack.d.ts +1 -1
- package/utils/reportErrorStack.js +1 -1
- package/utils/serverlessAppContext.js +1 -1
- package/utils/updateEnvFile.js +19 -69
- package/utils/useObservable.js +3 -3
- package/views/index.js +5 -1
|
@@ -1,23 +1,12 @@
|
|
|
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.ServerlessLog = exports.ServerlessDisplay = void 0;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const ink_1 = require("ink");
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const useObservable_1 = require("../../../utils/useObservable");
|
|
8
|
+
const StatusIcon_1 = require("./StatusIcon");
|
|
9
|
+
const statusLabels = {
|
|
21
10
|
starting: "Starting",
|
|
22
11
|
compiling: "Compiling...",
|
|
23
12
|
error: "Error! See log for details.",
|
|
@@ -27,7 +16,7 @@ var statusLabels = {
|
|
|
27
16
|
waiting: "Waiting...",
|
|
28
17
|
};
|
|
29
18
|
function StatusLabel(props) {
|
|
30
|
-
|
|
19
|
+
const color = (0, react_1.useMemo)(() => {
|
|
31
20
|
if (props.status === "packaging" ||
|
|
32
21
|
props.status === "preparing" ||
|
|
33
22
|
props.status === "waiting" ||
|
|
@@ -44,25 +33,25 @@ function StatusLabel(props) {
|
|
|
44
33
|
return "whiteBright";
|
|
45
34
|
}
|
|
46
35
|
}, [props.status]);
|
|
47
|
-
|
|
36
|
+
let label = props.statusLabel || statusLabels[props.status];
|
|
48
37
|
if (props.duration) {
|
|
49
|
-
label +=
|
|
38
|
+
label += ` (${props.duration}ms)`;
|
|
50
39
|
}
|
|
51
|
-
return ((0, jsx_runtime_1.jsxs)(ink_1.Box,
|
|
40
|
+
return ((0, jsx_runtime_1.jsxs)(ink_1.Box, { paddingX: 1, width: "100%", flexGrow: 1, flexDirection: "row", justifyContent: "space-between", children: [(0, jsx_runtime_1.jsx)(ink_1.Text, { color: color, children: label }), props.url && (0, jsx_runtime_1.jsxs)(ink_1.Text, { color: "white", children: ["\u2728 ", props.url] })] }));
|
|
52
41
|
}
|
|
53
42
|
function ServerlessDisplay(props) {
|
|
54
|
-
|
|
55
|
-
return ((0, jsx_runtime_1.jsx)(ink_1.Box,
|
|
43
|
+
const data = (0, useObservable_1.useObservable)(props.serverless);
|
|
44
|
+
return ((0, jsx_runtime_1.jsx)(ink_1.Box, { width: "100%", flexDirection: "column", children: (0, jsx_runtime_1.jsxs)(ink_1.Box, { width: "100%", paddingX: 1, borderStyle: "round", borderColor: data.status === "success" ? "green" : data.status === "error" ? "red" : "yellow", flexDirection: "row", children: [(0, jsx_runtime_1.jsx)(ink_1.Box, { width: 2, flexGrow: 0, flexShrink: 0, children: (0, jsx_runtime_1.jsx)(StatusIcon_1.StatusIcon, { icon: data.status === "success"
|
|
56
45
|
? "tick"
|
|
57
46
|
: data.status === "preparing" || data.status === "packaging" || data.status === "compiling"
|
|
58
47
|
? "loading"
|
|
59
48
|
: data.status === "error"
|
|
60
49
|
? "error"
|
|
61
|
-
: "none" }
|
|
50
|
+
: "none" }) }), (0, jsx_runtime_1.jsx)(ink_1.Box, { children: (0, jsx_runtime_1.jsxs)(ink_1.Box, { flexDirection: "row", children: [(0, jsx_runtime_1.jsx)(ink_1.Text, { bold: true, children: data.title }), (0, jsx_runtime_1.jsx)(StatusLabel, { status: data.status, statusLabel: "", duration: data.status === "success" ? data.duration : undefined, url: data.url })] }) })] }) }));
|
|
62
51
|
}
|
|
63
52
|
exports.ServerlessDisplay = ServerlessDisplay;
|
|
64
53
|
function ServerlessLog(props) {
|
|
65
|
-
|
|
66
|
-
return (0, jsx_runtime_1.jsx)(ink_1.Text, { children: log }
|
|
54
|
+
const log = (0, useObservable_1.useObservable)(props.serverless).log;
|
|
55
|
+
return (0, jsx_runtime_1.jsx)(ink_1.Text, { children: log });
|
|
67
56
|
}
|
|
68
57
|
exports.ServerlessLog = ServerlessLog;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
declare type Props = {
|
|
1
|
+
type Props = {
|
|
3
2
|
icon: "loading" | "tick" | "error" | "none";
|
|
4
3
|
};
|
|
5
|
-
export declare function StatusIcon(props: Props): JSX.Element;
|
|
4
|
+
export declare function StatusIcon(props: Props): import("react/jsx-runtime").JSX.Element;
|
|
6
5
|
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.StatusIcon = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const ink_1 = require("ink");
|
|
6
6
|
function StatusIcon(props) {
|
|
7
|
-
return ((0, jsx_runtime_1.jsx)(ink_1.Text, { children: props.icon === "tick" ? "✅" : props.icon === "error" ? "🚨" : props.icon === "loading" ? "🧠" : "💬" }
|
|
7
|
+
return ((0, jsx_runtime_1.jsx)(ink_1.Text, { children: props.icon === "tick" ? "✅" : props.icon === "error" ? "🚨" : props.icon === "loading" ? "🧠" : "💬" }));
|
|
8
8
|
}
|
|
9
9
|
exports.StatusIcon = StatusIcon;
|
package/cli/preinstall.js
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.main = void 0;
|
|
4
|
-
|
|
4
|
+
const child_process_1 = require("child_process");
|
|
5
5
|
function main() {
|
|
6
|
-
var _a, _b;
|
|
7
6
|
if (process.env.VERCEL) {
|
|
8
7
|
// const pkgFile = join(process.cwd(), "package.json")
|
|
9
8
|
// const pkg = JSON.parse(readFileSync(pkgFile).toString()) as any
|
|
10
9
|
// pkg.devDependencies["next"] = "^12.1.0"
|
|
11
10
|
// writeFile(pkgFile, JSON.stringify(pkg, null, " "), () => {})
|
|
12
|
-
|
|
11
|
+
const proc = (0, child_process_1.spawn)("yarn", ["add", "--dev", "next@^12.1.6"], {
|
|
13
12
|
cwd: process.cwd(),
|
|
14
13
|
});
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
proc.stdout?.pipe(process.stdout);
|
|
15
|
+
proc.stderr?.pipe(process.stderr);
|
|
17
16
|
}
|
|
18
17
|
}
|
|
19
18
|
exports.main = main;
|
package/cli/setup.js
CHANGED
|
@@ -1,90 +1,42 @@
|
|
|
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.setupTheme = void 0;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
function setupTheme() {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
])];
|
|
67
|
-
case 2:
|
|
68
|
-
result = _a.sent();
|
|
69
|
-
updateStyleFile(styleFileName, {
|
|
70
|
-
themeTitle: result.themeTitle,
|
|
71
|
-
});
|
|
72
|
-
updatePackageFile(packageFileName, {
|
|
73
|
-
packageName: repoName,
|
|
74
|
-
});
|
|
75
|
-
return [2 /*return*/];
|
|
76
|
-
}
|
|
77
|
-
});
|
|
7
|
+
const getRepoName_1 = require("../utils/getRepoName");
|
|
8
|
+
const inquirer_1 = __importDefault(require("inquirer"));
|
|
9
|
+
const path_1 = __importDefault(require("path"));
|
|
10
|
+
const fs_1 = __importDefault(require("fs"));
|
|
11
|
+
async function setupTheme() {
|
|
12
|
+
const { repoName } = await (0, getRepoName_1.getRepoName)(process.cwd());
|
|
13
|
+
if (!repoName) {
|
|
14
|
+
throw new Error(`This theme does is not linked to Git repo. Cannot continue with setup`);
|
|
15
|
+
}
|
|
16
|
+
const styleFileName = path_1.default.resolve(process.cwd(), "style.css");
|
|
17
|
+
const packageFileName = path_1.default.resolve(process.cwd(), "package.json");
|
|
18
|
+
const result = await inquirer_1.default.prompt([
|
|
19
|
+
{
|
|
20
|
+
type: "text",
|
|
21
|
+
name: "themeTitle",
|
|
22
|
+
message: `Enter the website or theme title`,
|
|
23
|
+
},
|
|
24
|
+
]);
|
|
25
|
+
updateStyleFile(styleFileName, {
|
|
26
|
+
themeTitle: result.themeTitle,
|
|
27
|
+
});
|
|
28
|
+
updatePackageFile(packageFileName, {
|
|
29
|
+
packageName: repoName,
|
|
78
30
|
});
|
|
79
31
|
}
|
|
80
32
|
exports.setupTheme = setupTheme;
|
|
81
33
|
function updateStyleFile(file, opts) {
|
|
82
|
-
|
|
34
|
+
let contents = fs_1.default.readFileSync(file).toString();
|
|
83
35
|
contents = contents.replace(/(Theme Name:\s*)([^\n]+)/, "$1" + opts.themeTitle);
|
|
84
36
|
fs_1.default.writeFileSync(file, contents);
|
|
85
37
|
}
|
|
86
38
|
function updatePackageFile(file, opts) {
|
|
87
|
-
|
|
39
|
+
const packageData = JSON.parse(fs_1.default.readFileSync(file).toString());
|
|
88
40
|
packageData.name = opts.packageName;
|
|
89
41
|
fs_1.default.writeFileSync(file, JSON.stringify(packageData, null, " "));
|
|
90
42
|
}
|
package/components/AdminBar.d.ts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare function AdminBar(): JSX.Element;
|
|
1
|
+
export declare function AdminBar(): import("react/jsx-runtime").JSX.Element;
|
package/components/AdminBar.js
CHANGED
|
@@ -1,9 +1,43 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AdminBar = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const STYLE = `
|
|
6
|
+
html,
|
|
7
|
+
html body,
|
|
8
|
+
* html body {
|
|
9
|
+
margin-top: 0 !important
|
|
10
|
+
}
|
|
11
|
+
html #wpadminbar{
|
|
12
|
+
opacity: 0;
|
|
13
|
+
-webkit-transition: all .3s ease;
|
|
14
|
+
transition: all .3s ease;
|
|
15
|
+
}
|
|
16
|
+
html #wpadminbar:hover{
|
|
17
|
+
opacity: 1;
|
|
18
|
+
}
|
|
19
|
+
html #wpadminbar{
|
|
20
|
+
top: -15px !important;
|
|
21
|
+
-webkit-transition-delay: 200ms;
|
|
22
|
+
transition-delay: 200ms;
|
|
23
|
+
}
|
|
24
|
+
html #wpadminbar:hover{
|
|
25
|
+
top: 0 !important
|
|
26
|
+
}
|
|
27
|
+
@media screen and (max-width: 782px){
|
|
28
|
+
html #wpadminbar{
|
|
29
|
+
top: -15px !important;
|
|
30
|
+
-webkit-transition-delay: 0;
|
|
31
|
+
transition-delay: 0;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
@media (max-width: 600px){
|
|
35
|
+
html #wpadminbar{
|
|
36
|
+
display: none !important;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
`;
|
|
6
40
|
function AdminBar() {
|
|
7
|
-
return (0, jsx_runtime_1.jsx)("style", { type: "text/css", dangerouslySetInnerHTML: { __html: STYLE } }
|
|
41
|
+
return (0, jsx_runtime_1.jsx)("style", { type: "text/css", dangerouslySetInnerHTML: { __html: STYLE } });
|
|
8
42
|
}
|
|
9
43
|
exports.AdminBar = AdminBar;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
|
-
|
|
2
|
+
type Props = {
|
|
3
3
|
children: ReactNode;
|
|
4
4
|
};
|
|
5
|
-
export declare function BrowserRouter(props: Props): JSX.Element;
|
|
5
|
+
export declare function BrowserRouter(props: Props): import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
export {};
|
|
@@ -1,47 +1,36 @@
|
|
|
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.BrowserRouter = void 0;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const react_1 = require("react");
|
|
9
|
+
const remoteProps_1 = require("../routing/remoteProps");
|
|
10
|
+
const routing_1 = require("../routing");
|
|
22
11
|
// @ts-ignore
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
12
|
+
const views_1 = __importDefault(require("@manifest/views"));
|
|
13
|
+
const usePageLoad_1 = require("../hooks/usePageLoad");
|
|
14
|
+
const hooks_1 = require("../hooks");
|
|
15
|
+
const reportErrorStack_1 = require("../utils/reportErrorStack");
|
|
16
|
+
const updateEditLink_1 = require("../routing/updateEditLink");
|
|
17
|
+
const updateHeadTags_1 = require("../routing/updateHeadTags");
|
|
18
|
+
const useQueryDebug_1 = require("../hooks/useQueryDebug");
|
|
19
|
+
let hasPopulatedCache = false;
|
|
31
20
|
function BrowserRouter(props) {
|
|
32
|
-
|
|
33
|
-
|
|
21
|
+
const setAppData = (0, hooks_1.useAppDataStore)((s) => s.setAppData);
|
|
22
|
+
const [state, setState] = (0, react_1.useState)(() => {
|
|
34
23
|
setAppData(_PAGE_DATA.appData.data);
|
|
35
24
|
(0, useQueryDebug_1.setQueryDebug)(_PAGE_DATA.queryMonitor);
|
|
36
25
|
return {
|
|
37
26
|
url: document.location.href,
|
|
38
27
|
data: _PAGE_DATA,
|
|
39
28
|
};
|
|
40
|
-
})
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
(0, react_1.useEffect)(
|
|
29
|
+
});
|
|
30
|
+
const { url, data } = state;
|
|
31
|
+
const [pending, setPendingUrl] = (0, react_1.useState)(null);
|
|
32
|
+
const setIsLoading = (0, usePageLoad_1.usePageLoad)((s) => s.setIsLoading);
|
|
33
|
+
(0, react_1.useEffect)(() => {
|
|
45
34
|
if (data.errorStack) {
|
|
46
35
|
(0, reportErrorStack_1.reportErrorStack)(data.errorStack);
|
|
47
36
|
}
|
|
@@ -50,34 +39,32 @@ function BrowserRouter(props) {
|
|
|
50
39
|
hasPopulatedCache = true;
|
|
51
40
|
(0, remoteProps_1.setInitialProps)(url, data);
|
|
52
41
|
}
|
|
53
|
-
(0, react_1.useEffect)(
|
|
42
|
+
(0, react_1.useEffect)(() => {
|
|
54
43
|
history.scrollRestoration = "manual";
|
|
55
44
|
}, []);
|
|
56
|
-
(0, react_1.useEffect)(
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
setPendingUrl({ popped: true, url: document.location.href, scrollPosition: (_a = e.state) === null || _a === void 0 ? void 0 : _a.scrollPosition });
|
|
45
|
+
(0, react_1.useEffect)(() => {
|
|
46
|
+
const handle = (e) => {
|
|
47
|
+
setPendingUrl({ popped: true, url: document.location.href, scrollPosition: e.state?.scrollPosition });
|
|
60
48
|
};
|
|
61
49
|
window.addEventListener("popstate", handle);
|
|
62
|
-
return
|
|
50
|
+
return () => {
|
|
63
51
|
window.removeEventListener("popstate", handle);
|
|
64
52
|
};
|
|
65
53
|
});
|
|
66
|
-
(0, react_1.useEffect)(
|
|
54
|
+
(0, react_1.useEffect)(() => {
|
|
67
55
|
if (pending === null)
|
|
68
56
|
return;
|
|
69
|
-
|
|
57
|
+
let cancelled = false;
|
|
70
58
|
if (!(0, remoteProps_1.hasCachedProps)(pending.url)) {
|
|
71
59
|
setIsLoading(true);
|
|
72
60
|
}
|
|
73
|
-
(0, remoteProps_1.fetchProps)(pending.url).then(
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
var _a, _b;
|
|
61
|
+
(0, remoteProps_1.fetchProps)(pending.url).then((data) => {
|
|
62
|
+
const view = views_1.default[data.view];
|
|
63
|
+
const nextUrl = data.canonical || pending.url;
|
|
64
|
+
const finish = () => {
|
|
78
65
|
setState({
|
|
79
66
|
url: nextUrl,
|
|
80
|
-
data
|
|
67
|
+
data,
|
|
81
68
|
});
|
|
82
69
|
// setData(data)
|
|
83
70
|
if (data.queryMonitor) {
|
|
@@ -88,11 +75,11 @@ function BrowserRouter(props) {
|
|
|
88
75
|
}
|
|
89
76
|
if (data.editLink)
|
|
90
77
|
(0, updateEditLink_1.updateEditLink)(data.editLink);
|
|
91
|
-
if (
|
|
78
|
+
if (data.meta?.head)
|
|
92
79
|
(0, updateHeadTags_1.updateHeadTags)(data.meta.head);
|
|
93
80
|
setIsLoading(false);
|
|
94
81
|
if (!pending.popped) {
|
|
95
|
-
history.replaceState({ scrollPosition:
|
|
82
|
+
history.replaceState({ scrollPosition: document.scrollingElement?.scrollTop }, "", document.location.href);
|
|
96
83
|
history.pushState({}, "", nextUrl);
|
|
97
84
|
}
|
|
98
85
|
};
|
|
@@ -105,29 +92,29 @@ function BrowserRouter(props) {
|
|
|
105
92
|
}
|
|
106
93
|
}
|
|
107
94
|
});
|
|
108
|
-
return
|
|
95
|
+
return () => {
|
|
109
96
|
cancelled = true;
|
|
110
97
|
};
|
|
111
98
|
}, [pending]);
|
|
112
|
-
|
|
113
|
-
(0, react_1.useEffect)(
|
|
99
|
+
const [scrollPosition, setScrollPosition] = (0, react_1.useState)({ value: null });
|
|
100
|
+
(0, react_1.useEffect)(() => {
|
|
114
101
|
if (document.scrollingElement && typeof scrollPosition.value === "number") {
|
|
115
102
|
document.scrollingElement.scrollTop = scrollPosition.value;
|
|
116
103
|
}
|
|
117
104
|
}, [scrollPosition]);
|
|
118
|
-
return ((0, jsx_runtime_1.jsx)(routing_1.RouterRoot,
|
|
119
|
-
setPendingUrl({ popped: false, url
|
|
120
|
-
}, onPreload:
|
|
105
|
+
return ((0, jsx_runtime_1.jsx)(routing_1.RouterRoot, { url: url, data: data, onNavigateRequest: (url) => {
|
|
106
|
+
setPendingUrl({ popped: false, url });
|
|
107
|
+
}, onPreload: (url) => {
|
|
121
108
|
if ((0, remoteProps_1.isSameOrigin)(url)) {
|
|
122
109
|
(0, remoteProps_1.fetchProps)(url);
|
|
123
110
|
}
|
|
124
|
-
}, onNavigated:
|
|
111
|
+
}, onNavigated: () => {
|
|
125
112
|
if (pending && typeof pending.scrollPosition === "number") {
|
|
126
113
|
setScrollPosition({ value: pending.scrollPosition });
|
|
127
114
|
}
|
|
128
115
|
else {
|
|
129
116
|
setScrollPosition({ value: 0 });
|
|
130
117
|
}
|
|
131
|
-
}
|
|
118
|
+
}, children: props.children }));
|
|
132
119
|
}
|
|
133
120
|
exports.BrowserRouter = BrowserRouter;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReactElement } from "react";
|
|
2
|
-
|
|
2
|
+
type Props = {
|
|
3
3
|
url: string;
|
|
4
4
|
fallback?: ReactElement;
|
|
5
5
|
};
|
|
@@ -7,5 +7,5 @@ declare type Props = {
|
|
|
7
7
|
* Renders an entire page view
|
|
8
8
|
* @param props
|
|
9
9
|
*/
|
|
10
|
-
export declare function InlinePage(props: Props): JSX.Element;
|
|
10
|
+
export declare function InlinePage(props: Props): import("react/jsx-runtime").JSX.Element;
|
|
11
11
|
export {};
|
package/components/InlinePage.js
CHANGED
|
@@ -1,45 +1,33 @@
|
|
|
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.InlinePage = void 0;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const react_1 = require("react");
|
|
9
|
+
const remoteProps_1 = require("../routing/remoteProps");
|
|
10
|
+
const routing_1 = require("../routing");
|
|
22
11
|
// @ts-ignore
|
|
23
|
-
|
|
12
|
+
const views_1 = __importDefault(require("@manifest/views"));
|
|
24
13
|
/**
|
|
25
14
|
* Renders an entire page view
|
|
26
15
|
* @param props
|
|
27
16
|
*/
|
|
28
17
|
function InlinePage(props) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
(0, react_1.useEffect)(function () {
|
|
18
|
+
const [data, setData] = (0, react_1.useState)(undefined);
|
|
19
|
+
const [isLoading, setIsLoading] = (0, react_1.useState)(true);
|
|
20
|
+
const [[Component], setComponent] = (0, react_1.useState)([null]);
|
|
21
|
+
(0, react_1.useEffect)(() => {
|
|
34
22
|
if (!props.url)
|
|
35
23
|
return;
|
|
36
|
-
|
|
24
|
+
let cancelled = false;
|
|
37
25
|
if (!(0, remoteProps_1.hasCachedProps)(props.url)) {
|
|
38
26
|
setIsLoading(true);
|
|
39
27
|
}
|
|
40
|
-
(0, remoteProps_1.fetchProps)(props.url).then(
|
|
41
|
-
|
|
42
|
-
|
|
28
|
+
(0, remoteProps_1.fetchProps)(props.url).then((data) => {
|
|
29
|
+
const view = views_1.default[data.view];
|
|
30
|
+
const finish = () => {
|
|
43
31
|
setData(data);
|
|
44
32
|
setIsLoading(false);
|
|
45
33
|
setComponent([view]);
|
|
@@ -53,18 +41,18 @@ function InlinePage(props) {
|
|
|
53
41
|
}
|
|
54
42
|
}
|
|
55
43
|
});
|
|
56
|
-
return
|
|
44
|
+
return () => {
|
|
57
45
|
cancelled = true;
|
|
58
46
|
};
|
|
59
47
|
}, [props.url]);
|
|
60
|
-
|
|
48
|
+
const routeItem = (0, react_1.useMemo)(() => {
|
|
61
49
|
return (0, routing_1.createRouteItem)(props.url, data);
|
|
62
50
|
}, [data, props.url]);
|
|
63
51
|
if (isLoading || !Component) {
|
|
64
|
-
return props.fallback || (0, jsx_runtime_1.jsx)(react_1.Fragment, {}
|
|
52
|
+
return props.fallback || (0, jsx_runtime_1.jsx)(react_1.Fragment, {});
|
|
65
53
|
}
|
|
66
54
|
else {
|
|
67
|
-
return ((0, jsx_runtime_1.jsx)(routing_1.RouteItemContext,
|
|
55
|
+
return ((0, jsx_runtime_1.jsx)(routing_1.RouteItemContext, { route: routeItem, children: (0, jsx_runtime_1.jsx)(Component, { ...data?.viewData?.data }) }));
|
|
68
56
|
}
|
|
69
57
|
}
|
|
70
58
|
exports.InlinePage = InlinePage;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
2
|
import { RouteData } from "../routing/remoteProps";
|
|
3
|
-
|
|
3
|
+
type Props = {
|
|
4
4
|
children: ReactNode;
|
|
5
5
|
path: string;
|
|
6
6
|
data: RouteData;
|
|
7
7
|
};
|
|
8
|
-
export declare function NextRouter({ children, path, data }: Props): JSX.Element;
|
|
8
|
+
export declare function NextRouter({ children, path, data }: Props): import("react/jsx-runtime").JSX.Element;
|
|
9
9
|
export {};
|