eddev 0.2.0-beta.9 → 0.2.2-beta.2
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/blocks/ContentBlocks.js +3 -0
- package/blocks/installGutenbergHooks.js +19 -2
- 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 +11 -1
- 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 +243 -47
- package/build/state/serverless-state.d.ts +26 -0
- package/{config/schema.js → build/state/serverless-state.js} +0 -0
- package/build/workers/codegen-worker-script.js +33 -0
- package/{config/schema.d.ts → build/workers/serverless-worker-dev-script.d.ts} +0 -0
- package/build/workers/serverless-worker-dev-script.js +21 -0
- package/cli/build.dev.js +34 -6
- 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 +17 -9
- package/config/config-schema.js +3 -1
- package/config/get-config.d.ts +39 -0
- package/config/get-config.js +32 -0
- package/config/parse-config.d.ts +8 -4
- 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/{serverless/create-rpc-client.d.ts → hooks/useRPC.d.ts} +18 -18
- package/hooks/useRPC.js +18 -0
- package/package.json +15 -7
- package/routing/routing.js +1 -1
- package/serverless/define-rpc-router.d.ts +5 -1
- package/serverless/define-rpc-router.js +11 -3
- package/serverless/index.d.ts +2 -1
- package/serverless/index.js +3 -1
- package/serverless-template/_utils/PageMeta.tsx +44 -0
- package/serverless-template/_utils/fetch-wordpress-props.ts +14 -3
- package/serverless-template/_utils/fetch-wp.ts +16 -0
- package/serverless-template/global.d.ts +7 -1
- package/serverless-template/next.config.js +10 -3
- 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.js +13 -5
- 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/create-rpc-client.js +0 -20
- package/serverless-template/package-lock.json +0 -641
- package/serverless-template/pages/api/hello.ts +0 -10
|
@@ -0,0 +1,41 @@
|
|
|
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.ToggleButton = void 0;
|
|
15
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
|
+
var icons_1 = require("../../icons");
|
|
17
|
+
var theme_1 = require("../../theme");
|
|
18
|
+
function ToggleButton(props) {
|
|
19
|
+
return ((0, jsx_runtime_1.jsxs)(ToggleButtonStyle, __assign({ onClick: function () { return props.onChange(!props.checked); } }, { children: [props.checked ? icons_1.checkFilled : icons_1.checkEmpty, props.label] }), void 0));
|
|
20
|
+
}
|
|
21
|
+
exports.ToggleButton = ToggleButton;
|
|
22
|
+
var ToggleButtonStyle = (0, theme_1.styled)("button", {
|
|
23
|
+
appearance: "none",
|
|
24
|
+
background: "transparent",
|
|
25
|
+
border: "0px",
|
|
26
|
+
padding: "3px",
|
|
27
|
+
height: "auto",
|
|
28
|
+
display: "inline-flex",
|
|
29
|
+
alignItems: "center",
|
|
30
|
+
justifyContent: "center",
|
|
31
|
+
color: "inherit",
|
|
32
|
+
"&:hover": {
|
|
33
|
+
// backgroundColor: "$bgHover",
|
|
34
|
+
},
|
|
35
|
+
svg: {
|
|
36
|
+
fill: "$fg",
|
|
37
|
+
width: "14px",
|
|
38
|
+
height: "14px",
|
|
39
|
+
display: "block",
|
|
40
|
+
},
|
|
41
|
+
});
|
|
@@ -0,0 +1,66 @@
|
|
|
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
|
+
var _a;
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.Tooltip = void 0;
|
|
16
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
17
|
+
var theme_1 = require("../../theme");
|
|
18
|
+
function Tooltip(props) {
|
|
19
|
+
return ((0, jsx_runtime_1.jsxs)(Wrapper, { children: [(0, jsx_runtime_1.jsx)(TooltipStyle, __assign({ css: { $$offset: (typeof props.offset === "number" ? props.offset : 5) + "px" }, nowrap: props.nowrap, mono: props.mono }, { children: props.label }), void 0), props.children] }, void 0));
|
|
20
|
+
}
|
|
21
|
+
exports.Tooltip = Tooltip;
|
|
22
|
+
var TooltipStyle = (0, theme_1.styled)("div", {
|
|
23
|
+
position: "absolute",
|
|
24
|
+
bottom: "calc(100% + $$offset)",
|
|
25
|
+
left: "50%",
|
|
26
|
+
transform: "translateX(-50%)",
|
|
27
|
+
backgroundColor: "#f0f0f0",
|
|
28
|
+
color: "#000000",
|
|
29
|
+
borderRadius: "100px",
|
|
30
|
+
fontSize: "$sm",
|
|
31
|
+
padding: "3px 10px",
|
|
32
|
+
opacity: 0,
|
|
33
|
+
pointerEvents: "none",
|
|
34
|
+
fontWeight: "normal",
|
|
35
|
+
"&:after": {
|
|
36
|
+
backgroundColor: "inherit",
|
|
37
|
+
content: '" "',
|
|
38
|
+
width: "5px",
|
|
39
|
+
height: "5px",
|
|
40
|
+
display: "block",
|
|
41
|
+
position: "absolute",
|
|
42
|
+
top: "100%",
|
|
43
|
+
left: "50%",
|
|
44
|
+
transform: "translate(-50%, -50%) rotate(45deg)",
|
|
45
|
+
},
|
|
46
|
+
variants: {
|
|
47
|
+
mono: {
|
|
48
|
+
true: {
|
|
49
|
+
fontFamily: "$mono",
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
nowrap: {
|
|
53
|
+
true: {
|
|
54
|
+
whiteSpace: "nowrap",
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
var Wrapper = (0, theme_1.styled)("div", {
|
|
60
|
+
position: "relative",
|
|
61
|
+
"&:hover": (_a = {},
|
|
62
|
+
_a[TooltipStyle.toString()] = {
|
|
63
|
+
opacity: 1,
|
|
64
|
+
},
|
|
65
|
+
_a),
|
|
66
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
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.PageDataDebugger = void 0;
|
|
15
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
|
+
var react_inspector_1 = require("react-inspector");
|
|
17
|
+
var routing_1 = require("../../../routing");
|
|
18
|
+
var theme_1 = require("../../theme");
|
|
19
|
+
var PanelWrapper_1 = require("../PanelWrapper");
|
|
20
|
+
function PageDataDebugger() {
|
|
21
|
+
var _a;
|
|
22
|
+
var route = (0, routing_1.useRoute)();
|
|
23
|
+
return ((0, jsx_runtime_1.jsx)(PanelWrapper_1.PanelWrapper, __assign({ title: "Page Data" }, { children: (0, jsx_runtime_1.jsx)(Wrapper, { children: (0, jsx_runtime_1.jsx)(react_inspector_1.ObjectInspector, { theme: "chromeDark", data: (_a = route.data) === null || _a === void 0 ? void 0 : _a.viewData.data, expandLevel: 3 }, void 0) }, void 0) }), void 0));
|
|
24
|
+
}
|
|
25
|
+
exports.PageDataDebugger = PageDataDebugger;
|
|
26
|
+
var Wrapper = (0, theme_1.styled)("div", {
|
|
27
|
+
width: "500px",
|
|
28
|
+
maxHeight: "calc(100vh - 100px)",
|
|
29
|
+
overflowY: "auto",
|
|
30
|
+
});
|
|
@@ -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.SpacingEditor = 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 PanelWrapper_1 = require("../PanelWrapper");
|
|
21
|
+
var ResponsiveScaleEditor_1 = require("../ResponsiveScaleEditor");
|
|
22
|
+
var useStylesheet_1 = require("../../hooks/useStylesheet");
|
|
23
|
+
var Button_1 = require("../atoms/Button");
|
|
24
|
+
var icons_1 = require("../../icons");
|
|
25
|
+
var Spacer_1 = require("../atoms/Spacer");
|
|
26
|
+
function spaceToJSON(space) {
|
|
27
|
+
return ("{\n" +
|
|
28
|
+
Object.entries(space)
|
|
29
|
+
.map(function (_a) {
|
|
30
|
+
var token = _a[0], values = _a[1];
|
|
31
|
+
var tokenStr = Object.entries(values)
|
|
32
|
+
.map(function (_a) {
|
|
33
|
+
var breakpoint = _a[0], value = _a[1];
|
|
34
|
+
return "\"".concat(breakpoint, "\": ").concat(JSON.stringify(value));
|
|
35
|
+
})
|
|
36
|
+
.join(", ");
|
|
37
|
+
return " \"".concat(token, "\": { ").concat(tokenStr, " }");
|
|
38
|
+
})
|
|
39
|
+
.join(",\n") +
|
|
40
|
+
"\n}");
|
|
41
|
+
}
|
|
42
|
+
function spaceToCSS(space) {
|
|
43
|
+
var parsedBreakpoints = (0, style_1.parseBreakpoints)(_theme_1.originalConfig.breakpoints, _theme_1.originalConfig.media);
|
|
44
|
+
var globalResponsive = (0, style_1.parseResponsiveTokens)({
|
|
45
|
+
space: space,
|
|
46
|
+
}, parsedBreakpoints).globalResponsive;
|
|
47
|
+
var rules = [];
|
|
48
|
+
Object.entries(globalResponsive).forEach(function (_a) {
|
|
49
|
+
var breakpoint = _a[0], values = _a[1];
|
|
50
|
+
var rule = "";
|
|
51
|
+
var media = _theme_1.originalConfig.media[breakpoint.replace("@", "")];
|
|
52
|
+
var variables = [];
|
|
53
|
+
for (var key in values) {
|
|
54
|
+
variables.push(key + ": " + values[key]);
|
|
55
|
+
}
|
|
56
|
+
if (media) {
|
|
57
|
+
rules.push("@media " + media + " {\n:root {" + variables.join(";\n") + "}\n}");
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
rules.push(":root {\n" + variables.join(";\n") + "\n}");
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
return rules.join("\n");
|
|
64
|
+
}
|
|
65
|
+
function SpacingEditor() {
|
|
66
|
+
var _a = (0, react_1.useState)(function () { return _theme_1.originalConfig.responsive.space; }), values = _a[0], setValues = _a[1];
|
|
67
|
+
var parsedBreakpoints = (0, style_1.parseBreakpoints)(_theme_1.originalConfig.breakpoints, _theme_1.originalConfig.media);
|
|
68
|
+
var stylesheet = (0, useStylesheet_1.useStylesheet)("spacing");
|
|
69
|
+
(0, react_1.useEffect)(function () {
|
|
70
|
+
stylesheet.set(spaceToCSS(values));
|
|
71
|
+
}, [values]);
|
|
72
|
+
return ((0, jsx_runtime_1.jsx)(react_1.Fragment, { children: (0, jsx_runtime_1.jsx)(PanelWrapper_1.PanelWrapper, __assign({ title: "Spacing Tokens", buttons: (0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(Button_1.Button, __assign({ small: true, onClick: function () {
|
|
73
|
+
navigator.clipboard.writeText(spaceToJSON(values));
|
|
74
|
+
} }, { children: [icons_1.copy, "Copy"] }), void 0), (0, jsx_runtime_1.jsxs)(Button_1.Button, __assign({ small: true, onClick: function () {
|
|
75
|
+
navigator.clipboard.readText().then(function (text) {
|
|
76
|
+
try {
|
|
77
|
+
var data = JSON.parse(text);
|
|
78
|
+
setValues(data);
|
|
79
|
+
}
|
|
80
|
+
catch (err) {
|
|
81
|
+
alert("Error decoding pasted content: " + err.message + ". You pasted:\n" + text);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
} }, { 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: function () {
|
|
85
|
+
setValues(_theme_1.originalConfig.responsive.space);
|
|
86
|
+
} }, { children: [icons_1.trash, " Reset"] }), void 0)] }, void 0) }, { children: (0, jsx_runtime_1.jsx)(ResponsiveScaleEditor_1.ResponsiveScaleEditor, { editableRange: true, editableValues: true, breakpoints: parsedBreakpoints, data: values, showBreakpointName: true, showRange: true, showValues: true, related: true, labelWidth: "30px", onChange: setValues, modes: ["px", "multiplier"] }, void 0) }), void 0) }, void 0));
|
|
87
|
+
}
|
|
88
|
+
exports.SpacingEditor = SpacingEditor;
|
|
@@ -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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function usePersistState<T>(id: string, initial: T): [T, (value: T) => void];
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.usePersistState = void 0;
|
|
4
|
+
var react_1 = require("react");
|
|
5
|
+
var get = function (id, fallback) {
|
|
6
|
+
if (fallback === void 0) { fallback = undefined; }
|
|
7
|
+
if (typeof localStorage === "undefined") {
|
|
8
|
+
return fallback;
|
|
9
|
+
}
|
|
10
|
+
var value = localStorage.getItem("devui_" + id);
|
|
11
|
+
if (value !== null) {
|
|
12
|
+
try {
|
|
13
|
+
return JSON.parse(value);
|
|
14
|
+
}
|
|
15
|
+
catch (err) {
|
|
16
|
+
return fallback;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
return fallback;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
var set = function (id, value) {
|
|
24
|
+
localStorage.setItem("devui_" + id, JSON.stringify(value));
|
|
25
|
+
};
|
|
26
|
+
function usePersistState(id, initial) {
|
|
27
|
+
var _a = (0, react_1.useState)(function () { return get(id, initial); }), value = _a[0], setValue = _a[1];
|
|
28
|
+
return [
|
|
29
|
+
value,
|
|
30
|
+
function (value) {
|
|
31
|
+
set(id, value);
|
|
32
|
+
setValue(value);
|
|
33
|
+
},
|
|
34
|
+
];
|
|
35
|
+
}
|
|
36
|
+
exports.usePersistState = usePersistState;
|
|
@@ -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;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const bolt: JSX.Element;
|
|
3
|
+
export declare const typography: JSX.Element;
|
|
4
|
+
export declare const ruler: JSX.Element;
|
|
5
|
+
export declare const structure: JSX.Element;
|
|
6
|
+
export declare const code: JSX.Element;
|
|
7
|
+
export declare const share: JSX.Element;
|
|
8
|
+
export declare const close: JSX.Element;
|
|
9
|
+
export declare const check: JSX.Element;
|
|
10
|
+
export declare const checkEmpty: JSX.Element;
|
|
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
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
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.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
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
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
|
+
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));
|
|
18
|
+
exports.ruler = ((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: "M23 6H1v12h22V6zm-2 10H3V8h2v4h2V8h2v4h2V8h2v4h2V8h2v4h2V8h2v8z" }, void 0)] }), void 0));
|
|
19
|
+
exports.structure = ((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" }, void 0) }, void 0), (0, jsx_runtime_1.jsx)("polygon", { points: "22,11 22,3 15,3 15,6 9,6 9,3 2,3 2,11 9,11 9,8 11,8 11,18 15,18 15,21 22,21 22,13 15,13 15,16 13,16 13,8 15,8 15,11" }, void 0)] }), void 0));
|
|
20
|
+
exports.code = ((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.4 16.6L4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4zm5.2 0l4.6-4.6-4.6-4.6L16 6l6 6-6 6-1.4-1.4z" }, void 0)] }), void 0));
|
|
21
|
+
exports.share = ((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" }, void 0) }, void 0), (0, jsx_runtime_1.jsx)("g", { children: (0, jsx_runtime_1.jsxs)("g", { children: [(0, jsx_runtime_1.jsx)("g", { children: (0, jsx_runtime_1.jsx)("polygon", { points: "23,3 1,3 1,13 3,13 3,5 21,5 21,21 23,21" }, void 0) }, void 0), (0, jsx_runtime_1.jsx)("g", { children: (0, jsx_runtime_1.jsx)("circle", { cx: "9", cy: "10", r: "4" }, void 0) }, void 0), (0, jsx_runtime_1.jsx)("g", { children: (0, jsx_runtime_1.jsx)("path", { d: "M15.39,16.56C13.71,15.7,11.53,15,9,15c-2.53,0-4.71,0.7-6.39,1.56C1.61,17.07,1,18.1,1,19.22V22h16v-2.78 C17,18.1,16.39,17.07,15.39,16.56z" }, void 0) }, void 0)] }, void 0) }, void 0)] }), void 0));
|
|
22
|
+
exports.close = ((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 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z" }, void 0)] }), void 0));
|
|
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
|
+
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
|
+
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));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./components/DevUI";
|
package/dev-ui/index.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
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;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ComponentType, ReactNode } from "react";
|
|
2
|
+
declare type DevUIPanelItem = {
|
|
3
|
+
label: string;
|
|
4
|
+
icon: ReactNode;
|
|
5
|
+
component: ComponentType;
|
|
6
|
+
};
|
|
7
|
+
export declare const DEV_UI_PANELS: {
|
|
8
|
+
[key: string]: DevUIPanelItem;
|
|
9
|
+
};
|
|
10
|
+
export declare type PanelID = keyof typeof DEV_UI_PANELS;
|
|
11
|
+
export {};
|