eddev 0.2.67-beta1 → 0.3.0-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 -2
- package/admin/components/ImageWell.js +51 -39
- package/admin/defineField.d.ts +2 -2
- package/admin/defineWidget.d.ts +1 -1
- package/admin/defineWidget.js +2 -2
- package/admin/index.js +1 -5
- package/admin/installFieldTypes.js +26 -26
- package/admin/runWidgets.js +28 -17
- package/admin/selectMedia.d.ts +2 -2
- package/admin/selectMedia.js +1 -1
- package/blocks/ContentBlocks.d.ts +6 -6
- package/blocks/ContentBlocks.js +66 -58
- package/blocks/ErrorBoundaryEditor.d.ts +1 -1
- package/blocks/ErrorBoundaryEditor.js +45 -16
- package/blocks/ErrorBoundaryFrontend.d.ts +1 -1
- package/blocks/ErrorBoundaryFrontend.js +45 -16
- package/blocks/InspectorControls.d.ts +1 -1
- package/blocks/InspectorControls.js +3 -3
- package/blocks/blockAttributes.d.ts +2 -2
- package/blocks/blockAttributes.js +44 -24
- package/blocks/index.js +1 -5
- package/blocks/inlineEditing.d.ts +6 -6
- package/blocks/inlineEditing.js +55 -36
- package/blocks/installGutenbergHooks.js +68 -48
- package/build/babel/plugin-name-defined-components.js +16 -15
- package/build/build-favicon.js +62 -11
- package/build/clean.js +52 -5
- package/build/create-codegen-worker.js +33 -78
- package/build/create-serverless-dev-worker.js +39 -61
- package/build/create-webpack-worker.js +33 -65
- package/build/file-tree.d.ts +2 -2
- package/build/file-tree.js +12 -12
- package/build/get-webpack-config.js +395 -341
- package/build/graphql-codegen/graphql-codegen-files.js +25 -31
- package/build/graphql-codegen/graphql-codegen-no-duplicates.js +4 -4
- package/build/graphql-codegen/graphql-codegen-queries.js +99 -102
- package/build/manifests/manifest-blocks.d.ts +1 -1
- package/build/manifests/manifest-blocks.js +29 -37
- package/build/manifests/manifest-fields.d.ts +1 -1
- package/build/manifests/manifest-fields.js +21 -23
- package/build/manifests/manifest-views.d.ts +1 -1
- package/build/manifests/manifest-views.js +25 -32
- package/build/manifests/manifest-widgets.d.ts +1 -1
- package/build/manifests/manifest-widgets.js +20 -22
- package/build/manifests/manifest.d.ts +2 -2
- package/build/manifests/manifest.js +94 -30
- package/build/reporter.d.ts +1 -1
- package/build/reporter.js +32 -29
- package/build/serverless/create-next-app.d.ts +1 -1
- package/build/serverless/create-next-app.js +467 -245
- 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 +519 -393
- package/build/workers/serverless-worker-dev-script.js +4 -4
- package/build/workers/webpack-worker-script.js +156 -90
- package/cli/build.dev.d.ts +1 -1
- package/cli/build.dev.js +126 -79
- package/cli/build.prod.d.ts +1 -1
- package/cli/build.prod.js +98 -42
- package/cli/cli.js +28 -19
- package/cli/display/components/BundleDisplay.d.ts +1 -1
- package/cli/display/components/BundleDisplay.js +24 -13
- package/cli/display/components/CodegenDisplay.d.ts +1 -1
- package/cli/display/components/CodegenDisplay.js +25 -14
- package/cli/display/components/DevCLIDisplay.d.ts +2 -2
- package/cli/display/components/DevCLIDisplay.js +25 -14
- package/cli/display/components/Fullscreen.js +20 -9
- package/cli/display/components/ServerlessDisplay.d.ts +2 -2
- package/cli/display/components/ServerlessDisplay.js +26 -15
- package/cli/display/components/StatusIcon.d.ts +2 -2
- package/cli/display/components/StatusIcon.js +3 -3
- package/cli/preinstall.js +5 -4
- package/cli/setup.js +73 -25
- package/components/AdminBar.d.ts +1 -1
- package/components/AdminBar.js +3 -37
- package/components/BrowserRouter.d.ts +2 -2
- package/components/BrowserRouter.js +54 -41
- package/components/InlinePage.d.ts +2 -2
- package/components/InlinePage.js +29 -17
- package/components/NextRouter.d.ts +2 -2
- package/components/NextRouter.js +29 -20
- package/components/index.js +1 -5
- 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 +13 -10
- package/config/index.js +1 -5
- package/config/parse-config.js +1 -1
- package/config/print-zod-errors.js +3 -3
- package/dev-ui/components/BreakpointColumnHeader.d.ts +2 -2
- package/dev-ui/components/BreakpointColumnHeader.js +18 -7
- package/dev-ui/components/BreakpointIndicator.d.ts +1 -1
- package/dev-ui/components/BreakpointIndicator.js +32 -25
- package/dev-ui/components/DevUI.d.ts +1 -1
- package/dev-ui/components/DevUI.js +13 -13
- package/dev-ui/components/Launcher.d.ts +2 -2
- package/dev-ui/components/Launcher.js +25 -13
- 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 -2
- package/dev-ui/components/ResponsiveLerpControl.js +38 -27
- package/dev-ui/components/ResponsiveScaleEditor.d.ts +4 -4
- package/dev-ui/components/ResponsiveScaleEditor.js +78 -64
- 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 +9 -8
- package/dev-ui/components/atoms/NumberField.d.ts +2 -2
- package/dev-ui/components/atoms/NumberField.js +42 -29
- 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 +16 -5
- package/dev-ui/components/atoms/Tooltip.d.ts +2 -2
- package/dev-ui/components/atoms/Tooltip.js +20 -8
- package/dev-ui/components/panels/AppDataDebugger.d.ts +1 -1
- package/dev-ui/components/panels/AppDataDebugger.js +19 -8
- package/dev-ui/components/panels/ColorEditor.d.ts +1 -1
- package/dev-ui/components/panels/ColorEditor.js +42 -35
- package/dev-ui/components/panels/PageDataDebugger.d.ts +1 -1
- package/dev-ui/components/panels/PageDataDebugger.js +20 -8
- package/dev-ui/components/panels/QueryDebugger.d.ts +1 -1
- package/dev-ui/components/panels/QueryDebugger.js +24 -12
- package/dev-ui/components/panels/SpacingEditor.d.ts +1 -1
- package/dev-ui/components/panels/SpacingEditor.js +48 -34
- package/dev-ui/components/panels/TypographyEditor.d.ts +1 -1
- package/dev-ui/components/panels/TypographyEditor.js +46 -38
- package/dev-ui/hooks/useBreakpoint.d.ts +1 -1
- package/dev-ui/hooks/useBreakpoint.js +13 -13
- package/dev-ui/hooks/usePersistState.js +7 -6
- package/dev-ui/hooks/useStylesheet.js +6 -6
- package/dev-ui/icons.d.ts +15 -15
- package/dev-ui/icons.js +27 -16
- package/dev-ui/index.js +1 -5
- package/dev-ui/loader.d.ts +1 -1
- package/dev-ui/loader.js +9 -13
- package/dev-ui/panels.d.ts +2 -2
- package/dev-ui/panels.js +7 -7
- package/dev-ui/theme.js +3 -3
- package/dynamic/dynamic-component.js +1 -1
- package/dynamic/index.js +1 -5
- package/entry/Root.d.ts +2 -2
- package/entry/Root.js +26 -16
- 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 +1 -5
- package/gravityforms/useGravityForm.d.ts +2 -2
- package/gravityforms/useGravityForm.js +130 -126
- package/hooks/index.js +1 -5
- package/hooks/queryUtils.d.ts +14 -14
- package/hooks/queryUtils.js +192 -101
- 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 +11 -11
- package/routing/index.js +1 -5
- package/routing/remoteProps.d.ts +1 -1
- package/routing/remoteProps.js +72 -31
- package/routing/routing.d.ts +25 -15
- package/routing/routing.js +200 -112
- package/routing/updateEditLink.js +1 -1
- package/serverless/define-api.d.ts +1 -1
- package/serverless/define-rpc-router.js +4 -8
- package/serverless/index.js +2 -6
- package/style/createStitches.js +142 -164
- package/style/index.js +1 -5
- package/tsconfig.json +1 -1
- package/utils/Observable.d.ts +2 -2
- package/utils/Observable.js +15 -12
- package/utils/getRepoName.js +3 -3
- package/utils/promptIfRepoNameIncorrect.js +64 -18
- 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 +69 -19
- package/utils/useObservable.js +3 -3
- package/views/index.js +1 -5
|
@@ -1,16 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
2
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
14
|
exports.ColorEditor = void 0;
|
|
4
|
-
|
|
15
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
16
|
// @ts-ignore
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
17
|
+
var _theme_1 = require("@theme");
|
|
18
|
+
var react_1 = require("react");
|
|
19
|
+
var PanelWrapper_1 = require("../PanelWrapper");
|
|
20
|
+
var useStylesheet_1 = require("../../hooks/useStylesheet");
|
|
21
|
+
var Button_1 = require("../atoms/Button");
|
|
22
|
+
var icons_1 = require("../../icons");
|
|
23
|
+
var Spacer_1 = require("../atoms/Spacer");
|
|
24
|
+
var theme_1 = require("../../theme");
|
|
14
25
|
function colorsToJSON(values) {
|
|
15
26
|
return JSON.stringify(values, null, 2);
|
|
16
27
|
// return (
|
|
@@ -29,15 +40,12 @@ function colorsToJSON(values) {
|
|
|
29
40
|
// )
|
|
30
41
|
}
|
|
31
42
|
function colorsToCSS(values) {
|
|
32
|
-
return
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
.
|
|
36
|
-
return `--colors-${token}: ${value};`;
|
|
43
|
+
return "\n body {\n ".concat(Object.entries(values)
|
|
44
|
+
.map(function (_a) {
|
|
45
|
+
var token = _a[0], value = _a[1];
|
|
46
|
+
return "--colors-".concat(token, ": ").concat(value, ";");
|
|
37
47
|
})
|
|
38
|
-
.join("\n")}
|
|
39
|
-
}
|
|
40
|
-
`;
|
|
48
|
+
.join("\n"), "\n }\n ");
|
|
41
49
|
// const parsedBreakpoints = parseBreakpoints(originalConfig.breakpoints, originalConfig.media)
|
|
42
50
|
// const { globalResponsive } = parseResponsiveTokens(
|
|
43
51
|
// {
|
|
@@ -62,41 +70,40 @@ function colorsToCSS(values) {
|
|
|
62
70
|
// return rules.join("\n")
|
|
63
71
|
}
|
|
64
72
|
function ColorEditor() {
|
|
65
|
-
|
|
73
|
+
var _a = (0, react_1.useState)(function () { return _theme_1.originalConfig.theme.colors; }), values = _a[0], setValues = _a[1];
|
|
66
74
|
console.log("COLOR", values, _theme_1.originalConfig);
|
|
67
|
-
|
|
68
|
-
(0, react_1.useEffect)(()
|
|
75
|
+
var stylesheet = (0, useStylesheet_1.useStylesheet)("colors");
|
|
76
|
+
(0, react_1.useEffect)(function () {
|
|
69
77
|
stylesheet.set(colorsToCSS(values));
|
|
70
78
|
}, [values]);
|
|
71
|
-
return ((0, jsx_runtime_1.jsx)(react_1.Fragment, { children: (0, jsx_runtime_1.jsx)(PanelWrapper_1.PanelWrapper, { title: "Colour Tokens", buttons: (0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(Button_1.Button, { small: true, onClick: ()
|
|
79
|
+
return ((0, jsx_runtime_1.jsx)(react_1.Fragment, { children: (0, jsx_runtime_1.jsx)(PanelWrapper_1.PanelWrapper, __assign({ title: "Colour Tokens", buttons: (0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(Button_1.Button, __assign({ small: true, onClick: function () {
|
|
72
80
|
navigator.clipboard.writeText(colorsToJSON(values));
|
|
73
|
-
}, children: [icons_1.copy, "Copy"] }), (0, jsx_runtime_1.jsxs)(Button_1.Button, { small: true, onClick: ()
|
|
74
|
-
navigator.clipboard.readText().then((text)
|
|
81
|
+
} }, { children: [icons_1.copy, "Copy"] }), void 0), (0, jsx_runtime_1.jsxs)(Button_1.Button, __assign({ small: true, onClick: function () {
|
|
82
|
+
navigator.clipboard.readText().then(function (text) {
|
|
75
83
|
try {
|
|
76
|
-
|
|
84
|
+
var data = JSON.parse(text);
|
|
77
85
|
setValues(data);
|
|
78
86
|
}
|
|
79
87
|
catch (err) {
|
|
80
88
|
alert("Error decoding pasted content: " + err.message + ". You pasted:\n" + text);
|
|
81
89
|
}
|
|
82
90
|
});
|
|
83
|
-
}, children: [icons_1.paste, "Paste"] }), (0, jsx_runtime_1.jsx)(Spacer_1.Spacer, {}), (0, jsx_runtime_1.jsxs)(Button_1.Button, { small: true, onClick: ()
|
|
91
|
+
} }, { 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 () {
|
|
84
92
|
setValues(_theme_1.originalConfig.theme.colors);
|
|
85
|
-
}, children: [icons_1.trash, " Reset"] })] }), children: Object.entries(values).map((
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}) }) }));
|
|
93
|
+
} }, { children: [icons_1.trash, " Reset"] }), void 0)] }, void 0) }, { children: Object.entries(values).map(function (_a) {
|
|
94
|
+
var token = _a[0], value = _a[1];
|
|
95
|
+
return ((0, jsx_runtime_1.jsxs)(ColorRow, { children: [(0, jsx_runtime_1.jsxs)(Cell, __assign({ mono: true }, { children: ["$", token] }), void 0), (0, jsx_runtime_1.jsx)(Cell, __assign({ mono: true, small: true }, { children: value }), void 0), (0, jsx_runtime_1.jsx)(Cell, { children: (0, jsx_runtime_1.jsx)("input", { type: "color", value: value, onChange: function (e) {
|
|
96
|
+
var _a;
|
|
97
|
+
setValues(__assign(__assign({}, values), (_a = {}, _a[token] = e.target.value, _a)));
|
|
98
|
+
} }, void 0) }, void 0)] }, void 0));
|
|
99
|
+
}) }), void 0) }, void 0));
|
|
93
100
|
}
|
|
94
101
|
exports.ColorEditor = ColorEditor;
|
|
95
|
-
|
|
102
|
+
var ColorRow = (0, theme_1.styled)("div", {
|
|
96
103
|
display: "flex",
|
|
97
104
|
borderBottom: "1px solid $$lineColor",
|
|
98
105
|
});
|
|
99
|
-
|
|
106
|
+
var Cell = (0, theme_1.styled)("div", {
|
|
100
107
|
flex: "0 0 150px",
|
|
101
108
|
variants: {
|
|
102
109
|
mono: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function PageDataDebugger():
|
|
1
|
+
export declare function PageDataDebugger(): JSX.Element;
|
|
@@ -1,17 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
2
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
14
|
exports.PageDataDebugger = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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");
|
|
9
20
|
function PageDataDebugger() {
|
|
10
|
-
|
|
11
|
-
|
|
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));
|
|
12
24
|
}
|
|
13
25
|
exports.PageDataDebugger = PageDataDebugger;
|
|
14
|
-
|
|
26
|
+
var Wrapper = (0, theme_1.styled)("div", {
|
|
15
27
|
width: "500px",
|
|
16
28
|
maxHeight: "calc(100vh - 100px)",
|
|
17
29
|
overflowY: "auto",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function QueryDebugger():
|
|
1
|
+
export declare function QueryDebugger(): JSX.Element;
|
|
@@ -1,21 +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
|
+
};
|
|
2
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
14
|
exports.QueryDebugger = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
15
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
|
+
var react_1 = require("@stitches/react");
|
|
17
|
+
var react_2 = require("react");
|
|
18
|
+
var useQueryDebug_1 = require("../../../hooks/useQueryDebug");
|
|
19
|
+
var PanelWrapper_1 = require("../PanelWrapper");
|
|
9
20
|
function QueryDebugger() {
|
|
10
|
-
|
|
11
|
-
return ((0, jsx_runtime_1.jsx)(PanelWrapper_1.PanelWrapper, { title: "Query Debugger", children: (0, jsx_runtime_1.jsx)(Wrapper, { children: data ? (0, jsx_runtime_1.jsx)(Item, { item: data, depth: 0 }) : (0, jsx_runtime_1.jsx)("div", { children: "No data" }) }) }));
|
|
21
|
+
var data = (0, useQueryDebug_1.useQueryDebugData)();
|
|
22
|
+
return ((0, jsx_runtime_1.jsx)(PanelWrapper_1.PanelWrapper, __assign({ title: "Query Debugger" }, { children: (0, jsx_runtime_1.jsx)(Wrapper, { children: data ? (0, jsx_runtime_1.jsx)(Item, { item: data, depth: 0 }, void 0) : (0, jsx_runtime_1.jsx)("div", { children: "No data" }, void 0) }, void 0) }), void 0));
|
|
12
23
|
}
|
|
13
24
|
exports.QueryDebugger = QueryDebugger;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
25
|
+
var Item = function (_a) {
|
|
26
|
+
var item = _a.item, depth = _a.depth;
|
|
27
|
+
var _b = (0, react_2.useState)(depth < 3), expanded = _b[0], setExpanded = _b[1];
|
|
28
|
+
return ((0, jsx_runtime_1.jsxs)(ItemStyle, { children: [(0, jsx_runtime_1.jsxs)("div", __assign({ className: "query-item-heading" }, { children: ["\u2022 ", (0, jsx_runtime_1.jsx)("strong", { children: item.label }, void 0), " ", (0, jsx_runtime_1.jsx)("code", { children: item.file }, void 0), " (", Number(item.duration).toFixed(1), "s)"] }), void 0), item.errors && item.errors.length ? ((0, jsx_runtime_1.jsx)("div", __assign({ className: "query-errors" }, { children: item.errors.map(function (err, i) { return ((0, jsx_runtime_1.jsxs)("div", __assign({ className: "query-error-item" }, { children: ["\u2022 ", err] }), i)); }) }), void 0)) : null, item.children && item.children.length ? ((0, jsx_runtime_1.jsx)("div", __assign({ className: "query-children" }, { children: item.children.map(function (child, i) { return ((0, jsx_runtime_1.jsx)(Item, { item: child, depth: depth + 1 }, i)); }) }), void 0)) : null] }, void 0));
|
|
17
29
|
};
|
|
18
|
-
|
|
30
|
+
var ItemStyle = (0, react_1.styled)("div", {
|
|
19
31
|
fontSize: "12px",
|
|
20
32
|
".query-children": {
|
|
21
33
|
paddingLeft: "30px",
|
|
@@ -28,7 +40,7 @@ const ItemStyle = (0, react_1.styled)("div", {
|
|
|
28
40
|
},
|
|
29
41
|
},
|
|
30
42
|
});
|
|
31
|
-
|
|
43
|
+
var Wrapper = (0, react_1.styled)("div", {
|
|
32
44
|
maxHeight: 500,
|
|
33
45
|
overflowY: "auto",
|
|
34
46
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function SpacingEditor():
|
|
1
|
+
export declare function SpacingEditor(): JSX.Element;
|
|
@@ -1,42 +1,56 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
2
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
14
|
exports.SpacingEditor = void 0;
|
|
4
|
-
|
|
15
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
16
|
// @ts-ignore
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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");
|
|
15
26
|
function spaceToJSON(space) {
|
|
16
27
|
return ("{\n" +
|
|
17
28
|
Object.entries(space)
|
|
18
|
-
.map((
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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));
|
|
22
35
|
})
|
|
23
36
|
.join(", ");
|
|
24
|
-
return
|
|
37
|
+
return " \"".concat(token, "\": { ").concat(tokenStr, " }");
|
|
25
38
|
})
|
|
26
39
|
.join(",\n") +
|
|
27
40
|
"\n}");
|
|
28
41
|
}
|
|
29
42
|
function spaceToCSS(space) {
|
|
30
|
-
|
|
31
|
-
|
|
43
|
+
var parsedBreakpoints = (0, style_1.parseBreakpoints)(_theme_1.originalConfig.breakpoints, _theme_1.originalConfig.media);
|
|
44
|
+
var globalResponsive = (0, style_1.parseResponsiveTokens)({
|
|
32
45
|
space: space,
|
|
33
|
-
}, parsedBreakpoints);
|
|
34
|
-
|
|
35
|
-
Object.entries(globalResponsive).forEach((
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
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) {
|
|
40
54
|
variables.push(key + ": " + values[key]);
|
|
41
55
|
}
|
|
42
56
|
if (media) {
|
|
@@ -49,26 +63,26 @@ function spaceToCSS(space) {
|
|
|
49
63
|
return rules.join("\n");
|
|
50
64
|
}
|
|
51
65
|
function SpacingEditor() {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
(0, react_1.useEffect)(()
|
|
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 () {
|
|
56
70
|
stylesheet.set(spaceToCSS(values));
|
|
57
71
|
}, [values]);
|
|
58
|
-
return ((0, jsx_runtime_1.jsx)(react_1.Fragment, { children: (0, jsx_runtime_1.jsx)(PanelWrapper_1.PanelWrapper, { title: "Spacing Tokens", buttons: (0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(Button_1.Button, { small: true, onClick: ()
|
|
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 () {
|
|
59
73
|
navigator.clipboard.writeText(spaceToJSON(values));
|
|
60
|
-
}, children: [icons_1.copy, "Copy"] }), (0, jsx_runtime_1.jsxs)(Button_1.Button, { small: true, onClick: ()
|
|
61
|
-
navigator.clipboard.readText().then((text)
|
|
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) {
|
|
62
76
|
try {
|
|
63
|
-
|
|
77
|
+
var data = JSON.parse(text);
|
|
64
78
|
setValues(data);
|
|
65
79
|
}
|
|
66
80
|
catch (err) {
|
|
67
81
|
alert("Error decoding pasted content: " + err.message + ". You pasted:\n" + text);
|
|
68
82
|
}
|
|
69
83
|
});
|
|
70
|
-
}, children: [icons_1.paste, "Paste"] }), (0, jsx_runtime_1.jsx)(Spacer_1.Spacer, {}), (0, jsx_runtime_1.jsxs)(Button_1.Button, { small: true, onClick: ()
|
|
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 () {
|
|
71
85
|
setValues(_theme_1.originalConfig.responsive.space);
|
|
72
|
-
}, children: [icons_1.trash, " Reset"] })] }), 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"] }) }) }));
|
|
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));
|
|
73
87
|
}
|
|
74
88
|
exports.SpacingEditor = SpacingEditor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function TypographyEditor():
|
|
1
|
+
export declare function TypographyEditor(): JSX.Element;
|
|
@@ -1,24 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
2
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
14
|
exports.TypographyEditor = void 0;
|
|
4
|
-
|
|
15
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
16
|
// @ts-ignore
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
|
+
var ResponsiveScaleEditor_1 = require("../ResponsiveScaleEditor");
|
|
17
28
|
function TypographyEditor() {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
29
|
+
var _a = (0, react_1.useState)(function () { return _theme_1.originalConfig.typography; }), values = _a[0], setValues = _a[1];
|
|
30
|
+
var parsedBreakpoints = (0, style_1.parseBreakpoints)(_theme_1.originalConfig.breakpoints, _theme_1.originalConfig.media);
|
|
31
|
+
var _b = (0, usePersistState_1.usePersistState)("preview_text", "The quick brown fox jumps over the lazy dog"), previewText = _b[0], setPreviewText = _b[1];
|
|
32
|
+
var reset = function () {
|
|
22
33
|
setValues(_theme_1.originalConfig.typography);
|
|
23
34
|
setPreviewText("The quick brown fox jumps over the lazy dog");
|
|
24
35
|
};
|
|
@@ -26,9 +37,9 @@ function TypographyEditor() {
|
|
|
26
37
|
// useEffect(() => {
|
|
27
38
|
// stylesheet.set(spaceToCSS(values))
|
|
28
39
|
// }, [values])
|
|
29
|
-
return ((0, jsx_runtime_1.jsx)(PanelWrapper_1.PanelWrapper, { title: "Typography", buttons: (0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(Button_1.Button, { small: true, onClick: ()
|
|
40
|
+
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 () {
|
|
30
41
|
// navigator.clipboard.writeText(spaceToJSON(values))
|
|
31
|
-
}, children: [icons_1.copy, "Copy"] }), (0, jsx_runtime_1.jsxs)(Button_1.Button, { small: true, onClick: ()
|
|
42
|
+
} }, { children: [icons_1.copy, "Copy"] }), void 0), (0, jsx_runtime_1.jsxs)(Button_1.Button, __assign({ small: true, onClick: function () {
|
|
32
43
|
// navigator.clipboard.readText().then((text) => {
|
|
33
44
|
// try {
|
|
34
45
|
// const data = JSON.parse(text)
|
|
@@ -37,41 +48,38 @@ function TypographyEditor() {
|
|
|
37
48
|
// alert("Error decoding pasted content: " + (err as any).message + ". You pasted:\n" + text)
|
|
38
49
|
// }
|
|
39
50
|
// })
|
|
40
|
-
}, children: [icons_1.paste, "Paste"] }), (0, jsx_runtime_1.jsx)(Spacer_1.Spacer, {}), (0, jsx_runtime_1.jsxs)(Button_1.Button, { small: true, onClick: reset, children: [icons_1.trash, " Reset"] })
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
},
|
|
53
|
-
});
|
|
54
|
-
}, modes: ["px", "multiplier"] })] })] }, index))) }) }));
|
|
51
|
+
} }, { 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) {
|
|
52
|
+
var name = _a[0], settings = _a[1];
|
|
53
|
+
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.jsxs)(Details, { children: [(0, jsx_runtime_1.jsx)(Preview, { css: { typography: name }, value: previewText, onChange: function (e) {
|
|
54
|
+
setPreviewText(e.currentTarget.value);
|
|
55
|
+
} }, void 0), (0, jsx_runtime_1.jsx)(ResponsiveScaleEditor_1.ResponsiveScaleEditor, { editableRange: true, editableValues: true, breakpoints: parsedBreakpoints, data: {
|
|
56
|
+
fontSize: settings.fontSize,
|
|
57
|
+
lineHeight: settings.lineHeight,
|
|
58
|
+
}, showBreakpointName: true, showRange: true, showValues: true, labelWidth: "80px", onChange: function (data) {
|
|
59
|
+
var _a;
|
|
60
|
+
setValues(__assign(__assign({}, values), (_a = {}, _a[name] = __assign(__assign({}, settings), { fontSize: data.fontSize, lineHeight: data.lineHeight }), _a)));
|
|
61
|
+
}, modes: ["px", "multiplier"] }, void 0)] }, void 0)] }, index));
|
|
62
|
+
}) }, void 0) }), void 0));
|
|
55
63
|
}
|
|
56
64
|
exports.TypographyEditor = TypographyEditor;
|
|
57
|
-
|
|
65
|
+
var TypographyItem = (0, theme_1.styled)("div", {
|
|
58
66
|
borderBottom: "1px solid $colors$bgLineStrong",
|
|
59
67
|
display: "flex",
|
|
60
68
|
paddingTop: "4px",
|
|
61
69
|
paddingBottom: "4px",
|
|
62
70
|
});
|
|
63
|
-
|
|
71
|
+
var Meta = (0, theme_1.styled)("div", {
|
|
64
72
|
width: "200px",
|
|
65
73
|
flex: "0 0 auto",
|
|
66
74
|
});
|
|
67
|
-
|
|
75
|
+
var Wrapper = (0, theme_1.styled)("div", {
|
|
68
76
|
maxHeight: "500px",
|
|
69
77
|
overflowY: "auto",
|
|
70
78
|
});
|
|
71
|
-
|
|
79
|
+
var Details = (0, theme_1.styled)("div", {
|
|
72
80
|
flex: "1 1 auto",
|
|
73
81
|
});
|
|
74
|
-
|
|
82
|
+
var Preview = (0, _theme_1.styled)("input", {
|
|
75
83
|
appearance: "none",
|
|
76
84
|
backgroundColor: "transparent",
|
|
77
85
|
borderLeft: 0,
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useBreakpoint = void 0;
|
|
4
4
|
// @ts-ignore
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
var _theme_1 = require("@theme");
|
|
6
|
+
var react_1 = require("react");
|
|
7
7
|
function useBreakpoint() {
|
|
8
8
|
// const [value, setValue] = useState(["initial", -1, 0] as [string, number, number])
|
|
9
|
-
|
|
9
|
+
var _a = (0, react_1.useState)({
|
|
10
10
|
name: "initial",
|
|
11
11
|
index: -1,
|
|
12
12
|
progress: 0,
|
|
@@ -14,11 +14,11 @@ function useBreakpoint() {
|
|
|
14
14
|
width: 0,
|
|
15
15
|
bpMin: 0,
|
|
16
16
|
bpMax: 0,
|
|
17
|
-
});
|
|
18
|
-
(0, react_1.useEffect)(()
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
22
|
name: "initial",
|
|
23
23
|
index: 0,
|
|
24
24
|
offset: window.innerWidth,
|
|
@@ -27,10 +27,10 @@ function useBreakpoint() {
|
|
|
27
27
|
bpMin: 0,
|
|
28
28
|
bpMax: _theme_1.breakpoints[0].max,
|
|
29
29
|
};
|
|
30
|
-
for (
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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
34
|
if (!media.includes("min-width") || !media)
|
|
35
35
|
continue;
|
|
36
36
|
if (window.matchMedia(media).matches) {
|
|
@@ -52,7 +52,7 @@ function useBreakpoint() {
|
|
|
52
52
|
};
|
|
53
53
|
handle();
|
|
54
54
|
window.addEventListener("resize", handle);
|
|
55
|
-
return ()
|
|
55
|
+
return function () { return window.removeEventListener("resize", handle); };
|
|
56
56
|
}, []);
|
|
57
57
|
return value;
|
|
58
58
|
}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.usePersistState = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
var react_1 = require("react");
|
|
5
|
+
var get = function (id, fallback) {
|
|
6
|
+
if (fallback === void 0) { fallback = undefined; }
|
|
6
7
|
if (typeof localStorage === "undefined") {
|
|
7
8
|
return fallback;
|
|
8
9
|
}
|
|
9
|
-
|
|
10
|
+
var value = localStorage.getItem("devui_" + id);
|
|
10
11
|
if (value !== null) {
|
|
11
12
|
try {
|
|
12
13
|
return JSON.parse(value);
|
|
@@ -19,14 +20,14 @@ const get = (id, fallback = undefined) => {
|
|
|
19
20
|
return fallback;
|
|
20
21
|
}
|
|
21
22
|
};
|
|
22
|
-
|
|
23
|
+
var set = function (id, value) {
|
|
23
24
|
localStorage.setItem("devui_" + id, JSON.stringify(value));
|
|
24
25
|
};
|
|
25
26
|
function usePersistState(id, initial) {
|
|
26
|
-
|
|
27
|
+
var _a = (0, react_1.useState)(function () { return get(id, initial); }), value = _a[0], setValue = _a[1];
|
|
27
28
|
return [
|
|
28
29
|
value,
|
|
29
|
-
(value)
|
|
30
|
+
function (value) {
|
|
30
31
|
set(id, value);
|
|
31
32
|
setValue(value);
|
|
32
33
|
},
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useStylesheet = void 0;
|
|
4
|
-
|
|
4
|
+
var react_1 = require("react");
|
|
5
5
|
function useStylesheet(id) {
|
|
6
|
-
|
|
7
|
-
(0, react_1.useEffect)(()
|
|
6
|
+
var _a = (0, react_1.useState)(null), element = _a[0], setElement = _a[1];
|
|
7
|
+
(0, react_1.useEffect)(function () {
|
|
8
8
|
if (!element) {
|
|
9
|
-
|
|
9
|
+
var style = document.getElementById("devui-" + id);
|
|
10
10
|
if (!style) {
|
|
11
11
|
style = document.createElement("style");
|
|
12
12
|
style.id = "devui-" + id;
|
|
@@ -16,12 +16,12 @@ function useStylesheet(id) {
|
|
|
16
16
|
}
|
|
17
17
|
}, [element]);
|
|
18
18
|
return {
|
|
19
|
-
clear() {
|
|
19
|
+
clear: function () {
|
|
20
20
|
if (element) {
|
|
21
21
|
element.innerHTML = "";
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
|
-
set(value) {
|
|
24
|
+
set: function (value) {
|
|
25
25
|
if (element) {
|
|
26
26
|
element.innerHTML = value;
|
|
27
27
|
}
|