eddev 0.2.0-beta.12 → 0.2.0-beta.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/build/get-webpack-config.js +1 -0
  2. package/build/serverless/create-next-app.js +60 -56
  3. package/cli/cli.js +4 -4
  4. package/components/PageHead.d.ts +1 -0
  5. package/components/PageHead.js +2 -0
  6. package/components/PageMeta.d.ts +1 -0
  7. package/components/PageMeta.js +2 -0
  8. package/components/PageMeta.monolith.d.ts +1 -0
  9. package/components/PageMeta.monolith.js +2 -0
  10. package/components/ServerlessPageMeta.d.ts +1 -0
  11. package/components/ServerlessPageMeta.js +2 -0
  12. package/config/config-schema.d.ts +5 -0
  13. package/config/config-schema.js +1 -0
  14. package/config/get-config.d.ts +3 -0
  15. package/config/parse-config.d.ts +2 -0
  16. package/dev-ui/components/{BreakpointItemHeader.d.ts → BreakpointColumnHeader.d.ts} +0 -0
  17. package/dev-ui/components/{BreakpointItemHeader.js → BreakpointColumnHeader.js} +3 -6
  18. package/dev-ui/components/BreakpointIndicator.d.ts +2 -0
  19. package/dev-ui/components/BreakpointIndicator.js +138 -0
  20. package/dev-ui/components/DevUI.d.ts +1 -1
  21. package/dev-ui/components/DevUI.js +13 -4
  22. package/dev-ui/components/Launcher.d.ts +90 -1
  23. package/dev-ui/components/Launcher.js +12 -36
  24. package/dev-ui/components/PanelWrapper.d.ts +6 -2
  25. package/dev-ui/components/PanelWrapper.js +22 -6
  26. package/dev-ui/components/ResponsiveLerpControl.d.ts +8 -0
  27. package/dev-ui/components/ResponsiveLerpControl.js +177 -0
  28. package/dev-ui/components/ResponsiveScaleEditor.d.ts +26 -0
  29. package/dev-ui/components/ResponsiveScaleEditor.js +233 -0
  30. package/dev-ui/components/atoms/Button.d.ts +47 -0
  31. package/dev-ui/components/atoms/Button.js +67 -0
  32. package/dev-ui/components/atoms/Dropdown.d.ts +13 -0
  33. package/dev-ui/components/atoms/Dropdown.js +50 -0
  34. package/dev-ui/components/atoms/NumberField.d.ts +12 -0
  35. package/dev-ui/components/atoms/NumberField.js +111 -0
  36. package/dev-ui/components/atoms/Spacer.d.ts +42 -0
  37. package/dev-ui/components/atoms/Spacer.js +8 -0
  38. package/dev-ui/components/{Text.d.ts → atoms/Text.d.ts} +7 -1
  39. package/dev-ui/components/atoms/Text.js +39 -0
  40. package/dev-ui/components/atoms/ToggleButton.d.ts +8 -0
  41. package/dev-ui/components/atoms/ToggleButton.js +41 -0
  42. package/dev-ui/components/atoms/Tooltip.d.ts +9 -0
  43. package/dev-ui/components/atoms/Tooltip.js +66 -0
  44. package/dev-ui/components/panels/PageDataDebugger.d.ts +2 -0
  45. package/dev-ui/components/panels/PageDataDebugger.js +30 -0
  46. package/dev-ui/components/panels/SpacingEditor.js +65 -33
  47. package/dev-ui/components/panels/TypographyEditor.d.ts +2 -0
  48. package/dev-ui/components/panels/TypographyEditor.js +88 -0
  49. package/dev-ui/hooks/useBreakpoint.d.ts +11 -0
  50. package/dev-ui/hooks/useBreakpoint.js +59 -0
  51. package/dev-ui/hooks/usePersistState.js +9 -1
  52. package/dev-ui/hooks/useStylesheet.d.ts +4 -0
  53. package/dev-ui/hooks/useStylesheet.js +31 -0
  54. package/dev-ui/icons.d.ts +4 -0
  55. package/dev-ui/icons.js +5 -1
  56. package/dev-ui/index.d.ts +1 -1
  57. package/dev-ui/index.js +11 -3
  58. package/dev-ui/loader.d.ts +2 -0
  59. package/dev-ui/loader.js +42 -0
  60. package/dev-ui/panels.js +9 -7
  61. package/dev-ui/theme.d.ts +16 -0
  62. package/dev-ui/theme.js +7 -2
  63. package/dynamic/dynamic-component.d.ts +1 -0
  64. package/entry/Root.js +2 -2
  65. package/package.json +12 -1
  66. package/serverless/create-rpc-client.d.ts +6 -17
  67. package/serverless-template/_utils/PageMeta.tsx +44 -0
  68. package/serverless-template/_utils/fetch-wordpress-props.ts +10 -3
  69. package/serverless-template/_utils/fetch-wp.ts +16 -0
  70. package/serverless-template/global.d.ts +1 -0
  71. package/serverless-template/next.config.js +2 -0
  72. package/serverless-template/pages/_app.tsx +7 -0
  73. package/style/createStitches.d.ts +14 -5
  74. package/style/createStitches.js +15 -51
  75. package/utils/updateEnvFile.d.ts +1 -0
  76. package/utils/updateEnvFile.js +76 -0
  77. package/build/workers/serverless-worker-script.d.ts +0 -0
  78. package/build/workers/serverless-worker-script.js +0 -1
  79. package/dev-ui/components/BreakpointList.d.ts +0 -6
  80. package/dev-ui/components/BreakpointList.js +0 -38
  81. package/dev-ui/components/Pill.d.ts +0 -0
  82. package/dev-ui/components/Pill.js +0 -1
  83. package/dev-ui/components/SpacingEditor.d.ts +0 -2
  84. package/dev-ui/components/SpacingEditor.js +0 -10
  85. package/dev-ui/components/Text.js +0 -13
@@ -11,18 +11,20 @@ var __assign = (this && this.__assign) || function () {
11
11
  return __assign.apply(this, arguments);
12
12
  };
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.Launcher = void 0;
14
+ exports.MenuItem = exports.Launcher = void 0;
15
15
  var jsx_runtime_1 = require("react/jsx-runtime");
16
16
  var icons_1 = require("../icons");
17
17
  var panels_1 = require("../panels");
18
18
  var theme_1 = require("../theme");
19
+ var Button_1 = require("./atoms/Button");
19
20
  function Launcher(props) {
20
21
  return ((0, jsx_runtime_1.jsxs)(LauncherWrapper, { children: [(0, jsx_runtime_1.jsx)(LauncherButton, __assign({ onClick: function (e) {
21
22
  props.onChange(!props.open, props.panel);
22
- } }, { children: props.open ? icons_1.close : icons_1.bolt }), void 0), (0, jsx_runtime_1.jsx)(Menu, __assign({ open: props.open }, { children: Object.entries(panels_1.DEV_UI_PANELS).map(function (_a) {
23
- var key = _a[0], panel = _a[1];
24
- return ((0, jsx_runtime_1.jsxs)(MenuItem, __assign({ state: key === props.panel ? "active" : props.panel ? "inactive" : undefined, onClick: function () { return props.onChange(true, key); } }, { children: [panel.icon, panel.label] }), key));
25
- }) }), void 0)] }, void 0));
23
+ } }, { children: props.open ? icons_1.close : icons_1.bolt }), void 0), (0, jsx_runtime_1.jsxs)(Menu, { children: [props.open &&
24
+ Object.entries(panels_1.DEV_UI_PANELS).map(function (_a) {
25
+ var key = _a[0], panel = _a[1];
26
+ return ((0, jsx_runtime_1.jsxs)(exports.MenuItem, __assign({ state: key === props.panel ? "active" : props.panel ? "inactive" : undefined, onClick: function () { return props.onChange(true, props.panel === key ? undefined : key); } }, { children: [panel.icon, panel.label] }), key));
27
+ }), props.extras] }, void 0)] }, void 0));
26
28
  }
27
29
  exports.Launcher = Launcher;
28
30
  var LauncherWrapper = (0, theme_1.styled)("div", {
@@ -31,7 +33,7 @@ var LauncherWrapper = (0, theme_1.styled)("div", {
31
33
  left: "5px",
32
34
  zIndex: 100000000,
33
35
  fontFamily: "$body",
34
- fontSize: "$md",
36
+ fontSize: "$sm",
35
37
  pointerEvents: "none",
36
38
  $$height: "$space$buttonHeight",
37
39
  userSelect: "none",
@@ -66,7 +68,6 @@ var Menu = (0, theme_1.styled)("div", {
66
68
  flexDirection: "row",
67
69
  alignItems: "flex-start",
68
70
  width: "calc(100vw - 40px)",
69
- overflow: "auto",
70
71
  "&::-webkit-scrollbar": {
71
72
  width: 0,
72
73
  height: 0,
@@ -84,35 +85,10 @@ var Menu = (0, theme_1.styled)("div", {
84
85
  },
85
86
  },
86
87
  });
87
- var MenuItem = (0, theme_1.styled)("div", {
88
- background: "$bg",
89
- color: "$fg",
90
- borderRadius: "100px",
91
- whiteSpace: "nowrap",
88
+ exports.MenuItem = (0, theme_1.styled)(Button_1.Button, {
92
89
  marginRight: "4px",
93
- padding: "4px 8px",
94
- display: "flex",
95
- alignItems: "center",
96
- cursor: "pointer",
97
- boxSizing: "border-box",
98
- height: "$$height",
99
- "&:hover": {
100
- backgroundColor: "$bgHover",
101
- color: "$fg",
102
- },
103
- svg: {
104
- display: "block",
105
- fill: "currentColor",
106
- marginRight: "5px",
107
- width: "14px",
108
- height: "14px",
109
- },
110
- variants: {
111
- state: {
112
- active: {},
113
- inactive: {
114
- color: "$fgFaded",
115
- },
116
- },
90
+ defaultVariants: {
91
+ color: "dark",
117
92
  },
93
+ flex: "0 0 auto",
118
94
  });
@@ -1,4 +1,8 @@
1
- import { PropsWithChildren } from "react";
2
- declare type Props = PropsWithChildren<{}>;
1
+ import { PropsWithChildren, ReactNode } from "react";
2
+ declare type Props = PropsWithChildren<{
3
+ padded?: boolean;
4
+ title?: string;
5
+ buttons?: ReactNode;
6
+ }>;
3
7
  export declare function PanelWrapper(props: Props): JSX.Element;
4
8
  export {};
@@ -4,18 +4,34 @@ exports.PanelWrapper = void 0;
4
4
  var jsx_runtime_1 = require("react/jsx-runtime");
5
5
  var theme_1 = require("../theme");
6
6
  function PanelWrapper(props) {
7
- return (0, jsx_runtime_1.jsx)(Wrapper, { children: props.children }, void 0);
7
+ return ((0, jsx_runtime_1.jsxs)(Wrapper, { children: [(0, jsx_runtime_1.jsxs)(Header, { children: [props.title && (0, jsx_runtime_1.jsx)(Title, { children: props.title }, void 0), " ", (0, jsx_runtime_1.jsx)(Buttons, { children: props.buttons }, void 0)] }, void 0), (0, jsx_runtime_1.jsx)(Contents, { children: props.children }, void 0)] }, void 0));
8
8
  }
9
9
  exports.PanelWrapper = PanelWrapper;
10
10
  var Wrapper = (0, theme_1.styled)("div", {
11
- position: "fixed",
12
- left: "5px",
13
- bottom: "calc($space$buttonHeight + 10px)",
14
11
  backgroundColor: "$bg",
15
12
  color: "$fg",
16
- borderRadius: "$sm",
13
+ borderRadius: "$md",
17
14
  maxWidth: "calc(100vw - 10px)",
18
15
  fontFamily: "$body",
19
16
  fontSize: "$md",
20
- zIndex: 10000000,
17
+ margin: "5px",
18
+ });
19
+ var Header = (0, theme_1.styled)("div", {
20
+ borderBottom: "1px solid $colors$bgHover",
21
+ padding: "$2",
22
+ display: "flex",
23
+ });
24
+ var Title = (0, theme_1.styled)("div", {
25
+ fontSize: "$lg",
26
+ flex: "1 1 auto",
27
+ });
28
+ var Contents = (0, theme_1.styled)("div", {
29
+ padding: "$2",
30
+ });
31
+ var Buttons = (0, theme_1.styled)("div", {
32
+ display: "flex",
33
+ alignItems: "center",
34
+ "> *": {
35
+ marginLeft: "5px",
36
+ },
21
37
  });
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import { ResponsiveAtomCalc } from "../../style";
3
+ declare type Props = {
4
+ data: ResponsiveAtomCalc[];
5
+ onToggleLerping?(breakpoint: string, enabled: boolean): void;
6
+ };
7
+ export declare function ResponsiveLerpControl(props: Props): JSX.Element;
8
+ export {};
@@ -0,0 +1,177 @@
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.ResponsiveLerpControl = void 0;
15
+ var jsx_runtime_1 = require("react/jsx-runtime");
16
+ var react_1 = require("react");
17
+ var icons_1 = require("../icons");
18
+ var theme_1 = require("../theme");
19
+ var Tooltip_1 = require("./atoms/Tooltip");
20
+ function ResponsiveLerpControl(props) {
21
+ var breakpoints = (0, react_1.useMemo)(function () {
22
+ return props.data.map(function (item) { return item.breakpoint; });
23
+ }, [props.data]);
24
+ var ranges = (0, react_1.useMemo)(function () {
25
+ var ranges = [];
26
+ var currentRange = undefined;
27
+ props.data.forEach(function (item, i) {
28
+ if (!currentRange) {
29
+ currentRange = {
30
+ fromBP: item.breakpoint,
31
+ toBP: item.breakpoint,
32
+ length: 1,
33
+ lerped: item.lerpStart,
34
+ isStart: true,
35
+ isEnd: false,
36
+ };
37
+ ranges.push(currentRange);
38
+ }
39
+ else if (item.defined) {
40
+ currentRange = {
41
+ fromBP: item.breakpoint,
42
+ toBP: item.breakpoint,
43
+ length: 1,
44
+ lerped: item.lerpStart,
45
+ isStart: false,
46
+ isEnd: false,
47
+ };
48
+ ranges.push(currentRange);
49
+ }
50
+ else {
51
+ currentRange.toBP = item.breakpoint;
52
+ currentRange.length += 1;
53
+ }
54
+ currentRange.isEnd = i === props.data.length - 1;
55
+ });
56
+ return ranges;
57
+ }, [props.data]);
58
+ var lerpablePoints = (0, react_1.useMemo)(function () {
59
+ var points = [];
60
+ var length = 0;
61
+ ranges.forEach(function (range) {
62
+ if (!range.isEnd && !range.isStart) {
63
+ points.push({ index: length + range.length / 2, bp: range.fromBP, lerping: range.lerped });
64
+ }
65
+ length += range.length;
66
+ });
67
+ return points;
68
+ }, [props.data, ranges]);
69
+ console.log("Ranges", ranges, lerpablePoints);
70
+ return ((0, jsx_runtime_1.jsxs)(Outer, { children: [ranges.map(function (item, i) {
71
+ return ((0, jsx_runtime_1.jsx)(RangeItem, __assign({ css: { $$length: item.length } }, { children: (0, jsx_runtime_1.jsx)(RangeLine, { lerping: item.lerped, hasStart: !item.isStart, hasEnd: !item.isEnd }, void 0) }), i));
72
+ }), props.onToggleLerping &&
73
+ lerpablePoints.map(function (item, i) {
74
+ return ((0, jsx_runtime_1.jsx)(LerpButton, __assign({ onClick: function () {
75
+ if (props.onToggleLerping) {
76
+ props.onToggleLerping(item.bp, !item.lerping);
77
+ }
78
+ }, lerping: item.lerping, css: { $$pos: item.index / breakpoints.length } }, { children: (0, jsx_runtime_1.jsx)(Tooltip_1.Tooltip, __assign({ 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 }, void 0) }), void 0) }), i));
79
+ })] }, void 0));
80
+ }
81
+ exports.ResponsiveLerpControl = ResponsiveLerpControl;
82
+ var Outer = (0, theme_1.styled)("div", {
83
+ width: "100%",
84
+ $$height: "16px",
85
+ height: "$$height",
86
+ display: "flex",
87
+ alignItems: "stretch",
88
+ position: "relative",
89
+ });
90
+ var RangeItem = (0, theme_1.styled)("div", {
91
+ flexGrow: "$$length",
92
+ position: "relative",
93
+ });
94
+ var RangeLine = (0, theme_1.styled)("div", {
95
+ position: "absolute",
96
+ left: "5px",
97
+ right: "5px",
98
+ top: "50%",
99
+ height: "3px",
100
+ transform: "translateY(-50%)",
101
+ background: "linear-gradient(to right, $$color1, $$color2)",
102
+ $$segHeight: "8px",
103
+ $$color1: "#888888",
104
+ $$color2: "#888888",
105
+ "&:before, &:after": {
106
+ position: "absolute",
107
+ height: "$$segHeight",
108
+ display: "block",
109
+ content: " ",
110
+ width: "2px",
111
+ top: "50%",
112
+ backgroundColor: "$$color1",
113
+ transform: "translateY(-50%)",
114
+ },
115
+ "&:after": {
116
+ right: 0,
117
+ backgroundColor: "$$color2",
118
+ },
119
+ variants: {
120
+ lerping: {
121
+ true: {
122
+ $$color1: "#FEBDF6",
123
+ $$color2: "#84FEDA",
124
+ },
125
+ },
126
+ hasEnd: {
127
+ false: {
128
+ $$color2: "transparent",
129
+ },
130
+ },
131
+ hasStart: {
132
+ false: {
133
+ $$color1: "transparent",
134
+ },
135
+ },
136
+ },
137
+ });
138
+ var LerpButton = (0, theme_1.styled)("div", {
139
+ position: "absolute",
140
+ left: "calc(100% * $$pos)",
141
+ top: "50%",
142
+ transform: "translate(-50%, -50%)",
143
+ opacity: 0,
144
+ backgroundColor: "$bg",
145
+ padding: "2px",
146
+ cursor: "pointer",
147
+ svg: {
148
+ fill: "currentColor",
149
+ width: "12px",
150
+ height: "12px",
151
+ display: "block",
152
+ },
153
+ "&:hover": {
154
+ opacity: 1,
155
+ },
156
+ variants: {
157
+ lerping: {
158
+ true: {
159
+ color: "#ff5555",
160
+ },
161
+ false: {
162
+ color: "#ffff55",
163
+ },
164
+ },
165
+ },
166
+ });
167
+ var LerpButtonInner = (0, theme_1.styled)("div", {
168
+ "&:before": {
169
+ content: " ",
170
+ display: "block",
171
+ position: "absolute",
172
+ left: "-10px",
173
+ top: "-5px",
174
+ right: "-10px",
175
+ bottom: "-5px",
176
+ },
177
+ });
@@ -0,0 +1,26 @@
1
+ /// <reference types="react" />
2
+ import { BreakpointArray } from "../../style";
3
+ export declare const RESPONSIVE_COLUMN_WIDTH = "110px";
4
+ export declare const RESPONSIVE_ROW_HEIGHT = "20px";
5
+ declare type ModeType = "px" | "multiplier" | "%" | "number";
6
+ declare type TokenData = {
7
+ [token: string]: {
8
+ [breakpoint: string]: string | [string];
9
+ };
10
+ };
11
+ declare type Props = {
12
+ editableRange?: boolean;
13
+ editableValues?: boolean;
14
+ showBreakpointName?: boolean;
15
+ showValues?: boolean;
16
+ showRange?: boolean;
17
+ data: TokenData;
18
+ breakpoints: BreakpointArray;
19
+ tabIndexStart?: number;
20
+ related?: boolean;
21
+ labelWidth: string;
22
+ modes: ModeType[];
23
+ onChange(data: TokenData): void;
24
+ };
25
+ export declare function ResponsiveScaleEditor(props: Props): JSX.Element;
26
+ export {};
@@ -0,0 +1,233 @@
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 __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.ResponsiveScaleEditor = exports.RESPONSIVE_ROW_HEIGHT = exports.RESPONSIVE_COLUMN_WIDTH = void 0;
18
+ var jsx_runtime_1 = require("react/jsx-runtime");
19
+ var style_1 = require("../../style");
20
+ var theme_1 = require("../theme");
21
+ var NumberField_1 = require("./atoms/NumberField");
22
+ var ResponsiveLerpControl_1 = require("./ResponsiveLerpControl");
23
+ var Text_1 = require("./atoms/Text");
24
+ var ToggleButton_1 = require("./atoms/ToggleButton");
25
+ var Tooltip_1 = require("./atoms/Tooltip");
26
+ var react_1 = require("react");
27
+ var immer_1 = __importDefault(require("immer"));
28
+ // @ts-ignore
29
+ var _theme_1 = require("@theme");
30
+ exports.RESPONSIVE_COLUMN_WIDTH = "110px";
31
+ exports.RESPONSIVE_ROW_HEIGHT = "20px";
32
+ function ResponsiveScaleEditor(props) {
33
+ var values = props.data;
34
+ var rows = (0, react_1.useMemo)(function () {
35
+ return Object.entries(props.data).map(function (_a) {
36
+ var key = _a[0], row = _a[1];
37
+ var info = (0, style_1.parseResponsiveObject)(props.breakpoints, row);
38
+ return {
39
+ token: key,
40
+ row: info,
41
+ };
42
+ });
43
+ }, [props.data]);
44
+ var general = (0, react_1.useMemo)(function () {
45
+ return props.data[0];
46
+ }, [props.data]);
47
+ var onChangeValue = function (item, value, token) {
48
+ props.onChange((0, immer_1.default)(values, function (draft) {
49
+ var subvalue = item.type === "px" ? value + "px" : item.type === "multiplier" ? "x" + value : undefined;
50
+ if (item.lerpStart && typeof subvalue === "string") {
51
+ subvalue = [subvalue];
52
+ }
53
+ if (subvalue === undefined) {
54
+ delete draft[token]["@" + item.breakpoint];
55
+ }
56
+ else {
57
+ draft[token]["@" + item.breakpoint] = subvalue;
58
+ }
59
+ }));
60
+ };
61
+ var onChangeUnits = function (breakpoint, token) {
62
+ var sampleValue = rows.find(function (r) { return r.token === token; }).row.find(function (item) { return item.breakpoint === breakpoint; });
63
+ var nextType = props.modes[(props.modes.indexOf(sampleValue.type) + 1) % props.modes.length];
64
+ props.onChange((0, immer_1.default)(values, function (draft) {
65
+ var updateToken = function (rowIndex) {
66
+ var token = rows[rowIndex].token;
67
+ var item = rows[rowIndex].row.find(function (i) { return i.breakpoint === breakpoint; });
68
+ var base = rows[rowIndex].row.find(function (i) { return i.breakpoint === item.lastBreakpoint; });
69
+ var nextValue;
70
+ if (item.type === "px" && nextType === "multiplier") {
71
+ if (base) {
72
+ console.log(item.value, base.concreteValue);
73
+ nextValue = "x" + item.value / (base === null || base === void 0 ? void 0 : base.concreteValue);
74
+ }
75
+ }
76
+ else if (item.type === "multiplier" && nextType === "px") {
77
+ nextValue = item.value * (base === null || base === void 0 ? void 0 : base.concreteValue) + "px";
78
+ }
79
+ if (nextValue) {
80
+ if (item.lerpStart) {
81
+ nextValue = [nextValue];
82
+ }
83
+ draft[token]["@" + item.breakpoint] = nextValue;
84
+ }
85
+ };
86
+ if (props.related) {
87
+ for (var i = 0; i < rows.length; i++) {
88
+ updateToken(i);
89
+ }
90
+ }
91
+ }));
92
+ };
93
+ var onToggleLerping = function (breakpoint, lerping) {
94
+ props.onChange((0, immer_1.default)(values, function (values) {
95
+ for (var token in values) {
96
+ var subval = values[token]["@" + breakpoint];
97
+ if (Array.isArray(subval)) {
98
+ subval = subval[0];
99
+ }
100
+ values[token]["@" + breakpoint] = lerping ? [subval] : subval;
101
+ }
102
+ }));
103
+ };
104
+ var onToggleBreakpoint = function (item, enabled) {
105
+ var breakpoint = item.breakpoint;
106
+ if (!enabled) {
107
+ props.onChange((0, immer_1.default)(values, function (values) {
108
+ for (var token in values) {
109
+ delete values[token]["@" + breakpoint];
110
+ }
111
+ }));
112
+ }
113
+ else {
114
+ props.onChange((0, immer_1.default)(values, function (values) {
115
+ for (var token in values) {
116
+ var original = _theme_1.originalConfig.responsive.space[token]["@" + breakpoint];
117
+ var value = original;
118
+ if (!value) {
119
+ value = values[token]["@" + item.baseBreakpoint];
120
+ }
121
+ if (!value)
122
+ value = "1px";
123
+ values[token]["@" + breakpoint] = value;
124
+ }
125
+ }));
126
+ }
127
+ };
128
+ return ((0, jsx_runtime_1.jsxs)(Wrapper, __assign({ css: { $$total: props.data.length, $$labelWidth: props.labelWidth } }, { children: [props.showBreakpointName && ((0, jsx_runtime_1.jsx)(Row, __assign({ heading: true }, { children: rows[0].row.map(function (item, i) {
129
+ var bp = props.breakpoints[i];
130
+ return ((0, jsx_runtime_1.jsx)(Col, __assign({ css: { textAlign: "center" } }, { children: (0, jsx_runtime_1.jsx)(Tooltip_1.Tooltip, __assign({ label: "".concat(bp.min, " to ").concat(bp.max || "∞"), mono: true, nowrap: true }, { children: (0, jsx_runtime_1.jsx)(ToggleButton_1.ToggleButton, { checked: item.defined, onChange: function (checked) {
131
+ onToggleBreakpoint === null || onToggleBreakpoint === void 0 ? void 0 : onToggleBreakpoint(item, checked);
132
+ }, label: (0, jsx_runtime_1.jsx)(Text_1.Text, __assign({ as: "span", variant: "monoBold" }, { children: item.breakpoint }), void 0) }, void 0) }), void 0) }), i));
133
+ }) }), void 0)), props.showRange && ((0, jsx_runtime_1.jsx)(Row, __assign({ heading: true }, { children: (0, jsx_runtime_1.jsx)(ResponsiveLerpControl_1.ResponsiveLerpControl, { onToggleLerping: onToggleLerping, data: rows[0].row }, void 0) }), void 0)), props.showValues && ((0, jsx_runtime_1.jsx)(react_1.Fragment, { children: rows.map(function (_a, rowIndex) {
134
+ var token = _a.token, row = _a.row;
135
+ return ((0, jsx_runtime_1.jsxs)(Row, __assign({ hoverable: true, labelIndent: false }, { children: [(0, jsx_runtime_1.jsx)(RowLabel, { children: (0, jsx_runtime_1.jsx)(Text_1.Text, __assign({ variant: "monoBold" }, { children: token }), void 0) }, void 0), row.map(function (item, i) {
136
+ var tabIndex = 500 + (props.tabIndexStart || 0) + i * 100;
137
+ return ((0, jsx_runtime_1.jsxs)(Col, { children: [(0, jsx_runtime_1.jsx)(Field, { children: item.type === "multiplier" ||
138
+ item.type === "number" ||
139
+ 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: function (value) {
141
+ onChangeValue(item, value, token);
142
+ }, increment: item.type === "px" ? 1 : 0.1 }, void 0)) : null }, void 0), item.defined && (!props.related || rowIndex === 0) && ((0, jsx_runtime_1.jsx)(ToolbarButton, __assign({ onClick: function () {
143
+ onChangeUnits(item.breakpoint, token);
144
+ } }, { children: item.type === "px" ? "px" : "multiplier" }), void 0))] }, i));
145
+ })] }), rowIndex));
146
+ }) }, void 0))] }), void 0));
147
+ }
148
+ exports.ResponsiveScaleEditor = ResponsiveScaleEditor;
149
+ var Wrapper = (0, theme_1.styled)("div", {
150
+ position: "relative",
151
+ width: "calc(".concat(exports.RESPONSIVE_COLUMN_WIDTH, " * $$total)"),
152
+ $$lineColor: "$colors$bgLine",
153
+ });
154
+ var Row = (0, theme_1.styled)("div", {
155
+ display: "flex",
156
+ borderBottom: "1px solid $$lineColor",
157
+ paddingLeft: "$$labelWidth",
158
+ variants: {
159
+ heading: {
160
+ true: {
161
+ $$lineColor: "transparent",
162
+ },
163
+ },
164
+ labelIndent: {
165
+ false: {
166
+ paddingLeft: "0",
167
+ },
168
+ },
169
+ hoverable: {
170
+ true: {
171
+ "&:hover": {
172
+ backgroundColor: "$colors$bgLine",
173
+ },
174
+ },
175
+ },
176
+ },
177
+ });
178
+ var Col = (0, theme_1.styled)("div", {
179
+ position: "relative",
180
+ width: exports.RESPONSIVE_COLUMN_WIDTH,
181
+ height: exports.RESPONSIVE_ROW_HEIGHT,
182
+ boxSizing: "border-box",
183
+ borderLeft: "1px solid $$lineColor",
184
+ display: "flex",
185
+ alignItems: "center",
186
+ justifyContent: "center",
187
+ paddingRight: "4px",
188
+ variants: {
189
+ autoHeight: {
190
+ true: {
191
+ height: "auto",
192
+ },
193
+ },
194
+ },
195
+ });
196
+ var Field = (0, theme_1.styled)("div", {
197
+ flex: "1 1 auto",
198
+ });
199
+ // const Start = styled("div", {
200
+ // position: "absolute",
201
+ // })
202
+ // const End = styled("div", {
203
+ // position: "absolute",
204
+ // right: 2,
205
+ // })
206
+ var RowLabel = (0, theme_1.styled)("div", {
207
+ width: "$$labelWidth",
208
+ height: exports.RESPONSIVE_ROW_HEIGHT,
209
+ boxSizing: "border-box",
210
+ flex: "0 0 auto",
211
+ });
212
+ var Toolbar = (0, theme_1.styled)("div", {
213
+ display: "flex",
214
+ textAlign: "left",
215
+ width: "100%",
216
+ paddingLeft: "4px",
217
+ paddingBottom: "4px",
218
+ button: {
219
+ marginRight: "3px",
220
+ },
221
+ });
222
+ var ToolbarButton = (0, theme_1.styled)("button", {
223
+ fontSize: "9px",
224
+ appearance: "none",
225
+ border: 0,
226
+ backgroundColor: "$colors$button",
227
+ color: "$colors$fg",
228
+ borderRadius: "4px",
229
+ padding: "0px 4px",
230
+ "&:hover": {
231
+ backgroundColor: "$colors$buttonHover",
232
+ },
233
+ });
@@ -0,0 +1,47 @@
1
+ export declare const Button: import("@stitches/react/types/styled-component").StyledComponent<"button", {
2
+ state?: "active" | "inactive" | undefined;
3
+ color?: "default" | "black" | undefined;
4
+ small?: boolean | "true" | undefined;
5
+ tiny?: boolean | "true" | undefined;
6
+ }, {}, import("@stitches/react/types/css-util").CSS<{}, {
7
+ space: {
8
+ smallButtonHeight: string;
9
+ buttonHeight: string;
10
+ 0: string;
11
+ 1: string;
12
+ 2: string;
13
+ 3: string;
14
+ 4: string;
15
+ 5: string;
16
+ 6: string;
17
+ };
18
+ colors: {
19
+ bg: string;
20
+ bgHover: string;
21
+ bgHoverLight: string;
22
+ bgLine: string;
23
+ bgLineStrong: string;
24
+ button: string;
25
+ buttonHover: string;
26
+ fg: string;
27
+ fgFaded: string;
28
+ };
29
+ fontSizes: {
30
+ sm: string;
31
+ md: string;
32
+ lg: string;
33
+ xl: string;
34
+ };
35
+ fonts: {
36
+ body: string;
37
+ mono: string;
38
+ };
39
+ radii: {
40
+ sm: string;
41
+ md: string;
42
+ lg: string;
43
+ };
44
+ transitions: {
45
+ default: string;
46
+ };
47
+ }, import("@stitches/react/types/config").DefaultThemeMap, {}>>;