eddev 0.2.0-beta.1 → 0.2.0-beta.13

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 (112) hide show
  1. package/build/build-favicon.d.ts +1 -0
  2. package/build/build-favicon.js +71 -0
  3. package/build/create-serverless-dev-worker.d.ts +3 -0
  4. package/build/create-serverless-dev-worker.js +99 -0
  5. package/build/get-webpack-config.js +19 -11
  6. package/build/reporter.js +0 -109
  7. package/build/serverless/create-next-app.d.ts +2 -0
  8. package/build/serverless/create-next-app.js +212 -76
  9. package/build/state/serverless-state.d.ts +26 -0
  10. package/build/state/serverless-state.js +2 -0
  11. package/build/workers/serverless-worker-dev-script.d.ts +1 -0
  12. package/build/workers/serverless-worker-dev-script.js +21 -0
  13. package/cli/build.dev.js +30 -7
  14. package/cli/build.prod.js +5 -0
  15. package/cli/cli.js +23 -15
  16. package/cli/display/components/DevCLIDisplay.d.ts +3 -0
  17. package/cli/display/components/DevCLIDisplay.js +20 -1
  18. package/cli/display/components/ServerlessDisplay.d.ts +9 -0
  19. package/cli/display/components/ServerlessDisplay.js +68 -0
  20. package/config/config-schema.d.ts +50 -0
  21. package/config/config-schema.js +18 -0
  22. package/config/create-schema-file.d.ts +1 -0
  23. package/config/create-schema-file.js +20 -0
  24. package/config/get-config.d.ts +36 -0
  25. package/config/get-config.js +32 -0
  26. package/config/index.d.ts +2 -0
  27. package/config/index.js +14 -0
  28. package/config/parse-config.d.ts +23 -0
  29. package/config/parse-config.js +8 -0
  30. package/config/print-zod-errors.d.ts +2 -0
  31. package/config/print-zod-errors.js +14 -0
  32. package/dev-ui/components/BreakpointColumnHeader.d.ts +11 -0
  33. package/dev-ui/components/BreakpointColumnHeader.js +47 -0
  34. package/dev-ui/components/BreakpointIndicator.d.ts +2 -0
  35. package/dev-ui/components/BreakpointIndicator.js +138 -0
  36. package/dev-ui/components/BreakpointList.d.ts +6 -0
  37. package/dev-ui/components/BreakpointList.js +38 -0
  38. package/dev-ui/components/DevUI.d.ts +2 -0
  39. package/dev-ui/components/DevUI.js +29 -0
  40. package/dev-ui/components/Launcher.d.ts +98 -0
  41. package/dev-ui/components/Launcher.js +94 -0
  42. package/dev-ui/components/PanelWrapper.d.ts +8 -0
  43. package/dev-ui/components/PanelWrapper.js +37 -0
  44. package/dev-ui/components/ResponsiveLerpControl.d.ts +8 -0
  45. package/dev-ui/components/ResponsiveLerpControl.js +177 -0
  46. package/dev-ui/components/ResponsiveScaleEditor.d.ts +26 -0
  47. package/dev-ui/components/ResponsiveScaleEditor.js +233 -0
  48. package/dev-ui/components/ResponsiveScaleHeader.d.ts +15 -0
  49. package/dev-ui/components/ResponsiveScaleHeader.js +51 -0
  50. package/dev-ui/components/atoms/Button.d.ts +47 -0
  51. package/dev-ui/components/atoms/Button.js +67 -0
  52. package/dev-ui/components/atoms/Dropdown.d.ts +13 -0
  53. package/dev-ui/components/atoms/Dropdown.js +50 -0
  54. package/dev-ui/components/atoms/NumberField.d.ts +12 -0
  55. package/dev-ui/components/atoms/NumberField.js +111 -0
  56. package/dev-ui/components/atoms/Spacer.d.ts +42 -0
  57. package/dev-ui/components/atoms/Spacer.js +8 -0
  58. package/dev-ui/components/atoms/Text.d.ts +45 -0
  59. package/dev-ui/components/atoms/Text.js +39 -0
  60. package/dev-ui/components/atoms/ToggleButton.d.ts +8 -0
  61. package/dev-ui/components/atoms/ToggleButton.js +41 -0
  62. package/dev-ui/components/atoms/Tooltip.d.ts +9 -0
  63. package/dev-ui/components/atoms/Tooltip.js +66 -0
  64. package/dev-ui/components/panels/PageDataDebugger.d.ts +2 -0
  65. package/dev-ui/components/panels/PageDataDebugger.js +30 -0
  66. package/dev-ui/components/panels/SpacingEditor.d.ts +2 -0
  67. package/dev-ui/components/panels/SpacingEditor.js +88 -0
  68. package/dev-ui/components/panels/TypographyEditor.d.ts +2 -0
  69. package/dev-ui/components/panels/TypographyEditor.js +88 -0
  70. package/dev-ui/hooks/useBreakpoint.d.ts +11 -0
  71. package/dev-ui/hooks/useBreakpoint.js +59 -0
  72. package/dev-ui/hooks/usePersistState.d.ts +1 -0
  73. package/dev-ui/hooks/usePersistState.js +33 -0
  74. package/dev-ui/hooks/useStylesheet.d.ts +4 -0
  75. package/dev-ui/hooks/useStylesheet.js +31 -0
  76. package/dev-ui/icons.d.ts +15 -0
  77. package/dev-ui/icons.js +29 -0
  78. package/dev-ui/index.d.ts +1 -0
  79. package/dev-ui/index.js +5 -0
  80. package/dev-ui/panels.d.ts +11 -0
  81. package/dev-ui/panels.js +33 -0
  82. package/dev-ui/theme.d.ts +150 -0
  83. package/dev-ui/theme.js +50 -0
  84. package/entry/Root.js +6 -5
  85. package/hooks/useAppData.js +0 -1
  86. package/package.json +8 -7
  87. package/serverless/create-rpc-client.d.ts +33 -0
  88. package/serverless/create-rpc-client.js +20 -0
  89. package/serverless/define-api.d.ts +2 -0
  90. package/serverless/define-api.js +66 -0
  91. package/serverless/define-rpc-router.d.ts +2 -0
  92. package/serverless/define-rpc-router.js +27 -0
  93. package/serverless/error-codes.d.ts +2 -0
  94. package/serverless/error-codes.js +14 -0
  95. package/serverless/index.d.ts +4 -0
  96. package/serverless/index.js +16 -0
  97. package/serverless/rpc-provider.d.ts +1 -0
  98. package/serverless/rpc-provider.js +5 -0
  99. package/serverless-template/_utils/ed-config.ts +5 -0
  100. package/serverless-template/_utils/fetch-wordpress-props.ts +30 -6
  101. package/serverless-template/next.config.js +63 -52
  102. package/serverless-template/pages/_app.tsx +0 -2
  103. package/serverless-template/pages/_document.tsx +19 -0
  104. package/style/createStitches.d.ts +75 -6
  105. package/style/createStitches.js +151 -45
  106. package/utils/getRepoName.d.ts +2 -2
  107. package/utils/getRepoName.js +14 -52
  108. package/cli/prepare-next.d.ts +0 -0
  109. package/cli/prepare-next.js +0 -1
  110. package/fields/ImageWell.d.ts +0 -8
  111. package/fields/ImageWell.js +0 -64
  112. package/serverless-template/package-lock.json +0 -641
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { DefaultThemeMap } from "@stitches/react";
3
2
  import { ConfigType } from "@stitches/core/types/config";
4
3
  import { Properties as CSS } from "csstype";
@@ -18,6 +17,12 @@ declare type TypographyConfig<Theme extends ConfigType.Theme<{}>, Media extends
18
17
  lineHeight?: ResponsiveValue<Media, Theme["lineHeights"] extends {} ? `$${Extract<keyof Theme["lineHeights"], string>}` | CSS["lineHeight"] : CSS["lineHeight"]>;
19
18
  };
20
19
  };
20
+ export declare type BreakpointArray = {
21
+ key: string;
22
+ min: string | null;
23
+ max: string | null;
24
+ }[];
25
+ export declare function parseBreakpoints(names: string[], medias: any): BreakpointArray;
21
26
  interface GridConfig<Theme extends ConfigType.Theme<{}>, Media extends ConfigType.Media<{}>> {
22
27
  columns: number;
23
28
  breakpoints: {
@@ -36,7 +41,49 @@ declare type ResponsiveScale<Media extends ConfigType.Media<{}>, T extends {}> =
36
41
  declare type ResponsiveConfig<Media extends ConfigType.Media<{}>, T extends {}> = {
37
42
  [Scale in keyof T]: ResponsiveScale<Media, T[Scale]>;
38
43
  };
39
- export declare function createStitches<Prefix extends string = "", Media extends {} = {}, Theme extends {} = {}, Responsive extends {} = {}, ThemeMap extends {} = DefaultThemeMap, Utils extends {} = {}, Typography extends {} = {}>(config: {
44
+ declare type ResponsiveAtom = {
45
+ lerpStart: boolean;
46
+ } & ({
47
+ type: "multiplier";
48
+ value: number;
49
+ } | {
50
+ type: "percent";
51
+ value: number;
52
+ } | {
53
+ type: "px";
54
+ value: number;
55
+ } | {
56
+ type: "number";
57
+ value: number;
58
+ } | {
59
+ type: "unknown";
60
+ value: string | number;
61
+ } | {
62
+ type: "undefined";
63
+ });
64
+ export declare type ResponsiveAtomCalc = ResponsiveAtom & {
65
+ defined: boolean;
66
+ breakpoint: string;
67
+ baseBreakpoint: string;
68
+ lastBreakpoint: string;
69
+ lerping?: {
70
+ fromBP: string | null;
71
+ toBP: string | null;
72
+ minMedia: number;
73
+ maxMedia: number;
74
+ minValue: number;
75
+ maxValue: number;
76
+ };
77
+ concreteValue: number | null;
78
+ };
79
+ export declare function parseResponsiveObject(breakpoints: ReturnType<typeof parseBreakpoints>, object: any): ResponsiveAtomCalc[];
80
+ export declare function getResponsiveObjectStyles(breakpoints: ReturnType<typeof parseBreakpoints>, object: any, varName: string, unit?: string): any[];
81
+ export declare function parseResponsiveTokens(theme: any, breakpoints: any): {
82
+ initialResponsive: any;
83
+ globalResponsive: any;
84
+ };
85
+ export declare function createStitches<Prefix extends string = "", Media extends {} = {}, Breakpoints extends (keyof Media)[] = [], Theme extends {} = {}, Responsive extends {} = {}, ThemeMap extends {} = DefaultThemeMap, Utils extends {} = {}, Typography extends {} = {}>(config: {
86
+ breakpoints: Breakpoints;
40
87
  prefix?: ConfigType.Prefix<Prefix>;
41
88
  media: ConfigType.Media<Media>;
42
89
  theme: ConfigType.Theme<Theme>;
@@ -55,12 +102,34 @@ export declare function createStitches<Prefix extends string = "", Media extends
55
102
  themeMap?: ConfigType.ThemeMap<ThemeMap>;
56
103
  utils: ConfigType.Utils<Utils>;
57
104
  }): {
105
+ originalConfig: {
106
+ breakpoints: Breakpoints;
107
+ prefix?: ConfigType.Prefix<Prefix> | undefined;
108
+ media: ConfigType.Media<Media>;
109
+ theme: ConfigType.Theme<Theme>;
110
+ responsive: ResponsiveConfig<Media & {
111
+ initial: string;
112
+ editor: string;
113
+ }, Responsive>;
114
+ typography: TypographyConfig<Theme, Media & {
115
+ initial: string;
116
+ editor: string;
117
+ }, Typography>;
118
+ grid: GridConfig<Theme, Media & {
119
+ initial: string;
120
+ editor: string;
121
+ }>;
122
+ themeMap?: ConfigType.ThemeMap<ThemeMap> | undefined;
123
+ utils: ConfigType.Utils<Utils>;
124
+ };
125
+ breakpoints: BreakpointArray;
58
126
  typeVariants: { [key in keyof TypographyConfig<Theme, Media & {
59
127
  initial: string;
60
128
  editor: string;
61
129
  }, Typography>]: any; };
62
130
  gridVariants: {};
63
131
  responsiveTokens: { [Scale in keyof Responsive]: { [T in keyof Responsive[Scale]]: number; }; };
132
+ responsiveGlobals: any;
64
133
  config: {
65
134
  prefix: "";
66
135
  media: {
@@ -587,7 +656,7 @@ export declare function createStitches<Prefix extends string = "", Media extends
587
656
  } & { [Scale_4 in keyof (Theme & { [Scale_1 in keyof Responsive]: { [T_1 in keyof Responsive[Scale_1]]: string; }; })]: { [Token_2 in keyof (Theme & { [Scale_1 in keyof Responsive]: { [T_1 in keyof Responsive[Scale_1]]: string; }; })[Scale_4]]: import("@stitches/react/types/theme").Token<Extract<Token_2, string | number>, string, Extract<Scale_4, string | void>, "">; }; };
588
657
  reset: () => void;
589
658
  getCssText: () => string;
590
- css: <Composers extends (string | import("react").JSXElementConstructor<any> | import("react").ExoticComponent<any> | import("@stitches/react/types/util").Function | {
659
+ css: <Composers extends (string | import("@stitches/react/types/util").Function | import("react").ExoticComponent<any> | import("react").JSXElementConstructor<any> | {
591
660
  [name: string]: unknown;
592
661
  })[], CSS_1 = import("@stitches/react/types/css-util").CSS<{
593
662
  initial: "";
@@ -710,7 +779,7 @@ export declare function createStitches<Prefix extends string = "", Media extends
710
779
  gridColumn: string;
711
780
  "--grid-columns": number;
712
781
  };
713
- }>>(...composers: { [K_1 in keyof Composers]: Composers[K_1] extends string | import("react").JSXElementConstructor<any> | import("react").ExoticComponent<any> | import("@stitches/react/types/util").Function ? Composers[K_1] : import("@stitches/react/types/stitches").RemoveIndex<CSS_1> & {
782
+ }>>(...composers: { [K_1 in keyof Composers]: Composers[K_1] extends string | import("@stitches/react/types/util").Function | import("react").ExoticComponent<any> | import("react").JSXElementConstructor<any> ? Composers[K_1] : import("@stitches/react/types/stitches").RemoveIndex<CSS_1> & {
714
783
  variants?: {
715
784
  [x: string]: {
716
785
  [x: string]: CSS_1;
@@ -724,7 +793,7 @@ export declare function createStitches<Prefix extends string = "", Media extends
724
793
  } & CSS_1 & { [K2 in keyof Composers[K_1]]: K2 extends "compoundVariants" | "defaultVariants" | "variants" ? unknown : K2 extends keyof CSS_1 ? CSS_1[K2] : unknown; }; }) => import("@stitches/react/types/styled-component").CssComponent<import("@stitches/react/types/styled-component").StyledComponentType<Composers>, import("@stitches/react/types/styled-component").StyledComponentProps<Composers>, {
725
794
  initial: "";
726
795
  } & Media, CSS_1>;
727
- styled: <Type extends import("react").ComponentType<any> | keyof JSX.IntrinsicElements | import("@stitches/react/types/util").Function, Composers_1 extends (string | import("react").ComponentType<any> | import("@stitches/react/types/util").Function | {
796
+ styled: <Type extends import("@stitches/react/types/util").Function | keyof JSX.IntrinsicElements | import("react").ComponentType<any>, Composers_1 extends (string | import("@stitches/react/types/util").Function | import("react").ComponentType<any> | {
728
797
  [name: string]: unknown;
729
798
  })[], CSS_2 = import("@stitches/react/types/css-util").CSS<{
730
799
  initial: "";
@@ -847,7 +916,7 @@ export declare function createStitches<Prefix extends string = "", Media extends
847
916
  gridColumn: string;
848
917
  "--grid-columns": number;
849
918
  };
850
- }>>(type: Type, ...composers: { [K_2 in keyof Composers_1]: Composers_1[K_2] extends string | import("react").ComponentType<any> | import("@stitches/react/types/util").Function ? Composers_1[K_2] : import("@stitches/react/types/stitches").RemoveIndex<CSS_2> & {
919
+ }>>(type: Type, ...composers: { [K_2 in keyof Composers_1]: Composers_1[K_2] extends string | import("@stitches/react/types/util").Function | import("react").ComponentType<any> ? Composers_1[K_2] : import("@stitches/react/types/stitches").RemoveIndex<CSS_2> & {
851
920
  variants?: {
852
921
  [x: string]: {
853
922
  [x: string]: CSS_2;
@@ -11,7 +11,7 @@ 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.createStitches = void 0;
14
+ exports.createStitches = exports.parseResponsiveTokens = exports.getResponsiveObjectStyles = exports.parseResponsiveObject = exports.parseBreakpoints = void 0;
15
15
  var react_1 = require("@stitches/react");
16
16
  var typeKeyMap = {
17
17
  fontSize: "fontSizes",
@@ -20,12 +20,14 @@ var typeKeyMap = {
20
20
  letterSpacing: "letterSpacings",
21
21
  fontWeight: "fontWeights",
22
22
  };
23
- function parseBreakpoints(medias) {
23
+ function parseBreakpoints(names, medias) {
24
24
  var breakpoints = [];
25
25
  // Add an initial breakpoint
26
26
  breakpoints.push({ key: "initial", min: "0px", max: null });
27
27
  // Parse each breakpoint
28
28
  for (var key in medias) {
29
+ if (!names.includes(key))
30
+ continue;
29
31
  var media = medias[key];
30
32
  var minMatch = media.match(/min-width: ([0-9]+[a-z]+)/);
31
33
  var maxMatch = media.match(/max-width: ([0-9]+[a-z]+)/);
@@ -51,6 +53,7 @@ function parseBreakpoints(medias) {
51
53
  }
52
54
  return breakpoints;
53
55
  }
56
+ exports.parseBreakpoints = parseBreakpoints;
54
57
  var unitless = function (value) { return parseFloat(value); };
55
58
  function parseTypography(theme, breakpoints, typography) {
56
59
  var globals = {};
@@ -143,55 +146,157 @@ function parseGrid(theme, media, grid) {
143
146
  "--grid-margin": breakpoint.margin,
144
147
  "--grid-col-width": "calc((var(--grid-inner-width) - (".concat(grid.columns - 1, " * var(--grid-gutter))) / ").concat(grid.columns, ")"),
145
148
  };
146
- // for (let i = 1; i < grid.columns; i++) {
147
- // globalGrid[bpName][
148
- // `--grid-${i}-cols`
149
- // ] = `calc(var(--grid-col-width) * ${i} + var(--grid-gutter) * ${i - 1})`
150
- // }
151
149
  }
152
150
  return { gridVariants: {}, globalGrid: globalGrid };
153
151
  }
154
- function parseResponsiveObject(theme, breakpoints, object, varName, scale) {
155
- var _a;
156
- // Util for grabbing the raw value of a token, for lerping
157
- var resolveValue = function (value) {
158
- if (typeof value === "string" && value.match(/^\$[a-z0-9\-\_]+$/) && scale) {
159
- // Single scale
160
- return theme[scale][value.replace("$", "")];
152
+ function parseResponsiveValue(val) {
153
+ if (Array.isArray(val)) {
154
+ return __assign(__assign({}, parseResponsiveValue(val[0])), { lerpStart: true });
155
+ }
156
+ else if (typeof val === "string") {
157
+ if (val.match(/^x[0-9\.]+$/)) {
158
+ return {
159
+ lerpStart: false,
160
+ type: "multiplier",
161
+ value: parseFloat(val.replace(/^x/, "")),
162
+ };
161
163
  }
162
- else if (typeof value === "number") {
163
- return value + "px";
164
+ else if (val.match(/^[0-9\.]+%$/)) {
165
+ return {
166
+ lerpStart: false,
167
+ type: "percent",
168
+ value: parseFloat(val.replace(/^x/, "")),
169
+ };
164
170
  }
165
- else {
166
- return value;
171
+ else if (val.match(/^[0-9\.]+px$/)) {
172
+ return {
173
+ lerpStart: false,
174
+ type: "px",
175
+ value: parseFloat(val.replace(/px$/, "")),
176
+ };
167
177
  }
178
+ }
179
+ else if (typeof val === "number") {
180
+ return {
181
+ lerpStart: false,
182
+ type: "number",
183
+ value: val,
184
+ };
185
+ }
186
+ else if (val === undefined || val === null) {
187
+ return {
188
+ lerpStart: false,
189
+ type: "undefined",
190
+ };
191
+ }
192
+ return {
193
+ lerpStart: false,
194
+ type: "unknown",
195
+ value: val,
168
196
  };
169
- var globals = {};
170
- var initial = {};
171
- var entries = Object.entries(object);
172
- entries.forEach(function (_a, i) {
173
- var _b;
174
- var bpName = _a[0], responsiveValue = _a[1];
175
- globals[bpName] = {};
176
- if (Array.isArray(responsiveValue)) {
177
- responsiveValue = responsiveValue[0];
178
- // An array in the format [value] signifies font locking between the current breakpoint and the next defined one
179
- var minSize = (_b = breakpoints.find(function (bp) { return "@" + bp.key === bpName; })) === null || _b === void 0 ? void 0 : _b.min;
180
- var nextBreakpoint = breakpoints.find(function (bp) { var _a; return "@" + bp.key === ((_a = entries[i + 1]) === null || _a === void 0 ? void 0 : _a[0]); });
181
- if (!nextBreakpoint)
182
- throw new Error("Cannot create responsive '".concat(varName, "' at breakpoint '").concat(bpName, "', since it is the last-defined breakpoint. Your last size should be a string/number/token."));
183
- var maxSize = nextBreakpoint.min;
184
- var responsiveValue2 = object["@" + nextBreakpoint.key];
185
- if (Array.isArray(responsiveValue2))
186
- responsiveValue2 = responsiveValue2[0];
187
- var size1 = resolveValue(responsiveValue);
188
- var size2 = resolveValue(responsiveValue2);
189
- responsiveValue = "calc(".concat(size1, " + (100vw - ").concat(minSize, ") / (").concat(unitless(maxSize), " - ").concat(unitless(minSize), ") * (").concat(unitless(size2), " - ").concat(unitless(size1), "))");
190
- }
191
- globals[bpName][varName] = responsiveValue;
197
+ }
198
+ function parseResponsiveObject(breakpoints, object) {
199
+ // Breakpoint hash
200
+ var breakpointHash = {};
201
+ for (var _i = 0, breakpoints_1 = breakpoints; _i < breakpoints_1.length; _i++) {
202
+ var bp = breakpoints_1[_i];
203
+ breakpointHash[bp.key] = {
204
+ min: bp.min ? parseFloat(bp.min) : null,
205
+ max: bp.max ? parseFloat(bp.max) : null,
206
+ };
207
+ }
208
+ var result = [];
209
+ var lerpStart = "initial";
210
+ var lastDefined = "initial";
211
+ var concreteValues = {};
212
+ for (var _a = 0, breakpoints_2 = breakpoints; _a < breakpoints_2.length; _a++) {
213
+ var bp = breakpoints_2[_a];
214
+ var value = parseResponsiveValue(object["@" + bp.key]);
215
+ var defined = value.type !== "undefined";
216
+ var base = !defined || value.type === "multiplier" ? lastDefined : bp.key;
217
+ lerpStart = value.lerpStart ? bp.key : lerpStart && !defined ? lerpStart : null;
218
+ if (value.type === "px" || value.type === "number") {
219
+ concreteValues[bp.key] = value.value;
220
+ }
221
+ else if (value.type === "multiplier") {
222
+ concreteValues[bp.key] = value.value * concreteValues[base];
223
+ }
224
+ else if (value.type === "percent") {
225
+ concreteValues[bp.key] = value.value;
226
+ }
227
+ result.push(__assign(__assign({}, value), { defined: defined, breakpoint: bp.key, lastBreakpoint: lastDefined, baseBreakpoint: base, lerping: lerpStart
228
+ ? {
229
+ fromBP: lerpStart,
230
+ toBP: null,
231
+ minMedia: 0,
232
+ maxMedia: 0,
233
+ minValue: 0,
234
+ maxValue: 0,
235
+ }
236
+ : undefined, concreteValue: concreteValues[bp.key] }));
237
+ if (defined) {
238
+ lastDefined = bp.key;
239
+ }
240
+ }
241
+ var nextBreakpoints = [];
242
+ var lastBreakpoint = null;
243
+ for (var i = breakpoints.length - 1; i >= 0; i--) {
244
+ var bp = breakpoints[i];
245
+ nextBreakpoints[i] = lastBreakpoint;
246
+ if (result[i].defined) {
247
+ lastBreakpoint = bp.key;
248
+ }
249
+ }
250
+ result.forEach(function (item, i) {
251
+ if (item.lerping) {
252
+ item.lerping.toBP = nextBreakpoints[i];
253
+ }
192
254
  });
193
- return [globals, (_a = globals["@initial"]) === null || _a === void 0 ? void 0 : _a[varName]];
255
+ result.forEach(function (item, i) {
256
+ var lerp = item.lerping;
257
+ if (lerp) {
258
+ var fromBP = lerp.fromBP ? breakpointHash[lerp.fromBP] : null;
259
+ var toBP = lerp.toBP ? breakpointHash[lerp.toBP] : null;
260
+ if (!fromBP || fromBP.min === null) {
261
+ throw new Error("Cannot create responsive style for first breakpoint");
262
+ }
263
+ if (!toBP || toBP.min === null) {
264
+ throw new Error("Cannot create responsive style for last breakpoint");
265
+ }
266
+ lerp.minMedia = fromBP.min;
267
+ lerp.maxMedia = toBP.min;
268
+ lerp.minValue = item.concreteValue;
269
+ lerp.maxValue = result.find(function (o) { return o.breakpoint === lerp.toBP; }).concreteValue;
270
+ }
271
+ });
272
+ return result;
273
+ }
274
+ exports.parseResponsiveObject = parseResponsiveObject;
275
+ function getResponsiveObjectStyles(breakpoints, object, varName, unit) {
276
+ var _a, _b;
277
+ var _c;
278
+ if (unit === void 0) { unit = "px"; }
279
+ // Prescale object
280
+ object = __assign({}, object);
281
+ var parsed = parseResponsiveObject(breakpoints, object);
282
+ var globals = {};
283
+ for (var _i = 0, parsed_1 = parsed; _i < parsed_1.length; _i++) {
284
+ var atom = parsed_1[_i];
285
+ if (atom.lerpStart && atom.lerping) {
286
+ var lerp = atom.lerping;
287
+ globals["@" + atom.breakpoint] = (_a = {},
288
+ _a[varName] = "calc(".concat(lerp.minValue).concat(unit, " + (100vw - ").concat(lerp.minMedia).concat(unit, ") / (").concat(lerp.maxMedia, " - ").concat(lerp.minMedia, ") * (").concat(lerp.maxValue, " - ").concat(lerp.minValue, "))"),
289
+ _a);
290
+ }
291
+ else if (atom.concreteValue) {
292
+ globals["@" + atom.breakpoint] = (_b = {},
293
+ _b[varName] = atom.concreteValue + unit,
294
+ _b);
295
+ }
296
+ }
297
+ return [globals, (_c = globals["@initial"]) === null || _c === void 0 ? void 0 : _c[varName]];
194
298
  }
299
+ exports.getResponsiveObjectStyles = getResponsiveObjectStyles;
195
300
  // parseResponsiveTokens({'@initial': blah, '@desktop': blah}, breakpoints, )
196
301
  function parseResponsiveTokens(theme, breakpoints) {
197
302
  var globalResponsive = {
@@ -204,7 +309,7 @@ function parseResponsiveTokens(theme, breakpoints) {
204
309
  for (var key in theme[scale]) {
205
310
  var val = theme[scale][key];
206
311
  if (val && typeof val === "object") {
207
- var _a = parseResponsiveObject(theme, breakpoints, val, "--" + scale + "-" + key, scale), tokenGlobals = _a[0], initial = _a[1];
312
+ var _a = getResponsiveObjectStyles(breakpoints, val, "--" + scale + "-" + key), tokenGlobals = _a[0], initial = _a[1];
208
313
  for (var bp in tokenGlobals) {
209
314
  globalResponsive[bp] = __assign(__assign({}, globalResponsive[bp]), tokenGlobals[bp]);
210
315
  }
@@ -217,8 +322,9 @@ function parseResponsiveTokens(theme, breakpoints) {
217
322
  }
218
323
  return { initialResponsive: initialResponsive, globalResponsive: globalResponsive };
219
324
  }
325
+ exports.parseResponsiveTokens = parseResponsiveTokens;
220
326
  function createStitches(config) {
221
- var breakpoints = parseBreakpoints(config.media);
327
+ var breakpoints = parseBreakpoints(config.breakpoints, config.media);
222
328
  var _a = parseTypography(config.theme, breakpoints, config.typography), typeVariants = _a.typeVariants, globalTypography = _a.globalTypography;
223
329
  var _b = parseGrid(config.theme, config.media, config.grid), gridVariants = _b.gridVariants, globalGrid = _b.globalGrid;
224
330
  var _c = parseResponsiveTokens(config.responsive, breakpoints), initialResponsive = _c.initialResponsive, globalResponsive = _c.globalResponsive;
@@ -309,6 +415,6 @@ function createStitches(config) {
309
415
  });
310
416
  stitches.globalCss(responsiveGlobals)();
311
417
  var responsiveTokens = {};
312
- return __assign(__assign({}, stitches), { typeVariants: typeVariants, gridVariants: gridVariants, responsiveTokens: responsiveTokens });
418
+ return __assign(__assign({}, stitches), { originalConfig: config, breakpoints: breakpoints, typeVariants: typeVariants, gridVariants: gridVariants, responsiveTokens: responsiveTokens, responsiveGlobals: responsiveGlobals });
313
419
  }
314
420
  exports.createStitches = createStitches;
@@ -1,4 +1,4 @@
1
- export declare function getRepoName(dir: string): Promise<{
1
+ export declare function getRepoName(dir: string): {
2
2
  repoName: string | undefined;
3
3
  themeName: string;
4
- }>;
4
+ };
@@ -1,62 +1,24 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (_) try {
18
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
39
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
40
4
  };
41
5
  Object.defineProperty(exports, "__esModule", { value: true });
42
6
  exports.getRepoName = void 0;
43
- var git_remote_origin_url_1 = __importDefault(require("git-remote-origin-url"));
7
+ var git_repo_name_1 = __importDefault(require("git-repo-name"));
44
8
  var path_1 = __importDefault(require("path"));
45
9
  function getRepoName(dir) {
46
- var _a;
47
- return __awaiter(this, void 0, void 0, function () {
48
- var info;
49
- return __generator(this, function (_b) {
50
- switch (_b.label) {
51
- case 0: return [4 /*yield*/, (0, git_remote_origin_url_1.default)(dir)];
52
- case 1:
53
- info = _b.sent();
54
- return [2 /*return*/, {
55
- repoName: (_a = info.match(/([^\/]+).git$/)) === null || _a === void 0 ? void 0 : _a[1],
56
- themeName: path_1.default.basename(dir),
57
- }];
58
- }
59
- });
60
- });
10
+ if (process.env.VERCEL) {
11
+ return {
12
+ repoName: process.env.VERCEL_GIT_REPO_SLUG,
13
+ themeName: process.env.VERCEL_GIT_REPO_SLUG,
14
+ };
15
+ }
16
+ else {
17
+ var info = git_repo_name_1.default.sync(dir);
18
+ return {
19
+ repoName: info || "",
20
+ themeName: path_1.default.basename(dir),
21
+ };
22
+ }
61
23
  }
62
24
  exports.getRepoName = getRepoName;
File without changes
@@ -1 +0,0 @@
1
- "use strict";
@@ -1,8 +0,0 @@
1
- /// <reference types="react" />
2
- declare type Props = {
3
- previewSize: string;
4
- value: number;
5
- onChange: (value: number | null) => void;
6
- };
7
- export declare function ImageWell(props: Props): JSX.Element;
8
- export {};
@@ -1,64 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ImageWell = void 0;
4
- var jsx_runtime_1 = require("react/jsx-runtime");
5
- var react_1 = require("@stitches/react");
6
- var react_2 = require("react");
7
- function ImageWell(props) {
8
- var _a = (0, react_2.useState)(null), selectedImage = _a[0], setSelectedImage = _a[1];
9
- var _b = (0, react_2.useState)(false), imageIsLoading = _b[0], setImageIsLoading = _b[1];
10
- (0, react_2.useEffect)(function () {
11
- if (props.value) {
12
- var cancelled = false;
13
- setImageIsLoading(true);
14
- fetch("/wp-json/ed/v1/media/" + Number(props.value))
15
- .then(function (response) { return response.json(); })
16
- .then(function (image) {
17
- setImageIsLoading(false);
18
- setSelectedImage(image);
19
- });
20
- }
21
- }, [props.value]);
22
- return ((0, jsx_runtime_1.jsxs)(Wrapper, { children: [imageIsLoading ? ((0, jsx_runtime_1.jsx)(Loading, { children: (0, jsx_runtime_1.jsx)(Spinner, {}, void 0) }, void 0)) : selectedImage ? ((0, jsx_runtime_1.jsx)(ImageContainer, { children: (0, jsx_runtime_1.jsx)("img", { src: selectedImage.sizes[props.previewSize] || selectedImage.sizes["thumbnail"] }, void 0) }, void 0)) : null, (0, jsx_runtime_1.jsx)(Toolbar, { children: selectedImage || imageIsLoading ? ((0, jsx_runtime_1.jsxs)(react_2.Fragment, { children: [(0, jsx_runtime_1.jsx)(Button, { children: "Remove" }, void 0), (0, jsx_runtime_1.jsx)(Button, { children: "Edit" }, void 0), (0, jsx_runtime_1.jsx)(Button, { children: "View" }, void 0)] }, void 0)) : null }, void 0)] }, void 0));
23
- }
24
- exports.ImageWell = ImageWell;
25
- var Wrapper = (0, react_1.styled)("div", {
26
- position: "relative",
27
- display: "block",
28
- width: "100%",
29
- border: "1px solid #aaaaaa",
30
- });
31
- var ImageContainer = (0, react_1.styled)("div", {
32
- padding: "4px",
33
- img: {
34
- maxWidth: "100%",
35
- },
36
- });
37
- var spin = (0, react_1.keyframes)({
38
- from: {
39
- transform: "rotate(0deg)",
40
- },
41
- to: {
42
- transform: "rotate(360deg)",
43
- },
44
- });
45
- var Spinner = (0, react_1.styled)("div", {
46
- display: "block",
47
- width: "32px",
48
- height: "32px",
49
- border: "4px solid transparent",
50
- borderTop: "currentColor",
51
- animation: "".concat(spin, " 1s linear infinite"),
52
- });
53
- var Loading = (0, react_1.styled)("div", {
54
- display: "flex",
55
- justifyContent: "center",
56
- alignItems: "center",
57
- padding: "8px",
58
- });
59
- var Toolbar = (0, react_1.styled)("div", {
60
- position: "absolute",
61
- top: 0,
62
- right: 0,
63
- padding: "4px",
64
- });