eddev 0.2.66 → 0.2.67-beta1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/admin/components/ImageWell.d.ts +2 -3
- package/admin/components/ImageWell.js +39 -51
- package/admin/defineField.d.ts +2 -2
- package/admin/defineWidget.d.ts +1 -1
- package/admin/defineWidget.js +2 -2
- package/admin/index.js +5 -1
- package/admin/installFieldTypes.js +26 -26
- package/admin/runWidgets.js +17 -28
- package/admin/selectMedia.d.ts +2 -2
- package/admin/selectMedia.js +1 -1
- package/blocks/ContentBlocks.d.ts +6 -6
- package/blocks/ContentBlocks.js +58 -66
- package/blocks/ErrorBoundaryEditor.d.ts +1 -1
- package/blocks/ErrorBoundaryEditor.js +16 -45
- package/blocks/ErrorBoundaryFrontend.d.ts +1 -1
- package/blocks/ErrorBoundaryFrontend.js +16 -45
- package/blocks/InspectorControls.d.ts +1 -1
- package/blocks/InspectorControls.js +3 -3
- package/blocks/blockAttributes.d.ts +2 -2
- package/blocks/blockAttributes.js +24 -44
- package/blocks/index.js +5 -1
- package/blocks/inlineEditing.d.ts +7 -7
- package/blocks/inlineEditing.js +36 -55
- package/blocks/installGutenbergHooks.js +48 -68
- package/build/babel/plugin-name-defined-components.js +15 -16
- package/build/build-favicon.js +11 -62
- package/build/clean.js +5 -52
- package/build/create-codegen-worker.js +78 -33
- package/build/create-serverless-dev-worker.js +61 -39
- package/build/create-webpack-worker.js +65 -33
- package/build/file-tree.d.ts +2 -2
- package/build/file-tree.js +12 -12
- package/build/get-webpack-config.js +341 -395
- package/build/graphql-codegen/graphql-codegen-files.js +31 -25
- package/build/graphql-codegen/graphql-codegen-no-duplicates.js +4 -4
- package/build/graphql-codegen/graphql-codegen-queries.js +102 -99
- package/build/manifests/manifest-blocks.d.ts +1 -1
- package/build/manifests/manifest-blocks.js +37 -29
- package/build/manifests/manifest-fields.d.ts +1 -1
- package/build/manifests/manifest-fields.js +23 -21
- package/build/manifests/manifest-views.d.ts +1 -1
- package/build/manifests/manifest-views.js +32 -25
- package/build/manifests/manifest-widgets.d.ts +1 -1
- package/build/manifests/manifest-widgets.js +22 -20
- package/build/manifests/manifest.d.ts +2 -2
- package/build/manifests/manifest.js +30 -90
- package/build/reporter.d.ts +1 -1
- package/build/reporter.js +29 -32
- package/build/serverless/create-next-app.d.ts +1 -1
- package/build/serverless/create-next-app.js +245 -467
- package/build/state/codegen-state.d.ts +4 -4
- package/build/state/compiler-state.d.ts +5 -5
- package/build/state/serverless-state.d.ts +3 -3
- package/build/workers/codegen-worker-script.js +392 -507
- package/build/workers/serverless-worker-dev-script.js +4 -4
- package/build/workers/webpack-worker-script.js +89 -150
- package/cli/build.dev.d.ts +1 -1
- package/cli/build.dev.js +79 -126
- package/cli/build.prod.d.ts +1 -1
- package/cli/build.prod.js +42 -98
- package/cli/cli.js +16 -55
- package/cli/display/components/BundleDisplay.d.ts +1 -2
- package/cli/display/components/BundleDisplay.js +13 -24
- package/cli/display/components/CodegenDisplay.d.ts +1 -2
- package/cli/display/components/CodegenDisplay.js +14 -25
- package/cli/display/components/DevCLIDisplay.d.ts +2 -3
- package/cli/display/components/DevCLIDisplay.js +14 -25
- package/cli/display/components/Fullscreen.js +9 -20
- package/cli/display/components/ServerlessDisplay.d.ts +2 -3
- package/cli/display/components/ServerlessDisplay.js +15 -26
- package/cli/display/components/StatusIcon.d.ts +2 -3
- package/cli/display/components/StatusIcon.js +3 -3
- package/cli/preinstall.js +4 -5
- package/cli/setup.js +25 -73
- package/components/AdminBar.d.ts +1 -2
- package/components/AdminBar.js +37 -3
- package/components/BrowserRouter.d.ts +2 -2
- package/components/BrowserRouter.js +41 -54
- package/components/InlinePage.d.ts +2 -2
- package/components/InlinePage.js +17 -29
- package/components/NextRouter.d.ts +2 -2
- package/components/NextRouter.js +20 -29
- package/components/index.js +5 -1
- package/config/config-schema.d.ts +1 -1
- package/config/config-schema.js +1 -1
- package/config/create-schema-file.js +6 -6
- package/config/get-config.js +10 -13
- package/config/index.js +5 -1
- package/config/parse-config.js +1 -1
- package/config/print-zod-errors.js +3 -3
- package/dev-ui/components/BreakpointColumnHeader.d.ts +2 -3
- package/dev-ui/components/BreakpointColumnHeader.js +7 -18
- package/dev-ui/components/BreakpointIndicator.d.ts +1 -2
- package/dev-ui/components/BreakpointIndicator.js +25 -32
- package/dev-ui/components/DevUI.d.ts +1 -2
- package/dev-ui/components/DevUI.js +13 -13
- package/dev-ui/components/Launcher.d.ts +2 -2
- package/dev-ui/components/Launcher.js +13 -25
- package/dev-ui/components/PanelWrapper.d.ts +2 -2
- package/dev-ui/components/PanelWrapper.js +8 -8
- package/dev-ui/components/ResponsiveLerpControl.d.ts +2 -3
- package/dev-ui/components/ResponsiveLerpControl.js +27 -38
- package/dev-ui/components/ResponsiveScaleEditor.d.ts +4 -5
- package/dev-ui/components/ResponsiveScaleEditor.js +64 -78
- package/dev-ui/components/atoms/Button.js +1 -1
- package/dev-ui/components/atoms/Dropdown.d.ts +3 -3
- package/dev-ui/components/atoms/Dropdown.js +8 -9
- package/dev-ui/components/atoms/NumberField.d.ts +2 -3
- package/dev-ui/components/atoms/NumberField.js +29 -42
- package/dev-ui/components/atoms/Spacer.js +1 -1
- package/dev-ui/components/atoms/Text.js +1 -1
- package/dev-ui/components/atoms/ToggleButton.d.ts +2 -2
- package/dev-ui/components/atoms/ToggleButton.js +5 -16
- package/dev-ui/components/atoms/Tooltip.d.ts +2 -2
- package/dev-ui/components/atoms/Tooltip.js +8 -20
- package/dev-ui/components/panels/AppDataDebugger.d.ts +1 -2
- package/dev-ui/components/panels/AppDataDebugger.js +8 -19
- package/dev-ui/components/panels/ColorEditor.d.ts +1 -2
- package/dev-ui/components/panels/ColorEditor.js +35 -42
- package/dev-ui/components/panels/PageDataDebugger.d.ts +1 -2
- package/dev-ui/components/panels/PageDataDebugger.js +8 -20
- package/dev-ui/components/panels/QueryDebugger.d.ts +1 -2
- package/dev-ui/components/panels/QueryDebugger.js +12 -24
- package/dev-ui/components/panels/SpacingEditor.d.ts +1 -2
- package/dev-ui/components/panels/SpacingEditor.js +34 -48
- package/dev-ui/components/panels/TypographyEditor.d.ts +1 -2
- package/dev-ui/components/panels/TypographyEditor.js +38 -46
- package/dev-ui/hooks/useBreakpoint.d.ts +1 -1
- package/dev-ui/hooks/useBreakpoint.js +13 -13
- package/dev-ui/hooks/usePersistState.js +6 -7
- package/dev-ui/hooks/useStylesheet.js +6 -6
- package/dev-ui/icons.d.ts +15 -16
- package/dev-ui/icons.js +16 -27
- package/dev-ui/index.js +5 -1
- package/dev-ui/loader.d.ts +1 -2
- package/dev-ui/loader.js +13 -9
- package/dev-ui/panels.d.ts +2 -2
- package/dev-ui/panels.js +7 -7
- package/dev-ui/theme.d.ts +96 -70
- package/dev-ui/theme.js +3 -3
- package/dynamic/dynamic-component.d.ts +1 -10
- package/dynamic/dynamic-component.js +1 -1
- package/dynamic/index.js +5 -1
- package/entry/Root.d.ts +2 -3
- package/entry/Root.js +16 -26
- package/entry/entry.admin.dev.js +4 -4
- package/entry/entry.admin.prod.js +4 -4
- package/entry/entry.monolith.dev.js +5 -5
- package/entry/entry.monolith.prod.js +5 -5
- package/gravityforms/gravity-forms.d.ts +2 -2
- package/gravityforms/index.js +5 -1
- package/gravityforms/useGravityForm.d.ts +2 -2
- package/gravityforms/useGravityForm.js +126 -130
- package/hooks/index.js +5 -1
- package/hooks/queryUtils.d.ts +14 -14
- package/hooks/queryUtils.js +101 -192
- package/hooks/useAppData.d.ts +2 -2
- package/hooks/useAppData.js +9 -9
- package/hooks/usePageLoad.js +4 -4
- package/hooks/useQueryDebug.d.ts +1 -1
- package/hooks/useQueryDebug.js +7 -7
- package/hooks/useRPC.d.ts +4 -4
- package/hooks/useRPC.js +3 -3
- package/package.json +7 -7
- package/routing/index.js +5 -1
- package/routing/remoteProps.d.ts +1 -1
- package/routing/remoteProps.js +31 -72
- package/routing/routing.d.ts +15 -15
- package/routing/routing.js +108 -170
- package/routing/updateEditLink.js +1 -1
- package/serverless/define-api.d.ts +1 -1
- package/serverless/define-rpc-router.js +8 -4
- package/serverless/index.js +6 -2
- package/style/createStitches.d.ts +375 -783
- package/style/createStitches.js +164 -142
- package/style/index.js +5 -1
- package/tsconfig.json +1 -1
- package/utils/Observable.d.ts +2 -2
- package/utils/Observable.js +12 -15
- package/utils/getRepoName.js +3 -3
- package/utils/promptIfRepoNameIncorrect.js +18 -64
- package/utils/refreshOverlayInterop.js +1 -1
- package/utils/reportErrorStack.d.ts +1 -1
- package/utils/reportErrorStack.js +1 -1
- package/utils/serverlessAppContext.js +1 -1
- package/utils/updateEnvFile.js +19 -69
- package/utils/useObservable.js +3 -3
- package/views/index.js +5 -1
|
@@ -1,30 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
3
|
exports.ResponsiveLerpControl = void 0;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const icons_1 = require("../icons");
|
|
7
|
+
const theme_1 = require("../theme");
|
|
8
|
+
const Tooltip_1 = require("./atoms/Tooltip");
|
|
20
9
|
function ResponsiveLerpControl(props) {
|
|
21
|
-
|
|
22
|
-
return props.data.map(
|
|
10
|
+
const breakpoints = (0, react_1.useMemo)(() => {
|
|
11
|
+
return props.data.map((item) => item.breakpoint);
|
|
23
12
|
}, [props.data]);
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
props.data.forEach(
|
|
13
|
+
const ranges = (0, react_1.useMemo)(() => {
|
|
14
|
+
const ranges = [];
|
|
15
|
+
let currentRange = undefined;
|
|
16
|
+
props.data.forEach((item, i) => {
|
|
28
17
|
if (!currentRange) {
|
|
29
18
|
currentRange = {
|
|
30
19
|
fromBP: item.breakpoint,
|
|
@@ -55,10 +44,10 @@ function ResponsiveLerpControl(props) {
|
|
|
55
44
|
});
|
|
56
45
|
return ranges;
|
|
57
46
|
}, [props.data]);
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
ranges.forEach(
|
|
47
|
+
const lerpablePoints = (0, react_1.useMemo)(() => {
|
|
48
|
+
let points = [];
|
|
49
|
+
let length = 0;
|
|
50
|
+
ranges.forEach((range) => {
|
|
62
51
|
if (!range.isEnd && !range.isStart) {
|
|
63
52
|
points.push({ index: length + range.length / 2, bp: range.fromBP, lerping: range.lerped });
|
|
64
53
|
}
|
|
@@ -67,19 +56,19 @@ function ResponsiveLerpControl(props) {
|
|
|
67
56
|
return points;
|
|
68
57
|
}, [props.data, ranges]);
|
|
69
58
|
console.log("Ranges", ranges, lerpablePoints);
|
|
70
|
-
return ((0, jsx_runtime_1.jsxs)(Outer, { children: [ranges.map(
|
|
71
|
-
return ((0, jsx_runtime_1.jsx)(RangeItem,
|
|
59
|
+
return ((0, jsx_runtime_1.jsxs)(Outer, { children: [ranges.map((item, i) => {
|
|
60
|
+
return ((0, jsx_runtime_1.jsx)(RangeItem, { css: { $$length: item.length }, children: (0, jsx_runtime_1.jsx)(RangeLine, { lerping: item.lerped, hasStart: !item.isStart, hasEnd: !item.isEnd }) }, i));
|
|
72
61
|
}), props.onToggleLerping &&
|
|
73
|
-
lerpablePoints.map(
|
|
74
|
-
return ((0, jsx_runtime_1.jsx)(LerpButton,
|
|
62
|
+
lerpablePoints.map((item, i) => {
|
|
63
|
+
return ((0, jsx_runtime_1.jsx)(LerpButton, { onClick: () => {
|
|
75
64
|
if (props.onToggleLerping) {
|
|
76
65
|
props.onToggleLerping(item.bp, !item.lerping);
|
|
77
66
|
}
|
|
78
|
-
}, lerping: item.lerping, css: { $$pos: item.index / breakpoints.length }
|
|
79
|
-
})] }
|
|
67
|
+
}, lerping: item.lerping, css: { $$pos: item.index / breakpoints.length }, children: (0, jsx_runtime_1.jsx)(Tooltip_1.Tooltip, { label: item.lerping ? "Disable Lerping" : "Enable Lerping", nowrap: true, offset: 10, children: (0, jsx_runtime_1.jsx)(LerpButtonInner, { children: item.lerping ? icons_1.close : icons_1.line }) }) }, i));
|
|
68
|
+
})] }));
|
|
80
69
|
}
|
|
81
70
|
exports.ResponsiveLerpControl = ResponsiveLerpControl;
|
|
82
|
-
|
|
71
|
+
const Outer = (0, theme_1.styled)("div", {
|
|
83
72
|
width: "100%",
|
|
84
73
|
$$height: "16px",
|
|
85
74
|
height: "$$height",
|
|
@@ -87,18 +76,18 @@ var Outer = (0, theme_1.styled)("div", {
|
|
|
87
76
|
alignItems: "stretch",
|
|
88
77
|
position: "relative",
|
|
89
78
|
});
|
|
90
|
-
|
|
79
|
+
const RangeItem = (0, theme_1.styled)("div", {
|
|
91
80
|
flexGrow: "$$length",
|
|
92
81
|
position: "relative",
|
|
93
82
|
});
|
|
94
|
-
|
|
83
|
+
const RangeLine = (0, theme_1.styled)("div", {
|
|
95
84
|
position: "absolute",
|
|
96
85
|
left: "5px",
|
|
97
86
|
right: "5px",
|
|
98
87
|
top: "50%",
|
|
99
88
|
height: "3px",
|
|
100
89
|
transform: "translateY(-50%)",
|
|
101
|
-
background:
|
|
90
|
+
background: `linear-gradient(to right, $$color1, $$color2)`,
|
|
102
91
|
$$segHeight: "8px",
|
|
103
92
|
$$color1: "#888888",
|
|
104
93
|
$$color2: "#888888",
|
|
@@ -135,7 +124,7 @@ var RangeLine = (0, theme_1.styled)("div", {
|
|
|
135
124
|
},
|
|
136
125
|
},
|
|
137
126
|
});
|
|
138
|
-
|
|
127
|
+
const LerpButton = (0, theme_1.styled)("div", {
|
|
139
128
|
position: "absolute",
|
|
140
129
|
left: "calc(100% * $$pos)",
|
|
141
130
|
top: "50%",
|
|
@@ -164,7 +153,7 @@ var LerpButton = (0, theme_1.styled)("div", {
|
|
|
164
153
|
},
|
|
165
154
|
},
|
|
166
155
|
});
|
|
167
|
-
|
|
156
|
+
const LerpButtonInner = (0, theme_1.styled)("div", {
|
|
168
157
|
"&:before": {
|
|
169
158
|
content: " ",
|
|
170
159
|
display: "block",
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { BreakpointArray } from "../../style";
|
|
3
2
|
export declare const RESPONSIVE_COLUMN_WIDTH = "110px";
|
|
4
3
|
export declare const RESPONSIVE_ROW_HEIGHT = "20px";
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
type ModeType = "px" | "multiplier" | "%" | "number";
|
|
5
|
+
type TokenData = {
|
|
7
6
|
[token: string]: {
|
|
8
7
|
[breakpoint: string]: string | [string];
|
|
9
8
|
};
|
|
10
9
|
};
|
|
11
|
-
|
|
10
|
+
type Props = {
|
|
12
11
|
editableRange?: boolean;
|
|
13
12
|
editableValues?: boolean;
|
|
14
13
|
showBreakpointName?: boolean;
|
|
@@ -22,5 +21,5 @@ declare type Props = {
|
|
|
22
21
|
modes: ModeType[];
|
|
23
22
|
onChange(data: TokenData): void;
|
|
24
23
|
};
|
|
25
|
-
export declare function ResponsiveScaleEditor(props: Props): JSX.Element;
|
|
24
|
+
export declare function ResponsiveScaleEditor(props: Props): import("react/jsx-runtime").JSX.Element;
|
|
26
25
|
export {};
|
|
@@ -1,52 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
4
|
};
|
|
16
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
6
|
exports.ResponsiveScaleEditor = exports.RESPONSIVE_ROW_HEIGHT = exports.RESPONSIVE_COLUMN_WIDTH = void 0;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const style_1 = require("../../style");
|
|
9
|
+
const theme_1 = require("../theme");
|
|
10
|
+
const NumberField_1 = require("./atoms/NumberField");
|
|
11
|
+
const ResponsiveLerpControl_1 = require("./ResponsiveLerpControl");
|
|
12
|
+
const Text_1 = require("./atoms/Text");
|
|
13
|
+
const ToggleButton_1 = require("./atoms/ToggleButton");
|
|
14
|
+
const Tooltip_1 = require("./atoms/Tooltip");
|
|
15
|
+
const react_1 = require("react");
|
|
16
|
+
const immer_1 = __importDefault(require("immer"));
|
|
28
17
|
// @ts-ignore
|
|
29
|
-
|
|
18
|
+
const _theme_1 = require("@theme");
|
|
30
19
|
exports.RESPONSIVE_COLUMN_WIDTH = "110px";
|
|
31
20
|
exports.RESPONSIVE_ROW_HEIGHT = "20px";
|
|
32
21
|
function ResponsiveScaleEditor(props) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
return Object.entries(props.data).map(
|
|
36
|
-
|
|
37
|
-
var info = (0, style_1.parseResponsiveObject)(props.breakpoints, row);
|
|
22
|
+
const values = props.data;
|
|
23
|
+
const rows = (0, react_1.useMemo)(() => {
|
|
24
|
+
return Object.entries(props.data).map(([key, row]) => {
|
|
25
|
+
const info = (0, style_1.parseResponsiveObject)(props.breakpoints, row);
|
|
38
26
|
return {
|
|
39
27
|
token: key,
|
|
40
28
|
row: info,
|
|
41
29
|
};
|
|
42
30
|
});
|
|
43
31
|
}, [props.data]);
|
|
44
|
-
|
|
32
|
+
const general = (0, react_1.useMemo)(() => {
|
|
45
33
|
return props.data[0];
|
|
46
34
|
}, [props.data]);
|
|
47
|
-
|
|
48
|
-
props.onChange((0, immer_1.default)(values,
|
|
49
|
-
|
|
35
|
+
const onChangeValue = (item, value, token) => {
|
|
36
|
+
props.onChange((0, immer_1.default)(values, (draft) => {
|
|
37
|
+
let subvalue = item.type === "px" ? value + "px" : item.type === "multiplier" ? "x" + value : undefined;
|
|
50
38
|
if (item.lerpStart && typeof subvalue === "string") {
|
|
51
39
|
subvalue = [subvalue];
|
|
52
40
|
}
|
|
@@ -58,22 +46,22 @@ function ResponsiveScaleEditor(props) {
|
|
|
58
46
|
}
|
|
59
47
|
}));
|
|
60
48
|
};
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
props.onChange((0, immer_1.default)(values,
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
49
|
+
const onChangeUnits = (breakpoint, token) => {
|
|
50
|
+
const sampleValue = rows.find((r) => r.token === token).row.find((item) => item.breakpoint === breakpoint);
|
|
51
|
+
const nextType = props.modes[(props.modes.indexOf(sampleValue.type) + 1) % props.modes.length];
|
|
52
|
+
props.onChange((0, immer_1.default)(values, (draft) => {
|
|
53
|
+
const updateToken = (rowIndex) => {
|
|
54
|
+
const token = rows[rowIndex].token;
|
|
55
|
+
const item = rows[rowIndex].row.find((i) => i.breakpoint === breakpoint);
|
|
56
|
+
const base = rows[rowIndex].row.find((i) => i.breakpoint === item.lastBreakpoint);
|
|
57
|
+
let nextValue;
|
|
70
58
|
if (item.type === "px" && nextType === "multiplier") {
|
|
71
59
|
if (base) {
|
|
72
|
-
nextValue = "x" + item.value /
|
|
60
|
+
nextValue = "x" + item.value / base?.concreteValue;
|
|
73
61
|
}
|
|
74
62
|
}
|
|
75
63
|
else if (item.type === "multiplier" && nextType === "px") {
|
|
76
|
-
nextValue = item.value *
|
|
64
|
+
nextValue = item.value * base?.concreteValue + "px";
|
|
77
65
|
}
|
|
78
66
|
if (nextValue) {
|
|
79
67
|
if (item.lerpStart) {
|
|
@@ -83,16 +71,16 @@ function ResponsiveScaleEditor(props) {
|
|
|
83
71
|
}
|
|
84
72
|
};
|
|
85
73
|
if (props.related) {
|
|
86
|
-
for (
|
|
74
|
+
for (let i = 0; i < rows.length; i++) {
|
|
87
75
|
updateToken(i);
|
|
88
76
|
}
|
|
89
77
|
}
|
|
90
78
|
}));
|
|
91
79
|
};
|
|
92
|
-
|
|
93
|
-
props.onChange((0, immer_1.default)(values,
|
|
94
|
-
for (
|
|
95
|
-
|
|
80
|
+
const onToggleLerping = (breakpoint, lerping) => {
|
|
81
|
+
props.onChange((0, immer_1.default)(values, (values) => {
|
|
82
|
+
for (let token in values) {
|
|
83
|
+
let subval = values[token]["@" + breakpoint];
|
|
96
84
|
if (Array.isArray(subval)) {
|
|
97
85
|
subval = subval[0];
|
|
98
86
|
}
|
|
@@ -100,21 +88,20 @@ function ResponsiveScaleEditor(props) {
|
|
|
100
88
|
}
|
|
101
89
|
}));
|
|
102
90
|
};
|
|
103
|
-
|
|
104
|
-
|
|
91
|
+
const onToggleBreakpoint = (item, enabled) => {
|
|
92
|
+
const breakpoint = item.breakpoint;
|
|
105
93
|
if (!enabled) {
|
|
106
|
-
props.onChange((0, immer_1.default)(values,
|
|
107
|
-
for (
|
|
94
|
+
props.onChange((0, immer_1.default)(values, (values) => {
|
|
95
|
+
for (let token in values) {
|
|
108
96
|
delete values[token]["@" + breakpoint];
|
|
109
97
|
}
|
|
110
98
|
}));
|
|
111
99
|
}
|
|
112
100
|
else {
|
|
113
|
-
props.onChange((0, immer_1.default)(values,
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
var value = original;
|
|
101
|
+
props.onChange((0, immer_1.default)(values, (values) => {
|
|
102
|
+
for (let token in values) {
|
|
103
|
+
const original = _theme_1.originalConfig.responsive.space[token]?.["@" + breakpoint];
|
|
104
|
+
let value = original;
|
|
118
105
|
if (!value) {
|
|
119
106
|
value = values[token]["@" + item.baseBreakpoint];
|
|
120
107
|
}
|
|
@@ -125,33 +112,32 @@ function ResponsiveScaleEditor(props) {
|
|
|
125
112
|
}));
|
|
126
113
|
}
|
|
127
114
|
};
|
|
128
|
-
return ((0, jsx_runtime_1.jsxs)(Wrapper,
|
|
129
|
-
|
|
130
|
-
return ((0, jsx_runtime_1.jsx)(Col,
|
|
131
|
-
onToggleBreakpoint
|
|
132
|
-
}, label: (0, jsx_runtime_1.jsx)(Text_1.Text,
|
|
133
|
-
}) })
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
var tabIndex = 500 + (props.tabIndexStart || 0) + i * 100;
|
|
115
|
+
return ((0, jsx_runtime_1.jsxs)(Wrapper, { css: { $$total: props.breakpoints.length, $$labelWidth: props.labelWidth }, children: [props.showBreakpointName && ((0, jsx_runtime_1.jsx)(Row, { heading: true, children: rows[0].row.map((item, i) => {
|
|
116
|
+
const bp = props.breakpoints[i];
|
|
117
|
+
return ((0, jsx_runtime_1.jsx)(Col, { css: { textAlign: "center" }, children: (0, jsx_runtime_1.jsx)(Tooltip_1.Tooltip, { label: `${bp.min} to ${bp.max || "∞"}`, mono: true, nowrap: true, children: (0, jsx_runtime_1.jsx)(ToggleButton_1.ToggleButton, { checked: item.defined, onChange: (checked) => {
|
|
118
|
+
onToggleBreakpoint?.(item, checked);
|
|
119
|
+
}, label: (0, jsx_runtime_1.jsx)(Text_1.Text, { as: "span", variant: "monoBold", children: item.breakpoint }) }) }) }, i));
|
|
120
|
+
}) })), props.showRange && ((0, jsx_runtime_1.jsx)(Row, { heading: true, children: (0, jsx_runtime_1.jsx)(ResponsiveLerpControl_1.ResponsiveLerpControl, { onToggleLerping: onToggleLerping, data: rows[0].row }) })), props.showValues && ((0, jsx_runtime_1.jsx)(react_1.Fragment, { children: rows.map(({ token, row }, rowIndex) => {
|
|
121
|
+
return ((0, jsx_runtime_1.jsxs)(Row, { hoverable: true, labelIndent: false, children: [(0, jsx_runtime_1.jsx)(RowLabel, { children: (0, jsx_runtime_1.jsx)(Text_1.Text, { variant: "monoBold", children: token }) }), row.map((item, i) => {
|
|
122
|
+
const tabIndex = 500 + (props.tabIndexStart || 0) + i * 100;
|
|
137
123
|
return ((0, jsx_runtime_1.jsxs)(Col, { children: [(0, jsx_runtime_1.jsx)(Field, { children: item.type === "multiplier" ||
|
|
138
124
|
item.type === "number" ||
|
|
139
125
|
item.type === "px" ||
|
|
140
|
-
item.type === "percent" ? ((0, jsx_runtime_1.jsx)(NumberField_1.NumberField, { tabIndex: tabIndex, prefix: item.type === "multiplier" ? "x" : "", suffix: item.type === "px" ? "px" : item.type === "percent" ? "%" : "", value: item.value, onChange:
|
|
126
|
+
item.type === "percent" ? ((0, jsx_runtime_1.jsx)(NumberField_1.NumberField, { tabIndex: tabIndex, prefix: item.type === "multiplier" ? "x" : "", suffix: item.type === "px" ? "px" : item.type === "percent" ? "%" : "", value: item.value, onChange: (value) => {
|
|
141
127
|
onChangeValue(item, value, token);
|
|
142
|
-
}, increment: item.type === "px" ? 1 : 0.1 }
|
|
128
|
+
}, increment: item.type === "px" ? 1 : 0.1 })) : null }), item.defined && (!props.related || rowIndex === 0) && ((0, jsx_runtime_1.jsx)(ToolbarButton, { onClick: () => {
|
|
143
129
|
onChangeUnits(item.breakpoint, token);
|
|
144
|
-
}
|
|
145
|
-
})] }
|
|
146
|
-
}) }
|
|
130
|
+
}, children: item.type === "px" ? "px" : "multiplier" }))] }, i));
|
|
131
|
+
})] }, rowIndex));
|
|
132
|
+
}) }))] }));
|
|
147
133
|
}
|
|
148
134
|
exports.ResponsiveScaleEditor = ResponsiveScaleEditor;
|
|
149
|
-
|
|
135
|
+
const Wrapper = (0, theme_1.styled)("div", {
|
|
150
136
|
position: "relative",
|
|
151
|
-
width:
|
|
137
|
+
width: `calc(${exports.RESPONSIVE_COLUMN_WIDTH} * $$total)`,
|
|
152
138
|
$$lineColor: "$colors$bgLine",
|
|
153
139
|
});
|
|
154
|
-
|
|
140
|
+
const Row = (0, theme_1.styled)("div", {
|
|
155
141
|
display: "flex",
|
|
156
142
|
borderBottom: "1px solid $$lineColor",
|
|
157
143
|
paddingLeft: "$$labelWidth",
|
|
@@ -175,7 +161,7 @@ var Row = (0, theme_1.styled)("div", {
|
|
|
175
161
|
},
|
|
176
162
|
},
|
|
177
163
|
});
|
|
178
|
-
|
|
164
|
+
const Col = (0, theme_1.styled)("div", {
|
|
179
165
|
position: "relative",
|
|
180
166
|
width: exports.RESPONSIVE_COLUMN_WIDTH,
|
|
181
167
|
height: exports.RESPONSIVE_ROW_HEIGHT,
|
|
@@ -193,7 +179,7 @@ var Col = (0, theme_1.styled)("div", {
|
|
|
193
179
|
},
|
|
194
180
|
},
|
|
195
181
|
});
|
|
196
|
-
|
|
182
|
+
const Field = (0, theme_1.styled)("div", {
|
|
197
183
|
flex: "1 1 auto",
|
|
198
184
|
});
|
|
199
185
|
// const Start = styled("div", {
|
|
@@ -203,13 +189,13 @@ var Field = (0, theme_1.styled)("div", {
|
|
|
203
189
|
// position: "absolute",
|
|
204
190
|
// right: 2,
|
|
205
191
|
// })
|
|
206
|
-
|
|
192
|
+
const RowLabel = (0, theme_1.styled)("div", {
|
|
207
193
|
width: "$$labelWidth",
|
|
208
194
|
height: exports.RESPONSIVE_ROW_HEIGHT,
|
|
209
195
|
boxSizing: "border-box",
|
|
210
196
|
flex: "0 0 auto",
|
|
211
197
|
});
|
|
212
|
-
|
|
198
|
+
const Toolbar = (0, theme_1.styled)("div", {
|
|
213
199
|
display: "flex",
|
|
214
200
|
textAlign: "left",
|
|
215
201
|
width: "100%",
|
|
@@ -219,7 +205,7 @@ var Toolbar = (0, theme_1.styled)("div", {
|
|
|
219
205
|
marginRight: "3px",
|
|
220
206
|
},
|
|
221
207
|
});
|
|
222
|
-
|
|
208
|
+
const ToolbarButton = (0, theme_1.styled)("button", {
|
|
223
209
|
fontSize: "9px",
|
|
224
210
|
appearance: "none",
|
|
225
211
|
border: 0,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Button = void 0;
|
|
4
|
-
|
|
4
|
+
const theme_1 = require("../../theme");
|
|
5
5
|
exports.Button = (0, theme_1.styled)("button", {
|
|
6
6
|
appearance: "none",
|
|
7
7
|
border: "0px",
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { PropsWithChildren, ReactNode } from "react";
|
|
2
|
-
|
|
2
|
+
type MenuItem = {
|
|
3
3
|
icon?: ReactNode;
|
|
4
4
|
label: string;
|
|
5
5
|
onClick: () => void;
|
|
6
6
|
};
|
|
7
|
-
|
|
7
|
+
type Props = PropsWithChildren<{
|
|
8
8
|
items: MenuItem[];
|
|
9
9
|
mono?: boolean;
|
|
10
10
|
offset?: number;
|
|
11
11
|
}>;
|
|
12
|
-
export declare function Tooltip(props: Props): JSX.Element;
|
|
12
|
+
export declare function Tooltip(props: Props): import("react/jsx-runtime").JSX.Element;
|
|
13
13
|
export {};
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var _a;
|
|
3
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
3
|
exports.Tooltip = void 0;
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const theme_1 = require("../../theme");
|
|
7
6
|
function Tooltip(props) {
|
|
8
|
-
return ((0, jsx_runtime_1.jsxs)(Wrapper, { children: [(0, jsx_runtime_1.jsx)(MenuWrapper, { css: { $$offset: (typeof props.offset === "number" ? props.offset : 5) + "px" }, mono: props.mono }
|
|
7
|
+
return ((0, jsx_runtime_1.jsxs)(Wrapper, { children: [(0, jsx_runtime_1.jsx)(MenuWrapper, { css: { $$offset: (typeof props.offset === "number" ? props.offset : 5) + "px" }, mono: props.mono }), props.children] }));
|
|
9
8
|
}
|
|
10
9
|
exports.Tooltip = Tooltip;
|
|
11
|
-
|
|
10
|
+
const MenuWrapper = (0, theme_1.styled)("div", {
|
|
12
11
|
position: "absolute",
|
|
13
12
|
bottom: "calc(100% + $$offset)",
|
|
14
13
|
left: "50%",
|
|
@@ -40,11 +39,11 @@ var MenuWrapper = (0, theme_1.styled)("div", {
|
|
|
40
39
|
},
|
|
41
40
|
},
|
|
42
41
|
});
|
|
43
|
-
|
|
42
|
+
const Wrapper = (0, theme_1.styled)("div", {
|
|
44
43
|
position: "relative",
|
|
45
|
-
"&:hover":
|
|
46
|
-
|
|
44
|
+
"&:hover": {
|
|
45
|
+
[MenuWrapper.toString()]: {
|
|
47
46
|
opacity: 1,
|
|
48
47
|
},
|
|
49
|
-
|
|
48
|
+
},
|
|
50
49
|
});
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
declare type Props = {
|
|
1
|
+
type Props = {
|
|
3
2
|
prefix?: string;
|
|
4
3
|
suffix?: string;
|
|
5
4
|
value: number;
|
|
@@ -8,5 +7,5 @@ declare type Props = {
|
|
|
8
7
|
increment: number;
|
|
9
8
|
tabIndex?: number;
|
|
10
9
|
};
|
|
11
|
-
export declare function NumberField(props: Props): JSX.Element;
|
|
10
|
+
export declare function NumberField(props: Props): import("react/jsx-runtime").JSX.Element;
|
|
12
11
|
export {};
|
|
@@ -1,37 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
3
|
exports.NumberField = void 0;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const theme_1 = require("../../theme");
|
|
18
7
|
function NumberField(props) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
8
|
+
const ref = (0, react_1.useRef)(null);
|
|
9
|
+
const [focused, setFocused] = (0, react_1.useState)(false);
|
|
10
|
+
const [value, setValue] = (0, react_1.useState)(props.value);
|
|
11
|
+
const focusAll = () => {
|
|
12
|
+
const range = document.createRange();
|
|
24
13
|
range.selectNodeContents(ref.current);
|
|
25
|
-
|
|
26
|
-
sel
|
|
27
|
-
sel
|
|
14
|
+
const sel = window.getSelection();
|
|
15
|
+
sel?.removeAllRanges();
|
|
16
|
+
sel?.addRange(range);
|
|
28
17
|
};
|
|
29
|
-
|
|
18
|
+
const normalize = (value) => {
|
|
30
19
|
return parseFloat(Math.max(0, value).toFixed(4));
|
|
31
20
|
};
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
var v = normalize(value);
|
|
21
|
+
const setValueForced = (value, changed = false) => {
|
|
22
|
+
const v = normalize(value);
|
|
35
23
|
setValue(v);
|
|
36
24
|
if (ref.current) {
|
|
37
25
|
if (ref.current.innerHTML !== v.toString()) {
|
|
@@ -42,26 +30,25 @@ function NumberField(props) {
|
|
|
42
30
|
props.onChange(value);
|
|
43
31
|
}
|
|
44
32
|
};
|
|
45
|
-
(0, react_1.useEffect)(
|
|
33
|
+
(0, react_1.useEffect)(() => {
|
|
46
34
|
setValueForced(props.value, false);
|
|
47
35
|
}, [props.value]);
|
|
48
|
-
(0, react_1.useEffect)(
|
|
36
|
+
(0, react_1.useEffect)(() => {
|
|
49
37
|
if (!focused) {
|
|
50
38
|
setValueForced(value);
|
|
51
39
|
}
|
|
52
40
|
}, [value, focused]);
|
|
53
|
-
return ((0, jsx_runtime_1.jsxs)(Field,
|
|
54
|
-
|
|
55
|
-
(_a = ref.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
41
|
+
return ((0, jsx_runtime_1.jsxs)(Field, { focused: focused, onMouseDown: (e) => {
|
|
42
|
+
ref.current?.focus();
|
|
56
43
|
if (!focused) {
|
|
57
44
|
focusAll();
|
|
58
45
|
e.preventDefault();
|
|
59
46
|
}
|
|
60
|
-
}
|
|
47
|
+
}, children: [props.prefix && (0, jsx_runtime_1.jsx)(Extra, { children: props.prefix }), (0, jsx_runtime_1.jsx)(Input, { ref: ref, contentEditable: !!props.onChange, tabIndex: props.tabIndex, onFocus: () => {
|
|
61
48
|
setFocused(true);
|
|
62
49
|
focusAll();
|
|
63
|
-
}, onBlur:
|
|
64
|
-
|
|
50
|
+
}, onBlur: () => setFocused(false), onInput: (e) => {
|
|
51
|
+
let value = parseFloat(e.currentTarget.innerText.replace(/[^0-9\.]/g, "")) || 0;
|
|
65
52
|
setValue(value);
|
|
66
53
|
props.onChange(value);
|
|
67
54
|
},
|
|
@@ -69,23 +56,23 @@ function NumberField(props) {
|
|
|
69
56
|
// console.log(e.clipboardData.getData("text/plain"))
|
|
70
57
|
// e.preventDefault()
|
|
71
58
|
// }}
|
|
72
|
-
onKeyDown:
|
|
73
|
-
|
|
59
|
+
onKeyDown: (e) => {
|
|
60
|
+
const increment = props.increment * (e.shiftKey ? 10 : 1);
|
|
74
61
|
if (e.key === "ArrowUp") {
|
|
75
62
|
setValueForced(value + increment, true);
|
|
76
|
-
setTimeout(
|
|
63
|
+
setTimeout(() => focusAll(), 1);
|
|
77
64
|
}
|
|
78
65
|
else if (e.key === "ArrowDown") {
|
|
79
66
|
setValueForced(value - increment, true);
|
|
80
|
-
setTimeout(
|
|
67
|
+
setTimeout(() => focusAll(), 1);
|
|
81
68
|
}
|
|
82
69
|
else if (e.key === "Enter") {
|
|
83
70
|
e.preventDefault();
|
|
84
71
|
}
|
|
85
|
-
} }
|
|
72
|
+
} }), props.suffix && (0, jsx_runtime_1.jsx)(Extra, { children: props.suffix })] }));
|
|
86
73
|
}
|
|
87
74
|
exports.NumberField = NumberField;
|
|
88
|
-
|
|
75
|
+
const Field = (0, theme_1.styled)("div", {
|
|
89
76
|
display: "inline-flex",
|
|
90
77
|
fontFamily: "$mono",
|
|
91
78
|
fontSize: "$sm",
|
|
@@ -99,13 +86,13 @@ var Field = (0, theme_1.styled)("div", {
|
|
|
99
86
|
},
|
|
100
87
|
},
|
|
101
88
|
});
|
|
102
|
-
|
|
89
|
+
const Input = (0, theme_1.styled)("span", {
|
|
103
90
|
outline: "0px",
|
|
104
91
|
"&::selection": {
|
|
105
92
|
background: "white",
|
|
106
93
|
color: "black",
|
|
107
94
|
},
|
|
108
95
|
});
|
|
109
|
-
|
|
96
|
+
const Extra = (0, theme_1.styled)("span", {
|
|
110
97
|
opacity: 0.7,
|
|
111
98
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Spacer = void 0;
|
|
4
|
-
|
|
4
|
+
const theme_1 = require("../../theme");
|
|
5
5
|
exports.Spacer = (0, theme_1.styled)("div", {
|
|
6
6
|
display: "block",
|
|
7
7
|
width: "$spaces$1",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
|
-
|
|
2
|
+
type Props = {
|
|
3
3
|
checked: boolean;
|
|
4
4
|
label: ReactNode;
|
|
5
5
|
onChange: (value: boolean) => void;
|
|
6
6
|
};
|
|
7
|
-
export declare function ToggleButton(props: Props): JSX.Element;
|
|
7
|
+
export declare function ToggleButton(props: Props): import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
export {};
|