eddev 0.2.0-beta.10 → 0.2.0-beta.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/get-webpack-config.js +4 -1
- package/cli/cli.js +1 -1
- package/config/config-schema.d.ts +7 -22
- package/config/config-schema.js +1 -6
- package/config/get-config.d.ts +6 -15
- package/config/parse-config.d.ts +4 -10
- 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 +33 -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/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.js +7 -5
- package/package.json +2 -1
- package/serverless-template/pages/_app.tsx +0 -2
- package/style/createStitches.d.ts +71 -1
- package/style/createStitches.js +151 -45
- package/utils/getRepoName.js +13 -5
- package/build/workers/serverless-worker-script.d.ts +0 -0
- package/build/workers/serverless-worker-script.js +0 -1
- package/serverless-template/package-lock.json +0 -641
|
@@ -0,0 +1,111 @@
|
|
|
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.NumberField = void 0;
|
|
15
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
|
+
var react_1 = require("react");
|
|
17
|
+
var theme_1 = require("../../theme");
|
|
18
|
+
function NumberField(props) {
|
|
19
|
+
var ref = (0, react_1.useRef)(null);
|
|
20
|
+
var _a = (0, react_1.useState)(false), focused = _a[0], setFocused = _a[1];
|
|
21
|
+
var _b = (0, react_1.useState)(props.value), value = _b[0], setValue = _b[1];
|
|
22
|
+
var focusAll = function () {
|
|
23
|
+
var range = document.createRange();
|
|
24
|
+
range.selectNodeContents(ref.current);
|
|
25
|
+
var sel = window.getSelection();
|
|
26
|
+
sel === null || sel === void 0 ? void 0 : sel.removeAllRanges();
|
|
27
|
+
sel === null || sel === void 0 ? void 0 : sel.addRange(range);
|
|
28
|
+
};
|
|
29
|
+
var normalize = function (value) {
|
|
30
|
+
return parseFloat(Math.max(0, value).toFixed(4));
|
|
31
|
+
};
|
|
32
|
+
var setValueForced = function (value, changed) {
|
|
33
|
+
if (changed === void 0) { changed = false; }
|
|
34
|
+
var v = normalize(value);
|
|
35
|
+
setValue(v);
|
|
36
|
+
if (ref.current) {
|
|
37
|
+
if (ref.current.innerHTML !== v.toString()) {
|
|
38
|
+
ref.current.innerHTML = v.toString();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
if (changed) {
|
|
42
|
+
props.onChange(value);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
(0, react_1.useEffect)(function () {
|
|
46
|
+
setValueForced(props.value, false);
|
|
47
|
+
}, [props.value]);
|
|
48
|
+
(0, react_1.useEffect)(function () {
|
|
49
|
+
if (!focused) {
|
|
50
|
+
setValueForced(value);
|
|
51
|
+
}
|
|
52
|
+
}, [value, focused]);
|
|
53
|
+
return ((0, jsx_runtime_1.jsxs)(Field, __assign({ focused: focused, onMouseDown: function (e) {
|
|
54
|
+
var _a;
|
|
55
|
+
(_a = ref.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
56
|
+
if (!focused) {
|
|
57
|
+
focusAll();
|
|
58
|
+
e.preventDefault();
|
|
59
|
+
}
|
|
60
|
+
} }, { children: [props.prefix && (0, jsx_runtime_1.jsx)(Extra, { children: props.prefix }, void 0), (0, jsx_runtime_1.jsx)(Input, { ref: ref, contentEditable: !!props.onChange, tabIndex: props.tabIndex, onFocus: function () {
|
|
61
|
+
setFocused(true);
|
|
62
|
+
focusAll();
|
|
63
|
+
}, onBlur: function () { return setFocused(false); }, onInput: function (e) {
|
|
64
|
+
var value = parseFloat(e.currentTarget.innerText.replace(/[^0-9\.]/g, "")) || 0;
|
|
65
|
+
setValue(value);
|
|
66
|
+
props.onChange(value);
|
|
67
|
+
},
|
|
68
|
+
// onPasteCapture={(e) => {
|
|
69
|
+
// console.log(e.clipboardData.getData("text/plain"))
|
|
70
|
+
// e.preventDefault()
|
|
71
|
+
// }}
|
|
72
|
+
onKeyDown: function (e) {
|
|
73
|
+
var increment = props.increment * (e.shiftKey ? 10 : 1);
|
|
74
|
+
if (e.key === "ArrowUp") {
|
|
75
|
+
setValueForced(value + increment, true);
|
|
76
|
+
setTimeout(function () { return focusAll(); }, 1);
|
|
77
|
+
}
|
|
78
|
+
else if (e.key === "ArrowDown") {
|
|
79
|
+
setValueForced(value - increment, true);
|
|
80
|
+
setTimeout(function () { return focusAll(); }, 1);
|
|
81
|
+
}
|
|
82
|
+
else if (e.key === "Enter") {
|
|
83
|
+
e.preventDefault();
|
|
84
|
+
}
|
|
85
|
+
} }, void 0), props.suffix && (0, jsx_runtime_1.jsx)(Extra, { children: props.suffix }, void 0)] }), void 0));
|
|
86
|
+
}
|
|
87
|
+
exports.NumberField = NumberField;
|
|
88
|
+
var Field = (0, theme_1.styled)("div", {
|
|
89
|
+
display: "inline-flex",
|
|
90
|
+
fontFamily: "$mono",
|
|
91
|
+
fontSize: "$sm",
|
|
92
|
+
padding: "0 4px",
|
|
93
|
+
borderRadius: "$sm",
|
|
94
|
+
variants: {
|
|
95
|
+
focused: {
|
|
96
|
+
true: {
|
|
97
|
+
backgroundColor: "$bgHover",
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
});
|
|
102
|
+
var Input = (0, theme_1.styled)("span", {
|
|
103
|
+
outline: "0px",
|
|
104
|
+
"&::selection": {
|
|
105
|
+
background: "white",
|
|
106
|
+
color: "black",
|
|
107
|
+
},
|
|
108
|
+
});
|
|
109
|
+
var Extra = (0, theme_1.styled)("span", {
|
|
110
|
+
opacity: 0.7,
|
|
111
|
+
});
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export declare const Spacer: import("@stitches/react/types/styled-component").StyledComponent<"div", {}, {}, import("@stitches/react/types/css-util").CSS<{}, {
|
|
2
|
+
space: {
|
|
3
|
+
smallButtonHeight: string;
|
|
4
|
+
buttonHeight: string;
|
|
5
|
+
0: string;
|
|
6
|
+
1: string;
|
|
7
|
+
2: string;
|
|
8
|
+
3: string;
|
|
9
|
+
4: string;
|
|
10
|
+
5: string;
|
|
11
|
+
6: string;
|
|
12
|
+
};
|
|
13
|
+
colors: {
|
|
14
|
+
bg: string;
|
|
15
|
+
bgHover: string;
|
|
16
|
+
bgHoverLight: string;
|
|
17
|
+
bgLine: string;
|
|
18
|
+
bgLineStrong: string;
|
|
19
|
+
button: string;
|
|
20
|
+
buttonHover: string;
|
|
21
|
+
fg: string;
|
|
22
|
+
fgFaded: string;
|
|
23
|
+
};
|
|
24
|
+
fontSizes: {
|
|
25
|
+
sm: string;
|
|
26
|
+
md: string;
|
|
27
|
+
lg: string;
|
|
28
|
+
xl: string;
|
|
29
|
+
};
|
|
30
|
+
fonts: {
|
|
31
|
+
body: string;
|
|
32
|
+
mono: string;
|
|
33
|
+
};
|
|
34
|
+
radii: {
|
|
35
|
+
sm: string;
|
|
36
|
+
md: string;
|
|
37
|
+
lg: string;
|
|
38
|
+
};
|
|
39
|
+
transitions: {
|
|
40
|
+
default: string;
|
|
41
|
+
};
|
|
42
|
+
}, import("@stitches/react/types/config").DefaultThemeMap, {}>>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export declare const Text: import("@stitches/react/types/styled-component").StyledComponent<"div", {
|
|
2
|
+
variant?: "h1" | "mono" | "monoBold" | "monoTiny" | undefined;
|
|
3
|
+
align?: "left" | "right" | "center" | undefined;
|
|
4
|
+
}, {}, import("@stitches/react/types/css-util").CSS<{}, {
|
|
5
|
+
space: {
|
|
6
|
+
smallButtonHeight: string;
|
|
7
|
+
buttonHeight: string;
|
|
8
|
+
0: string;
|
|
9
|
+
1: string;
|
|
10
|
+
2: string;
|
|
11
|
+
3: string;
|
|
12
|
+
4: string;
|
|
13
|
+
5: string;
|
|
14
|
+
6: string;
|
|
15
|
+
};
|
|
16
|
+
colors: {
|
|
17
|
+
bg: string;
|
|
18
|
+
bgHover: string;
|
|
19
|
+
bgHoverLight: string;
|
|
20
|
+
bgLine: string;
|
|
21
|
+
bgLineStrong: string;
|
|
22
|
+
button: string;
|
|
23
|
+
buttonHover: string;
|
|
24
|
+
fg: string;
|
|
25
|
+
fgFaded: string;
|
|
26
|
+
};
|
|
27
|
+
fontSizes: {
|
|
28
|
+
sm: string;
|
|
29
|
+
md: string;
|
|
30
|
+
lg: string;
|
|
31
|
+
xl: string;
|
|
32
|
+
};
|
|
33
|
+
fonts: {
|
|
34
|
+
body: string;
|
|
35
|
+
mono: string;
|
|
36
|
+
};
|
|
37
|
+
radii: {
|
|
38
|
+
sm: string;
|
|
39
|
+
md: string;
|
|
40
|
+
lg: string;
|
|
41
|
+
};
|
|
42
|
+
transitions: {
|
|
43
|
+
default: string;
|
|
44
|
+
};
|
|
45
|
+
}, import("@stitches/react/types/config").DefaultThemeMap, {}>>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Text = void 0;
|
|
4
|
+
var theme_1 = require("../../theme");
|
|
5
|
+
exports.Text = (0, theme_1.styled)("div", {
|
|
6
|
+
variants: {
|
|
7
|
+
variant: {
|
|
8
|
+
h1: {
|
|
9
|
+
fontSize: "$xl",
|
|
10
|
+
},
|
|
11
|
+
monoBold: {
|
|
12
|
+
fontFamily: "$mono",
|
|
13
|
+
fontSize: "$sm",
|
|
14
|
+
fontWeight: "bold",
|
|
15
|
+
lineHeight: "1.6",
|
|
16
|
+
},
|
|
17
|
+
mono: {
|
|
18
|
+
fontFamily: "$mono",
|
|
19
|
+
fontSize: "$sm",
|
|
20
|
+
lineHeight: "1.6",
|
|
21
|
+
},
|
|
22
|
+
monoTiny: {
|
|
23
|
+
fontSize: "8px",
|
|
24
|
+
fontFamily: "$mono",
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
align: {
|
|
28
|
+
left: {
|
|
29
|
+
textAlign: "left",
|
|
30
|
+
},
|
|
31
|
+
center: {
|
|
32
|
+
textAlign: "center",
|
|
33
|
+
},
|
|
34
|
+
right: {
|
|
35
|
+
textAlign: "right",
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
});
|
|
@@ -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];
|