eddev 0.2.0-beta.12 → 0.2.0-beta.16
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/get-webpack-config.js +1 -0
- package/build/serverless/create-next-app.js +60 -56
- package/cli/cli.js +4 -4
- package/components/PageHead.d.ts +1 -0
- package/components/PageHead.js +2 -0
- package/components/PageMeta.d.ts +1 -0
- package/components/PageMeta.js +2 -0
- package/components/PageMeta.monolith.d.ts +1 -0
- package/components/PageMeta.monolith.js +2 -0
- package/components/ServerlessPageMeta.d.ts +1 -0
- package/components/ServerlessPageMeta.js +2 -0
- package/config/config-schema.d.ts +5 -0
- package/config/config-schema.js +1 -0
- package/config/get-config.d.ts +3 -0
- package/config/parse-config.d.ts +2 -0
- package/dev-ui/components/{BreakpointItemHeader.d.ts → BreakpointColumnHeader.d.ts} +0 -0
- package/dev-ui/components/{BreakpointItemHeader.js → BreakpointColumnHeader.js} +3 -6
- package/dev-ui/components/BreakpointIndicator.d.ts +2 -0
- package/dev-ui/components/BreakpointIndicator.js +138 -0
- package/dev-ui/components/DevUI.d.ts +1 -1
- package/dev-ui/components/DevUI.js +13 -4
- package/dev-ui/components/Launcher.d.ts +90 -1
- package/dev-ui/components/Launcher.js +12 -36
- package/dev-ui/components/PanelWrapper.d.ts +6 -2
- package/dev-ui/components/PanelWrapper.js +22 -6
- 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/{Text.d.ts → atoms/Text.d.ts} +7 -1
- 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.js +65 -33
- 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.js +9 -1
- package/dev-ui/hooks/useStylesheet.d.ts +4 -0
- package/dev-ui/hooks/useStylesheet.js +31 -0
- package/dev-ui/icons.d.ts +4 -0
- package/dev-ui/icons.js +5 -1
- package/dev-ui/index.d.ts +1 -1
- package/dev-ui/index.js +11 -3
- package/dev-ui/loader.d.ts +2 -0
- package/dev-ui/loader.js +42 -0
- package/dev-ui/panels.js +9 -7
- package/dev-ui/theme.d.ts +16 -0
- package/dev-ui/theme.js +7 -2
- package/dynamic/dynamic-component.d.ts +1 -0
- package/entry/Root.js +2 -2
- package/package.json +12 -1
- package/serverless/create-rpc-client.d.ts +6 -17
- package/serverless-template/_utils/PageMeta.tsx +44 -0
- package/serverless-template/_utils/fetch-wordpress-props.ts +10 -3
- package/serverless-template/_utils/fetch-wp.ts +16 -0
- package/serverless-template/global.d.ts +1 -0
- package/serverless-template/next.config.js +2 -0
- package/serverless-template/pages/_app.tsx +7 -0
- package/style/createStitches.d.ts +14 -5
- package/style/createStitches.js +15 -51
- package/utils/updateEnvFile.d.ts +1 -0
- package/utils/updateEnvFile.js +76 -0
- package/build/workers/serverless-worker-script.d.ts +0 -0
- package/build/workers/serverless-worker-script.js +0 -1
- package/dev-ui/components/BreakpointList.d.ts +0 -6
- package/dev-ui/components/BreakpointList.js +0 -38
- package/dev-ui/components/Pill.d.ts +0 -0
- package/dev-ui/components/Pill.js +0 -1
- package/dev-ui/components/SpacingEditor.d.ts +0 -2
- package/dev-ui/components/SpacingEditor.js +0 -10
- package/dev-ui/components/Text.js +0 -13
|
@@ -0,0 +1,88 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.TypographyEditor = void 0;
|
|
15
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
|
+
// @ts-ignore
|
|
17
|
+
var _theme_1 = require("@theme");
|
|
18
|
+
var react_1 = require("react");
|
|
19
|
+
var style_1 = require("../../../style");
|
|
20
|
+
var usePersistState_1 = require("../../hooks/usePersistState");
|
|
21
|
+
var icons_1 = require("../../icons");
|
|
22
|
+
var theme_1 = require("../../theme");
|
|
23
|
+
var Button_1 = require("../atoms/Button");
|
|
24
|
+
var Spacer_1 = require("../atoms/Spacer");
|
|
25
|
+
var Text_1 = require("../atoms/Text");
|
|
26
|
+
var PanelWrapper_1 = require("../PanelWrapper");
|
|
27
|
+
function TypographyEditor() {
|
|
28
|
+
var _a = (0, react_1.useState)(function () { return _theme_1.originalConfig.typography; }), values = _a[0], setValues = _a[1];
|
|
29
|
+
var parsedBreakpoints = (0, style_1.parseBreakpoints)(_theme_1.originalConfig.breakpoints, _theme_1.originalConfig.media);
|
|
30
|
+
var _b = (0, usePersistState_1.usePersistState)("preview_text", "The quick brown fox jumps over the lazy dog"), previewText = _b[0], setPreviewText = _b[1];
|
|
31
|
+
var reset = function () {
|
|
32
|
+
setValues(_theme_1.originalConfig.typography);
|
|
33
|
+
setPreviewText("The quick brown fox jumps over the lazy dog");
|
|
34
|
+
};
|
|
35
|
+
// const stylesheet = useStylesheet("spacing")
|
|
36
|
+
// useEffect(() => {
|
|
37
|
+
// stylesheet.set(spaceToCSS(values))
|
|
38
|
+
// }, [values])
|
|
39
|
+
return ((0, jsx_runtime_1.jsx)(PanelWrapper_1.PanelWrapper, __assign({ title: "Typography", buttons: (0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(Button_1.Button, __assign({ small: true, onClick: function () {
|
|
40
|
+
// navigator.clipboard.writeText(spaceToJSON(values))
|
|
41
|
+
} }, { children: [icons_1.copy, "Copy"] }), void 0), (0, jsx_runtime_1.jsxs)(Button_1.Button, __assign({ small: true, onClick: function () {
|
|
42
|
+
// navigator.clipboard.readText().then((text) => {
|
|
43
|
+
// try {
|
|
44
|
+
// const data = JSON.parse(text)
|
|
45
|
+
// setValues(data)
|
|
46
|
+
// } catch (err) {
|
|
47
|
+
// alert("Error decoding pasted content: " + (err as any).message + ". You pasted:\n" + text)
|
|
48
|
+
// }
|
|
49
|
+
// })
|
|
50
|
+
} }, { children: [icons_1.paste, "Paste"] }), void 0), (0, jsx_runtime_1.jsx)(Spacer_1.Spacer, {}, void 0), (0, jsx_runtime_1.jsxs)(Button_1.Button, __assign({ small: true, onClick: reset }, { children: [icons_1.trash, " Reset"] }), void 0)] }, void 0) }, { children: (0, jsx_runtime_1.jsx)(Wrapper, { children: Object.entries(values).map(function (_a, index) {
|
|
51
|
+
var name = _a[0], settings = _a[1];
|
|
52
|
+
return ((0, jsx_runtime_1.jsxs)(TypographyItem, { children: [(0, jsx_runtime_1.jsx)(Meta, { children: (0, jsx_runtime_1.jsx)(Text_1.Text, __assign({ variant: "monoBold" }, { children: name }), void 0) }, void 0), (0, jsx_runtime_1.jsx)(Details, { children: (0, jsx_runtime_1.jsx)(Preview, { css: { typography: name }, value: previewText, onChange: function (e) {
|
|
53
|
+
setPreviewText(e.currentTarget.value);
|
|
54
|
+
} }, void 0) }, void 0)] }, index));
|
|
55
|
+
}) }, void 0) }), void 0));
|
|
56
|
+
}
|
|
57
|
+
exports.TypographyEditor = TypographyEditor;
|
|
58
|
+
var TypographyItem = (0, theme_1.styled)("div", {
|
|
59
|
+
borderBottom: "1px solid $colors$bgLineStrong",
|
|
60
|
+
display: "flex",
|
|
61
|
+
paddingTop: "4px",
|
|
62
|
+
paddingBottom: "4px",
|
|
63
|
+
});
|
|
64
|
+
var Meta = (0, theme_1.styled)("div", {
|
|
65
|
+
width: "200px",
|
|
66
|
+
flex: "0 0 auto",
|
|
67
|
+
});
|
|
68
|
+
var Wrapper = (0, theme_1.styled)("div", {
|
|
69
|
+
maxHeight: "500px",
|
|
70
|
+
overflowY: "auto",
|
|
71
|
+
});
|
|
72
|
+
var Details = (0, theme_1.styled)("div", {
|
|
73
|
+
flex: "1 1 auto",
|
|
74
|
+
});
|
|
75
|
+
var Preview = (0, _theme_1.styled)("input", {
|
|
76
|
+
appearance: "none",
|
|
77
|
+
backgroundColor: "transparent",
|
|
78
|
+
borderLeft: 0,
|
|
79
|
+
borderRight: 0,
|
|
80
|
+
borderTop: "1px solid #555555",
|
|
81
|
+
borderBottom: "1px solid #555555",
|
|
82
|
+
outline: "0",
|
|
83
|
+
color: "#ffffff",
|
|
84
|
+
padding: "0px 6px",
|
|
85
|
+
borderRadius: "0",
|
|
86
|
+
width: "100%",
|
|
87
|
+
marginBottom: "8px",
|
|
88
|
+
});
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useBreakpoint = void 0;
|
|
4
|
+
// @ts-ignore
|
|
5
|
+
var _theme_1 = require("@theme");
|
|
6
|
+
var react_1 = require("react");
|
|
7
|
+
function useBreakpoint() {
|
|
8
|
+
// const [value, setValue] = useState(["initial", -1, 0] as [string, number, number])
|
|
9
|
+
var _a = (0, react_1.useState)({
|
|
10
|
+
name: "initial",
|
|
11
|
+
index: -1,
|
|
12
|
+
progress: 0,
|
|
13
|
+
offset: 0,
|
|
14
|
+
width: 0,
|
|
15
|
+
bpMin: 0,
|
|
16
|
+
bpMax: 0,
|
|
17
|
+
}), value = _a[0], setValue = _a[1];
|
|
18
|
+
(0, react_1.useEffect)(function () {
|
|
19
|
+
var handle = function () {
|
|
20
|
+
var width = window.innerWidth;
|
|
21
|
+
var result = {
|
|
22
|
+
name: "initial",
|
|
23
|
+
index: 0,
|
|
24
|
+
offset: window.innerWidth,
|
|
25
|
+
progress: window.innerWidth / _theme_1.breakpoints[0].max,
|
|
26
|
+
width: window.innerWidth,
|
|
27
|
+
bpMin: 0,
|
|
28
|
+
bpMax: _theme_1.breakpoints[0].max,
|
|
29
|
+
};
|
|
30
|
+
for (var index in _theme_1.breakpoints) {
|
|
31
|
+
var bp = _theme_1.breakpoints[index];
|
|
32
|
+
var key = bp.key;
|
|
33
|
+
var media = _theme_1.config.media[key];
|
|
34
|
+
if (!media.includes("min-width") || !media)
|
|
35
|
+
continue;
|
|
36
|
+
if (window.matchMedia(media).matches) {
|
|
37
|
+
result.name = key;
|
|
38
|
+
result.index = Number(index);
|
|
39
|
+
result.offset = width - parseFloat(bp.min);
|
|
40
|
+
result.progress = result.offset / (parseFloat(bp.max) - parseFloat(bp.min));
|
|
41
|
+
result.bpMin = bp.min;
|
|
42
|
+
result.bpMax = bp.max;
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
break;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
setValue(result);
|
|
49
|
+
// if (breakpoint !== value[0]) {
|
|
50
|
+
// setValue([breakpoint, matchedIndex, progress])
|
|
51
|
+
// }
|
|
52
|
+
};
|
|
53
|
+
handle();
|
|
54
|
+
window.addEventListener("resize", handle);
|
|
55
|
+
return function () { return window.removeEventListener("resize", handle); };
|
|
56
|
+
}, []);
|
|
57
|
+
return value;
|
|
58
|
+
}
|
|
59
|
+
exports.useBreakpoint = useBreakpoint;
|
|
@@ -4,9 +4,17 @@ exports.usePersistState = void 0;
|
|
|
4
4
|
var react_1 = require("react");
|
|
5
5
|
var get = function (id, fallback) {
|
|
6
6
|
if (fallback === void 0) { fallback = undefined; }
|
|
7
|
+
if (typeof localStorage === "undefined") {
|
|
8
|
+
return fallback;
|
|
9
|
+
}
|
|
7
10
|
var value = localStorage.getItem("devui_" + id);
|
|
8
11
|
if (value !== null) {
|
|
9
|
-
|
|
12
|
+
try {
|
|
13
|
+
return JSON.parse(value);
|
|
14
|
+
}
|
|
15
|
+
catch (err) {
|
|
16
|
+
return fallback;
|
|
17
|
+
}
|
|
10
18
|
}
|
|
11
19
|
else {
|
|
12
20
|
return fallback;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useStylesheet = void 0;
|
|
4
|
+
var react_1 = require("react");
|
|
5
|
+
function useStylesheet(id) {
|
|
6
|
+
var _a = (0, react_1.useState)(null), element = _a[0], setElement = _a[1];
|
|
7
|
+
(0, react_1.useEffect)(function () {
|
|
8
|
+
if (!element) {
|
|
9
|
+
var style = document.getElementById("devui-" + id);
|
|
10
|
+
if (!style) {
|
|
11
|
+
style = document.createElement("style");
|
|
12
|
+
style.id = "devui-" + id;
|
|
13
|
+
document.body.appendChild(style);
|
|
14
|
+
}
|
|
15
|
+
setElement(style);
|
|
16
|
+
}
|
|
17
|
+
}, [element]);
|
|
18
|
+
return {
|
|
19
|
+
clear: function () {
|
|
20
|
+
if (element) {
|
|
21
|
+
element.innerHTML = "";
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
set: function (value) {
|
|
25
|
+
if (element) {
|
|
26
|
+
element.innerHTML = value;
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
exports.useStylesheet = useStylesheet;
|
package/dev-ui/icons.d.ts
CHANGED
|
@@ -9,3 +9,7 @@ export declare const close: JSX.Element;
|
|
|
9
9
|
export declare const check: JSX.Element;
|
|
10
10
|
export declare const checkEmpty: JSX.Element;
|
|
11
11
|
export declare const checkFilled: JSX.Element;
|
|
12
|
+
export declare const line: JSX.Element;
|
|
13
|
+
export declare const copy: JSX.Element;
|
|
14
|
+
export declare const paste: JSX.Element;
|
|
15
|
+
export declare const trash: JSX.Element;
|
package/dev-ui/icons.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.checkFilled = exports.checkEmpty = exports.check = exports.close = exports.share = exports.code = exports.structure = exports.ruler = exports.typography = exports.bolt = void 0;
|
|
14
|
+
exports.trash = exports.paste = exports.copy = exports.line = exports.checkFilled = exports.checkEmpty = exports.check = exports.close = exports.share = exports.code = exports.structure = exports.ruler = exports.typography = exports.bolt = void 0;
|
|
15
15
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
16
|
exports.bolt = ((0, jsx_runtime_1.jsxs)("svg", __assign({ xmlns: "http://www.w3.org/2000/svg", height: "24px", viewBox: "0 0 24 24", width: "24px", fill: "#000000" }, { children: [(0, jsx_runtime_1.jsx)("g", { children: (0, jsx_runtime_1.jsx)("rect", { fill: "none", height: "24", width: "24" }, void 0) }, void 0), (0, jsx_runtime_1.jsx)("g", { children: (0, jsx_runtime_1.jsx)("path", { d: "M11,21h-1l1-7H6.74c0,0,3.68-6.46,6.26-11h1l-1,7h4.28L11,21z" }, void 0) }, void 0)] }), void 0));
|
|
17
17
|
exports.typography = ((0, jsx_runtime_1.jsx)("svg", __assign({ xmlns: "http://www.w3.org/2000/svg", height: "24px", viewBox: "0 0 24 24", width: "24px", fill: "#000000" }, { children: (0, jsx_runtime_1.jsx)("path", { d: "M2.5 4v3h5v12h3V7h5V4h-13zm19 5h-9v3h3v7h3v-7h3V9z" }, void 0) }), void 0));
|
|
@@ -23,3 +23,7 @@ exports.close = ((0, jsx_runtime_1.jsxs)("svg", __assign({ xmlns: "http://www.w3
|
|
|
23
23
|
exports.check = ((0, jsx_runtime_1.jsxs)("svg", __assign({ xmlns: "http://www.w3.org/2000/svg", height: "24px", viewBox: "0 0 24 24", width: "24px", fill: "#000000" }, { children: [(0, jsx_runtime_1.jsx)("path", { d: "M0 0h24v24H0V0z", fill: "none" }, void 0), (0, jsx_runtime_1.jsx)("path", { d: "M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z" }, void 0)] }), void 0));
|
|
24
24
|
exports.checkEmpty = ((0, jsx_runtime_1.jsxs)("svg", __assign({ xmlns: "http://www.w3.org/2000/svg", height: "24px", viewBox: "0 0 24 24", width: "24px", fill: "#000000" }, { children: [(0, jsx_runtime_1.jsx)("path", { d: "M0 0h24v24H0V0z", fill: "none" }, void 0), (0, jsx_runtime_1.jsx)("path", { d: "M19 5v14H5V5h14m2-2H3v18h18V3z" }, void 0)] }), void 0));
|
|
25
25
|
exports.checkFilled = ((0, jsx_runtime_1.jsxs)("svg", __assign({ xmlns: "http://www.w3.org/2000/svg", height: "24px", viewBox: "0 0 24 24", width: "24px", fill: "#000000" }, { children: [(0, jsx_runtime_1.jsx)("path", { d: "M0 0h24v24H0V0z", fill: "none" }, void 0), (0, jsx_runtime_1.jsx)("path", { d: "M21 3H3v18h18V3zM10 17l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z" }, void 0)] }), void 0));
|
|
26
|
+
exports.line = ((0, jsx_runtime_1.jsxs)("svg", __assign({ xmlns: "http://www.w3.org/2000/svg", enableBackground: "new 0 0 24 24", height: "24px", viewBox: "0 0 24 24", width: "24px", fill: "#000000" }, { children: [(0, jsx_runtime_1.jsx)("g", { children: (0, jsx_runtime_1.jsx)("rect", { fill: "none", height: "24", width: "24", x: "0" }, void 0) }, void 0), (0, jsx_runtime_1.jsx)("g", { children: (0, jsx_runtime_1.jsx)("g", { children: (0, jsx_runtime_1.jsx)("path", { d: "M23,8c0,1.1-0.9,2-2,2c-0.18,0-0.35-0.02-0.51-0.07l-3.56,3.55C16.98,13.64,17,13.82,17,14c0,1.1-0.9,2-2,2s-2-0.9-2-2 c0-0.18,0.02-0.36,0.07-0.52l-2.55-2.55C10.36,10.98,10.18,11,10,11c-0.18,0-0.36-0.02-0.52-0.07l-4.55,4.56 C4.98,15.65,5,15.82,5,16c0,1.1-0.9,2-2,2s-2-0.9-2-2s0.9-2,2-2c0.18,0,0.35,0.02,0.51,0.07l4.56-4.55C8.02,9.36,8,9.18,8,9 c0-1.1,0.9-2,2-2s2,0.9,2,2c0,0.18-0.02,0.36-0.07,0.52l2.55,2.55C14.64,12.02,14.82,12,15,12c0.18,0,0.36,0.02,0.52,0.07 l3.55-3.56C19.02,8.35,19,8.18,19,8c0-1.1,0.9-2,2-2S23,6.9,23,8z" }, void 0) }, void 0) }, void 0)] }), void 0));
|
|
27
|
+
exports.copy = ((0, jsx_runtime_1.jsxs)("svg", __assign({ xmlns: "http://www.w3.org/2000/svg", height: "24px", viewBox: "0 0 24 24", width: "24px", fill: "#000000" }, { children: [(0, jsx_runtime_1.jsx)("path", { d: "M0 0h24v24H0V0z", fill: "none" }, void 0), (0, jsx_runtime_1.jsx)("path", { d: "M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z" }, void 0)] }), void 0));
|
|
28
|
+
exports.paste = ((0, jsx_runtime_1.jsxs)("svg", __assign({ xmlns: "http://www.w3.org/2000/svg", height: "24px", viewBox: "0 0 24 24", width: "24px", fill: "#000000" }, { children: [(0, jsx_runtime_1.jsx)("path", { d: "M0 0h24v24H0V0z", fill: "none" }, void 0), (0, jsx_runtime_1.jsx)("path", { d: "M19 2h-4.18C14.4.84 13.3 0 12 0S9.6.84 9.18 2H5c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-7 0c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1zm7 18H5V4h2v3h10V4h2v16z" }, void 0)] }), void 0));
|
|
29
|
+
exports.trash = ((0, jsx_runtime_1.jsxs)("svg", __assign({ xmlns: "http://www.w3.org/2000/svg", height: "24px", viewBox: "0 0 24 24", width: "24px", fill: "#000000" }, { children: [(0, jsx_runtime_1.jsx)("path", { d: "M0 0h24v24H0V0z", fill: "none" }, void 0), (0, jsx_runtime_1.jsx)("path", { d: "M6 21h12V7H6v14zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z" }, void 0)] }), void 0));
|
package/dev-ui/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from "./components/DevUI";
|
package/dev-ui/index.js
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
2
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
var DevUI_1 = require("./components/DevUI");
|
|
5
|
-
Object.defineProperty(exports, "DevUI", { enumerable: true, get: function () { return DevUI_1.DevUI; } });
|
|
13
|
+
__exportStar(require("./components/DevUI"), exports);
|
package/dev-ui/loader.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.DevUILoader = void 0;
|
|
23
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
24
|
+
var react_1 = require("react");
|
|
25
|
+
var dynamic_1 = require("../dynamic");
|
|
26
|
+
var usePersistState_1 = require("./hooks/usePersistState");
|
|
27
|
+
var DevUI = (0, dynamic_1.dynamic)(function () { return Promise.resolve().then(function () { return __importStar(require("./components/DevUI")); }); }, { ssr: false });
|
|
28
|
+
function DevUILoader() {
|
|
29
|
+
var _a = (0, usePersistState_1.usePersistState)("enable_devui", process.dev || (typeof window !== "undefined" && window["ENABLE_DEV_UI"])), render = _a[0], setRender = _a[1];
|
|
30
|
+
(0, react_1.useEffect)(function () {
|
|
31
|
+
if (document.location.search.includes("activate-dev-ui")) {
|
|
32
|
+
setRender(true);
|
|
33
|
+
}
|
|
34
|
+
}, []);
|
|
35
|
+
if (render) {
|
|
36
|
+
return (0, jsx_runtime_1.jsx)(DevUI, {}, void 0);
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.DevUILoader = DevUILoader;
|
package/dev-ui/panels.js
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DEV_UI_PANELS = void 0;
|
|
4
4
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
var PageDataDebugger_1 = require("./components/panels/PageDataDebugger");
|
|
5
6
|
var SpacingEditor_1 = require("./components/panels/SpacingEditor");
|
|
7
|
+
var TypographyEditor_1 = require("./components/panels/TypographyEditor");
|
|
6
8
|
var icons_1 = require("./icons");
|
|
7
9
|
var TempComponent = function () {
|
|
8
10
|
return (0, jsx_runtime_1.jsx)("div", { children: "Test" }, void 0);
|
|
@@ -11,7 +13,7 @@ exports.DEV_UI_PANELS = {
|
|
|
11
13
|
typography: {
|
|
12
14
|
label: "Typography",
|
|
13
15
|
icon: icons_1.typography,
|
|
14
|
-
component:
|
|
16
|
+
component: TypographyEditor_1.TypographyEditor,
|
|
15
17
|
},
|
|
16
18
|
spacing: {
|
|
17
19
|
label: "Spacing",
|
|
@@ -21,11 +23,11 @@ exports.DEV_UI_PANELS = {
|
|
|
21
23
|
page: {
|
|
22
24
|
label: "Page Data",
|
|
23
25
|
icon: icons_1.code,
|
|
24
|
-
component:
|
|
25
|
-
},
|
|
26
|
-
structure: {
|
|
27
|
-
label: "Page Structure",
|
|
28
|
-
icon: icons_1.structure,
|
|
29
|
-
component: TempComponent,
|
|
26
|
+
component: PageDataDebugger_1.PageDataDebugger,
|
|
30
27
|
},
|
|
28
|
+
// structure: {
|
|
29
|
+
// label: "Page Structure",
|
|
30
|
+
// icon: structure,
|
|
31
|
+
// component: TempComponent,
|
|
32
|
+
// },
|
|
31
33
|
};
|
package/dev-ui/theme.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
export declare const styled: <Type extends import("react").ComponentType<any> | keyof JSX.IntrinsicElements | import("@stitches/react/types/util").Function, Composers extends (string | import("react").ComponentType<any> | import("@stitches/react/types/util").Function | {
|
|
2
3
|
[name: string]: unknown;
|
|
3
4
|
})[], CSS = import("@stitches/react/types/css-util").CSS<{}, {
|
|
4
5
|
space: {
|
|
6
|
+
smallButtonHeight: string;
|
|
5
7
|
buttonHeight: string;
|
|
6
8
|
0: string;
|
|
7
9
|
1: string;
|
|
@@ -15,6 +17,10 @@ export declare const styled: <Type extends import("react").ComponentType<any> |
|
|
|
15
17
|
bg: string;
|
|
16
18
|
bgHover: string;
|
|
17
19
|
bgHoverLight: string;
|
|
20
|
+
bgLine: string;
|
|
21
|
+
bgLineStrong: string;
|
|
22
|
+
button: string;
|
|
23
|
+
buttonHover: string;
|
|
18
24
|
fg: string;
|
|
19
25
|
fgFaded: string;
|
|
20
26
|
};
|
|
@@ -49,6 +55,7 @@ export declare const styled: <Type extends import("react").ComponentType<any> |
|
|
|
49
55
|
defaultVariants?: ("variants" extends keyof Composers[K] ? { [Name_1 in keyof Composers[K][keyof Composers[K] & "variants"]]?: import("@stitches/react/types/util").String | import("@stitches/react/types/util").Widen<keyof Composers[K][keyof Composers[K] & "variants"][Name_1]> | undefined; } : import("@stitches/react/types/util").WideObject) | undefined;
|
|
50
56
|
} & CSS & { [K2 in keyof Composers[K]]: K2 extends "compoundVariants" | "defaultVariants" | "variants" ? unknown : K2 extends keyof CSS ? CSS[K2] : unknown; }; }) => import("@stitches/react/types/styled-component").StyledComponent<Type, import("@stitches/react/types/styled-component").StyledComponentProps<Composers>, {}, import("@stitches/react/types/css-util").CSS<{}, {
|
|
51
57
|
space: {
|
|
58
|
+
smallButtonHeight: string;
|
|
52
59
|
buttonHeight: string;
|
|
53
60
|
0: string;
|
|
54
61
|
1: string;
|
|
@@ -62,6 +69,10 @@ export declare const styled: <Type extends import("react").ComponentType<any> |
|
|
|
62
69
|
bg: string;
|
|
63
70
|
bgHover: string;
|
|
64
71
|
bgHoverLight: string;
|
|
72
|
+
bgLine: string;
|
|
73
|
+
bgLineStrong: string;
|
|
74
|
+
button: string;
|
|
75
|
+
buttonHover: string;
|
|
65
76
|
fg: string;
|
|
66
77
|
fgFaded: string;
|
|
67
78
|
};
|
|
@@ -87,6 +98,7 @@ export declare const styled: <Type extends import("react").ComponentType<any> |
|
|
|
87
98
|
[name: string]: unknown;
|
|
88
99
|
})[], CSS = import("@stitches/react/types/css-util").CSS<{}, {
|
|
89
100
|
space: {
|
|
101
|
+
smallButtonHeight: string;
|
|
90
102
|
buttonHeight: string;
|
|
91
103
|
0: string;
|
|
92
104
|
1: string;
|
|
@@ -100,6 +112,10 @@ export declare const styled: <Type extends import("react").ComponentType<any> |
|
|
|
100
112
|
bg: string;
|
|
101
113
|
bgHover: string;
|
|
102
114
|
bgHoverLight: string;
|
|
115
|
+
bgLine: string;
|
|
116
|
+
bgLineStrong: string;
|
|
117
|
+
button: string;
|
|
118
|
+
buttonHover: string;
|
|
103
119
|
fg: string;
|
|
104
120
|
fgFaded: string;
|
|
105
121
|
};
|
package/dev-ui/theme.js
CHANGED
|
@@ -6,6 +6,7 @@ var react_1 = require("@stitches/react");
|
|
|
6
6
|
exports.styled = (_a = (0, react_1.createStitches)({
|
|
7
7
|
theme: {
|
|
8
8
|
space: {
|
|
9
|
+
smallButtonHeight: "22px",
|
|
9
10
|
buttonHeight: "26px",
|
|
10
11
|
0: "4px",
|
|
11
12
|
1: "8px",
|
|
@@ -16,9 +17,13 @@ exports.styled = (_a = (0, react_1.createStitches)({
|
|
|
16
17
|
6: "48px",
|
|
17
18
|
},
|
|
18
19
|
colors: {
|
|
19
|
-
bg: "#
|
|
20
|
-
bgHover: "#
|
|
20
|
+
bg: "#111111",
|
|
21
|
+
bgHover: "#333333",
|
|
21
22
|
bgHoverLight: "#333333",
|
|
23
|
+
bgLine: "#1a1a1a",
|
|
24
|
+
bgLineStrong: "#222222",
|
|
25
|
+
button: "#333333",
|
|
26
|
+
buttonHover: "#555555",
|
|
22
27
|
fg: "#ffffff",
|
|
23
28
|
fgFaded: "#aaaaaa",
|
|
24
29
|
},
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
export declare const dynamic: {
|
|
2
3
|
<Props, Module = import("@loadable/component").DefaultComponent<Props>>(loadFn: (props: Props) => Promise<Module>, options: import("@loadable/component").OptionsWithResolver<Props, Module>): import("@loadable/component").LoadableComponent<Props>;
|
|
3
4
|
<Props_1>(loadFn: (props: Props_1) => Promise<import("@loadable/component").DefaultComponent<Props_1>>, options?: import("@loadable/component").OptionsWithoutResolver<Props_1> | undefined): import("@loadable/component").LoadableComponent<Props_1>;
|
package/entry/Root.js
CHANGED
|
@@ -34,11 +34,11 @@ var jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
34
34
|
// @ts-ignore
|
|
35
35
|
var views_1 = __importStar(require("@manifest/views"));
|
|
36
36
|
var react_1 = require("react");
|
|
37
|
-
var dev_ui_1 = require("../dev-ui");
|
|
38
37
|
var routing_1 = require("../routing");
|
|
38
|
+
var loader_1 = require("../dev-ui/loader");
|
|
39
39
|
function Root() {
|
|
40
40
|
var route = (0, routing_1.useRoute)();
|
|
41
|
-
return ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [process.devUI
|
|
41
|
+
return ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [process.devUI && (0, jsx_runtime_1.jsx)(loader_1.DevUILoader, {}, void 0), (0, jsx_runtime_1.jsx)(views_1.App, { children: (0, jsx_runtime_1.jsx)(routing_1.Switch, { children: Object.entries(views_1.default).map(function (_a) {
|
|
42
42
|
var _b, _c;
|
|
43
43
|
var name = _a[0], Component = _a[1];
|
|
44
44
|
return ((0, jsx_runtime_1.jsx)(routing_1.Route, __assign({ match: function (route) { var _a; return ((_a = route.data) === null || _a === void 0 ? void 0 : _a.view) === name; } }, { children: (0, jsx_runtime_1.jsx)(Component, __assign({}, (_c = (_b = route.data) === null || _b === void 0 ? void 0 : _b.viewData) === null || _c === void 0 ? void 0 : _c.data), void 0) }), name));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eddev",
|
|
3
|
-
"version": "0.2.0-beta.
|
|
3
|
+
"version": "0.2.0-beta.16",
|
|
4
4
|
"main": "./index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
|
@@ -50,6 +50,10 @@
|
|
|
50
50
|
"@soda/friendly-errors-webpack-plugin": "^1.8.0",
|
|
51
51
|
"@stitches/core": "^1.2.6",
|
|
52
52
|
"@stitches/react": "^1.2.6",
|
|
53
|
+
"@trpc/client": "^9.19.0",
|
|
54
|
+
"@trpc/next": "^9.19.0",
|
|
55
|
+
"@trpc/react": "^9.19.0",
|
|
56
|
+
"@trpc/server": "^9.19.0",
|
|
53
57
|
"autoprefixer": "^10.3.4",
|
|
54
58
|
"babel-loader": "^8.2.2",
|
|
55
59
|
"chalk": "^4.1.2",
|
|
@@ -67,15 +71,18 @@
|
|
|
67
71
|
"glob": "^7.1.7",
|
|
68
72
|
"glob-promise": "^4.2.0",
|
|
69
73
|
"graphql": "^15.5.3",
|
|
74
|
+
"immer": "^9.0.12",
|
|
70
75
|
"ink": "^3.2.0",
|
|
71
76
|
"inquirer": "^8.1.2",
|
|
72
77
|
"mini-css-extract-plugin": "^2.2.2",
|
|
78
|
+
"next": "^12.1.0",
|
|
73
79
|
"next-transpile-modules": "^9.0.0",
|
|
74
80
|
"postcss-loader": "^6.1.1",
|
|
75
81
|
"qs": "^6.10.1",
|
|
76
82
|
"react-error-overlay": "^6.0.9",
|
|
77
83
|
"react-inspector": "^5.1.1",
|
|
78
84
|
"react-merge-refs": "^1.1.0",
|
|
85
|
+
"react-query": "^3.34.16",
|
|
79
86
|
"react-refresh": "^0.10.0",
|
|
80
87
|
"rimraf": "^3.0.2",
|
|
81
88
|
"swr": "^1.0.1",
|
|
@@ -92,6 +99,10 @@
|
|
|
92
99
|
"zustand": "^3.5.10"
|
|
93
100
|
},
|
|
94
101
|
"peerDependencies": {
|
|
102
|
+
"@trpc/client": "^9.19.0",
|
|
103
|
+
"@trpc/next": "^9.19.0",
|
|
104
|
+
"@trpc/react": "^9.19.0",
|
|
105
|
+
"@trpc/server": "^9.19.0",
|
|
95
106
|
"react": "^18.0.0-rc.0",
|
|
96
107
|
"react-dom": "^18.0.0-rc.0"
|
|
97
108
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
export declare function createRPCClient(): {
|
|
2
3
|
Provider: ({ client, queryClient, children, isPrepass, ssrContext, }: {
|
|
3
|
-
queryClient: QueryClient;
|
|
4
|
+
queryClient: import("react-query").QueryClient;
|
|
4
5
|
client: import("@trpc/react").TRPCClient<import("@trpc/server").AnyRouter<any>>;
|
|
5
6
|
children: import("react").ReactNode;
|
|
6
7
|
isPrepass?: boolean | undefined;
|
|
@@ -8,25 +9,13 @@ export declare function createRPCClient(): {
|
|
|
8
9
|
}) => JSX.Element;
|
|
9
10
|
createClient: (opts: import("@trpc/react").CreateTRPCClientOptions<import("@trpc/server").AnyRouter<any>>) => import("@trpc/react").TRPCClient<import("@trpc/server").AnyRouter<any>>;
|
|
10
11
|
useContext: () => import("@trpc/react/dist/declarations/src/internals/context").TRPCContextState<import("@trpc/server").AnyRouter<any>, unknown>;
|
|
11
|
-
useQuery: <TPath extends string>(pathAndInput: [TPath, (null | undefined)?], opts?: import("@trpc/react").UseTRPCQueryOptions<TPath, unknown, any, import("@trpc/react").TRPCClientErrorLike<import("@trpc/server").AnyRouter<any>>> | undefined) => UseQueryResult<
|
|
12
|
-
|
|
13
|
-
output: import("@trpc/server").ThenArg<ReturnType<TRouter["_def"]["queries"][TPath_1]["call"]>>;
|
|
14
|
-
}; }[TPath_2]["output"], import("@trpc/react").TRPCClientErrorLike<TRouter>>;
|
|
15
|
-
useMutation: <TPath_1 extends string>(path: TPath_1 | [TPath_1], opts?: import("@trpc/react").UseTRPCMutationOptions<unknown, import("@trpc/react").TRPCClientErrorLike<import("@trpc/server").AnyRouter<any>>, any> | undefined) => UseMutationResult<{ [TPath_3 in keyof TRouter["_def"]["mutations"]]: {
|
|
16
|
-
input: import("@trpc/server").inferProcedureInput<TRouter["_def"]["mutations"][TPath_3]>;
|
|
17
|
-
output: import("@trpc/server").ThenArg<ReturnType<TRouter["_def"]["mutations"][TPath_3]["call"]>>;
|
|
18
|
-
}; }[TPath_1_1]["output"], import("@trpc/react").TRPCClientErrorLike<TRouter>, { [TPath_3 in keyof TRouter["_def"]["mutations"]]: {
|
|
19
|
-
input: import("@trpc/server").inferProcedureInput<TRouter["_def"]["mutations"][TPath_3]>;
|
|
20
|
-
output: import("@trpc/server").ThenArg<ReturnType<TRouter["_def"]["mutations"][TPath_3]["call"]>>;
|
|
21
|
-
}; }[TPath_1_1]["input"], unknown>;
|
|
12
|
+
useQuery: <TPath extends string>(pathAndInput: [TPath, (null | undefined)?], opts?: import("@trpc/react").UseTRPCQueryOptions<TPath, unknown, any, import("@trpc/react").TRPCClientErrorLike<import("@trpc/server").AnyRouter<any>>> | undefined) => import("react-query").UseQueryResult<any, import("@trpc/react").TRPCClientErrorLike<import("@trpc/server").AnyRouter<any>>>;
|
|
13
|
+
useMutation: <TPath_1 extends string>(path: TPath_1 | [TPath_1], opts?: import("@trpc/react").UseTRPCMutationOptions<unknown, import("@trpc/react").TRPCClientErrorLike<import("@trpc/server").AnyRouter<any>>, any> | undefined) => import("react-query").UseMutationResult<any, import("@trpc/react").TRPCClientErrorLike<import("@trpc/server").AnyRouter<any>>, unknown, unknown>;
|
|
22
14
|
useSubscription: <TPath_2 extends string, TOutput extends any>(pathAndInput: [TPath_2, (null | undefined)?], opts: {
|
|
23
15
|
enabled?: boolean | undefined;
|
|
24
16
|
onError?: ((err: import("@trpc/react").TRPCClientErrorLike<import("@trpc/server").AnyRouter<any>>) => void) | undefined;
|
|
25
17
|
onNext: (data: TOutput) => void;
|
|
26
18
|
}) => void;
|
|
27
|
-
useDehydratedState: (client: import("@trpc/react").TRPCClient<import("@trpc/server").AnyRouter<any>>, trpcState:
|
|
28
|
-
useInfiniteQuery: <TPath_3 extends never>(pathAndInput: [path: TPath_3, input: Omit<unknown, "cursor">], opts?: import("@trpc/react").UseTRPCInfiniteQueryOptions<TPath_3, Omit<unknown, "cursor">, any, import("@trpc/react").TRPCClientErrorLike<import("@trpc/server").AnyRouter<any>>> | undefined) => UseInfiniteQueryResult<
|
|
29
|
-
input: import("@trpc/server").inferProcedureInput<TRouter["_def"]["queries"][TPath_1]>;
|
|
30
|
-
output: import("@trpc/server").ThenArg<ReturnType<TRouter["_def"]["queries"][TPath_1]["call"]>>;
|
|
31
|
-
}; }[TPath_3_1]["output"], import("@trpc/react").TRPCClientErrorLike<TRouter>>;
|
|
19
|
+
useDehydratedState: (client: import("@trpc/react").TRPCClient<import("@trpc/server").AnyRouter<any>>, trpcState: import("react-query").DehydratedState | undefined) => import("react-query").DehydratedState | undefined;
|
|
20
|
+
useInfiniteQuery: <TPath_3 extends never>(pathAndInput: [path: TPath_3, input: Omit<unknown, "cursor">], opts?: import("@trpc/react").UseTRPCInfiniteQueryOptions<TPath_3, Omit<unknown, "cursor">, any, import("@trpc/react").TRPCClientErrorLike<import("@trpc/server").AnyRouter<any>>> | undefined) => import("react-query").UseInfiniteQueryResult<any, import("@trpc/react").TRPCClientErrorLike<import("@trpc/server").AnyRouter<any>>>;
|
|
32
21
|
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ParsedRouteTags } from "eddev/routing/remoteProps"
|
|
2
|
+
import Head from "next/head"
|
|
3
|
+
import { Fragment } from "react"
|
|
4
|
+
|
|
5
|
+
type Props = ParsedRouteTags
|
|
6
|
+
|
|
7
|
+
export function PageMeta(props: Props) {
|
|
8
|
+
console.log("Meta", props)
|
|
9
|
+
return (
|
|
10
|
+
<Head>
|
|
11
|
+
{props.title?.map((tag, i) => (
|
|
12
|
+
<title key={"title" + i}>{tag.__code}</title>
|
|
13
|
+
))}
|
|
14
|
+
{props.style?.map((tag, i) => {
|
|
15
|
+
return (
|
|
16
|
+
<style
|
|
17
|
+
key={"style" + i}
|
|
18
|
+
className={tag["class"]}
|
|
19
|
+
type={tag.type}
|
|
20
|
+
id={tag.id}
|
|
21
|
+
dangerouslySetInnerHTML={{ __html: tag.__code }}
|
|
22
|
+
/>
|
|
23
|
+
)
|
|
24
|
+
})}
|
|
25
|
+
{props.script?.map((tag, i) => {
|
|
26
|
+
return (
|
|
27
|
+
<script
|
|
28
|
+
key={"script" + i}
|
|
29
|
+
className={tag["class"]}
|
|
30
|
+
type={tag.type}
|
|
31
|
+
id={tag.id}
|
|
32
|
+
dangerouslySetInnerHTML={{ __html: tag.__code }}
|
|
33
|
+
/>
|
|
34
|
+
)
|
|
35
|
+
})}
|
|
36
|
+
{props.meta?.map((tag, i) => {
|
|
37
|
+
return <meta key={"meta" + i} {...tag} />
|
|
38
|
+
})}
|
|
39
|
+
{props.link?.map((tag, i) => {
|
|
40
|
+
return <link key={"link" + i} {...tag} />
|
|
41
|
+
})}
|
|
42
|
+
</Head>
|
|
43
|
+
)
|
|
44
|
+
}
|
|
@@ -1,18 +1,25 @@
|
|
|
1
1
|
import config from "./ed-config"
|
|
2
|
+
import { fetchWP } from "./fetch-wp"
|
|
2
3
|
|
|
3
4
|
const settings = config.serverless
|
|
4
5
|
|
|
5
6
|
export async function fetchWordpressProps(pathname: string) {
|
|
7
|
+
// Determine the URL for fetching
|
|
6
8
|
const origin = (process.env.SITE_URL as string).replace(/\/$/, "")
|
|
7
9
|
pathname = pathname.replace(/(^\/|\/$)/g, "")
|
|
8
10
|
const propsURL = origin + ("/" + pathname + "/?_props=all").replace(/\/+/, "/")
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
|
|
12
|
+
console.log("Fetching props", propsURL)
|
|
13
|
+
|
|
14
|
+
// Make the request
|
|
15
|
+
let response = await fetchWP(propsURL, {})
|
|
16
|
+
|
|
17
|
+
// Convert to text, rather than JSON — so we can do find-and-replace
|
|
11
18
|
let text = await response.text()
|
|
12
19
|
|
|
13
20
|
// Convert absolute site URL details to relative paths
|
|
14
21
|
text = text.replace(new RegExp(origin.replace(/(http|https)/, `https?`) + "([a-z0-9-_./]+)", "g"), (url) => {
|
|
15
|
-
const path = url.replace(/https?:\/\/[
|
|
22
|
+
const path = url.replace(/https?:\/\/[^\/]+/, "")
|
|
16
23
|
if (path.startsWith("/wp-content/uploads/")) {
|
|
17
24
|
if (settings?.uploads === "proxy") {
|
|
18
25
|
return path
|